ccdeck 3.22.15 → 3.23.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.
Files changed (51) hide show
  1. package/README.md +53 -10
  2. package/THIRD_PARTY_NOTICES.md +123 -15
  3. package/bin/deck.js +264 -21
  4. package/dist/web/assets/BrowserWatchModal-DD6srgsk.js +1 -0
  5. package/dist/web/assets/UsageHistoryModal-zExZpRWU.js +1 -0
  6. package/dist/web/assets/index-Bf-qcZ6x.css +1 -0
  7. package/dist/web/assets/index-Dsca2TwS.js +296 -0
  8. package/dist/web/index.html +9 -5
  9. package/hook/hook.js +631 -99
  10. package/package.json +1 -1
  11. package/release-notes.json +62 -1
  12. package/src/server/activity.mjs +42 -4
  13. package/src/server/args.mjs +30 -4
  14. package/src/server/browser-history.mjs +164 -38
  15. package/src/server/browser-presence.mjs +60 -0
  16. package/src/server/browser-react.mjs +160 -7
  17. package/src/server/browser-watch-store.mjs +319 -17
  18. package/src/server/browser-watch.mjs +304 -60
  19. package/src/server/ccusage.mjs +20 -4
  20. package/src/server/claude-accounts.mjs +79 -34
  21. package/src/server/claude-identity.mjs +121 -0
  22. package/src/server/cswap-admin.mjs +160 -133
  23. package/src/server/cswap-auto.mjs +86 -7
  24. package/src/server/cswap-install.mjs +280 -43
  25. package/src/server/deck-home.mjs +1 -1
  26. package/src/server/deck-prefs.mjs +244 -36
  27. package/src/server/deck-probe.mjs +1 -1
  28. package/src/server/exec.mjs +84 -3
  29. package/src/server/global-install.mjs +13 -0
  30. package/src/server/index.mjs +1454 -184
  31. package/src/server/installer.mjs +136 -8
  32. package/src/server/lan-about.mjs +8 -3
  33. package/src/server/lan-engine.mjs +335 -47
  34. package/src/server/lan-socket.mjs +384 -57
  35. package/src/server/lan-sync.mjs +472 -22
  36. package/src/server/log-writer.mjs +575 -2
  37. package/src/server/login-service.mjs +31 -4
  38. package/src/server/open-url.mjs +22 -2
  39. package/src/server/output-watch.mjs +59 -8
  40. package/src/server/purge-key.mjs +135 -0
  41. package/src/server/quota.mjs +112 -7
  42. package/src/server/running-deck.mjs +15 -1
  43. package/src/server/self-update.mjs +98 -4
  44. package/src/server/session-recap.mjs +89 -0
  45. package/src/server/static-cache.mjs +67 -0
  46. package/src/server/stop-deck.mjs +2 -2
  47. package/src/server/store-lock.mjs +51 -0
  48. package/src/server/supervisor.mjs +1 -1
  49. package/src/server/system-metrics.mjs +143 -17
  50. package/dist/web/assets/index-BYqkKWPC.js +0 -274
  51. package/dist/web/assets/index-s_dF8YYA.css +0 -1
@@ -0,0 +1,296 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const c of i.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var zu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bf={exports:{}},Fl={},zf={exports:{}},st={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var ak;function YM(){if(ak)return st;ak=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=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($){return $===null||typeof $!="object"?null:($=m&&$[m]||$["@@iterator"],typeof $=="function"?$:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,_={};function j($,V,he){this.props=$,this.context=V,this.refs=_,this.updater=he||w}j.prototype.isReactComponent={},j.prototype.setState=function($,V){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,V,"setState")},j.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function k(){}k.prototype=j.prototype;function S($,V,he){this.props=$,this.context=V,this.refs=_,this.updater=he||w}var E=S.prototype=new k;E.constructor=S,N(E,j.prototype),E.isPureReactComponent=!0;var C=Array.isArray,T=Object.prototype.hasOwnProperty,R={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function F($,V,he){var Y,J={},z=null,re=null;if(V!=null)for(Y in V.ref!==void 0&&(re=V.ref),V.key!==void 0&&(z=""+V.key),V)T.call(V,Y)&&!I.hasOwnProperty(Y)&&(J[Y]=V[Y]);var le=arguments.length-2;if(le===1)J.children=he;else if(1<le){for(var me=Array(le),ge=0;ge<le;ge++)me[ge]=arguments[ge+2];J.children=me}if($&&$.defaultProps)for(Y in le=$.defaultProps,le)J[Y]===void 0&&(J[Y]=le[Y]);return{$$typeof:e,type:$,key:z,ref:re,props:J,_owner:R.current}}function W($,V){return{$$typeof:e,type:$.type,key:V,ref:$.ref,props:$.props,_owner:$._owner}}function O($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function B($){var V={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(he){return V[he]})}var Z=/\/+/g;function Q($,V){return typeof $=="object"&&$!==null&&$.key!=null?B(""+$.key):V.toString(36)}function M($,V,he,Y,J){var z=typeof $;(z==="undefined"||z==="boolean")&&($=null);var re=!1;if($===null)re=!0;else switch(z){case"string":case"number":re=!0;break;case"object":switch($.$$typeof){case e:case t:re=!0}}if(re)return re=$,J=J(re),$=Y===""?"."+Q(re,0):Y,C(J)?(he="",$!=null&&(he=$.replace(Z,"$&/")+"/"),M(J,V,he,"",function(ge){return ge})):J!=null&&(O(J)&&(J=W(J,he+(!J.key||re&&re.key===J.key?"":(""+J.key).replace(Z,"$&/")+"/")+$)),V.push(J)),1;if(re=0,Y=Y===""?".":Y+":",C($))for(var le=0;le<$.length;le++){z=$[le];var me=Y+Q(z,le);re+=M(z,V,he,me,J)}else if(me=y($),typeof me=="function")for($=me.call($),le=0;!(z=$.next()).done;)z=z.value,me=Y+Q(z,le++),re+=M(z,V,he,me,J);else if(z==="object")throw V=String($),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return re}function K($,V,he){if($==null)return $;var Y=[],J=0;return M($,Y,"","",function(z){return V.call(he,z,J++)}),Y}function G($){if($._status===-1){var V=$._result;V=V(),V.then(function(he){($._status===0||$._status===-1)&&($._status=1,$._result=he)},function(he){($._status===0||$._status===-1)&&($._status=2,$._result=he)}),$._status===-1&&($._status=0,$._result=V)}if($._status===1)return $._result.default;throw $._result}var P={current:null},H={transition:null},L={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:H,ReactCurrentOwner:R};function U(){throw Error("act(...) is not supported in production builds of React.")}return st.Children={map:K,forEach:function($,V,he){K($,function(){V.apply(this,arguments)},he)},count:function($){var V=0;return K($,function(){V++}),V},toArray:function($){return K($,function(V){return V})||[]},only:function($){if(!O($))throw Error("React.Children.only expected to receive a single React element child.");return $}},st.Component=j,st.Fragment=n,st.Profiler=a,st.PureComponent=S,st.StrictMode=s,st.Suspense=f,st.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=L,st.act=U,st.cloneElement=function($,V,he){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var Y=N({},$.props),J=$.key,z=$.ref,re=$._owner;if(V!=null){if(V.ref!==void 0&&(z=V.ref,re=R.current),V.key!==void 0&&(J=""+V.key),$.type&&$.type.defaultProps)var le=$.type.defaultProps;for(me in V)T.call(V,me)&&!I.hasOwnProperty(me)&&(Y[me]=V[me]===void 0&&le!==void 0?le[me]:V[me])}var me=arguments.length-2;if(me===1)Y.children=he;else if(1<me){le=Array(me);for(var ge=0;ge<me;ge++)le[ge]=arguments[ge+2];Y.children=le}return{$$typeof:e,type:$.type,key:J,ref:z,props:Y,_owner:re}},st.createContext=function($){return $={$$typeof:c,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:i,_context:$},$.Consumer=$},st.createElement=F,st.createFactory=function($){var V=F.bind(null,$);return V.type=$,V},st.createRef=function(){return{current:null}},st.forwardRef=function($){return{$$typeof:u,render:$}},st.isValidElement=O,st.lazy=function($){return{$$typeof:h,_payload:{_status:-1,_result:$},_init:G}},st.memo=function($,V){return{$$typeof:p,type:$,compare:V===void 0?null:V}},st.startTransition=function($){var V=H.transition;H.transition={};try{$()}finally{H.transition=V}},st.unstable_act=U,st.useCallback=function($,V){return P.current.useCallback($,V)},st.useContext=function($){return P.current.useContext($)},st.useDebugValue=function(){},st.useDeferredValue=function($){return P.current.useDeferredValue($)},st.useEffect=function($,V){return P.current.useEffect($,V)},st.useId=function(){return P.current.useId()},st.useImperativeHandle=function($,V,he){return P.current.useImperativeHandle($,V,he)},st.useInsertionEffect=function($,V){return P.current.useInsertionEffect($,V)},st.useLayoutEffect=function($,V){return P.current.useLayoutEffect($,V)},st.useMemo=function($,V){return P.current.useMemo($,V)},st.useReducer=function($,V,he){return P.current.useReducer($,V,he)},st.useRef=function($){return P.current.useRef($)},st.useState=function($){return P.current.useState($)},st.useSyncExternalStore=function($,V,he){return P.current.useSyncExternalStore($,V,he)},st.useTransition=function(){return P.current.useTransition()},st.version="18.3.1",st}var ok;function bc(){return ok||(ok=1,zf.exports=YM()),zf.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 ik;function KM(){if(ik)return Fl;ik=1;var e=bc(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(u,f,p){var h,m={},y=null,w=null;p!==void 0&&(y=""+p),f.key!==void 0&&(y=""+f.key),f.ref!==void 0&&(w=f.ref);for(h in f)s.call(f,h)&&!i.hasOwnProperty(h)&&(m[h]=f[h]);if(u&&u.defaultProps)for(h in f=u.defaultProps,f)m[h]===void 0&&(m[h]=f[h]);return{$$typeof:t,type:u,key:y,ref:w,props:m,_owner:a.current}}return Fl.Fragment=n,Fl.jsx=c,Fl.jsxs=c,Fl}var lk;function XM(){return lk||(lk=1,Bf.exports=KM()),Bf.exports}var l=XM(),Uu={},Uf={exports:{}},In={},Wf={exports:{}},Hf={};/**
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 ck;function ZM(){return ck||(ck=1,(function(e){function t(H,L){var U=H.length;H.push(L);e:for(;0<U;){var $=U-1>>>1,V=H[$];if(0<a(V,L))H[$]=L,H[U]=V,U=$;else break e}}function n(H){return H.length===0?null:H[0]}function s(H){if(H.length===0)return null;var L=H[0],U=H.pop();if(U!==L){H[0]=U;e:for(var $=0,V=H.length,he=V>>>1;$<he;){var Y=2*($+1)-1,J=H[Y],z=Y+1,re=H[z];if(0>a(J,U))z<V&&0>a(re,J)?(H[$]=re,H[z]=U,$=z):(H[$]=J,H[Y]=U,$=Y);else if(z<V&&0>a(re,U))H[$]=re,H[z]=U,$=z;else break e}}return L}function a(H,L){var U=H.sortIndex-L.sortIndex;return U!==0?U:H.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var f=[],p=[],h=1,m=null,y=3,w=!1,N=!1,_=!1,j=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(H){for(var L=n(p);L!==null;){if(L.callback===null)s(p);else if(L.startTime<=H)s(p),L.sortIndex=L.expirationTime,t(f,L);else break;L=n(p)}}function C(H){if(_=!1,E(H),!N)if(n(f)!==null)N=!0,G(T);else{var L=n(p);L!==null&&P(C,L.startTime-H)}}function T(H,L){N=!1,_&&(_=!1,k(F),F=-1),w=!0;var U=y;try{for(E(L),m=n(f);m!==null&&(!(m.expirationTime>L)||H&&!B());){var $=m.callback;if(typeof $=="function"){m.callback=null,y=m.priorityLevel;var V=$(m.expirationTime<=L);L=e.unstable_now(),typeof V=="function"?m.callback=V:m===n(f)&&s(f),E(L)}else s(f);m=n(f)}if(m!==null)var he=!0;else{var Y=n(p);Y!==null&&P(C,Y.startTime-L),he=!1}return he}finally{m=null,y=U,w=!1}}var R=!1,I=null,F=-1,W=5,O=-1;function B(){return!(e.unstable_now()-O<W)}function Z(){if(I!==null){var H=e.unstable_now();O=H;var L=!0;try{L=I(!0,H)}finally{L?Q():(R=!1,I=null)}}else R=!1}var Q;if(typeof S=="function")Q=function(){S(Z)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,K=M.port2;M.port1.onmessage=Z,Q=function(){K.postMessage(null)}}else Q=function(){j(Z,0)};function G(H){I=H,R||(R=!0,Q())}function P(H,L){F=j(function(){H(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(H){H.callback=null},e.unstable_continueExecution=function(){N||w||(N=!0,G(T))},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(H){switch(y){case 1:case 2:case 3:var L=3;break;default:L=y}var U=y;y=L;try{return H()}finally{y=U}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(H,L){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var U=y;y=H;try{return L()}finally{y=U}},e.unstable_scheduleCallback=function(H,L,U){var $=e.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?$+U:$):U=$,H){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=U+V,H={id:h++,callback:L,priorityLevel:H,startTime:U,expirationTime:V,sortIndex:-1},U>$?(H.sortIndex=U,t(p,H),n(f)===null&&H===n(p)&&(_?(k(F),F=-1):_=!0,P(C,U-$))):(H.sortIndex=V,t(f,H),N||w||(N=!0,G(T))),H},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(H){var L=y;return function(){var U=y;y=L;try{return H.apply(this,arguments)}finally{y=U}}}})(Hf)),Hf}var uk;function QM(){return uk||(uk=1,Wf.exports=ZM()),Wf.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 dk;function JM(){if(dk)return In;dk=1;var e=bc(),t=QM();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,d=1;d<arguments.length;d++)o+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,a={};function i(r,o){c(r,o),c(r+"Capture",o)}function c(r,o){for(a[r]=o,r=0;r<o.length;r++)s.add(o[r])}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(r){return f.call(m,r)?!0:f.call(h,r)?!1:p.test(r)?m[r]=!0:(h[r]=!0,!1)}function w(r,o,d,g){if(d!==null&&d.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return g?!1:d!==null?!d.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function N(r,o,d,g){if(o===null||typeof o>"u"||w(r,o,d,g))return!0;if(g)return!1;if(d!==null)switch(d.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function _(r,o,d,g,v,b,A){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=g,this.attributeNamespace=v,this.mustUseProperty=d,this.propertyName=r,this.type=o,this.sanitizeURL=b,this.removeEmptyString=A}var j={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){j[r]=new _(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];j[o]=new _(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){j[r]=new _(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){j[r]=new _(r,2,!1,r,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(r){j[r]=new _(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){j[r]=new _(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){j[r]=new _(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){j[r]=new _(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){j[r]=new _(r,5,!1,r.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function S(r){return r[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(r){var o=r.replace(k,S);j[o]=new _(o,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var o=r.replace(k,S);j[o]=new _(o,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var o=r.replace(k,S);j[o]=new _(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){j[r]=new _(r,1,!1,r.toLowerCase(),null,!1,!1)}),j.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){j[r]=new _(r,1,!1,r.toLowerCase(),null,!0,!0)});function E(r,o,d,g){var v=j.hasOwnProperty(o)?j[o]:null;(v!==null?v.type!==0:g||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(N(o,d,v,g)&&(d=null),g||v===null?y(o)&&(d===null?r.removeAttribute(o):r.setAttribute(o,""+d)):v.mustUseProperty?r[v.propertyName]=d===null?v.type===3?!1:"":d:(o=v.attributeName,g=v.attributeNamespace,d===null?r.removeAttribute(o):(v=v.type,d=v===3||v===4&&d===!0?"":""+d,g?r.setAttributeNS(g,o,d):r.setAttribute(o,d))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),R=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),W=Symbol.for("react.profiler"),O=Symbol.for("react.provider"),B=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),P=Symbol.for("react.offscreen"),H=Symbol.iterator;function L(r){return r===null||typeof r!="object"?null:(r=H&&r[H]||r["@@iterator"],typeof r=="function"?r:null)}var U=Object.assign,$;function V(r){if($===void 0)try{throw Error()}catch(d){var o=d.stack.trim().match(/\n( *(at )?)/);$=o&&o[1]||""}return`
34
+ `+$+r}var he=!1;function Y(r,o){if(!r||he)return"";he=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(de){var g=de}Reflect.construct(r,[],o)}else{try{o.call()}catch(de){g=de}r.call(o.prototype)}else{try{throw Error()}catch(de){g=de}r()}}catch(de){if(de&&g&&typeof de.stack=="string"){for(var v=de.stack.split(`
35
+ `),b=g.stack.split(`
36
+ `),A=v.length-1,X=b.length-1;1<=A&&0<=X&&v[A]!==b[X];)X--;for(;1<=A&&0<=X;A--,X--)if(v[A]!==b[X]){if(A!==1||X!==1)do if(A--,X--,0>X||v[A]!==b[X]){var ne=`
37
+ `+v[A].replace(" at new "," at ");return r.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",r.displayName)),ne}while(1<=A&&0<=X);break}}}finally{he=!1,Error.prepareStackTrace=d}return(r=r?r.displayName||r.name:"")?V(r):""}function J(r){switch(r.tag){case 5:return V(r.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return r=Y(r.type,!1),r;case 11:return r=Y(r.type.render,!1),r;case 1:return r=Y(r.type,!0),r;default:return""}}function z(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case I:return"Fragment";case R:return"Portal";case W:return"Profiler";case F:return"StrictMode";case Q:return"Suspense";case M:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case B:return(r.displayName||"Context")+".Consumer";case O:return(r._context.displayName||"Context")+".Provider";case Z:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case K:return o=r.displayName||null,o!==null?o:z(r.type)||"Memo";case G:o=r._payload,r=r._init;try{return z(r(o))}catch{}}return null}function re(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return z(o);case 8:return o===F?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function le(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function me(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function ge(r){var o=me(r)?"checked":"value",d=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),g=""+r[o];if(!r.hasOwnProperty(o)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,b=d.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return v.call(this)},set:function(A){g=""+A,b.call(this,A)}}),Object.defineProperty(r,o,{enumerable:d.enumerable}),{getValue:function(){return g},setValue:function(A){g=""+A},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Me(r){r._valueTracker||(r._valueTracker=ge(r))}function qe(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var d=o.getValue(),g="";return r&&(g=me(r)?r.checked?"true":"false":r.value),r=g,r!==d?(o.setValue(r),!0):!1}function Ve(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Ue(r,o){var d=o.checked;return U({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??r._wrapperState.initialChecked})}function Se(r,o){var d=o.defaultValue==null?"":o.defaultValue,g=o.checked!=null?o.checked:o.defaultChecked;d=le(o.value!=null?o.value:d),r._wrapperState={initialChecked:g,initialValue:d,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function Qe(r,o){o=o.checked,o!=null&&E(r,"checked",o,!1)}function Ne(r,o){Qe(r,o);var d=le(o.value),g=o.type;if(d!=null)g==="number"?(d===0&&r.value===""||r.value!=d)&&(r.value=""+d):r.value!==""+d&&(r.value=""+d);else if(g==="submit"||g==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?ue(r,o.type,d):o.hasOwnProperty("defaultValue")&&ue(r,o.type,le(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function _e(r,o,d){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var g=o.type;if(!(g!=="submit"&&g!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,d||o===r.value||(r.value=o),r.defaultValue=o}d=r.name,d!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,d!==""&&(r.name=d)}function ue(r,o,d){(o!=="number"||Ve(r.ownerDocument)!==r)&&(d==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+d&&(r.defaultValue=""+d))}var je=Array.isArray;function Ce(r,o,d,g){if(r=r.options,o){o={};for(var v=0;v<d.length;v++)o["$"+d[v]]=!0;for(d=0;d<r.length;d++)v=o.hasOwnProperty("$"+r[d].value),r[d].selected!==v&&(r[d].selected=v),v&&g&&(r[d].defaultSelected=!0)}else{for(d=""+le(d),o=null,v=0;v<r.length;v++){if(r[v].value===d){r[v].selected=!0,g&&(r[v].defaultSelected=!0);return}o!==null||r[v].disabled||(o=r[v])}o!==null&&(o.selected=!0)}}function Fe(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return U({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function We(r,o){var d=o.value;if(d==null){if(d=o.children,o=o.defaultValue,d!=null){if(o!=null)throw Error(n(92));if(je(d)){if(1<d.length)throw Error(n(93));d=d[0]}o=d}o==null&&(o=""),d=o}r._wrapperState={initialValue:le(d)}}function He(r,o){var d=le(o.value),g=le(o.defaultValue);d!=null&&(d=""+d,d!==r.value&&(r.value=d),o.defaultValue==null&&r.defaultValue!==d&&(r.defaultValue=d)),g!=null&&(r.defaultValue=""+g)}function ot(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function wt(r){switch(r){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 ut(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?wt(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var ee,ke=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,d,g,v){MSApp.execUnsafeLocalFunction(function(){return r(o,d,g,v)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(ee=ee||document.createElement("div"),ee.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=ee.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function Be(r,o){if(o){var d=r.firstChild;if(d&&d===r.lastChild&&d.nodeType===3){d.nodeValue=o;return}}r.textContent=o}var et={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},ht=["Webkit","ms","Moz","O"];Object.keys(et).forEach(function(r){ht.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),et[o]=et[r]})});function Je(r,o,d){return o==null||typeof o=="boolean"||o===""?"":d||typeof o!="number"||o===0||et.hasOwnProperty(r)&&et[r]?(""+o).trim():o+"px"}function tt(r,o){r=r.style;for(var d in o)if(o.hasOwnProperty(d)){var g=d.indexOf("--")===0,v=Je(d,o[d],g);d==="float"&&(d="cssFloat"),g?r.setProperty(d,v):r[d]=v}}var it=U({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function bt(r,o){if(o){if(it[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function nt(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){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 pt=null;function fe(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var lt=null,vt=null,Gt=null;function Dt(r){if(r=Sl(r)){if(typeof lt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=ru(o),lt(r.stateNode,r.type,o))}}function Gn(r){vt?Gt?Gt.push(r):Gt=[r]:vt=r}function It(){if(vt){var r=vt,o=Gt;if(Gt=vt=null,Dt(r),o)for(r=0;r<o.length;r++)Dt(o[r])}}function Vn(r,o){return r(o)}function Yn(){}var qt=!1;function Kn(r,o,d){if(qt)return r(o,d);qt=!0;try{return Vn(r,o,d)}finally{qt=!1,(vt!==null||Gt!==null)&&(Yn(),It())}}function te(r,o){var d=r.stateNode;if(d===null)return null;var g=ru(d);if(g===null)return null;d=g[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(r=r.type,g=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!g;break e;default:r=!1}if(r)return null;if(d&&typeof d!="function")throw Error(n(231,o,typeof d));return d}var Ae=!1;if(u)try{var Oe={};Object.defineProperty(Oe,"passive",{get:function(){Ae=!0}}),window.addEventListener("test",Oe,Oe),window.removeEventListener("test",Oe,Oe)}catch{Ae=!1}function Re(r,o,d,g,v,b,A,X,ne){var de=Array.prototype.slice.call(arguments,3);try{o.apply(d,de)}catch(we){this.onError(we)}}var Le=!1,ct=null,Ct=!1,yt=null,Zr={onError:function(r){Le=!0,ct=r}};function kt(r,o,d,g,v,b,A,X,ne){Le=!1,ct=null,Re.apply(Zr,arguments)}function Jt(r,o,d,g,v,b,A,X,ne){if(kt.apply(this,arguments),Le){if(Le){var de=ct;Le=!1,ct=null}else throw Error(n(198));Ct||(Ct=!0,yt=de)}}function rn(r){var o=r,d=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(d=o.return),r=o.return;while(r)}return o.tag===3?d:null}function $r(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function ko(r){if(rn(r)!==r)throw Error(n(188))}function Ki(r){var o=r.alternate;if(!o){if(o=rn(r),o===null)throw Error(n(188));return o!==r?null:r}for(var d=r,g=o;;){var v=d.return;if(v===null)break;var b=v.alternate;if(b===null){if(g=v.return,g!==null){d=g;continue}break}if(v.child===b.child){for(b=v.child;b;){if(b===d)return ko(v),r;if(b===g)return ko(v),o;b=b.sibling}throw Error(n(188))}if(d.return!==g.return)d=v,g=b;else{for(var A=!1,X=v.child;X;){if(X===d){A=!0,d=v,g=b;break}if(X===g){A=!0,g=v,d=b;break}X=X.sibling}if(!A){for(X=b.child;X;){if(X===d){A=!0,d=b,g=v;break}if(X===g){A=!0,g=b,d=v;break}X=X.sibling}if(!A)throw Error(n(189))}}if(d.alternate!==g)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?r:o}function ua(r){return r=Ki(r),r!==null?da(r):null}function da(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=da(r);if(o!==null)return o;r=r.sibling}return null}var ha=t.unstable_scheduleCallback,_s=t.unstable_cancelCallback,fa=t.unstable_shouldYield,pa=t.unstable_requestPaint,St=t.unstable_now,Xi=t.unstable_getCurrentPriorityLevel,Ns=t.unstable_ImmediatePriority,_o=t.unstable_UserBlockingPriority,Or=t.unstable_NormalPriority,ma=t.unstable_LowPriority,No=t.unstable_IdlePriority,dr=null,vn=null;function Pr(r){if(vn&&typeof vn.onCommitFiberRoot=="function")try{vn.onCommitFiberRoot(dr,r,void 0,(r.current.flags&128)===128)}catch{}}var jn=Math.clz32?Math.clz32:Sh,Oc=Math.log,ga=Math.LN2;function Sh(r){return r>>>=0,r===0?32:31-(Oc(r)/ga|0)|0}var ya=64,wa=4194304;function va(r){switch(r&-r){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 r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function xa(r,o){var d=r.pendingLanes;if(d===0)return 0;var g=0,v=r.suspendedLanes,b=r.pingedLanes,A=d&268435455;if(A!==0){var X=A&~v;X!==0?g=va(X):(b&=A,b!==0&&(g=va(b)))}else A=d&~v,A!==0?g=va(A):b!==0&&(g=va(b));if(g===0)return 0;if(o!==0&&o!==g&&(o&v)===0&&(v=g&-g,b=o&-o,v>=b||v===16&&(b&4194240)!==0))return o;if((g&4)!==0&&(g|=d&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=g;0<o;)d=31-jn(o),v=1<<d,g|=r[d],o&=~v;return g}function ba(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jh(r,o){for(var d=r.suspendedLanes,g=r.pingedLanes,v=r.expirationTimes,b=r.pendingLanes;0<b;){var A=31-jn(b),X=1<<A,ne=v[A];ne===-1?((X&d)===0||(X&g)!==0)&&(v[A]=ba(X,o)):ne<=o&&(r.expiredLanes|=X),b&=~X}}function So(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function En(){var r=ya;return ya<<=1,(ya&4194240)===0&&(ya=64),r}function Ss(r){for(var o=[],d=0;31>d;d++)o.push(r);return o}function ka(r,o,d){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-jn(o),r[o]=d}function Zi(r,o){var d=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var g=r.eventTimes;for(r=r.expirationTimes;0<d;){var v=31-jn(d),b=1<<v;o[v]=0,g[v]=-1,r[v]=-1,d&=~b}}function Ft(r,o){var d=r.entangledLanes|=o;for(r=r.entanglements;d;){var g=31-jn(d),v=1<<g;v&o|r[g]&o&&(r[g]|=o),d&=~v}}var mt=0;function hr(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var _a,jo,Pc,fr,Na,Qi=!1,Eo=[],pr=null,mr=null,xn=null,js=new Map,Es=new Map,Pn=[],Ji="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 el(r,o){switch(r){case"focusin":case"focusout":pr=null;break;case"dragenter":case"dragleave":mr=null;break;case"mouseover":case"mouseout":xn=null;break;case"pointerover":case"pointerout":js.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Es.delete(o.pointerId)}}function Cs(r,o,d,g,v,b){return r===null||r.nativeEvent!==b?(r={blockedOn:o,domEventName:d,eventSystemFlags:g,nativeEvent:b,targetContainers:[v]},o!==null&&(o=Sl(o),o!==null&&jo(o)),r):(r.eventSystemFlags|=g,o=r.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),r)}function Lc(r,o,d,g,v){switch(o){case"focusin":return pr=Cs(pr,r,o,d,g,v),!0;case"dragenter":return mr=Cs(mr,r,o,d,g,v),!0;case"mouseover":return xn=Cs(xn,r,o,d,g,v),!0;case"pointerover":var b=v.pointerId;return js.set(b,Cs(js.get(b)||null,r,o,d,g,v)),!0;case"gotpointercapture":return b=v.pointerId,Es.set(b,Cs(Es.get(b)||null,r,o,d,g,v)),!0}return!1}function tl(r){var o=Wa(r.target);if(o!==null){var d=rn(o);if(d!==null){if(o=d.tag,o===13){if(o=$r(d),o!==null){r.blockedOn=o,Na(r.priority,function(){Pc(d)});return}}else if(o===3&&d.stateNode.current.memoizedState.isDehydrated){r.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Bt(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var d=Ro(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(d===null){d=r.nativeEvent;var g=new d.constructor(d.type,d);pt=g,d.target.dispatchEvent(g),pt=null}else return o=Sl(d),o!==null&&jo(o),r.blockedOn=d,!1;o.shift()}return!0}function Sa(r,o,d){Bt(r)&&d.delete(o)}function Co(){Qi=!1,pr!==null&&Bt(pr)&&(pr=null),mr!==null&&Bt(mr)&&(mr=null),xn!==null&&Bt(xn)&&(xn=null),js.forEach(Sa),Es.forEach(Sa)}function Qr(r,o){r.blockedOn===o&&(r.blockedOn=null,Qi||(Qi=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Co)))}function ja(r){function o(v){return Qr(v,r)}if(0<Eo.length){Qr(Eo[0],r);for(var d=1;d<Eo.length;d++){var g=Eo[d];g.blockedOn===r&&(g.blockedOn=null)}}for(pr!==null&&Qr(pr,r),mr!==null&&Qr(mr,r),xn!==null&&Qr(xn,r),js.forEach(o),Es.forEach(o),d=0;d<Pn.length;d++)g=Pn[d],g.blockedOn===r&&(g.blockedOn=null);for(;0<Pn.length&&(d=Pn[0],d.blockedOn===null);)tl(d),d.blockedOn===null&&Pn.shift()}var Ln=C.ReactCurrentBatchConfig,Ea=!0;function Ts(r,o,d,g){var v=mt,b=Ln.transition;Ln.transition=null;try{mt=1,To(r,o,d,g)}finally{mt=v,Ln.transition=b}}function Eh(r,o,d,g){var v=mt,b=Ln.transition;Ln.transition=null;try{mt=4,To(r,o,d,g)}finally{mt=v,Ln.transition=b}}function To(r,o,d,g){if(Ea){var v=Ro(r,o,d,g);if(v===null)ae(r,o,g,Ao,d),el(r,g);else if(Lc(v,r,o,d,g))g.stopPropagation();else if(el(r,g),o&4&&-1<Ji.indexOf(r)){for(;v!==null;){var b=Sl(v);if(b!==null&&_a(b),b=Ro(r,o,d,g),b===null&&ae(r,o,g,Ao,d),b===v)break;v=b}v!==null&&g.stopPropagation()}else ae(r,o,g,null,d)}}var Ao=null;function Ro(r,o,d,g){if(Ao=null,r=fe(g),r=Wa(r),r!==null)if(o=rn(r),o===null)r=null;else if(d=o.tag,d===13){if(r=$r(o),r!==null)return r;r=null}else if(d===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return Ao=r,null}function Dc(r){switch(r){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(Xi()){case Ns:return 1;case _o:return 4;case Or:case ma:return 16;case No:return 536870912;default:return 16}default:return 16}}var hn=null,Jr=null,Ca=null;function As(){if(Ca)return Ca;var r,o=Jr,d=o.length,g,v="value"in hn?hn.value:hn.textContent,b=v.length;for(r=0;r<d&&o[r]===v[r];r++);var A=d-r;for(g=1;g<=A&&o[d-g]===v[b-g];g++);return Ca=v.slice(r,1<g?1-g:void 0)}function Ta(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function Rs(){return!0}function Xn(){return!1}function bn(r){function o(d,g,v,b,A){this._reactName=d,this._targetInst=v,this.type=g,this.nativeEvent=b,this.target=A,this.currentTarget=null;for(var X in r)r.hasOwnProperty(X)&&(d=r[X],this[X]=d?d(b):b[X]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?Rs:Xn,this.isPropagationStopped=Xn,this}return U(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Rs)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Rs)},persist:function(){},isPersistent:Rs}),o}var Vt={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Aa=bn(Vt),es=U({},Vt,{view:0,detail:0}),qc=bn(es),Ms,Ra,Is,$s=U({},es,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Io,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Is&&(Is&&r.type==="mousemove"?(Ms=r.screenX-Is.screenX,Ra=r.screenY-Is.screenY):Ra=Ms=0,Is=r),Ms)},movementY:function(r){return"movementY"in r?r.movementY:Ra}}),nl=bn($s),Ch=U({},$s,{dataTransfer:0}),ts=bn(Ch),rl=U({},es,{relatedTarget:0}),Mo=bn(rl),sl=U({},Vt,{animationName:0,elapsedTime:0,pseudoElement:0}),Fc=bn(sl),al=U({},Vt,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),ns=bn(al),Bc=U({},Vt,{data:0}),zc=bn(Bc),Uc={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Wc={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"},Th={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sn(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Th[r])?!!o[r]:!1}function Io(){return sn}var $o=U({},es,{key:function(r){if(r.key){var o=Uc[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=Ta(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?Wc[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Io,charCode:function(r){return r.type==="keypress"?Ta(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Ta(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Os=bn($o),Ma=U({},$s,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Oo=bn(Ma),ol=U({},es,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Io}),Po=bn(ol),Ia=U({},Vt,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hc=bn(Ia),Ah=U({},$s,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Rh=bn(Ah),Lo=[9,13,27,32],il=u&&"CompositionEvent"in window,$a=null;u&&"documentMode"in document&&($a=document.documentMode);var ll=u&&"TextEvent"in window&&!$a,gr=u&&(!il||$a&&8<$a&&11>=$a),Ps=" ",cl=!1;function Gc(r,o){switch(r){case"keyup":return Lo.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vc(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var rs=!1;function Mh(r,o){switch(r){case"compositionend":return Vc(o);case"keypress":return o.which!==32?null:(cl=!0,Ps);case"textInput":return r=o.data,r===Ps&&cl?null:r;default:return null}}function Ih(r,o){if(rs)return r==="compositionend"||!il&&Gc(r,o)?(r=As(),Ca=Jr=hn=null,rs=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return gr&&o.locale!=="ko"?null:o.data;default:return null}}var fn={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 Yc(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!fn[r.type]:o==="textarea"}function Kc(r,o,d,g){Gn(g),o=Ee(o,"onChange"),0<o.length&&(d=new Aa("onChange","change",null,d,g),r.push({event:d,listeners:o}))}var Oa=null,Lr=null;function Do(r){bl(r,0)}function qo(r){var o=ti(r);if(qe(o))return r}function yr(r,o){if(r==="change")return o}var ul=!1;if(u){var dl;if(u){var Fo="oninput"in document;if(!Fo){var hl=document.createElement("div");hl.setAttribute("oninput","return;"),Fo=typeof hl.oninput=="function"}dl=Fo}else dl=!1;ul=dl&&(!document.documentMode||9<document.documentMode)}function Xc(){Oa&&(Oa.detachEvent("onpropertychange",Pa),Lr=Oa=null)}function Pa(r){if(r.propertyName==="value"&&qo(Lr)){var o=[];Kc(o,Lr,r,fe(r)),Kn(Do,o)}}function $h(r,o,d){r==="focusin"?(Xc(),Oa=o,Lr=d,Oa.attachEvent("onpropertychange",Pa)):r==="focusout"&&Xc()}function fl(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return qo(Lr)}function Zc(r,o){if(r==="click")return qo(o)}function Qc(r,o){if(r==="input"||r==="change")return qo(o)}function Jc(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var kn=typeof Object.is=="function"?Object.is:Jc;function Dr(r,o){if(kn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var d=Object.keys(r),g=Object.keys(o);if(d.length!==g.length)return!1;for(g=0;g<d.length;g++){var v=d[g];if(!f.call(o,v)||!kn(r[v],o[v]))return!1}return!0}function Bo(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function pl(r,o){var d=Bo(r);r=0;for(var g;d;){if(d.nodeType===3){if(g=r+d.textContent.length,r<=o&&g>=o)return{node:d,offset:o-r};r=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Bo(d)}}function La(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?La(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function zo(){for(var r=window,o=Ve();o instanceof r.HTMLIFrameElement;){try{var d=typeof o.contentWindow.location.href=="string"}catch{d=!1}if(d)r=o.contentWindow;else break;o=Ve(r.document)}return o}function Ls(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function ml(r){var o=zo(),d=r.focusedElem,g=r.selectionRange;if(o!==d&&d&&d.ownerDocument&&La(d.ownerDocument.documentElement,d)){if(g!==null&&Ls(d)){if(o=g.start,r=g.end,r===void 0&&(r=o),"selectionStart"in d)d.selectionStart=o,d.selectionEnd=Math.min(r,d.value.length);else if(r=(o=d.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var v=d.textContent.length,b=Math.min(g.start,v);g=g.end===void 0?b:Math.min(g.end,v),!r.extend&&b>g&&(v=g,g=b,b=v),v=pl(d,b);var A=pl(d,g);v&&A&&(r.rangeCount!==1||r.anchorNode!==v.node||r.anchorOffset!==v.offset||r.focusNode!==A.node||r.focusOffset!==A.offset)&&(o=o.createRange(),o.setStart(v.node,v.offset),r.removeAllRanges(),b>g?(r.addRange(o),r.extend(A.node,A.offset)):(o.setEnd(A.node,A.offset),r.addRange(o)))}}for(o=[],r=d;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<o.length;d++)r=o[d],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var Ds=u&&"documentMode"in document&&11>=document.documentMode,ss=null,Uo=null,$t=null,Wo=!1;function gl(r,o,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Wo||ss==null||ss!==Ve(g)||(g=ss,"selectionStart"in g&&Ls(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}),$t&&Dr($t,g)||($t=g,g=Ee(Uo,"onSelect"),0<g.length&&(o=new Aa("onSelect","select",null,o,d),r.push({event:o,listeners:g}),o.target=ss)))}function Ho(r,o){var d={};return d[r.toLowerCase()]=o.toLowerCase(),d["Webkit"+r]="webkit"+o,d["Moz"+r]="moz"+o,d}var qs={animationend:Ho("Animation","AnimationEnd"),animationiteration:Ho("Animation","AnimationIteration"),animationstart:Ho("Animation","AnimationStart"),transitionend:Ho("Transition","TransitionEnd")},Go={},Da={};u&&(Da=document.createElement("div").style,"AnimationEvent"in window||(delete qs.animationend.animation,delete qs.animationiteration.animation,delete qs.animationstart.animation),"TransitionEvent"in window||delete qs.transitionend.transition);function Vo(r){if(Go[r])return Go[r];if(!qs[r])return r;var o=qs[r],d;for(d in o)if(o.hasOwnProperty(d)&&d in Da)return Go[r]=o[d];return r}var qr=Vo("animationend"),Yo=Vo("animationiteration"),qa=Vo("animationstart"),Ko=Vo("transitionend"),eu=new Map,yl="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 wr(r,o){eu.set(r,o),i(o,[r])}for(var wl=0;wl<yl.length;wl++){var vl=yl[wl],tu=vl.toLowerCase(),Fa=vl[0].toUpperCase()+vl.slice(1);wr(tu,"on"+Fa)}wr(qr,"onAnimationEnd"),wr(Yo,"onAnimationIteration"),wr(qa,"onAnimationStart"),wr("dblclick","onDoubleClick"),wr("focusin","onFocus"),wr("focusout","onBlur"),wr(Ko,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var as="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(" "),Oh=new Set("cancel close invalid load scroll toggle".split(" ").concat(as));function xl(r,o,d){var g=r.type||"unknown-event";r.currentTarget=d,Jt(g,o,void 0,r),r.currentTarget=null}function bl(r,o){o=(o&4)!==0;for(var d=0;d<r.length;d++){var g=r[d],v=g.event;g=g.listeners;e:{var b=void 0;if(o)for(var A=g.length-1;0<=A;A--){var X=g[A],ne=X.instance,de=X.currentTarget;if(X=X.listener,ne!==b&&v.isPropagationStopped())break e;xl(v,X,de),b=ne}else for(A=0;A<g.length;A++){if(X=g[A],ne=X.instance,de=X.currentTarget,X=X.listener,ne!==b&&v.isPropagationStopped())break e;xl(v,X,de),b=ne}}}if(Ct)throw r=yt,Ct=!1,yt=null,r}function xt(r,o){var d=o[Ph];d===void 0&&(d=o[Ph]=new Set);var g=r+"__bubble";d.has(g)||(q(o,r,2,!1),d.add(g))}function Xo(r,o,d){var g=0;o&&(g|=4),q(d,r,g,o)}var Ba="_reactListening"+Math.random().toString(36).slice(2);function D(r){if(!r[Ba]){r[Ba]=!0,s.forEach(function(d){d!=="selectionchange"&&(Oh.has(d)||Xo(d,!1,r),Xo(d,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[Ba]||(o[Ba]=!0,Xo("selectionchange",!1,o))}}function q(r,o,d,g){switch(Dc(o)){case 1:var v=Ts;break;case 4:v=Eh;break;default:v=To}d=v.bind(null,o,d,r),v=void 0,!Ae||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),g?v!==void 0?r.addEventListener(o,d,{capture:!0,passive:v}):r.addEventListener(o,d,!0):v!==void 0?r.addEventListener(o,d,{passive:v}):r.addEventListener(o,d,!1)}function ae(r,o,d,g,v){var b=g;if((o&1)===0&&(o&2)===0&&g!==null)e:for(;;){if(g===null)return;var A=g.tag;if(A===3||A===4){var X=g.stateNode.containerInfo;if(X===v||X.nodeType===8&&X.parentNode===v)break;if(A===4)for(A=g.return;A!==null;){var ne=A.tag;if((ne===3||ne===4)&&(ne=A.stateNode.containerInfo,ne===v||ne.nodeType===8&&ne.parentNode===v))return;A=A.return}for(;X!==null;){if(A=Wa(X),A===null)return;if(ne=A.tag,ne===5||ne===6){g=b=A;continue e}X=X.parentNode}}g=g.return}Kn(function(){var de=b,we=fe(d),xe=[];e:{var ye=eu.get(r);if(ye!==void 0){var Te=Aa,$e=r;switch(r){case"keypress":if(Ta(d)===0)break e;case"keydown":case"keyup":Te=Os;break;case"focusin":$e="focus",Te=Mo;break;case"focusout":$e="blur",Te=Mo;break;case"beforeblur":case"afterblur":Te=Mo;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":Te=nl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Te=ts;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Te=Po;break;case qr:case Yo:case qa:Te=Fc;break;case Ko:Te=Hc;break;case"scroll":Te=qc;break;case"wheel":Te=Rh;break;case"copy":case"cut":case"paste":Te=ns;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Te=Oo}var Pe=(o&4)!==0,zt=!Pe&&r==="scroll",ie=Pe?ye!==null?ye+"Capture":null:ye;Pe=[];for(var se=de,ce;se!==null;){ce=se;var be=ce.stateNode;if(ce.tag===5&&be!==null&&(ce=be,ie!==null&&(be=te(se,ie),be!=null&&Pe.push(oe(se,be,ce)))),zt)break;se=se.return}0<Pe.length&&(ye=new Te(ye,$e,null,d,we),xe.push({event:ye,listeners:Pe}))}}if((o&7)===0){e:{if(ye=r==="mouseover"||r==="pointerover",Te=r==="mouseout"||r==="pointerout",ye&&d!==pt&&($e=d.relatedTarget||d.fromElement)&&(Wa($e)||$e[is]))break e;if((Te||ye)&&(ye=we.window===we?we:(ye=we.ownerDocument)?ye.defaultView||ye.parentWindow:window,Te?($e=d.relatedTarget||d.toElement,Te=de,$e=$e?Wa($e):null,$e!==null&&(zt=rn($e),$e!==zt||$e.tag!==5&&$e.tag!==6)&&($e=null)):(Te=null,$e=de),Te!==$e)){if(Pe=nl,be="onMouseLeave",ie="onMouseEnter",se="mouse",(r==="pointerout"||r==="pointerover")&&(Pe=Oo,be="onPointerLeave",ie="onPointerEnter",se="pointer"),zt=Te==null?ye:ti(Te),ce=$e==null?ye:ti($e),ye=new Pe(be,se+"leave",Te,d,we),ye.target=zt,ye.relatedTarget=ce,be=null,Wa(we)===de&&(Pe=new Pe(ie,se+"enter",$e,d,we),Pe.target=ce,Pe.relatedTarget=zt,be=Pe),zt=be,Te&&$e)t:{for(Pe=Te,ie=$e,se=0,ce=Pe;ce;ce=ve(ce))se++;for(ce=0,be=ie;be;be=ve(be))ce++;for(;0<se-ce;)Pe=ve(Pe),se--;for(;0<ce-se;)ie=ve(ie),ce--;for(;se--;){if(Pe===ie||ie!==null&&Pe===ie.alternate)break t;Pe=ve(Pe),ie=ve(ie)}Pe=null}else Pe=null;Te!==null&&Ge(xe,ye,Te,Pe,!1),$e!==null&&zt!==null&&Ge(xe,zt,$e,Pe,!0)}}e:{if(ye=de?ti(de):window,Te=ye.nodeName&&ye.nodeName.toLowerCase(),Te==="select"||Te==="input"&&ye.type==="file")var De=yr;else if(Yc(ye))if(ul)De=Qc;else{De=fl;var Ye=$h}else(Te=ye.nodeName)&&Te.toLowerCase()==="input"&&(ye.type==="checkbox"||ye.type==="radio")&&(De=Zc);if(De&&(De=De(r,de))){Kc(xe,De,d,we);break e}Ye&&Ye(r,ye,de),r==="focusout"&&(Ye=ye._wrapperState)&&Ye.controlled&&ye.type==="number"&&ue(ye,"number",ye.value)}switch(Ye=de?ti(de):window,r){case"focusin":(Yc(Ye)||Ye.contentEditable==="true")&&(ss=Ye,Uo=de,$t=null);break;case"focusout":$t=Uo=ss=null;break;case"mousedown":Wo=!0;break;case"contextmenu":case"mouseup":case"dragend":Wo=!1,gl(xe,d,we);break;case"selectionchange":if(Ds)break;case"keydown":case"keyup":gl(xe,d,we)}var Ke;if(il)e:{switch(r){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else rs?Gc(r,d)&&(Xe="onCompositionEnd"):r==="keydown"&&d.keyCode===229&&(Xe="onCompositionStart");Xe&&(gr&&d.locale!=="ko"&&(rs||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&rs&&(Ke=As()):(hn=we,Jr="value"in hn?hn.value:hn.textContent,rs=!0)),Ye=Ee(de,Xe),0<Ye.length&&(Xe=new zc(Xe,r,null,d,we),xe.push({event:Xe,listeners:Ye}),Ke?Xe.data=Ke:(Ke=Vc(d),Ke!==null&&(Xe.data=Ke)))),(Ke=ll?Mh(r,d):Ih(r,d))&&(de=Ee(de,"onBeforeInput"),0<de.length&&(we=new zc("onBeforeInput","beforeinput",null,d,we),xe.push({event:we,listeners:de}),we.data=Ke))}bl(xe,o)})}function oe(r,o,d){return{instance:r,listener:o,currentTarget:d}}function Ee(r,o){for(var d=o+"Capture",g=[];r!==null;){var v=r,b=v.stateNode;v.tag===5&&b!==null&&(v=b,b=te(r,d),b!=null&&g.unshift(oe(r,b,v)),b=te(r,o),b!=null&&g.push(oe(r,b,v))),r=r.return}return g}function ve(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function Ge(r,o,d,g,v){for(var b=o._reactName,A=[];d!==null&&d!==g;){var X=d,ne=X.alternate,de=X.stateNode;if(ne!==null&&ne===g)break;X.tag===5&&de!==null&&(X=de,v?(ne=te(d,b),ne!=null&&A.unshift(oe(d,ne,X))):v||(ne=te(d,b),ne!=null&&A.push(oe(d,ne,X)))),d=d.return}A.length!==0&&r.push({event:o,listeners:A})}var rt=/\r\n?/g,_t=/\u0000|\uFFFD/g;function Ze(r){return(typeof r=="string"?r:""+r).replace(rt,`
38
+ `).replace(_t,"")}function an(r,o,d){if(o=Ze(o),Ze(r)!==o&&d)throw Error(n(425))}function os(){}var Zo=null,kl=null;function Qo(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var _l=typeof setTimeout=="function"?setTimeout:void 0,nu=typeof clearTimeout=="function"?clearTimeout:void 0,Jo=typeof Promise=="function"?Promise:void 0,za=typeof queueMicrotask=="function"?queueMicrotask:typeof Jo<"u"?function(r){return Jo.resolve(null).then(r).catch(Ua)}:_l;function Ua(r){setTimeout(function(){throw r})}function Ot(r,o){var d=o,g=0;do{var v=d.nextSibling;if(r.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"){if(g===0){r.removeChild(v),ja(o);return}g--}else d!=="$"&&d!=="$?"&&d!=="$!"||g++;d=v}while(d);ja(o)}function vr(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function j0(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var d=r.data;if(d==="$"||d==="$!"||d==="$?"){if(o===0)return r;o--}else d==="/$"&&o++}r=r.previousSibling}return null}var ei=Math.random().toString(36).slice(2),Fr="__reactFiber$"+ei,Nl="__reactProps$"+ei,is="__reactContainer$"+ei,Ph="__reactEvents$"+ei,dM="__reactListeners$"+ei,hM="__reactHandles$"+ei;function Wa(r){var o=r[Fr];if(o)return o;for(var d=r.parentNode;d;){if(o=d[is]||d[Fr]){if(d=o.alternate,o.child!==null||d!==null&&d.child!==null)for(r=j0(r);r!==null;){if(d=r[Fr])return d;r=j0(r)}return o}r=d,d=r.parentNode}return null}function Sl(r){return r=r[Fr]||r[is],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function ti(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function ru(r){return r[Nl]||null}var Lh=[],ni=-1;function Fs(r){return{current:r}}function Et(r){0>ni||(r.current=Lh[ni],Lh[ni]=null,ni--)}function jt(r,o){ni++,Lh[ni]=r.current,r.current=o}var Bs={},pn=Fs(Bs),Cn=Fs(!1),Ha=Bs;function ri(r,o){var d=r.type.contextTypes;if(!d)return Bs;var g=r.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===o)return g.__reactInternalMemoizedMaskedChildContext;var v={},b;for(b in d)v[b]=o[b];return g&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=v),v}function Tn(r){return r=r.childContextTypes,r!=null}function su(){Et(Cn),Et(pn)}function E0(r,o,d){if(pn.current!==Bs)throw Error(n(168));jt(pn,o),jt(Cn,d)}function C0(r,o,d){var g=r.stateNode;if(o=o.childContextTypes,typeof g.getChildContext!="function")return d;g=g.getChildContext();for(var v in g)if(!(v in o))throw Error(n(108,re(r)||"Unknown",v));return U({},d,g)}function au(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Bs,Ha=pn.current,jt(pn,r),jt(Cn,Cn.current),!0}function T0(r,o,d){var g=r.stateNode;if(!g)throw Error(n(169));d?(r=C0(r,o,Ha),g.__reactInternalMemoizedMergedChildContext=r,Et(Cn),Et(pn),jt(pn,r)):Et(Cn),jt(Cn,d)}var ls=null,ou=!1,Dh=!1;function A0(r){ls===null?ls=[r]:ls.push(r)}function fM(r){ou=!0,A0(r)}function zs(){if(!Dh&&ls!==null){Dh=!0;var r=0,o=mt;try{var d=ls;for(mt=1;r<d.length;r++){var g=d[r];do g=g(!0);while(g!==null)}ls=null,ou=!1}catch(v){throw ls!==null&&(ls=ls.slice(r+1)),ha(Ns,zs),v}finally{mt=o,Dh=!1}}return null}var si=[],ai=0,iu=null,lu=0,Zn=[],Qn=0,Ga=null,cs=1,us="";function Va(r,o){si[ai++]=lu,si[ai++]=iu,iu=r,lu=o}function R0(r,o,d){Zn[Qn++]=cs,Zn[Qn++]=us,Zn[Qn++]=Ga,Ga=r;var g=cs;r=us;var v=32-jn(g)-1;g&=~(1<<v),d+=1;var b=32-jn(o)+v;if(30<b){var A=v-v%5;b=(g&(1<<A)-1).toString(32),g>>=A,v-=A,cs=1<<32-jn(o)+v|d<<v|g,us=b+r}else cs=1<<b|d<<v|g,us=r}function qh(r){r.return!==null&&(Va(r,1),R0(r,1,0))}function Fh(r){for(;r===iu;)iu=si[--ai],si[ai]=null,lu=si[--ai],si[ai]=null;for(;r===Ga;)Ga=Zn[--Qn],Zn[Qn]=null,us=Zn[--Qn],Zn[Qn]=null,cs=Zn[--Qn],Zn[Qn]=null}var Dn=null,qn=null,Tt=!1,xr=null;function M0(r,o){var d=nr(5,null,null,0);d.elementType="DELETED",d.stateNode=o,d.return=r,o=r.deletions,o===null?(r.deletions=[d],r.flags|=16):o.push(d)}function I0(r,o){switch(r.tag){case 5:var d=r.type;return o=o.nodeType!==1||d.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,Dn=r,qn=vr(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,Dn=r,qn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(d=Ga!==null?{id:cs,overflow:us}:null,r.memoizedState={dehydrated:o,treeContext:d,retryLane:1073741824},d=nr(18,null,null,0),d.stateNode=o,d.return=r,r.child=d,Dn=r,qn=null,!0):!1;default:return!1}}function Bh(r){return(r.mode&1)!==0&&(r.flags&128)===0}function zh(r){if(Tt){var o=qn;if(o){var d=o;if(!I0(r,o)){if(Bh(r))throw Error(n(418));o=vr(d.nextSibling);var g=Dn;o&&I0(r,o)?M0(g,d):(r.flags=r.flags&-4097|2,Tt=!1,Dn=r)}}else{if(Bh(r))throw Error(n(418));r.flags=r.flags&-4097|2,Tt=!1,Dn=r}}}function $0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;Dn=r}function cu(r){if(r!==Dn)return!1;if(!Tt)return $0(r),Tt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Qo(r.type,r.memoizedProps)),o&&(o=qn)){if(Bh(r))throw O0(),Error(n(418));for(;o;)M0(r,o),o=vr(o.nextSibling)}if($0(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var d=r.data;if(d==="/$"){if(o===0){qn=vr(r.nextSibling);break e}o--}else d!=="$"&&d!=="$!"&&d!=="$?"||o++}r=r.nextSibling}qn=null}}else qn=Dn?vr(r.stateNode.nextSibling):null;return!0}function O0(){for(var r=qn;r;)r=vr(r.nextSibling)}function oi(){qn=Dn=null,Tt=!1}function Uh(r){xr===null?xr=[r]:xr.push(r)}var pM=C.ReactCurrentBatchConfig;function jl(r,o,d){if(r=d.ref,r!==null&&typeof r!="function"&&typeof r!="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,r));var v=g,b=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===b?o.ref:(o=function(A){var X=v.refs;A===null?delete X[b]:X[b]=A},o._stringRef=b,o)}if(typeof r!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,r))}return r}function uu(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function P0(r){var o=r._init;return o(r._payload)}function L0(r){function o(ie,se){if(r){var ce=ie.deletions;ce===null?(ie.deletions=[se],ie.flags|=16):ce.push(se)}}function d(ie,se){if(!r)return null;for(;se!==null;)o(ie,se),se=se.sibling;return null}function g(ie,se){for(ie=new Map;se!==null;)se.key!==null?ie.set(se.key,se):ie.set(se.index,se),se=se.sibling;return ie}function v(ie,se){return ie=Xs(ie,se),ie.index=0,ie.sibling=null,ie}function b(ie,se,ce){return ie.index=ce,r?(ce=ie.alternate,ce!==null?(ce=ce.index,ce<se?(ie.flags|=2,se):ce):(ie.flags|=2,se)):(ie.flags|=1048576,se)}function A(ie){return r&&ie.alternate===null&&(ie.flags|=2),ie}function X(ie,se,ce,be){return se===null||se.tag!==6?(se=Of(ce,ie.mode,be),se.return=ie,se):(se=v(se,ce),se.return=ie,se)}function ne(ie,se,ce,be){var De=ce.type;return De===I?we(ie,se,ce.props.children,be,ce.key):se!==null&&(se.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===G&&P0(De)===se.type)?(be=v(se,ce.props),be.ref=jl(ie,se,ce),be.return=ie,be):(be=$u(ce.type,ce.key,ce.props,null,ie.mode,be),be.ref=jl(ie,se,ce),be.return=ie,be)}function de(ie,se,ce,be){return se===null||se.tag!==4||se.stateNode.containerInfo!==ce.containerInfo||se.stateNode.implementation!==ce.implementation?(se=Pf(ce,ie.mode,be),se.return=ie,se):(se=v(se,ce.children||[]),se.return=ie,se)}function we(ie,se,ce,be,De){return se===null||se.tag!==7?(se=to(ce,ie.mode,be,De),se.return=ie,se):(se=v(se,ce),se.return=ie,se)}function xe(ie,se,ce){if(typeof se=="string"&&se!==""||typeof se=="number")return se=Of(""+se,ie.mode,ce),se.return=ie,se;if(typeof se=="object"&&se!==null){switch(se.$$typeof){case T:return ce=$u(se.type,se.key,se.props,null,ie.mode,ce),ce.ref=jl(ie,null,se),ce.return=ie,ce;case R:return se=Pf(se,ie.mode,ce),se.return=ie,se;case G:var be=se._init;return xe(ie,be(se._payload),ce)}if(je(se)||L(se))return se=to(se,ie.mode,ce,null),se.return=ie,se;uu(ie,se)}return null}function ye(ie,se,ce,be){var De=se!==null?se.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return De!==null?null:X(ie,se,""+ce,be);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case T:return ce.key===De?ne(ie,se,ce,be):null;case R:return ce.key===De?de(ie,se,ce,be):null;case G:return De=ce._init,ye(ie,se,De(ce._payload),be)}if(je(ce)||L(ce))return De!==null?null:we(ie,se,ce,be,null);uu(ie,ce)}return null}function Te(ie,se,ce,be,De){if(typeof be=="string"&&be!==""||typeof be=="number")return ie=ie.get(ce)||null,X(se,ie,""+be,De);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case T:return ie=ie.get(be.key===null?ce:be.key)||null,ne(se,ie,be,De);case R:return ie=ie.get(be.key===null?ce:be.key)||null,de(se,ie,be,De);case G:var Ye=be._init;return Te(ie,se,ce,Ye(be._payload),De)}if(je(be)||L(be))return ie=ie.get(ce)||null,we(se,ie,be,De,null);uu(se,be)}return null}function $e(ie,se,ce,be){for(var De=null,Ye=null,Ke=se,Xe=se=0,nn=null;Ke!==null&&Xe<ce.length;Xe++){Ke.index>Xe?(nn=Ke,Ke=null):nn=Ke.sibling;var ft=ye(ie,Ke,ce[Xe],be);if(ft===null){Ke===null&&(Ke=nn);break}r&&Ke&&ft.alternate===null&&o(ie,Ke),se=b(ft,se,Xe),Ye===null?De=ft:Ye.sibling=ft,Ye=ft,Ke=nn}if(Xe===ce.length)return d(ie,Ke),Tt&&Va(ie,Xe),De;if(Ke===null){for(;Xe<ce.length;Xe++)Ke=xe(ie,ce[Xe],be),Ke!==null&&(se=b(Ke,se,Xe),Ye===null?De=Ke:Ye.sibling=Ke,Ye=Ke);return Tt&&Va(ie,Xe),De}for(Ke=g(ie,Ke);Xe<ce.length;Xe++)nn=Te(Ke,ie,Xe,ce[Xe],be),nn!==null&&(r&&nn.alternate!==null&&Ke.delete(nn.key===null?Xe:nn.key),se=b(nn,se,Xe),Ye===null?De=nn:Ye.sibling=nn,Ye=nn);return r&&Ke.forEach(function(Zs){return o(ie,Zs)}),Tt&&Va(ie,Xe),De}function Pe(ie,se,ce,be){var De=L(ce);if(typeof De!="function")throw Error(n(150));if(ce=De.call(ce),ce==null)throw Error(n(151));for(var Ye=De=null,Ke=se,Xe=se=0,nn=null,ft=ce.next();Ke!==null&&!ft.done;Xe++,ft=ce.next()){Ke.index>Xe?(nn=Ke,Ke=null):nn=Ke.sibling;var Zs=ye(ie,Ke,ft.value,be);if(Zs===null){Ke===null&&(Ke=nn);break}r&&Ke&&Zs.alternate===null&&o(ie,Ke),se=b(Zs,se,Xe),Ye===null?De=Zs:Ye.sibling=Zs,Ye=Zs,Ke=nn}if(ft.done)return d(ie,Ke),Tt&&Va(ie,Xe),De;if(Ke===null){for(;!ft.done;Xe++,ft=ce.next())ft=xe(ie,ft.value,be),ft!==null&&(se=b(ft,se,Xe),Ye===null?De=ft:Ye.sibling=ft,Ye=ft);return Tt&&Va(ie,Xe),De}for(Ke=g(ie,Ke);!ft.done;Xe++,ft=ce.next())ft=Te(Ke,ie,Xe,ft.value,be),ft!==null&&(r&&ft.alternate!==null&&Ke.delete(ft.key===null?Xe:ft.key),se=b(ft,se,Xe),Ye===null?De=ft:Ye.sibling=ft,Ye=ft);return r&&Ke.forEach(function(VM){return o(ie,VM)}),Tt&&Va(ie,Xe),De}function zt(ie,se,ce,be){if(typeof ce=="object"&&ce!==null&&ce.type===I&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case T:e:{for(var De=ce.key,Ye=se;Ye!==null;){if(Ye.key===De){if(De=ce.type,De===I){if(Ye.tag===7){d(ie,Ye.sibling),se=v(Ye,ce.props.children),se.return=ie,ie=se;break e}}else if(Ye.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===G&&P0(De)===Ye.type){d(ie,Ye.sibling),se=v(Ye,ce.props),se.ref=jl(ie,Ye,ce),se.return=ie,ie=se;break e}d(ie,Ye);break}else o(ie,Ye);Ye=Ye.sibling}ce.type===I?(se=to(ce.props.children,ie.mode,be,ce.key),se.return=ie,ie=se):(be=$u(ce.type,ce.key,ce.props,null,ie.mode,be),be.ref=jl(ie,se,ce),be.return=ie,ie=be)}return A(ie);case R:e:{for(Ye=ce.key;se!==null;){if(se.key===Ye)if(se.tag===4&&se.stateNode.containerInfo===ce.containerInfo&&se.stateNode.implementation===ce.implementation){d(ie,se.sibling),se=v(se,ce.children||[]),se.return=ie,ie=se;break e}else{d(ie,se);break}else o(ie,se);se=se.sibling}se=Pf(ce,ie.mode,be),se.return=ie,ie=se}return A(ie);case G:return Ye=ce._init,zt(ie,se,Ye(ce._payload),be)}if(je(ce))return $e(ie,se,ce,be);if(L(ce))return Pe(ie,se,ce,be);uu(ie,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,se!==null&&se.tag===6?(d(ie,se.sibling),se=v(se,ce),se.return=ie,ie=se):(d(ie,se),se=Of(ce,ie.mode,be),se.return=ie,ie=se),A(ie)):d(ie,se)}return zt}var ii=L0(!0),D0=L0(!1),du=Fs(null),hu=null,li=null,Wh=null;function Hh(){Wh=li=hu=null}function Gh(r){var o=du.current;Et(du),r._currentValue=o}function Vh(r,o,d){for(;r!==null;){var g=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,g!==null&&(g.childLanes|=o)):g!==null&&(g.childLanes&o)!==o&&(g.childLanes|=o),r===d)break;r=r.return}}function ci(r,o){hu=r,Wh=li=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(An=!0),r.firstContext=null)}function Jn(r){var o=r._currentValue;if(Wh!==r)if(r={context:r,memoizedValue:o,next:null},li===null){if(hu===null)throw Error(n(308));li=r,hu.dependencies={lanes:0,firstContext:r}}else li=li.next=r;return o}var Ya=null;function Yh(r){Ya===null?Ya=[r]:Ya.push(r)}function q0(r,o,d,g){var v=o.interleaved;return v===null?(d.next=d,Yh(o)):(d.next=v.next,v.next=d),o.interleaved=d,ds(r,g)}function ds(r,o){r.lanes|=o;var d=r.alternate;for(d!==null&&(d.lanes|=o),d=r,r=r.return;r!==null;)r.childLanes|=o,d=r.alternate,d!==null&&(d.childLanes|=o),d=r,r=r.return;return d.tag===3?d.stateNode:null}var Us=!1;function Kh(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function F0(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function hs(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Ws(r,o,d){var g=r.updateQueue;if(g===null)return null;if(g=g.shared,(dt&2)!==0){var v=g.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),g.pending=o,ds(r,d)}return v=g.interleaved,v===null?(o.next=o,Yh(g)):(o.next=v.next,v.next=o),g.interleaved=o,ds(r,d)}function fu(r,o,d){if(o=o.updateQueue,o!==null&&(o=o.shared,(d&4194240)!==0)){var g=o.lanes;g&=r.pendingLanes,d|=g,o.lanes=d,Ft(r,d)}}function B0(r,o){var d=r.updateQueue,g=r.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var v=null,b=null;if(d=d.firstBaseUpdate,d!==null){do{var A={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};b===null?v=b=A:b=b.next=A,d=d.next}while(d!==null);b===null?v=b=o:b=b.next=o}else v=b=o;d={baseState:g.baseState,firstBaseUpdate:v,lastBaseUpdate:b,shared:g.shared,effects:g.effects},r.updateQueue=d;return}r=d.lastBaseUpdate,r===null?d.firstBaseUpdate=o:r.next=o,d.lastBaseUpdate=o}function pu(r,o,d,g){var v=r.updateQueue;Us=!1;var b=v.firstBaseUpdate,A=v.lastBaseUpdate,X=v.shared.pending;if(X!==null){v.shared.pending=null;var ne=X,de=ne.next;ne.next=null,A===null?b=de:A.next=de,A=ne;var we=r.alternate;we!==null&&(we=we.updateQueue,X=we.lastBaseUpdate,X!==A&&(X===null?we.firstBaseUpdate=de:X.next=de,we.lastBaseUpdate=ne))}if(b!==null){var xe=v.baseState;A=0,we=de=ne=null,X=b;do{var ye=X.lane,Te=X.eventTime;if((g&ye)===ye){we!==null&&(we=we.next={eventTime:Te,lane:0,tag:X.tag,payload:X.payload,callback:X.callback,next:null});e:{var $e=r,Pe=X;switch(ye=o,Te=d,Pe.tag){case 1:if($e=Pe.payload,typeof $e=="function"){xe=$e.call(Te,xe,ye);break e}xe=$e;break e;case 3:$e.flags=$e.flags&-65537|128;case 0:if($e=Pe.payload,ye=typeof $e=="function"?$e.call(Te,xe,ye):$e,ye==null)break e;xe=U({},xe,ye);break e;case 2:Us=!0}}X.callback!==null&&X.lane!==0&&(r.flags|=64,ye=v.effects,ye===null?v.effects=[X]:ye.push(X))}else Te={eventTime:Te,lane:ye,tag:X.tag,payload:X.payload,callback:X.callback,next:null},we===null?(de=we=Te,ne=xe):we=we.next=Te,A|=ye;if(X=X.next,X===null){if(X=v.shared.pending,X===null)break;ye=X,X=ye.next,ye.next=null,v.lastBaseUpdate=ye,v.shared.pending=null}}while(!0);if(we===null&&(ne=xe),v.baseState=ne,v.firstBaseUpdate=de,v.lastBaseUpdate=we,o=v.shared.interleaved,o!==null){v=o;do A|=v.lane,v=v.next;while(v!==o)}else b===null&&(v.shared.lanes=0);Za|=A,r.lanes=A,r.memoizedState=xe}}function z0(r,o,d){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var g=r[o],v=g.callback;if(v!==null){if(g.callback=null,g=d,typeof v!="function")throw Error(n(191,v));v.call(g)}}}var El={},Br=Fs(El),Cl=Fs(El),Tl=Fs(El);function Ka(r){if(r===El)throw Error(n(174));return r}function Xh(r,o){switch(jt(Tl,o),jt(Cl,r),jt(Br,El),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:ut(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=ut(o,r)}Et(Br),jt(Br,o)}function ui(){Et(Br),Et(Cl),Et(Tl)}function U0(r){Ka(Tl.current);var o=Ka(Br.current),d=ut(o,r.type);o!==d&&(jt(Cl,r),jt(Br,d))}function Zh(r){Cl.current===r&&(Et(Br),Et(Cl))}var Rt=Fs(0);function mu(r){for(var o=r;o!==null;){if(o.tag===13){var d=o.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Qh=[];function Jh(){for(var r=0;r<Qh.length;r++)Qh[r]._workInProgressVersionPrimary=null;Qh.length=0}var gu=C.ReactCurrentDispatcher,ef=C.ReactCurrentBatchConfig,Xa=0,Mt=null,Yt=null,en=null,yu=!1,Al=!1,Rl=0,mM=0;function mn(){throw Error(n(321))}function tf(r,o){if(o===null)return!1;for(var d=0;d<o.length&&d<r.length;d++)if(!kn(r[d],o[d]))return!1;return!0}function nf(r,o,d,g,v,b){if(Xa=b,Mt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,gu.current=r===null||r.memoizedState===null?vM:xM,r=d(g,v),Al){b=0;do{if(Al=!1,Rl=0,25<=b)throw Error(n(301));b+=1,en=Yt=null,o.updateQueue=null,gu.current=bM,r=d(g,v)}while(Al)}if(gu.current=xu,o=Yt!==null&&Yt.next!==null,Xa=0,en=Yt=Mt=null,yu=!1,o)throw Error(n(300));return r}function rf(){var r=Rl!==0;return Rl=0,r}function zr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return en===null?Mt.memoizedState=en=r:en=en.next=r,en}function er(){if(Yt===null){var r=Mt.alternate;r=r!==null?r.memoizedState:null}else r=Yt.next;var o=en===null?Mt.memoizedState:en.next;if(o!==null)en=o,Yt=r;else{if(r===null)throw Error(n(310));Yt=r,r={memoizedState:Yt.memoizedState,baseState:Yt.baseState,baseQueue:Yt.baseQueue,queue:Yt.queue,next:null},en===null?Mt.memoizedState=en=r:en=en.next=r}return en}function Ml(r,o){return typeof o=="function"?o(r):o}function sf(r){var o=er(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=r;var g=Yt,v=g.baseQueue,b=d.pending;if(b!==null){if(v!==null){var A=v.next;v.next=b.next,b.next=A}g.baseQueue=v=b,d.pending=null}if(v!==null){b=v.next,g=g.baseState;var X=A=null,ne=null,de=b;do{var we=de.lane;if((Xa&we)===we)ne!==null&&(ne=ne.next={lane:0,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),g=de.hasEagerState?de.eagerState:r(g,de.action);else{var xe={lane:we,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};ne===null?(X=ne=xe,A=g):ne=ne.next=xe,Mt.lanes|=we,Za|=we}de=de.next}while(de!==null&&de!==b);ne===null?A=g:ne.next=X,kn(g,o.memoizedState)||(An=!0),o.memoizedState=g,o.baseState=A,o.baseQueue=ne,d.lastRenderedState=g}if(r=d.interleaved,r!==null){v=r;do b=v.lane,Mt.lanes|=b,Za|=b,v=v.next;while(v!==r)}else v===null&&(d.lanes=0);return[o.memoizedState,d.dispatch]}function af(r){var o=er(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=r;var g=d.dispatch,v=d.pending,b=o.memoizedState;if(v!==null){d.pending=null;var A=v=v.next;do b=r(b,A.action),A=A.next;while(A!==v);kn(b,o.memoizedState)||(An=!0),o.memoizedState=b,o.baseQueue===null&&(o.baseState=b),d.lastRenderedState=b}return[b,g]}function W0(){}function H0(r,o){var d=Mt,g=er(),v=o(),b=!kn(g.memoizedState,v);if(b&&(g.memoizedState=v,An=!0),g=g.queue,of(Y0.bind(null,d,g,r),[r]),g.getSnapshot!==o||b||en!==null&&en.memoizedState.tag&1){if(d.flags|=2048,Il(9,V0.bind(null,d,g,v,o),void 0,null),tn===null)throw Error(n(349));(Xa&30)!==0||G0(d,o,v)}return v}function G0(r,o,d){r.flags|=16384,r={getSnapshot:o,value:d},o=Mt.updateQueue,o===null?(o={lastEffect:null,stores:null},Mt.updateQueue=o,o.stores=[r]):(d=o.stores,d===null?o.stores=[r]:d.push(r))}function V0(r,o,d,g){o.value=d,o.getSnapshot=g,K0(o)&&X0(r)}function Y0(r,o,d){return d(function(){K0(o)&&X0(r)})}function K0(r){var o=r.getSnapshot;r=r.value;try{var d=o();return!kn(r,d)}catch{return!0}}function X0(r){var o=ds(r,1);o!==null&&Nr(o,r,1,-1)}function Z0(r){var o=zr();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ml,lastRenderedState:r},o.queue=r,r=r.dispatch=wM.bind(null,Mt,r),[o.memoizedState,r]}function Il(r,o,d,g){return r={tag:r,create:o,destroy:d,deps:g,next:null},o=Mt.updateQueue,o===null?(o={lastEffect:null,stores:null},Mt.updateQueue=o,o.lastEffect=r.next=r):(d=o.lastEffect,d===null?o.lastEffect=r.next=r:(g=d.next,d.next=r,r.next=g,o.lastEffect=r)),r}function Q0(){return er().memoizedState}function wu(r,o,d,g){var v=zr();Mt.flags|=r,v.memoizedState=Il(1|o,d,void 0,g===void 0?null:g)}function vu(r,o,d,g){var v=er();g=g===void 0?null:g;var b=void 0;if(Yt!==null){var A=Yt.memoizedState;if(b=A.destroy,g!==null&&tf(g,A.deps)){v.memoizedState=Il(o,d,b,g);return}}Mt.flags|=r,v.memoizedState=Il(1|o,d,b,g)}function J0(r,o){return wu(8390656,8,r,o)}function of(r,o){return vu(2048,8,r,o)}function eb(r,o){return vu(4,2,r,o)}function tb(r,o){return vu(4,4,r,o)}function nb(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function rb(r,o,d){return d=d!=null?d.concat([r]):null,vu(4,4,nb.bind(null,o,r),d)}function lf(){}function sb(r,o){var d=er();o=o===void 0?null:o;var g=d.memoizedState;return g!==null&&o!==null&&tf(o,g[1])?g[0]:(d.memoizedState=[r,o],r)}function ab(r,o){var d=er();o=o===void 0?null:o;var g=d.memoizedState;return g!==null&&o!==null&&tf(o,g[1])?g[0]:(r=r(),d.memoizedState=[r,o],r)}function ob(r,o,d){return(Xa&21)===0?(r.baseState&&(r.baseState=!1,An=!0),r.memoizedState=d):(kn(d,o)||(d=En(),Mt.lanes|=d,Za|=d,r.baseState=!0),o)}function gM(r,o){var d=mt;mt=d!==0&&4>d?d:4,r(!0);var g=ef.transition;ef.transition={};try{r(!1),o()}finally{mt=d,ef.transition=g}}function ib(){return er().memoizedState}function yM(r,o,d){var g=Ys(r);if(d={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null},lb(r))cb(o,d);else if(d=q0(r,o,d,g),d!==null){var v=Nn();Nr(d,r,g,v),ub(d,o,g)}}function wM(r,o,d){var g=Ys(r),v={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null};if(lb(r))cb(o,v);else{var b=r.alternate;if(r.lanes===0&&(b===null||b.lanes===0)&&(b=o.lastRenderedReducer,b!==null))try{var A=o.lastRenderedState,X=b(A,d);if(v.hasEagerState=!0,v.eagerState=X,kn(X,A)){var ne=o.interleaved;ne===null?(v.next=v,Yh(o)):(v.next=ne.next,ne.next=v),o.interleaved=v;return}}catch{}finally{}d=q0(r,o,v,g),d!==null&&(v=Nn(),Nr(d,r,g,v),ub(d,o,g))}}function lb(r){var o=r.alternate;return r===Mt||o!==null&&o===Mt}function cb(r,o){Al=yu=!0;var d=r.pending;d===null?o.next=o:(o.next=d.next,d.next=o),r.pending=o}function ub(r,o,d){if((d&4194240)!==0){var g=o.lanes;g&=r.pendingLanes,d|=g,o.lanes=d,Ft(r,d)}}var xu={readContext:Jn,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},vM={readContext:Jn,useCallback:function(r,o){return zr().memoizedState=[r,o===void 0?null:o],r},useContext:Jn,useEffect:J0,useImperativeHandle:function(r,o,d){return d=d!=null?d.concat([r]):null,wu(4194308,4,nb.bind(null,o,r),d)},useLayoutEffect:function(r,o){return wu(4194308,4,r,o)},useInsertionEffect:function(r,o){return wu(4,2,r,o)},useMemo:function(r,o){var d=zr();return o=o===void 0?null:o,r=r(),d.memoizedState=[r,o],r},useReducer:function(r,o,d){var g=zr();return o=d!==void 0?d(o):o,g.memoizedState=g.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},g.queue=r,r=r.dispatch=yM.bind(null,Mt,r),[g.memoizedState,r]},useRef:function(r){var o=zr();return r={current:r},o.memoizedState=r},useState:Z0,useDebugValue:lf,useDeferredValue:function(r){return zr().memoizedState=r},useTransition:function(){var r=Z0(!1),o=r[0];return r=gM.bind(null,r[1]),zr().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,d){var g=Mt,v=zr();if(Tt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=o(),tn===null)throw Error(n(349));(Xa&30)!==0||G0(g,o,d)}v.memoizedState=d;var b={value:d,getSnapshot:o};return v.queue=b,J0(Y0.bind(null,g,b,r),[r]),g.flags|=2048,Il(9,V0.bind(null,g,b,d,o),void 0,null),d},useId:function(){var r=zr(),o=tn.identifierPrefix;if(Tt){var d=us,g=cs;d=(g&~(1<<32-jn(g)-1)).toString(32)+d,o=":"+o+"R"+d,d=Rl++,0<d&&(o+="H"+d.toString(32)),o+=":"}else d=mM++,o=":"+o+"r"+d.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},xM={readContext:Jn,useCallback:sb,useContext:Jn,useEffect:of,useImperativeHandle:rb,useInsertionEffect:eb,useLayoutEffect:tb,useMemo:ab,useReducer:sf,useRef:Q0,useState:function(){return sf(Ml)},useDebugValue:lf,useDeferredValue:function(r){var o=er();return ob(o,Yt.memoizedState,r)},useTransition:function(){var r=sf(Ml)[0],o=er().memoizedState;return[r,o]},useMutableSource:W0,useSyncExternalStore:H0,useId:ib,unstable_isNewReconciler:!1},bM={readContext:Jn,useCallback:sb,useContext:Jn,useEffect:of,useImperativeHandle:rb,useInsertionEffect:eb,useLayoutEffect:tb,useMemo:ab,useReducer:af,useRef:Q0,useState:function(){return af(Ml)},useDebugValue:lf,useDeferredValue:function(r){var o=er();return Yt===null?o.memoizedState=r:ob(o,Yt.memoizedState,r)},useTransition:function(){var r=af(Ml)[0],o=er().memoizedState;return[r,o]},useMutableSource:W0,useSyncExternalStore:H0,useId:ib,unstable_isNewReconciler:!1};function br(r,o){if(r&&r.defaultProps){o=U({},o),r=r.defaultProps;for(var d in r)o[d]===void 0&&(o[d]=r[d]);return o}return o}function cf(r,o,d,g){o=r.memoizedState,d=d(g,o),d=d==null?o:U({},o,d),r.memoizedState=d,r.lanes===0&&(r.updateQueue.baseState=d)}var bu={isMounted:function(r){return(r=r._reactInternals)?rn(r)===r:!1},enqueueSetState:function(r,o,d){r=r._reactInternals;var g=Nn(),v=Ys(r),b=hs(g,v);b.payload=o,d!=null&&(b.callback=d),o=Ws(r,b,v),o!==null&&(Nr(o,r,v,g),fu(o,r,v))},enqueueReplaceState:function(r,o,d){r=r._reactInternals;var g=Nn(),v=Ys(r),b=hs(g,v);b.tag=1,b.payload=o,d!=null&&(b.callback=d),o=Ws(r,b,v),o!==null&&(Nr(o,r,v,g),fu(o,r,v))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var d=Nn(),g=Ys(r),v=hs(d,g);v.tag=2,o!=null&&(v.callback=o),o=Ws(r,v,g),o!==null&&(Nr(o,r,g,d),fu(o,r,g))}};function db(r,o,d,g,v,b,A){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(g,b,A):o.prototype&&o.prototype.isPureReactComponent?!Dr(d,g)||!Dr(v,b):!0}function hb(r,o,d){var g=!1,v=Bs,b=o.contextType;return typeof b=="object"&&b!==null?b=Jn(b):(v=Tn(o)?Ha:pn.current,g=o.contextTypes,b=(g=g!=null)?ri(r,v):Bs),o=new o(d,b),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=bu,r.stateNode=o,o._reactInternals=r,g&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=v,r.__reactInternalMemoizedMaskedChildContext=b),o}function fb(r,o,d,g){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(d,g),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(d,g),o.state!==r&&bu.enqueueReplaceState(o,o.state,null)}function uf(r,o,d,g){var v=r.stateNode;v.props=d,v.state=r.memoizedState,v.refs={},Kh(r);var b=o.contextType;typeof b=="object"&&b!==null?v.context=Jn(b):(b=Tn(o)?Ha:pn.current,v.context=ri(r,b)),v.state=r.memoizedState,b=o.getDerivedStateFromProps,typeof b=="function"&&(cf(r,o,b,d),v.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(o=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),o!==v.state&&bu.enqueueReplaceState(v,v.state,null),pu(r,d,v,g),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308)}function di(r,o){try{var d="",g=o;do d+=J(g),g=g.return;while(g);var v=d}catch(b){v=`
39
+ Error generating stack: `+b.message+`
40
+ `+b.stack}return{value:r,source:o,stack:v,digest:null}}function df(r,o,d){return{value:r,source:null,stack:d??null,digest:o??null}}function hf(r,o){try{console.error(o.value)}catch(d){setTimeout(function(){throw d})}}var kM=typeof WeakMap=="function"?WeakMap:Map;function pb(r,o,d){d=hs(-1,d),d.tag=3,d.payload={element:null};var g=o.value;return d.callback=function(){Cu||(Cu=!0,Ef=g),hf(r,o)},d}function mb(r,o,d){d=hs(-1,d),d.tag=3;var g=r.type.getDerivedStateFromError;if(typeof g=="function"){var v=o.value;d.payload=function(){return g(v)},d.callback=function(){hf(r,o)}}var b=r.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(d.callback=function(){hf(r,o),typeof g!="function"&&(Gs===null?Gs=new Set([this]):Gs.add(this));var A=o.stack;this.componentDidCatch(o.value,{componentStack:A!==null?A:""})}),d}function gb(r,o,d){var g=r.pingCache;if(g===null){g=r.pingCache=new kM;var v=new Set;g.set(o,v)}else v=g.get(o),v===void 0&&(v=new Set,g.set(o,v));v.has(d)||(v.add(d),r=PM.bind(null,r,o,d),o.then(r,r))}function yb(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function wb(r,o,d,g,v){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(o=hs(-1,1),o.tag=2,Ws(d,o,1))),d.lanes|=1),r):(r.flags|=65536,r.lanes=v,r)}var _M=C.ReactCurrentOwner,An=!1;function _n(r,o,d,g){o.child=r===null?D0(o,null,d,g):ii(o,r.child,d,g)}function vb(r,o,d,g,v){d=d.render;var b=o.ref;return ci(o,v),g=nf(r,o,d,g,b,v),d=rf(),r!==null&&!An?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,fs(r,o,v)):(Tt&&d&&qh(o),o.flags|=1,_n(r,o,g,v),o.child)}function xb(r,o,d,g,v){if(r===null){var b=d.type;return typeof b=="function"&&!$f(b)&&b.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(o.tag=15,o.type=b,bb(r,o,b,g,v)):(r=$u(d.type,null,g,o,o.mode,v),r.ref=o.ref,r.return=o,o.child=r)}if(b=r.child,(r.lanes&v)===0){var A=b.memoizedProps;if(d=d.compare,d=d!==null?d:Dr,d(A,g)&&r.ref===o.ref)return fs(r,o,v)}return o.flags|=1,r=Xs(b,g),r.ref=o.ref,r.return=o,o.child=r}function bb(r,o,d,g,v){if(r!==null){var b=r.memoizedProps;if(Dr(b,g)&&r.ref===o.ref)if(An=!1,o.pendingProps=g=b,(r.lanes&v)!==0)(r.flags&131072)!==0&&(An=!0);else return o.lanes=r.lanes,fs(r,o,v)}return ff(r,o,d,g,v)}function kb(r,o,d){var g=o.pendingProps,v=g.children,b=r!==null?r.memoizedState:null;if(g.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},jt(fi,Fn),Fn|=d;else{if((d&1073741824)===0)return r=b!==null?b.baseLanes|d:d,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,jt(fi,Fn),Fn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=b!==null?b.baseLanes:d,jt(fi,Fn),Fn|=g}else b!==null?(g=b.baseLanes|d,o.memoizedState=null):g=d,jt(fi,Fn),Fn|=g;return _n(r,o,v,d),o.child}function _b(r,o){var d=o.ref;(r===null&&d!==null||r!==null&&r.ref!==d)&&(o.flags|=512,o.flags|=2097152)}function ff(r,o,d,g,v){var b=Tn(d)?Ha:pn.current;return b=ri(o,b),ci(o,v),d=nf(r,o,d,g,b,v),g=rf(),r!==null&&!An?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,fs(r,o,v)):(Tt&&g&&qh(o),o.flags|=1,_n(r,o,d,v),o.child)}function Nb(r,o,d,g,v){if(Tn(d)){var b=!0;au(o)}else b=!1;if(ci(o,v),o.stateNode===null)_u(r,o),hb(o,d,g),uf(o,d,g,v),g=!0;else if(r===null){var A=o.stateNode,X=o.memoizedProps;A.props=X;var ne=A.context,de=d.contextType;typeof de=="object"&&de!==null?de=Jn(de):(de=Tn(d)?Ha:pn.current,de=ri(o,de));var we=d.getDerivedStateFromProps,xe=typeof we=="function"||typeof A.getSnapshotBeforeUpdate=="function";xe||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(X!==g||ne!==de)&&fb(o,A,g,de),Us=!1;var ye=o.memoizedState;A.state=ye,pu(o,g,A,v),ne=o.memoizedState,X!==g||ye!==ne||Cn.current||Us?(typeof we=="function"&&(cf(o,d,we,g),ne=o.memoizedState),(X=Us||db(o,d,X,g,ye,ne,de))?(xe||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount()),typeof A.componentDidMount=="function"&&(o.flags|=4194308)):(typeof A.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=g,o.memoizedState=ne),A.props=g,A.state=ne,A.context=de,g=X):(typeof A.componentDidMount=="function"&&(o.flags|=4194308),g=!1)}else{A=o.stateNode,F0(r,o),X=o.memoizedProps,de=o.type===o.elementType?X:br(o.type,X),A.props=de,xe=o.pendingProps,ye=A.context,ne=d.contextType,typeof ne=="object"&&ne!==null?ne=Jn(ne):(ne=Tn(d)?Ha:pn.current,ne=ri(o,ne));var Te=d.getDerivedStateFromProps;(we=typeof Te=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(X!==xe||ye!==ne)&&fb(o,A,g,ne),Us=!1,ye=o.memoizedState,A.state=ye,pu(o,g,A,v);var $e=o.memoizedState;X!==xe||ye!==$e||Cn.current||Us?(typeof Te=="function"&&(cf(o,d,Te,g),$e=o.memoizedState),(de=Us||db(o,d,de,g,ye,$e,ne)||!1)?(we||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(g,$e,ne),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(g,$e,ne)),typeof A.componentDidUpdate=="function"&&(o.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof A.componentDidUpdate!="function"||X===r.memoizedProps&&ye===r.memoizedState||(o.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||X===r.memoizedProps&&ye===r.memoizedState||(o.flags|=1024),o.memoizedProps=g,o.memoizedState=$e),A.props=g,A.state=$e,A.context=ne,g=de):(typeof A.componentDidUpdate!="function"||X===r.memoizedProps&&ye===r.memoizedState||(o.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||X===r.memoizedProps&&ye===r.memoizedState||(o.flags|=1024),g=!1)}return pf(r,o,d,g,b,v)}function pf(r,o,d,g,v,b){_b(r,o);var A=(o.flags&128)!==0;if(!g&&!A)return v&&T0(o,d,!1),fs(r,o,b);g=o.stateNode,_M.current=o;var X=A&&typeof d.getDerivedStateFromError!="function"?null:g.render();return o.flags|=1,r!==null&&A?(o.child=ii(o,r.child,null,b),o.child=ii(o,null,X,b)):_n(r,o,X,b),o.memoizedState=g.state,v&&T0(o,d,!0),o.child}function Sb(r){var o=r.stateNode;o.pendingContext?E0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&E0(r,o.context,!1),Xh(r,o.containerInfo)}function jb(r,o,d,g,v){return oi(),Uh(v),o.flags|=256,_n(r,o,d,g),o.child}var mf={dehydrated:null,treeContext:null,retryLane:0};function gf(r){return{baseLanes:r,cachePool:null,transitions:null}}function Eb(r,o,d){var g=o.pendingProps,v=Rt.current,b=!1,A=(o.flags&128)!==0,X;if((X=A)||(X=r!==null&&r.memoizedState===null?!1:(v&2)!==0),X?(b=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(v|=1),jt(Rt,v&1),r===null)return zh(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(A=g.children,r=g.fallback,b?(g=o.mode,b=o.child,A={mode:"hidden",children:A},(g&1)===0&&b!==null?(b.childLanes=0,b.pendingProps=A):b=Ou(A,g,0,null),r=to(r,g,d,null),b.return=o,r.return=o,b.sibling=r,o.child=b,o.child.memoizedState=gf(d),o.memoizedState=mf,r):yf(o,A));if(v=r.memoizedState,v!==null&&(X=v.dehydrated,X!==null))return NM(r,o,A,g,X,v,d);if(b){b=g.fallback,A=o.mode,v=r.child,X=v.sibling;var ne={mode:"hidden",children:g.children};return(A&1)===0&&o.child!==v?(g=o.child,g.childLanes=0,g.pendingProps=ne,o.deletions=null):(g=Xs(v,ne),g.subtreeFlags=v.subtreeFlags&14680064),X!==null?b=Xs(X,b):(b=to(b,A,d,null),b.flags|=2),b.return=o,g.return=o,g.sibling=b,o.child=g,g=b,b=o.child,A=r.child.memoizedState,A=A===null?gf(d):{baseLanes:A.baseLanes|d,cachePool:null,transitions:A.transitions},b.memoizedState=A,b.childLanes=r.childLanes&~d,o.memoizedState=mf,g}return b=r.child,r=b.sibling,g=Xs(b,{mode:"visible",children:g.children}),(o.mode&1)===0&&(g.lanes=d),g.return=o,g.sibling=null,r!==null&&(d=o.deletions,d===null?(o.deletions=[r],o.flags|=16):d.push(r)),o.child=g,o.memoizedState=null,g}function yf(r,o){return o=Ou({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function ku(r,o,d,g){return g!==null&&Uh(g),ii(o,r.child,null,d),r=yf(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function NM(r,o,d,g,v,b,A){if(d)return o.flags&256?(o.flags&=-257,g=df(Error(n(422))),ku(r,o,A,g)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(b=g.fallback,v=o.mode,g=Ou({mode:"visible",children:g.children},v,0,null),b=to(b,v,A,null),b.flags|=2,g.return=o,b.return=o,g.sibling=b,o.child=g,(o.mode&1)!==0&&ii(o,r.child,null,A),o.child.memoizedState=gf(A),o.memoizedState=mf,b);if((o.mode&1)===0)return ku(r,o,A,null);if(v.data==="$!"){if(g=v.nextSibling&&v.nextSibling.dataset,g)var X=g.dgst;return g=X,b=Error(n(419)),g=df(b,g,void 0),ku(r,o,A,g)}if(X=(A&r.childLanes)!==0,An||X){if(g=tn,g!==null){switch(A&-A){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(g.suspendedLanes|A))!==0?0:v,v!==0&&v!==b.retryLane&&(b.retryLane=v,ds(r,v),Nr(g,r,v,-1))}return If(),g=df(Error(n(421))),ku(r,o,A,g)}return v.data==="$?"?(o.flags|=128,o.child=r.child,o=LM.bind(null,r),v._reactRetry=o,null):(r=b.treeContext,qn=vr(v.nextSibling),Dn=o,Tt=!0,xr=null,r!==null&&(Zn[Qn++]=cs,Zn[Qn++]=us,Zn[Qn++]=Ga,cs=r.id,us=r.overflow,Ga=o),o=yf(o,g.children),o.flags|=4096,o)}function Cb(r,o,d){r.lanes|=o;var g=r.alternate;g!==null&&(g.lanes|=o),Vh(r.return,o,d)}function wf(r,o,d,g,v){var b=r.memoizedState;b===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:v}:(b.isBackwards=o,b.rendering=null,b.renderingStartTime=0,b.last=g,b.tail=d,b.tailMode=v)}function Tb(r,o,d){var g=o.pendingProps,v=g.revealOrder,b=g.tail;if(_n(r,o,g.children,d),g=Rt.current,(g&2)!==0)g=g&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Cb(r,d,o);else if(r.tag===19)Cb(r,d,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}g&=1}if(jt(Rt,g),(o.mode&1)===0)o.memoizedState=null;else switch(v){case"forwards":for(d=o.child,v=null;d!==null;)r=d.alternate,r!==null&&mu(r)===null&&(v=d),d=d.sibling;d=v,d===null?(v=o.child,o.child=null):(v=d.sibling,d.sibling=null),wf(o,!1,v,d,b);break;case"backwards":for(d=null,v=o.child,o.child=null;v!==null;){if(r=v.alternate,r!==null&&mu(r)===null){o.child=v;break}r=v.sibling,v.sibling=d,d=v,v=r}wf(o,!0,d,null,b);break;case"together":wf(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function _u(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function fs(r,o,d){if(r!==null&&(o.dependencies=r.dependencies),Za|=o.lanes,(d&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,d=Xs(r,r.pendingProps),o.child=d,d.return=o;r.sibling!==null;)r=r.sibling,d=d.sibling=Xs(r,r.pendingProps),d.return=o;d.sibling=null}return o.child}function SM(r,o,d){switch(o.tag){case 3:Sb(o),oi();break;case 5:U0(o);break;case 1:Tn(o.type)&&au(o);break;case 4:Xh(o,o.stateNode.containerInfo);break;case 10:var g=o.type._context,v=o.memoizedProps.value;jt(du,g._currentValue),g._currentValue=v;break;case 13:if(g=o.memoizedState,g!==null)return g.dehydrated!==null?(jt(Rt,Rt.current&1),o.flags|=128,null):(d&o.child.childLanes)!==0?Eb(r,o,d):(jt(Rt,Rt.current&1),r=fs(r,o,d),r!==null?r.sibling:null);jt(Rt,Rt.current&1);break;case 19:if(g=(d&o.childLanes)!==0,(r.flags&128)!==0){if(g)return Tb(r,o,d);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),jt(Rt,Rt.current),g)break;return null;case 22:case 23:return o.lanes=0,kb(r,o,d)}return fs(r,o,d)}var Ab,vf,Rb,Mb;Ab=function(r,o){for(var d=o.child;d!==null;){if(d.tag===5||d.tag===6)r.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===o)break;for(;d.sibling===null;){if(d.return===null||d.return===o)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},vf=function(){},Rb=function(r,o,d,g){var v=r.memoizedProps;if(v!==g){r=o.stateNode,Ka(Br.current);var b=null;switch(d){case"input":v=Ue(r,v),g=Ue(r,g),b=[];break;case"select":v=U({},v,{value:void 0}),g=U({},g,{value:void 0}),b=[];break;case"textarea":v=Fe(r,v),g=Fe(r,g),b=[];break;default:typeof v.onClick!="function"&&typeof g.onClick=="function"&&(r.onclick=os)}bt(d,g);var A;d=null;for(de in v)if(!g.hasOwnProperty(de)&&v.hasOwnProperty(de)&&v[de]!=null)if(de==="style"){var X=v[de];for(A in X)X.hasOwnProperty(A)&&(d||(d={}),d[A]="")}else de!=="dangerouslySetInnerHTML"&&de!=="children"&&de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&de!=="autoFocus"&&(a.hasOwnProperty(de)?b||(b=[]):(b=b||[]).push(de,null));for(de in g){var ne=g[de];if(X=v!=null?v[de]:void 0,g.hasOwnProperty(de)&&ne!==X&&(ne!=null||X!=null))if(de==="style")if(X){for(A in X)!X.hasOwnProperty(A)||ne&&ne.hasOwnProperty(A)||(d||(d={}),d[A]="");for(A in ne)ne.hasOwnProperty(A)&&X[A]!==ne[A]&&(d||(d={}),d[A]=ne[A])}else d||(b||(b=[]),b.push(de,d)),d=ne;else de==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,X=X?X.__html:void 0,ne!=null&&X!==ne&&(b=b||[]).push(de,ne)):de==="children"?typeof ne!="string"&&typeof ne!="number"||(b=b||[]).push(de,""+ne):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(a.hasOwnProperty(de)?(ne!=null&&de==="onScroll"&&xt("scroll",r),b||X===ne||(b=[])):(b=b||[]).push(de,ne))}d&&(b=b||[]).push("style",d);var de=b;(o.updateQueue=de)&&(o.flags|=4)}},Mb=function(r,o,d,g){d!==g&&(o.flags|=4)};function $l(r,o){if(!Tt)switch(r.tailMode){case"hidden":o=r.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?r.tail=null:d.sibling=null;break;case"collapsed":d=r.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:g.sibling=null}}function gn(r){var o=r.alternate!==null&&r.alternate.child===r.child,d=0,g=0;if(o)for(var v=r.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags&14680064,g|=v.flags&14680064,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags,g|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=g,r.childLanes=d,o}function jM(r,o,d){var g=o.pendingProps;switch(Fh(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gn(o),null;case 1:return Tn(o.type)&&su(),gn(o),null;case 3:return g=o.stateNode,ui(),Et(Cn),Et(pn),Jh(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(r===null||r.child===null)&&(cu(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,xr!==null&&(Af(xr),xr=null))),vf(r,o),gn(o),null;case 5:Zh(o);var v=Ka(Tl.current);if(d=o.type,r!==null&&o.stateNode!=null)Rb(r,o,d,g,v),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!g){if(o.stateNode===null)throw Error(n(166));return gn(o),null}if(r=Ka(Br.current),cu(o)){g=o.stateNode,d=o.type;var b=o.memoizedProps;switch(g[Fr]=o,g[Nl]=b,r=(o.mode&1)!==0,d){case"dialog":xt("cancel",g),xt("close",g);break;case"iframe":case"object":case"embed":xt("load",g);break;case"video":case"audio":for(v=0;v<as.length;v++)xt(as[v],g);break;case"source":xt("error",g);break;case"img":case"image":case"link":xt("error",g),xt("load",g);break;case"details":xt("toggle",g);break;case"input":Se(g,b),xt("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!b.multiple},xt("invalid",g);break;case"textarea":We(g,b),xt("invalid",g)}bt(d,b),v=null;for(var A in b)if(b.hasOwnProperty(A)){var X=b[A];A==="children"?typeof X=="string"?g.textContent!==X&&(b.suppressHydrationWarning!==!0&&an(g.textContent,X,r),v=["children",X]):typeof X=="number"&&g.textContent!==""+X&&(b.suppressHydrationWarning!==!0&&an(g.textContent,X,r),v=["children",""+X]):a.hasOwnProperty(A)&&X!=null&&A==="onScroll"&&xt("scroll",g)}switch(d){case"input":Me(g),_e(g,b,!0);break;case"textarea":Me(g),ot(g);break;case"select":case"option":break;default:typeof b.onClick=="function"&&(g.onclick=os)}g=v,o.updateQueue=g,g!==null&&(o.flags|=4)}else{A=v.nodeType===9?v:v.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=wt(d)),r==="http://www.w3.org/1999/xhtml"?d==="script"?(r=A.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof g.is=="string"?r=A.createElement(d,{is:g.is}):(r=A.createElement(d),d==="select"&&(A=r,g.multiple?A.multiple=!0:g.size&&(A.size=g.size))):r=A.createElementNS(r,d),r[Fr]=o,r[Nl]=g,Ab(r,o,!1,!1),o.stateNode=r;e:{switch(A=nt(d,g),d){case"dialog":xt("cancel",r),xt("close",r),v=g;break;case"iframe":case"object":case"embed":xt("load",r),v=g;break;case"video":case"audio":for(v=0;v<as.length;v++)xt(as[v],r);v=g;break;case"source":xt("error",r),v=g;break;case"img":case"image":case"link":xt("error",r),xt("load",r),v=g;break;case"details":xt("toggle",r),v=g;break;case"input":Se(r,g),v=Ue(r,g),xt("invalid",r);break;case"option":v=g;break;case"select":r._wrapperState={wasMultiple:!!g.multiple},v=U({},g,{value:void 0}),xt("invalid",r);break;case"textarea":We(r,g),v=Fe(r,g),xt("invalid",r);break;default:v=g}bt(d,v),X=v;for(b in X)if(X.hasOwnProperty(b)){var ne=X[b];b==="style"?tt(r,ne):b==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,ne!=null&&ke(r,ne)):b==="children"?typeof ne=="string"?(d!=="textarea"||ne!=="")&&Be(r,ne):typeof ne=="number"&&Be(r,""+ne):b!=="suppressContentEditableWarning"&&b!=="suppressHydrationWarning"&&b!=="autoFocus"&&(a.hasOwnProperty(b)?ne!=null&&b==="onScroll"&&xt("scroll",r):ne!=null&&E(r,b,ne,A))}switch(d){case"input":Me(r),_e(r,g,!1);break;case"textarea":Me(r),ot(r);break;case"option":g.value!=null&&r.setAttribute("value",""+le(g.value));break;case"select":r.multiple=!!g.multiple,b=g.value,b!=null?Ce(r,!!g.multiple,b,!1):g.defaultValue!=null&&Ce(r,!!g.multiple,g.defaultValue,!0);break;default:typeof v.onClick=="function"&&(r.onclick=os)}switch(d){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return gn(o),null;case 6:if(r&&o.stateNode!=null)Mb(r,o,r.memoizedProps,g);else{if(typeof g!="string"&&o.stateNode===null)throw Error(n(166));if(d=Ka(Tl.current),Ka(Br.current),cu(o)){if(g=o.stateNode,d=o.memoizedProps,g[Fr]=o,(b=g.nodeValue!==d)&&(r=Dn,r!==null))switch(r.tag){case 3:an(g.nodeValue,d,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&an(g.nodeValue,d,(r.mode&1)!==0)}b&&(o.flags|=4)}else g=(d.nodeType===9?d:d.ownerDocument).createTextNode(g),g[Fr]=o,o.stateNode=g}return gn(o),null;case 13:if(Et(Rt),g=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(Tt&&qn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)O0(),oi(),o.flags|=98560,b=!1;else if(b=cu(o),g!==null&&g.dehydrated!==null){if(r===null){if(!b)throw Error(n(318));if(b=o.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(n(317));b[Fr]=o}else oi(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;gn(o),b=!1}else xr!==null&&(Af(xr),xr=null),b=!0;if(!b)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=d,o):(g=g!==null,g!==(r!==null&&r.memoizedState!==null)&&g&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(Rt.current&1)!==0?Kt===0&&(Kt=3):If())),o.updateQueue!==null&&(o.flags|=4),gn(o),null);case 4:return ui(),vf(r,o),r===null&&D(o.stateNode.containerInfo),gn(o),null;case 10:return Gh(o.type._context),gn(o),null;case 17:return Tn(o.type)&&su(),gn(o),null;case 19:if(Et(Rt),b=o.memoizedState,b===null)return gn(o),null;if(g=(o.flags&128)!==0,A=b.rendering,A===null)if(g)$l(b,!1);else{if(Kt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(A=mu(r),A!==null){for(o.flags|=128,$l(b,!1),g=A.updateQueue,g!==null&&(o.updateQueue=g,o.flags|=4),o.subtreeFlags=0,g=d,d=o.child;d!==null;)b=d,r=g,b.flags&=14680066,A=b.alternate,A===null?(b.childLanes=0,b.lanes=r,b.child=null,b.subtreeFlags=0,b.memoizedProps=null,b.memoizedState=null,b.updateQueue=null,b.dependencies=null,b.stateNode=null):(b.childLanes=A.childLanes,b.lanes=A.lanes,b.child=A.child,b.subtreeFlags=0,b.deletions=null,b.memoizedProps=A.memoizedProps,b.memoizedState=A.memoizedState,b.updateQueue=A.updateQueue,b.type=A.type,r=A.dependencies,b.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),d=d.sibling;return jt(Rt,Rt.current&1|2),o.child}r=r.sibling}b.tail!==null&&St()>pi&&(o.flags|=128,g=!0,$l(b,!1),o.lanes=4194304)}else{if(!g)if(r=mu(A),r!==null){if(o.flags|=128,g=!0,d=r.updateQueue,d!==null&&(o.updateQueue=d,o.flags|=4),$l(b,!0),b.tail===null&&b.tailMode==="hidden"&&!A.alternate&&!Tt)return gn(o),null}else 2*St()-b.renderingStartTime>pi&&d!==1073741824&&(o.flags|=128,g=!0,$l(b,!1),o.lanes=4194304);b.isBackwards?(A.sibling=o.child,o.child=A):(d=b.last,d!==null?d.sibling=A:o.child=A,b.last=A)}return b.tail!==null?(o=b.tail,b.rendering=o,b.tail=o.sibling,b.renderingStartTime=St(),o.sibling=null,d=Rt.current,jt(Rt,g?d&1|2:d&1),o):(gn(o),null);case 22:case 23:return Mf(),g=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==g&&(o.flags|=8192),g&&(o.mode&1)!==0?(Fn&1073741824)!==0&&(gn(o),o.subtreeFlags&6&&(o.flags|=8192)):gn(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function EM(r,o){switch(Fh(o),o.tag){case 1:return Tn(o.type)&&su(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return ui(),Et(Cn),Et(pn),Jh(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Zh(o),null;case 13:if(Et(Rt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));oi()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return Et(Rt),null;case 4:return ui(),null;case 10:return Gh(o.type._context),null;case 22:case 23:return Mf(),null;case 24:return null;default:return null}}var Nu=!1,yn=!1,CM=typeof WeakSet=="function"?WeakSet:Set,Ie=null;function hi(r,o){var d=r.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(g){Pt(r,o,g)}else d.current=null}function xf(r,o,d){try{d()}catch(g){Pt(r,o,g)}}var Ib=!1;function TM(r,o){if(Zo=Ea,r=zo(),Ls(r)){if("selectionStart"in r)var d={start:r.selectionStart,end:r.selectionEnd};else e:{d=(d=r.ownerDocument)&&d.defaultView||window;var g=d.getSelection&&d.getSelection();if(g&&g.rangeCount!==0){d=g.anchorNode;var v=g.anchorOffset,b=g.focusNode;g=g.focusOffset;try{d.nodeType,b.nodeType}catch{d=null;break e}var A=0,X=-1,ne=-1,de=0,we=0,xe=r,ye=null;t:for(;;){for(var Te;xe!==d||v!==0&&xe.nodeType!==3||(X=A+v),xe!==b||g!==0&&xe.nodeType!==3||(ne=A+g),xe.nodeType===3&&(A+=xe.nodeValue.length),(Te=xe.firstChild)!==null;)ye=xe,xe=Te;for(;;){if(xe===r)break t;if(ye===d&&++de===v&&(X=A),ye===b&&++we===g&&(ne=A),(Te=xe.nextSibling)!==null)break;xe=ye,ye=xe.parentNode}xe=Te}d=X===-1||ne===-1?null:{start:X,end:ne}}else d=null}d=d||{start:0,end:0}}else d=null;for(kl={focusedElem:r,selectionRange:d},Ea=!1,Ie=o;Ie!==null;)if(o=Ie,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,Ie=r;else for(;Ie!==null;){o=Ie;try{var $e=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if($e!==null){var Pe=$e.memoizedProps,zt=$e.memoizedState,ie=o.stateNode,se=ie.getSnapshotBeforeUpdate(o.elementType===o.type?Pe:br(o.type,Pe),zt);ie.__reactInternalSnapshotBeforeUpdate=se}break;case 3:var ce=o.stateNode.containerInfo;ce.nodeType===1?ce.textContent="":ce.nodeType===9&&ce.documentElement&&ce.removeChild(ce.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(be){Pt(o,o.return,be)}if(r=o.sibling,r!==null){r.return=o.return,Ie=r;break}Ie=o.return}return $e=Ib,Ib=!1,$e}function Ol(r,o,d){var g=o.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var v=g=g.next;do{if((v.tag&r)===r){var b=v.destroy;v.destroy=void 0,b!==void 0&&xf(o,d,b)}v=v.next}while(v!==g)}}function Su(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var d=o=o.next;do{if((d.tag&r)===r){var g=d.create;d.destroy=g()}d=d.next}while(d!==o)}}function bf(r){var o=r.ref;if(o!==null){var d=r.stateNode;switch(r.tag){case 5:r=d;break;default:r=d}typeof o=="function"?o(r):o.current=r}}function $b(r){var o=r.alternate;o!==null&&(r.alternate=null,$b(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[Fr],delete o[Nl],delete o[Ph],delete o[dM],delete o[hM])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function Ob(r){return r.tag===5||r.tag===3||r.tag===4}function Pb(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Ob(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function kf(r,o,d){var g=r.tag;if(g===5||g===6)r=r.stateNode,o?d.nodeType===8?d.parentNode.insertBefore(r,o):d.insertBefore(r,o):(d.nodeType===8?(o=d.parentNode,o.insertBefore(r,d)):(o=d,o.appendChild(r)),d=d._reactRootContainer,d!=null||o.onclick!==null||(o.onclick=os));else if(g!==4&&(r=r.child,r!==null))for(kf(r,o,d),r=r.sibling;r!==null;)kf(r,o,d),r=r.sibling}function _f(r,o,d){var g=r.tag;if(g===5||g===6)r=r.stateNode,o?d.insertBefore(r,o):d.appendChild(r);else if(g!==4&&(r=r.child,r!==null))for(_f(r,o,d),r=r.sibling;r!==null;)_f(r,o,d),r=r.sibling}var on=null,kr=!1;function Hs(r,o,d){for(d=d.child;d!==null;)Lb(r,o,d),d=d.sibling}function Lb(r,o,d){if(vn&&typeof vn.onCommitFiberUnmount=="function")try{vn.onCommitFiberUnmount(dr,d)}catch{}switch(d.tag){case 5:yn||hi(d,o);case 6:var g=on,v=kr;on=null,Hs(r,o,d),on=g,kr=v,on!==null&&(kr?(r=on,d=d.stateNode,r.nodeType===8?r.parentNode.removeChild(d):r.removeChild(d)):on.removeChild(d.stateNode));break;case 18:on!==null&&(kr?(r=on,d=d.stateNode,r.nodeType===8?Ot(r.parentNode,d):r.nodeType===1&&Ot(r,d),ja(r)):Ot(on,d.stateNode));break;case 4:g=on,v=kr,on=d.stateNode.containerInfo,kr=!0,Hs(r,o,d),on=g,kr=v;break;case 0:case 11:case 14:case 15:if(!yn&&(g=d.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){v=g=g.next;do{var b=v,A=b.destroy;b=b.tag,A!==void 0&&((b&2)!==0||(b&4)!==0)&&xf(d,o,A),v=v.next}while(v!==g)}Hs(r,o,d);break;case 1:if(!yn&&(hi(d,o),g=d.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=d.memoizedProps,g.state=d.memoizedState,g.componentWillUnmount()}catch(X){Pt(d,o,X)}Hs(r,o,d);break;case 21:Hs(r,o,d);break;case 22:d.mode&1?(yn=(g=yn)||d.memoizedState!==null,Hs(r,o,d),yn=g):Hs(r,o,d);break;default:Hs(r,o,d)}}function Db(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var d=r.stateNode;d===null&&(d=r.stateNode=new CM),o.forEach(function(g){var v=DM.bind(null,r,g);d.has(g)||(d.add(g),g.then(v,v))})}}function _r(r,o){var d=o.deletions;if(d!==null)for(var g=0;g<d.length;g++){var v=d[g];try{var b=r,A=o,X=A;e:for(;X!==null;){switch(X.tag){case 5:on=X.stateNode,kr=!1;break e;case 3:on=X.stateNode.containerInfo,kr=!0;break e;case 4:on=X.stateNode.containerInfo,kr=!0;break e}X=X.return}if(on===null)throw Error(n(160));Lb(b,A,v),on=null,kr=!1;var ne=v.alternate;ne!==null&&(ne.return=null),v.return=null}catch(de){Pt(v,o,de)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)qb(o,r),o=o.sibling}function qb(r,o){var d=r.alternate,g=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(_r(o,r),Ur(r),g&4){try{Ol(3,r,r.return),Su(3,r)}catch(Pe){Pt(r,r.return,Pe)}try{Ol(5,r,r.return)}catch(Pe){Pt(r,r.return,Pe)}}break;case 1:_r(o,r),Ur(r),g&512&&d!==null&&hi(d,d.return);break;case 5:if(_r(o,r),Ur(r),g&512&&d!==null&&hi(d,d.return),r.flags&32){var v=r.stateNode;try{Be(v,"")}catch(Pe){Pt(r,r.return,Pe)}}if(g&4&&(v=r.stateNode,v!=null)){var b=r.memoizedProps,A=d!==null?d.memoizedProps:b,X=r.type,ne=r.updateQueue;if(r.updateQueue=null,ne!==null)try{X==="input"&&b.type==="radio"&&b.name!=null&&Qe(v,b),nt(X,A);var de=nt(X,b);for(A=0;A<ne.length;A+=2){var we=ne[A],xe=ne[A+1];we==="style"?tt(v,xe):we==="dangerouslySetInnerHTML"?ke(v,xe):we==="children"?Be(v,xe):E(v,we,xe,de)}switch(X){case"input":Ne(v,b);break;case"textarea":He(v,b);break;case"select":var ye=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!b.multiple;var Te=b.value;Te!=null?Ce(v,!!b.multiple,Te,!1):ye!==!!b.multiple&&(b.defaultValue!=null?Ce(v,!!b.multiple,b.defaultValue,!0):Ce(v,!!b.multiple,b.multiple?[]:"",!1))}v[Nl]=b}catch(Pe){Pt(r,r.return,Pe)}}break;case 6:if(_r(o,r),Ur(r),g&4){if(r.stateNode===null)throw Error(n(162));v=r.stateNode,b=r.memoizedProps;try{v.nodeValue=b}catch(Pe){Pt(r,r.return,Pe)}}break;case 3:if(_r(o,r),Ur(r),g&4&&d!==null&&d.memoizedState.isDehydrated)try{ja(o.containerInfo)}catch(Pe){Pt(r,r.return,Pe)}break;case 4:_r(o,r),Ur(r);break;case 13:_r(o,r),Ur(r),v=r.child,v.flags&8192&&(b=v.memoizedState!==null,v.stateNode.isHidden=b,!b||v.alternate!==null&&v.alternate.memoizedState!==null||(jf=St())),g&4&&Db(r);break;case 22:if(we=d!==null&&d.memoizedState!==null,r.mode&1?(yn=(de=yn)||we,_r(o,r),yn=de):_r(o,r),Ur(r),g&8192){if(de=r.memoizedState!==null,(r.stateNode.isHidden=de)&&!we&&(r.mode&1)!==0)for(Ie=r,we=r.child;we!==null;){for(xe=Ie=we;Ie!==null;){switch(ye=Ie,Te=ye.child,ye.tag){case 0:case 11:case 14:case 15:Ol(4,ye,ye.return);break;case 1:hi(ye,ye.return);var $e=ye.stateNode;if(typeof $e.componentWillUnmount=="function"){g=ye,d=ye.return;try{o=g,$e.props=o.memoizedProps,$e.state=o.memoizedState,$e.componentWillUnmount()}catch(Pe){Pt(g,d,Pe)}}break;case 5:hi(ye,ye.return);break;case 22:if(ye.memoizedState!==null){zb(xe);continue}}Te!==null?(Te.return=ye,Ie=Te):zb(xe)}we=we.sibling}e:for(we=null,xe=r;;){if(xe.tag===5){if(we===null){we=xe;try{v=xe.stateNode,de?(b=v.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none"):(X=xe.stateNode,ne=xe.memoizedProps.style,A=ne!=null&&ne.hasOwnProperty("display")?ne.display:null,X.style.display=Je("display",A))}catch(Pe){Pt(r,r.return,Pe)}}}else if(xe.tag===6){if(we===null)try{xe.stateNode.nodeValue=de?"":xe.memoizedProps}catch(Pe){Pt(r,r.return,Pe)}}else if((xe.tag!==22&&xe.tag!==23||xe.memoizedState===null||xe===r)&&xe.child!==null){xe.child.return=xe,xe=xe.child;continue}if(xe===r)break e;for(;xe.sibling===null;){if(xe.return===null||xe.return===r)break e;we===xe&&(we=null),xe=xe.return}we===xe&&(we=null),xe.sibling.return=xe.return,xe=xe.sibling}}break;case 19:_r(o,r),Ur(r),g&4&&Db(r);break;case 21:break;default:_r(o,r),Ur(r)}}function Ur(r){var o=r.flags;if(o&2){try{e:{for(var d=r.return;d!==null;){if(Ob(d)){var g=d;break e}d=d.return}throw Error(n(160))}switch(g.tag){case 5:var v=g.stateNode;g.flags&32&&(Be(v,""),g.flags&=-33);var b=Pb(r);_f(r,b,v);break;case 3:case 4:var A=g.stateNode.containerInfo,X=Pb(r);kf(r,X,A);break;default:throw Error(n(161))}}catch(ne){Pt(r,r.return,ne)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function AM(r,o,d){Ie=r,Fb(r)}function Fb(r,o,d){for(var g=(r.mode&1)!==0;Ie!==null;){var v=Ie,b=v.child;if(v.tag===22&&g){var A=v.memoizedState!==null||Nu;if(!A){var X=v.alternate,ne=X!==null&&X.memoizedState!==null||yn;X=Nu;var de=yn;if(Nu=A,(yn=ne)&&!de)for(Ie=v;Ie!==null;)A=Ie,ne=A.child,A.tag===22&&A.memoizedState!==null?Ub(v):ne!==null?(ne.return=A,Ie=ne):Ub(v);for(;b!==null;)Ie=b,Fb(b),b=b.sibling;Ie=v,Nu=X,yn=de}Bb(r)}else(v.subtreeFlags&8772)!==0&&b!==null?(b.return=v,Ie=b):Bb(r)}}function Bb(r){for(;Ie!==null;){var o=Ie;if((o.flags&8772)!==0){var d=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:yn||Su(5,o);break;case 1:var g=o.stateNode;if(o.flags&4&&!yn)if(d===null)g.componentDidMount();else{var v=o.elementType===o.type?d.memoizedProps:br(o.type,d.memoizedProps);g.componentDidUpdate(v,d.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var b=o.updateQueue;b!==null&&z0(o,b,g);break;case 3:var A=o.updateQueue;if(A!==null){if(d=null,o.child!==null)switch(o.child.tag){case 5:d=o.child.stateNode;break;case 1:d=o.child.stateNode}z0(o,A,d)}break;case 5:var X=o.stateNode;if(d===null&&o.flags&4){d=X;var ne=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":ne.autoFocus&&d.focus();break;case"img":ne.src&&(d.src=ne.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var de=o.alternate;if(de!==null){var we=de.memoizedState;if(we!==null){var xe=we.dehydrated;xe!==null&&ja(xe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}yn||o.flags&512&&bf(o)}catch(ye){Pt(o,o.return,ye)}}if(o===r){Ie=null;break}if(d=o.sibling,d!==null){d.return=o.return,Ie=d;break}Ie=o.return}}function zb(r){for(;Ie!==null;){var o=Ie;if(o===r){Ie=null;break}var d=o.sibling;if(d!==null){d.return=o.return,Ie=d;break}Ie=o.return}}function Ub(r){for(;Ie!==null;){var o=Ie;try{switch(o.tag){case 0:case 11:case 15:var d=o.return;try{Su(4,o)}catch(ne){Pt(o,d,ne)}break;case 1:var g=o.stateNode;if(typeof g.componentDidMount=="function"){var v=o.return;try{g.componentDidMount()}catch(ne){Pt(o,v,ne)}}var b=o.return;try{bf(o)}catch(ne){Pt(o,b,ne)}break;case 5:var A=o.return;try{bf(o)}catch(ne){Pt(o,A,ne)}}}catch(ne){Pt(o,o.return,ne)}if(o===r){Ie=null;break}var X=o.sibling;if(X!==null){X.return=o.return,Ie=X;break}Ie=o.return}}var RM=Math.ceil,ju=C.ReactCurrentDispatcher,Nf=C.ReactCurrentOwner,tr=C.ReactCurrentBatchConfig,dt=0,tn=null,Ut=null,ln=0,Fn=0,fi=Fs(0),Kt=0,Pl=null,Za=0,Eu=0,Sf=0,Ll=null,Rn=null,jf=0,pi=1/0,ps=null,Cu=!1,Ef=null,Gs=null,Tu=!1,Vs=null,Au=0,Dl=0,Cf=null,Ru=-1,Mu=0;function Nn(){return(dt&6)!==0?St():Ru!==-1?Ru:Ru=St()}function Ys(r){return(r.mode&1)===0?1:(dt&2)!==0&&ln!==0?ln&-ln:pM.transition!==null?(Mu===0&&(Mu=En()),Mu):(r=mt,r!==0||(r=window.event,r=r===void 0?16:Dc(r.type)),r)}function Nr(r,o,d,g){if(50<Dl)throw Dl=0,Cf=null,Error(n(185));ka(r,d,g),((dt&2)===0||r!==tn)&&(r===tn&&((dt&2)===0&&(Eu|=d),Kt===4&&Ks(r,ln)),Mn(r,g),d===1&&dt===0&&(o.mode&1)===0&&(pi=St()+500,ou&&zs()))}function Mn(r,o){var d=r.callbackNode;jh(r,o);var g=xa(r,r===tn?ln:0);if(g===0)d!==null&&_s(d),r.callbackNode=null,r.callbackPriority=0;else if(o=g&-g,r.callbackPriority!==o){if(d!=null&&_s(d),o===1)r.tag===0?fM(Hb.bind(null,r)):A0(Hb.bind(null,r)),za(function(){(dt&6)===0&&zs()}),d=null;else{switch(hr(g)){case 1:d=Ns;break;case 4:d=_o;break;case 16:d=Or;break;case 536870912:d=No;break;default:d=Or}d=Jb(d,Wb.bind(null,r))}r.callbackPriority=o,r.callbackNode=d}}function Wb(r,o){if(Ru=-1,Mu=0,(dt&6)!==0)throw Error(n(327));var d=r.callbackNode;if(mi()&&r.callbackNode!==d)return null;var g=xa(r,r===tn?ln:0);if(g===0)return null;if((g&30)!==0||(g&r.expiredLanes)!==0||o)o=Iu(r,g);else{o=g;var v=dt;dt|=2;var b=Vb();(tn!==r||ln!==o)&&(ps=null,pi=St()+500,Ja(r,o));do try{$M();break}catch(X){Gb(r,X)}while(!0);Hh(),ju.current=b,dt=v,Ut!==null?o=0:(tn=null,ln=0,o=Kt)}if(o!==0){if(o===2&&(v=So(r),v!==0&&(g=v,o=Tf(r,v))),o===1)throw d=Pl,Ja(r,0),Ks(r,g),Mn(r,St()),d;if(o===6)Ks(r,g);else{if(v=r.current.alternate,(g&30)===0&&!MM(v)&&(o=Iu(r,g),o===2&&(b=So(r),b!==0&&(g=b,o=Tf(r,b))),o===1))throw d=Pl,Ja(r,0),Ks(r,g),Mn(r,St()),d;switch(r.finishedWork=v,r.finishedLanes=g,o){case 0:case 1:throw Error(n(345));case 2:eo(r,Rn,ps);break;case 3:if(Ks(r,g),(g&130023424)===g&&(o=jf+500-St(),10<o)){if(xa(r,0)!==0)break;if(v=r.suspendedLanes,(v&g)!==g){Nn(),r.pingedLanes|=r.suspendedLanes&v;break}r.timeoutHandle=_l(eo.bind(null,r,Rn,ps),o);break}eo(r,Rn,ps);break;case 4:if(Ks(r,g),(g&4194240)===g)break;for(o=r.eventTimes,v=-1;0<g;){var A=31-jn(g);b=1<<A,A=o[A],A>v&&(v=A),g&=~b}if(g=v,g=St()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*RM(g/1960))-g,10<g){r.timeoutHandle=_l(eo.bind(null,r,Rn,ps),g);break}eo(r,Rn,ps);break;case 5:eo(r,Rn,ps);break;default:throw Error(n(329))}}}return Mn(r,St()),r.callbackNode===d?Wb.bind(null,r):null}function Tf(r,o){var d=Ll;return r.current.memoizedState.isDehydrated&&(Ja(r,o).flags|=256),r=Iu(r,o),r!==2&&(o=Rn,Rn=d,o!==null&&Af(o)),r}function Af(r){Rn===null?Rn=r:Rn.push.apply(Rn,r)}function MM(r){for(var o=r;;){if(o.flags&16384){var d=o.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var g=0;g<d.length;g++){var v=d[g],b=v.getSnapshot;v=v.value;try{if(!kn(b(),v))return!1}catch{return!1}}}if(d=o.child,o.subtreeFlags&16384&&d!==null)d.return=o,o=d;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Ks(r,o){for(o&=~Sf,o&=~Eu,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var d=31-jn(o),g=1<<d;r[d]=-1,o&=~g}}function Hb(r){if((dt&6)!==0)throw Error(n(327));mi();var o=xa(r,0);if((o&1)===0)return Mn(r,St()),null;var d=Iu(r,o);if(r.tag!==0&&d===2){var g=So(r);g!==0&&(o=g,d=Tf(r,g))}if(d===1)throw d=Pl,Ja(r,0),Ks(r,o),Mn(r,St()),d;if(d===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,eo(r,Rn,ps),Mn(r,St()),null}function Rf(r,o){var d=dt;dt|=1;try{return r(o)}finally{dt=d,dt===0&&(pi=St()+500,ou&&zs())}}function Qa(r){Vs!==null&&Vs.tag===0&&(dt&6)===0&&mi();var o=dt;dt|=1;var d=tr.transition,g=mt;try{if(tr.transition=null,mt=1,r)return r()}finally{mt=g,tr.transition=d,dt=o,(dt&6)===0&&zs()}}function Mf(){Fn=fi.current,Et(fi)}function Ja(r,o){r.finishedWork=null,r.finishedLanes=0;var d=r.timeoutHandle;if(d!==-1&&(r.timeoutHandle=-1,nu(d)),Ut!==null)for(d=Ut.return;d!==null;){var g=d;switch(Fh(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&su();break;case 3:ui(),Et(Cn),Et(pn),Jh();break;case 5:Zh(g);break;case 4:ui();break;case 13:Et(Rt);break;case 19:Et(Rt);break;case 10:Gh(g.type._context);break;case 22:case 23:Mf()}d=d.return}if(tn=r,Ut=r=Xs(r.current,null),ln=Fn=o,Kt=0,Pl=null,Sf=Eu=Za=0,Rn=Ll=null,Ya!==null){for(o=0;o<Ya.length;o++)if(d=Ya[o],g=d.interleaved,g!==null){d.interleaved=null;var v=g.next,b=d.pending;if(b!==null){var A=b.next;b.next=v,g.next=A}d.pending=g}Ya=null}return r}function Gb(r,o){do{var d=Ut;try{if(Hh(),gu.current=xu,yu){for(var g=Mt.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}yu=!1}if(Xa=0,en=Yt=Mt=null,Al=!1,Rl=0,Nf.current=null,d===null||d.return===null){Kt=1,Pl=o,Ut=null;break}e:{var b=r,A=d.return,X=d,ne=o;if(o=ln,X.flags|=32768,ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var de=ne,we=X,xe=we.tag;if((we.mode&1)===0&&(xe===0||xe===11||xe===15)){var ye=we.alternate;ye?(we.updateQueue=ye.updateQueue,we.memoizedState=ye.memoizedState,we.lanes=ye.lanes):(we.updateQueue=null,we.memoizedState=null)}var Te=yb(A);if(Te!==null){Te.flags&=-257,wb(Te,A,X,b,o),Te.mode&1&&gb(b,de,o),o=Te,ne=de;var $e=o.updateQueue;if($e===null){var Pe=new Set;Pe.add(ne),o.updateQueue=Pe}else $e.add(ne);break e}else{if((o&1)===0){gb(b,de,o),If();break e}ne=Error(n(426))}}else if(Tt&&X.mode&1){var zt=yb(A);if(zt!==null){(zt.flags&65536)===0&&(zt.flags|=256),wb(zt,A,X,b,o),Uh(di(ne,X));break e}}b=ne=di(ne,X),Kt!==4&&(Kt=2),Ll===null?Ll=[b]:Ll.push(b),b=A;do{switch(b.tag){case 3:b.flags|=65536,o&=-o,b.lanes|=o;var ie=pb(b,ne,o);B0(b,ie);break e;case 1:X=ne;var se=b.type,ce=b.stateNode;if((b.flags&128)===0&&(typeof se.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(Gs===null||!Gs.has(ce)))){b.flags|=65536,o&=-o,b.lanes|=o;var be=mb(b,X,o);B0(b,be);break e}}b=b.return}while(b!==null)}Kb(d)}catch(De){o=De,Ut===d&&d!==null&&(Ut=d=d.return);continue}break}while(!0)}function Vb(){var r=ju.current;return ju.current=xu,r===null?xu:r}function If(){(Kt===0||Kt===3||Kt===2)&&(Kt=4),tn===null||(Za&268435455)===0&&(Eu&268435455)===0||Ks(tn,ln)}function Iu(r,o){var d=dt;dt|=2;var g=Vb();(tn!==r||ln!==o)&&(ps=null,Ja(r,o));do try{IM();break}catch(v){Gb(r,v)}while(!0);if(Hh(),dt=d,ju.current=g,Ut!==null)throw Error(n(261));return tn=null,ln=0,Kt}function IM(){for(;Ut!==null;)Yb(Ut)}function $M(){for(;Ut!==null&&!fa();)Yb(Ut)}function Yb(r){var o=Qb(r.alternate,r,Fn);r.memoizedProps=r.pendingProps,o===null?Kb(r):Ut=o,Nf.current=null}function Kb(r){var o=r;do{var d=o.alternate;if(r=o.return,(o.flags&32768)===0){if(d=jM(d,o,Fn),d!==null){Ut=d;return}}else{if(d=EM(d,o),d!==null){d.flags&=32767,Ut=d;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Kt=6,Ut=null;return}}if(o=o.sibling,o!==null){Ut=o;return}Ut=o=r}while(o!==null);Kt===0&&(Kt=5)}function eo(r,o,d){var g=mt,v=tr.transition;try{tr.transition=null,mt=1,OM(r,o,d,g)}finally{tr.transition=v,mt=g}return null}function OM(r,o,d,g){do mi();while(Vs!==null);if((dt&6)!==0)throw Error(n(327));d=r.finishedWork;var v=r.finishedLanes;if(d===null)return null;if(r.finishedWork=null,r.finishedLanes=0,d===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var b=d.lanes|d.childLanes;if(Zi(r,b),r===tn&&(Ut=tn=null,ln=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Tu||(Tu=!0,Jb(Or,function(){return mi(),null})),b=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||b){b=tr.transition,tr.transition=null;var A=mt;mt=1;var X=dt;dt|=4,Nf.current=null,TM(r,d),qb(d,r),ml(kl),Ea=!!Zo,kl=Zo=null,r.current=d,AM(d),pa(),dt=X,mt=A,tr.transition=b}else r.current=d;if(Tu&&(Tu=!1,Vs=r,Au=v),b=r.pendingLanes,b===0&&(Gs=null),Pr(d.stateNode),Mn(r,St()),o!==null)for(g=r.onRecoverableError,d=0;d<o.length;d++)v=o[d],g(v.value,{componentStack:v.stack,digest:v.digest});if(Cu)throw Cu=!1,r=Ef,Ef=null,r;return(Au&1)!==0&&r.tag!==0&&mi(),b=r.pendingLanes,(b&1)!==0?r===Cf?Dl++:(Dl=0,Cf=r):Dl=0,zs(),null}function mi(){if(Vs!==null){var r=hr(Au),o=tr.transition,d=mt;try{if(tr.transition=null,mt=16>r?16:r,Vs===null)var g=!1;else{if(r=Vs,Vs=null,Au=0,(dt&6)!==0)throw Error(n(331));var v=dt;for(dt|=4,Ie=r.current;Ie!==null;){var b=Ie,A=b.child;if((Ie.flags&16)!==0){var X=b.deletions;if(X!==null){for(var ne=0;ne<X.length;ne++){var de=X[ne];for(Ie=de;Ie!==null;){var we=Ie;switch(we.tag){case 0:case 11:case 15:Ol(8,we,b)}var xe=we.child;if(xe!==null)xe.return=we,Ie=xe;else for(;Ie!==null;){we=Ie;var ye=we.sibling,Te=we.return;if($b(we),we===de){Ie=null;break}if(ye!==null){ye.return=Te,Ie=ye;break}Ie=Te}}}var $e=b.alternate;if($e!==null){var Pe=$e.child;if(Pe!==null){$e.child=null;do{var zt=Pe.sibling;Pe.sibling=null,Pe=zt}while(Pe!==null)}}Ie=b}}if((b.subtreeFlags&2064)!==0&&A!==null)A.return=b,Ie=A;else e:for(;Ie!==null;){if(b=Ie,(b.flags&2048)!==0)switch(b.tag){case 0:case 11:case 15:Ol(9,b,b.return)}var ie=b.sibling;if(ie!==null){ie.return=b.return,Ie=ie;break e}Ie=b.return}}var se=r.current;for(Ie=se;Ie!==null;){A=Ie;var ce=A.child;if((A.subtreeFlags&2064)!==0&&ce!==null)ce.return=A,Ie=ce;else e:for(A=se;Ie!==null;){if(X=Ie,(X.flags&2048)!==0)try{switch(X.tag){case 0:case 11:case 15:Su(9,X)}}catch(De){Pt(X,X.return,De)}if(X===A){Ie=null;break e}var be=X.sibling;if(be!==null){be.return=X.return,Ie=be;break e}Ie=X.return}}if(dt=v,zs(),vn&&typeof vn.onPostCommitFiberRoot=="function")try{vn.onPostCommitFiberRoot(dr,r)}catch{}g=!0}return g}finally{mt=d,tr.transition=o}}return!1}function Xb(r,o,d){o=di(d,o),o=pb(r,o,1),r=Ws(r,o,1),o=Nn(),r!==null&&(ka(r,1,o),Mn(r,o))}function Pt(r,o,d){if(r.tag===3)Xb(r,r,d);else for(;o!==null;){if(o.tag===3){Xb(o,r,d);break}else if(o.tag===1){var g=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Gs===null||!Gs.has(g))){r=di(d,r),r=mb(o,r,1),o=Ws(o,r,1),r=Nn(),o!==null&&(ka(o,1,r),Mn(o,r));break}}o=o.return}}function PM(r,o,d){var g=r.pingCache;g!==null&&g.delete(o),o=Nn(),r.pingedLanes|=r.suspendedLanes&d,tn===r&&(ln&d)===d&&(Kt===4||Kt===3&&(ln&130023424)===ln&&500>St()-jf?Ja(r,0):Sf|=d),Mn(r,o)}function Zb(r,o){o===0&&((r.mode&1)===0?o=1:(o=wa,wa<<=1,(wa&130023424)===0&&(wa=4194304)));var d=Nn();r=ds(r,o),r!==null&&(ka(r,o,d),Mn(r,d))}function LM(r){var o=r.memoizedState,d=0;o!==null&&(d=o.retryLane),Zb(r,d)}function DM(r,o){var d=0;switch(r.tag){case 13:var g=r.stateNode,v=r.memoizedState;v!==null&&(d=v.retryLane);break;case 19:g=r.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(o),Zb(r,d)}var Qb;Qb=function(r,o,d){if(r!==null)if(r.memoizedProps!==o.pendingProps||Cn.current)An=!0;else{if((r.lanes&d)===0&&(o.flags&128)===0)return An=!1,SM(r,o,d);An=(r.flags&131072)!==0}else An=!1,Tt&&(o.flags&1048576)!==0&&R0(o,lu,o.index);switch(o.lanes=0,o.tag){case 2:var g=o.type;_u(r,o),r=o.pendingProps;var v=ri(o,pn.current);ci(o,d),v=nf(null,o,g,r,v,d);var b=rf();return o.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Tn(g)?(b=!0,au(o)):b=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Kh(o),v.updater=bu,o.stateNode=v,v._reactInternals=o,uf(o,g,r,d),o=pf(null,o,g,!0,b,d)):(o.tag=0,Tt&&b&&qh(o),_n(null,o,v,d),o=o.child),o;case 16:g=o.elementType;e:{switch(_u(r,o),r=o.pendingProps,v=g._init,g=v(g._payload),o.type=g,v=o.tag=FM(g),r=br(g,r),v){case 0:o=ff(null,o,g,r,d);break e;case 1:o=Nb(null,o,g,r,d);break e;case 11:o=vb(null,o,g,r,d);break e;case 14:o=xb(null,o,g,br(g.type,r),d);break e}throw Error(n(306,g,""))}return o;case 0:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:br(g,v),ff(r,o,g,v,d);case 1:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:br(g,v),Nb(r,o,g,v,d);case 3:e:{if(Sb(o),r===null)throw Error(n(387));g=o.pendingProps,b=o.memoizedState,v=b.element,F0(r,o),pu(o,g,null,d);var A=o.memoizedState;if(g=A.element,b.isDehydrated)if(b={element:g,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},o.updateQueue.baseState=b,o.memoizedState=b,o.flags&256){v=di(Error(n(423)),o),o=jb(r,o,g,d,v);break e}else if(g!==v){v=di(Error(n(424)),o),o=jb(r,o,g,d,v);break e}else for(qn=vr(o.stateNode.containerInfo.firstChild),Dn=o,Tt=!0,xr=null,d=D0(o,null,g,d),o.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(oi(),g===v){o=fs(r,o,d);break e}_n(r,o,g,d)}o=o.child}return o;case 5:return U0(o),r===null&&zh(o),g=o.type,v=o.pendingProps,b=r!==null?r.memoizedProps:null,A=v.children,Qo(g,v)?A=null:b!==null&&Qo(g,b)&&(o.flags|=32),_b(r,o),_n(r,o,A,d),o.child;case 6:return r===null&&zh(o),null;case 13:return Eb(r,o,d);case 4:return Xh(o,o.stateNode.containerInfo),g=o.pendingProps,r===null?o.child=ii(o,null,g,d):_n(r,o,g,d),o.child;case 11:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:br(g,v),vb(r,o,g,v,d);case 7:return _n(r,o,o.pendingProps,d),o.child;case 8:return _n(r,o,o.pendingProps.children,d),o.child;case 12:return _n(r,o,o.pendingProps.children,d),o.child;case 10:e:{if(g=o.type._context,v=o.pendingProps,b=o.memoizedProps,A=v.value,jt(du,g._currentValue),g._currentValue=A,b!==null)if(kn(b.value,A)){if(b.children===v.children&&!Cn.current){o=fs(r,o,d);break e}}else for(b=o.child,b!==null&&(b.return=o);b!==null;){var X=b.dependencies;if(X!==null){A=b.child;for(var ne=X.firstContext;ne!==null;){if(ne.context===g){if(b.tag===1){ne=hs(-1,d&-d),ne.tag=2;var de=b.updateQueue;if(de!==null){de=de.shared;var we=de.pending;we===null?ne.next=ne:(ne.next=we.next,we.next=ne),de.pending=ne}}b.lanes|=d,ne=b.alternate,ne!==null&&(ne.lanes|=d),Vh(b.return,d,o),X.lanes|=d;break}ne=ne.next}}else if(b.tag===10)A=b.type===o.type?null:b.child;else if(b.tag===18){if(A=b.return,A===null)throw Error(n(341));A.lanes|=d,X=A.alternate,X!==null&&(X.lanes|=d),Vh(A,d,o),A=b.sibling}else A=b.child;if(A!==null)A.return=b;else for(A=b;A!==null;){if(A===o){A=null;break}if(b=A.sibling,b!==null){b.return=A.return,A=b;break}A=A.return}b=A}_n(r,o,v.children,d),o=o.child}return o;case 9:return v=o.type,g=o.pendingProps.children,ci(o,d),v=Jn(v),g=g(v),o.flags|=1,_n(r,o,g,d),o.child;case 14:return g=o.type,v=br(g,o.pendingProps),v=br(g.type,v),xb(r,o,g,v,d);case 15:return bb(r,o,o.type,o.pendingProps,d);case 17:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:br(g,v),_u(r,o),o.tag=1,Tn(g)?(r=!0,au(o)):r=!1,ci(o,d),hb(o,g,v),uf(o,g,v,d),pf(null,o,g,!0,r,d);case 19:return Tb(r,o,d);case 22:return kb(r,o,d)}throw Error(n(156,o.tag))};function Jb(r,o){return ha(r,o)}function qM(r,o,d,g){this.tag=r,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function nr(r,o,d,g){return new qM(r,o,d,g)}function $f(r){return r=r.prototype,!(!r||!r.isReactComponent)}function FM(r){if(typeof r=="function")return $f(r)?1:0;if(r!=null){if(r=r.$$typeof,r===Z)return 11;if(r===K)return 14}return 2}function Xs(r,o){var d=r.alternate;return d===null?(d=nr(r.tag,o,r.key,r.mode),d.elementType=r.elementType,d.type=r.type,d.stateNode=r.stateNode,d.alternate=r,r.alternate=d):(d.pendingProps=o,d.type=r.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=r.flags&14680064,d.childLanes=r.childLanes,d.lanes=r.lanes,d.child=r.child,d.memoizedProps=r.memoizedProps,d.memoizedState=r.memoizedState,d.updateQueue=r.updateQueue,o=r.dependencies,d.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},d.sibling=r.sibling,d.index=r.index,d.ref=r.ref,d}function $u(r,o,d,g,v,b){var A=2;if(g=r,typeof r=="function")$f(r)&&(A=1);else if(typeof r=="string")A=5;else e:switch(r){case I:return to(d.children,v,b,o);case F:A=8,v|=8;break;case W:return r=nr(12,d,o,v|2),r.elementType=W,r.lanes=b,r;case Q:return r=nr(13,d,o,v),r.elementType=Q,r.lanes=b,r;case M:return r=nr(19,d,o,v),r.elementType=M,r.lanes=b,r;case P:return Ou(d,v,b,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case O:A=10;break e;case B:A=9;break e;case Z:A=11;break e;case K:A=14;break e;case G:A=16,g=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=nr(A,d,o,v),o.elementType=r,o.type=g,o.lanes=b,o}function to(r,o,d,g){return r=nr(7,r,g,o),r.lanes=d,r}function Ou(r,o,d,g){return r=nr(22,r,g,o),r.elementType=P,r.lanes=d,r.stateNode={isHidden:!1},r}function Of(r,o,d){return r=nr(6,r,null,o),r.lanes=d,r}function Pf(r,o,d){return o=nr(4,r.children!==null?r.children:[],r.key,o),o.lanes=d,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function BM(r,o,d,g,v){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ss(0),this.expirationTimes=Ss(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ss(0),this.identifierPrefix=g,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Lf(r,o,d,g,v,b,A,X,ne){return r=new BM(r,o,d,X,ne),o===1?(o=1,b===!0&&(o|=8)):o=0,b=nr(3,null,null,o),r.current=b,b.stateNode=r,b.memoizedState={element:g,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Kh(b),r}function zM(r,o,d){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:g==null?null:""+g,children:r,containerInfo:o,implementation:d}}function ek(r){if(!r)return Bs;r=r._reactInternals;e:{if(rn(r)!==r||r.tag!==1)throw Error(n(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(Tn(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var d=r.type;if(Tn(d))return C0(r,d,o)}return o}function tk(r,o,d,g,v,b,A,X,ne){return r=Lf(d,g,!0,r,v,b,A,X,ne),r.context=ek(null),d=r.current,g=Nn(),v=Ys(d),b=hs(g,v),b.callback=o??null,Ws(d,b,v),r.current.lanes=v,ka(r,v,g),Mn(r,g),r}function Pu(r,o,d,g){var v=o.current,b=Nn(),A=Ys(v);return d=ek(d),o.context===null?o.context=d:o.pendingContext=d,o=hs(b,A),o.payload={element:r},g=g===void 0?null:g,g!==null&&(o.callback=g),r=Ws(v,o,A),r!==null&&(Nr(r,v,A,b),fu(r,v,A)),A}function Lu(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function nk(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var d=r.retryLane;r.retryLane=d!==0&&d<o?d:o}}function Df(r,o){nk(r,o),(r=r.alternate)&&nk(r,o)}function UM(){return null}var rk=typeof reportError=="function"?reportError:function(r){console.error(r)};function qf(r){this._internalRoot=r}Du.prototype.render=qf.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Pu(r,o,null,null)},Du.prototype.unmount=qf.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;Qa(function(){Pu(null,r,null,null)}),o[is]=null}};function Du(r){this._internalRoot=r}Du.prototype.unstable_scheduleHydration=function(r){if(r){var o=fr();r={blockedOn:null,target:r,priority:o};for(var d=0;d<Pn.length&&o!==0&&o<Pn[d].priority;d++);Pn.splice(d,0,r),d===0&&tl(r)}};function Ff(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function qu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function sk(){}function WM(r,o,d,g,v){if(v){if(typeof g=="function"){var b=g;g=function(){var de=Lu(A);b.call(de)}}var A=tk(o,g,r,0,null,!1,!1,"",sk);return r._reactRootContainer=A,r[is]=A.current,D(r.nodeType===8?r.parentNode:r),Qa(),A}for(;v=r.lastChild;)r.removeChild(v);if(typeof g=="function"){var X=g;g=function(){var de=Lu(ne);X.call(de)}}var ne=Lf(r,0,!1,null,null,!1,!1,"",sk);return r._reactRootContainer=ne,r[is]=ne.current,D(r.nodeType===8?r.parentNode:r),Qa(function(){Pu(o,ne,d,g)}),ne}function Fu(r,o,d,g,v){var b=d._reactRootContainer;if(b){var A=b;if(typeof v=="function"){var X=v;v=function(){var ne=Lu(A);X.call(ne)}}Pu(o,A,r,v)}else A=WM(d,o,r,v,g);return Lu(A)}_a=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var d=va(o.pendingLanes);d!==0&&(Ft(o,d|1),Mn(o,St()),(dt&6)===0&&(pi=St()+500,zs()))}break;case 13:Qa(function(){var g=ds(r,1);if(g!==null){var v=Nn();Nr(g,r,1,v)}}),Df(r,1)}},jo=function(r){if(r.tag===13){var o=ds(r,134217728);if(o!==null){var d=Nn();Nr(o,r,134217728,d)}Df(r,134217728)}},Pc=function(r){if(r.tag===13){var o=Ys(r),d=ds(r,o);if(d!==null){var g=Nn();Nr(d,r,o,g)}Df(r,o)}},fr=function(){return mt},Na=function(r,o){var d=mt;try{return mt=r,o()}finally{mt=d}},lt=function(r,o,d){switch(o){case"input":if(Ne(r,d),o=d.name,d.type==="radio"&&o!=null){for(d=r;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<d.length;o++){var g=d[o];if(g!==r&&g.form===r.form){var v=ru(g);if(!v)throw Error(n(90));qe(g),Ne(g,v)}}}break;case"textarea":He(r,d);break;case"select":o=d.value,o!=null&&Ce(r,!!d.multiple,o,!1)}},Vn=Rf,Yn=Qa;var HM={usingClientEntryPoint:!1,Events:[Sl,ti,ru,Gn,It,Rf]},ql={findFiberByHostInstance:Wa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},GM={bundleType:ql.bundleType,version:ql.version,rendererPackageName:ql.rendererPackageName,rendererConfig:ql.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=ua(r),r===null?null:r.stateNode},findFiberByHostInstance:ql.findFiberByHostInstance||UM,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 Bu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bu.isDisabled&&Bu.supportsFiber)try{dr=Bu.inject(GM),vn=Bu}catch{}}return In.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=HM,In.createPortal=function(r,o){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ff(o))throw Error(n(200));return zM(r,o,null,d)},In.createRoot=function(r,o){if(!Ff(r))throw Error(n(299));var d=!1,g="",v=rk;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(g=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=Lf(r,1,!1,null,null,d,!1,g,v),r[is]=o.current,D(r.nodeType===8?r.parentNode:r),new qf(o)},In.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=ua(o),r=r===null?null:r.stateNode,r},In.flushSync=function(r){return Qa(r)},In.hydrate=function(r,o,d){if(!qu(o))throw Error(n(200));return Fu(null,r,o,!0,d)},In.hydrateRoot=function(r,o,d){if(!Ff(r))throw Error(n(405));var g=d!=null&&d.hydratedSources||null,v=!1,b="",A=rk;if(d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(b=d.identifierPrefix),d.onRecoverableError!==void 0&&(A=d.onRecoverableError)),o=tk(o,null,r,1,d??null,v,!1,b,A),r[is]=o.current,D(r),g)for(r=0;r<g.length;r++)d=g[r],v=d._getVersion,v=v(d._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[d,v]:o.mutableSourceEagerHydrationData.push(d,v);return new Du(o)},In.render=function(r,o,d){if(!qu(o))throw Error(n(200));return Fu(null,r,o,!1,d)},In.unmountComponentAtNode=function(r){if(!qu(r))throw Error(n(40));return r._reactRootContainer?(Qa(function(){Fu(null,null,r,!1,function(){r._reactRootContainer=null,r[is]=null})}),!0):!1},In.unstable_batchedUpdates=Rf,In.unstable_renderSubtreeIntoContainer=function(r,o,d,g){if(!qu(d))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Fu(r,o,d,!1,g)},In.version="18.3.1-next-f1338f8080-20240426",In}var hk;function wT(){if(hk)return Uf.exports;hk=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(),Uf.exports=JM(),Uf.exports}var fk;function eI(){if(fk)return Uu;fk=1;var e=wT();return Uu.createRoot=e.createRoot,Uu.hydrateRoot=e.hydrateRoot,Uu}var tI=eI();const nI="modulepreload",rI=function(e){return"/"+e},pk={},vT=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let c=function(p){return Promise.all(p.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=c(n.map(p=>{if(p=rI(p),p in pk)return;pk[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":nI,h||(y.as="script"),y.crossOrigin="",y.href=p,f&&y.setAttribute("nonce",f),document.head.appendChild(y),h)return new Promise((w,N)=>{y.addEventListener("load",w),y.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${p}`)))})}))}function i(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return a.then(c=>{for(const u of c||[])u.status==="rejected"&&i(u.reason);return t().catch(i)})};var x=bc();const pe=xx(x);function un(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=un(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Gf={exports:{}},Vf={},Yf={exports:{}},Kf={};/**
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 mk;function sI(){if(mk)return Kf;mk=1;var e=bc();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,s=e.useState,a=e.useEffect,i=e.useLayoutEffect,c=e.useDebugValue;function u(m,y){var w=y(),N=s({inst:{value:w,getSnapshot:y}}),_=N[0].inst,j=N[1];return i(function(){_.value=w,_.getSnapshot=y,f(_)&&j({inst:_})},[m,w,y]),a(function(){return f(_)&&j({inst:_}),m(function(){f(_)&&j({inst:_})})},[m]),c(w),w}function f(m){var y=m.getSnapshot;m=m.value;try{var w=y();return!n(m,w)}catch{return!0}}function p(m,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return Kf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,Kf}var gk;function aI(){return gk||(gk=1,Yf.exports=sI()),Yf.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 yk;function oI(){if(yk)return Vf;yk=1;var e=bc(),t=aI();function n(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var s=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,i=e.useRef,c=e.useEffect,u=e.useMemo,f=e.useDebugValue;return Vf.useSyncExternalStoreWithSelector=function(p,h,m,y,w){var N=i(null);if(N.current===null){var _={hasValue:!1,value:null};N.current=_}else _=N.current;N=u(function(){function k(R){if(!S){if(S=!0,E=R,R=y(R),w!==void 0&&_.hasValue){var I=_.value;if(w(I,R))return C=I}return C=R}if(I=C,s(E,R))return I;var F=y(R);return w!==void 0&&w(I,F)?(E=R,I):(E=R,C=F)}var S=!1,E,C,T=m===void 0?null:m;return[function(){return k(h())},T===null?void 0:function(){return k(T())}]},[h,m,y,w]);var j=a(p,N[0],N[1]);return c(function(){_.hasValue=!0,_.value=j},[j]),f(j),j},Vf}var wk;function iI(){return wk||(wk=1,Gf.exports=oI()),Gf.exports}var lI=iI();const cI=xx(lI),uI={},vk=e=>{let t;const n=new Set,s=(h,m)=>{const y=typeof h=="function"?h(t):h;if(!Object.is(y,t)){const w=t;t=m??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(N=>N(t,w))}},a=()=>t,f={setState:s,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(uI?"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(s,a,f);return f},dI=e=>e?vk(e):vk,{useDebugValue:hI}=pe,{useSyncExternalStoreWithSelector:fI}=cI,pI=e=>e;function xT(e,t=pI,n){const s=fI(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return hI(s),s}const xk=(e,t)=>{const n=dI(e),s=(a,i=t)=>xT(n,a,i);return Object.assign(s,n),s},mI=(e,t)=>e?xk(e,t):xk;function Qt(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[s,a]of e)if(!Object.is(a,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}var gI={value:()=>{}};function Gd(){for(var e=0,t=arguments.length,n={},s;e<t;++e){if(!(s=arguments[e]+"")||s in n||/[\s.]/.test(s))throw new Error("illegal type: "+s);n[s]=[]}return new fd(n)}function fd(e){this._=e}function yI(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",a=n.indexOf(".");if(a>=0&&(s=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}fd.prototype=Gd.prototype={constructor:fd,on:function(e,t){var n=this._,s=yI(e+"",n),a,i=-1,c=s.length;if(arguments.length<2){for(;++i<c;)if((a=(e=s[i]).type)&&(a=wI(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<c;)if(a=(e=s[i]).type)n[a]=bk(n[a],e.name,t);else if(t==null)for(a in n)n[a]=bk(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new fd(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),s=0,a,i;s<a;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],s=0,a=i.length;s<a;++s)i[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],a=0,i=s.length;a<i;++a)s[a].value.apply(t,n)}};function wI(e,t){for(var n=0,s=e.length,a;n<s;++n)if((a=e[n]).name===t)return a.value}function bk(e,t,n){for(var s=0,a=e.length;s<a;++s)if(e[s].name===t){e[s]=gI,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var Bv="http://www.w3.org/1999/xhtml";const kk={svg:"http://www.w3.org/2000/svg",xhtml:Bv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vd(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),kk.hasOwnProperty(t)?{space:kk[t],local:e}:e}function vI(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Bv&&t.documentElement.namespaceURI===Bv?t.createElement(e):t.createElementNS(n,e)}}function xI(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function bT(e){var t=Vd(e);return(t.local?xI:vI)(t)}function bI(){}function bx(e){return e==null?bI:function(){return this.querySelector(e)}}function kI(e){typeof e!="function"&&(e=bx(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],c=i.length,u=s[a]=new Array(c),f,p,h=0;h<c;++h)(f=i[h])&&(p=e.call(f,f.__data__,h,i))&&("__data__"in f&&(p.__data__=f.__data__),u[h]=p);return new Wn(s,this._parents)}function _I(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function NI(){return[]}function kT(e){return e==null?NI:function(){return this.querySelectorAll(e)}}function SI(e){return function(){return _I(e.apply(this,arguments))}}function jI(e){typeof e=="function"?e=SI(e):e=kT(e);for(var t=this._groups,n=t.length,s=[],a=[],i=0;i<n;++i)for(var c=t[i],u=c.length,f,p=0;p<u;++p)(f=c[p])&&(s.push(e.call(f,f.__data__,p,c)),a.push(f));return new Wn(s,a)}function _T(e){return function(){return this.matches(e)}}function NT(e){return function(t){return t.matches(e)}}var EI=Array.prototype.find;function CI(e){return function(){return EI.call(this.children,e)}}function TI(){return this.firstElementChild}function AI(e){return this.select(e==null?TI:CI(typeof e=="function"?e:NT(e)))}var RI=Array.prototype.filter;function MI(){return Array.from(this.children)}function II(e){return function(){return RI.call(this.children,e)}}function $I(e){return this.selectAll(e==null?MI:II(typeof e=="function"?e:NT(e)))}function OI(e){typeof e!="function"&&(e=_T(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],c=i.length,u=s[a]=[],f,p=0;p<c;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&u.push(f);return new Wn(s,this._parents)}function ST(e){return new Array(e.length)}function PI(){return new Wn(this._enter||this._groups.map(ST),this._parents)}function Nd(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Nd.prototype={constructor:Nd,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 LI(e){return function(){return e}}function DI(e,t,n,s,a,i){for(var c=0,u,f=t.length,p=i.length;c<p;++c)(u=t[c])?(u.__data__=i[c],s[c]=u):n[c]=new Nd(e,i[c]);for(;c<f;++c)(u=t[c])&&(a[c]=u)}function qI(e,t,n,s,a,i,c){var u,f,p=new Map,h=t.length,m=i.length,y=new Array(h),w;for(u=0;u<h;++u)(f=t[u])&&(y[u]=w=c.call(f,f.__data__,u,t)+"",p.has(w)?a[u]=f:p.set(w,f));for(u=0;u<m;++u)w=c.call(e,i[u],u,i)+"",(f=p.get(w))?(s[u]=f,f.__data__=i[u],p.delete(w)):n[u]=new Nd(e,i[u]);for(u=0;u<h;++u)(f=t[u])&&p.get(y[u])===f&&(a[u]=f)}function FI(e){return e.__data__}function BI(e,t){if(!arguments.length)return Array.from(this,FI);var n=t?qI:DI,s=this._parents,a=this._groups;typeof e!="function"&&(e=LI(e));for(var i=a.length,c=new Array(i),u=new Array(i),f=new Array(i),p=0;p<i;++p){var h=s[p],m=a[p],y=m.length,w=zI(e.call(h,h&&h.__data__,p,s)),N=w.length,_=u[p]=new Array(N),j=c[p]=new Array(N),k=f[p]=new Array(y);n(h,m,_,j,k,w,t);for(var S=0,E=0,C,T;S<N;++S)if(C=_[S]){for(S>=E&&(E=S+1);!(T=j[E])&&++E<N;);C._next=T||null}}return c=new Wn(c,s),c._enter=u,c._exit=f,c}function zI(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function UI(){return new Wn(this._exit||this._groups.map(ST),this._parents)}function WI(e,t,n){var s=this.enter(),a=this,i=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?i.remove():n(i),s&&a?s.merge(a).order():a}function HI(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,a=n.length,i=s.length,c=Math.min(a,i),u=new Array(a),f=0;f<c;++f)for(var p=n[f],h=s[f],m=p.length,y=u[f]=new Array(m),w,N=0;N<m;++N)(w=p[N]||h[N])&&(y[N]=w);for(;f<a;++f)u[f]=n[f];return new Wn(u,this._parents)}function GI(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],a=s.length-1,i=s[a],c;--a>=0;)(c=s[a])&&(i&&c.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(c,i),i=c);return this}function VI(e){e||(e=YI);function t(m,y){return m&&y?e(m.__data__,y.__data__):!m-!y}for(var n=this._groups,s=n.length,a=new Array(s),i=0;i<s;++i){for(var c=n[i],u=c.length,f=a[i]=new Array(u),p,h=0;h<u;++h)(p=c[h])&&(f[h]=p);f.sort(t)}return new Wn(a,this._parents).order()}function YI(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function KI(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function XI(){return Array.from(this)}function ZI(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,i=s.length;a<i;++a){var c=s[a];if(c)return c}return null}function QI(){let e=0;for(const t of this)++e;return e}function JI(){return!this.node()}function e$(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var a=t[n],i=0,c=a.length,u;i<c;++i)(u=a[i])&&e.call(u,u.__data__,i,a);return this}function t$(e){return function(){this.removeAttribute(e)}}function n$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function r$(e,t){return function(){this.setAttribute(e,t)}}function s$(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function a$(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function o$(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 i$(e,t){var n=Vd(e);if(arguments.length<2){var s=this.node();return n.local?s.getAttributeNS(n.space,n.local):s.getAttribute(n)}return this.each((t==null?n.local?n$:t$:typeof t=="function"?n.local?o$:a$:n.local?s$:r$)(n,t))}function jT(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function l$(e){return function(){this.style.removeProperty(e)}}function c$(e,t,n){return function(){this.style.setProperty(e,t,n)}}function u$(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function d$(e,t,n){return arguments.length>1?this.each((t==null?l$:typeof t=="function"?u$:c$)(e,t,n??"")):$i(this.node(),e)}function $i(e,t){return e.style.getPropertyValue(t)||jT(e).getComputedStyle(e,null).getPropertyValue(t)}function h$(e){return function(){delete this[e]}}function f$(e,t){return function(){this[e]=t}}function p$(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function m$(e,t){return arguments.length>1?this.each((t==null?h$:typeof t=="function"?p$:f$)(e,t)):this.node()[e]}function ET(e){return e.trim().split(/^|\s+/)}function kx(e){return e.classList||new CT(e)}function CT(e){this._node=e,this._names=ET(e.getAttribute("class")||"")}CT.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 TT(e,t){for(var n=kx(e),s=-1,a=t.length;++s<a;)n.add(t[s])}function AT(e,t){for(var n=kx(e),s=-1,a=t.length;++s<a;)n.remove(t[s])}function g$(e){return function(){TT(this,e)}}function y$(e){return function(){AT(this,e)}}function w$(e,t){return function(){(t.apply(this,arguments)?TT:AT)(this,e)}}function v$(e,t){var n=ET(e+"");if(arguments.length<2){for(var s=kx(this.node()),a=-1,i=n.length;++a<i;)if(!s.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?w$:t?g$:y$)(n,t))}function x$(){this.textContent=""}function b$(e){return function(){this.textContent=e}}function k$(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function _$(e){return arguments.length?this.each(e==null?x$:(typeof e=="function"?k$:b$)(e)):this.node().textContent}function N$(){this.innerHTML=""}function S$(e){return function(){this.innerHTML=e}}function j$(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function E$(e){return arguments.length?this.each(e==null?N$:(typeof e=="function"?j$:S$)(e)):this.node().innerHTML}function C$(){this.nextSibling&&this.parentNode.appendChild(this)}function T$(){return this.each(C$)}function A$(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function R$(){return this.each(A$)}function M$(e){var t=typeof e=="function"?e:bT(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function I$(){return null}function $$(e,t){var n=typeof e=="function"?e:bT(e),s=t==null?I$:typeof t=="function"?t:bx(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function O$(){var e=this.parentNode;e&&e.removeChild(this)}function P$(){return this.each(O$)}function L$(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function D$(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function q$(e){return this.select(e?D$:L$)}function F$(e){return arguments.length?this.property("__data__",e):this.node().__data__}function B$(e){return function(t){e.call(this,t,this.__data__)}}function z$(e){return e.trim().split(/^|\s+/).map(function(t){var n="",s=t.indexOf(".");return s>=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function U$(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,a=t.length,i;n<a;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++s]=i;++s?t.length=s:delete this.__on}}}function W$(e,t,n){return function(){var s=this.__on,a,i=B$(t);if(s){for(var c=0,u=s.length;c<u;++c)if((a=s[c]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=i,a.options=n),a.value=t;return}}this.addEventListener(e.type,i,n),a={type:e.type,name:e.name,value:t,listener:i,options:n},s?s.push(a):this.__on=[a]}}function H$(e,t,n){var s=z$(e+""),a,i=s.length,c;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,p=u.length,h;f<p;++f)for(a=0,h=u[f];a<i;++a)if((c=s[a]).type===h.type&&c.name===h.name)return h.value}return}for(u=t?W$:U$,a=0;a<i;++a)this.each(u(s[a],t,n));return this}function RT(e,t,n){var s=jT(e),a=s.CustomEvent;typeof a=="function"?a=new a(t,n):(a=s.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function G$(e,t){return function(){return RT(this,e,t)}}function V$(e,t){return function(){return RT(this,e,t.apply(this,arguments))}}function Y$(e,t){return this.each((typeof t=="function"?V$:G$)(e,t))}function*K$(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,i=s.length,c;a<i;++a)(c=s[a])&&(yield c)}var MT=[null];function Wn(e,t){this._groups=e,this._parents=t}function kc(){return new Wn([[document.documentElement]],MT)}function X$(){return this}Wn.prototype=kc.prototype={constructor:Wn,select:kI,selectAll:jI,selectChild:AI,selectChildren:$I,filter:OI,data:BI,enter:PI,exit:UI,join:WI,merge:HI,selection:X$,order:GI,sort:VI,call:KI,nodes:XI,node:ZI,size:QI,empty:JI,each:e$,attr:i$,style:d$,property:m$,classed:v$,text:_$,html:E$,raise:T$,lower:R$,append:M$,insert:$$,remove:P$,clone:q$,datum:F$,on:H$,dispatch:Y$,[Symbol.iterator]:K$};function ar(e){return typeof e=="string"?new Wn([[document.querySelector(e)]],[document.documentElement]):new Wn([[e]],MT)}function Z$(e){let t;for(;t=e.sourceEvent;)e=t;return e}function jr(e,t){if(e=Z$(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const Q$={passive:!1},oc={capture:!0,passive:!1};function Xf(e){e.stopImmediatePropagation()}function Ti(e){e.preventDefault(),e.stopImmediatePropagation()}function IT(e){var t=e.document.documentElement,n=ar(e).on("dragstart.drag",Ti,oc);"onselectstart"in t?n.on("selectstart.drag",Ti,oc):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function $T(e,t){var n=e.document.documentElement,s=ar(e).on("dragstart.drag",null);t&&(s.on("click.drag",Ti,oc),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Wu=e=>()=>e;function zv(e,{sourceEvent:t,subject:n,target:s,identifier:a,active:i,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:s,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:i,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}})}zv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function J$(e){return!e.ctrlKey&&!e.button}function eO(){return this.parentNode}function tO(e,t){return t??{x:e.x,y:e.y}}function nO(){return navigator.maxTouchPoints||"ontouchstart"in this}function rO(){var e=J$,t=eO,n=tO,s=nO,a={},i=Gd("start","drag","end"),c=0,u,f,p,h,m=0;function y(C){C.on("mousedown.drag",w).filter(s).on("touchstart.drag",j).on("touchmove.drag",k,Q$).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,T){if(!(h||!e.call(this,C,T))){var R=E(this,t.call(this,C,T),C,T,"mouse");R&&(ar(C.view).on("mousemove.drag",N,oc).on("mouseup.drag",_,oc),IT(C.view),Xf(C),p=!1,u=C.clientX,f=C.clientY,R("start",C))}}function N(C){if(Ti(C),!p){var T=C.clientX-u,R=C.clientY-f;p=T*T+R*R>m}a.mouse("drag",C)}function _(C){ar(C.view).on("mousemove.drag mouseup.drag",null),$T(C.view,p),Ti(C),a.mouse("end",C)}function j(C,T){if(e.call(this,C,T)){var R=C.changedTouches,I=t.call(this,C,T),F=R.length,W,O;for(W=0;W<F;++W)(O=E(this,I,C,T,R[W].identifier,R[W]))&&(Xf(C),O("start",C,R[W]))}}function k(C){var T=C.changedTouches,R=T.length,I,F;for(I=0;I<R;++I)(F=a[T[I].identifier])&&(Ti(C),F("drag",C,T[I]))}function S(C){var T=C.changedTouches,R=T.length,I,F;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),I=0;I<R;++I)(F=a[T[I].identifier])&&(Xf(C),F("end",C,T[I]))}function E(C,T,R,I,F,W){var O=i.copy(),B=jr(W||R,T),Z,Q,M;if((M=n.call(C,new zv("beforestart",{sourceEvent:R,target:y,identifier:F,active:c,x:B[0],y:B[1],dx:0,dy:0,dispatch:O}),I))!=null)return Z=M.x-B[0]||0,Q=M.y-B[1]||0,function K(G,P,H){var L=B,U;switch(G){case"start":a[F]=K,U=c++;break;case"end":delete a[F],--c;case"drag":B=jr(H||P,T),U=c;break}O.call(G,C,new zv(G,{sourceEvent:P,subject:M,target:y,identifier:F,active:U,x:B[0]+Z,y:B[1]+Q,dx:B[0]-L[0],dy:B[1]-L[1],dispatch:O}),I)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Wu(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:Wu(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:Wu(C),y):n},y.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:Wu(!!C),y):s},y.on=function(){var C=i.on.apply(i,arguments);return C===i?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function _x(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function OT(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function _c(){}var ic=.7,Sd=1/ic,Ai="\\s*([+-]?\\d+)\\s*",lc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Hr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",sO=/^#([0-9a-f]{3,8})$/,aO=new RegExp(`^rgb\\(${Ai},${Ai},${Ai}\\)$`),oO=new RegExp(`^rgb\\(${Hr},${Hr},${Hr}\\)$`),iO=new RegExp(`^rgba\\(${Ai},${Ai},${Ai},${lc}\\)$`),lO=new RegExp(`^rgba\\(${Hr},${Hr},${Hr},${lc}\\)$`),cO=new RegExp(`^hsl\\(${lc},${Hr},${Hr}\\)$`),uO=new RegExp(`^hsla\\(${lc},${Hr},${Hr},${lc}\\)$`),_k={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};_x(_c,cc,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Nk,formatHex:Nk,formatHex8:dO,formatHsl:hO,formatRgb:Sk,toString:Sk});function Nk(){return this.rgb().formatHex()}function dO(){return this.rgb().formatHex8()}function hO(){return PT(this).formatHsl()}function Sk(){return this.rgb().formatRgb()}function cc(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=sO.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?jk(t):n===3?new $n(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Hu(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Hu(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=aO.exec(e))?new $n(t[1],t[2],t[3],1):(t=oO.exec(e))?new $n(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=iO.exec(e))?Hu(t[1],t[2],t[3],t[4]):(t=lO.exec(e))?Hu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=cO.exec(e))?Tk(t[1],t[2]/100,t[3]/100,1):(t=uO.exec(e))?Tk(t[1],t[2]/100,t[3]/100,t[4]):_k.hasOwnProperty(e)?jk(_k[e]):e==="transparent"?new $n(NaN,NaN,NaN,0):null}function jk(e){return new $n(e>>16&255,e>>8&255,e&255,1)}function Hu(e,t,n,s){return s<=0&&(e=t=n=NaN),new $n(e,t,n,s)}function fO(e){return e instanceof _c||(e=cc(e)),e?(e=e.rgb(),new $n(e.r,e.g,e.b,e.opacity)):new $n}function Uv(e,t,n,s){return arguments.length===1?fO(e):new $n(e,t,n,s??1)}function $n(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}_x($n,Uv,OT(_c,{brighter(e){return e=e==null?Sd:Math.pow(Sd,e),new $n(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ic:Math.pow(ic,e),new $n(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new $n(oo(this.r),oo(this.g),oo(this.b),jd(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:Ek,formatHex:Ek,formatHex8:pO,formatRgb:Ck,toString:Ck}));function Ek(){return`#${so(this.r)}${so(this.g)}${so(this.b)}`}function pO(){return`#${so(this.r)}${so(this.g)}${so(this.b)}${so((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ck(){const e=jd(this.opacity);return`${e===1?"rgb(":"rgba("}${oo(this.r)}, ${oo(this.g)}, ${oo(this.b)}${e===1?")":`, ${e})`}`}function jd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function oo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function so(e){return e=oo(e),(e<16?"0":"")+e.toString(16)}function Tk(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Er(e,t,n,s)}function PT(e){if(e instanceof Er)return new Er(e.h,e.s,e.l,e.opacity);if(e instanceof _c||(e=cc(e)),!e)return new Er;if(e instanceof Er)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,a=Math.min(t,n,s),i=Math.max(t,n,s),c=NaN,u=i-a,f=(i+a)/2;return u?(t===i?c=(n-s)/u+(n<s)*6:n===i?c=(s-t)/u+2:c=(t-n)/u+4,u/=f<.5?i+a:2-i-a,c*=60):u=f>0&&f<1?0:c,new Er(c,u,f,e.opacity)}function mO(e,t,n,s){return arguments.length===1?PT(e):new Er(e,t,n,s??1)}function Er(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}_x(Er,mO,OT(_c,{brighter(e){return e=e==null?Sd:Math.pow(Sd,e),new Er(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ic:Math.pow(ic,e),new Er(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,s=n+(n<.5?n:1-n)*t,a=2*n-s;return new $n(Zf(e>=240?e-240:e+120,a,s),Zf(e,a,s),Zf(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new Er(Ak(this.h),Gu(this.s),Gu(this.l),jd(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=jd(this.opacity);return`${e===1?"hsl(":"hsla("}${Ak(this.h)}, ${Gu(this.s)*100}%, ${Gu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ak(e){return e=(e||0)%360,e<0?e+360:e}function Gu(e){return Math.max(0,Math.min(1,e||0))}function Zf(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 LT=e=>()=>e;function gO(e,t){return function(n){return e+n*t}}function yO(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function wO(e){return(e=+e)==1?DT:function(t,n){return n-t?yO(t,n,e):LT(isNaN(t)?n:t)}}function DT(e,t){var n=t-e;return n?gO(e,n):LT(isNaN(e)?t:e)}const Rk=(function e(t){var n=wO(t);function s(a,i){var c=n((a=Uv(a)).r,(i=Uv(i)).r),u=n(a.g,i.g),f=n(a.b,i.b),p=DT(a.opacity,i.opacity);return function(h){return a.r=c(h),a.g=u(h),a.b=f(h),a.opacity=p(h),a+""}}return s.gamma=e,s})(1);function ta(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Wv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qf=new RegExp(Wv.source,"g");function vO(e){return function(){return e}}function xO(e){return function(t){return e(t)+""}}function bO(e,t){var n=Wv.lastIndex=Qf.lastIndex=0,s,a,i,c=-1,u=[],f=[];for(e=e+"",t=t+"";(s=Wv.exec(e))&&(a=Qf.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),u[c]?u[c]+=i:u[++c]=i),(s=s[0])===(a=a[0])?u[c]?u[c]+=a:u[++c]=a:(u[++c]=null,f.push({i:c,x:ta(s,a)})),n=Qf.lastIndex;return n<t.length&&(i=t.slice(n),u[c]?u[c]+=i:u[++c]=i),u.length<2?f[0]?xO(f[0].x):vO(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 Mk=180/Math.PI,Hv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function qT(e,t,n,s,a,i){var c,u,f;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(f=e*n+t*s)&&(n-=e*f,s-=t*f),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,f/=u),e*s<t*n&&(e=-e,t=-t,f=-f,c=-c),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*Mk,skewX:Math.atan(f)*Mk,scaleX:c,scaleY:u}}var Vu;function kO(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Hv:qT(t.a,t.b,t.c,t.d,t.e,t.f)}function _O(e){return e==null||(Vu||(Vu=document.createElementNS("http://www.w3.org/2000/svg","g")),Vu.setAttribute("transform",e),!(e=Vu.transform.baseVal.consolidate()))?Hv:(e=e.matrix,qT(e.a,e.b,e.c,e.d,e.e,e.f))}function FT(e,t,n,s){function a(p){return p.length?p.pop()+" ":""}function i(p,h,m,y,w,N){if(p!==m||h!==y){var _=w.push("translate(",null,t,null,n);N.push({i:_-4,x:ta(p,m)},{i:_-2,x:ta(h,y)})}else(m||y)&&w.push("translate("+m+t+y+n)}function c(p,h,m,y){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),y.push({i:m.push(a(m)+"rotate(",null,s)-2,x:ta(p,h)})):h&&m.push(a(m)+"rotate("+h+s)}function u(p,h,m,y){p!==h?y.push({i:m.push(a(m)+"skewX(",null,s)-2,x:ta(p,h)}):h&&m.push(a(m)+"skewX("+h+s)}function f(p,h,m,y,w,N){if(p!==m||h!==y){var _=w.push(a(w)+"scale(",null,",",null,")");N.push({i:_-4,x:ta(p,m)},{i:_-2,x:ta(h,y)})}else(m!==1||y!==1)&&w.push(a(w)+"scale("+m+","+y+")")}return function(p,h){var m=[],y=[];return p=e(p),h=e(h),i(p.translateX,p.translateY,h.translateX,h.translateY,m,y),c(p.rotate,h.rotate,m,y),u(p.skewX,h.skewX,m,y),f(p.scaleX,p.scaleY,h.scaleX,h.scaleY,m,y),p=h=null,function(w){for(var N=-1,_=y.length,j;++N<_;)m[(j=y[N]).i]=j.x(w);return m.join("")}}}var NO=FT(kO,"px, ","px)","deg)"),SO=FT(_O,", ",")",")"),jO=1e-12;function Ik(e){return((e=Math.exp(e))+1/e)/2}function EO(e){return((e=Math.exp(e))-1/e)/2}function CO(e){return((e=Math.exp(2*e))-1)/(e+1)}const TO=(function e(t,n,s){function a(i,c){var u=i[0],f=i[1],p=i[2],h=c[0],m=c[1],y=c[2],w=h-u,N=m-f,_=w*w+N*N,j,k;if(_<jO)k=Math.log(y/p)/t,j=function(I){return[u+I*w,f+I*N,p*Math.exp(t*I*k)]};else{var S=Math.sqrt(_),E=(y*y-p*p+s*_)/(2*p*n*S),C=(y*y-p*p-s*_)/(2*y*n*S),T=Math.log(Math.sqrt(E*E+1)-E),R=Math.log(Math.sqrt(C*C+1)-C);k=(R-T)/t,j=function(I){var F=I*k,W=Ik(T),O=p/(n*S)*(W*CO(t*F+T)-EO(T));return[u+O*w,f+O*N,p*W/Ik(t*F+T)]}}return j.duration=k*1e3*t/Math.SQRT2,j}return a.rho=function(i){var c=Math.max(.001,+i),u=c*c,f=u*u;return e(c,u,f)},a})(Math.SQRT2,2,4);var Oi=0,Zl=0,Bl=0,BT=1e3,Ed,Ql,Cd=0,lo=0,Yd=0,uc=typeof performance=="object"&&performance.now?performance:Date,zT=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Nx(){return lo||(zT(AO),lo=uc.now()+Yd)}function AO(){lo=0}function Td(){this._call=this._time=this._next=null}Td.prototype=UT.prototype={constructor:Td,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Nx():+n)+(t==null?0:+t),!this._next&&Ql!==this&&(Ql?Ql._next=this:Ed=this,Ql=this),this._call=e,this._time=n,Gv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gv())}};function UT(e,t,n){var s=new Td;return s.restart(e,t,n),s}function RO(){Nx(),++Oi;for(var e=Ed,t;e;)(t=lo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Oi}function $k(){lo=(Cd=uc.now())+Yd,Oi=Zl=0;try{RO()}finally{Oi=0,IO(),lo=0}}function MO(){var e=uc.now(),t=e-Cd;t>BT&&(Yd-=t,Cd=e)}function IO(){for(var e,t=Ed,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ed=n);Ql=e,Gv(s)}function Gv(e){if(!Oi){Zl&&(Zl=clearTimeout(Zl));var t=e-lo;t>24?(e<1/0&&(Zl=setTimeout($k,e-uc.now()-Yd)),Bl&&(Bl=clearInterval(Bl))):(Bl||(Cd=uc.now(),Bl=setInterval(MO,BT)),Oi=1,zT($k))}}function Ok(e,t,n){var s=new Td;return t=t==null?0:+t,s.restart(a=>{s.stop(),e(a+t)},t,n),s}var $O=Gd("start","end","cancel","interrupt"),OO=[],WT=0,Pk=1,Vv=2,pd=3,Lk=4,Yv=5,md=6;function Kd(e,t,n,s,a,i){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;PO(e,n,{name:t,index:s,group:a,on:$O,tween:OO,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:WT})}function Sx(e,t){var n=Mr(e,t);if(n.state>WT)throw new Error("too late; already scheduled");return n}function Yr(e,t){var n=Mr(e,t);if(n.state>pd)throw new Error("too late; already running");return n}function Mr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function PO(e,t,n){var s=e.__transition,a;s[t]=n,n.timer=UT(i,0,n.time);function i(p){n.state=Pk,n.timer.restart(c,n.delay,n.time),n.delay<=p&&c(p-n.delay)}function c(p){var h,m,y,w;if(n.state!==Pk)return f();for(h in s)if(w=s[h],w.name===n.name){if(w.state===pd)return Ok(c);w.state===Lk?(w.state=md,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[h]):+h<t&&(w.state=md,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[h])}if(Ok(function(){n.state===pd&&(n.state=Lk,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=Vv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Vv){for(n.state=pd,a=new Array(y=n.tween.length),h=0,m=-1;h<y;++h)(w=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(a[++m]=w);a.length=m+1}}function u(p){for(var h=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=Yv,1),m=-1,y=a.length;++m<y;)a[m].call(e,h);n.state===Yv&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=md,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function gd(e,t){var n=e.__transition,s,a,i=!0,c;if(n){t=t==null?null:t+"";for(c in n){if((s=n[c]).name!==t){i=!1;continue}a=s.state>Vv&&s.state<Yv,s.state=md,s.timer.stop(),s.on.call(a?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[c]}i&&delete e.__transition}}function LO(e){return this.each(function(){gd(this,e)})}function DO(e,t){var n,s;return function(){var a=Yr(this,e),i=a.tween;if(i!==n){s=n=i;for(var c=0,u=s.length;c<u;++c)if(s[c].name===t){s=s.slice(),s.splice(c,1);break}}a.tween=s}}function qO(e,t,n){var s,a;if(typeof n!="function")throw new Error;return function(){var i=Yr(this,e),c=i.tween;if(c!==s){a=(s=c).slice();for(var u={name:t,value:n},f=0,p=a.length;f<p;++f)if(a[f].name===t){a[f]=u;break}f===p&&a.push(u)}i.tween=a}}function FO(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=Mr(this.node(),n).tween,a=0,i=s.length,c;a<i;++a)if((c=s[a]).name===e)return c.value;return null}return this.each((t==null?DO:qO)(n,e,t))}function jx(e,t,n){var s=e._id;return e.each(function(){var a=Yr(this,s);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return Mr(a,s).value[t]}}function HT(e,t){var n;return(typeof t=="number"?ta:t instanceof cc?Rk:(n=cc(t))?(t=n,Rk):bO)(e,t)}function BO(e){return function(){this.removeAttribute(e)}}function zO(e){return function(){this.removeAttributeNS(e.space,e.local)}}function UO(e,t,n){var s,a=n+"",i;return function(){var c=this.getAttribute(e);return c===a?null:c===s?i:i=t(s=c,n)}}function WO(e,t,n){var s,a=n+"",i;return function(){var c=this.getAttributeNS(e.space,e.local);return c===a?null:c===s?i:i=t(s=c,n)}}function HO(e,t,n){var s,a,i;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===s&&f===a?i:(a=f,i=t(s=c,u)))}}function GO(e,t,n){var s,a,i;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===s&&f===a?i:(a=f,i=t(s=c,u)))}}function VO(e,t){var n=Vd(e),s=n==="transform"?SO:HT;return this.attrTween(e,typeof t=="function"?(n.local?GO:HO)(n,s,jx(this,"attr."+e,t)):t==null?(n.local?zO:BO)(n):(n.local?WO:UO)(n,s,t))}function YO(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function KO(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function XO(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&KO(e,i)),n}return a._value=t,a}function ZO(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&YO(e,i)),n}return a._value=t,a}function QO(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 s=Vd(e);return this.tween(n,(s.local?XO:ZO)(s,t))}function JO(e,t){return function(){Sx(this,e).delay=+t.apply(this,arguments)}}function e3(e,t){return t=+t,function(){Sx(this,e).delay=t}}function t3(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?JO:e3)(t,e)):Mr(this.node(),t).delay}function n3(e,t){return function(){Yr(this,e).duration=+t.apply(this,arguments)}}function r3(e,t){return t=+t,function(){Yr(this,e).duration=t}}function s3(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?n3:r3)(t,e)):Mr(this.node(),t).duration}function a3(e,t){if(typeof t!="function")throw new Error;return function(){Yr(this,e).ease=t}}function o3(e){var t=this._id;return arguments.length?this.each(a3(t,e)):Mr(this.node(),t).ease}function i3(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Yr(this,e).ease=n}}function l3(e){if(typeof e!="function")throw new Error;return this.each(i3(this._id,e))}function c3(e){typeof e!="function"&&(e=_T(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],c=i.length,u=s[a]=[],f,p=0;p<c;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&u.push(f);return new vs(s,this._parents,this._name,this._id)}function u3(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,a=n.length,i=Math.min(s,a),c=new Array(s),u=0;u<i;++u)for(var f=t[u],p=n[u],h=f.length,m=c[u]=new Array(h),y,w=0;w<h;++w)(y=f[w]||p[w])&&(m[w]=y);for(;u<s;++u)c[u]=t[u];return new vs(c,this._parents,this._name,this._id)}function d3(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 h3(e,t,n){var s,a,i=d3(t)?Sx:Yr;return function(){var c=i(this,e),u=c.on;u!==s&&(a=(s=u).copy()).on(t,n),c.on=a}}function f3(e,t){var n=this._id;return arguments.length<2?Mr(this.node(),n).on.on(e):this.each(h3(n,e,t))}function p3(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function m3(){return this.on("end.remove",p3(this._id))}function g3(e){var t=this._name,n=this._id;typeof e!="function"&&(e=bx(e));for(var s=this._groups,a=s.length,i=new Array(a),c=0;c<a;++c)for(var u=s[c],f=u.length,p=i[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,Kd(p[y],t,n,y,p,Mr(h,n)));return new vs(i,this._parents,t,n)}function y3(e){var t=this._name,n=this._id;typeof e!="function"&&(e=kT(e));for(var s=this._groups,a=s.length,i=[],c=[],u=0;u<a;++u)for(var f=s[u],p=f.length,h,m=0;m<p;++m)if(h=f[m]){for(var y=e.call(h,h.__data__,m,f),w,N=Mr(h,n),_=0,j=y.length;_<j;++_)(w=y[_])&&Kd(w,t,n,_,y,N);i.push(y),c.push(h)}return new vs(i,c,t,n)}var w3=kc.prototype.constructor;function v3(){return new w3(this._groups,this._parents)}function x3(e,t){var n,s,a;return function(){var i=$i(this,e),c=(this.style.removeProperty(e),$i(this,e));return i===c?null:i===n&&c===s?a:a=t(n=i,s=c)}}function GT(e){return function(){this.style.removeProperty(e)}}function b3(e,t,n){var s,a=n+"",i;return function(){var c=$i(this,e);return c===a?null:c===s?i:i=t(s=c,n)}}function k3(e,t,n){var s,a,i;return function(){var c=$i(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),$i(this,e))),c===f?null:c===s&&f===a?i:(a=f,i=t(s=c,u))}}function _3(e,t){var n,s,a,i="style."+t,c="end."+i,u;return function(){var f=Yr(this,e),p=f.on,h=f.value[i]==null?u||(u=GT(t)):void 0;(p!==n||a!==h)&&(s=(n=p).copy()).on(c,a=h),f.on=s}}function N3(e,t,n){var s=(e+="")=="transform"?NO:HT;return t==null?this.styleTween(e,x3(e,s)).on("end.style."+e,GT(e)):typeof t=="function"?this.styleTween(e,k3(e,s,jx(this,"style."+e,t))).each(_3(this._id,e)):this.styleTween(e,b3(e,s,t),n).on("end.style."+e,null)}function S3(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function j3(e,t,n){var s,a;function i(){var c=t.apply(this,arguments);return c!==a&&(s=(a=c)&&S3(e,c,n)),s}return i._value=t,i}function E3(e,t,n){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,j3(e,t,n??""))}function C3(e){return function(){this.textContent=e}}function T3(e){return function(){var t=e(this);this.textContent=t??""}}function A3(e){return this.tween("text",typeof e=="function"?T3(jx(this,"text",e)):C3(e==null?"":e+""))}function R3(e){return function(t){this.textContent=e.call(this,t)}}function M3(e){var t,n;function s(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&R3(a)),t}return s._value=e,s}function I3(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,M3(e))}function $3(){for(var e=this._name,t=this._id,n=VT(),s=this._groups,a=s.length,i=0;i<a;++i)for(var c=s[i],u=c.length,f,p=0;p<u;++p)if(f=c[p]){var h=Mr(f,t);Kd(f,e,n,p,c,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new vs(s,this._parents,e,n)}function O3(){var e,t,n=this,s=n._id,a=n.size();return new Promise(function(i,c){var u={value:c},f={value:function(){--a===0&&i()}};n.each(function(){var p=Yr(this,s),h=p.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),p.on=t}),a===0&&i()})}var P3=0;function vs(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function VT(){return++P3}var ms=kc.prototype;vs.prototype={constructor:vs,select:g3,selectAll:y3,selectChild:ms.selectChild,selectChildren:ms.selectChildren,filter:c3,merge:u3,selection:v3,transition:$3,call:ms.call,nodes:ms.nodes,node:ms.node,size:ms.size,empty:ms.empty,each:ms.each,on:f3,attr:VO,attrTween:QO,style:N3,styleTween:E3,text:A3,textTween:I3,remove:m3,tween:FO,delay:t3,duration:s3,ease:o3,easeVarying:l3,end:O3,[Symbol.iterator]:ms[Symbol.iterator]};function L3(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var D3={time:null,delay:0,duration:250,ease:L3};function q3(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 F3(e){var t,n;e instanceof vs?(t=e._id,e=e._name):(t=VT(),(n=D3).time=Nx(),e=e==null?null:e+"");for(var s=this._groups,a=s.length,i=0;i<a;++i)for(var c=s[i],u=c.length,f,p=0;p<u;++p)(f=c[p])&&Kd(f,e,t,p,c,n||q3(f,t));return new vs(s,this._parents,e,t)}kc.prototype.interrupt=LO;kc.prototype.transition=F3;const Yu=e=>()=>e;function B3(e,{sourceEvent:t,target:n,transform:s,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:a}})}function gs(e,t,n){this.k=e,this.x=t,this.y=n}gs.prototype={constructor:gs,scale:function(e){return e===1?this:new gs(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new gs(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 ws=new gs(1,0,0);gs.prototype;function Jf(e){e.stopImmediatePropagation()}function zl(e){e.preventDefault(),e.stopImmediatePropagation()}function z3(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function U3(){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 Dk(){return this.__zoom||ws}function W3(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function H3(){return navigator.maxTouchPoints||"ontouchstart"in this}function G3(e,t,n){var s=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a),c>i?(i+c)/2:Math.min(0,i)||Math.max(0,c))}function YT(){var e=z3,t=U3,n=G3,s=W3,a=H3,i=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=TO,p=Gd("start","zoom","end"),h,m,y,w=500,N=150,_=0,j=10;function k(M){M.property("__zoom",Dk).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",W).on("dblclick.zoom",O).filter(a).on("touchstart.zoom",B).on("touchmove.zoom",Z).on("touchend.zoom touchcancel.zoom",Q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(M,K,G,P){var H=M.selection?M.selection():M;H.property("__zoom",Dk),M!==H?T(M,K,G,P):H.interrupt().each(function(){R(this,arguments).event(P).start().zoom(null,typeof K=="function"?K.apply(this,arguments):K).end()})},k.scaleBy=function(M,K,G,P){k.scaleTo(M,function(){var H=this.__zoom.k,L=typeof K=="function"?K.apply(this,arguments):K;return H*L},G,P)},k.scaleTo=function(M,K,G,P){k.transform(M,function(){var H=t.apply(this,arguments),L=this.__zoom,U=G==null?C(H):typeof G=="function"?G.apply(this,arguments):G,$=L.invert(U),V=typeof K=="function"?K.apply(this,arguments):K;return n(E(S(L,V),U,$),H,c)},G,P)},k.translateBy=function(M,K,G,P){k.transform(M,function(){return n(this.__zoom.translate(typeof K=="function"?K.apply(this,arguments):K,typeof G=="function"?G.apply(this,arguments):G),t.apply(this,arguments),c)},null,P)},k.translateTo=function(M,K,G,P,H){k.transform(M,function(){var L=t.apply(this,arguments),U=this.__zoom,$=P==null?C(L):typeof P=="function"?P.apply(this,arguments):P;return n(ws.translate($[0],$[1]).scale(U.k).translate(typeof K=="function"?-K.apply(this,arguments):-K,typeof G=="function"?-G.apply(this,arguments):-G),L,c)},P,H)};function S(M,K){return K=Math.max(i[0],Math.min(i[1],K)),K===M.k?M:new gs(K,M.x,M.y)}function E(M,K,G){var P=K[0]-G[0]*M.k,H=K[1]-G[1]*M.k;return P===M.x&&H===M.y?M:new gs(M.k,P,H)}function C(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function T(M,K,G,P){M.on("start.zoom",function(){R(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(P).end()}).tween("zoom",function(){var H=this,L=arguments,U=R(H,L).event(P),$=t.apply(H,L),V=G==null?C($):typeof G=="function"?G.apply(H,L):G,he=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),Y=H.__zoom,J=typeof K=="function"?K.apply(H,L):K,z=f(Y.invert(V).concat(he/Y.k),J.invert(V).concat(he/J.k));return function(re){if(re===1)re=J;else{var le=z(re),me=he/le[2];re=new gs(me,V[0]-le[0]*me,V[1]-le[1]*me)}U.zoom(null,re)}})}function R(M,K,G){return!G&&M.__zooming||new I(M,K)}function I(M,K){this.that=M,this.args=K,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,K),this.taps=0}I.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,K){return this.mouse&&M!=="mouse"&&(this.mouse[1]=K.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=K.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=K.invert(this.touch1[0])),this.that.__zoom=K,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var K=ar(this.that).datum();p.call(M,this.that,new B3(M,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:p}),K)}};function F(M,...K){if(!e.apply(this,arguments))return;var G=R(this,K).event(M),P=this.__zoom,H=Math.max(i[0],Math.min(i[1],P.k*Math.pow(2,s.apply(this,arguments)))),L=jr(M);if(G.wheel)(G.mouse[0][0]!==L[0]||G.mouse[0][1]!==L[1])&&(G.mouse[1]=P.invert(G.mouse[0]=L)),clearTimeout(G.wheel);else{if(P.k===H)return;G.mouse=[L,P.invert(L)],gd(this),G.start()}zl(M),G.wheel=setTimeout(U,N),G.zoom("mouse",n(E(S(P,H),G.mouse[0],G.mouse[1]),G.extent,c));function U(){G.wheel=null,G.end()}}function W(M,...K){if(y||!e.apply(this,arguments))return;var G=M.currentTarget,P=R(this,K,!0).event(M),H=ar(M.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",he,!0),L=jr(M,G),U=M.clientX,$=M.clientY;IT(M.view),Jf(M),P.mouse=[L,this.__zoom.invert(L)],gd(this),P.start();function V(Y){if(zl(Y),!P.moved){var J=Y.clientX-U,z=Y.clientY-$;P.moved=J*J+z*z>_}P.event(Y).zoom("mouse",n(E(P.that.__zoom,P.mouse[0]=jr(Y,G),P.mouse[1]),P.extent,c))}function he(Y){H.on("mousemove.zoom mouseup.zoom",null),$T(Y.view,P.moved),zl(Y),P.event(Y).end()}}function O(M,...K){if(e.apply(this,arguments)){var G=this.__zoom,P=jr(M.changedTouches?M.changedTouches[0]:M,this),H=G.invert(P),L=G.k*(M.shiftKey?.5:2),U=n(E(S(G,L),P,H),t.apply(this,K),c);zl(M),u>0?ar(this).transition().duration(u).call(T,U,P,M):ar(this).call(k.transform,U,P,M)}}function B(M,...K){if(e.apply(this,arguments)){var G=M.touches,P=G.length,H=R(this,K,M.changedTouches.length===P).event(M),L,U,$,V;for(Jf(M),U=0;U<P;++U)$=G[U],V=jr($,this),V=[V,this.__zoom.invert(V),$.identifier],H.touch0?!H.touch1&&H.touch0[2]!==V[2]&&(H.touch1=V,H.taps=0):(H.touch0=V,L=!0,H.taps=1+!!h);h&&(h=clearTimeout(h)),L&&(H.taps<2&&(m=V[0],h=setTimeout(function(){h=null},w)),gd(this),H.start())}}function Z(M,...K){if(this.__zooming){var G=R(this,K).event(M),P=M.changedTouches,H=P.length,L,U,$,V;for(zl(M),L=0;L<H;++L)U=P[L],$=jr(U,this),G.touch0&&G.touch0[2]===U.identifier?G.touch0[0]=$:G.touch1&&G.touch1[2]===U.identifier&&(G.touch1[0]=$);if(U=G.that.__zoom,G.touch1){var he=G.touch0[0],Y=G.touch0[1],J=G.touch1[0],z=G.touch1[1],re=(re=J[0]-he[0])*re+(re=J[1]-he[1])*re,le=(le=z[0]-Y[0])*le+(le=z[1]-Y[1])*le;U=S(U,Math.sqrt(re/le)),$=[(he[0]+J[0])/2,(he[1]+J[1])/2],V=[(Y[0]+z[0])/2,(Y[1]+z[1])/2]}else if(G.touch0)$=G.touch0[0],V=G.touch0[1];else return;G.zoom("touch",n(E(U,$,V),G.extent,c))}}function Q(M,...K){if(this.__zooming){var G=R(this,K).event(M),P=M.changedTouches,H=P.length,L,U;for(Jf(M),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),L=0;L<H;++L)U=P[L],G.touch0&&G.touch0[2]===U.identifier?delete G.touch0:G.touch1&&G.touch1[2]===U.identifier&&delete G.touch1;if(G.touch1&&!G.touch0&&(G.touch0=G.touch1,delete G.touch1),G.touch0)G.touch0[1]=this.__zoom.invert(G.touch0[0]);else if(G.end(),G.taps===2&&(U=jr(U,this),Math.hypot(m[0]-U[0],m[1]-U[1])<j)){var $=ar(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return k.wheelDelta=function(M){return arguments.length?(s=typeof M=="function"?M:Yu(+M),k):s},k.filter=function(M){return arguments.length?(e=typeof M=="function"?M:Yu(!!M),k):e},k.touchable=function(M){return arguments.length?(a=typeof M=="function"?M:Yu(!!M),k):a},k.extent=function(M){return arguments.length?(t=typeof M=="function"?M:Yu([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),k):t},k.scaleExtent=function(M){return arguments.length?(i[0]=+M[0],i[1]=+M[1],k):[i[0],i[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?(_=(M=+M)*M,k):Math.sqrt(_)},k.tapDistance=function(M){return arguments.length?(j=+M,k):j},k}var Kr=wT();const Xd=x.createContext(null),V3=Xd.Provider,xs={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.`},KT=xs.error001();function gt(e,t){const n=x.useContext(Xd);if(n===null)throw new Error(KT);return xT(n,e,t)}const Wt=()=>{const e=x.useContext(Xd);if(e===null)throw new Error(KT);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},Y3=e=>e.userSelectionActive?"none":"all";function Ex({position:e,children:t,className:n,style:s,...a}){const i=gt(Y3),c=`${e}`.split("-");return pe.createElement("div",{className:un(["react-flow__panel",n,...c]),style:{...s,pointerEvents:i},...a},t)}function K3({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:pe.createElement(Ex,{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"},pe.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const X3=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:a=!0,labelBgStyle:i={},labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:f,className:p,...h})=>{const m=x.useRef(null),[y,w]=x.useState({x:0,y:0,width:0,height:0}),N=un(["react-flow__edge-textwrapper",p]);return x.useEffect(()=>{if(m.current){const _=m.current.getBBox();w({x:_.x,y:_.y,width:_.width,height:_.height})}},[n]),typeof n>"u"||!n?null:pe.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:N,visibility:y.width?"visible":"hidden",...h},a&&pe.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:i,rx:u,ry:u}),pe.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:s},n),f)};var Z3=x.memo(X3);const Cx=e=>({width:e.offsetWidth,height:e.offsetHeight}),Pi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Tx=(e={x:0,y:0},t)=>({x:Pi(e.x,t[0][0],t[1][0]),y:Pi(e.y,t[0][1],t[1][1])}),qk=(e,t,n)=>e<t?Pi(Math.abs(e-t),1,50)/50:e>n?-Pi(Math.abs(e-n),1,50)/50:0,XT=(e,t)=>{const n=qk(e.x,35,t.width-35)*20,s=qk(e.y,35,t.height-35)*20;return[n,s]},ZT=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},QT=(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)}),dc=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),JT=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Fk=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),Q3=(e,t)=>JT(QT(dc(e),dc(t))),Kv=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},J3=e=>or(e.width)&&or(e.height)&&or(e.x)&&or(e.y),or=e=>!isNaN(e)&&isFinite(e),Lt=Symbol.for("internals"),e2=["Enter"," ","Escape"],e4=(e,t)=>{},t4=e=>"nativeEvent"in e;function Xv(e){var a,i;const t=t4(e)?e.nativeEvent:e,n=((i=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const t2=e=>"clientX"in e,aa=(e,t)=>{var i,c;const n=t2(e),s=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,a=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},Ad=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Nc=({id:e,path:t,labelX:n,labelY:s,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w=20})=>pe.createElement(pe.Fragment,null,pe.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),w&&pe.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),a&&or(n)&&or(s)?pe.createElement(Z3,{x:n,y:s,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p}):null);Nc.displayName="BaseEdge";function Ul(e,t,n){return n===void 0?n:s=>{const a=t().edges.find(i=>i.id===e);a&&n(s,{...a})}}function n2({sourceX:e,sourceY:t,targetX:n,targetY:s}){const a=Math.abs(n-e)/2,i=n<e?n+a:n-a,c=Math.abs(s-t)/2,u=s<t?s+c:s-c;return[i,u,a,c]}function r2({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:a,sourceControlY:i,targetControlX:c,targetControlY:u}){const f=e*.125+a*.375+c*.375+n*.125,p=t*.125+i*.375+u*.375+s*.125,h=Math.abs(f-e),m=Math.abs(p-t);return[f,p,h,m]}var co;(function(e){e.Strict="strict",e.Loose="loose"})(co||(co={}));var ao;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ao||(ao={}));var hc;(function(e){e.Partial="partial",e.Full="full"})(hc||(hc={}));var ra;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ra||(ra={}));var Rd;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Rd||(Rd={}));var ze;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ze||(ze={}));function Bk({pos:e,x1:t,y1:n,x2:s,y2:a}){return e===ze.Left||e===ze.Right?[.5*(t+s),n]:[t,.5*(n+a)]}function s2({sourceX:e,sourceY:t,sourcePosition:n=ze.Bottom,targetX:s,targetY:a,targetPosition:i=ze.Top}){const[c,u]=Bk({pos:n,x1:e,y1:t,x2:s,y2:a}),[f,p]=Bk({pos:i,x1:s,y1:a,x2:e,y2:t}),[h,m,y,w]=r2({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:c,sourceControlY:u,targetControlX:f,targetControlY:p});return[`M${e},${t} C${c},${u} ${f},${p} ${s},${a}`,h,m,y,w]}const Ax=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=ze.Bottom,targetPosition:i=ze.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})=>{const[j,k,S]=s2({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i});return pe.createElement(Nc,{path:j,labelX:k,labelY:S,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})});Ax.displayName="SimpleBezierEdge";const zk={[ze.Left]:{x:-1,y:0},[ze.Right]:{x:1,y:0},[ze.Top]:{x:0,y:-1},[ze.Bottom]:{x:0,y:1}},n4=({source:e,sourcePosition:t=ze.Bottom,target:n})=>t===ze.Left||t===ze.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},Uk=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function r4({source:e,sourcePosition:t=ze.Bottom,target:n,targetPosition:s=ze.Top,center:a,offset:i}){const c=zk[t],u=zk[s],f={x:e.x+c.x*i,y:e.y+c.y*i},p={x:n.x+u.x*i,y:n.y+u.y*i},h=n4({source:f,sourcePosition:t,target:p}),m=h.x!==0?"x":"y",y=h[m];let w=[],N,_;const j={x:0,y:0},k={x:0,y:0},[S,E,C,T]=n2({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[m]*u[m]===-1){N=a.x??S,_=a.y??E;const I=[{x:N,y:f.y},{x:N,y:p.y}],F=[{x:f.x,y:_},{x:p.x,y:_}];c[m]===y?w=m==="x"?I:F:w=m==="x"?F:I}else{const I=[{x:f.x,y:p.y}],F=[{x:p.x,y:f.y}];if(m==="x"?w=c.x===y?F:I:w=c.y===y?I:F,t===s){const Q=Math.abs(e[m]-n[m]);if(Q<=i){const M=Math.min(i-1,i-Q);c[m]===y?j[m]=(f[m]>e[m]?-1:1)*M:k[m]=(p[m]>n[m]?-1:1)*M}}if(t!==s){const Q=m==="x"?"y":"x",M=c[m]===u[Q],K=f[Q]>p[Q],G=f[Q]<p[Q];(c[m]===1&&(!M&&K||M&&G)||c[m]!==1&&(!M&&G||M&&K))&&(w=m==="x"?I:F)}const W={x:f.x+j.x,y:f.y+j.y},O={x:p.x+k.x,y:p.y+k.y},B=Math.max(Math.abs(W.x-w[0].x),Math.abs(O.x-w[0].x)),Z=Math.max(Math.abs(W.y-w[0].y),Math.abs(O.y-w[0].y));B>=Z?(N=(W.x+O.x)/2,_=w[0].y):(N=w[0].x,_=(W.y+O.y)/2)}return[[e,{x:f.x+j.x,y:f.y+j.y},...w,{x:p.x+k.x,y:p.y+k.y},n],N,_,C,T]}function s4(e,t,n,s){const a=Math.min(Uk(e,t)/2,Uk(t,n)/2,s),{x:i,y:c}=t;if(e.x===i&&i===n.x||e.y===c&&c===n.y)return`L${i} ${c}`;if(e.y===c){const p=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${i+a*p},${c}Q ${i},${c} ${i},${c+a*h}`}const u=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${i},${c+a*f}Q ${i},${c} ${i+a*u},${c}`}function Zv({sourceX:e,sourceY:t,sourcePosition:n=ze.Bottom,targetX:s,targetY:a,targetPosition:i=ze.Top,borderRadius:c=5,centerX:u,centerY:f,offset:p=20}){const[h,m,y,w,N]=r4({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:a},targetPosition:i,center:{x:u,y:f},offset:p});return[h.reduce((j,k,S)=>{let E="";return S>0&&S<h.length-1?E=s4(h[S-1],k,h[S+1],c):E=`${S===0?"M":"L"}${k.x} ${k.y}`,j+=E,j},""),m,y,w,N]}const Zd=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,sourcePosition:m=ze.Bottom,targetPosition:y=ze.Top,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:j})=>{const[k,S,E]=Zv({sourceX:e,sourceY:t,sourcePosition:m,targetX:n,targetY:s,targetPosition:y,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset});return pe.createElement(Nc,{path:k,labelX:S,labelY:E,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:N,interactionWidth:j})});Zd.displayName="SmoothStepEdge";const Rx=x.memo(e=>{var t;return pe.createElement(Zd,{...e,pathOptions:x.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Rx.displayName="StepEdge";function a4({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[a,i,c,u]=n2({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,a,i,c,u]}const Mx=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[N,_,j]=a4({sourceX:e,sourceY:t,targetX:n,targetY:s});return pe.createElement(Nc,{path:N,labelX:_,labelY:j,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})});Mx.displayName="StraightEdge";function Ku(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wk({pos:e,x1:t,y1:n,x2:s,y2:a,c:i}){switch(e){case ze.Left:return[t-Ku(t-s,i),n];case ze.Right:return[t+Ku(s-t,i),n];case ze.Top:return[t,n-Ku(n-a,i)];case ze.Bottom:return[t,n+Ku(a-n,i)]}}function Ix({sourceX:e,sourceY:t,sourcePosition:n=ze.Bottom,targetX:s,targetY:a,targetPosition:i=ze.Top,curvature:c=.25}){const[u,f]=Wk({pos:n,x1:e,y1:t,x2:s,y2:a,c}),[p,h]=Wk({pos:i,x1:s,y1:a,x2:e,y2:t,c}),[m,y,w,N]=r2({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:u,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${u},${f} ${p},${h} ${s},${a}`,m,y,w,N]}const Md=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=ze.Bottom,targetPosition:i=ze.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:j})=>{const[k,S,E]=Ix({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i,curvature:_==null?void 0:_.curvature});return pe.createElement(Nc,{path:k,labelX:S,labelY:E,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:j})});Md.displayName="BezierEdge";const $x=x.createContext(null),o4=$x.Provider;$x.Consumer;const i4=()=>x.useContext($x),l4=e=>"id"in e&&"source"in e&&"target"in e,c4=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Qv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,u4=(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)),d4=(e,t)=>{if(!e.source||!e.target)return t;let n;return l4(e)?n={...e}:n={...e,id:c4(e)},u4(n,t)?t:t.concat(n)},Jv=({x:e,y:t},[n,s,a],i,[c,u])=>{const f={x:(e-n)/a,y:(t-s)/a};return i?{x:c*Math.round(f.x/c),y:u*Math.round(f.y/u)}:f},a2=({x:e,y:t},[n,s,a])=>({x:e*a+n,y:t*a+s}),io=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],s=(e.height??0)*t[1],a={x:e.position.x-n,y:e.position.y-s};return{...a,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-s}:a}},Qd=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,a)=>{const{x:i,y:c}=io(a,t).positionAbsolute;return QT(s,dc({x:i,y:c,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return JT(n)},o2=(e,t,[n,s,a]=[0,0,1],i=!1,c=!1,u=[0,0])=>{const f={x:(t.x-n)/a,y:(t.y-s)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(h=>{const{width:m,height:y,selectable:w=!0,hidden:N=!1}=h;if(c&&!w||N)return!1;const{positionAbsolute:_}=io(h,u),j={x:_.x,y:_.y,width:m||0,height:y||0},k=Kv(f,j),S=typeof m>"u"||typeof y>"u"||m===null||y===null,E=i&&k>0,C=(m||0)*(y||0);(S||E||k>=C||h.dragging)&&p.push(h)}),p},i2=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},l2=(e,t,n,s,a,i=.1)=>{const c=t/(e.width*(1+i)),u=n/(e.height*(1+i)),f=Math.min(c,u),p=Pi(f,s,a),h=e.x+e.width/2,m=e.y+e.height/2,y=t/2-h*p,w=n/2-m*p;return{x:y,y:w,zoom:p}},ro=(e,t=0)=>e.transition().duration(t);function Hk(e,t,n,s){return(t[n]||[]).reduce((a,i)=>{var c,u;return`${e.id}-${i.id}-${n}`!==s&&a.push({id:i.id||null,type:n,nodeId:e.id,x:(((c=e.positionAbsolute)==null?void 0:c.x)??0)+i.x+i.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+i.y+i.height/2}),a},[])}function h4(e,t,n,s,a,i){const{x:c,y:u}=aa(e),p=t.elementsFromPoint(c,u).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const _=Ox(void 0,p),j=p.getAttribute("data-handleid"),k=i({nodeId:N,id:j,type:_});if(k){const S=a.find(E=>E.nodeId===N&&E.type===_&&E.id===j);return{handle:{id:j,type:_,nodeId:N,x:(S==null?void 0:S.x)||n.x,y:(S==null?void 0:S.y)||n.y},validHandleResult:k}}}}let h=[],m=1/0;if(a.forEach(N=>{const _=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(_<=s){const j=i(N);_<=m&&(_<m?h=[{handle:N,validHandleResult:j}]:_===m&&h.push({handle:N,validHandleResult:j}),m=_)}}),!h.length)return{handle:null,validHandleResult:c2()};if(h.length===1)return h[0];const y=h.some(({validHandleResult:N})=>N.isValid),w=h.some(({handle:N})=>N.type==="target");return h.find(({handle:N,validHandleResult:_})=>w?N.type==="target":y?_.isValid:!0)||h[0]}const f4={source:null,target:null,sourceHandle:null,targetHandle:null},c2=()=>({handleDomNode:null,isValid:!1,connection:f4,endHandle:null});function u2(e,t,n,s,a,i,c){const u=a==="target",f=c.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...c2(),handleDomNode:f};if(f){const h=Ox(void 0,f),m=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),N=f.classList.contains("connectableend"),_={source:u?m:n,sourceHandle:u?y:s,target:u?n:m,targetHandle:u?s:y};p.connection=_,w&&N&&(t===co.Strict?u&&h==="source"||!u&&h==="target":m!==n||y!==s)&&(p.endHandle={nodeId:m,handleId:y,type:h},p.isValid=i(_))}return p}function p4({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((a,i)=>{if(i[Lt]){const{handleBounds:c}=i[Lt];let u=[],f=[];c&&(u=Hk(i,c,"source",`${t}-${n}-${s}`),f=Hk(i,c,"target",`${t}-${n}-${s}`)),a.push(...u,...f)}return a},[])}function Ox(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function ep(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function m4(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function d2({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:a,getState:i,setState:c,isValidConnection:u,edgeUpdaterType:f,onReconnectEnd:p}){const h=ZT(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:_,panBy:j,getNodes:k,cancelConnection:S}=i();let E=0,C;const{x:T,y:R}=aa(e),I=h==null?void 0:h.elementFromPoint(T,R),F=Ox(f,I),W=y==null?void 0:y.getBoundingClientRect();if(!W||!F)return;let O,B=aa(e,W),Z=!1,Q=null,M=!1,K=null;const G=p4({nodes:k(),nodeId:n,handleId:t,handleType:F}),P=()=>{if(!w)return;const[U,$]=XT(B,W);j({x:U,y:$}),E=requestAnimationFrame(P)};c({connectionPosition:B,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:F,connectionStartHandle:{nodeId:n,handleId:t,type:F},connectionEndHandle:null}),_==null||_(e,{nodeId:n,handleId:t,handleType:F});function H(U){const{transform:$}=i();B=aa(U,W);const{handle:V,validHandleResult:he}=h4(U,h,Jv(B,$,!1,[1,1]),N,G,Y=>u2(Y,m,n,t,a?"target":"source",u,h));if(C=V,Z||(P(),Z=!0),K=he.handleDomNode,Q=he.connection,M=he.isValid,c({connectionPosition:C&&M?a2({x:C.x,y:C.y},$):B,connectionStatus:m4(!!C,M),connectionEndHandle:he.endHandle}),!C&&!M&&!K)return ep(O);Q.source!==Q.target&&K&&(ep(O),O=K,K.classList.add("connecting","react-flow__handle-connecting"),K.classList.toggle("valid",M),K.classList.toggle("react-flow__handle-valid",M))}function L(U){var $,V;(C||K)&&Q&&M&&(s==null||s(Q)),(V=($=i()).onConnectEnd)==null||V.call($,U),f&&(p==null||p(U)),ep(O),S(),cancelAnimationFrame(E),Z=!1,M=!1,Q=null,K=null,h.removeEventListener("mousemove",H),h.removeEventListener("mouseup",L),h.removeEventListener("touchmove",H),h.removeEventListener("touchend",L)}h.addEventListener("mousemove",H),h.addEventListener("mouseup",L),h.addEventListener("touchmove",H),h.addEventListener("touchend",L)}const Gk=()=>!0,g4=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),y4=(e,t,n)=>s=>{const{connectionStartHandle:a,connectionEndHandle:i,connectionClickStartHandle:c}=s;return{connecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.handleId)===t&&(c==null?void 0:c.type)===n}},h2=x.forwardRef(({type:e="source",position:t=ze.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:i=!0,id:c,onConnect:u,children:f,className:p,onMouseDown:h,onTouchStart:m,...y},w)=>{var W,O;const N=c||null,_=e==="target",j=Wt(),k=i4(),{connectOnClick:S,noPanClassName:E}=gt(g4,Qt),{connecting:C,clickConnecting:T}=gt(y4(k,N,e),Qt);k||(O=(W=j.getState()).onError)==null||O.call(W,"010",xs.error010());const R=B=>{const{defaultEdgeOptions:Z,onConnect:Q,hasDefaultEdges:M}=j.getState(),K={...Z,...B};if(M){const{edges:G,setEdges:P}=j.getState();P(d4(K,G))}Q==null||Q(K),u==null||u(K)},I=B=>{if(!k)return;const Z=t2(B);a&&(Z&&B.button===0||!Z)&&d2({event:B,handleId:N,nodeId:k,onConnect:R,isTarget:_,getState:j.getState,setState:j.setState,isValidConnection:n||j.getState().isValidConnection||Gk}),Z?h==null||h(B):m==null||m(B)},F=B=>{const{onClickConnectStart:Z,onClickConnectEnd:Q,connectionClickStartHandle:M,connectionMode:K,isValidConnection:G}=j.getState();if(!k||!M&&!a)return;if(!M){Z==null||Z(B,{nodeId:k,handleId:N,handleType:e}),j.setState({connectionClickStartHandle:{nodeId:k,type:e,handleId:N}});return}const P=ZT(B.target),H=n||G||Gk,{connection:L,isValid:U}=u2({nodeId:k,id:N,type:e},K,M.nodeId,M.handleId||null,M.type,H,P);U&&R(L),Q==null||Q(B),j.setState({connectionClickStartHandle:null})};return pe.createElement("div",{"data-handleid":N,"data-nodeid":k,"data-handlepos":t,"data-id":`${k}-${N}-${e}`,className:un(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,p,{source:!_,target:_,connectable:s,connectablestart:a,connectableend:i,connecting:T,connectionindicator:s&&(a&&!C||i&&C)}]),onMouseDown:I,onTouchStart:I,onClick:S?F:void 0,ref:w,...y},f)});h2.displayName="Handle";var uo=x.memo(h2);const f2=({data:e,isConnectable:t,targetPosition:n=ze.Top,sourcePosition:s=ze.Bottom})=>pe.createElement(pe.Fragment,null,pe.createElement(uo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,pe.createElement(uo,{type:"source",position:s,isConnectable:t}));f2.displayName="DefaultNode";var ex=x.memo(f2);const p2=({data:e,isConnectable:t,sourcePosition:n=ze.Bottom})=>pe.createElement(pe.Fragment,null,e==null?void 0:e.label,pe.createElement(uo,{type:"source",position:n,isConnectable:t}));p2.displayName="InputNode";var m2=x.memo(p2);const g2=({data:e,isConnectable:t,targetPosition:n=ze.Top})=>pe.createElement(pe.Fragment,null,pe.createElement(uo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);g2.displayName="OutputNode";var y2=x.memo(g2);const Px=()=>null;Px.displayName="GroupNode";const w4=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),Xu=e=>e.id;function v4(e,t){return Qt(e.selectedNodes.map(Xu),t.selectedNodes.map(Xu))&&Qt(e.selectedEdges.map(Xu),t.selectedEdges.map(Xu))}const w2=x.memo(({onSelectionChange:e})=>{const t=Wt(),{selectedNodes:n,selectedEdges:s}=gt(w4,v4);return x.useEffect(()=>{const a={nodes:n,edges:s};e==null||e(a),t.getState().onSelectionChange.forEach(i=>i(a))},[n,s,e]),null});w2.displayName="SelectionListener";const x4=e=>!!e.onSelectionChange;function b4({onSelectionChange:e}){const t=gt(x4);return e||t?pe.createElement(w2,{onSelectionChange:e}):null}const k4=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 gi(e,t){x.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function at(e,t,n){x.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const _4=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:a,onConnectStart:i,onConnectEnd:c,onClickConnectStart:u,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:h,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:_,maxZoom:j,nodeExtent:k,onNodesChange:S,onEdgesChange:E,elementsSelectable:C,connectionMode:T,snapGrid:R,snapToGrid:I,translateExtent:F,connectOnClick:W,defaultEdgeOptions:O,fitView:B,fitViewOptions:Z,onNodesDelete:Q,onEdgesDelete:M,onNodeDrag:K,onNodeDragStart:G,onNodeDragStop:P,onSelectionDrag:H,onSelectionDragStart:L,onSelectionDragStop:U,noPanClassName:$,nodeOrigin:V,rfId:he,autoPanOnConnect:Y,autoPanOnNodeDrag:J,onError:z,connectionRadius:re,isValidConnection:le,nodeDragThreshold:me})=>{const{setNodes:ge,setEdges:Me,setDefaultNodesAndEdges:qe,setMinZoom:Ve,setMaxZoom:Ue,setTranslateExtent:Se,setNodeExtent:Qe,reset:Ne}=gt(k4,Qt),_e=Wt();return x.useEffect(()=>{const ue=s==null?void 0:s.map(je=>({...je,...O}));return qe(n,ue),()=>{Ne()}},[]),at("defaultEdgeOptions",O,_e.setState),at("connectionMode",T,_e.setState),at("onConnect",a,_e.setState),at("onConnectStart",i,_e.setState),at("onConnectEnd",c,_e.setState),at("onClickConnectStart",u,_e.setState),at("onClickConnectEnd",f,_e.setState),at("nodesDraggable",p,_e.setState),at("nodesConnectable",h,_e.setState),at("nodesFocusable",m,_e.setState),at("edgesFocusable",y,_e.setState),at("edgesUpdatable",w,_e.setState),at("elementsSelectable",C,_e.setState),at("elevateNodesOnSelect",N,_e.setState),at("snapToGrid",I,_e.setState),at("snapGrid",R,_e.setState),at("onNodesChange",S,_e.setState),at("onEdgesChange",E,_e.setState),at("connectOnClick",W,_e.setState),at("fitViewOnInit",B,_e.setState),at("fitViewOnInitOptions",Z,_e.setState),at("onNodesDelete",Q,_e.setState),at("onEdgesDelete",M,_e.setState),at("onNodeDrag",K,_e.setState),at("onNodeDragStart",G,_e.setState),at("onNodeDragStop",P,_e.setState),at("onSelectionDrag",H,_e.setState),at("onSelectionDragStart",L,_e.setState),at("onSelectionDragStop",U,_e.setState),at("noPanClassName",$,_e.setState),at("nodeOrigin",V,_e.setState),at("rfId",he,_e.setState),at("autoPanOnConnect",Y,_e.setState),at("autoPanOnNodeDrag",J,_e.setState),at("onError",z,_e.setState),at("connectionRadius",re,_e.setState),at("isValidConnection",le,_e.setState),at("nodeDragThreshold",me,_e.setState),gi(e,ge),gi(t,Me),gi(_,Ve),gi(j,Ue),gi(F,Se),gi(k,Qe),null},Vk={display:"none"},N4={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},v2="react-flow__node-desc",x2="react-flow__edge-desc",S4="react-flow__aria-live",j4=e=>e.ariaLiveMessage;function E4({rfId:e}){const t=gt(j4);return pe.createElement("div",{id:`${S4}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:N4},t)}function C4({rfId:e,disableKeyboardA11y:t}){return pe.createElement(pe.Fragment,null,pe.createElement("div",{id:`${v2}-${e}`,style:Vk},"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."," "),pe.createElement("div",{id:`${x2}-${e}`,style:Vk},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&pe.createElement(E4,{rfId:e}))}var fc=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=x.useState(!1),a=x.useRef(!1),i=x.useRef(new Set([])),[c,u]=x.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),h=p.reduce((m,y)=>m.concat(...y),[]);return[p,h]}return[[],[]]},[e]);return x.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const h=w=>{if(a.current=w.ctrlKey||w.metaKey||w.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&Xv(w))return!1;const _=Kk(w.code,u);i.current.add(w[_]),Yk(c,i.current,!1)&&(w.preventDefault(),s(!0))},m=w=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&Xv(w))return!1;const _=Kk(w.code,u);Yk(c,i.current,!0)?(s(!1),i.current.clear()):i.current.delete(w[_]),w.key==="Meta"&&i.current.clear(),a.current=!1},y=()=>{i.current.clear(),s(!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,s]),n};function Yk(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(a=>t.has(a)))}function Kk(e,t){return t.includes(e)?"code":"key"}function b2(e,t,n,s){var u,f;const a=e.parentNode||e.parentId;if(!a)return n;const i=t.get(a),c=io(i,s);return b2(i,t,{x:(n.x??0)+c.x,y:(n.y??0)+c.y,z:(((u=i[Lt])==null?void 0:u.z)??0)>(n.z??0)?((f=i[Lt])==null?void 0:f.z)??0:n.z??0},s)}function k2(e,t,n){e.forEach(s=>{var i;const a=s.parentNode||s.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||n!=null&&n[s.id]){const{x:c,y:u,z:f}=b2(s,e,{...s.position,z:((i=s[Lt])==null?void 0:i.z)??0},t);s.positionAbsolute={x:c,y:u},s[Lt].z=f,n!=null&&n[s.id]&&(s[Lt].isParent=!0)}})}function tp(e,t,n,s){const a=new Map,i={},c=s?1e3:0;return e.forEach(u=>{var w;const f=(or(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&&(i[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(h,Lt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[Lt])==null?void 0:w.handleBounds,z:f}}),a.set(u.id,h)}),k2(a,n,i),a}function _2(e,t={}){const{getNodes:n,width:s,height:a,minZoom:i,maxZoom:c,d3Zoom:u,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:m}=e(),y=t.initial&&!p&&h;if(u&&f&&(y||!t.initial)){const N=n().filter(j=>{var S;const k=t.includeHiddenNodes?j.width&&j.height:!j.hidden;return(S=t.nodes)!=null&&S.length?k&&t.nodes.some(E=>E.id===j.id):k}),_=N.every(j=>j.width&&j.height);if(N.length>0&&_){const j=Qd(N,m),{x:k,y:S,zoom:E}=l2(j,s,a,t.minZoom??i,t.maxZoom??c,t.padding??.1),C=ws.translate(k,S).scale(E);return typeof t.duration=="number"&&t.duration>0?u.transform(ro(f,t.duration),C):u.transform(f,C),!0}}return!1}function T4(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[Lt]:s[Lt],selected:n.selected})}),new Map(t)}function A4(e,t){return t.map(n=>{const s=e.find(a=>a.id===n.id);return s&&(n.selected=s.selected),n})}function Zu({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:a,edges:i,onNodesChange:c,onEdgesChange:u,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&s({nodeInternals:T4(e,a)}),c==null||c(e)),t!=null&&t.length&&(p&&s({edges:A4(t,i)}),u==null||u(t))}const yi=()=>{},R4={zoomIn:yi,zoomOut:yi,zoomTo:yi,getZoom:()=>1,setViewport:yi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:yi,fitBounds:yi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},M4=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),I4=()=>{const e=Wt(),{d3Zoom:t,d3Selection:n}=gt(M4,Qt);return x.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(ro(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(ro(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,i)=>t.scaleTo(ro(n,i==null?void 0:i.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,i)=>{const[c,u,f]=e.getState().transform,p=ws.translate(a.x??c,a.y??u).scale(a.zoom??f);t.transform(ro(n,i==null?void 0:i.duration),p)},getViewport:()=>{const[a,i,c]=e.getState().transform;return{x:a,y:i,zoom:c}},fitView:a=>_2(e.getState,a),setCenter:(a,i,c)=>{const{width:u,height:f,maxZoom:p}=e.getState(),h=typeof(c==null?void 0:c.zoom)<"u"?c.zoom:p,m=u/2-a*h,y=f/2-i*h,w=ws.translate(m,y).scale(h);t.transform(ro(n,c==null?void 0:c.duration),w)},fitBounds:(a,i)=>{const{width:c,height:u,minZoom:f,maxZoom:p}=e.getState(),{x:h,y:m,zoom:y}=l2(a,c,u,f,p,(i==null?void 0:i.padding)??.1),w=ws.translate(h,m).scale(y);t.transform(ro(n,i==null?void 0:i.duration),w)},project:a=>{const{transform:i,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"),Jv(a,i,c,u)},screenToFlowPosition:a=>{const{transform:i,snapToGrid:c,snapGrid:u,domNode:f}=e.getState();if(!f)return a;const{x:p,y:h}=f.getBoundingClientRect(),m={x:a.x-p,y:a.y-h};return Jv(m,i,c,u)},flowToScreenPosition:a=>{const{transform:i,domNode:c}=e.getState();if(!c)return a;const{x:u,y:f}=c.getBoundingClientRect(),p=a2(a,i);return{x:p.x+u,y:p.y+f}},viewportInitialized:!0}:R4,[t,n])};function Sc(){const e=I4(),t=Wt(),n=x.useCallback(()=>t.getState().getNodes().map(_=>({..._})),[]),s=x.useCallback(_=>t.getState().nodeInternals.get(_),[]),a=x.useCallback(()=>{const{edges:_=[]}=t.getState();return _.map(j=>({...j}))},[]),i=x.useCallback(_=>{const{edges:j=[]}=t.getState();return j.find(k=>k.id===_)},[]),c=x.useCallback(_=>{const{getNodes:j,setNodes:k,hasDefaultNodes:S,onNodesChange:E}=t.getState(),C=j(),T=typeof _=="function"?_(C):_;if(S)k(T);else if(E){const R=T.length===0?C.map(I=>({type:"remove",id:I.id})):T.map(I=>({item:I,type:"reset"}));E(R)}},[]),u=x.useCallback(_=>{const{edges:j=[],setEdges:k,hasDefaultEdges:S,onEdgesChange:E}=t.getState(),C=typeof _=="function"?_(j):_;if(S)k(C);else if(E){const T=C.length===0?j.map(R=>({type:"remove",id:R.id})):C.map(R=>({item:R,type:"reset"}));E(T)}},[]),f=x.useCallback(_=>{const j=Array.isArray(_)?_:[_],{getNodes:k,setNodes:S,hasDefaultNodes:E,onNodesChange:C}=t.getState();if(E){const R=[...k(),...j];S(R)}else if(C){const T=j.map(R=>({item:R,type:"add"}));C(T)}},[]),p=x.useCallback(_=>{const j=Array.isArray(_)?_:[_],{edges:k=[],setEdges:S,hasDefaultEdges:E,onEdgesChange:C}=t.getState();if(E)S([...k,...j]);else if(C){const T=j.map(R=>({item:R,type:"add"}));C(T)}},[]),h=x.useCallback(()=>{const{getNodes:_,edges:j=[],transform:k}=t.getState(),[S,E,C]=k;return{nodes:_().map(T=>({...T})),edges:j.map(T=>({...T})),viewport:{x:S,y:E,zoom:C}}},[]),m=x.useCallback(({nodes:_,edges:j})=>{const{nodeInternals:k,getNodes:S,edges:E,hasDefaultNodes:C,hasDefaultEdges:T,onNodesDelete:R,onEdgesDelete:I,onNodesChange:F,onEdgesChange:W}=t.getState(),O=(_||[]).map(K=>K.id),B=(j||[]).map(K=>K.id),Z=S().reduce((K,G)=>{const P=G.parentNode||G.parentId,H=!O.includes(G.id)&&P&&K.find(U=>U.id===P);return(typeof G.deletable=="boolean"?G.deletable:!0)&&(O.includes(G.id)||H)&&K.push(G),K},[]),Q=E.filter(K=>typeof K.deletable=="boolean"?K.deletable:!0),M=Q.filter(K=>B.includes(K.id));if(Z||M){const K=i2(Z,Q),G=[...M,...K],P=G.reduce((H,L)=>(H.includes(L.id)||H.push(L.id),H),[]);if((T||C)&&(T&&t.setState({edges:E.filter(H=>!P.includes(H.id))}),C&&(Z.forEach(H=>{k.delete(H.id)}),t.setState({nodeInternals:new Map(k)}))),P.length>0&&(I==null||I(G),W&&W(P.map(H=>({id:H,type:"remove"})))),Z.length>0&&(R==null||R(Z),F)){const H=Z.map(L=>({id:L.id,type:"remove"}));F(H)}}},[]),y=x.useCallback(_=>{const j=J3(_),k=j?null:t.getState().nodeInternals.get(_.id);return!j&&!k?[null,null,j]:[j?_:Fk(k),k,j]},[]),w=x.useCallback((_,j=!0,k)=>{const[S,E,C]=y(_);return S?(k||t.getState().getNodes()).filter(T=>{if(!C&&(T.id===E.id||!T.positionAbsolute))return!1;const R=Fk(T),I=Kv(R,S);return j&&I>0||I>=S.width*S.height}):[]},[]),N=x.useCallback((_,j,k=!0)=>{const[S]=y(_);if(!S)return!1;const E=Kv(S,j);return k&&E>0||E>=S.width*S.height},[]);return x.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:a,getEdge:i,setNodes:c,setEdges:u,addNodes:f,addEdges:p,toObject:h,deleteElements:m,getIntersectingNodes:w,isNodeIntersecting:N}),[e,n,s,a,i,c,u,f,p,h,m,w,N])}const $4={actInsideInputWithModifier:!1};var O4=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Wt(),{deleteElements:s}=Sc(),a=fc(e,$4),i=fc(t);x.useEffect(()=>{if(a){const{edges:c,getNodes:u}=n.getState(),f=u().filter(h=>h.selected),p=c.filter(h=>h.selected);s({nodes:f,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),x.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function P4(e){const t=Wt();x.useEffect(()=>{let n;const s=()=>{var i,c;if(!e.current)return;const a=Cx(e.current);(a.height===0||a.width===0)&&((c=(i=t.getState()).onError)==null||c.call(i,"004",xs.error004())),t.setState({width:a.width||500,height:a.height||500})};return s(),window.addEventListener("resize",s),e.current&&(n=new ResizeObserver(()=>s()),n.observe(e.current)),()=>{window.removeEventListener("resize",s),n&&e.current&&n.unobserve(e.current)}},[])}const Lx={position:"absolute",width:"100%",height:"100%",top:0,left:0},L4=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Qu=e=>({x:e.x,y:e.y,zoom:e.k}),wi=(e,t)=>e.target.closest(`.${t}`),Xk=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Zk=e=>{const t=e.ctrlKey&&Ad()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},D4=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),q4=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:a=!0,zoomOnPinch:i=!0,panOnScroll:c=!1,panOnScrollSpeed:u=.5,panOnScrollMode:f=ao.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:_,zoomActivationKeyCode:j,preventScrolling:k=!0,children:S,noWheelClassName:E,noPanClassName:C})=>{const T=x.useRef(),R=Wt(),I=x.useRef(!1),F=x.useRef(!1),W=x.useRef(null),O=x.useRef({x:0,y:0,zoom:0}),{d3Zoom:B,d3Selection:Z,d3ZoomHandler:Q,userSelectionActive:M}=gt(D4,Qt),K=fc(j),G=x.useRef(0),P=x.useRef(!1),H=x.useRef();return P4(W),x.useEffect(()=>{if(W.current){const L=W.current.getBoundingClientRect(),U=YT().scaleExtent([N,_]).translateExtent(w),$=ar(W.current).call(U),V=ws.translate(y.x,y.y).scale(Pi(y.zoom,N,_)),he=[[0,0],[L.width,L.height]],Y=U.constrain()(V,he,w);U.transform($,Y),U.wheelDelta(Zk),R.setState({d3Zoom:U,d3Selection:$,d3ZoomHandler:$.on("wheel.zoom"),transform:[Y.x,Y.y,Y.k],domNode:W.current.closest(".react-flow")})}},[]),x.useEffect(()=>{Z&&B&&(c&&!K&&!M?Z.on("wheel.zoom",L=>{if(wi(L,E))return!1;L.preventDefault(),L.stopImmediatePropagation();const U=Z.property("__zoom").k||1;if(L.ctrlKey&&i){const le=jr(L),me=Zk(L),ge=U*Math.pow(2,me);B.scaleTo(Z,ge,le,L);return}const $=L.deltaMode===1?20:1;let V=f===ao.Vertical?0:L.deltaX*$,he=f===ao.Horizontal?0:L.deltaY*$;!Ad()&&L.shiftKey&&f!==ao.Vertical&&(V=L.deltaY*$,he=0),B.translateBy(Z,-(V/U)*u,-(he/U)*u,{internal:!0});const Y=Qu(Z.property("__zoom")),{onViewportChangeStart:J,onViewportChange:z,onViewportChangeEnd:re}=R.getState();clearTimeout(H.current),P.current||(P.current=!0,t==null||t(L,Y),J==null||J(Y)),P.current&&(e==null||e(L,Y),z==null||z(Y),H.current=setTimeout(()=>{n==null||n(L,Y),re==null||re(Y),P.current=!1},150))},{passive:!1}):typeof Q<"u"&&Z.on("wheel.zoom",function(L,U){if(!k&&L.type==="wheel"&&!L.ctrlKey||wi(L,E))return null;L.preventDefault(),Q.call(this,L,U)},{passive:!1}))},[M,c,f,Z,B,Q,K,i,k,E,t,e,n]),x.useEffect(()=>{B&&B.on("start",L=>{var V,he;if(!L.sourceEvent||L.sourceEvent.internal)return null;G.current=(V=L.sourceEvent)==null?void 0:V.button;const{onViewportChangeStart:U}=R.getState(),$=Qu(L.transform);I.current=!0,O.current=$,((he=L.sourceEvent)==null?void 0:he.type)==="mousedown"&&R.setState({paneDragging:!0}),U==null||U($),t==null||t(L.sourceEvent,$)})},[B,t]),x.useEffect(()=>{B&&(M&&!I.current?B.on("zoom",null):M||B.on("zoom",L=>{var $;const{onViewportChange:U}=R.getState();if(R.setState({transform:[L.transform.x,L.transform.y,L.transform.k]}),F.current=!!(s&&Xk(m,G.current??0)),(e||U)&&!(($=L.sourceEvent)!=null&&$.internal)){const V=Qu(L.transform);U==null||U(V),e==null||e(L.sourceEvent,V)}}))},[M,B,e,m,s]),x.useEffect(()=>{B&&B.on("end",L=>{if(!L.sourceEvent||L.sourceEvent.internal)return null;const{onViewportChangeEnd:U}=R.getState();if(I.current=!1,R.setState({paneDragging:!1}),s&&Xk(m,G.current??0)&&!F.current&&s(L.sourceEvent),F.current=!1,(n||U)&&L4(O.current,L.transform)){const $=Qu(L.transform);O.current=$,clearTimeout(T.current),T.current=setTimeout(()=>{U==null||U($),n==null||n(L.sourceEvent,$)},c?150:0)}})},[B,c,m,n,s]),x.useEffect(()=>{B&&B.filter(L=>{const U=K||a,$=i&&L.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&L.button===1&&L.type==="mousedown"&&(wi(L,"react-flow__node")||wi(L,"react-flow__edge")))return!0;if(!m&&!U&&!c&&!p&&!i||M||!p&&L.type==="dblclick"||wi(L,E)&&L.type==="wheel"||wi(L,C)&&(L.type!=="wheel"||c&&L.type==="wheel"&&!K)||!i&&L.ctrlKey&&L.type==="wheel"||!U&&!c&&!$&&L.type==="wheel"||!m&&(L.type==="mousedown"||L.type==="touchstart")||Array.isArray(m)&&!m.includes(L.button)&&L.type==="mousedown")return!1;const V=Array.isArray(m)&&m.includes(L.button)||!L.button||L.button<=1;return(!L.ctrlKey||L.type==="wheel")&&V})},[M,B,a,i,c,p,m,h,K]),pe.createElement("div",{className:"react-flow__renderer",ref:W,style:Lx},S)},F4=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function B4(){const{userSelectionActive:e,userSelectionRect:t}=gt(F4,Qt);return e&&t?pe.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 Qk(e,t){const n=t.parentNode||t.parentId,s=e.find(a=>a.id===n);if(s){const a=t.position.x+t.width-s.width,i=t.position.y+t.height-s.height;if(a>0||i>0||t.position.x<0||t.position.y<0){if(s.style={...s.style},s.style.width=s.style.width??s.width,s.style.height=s.style.height??s.height,a>0&&(s.style.width+=a),i>0&&(s.style.height+=i),t.position.x<0){const c=Math.abs(t.position.x);s.position.x=s.position.x-c,s.style.width+=c,t.position.x=0}if(t.position.y<0){const c=Math.abs(t.position.y);s.position.y=s.position.y-c,s.style.height+=c,t.position.y=0}s.width=s.style.width,s.height=s.style.height}}}function z4(e,t){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const n=e.filter(s=>s.type==="add").map(s=>s.item);return t.reduce((s,a)=>{const i=e.filter(u=>u.id===a.id);if(i.length===0)return s.push(a),s;const c={...a};for(const u of i)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&&Qk(s,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&&Qk(s,c);break}case"remove":return s}return s.push(c),s},n)}function U4(e,t){return z4(e,t)}const na=(e,t)=>({id:e,type:"select",selected:t});function Si(e,t){return e.reduce((n,s)=>{const a=t.includes(s.id);return!s.selected&&a?(s.selected=!0,n.push(na(s.id,!0))):s.selected&&!a&&(s.selected=!1,n.push(na(s.id,!1))),n},[])}const np=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},W4=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),N2=x.memo(({isSelecting:e,selectionMode:t=hc.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:a,onPaneClick:i,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:m})=>{const y=x.useRef(null),w=Wt(),N=x.useRef(0),_=x.useRef(0),j=x.useRef(),{userSelectionActive:k,elementsSelectable:S,dragging:E}=gt(W4,Qt),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,_.current=0},T=Q=>{i==null||i(Q),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},R=Q=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){Q.preventDefault();return}c==null||c(Q)},I=u?Q=>u(Q):void 0,F=Q=>{const{resetSelectedElements:M,domNode:K}=w.getState();if(j.current=K==null?void 0:K.getBoundingClientRect(),!S||!e||Q.button!==0||Q.target!==y.current||!j.current)return;const{x:G,y:P}=aa(Q,j.current);M(),w.setState({userSelectionRect:{width:0,height:0,startX:G,startY:P,x:G,y:P}}),s==null||s(Q)},W=Q=>{const{userSelectionRect:M,nodeInternals:K,edges:G,transform:P,onNodesChange:H,onEdgesChange:L,nodeOrigin:U,getNodes:$}=w.getState();if(!e||!j.current||!M)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=aa(Q,j.current),he=M.startX??0,Y=M.startY??0,J={...M,x:V.x<he?V.x:he,y:V.y<Y?V.y:Y,width:Math.abs(V.x-he),height:Math.abs(V.y-Y)},z=$(),re=o2(K,J,P,t===hc.Partial,!0,U),le=i2(re,G).map(ge=>ge.id),me=re.map(ge=>ge.id);if(N.current!==me.length){N.current=me.length;const ge=Si(z,me);ge.length&&(H==null||H(ge))}if(_.current!==le.length){_.current=le.length;const ge=Si(G,le);ge.length&&(L==null||L(ge))}w.setState({userSelectionRect:J})},O=Q=>{if(Q.button!==0)return;const{userSelectionRect:M}=w.getState();!k&&M&&Q.target===y.current&&(T==null||T(Q)),w.setState({nodesSelectionActive:N.current>0}),C(),a==null||a(Q)},B=Q=>{k&&(w.setState({nodesSelectionActive:N.current>0}),a==null||a(Q)),C()},Z=S&&(e||k);return pe.createElement("div",{className:un(["react-flow__pane",{dragging:E,selection:e}]),onClick:Z?void 0:np(T,y),onContextMenu:np(R,y),onWheel:np(I,y),onMouseEnter:Z?void 0:f,onMouseDown:Z?F:void 0,onMouseMove:Z?W:p,onMouseUp:Z?O:void 0,onMouseLeave:Z?B:h,ref:y,style:Lx},m,pe.createElement(B4,null))});N2.displayName="Pane";function S2(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:S2(s,t):!1}function Jk(e,t,n){let s=e;do{if(s!=null&&s.matches(t))return!0;if(s===n.current)return!1;s=s.parentElement}while(s);return!1}function H4(e,t,n,s){return Array.from(e.values()).filter(a=>(a.selected||a.id===s)&&(!a.parentNode||a.parentId||!S2(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var i,c;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=a.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((c=a.positionAbsolute)==null?void 0:c.y)??0)},delta:{x:0,y:0},extent:a.extent,parentNode:a.parentNode||a.parentId,parentId:a.parentNode||a.parentId,width:a.width,height:a.height,expandParent:a.expandParent}})}function G4(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function j2(e,t,n,s,a=[0,0],i){const c=G4(e,e.extent||s);let u=c;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const m=n.get(f),{x:y,y:w}=io(m,a).positionAbsolute;u=m&&or(y)&&or(w)&&or(m.width)&&or(m.height)?[[y+e.width*a[0],w+e.height*a[1]],[y+m.width-e.width+e.width*a[0],w+m.height-e.height+e.height*a[1]]]:u}else i==null||i("005",xs.error005()),u=c;else if(e.extent&&f&&e.extent!=="parent"){const m=n.get(f),{x:y,y:w}=io(m,a).positionAbsolute;u=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(f){const m=n.get(f);p=io(m,a).positionAbsolute}const h=u&&u!=="parent"?Tx(t,u):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function rp({nodeId:e,dragItems:t,nodeInternals:n}){const s=t.map(a=>({...n.get(a.id),position:a.position,positionAbsolute:a.positionAbsolute}));return[e?s.find(a=>a.id===e):s[0],s]}const e1=(e,t,n,s)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const i=Array.from(a),c=t.getBoundingClientRect(),u={x:c.width*s[0],y:c.height*s[1]};return i.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,...Cx(f)}})};function Wl(e,t,n){return n===void 0?n:s=>{const a=t().nodeInternals.get(e);a&&n(s,{...a})}}function tx({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:a,unselectNodesAndEdges:i,multiSelectionActive:c,nodeInternals:u,onError:f}=t.getState(),p=u.get(e);if(!p){f==null||f("012",xs.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&c)&&(i({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var h;return(h=s==null?void 0:s.current)==null?void 0:h.blur()})):a([e])}function V4(){const e=Wt();return x.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:a,snapToGrid:i}=e.getState(),c=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,f={x:(c-s[0])/s[2],y:(u-s[1])/s[2]};return{xSnapped:i?a[0]*Math.round(f.x/a[0]):f.x,ySnapped:i?a[1]*Math.round(f.y/a[1]):f.y,...f}},[])}function sp(e){return(t,n,s)=>e==null?void 0:e(t,s)}function E2({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:a,isSelectable:i,selectNodesOnDrag:c}){const u=Wt(),[f,p]=x.useState(!1),h=x.useRef([]),m=x.useRef({x:null,y:null}),y=x.useRef(0),w=x.useRef(null),N=x.useRef({x:0,y:0}),_=x.useRef(null),j=x.useRef(!1),k=x.useRef(!1),S=x.useRef(!1),E=V4();return x.useEffect(()=>{if(e!=null&&e.current){const C=ar(e.current),T=({x:F,y:W})=>{const{nodeInternals:O,onNodeDrag:B,onSelectionDrag:Z,updateNodePositions:Q,nodeExtent:M,snapGrid:K,snapToGrid:G,nodeOrigin:P,onError:H}=u.getState();m.current={x:F,y:W};let L=!1,U={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&M){const V=Qd(h.current,P);U=dc(V)}if(h.current=h.current.map(V=>{const he={x:F-V.distance.x,y:W-V.distance.y};G&&(he.x=K[0]*Math.round(he.x/K[0]),he.y=K[1]*Math.round(he.y/K[1]));const Y=[[M[0][0],M[0][1]],[M[1][0],M[1][1]]];h.current.length>1&&M&&!V.extent&&(Y[0][0]=V.positionAbsolute.x-U.x+M[0][0],Y[1][0]=V.positionAbsolute.x+(V.width??0)-U.x2+M[1][0],Y[0][1]=V.positionAbsolute.y-U.y+M[0][1],Y[1][1]=V.positionAbsolute.y+(V.height??0)-U.y2+M[1][1]);const J=j2(V,he,O,Y,P,H);return L=L||V.position.x!==J.position.x||V.position.y!==J.position.y,V.position=J.position,V.positionAbsolute=J.positionAbsolute,V}),!L)return;Q(h.current,!0,!0),p(!0);const $=a?B:sp(Z);if($&&_.current){const[V,he]=rp({nodeId:a,dragItems:h.current,nodeInternals:O});$(_.current,V,he)}},R=()=>{if(!w.current)return;const[F,W]=XT(N.current,w.current);if(F!==0||W!==0){const{transform:O,panBy:B}=u.getState();m.current.x=(m.current.x??0)-F/O[2],m.current.y=(m.current.y??0)-W/O[2],B({x:F,y:W})&&T(m.current)}y.current=requestAnimationFrame(R)},I=F=>{var P;const{nodeInternals:W,multiSelectionActive:O,nodesDraggable:B,unselectNodesAndEdges:Z,onNodeDragStart:Q,onSelectionDragStart:M}=u.getState();k.current=!0;const K=a?Q:sp(M);(!c||!i)&&!O&&a&&((P=W.get(a))!=null&&P.selected||Z()),a&&i&&c&&tx({id:a,store:u,nodeRef:e});const G=E(F);if(m.current=G,h.current=H4(W,B,G,a),K&&h.current){const[H,L]=rp({nodeId:a,dragItems:h.current,nodeInternals:W});K(F.sourceEvent,H,L)}};if(t)C.on(".drag",null);else{const F=rO().on("start",W=>{const{domNode:O,nodeDragThreshold:B}=u.getState();B===0&&I(W),S.current=!1;const Z=E(W);m.current=Z,w.current=(O==null?void 0:O.getBoundingClientRect())||null,N.current=aa(W.sourceEvent,w.current)}).on("drag",W=>{var Q,M;const O=E(W),{autoPanOnNodeDrag:B,nodeDragThreshold:Z}=u.getState();if(W.sourceEvent.type==="touchmove"&&W.sourceEvent.touches.length>1&&(S.current=!0),!S.current){if(!j.current&&k.current&&B&&(j.current=!0,R()),!k.current){const K=O.xSnapped-(((Q=m==null?void 0:m.current)==null?void 0:Q.x)??0),G=O.ySnapped-(((M=m==null?void 0:m.current)==null?void 0:M.y)??0);Math.sqrt(K*K+G*G)>Z&&I(W)}(m.current.x!==O.xSnapped||m.current.y!==O.ySnapped)&&h.current&&k.current&&(_.current=W.sourceEvent,N.current=aa(W.sourceEvent,w.current),T(O))}}).on("end",W=>{if(!(!k.current||S.current)&&(p(!1),j.current=!1,k.current=!1,cancelAnimationFrame(y.current),h.current)){const{updateNodePositions:O,nodeInternals:B,onNodeDragStop:Z,onSelectionDragStop:Q}=u.getState(),M=a?Z:sp(Q);if(O(h.current,!1,!1),M){const[K,G]=rp({nodeId:a,dragItems:h.current,nodeInternals:B});M(W.sourceEvent,K,G)}}}).filter(W=>{const O=W.target;return!W.button&&(!n||!Jk(O,`.${n}`,e))&&(!s||Jk(O,s,e))});return C.call(F),()=>{C.on(".drag",null)}}}},[e,t,n,s,i,u,a,c,E]),f}function C2(){const e=Wt();return x.useCallback(n=>{const{nodeInternals:s,nodeExtent:a,updateNodePositions:i,getNodes:c,snapToGrid:u,snapGrid:f,onError:p,nodesDraggable:h}=e.getState(),m=c().filter(S=>S.selected&&(S.draggable||h&&typeof S.draggable>"u")),y=u?f[0]:5,w=u?f[1]:5,N=n.isShiftPressed?4:1,_=n.x*y*N,j=n.y*w*N,k=m.map(S=>{if(S.positionAbsolute){const E={x:S.positionAbsolute.x+_,y:S.positionAbsolute.y+j};u&&(E.x=f[0]*Math.round(E.x/f[0]),E.y=f[1]*Math.round(E.y/f[1]));const{positionAbsolute:C,position:T}=j2(S,E,s,a,void 0,p);S.position=T,S.positionAbsolute=C}return S});i(k,!0,!1)},[])}const Ri={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Hl=e=>{const t=({id:n,type:s,data:a,xPos:i,yPos:c,xPosOrigin:u,yPosOrigin:f,selected:p,onClick:h,onMouseEnter:m,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:_,style:j,className:k,isDraggable:S,isSelectable:E,isConnectable:C,isFocusable:T,selectNodesOnDrag:R,sourcePosition:I,targetPosition:F,hidden:W,resizeObserver:O,dragHandle:B,zIndex:Z,isParent:Q,noDragClassName:M,noPanClassName:K,initialized:G,disableKeyboardA11y:P,ariaLabel:H,rfId:L,hasHandleBounds:U})=>{const $=Wt(),V=x.useRef(null),he=x.useRef(null),Y=x.useRef(I),J=x.useRef(F),z=x.useRef(s),re=E||S||h||m||y||w,le=C2(),me=Wl(n,$.getState,m),ge=Wl(n,$.getState,y),Me=Wl(n,$.getState,w),qe=Wl(n,$.getState,N),Ve=Wl(n,$.getState,_),Ue=Ne=>{const{nodeDragThreshold:_e}=$.getState();if(E&&(!R||!S||_e>0)&&tx({id:n,store:$,nodeRef:V}),h){const ue=$.getState().nodeInternals.get(n);ue&&h(Ne,{...ue})}},Se=Ne=>{if(!Xv(Ne)&&!P)if(e2.includes(Ne.key)&&E){const _e=Ne.key==="Escape";tx({id:n,store:$,unselect:_e,nodeRef:V})}else S&&p&&Object.prototype.hasOwnProperty.call(Ri,Ne.key)&&($.setState({ariaLiveMessage:`Moved selected node ${Ne.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~c}`}),le({x:Ri[Ne.key].x,y:Ri[Ne.key].y,isShiftPressed:Ne.shiftKey}))};x.useEffect(()=>()=>{he.current&&(O==null||O.unobserve(he.current),he.current=null)},[]),x.useEffect(()=>{if(V.current&&!W){const Ne=V.current;(!G||!U||he.current!==Ne)&&(he.current&&(O==null||O.unobserve(he.current)),O==null||O.observe(Ne),he.current=Ne)}},[W,G,U]),x.useEffect(()=>{const Ne=z.current!==s,_e=Y.current!==I,ue=J.current!==F;V.current&&(Ne||_e||ue)&&(Ne&&(z.current=s),_e&&(Y.current=I),ue&&(J.current=F),$.getState().updateNodeDimensions([{id:n,nodeElement:V.current,forceUpdate:!0}]))},[n,s,I,F]);const Qe=E2({nodeRef:V,disabled:W||!S,noDragClassName:M,handleSelector:B,nodeId:n,isSelectable:E,selectNodesOnDrag:R});return W?null:pe.createElement("div",{className:un(["react-flow__node",`react-flow__node-${s}`,{[K]:S},k,{selected:p,selectable:E,parent:Q,dragging:Qe}]),ref:V,style:{zIndex:Z,transform:`translate(${u}px,${f}px)`,pointerEvents:re?"all":"none",visibility:G?"visible":"hidden",...j},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:me,onMouseMove:ge,onMouseLeave:Me,onContextMenu:qe,onClick:Ue,onDoubleClick:Ve,onKeyDown:T?Se:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":P?void 0:`${v2}-${L}`,"aria-label":H},pe.createElement(o4,{value:n},pe.createElement(e,{id:n,data:a,type:s,xPos:i,yPos:c,selected:p,isConnectable:C,sourcePosition:I,targetPosition:F,dragging:Qe,dragHandle:B,zIndex:Z})))};return t.displayName="NodeWrapper",x.memo(t)};const Y4=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Qd(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function K4({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Wt(),{width:a,height:i,x:c,y:u,transformString:f,userSelectionActive:p}=gt(Y4,Qt),h=C2(),m=x.useRef(null);if(x.useEffect(()=>{var N;n||(N=m.current)==null||N.focus({preventScroll:!0})},[n]),E2({nodeRef:m}),p||!a||!i)return null;const y=e?N=>{const _=s.getState().getNodes().filter(j=>j.selected);e(N,_)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(Ri,N.key)&&h({x:Ri[N.key].x,y:Ri[N.key].y,isShiftPressed:N.shiftKey})};return pe.createElement("div",{className:un(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},pe.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:a,height:i,top:u,left:c}}))}var X4=x.memo(K4);const Z4=e=>e.nodesSelectionActive,T2=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:c,deleteKeyCode:u,onMove:f,onMoveStart:p,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:_,multiSelectionKeyCode:j,panActivationKeyCode:k,zoomActivationKeyCode:S,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:I,panOnScrollMode:F,zoomOnDoubleClick:W,panOnDrag:O,defaultViewport:B,translateExtent:Z,minZoom:Q,maxZoom:M,preventScrolling:K,onSelectionContextMenu:G,noWheelClassName:P,noPanClassName:H,disableKeyboardA11y:L})=>{const U=gt(Z4),$=fc(m),V=fc(k),he=V||O,Y=V||R,J=$||y&&he!==!0;return O4({deleteKeyCode:u,multiSelectionKeyCode:j}),pe.createElement(q4,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:Y,panOnScrollSpeed:I,panOnScrollMode:F,zoomOnDoubleClick:W,panOnDrag:!$&&he,defaultViewport:B,translateExtent:Z,minZoom:Q,maxZoom:M,zoomActivationKeyCode:S,preventScrolling:K,noWheelClassName:P,noPanClassName:H},pe.createElement(N2,{onSelectionStart:N,onSelectionEnd:_,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:c,panOnDrag:he,isSelecting:!!J,selectionMode:w},e,U&&pe.createElement(X4,{onSelectionContextMenu:G,noPanClassName:H,disableKeyboardA11y:L})))};T2.displayName="FlowRenderer";var Q4=x.memo(T2);function J4(e){return gt(x.useCallback(n=>e?o2(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function eP(e){const t={input:Hl(e.input||m2),default:Hl(e.default||ex),output:Hl(e.output||y2),group:Hl(e.group||Px)},n={},s=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,i)=>(a[i]=Hl(e[i]||ex),a),n);return{...t,...s}}const tP=({x:e,y:t,width:n,height:s,origin:a})=>!n||!s?{x:e,y:t}:a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:e,y:t}:{x:e-n*a[0],y:t-s*a[1]},nP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),A2=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:a,updateNodeDimensions:i,onError:c}=gt(nP,Qt),u=J4(e.onlyRenderVisibleElements),f=x.useRef(),p=x.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(m=>{const y=m.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));i(y)});return f.current=h,h},[]);return x.useEffect(()=>()=>{var h;(h=f==null?void 0:f.current)==null||h.disconnect()},[]),pe.createElement("div",{className:"react-flow__nodes",style:Lx},u.map(h=>{var T,R,I;let m=h.type||"default";e.nodeTypes[m]||(c==null||c("003",xs.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,w=!!(h.draggable||t&&typeof h.draggable>"u"),N=!!(h.selectable||a&&typeof h.selectable>"u"),_=!!(h.connectable||n&&typeof h.connectable>"u"),j=!!(h.focusable||s&&typeof h.focusable>"u"),k=e.nodeExtent?Tx(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,S=(k==null?void 0:k.x)??0,E=(k==null?void 0:k.y)??0,C=tP({x:S,y:E,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return pe.createElement(y,{key:h.id,id:h.id,className:h.className,style:h.style,type:m,data:h.data,sourcePosition:h.sourcePosition||ze.Bottom,targetPosition:h.targetPosition||ze.Top,hidden:h.hidden,xPos:S,yPos:E,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!h.selected,isDraggable:w,isSelectable:N,isConnectable:_,isFocusable:j,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((T=h[Lt])==null?void 0:T.z)??0,isParent:!!((R=h[Lt])!=null&&R.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((I=h[Lt])!=null&&I.handleBounds)})}))};A2.displayName="NodeRenderer";var rP=x.memo(A2);const sP=(e,t,n)=>n===ze.Left?e-t:n===ze.Right?e+t:e,aP=(e,t,n)=>n===ze.Top?e-t:n===ze.Bottom?e+t:e,t1="react-flow__edgeupdater",n1=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:a,onMouseEnter:i,onMouseOut:c,type:u})=>pe.createElement("circle",{onMouseDown:a,onMouseEnter:i,onMouseOut:c,className:un([t1,`${t1}-${u}`]),cx:sP(t,s,e),cy:aP(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),oP=()=>!0;var vi=e=>{const t=({id:n,className:s,type:a,data:i,onClick:c,onEdgeDoubleClick:u,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,style:j,source:k,target:S,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:I,targetPosition:F,elementsSelectable:W,hidden:O,sourceHandleId:B,targetHandleId:Z,onContextMenu:Q,onMouseEnter:M,onMouseMove:K,onMouseLeave:G,reconnectRadius:P,onReconnect:H,onReconnectStart:L,onReconnectEnd:U,markerEnd:$,markerStart:V,rfId:he,ariaLabel:Y,isFocusable:J,isReconnectable:z,pathOptions:re,interactionWidth:le,disableKeyboardA11y:me})=>{const ge=x.useRef(null),[Me,qe]=x.useState(!1),[Ve,Ue]=x.useState(!1),Se=Wt(),Qe=x.useMemo(()=>`url('#${Qv(V,he)}')`,[V,he]),Ne=x.useMemo(()=>`url('#${Qv($,he)}')`,[$,he]);if(O)return null;const _e=et=>{var nt;const{edges:ht,addSelectedEdges:Je,unselectNodesAndEdges:tt,multiSelectionActive:it}=Se.getState(),bt=ht.find(pt=>pt.id===n);bt&&(W&&(Se.setState({nodesSelectionActive:!1}),bt.selected&&it?(tt({nodes:[],edges:[bt]}),(nt=ge.current)==null||nt.blur()):Je([n])),c&&c(et,bt))},ue=Ul(n,Se.getState,u),je=Ul(n,Se.getState,Q),Ce=Ul(n,Se.getState,M),Fe=Ul(n,Se.getState,K),We=Ul(n,Se.getState,G),He=(et,ht)=>{if(et.button!==0)return;const{edges:Je,isValidConnection:tt}=Se.getState(),it=ht?S:k,bt=(ht?Z:B)||null,nt=ht?"target":"source",pt=tt||oP,fe=ht,lt=Je.find(Dt=>Dt.id===n);Ue(!0),L==null||L(et,lt,nt);const vt=Dt=>{Ue(!1),U==null||U(Dt,lt,nt)};d2({event:et,handleId:bt,nodeId:it,onConnect:Dt=>H==null?void 0:H(lt,Dt),isTarget:fe,getState:Se.getState,setState:Se.setState,isValidConnection:pt,edgeUpdaterType:nt,onReconnectEnd:vt})},ot=et=>He(et,!0),wt=et=>He(et,!1),ut=()=>qe(!0),ee=()=>qe(!1),ke=!W&&!c,Be=et=>{var ht;if(!me&&e2.includes(et.key)&&W){const{unselectNodesAndEdges:Je,addSelectedEdges:tt,edges:it}=Se.getState();et.key==="Escape"?((ht=ge.current)==null||ht.blur(),Je({edges:[it.find(nt=>nt.id===n)]})):tt([n])}};return pe.createElement("g",{className:un(["react-flow__edge",`react-flow__edge-${a}`,s,{selected:f,animated:p,inactive:ke,updating:Me}]),onClick:_e,onDoubleClick:ue,onContextMenu:je,onMouseEnter:Ce,onMouseMove:Fe,onMouseLeave:We,onKeyDown:J?Be:void 0,tabIndex:J?0:void 0,role:J?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Y===null?void 0:Y||`Edge from ${k} to ${S}`,"aria-describedby":J?`${x2}-${he}`:void 0,ref:ge},!Ve&&pe.createElement(e,{id:n,source:k,target:S,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,data:i,style:j,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:I,targetPosition:F,sourceHandleId:B,targetHandleId:Z,markerStart:Qe,markerEnd:Ne,pathOptions:re,interactionWidth:le}),z&&pe.createElement(pe.Fragment,null,(z==="source"||z===!0)&&pe.createElement(n1,{position:I,centerX:E,centerY:C,radius:P,onMouseDown:ot,onMouseEnter:ut,onMouseOut:ee,type:"source"}),(z==="target"||z===!0)&&pe.createElement(n1,{position:F,centerX:T,centerY:R,radius:P,onMouseDown:wt,onMouseEnter:ut,onMouseOut:ee,type:"target"})))};return t.displayName="EdgeWrapper",x.memo(t)};function iP(e){const t={default:vi(e.default||Md),straight:vi(e.bezier||Mx),step:vi(e.step||Rx),smoothstep:vi(e.step||Zd),simplebezier:vi(e.simplebezier||Ax)},n={},s=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,i)=>(a[i]=vi(e[i]||Md),a),n);return{...t,...s}}function r1(e,t,n=null){const s=((n==null?void 0:n.x)||0)+t.x,a=((n==null?void 0:n.y)||0)+t.y,i=(n==null?void 0:n.width)||t.width,c=(n==null?void 0:n.height)||t.height;switch(e){case ze.Top:return{x:s+i/2,y:a};case ze.Right:return{x:s+i,y:a+c/2};case ze.Bottom:return{x:s+i/2,y:a+c};case ze.Left:return{x:s,y:a+c/2}}}function s1(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const lP=(e,t,n,s,a,i)=>{const c=r1(n,e,t),u=r1(i,s,a);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y}};function cP({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:a,targetHeight:i,width:c,height:u,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+a),y2:Math.max(e.y+s,t.y+i)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const h=dc({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 a1(e){var s,a,i,c,u;const t=((s=e==null?void 0:e[Lt])==null?void 0:s.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)<"u"&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.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 uP=[{level:0,isMaxLevel:!0,edges:[]}];function dP(e,t,n=!1){let s=-1;const a=e.reduce((c,u)=>{var h,m;const f=or(u.zIndex);let p=f?u.zIndex:0;if(n){const y=t.get(u.target),w=t.get(u.source),N=u.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),_=Math.max(((h=w==null?void 0:w[Lt])==null?void 0:h.z)||0,((m=y==null?void 0:y[Lt])==null?void 0:m.z)||0,1e3);p=(f?u.zIndex:0)+(N?_:0)}return c[p]?c[p].push(u):c[p]=[u],s=p>s?p:s,c},{}),i=Object.entries(a).map(([c,u])=>{const f=+c;return{edges:u,level:f,isMaxLevel:f===s}});return i.length===0?uP:i}function hP(e,t,n){const s=gt(x.useCallback(a=>e?a.edges.filter(i=>{const c=t.get(i.source),u=t.get(i.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)&&cP({sourcePos:c.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:c.width,sourceHeight:c.height,targetWidth:u.width,targetHeight:u.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return dP(s,t,n)}const fP=({color:e="none",strokeWidth:t=1})=>pe.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),pP=({color:e="none",strokeWidth:t=1})=>pe.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),o1={[Rd.Arrow]:fP,[Rd.ArrowClosed]:pP};function mP(e){const t=Wt();return x.useMemo(()=>{var a,i;return Object.prototype.hasOwnProperty.call(o1,e)?o1[e]:((i=(a=t.getState()).onError)==null||i.call(a,"009",xs.error009(e)),null)},[e])}const gP=({id:e,type:t,color:n,width:s=12.5,height:a=12.5,markerUnits:i="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const f=mP(t);return f?pe.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:u,refX:"0",refY:"0"},pe.createElement(f,{color:n,strokeWidth:c})):null},yP=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((a,i)=>([i.markerStart,i.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const u=Qv(c,t);s.includes(u)||(a.push({id:u,color:c.color||e,...c}),s.push(u))}}),a),[]).sort((a,i)=>a.id.localeCompare(i.id))},R2=({defaultColor:e,rfId:t})=>{const n=gt(x.useCallback(yP({defaultColor:e,rfId:t}),[e,t]),(s,a)=>!(s.length!==a.length||s.some((i,c)=>i.id!==a[c].id)));return pe.createElement("defs",null,n.map(s=>pe.createElement(gP,{id:s.id,key:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient})))};R2.displayName="MarkerDefinitions";var wP=x.memo(R2);const vP=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}),M2=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:a,noPanClassName:i,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,children:j,disableKeyboardA11y:k})=>{const{edgesFocusable:S,edgesUpdatable:E,elementsSelectable:C,width:T,height:R,connectionMode:I,nodeInternals:F,onError:W}=gt(vP,Qt),O=hP(t,F,n);return T?pe.createElement(pe.Fragment,null,O.map(({level:B,edges:Z,isMaxLevel:Q})=>pe.createElement("svg",{key:B,style:{zIndex:B},width:T,height:R,className:"react-flow__edges react-flow__container"},Q&&pe.createElement(wP,{defaultColor:e,rfId:s}),pe.createElement("g",null,Z.map(M=>{const[K,G,P]=a1(F.get(M.source)),[H,L,U]=a1(F.get(M.target));if(!P||!U)return null;let $=M.type||"default";a[$]||(W==null||W("011",xs.error011($)),$="default");const V=a[$]||a.default,he=I===co.Strict?L.target:(L.target??[]).concat(L.source??[]),Y=s1(G.source,M.sourceHandle),J=s1(he,M.targetHandle),z=(Y==null?void 0:Y.position)||ze.Bottom,re=(J==null?void 0:J.position)||ze.Top,le=!!(M.focusable||S&&typeof M.focusable>"u"),me=M.reconnectable||M.updatable,ge=typeof y<"u"&&(me||E&&typeof me>"u");if(!Y||!J)return W==null||W("008",xs.error008(Y,M)),null;const{sourceX:Me,sourceY:qe,targetX:Ve,targetY:Ue}=lP(K,Y,z,H,J,re);return pe.createElement(V,{key:M.id,id:M.id,className:un([M.className,i]),type:$,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:Me,sourceY:qe,targetX:Ve,targetY:Ue,sourcePosition:z,targetPosition:re,elementsSelectable:C,onContextMenu:c,onMouseEnter:u,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,rfId:s,ariaLabel:M.ariaLabel,isFocusable:le,isReconnectable:ge,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth,disableKeyboardA11y:k})})))),j):null};M2.displayName="EdgeRenderer";var xP=x.memo(M2);const bP=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function kP({children:e}){const t=gt(bP);return pe.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function _P(e){const t=Sc(),n=x.useRef(!1);x.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const NP={[ze.Left]:ze.Right,[ze.Right]:ze.Left,[ze.Top]:ze.Bottom,[ze.Bottom]:ze.Top},I2=({nodeId:e,handleType:t,style:n,type:s=ra.Bezier,CustomComponent:a,connectionStatus:i})=>{var R,I,F;const{fromNode:c,handleId:u,toX:f,toY:p,connectionMode:h}=gt(x.useCallback(W=>({fromNode:W.nodeInternals.get(e),handleId:W.connectionHandleId,toX:(W.connectionPosition.x-W.transform[0])/W.transform[2],toY:(W.connectionPosition.y-W.transform[1])/W.transform[2],connectionMode:W.connectionMode}),[e]),Qt),m=(R=c==null?void 0:c[Lt])==null?void 0:R.handleBounds;let y=m==null?void 0:m[t];if(h===co.Loose&&(y=y||(m==null?void 0:m[t==="source"?"target":"source"])),!c||!y)return null;const w=u?y.find(W=>W.id===u):y[0],N=w?w.x+w.width/2:(c.width??0)/2,_=w?w.y+w.height/2:c.height??0,j=(((I=c.positionAbsolute)==null?void 0:I.x)??0)+N,k=(((F=c.positionAbsolute)==null?void 0:F.y)??0)+_,S=w==null?void 0:w.position,E=S?NP[S]:null;if(!S||!E)return null;if(a)return pe.createElement(a,{connectionLineType:s,connectionLineStyle:n,fromNode:c,fromHandle:w,fromX:j,fromY:k,toX:f,toY:p,fromPosition:S,toPosition:E,connectionStatus:i});let C="";const T={sourceX:j,sourceY:k,sourcePosition:S,targetX:f,targetY:p,targetPosition:E};return s===ra.Bezier?[C]=Ix(T):s===ra.Step?[C]=Zv({...T,borderRadius:0}):s===ra.SmoothStep?[C]=Zv(T):s===ra.SimpleBezier?[C]=s2(T):C=`M${j},${k} ${f},${p}`,pe.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};I2.displayName="ConnectionLine";const SP=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function jP({containerStyle:e,style:t,type:n,component:s}){const{nodeId:a,handleType:i,nodesConnectable:c,width:u,height:f,connectionStatus:p}=gt(SP,Qt);return!(a&&i&&u&&c)?null:pe.createElement("svg",{style:e,width:u,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},pe.createElement("g",{className:un(["react-flow__connection",p])},pe.createElement(I2,{nodeId:a,handleType:i,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function i1(e,t){return x.useRef(null),Wt(),x.useMemo(()=>t(e),[e])}const $2=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:a,onInit:i,onNodeClick:c,onEdgeClick:u,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:_,onSelectionEnd:j,connectionLineType:k,connectionLineStyle:S,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:T,selectionOnDrag:R,selectionMode:I,multiSelectionKeyCode:F,panActivationKeyCode:W,zoomActivationKeyCode:O,deleteKeyCode:B,onlyRenderVisibleElements:Z,elementsSelectable:Q,selectNodesOnDrag:M,defaultViewport:K,translateExtent:G,minZoom:P,maxZoom:H,preventScrolling:L,defaultMarkerColor:U,zoomOnScroll:$,zoomOnPinch:V,panOnScroll:he,panOnScrollSpeed:Y,panOnScrollMode:J,zoomOnDoubleClick:z,panOnDrag:re,onPaneClick:le,onPaneMouseEnter:me,onPaneMouseMove:ge,onPaneMouseLeave:Me,onPaneScroll:qe,onPaneContextMenu:Ve,onEdgeContextMenu:Ue,onEdgeMouseEnter:Se,onEdgeMouseMove:Qe,onEdgeMouseLeave:Ne,onReconnect:_e,onReconnectStart:ue,onReconnectEnd:je,reconnectRadius:Ce,noDragClassName:Fe,noWheelClassName:We,noPanClassName:He,elevateEdgesOnSelect:ot,disableKeyboardA11y:wt,nodeOrigin:ut,nodeExtent:ee,rfId:ke})=>{const Be=i1(e,eP),et=i1(t,iP);return _P(i),pe.createElement(Q4,{onPaneClick:le,onPaneMouseEnter:me,onPaneMouseMove:ge,onPaneMouseLeave:Me,onPaneContextMenu:Ve,onPaneScroll:qe,deleteKeyCode:B,selectionKeyCode:T,selectionOnDrag:R,selectionMode:I,onSelectionStart:_,onSelectionEnd:j,multiSelectionKeyCode:F,panActivationKeyCode:W,zoomActivationKeyCode:O,elementsSelectable:Q,onMove:n,onMoveStart:s,onMoveEnd:a,zoomOnScroll:$,zoomOnPinch:V,zoomOnDoubleClick:z,panOnScroll:he,panOnScrollSpeed:Y,panOnScrollMode:J,panOnDrag:re,defaultViewport:K,translateExtent:G,minZoom:P,maxZoom:H,onSelectionContextMenu:N,preventScrolling:L,noDragClassName:Fe,noWheelClassName:We,noPanClassName:He,disableKeyboardA11y:wt},pe.createElement(kP,null,pe.createElement(xP,{edgeTypes:et,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:Z,onEdgeContextMenu:Ue,onEdgeMouseEnter:Se,onEdgeMouseMove:Qe,onEdgeMouseLeave:Ne,onReconnect:_e,onReconnectStart:ue,onReconnectEnd:je,reconnectRadius:Ce,defaultMarkerColor:U,noPanClassName:He,elevateEdgesOnSelect:!!ot,disableKeyboardA11y:wt,rfId:ke},pe.createElement(jP,{style:S,type:k,component:E,containerStyle:C})),pe.createElement("div",{className:"react-flow__edgelabel-renderer"}),pe.createElement(rP,{nodeTypes:Be,onNodeClick:c,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:M,onlyRenderVisibleElements:Z,noPanClassName:He,noDragClassName:Fe,disableKeyboardA11y:wt,nodeOrigin:ut,nodeExtent:ee,rfId:ke})))};$2.displayName="GraphView";var EP=x.memo($2);const nx=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Qs={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:nx,nodeExtent:nx,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:co.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:e4,isValidConnection:void 0},CP=()=>mI((e,t)=>({...Qs,setNodes:n=>{const{nodeInternals:s,nodeOrigin:a,elevateNodesOnSelect:i}=t();e({nodeInternals:tp(n,s,a,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:s={}}=t();e({edges:n.map(a=>({...s,...a}))})},setDefaultNodesAndEdges:(n,s)=>{const a=typeof n<"u",i=typeof s<"u",c=a?tp(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:c,edges:i?s:[],hasDefaultNodes:a,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:a,fitViewOnInit:i,fitViewOnInitDone:c,fitViewOnInitOptions:u,domNode:f,nodeOrigin:p}=t(),h=f==null?void 0:f.querySelector(".react-flow__viewport");if(!h)return;const m=window.getComputedStyle(h),{m22:y}=new window.DOMMatrixReadOnly(m.transform),w=n.reduce((_,j)=>{const k=a.get(j.id);if(k!=null&&k.hidden)a.set(k.id,{...k,[Lt]:{...k[Lt],handleBounds:void 0}});else if(k){const S=Cx(j.nodeElement);!!(S.width&&S.height&&(k.width!==S.width||k.height!==S.height||j.forceUpdate))&&(a.set(k.id,{...k,[Lt]:{...k[Lt],handleBounds:{source:e1(".source",j.nodeElement,y,p),target:e1(".target",j.nodeElement,y,p)}},...S}),_.push({id:k.id,type:"dimensions",dimensions:S}))}return _},[]);k2(a,p);const N=c||i&&!c&&_2(t,{initial:!0,...u});e({nodeInternals:new Map(a),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(s==null||s(w))},updateNodePositions:(n,s=!0,a=!1)=>{const{triggerNodeChanges:i}=t(),c=n.map(u=>{const f={id:u.id,type:"position",dragging:a};return s&&(f.positionAbsolute=u.positionAbsolute,f.position=u.position),f});i(c)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:a,hasDefaultNodes:i,nodeOrigin:c,getNodes:u,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(i){const p=U4(n,u()),h=tp(p,a,c,f);e({nodeInternals:h})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let c,u=null;s?c=n.map(f=>na(f,!0)):(c=Si(i(),n),u=Si(a,[])),Zu({changedNodes:c,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let c,u=null;s?c=n.map(f=>na(f,!0)):(c=Si(a,n),u=Si(i(),[])),Zu({changedNodes:u,changedEdges:c,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:a,getNodes:i}=t(),c=n||i(),u=s||a,f=c.map(h=>(h.selected=!1,na(h.id,!1))),p=u.map(h=>na(h.id,!1));Zu({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:a}=t();s==null||s.scaleExtent([n,a]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:a}=t();s==null||s.scaleExtent([a,n]),e({maxZoom:n})},setTranslateExtent:n=>{var s;(s=t().d3Zoom)==null||s.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:s}=t(),i=s().filter(u=>u.selected).map(u=>na(u.id,!1)),c=n.filter(u=>u.selected).map(u=>na(u.id,!1));Zu({changedNodes:i,changedEdges:c,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(a=>{a.positionAbsolute=Tx(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:a,height:i,d3Zoom:c,d3Selection:u,translateExtent:f}=t();if(!c||!u||!n.x&&!n.y)return!1;const p=ws.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),h=[[0,0],[a,i]],m=c==null?void 0:c.constrain()(p,h,f);return c.transform(u,m),s[0]!==m.x||s[1]!==m.y||s[2]!==m.k},cancelConnection:()=>e({connectionNodeId:Qs.connectionNodeId,connectionHandleId:Qs.connectionHandleId,connectionHandleType:Qs.connectionHandleType,connectionStatus:Qs.connectionStatus,connectionStartHandle:Qs.connectionStartHandle,connectionEndHandle:Qs.connectionEndHandle}),reset:()=>e({...Qs})}),Object.is),Dx=({children:e})=>{const t=x.useRef(null);return t.current||(t.current=CP()),pe.createElement(V3,{value:t.current},e)};Dx.displayName="ReactFlowProvider";const O2=({children:e})=>x.useContext(Xd)?pe.createElement(pe.Fragment,null,e):pe.createElement(Dx,null,e);O2.displayName="ReactFlowWrapper";const TP={input:m2,default:ex,output:y2,group:Px},AP={default:Md,straight:Mx,step:Rx,smoothstep:Zd,simplebezier:Ax},RP=[0,0],MP=[15,15],IP={x:0,y:0,zoom:1},$P={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},P2=x.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:a,nodeTypes:i=TP,edgeTypes:c=AP,onNodeClick:u,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:j,onClickConnectEnd:k,onNodeMouseEnter:S,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,onNodeDragStart:I,onNodeDrag:F,onNodeDragStop:W,onNodesDelete:O,onEdgesDelete:B,onSelectionChange:Z,onSelectionDragStart:Q,onSelectionDrag:M,onSelectionDragStop:K,onSelectionContextMenu:G,onSelectionStart:P,onSelectionEnd:H,connectionMode:L=co.Strict,connectionLineType:U=ra.Bezier,connectionLineStyle:$,connectionLineComponent:V,connectionLineContainerStyle:he,deleteKeyCode:Y="Backspace",selectionKeyCode:J="Shift",selectionOnDrag:z=!1,selectionMode:re=hc.Full,panActivationKeyCode:le="Space",multiSelectionKeyCode:me=Ad()?"Meta":"Control",zoomActivationKeyCode:ge=Ad()?"Meta":"Control",snapToGrid:Me=!1,snapGrid:qe=MP,onlyRenderVisibleElements:Ve=!1,selectNodesOnDrag:Ue=!0,nodesDraggable:Se,nodesConnectable:Qe,nodesFocusable:Ne,nodeOrigin:_e=RP,edgesFocusable:ue,edgesUpdatable:je,elementsSelectable:Ce,defaultViewport:Fe=IP,minZoom:We=.5,maxZoom:He=2,translateExtent:ot=nx,preventScrolling:wt=!0,nodeExtent:ut,defaultMarkerColor:ee="#b1b1b7",zoomOnScroll:ke=!0,zoomOnPinch:Be=!0,panOnScroll:et=!1,panOnScrollSpeed:ht=.5,panOnScrollMode:Je=ao.Free,zoomOnDoubleClick:tt=!0,panOnDrag:it=!0,onPaneClick:bt,onPaneMouseEnter:nt,onPaneMouseMove:pt,onPaneMouseLeave:fe,onPaneScroll:lt,onPaneContextMenu:vt,children:Gt,onEdgeContextMenu:Dt,onEdgeDoubleClick:Gn,onEdgeMouseEnter:It,onEdgeMouseMove:Vn,onEdgeMouseLeave:Yn,onEdgeUpdate:qt,onEdgeUpdateStart:Kn,onEdgeUpdateEnd:te,onReconnect:Ae,onReconnectStart:Oe,onReconnectEnd:Re,reconnectRadius:Le=10,edgeUpdaterRadius:ct=10,onNodesChange:Ct,onEdgesChange:yt,noDragClassName:Zr="nodrag",noWheelClassName:kt="nowheel",noPanClassName:Jt="nopan",fitView:rn=!1,fitViewOptions:$r,connectOnClick:ko=!0,attributionPosition:Ki,proOptions:ua,defaultEdgeOptions:da,elevateNodesOnSelect:ha=!0,elevateEdgesOnSelect:_s=!1,disableKeyboardA11y:fa=!1,autoPanOnConnect:pa=!0,autoPanOnNodeDrag:St=!0,connectionRadius:Xi=20,isValidConnection:Ns,onError:_o,style:Or,id:ma,nodeDragThreshold:No,...dr},vn)=>{const Pr=ma||"1";return pe.createElement("div",{...dr,style:{...Or,...$P},ref:vn,className:un(["react-flow",a]),"data-testid":"rf__wrapper",id:ma},pe.createElement(O2,null,pe.createElement(EP,{onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:S,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,nodeTypes:i,edgeTypes:c,connectionLineType:U,connectionLineStyle:$,connectionLineComponent:V,connectionLineContainerStyle:he,selectionKeyCode:J,selectionOnDrag:z,selectionMode:re,deleteKeyCode:Y,multiSelectionKeyCode:me,panActivationKeyCode:le,zoomActivationKeyCode:ge,onlyRenderVisibleElements:Ve,selectNodesOnDrag:Ue,defaultViewport:Fe,translateExtent:ot,minZoom:We,maxZoom:He,preventScrolling:wt,zoomOnScroll:ke,zoomOnPinch:Be,zoomOnDoubleClick:tt,panOnScroll:et,panOnScrollSpeed:ht,panOnScrollMode:Je,panOnDrag:it,onPaneClick:bt,onPaneMouseEnter:nt,onPaneMouseMove:pt,onPaneMouseLeave:fe,onPaneScroll:lt,onPaneContextMenu:vt,onSelectionContextMenu:G,onSelectionStart:P,onSelectionEnd:H,onEdgeContextMenu:Dt,onEdgeDoubleClick:Gn,onEdgeMouseEnter:It,onEdgeMouseMove:Vn,onEdgeMouseLeave:Yn,onReconnect:Ae??qt,onReconnectStart:Oe??Kn,onReconnectEnd:Re??te,reconnectRadius:Le??ct,defaultMarkerColor:ee,noDragClassName:Zr,noWheelClassName:kt,noPanClassName:Jt,elevateEdgesOnSelect:_s,rfId:Pr,disableKeyboardA11y:fa,nodeOrigin:_e,nodeExtent:ut}),pe.createElement(_4,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:j,onClickConnectEnd:k,nodesDraggable:Se,nodesConnectable:Qe,nodesFocusable:Ne,edgesFocusable:ue,edgesUpdatable:je,elementsSelectable:Ce,elevateNodesOnSelect:ha,minZoom:We,maxZoom:He,nodeExtent:ut,onNodesChange:Ct,onEdgesChange:yt,snapToGrid:Me,snapGrid:qe,connectionMode:L,translateExtent:ot,connectOnClick:ko,defaultEdgeOptions:da,fitView:rn,fitViewOptions:$r,onNodesDelete:O,onEdgesDelete:B,onNodeDragStart:I,onNodeDrag:F,onNodeDragStop:W,onSelectionDrag:M,onSelectionDragStart:Q,onSelectionDragStop:K,noPanClassName:Jt,nodeOrigin:_e,rfId:Pr,autoPanOnConnect:pa,autoPanOnNodeDrag:St,onError:_o,connectionRadius:Xi,isValidConnection:Ns,nodeDragThreshold:No}),pe.createElement(b4,{onSelectionChange:Z}),Gt,pe.createElement(K3,{proOptions:ua,position:Ki}),pe.createElement(C4,{rfId:Pr,disableKeyboardA11y:fa})))});P2.displayName="ReactFlow";const OP=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function L2(){return gt(OP,Qt)}const D2=({id:e,x:t,y:n,width:s,height:a,style:i,color:c,strokeColor:u,strokeWidth:f,className:p,borderRadius:h,shapeRendering:m,onClick:y,selected:w})=>{const{background:N,backgroundColor:_}=i||{},j=c||N||_;return pe.createElement("rect",{className:un(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:h,ry:h,width:s,height:a,fill:j,stroke:u,strokeWidth:f,shapeRendering:m,onClick:y?k=>y(k,e):void 0})};D2.displayName="MiniMapNode";var PP=x.memo(D2);const LP=e=>e.nodeOrigin,DP=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),ap=e=>e instanceof Function?e:()=>e;function qP({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:i=PP,onClick:c}){const u=gt(DP,Qt),f=gt(LP),p=ap(t),h=ap(e),m=ap(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return pe.createElement(pe.Fragment,null,u.map(w=>{const{x:N,y:_}=io(w,f).positionAbsolute;return pe.createElement(i,{key:w.id,x:N,y:_,width:w.width,height:w.height,style:w.style,selected:w.selected,className:m(w),color:p(w),borderRadius:s,strokeColor:h(w),strokeWidth:a,shapeRendering:y,onClick:c,id:w.id})}))}var FP=x.memo(qP);const BP=200,zP=150,UP=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?Q3(Qd(t,e.nodeOrigin),n):n,rfId:e.rfId}},WP="react-flow__minimap-desc";function q2({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:a="",nodeBorderRadius:i=5,nodeStrokeWidth:c=2,nodeComponent:u,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:_=!1,ariaLabel:j="React Flow mini map",inversePan:k=!1,zoomStep:S=10,offsetScale:E=5}){const C=Wt(),T=x.useRef(null),{boundingRect:R,viewBB:I,rfId:F}=gt(UP,Qt),W=(e==null?void 0:e.width)??BP,O=(e==null?void 0:e.height)??zP,B=R.width/W,Z=R.height/O,Q=Math.max(B,Z),M=Q*W,K=Q*O,G=E*Q,P=R.x-(M-R.width)/2-G,H=R.y-(K-R.height)/2-G,L=M+G*2,U=K+G*2,$=`${WP}-${F}`,V=x.useRef(0);V.current=Q,x.useEffect(()=>{if(T.current){const J=ar(T.current),z=me=>{const{transform:ge,d3Selection:Me,d3Zoom:qe}=C.getState();if(me.sourceEvent.type!=="wheel"||!Me||!qe)return;const Ve=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*S,Ue=ge[2]*Math.pow(2,Ve);qe.scaleTo(Me,Ue)},re=me=>{const{transform:ge,d3Selection:Me,d3Zoom:qe,translateExtent:Ve,width:Ue,height:Se}=C.getState();if(me.sourceEvent.type!=="mousemove"||!Me||!qe)return;const Qe=V.current*Math.max(1,ge[2])*(k?-1:1),Ne={x:ge[0]-me.sourceEvent.movementX*Qe,y:ge[1]-me.sourceEvent.movementY*Qe},_e=[[0,0],[Ue,Se]],ue=ws.translate(Ne.x,Ne.y).scale(ge[2]),je=qe.constrain()(ue,_e,Ve);qe.transform(Me,je)},le=YT().on("zoom",N?re:null).on("zoom.wheel",_?z:null);return J.call(le),()=>{J.on("zoom",null)}}},[N,_,k,S]);const he=y?J=>{const z=jr(J);y(J,{x:z[0],y:z[1]})}:void 0,Y=w?(J,z)=>{const re=C.getState().nodeInternals.get(z);w(J,re)}:void 0;return pe.createElement(Ex,{position:m,style:e,className:un(["react-flow__minimap",t]),"data-testid":"rf__minimap"},pe.createElement("svg",{width:W,height:O,viewBox:`${P} ${H} ${L} ${U}`,role:"img","aria-labelledby":$,ref:T,onClick:he},j&&pe.createElement("title",{id:$},j),pe.createElement(FP,{onClick:Y,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:u}),pe.createElement("path",{className:"react-flow__minimap-mask",d:`M${P-G},${H-G}h${L+G*2}v${U+G*2}h${-L-G*2}z
57
+ M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}q2.displayName="MiniMap";var HP=x.memo(q2);function GP(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},pe.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function VP(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},pe.createElement("path",{d:"M0 0h32v4.2H0z"}))}function YP(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},pe.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 KP(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},pe.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 XP(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},pe.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 sr=({children:e,className:t,...n})=>pe.createElement("button",{type:"button",className:un(["react-flow__controls-button",t]),...n},e);sr.displayName="ControlButton";const ZP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),F2=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:a,onZoomIn:i,onZoomOut:c,onFitView:u,onInteractiveChange:f,className:p,children:h,position:m="bottom-left"})=>{const y=Wt(),[w,N]=x.useState(!1),{isInteractive:_,minZoomReached:j,maxZoomReached:k}=gt(ZP,Qt),{zoomIn:S,zoomOut:E,fitView:C}=Sc();if(x.useEffect(()=>{N(!0)},[]),!w)return null;const T=()=>{S(),i==null||i()},R=()=>{E(),c==null||c()},I=()=>{C(a),u==null||u()},F=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),f==null||f(!_)};return pe.createElement(Ex,{className:un(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},t&&pe.createElement(pe.Fragment,null,pe.createElement(sr,{onClick:T,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},pe.createElement(GP,null)),pe.createElement(sr,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:j},pe.createElement(VP,null))),n&&pe.createElement(sr,{className:"react-flow__controls-fitview",onClick:I,title:"fit view","aria-label":"fit view"},pe.createElement(YP,null)),s&&pe.createElement(sr,{className:"react-flow__controls-interactive",onClick:F,title:"toggle interactivity","aria-label":"toggle interactivity"},_?pe.createElement(XP,null):pe.createElement(KP,null)),h)};F2.displayName="Controls";var QP=x.memo(F2),Tr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Tr||(Tr={}));function JP({color:e,dimensions:t,lineWidth:n}){return pe.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function eL({color:e,radius:t}){return pe.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const tL={[Tr.Dots]:"#91919a",[Tr.Lines]:"#eee",[Tr.Cross]:"#e2e2e2"},nL={[Tr.Dots]:1,[Tr.Lines]:1,[Tr.Cross]:6},rL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function B2({id:e,variant:t=Tr.Dots,gap:n=20,size:s,lineWidth:a=1,offset:i=2,color:c,style:u,className:f}){const p=x.useRef(null),{transform:h,patternId:m}=gt(rL,Qt),y=c||tL[t],w=s||nL[t],N=t===Tr.Dots,_=t===Tr.Cross,j=Array.isArray(n)?n:[n,n],k=[j[0]*h[2]||1,j[1]*h[2]||1],S=w*h[2],E=_?[S,S]:k,C=N?[S/i,S/i]:[E[0]/i,E[1]/i];return pe.createElement("svg",{className:un(["react-flow__background",f]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},pe.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]})`},N?pe.createElement(eL,{color:y,radius:S/i}):pe.createElement(JP,{dimensions:E,color:y,lineWidth:a})),pe.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}B2.displayName="Background";var sL=x.memo(B2);const aL=["us-gov","global","apac","us","eu","jp","au"],oL=new RegExp(`^(?:(?:${aL.join("|")})\\.)?anthropic\\.`,"i");function jc(e){return e.replace(oL,"")}const iL=["command","cmd","file_path","path","url","pattern","notebook_path"],l1=120,op=e=>e.length>l1?`${e.slice(0,l1-1)}…`:e;function lL(e){if(typeof e=="string")return e.trim()?op(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of iL){const s=t[n];if(typeof s=="string"&&s.trim())return op(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(a=>typeof a=="string")){const a=s.join(" ").trim();if(a)return op(a)}}return null}const cL=/^\s*<task-notification>([\s\S]*?)<\/task-notification>/;function c1(e,t){var n;return((n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`).exec(e))==null?void 0:n[1].trim())||void 0}const u1={completed:"background task finished",failed:"background task failed",killed:"background task stopped"};function qx(e){const t=cL.exec(e);if(!t)return null;const n=c1(t[1],"status");return{label:(n&&Object.hasOwn(u1,n)?u1[n]:void 0)??"background task update",detail:c1(t[1],"summary")}}function z2(e){return e.filter(t=>!qx(t.text))}const uL=/[0-9a-f]{16,}/i,dL=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function U2(e){return uL.test(e)||dL.test(e)}function hL(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);for(let n=t.length-1;n>=0;n--)if(!U2(t[n]))return t[n];return t[t.length-1]}function W2(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function Fx(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,s=n.ephemeral_1h_input_tokens,a=n.ephemeral_5m_input_tokens;return typeof s!="number"&&typeof a!="number"?{}:{cacheCreate1hTokens:Number(s??0),cacheCreate5mTokens:Number(a??0)}}function fL(e){const t=Fx(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 pL(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,s]of Object.entries(e))!n||!s||typeof s!="object"||(t[n]=fL(s));return Object.keys(t).length?t:void 0}function H2(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),...Fx(n)};for(const s of Object.values(n)){const a=H2(s,t+1);if(a)return a}return null}const mL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i,gL=new Set(["tool_input","tool_response"]);function G2(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&mL.test(jc(n.model)))return n.model;for(const[s,a]of Object.entries(n)){if(gL.has(s))continue;const i=G2(a,t+1);if(i)return i}return null}function rx(){return{agents:new Map,toolIndex:new Map,activeSubagentStack:new Map,subagentTombstones:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function oa(e){return hL(e)}function d1(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Li(e,t){return`${e}::${t}`}function ia(e,t){return`${e}\0${t}`}function Id(e){const t=e.agent_type??e.subagent_type;return t&&!U2(t)?t:"subagent"}function rc(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function ji(e,t,n,s){const a=t;let i=e.agents.get(a);return i||(i={id:a,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:W2()},e.agents.set(a,i),i)}function V2(e,t,n,s){const a=Li(t,n),i=e.agents.get(a);if(!i)return null;!i.cwd&&s.cwd&&(i.cwd=s.cwd,i.cwdBasename=oa(s.cwd));const c=Id(s);return c&&(i.label==="subagent"||!i.label)&&(i.label=c),i}function yL(e,t,n){const s=t.session_id??"unknown",a=rc(t);if(a){const f=V2(e,s,a,t);if(f)return f}const i=e.activeSubagentStack.get(s),c=i&&i.length>0?i[i.length-1]:null;if(c){const f=e.agents.get(Li(s,c));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=oa(t.cwd)),f}const u=ji(e,s,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=oa(t.cwd)),u.label==="session"&&t.cwd&&(u.label=oa(t.cwd)??"session"),u}function wL(e,t,n,s,a){const i=Li(t,n),c=ji(e,t,a,!0);let u=e.agents.get(i);if(u){!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=oa(s.cwd));const f=Id(s);return f&&(u.label==="subagent"||!u.label)&&(u.label=f),u}return u={id:i,sessionId:t,label:Id(s),kind:"subagent",parentId:c.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:s.cwd,cwdBasename:oa(s.cwd),toolCount:0,childCount:0,usage:W2()},e.agents.set(i,u),c.childCount+=1,u}function vL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function h1(e,t,n){const s=e.activeSubagentStack.get(t);if(s){for(let a=s.length-1;a>=0;a--)if(s[a]===n){s.splice(a,1);break}s.length===0&&e.activeSubagentStack.delete(t)}}function Ju(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 f1=200;function xL(e,t){for(const n of e.values()){const s=n.tools.find(a=>a.id===t);if(s)return s}return null}const bL=25;function kL(e,t){const n=t.tools;if(n.length>f1){const s=n.splice(0,n.length-f1);for(const a of s){const i=ia(t.sessionId,a.id);e.toolIndex.get(i)===a&&e.toolIndex.delete(i)}}for(let s=n.length-bL-1;s>=0;s--){const a=n[s];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function _L(e,t,n){const s=e.toolIndex.get(ia(t.sessionId,n));if(s)return s;for(let a=t.tools.length-1;a>=0;a--)if(t.tools[a].id===n)return t.tools[a];return null}const p1=2e3;function NL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const a=e.prompts[s];if(a.at<t-p1)return!1;if(a.text===n&&a.at<=t+p1)return!0}return!1}const ed=2e3;function SL(e){let t=e.startedAt;for(const n of e.prompts)n.at>t&&(t=n.at);return t}function Y2(e,t){for(const n of t.tools){const s=ia(t.sessionId,n.id);e.toolIndex.get(s)===n&&e.toolIndex.delete(s)}}function Ec(e,t){return t&&(e.revision+=1),t}function jL(e,t,n,s,a){if(e.agents.size<=n)return!1;const i=m=>m.state==="done"&&m.endedAt!=null&&t-m.endedAt>s,c=[],u=new Map;for(const[m,y]of e.agents){if(y.parentId!=null){const w=u.get(y.parentId);w?w.push(m):u.set(y.parentId,[m])}i(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&&(Y2(e,y),e.agents.delete(m),p.add(y.sessionId),f++)};for(const m of c){if(e.agents.size<=n)break;if(!e.agents.has(m.id))continue;const y=(u.get(m.id)??[]).map(w=>e.agents.get(w)).filter(w=>w!=null);if(!y.some(w=>!i(w))){for(const w of y)h(w.id);h(m.id)}}if(a&&p.size>0){const m=new Set;for(const y of e.agents.values())m.add(y.sessionId);for(const y of p)m.has(y)||a(y)}return Ec(e,f>0)}function EL(e,t,n,s,a){const i=new Map;for(const[h,m]of e.agents){let y=i.get(m.sessionId);y||(y={ids:[],endedAt:0,live:!1,closed:!1},i.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=[...i].filter(([,h])=>!h.live&&h.endedAt>0&&t-h.endedAt>s).sort(([,h],[,m])=>h.closed===m.closed?h.endedAt-m.endedAt:h.closed?-1:1);let f=[...i.values()].filter(h=>!h.live).length-n;if(f<=0)return!1;let p=!1;for(const[h,m]of c){if(f<=0)break;for(const y of m.ids){const w=e.agents.get(y);w&&Y2(e,w),e.agents.delete(y)}a==null||a(h),f--,p=!0}return Ec(e,p)}function CL(e,t){const n=t==null?void 0:t.payload,s=n==null?void 0:n.hook_event_name;if(s!=="PostToolUse"&&s!=="PostToolUseFailure")return!1;const a=n==null?void 0:n.tool_use_id;return typeof a!="string"||a.length===0?!1:e.toolIndex.has(ia((n==null?void 0:n.session_id)??"unknown",a))}function TL(e){let t=!1;for(const n of e.agents.values())for(const s of n.tools)s.endedAt!=null||s.outcomeGap||(s.outcomeGap=!0,t=!0);return Ec(e,t)}function AL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.provider==="codex")continue;const i=e.agents.get(a.sessionId),c=(i==null?void 0:i.lastEventAt)??(i==null?void 0:i.startedAt);for(const u of a.tools){const f=Math.max(u.startedAt,c??u.startedAt);u.endedAt==null&&t-f>n&&(u.endedAt=f,u.ok=!1,u.errorPreview=u.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(ia(a.sessionId,u.id)),s=!0)}}return Ec(e,s)}const m1=90*6e4;function RL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.kind!=="root")continue;const i=a.lastEventAt??a.startedAt;if(!(t-i<=n)){a.waiting&&(a.waiting=null,s=!0),a.closedAt==null&&(a.closedAt=i),a.state==="active"&&(a.state="done",a.endedAt=i,a.reaped=!0,s=!0);for(const c of e.agents.values())c.sessionId!==a.sessionId||c.kind==="root"||c.state!=="active"||(c.state="done",c.endedAt=i,s=!0);e.activeSubagentStack.delete(a.sessionId)}}return Ec(e,s)}function ML(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const IL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed","SessionRecapped"]);function $L(e,t){let n=null;for(const s of e.toolIndex.values()){const a=s.agentId?e.agents.get(s.agentId):void 0;!a||a.sessionId!==t||(!n||s.startedAt>n.startedAt)&&(n=s)}return n}const OL=3e4;function PL(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>OL)&&!(e.startedAt>t))return{name:e.name,preview:lL(e.input)??""}}function LL(e,t,n,s,a){if(n!=="permission")return{kind:n,message:s,since:a};const i=$L(e,t),c={kind:n,message:s,since:a};i!=null&&i.explicitSubagentId&&(c.subagentId=i.explicitSubagentId);const u=PL(i,a);return u&&(c.tool=u),c}function DL(e,t,n){if(e.kind==="idle")return!0;const s=rc(t);return s==null?!0:e.subagentId!=null&&Li(n,s)===e.subagentId}function g1(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 s=t.payload??{},a=t.receivedAt,i=s.hook_event_name??"Unknown";if(i==="__clear")return{...rx(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const c=s.session_id??"unknown";if(!IL.has(i)){const h=e.agents.get(c);h!=null&&h.waiting&&DL(h.waiting,s,c)&&(h.waiting=null)}const u=e.agents.get(c);if(u&&a>(u.lastEventAt??0)&&(u.lastEventAt=a,u.reaped&&(u.reaped=!1,u.state="active",u.endedAt=void 0,u.closedAt=void 0)),typeof s.model_context_window=="number"&&s.model_context_window>0){const h=e.agents.get(c);h&&(h.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const h=e.agents.get(c);h&&(h.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const h=e.agents.get(c);h&&(h.context={...h.context??d1(),currentContextTokens:s.context_tokens})}if(i==="ModelObserved"){const h=typeof s.model=="string"?s.model:null;if(h){const y=e.agents.get(c);y&&(y.model=h)}const m=s.subagentModels;if(m&&typeof m=="object")for(const[y,w]of Object.entries(m)){if(typeof w!="string")continue;const N=`${c}::${y}`,_=e.agents.get(N);_&&(_.model=w)}return e}if(i==="ContextObserved"){const h=s.context??null;if(h){const m=e.agents.get(c);if(m){const y=m.context??d1(),w=(_,j)=>typeof h[_]=="number"?h[_]:j,N=Array.isArray(h.memoryFiles)?h.memoryFiles:Array.isArray(h.claudeMdFiles)?h.claudeMdFiles:null;m.context={msgsUser:w("msgsUser",y.msgsUser),msgsAssistant:w("msgsAssistant",y.msgsAssistant),toolUses:w("toolUses",y.toolUses),toolResults:w("toolResults",y.toolResults),systemReminders:w("systemReminders",y.systemReminders),currentContextTokens:w("currentContextTokens",y.currentContextTokens),memoryFiles:N??y.memoryFiles}}}return e}if(i==="SessionNamed"){const h=e.agents.get(c);if(h){const m=typeof s.sessionName=="string"?s.sessionName.trim():"",y=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";m&&(h.sessionName=m),y&&(h.sessionTitle=y);const w=h.sessionName??"";h.sessionTitle&&w&&h.sessionTitle.toLowerCase()===w.toLowerCase()&&(h.sessionTitle=void 0)}return e}if(i==="SessionRecapped"){const h=e.agents.get(c);if(h){const m=s.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(i==="OutputObserved"){const h=s.kind==="thinking"||s.kind==="text"||s.kind==="tool_use"?s.kind:null,m=typeof s.at=="number"&&Number.isFinite(s.at)?s.at:a;if(!h)return e;const y=e.agents.get(c);if(!y||y.lastOutputAt!=null&&m<=y.lastOutputAt)return e;if(y.lastOutputAt=m,h!=="tool_use"){const w=(y.outputs??[]).filter(N=>m-N<qL);w.push(m),y.outputs=w.length>y1?w.slice(-y1):w}return e.revision+=1,e}if(i==="UsageObserved"){const h=s.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=Fx(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=pL(s.usageByModel)}}return e}const f=yL(e,s,a);f.provider||(f.provider=s.provider==="codex"?"codex":"claude");const p=G2(s);switch(p&&(f.model=p),i){case"SessionStart":{const h=ji(e,c,a,!1);h.synthetic=!1,h.state="active",h.closedAt=void 0,h.endedAt=void 0,h.startedAt=Math.min(h.startedAt??a,a),!h.cwd&&s.cwd&&(h.cwd=s.cwd,h.cwdBasename=oa(s.cwd)),h.label==="session"&&s.cwd&&(h.label=oa(s.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===c&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<a&&(y.exitAt=a);const h=ji(e,c,a,!1);h.state="active",h.endedAt=void 0,h.closedAt=void 0,h.exitAt=void 0;const m=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";m&&!NL(h,a,m)&&(h.prompts.push({at:a,text:m}),!h.firstPrompt&&!qx(m)&&(h.firstPrompt=Ju(m,120)));break}case"PreToolUse":{const h=s.tool_use_id?_L(e,f,s.tool_use_id):null;if(h){s.tool_name&&h.name==="?"&&(h.name=s.tool_name),h.endedAt==null&&!h.trimmed&&s.tool_input!==void 0&&(h.input=s.tool_input,h.inputPreview=Ju(s.tool_input));break}const m=s.tool_use_id??`${f.id}:${f.toolCount}`,y=rc(s),w={id:m,name:s.tool_name??"?",input:s.tool_input,inputPreview:Ju(s.tool_input),agentId:f.id,explicitSubagentId:y?Li(c,y):void 0,startedAt:a};f.tools.push(w),f.toolCount+=1,f.state="active",e.toolIndex.set(ia(f.sessionId,m),w),kL(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=s.tool_use_id;if(!h)break;const m=ia(c,h);let y=e.toolIndex.get(m),w=!1;if(!y)for(const _ of e.agents.values()){if(_.sessionId!==c)continue;const j=_.tools.find(k=>k.id===h);if(j){y=j,w=!0;break}}if(!y||y.outcomeApplied)break;y.outcomeApplied=!0,y.outcomeGap=void 0,y.endedAt=a,y.ok=i==="PostToolUse",y.trimmed||(y.response=s.tool_response),i==="PostToolUseFailure"?y.errorPreview=Ju(s.tool_response):w&&(y.errorPreview=void 0);const N=H2(s.tool_response);N&&(y.usage=N),e.toolIndex.delete(m);break}case"SubagentStart":{const h=rc(s);if(!h)break;const m=wL(e,c,h,s,a),y=Id(s);y&&(m.label=y);const w=e.subagentTombstones.get(m.id);w!=null&&e.subagentTombstones.delete(m.id);const N=m.endedAt!=null&&a-m.endedAt<=ed,_=w!=null&&a-w<=ed;if(N||_){const j=_?w:m.endedAt;m.state="done",m.endedAt=j,m.startedAt=Math.min(m.startedAt,j),h1(e,c,h);break}m.state="active",m.startedAt=m.startedAt||a,m.exitAt=void 0,m.endedAt=void 0,vL(e,c,h);break}case"SubagentStop":{const h=rc(s);if(!h)break;const m=V2(e,c,h,s);if(!m){for(const[y,w]of e.subagentTombstones)a-w>ed&&e.subagentTombstones.delete(y);e.subagentTombstones.set(Li(c,h),a);break}m.state="done",m.endedAt=Math.min(m.endedAt??a,a),h1(e,c,h);break}case"Stop":case"SessionEnd":{const h=ji(e,c,a,!1),m=SL(h);if(a<m)break;const y=h.lastTurnEndAt;if(y!=null&&m>y&&a<=y+ed)break;h.state="done",h.endedAt=a,h.lastTurnEndAt=a;for(const w of h.provider==="codex"?[]:e.agents.values())if(w.sessionId===c)for(const N of w.tools)N.endedAt==null&&N.explicitSubagentId==null&&(N.endedAt=a,N.ok=!1,N.errorPreview=N.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"the turn ended before this call returned",e.toolIndex.delete(ia(w.sessionId,N.id)));i==="SessionEnd"&&(h.closedAt=a),e.activeSubagentStack.delete(c);break}case"Notification":{const h=ML(s.notification_type);if(!h)break;const m=ji(e,c,a,!1),y=typeof s.message=="string"?s.message:"",w=m.waiting;m.waiting=w&&w.kind===h&&w.message===y?{...w,since:Math.min(w.since,a)}:LL(e,c,h,y,a);break}}return e}const qL=6e4,y1=64;function $d(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 FL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},BL=[{match:/^claude[-_](fable|mythos)[-_]5[-_.]1\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:.25,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_](fable|mythos)[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_]opus[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]sonnet[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:FL},{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 zL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Ui(e,t=Date.now()){if(!e)return null;const n=jc(e);for(const s of BL)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function K2(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),s=Math.max(0,e.cacheCreate5mTokens??0),a=Math.max(0,e.cacheCreateTokens-n-s),i=s+a,c=t.cacheWrite1h??t.cacheWrite;return{tokens5m:i,tokens1h:n,usd5m:i*t.cacheWrite/1e6,usd1h:n*c/1e6}}function X2(e,t,n=Date.now()){if(!zL(t))return e.inputTokens;const s=Ui(t,n),a=((s==null?void 0:s.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-a)}function Bx(e,t,n=Date.now()){const s=Ui(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=X2(e,t,n)*s.input/1e6,i=e.outputTokens*s.output/1e6,c=e.cacheReadTokens*s.cacheRead/1e6,u=K2(e,s),f=u.usd5m+u.usd1h;return{input:a,output:i,cacheRead:c,cacheWrite:f,total:a+i+c+f}}const w1=2e5,UL=1e6,WL=[/\[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],HL=[{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 GL(e){if(!e)return w1;const t=jc(e);for(const n of WL)if(n.test(t))return UL;for(const n of HL)if(n.match.test(t))return n.window;return w1}function Z2(e,t){return typeof e=="number"&&e>0?e:GL(t)}const Ni="not priced";function Nt(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const t=(e*100).toFixed(e<.1?1:0);if(Number(t)<100)return`${t}¢`}return e<100?`$${e.toFixed(2)}`:e<1e4?`$${e.toFixed(0)}`:`$${(e/1e3).toFixed(1)}k`}function zx(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${Nt(s)}/min`:`${Nt(n*3600)}/hr`}function VL(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 YL(e,t){let n=0,s=0,a=0,i=0,c=0,u=0;for(const m of t)n+=m.inputTokens,s+=m.outputTokens,a+=m.cacheReadTokens,i+=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,s),cacheReadTokens:f(e.cacheReadTokens,a),cacheCreateTokens:f(e.cacheCreateTokens,i)};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 Cc(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const s=n.map(i=>({model:i,usage:t[i]})),a=YL(e.usage,s.map(i=>i.usage));if(a){const i=s.findIndex(c=>c.model===e.model);i>=0?s[i]={model:s[i].model,usage:VL(s[i].usage,a)}:s.push({model:e.model,usage:a})}return s}function Hn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of Cc(e)){const a=Bx(s.usage,s.model,t);n.input+=a.input,n.output+=a.output,n.cacheRead+=a.cacheRead,n.cacheWrite+=a.cacheWrite,n.total+=a.total}return n}function Od(e,t=Date.now()){let n=0;for(const s of Cc(e))Ui(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function Q2(e){const t=[];for(const n of Cc(e)){if(!n.model||t.includes(n.model))continue;const s=n.usage;s.inputTokens+s.outputTokens+s.cacheReadTokens+s.cacheCreateTokens<=0||t.push(n.model)}return t}function J2(e){return Q2(e).filter(t=>t!==e.model)}const KL=new Set(["untrusted","on-request","on-failure"]);function XL(e){return typeof e!="string"||!e?null:KL.has(e)?!0:e==="never"?!1:null}function ZL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=XL(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 v1(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function ho(e){const t=jc(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const a=v1(n[1]),i=n[2].replace(/[-_]/g,".");return`${a} ${i}`}const s=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(s){const a=s[1].replace(/[-_]/g,"."),i=s[2].split(/[-_]/).filter(Boolean).map(v1);return[`GPT-${a}`,...i].join(" ")}return e}function Jd(e){const t=jc(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function go(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function ip(e){const t=[];for(const n of e)n.kind==="root"&&go(n.waiting)&&t.push({id:n.id,label:n.label,waiting:n.waiting});return t.sort((n,s)=>n.waiting.since-s.waiting.since)}function QL(e,t){if(e.length===0)return null;const n=e.findIndex(s=>s.id===t);return e[(n+1)%e.length]}function JL(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function eh(e,t){return`${e}@${t.since}`}function eA(e,t){if(!e.tool)return null;const{name:n,preview:s}=e.tool,a=new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(t);return s?a?s:`${n} · ${s}`:a?null:n}function e5(e){const t=e.message||"Needs your permission",n=eA(e,t);return n?`${t}
60
+ Likely on: ${n}`:t}function t5(e,t,n,s=!0){if(!s)return[];if(n)return[];const a=[];for(const i of e){if(!go(i.waiting))continue;const c=eh(i.id,i.waiting);t.has(c)||a.push({key:c,title:i.label,body:e5(i.waiting),sessionId:i.id})}return a}function n5(e,t,n){const s=new Set;for(const i of e)s.add(eh(i.id,i.waiting));const a=new Set;for(const i of n)s.has(i)&&a.add(i);for(const i of t)a.add(i.key);return a}function lp(e){return new Set(e.map(t=>eh(t.id,t.waiting)))}function r5(e,t){return e!==t}function s5(e,t){return!e&&t!=null}function a5(e,t){return e!==null&&t!=null}function wn(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 Pd(e,t,n){const s=(t??n)-e;if(s<1e3)return`${Math.max(0,s)}ms`;const a=Math.floor(s/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60),c=a%60;return`${i}m ${String(c).padStart(2,"0")}s`}function tA(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 nA(e,t){const n=typeof e=="string"?e.trim():"",s=typeof t=="string"?t.trim():"";return{face:n||s||void 0,tooltip:s||n||void 0}}const o5=1;function i5(){const e=[];let t=0;function n(){let s;for(const a of e)(!s||a.layer>s.layer||a.layer===s.layer&&a.seq>s.seq)&&(s=a);return s}return{push(s,a=0){const i={dismiss:s,layer:a,seq:t++};return e.push(i),()=>{const c=e.indexOf(i);c!==-1&&e.splice(c,1)}},dismissTop(){const s=n();return s?(s.dismiss(),!0):!1},isTop(s){const a=n();return a!=null&&a.dismiss===s},depth(){return e.length}}}const Ld=i5();function l5(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function x1(e){return String(e.tagName??"").toUpperCase()==="BODY"}function c5(e,t){return!e||!e.isConnected||x1(e)?!1:t==null||x1(t)}const b1="a[href], button, input, select, textarea, [tabindex]";function u5(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function d5(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function h5({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 th(e){return e.ctrlKey||e.metaKey||e.altKey}const f5=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),p5=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),m5=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function Ux(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function g5(e){return Ux(e)==="BUTTON"?!0:(typeof e.role=="string"?e.role.trim().toLowerCase():"").split(/\s+/).includes("button")}function Wx(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=Ux(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!f5.has(String(e.type??"text").toLowerCase())}function y5(e,t){if(!e)return!1;if(Wx(e))return!0;if(t!=null&&t.length===1&&t!==" "&&e.pointerFocused&&g5(e))return!1;if(p5.has(Ux(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(s=>m5.has(s))}function w5({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function rA(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(b1))return u5({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&d5({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(b1)!=null})}):[]}function v5(e,t){const n=rA(e);if(!t||!e.contains(t)||n.includes(t))return n;const s=n.findIndex(a=>(t.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return s===-1?[...n,t]:[...n.slice(0,s),t,...n.slice(s)]}function dn(e,t={}){const{focusRef:n,layer:s}=t,a=x.useRef(null),i=x.useRef(e);i.current=e;const c=x.useRef(null);c.current===null&&(c.current=()=>i.current());const u=c.current;return x.useEffect(()=>Ld.push(u,s),[u,s]),x.useEffect(()=>{var p;const f=document.activeElement;return(p=(n==null?void 0:n.current)??rA(a.current)[0])==null||p.focus(),()=>{c5(f,document.activeElement)&&f.focus()}},[]),x.useEffect(()=>{const f=p=>{var _;if(p.key!=="Tab"||th(p))return;const h=a.current;if(!h)return;const m=document.activeElement;if(!(m!=null&&h.contains(m))&&!Ld.isTop(u))return;const w=v5(h,m),N=h5({count:w.length,index:m?w.indexOf(m):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((_=w[N.index])==null||_.focus()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[u]),a}function x5(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 rr(e){return e.toLocaleString()}function b5(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const k5=60;function _5(e,t=k5){if(e.length<=t)return e;const n=e.slice(e.length-(t-1)),s=n.search(/[/\\]/);return"…"+(s===-1?n:n.slice(s))}function N5({agent:e,onClose:t}){var y;const n=x.useRef(null),s=dn(t,{focusRef:n}),a=e.context,i=e.usage,c=(a==null?void 0:a.currentContextTokens)??0,u=Z2(e.contextWindow,e.model),f=Math.min(100,c/u*100),p=Hn(e),h=e.provider==="codex"?i.inputTokens+i.outputTokens:i.inputTokens+i.outputTokens+i.cacheReadTokens+i.cacheCreateTokens,m=x5(e.provider);return l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:s,className:"modal ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[l.jsxs("header",{className:"ctx-modal-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),l.jsx("div",{className:"ctx-modal-sub",children:m.subtitle})]}),l.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),l.jsxs("section",{className:"ctx-window-row",children:[l.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f),children:l.jsx("div",{className:"ctx-window-fill",style:{transform:`scaleX(${Math.min(100,Math.max(0,f))/100})`}})}),l.jsxs("div",{className:"ctx-window-meta",children:[l.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),l.jsxs("span",{children:[rr(c)," / ",rr(u)," tok (",m.windowScope,")"]})]})]}),l.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),l.jsxs("div",{className:"ctx-grid",children:[l.jsx(Sr,{label:"input tokens",val:rr(i.inputTokens)}),l.jsx(Sr,{label:"output tokens",val:rr(i.outputTokens)}),l.jsx(Sr,{label:"cache reads",val:rr(i.cacheReadTokens)}),l.jsx(Sr,{label:"cache writes",val:rr(i.cacheCreateTokens)}),l.jsx(Sr,{label:"cumulative total",val:rr(h)}),l.jsx(Sr,{label:"estimated cost",val:Nt(p.total),accent:!0})]}),l.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),m.compositionCounted?l.jsxs("div",{className:"ctx-grid",children:[l.jsx(Sr,{label:"user messages",val:rr((a==null?void 0:a.msgsUser)??0)}),l.jsx(Sr,{label:"assistant messages",val:rr((a==null?void 0:a.msgsAssistant)??0)}),l.jsx(Sr,{label:"tool uses",val:rr((a==null?void 0:a.toolUses)??0)}),l.jsx(Sr,{label:"tool results",val:rr((a==null?void 0:a.toolResults)??0)}),l.jsx(Sr,{label:"system-reminders",val:rr((a==null?void 0:a.systemReminders)??0)})]}):l.jsx("div",{className:"ctx-empty",children:m.compositionUncounted}),l.jsx("h3",{className:"ctx-section-title",children:m.memoryHeading}),(((y=a==null?void 0:a.memoryFiles)==null?void 0:y.length)??0)===0?l.jsx("div",{className:"ctx-empty",children:m.memoryEmpty}):l.jsx("ul",{className:"ctx-md-list",children:a.memoryFiles.map(w=>l.jsxs("li",{children:[l.jsx("span",{className:"ctx-md-path",title:w.path,children:_5(w.path)}),l.jsx("span",{className:"ctx-md-size",children:b5(w.bytes)})]},w.path))})]})})}function Sr({label:e,val:t,accent:n}){return l.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[l.jsx("span",{className:"ctx-row-label",children:e}),l.jsx("span",{className:"ctx-row-val",children:t})]})}function S5({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:a}){const i=Z2(n,t),c=Math.min(1,e/i),u=s/2-3,f=s/2,p=2*Math.PI*u,h=p*c,m=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return l.jsx("button",{type:"button",className:"ctx-donut",onClick:a,title:`context: ${e.toLocaleString()} / ${i.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":`Context ${Math.round(c*100)}% of ${i.toLocaleString()} tokens — show breakdown`,children:l.jsxs("svg",{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[l.jsx("circle",{cx:f,cy:f,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),l.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)"}}),l.jsx("text",{x:f,y:f+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}const k1=new Map;function sA(e){let t=k1.get(e);return t||(t={now:Date.now(),listeners:new Set,timer:null},k1.set(e,t)),t}function j5(e,t){const n=sA(e);return n.listeners.add(t),n.timer===null&&(n.now=Date.now(),n.timer=setInterval(()=>{n.now=Date.now();for(const s of n.listeners)s()},e)),()=>{n.listeners.delete(t),n.listeners.size===0&&n.timer!==null&&(clearInterval(n.timer),n.timer=null)}}function E5(e){return sA(e).now}const _1=new Map,N1=new Map;function nh(e=1e3){let t=_1.get(e);t||(t=s=>j5(e,s),_1.set(e,t));let n=N1.get(e);return n||(n=()=>E5(e),N1.set(e,n)),x.useSyncExternalStore(t,n,n)}function rh(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 C5="1",S1="agent-dag.schema",T5=["agent-dag.layout","agent-dag.viewport"];function yo(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function A5(e,t=C5){let n=null;try{n=e.getItem(S1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const a of T5)try{e.getItem(a)!==null&&(e.removeItem(a),s.push(a))}catch{}try{e.setItem(S1,t)}catch{}return s}const aA="agent-dag.recapsDismissed",j1=200;function R5(){const e=yo(aA);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}let Di=new Set(R5());const sx=new Set;let oA=0;function iA(e){return sx.add(e),()=>{sx.delete(e)}}function lA(e){if(Di=e,oA++,typeof window<"u")try{const t=Array.from(e);window.localStorage.setItem(aA,JSON.stringify(t.length>j1?t.slice(-j1):t))}catch{}for(const t of sx)t()}function cA(e,t){return`${e}@${t}`}function M5(e){return Di.has(e)}function I5(e){if(Di.has(e))return;const t=new Set(Di);t.add(e),lA(t)}function $5(e){const t=new Set(Di);t.delete(e)||t.add(e),lA(t)}function O5(e){return x.useSyncExternalStore(iA,()=>e!=null&&Di.has(e),()=>!1)}function Hx(e){return`recap:${e}`}function P5(e){return e.startsWith("recap:")}function L5(){return x.useSyncExternalStore(iA,()=>oA,()=>0)}function E1(e,t){const n=Ui(t);if(!n)return`model: ${t}
61
+ no published rate in this build — the tokens are counted, the dollars are not`;const s=h=>h.toLocaleString(),a=h=>`$${h}/MTok`,i=Bx(e,t),c=K2(e,n),u=c.tokens1h>0?[`cache w5m${s(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${Nt(c.usd5m)}`,`cache w1h${s(c.tokens1h).padStart(14)} × ${a(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${Nt(c.usd1h)}`]:[`cache w ${s(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${Nt(c.usd5m)}`],f=X2(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(f).padStart(14)} × ${a(n.input).padEnd(11)} = ${Nt(i.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${a(n.output).padEnd(11)} = ${Nt(i.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${a(n.cacheRead).padEnd(11)} = ${Nt(i.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${Nt(i.total)}`].join(`
62
+ `)}function C1(e){const t=Cc(e);return t.length<=1?E1(e.usage,e.model):[...t.map(n=>E1(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${Nt(Hn(e).total)}`].join(`
63
+ `)}function D5({data:e,selected:t}){var j,k;const n=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),s=e.tools.filter(S=>!S.endedAt).length,a=e.tools.filter(S=>S.ok===!1).length,i=$d(e.sessionId),c=((j=e.context)==null?void 0:j.currentContextTokens)??0,u=e.kind==="root"&&c>0,f=e.sessionTitle?e.cwd?`${e.cwd}
64
+ ${e.sessionTitle}`:e.sessionTitle:e.cwd,p=J2(e),h=p.length>0?`${e.model}
65
+ spend on this card also covers:
66
+ ${p.join(`
67
+ `)}`:e.model,m=nA(e.sessionName,e.sessionTitle),y=rh(e),w=y?cA(e.sessionId,y.at):null,N=O5(w),_=y!=null&&!N;return l.jsxs("div",{className:n,style:{"--session-hue":i},children:[l.jsx("span",{className:"accent-stripe"}),l.jsx(uo,{type:"target",position:ze.Left,style:{background:"transparent",border:"none"}}),l.jsxs("div",{className:"head",children:[l.jsxs("div",{className:"title",children:[l.jsx(B5,{state:e.state}),l.jsx("span",{className:"label",title:f,children:e.label}),e.synthetic&&l.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"}),y&&w&&l.jsx("button",{type:"button",className:"glyph-btn recap-pin","aria-label":"Claude Code's recap","aria-expanded":_,title:_?"Hide the recap":"Show Claude Code's recap",onClick:S=>{S.stopPropagation(),$5(w)},children:l.jsx(Gx,{})})]}),l.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&l.jsx(S5,{currentContextTokens:c,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),l.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?"≥ ":"",l.jsx(F5,{start:e.startedAt,end:e.endedAt})]})]})]}),l.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&l.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?l.jsxs("span",{className:"model-chip","data-family":Jd(e.model),title:h,children:[ho(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?l.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&m.face&&l.jsx("div",{className:"session-name",title:m.tooltip,children:m.face}),e.waiting&&l.jsx(H5,{waiting:e.waiting}),(()=>{const S=ZL(e);return S?l.jsxs("div",{className:"approval-blind-row",title:S.detail,children:[l.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),l.jsx("span",{className:"approval-blind-said",children:S.label})]}):null})(),(e.tools.length>0||(((k=e.outputs)==null?void 0:k.length)??0)>0)&&l.jsx(G5,{tools:e.tools,outputs:e.outputs}),l.jsxs("div",{className:"meta",children:[l.jsxs("span",{children:[l.jsx("b",{children:e.toolCount})," tools"]}),a>0&&l.jsxs("span",{className:"failed-meta",title:`${a} tool ${a===1?"call":"calls"} returned an error`,children:[l.jsx("b",{children:a})," err"]}),s>0&&l.jsxs("span",{className:"inflight-meta",children:[l.jsx("b",{children:s})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&l.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:[l.jsx("b",{children:wn(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const S=Ui(e.model),E=Hn(e),C=Od(e);if(!S&&E.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:l.jsx("span",{className:"cost-unpriced",title:C1(e),children:Ni});if(E.total<=0)return null;const T=Math.max(0,((e.endedAt??Date.now())-e.startedAt)/1e3),R=e.state==="active"&&!e.synthetic?zx(E.total,T):null,I=C1(e)+(R?`
68
+ burn: ${R}`:"");return l.jsx("span",{className:"cost-meta",title:I,children:l.jsxs("b",{children:[Nt(E.total),C>0?"+":""]})})})()]}),l.jsx(uo,{type:"source",position:ze.Right,style:{background:"transparent",border:"none"}})]})}const q5=x.memo(D5);function F5({start:e,end:t}){const n=nh(1e3);return l.jsx(l.Fragment,{children:Pd(e,t,n)})}function pc(e){return e==="active"?"live":e==="done"?"done":"err"}function B5({state:e}){return l.jsx("span",{className:`state-pill state-${e}`,children:pc(e)})}function qi(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function z5(e,t=Date.now()){const n=e.tools.filter(a=>a.ok===!1).length,s=Hn(e,t).total;return[e.label,e.kind==="root"?"session":"subagent",pc(e.state),go(e.waiting)?qi(e.waiting):null,e.model?ho(e.model):null,`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,n>0?`${n} failed`:null,s>0?`${Nt(s)}${Od(e,t)>0?"+":""}`:null].filter(Boolean).join(", ")}function U5(e,t){const n=eA(e,t);return n?`Likely on: ${n}`:null}function W5(e){return e.kind==="idle"?"Your turn":qi(e)}function H5({waiting:e}){const t=nh(1e3),n=go(e),s=qi(e);return l.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
69
+ Blocked for ${Pd(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?l.jsx("span",{className:"ap-pulse","aria-hidden":!0}):l.jsx("span",{className:"waiting-dot","aria-hidden":!0}),l.jsx("span",{className:"waiting-said",children:W5(e)}),l.jsx("b",{children:Pd(e.since,void 0,t)})]})}function Gx(){return l.jsxs("svg",{className:"recap-glyph",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true",focusable:"false",children:[l.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"}),l.jsx("circle",{cx:"6",cy:"1.2",r:"1.05",fill:"currentColor"}),l.jsx("circle",{cx:"6",cy:"10.8",r:"1.05",fill:"currentColor"}),l.jsx("circle",{cx:"1.2",cy:"6",r:"1.05",fill:"currentColor"}),l.jsx("circle",{cx:"10.8",cy:"6",r:"1.05",fill:"currentColor"})]})}function G5({tools:e,outputs:t}){const n=nh(1e3),s=6e4,a=24,i=s/a,c=new Array(a).fill(0);let u=0;const f=E=>{const C=n-E;if(C<0||C>=s)return;const T=a-1-Math.floor(C/i);T>=0&&T<a&&(c[T]+=1,u+=1)};for(const E of e)f(E.startedAt);for(const E of t??[])f(E);const p=2,h=Math.max(0,...c),m=132,y=14,w=m/a,N=h/(i/1e3),_=e.filter(E=>n-E.startedAt>=0&&n-E.startedAt<s).length,j=u-_,k=[_>0?`${_} tool ${_===1?"call":"calls"}`:"",j>0?`${j} ${j===1?"block":"blocks"} of thinking and writing`:""].filter(Boolean),S=u===0?"nothing in the last 60s":`${k.join(" · ")} in last 60s · peak ${N.toFixed(1)}/s`;return l.jsxs("div",{className:"tool-spark-row",title:S,children:[l.jsx("svg",{className:"tool-spark",width:m,height:y,viewBox:`0 0 ${m} ${y}`,"aria-hidden":!0,children:c.map((E,C)=>{const T=E===0?1.5:Math.max(1.5,Math.min(1,E/p)*y),R=C===a-1&&E>0,F=`tool-spark-bar${E>0?" active":""}${R?" latest":""}`;return l.jsx("rect",{x:C*w+.4,y:y-T,width:Math.max(.5,w-1),height:T,rx:.8,className:F},R?`landed:${E}`:C)})}),l.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function V5(e,t){return e?t==="gone"?"entering":t==="leaving"?"here":t:t==="gone"?"gone":"leaving"}function cp(e){return e!=="gone"}function up(e,t){const[n,s]=x.useState(()=>e?"here":"gone"),a=x.useRef(null);return x.useEffect(()=>{s(i=>V5(e,i))},[e]),x.useEffect(()=>{if(n==="leaving")return a.current=window.setTimeout(()=>s("gone"),t),()=>{a.current!=null&&window.clearTimeout(a.current)}},[n,t]),x.useEffect(()=>{n==="entering"&&s("here")},[n]),n}async function Vx(e,t=500){var s;if(!e)return!1;let n=!1;try{n=await Promise.race([((s=navigator.clipboard)==null?void 0:s.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(a=>window.setTimeout(()=>a(!1),t))])}catch{n=!1}if(n)return!0;try{const a=document.createElement("textarea");a.value=e,a.setAttribute("readonly",""),a.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(a),a.select(),n=document.execCommand("copy"),a.remove()}catch{n=!1}return n}const Y5=60,K5=6e3,Gr=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),Bn=e=>typeof e=="string"?e:null;function fo(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),s=n?e.map((i,c)=>[String(c),i]):Object.entries(e);if(s.length===0)return n?"[]":"{}";const a=[];for(const[i,c]of s){const u=n?`${t}-`:`${t}${i}:`;if(typeof c=="string"&&c.includes(`
70
+ `)){a.push(u);for(const f of c.split(`
71
+ `))a.push(`${t} ${f}`)}else if(c!==null&&typeof c=="object"){const f=fo(c,`${t} `);f==="[]"||f==="{}"?a.push(`${u} ${f}`):a.push(u,f)}else a.push(`${u} ${c===void 0?"(none)":String(c)}`)}return a.join(`
72
+ `)}function X5(e){return e.lines??e.text.split(`
73
+ `).map(t=>({text:t}))}function Z5(e,t){if(t)return{shown:e,cut:!1};const n=[];let s=0;for(const a of e){if(n.length===Y5)return{shown:n,cut:!0};const i=K5-s;if(a.text.length>i)return n.push({...a,text:`${a.text.slice(0,Math.max(i,0))}…`}),{shown:n,cut:!0};n.push(a),s+=a.text.length+1}return{shown:n,cut:!1}}const Sn=(e,t,n=!1)=>({...e?{label:e}:{},text:t,...n?{err:!0}:{}}),zn=(e,t)=>({label:e,text:t,inline:!0}),uA=(e,t)=>({label:e,text:t.map(n=>n.text).join(`
74
+ `),lines:t});function Q5(e,t){return[...e.split(`
75
+ `).map(n=>({text:`- ${n}`,tone:"del"})),...t.split(`
76
+ `).map(n=>({text:`+ ${n}`,tone:"add"}))]}function J5(e){if(!Array.isArray(e)||e.length===0)return null;const t=[];for(const n of e){if(!Gr(n)||!Array.isArray(n.lines))return null;t.push({text:`@@ -${n.oldStart},${n.oldLines} +${n.newStart},${n.newLines} @@`,tone:"ctx"});for(const s of n.lines){const a=String(s);t.push(a.startsWith("+")?{text:a,tone:"add"}:a.startsWith("-")?{text:a,tone:"del"}:{text:a})}}return t}function T1(e){if(typeof e=="string")return[Sn(void 0,e)];if(!Gr(e))return[Sn(void 0,fo(e))];const t=[],n=Bn(e.type);n==="create"&&t.push(zn("result","created the file"));const s=J5(e.structuredPatch);return s&&t.push(uA("applied",s)),e.userModified===!0&&t.push(zn("note","the user changed it before it was applied")),t.length?t:[zn("result",n==="update"?"updated the file":"done")]}function e6(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 s=t??1;return n!=null?`${s}–${s+n-1}`:`from ${s}`}function t6(e){if(typeof e=="string")return[Sn(void 0,e)];const t=Gr(e)&&Gr(e.file)?e.file:null,n=Bn(t==null?void 0:t.content);if(t&&n!=null){const a=[],i=Number(t.numLines),c=Number(t.totalLines),u=Number(t.startLine);return Number.isFinite(i)&&Number.isFinite(c)&&c>0&&a.push(zn("lines",i>=c?`all ${c}`:Number.isFinite(u)?`${u}–${u+i-1} of ${c}`:`${i} of ${c}`)),a.push(Sn("content",n)),a}const s=Gr(e)?Bn(e.type):null;return s&&s!=="text"?[zn("result",`${/^[aeiou]/i.test(s)?"an":"a"} ${s} file`)]:[Sn(void 0,fo(e))]}function n6(e){if(typeof e=="string")return[Sn("output",e)];if(!Gr(e))return[Sn(void 0,fo(e))];const t=Bn(e.stdout),n=Bn(e.stderr);if(t==null&&n==null)return[Sn(void 0,fo(e))];const s=[];return t&&s.push(Sn("output",t.replace(/\n$/,""))),n&&s.push(Sn("errors",n.replace(/\n$/,""),!0)),e.interrupted===!0&&s.push(zn("note","interrupted before it finished")),s.length?s:[zn("output","none")]}function r6(e,t,n){const s=Gr(t)?t:null;if(s&&(e==="Edit"||e==="MultiEdit")){const a=Bn(s.file_path),i=(e==="MultiEdit"?Array.isArray(s.edits)?s.edits:[]:[s]).filter(Gr).filter(c=>Bn(c.old_string)!=null&&Bn(c.new_string)!=null);if(a&&i.length){const c=[zn("file",a)];return i.forEach((u,f)=>{const p=u.replace_all===!0?", every occurrence":"";c.push(uA(i.length>1?`change ${f+1}${p}`:`change${p}`,Q5(u.old_string,u.new_string)))}),{input:c,response:T1(n)}}}if(s&&e==="Write"){const a=Bn(s.file_path),i=Bn(s.content);if(a&&i!=null)return{input:[zn("file",a),Sn("content",i)],response:T1(n)}}if(s&&e==="Read"){const a=Bn(s.file_path);if(a){const i=e6(s);return{input:i?[zn("file",a),zn("lines",i)]:[zn("file",a)],response:t6(n)}}}if(s&&e==="Bash"){const a=Bn(s.command);if(a!=null){const i=Bn(s.description);return{input:i?[Sn("command",a),zn("why",i)]:[Sn("command",a)],response:n6(n)}}}return{input:[Sn(void 0,fo(t))],response:[Sn(void 0,fo(n))]}}function A1(e,t,n){if(n==null)return"";if(typeof n=="string")return n;if(Gr(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(s=>typeof s=="string"&&s!=="").join(`
77
+ `);if(e==="Read"&&t==="response"&&Gr(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 s6({tool:e,onClose:t}){const n=dn(t),s=e.endedAt==null?"inflight":e.ok===!1?"err":"done",a=e.input??e.inputPreview,i=e.response??e.errorPreview,c=r6(e.name,a,i);return l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:n,className:"modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{className:`status-dot ${s}`,"aria-hidden":!0}),l.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),l.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),l.jsxs("div",{className:"modal-actions",children:[l.jsx("span",{className:"modal-dur",children:tA(e,"in-flight…")}),l.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),l.jsxs("section",{className:"modal-body",children:[e.trimmed&&l.jsx("div",{className:"modal-section",children:l.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),l.jsxs("div",{className:"modal-section",children:[l.jsxs("div",{className:"tm-head",children:[l.jsx("h4",{children:"Input"}),l.jsx(M1,{text:A1(e.name,"input",a),what:"input"})]}),c.input.map((u,f)=>l.jsx(R1,{block:u},f))]}),l.jsxs("div",{className:"modal-section",children:[l.jsxs("div",{className:"tm-head",children:[l.jsxs("h4",{children:["Response ",s==="err"&&l.jsx("span",{className:"err-tag",children:"error"})]}),e.endedAt!=null&&l.jsx(M1,{text:A1(e.name,"response",i),what:"response"})]}),e.endedAt==null?l.jsx("pre",{children:"(waiting…)"}):c.response.map((u,f)=>l.jsx(R1,{block:u},f))]})]})]})})}const a6={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function R1({block:e}){const[t,n]=x.useState(!1);if(e.inline)return l.jsxs("p",{className:"tm-inline",children:[e.label&&l.jsx("span",{className:"tm-label",children:e.label}),l.jsx("code",{children:e.text})]});const{shown:s,cut:a}=Z5(X5(e),t);return l.jsxs("div",{className:"tm-block",children:[e.label&&l.jsx("span",{className:"tm-label",children:e.label}),l.jsx("pre",{className:e.err?"tm-err":void 0,children:e.lines?s.map((i,c)=>l.jsxs("span",{className:i.tone?a6[i.tone]:void 0,children:[i.text,c<s.length-1?`
78
+ `:""]},c)):s.map(i=>i.text).join(`
79
+ `)}),a&&l.jsx("button",{type:"button",className:"btn tm-more",onClick:()=>n(!0),children:"show all"})]})}function M1({text:e,what:t}){const[n,s]=x.useState(!1),a=x.useRef(!0);return x.useEffect(()=>()=>{a.current=!1},[]),l.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n?`The ${t} was copied`:`Copy the ${t}`,onClick:()=>void Vx(e).then(i=>{!i||!a.current||(s(!0),window.setTimeout(()=>{a.current&&s(!1)},1600))}),children:n?"copied":"copy"})}const td=18,I1=26,o6=12,i6=240;function l6(e,t){return(e+i6)*(t||1)}function c6(e){return u6(e.nodeInternals.values())}function u6(e){const t=new Map;for(const a of e){if(a.type!=="agent"&&a.type!=="recapNote")continue;const i=a.data;if(!(i!=null&&i.sessionId)||i.exitAt!=null||a.width==null||a.height==null)continue;const c=a.position.x,u=a.position.y,f=c+a.width,p=u+a.height,h=t.get(i.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),i.kind==="root"&&(h.label=P1(i)??h.label),i.kind==="root"&&(h.name=L1(i))):t.set(i.sessionId,{minX:c,minY:u,maxX:f,maxY:p,label:P1(i)??i.sessionId,name:L1(i)})}const n=new Map;for(const a of t.values())n.set(a.label,(n.get(a.label)??0)+1);const s=[];for(const[a,i]of t){const c=(n.get(i.label)??0)>1;s.push({sessionId:a,...f6(i.label,i.name,a,c),x:i.minX-td,y:i.minY-td-I1,w:i.maxX-i.minX+td*2,h:i.maxY-i.minY+td*2+I1})}return s}const ax=" · ",d6=32,h6=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function $1(e){return h6.test(e)?2:1}function O1(e,t=d6){const n=[...e];let s=0;for(const c of n)s+=$1(c);if(s<=t)return e;const a=[];let i=0;for(const c of n){const u=$1(c);if(i+u>t-1)break;a.push(c),i+=u}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function f6(e,t,n,s){const a=(t==null?void 0:t.trim())??"",i=s?p6(n):void 0,c=[e,a||void 0,i].filter(Boolean);return{label:O1(e),name:a?O1(a):void 0,shortId:i,fullLabel:c.join(ax)}}function p6(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function P1(e){if(e.kind==="root")return e.label}function L1(e){if(e.kind==="root")return nA(e.sessionName,e.sessionTitle).face}function m6({onFit:e}){const{x:t,y:n,zoom:s}=L2(),a=Sc(),i=gt(c6,g6);if(i.length<=1)return null;const c=f=>{try{const p=a.getNodes().filter(h=>{const m=h.data;return(m==null?void 0:m.sessionId)===f});if(p.length===0)return;a.fitView({padding:.3,duration:500,nodes:p}),e==null||e()}catch{}},u={transform:`translate(${t}px, ${n}px) scale(${s})`};return l.jsx("div",{className:"session-clusters",style:u,children:i.map(f=>{const p=$d(f.sessionId),h={position:"absolute",left:0,top:0,transform:`translate(${f.x}px, ${f.y}px)`,width:f.w,height:f.h,"--session-hue":p},m={position:"absolute",left:f.x+16,top:f.y-o6/(s||1),transform:`scale(${1/(s||1)})`,transformOrigin:"left top",maxWidth:l6(f.w,s),"--session-hue":p};return l.jsxs(pe.Fragment,{children:[l.jsx("div",{className:"cluster-card",style:h,"aria-hidden":!0}),l.jsxs("button",{type:"button",className:"cluster-label",style:m,title:`Fit view to ${f.fullLabel}
80
+ drag the wrapper to move the whole session`,onClick:()=>c(f.sessionId),children:[f.label,f.name?l.jsx("span",{className:"cluster-label-name",children:ax+f.name}):null,f.shortId?l.jsx("span",{className:"cluster-label-id",children:ax+f.shortId}):null]})]},f.sessionId)})})}function g6(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],a=t[n];if(s.sessionId!==a.sessionId||s.label!==a.label||s.name!==a.name||s.shortId!==a.shortId||s.fullLabel!==a.fullLabel||s.x!==a.x||s.y!==a.y||s.w!==a.w||s.h!==a.h)return!1}return!0}function y6({data:e}){return l.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}function dA(e){const t=Math.max(0,e);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function yd(e){return dA(Math.floor(e/1e3))}function hA(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),a=Math.floor(n%86400/3600),i=Math.floor(n%3600/60);return s>0?`${s}d ${a}h`:a>0?`${a}h ${i}m`:`${i}m`}function w6(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function ox(e,t,n){const s=new Date(e),a=yd(t-e);return{label:w6(s,new Date(t))?a:`${a} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function v6({data:e}){const t=nh(3e4),n=ox(e.recap.at,t);return l.jsxs("div",{className:"recap-note",role:"note","aria-label":"Claude Code's recap",style:{"--session-hue":e.hue},children:[l.jsxs("div",{className:"recap-note-head",children:[l.jsxs("span",{className:"recap-note-mark",children:[l.jsx(Gx,{}),"recap"]}),l.jsx("span",{className:"recap-note-age",title:n.title,children:n.label}),l.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:s=>{s.stopPropagation(),I5(e.noteKey)},children:"×"})]}),l.jsx("p",{className:"recap-note-text",children:e.recap.text}),l.jsx(uo,{type:"source",position:ze.Right,style:{background:"transparent",border:"none"}})]})}function x6({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a,targetPosition:i,style:c}){const[u]=Ix({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i,curvature:.35});return l.jsxs("g",{className:"recap-tie",style:c,children:[l.jsx("path",{className:"recap-tie-thread",d:u}),l.jsx("path",{className:"recap-tie-beads",d:u}),l.jsx("circle",{className:"recap-tie-end",cx:e,cy:t,r:3.5}),l.jsx("circle",{className:"recap-tie-end",cx:n,cy:s,r:3.5})]})}const Tc={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"}},b6=Object.fromEntries(Object.entries(Tc).map(([e,t])=>[e,t.category])),k6=Object.fromEntries(Object.entries(Tc).map(([e,t])=>[e,t.emoji])),_6=Object.fromEntries(Object.entries(Tc).map(([e,t])=>[e,t.label])),N6=new Set(Object.keys(Tc)),S6=new Set(Object.entries(Tc).filter(([,e])=>e.shell).map(([e])=>e)),D1={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",...b6};function fA(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(D1,e)?D1[e]:"other"}const j6=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,E6=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function C6(e){if(typeof e!="string"||!e)return null;const t=j6.exec(e);if(t){const s=T6(t[2]);if(s.trim())return s}const n=E6.exec(e);return n?n[1]:null}function T6(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
81
+ `:n==="r"?"\r":n==="t"?" ":n)}const pA=600,A6=4,R6=36,ix=16,M6=60,I6=6,q1=220,F1=96,$6=28,B1={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:"📡",...k6};function z1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(B1,e)?B1[e]:"✨"}const U1={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 mA(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 mA(n[1]);for(;;){const i=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!i)break;t=t.slice(i[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const s=t.match(/^([^\s|;&<>(]+)/);if(!s)return null;let a=s[1];return/^[A-Za-z0-9_][\w.+-]*$/.test(a.replace(/^.*[/\\]/,""))?(a=a.replace(/^.*[/\\]/,""),a=a.replace(/\.(exe|cmd|bat|ps1)$/i,""),a||null):null}function O6(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=C6(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 s=n.findIndex(a=>/^(-Command|-c)$/i.test(a));if(s>=0&&s+1<n.length)return n[s+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const P6=new Set(["Bash","PowerShell",...S6]),L6=N6;function D6(e,t){return L6.has(e)||e.startsWith("mcp__")?Math.max(F1,34+t.length*7.5):F1}function q6(e,t){if(!P6.has(e))return null;const n=O6(t);if(!n)return null;const s=mA(n);return s?{emoji:Object.hasOwn(U1,s)?U1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const F6=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),W1={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:"🗄️"},H1={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 B6(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function z6(e){const t=e.toLowerCase();if(Object.hasOwn(H1,t))return H1[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 s=t.slice(n+1);if(Object.hasOwn(W1,s))return W1[s]}return"📄"}function U6(e,t){if(!t||typeof t!="object")return null;const n=t;if(e==="apply_patch"&&typeof n.patch=="string"){const s=n.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return s?s[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 W6(e,t){if(!F6.has(e))return null;const n=U6(e,t);if(!n)return null;const s=B6(n);return s?{emoji:e==="LS"?"📂":z6(s),label:s,category:"file",detail:n}:null}const G1={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 Yx(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 H6(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 gA(e){const t=e.toLowerCase();return Object.hasOwn(G1,t)?G1[t]:void 0}function G6(e,t){const n=Yx(e);if(!n)return null;const{server:s,method:a}=n;if(!a)return null;const i=gA(s);return{emoji:(i==null?void 0:i.emoji)??"🔌",label:a,category:"mcp",detail:i?`${i.name} · ${a}`:`${s} · ${a}`}}function V6(e,t){return q6(e,t)??W6(e,t)??G6(e)}const V1=_6,Y1=18;function Y6(e){const t=[...e];return t.length<=Y1?e:t.slice(0,Y1-1).join("")+"…"}function yA(e){const t=Yx(e);if(t){const s=gA(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:Y6(t.server),hue:H6(t.server)}}const n=Object.hasOwn(V1,e)?V1[e]:"";return n?{emoji:z1(e),label:n}:{emoji:z1(e),label:e}}function K6(e){let t=null,n="";for(const s of e){const a=Yx(s);if(a){if(!a.server)return null;if(t===null)t=a.server,n=s;else if(a.server!==t)return null}}return t===null?null:yA(n)}function X6(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function Z6(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/pA)}function Q6(e,t){const n=[],s=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const i=e[a];s.has(i.id)||(s.add(i.id),n.push(i))}return n.reverse()}function J6(e,t,n,s,a,i){const c=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&i-u.exitAt>pA)continue;const f=s.get(u.id)??n.get(u.id);if(!f)continue;const p=Q6(u.tools,A6);if(p.length===0)continue;const h=u.exitAt??null,m=a.get(u.id),y=Math.max((m==null?void 0:m.width)??q1,q1),w=(m==null?void 0:m.height)??130,N=f.x,_=f.y,j=N+y,k=_+w/2;p.forEach((S,E)=>{const C=E*R6,T=N+y+M6,R=_+I6+C,I=Z6(i,h),F=S.inputPreview??"",W=X6(S),O=I<.999,B=yA(S.name);c.push({id:`${u.id}::${S.id}`,toolId:S.id,agentId:u.id,toolName:S.name,name:B.label,emoji:B.emoji,status:W,category:fA(S.name),mcpHue:B.hue,inputPreview:F,fade:I,fading:O,worldX:T,worldY:R,anchorX:j,anchorY:k,spawnDx:j-T,spawnDy:k-(R+ix)});const Z=V6(S.name,S.input);if(Z){const Q=D6(S.name,B.label),M=T+Q+$6,K=R,G=T+Q,P=R+ix;c.push({id:`sub:${u.id}::${S.id}`,toolId:S.id,agentId:u.id,toolName:S.name,name:Z.label,emoji:Z.emoji,isSub:!0,status:W,category:Z.category,inputPreview:Z.detail??F,fade:I,fading:O,worldX:M,worldY:K,anchorX:G,anchorY:P,spawnDx:G-M,spawnDy:0})}})}return c}function eD({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:a,spotlight:i,hiddenCategories:c,now:u,onOpenTool:f}){const p=J6(e,t,n,s,a,u),h=c&&c.size>0?p.filter(m=>!c.has(m.category)):p;return l.jsx(tD,{bursts:h,spotlight:i,onOpenTool:f})}function tD({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:a,zoom:i}=L2();return l.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[l.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const u=c.anchorX*i+s,f=c.anchorY*i+a,p=(c.worldX+6)*i+s,h=(c.worldY+ix)*i+a,m=Math.max(1,p-u),y=Math.min(1,Math.abs(h-f)/m),w=u+m*(.55-.22*y),N=t!=null&&!t.has(c.agentId),_=c.fade*(N?.14:1);return l.jsx("path",{d:`M ${u} ${f} Q ${w} ${f}, ${p} ${h}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:_},`l:${c.id}`)})}),e.map(c=>l.jsx(rD,{b:c,x:s,y:a,zoom:i,dim:t!=null&&!t.has(c.agentId),onOpenTool:n},c.id))]})}function nD(e,t){const n=e.b,s=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===s.id&&n.toolId===s.toolId&&n.worldX===s.worldX&&n.worldY===s.worldY&&n.spawnDx===s.spawnDx&&n.spawnDy===s.spawnDy&&n.status===s.status&&n.fading===s.fading&&n.category===s.category&&n.mcpHue===s.mcpHue&&n.isSub===s.isSub&&n.emoji===s.emoji&&n.name===s.name&&n.toolName===s.toolName&&n.inputPreview===s.inputPreview}const rD=x.memo(function({b:t,x:n,y:s,zoom:a,dim:i,onOpenTool:c}){const u=t.worldX*a+n,f=t.worldY*a+s,p={left:`${u}px`,top:`${f}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${t.spawnDx}px`,"--spawn-dy":`${t.spawnDy}px`},h=t.isSub?`${t.toolName} · ${t.name}`:t.toolName,m=t.inputPreview?`${h} · ${t.inputPreview}`:h,y=c!=null,w=t.mcpHue!=null?{"--mcp-hue":t.mcpHue}:{},N=i?" dim":"";return l.jsx("div",{className:"tool-burst-wrap",style:p,children:l.jsxs("div",{className:`tool-burst cat-${t.category}${t.mcpHue!=null?" mcp-hue":""} status-${t.status}${t.fading?" fading":""}${y?" clickable":""}${t.isSub?" sub":""}${N}`,style:w,title:m,onClick:y?()=>c(t.toolId):void 0,children:[l.jsx("span",{className:"tb-emoji",children:t.emoji}),l.jsx("span",{className:"tb-name",children:t.name}),t.status==="inflight"&&l.jsx("span",{className:"tb-spin"}),t.status==="done"&&l.jsx("span",{className:"tb-mark done",children:"✓"}),t.status==="err"&&l.jsx("span",{className:"tb-mark err",children:"×"})]})})},nD);function sD(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,a=0,i=0;for(const c of e){const u=Hn(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,s+=c.usage.outputTokens,a+=c.usage.cacheReadTokens,i+=c.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:a,cacheCreateTokens:i,sum:n+s}}const aD="spend on this board",oD="on this board",K1=`Everything on the board right now, and only that.
82
+ Finished sessions are evicted from the canvas a couple of minutes after they end, and their tokens and dollars leave with them — so this figure falls on its own.
83
+ Press H for the totals ccusage reads off the logs on disk, which do not forget.`,wA="session spend";function Kx({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(i,c,u)=>{if(i<=0)return null;const f=i/n*100;return l.jsx("span",{className:`cb-seg ${c}`,style:{width:`${f}%`},title:`${u}: ${Nt(i)} (${f.toFixed(0)}%)`},c)},a=t==="lg";return l.jsxs("div",{className:a?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[s(e.input,"cb-input","input"),s(e.output,"cb-output","output"),s(e.cacheRead,"cb-cache-r","cache read"),s(e.cacheWrite,"cb-cache-w","cache write")]})}function iD({state:e,sessionId:t,onClose:n}){const s=x.useMemo(()=>lD(e,t),[e,t]),a=x.useRef(null),i=dn(n,{focusRef:a});return s?l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:i,className:"modal session-summary",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[l.jsxs("div",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),l.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),l.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),l.jsxs("div",{className:"modal-actions",children:[l.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),l.jsx("button",{type:"button",ref:a,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),l.jsxs("div",{className:"modal-body",children:[l.jsxs("section",{className:"ss-hero",children:[l.jsxs("div",{className:"ss-hero-left",children:[l.jsx("div",{className:"ss-cost-label",children:wA}),l.jsx("div",{className:"ss-cost",children:Nt(s.cost.total)}),s.modelChips.length>0&&l.jsx("div",{className:"ss-models",children:s.modelChips.map(c=>l.jsx("span",{className:"model-chip","data-family":Jd(c),title:c,children:ho(c)},c))})]}),l.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&l.jsxs(l.Fragment,{children:[l.jsx(Kx,{cost:s.cost,size:"lg"}),l.jsxs("div",{className:"ss-cost-legend",children:[l.jsxs("span",{className:"ssl ssl-in",children:["input ",l.jsx("b",{children:Nt(s.cost.input)})]}),l.jsxs("span",{className:"ssl ssl-out",children:["output ",l.jsx("b",{children:Nt(s.cost.output)})]}),l.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",l.jsx("b",{children:Nt(s.cost.cacheRead)})]}),l.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",l.jsx("b",{children:Nt(s.cost.cacheWrite)})]})]})]})})]}),l.jsxs("section",{className:"ss-stats",children:[l.jsx(xi,{label:"agents",value:s.agentCount}),l.jsx(xi,{label:"subagents",value:s.subagentCount}),l.jsx(xi,{label:"tool calls",value:s.toolCount}),l.jsx(xi,{label:"prompts",value:s.promptCount}),l.jsx(xi,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&l.jsx(xi,{label:"errors",value:s.errCount,tone:"err"})]}),s.topTools.length>0&&l.jsxs("section",{className:"modal-section",children:[l.jsx("h4",{children:"Most-used tools"}),l.jsx("div",{className:"ss-top-tools",children:s.topTools.map(([c,u])=>l.jsxs("div",{className:"ss-tt",children:[l.jsx("span",{className:"ss-tt-name",children:c}),l.jsx("span",{className:"ss-tt-bar",children:l.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/s.topTools[0][1]*100}%`}})}),l.jsx("span",{className:"ss-tt-count",children:u})]},c))})]}),s.firstPrompt&&l.jsxs("section",{className:"modal-section",children:[l.jsx("h4",{children:"Opening prompt"}),l.jsx("div",{className:"ss-prompt",children:s.firstPrompt})]})]})]})}):null}function xi({label:e,value:t,tone:n}){return l.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[l.jsx("div",{className:"ss-stat-value",children:t}),l.jsx("div",{className:"ss-stat-label",children:e})]})}function lD(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const E of e.agents.values())E.sessionId===t&&s.push(E);if(s.length===0)return null;const a={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},i=new Set,c=new Map;let u=0,f=0,p=0,h=0,m=0,y,w=1/0,N=0;for(const E of s){const C=Hn(E);a.input+=C.input,a.output+=C.output,a.cacheRead+=C.cacheRead,a.cacheWrite+=C.cacheWrite,a.total+=C.total;for(const R of Q2(E))i.add(R);E.model&&i.add(E.model),E.kind==="subagent"&&m++;const T=z2(E.prompts);f+=T.length,!y&&T.length>0&&(y=T[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,u+=E.toolCount,w=Math.min(w,E.startedAt),N=Math.max(N,E.endedAt??Date.now());for(const R of E.tools)c.set(R.name,(c.get(R.name)??0)+1),R.ok===!1&&h++}const _=Math.max(0,N-w),j=Math.floor(_/1e3),k=j<60?`${j}s`:j<3600?`${Math.floor(j/60)}m ${String(j%60).padStart(2,"0")}s`:`${Math.floor(j/3600)}h ${Math.floor(j%3600/60)}m`,S=Array.from(c.entries()).sort((E,C)=>C[1]-E[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:k,cost:a,modelChips:Array.from(i),agentCount:s.length,subagentCount:m,toolCount:u,promptCount:f,tokensSum:p,errCount:h,topTools:S,firstPrompt:y}}function X1(e){return e.waiting?go(e.waiting)?0:1:e.state==="active"?2:3}function cD(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let a=s.toolCount,i=Hn(s).total,c=s.endedAt??s.startedAt;for(const u of e.agents.values()){if(u.sessionId!==s.sessionId||u.kind==="root")continue;a+=u.toolCount,i+=Hn(u).total;const f=u.endedAt??u.startedAt;f>c&&(c=f)}n.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",cwdBasename:s.cwdBasename,state:s.state,waiting:s.waiting,recap:rh(s),modelId:s.model,toolCount:a,cost:i,startedAt:s.startedAt,lastActivity:c})}return n.sort((s,a)=>{const i=X1(s),c=X1(a);return i!==c?i-c:s.waiting&&a.waiting?s.waiting.since-a.waiting.since:a.lastActivity-s.lastActivity}),n}function Z1(e,t,n){const s=(t??n)-e;if(s<1e3)return"<1s";const a=Math.floor(s/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60);return i<60?`${i}m`:`${Math.floor(i/60)}h ${i%60}m`}function uD({state:e,now:t,selectedIds:n,onSelect:s,onClose:a}){const i=x.useMemo(()=>cD(e),[e,e.revision,t]),c=i.filter(f=>f.state==="active").length,u=i.filter(f=>go(f.waiting)).length;return l.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[l.jsxs("div",{className:"sl-header",children:[l.jsxs("h2",{children:["Sessions ",l.jsx("span",{className:"sl-count",children:i.length})]}),u>0&&l.jsxs("span",{className:"sl-waiting-count",children:[u," waiting"]}),c>0&&l.jsxs("span",{className:"sl-live-count",children:[c," live"]}),l.jsx("button",{className:"glyph-btn sl-close",onClick:a,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),l.jsxs("div",{className:"sl-rows",children:[i.length===0&&l.jsx("div",{className:"sl-empty",children:"No sessions yet."}),i.map(f=>{const p=n.has(f.sessionId);return l.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}`,onClick:()=>s(f.sessionId),title:`Focus ${f.label}`,children:[l.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:pc(f.state)}),l.jsxs("div",{className:"sl-row-body",children:[l.jsxs("div",{className:"sl-row-head",children:[l.jsx("span",{className:"sl-label",children:f.label}),f.modelId&&l.jsx("span",{className:"model-chip","data-family":Jd(f.modelId),title:f.modelId,children:ho(f.modelId)})]}),l.jsxs("div",{className:"sl-row-meta",children:[l.jsxs("span",{title:"tool calls",children:[l.jsx("b",{children:f.toolCount})," tools"]}),f.cost>0&&l.jsx("span",{className:"sl-cost",title:wA,children:l.jsx("b",{children:Nt(f.cost)})}),f.waiting?l.jsxs("span",{className:"sl-waiting",title:[qi(f.waiting),U5(f.waiting,qi(f.waiting)),`Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`].filter(Boolean).join(`
84
+ `),children:["waiting ",Z1(f.waiting.since,void 0,t),f.waiting.tool&&l.jsxs("span",{className:"sl-waiting-tool",children:[" · ",f.waiting.tool.name]})]}):l.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:Z1(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]}),f.recap&&l.jsxs("span",{className:"sl-recap",title:f.recap.text,children:[l.jsx(Gx,{}),f.recap.text]})]})]},f.sessionId)})]})]})}const dD=e=>1-Math.pow(1-e,5),vA=420;function hD(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 s=Math.max(Math.abs(e),Math.abs(t));return s===0||n/s>=.005}function fD(e,t,n,s=vA){return n>=s?t:n<=0?e:e+(t-e)*dD(n/s)}function pD(e,t,n,s={}){const a=s.now??(()=>performance.now()),i=s.raf??(w=>requestAnimationFrame(w)),c=s.cancel??(w=>cancelAnimationFrame(w)),u=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),f=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||f()||!hD(e,t))return n(t),()=>{};const p=a();let h=0,m=!0;const y=()=>{if(!m)return;const w=a()-p;n(fD(e,t,w)),w<vA&&(h=i(y))};return h=i(y),()=>{m=!1,h&&c(h)}}const lx={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function dp(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const a=Hn(s,t);n.set(s.sessionId,{cost:a.total,inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,cacheReadTokens:s.usage.cacheReadTokens,cacheCreateTokens:s.usage.cacheCreateTokens})}return n}function mD(e,t){if(!e)return lx;const n={...lx};for(const[s,a]of t){const i=e.get(s);if(!i)continue;const c={cost:a.cost-i.cost,inputTokens:a.inputTokens-i.inputTokens,outputTokens:a.outputTokens-i.outputTokens,cacheReadTokens:a.cacheReadTokens-i.cacheReadTokens,cacheCreateTokens:a.cacheCreateTokens-i.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 xA(e,t,n){const s=yD*Math.max(1,n/kA);let a=0;for(const[i,c]of t){const u=e.get(i);if(u===void 0)continue;const f=c.cost-u.cost;f>0&&f<=s&&(a+=f)}return a}const Q1={samples:[],last:new Map,watched:0},bA=10*6e4,gD=6e4,kA=5e3,yD=20;function wD(e,t,n){const s=e.samples[e.samples.length-1];if(s&&t-s.t<kA)return e;const a=e.watched+xA(e.last,n,s?t-s.t:0),i=e.samples.filter(c=>t-c.t<=bA);return i.push({t,watched:a}),{samples:i,last:n,watched:a}}function vD(e,t,n){const s=e.samples[0];if(!s)return null;const a=t-s.t;if(a<gD)return null;const i=e.samples[e.samples.length-1].t,c=e.watched+xA(e.last,n,t-i)-s.watched;return c>0?{spent:c,spanSec:a/1e3,spanMin:Math.min(bA/6e4,Math.ceil(a/6e4))}:null}function J1(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const sh=[{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 xD(e,t,n=sh.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 bD(e,t=new Date){return e==="today"?J1(1,t):e==="month"?J1(t.getDate(),t):"20200101"}const Un=e=>typeof e=="number"&&Number.isFinite(e)?e:0,wd=e=>typeof e=="string"?e:"";function _A(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const s of t){const a=Array.isArray(s==null?void 0:s.modelBreakdowns)?s.modelBreakdowns:[];for(const i of a){const c=wd(i==null?void 0:i.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+=Un(i==null?void 0:i.cost),u.inputTokens+=Un(i==null?void 0:i.inputTokens),u.outputTokens+=Un(i==null?void 0:i.outputTokens),u.cacheReadTokens+=Un(i==null?void 0:i.cacheReadTokens),u.cacheCreateTokens+=Un(i==null?void 0:i.cacheCreationTokens)}}return[...n.values()].sort((s,a)=>a.cost-s.cost||a.tokens-s.tokens)}const kD=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function _D(e){var t;return((t=kD.exec(e))==null?void 0:t[0])??e}function ND(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const a of n){const i=wd(a==null?void 0:a.period);if(!i)continue;const c=_D(i),u=a==null?void 0:a.metadata,f=typeof(u==null?void 0:u.lastActivity)=="string"?Date.parse(u.lastActivity):NaN;s.push({sessionId:c,label:t.get(c)??null,agent:wd(a==null?void 0:a.agent)||"claude",cost:Un(a==null?void 0:a.totalCost),tokens:Un(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(wd).filter(Boolean):[],lastActivityMs:Number.isFinite(f)?f:null})}return s.sort((a,i)=>i.cost-a.cost||i.tokens-a.tokens)}function NA(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=Un(t.cacheReadTokens),p=Un(t.cacheCreationTokens),h=Un(t.inputTokens),m=Un(t.outputTokens);return{cost:Un(t.totalCost),inputTokens:h,outputTokens:m,cacheReadTokens:f,cacheCreateTokens:p,tokens:Un(t.totalTokens)||h+m+f+p}}const n=_A(e),s=f=>n.reduce((p,h)=>p+f(h),0),a=s(f=>f.inputTokens),i=s(f=>f.outputTokens),c=s(f=>f.cacheReadTokens),u=s(f=>f.cacheCreateTokens);return{cost:s(f=>f.cost),inputTokens:a,outputTokens:i,cacheReadTokens:c,cacheCreateTokens:u,tokens:a+i+c+u}}function SD(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 e_(e,t){var n;return((n=sh.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function jD(e,t,n){const s=e!=null,a=NA(e);return{fromRange:s,cost:s?a.cost+n.cost:t.cost.total,inputTokens:s?a.inputTokens+n.inputTokens:t.inputTokens,outputTokens:s?a.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:s?a.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:s?a.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:s?a.cost>0:t.cost.total>0,tokenSum:s?a.tokens:t.sum,showCostBar:!s}}const Zt="ccdeck";function la(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function ah(e){return e==null}const cx="self";function sa(e,t=!1){const n=la(e?cx:null,cx);return{disabled:t||n.disabled,"aria-busy":n.busy}}function ys(e){return ah(e?cx:null)}function ED(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function t_(e){return e==null||e==="BODY"||e==="HTML"}const SA="agent-dag.usagePeriod";function CD(){const e=yo(SA);return sh.some(t=>t.key===e)?e:"today"}function TD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(SA,e)}catch{}}const jA="agent-dag.usageSessionsOpen";function AD(){return yo(jA)==="1"}function RD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(jA,e?"1":"0")}catch{}}function n_(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 MD(e){return e==="claude-swap"?"Read from claude-swap's last collection — costs no request against your usage-endpoint budget":e==="api"?"Fetched from Anthropic's usage endpoint, at most once every 5 minutes":e==="cli"?"Parsed from `claude /usage`, at most once every 5 minutes":"Last update"}const hp="__unknown__";function ID(e,t,n,s){const a=Math.max(0,t-s),i=Math.max(0,n-a);if(i<120)return null;const c=Math.min(100,i/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=i>0?e/i:0,h=p>0?f/p:1/0,m={label:`${Math.round(u)}% over pace`,color:"var(--warn)",expectedPct:c,isDeficit:!0};if(h<a&&h<86400){const y=Math.floor(h/3600),w=Math.floor(h%3600/60);m.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return m}return{label:`${Math.round(-u)}% under pace`,color:"var(--ok)",expectedPct:c,isDeficit:!1}}function Js({pct:e,label:t,reset:n,resetAt:s,windowSec:a,limitReached:i,nowSec:c}){const u=Math.min(100,Math.max(0,e)),p=i||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",h=u===0?"< 1%":`${u}%`,m=u===0?2:u,y=s?hA(s,c):null,w=s&&a?ID(u,s,a,c):null,[N,_]=x.useState(!1),j=x.useId();return l.jsxs("div",{className:"qb-row",children:[l.jsxs("div",{className:"qb-meta",children:[l.jsxs("span",{className:"qb-label",children:[t,i&&l.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),l.jsx("span",{className:"qb-pct",style:{color:p},children:h})]}),l.jsxs("div",{className:"qb-track",children:[l.jsx("div",{className:"qb-fill",style:{transform:`scaleX(${m/100})`,background:p,opacity:u===0?.4:1}}),w&&l.jsx("div",{className:"qb-pace-rail",style:{transform:`translateX(${w.expectedPct}%)`},children:l.jsx("div",{"aria-hidden":!0,className:"qb-pace-marker",style:{background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})})]}),l.jsxs("div",{className:"qb-reset-row",children:[y?l.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?l.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&l.jsxs("button",{type:"button",className:"qb-pace",style:{color:w.color},"aria-expanded":N,"aria-controls":N?j:void 0,onClick:()=>_(k=>!k),children:[l.jsx("i",{className:"qb-pace-key","aria-hidden":!0,style:{background:w.isDeficit?"var(--err)":"var(--ok)"}}),w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label]})]}),N&&w&&l.jsxs("div",{id:j,className:"qb-why",children:["To last until reset, stay near ",Math.round(w.expectedPct),"% by now."]})]})}const $D=6e4,OD=2e4;function PD(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),i=x.useRef(null),c=x.useRef(!1),u=async(p=!1)=>{if(!(p&&!ys(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/quota?refresh=1":"/api/quota",{signal:AbortSignal.timeout(OD)});m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return u(!0),i.current=window.setInterval(()=>u(!1),$D),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&u(!0)}}}function LD(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 DD(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 EA=6e4,r_=6e4;function qD(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),i=x.useRef(null),c=x.useRef(!1),u=async(p=!1)=>{if(!(p&&!ys(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return u(!0),i.current=window.setInterval(()=>u(!1),EA),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&u(!0)}}}function FD(e){const[t,n]=x.useState(null),s=x.useRef(null),a=async()=>{try{const i=await fetch("/api/codex-usage");i.ok&&n(await i.json())}catch{}};return x.useEffect(()=>{if(e)return a(),s.current=window.setInterval(a,EA),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function BD(e,t,n){const[s,a]=x.useState(null),[i,c]=x.useState(!1),[u,f]=x.useState(0),p=x.useRef(0);x.useEffect(()=>{const m=()=>document.visibilityState==="visible",y=()=>{m()&&f(_=>_+1)},w=window.setInterval(y,r_),N=()=>{m()&&Date.now()-p.current>=r_&&f(_=>_+1)};return document.addEventListener("visibilitychange",N),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",N)}},[]);const h=x.useRef(t);return x.useEffect(()=>{let m=!0;const y=t!==h.current;h.current=t;const w=e,N=bD(w);return c(!0),fetch(`/api/ccusage?since=${N}${y?"&refresh=1":""}`).then(_=>_.ok?_.json():null).then(_=>{!m||!(_!=null&&_.ok)||(p.current=Date.now(),a({period:w,data:_,baseline:n()}))}).catch(()=>{}).finally(()=>{m&&c(!1)}),()=>{m=!1}},[e,t,u]),{...SD(s,e),loading:i}}function Gl(e){const[t,n]=x.useState(e),s=x.useRef(e),a=x.useRef(!0);return x.useEffect(()=>{s.current=t},[t]),x.useEffect(()=>{if(a.current){a.current=!1,s.current=e,n(e);return}return pD(s.current,e,c=>{s.current=c,n(c)})},[e]),t}function zD({state:e,now:t,providers:n,leaving:s,onClose:a,liveSince:i=null}){var wt,ut;const{quota:c,loading:u,refresh:f}=PD(n.claude),{data:p,loading:h,refresh:m}=qD(n.codex),{data:y}=FD(n.codex),[w,N]=x.useState(()=>Math.floor(Date.now()/1e3));x.useEffect(()=>{const ee=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ee)},[]);const _=x.useRef(Q1),j=x.useRef(null),{byModel:k,totalCost:S,totalTokens:E,burnRate:C}=x.useMemo(()=>{const ee=new Map;for(const tt of e.agents.values())for(const it of Cc(tt)){const bt=it.model??hp,nt=Bx(it.usage,it.model),pt=ee.get(bt);pt?(pt.inputTokens+=it.usage.inputTokens,pt.outputTokens+=it.usage.outputTokens,pt.cacheReadTokens+=it.usage.cacheReadTokens,pt.cacheCreateTokens+=it.usage.cacheCreateTokens,pt.cost.total+=nt.total,pt.cost.input+=nt.input,pt.cost.output+=nt.output,pt.cost.cacheRead+=nt.cacheRead,pt.cost.cacheWrite+=nt.cacheWrite,pt.agentCount++):ee.set(bt,{model:bt,inputTokens:it.usage.inputTokens,outputTokens:it.usage.outputTokens,cacheReadTokens:it.usage.cacheReadTokens,cacheCreateTokens:it.usage.cacheCreateTokens,cost:{...nt},agentCount:1,priced:Ui(it.model)!=null})}const ke=Array.from(ee.values()).sort((tt,it)=>it.cost.total-tt.cost.total||it.inputTokens+it.outputTokens-(tt.inputTokens+tt.outputTokens)),Be=sD(e.agents.values());j.current!==i&&(j.current=i,_.current=Q1);const et=dp(e.agents.values(),t);i!=null&&(_.current=wD(_.current,t,et));const ht=i==null?null:vD(_.current,t,et),Je=ht?{label:zx(ht.spent,ht.spanSec),spanMin:ht.spanMin}:null;return{byModel:ke,totalCost:Be.cost,totalTokens:Be,burnRate:Je}},[e,e.revision,t,i]),T=x.useMemo(()=>{const ee=[];for(const ke of e.agents.values()){if(ke.kind!=="root")continue;let Be=Hn(ke).total,et=ke.usage.inputTokens,ht=ke.usage.outputTokens,Je=Od(ke);for(const tt of e.agents.values())tt.sessionId!==ke.sessionId||tt.kind==="root"||(Be+=Hn(tt).total,et+=tt.usage.inputTokens,ht+=tt.usage.outputTokens,Je+=Od(tt));ee.push({sessionId:ke.sessionId,label:ke.label||ke.cwdBasename||"session",state:ke.state,cost:Be,inputTokens:et,outputTokens:ht,unpricedTokens:Je})}return ee.sort((ke,Be)=>Be.cost-ke.cost||Be.inputTokens+Be.outputTokens-(ke.inputTokens+ke.outputTokens)).slice(0,12)},[e,e.revision]),[R,I]=x.useState(CD);x.useEffect(()=>{TD(R)},[R]);const[F,W]=x.useState(AD);x.useEffect(()=>{RD(F)},[F]);const O=x.useRef([]),[B,Z]=x.useState(0),Q=x.useRef(()=>new Map);Q.current=()=>dp(e.agents.values(),t);const M=x.useCallback(()=>Q.current(),[]),{data:K,shown:G,stale:P,loading:H,baseline:L}=BD(R,B,M),U=K!=null,$=H&&P,V=x.useMemo(()=>{const ee=new Map;for(const ke of e.agents.values()){if(ke.kind!=="root"||!ke.sessionId)continue;const Be=ke.label||ke.cwdBasename;Be&&ee.set(ke.sessionId,Be)}return ee},[e,e.revision]),he=x.useMemo(()=>{const ee=new Map;for(const ke of e.agents.values())ke.kind!=="root"||!ke.sessionId||ee.set(ke.sessionId,ke.state);return ee},[e,e.revision]),Y=x.useMemo(()=>U?_A(K):[],[K,U]),J=x.useMemo(()=>{if(!U)return[];const ee=ND(K,V).slice(0,12),ke=new Map;for(const Be of ee)Be.label&&ke.set(Be.label,(ke.get(Be.label)??0)+1);return ee.map(Be=>Be.label&&(ke.get(Be.label)??0)>1?{...Be,label:`${Be.label} ${Be.sessionId.slice(0,4)}`}:Be)},[K,U,V]),z=x.useMemo(()=>NA(K),[K]),re=e_(G,R),le=P?" up-stale":"",me=x.useMemo(()=>U?mD(L,dp(e.agents.values(),t)):lx,[e,e.revision,L,U,t]),ge=jD(K,{...E,cost:S},me),Me=ge.hasCost,qe=ge.tokenSum,Ve=Gl(ge.cost),Ue=Gl(ge.inputTokens),Se=Gl(ge.outputTokens),Qe=Gl(ge.cacheReadTokens),Ne=Gl(ge.cacheCreateTokens),_e=k.filter(ee=>ee.cost.total>0||ee.inputTokens+ee.outputTokens>0),ue=T.filter(ee=>ee.cost>0||ee.inputTokens+ee.outputTokens>0),je=U?Y.some(ee=>ee.cost<=0&&ee.tokens>0):_e.some(ee=>!ee.priced),Ce=u||h,Fe=n_(c==null?void 0:c.fetchedAt,w),We=n_(p==null?void 0:p.fetchedAt,w),He=()=>{f(),m(),Z(ee=>ee+1)},ot=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return l.jsxs("aside",{className:`usage-panel${s?" leaving":""}`,id:"usage-panel","aria-label":"Usage",children:[l.jsxs("div",{className:"up-header",children:[l.jsx("h2",{children:"Usage"}),C&&l.jsxs("span",{className:"up-rate",title:`Spend on this board over the last ${C.spanMin} min`,children:[C.label,l.jsxs("span",{className:"up-rate-span",children:[" · ",C.spanMin," min"]})]}),l.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&l.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:He,...sa(Ce),"aria-label":ot,title:ot,children:Ce?"…":"↻"}),l.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:a,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&l.jsxs("section",{className:"up-section up-quota-section",children:[l.jsxs("h3",{className:"up-section-title",children:["Claude quota",Fe&&!u&&l.jsx("span",{className:"up-section-age",title:MD(c==null?void 0:c.source),children:Fe})]}),c!=null&&c.ok?l.jsxs("div",{className:"up-quota-bars",children:[c.session5hPct!=null&&l.jsx(Js,{label:"5-hour window",pct:c.session5hPct,reset:c.session5hReset,resetAt:c.session5hResetAt,windowSec:c.session5hWindowSec,nowSec:w}),c.week7dPct!=null&&l.jsx(Js,{label:"7-day window",pct:c.week7dPct,reset:c.week7dReset,resetAt:c.week7dResetAt,windowSec:c.week7dWindowSec,nowSec:w}),c.weekSonnetPct!=null&&l.jsx(Js,{label:"Sonnet (7d)",pct:c.weekSonnetPct,nowSec:w}),c.weekOpusPct!=null&&l.jsx(Js,{label:"Opus (7d)",pct:c.weekOpusPct,nowSec:w}),c.extraEnabled&&c.extraUsedCredits!=null&&c.extraMonthlyLimit?l.jsx(Js,{label:`Extra credits (month${c.extraCurrency?`, ${c.extraCurrency}`:""})`,pct:Math.min(100,Math.round(c.extraUsedCredits/c.extraMonthlyLimit*100)),nowSec:w}):c.extraEnabled&&l.jsx("div",{className:"up-quota-sub up-credits",children:"extra usage credits: on"})]}):(c==null?void 0:c.ok)===!1?l.jsxs("div",{className:"up-quota-na",children:[l.jsx("span",{children:c.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),l.jsx("span",{className:"up-quota-hint",children:LD(c.reason)})]}):l.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&l.jsxs("section",{className:"up-section up-quota-section",children:[l.jsxs("h3",{className:"up-section-title",children:["Codex quota",(p==null?void 0:p.ok)&&p.planLabel&&l.jsx("span",{className:"up-plan-badge",children:p.planLabel}),We&&!h&&l.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:We})]}),p!=null&&p.ok?l.jsxs("div",{className:"up-quota-bars",children:[(wt=p.windows)==null?void 0:wt.map(ee=>l.jsx(Js,{label:ee.label,pct:ee.pct,reset:ee.reset??void 0,resetAt:ee.resetAt??void 0,windowSec:ee.windowSec??void 0,limitReached:p.limitReached&&ee.pct>=100,nowSec:w},ee.id)),(ut=p.extraWindows)==null?void 0:ut.map(ee=>l.jsx(Js,{label:ee.label,pct:ee.pct,reset:ee.reset??void 0,resetAt:ee.resetAt??void 0,windowSec:ee.windowSec??void 0,nowSec:w},ee.id)),p.creditLimit&&l.jsx(Js,{label:`spend cap · $${Math.round(p.creditLimit.used)} of $${Math.round(p.creditLimit.limit)}`,pct:p.creditLimit.usedPct,reset:p.creditLimit.reset??void 0,resetAt:p.creditLimit.resetAt??void 0,limitReached:p.spendControlReached,nowSec:w}),p.creditsBalance&&!p.creditsUnlimited&&l.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",p.creditsBalance,p.overageReached&&" · overage limit reached"]}),p.creditsUnlimited&&l.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),p.resetCredits&&p.resetCredits.availableCount>0&&l.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Zt} 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&&l.jsx("div",{className:"up-quota-sub",children:p.promo}),p.partial&&l.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?l.jsxs("div",{className:"up-quota-na",children:[l.jsx("span",{children:"Quota unavailable."}),l.jsx("span",{className:"up-quota-hint",children:DD(p.reason)})]}):l.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(y==null?void 0:y.ok)&&y.window7d&&y.window7d.sessionCount>0&&l.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${y.window5h?`
85
+ last 5h: ${wn(y.window5h.totalTokens)} tokens · ${y.window5h.sessionCount} session${y.window5h.sessionCount!==1?"s":""}`:""}`,children:[wn(y.window7d.totalTokens)," tokens · ",y.window7d.sessionCount," session",y.window7d.sessionCount!==1?"s":""," (7d)"]})]}),U&&l.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":$||void 0,onKeyDown:ee=>{var et;const ke=O.current.indexOf(ee.target);if(ke<0)return;const Be=xD(ee.key,ke);Be!==null&&(ee.preventDefault(),(et=O.current[Be])==null||et.focus())},children:sh.map((ee,ke)=>l.jsx("button",{type:"button",ref:Be=>{O.current[ke]=Be},tabIndex:R===ee.key?0:-1,"aria-pressed":R===ee.key,"data-pending":R===ee.key&&$?"":void 0,title:R===ee.key&&$?`Reading ${ee.noun} from the transcripts on this machine…`:ee.hint,className:"uh-range-btn",onClick:()=>I(ee.key),children:ee.label},ee.key))}),U&&l.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:$?`Reading ${e_(R,R)}…`:""}),qe>0?l.jsxs(l.Fragment,{children:[Me&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`up-total${le}`,title:U?void 0:K1,children:[l.jsx("span",{className:"up-total-value",children:Nt(Ve)}),l.jsx("span",{className:"up-total-label",children:U?re:aD})]}),ge.showCostBar&&l.jsx(Kx,{cost:S})]}),l.jsxs("div",{className:`up-tokens-row${le}`,title:U?void 0:K1,children:[l.jsxs("span",{className:"up-tok",children:[l.jsx("span",{className:"up-k",children:"in"}),wn(Ue)]}),l.jsxs("span",{className:"up-tok",children:[l.jsx("span",{className:"up-k",children:"out"}),wn(Se)]}),ge.cacheReadTokens>0&&l.jsxs("span",{className:"up-tok",children:[l.jsx("span",{className:"up-k",children:"cache r"}),wn(Qe)]}),ge.cacheCreateTokens>0&&l.jsxs("span",{className:"up-tok",children:[l.jsx("span",{className:"up-k",children:"cache c"}),wn(Ne)]}),!Me&&l.jsx("span",{className:"up-tok up-scope",children:oD})]}),(U?Y.length:_e.length)>0&&l.jsxs("section",{className:`up-section${le}`,children:[l.jsx("h3",{className:"up-section-title",children:"By model"}),l.jsxs("table",{className:"up-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Model"}),l.jsx("th",{children:"Tokens"}),l.jsx("th",{children:"Cost"})]})}),l.jsx("tbody",{children:U?Y.map(ee=>l.jsxs("tr",{children:[l.jsx("td",{className:"up-model-name",title:ee.model,children:ho(ee.model)}),l.jsx("td",{className:"up-num",children:wn(ee.tokens)}),ee.cost>0?l.jsx("td",{className:"up-num up-cost-val",children:Nt(ee.cost)}):l.jsx("td",{className:"up-num up-unpriced",children:Ni})]},ee.model)):_e.map(ee=>l.jsxs("tr",{children:[l.jsx("td",{className:"up-model-name",title:ee.model===hp?"no model reported yet":ee.model,children:ee.model===hp?"unknown":ho(ee.model)}),l.jsx("td",{className:"up-num",children:wn(ee.inputTokens+ee.outputTokens)}),ee.priced?l.jsx("td",{className:"up-num up-cost-val",children:Nt(ee.cost.total)}):l.jsx("td",{className:"up-num up-unpriced",children:Ni})]},ee.model))})]})]}),U&&J.length===0&&z.tokens>0&&l.jsxs("section",{className:"up-section",children:[l.jsx("h3",{className:"up-section-title",children:"By session"}),l.jsxs("div",{className:"up-hint",children:["No session is dated ",re," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(U?J.length:ue.length)>0&&(()=>{const ee=U?J.length:ue.length;return l.jsxs("section",{className:`up-section${le}`,children:[l.jsx("h3",{className:"up-section-title",children:l.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":F,"aria-controls":"up-sessions",title:F?"Hide the per-session breakdown":`Show the per-session breakdown — ${ee} session${ee===1?"":"s"}`,onClick:()=>W(ke=>!ke),children:["By session",U&&l.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${re}, each showing what that session has cost since it started.
86
+ A session that began earlier brings its whole total with it, so these rows can add up to more than the figure above.`,children:["active ",re]}),l.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:l.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),l.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!F,children:[U&&J.map(ke=>{const Be=he.get(ke.sessionId);return l.jsxs("div",{className:"up-session-row",children:[Be?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:`sl-dot state-${Be}`,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:pc(Be)})]}):l.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),l.jsx("span",{className:`up-session-label${ke.label?"":" up-session-id"}`,title:ke.label?`${ke.label}
87
+ ${ke.sessionId}`:ke.sessionId,children:ke.label??ke.sessionId.slice(0,8)}),l.jsx("span",{className:"up-session-tokens",children:wn(ke.tokens)}),ke.cost>0?l.jsx("span",{className:"up-session-cost",title:ke.models.join(", ")||void 0,children:Nt(ke.cost)}):l.jsx("span",{className:"up-session-cost up-unpriced",children:Ni})]},ke.sessionId)}),!U&&ue.map(ke=>l.jsxs("div",{className:"up-session-row",children:[l.jsx("span",{className:`sl-dot state-${ke.state}`,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:pc(ke.state)}),l.jsx("span",{className:"up-session-label",children:ke.label}),l.jsx("span",{className:"up-session-tokens",children:wn(ke.inputTokens+ke.outputTokens)}),ke.cost>0?l.jsxs("span",{className:"up-session-cost",title:ke.unpricedTokens>0?`${wn(ke.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Nt(ke.cost),ke.unpricedTokens>0?"+":""]}):l.jsx("span",{className:"up-session-cost up-unpriced",children:Ni})]},ke.sessionId))]})]})})(),je&&l.jsxs("div",{className:"up-hint",children:["“",Ni,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):l.jsx("div",{className:"up-empty",children:U?l.jsxs(l.Fragment,{children:["No usage ",re,".",l.jsx("br",{}),"Try a longer period."]}):l.jsxs(l.Fragment,{children:["No usage data yet.",l.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const cn={l:30,r:6,t:6,b:2},ea={l:0,r:0,t:2,b:1},oh=104,UD=64;function Cr(e,t=100,n=oh,s=cn){const a=n-s.t-s.b;return s.t+a*(1-Math.max(0,Math.min(t,e))/t)}function CA(e,t,n,s=100,a=oh,i=cn){if(!e.length)return"";const c=e[e.length-1].t-e[0].t,u=h=>{const m=t-i.l-i.r;return i.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)} ${Cr(h.v,s,a,i).toFixed(1)}`,p=h}return f}function TA(e,t,n,s=100,a=oh,i=cn){if(e.length<2)return"";const c=a-i.b,u=e[e.length-1].t-e[0].t,f=t-i.l-i.r,p=w=>i.l+(u>0?f*(w-e[0].t)/u:f/2);let h="",m=[];const y=()=>{if(m.length>=2){let w=`M${p(m[0].t).toFixed(1)} ${c}`;for(const N of m)w+=`L${p(N.t).toFixed(1)} ${Cr(N.v,s,a,i).toFixed(1)}`;h+=`${w}L${p(m[m.length-1].t).toFixed(1)} ${c}Z`}m=[]};for(const w of e)m.length&&w.t-m[m.length-1].t>n*2&&y(),m.push(w);return y(),h}function WD(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 AA(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function HD(e,t,n=s=>sc(s)){const s=e.filter(c=>c.v>0);if(!e.length)return null;if(!s.length)return"never held back";const a=s.length*(t/6e4),i=s[s.length-1];return`held back for ${a===1?"1 minute":`${a} minutes`}, last at ${n(i.t)}`}function sc(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Xx(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 s=Math.floor(n/60),a=n%60;return a?`${s}h ${a}m`:`${s}h`}function GD({group:e,title:t,onClose:n}){const s=dn(n),[a,i]=x.useState(null);x.useEffect(()=>{let p=!0;const h=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const w=await y.json();p&&(w!=null&&w.ok)&&i(w)}catch{}};h();const m=window.setInterval(h,2e4);return()=>{p=!1,window.clearInterval(m)}},[e]);const c=(a==null?void 0:a.series)??[],[u,f]=x.useMemo(()=>{let p=1/0,h=0;for(const m of c)m.points.length&&(p=Math.min(p,m.points[0].t),h=Math.max(h,m.points[m.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(a==null?void 0:a.sinceMs)??0):(a==null?void 0:a.sinceMs)??0,h]},[c,a==null?void 0:a.sinceMs]);return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[l.jsxs("div",{className:"modal-head",children:[l.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),a&&u>0&&l.jsxs("span",{className:"hist-since",children:["since ",sc(u)," · ",Xx(u,f||Date.now())]}),l.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),l.jsx("div",{className:"hist-body",children:a==null?l.jsx("p",{className:"hist-empty",children:"Reading…"}):c.length===0?l.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):c.map(p=>l.jsx(VD,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function VD({series:e,stepMs:t}){const n=x.useRef(null),[s,a]=x.useState(560),[i,c]=x.useState(null);x.useEffect(()=>{const I=n.current;if(!I||typeof ResizeObserver>"u")return;const F=new ResizeObserver(([W])=>a(Math.max(160,W.contentRect.width)));return F.observe(I),()=>F.disconnect()},[]);const{points:u,unit:f,warnAt:p,critAt:h,label:m,top:y,restsAtZero:w}=e,N=w?UD:oh,{now:_,peak:j}=WD(u),k=f==="C"?"°C":f,S=m==="Throttling"?HD(u,t):null,E=i!=null?u[i]:null,C=u.length>1?u[u.length-1].t-u[0].t:0,T=I=>{const F=s-cn.l-cn.r;return cn.l+(C>0?F*(I-u[0].t)/C:F/2)},R=I=>{if(u.length<2)return;const F=I.currentTarget.getBoundingClientRect(),W=(I.clientX-F.left-cn.l)/Math.max(1,F.width-cn.l-cn.r),O=u[0].t+C*Math.max(0,Math.min(1,W));let B=0;for(let Z=1;Z<u.length;Z++)Math.abs(u[Z].t-O)<Math.abs(u[B].t-O)&&(B=Z);c(B)};return l.jsxs("section",{className:"hist-series","aria-label":`${m} history`,children:[l.jsxs("div",{className:"hist-head",children:[l.jsx("span",{className:"hist-label",children:m}),l.jsxs("span",{className:"hist-stats",children:[_!=null&&l.jsxs(l.Fragment,{children:[l.jsx("b",{children:_}),l.jsxs("span",{children:[k," now"]})]}),j!=null&&l.jsxs(l.Fragment,{children:[l.jsx("b",{className:AA(j,p,h),children:j}),l.jsxs("span",{children:[k," peak"]})]})]})]}),l.jsx("div",{className:"hist-plot",ref:n,children:l.jsxs("svg",{className:"hist-chart",width:"100%",height:N,viewBox:`0 0 ${s} ${N}`,preserveAspectRatio:"none",role:"img","aria-label":_==null?`${m}: nothing measured yet`:`${m}: ${_}${k} now, peak ${j}${k}, over ${Xx(u[0].t,u[u.length-1].t)}`,onPointerMove:R,onPointerLeave:()=>c(null),children:[[["warn",p],["hot",h]].map(([I,F])=>F==null||F>y?null:l.jsxs("g",{children:[l.jsx("line",{className:`hist-rule ${I}`,x1:cn.l,x2:s-cn.r,y1:Cr(F,y,N),y2:Cr(F,y,N)}),l.jsx("text",{className:`hist-rule-tag ${I}`,x:2,y:Cr(F,y,N)+3,children:F})]},I)),l.jsx("line",{className:"hist-floor",x1:cn.l,x2:s-cn.r,y1:N-cn.b,y2:N-cn.b}),l.jsx("path",{className:"hist-area",d:TA(u,s,t,y,N)}),l.jsx("path",{className:"hist-line",d:CA(u,s,t,y,N)}),u.length===1&&l.jsx("circle",{className:"hist-dot",cx:T(u[0].t),cy:Cr(u[0].v,y,N),r:3}),E&&l.jsxs("g",{children:[l.jsx("line",{className:"hist-cross",x1:T(E.t),x2:T(E.t),y1:cn.t,y2:N-cn.b}),l.jsx("circle",{className:"hist-dot",cx:T(E.t),cy:Cr(E.v,y,N),r:3})]})]})}),l.jsx("div",{className:"hist-axis",children:E?l.jsxs("span",{className:"hist-at",children:[sc(E.t)," — ",l.jsx("b",{children:E.v}),k]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{children:u.length?sc(u[0].t):""}),l.jsx("span",{children:u.length?sc(u[u.length-1].t):""})]})}),S&&l.jsx("div",{className:"hist-note",children:S})]})}const YD="thermal:Throttling";function KD(e){var n,s,a,i;const t={};e.cpu!=null&&(t["cpu:all"]=e.cpu),(n=e.perCore)!=null&&n.length&&(t["cpu:busiest"]=Math.max(...e.perCore)),e.memory&&(t["mem:physical"]=e.memory.usedPct),e.swap&&e.swap.total>0&&(t["mem:swap"]=Math.round(e.swap.used/e.swap.total*1e3)/10),(s=e.loadavg)!=null&&s.length&&(t["load:1m"]=e.loadavg[0]);for(const c of((a=e.thermal)==null?void 0:a.celsius)??[])t[`thermal:${c.label}`]=c.celsius;return(i=e.thermal)!=null&&i.throttle&&(t[YD]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function vd(e,t){return t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function nd(e,t){return Number.isInteger(e)?t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`:vd(e,t)}const s_=["cores","memory","load","thermal"],no=116,Wr=24,XD=60,ZD=6e4;function QD(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function JD(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function eq(e,t=XD){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function tq({sys:e}){const[t,n]=x.useState({});x.useEffect(()=>{let c=!0;const u=async()=>{const p=await Promise.all(s_.map(async h=>{try{const m=await fetch(`/api/system/history?group=${h}`);return m.ok?[h,await m.json()]:[h,null]}catch{return[h,null]}}));c&&n(h=>{const m={...h};for(const[y,w]of p)w!=null&&w.ok&&(m[y]=w);return m})};u();const f=setInterval(()=>void u(),ZD);return()=>{c=!1,clearInterval(f)}},[]);const s=x.useMemo(()=>KD(e),[e]),a=x.useMemo(()=>s_.flatMap(c=>{const u=t[c];return u?u.series.filter(QD).map(f=>({series:eq(f),stepMs:u.stepMs})):[]}),[t]),i=x.useMemo(()=>{let c=1/0,u=-1/0;for(const{series:f}of a){const p=f.points;p.length&&(c=Math.min(c,p[0].t),u=Math.max(u,p[p.length-1].t))}return Number.isFinite(c)?Xx(c,u):"less than a minute"},[a]);return Object.keys(s).length?l.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${i}`,children:a.map(({series:c,stepMs:u})=>l.jsx(nq,{series:c,stepMs:u,now:s[c.key],span:i},c.key))}):null}function nq({series:e,stepMs:t,now:n,span:s}){var w;const{points:a,top:i,unit:c,warnAt:u,critAt:f}=e,p=JD(e),h=n??((w=a[a.length-1])==null?void 0:w.v),m=h==null?"":AA(h,u,f),y=Math.max(...a.map(N=>N.v));return l.jsxs("div",{className:`pl-cell${m?` ${m}`:""}`,title:[`${p} · peak ${vd(y,c)} over the last ${s}`,u!=null?`over ${nd(u,c)} is uncomfortable`:"",f!=null?`over ${nd(f,c)} the machine acts`:""].filter(Boolean).join(" · "),children:[l.jsxs("div",{className:"pl-cell-head",children:[l.jsx("span",{className:"pl-cell-label",children:p}),l.jsx("span",{className:"pl-cell-now",children:h==null?"—":vd(h,c)})]}),l.jsxs("svg",{className:"pl-spark",width:no,height:Wr,viewBox:`0 0 ${no} ${Wr}`,preserveAspectRatio:"none","aria-hidden":!0,children:[l.jsx("line",{className:"pl-spark-floor",x1:0,x2:no,y1:Wr-ea.b,y2:Wr-ea.b}),l.jsx("path",{className:"pl-spark-area",d:TA(a,no,t,i,Wr,ea)}),u!=null&&l.jsx("line",{className:"pl-rule warn",x1:0,x2:no,y1:Cr(u,i,Wr,ea),y2:Cr(u,i,Wr,ea)}),f!=null&&l.jsx("line",{className:"pl-rule hot",x1:0,x2:no,y1:Cr(f,i,Wr,ea),y2:Cr(f,i,Wr,ea)}),l.jsx("path",{className:"pl-spark-line",d:CA(a,no,t,i,Wr,ea)})]}),l.jsxs("span",{className:"vis-hidden",children:["peak ",vd(y,c)," over the last ",s,u!=null&&`, uncomfortable over ${nd(u,c)}`,f!=null&&`, the machine acts over ${nd(f,c)}`]})]})}const rq={key:"cpu",dir:"desc"};function sq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function aq(e,t){const n=t.dir==="asc"?1:-1,s=i=>t.key==="cpu"?i.cpu:t.key==="mem"?i.mem:t.key==="rss"?i.rssBytes:t.key==="threads"?i.threads:i.uptimeSec,a=(i,c)=>{if(t.key==="name")return n*i.name.localeCompare(c.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=i.user??"",h=c.user??"";return!p||!h?p===h?0:p?-1:1:n*p.localeCompare(h,void 0,{sensitivity:"base"})}const u=s(i),f=s(c);return u==null||f==null?u==null?f==null?0:1:-1:n*(u-f)};return[...e].sort((i,c)=>a(i,c)||(c.cpu??-1)-(i.cpu??-1)||c.mem-i.mem||i.pid-c.pid)}function oq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const iq=4e3;function lq(){const[e,t]=x.useState(null);return x.useEffect(()=>{let n=!0;const s=async()=>{if(document.visibilityState!=="hidden")try{const i=await fetch("/api/system/processes?detail=1");if(!i.ok)return;const c=await i.json();n&&(c!=null&&c.ok)&&t({procs:c.procs??[],total:c.total??0})}catch{}};s();const a=window.setInterval(s,iq);return()=>{n=!1,window.clearInterval(a)}},[]),e}function cq(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,s=0;for(;n>=1024&&s<t.length-1;)n/=1024,s++;return`${n>=100?n.toFixed(0):n.toFixed(1)} ${t[s]}`}function uq(e){return e==null||!Number.isFinite(e)||e<0?"—":e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function dq({sys:e,onClose:t}){const n=dn(t),[s,a]=x.useState(rq),i=lq(),c=i?aq(i.procs,s):null;return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:n,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[l.jsxs("div",{className:"modal-head",children:[l.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),i&&l.jsxs("span",{className:"pl-count",children:[c.length," of ",i.total," running"]}),l.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),l.jsxs("div",{className:"pl-split",children:[l.jsx("div",{className:"pl-body",children:c==null?l.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):c.length===0?l.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):l.jsxs("table",{className:"sd-procs pl-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx(bi,{col:"cpu",label:"cpu",sort:s,onSort:a}),l.jsx(bi,{col:"rss",label:"memory",note:"Resident set size, which is what ps and Task Manager report; macOS Activity Monitor shows a different figure.",sort:s,onSort:a}),l.jsx(bi,{col:"threads",label:"threads",sort:s,onSort:a}),l.jsx(bi,{col:"uptime",label:"up",sort:s,onSort:a}),l.jsx(bi,{col:"user",label:"user",sort:s,onSort:a}),l.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),l.jsx(bi,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:s,onSort:a})]})}),l.jsx("tbody",{children:c.map(u=>l.jsxs("tr",{children:[l.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),l.jsx("td",{className:"sd-num sd-dim",title:`${u.mem.toFixed(1)}% of installed memory`,children:cq(u.rssBytes)}),l.jsx("td",{className:"sd-num sd-dim",children:u.threads??"—"}),l.jsx("td",{className:"sd-num sd-dim",children:uq(u.uptimeSec)}),l.jsx("td",{className:"sd-dim pl-user",children:u.user??"—"}),l.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),l.jsxs("td",{className:"pl-name",children:[u.name,u.cmd&&l.jsxs("span",{className:"pl-cmd",title:u.cmd,children:[" ",u.cmd]})]})]},u.pid))})]})}),l.jsx(tq,{sys:e})]})]})}),document.body)}function bi({col:e,label:t,note:n,sort:s,onSort:a}){const i=oq(s,e);return l.jsx("th",{scope:"col","aria-sort":i,children:l.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
88
+
89
+ ${n}`:`Sort by ${t}`,onClick:()=>a(sq(s,e)),children:[t,l.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}const hq=3e3;function fq(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function pq(e,t,n=Date.now()){const s=Math.max(0,Math.min(100,100-e));return{pct:s,value:`${s}%`,tone:s===0?"calm":s>=30?"hot":"warn",note:s>0?`CPU held to ${e}% of full speed to cool down`:t?`at full speed · held to ${100-t.peak}% ${mq(t.lastMs,n)}`:"running at full speed, and never held back"}}function mq(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 s=Math.floor(n/60);return s===1?"an hour ago":`${s} hours ago`}function Vl(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 gq(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),s=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${s}m`:`${s}m`}function yq(){const[e,t]=x.useState(null),n=x.useRef(null);return x.useEffect(()=>{let s=!0;const a=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},i=()=>{n.current==null&&(a(),n.current=window.setInterval(a,hq))},c=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){c();return}i(),a()};return i(),document.addEventListener("visibilitychange",u),()=>{s=!1,c(),document.removeEventListener("visibilitychange",u)}},[]),e}function a_({usageOpen:e,leaving:t,sub:n,onClose:s,children:a}){return l.jsxs("aside",{className:`sysdetail${e?" shifted":""}${t?" leaving":""}`,id:"system-panel","aria-labelledby":"sd-title",children:[l.jsxs("div",{className:"sd-head",children:[l.jsx("h2",{className:"sd-title",id:"sd-title",children:"This machine"}),n&&l.jsx("span",{className:"sd-sub",children:n}),l.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:s,"aria-label":"Close",title:"Close",children:"×"})]}),a]})}function wq({usageOpen:e,leaving:t,onClose:n}){const s=yq();if(!s||s.cpu==null||!s.memory)return l.jsx(a_,{usageOpen:e,leaving:t,onClose:n,children:l.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:a,swap:i,perCore:c,loadavg:u,cores:f,uptimeSec:p,platform:h,thermal:m}=s,y=a?a.total-a.available:0,w=h==="win32"?"Commit":"Swap",N=i&&i.total>0?i.used/i.total*100:0;return l.jsxs(a_,{usageOpen:e,leaving:t,sub:`up ${gq(p)} · ${f} cores`,onClose:n,children:[c&&c.length>0&&l.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:l.jsx(xd,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:l.jsx("div",{className:"sd-cores",children:c.map((_,j)=>l.jsx("span",{className:"sd-core",title:`core ${j+1}: ${_}%`,children:l.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,_)/100})`}})},j))})})}),l.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:l.jsxs(xd,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&l.jsx(Dd,{label:"Physical",value:l.jsxs(l.Fragment,{children:[l.jsx("b",{children:Vl(y)})," of ",Vl(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${Vl(a.available)} available`}),i&&i.total>0&&l.jsx(Dd,{label:w,value:l.jsxs(l.Fragment,{children:[l.jsx("b",{children:Vl(i.used)})," of ",Vl(i.total)]}),pct:N,tone:N>=90?"warn":"calm",note:N>=50?"paging to disk":void 0})]})}),u&&l.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:l.jsxs(xd,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[l.jsx("div",{className:"sd-load",children:u.map((_,j)=>l.jsxs("span",{className:`sd-load-item${_>f?" over":""}`,children:[l.jsx("b",{children:_.toFixed(2)}),l.jsx("span",{children:["1m","5m","15m"][j]})]},j))}),l.jsx("div",{className:"sd-note",children:u[0]>f?`${(u[0]/f).toFixed(1)}× more work queued than cores to run it`:`within ${f} cores`})]})}),l.jsx(vq,{thermal:m}),l.jsx(xq,{sys:s})]})}function xd({group:e,title:t,action:n,label:s,children:a}){const[i,c]=x.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:"sd-open",onClick:()=>c(!0),title:n,"aria-label":n,children:[l.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",l.jsx("i",{className:"sd-row-more",children:"›"})]}),a]}),i&&l.jsx(GD,{group:e,title:t,onClose:()=>c(!1)})]})}function vq({thermal:e}){if(!e)return null;const t=e.throttle?pq(e.throttle.speedLimit,e.heldBack):null;return l.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:l.jsxs(xd,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>l.jsx(Dd,{label:n.label,value:l.jsxs(l.Fragment,{children:[l.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:fq(n.celsius,n.warnAt,n.critAt)},n.label)),t&&l.jsx(Dd,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function xq({sys:e}){const[t,n]=x.useState(!1);return l.jsxs("div",{className:"sd-section sd-door-section",children:[l.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:l.jsxs("span",{className:"sd-door-plate",children:[l.jsxs("span",{className:"sd-door-name",children:["Busiest processes",l.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),l.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&l.jsx(dq,{sys:e,onClose:()=>n(!1)})]})}function Dd({label:e,value:t,pct:n,tone:s="calm",note:a}){return l.jsxs("div",{className:"sd-row",children:[l.jsxs("div",{className:"sd-row-head",children:[l.jsx("span",{className:"sd-row-label",children:e}),l.jsx("span",{className:"sd-row-val",children:t})]}),l.jsx("span",{className:"sd-track",children:l.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),a&&l.jsx("div",{className:"sd-note",children:a})]})}const o_=18,bq=1100,ki=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},kq=Array.from({length:o_},(e,t)=>{const n=-72+144*t/(o_-1)+(ki(t,1)-.5)*9,s=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+ki(t,2)*.52);return{dx:Math.cos(s)*a,dy:Math.sin(s)*a,rot:(t%2?1:-1)*(100+ki(t,3)*260),delay:Math.round(ki(t,4)*90),dur:760+Math.round(ki(t,5)*260),scale:.8+ki(t,6)*.45,hue:t%4,round:t%3===0}});function i_({anchor:e}){var a;const[t,n]=x.useState(null),s=typeof window<"u"&&((a=window.matchMedia)==null?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches);return x.useEffect(()=>{if(s)return;const i=e.current;if(!i)return;const c=i.getBoundingClientRect();n({x:c.left+c.width/2,y:c.top+c.height/2});const u=window.setTimeout(()=>n(null),bq);return()=>window.clearTimeout(u)},[e,s]),s||!t?null:Kr.createPortal(l.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:kq.map((i,c)=>l.jsx("span",{className:`confetti-bit${i.round?" round":""}`,"data-hue":i.hue,style:{"--dx":`${i.dx.toFixed(1)}px`,"--dy":`${i.dy.toFixed(1)}px`,"--rot":`${i.rot}deg`,"--s":i.scale.toFixed(2),animationDelay:`${i.delay}ms`,animationDuration:`${i.dur}ms, ${i.dur}ms`}},c))}),document.body)}const RA=new Set(["awaiting_url","awaiting_code","registering"]);function _q(e){return e!=null&&RA.has(e)}function MA(e){return e!=null&&e!=="done"&&!RA.has(e)}const Nq="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",Sq="the sign-in did not complete";function jq({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?Nq:Sq)}}function Eq({restored:e,activeAccount:t}){if(e!==!1)return null;const n=(t==null?void 0:t.email)||((t==null?void 0:t.num)!=null?`account ${t.num}`:null);return n?`This machine is now signed in as ${n} — the account you were using could not be put back. Switch back from the accounts panel.`:"The account you were using could not be put back — check which account this machine is signed in as from the accounts panel."}const Cq="done";function Tq(){let e=!1;return{shouldAnnounce(t){return t!==Cq?(e=!1,!1):e?!1:(e=!0,!0)}}}function Zx(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const Aq={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 ${Zt}`,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"},Rq={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"},Mq=`claude-swap could not read the login keychain — start ${Zt} from a Terminal window rather than a background service`;function ux(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(mc(e)))return Mq;const n=Zx(Rq,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function mc(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const Iq={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"},$q="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 Oq(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const Pq="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",Lq="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",Dq=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),qq=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,Fq=/[\\/]_npx[\\/]/i,Bq=`the copy of ccusage ${Zt} installed for itself`;function zq(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function K7(e,t){const n=Uq(e,t),s=zq(e);switch(e==null?void 0:e.stage){case"npx":return s?`ccusage failed on both of its paths. The managed install failed first — ${s} — and the deck then fell back to npx, where ${Yl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${Yl(n)}`;case"managed":return`${Bq} failed to run: ${Yl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${Yl(n)}`:`the ccusage this deck found on your PATH failed to run: ${Yl(n)}`;default:return n}}const Yl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function Uq(e,t){const n=mc(e);if(Dq(n)){if(Fq.test(n))return Lq;if(qq.test(n))return Pq}if(Oq(n))return $q;const s=Zx(Iq,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Ei(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&MA(e.state))return e.error;const n=Zx(Aq,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function Wq(e,t,n){if(n<=0||th(e))return{kind:"pass"};const s=t>=0&&t<n?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:s===-1?0:(s+1)%n};case"ArrowLeft":return{kind:"select",index:s===-1?n-1:(s-1+n)%n};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:n-1};default:return{kind:"pass"}}}function IA(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 Hq(e){const t=new Map;for(const n of e){const s=(n.email??"").trim().toLowerCase();s&&t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=(n.email??"").trim(),a=n.alias||s||`account ${n.num}`,i=[];return n.alias&&s&&i.push(s),s&&(t.get(s.toLowerCase())??0)>1&&i.push(n.org||`slot ${n.num}`),{num:n.num,label:a,sub:i.length?i.join(" · "):null}})}function Gq(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 Vq(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 Yq(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(h=>h.state===p).length,s=[],a=n("imported");a&&s.push(`${a} of ${t} imported`);const i=n("healed");i&&s.push(`${i} had a dead token replaced`);const c=n("updated");c&&s.push(`${c} updated`);const u=n("present");u&&s.push(`${u} already here`);const f=n("failed");return f&&s.push(`${f} did not arrive`),`${s.join(", ")}.`}const Kq=1500,rd=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],l_="aa-panel",c_=e=>`aa-tab-${e}`;async function Kl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const dx=pe.forwardRef((e,t)=>l.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[l.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),l.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));dx.displayName="SuccessMark";function Xq({onClose:e,onChanged:t}){const[n,s]=x.useState("login"),[a,i]=x.useState(null),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(!1),[y,w]=x.useState(null),[N,_]=x.useState(null),[j,k]=x.useState(null),[S,E]=x.useState(null),C=x.useRef(""),T=x.useRef(!1),R=x.useRef(!1),I=x.useRef(null),F=x.useRef(null),W=x.useRef(null),O=x.useRef(null),B=x.useRef([]),Z=x.useRef(!1),Q=x.useCallback(()=>{T.current&&Kl({action:"login-cancel"}).catch(()=>{}),e()},[e]),M=dn(Q,{focusRef:W}),K=x.useCallback(async()=>{if(!ys(R.current))return;R.current=!0,m(!0),w(null),T.current=!0;const z=await Kl({action:"login"}).catch(()=>null);if(R.current=!1,m(!1),!(z!=null&&z.ok)){w(Ei(z,"could not start the sign-in"));return}i(z)},[]);x.useEffect(()=>{if(!_q(a==null?void 0:a.state))return;const z=window.setInterval(async()=>{try{const re=await fetch("/api/claude-accounts/login");re.ok&&i(await re.json())}catch{}},Kq);return()=>window.clearInterval(z)},[a]);const G=x.useRef(t);G.current=t;const P=x.useState(Tq)[0];x.useEffect(()=>{var z;(a==null?void 0:a.state)==="awaiting_code"&&((z=I.current)==null||z.focus()),P.shouldAnnounce(a==null?void 0:a.state)&&G.current()},[a==null?void 0:a.state,P]),x.useEffect(()=>{var z;n==="paste"&&!Z.current&&((z=F.current)==null||z.focus()),Z.current=!1},[n]);const H=x.useCallback(z=>{var le;const re=Wq(z,rd.findIndex(me=>me.id===n),rd.length);re.kind!=="pass"&&(z.preventDefault(),Z.current=!0,s(rd[re.index].id),(le=B.current[re.index])==null||le.focus())},[n]),L=x.useCallback(async()=>{var re;if(!ys(R.current))return;R.current=!0,m(!0),w(null);const z=await Kl({action:"login-code",code:c}).catch(()=>null);if(R.current=!1,m(!1),!(z!=null&&z.ok)){w(Ei(z,"the code was not accepted")),z!=null&&z.state&&i(z),(re=I.current)==null||re.select();return}u(""),i(z)},[c,a]),U=x.useCallback(async()=>{if(!ys(R.current))return;R.current=!0,m(!0),w(null);const z=await Kl({action:"import",blob:f}).catch(()=>null);if(R.current=!1,m(!1),!(z!=null&&z.ok)){w(Ei(z,"the import failed"));return}C.current=f,p(""),E(null),_(z.results??[]),t()},[f,t]),$=x.useCallback(async z=>{const re=`${z.email}|${z.org??""}`;if(!ys(R.current)||!C.current)return;R.current=!0,m(!0),k(re),E(null);const le=await Kl({action:"import",blob:C.current,force:!0,only:{email:z.email,org:z.org??""}}).catch(()=>null);if(R.current=!1,m(!1),k(null),!(le!=null&&le.ok)){E({key:re,text:Ei(le,"that account could not be updated")});return}const me=(le.results??[])[0];me&&_(ge=>ge&&ge.map(Me=>`${Me.email}|${Me.org??""}`===re?me:Me)),t()},[t]),V=(a==null?void 0:a.state)==="done"?a.account:null,he=Eq({restored:a==null?void 0:a.restored,activeAccount:a==null?void 0:a.activeAccount}),Y=MA(a==null?void 0:a.state)||!!(y&&T.current&&!h),J=jq({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:Q,role:"presentation",children:l.jsxs("div",{ref:M,className:"modal aa-modal",onClick:z=>z.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:H,children:rd.map((z,re)=>l.jsx("button",{type:"button",role:"tab",id:c_(z.id),ref:le=>{B.current[re]=le},"aria-selected":n===z.id,"aria-controls":l_,tabIndex:n===z.id?0:-1,className:`aa-tab${n===z.id?" on":""}`,onClick:()=>{Z.current=!1,s(z.id)},children:z.label},z.id))})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:Q,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsx("section",{className:"modal-body aa-body",id:l_,role:"tabpanel","aria-labelledby":c_(n),children:n==="login"?V?l.jsxs("div",{className:"aa-done",children:[l.jsx(dx,{ref:O}),l.jsx(i_,{anchor:O}),l.jsx("h4",{children:V.added?`Account ${V.num} added`:"Credentials refreshed"}),l.jsxs("p",{className:"aa-note",children:[l.jsx("strong",{children:V.email}),V.added?he?" 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."]}),he?l.jsx("p",{className:"aa-note aa-warn",role:"status",children:he}):null,l.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(a==null?void 0:a.state)==="awaiting_code"||(a==null?void 0:a.state)==="registering"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:"1 · Approve in the browser"}),l.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),l.jsx("a",{className:"aa-link",href:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),l.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."}),l.jsxs("div",{className:"aa-field",children:[l.jsx("input",{ref:I,type:"text",value:c,onChange:z=>u(z.target.value),onKeyDown:z=>{z.key==="Enter"&&c.trim()&&!h&&L()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),l.jsx("button",{type:"button",className:"btn primary",...sa(h,!c.trim()||a.state==="registering"),onClick:L,children:a.state==="registering"?"registering…":"Continue"})]}),(y||a.error)&&l.jsx("p",{className:"aa-err",children:y??a.error}),l.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."})]})]}):Y?l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:J.title}),l.jsx("p",{className:"aa-err",children:J.message}),l.jsx("button",{type:"button",className:"btn",onClick:()=>{T.current=!1,i(null),w(null),K()},children:"Try again"})]}):h||T.current?l.jsx("div",{className:"aa-step",children:l.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):l.jsxs("div",{className:"aa-step aa-primer",children:[l.jsx("h4",{children:"Sign in to Anthropic"}),l.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."}),l.jsx("div",{className:"aa-actions",children:l.jsx("button",{type:"button",ref:W,className:"btn primary",onClick:K,children:"Open the sign-in page"})})]}):N?(()=>{const z=N.filter(re=>re.state==="imported").length;return l.jsxs("div",{className:"aa-done",children:[l.jsx(dx,{ref:O}),z>0&&l.jsx(i_,{anchor:O}),l.jsx("h4",{children:Yq(N)}),N.length>0&&l.jsx("ul",{className:"aa-results",children:N.map(re=>{const le=`${re.email}|${re.org??""}`;return l.jsxs("li",{className:`aa-result ${re.state}`,children:[l.jsx("span",{className:"aa-result-who",children:re.email||(re.num?`slot ${re.num}`:"an account")}),l.jsx("span",{className:"aa-result-what",children:Vq(re.state)}),re.state==="present"&&l.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":j===le,title:`Overwrite the stored login for ${re.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>$(re),children:j===le?"updating…":"update anyway"}),(S==null?void 0:S.key)===le&&l.jsx("span",{className:"aa-result-err",children:S.text})]},le)})}),l.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",l.jsx("strong",{children:" update anyway"}),"."]}),l.jsxs("div",{className:"aa-actions",children:[l.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),l.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",E(null),_(null)},children:"Import another"})]})]})})():l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:"Paste an account shared from another deck"}),l.jsxs("div",{className:"aa-field",children:[l.jsx("input",{ref:F,type:"text",value:f,onChange:z=>p(z.target.value),onKeyDown:z=>{z.key==="Enter"&&f.trim()&&!h&&U()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),l.jsx("button",{type:"button",className:"btn primary",...sa(h,!f.trim()),onClick:U,children:h?"importing…":"Import"})]}),y&&l.jsx("p",{className:"aa-err",children:y}),l.jsxs("p",{className:"aa-note",children:["Use ",l.jsx("strong",{children:"share"})," on one account in the other deck, or ",l.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})}),document.body)}function Zq(e,t,n){if(n<=0||th(e))return{kind:"pass"};const s=t>=0&&t<n?t:-1;switch(e.key){case"ArrowDown":return{kind:"focus",index:s===-1?0:(s+1)%n};case"ArrowUp":return{kind:"focus",index:s===-1?n-1:(s-1+n)%n};case"Home":return{kind:"focus",index:0};case"End":return{kind:"focus",index:n-1};default:return{kind:"pass"}}}const sd=4,Xl=8;function Qq(e,t,n){const s=n.height-Xl-(e.bottom+sd),a=e.top-sd-Xl,i=t.height<=s||s>=a?"below":"above",c=i==="below"?s:a,u=t.height<=c,f=u?t.height:Math.max(0,c),p=i==="below"?e.bottom+sd:e.top-sd-f,h=Math.max(Xl,Math.min(e.right-t.width,n.width-Xl-t.width));return{top:Math.max(Xl,p),left:h,side:i,maxHeight:u?null:f}}const $A='[role="menuitem"]';function u_(e){return e?Array.from(e.querySelectorAll($A)).filter(t=>!t.disabled):[]}function d_({anchorId:e,boundaryId:t,id:n,className:s,role:a,labelledBy:i,start:c="first",onClose:u,children:f}){const p=x.useRef(u);p.current=u;const h=dn(()=>{var _;(_=document.getElementById(e))==null||_.focus(),p.current()}),m=x.useCallback(()=>{var C;const _=h.current;if(!_)return;const j=document.getElementById(e);if(!j){p.current();return}const k=j.getBoundingClientRect(),S=t?(C=document.getElementById(t))==null?void 0:C.getBoundingClientRect():null;if(S&&(k.bottom<=S.top||k.top>=S.bottom)){_.contains(document.activeElement)&&j.focus({preventScroll:!0}),p.current();return}_.style.maxHeight="";const E=Qq(k,{width:_.offsetWidth,height:_.offsetHeight},{width:window.innerWidth,height:window.innerHeight});_.style.top=`${E.top}px`,_.style.left=`${E.left}px`,_.style.maxHeight=E.maxHeight==null?"":`${E.maxHeight}px`,_.dataset.side=E.side},[e,t,h]);x.useLayoutEffect(()=>{m()}),x.useEffect(()=>{const _=j=>{var k;(k=h.current)!=null&&k.contains(j.target)||m()};return window.addEventListener("scroll",_,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",m)}},[m,h]),x.useEffect(()=>{const _=j=>{var S,E;const k=j.target;!k||(S=h.current)!=null&&S.contains(k)||(E=document.getElementById(e))!=null&&E.contains(k)||p.current()};return window.addEventListener("pointerdown",_,!0),()=>window.removeEventListener("pointerdown",_,!0)},[e,h]),x.useEffect(()=>{var j;if(a!=="menu")return;const _=u_(h.current);(j=c==="last"?_[_.length-1]:_[0])==null||j.focus()},[]);const y=_=>{var j;if(a==="menu"&&_.key==="Tab"){_.stopPropagation(),(j=document.getElementById(e))==null||j.focus(),_.shiftKey&&_.preventDefault(),p.current();return}if(a==="menu"){const k=u_(h.current),S=Zq(_,k.indexOf(document.activeElement),k.length);S.kind==="focus"&&(_.preventDefault(),k[S.index].focus())}_.key.length===1&&_.stopPropagation()},w=_=>{_.target.closest("button, input, select, textarea, code")||_.preventDefault()},N=_=>{if(a!=="menu"||_.pointerType==="touch")return;const j=_.target.closest($A);j&&!j.disabled&&document.activeElement!==j&&j.focus({preventScroll:!0})};return Kr.createPortal(l.jsx("div",{ref:h,id:n,className:`anchored-popover${s?` ${s}`:""}`,role:a,"aria-labelledby":i,onKeyDown:y,onMouseDown:w,onPointerMove:N,children:f}),document.body)}async function Jq(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const eF=1800;function tF({accounts:e,onClose:t,copyText:n}){const[s,a]=x.useState([]),[i,c]=x.useState(null),[u,f]=x.useState(!1),[p,h]=x.useState(null),[m,y]=x.useState(!1),[w,N]=x.useState(()=>Math.floor(Date.now()/1e3)),_=x.useRef(null),j=x.useRef(!1),k=dn(t,{focusRef:_});x.useEffect(()=>{if(!i)return;N(Math.floor(Date.now()/1e3));const O=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(O)},[i]);const S=Hq(e),E=e.filter(O=>!s.includes(O.num)).map(O=>O.num),C=E.length===e.length,T=O=>a(B=>B.includes(O)?B.filter(Z=>Z!==O):[...B,O]),R=x.useCallback(async()=>{if(!ys(j.current)||!E.length)return;j.current=!0,f(!0),h(null),y(!1);const O=await Jq({action:"share",accounts:E}).catch(()=>null);if(j.current=!1,f(!1),!(O!=null&&O.ok)){h(Ei(O,"the share could not be made"));return}c({blob:O.blob,expiresAt:O.expiresAt,shared:O.shared??[],failed:O.failed??[]})},[e,E]),I=i?IA(i.expiresAt,w):null,F=(I==null?void 0:I.tone)==="gone",W=(i==null?void 0:i.shared.length)??0;return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:k,className:"modal sa-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("h3",{children:"Share accounts"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsx("section",{className:"modal-body sa-body",children:i?l.jsxs("div",{className:"sa-step",children:[l.jsx("h4",{children:F?"This share has expired":W===1?"1 account, ready to paste":`${W} accounts, ready to paste`}),l.jsx("code",{className:`ap-share-blob${F?" sa-dead":""}`,children:i.blob}),l.jsxs("div",{className:"ap-share-foot",children:[l.jsx("button",{type:"button",className:"ap-manage-btn",ref:_,onClick:async()=>{if(F){c(null),R();return}await n(i.blob)&&(y(!0),window.setTimeout(()=>y(!1),eF))},children:F?"make a new share":m?"copied":`copy ${W===1?"the share":"all "+W}`}),l.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:[l.jsx("span",{className:"ap-share-warn",children:W===1?"this is the password":`this is ${W} passwords`})," · ",l.jsx("span",{className:`ap-share-expiry ${I==null?void 0:I.tone}`,children:I==null?void 0:I.text})]})]}),i.failed.length>0&&l.jsxs("div",{className:"sa-failed",role:"alert",children:[l.jsx("p",{className:"sa-failed-head",children:i.failed.length===1?"One account is not in this bundle:":`${i.failed.length} accounts are not in this bundle:`}),l.jsx("ul",{className:"sa-list",children:i.failed.map(O=>{var Z;const B=!!(O.email&&((Z=O.detail)!=null&&Z.includes(O.email)));return l.jsxs("li",{children:[!B&&l.jsx("span",{className:"sa-who",children:O.email||`account ${O.num}`}),l.jsx("span",{className:"sa-why",children:O.detail||"could not be exported"})]},`${O.num}-${O.email}`)})})]}),l.jsx("p",{className:"sa-note",children:F?l.jsx(l.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):l.jsxs(l.Fragment,{children:["Paste it into the other deck with ",l.jsx("strong",{children:"+"})," → ",l.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),l.jsxs("div",{className:"sa-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>{c(null),y(!1)},children:"Pick again"}),l.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?l.jsxs("div",{className:"sa-step",children:[l.jsx("h4",{children:"Nothing to share"}),l.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",l.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),l.jsx("div",{className:"sa-actions",children:l.jsx("button",{type:"button",className:"btn primary",ref:_,onClick:t,children:"Close"})})]}):l.jsxs("div",{className:"sa-step",children:[l.jsxs("h4",{children:["Which accounts go to the other ",Zt,"?"]}),l.jsx("p",{className:`sa-count${E.length?"":" empty"}`,children:Gq(E.length)}),l.jsx("ul",{className:"sa-list sa-pick",children:S.map(O=>l.jsx("li",{children:l.jsxs("label",{className:"sa-row",children:[l.jsx("input",{type:"checkbox",checked:E.includes(O.num),onChange:()=>T(O.num)}),l.jsx("span",{className:"sa-who",children:O.label}),O.sub&&l.jsx("span",{className:"sa-sub",children:O.sub})]})},O.num))}),p&&l.jsx("p",{className:"aa-err",children:p}),l.jsxs("div",{className:"sa-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>a(C?e.map(O=>O.num):[]),children:C?"Clear all":"Select all"}),l.jsx("button",{type:"button",className:"btn primary",ref:_,...sa(u,!E.length),onClick:R,children:u?"making the share…":E.length===0?"Share":E.length===1?"Share 1 account":`Share ${E.length} accounts`})]})]})})]})}),document.body)}function nF(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((a,i)=>a-i).map(a=>{const i=a===t?"here":n.has(a)?"swap":"free";return{slot:a,kind:i,label:i==="here"?`slot ${a}`:`slot ${a} · ${i}`}})}function rF(e,t,n){if(!(n!=null&&n.ok))return null;const s=Number.isInteger(n.to)?n.to:null;if(s==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const a=n.swapped===!0&&s!==t;return{menuFor:e.menuFor===t?s:a&&e.menuFor===s?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:a?{at:s,displaced:t}:null}}function sF(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function aF(e,t,n){var a;const s=((a=e.find(i=>i.slot===t))==null?void 0:a.kind)??"here";return s==="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}.`}:s==="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 oF(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 h_(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function iF(e){const t=e.filter(u=>!h_(u)),n=e.filter(u=>h_(u)),s=t.length?t:n,a=t.length?n:[],i=s.reduce((u,f)=>u&&u.pct>=f.pct?u:f,null);let c=null;for(const u of a)i&&u.pct<=i.pct||(!c||u.pct>c.pct)&&(c=u);return{shown:s,rest:a,fuller:c,peak:c??i}}const lF="\0";function Qx(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}${lF}${n}`}function cF(e,t){const n=Qx(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function uF(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(Qx)),s=e.filter(a=>n.has(a));return s.length===e.length?e:s}const dF=64;function hF(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const fF=Object.freeze({text:"couldn't reach the deck server",reload:!0}),pF=Object.freeze({text:"still waiting on the deck server — claude-swap can be slow to answer",reload:!0});async function f_(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function mF(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=mc(t.body);return{text:ux(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function p_(e,t){return t?e!=null&&e.reload&&e.text===t.text&&e.raw===t.raw?e:t:e!=null&&e.reload?null:e}function OA({title:e,steps:t,finish:n,aside:s,onClose:a}){const i=x.useRef(null),c=dn(a,{focusRef:i}),[u,f]=x.useState(0),p=u===t.length-1,h=t[u],m=N=>f(Math.max(0,Math.min(t.length-1,N))),y=N=>{N.key!=="ArrowRight"&&N.key!=="ArrowLeft"||(N.preventDefault(),N.stopPropagation(),m(N.key==="ArrowRight"?u+1:u-1))},w=()=>{if(!p){m(u+1);return}n?n.act():a()};return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:l.jsxs("div",{ref:c,className:"modal guide",onClick:N=>N.stopPropagation(),onKeyDown:y,role:"dialog","aria-modal":"true","aria-labelledby":"guide-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{id:"guide-title",className:"modal-tool-name",children:e}),l.jsxs("span",{className:"modal-tool-id",children:[u+1," / ",t.length]})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsx("div",{className:"guide-stage",children:h.art},u),l.jsx("p",{className:"guide-line","aria-live":"polite",children:h.line}),l.jsx("p",{className:"guide-tip",children:h.tip??""}),l.jsxs("div",{className:"guide-foot",children:[l.jsx("div",{className:"guide-dots",children:t.map((N,_)=>l.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${_+1} of ${t.length}`,"aria-current":_===u?"step":void 0,onClick:()=>m(_)},_))}),p&&s&&l.jsx("button",{type:"button",className:"ap-lan-word guide-aside",onClick:s.act,children:s.label}),u>0&&l.jsx("button",{type:"button",className:"btn",onClick:()=>m(u-1),children:"Back"}),l.jsx("button",{ref:i,type:"button",className:"btn primary",onClick:w,children:p?(n==null?void 0:n.label)??"Done":"Next"})]})]})]})}),document.body)}const hx={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function lr({children:e}){return l.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function ir({x:e,y:t=34,w:n=176,h:s=132,label:a}){return l.jsxs(l.Fragment,{children:[a&&l.jsx("text",{x:e+2,y:t-9,className:"ga-cap",children:a}),l.jsx("rect",{x:e,y:t,width:n,height:s,rx:10,className:"ga-screen"})]})}function Ar({x:e,y:t,email:n,state:s,tone:a,bars:i}){return l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:e+3,cy:t-4,r:3,className:hx[a]}),l.jsx("text",{x:e+12,y:t,className:"ga-t ga-mono",children:n}),l.jsx("text",{x:e+12,y:t+16,className:`ga-s ${hx[a]}`,children:s}),i==null?void 0:i.map((c,u)=>l.jsxs("g",{children:[l.jsx("text",{x:e,y:t+40+u*18,className:"ga-s",children:u?"7d":"5h"}),l.jsx("rect",{x:e+22,y:t+35+u*18,width:96,height:4,rx:2,className:"ga-track"}),l.jsx("rect",{x:e+22,y:t+35+u*18,width:96*c/100,height:4,rx:2,className:"ga-accent"}),l.jsxs("text",{x:e+148,y:t+40+u*18,className:"ga-s ga-accent",textAnchor:"end",children:[c,"%"]})]},u))]})}function PA({x:e,y:t,on:n}){return l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:30,height:18,rx:9,className:n?"ga-switch-on":"ga-switch"}),l.jsx("circle",{cx:n?e+21:e+9,cy:t+9,r:6,className:n?"ga-knob-on":"ga-knob"})]})}function ad({x:e,y:t,name:n,here:s=!0}){return l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:e+3,cy:t-4,r:3,className:s?"ga-ok":"ga-dim"}),l.jsx("text",{x:e+12,y:t,className:s?"ga-t":"ga-s",children:n})]})}function m_({x:e,y:t,on:n}){return n?l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:12,height:12,rx:3,className:"ga-accent"}),l.jsx("path",{d:`M${e+3} ${t+6.2}l2.3 2.3 4-4.6`,className:"ga-tick"})]}):l.jsx("rect",{x:e+.5,y:t+.5,width:11,height:11,rx:3,className:"ga-box"})}function g_({x:e,y:t,d:n}){return l.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function Jx({x:e,y:t}){return l.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 e0(){return l.jsxs(l.Fragment,{children:[l.jsx("circle",{r:9,className:"ga-key-bed"}),l.jsxs("g",{transform:"translate(-6 -6) scale(0.857)",className:"ga-key",children:[l.jsx("circle",{cx:4.6,cy:7,r:2.6}),l.jsx("path",{d:"M7.2 7h5.2M10.6 7v2.2M12.4 7v1.6"})]})]})}function Ci({x:e,y:t,w:n,title:s,sub:a,tone:i}){return l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:n,height:40,rx:8,className:"ga-screen"}),l.jsx("rect",{x:e+6,y:t+10,width:3,height:20,rx:1.5,className:hx[i]}),l.jsx("text",{x:e+16,y:t+17,className:"ga-t ga-strong",children:s}),l.jsx("text",{x:e+16,y:t+31,className:"ga-s",children:a})]})}function Mi({x:e,y:t,label:n,live:s}){return l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:46,height:20,rx:10,className:s?"ga-chip-live":"ga-chip"}),l.jsx("text",{x:e+23,y:t+14,className:"ga-s ga-mono",textAnchor:"middle",children:n})]})}function qd({x:e,y:t}){return l.jsxs(l.Fragment,{children:[l.jsx("text",{x:e,y:t,className:"ga-cap",children:"LOCAL NETWORK"}),l.jsx(PA,{x:e+118,y:t-13,on:!0})]})}function gF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:14,y:14,width:206,height:172,rx:10,className:"ga-screen"}),l.jsx("text",{x:28,y:38,className:"ga-t ga-strong",children:"Sessions"}),l.jsx("text",{x:206,y:38,className:"ga-s ga-warn",textAnchor:"end",children:"1 waiting"}),l.jsx("rect",{x:20,y:50,width:194,height:42,rx:6,className:"ga-bed-warn"}),l.jsx("circle",{cx:33,cy:64,r:7,className:"ga-ring-warn ga-ping"}),l.jsx("circle",{cx:33,cy:64,r:3.5,className:"ga-warn"}),l.jsx("text",{x:44,y:68,className:"ga-t",children:"api-server"}),l.jsx("text",{x:44,y:83,className:"ga-s ga-warn",children:"waiting 6m · Bash"}),l.jsx("circle",{cx:33,cy:108,r:3.5,className:"ga-flight"}),l.jsx("text",{x:44,y:112,className:"ga-t",children:"docs-site"}),l.jsx("text",{x:44,y:127,className:"ga-s",children:"running · 12 tools"}),l.jsx("circle",{cx:33,cy:150,r:3.5,className:"ga-ok"}),l.jsx("text",{x:44,y:154,className:"ga-t",children:"billing"}),l.jsx("text",{x:44,y:169,className:"ga-s",children:"done · $0.84"}),l.jsx("path",{d:"M216 71C234 71 230 100 244 100",className:"ga-arc"}),l.jsx("path",{d:"M239 96l5 4-5 4",className:"ga-arrow"}),l.jsx("rect",{x:248,y:44,width:178,height:112,rx:10,className:"ga-screen"}),l.jsx("text",{x:262,y:64,className:"ga-cap",children:"API-SERVER"}),l.jsx("line",{x1:248,y1:74,x2:426,y2:74,className:"ga-line"}),l.jsx("text",{x:262,y:96,className:"ga-s ga-mono",children:"Bash(npm test)"}),l.jsx("text",{x:262,y:116,className:"ga-t ga-mono ga-warn",children:"Allow this command?"}),l.jsx("text",{x:262,y:136,className:"ga-s ga-mono",children:"> 1. Yes 2. No"})]})}function yF(){return l.jsxs(lr,{children:[l.jsx("path",{d:"M136 100C166 100 166 38 196 38",className:"ga-edge ga-flow"}),l.jsx("path",{d:"M136 100H196",className:"ga-edge ga-flow"}),l.jsx("path",{d:"M136 100C166 100 166 162 196 162",className:"ga-edge-done"}),l.jsx("path",{d:"M308 38H326M308 100H326",className:"ga-edge"}),l.jsx(Ci,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),l.jsx(Ci,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),l.jsx(Ci,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),l.jsx(Ci,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),l.jsx(Mi,{x:326,y:28,label:"Read"}),l.jsx(Mi,{x:380,y:28,label:"Grep",live:!0}),l.jsx(Mi,{x:326,y:90,label:"Bash",live:!0})]})}function y_({x:e,y:t,label:n,pct:s,note:a}){return l.jsxs(l.Fragment,{children:[l.jsx("text",{x:e,y:t,className:"ga-s",children:n}),l.jsxs("text",{x:e+194,y:t,className:"ga-s ga-accent",textAnchor:"end",children:[s,"%"]}),l.jsx("rect",{x:e,y:t+7,width:194,height:5,rx:2.5,className:"ga-track"}),l.jsx("rect",{x:e,y:t+7,width:194*s/100,height:5,rx:2.5,className:"ga-accent"}),l.jsx("text",{x:e,y:t+26,className:"ga-s",children:a})]})}function wF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:14,y:30,width:172,height:140,rx:10,className:"ga-screen"}),l.jsx("text",{x:30,y:56,className:"ga-cap",children:"THIS SESSION"}),l.jsx("text",{x:30,y:98,className:"ga-big",children:"$3.66"}),l.jsx("text",{x:30,y:122,className:"ga-s",children:"Opus 5 · 1.2M tokens"}),l.jsx("text",{x:30,y:150,className:"ga-s",children:"$21.40 today"}),l.jsx("rect",{x:200,y:30,width:226,height:140,rx:10,className:"ga-screen"}),l.jsx("text",{x:216,y:56,className:"ga-cap",children:"CLAUDE QUOTA"}),l.jsx(y_,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),l.jsx(y_,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function vF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),l.jsx(Ci,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),l.jsx(Jx,{x:156,y:106}),l.jsx("path",{d:"M170 92C186 92 184 60 200 60",className:"ga-arc"}),l.jsx("path",{d:"M195 56l5 4-5 4",className:"ga-arrow"}),l.jsx(ir,{x:200,y:22,w:226,h:160}),l.jsx("text",{x:214,y:46,className:"ga-t ga-strong",children:"tests"}),l.jsx("text",{x:412,y:46,className:"ga-s",textAnchor:"end",children:"Sonnet 5 · 38s"}),l.jsx("line",{x1:200,y1:56,x2:426,y2:56,className:"ga-line"}),l.jsx("text",{x:214,y:76,className:"ga-cap",children:"PROMPT"}),l.jsx("text",{x:214,y:92,className:"ga-t",children:"Run the suite and fix what fails"}),l.jsx("text",{x:214,y:116,className:"ga-cap",children:"TOOLS · 6"}),l.jsx(Mi,{x:214,y:122,label:"Read"}),l.jsx(Mi,{x:266,y:122,label:"Edit"}),l.jsx(Mi,{x:318,y:122,label:"Bash",live:!0}),l.jsx("text",{x:214,y:164,className:"ga-cap",children:"TOKENS"}),l.jsx("text",{x:214,y:178,className:"ga-s ga-mono",children:"41k in · 2.1k out · $0.12"})]})}function xF(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return l.jsxs(lr,{children:[l.jsx(ir,{x:14,y:20,w:412,h:160}),l.jsx("text",{x:28,y:44,className:"ga-t ga-strong",children:"This machine"}),l.jsx("text",{x:412,y:44,className:"ga-s",textAnchor:"end",children:"12 cores · up 10d"}),l.jsx("line",{x1:14,y1:56,x2:426,y2:56,className:"ga-line"}),l.jsx("text",{x:28,y:76,className:"ga-cap",children:"CORES"}),e.map((t,n)=>l.jsxs("g",{children:[l.jsx("rect",{x:28+n*15,y:82,width:10,height:30,rx:2,className:"ga-track"}),l.jsx("rect",{x:28+n*15,y:112-t,width:10,height:t,rx:2,className:"ga-accent"})]},n)),l.jsx("text",{x:28,y:136,className:"ga-cap",children:"MEMORY"}),l.jsx("rect",{x:28,y:143,width:178,height:5,rx:2.5,className:"ga-track"}),l.jsx("rect",{x:28,y:143,width:105,height:5,rx:2.5,className:"ga-accent"}),l.jsx("text",{x:28,y:165,className:"ga-s",children:"18.9 GB of 32.0 GB"}),l.jsx("text",{x:240,y:76,className:"ga-cap",children:"THERMAL"}),l.jsx("text",{x:240,y:100,className:"ga-big",children:"66 °C"}),l.jsx("text",{x:240,y:118,className:"ga-s ga-ok",children:"running at full speed"}),l.jsx("text",{x:240,y:142,className:"ga-cap",children:"BUSIEST PROCESSES"}),l.jsx("text",{x:240,y:160,className:"ga-s ga-mono",children:"node · claude"}),l.jsx("text",{x:412,y:160,className:"ga-s ga-mono",textAnchor:"end",children:"38%"}),l.jsx("text",{x:240,y:176,className:"ga-s ga-mono",children:"esbuild"}),l.jsx("text",{x:412,y:176,className:"ga-s ga-mono",textAnchor:"end",children:"21%"})]})}function bF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:14,y:40,width:188,height:120,rx:10,className:"ga-screen"}),l.jsx("text",{x:28,y:60,className:"ga-cap",children:"~/MY-PROJECT"}),l.jsx("line",{x1:14,y1:70,x2:202,y2:70,className:"ga-line"}),l.jsxs("text",{x:28,y:100,className:"ga-t ga-mono",children:[l.jsx("tspan",{className:"ga-accent",children:"$"})," claude"]}),l.jsx("rect",{x:86,y:90,width:7,height:13,className:"ga-caret ga-blink"}),l.jsx("text",{x:28,y:130,className:"ga-s ga-mono",children:"or: codex"}),l.jsx("path",{d:"M210 100H238",className:"ga-arc"}),l.jsx("path",{d:"M233 95l6 5-6 5",className:"ga-arrow"}),l.jsx("rect",{x:250,y:40,width:176,height:120,rx:10,className:"ga-canvas"}),l.jsx("g",{className:"ga-pop",children:l.jsx(Ci,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function kF(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,y:16,w:232,h:170}),l.jsx("text",{x:28,y:40,className:"ga-t ga-strong",children:"Claude accounts"}),l.jsx(g_,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),l.jsx(g_,{x:220,y:33,d:"M3.3 10.7L10.7 3.3M5.2 3.3h5.5v5.5"}),l.jsx("line",{x1:14,y1:52,x2:246,y2:52,className:"ga-line"}),l.jsx(Ar,{x:28,y:74,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),l.jsx("rect",{x:190,y:62,width:44,height:18,rx:9,className:"ga-accent"}),l.jsx("text",{x:212,y:74,className:"ga-s ga-on-accent",textAnchor:"middle",children:"active"}),l.jsx("line",{x1:14,y1:140,x2:246,y2:140,className:"ga-line"}),l.jsx(Ar,{x:28,y:160,email:"personal@me.dev",state:"signed in",tone:"ok"}),l.jsx("rect",{x:188,y:148,width:46,height:18,rx:9,className:"ga-chip"}),l.jsx("text",{x:211,y:160,className:"ga-s",textAnchor:"middle",children:"switch"}),l.jsx(Jx,{x:221,y:161}),l.jsx("path",{d:"M250 40C270 40 262 78 282 78",className:"ga-arc"}),l.jsx("path",{d:"M277 74l5 4-5 4",className:"ga-arrow"}),l.jsx(ir,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),l.jsx("g",{className:"ga-pop",children:l.jsx(Ar,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function _F(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,label:"THIS MACHINE"}),l.jsx(qd,{x:28,y:60}),l.jsx("g",{className:"ga-swap-out",children:l.jsx(Ar,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),l.jsx("g",{className:"ga-swap-in",children:l.jsx(Ar,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),l.jsx(ir,{x:250,label:"ANOTHER MACHINE"}),l.jsx(qd,{x:264,y:60}),l.jsx(Ar,{x:264,y:98,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),l.jsx("path",{d:"M246 120C234 80 206 80 194 120",className:"ga-arc"}),l.jsx("g",{className:"ga-travel ga-travel-low",transform:"translate(220 90)",children:l.jsx(e0,{})})]})}const NF=[{art:l.jsx(gF,{}),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:l.jsx(yF,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:l.jsx(vF,{}),line:"Click any node: its prompt, every tool call, tokens and timing."},{art:l.jsx(wF,{}),line:"What each session costs, and how much quota is left."},{art:l.jsx(xF,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:l.jsx(kF,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:l.jsx(_F,{}),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:l.jsx(bF,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function SF(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,label:"THIS MACHINE"}),l.jsx(Ar,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"}),l.jsx("rect",{x:40,y:94,width:86,height:20,rx:10,className:"ga-pill-warn"}),l.jsx("text",{x:83,y:108,className:"ga-s ga-warn",textAnchor:"middle",children:"sign in again"}),l.jsx("line",{x1:198,y1:100,x2:242,y2:100,className:"ga-off"}),l.jsx(ir,{x:250,label:"ANOTHER MACHINE"}),l.jsx(Ar,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function jF(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,label:"THIS MACHINE"}),l.jsx(qd,{x:28,y:60}),l.jsx(ad,{x:28,y:92,name:"Ana's MacBook"}),l.jsx(ad,{x:28,y:114,name:"Dorin's PC"}),l.jsx(ir,{x:250,label:"ANOTHER MACHINE"}),l.jsx(qd,{x:264,y:60}),l.jsx(ad,{x:264,y:92,name:"Your MacBook"}),l.jsx(ad,{x:264,y:114,name:"Dorin's PC"}),l.jsx("line",{x1:196,y1:100,x2:244,y2:100,className:"ga-arc"}),l.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping"}),l.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping ga-ping-2"}),l.jsx("circle",{cx:220,cy:100,r:3,className:"ga-accent"})]})}function EF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:90,y:18,width:260,height:164,rx:10,className:"ga-screen"}),l.jsx("text",{x:106,y:42,className:"ga-t ga-strong",children:"This deck on the network"}),l.jsx("line",{x1:90,y1:54,x2:350,y2:54,className:"ga-line"}),l.jsx("text",{x:106,y:76,className:"ga-cap",children:"SHARE THESE ACCOUNTS"}),l.jsx(m_,{x:106,y:88,on:!0}),l.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),l.jsx(m_,{x:106,y:112}),l.jsx("text",{x:126,y:122,className:"ga-s ga-mono",children:"personal@me.dev"}),l.jsx("text",{x:106,y:150,className:"ga-cap",children:"PAIRING"}),l.jsx("text",{x:106,y:168,className:"ga-s",children:"Say yes to every deck that asks"}),l.jsx(PA,{x:304,y:157,on:!0}),l.jsx(Jx,{x:115,y:97})]})}function CF(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,label:"THIS MACHINE"}),l.jsx("g",{className:"ga-swap-out",children:l.jsx(Ar,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),l.jsx("g",{className:"ga-swap-in",children:l.jsx(Ar,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),l.jsx(ir,{x:250,label:"ANOTHER MACHINE"}),l.jsx(Ar,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),l.jsx("path",{d:"M246 96C234 56 206 56 194 96",className:"ga-arc"}),l.jsx("g",{className:"ga-travel",transform:"translate(220 66)",children:l.jsx(e0,{})})]})}const TF=[{art:l.jsx(SF,{}),line:"A login can expire on one machine while it still works on another."},{art:l.jsx(jF,{}),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:l.jsx(EF,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:l.jsx(CF,{}),line:"An expired login is copied from a paired machine within a minute."}];function AF(){return l.jsxs("svg",{className:"guide-art",viewBox:"0 0 232 60","aria-hidden":!0,focusable:"false",children:[l.jsx("rect",{x:1,y:14,width:78,height:42,rx:7,className:"ga-screen"}),l.jsx("circle",{cx:13,cy:29,r:3,className:"ga-warn"}),l.jsx("rect",{x:21,y:27,width:46,height:4,rx:2,className:"ga-track"}),l.jsx("rect",{x:13,y:39,width:40,height:3,rx:1.5,className:"ga-track"}),l.jsx("rect",{x:153,y:14,width:78,height:42,rx:7,className:"ga-screen"}),l.jsx("circle",{cx:165,cy:29,r:3,className:"ga-ok"}),l.jsx("rect",{x:173,y:27,width:46,height:4,rx:2,className:"ga-track"}),l.jsx("rect",{x:165,y:39,width:40,height:3,rx:1.5,className:"ga-accent"}),l.jsx("path",{d:"M150 36C138 6 94 6 82 36",className:"ga-arc"}),l.jsx("g",{transform:"translate(116 13)",children:l.jsx(e0,{})})]})}async function fp(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const RF={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."},MF={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function w_(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||Xt(n,t)}function IF({status:e,manual:t,onClose:n,onChanged:s}){var P,H;const a=x.useRef(null),i=dn(n,{focusRef:a}),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(null),[y,w]=x.useState(null),[N,_]=x.useState(null),[j,k]=x.useState(null),[S,E]=x.useState(()=>Date.now());x.useEffect(()=>{const L=window.setInterval(()=>E(Date.now()),1e3);return()=>window.clearInterval(L)},[]);const C=x.useRef(!0);x.useEffect(()=>()=>{C.current=!1},[]);const T=x.useRef(null),R=x.useCallback(L=>ah(T.current)?(T.current=L,_(L),!0):!1,[]),I=x.useCallback(()=>{T.current=null,C.current&&_(null)},[]),F=L=>{const U=la(N,L);return{disabled:U.disabled,"aria-busy":U.busy}},W=L=>(h==null?void 0:h.field)===L?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},O=L=>m(U=>U&&U.field===L?null:U),B=x.useCallback(async()=>{const L=GF(c);if(!L){m({text:$F(c),field:"addr"});return}const U=`${L.addr}:${L.port}`,$=e.peers.find(V=>V.addr===L.addr&&V.port===L.port&&V.paired);if($){m({text:`Already paired with ${$.name} at that address.`,field:"addr"});return}if(t.includes(U)){m({text:"This deck already calls that address.",field:"addr"});return}if(R("add"))try{const V=await fp("/api/prefs",{lan:{manual:[...t,U]}});if(!C.current)return;V!=null&&V.ok?(m(null),u(""),s(),n()):m({text:Xt("add that address",V),field:"addr"})}catch{C.current&&m({text:Xt("add that address",null),field:"addr"})}finally{I()}},[c,t,e.peers,s,n,R,I]),Z=x.useCallback(async L=>{if(!R(`invite:${L}`))return;const U=L==="make"?"make an invite":"cancel that invite";try{const $=await fp("/api/lan/invite",{action:L});if(!C.current)return;$!=null&&$.ok?(m(null),w(null),s()):m({text:w_(MF,$,U)})}catch{C.current&&m({text:Xt(U,null)})}finally{I()}},[s,R,I]),Q=x.useCallback(async()=>{const L=f.trim();if(!(!L||!R("join"))){k(null);try{const U=await fp("/api/lan/invite",{action:"join",token:L});if(!C.current)return;U!=null&&U.ok?(p(""),m(null),s(),n()):(U==null?void 0:U.reason)==="unreachable"&&Array.isArray(U.tried)&&U.tried.length?(k(U.tried),m(null)):(k(null),m({text:w_(RF,U,"use that invite"),field:"join"}))}catch{C.current&&m({text:Xt("use that invite",null),field:"join"})}finally{I()}}},[f,s,n,R,I]),M=x.useCallback(async(L,U)=>{try{await navigator.clipboard.writeText(L),w(U),window.setTimeout(()=>{C.current&&w($=>$===U?null:$)},1600)}catch{m({text:"Could not copy it — select the text and copy it by hand."})}},[]),K=e.invite&&e.invite.expiresAt>S?e.invite:null,G=((P=e.reach)==null?void 0:P.steps)??[];return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:i,className:"modal lan-add",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[h&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:h.text}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),((H=e.reach)==null?void 0:H.blocked)&&l.jsxs("div",{className:"ap-lan-reach",children:[l.jsx("p",{className:"lan-warn",children:e.reach.text}),l.jsx("p",{className:"lan-note",children:"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."}),G.length>0&&l.jsxs("details",{className:"ap-lan-reach-fix",children:[l.jsx("summary",{children:"or let them find this deck on their own"}),l.jsxs("p",{className:"lan-note",children:["Run this in PowerShell ",l.jsx("strong",{children:"as Administrator"}),", then restart the deck.",e.reach.category==="Public"&&l.jsx(l.Fragment,{children:" The first line marks this network as a home or office one — leave it out on a network you do not trust."})]}),l.jsx("pre",{className:"ap-lan-cmd",children:l.jsx("code",{children:G.join(`
90
+ `)})}),l.jsx("button",{type:"button",className:"ap-manage-btn",...F("copy:fix"),onClick:()=>void M(G.join(`
91
+ `),"fix"),title:"Copy these lines, then paste them into an elevated PowerShell",children:y==="fix"?"copied":"copy command"})]})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"By address"}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("input",{ref:a,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:c,placeholder:"192.168.1.5:54340",spellCheck:!1,...W("addr"),onChange:L=>{u(L.target.value),O("addr")},onKeyDown:L=>{L.key==="Enter"&&B()}}),c.trim()!==""&&l.jsx("button",{type:"button",className:"ap-manage-btn",...F("add"),onClick:()=>void B(),title:"Add it to the decks this one calls, starting now.",children:"add"})]}),l.jsx("p",{className:"lan-note",children:"This deck calls that address until somebody there accepts."})]}),l.jsxs("div",{className:"modal-section",children:[l.jsxs("h3",{className:"lan-h",children:["With an invite",!K&&l.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...F("invite:make"),onClick:()=>void Z("make"),title:"One piece of text you send them. They paste it, and the two decks pair — nobody has to press anything here.",children:N==="invite:make"?"making…":"make one to send"})]}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:f,placeholder:"paste one you were sent",spellCheck:!1,...W("join"),onChange:L=>{p(L.target.value),k(null),O("join")},onKeyDown:L=>{L.key==="Enter"&&Q()}}),f.trim()!==""&&l.jsx("button",{type:"button",className:"ap-manage-btn",...F("join"),onClick:()=>void Q(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:N==="join"?"joining…":"join"})]}),l.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),j&&l.jsxs("div",{className:"ap-lan-tried",children:[l.jsx("span",{className:"lan-note",children:"Nothing answered at any address in that invite. Check that deck is running with its Local network switch on."}),j.map(L=>l.jsxs("span",{className:"ap-lan-tried-row",children:[l.jsx("code",{className:"ap-lan-code",children:L.addr}),l.jsx("span",{className:"ap-lan-bad",children:L.why})]},L.addr))]}),K&&l.jsxs("div",{className:"ap-lan-invite",children:[l.jsxs("div",{className:"ap-lan-invite-head",children:[l.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),l.jsxs("span",{className:"ap-lan-invite-left",children:[YF(K.expiresAt,S)," left"]})]}),l.jsx("code",{className:"ap-lan-token",children:K.token}),l.jsxs("div",{className:"ap-lan-acts",children:[l.jsx("button",{type:"button",className:"ap-manage-btn",...F("copy:invite"),onClick:()=>void M(K.token,"invite"),title:"Copy it, and send it however you already talk to them",children:y==="invite"?"copied":"copy"}),l.jsx("button",{type:"button",className:"ap-manage-btn",...F("invite:withdraw"),onClick:()=>void Z("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),l.jsx("p",{className:"lan-warn",children:"Anyone who gets this text can pair with this deck until it runs out."})]})]})]})]})}),document.body)}function $F(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 OF=1e3;function PF(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=Vr(e,t);return`${n} · ${s==="now"?"just now":s}`}function v_(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}function LF(){return l.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:[l.jsx("path",{d:"M9.6 2.4l2 2L5 11l-2.6.6L3 9z"}),l.jsx("path",{d:"M8.4 3.6l2 2"})]})}function x_(){return l.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:[l.jsx("rect",{x:"2.5",y:"3",width:"11",height:"7.5",rx:"1.2"}),l.jsx("path",{d:"M1 13h14"})]})}function od({dir:e,gate:t=!1}){const n=t?12:8;return l.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:l.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 DF={works:"works here",expired:"expired here",missing:"not on this deck"},qF={works:"works there",broken:"broken there",unknown:"not offered by that deck"};function FF(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${DF[e.here]}, ${qF[e.there]}, ${t}${e.usedThere?", in use there":""}.`}function BF({row:e,source:t,status:n,accounts:s,now:a,busy:i,onClose:c,onRename:u,onCheck:f,onVerb:p,onSettings:h,twins:m=[],onUnpair:y}){var it,bt,nt,pt;const w=x.useRef(null),N=dn(c,{focusRef:w}),[_,j]=x.useState(null),[k,S]=x.useState(null),[E,C]=x.useState(!1),T=x.useRef(0),[R,I]=x.useState(null),[F,W]=x.useState(!1),[O,B]=x.useState(0),Z=x.useRef(null),Q=x.useRef(!0);x.useEffect(()=>()=>{Q.current=!1},[]);const M=_!=null;x.useEffect(()=>{var fe;M&&((fe=Z.current)==null||fe.select())},[M]),x.useEffect(()=>{if(!E)return;const fe=window.setTimeout(()=>C(!1),4e3);return()=>window.clearTimeout(fe)},[E]),x.useEffect(()=>{if(!R)return;const fe=window.setTimeout(()=>I(null),4e3);return()=>window.clearTimeout(fe)},[R]);const K=fe=>{const lt=la(i,fe);return{disabled:lt.disabled,"aria-busy":lt.busy}},G=async fe=>{const lt=await fe();return Q.current&&S(lt),lt==null},{peer:P,stranger:H}=t,L=e.kind==="paired",U=e.self??e.name,$=e.kind!=="dialling",V=e.kind==="dialling"?null:e.fp,he=P?P.addr?`${P.addr}:${P.port}`:"":H?H.port?`${H.addr}:${H.port}`:H.addr:e.addr,Y=(P==null?void 0:P.about)??null,J=((it=n.about)==null?void 0:it.version)??null,z=async fe=>{const lt=fe.trim()===U?"":fe;await G(()=>u(lt))&&j(null)},re=async()=>{if(V)try{if(await navigator.clipboard.writeText(V),!Q.current)return;W(!0),window.setTimeout(()=>{Q.current&&W(!1)},1600)}catch{Q.current&&S("Could not copy it — select the fingerprint and copy it by hand.")}},le=L?P!=null&&P.waiting?P.lastSeen!=null?"not said — it runs an older version":"not said yet — it says when it next calls":P!=null&&P.offers?"not said — it runs an older version":"not reached yet":"shown once paired",me=v_(n.about),ge=v_(Y),Me=Y!=null&&Y.version&&J?t8(Y.version,J):null,qe=P?LA(P.last,a):null,Ve=(bt=P==null?void 0:P.last)!=null&&bt.error&&qe&&qe.text!==P.last.error?P.last.error:null,Ue=((nt=P==null?void 0:P.last)==null?void 0:nt.done)??[],Se=!!qe&&!!Ve&&!e.quiet&&e.state.startsWith(qe.text),Qe=L||e.kind==="dialling",Ne=P?P.waiting?null:P.manual?"added by address":"on this network":e.kind==="nearby"?"heard on this network":"asked this deck to pair",_e=e.tone==="bad"?"bad":L?e.here?"up":"down":"loose",ue=i===`check:${e.fp}`,je=(P==null?void 0:P.offers)??null,Ce=_e==="up"?(je==null?void 0:je.current)??null:null,Fe=Ce&&"key"in Ce?Ce.key:null,We=!!Ce&&"hidden"in Ce,He=!!Ce&&"other"in Ce,ot=L?r8((je==null?void 0:je.accounts)??null,s,n.shared??[],Fe):[],wt=ot.filter(fe=>fe.in==null&&fe.out==="cut"),ut=ot.some(fe=>fe.in!=null),ee=ot.some(fe=>fe.out!=null),ke=new Map(Ue.map(fe=>[fe.email,fe])),Be=Ue.filter(fe=>!ot.some(lt=>lt.email===fe.email)),et=L?je?je.accounts.length===0?"That deck offers nothing. Nobody there has chosen a login to share.":null:P!=null&&P.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.":(pt=P==null?void 0:P.last)!=null&&pt.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,ht=je&&(P!=null&&P.last)&&P.last.at-je.at>OF?Vr(je.at,a):null,Je=[];L&&(P!=null&&P.pairedAt)?Je.push({label:"Paired",value:PF(P.pairedAt,a),tone:"meta"}):e.kind==="declined"&&H&&Je.push({label:"Paired",value:`no · you said no ${n0(H.at,a)}`,tone:"meta"}),Je.push({label:"Fingerprint",value:V?l.jsxs("span",{className:"lan-fp",children:[l.jsx("code",{className:"ap-lan-code",children:V}),l.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void re(),"aria-label":F?"Fingerprint copied":"Copy the fingerprint",children:F?"copied":"copy"})]}):"not known — nothing has answered there",tone:V?void 0:"quiet"});const tt=m.length?[{row:e,peer:P??null},...m]:[];return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:l.jsxs("div",{ref:N,className:"modal lan-peer","data-tone":e.tone,onClick:fe=>fe.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-peer-title","aria-describedby":"lan-peer-sub",children:[l.jsxs("header",{className:"modal-head lan-peer-head",children:[l.jsx("i",{className:e.here?"ap-pulse":"ap-dot","aria-hidden":!0}),l.jsxs("div",{className:"lan-peer-id",children:[M?l.jsxs("form",{className:"lan-peer-edit",onSubmit:fe=>{fe.preventDefault(),z(_??"")},children:[l.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),l.jsx("input",{ref:Z,className:"ap-manage-input lan-peer-input",value:_??"",maxLength:48,placeholder:U,"aria-label":"Name for this deck, shown on this deck only",onChange:fe=>j(fe.target.value)}),l.jsx("button",{type:"submit",className:"ap-manage-btn",...K(`alias:${e.fp}`),children:"save"}),l.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>j(null),children:"cancel"})]}):l.jsxs("span",{className:"lan-peer-title",children:[l.jsx("span",{id:"lan-peer-title",className:"lan-peer-name",children:e.name}),$&&l.jsx("button",{type:"button",className:"glyph-btn lan-peer-rename",onClick:()=>{S(null),j(e.name)},"aria-label":`Rename ${e.name} on this deck`,title:"Give it a name of your own. Only this deck sees it.",children:l.jsx(LF,{})})]}),l.jsxs("p",{id:"lan-peer-sub",className:"lan-peer-sub",children:[e.self&&l.jsxs(l.Fragment,{children:["calls itself ",l.jsx("span",{className:"lan-peer-self",children:e.self}),M&&l.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...K(`alias:${e.fp}`),onClick:()=>void z(""),children:"use this name"}),l.jsx("span",{className:"vis-hidden",children:". "}),!e.quiet&&l.jsx("span",{"aria-hidden":!0,children:" · "})]}),l.jsx("span",{className:e.quiet?"vis-hidden":"lan-peer-state",children:e.state})]})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{ref:w,type:"button",className:"glyph-btn",onClick:c,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body lan-peer-body",children:[k&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",children:k}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>S(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),l.jsxs("div",{className:"lan-map","data-link":_e,"data-asking":ue||void 0,"data-bus":ot.length>0||void 0,children:[l.jsxs("div",{className:"lan-ends",children:[l.jsxs("p",{className:"lan-end",children:[l.jsx("span",{className:"lan-end-name",children:"This deck"}),me&&l.jsx("span",{className:"lan-end-runs",children:me}),L&&n.shareActive===!1&&l.jsx("span",{className:"lan-end-note",children:"current account hidden"})]}),l.jsxs("p",{className:"lan-end","data-side":"there",children:[l.jsx("span",{className:"lan-end-name",children:e.name}),e.kind!=="dialling"&&l.jsxs("span",{className:"lan-end-runs",children:[ge??(Y?"not said":le),Me?` · ${Me<0?"older":"newer"}`:null]}),We&&l.jsx("span",{className:"lan-end-note",children:"current account hidden"}),He&&l.jsx("span",{className:"lan-end-note",children:"on another account"})]})]}),l.jsxs("div",{className:"lan-link",children:[l.jsx(x_,{}),l.jsxs("span",{className:"lan-span",children:[l.jsxs("span",{className:"lan-wire","aria-hidden":!0,children:[l.jsx("i",{className:"lan-glint","data-dir":"out"}),l.jsx("i",{className:"lan-glint","data-dir":"in"})]}),l.jsx("span",{className:"lan-link-label",children:he?l.jsx("code",{className:"ap-lan-code",children:he}):"none here — it calls this deck"})]}),l.jsx(x_,{}),(he&&Ne||Qe)&&l.jsxs("p",{className:"lan-link-sub",children:[he&&Ne,he&&Ne&&Qe&&" · ",Qe&&(qe?Se?l.jsx("code",{className:"ap-lan-code",children:Ve}):l.jsx("span",{className:"lan-round","data-tone":qe.tone,children:qe.text.replace(/ · now$/," · just now")}):"not asked yet"),Qe&&Ve&&!Se&&l.jsx("code",{className:"lan-fact-raw",children:Ve})]}),Be.length>0&&l.jsx("ul",{className:"lan-done",children:Be.map(fe=>l.jsxs("li",{"data-ok":fe.ok,children:[fe.email," ",l.jsx("span",{className:"lan-done-what",children:fe.ok?"arrived":"did not arrive"})]},`${fe.email}:${fe.action}`))}),(P==null?void 0:P.waiting)&&l.jsx("p",{className:"lan-note lan-link-note",children:e.hint})]}),ot.length>0&&l.jsx("ul",{className:"lan-lanes",role:"list","aria-label":`Logins between this deck and ${e.name}`,children:ot.map((fe,lt)=>{const vt=ke.get(fe.email),Gt=fe.out==="live"||fe.in!=null&&fe.in!=="cut";return l.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":fe.tone,"data-draw":fe.in&&fe.out?"both":fe.in?"in":"out","data-used-there":fe.usedThere||void 0,style:{"--i":lt},children:[l.jsx("i",{className:"lan-pip","data-end":"here","data-state":fe.here,"aria-hidden":!0}),l.jsxs("span",{className:"lan-track",children:[l.jsxs("span",{className:"lan-wire","data-flow":Gt?"live":"cut","aria-hidden":!0,children:[(fe.in==="live"||fe.in==="wait")&&l.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":fe.in}),fe.out==="live"&&l.jsx("i",{className:"lan-glint","data-dir":"out"})]}),fe.in&&fe.in!=="cut"&&l.jsx(od,{dir:"in",gate:fe.in==="blocked"}),fe.out==="live"&&l.jsx(od,{dir:"out"}),l.jsx("span",{className:"lan-lane-email",children:fe.email})]}),l.jsx("i",{className:"lan-pip","data-end":"there","data-state":fe.there,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:FF(fe)}),(fe.caption||vt)&&l.jsxs("span",{className:"lan-lane-note",children:[fe.caption,fe.caption&&vt&&" · ",vt&&l.jsx("span",{className:"lan-lane-done","data-ok":vt.ok,children:vt.ok?"arrived last round":"did not arrive last round"})]})]},fe.key)})},O),L&&l.jsxs(l.Fragment,{children:[wt.length>0&&l.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",wt.length===1?wt[0].email:"the expired ones"," until you sign in again here."]}),et&&l.jsx("p",{className:"lan-empty",children:et}),ht&&l.jsxs("p",{className:"lan-stale",children:["As of ",ht==="now"?"just now":ht,", when it last answered."]}),l.jsxs("div",{className:"lan-legend",children:[ut&&l.jsxs("span",{className:"lan-key",children:[l.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:l.jsx(od,{dir:"in"})}),"from ",e.name]}),ee?l.jsxs("span",{className:"lan-key",children:[l.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:l.jsx(od,{dir:"out"})}),"from this deck, to every paired deck"]}):l.jsx("span",{className:"lan-key",children:"This deck offers nothing yet."}),l.jsx("button",{type:"button",className:"ap-lan-word lan-legend-act",onClick:h,"aria-label":"Change what this deck offers",children:"change"})]})]})]}),l.jsx("dl",{className:"lan-facts",children:Je.map(fe=>l.jsxs("div",{className:"lan-fact","data-tone":fe.tone,children:[l.jsx("dt",{children:fe.label}),l.jsx("dd",{children:fe.value})]},fe.label))}),tt.length>1&&l.jsxs("div",{className:"modal-section",children:[l.jsxs("h3",{className:"lan-h",children:[tt.length," decks on this machine"]}),l.jsx("ul",{className:"lan-twins",role:"list",children:tt.map((fe,lt)=>{var Vn,Yn,qt,Kn;const vt=(Vn=fe.peer)!=null&&Vn.addr?`${fe.peer.addr}:${fe.peer.port}`:fe.row.addr,Gt=vt||fe.row.fp,Dt=(Yn=fe.peer)!=null&&Yn.pairedAt?Vr(fe.peer.pairedAt,a):null,Gn=[(Kn=(qt=fe.peer)==null?void 0:qt.about)!=null&&Kn.version?`runs ${fe.peer.about.version}`:null,Dt?`paired ${Dt==="now"?"just now":Dt}`:null,fe.row.state].filter(Boolean).join(" · "),It=fe.row.fp;return l.jsxs("li",{role:"listitem",className:"lan-twin","data-tone":fe.row.tone,children:[l.jsx("i",{className:fe.row.here?"ap-pulse":"ap-dot","aria-hidden":!0}),vt?l.jsx("code",{className:"ap-lan-code lan-twin-at",children:vt}):l.jsx("span",{className:"lan-twin-at lan-twin-none",children:"no address here"}),l.jsx("code",{className:"ap-lan-code lan-twin-fp",children:It}),lt>0&&y&&l.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${R===It?" armed":""}`,...K(`unpair:${It}`),onKeyDown:te=>{te.repeat&&te.preventDefault()},onClick:()=>{if(R!==It){I(It),T.current=Date.now();return}Date.now()-T.current<gc||(I(null),G(()=>y(It)))},"aria-label":R===It?`Confirm unpairing ${Gt}`:`Unpair ${Gt}`,title:R===It?"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:i===`unpair:${It}`?"unpairing…":R===It?"confirm":"unpair"}),l.jsx("span",{className:"lan-twin-meta",children:lt===0?`${Gn} · shown above`:Gn})]},It)})})]})]}),l.jsxs("footer",{className:"lan-peer-foot",children:[e.kind==="asks"&&l.jsx("p",{className:"lan-foot-note",children:"This deck is now asking to pair. Answer it from the panel behind this."}),L&&!(P!=null&&P.waiting)&&l.jsx("button",{type:"button",className:"btn",...K(`check:${e.fp}`),onClick:()=>void G(f).then(fe=>{fe&&Q.current&&B(lt=>lt+1)}),title:"Ask this deck now instead of waiting for the next round",children:i===`check:${e.fp}`?"Checking…":"Check now"}),e.kind==="paired"&&l.jsx("button",{type:"button",className:`btn danger lan-peer-verb${E?" armed":""}`,...K(`unpair:${e.fp}`),onKeyDown:fe=>{fe.repeat&&fe.preventDefault()},onClick:()=>{if(!E){C(!0),T.current=Date.now();return}Date.now()-T.current<gc||(C(!1),G(p))},"aria-label":E?`Confirm unpairing ${e.name}`:`Unpair ${e.name}`,title:E?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:i===`unpair:${e.fp}`?"Unpairing…":E?"Confirm unpair":"Unpair"}),e.kind==="nearby"&&l.jsx("button",{type:"button",className:"btn primary lan-peer-verb",...K(`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:i===`accept:${e.fp}`?"Asking…":"Ask to pair"}),e.kind==="dialling"&&l.jsx("button",{type:"button",className:"btn lan-peer-verb",...K(`drop:${e.fp}`),onClick:()=>void G(p),title:"Stop trying this address. Nothing was ever paired here.",children:i===`drop:${e.fp}`?"Stopping…":"Stop dialling"}),e.kind==="declined"&&l.jsx("button",{type:"button",className:"btn lan-peer-verb",...K(`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:i===`allow:${e.fp}`?"Allowing…":"Let it ask again"})]})]})}),document.body)}function zF({status:e,accounts:t,onClose:n,onChanged:s}){const a=dn(n),[i,c]=x.useState(null),[u,f]=x.useState(null),[p,h]=x.useState(!1),[m,y]=x.useState(!1),w=x.useRef(0);x.useEffect(()=>{if(!m)return;const B=window.setTimeout(()=>y(!1),4e3);return()=>window.clearTimeout(B)},[m]);const[N,_]=x.useState(null),j=x.useRef(null),k=B=>{const Z=la(N,B);return{disabled:Z.disabled,"aria-busy":Z.busy}},S=x.useRef(null),E=x.useRef(!0);x.useEffect(()=>()=>{E.current=!1},[]),x.useEffect(()=>{S.current&&VF(S.current,e.shared??[])&&(S.current=null)},[e.shared]);const C=x.useCallback(async(B,Z,Q="write")=>{j.current=Q,_(Q);try{const K=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:B})})).json().catch(()=>null);return E.current?(K!=null&&K.ok?f(null):f(Xt(Z,K)),s(),(K==null?void 0:K.ok)===!0):!1}catch{return E.current&&f(Xt(Z,null)),!1}finally{j.current=null,E.current&&_(null)}},[s]),T=x.useCallback(async()=>{if(i!=null&&i!==(e.name??"")){if(!await C({name:i},"save the name","name"))return;E.current&&c(null)}n()},[i,e.name,C,n]),R=async()=>{if(!e.fp)return;const B=await Vx(e.fp);if(E.current){if(!B){f("Could not copy it — select the fingerprint and copy it by hand.");return}h(!0),window.setTimeout(()=>{E.current&&h(!1)},1600)}},I=new Set(S.current??e.shared??[]),F=e.autoAsk!==!1,W=e.autoAccept!==!1,O=e.shareActive!==!1;return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:a,className:"modal lan-modal",onClick:B=>B.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[u&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",children:u}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"Name"}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("span",{className:"ap-lan-label",children:"appear as"}),l.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:i??e.name??"",placeholder:"this machine",onChange:B=>c(B.target.value),onKeyDown:B=>{B.key!=="Enter"||i==null||(C({name:i},"save the name","name"),c(null))}}),i!=null&&i!==(e.name??"")&&l.jsx("button",{type:"button",className:"ap-manage-btn",...k("name"),onClick:()=>{C({name:i},"save the name","name"),c(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),e.fp?l.jsxs("span",{className:"lan-fp",children:[l.jsx("code",{className:"ap-lan-code",children:e.fp}),l.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void R(),"aria-label":p?"Fingerprint copied":"Copy this deck's fingerprint",children:p?"copied":"copy"})]}):l.jsx("span",{className:"ap-lan-label",children:"not known yet"})]})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"Share these accounts"}),l.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&l.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(B=>l.jsxs("label",{className:"ap-lan-pick",title:B.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:[l.jsx("input",{type:"checkbox",checked:I.has(B.key),onChange:Z=>{const Q=new Set(S.current??e.shared??[]);Z.target.checked?Q.add(B.key):Q.delete(B.key),S.current=[...Q],C({shared:[...Q]},Z.target.checked?"share that account":"stop sharing that account")}}),l.jsx("span",{className:"ap-lan-pick-name",children:B.email}),!B.alive&&l.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},B.key))]}),t.length>0&&l.jsxs("div",{className:"lan-switch",children:[l.jsx("span",{className:"lan-switch-what",children:"Show paired decks which of these this deck is using"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":O,"aria-label":"Show paired decks which of these this deck is using",...k("current"),onClick:()=>void C({shareActive:!O},O?"stop showing which account this deck is using":"show which account this deck is using","current"),title:O?"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:l.jsx("span",{className:"switch-knob"})})]})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"Pairing"}),l.jsxs("div",{className:"lan-switches",children:[l.jsxs("div",{className:"lan-switch",children:[l.jsx("span",{className:"lan-switch-what",children:"Ask every deck this one finds"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":F,"aria-label":"Ask every deck this one finds",...k("ask"),onClick:()=>void C({autoAsk:!F},F?"stop asking automatically":"ask every deck this one finds","ask"),title:F?"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:l.jsx("span",{className:"switch-knob"})})]}),l.jsxs("div",{className:"lan-switch",children:[l.jsx("span",{className:"lan-switch-what",children:"Say yes to every deck that asks"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":W,"aria-label":"Say yes to every deck that asks","data-tone":"warn","data-armed":m||void 0,...k("accept"),onKeyDown:B=>{B.repeat&&B.preventDefault()},onClick:()=>{if(!W&&!m){y(!0),w.current=Date.now();return}m&&Date.now()-w.current<gc||(y(!1),C({autoAccept:!W},W?"stop accepting automatically":"accept every deck that asks","accept"))},title:W?"Stop saying yes for you. A deck that asks waits in the panel again.":m?"Press again to turn it on.":"Say yes for you. Every deck on this network that asks is paired without anybody being asked here.",children:l.jsx("span",{className:"switch-knob"})})]})]}),l.jsx("p",{className:m||W?"lan-warn":"lan-note","aria-live":"polite",children:m?l.jsx(l.Fragment,{children:"Press the switch again to turn it on. Any deck on this network that asks would then be paired, and offered any login ticked above, without you being asked."}):W?l.jsx(l.Fragment,{children:"Any deck on this network that asks is paired, and offered any login ticked above, without you being asked."}):F?l.jsx(l.Fragment,{children:"This deck asks; somebody on the other machine still has to say yes. A request coming the other way waits in the panel for you."}):l.jsxs(l.Fragment,{children:["Nothing pairs on its own. You press ",l.jsx("strong",{children:"ask"})," on a deck you find, and ",l.jsx("strong",{children:"accept"})," on one that asks. A deck you said no to is never asked about again either way."]})})]})]}),l.jsxs("footer",{className:"lan-setup-foot",children:[l.jsx("span",{className:"lan-foot-note",children:"Changes are saved as you make them."}),l.jsx("button",{type:"button",className:"btn primary",...k("name"),onClick:()=>void T(),children:"Done"})]})]})}),document.body)}function Vr(e,t){if(e==null)return"not seen";const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"now";const s=Math.round(n/60);if(s<60)return`${s}m ago`;const a=Math.round(s/60);return a<48?`${a}h ago`:`${Math.round(a/24)}d ago`}const t0={"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"}},UF={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 WF(e){var s;const t=HF[e];if(t)return t;const n=(s=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:s[1];return n&&UF[n]||e}const HF={"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 LA(e,t){if(!e)return null;if(e.error)return t0[e.error]??{text:WF(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${Vr(e.at,t)}`,tone:"idle"};const s=n.filter(i=>i.ok),a=s.length===1?"login":"logins";return s.length===n.length?{text:`${s.length} ${a} arrived · ${Vr(e.at,t)}`,tone:"ok"}:{text:`${s.length} of ${n.length} logins arrived · ${Vr(e.at,t)}`,tone:"bad"}}const fx=5e3,DA=6e4,gc=400;function GF(e){const t=(e??"").trim(),n=t.lastIndexOf(":");if(n<=0||n===t.length-1)return null;const s=t.slice(0,n).trim(),a=Number(t.slice(n+1).trim());return!s||!Number.isInteger(a)||a<1||a>65535||s.includes(":")&&!(s.startsWith("[")&&s.endsWith("]"))?null:{addr:s,port:a}}function Xt(e,t){return t==null?`Could not ${e} — the deck did not answer.`:t.reason?`Could not ${e} — the deck refused it (${t.reason}).`:`Could not ${e}.`}function VF(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function YF(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function qA(e,t){var n,s;return(n=e.last)!=null&&n.error&&!t0[e.last.error]?!1:!!((s=e.last)!=null&&s.at&&t-e.last.at<Fd||e.lastSeen!=null&&t-e.lastSeen<Fd)}const Fd=95e3;function KF(e,t){const n=[],s=[];for(const a of e??[])(qA(a,t)?n:s).push(a);return{online:n,offline:s}}function XF(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 s=(e.peers??[]).filter(w=>w.paired!==!1||w.met);if(!s.length)return{text:"no deck paired yet",tone:"idle"};const a=s.filter(w=>w.waiting),i=s.filter(w=>!w.waiting),c=a.filter(w=>{var N;return!((N=w.last)!=null&&N.error)&&w.lastSeen!=null&&t-w.lastSeen<Fd}),{online:u,offline:f}=KF(i,t),p=[...f,...a.filter(w=>!c.includes(w))],h=u.length+c.length,m=u.filter(w=>{var N;return((N=w.last)==null?void 0:N.error)==="waiting for the other deck to accept this one"});if(h&&m.length===h)return{text:h===1?"1 deck found · waiting for them to accept":`${h} decks found · waiting for them to accept`,tone:"wait"};if(!h)return{text:p.length===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${p.length} decks`,tone:"bad"};const y=h===1?"1 deck ready":`${h} decks ready`;return{text:p.length?`${y} · ${p.length} away`:y,tone:"ok"}}function ZF(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const s=Vr(e,t);return s==="now"?"checked just now":`checked ${s}`}function n0(e,t){const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"just now";const s=Math.round(n/60);return s<60?`${s}m ago`:`${Math.round(s/60)}h ago`}function QF(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<Fd;return{text:n?"online · one-way, it calls in":`one-way · last online ${Vr(e,t)}`,here:n}}function b_(e,t,n){return t?"online":e.lastSeen!=null?`last online ${Vr(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function JF(e,t){var y,w,N,_,j;if(!e)return[];const n=[],s=new Set,a=(k,S)=>k.name.localeCompare(S.name,void 0,{numeric:!0}),i=e.aliases??{},c=(k,S)=>{const E=k?i[k]:void 0;return E&&E!==S?{name:E,self:S}:{name:S}};for(const k of e.pending??[]){if(!(k!=null&&k.fp)||s.has(k.fp))continue;s.add(k.fp);const S=c(k.fp,k.name||k.fp);n.push({fp:k.fp,name:S.name,...S.self?{self:S.self}:{},addr:k.addr??"",kind:"asks",state:`wants to pair · ${n0(k.at,t)}`,tone:"wait",here:!0,hint:`${S.name} at ${k.addr} is waiting for an answer.`})}const u=[],f=[];for(const k of e.peers??[]){const S=k.peerFp??k.fp;if(!S||s.has(S))continue;s.add(S);const E=LA(k.last,t),C=qA(k,t),T=k.addr?`${k.addr}:${k.port}`:"";if(!k.paired&&k.manual&&!k.met){f.push({fp:T,name:T||k.name||S,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 ${T} yet — ${k.last.error}.`:`Dialling ${T} until something answers.`});continue}const R=k.waiting?QF(k.lastSeen,t):null,I=R?R.here:C,F=!R&&E?I?`online · ${E.text.replace(/ · .*$/,"")}`:`${E.text.replace(/ · .*$/,"")} · ${b_(k,I,t)}`:R?R.text:b_(k,I,t),W=(w=k.last)!=null&&w.error?t0[k.last.error]:null,O=!R&&I&&!((N=k.last)!=null&&N.error)&&!(((_=k.last)==null?void 0:_.done)??[]).length,B=k.manual&&!k.met?{name:T}:c(S,k.name||S);u.push({fp:S,name:B.name,...B.self?{self:B.self}:{},addr:k.addr??"",kind:"paired",state:F,quiet:O,tone:W?W.tone==="bad"?"bad":"wait":E?E.tone:I?"ok":"idle",here:R?R.here:C,hint:R?`${B.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 ${Vr(k.lastSeen,t)}.`} Add its address with the + at the top of this section to reach it either way.`:`${B.name}${T?` at ${T}`:""}${(j=k.last)!=null&&j.error?` — ${k.last.error}`:""}`})}n.push(...e8(u).sort(a),...f.sort(a));const p=[];for(const k of e.strangers??[]){if(!(k!=null&&k.fp)||s.has(k.fp))continue;s.add(k.fp);const S=c(k.fp,k.name||k.fp);p.push({fp:k.fp,name:S.name,...S.self?{self:S.self}:{},addr:k.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:`${S.name} at ${k.addr} is on this network and nothing is shared with it.`})}n.push(...p.sort(a));const h=[];for(const k of e.declined??[]){if(!(k!=null&&k.fp)||s.has(k.fp))continue;s.add(k.fp);const S=c(k.fp,k.name||k.fp);h.push({fp:k.fp,name:S.name,...S.self?{self:S.self}:{},addr:k.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${S.name} asked and was turned away. It is not asking any more.`})}n.push(...h.sort(a));const m=new Map;for(const 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 e8(e){const t=new Map;for(const s of e){const a=t.get(s.name);a?a.push(s):t.set(s.name,[s])}const n=[];for(const s of t.values()){const a=[...new Set(s.filter(i=>i.addr).map(i=>i.addr))];if(a.length>1){for(const i of a)n.push(k_(s.filter(c=>c.addr===i)));n.push(...s.filter(i=>!i.addr))}else n.push(k_(s))}return n}function k_(e){const[t,...n]=[...e].sort((s,a)=>Number(a.here)-Number(s.here)||+!!a.addr-+!!s.addr);return n.length?{...t,twins:n}:t}function __(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function N_(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 t8(e,t){const n=/^(\d+)\.(\d+)\.(\d+)/.exec(e??""),s=/^(\d+)\.(\d+)\.(\d+)/.exec(t??"");if(!n||!s)return null;for(let a=1;a<=3;a++){const i=Number(n[a])-Number(s[a]);if(i)return Math.sign(i)}return 0}function n8(e,t,n){const s=t?t.alive?"works here":"expired here":"not on this deck";if(!e.alive){const a=t&&!t.alive?"neither copy works — sign in again here":null;return{there:"broken there",here:s,note:a,tone:a?"bad":"idle"}}return t?t.alive?{there:"works there",here:s,note:null,tone:"ok"}:n?{there:"works there",here:s,note:"repairs next round",tone:"wait"}:{there:"works there",here:s,note:"share it to repair",tone:"bad"}:{there:"works there",here:s,note:"arrives next round",tone:"wait"}}function r8(e,t,n,s=null){const a=new Map(t.map(f=>[f.key,f])),i=new Set(n),c=[],u=new Set;for(const f of e??[]){if(u.has(f.key))continue;u.add(f.key);const p=a.get(f.key)??null,h=i.has(f.key),m=n8(f,p,h),y=p?p.alive?"works":"expired":"missing",w=!f.alive&&p&&!p.alive?m.note:[y==="works"?null:m.here,f.alive?null:m.there,m.note].filter(Boolean).join(" · ")||null;c.push({key:f.key,email:f.email,here:y,there:f.alive?"works":"broken",in:f.alive?m.tone==="wait"?"wait":m.tone==="bad"?"blocked":"live":"cut",out:h&&p?p.alive?"live":"cut":null,caption:w,tone:m.tone,usedThere:s===f.key})}for(const f of n){const p=a.get(f);!p||u.has(f)||(u.add(f),c.push({key:f,email:p.email,here:p.alive?"works":"expired",there:"unknown",in:null,out:p.alive?"live":"cut",caption:p.alive?null:"expired here",tone:p.alive?"ok":"bad",usedThere:!1}))}return c}async function _i(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function s8(e,t){if(!e)return{text:"checking…",tone:"idle",trouble:0};if(!e.enabled)return{text:"Off",tone:"idle",trouble:0};if(e.stalled)return{text:"could not start",tone:"bad",trouble:0};if(!e.running)return{text:"starting…",tone:"wait",trouble:0};const n=t.filter(i=>i.kind==="asks").length;if(n)return{text:n===1?"1 deck wants to pair":`${n} decks want to pair`,tone:"wait",trouble:0};const s=t.filter(i=>i.kind==="paired").length,a=t.filter(i=>i.kind!=="asks"&&i.tone==="bad").length;return s?{text:`${s} paired`,tone:"ok",trouble:a}:{text:"On · none paired yet",tone:"idle",trouble:a}}function a8({accounts:e,onChanged:t,view:n,onOpen:s,onBack:a,closeButton:i}){const[c,u]=x.useState(null),[f,p]=x.useState([]),[h,m]=x.useState(null),[y,w]=x.useState(!1),[N,_]=x.useState(null),j=x.useRef(0),[k,S]=x.useState(!1),[E,C]=x.useState(!1),[T,R]=x.useState(!1),[I,F]=x.useState(null),W=x.useRef(null),O=x.useCallback(ue=>ah(W.current)?(W.current=ue,m(ue),!0):!1,[]),B=x.useCallback(()=>{W.current=null,K.current&&m(null)},[]),Z=ue=>{const je=la(h,ue);return{disabled:je.disabled,"aria-busy":je.busy}},[Q,M]=x.useState(()=>Date.now()),K=x.useRef(!0),G=x.useRef(fx),P=x.useCallback(async()=>{var ue,je;try{const[Ce,Fe]=await Promise.all([fetch("/api/lan").then(We=>We.json()),fetch("/api/prefs").then(We=>We.json())]);if(!K.current)return;Ce!=null&&Ce.ok&&u(Ce),Fe!=null&&Fe.ok&&p(Array.isArray((je=(ue=Fe.prefs)==null?void 0:ue.lan)==null?void 0:je.manual)?Fe.prefs.lan.manual:[]),G.current=(Ce==null?void 0:Ce.enabled)===!0?fx:DA}catch{}},[]);x.useEffect(()=>{K.current=!0;let ue=0;const je=async()=>{M(Date.now()),await P(),K.current&&(ue=window.setTimeout(je,G.current))};return je(),()=>{K.current=!1,window.clearTimeout(ue)}},[P]);const H=x.useCallback(async()=>{const ue=(c==null?void 0:c.enabled)===!0;if(O("switch"))try{const je=await _i("/api/prefs",{lan:{enabled:!ue}});if(!K.current)return;je!=null&&je.ok?(F(null),ue||w(!0)):F(Xt(ue?"turn this off":"turn this on",je)),await P()}catch{K.current&&F(Xt(ue?"turn this off":"turn this on",null))}finally{B()}},[c==null?void 0:c.enabled,P,O,B]),L=x.useCallback(async(ue,je,Ce)=>{if(!O(`${ue}:${je}`))return null;let Fe=null;try{const We=await _i("/api/lan/peer",{action:ue,fp:je});if(!K.current)return null;We!=null&&We.ok?(u(We),F(null)):(Fe=Xt(Ce,We),F(Fe)),await P()}catch{Fe=Xt(Ce,null),K.current&&F(Fe)}finally{B()}return Fe},[P,O,B]),U=x.useCallback(async ue=>{if(!O(`drop:${ue}`))return null;let je=null;try{const Ce=await _i("/api/prefs",{lan:{manual:f.filter(Fe=>Fe!==ue)}});if(!K.current)return null;Ce!=null&&Ce.ok?(F(null),t()):(je=Xt("stop dialling that address",Ce),F(je)),await P()}catch{je=Xt("stop dialling that address",null),K.current&&F(je)}finally{B()}return je},[f,P,t,O,B]),[$,V]=x.useState(null),he=x.useCallback(async(ue,je)=>{if(!O(`alias:${ue}`))return"Something else is still being saved. Try again in a moment.";try{const Ce=await _i("/api/lan/peer",{action:"alias",fp:ue,name:je});return K.current?Ce!=null&&Ce.ok?(u(Ce),null):Xt("rename that deck",Ce):null}catch{return Xt("rename that deck",null)}finally{B()}},[O,B]),Y=x.useCallback(async ue=>{if(!O(`check:${ue}`))return null;try{const je=await _i("/api/lan/sync",{fp:ue});return K.current?je!=null&&je.ok?(u(je),t(),null):(je==null?void 0:je.reason)==="no_address"?"There is no address here to call it on. It calls this deck, and it is up to date each time it does.":Xt("check that deck",je):null}catch{return Xt("check that deck",null)}finally{B()}},[O,B,t]),J=x.useCallback(async()=>{if(O("check"))try{const ue=await _i("/api/lan/sync",{});if(!K.current)return;ue!=null&&ue.ok?(u(ue),F(null)):F(Xt("check the other decks",ue)),t()}catch{K.current&&F(Xt("check the other decks",null))}finally{B()}},[O,B,t]),z=(c==null?void 0:c.enabled)===!0,re=JF(c,Q),le=$?re.find(ue=>{var je;return ue.fp===$||((je=ue.twins)==null?void 0:je.some(Ce=>Ce.fp===$))})??null:null;x.useEffect(()=>{$&&c&&!le&&V(null)},[$,c,le]);const me=re.filter(ue=>ue.kind==="asks"),ge=re.filter(ue=>ue.kind!=="asks"),Me=ge.filter(ue=>ue.here),qe=ge.filter(ue=>!ue.here),Ve=qe.filter(ue=>ue.tone==="bad").length,Ue=T||Me.length===0,Se=XF(c,Q),Qe=ge.filter(ue=>ue.kind==="paired").length,Ne=s8(c,re),_e=l.jsxs(l.Fragment,{children:[k&&c&&l.jsx(IF,{status:c,manual:f,onClose:()=>S(!1),onChanged:()=>{P(),t()}}),E&&l.jsx(OA,{title:"How Local network works",steps:TF,finish:z?void 0:{label:"Turn it on",act:()=>{C(!1),H()}},onClose:()=>C(!1)}),y&&c&&l.jsx(zF,{status:{...c,manualRows:f},accounts:e,manual:f,onClose:()=>w(!1),onChanged:()=>{P(),t()}}),le&&c&&l.jsx(BF,{row:le,source:N_(c,le),status:c,accounts:e,now:Q,busy:h,onClose:()=>V(null),onRename:ue=>he(le.fp,ue),onCheck:()=>Y(le.fp),onVerb:()=>{switch(le.kind){case"paired":return L("unpair",le.fp,"unpair that deck");case"nearby":return L("accept",le.fp,"reach that deck");case"declined":return L("allow",le.fp,"let that deck ask again");case"dialling":return U(le.fp);default:return Promise.resolve(null)}},onSettings:()=>{V(null),w(!0)},twins:(le.twins??[]).map(ue=>({row:ue,peer:N_(c,ue).peer??null})),onUnpair:ue=>L("unpair",ue,"unpair that deck")})]});return n?l.jsxs("div",{className:"ap-lan-view",children:[l.jsxs("div",{className:"ap-header",children:[l.jsx("button",{type:"button",id:"ap-lan-back",className:"glyph-btn ap-back",onClick:a,"aria-label":"Back to Claude accounts",title:"Back to Claude accounts",children:l.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:l.jsx("path",{d:"M8.4 3.4 4.8 7l3.6 3.6"})})}),l.jsx("h2",{id:"ap-lan-title",children:"Local network"}),l.jsxs("div",{className:"ap-header-right",children:[z&&l.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>S(!0),"aria-label":"Add a deck",title:"Reach a deck that has not turned up on its own — by address, or with an invite",children:l.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:[l.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"}),l.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"})]})}),z&&Qe>0&&l.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...Z("check"),onClick:()=>void J(),"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:l.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:[l.jsx("circle",{cx:"7",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),l.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"}),l.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"})]})}),z&&l.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...Z("setup"),onClick:()=>w(!0),"aria-label":"This deck's name and shared logins",title:"This deck's name on the network, and which of its logins it offers",children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M1.8 4.7h10.4M1.8 9.3h10.4"}),l.jsx("circle",{cx:"9.1",cy:"4.7",r:"1.6",fill:"var(--panel)"}),l.jsx("circle",{cx:"4.9",cy:"9.3",r:"1.6",fill:"var(--panel)"})]})}),i]})]}),l.jsx("div",{className:"ap-scroll",id:"ap-lan-scroll",children:l.jsxs("div",{className:"ap-lan",children:[l.jsxs("div",{className:"ap-policy",children:[l.jsx("h3",{className:"ap-auto-title",children:"Sync with paired decks"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":z,"aria-label":"Sync with paired decks",...Z("switch"),onClick:()=>void H(),title:z?"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:l.jsx("span",{className:"switch-knob"})})]}),!z&&l.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:[l.jsx(AF,{}),l.jsx("span",{className:"ap-lan-intro-text",children:"Paired machines repair each other's expired logins."}),l.jsx("span",{className:"ap-lan-intro-go",children:"See how it works"})]}),l.jsx("p",{className:`ap-lan-status ${Se.tone}`,role:"status",children:Se.tone==="ok"?"":Se.text}),I&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",children:I}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>F(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),z&&l.jsxs(l.Fragment,{children:[me.length>0&&l.jsx("div",{className:"ap-lan-asks",role:"alert",children:me.map(ue=>l.jsxs("div",{className:"ap-lan-ask",children:[l.jsxs("span",{className:"ap-lan-ask-what",children:[l.jsx("strong",{className:"ap-lan-peer-name",children:ue.name})," at ",l.jsx("code",{className:"ap-lan-code",children:ue.addr})," wants to pair"]}),l.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",l.jsx("code",{className:"ap-lan-code",children:ue.fp})]}),l.jsxs("span",{className:"ap-lan-ask-acts",children:[l.jsx("button",{type:"button",className:"ap-manage-btn",...Z(`accept:${ue.fp}`),onClick:()=>void L("accept",ue.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${ue.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),l.jsx("button",{type:"button",className:"ap-manage-btn",...Z(`dismiss:${ue.fp}`),onClick:()=>void L("dismiss",ue.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},ue.fp))}),(Ue?[...Me,...qe]:Me).length>0&&l.jsx("ul",{className:"ap-lan-here",children:(Ue?[...Me,...qe]:Me).map((ue,je)=>l.jsxs("li",{className:"ap-lan-who","data-tone":ue.tone,children:[l.jsx("i",{className:ue.here?"ap-pulse":"ap-dot","aria-hidden":!0}),l.jsx("span",{className:"ap-lan-who-name","aria-hidden":!0,children:ue.name}),l.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${je}`,onClick:()=>V(ue.fp),children:l.jsxs("span",{className:"vis-hidden",children:[ue.name,", details"]})}),l.jsx("span",{id:`lan-who-state-${je}`,className:ue.quiet?"vis-hidden":"ap-lan-who-when",children:ue.state}),ue.kind==="nearby"&&l.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...Z(`accept:${ue.fp}`),onClick:()=>void L("accept",ue.fp,"reach that deck"),"aria-label":`Ask ${ue.name} to pair`,title:`Send ${ue.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${ue.fp}.`,children:"ask"}),ue.kind==="paired"&&l.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${N===ue.fp?" armed":""}`,...Z(`unpair:${ue.fp}`),onClick:()=>{if(N!==ue.fp){_(ue.fp),j.current=Date.now(),window.setTimeout(()=>_(Ce=>Ce===ue.fp?null:Ce),4e3);return}Date.now()-j.current<gc||(_(null),L("unpair",ue.fp,"unpair that deck"))},"aria-label":N===ue.fp?`Confirm unpairing ${ue.name}`:`Unpair ${ue.name}`,title:N===ue.fp?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:N===ue.fp?"confirm":"unpair"}),ue.kind==="dialling"&&l.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...Z(`drop:${ue.fp}`),onClick:()=>void U(ue.fp),"aria-label":`Stop dialling ${ue.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),ue.kind==="declined"&&l.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...Z(`allow:${ue.fp}`),onClick:()=>void L("allow",ue.fp,"let that deck ask again"),"aria-label":`Let ${ue.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${ue.kind}:${ue.fp}`))}),(Me.length>0&&qe.length>0||z&&Qe>0)&&l.jsxs("div",{className:"ap-lan-tail",children:[Me.length>0&&qe.length>0&&l.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":T,onClick:()=>R(ue=>!ue),title:T?"Show only the decks that are on":`Show the ${qe.length} deck${qe.length===1?"":"s"} that are not responding right now`,children:[l.jsx("span",{className:`ap-lan-chev${T?" open":""}`,"aria-hidden":!0,children:"›"}),T?"fewer":`${qe.length} more`,!T&&Ve>0&&l.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",Ve," not responding"]})]}),z&&Qe>0&&l.jsx("span",{className:"ap-lan-checked",children:ZF(c==null?void 0:c.checkedAt,Q,h==="check")})]}),ge.length===0&&me.length===0&&l.jsxs(l.Fragment,{children:[l.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."}),l.jsx("button",{type:"button",className:"ap-lan-word ap-lan-how",onClick:()=>C(!0),children:"How it works"})]})]})]})}),_e]}):l.jsxs("div",{className:"ap-foot",children:[l.jsxs("button",{type:"button",id:"ap-lan-entry",className:"ap-nav",onClick:s,children:[l.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:[l.jsx("rect",{x:"1.8",y:"2.3",width:"10.4",height:"7.2",rx:"1.2"}),l.jsx("path",{d:"M5 11.9h4M7 9.5v2.4"})]}),l.jsxs("span",{className:"ap-nav-text",children:[l.jsx("span",{className:"ap-nav-name",children:"Local network"}),l.jsxs("span",{className:"ap-nav-state","data-tone":Ne.tone,children:[Ne.text,Ne.trouble>0&&l.jsxs("span",{className:"ap-nav-bad",children:[" · ",Ne.trouble," not responding"]})]})]}),l.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:l.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),l.jsx("p",{className:"vis-hidden",role:"status",children:Se.tone==="ok"?"":Se.text}),_e]})}const S_=15e3,o8=8e3,i8=1800,l8=3e4,pp=[70,80,85,90,95];function mp(e,t){return dA(t-Math.floor(e/1e3))}function c8(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 Jl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function u8(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 s=Math.max(1,Math.ceil((e.retryAt/1e3-t)/60)),a=e.reason?`Re-capturing it from the login you already have did not work (${e.reason}).`:"The deck re-captured it from the login you already have, and claude-swap still cannot read it.";return{text:"numbers paused",hint:`${n} ${a} It tries again in ${s}m. No sign-in, no switch.`}}return{text:"numbers paused",hint:n}}function d8(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 h8(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 gp(e,t){if(e.staleCopy){const n=u8(e.repair??null,t);return{text:Jl(n.text),hint:n.hint,fix:null,tone:"quiet",blocksSwitch:!1}}if(e.stopped){const n=h8(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 s=e.collector==="no_credentials"||e.collector==="relogin_required";return{text:Jl(n.text),hint:n.hint,fix:n.fix?Jl(n.fix):null,tone:s||e.collector==="keychain_unavailable"?"warn":"quiet",blocksSwitch:s}}if(e.error){const n=d8(e.error);return{text:Jl(n.text),hint:n.hint,fix:n.fixable?"Sign in again":null,tone:n.fixable?"warn":"quiet",blocksSwitch:n.fixable}}return null}function yp(){return l.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:[l.jsx("path",{d:"M7 1.9 12.9 12H1.1Z"}),l.jsx("path",{d:"M7 5.6v2.9"}),l.jsx("path",{d:"M7 10.3v.05"})]})}function f8(e){return e>=90?"hi":e>=70?"mid":void 0}function p8(e){const t=Number(e);return[...Number.isFinite(t)&&t>0&&!pp.includes(t)?[...pp,t]:pp].sort((s,a)=>s-a)}function m8({lane:e,nowSec:t,frozen:n}){const s=Math.min(100,Math.max(0,e.pct)),a=n?"var(--muted)":s>=90?"var(--err)":s>=70?"var(--warn)":"var(--accent)",i=e.resetAt&&!n?hA(e.resetAt,t):null;return l.jsxs("div",{className:"ap-lane",children:[l.jsx("span",{className:"ap-lane-label",title:e.label,children:e.label}),l.jsx("div",{className:"ap-lane-track",children:l.jsx("div",{className:"ap-lane-fill",style:{width:`${s===0?1.5:s}%`,background:a,opacity:s===0||n?.4:1}})}),l.jsxs("span",{className:"ap-lane-pct",style:{color:a},children:[s,"%"]}),l.jsx("span",{className:"ap-lane-reset",title:i?`${e.label} resets in ${i}`:void 0,children:i&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"vis-hidden",children:"resets in "}),i]})})]})}async function j_(e){var n;let t=!1;try{t=await Promise.race([((n=navigator.clipboard)==null?void 0:n.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(s=>window.setTimeout(()=>s(!1),500))])}catch{t=!1}if(t)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(),t=document.execCommand("copy"),s.remove()}catch{t=!1}return t}function g8({onClose:e,leaving:t}){var Vn,Yn,qt,Kn;const[n,s]=x.useState(null),[a,i]=x.useState(null),[c,u]=x.useState(null),[f,p]=x.useState(!1),[h,m]=x.useState(null),[y,w]=x.useState(null),[N,_]=x.useState("accounts"),[j,k]=x.useState(!1),[S,E]=x.useState(null),C=x.useRef(S);C.current=S;const[T,R]=x.useState(()=>Math.floor(Date.now()/1e3)),I=x.useRef(null),[F,W]=x.useState(null),O=(F==null?void 0:F.num)??null,B=x.useRef(F);B.current=F;const[Z,Q]=x.useState(null),[M,K]=x.useState(!1),[G,P]=x.useState(""),[H,L]=x.useState(null),U=x.useRef(0),[$,V]=x.useState(null),[he,Y]=x.useState(!1),[J,z]=x.useState(!1),[re,le]=x.useState(null),[me,ge]=x.useState(null),[Me,qe]=x.useState(null),[Ve,Ue]=x.useState(!1),Se=x.useRef(null),Qe=x.useRef(null),[Ne,_e]=x.useState([]),ue=x.useRef(null),je=x.useCallback(te=>ah(ue.current)?(ue.current=te,u(te),!0):!1,[]),Ce=x.useCallback(()=>{ue.current=null,u(null)},[]),Fe=(te,Ae=!1)=>{const Oe=la(c,te);return{disabled:Oe.disabled,"aria-busy":Oe.busy||Ae}},We=x.useCallback(te=>{window.requestAnimationFrame(()=>{var Ae;if(t_(((Ae=document.activeElement)==null?void 0:Ae.tagName)??null))for(const Oe of ED(te)){const Re=document.querySelector(Oe);if(Re){Re.focus();return}}})},[]),He=x.useCallback(async(te=!1)=>{te&&p(!0);const Ae=new AbortController,Oe=window.setTimeout(()=>Ae.abort(),l8);try{const[Re,Le]=await Promise.all([fetch(`/api/claude-accounts${te?"?refresh=1":""}`,{signal:Ae.signal}),fetch("/api/cswap-auto",{signal:Ae.signal})]);if(Re.ok){const Ct=await Re.json();s(Ct),_e(yt=>uF(yt,Ct.accounts))}Le.ok&&i(await Le.json());const ct=mF([await f_(Re),await f_(Le)]);m(Ct=>p_(Ct,ct))}catch{m(Re=>p_(Re,Ae.signal.aborted?pF:fF))}finally{window.clearTimeout(Oe),te&&p(!1)}},[]),ot=x.useCallback(async(te,Ae,Oe="panel")=>{if(!je(Ae))return null;const Re=Oe==="menu"?Q:m;Re(null);try{const ct=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return ct!=null&&ct.ok||Re({text:ux(ct,"command failed"),raw:mc(ct)}),ct}catch{return Re({text:"server unreachable"}),null}finally{Ce()}},[je,Ce]),wt=x.useCallback(async(te,Ae)=>{if(!je(Ae))return null;m(null),Q(null);try{const Re=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return Re!=null&&Re.ok||Q({text:Ei(Re,"command failed")}),Re}catch{return Q({text:"server unreachable"}),null}finally{Ce()}},[je,Ce]);x.useEffect(()=>(He(!0),I.current=window.setInterval(()=>He(!1),S_),()=>{I.current!=null&&window.clearInterval(I.current)}),[He]),x.useEffect(()=>{const te=window.setInterval(()=>R(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(te)},[]);const ut=((Vn=a==null?void 0:a.settings["autoswitch.threshold"])==null?void 0:Vn.value)??"90",ee=Me??ut,ke=oF(ee,ut),Be=(Yn=n==null?void 0:n.accounts)==null?void 0:Yn.find(te=>te.active),et=Be?gp(Be,T):null,ht=async(te,Ae)=>{if(je(`switch-${te}`)){m(null),w(null);try{const Re=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:te})})).json().catch(()=>null);Re!=null&&Re.ok?w({num:te,name:Ae}):m({text:ux(Re,"the switch failed"),raw:mc(Re),row:te}),await He(!0)}catch{m({text:"server unreachable",row:te})}finally{Ce(),We(te)}}},Je=x.useCallback(()=>{W(null),Q(null),L(null),V(null),z(!1)},[]),tt=(te,Ae="first")=>{Je(),E(null),ge(null),W({num:te,view:"menu",start:Ae})},it=(te,Ae)=>{Je(),E(Oe=>(Oe==null?void 0:Oe.anchor)===Ae?null:{num:te,anchor:Ae})},bt=x.useCallback((te=!1)=>{var Oe;const Ae=C.current;te&&Ae&&((Oe=document.getElementById(Ae.anchor))==null||Oe.focus()),E(null)},[]),nt=()=>{Je(),E(null),_("lan")},pt=x.useRef(N);x.useEffect(()=>{pt.current!==N&&(pt.current=N,window.requestAnimationFrame(()=>{var te;(te=document.getElementById(N==="lan"?"ap-lan-back":"ap-lan-entry"))==null||te.focus()}))},[N]),x.useEffect(()=>{n!=null&&n.ok&&k(!0)},[n==null?void 0:n.ok]);const fe=x.useCallback(te=>{var Re,Le;const Ae=B.current;if(!Ae||te!=null&&Ae.num!==te)return;const Oe=document.getElementById(`ap-menu-${Ae.num}`);(Oe!=null&&Oe.contains(document.activeElement)||t_(((Re=document.activeElement)==null?void 0:Re.tagName)??null))&&((Le=document.getElementById(`ap-more-${Ae.num}`))==null||Le.focus()),Je()},[Je]);x.useEffect(()=>{t&&(Je(),E(null))},[t,Je]),x.useEffect(()=>{F&&(n!=null&&n.accounts)&&!n.accounts.some(te=>te.num===F.num)&&Je(),S&&(n!=null&&n.accounts)&&!n.accounts.some(te=>te.num===S.num)&&E(null)},[n,F,S,Je]);const lt=async te=>{var Oe;z(!1);const Ae=await wt({action:"share",account:te},`share-${te}`);!(Ae!=null&&Ae.ok)||((Oe=B.current)==null?void 0:Oe.num)!==te||(V({num:te,blob:Ae.blob,expiresAt:Ae.expiresAt}),W({num:te,view:"share"}))},vt=async(te,Ae)=>{const{commit:Oe,alias:Re}=hF(G,Ae);if(Oe){const Le=await wt({action:"alias",account:te,alias:Re},`alias-${te}`);if(await He(!0),!(Le!=null&&Le.ok))return}fe(te)},Gt=async(te,Ae)=>{var Le,ct;const Oe=await wt({action:"move",account:te,slot:Ae},`move-${te}`),Re=rF({menuFor:((Le=B.current)==null?void 0:Le.num)??null,shareFor:($==null?void 0:$.num)??null},te,Oe);if(await He(!0),Re){((ct=B.current)==null?void 0:ct.num)===te&&Je(),L(Re.confirmRemove),Re.shareFor==null&&(V(null),z(!1)),le(Re.swapNote);const Ct=Re.swapNote;Ct&&window.setTimeout(()=>le(yt=>yt===Ct?null:yt),o8),ge(null),We(Re.menuFor)}return Oe},Dt=async(te,Ae,Oe)=>{if(!Oe.sends){fe(te);return}await Gt(te,Ae)},Gn=async(te,Ae)=>{if(Ae.sends){const Oe=await ot({action:"setting",key:"autoswitch.threshold",value:te},"threshold");if(await He(!0),!(Oe!=null&&Oe.ok))return;qe(null)}Ue(!0),window.setTimeout(()=>{var Oe;document.activeElement===Qe.current&&((Oe=Se.current)==null||Oe.focus()),Ue(!1)},i8)},It=l.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:l.jsx("path",{d:"M3.4 3.4l7.2 7.2M10.6 3.4l-7.2 7.2"})})});return l.jsxs("aside",{className:`accounts-panel${t?" leaving":""}`,id:"accounts-panel","aria-label":"Claude accounts",children:[N==="accounts"&&l.jsxs("div",{className:"ap-header",children:[l.jsx("h2",{children:"Claude accounts"}),l.jsxs("div",{className:"ap-header-right",children:[l.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>K(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:l.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),(((qt=n==null?void 0:n.accounts)==null?void 0:qt.length)??0)>0&&l.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>Y(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${Zt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:l.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:[l.jsx("path",{d:"M3.3 10.7L10.7 3.3"}),l.jsx("path",{d:"M5.5 3.3h5.2v5.2"})]})}),l.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>He(!0),...Fe("reload",f),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:l.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:[l.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),l.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),It]})]}),N==="accounts"&&l.jsx("div",{className:"ap-scroll",id:"ap-scroll",children:n==null?h?l.jsxs("div",{className:"ap-empty",role:"alert",children:[l.jsx("span",{title:h.raw||void 0,children:h.text}),l.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",S_/1e3," seconds."]}),l.jsx("button",{type:"button",className:"ap-fix",disabled:f,onClick:()=>He(!0),children:f?"trying…":"try again"})]}):l.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?l.jsxs(l.Fragment,{children:[Be&&(et==null?void 0:et.tone)==="warn"&&l.jsxs("div",{className:"ap-notice",children:[l.jsxs("button",{type:"button",id:"ap-notice",className:"ap-issue","data-tone":"warn","aria-haspopup":"dialog","aria-expanded":(S==null?void 0:S.anchor)==="ap-notice","aria-controls":(S==null?void 0:S.anchor)==="ap-notice"?"ap-issue-pop":void 0,onClick:()=>it(Be.num,"ap-notice"),children:[l.jsx(yp,{}),l.jsx("span",{className:"ap-issue-text",children:"Current account needs attention"})]}),et.fix&&l.jsx("button",{type:"button",className:"ap-notice-fix",onClick:()=>K(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"Sign in"})]}),l.jsx("ul",{className:"ap-list",children:(Kn=n.accounts)==null?void 0:Kn.map(te=>{const{shown:Ae,fuller:Oe}=iF(te.lanes),Re=gp(te,T),Le=te.active||Ne.includes(Qx(te)),ct=te.alias??te.email??`account ${te.num}`,Ct=te.stale||(Re==null?void 0:Re.blocksSwitch)===!0,yt=Oe?[...Ae,Oe]:Ae,Zr=te.fetchedAt?mp(te.fetchedAt,T):null;return l.jsxs("li",{className:`ap-account${te.active?" active":""}`,"aria-current":te.active?"true":void 0,"data-open":Le?"":void 0,"data-frozen":Ct?"":void 0,children:[!te.active&&l.jsx("button",{type:"button",className:"ap-row-open",id:`ap-row-${te.num}`,"aria-expanded":Le,"aria-controls":Le?`ap-detail-${te.num}`:void 0,"aria-describedby":!Le&&!(Re!=null&&Re.blocksSwitch)?`ap-quota-${te.num}`:void 0,onClick:()=>_e(kt=>cF(kt,te)),children:l.jsxs("span",{className:"vis-hidden",children:[ct,", ",Le?"hide details":"details"]})}),l.jsxs("div",{className:"ap-account-head",children:[te.active?l.jsx("span",{className:"ap-live",title:`Active account · slot ${te.num}`,children:l.jsxs("span",{className:"vis-hidden",children:["Active account, slot ",te.num,":"]})}):l.jsx("span",{className:"ap-num",children:te.num}),te.alias&&l.jsx("span",{className:"ap-alias",title:te.alias,children:te.alias}),l.jsx("span",{className:"ap-email",title:te.email??void 0,children:te.email}),te.disabled&&l.jsx("span",{className:"ap-held",children:"held out"}),!te.active&&!te.disabled&&!(Re!=null&&Re.blocksSwitch)&&l.jsx("button",{type:"button",className:"ap-switch",...Fe(`switch-${te.num}`),onClick:()=>ht(te.num,ct),"aria-label":`Switch to ${ct}`,title:`Switch to ${te.alias??te.email}`,children:c===`switch-${te.num}`?"…":"Switch"}),l.jsx("button",{type:"button",id:`ap-more-${te.num}`,className:"ap-more","aria-label":`More actions for ${te.email??te.alias??`account ${te.num}`}`,"aria-haspopup":"menu","aria-expanded":O===te.num,"aria-controls":O===te.num?`ap-menu-${te.num}`:void 0,title:"More actions",onClick:()=>O===te.num?fe():tt(te.num),onKeyDown:kt=>{kt.key!=="ArrowDown"&&kt.key!=="ArrowUp"||(kt.preventDefault(),tt(te.num,kt.key==="ArrowUp"?"last":"first"))},children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"currentColor","aria-hidden":!0,children:[l.jsx("circle",{cx:"2.8",cy:"7",r:"1.15"}),l.jsx("circle",{cx:"7",cy:"7",r:"1.15"}),l.jsx("circle",{cx:"11.2",cy:"7",r:"1.15"})]})})]}),(h==null?void 0:h.row)===te.num&&l.jsxs("div",{className:"ap-failure ap-row-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),te.active&&(y==null?void 0:y.num)===te.num&&l.jsx("p",{className:"ap-switched",children:"Now active. New sessions start on it; ones already running pick it up on their next message, up to about 30 seconds later on macOS."}),(re==null?void 0:re.at)===te.num&&(()=>{var rn;const kt=(rn=n.accounts)==null?void 0:rn.find($r=>$r.num===re.displaced),Jt=(kt==null?void 0:kt.alias)??(kt==null?void 0:kt.email)??"the account that was there";return l.jsxs("p",{className:"ap-note ap-swap-note",title:`Slot ${re.at} was taken, so the two accounts traded places: ${Jt} now holds slot ${re.displaced}.`,children:["swapped with slot ",re.displaced]})})(),Re&&l.jsxs("div",{className:"ap-issue-line",children:[l.jsxs("button",{type:"button",id:`ap-issue-${te.num}`,className:"ap-issue","data-tone":Re.tone,"aria-haspopup":"dialog","aria-expanded":(S==null?void 0:S.anchor)===`ap-issue-${te.num}`,"aria-controls":(S==null?void 0:S.anchor)===`ap-issue-${te.num}`?"ap-issue-pop":void 0,onClick:()=>it(te.num,`ap-issue-${te.num}`),children:[Re.tone==="warn"&&l.jsx(yp,{}),l.jsx("span",{className:"ap-issue-text",children:Re.text})]}),!Le&&l.jsx("span",{className:"ap-issue-age",title:"When claude-swap last read this account's usage",children:Zr??"never collected"})]}),!Le&&!(Re!=null&&Re.blocksSwitch)&&l.jsxs("p",{className:"ap-quota",id:`ap-quota-${te.num}`,children:[yt.length?yt.map(kt=>l.jsxs("span",{className:"ap-q",children:[l.jsx("span",{className:"ap-q-label",children:kt.label})," ",l.jsxs("span",{className:"ap-q-pct","data-level":Ct?void 0:f8(kt.pct),children:[Math.round(kt.pct),"%"]})]},kt.id)):l.jsx("span",{className:"ap-q-label",children:"no usage recorded yet"}),te.stale&&!Re&&l.jsx("span",{className:"ap-q-age","data-never":Zr?void 0:"",title:"When claude-swap last read this account's usage",children:Zr??"never collected"})]}),Le&&l.jsxs("div",{className:"ap-detail",id:`ap-detail-${te.num}`,children:[l.jsx("div",{className:"ap-lanes",children:te.lanes.length?te.lanes.map(kt=>l.jsx(m8,{lane:kt,nowSec:T,frozen:Ct},kt.id)):l.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),l.jsx("div",{className:"ap-meta",children:te.fetchedAt?l.jsxs("span",{className:`ap-age${te.stale&&!Re?" 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 ",mp(te.fetchedAt,T),Re!=null&&Re.blocksSwitch?"":c8(te.nextAt,T)]}):l.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})})]})]},te.num)})}),F&&(()=>{var Re;const te=(Re=n.accounts)==null?void 0:Re.find(Le=>Le.num===F.num);if(!te)return null;const Ae=`ap-pop-title-${te.num}`,Oe=Z&&l.jsx("p",{className:"ap-pop-error",role:"alert",title:Z.raw||void 0,children:Z.text});return l.jsxs(d_,{anchorId:`ap-more-${te.num}`,boundaryId:"ap-scroll",id:`ap-menu-${te.num}`,className:"ap-pop",role:F.view==="menu"?"menu":"dialog",labelledBy:F.view==="menu"?`ap-more-${te.num}`:Ae,start:F.start,onClose:Je,children:[F.view==="menu"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{P(te.alias??""),Q(null),W({num:te.num,view:"rename"})},children:"Rename"}),l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{ge(null),Q(null),W({num:te.num,view:"move"})},children:"Move to slot…"}),l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...Fe(`share-${te.num}`),title:`Copy this account to another ${Zt}. 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:()=>lt(te.num),children:c===`share-${te.num}`?"Sharing…":"Share"}),(((a==null?void 0:a.enabled)||(a==null?void 0:a.external))&&!te.active||te.disabled)&&l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...Fe(`rot-${te.num}`),title:te.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",onClick:()=>ot({action:"account",account:te.num,enabled:te.disabled},`rot-${te.num}`,"menu").then(Le=>{He(!0),Le!=null&&Le.ok&&fe(te.num)}),children:te.disabled?"Put back in rotation":"Hold out of rotation"}),l.jsx("div",{role:"separator",className:"ap-menu-sep"}),l.jsx("button",{type:"button",role:"menuitem",className:`ap-menu-item danger${H===te.num?" armed":""}`,...Fe(`rm-${te.num}`),"aria-label":H===te.num?"Confirm remove":void 0,title:H===te.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(H!==te.num){L(te.num),U.current=Date.now(),window.setTimeout(()=>L(Le=>Le===te.num?null:Le),4e3);return}Date.now()-U.current<gc||(L(null),wt({action:"remove",account:te.num},`rm-${te.num}`).then(Le=>{var ct;He(!0),Le!=null&&Le.ok&&(((ct=B.current)==null?void 0:ct.num)===te.num&&Je(),We(null))}))},children:c===`rm-${te.num}`?"Removing…":H===te.num?"Confirm":"Remove"}),Oe]}),F.view==="rename"&&l.jsxs("form",{className:"ap-pop-form",onSubmit:Le=>{Le.preventDefault(),vt(te.num,te.alias)},children:[l.jsx("label",{className:"ap-pop-title",id:Ae,htmlFor:`ap-alias-${te.num}`,children:"Rename account"}),l.jsx("input",{id:`ap-alias-${te.num}`,className:"ap-manage-input",type:"text",value:G,onChange:Le=>P(Le.target.value),maxLength:dF,placeholder:"e.g. work",spellCheck:!1,autoComplete:"off",autoFocus:!0,onFocus:Le=>Le.currentTarget.select()}),Oe,l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>fe(),children:"Cancel"}),l.jsx("button",{type:"submit",className:"btn primary",...Fe(`alias-${te.num}`),title:"A short name to show instead of the email",children:c===`alias-${te.num}`?"…":"Save"})]})]}),F.view==="move"&&(()=>{const Le=nF((n.accounts??[]).map(yt=>yt.num),te.num),ct=sF(Le,me,te.num),Ct=aF(Le,ct,te.num);return l.jsxs("div",{className:"ap-pop-form",children:[l.jsx("label",{className:"ap-pop-title",id:Ae,htmlFor:`ap-slot-${te.num}`,children:"Move to slot"}),l.jsx("span",{className:"ap-field",children:l.jsx("select",{id:`ap-slot-${te.num}`,value:String(ct),...Fe(`move-${te.num}`),onChange:yt=>ge(Number(yt.target.value)),autoFocus:!0,children:Le.map(yt=>l.jsx("option",{value:yt.slot,children:yt.label},yt.slot))})}),Oe,l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>fe(),children:"Cancel"}),l.jsx("button",{type:"button",className:"btn primary",...Fe(`move-${te.num}`),title:Ct.title,onClick:()=>Dt(te.num,ct,Ct),children:c===`move-${te.num}`?"…":Jl(Ct.label)})]})]})})(),F.view==="share"&&($==null?void 0:$.num)===te.num&&(()=>{const Le=IA($.expiresAt,T),ct=Le.tone==="gone";return l.jsxs("div",{className:`ap-pop-form ap-share${ct?" expired":""}`,children:[l.jsx("p",{className:"ap-pop-title",id:Ae,children:"Share account"}),l.jsx("code",{className:"ap-share-blob",children:$.blob}),l.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:[l.jsx("span",{className:"ap-share-warn",children:"This is the password"})," · ",l.jsx("span",{className:`ap-share-expiry ${Le.tone}`,children:Le.text})]}),Oe,l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>fe(),children:"Done"}),l.jsx("button",{type:"button",className:"btn primary",...Fe(`share-${te.num}`),autoFocus:!0,onClick:async()=>{if(ct){await lt(te.num);return}await j_($.blob)&&(z(!0),window.setTimeout(()=>z(!1),1800))},children:ct?"Make a new share":J?"Copied":"Copy"})]})]})})()]})})(),S&&(()=>{var Oe;const te=(Oe=n.accounts)==null?void 0:Oe.find(Re=>Re.num===S.num),Ae=te?gp(te,T):null;return!te||!Ae?null:l.jsx(d_,{anchorId:S.anchor,boundaryId:"ap-scroll",id:"ap-issue-pop",className:"ap-pop ap-issue-pop",role:"dialog",labelledBy:"ap-issue-title",onClose:()=>bt(),children:l.jsxs("div",{className:"ap-pop-form",children:[l.jsxs("p",{className:"ap-pop-title ap-issue-title",id:"ap-issue-title","data-tone":Ae.tone,children:[Ae.tone==="warn"&&l.jsx(yp,{}),Ae.text]}),l.jsx("p",{className:"ap-pop-note ap-issue-hint",children:Ae.hint}),l.jsxs("p",{className:"ap-pop-note ap-issue-when",children:[l.jsx("span",{className:"ap-issue-who",children:te.alias??te.email??`account ${te.num}`})," · ",te.fetchedAt?`last collected ${mp(te.fetchedAt,T)}`:"never collected"]}),l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>bt(!0),children:"Done"}),Ae.fix&&l.jsx("button",{type:"button",className:"btn primary",onClick:()=>{bt(!0),K(!0)},title:"Open the sign-in dialog. Signing in as this account puts its login back in this slot — it keeps its slot, its alias and its history.",children:Ae.fix})]})]})})})()]}):l.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"claude-swap isn't installed."}),l.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&&l.jsx("code",{className:"ap-cmd",children:n.hint}),l.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",l.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"No accounts added yet."}),l.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",l.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"Couldn't read the account store."}),l.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})})}),N==="accounts"&&n!=null&&h&&h.row==null&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),N==="accounts"&&(n==null?void 0:n.ok)&&(a==null?void 0:a.ok)&&l.jsxs("div",{className:"ap-foot",children:[l.jsxs("div",{className:"ap-policy",children:[l.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),l.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:l.jsx("select",{ref:Se,"aria-label":"Switch threshold",value:ee,...Fe("threshold"),onChange:te=>qe(te.target.value),children:p8(ut).map(te=>l.jsxs("option",{value:te,children:[te,"%"]},te))})}),(ke.sends||Ve)&&l.jsx("button",{ref:Qe,type:"button",className:"ap-manage-btn",...Fe("threshold"),title:ke.title,onClick:()=>Gn(ee,ke),children:Ve&&!ke.sends?ke.done:ke.label}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":a.enabled,"aria-label":"Auto-switch",...Fe("enable"),onClick:()=>ot({action:"enable",enabled:!a.enabled},"enable").then(()=>He(!0)),title:a.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:l.jsx("span",{className:"switch-knob"})})]}),a.external&&l.jsxs("p",{className:"ap-auto-note",children:[l.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",l.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",a.enabled?" — this toggle takes over when you stop it.":"."]})]}),l.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:y?`Now active: ${y.name}`:""}),j&&l.jsx(a8,{accounts:((n==null?void 0:n.accounts)??[]).map(te=>({key:`${String(te.email??"").trim().toLowerCase()}@@${te.orgUuid??""}`,email:te.email??"",alive:te.alive===!0})),onChanged:()=>He(!0),view:N==="lan",onOpen:nt,onBack:()=>_("accounts"),closeButton:It}),M&&l.jsx(Xq,{onClose:()=>K(!1),onChanged:()=>He(!0)}),he&&l.jsx(tF,{accounts:((n==null?void 0:n.accounts)??[]).map(te=>({num:te.num,email:te.email,alias:te.alias,org:te.org})),onClose:()=>Y(!1),copyText:j_})]})}const y8=3e4;function w8({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function v8({bundle:e,running:t,pending:n,lastTried:s}){return t?w8({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function x8(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function b8({asked:e,reported:t}){return t?t!==e:!1}function FA(e){const t=e.thresholdMs??y8;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 k8(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 _8(e,t){return e?t==null?"auto when idle":`auto in ${k8(t)}`:"auto-restart off"}function E_(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function N8(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 S8(e){const t=FA(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 j8(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function E8(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 C8(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function T8(e,t){const n=C8(e),s=(...c)=>[n?`${n} on the canvas`:null,...c,"layout, pins and selection"].filter(u=>u!==null),a="This cannot be undone.";if(!t)return{goes:s("the event log on disk — the file a restarted deck replays to rebuild what you see, and the file every deck on this machine shares unless one was told otherwise"),stays:[],final:a,confirm:"Clear everything"};if(!t.path)return{goes:s(),stays:[],final:`This deck keeps no event log, so nothing on disk changes — and nothing can bring the canvas back. ${a}`,confirm:"Clear everything"};if(!t.mine){const c=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,u=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{goes:s(),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:s("this deck's event log — the file a restarted deck replays to rebuild what you see"),stays:[],final:a,confirm:"Clear everything"};const i=t.decks-1;return{goes:s(`the event log ${i===1?"1 other running deck shares":`${i} other running decks share`} with this one — every session recorded in it, not just the ones drawn here`),stays:[i===1?"what that deck shows, until it restarts — then it is gone there too":"what those decks show, until they restart — then it is gone there too"],final:a,confirm:"Clear everything"}}function A8({agentCount:e,onConfirm:t,onCancel:n}){const s=x.useRef(null),a=dn(n,{focusRef:s,layer:o5}),[i,c]=x.useState(null);x.useEffect(()=>{let m=!1;return fetch("/api/clear").then(y=>y.ok?y.json():null).then(y=>{m||c(E8(y))}).catch(()=>{}),()=>{m=!0}},[]);const{goes:u,stays:f,final:p,confirm:h}=T8(e,i);return l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{className:"status-dot err","aria-hidden":!0}),l.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsxs("dl",{className:"cc-plan",children:[l.jsx("dt",{children:"Goes"}),l.jsx("dd",{children:u.map(m=>l.jsx("span",{children:m},m))}),l.jsx("dt",{children:"Stays"}),l.jsx("dd",{children:f.length>0?f.map(m=>l.jsx("span",{children:m},m)):l.jsx("span",{children:"nothing"})})]}),p&&l.jsx("p",{className:"cc-final",children:p}),l.jsxs("div",{className:"cc-actions",children:[l.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),l.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const R8="Press Esc first if a key does nothing.",M8=[{title:"Canvas",rows:[{cap:"Space",action:"pause or resume the stream",binds:[" "]},{cap:"J",action:"next agent",binds:["j","J"]},{cap:"K",action:"previous agent",binds:["k","K"]},{cap:"W",action:"the session waiting on you — oldest first, again for the next",binds:["w","W"]},{cap:"F",action:"fit every agent on screen",binds:["f","F"]},{cap:"R",action:"re-arrange the canvas and drop the pins",binds:["r","R"]},{cap:"C",action:"clear the canvas and the event log — asks first",binds:["c","C"]}]},{title:"Panels and dialogs",rows:[{cap:"U",action:"usage panel",binds:["u","U"]},{cap:"L",action:"session list",binds:["l","L"]},{cap:"D",action:"detail panel",binds:["d","D"]},{cap:"H",action:"usage history",binds:["h","H"]},{cap:"A",action:"Claude accounts, where Claude Code is installed",binds:["a","A"]},{cap:"S",action:"this machine — cores, memory, temperature",binds:["s","S"]},{cap:"B",action:"Browser Watch",binds:["b","B"]},{cap:"V",action:"the sound menu — volume, tones, notifications",binds:["v","V"]},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"light or dark theme",binds:["t","T"]}]},{title:"Focus and selection",rows:[{cap:"Tab",action:"reach the agent cards",binds:[]},{cap:"Enter",action:"select the focused card",binds:["Enter"]},{cap:"Shift + Enter",action:"add the focused card to the selection",binds:["Enter"]},{cap:"Esc",action:"close what is open, deselect, release focus",binds:["Escape"]}]},{title:"Mouse",rows:[{cap:"drag",action:"move a node, and pin it where you dropped it",binds:[]},{cap:"shift-click",action:"add an agent to the selection",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function I8({onClose:e,onTour:t}){const n=dn(e);return l.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:l.jsxs("div",{ref:n,className:"modal key-help",onClick:s=>s.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[t&&l.jsxs("div",{className:"guide-door",children:[l.jsx("span",{children:"Eight pictures of what the deck shows."}),l.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),l.jsx("div",{className:"shortcuts",children:M8.map(s=>l.jsxs(x.Fragment,{children:[l.jsx("h3",{className:"kh-group",children:s.title}),s.rows.map(a=>l.jsxs("div",{className:"sc",children:[l.jsx("kbd",{children:a.cap}),l.jsx("span",{children:a.action})]},`${s.title}:${a.cap}:${a.action}`))]},s.title))}),l.jsx("p",{className:"kh-foot",children:R8})]})]})})}const $8=["done","needs-input"],O8=[{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}]}],P8=[{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}]}],r0={done:O8,"needs-input":P8},Fi="two";function px(e,t){const n=r0[e];return n.find(s=>s.id===t)??n.find(s=>s.id===Fi)??n[0]}function BA(e,t){return r0[e].some(s=>s.id===t)?t:Fi}px("done",Fi).notes,px("needs-input",Fi).notes;const C_=.04,L8=.24,bd=0,Bd=100,mx=5,yc=50;function wc(e){if(!Number.isFinite(e))return yc;const t=Math.round(e/mx)*mx;return Math.min(Bd,Math.max(bd,t))}function D8(e){if(e==null)return yc;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?wc(Number(t)):yc}function q8(e){const t=wc(e),n=C_+(L8-C_)*(t/Bd);return Math.round(n*1e4)/1e4}function F8(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(q8(e)*s*1e4)/1e4}const B8=160,z8="agent-dag.soundLevel.done",U8="agent-dag.soundLevel.needs-input",W8="agent-dag.soundFigure.done",H8="agent-dag.soundFigure.needs-input",zA={done:z8,"needs-input":U8},UA={done:W8,"needs-input":H8},gx={done:{level:yc,figure:Fi},"needs-input":{level:yc,figure:Fi}};function G8(e){const t=n=>({level:D8(e(zA[n])),figure:BA(n,e(UA[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const T_={Stop:"done",Notification:"needs-input"};function V8(e,t){var s;if(t)return null;const n=(s=e==null?void 0:e.payload)==null?void 0:s.hook_event_name;return typeof n!="string"?null:Object.hasOwn(T_,n)?T_[n]:null}function Y8(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,s=!1;const a=()=>e.enabled()?s&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",i=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,a())};function c(){var f;if(!(!t||s))try{n=n??new t,(f=n.resume)==null||f.call(n).then(i,()=>{}),s=!0,i()}catch{}}function u(f,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const h=(((N=e.prefs)==null?void 0:N.call(e))??gx)[f]??gx[f],m=px(f,h.figure),y=F8(h.level,m),w=n.currentTime;for(const _ of m.notes){const j=n.createOscillator(),k=n.createGain();j.type=m.type??"sine",j.frequency.value=_.hz;const S=w+_.at,E=S+_.ms/1e3;k.gain.setValueAtTime(1e-4,S),k.gain.exponentialRampToValueAtTime(y,S+.012),k.gain.exponentialRampToValueAtTime(1e-4,E),j.connect(k).connect(n.destination),j.start(S),j.stop(E+.02)}return!0}return{unlock:c,play:u,state:a,get context(){return n}}}const K8="Notify me when a session needs my attention.",X8="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",A_="Get notified when you're away from this tab.";function Z8(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:A_};case"default":return{status:null,ask:!0,ok:!1,note:A_};case"denied":return{status:"Blocked",ask:!1,ok:!1,note:"Your browser is blocking them; only its own site settings can undo that. You'll still be told once this tab is closed."};default:return{status:"Unavailable",ask:!1,ok:!1,note:"This browser cannot show them. You'll still be told once this tab is closed."}}}const R_={done:"Turn finished","needs-input":"Claude is asking"},Q8={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function J8({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:a,onFigure:i,onPreview:c,openerRef:u,notifyOn:f,onToggleNotify:p,notifyVetoed:h,notifyPermission:m,onAskNotify:y}){const w=Z8(m),N=f&&!h,_=dn(e),j=x.useRef(e);return j.current=e,x.useEffect(()=>{const k=S=>{var C,T;const E=S.target;E&&((C=_.current)!=null&&C.contains(E)||(T=u.current)!=null&&T.contains(E)||j.current())};return window.addEventListener("pointerdown",k,!0),()=>window.removeEventListener("pointerdown",k,!0)},[_,u]),l.jsxs("div",{ref:_,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[l.jsxs("div",{className:"sm-switches",children:[l.jsxs("label",{className:"sm-switch",children:[l.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),l.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:l.jsx("span",{className:"switch-knob"})})]}),l.jsxs("div",{className:"sm-setting",children:[l.jsxs("label",{className:"sm-switch",children:[l.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),l.jsx("button",{type:"button",role:"switch","aria-checked":f,"aria-labelledby":"sm-notify-label",className:"switch",onClick:p,title:"A system notification when a session blocks on you",children:l.jsx("span",{className:"switch-knob"})})]}),l.jsx("p",{className:"sm-note",children:h?X8:K8})]})]}),N&&l.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[l.jsxs("div",{className:"sm-channel-head",children:[l.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),w.ask?l.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:y,children:"Enable"}):l.jsxs("span",{className:"sm-channel-state","data-ok":w.ok||void 0,children:[w.ok&&l.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:l.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),w.status]})]}),l.jsx("p",{className:"sm-note",children:w.note})]}),!t&&l.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."}),l.jsx("div",{className:"sm-tones",children:$8.map(k=>{const S=s[k],E=`sm-level-${k}`,C=`sm-figure-${k}`;return l.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${k}`,children:[l.jsxs("div",{className:"sm-tone-head",children:[l.jsx("h3",{className:"sm-tone-name",id:`sm-name-${k}`,children:R_[k]}),l.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(k),"aria-label":`Hear the ${R_[k].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:[l.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),l.jsxs("div",{className:"sm-row",children:[l.jsx("label",{htmlFor:E,children:"Volume"}),l.jsx("input",{id:E,type:"range",min:bd,max:Bd,step:mx,value:S.level,onChange:T=>a(k,Number(T.target.value)),style:{"--sm-level":`${(S.level-bd)/(Bd-bd)*100}%`}}),l.jsxs("span",{className:"sm-read",children:[S.level,"%"]})]}),l.jsxs("div",{className:"sm-row",children:[l.jsx("label",{htmlFor:C,children:"Tone"}),l.jsx("select",{id:C,className:"sm-select",value:S.figure,onChange:T=>i(k,T.target.value),children:r0[k].map(T=>l.jsx("option",{value:T.id,children:T.label},T.id))})]}),l.jsx("p",{className:"sm-note",children:Q8[k]})]},k)})}),l.jsxs("p",{className:"sm-foot",children:[l.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const eB=15e3;function tB(e){return e.visibilityState==="visible"&&e.hasFocus()}function nB(e,t){return t||e===!0}function rB(){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 sB={"//":["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.0":[{title:"🧭 The accounts column leads with accounts",body:`The live account is the open row: its windows as bars, when each one resets, and how old the numbers are. Every other account rests on the two figures a switch is decided by, and opens with a click when you want the rest.
92
+
93
+ A problem stays on the row — an expired login, one that was never stored, a keychain the deck cannot open — with the reason and the sign-in one press away. Auto-switch is one row now: its threshold and its switch. Local network moved out of the column into a view of its own, reached from a row at the foot that says how many machines are paired and how many are not responding.`},{title:"💬 A resting session shows Claude Code's recap beside its card",body:"When a session stops, Claude Code's own recap of what it did is drawn beside the card — so a board you come back to says what happened without opening anything."},{title:"🪟 The chrome went quiet",body:`The topbar is borderless, one set of corners runs through the app, the canvas ground is flat, and the minimap, the zoom controls, the type filter and the Machine and Usage panels read as tooling rather than as cards.
94
+
95
+ The canvas also says when auto-fit is off, with one press to bring new sessions back into view.`},{title:"🔍 A tool call's detail reads as the call",body:"A tool call's arguments are shown as the call rather than as escaped JSON, and can be copied."},{title:"🔐 Saying yes to every deck that asks takes two presses",body:"The switch that accepts every pairing request arms first and says what it hands over, so one stray click cannot put this machine's logins on another deck."},{title:"🖐️ Targets, themes and contrast",body:"The panel's smallest controls reach the 24px target floor, and grow further under a finger. A first run follows the system's light or dark setting instead of picking one. Status dots, meters and switch knobs survive a Windows Contrast theme."}],"3.22.15":[{title:"🖱️ Clicking a card opens its details",body:"Selecting an agent is inspecting it: a click, `j`/`k`, a session picked from the list and Enter on a focused card all open the detail panel — prompt, every tool call, tokens, timing. It used to open only with `D`, so anybody who closed it with its × and never found the key did not get it back. The × still closes it until the next selection, and `D` still toggles it.\n\n`D` with nothing selected now picks a card first — the session that has waited longest, or the one `j` would land on — instead of flipping a switch with nothing on screen to show for it."},{title:"⌨️ The keyboard and screen readers reach the whole deck",body:`Shortcuts keep working after a mouse click on a button. A click left focus on the button it pressed, and the key handler leaves a focused control its own keys, so every single-key shortcut was dead until you pressed Esc — with nothing on screen to say so.
96
+
97
+ Tab follows the page now — topbar, the accounts column, the canvas, usage, machine — instead of zig-zagging left and right across it, and a canvas card reached by Tab draws the focus ring. A screen reader hears each card by name, with its kind, state, model and cost, rather than every word on it run together; the machine panel has a heading its region is named by; and the theme button is named for the theme it switches to.
98
+
99
+ With **Reduce motion** set, the camera no longer flies across the canvas to a card.`},{title:"💵 The money figures say what they measure",body:"The usage header's **$/min** is spend over a trailing window, and says which span it measured: `$3.54/min · 2 min`. It used to divide the live agents' cost by how long the longest of them had been running, so one deck read $2.39/min in a tab left open and $19.49/min in a tab opened minutes later.\n\nA quota bar's pace says **over pace** or **under pace**. It said `ahead`, which is how plain English says winning, on the very line meant to warn you that you are burning the window faster than it lasts.\n\nA card's clock reads `≥ 53m 52s` for a session this page joined after it had started, instead of presenting the part it saw as the whole of it — and that card's per-minute burn is left out rather than divided by the short clock."},{title:"↔️ Narrow windows keep every topbar control on screen",body:`At 400px six of the topbar's buttons sat past the right edge and the page scrolled sideways. The readouts give way first now and the controls stay; below 640px the side panels span the window instead of leaving the canvas a sliver; and the category filter wraps inside the canvas rather than being clipped by it.
100
+
101
+ Zoomed out, a card's name and a cluster's label stay readable instead of shrinking to about four pixels — which is the view a board of any size actually sits at.`},{title:"🔑 A paired deck's dialog says which account that machine is on",body:`The lane of the account the other machine is working on takes the accent and a slow ring on that machine's end. An account is named only if that deck shares it: on one it does not share, the dialog reads "on another account" and never which. A new switch under **SHARE THESE ACCOUNTS**, on by default, turns the telling off, and paired decks then read "current account hidden".
102
+
103
+ **This deck on the network** prints this deck's own fingerprint again. A pairing request asks you to match it against the one on the other machine's screen, and no screen here was showing it — so the one check a person can make against a rogue deck could not be made, on the step that hands over logins.`},{title:"💬 The deck's messages send you somewhere worth going",body:'An empty canvas no longer ends with "Make sure ccdeck is running" while the page is plainly connected to it. The capture hints under that line, one per CLI, are the real reasons a canvas stays empty, and they stay. With the stream down the screen says whether this page lost a deck that was there or never found one, in those words, rather than naming the `/events` route nobody who typed `npx ccdeck` has seen.\n\nAnd a slow `claude-swap` now reads as a slow answer — "still waiting on the deck server" — instead of "couldn\'t reach the deck server", which sent people off to restart a server that was fine.'}],"3.22.10":[{title:"🖱️ Icon buttons are easier to hit",body:"Icon buttons react when the pointer is near them — no need to hit the icon exactly."},{title:"🧩 Sessions spread across the canvas",body:"Sessions now spread across the canvas in columns instead of one tall column, and new sessions and subagents land in the free space beside them. Nothing is placed under the Machine or Usage panels. Press R once to rearrange a board you already have."}],"3.21.0":[{title:"🖼️ The deck explains itself in pictures",body:"🎬 First run opens an eight-picture tour instead of the changelog — who is waiting on you, the tree, a node's inside, cost and quota, this machine, accounts, local network, how to start. `Take the tour` on an empty canvas brings it back.\n\n📡 **Local network** has a guide: a card while it is off, `How it works` under an empty list, four pictures ending on `Turn it on`. A machine's row opens its own dialog — address, version and system, the logins it offers, and a name of your own for it. Setup ends on Done.\n\n🔄 The deck updates itself when nobody is looking: no tab focused, no agent mid-turn, thirty seconds quiet. The banner's `auto when idle` switch governs it.\n\n🔑 An account whose numbers were paused resumes on its own, and the panel is titled **Claude accounts** — a Codex login is not in it."}],"3.20.0":[{title:"🟢 The deck keeps running after you close the terminal",body:"`ccdeck` prints the same boot report and gives you the prompt back. The deck stays up, and starts again when you log in.\n\n🛑 **`ccdeck --stop` is the off switch now** — Ctrl+C only cancels a start that is still printing. `--status` says what is running, `--logs` shows what the deck wrote while you were away, and `--foreground` holds the terminal the way every version before this one did.\n\n🔁 Typing `ccdeck` beside a deck that is already up opens **that deck's tab** instead of building a second one. `ccdeck --stop --all` clears any older deck still running from before this version. An `npx` run cannot start at login — `npx ccdeck --install` puts it on your PATH and sets that up.\n\n🔑 An account that will not collect now says which of three things is wrong: **no stored login**, a **login that expired**, or a **keychain the deck cannot open** — with the fix beside it. One with no stored login is filled over the local network by a paired deck that has it.\n\n📡 And decks find each other again on a machine with a VPN up: the beacon was going to an address that never left the machine, so this deck could hear colleagues and none of them could hear it."}],"3.19.0":[{title:"🟢 Local network: fixes and improvements",body:`The list of decks is quiet now. A deck that is **on**, with nothing to repair, is a name and a green mark — no sentence under it. Every healthy row used to carry the same words, so the one row worth reading looked like all the others. A failure, a login that arrived, a machine that is away, still say so, and they are now the only rows with anything written on them.
104
+
105
+ \`unpair\` arrives when you point at a row rather than sitting on every one of them, two machines that share a name show their addresses, and the ↻ turns while a round is out.
106
+
107
+ **Add a deck** is two ways in — by address, or with an invite — with \`make one to send\` beside the invite heading instead of under the paste field, where it read as that field's button. A refused address now says which mistake it was, and an invite that will not work says whether it ran out, was not an invite, or reached nothing.
108
+
109
+ Switching **Local network** on opens your name and shared logins, every time, so nothing goes on the network without you having just seen what goes with it.`}],"3.18.3":[{title:"🟢 The list shows what is on, and folds the rest",body:'A machine that is off, or nearby and unpaired, or one you said no to, is context rather than an answer to "who can I use right now" — so the decks that are **on** lead the list and everything else is one line: `2 more`. Nothing worrying is hidden by it: a deck that cannot be reached is counted in that line, in the warning colour, so the fold says whether it is worth opening.\n\nThe round moved to a **↻ beside the switch**, where the accounts header has kept the same act since it was written, and the line under the state now says when it last ran — `checked 2m ago`, or `not checked yet`. A list that refreshes itself and a list that has stopped used to look identical, and pressing the button to find out was the only way to tell.'}],"3.18.1":[{title:"🔁 A deck stops asking to pair over and over",body:"Several decks on one computer share a config directory, so they start with one key. Each read the others' beacons as somebody wearing its name, took a fresh key, and wrote it to the file the others read — a loop that never settles. Every new key is a **new deck** to everyone else on the network, so one machine sent a fresh pairing request every few seconds and accepting one accomplished nothing: the deck that asked no longer existed by the time the answer arrived.\n\nDecks on one computer now recognise each other as the same machine and leave the key alone. The clash still worth healing — a `~/.claude` copied to a second machine — is unchanged.\n\nThis also collapses the rows: a computer that has run the deck a few times appeared several times on everybody else's panel and is one row now. **Both machines need this version** for that to take effect on the other one's screen.\n\nA deck that answered is no longer counted as unreachable, the list refreshes itself in seconds while somebody is deciding rather than at the next minute, and a failed round says what happened — `not listening`, `no route to it` — with the address and the raw error on the hover."}],"3.18.0":[{title:"🟢 A deck that is switched off no longer reads as on",body:"A paired deck this one has no address for was drawn **live** on the strength of being paired — a machine closed an hour ago still sat under `1 deck ready`. Every row now leads with whether that machine is actually there, and when it last was: `online · 1 login arrived`, `no answer · last online 20m ago`, `never reached`. The mark beside the name is a traffic light — green for a deck that answered, amber for one that cannot be reached, grey for one nothing has heard from.\n\n**+ add a deck** opens a dialog now instead of unfolding inside the panel. An address, an invite and the firewall note never fitted a 288px column, and unfolded they turned a list of machines into a form."}],"3.17.0":[{title:"🔔 Pairing is two presses",body:`When another deck asks to pair, the question now arrives **over the deck** rather than in a row three sections down a panel: its name, its address, the fingerprint to compare, **Accept** or **Decline**. Escape means later — the request stays in the panel until you answer it.
110
+
111
+ The rest is one list. Every deck you are paired with, every deck on the network, and every one you turned away, each a row with its state under the name and one verb at the end — and a deck that cannot be reached now reads differently from one that is fine. Saying no also reaches the other machine now, instead of leaving it waiting forever; you can take it back.
112
+
113
+ The dialog behind **setup** is down to the two things it is really about: what this deck is called, and which logins it offers.`}],"3.15.0":[{title:"🔗 Decks on one network heal each other's dead logins",body:`A login dies on the machine that has not used it while the same account keeps working on the machine that has. The fix was a blob copied out of one deck and pasted into another. Now: **Accounts ▸ Local network**, the same passphrase on each deck — it offers you six words — and they find each other and repair themselves.
114
+
115
+ A deck only **adds** an account it does not have, or **replaces one it has proven dead** — proven by Anthropic refusing the token, not guessed. A credential that works is never touched. The passphrase is the only gate; a stranger on the same wifi sees that a deck exists and nothing else.`},{title:"⚠️ What sharing a login actually means",body:`**A login you share is a live one, and it cannot be taken back.** Turning the switch off stops what has not happened yet; a credential that has left your machine is gone, and the only real revocation is signing in again at Anthropic — which ends the session everywhere at once.
116
+
117
+ Sharing a Claude account may also be against Anthropic's terms. Your call; the deck says it once and does not nag.`}],"3.14.0":[{title:"📊 The machine comes back beside the list that covers it",body:`**Busiest processes** opens over the machine panel and hides the very readings that sent you looking. They are back beside the list — cores, memory, swap, queued work, temperature — with up to an hour behind each: a column down the side on a wide screen, a band under the table on a narrow one.
118
+
119
+ Each is drawn against the line it is measured to — memory and swap at 90%, load at your core count, the GPU at 75° and again at 90° — so swap sitting *on* its line is something you see rather than work out. The processor readings get no line on purpose: a CPU at 90% is your machine doing what you asked for. Throttling appears only once your machine has actually been held back, and the band says how much history it really has rather than claiming an hour it has not had.`},{title:"📋 The process dialog's footnote moved onto the columns it was about",body:"A band ran along the bottom of **Busiest processes** saying three things. Two were worth keeping and are now on the header of the column they describe — hover `memory` to read what that number measures, `process` to read that the command-line redaction is a filter rather than a promise.\n\nThe third said the list is the busiest by processor and memory, refreshed every four seconds. The heading, the count beside it and the moving numbers were already saying that."},{title:"📝 These notes render what they were written in",body:`Every note in this dialog is written in Markdown — **bold** for the sentence that carries the change, backticks for a flag or a path — and the dialog printed the string raw. So the first window you see after an upgrade has been showing you \`**this**\`, backticks and all, since the feature shipped: 25 of 52 notes, 52 bold spans, 54 code spans.
120
+
121
+ What you are reading is the first version that does not.
122
+
123
+ No Markdown library came along for it. Counted in the file: bold 52, code 54, links 0, headings 0, lists 0 — and the smallest library that reads all of Markdown is 40KB on a bundle the deck fetches while you wait for it to start.`},{title:"⎋ Esc leaves the machine panel where it is",body:"The × on **This machine** read `Close (Esc)`, so Escape put the panel away. Escape belongs to the canvas — it deselects and hands the keyboard back — and pressing it while you are reading your instruments should not close them.\n\nThe panel now closes the two ways it opens: its ×, and the meter in the topbar. The × says `Close`, and names no key it does not answer."},{title:"🖥 The machine moved out of the topbar and into a button",body:"The small CPU sparkline and memory bar in the topbar are gone. A chip glyph in the icon row beside `$` and the accounts silhouette opens the same **This machine** panel — cores, memory, swap, load, temperature, busiest processes — and the bar stops moving in the corner of your eye.\n\nIt also stops asking. The deck read your machine every three seconds for the life of every tab to feed that meter; it now reads only while the panel is open, and the history behind the readings is kept by the deck itself, so a panel opened an hour from now still has the hour behind it."},{title:"🔎 The panel's eight process rows became one way in",body:"The machine panel drew eight processes in a 280px box: three columns, names cut off mid-word, and a `ps` run every four seconds to keep them moving. **Busiest processes** is a single row you press now, and the dialog behind it is what it always was — every candidate the deck sees, its memory in bytes, threads, user, pid, and the command line that tells you which `node` this one is.\n\nWith that dialog closed, the deck reads no process list at all."},{title:"⏱ The restart banner says whether the press is safe, and shows the fuse",body:"The button read `Restart now` whether the machine was idle or five agents were mid-turn — and the events fired while the server is down are lost for good. It reads **`Restart anyway`** now when something is running, with the count beside it, and `Restart now` with *nothing is running* when the machine is quiet.\n\nThe automatic restart said only `auto when idle`, while a 30-second clock ran where nobody could see it. It counts — **`auto in 18s`** — which is also how you stop it, since the switch is the label. The amber dot pulses only while that clock runs.\n\nThe switch also says `auto-restart off` in words rather than in a colour, both its label and the button are readable in the light theme now, and a tab you are not looking at no longer restarts the deck under the tab you are."}],"3.13.0":[{title:"📊 Usage history stops jumping out from under you",body:`Pressing **H** put \`running ccusage…\` in a box 186px tall. Two to four seconds later the chart, the totals and the legend arrived and the box became 429px — and because the dialog is centred, that growth moved the whole thing **121px upward**, under the cursor that had just pressed something.
124
+
125
+ The chart's place is now reserved from the first frame: the 168px the chart is tall plus the 16px it keeps for its day labels, both taken from the chart's own rule so the placeholder and the thing it holds room for cannot drift apart. The jump goes from 243px to 156px. It deliberately stops there — the totals and the legend are content, the legend's height depends on how many models ran, and reserving those would have meant drawing four plausible empty cards for a reading that had not arrived.
126
+
127
+ What is drawn in the reserved space is **the chart's baseline and nothing else**: one line, in the same colour, at the height the columns will land on. Not a skeleton of grey bars — a skeleton stands in for content, an axis is furniture, and furniture is honest before the data exists. The light on it travels rather than fills, because the deck knows a subprocess is running and does not know how far through your transcripts it has got.
128
+
129
+ Then the days rise out of that line, **oldest first**. The stagger is divided rather than fixed — 200ms of spread whether the range is 7 days or 90 — so the longest range is not also the slowest to appear.
130
+
131
+ With reduced motion both loops and both entrances are off. The reserved space is layout, not animation, and stays outside that rule: asking for less movement gets you the same dialog that does not jump.`},{title:"⏳ The period mark says it is being read",body:"The first read of **today**, **month** or **all** takes two to three seconds — it walks the transcripts on this machine, and the cost is the walk, not the size of the range you asked for. Until now the panel said nothing for the whole of it, so pressing `month` looked like pressing nothing, and the honest response was to press it again.\n\nThe mark under the period now pulses while that read is in flight, and it **pulses rather than fills**: nothing measures how far through the transcripts ccusage has got, so a bar that filled would be inventing a number. Hovering the pending period says which one is being read, and screen readers are told the same thing through a live region rather than being left with a silent button."}],"3.12.0":[{title:"🔍 Busiest processes tells you which one",body:"The list could say what was eating the machine and not **which** of nine identical `Google Chrome Helper` rows was the headless Chrome you left running. It now shows the arguments after the name — `--type=renderer` beside one, `serve admin-portal --port 44440` beside a node — and four columns it did not have: **memory in MB and GB** instead of a percentage, **threads**, **how long it has been up**, and **user**. Every column sorts; press its heading.\n\n**Command lines have anything secret-shaped removed before they leave your machine** — the value of any flag whose name says token, password, key or secret, the password in a URL, and the shapes that identify themselves. It is a filter and not a guarantee: a secret that looks like an ordinary word looks like an ordinary word. The reading happens only while this modal is open, so a deck whose process list you never open never reads a command line at all.\n\n**Memory is resident set size** — what `ps` and Windows Task Manager report. On macOS this is *not* the number Activity Monitor shows in its Memory column; that one is the physical footprint, and on the machine this was built on the two disagree by up to fourteen times on the same process. No unprivileged command reports the footprint quickly, so the deck shows the figure that means the same thing on all three platforms and says which one it is.\n\n**There is no Ports column**, and the reason is the same kind of honesty: Mach ports do not exist on Linux, are not what Windows calls a handle, and on macOS the only way to count them takes four seconds — against a list that refreshes every four."},{title:"🔢 A token count that stays a whole number",body:"Switching the Usage panel from **month** to **today** counted down smoothly and then, for a fraction of a second, showed something like `in 594.3268260610639` where a token count belongs.\n\nThe count was never wrong; the printing was. The figures animate between two readings, so the formatter is handed a fraction on most of its frames — every size above a thousand was already rounded and the one below it was not."}],"3.11.0":[{title:"🗂 The session list waits to be asked for",body:`**BY SESSION in the Usage panel now starts collapsed.** It is the one block in that panel with no ceiling — every other section is two or three rows, or a model table bounded by the models that exist — and it was the reason the panel scrolled at all. Shut, the whole panel is one screen: quota, period, money, models. Press the heading to open it, and it stays open; ccdeck remembers your answer from then on.
132
+
133
+ The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
134
+
135
+ **Scrollbars are also gone until you point at the thing that scrolls.** Nothing moves when they appear — the track keeps its width in both states, so no text shifts under the pointer as it arrives.`},{title:"📊 today · month · all, as tabs that remember",body:"**The Usage panel's period switcher is a full-width row of tabs** rather than a pill floating over the column, with a thin cyan mark under the word it belongs to. It governs the figures beneath it, so it now looks like it does.\n\n**Your chosen period survives a reload.** It was the one preference in that panel that did not.\n\n**It costs one Tab stop instead of three.** Tab into the strip, then move with ←/→ or Home/End, and press Enter to choose. Arrowing past a period no longer starts reading it — moving and choosing are separate now, which matters on `all`.\n\nAnd **`month` says which month.** Hover it: this is the calendar month, from the 1st — not the last 30 days. `today` and `all` say what they cover too."},{title:"🔔 Sounds and Notifications are two switches, and Browser notifications is a channel",body:`**The sound menu has been rebuilt.** Sounds and Notifications are real switches now instead of words that read like status. Under them, **Browser notifications** is named as what it is — one of the two ways ccdeck can reach you — rather than sitting there as a third setting that seemed to contradict the one above it.
136
+
137
+ There are two notifiers and they never both fire: the page raises one when the deck is open but hidden, and the server raises one when no page is open at all. Only the first needs a browser permission, which is why the permission belongs to a channel and not to the feature. **Turning Notifications on now asks the browser on that same press** — no second control to hunt for.
138
+
139
+ \`M\` mutes and unmutes sounds from anywhere. **Hear it** plays the tone even when Sounds is off, so you can pick one before turning them back on.`},{title:"🧹 No agent, no empty panel",body:`**The detail panel no longer appears when nothing is selected.** It used to sit there empty, and a tab on the edge of the canvas existed to bring it back after you closed it — both are gone. Select an agent and the panel is there; press **D** to toggle it yourself.
140
+
141
+ The canvas is that much wider whenever you are not reading one agent.`}],"3.10.0":[{title:"🔌 Who else can drive your browser, and where to see it",body:"**Browser Watch has a Remote control section.** The Claude in Chrome extension holds a connection open to Anthropic's relay, and that connection is registered against your **account**, not against this machine — so any Claude Code session signed in to the same account, running anywhere, can enumerate and drive this browser, and nothing prompts you on the machine being driven.\n\nThe panel now says whether that is the case here, and what the extension is actually allowed to do in each profile — enabled or switched off, every site or only the ones it was granted, and which of the powerful APIs it holds. That last part is not what `chrome://extensions` shows you: the per-site list there is enforced by the extension, on itself, while the grant underneath stays exactly as wide as it was.\n\nIf you want it closed, the section hands you the one command that closes it — as text, to paste in your own terminal. **ccdeck never runs it and never asks for your password**, and it never will: no part of this deck elevates, and a dashboard that could raise a password box on request would be a gift to anything else running on the machine. If the block is already in place, the section offers the command that takes it back out. And if something else in your hosts file already points that name somewhere, it says so and leaves the line alone — ccdeck only removes the line ccdeck wrote.\n\nAll of this is two file reads and no network call. It was written some releases ago and, until now, was not connected to any screen.\n\n**Also:** the README said `share` produces a `ccdeck1:` blob. It produces `ccdeck2:` — `ccdeck1:` has been read-only legacy for a while."}],"3.9.0":[{title:"🎛️ Five switches that were not where the thing they control is",body:'**The session list has a button again.** It lost one a while back and only the `L` key was left — and `L` is written down in one place, a shortcuts sheet behind a small `?` in the corner of the canvas. If you use a mouse there was no way to open the list at all. The `☰` is back at the left of the top bar.\n\n**The Notifications switch now tells you whether the browser will actually show one.** It said `on` while this browser had never been asked for permission, which is not the same thing. It now says so on that row and offers the ask right there. Before, the only place to grant it was a button that appears solely while a session is stuck waiting — so on a machine where that rarely happens you could not switch notifications on at all.\n\n**Started with `--workspace` or `--scope` and seeing nothing?** The empty screen used to tell everyone to "run `claude` or `codex` in any folder", which is the one thing that cannot work for you. It now names the folder the deck is actually watching.\n\n**Browser Watch says when a setting did not save.** Flipping the switch and having it fail showed a red line reading "Could not read" — about reading history, not about your press — and ten seconds later the panel wiped it and looked perfectly healthy with the setting unchanged. A failed save now says so, in its own words, and stays until you dismiss it. The "nobody browsing for" menu also follows the stored value again: change it in a second tab and this one never caught up.\n\n**The deck no longer restarts itself when nothing on screen offers to stop it.** Thirty seconds after the last agent went quiet, with a new version on disk, the server would exit, come back and reload the page. The `auto when idle` switch that controls that lives inside the update banner — so if you had closed the banner with its `×`, it happened with no visible setting anywhere. Closing the banner now also stands down the restart; clicking the version chip brings back both together.'}],"3.8.9":[{title:"🖥️ Four things that only went wrong on somebody else's operating system",body:"**Ubuntu:** the deck knew where Chromium and Brave keep their profiles when installed as a snap or a flatpak — which on a default Ubuntu is the only place Chromium is — but not what those programs are called. So it reported them as not running while they were, and refused to quit them. Both now work.\n\n**Windows:** the deck asked the system whether it could write to the folder an update installs into, and Windows always answers yes for a folder whatever the permissions say. It offered you an update that then died inside npm with a permission error. It now finds out by trying, and declines up front with the command to run yourself — which is what every other platform already got.\n\n**Linux:** if `XDG_DATA_HOME` was set to something starting with `~`, as it is from a systemd unit or a Dockerfile, the deck and claude-swap looked in two different places for your accounts. The panel said you had none while `cswap list` showed them all.\n\n**Plain terminals:** six messages used a typographic dash the old Windows console and the Linux text console cannot draw, so a box appeared mid-sentence — including in the line that explains why no events are arriving. They use the plain form on those terminals now, like everything else already did."}],"3.8.8":[{title:"📉 A false 99% on the memory chart, and three other quiet failures",body:`**The machine meter no longer invents a reading.** When the deck could not measure memory — a subprocess that would not start under load, or one that took too long — it substituted a number that means something else, and on a Mac that reads as about 99% used. The meter went red for half a minute, and because the chart keeps the highest value in each minute, that false peak stayed on it for a full day. A poll that cannot measure now keeps the last reading and records nothing: a gap in the chart is honest.
142
+
143
+ **A failed ccusage repair no longer disables the repair.** If the deck found a half-installed copy it removes it and starts again. On Windows that removal can fail for a few seconds because the program it just ran still has the folder open — and the deck then treated the attempt as spent and never tried again for the rest of the session, leaving the panel permanently unable to read your usage. It now only counts a repair that happened.
144
+
145
+ **Changing the auto-switch interval takes effect even during startup.** Set it in the first seconds after launch and the timer kept the old value for the life of the process, while the panel showed the new one.
146
+
147
+ **Codex sessions with very large histories no longer cost hundreds of megabytes to read.** The deck read the whole file to find four values that live at its two ends — measured at 185 MB of memory and 95ms of frozen interface for one 44 MB session. It now reads only the ends.`}],"3.8.7":[{title:"🧠 Four things in the panel that behaved wrongly",body:`**Today's figure no longer overshoots.** Once a minute, when a fresh reading landed, the headline briefly counted past the true number and back down — it was measuring the last minute of spend from a starting point one moment out of date. The reading and its starting point are now recorded together, so there is no moment where they can disagree.
148
+
149
+ **Browser Watch marks findings read when you close it, not when you open it.** It was clearing the badge immediately, and stamping every new finding as read the moment it arrived — so anything that turned up while you were reading was never badged at all. It was also writing to storage four times a second the whole time the panel was open.
150
+
151
+ **A hidden tool category can always be brought back.** Hide one, leave the deck running, and once the canvas had turned over the row of chips disappeared while the filter stayed on — no bubbles, and nothing to press. Only reloading fixed it. The chips now stay for as long as anything is hidden.
152
+
153
+ **Clicking a session's name no longer switches auto-fit off.** The deck was reading its own camera move as you grabbing the canvas, and remembered it across restarts, with nothing said.`}],"3.8.6":[{title:"🗂️ Two decks can no longer both claim the same log",body:"When several decks share one events log they elect a single writer for it, so nothing is recorded twice. That election compared the path as typed — so two decks reaching the SAME file by different spellings each thought they were alone, both wrote every event, and each believed the log was theirs to clear.\n\nDifferent spellings are ordinary, not exotic: a shortened Windows home directory, a mapped or substituted drive, a junction, or on macOS `/tmp` against `/private/tmp`. The visible symptoms were duplicated tool calls after a restart, and Clear wiping history belonging to another deck.\n\nThe path is now canonicalised the same way the watched folder already was. It works on a first run too, before the log file exists."}],"3.8.5":[{title:"⛔ Cancelling a sign-in no longer adds the account anyway",body:`Press Escape while adding a Claude account and the deck killed the sign-in — and then, sometimes, registered the account regardless, switched to it, and told you it had worked.
154
+
155
+ The deck asks the tools it runs whether they finished cleanly. A program that is well behaved about being cancelled tidies up and exits with a success code, and the deck was reading that as "it finished" rather than "I stopped it". \`claude auth login\` is exactly that kind of program.
156
+
157
+ A cancelled run now reports as cancelled. Everything that was not cancelled is unaffected.`}],"3.8.4":[{title:"🧷 Your own hooks can no longer be eaten by two decks starting together",body:'If you keep hooks of your own in `settings.json`, the deck parks them while it installs and puts them back afterwards. Two decks starting at the same moment could interleave inside that, and the loser wrote a version of the file computed before the restore — so your hook was gone from `settings.json` and gone from the park, which was its only other copy.\n\nThere was already a check for this, and it had a hole: if the last-moment re-read of the file failed, it read that as "nothing changed" and wrote anyway. A failed read is the one moment that check was most needed, because the usual reason a file cannot be read for a few milliseconds is that something else has just written it.\n\n`ccdeck --uninstall` had no such check at all and could overwrite a deck that was starting, then exit 0 saying it had succeeded. It has one now, and when it declines it says so and tells you to run it again rather than reporting that there was nothing to remove.'}],"3.8.3":[{title:"🪟 Windows: two settings files that could refuse to save",body:`On Windows a file cannot be moved into place while anything else has it open, and Defender and the search indexer open a file the instant it is written. The deck has had a retry for that for a long time, and two files written in the last few days were not using it: the notifications preference, and Browser Watch's episode archive.
158
+
159
+ When it bit, the notifications switch silently did not stick, and Browser Watch answered an error and showed an empty panel. Both now retry the way everything else in the deck already did.
160
+
161
+ Nothing changes on macOS or Linux, where the operating system never refused the move in the first place — which is why this got past a green test suite on both.`}],"3.8.2":[{title:"⌨️ A closed-behind-your-back dialog no longer kills every keyboard shortcut",body:`Open the context ring on a session's card and leave it open. The session finishes, and a couple of minutes later the canvas evicts it — or you press Clear. The dialog vanished, and from that moment every shortcut in the deck stopped working: Space, C, R, F, L, H, U, A, J, K, T, M, and the trash button too. Only reloading the page brought them back.
162
+
163
+ The deck was still counting the dialog as open, because it remembered which session you had opened it for rather than whether anything was on screen. It now closes the dialog when its session leaves the board, which is what should have happened in the first place. The end-of-session recap had the same problem and is fixed with it.`}],"3.8.1":[{title:"🔒 Security: update if the deck runs on a Mac",body:"A local process able to reach the deck's port — no token, no browser, no tab — could get a string of its choosing compiled as AppleScript when the deck raised a desktop notification with no page open. On macOS that is code running as you.\n\nThe strings were already passed as arguments rather than pasted into the script, which is normally the whole defence. It is not enough for `osascript`: its option parser reads any argument starting with a dash as an option, so a name beginning with `-e` was taken as more script instead of as text. Every place the deck hands `osascript` or `notify-send` something from outside now carries an explicit end-of-options marker, so nothing from outside can be read as an instruction again.\n\nNothing to change on your side beyond updating. If you would rather keep the deck off the desktop entirely, the Notifications switch in the sound menu does that, and `AGENTS_DECK_NO_NOTIFY=1` does it at launch — but the fix is the thing to have."}],"3.8.0":[{title:"🔕 Notifications now have an off switch",body:`3.7.0 gave you a "notify me" button and no way back. Turning them off meant digging into your browser's site settings — which no page can do for you — and that still left the other notifier, the one the deck raises when no page is open at all. Silencing that one meant quitting the deck and starting it again with \`AGENTS_DECK_NO_NOTIFY=1\` in front. The person who wanted quiet was the one doing the work.
164
+
165
+ There is a **Notifications** switch in the sound menu now, beside the one for sound — that menu is already "how loudly does this deck interrupt me". One switch governs both notifiers, it takes effect immediately without a restart, and it is remembered across restarts.
166
+
167
+ It is kept by the deck rather than by your browser, because the second notifier runs when no page exists and a setting living in a page could never reach it. \`AGENTS_DECK_NO_NOTIFY=1\` still wins over the switch — a machine told at launch to stay off the desktop stays off it — and when that is the case the menu says so instead of showing an "on" that will not happen.`}],"3.7.1":[{title:"🔔 The notifications now fire on the thing that actually stops your agent",body:`3.7.0 could tell you a session was waiting — but only when Claude Code asked permission to run a tool. If you work with permissions bypassed, that never happens, and the whole feature was silent for you. Measured on one real log: 1683 events, every one of them in bypassPermissions, and a single permission prompt in the entire history.
168
+
169
+ What fires constantly on that setup is the other kind: the agent asking you a question and stopping for the answer. The deck was throwing those away — no amber chip, no row in the sidebar, no notification, and no "notify me" button, because the button only appears while something is actually blocked.
170
+
171
+ Now they count. The card carries the question itself rather than a generic "Your turn" — "paycore needs your input: merge both branches to main, or just one?" — and so does the notification, on the desktop, whether the tab is behind something or not open at all.
172
+
173
+ An idle prompt still stays quiet: a turn that ended is not a session that is stuck, and a channel that cries wolf is one you switch off.`}],"3.7.0":[{title:"🔔 The deck can reach you when you are not looking at it",body:`The deck's whole point is telling you which agent is waiting on you, and until now it could only say so on screen — the amber chip, the tab title, the favicon. Every one of those is drawn inside a page, so the one moment it matters, when you have walked away and four agents have gone quiet, the deck was silent.
174
+
175
+ Now it reaches the desktop, two ways that never overlap. With the deck open behind something, the page raises the notification itself: a "notify me" button appears in the top bar the first time a session blocks, and the browser asks you — nothing is requested before there is something to notify you about. With no page open at all, the server raises it, because it can see that nobody is connected and therefore that no other surface is saying anything.
176
+
177
+ One notification per session, replaced rather than stacked if a second deck raises it too. Clicking it brings the tab forward. \`AGENTS_DECK_NO_NOTIFY=1\` turns the desktop side off entirely, and if you refuse the browser prompt the deck says so plainly instead of leaving you thinking you switched something on — after a refusal only your browser's site settings can undo it, which no page is allowed to touch.`},{title:"🧩 A blocked session now says what it is asking for",body:'"Waiting on you" told you to go and look. The session row and the card now carry the tool the prompt is most likely about, and the tooltip carries the one line of its input that a person actually reads — `rm -rf node_modules` rather than `{"command":"rm -rf node_modules"}`.\n\nIt is a guess and it is worded as one: the deck sees the tool calls, not the permission dialog, so it says "likely on". The deck still cannot allow, deny or answer anything for your agent, and it never will.'},{title:"🧮 Today's figure was counting some sessions twice",body:`The panel reads your usage from ccusage once a minute and fills the gap in between from what the deck is watching. The filling-in was wrong: any session that reached the canvas after the reading had landed was added in full, and since the canvas is still loading when the first reading arrives, that was most of them.
178
+
179
+ Measured on a deck four seconds old: ccusage said $450 for today and the panel said $1,006. The table underneath it said $450 the whole time, which is the disagreement to trust.
180
+
181
+ The deck now adds only work it has actually watched happen. A session that starts while you are looking shows up at the next reading instead of instantly — up to a minute — which is how the panel behaved before the live figure existed at all. Everything already on screen keeps moving as it did.`}],"3.6.0":[{title:"✂️ The two figures at the end of the top bar are gone",body:`The bar used to end with a token count and a dollar figure. Both were sums over what is on the canvas at that moment, and the canvas drops finished sessions a couple of minutes after they end — so both numbers fell on their own, with nothing on screen to explain the fall. They carried the word "board" and a three-line tooltip for exactly that reason.
182
+
183
+ The usage panel answers the same question without the apology: it reads the logs on disk, it covers sessions this deck never watched, and it does not forget. Press U for the panel, or H for the full history.
184
+
185
+ What is left in the bar is what is true right now — whether the stream is alive, and what your machine is doing.`}],"3.5.0":[{title:"⚡ The figures move when the work happens",body:`Reading your usage off the logs is not free — measured here, one reading is 7.8 seconds of CPU, because ccusage walks every transcript on the machine whatever period you asked for. Once a minute is affordable; once every ten seconds would be three quarters of a core, permanently, for numbers that move slowly.
186
+
187
+ So the reading stays on a minute and the deck fills the gap with what it already knows. Every hook event carries its session's running total, so the panel adds whatever has been spent since the last reading and counts up to it. The headline now moves when a turn finishes rather than on the clock, and it costs nothing extra.
188
+
189
+ It only ever adds. A session leaving the canvas cannot pull the figure down, and the next reading corrects whatever the estimate got wrong — the tokens are exact, and the dollars in between are priced by the deck's own table.
190
+
191
+ Two smaller things with it: pressing today, month or all now counts between the two figures instead of swapping them, and coming back to the tab only re-reads if what is on screen is actually stale.`}],"3.4.0":[{title:"🔢 The figures count to their new value, once a minute",body:`The Usage panel re-reads its numbers every minute now rather than every five, and it is a real minute — the server used to hold a reading for two, so a shorter poll would have handed the same figure back.
192
+
193
+ And they no longer teleport. Replaced in a single frame, $170 → $269 says only "this is different now": no direction, no sense of how much, and nothing at all if your eye was a few pixels away. Counted over a fifth of a second, the same change says up, and roughly how far.
194
+
195
+ What deliberately does not count: the first paint, a change of period — "today" and "all time" are different quantities rather than one that moved — the tables, a change too small to read, and anything at all if you have reduced motion on or the tab is in the background.`},{title:"🧹 The board's own figure is out of the Usage panel",body:`3.3.0 put the canvas's live spend on its own labelled line, under whichever period you had chosen. In front of a panel that answers today, this month and all time from the logs on disk, that second money figure answers a question nobody asked at that moment — and it invited a comparison it could never win, $7,385 on the board beneath $170 for today.
196
+
197
+ It is gone. The board's tokens and cost are still on the topbar, with the sentence that explains why they fall on their own, and the panel still shows them when ccusage cannot answer at all.`}],"3.3.0":[{title:"📊 The Usage panel answers for a period, not just for the board",body:`It used to add up the sessions drawn on the canvas — which is an honest number with a scope nobody reads it as having: finished sessions are evicted a couple of minutes after they end, so the figure fell on its own while nothing had happened and nothing was refunded.
198
+
199
+ It now reads ccusage, the same source the H modal uses, and offers today, this month and all time. BY MODEL and BY SESSION come from there too, and each session is named by the project the board knows it as rather than by a uuid.
200
+
201
+ The live figure is still there, on its own line and labelled — what the sessions currently on the board have spent — because that is a different question from what the month cost.
202
+
203
+ One thing worth knowing about the source: ccusage reports a session's LIFETIME total, so the rows under "active today" can add up to more than the day above them. The heading says so.`},{title:"🪟 Windows: a deck started from an elevated terminal was being treated as dead",body:"The hook decides whether a deck is still running by trying to signal it. On POSIX a process you may not signal answers EPERM; on Windows it answers EACCES, and only EPERM was accepted — so a deck started from an elevated terminal, or under another account, read as gone. Its registration was deleted on every event and rewritten five seconds later, while its banner went on saying it was connected and almost nothing arrived.\n\nThree more Windows-only faults went with it: a read-only settings.json made every hook install fail for good (the atomic write could not replace the file); the machine panel answered 500 every four seconds whenever the process read failed; and a bare command name was looked for in the working directory before PATH, which is where `npx ccdeck` was run."},{title:"👁 Browser Watch reads nothing while it is switched off",body:`The switch used to control only what was KEPT. The read happened anyway — every five minutes, on every deck, the panel's badge poll discovered each Chromium profile and copied its whole History database to a temp file to query it. A switch that says off while that continues is not a switch.
204
+
205
+ With the watch off, nothing touches a browser now. Opening the panel still reads live, because that is you looking, and a watch that is ON still records in the background — that is the feature. The trade is that the topbar badge no longer counts findings while the watch is off; open the panel to see them.
206
+
207
+ The README has a Browser Watch section now: what is read, when, where the copy goes, and that only visits after the deck started are ever considered.`},{title:"🔒 The deck's own data is no longer readable by anything on the machine",body:"Changing an account needed the deck's credential; reading the event ring did not. Anything running on your machine could `curl` the events — prompt text, the commands an agent ran, the paths and contents it touched — plus the account list and the browsing episodes.\n\nThose reads now answer to the same rule the mutations do: the deck's own page, or its token. Nothing changes for you in the browser. A script of yours that reads those routes needs the token from `~/.claude/agent-dag/<pid>.json`, sent as `x-ccdeck-token`."},{title:"💳 An API-key, Bedrock or Vertex install is told there is no quota window",body:`Those installs are billed per token and have no five-hour window. The CLI ran, printed no quota lines, and the deck read that as a genuine "under 1%" — drawing two empty bars for a measurement nobody had taken, or telling you to run /usage, which cannot help there.
208
+
209
+ It now says what it is, in one line, the way the Codex half already did.`},{title:"🎨 The model chip is coloured by its model again",body:`A session that switched model — Sonnet, then Opus — drew a chip reading "Opus 5 +1" in Sonnet blue, because the colour was picked from the tooltip and the tooltip lists every model the card's spend covers. Add a Fable turn and it went yellow.
210
+
211
+ Also fixed on the way past: an account import the CLI rejected could take the whole deck down with it, and a corrupt compressed Codex rollout leaked a file handle on every poll.`}],"3.2.1":[{title:"💵 Sonnet 5 was being costed fifty per cent high",body:`Sonnet 5 launched at $2/$10 per million tokens as introductory pricing, with a rise to $3/$15 announced for September 1. The deck implemented that schedule, and on September 1 it started charging the higher rate.
212
+
213
+ The increase was cancelled. Anthropic's pricing page now says the $2/$10 rate is simply the price and the rise "will not occur" — so every Sonnet 5 session since the 1st has been shown to you at half again what it cost.
214
+
215
+ It is corrected, and there is no date logic left in that rate to go stale a second time. Numbers already on your board are recomputed from the log the next time the deck starts; nothing was billed by us, only displayed.
216
+
217
+ Fable 5.1 and Mythos 5.1 are also priced now, including the cache read that is a quarter of Fable 5's — which is most of what a long session pays for.`}],"3.2.0":[{title:"🌡️ Windows shows a temperature where it can find one",body:`On most Windows laptops there is nothing to show, and that is Windows rather than this deck: modern machines declare no ACPI thermal zone, and the sensors that do exist sit behind an interface only an administrator may read. Measured on real hardware, elevated and not.
218
+
219
+ One thing does work, and it costs you nothing to have. If LibreHardwareMonitor happens to be running with its web server on, the deck now reads its numbers over localhost — which needs no privileges at all.
220
+
221
+ It is only ever a read. Nothing is installed, nothing is asked of you, and a machine without it shows no section, exactly as before.`}],"3.1.0":[{title:"🚀 The first run stops looking like it hung",body:`\`npx ccdeck\` on a machine that has never run it used to sit on a spinner at "checking claude-swap" and say nothing else. Measured on a Windows box: seventeen and a half seconds before it told you where to point a browser. It is now one and a half.
222
+
223
+ The deck was waiting for an install nobody asked for during that boot — a Python toolchain being fetched so the accounts panel would work. The port had been open the whole time; there was just nothing on screen to say so.
224
+
225
+ It no longer waits. Anything still working past the boot says so on its own line and keeps going in the background, and the deck comes up without it.`},{title:"⚡ Every start is quicker, and stays quicker",body:`The event log was read from the beginning on every boot to fill a buffer that only keeps the last two thousand events — so four fifths of that reading existed to be thrown away, and it got slower the longer you had been using the deck. It reads from the end now and stops when the buffer is full: 258ms down to 20ms here, on a 34 MB log, and it no longer grows.
226
+
227
+ The accounts tool is also asked for its version once instead of twice, which on this machine was the single largest thing in an ordinary boot.`},{title:"📉 Ten fewer packages to install",body:"Opening your browser used to cost a dependency that brought nine more with it — ten downloads on a cold `npx ccdeck` before the deck's own files were unpacked. It is now done with the commands the operating system already has.\n\nThe package has no runtime dependencies at all."},{title:"🌡️ Temperature, on the machines that could not show it",body:`On Windows the deck was asking somewhere it is not allowed to look: that reading lives behind a namespace that needs administrator, so it failed for everybody and the section never appeared. It reads a performance counter now, which needs nothing.
228
+
229
+ On Apple Silicon there is no command that ships with macOS which prints a temperature at all — the sensors are behind an interface only native code can reach. The deck fetches a small signed tool for it, verified against the checksum its release publishes, in the background and only on the Macs that need it. You do not have to install anything. \`AGENTS_DECK_NO_DOWNLOAD=1\` turns that off.
230
+
231
+ A machine with no sensor still shows no section, which includes every virtual machine. Nothing is drawn that was not measured.`},{title:"😌 The terminal goes quiet when there is nothing happening",body:`The dot at the bottom blinked every 800ms for as long as the deck ran, which is what a terminal does while it is working — so a deck that had finished in a second looked like one that never finished.
232
+
233
+ It now moves only while something actually is: a job still running, or hooks that cannot find the deck. Otherwise it is drawn once and left alone, and it says what the job is rather than just blinking. A step that takes more than three seconds shows how long it has been going, which is the whole of "is this stuck".
234
+
235
+ And a machine with no Claude Code installed stops being told about it every few seconds — that one is said once now, on its own line instead of across the status line.`}],"3.0.0":[{title:"📈 The machine panel now shows what it DID, not just what it is",body:`Click any section of the machine panel — Cores, Memory, Load average, Thermal — and it opens a chart of what that reading has done since the deck started.
236
+
237
+ The panel could always tell you the machine is busy now. It could not tell you whether it got hot while that three-hour build was running, or how deep the queue went while you were away, and those are the questions you actually have afterwards.
238
+
239
+ Thermal is new as well. Where the machine will give degrees, it gives degrees; on a Mac it also reports whether the CPU is being held back to cool down, which is the consequence a temperature has to be interpreted into anyway. Nothing is drawn that was not measured — a machine with no sensor gets no section at all, rather than a zero.`},{title:"🔍 The whole process list, not just the busiest eight",body:`"more" beside Busiest processes opens the full list the deck is watching — around fifty processes rather than eight — with the pid and the untruncated name.
240
+
241
+ This closes a gap. The panel's eight rows are the busiest, so sorting them by name only reorders those eight: "is my test runner still going" could not be answered if the test runner was not already on screen. Now it can.
242
+
243
+ It is deliberately not a task manager. Nothing here ends a process; Activity Monitor and Task Manager are better at that and it is not a thing this deck should own.`},{title:"🔤 Process names in Cyrillic, Greek or with accents read correctly",body:`An application named Яндекс Музыка was showing up as M-PM-/M-PM-=M-PM-4M-PM-5… in the process list, and so was every other name the deck could not spell in plain ASCII.
244
+
245
+ The deck was forcing a fixed locale on the commands it runs, to guarantee that a decimal point stays a point on a machine set to German or Russian — and that also forced the character set. It forces only the number format now. Your own character set is left alone, which is what makes the name arrive intact.`},{title:"📦 The text you copy to share accounts is a third of its size",body:`Sharing three accounts used to produce 6168 characters. It is now 1896.
246
+
247
+ Most of that text was never the credentials — two OAuth tokens are about two hundred characters between them, and the rest was the envelope, whose field names repeated in full for every account added. So the saving grows with the number of accounts rather than shrinking.
248
+
249
+ A blob you copied before this still imports until it expires. One made now cannot be read by a deck older than this version — that is the one thing in this release that older decks cannot follow.`}],"1.48.0":[{title:"👁 Browser Watch — see what a program opened while you were away",body:`There is a new eye in the top bar. It watches the browsers on this machine and tells you when a program — an extension, an agent, a command — opened pages while nobody was touching the browser.
250
+
251
+ Usually that is your own agent doing what you asked, and the panel says so rather than crying intrusion. What it gives you is the evidence: which pages, in which browser, at what time, with every address written out in full.
252
+
253
+ It is off until you switch it on, and nothing leaves this machine. It reads a copy of the browser's own history and only pages newer than the moment the deck started — never anything from before, never cookies, never saved passwords. Open ⚙ inside the panel and "What Browser Watch can access" says exactly what it reads, keeps and sends.
254
+
255
+ When it finds something the eye turns amber with a count. You can dismiss a finding once you have looked at it and it stays gone, while the log file on disk keeps the record. On a Mac it can also close the tab it found, or quit the browser.`},{title:"🔑 Move all your accounts to another machine in one paste",body:`Sharing accounts between two decks used to be one account at a time, and step four of six is where people stop — leaving the second deck half set up with nothing saying so.
256
+
257
+ Pick the accounts you want, copy one blob, paste it into the other deck. The import adds what is missing, leaves what already works alone, heals an account whose token has died, and tells you which of those happened to each one.
258
+
259
+ The blob carries real credentials, so it expires ten minutes after you make it and the deck refuses an expired one before it unwraps anything.`}],"1.47.0":[{title:"🔌 The top bar goes quiet when everything is fine",body:`The green "live" pill used to sit up there permanently to tell you nothing was broken. It is gone while things are working.
260
+
261
+ You will still see a pill when it matters: amber when you pause the canvas, with how many events are waiting, and red when the deck loses its connection to the server. No pill means all is well.`},{title:"🔴 The browser tab tells you when the connection drops",body:`The little icon in the tab has always shown what your sessions are doing — grey when it is quiet, blue when something is working, amber when a session is waiting on you.
262
+
263
+ It could not say the one thing that matters most: that the deck has stopped hearing from the server. Until now it just kept showing whatever it had last seen. It turns into a broken red ring instead, so you can spot it from another tab without switching over.`}],"1.46.0":[{title:"🔊 Pick a volume and a sound for each of the two tones",body:`Click the speaker in the top bar and a small menu opens. There are two tones — one when a turn finishes, one when Claude is waiting for you — and each has its own volume and its own sound, six to choose from. Press "Hear it" to try one straight away, without waiting for a real turn.
264
+
265
+ The two lists are separate on purpose, so you can never end up with both tones sounding the same. A finish tone always falls; an asking tone always rises. That is how you tell them apart without looking at the screen.
266
+
267
+ M still turns the sound on and off from anywhere.`},{title:"✨ This box is new",body:`After an update, the deck tells you what changed — once, and only when there is something worth telling. Most updates have nothing to say and you will see nothing at all.
268
+
269
+ Click the version at the top of the deck to read it again whenever you like.`}],"1.45.0":[{title:"🔕 The deck no longer puts anything in your settings.json",body:"It used to add a hook there so Claude Code would play a sound when a turn ended. That entry is removed the first time you start this version, and any sound hook you wrote yourself is put back exactly where you had it. Nothing else in that file is touched. The deck makes the sound itself now — which is also why you finally hear one when a Codex turn ends, not just a Claude one."}],"3.16.0":[{title:"🤝 Pair two decks with one piece of text",body:`**Accounts ▸ Local network ▸ setup… ▸ make an invite.** Send the text however you already talk to them; they paste it and the two decks are paired. Nobody presses accept, and neither of you has to know which of your addresses the other can reach — the invite carries them all and their deck tries each one.
270
+
271
+ Decks on the same router still find each other on their own and appear under **on this network right now**. An invite is for the case that does not work: another subnet, a VPN, a firewall.
272
+
273
+ The invite lasts 10 minutes and is used once. Anyone who gets hold of the text can pair with your deck until it runs out, so send it the way you would send anything else you would not want forwarded.`},{title:"⚠️ Both machines have to be on this version",body:`The two decks no longer speak the old protocol, and there is no fallback: a 3.15 deck and a 3.16 deck cannot see each other at all. Update both.
274
+
275
+ The group passphrase is gone. If you had one set, that pairing is not carried over — make an invite and pair again. It was replaced because a passphrase that differs by one character produced a closed socket and no other symptom on either machine, and a secret is the one thing a panel must never print, so neither person could check theirs against the other's.`}],"3.22.1":[{title:"🖥️ A first run now opens This machine too",body:`Accounts and usage already opened themselves the first time you ran the deck; the machine panel did not, and now does. It is the panel that answers "is this box coping" — cores, memory, load, temperature — and somebody meeting the deck for the first time cannot ask for a panel they do not know is there.
276
+
277
+ It only does this when you have never said otherwise. Close it once and it stays closed, on that browser, for good — the same rule the other two panels have always followed. Nothing reopens it behind you.
278
+
279
+ While it is open it polls this machine once every few seconds, and it stops the moment you close it or switch tabs.`}],"3.22.4":[{title:"📈 A card stops looking idle while it is thinking",body:`The activity chart on each card counted tool calls and nothing else, so the time an agent spends reading, reasoning and writing drew as a flat line — measured on this machine, 16.5% of all working time, more than the time spent inside the tools themselves. A session that was busy looked exactly like one that had died, and the only way to tell them apart was to wait and see whether anything ever appeared.
280
+
281
+ It marks that work now. A chart with bars in it means the agent is doing something, whether or not it has called a tool in the last minute; a flat chart means it genuinely is not. Hover it for the split — how many tool calls and how many blocks of thinking and writing landed in the last 60 seconds.
282
+
283
+ Nothing was added to the card and nothing new is polled. The deck already reads each session's transcript for its token counts; this reads the same file for what the model has finished writing, and a session that is quiet costs one file check per second and a half.`}]},s0="agent-dag.releaseNotesSeen";function M_(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Bi(e,t){const n=M_(e),s=M_(t);for(let a=0;a<Math.max(n.length,s.length);a++){const i=(n[a]??0)-(s[a]??0);if(i!==0)return i<0?-1:1}return 0}function zi(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function aB(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 oB(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!zi(n)||!Array.isArray(s))continue;const a=s.filter(aB);a.length&&t.push({version:n,notes:a})}return t.sort((n,s)=>Bi(s.version,n.version))}const I_=oB(sB);function WA(e,t,n){return e.filter(s=>Bi(s.version,n)<=0&&(t===null||Bi(s.version,t)>0))}function iB(e,t){return e.filter(n=>Bi(n.version,t)===0)}function lB(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 cB({since:e,running:t,entries:n,firstRun:s}){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(s&&zi(t))return`The deck has not run in this browser before, so this is what v${t} — the release you have — changed. Earlier releases are not repeated here; clicking the version in the topbar brings all of them back.`;const a=n[0].version;if(!zi(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const i=Bi(a,t);return i<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:i>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const uB=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function dB(e){const t=uB.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function $_(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function hB(e){if(!e)return null;let t=null;try{t=e.getItem(s0)}catch{return null}return zi(t)?t:null}function fB(e){if(!e)return!1;try{return e.getItem(s0),!0}catch{return!1}}function pB(e,t){if(!e)return!1;try{return e.setItem(s0,t),!0}catch{return!1}}const HA="agent-dag.tourSeen";function mB(e){if(!e)return!1;try{return e.getItem(HA)==="1"}catch{return!1}}function gB(e){if(!e)return!1;try{return e.setItem(HA,"1"),!0}catch{return!1}}function yB({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 wB({stored:e,running:t,notes:n,remembers:s=!0}){if(!zi(t))return{show:[],record:null,reason:"no-version"};if(!zi(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const c=iB(n,t);return c.length?{show:c,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=Bi(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const i=WA(n,e,t);return i.length?{show:i,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function vB(e,t){if(/\s|^$/.test(e[t+2]??""))return-1;let n=t+2;for(;n<e.length;){if(e[n]==="`"){const s=e.indexOf("`",n+1);if(s<0)break;n=s+1;continue}if(e.startsWith("**",n)&&!/\s/.test(e[n-1]??" "))return n;n++}return-1}function GA(e,t=!0){const n=[];let s="";const a=()=>{s&&(n.push({kind:"text",text:s}),s="")};let i=0;for(;i<e.length;){if(e[i]==="`"){const c=e.indexOf("`",i+1);if(c>i+1){a(),n.push({kind:"code",text:e.slice(i+1,c)}),i=c+1;continue}}else if(t&&e.startsWith("**",i)){const c=vB(e,i);if(c>0){a(),n.push({kind:"bold",kids:GA(e.slice(i+2,c),!1)}),i=c+2;continue}}s+=e[i],i+=1}return a(),n}function xB({entries:e,since:t,running:n,firstRun:s,onClose:a,onTour:i}){const c=dn(a),u=lB(e);return l.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:l.jsxs("div",{ref:c,className:"modal release-notes",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),u&&l.jsx("span",{className:"modal-tool-id",children:u})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsx("p",{className:"modal-note",children:cB({since:t,running:n,firstRun:s,entries:e})}),i&&l.jsxs("div",{className:"guide-door",children:[l.jsx("span",{children:"Eight pictures of what the deck shows."}),l.jsx("button",{type:"button",className:"btn",onClick:i,children:"Take the tour"})]}),e.map(f=>l.jsxs("section",{className:"modal-section",children:[l.jsxs("h3",{className:"rn-version",children:["v",f.version]}),l.jsx("ul",{className:"rn-notes",children:f.notes.map((p,h)=>{const{icon:m,rest:y}=dB(p.title);return l.jsxs("li",{className:"rn-note",children:[l.jsxs("p",{className:"rn-note-title",children:[m&&l.jsx("span",{className:"rn-note-icon",children:m}),y]}),l.jsx("p",{className:"rn-note-body",children:VA(GA(p.body))})]},h)})})]},f.version))]})]})})}function VA(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?l.jsx("code",{className:"rn-code",children:t.text},n):l.jsx("strong",{className:"rn-strong",children:VA(t.kids)},n))}function bB(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function kB(e,t,n){var c;if(e.length===0)return null;const s=bB(e),a=t?s.findIndex(u=>u.id===t):-1,i=a===-1?n===1?0:s.length-1:(a+n+s.length)%s.length;return((c=s[i])==null?void 0:c.id)??null}const _B=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function NB(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:_B.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const SB=new Set(["","BODY","HTML","#DOCUMENT"]);function jB(e){return!e||Wx(e)?!1:!SB.has(String(e.tagName??"").toUpperCase())}function id(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function EB(e,t){let n=!1;for(const a of e)if(!t.has(a)){n=!0;break}if(!n)return e;const s=new Set;for(const a of e)t.has(a)&&s.add(a);return s}function CB(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`),n.kind==="root"&&t.add(Hx(n.id));return t}function TB(e){const t=new Set;for(const n of e)t.add(n.id),n.kind==="root"&&t.add(Hx(n.id));return t}function AB(e,t){if(!t||!e.agents.get(t))return null;const s=new Set([t]);let a=t;for(;a;){const c=e.agents.get(a);if(!(c!=null&&c.parentId)||s.has(c.parentId))break;s.add(c.parentId),a=c.parentId}let i=!0;for(;i;){i=!1;for(const c of e.agents.values())c.parentId&&s.has(c.parentId)&&!s.has(c.id)&&(s.add(c.id),i=!0)}return s}function RB(e,t){const n=new Set;for(const s of t){const a=AB(e,s);if(a)for(const i of a)n.add(i)}return n.size>0?n:null}function kd(e,t,n){return!t.has(e)||n.has(e)}function MB(e,t,n,s){return!t.has(e)&&kd(e,n,s)}function IB(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function O_(e,t,n,s){n.set(e,t),s.delete(e)}const $B=40,OB=120;function PB(e,t){let n=null,s=0,a=Number.NEGATIVE_INFINITY;const i=()=>{n=null,a=t.now(),e()},c=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(f,p,h)=>{if(n!=null){if(s<=f)return;c()}const m=Math.min(h,Math.max(0,f-p));s=f,n=t.setTimeout(i,m)};return{live(f=$B){const p=t.now(),h=Math.max(a+f,p);if(h<=p){c(),i();return}u(h,p,f)},replay(f=OB){c(),s=t.now()+f,n=t.setTimeout(i,f)},flush(){c(),i()},cancel(){c()}}}const LB=1e3;function DB(e={}){const t=Math.max(1,Math.floor(e.limit??LB)),n=e.protect;let s=!1,a=[],i=new Set,c=0,u=0,f=null;return{get paused(){return s},get size(){return a.length},get dropped(){return c},get overflowed(){return c>0},get through(){return u},accept(p){const h=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,m=(p==null?void 0:p.epoch)??null,y=m!==null&&m!==f;y&&(f=m,u=0);const w=h!==null&&!y&&h<=u;if(h!==null&&h>u&&(u=h),!s)return!0;if(w)return!1;if(a.push(p),n!=null&&n(p)&&i.add(p),a.length>t){let N=0;if(i.size<a.length)for(;i.has(a[N]);)N++;const[_]=a.splice(N,1);i.delete(_),c++}return!1},setPaused(p){if(s=p,p)return[];const h=a;return a=[],i=new Set,c=0,h}}}const YA="agent-dag.theme";function qB(e,t=!1){return e==="light"||e==="dark"?e:t?"light":"dark"}function FB(){try{return window.matchMedia("(prefers-color-scheme: light)").matches}catch{return!1}}function BB(){return qB(yo(YA),FB())}const zB=6,UB="ccdeck-tabs";function WB(e){return e>=zB}function HB(e,t,n){const s=a=>{const i=a.data;(i==null?void 0:i.kind)==="who"&&i.from!==t&&e.postMessage({kind:"here",from:t,to:i.from,streaming:n()})};return e.addEventListener("message",s),{ask(a,i=(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}),i(()=>{e.removeEventListener("message",f),c(u.size)},a)})},leave(){var a;e.removeEventListener("message",s),(a=e.close)==null||a.call(e)}}}function GB({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${Zt}`:Zt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const ld={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function cd(e,t){const a=c=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${c}/>`;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${t==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:t==="offline"?a(` stroke-dasharray="${56.5485.toFixed(2)} ${18.8495.toFixed(2)}" transform="rotate(-58 16 16)"`):a("")+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const VB=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(cd(ld.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(cd(ld.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(cd(ld.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(cd(ld.idle,"idle"))}`}),YB="No sessions are waiting for you.";function KB(e){if(e.length===0)return"";const[t,...n]=e;if(n.length===0)return`${t.label} is waiting for your permission.`;const s=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${s} are waiting for your permission.`}function XB(e,t){return t!==""?t:e===""?"":YB}const P_="agent-dag.browserWatch.seenMs";function ZB(e,t){return e.filter(n=>n.startMs>t)}function QB(e,t){const n=(e??[]).filter(a=>a&&typeof a.fp=="string"&&!t.has(a.fp));if(!n.length)return{request:null,waiting:0};const s=[...n].sort((a,i)=>(a.at??0)-(i.at??0));return{request:s[0],waiting:s.length-1}}function JB({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:i,onLater:c}){const u=x.useRef(null),f=dn(c,{focusRef:u}),p=la(n,"accept"),h=la(n,"dismiss");return l.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:l.jsxs("div",{ref:f,className:"modal lan-ask",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("i",{className:"ap-pulse","aria-hidden":!0}),l.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:c,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsxs("p",{className:"lan-ask-who",children:[l.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",l.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",n0(e.at,s)]}),l.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."}),l.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",l.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&&l.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.`}),l.jsxs("div",{className:"lan-ask-acts",children:[l.jsx("button",{type:"button",ref:u,className:"btn",disabled:h.disabled,"aria-busy":h.busy,onClick:i,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),l.jsx("button",{type:"button",className:"btn primary",disabled:p.disabled,"aria-busy":p.busy,onClick:a,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function a0(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 wp,L_;function ez(){if(L_)return wp;L_=1;function e(){this.__data__=[],this.size=0}return wp=e,wp}var vp,D_;function Wi(){if(D_)return vp;D_=1;function e(t,n){return t===n||t!==t&&n!==n}return vp=e,vp}var xp,q_;function ih(){if(q_)return xp;q_=1;var e=Wi();function t(n,s){for(var a=n.length;a--;)if(e(n[a][0],s))return a;return-1}return xp=t,xp}var bp,F_;function tz(){if(F_)return bp;F_=1;var e=ih(),t=Array.prototype,n=t.splice;function s(a){var i=this.__data__,c=e(i,a);if(c<0)return!1;var u=i.length-1;return c==u?i.pop():n.call(i,c,1),--this.size,!0}return bp=s,bp}var kp,B_;function nz(){if(B_)return kp;B_=1;var e=ih();function t(n){var s=this.__data__,a=e(s,n);return a<0?void 0:s[a][1]}return kp=t,kp}var _p,z_;function rz(){if(z_)return _p;z_=1;var e=ih();function t(n){return e(this.__data__,n)>-1}return _p=t,_p}var Np,U_;function sz(){if(U_)return Np;U_=1;var e=ih();function t(n,s){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,s])):a[i][1]=s,this}return Np=t,Np}var Sp,W_;function lh(){if(W_)return Sp;W_=1;var e=ez(),t=tz(),n=nz(),s=rz(),a=sz();function i(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 i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,Sp=i,Sp}var jp,H_;function az(){if(H_)return jp;H_=1;var e=lh();function t(){this.__data__=new e,this.size=0}return jp=t,jp}var Ep,G_;function oz(){if(G_)return Ep;G_=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return Ep=e,Ep}var Cp,V_;function iz(){if(V_)return Cp;V_=1;function e(t){return this.__data__.get(t)}return Cp=e,Cp}var Tp,Y_;function lz(){if(Y_)return Tp;Y_=1;function e(t){return this.__data__.has(t)}return Tp=e,Tp}var Ap,K_;function KA(){if(K_)return Ap;K_=1;var e=typeof zu=="object"&&zu&&zu.Object===Object&&zu;return Ap=e,Ap}var Rp,X_;function Ir(){if(X_)return Rp;X_=1;var e=KA(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Rp=n,Rp}var Mp,Z_;function Hi(){if(Z_)return Mp;Z_=1;var e=Ir(),t=e.Symbol;return Mp=t,Mp}var Ip,Q_;function cz(){if(Q_)return Ip;Q_=1;var e=Hi(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function i(c){var u=n.call(c,a),f=c[a];try{c[a]=void 0;var p=!0}catch{}var h=s.call(c);return p&&(u?c[a]=f:delete c[a]),h}return Ip=i,Ip}var $p,J_;function uz(){if(J_)return $p;J_=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return $p=n,$p}var Op,eN;function wo(){if(eN)return Op;eN=1;var e=Hi(),t=cz(),n=uz(),s="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function c(u){return u==null?u===void 0?a:s:i&&i in Object(u)?t(u):n(u)}return Op=c,Op}var Pp,tN;function cr(){if(tN)return Pp;tN=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Pp=e,Pp}var Lp,nN;function Ac(){if(nN)return Lp;nN=1;var e=wo(),t=cr(),n="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function c(u){if(!t(u))return!1;var f=e(u);return f==s||f==a||f==n||f==i}return Lp=c,Lp}var Dp,rN;function dz(){if(rN)return Dp;rN=1;var e=Ir(),t=e["__core-js_shared__"];return Dp=t,Dp}var qp,sN;function hz(){if(sN)return qp;sN=1;var e=dz(),t=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function n(s){return!!t&&t in s}return qp=n,qp}var Fp,aN;function XA(){if(aN)return Fp;aN=1;var e=Function.prototype,t=e.toString;function n(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return Fp=n,Fp}var Bp,oN;function fz(){if(oN)return Bp;oN=1;var e=Ac(),t=hz(),n=cr(),s=XA(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,f=c.toString,p=u.hasOwnProperty,h=RegExp("^"+f.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!n(y)||t(y))return!1;var w=e(y)?h:i;return w.test(s(y))}return Bp=m,Bp}var zp,iN;function pz(){if(iN)return zp;iN=1;function e(t,n){return t==null?void 0:t[n]}return zp=e,zp}var Up,lN;function vo(){if(lN)return Up;lN=1;var e=fz(),t=pz();function n(s,a){var i=t(s,a);return e(i)?i:void 0}return Up=n,Up}var Wp,cN;function o0(){if(cN)return Wp;cN=1;var e=vo(),t=Ir(),n=e(t,"Map");return Wp=n,Wp}var Hp,uN;function ch(){if(uN)return Hp;uN=1;var e=vo(),t=e(Object,"create");return Hp=t,Hp}var Gp,dN;function mz(){if(dN)return Gp;dN=1;var e=ch();function t(){this.__data__=e?e(null):{},this.size=0}return Gp=t,Gp}var Vp,hN;function gz(){if(hN)return Vp;hN=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Vp=e,Vp}var Yp,fN;function yz(){if(fN)return Yp;fN=1;var e=ch(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function a(i){var c=this.__data__;if(e){var u=c[i];return u===t?void 0:u}return s.call(c,i)?c[i]:void 0}return Yp=a,Yp}var Kp,pN;function wz(){if(pN)return Kp;pN=1;var e=ch(),t=Object.prototype,n=t.hasOwnProperty;function s(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return Kp=s,Kp}var Xp,mN;function vz(){if(mN)return Xp;mN=1;var e=ch(),t="__lodash_hash_undefined__";function n(s,a){var i=this.__data__;return this.size+=this.has(s)?0:1,i[s]=e&&a===void 0?t:a,this}return Xp=n,Xp}var Zp,gN;function xz(){if(gN)return Zp;gN=1;var e=mz(),t=gz(),n=yz(),s=wz(),a=vz();function i(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 i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,Zp=i,Zp}var Qp,yN;function bz(){if(yN)return Qp;yN=1;var e=xz(),t=lh(),n=o0();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Qp=s,Qp}var Jp,wN;function kz(){if(wN)return Jp;wN=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Jp=e,Jp}var em,vN;function uh(){if(vN)return em;vN=1;var e=kz();function t(n,s){var a=n.__data__;return e(s)?a[typeof s=="string"?"string":"hash"]:a.map}return em=t,em}var tm,xN;function _z(){if(xN)return tm;xN=1;var e=uh();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return tm=t,tm}var nm,bN;function Nz(){if(bN)return nm;bN=1;var e=uh();function t(n){return e(this,n).get(n)}return nm=t,nm}var rm,kN;function Sz(){if(kN)return rm;kN=1;var e=uh();function t(n){return e(this,n).has(n)}return rm=t,rm}var sm,_N;function jz(){if(_N)return sm;_N=1;var e=uh();function t(n,s){var a=e(this,n),i=a.size;return a.set(n,s),this.size+=a.size==i?0:1,this}return sm=t,sm}var am,NN;function i0(){if(NN)return am;NN=1;var e=bz(),t=_z(),n=Nz(),s=Sz(),a=jz();function i(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 i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,am=i,am}var om,SN;function Ez(){if(SN)return om;SN=1;var e=lh(),t=o0(),n=i0(),s=200;function a(i,c){var u=this.__data__;if(u instanceof e){var f=u.__data__;if(!t||f.length<s-1)return f.push([i,c]),this.size=++u.size,this;u=this.__data__=new n(f)}return u.set(i,c),this.size=u.size,this}return om=a,om}var im,jN;function dh(){if(jN)return im;jN=1;var e=lh(),t=az(),n=oz(),s=iz(),a=lz(),i=Ez();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=s,c.prototype.has=a,c.prototype.set=i,im=c,im}var lm,EN;function l0(){if(EN)return lm;EN=1;function e(t,n){for(var s=-1,a=t==null?0:t.length;++s<a&&n(t[s],s,t)!==!1;);return t}return lm=e,lm}var cm,CN;function ZA(){if(CN)return cm;CN=1;var e=vo(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return cm=t,cm}var um,TN;function hh(){if(TN)return um;TN=1;var e=ZA();function t(n,s,a){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[s]=a}return um=t,um}var dm,AN;function fh(){if(AN)return dm;AN=1;var e=hh(),t=Wi(),n=Object.prototype,s=n.hasOwnProperty;function a(i,c,u){var f=i[c];(!(s.call(i,c)&&t(f,u))||u===void 0&&!(c in i))&&e(i,c,u)}return dm=a,dm}var hm,RN;function Rc(){if(RN)return hm;RN=1;var e=fh(),t=hh();function n(s,a,i,c){var u=!i;i||(i={});for(var f=-1,p=a.length;++f<p;){var h=a[f],m=c?c(i[h],s[h],h,i,s):void 0;m===void 0&&(m=s[h]),u?t(i,h,m):e(i,h,m)}return i}return hm=n,hm}var fm,MN;function Cz(){if(MN)return fm;MN=1;function e(t,n){for(var s=-1,a=Array(t);++s<t;)a[s]=n(s);return a}return fm=e,fm}var pm,IN;function Xr(){if(IN)return pm;IN=1;function e(t){return t!=null&&typeof t=="object"}return pm=e,pm}var mm,$N;function Tz(){if($N)return mm;$N=1;var e=wo(),t=Xr(),n="[object Arguments]";function s(a){return t(a)&&e(a)==n}return mm=s,mm}var gm,ON;function Mc(){if(ON)return gm;ON=1;var e=Tz(),t=Xr(),n=Object.prototype,s=n.hasOwnProperty,a=n.propertyIsEnumerable,i=e((function(){return arguments})())?e:function(c){return t(c)&&s.call(c,"callee")&&!a.call(c,"callee")};return gm=i,gm}var ym,PN;function Ht(){if(PN)return ym;PN=1;var e=Array.isArray;return ym=e,ym}var ec={exports:{}},wm,LN;function Az(){if(LN)return wm;LN=1;function e(){return!1}return wm=e,wm}ec.exports;var DN;function Gi(){return DN||(DN=1,(function(e,t){var n=Ir(),s=Az(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,c=i&&i.exports===a,u=c?n.Buffer:void 0,f=u?u.isBuffer:void 0,p=f||s;e.exports=p})(ec,ec.exports)),ec.exports}var vm,qN;function ph(){if(qN)return vm;qN=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,a){var i=typeof s;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<a}return vm=n,vm}var xm,FN;function c0(){if(FN)return xm;FN=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return xm=t,xm}var bm,BN;function Rz(){if(BN)return bm;BN=1;var e=wo(),t=c0(),n=Xr(),s="[object Arguments]",a="[object Array]",i="[object Boolean]",c="[object Date]",u="[object Error]",f="[object Function]",p="[object Map]",h="[object Number]",m="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",_="[object WeakMap]",j="[object ArrayBuffer]",k="[object DataView]",S="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",T="[object Int16Array]",R="[object Int32Array]",I="[object Uint8Array]",F="[object Uint8ClampedArray]",W="[object Uint16Array]",O="[object Uint32Array]",B={};B[S]=B[E]=B[C]=B[T]=B[R]=B[I]=B[F]=B[W]=B[O]=!0,B[s]=B[a]=B[j]=B[i]=B[k]=B[c]=B[u]=B[f]=B[p]=B[h]=B[m]=B[y]=B[w]=B[N]=B[_]=!1;function Z(Q){return n(Q)&&t(Q.length)&&!!B[e(Q)]}return bm=Z,bm}var km,zN;function mh(){if(zN)return km;zN=1;function e(t){return function(n){return t(n)}}return km=e,km}var tc={exports:{}};tc.exports;var UN;function u0(){return UN||(UN=1,(function(e,t){var n=KA(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,c=i&&n.process,u=(function(){try{var f=a&&a.require&&a.require("util").types;return f||c&&c.binding&&c.binding("util")}catch{}})();e.exports=u})(tc,tc.exports)),tc.exports}var _m,WN;function Ic(){if(WN)return _m;WN=1;var e=Rz(),t=mh(),n=u0(),s=n&&n.isTypedArray,a=s?t(s):e;return _m=a,_m}var Nm,HN;function QA(){if(HN)return Nm;HN=1;var e=Cz(),t=Mc(),n=Ht(),s=Gi(),a=ph(),i=Ic(),c=Object.prototype,u=c.hasOwnProperty;function f(p,h){var m=n(p),y=!m&&t(p),w=!m&&!y&&s(p),N=!m&&!y&&!w&&i(p),_=m||y||w||N,j=_?e(p.length,String):[],k=j.length;for(var S in p)(h||u.call(p,S))&&!(_&&(S=="length"||w&&(S=="offset"||S=="parent")||N&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||a(S,k)))&&j.push(S);return j}return Nm=f,Nm}var Sm,GN;function gh(){if(GN)return Sm;GN=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,a=typeof s=="function"&&s.prototype||e;return n===a}return Sm=t,Sm}var jm,VN;function JA(){if(VN)return jm;VN=1;function e(t,n){return function(s){return t(n(s))}}return jm=e,jm}var Em,YN;function Mz(){if(YN)return Em;YN=1;var e=JA(),t=e(Object.keys,Object);return Em=t,Em}var Cm,KN;function d0(){if(KN)return Cm;KN=1;var e=gh(),t=Mz(),n=Object.prototype,s=n.hasOwnProperty;function a(i){if(!e(i))return t(i);var c=[];for(var u in Object(i))s.call(i,u)&&u!="constructor"&&c.push(u);return c}return Cm=a,Cm}var Tm,XN;function bs(){if(XN)return Tm;XN=1;var e=Ac(),t=c0();function n(s){return s!=null&&t(s.length)&&!e(s)}return Tm=n,Tm}var Am,ZN;function ca(){if(ZN)return Am;ZN=1;var e=QA(),t=d0(),n=bs();function s(a){return n(a)?e(a):t(a)}return Am=s,Am}var Rm,QN;function Iz(){if(QN)return Rm;QN=1;var e=Rc(),t=ca();function n(s,a){return s&&e(a,t(a),s)}return Rm=n,Rm}var Mm,JN;function $z(){if(JN)return Mm;JN=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return Mm=e,Mm}var Im,eS;function Oz(){if(eS)return Im;eS=1;var e=cr(),t=gh(),n=$z(),s=Object.prototype,a=s.hasOwnProperty;function i(c){if(!e(c))return n(c);var u=t(c),f=[];for(var p in c)p=="constructor"&&(u||!a.call(c,p))||f.push(p);return f}return Im=i,Im}var $m,tS;function xo(){if(tS)return $m;tS=1;var e=QA(),t=Oz(),n=bs();function s(a){return n(a)?e(a,!0):t(a)}return $m=s,$m}var Om,nS;function Pz(){if(nS)return Om;nS=1;var e=Rc(),t=xo();function n(s,a){return s&&e(a,t(a),s)}return Om=n,Om}var nc={exports:{}};nc.exports;var rS;function eR(){return rS||(rS=1,(function(e,t){var n=Ir(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,c=i?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})(nc,nc.exports)),nc.exports}var Pm,sS;function tR(){if(sS)return Pm;sS=1;function e(t,n){var s=-1,a=t.length;for(n||(n=Array(a));++s<a;)n[s]=t[s];return n}return Pm=e,Pm}var Lm,aS;function nR(){if(aS)return Lm;aS=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=0,c=[];++s<a;){var u=t[s];n(u,s,t)&&(c[i++]=u)}return c}return Lm=e,Lm}var Dm,oS;function rR(){if(oS)return Dm;oS=1;function e(){return[]}return Dm=e,Dm}var qm,iS;function h0(){if(iS)return qm;iS=1;var e=nR(),t=rR(),n=Object.prototype,s=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(c){return c==null?[]:(c=Object(c),e(a(c),function(u){return s.call(c,u)}))}:t;return qm=i,qm}var Fm,lS;function Lz(){if(lS)return Fm;lS=1;var e=Rc(),t=h0();function n(s,a){return e(s,t(s),a)}return Fm=n,Fm}var Bm,cS;function f0(){if(cS)return Bm;cS=1;function e(t,n){for(var s=-1,a=n.length,i=t.length;++s<a;)t[i+s]=n[s];return t}return Bm=e,Bm}var zm,uS;function yh(){if(uS)return zm;uS=1;var e=JA(),t=e(Object.getPrototypeOf,Object);return zm=t,zm}var Um,dS;function sR(){if(dS)return Um;dS=1;var e=f0(),t=yh(),n=h0(),s=rR(),a=Object.getOwnPropertySymbols,i=a?function(c){for(var u=[];c;)e(u,n(c)),c=t(c);return u}:s;return Um=i,Um}var Wm,hS;function Dz(){if(hS)return Wm;hS=1;var e=Rc(),t=sR();function n(s,a){return e(s,t(s),a)}return Wm=n,Wm}var Hm,fS;function aR(){if(fS)return Hm;fS=1;var e=f0(),t=Ht();function n(s,a,i){var c=a(s);return t(s)?c:e(c,i(s))}return Hm=n,Hm}var Gm,pS;function oR(){if(pS)return Gm;pS=1;var e=aR(),t=h0(),n=ca();function s(a){return e(a,n,t)}return Gm=s,Gm}var Vm,mS;function qz(){if(mS)return Vm;mS=1;var e=aR(),t=sR(),n=xo();function s(a){return e(a,n,t)}return Vm=s,Vm}var Ym,gS;function Fz(){if(gS)return Ym;gS=1;var e=vo(),t=Ir(),n=e(t,"DataView");return Ym=n,Ym}var Km,yS;function Bz(){if(yS)return Km;yS=1;var e=vo(),t=Ir(),n=e(t,"Promise");return Km=n,Km}var Xm,wS;function iR(){if(wS)return Xm;wS=1;var e=vo(),t=Ir(),n=e(t,"Set");return Xm=n,Xm}var Zm,vS;function zz(){if(vS)return Zm;vS=1;var e=vo(),t=Ir(),n=e(t,"WeakMap");return Zm=n,Zm}var Qm,xS;function Vi(){if(xS)return Qm;xS=1;var e=Fz(),t=o0(),n=Bz(),s=iR(),a=zz(),i=wo(),c=XA(),u="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",m="[object WeakMap]",y="[object DataView]",w=c(e),N=c(t),_=c(n),j=c(s),k=c(a),S=i;return(e&&S(new e(new ArrayBuffer(1)))!=y||t&&S(new t)!=u||n&&S(n.resolve())!=p||s&&S(new s)!=h||a&&S(new a)!=m)&&(S=function(E){var C=i(E),T=C==f?E.constructor:void 0,R=T?c(T):"";if(R)switch(R){case w:return y;case N:return u;case _:return p;case j:return h;case k:return m}return C}),Qm=S,Qm}var Jm,bS;function Uz(){if(bS)return Jm;bS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var a=s.length,i=new s.constructor(a);return a&&typeof s[0]=="string"&&t.call(s,"index")&&(i.index=s.index,i.input=s.input),i}return Jm=n,Jm}var eg,kS;function lR(){if(kS)return eg;kS=1;var e=Ir(),t=e.Uint8Array;return eg=t,eg}var tg,_S;function p0(){if(_S)return tg;_S=1;var e=lR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return tg=t,tg}var ng,NS;function Wz(){if(NS)return ng;NS=1;var e=p0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return ng=t,ng}var rg,SS;function Hz(){if(SS)return rg;SS=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return rg=t,rg}var sg,jS;function Gz(){if(jS)return sg;jS=1;var e=Hi(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(a){return n?Object(n.call(a)):{}}return sg=s,sg}var ag,ES;function cR(){if(ES)return ag;ES=1;var e=p0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return ag=t,ag}var og,CS;function Vz(){if(CS)return og;CS=1;var e=p0(),t=Wz(),n=Hz(),s=Gz(),a=cR(),i="[object Boolean]",c="[object Date]",u="[object Map]",f="[object Number]",p="[object RegExp]",h="[object Set]",m="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",j="[object Float64Array]",k="[object Int8Array]",S="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",I="[object Uint32Array]";function F(W,O,B){var Z=W.constructor;switch(O){case w:return e(W);case i:case c:return new Z(+W);case N:return t(W,B);case _:case j:case k:case S:case E:case C:case T:case R:case I:return a(W,B);case u:return new Z;case f:case m:return new Z(W);case p:return n(W);case h:return new Z;case y:return s(W)}}return og=F,og}var ig,TS;function uR(){if(TS)return ig;TS=1;var e=cr(),t=Object.create,n=(function(){function s(){}return function(a){if(!e(a))return{};if(t)return t(a);s.prototype=a;var i=new s;return s.prototype=void 0,i}})();return ig=n,ig}var lg,AS;function dR(){if(AS)return lg;AS=1;var e=uR(),t=yh(),n=gh();function s(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return lg=s,lg}var cg,RS;function Yz(){if(RS)return cg;RS=1;var e=Vi(),t=Xr(),n="[object Map]";function s(a){return t(a)&&e(a)==n}return cg=s,cg}var ug,MS;function Kz(){if(MS)return ug;MS=1;var e=Yz(),t=mh(),n=u0(),s=n&&n.isMap,a=s?t(s):e;return ug=a,ug}var dg,IS;function Xz(){if(IS)return dg;IS=1;var e=Vi(),t=Xr(),n="[object Set]";function s(a){return t(a)&&e(a)==n}return dg=s,dg}var hg,$S;function Zz(){if($S)return hg;$S=1;var e=Xz(),t=mh(),n=u0(),s=n&&n.isSet,a=s?t(s):e;return hg=a,hg}var fg,OS;function hR(){if(OS)return fg;OS=1;var e=dh(),t=l0(),n=fh(),s=Iz(),a=Pz(),i=eR(),c=tR(),u=Lz(),f=Dz(),p=oR(),h=qz(),m=Vi(),y=Uz(),w=Vz(),N=dR(),_=Ht(),j=Gi(),k=Kz(),S=cr(),E=Zz(),C=ca(),T=xo(),R=1,I=2,F=4,W="[object Arguments]",O="[object Array]",B="[object Boolean]",Z="[object Date]",Q="[object Error]",M="[object Function]",K="[object GeneratorFunction]",G="[object Map]",P="[object Number]",H="[object Object]",L="[object RegExp]",U="[object Set]",$="[object String]",V="[object Symbol]",he="[object WeakMap]",Y="[object ArrayBuffer]",J="[object DataView]",z="[object Float32Array]",re="[object Float64Array]",le="[object Int8Array]",me="[object Int16Array]",ge="[object Int32Array]",Me="[object Uint8Array]",qe="[object Uint8ClampedArray]",Ve="[object Uint16Array]",Ue="[object Uint32Array]",Se={};Se[W]=Se[O]=Se[Y]=Se[J]=Se[B]=Se[Z]=Se[z]=Se[re]=Se[le]=Se[me]=Se[ge]=Se[G]=Se[P]=Se[H]=Se[L]=Se[U]=Se[$]=Se[V]=Se[Me]=Se[qe]=Se[Ve]=Se[Ue]=!0,Se[Q]=Se[M]=Se[he]=!1;function Qe(Ne,_e,ue,je,Ce,Fe){var We,He=_e&R,ot=_e&I,wt=_e&F;if(ue&&(We=Ce?ue(Ne,je,Ce,Fe):ue(Ne)),We!==void 0)return We;if(!S(Ne))return Ne;var ut=_(Ne);if(ut){if(We=y(Ne),!He)return c(Ne,We)}else{var ee=m(Ne),ke=ee==M||ee==K;if(j(Ne))return i(Ne,He);if(ee==H||ee==W||ke&&!Ce){if(We=ot||ke?{}:N(Ne),!He)return ot?f(Ne,a(We,Ne)):u(Ne,s(We,Ne))}else{if(!Se[ee])return Ce?Ne:{};We=w(Ne,ee,He)}}Fe||(Fe=new e);var Be=Fe.get(Ne);if(Be)return Be;Fe.set(Ne,We),E(Ne)?Ne.forEach(function(Je){We.add(Qe(Je,_e,ue,Je,Ne,Fe))}):k(Ne)&&Ne.forEach(function(Je,tt){We.set(tt,Qe(Je,_e,ue,tt,Ne,Fe))});var et=wt?ot?h:p:ot?T:C,ht=ut?void 0:et(Ne);return t(ht||Ne,function(Je,tt){ht&&(tt=Je,Je=Ne[tt]),n(We,tt,Qe(Je,_e,ue,tt,Ne,Fe))}),We}return fg=Qe,fg}var pg,PS;function Qz(){if(PS)return pg;PS=1;var e=hR(),t=4;function n(s){return e(s,t)}return pg=n,pg}var mg,LS;function m0(){if(LS)return mg;LS=1;function e(t){return function(){return t}}return mg=e,mg}var gg,DS;function Jz(){if(DS)return gg;DS=1;function e(t){return function(n,s,a){for(var i=-1,c=Object(n),u=a(n),f=u.length;f--;){var p=u[t?f:++i];if(s(c[p],p,c)===!1)break}return n}}return gg=e,gg}var yg,qS;function g0(){if(qS)return yg;qS=1;var e=Jz(),t=e();return yg=t,yg}var wg,FS;function y0(){if(FS)return wg;FS=1;var e=g0(),t=ca();function n(s,a){return s&&e(s,a,t)}return wg=n,wg}var vg,BS;function eU(){if(BS)return vg;BS=1;var e=bs();function t(n,s){return function(a,i){if(a==null)return a;if(!e(a))return n(a,i);for(var c=a.length,u=s?c:-1,f=Object(a);(s?u--:++u<c)&&i(f[u],u,f)!==!1;);return a}}return vg=t,vg}var xg,zS;function wh(){if(zS)return xg;zS=1;var e=y0(),t=eU(),n=t(e);return xg=n,xg}var bg,US;function bo(){if(US)return bg;US=1;function e(t){return t}return bg=e,bg}var kg,WS;function fR(){if(WS)return kg;WS=1;var e=bo();function t(n){return typeof n=="function"?n:e}return kg=t,kg}var _g,HS;function pR(){if(HS)return _g;HS=1;var e=l0(),t=wh(),n=fR(),s=Ht();function a(i,c){var u=s(i)?e:t;return u(i,n(c))}return _g=a,_g}var Ng,GS;function mR(){return GS||(GS=1,Ng=pR()),Ng}var Sg,VS;function tU(){if(VS)return Sg;VS=1;var e=wh();function t(n,s){var a=[];return e(n,function(i,c,u){s(i,c,u)&&a.push(i)}),a}return Sg=t,Sg}var jg,YS;function nU(){if(YS)return jg;YS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return jg=t,jg}var Eg,KS;function rU(){if(KS)return Eg;KS=1;function e(t){return this.__data__.has(t)}return Eg=e,Eg}var Cg,XS;function gR(){if(XS)return Cg;XS=1;var e=i0(),t=nU(),n=rU();function s(a){var i=-1,c=a==null?0:a.length;for(this.__data__=new e;++i<c;)this.add(a[i])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,Cg=s,Cg}var Tg,ZS;function sU(){if(ZS)return Tg;ZS=1;function e(t,n){for(var s=-1,a=t==null?0:t.length;++s<a;)if(n(t[s],s,t))return!0;return!1}return Tg=e,Tg}var Ag,QS;function yR(){if(QS)return Ag;QS=1;function e(t,n){return t.has(n)}return Ag=e,Ag}var Rg,JS;function wR(){if(JS)return Rg;JS=1;var e=gR(),t=sU(),n=yR(),s=1,a=2;function i(c,u,f,p,h,m){var y=f&s,w=c.length,N=u.length;if(w!=N&&!(y&&N>w))return!1;var _=m.get(c),j=m.get(u);if(_&&j)return _==u&&j==c;var k=-1,S=!0,E=f&a?new e:void 0;for(m.set(c,u),m.set(u,c);++k<w;){var C=c[k],T=u[k];if(p)var R=y?p(T,C,k,u,c,m):p(C,T,k,c,u,m);if(R!==void 0){if(R)continue;S=!1;break}if(E){if(!t(u,function(I,F){if(!n(E,F)&&(C===I||h(C,I,f,p,m)))return E.push(F)})){S=!1;break}}else if(!(C===T||h(C,T,f,p,m))){S=!1;break}}return m.delete(c),m.delete(u),S}return Rg=i,Rg}var Mg,ej;function aU(){if(ej)return Mg;ej=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a,i){s[++n]=[i,a]}),s}return Mg=e,Mg}var Ig,tj;function w0(){if(tj)return Ig;tj=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a){s[++n]=a}),s}return Ig=e,Ig}var $g,nj;function oU(){if(nj)return $g;nj=1;var e=Hi(),t=lR(),n=Wi(),s=wR(),a=aU(),i=w0(),c=1,u=2,f="[object Boolean]",p="[object Date]",h="[object Error]",m="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",_="[object String]",j="[object Symbol]",k="[object ArrayBuffer]",S="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function T(R,I,F,W,O,B,Z){switch(F){case S:if(R.byteLength!=I.byteLength||R.byteOffset!=I.byteOffset)return!1;R=R.buffer,I=I.buffer;case k:return!(R.byteLength!=I.byteLength||!B(new t(R),new t(I)));case f:case p:case y:return n(+R,+I);case h:return R.name==I.name&&R.message==I.message;case w:case _:return R==I+"";case m:var Q=a;case N:var M=W&c;if(Q||(Q=i),R.size!=I.size&&!M)return!1;var K=Z.get(R);if(K)return K==I;W|=u,Z.set(R,I);var G=s(Q(R),Q(I),W,O,B,Z);return Z.delete(R),G;case j:if(C)return C.call(R)==C.call(I)}return!1}return $g=T,$g}var Og,rj;function iU(){if(rj)return Og;rj=1;var e=oR(),t=1,n=Object.prototype,s=n.hasOwnProperty;function a(i,c,u,f,p,h){var m=u&t,y=e(i),w=y.length,N=e(c),_=N.length;if(w!=_&&!m)return!1;for(var j=w;j--;){var k=y[j];if(!(m?k in c:s.call(c,k)))return!1}var S=h.get(i),E=h.get(c);if(S&&E)return S==c&&E==i;var C=!0;h.set(i,c),h.set(c,i);for(var T=m;++j<w;){k=y[j];var R=i[k],I=c[k];if(f)var F=m?f(I,R,k,c,i,h):f(R,I,k,i,c,h);if(!(F===void 0?R===I||p(R,I,u,f,h):F)){C=!1;break}T||(T=k=="constructor")}if(C&&!T){var W=i.constructor,O=c.constructor;W!=O&&"constructor"in i&&"constructor"in c&&!(typeof W=="function"&&W instanceof W&&typeof O=="function"&&O instanceof O)&&(C=!1)}return h.delete(i),h.delete(c),C}return Og=a,Og}var Pg,sj;function lU(){if(sj)return Pg;sj=1;var e=dh(),t=wR(),n=oU(),s=iU(),a=Vi(),i=Ht(),c=Gi(),u=Ic(),f=1,p="[object Arguments]",h="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(_,j,k,S,E,C){var T=i(_),R=i(j),I=T?h:a(_),F=R?h:a(j);I=I==p?m:I,F=F==p?m:F;var W=I==m,O=F==m,B=I==F;if(B&&c(_)){if(!c(j))return!1;T=!0,W=!1}if(B&&!W)return C||(C=new e),T||u(_)?t(_,j,k,S,E,C):n(_,j,I,k,S,E,C);if(!(k&f)){var Z=W&&w.call(_,"__wrapped__"),Q=O&&w.call(j,"__wrapped__");if(Z||Q){var M=Z?_.value():_,K=Q?j.value():j;return C||(C=new e),E(M,K,k,S,C)}}return B?(C||(C=new e),s(_,j,k,S,E,C)):!1}return Pg=N,Pg}var Lg,aj;function vR(){if(aj)return Lg;aj=1;var e=lU(),t=Xr();function n(s,a,i,c,u){return s===a?!0:s==null||a==null||!t(s)&&!t(a)?s!==s&&a!==a:e(s,a,i,c,n,u)}return Lg=n,Lg}var Dg,oj;function cU(){if(oj)return Dg;oj=1;var e=dh(),t=vR(),n=1,s=2;function a(i,c,u,f){var p=u.length,h=p,m=!f;if(i==null)return!h;for(i=Object(i);p--;){var y=u[p];if(m&&y[2]?y[1]!==i[y[0]]:!(y[0]in i))return!1}for(;++p<h;){y=u[p];var w=y[0],N=i[w],_=y[1];if(m&&y[2]){if(N===void 0&&!(w in i))return!1}else{var j=new e;if(f)var k=f(N,_,w,i,c,j);if(!(k===void 0?t(_,N,n|s,f,j):k))return!1}}return!0}return Dg=a,Dg}var qg,ij;function xR(){if(ij)return qg;ij=1;var e=cr();function t(n){return n===n&&!e(n)}return qg=t,qg}var Fg,lj;function uU(){if(lj)return Fg;lj=1;var e=xR(),t=ca();function n(s){for(var a=t(s),i=a.length;i--;){var c=a[i],u=s[c];a[i]=[c,u,e(u)]}return a}return Fg=n,Fg}var Bg,cj;function bR(){if(cj)return Bg;cj=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return Bg=e,Bg}var zg,uj;function dU(){if(uj)return zg;uj=1;var e=cU(),t=uU(),n=bR();function s(a){var i=t(a);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(c){return c===a||e(c,a,i)}}return zg=s,zg}var Ug,dj;function Yi(){if(dj)return Ug;dj=1;var e=wo(),t=Xr(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return Ug=s,Ug}var Wg,hj;function v0(){if(hj)return Wg;hj=1;var e=Ht(),t=Yi(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(i,c){if(e(i))return!1;var u=typeof i;return u=="number"||u=="symbol"||u=="boolean"||i==null||t(i)?!0:s.test(i)||!n.test(i)||c!=null&&i in Object(c)}return Wg=a,Wg}var Hg,fj;function hU(){if(fj)return Hg;fj=1;var e=i0(),t="Expected a function";function n(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var c=arguments,u=a?a.apply(this,c):c[0],f=i.cache;if(f.has(u))return f.get(u);var p=s.apply(this,c);return i.cache=f.set(u,p)||f,p};return i.cache=new(n.Cache||e),i}return n.Cache=e,Hg=n,Hg}var Gg,pj;function fU(){if(pj)return Gg;pj=1;var e=hU(),t=500;function n(s){var a=e(s,function(c){return i.size===t&&i.clear(),c}),i=a.cache;return a}return Gg=n,Gg}var Vg,mj;function pU(){if(mj)return Vg;mj=1;var e=fU(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(c,u,f,p){i.push(f?p.replace(n,"$1"):u||c)}),i});return Vg=s,Vg}var Yg,gj;function vh(){if(gj)return Yg;gj=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=Array(a);++s<a;)i[s]=n(t[s],s,t);return i}return Yg=e,Yg}var Kg,yj;function mU(){if(yj)return Kg;yj=1;var e=Hi(),t=vh(),n=Ht(),s=Yi(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function c(u){if(typeof u=="string")return u;if(n(u))return t(u,c)+"";if(s(u))return i?i.call(u):"";var f=u+"";return f=="0"&&1/u==-1/0?"-0":f}return Kg=c,Kg}var Xg,wj;function kR(){if(wj)return Xg;wj=1;var e=mU();function t(n){return n==null?"":e(n)}return Xg=t,Xg}var Zg,vj;function xh(){if(vj)return Zg;vj=1;var e=Ht(),t=v0(),n=pU(),s=kR();function a(i,c){return e(i)?i:t(i,c)?[i]:n(s(i))}return Zg=a,Zg}var Qg,xj;function $c(){if(xj)return Qg;xj=1;var e=Yi();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Qg=t,Qg}var Jg,bj;function bh(){if(bj)return Jg;bj=1;var e=xh(),t=$c();function n(s,a){a=e(a,s);for(var i=0,c=a.length;s!=null&&i<c;)s=s[t(a[i++])];return i&&i==c?s:void 0}return Jg=n,Jg}var ey,kj;function gU(){if(kj)return ey;kj=1;var e=bh();function t(n,s,a){var i=n==null?void 0:e(n,s);return i===void 0?a:i}return ey=t,ey}var ty,_j;function yU(){if(_j)return ty;_j=1;function e(t,n){return t!=null&&n in Object(t)}return ty=e,ty}var ny,Nj;function _R(){if(Nj)return ny;Nj=1;var e=xh(),t=Mc(),n=Ht(),s=ph(),a=c0(),i=$c();function c(u,f,p){f=e(f,u);for(var h=-1,m=f.length,y=!1;++h<m;){var w=i(f[h]);if(!(y=u!=null&&p(u,w)))break;u=u[w]}return y||++h!=m?y:(m=u==null?0:u.length,!!m&&a(m)&&s(w,m)&&(n(u)||t(u)))}return ny=c,ny}var ry,Sj;function NR(){if(Sj)return ry;Sj=1;var e=yU(),t=_R();function n(s,a){return s!=null&&t(s,a,e)}return ry=n,ry}var sy,jj;function wU(){if(jj)return sy;jj=1;var e=vR(),t=gU(),n=NR(),s=v0(),a=xR(),i=bR(),c=$c(),u=1,f=2;function p(h,m){return s(h)&&a(m)?i(c(h),m):function(y){var w=t(y,h);return w===void 0&&w===m?n(y,h):e(m,w,u|f)}}return sy=p,sy}var ay,Ej;function SR(){if(Ej)return ay;Ej=1;function e(t){return function(n){return n==null?void 0:n[t]}}return ay=e,ay}var oy,Cj;function vU(){if(Cj)return oy;Cj=1;var e=bh();function t(n){return function(s){return e(s,n)}}return oy=t,oy}var iy,Tj;function xU(){if(Tj)return iy;Tj=1;var e=SR(),t=vU(),n=v0(),s=$c();function a(i){return n(i)?e(s(i)):t(i)}return iy=a,iy}var ly,Aj;function ks(){if(Aj)return ly;Aj=1;var e=dU(),t=wU(),n=bo(),s=Ht(),a=xU();function i(c){return typeof c=="function"?c:c==null?n:typeof c=="object"?s(c)?t(c[0],c[1]):e(c):a(c)}return ly=i,ly}var cy,Rj;function jR(){if(Rj)return cy;Rj=1;var e=nR(),t=tU(),n=ks(),s=Ht();function a(i,c){var u=s(i)?e:t;return u(i,n(c,3))}return cy=a,cy}var uy,Mj;function bU(){if(Mj)return uy;Mj=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,a){return s!=null&&t.call(s,a)}return uy=n,uy}var dy,Ij;function ER(){if(Ij)return dy;Ij=1;var e=bU(),t=_R();function n(s,a){return s!=null&&t(s,a,e)}return dy=n,dy}var hy,$j;function kU(){if($j)return hy;$j=1;var e=d0(),t=Vi(),n=Mc(),s=Ht(),a=bs(),i=Gi(),c=gh(),u=Ic(),f="[object Map]",p="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function y(w){if(w==null)return!0;if(a(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||i(w)||u(w)||n(w)))return!w.length;var N=t(w);if(N==f||N==p)return!w.size;if(c(w))return!e(w).length;for(var _ in w)if(m.call(w,_))return!1;return!0}return hy=y,hy}var fy,Oj;function CR(){if(Oj)return fy;Oj=1;function e(t){return t===void 0}return fy=e,fy}var py,Pj;function TR(){if(Pj)return py;Pj=1;var e=wh(),t=bs();function n(s,a){var i=-1,c=t(s)?Array(s.length):[];return e(s,function(u,f,p){c[++i]=a(u,f,p)}),c}return py=n,py}var my,Lj;function AR(){if(Lj)return my;Lj=1;var e=vh(),t=ks(),n=TR(),s=Ht();function a(i,c){var u=s(i)?e:n;return u(i,t(c,3))}return my=a,my}var gy,Dj;function _U(){if(Dj)return gy;Dj=1;function e(t,n,s,a){var i=-1,c=t==null?0:t.length;for(a&&c&&(s=t[++i]);++i<c;)s=n(s,t[i],i,t);return s}return gy=e,gy}var yy,qj;function NU(){if(qj)return yy;qj=1;function e(t,n,s,a,i){return i(t,function(c,u,f){s=a?(a=!1,c):n(s,c,u,f)}),s}return yy=e,yy}var wy,Fj;function RR(){if(Fj)return wy;Fj=1;var e=_U(),t=wh(),n=ks(),s=NU(),a=Ht();function i(c,u,f){var p=a(c)?e:s,h=arguments.length<3;return p(c,n(u,4),f,h,t)}return wy=i,wy}var vy,Bj;function SU(){if(Bj)return vy;Bj=1;var e=wo(),t=Ht(),n=Xr(),s="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==s}return vy=a,vy}var xy,zj;function jU(){if(zj)return xy;zj=1;var e=SR(),t=e("length");return xy=t,xy}var by,Uj;function EU(){if(Uj)return by;Uj=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",c="\\u200d",u=RegExp("["+c+e+a+i+"]");function f(p){return u.test(p)}return by=f,by}var ky,Wj;function CU(){if(Wj)return ky;Wj=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",c="["+e+"]",u="["+a+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+f+")",h="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",_="["+i+"]?",j="(?:"+w+"(?:"+[h,m,y].join("|")+")"+_+N+")*",k=_+N+j,S="(?:"+[h+u+"?",u,m,y,c].join("|")+")",E=RegExp(f+"(?="+f+")|"+S+k,"g");function C(T){for(var R=E.lastIndex=0;E.test(T);)++R;return R}return ky=C,ky}var _y,Hj;function TU(){if(Hj)return _y;Hj=1;var e=jU(),t=EU(),n=CU();function s(a){return t(a)?n(a):e(a)}return _y=s,_y}var Ny,Gj;function AU(){if(Gj)return Ny;Gj=1;var e=d0(),t=Vi(),n=bs(),s=SU(),a=TU(),i="[object Map]",c="[object Set]";function u(f){if(f==null)return 0;if(n(f))return s(f)?a(f):f.length;var p=t(f);return p==i||p==c?f.size:e(f).length}return Ny=u,Ny}var Sy,Vj;function RU(){if(Vj)return Sy;Vj=1;var e=l0(),t=uR(),n=y0(),s=ks(),a=yh(),i=Ht(),c=Gi(),u=Ac(),f=cr(),p=Ic();function h(m,y,w){var N=i(m),_=N||c(m)||p(m);if(y=s(y,4),w==null){var j=m&&m.constructor;_?w=N?new j:[]:f(m)?w=u(j)?t(a(m)):{}:w={}}return(_?e:n)(m,function(k,S,E){return y(w,k,S,E)}),w}return Sy=h,Sy}var jy,Yj;function MU(){if(Yj)return jy;Yj=1;var e=Hi(),t=Mc(),n=Ht(),s=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(s&&i&&i[s])}return jy=a,jy}var Ey,Kj;function x0(){if(Kj)return Ey;Kj=1;var e=f0(),t=MU();function n(s,a,i,c,u){var f=-1,p=s.length;for(i||(i=t),u||(u=[]);++f<p;){var h=s[f];a>0&&i(h)?a>1?n(h,a-1,i,c,u):e(u,h):c||(u[u.length]=h)}return u}return Ey=n,Ey}var Cy,Xj;function IU(){if(Xj)return Cy;Xj=1;function e(t,n,s){switch(s.length){case 0:return t.call(n);case 1:return t.call(n,s[0]);case 2:return t.call(n,s[0],s[1]);case 3:return t.call(n,s[0],s[1],s[2])}return t.apply(n,s)}return Cy=e,Cy}var Ty,Zj;function MR(){if(Zj)return Ty;Zj=1;var e=IU(),t=Math.max;function n(s,a,i){return a=t(a===void 0?s.length-1:a,0),function(){for(var c=arguments,u=-1,f=t(c.length-a,0),p=Array(f);++u<f;)p[u]=c[a+u];u=-1;for(var h=Array(a+1);++u<a;)h[u]=c[u];return h[a]=i(p),e(s,this,h)}}return Ty=n,Ty}var Ay,Qj;function $U(){if(Qj)return Ay;Qj=1;var e=m0(),t=ZA(),n=bo(),s=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return Ay=s,Ay}var Ry,Jj;function OU(){if(Jj)return Ry;Jj=1;var e=800,t=16,n=Date.now;function s(a){var i=0,c=0;return function(){var u=n(),f=t-(u-c);if(c=u,f>0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return Ry=s,Ry}var My,eE;function IR(){if(eE)return My;eE=1;var e=$U(),t=OU(),n=t(e);return My=n,My}var Iy,tE;function kh(){if(tE)return Iy;tE=1;var e=bo(),t=MR(),n=IR();function s(a,i){return n(t(a,i,e),a+"")}return Iy=s,Iy}var $y,nE;function $R(){if(nE)return $y;nE=1;function e(t,n,s,a){for(var i=t.length,c=s+(a?1:-1);a?c--:++c<i;)if(n(t[c],c,t))return c;return-1}return $y=e,$y}var Oy,rE;function PU(){if(rE)return Oy;rE=1;function e(t){return t!==t}return Oy=e,Oy}var Py,sE;function LU(){if(sE)return Py;sE=1;function e(t,n,s){for(var a=s-1,i=t.length;++a<i;)if(t[a]===n)return a;return-1}return Py=e,Py}var Ly,aE;function DU(){if(aE)return Ly;aE=1;var e=$R(),t=PU(),n=LU();function s(a,i,c){return i===i?n(a,i,c):e(a,t,c)}return Ly=s,Ly}var Dy,oE;function qU(){if(oE)return Dy;oE=1;var e=DU();function t(n,s){var a=n==null?0:n.length;return!!a&&e(n,s,0)>-1}return Dy=t,Dy}var qy,iE;function FU(){if(iE)return qy;iE=1;function e(t,n,s){for(var a=-1,i=t==null?0:t.length;++a<i;)if(s(n,t[a]))return!0;return!1}return qy=e,qy}var Fy,lE;function BU(){if(lE)return Fy;lE=1;function e(){}return Fy=e,Fy}var By,cE;function zU(){if(cE)return By;cE=1;var e=iR(),t=BU(),n=w0(),s=1/0,a=e&&1/n(new e([,-0]))[1]==s?function(i){return new e(i)}:t;return By=a,By}var zy,uE;function UU(){if(uE)return zy;uE=1;var e=gR(),t=qU(),n=FU(),s=yR(),a=zU(),i=w0(),c=200;function u(f,p,h){var m=-1,y=t,w=f.length,N=!0,_=[],j=_;if(h)N=!1,y=n;else if(w>=c){var k=p?null:a(f);if(k)return i(k);N=!1,y=s,j=new e}else j=p?[]:_;e:for(;++m<w;){var S=f[m],E=p?p(S):S;if(S=h||S!==0?S:0,N&&E===E){for(var C=j.length;C--;)if(j[C]===E)continue e;p&&j.push(E),_.push(S)}else y(j,E,h)||(j!==_&&j.push(E),_.push(S))}return _}return zy=u,zy}var Uy,dE;function OR(){if(dE)return Uy;dE=1;var e=bs(),t=Xr();function n(s){return t(s)&&e(s)}return Uy=n,Uy}var Wy,hE;function WU(){if(hE)return Wy;hE=1;var e=x0(),t=kh(),n=UU(),s=OR(),a=t(function(i){return n(e(i,1,s,!0))});return Wy=a,Wy}var Hy,fE;function HU(){if(fE)return Hy;fE=1;var e=vh();function t(n,s){return e(s,function(a){return n[a]})}return Hy=t,Hy}var Gy,pE;function PR(){if(pE)return Gy;pE=1;var e=HU(),t=ca();function n(s){return s==null?[]:e(s,t(s))}return Gy=n,Gy}var Vy,mE;function ur(){if(mE)return Vy;mE=1;var e;if(typeof a0=="function")try{e={clone:Qz(),constant:m0(),each:mR(),filter:jR(),has:ER(),isArray:Ht(),isEmpty:kU(),isFunction:Ac(),isUndefined:CR(),keys:ca(),map:AR(),reduce:RR(),size:AU(),transform:RU(),union:WU(),values:PR()}}catch{}return e||(e=window._),Vy=e,Vy}var Yy,gE;function b0(){if(gE)return Yy;gE=1;var e=ur();Yy=a;var t="\0",n="\0",s="";function a(h){this._isDirected=e.has(h,"directed")?h.directed:!0,this._isMultigraph=e.has(h,"multigraph")?h.multigraph:!1,this._isCompound=e.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(h){return this._label=h,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._in[m])})},a.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._out[m])})},a.prototype.setNodes=function(h,m){var y=arguments,w=this;return e.each(h,function(N){y.length>1?w.setNode(N,m):w.setNode(N)}),this},a.prototype.setNode=function(h,m){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=m),this):(this._nodes[h]=arguments.length>1?m:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},a.prototype.node=function(h){return this._nodes[h]},a.prototype.hasNode=function(h){return e.has(this._nodes,h)},a.prototype.removeNode=function(h){var m=this;if(e.has(this._nodes,h)){var y=function(w){m.removeEdge(m._edgeObjs[w])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(w){m.setParent(w)}),delete this._children[h]),e.each(e.keys(this._in[h]),y),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),y),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},a.prototype.setParent=function(h,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=n;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===h)throw new Error("Setting "+m+" as parent of "+h+" would create a cycle");this.setNode(m)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=m,this._children[m][h]=!0,this},a.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},a.prototype.parent=function(h){if(this._isCompound){var m=this._parent[h];if(m!==n)return m}},a.prototype.children=function(h){if(e.isUndefined(h)&&(h=n),this._isCompound){var m=this._children[h];if(m)return e.keys(m)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},a.prototype.predecessors=function(h){var m=this._preds[h];if(m)return e.keys(m)},a.prototype.successors=function(h){var m=this._sucs[h];if(m)return e.keys(m)},a.prototype.neighbors=function(h){var m=this.predecessors(h);if(m)return e.union(m,this.successors(h))},a.prototype.isLeaf=function(h){var m;return this.isDirected()?m=this.successors(h):m=this.neighbors(h),m.length===0},a.prototype.filterNodes=function(h){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(_,j){h(j)&&m.setNode(j,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var w={};function N(_){var j=y.parent(_);return j===void 0||m.hasNode(j)?(w[_]=j,j):j in w?w[j]:N(j)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,N(_))}),m},a.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(h,m){var y=this,w=arguments;return e.reduce(h,function(N,_){return w.length>1?y.setEdge(N,_,m):y.setEdge(N,_),_}),this},a.prototype.setEdge=function(){var h,m,y,w,N=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(h=_.v,m=_.w,y=_.name,arguments.length===2&&(w=arguments[1],N=!0)):(h=_,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),h=""+h,m=""+m,e.isUndefined(y)||(y=""+y);var j=u(this._isDirected,h,m,y);if(e.has(this._edgeLabels,j))return N&&(this._edgeLabels[j]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(m),this._edgeLabels[j]=N?w: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[j]=k,i(this._preds[m],h),i(this._sucs[h],m),this._in[m][j]=k,this._out[h][j]=k,this._edgeCount++,this},a.prototype.edge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return this._edgeLabels[w]},a.prototype.hasEdge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return e.has(this._edgeLabels,w)},a.prototype.removeEdge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y),N=this._edgeObjs[w];return N&&(h=N.v,m=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],c(this._preds[m],h),c(this._sucs[h],m),delete this._in[m][w],delete this._out[h][w],this._edgeCount--),this},a.prototype.inEdges=function(h,m){var y=this._in[h];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.v===m}):w}},a.prototype.outEdges=function(h,m){var y=this._out[h];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.w===m}):w}},a.prototype.nodeEdges=function(h,m){var y=this.inEdges(h,m);if(y)return y.concat(this.outEdges(h,m))};function i(h,m){h[m]?h[m]++:h[m]=1}function c(h,m){--h[m]||delete h[m]}function u(h,m,y,w){var N=""+m,_=""+y;if(!h&&N>_){var j=N;N=_,_=j}return N+s+_+s+(e.isUndefined(w)?t:w)}function f(h,m,y,w){var N=""+m,_=""+y;if(!h&&N>_){var j=N;N=_,_=j}var k={v:N,w:_};return w&&(k.name=w),k}function p(h,m){return u(h,m.v,m.w,m.name)}return Yy}var Ky,yE;function GU(){return yE||(yE=1,Ky="2.1.8"),Ky}var Xy,wE;function VU(){return wE||(wE=1,Xy={Graph:b0(),version:GU()}),Xy}var Zy,vE;function YU(){if(vE)return Zy;vE=1;var e=ur(),t=b0();Zy={write:n,read:i};function n(c){var u={options:{directed:c.isDirected(),multigraph:c.isMultigraph(),compound:c.isCompound()},nodes:s(c),edges:a(c)};return e.isUndefined(c.graph())||(u.value=e.clone(c.graph())),u}function s(c){return e.map(c.nodes(),function(u){var f=c.node(u),p=c.parent(u),h={v:u};return e.isUndefined(f)||(h.value=f),e.isUndefined(p)||(h.parent=p),h})}function a(c){return e.map(c.edges(),function(u){var f=c.edge(u),p={v:u.v,w:u.w};return e.isUndefined(u.name)||(p.name=u.name),e.isUndefined(f)||(p.value=f),p})}function i(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 Zy}var Qy,xE;function KU(){if(xE)return Qy;xE=1;var e=ur();Qy=t;function t(n){var s={},a=[],i;function c(u){e.has(s,u)||(s[u]=!0,i.push(u),e.each(n.successors(u),c),e.each(n.predecessors(u),c))}return e.each(n.nodes(),function(u){i=[],c(u),i.length&&a.push(i)}),a}return Qy}var Jy,bE;function LR(){if(bE)return Jy;bE=1;var e=ur();Jy=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 s=this._keyIndices[n];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,s){var a=this._keyIndices;if(n=String(n),!e.has(a,n)){var i=this._arr,c=i.length;return a[n]=c,i.push({key:n,priority:s}),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,s){var a=this._keyIndices[n];if(s>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+s);this._arr[a].priority=s,this._decrease(a)},t.prototype._heapify=function(n){var s=this._arr,a=2*n,i=a+1,c=n;a<s.length&&(c=s[a].priority<s[c].priority?a:c,i<s.length&&(c=s[i].priority<s[c].priority?i:c),c!==n&&(this._swap(n,c),this._heapify(c)))},t.prototype._decrease=function(n){for(var s=this._arr,a=s[n].priority,i;n!==0&&(i=n>>1,!(s[i].priority<a));)this._swap(n,i),n=i},t.prototype._swap=function(n,s){var a=this._arr,i=this._keyIndices,c=a[n],u=a[s];a[n]=u,a[s]=c,i[u.key]=n,i[c.key]=s},Jy}var ew,kE;function DR(){if(kE)return ew;kE=1;var e=ur(),t=LR();ew=s;var n=e.constant(1);function s(i,c,u,f){return a(i,String(c),u||n,f||function(p){return i.outEdges(p)})}function a(i,c,u,f){var p={},h=new t,m,y,w=function(N){var _=N.v!==m?N.v:N.w,j=p[_],k=u(N),S=y.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+k);S<j.distance&&(j.distance=S,j.predecessor=m,h.decrease(_,S))};for(i.nodes().forEach(function(N){var _=N===c?0:Number.POSITIVE_INFINITY;p[N]={distance:_},h.add(N,_)});h.size()>0&&(m=h.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(w);return p}return ew}var tw,_E;function XU(){if(_E)return tw;_E=1;var e=DR(),t=ur();tw=n;function n(s,a,i){return t.transform(s.nodes(),function(c,u){c[u]=e(s,u,a,i)},{})}return tw}var nw,NE;function qR(){if(NE)return nw;NE=1;var e=ur();nw=t;function t(n){var s=0,a=[],i={},c=[];function u(f){var p=i[f]={onStack:!0,lowlink:s,index:s++};if(a.push(f),n.successors(f).forEach(function(y){e.has(i,y)?i[y].onStack&&(p.lowlink=Math.min(p.lowlink,i[y].index)):(u(y),p.lowlink=Math.min(p.lowlink,i[y].lowlink))}),p.lowlink===p.index){var h=[],m;do m=a.pop(),i[m].onStack=!1,h.push(m);while(f!==m);c.push(h)}}return n.nodes().forEach(function(f){e.has(i,f)||u(f)}),c}return nw}var rw,SE;function ZU(){if(SE)return rw;SE=1;var e=ur(),t=qR();rw=n;function n(s){return e.filter(t(s),function(a){return a.length>1||a.length===1&&s.hasEdge(a[0],a[0])})}return rw}var sw,jE;function QU(){if(jE)return sw;jE=1;var e=ur();sw=n;var t=e.constant(1);function n(a,i,c){return s(a,i||t,c||function(u){return a.outEdges(u)})}function s(a,i,c){var u={},f=a.nodes();return f.forEach(function(p){u[p]={},u[p][p]={distance:0},f.forEach(function(h){p!==h&&(u[p][h]={distance:Number.POSITIVE_INFINITY})}),c(p).forEach(function(h){var m=h.v===p?h.w:h.v,y=i(h);u[p][m]={distance:y,predecessor:p}})}),f.forEach(function(p){var h=u[p];f.forEach(function(m){var y=u[m];f.forEach(function(w){var N=y[p],_=h[w],j=y[w],k=N.distance+_.distance;k<j.distance&&(j.distance=k,j.predecessor=_.predecessor)})})}),u}return sw}var aw,EE;function FR(){if(EE)return aw;EE=1;var e=ur();aw=t,t.CycleException=n;function t(s){var a={},i={},c=[];function u(f){if(e.has(i,f))throw new n;e.has(a,f)||(i[f]=!0,a[f]=!0,e.each(s.predecessors(f),u),delete i[f],c.push(f))}if(e.each(s.sinks(),u),e.size(a)!==s.nodeCount())throw new n;return c}function n(){}return n.prototype=new Error,aw}var ow,CE;function JU(){if(CE)return ow;CE=1;var e=FR();ow=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return ow}var iw,TE;function BR(){if(TE)return iw;TE=1;var e=ur();iw=t;function t(s,a,i){e.isArray(a)||(a=[a]);var c=(s.isDirected()?s.successors:s.neighbors).bind(s),u=[],f={};return e.each(a,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,i==="post",f,c,u)}),u}function n(s,a,i,c,u,f){e.has(c,a)||(c[a]=!0,i||f.push(a),e.each(u(a),function(p){n(s,p,i,c,u,f)}),i&&f.push(a))}return iw}var lw,AE;function eW(){if(AE)return lw;AE=1;var e=BR();lw=t;function t(n,s){return e(n,s,"post")}return lw}var cw,RE;function tW(){if(RE)return cw;RE=1;var e=BR();cw=t;function t(n,s){return e(n,s,"pre")}return cw}var uw,ME;function nW(){if(ME)return uw;ME=1;var e=ur(),t=b0(),n=LR();uw=s;function s(a,i){var c=new t,u={},f=new n,p;function h(y){var w=y.v===p?y.w:y.v,N=f.priority(w);if(N!==void 0){var _=i(y);_<N&&(u[w]=p,f.decrease(w,_))}}if(a.nodeCount()===0)return c;e.each(a.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),c.setNode(y)}),f.decrease(a.nodes()[0],0);for(var m=!1;f.size()>0;){if(p=f.removeMin(),e.has(u,p))c.setEdge(p,u[p]);else{if(m)throw new Error("Input graph is not connected: "+a);m=!0}a.nodeEdges(p).forEach(h)}return c}return uw}var dw,IE;function rW(){return IE||(IE=1,dw={components:KU(),dijkstra:DR(),dijkstraAll:XU(),findCycles:ZU(),floydWarshall:QU(),isAcyclic:JU(),postorder:eW(),preorder:tW(),prim:nW(),tarjan:qR(),topsort:FR()}),dw}var hw,$E;function sW(){if($E)return hw;$E=1;var e=VU();return hw={Graph:e.Graph,json:YU(),alg:rW(),version:e.version},hw}var fw,OE;function Rr(){if(OE)return fw;OE=1;var e;if(typeof a0=="function")try{e=sW()}catch{}return e||(e=window.graphlib),fw=e,fw}var pw,PE;function aW(){if(PE)return pw;PE=1;var e=hR(),t=1,n=4;function s(a){return e(a,t|n)}return pw=s,pw}var mw,LE;function _h(){if(LE)return mw;LE=1;var e=Wi(),t=bs(),n=ph(),s=cr();function a(i,c,u){if(!s(u))return!1;var f=typeof c;return(f=="number"?t(u)&&n(c,u.length):f=="string"&&c in u)?e(u[c],i):!1}return mw=a,mw}var gw,DE;function oW(){if(DE)return gw;DE=1;var e=kh(),t=Wi(),n=_h(),s=xo(),a=Object.prototype,i=a.hasOwnProperty,c=e(function(u,f){u=Object(u);var p=-1,h=f.length,m=h>2?f[2]:void 0;for(m&&n(f[0],f[1],m)&&(h=1);++p<h;)for(var y=f[p],w=s(y),N=-1,_=w.length;++N<_;){var j=w[N],k=u[j];(k===void 0||t(k,a[j])&&!i.call(u,j))&&(u[j]=y[j])}return u});return gw=c,gw}var yw,qE;function iW(){if(qE)return yw;qE=1;var e=ks(),t=bs(),n=ca();function s(a){return function(i,c,u){var f=Object(i);if(!t(i)){var p=e(c,3);i=n(i),c=function(m){return p(f[m],m,f)}}var h=a(i,c,u);return h>-1?f[p?i[h]:h]:void 0}}return yw=s,yw}var ww,FE;function lW(){if(FE)return ww;FE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return ww=t,ww}var vw,BE;function cW(){if(BE)return vw;BE=1;var e=lW(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return vw=n,vw}var xw,zE;function uW(){if(zE)return xw;zE=1;var e=cW(),t=cr(),n=Yi(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;function f(p){if(typeof p=="number")return p;if(n(p))return s;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=i.test(p);return m||c.test(p)?u(p.slice(2),m?2:8):a.test(p)?s:+p}return xw=f,xw}var bw,UE;function zR(){if(UE)return bw;UE=1;var e=uW(),t=1/0,n=17976931348623157e292;function s(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var i=a<0?-1:1;return i*n}return a===a?a:0}return bw=s,bw}var kw,WE;function dW(){if(WE)return kw;WE=1;var e=zR();function t(n){var s=e(n),a=s%1;return s===s?a?s-a:s:0}return kw=t,kw}var _w,HE;function hW(){if(HE)return _w;HE=1;var e=$R(),t=ks(),n=dW(),s=Math.max;function a(i,c,u){var f=i==null?0:i.length;if(!f)return-1;var p=u==null?0:n(u);return p<0&&(p=s(f+p,0)),e(i,t(c,3),p)}return _w=a,_w}var Nw,GE;function fW(){if(GE)return Nw;GE=1;var e=iW(),t=hW(),n=e(t);return Nw=n,Nw}var Sw,VE;function UR(){if(VE)return Sw;VE=1;var e=x0();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return Sw=t,Sw}var jw,YE;function pW(){if(YE)return jw;YE=1;var e=g0(),t=fR(),n=xo();function s(a,i){return a==null?a:e(a,t(i),n)}return jw=s,jw}var Ew,KE;function mW(){if(KE)return Ew;KE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Ew=e,Ew}var Cw,XE;function gW(){if(XE)return Cw;XE=1;var e=hh(),t=y0(),n=ks();function s(a,i){var c={};return i=n(i,3),t(a,function(u,f,p){e(c,f,i(u,f,p))}),c}return Cw=s,Cw}var Tw,ZE;function k0(){if(ZE)return Tw;ZE=1;var e=Yi();function t(n,s,a){for(var i=-1,c=n.length;++i<c;){var u=n[i],f=s(u);if(f!=null&&(p===void 0?f===f&&!e(f):a(f,p)))var p=f,h=u}return h}return Tw=t,Tw}var Aw,QE;function yW(){if(QE)return Aw;QE=1;function e(t,n){return t>n}return Aw=e,Aw}var Rw,JE;function wW(){if(JE)return Rw;JE=1;var e=k0(),t=yW(),n=bo();function s(a){return a&&a.length?e(a,n,t):void 0}return Rw=s,Rw}var Mw,eC;function WR(){if(eC)return Mw;eC=1;var e=hh(),t=Wi();function n(s,a,i){(i!==void 0&&!t(s[a],i)||i===void 0&&!(a in s))&&e(s,a,i)}return Mw=n,Mw}var Iw,tC;function vW(){if(tC)return Iw;tC=1;var e=wo(),t=yh(),n=Xr(),s="[object Object]",a=Function.prototype,i=Object.prototype,c=a.toString,u=i.hasOwnProperty,f=c.call(Object);function p(h){if(!n(h)||e(h)!=s)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 Iw=p,Iw}var $w,nC;function HR(){if(nC)return $w;nC=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return $w=e,$w}var Ow,rC;function xW(){if(rC)return Ow;rC=1;var e=Rc(),t=xo();function n(s){return e(s,t(s))}return Ow=n,Ow}var Pw,sC;function bW(){if(sC)return Pw;sC=1;var e=WR(),t=eR(),n=cR(),s=tR(),a=dR(),i=Mc(),c=Ht(),u=OR(),f=Gi(),p=Ac(),h=cr(),m=vW(),y=Ic(),w=HR(),N=xW();function _(j,k,S,E,C,T,R){var I=w(j,S),F=w(k,S),W=R.get(F);if(W){e(j,S,W);return}var O=T?T(I,F,S+"",j,k,R):void 0,B=O===void 0;if(B){var Z=c(F),Q=!Z&&f(F),M=!Z&&!Q&&y(F);O=F,Z||Q||M?c(I)?O=I:u(I)?O=s(I):Q?(B=!1,O=t(F,!0)):M?(B=!1,O=n(F,!0)):O=[]:m(F)||i(F)?(O=I,i(I)?O=N(I):(!h(I)||p(I))&&(O=a(F))):B=!1}B&&(R.set(F,O),C(O,F,E,T,R),R.delete(F)),e(j,S,O)}return Pw=_,Pw}var Lw,aC;function kW(){if(aC)return Lw;aC=1;var e=dh(),t=WR(),n=g0(),s=bW(),a=cr(),i=xo(),c=HR();function u(f,p,h,m,y){f!==p&&n(p,function(w,N){if(y||(y=new e),a(w))s(f,p,N,h,u,m,y);else{var _=m?m(c(f,N),w,N+"",f,p,y):void 0;_===void 0&&(_=w),t(f,N,_)}},i)}return Lw=u,Lw}var Dw,oC;function _W(){if(oC)return Dw;oC=1;var e=kh(),t=_h();function n(s){return e(function(a,i){var c=-1,u=i.length,f=u>1?i[u-1]:void 0,p=u>2?i[2]:void 0;for(f=s.length>3&&typeof f=="function"?(u--,f):void 0,p&&t(i[0],i[1],p)&&(f=u<3?void 0:f,u=1),a=Object(a);++c<u;){var h=i[c];h&&s(a,h,c,f)}return a})}return Dw=n,Dw}var qw,iC;function NW(){if(iC)return qw;iC=1;var e=kW(),t=_W(),n=t(function(s,a,i){e(s,a,i)});return qw=n,qw}var Fw,lC;function GR(){if(lC)return Fw;lC=1;function e(t,n){return t<n}return Fw=e,Fw}var Bw,cC;function SW(){if(cC)return Bw;cC=1;var e=k0(),t=GR(),n=bo();function s(a){return a&&a.length?e(a,n,t):void 0}return Bw=s,Bw}var zw,uC;function jW(){if(uC)return zw;uC=1;var e=k0(),t=ks(),n=GR();function s(a,i){return a&&a.length?e(a,t(i,2),n):void 0}return zw=s,zw}var Uw,dC;function EW(){if(dC)return Uw;dC=1;var e=Ir(),t=function(){return e.Date.now()};return Uw=t,Uw}var Ww,hC;function CW(){if(hC)return Ww;hC=1;var e=fh(),t=xh(),n=ph(),s=cr(),a=$c();function i(c,u,f,p){if(!s(c))return c;u=t(u,c);for(var h=-1,m=u.length,y=m-1,w=c;w!=null&&++h<m;){var N=a(u[h]),_=f;if(N==="__proto__"||N==="constructor"||N==="prototype")return c;if(h!=y){var j=w[N];_=p?p(j,N,w):void 0,_===void 0&&(_=s(j)?j:n(u[h+1])?[]:{})}e(w,N,_),w=w[N]}return c}return Ww=i,Ww}var Hw,fC;function TW(){if(fC)return Hw;fC=1;var e=bh(),t=CW(),n=xh();function s(a,i,c){for(var u=-1,f=i.length,p={};++u<f;){var h=i[u],m=e(a,h);c(m,h)&&t(p,n(h,a),m)}return p}return Hw=s,Hw}var Gw,pC;function AW(){if(pC)return Gw;pC=1;var e=TW(),t=NR();function n(s,a){return e(s,a,function(i,c){return t(s,c)})}return Gw=n,Gw}var Vw,mC;function RW(){if(mC)return Vw;mC=1;var e=UR(),t=MR(),n=IR();function s(a){return n(t(a,void 0,e),a+"")}return Vw=s,Vw}var Yw,gC;function MW(){if(gC)return Yw;gC=1;var e=AW(),t=RW(),n=t(function(s,a){return s==null?{}:e(s,a)});return Yw=n,Yw}var Kw,yC;function IW(){if(yC)return Kw;yC=1;var e=Math.ceil,t=Math.max;function n(s,a,i,c){for(var u=-1,f=t(e((a-s)/(i||1)),0),p=Array(f);f--;)p[c?f:++u]=s,s+=i;return p}return Kw=n,Kw}var Xw,wC;function $W(){if(wC)return Xw;wC=1;var e=IW(),t=_h(),n=zR();function s(a){return function(i,c,u){return u&&typeof u!="number"&&t(i,c,u)&&(c=u=void 0),i=n(i),c===void 0?(c=i,i=0):c=n(c),u=u===void 0?i<c?1:-1:n(u),e(i,c,u,a)}}return Xw=s,Xw}var Zw,vC;function OW(){if(vC)return Zw;vC=1;var e=$W(),t=e();return Zw=t,Zw}var Qw,xC;function PW(){if(xC)return Qw;xC=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Qw=e,Qw}var Jw,bC;function LW(){if(bC)return Jw;bC=1;var e=Yi();function t(n,s){if(n!==s){var a=n!==void 0,i=n===null,c=n===n,u=e(n),f=s!==void 0,p=s===null,h=s===s,m=e(s);if(!p&&!m&&!u&&n>s||u&&f&&h&&!p&&!m||i&&f&&h||!a&&h||!c)return 1;if(!i&&!u&&!m&&n<s||m&&a&&c&&!i&&!u||p&&a&&c||!f&&c||!h)return-1}return 0}return Jw=t,Jw}var ev,kC;function DW(){if(kC)return ev;kC=1;var e=LW();function t(n,s,a){for(var i=-1,c=n.criteria,u=s.criteria,f=c.length,p=a.length;++i<f;){var h=e(c[i],u[i]);if(h){if(i>=p)return h;var m=a[i];return h*(m=="desc"?-1:1)}}return n.index-s.index}return ev=t,ev}var tv,_C;function qW(){if(_C)return tv;_C=1;var e=vh(),t=bh(),n=ks(),s=TR(),a=PW(),i=mh(),c=DW(),u=bo(),f=Ht();function p(h,m,y){m.length?m=e(m,function(_){return f(_)?function(j){return t(j,_.length===1?_[0]:_)}:_}):m=[u];var w=-1;m=e(m,i(n));var N=s(h,function(_,j,k){var S=e(m,function(E){return E(_)});return{criteria:S,index:++w,value:_}});return a(N,function(_,j){return c(_,j,y)})}return tv=p,tv}var nv,NC;function FW(){if(NC)return nv;NC=1;var e=x0(),t=qW(),n=kh(),s=_h(),a=n(function(i,c){if(i==null)return[];var u=c.length;return u>1&&s(i,c[0],c[1])?c=[]:u>2&&s(c[0],c[1],c[2])&&(c=[c[0]]),t(i,e(c,1),[])});return nv=a,nv}var rv,SC;function BW(){if(SC)return rv;SC=1;var e=kR(),t=0;function n(s){var a=++t;return e(s)+a}return rv=n,rv}var sv,jC;function zW(){if(jC)return sv;jC=1;function e(t,n,s){for(var a=-1,i=t.length,c=n.length,u={};++a<i;){var f=a<c?n[a]:void 0;s(u,t[a],f)}return u}return sv=e,sv}var av,EC;function UW(){if(EC)return av;EC=1;var e=fh(),t=zW();function n(s,a){return t(s||[],a||[],e)}return av=n,av}var ov,CC;function At(){if(CC)return ov;CC=1;var e;if(typeof a0=="function")try{e={cloneDeep:aW(),constant:m0(),defaults:oW(),each:mR(),filter:jR(),find:fW(),flatten:UR(),forEach:pR(),forIn:pW(),has:ER(),isUndefined:CR(),last:mW(),map:AR(),mapValues:gW(),max:wW(),merge:NW(),min:SW(),minBy:jW(),now:EW(),pick:MW(),range:OW(),reduce:RR(),sortBy:FW(),uniqueId:BW(),values:PR(),zipObject:UW()}}catch{}return e||(e=window._),ov=e,ov}var iv,TC;function WW(){if(TC)return iv;TC=1,iv=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,a=s._prev;if(a!==s)return t(a),a},e.prototype.enqueue=function(s){var a=this._sentinel;s._prev&&s._next&&t(s),s._next=a._next,a._next._prev=s,a._next=s,s._prev=a},e.prototype.toString=function(){for(var s=[],a=this._sentinel,i=a._prev;i!==a;)s.push(JSON.stringify(i,n)),i=i._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function n(s,a){if(s!=="_next"&&s!=="_prev")return a}return iv}var lv,AC;function HW(){if(AC)return lv;AC=1;var e=At(),t=Rr().Graph,n=WW();lv=a;var s=e.constant(1);function a(p,h){if(p.nodeCount()<=1)return[];var m=u(p,h||s),y=i(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function i(p,h,m){for(var y=[],w=h[h.length-1],N=h[0],_;p.nodeCount();){for(;_=N.dequeue();)c(p,h,m,_);for(;_=w.dequeue();)c(p,h,m,_);if(p.nodeCount()){for(var j=h.length-2;j>0;--j)if(_=h[j].dequeue(),_){y=y.concat(c(p,h,m,_,!0));break}}}return y}function c(p,h,m,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var j=p.edge(_),k=p.node(_.v);w&&N.push({v:_.v,w:_.w}),k.out-=j,f(h,m,k)}),e.forEach(p.outEdges(y.v),function(_){var j=p.edge(_),k=_.w,S=p.node(k);S.in-=j,f(h,m,S)}),p.removeNode(y.v),N}function u(p,h){var m=new t,y=0,w=0;e.forEach(p.nodes(),function(j){m.setNode(j,{v:j,in:0,out:0})}),e.forEach(p.edges(),function(j){var k=m.edge(j.v,j.w)||0,S=h(j),E=k+S;m.setEdge(j.v,j.w,E),w=Math.max(w,m.node(j.v).out+=S),y=Math.max(y,m.node(j.w).in+=S)});var N=e.range(w+y+3).map(function(){return new n}),_=y+1;return e.forEach(m.nodes(),function(j){f(N,_,m.node(j))}),{graph:m,buckets:N,zeroIdx:_}}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 lv}var cv,RC;function GW(){if(RC)return cv;RC=1;var e=At(),t=HW();cv={run:n,undo:a};function n(i){var c=i.graph().acyclicer==="greedy"?t(i,u(i)):s(i);e.forEach(c,function(f){var p=i.edge(f);i.removeEdge(f),p.forwardName=f.name,p.reversed=!0,i.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function u(f){return function(p){return f.edge(p).weight}}}function s(i){var c=[],u={},f={};function p(h){e.has(f,h)||(f[h]=!0,u[h]=!0,e.forEach(i.outEdges(h),function(m){e.has(u,m.w)?c.push(m):p(m.w)}),delete u[h])}return e.forEach(i.nodes(),p),c}function a(i){e.forEach(i.edges(),function(c){var u=i.edge(c);if(u.reversed){i.removeEdge(c);var f=u.forwardName;delete u.reversed,delete u.forwardName,i.setEdge(c.w,c.v,u,f)}})}return cv}var uv,MC;function On(){if(MC)return uv;MC=1;var e=At(),t=Rr().Graph;uv={addDummyNode:n,simplify:s,asNonCompoundGraph:a,successorWeights:i,predecessorWeights:c,intersectRect:u,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:m,maxRank:y,partition:w,time:N,notime:_};function n(j,k,S,E){var C;do C=e.uniqueId(E);while(j.hasNode(C));return S.dummy=k,j.setNode(C,S),C}function s(j){var k=new t().setGraph(j.graph());return e.forEach(j.nodes(),function(S){k.setNode(S,j.node(S))}),e.forEach(j.edges(),function(S){var E=k.edge(S.v,S.w)||{weight:0,minlen:1},C=j.edge(S);k.setEdge(S.v,S.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),k}function a(j){var k=new t({multigraph:j.isMultigraph()}).setGraph(j.graph());return e.forEach(j.nodes(),function(S){j.children(S).length||k.setNode(S,j.node(S))}),e.forEach(j.edges(),function(S){k.setEdge(S,j.edge(S))}),k}function i(j){var k=e.map(j.nodes(),function(S){var E={};return e.forEach(j.outEdges(S),function(C){E[C.w]=(E[C.w]||0)+j.edge(C).weight}),E});return e.zipObject(j.nodes(),k)}function c(j){var k=e.map(j.nodes(),function(S){var E={};return e.forEach(j.inEdges(S),function(C){E[C.v]=(E[C.v]||0)+j.edge(C).weight}),E});return e.zipObject(j.nodes(),k)}function u(j,k){var S=j.x,E=j.y,C=k.x-S,T=k.y-E,R=j.width/2,I=j.height/2;if(!C&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var F,W;return Math.abs(T)*R>Math.abs(C)*I?(T<0&&(I=-I),F=I*C/T,W=I):(C<0&&(R=-R),F=R,W=R*T/C),{x:S+F,y:E+W}}function f(j){var k=e.map(e.range(y(j)+1),function(){return[]});return e.forEach(j.nodes(),function(S){var E=j.node(S),C=E.rank;e.isUndefined(C)||(k[C][E.order]=S)}),k}function p(j){var k=e.min(e.map(j.nodes(),function(S){return j.node(S).rank}));e.forEach(j.nodes(),function(S){var E=j.node(S);e.has(E,"rank")&&(E.rank-=k)})}function h(j){var k=e.min(e.map(j.nodes(),function(T){return j.node(T).rank})),S=[];e.forEach(j.nodes(),function(T){var R=j.node(T).rank-k;S[R]||(S[R]=[]),S[R].push(T)});var E=0,C=j.graph().nodeRankFactor;e.forEach(S,function(T,R){e.isUndefined(T)&&R%C!==0?--E:E&&e.forEach(T,function(I){j.node(I).rank+=E})})}function m(j,k,S,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=S,C.order=E),n(j,"border",C,k)}function y(j){return e.max(e.map(j.nodes(),function(k){var S=j.node(k).rank;if(!e.isUndefined(S))return S}))}function w(j,k){var S={lhs:[],rhs:[]};return e.forEach(j,function(E){k(E)?S.lhs.push(E):S.rhs.push(E)}),S}function N(j,k){var S=e.now();try{return k()}finally{console.log(j+" time: "+(e.now()-S)+"ms")}}function _(j,k){return k()}return uv}var dv,IC;function VW(){if(IC)return dv;IC=1;var e=At(),t=On();dv={run:n,undo:a};function n(i){i.graph().dummyChains=[],e.forEach(i.edges(),function(c){s(i,c)})}function s(i,c){var u=c.v,f=i.node(u).rank,p=c.w,h=i.node(p).rank,m=c.name,y=i.edge(c),w=y.labelRank;if(h!==f+1){i.removeEdge(c);var N,_,j;for(j=0,++f;f<h;++j,++f)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:c,rank:f},N=t.addDummyNode(i,"edge",_,"_d"),f===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),i.setEdge(u,N,{weight:y.weight},m),j===0&&i.graph().dummyChains.push(N),u=N;i.setEdge(u,p,{weight:y.weight},m)}}function a(i){e.forEach(i.graph().dummyChains,function(c){var u=i.node(c),f=u.edgeLabel,p;for(i.setEdge(u.edgeObj,f);u.dummy;)p=i.successors(c)[0],i.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=i.node(c)})}return dv}var hv,$C;function zd(){if($C)return hv;$C=1;var e=At();hv={longestPath:t,slack:n};function t(s){var a={};function i(c){var u=s.node(c);if(e.has(a,c))return u.rank;a[c]=!0;var f=e.min(e.map(s.outEdges(c),function(p){return i(p.w)-s.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),u.rank=f}e.forEach(s.sources(),i)}function n(s,a){return s.node(a.w).rank-s.node(a.v).rank-s.edge(a).minlen}return hv}var fv,OC;function VR(){if(OC)return fv;OC=1;var e=At(),t=Rr().Graph,n=zd().slack;fv=s;function s(u){var f=new t({directed:!1}),p=u.nodes()[0],h=u.nodeCount();f.setNode(p,{});for(var m,y;a(f,u)<h;)m=i(f,u),y=f.hasNode(m.v)?n(u,m):-n(u,m),c(f,u,y);return f}function a(u,f){function p(h){e.forEach(f.nodeEdges(h),function(m){var y=m.v,w=h===y?m.w:y;!u.hasNode(w)&&!n(f,m)&&(u.setNode(w,{}),u.setEdge(h,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function i(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 fv}var pv,PC;function YW(){if(PC)return pv;PC=1;var e=At(),t=VR(),n=zd().slack,s=zd().longestPath,a=Rr().alg.preorder,i=Rr().alg.postorder,c=On().simplify;pv=u,u.initLowLimValues=m,u.initCutValues=f,u.calcCutValue=h,u.leaveEdge=w,u.enterEdge=N,u.exchangeEdges=_;function u(E){E=c(E),s(E);var C=t(E);m(C),f(C,E);for(var T,R;T=w(C);)R=N(C,E,T),_(C,E,T,R)}function f(E,C){var T=i(E,E.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(R){p(E,C,R)})}function p(E,C,T){var R=E.node(T),I=R.parent;E.edge(T,I).cutvalue=h(E,C,T)}function h(E,C,T){var R=E.node(T),I=R.parent,F=!0,W=C.edge(T,I),O=0;return W||(F=!1,W=C.edge(I,T)),O=W.weight,e.forEach(C.nodeEdges(T),function(B){var Z=B.v===T,Q=Z?B.w:B.v;if(Q!==I){var M=Z===F,K=C.edge(B).weight;if(O+=M?K:-K,k(E,T,Q)){var G=E.edge(T,Q).cutvalue;O+=M?-G:G}}}),O}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,T,R,I){var F=T,W=E.node(R);return C[R]=!0,e.forEach(E.neighbors(R),function(O){e.has(C,O)||(T=y(E,C,T,O,R))}),W.low=F,W.lim=T++,I?W.parent=I:delete W.parent,T}function w(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function N(E,C,T){var R=T.v,I=T.w;C.hasEdge(R,I)||(R=T.w,I=T.v);var F=E.node(R),W=E.node(I),O=F,B=!1;F.lim>W.lim&&(O=W,B=!0);var Z=e.filter(C.edges(),function(Q){return B===S(E,E.node(Q.v),O)&&B!==S(E,E.node(Q.w),O)});return e.minBy(Z,function(Q){return n(C,Q)})}function _(E,C,T,R){var I=T.v,F=T.w;E.removeEdge(I,F),E.setEdge(R.v,R.w,{}),m(E),f(E,C),j(E,C)}function j(E,C){var T=e.find(E.nodes(),function(I){return!C.node(I).parent}),R=a(E,T);R=R.slice(1),e.forEach(R,function(I){var F=E.node(I).parent,W=C.edge(I,F),O=!1;W||(W=C.edge(F,I),O=!0),C.node(I).rank=C.node(F).rank+(O?W.minlen:-W.minlen)})}function k(E,C,T){return E.hasEdge(C,T)}function S(E,C,T){return T.low<=C.lim&&C.lim<=T.lim}return pv}var mv,LC;function KW(){if(LC)return mv;LC=1;var e=zd(),t=e.longestPath,n=VR(),s=YW();mv=a;function a(f){switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":c(f);break;case"longest-path":i(f);break;default:u(f)}}var i=t;function c(f){t(f),n(f)}function u(f){s(f)}return mv}var gv,DC;function XW(){if(DC)return gv;DC=1;var e=At();gv=t;function t(a){var i=s(a);e.forEach(a.graph().dummyChains,function(c){for(var u=a.node(c),f=u.edgeObj,p=n(a,i,f.v,f.w),h=p.path,m=p.lca,y=0,w=h[y],N=!0;c!==f.w;){if(u=a.node(c),N){for(;(w=h[y])!==m&&a.node(w).maxRank<u.rank;)y++;w===m&&(N=!1)}if(!N){for(;y<h.length-1&&a.node(w=h[y+1]).minRank<=u.rank;)y++;w=h[y]}a.setParent(c,w),c=a.successors(c)[0]}})}function n(a,i,c,u){var f=[],p=[],h=Math.min(i[c].low,i[u].low),m=Math.max(i[c].lim,i[u].lim),y,w;y=c;do y=a.parent(y),f.push(y);while(y&&(i[y].low>h||m>i[y].lim));for(w=y,y=u;(y=a.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function s(a){var i={},c=0;function u(f){var p=c;e.forEach(a.children(f),u),i[f]={low:p,lim:c++}}return e.forEach(a.children(),u),i}return gv}var yv,qC;function ZW(){if(qC)return yv;qC=1;var e=At(),t=On();yv={run:n,cleanup:c};function n(u){var f=t.addDummyNode(u,"root",{},"_root"),p=a(u),h=e.max(e.values(p))-1,m=2*h+1;u.graph().nestingRoot=f,e.forEach(u.edges(),function(w){u.edge(w).minlen*=m});var y=i(u)+1;e.forEach(u.children(),function(w){s(u,f,m,y,h,p,w)}),u.graph().nodeRankFactor=m}function s(u,f,p,h,m,y,w){var N=u.children(w);if(!N.length){w!==f&&u.setEdge(f,w,{weight:0,minlen:p});return}var _=t.addBorderNode(u,"_bt"),j=t.addBorderNode(u,"_bb"),k=u.node(w);u.setParent(_,w),k.borderTop=_,u.setParent(j,w),k.borderBottom=j,e.forEach(N,function(S){s(u,f,p,h,m,y,S);var E=u.node(S),C=E.borderTop?E.borderTop:S,T=E.borderBottom?E.borderBottom:S,R=E.borderTop?h:2*h,I=C!==T?1:m-y[w]+1;u.setEdge(_,C,{weight:R,minlen:I,nestingEdge:!0}),u.setEdge(T,j,{weight:R,minlen:I,nestingEdge:!0})}),u.parent(w)||u.setEdge(f,_,{weight:0,minlen:m+y[w]})}function a(u){var f={};function p(h,m){var y=u.children(h);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),f[h]=m}return e.forEach(u.children(),function(h){p(h,1)}),f}function i(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 yv}var wv,FC;function QW(){if(FC)return wv;FC=1;var e=At(),t=On();wv=n;function n(a){function i(c){var u=a.children(c),f=a.node(c);if(u.length&&e.forEach(u,i),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,h=f.maxRank+1;p<h;++p)s(a,"borderLeft","_bl",c,f,p),s(a,"borderRight","_br",c,f,p)}}e.forEach(a.children(),i)}function s(a,i,c,u,f,p){var h={width:0,height:0,rank:p,borderType:i},m=f[i][p-1],y=t.addDummyNode(a,"border",h,c);f[i][p]=y,a.setParent(y,u),m&&a.setEdge(m,y,{weight:1})}return wv}var vv,BC;function JW(){if(BC)return vv;BC=1;var e=At();vv={adjust:t,undo:n};function t(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&s(p)}function n(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&i(p),(h==="lr"||h==="rl")&&(u(p),s(p))}function s(p){e.forEach(p.nodes(),function(h){a(p.node(h))}),e.forEach(p.edges(),function(h){a(p.edge(h))})}function a(p){var h=p.width;p.width=p.height,p.height=h}function i(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 vv}var xv,zC;function eH(){if(zC)return xv;zC=1;var e=At();xv=t;function t(n){var s={},a=e.filter(n.nodes(),function(p){return!n.children(p).length}),i=e.max(e.map(a,function(p){return n.node(p).rank})),c=e.map(e.range(i+1),function(){return[]});function u(p){if(!e.has(s,p)){s[p]=!0;var h=n.node(p);c[h.rank].push(p),e.forEach(n.successors(p),u)}}var f=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(f,u),c}return xv}var bv,UC;function tH(){if(UC)return bv;UC=1;var e=At();bv=t;function t(s,a){for(var i=0,c=1;c<a.length;++c)i+=n(s,a[c-1],a[c]);return i}function n(s,a,i){for(var c=e.zipObject(i,e.map(i,function(y,w){return w})),u=e.flatten(e.map(a,function(y){return e.sortBy(e.map(s.outEdges(y),function(w){return{pos:c[w.w],weight:s.edge(w).weight}}),"pos")}),!0),f=1;f<i.length;)f<<=1;var p=2*f-1;f-=1;var h=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(u.forEach(function(y){var w=y.pos+f;h[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=h[w+1]),w=w-1>>1,h[w]+=y.weight;m+=y.weight*N})),m}return bv}var kv,WC;function nH(){if(WC)return kv;WC=1;var e=At();kv=t;function t(n,s){return e.map(s,function(a){var i=n.inEdges(a);if(i.length){var c=e.reduce(i,function(u,f){var p=n.edge(f),h=n.node(f.v);return{sum:u.sum+p.weight*h.order,weight:u.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:a}})}return kv}var _v,HC;function rH(){if(HC)return _v;HC=1;var e=At();_v=t;function t(a,i){var c={};e.forEach(a,function(f,p){var h=c[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(h.barycenter=f.barycenter,h.weight=f.weight)}),e.forEach(i.edges(),function(f){var p=c[f.v],h=c[f.w];!e.isUndefined(p)&&!e.isUndefined(h)&&(h.indegree++,p.out.push(c[f.w]))});var u=e.filter(c,function(f){return!f.indegree});return n(u)}function n(a){var i=[];function c(p){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(p.barycenter)||h.barycenter>=p.barycenter)&&s(p,h)}}function u(p){return function(h){h.in.push(p),--h.indegree===0&&a.push(h)}}for(;a.length;){var f=a.pop();i.push(f),e.forEach(f.in.reverse(),c(f)),e.forEach(f.out,u(f))}return e.map(e.filter(i,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(a,i){var c=0,u=0;a.weight&&(c+=a.barycenter*a.weight,u+=a.weight),i.weight&&(c+=i.barycenter*i.weight,u+=i.weight),a.vs=i.vs.concat(a.vs),a.barycenter=c/u,a.weight=u,a.i=Math.min(i.i,a.i),i.merged=!0}return _v}var Nv,GC;function sH(){if(GC)return Nv;GC=1;var e=At(),t=On();Nv=n;function n(i,c){var u=t.partition(i,function(_){return e.has(_,"barycenter")}),f=u.lhs,p=e.sortBy(u.rhs,function(_){return-_.i}),h=[],m=0,y=0,w=0;f.sort(a(!!c)),w=s(h,p,w),e.forEach(f,function(_){w+=_.vs.length,h.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,w=s(h,p,w)});var N={vs:e.flatten(h,!0)};return y&&(N.barycenter=m/y,N.weight=y),N}function s(i,c,u){for(var f;c.length&&(f=e.last(c)).i<=u;)c.pop(),i.push(f.vs),u++;return u}function a(i){return function(c,u){return c.barycenter<u.barycenter?-1:c.barycenter>u.barycenter?1:i?u.i-c.i:c.i-u.i}}return Nv}var Sv,VC;function aH(){if(VC)return Sv;VC=1;var e=At(),t=nH(),n=rH(),s=sH();Sv=a;function a(u,f,p,h){var m=u.children(f),y=u.node(f),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,_={};w&&(m=e.filter(m,function(T){return T!==w&&T!==N}));var j=t(u,m);e.forEach(j,function(T){if(u.children(T.v).length){var R=a(u,T.v,p,h);_[T.v]=R,e.has(R,"barycenter")&&c(T,R)}});var k=n(j,p);i(k,_);var S=s(k,h);if(w&&(S.vs=e.flatten([w,S.vs,N],!0),u.predecessors(w).length)){var E=u.node(u.predecessors(w)[0]),C=u.node(u.predecessors(N)[0]);e.has(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+E.order+C.order)/(S.weight+2),S.weight+=2}return S}function i(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 Sv}var jv,YC;function oH(){if(YC)return jv;YC=1;var e=At(),t=Rr().Graph;jv=n;function n(a,i,c){var u=s(a),f=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var h=a.node(p),m=a.parent(p);(h.rank===i||h.minRank<=i&&i<=h.maxRank)&&(f.setNode(p),f.setParent(p,m||u),e.forEach(a[c](p),function(y){var w=y.v===p?y.w:y.v,N=f.edge(w,p),_=e.isUndefined(N)?0:N.weight;f.setEdge(w,p,{weight:a.edge(y).weight+_})}),e.has(h,"minRank")&&f.setNode(p,{borderLeft:h.borderLeft[i],borderRight:h.borderRight[i]}))}),f}function s(a){for(var i;a.hasNode(i=e.uniqueId("_root")););return i}return jv}var Ev,KC;function iH(){if(KC)return Ev;KC=1;var e=At();Ev=t;function t(n,s,a){var i={},c;e.forEach(a,function(u){for(var f=n.parent(u),p,h;f;){if(p=n.parent(f),p?(h=i[p],i[p]=f):(h=c,c=f),h&&h!==f){s.setEdge(h,f);return}f=p}})}return Ev}var Cv,XC;function lH(){if(XC)return Cv;XC=1;var e=At(),t=eH(),n=tH(),s=aH(),a=oH(),i=iH(),c=Rr().Graph,u=On();Cv=f;function f(y){var w=u.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),_=p(y,e.range(w-1,-1,-1),"outEdges"),j=t(y);m(y,j);for(var k=Number.POSITIVE_INFINITY,S,E=0,C=0;C<4;++E,++C){h(E%2?N:_,E%4>=2),j=u.buildLayerMatrix(y);var T=n(y,j);T<k&&(C=0,S=e.cloneDeep(j),k=T)}m(y,S)}function p(y,w,N){return e.map(w,function(_){return a(y,_,N)})}function h(y,w){var N=new c;e.forEach(y,function(_){var j=_.graph().root,k=s(_,j,N,w);e.forEach(k.vs,function(S,E){_.node(S).order=E}),i(_,N,k.vs)})}function m(y,w){e.forEach(w,function(N){e.forEach(N,function(_,j){y.node(_).order=j})})}return Cv}var Tv,ZC;function cH(){if(ZC)return Tv;ZC=1;var e=At(),t=Rr().Graph,n=On();Tv={positionX:N,findType1Conflicts:s,findType2Conflicts:a,addConflict:c,hasConflict:u,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function s(k,S){var E={};function C(T,R){var I=0,F=0,W=T.length,O=e.last(R);return e.forEach(R,function(B,Z){var Q=i(k,B),M=Q?k.node(Q).order:W;(Q||B===O)&&(e.forEach(R.slice(F,Z+1),function(K){e.forEach(k.predecessors(K),function(G){var P=k.node(G),H=P.order;(H<I||M<H)&&!(P.dummy&&k.node(K).dummy)&&c(E,G,K)})}),F=Z+1,I=M)}),R}return e.reduce(S,C),E}function a(k,S){var E={};function C(R,I,F,W,O){var B;e.forEach(e.range(I,F),function(Z){B=R[Z],k.node(B).dummy&&e.forEach(k.predecessors(B),function(Q){var M=k.node(Q);M.dummy&&(M.order<W||M.order>O)&&c(E,Q,B)})})}function T(R,I){var F=-1,W,O=0;return e.forEach(I,function(B,Z){if(k.node(B).dummy==="border"){var Q=k.predecessors(B);Q.length&&(W=k.node(Q[0]).order,C(I,O,Z,F,W),O=Z,F=W)}C(I,O,I.length,W,R.length)}),I}return e.reduce(S,T),E}function i(k,S){if(k.node(S).dummy)return e.find(k.predecessors(S),function(E){return k.node(E).dummy})}function c(k,S,E){if(S>E){var C=S;S=E,E=C}var T=k[S];T||(k[S]=T={}),T[E]=!0}function u(k,S,E){if(S>E){var C=S;S=E,E=C}return e.has(k[S],E)}function f(k,S,E,C){var T={},R={},I={};return e.forEach(S,function(F){e.forEach(F,function(W,O){T[W]=W,R[W]=W,I[W]=O})}),e.forEach(S,function(F){var W=-1;e.forEach(F,function(O){var B=C(O);if(B.length){B=e.sortBy(B,function(G){return I[G]});for(var Z=(B.length-1)/2,Q=Math.floor(Z),M=Math.ceil(Z);Q<=M;++Q){var K=B[Q];R[O]===O&&W<I[K]&&!u(E,O,K)&&(R[K]=O,R[O]=T[O]=T[K],W=I[K])}}})}),{root:T,align:R}}function p(k,S,E,C,T){var R={},I=h(k,S,E,T),F=T?"borderLeft":"borderRight";function W(Z,Q){for(var M=I.nodes(),K=M.pop(),G={};K;)G[K]?Z(K):(G[K]=!0,M.push(K),M=M.concat(Q(K))),K=M.pop()}function O(Z){R[Z]=I.inEdges(Z).reduce(function(Q,M){return Math.max(Q,R[M.v]+I.edge(M))},0)}function B(Z){var Q=I.outEdges(Z).reduce(function(K,G){return Math.min(K,R[G.w]-I.edge(G))},Number.POSITIVE_INFINITY),M=k.node(Z);Q!==Number.POSITIVE_INFINITY&&M.borderType!==F&&(R[Z]=Math.max(R[Z],Q))}return W(O,I.predecessors.bind(I)),W(B,I.successors.bind(I)),e.forEach(C,function(Z){R[Z]=R[E[Z]]}),R}function h(k,S,E,C){var T=new t,R=k.graph(),I=_(R.nodesep,R.edgesep,C);return e.forEach(S,function(F){var W;e.forEach(F,function(O){var B=E[O];if(T.setNode(B),W){var Z=E[W],Q=T.edge(Z,B);T.setEdge(Z,B,Math.max(I(k,O,W),Q||0))}W=O})}),T}function m(k,S){return e.minBy(e.values(S),function(E){var C=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(E,function(R,I){var F=j(k,I)/2;C=Math.max(R+F,C),T=Math.min(R-F,T)}),C-T})}function y(k,S){var E=e.values(S),C=e.min(E),T=e.max(E);e.forEach(["u","d"],function(R){e.forEach(["l","r"],function(I){var F=R+I,W=k[F],O;if(W!==S){var B=e.values(W);O=I==="l"?C-e.min(B):T-e.max(B),O&&(k[F]=e.mapValues(W,function(Z){return Z+O}))}})})}function w(k,S){return e.mapValues(k.ul,function(E,C){if(S)return k[S.toLowerCase()][C];var T=e.sortBy(e.map(k,C));return(T[1]+T[2])/2})}function N(k){var S=n.buildLayerMatrix(k),E=e.merge(s(k,S),a(k,S)),C={},T;e.forEach(["u","d"],function(I){T=I==="u"?S:e.values(S).reverse(),e.forEach(["l","r"],function(F){F==="r"&&(T=e.map(T,function(Z){return e.values(Z).reverse()}));var W=(I==="u"?k.predecessors:k.successors).bind(k),O=f(k,T,E,W),B=p(k,T,O.root,O.align,F==="r");F==="r"&&(B=e.mapValues(B,function(Z){return-Z})),C[I+F]=B})});var R=m(k,C);return y(C,R),w(C,k.graph().align)}function _(k,S,E){return function(C,T,R){var I=C.node(T),F=C.node(R),W=0,O;if(W+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":O=-I.width/2;break;case"r":O=I.width/2;break}if(O&&(W+=E?O:-O),O=0,W+=(I.dummy?S:k)/2,W+=(F.dummy?S:k)/2,W+=F.width/2,e.has(F,"labelpos"))switch(F.labelpos.toLowerCase()){case"l":O=F.width/2;break;case"r":O=-F.width/2;break}return O&&(W+=E?O:-O),O=0,W}}function j(k,S){return k.node(S).width}return Tv}var Av,QC;function uH(){if(QC)return Av;QC=1;var e=At(),t=On(),n=cH().positionX;Av=s;function s(i){i=t.asNonCompoundGraph(i),a(i),e.forEach(n(i),function(c,u){i.node(u).x=c})}function a(i){var c=t.buildLayerMatrix(i),u=i.graph().ranksep,f=0;e.forEach(c,function(p){var h=e.max(e.map(p,function(m){return i.node(m).height}));e.forEach(p,function(m){i.node(m).y=f+h/2}),f+=h+u})}return Av}var Rv,JC;function dH(){if(JC)return Rv;JC=1;var e=At(),t=GW(),n=VW(),s=KW(),a=On().normalizeRanks,i=XW(),c=On().removeEmptyRanks,u=ZW(),f=QW(),p=JW(),h=lH(),m=uH(),y=On(),w=Rr().Graph;Rv=N;function N(Y,J){var z=J&&J.debugTiming?y.time:y.notime;z("layout",function(){var re=z(" buildLayoutGraph",function(){return W(Y)});z(" runLayout",function(){_(re,z)}),z(" updateInputGraph",function(){j(Y,re)})})}function _(Y,J){J(" makeSpaceForEdgeLabels",function(){O(Y)}),J(" removeSelfEdges",function(){L(Y)}),J(" acyclic",function(){t.run(Y)}),J(" nestingGraph.run",function(){u.run(Y)}),J(" rank",function(){s(y.asNonCompoundGraph(Y))}),J(" injectEdgeLabelProxies",function(){B(Y)}),J(" removeEmptyRanks",function(){c(Y)}),J(" nestingGraph.cleanup",function(){u.cleanup(Y)}),J(" normalizeRanks",function(){a(Y)}),J(" assignRankMinMax",function(){Z(Y)}),J(" removeEdgeLabelProxies",function(){Q(Y)}),J(" normalize.run",function(){n.run(Y)}),J(" parentDummyChains",function(){i(Y)}),J(" addBorderSegments",function(){f(Y)}),J(" order",function(){h(Y)}),J(" insertSelfEdges",function(){U(Y)}),J(" adjustCoordinateSystem",function(){p.adjust(Y)}),J(" position",function(){m(Y)}),J(" positionSelfEdges",function(){$(Y)}),J(" removeBorderNodes",function(){H(Y)}),J(" normalize.undo",function(){n.undo(Y)}),J(" fixupEdgeLabelCoords",function(){G(Y)}),J(" undoCoordinateSystem",function(){p.undo(Y)}),J(" translateGraph",function(){M(Y)}),J(" assignNodeIntersects",function(){K(Y)}),J(" reversePoints",function(){P(Y)}),J(" acyclic.undo",function(){t.undo(Y)})}function j(Y,J){e.forEach(Y.nodes(),function(z){var re=Y.node(z),le=J.node(z);re&&(re.x=le.x,re.y=le.y,J.children(z).length&&(re.width=le.width,re.height=le.height))}),e.forEach(Y.edges(),function(z){var re=Y.edge(z),le=J.edge(z);re.points=le.points,e.has(le,"x")&&(re.x=le.x,re.y=le.y)}),Y.graph().width=J.graph().width,Y.graph().height=J.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],T={width:0,height:0},R=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},F=["labelpos"];function W(Y){var J=new w({multigraph:!0,compound:!0}),z=he(Y.graph());return J.setGraph(e.merge({},S,V(z,k),e.pick(z,E))),e.forEach(Y.nodes(),function(re){var le=he(Y.node(re));J.setNode(re,e.defaults(V(le,C),T)),J.setParent(re,Y.parent(re))}),e.forEach(Y.edges(),function(re){var le=he(Y.edge(re));J.setEdge(re,e.merge({},I,V(le,R),e.pick(le,F)))}),J}function O(Y){var J=Y.graph();J.ranksep/=2,e.forEach(Y.edges(),function(z){var re=Y.edge(z);re.minlen*=2,re.labelpos.toLowerCase()!=="c"&&(J.rankdir==="TB"||J.rankdir==="BT"?re.width+=re.labeloffset:re.height+=re.labeloffset)})}function B(Y){e.forEach(Y.edges(),function(J){var z=Y.edge(J);if(z.width&&z.height){var re=Y.node(J.v),le=Y.node(J.w),me={rank:(le.rank-re.rank)/2+re.rank,e:J};y.addDummyNode(Y,"edge-proxy",me,"_ep")}})}function Z(Y){var J=0;e.forEach(Y.nodes(),function(z){var re=Y.node(z);re.borderTop&&(re.minRank=Y.node(re.borderTop).rank,re.maxRank=Y.node(re.borderBottom).rank,J=e.max(J,re.maxRank))}),Y.graph().maxRank=J}function Q(Y){e.forEach(Y.nodes(),function(J){var z=Y.node(J);z.dummy==="edge-proxy"&&(Y.edge(z.e).labelRank=z.rank,Y.removeNode(J))})}function M(Y){var J=Number.POSITIVE_INFINITY,z=0,re=Number.POSITIVE_INFINITY,le=0,me=Y.graph(),ge=me.marginx||0,Me=me.marginy||0;function qe(Ve){var Ue=Ve.x,Se=Ve.y,Qe=Ve.width,Ne=Ve.height;J=Math.min(J,Ue-Qe/2),z=Math.max(z,Ue+Qe/2),re=Math.min(re,Se-Ne/2),le=Math.max(le,Se+Ne/2)}e.forEach(Y.nodes(),function(Ve){qe(Y.node(Ve))}),e.forEach(Y.edges(),function(Ve){var Ue=Y.edge(Ve);e.has(Ue,"x")&&qe(Ue)}),J-=ge,re-=Me,e.forEach(Y.nodes(),function(Ve){var Ue=Y.node(Ve);Ue.x-=J,Ue.y-=re}),e.forEach(Y.edges(),function(Ve){var Ue=Y.edge(Ve);e.forEach(Ue.points,function(Se){Se.x-=J,Se.y-=re}),e.has(Ue,"x")&&(Ue.x-=J),e.has(Ue,"y")&&(Ue.y-=re)}),me.width=z-J+ge,me.height=le-re+Me}function K(Y){e.forEach(Y.edges(),function(J){var z=Y.edge(J),re=Y.node(J.v),le=Y.node(J.w),me,ge;z.points?(me=z.points[0],ge=z.points[z.points.length-1]):(z.points=[],me=le,ge=re),z.points.unshift(y.intersectRect(re,me)),z.points.push(y.intersectRect(le,ge))})}function G(Y){e.forEach(Y.edges(),function(J){var z=Y.edge(J);if(e.has(z,"x"))switch((z.labelpos==="l"||z.labelpos==="r")&&(z.width-=z.labeloffset),z.labelpos){case"l":z.x-=z.width/2+z.labeloffset;break;case"r":z.x+=z.width/2+z.labeloffset;break}})}function P(Y){e.forEach(Y.edges(),function(J){var z=Y.edge(J);z.reversed&&z.points.reverse()})}function H(Y){e.forEach(Y.nodes(),function(J){if(Y.children(J).length){var z=Y.node(J),re=Y.node(z.borderTop),le=Y.node(z.borderBottom),me=Y.node(e.last(z.borderLeft)),ge=Y.node(e.last(z.borderRight));z.width=Math.abs(ge.x-me.x),z.height=Math.abs(le.y-re.y),z.x=me.x+z.width/2,z.y=re.y+z.height/2}}),e.forEach(Y.nodes(),function(J){Y.node(J).dummy==="border"&&Y.removeNode(J)})}function L(Y){e.forEach(Y.edges(),function(J){if(J.v===J.w){var z=Y.node(J.v);z.selfEdges||(z.selfEdges=[]),z.selfEdges.push({e:J,label:Y.edge(J)}),Y.removeEdge(J)}})}function U(Y){var J=y.buildLayerMatrix(Y);e.forEach(J,function(z){var re=0;e.forEach(z,function(le,me){var ge=Y.node(le);ge.order=me+re,e.forEach(ge.selfEdges,function(Me){y.addDummyNode(Y,"selfedge",{width:Me.label.width,height:Me.label.height,rank:ge.rank,order:me+ ++re,e:Me.e,label:Me.label},"_se")}),delete ge.selfEdges})})}function $(Y){e.forEach(Y.nodes(),function(J){var z=Y.node(J);if(z.dummy==="selfedge"){var re=Y.node(z.e.v),le=re.x+re.width/2,me=re.y,ge=z.x-le,Me=re.height/2;Y.setEdge(z.e,z.label),Y.removeNode(J),z.label.points=[{x:le+2*ge/3,y:me-Me},{x:le+5*ge/6,y:me-Me},{x:le+ge,y:me},{x:le+5*ge/6,y:me+Me},{x:le+2*ge/3,y:me+Me}],z.label.x=z.x,z.label.y=z.y}})}function V(Y,J){return e.mapValues(e.pick(Y,J),Number)}function he(Y){var J={};return e.forEach(Y,function(z,re){J[re.toLowerCase()]=z}),J}return Rv}var Mv,eT;function hH(){if(eT)return Mv;eT=1;var e=At(),t=On(),n=Rr().Graph;Mv={debugOrdering:s};function s(a){var i=t.buildLayerMatrix(a),c=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(u){c.setNode(u,{label:u}),c.setParent(u,"layer"+a.node(u).rank)}),e.forEach(a.edges(),function(u){c.setEdge(u.v,u.w,{},u.name)}),e.forEach(i,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 Mv}var Iv,tT;function fH(){return tT||(tT=1,Iv="0.8.5"),Iv}var $v,nT;function pH(){return nT||(nT=1,$v={graphlib:Rr(),layout:dH(),debug:hH(),util:{time:On().time,notime:On().notime},version:fH()}),$v}var mH=pH();const rT=xx(mH),po=240,vc=130,Ii=74,Nh=72,ac=Ii+Nh;function YR(e,t){var s;let n=po;for(const a of e)n=Math.max(n,((s=t.get(a.id))==null?void 0:s.width)??po);return n}const Ud=420,KR=1;function gH(e,t,n,s){return Math.min(KR,n/Math.max(1,e),s/Math.max(1,t))}function mo(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function yH(e,t){return((t==null?void 0:t.get(e))??0)>0?Ud:0}function wH(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function xc(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??po)+yH(e,n),h:Math.max((s==null?void 0:s.height)??vc,wH(e,n))}}function vH(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function xH(e,t,n,s,a,i){const c=new rT.graphlib.Graph;c.setDefaultEdgeLabel(()=>({})),c.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(k=>!a.has(k)),f=new Set(u);for(const k of u){const{w:S,h:E}=xc(k,s,i);c.setNode(k,{width:S,height:E})}for(const k of t)f.has(k.source)&&f.has(k.target)&&c.setEdge(k.source,k.target);rT.layout(c);const p=new Map;let h=1/0,m=1/0,y=-1/0,w=-1/0;for(const k of u){const S=c.node(k);if(!S)continue;const E=s.get(k),C=(E==null?void 0:E.width)??po,T=(E==null?void 0:E.height)??vc,R=xc(k,s,i),I=S.x-R.w/2,F=S.y-R.h/2;p.set(k,{x:I,y:F}),I<h&&(h=I),F<m&&(m=F),I+C>y&&(y=I+C),F+T>w&&(w=F+T)}if(Number.isFinite(h)&&Number.isFinite(m))for(const[k,S]of p)p.set(k,{x:S.x-h,y:S.y-m});const N=Number.isFinite(y)?y-h:0,_=Number.isFinite(w)?w-m:0;let j=null;for(const k of e){const S=a.get(k);if(!S)continue;const E=s.get(k),C=(E==null?void 0:E.width)??po,T=(E==null?void 0:E.height)??vc;j=j===null?{minX:S.x,minY:S.y,maxX:S.x+C,maxY:S.y+T}:{minX:Math.min(j.minX,S.x),minY:Math.min(j.minY,S.y),maxX:Math.max(j.maxX,S.x+C),maxY:Math.max(j.maxY,S.y+T)}}return{positions:p,width:N,height:_,pinnedBox:j}}function XR(e,t,n){const s=n.direction??"LR",a=n.pinned??new Map,i=n.measured??new Map,c=n.lanes,u=new Map;for(const h of e){const m=mo(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,...xH(u.get(h),t,s,i,a,c)})),gap:YR(e,i)}}const ZR=e=>e.reduce((t,n)=>Math.max(t,n.width),0)+Ud,bH=e=>e.reduce((t,n)=>t+n.height,0)+ac*Math.max(0,e.length-1);function yx(e,t,n,s){const a=f=>{const p=[[]];let h=0;for(const m of e)h>0&&h+m.height>f&&(p.push([]),h=0),p[p.length-1].push(m),h+=m.height+ac;return p},i=[];for(let f=0;f<e.length;f++){let p=-ac;for(let h=f;h<e.length;h++)i.push(p+=e[h].height+ac)}i.sort((f,p)=>f-p);const c=f=>{let p=0,h=i.length-1;for(;p<h;){const m=p+h>>1;a(i[m]).length<=f?h=m:p=m+1}return a(i[p])};let u=[e];if(n>0&&s>0){const f=h=>gH(h.reduce((m,y)=>m+ZR(y),0)+t*(h.length-1),Math.max(...h.map(bH)),n,s);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 kH(e,t,n,s,a){if(!(s.width>0&&s.height>0&&a.width>0&&a.height>0))return!1;const{laid:i,gap:c}=XR(e,t,n);return i.length<2?!1:yx(i,c,s.width,s.height).length!==yx(i,c,a.width,a.height).length}function _H(e,t,n={}){const s=n.pinned??new Map,{laid:a,gap:i}=XR(e,t,n),c=yx(a,i,n.availableWidth??0,n.availableHeight??0),u=new Map;let f=0;for(const p of c){const h=ZR(p);let m=0;for(const{positions:y,height:w,pinnedBox:N}of p){for(const[j,k]of y)u.set(j,{x:k.x+f,y:k.y+m});let _=m+w;N&&N.maxY>_&&N.minX<f+h&&f<N.maxX&&(_=N.maxY),m=_+ac}f+=h+i}return e.map(p=>{const h=s.get(p.id);if(h)return{...p,position:h};const m=u.get(p.id);return m?{...p,position:m}:p})}function NH(e,t,n,s,a){const c=Ii+Nh,u=60,f=w=>xc(w,s,a),p=new Map(e.map(w=>[w.id,mo(w)])),h=[],m=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),y=[];for(const{id:w,pos:N}of m){const{w:_,h:j}=f(w),k=p.get(w)??"_default";if(n.has(w)){h.push({x:N.x,y:N.y,w:_,h:j,sid:k});continue}let S=N.y;for(let E=0;E<h.length+1;E++){const C=h.find(T=>{const R=T.sid===k?24:u,I=T.sid===k?24:c;return N.x<T.x+T.w+R&&T.x<N.x+_+R&&S<T.y+T.h+I&&T.y<S+j+I});if(!C)break;S=C.y+C.h+(C.sid===k?24:c)}S!==N.y&&(t.set(w,{x:N.x,y:S}),y.push(w)),h.push({x:N.x,y:S,w:_,h:j,sid:k})}return y}function SH(e,t,n,s,a,i,c){const u=E=>xc(E,s,i),f=E=>n.get(E)??t.get(E),p=E=>{const C=s.get(E);return{cw:(C==null?void 0:C.width)??po,ch:(C==null?void 0:C.height)??vc}},h=c!=null&&c.width>0&&c.height>0,m=new Map;for(const E of e){if(!f(E.id))continue;const C=mo(E),T=m.get(C);T?T.push(E):m.set(C,[E])}const y=new Set;for(const[E,C]of m)C.every(T=>a.has(T.id)&&!n.has(T.id))&&y.add(E);const w=new Map,N=[];for(const E of e){const C=f(E.id);if(!C)continue;const{w:T,h:R}=u(E.id),I=mo(E);y.has(I)?(w.get(I)??w.set(I,[]).get(I)).push(E):N.push({x:C.x,y:C.y,w:T,h:R,...p(E.id)})}if(w.size===0||h&&N.length===0)return[];const _=Ii+Nh,j=(E,C,T,R)=>N.some(I=>E<I.x+I.w+Ii&&I.x<E+T+Ii&&C<I.y+I.h+_&&I.y<C+R+_),k=YR(e,s),S=[];for(const E of[...w.keys()].sort()){const C=w.get(E);let T=1/0,R=1/0,I=-1/0,F=-1/0,W=-1/0,O=-1/0;for(const P of C){const H=f(P.id),{w:L,h:U}=u(P.id),{cw:$,ch:V}=p(P.id);T=Math.min(T,H.x),R=Math.min(R,H.y),I=Math.max(I,H.x+L),F=Math.max(F,H.y+U),W=Math.max(W,H.x+$),O=Math.max(O,H.y+V)}const B=I-T,Z=F-R,Q=[...new Set(N.map(P=>Math.round(P.x)))].sort((P,H)=>P-H),M=Q.length?Q:[T],K=[0,...N.map(P=>P.y+P.h+_)].sort((P,H)=>P-H);let G=null;if(h){let P=1/0,H=1/0,L=-1/0,U=-1/0;for(const z of N)P=Math.min(P,z.x),H=Math.min(H,z.y),L=Math.max(L,z.x+z.cw),U=Math.max(U,z.y+z.ch);const $=(z,re)=>{const le=c.width/(Math.max(L,z+W-T)-Math.min(P,z)+Ud),me=c.height/(Math.max(U,re+O-R)-Math.min(H,re));return[Math.min(KR,le,me),Math.min(le,me),Math.max(le,me)]},V=(z,re)=>{for(let le=0;le<z.length;le++){if(z[le]>re[le]+1e-9)return!0;if(z[le]<re[le]-1e-9)return!1}return!1},he=Math.round(L+Ud+k),Y=[...new Set([...K,H])].sort((z,re)=>z-re);let J=null;for(const z of[...M,he])for(const re of Y){if(j(z,re,B,Z))continue;const le=$(z,re);(J===null||V(le,J))&&(J=le,G={x:z,y:re})}G&&G.x===T&&G.y===R&&(G=null)}else e:for(const P of M)for(const H of K){if(H>=R)break;if(!j(P,H,B,Z)){G={x:P,y:H};break e}}if(G){const P=G.x-T,H=G.y-R;for(const L of C){const U=f(L.id);t.set(L.id,{x:U.x+P,y:U.y+H})}S.push(E)}for(const P of C){const H=f(P.id),{w:L,h:U}=u(P.id);N.push({x:H.x,y:H.y,w:L,h:U,...p(P.id)})}}return S}function jH(e,t,n){const s=new Map;for(const a of e){if(t.has(a.id)||!n(a.id))continue;const i=mo(a);(s.get(i)??s.set(i,[]).get(i)).push(a)}if(s.size===0)return e;for(const a of s.values())a.sort((i,c)=>i.id.localeCompare(c.id));return e.map(a=>{var p;if(t.has(a.id)||n(a.id))return a;const i=s.get(mo(a));if(!i)return a;const c=(p=a.data)==null?void 0:p.parentId,u=i.find(h=>h.id===c)??i[0],f=n(u.id);return{...a,position:{x:a.position.x+f.x-u.position.x,y:a.position.y+f.y-u.position.y}}})}function EH(e,t,n,s,a,i=!1,c){const p=Ii+Nh+1,h=8,m=1.75,y=200,w=.7,N=.01,_=O=>xc(O,s,c),j=O=>n.get(O)??t.get(O),k=new Map;for(const O of e){if(!j(O.id))continue;const B=mo(O),Z=k.get(B);Z?Z.push(O):k.set(B,[O])}const S=[],E=new Set,C=new Set,T=a.size===0;for(const O of[...k.keys()].sort()){const B=k.get(O);let Z=1/0,Q=1/0,M=-1/0,K=-1/0,G=!1;for(const U of B){const $=j(U.id),{w:V,h:he}=_(U.id);Z=Math.min(Z,$.x),Q=Math.min(Q,$.y),M=Math.max(M,$.x+V),K=Math.max(K,$.y+he),n.has(U.id)&&(G=!0)}const P=M-Z,H=K-Q;C.add(O);const L=a.get(O);L&&(P>L.w+h||H>L.h+h)&&E.add(O),a.set(O,{w:P,h:H}),S.push({sid:O,members:B.map(U=>U.id),x:Z,y:Q,w:P,h:H,anchored:G,mass:1})}for(const O of[...a.keys()])C.has(O)||a.delete(O);if(i||T)return[];let R=!1;for(let O=0;O<S.length&&!R;O++)for(let B=O+1;B<S.length;B++){const Z=S[O],Q=S[B];if(!(Z.anchored&&Q.anchored)&&Math.abs(Z.x+Z.w/2-(Q.x+Q.w/2))<(Z.w+Q.w)/2+61&&Math.abs(Z.y+Z.h/2-(Q.y+Q.h/2))<(Z.h+Q.h)/2+p){R=!0;break}}if(E.size===0&&!R)return[];if(E.size>0)for(const O of S)E.has(O.sid)&&(O.mass=8);else for(const O of S)O.mass=Math.max(1,O.w*O.h/(po*vc));const I=new Map(S.map(O=>[O.sid,O.x])),F=new Map(S.map(O=>[O.sid,O.y]));for(let O=0;O<y;O++){const B=new Map,Z=new Map;let Q=0;for(let M=0;M<S.length;M++)for(let K=M+1;K<S.length;K++){const G=S[M],P=S[K];if(G.anchored&&P.anchored)continue;const H=G.x+G.w/2,L=G.y+G.h/2,U=P.x+P.w/2,$=P.y+P.h/2,V=(G.w+P.w)/2+61-Math.abs(H-U),he=(G.h+P.h)/2+p-Math.abs(L-$);if(V<=0||he<=0)continue;const Y=(We,He)=>!We.anchored&&!(He<0&&We.x<=0),J=(We,He)=>!We.anchored&&!(He<0&&We.y<=0),z=(We,He,ot)=>{const wt=We===He,ut=wt?G.sid<P.sid?-1:1:Math.sign(We-He);return ot(G,ut)||ot(P,-ut)?ut:wt&&(ot(G,-ut)||ot(P,ut))?-ut:0},re=z(H,U,Y),le=z(L,$,J),me=re!==0,ge=le!==0;if(!me&&!ge)continue;const Me=me&&(!ge||V*m<he),[qe,Ve,Ue,Se]=Me?[re,V,B,Y]:[le,he,Z,J],Qe=Se(G,qe),Ne=Se(P,-qe),_e=G.mass,ue=P.mass,je=Qe?Ne?ue/(_e+ue):1:0,Ce=Ne?Qe?_e/(_e+ue):1:0,Fe=Ve*w;Ue.set(G.sid,(Ue.get(G.sid)??0)+qe*Fe*je),Ue.set(P.sid,(Ue.get(P.sid)??0)-qe*Fe*Ce),Q+=Fe}for(const M of S)M.anchored||(M.x=Math.max(0,M.x+(B.get(M.sid)??0)),M.y=Math.max(0,M.y+(Z.get(M.sid)??0)));if(Q<N)break}const W=[];for(const O of S){const B=O.x-I.get(O.sid),Z=O.y-F.get(O.sid);if(!(Math.abs(B)<1&&Math.abs(Z)<1)){for(const Q of O.members){if(n.has(Q))continue;const M=t.get(Q);M&&t.set(Q,{x:M.x+B,y:M.y+Z})}W.push(O.sid)}}return W}const CH=600;function wx(e,t){return!(e.exitAt!=null&&t-e.exitAt>CH||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function TH(e,t){const n=new Set;for(const s of e.agents.values())wx(s,t)&&n.add(s.id);return n}function AH(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 RH(e,t,n=0){if(!e)return!1;for(const s of t)if(AH(e,s,n))return!0;return!1}const QR="sessionGroup";function MH(e,t){var s,a;if(e.type===QR)return"transparent";if(go((s=e.data)==null?void 0:s.waiting))return t("--warn");if(e.type==="recapNote")return t("--muted");const n=(a=e.data)==null?void 0:a.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const JR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function sT(e){const t={};for(const n of JR)t[n]=e(n);return t}function IH(e){return t=>e[t]??""}function $H(e,t){return JR.every(n=>e[n]===t[n])}function OH(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[a,i]of e.positions)n.set(a,i),t.has(a)&&s.set(a,i);return{positions:n,pinned:s}}const eM=.2,tM=1.6;function PH(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:s,zoom:a}=t;return typeof n!="number"||typeof s!="number"||typeof a!="number"||!Number.isFinite(n)||!Number.isFinite(s)||!Number.isFinite(a)||a<eM||a>tM?null:{x:n,y:s,zoom:a}}const LH=1200,DH=1e3;function aT(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<LH?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<DH}function _d({durationMs:e,documentHidden:t,reducedMotion:n=qH()}){return t||n?!1:Number.isFinite(e)&&e>0}function qH(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function Ov(e){const t=typeof document<"u"&&document.hidden;return _d({durationMs:e,documentHidden:t})?e:0}function FH(e,t,n){const s=e.x*t.zoom+t.x,a=e.y*t.zoom+t.y,i=(e.x+e.width)*t.zoom+t.x,c=(e.y+e.height)*t.zoom+t.y;return i>0&&s<n.width&&c>0&&a<n.height}function BH({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 s=!1;for(const a of n)if(s=!0,FH(a,t,e))return!1;return s}const zH="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Pv="click for what's new";function UH(e){if(e.checkDisabled)return`${zH} · ${Pv}`;if(e.checking)return`Asking npm for the newest release… · ${Pv}`;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 · ${Pv}, and to check npm now`}function WH(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 HH(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 GH(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 vx={kind:"assumed",claude:!0,codex:!0};function VH(e){if(!e||typeof e!="object")return vx;const t=e.providers;if(!t||typeof t!="object")return vx;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function YH(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const oT={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function KH(e){const t=e.toLowerCase();return Object.hasOwn(oT,t)?oT[t]:t?t[0].toUpperCase()+t.slice(1):""}function XH(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function X7(e,t=[]){const n=t.length?XH(t.map(KH)):YH(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function ZH(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 QH(e,t){const n=t.prefs??gx,s=wc(n.done.level),a=wc(n["needs-input"].level),i=s===a?`${s}%`:`${s}% and ${a}%`,c=t.on?`Sound: on at ${i} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",u=e.codex?`
284
+
285
+ Both CLIs get the finish tone. The second tone — Claude is waiting for you — has no Codex equivalent to fire on, so it only ever plays for Claude Code.`:"",f=t.on&&t.locked?`
286
+
287
+ Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return c+u+f+`
288
+
289
+ Click to set the volume and the sound of each tone, and to hear either one.`}function Wd(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const iT=99;function JH(e){const t=Math.max(0,Math.floor(e));return t>iT?`${iT}+`:String(t)}const e7="Pause the canvas";function t7(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 — ${Wd(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)":`${Wd(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function n7(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 nM="paused · full",r7=(e,t)=>t>0?nM:e>0?`paused · ${JH(e)}`:"paused";function s7(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:r7(e.held,t),widest:nM,title:t>0?`Connected — the pause is full at ${Wd(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Wd(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 a7=x.lazy(()=>vT(()=>import("./UsageHistoryModal-zExZpRWU.js"),[])),o7=x.lazy(()=>vT(()=>import("./BrowserWatchModal-DD6srgsk.js"),[]));function lT(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const i7={agent:q5,sessionGroup:y6,recapNote:v6},l7={recapTie:x6},c7=300,cT=130,u7=160,rM="react-flow__node";function uT(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,rM))===!0}const Lv=80,Dv=.86;function dT(e){if(!e)return 0;const t=e.getBoundingClientRect();let n=t.right;for(const s of document.querySelectorAll(".sysdetail:not(.leaving), .usage-panel:not(.leaving)")){const a=s.getBoundingClientRect();a.width>0&&a.left>t.left&&(n=Math.min(n,a.left))}return Math.max(0,t.right-n)}function d7(e){try{const t=document.querySelector(`.${rM}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const h7=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),f7=420;function p7(e){return e<.35?"far":e<.55?"mid":"full"}const ud=18,m7=200,g7=5*6e4,y7=6,w7=2*6e4,hT=400,_0="agent-dag.layout",N0="agent-dag.layoutFrame",S0="agent-dag.viewport",sM="agent-dag.sessionListOpen",aM="agent-dag.detailOpen",oM="agent-dag.usagePanelOpen",iM="agent-dag.systemPanelOpen",fT="agent-dag.accountsPanelOpen",qv="agent-dag.versionNoticeDismissed",pT="agent-dag.oldNameNoticeDismissed",v7=15*6e4,Fv={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:"},dd="agent-dag.autoRestart",mT="agent-dag.bundleReloadedFor";function x7(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(sM)==="1"}catch{return!1}}function b7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(sM,e?"1":"0")}catch{}}function k7(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(aM)==="1"}catch{return!1}}function _7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(aM,e?"1":"0")}catch{}}function N7(){const e=yo(oM);return e===null?!0:e==="1"}function S7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(oM,e?"1":"0")}catch{}}function j7(){const e=yo(iM);return e===null?!0:e==="1"}function E7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(iM,e?"1":"0")}catch{}}function C7(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(_0);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const a=Object.entries(n).filter(([,i])=>i&&typeof i.x=="number"&&typeof i.y=="number");return{positions:a,pins:a.map(([i])=>i)}}return{positions:Object.entries(n.positions??{}).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function hd(e,t){if(!(typeof window>"u"))try{const n={};for(const[s,a]of e)n[s]=a;for(const[s,a]of t)n[s]=a;window.localStorage.setItem(_0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function T7(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(N0);if(!e)return null;const t=JSON.parse(e);return!(typeof(t==null?void 0:t.width)=="number"&&typeof(t==null?void 0:t.height)=="number")||!(t.width>0&&t.height>0)?null:{width:t.width,height:t.height}}catch{return null}}function A7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(N0,JSON.stringify(e))}catch{}}function R7(){if(typeof window>"u")return null;try{return PH(window.localStorage.getItem(S0))}catch{return null}}function M7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(S0,JSON.stringify(e))}catch{}}function gT(){if(!(typeof window>"u")){try{window.localStorage.removeItem(_0)}catch{}try{window.localStorage.removeItem(S0)}catch{}try{window.localStorage.removeItem(N0)}catch{}}}function I7(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const h of e.agents.values())h.sessionId===t&&s.push(h);const a={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:s.map(h=>({id:h.id,kind:h.kind,label:h.label,parentId:h.parentId,state:h.state,startedAt:h.startedAt,endedAt:h.endedAt,model:h.model,cwd:h.cwd,usage:h.usage,prompts:h.prompts,tools:h.tools.map(m=>({id:m.id,name:m.name,inputPreview:m.inputPreview,startedAt:m.startedAt,endedAt:m.endedAt,ok:m.ok,errorPreview:m.errorPreview,usage:m.usage}))}))},i=JSON.stringify(a,null,2),c=new Blob([i],{type:"application/json"}),u=URL.createObjectURL(c),f=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=u,f.download=`${Zt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const lM={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},$7={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 O7({cat:e}){return l.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:l.jsx("path",{d:$7[e]})})}const Hd={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},cM=fA,yT=new WeakMap;function P7(e,t){let n=yT.get(e);(!n||n.revision!==e.revision||n.open!==t)&&(n={revision:e.revision,open:t,byId:new Map},yT.set(e,n));const{byId:s}=n;return a=>{let i=s.get(a.id);return i||(i={...a,onOpenContext:t},s.set(a.id,i)),i}}function uM(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 L7(e,t,n,s,a,i,c,u,f,p,h,m,y,w,N,_,j,k){var Q,M,K,G;const S=[],E=[],C=P7(e,k);for(const P of e.agents.values()){if(!j.has(P.id))continue;const H=P.exitAt!=null,L=_!=null&&!_.has(P.id),U=[H?"rf-exiting":"",L?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,$=i.get(P.id);if(S.push({id:P.id,type:"agent",position:{x:0,y:0},data:C(P),className:U,ariaLabel:z5(P,t),...$?{width:$.width,height:$.height}:null}),P.parentId&&j.has(P.parentId)){const Y=$d(P.sessionId),J=H,z=N.size>0&&(N.has(P.id)||N.has(P.parentId)),re=_!=null&&!_.has(P.id)&&!_.has(P.parentId),le=P.state==="active"?2:1.5,me=z?le+1.5:le,ge=J?.2:re?.12:1,Me=["sess-edge",P.state==="active"?"sess-live":"sess-idle",J?"rf-edge-exiting":"",z?"rf-edge-selected":""].filter(Boolean).join(" ");E.push({id:`e:${P.parentId}->${P.id}`,source:P.parentId,target:P.id,animated:(P.state==="active"||z)&&!J,type:"smoothstep",style:{"--session-hue":Y,strokeWidth:me,opacity:ge,transition:"var(--edge-transition)"},className:Me})}const V=P.kind==="root"?rh(P):null,he=V?cA(P.sessionId,V.at):null;if(V&&he&&!M5(he)){const Y=Hx(P.id),J=$d(P.sessionId),z=i.get(Y);S.push({id:Y,type:"recapNote",position:{x:0,y:0},data:{sessionId:P.sessionId,parentId:P.id,recap:V,noteKey:he,hue:J},className:L?"rf-spotlit-out":void 0,selectable:!1,focusable:!1,ariaLabel:`Claude Code's recap for ${P.label}`,...z?{width:z.width,height:z.height}:null}),E.push({id:`e:recap:${P.id}`,source:Y,target:P.id,type:"recapTie",className:"recap-edge",focusable:!1,style:{"--session-hue":J}})}}const T=uM(e),R=`${y}#lanes:${vH(T)}`,I=new Set(S.filter(P=>P.type==="recapNote").map(P=>P.id));for(const P of Array.from(h.keys()))P5(P)&&!I.has(P)&&!a.has(P)&&(h.delete(P),m.delete(P));const F=S.filter(P=>MB(P.id,a,h,m));if(F.length>0||R!==w.current){if(F.length>0){const P=jH(_H(S,E,{direction:"LR",pinned:a,measured:i,availableWidth:n,availableHeight:s,lanes:T}),a,H=>kd(H,h,m)?void 0:h.get(H));for(const H of P)kd(H.id,h,m)&&O_(H.id,H.position,h,m);SH(S,h,a,i,new Set(F.filter(H=>H.type!=="recapNote").map(H=>H.id)),T,{width:n,height:s});for(const H of F){if(H.type!=="recapNote")continue;const L=(Q=H.data)==null?void 0:Q.parentId;if(!L)continue;const U=a.get(L)??(kd(L,h,m)?void 0:h.get(L));if(!U)continue;const $=((M=i.get(H.id))==null?void 0:M.width)??c7,V=((K=i.get(H.id))==null?void 0:K.height)??cT,he=((G=i.get(L))==null?void 0:G.height)??cT;O_(H.id,{x:U.x-u7-$,y:U.y+(he-V)/2},h,m)}}NH(S,h,a,i,T),w.current=R}const W=EH(S,h,a,i,c,!f||p,T);W.length>0&&u(W);const O=TB(e.agents.values());id(h,O),id(m,O),id(a,O),id(i,CB(e.agents.values()));const B=[];let Z=!1;for(const P of S){let H=a.get(P.id)??h.get(P.id);H||(H=IB(P.id,h,m),Z=!0),B.push({...P,position:H})}return Z&&(w.current=""),{nodes:B,edges:E}}function D7(){return l.jsx(Dx,{children:l.jsx(B7,{})})}const q7=e=>e.transform[2]>=e.maxZoom,F7=e=>e.transform[2]<=e.minZoom;function B7(){var bl,xt,Xo,Ba;const e=Sc(),t=gt(q7),n=gt(F7),s=Wt(),a=x.useState(rx)[0],i=x.useRef(a),[,c]=x.useState(0),u=x.useCallback(()=>c(D=>D+1),[]),[f,p]=x.useState(k7);x.useEffect(()=>{_7(f)},[f]);const[h,m]=x.useState(()=>new Set),[y,w]=x.useState(null),[N,_]=x.useState(null),j=x.useCallback((D,q)=>{m(ae=>{if(!q)return new Set([D]);const oe=new Set(ae);return oe.has(D)?oe.delete(D):oe.add(D),oe}),w(ae=>q&&ae===D?ae:D),q||p(!0)},[]),k=x.useCallback(()=>{m(new Set),w(null)},[]),[S,E]=x.useState(null),[C,T]=x.useState(null),R=x.useCallback(D=>T(D),[]),[I,F]=x.useState(!1),[W,O]=x.useState(!1),[B,Z]=x.useState(!1),Q=x.useRef(null),[M,K]=x.useState(x7);x.useEffect(()=>{b7(M)},[M]);const[G,P]=x.useState(N7);x.useEffect(()=>{S7(G)},[G]);const[H,L]=x.useState(j7);x.useEffect(()=>{E7(H)},[H]);const U=x.useRef(!1),[$,V]=x.useState(()=>{const D=(()=>{try{const q=window.localStorage.getItem(fT);return q===null?!0:q==="1"}catch{return!0}})();return D&&M?(U.current=!0,!1):D});x.useEffect(()=>{if(!(!$&&U.current))try{window.localStorage.setItem(fT,$?"1":"0")}catch{}},[$]),x.useEffect(()=>{!M&&U.current&&(U.current=!1,V(!0))},[M]);const he=up($,200),Y=up(G,130),J=up(H,130),[z,re]=x.useState(null);x.useEffect(()=>{let D=null;try{D=localStorage.getItem("agent-dag.sound")}catch{}re(D===null?!0:D==="on")},[]);const le=x.useCallback(()=>{re(D=>{var ae;const q=D!==!0;try{localStorage.setItem("agent-dag.sound",q?"on":"off")}catch{}return q&&((ae=Ce.current)==null||ae.unlock()),q})},[]),me=x.useCallback(D=>{le()},[le]),ge=x.useRef(me);ge.current=me;const Me=x.useRef(z);Me.current=z;const[qe,Ve]=x.useState(()=>G8(yo)),Ue=x.useRef(qe);Ue.current=qe;const Se=x.useRef(null),Qe=x.useCallback((D,q=!1)=>{var ae,oe;if((ae=Ce.current)==null||ae.unlock(),Se.current!==null&&clearTimeout(Se.current),Se.current=null,!q){(oe=Ce.current)==null||oe.play(D,!0);return}Se.current=setTimeout(()=>{var Ee;Se.current=null,(Ee=Ce.current)==null||Ee.play(D,!0)},B8)},[]),Ne=x.useCallback((D,q)=>{Ve(ae=>{const oe={level:wc(q.level??ae[D].level),figure:BA(D,q.figure??ae[D].figure)};try{localStorage.setItem(zA[D],String(oe.level)),localStorage.setItem(UA[D],oe.figure)}catch{}return{...ae,[D]:oe}}),Qe(D,!0)},[Qe]);x.useEffect(()=>()=>{Se.current!==null&&clearTimeout(Se.current)},[]);const[_e,ue]=x.useState(!1),je=x.useRef(null),Ce=x.useRef(null),[Fe,We]=x.useState("locked");x.useEffect(()=>{const D=Y8({enabled:()=>Me.current===!0,prefs:()=>Ue.current,onState:We});Ce.current=D,We(D.state());const q=()=>D.unlock();return window.addEventListener("pointerdown",q,{once:!0,capture:!0}),window.addEventListener("keydown",q,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",q,{capture:!0}),window.removeEventListener("keydown",q,{capture:!0})}},[]);const[He,ot]=x.useState(!1),[wt,ut]=x.useState(!1),[ee,ke]=x.useState(null),[Be,et]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(qv)??""}catch{return""}}),[ht,Je]=x.useState(!1),tt=x.useRef(0),[it,bt]=x.useState(!1),nt=x.useCallback((D=!1)=>(D&&(tt.current=Date.now(),bt(!0)),fetch(D?"/api/version?refresh=1":"/api/version").then(q=>q.ok?q.json():null).then(q=>{q&&ke(q)}).catch(()=>{}).finally(()=>{D&&bt(!1)})),[]),pt=x.useCallback(()=>{nt(Date.now()-tt.current>=v7)},[nt]);x.useEffect(()=>{nt();const D=window.setInterval(pt,5*6e4),q=()=>{document.visibilityState==="visible"&&pt()};return document.addEventListener("visibilitychange",q),()=>{window.clearInterval(D),document.removeEventListener("visibilitychange",q)}},[nt,pt]),x.useEffect(()=>{He&&nt()},[He,nt]),x.useEffect(()=>{const D=rB();let q=null;const ae=Ge=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:D,looking:Ge}),keepalive:!0}).catch(()=>{})},oe=()=>{const Ge=tB(document);nB(q,Ge)&&ae(Ge),q=Ge},Ee=()=>{q&&ae(!1),q=!1};oe();const ve=window.setInterval(oe,eB);return window.addEventListener("focus",oe),window.addEventListener("blur",oe),document.addEventListener("visibilitychange",oe),window.addEventListener("pagehide",Ee),()=>{window.clearInterval(ve),window.removeEventListener("focus",oe),window.removeEventListener("blur",oe),document.removeEventListener("visibilitychange",oe),window.removeEventListener("pagehide",Ee),Ee()}},[]);const fe=(ee==null?void 0:ee.notice)??null,[lt,vt]=x.useState(null),Gt=x.useRef(!1);x.useEffect(()=>{if(Gt.current)return;const D=$_(),q=hB(D),ae=wB({stored:q,running:(ee==null?void 0:ee.running)??null,notes:I_,remembers:fB(D)});if(ae.reason==="no-version")return;Gt.current=!0,ae.record&&pB(D,ae.record);const oe=yB({tourSeen:mB(D),decision:ae}),Ee=ae.show.length?{entries:ae.show,since:q,firstRun:!1}:null;oe.tour&&Z(!0),oe.notes==="now"?vt(Ee):oe.notes==="after"&&(Q.current=Ee)},[ee==null?void 0:ee.running]);const Dt=(ee==null?void 0:ee.running)??"3.23.0",Gn=x.useMemo(()=>WA(I_,null,Dt),[Dt]),It=x.useCallback(()=>{vt({entries:Gn,since:null,firstRun:!1})},[Gn]),[Vn,Yn]=x.useState(null),[qt,Kn]=x.useState(vx);x.useEffect(()=>{let D=!1;return fetch("/api/health").then(q=>q.ok?q.json():null).then(q=>{D||(Kn(VH(q)),!(!q||typeof q.workspace!="string")&&Yn(q.workspace))}).catch(()=>{}),()=>{D=!0}},[He]);const te=x.useRef(qt);te.current=qt;const Ae=fe?`${fe.kind}:${fe.to}`:"",Oe=fe!=null&&Be!==Ae,Re=x.useCallback(()=>{et("");try{window.localStorage.setItem(qv,"")}catch{}},[]),Le=x.useCallback(()=>{if(fe){et(Ae);try{window.localStorage.setItem(qv,Ae)}catch{}}},[fe,Ae]),[ct,Ct]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(pT)??""}catch{return""}}),yt=ee!=null&&ee.invokedAs&&ee.invokedAs!==Zt?ee.invokedAs:null,Zr=yt!=null&&ct!==yt,kt=x.useCallback(()=>{if(yt){Ct(yt);try{window.localStorage.setItem(pT,yt)}catch{}}},[yt]),Jt=((bl=ee==null?void 0:ee.upgrade)==null?void 0:bl.state)??"idle",rn=x8(ee==null?void 0:ee.upgrade),$r=x.useRef(!1),ko=x.useCallback(async()=>{if(ys($r.current||Jt==="running")){$r.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await nt(),$r.current=!1}},[Jt,nt]);x.useEffect(()=>{if(Jt!=="running")return;const D=window.setInterval(nt,3e3);return()=>window.clearInterval(D)},[Jt,nt]);const Ki=x.useCallback(async()=>{const D=ee==null?void 0:ee.command;!D||!await Vx(D)||(Je(!0),window.setTimeout(()=>Je(!1),1600))},[ee==null?void 0:ee.command]),ua=x.useCallback(()=>{K(D=>(D||V(q=>(q&&(U.current=!0),!1)),!D))},[]),da=x.useCallback(()=>{U.current=!1,V(D=>(D||K(!1),!D))},[]),[ha,_s]=x.useState(!1),[fa,pa]=x.useState(!1),[St,Xi]=x.useState(()=>{try{return Number(localStorage.getItem(P_))||0}catch{return 0}}),[Ns,_o]=x.useState([]),[Or,ma]=x.useState(!1);x.useEffect(()=>{let D=!0;const q=()=>{fetch("/api/browser-watch?live=0").then(oe=>oe.ok?oe.json():null).then(oe=>{var Ee;!D||!(oe!=null&&oe.ok)||(_o(oe.episodes??[]),ma(((Ee=oe.settings)==null?void 0:Ee.enabled)===!0))}).catch(()=>{})};q();const ae=setInterval(q,5*6e4);return()=>{D=!1,clearInterval(ae)}},[]);const[No,dr]=x.useState([]),vn=x.useRef(new Set),[Pr,jn]=x.useState(null);x.useEffect(()=>{let D=!0,q=0;const ae=()=>{fetch("/api/lan").then(oe=>oe.ok?oe.json():null).then(oe=>D?(oe!=null&&oe.ok&&dr(__(Array.isArray(oe.pending)?oe.pending:[],oe.aliases)),oe):null).catch(()=>null).then(oe=>{D&&(q=window.setTimeout(ae,(oe==null?void 0:oe.enabled)===!0?fx:DA))})};return ae(),()=>{D=!1,window.clearTimeout(q)}},[]);const Oc=x.useCallback(async(D,q)=>{if(!Pr){jn(D);try{const oe=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:D,fp:q})})).json().catch(()=>null);oe&&Array.isArray(oe.pending)?dr(__(oe.pending,oe.aliases)):dr(Ee=>Ee.filter(ve=>ve.fp!==q))}catch{}finally{jn(null)}}},[Pr]),ga=x.useMemo(()=>ZB(Ns,St).length,[Ns,St]),[Sh,ya]=x.useState(0),wa=x.useRef(null),[va,xa]=x.useState(!1),ba=x.useRef(null),[jh,So]=x.useState(0),En=x.useState(()=>DB({protect:D=>CL(i.current,D)}))[0],[Ss,ka]=x.useState(!1),Zi=x.useCallback(()=>{const D=En.paused&&En.dropped>0,q=En.setPaused(!En.paused);D&&TL(i.current);for(const ae of q)i.current=g1(i.current,ae);ka(En.paused)},[En]),[Ft,mt]=x.useState(Date.now()),[hr,_a]=x.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(dd)!=="0"}catch{return!0}}),jo=x.useRef(!1),Pc=x.useCallback(()=>{const D=!hr;jo.current=!0;try{window.localStorage.removeItem(dd)}catch{}_a(D),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:D})}).then(q=>q.ok?q.json():null).then(q=>{var ae;q!=null&&q.ok&&_a(((ae=q.prefs)==null?void 0:ae.autoUpdate)!==!1)}).catch(()=>{})},[hr]),[fr,Na]=x.useState(!1),[Qi,Eo]=x.useState("restart"),[pr,mr]=x.useState(null),xn=x.useRef(!1),js=x.useRef(null),Es=x.useRef(0),Pn=x.useCallback(async D=>{if(!ys(xn.current))return;const q=(D==null?void 0:D.upgrade)===!0;xn.current=!0,js.current=rn;const ae=++Es.current;Eo(q?"npx":"restart"),Na(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(fe==null?void 0:fe.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:q})})}catch{}window.setTimeout(()=>{if(Es.current===ae&&xn.current){xn.current=!1,Na(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},q?18e4:3e4)},[fe==null?void 0:fe.to,rn]),Ji=x.useRef(null);x.useEffect(()=>{const D=E_(i.current.agents.values())>0,q=S8({enabled:hr,kind:fe==null?void 0:fe.kind,canRestart:(ee==null?void 0:ee.canRestart)===!0,noticeOpen:Oe,visible:document.visibilityState==="visible",busy:D,idleSince:Ji.current,now:Ft});Ji.current=q.idleSince,q.restart&&Pn()},[hr,fe==null?void 0:fe.kind,ee==null?void 0:ee.canRestart,Oe,Ft,Pn]);const el=E_(i.current.agents.values()),Cs=N8(el),Lc=FA({enabled:hr,kind:fe==null?void 0:fe.kind,canRestart:(ee==null?void 0:ee.canRestart)===!0,noticeOpen:Oe,visible:document.visibilityState==="visible",busy:el>0,idleSince:Ji.current,now:Ft});x.useEffect(()=>{const D=ee==null?void 0:ee.running;let q=null,ae=null;try{q=window.sessionStorage.getItem("agent-dag.restartPending"),ae=window.sessionStorage.getItem(mT)}catch{return}const oe=v8({bundle:"3.23.0",running:D,pending:q,lastTried:ae});if(oe==="reload"){try{window.sessionStorage.setItem(mT,D??"")}catch{return}window.location.reload();return}if(oe!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}xn.current=!1,Na(!1),mr(D??null);const Ee=window.setTimeout(()=>mr(null),6e3);return()=>window.clearTimeout(Ee)},[ee==null?void 0:ee.running]),x.useEffect(()=>{if(fr&&b8({asked:js.current,reported:rn})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}xn.current=!1,Na(!1)}},[fr,rn]);const tl=x.useState(()=>OH(C7()))[0],Bt=x.useRef(tl.pinned),Sa=x.useRef(null),Co=x.useState(()=>R7())[0],[Qr,ja]=x.useState(()=>new Set),[Ln,Ea]=x.useState(BB),[Ts,Eh]=x.useState(()=>sT(lT)),To=x.useMemo(()=>IH(Ts),[Ts]),Ao=x.useCallback(D=>MH(D,To),[To]),[Ro,Dc]=x.useState(!1);x.useEffect(()=>{document.documentElement.dataset.theme=Ln;try{window.localStorage.setItem(YA,Ln)}catch{}Eh(D=>{const q=sT(lT);return $H(D,q)?D:q})},[Ln]);const hn=x.useCallback((D,q)=>{if(_d({durationMs:q,documentHidden:document.hidden})){e.setViewport(D,{duration:q});return}const{d3Zoom:ae,d3Selection:oe}=s.getState(),Ee=oe==null?void 0:oe.property("__zoom");if(ae&&oe&&Ee&&Ee.k>0&&D.zoom>0){ae.transform(oe,Ee.scale(D.zoom/Ee.k).translate((D.x-Ee.x)/D.zoom,(D.y-Ee.y)/D.zoom));return}e.setViewport(D,{duration:0})},[e,s]),Jr=x.useRef(null);x.useEffect(()=>{if(!Co)return;const D=window.setTimeout(()=>{try{hn(Co,0)}catch{}Xn.current=Date.now()},60);return()=>window.clearTimeout(D)},[hn,Co]);const Ca=x.useRef(!0),[As,Ta]=x.useState(null);x.useEffect(()=>{const D=new EventSource("/events"),q=PB(u,{now:()=>Date.now(),setTimeout:(ve,Ge)=>window.setTimeout(ve,Ge),clearTimeout:ve=>window.clearTimeout(ve)});let ae=!1;const oe=typeof BroadcastChannel=="function"?HB(new BroadcastChannel(UB),Math.random().toString(36).slice(2),()=>ae):null,Ee=window.setInterval(()=>{ae||!oe||oe.ask(600).then(ve=>{ae||ut(WB(ve))})},3e3);return D.addEventListener("open",()=>{ot(!0),Dc(!0)}),D.addEventListener("error",()=>{ot(!1),Ta(null)}),D.addEventListener("open",()=>{ae=!0,ut(!1)}),D.addEventListener("error",()=>{ae=!1}),D.addEventListener("replay-end",()=>{Ca.current=!1,q.flush(),Ta(Date.now())}),D.addEventListener("hook",ve=>{var Ge;try{const rt=JSON.parse(ve.data);if(!En.accept(rt))return;i.current=g1(i.current,rt);const _t=rt.replay===!0||Ca.current||Date.now()-rt.receivedAt>3e4;_t?q.replay():q.live();const Ze=V8(rt,_t);Ze&&((Ge=Ce.current)==null||Ge.play(Ze))}catch{}}),()=>{D.close(),q.cancel(),window.clearInterval(Ee),oe==null||oe.leave()}},[u]),x.useEffect(()=>{const D=setInterval(()=>{const q=Date.now();mt(q);let ae=AL(i.current,q,m1);RL(i.current,q,m1)&&(ae=!0);const oe=[],Ee=ve=>{oe.push(ve)};jL(i.current,q,m7,g7,Ee)&&(ae=!0),EL(i.current,q,y7,w7,Ee)&&(ae=!0),oe.length>0&&fetch("/api/forget",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:oe})}).catch(()=>{}),m(ve=>EB(ve,i.current.agents)),w(ve=>ve!=null&&!i.current.agents.has(ve)?null:ve),T(ve=>ve!=null&&!i.current.agents.has(ve)?null:ve),E(ve=>ve!=null&&!i.current.agents.has(ve)?null:ve),ae&&u()},250);return()=>clearInterval(D)},[u]);const Rs=x.useRef(null),Xn=x.useRef(0),bn=420,Vt=x.useCallback((D=500)=>{const q=Lv,ae=1,oe=.2,Ee=Dv;try{const ve=document.querySelector(".canvas-wrap"),Ge=Array.from(document.querySelectorAll(".react-flow__node")).filter(Ot=>Ot.offsetWidth>0);if(!ve||Ge.length===0)return;const rt=ve.getBoundingClientRect(),_t=e.getViewport();if(!Number.isFinite(_t.zoom)||_t.zoom<=0)return;const Ze=Ot=>(Ot-rt.left-_t.x)/_t.zoom,an=Ot=>(Ot-rt.top-_t.y)/_t.zoom,os=Ge.map(Ot=>Ot.getBoundingClientRect()),Zo=Math.min(...os.map(Ot=>Ze(Ot.left))),kl=Math.max(...os.map(Ot=>Ze(Ot.right))),Qo=Math.min(...os.map(Ot=>an(Ot.top))),_l=Math.max(...os.map(Ot=>an(Ot.bottom))),nu=kl-Zo,Jo=_l-Qo;if(!(nu>0&&Jo>0))return;const za=Math.max(oe,Math.min(ae,(rt.width-dT(ve)-q*2)/(nu+bn)*Ee,(rt.height-q*2)/Jo*Ee)),Ua={x:q-Zo*za,y:Math.max(q,(rt.height-Jo*za)/2)-Qo*za,zoom:za};hn(Ua,D),Xn.current=Date.now(),Jr.current=_d({durationMs:D,documentHidden:document.hidden})?{target:Ua,until:Date.now()+D+60}:null,window.setTimeout(()=>{var Ot;try{((Ot=Jr.current)==null?void 0:Ot.target)===Ua&&(Jr.current=null);const vr=e.getViewport();(Math.abs(vr.zoom-za)>.01||Math.abs(vr.x-Ua.x)>2)&&hn(Ua,0)}catch{}},D+60)}catch{}},[e,hn]);x.useEffect(()=>{const D=()=>{if(!document.hidden)return;const q=Jr.current;if(Jr.current=null,!(!q||Date.now()>q.until)){try{hn(q.target,0)}catch{}Xn.current=Date.now()}};return document.addEventListener("visibilitychange",D),()=>document.removeEventListener("visibilitychange",D)},[hn]);const Aa=x.useRef(""),es=x.useRef(null),qc=x.useRef(0),Ms=x.useCallback(()=>{qc.current=Date.now()},[]),Ra=x.useRef(null),Is=x.useRef(0),$s=x.useCallback(()=>{Is.current=Date.now()},[]),nl=x.useCallback(D=>({hasSourceEvent:!!D,at:Date.now(),lastDeckFitAt:Xn.current,lastCanvasInputAt:Is.current}),[]),Ch="agent-dag.autoFitDisabled",ts=x.useRef(!1),[rl,Mo]=x.useState(!1);x.useEffect(()=>{try{window.localStorage.removeItem(Ch)}catch{}},[]);const sl=x.useCallback(()=>{ts.current||(ts.current=!0,Mo(!0))},[]),Fc=x.useCallback(()=>{ts.current=!1,Mo(!1),Vt(400)},[e,Vt]);x.useEffect(()=>{const D=setInterval(()=>{if(ts.current||Date.now()-qc.current<800)return;const q=i.current,ae=Date.now(),oe=[];for(const ve of q.agents.values())wx(ve,ae)&&oe.push({id:ve.id});if(oe.length===0)return;const Ee=[];for(const{id:ve}of oe){const Ge=ns.current.get(ve),rt=Bt.current.get(ve)??sn.current.get(ve);!Ge||!rt||Ee.push({x:rt.x,y:rt.y,width:Ge.width,height:Ge.height})}BH({pane:Ra.current,viewport:e.getViewport(),boxes:Ee})&&Vt(600)},1500);return()=>clearInterval(D)},[e]);const al=x.useRef(!1),ns=x.useRef(new Map),Bc=x.useRef(0),zc=x.useCallback(D=>{const q=ns.current;let ae=!1;for(const oe of D.nodeInternals.values()){const Ee=oe.width,ve=oe.height;if(Ee==null||ve==null)continue;const Ge=q.get(oe.id);Ge?(Math.abs(Ge.height-ve)>4||Math.abs(Ge.width-Ee)>4)&&(q.set(oe.id,{width:Ee,height:ve}),ae=!0):(q.set(oe.id,{width:Ee,height:ve}),ae=!0)}return ae&&(Bc.current+=1),Bc.current},[]),Uc=gt(zc),[Wc,Th]=x.useState(0);x.useEffect(()=>{let D=0;const q=()=>{const oe=ns.current;let Ee=!1;for(const ve of document.querySelectorAll(".react-flow__node[data-id]")){const Ge=ve.getAttribute("data-id");if(!Ge)continue;const rt=ve.offsetWidth,_t=ve.offsetHeight;if(!rt||!_t)continue;const Ze=oe.get(Ge);(!Ze||Math.abs(Ze.width-rt)>4||Math.abs(Ze.height-_t)>4)&&(oe.set(Ge,{width:rt,height:_t}),Ee=!0)}Ee&&Th(ve=>ve+1)};if(al.current)return;let ae=0;return document.visibilityState==="hidden"?ae=window.setTimeout(q,32):D=requestAnimationFrame(q),()=>{cancelAnimationFrame(D),window.clearTimeout(ae)}});const sn=x.useRef(tl.positions),Io=x.useRef(new Set),$o=x.useRef(""),Os=x.useMemo(()=>{const D=[];for(const q of i.current.agents.values())wx(q,Ft)&&D.push(q.id+(q.parentId?`>${q.parentId}`:""));return D.sort(),`${D.join("|")}#sv${Uc}.${Wc}`},[i.current,i.current.revision,Ft,Uc,Wc]),Ma=x.useRef(null);x.useEffect(()=>(Ma.current!=null&&window.clearTimeout(Ma.current),Ma.current=window.setTimeout(()=>{hd(sn.current,Bt.current)},1500),()=>{Ma.current!=null&&window.clearTimeout(Ma.current)}),[Os]),x.useEffect(()=>{if(Aa.current===Os)return;const D=Aa.current;if(Aa.current=Os,!D||ts.current)return;Date.now()-Xn.current>1200&&Vt(400),Rs.current&&window.clearTimeout(Rs.current),Rs.current=window.setTimeout(()=>{ts.current||Vt(500)},280)},[Os,e,Vt]);const Oo=x.useMemo(()=>RB(i.current,h),[i.current,i.current.revision,h]),ol=x.useMemo(()=>TH(i.current,Ft),[i.current,i.current.revision,Ft]),Po=x.useRef(null),[Ia,Hc]=x.useState({w:0,h:0});x.useEffect(()=>{const D=Po.current;if(!D||typeof ResizeObserver>"u")return;const q=new ResizeObserver(ae=>{var Ee;const oe=(Ee=ae[0])==null?void 0:Ee.contentRect;oe&&(Ra.current={width:oe.width,height:oe.height},Hc(ve=>Math.abs(ve.w-oe.width)>40||Math.abs(ve.h-oe.height)>40?{w:oe.width,h:oe.height}:ve))});return q.observe(D),Ra.current={width:D.clientWidth,height:D.clientHeight},Hc({w:D.clientWidth,h:D.clientHeight}),()=>q.disconnect()},[]);const Ah=x.useCallback(D=>{var ae,oe;const q=D.target;!(q!=null&&q.closest)||q.closest(h7)!==D.currentTarget||(D.preventDefault(),(oe=(ae=document.activeElement)==null?void 0:ae.blur)==null||oe.call(ae))},[]),Rh=x.useRef(new Map),[Lo,il]=x.useState(!1);x.useEffect(()=>{const D=window.setTimeout(()=>il(!0),2500);return()=>window.clearTimeout(D)},[]);const[$a,ll]=x.useState(!1),gr=x.useRef(null),[Ps,cl]=x.useState(!1),[Gc,Vc]=x.useState("full"),rs=x.useRef("full"),Mh=x.useCallback(()=>{gr.current&&(window.clearTimeout(gr.current),gr.current=null),ll(!1)},[]),Ih=x.useCallback(D=>{D.length!==0&&queueMicrotask(()=>{ll(!0),gr.current&&window.clearTimeout(gr.current),gr.current=window.setTimeout(()=>ll(!1),f7+80)})},[]);x.useEffect(()=>()=>{gr.current&&window.clearTimeout(gr.current)},[]);const fn=y?i.current.agents.get(y):null,Yc=f&&fn!=null,[Kc,Oa]=x.useState(0);x.useEffect(()=>{const D=dT(Po.current);Oa(q=>Math.abs(q-D)>40?D:q)},[J,Y,G,Yc,Ia.w]);const Lr=Ia.w>0?Math.max(0,(Ia.w-Kc-Lv*2)*Dv):0,Do=Ia.h>0?Math.max(0,(Ia.h-Lv*2)*Dv):0,qo=L5(),{nodes:yr,edges:ul}=x.useMemo(()=>L7(i.current,Ft,Lr,Do,Bt.current,ns.current,Rh.current,Ih,Lo,Ps,sn.current,Io.current,Os,$o,h,Oo,ol,R),[i.current,i.current.revision,Ft,Lr,Do,Lo,Ps,Os,h,Oo,ol,R,Sh,qo]),dl=x.useState(T7)[0],Fo=x.useRef(dl);x.useEffect(()=>{if(!Lo||Ps)return;const D={width:Lr,height:Do};if(!(D.width>0&&D.height>0))return;const q=Fo.current;if(Fo.current=D,A7(D),!q||q.width===D.width&&q.height===D.height)return;const ae={direction:"LR",pinned:Bt.current,measured:ns.current,lanes:uM(i.current)};if(kH(yr,ul,ae,q,D)){for(const oe of Array.from(sn.current.keys()))Bt.current.has(oe)||sn.current.delete(oe);Io.current.clear(),$o.current="",u(),window.setTimeout(()=>{hd(sn.current,Bt.current),!ts.current&&Vt(500)},80)}},[Lr,Do,Lo,Ps,u,Vt]);const hl=x.useMemo(()=>{const D=new Map;for(const ae of yr){const oe=ae.data;if(!(oe!=null&&oe.sessionId)||oe.exitAt!=null)continue;const Ee=ae.width,ve=ae.height;if(Ee==null||ve==null)continue;const Ge=ae.position.x,rt=ae.position.y,_t=Ge+Ee,Ze=rt+ve,an=D.get(oe.sessionId);an?(an.minX=Math.min(an.minX,Ge),an.minY=Math.min(an.minY,rt),an.maxX=Math.max(an.maxX,_t),an.maxY=Math.max(an.maxY,Ze)):D.set(oe.sessionId,{minX:Ge,minY:rt,maxX:_t,maxY:Ze})}const q=[];for(const[ae,oe]of D){const Ee=oe.maxX-oe.minX+ud*2,ve=oe.maxY-oe.minY+ud*2;q.push({id:`group:${ae}`,type:QR,position:{x:oe.minX-ud,y:oe.minY-ud},data:{sessionId:ae,w:Ee,h:ve},width:Ee,height:ve,style:{width:Ee,height:ve},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return q},[yr]),Xc=x.useMemo(()=>{const D=[...hl,...yr],q=ba.current;return!q||q.size===0?D:D.map(ae=>{const oe=q.get(ae.id);return oe?{...ae,position:oe}:ae})},[hl,yr,jh]),Pa=x.useMemo(()=>{const D=new Set;for(const q of i.current.agents.values())for(const ae of q.tools)D.add(cM(ae.name));return Object.keys(lM).filter(q=>D.has(q))},[i.current,i.current.revision]);x.useEffect(()=>{if(Pa.length<=1){xa(!1);return}let D=0;const q=()=>{const ae=wa.current;if(ae&&!document.hidden){const oe=ae.getBoundingClientRect(),Ee=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Ge=>Ge.getBoundingClientRect()),ve=RH(oe,Ee,8);xa(Ge=>Ge===ve?Ge:ve)}D=window.setTimeout(q,300)};return q(),()=>window.clearTimeout(D)},[Pa.length]);const $h=x.useCallback(D=>{ja(q=>{const ae=new Set(q);return ae.has(D)?ae.delete(D):ae.add(D),ae})},[]),fl=N?xL(i.current.agents,N):null,Zc=x.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}i.current=rx(),Bt.current.clear(),ns.current.clear(),sn.current.clear(),$o.current="",gT(),k(),u()},[u,k]),Qc=x.useRef(I);Qc.current=I;const Jc=x.useRef(W);Jc.current=W;const kn=x.useRef(!1);kn.current=fl!=null||ha||C!=null||B||S!=null||fa||W||lt!=null;const Dr=x.useCallback(D=>{const q=j8(D,{confirmOpen:Qc.current,modalOpen:kn.current});q==="confirm"?F(!0):q==="clear"&&(F(!1),Zc())},[Zc]),Bo=x.useCallback(()=>{Bt.current.clear(),sn.current.clear(),$o.current="",gT(),u(),window.setTimeout(()=>Vt(500),80)},[u,e,Vt]),pl=x.useCallback(()=>Vt(500),[Vt]),La=x.useRef(yr);La.current=yr;const zo=x.useRef(y);zo.current=y;const Ls=x.useCallback(D=>{const q=La.current.filter(ve=>ve.type==="agent"),ae=kB(q.map(ve=>({id:ve.id,x:ve.position.x,y:ve.position.y})),zo.current,D),oe=ae?q.find(ve=>ve.id===ae):void 0;if(!oe)return;const Ee=uT(document.activeElement);j(oe.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:Ov(350),nodes:[oe]})}catch{}Xn.current=Date.now(),Ee&&d7(oe.id)},30)},[j,e]),ml=x.useRef(null),Ds=x.useCallback(D=>{j(D,!1),window.setTimeout(()=>{try{const q=La.current.find(ae=>ae.id===D);q&&e.fitView({padding:.3,duration:Ov(500),nodes:[q]}),Xn.current=Date.now()}catch{}},60)},[j,e]),ss=x.useRef(null);x.useEffect(()=>{let D=-1/0;const q=()=>{D=performance.now()},ae=oe=>{ss.current=performance.now()-D<250?oe.target:null};return window.addEventListener("pointerdown",q,!0),window.addEventListener("focusin",ae,!0),()=>{window.removeEventListener("pointerdown",q,!0),window.removeEventListener("focusin",ae,!0)}},[]),x.useEffect(()=>{const D=q=>{var rt,_t;const ae=q.target,oe={tagName:ae==null?void 0:ae.tagName,isContentEditable:ae==null?void 0:ae.isContentEditable,role:(rt=ae==null?void 0:ae.getAttribute)==null?void 0:rt.call(ae,"role"),type:ae==null?void 0:ae.type,pointerFocused:ae!=null&&ae===ss.current};if(q.key==="Escape"){const Ze=l5({overlayOpen:Ld.depth()>0,typing:Wx(oe)});Ze==="dismiss"?Ld.dismissTop():Ze==="blur"?ae==null||ae.blur():(jB(oe)&&(ae==null||ae.blur()),k());return}if(th(q))return;const Ee=uT(ae)?(_t=ae==null?void 0:ae.getAttribute)==null?void 0:_t.call(ae,"data-id"):null,ve=Ee&&La.current.some(Ze=>Ze.id===Ee)?Ee:null,Ge=NB(q,ve);if(Ge.kind==="activate"){q.preventDefault(),j(Ge.nodeId,Ge.additive);return}if(Ge.kind!=="node"&&!(Ge.nodeId==null&&y5(oe,q.key))&&!w5({key:q.key,modalOpen:kn.current,sheetOpen:Jc.current})){if(q.key===" "&&(q.preventDefault(),Zi()),(q.key==="c"||q.key==="C")&&Dr("shortcut"),(q.key==="r"||q.key==="R")&&Bo(),(q.key==="f"||q.key==="F")&&pl(),(q.key==="l"||q.key==="L")&&ua(),q.key==="d"||q.key==="D")if(zo.current)p(Ze=>!Ze);else{const Ze=ip(i.current.agents.values());Ze.length>0?Ds(Ze[0].id):Ls(1)}if((q.key==="h"||q.key==="H")&&_s(Ze=>!Ze),(q.key==="u"||q.key==="U")&&P(Ze=>!Ze),(q.key==="a"||q.key==="A")&&te.current.claude&&da(),(q.key==="j"||q.key==="J")&&Ls(1),(q.key==="k"||q.key==="K")&&Ls(-1),q.key==="w"||q.key==="W"){const Ze=QL(ip(i.current.agents.values()),ml.current);Ze&&(ml.current=Ze.id,Ds(Ze.id))}(q.key==="t"||q.key==="T")&&Ea(Ze=>Ze==="dark"?"light":"dark"),(q.key==="m"||q.key==="M")&&te.current.claude&&Me.current!==null&&ge.current(q.shiftKey),(q.key==="s"||q.key==="S")&&L(Ze=>!Ze),(q.key==="b"||q.key==="B")&&pa(Ze=>!Ze),(q.key==="v"||q.key==="V")&&te.current.claude&&Me.current!==null&&ue(Ze=>!Ze),q.key==="?"&&O(Ze=>!Ze)}};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[Dr,Bo,pl,k,j,Ls,Ds,Zi]);const Uo=i.current.agents.size,$t=x.useMemo(()=>ip(i.current.agents.values()),[i.current,i.current.revision]),Wo=x.useMemo(()=>JL(i.current.agents.values()),[i.current,i.current.revision]),gl=x.useRef(null);x.useEffect(()=>{const D=GB({waiting:$t.length,running:Wo,connected:He}),q=gl.current;if(gl.current=D,(q==null?void 0:q.title)!==D.title&&(document.title=D.title),(q==null?void 0:q.icon)!==D.icon){const ae=document.querySelector('link[rel="icon"]');ae&&(ae.href=VB[D.icon])}},[$t.length,Wo,He]);const[Ho,qs]=x.useState(""),Go=KB($t);x.useEffect(()=>{qs(D=>XB(D,Go))},[Go]);const[Da,Vo]=x.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[qr,Yo]=x.useState(null),[qa,Ko]=x.useState(!1),[eu,yl]=x.useState(!1);x.useEffect(()=>{let D=!0;return fetch("/api/prefs").then(q=>q.ok?q.json():null).then(q=>{var ae,oe,Ee;if(!(!D||!(q!=null&&q.ok))){if(!jo.current){let ve=!1;try{ve=window.localStorage.getItem(dd)==="0",window.localStorage.removeItem(dd)}catch{}ve&&((ae=q.prefs)==null?void 0:ae.autoUpdate)!==!1?(_a(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):_a(((oe=q.prefs)==null?void 0:oe.autoUpdate)!==!1)}Ko(((Ee=q.prefs)==null?void 0:Ee.notifications)===!0),yl(q.notificationsVetoed===!0)}}).catch(()=>{}),()=>{D=!1}},[]);const wr=x.useRef(()=>{}),wl=x.useCallback(()=>{const D=!qa;Ko(D),D&&typeof Notification<"u"&&Notification.permission==="default"&&wr.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:D})}).then(q=>q.ok?q.json():null).then(q=>{var ae;q!=null&&q.ok&&(Ko(((ae=q.prefs)==null?void 0:ae.notifications)===!0),yl(q.notificationsVetoed===!0))}).catch(()=>{})},[qa]),vl=typeof Notification<"u";x.useEffect(()=>{if(!qr)return;const q=setTimeout(()=>Yo(null),qr==="blocked"?8e3:4e3);return()=>clearTimeout(q)},[qr]);const tu=x.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(D=>{const q=D;Vo(q),q==="granted"?Yo("on"):q==="denied"&&Yo("blocked")})},[]);wr.current=tu;const Fa=x.useRef(new Set),as=x.useRef(null),Oh=$t.map(D=>eh(D.id,D.waiting)).join("|");x.useEffect(()=>{r5(as.current,Da)&&(as.current=Da,Fa.current=lp($t))},[Da]);const xl=x.useRef(!1);return x.useEffect(()=>{s5(xl.current,As)&&(xl.current=!0,Fa.current=lp($t))},[As]),x.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!a5(as.current,As))return;const D=typeof document>"u"||!document.hidden,q=t5($t,Fa.current,D,qa);for(const ae of q)try{const oe=new Notification(ae.title,{body:ae.body,tag:ae.key});oe.onclick=()=>{window.focus(),Ds(ae.sessionId),oe.close()}}catch{}Fa.current=D?lp($t):n5($t,q,Fa.current)},[Oh,As]),l.jsxs("div",{className:"app",children:[l.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),l.jsxs("header",{className:"topbar",children:[l.jsxs("div",{className:"readout",children:[l.jsxs("div",{className:"brand",children:[l.jsx("span",{className:"logo"}),l.jsx("h1",{children:Zt}),fe?l.jsxs("button",{type:"button",className:"v stale",onClick:()=>{It(),Re()},"aria-haspopup":"dialog","aria-label":HH({...fe,open:Oe}),title:fe.kind==="restart"?`Running v${fe.from}; v${fe.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${fe.from}; v${fe.to} is on npm · click for what's new`,children:["v",fe.from,l.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const D={running:Dt,latest:ee==null?void 0:ee.latest,latestPending:ee==null?void 0:ee.latestPending,checkedAgo:ee!=null&&ee.checkedAt?yd(Ft-ee.checkedAt):null,checkFailedAgo:ee!=null&&ee.checkFailedAt&&ee.checkFailedAt>(ee.checkedAt??0)?yd(Ft-ee.checkFailedAt):null,checkDisabled:ee==null?void 0:ee.checkDisabled,checking:it};return l.jsxs("button",{type:"button",className:it?"v checking":"v",onClick:()=>{It(),nt(!0)},"aria-busy":it||void 0,"aria-haspopup":"dialog","aria-label":WH(D),title:UH(D),children:["v",D.running]})})()]}),l.jsx("span",{className:"status",children:(()=>{const D=s7({connected:He,paused:Ss,held:En.size,dropped:En.dropped});return D.resting?null:l.jsx("span",{className:`pill ${D.tone}`,title:D.title,children:l.jsxs("span",{className:"pill-box",children:[l.jsx("span",{className:"pill-widest","aria-hidden":!0,children:D.widest}),l.jsx("span",{className:"pill-label",children:D.label})]})})})()}),l.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Ho}),$t.length>0&&l.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>{ml.current=$t[0].id,Ds($t[0].id)},title:`Blocked waiting for you — click, or press W, to go to the one that has been stuck longest:
290
+ ${$t.map(D=>` ${D.label}: ${qi(D.waiting)} (${yd(Ft-D.waiting.since)})`).join(`
291
+ `)}`,"aria-label":`${$t.length} session${$t.length===1?"":"s"} waiting for you`,children:[l.jsx("span",{className:"ap-pulse","aria-hidden":!0}),l.jsx("b",{children:$t.length})," ",l.jsx("span",{className:"ws-word",children:"waiting"})]}),qr&&l.jsx("span",{className:qr==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:qr==="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:qr==="on"?"notifications on":"notifications blocked"})]}),fn&&(()=>{const D=Hn(fn),q=Math.max(0,((fn.endedAt??Ft)-fn.startedAt)/1e3),ae=fn.state==="active"?zx(D.total,q):null,oe=h.size-1;return l.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${fn.label}`,onClick:()=>{try{const Ee=yr.find(ve=>ve.id===fn.id);Ee&&e.fitView({padding:.35,duration:Ov(500),nodes:[Ee]}),Xn.current=Date.now()}catch{}},children:[l.jsx("span",{className:`state-pill state-${fn.state}`,children:fn.state==="active"?"live":fn.state}),l.jsx("span",{className:"selected-label",children:fn.label}),D.total>0&&l.jsxs("span",{className:"selected-cost",children:[Nt(D.total),ae?l.jsxs("span",{className:"selected-rate",children:[" · ",ae]}):null]}),oe>0&&l.jsxs("span",{className:"selected-extra",children:["+",oe]}),l.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:Ee=>{Ee.stopPropagation(),k()},children:"×"})]})})(),l.jsxs("div",{className:"actions",children:[l.jsxs("div",{className:"action-run",children:[l.jsxs("button",{className:"btn icon-btn",onClick:ua,title:`${M?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":M,"aria-controls":M?"session-list":void 0,children:[l.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:[l.jsx("path",{d:"M5.4 3.6h6.6M5.4 7h6.6M5.4 10.4h6.6"}),l.jsx("path",{d:"M2.2 3.6h.2M2.2 7h.2M2.2 10.4h.2"})]}),l.jsx("span",{className:"tb-word",children:"Session list"})]}),l.jsxs("button",{className:"btn icon-btn",onClick:()=>P(D=>!D),title:`${G?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":G,"aria-controls":G?"usage-panel":void 0,children:[l.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:[l.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"}),l.jsx("path",{d:"M7 1.6v1.5M7 10.9v1.5"})]}),l.jsx("span",{className:"tb-word",children:"Usage"})]}),l.jsxs("button",{className:"btn icon-btn",onClick:()=>_s(D=>!D),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:[l.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:[l.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),l.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),l.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]}),l.jsx("span",{className:"tb-word",children:"History"})]})]}),l.jsxs("div",{className:"action-run",children:[qt.claude&&l.jsxs("button",{className:"btn icon-btn",onClick:da,title:`${$?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":$,"aria-controls":$?"accounts-panel":void 0,children:[l.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:[l.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),l.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]}),l.jsx("span",{className:"tb-word",children:"Accounts"})]}),l.jsxs("button",{className:"btn icon-btn",onClick:()=>L(D=>!D),title:`${H?"Hide":"Show"} this machine — cores, memory, temperature (S)`,"aria-label":"Toggle machine detail","aria-expanded":H,"aria-controls":H?"system-panel":void 0,children:[l.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:[l.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),l.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"})]}),l.jsx("span",{className:"tb-word",children:"Machine"})]}),l.jsxs("button",{className:"btn icon-btn bw-btn",onClick:()=>pa(D=>!D),title:Or?"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, ${Or?"watching":"not watching"}`+(ga>0?`, ${ga} unread`:""),"aria-haspopup":"dialog",children:[l.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:[l.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"}),Or||ga>0?l.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):l.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),l.jsx("span",{className:"tb-word",children:"Browser watch"}),ga>0&&l.jsx("span",{className:"bw-badge","aria-hidden":!0,children:ga})]})]}),l.jsxs("div",{className:"action-run action-run-utility",children:[qt.claude&&z!==null&&l.jsxs("div",{className:"sound-slot",children:[l.jsxs("button",{ref:je,className:"btn icon-btn",onClick:()=>ue(D=>!D),...sa(!1),title:QH(qt,{on:z===!0,locked:Fe==="locked",prefs:qe}),"aria-label":`Sound settings, ${z?"on":"off"}`,"aria-haspopup":"dialog","aria-expanded":_e,"aria-controls":_e?"sound-menu":void 0,children:[l.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:[l.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),z?l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),l.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M10 5.6l2.6 2.8"}),l.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]}),l.jsx("span",{className:"tb-word",children:"Sound"})]}),_e&&l.jsx(J8,{onClose:()=>ue(!1),soundOn:z===!0,onToggleSound:le,prefs:qe,onLevel:(D,q)=>Ne(D,{level:q}),onFigure:(D,q)=>Ne(D,{figure:q}),onPreview:D=>Qe(D),notifyOn:qa,onToggleNotify:wl,notifyVetoed:eu,notifyPermission:vl?Da:"unsupported",onAskNotify:tu,openerRef:je})]}),l.jsx("button",{className:"btn icon-btn",onClick:()=>Ea(D=>D==="dark"?"light":"dark"),title:`Switch to ${Ln==="dark"?"light":"dark"} mode (T)`,"aria-label":`Switch to ${Ln==="dark"?"light":"dark"} mode`,children:Ln==="dark"?l.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:[l.jsx("circle",{cx:"7",cy:"7",r:"2.5"}),l.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"})]}):l.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:l.jsx("path",{d:"M11.8 8.4A5 5 0 1 1 5.6 2.2a4 4 0 0 0 6.2 6.2Z"})})})]})]})]}),pr?l.jsxs("div",{className:"ver-banner done",role:"status",children:[l.jsx("span",{className:"ver-dot"}),l.jsxs("strong",{children:["Restarted — now running v",pr,"."]}),l.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Ro&&!He?l.jsxs("div",{className:"conn-banner",role:"alert",children:[l.jsx("span",{className:"conn-dot"}),fr?Qi==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Zt}…`:(()=>{const D=n7({connected:He,paused:Ss});return l.jsxs(l.Fragment,{children:[`Lost connection to the ${Zt} server. Reconnecting…`,D&&l.jsx("span",{className:"conn-sub",children:D})]})})()]}):Oe&&fe?l.jsxs("div",{className:`ver-banner ${fe.kind}`,role:"status",children:[l.jsx("span",{className:`ver-dot${Lc==null?"":" armed"}`}),fe.kind==="restart"?l.jsxs(l.Fragment,{children:[l.jsxs("strong",{children:["v",fe.to," is installed — this deck still runs v",fe.from,"."]}),ee!=null&&ee.canRestart?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"ver-act",onClick:()=>Pn(),...sa(fr),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
292
+
293
+ Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.`,children:fr?"restarting…":Cs.label}),!fr&&l.jsx("span",{className:"ver-sub",children:Cs.clause}),l.jsxs("label",{className:"ver-auto",children:[l.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":hr,onClick:Pc,"aria-label":"Auto-restart when idle",title:hr?"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:l.jsx("span",{className:"switch-knob"})}),l.jsx("span",{"aria-hidden":!0,children:_8(hr,Lc)})]})]}):l.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."})]}):l.jsxs(l.Fragment,{children:[l.jsxs("strong",{children:[Zt," v",fe.to," is out — you are on v",fe.from,"."]}),(ee==null?void 0:ee.upgradeMode)==="install"&&Jt!=="failed"&&l.jsx("button",{type:"button",className:"ver-act",onClick:ko,...sa(Jt==="running",Jt==="done"),title:`Runs ${((xt=ee==null?void 0:ee.upgrade)==null?void 0:xt.command)??(ee==null?void 0:ee.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Jt==="running"?"installing…":Jt==="done"?"installed":"Update now"}),(ee==null?void 0:ee.upgradeMode)==="npx"&&(ee==null?void 0:ee.canRestart)&&l.jsx("button",{type:"button",className:"ver-act",onClick:()=>Pn({upgrade:!0}),...sa(fr),title:`Runs ${ee==null?void 0:ee.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:fr?"fetching…":Jt==="failed"?"Retry update":"Update & restart"}),Jt==="failed"?l.jsxs("span",{className:"ver-sub fail",title:((Xo=ee==null?void 0:ee.upgrade)==null?void 0:Xo.error)??"",children:[(ee==null?void 0:ee.upgradeMode)==="npx"?"update failed":"install failed",": ",((Ba=ee==null?void 0:ee.upgrade)==null?void 0:Ba.error)??"unknown error"," — run it yourself:"]}):(ee==null?void 0:ee.upgradeMode)==="npx"?l.jsx("span",{className:"ver-sub",children:ee!=null&&ee.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Fv.npx}):ee!=null&&ee.upgradeBlocked?l.jsx("span",{className:"ver-sub",children:Object.hasOwn(Fv,ee.upgradeBlocked)?Fv[ee.upgradeBlocked]:"cannot install from here"}):null,l.jsxs("button",{type:"button",className:"ver-cmd",onClick:Ki,title:"Copy to clipboard",children:[l.jsx("code",{children:ee==null?void 0:ee.command}),l.jsx("span",{className:"ver-cmd-hint",children:ht?"copied":"copy"})]})]}),l.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Le,children:"×"})]}):Zr&&yt?l.jsxs("div",{className:"ver-banner",role:"status",children:[l.jsx("span",{className:"ver-dot"}),l.jsxs("strong",{children:[yt," still works — the deck is called ",Zt," now."]}),ee!=null&&ee.renameFix?l.jsx("span",{className:"ver-sub",children:ee.renameFix}):null,l.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:kt,children:"×"})]}):null,cp(he)&&qt.claude&&l.jsx(g8,{leaving:he==="leaving",onClose:()=>V(!1)}),M&&l.jsx(uD,{state:i.current,now:Ft,selectedIds:h,onSelect:Ds,onClose:()=>K(!1)}),l.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${$a?" bubbling":""}${Ps?" dragging-any":""}`,"data-detail":Gc,ref:Po,onMouseDownCapture:Ah,onPointerDownCapture:$s,onPointerUpCapture:$s,onWheelCapture:$s,children:[Uo===0&&(!He&&wt?l.jsx(z7,{}):l.jsx(U7,{live:He,everConnected:Ro,providers:qt,workspace:Vn,onTour:()=>Z(!0)})),(Pa.length>1||Qr.size>0)&&l.jsx("div",{ref:wa,className:`cat-filter-bar${va?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Pa.map(D=>{const q=Qr.has(D);return l.jsxs("button",{type:"button",className:`cat-filter${q?" off":""}`,onClick:()=>$h(D),"aria-pressed":!q,title:`${q?"Show":"Hide"} ${Hd[D]} tools`,children:[l.jsx(O7,{cat:D}),l.jsx("span",{className:"cat-name",children:Hd[D]})]},D)})}),l.jsxs(P2,{nodes:Xc,edges:ul,nodeTypes:i7,edgesFocusable:!1,edgeTypes:l7,fitView:!Co,fitViewOptions:{padding:.25,duration:_d({durationMs:hT,documentHidden:document.hidden})?hT:0},minZoom:eM,maxZoom:tM,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:(D,q)=>{if(q.type==="sessionGroup"){k();return}if(q.type==="recapNote"){j(q.data.parentId,D.shiftKey);return}j(q.id,D.shiftKey)},onPaneClick:()=>k(),onMoveStart:D=>{aT(nl(D))&&sl()},onMove:(D,q)=>{var oe;Ms(),aT(nl(D))&&sl();const ae=p7(q.zoom);ae!==rs.current&&(rs.current=ae,Vc(ae)),(oe=Po.current)==null||oe.style.setProperty("--zoom",String(q.zoom)),es.current&&window.clearTimeout(es.current),es.current=window.setTimeout(()=>M7(q),250)},onNodeDragStart:(D,q)=>{var ae;if(Mh(),al.current=!0,ba.current=new Map,cl(!0),Ms(),sl(),q.type==="sessionGroup"){const oe=(ae=q.data)==null?void 0:ae.sessionId,Ee=new Map;if(oe)for(const ve of yr){const Ge=ve.data;(Ge==null?void 0:Ge.sessionId)===oe&&Ee.set(ve.id,{x:ve.position.x,y:ve.position.y})}Sa.current={start:{x:q.position.x,y:q.position.y},members:Ee};return}Bt.current.set(q.id,{x:q.position.x,y:q.position.y})},onNodeDrag:(D,q)=>{var ae;if(Ms(),q.type==="sessionGroup"){const oe=Sa.current;if(!oe)return;const Ee=q.position.x-oe.start.x,ve=q.position.y-oe.start.y;for(const[rt,_t]of oe.members){const Ze={x:_t.x+Ee,y:_t.y+ve};Bt.current.set(rt,Ze),sn.current.set(rt,Ze)}const Ge=ba.current;if(Ge){for(const[rt,_t]of oe.members)Ge.set(rt,{x:_t.x+Ee,y:_t.y+ve});Ge.set(q.id,{x:q.position.x,y:q.position.y})}So(rt=>rt+1);return}Bt.current.set(q.id,{x:q.position.x,y:q.position.y}),sn.current.set(q.id,{x:q.position.x,y:q.position.y}),(ae=ba.current)==null||ae.set(q.id,{x:q.position.x,y:q.position.y}),So(oe=>oe+1)},onNodeDragStop:(D,q)=>{if(Ms(),al.current=!1,ba.current=null,cl(!1),ya(ae=>ae+1),q.type==="sessionGroup"){const ae=Sa.current;if(ae){const oe=q.position.x-ae.start.x,Ee=q.position.y-ae.start.y;for(const[ve,Ge]of ae.members){const rt={x:Ge.x+oe,y:Ge.y+Ee};Bt.current.set(ve,rt),sn.current.set(ve,rt)}}Sa.current=null,hd(sn.current,Bt.current),ya(oe=>oe+1);return}Bt.current.set(q.id,{x:q.position.x,y:q.position.y}),sn.current.set(q.id,{x:q.position.x,y:q.position.y}),hd(sn.current,Bt.current)},children:[l.jsx(sL,{gap:28,size:1,color:Ts["--grid-line"]}),l.jsx(m6,{onFit:()=>{Xn.current=Date.now()}}),l.jsx(eD,{agents:i.current.agents,visibleAgentIds:ol,positions:sn.current,pinned:Bt.current,measured:ns.current,spotlight:Oo,hiddenCategories:Qr,now:Ft,onOpenTool:_}),rl&&l.jsxs("div",{className:"autofit-chip",children:[l.jsx("span",{className:"autofit-state",title:"New sessions are not brought into view while you are moving it yourself",children:"Auto-fit off"}),l.jsx("button",{type:"button",className:"autofit-resume",onClick:Fc,title:"Bring new sessions into view again","aria-label":"Resume auto-fit",children:"Resume"})]}),l.jsxs(QP,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[l.jsx(sr,{onClick:()=>e.zoomIn(),title:"Zoom in","aria-label":"Zoom in",disabled:t,children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:l.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),l.jsx(sr,{onClick:()=>e.zoomOut(),title:"Zoom out","aria-label":"Zoom out",disabled:n,children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:l.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),l.jsx(sr,{onClick:Fc,title:rl?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view","data-nudge":rl?"":void 0,children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),l.jsx(sr,{"data-group-start":"",onClick:Zi,title:t7({paused:Ss,held:En.size,dropped:En.dropped}),"aria-label":e7,"aria-pressed":Ss,children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:l.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),l.jsx(sr,{onClick:Bo,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),l.jsx(sr,{"data-group-start":"","data-danger":"",onClick:()=>Dr("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),l.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"}),l.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"}),l.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),l.jsx(sr,{"data-group-start":"",onClick:()=>O(D=>!D),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.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"}),l.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),l.jsx(HP,{zoomable:!0,pannable:!0,nodeColor:Ao,nodeStrokeWidth:2,maskColor:Ts["--minimap-mask"],maskStrokeColor:Ts["--line"]})]})]}),cp(Y)&&l.jsx(zD,{state:i.current,now:Ft,providers:qt,liveSince:As,leaving:Y==="leaving",onClose:()=>P(!1)}),cp(J)&&l.jsx(wq,{usageOpen:G,leaving:J==="leaving",onClose:()=>L(!1)}),f&&fn?l.jsxs("aside",{className:"detail","aria-label":"Detail",children:[l.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>p(!1),children:"×"}),l.jsx(H7,{agent:fn,now:Ft,onOpenTool:_,onShowSummary:E,onExportSession:D=>I7(i.current,D)})]}):null,fl&&l.jsx(s6,{tool:fl,onClose:()=>_(null)}),ha&&l.jsx(x.Suspense,{fallback:null,children:l.jsx(a7,{providers:qt,onClose:()=>_s(!1)})}),fa&&l.jsx(x.Suspense,{fallback:null,children:l.jsx(o7,{onClose:()=>pa(!1),onSeen:D=>{Xi(D);try{localStorage.setItem(P_,String(D))}catch{}},onWatching:ma,palette:Ts})}),C&&(()=>{const D=i.current.agents.get(C);return D?l.jsx(N5,{agent:D,onClose:()=>T(null)}):null})(),S&&l.jsx(iD,{state:i.current,sessionId:S,onClose:()=>E(null)}),lt&&l.jsx(xB,{entries:lt.entries,since:lt.since,firstRun:lt.firstRun,running:Dt,onClose:()=>vt(null),onTour:()=>{vt(null),Z(!0)}}),(()=>{const{request:D,waiting:q}=QB(No,vn.current);return D?l.jsx(JB,{request:D,waiting:q,busy:Pr,now:Date.now(),onAccept:()=>void Oc("accept",D.fp),onDecline:()=>void Oc("dismiss",D.fp),onLater:()=>{Pr||(vn.current.add(D.fp),dr(ae=>[...ae]))}}):null})(),W&&l.jsx(I8,{onClose:()=>O(!1),onTour:()=>{O(!1),Z(!0)}}),B&&l.jsx(OA,{title:"What the deck shows you",steps:NF,onClose:()=>{Z(!1),gB($_());const D=Q.current;Q.current=null,D&&vt(D)}}),I&&l.jsx(A8,{agentCount:Uo,onConfirm:()=>Dr("confirmation"),onCancel:()=>F(!1)})]})}function z7(){return l.jsxs("div",{className:"empty-hero",children:[l.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[l.jsx("div",{className:"core"}),l.jsxs("div",{className:"orbit r1",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r2",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r3",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]})]}),l.jsxs("h2",{children:["Too many ",Zt," tabs are open"]}),l.jsxs("p",{children:["This browser keeps at most six live connections to one address, and other ",l.jsx("code",{children:Zt})," tabs are holding them. Close one and this tab connects on its own."]})]})}function U7({live:e,everConnected:t,providers:n,workspace:s,onTour:a}){const i=!e;return l.jsxs("div",{className:"empty-hero",children:[l.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[l.jsx("div",{className:"core"}),l.jsxs("div",{className:"orbit r1",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r2",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r3",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]})]}),i?l.jsxs(l.Fragment,{children:[l.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),l.jsxs("p",{children:[t?"This page lost its connection to ":"This page cannot reach ",l.jsx("code",{children:Zt}),". Check that it is still running in your terminal — the page picks up again on its own."]})]}):W7(n,s),!i&&l.jsx("button",{type:"button",className:"btn empty-tour",onClick:a,children:"Take the tour"})]})}function W7(e,t){const n=GH(t);return l.jsxs(l.Fragment,{children:[l.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?l.jsxs("p",{children:[n.lead," ",l.jsx("code",{children:n.workspace}),n.tail]}):l.jsxs("p",{children:["Run ",l.jsx("code",{children:"claude"})," or ",l.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."]}),ZH(e).map(s=>l.jsx("p",{className:"hint-row",children:s.spans.map((a,i)=>a.code?l.jsx("code",{children:a.text},i):l.jsx("span",{children:a.text},i))},s.provider))]})}function H7({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:a}){const i=`${e.synthetic?"≥ ":""}${Pd(e.startedAt,e.endedAt,t)}`,c=Hn(e),u=c.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const _=cM(N.name);p.set(_,(p.get(_)??0)+1)}const h=e.tools.filter(N=>N.ok===!1).length,m=e.tools.filter(N=>!N.endedAt).length,y=Array.from(p.entries()).sort((N,_)=>_[1]-N[1]),w=p.has("mcp")?K6(e.tools.map(N=>N.name)):null;return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:"detail-hero",children:[l.jsxs("div",{className:"hero-line",children:[l.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),l.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),l.jsxs("div",{className:"hero-meta",children:[l.jsx("span",{className:"hero-meta-item",children:e.kind==="root"?"session":"subagent"}),l.jsx("span",{className:"hero-sep",children:"·"}),l.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:i}),e.model&&(()=>{const N=J2(e);return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"hero-sep",children:"·"}),l.jsxs("span",{className:"model-chip","data-family":Jd(e.model),title:N.length>0?`${e.model}
294
+ spend on this panel also covers:
295
+ ${N.join(`
296
+ `)}`:e.model,children:[ho(e.model),N.length>0?` +${N.length}`:""]})]})})()]}),u&&l.jsxs("div",{className:"hero-cost",children:[l.jsxs("div",{className:"hero-cost-headline",children:[l.jsx("span",{className:"hero-cost-value",children:Nt(c.total)}),l.jsx("span",{className:"hero-cost-label",children:"spend"})]}),l.jsx(Kx,{cost:c})]}),l.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&l.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>s(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),a&&l.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>a(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),(()=>{const N=rh(e);if(!N)return null;const _=ox(N.at,t);return l.jsxs("section",{className:"detail-section",children:[l.jsxs("h3",{children:["Recap ",l.jsx("span",{className:"section-count",title:_.title,children:_.label})]}),l.jsx("p",{className:"detail-recap",children:N.text})]})})(),e.tools.length>0&&l.jsxs("section",{className:"detail-section",children:[l.jsx("h3",{children:"Activity"}),l.jsxs("div",{className:"activity-row",children:[l.jsxs("div",{className:"activity-counters",children:[l.jsxs("span",{className:"ac-item",children:[l.jsx("b",{children:e.toolCount})," calls"]}),m>0&&l.jsxs("span",{className:"ac-item ac-live",children:[l.jsx("b",{children:m})," live"]}),h>0&&l.jsxs("span",{className:"ac-item ac-err",children:[l.jsx("b",{children:h})," err"]})]}),l.jsx("div",{className:"cat-strip",children:y.map(([N,_])=>{const j=N==="mcp"?w:null,k=j==null?void 0:j.hue,S=`${_} ${Hd[N]} call${_===1?"":"s"}`;return l.jsxs("span",{className:`cat-chip cat-${N}${k!=null?" mcp-hue":""}`,style:k!=null?{"--mcp-hue":k}:void 0,title:j?`${S}, all to ${j.label}`:S,children:[l.jsx("span",{className:"cat-emoji","aria-hidden":!0,children:lM[N]}),l.jsx("span",{className:"cat-name",children:Hd[N]}),l.jsx("span",{className:"cat-count",children:_}),j&&l.jsx("span",{className:"cat-server",children:j.label})]},N)})})]})]}),f>0&&l.jsxs("section",{className:"detail-section",children:[l.jsx("h3",{children:"Tokens"}),l.jsxs("div",{className:"tokens-grid",children:[l.jsxs("div",{children:[l.jsx("span",{className:"k",children:"in"}),l.jsx("b",{title:e.usage.inputTokens.toLocaleString(),children:wn(e.usage.inputTokens)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"k",children:"out"}),l.jsx("b",{title:e.usage.outputTokens.toLocaleString(),children:wn(e.usage.outputTokens)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"k",children:"cache r"}),l.jsx("b",{title:e.usage.cacheReadTokens.toLocaleString(),children:wn(e.usage.cacheReadTokens)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"k",children:"cache c"}),l.jsx("b",{title:e.usage.cacheCreateTokens.toLocaleString(),children:wn(e.usage.cacheCreateTokens)})]})]})]}),l.jsxs("section",{className:"detail-section",children:[l.jsx("h3",{children:"Identity"}),l.jsxs("div",{children:[e.cwd&&l.jsxs("div",{className:"row",children:[l.jsx("span",{className:"k",children:"cwd"}),l.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),l.jsxs("div",{className:"row",children:[l.jsx("span",{className:"k",children:"session"}),l.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&l.jsxs("div",{className:"row",children:[l.jsx("span",{className:"k",children:"parent"}),l.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&l.jsxs("section",{className:"detail-section",children:[l.jsxs("h3",{children:["Prompts ",l.jsx("span",{className:"section-count",children:z2(e.prompts).length})]}),l.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((N,_)=>{const j=ox(N.at,t),k=qx(N.text);return k?l.jsxs("details",{className:"prompt-entry prompt-injected",children:[l.jsxs("summary",{children:[l.jsx("span",{className:"prompt-time",title:j.title,children:j.label}),l.jsx("span",{className:"prompt-injected-label",children:k.label})]}),k.detail&&l.jsx("div",{className:"prompt-injected-detail",children:k.detail})]},_):l.jsxs("div",{className:"prompt-entry",children:[l.jsx("div",{className:"prompt-time",title:j.title,children:j.label}),l.jsx("div",{className:"prompt-text",children:N.text})]},_)})})]}),l.jsxs("section",{className:"detail-section",children:[l.jsxs("h3",{children:["Tool calls ",l.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&l.jsx("div",{className:"empty",children:"No tool calls yet."}),l.jsx("div",{children:e.tools.slice().reverse().map(N=>l.jsx(V7,{t:N,onClick:()=>n(N.id)},N.id))})]})]})}const G7={inflight:"in-flight",done:"done",err:"error"};function V7({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=tA(e,"…");return l.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[l.jsxs("span",{className:"name",children:[l.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:G7[n]}),e.name]}),l.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{A5(window.localStorage)}catch{}const Y7=tI.createRoot(document.getElementById("root"));Y7.render(l.jsx(D7,{}));export{P_ as S,KH as a,X7 as b,mc as c,wn as d,K7 as e,Nt as f,ho as g,ys as h,Vx as i,l as j,ZB as k,J1 as p,x as r,sa as s,dn as u};