ccdeck 3.22.11 → 3.22.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
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 l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();var vu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vf={exports:{}},
|
|
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 l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();var vu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vf={exports:{}},gl={},xf={exports:{}},nt={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var $b;function rM(){if($b)return nt;$b=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"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function y(P){return P===null||typeof P!="object"?null:(P=m&&P[m]||P["@@iterator"],typeof P=="function"?P:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,_={};function S(P,V,he){this.props=P,this.context=V,this.refs=_,this.updater=he||v}S.prototype.isReactComponent={},S.prototype.setState=function(P,V){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,V,"setState")},S.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function k(){}k.prototype=S.prototype;function j(P,V,he){this.props=P,this.context=V,this.refs=_,this.updater=he||v}var E=j.prototype=new k;E.constructor=j,N(E,S.prototype),E.isPureReactComponent=!0;var C=Array.isArray,T=Object.prototype.hasOwnProperty,R={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function D(P,V,he){var U,W={},ee=null,H=null;if(V!=null)for(U in V.ref!==void 0&&(H=V.ref),V.key!==void 0&&(ee=""+V.key),V)T.call(V,U)&&!A.hasOwnProperty(U)&&(W[U]=V[U]);var ae=arguments.length-2;if(ae===1)W.children=he;else if(1<ae){for(var me=Array(ae),ge=0;ge<ae;ge++)me[ge]=arguments[ge+2];W.children=me}if(P&&P.defaultProps)for(U in ae=P.defaultProps,ae)W[U]===void 0&&(W[U]=ae[U]);return{$$typeof:e,type:P,key:ee,ref:H,props:W,_owner:R.current}}function O(P,V){return{$$typeof:e,type:P.type,key:V,ref:P.ref,props:P.props,_owner:P._owner}}function $(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function F(P){var V={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(he){return V[he]})}var Z=/\/+/g;function J(P,V){return typeof P=="object"&&P!==null&&P.key!=null?F(""+P.key):V.toString(36)}function I(P,V,he,U,W){var ee=typeof P;(ee==="undefined"||ee==="boolean")&&(P=null);var H=!1;if(P===null)H=!0;else switch(ee){case"string":case"number":H=!0;break;case"object":switch(P.$$typeof){case e:case t:H=!0}}if(H)return H=P,W=W(H),P=U===""?"."+J(H,0):U,C(W)?(he="",P!=null&&(he=P.replace(Z,"$&/")+"/"),I(W,V,he,"",function(ge){return ge})):W!=null&&($(W)&&(W=O(W,he+(!W.key||H&&H.key===W.key?"":(""+W.key).replace(Z,"$&/")+"/")+P)),V.push(W)),1;if(H=0,U=U===""?".":U+":",C(P))for(var ae=0;ae<P.length;ae++){ee=P[ae];var me=U+J(ee,ae);H+=I(ee,V,he,me,W)}else if(me=y(P),typeof me=="function")for(P=me.call(P),ae=0;!(ee=P.next()).done;)ee=ee.value,me=U+J(ee,ae++),H+=I(ee,V,he,me,W);else if(ee==="object")throw V=String(P),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return H}function X(P,V,he){if(P==null)return P;var U=[],W=0;return I(P,U,"","",function(ee){return V.call(he,ee,W++)}),U}function G(P){if(P._status===-1){var V=P._result;V=V(),V.then(function(he){(P._status===0||P._status===-1)&&(P._status=1,P._result=he)},function(he){(P._status===0||P._status===-1)&&(P._status=2,P._result=he)}),P._status===-1&&(P._status=0,P._result=V)}if(P._status===1)return P._result.default;throw P._result}var q={current:null},Y={transition:null},L={ReactCurrentDispatcher:q,ReactCurrentBatchConfig:Y,ReactCurrentOwner:R};function K(){throw Error("act(...) is not supported in production builds of React.")}return nt.Children={map:X,forEach:function(P,V,he){X(P,function(){V.apply(this,arguments)},he)},count:function(P){var V=0;return X(P,function(){V++}),V},toArray:function(P){return X(P,function(V){return V})||[]},only:function(P){if(!$(P))throw Error("React.Children.only expected to receive a single React element child.");return P}},nt.Component=S,nt.Fragment=n,nt.Profiler=a,nt.PureComponent=j,nt.StrictMode=s,nt.Suspense=h,nt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=L,nt.act=K,nt.cloneElement=function(P,V,he){if(P==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+P+".");var U=N({},P.props),W=P.key,ee=P.ref,H=P._owner;if(V!=null){if(V.ref!==void 0&&(ee=V.ref,H=R.current),V.key!==void 0&&(W=""+V.key),P.type&&P.type.defaultProps)var ae=P.type.defaultProps;for(me in V)T.call(V,me)&&!A.hasOwnProperty(me)&&(U[me]=V[me]===void 0&&ae!==void 0?ae[me]:V[me])}var me=arguments.length-2;if(me===1)U.children=he;else if(1<me){ae=Array(me);for(var ge=0;ge<me;ge++)ae[ge]=arguments[ge+2];U.children=ae}return{$$typeof:e,type:P.type,key:W,ref:ee,props:U,_owner:H}},nt.createContext=function(P){return P={$$typeof:c,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},P.Provider={$$typeof:l,_context:P},P.Consumer=P},nt.createElement=D,nt.createFactory=function(P){var V=D.bind(null,P);return V.type=P,V},nt.createRef=function(){return{current:null}},nt.forwardRef=function(P){return{$$typeof:d,render:P}},nt.isValidElement=$,nt.lazy=function(P){return{$$typeof:f,_payload:{_status:-1,_result:P},_init:G}},nt.memo=function(P,V){return{$$typeof:p,type:P,compare:V===void 0?null:V}},nt.startTransition=function(P){var V=Y.transition;Y.transition={};try{P()}finally{Y.transition=V}},nt.unstable_act=K,nt.useCallback=function(P,V){return q.current.useCallback(P,V)},nt.useContext=function(P){return q.current.useContext(P)},nt.useDebugValue=function(){},nt.useDeferredValue=function(P){return q.current.useDeferredValue(P)},nt.useEffect=function(P,V){return q.current.useEffect(P,V)},nt.useId=function(){return q.current.useId()},nt.useImperativeHandle=function(P,V,he){return q.current.useImperativeHandle(P,V,he)},nt.useInsertionEffect=function(P,V){return q.current.useInsertionEffect(P,V)},nt.useLayoutEffect=function(P,V){return q.current.useLayoutEffect(P,V)},nt.useMemo=function(P,V){return q.current.useMemo(P,V)},nt.useReducer=function(P,V,he){return q.current.useReducer(P,V,he)},nt.useRef=function(P){return q.current.useRef(P)},nt.useState=function(P){return q.current.useState(P)},nt.useSyncExternalStore=function(P,V,he){return q.current.useSyncExternalStore(P,V,he)},nt.useTransition=function(){return q.current.useTransition()},nt.version="18.3.1",nt}var Ob;function Vl(){return Ob||(Ob=1,xf.exports=rM()),xf.exports}/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.production.min.js
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var Pb;function sM(){if(Pb)return gl;Pb=1;var e=Vl(),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,l={key:!0,ref:!0,__self:!0,__source:!0};function c(d,h,p){var f,m={},y=null,v=null;p!==void 0&&(y=""+p),h.key!==void 0&&(y=""+h.key),h.ref!==void 0&&(v=h.ref);for(f in h)s.call(h,f)&&!l.hasOwnProperty(f)&&(m[f]=h[f]);if(d&&d.defaultProps)for(f in h=d.defaultProps,h)m[f]===void 0&&(m[f]=h[f]);return{$$typeof:t,type:d,key:y,ref:v,props:m,_owner:a.current}}return gl.Fragment=n,gl.jsx=c,gl.jsxs=c,gl}var Lb;function aM(){return Lb||(Lb=1,vf.exports=sM()),vf.exports}var i=aM(),xu={},bf={exports:{}},xn={},kf={exports:{}},_f={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.min.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var
|
|
25
|
+
*/var Db;function oM(){return Db||(Db=1,(function(e){function t(Y,L){var K=Y.length;Y.push(L);e:for(;0<K;){var P=K-1>>>1,V=Y[P];if(0<a(V,L))Y[P]=L,Y[K]=V,K=P;else break e}}function n(Y){return Y.length===0?null:Y[0]}function s(Y){if(Y.length===0)return null;var L=Y[0],K=Y.pop();if(K!==L){Y[0]=K;e:for(var P=0,V=Y.length,he=V>>>1;P<he;){var U=2*(P+1)-1,W=Y[U],ee=U+1,H=Y[ee];if(0>a(W,K))ee<V&&0>a(H,W)?(Y[P]=H,Y[ee]=K,P=ee):(Y[P]=W,Y[U]=K,P=U);else if(ee<V&&0>a(H,K))Y[P]=H,Y[ee]=K,P=ee;else break e}}return L}function a(Y,L){var K=Y.sortIndex-L.sortIndex;return K!==0?K:Y.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var h=[],p=[],f=1,m=null,y=3,v=!1,N=!1,_=!1,S=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(Y){for(var L=n(p);L!==null;){if(L.callback===null)s(p);else if(L.startTime<=Y)s(p),L.sortIndex=L.expirationTime,t(h,L);else break;L=n(p)}}function C(Y){if(_=!1,E(Y),!N)if(n(h)!==null)N=!0,G(T);else{var L=n(p);L!==null&&q(C,L.startTime-Y)}}function T(Y,L){N=!1,_&&(_=!1,k(D),D=-1),v=!0;var K=y;try{for(E(L),m=n(h);m!==null&&(!(m.expirationTime>L)||Y&&!F());){var P=m.callback;if(typeof P=="function"){m.callback=null,y=m.priorityLevel;var V=P(m.expirationTime<=L);L=e.unstable_now(),typeof V=="function"?m.callback=V:m===n(h)&&s(h),E(L)}else s(h);m=n(h)}if(m!==null)var he=!0;else{var U=n(p);U!==null&&q(C,U.startTime-L),he=!1}return he}finally{m=null,y=K,v=!1}}var R=!1,A=null,D=-1,O=5,$=-1;function F(){return!(e.unstable_now()-$<O)}function Z(){if(A!==null){var Y=e.unstable_now();$=Y;var L=!0;try{L=A(!0,Y)}finally{L?J():(R=!1,A=null)}}else R=!1}var J;if(typeof j=="function")J=function(){j(Z)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,X=I.port2;I.port1.onmessage=Z,J=function(){X.postMessage(null)}}else J=function(){S(Z,0)};function G(Y){A=Y,R||(R=!0,J())}function q(Y,L){D=S(function(){Y(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(Y){Y.callback=null},e.unstable_continueExecution=function(){N||v||(N=!0,G(T))},e.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<Y?Math.floor(1e3/Y):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(h)},e.unstable_next=function(Y){switch(y){case 1:case 2:case 3:var L=3;break;default:L=y}var K=y;y=L;try{return Y()}finally{y=K}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Y,L){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var K=y;y=Y;try{return L()}finally{y=K}},e.unstable_scheduleCallback=function(Y,L,K){var P=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?P+K:P):K=P,Y){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=K+V,Y={id:f++,callback:L,priorityLevel:Y,startTime:K,expirationTime:V,sortIndex:-1},K>P?(Y.sortIndex=K,t(p,Y),n(h)===null&&Y===n(p)&&(_?(k(D),D=-1):_=!0,q(C,K-P))):(Y.sortIndex=V,t(h,Y),N||v||(N=!0,G(T))),Y},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(Y){var L=y;return function(){var K=y;y=L;try{return Y.apply(this,arguments)}finally{y=K}}}})(_f)),_f}var qb;function iM(){return qb||(qb=1,kf.exports=oM()),kf.exports}/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.min.js
|
|
28
28
|
*
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var
|
|
34
|
-
`+P+r}var he=!1;function
|
|
33
|
+
*/var Fb;function lM(){if(Fb)return xn;Fb=1;var e=Vl(),t=iM();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,u=1;u<arguments.length;u++)o+="&args[]="+encodeURIComponent(arguments[u]);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 l(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 d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=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]*$/,f={},m={};function y(r){return h.call(m,r)?!0:h.call(f,r)?!1:p.test(r)?m[r]=!0:(f[r]=!0,!1)}function v(r,o,u,g){if(u!==null&&u.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return g?!1:u!==null?!u.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function N(r,o,u,g){if(o===null||typeof o>"u"||v(r,o,u,g))return!0;if(g)return!1;if(u!==null)switch(u.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,u,g,w,b,M){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=g,this.attributeNamespace=w,this.mustUseProperty=u,this.propertyName=r,this.type=o,this.sanitizeURL=b,this.removeEmptyString=M}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){S[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];S[o]=new _(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){S[r]=new _(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){S[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){S[r]=new _(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){S[r]=new _(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){S[r]=new _(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){S[r]=new _(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){S[r]=new _(r,5,!1,r.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function j(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,j);S[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,j);S[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,j);S[o]=new _(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){S[r]=new _(r,1,!1,r.toLowerCase(),null,!1,!1)}),S.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){S[r]=new _(r,1,!1,r.toLowerCase(),null,!0,!0)});function E(r,o,u,g){var w=S.hasOwnProperty(o)?S[o]:null;(w!==null?w.type!==0:g||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(N(o,u,w,g)&&(u=null),g||w===null?y(o)&&(u===null?r.removeAttribute(o):r.setAttribute(o,""+u)):w.mustUseProperty?r[w.propertyName]=u===null?w.type===3?!1:"":u:(o=w.attributeName,g=w.attributeNamespace,u===null?r.removeAttribute(o):(w=w.type,u=w===3||w===4&&u===!0?"":""+u,g?r.setAttributeNS(g,o,u):r.setAttribute(o,u))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),R=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),$=Symbol.for("react.provider"),F=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),q=Symbol.for("react.offscreen"),Y=Symbol.iterator;function L(r){return r===null||typeof r!="object"?null:(r=Y&&r[Y]||r["@@iterator"],typeof r=="function"?r:null)}var K=Object.assign,P;function V(r){if(P===void 0)try{throw Error()}catch(u){var o=u.stack.trim().match(/\n( *(at )?)/);P=o&&o[1]||""}return`
|
|
34
|
+
`+P+r}var he=!1;function U(r,o){if(!r||he)return"";he=!0;var u=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 w=de.stack.split(`
|
|
35
35
|
`),b=g.stack.split(`
|
|
36
36
|
`),M=w.length-1,Q=b.length-1;1<=M&&0<=Q&&w[M]!==b[Q];)Q--;for(;1<=M&&0<=Q;M--,Q--)if(w[M]!==b[Q]){if(M!==1||Q!==1)do if(M--,Q--,0>Q||w[M]!==b[Q]){var te=`
|
|
37
|
-
`+w[M].replace(" at new "," at ");return r.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",r.displayName)),te}while(1<=M&&0<=Q);break}}}finally{he=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?V(r):""}function W(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=z(r.type,!1),r;case 11:return r=z(r.type.render,!1),r;case 1:return r=z(r.type,!0),r;default:return""}}function ee(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 A:return"Fragment";case R:return"Portal";case O:return"Profiler";case D:return"StrictMode";case J:return"Suspense";case I:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case B:return(r.displayName||"Context")+".Consumer";case $: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 X:return o=r.displayName||null,o!==null?o:ee(r.type)||"Memo";case G:o=r._payload,r=r._init;try{return ee(r(o))}catch{}}return null}function H(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 ee(o);case 8:return o===D?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function ae(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",u=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),g=""+r[o];if(!r.hasOwnProperty(o)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var w=u.get,b=u.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return w.call(this)},set:function(M){g=""+M,b.call(this,M)}}),Object.defineProperty(r,o,{enumerable:u.enumerable}),{getValue:function(){return g},setValue:function(M){g=""+M},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Re(r){r._valueTracker||(r._valueTracker=ge(r))}function $e(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var u=o.getValue(),g="";return r&&(g=me(r)?r.checked?"true":"false":r.value),r=g,r!==u?(o.setValue(r),!0):!1}function ce(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 we(r,o){var u=o.checked;return K({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??r._wrapperState.initialChecked})}function xe(r,o){var u=o.defaultValue==null?"":o.defaultValue,g=o.checked!=null?o.checked:o.defaultChecked;u=ae(o.value!=null?o.value:u),r._wrapperState={initialChecked:g,initialValue:u,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function De(r,o){o=o.checked,o!=null&&E(r,"checked",o,!1)}function _e(r,o){De(r,o);var u=ae(o.value),g=o.type;if(u!=null)g==="number"?(u===0&&r.value===""||r.value!=u)&&(r.value=""+u):r.value!==""+u&&(r.value=""+u);else if(g==="submit"||g==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Ge(r,o.type,u):o.hasOwnProperty("defaultValue")&&Ge(r,o.type,ae(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function Ee(r,o,u){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,u||o===r.value||(r.value=o),r.defaultValue=o}u=r.name,u!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,u!==""&&(r.name=u)}function Ge(r,o,u){(o!=="number"||ce(r.ownerDocument)!==r)&&(u==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+u&&(r.defaultValue=""+u))}var st=Array.isArray;function Je(r,o,u,g){if(r=r.options,o){o={};for(var w=0;w<u.length;w++)o["$"+u[w]]=!0;for(u=0;u<r.length;u++)w=o.hasOwnProperty("$"+r[u].value),r[u].selected!==w&&(r[u].selected=w),w&&g&&(r[u].defaultSelected=!0)}else{for(u=""+ae(u),o=null,w=0;w<r.length;w++){if(r[w].value===u){r[w].selected=!0,g&&(r[w].defaultSelected=!0);return}o!==null||r[w].disabled||(o=r[w])}o!==null&&(o.selected=!0)}}function Ze(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return K({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Qe(r,o){var u=o.value;if(u==null){if(u=o.children,o=o.defaultValue,u!=null){if(o!=null)throw Error(n(92));if(st(u)){if(1<u.length)throw Error(n(93));u=u[0]}o=u}o==null&&(o=""),u=o}r._wrapperState={initialValue:ae(u)}}function fe(r,o){var u=ae(o.value),g=ae(o.defaultValue);u!=null&&(u=""+u,u!==r.value&&(r.value=u),o.defaultValue==null&&r.defaultValue!==u&&(r.defaultValue=u)),g!=null&&(r.defaultValue=""+g)}function ye(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function Se(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 Pe(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?Se(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var et,ft=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,u,g,w){MSApp.execUnsafeLocalFunction(function(){return r(o,u,g,w)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(et=et||document.createElement("div"),et.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=et.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function dt(r,o){if(o){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=o;return}}r.textContent=o}var ze={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},Xe=["Webkit","ms","Moz","O"];Object.keys(ze).forEach(function(r){Xe.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),ze[o]=ze[r]})});function re(r,o,u){return o==null||typeof o=="boolean"||o===""?"":u||typeof o!="number"||o===0||ze.hasOwnProperty(r)&&ze[r]?(""+o).trim():o+"px"}function Fe(r,o){r=r.style;for(var u in o)if(o.hasOwnProperty(u)){var g=u.indexOf("--")===0,w=re(u,o[u],g);u==="float"&&(u="cssFloat"),g?r.setProperty(u,w):r[u]=w}}var se=K({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ce(r,o){if(o){if(se[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 Ve(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 gt=null;function xt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Te=null,tt=null,pt=null;function wt(r){if(r=el(r)){if(typeof Te!="function")throw Error(n(280));var o=r.stateNode;o&&(o=$c(o),Te(r.stateNode,r.type,o))}}function Yt(r){tt?pt?pt.push(r):pt=[r]:tt=r}function Fr(){if(tt){var r=tt,o=pt;if(pt=tt=null,wt(r),o)for(r=0;r<o.length;r++)wt(o[r])}}function Qn(r,o){return r(o)}function Br(){}var Zn=!1;function eo(r,o,u){if(Zn)return r(o,u);Zn=!0;try{return Qn(r,o,u)}finally{Zn=!1,(tt!==null||pt!==null)&&(Br(),Fr())}}function zr(r,o){var u=r.stateNode;if(u===null)return null;var g=$c(u);if(g===null)return null;u=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(u&&typeof u!="function")throw Error(n(231,o,typeof u));return u}var Xs=!1;if(d)try{var Ur={};Object.defineProperty(Ur,"passive",{get:function(){Xs=!0}}),window.addEventListener("test",Ur,Ur),window.removeEventListener("test",Ur,Ur)}catch{Xs=!1}function Mn(r,o,u,g,w,b,M,Q,te){var de=Array.prototype.slice.call(arguments,3);try{o.apply(u,de)}catch(be){this.onError(be)}}var Wr=!1,ys=null,Ft=!1,vr=null,Qs={onError:function(r){Wr=!0,ys=r}};function ki(r,o,u,g,w,b,M,Q,te){Wr=!1,ys=null,Mn.apply(Qs,arguments)}function to(r,o,u,g,w,b,M,Q,te){if(ki.apply(this,arguments),Wr){if(Wr){var de=ys;Wr=!1,ys=null}else throw Error(n(198));Ft||(Ft=!0,vr=de)}}function In(r){var o=r,u=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(u=o.return),r=o.return;while(r)}return o.tag===3?u:null}function Zs(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 Js(r){if(In(r)!==r)throw Error(n(188))}function ea(r){var o=r.alternate;if(!o){if(o=In(r),o===null)throw Error(n(188));return o!==r?null:r}for(var u=r,g=o;;){var w=u.return;if(w===null)break;var b=w.alternate;if(b===null){if(g=w.return,g!==null){u=g;continue}break}if(w.child===b.child){for(b=w.child;b;){if(b===u)return Js(w),r;if(b===g)return Js(w),o;b=b.sibling}throw Error(n(188))}if(u.return!==g.return)u=w,g=b;else{for(var M=!1,Q=w.child;Q;){if(Q===u){M=!0,u=w,g=b;break}if(Q===g){M=!0,g=w,u=b;break}Q=Q.sibling}if(!M){for(Q=b.child;Q;){if(Q===u){M=!0,u=b,g=w;break}if(Q===g){M=!0,g=b,u=w;break}Q=Q.sibling}if(!M)throw Error(n(189))}}if(u.alternate!==g)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?r:o}function ta(r){return r=ea(r),r!==null?na(r):null}function na(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=na(r);if(o!==null)return o;r=r.sibling}return null}var ra=t.unstable_scheduleCallback,no=t.unstable_cancelCallback,sa=t.unstable_shouldYield,_i=t.unstable_requestPaint,mt=t.unstable_now,ro=t.unstable_getCurrentPriorityLevel,aa=t.unstable_ImmediatePriority,Hr=t.unstable_UserBlockingPriority,Gr=t.unstable_NormalPriority,Vr=t.unstable_LowPriority,oa=t.unstable_IdlePriority,Yr=null,Ot=null;function ia(r){if(Ot&&typeof Ot.onCommitFiberRoot=="function")try{Ot.onCommitFiberRoot(Yr,r,void 0,(r.current.flags&128)===128)}catch{}}var dn=Math.clz32?Math.clz32:cc,lc=Math.log,Kd=Math.LN2;function cc(r){return r>>>=0,r===0?32:31-(lc(r)/Kd|0)|0}var xr=64,so=4194304;function ws(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 en(r,o){var u=r.pendingLanes;if(u===0)return 0;var g=0,w=r.suspendedLanes,b=r.pingedLanes,M=u&268435455;if(M!==0){var Q=M&~w;Q!==0?g=ws(Q):(b&=M,b!==0&&(g=ws(b)))}else M=u&~w,M!==0?g=ws(M):b!==0&&(g=ws(b));if(g===0)return 0;if(o!==0&&o!==g&&(o&w)===0&&(w=g&-g,b=o&-o,w>=b||w===16&&(b&4194240)!==0))return o;if((g&4)!==0&&(g|=u&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=g;0<o;)u=31-dn(o),w=1<<u,g|=r[u],o&=~w;return g}function ao(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 Xd(r,o){for(var u=r.suspendedLanes,g=r.pingedLanes,w=r.expirationTimes,b=r.pendingLanes;0<b;){var M=31-dn(b),Q=1<<M,te=w[M];te===-1?((Q&u)===0||(Q&g)!==0)&&(w[M]=ao(Q,o)):te<=o&&(r.expiredLanes|=Q),b&=~Q}}function la(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Tt(){var r=xr;return xr<<=1,(xr&4194240)===0&&(xr=64),r}function Ni(r){for(var o=[],u=0;31>u;u++)o.push(r);return o}function on(r,o,u){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-dn(o),r[o]=u}function oo(r,o){var u=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<u;){var w=31-dn(u),b=1<<w;o[w]=0,g[w]=-1,r[w]=-1,u&=~b}}function io(r,o){var u=r.entangledLanes|=o;for(r=r.entanglements;u;){var g=31-dn(u),w=1<<g;w&o|r[g]&o&&(r[g]|=o),u&=~w}}var ct=0;function Jn(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var ca,Si,uc,ji,Ei,br=!1,ua=[],er=null,_n=null,$n=null,vs=new Map,xs=new Map,tr=[],dc="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 tn(r,o){switch(r){case"focusin":case"focusout":er=null;break;case"dragenter":case"dragleave":_n=null;break;case"mouseover":case"mouseout":$n=null;break;case"pointerover":case"pointerout":vs.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":xs.delete(o.pointerId)}}function kr(r,o,u,g,w,b){return r===null||r.nativeEvent!==b?(r={blockedOn:o,domEventName:u,eventSystemFlags:g,nativeEvent:b,targetContainers:[w]},o!==null&&(o=el(o),o!==null&&Si(o)),r):(r.eventSystemFlags|=g,o=r.targetContainers,w!==null&&o.indexOf(w)===-1&&o.push(w),r)}function lo(r,o,u,g,w){switch(o){case"focusin":return er=kr(er,r,o,u,g,w),!0;case"dragenter":return _n=kr(_n,r,o,u,g,w),!0;case"mouseover":return $n=kr($n,r,o,u,g,w),!0;case"pointerover":var b=w.pointerId;return vs.set(b,kr(vs.get(b)||null,r,o,u,g,w)),!0;case"gotpointercapture":return b=w.pointerId,xs.set(b,kr(xs.get(b)||null,r,o,u,g,w)),!0}return!1}function co(r){var o=Ea(r.target);if(o!==null){var u=In(o);if(u!==null){if(o=u.tag,o===13){if(o=Zs(u),o!==null){r.blockedOn=o,Ei(r.priority,function(){uc(u)});return}}else if(o===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function uo(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var u=Qr(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(u===null){u=r.nativeEvent;var g=new u.constructor(u.type,u);gt=g,u.target.dispatchEvent(g),gt=null}else return o=el(u),o!==null&&Si(o),r.blockedOn=u,!1;o.shift()}return!0}function Kr(r,o,u){uo(r)&&u.delete(o)}function hc(){br=!1,er!==null&&uo(er)&&(er=null),_n!==null&&uo(_n)&&(_n=null),$n!==null&&uo($n)&&($n=null),vs.forEach(Kr),xs.forEach(Kr)}function hn(r,o){r.blockedOn===o&&(r.blockedOn=null,br||(br=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,hc)))}function da(r){function o(w){return hn(w,r)}if(0<ua.length){hn(ua[0],r);for(var u=1;u<ua.length;u++){var g=ua[u];g.blockedOn===r&&(g.blockedOn=null)}}for(er!==null&&hn(er,r),_n!==null&&hn(_n,r),$n!==null&&hn($n,r),vs.forEach(o),xs.forEach(o),u=0;u<tr.length;u++)g=tr[u],g.blockedOn===r&&(g.blockedOn=null);for(;0<tr.length&&(u=tr[0],u.blockedOn===null);)co(u),u.blockedOn===null&&tr.shift()}var Xr=C.ReactCurrentBatchConfig,ho=!0;function Qd(r,o,u,g){var w=ct,b=Xr.transition;Xr.transition=null;try{ct=1,Ci(r,o,u,g)}finally{ct=w,Xr.transition=b}}function fc(r,o,u,g){var w=ct,b=Xr.transition;Xr.transition=null;try{ct=4,Ci(r,o,u,g)}finally{ct=w,Xr.transition=b}}function Ci(r,o,u,g){if(ho){var w=Qr(r,o,u,g);if(w===null)Zi(r,o,g,On,u),tn(r,g);else if(lo(w,r,o,u,g))g.stopPropagation();else if(tn(r,g),o&4&&-1<dc.indexOf(r)){for(;w!==null;){var b=el(w);if(b!==null&&ca(b),b=Qr(r,o,u,g),b===null&&Zi(r,o,g,On,u),b===w)break;w=b}w!==null&&g.stopPropagation()}else Zi(r,o,g,null,u)}}var On=null;function Qr(r,o,u,g){if(On=null,r=xt(g),r=Ea(r),r!==null)if(o=In(r),o===null)r=null;else if(u=o.tag,u===13){if(r=Zs(o),r!==null)return r;r=null}else if(u===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return On=r,null}function Ti(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(ro()){case aa:return 1;case Hr:return 4;case Gr:case Vr:return 16;case oa:return 536870912;default:return 16}default:return 16}}var Pn=null,Nn=null,fo=null;function Sn(){if(fo)return fo;var r,o=Nn,u=o.length,g,w="value"in Pn?Pn.value:Pn.textContent,b=w.length;for(r=0;r<u&&o[r]===w[r];r++);var M=u-r;for(g=1;g<=M&&o[u-g]===w[b-g];g++);return fo=w.slice(r,1<g?1-g:void 0)}function bs(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 ks(){return!0}function Ai(){return!1}function Bt(r){function o(u,g,w,b,M){this._reactName=u,this._targetInst=w,this.type=g,this.nativeEvent=b,this.target=M,this.currentTarget=null;for(var Q in r)r.hasOwnProperty(Q)&&(u=r[Q],this[Q]=u?u(b):b[Q]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?ks:Ai,this.isPropagationStopped=Ai,this}return K(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=ks)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=ks)},persist:function(){},isPersistent:ks}),o}var _r={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},po=Bt(_r),Zr=K({},_r,{view:0,detail:0}),pc=Bt(Zr),ha,mo,Ln,fa=K({},Zr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ma,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!==Ln&&(Ln&&r.type==="mousemove"?(ha=r.screenX-Ln.screenX,mo=r.screenY-Ln.screenY):mo=ha=0,Ln=r),ha)},movementY:function(r){return"movementY"in r?r.movementY:mo}}),Ri=Bt(fa),Mi=K({},fa,{dataTransfer:0}),Zd=Bt(Mi),Ii=K({},Zr,{relatedTarget:0}),Nr=Bt(Ii),mc=K({},_r,{animationName:0,elapsedTime:0,pseudoElement:0}),Jd=Bt(mc),gc=K({},_r,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),yc=Bt(gc),eh=K({},_r,{data:0}),ln=Bt(eh),th={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$i={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"},_s={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pa(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=_s[r])?!!o[r]:!1}function ma(){return pa}var Oi=K({},Zr,{key:function(r){if(r.key){var o=th[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=bs(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?$i[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ma,charCode:function(r){return r.type==="keypress"?bs(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?bs(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Pi=Bt(Oi),go=K({},fa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Li=Bt(go),nh=K({},Zr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ma}),rh=Bt(nh),wc=K({},_r,{propertyName:0,elapsedTime:0,pseudoElement:0}),sh=Bt(wc),ah=K({},fa,{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}),Di=Bt(ah),Sr=[9,13,27,32],ga=d&&"CompositionEvent"in window,Ns=null;d&&"documentMode"in document&&(Ns=document.documentMode);var oh=d&&"TextEvent"in window&&!Ns,vc=d&&(!ga||Ns&&8<Ns&&11>=Ns),qi=" ",xc=!1;function bc(r,o){switch(r){case"keyup":return Sr.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kc(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ss=!1;function _c(r,o){switch(r){case"compositionend":return kc(o);case"keypress":return o.which!==32?null:(xc=!0,qi);case"textInput":return r=o.data,r===qi&&xc?null:r;default:return null}}function Nc(r,o){if(Ss)return r==="compositionend"||!ga&&bc(r,o)?(r=Sn(),fo=Nn=Pn=null,Ss=!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 vc&&o.locale!=="ko"?null:o.data;default:return null}}var jr={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 Sc(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!jr[r.type]:o==="textarea"}function Fi(r,o,u,g){Yt(g),o=So(o,"onChange"),0<o.length&&(u=new po("onChange","change",null,u,g),r.push({event:u,listeners:o}))}var ya=null,Er=null;function ih(r){ot(r,0)}function zt(r){var o=Co(r);if($e(o))return r}function Bi(r,o){if(r==="change")return o}var zi=!1;if(d){var yo;if(d){var wo="oninput"in document;if(!wo){var vo=document.createElement("div");vo.setAttribute("oninput","return;"),wo=typeof vo.oninput=="function"}yo=wo}else yo=!1;zi=yo&&(!document.documentMode||9<document.documentMode)}function wa(){ya&&(ya.detachEvent("onpropertychange",xo),Er=ya=null)}function xo(r){if(r.propertyName==="value"&&zt(Er)){var o=[];Fi(o,Er,r,xt(r)),eo(ih,o)}}function jc(r,o,u){r==="focusin"?(wa(),ya=o,Er=u,ya.attachEvent("onpropertychange",xo)):r==="focusout"&&wa()}function bo(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return zt(Er)}function Ec(r,o){if(r==="click")return zt(o)}function Ui(r,o){if(r==="input"||r==="change")return zt(o)}function Wi(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var fn=typeof Object.is=="function"?Object.is:Wi;function At(r,o){if(fn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var u=Object.keys(r),g=Object.keys(o);if(u.length!==g.length)return!1;for(g=0;g<u.length;g++){var w=u[g];if(!h.call(o,w)||!fn(r[w],o[w]))return!1}return!0}function Hi(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Gi(r,o){var u=Hi(r);r=0;for(var g;u;){if(u.nodeType===3){if(g=r+u.textContent.length,r<=o&&g>=o)return{node:u,offset:o-r};r=g}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Hi(u)}}function Cc(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Cc(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Tc(){for(var r=window,o=ce();o instanceof r.HTMLIFrameElement;){try{var u=typeof o.contentWindow.location.href=="string"}catch{u=!1}if(u)r=o.contentWindow;else break;o=ce(r.document)}return o}function ko(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 _o(r){var o=Tc(),u=r.focusedElem,g=r.selectionRange;if(o!==u&&u&&u.ownerDocument&&Cc(u.ownerDocument.documentElement,u)){if(g!==null&&ko(u)){if(o=g.start,r=g.end,r===void 0&&(r=o),"selectionStart"in u)u.selectionStart=o,u.selectionEnd=Math.min(r,u.value.length);else if(r=(o=u.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var w=u.textContent.length,b=Math.min(g.start,w);g=g.end===void 0?b:Math.min(g.end,w),!r.extend&&b>g&&(w=g,g=b,b=w),w=Gi(u,b);var M=Gi(u,g);w&&M&&(r.rangeCount!==1||r.anchorNode!==w.node||r.anchorOffset!==w.offset||r.focusNode!==M.node||r.focusOffset!==M.offset)&&(o=o.createRange(),o.setStart(w.node,w.offset),r.removeAllRanges(),b>g?(r.addRange(o),r.extend(M.node,M.offset)):(o.setEnd(M.node,M.offset),r.addRange(o)))}}for(o=[],r=u;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<o.length;u++)r=o[u],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var lh=d&&"documentMode"in document&&11>=document.documentMode,pn=null,va=null,Cr=null,xa=!1;function Ac(r,o,u){var g=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;xa||pn==null||pn!==ce(g)||(g=pn,"selectionStart"in g&&ko(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Cr&&At(Cr,g)||(Cr=g,g=So(va,"onSelect"),0<g.length&&(o=new po("onSelect","select",null,o,u),r.push({event:o,listeners:g}),o.target=pn)))}function ba(r,o){var u={};return u[r.toLowerCase()]=o.toLowerCase(),u["Webkit"+r]="webkit"+o,u["Moz"+r]="moz"+o,u}var Jr={animationend:ba("Animation","AnimationEnd"),animationiteration:ba("Animation","AnimationIteration"),animationstart:ba("Animation","AnimationStart"),transitionend:ba("Transition","TransitionEnd")},Vi={},Rc={};d&&(Rc=document.createElement("div").style,"AnimationEvent"in window||(delete Jr.animationend.animation,delete Jr.animationiteration.animation,delete Jr.animationstart.animation),"TransitionEvent"in window||delete Jr.transitionend.transition);function ka(r){if(Vi[r])return Vi[r];if(!Jr[r])return r;var o=Jr[r],u;for(u in o)if(o.hasOwnProperty(u)&&u in Rc)return Vi[r]=o[u];return r}var _a=ka("animationend"),No=ka("animationiteration"),Mc=ka("animationstart"),Yi=ka("transitionend"),Ki=new Map,Xi="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 nr(r,o){Ki.set(r,o),l(o,[r])}for(var F=0;F<Xi.length;F++){var U=Xi[F],oe=U.toLowerCase(),le=U[0].toUpperCase()+U.slice(1);nr(oe,"on"+le)}nr(_a,"onAnimationEnd"),nr(No,"onAnimationIteration"),nr(Mc,"onAnimationStart"),nr("dblclick","onDoubleClick"),nr("focusin","onFocus"),nr("focusout","onBlur"),nr(Yi,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var je="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(" "),Me=new Set("cancel close invalid load scroll toggle".split(" ").concat(je));function Ue(r,o,u){var g=r.type||"unknown-event";r.currentTarget=u,to(g,o,void 0,r),r.currentTarget=null}function ot(r,o){o=(o&4)!==0;for(var u=0;u<r.length;u++){var g=r[u],w=g.event;g=g.listeners;e:{var b=void 0;if(o)for(var M=g.length-1;0<=M;M--){var Q=g[M],te=Q.instance,de=Q.currentTarget;if(Q=Q.listener,te!==b&&w.isPropagationStopped())break e;Ue(w,Q,de),b=te}else for(M=0;M<g.length;M++){if(Q=g[M],te=Q.instance,de=Q.currentTarget,Q=Q.listener,te!==b&&w.isPropagationStopped())break e;Ue(w,Q,de),b=te}}}if(Ft)throw r=vr,Ft=!1,vr=null,r}function Ye(r,o){var u=o[ph];u===void 0&&(u=o[ph]=new Set);var g=r+"__bubble";u.has(g)||(Qi(o,r,2,!1),u.add(g))}function ut(r,o,u){var g=0;o&&(g|=4),Qi(u,r,g,o)}var Kt="_reactListening"+Math.random().toString(36).slice(2);function Tr(r){if(!r[Kt]){r[Kt]=!0,s.forEach(function(u){u!=="selectionchange"&&(Me.has(u)||ut(u,!1,r),ut(u,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[Kt]||(o[Kt]=!0,ut("selectionchange",!1,o))}}function Qi(r,o,u,g){switch(Ti(o)){case 1:var w=Qd;break;case 4:w=fc;break;default:w=Ci}u=w.bind(null,o,u,r),w=void 0,!Xs||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(w=!0),g?w!==void 0?r.addEventListener(o,u,{capture:!0,passive:w}):r.addEventListener(o,u,!0):w!==void 0?r.addEventListener(o,u,{passive:w}):r.addEventListener(o,u,!1)}function Zi(r,o,u,g,w){var b=g;if((o&1)===0&&(o&2)===0&&g!==null)e:for(;;){if(g===null)return;var M=g.tag;if(M===3||M===4){var Q=g.stateNode.containerInfo;if(Q===w||Q.nodeType===8&&Q.parentNode===w)break;if(M===4)for(M=g.return;M!==null;){var te=M.tag;if((te===3||te===4)&&(te=M.stateNode.containerInfo,te===w||te.nodeType===8&&te.parentNode===w))return;M=M.return}for(;Q!==null;){if(M=Ea(Q),M===null)return;if(te=M.tag,te===5||te===6){g=b=M;continue e}Q=Q.parentNode}}g=g.return}eo(function(){var de=b,be=xt(u),ke=[];e:{var ve=Ki.get(r);if(ve!==void 0){var Ae=po,Oe=r;switch(r){case"keypress":if(bs(u)===0)break e;case"keydown":case"keyup":Ae=Pi;break;case"focusin":Oe="focus",Ae=Nr;break;case"focusout":Oe="blur",Ae=Nr;break;case"beforeblur":case"afterblur":Ae=Nr;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ae=Ri;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ae=Zd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ae=rh;break;case _a:case No:case Mc:Ae=Jd;break;case Yi:Ae=sh;break;case"scroll":Ae=pc;break;case"wheel":Ae=Di;break;case"copy":case"cut":case"paste":Ae=yc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ae=Li}var Le=(o&4)!==0,Ct=!Le&&r==="scroll",ie=Le?ve!==null?ve+"Capture":null:ve;Le=[];for(var ne=de,ue;ne!==null;){ue=ne;var Ne=ue.stateNode;if(ue.tag===5&&Ne!==null&&(ue=Ne,ie!==null&&(Ne=zr(ne,ie),Ne!=null&&Le.push(js(ne,Ne,ue)))),Ct)break;ne=ne.return}0<Le.length&&(ve=new Ae(ve,Oe,null,u,be),ke.push({event:ve,listeners:Le}))}}if((o&7)===0){e:{if(ve=r==="mouseover"||r==="pointerover",Ae=r==="mouseout"||r==="pointerout",ve&&u!==gt&&(Oe=u.relatedTarget||u.fromElement)&&(Ea(Oe)||Oe[ts]))break e;if((Ae||ve)&&(ve=be.window===be?be:(ve=be.ownerDocument)?ve.defaultView||ve.parentWindow:window,Ae?(Oe=u.relatedTarget||u.toElement,Ae=de,Oe=Oe?Ea(Oe):null,Oe!==null&&(Ct=In(Oe),Oe!==Ct||Oe.tag!==5&&Oe.tag!==6)&&(Oe=null)):(Ae=null,Oe=de),Ae!==Oe)){if(Le=Ri,Ne="onMouseLeave",ie="onMouseEnter",ne="mouse",(r==="pointerout"||r==="pointerover")&&(Le=Li,Ne="onPointerLeave",ie="onPointerEnter",ne="pointer"),Ct=Ae==null?ve:Co(Ae),ue=Oe==null?ve:Co(Oe),ve=new Le(Ne,ne+"leave",Ae,u,be),ve.target=Ct,ve.relatedTarget=ue,Ne=null,Ea(be)===de&&(Le=new Le(ie,ne+"enter",Oe,u,be),Le.target=ue,Le.relatedTarget=Ct,Ne=Le),Ct=Ne,Ae&&Oe)t:{for(Le=Ae,ie=Oe,ne=0,ue=Le;ue;ue=es(ue))ne++;for(ue=0,Ne=ie;Ne;Ne=es(Ne))ue++;for(;0<ne-ue;)Le=es(Le),ne--;for(;0<ue-ne;)ie=es(ie),ue--;for(;ne--;){if(Le===ie||ie!==null&&Le===ie.alternate)break t;Le=es(Le),ie=es(ie)}Le=null}else Le=null;Ae!==null&&jo(ke,ve,Ae,Le,!1),Oe!==null&&Ct!==null&&jo(ke,Ct,Oe,Le,!0)}}e:{if(ve=de?Co(de):window,Ae=ve.nodeName&&ve.nodeName.toLowerCase(),Ae==="select"||Ae==="input"&&ve.type==="file")var qe=Bi;else if(Sc(ve))if(zi)qe=Ui;else{qe=bo;var We=jc}else(Ae=ve.nodeName)&&Ae.toLowerCase()==="input"&&(ve.type==="checkbox"||ve.type==="radio")&&(qe=Ec);if(qe&&(qe=qe(r,de))){Fi(ke,qe,u,be);break e}We&&We(r,ve,de),r==="focusout"&&(We=ve._wrapperState)&&We.controlled&&ve.type==="number"&&Ge(ve,"number",ve.value)}switch(We=de?Co(de):window,r){case"focusin":(Sc(We)||We.contentEditable==="true")&&(pn=We,va=de,Cr=null);break;case"focusout":Cr=va=pn=null;break;case"mousedown":xa=!0;break;case"contextmenu":case"mouseup":case"dragend":xa=!1,Ac(ke,u,be);break;case"selectionchange":if(lh)break;case"keydown":case"keyup":Ac(ke,u,be)}var He;if(ga)e:{switch(r){case"compositionstart":var Ke="onCompositionStart";break e;case"compositionend":Ke="onCompositionEnd";break e;case"compositionupdate":Ke="onCompositionUpdate";break e}Ke=void 0}else Ss?bc(r,u)&&(Ke="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(Ke="onCompositionStart");Ke&&(vc&&u.locale!=="ko"&&(Ss||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&Ss&&(He=Sn()):(Pn=be,Nn="value"in Pn?Pn.value:Pn.textContent,Ss=!0)),We=So(de,Ke),0<We.length&&(Ke=new ln(Ke,r,null,u,be),ke.push({event:Ke,listeners:We}),He?Ke.data=He:(He=kc(u),He!==null&&(Ke.data=He)))),(He=oh?_c(r,u):Nc(r,u))&&(de=So(de,"onBeforeInput"),0<de.length&&(be=new ln("onBeforeInput","beforeinput",null,u,be),ke.push({event:be,listeners:de}),be.data=He))}ot(ke,o)})}function js(r,o,u){return{instance:r,listener:o,currentTarget:u}}function So(r,o){for(var u=o+"Capture",g=[];r!==null;){var w=r,b=w.stateNode;w.tag===5&&b!==null&&(w=b,b=zr(r,u),b!=null&&g.unshift(js(r,b,w)),b=zr(r,o),b!=null&&g.push(js(r,b,w))),r=r.return}return g}function es(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function jo(r,o,u,g,w){for(var b=o._reactName,M=[];u!==null&&u!==g;){var Q=u,te=Q.alternate,de=Q.stateNode;if(te!==null&&te===g)break;Q.tag===5&&de!==null&&(Q=de,w?(te=zr(u,b),te!=null&&M.unshift(js(u,te,Q))):w||(te=zr(u,b),te!=null&&M.push(js(u,te,Q)))),u=u.return}M.length!==0&&r.push({event:o,listeners:M})}var Na=/\r\n?/g,Sa=/\u0000|\uFFFD/g;function Et(r){return(typeof r=="string"?r:""+r).replace(Na,`
|
|
38
|
-
`).replace(Sa,"")}function ja(r,o,u){if(o=Et(o),Et(r)!==o&&u)throw Error(n(425))}function Ic(){}var ch=null,uh=null;function dh(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 hh=typeof setTimeout=="function"?setTimeout:void 0,gR=typeof clearTimeout=="function"?clearTimeout:void 0,Jx=typeof Promise=="function"?Promise:void 0,yR=typeof queueMicrotask=="function"?queueMicrotask:typeof Jx<"u"?function(r){return Jx.resolve(null).then(r).catch(wR)}:hh;function wR(r){setTimeout(function(){throw r})}function fh(r,o){var u=o,g=0;do{var w=u.nextSibling;if(r.removeChild(u),w&&w.nodeType===8)if(u=w.data,u==="/$"){if(g===0){r.removeChild(w),da(o);return}g--}else u!=="$"&&u!=="$?"&&u!=="$!"||g++;u=w}while(u);da(o)}function Es(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 e0(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"){if(o===0)return r;o--}else u==="/$"&&o++}r=r.previousSibling}return null}var Eo=Math.random().toString(36).slice(2),Ar="__reactFiber$"+Eo,Ji="__reactProps$"+Eo,ts="__reactContainer$"+Eo,ph="__reactEvents$"+Eo,vR="__reactListeners$"+Eo,xR="__reactHandles$"+Eo;function Ea(r){var o=r[Ar];if(o)return o;for(var u=r.parentNode;u;){if(o=u[ts]||u[Ar]){if(u=o.alternate,o.child!==null||u!==null&&u.child!==null)for(r=e0(r);r!==null;){if(u=r[Ar])return u;r=e0(r)}return o}r=u,u=r.parentNode}return null}function el(r){return r=r[Ar]||r[ts],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Co(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function $c(r){return r[Ji]||null}var mh=[],To=-1;function Cs(r){return{current:r}}function vt(r){0>To||(r.current=mh[To],mh[To]=null,To--)}function yt(r,o){To++,mh[To]=r.current,r.current=o}var Ts={},nn=Cs(Ts),mn=Cs(!1),Ca=Ts;function Ao(r,o){var u=r.type.contextTypes;if(!u)return Ts;var g=r.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===o)return g.__reactInternalMemoizedMaskedChildContext;var w={},b;for(b in u)w[b]=o[b];return g&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=w),w}function gn(r){return r=r.childContextTypes,r!=null}function Oc(){vt(mn),vt(nn)}function t0(r,o,u){if(nn.current!==Ts)throw Error(n(168));yt(nn,o),yt(mn,u)}function n0(r,o,u){var g=r.stateNode;if(o=o.childContextTypes,typeof g.getChildContext!="function")return u;g=g.getChildContext();for(var w in g)if(!(w in o))throw Error(n(108,H(r)||"Unknown",w));return K({},u,g)}function Pc(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Ts,Ca=nn.current,yt(nn,r),yt(mn,mn.current),!0}function r0(r,o,u){var g=r.stateNode;if(!g)throw Error(n(169));u?(r=n0(r,o,Ca),g.__reactInternalMemoizedMergedChildContext=r,vt(mn),vt(nn),yt(nn,r)):vt(mn),yt(mn,u)}var ns=null,Lc=!1,gh=!1;function s0(r){ns===null?ns=[r]:ns.push(r)}function bR(r){Lc=!0,s0(r)}function As(){if(!gh&&ns!==null){gh=!0;var r=0,o=ct;try{var u=ns;for(ct=1;r<u.length;r++){var g=u[r];do g=g(!0);while(g!==null)}ns=null,Lc=!1}catch(w){throw ns!==null&&(ns=ns.slice(r+1)),ra(aa,As),w}finally{ct=o,gh=!1}}return null}var Ro=[],Mo=0,Dc=null,qc=0,Dn=[],qn=0,Ta=null,rs=1,ss="";function Aa(r,o){Ro[Mo++]=qc,Ro[Mo++]=Dc,Dc=r,qc=o}function a0(r,o,u){Dn[qn++]=rs,Dn[qn++]=ss,Dn[qn++]=Ta,Ta=r;var g=rs;r=ss;var w=32-dn(g)-1;g&=~(1<<w),u+=1;var b=32-dn(o)+w;if(30<b){var M=w-w%5;b=(g&(1<<M)-1).toString(32),g>>=M,w-=M,rs=1<<32-dn(o)+w|u<<w|g,ss=b+r}else rs=1<<b|u<<w|g,ss=r}function yh(r){r.return!==null&&(Aa(r,1),a0(r,1,0))}function wh(r){for(;r===Dc;)Dc=Ro[--Mo],Ro[Mo]=null,qc=Ro[--Mo],Ro[Mo]=null;for(;r===Ta;)Ta=Dn[--qn],Dn[qn]=null,ss=Dn[--qn],Dn[qn]=null,rs=Dn[--qn],Dn[qn]=null}var jn=null,En=null,bt=!1,rr=null;function o0(r,o){var u=Un(5,null,null,0);u.elementType="DELETED",u.stateNode=o,u.return=r,o=r.deletions,o===null?(r.deletions=[u],r.flags|=16):o.push(u)}function i0(r,o){switch(r.tag){case 5:var u=r.type;return o=o.nodeType!==1||u.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,jn=r,En=Es(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,jn=r,En=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(u=Ta!==null?{id:rs,overflow:ss}:null,r.memoizedState={dehydrated:o,treeContext:u,retryLane:1073741824},u=Un(18,null,null,0),u.stateNode=o,u.return=r,r.child=u,jn=r,En=null,!0):!1;default:return!1}}function vh(r){return(r.mode&1)!==0&&(r.flags&128)===0}function xh(r){if(bt){var o=En;if(o){var u=o;if(!i0(r,o)){if(vh(r))throw Error(n(418));o=Es(u.nextSibling);var g=jn;o&&i0(r,o)?o0(g,u):(r.flags=r.flags&-4097|2,bt=!1,jn=r)}}else{if(vh(r))throw Error(n(418));r.flags=r.flags&-4097|2,bt=!1,jn=r}}}function l0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;jn=r}function Fc(r){if(r!==jn)return!1;if(!bt)return l0(r),bt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!dh(r.type,r.memoizedProps)),o&&(o=En)){if(vh(r))throw c0(),Error(n(418));for(;o;)o0(r,o),o=Es(o.nextSibling)}if(l0(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 u=r.data;if(u==="/$"){if(o===0){En=Es(r.nextSibling);break e}o--}else u!=="$"&&u!=="$!"&&u!=="$?"||o++}r=r.nextSibling}En=null}}else En=jn?Es(r.stateNode.nextSibling):null;return!0}function c0(){for(var r=En;r;)r=Es(r.nextSibling)}function Io(){En=jn=null,bt=!1}function bh(r){rr===null?rr=[r]:rr.push(r)}var kR=C.ReactCurrentBatchConfig;function tl(r,o,u){if(r=u.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(n(309));var g=u.stateNode}if(!g)throw Error(n(147,r));var w=g,b=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===b?o.ref:(o=function(M){var Q=w.refs;M===null?delete Q[b]:Q[b]=M},o._stringRef=b,o)}if(typeof r!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,r))}return r}function Bc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function u0(r){var o=r._init;return o(r._payload)}function d0(r){function o(ie,ne){if(r){var ue=ie.deletions;ue===null?(ie.deletions=[ne],ie.flags|=16):ue.push(ne)}}function u(ie,ne){if(!r)return null;for(;ne!==null;)o(ie,ne),ne=ne.sibling;return null}function g(ie,ne){for(ie=new Map;ne!==null;)ne.key!==null?ie.set(ne.key,ne):ie.set(ne.index,ne),ne=ne.sibling;return ie}function w(ie,ne){return ie=Ds(ie,ne),ie.index=0,ie.sibling=null,ie}function b(ie,ne,ue){return ie.index=ue,r?(ue=ie.alternate,ue!==null?(ue=ue.index,ue<ne?(ie.flags|=2,ne):ue):(ie.flags|=2,ne)):(ie.flags|=1048576,ne)}function M(ie){return r&&ie.alternate===null&&(ie.flags|=2),ie}function Q(ie,ne,ue,Ne){return ne===null||ne.tag!==6?(ne=ff(ue,ie.mode,Ne),ne.return=ie,ne):(ne=w(ne,ue),ne.return=ie,ne)}function te(ie,ne,ue,Ne){var qe=ue.type;return qe===A?be(ie,ne,ue.props.children,Ne,ue.key):ne!==null&&(ne.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===G&&u0(qe)===ne.type)?(Ne=w(ne,ue.props),Ne.ref=tl(ie,ne,ue),Ne.return=ie,Ne):(Ne=du(ue.type,ue.key,ue.props,null,ie.mode,Ne),Ne.ref=tl(ie,ne,ue),Ne.return=ie,Ne)}function de(ie,ne,ue,Ne){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==ue.containerInfo||ne.stateNode.implementation!==ue.implementation?(ne=pf(ue,ie.mode,Ne),ne.return=ie,ne):(ne=w(ne,ue.children||[]),ne.return=ie,ne)}function be(ie,ne,ue,Ne,qe){return ne===null||ne.tag!==7?(ne=Da(ue,ie.mode,Ne,qe),ne.return=ie,ne):(ne=w(ne,ue),ne.return=ie,ne)}function ke(ie,ne,ue){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=ff(""+ne,ie.mode,ue),ne.return=ie,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case T:return ue=du(ne.type,ne.key,ne.props,null,ie.mode,ue),ue.ref=tl(ie,null,ne),ue.return=ie,ue;case R:return ne=pf(ne,ie.mode,ue),ne.return=ie,ne;case G:var Ne=ne._init;return ke(ie,Ne(ne._payload),ue)}if(st(ne)||L(ne))return ne=Da(ne,ie.mode,ue,null),ne.return=ie,ne;Bc(ie,ne)}return null}function ve(ie,ne,ue,Ne){var qe=ne!==null?ne.key:null;if(typeof ue=="string"&&ue!==""||typeof ue=="number")return qe!==null?null:Q(ie,ne,""+ue,Ne);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case T:return ue.key===qe?te(ie,ne,ue,Ne):null;case R:return ue.key===qe?de(ie,ne,ue,Ne):null;case G:return qe=ue._init,ve(ie,ne,qe(ue._payload),Ne)}if(st(ue)||L(ue))return qe!==null?null:be(ie,ne,ue,Ne,null);Bc(ie,ue)}return null}function Ae(ie,ne,ue,Ne,qe){if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number")return ie=ie.get(ue)||null,Q(ne,ie,""+Ne,qe);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case T:return ie=ie.get(Ne.key===null?ue:Ne.key)||null,te(ne,ie,Ne,qe);case R:return ie=ie.get(Ne.key===null?ue:Ne.key)||null,de(ne,ie,Ne,qe);case G:var We=Ne._init;return Ae(ie,ne,ue,We(Ne._payload),qe)}if(st(Ne)||L(Ne))return ie=ie.get(ue)||null,be(ne,ie,Ne,qe,null);Bc(ne,Ne)}return null}function Oe(ie,ne,ue,Ne){for(var qe=null,We=null,He=ne,Ke=ne=0,Ht=null;He!==null&&Ke<ue.length;Ke++){He.index>Ke?(Ht=He,He=null):Ht=He.sibling;var lt=ve(ie,He,ue[Ke],Ne);if(lt===null){He===null&&(He=Ht);break}r&&He&<.alternate===null&&o(ie,He),ne=b(lt,ne,Ke),We===null?qe=lt:We.sibling=lt,We=lt,He=Ht}if(Ke===ue.length)return u(ie,He),bt&&Aa(ie,Ke),qe;if(He===null){for(;Ke<ue.length;Ke++)He=ke(ie,ue[Ke],Ne),He!==null&&(ne=b(He,ne,Ke),We===null?qe=He:We.sibling=He,We=He);return bt&&Aa(ie,Ke),qe}for(He=g(ie,He);Ke<ue.length;Ke++)Ht=Ae(He,ie,Ke,ue[Ke],Ne),Ht!==null&&(r&&Ht.alternate!==null&&He.delete(Ht.key===null?Ke:Ht.key),ne=b(Ht,ne,Ke),We===null?qe=Ht:We.sibling=Ht,We=Ht);return r&&He.forEach(function(qs){return o(ie,qs)}),bt&&Aa(ie,Ke),qe}function Le(ie,ne,ue,Ne){var qe=L(ue);if(typeof qe!="function")throw Error(n(150));if(ue=qe.call(ue),ue==null)throw Error(n(151));for(var We=qe=null,He=ne,Ke=ne=0,Ht=null,lt=ue.next();He!==null&&!lt.done;Ke++,lt=ue.next()){He.index>Ke?(Ht=He,He=null):Ht=He.sibling;var qs=ve(ie,He,lt.value,Ne);if(qs===null){He===null&&(He=Ht);break}r&&He&&qs.alternate===null&&o(ie,He),ne=b(qs,ne,Ke),We===null?qe=qs:We.sibling=qs,We=qs,He=Ht}if(lt.done)return u(ie,He),bt&&Aa(ie,Ke),qe;if(He===null){for(;!lt.done;Ke++,lt=ue.next())lt=ke(ie,lt.value,Ne),lt!==null&&(ne=b(lt,ne,Ke),We===null?qe=lt:We.sibling=lt,We=lt);return bt&&Aa(ie,Ke),qe}for(He=g(ie,He);!lt.done;Ke++,lt=ue.next())lt=Ae(He,ie,Ke,lt.value,Ne),lt!==null&&(r&<.alternate!==null&&He.delete(lt.key===null?Ke:lt.key),ne=b(lt,ne,Ke),We===null?qe=lt:We.sibling=lt,We=lt);return r&&He.forEach(function(tM){return o(ie,tM)}),bt&&Aa(ie,Ke),qe}function Ct(ie,ne,ue,Ne){if(typeof ue=="object"&&ue!==null&&ue.type===A&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case T:e:{for(var qe=ue.key,We=ne;We!==null;){if(We.key===qe){if(qe=ue.type,qe===A){if(We.tag===7){u(ie,We.sibling),ne=w(We,ue.props.children),ne.return=ie,ie=ne;break e}}else if(We.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===G&&u0(qe)===We.type){u(ie,We.sibling),ne=w(We,ue.props),ne.ref=tl(ie,We,ue),ne.return=ie,ie=ne;break e}u(ie,We);break}else o(ie,We);We=We.sibling}ue.type===A?(ne=Da(ue.props.children,ie.mode,Ne,ue.key),ne.return=ie,ie=ne):(Ne=du(ue.type,ue.key,ue.props,null,ie.mode,Ne),Ne.ref=tl(ie,ne,ue),Ne.return=ie,ie=Ne)}return M(ie);case R:e:{for(We=ue.key;ne!==null;){if(ne.key===We)if(ne.tag===4&&ne.stateNode.containerInfo===ue.containerInfo&&ne.stateNode.implementation===ue.implementation){u(ie,ne.sibling),ne=w(ne,ue.children||[]),ne.return=ie,ie=ne;break e}else{u(ie,ne);break}else o(ie,ne);ne=ne.sibling}ne=pf(ue,ie.mode,Ne),ne.return=ie,ie=ne}return M(ie);case G:return We=ue._init,Ct(ie,ne,We(ue._payload),Ne)}if(st(ue))return Oe(ie,ne,ue,Ne);if(L(ue))return Le(ie,ne,ue,Ne);Bc(ie,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"?(ue=""+ue,ne!==null&&ne.tag===6?(u(ie,ne.sibling),ne=w(ne,ue),ne.return=ie,ie=ne):(u(ie,ne),ne=ff(ue,ie.mode,Ne),ne.return=ie,ie=ne),M(ie)):u(ie,ne)}return Ct}var $o=d0(!0),h0=d0(!1),zc=Cs(null),Uc=null,Oo=null,kh=null;function _h(){kh=Oo=Uc=null}function Nh(r){var o=zc.current;vt(zc),r._currentValue=o}function Sh(r,o,u){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===u)break;r=r.return}}function Po(r,o){Uc=r,kh=Oo=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(yn=!0),r.firstContext=null)}function Fn(r){var o=r._currentValue;if(kh!==r)if(r={context:r,memoizedValue:o,next:null},Oo===null){if(Uc===null)throw Error(n(308));Oo=r,Uc.dependencies={lanes:0,firstContext:r}}else Oo=Oo.next=r;return o}var Ra=null;function jh(r){Ra===null?Ra=[r]:Ra.push(r)}function f0(r,o,u,g){var w=o.interleaved;return w===null?(u.next=u,jh(o)):(u.next=w.next,w.next=u),o.interleaved=u,as(r,g)}function as(r,o){r.lanes|=o;var u=r.alternate;for(u!==null&&(u.lanes|=o),u=r,r=r.return;r!==null;)r.childLanes|=o,u=r.alternate,u!==null&&(u.childLanes|=o),u=r,r=r.return;return u.tag===3?u.stateNode:null}var Rs=!1;function Eh(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function p0(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 os(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Ms(r,o,u){var g=r.updateQueue;if(g===null)return null;if(g=g.shared,(it&2)!==0){var w=g.pending;return w===null?o.next=o:(o.next=w.next,w.next=o),g.pending=o,as(r,u)}return w=g.interleaved,w===null?(o.next=o,jh(g)):(o.next=w.next,w.next=o),g.interleaved=o,as(r,u)}function Wc(r,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194240)!==0)){var g=o.lanes;g&=r.pendingLanes,u|=g,o.lanes=u,io(r,u)}}function m0(r,o){var u=r.updateQueue,g=r.alternate;if(g!==null&&(g=g.updateQueue,u===g)){var w=null,b=null;if(u=u.firstBaseUpdate,u!==null){do{var M={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};b===null?w=b=M:b=b.next=M,u=u.next}while(u!==null);b===null?w=b=o:b=b.next=o}else w=b=o;u={baseState:g.baseState,firstBaseUpdate:w,lastBaseUpdate:b,shared:g.shared,effects:g.effects},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=o:r.next=o,u.lastBaseUpdate=o}function Hc(r,o,u,g){var w=r.updateQueue;Rs=!1;var b=w.firstBaseUpdate,M=w.lastBaseUpdate,Q=w.shared.pending;if(Q!==null){w.shared.pending=null;var te=Q,de=te.next;te.next=null,M===null?b=de:M.next=de,M=te;var be=r.alternate;be!==null&&(be=be.updateQueue,Q=be.lastBaseUpdate,Q!==M&&(Q===null?be.firstBaseUpdate=de:Q.next=de,be.lastBaseUpdate=te))}if(b!==null){var ke=w.baseState;M=0,be=de=te=null,Q=b;do{var ve=Q.lane,Ae=Q.eventTime;if((g&ve)===ve){be!==null&&(be=be.next={eventTime:Ae,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var Oe=r,Le=Q;switch(ve=o,Ae=u,Le.tag){case 1:if(Oe=Le.payload,typeof Oe=="function"){ke=Oe.call(Ae,ke,ve);break e}ke=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=Le.payload,ve=typeof Oe=="function"?Oe.call(Ae,ke,ve):Oe,ve==null)break e;ke=K({},ke,ve);break e;case 2:Rs=!0}}Q.callback!==null&&Q.lane!==0&&(r.flags|=64,ve=w.effects,ve===null?w.effects=[Q]:ve.push(Q))}else Ae={eventTime:Ae,lane:ve,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},be===null?(de=be=Ae,te=ke):be=be.next=Ae,M|=ve;if(Q=Q.next,Q===null){if(Q=w.shared.pending,Q===null)break;ve=Q,Q=ve.next,ve.next=null,w.lastBaseUpdate=ve,w.shared.pending=null}}while(!0);if(be===null&&(te=ke),w.baseState=te,w.firstBaseUpdate=de,w.lastBaseUpdate=be,o=w.shared.interleaved,o!==null){w=o;do M|=w.lane,w=w.next;while(w!==o)}else b===null&&(w.shared.lanes=0);$a|=M,r.lanes=M,r.memoizedState=ke}}function g0(r,o,u){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var g=r[o],w=g.callback;if(w!==null){if(g.callback=null,g=u,typeof w!="function")throw Error(n(191,w));w.call(g)}}}var nl={},Rr=Cs(nl),rl=Cs(nl),sl=Cs(nl);function Ma(r){if(r===nl)throw Error(n(174));return r}function Ch(r,o){switch(yt(sl,o),yt(rl,r),yt(Rr,nl),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:Pe(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=Pe(o,r)}vt(Rr),yt(Rr,o)}function Lo(){vt(Rr),vt(rl),vt(sl)}function y0(r){Ma(sl.current);var o=Ma(Rr.current),u=Pe(o,r.type);o!==u&&(yt(rl,r),yt(Rr,u))}function Th(r){rl.current===r&&(vt(Rr),vt(rl))}var _t=Cs(0);function Gc(r){for(var o=r;o!==null;){if(o.tag===13){var u=o.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.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 Ah=[];function Rh(){for(var r=0;r<Ah.length;r++)Ah[r]._workInProgressVersionPrimary=null;Ah.length=0}var Vc=C.ReactCurrentDispatcher,Mh=C.ReactCurrentBatchConfig,Ia=0,Nt=null,Pt=null,Ut=null,Yc=!1,al=!1,ol=0,_R=0;function rn(){throw Error(n(321))}function Ih(r,o){if(o===null)return!1;for(var u=0;u<o.length&&u<r.length;u++)if(!fn(r[u],o[u]))return!1;return!0}function $h(r,o,u,g,w,b){if(Ia=b,Nt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Vc.current=r===null||r.memoizedState===null?ER:CR,r=u(g,w),al){b=0;do{if(al=!1,ol=0,25<=b)throw Error(n(301));b+=1,Ut=Pt=null,o.updateQueue=null,Vc.current=TR,r=u(g,w)}while(al)}if(Vc.current=Qc,o=Pt!==null&&Pt.next!==null,Ia=0,Ut=Pt=Nt=null,Yc=!1,o)throw Error(n(300));return r}function Oh(){var r=ol!==0;return ol=0,r}function Mr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ut===null?Nt.memoizedState=Ut=r:Ut=Ut.next=r,Ut}function Bn(){if(Pt===null){var r=Nt.alternate;r=r!==null?r.memoizedState:null}else r=Pt.next;var o=Ut===null?Nt.memoizedState:Ut.next;if(o!==null)Ut=o,Pt=r;else{if(r===null)throw Error(n(310));Pt=r,r={memoizedState:Pt.memoizedState,baseState:Pt.baseState,baseQueue:Pt.baseQueue,queue:Pt.queue,next:null},Ut===null?Nt.memoizedState=Ut=r:Ut=Ut.next=r}return Ut}function il(r,o){return typeof o=="function"?o(r):o}function Ph(r){var o=Bn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var g=Pt,w=g.baseQueue,b=u.pending;if(b!==null){if(w!==null){var M=w.next;w.next=b.next,b.next=M}g.baseQueue=w=b,u.pending=null}if(w!==null){b=w.next,g=g.baseState;var Q=M=null,te=null,de=b;do{var be=de.lane;if((Ia&be)===be)te!==null&&(te=te.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 ke={lane:be,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};te===null?(Q=te=ke,M=g):te=te.next=ke,Nt.lanes|=be,$a|=be}de=de.next}while(de!==null&&de!==b);te===null?M=g:te.next=Q,fn(g,o.memoizedState)||(yn=!0),o.memoizedState=g,o.baseState=M,o.baseQueue=te,u.lastRenderedState=g}if(r=u.interleaved,r!==null){w=r;do b=w.lane,Nt.lanes|=b,$a|=b,w=w.next;while(w!==r)}else w===null&&(u.lanes=0);return[o.memoizedState,u.dispatch]}function Lh(r){var o=Bn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var g=u.dispatch,w=u.pending,b=o.memoizedState;if(w!==null){u.pending=null;var M=w=w.next;do b=r(b,M.action),M=M.next;while(M!==w);fn(b,o.memoizedState)||(yn=!0),o.memoizedState=b,o.baseQueue===null&&(o.baseState=b),u.lastRenderedState=b}return[b,g]}function w0(){}function v0(r,o){var u=Nt,g=Bn(),w=o(),b=!fn(g.memoizedState,w);if(b&&(g.memoizedState=w,yn=!0),g=g.queue,Dh(k0.bind(null,u,g,r),[r]),g.getSnapshot!==o||b||Ut!==null&&Ut.memoizedState.tag&1){if(u.flags|=2048,ll(9,b0.bind(null,u,g,w,o),void 0,null),Wt===null)throw Error(n(349));(Ia&30)!==0||x0(u,o,w)}return w}function x0(r,o,u){r.flags|=16384,r={getSnapshot:o,value:u},o=Nt.updateQueue,o===null?(o={lastEffect:null,stores:null},Nt.updateQueue=o,o.stores=[r]):(u=o.stores,u===null?o.stores=[r]:u.push(r))}function b0(r,o,u,g){o.value=u,o.getSnapshot=g,_0(o)&&N0(r)}function k0(r,o,u){return u(function(){_0(o)&&N0(r)})}function _0(r){var o=r.getSnapshot;r=r.value;try{var u=o();return!fn(r,u)}catch{return!0}}function N0(r){var o=as(r,1);o!==null&&ir(o,r,1,-1)}function S0(r){var o=Mr();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:il,lastRenderedState:r},o.queue=r,r=r.dispatch=jR.bind(null,Nt,r),[o.memoizedState,r]}function ll(r,o,u,g){return r={tag:r,create:o,destroy:u,deps:g,next:null},o=Nt.updateQueue,o===null?(o={lastEffect:null,stores:null},Nt.updateQueue=o,o.lastEffect=r.next=r):(u=o.lastEffect,u===null?o.lastEffect=r.next=r:(g=u.next,u.next=r,r.next=g,o.lastEffect=r)),r}function j0(){return Bn().memoizedState}function Kc(r,o,u,g){var w=Mr();Nt.flags|=r,w.memoizedState=ll(1|o,u,void 0,g===void 0?null:g)}function Xc(r,o,u,g){var w=Bn();g=g===void 0?null:g;var b=void 0;if(Pt!==null){var M=Pt.memoizedState;if(b=M.destroy,g!==null&&Ih(g,M.deps)){w.memoizedState=ll(o,u,b,g);return}}Nt.flags|=r,w.memoizedState=ll(1|o,u,b,g)}function E0(r,o){return Kc(8390656,8,r,o)}function Dh(r,o){return Xc(2048,8,r,o)}function C0(r,o){return Xc(4,2,r,o)}function T0(r,o){return Xc(4,4,r,o)}function A0(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 R0(r,o,u){return u=u!=null?u.concat([r]):null,Xc(4,4,A0.bind(null,o,r),u)}function qh(){}function M0(r,o){var u=Bn();o=o===void 0?null:o;var g=u.memoizedState;return g!==null&&o!==null&&Ih(o,g[1])?g[0]:(u.memoizedState=[r,o],r)}function I0(r,o){var u=Bn();o=o===void 0?null:o;var g=u.memoizedState;return g!==null&&o!==null&&Ih(o,g[1])?g[0]:(r=r(),u.memoizedState=[r,o],r)}function $0(r,o,u){return(Ia&21)===0?(r.baseState&&(r.baseState=!1,yn=!0),r.memoizedState=u):(fn(u,o)||(u=Tt(),Nt.lanes|=u,$a|=u,r.baseState=!0),o)}function NR(r,o){var u=ct;ct=u!==0&&4>u?u:4,r(!0);var g=Mh.transition;Mh.transition={};try{r(!1),o()}finally{ct=u,Mh.transition=g}}function O0(){return Bn().memoizedState}function SR(r,o,u){var g=Ps(r);if(u={lane:g,action:u,hasEagerState:!1,eagerState:null,next:null},P0(r))L0(o,u);else if(u=f0(r,o,u,g),u!==null){var w=un();ir(u,r,g,w),D0(u,o,g)}}function jR(r,o,u){var g=Ps(r),w={lane:g,action:u,hasEagerState:!1,eagerState:null,next:null};if(P0(r))L0(o,w);else{var b=r.alternate;if(r.lanes===0&&(b===null||b.lanes===0)&&(b=o.lastRenderedReducer,b!==null))try{var M=o.lastRenderedState,Q=b(M,u);if(w.hasEagerState=!0,w.eagerState=Q,fn(Q,M)){var te=o.interleaved;te===null?(w.next=w,jh(o)):(w.next=te.next,te.next=w),o.interleaved=w;return}}catch{}finally{}u=f0(r,o,w,g),u!==null&&(w=un(),ir(u,r,g,w),D0(u,o,g))}}function P0(r){var o=r.alternate;return r===Nt||o!==null&&o===Nt}function L0(r,o){al=Yc=!0;var u=r.pending;u===null?o.next=o:(o.next=u.next,u.next=o),r.pending=o}function D0(r,o,u){if((u&4194240)!==0){var g=o.lanes;g&=r.pendingLanes,u|=g,o.lanes=u,io(r,u)}}var Qc={readContext:Fn,useCallback:rn,useContext:rn,useEffect:rn,useImperativeHandle:rn,useInsertionEffect:rn,useLayoutEffect:rn,useMemo:rn,useReducer:rn,useRef:rn,useState:rn,useDebugValue:rn,useDeferredValue:rn,useTransition:rn,useMutableSource:rn,useSyncExternalStore:rn,useId:rn,unstable_isNewReconciler:!1},ER={readContext:Fn,useCallback:function(r,o){return Mr().memoizedState=[r,o===void 0?null:o],r},useContext:Fn,useEffect:E0,useImperativeHandle:function(r,o,u){return u=u!=null?u.concat([r]):null,Kc(4194308,4,A0.bind(null,o,r),u)},useLayoutEffect:function(r,o){return Kc(4194308,4,r,o)},useInsertionEffect:function(r,o){return Kc(4,2,r,o)},useMemo:function(r,o){var u=Mr();return o=o===void 0?null:o,r=r(),u.memoizedState=[r,o],r},useReducer:function(r,o,u){var g=Mr();return o=u!==void 0?u(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=SR.bind(null,Nt,r),[g.memoizedState,r]},useRef:function(r){var o=Mr();return r={current:r},o.memoizedState=r},useState:S0,useDebugValue:qh,useDeferredValue:function(r){return Mr().memoizedState=r},useTransition:function(){var r=S0(!1),o=r[0];return r=NR.bind(null,r[1]),Mr().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,u){var g=Nt,w=Mr();if(bt){if(u===void 0)throw Error(n(407));u=u()}else{if(u=o(),Wt===null)throw Error(n(349));(Ia&30)!==0||x0(g,o,u)}w.memoizedState=u;var b={value:u,getSnapshot:o};return w.queue=b,E0(k0.bind(null,g,b,r),[r]),g.flags|=2048,ll(9,b0.bind(null,g,b,u,o),void 0,null),u},useId:function(){var r=Mr(),o=Wt.identifierPrefix;if(bt){var u=ss,g=rs;u=(g&~(1<<32-dn(g)-1)).toString(32)+u,o=":"+o+"R"+u,u=ol++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=_R++,o=":"+o+"r"+u.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},CR={readContext:Fn,useCallback:M0,useContext:Fn,useEffect:Dh,useImperativeHandle:R0,useInsertionEffect:C0,useLayoutEffect:T0,useMemo:I0,useReducer:Ph,useRef:j0,useState:function(){return Ph(il)},useDebugValue:qh,useDeferredValue:function(r){var o=Bn();return $0(o,Pt.memoizedState,r)},useTransition:function(){var r=Ph(il)[0],o=Bn().memoizedState;return[r,o]},useMutableSource:w0,useSyncExternalStore:v0,useId:O0,unstable_isNewReconciler:!1},TR={readContext:Fn,useCallback:M0,useContext:Fn,useEffect:Dh,useImperativeHandle:R0,useInsertionEffect:C0,useLayoutEffect:T0,useMemo:I0,useReducer:Lh,useRef:j0,useState:function(){return Lh(il)},useDebugValue:qh,useDeferredValue:function(r){var o=Bn();return Pt===null?o.memoizedState=r:$0(o,Pt.memoizedState,r)},useTransition:function(){var r=Lh(il)[0],o=Bn().memoizedState;return[r,o]},useMutableSource:w0,useSyncExternalStore:v0,useId:O0,unstable_isNewReconciler:!1};function sr(r,o){if(r&&r.defaultProps){o=K({},o),r=r.defaultProps;for(var u in r)o[u]===void 0&&(o[u]=r[u]);return o}return o}function Fh(r,o,u,g){o=r.memoizedState,u=u(g,o),u=u==null?o:K({},o,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Zc={isMounted:function(r){return(r=r._reactInternals)?In(r)===r:!1},enqueueSetState:function(r,o,u){r=r._reactInternals;var g=un(),w=Ps(r),b=os(g,w);b.payload=o,u!=null&&(b.callback=u),o=Ms(r,b,w),o!==null&&(ir(o,r,w,g),Wc(o,r,w))},enqueueReplaceState:function(r,o,u){r=r._reactInternals;var g=un(),w=Ps(r),b=os(g,w);b.tag=1,b.payload=o,u!=null&&(b.callback=u),o=Ms(r,b,w),o!==null&&(ir(o,r,w,g),Wc(o,r,w))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var u=un(),g=Ps(r),w=os(u,g);w.tag=2,o!=null&&(w.callback=o),o=Ms(r,w,g),o!==null&&(ir(o,r,g,u),Wc(o,r,g))}};function q0(r,o,u,g,w,b,M){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(g,b,M):o.prototype&&o.prototype.isPureReactComponent?!At(u,g)||!At(w,b):!0}function F0(r,o,u){var g=!1,w=Ts,b=o.contextType;return typeof b=="object"&&b!==null?b=Fn(b):(w=gn(o)?Ca:nn.current,g=o.contextTypes,b=(g=g!=null)?Ao(r,w):Ts),o=new o(u,b),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Zc,r.stateNode=o,o._reactInternals=r,g&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=w,r.__reactInternalMemoizedMaskedChildContext=b),o}function B0(r,o,u,g){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,g),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,g),o.state!==r&&Zc.enqueueReplaceState(o,o.state,null)}function Bh(r,o,u,g){var w=r.stateNode;w.props=u,w.state=r.memoizedState,w.refs={},Eh(r);var b=o.contextType;typeof b=="object"&&b!==null?w.context=Fn(b):(b=gn(o)?Ca:nn.current,w.context=Ao(r,b)),w.state=r.memoizedState,b=o.getDerivedStateFromProps,typeof b=="function"&&(Fh(r,o,b,u),w.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(o=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),o!==w.state&&Zc.enqueueReplaceState(w,w.state,null),Hc(r,u,w,g),w.state=r.memoizedState),typeof w.componentDidMount=="function"&&(r.flags|=4194308)}function Do(r,o){try{var u="",g=o;do u+=W(g),g=g.return;while(g);var w=u}catch(b){w=`
|
|
37
|
+
`+w[M].replace(" at new "," at ");return r.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",r.displayName)),te}while(1<=M&&0<=Q);break}}}finally{he=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?V(r):""}function W(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=U(r.type,!1),r;case 11:return r=U(r.type.render,!1),r;case 1:return r=U(r.type,!0),r;default:return""}}function ee(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 A:return"Fragment";case R:return"Portal";case O:return"Profiler";case D:return"StrictMode";case J:return"Suspense";case I:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case F:return(r.displayName||"Context")+".Consumer";case $: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 X:return o=r.displayName||null,o!==null?o:ee(r.type)||"Memo";case G:o=r._payload,r=r._init;try{return ee(r(o))}catch{}}return null}function H(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 ee(o);case 8:return o===D?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function ae(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",u=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),g=""+r[o];if(!r.hasOwnProperty(o)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var w=u.get,b=u.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return w.call(this)},set:function(M){g=""+M,b.call(this,M)}}),Object.defineProperty(r,o,{enumerable:u.enumerable}),{getValue:function(){return g},setValue:function(M){g=""+M},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Re(r){r._valueTracker||(r._valueTracker=ge(r))}function $e(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var u=o.getValue(),g="";return r&&(g=me(r)?r.checked?"true":"false":r.value),r=g,r!==u?(o.setValue(r),!0):!1}function ce(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 we(r,o){var u=o.checked;return K({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??r._wrapperState.initialChecked})}function xe(r,o){var u=o.defaultValue==null?"":o.defaultValue,g=o.checked!=null?o.checked:o.defaultChecked;u=ae(o.value!=null?o.value:u),r._wrapperState={initialChecked:g,initialValue:u,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function De(r,o){o=o.checked,o!=null&&E(r,"checked",o,!1)}function _e(r,o){De(r,o);var u=ae(o.value),g=o.type;if(u!=null)g==="number"?(u===0&&r.value===""||r.value!=u)&&(r.value=""+u):r.value!==""+u&&(r.value=""+u);else if(g==="submit"||g==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Ge(r,o.type,u):o.hasOwnProperty("defaultValue")&&Ge(r,o.type,ae(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function Ee(r,o,u){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,u||o===r.value||(r.value=o),r.defaultValue=o}u=r.name,u!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,u!==""&&(r.name=u)}function Ge(r,o,u){(o!=="number"||ce(r.ownerDocument)!==r)&&(u==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+u&&(r.defaultValue=""+u))}var st=Array.isArray;function Je(r,o,u,g){if(r=r.options,o){o={};for(var w=0;w<u.length;w++)o["$"+u[w]]=!0;for(u=0;u<r.length;u++)w=o.hasOwnProperty("$"+r[u].value),r[u].selected!==w&&(r[u].selected=w),w&&g&&(r[u].defaultSelected=!0)}else{for(u=""+ae(u),o=null,w=0;w<r.length;w++){if(r[w].value===u){r[w].selected=!0,g&&(r[w].defaultSelected=!0);return}o!==null||r[w].disabled||(o=r[w])}o!==null&&(o.selected=!0)}}function Ze(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return K({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Qe(r,o){var u=o.value;if(u==null){if(u=o.children,o=o.defaultValue,u!=null){if(o!=null)throw Error(n(92));if(st(u)){if(1<u.length)throw Error(n(93));u=u[0]}o=u}o==null&&(o=""),u=o}r._wrapperState={initialValue:ae(u)}}function fe(r,o){var u=ae(o.value),g=ae(o.defaultValue);u!=null&&(u=""+u,u!==r.value&&(r.value=u),o.defaultValue==null&&r.defaultValue!==u&&(r.defaultValue=u)),g!=null&&(r.defaultValue=""+g)}function ye(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function Se(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 Pe(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?Se(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var et,ft=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,u,g,w){MSApp.execUnsafeLocalFunction(function(){return r(o,u,g,w)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(et=et||document.createElement("div"),et.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=et.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function dt(r,o){if(o){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=o;return}}r.textContent=o}var ze={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},Xe=["Webkit","ms","Moz","O"];Object.keys(ze).forEach(function(r){Xe.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),ze[o]=ze[r]})});function re(r,o,u){return o==null||typeof o=="boolean"||o===""?"":u||typeof o!="number"||o===0||ze.hasOwnProperty(r)&&ze[r]?(""+o).trim():o+"px"}function Fe(r,o){r=r.style;for(var u in o)if(o.hasOwnProperty(u)){var g=u.indexOf("--")===0,w=re(u,o[u],g);u==="float"&&(u="cssFloat"),g?r.setProperty(u,w):r[u]=w}}var se=K({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ce(r,o){if(o){if(se[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 Ve(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 gt=null;function xt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Te=null,tt=null,pt=null;function wt(r){if(r=tl(r)){if(typeof Te!="function")throw Error(n(280));var o=r.stateNode;o&&(o=$c(o),Te(r.stateNode,r.type,o))}}function Yt(r){tt?pt?pt.push(r):pt=[r]:tt=r}function Fr(){if(tt){var r=tt,o=pt;if(pt=tt=null,wt(r),o)for(r=0;r<o.length;r++)wt(o[r])}}function Qn(r,o){return r(o)}function Br(){}var Zn=!1;function to(r,o,u){if(Zn)return r(o,u);Zn=!0;try{return Qn(r,o,u)}finally{Zn=!1,(tt!==null||pt!==null)&&(Br(),Fr())}}function zr(r,o){var u=r.stateNode;if(u===null)return null;var g=$c(u);if(g===null)return null;u=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(u&&typeof u!="function")throw Error(n(231,o,typeof u));return u}var Xs=!1;if(d)try{var Ur={};Object.defineProperty(Ur,"passive",{get:function(){Xs=!0}}),window.addEventListener("test",Ur,Ur),window.removeEventListener("test",Ur,Ur)}catch{Xs=!1}function Mn(r,o,u,g,w,b,M,Q,te){var de=Array.prototype.slice.call(arguments,3);try{o.apply(u,de)}catch(be){this.onError(be)}}var Wr=!1,ys=null,Ft=!1,vr=null,Qs={onError:function(r){Wr=!0,ys=r}};function Ni(r,o,u,g,w,b,M,Q,te){Wr=!1,ys=null,Mn.apply(Qs,arguments)}function no(r,o,u,g,w,b,M,Q,te){if(Ni.apply(this,arguments),Wr){if(Wr){var de=ys;Wr=!1,ys=null}else throw Error(n(198));Ft||(Ft=!0,vr=de)}}function In(r){var o=r,u=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(u=o.return),r=o.return;while(r)}return o.tag===3?u:null}function Zs(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 Js(r){if(In(r)!==r)throw Error(n(188))}function ea(r){var o=r.alternate;if(!o){if(o=In(r),o===null)throw Error(n(188));return o!==r?null:r}for(var u=r,g=o;;){var w=u.return;if(w===null)break;var b=w.alternate;if(b===null){if(g=w.return,g!==null){u=g;continue}break}if(w.child===b.child){for(b=w.child;b;){if(b===u)return Js(w),r;if(b===g)return Js(w),o;b=b.sibling}throw Error(n(188))}if(u.return!==g.return)u=w,g=b;else{for(var M=!1,Q=w.child;Q;){if(Q===u){M=!0,u=w,g=b;break}if(Q===g){M=!0,g=w,u=b;break}Q=Q.sibling}if(!M){for(Q=b.child;Q;){if(Q===u){M=!0,u=b,g=w;break}if(Q===g){M=!0,g=b,u=w;break}Q=Q.sibling}if(!M)throw Error(n(189))}}if(u.alternate!==g)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?r:o}function ta(r){return r=ea(r),r!==null?na(r):null}function na(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=na(r);if(o!==null)return o;r=r.sibling}return null}var ra=t.unstable_scheduleCallback,ro=t.unstable_cancelCallback,sa=t.unstable_shouldYield,Si=t.unstable_requestPaint,mt=t.unstable_now,so=t.unstable_getCurrentPriorityLevel,aa=t.unstable_ImmediatePriority,Hr=t.unstable_UserBlockingPriority,Gr=t.unstable_NormalPriority,Vr=t.unstable_LowPriority,oa=t.unstable_IdlePriority,Yr=null,Ot=null;function ia(r){if(Ot&&typeof Ot.onCommitFiberRoot=="function")try{Ot.onCommitFiberRoot(Yr,r,void 0,(r.current.flags&128)===128)}catch{}}var dn=Math.clz32?Math.clz32:uc,cc=Math.log,Kd=Math.LN2;function uc(r){return r>>>=0,r===0?32:31-(cc(r)/Kd|0)|0}var xr=64,ao=4194304;function ws(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 en(r,o){var u=r.pendingLanes;if(u===0)return 0;var g=0,w=r.suspendedLanes,b=r.pingedLanes,M=u&268435455;if(M!==0){var Q=M&~w;Q!==0?g=ws(Q):(b&=M,b!==0&&(g=ws(b)))}else M=u&~w,M!==0?g=ws(M):b!==0&&(g=ws(b));if(g===0)return 0;if(o!==0&&o!==g&&(o&w)===0&&(w=g&-g,b=o&-o,w>=b||w===16&&(b&4194240)!==0))return o;if((g&4)!==0&&(g|=u&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=g;0<o;)u=31-dn(o),w=1<<u,g|=r[u],o&=~w;return g}function oo(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 Xd(r,o){for(var u=r.suspendedLanes,g=r.pingedLanes,w=r.expirationTimes,b=r.pendingLanes;0<b;){var M=31-dn(b),Q=1<<M,te=w[M];te===-1?((Q&u)===0||(Q&g)!==0)&&(w[M]=oo(Q,o)):te<=o&&(r.expiredLanes|=Q),b&=~Q}}function la(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Tt(){var r=xr;return xr<<=1,(xr&4194240)===0&&(xr=64),r}function ji(r){for(var o=[],u=0;31>u;u++)o.push(r);return o}function on(r,o,u){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-dn(o),r[o]=u}function io(r,o){var u=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<u;){var w=31-dn(u),b=1<<w;o[w]=0,g[w]=-1,r[w]=-1,u&=~b}}function lo(r,o){var u=r.entangledLanes|=o;for(r=r.entanglements;u;){var g=31-dn(u),w=1<<g;w&o|r[g]&o&&(r[g]|=o),u&=~w}}var ut=0;function Jn(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var ca,Ei,dc,Ci,Ti,br=!1,ua=[],er=null,_n=null,$n=null,vs=new Map,xs=new Map,tr=[],hc="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 tn(r,o){switch(r){case"focusin":case"focusout":er=null;break;case"dragenter":case"dragleave":_n=null;break;case"mouseover":case"mouseout":$n=null;break;case"pointerover":case"pointerout":vs.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":xs.delete(o.pointerId)}}function kr(r,o,u,g,w,b){return r===null||r.nativeEvent!==b?(r={blockedOn:o,domEventName:u,eventSystemFlags:g,nativeEvent:b,targetContainers:[w]},o!==null&&(o=tl(o),o!==null&&Ei(o)),r):(r.eventSystemFlags|=g,o=r.targetContainers,w!==null&&o.indexOf(w)===-1&&o.push(w),r)}function co(r,o,u,g,w){switch(o){case"focusin":return er=kr(er,r,o,u,g,w),!0;case"dragenter":return _n=kr(_n,r,o,u,g,w),!0;case"mouseover":return $n=kr($n,r,o,u,g,w),!0;case"pointerover":var b=w.pointerId;return vs.set(b,kr(vs.get(b)||null,r,o,u,g,w)),!0;case"gotpointercapture":return b=w.pointerId,xs.set(b,kr(xs.get(b)||null,r,o,u,g,w)),!0}return!1}function uo(r){var o=Ca(r.target);if(o!==null){var u=In(o);if(u!==null){if(o=u.tag,o===13){if(o=Zs(u),o!==null){r.blockedOn=o,Ti(r.priority,function(){dc(u)});return}}else if(o===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function ho(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var u=Qr(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(u===null){u=r.nativeEvent;var g=new u.constructor(u.type,u);gt=g,u.target.dispatchEvent(g),gt=null}else return o=tl(u),o!==null&&Ei(o),r.blockedOn=u,!1;o.shift()}return!0}function Kr(r,o,u){ho(r)&&u.delete(o)}function fc(){br=!1,er!==null&&ho(er)&&(er=null),_n!==null&&ho(_n)&&(_n=null),$n!==null&&ho($n)&&($n=null),vs.forEach(Kr),xs.forEach(Kr)}function hn(r,o){r.blockedOn===o&&(r.blockedOn=null,br||(br=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,fc)))}function da(r){function o(w){return hn(w,r)}if(0<ua.length){hn(ua[0],r);for(var u=1;u<ua.length;u++){var g=ua[u];g.blockedOn===r&&(g.blockedOn=null)}}for(er!==null&&hn(er,r),_n!==null&&hn(_n,r),$n!==null&&hn($n,r),vs.forEach(o),xs.forEach(o),u=0;u<tr.length;u++)g=tr[u],g.blockedOn===r&&(g.blockedOn=null);for(;0<tr.length&&(u=tr[0],u.blockedOn===null);)uo(u),u.blockedOn===null&&tr.shift()}var Xr=C.ReactCurrentBatchConfig,fo=!0;function Qd(r,o,u,g){var w=ut,b=Xr.transition;Xr.transition=null;try{ut=1,Ai(r,o,u,g)}finally{ut=w,Xr.transition=b}}function pc(r,o,u,g){var w=ut,b=Xr.transition;Xr.transition=null;try{ut=4,Ai(r,o,u,g)}finally{ut=w,Xr.transition=b}}function Ai(r,o,u,g){if(fo){var w=Qr(r,o,u,g);if(w===null)Ji(r,o,g,On,u),tn(r,g);else if(co(w,r,o,u,g))g.stopPropagation();else if(tn(r,g),o&4&&-1<hc.indexOf(r)){for(;w!==null;){var b=tl(w);if(b!==null&&ca(b),b=Qr(r,o,u,g),b===null&&Ji(r,o,g,On,u),b===w)break;w=b}w!==null&&g.stopPropagation()}else Ji(r,o,g,null,u)}}var On=null;function Qr(r,o,u,g){if(On=null,r=xt(g),r=Ca(r),r!==null)if(o=In(r),o===null)r=null;else if(u=o.tag,u===13){if(r=Zs(o),r!==null)return r;r=null}else if(u===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return On=r,null}function Ri(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(so()){case aa:return 1;case Hr:return 4;case Gr:case Vr:return 16;case oa:return 536870912;default:return 16}default:return 16}}var Pn=null,Nn=null,po=null;function Sn(){if(po)return po;var r,o=Nn,u=o.length,g,w="value"in Pn?Pn.value:Pn.textContent,b=w.length;for(r=0;r<u&&o[r]===w[r];r++);var M=u-r;for(g=1;g<=M&&o[u-g]===w[b-g];g++);return po=w.slice(r,1<g?1-g:void 0)}function bs(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 ks(){return!0}function Mi(){return!1}function Bt(r){function o(u,g,w,b,M){this._reactName=u,this._targetInst=w,this.type=g,this.nativeEvent=b,this.target=M,this.currentTarget=null;for(var Q in r)r.hasOwnProperty(Q)&&(u=r[Q],this[Q]=u?u(b):b[Q]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?ks:Mi,this.isPropagationStopped=Mi,this}return K(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=ks)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=ks)},persist:function(){},isPersistent:ks}),o}var _r={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mo=Bt(_r),Zr=K({},_r,{view:0,detail:0}),mc=Bt(Zr),ha,go,Ln,fa=K({},Zr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ma,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!==Ln&&(Ln&&r.type==="mousemove"?(ha=r.screenX-Ln.screenX,go=r.screenY-Ln.screenY):go=ha=0,Ln=r),ha)},movementY:function(r){return"movementY"in r?r.movementY:go}}),Ii=Bt(fa),$i=K({},fa,{dataTransfer:0}),Zd=Bt($i),Oi=K({},Zr,{relatedTarget:0}),Nr=Bt(Oi),gc=K({},_r,{animationName:0,elapsedTime:0,pseudoElement:0}),Jd=Bt(gc),yc=K({},_r,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),wc=Bt(yc),eh=K({},_r,{data:0}),ln=Bt(eh),th={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Pi={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"},_s={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pa(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=_s[r])?!!o[r]:!1}function ma(){return pa}var Li=K({},Zr,{key:function(r){if(r.key){var o=th[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=bs(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?Pi[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ma,charCode:function(r){return r.type==="keypress"?bs(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?bs(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Di=Bt(Li),yo=K({},fa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qi=Bt(yo),nh=K({},Zr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ma}),rh=Bt(nh),vc=K({},_r,{propertyName:0,elapsedTime:0,pseudoElement:0}),sh=Bt(vc),ah=K({},fa,{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}),Fi=Bt(ah),Sr=[9,13,27,32],ga=d&&"CompositionEvent"in window,Ns=null;d&&"documentMode"in document&&(Ns=document.documentMode);var oh=d&&"TextEvent"in window&&!Ns,xc=d&&(!ga||Ns&&8<Ns&&11>=Ns),Bi=" ",bc=!1;function kc(r,o){switch(r){case"keyup":return Sr.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _c(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ss=!1;function Nc(r,o){switch(r){case"compositionend":return _c(o);case"keypress":return o.which!==32?null:(bc=!0,Bi);case"textInput":return r=o.data,r===Bi&&bc?null:r;default:return null}}function Sc(r,o){if(Ss)return r==="compositionend"||!ga&&kc(r,o)?(r=Sn(),po=Nn=Pn=null,Ss=!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 xc&&o.locale!=="ko"?null:o.data;default:return null}}var jr={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 jc(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!jr[r.type]:o==="textarea"}function zi(r,o,u,g){Yt(g),o=Eo(o,"onChange"),0<o.length&&(u=new mo("onChange","change",null,u,g),r.push({event:u,listeners:o}))}var ya=null,Er=null;function ih(r){it(r,0)}function zt(r){var o=Ao(r);if($e(o))return r}function Ui(r,o){if(r==="change")return o}var Wi=!1;if(d){var wo;if(d){var vo="oninput"in document;if(!vo){var xo=document.createElement("div");xo.setAttribute("oninput","return;"),vo=typeof xo.oninput=="function"}wo=vo}else wo=!1;Wi=wo&&(!document.documentMode||9<document.documentMode)}function wa(){ya&&(ya.detachEvent("onpropertychange",bo),Er=ya=null)}function bo(r){if(r.propertyName==="value"&&zt(Er)){var o=[];zi(o,Er,r,xt(r)),to(ih,o)}}function Ec(r,o,u){r==="focusin"?(wa(),ya=o,Er=u,ya.attachEvent("onpropertychange",bo)):r==="focusout"&&wa()}function ko(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return zt(Er)}function Hi(r,o){if(r==="click")return zt(o)}function _o(r,o){if(r==="input"||r==="change")return zt(o)}function va(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var fn=typeof Object.is=="function"?Object.is:va;function At(r,o){if(fn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var u=Object.keys(r),g=Object.keys(o);if(u.length!==g.length)return!1;for(g=0;g<u.length;g++){var w=u[g];if(!h.call(o,w)||!fn(r[w],o[w]))return!1}return!0}function Gi(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Vi(r,o){var u=Gi(r);r=0;for(var g;u;){if(u.nodeType===3){if(g=r+u.textContent.length,r<=o&&g>=o)return{node:u,offset:o-r};r=g}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Gi(u)}}function Cc(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Cc(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Tc(){for(var r=window,o=ce();o instanceof r.HTMLIFrameElement;){try{var u=typeof o.contentWindow.location.href=="string"}catch{u=!1}if(u)r=o.contentWindow;else break;o=ce(r.document)}return o}function No(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 So(r){var o=Tc(),u=r.focusedElem,g=r.selectionRange;if(o!==u&&u&&u.ownerDocument&&Cc(u.ownerDocument.documentElement,u)){if(g!==null&&No(u)){if(o=g.start,r=g.end,r===void 0&&(r=o),"selectionStart"in u)u.selectionStart=o,u.selectionEnd=Math.min(r,u.value.length);else if(r=(o=u.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var w=u.textContent.length,b=Math.min(g.start,w);g=g.end===void 0?b:Math.min(g.end,w),!r.extend&&b>g&&(w=g,g=b,b=w),w=Vi(u,b);var M=Vi(u,g);w&&M&&(r.rangeCount!==1||r.anchorNode!==w.node||r.anchorOffset!==w.offset||r.focusNode!==M.node||r.focusOffset!==M.offset)&&(o=o.createRange(),o.setStart(w.node,w.offset),r.removeAllRanges(),b>g?(r.addRange(o),r.extend(M.node,M.offset)):(o.setEnd(M.node,M.offset),r.addRange(o)))}}for(o=[],r=u;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<o.length;u++)r=o[u],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var lh=d&&"documentMode"in document&&11>=document.documentMode,pn=null,xa=null,Cr=null,ba=!1;function Ac(r,o,u){var g=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;ba||pn==null||pn!==ce(g)||(g=pn,"selectionStart"in g&&No(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}),Cr&&At(Cr,g)||(Cr=g,g=Eo(xa,"onSelect"),0<g.length&&(o=new mo("onSelect","select",null,o,u),r.push({event:o,listeners:g}),o.target=pn)))}function ka(r,o){var u={};return u[r.toLowerCase()]=o.toLowerCase(),u["Webkit"+r]="webkit"+o,u["Moz"+r]="moz"+o,u}var Jr={animationend:ka("Animation","AnimationEnd"),animationiteration:ka("Animation","AnimationIteration"),animationstart:ka("Animation","AnimationStart"),transitionend:ka("Transition","TransitionEnd")},Yi={},Rc={};d&&(Rc=document.createElement("div").style,"AnimationEvent"in window||(delete Jr.animationend.animation,delete Jr.animationiteration.animation,delete Jr.animationstart.animation),"TransitionEvent"in window||delete Jr.transitionend.transition);function _a(r){if(Yi[r])return Yi[r];if(!Jr[r])return r;var o=Jr[r],u;for(u in o)if(o.hasOwnProperty(u)&&u in Rc)return Yi[r]=o[u];return r}var Na=_a("animationend"),jo=_a("animationiteration"),Mc=_a("animationstart"),Ki=_a("transitionend"),Xi=new Map,Qi="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 nr(r,o){Xi.set(r,o),l(o,[r])}for(var B=0;B<Qi.length;B++){var z=Qi[B],oe=z.toLowerCase(),le=z[0].toUpperCase()+z.slice(1);nr(oe,"on"+le)}nr(Na,"onAnimationEnd"),nr(jo,"onAnimationIteration"),nr(Mc,"onAnimationStart"),nr("dblclick","onDoubleClick"),nr("focusin","onFocus"),nr("focusout","onBlur"),nr(Ki,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var je="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(" "),Me=new Set("cancel close invalid load scroll toggle".split(" ").concat(je));function Ue(r,o,u){var g=r.type||"unknown-event";r.currentTarget=u,no(g,o,void 0,r),r.currentTarget=null}function it(r,o){o=(o&4)!==0;for(var u=0;u<r.length;u++){var g=r[u],w=g.event;g=g.listeners;e:{var b=void 0;if(o)for(var M=g.length-1;0<=M;M--){var Q=g[M],te=Q.instance,de=Q.currentTarget;if(Q=Q.listener,te!==b&&w.isPropagationStopped())break e;Ue(w,Q,de),b=te}else for(M=0;M<g.length;M++){if(Q=g[M],te=Q.instance,de=Q.currentTarget,Q=Q.listener,te!==b&&w.isPropagationStopped())break e;Ue(w,Q,de),b=te}}}if(Ft)throw r=vr,Ft=!1,vr=null,r}function Ye(r,o){var u=o[ph];u===void 0&&(u=o[ph]=new Set);var g=r+"__bubble";u.has(g)||(Zi(o,r,2,!1),u.add(g))}function at(r,o,u){var g=0;o&&(g|=4),Zi(u,r,g,o)}var Kt="_reactListening"+Math.random().toString(36).slice(2);function Tr(r){if(!r[Kt]){r[Kt]=!0,s.forEach(function(u){u!=="selectionchange"&&(Me.has(u)||at(u,!1,r),at(u,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[Kt]||(o[Kt]=!0,at("selectionchange",!1,o))}}function Zi(r,o,u,g){switch(Ri(o)){case 1:var w=Qd;break;case 4:w=pc;break;default:w=Ai}u=w.bind(null,o,u,r),w=void 0,!Xs||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(w=!0),g?w!==void 0?r.addEventListener(o,u,{capture:!0,passive:w}):r.addEventListener(o,u,!0):w!==void 0?r.addEventListener(o,u,{passive:w}):r.addEventListener(o,u,!1)}function Ji(r,o,u,g,w){var b=g;if((o&1)===0&&(o&2)===0&&g!==null)e:for(;;){if(g===null)return;var M=g.tag;if(M===3||M===4){var Q=g.stateNode.containerInfo;if(Q===w||Q.nodeType===8&&Q.parentNode===w)break;if(M===4)for(M=g.return;M!==null;){var te=M.tag;if((te===3||te===4)&&(te=M.stateNode.containerInfo,te===w||te.nodeType===8&&te.parentNode===w))return;M=M.return}for(;Q!==null;){if(M=Ca(Q),M===null)return;if(te=M.tag,te===5||te===6){g=b=M;continue e}Q=Q.parentNode}}g=g.return}to(function(){var de=b,be=xt(u),ke=[];e:{var ve=Xi.get(r);if(ve!==void 0){var Ae=mo,Oe=r;switch(r){case"keypress":if(bs(u)===0)break e;case"keydown":case"keyup":Ae=Di;break;case"focusin":Oe="focus",Ae=Nr;break;case"focusout":Oe="blur",Ae=Nr;break;case"beforeblur":case"afterblur":Ae=Nr;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ae=Ii;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ae=Zd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ae=rh;break;case Na:case jo:case Mc:Ae=Jd;break;case Ki:Ae=sh;break;case"scroll":Ae=mc;break;case"wheel":Ae=Fi;break;case"copy":case"cut":case"paste":Ae=wc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ae=qi}var Le=(o&4)!==0,Ct=!Le&&r==="scroll",ie=Le?ve!==null?ve+"Capture":null:ve;Le=[];for(var ne=de,ue;ne!==null;){ue=ne;var Ne=ue.stateNode;if(ue.tag===5&&Ne!==null&&(ue=Ne,ie!==null&&(Ne=zr(ne,ie),Ne!=null&&Le.push(js(ne,Ne,ue)))),Ct)break;ne=ne.return}0<Le.length&&(ve=new Ae(ve,Oe,null,u,be),ke.push({event:ve,listeners:Le}))}}if((o&7)===0){e:{if(ve=r==="mouseover"||r==="pointerover",Ae=r==="mouseout"||r==="pointerout",ve&&u!==gt&&(Oe=u.relatedTarget||u.fromElement)&&(Ca(Oe)||Oe[ts]))break e;if((Ae||ve)&&(ve=be.window===be?be:(ve=be.ownerDocument)?ve.defaultView||ve.parentWindow:window,Ae?(Oe=u.relatedTarget||u.toElement,Ae=de,Oe=Oe?Ca(Oe):null,Oe!==null&&(Ct=In(Oe),Oe!==Ct||Oe.tag!==5&&Oe.tag!==6)&&(Oe=null)):(Ae=null,Oe=de),Ae!==Oe)){if(Le=Ii,Ne="onMouseLeave",ie="onMouseEnter",ne="mouse",(r==="pointerout"||r==="pointerover")&&(Le=qi,Ne="onPointerLeave",ie="onPointerEnter",ne="pointer"),Ct=Ae==null?ve:Ao(Ae),ue=Oe==null?ve:Ao(Oe),ve=new Le(Ne,ne+"leave",Ae,u,be),ve.target=Ct,ve.relatedTarget=ue,Ne=null,Ca(be)===de&&(Le=new Le(ie,ne+"enter",Oe,u,be),Le.target=ue,Le.relatedTarget=Ct,Ne=Le),Ct=Ne,Ae&&Oe)t:{for(Le=Ae,ie=Oe,ne=0,ue=Le;ue;ue=es(ue))ne++;for(ue=0,Ne=ie;Ne;Ne=es(Ne))ue++;for(;0<ne-ue;)Le=es(Le),ne--;for(;0<ue-ne;)ie=es(ie),ue--;for(;ne--;){if(Le===ie||ie!==null&&Le===ie.alternate)break t;Le=es(Le),ie=es(ie)}Le=null}else Le=null;Ae!==null&&Co(ke,ve,Ae,Le,!1),Oe!==null&&Ct!==null&&Co(ke,Ct,Oe,Le,!0)}}e:{if(ve=de?Ao(de):window,Ae=ve.nodeName&&ve.nodeName.toLowerCase(),Ae==="select"||Ae==="input"&&ve.type==="file")var qe=Ui;else if(jc(ve))if(Wi)qe=_o;else{qe=ko;var We=Ec}else(Ae=ve.nodeName)&&Ae.toLowerCase()==="input"&&(ve.type==="checkbox"||ve.type==="radio")&&(qe=Hi);if(qe&&(qe=qe(r,de))){zi(ke,qe,u,be);break e}We&&We(r,ve,de),r==="focusout"&&(We=ve._wrapperState)&&We.controlled&&ve.type==="number"&&Ge(ve,"number",ve.value)}switch(We=de?Ao(de):window,r){case"focusin":(jc(We)||We.contentEditable==="true")&&(pn=We,xa=de,Cr=null);break;case"focusout":Cr=xa=pn=null;break;case"mousedown":ba=!0;break;case"contextmenu":case"mouseup":case"dragend":ba=!1,Ac(ke,u,be);break;case"selectionchange":if(lh)break;case"keydown":case"keyup":Ac(ke,u,be)}var He;if(ga)e:{switch(r){case"compositionstart":var Ke="onCompositionStart";break e;case"compositionend":Ke="onCompositionEnd";break e;case"compositionupdate":Ke="onCompositionUpdate";break e}Ke=void 0}else Ss?kc(r,u)&&(Ke="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(Ke="onCompositionStart");Ke&&(xc&&u.locale!=="ko"&&(Ss||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&Ss&&(He=Sn()):(Pn=be,Nn="value"in Pn?Pn.value:Pn.textContent,Ss=!0)),We=Eo(de,Ke),0<We.length&&(Ke=new ln(Ke,r,null,u,be),ke.push({event:Ke,listeners:We}),He?Ke.data=He:(He=_c(u),He!==null&&(Ke.data=He)))),(He=oh?Nc(r,u):Sc(r,u))&&(de=Eo(de,"onBeforeInput"),0<de.length&&(be=new ln("onBeforeInput","beforeinput",null,u,be),ke.push({event:be,listeners:de}),be.data=He))}it(ke,o)})}function js(r,o,u){return{instance:r,listener:o,currentTarget:u}}function Eo(r,o){for(var u=o+"Capture",g=[];r!==null;){var w=r,b=w.stateNode;w.tag===5&&b!==null&&(w=b,b=zr(r,u),b!=null&&g.unshift(js(r,b,w)),b=zr(r,o),b!=null&&g.push(js(r,b,w))),r=r.return}return g}function es(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function Co(r,o,u,g,w){for(var b=o._reactName,M=[];u!==null&&u!==g;){var Q=u,te=Q.alternate,de=Q.stateNode;if(te!==null&&te===g)break;Q.tag===5&&de!==null&&(Q=de,w?(te=zr(u,b),te!=null&&M.unshift(js(u,te,Q))):w||(te=zr(u,b),te!=null&&M.push(js(u,te,Q)))),u=u.return}M.length!==0&&r.push({event:o,listeners:M})}var Sa=/\r\n?/g,ja=/\u0000|\uFFFD/g;function Et(r){return(typeof r=="string"?r:""+r).replace(Sa,`
|
|
38
|
+
`).replace(ja,"")}function Ea(r,o,u){if(o=Et(o),Et(r)!==o&&u)throw Error(n(425))}function Ic(){}var ch=null,uh=null;function dh(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 hh=typeof setTimeout=="function"?setTimeout:void 0,yR=typeof clearTimeout=="function"?clearTimeout:void 0,e0=typeof Promise=="function"?Promise:void 0,wR=typeof queueMicrotask=="function"?queueMicrotask:typeof e0<"u"?function(r){return e0.resolve(null).then(r).catch(vR)}:hh;function vR(r){setTimeout(function(){throw r})}function fh(r,o){var u=o,g=0;do{var w=u.nextSibling;if(r.removeChild(u),w&&w.nodeType===8)if(u=w.data,u==="/$"){if(g===0){r.removeChild(w),da(o);return}g--}else u!=="$"&&u!=="$?"&&u!=="$!"||g++;u=w}while(u);da(o)}function Es(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 t0(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"){if(o===0)return r;o--}else u==="/$"&&o++}r=r.previousSibling}return null}var To=Math.random().toString(36).slice(2),Ar="__reactFiber$"+To,el="__reactProps$"+To,ts="__reactContainer$"+To,ph="__reactEvents$"+To,xR="__reactListeners$"+To,bR="__reactHandles$"+To;function Ca(r){var o=r[Ar];if(o)return o;for(var u=r.parentNode;u;){if(o=u[ts]||u[Ar]){if(u=o.alternate,o.child!==null||u!==null&&u.child!==null)for(r=t0(r);r!==null;){if(u=r[Ar])return u;r=t0(r)}return o}r=u,u=r.parentNode}return null}function tl(r){return r=r[Ar]||r[ts],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Ao(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function $c(r){return r[el]||null}var mh=[],Ro=-1;function Cs(r){return{current:r}}function vt(r){0>Ro||(r.current=mh[Ro],mh[Ro]=null,Ro--)}function yt(r,o){Ro++,mh[Ro]=r.current,r.current=o}var Ts={},nn=Cs(Ts),mn=Cs(!1),Ta=Ts;function Mo(r,o){var u=r.type.contextTypes;if(!u)return Ts;var g=r.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===o)return g.__reactInternalMemoizedMaskedChildContext;var w={},b;for(b in u)w[b]=o[b];return g&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=w),w}function gn(r){return r=r.childContextTypes,r!=null}function Oc(){vt(mn),vt(nn)}function n0(r,o,u){if(nn.current!==Ts)throw Error(n(168));yt(nn,o),yt(mn,u)}function r0(r,o,u){var g=r.stateNode;if(o=o.childContextTypes,typeof g.getChildContext!="function")return u;g=g.getChildContext();for(var w in g)if(!(w in o))throw Error(n(108,H(r)||"Unknown",w));return K({},u,g)}function Pc(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Ts,Ta=nn.current,yt(nn,r),yt(mn,mn.current),!0}function s0(r,o,u){var g=r.stateNode;if(!g)throw Error(n(169));u?(r=r0(r,o,Ta),g.__reactInternalMemoizedMergedChildContext=r,vt(mn),vt(nn),yt(nn,r)):vt(mn),yt(mn,u)}var ns=null,Lc=!1,gh=!1;function a0(r){ns===null?ns=[r]:ns.push(r)}function kR(r){Lc=!0,a0(r)}function As(){if(!gh&&ns!==null){gh=!0;var r=0,o=ut;try{var u=ns;for(ut=1;r<u.length;r++){var g=u[r];do g=g(!0);while(g!==null)}ns=null,Lc=!1}catch(w){throw ns!==null&&(ns=ns.slice(r+1)),ra(aa,As),w}finally{ut=o,gh=!1}}return null}var Io=[],$o=0,Dc=null,qc=0,Dn=[],qn=0,Aa=null,rs=1,ss="";function Ra(r,o){Io[$o++]=qc,Io[$o++]=Dc,Dc=r,qc=o}function o0(r,o,u){Dn[qn++]=rs,Dn[qn++]=ss,Dn[qn++]=Aa,Aa=r;var g=rs;r=ss;var w=32-dn(g)-1;g&=~(1<<w),u+=1;var b=32-dn(o)+w;if(30<b){var M=w-w%5;b=(g&(1<<M)-1).toString(32),g>>=M,w-=M,rs=1<<32-dn(o)+w|u<<w|g,ss=b+r}else rs=1<<b|u<<w|g,ss=r}function yh(r){r.return!==null&&(Ra(r,1),o0(r,1,0))}function wh(r){for(;r===Dc;)Dc=Io[--$o],Io[$o]=null,qc=Io[--$o],Io[$o]=null;for(;r===Aa;)Aa=Dn[--qn],Dn[qn]=null,ss=Dn[--qn],Dn[qn]=null,rs=Dn[--qn],Dn[qn]=null}var jn=null,En=null,bt=!1,rr=null;function i0(r,o){var u=Un(5,null,null,0);u.elementType="DELETED",u.stateNode=o,u.return=r,o=r.deletions,o===null?(r.deletions=[u],r.flags|=16):o.push(u)}function l0(r,o){switch(r.tag){case 5:var u=r.type;return o=o.nodeType!==1||u.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,jn=r,En=Es(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,jn=r,En=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(u=Aa!==null?{id:rs,overflow:ss}:null,r.memoizedState={dehydrated:o,treeContext:u,retryLane:1073741824},u=Un(18,null,null,0),u.stateNode=o,u.return=r,r.child=u,jn=r,En=null,!0):!1;default:return!1}}function vh(r){return(r.mode&1)!==0&&(r.flags&128)===0}function xh(r){if(bt){var o=En;if(o){var u=o;if(!l0(r,o)){if(vh(r))throw Error(n(418));o=Es(u.nextSibling);var g=jn;o&&l0(r,o)?i0(g,u):(r.flags=r.flags&-4097|2,bt=!1,jn=r)}}else{if(vh(r))throw Error(n(418));r.flags=r.flags&-4097|2,bt=!1,jn=r}}}function c0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;jn=r}function Fc(r){if(r!==jn)return!1;if(!bt)return c0(r),bt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!dh(r.type,r.memoizedProps)),o&&(o=En)){if(vh(r))throw u0(),Error(n(418));for(;o;)i0(r,o),o=Es(o.nextSibling)}if(c0(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 u=r.data;if(u==="/$"){if(o===0){En=Es(r.nextSibling);break e}o--}else u!=="$"&&u!=="$!"&&u!=="$?"||o++}r=r.nextSibling}En=null}}else En=jn?Es(r.stateNode.nextSibling):null;return!0}function u0(){for(var r=En;r;)r=Es(r.nextSibling)}function Oo(){En=jn=null,bt=!1}function bh(r){rr===null?rr=[r]:rr.push(r)}var _R=C.ReactCurrentBatchConfig;function nl(r,o,u){if(r=u.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(n(309));var g=u.stateNode}if(!g)throw Error(n(147,r));var w=g,b=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===b?o.ref:(o=function(M){var Q=w.refs;M===null?delete Q[b]:Q[b]=M},o._stringRef=b,o)}if(typeof r!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,r))}return r}function Bc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function d0(r){var o=r._init;return o(r._payload)}function h0(r){function o(ie,ne){if(r){var ue=ie.deletions;ue===null?(ie.deletions=[ne],ie.flags|=16):ue.push(ne)}}function u(ie,ne){if(!r)return null;for(;ne!==null;)o(ie,ne),ne=ne.sibling;return null}function g(ie,ne){for(ie=new Map;ne!==null;)ne.key!==null?ie.set(ne.key,ne):ie.set(ne.index,ne),ne=ne.sibling;return ie}function w(ie,ne){return ie=Ds(ie,ne),ie.index=0,ie.sibling=null,ie}function b(ie,ne,ue){return ie.index=ue,r?(ue=ie.alternate,ue!==null?(ue=ue.index,ue<ne?(ie.flags|=2,ne):ue):(ie.flags|=2,ne)):(ie.flags|=1048576,ne)}function M(ie){return r&&ie.alternate===null&&(ie.flags|=2),ie}function Q(ie,ne,ue,Ne){return ne===null||ne.tag!==6?(ne=ff(ue,ie.mode,Ne),ne.return=ie,ne):(ne=w(ne,ue),ne.return=ie,ne)}function te(ie,ne,ue,Ne){var qe=ue.type;return qe===A?be(ie,ne,ue.props.children,Ne,ue.key):ne!==null&&(ne.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===G&&d0(qe)===ne.type)?(Ne=w(ne,ue.props),Ne.ref=nl(ie,ne,ue),Ne.return=ie,Ne):(Ne=du(ue.type,ue.key,ue.props,null,ie.mode,Ne),Ne.ref=nl(ie,ne,ue),Ne.return=ie,Ne)}function de(ie,ne,ue,Ne){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==ue.containerInfo||ne.stateNode.implementation!==ue.implementation?(ne=pf(ue,ie.mode,Ne),ne.return=ie,ne):(ne=w(ne,ue.children||[]),ne.return=ie,ne)}function be(ie,ne,ue,Ne,qe){return ne===null||ne.tag!==7?(ne=qa(ue,ie.mode,Ne,qe),ne.return=ie,ne):(ne=w(ne,ue),ne.return=ie,ne)}function ke(ie,ne,ue){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=ff(""+ne,ie.mode,ue),ne.return=ie,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case T:return ue=du(ne.type,ne.key,ne.props,null,ie.mode,ue),ue.ref=nl(ie,null,ne),ue.return=ie,ue;case R:return ne=pf(ne,ie.mode,ue),ne.return=ie,ne;case G:var Ne=ne._init;return ke(ie,Ne(ne._payload),ue)}if(st(ne)||L(ne))return ne=qa(ne,ie.mode,ue,null),ne.return=ie,ne;Bc(ie,ne)}return null}function ve(ie,ne,ue,Ne){var qe=ne!==null?ne.key:null;if(typeof ue=="string"&&ue!==""||typeof ue=="number")return qe!==null?null:Q(ie,ne,""+ue,Ne);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case T:return ue.key===qe?te(ie,ne,ue,Ne):null;case R:return ue.key===qe?de(ie,ne,ue,Ne):null;case G:return qe=ue._init,ve(ie,ne,qe(ue._payload),Ne)}if(st(ue)||L(ue))return qe!==null?null:be(ie,ne,ue,Ne,null);Bc(ie,ue)}return null}function Ae(ie,ne,ue,Ne,qe){if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number")return ie=ie.get(ue)||null,Q(ne,ie,""+Ne,qe);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case T:return ie=ie.get(Ne.key===null?ue:Ne.key)||null,te(ne,ie,Ne,qe);case R:return ie=ie.get(Ne.key===null?ue:Ne.key)||null,de(ne,ie,Ne,qe);case G:var We=Ne._init;return Ae(ie,ne,ue,We(Ne._payload),qe)}if(st(Ne)||L(Ne))return ie=ie.get(ue)||null,be(ne,ie,Ne,qe,null);Bc(ne,Ne)}return null}function Oe(ie,ne,ue,Ne){for(var qe=null,We=null,He=ne,Ke=ne=0,Ht=null;He!==null&&Ke<ue.length;Ke++){He.index>Ke?(Ht=He,He=null):Ht=He.sibling;var ct=ve(ie,He,ue[Ke],Ne);if(ct===null){He===null&&(He=Ht);break}r&&He&&ct.alternate===null&&o(ie,He),ne=b(ct,ne,Ke),We===null?qe=ct:We.sibling=ct,We=ct,He=Ht}if(Ke===ue.length)return u(ie,He),bt&&Ra(ie,Ke),qe;if(He===null){for(;Ke<ue.length;Ke++)He=ke(ie,ue[Ke],Ne),He!==null&&(ne=b(He,ne,Ke),We===null?qe=He:We.sibling=He,We=He);return bt&&Ra(ie,Ke),qe}for(He=g(ie,He);Ke<ue.length;Ke++)Ht=Ae(He,ie,Ke,ue[Ke],Ne),Ht!==null&&(r&&Ht.alternate!==null&&He.delete(Ht.key===null?Ke:Ht.key),ne=b(Ht,ne,Ke),We===null?qe=Ht:We.sibling=Ht,We=Ht);return r&&He.forEach(function(qs){return o(ie,qs)}),bt&&Ra(ie,Ke),qe}function Le(ie,ne,ue,Ne){var qe=L(ue);if(typeof qe!="function")throw Error(n(150));if(ue=qe.call(ue),ue==null)throw Error(n(151));for(var We=qe=null,He=ne,Ke=ne=0,Ht=null,ct=ue.next();He!==null&&!ct.done;Ke++,ct=ue.next()){He.index>Ke?(Ht=He,He=null):Ht=He.sibling;var qs=ve(ie,He,ct.value,Ne);if(qs===null){He===null&&(He=Ht);break}r&&He&&qs.alternate===null&&o(ie,He),ne=b(qs,ne,Ke),We===null?qe=qs:We.sibling=qs,We=qs,He=Ht}if(ct.done)return u(ie,He),bt&&Ra(ie,Ke),qe;if(He===null){for(;!ct.done;Ke++,ct=ue.next())ct=ke(ie,ct.value,Ne),ct!==null&&(ne=b(ct,ne,Ke),We===null?qe=ct:We.sibling=ct,We=ct);return bt&&Ra(ie,Ke),qe}for(He=g(ie,He);!ct.done;Ke++,ct=ue.next())ct=Ae(He,ie,Ke,ct.value,Ne),ct!==null&&(r&&ct.alternate!==null&&He.delete(ct.key===null?Ke:ct.key),ne=b(ct,ne,Ke),We===null?qe=ct:We.sibling=ct,We=ct);return r&&He.forEach(function(nM){return o(ie,nM)}),bt&&Ra(ie,Ke),qe}function Ct(ie,ne,ue,Ne){if(typeof ue=="object"&&ue!==null&&ue.type===A&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case T:e:{for(var qe=ue.key,We=ne;We!==null;){if(We.key===qe){if(qe=ue.type,qe===A){if(We.tag===7){u(ie,We.sibling),ne=w(We,ue.props.children),ne.return=ie,ie=ne;break e}}else if(We.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===G&&d0(qe)===We.type){u(ie,We.sibling),ne=w(We,ue.props),ne.ref=nl(ie,We,ue),ne.return=ie,ie=ne;break e}u(ie,We);break}else o(ie,We);We=We.sibling}ue.type===A?(ne=qa(ue.props.children,ie.mode,Ne,ue.key),ne.return=ie,ie=ne):(Ne=du(ue.type,ue.key,ue.props,null,ie.mode,Ne),Ne.ref=nl(ie,ne,ue),Ne.return=ie,ie=Ne)}return M(ie);case R:e:{for(We=ue.key;ne!==null;){if(ne.key===We)if(ne.tag===4&&ne.stateNode.containerInfo===ue.containerInfo&&ne.stateNode.implementation===ue.implementation){u(ie,ne.sibling),ne=w(ne,ue.children||[]),ne.return=ie,ie=ne;break e}else{u(ie,ne);break}else o(ie,ne);ne=ne.sibling}ne=pf(ue,ie.mode,Ne),ne.return=ie,ie=ne}return M(ie);case G:return We=ue._init,Ct(ie,ne,We(ue._payload),Ne)}if(st(ue))return Oe(ie,ne,ue,Ne);if(L(ue))return Le(ie,ne,ue,Ne);Bc(ie,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"?(ue=""+ue,ne!==null&&ne.tag===6?(u(ie,ne.sibling),ne=w(ne,ue),ne.return=ie,ie=ne):(u(ie,ne),ne=ff(ue,ie.mode,Ne),ne.return=ie,ie=ne),M(ie)):u(ie,ne)}return Ct}var Po=h0(!0),f0=h0(!1),zc=Cs(null),Uc=null,Lo=null,kh=null;function _h(){kh=Lo=Uc=null}function Nh(r){var o=zc.current;vt(zc),r._currentValue=o}function Sh(r,o,u){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===u)break;r=r.return}}function Do(r,o){Uc=r,kh=Lo=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(yn=!0),r.firstContext=null)}function Fn(r){var o=r._currentValue;if(kh!==r)if(r={context:r,memoizedValue:o,next:null},Lo===null){if(Uc===null)throw Error(n(308));Lo=r,Uc.dependencies={lanes:0,firstContext:r}}else Lo=Lo.next=r;return o}var Ma=null;function jh(r){Ma===null?Ma=[r]:Ma.push(r)}function p0(r,o,u,g){var w=o.interleaved;return w===null?(u.next=u,jh(o)):(u.next=w.next,w.next=u),o.interleaved=u,as(r,g)}function as(r,o){r.lanes|=o;var u=r.alternate;for(u!==null&&(u.lanes|=o),u=r,r=r.return;r!==null;)r.childLanes|=o,u=r.alternate,u!==null&&(u.childLanes|=o),u=r,r=r.return;return u.tag===3?u.stateNode:null}var Rs=!1;function Eh(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function m0(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 os(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Ms(r,o,u){var g=r.updateQueue;if(g===null)return null;if(g=g.shared,(lt&2)!==0){var w=g.pending;return w===null?o.next=o:(o.next=w.next,w.next=o),g.pending=o,as(r,u)}return w=g.interleaved,w===null?(o.next=o,jh(g)):(o.next=w.next,w.next=o),g.interleaved=o,as(r,u)}function Wc(r,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194240)!==0)){var g=o.lanes;g&=r.pendingLanes,u|=g,o.lanes=u,lo(r,u)}}function g0(r,o){var u=r.updateQueue,g=r.alternate;if(g!==null&&(g=g.updateQueue,u===g)){var w=null,b=null;if(u=u.firstBaseUpdate,u!==null){do{var M={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};b===null?w=b=M:b=b.next=M,u=u.next}while(u!==null);b===null?w=b=o:b=b.next=o}else w=b=o;u={baseState:g.baseState,firstBaseUpdate:w,lastBaseUpdate:b,shared:g.shared,effects:g.effects},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=o:r.next=o,u.lastBaseUpdate=o}function Hc(r,o,u,g){var w=r.updateQueue;Rs=!1;var b=w.firstBaseUpdate,M=w.lastBaseUpdate,Q=w.shared.pending;if(Q!==null){w.shared.pending=null;var te=Q,de=te.next;te.next=null,M===null?b=de:M.next=de,M=te;var be=r.alternate;be!==null&&(be=be.updateQueue,Q=be.lastBaseUpdate,Q!==M&&(Q===null?be.firstBaseUpdate=de:Q.next=de,be.lastBaseUpdate=te))}if(b!==null){var ke=w.baseState;M=0,be=de=te=null,Q=b;do{var ve=Q.lane,Ae=Q.eventTime;if((g&ve)===ve){be!==null&&(be=be.next={eventTime:Ae,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var Oe=r,Le=Q;switch(ve=o,Ae=u,Le.tag){case 1:if(Oe=Le.payload,typeof Oe=="function"){ke=Oe.call(Ae,ke,ve);break e}ke=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=Le.payload,ve=typeof Oe=="function"?Oe.call(Ae,ke,ve):Oe,ve==null)break e;ke=K({},ke,ve);break e;case 2:Rs=!0}}Q.callback!==null&&Q.lane!==0&&(r.flags|=64,ve=w.effects,ve===null?w.effects=[Q]:ve.push(Q))}else Ae={eventTime:Ae,lane:ve,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},be===null?(de=be=Ae,te=ke):be=be.next=Ae,M|=ve;if(Q=Q.next,Q===null){if(Q=w.shared.pending,Q===null)break;ve=Q,Q=ve.next,ve.next=null,w.lastBaseUpdate=ve,w.shared.pending=null}}while(!0);if(be===null&&(te=ke),w.baseState=te,w.firstBaseUpdate=de,w.lastBaseUpdate=be,o=w.shared.interleaved,o!==null){w=o;do M|=w.lane,w=w.next;while(w!==o)}else b===null&&(w.shared.lanes=0);Oa|=M,r.lanes=M,r.memoizedState=ke}}function y0(r,o,u){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var g=r[o],w=g.callback;if(w!==null){if(g.callback=null,g=u,typeof w!="function")throw Error(n(191,w));w.call(g)}}}var rl={},Rr=Cs(rl),sl=Cs(rl),al=Cs(rl);function Ia(r){if(r===rl)throw Error(n(174));return r}function Ch(r,o){switch(yt(al,o),yt(sl,r),yt(Rr,rl),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:Pe(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=Pe(o,r)}vt(Rr),yt(Rr,o)}function qo(){vt(Rr),vt(sl),vt(al)}function w0(r){Ia(al.current);var o=Ia(Rr.current),u=Pe(o,r.type);o!==u&&(yt(sl,r),yt(Rr,u))}function Th(r){sl.current===r&&(vt(Rr),vt(sl))}var _t=Cs(0);function Gc(r){for(var o=r;o!==null;){if(o.tag===13){var u=o.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.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 Ah=[];function Rh(){for(var r=0;r<Ah.length;r++)Ah[r]._workInProgressVersionPrimary=null;Ah.length=0}var Vc=C.ReactCurrentDispatcher,Mh=C.ReactCurrentBatchConfig,$a=0,Nt=null,Pt=null,Ut=null,Yc=!1,ol=!1,il=0,NR=0;function rn(){throw Error(n(321))}function Ih(r,o){if(o===null)return!1;for(var u=0;u<o.length&&u<r.length;u++)if(!fn(r[u],o[u]))return!1;return!0}function $h(r,o,u,g,w,b){if($a=b,Nt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Vc.current=r===null||r.memoizedState===null?CR:TR,r=u(g,w),ol){b=0;do{if(ol=!1,il=0,25<=b)throw Error(n(301));b+=1,Ut=Pt=null,o.updateQueue=null,Vc.current=AR,r=u(g,w)}while(ol)}if(Vc.current=Qc,o=Pt!==null&&Pt.next!==null,$a=0,Ut=Pt=Nt=null,Yc=!1,o)throw Error(n(300));return r}function Oh(){var r=il!==0;return il=0,r}function Mr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ut===null?Nt.memoizedState=Ut=r:Ut=Ut.next=r,Ut}function Bn(){if(Pt===null){var r=Nt.alternate;r=r!==null?r.memoizedState:null}else r=Pt.next;var o=Ut===null?Nt.memoizedState:Ut.next;if(o!==null)Ut=o,Pt=r;else{if(r===null)throw Error(n(310));Pt=r,r={memoizedState:Pt.memoizedState,baseState:Pt.baseState,baseQueue:Pt.baseQueue,queue:Pt.queue,next:null},Ut===null?Nt.memoizedState=Ut=r:Ut=Ut.next=r}return Ut}function ll(r,o){return typeof o=="function"?o(r):o}function Ph(r){var o=Bn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var g=Pt,w=g.baseQueue,b=u.pending;if(b!==null){if(w!==null){var M=w.next;w.next=b.next,b.next=M}g.baseQueue=w=b,u.pending=null}if(w!==null){b=w.next,g=g.baseState;var Q=M=null,te=null,de=b;do{var be=de.lane;if(($a&be)===be)te!==null&&(te=te.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 ke={lane:be,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};te===null?(Q=te=ke,M=g):te=te.next=ke,Nt.lanes|=be,Oa|=be}de=de.next}while(de!==null&&de!==b);te===null?M=g:te.next=Q,fn(g,o.memoizedState)||(yn=!0),o.memoizedState=g,o.baseState=M,o.baseQueue=te,u.lastRenderedState=g}if(r=u.interleaved,r!==null){w=r;do b=w.lane,Nt.lanes|=b,Oa|=b,w=w.next;while(w!==r)}else w===null&&(u.lanes=0);return[o.memoizedState,u.dispatch]}function Lh(r){var o=Bn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var g=u.dispatch,w=u.pending,b=o.memoizedState;if(w!==null){u.pending=null;var M=w=w.next;do b=r(b,M.action),M=M.next;while(M!==w);fn(b,o.memoizedState)||(yn=!0),o.memoizedState=b,o.baseQueue===null&&(o.baseState=b),u.lastRenderedState=b}return[b,g]}function v0(){}function x0(r,o){var u=Nt,g=Bn(),w=o(),b=!fn(g.memoizedState,w);if(b&&(g.memoizedState=w,yn=!0),g=g.queue,Dh(_0.bind(null,u,g,r),[r]),g.getSnapshot!==o||b||Ut!==null&&Ut.memoizedState.tag&1){if(u.flags|=2048,cl(9,k0.bind(null,u,g,w,o),void 0,null),Wt===null)throw Error(n(349));($a&30)!==0||b0(u,o,w)}return w}function b0(r,o,u){r.flags|=16384,r={getSnapshot:o,value:u},o=Nt.updateQueue,o===null?(o={lastEffect:null,stores:null},Nt.updateQueue=o,o.stores=[r]):(u=o.stores,u===null?o.stores=[r]:u.push(r))}function k0(r,o,u,g){o.value=u,o.getSnapshot=g,N0(o)&&S0(r)}function _0(r,o,u){return u(function(){N0(o)&&S0(r)})}function N0(r){var o=r.getSnapshot;r=r.value;try{var u=o();return!fn(r,u)}catch{return!0}}function S0(r){var o=as(r,1);o!==null&&ir(o,r,1,-1)}function j0(r){var o=Mr();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:r},o.queue=r,r=r.dispatch=ER.bind(null,Nt,r),[o.memoizedState,r]}function cl(r,o,u,g){return r={tag:r,create:o,destroy:u,deps:g,next:null},o=Nt.updateQueue,o===null?(o={lastEffect:null,stores:null},Nt.updateQueue=o,o.lastEffect=r.next=r):(u=o.lastEffect,u===null?o.lastEffect=r.next=r:(g=u.next,u.next=r,r.next=g,o.lastEffect=r)),r}function E0(){return Bn().memoizedState}function Kc(r,o,u,g){var w=Mr();Nt.flags|=r,w.memoizedState=cl(1|o,u,void 0,g===void 0?null:g)}function Xc(r,o,u,g){var w=Bn();g=g===void 0?null:g;var b=void 0;if(Pt!==null){var M=Pt.memoizedState;if(b=M.destroy,g!==null&&Ih(g,M.deps)){w.memoizedState=cl(o,u,b,g);return}}Nt.flags|=r,w.memoizedState=cl(1|o,u,b,g)}function C0(r,o){return Kc(8390656,8,r,o)}function Dh(r,o){return Xc(2048,8,r,o)}function T0(r,o){return Xc(4,2,r,o)}function A0(r,o){return Xc(4,4,r,o)}function R0(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 M0(r,o,u){return u=u!=null?u.concat([r]):null,Xc(4,4,R0.bind(null,o,r),u)}function qh(){}function I0(r,o){var u=Bn();o=o===void 0?null:o;var g=u.memoizedState;return g!==null&&o!==null&&Ih(o,g[1])?g[0]:(u.memoizedState=[r,o],r)}function $0(r,o){var u=Bn();o=o===void 0?null:o;var g=u.memoizedState;return g!==null&&o!==null&&Ih(o,g[1])?g[0]:(r=r(),u.memoizedState=[r,o],r)}function O0(r,o,u){return($a&21)===0?(r.baseState&&(r.baseState=!1,yn=!0),r.memoizedState=u):(fn(u,o)||(u=Tt(),Nt.lanes|=u,Oa|=u,r.baseState=!0),o)}function SR(r,o){var u=ut;ut=u!==0&&4>u?u:4,r(!0);var g=Mh.transition;Mh.transition={};try{r(!1),o()}finally{ut=u,Mh.transition=g}}function P0(){return Bn().memoizedState}function jR(r,o,u){var g=Ps(r);if(u={lane:g,action:u,hasEagerState:!1,eagerState:null,next:null},L0(r))D0(o,u);else if(u=p0(r,o,u,g),u!==null){var w=un();ir(u,r,g,w),q0(u,o,g)}}function ER(r,o,u){var g=Ps(r),w={lane:g,action:u,hasEagerState:!1,eagerState:null,next:null};if(L0(r))D0(o,w);else{var b=r.alternate;if(r.lanes===0&&(b===null||b.lanes===0)&&(b=o.lastRenderedReducer,b!==null))try{var M=o.lastRenderedState,Q=b(M,u);if(w.hasEagerState=!0,w.eagerState=Q,fn(Q,M)){var te=o.interleaved;te===null?(w.next=w,jh(o)):(w.next=te.next,te.next=w),o.interleaved=w;return}}catch{}finally{}u=p0(r,o,w,g),u!==null&&(w=un(),ir(u,r,g,w),q0(u,o,g))}}function L0(r){var o=r.alternate;return r===Nt||o!==null&&o===Nt}function D0(r,o){ol=Yc=!0;var u=r.pending;u===null?o.next=o:(o.next=u.next,u.next=o),r.pending=o}function q0(r,o,u){if((u&4194240)!==0){var g=o.lanes;g&=r.pendingLanes,u|=g,o.lanes=u,lo(r,u)}}var Qc={readContext:Fn,useCallback:rn,useContext:rn,useEffect:rn,useImperativeHandle:rn,useInsertionEffect:rn,useLayoutEffect:rn,useMemo:rn,useReducer:rn,useRef:rn,useState:rn,useDebugValue:rn,useDeferredValue:rn,useTransition:rn,useMutableSource:rn,useSyncExternalStore:rn,useId:rn,unstable_isNewReconciler:!1},CR={readContext:Fn,useCallback:function(r,o){return Mr().memoizedState=[r,o===void 0?null:o],r},useContext:Fn,useEffect:C0,useImperativeHandle:function(r,o,u){return u=u!=null?u.concat([r]):null,Kc(4194308,4,R0.bind(null,o,r),u)},useLayoutEffect:function(r,o){return Kc(4194308,4,r,o)},useInsertionEffect:function(r,o){return Kc(4,2,r,o)},useMemo:function(r,o){var u=Mr();return o=o===void 0?null:o,r=r(),u.memoizedState=[r,o],r},useReducer:function(r,o,u){var g=Mr();return o=u!==void 0?u(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=jR.bind(null,Nt,r),[g.memoizedState,r]},useRef:function(r){var o=Mr();return r={current:r},o.memoizedState=r},useState:j0,useDebugValue:qh,useDeferredValue:function(r){return Mr().memoizedState=r},useTransition:function(){var r=j0(!1),o=r[0];return r=SR.bind(null,r[1]),Mr().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,u){var g=Nt,w=Mr();if(bt){if(u===void 0)throw Error(n(407));u=u()}else{if(u=o(),Wt===null)throw Error(n(349));($a&30)!==0||b0(g,o,u)}w.memoizedState=u;var b={value:u,getSnapshot:o};return w.queue=b,C0(_0.bind(null,g,b,r),[r]),g.flags|=2048,cl(9,k0.bind(null,g,b,u,o),void 0,null),u},useId:function(){var r=Mr(),o=Wt.identifierPrefix;if(bt){var u=ss,g=rs;u=(g&~(1<<32-dn(g)-1)).toString(32)+u,o=":"+o+"R"+u,u=il++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=NR++,o=":"+o+"r"+u.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},TR={readContext:Fn,useCallback:I0,useContext:Fn,useEffect:Dh,useImperativeHandle:M0,useInsertionEffect:T0,useLayoutEffect:A0,useMemo:$0,useReducer:Ph,useRef:E0,useState:function(){return Ph(ll)},useDebugValue:qh,useDeferredValue:function(r){var o=Bn();return O0(o,Pt.memoizedState,r)},useTransition:function(){var r=Ph(ll)[0],o=Bn().memoizedState;return[r,o]},useMutableSource:v0,useSyncExternalStore:x0,useId:P0,unstable_isNewReconciler:!1},AR={readContext:Fn,useCallback:I0,useContext:Fn,useEffect:Dh,useImperativeHandle:M0,useInsertionEffect:T0,useLayoutEffect:A0,useMemo:$0,useReducer:Lh,useRef:E0,useState:function(){return Lh(ll)},useDebugValue:qh,useDeferredValue:function(r){var o=Bn();return Pt===null?o.memoizedState=r:O0(o,Pt.memoizedState,r)},useTransition:function(){var r=Lh(ll)[0],o=Bn().memoizedState;return[r,o]},useMutableSource:v0,useSyncExternalStore:x0,useId:P0,unstable_isNewReconciler:!1};function sr(r,o){if(r&&r.defaultProps){o=K({},o),r=r.defaultProps;for(var u in r)o[u]===void 0&&(o[u]=r[u]);return o}return o}function Fh(r,o,u,g){o=r.memoizedState,u=u(g,o),u=u==null?o:K({},o,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Zc={isMounted:function(r){return(r=r._reactInternals)?In(r)===r:!1},enqueueSetState:function(r,o,u){r=r._reactInternals;var g=un(),w=Ps(r),b=os(g,w);b.payload=o,u!=null&&(b.callback=u),o=Ms(r,b,w),o!==null&&(ir(o,r,w,g),Wc(o,r,w))},enqueueReplaceState:function(r,o,u){r=r._reactInternals;var g=un(),w=Ps(r),b=os(g,w);b.tag=1,b.payload=o,u!=null&&(b.callback=u),o=Ms(r,b,w),o!==null&&(ir(o,r,w,g),Wc(o,r,w))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var u=un(),g=Ps(r),w=os(u,g);w.tag=2,o!=null&&(w.callback=o),o=Ms(r,w,g),o!==null&&(ir(o,r,g,u),Wc(o,r,g))}};function F0(r,o,u,g,w,b,M){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(g,b,M):o.prototype&&o.prototype.isPureReactComponent?!At(u,g)||!At(w,b):!0}function B0(r,o,u){var g=!1,w=Ts,b=o.contextType;return typeof b=="object"&&b!==null?b=Fn(b):(w=gn(o)?Ta:nn.current,g=o.contextTypes,b=(g=g!=null)?Mo(r,w):Ts),o=new o(u,b),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Zc,r.stateNode=o,o._reactInternals=r,g&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=w,r.__reactInternalMemoizedMaskedChildContext=b),o}function z0(r,o,u,g){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,g),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,g),o.state!==r&&Zc.enqueueReplaceState(o,o.state,null)}function Bh(r,o,u,g){var w=r.stateNode;w.props=u,w.state=r.memoizedState,w.refs={},Eh(r);var b=o.contextType;typeof b=="object"&&b!==null?w.context=Fn(b):(b=gn(o)?Ta:nn.current,w.context=Mo(r,b)),w.state=r.memoizedState,b=o.getDerivedStateFromProps,typeof b=="function"&&(Fh(r,o,b,u),w.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(o=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),o!==w.state&&Zc.enqueueReplaceState(w,w.state,null),Hc(r,u,w,g),w.state=r.memoizedState),typeof w.componentDidMount=="function"&&(r.flags|=4194308)}function Fo(r,o){try{var u="",g=o;do u+=W(g),g=g.return;while(g);var w=u}catch(b){w=`
|
|
39
39
|
Error generating stack: `+b.message+`
|
|
40
|
-
`+b.stack}return{value:r,source:o,stack:w,digest:null}}function zh(r,o,u){return{value:r,source:null,stack:u??null,digest:o??null}}function Uh(r,o){try{console.error(o.value)}catch(u){setTimeout(function(){throw u})}}var AR=typeof WeakMap=="function"?WeakMap:Map;function z0(r,o,u){u=os(-1,u),u.tag=3,u.payload={element:null};var g=o.value;return u.callback=function(){au||(au=!0,sf=g),Uh(r,o)},u}function U0(r,o,u){u=os(-1,u),u.tag=3;var g=r.type.getDerivedStateFromError;if(typeof g=="function"){var w=o.value;u.payload=function(){return g(w)},u.callback=function(){Uh(r,o)}}var b=r.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(u.callback=function(){Uh(r,o),typeof g!="function"&&($s===null?$s=new Set([this]):$s.add(this));var M=o.stack;this.componentDidCatch(o.value,{componentStack:M!==null?M:""})}),u}function W0(r,o,u){var g=r.pingCache;if(g===null){g=r.pingCache=new AR;var w=new Set;g.set(o,w)}else w=g.get(o),w===void 0&&(w=new Set,g.set(o,w));w.has(u)||(w.add(u),r=WR.bind(null,r,o,u),o.then(r,r))}function H0(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 G0(r,o,u,g,w){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(o=os(-1,1),o.tag=2,Ms(u,o,1))),u.lanes|=1),r):(r.flags|=65536,r.lanes=w,r)}var RR=C.ReactCurrentOwner,yn=!1;function cn(r,o,u,g){o.child=r===null?h0(o,null,u,g):$o(o,r.child,u,g)}function V0(r,o,u,g,w){u=u.render;var b=o.ref;return Po(o,w),g=$h(r,o,u,g,b,w),u=Oh(),r!==null&&!yn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~w,is(r,o,w)):(bt&&u&&yh(o),o.flags|=1,cn(r,o,g,w),o.child)}function Y0(r,o,u,g,w){if(r===null){var b=u.type;return typeof b=="function"&&!hf(b)&&b.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(o.tag=15,o.type=b,K0(r,o,b,g,w)):(r=du(u.type,null,g,o,o.mode,w),r.ref=o.ref,r.return=o,o.child=r)}if(b=r.child,(r.lanes&w)===0){var M=b.memoizedProps;if(u=u.compare,u=u!==null?u:At,u(M,g)&&r.ref===o.ref)return is(r,o,w)}return o.flags|=1,r=Ds(b,g),r.ref=o.ref,r.return=o,o.child=r}function K0(r,o,u,g,w){if(r!==null){var b=r.memoizedProps;if(At(b,g)&&r.ref===o.ref)if(yn=!1,o.pendingProps=g=b,(r.lanes&w)!==0)(r.flags&131072)!==0&&(yn=!0);else return o.lanes=r.lanes,is(r,o,w)}return Wh(r,o,u,g,w)}function X0(r,o,u){var g=o.pendingProps,w=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},yt(Fo,Cn),Cn|=u;else{if((u&1073741824)===0)return r=b!==null?b.baseLanes|u:u,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,yt(Fo,Cn),Cn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=b!==null?b.baseLanes:u,yt(Fo,Cn),Cn|=g}else b!==null?(g=b.baseLanes|u,o.memoizedState=null):g=u,yt(Fo,Cn),Cn|=g;return cn(r,o,w,u),o.child}function Q0(r,o){var u=o.ref;(r===null&&u!==null||r!==null&&r.ref!==u)&&(o.flags|=512,o.flags|=2097152)}function Wh(r,o,u,g,w){var b=gn(u)?Ca:nn.current;return b=Ao(o,b),Po(o,w),u=$h(r,o,u,g,b,w),g=Oh(),r!==null&&!yn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~w,is(r,o,w)):(bt&&g&&yh(o),o.flags|=1,cn(r,o,u,w),o.child)}function Z0(r,o,u,g,w){if(gn(u)){var b=!0;Pc(o)}else b=!1;if(Po(o,w),o.stateNode===null)eu(r,o),F0(o,u,g),Bh(o,u,g,w),g=!0;else if(r===null){var M=o.stateNode,Q=o.memoizedProps;M.props=Q;var te=M.context,de=u.contextType;typeof de=="object"&&de!==null?de=Fn(de):(de=gn(u)?Ca:nn.current,de=Ao(o,de));var be=u.getDerivedStateFromProps,ke=typeof be=="function"||typeof M.getSnapshotBeforeUpdate=="function";ke||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(Q!==g||te!==de)&&B0(o,M,g,de),Rs=!1;var ve=o.memoizedState;M.state=ve,Hc(o,g,M,w),te=o.memoizedState,Q!==g||ve!==te||mn.current||Rs?(typeof be=="function"&&(Fh(o,u,be,g),te=o.memoizedState),(Q=Rs||q0(o,u,Q,g,ve,te,de))?(ke||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(o.flags|=4194308)):(typeof M.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=g,o.memoizedState=te),M.props=g,M.state=te,M.context=de,g=Q):(typeof M.componentDidMount=="function"&&(o.flags|=4194308),g=!1)}else{M=o.stateNode,p0(r,o),Q=o.memoizedProps,de=o.type===o.elementType?Q:sr(o.type,Q),M.props=de,ke=o.pendingProps,ve=M.context,te=u.contextType,typeof te=="object"&&te!==null?te=Fn(te):(te=gn(u)?Ca:nn.current,te=Ao(o,te));var Ae=u.getDerivedStateFromProps;(be=typeof Ae=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(Q!==ke||ve!==te)&&B0(o,M,g,te),Rs=!1,ve=o.memoizedState,M.state=ve,Hc(o,g,M,w);var Oe=o.memoizedState;Q!==ke||ve!==Oe||mn.current||Rs?(typeof Ae=="function"&&(Fh(o,u,Ae,g),Oe=o.memoizedState),(de=Rs||q0(o,u,de,g,ve,Oe,te)||!1)?(be||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(g,Oe,te),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(g,Oe,te)),typeof M.componentDidUpdate=="function"&&(o.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof M.componentDidUpdate!="function"||Q===r.memoizedProps&&ve===r.memoizedState||(o.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||Q===r.memoizedProps&&ve===r.memoizedState||(o.flags|=1024),o.memoizedProps=g,o.memoizedState=Oe),M.props=g,M.state=Oe,M.context=te,g=de):(typeof M.componentDidUpdate!="function"||Q===r.memoizedProps&&ve===r.memoizedState||(o.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||Q===r.memoizedProps&&ve===r.memoizedState||(o.flags|=1024),g=!1)}return Hh(r,o,u,g,b,w)}function Hh(r,o,u,g,w,b){Q0(r,o);var M=(o.flags&128)!==0;if(!g&&!M)return w&&r0(o,u,!1),is(r,o,b);g=o.stateNode,RR.current=o;var Q=M&&typeof u.getDerivedStateFromError!="function"?null:g.render();return o.flags|=1,r!==null&&M?(o.child=$o(o,r.child,null,b),o.child=$o(o,null,Q,b)):cn(r,o,Q,b),o.memoizedState=g.state,w&&r0(o,u,!0),o.child}function J0(r){var o=r.stateNode;o.pendingContext?t0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&t0(r,o.context,!1),Ch(r,o.containerInfo)}function eb(r,o,u,g,w){return Io(),bh(w),o.flags|=256,cn(r,o,u,g),o.child}var Gh={dehydrated:null,treeContext:null,retryLane:0};function Vh(r){return{baseLanes:r,cachePool:null,transitions:null}}function tb(r,o,u){var g=o.pendingProps,w=_t.current,b=!1,M=(o.flags&128)!==0,Q;if((Q=M)||(Q=r!==null&&r.memoizedState===null?!1:(w&2)!==0),Q?(b=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(w|=1),yt(_t,w&1),r===null)return xh(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):(M=g.children,r=g.fallback,b?(g=o.mode,b=o.child,M={mode:"hidden",children:M},(g&1)===0&&b!==null?(b.childLanes=0,b.pendingProps=M):b=hu(M,g,0,null),r=Da(r,g,u,null),b.return=o,r.return=o,b.sibling=r,o.child=b,o.child.memoizedState=Vh(u),o.memoizedState=Gh,r):Yh(o,M));if(w=r.memoizedState,w!==null&&(Q=w.dehydrated,Q!==null))return MR(r,o,M,g,Q,w,u);if(b){b=g.fallback,M=o.mode,w=r.child,Q=w.sibling;var te={mode:"hidden",children:g.children};return(M&1)===0&&o.child!==w?(g=o.child,g.childLanes=0,g.pendingProps=te,o.deletions=null):(g=Ds(w,te),g.subtreeFlags=w.subtreeFlags&14680064),Q!==null?b=Ds(Q,b):(b=Da(b,M,u,null),b.flags|=2),b.return=o,g.return=o,g.sibling=b,o.child=g,g=b,b=o.child,M=r.child.memoizedState,M=M===null?Vh(u):{baseLanes:M.baseLanes|u,cachePool:null,transitions:M.transitions},b.memoizedState=M,b.childLanes=r.childLanes&~u,o.memoizedState=Gh,g}return b=r.child,r=b.sibling,g=Ds(b,{mode:"visible",children:g.children}),(o.mode&1)===0&&(g.lanes=u),g.return=o,g.sibling=null,r!==null&&(u=o.deletions,u===null?(o.deletions=[r],o.flags|=16):u.push(r)),o.child=g,o.memoizedState=null,g}function Yh(r,o){return o=hu({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Jc(r,o,u,g){return g!==null&&bh(g),$o(o,r.child,null,u),r=Yh(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function MR(r,o,u,g,w,b,M){if(u)return o.flags&256?(o.flags&=-257,g=zh(Error(n(422))),Jc(r,o,M,g)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(b=g.fallback,w=o.mode,g=hu({mode:"visible",children:g.children},w,0,null),b=Da(b,w,M,null),b.flags|=2,g.return=o,b.return=o,g.sibling=b,o.child=g,(o.mode&1)!==0&&$o(o,r.child,null,M),o.child.memoizedState=Vh(M),o.memoizedState=Gh,b);if((o.mode&1)===0)return Jc(r,o,M,null);if(w.data==="$!"){if(g=w.nextSibling&&w.nextSibling.dataset,g)var Q=g.dgst;return g=Q,b=Error(n(419)),g=zh(b,g,void 0),Jc(r,o,M,g)}if(Q=(M&r.childLanes)!==0,yn||Q){if(g=Wt,g!==null){switch(M&-M){case 4:w=2;break;case 16:w=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:w=32;break;case 536870912:w=268435456;break;default:w=0}w=(w&(g.suspendedLanes|M))!==0?0:w,w!==0&&w!==b.retryLane&&(b.retryLane=w,as(r,w),ir(g,r,w,-1))}return df(),g=zh(Error(n(421))),Jc(r,o,M,g)}return w.data==="$?"?(o.flags|=128,o.child=r.child,o=HR.bind(null,r),w._reactRetry=o,null):(r=b.treeContext,En=Es(w.nextSibling),jn=o,bt=!0,rr=null,r!==null&&(Dn[qn++]=rs,Dn[qn++]=ss,Dn[qn++]=Ta,rs=r.id,ss=r.overflow,Ta=o),o=Yh(o,g.children),o.flags|=4096,o)}function nb(r,o,u){r.lanes|=o;var g=r.alternate;g!==null&&(g.lanes|=o),Sh(r.return,o,u)}function Kh(r,o,u,g,w){var b=r.memoizedState;b===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:g,tail:u,tailMode:w}:(b.isBackwards=o,b.rendering=null,b.renderingStartTime=0,b.last=g,b.tail=u,b.tailMode=w)}function rb(r,o,u){var g=o.pendingProps,w=g.revealOrder,b=g.tail;if(cn(r,o,g.children,u),g=_t.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&&nb(r,u,o);else if(r.tag===19)nb(r,u,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(yt(_t,g),(o.mode&1)===0)o.memoizedState=null;else switch(w){case"forwards":for(u=o.child,w=null;u!==null;)r=u.alternate,r!==null&&Gc(r)===null&&(w=u),u=u.sibling;u=w,u===null?(w=o.child,o.child=null):(w=u.sibling,u.sibling=null),Kh(o,!1,w,u,b);break;case"backwards":for(u=null,w=o.child,o.child=null;w!==null;){if(r=w.alternate,r!==null&&Gc(r)===null){o.child=w;break}r=w.sibling,w.sibling=u,u=w,w=r}Kh(o,!0,u,null,b);break;case"together":Kh(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function eu(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function is(r,o,u){if(r!==null&&(o.dependencies=r.dependencies),$a|=o.lanes,(u&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,u=Ds(r,r.pendingProps),o.child=u,u.return=o;r.sibling!==null;)r=r.sibling,u=u.sibling=Ds(r,r.pendingProps),u.return=o;u.sibling=null}return o.child}function IR(r,o,u){switch(o.tag){case 3:J0(o),Io();break;case 5:y0(o);break;case 1:gn(o.type)&&Pc(o);break;case 4:Ch(o,o.stateNode.containerInfo);break;case 10:var g=o.type._context,w=o.memoizedProps.value;yt(zc,g._currentValue),g._currentValue=w;break;case 13:if(g=o.memoizedState,g!==null)return g.dehydrated!==null?(yt(_t,_t.current&1),o.flags|=128,null):(u&o.child.childLanes)!==0?tb(r,o,u):(yt(_t,_t.current&1),r=is(r,o,u),r!==null?r.sibling:null);yt(_t,_t.current&1);break;case 19:if(g=(u&o.childLanes)!==0,(r.flags&128)!==0){if(g)return rb(r,o,u);o.flags|=128}if(w=o.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),yt(_t,_t.current),g)break;return null;case 22:case 23:return o.lanes=0,X0(r,o,u)}return is(r,o,u)}var sb,Xh,ab,ob;sb=function(r,o){for(var u=o.child;u!==null;){if(u.tag===5||u.tag===6)r.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},Xh=function(){},ab=function(r,o,u,g){var w=r.memoizedProps;if(w!==g){r=o.stateNode,Ma(Rr.current);var b=null;switch(u){case"input":w=we(r,w),g=we(r,g),b=[];break;case"select":w=K({},w,{value:void 0}),g=K({},g,{value:void 0}),b=[];break;case"textarea":w=Ze(r,w),g=Ze(r,g),b=[];break;default:typeof w.onClick!="function"&&typeof g.onClick=="function"&&(r.onclick=Ic)}Ce(u,g);var M;u=null;for(de in w)if(!g.hasOwnProperty(de)&&w.hasOwnProperty(de)&&w[de]!=null)if(de==="style"){var Q=w[de];for(M in Q)Q.hasOwnProperty(M)&&(u||(u={}),u[M]="")}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 te=g[de];if(Q=w!=null?w[de]:void 0,g.hasOwnProperty(de)&&te!==Q&&(te!=null||Q!=null))if(de==="style")if(Q){for(M in Q)!Q.hasOwnProperty(M)||te&&te.hasOwnProperty(M)||(u||(u={}),u[M]="");for(M in te)te.hasOwnProperty(M)&&Q[M]!==te[M]&&(u||(u={}),u[M]=te[M])}else u||(b||(b=[]),b.push(de,u)),u=te;else de==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,Q=Q?Q.__html:void 0,te!=null&&Q!==te&&(b=b||[]).push(de,te)):de==="children"?typeof te!="string"&&typeof te!="number"||(b=b||[]).push(de,""+te):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(a.hasOwnProperty(de)?(te!=null&&de==="onScroll"&&Ye("scroll",r),b||Q===te||(b=[])):(b=b||[]).push(de,te))}u&&(b=b||[]).push("style",u);var de=b;(o.updateQueue=de)&&(o.flags|=4)}},ob=function(r,o,u,g){u!==g&&(o.flags|=4)};function cl(r,o){if(!bt)switch(r.tailMode){case"hidden":o=r.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var g=null;u!==null;)u.alternate!==null&&(g=u),u=u.sibling;g===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:g.sibling=null}}function sn(r){var o=r.alternate!==null&&r.alternate.child===r.child,u=0,g=0;if(o)for(var w=r.child;w!==null;)u|=w.lanes|w.childLanes,g|=w.subtreeFlags&14680064,g|=w.flags&14680064,w.return=r,w=w.sibling;else for(w=r.child;w!==null;)u|=w.lanes|w.childLanes,g|=w.subtreeFlags,g|=w.flags,w.return=r,w=w.sibling;return r.subtreeFlags|=g,r.childLanes=u,o}function $R(r,o,u){var g=o.pendingProps;switch(wh(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sn(o),null;case 1:return gn(o.type)&&Oc(),sn(o),null;case 3:return g=o.stateNode,Lo(),vt(mn),vt(nn),Rh(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(r===null||r.child===null)&&(Fc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,rr!==null&&(lf(rr),rr=null))),Xh(r,o),sn(o),null;case 5:Th(o);var w=Ma(sl.current);if(u=o.type,r!==null&&o.stateNode!=null)ab(r,o,u,g,w),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!g){if(o.stateNode===null)throw Error(n(166));return sn(o),null}if(r=Ma(Rr.current),Fc(o)){g=o.stateNode,u=o.type;var b=o.memoizedProps;switch(g[Ar]=o,g[Ji]=b,r=(o.mode&1)!==0,u){case"dialog":Ye("cancel",g),Ye("close",g);break;case"iframe":case"object":case"embed":Ye("load",g);break;case"video":case"audio":for(w=0;w<je.length;w++)Ye(je[w],g);break;case"source":Ye("error",g);break;case"img":case"image":case"link":Ye("error",g),Ye("load",g);break;case"details":Ye("toggle",g);break;case"input":xe(g,b),Ye("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!b.multiple},Ye("invalid",g);break;case"textarea":Qe(g,b),Ye("invalid",g)}Ce(u,b),w=null;for(var M in b)if(b.hasOwnProperty(M)){var Q=b[M];M==="children"?typeof Q=="string"?g.textContent!==Q&&(b.suppressHydrationWarning!==!0&&ja(g.textContent,Q,r),w=["children",Q]):typeof Q=="number"&&g.textContent!==""+Q&&(b.suppressHydrationWarning!==!0&&ja(g.textContent,Q,r),w=["children",""+Q]):a.hasOwnProperty(M)&&Q!=null&&M==="onScroll"&&Ye("scroll",g)}switch(u){case"input":Re(g),Ee(g,b,!0);break;case"textarea":Re(g),ye(g);break;case"select":case"option":break;default:typeof b.onClick=="function"&&(g.onclick=Ic)}g=w,o.updateQueue=g,g!==null&&(o.flags|=4)}else{M=w.nodeType===9?w:w.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=Se(u)),r==="http://www.w3.org/1999/xhtml"?u==="script"?(r=M.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof g.is=="string"?r=M.createElement(u,{is:g.is}):(r=M.createElement(u),u==="select"&&(M=r,g.multiple?M.multiple=!0:g.size&&(M.size=g.size))):r=M.createElementNS(r,u),r[Ar]=o,r[Ji]=g,sb(r,o,!1,!1),o.stateNode=r;e:{switch(M=Ve(u,g),u){case"dialog":Ye("cancel",r),Ye("close",r),w=g;break;case"iframe":case"object":case"embed":Ye("load",r),w=g;break;case"video":case"audio":for(w=0;w<je.length;w++)Ye(je[w],r);w=g;break;case"source":Ye("error",r),w=g;break;case"img":case"image":case"link":Ye("error",r),Ye("load",r),w=g;break;case"details":Ye("toggle",r),w=g;break;case"input":xe(r,g),w=we(r,g),Ye("invalid",r);break;case"option":w=g;break;case"select":r._wrapperState={wasMultiple:!!g.multiple},w=K({},g,{value:void 0}),Ye("invalid",r);break;case"textarea":Qe(r,g),w=Ze(r,g),Ye("invalid",r);break;default:w=g}Ce(u,w),Q=w;for(b in Q)if(Q.hasOwnProperty(b)){var te=Q[b];b==="style"?Fe(r,te):b==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,te!=null&&ft(r,te)):b==="children"?typeof te=="string"?(u!=="textarea"||te!=="")&&dt(r,te):typeof te=="number"&&dt(r,""+te):b!=="suppressContentEditableWarning"&&b!=="suppressHydrationWarning"&&b!=="autoFocus"&&(a.hasOwnProperty(b)?te!=null&&b==="onScroll"&&Ye("scroll",r):te!=null&&E(r,b,te,M))}switch(u){case"input":Re(r),Ee(r,g,!1);break;case"textarea":Re(r),ye(r);break;case"option":g.value!=null&&r.setAttribute("value",""+ae(g.value));break;case"select":r.multiple=!!g.multiple,b=g.value,b!=null?Je(r,!!g.multiple,b,!1):g.defaultValue!=null&&Je(r,!!g.multiple,g.defaultValue,!0);break;default:typeof w.onClick=="function"&&(r.onclick=Ic)}switch(u){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 sn(o),null;case 6:if(r&&o.stateNode!=null)ob(r,o,r.memoizedProps,g);else{if(typeof g!="string"&&o.stateNode===null)throw Error(n(166));if(u=Ma(sl.current),Ma(Rr.current),Fc(o)){if(g=o.stateNode,u=o.memoizedProps,g[Ar]=o,(b=g.nodeValue!==u)&&(r=jn,r!==null))switch(r.tag){case 3:ja(g.nodeValue,u,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&ja(g.nodeValue,u,(r.mode&1)!==0)}b&&(o.flags|=4)}else g=(u.nodeType===9?u:u.ownerDocument).createTextNode(g),g[Ar]=o,o.stateNode=g}return sn(o),null;case 13:if(vt(_t),g=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(bt&&En!==null&&(o.mode&1)!==0&&(o.flags&128)===0)c0(),Io(),o.flags|=98560,b=!1;else if(b=Fc(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[Ar]=o}else Io(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;sn(o),b=!1}else rr!==null&&(lf(rr),rr=null),b=!0;if(!b)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=u,o):(g=g!==null,g!==(r!==null&&r.memoizedState!==null)&&g&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(_t.current&1)!==0?Lt===0&&(Lt=3):df())),o.updateQueue!==null&&(o.flags|=4),sn(o),null);case 4:return Lo(),Xh(r,o),r===null&&Tr(o.stateNode.containerInfo),sn(o),null;case 10:return Nh(o.type._context),sn(o),null;case 17:return gn(o.type)&&Oc(),sn(o),null;case 19:if(vt(_t),b=o.memoizedState,b===null)return sn(o),null;if(g=(o.flags&128)!==0,M=b.rendering,M===null)if(g)cl(b,!1);else{if(Lt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(M=Gc(r),M!==null){for(o.flags|=128,cl(b,!1),g=M.updateQueue,g!==null&&(o.updateQueue=g,o.flags|=4),o.subtreeFlags=0,g=u,u=o.child;u!==null;)b=u,r=g,b.flags&=14680066,M=b.alternate,M===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=M.childLanes,b.lanes=M.lanes,b.child=M.child,b.subtreeFlags=0,b.deletions=null,b.memoizedProps=M.memoizedProps,b.memoizedState=M.memoizedState,b.updateQueue=M.updateQueue,b.type=M.type,r=M.dependencies,b.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),u=u.sibling;return yt(_t,_t.current&1|2),o.child}r=r.sibling}b.tail!==null&&mt()>Bo&&(o.flags|=128,g=!0,cl(b,!1),o.lanes=4194304)}else{if(!g)if(r=Gc(M),r!==null){if(o.flags|=128,g=!0,u=r.updateQueue,u!==null&&(o.updateQueue=u,o.flags|=4),cl(b,!0),b.tail===null&&b.tailMode==="hidden"&&!M.alternate&&!bt)return sn(o),null}else 2*mt()-b.renderingStartTime>Bo&&u!==1073741824&&(o.flags|=128,g=!0,cl(b,!1),o.lanes=4194304);b.isBackwards?(M.sibling=o.child,o.child=M):(u=b.last,u!==null?u.sibling=M:o.child=M,b.last=M)}return b.tail!==null?(o=b.tail,b.rendering=o,b.tail=o.sibling,b.renderingStartTime=mt(),o.sibling=null,u=_t.current,yt(_t,g?u&1|2:u&1),o):(sn(o),null);case 22:case 23:return uf(),g=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==g&&(o.flags|=8192),g&&(o.mode&1)!==0?(Cn&1073741824)!==0&&(sn(o),o.subtreeFlags&6&&(o.flags|=8192)):sn(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function OR(r,o){switch(wh(o),o.tag){case 1:return gn(o.type)&&Oc(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return Lo(),vt(mn),vt(nn),Rh(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Th(o),null;case 13:if(vt(_t),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));Io()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return vt(_t),null;case 4:return Lo(),null;case 10:return Nh(o.type._context),null;case 22:case 23:return uf(),null;case 24:return null;default:return null}}var tu=!1,an=!1,PR=typeof WeakSet=="function"?WeakSet:Set,Ie=null;function qo(r,o){var u=r.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(g){St(r,o,g)}else u.current=null}function Qh(r,o,u){try{u()}catch(g){St(r,o,g)}}var ib=!1;function LR(r,o){if(ch=ho,r=Tc(),ko(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var g=u.getSelection&&u.getSelection();if(g&&g.rangeCount!==0){u=g.anchorNode;var w=g.anchorOffset,b=g.focusNode;g=g.focusOffset;try{u.nodeType,b.nodeType}catch{u=null;break e}var M=0,Q=-1,te=-1,de=0,be=0,ke=r,ve=null;t:for(;;){for(var Ae;ke!==u||w!==0&&ke.nodeType!==3||(Q=M+w),ke!==b||g!==0&&ke.nodeType!==3||(te=M+g),ke.nodeType===3&&(M+=ke.nodeValue.length),(Ae=ke.firstChild)!==null;)ve=ke,ke=Ae;for(;;){if(ke===r)break t;if(ve===u&&++de===w&&(Q=M),ve===b&&++be===g&&(te=M),(Ae=ke.nextSibling)!==null)break;ke=ve,ve=ke.parentNode}ke=Ae}u=Q===-1||te===-1?null:{start:Q,end:te}}else u=null}u=u||{start:0,end:0}}else u=null;for(uh={focusedElem:r,selectionRange:u},ho=!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 Oe=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Oe!==null){var Le=Oe.memoizedProps,Ct=Oe.memoizedState,ie=o.stateNode,ne=ie.getSnapshotBeforeUpdate(o.elementType===o.type?Le:sr(o.type,Le),Ct);ie.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var ue=o.stateNode.containerInfo;ue.nodeType===1?ue.textContent="":ue.nodeType===9&&ue.documentElement&&ue.removeChild(ue.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ne){St(o,o.return,Ne)}if(r=o.sibling,r!==null){r.return=o.return,Ie=r;break}Ie=o.return}return Oe=ib,ib=!1,Oe}function ul(r,o,u){var g=o.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var w=g=g.next;do{if((w.tag&r)===r){var b=w.destroy;w.destroy=void 0,b!==void 0&&Qh(o,u,b)}w=w.next}while(w!==g)}}function nu(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var u=o=o.next;do{if((u.tag&r)===r){var g=u.create;u.destroy=g()}u=u.next}while(u!==o)}}function Zh(r){var o=r.ref;if(o!==null){var u=r.stateNode;switch(r.tag){case 5:r=u;break;default:r=u}typeof o=="function"?o(r):o.current=r}}function lb(r){var o=r.alternate;o!==null&&(r.alternate=null,lb(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[Ar],delete o[Ji],delete o[ph],delete o[vR],delete o[xR])),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 cb(r){return r.tag===5||r.tag===3||r.tag===4}function ub(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||cb(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 Jh(r,o,u){var g=r.tag;if(g===5||g===6)r=r.stateNode,o?u.nodeType===8?u.parentNode.insertBefore(r,o):u.insertBefore(r,o):(u.nodeType===8?(o=u.parentNode,o.insertBefore(r,u)):(o=u,o.appendChild(r)),u=u._reactRootContainer,u!=null||o.onclick!==null||(o.onclick=Ic));else if(g!==4&&(r=r.child,r!==null))for(Jh(r,o,u),r=r.sibling;r!==null;)Jh(r,o,u),r=r.sibling}function ef(r,o,u){var g=r.tag;if(g===5||g===6)r=r.stateNode,o?u.insertBefore(r,o):u.appendChild(r);else if(g!==4&&(r=r.child,r!==null))for(ef(r,o,u),r=r.sibling;r!==null;)ef(r,o,u),r=r.sibling}var Xt=null,ar=!1;function Is(r,o,u){for(u=u.child;u!==null;)db(r,o,u),u=u.sibling}function db(r,o,u){if(Ot&&typeof Ot.onCommitFiberUnmount=="function")try{Ot.onCommitFiberUnmount(Yr,u)}catch{}switch(u.tag){case 5:an||qo(u,o);case 6:var g=Xt,w=ar;Xt=null,Is(r,o,u),Xt=g,ar=w,Xt!==null&&(ar?(r=Xt,u=u.stateNode,r.nodeType===8?r.parentNode.removeChild(u):r.removeChild(u)):Xt.removeChild(u.stateNode));break;case 18:Xt!==null&&(ar?(r=Xt,u=u.stateNode,r.nodeType===8?fh(r.parentNode,u):r.nodeType===1&&fh(r,u),da(r)):fh(Xt,u.stateNode));break;case 4:g=Xt,w=ar,Xt=u.stateNode.containerInfo,ar=!0,Is(r,o,u),Xt=g,ar=w;break;case 0:case 11:case 14:case 15:if(!an&&(g=u.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){w=g=g.next;do{var b=w,M=b.destroy;b=b.tag,M!==void 0&&((b&2)!==0||(b&4)!==0)&&Qh(u,o,M),w=w.next}while(w!==g)}Is(r,o,u);break;case 1:if(!an&&(qo(u,o),g=u.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=u.memoizedProps,g.state=u.memoizedState,g.componentWillUnmount()}catch(Q){St(u,o,Q)}Is(r,o,u);break;case 21:Is(r,o,u);break;case 22:u.mode&1?(an=(g=an)||u.memoizedState!==null,Is(r,o,u),an=g):Is(r,o,u);break;default:Is(r,o,u)}}function hb(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var u=r.stateNode;u===null&&(u=r.stateNode=new PR),o.forEach(function(g){var w=GR.bind(null,r,g);u.has(g)||(u.add(g),g.then(w,w))})}}function or(r,o){var u=o.deletions;if(u!==null)for(var g=0;g<u.length;g++){var w=u[g];try{var b=r,M=o,Q=M;e:for(;Q!==null;){switch(Q.tag){case 5:Xt=Q.stateNode,ar=!1;break e;case 3:Xt=Q.stateNode.containerInfo,ar=!0;break e;case 4:Xt=Q.stateNode.containerInfo,ar=!0;break e}Q=Q.return}if(Xt===null)throw Error(n(160));db(b,M,w),Xt=null,ar=!1;var te=w.alternate;te!==null&&(te.return=null),w.return=null}catch(de){St(w,o,de)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)fb(o,r),o=o.sibling}function fb(r,o){var u=r.alternate,g=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(or(o,r),Ir(r),g&4){try{ul(3,r,r.return),nu(3,r)}catch(Le){St(r,r.return,Le)}try{ul(5,r,r.return)}catch(Le){St(r,r.return,Le)}}break;case 1:or(o,r),Ir(r),g&512&&u!==null&&qo(u,u.return);break;case 5:if(or(o,r),Ir(r),g&512&&u!==null&&qo(u,u.return),r.flags&32){var w=r.stateNode;try{dt(w,"")}catch(Le){St(r,r.return,Le)}}if(g&4&&(w=r.stateNode,w!=null)){var b=r.memoizedProps,M=u!==null?u.memoizedProps:b,Q=r.type,te=r.updateQueue;if(r.updateQueue=null,te!==null)try{Q==="input"&&b.type==="radio"&&b.name!=null&&De(w,b),Ve(Q,M);var de=Ve(Q,b);for(M=0;M<te.length;M+=2){var be=te[M],ke=te[M+1];be==="style"?Fe(w,ke):be==="dangerouslySetInnerHTML"?ft(w,ke):be==="children"?dt(w,ke):E(w,be,ke,de)}switch(Q){case"input":_e(w,b);break;case"textarea":fe(w,b);break;case"select":var ve=w._wrapperState.wasMultiple;w._wrapperState.wasMultiple=!!b.multiple;var Ae=b.value;Ae!=null?Je(w,!!b.multiple,Ae,!1):ve!==!!b.multiple&&(b.defaultValue!=null?Je(w,!!b.multiple,b.defaultValue,!0):Je(w,!!b.multiple,b.multiple?[]:"",!1))}w[Ji]=b}catch(Le){St(r,r.return,Le)}}break;case 6:if(or(o,r),Ir(r),g&4){if(r.stateNode===null)throw Error(n(162));w=r.stateNode,b=r.memoizedProps;try{w.nodeValue=b}catch(Le){St(r,r.return,Le)}}break;case 3:if(or(o,r),Ir(r),g&4&&u!==null&&u.memoizedState.isDehydrated)try{da(o.containerInfo)}catch(Le){St(r,r.return,Le)}break;case 4:or(o,r),Ir(r);break;case 13:or(o,r),Ir(r),w=r.child,w.flags&8192&&(b=w.memoizedState!==null,w.stateNode.isHidden=b,!b||w.alternate!==null&&w.alternate.memoizedState!==null||(rf=mt())),g&4&&hb(r);break;case 22:if(be=u!==null&&u.memoizedState!==null,r.mode&1?(an=(de=an)||be,or(o,r),an=de):or(o,r),Ir(r),g&8192){if(de=r.memoizedState!==null,(r.stateNode.isHidden=de)&&!be&&(r.mode&1)!==0)for(Ie=r,be=r.child;be!==null;){for(ke=Ie=be;Ie!==null;){switch(ve=Ie,Ae=ve.child,ve.tag){case 0:case 11:case 14:case 15:ul(4,ve,ve.return);break;case 1:qo(ve,ve.return);var Oe=ve.stateNode;if(typeof Oe.componentWillUnmount=="function"){g=ve,u=ve.return;try{o=g,Oe.props=o.memoizedProps,Oe.state=o.memoizedState,Oe.componentWillUnmount()}catch(Le){St(g,u,Le)}}break;case 5:qo(ve,ve.return);break;case 22:if(ve.memoizedState!==null){gb(ke);continue}}Ae!==null?(Ae.return=ve,Ie=Ae):gb(ke)}be=be.sibling}e:for(be=null,ke=r;;){if(ke.tag===5){if(be===null){be=ke;try{w=ke.stateNode,de?(b=w.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none"):(Q=ke.stateNode,te=ke.memoizedProps.style,M=te!=null&&te.hasOwnProperty("display")?te.display:null,Q.style.display=re("display",M))}catch(Le){St(r,r.return,Le)}}}else if(ke.tag===6){if(be===null)try{ke.stateNode.nodeValue=de?"":ke.memoizedProps}catch(Le){St(r,r.return,Le)}}else if((ke.tag!==22&&ke.tag!==23||ke.memoizedState===null||ke===r)&&ke.child!==null){ke.child.return=ke,ke=ke.child;continue}if(ke===r)break e;for(;ke.sibling===null;){if(ke.return===null||ke.return===r)break e;be===ke&&(be=null),ke=ke.return}be===ke&&(be=null),ke.sibling.return=ke.return,ke=ke.sibling}}break;case 19:or(o,r),Ir(r),g&4&&hb(r);break;case 21:break;default:or(o,r),Ir(r)}}function Ir(r){var o=r.flags;if(o&2){try{e:{for(var u=r.return;u!==null;){if(cb(u)){var g=u;break e}u=u.return}throw Error(n(160))}switch(g.tag){case 5:var w=g.stateNode;g.flags&32&&(dt(w,""),g.flags&=-33);var b=ub(r);ef(r,b,w);break;case 3:case 4:var M=g.stateNode.containerInfo,Q=ub(r);Jh(r,Q,M);break;default:throw Error(n(161))}}catch(te){St(r,r.return,te)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function DR(r,o,u){Ie=r,pb(r)}function pb(r,o,u){for(var g=(r.mode&1)!==0;Ie!==null;){var w=Ie,b=w.child;if(w.tag===22&&g){var M=w.memoizedState!==null||tu;if(!M){var Q=w.alternate,te=Q!==null&&Q.memoizedState!==null||an;Q=tu;var de=an;if(tu=M,(an=te)&&!de)for(Ie=w;Ie!==null;)M=Ie,te=M.child,M.tag===22&&M.memoizedState!==null?yb(w):te!==null?(te.return=M,Ie=te):yb(w);for(;b!==null;)Ie=b,pb(b),b=b.sibling;Ie=w,tu=Q,an=de}mb(r)}else(w.subtreeFlags&8772)!==0&&b!==null?(b.return=w,Ie=b):mb(r)}}function mb(r){for(;Ie!==null;){var o=Ie;if((o.flags&8772)!==0){var u=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:an||nu(5,o);break;case 1:var g=o.stateNode;if(o.flags&4&&!an)if(u===null)g.componentDidMount();else{var w=o.elementType===o.type?u.memoizedProps:sr(o.type,u.memoizedProps);g.componentDidUpdate(w,u.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var b=o.updateQueue;b!==null&&g0(o,b,g);break;case 3:var M=o.updateQueue;if(M!==null){if(u=null,o.child!==null)switch(o.child.tag){case 5:u=o.child.stateNode;break;case 1:u=o.child.stateNode}g0(o,M,u)}break;case 5:var Q=o.stateNode;if(u===null&&o.flags&4){u=Q;var te=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":te.autoFocus&&u.focus();break;case"img":te.src&&(u.src=te.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 be=de.memoizedState;if(be!==null){var ke=be.dehydrated;ke!==null&&da(ke)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}an||o.flags&512&&Zh(o)}catch(ve){St(o,o.return,ve)}}if(o===r){Ie=null;break}if(u=o.sibling,u!==null){u.return=o.return,Ie=u;break}Ie=o.return}}function gb(r){for(;Ie!==null;){var o=Ie;if(o===r){Ie=null;break}var u=o.sibling;if(u!==null){u.return=o.return,Ie=u;break}Ie=o.return}}function yb(r){for(;Ie!==null;){var o=Ie;try{switch(o.tag){case 0:case 11:case 15:var u=o.return;try{nu(4,o)}catch(te){St(o,u,te)}break;case 1:var g=o.stateNode;if(typeof g.componentDidMount=="function"){var w=o.return;try{g.componentDidMount()}catch(te){St(o,w,te)}}var b=o.return;try{Zh(o)}catch(te){St(o,b,te)}break;case 5:var M=o.return;try{Zh(o)}catch(te){St(o,M,te)}}}catch(te){St(o,o.return,te)}if(o===r){Ie=null;break}var Q=o.sibling;if(Q!==null){Q.return=o.return,Ie=Q;break}Ie=o.return}}var qR=Math.ceil,ru=C.ReactCurrentDispatcher,tf=C.ReactCurrentOwner,zn=C.ReactCurrentBatchConfig,it=0,Wt=null,Rt=null,Qt=0,Cn=0,Fo=Cs(0),Lt=0,dl=null,$a=0,su=0,nf=0,hl=null,wn=null,rf=0,Bo=1/0,ls=null,au=!1,sf=null,$s=null,ou=!1,Os=null,iu=0,fl=0,af=null,lu=-1,cu=0;function un(){return(it&6)!==0?mt():lu!==-1?lu:lu=mt()}function Ps(r){return(r.mode&1)===0?1:(it&2)!==0&&Qt!==0?Qt&-Qt:kR.transition!==null?(cu===0&&(cu=Tt()),cu):(r=ct,r!==0||(r=window.event,r=r===void 0?16:Ti(r.type)),r)}function ir(r,o,u,g){if(50<fl)throw fl=0,af=null,Error(n(185));on(r,u,g),((it&2)===0||r!==Wt)&&(r===Wt&&((it&2)===0&&(su|=u),Lt===4&&Ls(r,Qt)),vn(r,g),u===1&&it===0&&(o.mode&1)===0&&(Bo=mt()+500,Lc&&As()))}function vn(r,o){var u=r.callbackNode;Xd(r,o);var g=en(r,r===Wt?Qt:0);if(g===0)u!==null&&no(u),r.callbackNode=null,r.callbackPriority=0;else if(o=g&-g,r.callbackPriority!==o){if(u!=null&&no(u),o===1)r.tag===0?bR(vb.bind(null,r)):s0(vb.bind(null,r)),yR(function(){(it&6)===0&&As()}),u=null;else{switch(Jn(g)){case 1:u=aa;break;case 4:u=Hr;break;case 16:u=Gr;break;case 536870912:u=oa;break;default:u=Gr}u=Eb(u,wb.bind(null,r))}r.callbackPriority=o,r.callbackNode=u}}function wb(r,o){if(lu=-1,cu=0,(it&6)!==0)throw Error(n(327));var u=r.callbackNode;if(zo()&&r.callbackNode!==u)return null;var g=en(r,r===Wt?Qt:0);if(g===0)return null;if((g&30)!==0||(g&r.expiredLanes)!==0||o)o=uu(r,g);else{o=g;var w=it;it|=2;var b=bb();(Wt!==r||Qt!==o)&&(ls=null,Bo=mt()+500,Pa(r,o));do try{zR();break}catch(Q){xb(r,Q)}while(!0);_h(),ru.current=b,it=w,Rt!==null?o=0:(Wt=null,Qt=0,o=Lt)}if(o!==0){if(o===2&&(w=la(r),w!==0&&(g=w,o=of(r,w))),o===1)throw u=dl,Pa(r,0),Ls(r,g),vn(r,mt()),u;if(o===6)Ls(r,g);else{if(w=r.current.alternate,(g&30)===0&&!FR(w)&&(o=uu(r,g),o===2&&(b=la(r),b!==0&&(g=b,o=of(r,b))),o===1))throw u=dl,Pa(r,0),Ls(r,g),vn(r,mt()),u;switch(r.finishedWork=w,r.finishedLanes=g,o){case 0:case 1:throw Error(n(345));case 2:La(r,wn,ls);break;case 3:if(Ls(r,g),(g&130023424)===g&&(o=rf+500-mt(),10<o)){if(en(r,0)!==0)break;if(w=r.suspendedLanes,(w&g)!==g){un(),r.pingedLanes|=r.suspendedLanes&w;break}r.timeoutHandle=hh(La.bind(null,r,wn,ls),o);break}La(r,wn,ls);break;case 4:if(Ls(r,g),(g&4194240)===g)break;for(o=r.eventTimes,w=-1;0<g;){var M=31-dn(g);b=1<<M,M=o[M],M>w&&(w=M),g&=~b}if(g=w,g=mt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*qR(g/1960))-g,10<g){r.timeoutHandle=hh(La.bind(null,r,wn,ls),g);break}La(r,wn,ls);break;case 5:La(r,wn,ls);break;default:throw Error(n(329))}}}return vn(r,mt()),r.callbackNode===u?wb.bind(null,r):null}function of(r,o){var u=hl;return r.current.memoizedState.isDehydrated&&(Pa(r,o).flags|=256),r=uu(r,o),r!==2&&(o=wn,wn=u,o!==null&&lf(o)),r}function lf(r){wn===null?wn=r:wn.push.apply(wn,r)}function FR(r){for(var o=r;;){if(o.flags&16384){var u=o.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var g=0;g<u.length;g++){var w=u[g],b=w.getSnapshot;w=w.value;try{if(!fn(b(),w))return!1}catch{return!1}}}if(u=o.child,o.subtreeFlags&16384&&u!==null)u.return=o,o=u;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 Ls(r,o){for(o&=~nf,o&=~su,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var u=31-dn(o),g=1<<u;r[u]=-1,o&=~g}}function vb(r){if((it&6)!==0)throw Error(n(327));zo();var o=en(r,0);if((o&1)===0)return vn(r,mt()),null;var u=uu(r,o);if(r.tag!==0&&u===2){var g=la(r);g!==0&&(o=g,u=of(r,g))}if(u===1)throw u=dl,Pa(r,0),Ls(r,o),vn(r,mt()),u;if(u===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,La(r,wn,ls),vn(r,mt()),null}function cf(r,o){var u=it;it|=1;try{return r(o)}finally{it=u,it===0&&(Bo=mt()+500,Lc&&As())}}function Oa(r){Os!==null&&Os.tag===0&&(it&6)===0&&zo();var o=it;it|=1;var u=zn.transition,g=ct;try{if(zn.transition=null,ct=1,r)return r()}finally{ct=g,zn.transition=u,it=o,(it&6)===0&&As()}}function uf(){Cn=Fo.current,vt(Fo)}function Pa(r,o){r.finishedWork=null,r.finishedLanes=0;var u=r.timeoutHandle;if(u!==-1&&(r.timeoutHandle=-1,gR(u)),Rt!==null)for(u=Rt.return;u!==null;){var g=u;switch(wh(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&Oc();break;case 3:Lo(),vt(mn),vt(nn),Rh();break;case 5:Th(g);break;case 4:Lo();break;case 13:vt(_t);break;case 19:vt(_t);break;case 10:Nh(g.type._context);break;case 22:case 23:uf()}u=u.return}if(Wt=r,Rt=r=Ds(r.current,null),Qt=Cn=o,Lt=0,dl=null,nf=su=$a=0,wn=hl=null,Ra!==null){for(o=0;o<Ra.length;o++)if(u=Ra[o],g=u.interleaved,g!==null){u.interleaved=null;var w=g.next,b=u.pending;if(b!==null){var M=b.next;b.next=w,g.next=M}u.pending=g}Ra=null}return r}function xb(r,o){do{var u=Rt;try{if(_h(),Vc.current=Qc,Yc){for(var g=Nt.memoizedState;g!==null;){var w=g.queue;w!==null&&(w.pending=null),g=g.next}Yc=!1}if(Ia=0,Ut=Pt=Nt=null,al=!1,ol=0,tf.current=null,u===null||u.return===null){Lt=1,dl=o,Rt=null;break}e:{var b=r,M=u.return,Q=u,te=o;if(o=Qt,Q.flags|=32768,te!==null&&typeof te=="object"&&typeof te.then=="function"){var de=te,be=Q,ke=be.tag;if((be.mode&1)===0&&(ke===0||ke===11||ke===15)){var ve=be.alternate;ve?(be.updateQueue=ve.updateQueue,be.memoizedState=ve.memoizedState,be.lanes=ve.lanes):(be.updateQueue=null,be.memoizedState=null)}var Ae=H0(M);if(Ae!==null){Ae.flags&=-257,G0(Ae,M,Q,b,o),Ae.mode&1&&W0(b,de,o),o=Ae,te=de;var Oe=o.updateQueue;if(Oe===null){var Le=new Set;Le.add(te),o.updateQueue=Le}else Oe.add(te);break e}else{if((o&1)===0){W0(b,de,o),df();break e}te=Error(n(426))}}else if(bt&&Q.mode&1){var Ct=H0(M);if(Ct!==null){(Ct.flags&65536)===0&&(Ct.flags|=256),G0(Ct,M,Q,b,o),bh(Do(te,Q));break e}}b=te=Do(te,Q),Lt!==4&&(Lt=2),hl===null?hl=[b]:hl.push(b),b=M;do{switch(b.tag){case 3:b.flags|=65536,o&=-o,b.lanes|=o;var ie=z0(b,te,o);m0(b,ie);break e;case 1:Q=te;var ne=b.type,ue=b.stateNode;if((b.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||ue!==null&&typeof ue.componentDidCatch=="function"&&($s===null||!$s.has(ue)))){b.flags|=65536,o&=-o,b.lanes|=o;var Ne=U0(b,Q,o);m0(b,Ne);break e}}b=b.return}while(b!==null)}_b(u)}catch(qe){o=qe,Rt===u&&u!==null&&(Rt=u=u.return);continue}break}while(!0)}function bb(){var r=ru.current;return ru.current=Qc,r===null?Qc:r}function df(){(Lt===0||Lt===3||Lt===2)&&(Lt=4),Wt===null||($a&268435455)===0&&(su&268435455)===0||Ls(Wt,Qt)}function uu(r,o){var u=it;it|=2;var g=bb();(Wt!==r||Qt!==o)&&(ls=null,Pa(r,o));do try{BR();break}catch(w){xb(r,w)}while(!0);if(_h(),it=u,ru.current=g,Rt!==null)throw Error(n(261));return Wt=null,Qt=0,Lt}function BR(){for(;Rt!==null;)kb(Rt)}function zR(){for(;Rt!==null&&!sa();)kb(Rt)}function kb(r){var o=jb(r.alternate,r,Cn);r.memoizedProps=r.pendingProps,o===null?_b(r):Rt=o,tf.current=null}function _b(r){var o=r;do{var u=o.alternate;if(r=o.return,(o.flags&32768)===0){if(u=$R(u,o,Cn),u!==null){Rt=u;return}}else{if(u=OR(u,o),u!==null){u.flags&=32767,Rt=u;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Lt=6,Rt=null;return}}if(o=o.sibling,o!==null){Rt=o;return}Rt=o=r}while(o!==null);Lt===0&&(Lt=5)}function La(r,o,u){var g=ct,w=zn.transition;try{zn.transition=null,ct=1,UR(r,o,u,g)}finally{zn.transition=w,ct=g}return null}function UR(r,o,u,g){do zo();while(Os!==null);if((it&6)!==0)throw Error(n(327));u=r.finishedWork;var w=r.finishedLanes;if(u===null)return null;if(r.finishedWork=null,r.finishedLanes=0,u===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var b=u.lanes|u.childLanes;if(oo(r,b),r===Wt&&(Rt=Wt=null,Qt=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||ou||(ou=!0,Eb(Gr,function(){return zo(),null})),b=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||b){b=zn.transition,zn.transition=null;var M=ct;ct=1;var Q=it;it|=4,tf.current=null,LR(r,u),fb(u,r),_o(uh),ho=!!ch,uh=ch=null,r.current=u,DR(u),_i(),it=Q,ct=M,zn.transition=b}else r.current=u;if(ou&&(ou=!1,Os=r,iu=w),b=r.pendingLanes,b===0&&($s=null),ia(u.stateNode),vn(r,mt()),o!==null)for(g=r.onRecoverableError,u=0;u<o.length;u++)w=o[u],g(w.value,{componentStack:w.stack,digest:w.digest});if(au)throw au=!1,r=sf,sf=null,r;return(iu&1)!==0&&r.tag!==0&&zo(),b=r.pendingLanes,(b&1)!==0?r===af?fl++:(fl=0,af=r):fl=0,As(),null}function zo(){if(Os!==null){var r=Jn(iu),o=zn.transition,u=ct;try{if(zn.transition=null,ct=16>r?16:r,Os===null)var g=!1;else{if(r=Os,Os=null,iu=0,(it&6)!==0)throw Error(n(331));var w=it;for(it|=4,Ie=r.current;Ie!==null;){var b=Ie,M=b.child;if((Ie.flags&16)!==0){var Q=b.deletions;if(Q!==null){for(var te=0;te<Q.length;te++){var de=Q[te];for(Ie=de;Ie!==null;){var be=Ie;switch(be.tag){case 0:case 11:case 15:ul(8,be,b)}var ke=be.child;if(ke!==null)ke.return=be,Ie=ke;else for(;Ie!==null;){be=Ie;var ve=be.sibling,Ae=be.return;if(lb(be),be===de){Ie=null;break}if(ve!==null){ve.return=Ae,Ie=ve;break}Ie=Ae}}}var Oe=b.alternate;if(Oe!==null){var Le=Oe.child;if(Le!==null){Oe.child=null;do{var Ct=Le.sibling;Le.sibling=null,Le=Ct}while(Le!==null)}}Ie=b}}if((b.subtreeFlags&2064)!==0&&M!==null)M.return=b,Ie=M;else e:for(;Ie!==null;){if(b=Ie,(b.flags&2048)!==0)switch(b.tag){case 0:case 11:case 15:ul(9,b,b.return)}var ie=b.sibling;if(ie!==null){ie.return=b.return,Ie=ie;break e}Ie=b.return}}var ne=r.current;for(Ie=ne;Ie!==null;){M=Ie;var ue=M.child;if((M.subtreeFlags&2064)!==0&&ue!==null)ue.return=M,Ie=ue;else e:for(M=ne;Ie!==null;){if(Q=Ie,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:nu(9,Q)}}catch(qe){St(Q,Q.return,qe)}if(Q===M){Ie=null;break e}var Ne=Q.sibling;if(Ne!==null){Ne.return=Q.return,Ie=Ne;break e}Ie=Q.return}}if(it=w,As(),Ot&&typeof Ot.onPostCommitFiberRoot=="function")try{Ot.onPostCommitFiberRoot(Yr,r)}catch{}g=!0}return g}finally{ct=u,zn.transition=o}}return!1}function Nb(r,o,u){o=Do(u,o),o=z0(r,o,1),r=Ms(r,o,1),o=un(),r!==null&&(on(r,1,o),vn(r,o))}function St(r,o,u){if(r.tag===3)Nb(r,r,u);else for(;o!==null;){if(o.tag===3){Nb(o,r,u);break}else if(o.tag===1){var g=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&($s===null||!$s.has(g))){r=Do(u,r),r=U0(o,r,1),o=Ms(o,r,1),r=un(),o!==null&&(on(o,1,r),vn(o,r));break}}o=o.return}}function WR(r,o,u){var g=r.pingCache;g!==null&&g.delete(o),o=un(),r.pingedLanes|=r.suspendedLanes&u,Wt===r&&(Qt&u)===u&&(Lt===4||Lt===3&&(Qt&130023424)===Qt&&500>mt()-rf?Pa(r,0):nf|=u),vn(r,o)}function Sb(r,o){o===0&&((r.mode&1)===0?o=1:(o=so,so<<=1,(so&130023424)===0&&(so=4194304)));var u=un();r=as(r,o),r!==null&&(on(r,o,u),vn(r,u))}function HR(r){var o=r.memoizedState,u=0;o!==null&&(u=o.retryLane),Sb(r,u)}function GR(r,o){var u=0;switch(r.tag){case 13:var g=r.stateNode,w=r.memoizedState;w!==null&&(u=w.retryLane);break;case 19:g=r.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(o),Sb(r,u)}var jb;jb=function(r,o,u){if(r!==null)if(r.memoizedProps!==o.pendingProps||mn.current)yn=!0;else{if((r.lanes&u)===0&&(o.flags&128)===0)return yn=!1,IR(r,o,u);yn=(r.flags&131072)!==0}else yn=!1,bt&&(o.flags&1048576)!==0&&a0(o,qc,o.index);switch(o.lanes=0,o.tag){case 2:var g=o.type;eu(r,o),r=o.pendingProps;var w=Ao(o,nn.current);Po(o,u),w=$h(null,o,g,r,w,u);var b=Oh();return o.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,gn(g)?(b=!0,Pc(o)):b=!1,o.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Eh(o),w.updater=Zc,o.stateNode=w,w._reactInternals=o,Bh(o,g,r,u),o=Hh(null,o,g,!0,b,u)):(o.tag=0,bt&&b&&yh(o),cn(null,o,w,u),o=o.child),o;case 16:g=o.elementType;e:{switch(eu(r,o),r=o.pendingProps,w=g._init,g=w(g._payload),o.type=g,w=o.tag=YR(g),r=sr(g,r),w){case 0:o=Wh(null,o,g,r,u);break e;case 1:o=Z0(null,o,g,r,u);break e;case 11:o=V0(null,o,g,r,u);break e;case 14:o=Y0(null,o,g,sr(g.type,r),u);break e}throw Error(n(306,g,""))}return o;case 0:return g=o.type,w=o.pendingProps,w=o.elementType===g?w:sr(g,w),Wh(r,o,g,w,u);case 1:return g=o.type,w=o.pendingProps,w=o.elementType===g?w:sr(g,w),Z0(r,o,g,w,u);case 3:e:{if(J0(o),r===null)throw Error(n(387));g=o.pendingProps,b=o.memoizedState,w=b.element,p0(r,o),Hc(o,g,null,u);var M=o.memoizedState;if(g=M.element,b.isDehydrated)if(b={element:g,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},o.updateQueue.baseState=b,o.memoizedState=b,o.flags&256){w=Do(Error(n(423)),o),o=eb(r,o,g,u,w);break e}else if(g!==w){w=Do(Error(n(424)),o),o=eb(r,o,g,u,w);break e}else for(En=Es(o.stateNode.containerInfo.firstChild),jn=o,bt=!0,rr=null,u=h0(o,null,g,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Io(),g===w){o=is(r,o,u);break e}cn(r,o,g,u)}o=o.child}return o;case 5:return y0(o),r===null&&xh(o),g=o.type,w=o.pendingProps,b=r!==null?r.memoizedProps:null,M=w.children,dh(g,w)?M=null:b!==null&&dh(g,b)&&(o.flags|=32),Q0(r,o),cn(r,o,M,u),o.child;case 6:return r===null&&xh(o),null;case 13:return tb(r,o,u);case 4:return Ch(o,o.stateNode.containerInfo),g=o.pendingProps,r===null?o.child=$o(o,null,g,u):cn(r,o,g,u),o.child;case 11:return g=o.type,w=o.pendingProps,w=o.elementType===g?w:sr(g,w),V0(r,o,g,w,u);case 7:return cn(r,o,o.pendingProps,u),o.child;case 8:return cn(r,o,o.pendingProps.children,u),o.child;case 12:return cn(r,o,o.pendingProps.children,u),o.child;case 10:e:{if(g=o.type._context,w=o.pendingProps,b=o.memoizedProps,M=w.value,yt(zc,g._currentValue),g._currentValue=M,b!==null)if(fn(b.value,M)){if(b.children===w.children&&!mn.current){o=is(r,o,u);break e}}else for(b=o.child,b!==null&&(b.return=o);b!==null;){var Q=b.dependencies;if(Q!==null){M=b.child;for(var te=Q.firstContext;te!==null;){if(te.context===g){if(b.tag===1){te=os(-1,u&-u),te.tag=2;var de=b.updateQueue;if(de!==null){de=de.shared;var be=de.pending;be===null?te.next=te:(te.next=be.next,be.next=te),de.pending=te}}b.lanes|=u,te=b.alternate,te!==null&&(te.lanes|=u),Sh(b.return,u,o),Q.lanes|=u;break}te=te.next}}else if(b.tag===10)M=b.type===o.type?null:b.child;else if(b.tag===18){if(M=b.return,M===null)throw Error(n(341));M.lanes|=u,Q=M.alternate,Q!==null&&(Q.lanes|=u),Sh(M,u,o),M=b.sibling}else M=b.child;if(M!==null)M.return=b;else for(M=b;M!==null;){if(M===o){M=null;break}if(b=M.sibling,b!==null){b.return=M.return,M=b;break}M=M.return}b=M}cn(r,o,w.children,u),o=o.child}return o;case 9:return w=o.type,g=o.pendingProps.children,Po(o,u),w=Fn(w),g=g(w),o.flags|=1,cn(r,o,g,u),o.child;case 14:return g=o.type,w=sr(g,o.pendingProps),w=sr(g.type,w),Y0(r,o,g,w,u);case 15:return K0(r,o,o.type,o.pendingProps,u);case 17:return g=o.type,w=o.pendingProps,w=o.elementType===g?w:sr(g,w),eu(r,o),o.tag=1,gn(g)?(r=!0,Pc(o)):r=!1,Po(o,u),F0(o,g,w),Bh(o,g,w,u),Hh(null,o,g,!0,r,u);case 19:return rb(r,o,u);case 22:return X0(r,o,u)}throw Error(n(156,o.tag))};function Eb(r,o){return ra(r,o)}function VR(r,o,u,g){this.tag=r,this.key=u,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 Un(r,o,u,g){return new VR(r,o,u,g)}function hf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function YR(r){if(typeof r=="function")return hf(r)?1:0;if(r!=null){if(r=r.$$typeof,r===Z)return 11;if(r===X)return 14}return 2}function Ds(r,o){var u=r.alternate;return u===null?(u=Un(r.tag,o,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=o,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&14680064,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,o=r.dependencies,u.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u}function du(r,o,u,g,w,b){var M=2;if(g=r,typeof r=="function")hf(r)&&(M=1);else if(typeof r=="string")M=5;else e:switch(r){case A:return Da(u.children,w,b,o);case D:M=8,w|=8;break;case O:return r=Un(12,u,o,w|2),r.elementType=O,r.lanes=b,r;case J:return r=Un(13,u,o,w),r.elementType=J,r.lanes=b,r;case I:return r=Un(19,u,o,w),r.elementType=I,r.lanes=b,r;case q:return hu(u,w,b,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case $:M=10;break e;case B:M=9;break e;case Z:M=11;break e;case X:M=14;break e;case G:M=16,g=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Un(M,u,o,w),o.elementType=r,o.type=g,o.lanes=b,o}function Da(r,o,u,g){return r=Un(7,r,g,o),r.lanes=u,r}function hu(r,o,u,g){return r=Un(22,r,g,o),r.elementType=q,r.lanes=u,r.stateNode={isHidden:!1},r}function ff(r,o,u){return r=Un(6,r,null,o),r.lanes=u,r}function pf(r,o,u){return o=Un(4,r.children!==null?r.children:[],r.key,o),o.lanes=u,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function KR(r,o,u,g,w){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=Ni(0),this.expirationTimes=Ni(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ni(0),this.identifierPrefix=g,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function mf(r,o,u,g,w,b,M,Q,te){return r=new KR(r,o,u,Q,te),o===1?(o=1,b===!0&&(o|=8)):o=0,b=Un(3,null,null,o),r.current=b,b.stateNode=r,b.memoizedState={element:g,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},Eh(b),r}function XR(r,o,u){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:u}}function Cb(r){if(!r)return Ts;r=r._reactInternals;e:{if(In(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(gn(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var u=r.type;if(gn(u))return n0(r,u,o)}return o}function Tb(r,o,u,g,w,b,M,Q,te){return r=mf(u,g,!0,r,w,b,M,Q,te),r.context=Cb(null),u=r.current,g=un(),w=Ps(u),b=os(g,w),b.callback=o??null,Ms(u,b,w),r.current.lanes=w,on(r,w,g),vn(r,g),r}function fu(r,o,u,g){var w=o.current,b=un(),M=Ps(w);return u=Cb(u),o.context===null?o.context=u:o.pendingContext=u,o=os(b,M),o.payload={element:r},g=g===void 0?null:g,g!==null&&(o.callback=g),r=Ms(w,o,M),r!==null&&(ir(r,w,M,b),Wc(r,w,M)),M}function pu(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 Ab(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<o?u:o}}function gf(r,o){Ab(r,o),(r=r.alternate)&&Ab(r,o)}function QR(){return null}var Rb=typeof reportError=="function"?reportError:function(r){console.error(r)};function yf(r){this._internalRoot=r}mu.prototype.render=yf.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));fu(r,o,null,null)},mu.prototype.unmount=yf.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;Oa(function(){fu(null,r,null,null)}),o[ts]=null}};function mu(r){this._internalRoot=r}mu.prototype.unstable_scheduleHydration=function(r){if(r){var o=ji();r={blockedOn:null,target:r,priority:o};for(var u=0;u<tr.length&&o!==0&&o<tr[u].priority;u++);tr.splice(u,0,r),u===0&&co(r)}};function wf(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function gu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Mb(){}function ZR(r,o,u,g,w){if(w){if(typeof g=="function"){var b=g;g=function(){var de=pu(M);b.call(de)}}var M=Tb(o,g,r,0,null,!1,!1,"",Mb);return r._reactRootContainer=M,r[ts]=M.current,Tr(r.nodeType===8?r.parentNode:r),Oa(),M}for(;w=r.lastChild;)r.removeChild(w);if(typeof g=="function"){var Q=g;g=function(){var de=pu(te);Q.call(de)}}var te=mf(r,0,!1,null,null,!1,!1,"",Mb);return r._reactRootContainer=te,r[ts]=te.current,Tr(r.nodeType===8?r.parentNode:r),Oa(function(){fu(o,te,u,g)}),te}function yu(r,o,u,g,w){var b=u._reactRootContainer;if(b){var M=b;if(typeof w=="function"){var Q=w;w=function(){var te=pu(M);Q.call(te)}}fu(o,M,r,w)}else M=ZR(u,o,r,w,g);return pu(M)}ca=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var u=ws(o.pendingLanes);u!==0&&(io(o,u|1),vn(o,mt()),(it&6)===0&&(Bo=mt()+500,As()))}break;case 13:Oa(function(){var g=as(r,1);if(g!==null){var w=un();ir(g,r,1,w)}}),gf(r,1)}},Si=function(r){if(r.tag===13){var o=as(r,134217728);if(o!==null){var u=un();ir(o,r,134217728,u)}gf(r,134217728)}},uc=function(r){if(r.tag===13){var o=Ps(r),u=as(r,o);if(u!==null){var g=un();ir(u,r,o,g)}gf(r,o)}},ji=function(){return ct},Ei=function(r,o){var u=ct;try{return ct=r,o()}finally{ct=u}},Te=function(r,o,u){switch(o){case"input":if(_e(r,u),o=u.name,u.type==="radio"&&o!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<u.length;o++){var g=u[o];if(g!==r&&g.form===r.form){var w=$c(g);if(!w)throw Error(n(90));$e(g),_e(g,w)}}}break;case"textarea":fe(r,u);break;case"select":o=u.value,o!=null&&Je(r,!!u.multiple,o,!1)}},Qn=cf,Br=Oa;var JR={usingClientEntryPoint:!1,Events:[el,Co,$c,Yt,Fr,cf]},pl={findFiberByHostInstance:Ea,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},eM={bundleType:pl.bundleType,version:pl.version,rendererPackageName:pl.rendererPackageName,rendererConfig:pl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=ta(r),r===null?null:r.stateNode},findFiberByHostInstance:pl.findFiberByHostInstance||QR,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 wu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wu.isDisabled&&wu.supportsFiber)try{Yr=wu.inject(eM),Ot=wu}catch{}}return xn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=JR,xn.createPortal=function(r,o){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!wf(o))throw Error(n(200));return XR(r,o,null,u)},xn.createRoot=function(r,o){if(!wf(r))throw Error(n(299));var u=!1,g="",w=Rb;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(g=o.identifierPrefix),o.onRecoverableError!==void 0&&(w=o.onRecoverableError)),o=mf(r,1,!1,null,null,u,!1,g,w),r[ts]=o.current,Tr(r.nodeType===8?r.parentNode:r),new yf(o)},xn.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=ta(o),r=r===null?null:r.stateNode,r},xn.flushSync=function(r){return Oa(r)},xn.hydrate=function(r,o,u){if(!gu(o))throw Error(n(200));return yu(null,r,o,!0,u)},xn.hydrateRoot=function(r,o,u){if(!wf(r))throw Error(n(405));var g=u!=null&&u.hydratedSources||null,w=!1,b="",M=Rb;if(u!=null&&(u.unstable_strictMode===!0&&(w=!0),u.identifierPrefix!==void 0&&(b=u.identifierPrefix),u.onRecoverableError!==void 0&&(M=u.onRecoverableError)),o=Tb(o,null,r,1,u??null,w,!1,b,M),r[ts]=o.current,Tr(r),g)for(r=0;r<g.length;r++)u=g[r],w=u._getVersion,w=w(u._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[u,w]:o.mutableSourceEagerHydrationData.push(u,w);return new mu(o)},xn.render=function(r,o,u){if(!gu(o))throw Error(n(200));return yu(null,r,o,!1,u)},xn.unmountComponentAtNode=function(r){if(!gu(r))throw Error(n(40));return r._reactRootContainer?(Oa(function(){yu(null,null,r,!1,function(){r._reactRootContainer=null,r[ts]=null})}),!0):!1},xn.unstable_batchedUpdates=cf,xn.unstable_renderSubtreeIntoContainer=function(r,o,u,g){if(!gu(u))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return yu(r,o,u,!1,g)},xn.version="18.3.1-next-f1338f8080-20240426",xn}var Fb;function LC(){if(Fb)return bf.exports;Fb=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(),bf.exports=iM(),bf.exports}var Bb;function lM(){if(Bb)return xu;Bb=1;var e=LC();return xu.createRoot=e.createRoot,xu.hydrateRoot=e.hydrateRoot,xu}var cM=lM(),x=Gl();const pe=Qv(x);function Jt(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=Jt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Nf={exports:{}},Sf={},jf={exports:{}},Ef={};/**
|
|
40
|
+
`+b.stack}return{value:r,source:o,stack:w,digest:null}}function zh(r,o,u){return{value:r,source:null,stack:u??null,digest:o??null}}function Uh(r,o){try{console.error(o.value)}catch(u){setTimeout(function(){throw u})}}var RR=typeof WeakMap=="function"?WeakMap:Map;function U0(r,o,u){u=os(-1,u),u.tag=3,u.payload={element:null};var g=o.value;return u.callback=function(){au||(au=!0,sf=g),Uh(r,o)},u}function W0(r,o,u){u=os(-1,u),u.tag=3;var g=r.type.getDerivedStateFromError;if(typeof g=="function"){var w=o.value;u.payload=function(){return g(w)},u.callback=function(){Uh(r,o)}}var b=r.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(u.callback=function(){Uh(r,o),typeof g!="function"&&($s===null?$s=new Set([this]):$s.add(this));var M=o.stack;this.componentDidCatch(o.value,{componentStack:M!==null?M:""})}),u}function H0(r,o,u){var g=r.pingCache;if(g===null){g=r.pingCache=new RR;var w=new Set;g.set(o,w)}else w=g.get(o),w===void 0&&(w=new Set,g.set(o,w));w.has(u)||(w.add(u),r=HR.bind(null,r,o,u),o.then(r,r))}function G0(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 V0(r,o,u,g,w){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(o=os(-1,1),o.tag=2,Ms(u,o,1))),u.lanes|=1),r):(r.flags|=65536,r.lanes=w,r)}var MR=C.ReactCurrentOwner,yn=!1;function cn(r,o,u,g){o.child=r===null?f0(o,null,u,g):Po(o,r.child,u,g)}function Y0(r,o,u,g,w){u=u.render;var b=o.ref;return Do(o,w),g=$h(r,o,u,g,b,w),u=Oh(),r!==null&&!yn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~w,is(r,o,w)):(bt&&u&&yh(o),o.flags|=1,cn(r,o,g,w),o.child)}function K0(r,o,u,g,w){if(r===null){var b=u.type;return typeof b=="function"&&!hf(b)&&b.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(o.tag=15,o.type=b,X0(r,o,b,g,w)):(r=du(u.type,null,g,o,o.mode,w),r.ref=o.ref,r.return=o,o.child=r)}if(b=r.child,(r.lanes&w)===0){var M=b.memoizedProps;if(u=u.compare,u=u!==null?u:At,u(M,g)&&r.ref===o.ref)return is(r,o,w)}return o.flags|=1,r=Ds(b,g),r.ref=o.ref,r.return=o,o.child=r}function X0(r,o,u,g,w){if(r!==null){var b=r.memoizedProps;if(At(b,g)&&r.ref===o.ref)if(yn=!1,o.pendingProps=g=b,(r.lanes&w)!==0)(r.flags&131072)!==0&&(yn=!0);else return o.lanes=r.lanes,is(r,o,w)}return Wh(r,o,u,g,w)}function Q0(r,o,u){var g=o.pendingProps,w=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},yt(zo,Cn),Cn|=u;else{if((u&1073741824)===0)return r=b!==null?b.baseLanes|u:u,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,yt(zo,Cn),Cn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=b!==null?b.baseLanes:u,yt(zo,Cn),Cn|=g}else b!==null?(g=b.baseLanes|u,o.memoizedState=null):g=u,yt(zo,Cn),Cn|=g;return cn(r,o,w,u),o.child}function Z0(r,o){var u=o.ref;(r===null&&u!==null||r!==null&&r.ref!==u)&&(o.flags|=512,o.flags|=2097152)}function Wh(r,o,u,g,w){var b=gn(u)?Ta:nn.current;return b=Mo(o,b),Do(o,w),u=$h(r,o,u,g,b,w),g=Oh(),r!==null&&!yn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~w,is(r,o,w)):(bt&&g&&yh(o),o.flags|=1,cn(r,o,u,w),o.child)}function J0(r,o,u,g,w){if(gn(u)){var b=!0;Pc(o)}else b=!1;if(Do(o,w),o.stateNode===null)eu(r,o),B0(o,u,g),Bh(o,u,g,w),g=!0;else if(r===null){var M=o.stateNode,Q=o.memoizedProps;M.props=Q;var te=M.context,de=u.contextType;typeof de=="object"&&de!==null?de=Fn(de):(de=gn(u)?Ta:nn.current,de=Mo(o,de));var be=u.getDerivedStateFromProps,ke=typeof be=="function"||typeof M.getSnapshotBeforeUpdate=="function";ke||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(Q!==g||te!==de)&&z0(o,M,g,de),Rs=!1;var ve=o.memoizedState;M.state=ve,Hc(o,g,M,w),te=o.memoizedState,Q!==g||ve!==te||mn.current||Rs?(typeof be=="function"&&(Fh(o,u,be,g),te=o.memoizedState),(Q=Rs||F0(o,u,Q,g,ve,te,de))?(ke||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(o.flags|=4194308)):(typeof M.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=g,o.memoizedState=te),M.props=g,M.state=te,M.context=de,g=Q):(typeof M.componentDidMount=="function"&&(o.flags|=4194308),g=!1)}else{M=o.stateNode,m0(r,o),Q=o.memoizedProps,de=o.type===o.elementType?Q:sr(o.type,Q),M.props=de,ke=o.pendingProps,ve=M.context,te=u.contextType,typeof te=="object"&&te!==null?te=Fn(te):(te=gn(u)?Ta:nn.current,te=Mo(o,te));var Ae=u.getDerivedStateFromProps;(be=typeof Ae=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(Q!==ke||ve!==te)&&z0(o,M,g,te),Rs=!1,ve=o.memoizedState,M.state=ve,Hc(o,g,M,w);var Oe=o.memoizedState;Q!==ke||ve!==Oe||mn.current||Rs?(typeof Ae=="function"&&(Fh(o,u,Ae,g),Oe=o.memoizedState),(de=Rs||F0(o,u,de,g,ve,Oe,te)||!1)?(be||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(g,Oe,te),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(g,Oe,te)),typeof M.componentDidUpdate=="function"&&(o.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof M.componentDidUpdate!="function"||Q===r.memoizedProps&&ve===r.memoizedState||(o.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||Q===r.memoizedProps&&ve===r.memoizedState||(o.flags|=1024),o.memoizedProps=g,o.memoizedState=Oe),M.props=g,M.state=Oe,M.context=te,g=de):(typeof M.componentDidUpdate!="function"||Q===r.memoizedProps&&ve===r.memoizedState||(o.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||Q===r.memoizedProps&&ve===r.memoizedState||(o.flags|=1024),g=!1)}return Hh(r,o,u,g,b,w)}function Hh(r,o,u,g,w,b){Z0(r,o);var M=(o.flags&128)!==0;if(!g&&!M)return w&&s0(o,u,!1),is(r,o,b);g=o.stateNode,MR.current=o;var Q=M&&typeof u.getDerivedStateFromError!="function"?null:g.render();return o.flags|=1,r!==null&&M?(o.child=Po(o,r.child,null,b),o.child=Po(o,null,Q,b)):cn(r,o,Q,b),o.memoizedState=g.state,w&&s0(o,u,!0),o.child}function eb(r){var o=r.stateNode;o.pendingContext?n0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&n0(r,o.context,!1),Ch(r,o.containerInfo)}function tb(r,o,u,g,w){return Oo(),bh(w),o.flags|=256,cn(r,o,u,g),o.child}var Gh={dehydrated:null,treeContext:null,retryLane:0};function Vh(r){return{baseLanes:r,cachePool:null,transitions:null}}function nb(r,o,u){var g=o.pendingProps,w=_t.current,b=!1,M=(o.flags&128)!==0,Q;if((Q=M)||(Q=r!==null&&r.memoizedState===null?!1:(w&2)!==0),Q?(b=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(w|=1),yt(_t,w&1),r===null)return xh(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):(M=g.children,r=g.fallback,b?(g=o.mode,b=o.child,M={mode:"hidden",children:M},(g&1)===0&&b!==null?(b.childLanes=0,b.pendingProps=M):b=hu(M,g,0,null),r=qa(r,g,u,null),b.return=o,r.return=o,b.sibling=r,o.child=b,o.child.memoizedState=Vh(u),o.memoizedState=Gh,r):Yh(o,M));if(w=r.memoizedState,w!==null&&(Q=w.dehydrated,Q!==null))return IR(r,o,M,g,Q,w,u);if(b){b=g.fallback,M=o.mode,w=r.child,Q=w.sibling;var te={mode:"hidden",children:g.children};return(M&1)===0&&o.child!==w?(g=o.child,g.childLanes=0,g.pendingProps=te,o.deletions=null):(g=Ds(w,te),g.subtreeFlags=w.subtreeFlags&14680064),Q!==null?b=Ds(Q,b):(b=qa(b,M,u,null),b.flags|=2),b.return=o,g.return=o,g.sibling=b,o.child=g,g=b,b=o.child,M=r.child.memoizedState,M=M===null?Vh(u):{baseLanes:M.baseLanes|u,cachePool:null,transitions:M.transitions},b.memoizedState=M,b.childLanes=r.childLanes&~u,o.memoizedState=Gh,g}return b=r.child,r=b.sibling,g=Ds(b,{mode:"visible",children:g.children}),(o.mode&1)===0&&(g.lanes=u),g.return=o,g.sibling=null,r!==null&&(u=o.deletions,u===null?(o.deletions=[r],o.flags|=16):u.push(r)),o.child=g,o.memoizedState=null,g}function Yh(r,o){return o=hu({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Jc(r,o,u,g){return g!==null&&bh(g),Po(o,r.child,null,u),r=Yh(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function IR(r,o,u,g,w,b,M){if(u)return o.flags&256?(o.flags&=-257,g=zh(Error(n(422))),Jc(r,o,M,g)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(b=g.fallback,w=o.mode,g=hu({mode:"visible",children:g.children},w,0,null),b=qa(b,w,M,null),b.flags|=2,g.return=o,b.return=o,g.sibling=b,o.child=g,(o.mode&1)!==0&&Po(o,r.child,null,M),o.child.memoizedState=Vh(M),o.memoizedState=Gh,b);if((o.mode&1)===0)return Jc(r,o,M,null);if(w.data==="$!"){if(g=w.nextSibling&&w.nextSibling.dataset,g)var Q=g.dgst;return g=Q,b=Error(n(419)),g=zh(b,g,void 0),Jc(r,o,M,g)}if(Q=(M&r.childLanes)!==0,yn||Q){if(g=Wt,g!==null){switch(M&-M){case 4:w=2;break;case 16:w=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:w=32;break;case 536870912:w=268435456;break;default:w=0}w=(w&(g.suspendedLanes|M))!==0?0:w,w!==0&&w!==b.retryLane&&(b.retryLane=w,as(r,w),ir(g,r,w,-1))}return df(),g=zh(Error(n(421))),Jc(r,o,M,g)}return w.data==="$?"?(o.flags|=128,o.child=r.child,o=GR.bind(null,r),w._reactRetry=o,null):(r=b.treeContext,En=Es(w.nextSibling),jn=o,bt=!0,rr=null,r!==null&&(Dn[qn++]=rs,Dn[qn++]=ss,Dn[qn++]=Aa,rs=r.id,ss=r.overflow,Aa=o),o=Yh(o,g.children),o.flags|=4096,o)}function rb(r,o,u){r.lanes|=o;var g=r.alternate;g!==null&&(g.lanes|=o),Sh(r.return,o,u)}function Kh(r,o,u,g,w){var b=r.memoizedState;b===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:g,tail:u,tailMode:w}:(b.isBackwards=o,b.rendering=null,b.renderingStartTime=0,b.last=g,b.tail=u,b.tailMode=w)}function sb(r,o,u){var g=o.pendingProps,w=g.revealOrder,b=g.tail;if(cn(r,o,g.children,u),g=_t.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&&rb(r,u,o);else if(r.tag===19)rb(r,u,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(yt(_t,g),(o.mode&1)===0)o.memoizedState=null;else switch(w){case"forwards":for(u=o.child,w=null;u!==null;)r=u.alternate,r!==null&&Gc(r)===null&&(w=u),u=u.sibling;u=w,u===null?(w=o.child,o.child=null):(w=u.sibling,u.sibling=null),Kh(o,!1,w,u,b);break;case"backwards":for(u=null,w=o.child,o.child=null;w!==null;){if(r=w.alternate,r!==null&&Gc(r)===null){o.child=w;break}r=w.sibling,w.sibling=u,u=w,w=r}Kh(o,!0,u,null,b);break;case"together":Kh(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function eu(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function is(r,o,u){if(r!==null&&(o.dependencies=r.dependencies),Oa|=o.lanes,(u&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,u=Ds(r,r.pendingProps),o.child=u,u.return=o;r.sibling!==null;)r=r.sibling,u=u.sibling=Ds(r,r.pendingProps),u.return=o;u.sibling=null}return o.child}function $R(r,o,u){switch(o.tag){case 3:eb(o),Oo();break;case 5:w0(o);break;case 1:gn(o.type)&&Pc(o);break;case 4:Ch(o,o.stateNode.containerInfo);break;case 10:var g=o.type._context,w=o.memoizedProps.value;yt(zc,g._currentValue),g._currentValue=w;break;case 13:if(g=o.memoizedState,g!==null)return g.dehydrated!==null?(yt(_t,_t.current&1),o.flags|=128,null):(u&o.child.childLanes)!==0?nb(r,o,u):(yt(_t,_t.current&1),r=is(r,o,u),r!==null?r.sibling:null);yt(_t,_t.current&1);break;case 19:if(g=(u&o.childLanes)!==0,(r.flags&128)!==0){if(g)return sb(r,o,u);o.flags|=128}if(w=o.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),yt(_t,_t.current),g)break;return null;case 22:case 23:return o.lanes=0,Q0(r,o,u)}return is(r,o,u)}var ab,Xh,ob,ib;ab=function(r,o){for(var u=o.child;u!==null;){if(u.tag===5||u.tag===6)r.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},Xh=function(){},ob=function(r,o,u,g){var w=r.memoizedProps;if(w!==g){r=o.stateNode,Ia(Rr.current);var b=null;switch(u){case"input":w=we(r,w),g=we(r,g),b=[];break;case"select":w=K({},w,{value:void 0}),g=K({},g,{value:void 0}),b=[];break;case"textarea":w=Ze(r,w),g=Ze(r,g),b=[];break;default:typeof w.onClick!="function"&&typeof g.onClick=="function"&&(r.onclick=Ic)}Ce(u,g);var M;u=null;for(de in w)if(!g.hasOwnProperty(de)&&w.hasOwnProperty(de)&&w[de]!=null)if(de==="style"){var Q=w[de];for(M in Q)Q.hasOwnProperty(M)&&(u||(u={}),u[M]="")}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 te=g[de];if(Q=w!=null?w[de]:void 0,g.hasOwnProperty(de)&&te!==Q&&(te!=null||Q!=null))if(de==="style")if(Q){for(M in Q)!Q.hasOwnProperty(M)||te&&te.hasOwnProperty(M)||(u||(u={}),u[M]="");for(M in te)te.hasOwnProperty(M)&&Q[M]!==te[M]&&(u||(u={}),u[M]=te[M])}else u||(b||(b=[]),b.push(de,u)),u=te;else de==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,Q=Q?Q.__html:void 0,te!=null&&Q!==te&&(b=b||[]).push(de,te)):de==="children"?typeof te!="string"&&typeof te!="number"||(b=b||[]).push(de,""+te):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(a.hasOwnProperty(de)?(te!=null&&de==="onScroll"&&Ye("scroll",r),b||Q===te||(b=[])):(b=b||[]).push(de,te))}u&&(b=b||[]).push("style",u);var de=b;(o.updateQueue=de)&&(o.flags|=4)}},ib=function(r,o,u,g){u!==g&&(o.flags|=4)};function ul(r,o){if(!bt)switch(r.tailMode){case"hidden":o=r.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var g=null;u!==null;)u.alternate!==null&&(g=u),u=u.sibling;g===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:g.sibling=null}}function sn(r){var o=r.alternate!==null&&r.alternate.child===r.child,u=0,g=0;if(o)for(var w=r.child;w!==null;)u|=w.lanes|w.childLanes,g|=w.subtreeFlags&14680064,g|=w.flags&14680064,w.return=r,w=w.sibling;else for(w=r.child;w!==null;)u|=w.lanes|w.childLanes,g|=w.subtreeFlags,g|=w.flags,w.return=r,w=w.sibling;return r.subtreeFlags|=g,r.childLanes=u,o}function OR(r,o,u){var g=o.pendingProps;switch(wh(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sn(o),null;case 1:return gn(o.type)&&Oc(),sn(o),null;case 3:return g=o.stateNode,qo(),vt(mn),vt(nn),Rh(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(r===null||r.child===null)&&(Fc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,rr!==null&&(lf(rr),rr=null))),Xh(r,o),sn(o),null;case 5:Th(o);var w=Ia(al.current);if(u=o.type,r!==null&&o.stateNode!=null)ob(r,o,u,g,w),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!g){if(o.stateNode===null)throw Error(n(166));return sn(o),null}if(r=Ia(Rr.current),Fc(o)){g=o.stateNode,u=o.type;var b=o.memoizedProps;switch(g[Ar]=o,g[el]=b,r=(o.mode&1)!==0,u){case"dialog":Ye("cancel",g),Ye("close",g);break;case"iframe":case"object":case"embed":Ye("load",g);break;case"video":case"audio":for(w=0;w<je.length;w++)Ye(je[w],g);break;case"source":Ye("error",g);break;case"img":case"image":case"link":Ye("error",g),Ye("load",g);break;case"details":Ye("toggle",g);break;case"input":xe(g,b),Ye("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!b.multiple},Ye("invalid",g);break;case"textarea":Qe(g,b),Ye("invalid",g)}Ce(u,b),w=null;for(var M in b)if(b.hasOwnProperty(M)){var Q=b[M];M==="children"?typeof Q=="string"?g.textContent!==Q&&(b.suppressHydrationWarning!==!0&&Ea(g.textContent,Q,r),w=["children",Q]):typeof Q=="number"&&g.textContent!==""+Q&&(b.suppressHydrationWarning!==!0&&Ea(g.textContent,Q,r),w=["children",""+Q]):a.hasOwnProperty(M)&&Q!=null&&M==="onScroll"&&Ye("scroll",g)}switch(u){case"input":Re(g),Ee(g,b,!0);break;case"textarea":Re(g),ye(g);break;case"select":case"option":break;default:typeof b.onClick=="function"&&(g.onclick=Ic)}g=w,o.updateQueue=g,g!==null&&(o.flags|=4)}else{M=w.nodeType===9?w:w.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=Se(u)),r==="http://www.w3.org/1999/xhtml"?u==="script"?(r=M.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof g.is=="string"?r=M.createElement(u,{is:g.is}):(r=M.createElement(u),u==="select"&&(M=r,g.multiple?M.multiple=!0:g.size&&(M.size=g.size))):r=M.createElementNS(r,u),r[Ar]=o,r[el]=g,ab(r,o,!1,!1),o.stateNode=r;e:{switch(M=Ve(u,g),u){case"dialog":Ye("cancel",r),Ye("close",r),w=g;break;case"iframe":case"object":case"embed":Ye("load",r),w=g;break;case"video":case"audio":for(w=0;w<je.length;w++)Ye(je[w],r);w=g;break;case"source":Ye("error",r),w=g;break;case"img":case"image":case"link":Ye("error",r),Ye("load",r),w=g;break;case"details":Ye("toggle",r),w=g;break;case"input":xe(r,g),w=we(r,g),Ye("invalid",r);break;case"option":w=g;break;case"select":r._wrapperState={wasMultiple:!!g.multiple},w=K({},g,{value:void 0}),Ye("invalid",r);break;case"textarea":Qe(r,g),w=Ze(r,g),Ye("invalid",r);break;default:w=g}Ce(u,w),Q=w;for(b in Q)if(Q.hasOwnProperty(b)){var te=Q[b];b==="style"?Fe(r,te):b==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,te!=null&&ft(r,te)):b==="children"?typeof te=="string"?(u!=="textarea"||te!=="")&&dt(r,te):typeof te=="number"&&dt(r,""+te):b!=="suppressContentEditableWarning"&&b!=="suppressHydrationWarning"&&b!=="autoFocus"&&(a.hasOwnProperty(b)?te!=null&&b==="onScroll"&&Ye("scroll",r):te!=null&&E(r,b,te,M))}switch(u){case"input":Re(r),Ee(r,g,!1);break;case"textarea":Re(r),ye(r);break;case"option":g.value!=null&&r.setAttribute("value",""+ae(g.value));break;case"select":r.multiple=!!g.multiple,b=g.value,b!=null?Je(r,!!g.multiple,b,!1):g.defaultValue!=null&&Je(r,!!g.multiple,g.defaultValue,!0);break;default:typeof w.onClick=="function"&&(r.onclick=Ic)}switch(u){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 sn(o),null;case 6:if(r&&o.stateNode!=null)ib(r,o,r.memoizedProps,g);else{if(typeof g!="string"&&o.stateNode===null)throw Error(n(166));if(u=Ia(al.current),Ia(Rr.current),Fc(o)){if(g=o.stateNode,u=o.memoizedProps,g[Ar]=o,(b=g.nodeValue!==u)&&(r=jn,r!==null))switch(r.tag){case 3:Ea(g.nodeValue,u,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&Ea(g.nodeValue,u,(r.mode&1)!==0)}b&&(o.flags|=4)}else g=(u.nodeType===9?u:u.ownerDocument).createTextNode(g),g[Ar]=o,o.stateNode=g}return sn(o),null;case 13:if(vt(_t),g=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(bt&&En!==null&&(o.mode&1)!==0&&(o.flags&128)===0)u0(),Oo(),o.flags|=98560,b=!1;else if(b=Fc(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[Ar]=o}else Oo(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;sn(o),b=!1}else rr!==null&&(lf(rr),rr=null),b=!0;if(!b)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=u,o):(g=g!==null,g!==(r!==null&&r.memoizedState!==null)&&g&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(_t.current&1)!==0?Lt===0&&(Lt=3):df())),o.updateQueue!==null&&(o.flags|=4),sn(o),null);case 4:return qo(),Xh(r,o),r===null&&Tr(o.stateNode.containerInfo),sn(o),null;case 10:return Nh(o.type._context),sn(o),null;case 17:return gn(o.type)&&Oc(),sn(o),null;case 19:if(vt(_t),b=o.memoizedState,b===null)return sn(o),null;if(g=(o.flags&128)!==0,M=b.rendering,M===null)if(g)ul(b,!1);else{if(Lt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(M=Gc(r),M!==null){for(o.flags|=128,ul(b,!1),g=M.updateQueue,g!==null&&(o.updateQueue=g,o.flags|=4),o.subtreeFlags=0,g=u,u=o.child;u!==null;)b=u,r=g,b.flags&=14680066,M=b.alternate,M===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=M.childLanes,b.lanes=M.lanes,b.child=M.child,b.subtreeFlags=0,b.deletions=null,b.memoizedProps=M.memoizedProps,b.memoizedState=M.memoizedState,b.updateQueue=M.updateQueue,b.type=M.type,r=M.dependencies,b.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),u=u.sibling;return yt(_t,_t.current&1|2),o.child}r=r.sibling}b.tail!==null&&mt()>Uo&&(o.flags|=128,g=!0,ul(b,!1),o.lanes=4194304)}else{if(!g)if(r=Gc(M),r!==null){if(o.flags|=128,g=!0,u=r.updateQueue,u!==null&&(o.updateQueue=u,o.flags|=4),ul(b,!0),b.tail===null&&b.tailMode==="hidden"&&!M.alternate&&!bt)return sn(o),null}else 2*mt()-b.renderingStartTime>Uo&&u!==1073741824&&(o.flags|=128,g=!0,ul(b,!1),o.lanes=4194304);b.isBackwards?(M.sibling=o.child,o.child=M):(u=b.last,u!==null?u.sibling=M:o.child=M,b.last=M)}return b.tail!==null?(o=b.tail,b.rendering=o,b.tail=o.sibling,b.renderingStartTime=mt(),o.sibling=null,u=_t.current,yt(_t,g?u&1|2:u&1),o):(sn(o),null);case 22:case 23:return uf(),g=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==g&&(o.flags|=8192),g&&(o.mode&1)!==0?(Cn&1073741824)!==0&&(sn(o),o.subtreeFlags&6&&(o.flags|=8192)):sn(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function PR(r,o){switch(wh(o),o.tag){case 1:return gn(o.type)&&Oc(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return qo(),vt(mn),vt(nn),Rh(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Th(o),null;case 13:if(vt(_t),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));Oo()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return vt(_t),null;case 4:return qo(),null;case 10:return Nh(o.type._context),null;case 22:case 23:return uf(),null;case 24:return null;default:return null}}var tu=!1,an=!1,LR=typeof WeakSet=="function"?WeakSet:Set,Ie=null;function Bo(r,o){var u=r.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(g){St(r,o,g)}else u.current=null}function Qh(r,o,u){try{u()}catch(g){St(r,o,g)}}var lb=!1;function DR(r,o){if(ch=fo,r=Tc(),No(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var g=u.getSelection&&u.getSelection();if(g&&g.rangeCount!==0){u=g.anchorNode;var w=g.anchorOffset,b=g.focusNode;g=g.focusOffset;try{u.nodeType,b.nodeType}catch{u=null;break e}var M=0,Q=-1,te=-1,de=0,be=0,ke=r,ve=null;t:for(;;){for(var Ae;ke!==u||w!==0&&ke.nodeType!==3||(Q=M+w),ke!==b||g!==0&&ke.nodeType!==3||(te=M+g),ke.nodeType===3&&(M+=ke.nodeValue.length),(Ae=ke.firstChild)!==null;)ve=ke,ke=Ae;for(;;){if(ke===r)break t;if(ve===u&&++de===w&&(Q=M),ve===b&&++be===g&&(te=M),(Ae=ke.nextSibling)!==null)break;ke=ve,ve=ke.parentNode}ke=Ae}u=Q===-1||te===-1?null:{start:Q,end:te}}else u=null}u=u||{start:0,end:0}}else u=null;for(uh={focusedElem:r,selectionRange:u},fo=!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 Oe=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Oe!==null){var Le=Oe.memoizedProps,Ct=Oe.memoizedState,ie=o.stateNode,ne=ie.getSnapshotBeforeUpdate(o.elementType===o.type?Le:sr(o.type,Le),Ct);ie.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var ue=o.stateNode.containerInfo;ue.nodeType===1?ue.textContent="":ue.nodeType===9&&ue.documentElement&&ue.removeChild(ue.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ne){St(o,o.return,Ne)}if(r=o.sibling,r!==null){r.return=o.return,Ie=r;break}Ie=o.return}return Oe=lb,lb=!1,Oe}function dl(r,o,u){var g=o.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var w=g=g.next;do{if((w.tag&r)===r){var b=w.destroy;w.destroy=void 0,b!==void 0&&Qh(o,u,b)}w=w.next}while(w!==g)}}function nu(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var u=o=o.next;do{if((u.tag&r)===r){var g=u.create;u.destroy=g()}u=u.next}while(u!==o)}}function Zh(r){var o=r.ref;if(o!==null){var u=r.stateNode;switch(r.tag){case 5:r=u;break;default:r=u}typeof o=="function"?o(r):o.current=r}}function cb(r){var o=r.alternate;o!==null&&(r.alternate=null,cb(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[Ar],delete o[el],delete o[ph],delete o[xR],delete o[bR])),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 ub(r){return r.tag===5||r.tag===3||r.tag===4}function db(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||ub(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 Jh(r,o,u){var g=r.tag;if(g===5||g===6)r=r.stateNode,o?u.nodeType===8?u.parentNode.insertBefore(r,o):u.insertBefore(r,o):(u.nodeType===8?(o=u.parentNode,o.insertBefore(r,u)):(o=u,o.appendChild(r)),u=u._reactRootContainer,u!=null||o.onclick!==null||(o.onclick=Ic));else if(g!==4&&(r=r.child,r!==null))for(Jh(r,o,u),r=r.sibling;r!==null;)Jh(r,o,u),r=r.sibling}function ef(r,o,u){var g=r.tag;if(g===5||g===6)r=r.stateNode,o?u.insertBefore(r,o):u.appendChild(r);else if(g!==4&&(r=r.child,r!==null))for(ef(r,o,u),r=r.sibling;r!==null;)ef(r,o,u),r=r.sibling}var Xt=null,ar=!1;function Is(r,o,u){for(u=u.child;u!==null;)hb(r,o,u),u=u.sibling}function hb(r,o,u){if(Ot&&typeof Ot.onCommitFiberUnmount=="function")try{Ot.onCommitFiberUnmount(Yr,u)}catch{}switch(u.tag){case 5:an||Bo(u,o);case 6:var g=Xt,w=ar;Xt=null,Is(r,o,u),Xt=g,ar=w,Xt!==null&&(ar?(r=Xt,u=u.stateNode,r.nodeType===8?r.parentNode.removeChild(u):r.removeChild(u)):Xt.removeChild(u.stateNode));break;case 18:Xt!==null&&(ar?(r=Xt,u=u.stateNode,r.nodeType===8?fh(r.parentNode,u):r.nodeType===1&&fh(r,u),da(r)):fh(Xt,u.stateNode));break;case 4:g=Xt,w=ar,Xt=u.stateNode.containerInfo,ar=!0,Is(r,o,u),Xt=g,ar=w;break;case 0:case 11:case 14:case 15:if(!an&&(g=u.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){w=g=g.next;do{var b=w,M=b.destroy;b=b.tag,M!==void 0&&((b&2)!==0||(b&4)!==0)&&Qh(u,o,M),w=w.next}while(w!==g)}Is(r,o,u);break;case 1:if(!an&&(Bo(u,o),g=u.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=u.memoizedProps,g.state=u.memoizedState,g.componentWillUnmount()}catch(Q){St(u,o,Q)}Is(r,o,u);break;case 21:Is(r,o,u);break;case 22:u.mode&1?(an=(g=an)||u.memoizedState!==null,Is(r,o,u),an=g):Is(r,o,u);break;default:Is(r,o,u)}}function fb(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var u=r.stateNode;u===null&&(u=r.stateNode=new LR),o.forEach(function(g){var w=VR.bind(null,r,g);u.has(g)||(u.add(g),g.then(w,w))})}}function or(r,o){var u=o.deletions;if(u!==null)for(var g=0;g<u.length;g++){var w=u[g];try{var b=r,M=o,Q=M;e:for(;Q!==null;){switch(Q.tag){case 5:Xt=Q.stateNode,ar=!1;break e;case 3:Xt=Q.stateNode.containerInfo,ar=!0;break e;case 4:Xt=Q.stateNode.containerInfo,ar=!0;break e}Q=Q.return}if(Xt===null)throw Error(n(160));hb(b,M,w),Xt=null,ar=!1;var te=w.alternate;te!==null&&(te.return=null),w.return=null}catch(de){St(w,o,de)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)pb(o,r),o=o.sibling}function pb(r,o){var u=r.alternate,g=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(or(o,r),Ir(r),g&4){try{dl(3,r,r.return),nu(3,r)}catch(Le){St(r,r.return,Le)}try{dl(5,r,r.return)}catch(Le){St(r,r.return,Le)}}break;case 1:or(o,r),Ir(r),g&512&&u!==null&&Bo(u,u.return);break;case 5:if(or(o,r),Ir(r),g&512&&u!==null&&Bo(u,u.return),r.flags&32){var w=r.stateNode;try{dt(w,"")}catch(Le){St(r,r.return,Le)}}if(g&4&&(w=r.stateNode,w!=null)){var b=r.memoizedProps,M=u!==null?u.memoizedProps:b,Q=r.type,te=r.updateQueue;if(r.updateQueue=null,te!==null)try{Q==="input"&&b.type==="radio"&&b.name!=null&&De(w,b),Ve(Q,M);var de=Ve(Q,b);for(M=0;M<te.length;M+=2){var be=te[M],ke=te[M+1];be==="style"?Fe(w,ke):be==="dangerouslySetInnerHTML"?ft(w,ke):be==="children"?dt(w,ke):E(w,be,ke,de)}switch(Q){case"input":_e(w,b);break;case"textarea":fe(w,b);break;case"select":var ve=w._wrapperState.wasMultiple;w._wrapperState.wasMultiple=!!b.multiple;var Ae=b.value;Ae!=null?Je(w,!!b.multiple,Ae,!1):ve!==!!b.multiple&&(b.defaultValue!=null?Je(w,!!b.multiple,b.defaultValue,!0):Je(w,!!b.multiple,b.multiple?[]:"",!1))}w[el]=b}catch(Le){St(r,r.return,Le)}}break;case 6:if(or(o,r),Ir(r),g&4){if(r.stateNode===null)throw Error(n(162));w=r.stateNode,b=r.memoizedProps;try{w.nodeValue=b}catch(Le){St(r,r.return,Le)}}break;case 3:if(or(o,r),Ir(r),g&4&&u!==null&&u.memoizedState.isDehydrated)try{da(o.containerInfo)}catch(Le){St(r,r.return,Le)}break;case 4:or(o,r),Ir(r);break;case 13:or(o,r),Ir(r),w=r.child,w.flags&8192&&(b=w.memoizedState!==null,w.stateNode.isHidden=b,!b||w.alternate!==null&&w.alternate.memoizedState!==null||(rf=mt())),g&4&&fb(r);break;case 22:if(be=u!==null&&u.memoizedState!==null,r.mode&1?(an=(de=an)||be,or(o,r),an=de):or(o,r),Ir(r),g&8192){if(de=r.memoizedState!==null,(r.stateNode.isHidden=de)&&!be&&(r.mode&1)!==0)for(Ie=r,be=r.child;be!==null;){for(ke=Ie=be;Ie!==null;){switch(ve=Ie,Ae=ve.child,ve.tag){case 0:case 11:case 14:case 15:dl(4,ve,ve.return);break;case 1:Bo(ve,ve.return);var Oe=ve.stateNode;if(typeof Oe.componentWillUnmount=="function"){g=ve,u=ve.return;try{o=g,Oe.props=o.memoizedProps,Oe.state=o.memoizedState,Oe.componentWillUnmount()}catch(Le){St(g,u,Le)}}break;case 5:Bo(ve,ve.return);break;case 22:if(ve.memoizedState!==null){yb(ke);continue}}Ae!==null?(Ae.return=ve,Ie=Ae):yb(ke)}be=be.sibling}e:for(be=null,ke=r;;){if(ke.tag===5){if(be===null){be=ke;try{w=ke.stateNode,de?(b=w.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none"):(Q=ke.stateNode,te=ke.memoizedProps.style,M=te!=null&&te.hasOwnProperty("display")?te.display:null,Q.style.display=re("display",M))}catch(Le){St(r,r.return,Le)}}}else if(ke.tag===6){if(be===null)try{ke.stateNode.nodeValue=de?"":ke.memoizedProps}catch(Le){St(r,r.return,Le)}}else if((ke.tag!==22&&ke.tag!==23||ke.memoizedState===null||ke===r)&&ke.child!==null){ke.child.return=ke,ke=ke.child;continue}if(ke===r)break e;for(;ke.sibling===null;){if(ke.return===null||ke.return===r)break e;be===ke&&(be=null),ke=ke.return}be===ke&&(be=null),ke.sibling.return=ke.return,ke=ke.sibling}}break;case 19:or(o,r),Ir(r),g&4&&fb(r);break;case 21:break;default:or(o,r),Ir(r)}}function Ir(r){var o=r.flags;if(o&2){try{e:{for(var u=r.return;u!==null;){if(ub(u)){var g=u;break e}u=u.return}throw Error(n(160))}switch(g.tag){case 5:var w=g.stateNode;g.flags&32&&(dt(w,""),g.flags&=-33);var b=db(r);ef(r,b,w);break;case 3:case 4:var M=g.stateNode.containerInfo,Q=db(r);Jh(r,Q,M);break;default:throw Error(n(161))}}catch(te){St(r,r.return,te)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function qR(r,o,u){Ie=r,mb(r)}function mb(r,o,u){for(var g=(r.mode&1)!==0;Ie!==null;){var w=Ie,b=w.child;if(w.tag===22&&g){var M=w.memoizedState!==null||tu;if(!M){var Q=w.alternate,te=Q!==null&&Q.memoizedState!==null||an;Q=tu;var de=an;if(tu=M,(an=te)&&!de)for(Ie=w;Ie!==null;)M=Ie,te=M.child,M.tag===22&&M.memoizedState!==null?wb(w):te!==null?(te.return=M,Ie=te):wb(w);for(;b!==null;)Ie=b,mb(b),b=b.sibling;Ie=w,tu=Q,an=de}gb(r)}else(w.subtreeFlags&8772)!==0&&b!==null?(b.return=w,Ie=b):gb(r)}}function gb(r){for(;Ie!==null;){var o=Ie;if((o.flags&8772)!==0){var u=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:an||nu(5,o);break;case 1:var g=o.stateNode;if(o.flags&4&&!an)if(u===null)g.componentDidMount();else{var w=o.elementType===o.type?u.memoizedProps:sr(o.type,u.memoizedProps);g.componentDidUpdate(w,u.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var b=o.updateQueue;b!==null&&y0(o,b,g);break;case 3:var M=o.updateQueue;if(M!==null){if(u=null,o.child!==null)switch(o.child.tag){case 5:u=o.child.stateNode;break;case 1:u=o.child.stateNode}y0(o,M,u)}break;case 5:var Q=o.stateNode;if(u===null&&o.flags&4){u=Q;var te=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":te.autoFocus&&u.focus();break;case"img":te.src&&(u.src=te.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 be=de.memoizedState;if(be!==null){var ke=be.dehydrated;ke!==null&&da(ke)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}an||o.flags&512&&Zh(o)}catch(ve){St(o,o.return,ve)}}if(o===r){Ie=null;break}if(u=o.sibling,u!==null){u.return=o.return,Ie=u;break}Ie=o.return}}function yb(r){for(;Ie!==null;){var o=Ie;if(o===r){Ie=null;break}var u=o.sibling;if(u!==null){u.return=o.return,Ie=u;break}Ie=o.return}}function wb(r){for(;Ie!==null;){var o=Ie;try{switch(o.tag){case 0:case 11:case 15:var u=o.return;try{nu(4,o)}catch(te){St(o,u,te)}break;case 1:var g=o.stateNode;if(typeof g.componentDidMount=="function"){var w=o.return;try{g.componentDidMount()}catch(te){St(o,w,te)}}var b=o.return;try{Zh(o)}catch(te){St(o,b,te)}break;case 5:var M=o.return;try{Zh(o)}catch(te){St(o,M,te)}}}catch(te){St(o,o.return,te)}if(o===r){Ie=null;break}var Q=o.sibling;if(Q!==null){Q.return=o.return,Ie=Q;break}Ie=o.return}}var FR=Math.ceil,ru=C.ReactCurrentDispatcher,tf=C.ReactCurrentOwner,zn=C.ReactCurrentBatchConfig,lt=0,Wt=null,Rt=null,Qt=0,Cn=0,zo=Cs(0),Lt=0,hl=null,Oa=0,su=0,nf=0,fl=null,wn=null,rf=0,Uo=1/0,ls=null,au=!1,sf=null,$s=null,ou=!1,Os=null,iu=0,pl=0,af=null,lu=-1,cu=0;function un(){return(lt&6)!==0?mt():lu!==-1?lu:lu=mt()}function Ps(r){return(r.mode&1)===0?1:(lt&2)!==0&&Qt!==0?Qt&-Qt:_R.transition!==null?(cu===0&&(cu=Tt()),cu):(r=ut,r!==0||(r=window.event,r=r===void 0?16:Ri(r.type)),r)}function ir(r,o,u,g){if(50<pl)throw pl=0,af=null,Error(n(185));on(r,u,g),((lt&2)===0||r!==Wt)&&(r===Wt&&((lt&2)===0&&(su|=u),Lt===4&&Ls(r,Qt)),vn(r,g),u===1&<===0&&(o.mode&1)===0&&(Uo=mt()+500,Lc&&As()))}function vn(r,o){var u=r.callbackNode;Xd(r,o);var g=en(r,r===Wt?Qt:0);if(g===0)u!==null&&ro(u),r.callbackNode=null,r.callbackPriority=0;else if(o=g&-g,r.callbackPriority!==o){if(u!=null&&ro(u),o===1)r.tag===0?kR(xb.bind(null,r)):a0(xb.bind(null,r)),wR(function(){(lt&6)===0&&As()}),u=null;else{switch(Jn(g)){case 1:u=aa;break;case 4:u=Hr;break;case 16:u=Gr;break;case 536870912:u=oa;break;default:u=Gr}u=Cb(u,vb.bind(null,r))}r.callbackPriority=o,r.callbackNode=u}}function vb(r,o){if(lu=-1,cu=0,(lt&6)!==0)throw Error(n(327));var u=r.callbackNode;if(Wo()&&r.callbackNode!==u)return null;var g=en(r,r===Wt?Qt:0);if(g===0)return null;if((g&30)!==0||(g&r.expiredLanes)!==0||o)o=uu(r,g);else{o=g;var w=lt;lt|=2;var b=kb();(Wt!==r||Qt!==o)&&(ls=null,Uo=mt()+500,La(r,o));do try{UR();break}catch(Q){bb(r,Q)}while(!0);_h(),ru.current=b,lt=w,Rt!==null?o=0:(Wt=null,Qt=0,o=Lt)}if(o!==0){if(o===2&&(w=la(r),w!==0&&(g=w,o=of(r,w))),o===1)throw u=hl,La(r,0),Ls(r,g),vn(r,mt()),u;if(o===6)Ls(r,g);else{if(w=r.current.alternate,(g&30)===0&&!BR(w)&&(o=uu(r,g),o===2&&(b=la(r),b!==0&&(g=b,o=of(r,b))),o===1))throw u=hl,La(r,0),Ls(r,g),vn(r,mt()),u;switch(r.finishedWork=w,r.finishedLanes=g,o){case 0:case 1:throw Error(n(345));case 2:Da(r,wn,ls);break;case 3:if(Ls(r,g),(g&130023424)===g&&(o=rf+500-mt(),10<o)){if(en(r,0)!==0)break;if(w=r.suspendedLanes,(w&g)!==g){un(),r.pingedLanes|=r.suspendedLanes&w;break}r.timeoutHandle=hh(Da.bind(null,r,wn,ls),o);break}Da(r,wn,ls);break;case 4:if(Ls(r,g),(g&4194240)===g)break;for(o=r.eventTimes,w=-1;0<g;){var M=31-dn(g);b=1<<M,M=o[M],M>w&&(w=M),g&=~b}if(g=w,g=mt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*FR(g/1960))-g,10<g){r.timeoutHandle=hh(Da.bind(null,r,wn,ls),g);break}Da(r,wn,ls);break;case 5:Da(r,wn,ls);break;default:throw Error(n(329))}}}return vn(r,mt()),r.callbackNode===u?vb.bind(null,r):null}function of(r,o){var u=fl;return r.current.memoizedState.isDehydrated&&(La(r,o).flags|=256),r=uu(r,o),r!==2&&(o=wn,wn=u,o!==null&&lf(o)),r}function lf(r){wn===null?wn=r:wn.push.apply(wn,r)}function BR(r){for(var o=r;;){if(o.flags&16384){var u=o.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var g=0;g<u.length;g++){var w=u[g],b=w.getSnapshot;w=w.value;try{if(!fn(b(),w))return!1}catch{return!1}}}if(u=o.child,o.subtreeFlags&16384&&u!==null)u.return=o,o=u;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 Ls(r,o){for(o&=~nf,o&=~su,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var u=31-dn(o),g=1<<u;r[u]=-1,o&=~g}}function xb(r){if((lt&6)!==0)throw Error(n(327));Wo();var o=en(r,0);if((o&1)===0)return vn(r,mt()),null;var u=uu(r,o);if(r.tag!==0&&u===2){var g=la(r);g!==0&&(o=g,u=of(r,g))}if(u===1)throw u=hl,La(r,0),Ls(r,o),vn(r,mt()),u;if(u===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,Da(r,wn,ls),vn(r,mt()),null}function cf(r,o){var u=lt;lt|=1;try{return r(o)}finally{lt=u,lt===0&&(Uo=mt()+500,Lc&&As())}}function Pa(r){Os!==null&&Os.tag===0&&(lt&6)===0&&Wo();var o=lt;lt|=1;var u=zn.transition,g=ut;try{if(zn.transition=null,ut=1,r)return r()}finally{ut=g,zn.transition=u,lt=o,(lt&6)===0&&As()}}function uf(){Cn=zo.current,vt(zo)}function La(r,o){r.finishedWork=null,r.finishedLanes=0;var u=r.timeoutHandle;if(u!==-1&&(r.timeoutHandle=-1,yR(u)),Rt!==null)for(u=Rt.return;u!==null;){var g=u;switch(wh(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&Oc();break;case 3:qo(),vt(mn),vt(nn),Rh();break;case 5:Th(g);break;case 4:qo();break;case 13:vt(_t);break;case 19:vt(_t);break;case 10:Nh(g.type._context);break;case 22:case 23:uf()}u=u.return}if(Wt=r,Rt=r=Ds(r.current,null),Qt=Cn=o,Lt=0,hl=null,nf=su=Oa=0,wn=fl=null,Ma!==null){for(o=0;o<Ma.length;o++)if(u=Ma[o],g=u.interleaved,g!==null){u.interleaved=null;var w=g.next,b=u.pending;if(b!==null){var M=b.next;b.next=w,g.next=M}u.pending=g}Ma=null}return r}function bb(r,o){do{var u=Rt;try{if(_h(),Vc.current=Qc,Yc){for(var g=Nt.memoizedState;g!==null;){var w=g.queue;w!==null&&(w.pending=null),g=g.next}Yc=!1}if($a=0,Ut=Pt=Nt=null,ol=!1,il=0,tf.current=null,u===null||u.return===null){Lt=1,hl=o,Rt=null;break}e:{var b=r,M=u.return,Q=u,te=o;if(o=Qt,Q.flags|=32768,te!==null&&typeof te=="object"&&typeof te.then=="function"){var de=te,be=Q,ke=be.tag;if((be.mode&1)===0&&(ke===0||ke===11||ke===15)){var ve=be.alternate;ve?(be.updateQueue=ve.updateQueue,be.memoizedState=ve.memoizedState,be.lanes=ve.lanes):(be.updateQueue=null,be.memoizedState=null)}var Ae=G0(M);if(Ae!==null){Ae.flags&=-257,V0(Ae,M,Q,b,o),Ae.mode&1&&H0(b,de,o),o=Ae,te=de;var Oe=o.updateQueue;if(Oe===null){var Le=new Set;Le.add(te),o.updateQueue=Le}else Oe.add(te);break e}else{if((o&1)===0){H0(b,de,o),df();break e}te=Error(n(426))}}else if(bt&&Q.mode&1){var Ct=G0(M);if(Ct!==null){(Ct.flags&65536)===0&&(Ct.flags|=256),V0(Ct,M,Q,b,o),bh(Fo(te,Q));break e}}b=te=Fo(te,Q),Lt!==4&&(Lt=2),fl===null?fl=[b]:fl.push(b),b=M;do{switch(b.tag){case 3:b.flags|=65536,o&=-o,b.lanes|=o;var ie=U0(b,te,o);g0(b,ie);break e;case 1:Q=te;var ne=b.type,ue=b.stateNode;if((b.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||ue!==null&&typeof ue.componentDidCatch=="function"&&($s===null||!$s.has(ue)))){b.flags|=65536,o&=-o,b.lanes|=o;var Ne=W0(b,Q,o);g0(b,Ne);break e}}b=b.return}while(b!==null)}Nb(u)}catch(qe){o=qe,Rt===u&&u!==null&&(Rt=u=u.return);continue}break}while(!0)}function kb(){var r=ru.current;return ru.current=Qc,r===null?Qc:r}function df(){(Lt===0||Lt===3||Lt===2)&&(Lt=4),Wt===null||(Oa&268435455)===0&&(su&268435455)===0||Ls(Wt,Qt)}function uu(r,o){var u=lt;lt|=2;var g=kb();(Wt!==r||Qt!==o)&&(ls=null,La(r,o));do try{zR();break}catch(w){bb(r,w)}while(!0);if(_h(),lt=u,ru.current=g,Rt!==null)throw Error(n(261));return Wt=null,Qt=0,Lt}function zR(){for(;Rt!==null;)_b(Rt)}function UR(){for(;Rt!==null&&!sa();)_b(Rt)}function _b(r){var o=Eb(r.alternate,r,Cn);r.memoizedProps=r.pendingProps,o===null?Nb(r):Rt=o,tf.current=null}function Nb(r){var o=r;do{var u=o.alternate;if(r=o.return,(o.flags&32768)===0){if(u=OR(u,o,Cn),u!==null){Rt=u;return}}else{if(u=PR(u,o),u!==null){u.flags&=32767,Rt=u;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Lt=6,Rt=null;return}}if(o=o.sibling,o!==null){Rt=o;return}Rt=o=r}while(o!==null);Lt===0&&(Lt=5)}function Da(r,o,u){var g=ut,w=zn.transition;try{zn.transition=null,ut=1,WR(r,o,u,g)}finally{zn.transition=w,ut=g}return null}function WR(r,o,u,g){do Wo();while(Os!==null);if((lt&6)!==0)throw Error(n(327));u=r.finishedWork;var w=r.finishedLanes;if(u===null)return null;if(r.finishedWork=null,r.finishedLanes=0,u===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var b=u.lanes|u.childLanes;if(io(r,b),r===Wt&&(Rt=Wt=null,Qt=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||ou||(ou=!0,Cb(Gr,function(){return Wo(),null})),b=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||b){b=zn.transition,zn.transition=null;var M=ut;ut=1;var Q=lt;lt|=4,tf.current=null,DR(r,u),pb(u,r),So(uh),fo=!!ch,uh=ch=null,r.current=u,qR(u),Si(),lt=Q,ut=M,zn.transition=b}else r.current=u;if(ou&&(ou=!1,Os=r,iu=w),b=r.pendingLanes,b===0&&($s=null),ia(u.stateNode),vn(r,mt()),o!==null)for(g=r.onRecoverableError,u=0;u<o.length;u++)w=o[u],g(w.value,{componentStack:w.stack,digest:w.digest});if(au)throw au=!1,r=sf,sf=null,r;return(iu&1)!==0&&r.tag!==0&&Wo(),b=r.pendingLanes,(b&1)!==0?r===af?pl++:(pl=0,af=r):pl=0,As(),null}function Wo(){if(Os!==null){var r=Jn(iu),o=zn.transition,u=ut;try{if(zn.transition=null,ut=16>r?16:r,Os===null)var g=!1;else{if(r=Os,Os=null,iu=0,(lt&6)!==0)throw Error(n(331));var w=lt;for(lt|=4,Ie=r.current;Ie!==null;){var b=Ie,M=b.child;if((Ie.flags&16)!==0){var Q=b.deletions;if(Q!==null){for(var te=0;te<Q.length;te++){var de=Q[te];for(Ie=de;Ie!==null;){var be=Ie;switch(be.tag){case 0:case 11:case 15:dl(8,be,b)}var ke=be.child;if(ke!==null)ke.return=be,Ie=ke;else for(;Ie!==null;){be=Ie;var ve=be.sibling,Ae=be.return;if(cb(be),be===de){Ie=null;break}if(ve!==null){ve.return=Ae,Ie=ve;break}Ie=Ae}}}var Oe=b.alternate;if(Oe!==null){var Le=Oe.child;if(Le!==null){Oe.child=null;do{var Ct=Le.sibling;Le.sibling=null,Le=Ct}while(Le!==null)}}Ie=b}}if((b.subtreeFlags&2064)!==0&&M!==null)M.return=b,Ie=M;else e:for(;Ie!==null;){if(b=Ie,(b.flags&2048)!==0)switch(b.tag){case 0:case 11:case 15:dl(9,b,b.return)}var ie=b.sibling;if(ie!==null){ie.return=b.return,Ie=ie;break e}Ie=b.return}}var ne=r.current;for(Ie=ne;Ie!==null;){M=Ie;var ue=M.child;if((M.subtreeFlags&2064)!==0&&ue!==null)ue.return=M,Ie=ue;else e:for(M=ne;Ie!==null;){if(Q=Ie,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:nu(9,Q)}}catch(qe){St(Q,Q.return,qe)}if(Q===M){Ie=null;break e}var Ne=Q.sibling;if(Ne!==null){Ne.return=Q.return,Ie=Ne;break e}Ie=Q.return}}if(lt=w,As(),Ot&&typeof Ot.onPostCommitFiberRoot=="function")try{Ot.onPostCommitFiberRoot(Yr,r)}catch{}g=!0}return g}finally{ut=u,zn.transition=o}}return!1}function Sb(r,o,u){o=Fo(u,o),o=U0(r,o,1),r=Ms(r,o,1),o=un(),r!==null&&(on(r,1,o),vn(r,o))}function St(r,o,u){if(r.tag===3)Sb(r,r,u);else for(;o!==null;){if(o.tag===3){Sb(o,r,u);break}else if(o.tag===1){var g=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&($s===null||!$s.has(g))){r=Fo(u,r),r=W0(o,r,1),o=Ms(o,r,1),r=un(),o!==null&&(on(o,1,r),vn(o,r));break}}o=o.return}}function HR(r,o,u){var g=r.pingCache;g!==null&&g.delete(o),o=un(),r.pingedLanes|=r.suspendedLanes&u,Wt===r&&(Qt&u)===u&&(Lt===4||Lt===3&&(Qt&130023424)===Qt&&500>mt()-rf?La(r,0):nf|=u),vn(r,o)}function jb(r,o){o===0&&((r.mode&1)===0?o=1:(o=ao,ao<<=1,(ao&130023424)===0&&(ao=4194304)));var u=un();r=as(r,o),r!==null&&(on(r,o,u),vn(r,u))}function GR(r){var o=r.memoizedState,u=0;o!==null&&(u=o.retryLane),jb(r,u)}function VR(r,o){var u=0;switch(r.tag){case 13:var g=r.stateNode,w=r.memoizedState;w!==null&&(u=w.retryLane);break;case 19:g=r.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(o),jb(r,u)}var Eb;Eb=function(r,o,u){if(r!==null)if(r.memoizedProps!==o.pendingProps||mn.current)yn=!0;else{if((r.lanes&u)===0&&(o.flags&128)===0)return yn=!1,$R(r,o,u);yn=(r.flags&131072)!==0}else yn=!1,bt&&(o.flags&1048576)!==0&&o0(o,qc,o.index);switch(o.lanes=0,o.tag){case 2:var g=o.type;eu(r,o),r=o.pendingProps;var w=Mo(o,nn.current);Do(o,u),w=$h(null,o,g,r,w,u);var b=Oh();return o.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,gn(g)?(b=!0,Pc(o)):b=!1,o.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Eh(o),w.updater=Zc,o.stateNode=w,w._reactInternals=o,Bh(o,g,r,u),o=Hh(null,o,g,!0,b,u)):(o.tag=0,bt&&b&&yh(o),cn(null,o,w,u),o=o.child),o;case 16:g=o.elementType;e:{switch(eu(r,o),r=o.pendingProps,w=g._init,g=w(g._payload),o.type=g,w=o.tag=KR(g),r=sr(g,r),w){case 0:o=Wh(null,o,g,r,u);break e;case 1:o=J0(null,o,g,r,u);break e;case 11:o=Y0(null,o,g,r,u);break e;case 14:o=K0(null,o,g,sr(g.type,r),u);break e}throw Error(n(306,g,""))}return o;case 0:return g=o.type,w=o.pendingProps,w=o.elementType===g?w:sr(g,w),Wh(r,o,g,w,u);case 1:return g=o.type,w=o.pendingProps,w=o.elementType===g?w:sr(g,w),J0(r,o,g,w,u);case 3:e:{if(eb(o),r===null)throw Error(n(387));g=o.pendingProps,b=o.memoizedState,w=b.element,m0(r,o),Hc(o,g,null,u);var M=o.memoizedState;if(g=M.element,b.isDehydrated)if(b={element:g,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},o.updateQueue.baseState=b,o.memoizedState=b,o.flags&256){w=Fo(Error(n(423)),o),o=tb(r,o,g,u,w);break e}else if(g!==w){w=Fo(Error(n(424)),o),o=tb(r,o,g,u,w);break e}else for(En=Es(o.stateNode.containerInfo.firstChild),jn=o,bt=!0,rr=null,u=f0(o,null,g,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Oo(),g===w){o=is(r,o,u);break e}cn(r,o,g,u)}o=o.child}return o;case 5:return w0(o),r===null&&xh(o),g=o.type,w=o.pendingProps,b=r!==null?r.memoizedProps:null,M=w.children,dh(g,w)?M=null:b!==null&&dh(g,b)&&(o.flags|=32),Z0(r,o),cn(r,o,M,u),o.child;case 6:return r===null&&xh(o),null;case 13:return nb(r,o,u);case 4:return Ch(o,o.stateNode.containerInfo),g=o.pendingProps,r===null?o.child=Po(o,null,g,u):cn(r,o,g,u),o.child;case 11:return g=o.type,w=o.pendingProps,w=o.elementType===g?w:sr(g,w),Y0(r,o,g,w,u);case 7:return cn(r,o,o.pendingProps,u),o.child;case 8:return cn(r,o,o.pendingProps.children,u),o.child;case 12:return cn(r,o,o.pendingProps.children,u),o.child;case 10:e:{if(g=o.type._context,w=o.pendingProps,b=o.memoizedProps,M=w.value,yt(zc,g._currentValue),g._currentValue=M,b!==null)if(fn(b.value,M)){if(b.children===w.children&&!mn.current){o=is(r,o,u);break e}}else for(b=o.child,b!==null&&(b.return=o);b!==null;){var Q=b.dependencies;if(Q!==null){M=b.child;for(var te=Q.firstContext;te!==null;){if(te.context===g){if(b.tag===1){te=os(-1,u&-u),te.tag=2;var de=b.updateQueue;if(de!==null){de=de.shared;var be=de.pending;be===null?te.next=te:(te.next=be.next,be.next=te),de.pending=te}}b.lanes|=u,te=b.alternate,te!==null&&(te.lanes|=u),Sh(b.return,u,o),Q.lanes|=u;break}te=te.next}}else if(b.tag===10)M=b.type===o.type?null:b.child;else if(b.tag===18){if(M=b.return,M===null)throw Error(n(341));M.lanes|=u,Q=M.alternate,Q!==null&&(Q.lanes|=u),Sh(M,u,o),M=b.sibling}else M=b.child;if(M!==null)M.return=b;else for(M=b;M!==null;){if(M===o){M=null;break}if(b=M.sibling,b!==null){b.return=M.return,M=b;break}M=M.return}b=M}cn(r,o,w.children,u),o=o.child}return o;case 9:return w=o.type,g=o.pendingProps.children,Do(o,u),w=Fn(w),g=g(w),o.flags|=1,cn(r,o,g,u),o.child;case 14:return g=o.type,w=sr(g,o.pendingProps),w=sr(g.type,w),K0(r,o,g,w,u);case 15:return X0(r,o,o.type,o.pendingProps,u);case 17:return g=o.type,w=o.pendingProps,w=o.elementType===g?w:sr(g,w),eu(r,o),o.tag=1,gn(g)?(r=!0,Pc(o)):r=!1,Do(o,u),B0(o,g,w),Bh(o,g,w,u),Hh(null,o,g,!0,r,u);case 19:return sb(r,o,u);case 22:return Q0(r,o,u)}throw Error(n(156,o.tag))};function Cb(r,o){return ra(r,o)}function YR(r,o,u,g){this.tag=r,this.key=u,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 Un(r,o,u,g){return new YR(r,o,u,g)}function hf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function KR(r){if(typeof r=="function")return hf(r)?1:0;if(r!=null){if(r=r.$$typeof,r===Z)return 11;if(r===X)return 14}return 2}function Ds(r,o){var u=r.alternate;return u===null?(u=Un(r.tag,o,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=o,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&14680064,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,o=r.dependencies,u.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u}function du(r,o,u,g,w,b){var M=2;if(g=r,typeof r=="function")hf(r)&&(M=1);else if(typeof r=="string")M=5;else e:switch(r){case A:return qa(u.children,w,b,o);case D:M=8,w|=8;break;case O:return r=Un(12,u,o,w|2),r.elementType=O,r.lanes=b,r;case J:return r=Un(13,u,o,w),r.elementType=J,r.lanes=b,r;case I:return r=Un(19,u,o,w),r.elementType=I,r.lanes=b,r;case q:return hu(u,w,b,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case $:M=10;break e;case F:M=9;break e;case Z:M=11;break e;case X:M=14;break e;case G:M=16,g=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Un(M,u,o,w),o.elementType=r,o.type=g,o.lanes=b,o}function qa(r,o,u,g){return r=Un(7,r,g,o),r.lanes=u,r}function hu(r,o,u,g){return r=Un(22,r,g,o),r.elementType=q,r.lanes=u,r.stateNode={isHidden:!1},r}function ff(r,o,u){return r=Un(6,r,null,o),r.lanes=u,r}function pf(r,o,u){return o=Un(4,r.children!==null?r.children:[],r.key,o),o.lanes=u,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function XR(r,o,u,g,w){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=ji(0),this.expirationTimes=ji(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ji(0),this.identifierPrefix=g,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function mf(r,o,u,g,w,b,M,Q,te){return r=new XR(r,o,u,Q,te),o===1?(o=1,b===!0&&(o|=8)):o=0,b=Un(3,null,null,o),r.current=b,b.stateNode=r,b.memoizedState={element:g,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},Eh(b),r}function QR(r,o,u){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:u}}function Tb(r){if(!r)return Ts;r=r._reactInternals;e:{if(In(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(gn(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var u=r.type;if(gn(u))return r0(r,u,o)}return o}function Ab(r,o,u,g,w,b,M,Q,te){return r=mf(u,g,!0,r,w,b,M,Q,te),r.context=Tb(null),u=r.current,g=un(),w=Ps(u),b=os(g,w),b.callback=o??null,Ms(u,b,w),r.current.lanes=w,on(r,w,g),vn(r,g),r}function fu(r,o,u,g){var w=o.current,b=un(),M=Ps(w);return u=Tb(u),o.context===null?o.context=u:o.pendingContext=u,o=os(b,M),o.payload={element:r},g=g===void 0?null:g,g!==null&&(o.callback=g),r=Ms(w,o,M),r!==null&&(ir(r,w,M,b),Wc(r,w,M)),M}function pu(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 Rb(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<o?u:o}}function gf(r,o){Rb(r,o),(r=r.alternate)&&Rb(r,o)}function ZR(){return null}var Mb=typeof reportError=="function"?reportError:function(r){console.error(r)};function yf(r){this._internalRoot=r}mu.prototype.render=yf.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));fu(r,o,null,null)},mu.prototype.unmount=yf.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;Pa(function(){fu(null,r,null,null)}),o[ts]=null}};function mu(r){this._internalRoot=r}mu.prototype.unstable_scheduleHydration=function(r){if(r){var o=Ci();r={blockedOn:null,target:r,priority:o};for(var u=0;u<tr.length&&o!==0&&o<tr[u].priority;u++);tr.splice(u,0,r),u===0&&uo(r)}};function wf(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function gu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Ib(){}function JR(r,o,u,g,w){if(w){if(typeof g=="function"){var b=g;g=function(){var de=pu(M);b.call(de)}}var M=Ab(o,g,r,0,null,!1,!1,"",Ib);return r._reactRootContainer=M,r[ts]=M.current,Tr(r.nodeType===8?r.parentNode:r),Pa(),M}for(;w=r.lastChild;)r.removeChild(w);if(typeof g=="function"){var Q=g;g=function(){var de=pu(te);Q.call(de)}}var te=mf(r,0,!1,null,null,!1,!1,"",Ib);return r._reactRootContainer=te,r[ts]=te.current,Tr(r.nodeType===8?r.parentNode:r),Pa(function(){fu(o,te,u,g)}),te}function yu(r,o,u,g,w){var b=u._reactRootContainer;if(b){var M=b;if(typeof w=="function"){var Q=w;w=function(){var te=pu(M);Q.call(te)}}fu(o,M,r,w)}else M=JR(u,o,r,w,g);return pu(M)}ca=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var u=ws(o.pendingLanes);u!==0&&(lo(o,u|1),vn(o,mt()),(lt&6)===0&&(Uo=mt()+500,As()))}break;case 13:Pa(function(){var g=as(r,1);if(g!==null){var w=un();ir(g,r,1,w)}}),gf(r,1)}},Ei=function(r){if(r.tag===13){var o=as(r,134217728);if(o!==null){var u=un();ir(o,r,134217728,u)}gf(r,134217728)}},dc=function(r){if(r.tag===13){var o=Ps(r),u=as(r,o);if(u!==null){var g=un();ir(u,r,o,g)}gf(r,o)}},Ci=function(){return ut},Ti=function(r,o){var u=ut;try{return ut=r,o()}finally{ut=u}},Te=function(r,o,u){switch(o){case"input":if(_e(r,u),o=u.name,u.type==="radio"&&o!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<u.length;o++){var g=u[o];if(g!==r&&g.form===r.form){var w=$c(g);if(!w)throw Error(n(90));$e(g),_e(g,w)}}}break;case"textarea":fe(r,u);break;case"select":o=u.value,o!=null&&Je(r,!!u.multiple,o,!1)}},Qn=cf,Br=Pa;var eM={usingClientEntryPoint:!1,Events:[tl,Ao,$c,Yt,Fr,cf]},ml={findFiberByHostInstance:Ca,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},tM={bundleType:ml.bundleType,version:ml.version,rendererPackageName:ml.rendererPackageName,rendererConfig:ml.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=ta(r),r===null?null:r.stateNode},findFiberByHostInstance:ml.findFiberByHostInstance||ZR,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 wu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wu.isDisabled&&wu.supportsFiber)try{Yr=wu.inject(tM),Ot=wu}catch{}}return xn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=eM,xn.createPortal=function(r,o){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!wf(o))throw Error(n(200));return QR(r,o,null,u)},xn.createRoot=function(r,o){if(!wf(r))throw Error(n(299));var u=!1,g="",w=Mb;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(g=o.identifierPrefix),o.onRecoverableError!==void 0&&(w=o.onRecoverableError)),o=mf(r,1,!1,null,null,u,!1,g,w),r[ts]=o.current,Tr(r.nodeType===8?r.parentNode:r),new yf(o)},xn.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=ta(o),r=r===null?null:r.stateNode,r},xn.flushSync=function(r){return Pa(r)},xn.hydrate=function(r,o,u){if(!gu(o))throw Error(n(200));return yu(null,r,o,!0,u)},xn.hydrateRoot=function(r,o,u){if(!wf(r))throw Error(n(405));var g=u!=null&&u.hydratedSources||null,w=!1,b="",M=Mb;if(u!=null&&(u.unstable_strictMode===!0&&(w=!0),u.identifierPrefix!==void 0&&(b=u.identifierPrefix),u.onRecoverableError!==void 0&&(M=u.onRecoverableError)),o=Ab(o,null,r,1,u??null,w,!1,b,M),r[ts]=o.current,Tr(r),g)for(r=0;r<g.length;r++)u=g[r],w=u._getVersion,w=w(u._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[u,w]:o.mutableSourceEagerHydrationData.push(u,w);return new mu(o)},xn.render=function(r,o,u){if(!gu(o))throw Error(n(200));return yu(null,r,o,!1,u)},xn.unmountComponentAtNode=function(r){if(!gu(r))throw Error(n(40));return r._reactRootContainer?(Pa(function(){yu(null,null,r,!1,function(){r._reactRootContainer=null,r[ts]=null})}),!0):!1},xn.unstable_batchedUpdates=cf,xn.unstable_renderSubtreeIntoContainer=function(r,o,u,g){if(!gu(u))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return yu(r,o,u,!1,g)},xn.version="18.3.1-next-f1338f8080-20240426",xn}var Bb;function qC(){if(Bb)return bf.exports;Bb=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(),bf.exports=lM(),bf.exports}var zb;function cM(){if(zb)return xu;zb=1;var e=qC();return xu.createRoot=e.createRoot,xu.hydrateRoot=e.hydrateRoot,xu}var uM=cM(),x=Vl();const pe=Qv(x);function Jt(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=Jt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Nf={exports:{}},Sf={},jf={exports:{}},Ef={};/**
|
|
41
41
|
* @license React
|
|
42
42
|
* use-sync-external-store-shim.production.js
|
|
43
43
|
*
|
|
@@ -45,7 +45,7 @@ Error generating stack: `+b.message+`
|
|
|
45
45
|
*
|
|
46
46
|
* This source code is licensed under the MIT license found in the
|
|
47
47
|
* LICENSE file in the root directory of this source tree.
|
|
48
|
-
*/var
|
|
48
|
+
*/var Ub;function dM(){if(Ub)return Ef;Ub=1;var e=Vl();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,l=e.useLayoutEffect,c=e.useDebugValue;function d(m,y){var v=y(),N=s({inst:{value:v,getSnapshot:y}}),_=N[0].inst,S=N[1];return l(function(){_.value=v,_.getSnapshot=y,h(_)&&S({inst:_})},[m,v,y]),a(function(){return h(_)&&S({inst:_}),m(function(){h(_)&&S({inst:_})})},[m]),c(v),v}function h(m){var y=m.getSnapshot;m=m.value;try{var v=y();return!n(m,v)}catch{return!0}}function p(m,y){return y()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:d;return Ef.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Ef}var Wb;function hM(){return Wb||(Wb=1,jf.exports=dM()),jf.exports}/**
|
|
49
49
|
* @license React
|
|
50
50
|
* use-sync-external-store-shim/with-selector.production.js
|
|
51
51
|
*
|
|
@@ -53,32 +53,32 @@ Error generating stack: `+b.message+`
|
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the MIT license found in the
|
|
55
55
|
* LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/var Wb;function hM(){if(Wb)return Sf;Wb=1;var e=Gl(),t=dM();function n(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var s=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,l=e.useRef,c=e.useEffect,d=e.useMemo,h=e.useDebugValue;return Sf.useSyncExternalStoreWithSelector=function(p,f,m,y,v){var N=l(null);if(N.current===null){var _={hasValue:!1,value:null};N.current=_}else _=N.current;N=d(function(){function k(R){if(!j){if(j=!0,E=R,R=y(R),v!==void 0&&_.hasValue){var A=_.value;if(v(A,R))return C=A}return C=R}if(A=C,s(E,R))return A;var D=y(R);return v!==void 0&&v(A,D)?(E=R,A):(E=R,C=D)}var j=!1,E,C,T=m===void 0?null:m;return[function(){return k(f())},T===null?void 0:function(){return k(T())}]},[f,m,y,v]);var S=a(p,N[0],N[1]);return c(function(){_.hasValue=!0,_.value=S},[S]),h(S),S},Sf}var Hb;function fM(){return Hb||(Hb=1,Nf.exports=hM()),Nf.exports}var pM=fM();const mM=Qv(pM),gM={},Gb=e=>{let t;const n=new Set,s=(f,m)=>{const y=typeof f=="function"?f(t):f;if(!Object.is(y,t)){const v=t;t=m??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(N=>N(t,v))}},a=()=>t,h={setState:s,getState:a,getInitialState:()=>p,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(gM?"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,h);return h},yM=e=>e?Gb(e):Gb,{useDebugValue:wM}=pe,{useSyncExternalStoreWithSelector:vM}=mM,xM=e=>e;function DC(e,t=xM,n){const s=vM(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return wM(s),s}const Vb=(e,t)=>{const n=yM(e),s=(a,l=t)=>DC(n,a,l);return Object.assign(s,n),s},bM=(e,t)=>e?Vb(e,t):Vb;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 kM={value:()=>{}};function vd(){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 Wu(n)}function Wu(e){this._=e}function _M(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}})}Wu.prototype=vd.prototype={constructor:Wu,on:function(e,t){var n=this._,s=_M(e+"",n),a,l=-1,c=s.length;if(arguments.length<2){for(;++l<c;)if((a=(e=s[l]).type)&&(a=NM(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<c;)if(a=(e=s[l]).type)n[a]=Yb(n[a],e.name,t);else if(t==null)for(a in n)n[a]=Yb(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 Wu(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),s=0,a,l;s<a;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],s=0,a=l.length;s<a;++s)l[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,l=s.length;a<l;++a)s[a].value.apply(t,n)}};function NM(e,t){for(var n=0,s=e.length,a;n<s;++n)if((a=e[n]).name===t)return a.value}function Yb(e,t,n){for(var s=0,a=e.length;s<a;++s)if(e[s].name===t){e[s]=kM,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var pv="http://www.w3.org/1999/xhtml";const Kb={svg:"http://www.w3.org/2000/svg",xhtml:pv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function xd(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Kb.hasOwnProperty(t)?{space:Kb[t],local:e}:e}function SM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===pv&&t.documentElement.namespaceURI===pv?t.createElement(e):t.createElementNS(n,e)}}function jM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function qC(e){var t=xd(e);return(t.local?jM:SM)(t)}function EM(){}function Zv(e){return e==null?EM:function(){return this.querySelector(e)}}function CM(e){typeof e!="function"&&(e=Zv(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,d=s[a]=new Array(c),h,p,f=0;f<c;++f)(h=l[f])&&(p=e.call(h,h.__data__,f,l))&&("__data__"in h&&(p.__data__=h.__data__),d[f]=p);return new Rn(s,this._parents)}function TM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function AM(){return[]}function FC(e){return e==null?AM:function(){return this.querySelectorAll(e)}}function RM(e){return function(){return TM(e.apply(this,arguments))}}function MM(e){typeof e=="function"?e=RM(e):e=FC(e);for(var t=this._groups,n=t.length,s=[],a=[],l=0;l<n;++l)for(var c=t[l],d=c.length,h,p=0;p<d;++p)(h=c[p])&&(s.push(e.call(h,h.__data__,p,c)),a.push(h));return new Rn(s,a)}function BC(e){return function(){return this.matches(e)}}function zC(e){return function(t){return t.matches(e)}}var IM=Array.prototype.find;function $M(e){return function(){return IM.call(this.children,e)}}function OM(){return this.firstElementChild}function PM(e){return this.select(e==null?OM:$M(typeof e=="function"?e:zC(e)))}var LM=Array.prototype.filter;function DM(){return Array.from(this.children)}function qM(e){return function(){return LM.call(this.children,e)}}function FM(e){return this.selectAll(e==null?DM:qM(typeof e=="function"?e:zC(e)))}function BM(e){typeof e!="function"&&(e=BC(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,d=s[a]=[],h,p=0;p<c;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&d.push(h);return new Rn(s,this._parents)}function UC(e){return new Array(e.length)}function zM(){return new Rn(this._enter||this._groups.map(UC),this._parents)}function Ju(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ju.prototype={constructor:Ju,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 UM(e){return function(){return e}}function WM(e,t,n,s,a,l){for(var c=0,d,h=t.length,p=l.length;c<p;++c)(d=t[c])?(d.__data__=l[c],s[c]=d):n[c]=new Ju(e,l[c]);for(;c<h;++c)(d=t[c])&&(a[c]=d)}function HM(e,t,n,s,a,l,c){var d,h,p=new Map,f=t.length,m=l.length,y=new Array(f),v;for(d=0;d<f;++d)(h=t[d])&&(y[d]=v=c.call(h,h.__data__,d,t)+"",p.has(v)?a[d]=h:p.set(v,h));for(d=0;d<m;++d)v=c.call(e,l[d],d,l)+"",(h=p.get(v))?(s[d]=h,h.__data__=l[d],p.delete(v)):n[d]=new Ju(e,l[d]);for(d=0;d<f;++d)(h=t[d])&&p.get(y[d])===h&&(a[d]=h)}function GM(e){return e.__data__}function VM(e,t){if(!arguments.length)return Array.from(this,GM);var n=t?HM:WM,s=this._parents,a=this._groups;typeof e!="function"&&(e=UM(e));for(var l=a.length,c=new Array(l),d=new Array(l),h=new Array(l),p=0;p<l;++p){var f=s[p],m=a[p],y=m.length,v=YM(e.call(f,f&&f.__data__,p,s)),N=v.length,_=d[p]=new Array(N),S=c[p]=new Array(N),k=h[p]=new Array(y);n(f,m,_,S,k,v,t);for(var j=0,E=0,C,T;j<N;++j)if(C=_[j]){for(j>=E&&(E=j+1);!(T=S[E])&&++E<N;);C._next=T||null}}return c=new Rn(c,s),c._enter=d,c._exit=h,c}function YM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function KM(){return new Rn(this._exit||this._groups.map(UC),this._parents)}function XM(e,t,n){var s=this.enter(),a=this,l=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?l.remove():n(l),s&&a?s.merge(a).order():a}function QM(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,a=n.length,l=s.length,c=Math.min(a,l),d=new Array(a),h=0;h<c;++h)for(var p=n[h],f=s[h],m=p.length,y=d[h]=new Array(m),v,N=0;N<m;++N)(v=p[N]||f[N])&&(y[N]=v);for(;h<a;++h)d[h]=n[h];return new Rn(d,this._parents)}function ZM(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],a=s.length-1,l=s[a],c;--a>=0;)(c=s[a])&&(l&&c.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(c,l),l=c);return this}function JM(e){e||(e=eI);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),l=0;l<s;++l){for(var c=n[l],d=c.length,h=a[l]=new Array(d),p,f=0;f<d;++f)(p=c[f])&&(h[f]=p);h.sort(t)}return new Rn(a,this._parents).order()}function eI(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function tI(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function nI(){return Array.from(this)}function rI(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,l=s.length;a<l;++a){var c=s[a];if(c)return c}return null}function sI(){let e=0;for(const t of this)++e;return e}function aI(){return!this.node()}function oI(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var a=t[n],l=0,c=a.length,d;l<c;++l)(d=a[l])&&e.call(d,d.__data__,l,a);return this}function iI(e){return function(){this.removeAttribute(e)}}function lI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cI(e,t){return function(){this.setAttribute(e,t)}}function uI(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function dI(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function hI(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 fI(e,t){var n=xd(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?lI:iI:typeof t=="function"?n.local?hI:dI:n.local?uI:cI)(n,t))}function WC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function pI(e){return function(){this.style.removeProperty(e)}}function mI(e,t,n){return function(){this.style.setProperty(e,t,n)}}function gI(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function yI(e,t,n){return arguments.length>1?this.each((t==null?pI:typeof t=="function"?gI:mI)(e,t,n??"")):ii(this.node(),e)}function ii(e,t){return e.style.getPropertyValue(t)||WC(e).getComputedStyle(e,null).getPropertyValue(t)}function wI(e){return function(){delete this[e]}}function vI(e,t){return function(){this[e]=t}}function xI(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function bI(e,t){return arguments.length>1?this.each((t==null?wI:typeof t=="function"?xI:vI)(e,t)):this.node()[e]}function HC(e){return e.trim().split(/^|\s+/)}function Jv(e){return e.classList||new GC(e)}function GC(e){this._node=e,this._names=HC(e.getAttribute("class")||"")}GC.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 VC(e,t){for(var n=Jv(e),s=-1,a=t.length;++s<a;)n.add(t[s])}function YC(e,t){for(var n=Jv(e),s=-1,a=t.length;++s<a;)n.remove(t[s])}function kI(e){return function(){VC(this,e)}}function _I(e){return function(){YC(this,e)}}function NI(e,t){return function(){(t.apply(this,arguments)?VC:YC)(this,e)}}function SI(e,t){var n=HC(e+"");if(arguments.length<2){for(var s=Jv(this.node()),a=-1,l=n.length;++a<l;)if(!s.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?NI:t?kI:_I)(n,t))}function jI(){this.textContent=""}function EI(e){return function(){this.textContent=e}}function CI(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function TI(e){return arguments.length?this.each(e==null?jI:(typeof e=="function"?CI:EI)(e)):this.node().textContent}function AI(){this.innerHTML=""}function RI(e){return function(){this.innerHTML=e}}function MI(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function II(e){return arguments.length?this.each(e==null?AI:(typeof e=="function"?MI:RI)(e)):this.node().innerHTML}function $I(){this.nextSibling&&this.parentNode.appendChild(this)}function OI(){return this.each($I)}function PI(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function LI(){return this.each(PI)}function DI(e){var t=typeof e=="function"?e:qC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function qI(){return null}function FI(e,t){var n=typeof e=="function"?e:qC(e),s=t==null?qI:typeof t=="function"?t:Zv(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function BI(){var e=this.parentNode;e&&e.removeChild(this)}function zI(){return this.each(BI)}function UI(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function WI(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function HI(e){return this.select(e?WI:UI)}function GI(e){return arguments.length?this.property("__data__",e):this.node().__data__}function VI(e){return function(t){e.call(this,t,this.__data__)}}function YI(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 KI(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,a=t.length,l;n<a;++n)l=t[n],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++s]=l;++s?t.length=s:delete this.__on}}}function XI(e,t,n){return function(){var s=this.__on,a,l=VI(t);if(s){for(var c=0,d=s.length;c<d;++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=l,a.options=n),a.value=t;return}}this.addEventListener(e.type,l,n),a={type:e.type,name:e.name,value:t,listener:l,options:n},s?s.push(a):this.__on=[a]}}function QI(e,t,n){var s=YI(e+""),a,l=s.length,c;if(arguments.length<2){var d=this.node().__on;if(d){for(var h=0,p=d.length,f;h<p;++h)for(a=0,f=d[h];a<l;++a)if((c=s[a]).type===f.type&&c.name===f.name)return f.value}return}for(d=t?XI:KI,a=0;a<l;++a)this.each(d(s[a],t,n));return this}function KC(e,t,n){var s=WC(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 ZI(e,t){return function(){return KC(this,e,t)}}function JI(e,t){return function(){return KC(this,e,t.apply(this,arguments))}}function e$(e,t){return this.each((typeof t=="function"?JI:ZI)(e,t))}function*t$(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,l=s.length,c;a<l;++a)(c=s[a])&&(yield c)}var XC=[null];function Rn(e,t){this._groups=e,this._parents=t}function Vl(){return new Rn([[document.documentElement]],XC)}function n$(){return this}Rn.prototype=Vl.prototype={constructor:Rn,select:CM,selectAll:MM,selectChild:PM,selectChildren:FM,filter:BM,data:VM,enter:zM,exit:KM,join:XM,merge:QM,selection:n$,order:ZM,sort:JM,call:tI,nodes:nI,node:rI,size:sI,empty:aI,each:oI,attr:fI,style:yI,property:bI,classed:SI,text:TI,html:II,raise:OI,lower:LI,append:DI,insert:FI,remove:zI,clone:HI,datum:GI,on:QI,dispatch:e$,[Symbol.iterator]:t$};function Hn(e){return typeof e=="string"?new Rn([[document.querySelector(e)]],[document.documentElement]):new Rn([[e]],XC)}function r$(e){let t;for(;t=e.sourceEvent;)e=t;return e}function cr(e,t){if(e=r$(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 s$={passive:!1},Il={capture:!0,passive:!1};function Cf(e){e.stopImmediatePropagation()}function ni(e){e.preventDefault(),e.stopImmediatePropagation()}function QC(e){var t=e.document.documentElement,n=Hn(e).on("dragstart.drag",ni,Il);"onselectstart"in t?n.on("selectstart.drag",ni,Il):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ZC(e,t){var n=e.document.documentElement,s=Hn(e).on("dragstart.drag",null);t&&(s.on("click.drag",ni,Il),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 bu=e=>()=>e;function mv(e,{sourceEvent:t,subject:n,target:s,identifier:a,active:l,x:c,y:d,dx:h,dy:p,dispatch:f}){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:l,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:d,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:f}})}mv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function a$(e){return!e.ctrlKey&&!e.button}function o$(){return this.parentNode}function i$(e,t){return t??{x:e.x,y:e.y}}function l$(){return navigator.maxTouchPoints||"ontouchstart"in this}function c$(){var e=a$,t=o$,n=i$,s=l$,a={},l=vd("start","drag","end"),c=0,d,h,p,f,m=0;function y(C){C.on("mousedown.drag",v).filter(s).on("touchstart.drag",S).on("touchmove.drag",k,s$).on("touchend.drag touchcancel.drag",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(C,T){if(!(f||!e.call(this,C,T))){var R=E(this,t.call(this,C,T),C,T,"mouse");R&&(Hn(C.view).on("mousemove.drag",N,Il).on("mouseup.drag",_,Il),QC(C.view),Cf(C),p=!1,d=C.clientX,h=C.clientY,R("start",C))}}function N(C){if(ni(C),!p){var T=C.clientX-d,R=C.clientY-h;p=T*T+R*R>m}a.mouse("drag",C)}function _(C){Hn(C.view).on("mousemove.drag mouseup.drag",null),ZC(C.view,p),ni(C),a.mouse("end",C)}function S(C,T){if(e.call(this,C,T)){var R=C.changedTouches,A=t.call(this,C,T),D=R.length,O,$;for(O=0;O<D;++O)($=E(this,A,C,T,R[O].identifier,R[O]))&&(Cf(C),$("start",C,R[O]))}}function k(C){var T=C.changedTouches,R=T.length,A,D;for(A=0;A<R;++A)(D=a[T[A].identifier])&&(ni(C),D("drag",C,T[A]))}function j(C){var T=C.changedTouches,R=T.length,A,D;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),A=0;A<R;++A)(D=a[T[A].identifier])&&(Cf(C),D("end",C,T[A]))}function E(C,T,R,A,D,O){var $=l.copy(),B=cr(O||R,T),Z,J,I;if((I=n.call(C,new mv("beforestart",{sourceEvent:R,target:y,identifier:D,active:c,x:B[0],y:B[1],dx:0,dy:0,dispatch:$}),A))!=null)return Z=I.x-B[0]||0,J=I.y-B[1]||0,function X(G,q,Y){var L=B,K;switch(G){case"start":a[D]=X,K=c++;break;case"end":delete a[D],--c;case"drag":B=cr(Y||q,T),K=c;break}$.call(G,C,new mv(G,{sourceEvent:q,subject:I,target:y,identifier:D,active:K,x:B[0]+Z,y:B[1]+J,dx:B[0]-L[0],dy:B[1]-L[1],dispatch:$}),A)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:bu(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:bu(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:bu(C),y):n},y.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:bu(!!C),y):s},y.on=function(){var C=l.on.apply(l,arguments);return C===l?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function ex(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function JC(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Yl(){}var $l=.7,ed=1/$l,ri="\\s*([+-]?\\d+)\\s*",Ol="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Pr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",u$=/^#([0-9a-f]{3,8})$/,d$=new RegExp(`^rgb\\(${ri},${ri},${ri}\\)$`),h$=new RegExp(`^rgb\\(${Pr},${Pr},${Pr}\\)$`),f$=new RegExp(`^rgba\\(${ri},${ri},${ri},${Ol}\\)$`),p$=new RegExp(`^rgba\\(${Pr},${Pr},${Pr},${Ol}\\)$`),m$=new RegExp(`^hsl\\(${Ol},${Pr},${Pr}\\)$`),g$=new RegExp(`^hsla\\(${Ol},${Pr},${Pr},${Ol}\\)$`),Xb={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};ex(Yl,Pl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Qb,formatHex:Qb,formatHex8:y$,formatHsl:w$,formatRgb:Zb,toString:Zb});function Qb(){return this.rgb().formatHex()}function y$(){return this.rgb().formatHex8()}function w$(){return eT(this).formatHsl()}function Zb(){return this.rgb().formatRgb()}function Pl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=u$.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Jb(t):n===3?new bn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ku(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ku(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=d$.exec(e))?new bn(t[1],t[2],t[3],1):(t=h$.exec(e))?new bn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=f$.exec(e))?ku(t[1],t[2],t[3],t[4]):(t=p$.exec(e))?ku(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=m$.exec(e))?nk(t[1],t[2]/100,t[3]/100,1):(t=g$.exec(e))?nk(t[1],t[2]/100,t[3]/100,t[4]):Xb.hasOwnProperty(e)?Jb(Xb[e]):e==="transparent"?new bn(NaN,NaN,NaN,0):null}function Jb(e){return new bn(e>>16&255,e>>8&255,e&255,1)}function ku(e,t,n,s){return s<=0&&(e=t=n=NaN),new bn(e,t,n,s)}function v$(e){return e instanceof Yl||(e=Pl(e)),e?(e=e.rgb(),new bn(e.r,e.g,e.b,e.opacity)):new bn}function gv(e,t,n,s){return arguments.length===1?v$(e):new bn(e,t,n,s??1)}function bn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}ex(bn,gv,JC(Yl,{brighter(e){return e=e==null?ed:Math.pow(ed,e),new bn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?$l:Math.pow($l,e),new bn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new bn(Wa(this.r),Wa(this.g),Wa(this.b),td(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:x$,formatRgb:tk,toString:tk}));function ek(){return`#${za(this.r)}${za(this.g)}${za(this.b)}`}function x$(){return`#${za(this.r)}${za(this.g)}${za(this.b)}${za((isNaN(this.opacity)?1:this.opacity)*255)}`}function tk(){const e=td(this.opacity);return`${e===1?"rgb(":"rgba("}${Wa(this.r)}, ${Wa(this.g)}, ${Wa(this.b)}${e===1?")":`, ${e})`}`}function td(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Wa(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function za(e){return e=Wa(e),(e<16?"0":"")+e.toString(16)}function nk(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ur(e,t,n,s)}function eT(e){if(e instanceof ur)return new ur(e.h,e.s,e.l,e.opacity);if(e instanceof Yl||(e=Pl(e)),!e)return new ur;if(e instanceof ur)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,a=Math.min(t,n,s),l=Math.max(t,n,s),c=NaN,d=l-a,h=(l+a)/2;return d?(t===l?c=(n-s)/d+(n<s)*6:n===l?c=(s-t)/d+2:c=(t-n)/d+4,d/=h<.5?l+a:2-l-a,c*=60):d=h>0&&h<1?0:c,new ur(c,d,h,e.opacity)}function b$(e,t,n,s){return arguments.length===1?eT(e):new ur(e,t,n,s??1)}function ur(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}ex(ur,b$,JC(Yl,{brighter(e){return e=e==null?ed:Math.pow(ed,e),new ur(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?$l:Math.pow($l,e),new ur(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 bn(Tf(e>=240?e-240:e+120,a,s),Tf(e,a,s),Tf(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new ur(rk(this.h),_u(this.s),_u(this.l),td(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=td(this.opacity);return`${e===1?"hsl(":"hsla("}${rk(this.h)}, ${_u(this.s)*100}%, ${_u(this.l)*100}%${e===1?")":`, ${e})`}`}}));function rk(e){return e=(e||0)%360,e<0?e+360:e}function _u(e){return Math.max(0,Math.min(1,e||0))}function Tf(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 tT=e=>()=>e;function k$(e,t){return function(n){return e+n*t}}function _$(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 N$(e){return(e=+e)==1?nT:function(t,n){return n-t?_$(t,n,e):tT(isNaN(t)?n:t)}}function nT(e,t){var n=t-e;return n?k$(e,n):tT(isNaN(e)?t:e)}const sk=(function e(t){var n=N$(t);function s(a,l){var c=n((a=gv(a)).r,(l=gv(l)).r),d=n(a.g,l.g),h=n(a.b,l.b),p=nT(a.opacity,l.opacity);return function(f){return a.r=c(f),a.g=d(f),a.b=h(f),a.opacity=p(f),a+""}}return s.gamma=e,s})(1);function zs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var yv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Af=new RegExp(yv.source,"g");function S$(e){return function(){return e}}function j$(e){return function(t){return e(t)+""}}function E$(e,t){var n=yv.lastIndex=Af.lastIndex=0,s,a,l,c=-1,d=[],h=[];for(e=e+"",t=t+"";(s=yv.exec(e))&&(a=Af.exec(t));)(l=a.index)>n&&(l=t.slice(n,l),d[c]?d[c]+=l:d[++c]=l),(s=s[0])===(a=a[0])?d[c]?d[c]+=a:d[++c]=a:(d[++c]=null,h.push({i:c,x:zs(s,a)})),n=Af.lastIndex;return n<t.length&&(l=t.slice(n),d[c]?d[c]+=l:d[++c]=l),d.length<2?h[0]?j$(h[0].x):S$(t):(t=h.length,function(p){for(var f=0,m;f<t;++f)d[(m=h[f]).i]=m.x(p);return d.join("")})}var ak=180/Math.PI,wv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function rT(e,t,n,s,a,l){var c,d,h;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(h=e*n+t*s)&&(n-=e*h,s-=t*h),(d=Math.sqrt(n*n+s*s))&&(n/=d,s/=d,h/=d),e*s<t*n&&(e=-e,t=-t,h=-h,c=-c),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*ak,skewX:Math.atan(h)*ak,scaleX:c,scaleY:d}}var Nu;function C$(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?wv:rT(t.a,t.b,t.c,t.d,t.e,t.f)}function T$(e){return e==null||(Nu||(Nu=document.createElementNS("http://www.w3.org/2000/svg","g")),Nu.setAttribute("transform",e),!(e=Nu.transform.baseVal.consolidate()))?wv:(e=e.matrix,rT(e.a,e.b,e.c,e.d,e.e,e.f))}function sT(e,t,n,s){function a(p){return p.length?p.pop()+" ":""}function l(p,f,m,y,v,N){if(p!==m||f!==y){var _=v.push("translate(",null,t,null,n);N.push({i:_-4,x:zs(p,m)},{i:_-2,x:zs(f,y)})}else(m||y)&&v.push("translate("+m+t+y+n)}function c(p,f,m,y){p!==f?(p-f>180?f+=360:f-p>180&&(p+=360),y.push({i:m.push(a(m)+"rotate(",null,s)-2,x:zs(p,f)})):f&&m.push(a(m)+"rotate("+f+s)}function d(p,f,m,y){p!==f?y.push({i:m.push(a(m)+"skewX(",null,s)-2,x:zs(p,f)}):f&&m.push(a(m)+"skewX("+f+s)}function h(p,f,m,y,v,N){if(p!==m||f!==y){var _=v.push(a(v)+"scale(",null,",",null,")");N.push({i:_-4,x:zs(p,m)},{i:_-2,x:zs(f,y)})}else(m!==1||y!==1)&&v.push(a(v)+"scale("+m+","+y+")")}return function(p,f){var m=[],y=[];return p=e(p),f=e(f),l(p.translateX,p.translateY,f.translateX,f.translateY,m,y),c(p.rotate,f.rotate,m,y),d(p.skewX,f.skewX,m,y),h(p.scaleX,p.scaleY,f.scaleX,f.scaleY,m,y),p=f=null,function(v){for(var N=-1,_=y.length,S;++N<_;)m[(S=y[N]).i]=S.x(v);return m.join("")}}}var A$=sT(C$,"px, ","px)","deg)"),R$=sT(T$,", ",")",")"),M$=1e-12;function ok(e){return((e=Math.exp(e))+1/e)/2}function I$(e){return((e=Math.exp(e))-1/e)/2}function $$(e){return((e=Math.exp(2*e))-1)/(e+1)}const O$=(function e(t,n,s){function a(l,c){var d=l[0],h=l[1],p=l[2],f=c[0],m=c[1],y=c[2],v=f-d,N=m-h,_=v*v+N*N,S,k;if(_<M$)k=Math.log(y/p)/t,S=function(A){return[d+A*v,h+A*N,p*Math.exp(t*A*k)]};else{var j=Math.sqrt(_),E=(y*y-p*p+s*_)/(2*p*n*j),C=(y*y-p*p-s*_)/(2*y*n*j),T=Math.log(Math.sqrt(E*E+1)-E),R=Math.log(Math.sqrt(C*C+1)-C);k=(R-T)/t,S=function(A){var D=A*k,O=ok(T),$=p/(n*j)*(O*$$(t*D+T)-I$(T));return[d+$*v,h+$*N,p*O/ok(t*D+T)]}}return S.duration=k*1e3*t/Math.SQRT2,S}return a.rho=function(l){var c=Math.max(.001,+l),d=c*c,h=d*d;return e(c,d,h)},a})(Math.SQRT2,2,4);var li=0,jl=0,gl=0,aT=1e3,nd,El,rd=0,Ga=0,bd=0,Ll=typeof performance=="object"&&performance.now?performance:Date,oT=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function tx(){return Ga||(oT(P$),Ga=Ll.now()+bd)}function P$(){Ga=0}function sd(){this._call=this._time=this._next=null}sd.prototype=iT.prototype={constructor:sd,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?tx():+n)+(t==null?0:+t),!this._next&&El!==this&&(El?El._next=this:nd=this,El=this),this._call=e,this._time=n,vv()},stop:function(){this._call&&(this._call=null,this._time=1/0,vv())}};function iT(e,t,n){var s=new sd;return s.restart(e,t,n),s}function L$(){tx(),++li;for(var e=nd,t;e;)(t=Ga-e._time)>=0&&e._call.call(void 0,t),e=e._next;--li}function ik(){Ga=(rd=Ll.now())+bd,li=jl=0;try{L$()}finally{li=0,q$(),Ga=0}}function D$(){var e=Ll.now(),t=e-rd;t>aT&&(bd-=t,rd=e)}function q$(){for(var e,t=nd,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:nd=n);El=e,vv(s)}function vv(e){if(!li){jl&&(jl=clearTimeout(jl));var t=e-Ga;t>24?(e<1/0&&(jl=setTimeout(ik,e-Ll.now()-bd)),gl&&(gl=clearInterval(gl))):(gl||(rd=Ll.now(),gl=setInterval(D$,aT)),li=1,oT(ik))}}function lk(e,t,n){var s=new sd;return t=t==null?0:+t,s.restart(a=>{s.stop(),e(a+t)},t,n),s}var F$=vd("start","end","cancel","interrupt"),B$=[],lT=0,ck=1,xv=2,Hu=3,uk=4,bv=5,Gu=6;function kd(e,t,n,s,a,l){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;z$(e,n,{name:t,index:s,group:a,on:F$,tween:B$,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:lT})}function nx(e,t){var n=yr(e,t);if(n.state>lT)throw new Error("too late; already scheduled");return n}function Dr(e,t){var n=yr(e,t);if(n.state>Hu)throw new Error("too late; already running");return n}function yr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function z$(e,t,n){var s=e.__transition,a;s[t]=n,n.timer=iT(l,0,n.time);function l(p){n.state=ck,n.timer.restart(c,n.delay,n.time),n.delay<=p&&c(p-n.delay)}function c(p){var f,m,y,v;if(n.state!==ck)return h();for(f in s)if(v=s[f],v.name===n.name){if(v.state===Hu)return lk(c);v.state===uk?(v.state=Gu,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete s[f]):+f<t&&(v.state=Gu,v.timer.stop(),v.on.call("cancel",e,e.__data__,v.index,v.group),delete s[f])}if(lk(function(){n.state===Hu&&(n.state=uk,n.timer.restart(d,n.delay,n.time),d(p))}),n.state=xv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===xv){for(n.state=Hu,a=new Array(y=n.tween.length),f=0,m=-1;f<y;++f)(v=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(a[++m]=v);a.length=m+1}}function d(p){for(var f=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(h),n.state=bv,1),m=-1,y=a.length;++m<y;)a[m].call(e,f);n.state===bv&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=Gu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function Vu(e,t){var n=e.__transition,s,a,l=!0,c;if(n){t=t==null?null:t+"";for(c in n){if((s=n[c]).name!==t){l=!1;continue}a=s.state>xv&&s.state<bv,s.state=Gu,s.timer.stop(),s.on.call(a?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[c]}l&&delete e.__transition}}function U$(e){return this.each(function(){Vu(this,e)})}function W$(e,t){var n,s;return function(){var a=Dr(this,e),l=a.tween;if(l!==n){s=n=l;for(var c=0,d=s.length;c<d;++c)if(s[c].name===t){s=s.slice(),s.splice(c,1);break}}a.tween=s}}function H$(e,t,n){var s,a;if(typeof n!="function")throw new Error;return function(){var l=Dr(this,e),c=l.tween;if(c!==s){a=(s=c).slice();for(var d={name:t,value:n},h=0,p=a.length;h<p;++h)if(a[h].name===t){a[h]=d;break}h===p&&a.push(d)}l.tween=a}}function G$(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=yr(this.node(),n).tween,a=0,l=s.length,c;a<l;++a)if((c=s[a]).name===e)return c.value;return null}return this.each((t==null?W$:H$)(n,e,t))}function rx(e,t,n){var s=e._id;return e.each(function(){var a=Dr(this,s);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return yr(a,s).value[t]}}function cT(e,t){var n;return(typeof t=="number"?zs:t instanceof Pl?sk:(n=Pl(t))?(t=n,sk):E$)(e,t)}function V$(e){return function(){this.removeAttribute(e)}}function Y$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function K$(e,t,n){var s,a=n+"",l;return function(){var c=this.getAttribute(e);return c===a?null:c===s?l:l=t(s=c,n)}}function X$(e,t,n){var s,a=n+"",l;return function(){var c=this.getAttributeNS(e.space,e.local);return c===a?null:c===s?l:l=t(s=c,n)}}function Q$(e,t,n){var s,a,l;return function(){var c,d=n(this),h;return d==null?void this.removeAttribute(e):(c=this.getAttribute(e),h=d+"",c===h?null:c===s&&h===a?l:(a=h,l=t(s=c,d)))}}function Z$(e,t,n){var s,a,l;return function(){var c,d=n(this),h;return d==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),h=d+"",c===h?null:c===s&&h===a?l:(a=h,l=t(s=c,d)))}}function J$(e,t){var n=xd(e),s=n==="transform"?R$:cT;return this.attrTween(e,typeof t=="function"?(n.local?Z$:Q$)(n,s,rx(this,"attr."+e,t)):t==null?(n.local?Y$:V$)(n):(n.local?X$:K$)(n,s,t))}function eO(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function tO(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function nO(e,t){var n,s;function a(){var l=t.apply(this,arguments);return l!==s&&(n=(s=l)&&tO(e,l)),n}return a._value=t,a}function rO(e,t){var n,s;function a(){var l=t.apply(this,arguments);return l!==s&&(n=(s=l)&&eO(e,l)),n}return a._value=t,a}function sO(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=xd(e);return this.tween(n,(s.local?nO:rO)(s,t))}function aO(e,t){return function(){nx(this,e).delay=+t.apply(this,arguments)}}function oO(e,t){return t=+t,function(){nx(this,e).delay=t}}function iO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?aO:oO)(t,e)):yr(this.node(),t).delay}function lO(e,t){return function(){Dr(this,e).duration=+t.apply(this,arguments)}}function cO(e,t){return t=+t,function(){Dr(this,e).duration=t}}function uO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?lO:cO)(t,e)):yr(this.node(),t).duration}function dO(e,t){if(typeof t!="function")throw new Error;return function(){Dr(this,e).ease=t}}function hO(e){var t=this._id;return arguments.length?this.each(dO(t,e)):yr(this.node(),t).ease}function fO(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Dr(this,e).ease=n}}function pO(e){if(typeof e!="function")throw new Error;return this.each(fO(this._id,e))}function mO(e){typeof e!="function"&&(e=BC(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,d=s[a]=[],h,p=0;p<c;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&d.push(h);return new hs(s,this._parents,this._name,this._id)}function gO(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,a=n.length,l=Math.min(s,a),c=new Array(s),d=0;d<l;++d)for(var h=t[d],p=n[d],f=h.length,m=c[d]=new Array(f),y,v=0;v<f;++v)(y=h[v]||p[v])&&(m[v]=y);for(;d<s;++d)c[d]=t[d];return new hs(c,this._parents,this._name,this._id)}function yO(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 wO(e,t,n){var s,a,l=yO(t)?nx:Dr;return function(){var c=l(this,e),d=c.on;d!==s&&(a=(s=d).copy()).on(t,n),c.on=a}}function vO(e,t){var n=this._id;return arguments.length<2?yr(this.node(),n).on.on(e):this.each(wO(n,e,t))}function xO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function bO(){return this.on("end.remove",xO(this._id))}function kO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Zv(e));for(var s=this._groups,a=s.length,l=new Array(a),c=0;c<a;++c)for(var d=s[c],h=d.length,p=l[c]=new Array(h),f,m,y=0;y<h;++y)(f=d[y])&&(m=e.call(f,f.__data__,y,d))&&("__data__"in f&&(m.__data__=f.__data__),p[y]=m,kd(p[y],t,n,y,p,yr(f,n)));return new hs(l,this._parents,t,n)}function _O(e){var t=this._name,n=this._id;typeof e!="function"&&(e=FC(e));for(var s=this._groups,a=s.length,l=[],c=[],d=0;d<a;++d)for(var h=s[d],p=h.length,f,m=0;m<p;++m)if(f=h[m]){for(var y=e.call(f,f.__data__,m,h),v,N=yr(f,n),_=0,S=y.length;_<S;++_)(v=y[_])&&kd(v,t,n,_,y,N);l.push(y),c.push(f)}return new hs(l,c,t,n)}var NO=Vl.prototype.constructor;function SO(){return new NO(this._groups,this._parents)}function jO(e,t){var n,s,a;return function(){var l=ii(this,e),c=(this.style.removeProperty(e),ii(this,e));return l===c?null:l===n&&c===s?a:a=t(n=l,s=c)}}function uT(e){return function(){this.style.removeProperty(e)}}function EO(e,t,n){var s,a=n+"",l;return function(){var c=ii(this,e);return c===a?null:c===s?l:l=t(s=c,n)}}function CO(e,t,n){var s,a,l;return function(){var c=ii(this,e),d=n(this),h=d+"";return d==null&&(h=d=(this.style.removeProperty(e),ii(this,e))),c===h?null:c===s&&h===a?l:(a=h,l=t(s=c,d))}}function TO(e,t){var n,s,a,l="style."+t,c="end."+l,d;return function(){var h=Dr(this,e),p=h.on,f=h.value[l]==null?d||(d=uT(t)):void 0;(p!==n||a!==f)&&(s=(n=p).copy()).on(c,a=f),h.on=s}}function AO(e,t,n){var s=(e+="")=="transform"?A$:cT;return t==null?this.styleTween(e,jO(e,s)).on("end.style."+e,uT(e)):typeof t=="function"?this.styleTween(e,CO(e,s,rx(this,"style."+e,t))).each(TO(this._id,e)):this.styleTween(e,EO(e,s,t),n).on("end.style."+e,null)}function RO(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function MO(e,t,n){var s,a;function l(){var c=t.apply(this,arguments);return c!==a&&(s=(a=c)&&RO(e,c,n)),s}return l._value=t,l}function IO(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,MO(e,t,n??""))}function $O(e){return function(){this.textContent=e}}function OO(e){return function(){var t=e(this);this.textContent=t??""}}function PO(e){return this.tween("text",typeof e=="function"?OO(rx(this,"text",e)):$O(e==null?"":e+""))}function LO(e){return function(t){this.textContent=e.call(this,t)}}function DO(e){var t,n;function s(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&LO(a)),t}return s._value=e,s}function qO(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,DO(e))}function FO(){for(var e=this._name,t=this._id,n=dT(),s=this._groups,a=s.length,l=0;l<a;++l)for(var c=s[l],d=c.length,h,p=0;p<d;++p)if(h=c[p]){var f=yr(h,t);kd(h,e,n,p,c,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new hs(s,this._parents,e,n)}function BO(){var e,t,n=this,s=n._id,a=n.size();return new Promise(function(l,c){var d={value:c},h={value:function(){--a===0&&l()}};n.each(function(){var p=Dr(this,s),f=p.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(d),t._.interrupt.push(d),t._.end.push(h)),p.on=t}),a===0&&l()})}var zO=0;function hs(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function dT(){return++zO}var cs=Vl.prototype;hs.prototype={constructor:hs,select:kO,selectAll:_O,selectChild:cs.selectChild,selectChildren:cs.selectChildren,filter:mO,merge:gO,selection:SO,transition:FO,call:cs.call,nodes:cs.nodes,node:cs.node,size:cs.size,empty:cs.empty,each:cs.each,on:vO,attr:J$,attrTween:sO,style:AO,styleTween:IO,text:PO,textTween:qO,remove:bO,tween:G$,delay:iO,duration:uO,ease:hO,easeVarying:pO,end:BO,[Symbol.iterator]:cs[Symbol.iterator]};function UO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var WO={time:null,delay:0,duration:250,ease:UO};function HO(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 GO(e){var t,n;e instanceof hs?(t=e._id,e=e._name):(t=dT(),(n=WO).time=tx(),e=e==null?null:e+"");for(var s=this._groups,a=s.length,l=0;l<a;++l)for(var c=s[l],d=c.length,h,p=0;p<d;++p)(h=c[p])&&kd(h,e,t,p,c,n||HO(h,t));return new hs(s,this._parents,e,t)}Vl.prototype.interrupt=U$;Vl.prototype.transition=GO;const Su=e=>()=>e;function VO(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 us(e,t,n){this.k=e,this.x=t,this.y=n}us.prototype={constructor:us,scale:function(e){return e===1?this:new us(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new us(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ds=new us(1,0,0);us.prototype;function Rf(e){e.stopImmediatePropagation()}function yl(e){e.preventDefault(),e.stopImmediatePropagation()}function YO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function KO(){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||ds}function XO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function QO(){return navigator.maxTouchPoints||"ontouchstart"in this}function ZO(e,t,n){var s=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a),c>l?(l+c)/2:Math.min(0,l)||Math.max(0,c))}function hT(){var e=YO,t=KO,n=ZO,s=XO,a=QO,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,h=O$,p=vd("start","zoom","end"),f,m,y,v=500,N=150,_=0,S=10;function k(I){I.property("__zoom",dk).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",$).filter(a).on("touchstart.zoom",B).on("touchmove.zoom",Z).on("touchend.zoom touchcancel.zoom",J).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(I,X,G,q){var Y=I.selection?I.selection():I;Y.property("__zoom",dk),I!==Y?T(I,X,G,q):Y.interrupt().each(function(){R(this,arguments).event(q).start().zoom(null,typeof X=="function"?X.apply(this,arguments):X).end()})},k.scaleBy=function(I,X,G,q){k.scaleTo(I,function(){var Y=this.__zoom.k,L=typeof X=="function"?X.apply(this,arguments):X;return Y*L},G,q)},k.scaleTo=function(I,X,G,q){k.transform(I,function(){var Y=t.apply(this,arguments),L=this.__zoom,K=G==null?C(Y):typeof G=="function"?G.apply(this,arguments):G,P=L.invert(K),V=typeof X=="function"?X.apply(this,arguments):X;return n(E(j(L,V),K,P),Y,c)},G,q)},k.translateBy=function(I,X,G,q){k.transform(I,function(){return n(this.__zoom.translate(typeof X=="function"?X.apply(this,arguments):X,typeof G=="function"?G.apply(this,arguments):G),t.apply(this,arguments),c)},null,q)},k.translateTo=function(I,X,G,q,Y){k.transform(I,function(){var L=t.apply(this,arguments),K=this.__zoom,P=q==null?C(L):typeof q=="function"?q.apply(this,arguments):q;return n(ds.translate(P[0],P[1]).scale(K.k).translate(typeof X=="function"?-X.apply(this,arguments):-X,typeof G=="function"?-G.apply(this,arguments):-G),L,c)},q,Y)};function j(I,X){return X=Math.max(l[0],Math.min(l[1],X)),X===I.k?I:new us(X,I.x,I.y)}function E(I,X,G){var q=X[0]-G[0]*I.k,Y=X[1]-G[1]*I.k;return q===I.x&&Y===I.y?I:new us(I.k,q,Y)}function C(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function T(I,X,G,q){I.on("start.zoom",function(){R(this,arguments).event(q).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(q).end()}).tween("zoom",function(){var Y=this,L=arguments,K=R(Y,L).event(q),P=t.apply(Y,L),V=G==null?C(P):typeof G=="function"?G.apply(Y,L):G,he=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),z=Y.__zoom,W=typeof X=="function"?X.apply(Y,L):X,ee=h(z.invert(V).concat(he/z.k),W.invert(V).concat(he/W.k));return function(H){if(H===1)H=W;else{var ae=ee(H),me=he/ae[2];H=new us(me,V[0]-ae[0]*me,V[1]-ae[1]*me)}K.zoom(null,H)}})}function R(I,X,G){return!G&&I.__zooming||new A(I,X)}function A(I,X){this.that=I,this.args=X,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,X),this.taps=0}A.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,X){return this.mouse&&I!=="mouse"&&(this.mouse[1]=X.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=X.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=X.invert(this.touch1[0])),this.that.__zoom=X,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var X=Hn(this.that).datum();p.call(I,this.that,new VO(I,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:p}),X)}};function D(I,...X){if(!e.apply(this,arguments))return;var G=R(this,X).event(I),q=this.__zoom,Y=Math.max(l[0],Math.min(l[1],q.k*Math.pow(2,s.apply(this,arguments)))),L=cr(I);if(G.wheel)(G.mouse[0][0]!==L[0]||G.mouse[0][1]!==L[1])&&(G.mouse[1]=q.invert(G.mouse[0]=L)),clearTimeout(G.wheel);else{if(q.k===Y)return;G.mouse=[L,q.invert(L)],Vu(this),G.start()}yl(I),G.wheel=setTimeout(K,N),G.zoom("mouse",n(E(j(q,Y),G.mouse[0],G.mouse[1]),G.extent,c));function K(){G.wheel=null,G.end()}}function O(I,...X){if(y||!e.apply(this,arguments))return;var G=I.currentTarget,q=R(this,X,!0).event(I),Y=Hn(I.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",he,!0),L=cr(I,G),K=I.clientX,P=I.clientY;QC(I.view),Rf(I),q.mouse=[L,this.__zoom.invert(L)],Vu(this),q.start();function V(z){if(yl(z),!q.moved){var W=z.clientX-K,ee=z.clientY-P;q.moved=W*W+ee*ee>_}q.event(z).zoom("mouse",n(E(q.that.__zoom,q.mouse[0]=cr(z,G),q.mouse[1]),q.extent,c))}function he(z){Y.on("mousemove.zoom mouseup.zoom",null),ZC(z.view,q.moved),yl(z),q.event(z).end()}}function $(I,...X){if(e.apply(this,arguments)){var G=this.__zoom,q=cr(I.changedTouches?I.changedTouches[0]:I,this),Y=G.invert(q),L=G.k*(I.shiftKey?.5:2),K=n(E(j(G,L),q,Y),t.apply(this,X),c);yl(I),d>0?Hn(this).transition().duration(d).call(T,K,q,I):Hn(this).call(k.transform,K,q,I)}}function B(I,...X){if(e.apply(this,arguments)){var G=I.touches,q=G.length,Y=R(this,X,I.changedTouches.length===q).event(I),L,K,P,V;for(Rf(I),K=0;K<q;++K)P=G[K],V=cr(P,this),V=[V,this.__zoom.invert(V),P.identifier],Y.touch0?!Y.touch1&&Y.touch0[2]!==V[2]&&(Y.touch1=V,Y.taps=0):(Y.touch0=V,L=!0,Y.taps=1+!!f);f&&(f=clearTimeout(f)),L&&(Y.taps<2&&(m=V[0],f=setTimeout(function(){f=null},v)),Vu(this),Y.start())}}function Z(I,...X){if(this.__zooming){var G=R(this,X).event(I),q=I.changedTouches,Y=q.length,L,K,P,V;for(yl(I),L=0;L<Y;++L)K=q[L],P=cr(K,this),G.touch0&&G.touch0[2]===K.identifier?G.touch0[0]=P:G.touch1&&G.touch1[2]===K.identifier&&(G.touch1[0]=P);if(K=G.that.__zoom,G.touch1){var he=G.touch0[0],z=G.touch0[1],W=G.touch1[0],ee=G.touch1[1],H=(H=W[0]-he[0])*H+(H=W[1]-he[1])*H,ae=(ae=ee[0]-z[0])*ae+(ae=ee[1]-z[1])*ae;K=j(K,Math.sqrt(H/ae)),P=[(he[0]+W[0])/2,(he[1]+W[1])/2],V=[(z[0]+ee[0])/2,(z[1]+ee[1])/2]}else if(G.touch0)P=G.touch0[0],V=G.touch0[1];else return;G.zoom("touch",n(E(K,P,V),G.extent,c))}}function J(I,...X){if(this.__zooming){var G=R(this,X).event(I),q=I.changedTouches,Y=q.length,L,K;for(Rf(I),y&&clearTimeout(y),y=setTimeout(function(){y=null},v),L=0;L<Y;++L)K=q[L],G.touch0&&G.touch0[2]===K.identifier?delete G.touch0:G.touch1&&G.touch1[2]===K.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&&(K=cr(K,this),Math.hypot(m[0]-K[0],m[1]-K[1])<S)){var P=Hn(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return k.wheelDelta=function(I){return arguments.length?(s=typeof I=="function"?I:Su(+I),k):s},k.filter=function(I){return arguments.length?(e=typeof I=="function"?I:Su(!!I),k):e},k.touchable=function(I){return arguments.length?(a=typeof I=="function"?I:Su(!!I),k):a},k.extent=function(I){return arguments.length?(t=typeof I=="function"?I:Su([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),k):t},k.scaleExtent=function(I){return arguments.length?(l[0]=+I[0],l[1]=+I[1],k):[l[0],l[1]]},k.translateExtent=function(I){return arguments.length?(c[0][0]=+I[0][0],c[1][0]=+I[1][0],c[0][1]=+I[0][1],c[1][1]=+I[1][1],k):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},k.constrain=function(I){return arguments.length?(n=I,k):n},k.duration=function(I){return arguments.length?(d=+I,k):d},k.interpolate=function(I){return arguments.length?(h=I,k):h},k.on=function(){var I=p.on.apply(p,arguments);return I===p?k:I},k.clickDistance=function(I){return arguments.length?(_=(I=+I)*I,k):Math.sqrt(_)},k.tapDistance=function(I){return arguments.length?(S=+I,k):S},k}var ps=LC();const _d=x.createContext(null),JO=_d.Provider,fs={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.`},fT=fs.error001();function ht(e,t){const n=x.useContext(_d);if(n===null)throw new Error(fT);return DC(n,e,t)}const It=()=>{const e=x.useContext(_d);if(e===null)throw new Error(fT);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},eP=e=>e.userSelectionActive?"none":"all";function sx({position:e,children:t,className:n,style:s,...a}){const l=ht(eP),c=`${e}`.split("-");return pe.createElement("div",{className:Jt(["react-flow__panel",n,...c]),style:{...s,pointerEvents:l},...a},t)}function tP({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:pe.createElement(sx,{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 nP=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:a=!0,labelBgStyle:l={},labelBgPadding:c=[2,4],labelBgBorderRadius:d=2,children:h,className:p,...f})=>{const m=x.useRef(null),[y,v]=x.useState({x:0,y:0,width:0,height:0}),N=Jt(["react-flow__edge-textwrapper",p]);return x.useEffect(()=>{if(m.current){const _=m.current.getBBox();v({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",...f},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:l,rx:d,ry:d}),pe.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:s},n),h)};var rP=x.memo(nP);const ax=e=>({width:e.offsetWidth,height:e.offsetHeight}),ci=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ox=(e={x:0,y:0},t)=>({x:ci(e.x,t[0][0],t[1][0]),y:ci(e.y,t[0][1],t[1][1])}),hk=(e,t,n)=>e<t?ci(Math.abs(e-t),1,50)/50:e>n?-ci(Math.abs(e-n),1,50)/50:0,pT=(e,t)=>{const n=hk(e.x,35,t.width-35)*20,s=hk(e.y,35,t.height-35)*20;return[n,s]},mT=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},gT=(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)}),Dl=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),yT=({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}),sP=(e,t)=>yT(gT(Dl(e),Dl(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)},aP=e=>Gn(e.width)&&Gn(e.height)&&Gn(e.x)&&Gn(e.y),Gn=e=>!isNaN(e)&&isFinite(e),jt=Symbol.for("internals"),wT=["Enter"," ","Escape"],oP=(e,t)=>{},iP=e=>"nativeEvent"in e;function _v(e){var a,l;const t=iP(e)?e.nativeEvent:e,n=((l=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:l[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const vT=e=>"clientX"in e,Hs=(e,t)=>{var l,c;const n=vT(e),s=n?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,a=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x: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},Kl=({id:e,path:t,labelX:n,labelY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:m,markerStart:y,interactionWidth:v=20})=>pe.createElement(pe.Fragment,null,pe.createElement("path",{id:e,style:f,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),v&&pe.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:v,className:"react-flow__edge-interaction"}),a&&Gn(n)&&Gn(s)?pe.createElement(rP,{x:n,y:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p}):null);Kl.displayName="BaseEdge";function wl(e,t,n){return n===void 0?n:s=>{const a=t().edges.find(l=>l.id===e);a&&n(s,{...a})}}function xT({sourceX:e,sourceY:t,targetX:n,targetY:s}){const a=Math.abs(n-e)/2,l=n<e?n+a:n-a,c=Math.abs(s-t)/2,d=s<t?s+c:s-c;return[l,d,a,c]}function bT({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d}){const h=e*.125+a*.375+c*.375+n*.125,p=t*.125+l*.375+d*.375+s*.125,f=Math.abs(h-e),m=Math.abs(p-t);return[h,p,f,m]}var Va;(function(e){e.Strict="strict",e.Loose="loose"})(Va||(Va={}));var Ua;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ua||(Ua={}));var ql;(function(e){e.Partial="partial",e.Full="full"})(ql||(ql={}));var Ws;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ws||(Ws={}));var od;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(od||(od={}));var Be;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Be||(Be={}));function pk({pos:e,x1:t,y1:n,x2:s,y2:a}){return e===Be.Left||e===Be.Right?[.5*(t+s),n]:[t,.5*(n+a)]}function kT({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:s,targetY:a,targetPosition:l=Be.Top}){const[c,d]=pk({pos:n,x1:e,y1:t,x2:s,y2:a}),[h,p]=pk({pos:l,x1:s,y1:a,x2:e,y2:t}),[f,m,y,v]=bT({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:c,sourceControlY:d,targetControlX:h,targetControlY:p});return[`M${e},${t} C${c},${d} ${h},${p} ${s},${a}`,f,m,y,v]}const ix=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=Be.Bottom,targetPosition:l=Be.Top,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:N,interactionWidth:_})=>{const[S,k,j]=kT({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:l});return pe.createElement(Kl,{path:S,labelX:k,labelY:j,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:N,interactionWidth:_})});ix.displayName="SimpleBezierEdge";const mk={[Be.Left]:{x:-1,y:0},[Be.Right]:{x:1,y:0},[Be.Top]:{x:0,y:-1},[Be.Bottom]:{x:0,y:1}},lP=({source:e,sourcePosition:t=Be.Bottom,target:n})=>t===Be.Left||t===Be.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},gk=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function cP({source:e,sourcePosition:t=Be.Bottom,target:n,targetPosition:s=Be.Top,center:a,offset:l}){const c=mk[t],d=mk[s],h={x:e.x+c.x*l,y:e.y+c.y*l},p={x:n.x+d.x*l,y:n.y+d.y*l},f=lP({source:h,sourcePosition:t,target:p}),m=f.x!==0?"x":"y",y=f[m];let v=[],N,_;const S={x:0,y:0},k={x:0,y:0},[j,E,C,T]=xT({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[m]*d[m]===-1){N=a.x??j,_=a.y??E;const A=[{x:N,y:h.y},{x:N,y:p.y}],D=[{x:h.x,y:_},{x:p.x,y:_}];c[m]===y?v=m==="x"?A:D:v=m==="x"?D:A}else{const A=[{x:h.x,y:p.y}],D=[{x:p.x,y:h.y}];if(m==="x"?v=c.x===y?D:A:v=c.y===y?A:D,t===s){const J=Math.abs(e[m]-n[m]);if(J<=l){const I=Math.min(l-1,l-J);c[m]===y?S[m]=(h[m]>e[m]?-1:1)*I:k[m]=(p[m]>n[m]?-1:1)*I}}if(t!==s){const J=m==="x"?"y":"x",I=c[m]===d[J],X=h[J]>p[J],G=h[J]<p[J];(c[m]===1&&(!I&&X||I&&G)||c[m]!==1&&(!I&&G||I&&X))&&(v=m==="x"?A:D)}const O={x:h.x+S.x,y:h.y+S.y},$={x:p.x+k.x,y:p.y+k.y},B=Math.max(Math.abs(O.x-v[0].x),Math.abs($.x-v[0].x)),Z=Math.max(Math.abs(O.y-v[0].y),Math.abs($.y-v[0].y));B>=Z?(N=(O.x+$.x)/2,_=v[0].y):(N=v[0].x,_=(O.y+$.y)/2)}return[[e,{x:h.x+S.x,y:h.y+S.y},...v,{x:p.x+k.x,y:p.y+k.y},n],N,_,C,T]}function uP(e,t,n,s){const a=Math.min(gk(e,t)/2,gk(t,n)/2,s),{x:l,y:c}=t;if(e.x===l&&l===n.x||e.y===c&&c===n.y)return`L${l} ${c}`;if(e.y===c){const p=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${l+a*p},${c}Q ${l},${c} ${l},${c+a*f}`}const d=e.x<n.x?1:-1,h=e.y<n.y?-1:1;return`L ${l},${c+a*h}Q ${l},${c} ${l+a*d},${c}`}function Nv({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:s,targetY:a,targetPosition:l=Be.Top,borderRadius:c=5,centerX:d,centerY:h,offset:p=20}){const[f,m,y,v,N]=cP({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:a},targetPosition:l,center:{x:d,y:h},offset:p});return[f.reduce((S,k,j)=>{let E="";return j>0&&j<f.length-1?E=uP(f[j-1],k,f[j+1],c):E=`${j===0?"M":"L"}${k.x} ${k.y}`,S+=E,S},""),m,y,v,N]}const Nd=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,sourcePosition:m=Be.Bottom,targetPosition:y=Be.Top,markerEnd:v,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[k,j,E]=Nv({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(Kl,{path:k,labelX:j,labelY:E,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:v,markerStart:N,interactionWidth:S})});Nd.displayName="SmoothStepEdge";const lx=x.memo(e=>{var t;return pe.createElement(Nd,{...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])})});lx.displayName="StepEdge";function dP({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[a,l,c,d]=xT({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,a,l,c,d]}const cx=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:m,markerStart:y,interactionWidth:v})=>{const[N,_,S]=dP({sourceX:e,sourceY:t,targetX:n,targetY:s});return pe.createElement(Kl,{path:N,labelX:_,labelY:S,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:m,markerStart:y,interactionWidth:v})});cx.displayName="StraightEdge";function ju(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function yk({pos:e,x1:t,y1:n,x2:s,y2:a,c:l}){switch(e){case Be.Left:return[t-ju(t-s,l),n];case Be.Right:return[t+ju(s-t,l),n];case Be.Top:return[t,n-ju(n-a,l)];case Be.Bottom:return[t,n+ju(a-n,l)]}}function _T({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:s,targetY:a,targetPosition:l=Be.Top,curvature:c=.25}){const[d,h]=yk({pos:n,x1:e,y1:t,x2:s,y2:a,c}),[p,f]=yk({pos:l,x1:s,y1:a,x2:e,y2:t,c}),[m,y,v,N]=bT({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:d,sourceControlY:h,targetControlX:p,targetControlY:f});return[`M${e},${t} C${d},${h} ${p},${f} ${s},${a}`,m,y,v,N]}const id=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=Be.Bottom,targetPosition:l=Be.Top,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[k,j,E]=_T({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:l,curvature:_==null?void 0:_.curvature});return pe.createElement(Kl,{path:k,labelX:j,labelY:E,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:N,interactionWidth:S})});id.displayName="BezierEdge";const ux=x.createContext(null),hP=ux.Provider;ux.Consumer;const fP=()=>x.useContext(ux),pP=e=>"id"in e&&"source"in e&&"target"in e,mP=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Sv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,gP=(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)),yP=(e,t)=>{if(!e.source||!e.target)return t;let n;return pP(e)?n={...e}:n={...e,id:mP(e)},gP(n,t)?t:t.concat(n)},jv=({x:e,y:t},[n,s,a],l,[c,d])=>{const h={x:(e-n)/a,y:(t-s)/a};return l?{x:c*Math.round(h.x/c),y:d*Math.round(h.y/d)}:h},NT=({x:e,y:t},[n,s,a])=>({x:e*a+n,y:t*a+s}),Ha=(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}},Sd=(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:l,y:c}=Ha(a,t).positionAbsolute;return gT(s,Dl({x:l,y:c,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return yT(n)},ST=(e,t,[n,s,a]=[0,0,1],l=!1,c=!1,d=[0,0])=>{const h={x:(t.x-n)/a,y:(t.y-s)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(f=>{const{width:m,height:y,selectable:v=!0,hidden:N=!1}=f;if(c&&!v||N)return!1;const{positionAbsolute:_}=Ha(f,d),S={x:_.x,y:_.y,width:m||0,height:y||0},k=kv(h,S),j=typeof m>"u"||typeof y>"u"||m===null||y===null,E=l&&k>0,C=(m||0)*(y||0);(j||E||k>=C||f.dragging)&&p.push(f)}),p},jT=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},ET=(e,t,n,s,a,l=.1)=>{const c=t/(e.width*(1+l)),d=n/(e.height*(1+l)),h=Math.min(c,d),p=ci(h,s,a),f=e.x+e.width/2,m=e.y+e.height/2,y=t/2-f*p,v=n/2-m*p;return{x:y,y:v,zoom:p}},Ba=(e,t=0)=>e.transition().duration(t);function wk(e,t,n,s){return(t[n]||[]).reduce((a,l)=>{var c,d;return`${e.id}-${l.id}-${n}`!==s&&a.push({id:l.id||null,type:n,nodeId:e.id,x:(((c=e.positionAbsolute)==null?void 0:c.x)??0)+l.x+l.width/2,y:(((d=e.positionAbsolute)==null?void 0:d.y)??0)+l.y+l.height/2}),a},[])}function wP(e,t,n,s,a,l){const{x:c,y:d}=Hs(e),p=t.elementsFromPoint(c,d).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const _=dx(void 0,p),S=p.getAttribute("data-handleid"),k=l({nodeId:N,id:S,type:_});if(k){const j=a.find(E=>E.nodeId===N&&E.type===_&&E.id===S);return{handle:{id:S,type:_,nodeId:N,x:(j==null?void 0:j.x)||n.x,y:(j==null?void 0:j.y)||n.y},validHandleResult:k}}}}let f=[],m=1/0;if(a.forEach(N=>{const _=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(_<=s){const S=l(N);_<=m&&(_<m?f=[{handle:N,validHandleResult:S}]:_===m&&f.push({handle:N,validHandleResult:S}),m=_)}}),!f.length)return{handle:null,validHandleResult:CT()};if(f.length===1)return f[0];const y=f.some(({validHandleResult:N})=>N.isValid),v=f.some(({handle:N})=>N.type==="target");return f.find(({handle:N,validHandleResult:_})=>v?N.type==="target":y?_.isValid:!0)||f[0]}const vP={source:null,target:null,sourceHandle:null,targetHandle:null},CT=()=>({handleDomNode:null,isValid:!1,connection:vP,endHandle:null});function TT(e,t,n,s,a,l,c){const d=a==="target",h=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={...CT(),handleDomNode:h};if(h){const f=dx(void 0,h),m=h.getAttribute("data-nodeid"),y=h.getAttribute("data-handleid"),v=h.classList.contains("connectable"),N=h.classList.contains("connectableend"),_={source:d?m:n,sourceHandle:d?y:s,target:d?n:m,targetHandle:d?s:y};p.connection=_,v&&N&&(t===Va.Strict?d&&f==="source"||!d&&f==="target":m!==n||y!==s)&&(p.endHandle={nodeId:m,handleId:y,type:f},p.isValid=l(_))}return p}function xP({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((a,l)=>{if(l[jt]){const{handleBounds:c}=l[jt];let d=[],h=[];c&&(d=wk(l,c,"source",`${t}-${n}-${s}`),h=wk(l,c,"target",`${t}-${n}-${s}`)),a.push(...d,...h)}return a},[])}function dx(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Mf(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function bP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function AT({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:a,getState:l,setState:c,isValidConnection:d,edgeUpdaterType:h,onReconnectEnd:p}){const f=mT(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:v,connectionRadius:N,onConnectStart:_,panBy:S,getNodes:k,cancelConnection:j}=l();let E=0,C;const{x:T,y:R}=Hs(e),A=f==null?void 0:f.elementFromPoint(T,R),D=dx(h,A),O=y==null?void 0:y.getBoundingClientRect();if(!O||!D)return;let $,B=Hs(e,O),Z=!1,J=null,I=!1,X=null;const G=xP({nodes:k(),nodeId:n,handleId:t,handleType:D}),q=()=>{if(!v)return;const[K,P]=pT(B,O);S({x:K,y:P}),E=requestAnimationFrame(q)};c({connectionPosition:B,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:D,connectionStartHandle:{nodeId:n,handleId:t,type:D},connectionEndHandle:null}),_==null||_(e,{nodeId:n,handleId:t,handleType:D});function Y(K){const{transform:P}=l();B=Hs(K,O);const{handle:V,validHandleResult:he}=wP(K,f,jv(B,P,!1,[1,1]),N,G,z=>TT(z,m,n,t,a?"target":"source",d,f));if(C=V,Z||(q(),Z=!0),X=he.handleDomNode,J=he.connection,I=he.isValid,c({connectionPosition:C&&I?NT({x:C.x,y:C.y},P):B,connectionStatus:bP(!!C,I),connectionEndHandle:he.endHandle}),!C&&!I&&!X)return Mf($);J.source!==J.target&&X&&(Mf($),$=X,X.classList.add("connecting","react-flow__handle-connecting"),X.classList.toggle("valid",I),X.classList.toggle("react-flow__handle-valid",I))}function L(K){var P,V;(C||X)&&J&&I&&(s==null||s(J)),(V=(P=l()).onConnectEnd)==null||V.call(P,K),h&&(p==null||p(K)),Mf($),j(),cancelAnimationFrame(E),Z=!1,I=!1,J=null,X=null,f.removeEventListener("mousemove",Y),f.removeEventListener("mouseup",L),f.removeEventListener("touchmove",Y),f.removeEventListener("touchend",L)}f.addEventListener("mousemove",Y),f.addEventListener("mouseup",L),f.addEventListener("touchmove",Y),f.addEventListener("touchend",L)}const vk=()=>!0,kP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),_P=(e,t,n)=>s=>{const{connectionStartHandle:a,connectionEndHandle:l,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||(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n,clickConnecting:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.handleId)===t&&(c==null?void 0:c.type)===n}},RT=x.forwardRef(({type:e="source",position:t=Be.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:c,onConnect:d,children:h,className:p,onMouseDown:f,onTouchStart:m,...y},v)=>{var O,$;const N=c||null,_=e==="target",S=It(),k=fP(),{connectOnClick:j,noPanClassName:E}=ht(kP,qt),{connecting:C,clickConnecting:T}=ht(_P(k,N,e),qt);k||($=(O=S.getState()).onError)==null||$.call(O,"010",fs.error010());const R=B=>{const{defaultEdgeOptions:Z,onConnect:J,hasDefaultEdges:I}=S.getState(),X={...Z,...B};if(I){const{edges:G,setEdges:q}=S.getState();q(yP(X,G))}J==null||J(X),d==null||d(X)},A=B=>{if(!k)return;const Z=vT(B);a&&(Z&&B.button===0||!Z)&&AT({event:B,handleId:N,nodeId:k,onConnect:R,isTarget:_,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||vk}),Z?f==null||f(B):m==null||m(B)},D=B=>{const{onClickConnectStart:Z,onClickConnectEnd:J,connectionClickStartHandle:I,connectionMode:X,isValidConnection:G}=S.getState();if(!k||!I&&!a)return;if(!I){Z==null||Z(B,{nodeId:k,handleId:N,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:k,type:e,handleId:N}});return}const q=mT(B.target),Y=n||G||vk,{connection:L,isValid:K}=TT({nodeId:k,id:N,type:e},X,I.nodeId,I.handleId||null,I.type,Y,q);K&&R(L),J==null||J(B),S.setState({connectionClickStartHandle:null})};return pe.createElement("div",{"data-handleid":N,"data-nodeid":k,"data-handlepos":t,"data-id":`${k}-${N}-${e}`,className:Jt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,p,{source:!_,target:_,connectable:s,connectablestart:a,connectableend:l,connecting:T,connectionindicator:s&&(a&&!C||l&&C)}]),onMouseDown:A,onTouchStart:A,onClick:j?D:void 0,ref:v,...y},h)});RT.displayName="Handle";var ui=x.memo(RT);const MT=({data:e,isConnectable:t,targetPosition:n=Be.Top,sourcePosition:s=Be.Bottom})=>pe.createElement(pe.Fragment,null,pe.createElement(ui,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,pe.createElement(ui,{type:"source",position:s,isConnectable:t}));MT.displayName="DefaultNode";var Ev=x.memo(MT);const IT=({data:e,isConnectable:t,sourcePosition:n=Be.Bottom})=>pe.createElement(pe.Fragment,null,e==null?void 0:e.label,pe.createElement(ui,{type:"source",position:n,isConnectable:t}));IT.displayName="InputNode";var $T=x.memo(IT);const OT=({data:e,isConnectable:t,targetPosition:n=Be.Top})=>pe.createElement(pe.Fragment,null,pe.createElement(ui,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);OT.displayName="OutputNode";var PT=x.memo(OT);const hx=()=>null;hx.displayName="GroupNode";const NP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),Eu=e=>e.id;function SP(e,t){return qt(e.selectedNodes.map(Eu),t.selectedNodes.map(Eu))&&qt(e.selectedEdges.map(Eu),t.selectedEdges.map(Eu))}const LT=x.memo(({onSelectionChange:e})=>{const t=It(),{selectedNodes:n,selectedEdges:s}=ht(NP,SP);return x.useEffect(()=>{const a={nodes:n,edges:s};e==null||e(a),t.getState().onSelectionChange.forEach(l=>l(a))},[n,s,e]),null});LT.displayName="SelectionListener";const jP=e=>!!e.onSelectionChange;function EP({onSelectionChange:e}){const t=ht(jP);return e||t?pe.createElement(LT,{onSelectionChange:e}):null}const CP=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 Uo(e,t){x.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function rt(e,t,n){x.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const TP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:a,onConnectStart:l,onConnectEnd:c,onClickConnectStart:d,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:f,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:v,elevateNodesOnSelect:N,minZoom:_,maxZoom:S,nodeExtent:k,onNodesChange:j,onEdgesChange:E,elementsSelectable:C,connectionMode:T,snapGrid:R,snapToGrid:A,translateExtent:D,connectOnClick:O,defaultEdgeOptions:$,fitView:B,fitViewOptions:Z,onNodesDelete:J,onEdgesDelete:I,onNodeDrag:X,onNodeDragStart:G,onNodeDragStop:q,onSelectionDrag:Y,onSelectionDragStart:L,onSelectionDragStop:K,noPanClassName:P,nodeOrigin:V,rfId:he,autoPanOnConnect:z,autoPanOnNodeDrag:W,onError:ee,connectionRadius:H,isValidConnection:ae,nodeDragThreshold:me})=>{const{setNodes:ge,setEdges:Re,setDefaultNodesAndEdges:$e,setMinZoom:ce,setMaxZoom:we,setTranslateExtent:xe,setNodeExtent:De,reset:_e}=ht(CP,qt),Ee=It();return x.useEffect(()=>{const Ge=s==null?void 0:s.map(st=>({...st,...$}));return $e(n,Ge),()=>{_e()}},[]),rt("defaultEdgeOptions",$,Ee.setState),rt("connectionMode",T,Ee.setState),rt("onConnect",a,Ee.setState),rt("onConnectStart",l,Ee.setState),rt("onConnectEnd",c,Ee.setState),rt("onClickConnectStart",d,Ee.setState),rt("onClickConnectEnd",h,Ee.setState),rt("nodesDraggable",p,Ee.setState),rt("nodesConnectable",f,Ee.setState),rt("nodesFocusable",m,Ee.setState),rt("edgesFocusable",y,Ee.setState),rt("edgesUpdatable",v,Ee.setState),rt("elementsSelectable",C,Ee.setState),rt("elevateNodesOnSelect",N,Ee.setState),rt("snapToGrid",A,Ee.setState),rt("snapGrid",R,Ee.setState),rt("onNodesChange",j,Ee.setState),rt("onEdgesChange",E,Ee.setState),rt("connectOnClick",O,Ee.setState),rt("fitViewOnInit",B,Ee.setState),rt("fitViewOnInitOptions",Z,Ee.setState),rt("onNodesDelete",J,Ee.setState),rt("onEdgesDelete",I,Ee.setState),rt("onNodeDrag",X,Ee.setState),rt("onNodeDragStart",G,Ee.setState),rt("onNodeDragStop",q,Ee.setState),rt("onSelectionDrag",Y,Ee.setState),rt("onSelectionDragStart",L,Ee.setState),rt("onSelectionDragStop",K,Ee.setState),rt("noPanClassName",P,Ee.setState),rt("nodeOrigin",V,Ee.setState),rt("rfId",he,Ee.setState),rt("autoPanOnConnect",z,Ee.setState),rt("autoPanOnNodeDrag",W,Ee.setState),rt("onError",ee,Ee.setState),rt("connectionRadius",H,Ee.setState),rt("isValidConnection",ae,Ee.setState),rt("nodeDragThreshold",me,Ee.setState),Uo(e,ge),Uo(t,Re),Uo(_,ce),Uo(S,we),Uo(D,xe),Uo(k,De),null},xk={display:"none"},AP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},DT="react-flow__node-desc",qT="react-flow__edge-desc",RP="react-flow__aria-live",MP=e=>e.ariaLiveMessage;function IP({rfId:e}){const t=ht(MP);return pe.createElement("div",{id:`${RP}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:AP},t)}function $P({rfId:e,disableKeyboardA11y:t}){return pe.createElement(pe.Fragment,null,pe.createElement("div",{id:`${DT}-${e}`,style:xk},"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:`${qT}-${e}`,style:xk},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&pe.createElement(IP,{rfId:e}))}var Fl=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=x.useState(!1),a=x.useRef(!1),l=x.useRef(new Set([])),[c,d]=x.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),f=p.reduce((m,y)=>m.concat(...y),[]);return[p,f]}return[[],[]]},[e]);return x.useEffect(()=>{const h=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||h;if(e!==null){const f=v=>{if(a.current=v.ctrlKey||v.metaKey||v.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&_v(v))return!1;const _=kk(v.code,d);l.current.add(v[_]),bk(c,l.current,!1)&&(v.preventDefault(),s(!0))},m=v=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&_v(v))return!1;const _=kk(v.code,d);bk(c,l.current,!0)?(s(!1),l.current.clear()):l.current.delete(v[_]),v.key==="Meta"&&l.current.clear(),a.current=!1},y=()=>{l.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",f),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",f),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,s]),n};function bk(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 FT(e,t,n,s){var d,h;const a=e.parentNode||e.parentId;if(!a)return n;const l=t.get(a),c=Ha(l,s);return FT(l,t,{x:(n.x??0)+c.x,y:(n.y??0)+c.y,z:(((d=l[jt])==null?void 0:d.z)??0)>(n.z??0)?((h=l[jt])==null?void 0:h.z)??0:n.z??0},s)}function BT(e,t,n){e.forEach(s=>{var l;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:d,z:h}=FT(s,e,{...s.position,z:((l=s[jt])==null?void 0:l.z)??0},t);s.positionAbsolute={x:c,y:d},s[jt].z=h,n!=null&&n[s.id]&&(s[jt].isParent=!0)}})}function If(e,t,n,s){const a=new Map,l={},c=s?1e3:0;return e.forEach(d=>{var v;const h=(Gn(d.zIndex)?d.zIndex:0)+(d.selected?c:0),p=t.get(d.id),f={...d,positionAbsolute:{x:d.position.x,y:d.position.y}},m=d.parentNode||d.parentId;m&&(l[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==d.type;Object.defineProperty(f,jt,{enumerable:!1,value:{handleBounds:y||(v=p==null?void 0:p[jt])==null?void 0:v.handleBounds,z:h}}),a.set(d.id,f)}),BT(a,n,l),a}function zT(e,t={}){const{getNodes:n,width:s,height:a,minZoom:l,maxZoom:c,d3Zoom:d,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:f,nodeOrigin:m}=e(),y=t.initial&&!p&&f;if(d&&h&&(y||!t.initial)){const N=n().filter(S=>{var j;const k=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return(j=t.nodes)!=null&&j.length?k&&t.nodes.some(E=>E.id===S.id):k}),_=N.every(S=>S.width&&S.height);if(N.length>0&&_){const S=Sd(N,m),{x:k,y:j,zoom:E}=ET(S,s,a,t.minZoom??l,t.maxZoom??c,t.padding??.1),C=ds.translate(k,j).scale(E);return typeof t.duration=="number"&&t.duration>0?d.transform(Ba(h,t.duration),C):d.transform(h,C),!0}}return!1}function OP(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[jt]:s[jt],selected:n.selected})}),new Map(t)}function PP(e,t){return t.map(n=>{const s=e.find(a=>a.id===n.id);return s&&(n.selected=s.selected),n})}function Cu({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:a,edges:l,onNodesChange:c,onEdgesChange:d,hasDefaultNodes:h,hasDefaultEdges:p}=n();e!=null&&e.length&&(h&&s({nodeInternals:OP(e,a)}),c==null||c(e)),t!=null&&t.length&&(p&&s({edges:PP(t,l)}),d==null||d(t))}const Wo=()=>{},LP={zoomIn:Wo,zoomOut:Wo,zoomTo:Wo,getZoom:()=>1,setViewport:Wo,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Wo,fitBounds:Wo,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},DP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),qP=()=>{const e=It(),{d3Zoom:t,d3Selection:n}=ht(DP,qt);return x.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(Ba(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(Ba(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,l)=>t.scaleTo(Ba(n,l==null?void 0:l.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,l)=>{const[c,d,h]=e.getState().transform,p=ds.translate(a.x??c,a.y??d).scale(a.zoom??h);t.transform(Ba(n,l==null?void 0:l.duration),p)},getViewport:()=>{const[a,l,c]=e.getState().transform;return{x:a,y:l,zoom:c}},fitView:a=>zT(e.getState,a),setCenter:(a,l,c)=>{const{width:d,height:h,maxZoom:p}=e.getState(),f=typeof(c==null?void 0:c.zoom)<"u"?c.zoom:p,m=d/2-a*f,y=h/2-l*f,v=ds.translate(m,y).scale(f);t.transform(Ba(n,c==null?void 0:c.duration),v)},fitBounds:(a,l)=>{const{width:c,height:d,minZoom:h,maxZoom:p}=e.getState(),{x:f,y:m,zoom:y}=ET(a,c,d,h,p,(l==null?void 0:l.padding)??.1),v=ds.translate(f,m).scale(y);t.transform(Ba(n,l==null?void 0:l.duration),v)},project:a=>{const{transform:l,snapToGrid:c,snapGrid:d}=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,l,c,d)},screenToFlowPosition:a=>{const{transform:l,snapToGrid:c,snapGrid:d,domNode:h}=e.getState();if(!h)return a;const{x:p,y:f}=h.getBoundingClientRect(),m={x:a.x-p,y:a.y-f};return jv(m,l,c,d)},flowToScreenPosition:a=>{const{transform:l,domNode:c}=e.getState();if(!c)return a;const{x:d,y:h}=c.getBoundingClientRect(),p=NT(a,l);return{x:p.x+d,y:p.y+h}},viewportInitialized:!0}:LP,[t,n])};function Xl(){const e=qP(),t=It(),n=x.useCallback(()=>t.getState().getNodes().map(_=>({..._})),[]),s=x.useCallback(_=>t.getState().nodeInternals.get(_),[]),a=x.useCallback(()=>{const{edges:_=[]}=t.getState();return _.map(S=>({...S}))},[]),l=x.useCallback(_=>{const{edges:S=[]}=t.getState();return S.find(k=>k.id===_)},[]),c=x.useCallback(_=>{const{getNodes:S,setNodes:k,hasDefaultNodes:j,onNodesChange:E}=t.getState(),C=S(),T=typeof _=="function"?_(C):_;if(j)k(T);else if(E){const R=T.length===0?C.map(A=>({type:"remove",id:A.id})):T.map(A=>({item:A,type:"reset"}));E(R)}},[]),d=x.useCallback(_=>{const{edges:S=[],setEdges:k,hasDefaultEdges:j,onEdgesChange:E}=t.getState(),C=typeof _=="function"?_(S):_;if(j)k(C);else if(E){const T=C.length===0?S.map(R=>({type:"remove",id:R.id})):C.map(R=>({item:R,type:"reset"}));E(T)}},[]),h=x.useCallback(_=>{const S=Array.isArray(_)?_:[_],{getNodes:k,setNodes:j,hasDefaultNodes:E,onNodesChange:C}=t.getState();if(E){const R=[...k(),...S];j(R)}else if(C){const T=S.map(R=>({item:R,type:"add"}));C(T)}},[]),p=x.useCallback(_=>{const S=Array.isArray(_)?_:[_],{edges:k=[],setEdges:j,hasDefaultEdges:E,onEdgesChange:C}=t.getState();if(E)j([...k,...S]);else if(C){const T=S.map(R=>({item:R,type:"add"}));C(T)}},[]),f=x.useCallback(()=>{const{getNodes:_,edges:S=[],transform:k}=t.getState(),[j,E,C]=k;return{nodes:_().map(T=>({...T})),edges:S.map(T=>({...T})),viewport:{x:j,y:E,zoom:C}}},[]),m=x.useCallback(({nodes:_,edges:S})=>{const{nodeInternals:k,getNodes:j,edges:E,hasDefaultNodes:C,hasDefaultEdges:T,onNodesDelete:R,onEdgesDelete:A,onNodesChange:D,onEdgesChange:O}=t.getState(),$=(_||[]).map(X=>X.id),B=(S||[]).map(X=>X.id),Z=j().reduce((X,G)=>{const q=G.parentNode||G.parentId,Y=!$.includes(G.id)&&q&&X.find(K=>K.id===q);return(typeof G.deletable=="boolean"?G.deletable:!0)&&($.includes(G.id)||Y)&&X.push(G),X},[]),J=E.filter(X=>typeof X.deletable=="boolean"?X.deletable:!0),I=J.filter(X=>B.includes(X.id));if(Z||I){const X=jT(Z,J),G=[...I,...X],q=G.reduce((Y,L)=>(Y.includes(L.id)||Y.push(L.id),Y),[]);if((T||C)&&(T&&t.setState({edges:E.filter(Y=>!q.includes(Y.id))}),C&&(Z.forEach(Y=>{k.delete(Y.id)}),t.setState({nodeInternals:new Map(k)}))),q.length>0&&(A==null||A(G),O&&O(q.map(Y=>({id:Y,type:"remove"})))),Z.length>0&&(R==null||R(Z),D)){const Y=Z.map(L=>({id:L.id,type:"remove"}));D(Y)}}},[]),y=x.useCallback(_=>{const S=aP(_),k=S?null:t.getState().nodeInternals.get(_.id);return!S&&!k?[null,null,S]:[S?_:fk(k),k,S]},[]),v=x.useCallback((_,S=!0,k)=>{const[j,E,C]=y(_);return j?(k||t.getState().getNodes()).filter(T=>{if(!C&&(T.id===E.id||!T.positionAbsolute))return!1;const R=fk(T),A=kv(R,j);return S&&A>0||A>=j.width*j.height}):[]},[]),N=x.useCallback((_,S,k=!0)=>{const[j]=y(_);if(!j)return!1;const E=kv(j,S);return k&&E>0||E>=j.width*j.height},[]);return x.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:a,getEdge:l,setNodes:c,setEdges:d,addNodes:h,addEdges:p,toObject:f,deleteElements:m,getIntersectingNodes:v,isNodeIntersecting:N}),[e,n,s,a,l,c,d,h,p,f,m,v,N])}const FP={actInsideInputWithModifier:!1};var BP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=It(),{deleteElements:s}=Xl(),a=Fl(e,FP),l=Fl(t);x.useEffect(()=>{if(a){const{edges:c,getNodes:d}=n.getState(),h=d().filter(f=>f.selected),p=c.filter(f=>f.selected);s({nodes:h,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),x.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])};function zP(e){const t=It();x.useEffect(()=>{let n;const s=()=>{var l,c;if(!e.current)return;const a=ax(e.current);(a.height===0||a.width===0)&&((c=(l=t.getState()).onError)==null||c.call(l,"004",fs.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 fx={position:"absolute",width:"100%",height:"100%",top:0,left:0},UP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Tu=e=>({x:e.x,y:e.y,zoom:e.k}),Ho=(e,t)=>e.target.closest(`.${t}`),_k=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Nk=e=>{const t=e.ctrlKey&&ad()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},WP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),HP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:a=!0,zoomOnPinch:l=!0,panOnScroll:c=!1,panOnScrollSpeed:d=.5,panOnScrollMode:h=Ua.Free,zoomOnDoubleClick:p=!0,elementsSelectable:f,panOnDrag:m=!0,defaultViewport:y,translateExtent:v,minZoom:N,maxZoom:_,zoomActivationKeyCode:S,preventScrolling:k=!0,children:j,noWheelClassName:E,noPanClassName:C})=>{const T=x.useRef(),R=It(),A=x.useRef(!1),D=x.useRef(!1),O=x.useRef(null),$=x.useRef({x:0,y:0,zoom:0}),{d3Zoom:B,d3Selection:Z,d3ZoomHandler:J,userSelectionActive:I}=ht(WP,qt),X=Fl(S),G=x.useRef(0),q=x.useRef(!1),Y=x.useRef();return zP(O),x.useEffect(()=>{if(O.current){const L=O.current.getBoundingClientRect(),K=hT().scaleExtent([N,_]).translateExtent(v),P=Hn(O.current).call(K),V=ds.translate(y.x,y.y).scale(ci(y.zoom,N,_)),he=[[0,0],[L.width,L.height]],z=K.constrain()(V,he,v);K.transform(P,z),K.wheelDelta(Nk),R.setState({d3Zoom:K,d3Selection:P,d3ZoomHandler:P.on("wheel.zoom"),transform:[z.x,z.y,z.k],domNode:O.current.closest(".react-flow")})}},[]),x.useEffect(()=>{Z&&B&&(c&&!X&&!I?Z.on("wheel.zoom",L=>{if(Ho(L,E))return!1;L.preventDefault(),L.stopImmediatePropagation();const K=Z.property("__zoom").k||1;if(L.ctrlKey&&l){const ae=cr(L),me=Nk(L),ge=K*Math.pow(2,me);B.scaleTo(Z,ge,ae,L);return}const P=L.deltaMode===1?20:1;let V=h===Ua.Vertical?0:L.deltaX*P,he=h===Ua.Horizontal?0:L.deltaY*P;!ad()&&L.shiftKey&&h!==Ua.Vertical&&(V=L.deltaY*P,he=0),B.translateBy(Z,-(V/K)*d,-(he/K)*d,{internal:!0});const z=Tu(Z.property("__zoom")),{onViewportChangeStart:W,onViewportChange:ee,onViewportChangeEnd:H}=R.getState();clearTimeout(Y.current),q.current||(q.current=!0,t==null||t(L,z),W==null||W(z)),q.current&&(e==null||e(L,z),ee==null||ee(z),Y.current=setTimeout(()=>{n==null||n(L,z),H==null||H(z),q.current=!1},150))},{passive:!1}):typeof J<"u"&&Z.on("wheel.zoom",function(L,K){if(!k&&L.type==="wheel"&&!L.ctrlKey||Ho(L,E))return null;L.preventDefault(),J.call(this,L,K)},{passive:!1}))},[I,c,h,Z,B,J,X,l,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:K}=R.getState(),P=Tu(L.transform);A.current=!0,$.current=P,((he=L.sourceEvent)==null?void 0:he.type)==="mousedown"&&R.setState({paneDragging:!0}),K==null||K(P),t==null||t(L.sourceEvent,P)})},[B,t]),x.useEffect(()=>{B&&(I&&!A.current?B.on("zoom",null):I||B.on("zoom",L=>{var P;const{onViewportChange:K}=R.getState();if(R.setState({transform:[L.transform.x,L.transform.y,L.transform.k]}),D.current=!!(s&&_k(m,G.current??0)),(e||K)&&!((P=L.sourceEvent)!=null&&P.internal)){const V=Tu(L.transform);K==null||K(V),e==null||e(L.sourceEvent,V)}}))},[I,B,e,m,s]),x.useEffect(()=>{B&&B.on("end",L=>{if(!L.sourceEvent||L.sourceEvent.internal)return null;const{onViewportChangeEnd:K}=R.getState();if(A.current=!1,R.setState({paneDragging:!1}),s&&_k(m,G.current??0)&&!D.current&&s(L.sourceEvent),D.current=!1,(n||K)&&UP($.current,L.transform)){const P=Tu(L.transform);$.current=P,clearTimeout(T.current),T.current=setTimeout(()=>{K==null||K(P),n==null||n(L.sourceEvent,P)},c?150:0)}})},[B,c,m,n,s]),x.useEffect(()=>{B&&B.filter(L=>{const K=X||a,P=l&&L.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&L.button===1&&L.type==="mousedown"&&(Ho(L,"react-flow__node")||Ho(L,"react-flow__edge")))return!0;if(!m&&!K&&!c&&!p&&!l||I||!p&&L.type==="dblclick"||Ho(L,E)&&L.type==="wheel"||Ho(L,C)&&(L.type!=="wheel"||c&&L.type==="wheel"&&!X)||!l&&L.ctrlKey&&L.type==="wheel"||!K&&!c&&!P&&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})},[I,B,a,l,c,p,m,f,X]),pe.createElement("div",{className:"react-flow__renderer",ref:O,style:fx},j)},GP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function VP(){const{userSelectionActive:e,userSelectionRect:t}=ht(GP,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 Sk(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,l=t.position.y+t.height-s.height;if(a>0||l>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),l>0&&(s.style.height+=l),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 YP(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 l=e.filter(d=>d.id===a.id);if(l.length===0)return s.push(a),s;const c={...a};for(const d of l)if(d)switch(d.type){case"select":{c.selected=d.selected;break}case"position":{typeof d.position<"u"&&(c.position=d.position),typeof d.positionAbsolute<"u"&&(c.positionAbsolute=d.positionAbsolute),typeof d.dragging<"u"&&(c.dragging=d.dragging),c.expandParent&&Sk(s,c);break}case"dimensions":{typeof d.dimensions<"u"&&(c.width=d.dimensions.width,c.height=d.dimensions.height),typeof d.updateStyle<"u"&&(c.style={...c.style||{},...d.dimensions}),typeof d.resizing=="boolean"&&(c.resizing=d.resizing),c.expandParent&&Sk(s,c);break}case"remove":return s}return s.push(c),s},n)}function KP(e,t){return YP(e,t)}const Us=(e,t)=>({id:e,type:"select",selected:t});function Zo(e,t){return e.reduce((n,s)=>{const a=t.includes(s.id);return!s.selected&&a?(s.selected=!0,n.push(Us(s.id,!0))):s.selected&&!a&&(s.selected=!1,n.push(Us(s.id,!1))),n},[])}const $f=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},XP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),UT=x.memo(({isSelecting:e,selectionMode:t=ql.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:d,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:f,children:m})=>{const y=x.useRef(null),v=It(),N=x.useRef(0),_=x.useRef(0),S=x.useRef(),{userSelectionActive:k,elementsSelectable:j,dragging:E}=ht(XP,qt),C=()=>{v.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,_.current=0},T=J=>{l==null||l(J),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},R=J=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){J.preventDefault();return}c==null||c(J)},A=d?J=>d(J):void 0,D=J=>{const{resetSelectedElements:I,domNode:X}=v.getState();if(S.current=X==null?void 0:X.getBoundingClientRect(),!j||!e||J.button!==0||J.target!==y.current||!S.current)return;const{x:G,y:q}=Hs(J,S.current);I(),v.setState({userSelectionRect:{width:0,height:0,startX:G,startY:q,x:G,y:q}}),s==null||s(J)},O=J=>{const{userSelectionRect:I,nodeInternals:X,edges:G,transform:q,onNodesChange:Y,onEdgesChange:L,nodeOrigin:K,getNodes:P}=v.getState();if(!e||!S.current||!I)return;v.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Hs(J,S.current),he=I.startX??0,z=I.startY??0,W={...I,x:V.x<he?V.x:he,y:V.y<z?V.y:z,width:Math.abs(V.x-he),height:Math.abs(V.y-z)},ee=P(),H=ST(X,W,q,t===ql.Partial,!0,K),ae=jT(H,G).map(ge=>ge.id),me=H.map(ge=>ge.id);if(N.current!==me.length){N.current=me.length;const ge=Zo(ee,me);ge.length&&(Y==null||Y(ge))}if(_.current!==ae.length){_.current=ae.length;const ge=Zo(G,ae);ge.length&&(L==null||L(ge))}v.setState({userSelectionRect:W})},$=J=>{if(J.button!==0)return;const{userSelectionRect:I}=v.getState();!k&&I&&J.target===y.current&&(T==null||T(J)),v.setState({nodesSelectionActive:N.current>0}),C(),a==null||a(J)},B=J=>{k&&(v.setState({nodesSelectionActive:N.current>0}),a==null||a(J)),C()},Z=j&&(e||k);return pe.createElement("div",{className:Jt(["react-flow__pane",{dragging:E,selection:e}]),onClick:Z?void 0:$f(T,y),onContextMenu:$f(R,y),onWheel:$f(A,y),onMouseEnter:Z?void 0:h,onMouseDown:Z?D:void 0,onMouseMove:Z?O:p,onMouseUp:Z?$:void 0,onMouseLeave:Z?B:f,ref:y,style:fx},m,pe.createElement(VP,null))});UT.displayName="Pane";function WT(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:WT(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 QP(e,t,n,s){return Array.from(e.values()).filter(a=>(a.selected||a.id===s)&&(!a.parentNode||a.parentId||!WT(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var l,c;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((l=a.positionAbsolute)==null?void 0:l.x)??0),y:n.y-(((c=a.positionAbsolute)==null?void 0:c.y)??0)},delta:{x:0,y:0},extent:a.extent,parentNode:a.parentNode||a.parentId,parentId:a.parentNode||a.parentId,width:a.width,height:a.height,expandParent:a.expandParent}})}function ZP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function HT(e,t,n,s,a=[0,0],l){const c=ZP(e,e.extent||s);let d=c;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const m=n.get(h),{x:y,y:v}=Ha(m,a).positionAbsolute;d=m&&Gn(y)&&Gn(v)&&Gn(m.width)&&Gn(m.height)?[[y+e.width*a[0],v+e.height*a[1]],[y+m.width-e.width+e.width*a[0],v+m.height-e.height+e.height*a[1]]]:d}else l==null||l("005",fs.error005()),d=c;else if(e.extent&&h&&e.extent!=="parent"){const m=n.get(h),{x:y,y:v}=Ha(m,a).positionAbsolute;d=[[e.extent[0][0]+y,e.extent[0][1]+v],[e.extent[1][0]+y,e.extent[1][1]+v]]}let p={x:0,y:0};if(h){const m=n.get(h);p=Ha(m,a).positionAbsolute}const f=d&&d!=="parent"?ox(t,d):t;return{position:{x:f.x-p.x,y:f.y-p.y},positionAbsolute:f}}function Of({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 Ek=(e,t,n,s)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const l=Array.from(a),c=t.getBoundingClientRect(),d={x:c.width*s[0],y:c.height*s[1]};return l.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-c.left-d.x)/n,y:(p.top-c.top-d.y)/n,...ax(h)}})};function vl(e,t,n){return n===void 0?n:s=>{const a=t().nodeInternals.get(e);a&&n(s,{...a})}}function Cv({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:c,nodeInternals:d,onError:h}=t.getState(),p=d.get(e);if(!p){h==null||h("012",fs.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&c)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var f;return(f=s==null?void 0:s.current)==null?void 0:f.blur()})):a([e])}function JP(){const e=It();return x.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:a,snapToGrid:l}=e.getState(),c=n.touches?n.touches[0].clientX:n.clientX,d=n.touches?n.touches[0].clientY:n.clientY,h={x:(c-s[0])/s[2],y:(d-s[1])/s[2]};return{xSnapped:l?a[0]*Math.round(h.x/a[0]):h.x,ySnapped:l?a[1]*Math.round(h.y/a[1]):h.y,...h}},[])}function Pf(e){return(t,n,s)=>e==null?void 0:e(t,s)}function GT({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:a,isSelectable:l,selectNodesOnDrag:c}){const d=It(),[h,p]=x.useState(!1),f=x.useRef([]),m=x.useRef({x:null,y:null}),y=x.useRef(0),v=x.useRef(null),N=x.useRef({x:0,y:0}),_=x.useRef(null),S=x.useRef(!1),k=x.useRef(!1),j=x.useRef(!1),E=JP();return x.useEffect(()=>{if(e!=null&&e.current){const C=Hn(e.current),T=({x:D,y:O})=>{const{nodeInternals:$,onNodeDrag:B,onSelectionDrag:Z,updateNodePositions:J,nodeExtent:I,snapGrid:X,snapToGrid:G,nodeOrigin:q,onError:Y}=d.getState();m.current={x:D,y:O};let L=!1,K={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&I){const V=Sd(f.current,q);K=Dl(V)}if(f.current=f.current.map(V=>{const he={x:D-V.distance.x,y:O-V.distance.y};G&&(he.x=X[0]*Math.round(he.x/X[0]),he.y=X[1]*Math.round(he.y/X[1]));const z=[[I[0][0],I[0][1]],[I[1][0],I[1][1]]];f.current.length>1&&I&&!V.extent&&(z[0][0]=V.positionAbsolute.x-K.x+I[0][0],z[1][0]=V.positionAbsolute.x+(V.width??0)-K.x2+I[1][0],z[0][1]=V.positionAbsolute.y-K.y+I[0][1],z[1][1]=V.positionAbsolute.y+(V.height??0)-K.y2+I[1][1]);const W=HT(V,he,$,z,q,Y);return L=L||V.position.x!==W.position.x||V.position.y!==W.position.y,V.position=W.position,V.positionAbsolute=W.positionAbsolute,V}),!L)return;J(f.current,!0,!0),p(!0);const P=a?B:Pf(Z);if(P&&_.current){const[V,he]=Of({nodeId:a,dragItems:f.current,nodeInternals:$});P(_.current,V,he)}},R=()=>{if(!v.current)return;const[D,O]=pT(N.current,v.current);if(D!==0||O!==0){const{transform:$,panBy:B}=d.getState();m.current.x=(m.current.x??0)-D/$[2],m.current.y=(m.current.y??0)-O/$[2],B({x:D,y:O})&&T(m.current)}y.current=requestAnimationFrame(R)},A=D=>{var q;const{nodeInternals:O,multiSelectionActive:$,nodesDraggable:B,unselectNodesAndEdges:Z,onNodeDragStart:J,onSelectionDragStart:I}=d.getState();k.current=!0;const X=a?J:Pf(I);(!c||!l)&&!$&&a&&((q=O.get(a))!=null&&q.selected||Z()),a&&l&&c&&Cv({id:a,store:d,nodeRef:e});const G=E(D);if(m.current=G,f.current=QP(O,B,G,a),X&&f.current){const[Y,L]=Of({nodeId:a,dragItems:f.current,nodeInternals:O});X(D.sourceEvent,Y,L)}};if(t)C.on(".drag",null);else{const D=c$().on("start",O=>{const{domNode:$,nodeDragThreshold:B}=d.getState();B===0&&A(O),j.current=!1;const Z=E(O);m.current=Z,v.current=($==null?void 0:$.getBoundingClientRect())||null,N.current=Hs(O.sourceEvent,v.current)}).on("drag",O=>{var J,I;const $=E(O),{autoPanOnNodeDrag:B,nodeDragThreshold:Z}=d.getState();if(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1&&(j.current=!0),!j.current){if(!S.current&&k.current&&B&&(S.current=!0,R()),!k.current){const X=$.xSnapped-(((J=m==null?void 0:m.current)==null?void 0:J.x)??0),G=$.ySnapped-(((I=m==null?void 0:m.current)==null?void 0:I.y)??0);Math.sqrt(X*X+G*G)>Z&&A(O)}(m.current.x!==$.xSnapped||m.current.y!==$.ySnapped)&&f.current&&k.current&&(_.current=O.sourceEvent,N.current=Hs(O.sourceEvent,v.current),T($))}}).on("end",O=>{if(!(!k.current||j.current)&&(p(!1),S.current=!1,k.current=!1,cancelAnimationFrame(y.current),f.current)){const{updateNodePositions:$,nodeInternals:B,onNodeDragStop:Z,onSelectionDragStop:J}=d.getState(),I=a?Z:Pf(J);if($(f.current,!1,!1),I){const[X,G]=Of({nodeId:a,dragItems:f.current,nodeInternals:B});I(O.sourceEvent,X,G)}}}).filter(O=>{const $=O.target;return!O.button&&(!n||!jk($,`.${n}`,e))&&(!s||jk($,s,e))});return C.call(D),()=>{C.on(".drag",null)}}}},[e,t,n,s,l,d,a,c,E]),h}function VT(){const e=It();return x.useCallback(n=>{const{nodeInternals:s,nodeExtent:a,updateNodePositions:l,getNodes:c,snapToGrid:d,snapGrid:h,onError:p,nodesDraggable:f}=e.getState(),m=c().filter(j=>j.selected&&(j.draggable||f&&typeof j.draggable>"u")),y=d?h[0]:5,v=d?h[1]:5,N=n.isShiftPressed?4:1,_=n.x*y*N,S=n.y*v*N,k=m.map(j=>{if(j.positionAbsolute){const E={x:j.positionAbsolute.x+_,y:j.positionAbsolute.y+S};d&&(E.x=h[0]*Math.round(E.x/h[0]),E.y=h[1]*Math.round(E.y/h[1]));const{positionAbsolute:C,position:T}=HT(j,E,s,a,void 0,p);j.position=T,j.positionAbsolute=C}return j});l(k,!0,!1)},[])}const si={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var xl=e=>{const t=({id:n,type:s,data:a,xPos:l,yPos:c,xPosOrigin:d,yPosOrigin:h,selected:p,onClick:f,onMouseEnter:m,onMouseMove:y,onMouseLeave:v,onContextMenu:N,onDoubleClick:_,style:S,className:k,isDraggable:j,isSelectable:E,isConnectable:C,isFocusable:T,selectNodesOnDrag:R,sourcePosition:A,targetPosition:D,hidden:O,resizeObserver:$,dragHandle:B,zIndex:Z,isParent:J,noDragClassName:I,noPanClassName:X,initialized:G,disableKeyboardA11y:q,ariaLabel:Y,rfId:L,hasHandleBounds:K})=>{const P=It(),V=x.useRef(null),he=x.useRef(null),z=x.useRef(A),W=x.useRef(D),ee=x.useRef(s),H=E||j||f||m||y||v,ae=VT(),me=vl(n,P.getState,m),ge=vl(n,P.getState,y),Re=vl(n,P.getState,v),$e=vl(n,P.getState,N),ce=vl(n,P.getState,_),we=_e=>{const{nodeDragThreshold:Ee}=P.getState();if(E&&(!R||!j||Ee>0)&&Cv({id:n,store:P,nodeRef:V}),f){const Ge=P.getState().nodeInternals.get(n);Ge&&f(_e,{...Ge})}},xe=_e=>{if(!_v(_e)&&!q)if(wT.includes(_e.key)&&E){const Ee=_e.key==="Escape";Cv({id:n,store:P,unselect:Ee,nodeRef:V})}else j&&p&&Object.prototype.hasOwnProperty.call(si,_e.key)&&(P.setState({ariaLiveMessage:`Moved selected node ${_e.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~c}`}),ae({x:si[_e.key].x,y:si[_e.key].y,isShiftPressed:_e.shiftKey}))};x.useEffect(()=>()=>{he.current&&($==null||$.unobserve(he.current),he.current=null)},[]),x.useEffect(()=>{if(V.current&&!O){const _e=V.current;(!G||!K||he.current!==_e)&&(he.current&&($==null||$.unobserve(he.current)),$==null||$.observe(_e),he.current=_e)}},[O,G,K]),x.useEffect(()=>{const _e=ee.current!==s,Ee=z.current!==A,Ge=W.current!==D;V.current&&(_e||Ee||Ge)&&(_e&&(ee.current=s),Ee&&(z.current=A),Ge&&(W.current=D),P.getState().updateNodeDimensions([{id:n,nodeElement:V.current,forceUpdate:!0}]))},[n,s,A,D]);const De=GT({nodeRef:V,disabled:O||!j,noDragClassName:I,handleSelector:B,nodeId:n,isSelectable:E,selectNodesOnDrag:R});return O?null:pe.createElement("div",{className:Jt(["react-flow__node",`react-flow__node-${s}`,{[X]:j},k,{selected:p,selectable:E,parent:J,dragging:De}]),ref:V,style:{zIndex:Z,transform:`translate(${d}px,${h}px)`,pointerEvents:H?"all":"none",visibility:G?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:me,onMouseMove:ge,onMouseLeave:Re,onContextMenu:$e,onClick:we,onDoubleClick:ce,onKeyDown:T?xe:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":q?void 0:`${DT}-${L}`,"aria-label":Y},pe.createElement(hP,{value:n},pe.createElement(e,{id:n,data:a,type:s,xPos:l,yPos:c,selected:p,isConnectable:C,sourcePosition:A,targetPosition:D,dragging:De,dragHandle:B,zIndex:Z})))};return t.displayName="NodeWrapper",x.memo(t)};const e3=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Sd(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function t3({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=It(),{width:a,height:l,x:c,y:d,transformString:h,userSelectionActive:p}=ht(e3,qt),f=VT(),m=x.useRef(null);if(x.useEffect(()=>{var N;n||(N=m.current)==null||N.focus({preventScroll:!0})},[n]),GT({nodeRef:m}),p||!a||!l)return null;const y=e?N=>{const _=s.getState().getNodes().filter(S=>S.selected);e(N,_)}:void 0,v=N=>{Object.prototype.hasOwnProperty.call(si,N.key)&&f({x:si[N.key].x,y:si[N.key].y,isShiftPressed:N.shiftKey})};return pe.createElement("div",{className:Jt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:h}},pe.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:v,style:{width:a,height:l,top:d,left:c}}))}var n3=x.memo(t3);const r3=e=>e.nodesSelectionActive,YT=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,deleteKeyCode:d,onMove:h,onMoveStart:p,onMoveEnd:f,selectionKeyCode:m,selectionOnDrag:y,selectionMode:v,onSelectionStart:N,onSelectionEnd:_,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:j,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:A,panOnScrollMode:D,zoomOnDoubleClick:O,panOnDrag:$,defaultViewport:B,translateExtent:Z,minZoom:J,maxZoom:I,preventScrolling:X,onSelectionContextMenu:G,noWheelClassName:q,noPanClassName:Y,disableKeyboardA11y:L})=>{const K=ht(r3),P=Fl(m),V=Fl(k),he=V||$,z=V||R,W=P||y&&he!==!0;return BP({deleteKeyCode:d,multiSelectionKeyCode:S}),pe.createElement(HP,{onMove:h,onMoveStart:p,onMoveEnd:f,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:z,panOnScrollSpeed:A,panOnScrollMode:D,zoomOnDoubleClick:O,panOnDrag:!P&&he,defaultViewport:B,translateExtent:Z,minZoom:J,maxZoom:I,zoomActivationKeyCode:j,preventScrolling:X,noWheelClassName:q,noPanClassName:Y},pe.createElement(UT,{onSelectionStart:N,onSelectionEnd:_,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,panOnDrag:he,isSelecting:!!W,selectionMode:v},e,K&&pe.createElement(n3,{onSelectionContextMenu:G,noPanClassName:Y,disableKeyboardA11y:L})))};YT.displayName="FlowRenderer";var s3=x.memo(YT);function a3(e){return ht(x.useCallback(n=>e?ST(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function o3(e){const t={input:xl(e.input||$T),default:xl(e.default||Ev),output:xl(e.output||PT),group:xl(e.group||hx)},n={},s=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,l)=>(a[l]=xl(e[l]||Ev),a),n);return{...t,...s}}const i3=({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]},l3=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),KT=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:a,updateNodeDimensions:l,onError:c}=ht(l3,qt),d=a3(e.onlyRenderVisibleElements),h=x.useRef(),p=x.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(m=>{const y=m.map(v=>({id:v.target.getAttribute("data-id"),nodeElement:v.target,forceUpdate:!0}));l(y)});return h.current=f,f},[]);return x.useEffect(()=>()=>{var f;(f=h==null?void 0:h.current)==null||f.disconnect()},[]),pe.createElement("div",{className:"react-flow__nodes",style:fx},d.map(f=>{var T,R,A;let m=f.type||"default";e.nodeTypes[m]||(c==null||c("003",fs.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,v=!!(f.draggable||t&&typeof f.draggable>"u"),N=!!(f.selectable||a&&typeof f.selectable>"u"),_=!!(f.connectable||n&&typeof f.connectable>"u"),S=!!(f.focusable||s&&typeof f.focusable>"u"),k=e.nodeExtent?ox(f.positionAbsolute,e.nodeExtent):f.positionAbsolute,j=(k==null?void 0:k.x)??0,E=(k==null?void 0:k.y)??0,C=i3({x:j,y:E,width:f.width??0,height:f.height??0,origin:e.nodeOrigin});return pe.createElement(y,{key:f.id,id:f.id,className:f.className,style:f.style,type:m,data:f.data,sourcePosition:f.sourcePosition||Be.Bottom,targetPosition:f.targetPosition||Be.Top,hidden:f.hidden,xPos:j,yPos:E,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!f.selected,isDraggable:v,isSelectable:N,isConnectable:_,isFocusable:S,resizeObserver:p,dragHandle:f.dragHandle,zIndex:((T=f[jt])==null?void 0:T.z)??0,isParent:!!((R=f[jt])!=null&&R.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!f.width&&!!f.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!((A=f[jt])!=null&&A.handleBounds)})}))};KT.displayName="NodeRenderer";var c3=x.memo(KT);const u3=(e,t,n)=>n===Be.Left?e-t:n===Be.Right?e+t:e,d3=(e,t,n)=>n===Be.Top?e-t:n===Be.Bottom?e+t:e,Ck="react-flow__edgeupdater",Tk=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:a,onMouseEnter:l,onMouseOut:c,type:d})=>pe.createElement("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:c,className:Jt([Ck,`${Ck}-${d}`]),cx:u3(t,s,e),cy:d3(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),h3=()=>!0;var Go=e=>{const t=({id:n,className:s,type:a,data:l,onClick:c,onEdgeDoubleClick:d,selected:h,animated:p,label:f,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:N,labelBgBorderRadius:_,style:S,source:k,target:j,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:A,targetPosition:D,elementsSelectable:O,hidden:$,sourceHandleId:B,targetHandleId:Z,onContextMenu:J,onMouseEnter:I,onMouseMove:X,onMouseLeave:G,reconnectRadius:q,onReconnect:Y,onReconnectStart:L,onReconnectEnd:K,markerEnd:P,markerStart:V,rfId:he,ariaLabel:z,isFocusable:W,isReconnectable:ee,pathOptions:H,interactionWidth:ae,disableKeyboardA11y:me})=>{const ge=x.useRef(null),[Re,$e]=x.useState(!1),[ce,we]=x.useState(!1),xe=It(),De=x.useMemo(()=>`url('#${Sv(V,he)}')`,[V,he]),_e=x.useMemo(()=>`url('#${Sv(P,he)}')`,[P,he]);if($)return null;const Ee=ze=>{var Ve;const{edges:Xe,addSelectedEdges:re,unselectNodesAndEdges:Fe,multiSelectionActive:se}=xe.getState(),Ce=Xe.find(gt=>gt.id===n);Ce&&(O&&(xe.setState({nodesSelectionActive:!1}),Ce.selected&&se?(Fe({nodes:[],edges:[Ce]}),(Ve=ge.current)==null||Ve.blur()):re([n])),c&&c(ze,Ce))},Ge=wl(n,xe.getState,d),st=wl(n,xe.getState,J),Je=wl(n,xe.getState,I),Ze=wl(n,xe.getState,X),Qe=wl(n,xe.getState,G),fe=(ze,Xe)=>{if(ze.button!==0)return;const{edges:re,isValidConnection:Fe}=xe.getState(),se=Xe?j:k,Ce=(Xe?Z:B)||null,Ve=Xe?"target":"source",gt=Fe||h3,xt=Xe,Te=re.find(wt=>wt.id===n);we(!0),L==null||L(ze,Te,Ve);const tt=wt=>{we(!1),K==null||K(wt,Te,Ve)};AT({event:ze,handleId:Ce,nodeId:se,onConnect:wt=>Y==null?void 0:Y(Te,wt),isTarget:xt,getState:xe.getState,setState:xe.setState,isValidConnection:gt,edgeUpdaterType:Ve,onReconnectEnd:tt})},ye=ze=>fe(ze,!0),Se=ze=>fe(ze,!1),Pe=()=>$e(!0),et=()=>$e(!1),ft=!O&&!c,dt=ze=>{var Xe;if(!me&&wT.includes(ze.key)&&O){const{unselectNodesAndEdges:re,addSelectedEdges:Fe,edges:se}=xe.getState();ze.key==="Escape"?((Xe=ge.current)==null||Xe.blur(),re({edges:[se.find(Ve=>Ve.id===n)]})):Fe([n])}};return pe.createElement("g",{className:Jt(["react-flow__edge",`react-flow__edge-${a}`,s,{selected:h,animated:p,inactive:ft,updating:Re}]),onClick:Ee,onDoubleClick:Ge,onContextMenu:st,onMouseEnter:Je,onMouseMove:Ze,onMouseLeave:Qe,onKeyDown:W?dt:void 0,tabIndex:W?0:void 0,role:W?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":z===null?void 0:z||`Edge from ${k} to ${j}`,"aria-describedby":W?`${qT}-${he}`:void 0,ref:ge},!ce&&pe.createElement(e,{id:n,source:k,target:j,selected:h,animated:p,label:f,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:N,labelBgBorderRadius:_,data:l,style:S,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:A,targetPosition:D,sourceHandleId:B,targetHandleId:Z,markerStart:De,markerEnd:_e,pathOptions:H,interactionWidth:ae}),ee&&pe.createElement(pe.Fragment,null,(ee==="source"||ee===!0)&&pe.createElement(Tk,{position:A,centerX:E,centerY:C,radius:q,onMouseDown:ye,onMouseEnter:Pe,onMouseOut:et,type:"source"}),(ee==="target"||ee===!0)&&pe.createElement(Tk,{position:D,centerX:T,centerY:R,radius:q,onMouseDown:Se,onMouseEnter:Pe,onMouseOut:et,type:"target"})))};return t.displayName="EdgeWrapper",x.memo(t)};function f3(e){const t={default:Go(e.default||id),straight:Go(e.bezier||cx),step:Go(e.step||lx),smoothstep:Go(e.step||Nd),simplebezier:Go(e.simplebezier||ix)},n={},s=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,l)=>(a[l]=Go(e[l]||id),a),n);return{...t,...s}}function Ak(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,l=(n==null?void 0:n.width)||t.width,c=(n==null?void 0:n.height)||t.height;switch(e){case Be.Top:return{x:s+l/2,y:a};case Be.Right:return{x:s+l,y:a+c/2};case Be.Bottom:return{x:s+l/2,y:a+c};case Be.Left:return{x:s,y:a+c/2}}}function Rk(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const p3=(e,t,n,s,a,l)=>{const c=Ak(n,e,t),d=Ak(l,s,a);return{sourceX:c.x,sourceY:c.y,targetX:d.x,targetY:d.y}};function m3({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:a,targetHeight:l,width:c,height:d,transform:h}){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+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const f=Dl({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:c/h[2],height:d/h[2]}),m=Math.max(0,Math.min(f.x2,p.x2)-Math.max(f.x,p.x)),y=Math.max(0,Math.min(f.y2,p.y2)-Math.max(f.y,p.y));return Math.ceil(m*y)>0}function Mk(e){var s,a,l,c,d;const t=((s=e==null?void 0:e[jt])==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((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)<"u";return[{x:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.x)||0,y:((d=e==null?void 0:e.positionAbsolute)==null?void 0:d.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const g3=[{level:0,isMaxLevel:!0,edges:[]}];function y3(e,t,n=!1){let s=-1;const a=e.reduce((c,d)=>{var f,m;const h=Gn(d.zIndex);let p=h?d.zIndex:0;if(n){const y=t.get(d.target),v=t.get(d.source),N=d.selected||(y==null?void 0:y.selected)||(v==null?void 0:v.selected),_=Math.max(((f=v==null?void 0:v[jt])==null?void 0:f.z)||0,((m=y==null?void 0:y[jt])==null?void 0:m.z)||0,1e3);p=(h?d.zIndex:0)+(N?_:0)}return c[p]?c[p].push(d):c[p]=[d],s=p>s?p:s,c},{}),l=Object.entries(a).map(([c,d])=>{const h=+c;return{edges:d,level:h,isMaxLevel:h===s}});return l.length===0?g3:l}function w3(e,t,n){const s=ht(x.useCallback(a=>e?a.edges.filter(l=>{const c=t.get(l.source),d=t.get(l.target);return(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&(d==null?void 0:d.width)&&(d==null?void 0:d.height)&&m3({sourcePos:c.positionAbsolute||{x:0,y:0},targetPos:d.positionAbsolute||{x:0,y:0},sourceWidth:c.width,sourceHeight:c.height,targetWidth:d.width,targetHeight:d.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return y3(s,t,n)}const v3=({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"}),x3=({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"}),Ik={[od.Arrow]:v3,[od.ArrowClosed]:x3};function b3(e){const t=It();return x.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call(Ik,e)?Ik[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",fs.error009(e)),null)},[e])}const k3=({id:e,type:t,color:n,width:s=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:c,orient:d="auto-start-reverse"})=>{const h=b3(t);return h?pe.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:d,refX:"0",refY:"0"},pe.createElement(h,{color:n,strokeWidth:c})):null},_3=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const d=Sv(c,t);s.includes(d)||(a.push({id:d,color:c.color||e,...c}),s.push(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))},XT=({defaultColor:e,rfId:t})=>{const n=ht(x.useCallback(_3({defaultColor:e,rfId:t}),[e,t]),(s,a)=>!(s.length!==a.length||s.some((l,c)=>l.id!==a[c].id)));return pe.createElement("defs",null,n.map(s=>pe.createElement(k3,{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})))};XT.displayName="MarkerDefinitions";var N3=x.memo(XT);const S3=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}),QT=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:a,noPanClassName:l,onEdgeContextMenu:c,onEdgeMouseEnter:d,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:f,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:v,onReconnectEnd:N,reconnectRadius:_,children:S,disableKeyboardA11y:k})=>{const{edgesFocusable:j,edgesUpdatable:E,elementsSelectable:C,width:T,height:R,connectionMode:A,nodeInternals:D,onError:O}=ht(S3,qt),$=w3(t,D,n);return T?pe.createElement(pe.Fragment,null,$.map(({level:B,edges:Z,isMaxLevel:J})=>pe.createElement("svg",{key:B,style:{zIndex:B},width:T,height:R,className:"react-flow__edges react-flow__container"},J&&pe.createElement(N3,{defaultColor:e,rfId:s}),pe.createElement("g",null,Z.map(I=>{const[X,G,q]=Mk(D.get(I.source)),[Y,L,K]=Mk(D.get(I.target));if(!q||!K)return null;let P=I.type||"default";a[P]||(O==null||O("011",fs.error011(P)),P="default");const V=a[P]||a.default,he=A===Va.Strict?L.target:(L.target??[]).concat(L.source??[]),z=Rk(G.source,I.sourceHandle),W=Rk(he,I.targetHandle),ee=(z==null?void 0:z.position)||Be.Bottom,H=(W==null?void 0:W.position)||Be.Top,ae=!!(I.focusable||j&&typeof I.focusable>"u"),me=I.reconnectable||I.updatable,ge=typeof y<"u"&&(me||E&&typeof me>"u");if(!z||!W)return O==null||O("008",fs.error008(z,I)),null;const{sourceX:Re,sourceY:$e,targetX:ce,targetY:we}=p3(X,z,ee,Y,W,H);return pe.createElement(V,{key:I.id,id:I.id,className:Jt([I.className,l]),type:P,data:I.data,selected:!!I.selected,animated:!!I.animated,hidden:!!I.hidden,label:I.label,labelStyle:I.labelStyle,labelShowBg:I.labelShowBg,labelBgStyle:I.labelBgStyle,labelBgPadding:I.labelBgPadding,labelBgBorderRadius:I.labelBgBorderRadius,style:I.style,source:I.source,target:I.target,sourceHandleId:I.sourceHandle,targetHandleId:I.targetHandle,markerEnd:I.markerEnd,markerStart:I.markerStart,sourceX:Re,sourceY:$e,targetX:ce,targetY:we,sourcePosition:ee,targetPosition:H,elementsSelectable:C,onContextMenu:c,onMouseEnter:d,onMouseMove:h,onMouseLeave:p,onClick:f,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:v,onReconnectEnd:N,reconnectRadius:_,rfId:s,ariaLabel:I.ariaLabel,isFocusable:ae,isReconnectable:ge,pathOptions:"pathOptions"in I?I.pathOptions:void 0,interactionWidth:I.interactionWidth,disableKeyboardA11y:k})})))),S):null};QT.displayName="EdgeRenderer";var j3=x.memo(QT);const E3=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function C3({children:e}){const t=ht(E3);return pe.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function T3(e){const t=Xl(),n=x.useRef(!1);x.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const A3={[Be.Left]:Be.Right,[Be.Right]:Be.Left,[Be.Top]:Be.Bottom,[Be.Bottom]:Be.Top},ZT=({nodeId:e,handleType:t,style:n,type:s=Ws.Bezier,CustomComponent:a,connectionStatus:l})=>{var R,A,D;const{fromNode:c,handleId:d,toX:h,toY:p,connectionMode:f}=ht(x.useCallback(O=>({fromNode:O.nodeInternals.get(e),handleId:O.connectionHandleId,toX:(O.connectionPosition.x-O.transform[0])/O.transform[2],toY:(O.connectionPosition.y-O.transform[1])/O.transform[2],connectionMode:O.connectionMode}),[e]),qt),m=(R=c==null?void 0:c[jt])==null?void 0:R.handleBounds;let y=m==null?void 0:m[t];if(f===Va.Loose&&(y=y||(m==null?void 0:m[t==="source"?"target":"source"])),!c||!y)return null;const v=d?y.find(O=>O.id===d):y[0],N=v?v.x+v.width/2:(c.width??0)/2,_=v?v.y+v.height/2:c.height??0,S=(((A=c.positionAbsolute)==null?void 0:A.x)??0)+N,k=(((D=c.positionAbsolute)==null?void 0:D.y)??0)+_,j=v==null?void 0:v.position,E=j?A3[j]:null;if(!j||!E)return null;if(a)return pe.createElement(a,{connectionLineType:s,connectionLineStyle:n,fromNode:c,fromHandle:v,fromX:S,fromY:k,toX:h,toY:p,fromPosition:j,toPosition:E,connectionStatus:l});let C="";const T={sourceX:S,sourceY:k,sourcePosition:j,targetX:h,targetY:p,targetPosition:E};return s===Ws.Bezier?[C]=_T(T):s===Ws.Step?[C]=Nv({...T,borderRadius:0}):s===Ws.SmoothStep?[C]=Nv(T):s===Ws.SimpleBezier?[C]=kT(T):C=`M${S},${k} ${h},${p}`,pe.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};ZT.displayName="ConnectionLine";const R3=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function M3({containerStyle:e,style:t,type:n,component:s}){const{nodeId:a,handleType:l,nodesConnectable:c,width:d,height:h,connectionStatus:p}=ht(R3,qt);return!(a&&l&&d&&c)?null:pe.createElement("svg",{style:e,width:d,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},pe.createElement("g",{className:Jt(["react-flow__connection",p])},pe.createElement(ZT,{nodeId:a,handleType:l,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function $k(e,t){return x.useRef(null),It(),x.useMemo(()=>t(e),[e])}const JT=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:a,onInit:l,onNodeClick:c,onEdgeClick:d,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:v,onSelectionContextMenu:N,onSelectionStart:_,onSelectionEnd:S,connectionLineType:k,connectionLineStyle:j,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:T,selectionOnDrag:R,selectionMode:A,multiSelectionKeyCode:D,panActivationKeyCode:O,zoomActivationKeyCode:$,deleteKeyCode:B,onlyRenderVisibleElements:Z,elementsSelectable:J,selectNodesOnDrag:I,defaultViewport:X,translateExtent:G,minZoom:q,maxZoom:Y,preventScrolling:L,defaultMarkerColor:K,zoomOnScroll:P,zoomOnPinch:V,panOnScroll:he,panOnScrollSpeed:z,panOnScrollMode:W,zoomOnDoubleClick:ee,panOnDrag:H,onPaneClick:ae,onPaneMouseEnter:me,onPaneMouseMove:ge,onPaneMouseLeave:Re,onPaneScroll:$e,onPaneContextMenu:ce,onEdgeContextMenu:we,onEdgeMouseEnter:xe,onEdgeMouseMove:De,onEdgeMouseLeave:_e,onReconnect:Ee,onReconnectStart:Ge,onReconnectEnd:st,reconnectRadius:Je,noDragClassName:Ze,noWheelClassName:Qe,noPanClassName:fe,elevateEdgesOnSelect:ye,disableKeyboardA11y:Se,nodeOrigin:Pe,nodeExtent:et,rfId:ft})=>{const dt=$k(e,o3),ze=$k(t,f3);return T3(l),pe.createElement(s3,{onPaneClick:ae,onPaneMouseEnter:me,onPaneMouseMove:ge,onPaneMouseLeave:Re,onPaneContextMenu:ce,onPaneScroll:$e,deleteKeyCode:B,selectionKeyCode:T,selectionOnDrag:R,selectionMode:A,onSelectionStart:_,onSelectionEnd:S,multiSelectionKeyCode:D,panActivationKeyCode:O,zoomActivationKeyCode:$,elementsSelectable:J,onMove:n,onMoveStart:s,onMoveEnd:a,zoomOnScroll:P,zoomOnPinch:V,zoomOnDoubleClick:ee,panOnScroll:he,panOnScrollSpeed:z,panOnScrollMode:W,panOnDrag:H,defaultViewport:X,translateExtent:G,minZoom:q,maxZoom:Y,onSelectionContextMenu:N,preventScrolling:L,noDragClassName:Ze,noWheelClassName:Qe,noPanClassName:fe,disableKeyboardA11y:Se},pe.createElement(C3,null,pe.createElement(j3,{edgeTypes:ze,onEdgeClick:d,onEdgeDoubleClick:p,onlyRenderVisibleElements:Z,onEdgeContextMenu:we,onEdgeMouseEnter:xe,onEdgeMouseMove:De,onEdgeMouseLeave:_e,onReconnect:Ee,onReconnectStart:Ge,onReconnectEnd:st,reconnectRadius:Je,defaultMarkerColor:K,noPanClassName:fe,elevateEdgesOnSelect:!!ye,disableKeyboardA11y:Se,rfId:ft},pe.createElement(M3,{style:j,type:k,component:E,containerStyle:C})),pe.createElement("div",{className:"react-flow__edgelabel-renderer"}),pe.createElement(c3,{nodeTypes:dt,onNodeClick:c,onNodeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:v,selectNodesOnDrag:I,onlyRenderVisibleElements:Z,noPanClassName:fe,noDragClassName:Ze,disableKeyboardA11y:Se,nodeOrigin:Pe,nodeExtent:et,rfId:ft})))};JT.displayName="GraphView";var I3=x.memo(JT);const Tv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Fs={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:Tv,nodeExtent:Tv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Va.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:oP,isValidConnection:void 0},$3=()=>bM((e,t)=>({...Fs,setNodes:n=>{const{nodeInternals:s,nodeOrigin:a,elevateNodesOnSelect:l}=t();e({nodeInternals:If(n,s,a,l)})},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",l=typeof s<"u",c=a?If(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:c,edges:l?s:[],hasDefaultNodes:a,hasDefaultEdges:l})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:a,fitViewOnInit:l,fitViewOnInitDone:c,fitViewOnInitOptions:d,domNode:h,nodeOrigin:p}=t(),f=h==null?void 0:h.querySelector(".react-flow__viewport");if(!f)return;const m=window.getComputedStyle(f),{m22:y}=new window.DOMMatrixReadOnly(m.transform),v=n.reduce((_,S)=>{const k=a.get(S.id);if(k!=null&&k.hidden)a.set(k.id,{...k,[jt]:{...k[jt],handleBounds:void 0}});else if(k){const j=ax(S.nodeElement);!!(j.width&&j.height&&(k.width!==j.width||k.height!==j.height||S.forceUpdate))&&(a.set(k.id,{...k,[jt]:{...k[jt],handleBounds:{source:Ek(".source",S.nodeElement,y,p),target:Ek(".target",S.nodeElement,y,p)}},...j}),_.push({id:k.id,type:"dimensions",dimensions:j}))}return _},[]);BT(a,p);const N=c||l&&!c&&zT(t,{initial:!0,...d});e({nodeInternals:new Map(a),fitViewOnInitDone:N}),(v==null?void 0:v.length)>0&&(s==null||s(v))},updateNodePositions:(n,s=!0,a=!1)=>{const{triggerNodeChanges:l}=t(),c=n.map(d=>{const h={id:d.id,type:"position",dragging:a};return s&&(h.positionAbsolute=d.positionAbsolute,h.position=d.position),h});l(c)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:a,hasDefaultNodes:l,nodeOrigin:c,getNodes:d,elevateNodesOnSelect:h}=t();if(n!=null&&n.length){if(l){const p=KP(n,d()),f=If(p,a,c,h);e({nodeInternals:f})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:a,getNodes:l}=t();let c,d=null;s?c=n.map(h=>Us(h,!0)):(c=Zo(l(),n),d=Zo(a,[])),Cu({changedNodes:c,changedEdges:d,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:a,getNodes:l}=t();let c,d=null;s?c=n.map(h=>Us(h,!0)):(c=Zo(a,n),d=Zo(l(),[])),Cu({changedNodes:d,changedEdges:c,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:a,getNodes:l}=t(),c=n||l(),d=s||a,h=c.map(f=>(f.selected=!1,Us(f.id,!1))),p=d.map(f=>Us(f.id,!1));Cu({changedNodes:h,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(),l=s().filter(d=>d.selected).map(d=>Us(d.id,!1)),c=n.filter(d=>d.selected).map(d=>Us(d.id,!1));Cu({changedNodes:l,changedEdges:c,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(a=>{a.positionAbsolute=ox(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:a,height:l,d3Zoom:c,d3Selection:d,translateExtent:h}=t();if(!c||!d||!n.x&&!n.y)return!1;const p=ds.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),f=[[0,0],[a,l]],m=c==null?void 0:c.constrain()(p,f,h);return c.transform(d,m),s[0]!==m.x||s[1]!==m.y||s[2]!==m.k},cancelConnection:()=>e({connectionNodeId:Fs.connectionNodeId,connectionHandleId:Fs.connectionHandleId,connectionHandleType:Fs.connectionHandleType,connectionStatus:Fs.connectionStatus,connectionStartHandle:Fs.connectionStartHandle,connectionEndHandle:Fs.connectionEndHandle}),reset:()=>e({...Fs})}),Object.is),px=({children:e})=>{const t=x.useRef(null);return t.current||(t.current=$3()),pe.createElement(JO,{value:t.current},e)};px.displayName="ReactFlowProvider";const e2=({children:e})=>x.useContext(_d)?pe.createElement(pe.Fragment,null,e):pe.createElement(px,null,e);e2.displayName="ReactFlowWrapper";const O3={input:$T,default:Ev,output:PT,group:hx},P3={default:id,straight:cx,step:lx,smoothstep:Nd,simplebezier:ix},L3=[0,0],D3=[15,15],q3={x:0,y:0,zoom:1},F3={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},t2=x.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:a,nodeTypes:l=O3,edgeTypes:c=P3,onNodeClick:d,onEdgeClick:h,onInit:p,onMove:f,onMoveStart:m,onMoveEnd:y,onConnect:v,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:k,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,onNodeDragStart:A,onNodeDrag:D,onNodeDragStop:O,onNodesDelete:$,onEdgesDelete:B,onSelectionChange:Z,onSelectionDragStart:J,onSelectionDrag:I,onSelectionDragStop:X,onSelectionContextMenu:G,onSelectionStart:q,onSelectionEnd:Y,connectionMode:L=Va.Strict,connectionLineType:K=Ws.Bezier,connectionLineStyle:P,connectionLineComponent:V,connectionLineContainerStyle:he,deleteKeyCode:z="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:ee=!1,selectionMode:H=ql.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:me=ad()?"Meta":"Control",zoomActivationKeyCode:ge=ad()?"Meta":"Control",snapToGrid:Re=!1,snapGrid:$e=D3,onlyRenderVisibleElements:ce=!1,selectNodesOnDrag:we=!0,nodesDraggable:xe,nodesConnectable:De,nodesFocusable:_e,nodeOrigin:Ee=L3,edgesFocusable:Ge,edgesUpdatable:st,elementsSelectable:Je,defaultViewport:Ze=q3,minZoom:Qe=.5,maxZoom:fe=2,translateExtent:ye=Tv,preventScrolling:Se=!0,nodeExtent:Pe,defaultMarkerColor:et="#b1b1b7",zoomOnScroll:ft=!0,zoomOnPinch:dt=!0,panOnScroll:ze=!1,panOnScrollSpeed:Xe=.5,panOnScrollMode:re=Ua.Free,zoomOnDoubleClick:Fe=!0,panOnDrag:se=!0,onPaneClick:Ce,onPaneMouseEnter:Ve,onPaneMouseMove:gt,onPaneMouseLeave:xt,onPaneScroll:Te,onPaneContextMenu:tt,children:pt,onEdgeContextMenu:wt,onEdgeDoubleClick:Yt,onEdgeMouseEnter:Fr,onEdgeMouseMove:Qn,onEdgeMouseLeave:Br,onEdgeUpdate:Zn,onEdgeUpdateStart:eo,onEdgeUpdateEnd:zr,onReconnect:Xs,onReconnectStart:Ur,onReconnectEnd:Mn,reconnectRadius:Wr=10,edgeUpdaterRadius:ys=10,onNodesChange:Ft,onEdgesChange:vr,noDragClassName:Qs="nodrag",noWheelClassName:ki="nowheel",noPanClassName:to="nopan",fitView:In=!1,fitViewOptions:Zs,connectOnClick:Js=!0,attributionPosition:ea,proOptions:ta,defaultEdgeOptions:na,elevateNodesOnSelect:ra=!0,elevateEdgesOnSelect:no=!1,disableKeyboardA11y:sa=!1,autoPanOnConnect:_i=!0,autoPanOnNodeDrag:mt=!0,connectionRadius:ro=20,isValidConnection:aa,onError:Hr,style:Gr,id:Vr,nodeDragThreshold:oa,...Yr},Ot)=>{const ia=Vr||"1";return pe.createElement("div",{...Yr,style:{...Gr,...F3},ref:Ot,className:Jt(["react-flow",a]),"data-testid":"rf__wrapper",id:Vr},pe.createElement(e2,null,pe.createElement(I3,{onInit:p,onMove:f,onMoveStart:m,onMoveEnd:y,onNodeClick:d,onEdgeClick:h,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,nodeTypes:l,edgeTypes:c,connectionLineType:K,connectionLineStyle:P,connectionLineComponent:V,connectionLineContainerStyle:he,selectionKeyCode:W,selectionOnDrag:ee,selectionMode:H,deleteKeyCode:z,multiSelectionKeyCode:me,panActivationKeyCode:ae,zoomActivationKeyCode:ge,onlyRenderVisibleElements:ce,selectNodesOnDrag:we,defaultViewport:Ze,translateExtent:ye,minZoom:Qe,maxZoom:fe,preventScrolling:Se,zoomOnScroll:ft,zoomOnPinch:dt,zoomOnDoubleClick:Fe,panOnScroll:ze,panOnScrollSpeed:Xe,panOnScrollMode:re,panOnDrag:se,onPaneClick:Ce,onPaneMouseEnter:Ve,onPaneMouseMove:gt,onPaneMouseLeave:xt,onPaneScroll:Te,onPaneContextMenu:tt,onSelectionContextMenu:G,onSelectionStart:q,onSelectionEnd:Y,onEdgeContextMenu:wt,onEdgeDoubleClick:Yt,onEdgeMouseEnter:Fr,onEdgeMouseMove:Qn,onEdgeMouseLeave:Br,onReconnect:Xs??Zn,onReconnectStart:Ur??eo,onReconnectEnd:Mn??zr,reconnectRadius:Wr??ys,defaultMarkerColor:et,noDragClassName:Qs,noWheelClassName:ki,noPanClassName:to,elevateEdgesOnSelect:no,rfId:ia,disableKeyboardA11y:sa,nodeOrigin:Ee,nodeExtent:Pe}),pe.createElement(TP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:v,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:k,nodesDraggable:xe,nodesConnectable:De,nodesFocusable:_e,edgesFocusable:Ge,edgesUpdatable:st,elementsSelectable:Je,elevateNodesOnSelect:ra,minZoom:Qe,maxZoom:fe,nodeExtent:Pe,onNodesChange:Ft,onEdgesChange:vr,snapToGrid:Re,snapGrid:$e,connectionMode:L,translateExtent:ye,connectOnClick:Js,defaultEdgeOptions:na,fitView:In,fitViewOptions:Zs,onNodesDelete:$,onEdgesDelete:B,onNodeDragStart:A,onNodeDrag:D,onNodeDragStop:O,onSelectionDrag:I,onSelectionDragStart:J,onSelectionDragStop:X,noPanClassName:to,nodeOrigin:Ee,rfId:ia,autoPanOnConnect:_i,autoPanOnNodeDrag:mt,onError:Hr,connectionRadius:ro,isValidConnection:aa,nodeDragThreshold:oa}),pe.createElement(EP,{onSelectionChange:Z}),pt,pe.createElement(tP,{proOptions:ta,position:ea}),pe.createElement($P,{rfId:ia,disableKeyboardA11y:sa})))});t2.displayName="ReactFlow";const B3=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function n2(){return ht(B3,qt)}const r2=({id:e,x:t,y:n,width:s,height:a,style:l,color:c,strokeColor:d,strokeWidth:h,className:p,borderRadius:f,shapeRendering:m,onClick:y,selected:v})=>{const{background:N,backgroundColor:_}=l||{},S=c||N||_;return pe.createElement("rect",{className:Jt(["react-flow__minimap-node",{selected:v},p]),x:t,y:n,rx:f,ry:f,width:s,height:a,fill:S,stroke:d,strokeWidth:h,shapeRendering:m,onClick:y?k=>y(k,e):void 0})};r2.displayName="MiniMapNode";var z3=x.memo(r2);const U3=e=>e.nodeOrigin,W3=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Lf=e=>e instanceof Function?e:()=>e;function H3({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:l=z3,onClick:c}){const d=ht(W3,qt),h=ht(U3),p=Lf(t),f=Lf(e),m=Lf(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return pe.createElement(pe.Fragment,null,d.map(v=>{const{x:N,y:_}=Ha(v,h).positionAbsolute;return pe.createElement(l,{key:v.id,x:N,y:_,width:v.width,height:v.height,style:v.style,selected:v.selected,className:m(v),color:p(v),borderRadius:s,strokeColor:f(v),strokeWidth:a,shapeRendering:y,onClick:c,id:v.id})}))}var G3=x.memo(H3);const V3=200,Y3=150,K3=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?sP(Sd(t,e.nodeOrigin),n):n,rfId:e.rfId}},X3="react-flow__minimap-desc";function s2({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:c=2,nodeComponent:d,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:f=1,position:m="bottom-right",onClick:y,onNodeClick:v,pannable:N=!1,zoomable:_=!1,ariaLabel:S="React Flow mini map",inversePan:k=!1,zoomStep:j=10,offsetScale:E=5}){const C=It(),T=x.useRef(null),{boundingRect:R,viewBB:A,rfId:D}=ht(K3,qt),O=(e==null?void 0:e.width)??V3,$=(e==null?void 0:e.height)??Y3,B=R.width/O,Z=R.height/$,J=Math.max(B,Z),I=J*O,X=J*$,G=E*J,q=R.x-(I-R.width)/2-G,Y=R.y-(X-R.height)/2-G,L=I+G*2,K=X+G*2,P=`${X3}-${D}`,V=x.useRef(0);V.current=J,x.useEffect(()=>{if(T.current){const W=Hn(T.current),ee=me=>{const{transform:ge,d3Selection:Re,d3Zoom:$e}=C.getState();if(me.sourceEvent.type!=="wheel"||!Re||!$e)return;const ce=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*j,we=ge[2]*Math.pow(2,ce);$e.scaleTo(Re,we)},H=me=>{const{transform:ge,d3Selection:Re,d3Zoom:$e,translateExtent:ce,width:we,height:xe}=C.getState();if(me.sourceEvent.type!=="mousemove"||!Re||!$e)return;const De=V.current*Math.max(1,ge[2])*(k?-1:1),_e={x:ge[0]-me.sourceEvent.movementX*De,y:ge[1]-me.sourceEvent.movementY*De},Ee=[[0,0],[we,xe]],Ge=ds.translate(_e.x,_e.y).scale(ge[2]),st=$e.constrain()(Ge,Ee,ce);$e.transform(Re,st)},ae=hT().on("zoom",N?H:null).on("zoom.wheel",_?ee:null);return W.call(ae),()=>{W.on("zoom",null)}}},[N,_,k,j]);const he=y?W=>{const ee=cr(W);y(W,{x:ee[0],y:ee[1]})}:void 0,z=v?(W,ee)=>{const H=C.getState().nodeInternals.get(ee);v(W,H)}:void 0;return pe.createElement(sx,{position:m,style:e,className:Jt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},pe.createElement("svg",{width:O,height:$,viewBox:`${q} ${Y} ${L} ${K}`,role:"img","aria-labelledby":P,ref:T,onClick:he},S&&pe.createElement("title",{id:P},S),pe.createElement(G3,{onClick:z,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:d}),pe.createElement("path",{className:"react-flow__minimap-mask",d:`M${q-G},${Y-G}h${L+G*2}v${K+G*2}h${-L-G*2}z
|
|
57
|
-
M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:f,pointerEvents:"none"})))}s2.displayName="MiniMap";var Q3=x.memo(s2);function Z3(){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 J3(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},pe.createElement("path",{d:"M0 0h32v4.2H0z"}))}function eL(){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 tL(){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 nL(){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 Or=({children:e,className:t,...n})=>pe.createElement("button",{type:"button",className:Jt(["react-flow__controls-button",t]),...n},e);Or.displayName="ControlButton";const rL=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),a2=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:c,onFitView:d,onInteractiveChange:h,className:p,children:f,position:m="bottom-left"})=>{const y=It(),[v,N]=x.useState(!1),{isInteractive:_,minZoomReached:S,maxZoomReached:k}=ht(rL,qt),{zoomIn:j,zoomOut:E,fitView:C}=Xl();if(x.useEffect(()=>{N(!0)},[]),!v)return null;const T=()=>{j(),l==null||l()},R=()=>{E(),c==null||c()},A=()=>{C(a),d==null||d()},D=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),h==null||h(!_)};return pe.createElement(sx,{className:Jt(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},t&&pe.createElement(pe.Fragment,null,pe.createElement(Or,{onClick:T,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},pe.createElement(Z3,null)),pe.createElement(Or,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},pe.createElement(J3,null))),n&&pe.createElement(Or,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},pe.createElement(eL,null)),s&&pe.createElement(Or,{className:"react-flow__controls-interactive",onClick:D,title:"toggle interactivity","aria-label":"toggle interactivity"},_?pe.createElement(nL,null):pe.createElement(tL,null)),f)};a2.displayName="Controls";var sL=x.memo(a2),pr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(pr||(pr={}));function aL({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 oL({color:e,radius:t}){return pe.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const iL={[pr.Dots]:"#91919a",[pr.Lines]:"#eee",[pr.Cross]:"#e2e2e2"},lL={[pr.Dots]:1,[pr.Lines]:1,[pr.Cross]:6},cL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function o2({id:e,variant:t=pr.Dots,gap:n=20,size:s,lineWidth:a=1,offset:l=2,color:c,style:d,className:h}){const p=x.useRef(null),{transform:f,patternId:m}=ht(cL,qt),y=c||iL[t],v=s||lL[t],N=t===pr.Dots,_=t===pr.Cross,S=Array.isArray(n)?n:[n,n],k=[S[0]*f[2]||1,S[1]*f[2]||1],j=v*f[2],E=_?[j,j]:k,C=N?[j/l,j/l]:[E[0]/l,E[1]/l];return pe.createElement("svg",{className:Jt(["react-flow__background",h]),style:{...d,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},pe.createElement("pattern",{id:m+e,x:f[0]%k[0],y:f[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},N?pe.createElement(oL,{color:y,radius:j/l}):pe.createElement(aL,{dimensions:E,color:y,lineWidth:a})),pe.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}o2.displayName="Background";var uL=x.memo(o2);const dL=["us-gov","global","apac","us","eu","jp","au"],hL=new RegExp(`^(?:(?:${dL.join("|")})\\.)?anthropic\\.`,"i");function Ql(e){return e.replace(hL,"")}const fL=["command","cmd","file_path","path","url","pattern","notebook_path"],Ok=120,Df=e=>e.length>Ok?`${e.slice(0,Ok-1)}…`:e;function pL(e){if(typeof e=="string")return e.trim()?Df(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of fL){const s=t[n];if(typeof s=="string"&&s.trim())return Df(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(a=>typeof a=="string")){const a=s.join(" ").trim();if(a)return Df(a)}}return null}function i2(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function mx(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 mL(e){const t=mx(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 gL(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]=mL(s));return Object.keys(t).length?t:void 0}function l2(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),...mx(n)};for(const s of Object.values(n)){const a=l2(s,t+1);if(a)return a}return null}const yL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function c2(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&yL.test(Ql(n.model)))return n.model;for(const s of Object.values(n)){const a=c2(s,t+1);if(a)return a}return null}function Av(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Gs(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Pk(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Zl(e,t){return`${e}::${t}`}function ld(e){return e.agent_type??e.subagent_type??"subagent"}function Rl(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Jo(e,t,n,s){const a=t;let l=e.agents.get(a);return l||(l={id:a,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:i2()},e.agents.set(a,l),l)}function u2(e,t,n,s){const a=Zl(t,n),l=e.agents.get(a);if(!l)return null;!l.cwd&&s.cwd&&(l.cwd=s.cwd,l.cwdBasename=Gs(s.cwd));const c=ld(s);return c&&(l.label==="subagent"||!l.label)&&(l.label=c),l}function wL(e,t,n){const s=t.session_id??"unknown",a=Rl(t);if(a){const h=u2(e,s,a,t);if(h)return h}const l=e.activeSubagentStack.get(s),c=l&&l.length>0?l[l.length-1]:null;if(c){const h=e.agents.get(Zl(s,c));if(h)return!h.cwd&&t.cwd&&(h.cwd=t.cwd,h.cwdBasename=Gs(t.cwd)),h}const d=Jo(e,s,n,t.hook_event_name!=="SessionStart");return!d.cwd&&t.cwd&&(d.cwd=t.cwd,d.cwdBasename=Gs(t.cwd)),d.label==="session"&&t.cwd&&(d.label=Gs(t.cwd)??"session"),d}function vL(e,t,n,s,a){const l=Zl(t,n),c=Jo(e,t,a,!0);let d=e.agents.get(l);if(d){!d.cwd&&s.cwd&&(d.cwd=s.cwd,d.cwdBasename=Gs(s.cwd));const h=ld(s);return h&&(d.label==="subagent"||!d.label)&&(d.label=h),d}return d={id:l,sessionId:t,label:ld(s),kind:"subagent",parentId:c.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:s.cwd,cwdBasename:Gs(s.cwd),toolCount:0,childCount:0,usage:i2()},e.agents.set(l,d),c.childCount+=1,d}function xL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function bL(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 Au(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 Lk=200,kL=25;function _L(e,t){const n=t.tools;if(n.length>Lk){const s=n.splice(0,n.length-Lk);for(const a of s)e.toolIndex.get(a.id)===a&&(e.toolIndex.delete(a.id),e.toolOwner.delete(a.id))}for(let s=n.length-kL-1;s>=0;s--){const a=n[s];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function NL(e,t,n){const s=e.toolIndex.get(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 Dk=2e3;function SL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const a=e.prompts[s];if(a.at<t-Dk)return!1;if(a.text===n&&a.at<=t+Dk)return!0}return!1}function d2(e,t){for(const n of t.tools)e.toolIndex.get(n.id)===n&&e.toolIndex.delete(n.id),e.toolOwner.get(n.id)===t.id&&e.toolOwner.delete(n.id)}function Jl(e,t){return t&&(e.revision+=1),t}function jL(e,t,n,s){if(e.agents.size<=n)return!1;const a=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>s,l=[],c=new Map;for(const[p,f]of e.agents){if(f.parentId!=null){const m=c.get(f.parentId);m?m.push(p):c.set(f.parentId,[p])}a(f)&&l.push({id:p,endedAt:f.endedAt})}if(l.length===0)return!1;l.sort((p,f)=>p.endedAt-f.endedAt);let d=0;const h=p=>{const f=e.agents.get(p);f&&(d2(e,f),e.agents.delete(p),d++)};for(const p of l){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const f=(c.get(p.id)??[]).map(m=>e.agents.get(m)).filter(m=>m!=null);if(!f.some(m=>!a(m))){for(const m of f)h(m.id);h(p.id)}}return Jl(e,d>0)}function EL(e,t,n,s){const a=new Map;for(const[p,f]of e.agents){let m=a.get(f.sessionId);m||(m={ids:[],endedAt:0,live:!1,closed:!1},a.set(f.sessionId,m)),m.ids.push(p),f.kind==="root"&&f.closedAt!=null&&(m.closed=!0),f.state==="done"&&f.endedAt!=null?m.endedAt=Math.max(m.endedAt,f.endedAt):m.live=!0}const l=[...a.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>s).sort((p,f)=>p.closed===f.closed?p.endedAt-f.endedAt:p.closed?-1:1);let d=[...a.values()].filter(p=>!p.live).length-n;if(d<=0)return!1;let h=!1;for(const p of l){if(d<=0)break;for(const f of p.ids){const m=e.agents.get(f);m&&d2(e,m),e.agents.delete(f)}d--,h=!0}return Jl(e,h)}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&&e.toolIndex.has(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 Jl(e,t)}function AL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.provider==="codex")continue;const l=e.agents.get(a.sessionId),c=(l==null?void 0:l.lastEventAt)??(l==null?void 0:l.startedAt);for(const d of a.tools){const h=Math.max(d.startedAt,c??d.startedAt);d.endedAt==null&&t-h>n&&(d.endedAt=h,d.ok=!1,d.errorPreview=d.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(d.id),e.toolOwner.delete(d.id),s=!0)}}return Jl(e,s)}const qk=90*6e4;function RL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.kind!=="root")continue;const l=a.lastEventAt??a.startedAt;if(!(t-l<=n)){a.waiting&&(a.waiting=null,s=!0),a.closedAt==null&&(a.closedAt=l),a.state==="active"&&(a.state="done",a.endedAt=l,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=l,s=!0);e.activeSubagentStack.delete(a.sessionId)}}return Jl(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"]);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:pL(e.input)??""}}function LL(e,t,n,s,a){if(n!=="permission")return{kind:n,message:s,since:a};const l=$L(e,t),c={kind:n,message:s,since:a};l!=null&&l.explicitSubagentId&&(c.subagentId=l.explicitSubagentId);const d=PL(l,a);return d&&(c.tool=d),c}function DL(e,t,n){if(e.kind==="idle")return!0;const s=Rl(t);return s==null?!0:e.subagentId!=null&&Zl(n,s)===e.subagentId}function Fk(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,l=s.hook_event_name??"Unknown";if(l==="__clear")return{...Av(),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(l)){const f=e.agents.get(c);f!=null&&f.waiting&&DL(f.waiting,s,c)&&(f.waiting=null)}const d=e.agents.get(c);if(d&&a>(d.lastEventAt??0)&&(d.lastEventAt=a,d.reaped&&(d.reaped=!1,d.state="active",d.endedAt=void 0,d.closedAt=void 0)),typeof s.model_context_window=="number"&&s.model_context_window>0){const f=e.agents.get(c);f&&(f.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const f=e.agents.get(c);f&&(f.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const f=e.agents.get(c);f&&(f.context={...f.context??Pk(),currentContextTokens:s.context_tokens})}if(l==="ModelObserved"){const f=typeof s.model=="string"?s.model:null;if(f){const y=e.agents.get(c);y&&(y.model=f)}const m=s.subagentModels;if(m&&typeof m=="object")for(const[y,v]of Object.entries(m)){if(typeof v!="string")continue;const N=`${c}::${y}`,_=e.agents.get(N);_&&(_.model=v)}return e}if(l==="ContextObserved"){const f=s.context??null;if(f){const m=e.agents.get(c);if(m){const y=m.context??Pk(),v=(_,S)=>typeof f[_]=="number"?f[_]:S,N=Array.isArray(f.memoryFiles)?f.memoryFiles:Array.isArray(f.claudeMdFiles)?f.claudeMdFiles:null;m.context={msgsUser:v("msgsUser",y.msgsUser),msgsAssistant:v("msgsAssistant",y.msgsAssistant),toolUses:v("toolUses",y.toolUses),toolResults:v("toolResults",y.toolResults),systemReminders:v("systemReminders",y.systemReminders),currentContextTokens:v("currentContextTokens",y.currentContextTokens),memoryFiles:N??y.memoryFiles}}}return e}if(l==="SessionNamed"){const f=e.agents.get(c);if(f){const m=typeof s.sessionName=="string"?s.sessionName.trim():"",y=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";m&&(f.sessionName=m),y&&(f.sessionTitle=y);const v=f.sessionName??"";f.sessionTitle&&v&&f.sessionTitle.toLowerCase()===v.toLowerCase()&&(f.sessionTitle=void 0)}return e}if(l==="OutputObserved"){const f=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(!f)return e;const y=e.agents.get(c);if(!y||y.lastOutputAt!=null&&m<=y.lastOutputAt)return e;if(y.lastOutputAt=m,f!=="tool_use"){const v=(y.outputs??[]).filter(N=>m-N<qL);v.push(m),y.outputs=v.length>Bk?v.slice(-Bk):v}return e.revision+=1,e}if(l==="UsageObserved"){const f=s.usage??null;if(f){const m=e.agents.get(c);if(m){m.usage.inputTokens=Number(f.input_tokens??0),m.usage.outputTokens=Number(f.output_tokens??0),m.usage.cacheReadTokens=Number(f.cache_read_input_tokens??f.cached_input_tokens??0),m.usage.cacheCreateTokens=Number(f.cache_creation_input_tokens??f.cache_write_input_tokens??0);const y=mx(f);m.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,m.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof f.reasoning_output_tokens=="number"&&(m.usage.reasoningOutputTokens=Number(f.reasoning_output_tokens)),m.usageByModel=gL(s.usageByModel)}}return e}const h=wL(e,s,a);h.provider||(h.provider=s.provider==="codex"?"codex":"claude");const p=c2(s);switch(p&&(h.model=p),l){case"SessionStart":{const f=Jo(e,c,a,!1);f.synthetic=!1,f.state="active",f.closedAt=void 0,f.startedAt=f.startedAt||a,!f.cwd&&s.cwd&&(f.cwd=s.cwd,f.cwdBasename=Gs(s.cwd)),f.label==="session"&&s.cwd&&(f.label=Gs(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 f=Jo(e,c,a,!1);f.state="active",f.endedAt=void 0,f.closedAt=void 0,f.exitAt=void 0;const m=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";m&&!SL(f,a,m)&&(f.prompts.push({at:a,text:m}),f.firstPrompt||(f.firstPrompt=Au(m,120)));break}case"PreToolUse":{const f=s.tool_use_id?NL(e,h,s.tool_use_id):null;if(f){s.tool_name&&f.name==="?"&&(f.name=s.tool_name),f.endedAt==null&&!f.trimmed&&s.tool_input!==void 0&&(f.input=s.tool_input,f.inputPreview=Au(s.tool_input));break}const m=s.tool_use_id??`${h.id}:${h.toolCount}`,y=Rl(s),v={id:m,name:s.tool_name??"?",input:s.tool_input,inputPreview:Au(s.tool_input),agentId:h.id,explicitSubagentId:y?Zl(c,y):void 0,startedAt:a};h.tools.push(v),h.toolCount+=1,h.state="active",e.toolIndex.set(m,v),e.toolOwner.set(m,h.id),_L(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const f=s.tool_use_id;if(!f)break;let m=e.toolIndex.get(f),y=!1;if(!m)for(const N of e.agents.values()){const _=N.tools.find(S=>S.id===f);if(_){m=_,y=!0;break}}if(!m||m.outcomeApplied)break;m.outcomeApplied=!0,m.outcomeGap=void 0,m.endedAt=a,m.ok=l==="PostToolUse",m.trimmed||(m.response=s.tool_response),l==="PostToolUseFailure"?m.errorPreview=Au(s.tool_response):y&&(m.errorPreview=void 0);const v=l2(s.tool_response);v&&(m.usage=v),e.toolIndex.delete(f),e.toolOwner.delete(f);break}case"SubagentStart":{const f=Rl(s);if(!f)break;const m=vL(e,c,f,s,a);m.state="active",m.startedAt=m.startedAt||a,m.exitAt=void 0,m.endedAt=void 0;const y=ld(s);y&&(m.label=y),xL(e,c,f);break}case"SubagentStop":{const f=Rl(s);if(!f)break;const m=u2(e,c,f,s);if(!m)break;m.state="done",m.endedAt=a,bL(e,c,f);break}case"Stop":case"SessionEnd":{const f=Jo(e,c,a,!1);f.state="done",f.endedAt=a;for(const m of f.provider==="codex"?[]:f.tools)m.endedAt==null&&(m.endedAt=a,m.ok=!1,m.errorPreview=m.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"the turn ended before this call returned",e.toolIndex.delete(m.id),e.toolOwner.delete(m.id));l==="SessionEnd"&&(f.closedAt=a),e.activeSubagentStack.delete(c);break}case"Notification":{const f=ML(s.notification_type);if(!f)break;const m=Jo(e,c,a,!1),y=typeof s.message=="string"?s.message:"",v=m.waiting;m.waiting=v&&v.kind===f&&v.message===y?{...v,since:Math.min(v.since,a)}:LL(e,c,f,y,a);break}}return e}const qL=6e4,Bk=64;function gx(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[-_]5[-_.]6[-_]cyber/i,rates:{input:12.5,output:75,cacheRead:1.25,cacheWrite:0}},{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/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:6.25}},{match:/^gpt[-_]5[-_.]5[-_]pro/i,rates:{input:30,output:180,cacheRead:30,cacheWrite:0}},{match:/^gpt[-_]5[-_.]5\b/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 mi(e,t=Date.now()){if(!e)return null;const n=Ql(e);for(const s of BL)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function h2(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),l=s+a,c=t.cacheWrite1h??t.cacheWrite;return{tokens5m:l,tokens1h:n,usd5m:l*t.cacheWrite/1e6,usd1h:n*c/1e6}}function f2(e,t,n=Date.now()){if(!zL(t))return e.inputTokens;const s=mi(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 yx(e,t,n=Date.now()){const s=mi(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=f2(e,t,n)*s.input/1e6,l=e.outputTokens*s.output/1e6,c=e.cacheReadTokens*s.cacheRead/1e6,d=h2(e,s),h=d.usd5m+d.usd1h;return{input:a,output:l,cacheRead:c,cacheWrite:h,total:a+l+c+h}}const zk=2e5,UL=1e6,WL=[/\[1m\]/i,/^claude[-_]opus[-_]5\b/i,/^claude[-_]sonnet[-_]5\b/i,/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b/i,/^claude[-_]sonnet[-_]4[-_.]6\b/i,/^claude[-_](fable|mythos)[-_]5\b/i],HL=[{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 zk;const t=Ql(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 zk}function p2(e,t){return typeof e=="number"&&e>0?e:GL(t)}const Qo="not priced";function at(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 wx(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${at(s)}/min`:`${at(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,l=0,c=0,d=0;for(const m of t)n+=m.inputTokens,s+=m.outputTokens,a+=m.cacheReadTokens,l+=m.cacheCreateTokens,c+=m.cacheCreate1hTokens??0,d+=m.cacheCreate5mTokens??0;const h=(m,y)=>Math.max(0,m-y),p={inputTokens:h(e.inputTokens,n),outputTokens:h(e.outputTokens,s),cacheReadTokens:h(e.cacheReadTokens,a),cacheCreateTokens:h(e.cacheCreateTokens,l)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=h(e.cacheCreate1hTokens??0,c),p.cacheCreate5mTokens=h(e.cacheCreate5mTokens??0,d)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function ec(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(l=>({model:l,usage:t[l]})),a=YL(e.usage,s.map(l=>l.usage));if(a){const l=s.findIndex(c=>c.model===e.model);l>=0?s[l]={model:s[l].model,usage:VL(s[l].usage,a)}:s.push({model:e.model,usage:a})}return s}function An(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of ec(e)){const a=yx(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 Rv(e,t=Date.now()){let n=0;for(const s of ec(e))mi(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function m2(e){const t=[];for(const n of ec(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 g2(e){return m2(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 QL(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."}
|
|
56
|
+
*/var Hb;function fM(){if(Hb)return Sf;Hb=1;var e=Vl(),t=hM();function n(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var s=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,l=e.useRef,c=e.useEffect,d=e.useMemo,h=e.useDebugValue;return Sf.useSyncExternalStoreWithSelector=function(p,f,m,y,v){var N=l(null);if(N.current===null){var _={hasValue:!1,value:null};N.current=_}else _=N.current;N=d(function(){function k(R){if(!j){if(j=!0,E=R,R=y(R),v!==void 0&&_.hasValue){var A=_.value;if(v(A,R))return C=A}return C=R}if(A=C,s(E,R))return A;var D=y(R);return v!==void 0&&v(A,D)?(E=R,A):(E=R,C=D)}var j=!1,E,C,T=m===void 0?null:m;return[function(){return k(f())},T===null?void 0:function(){return k(T())}]},[f,m,y,v]);var S=a(p,N[0],N[1]);return c(function(){_.hasValue=!0,_.value=S},[S]),h(S),S},Sf}var Gb;function pM(){return Gb||(Gb=1,Nf.exports=fM()),Nf.exports}var mM=pM();const gM=Qv(mM),yM={},Vb=e=>{let t;const n=new Set,s=(f,m)=>{const y=typeof f=="function"?f(t):f;if(!Object.is(y,t)){const v=t;t=m??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(N=>N(t,v))}},a=()=>t,h={setState:s,getState:a,getInitialState:()=>p,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(yM?"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,h);return h},wM=e=>e?Vb(e):Vb,{useDebugValue:vM}=pe,{useSyncExternalStoreWithSelector:xM}=gM,bM=e=>e;function FC(e,t=bM,n){const s=xM(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return vM(s),s}const Yb=(e,t)=>{const n=wM(e),s=(a,l=t)=>FC(n,a,l);return Object.assign(s,n),s},kM=(e,t)=>e?Yb(e,t):Yb;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 _M={value:()=>{}};function vd(){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 Wu(n)}function Wu(e){this._=e}function NM(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}})}Wu.prototype=vd.prototype={constructor:Wu,on:function(e,t){var n=this._,s=NM(e+"",n),a,l=-1,c=s.length;if(arguments.length<2){for(;++l<c;)if((a=(e=s[l]).type)&&(a=SM(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<c;)if(a=(e=s[l]).type)n[a]=Kb(n[a],e.name,t);else if(t==null)for(a in n)n[a]=Kb(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 Wu(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),s=0,a,l;s<a;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],s=0,a=l.length;s<a;++s)l[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,l=s.length;a<l;++a)s[a].value.apply(t,n)}};function SM(e,t){for(var n=0,s=e.length,a;n<s;++n)if((a=e[n]).name===t)return a.value}function Kb(e,t,n){for(var s=0,a=e.length;s<a;++s)if(e[s].name===t){e[s]=_M,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var pv="http://www.w3.org/1999/xhtml";const Xb={svg:"http://www.w3.org/2000/svg",xhtml:pv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function xd(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Xb.hasOwnProperty(t)?{space:Xb[t],local:e}:e}function jM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===pv&&t.documentElement.namespaceURI===pv?t.createElement(e):t.createElementNS(n,e)}}function EM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function BC(e){var t=xd(e);return(t.local?EM:jM)(t)}function CM(){}function Zv(e){return e==null?CM:function(){return this.querySelector(e)}}function TM(e){typeof e!="function"&&(e=Zv(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,d=s[a]=new Array(c),h,p,f=0;f<c;++f)(h=l[f])&&(p=e.call(h,h.__data__,f,l))&&("__data__"in h&&(p.__data__=h.__data__),d[f]=p);return new Rn(s,this._parents)}function AM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function RM(){return[]}function zC(e){return e==null?RM:function(){return this.querySelectorAll(e)}}function MM(e){return function(){return AM(e.apply(this,arguments))}}function IM(e){typeof e=="function"?e=MM(e):e=zC(e);for(var t=this._groups,n=t.length,s=[],a=[],l=0;l<n;++l)for(var c=t[l],d=c.length,h,p=0;p<d;++p)(h=c[p])&&(s.push(e.call(h,h.__data__,p,c)),a.push(h));return new Rn(s,a)}function UC(e){return function(){return this.matches(e)}}function WC(e){return function(t){return t.matches(e)}}var $M=Array.prototype.find;function OM(e){return function(){return $M.call(this.children,e)}}function PM(){return this.firstElementChild}function LM(e){return this.select(e==null?PM:OM(typeof e=="function"?e:WC(e)))}var DM=Array.prototype.filter;function qM(){return Array.from(this.children)}function FM(e){return function(){return DM.call(this.children,e)}}function BM(e){return this.selectAll(e==null?qM:FM(typeof e=="function"?e:WC(e)))}function zM(e){typeof e!="function"&&(e=UC(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,d=s[a]=[],h,p=0;p<c;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&d.push(h);return new Rn(s,this._parents)}function HC(e){return new Array(e.length)}function UM(){return new Rn(this._enter||this._groups.map(HC),this._parents)}function Ju(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ju.prototype={constructor:Ju,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 WM(e){return function(){return e}}function HM(e,t,n,s,a,l){for(var c=0,d,h=t.length,p=l.length;c<p;++c)(d=t[c])?(d.__data__=l[c],s[c]=d):n[c]=new Ju(e,l[c]);for(;c<h;++c)(d=t[c])&&(a[c]=d)}function GM(e,t,n,s,a,l,c){var d,h,p=new Map,f=t.length,m=l.length,y=new Array(f),v;for(d=0;d<f;++d)(h=t[d])&&(y[d]=v=c.call(h,h.__data__,d,t)+"",p.has(v)?a[d]=h:p.set(v,h));for(d=0;d<m;++d)v=c.call(e,l[d],d,l)+"",(h=p.get(v))?(s[d]=h,h.__data__=l[d],p.delete(v)):n[d]=new Ju(e,l[d]);for(d=0;d<f;++d)(h=t[d])&&p.get(y[d])===h&&(a[d]=h)}function VM(e){return e.__data__}function YM(e,t){if(!arguments.length)return Array.from(this,VM);var n=t?GM:HM,s=this._parents,a=this._groups;typeof e!="function"&&(e=WM(e));for(var l=a.length,c=new Array(l),d=new Array(l),h=new Array(l),p=0;p<l;++p){var f=s[p],m=a[p],y=m.length,v=KM(e.call(f,f&&f.__data__,p,s)),N=v.length,_=d[p]=new Array(N),S=c[p]=new Array(N),k=h[p]=new Array(y);n(f,m,_,S,k,v,t);for(var j=0,E=0,C,T;j<N;++j)if(C=_[j]){for(j>=E&&(E=j+1);!(T=S[E])&&++E<N;);C._next=T||null}}return c=new Rn(c,s),c._enter=d,c._exit=h,c}function KM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function XM(){return new Rn(this._exit||this._groups.map(HC),this._parents)}function QM(e,t,n){var s=this.enter(),a=this,l=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?l.remove():n(l),s&&a?s.merge(a).order():a}function ZM(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,a=n.length,l=s.length,c=Math.min(a,l),d=new Array(a),h=0;h<c;++h)for(var p=n[h],f=s[h],m=p.length,y=d[h]=new Array(m),v,N=0;N<m;++N)(v=p[N]||f[N])&&(y[N]=v);for(;h<a;++h)d[h]=n[h];return new Rn(d,this._parents)}function JM(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],a=s.length-1,l=s[a],c;--a>=0;)(c=s[a])&&(l&&c.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(c,l),l=c);return this}function eI(e){e||(e=tI);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),l=0;l<s;++l){for(var c=n[l],d=c.length,h=a[l]=new Array(d),p,f=0;f<d;++f)(p=c[f])&&(h[f]=p);h.sort(t)}return new Rn(a,this._parents).order()}function tI(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function nI(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function rI(){return Array.from(this)}function sI(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,l=s.length;a<l;++a){var c=s[a];if(c)return c}return null}function aI(){let e=0;for(const t of this)++e;return e}function oI(){return!this.node()}function iI(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var a=t[n],l=0,c=a.length,d;l<c;++l)(d=a[l])&&e.call(d,d.__data__,l,a);return this}function lI(e){return function(){this.removeAttribute(e)}}function cI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function uI(e,t){return function(){this.setAttribute(e,t)}}function dI(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function hI(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function fI(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 pI(e,t){var n=xd(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?cI:lI:typeof t=="function"?n.local?fI:hI:n.local?dI:uI)(n,t))}function GC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function mI(e){return function(){this.style.removeProperty(e)}}function gI(e,t,n){return function(){this.style.setProperty(e,t,n)}}function yI(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function wI(e,t,n){return arguments.length>1?this.each((t==null?mI:typeof t=="function"?yI:gI)(e,t,n??"")):ci(this.node(),e)}function ci(e,t){return e.style.getPropertyValue(t)||GC(e).getComputedStyle(e,null).getPropertyValue(t)}function vI(e){return function(){delete this[e]}}function xI(e,t){return function(){this[e]=t}}function bI(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function kI(e,t){return arguments.length>1?this.each((t==null?vI:typeof t=="function"?bI:xI)(e,t)):this.node()[e]}function VC(e){return e.trim().split(/^|\s+/)}function Jv(e){return e.classList||new YC(e)}function YC(e){this._node=e,this._names=VC(e.getAttribute("class")||"")}YC.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 KC(e,t){for(var n=Jv(e),s=-1,a=t.length;++s<a;)n.add(t[s])}function XC(e,t){for(var n=Jv(e),s=-1,a=t.length;++s<a;)n.remove(t[s])}function _I(e){return function(){KC(this,e)}}function NI(e){return function(){XC(this,e)}}function SI(e,t){return function(){(t.apply(this,arguments)?KC:XC)(this,e)}}function jI(e,t){var n=VC(e+"");if(arguments.length<2){for(var s=Jv(this.node()),a=-1,l=n.length;++a<l;)if(!s.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?SI:t?_I:NI)(n,t))}function EI(){this.textContent=""}function CI(e){return function(){this.textContent=e}}function TI(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function AI(e){return arguments.length?this.each(e==null?EI:(typeof e=="function"?TI:CI)(e)):this.node().textContent}function RI(){this.innerHTML=""}function MI(e){return function(){this.innerHTML=e}}function II(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function $I(e){return arguments.length?this.each(e==null?RI:(typeof e=="function"?II:MI)(e)):this.node().innerHTML}function OI(){this.nextSibling&&this.parentNode.appendChild(this)}function PI(){return this.each(OI)}function LI(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function DI(){return this.each(LI)}function qI(e){var t=typeof e=="function"?e:BC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function FI(){return null}function BI(e,t){var n=typeof e=="function"?e:BC(e),s=t==null?FI:typeof t=="function"?t:Zv(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function zI(){var e=this.parentNode;e&&e.removeChild(this)}function UI(){return this.each(zI)}function WI(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function HI(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function GI(e){return this.select(e?HI:WI)}function VI(e){return arguments.length?this.property("__data__",e):this.node().__data__}function YI(e){return function(t){e.call(this,t,this.__data__)}}function KI(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 XI(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,a=t.length,l;n<a;++n)l=t[n],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++s]=l;++s?t.length=s:delete this.__on}}}function QI(e,t,n){return function(){var s=this.__on,a,l=YI(t);if(s){for(var c=0,d=s.length;c<d;++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=l,a.options=n),a.value=t;return}}this.addEventListener(e.type,l,n),a={type:e.type,name:e.name,value:t,listener:l,options:n},s?s.push(a):this.__on=[a]}}function ZI(e,t,n){var s=KI(e+""),a,l=s.length,c;if(arguments.length<2){var d=this.node().__on;if(d){for(var h=0,p=d.length,f;h<p;++h)for(a=0,f=d[h];a<l;++a)if((c=s[a]).type===f.type&&c.name===f.name)return f.value}return}for(d=t?QI:XI,a=0;a<l;++a)this.each(d(s[a],t,n));return this}function QC(e,t,n){var s=GC(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 JI(e,t){return function(){return QC(this,e,t)}}function e$(e,t){return function(){return QC(this,e,t.apply(this,arguments))}}function t$(e,t){return this.each((typeof t=="function"?e$:JI)(e,t))}function*n$(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,l=s.length,c;a<l;++a)(c=s[a])&&(yield c)}var ZC=[null];function Rn(e,t){this._groups=e,this._parents=t}function Yl(){return new Rn([[document.documentElement]],ZC)}function r$(){return this}Rn.prototype=Yl.prototype={constructor:Rn,select:TM,selectAll:IM,selectChild:LM,selectChildren:BM,filter:zM,data:YM,enter:UM,exit:XM,join:QM,merge:ZM,selection:r$,order:JM,sort:eI,call:nI,nodes:rI,node:sI,size:aI,empty:oI,each:iI,attr:pI,style:wI,property:kI,classed:jI,text:AI,html:$I,raise:PI,lower:DI,append:qI,insert:BI,remove:UI,clone:GI,datum:VI,on:ZI,dispatch:t$,[Symbol.iterator]:n$};function Hn(e){return typeof e=="string"?new Rn([[document.querySelector(e)]],[document.documentElement]):new Rn([[e]],ZC)}function s$(e){let t;for(;t=e.sourceEvent;)e=t;return e}function cr(e,t){if(e=s$(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 a$={passive:!1},$l={capture:!0,passive:!1};function Cf(e){e.stopImmediatePropagation()}function si(e){e.preventDefault(),e.stopImmediatePropagation()}function JC(e){var t=e.document.documentElement,n=Hn(e).on("dragstart.drag",si,$l);"onselectstart"in t?n.on("selectstart.drag",si,$l):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function eT(e,t){var n=e.document.documentElement,s=Hn(e).on("dragstart.drag",null);t&&(s.on("click.drag",si,$l),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 bu=e=>()=>e;function mv(e,{sourceEvent:t,subject:n,target:s,identifier:a,active:l,x:c,y:d,dx:h,dy:p,dispatch:f}){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:l,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:d,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:f}})}mv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function o$(e){return!e.ctrlKey&&!e.button}function i$(){return this.parentNode}function l$(e,t){return t??{x:e.x,y:e.y}}function c$(){return navigator.maxTouchPoints||"ontouchstart"in this}function u$(){var e=o$,t=i$,n=l$,s=c$,a={},l=vd("start","drag","end"),c=0,d,h,p,f,m=0;function y(C){C.on("mousedown.drag",v).filter(s).on("touchstart.drag",S).on("touchmove.drag",k,a$).on("touchend.drag touchcancel.drag",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(C,T){if(!(f||!e.call(this,C,T))){var R=E(this,t.call(this,C,T),C,T,"mouse");R&&(Hn(C.view).on("mousemove.drag",N,$l).on("mouseup.drag",_,$l),JC(C.view),Cf(C),p=!1,d=C.clientX,h=C.clientY,R("start",C))}}function N(C){if(si(C),!p){var T=C.clientX-d,R=C.clientY-h;p=T*T+R*R>m}a.mouse("drag",C)}function _(C){Hn(C.view).on("mousemove.drag mouseup.drag",null),eT(C.view,p),si(C),a.mouse("end",C)}function S(C,T){if(e.call(this,C,T)){var R=C.changedTouches,A=t.call(this,C,T),D=R.length,O,$;for(O=0;O<D;++O)($=E(this,A,C,T,R[O].identifier,R[O]))&&(Cf(C),$("start",C,R[O]))}}function k(C){var T=C.changedTouches,R=T.length,A,D;for(A=0;A<R;++A)(D=a[T[A].identifier])&&(si(C),D("drag",C,T[A]))}function j(C){var T=C.changedTouches,R=T.length,A,D;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),A=0;A<R;++A)(D=a[T[A].identifier])&&(Cf(C),D("end",C,T[A]))}function E(C,T,R,A,D,O){var $=l.copy(),F=cr(O||R,T),Z,J,I;if((I=n.call(C,new mv("beforestart",{sourceEvent:R,target:y,identifier:D,active:c,x:F[0],y:F[1],dx:0,dy:0,dispatch:$}),A))!=null)return Z=I.x-F[0]||0,J=I.y-F[1]||0,function X(G,q,Y){var L=F,K;switch(G){case"start":a[D]=X,K=c++;break;case"end":delete a[D],--c;case"drag":F=cr(Y||q,T),K=c;break}$.call(G,C,new mv(G,{sourceEvent:q,subject:I,target:y,identifier:D,active:K,x:F[0]+Z,y:F[1]+J,dx:F[0]-L[0],dy:F[1]-L[1],dispatch:$}),A)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:bu(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:bu(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:bu(C),y):n},y.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:bu(!!C),y):s},y.on=function(){var C=l.on.apply(l,arguments);return C===l?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function ex(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function tT(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Kl(){}var Ol=.7,ed=1/Ol,ai="\\s*([+-]?\\d+)\\s*",Pl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Pr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",d$=/^#([0-9a-f]{3,8})$/,h$=new RegExp(`^rgb\\(${ai},${ai},${ai}\\)$`),f$=new RegExp(`^rgb\\(${Pr},${Pr},${Pr}\\)$`),p$=new RegExp(`^rgba\\(${ai},${ai},${ai},${Pl}\\)$`),m$=new RegExp(`^rgba\\(${Pr},${Pr},${Pr},${Pl}\\)$`),g$=new RegExp(`^hsl\\(${Pl},${Pr},${Pr}\\)$`),y$=new RegExp(`^hsla\\(${Pl},${Pr},${Pr},${Pl}\\)$`),Qb={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};ex(Kl,Ll,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Zb,formatHex:Zb,formatHex8:w$,formatHsl:v$,formatRgb:Jb,toString:Jb});function Zb(){return this.rgb().formatHex()}function w$(){return this.rgb().formatHex8()}function v$(){return nT(this).formatHsl()}function Jb(){return this.rgb().formatRgb()}function Ll(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=d$.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ek(t):n===3?new bn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ku(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ku(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=h$.exec(e))?new bn(t[1],t[2],t[3],1):(t=f$.exec(e))?new bn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=p$.exec(e))?ku(t[1],t[2],t[3],t[4]):(t=m$.exec(e))?ku(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=g$.exec(e))?rk(t[1],t[2]/100,t[3]/100,1):(t=y$.exec(e))?rk(t[1],t[2]/100,t[3]/100,t[4]):Qb.hasOwnProperty(e)?ek(Qb[e]):e==="transparent"?new bn(NaN,NaN,NaN,0):null}function ek(e){return new bn(e>>16&255,e>>8&255,e&255,1)}function ku(e,t,n,s){return s<=0&&(e=t=n=NaN),new bn(e,t,n,s)}function x$(e){return e instanceof Kl||(e=Ll(e)),e?(e=e.rgb(),new bn(e.r,e.g,e.b,e.opacity)):new bn}function gv(e,t,n,s){return arguments.length===1?x$(e):new bn(e,t,n,s??1)}function bn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}ex(bn,gv,tT(Kl,{brighter(e){return e=e==null?ed:Math.pow(ed,e),new bn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ol:Math.pow(Ol,e),new bn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new bn(Ha(this.r),Ha(this.g),Ha(this.b),td(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:tk,formatHex:tk,formatHex8:b$,formatRgb:nk,toString:nk}));function tk(){return`#${Ua(this.r)}${Ua(this.g)}${Ua(this.b)}`}function b$(){return`#${Ua(this.r)}${Ua(this.g)}${Ua(this.b)}${Ua((isNaN(this.opacity)?1:this.opacity)*255)}`}function nk(){const e=td(this.opacity);return`${e===1?"rgb(":"rgba("}${Ha(this.r)}, ${Ha(this.g)}, ${Ha(this.b)}${e===1?")":`, ${e})`}`}function td(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ha(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ua(e){return e=Ha(e),(e<16?"0":"")+e.toString(16)}function rk(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ur(e,t,n,s)}function nT(e){if(e instanceof ur)return new ur(e.h,e.s,e.l,e.opacity);if(e instanceof Kl||(e=Ll(e)),!e)return new ur;if(e instanceof ur)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,a=Math.min(t,n,s),l=Math.max(t,n,s),c=NaN,d=l-a,h=(l+a)/2;return d?(t===l?c=(n-s)/d+(n<s)*6:n===l?c=(s-t)/d+2:c=(t-n)/d+4,d/=h<.5?l+a:2-l-a,c*=60):d=h>0&&h<1?0:c,new ur(c,d,h,e.opacity)}function k$(e,t,n,s){return arguments.length===1?nT(e):new ur(e,t,n,s??1)}function ur(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}ex(ur,k$,tT(Kl,{brighter(e){return e=e==null?ed:Math.pow(ed,e),new ur(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ol:Math.pow(Ol,e),new ur(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 bn(Tf(e>=240?e-240:e+120,a,s),Tf(e,a,s),Tf(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new ur(sk(this.h),_u(this.s),_u(this.l),td(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=td(this.opacity);return`${e===1?"hsl(":"hsla("}${sk(this.h)}, ${_u(this.s)*100}%, ${_u(this.l)*100}%${e===1?")":`, ${e})`}`}}));function sk(e){return e=(e||0)%360,e<0?e+360:e}function _u(e){return Math.max(0,Math.min(1,e||0))}function Tf(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 rT=e=>()=>e;function _$(e,t){return function(n){return e+n*t}}function N$(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 S$(e){return(e=+e)==1?sT:function(t,n){return n-t?N$(t,n,e):rT(isNaN(t)?n:t)}}function sT(e,t){var n=t-e;return n?_$(e,n):rT(isNaN(e)?t:e)}const ak=(function e(t){var n=S$(t);function s(a,l){var c=n((a=gv(a)).r,(l=gv(l)).r),d=n(a.g,l.g),h=n(a.b,l.b),p=sT(a.opacity,l.opacity);return function(f){return a.r=c(f),a.g=d(f),a.b=h(f),a.opacity=p(f),a+""}}return s.gamma=e,s})(1);function zs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var yv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Af=new RegExp(yv.source,"g");function j$(e){return function(){return e}}function E$(e){return function(t){return e(t)+""}}function C$(e,t){var n=yv.lastIndex=Af.lastIndex=0,s,a,l,c=-1,d=[],h=[];for(e=e+"",t=t+"";(s=yv.exec(e))&&(a=Af.exec(t));)(l=a.index)>n&&(l=t.slice(n,l),d[c]?d[c]+=l:d[++c]=l),(s=s[0])===(a=a[0])?d[c]?d[c]+=a:d[++c]=a:(d[++c]=null,h.push({i:c,x:zs(s,a)})),n=Af.lastIndex;return n<t.length&&(l=t.slice(n),d[c]?d[c]+=l:d[++c]=l),d.length<2?h[0]?E$(h[0].x):j$(t):(t=h.length,function(p){for(var f=0,m;f<t;++f)d[(m=h[f]).i]=m.x(p);return d.join("")})}var ok=180/Math.PI,wv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function aT(e,t,n,s,a,l){var c,d,h;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(h=e*n+t*s)&&(n-=e*h,s-=t*h),(d=Math.sqrt(n*n+s*s))&&(n/=d,s/=d,h/=d),e*s<t*n&&(e=-e,t=-t,h=-h,c=-c),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*ok,skewX:Math.atan(h)*ok,scaleX:c,scaleY:d}}var Nu;function T$(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?wv:aT(t.a,t.b,t.c,t.d,t.e,t.f)}function A$(e){return e==null||(Nu||(Nu=document.createElementNS("http://www.w3.org/2000/svg","g")),Nu.setAttribute("transform",e),!(e=Nu.transform.baseVal.consolidate()))?wv:(e=e.matrix,aT(e.a,e.b,e.c,e.d,e.e,e.f))}function oT(e,t,n,s){function a(p){return p.length?p.pop()+" ":""}function l(p,f,m,y,v,N){if(p!==m||f!==y){var _=v.push("translate(",null,t,null,n);N.push({i:_-4,x:zs(p,m)},{i:_-2,x:zs(f,y)})}else(m||y)&&v.push("translate("+m+t+y+n)}function c(p,f,m,y){p!==f?(p-f>180?f+=360:f-p>180&&(p+=360),y.push({i:m.push(a(m)+"rotate(",null,s)-2,x:zs(p,f)})):f&&m.push(a(m)+"rotate("+f+s)}function d(p,f,m,y){p!==f?y.push({i:m.push(a(m)+"skewX(",null,s)-2,x:zs(p,f)}):f&&m.push(a(m)+"skewX("+f+s)}function h(p,f,m,y,v,N){if(p!==m||f!==y){var _=v.push(a(v)+"scale(",null,",",null,")");N.push({i:_-4,x:zs(p,m)},{i:_-2,x:zs(f,y)})}else(m!==1||y!==1)&&v.push(a(v)+"scale("+m+","+y+")")}return function(p,f){var m=[],y=[];return p=e(p),f=e(f),l(p.translateX,p.translateY,f.translateX,f.translateY,m,y),c(p.rotate,f.rotate,m,y),d(p.skewX,f.skewX,m,y),h(p.scaleX,p.scaleY,f.scaleX,f.scaleY,m,y),p=f=null,function(v){for(var N=-1,_=y.length,S;++N<_;)m[(S=y[N]).i]=S.x(v);return m.join("")}}}var R$=oT(T$,"px, ","px)","deg)"),M$=oT(A$,", ",")",")"),I$=1e-12;function ik(e){return((e=Math.exp(e))+1/e)/2}function $$(e){return((e=Math.exp(e))-1/e)/2}function O$(e){return((e=Math.exp(2*e))-1)/(e+1)}const P$=(function e(t,n,s){function a(l,c){var d=l[0],h=l[1],p=l[2],f=c[0],m=c[1],y=c[2],v=f-d,N=m-h,_=v*v+N*N,S,k;if(_<I$)k=Math.log(y/p)/t,S=function(A){return[d+A*v,h+A*N,p*Math.exp(t*A*k)]};else{var j=Math.sqrt(_),E=(y*y-p*p+s*_)/(2*p*n*j),C=(y*y-p*p-s*_)/(2*y*n*j),T=Math.log(Math.sqrt(E*E+1)-E),R=Math.log(Math.sqrt(C*C+1)-C);k=(R-T)/t,S=function(A){var D=A*k,O=ik(T),$=p/(n*j)*(O*O$(t*D+T)-$$(T));return[d+$*v,h+$*N,p*O/ik(t*D+T)]}}return S.duration=k*1e3*t/Math.SQRT2,S}return a.rho=function(l){var c=Math.max(.001,+l),d=c*c,h=d*d;return e(c,d,h)},a})(Math.SQRT2,2,4);var ui=0,El=0,yl=0,iT=1e3,nd,Cl,rd=0,Va=0,bd=0,Dl=typeof performance=="object"&&performance.now?performance:Date,lT=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function tx(){return Va||(lT(L$),Va=Dl.now()+bd)}function L$(){Va=0}function sd(){this._call=this._time=this._next=null}sd.prototype=cT.prototype={constructor:sd,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?tx():+n)+(t==null?0:+t),!this._next&&Cl!==this&&(Cl?Cl._next=this:nd=this,Cl=this),this._call=e,this._time=n,vv()},stop:function(){this._call&&(this._call=null,this._time=1/0,vv())}};function cT(e,t,n){var s=new sd;return s.restart(e,t,n),s}function D$(){tx(),++ui;for(var e=nd,t;e;)(t=Va-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ui}function lk(){Va=(rd=Dl.now())+bd,ui=El=0;try{D$()}finally{ui=0,F$(),Va=0}}function q$(){var e=Dl.now(),t=e-rd;t>iT&&(bd-=t,rd=e)}function F$(){for(var e,t=nd,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:nd=n);Cl=e,vv(s)}function vv(e){if(!ui){El&&(El=clearTimeout(El));var t=e-Va;t>24?(e<1/0&&(El=setTimeout(lk,e-Dl.now()-bd)),yl&&(yl=clearInterval(yl))):(yl||(rd=Dl.now(),yl=setInterval(q$,iT)),ui=1,lT(lk))}}function ck(e,t,n){var s=new sd;return t=t==null?0:+t,s.restart(a=>{s.stop(),e(a+t)},t,n),s}var B$=vd("start","end","cancel","interrupt"),z$=[],uT=0,uk=1,xv=2,Hu=3,dk=4,bv=5,Gu=6;function kd(e,t,n,s,a,l){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;U$(e,n,{name:t,index:s,group:a,on:B$,tween:z$,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:uT})}function nx(e,t){var n=yr(e,t);if(n.state>uT)throw new Error("too late; already scheduled");return n}function Dr(e,t){var n=yr(e,t);if(n.state>Hu)throw new Error("too late; already running");return n}function yr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function U$(e,t,n){var s=e.__transition,a;s[t]=n,n.timer=cT(l,0,n.time);function l(p){n.state=uk,n.timer.restart(c,n.delay,n.time),n.delay<=p&&c(p-n.delay)}function c(p){var f,m,y,v;if(n.state!==uk)return h();for(f in s)if(v=s[f],v.name===n.name){if(v.state===Hu)return ck(c);v.state===dk?(v.state=Gu,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete s[f]):+f<t&&(v.state=Gu,v.timer.stop(),v.on.call("cancel",e,e.__data__,v.index,v.group),delete s[f])}if(ck(function(){n.state===Hu&&(n.state=dk,n.timer.restart(d,n.delay,n.time),d(p))}),n.state=xv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===xv){for(n.state=Hu,a=new Array(y=n.tween.length),f=0,m=-1;f<y;++f)(v=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(a[++m]=v);a.length=m+1}}function d(p){for(var f=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(h),n.state=bv,1),m=-1,y=a.length;++m<y;)a[m].call(e,f);n.state===bv&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=Gu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function Vu(e,t){var n=e.__transition,s,a,l=!0,c;if(n){t=t==null?null:t+"";for(c in n){if((s=n[c]).name!==t){l=!1;continue}a=s.state>xv&&s.state<bv,s.state=Gu,s.timer.stop(),s.on.call(a?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[c]}l&&delete e.__transition}}function W$(e){return this.each(function(){Vu(this,e)})}function H$(e,t){var n,s;return function(){var a=Dr(this,e),l=a.tween;if(l!==n){s=n=l;for(var c=0,d=s.length;c<d;++c)if(s[c].name===t){s=s.slice(),s.splice(c,1);break}}a.tween=s}}function G$(e,t,n){var s,a;if(typeof n!="function")throw new Error;return function(){var l=Dr(this,e),c=l.tween;if(c!==s){a=(s=c).slice();for(var d={name:t,value:n},h=0,p=a.length;h<p;++h)if(a[h].name===t){a[h]=d;break}h===p&&a.push(d)}l.tween=a}}function V$(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=yr(this.node(),n).tween,a=0,l=s.length,c;a<l;++a)if((c=s[a]).name===e)return c.value;return null}return this.each((t==null?H$:G$)(n,e,t))}function rx(e,t,n){var s=e._id;return e.each(function(){var a=Dr(this,s);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return yr(a,s).value[t]}}function dT(e,t){var n;return(typeof t=="number"?zs:t instanceof Ll?ak:(n=Ll(t))?(t=n,ak):C$)(e,t)}function Y$(e){return function(){this.removeAttribute(e)}}function K$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function X$(e,t,n){var s,a=n+"",l;return function(){var c=this.getAttribute(e);return c===a?null:c===s?l:l=t(s=c,n)}}function Q$(e,t,n){var s,a=n+"",l;return function(){var c=this.getAttributeNS(e.space,e.local);return c===a?null:c===s?l:l=t(s=c,n)}}function Z$(e,t,n){var s,a,l;return function(){var c,d=n(this),h;return d==null?void this.removeAttribute(e):(c=this.getAttribute(e),h=d+"",c===h?null:c===s&&h===a?l:(a=h,l=t(s=c,d)))}}function J$(e,t,n){var s,a,l;return function(){var c,d=n(this),h;return d==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),h=d+"",c===h?null:c===s&&h===a?l:(a=h,l=t(s=c,d)))}}function eO(e,t){var n=xd(e),s=n==="transform"?M$:dT;return this.attrTween(e,typeof t=="function"?(n.local?J$:Z$)(n,s,rx(this,"attr."+e,t)):t==null?(n.local?K$:Y$)(n):(n.local?Q$:X$)(n,s,t))}function tO(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function nO(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function rO(e,t){var n,s;function a(){var l=t.apply(this,arguments);return l!==s&&(n=(s=l)&&nO(e,l)),n}return a._value=t,a}function sO(e,t){var n,s;function a(){var l=t.apply(this,arguments);return l!==s&&(n=(s=l)&&tO(e,l)),n}return a._value=t,a}function aO(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=xd(e);return this.tween(n,(s.local?rO:sO)(s,t))}function oO(e,t){return function(){nx(this,e).delay=+t.apply(this,arguments)}}function iO(e,t){return t=+t,function(){nx(this,e).delay=t}}function lO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?oO:iO)(t,e)):yr(this.node(),t).delay}function cO(e,t){return function(){Dr(this,e).duration=+t.apply(this,arguments)}}function uO(e,t){return t=+t,function(){Dr(this,e).duration=t}}function dO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?cO:uO)(t,e)):yr(this.node(),t).duration}function hO(e,t){if(typeof t!="function")throw new Error;return function(){Dr(this,e).ease=t}}function fO(e){var t=this._id;return arguments.length?this.each(hO(t,e)):yr(this.node(),t).ease}function pO(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Dr(this,e).ease=n}}function mO(e){if(typeof e!="function")throw new Error;return this.each(pO(this._id,e))}function gO(e){typeof e!="function"&&(e=UC(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,d=s[a]=[],h,p=0;p<c;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&d.push(h);return new hs(s,this._parents,this._name,this._id)}function yO(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,a=n.length,l=Math.min(s,a),c=new Array(s),d=0;d<l;++d)for(var h=t[d],p=n[d],f=h.length,m=c[d]=new Array(f),y,v=0;v<f;++v)(y=h[v]||p[v])&&(m[v]=y);for(;d<s;++d)c[d]=t[d];return new hs(c,this._parents,this._name,this._id)}function wO(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 vO(e,t,n){var s,a,l=wO(t)?nx:Dr;return function(){var c=l(this,e),d=c.on;d!==s&&(a=(s=d).copy()).on(t,n),c.on=a}}function xO(e,t){var n=this._id;return arguments.length<2?yr(this.node(),n).on.on(e):this.each(vO(n,e,t))}function bO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function kO(){return this.on("end.remove",bO(this._id))}function _O(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Zv(e));for(var s=this._groups,a=s.length,l=new Array(a),c=0;c<a;++c)for(var d=s[c],h=d.length,p=l[c]=new Array(h),f,m,y=0;y<h;++y)(f=d[y])&&(m=e.call(f,f.__data__,y,d))&&("__data__"in f&&(m.__data__=f.__data__),p[y]=m,kd(p[y],t,n,y,p,yr(f,n)));return new hs(l,this._parents,t,n)}function NO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zC(e));for(var s=this._groups,a=s.length,l=[],c=[],d=0;d<a;++d)for(var h=s[d],p=h.length,f,m=0;m<p;++m)if(f=h[m]){for(var y=e.call(f,f.__data__,m,h),v,N=yr(f,n),_=0,S=y.length;_<S;++_)(v=y[_])&&kd(v,t,n,_,y,N);l.push(y),c.push(f)}return new hs(l,c,t,n)}var SO=Yl.prototype.constructor;function jO(){return new SO(this._groups,this._parents)}function EO(e,t){var n,s,a;return function(){var l=ci(this,e),c=(this.style.removeProperty(e),ci(this,e));return l===c?null:l===n&&c===s?a:a=t(n=l,s=c)}}function hT(e){return function(){this.style.removeProperty(e)}}function CO(e,t,n){var s,a=n+"",l;return function(){var c=ci(this,e);return c===a?null:c===s?l:l=t(s=c,n)}}function TO(e,t,n){var s,a,l;return function(){var c=ci(this,e),d=n(this),h=d+"";return d==null&&(h=d=(this.style.removeProperty(e),ci(this,e))),c===h?null:c===s&&h===a?l:(a=h,l=t(s=c,d))}}function AO(e,t){var n,s,a,l="style."+t,c="end."+l,d;return function(){var h=Dr(this,e),p=h.on,f=h.value[l]==null?d||(d=hT(t)):void 0;(p!==n||a!==f)&&(s=(n=p).copy()).on(c,a=f),h.on=s}}function RO(e,t,n){var s=(e+="")=="transform"?R$:dT;return t==null?this.styleTween(e,EO(e,s)).on("end.style."+e,hT(e)):typeof t=="function"?this.styleTween(e,TO(e,s,rx(this,"style."+e,t))).each(AO(this._id,e)):this.styleTween(e,CO(e,s,t),n).on("end.style."+e,null)}function MO(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function IO(e,t,n){var s,a;function l(){var c=t.apply(this,arguments);return c!==a&&(s=(a=c)&&MO(e,c,n)),s}return l._value=t,l}function $O(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,IO(e,t,n??""))}function OO(e){return function(){this.textContent=e}}function PO(e){return function(){var t=e(this);this.textContent=t??""}}function LO(e){return this.tween("text",typeof e=="function"?PO(rx(this,"text",e)):OO(e==null?"":e+""))}function DO(e){return function(t){this.textContent=e.call(this,t)}}function qO(e){var t,n;function s(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&DO(a)),t}return s._value=e,s}function FO(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,qO(e))}function BO(){for(var e=this._name,t=this._id,n=fT(),s=this._groups,a=s.length,l=0;l<a;++l)for(var c=s[l],d=c.length,h,p=0;p<d;++p)if(h=c[p]){var f=yr(h,t);kd(h,e,n,p,c,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new hs(s,this._parents,e,n)}function zO(){var e,t,n=this,s=n._id,a=n.size();return new Promise(function(l,c){var d={value:c},h={value:function(){--a===0&&l()}};n.each(function(){var p=Dr(this,s),f=p.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(d),t._.interrupt.push(d),t._.end.push(h)),p.on=t}),a===0&&l()})}var UO=0;function hs(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function fT(){return++UO}var cs=Yl.prototype;hs.prototype={constructor:hs,select:_O,selectAll:NO,selectChild:cs.selectChild,selectChildren:cs.selectChildren,filter:gO,merge:yO,selection:jO,transition:BO,call:cs.call,nodes:cs.nodes,node:cs.node,size:cs.size,empty:cs.empty,each:cs.each,on:xO,attr:eO,attrTween:aO,style:RO,styleTween:$O,text:LO,textTween:FO,remove:kO,tween:V$,delay:lO,duration:dO,ease:fO,easeVarying:mO,end:zO,[Symbol.iterator]:cs[Symbol.iterator]};function WO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var HO={time:null,delay:0,duration:250,ease:WO};function GO(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 VO(e){var t,n;e instanceof hs?(t=e._id,e=e._name):(t=fT(),(n=HO).time=tx(),e=e==null?null:e+"");for(var s=this._groups,a=s.length,l=0;l<a;++l)for(var c=s[l],d=c.length,h,p=0;p<d;++p)(h=c[p])&&kd(h,e,t,p,c,n||GO(h,t));return new hs(s,this._parents,e,t)}Yl.prototype.interrupt=W$;Yl.prototype.transition=VO;const Su=e=>()=>e;function YO(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 us(e,t,n){this.k=e,this.x=t,this.y=n}us.prototype={constructor:us,scale:function(e){return e===1?this:new us(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new us(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ds=new us(1,0,0);us.prototype;function Rf(e){e.stopImmediatePropagation()}function wl(e){e.preventDefault(),e.stopImmediatePropagation()}function KO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function XO(){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 hk(){return this.__zoom||ds}function QO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ZO(){return navigator.maxTouchPoints||"ontouchstart"in this}function JO(e,t,n){var s=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a),c>l?(l+c)/2:Math.min(0,l)||Math.max(0,c))}function pT(){var e=KO,t=XO,n=JO,s=QO,a=ZO,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,h=P$,p=vd("start","zoom","end"),f,m,y,v=500,N=150,_=0,S=10;function k(I){I.property("__zoom",hk).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",$).filter(a).on("touchstart.zoom",F).on("touchmove.zoom",Z).on("touchend.zoom touchcancel.zoom",J).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(I,X,G,q){var Y=I.selection?I.selection():I;Y.property("__zoom",hk),I!==Y?T(I,X,G,q):Y.interrupt().each(function(){R(this,arguments).event(q).start().zoom(null,typeof X=="function"?X.apply(this,arguments):X).end()})},k.scaleBy=function(I,X,G,q){k.scaleTo(I,function(){var Y=this.__zoom.k,L=typeof X=="function"?X.apply(this,arguments):X;return Y*L},G,q)},k.scaleTo=function(I,X,G,q){k.transform(I,function(){var Y=t.apply(this,arguments),L=this.__zoom,K=G==null?C(Y):typeof G=="function"?G.apply(this,arguments):G,P=L.invert(K),V=typeof X=="function"?X.apply(this,arguments):X;return n(E(j(L,V),K,P),Y,c)},G,q)},k.translateBy=function(I,X,G,q){k.transform(I,function(){return n(this.__zoom.translate(typeof X=="function"?X.apply(this,arguments):X,typeof G=="function"?G.apply(this,arguments):G),t.apply(this,arguments),c)},null,q)},k.translateTo=function(I,X,G,q,Y){k.transform(I,function(){var L=t.apply(this,arguments),K=this.__zoom,P=q==null?C(L):typeof q=="function"?q.apply(this,arguments):q;return n(ds.translate(P[0],P[1]).scale(K.k).translate(typeof X=="function"?-X.apply(this,arguments):-X,typeof G=="function"?-G.apply(this,arguments):-G),L,c)},q,Y)};function j(I,X){return X=Math.max(l[0],Math.min(l[1],X)),X===I.k?I:new us(X,I.x,I.y)}function E(I,X,G){var q=X[0]-G[0]*I.k,Y=X[1]-G[1]*I.k;return q===I.x&&Y===I.y?I:new us(I.k,q,Y)}function C(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function T(I,X,G,q){I.on("start.zoom",function(){R(this,arguments).event(q).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(q).end()}).tween("zoom",function(){var Y=this,L=arguments,K=R(Y,L).event(q),P=t.apply(Y,L),V=G==null?C(P):typeof G=="function"?G.apply(Y,L):G,he=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),U=Y.__zoom,W=typeof X=="function"?X.apply(Y,L):X,ee=h(U.invert(V).concat(he/U.k),W.invert(V).concat(he/W.k));return function(H){if(H===1)H=W;else{var ae=ee(H),me=he/ae[2];H=new us(me,V[0]-ae[0]*me,V[1]-ae[1]*me)}K.zoom(null,H)}})}function R(I,X,G){return!G&&I.__zooming||new A(I,X)}function A(I,X){this.that=I,this.args=X,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,X),this.taps=0}A.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,X){return this.mouse&&I!=="mouse"&&(this.mouse[1]=X.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=X.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=X.invert(this.touch1[0])),this.that.__zoom=X,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var X=Hn(this.that).datum();p.call(I,this.that,new YO(I,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:p}),X)}};function D(I,...X){if(!e.apply(this,arguments))return;var G=R(this,X).event(I),q=this.__zoom,Y=Math.max(l[0],Math.min(l[1],q.k*Math.pow(2,s.apply(this,arguments)))),L=cr(I);if(G.wheel)(G.mouse[0][0]!==L[0]||G.mouse[0][1]!==L[1])&&(G.mouse[1]=q.invert(G.mouse[0]=L)),clearTimeout(G.wheel);else{if(q.k===Y)return;G.mouse=[L,q.invert(L)],Vu(this),G.start()}wl(I),G.wheel=setTimeout(K,N),G.zoom("mouse",n(E(j(q,Y),G.mouse[0],G.mouse[1]),G.extent,c));function K(){G.wheel=null,G.end()}}function O(I,...X){if(y||!e.apply(this,arguments))return;var G=I.currentTarget,q=R(this,X,!0).event(I),Y=Hn(I.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",he,!0),L=cr(I,G),K=I.clientX,P=I.clientY;JC(I.view),Rf(I),q.mouse=[L,this.__zoom.invert(L)],Vu(this),q.start();function V(U){if(wl(U),!q.moved){var W=U.clientX-K,ee=U.clientY-P;q.moved=W*W+ee*ee>_}q.event(U).zoom("mouse",n(E(q.that.__zoom,q.mouse[0]=cr(U,G),q.mouse[1]),q.extent,c))}function he(U){Y.on("mousemove.zoom mouseup.zoom",null),eT(U.view,q.moved),wl(U),q.event(U).end()}}function $(I,...X){if(e.apply(this,arguments)){var G=this.__zoom,q=cr(I.changedTouches?I.changedTouches[0]:I,this),Y=G.invert(q),L=G.k*(I.shiftKey?.5:2),K=n(E(j(G,L),q,Y),t.apply(this,X),c);wl(I),d>0?Hn(this).transition().duration(d).call(T,K,q,I):Hn(this).call(k.transform,K,q,I)}}function F(I,...X){if(e.apply(this,arguments)){var G=I.touches,q=G.length,Y=R(this,X,I.changedTouches.length===q).event(I),L,K,P,V;for(Rf(I),K=0;K<q;++K)P=G[K],V=cr(P,this),V=[V,this.__zoom.invert(V),P.identifier],Y.touch0?!Y.touch1&&Y.touch0[2]!==V[2]&&(Y.touch1=V,Y.taps=0):(Y.touch0=V,L=!0,Y.taps=1+!!f);f&&(f=clearTimeout(f)),L&&(Y.taps<2&&(m=V[0],f=setTimeout(function(){f=null},v)),Vu(this),Y.start())}}function Z(I,...X){if(this.__zooming){var G=R(this,X).event(I),q=I.changedTouches,Y=q.length,L,K,P,V;for(wl(I),L=0;L<Y;++L)K=q[L],P=cr(K,this),G.touch0&&G.touch0[2]===K.identifier?G.touch0[0]=P:G.touch1&&G.touch1[2]===K.identifier&&(G.touch1[0]=P);if(K=G.that.__zoom,G.touch1){var he=G.touch0[0],U=G.touch0[1],W=G.touch1[0],ee=G.touch1[1],H=(H=W[0]-he[0])*H+(H=W[1]-he[1])*H,ae=(ae=ee[0]-U[0])*ae+(ae=ee[1]-U[1])*ae;K=j(K,Math.sqrt(H/ae)),P=[(he[0]+W[0])/2,(he[1]+W[1])/2],V=[(U[0]+ee[0])/2,(U[1]+ee[1])/2]}else if(G.touch0)P=G.touch0[0],V=G.touch0[1];else return;G.zoom("touch",n(E(K,P,V),G.extent,c))}}function J(I,...X){if(this.__zooming){var G=R(this,X).event(I),q=I.changedTouches,Y=q.length,L,K;for(Rf(I),y&&clearTimeout(y),y=setTimeout(function(){y=null},v),L=0;L<Y;++L)K=q[L],G.touch0&&G.touch0[2]===K.identifier?delete G.touch0:G.touch1&&G.touch1[2]===K.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&&(K=cr(K,this),Math.hypot(m[0]-K[0],m[1]-K[1])<S)){var P=Hn(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return k.wheelDelta=function(I){return arguments.length?(s=typeof I=="function"?I:Su(+I),k):s},k.filter=function(I){return arguments.length?(e=typeof I=="function"?I:Su(!!I),k):e},k.touchable=function(I){return arguments.length?(a=typeof I=="function"?I:Su(!!I),k):a},k.extent=function(I){return arguments.length?(t=typeof I=="function"?I:Su([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),k):t},k.scaleExtent=function(I){return arguments.length?(l[0]=+I[0],l[1]=+I[1],k):[l[0],l[1]]},k.translateExtent=function(I){return arguments.length?(c[0][0]=+I[0][0],c[1][0]=+I[1][0],c[0][1]=+I[0][1],c[1][1]=+I[1][1],k):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},k.constrain=function(I){return arguments.length?(n=I,k):n},k.duration=function(I){return arguments.length?(d=+I,k):d},k.interpolate=function(I){return arguments.length?(h=I,k):h},k.on=function(){var I=p.on.apply(p,arguments);return I===p?k:I},k.clickDistance=function(I){return arguments.length?(_=(I=+I)*I,k):Math.sqrt(_)},k.tapDistance=function(I){return arguments.length?(S=+I,k):S},k}var ps=qC();const _d=x.createContext(null),eP=_d.Provider,fs={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.`},mT=fs.error001();function ht(e,t){const n=x.useContext(_d);if(n===null)throw new Error(mT);return FC(n,e,t)}const It=()=>{const e=x.useContext(_d);if(e===null)throw new Error(mT);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},tP=e=>e.userSelectionActive?"none":"all";function sx({position:e,children:t,className:n,style:s,...a}){const l=ht(tP),c=`${e}`.split("-");return pe.createElement("div",{className:Jt(["react-flow__panel",n,...c]),style:{...s,pointerEvents:l},...a},t)}function nP({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:pe.createElement(sx,{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 rP=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:a=!0,labelBgStyle:l={},labelBgPadding:c=[2,4],labelBgBorderRadius:d=2,children:h,className:p,...f})=>{const m=x.useRef(null),[y,v]=x.useState({x:0,y:0,width:0,height:0}),N=Jt(["react-flow__edge-textwrapper",p]);return x.useEffect(()=>{if(m.current){const _=m.current.getBBox();v({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",...f},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:l,rx:d,ry:d}),pe.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:s},n),h)};var sP=x.memo(rP);const ax=e=>({width:e.offsetWidth,height:e.offsetHeight}),di=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ox=(e={x:0,y:0},t)=>({x:di(e.x,t[0][0],t[1][0]),y:di(e.y,t[0][1],t[1][1])}),fk=(e,t,n)=>e<t?di(Math.abs(e-t),1,50)/50:e>n?-di(Math.abs(e-n),1,50)/50:0,gT=(e,t)=>{const n=fk(e.x,35,t.width-35)*20,s=fk(e.y,35,t.height-35)*20;return[n,s]},yT=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},wT=(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)}),ql=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),vT=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),pk=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),aP=(e,t)=>vT(wT(ql(e),ql(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)},oP=e=>Gn(e.width)&&Gn(e.height)&&Gn(e.x)&&Gn(e.y),Gn=e=>!isNaN(e)&&isFinite(e),jt=Symbol.for("internals"),xT=["Enter"," ","Escape"],iP=(e,t)=>{},lP=e=>"nativeEvent"in e;function _v(e){var a,l;const t=lP(e)?e.nativeEvent:e,n=((l=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:l[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const bT=e=>"clientX"in e,Hs=(e,t)=>{var l,c;const n=bT(e),s=n?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,a=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x: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},Xl=({id:e,path:t,labelX:n,labelY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:m,markerStart:y,interactionWidth:v=20})=>pe.createElement(pe.Fragment,null,pe.createElement("path",{id:e,style:f,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),v&&pe.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:v,className:"react-flow__edge-interaction"}),a&&Gn(n)&&Gn(s)?pe.createElement(sP,{x:n,y:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p}):null);Xl.displayName="BaseEdge";function vl(e,t,n){return n===void 0?n:s=>{const a=t().edges.find(l=>l.id===e);a&&n(s,{...a})}}function kT({sourceX:e,sourceY:t,targetX:n,targetY:s}){const a=Math.abs(n-e)/2,l=n<e?n+a:n-a,c=Math.abs(s-t)/2,d=s<t?s+c:s-c;return[l,d,a,c]}function _T({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d}){const h=e*.125+a*.375+c*.375+n*.125,p=t*.125+l*.375+d*.375+s*.125,f=Math.abs(h-e),m=Math.abs(p-t);return[h,p,f,m]}var Ya;(function(e){e.Strict="strict",e.Loose="loose"})(Ya||(Ya={}));var Wa;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Wa||(Wa={}));var Fl;(function(e){e.Partial="partial",e.Full="full"})(Fl||(Fl={}));var Ws;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ws||(Ws={}));var od;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(od||(od={}));var Be;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Be||(Be={}));function mk({pos:e,x1:t,y1:n,x2:s,y2:a}){return e===Be.Left||e===Be.Right?[.5*(t+s),n]:[t,.5*(n+a)]}function NT({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:s,targetY:a,targetPosition:l=Be.Top}){const[c,d]=mk({pos:n,x1:e,y1:t,x2:s,y2:a}),[h,p]=mk({pos:l,x1:s,y1:a,x2:e,y2:t}),[f,m,y,v]=_T({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:c,sourceControlY:d,targetControlX:h,targetControlY:p});return[`M${e},${t} C${c},${d} ${h},${p} ${s},${a}`,f,m,y,v]}const ix=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=Be.Bottom,targetPosition:l=Be.Top,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:N,interactionWidth:_})=>{const[S,k,j]=NT({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:l});return pe.createElement(Xl,{path:S,labelX:k,labelY:j,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:N,interactionWidth:_})});ix.displayName="SimpleBezierEdge";const gk={[Be.Left]:{x:-1,y:0},[Be.Right]:{x:1,y:0},[Be.Top]:{x:0,y:-1},[Be.Bottom]:{x:0,y:1}},cP=({source:e,sourcePosition:t=Be.Bottom,target:n})=>t===Be.Left||t===Be.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},yk=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function uP({source:e,sourcePosition:t=Be.Bottom,target:n,targetPosition:s=Be.Top,center:a,offset:l}){const c=gk[t],d=gk[s],h={x:e.x+c.x*l,y:e.y+c.y*l},p={x:n.x+d.x*l,y:n.y+d.y*l},f=cP({source:h,sourcePosition:t,target:p}),m=f.x!==0?"x":"y",y=f[m];let v=[],N,_;const S={x:0,y:0},k={x:0,y:0},[j,E,C,T]=kT({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[m]*d[m]===-1){N=a.x??j,_=a.y??E;const A=[{x:N,y:h.y},{x:N,y:p.y}],D=[{x:h.x,y:_},{x:p.x,y:_}];c[m]===y?v=m==="x"?A:D:v=m==="x"?D:A}else{const A=[{x:h.x,y:p.y}],D=[{x:p.x,y:h.y}];if(m==="x"?v=c.x===y?D:A:v=c.y===y?A:D,t===s){const J=Math.abs(e[m]-n[m]);if(J<=l){const I=Math.min(l-1,l-J);c[m]===y?S[m]=(h[m]>e[m]?-1:1)*I:k[m]=(p[m]>n[m]?-1:1)*I}}if(t!==s){const J=m==="x"?"y":"x",I=c[m]===d[J],X=h[J]>p[J],G=h[J]<p[J];(c[m]===1&&(!I&&X||I&&G)||c[m]!==1&&(!I&&G||I&&X))&&(v=m==="x"?A:D)}const O={x:h.x+S.x,y:h.y+S.y},$={x:p.x+k.x,y:p.y+k.y},F=Math.max(Math.abs(O.x-v[0].x),Math.abs($.x-v[0].x)),Z=Math.max(Math.abs(O.y-v[0].y),Math.abs($.y-v[0].y));F>=Z?(N=(O.x+$.x)/2,_=v[0].y):(N=v[0].x,_=(O.y+$.y)/2)}return[[e,{x:h.x+S.x,y:h.y+S.y},...v,{x:p.x+k.x,y:p.y+k.y},n],N,_,C,T]}function dP(e,t,n,s){const a=Math.min(yk(e,t)/2,yk(t,n)/2,s),{x:l,y:c}=t;if(e.x===l&&l===n.x||e.y===c&&c===n.y)return`L${l} ${c}`;if(e.y===c){const p=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${l+a*p},${c}Q ${l},${c} ${l},${c+a*f}`}const d=e.x<n.x?1:-1,h=e.y<n.y?-1:1;return`L ${l},${c+a*h}Q ${l},${c} ${l+a*d},${c}`}function Nv({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:s,targetY:a,targetPosition:l=Be.Top,borderRadius:c=5,centerX:d,centerY:h,offset:p=20}){const[f,m,y,v,N]=uP({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:a},targetPosition:l,center:{x:d,y:h},offset:p});return[f.reduce((S,k,j)=>{let E="";return j>0&&j<f.length-1?E=dP(f[j-1],k,f[j+1],c):E=`${j===0?"M":"L"}${k.x} ${k.y}`,S+=E,S},""),m,y,v,N]}const Nd=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,sourcePosition:m=Be.Bottom,targetPosition:y=Be.Top,markerEnd:v,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[k,j,E]=Nv({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(Xl,{path:k,labelX:j,labelY:E,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:v,markerStart:N,interactionWidth:S})});Nd.displayName="SmoothStepEdge";const lx=x.memo(e=>{var t;return pe.createElement(Nd,{...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])})});lx.displayName="StepEdge";function hP({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[a,l,c,d]=kT({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,a,l,c,d]}const cx=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:m,markerStart:y,interactionWidth:v})=>{const[N,_,S]=hP({sourceX:e,sourceY:t,targetX:n,targetY:s});return pe.createElement(Xl,{path:N,labelX:_,labelY:S,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:m,markerStart:y,interactionWidth:v})});cx.displayName="StraightEdge";function ju(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:l}){switch(e){case Be.Left:return[t-ju(t-s,l),n];case Be.Right:return[t+ju(s-t,l),n];case Be.Top:return[t,n-ju(n-a,l)];case Be.Bottom:return[t,n+ju(a-n,l)]}}function ST({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:s,targetY:a,targetPosition:l=Be.Top,curvature:c=.25}){const[d,h]=wk({pos:n,x1:e,y1:t,x2:s,y2:a,c}),[p,f]=wk({pos:l,x1:s,y1:a,x2:e,y2:t,c}),[m,y,v,N]=_T({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:d,sourceControlY:h,targetControlX:p,targetControlY:f});return[`M${e},${t} C${d},${h} ${p},${f} ${s},${a}`,m,y,v,N]}const id=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=Be.Bottom,targetPosition:l=Be.Top,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[k,j,E]=ST({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:l,curvature:_==null?void 0:_.curvature});return pe.createElement(Xl,{path:k,labelX:j,labelY:E,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:N,interactionWidth:S})});id.displayName="BezierEdge";const ux=x.createContext(null),fP=ux.Provider;ux.Consumer;const pP=()=>x.useContext(ux),mP=e=>"id"in e&&"source"in e&&"target"in e,gP=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Sv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,yP=(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)),wP=(e,t)=>{if(!e.source||!e.target)return t;let n;return mP(e)?n={...e}:n={...e,id:gP(e)},yP(n,t)?t:t.concat(n)},jv=({x:e,y:t},[n,s,a],l,[c,d])=>{const h={x:(e-n)/a,y:(t-s)/a};return l?{x:c*Math.round(h.x/c),y:d*Math.round(h.y/d)}:h},jT=({x:e,y:t},[n,s,a])=>({x:e*a+n,y:t*a+s}),Ga=(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}},Sd=(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:l,y:c}=Ga(a,t).positionAbsolute;return wT(s,ql({x:l,y:c,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return vT(n)},ET=(e,t,[n,s,a]=[0,0,1],l=!1,c=!1,d=[0,0])=>{const h={x:(t.x-n)/a,y:(t.y-s)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(f=>{const{width:m,height:y,selectable:v=!0,hidden:N=!1}=f;if(c&&!v||N)return!1;const{positionAbsolute:_}=Ga(f,d),S={x:_.x,y:_.y,width:m||0,height:y||0},k=kv(h,S),j=typeof m>"u"||typeof y>"u"||m===null||y===null,E=l&&k>0,C=(m||0)*(y||0);(j||E||k>=C||f.dragging)&&p.push(f)}),p},CT=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},TT=(e,t,n,s,a,l=.1)=>{const c=t/(e.width*(1+l)),d=n/(e.height*(1+l)),h=Math.min(c,d),p=di(h,s,a),f=e.x+e.width/2,m=e.y+e.height/2,y=t/2-f*p,v=n/2-m*p;return{x:y,y:v,zoom:p}},za=(e,t=0)=>e.transition().duration(t);function vk(e,t,n,s){return(t[n]||[]).reduce((a,l)=>{var c,d;return`${e.id}-${l.id}-${n}`!==s&&a.push({id:l.id||null,type:n,nodeId:e.id,x:(((c=e.positionAbsolute)==null?void 0:c.x)??0)+l.x+l.width/2,y:(((d=e.positionAbsolute)==null?void 0:d.y)??0)+l.y+l.height/2}),a},[])}function vP(e,t,n,s,a,l){const{x:c,y:d}=Hs(e),p=t.elementsFromPoint(c,d).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const _=dx(void 0,p),S=p.getAttribute("data-handleid"),k=l({nodeId:N,id:S,type:_});if(k){const j=a.find(E=>E.nodeId===N&&E.type===_&&E.id===S);return{handle:{id:S,type:_,nodeId:N,x:(j==null?void 0:j.x)||n.x,y:(j==null?void 0:j.y)||n.y},validHandleResult:k}}}}let f=[],m=1/0;if(a.forEach(N=>{const _=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(_<=s){const S=l(N);_<=m&&(_<m?f=[{handle:N,validHandleResult:S}]:_===m&&f.push({handle:N,validHandleResult:S}),m=_)}}),!f.length)return{handle:null,validHandleResult:AT()};if(f.length===1)return f[0];const y=f.some(({validHandleResult:N})=>N.isValid),v=f.some(({handle:N})=>N.type==="target");return f.find(({handle:N,validHandleResult:_})=>v?N.type==="target":y?_.isValid:!0)||f[0]}const xP={source:null,target:null,sourceHandle:null,targetHandle:null},AT=()=>({handleDomNode:null,isValid:!1,connection:xP,endHandle:null});function RT(e,t,n,s,a,l,c){const d=a==="target",h=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={...AT(),handleDomNode:h};if(h){const f=dx(void 0,h),m=h.getAttribute("data-nodeid"),y=h.getAttribute("data-handleid"),v=h.classList.contains("connectable"),N=h.classList.contains("connectableend"),_={source:d?m:n,sourceHandle:d?y:s,target:d?n:m,targetHandle:d?s:y};p.connection=_,v&&N&&(t===Ya.Strict?d&&f==="source"||!d&&f==="target":m!==n||y!==s)&&(p.endHandle={nodeId:m,handleId:y,type:f},p.isValid=l(_))}return p}function bP({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((a,l)=>{if(l[jt]){const{handleBounds:c}=l[jt];let d=[],h=[];c&&(d=vk(l,c,"source",`${t}-${n}-${s}`),h=vk(l,c,"target",`${t}-${n}-${s}`)),a.push(...d,...h)}return a},[])}function dx(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Mf(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function kP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function MT({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:a,getState:l,setState:c,isValidConnection:d,edgeUpdaterType:h,onReconnectEnd:p}){const f=yT(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:v,connectionRadius:N,onConnectStart:_,panBy:S,getNodes:k,cancelConnection:j}=l();let E=0,C;const{x:T,y:R}=Hs(e),A=f==null?void 0:f.elementFromPoint(T,R),D=dx(h,A),O=y==null?void 0:y.getBoundingClientRect();if(!O||!D)return;let $,F=Hs(e,O),Z=!1,J=null,I=!1,X=null;const G=bP({nodes:k(),nodeId:n,handleId:t,handleType:D}),q=()=>{if(!v)return;const[K,P]=gT(F,O);S({x:K,y:P}),E=requestAnimationFrame(q)};c({connectionPosition:F,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:D,connectionStartHandle:{nodeId:n,handleId:t,type:D},connectionEndHandle:null}),_==null||_(e,{nodeId:n,handleId:t,handleType:D});function Y(K){const{transform:P}=l();F=Hs(K,O);const{handle:V,validHandleResult:he}=vP(K,f,jv(F,P,!1,[1,1]),N,G,U=>RT(U,m,n,t,a?"target":"source",d,f));if(C=V,Z||(q(),Z=!0),X=he.handleDomNode,J=he.connection,I=he.isValid,c({connectionPosition:C&&I?jT({x:C.x,y:C.y},P):F,connectionStatus:kP(!!C,I),connectionEndHandle:he.endHandle}),!C&&!I&&!X)return Mf($);J.source!==J.target&&X&&(Mf($),$=X,X.classList.add("connecting","react-flow__handle-connecting"),X.classList.toggle("valid",I),X.classList.toggle("react-flow__handle-valid",I))}function L(K){var P,V;(C||X)&&J&&I&&(s==null||s(J)),(V=(P=l()).onConnectEnd)==null||V.call(P,K),h&&(p==null||p(K)),Mf($),j(),cancelAnimationFrame(E),Z=!1,I=!1,J=null,X=null,f.removeEventListener("mousemove",Y),f.removeEventListener("mouseup",L),f.removeEventListener("touchmove",Y),f.removeEventListener("touchend",L)}f.addEventListener("mousemove",Y),f.addEventListener("mouseup",L),f.addEventListener("touchmove",Y),f.addEventListener("touchend",L)}const xk=()=>!0,_P=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),NP=(e,t,n)=>s=>{const{connectionStartHandle:a,connectionEndHandle:l,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||(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n,clickConnecting:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.handleId)===t&&(c==null?void 0:c.type)===n}},IT=x.forwardRef(({type:e="source",position:t=Be.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:c,onConnect:d,children:h,className:p,onMouseDown:f,onTouchStart:m,...y},v)=>{var O,$;const N=c||null,_=e==="target",S=It(),k=pP(),{connectOnClick:j,noPanClassName:E}=ht(_P,qt),{connecting:C,clickConnecting:T}=ht(NP(k,N,e),qt);k||($=(O=S.getState()).onError)==null||$.call(O,"010",fs.error010());const R=F=>{const{defaultEdgeOptions:Z,onConnect:J,hasDefaultEdges:I}=S.getState(),X={...Z,...F};if(I){const{edges:G,setEdges:q}=S.getState();q(wP(X,G))}J==null||J(X),d==null||d(X)},A=F=>{if(!k)return;const Z=bT(F);a&&(Z&&F.button===0||!Z)&&MT({event:F,handleId:N,nodeId:k,onConnect:R,isTarget:_,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||xk}),Z?f==null||f(F):m==null||m(F)},D=F=>{const{onClickConnectStart:Z,onClickConnectEnd:J,connectionClickStartHandle:I,connectionMode:X,isValidConnection:G}=S.getState();if(!k||!I&&!a)return;if(!I){Z==null||Z(F,{nodeId:k,handleId:N,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:k,type:e,handleId:N}});return}const q=yT(F.target),Y=n||G||xk,{connection:L,isValid:K}=RT({nodeId:k,id:N,type:e},X,I.nodeId,I.handleId||null,I.type,Y,q);K&&R(L),J==null||J(F),S.setState({connectionClickStartHandle:null})};return pe.createElement("div",{"data-handleid":N,"data-nodeid":k,"data-handlepos":t,"data-id":`${k}-${N}-${e}`,className:Jt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,p,{source:!_,target:_,connectable:s,connectablestart:a,connectableend:l,connecting:T,connectionindicator:s&&(a&&!C||l&&C)}]),onMouseDown:A,onTouchStart:A,onClick:j?D:void 0,ref:v,...y},h)});IT.displayName="Handle";var hi=x.memo(IT);const $T=({data:e,isConnectable:t,targetPosition:n=Be.Top,sourcePosition:s=Be.Bottom})=>pe.createElement(pe.Fragment,null,pe.createElement(hi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,pe.createElement(hi,{type:"source",position:s,isConnectable:t}));$T.displayName="DefaultNode";var Ev=x.memo($T);const OT=({data:e,isConnectable:t,sourcePosition:n=Be.Bottom})=>pe.createElement(pe.Fragment,null,e==null?void 0:e.label,pe.createElement(hi,{type:"source",position:n,isConnectable:t}));OT.displayName="InputNode";var PT=x.memo(OT);const LT=({data:e,isConnectable:t,targetPosition:n=Be.Top})=>pe.createElement(pe.Fragment,null,pe.createElement(hi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);LT.displayName="OutputNode";var DT=x.memo(LT);const hx=()=>null;hx.displayName="GroupNode";const SP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),Eu=e=>e.id;function jP(e,t){return qt(e.selectedNodes.map(Eu),t.selectedNodes.map(Eu))&&qt(e.selectedEdges.map(Eu),t.selectedEdges.map(Eu))}const qT=x.memo(({onSelectionChange:e})=>{const t=It(),{selectedNodes:n,selectedEdges:s}=ht(SP,jP);return x.useEffect(()=>{const a={nodes:n,edges:s};e==null||e(a),t.getState().onSelectionChange.forEach(l=>l(a))},[n,s,e]),null});qT.displayName="SelectionListener";const EP=e=>!!e.onSelectionChange;function CP({onSelectionChange:e}){const t=ht(EP);return e||t?pe.createElement(qT,{onSelectionChange:e}):null}const TP=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 Ho(e,t){x.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function rt(e,t,n){x.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const AP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:a,onConnectStart:l,onConnectEnd:c,onClickConnectStart:d,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:f,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:v,elevateNodesOnSelect:N,minZoom:_,maxZoom:S,nodeExtent:k,onNodesChange:j,onEdgesChange:E,elementsSelectable:C,connectionMode:T,snapGrid:R,snapToGrid:A,translateExtent:D,connectOnClick:O,defaultEdgeOptions:$,fitView:F,fitViewOptions:Z,onNodesDelete:J,onEdgesDelete:I,onNodeDrag:X,onNodeDragStart:G,onNodeDragStop:q,onSelectionDrag:Y,onSelectionDragStart:L,onSelectionDragStop:K,noPanClassName:P,nodeOrigin:V,rfId:he,autoPanOnConnect:U,autoPanOnNodeDrag:W,onError:ee,connectionRadius:H,isValidConnection:ae,nodeDragThreshold:me})=>{const{setNodes:ge,setEdges:Re,setDefaultNodesAndEdges:$e,setMinZoom:ce,setMaxZoom:we,setTranslateExtent:xe,setNodeExtent:De,reset:_e}=ht(TP,qt),Ee=It();return x.useEffect(()=>{const Ge=s==null?void 0:s.map(st=>({...st,...$}));return $e(n,Ge),()=>{_e()}},[]),rt("defaultEdgeOptions",$,Ee.setState),rt("connectionMode",T,Ee.setState),rt("onConnect",a,Ee.setState),rt("onConnectStart",l,Ee.setState),rt("onConnectEnd",c,Ee.setState),rt("onClickConnectStart",d,Ee.setState),rt("onClickConnectEnd",h,Ee.setState),rt("nodesDraggable",p,Ee.setState),rt("nodesConnectable",f,Ee.setState),rt("nodesFocusable",m,Ee.setState),rt("edgesFocusable",y,Ee.setState),rt("edgesUpdatable",v,Ee.setState),rt("elementsSelectable",C,Ee.setState),rt("elevateNodesOnSelect",N,Ee.setState),rt("snapToGrid",A,Ee.setState),rt("snapGrid",R,Ee.setState),rt("onNodesChange",j,Ee.setState),rt("onEdgesChange",E,Ee.setState),rt("connectOnClick",O,Ee.setState),rt("fitViewOnInit",F,Ee.setState),rt("fitViewOnInitOptions",Z,Ee.setState),rt("onNodesDelete",J,Ee.setState),rt("onEdgesDelete",I,Ee.setState),rt("onNodeDrag",X,Ee.setState),rt("onNodeDragStart",G,Ee.setState),rt("onNodeDragStop",q,Ee.setState),rt("onSelectionDrag",Y,Ee.setState),rt("onSelectionDragStart",L,Ee.setState),rt("onSelectionDragStop",K,Ee.setState),rt("noPanClassName",P,Ee.setState),rt("nodeOrigin",V,Ee.setState),rt("rfId",he,Ee.setState),rt("autoPanOnConnect",U,Ee.setState),rt("autoPanOnNodeDrag",W,Ee.setState),rt("onError",ee,Ee.setState),rt("connectionRadius",H,Ee.setState),rt("isValidConnection",ae,Ee.setState),rt("nodeDragThreshold",me,Ee.setState),Ho(e,ge),Ho(t,Re),Ho(_,ce),Ho(S,we),Ho(D,xe),Ho(k,De),null},bk={display:"none"},RP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},FT="react-flow__node-desc",BT="react-flow__edge-desc",MP="react-flow__aria-live",IP=e=>e.ariaLiveMessage;function $P({rfId:e}){const t=ht(IP);return pe.createElement("div",{id:`${MP}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:RP},t)}function OP({rfId:e,disableKeyboardA11y:t}){return pe.createElement(pe.Fragment,null,pe.createElement("div",{id:`${FT}-${e}`,style:bk},"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:`${BT}-${e}`,style:bk},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&pe.createElement($P,{rfId:e}))}var Bl=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=x.useState(!1),a=x.useRef(!1),l=x.useRef(new Set([])),[c,d]=x.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),f=p.reduce((m,y)=>m.concat(...y),[]);return[p,f]}return[[],[]]},[e]);return x.useEffect(()=>{const h=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||h;if(e!==null){const f=v=>{if(a.current=v.ctrlKey||v.metaKey||v.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&_v(v))return!1;const _=_k(v.code,d);l.current.add(v[_]),kk(c,l.current,!1)&&(v.preventDefault(),s(!0))},m=v=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&_v(v))return!1;const _=_k(v.code,d);kk(c,l.current,!0)?(s(!1),l.current.clear()):l.current.delete(v[_]),v.key==="Meta"&&l.current.clear(),a.current=!1},y=()=>{l.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",f),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",f),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,s]),n};function kk(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(a=>t.has(a)))}function _k(e,t){return t.includes(e)?"code":"key"}function zT(e,t,n,s){var d,h;const a=e.parentNode||e.parentId;if(!a)return n;const l=t.get(a),c=Ga(l,s);return zT(l,t,{x:(n.x??0)+c.x,y:(n.y??0)+c.y,z:(((d=l[jt])==null?void 0:d.z)??0)>(n.z??0)?((h=l[jt])==null?void 0:h.z)??0:n.z??0},s)}function UT(e,t,n){e.forEach(s=>{var l;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:d,z:h}=zT(s,e,{...s.position,z:((l=s[jt])==null?void 0:l.z)??0},t);s.positionAbsolute={x:c,y:d},s[jt].z=h,n!=null&&n[s.id]&&(s[jt].isParent=!0)}})}function If(e,t,n,s){const a=new Map,l={},c=s?1e3:0;return e.forEach(d=>{var v;const h=(Gn(d.zIndex)?d.zIndex:0)+(d.selected?c:0),p=t.get(d.id),f={...d,positionAbsolute:{x:d.position.x,y:d.position.y}},m=d.parentNode||d.parentId;m&&(l[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==d.type;Object.defineProperty(f,jt,{enumerable:!1,value:{handleBounds:y||(v=p==null?void 0:p[jt])==null?void 0:v.handleBounds,z:h}}),a.set(d.id,f)}),UT(a,n,l),a}function WT(e,t={}){const{getNodes:n,width:s,height:a,minZoom:l,maxZoom:c,d3Zoom:d,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:f,nodeOrigin:m}=e(),y=t.initial&&!p&&f;if(d&&h&&(y||!t.initial)){const N=n().filter(S=>{var j;const k=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return(j=t.nodes)!=null&&j.length?k&&t.nodes.some(E=>E.id===S.id):k}),_=N.every(S=>S.width&&S.height);if(N.length>0&&_){const S=Sd(N,m),{x:k,y:j,zoom:E}=TT(S,s,a,t.minZoom??l,t.maxZoom??c,t.padding??.1),C=ds.translate(k,j).scale(E);return typeof t.duration=="number"&&t.duration>0?d.transform(za(h,t.duration),C):d.transform(h,C),!0}}return!1}function PP(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[jt]:s[jt],selected:n.selected})}),new Map(t)}function LP(e,t){return t.map(n=>{const s=e.find(a=>a.id===n.id);return s&&(n.selected=s.selected),n})}function Cu({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:a,edges:l,onNodesChange:c,onEdgesChange:d,hasDefaultNodes:h,hasDefaultEdges:p}=n();e!=null&&e.length&&(h&&s({nodeInternals:PP(e,a)}),c==null||c(e)),t!=null&&t.length&&(p&&s({edges:LP(t,l)}),d==null||d(t))}const Go=()=>{},DP={zoomIn:Go,zoomOut:Go,zoomTo:Go,getZoom:()=>1,setViewport:Go,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Go,fitBounds:Go,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},qP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),FP=()=>{const e=It(),{d3Zoom:t,d3Selection:n}=ht(qP,qt);return x.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(za(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(za(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,l)=>t.scaleTo(za(n,l==null?void 0:l.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,l)=>{const[c,d,h]=e.getState().transform,p=ds.translate(a.x??c,a.y??d).scale(a.zoom??h);t.transform(za(n,l==null?void 0:l.duration),p)},getViewport:()=>{const[a,l,c]=e.getState().transform;return{x:a,y:l,zoom:c}},fitView:a=>WT(e.getState,a),setCenter:(a,l,c)=>{const{width:d,height:h,maxZoom:p}=e.getState(),f=typeof(c==null?void 0:c.zoom)<"u"?c.zoom:p,m=d/2-a*f,y=h/2-l*f,v=ds.translate(m,y).scale(f);t.transform(za(n,c==null?void 0:c.duration),v)},fitBounds:(a,l)=>{const{width:c,height:d,minZoom:h,maxZoom:p}=e.getState(),{x:f,y:m,zoom:y}=TT(a,c,d,h,p,(l==null?void 0:l.padding)??.1),v=ds.translate(f,m).scale(y);t.transform(za(n,l==null?void 0:l.duration),v)},project:a=>{const{transform:l,snapToGrid:c,snapGrid:d}=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,l,c,d)},screenToFlowPosition:a=>{const{transform:l,snapToGrid:c,snapGrid:d,domNode:h}=e.getState();if(!h)return a;const{x:p,y:f}=h.getBoundingClientRect(),m={x:a.x-p,y:a.y-f};return jv(m,l,c,d)},flowToScreenPosition:a=>{const{transform:l,domNode:c}=e.getState();if(!c)return a;const{x:d,y:h}=c.getBoundingClientRect(),p=jT(a,l);return{x:p.x+d,y:p.y+h}},viewportInitialized:!0}:DP,[t,n])};function Ql(){const e=FP(),t=It(),n=x.useCallback(()=>t.getState().getNodes().map(_=>({..._})),[]),s=x.useCallback(_=>t.getState().nodeInternals.get(_),[]),a=x.useCallback(()=>{const{edges:_=[]}=t.getState();return _.map(S=>({...S}))},[]),l=x.useCallback(_=>{const{edges:S=[]}=t.getState();return S.find(k=>k.id===_)},[]),c=x.useCallback(_=>{const{getNodes:S,setNodes:k,hasDefaultNodes:j,onNodesChange:E}=t.getState(),C=S(),T=typeof _=="function"?_(C):_;if(j)k(T);else if(E){const R=T.length===0?C.map(A=>({type:"remove",id:A.id})):T.map(A=>({item:A,type:"reset"}));E(R)}},[]),d=x.useCallback(_=>{const{edges:S=[],setEdges:k,hasDefaultEdges:j,onEdgesChange:E}=t.getState(),C=typeof _=="function"?_(S):_;if(j)k(C);else if(E){const T=C.length===0?S.map(R=>({type:"remove",id:R.id})):C.map(R=>({item:R,type:"reset"}));E(T)}},[]),h=x.useCallback(_=>{const S=Array.isArray(_)?_:[_],{getNodes:k,setNodes:j,hasDefaultNodes:E,onNodesChange:C}=t.getState();if(E){const R=[...k(),...S];j(R)}else if(C){const T=S.map(R=>({item:R,type:"add"}));C(T)}},[]),p=x.useCallback(_=>{const S=Array.isArray(_)?_:[_],{edges:k=[],setEdges:j,hasDefaultEdges:E,onEdgesChange:C}=t.getState();if(E)j([...k,...S]);else if(C){const T=S.map(R=>({item:R,type:"add"}));C(T)}},[]),f=x.useCallback(()=>{const{getNodes:_,edges:S=[],transform:k}=t.getState(),[j,E,C]=k;return{nodes:_().map(T=>({...T})),edges:S.map(T=>({...T})),viewport:{x:j,y:E,zoom:C}}},[]),m=x.useCallback(({nodes:_,edges:S})=>{const{nodeInternals:k,getNodes:j,edges:E,hasDefaultNodes:C,hasDefaultEdges:T,onNodesDelete:R,onEdgesDelete:A,onNodesChange:D,onEdgesChange:O}=t.getState(),$=(_||[]).map(X=>X.id),F=(S||[]).map(X=>X.id),Z=j().reduce((X,G)=>{const q=G.parentNode||G.parentId,Y=!$.includes(G.id)&&q&&X.find(K=>K.id===q);return(typeof G.deletable=="boolean"?G.deletable:!0)&&($.includes(G.id)||Y)&&X.push(G),X},[]),J=E.filter(X=>typeof X.deletable=="boolean"?X.deletable:!0),I=J.filter(X=>F.includes(X.id));if(Z||I){const X=CT(Z,J),G=[...I,...X],q=G.reduce((Y,L)=>(Y.includes(L.id)||Y.push(L.id),Y),[]);if((T||C)&&(T&&t.setState({edges:E.filter(Y=>!q.includes(Y.id))}),C&&(Z.forEach(Y=>{k.delete(Y.id)}),t.setState({nodeInternals:new Map(k)}))),q.length>0&&(A==null||A(G),O&&O(q.map(Y=>({id:Y,type:"remove"})))),Z.length>0&&(R==null||R(Z),D)){const Y=Z.map(L=>({id:L.id,type:"remove"}));D(Y)}}},[]),y=x.useCallback(_=>{const S=oP(_),k=S?null:t.getState().nodeInternals.get(_.id);return!S&&!k?[null,null,S]:[S?_:pk(k),k,S]},[]),v=x.useCallback((_,S=!0,k)=>{const[j,E,C]=y(_);return j?(k||t.getState().getNodes()).filter(T=>{if(!C&&(T.id===E.id||!T.positionAbsolute))return!1;const R=pk(T),A=kv(R,j);return S&&A>0||A>=j.width*j.height}):[]},[]),N=x.useCallback((_,S,k=!0)=>{const[j]=y(_);if(!j)return!1;const E=kv(j,S);return k&&E>0||E>=j.width*j.height},[]);return x.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:a,getEdge:l,setNodes:c,setEdges:d,addNodes:h,addEdges:p,toObject:f,deleteElements:m,getIntersectingNodes:v,isNodeIntersecting:N}),[e,n,s,a,l,c,d,h,p,f,m,v,N])}const BP={actInsideInputWithModifier:!1};var zP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=It(),{deleteElements:s}=Ql(),a=Bl(e,BP),l=Bl(t);x.useEffect(()=>{if(a){const{edges:c,getNodes:d}=n.getState(),h=d().filter(f=>f.selected),p=c.filter(f=>f.selected);s({nodes:h,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),x.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])};function UP(e){const t=It();x.useEffect(()=>{let n;const s=()=>{var l,c;if(!e.current)return;const a=ax(e.current);(a.height===0||a.width===0)&&((c=(l=t.getState()).onError)==null||c.call(l,"004",fs.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 fx={position:"absolute",width:"100%",height:"100%",top:0,left:0},WP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Tu=e=>({x:e.x,y:e.y,zoom:e.k}),Vo=(e,t)=>e.target.closest(`.${t}`),Nk=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Sk=e=>{const t=e.ctrlKey&&ad()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},HP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),GP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:a=!0,zoomOnPinch:l=!0,panOnScroll:c=!1,panOnScrollSpeed:d=.5,panOnScrollMode:h=Wa.Free,zoomOnDoubleClick:p=!0,elementsSelectable:f,panOnDrag:m=!0,defaultViewport:y,translateExtent:v,minZoom:N,maxZoom:_,zoomActivationKeyCode:S,preventScrolling:k=!0,children:j,noWheelClassName:E,noPanClassName:C})=>{const T=x.useRef(),R=It(),A=x.useRef(!1),D=x.useRef(!1),O=x.useRef(null),$=x.useRef({x:0,y:0,zoom:0}),{d3Zoom:F,d3Selection:Z,d3ZoomHandler:J,userSelectionActive:I}=ht(HP,qt),X=Bl(S),G=x.useRef(0),q=x.useRef(!1),Y=x.useRef();return UP(O),x.useEffect(()=>{if(O.current){const L=O.current.getBoundingClientRect(),K=pT().scaleExtent([N,_]).translateExtent(v),P=Hn(O.current).call(K),V=ds.translate(y.x,y.y).scale(di(y.zoom,N,_)),he=[[0,0],[L.width,L.height]],U=K.constrain()(V,he,v);K.transform(P,U),K.wheelDelta(Sk),R.setState({d3Zoom:K,d3Selection:P,d3ZoomHandler:P.on("wheel.zoom"),transform:[U.x,U.y,U.k],domNode:O.current.closest(".react-flow")})}},[]),x.useEffect(()=>{Z&&F&&(c&&!X&&!I?Z.on("wheel.zoom",L=>{if(Vo(L,E))return!1;L.preventDefault(),L.stopImmediatePropagation();const K=Z.property("__zoom").k||1;if(L.ctrlKey&&l){const ae=cr(L),me=Sk(L),ge=K*Math.pow(2,me);F.scaleTo(Z,ge,ae,L);return}const P=L.deltaMode===1?20:1;let V=h===Wa.Vertical?0:L.deltaX*P,he=h===Wa.Horizontal?0:L.deltaY*P;!ad()&&L.shiftKey&&h!==Wa.Vertical&&(V=L.deltaY*P,he=0),F.translateBy(Z,-(V/K)*d,-(he/K)*d,{internal:!0});const U=Tu(Z.property("__zoom")),{onViewportChangeStart:W,onViewportChange:ee,onViewportChangeEnd:H}=R.getState();clearTimeout(Y.current),q.current||(q.current=!0,t==null||t(L,U),W==null||W(U)),q.current&&(e==null||e(L,U),ee==null||ee(U),Y.current=setTimeout(()=>{n==null||n(L,U),H==null||H(U),q.current=!1},150))},{passive:!1}):typeof J<"u"&&Z.on("wheel.zoom",function(L,K){if(!k&&L.type==="wheel"&&!L.ctrlKey||Vo(L,E))return null;L.preventDefault(),J.call(this,L,K)},{passive:!1}))},[I,c,h,Z,F,J,X,l,k,E,t,e,n]),x.useEffect(()=>{F&&F.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:K}=R.getState(),P=Tu(L.transform);A.current=!0,$.current=P,((he=L.sourceEvent)==null?void 0:he.type)==="mousedown"&&R.setState({paneDragging:!0}),K==null||K(P),t==null||t(L.sourceEvent,P)})},[F,t]),x.useEffect(()=>{F&&(I&&!A.current?F.on("zoom",null):I||F.on("zoom",L=>{var P;const{onViewportChange:K}=R.getState();if(R.setState({transform:[L.transform.x,L.transform.y,L.transform.k]}),D.current=!!(s&&Nk(m,G.current??0)),(e||K)&&!((P=L.sourceEvent)!=null&&P.internal)){const V=Tu(L.transform);K==null||K(V),e==null||e(L.sourceEvent,V)}}))},[I,F,e,m,s]),x.useEffect(()=>{F&&F.on("end",L=>{if(!L.sourceEvent||L.sourceEvent.internal)return null;const{onViewportChangeEnd:K}=R.getState();if(A.current=!1,R.setState({paneDragging:!1}),s&&Nk(m,G.current??0)&&!D.current&&s(L.sourceEvent),D.current=!1,(n||K)&&WP($.current,L.transform)){const P=Tu(L.transform);$.current=P,clearTimeout(T.current),T.current=setTimeout(()=>{K==null||K(P),n==null||n(L.sourceEvent,P)},c?150:0)}})},[F,c,m,n,s]),x.useEffect(()=>{F&&F.filter(L=>{const K=X||a,P=l&&L.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&L.button===1&&L.type==="mousedown"&&(Vo(L,"react-flow__node")||Vo(L,"react-flow__edge")))return!0;if(!m&&!K&&!c&&!p&&!l||I||!p&&L.type==="dblclick"||Vo(L,E)&&L.type==="wheel"||Vo(L,C)&&(L.type!=="wheel"||c&&L.type==="wheel"&&!X)||!l&&L.ctrlKey&&L.type==="wheel"||!K&&!c&&!P&&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})},[I,F,a,l,c,p,m,f,X]),pe.createElement("div",{className:"react-flow__renderer",ref:O,style:fx},j)},VP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function YP(){const{userSelectionActive:e,userSelectionRect:t}=ht(VP,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 jk(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,l=t.position.y+t.height-s.height;if(a>0||l>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),l>0&&(s.style.height+=l),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 KP(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 l=e.filter(d=>d.id===a.id);if(l.length===0)return s.push(a),s;const c={...a};for(const d of l)if(d)switch(d.type){case"select":{c.selected=d.selected;break}case"position":{typeof d.position<"u"&&(c.position=d.position),typeof d.positionAbsolute<"u"&&(c.positionAbsolute=d.positionAbsolute),typeof d.dragging<"u"&&(c.dragging=d.dragging),c.expandParent&&jk(s,c);break}case"dimensions":{typeof d.dimensions<"u"&&(c.width=d.dimensions.width,c.height=d.dimensions.height),typeof d.updateStyle<"u"&&(c.style={...c.style||{},...d.dimensions}),typeof d.resizing=="boolean"&&(c.resizing=d.resizing),c.expandParent&&jk(s,c);break}case"remove":return s}return s.push(c),s},n)}function XP(e,t){return KP(e,t)}const Us=(e,t)=>({id:e,type:"select",selected:t});function ei(e,t){return e.reduce((n,s)=>{const a=t.includes(s.id);return!s.selected&&a?(s.selected=!0,n.push(Us(s.id,!0))):s.selected&&!a&&(s.selected=!1,n.push(Us(s.id,!1))),n},[])}const $f=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},QP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),HT=x.memo(({isSelecting:e,selectionMode:t=Fl.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:d,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:f,children:m})=>{const y=x.useRef(null),v=It(),N=x.useRef(0),_=x.useRef(0),S=x.useRef(),{userSelectionActive:k,elementsSelectable:j,dragging:E}=ht(QP,qt),C=()=>{v.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,_.current=0},T=J=>{l==null||l(J),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},R=J=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){J.preventDefault();return}c==null||c(J)},A=d?J=>d(J):void 0,D=J=>{const{resetSelectedElements:I,domNode:X}=v.getState();if(S.current=X==null?void 0:X.getBoundingClientRect(),!j||!e||J.button!==0||J.target!==y.current||!S.current)return;const{x:G,y:q}=Hs(J,S.current);I(),v.setState({userSelectionRect:{width:0,height:0,startX:G,startY:q,x:G,y:q}}),s==null||s(J)},O=J=>{const{userSelectionRect:I,nodeInternals:X,edges:G,transform:q,onNodesChange:Y,onEdgesChange:L,nodeOrigin:K,getNodes:P}=v.getState();if(!e||!S.current||!I)return;v.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Hs(J,S.current),he=I.startX??0,U=I.startY??0,W={...I,x:V.x<he?V.x:he,y:V.y<U?V.y:U,width:Math.abs(V.x-he),height:Math.abs(V.y-U)},ee=P(),H=ET(X,W,q,t===Fl.Partial,!0,K),ae=CT(H,G).map(ge=>ge.id),me=H.map(ge=>ge.id);if(N.current!==me.length){N.current=me.length;const ge=ei(ee,me);ge.length&&(Y==null||Y(ge))}if(_.current!==ae.length){_.current=ae.length;const ge=ei(G,ae);ge.length&&(L==null||L(ge))}v.setState({userSelectionRect:W})},$=J=>{if(J.button!==0)return;const{userSelectionRect:I}=v.getState();!k&&I&&J.target===y.current&&(T==null||T(J)),v.setState({nodesSelectionActive:N.current>0}),C(),a==null||a(J)},F=J=>{k&&(v.setState({nodesSelectionActive:N.current>0}),a==null||a(J)),C()},Z=j&&(e||k);return pe.createElement("div",{className:Jt(["react-flow__pane",{dragging:E,selection:e}]),onClick:Z?void 0:$f(T,y),onContextMenu:$f(R,y),onWheel:$f(A,y),onMouseEnter:Z?void 0:h,onMouseDown:Z?D:void 0,onMouseMove:Z?O:p,onMouseUp:Z?$:void 0,onMouseLeave:Z?F:f,ref:y,style:fx},m,pe.createElement(YP,null))});HT.displayName="Pane";function GT(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:GT(s,t):!1}function Ek(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 ZP(e,t,n,s){return Array.from(e.values()).filter(a=>(a.selected||a.id===s)&&(!a.parentNode||a.parentId||!GT(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var l,c;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((l=a.positionAbsolute)==null?void 0:l.x)??0),y:n.y-(((c=a.positionAbsolute)==null?void 0:c.y)??0)},delta:{x:0,y:0},extent:a.extent,parentNode:a.parentNode||a.parentId,parentId:a.parentNode||a.parentId,width:a.width,height:a.height,expandParent:a.expandParent}})}function JP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function VT(e,t,n,s,a=[0,0],l){const c=JP(e,e.extent||s);let d=c;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const m=n.get(h),{x:y,y:v}=Ga(m,a).positionAbsolute;d=m&&Gn(y)&&Gn(v)&&Gn(m.width)&&Gn(m.height)?[[y+e.width*a[0],v+e.height*a[1]],[y+m.width-e.width+e.width*a[0],v+m.height-e.height+e.height*a[1]]]:d}else l==null||l("005",fs.error005()),d=c;else if(e.extent&&h&&e.extent!=="parent"){const m=n.get(h),{x:y,y:v}=Ga(m,a).positionAbsolute;d=[[e.extent[0][0]+y,e.extent[0][1]+v],[e.extent[1][0]+y,e.extent[1][1]+v]]}let p={x:0,y:0};if(h){const m=n.get(h);p=Ga(m,a).positionAbsolute}const f=d&&d!=="parent"?ox(t,d):t;return{position:{x:f.x-p.x,y:f.y-p.y},positionAbsolute:f}}function Of({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 Ck=(e,t,n,s)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const l=Array.from(a),c=t.getBoundingClientRect(),d={x:c.width*s[0],y:c.height*s[1]};return l.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-c.left-d.x)/n,y:(p.top-c.top-d.y)/n,...ax(h)}})};function xl(e,t,n){return n===void 0?n:s=>{const a=t().nodeInternals.get(e);a&&n(s,{...a})}}function Cv({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:c,nodeInternals:d,onError:h}=t.getState(),p=d.get(e);if(!p){h==null||h("012",fs.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&c)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var f;return(f=s==null?void 0:s.current)==null?void 0:f.blur()})):a([e])}function e3(){const e=It();return x.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:a,snapToGrid:l}=e.getState(),c=n.touches?n.touches[0].clientX:n.clientX,d=n.touches?n.touches[0].clientY:n.clientY,h={x:(c-s[0])/s[2],y:(d-s[1])/s[2]};return{xSnapped:l?a[0]*Math.round(h.x/a[0]):h.x,ySnapped:l?a[1]*Math.round(h.y/a[1]):h.y,...h}},[])}function Pf(e){return(t,n,s)=>e==null?void 0:e(t,s)}function YT({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:a,isSelectable:l,selectNodesOnDrag:c}){const d=It(),[h,p]=x.useState(!1),f=x.useRef([]),m=x.useRef({x:null,y:null}),y=x.useRef(0),v=x.useRef(null),N=x.useRef({x:0,y:0}),_=x.useRef(null),S=x.useRef(!1),k=x.useRef(!1),j=x.useRef(!1),E=e3();return x.useEffect(()=>{if(e!=null&&e.current){const C=Hn(e.current),T=({x:D,y:O})=>{const{nodeInternals:$,onNodeDrag:F,onSelectionDrag:Z,updateNodePositions:J,nodeExtent:I,snapGrid:X,snapToGrid:G,nodeOrigin:q,onError:Y}=d.getState();m.current={x:D,y:O};let L=!1,K={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&I){const V=Sd(f.current,q);K=ql(V)}if(f.current=f.current.map(V=>{const he={x:D-V.distance.x,y:O-V.distance.y};G&&(he.x=X[0]*Math.round(he.x/X[0]),he.y=X[1]*Math.round(he.y/X[1]));const U=[[I[0][0],I[0][1]],[I[1][0],I[1][1]]];f.current.length>1&&I&&!V.extent&&(U[0][0]=V.positionAbsolute.x-K.x+I[0][0],U[1][0]=V.positionAbsolute.x+(V.width??0)-K.x2+I[1][0],U[0][1]=V.positionAbsolute.y-K.y+I[0][1],U[1][1]=V.positionAbsolute.y+(V.height??0)-K.y2+I[1][1]);const W=VT(V,he,$,U,q,Y);return L=L||V.position.x!==W.position.x||V.position.y!==W.position.y,V.position=W.position,V.positionAbsolute=W.positionAbsolute,V}),!L)return;J(f.current,!0,!0),p(!0);const P=a?F:Pf(Z);if(P&&_.current){const[V,he]=Of({nodeId:a,dragItems:f.current,nodeInternals:$});P(_.current,V,he)}},R=()=>{if(!v.current)return;const[D,O]=gT(N.current,v.current);if(D!==0||O!==0){const{transform:$,panBy:F}=d.getState();m.current.x=(m.current.x??0)-D/$[2],m.current.y=(m.current.y??0)-O/$[2],F({x:D,y:O})&&T(m.current)}y.current=requestAnimationFrame(R)},A=D=>{var q;const{nodeInternals:O,multiSelectionActive:$,nodesDraggable:F,unselectNodesAndEdges:Z,onNodeDragStart:J,onSelectionDragStart:I}=d.getState();k.current=!0;const X=a?J:Pf(I);(!c||!l)&&!$&&a&&((q=O.get(a))!=null&&q.selected||Z()),a&&l&&c&&Cv({id:a,store:d,nodeRef:e});const G=E(D);if(m.current=G,f.current=ZP(O,F,G,a),X&&f.current){const[Y,L]=Of({nodeId:a,dragItems:f.current,nodeInternals:O});X(D.sourceEvent,Y,L)}};if(t)C.on(".drag",null);else{const D=u$().on("start",O=>{const{domNode:$,nodeDragThreshold:F}=d.getState();F===0&&A(O),j.current=!1;const Z=E(O);m.current=Z,v.current=($==null?void 0:$.getBoundingClientRect())||null,N.current=Hs(O.sourceEvent,v.current)}).on("drag",O=>{var J,I;const $=E(O),{autoPanOnNodeDrag:F,nodeDragThreshold:Z}=d.getState();if(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1&&(j.current=!0),!j.current){if(!S.current&&k.current&&F&&(S.current=!0,R()),!k.current){const X=$.xSnapped-(((J=m==null?void 0:m.current)==null?void 0:J.x)??0),G=$.ySnapped-(((I=m==null?void 0:m.current)==null?void 0:I.y)??0);Math.sqrt(X*X+G*G)>Z&&A(O)}(m.current.x!==$.xSnapped||m.current.y!==$.ySnapped)&&f.current&&k.current&&(_.current=O.sourceEvent,N.current=Hs(O.sourceEvent,v.current),T($))}}).on("end",O=>{if(!(!k.current||j.current)&&(p(!1),S.current=!1,k.current=!1,cancelAnimationFrame(y.current),f.current)){const{updateNodePositions:$,nodeInternals:F,onNodeDragStop:Z,onSelectionDragStop:J}=d.getState(),I=a?Z:Pf(J);if($(f.current,!1,!1),I){const[X,G]=Of({nodeId:a,dragItems:f.current,nodeInternals:F});I(O.sourceEvent,X,G)}}}).filter(O=>{const $=O.target;return!O.button&&(!n||!Ek($,`.${n}`,e))&&(!s||Ek($,s,e))});return C.call(D),()=>{C.on(".drag",null)}}}},[e,t,n,s,l,d,a,c,E]),h}function KT(){const e=It();return x.useCallback(n=>{const{nodeInternals:s,nodeExtent:a,updateNodePositions:l,getNodes:c,snapToGrid:d,snapGrid:h,onError:p,nodesDraggable:f}=e.getState(),m=c().filter(j=>j.selected&&(j.draggable||f&&typeof j.draggable>"u")),y=d?h[0]:5,v=d?h[1]:5,N=n.isShiftPressed?4:1,_=n.x*y*N,S=n.y*v*N,k=m.map(j=>{if(j.positionAbsolute){const E={x:j.positionAbsolute.x+_,y:j.positionAbsolute.y+S};d&&(E.x=h[0]*Math.round(E.x/h[0]),E.y=h[1]*Math.round(E.y/h[1]));const{positionAbsolute:C,position:T}=VT(j,E,s,a,void 0,p);j.position=T,j.positionAbsolute=C}return j});l(k,!0,!1)},[])}const oi={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var bl=e=>{const t=({id:n,type:s,data:a,xPos:l,yPos:c,xPosOrigin:d,yPosOrigin:h,selected:p,onClick:f,onMouseEnter:m,onMouseMove:y,onMouseLeave:v,onContextMenu:N,onDoubleClick:_,style:S,className:k,isDraggable:j,isSelectable:E,isConnectable:C,isFocusable:T,selectNodesOnDrag:R,sourcePosition:A,targetPosition:D,hidden:O,resizeObserver:$,dragHandle:F,zIndex:Z,isParent:J,noDragClassName:I,noPanClassName:X,initialized:G,disableKeyboardA11y:q,ariaLabel:Y,rfId:L,hasHandleBounds:K})=>{const P=It(),V=x.useRef(null),he=x.useRef(null),U=x.useRef(A),W=x.useRef(D),ee=x.useRef(s),H=E||j||f||m||y||v,ae=KT(),me=xl(n,P.getState,m),ge=xl(n,P.getState,y),Re=xl(n,P.getState,v),$e=xl(n,P.getState,N),ce=xl(n,P.getState,_),we=_e=>{const{nodeDragThreshold:Ee}=P.getState();if(E&&(!R||!j||Ee>0)&&Cv({id:n,store:P,nodeRef:V}),f){const Ge=P.getState().nodeInternals.get(n);Ge&&f(_e,{...Ge})}},xe=_e=>{if(!_v(_e)&&!q)if(xT.includes(_e.key)&&E){const Ee=_e.key==="Escape";Cv({id:n,store:P,unselect:Ee,nodeRef:V})}else j&&p&&Object.prototype.hasOwnProperty.call(oi,_e.key)&&(P.setState({ariaLiveMessage:`Moved selected node ${_e.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~c}`}),ae({x:oi[_e.key].x,y:oi[_e.key].y,isShiftPressed:_e.shiftKey}))};x.useEffect(()=>()=>{he.current&&($==null||$.unobserve(he.current),he.current=null)},[]),x.useEffect(()=>{if(V.current&&!O){const _e=V.current;(!G||!K||he.current!==_e)&&(he.current&&($==null||$.unobserve(he.current)),$==null||$.observe(_e),he.current=_e)}},[O,G,K]),x.useEffect(()=>{const _e=ee.current!==s,Ee=U.current!==A,Ge=W.current!==D;V.current&&(_e||Ee||Ge)&&(_e&&(ee.current=s),Ee&&(U.current=A),Ge&&(W.current=D),P.getState().updateNodeDimensions([{id:n,nodeElement:V.current,forceUpdate:!0}]))},[n,s,A,D]);const De=YT({nodeRef:V,disabled:O||!j,noDragClassName:I,handleSelector:F,nodeId:n,isSelectable:E,selectNodesOnDrag:R});return O?null:pe.createElement("div",{className:Jt(["react-flow__node",`react-flow__node-${s}`,{[X]:j},k,{selected:p,selectable:E,parent:J,dragging:De}]),ref:V,style:{zIndex:Z,transform:`translate(${d}px,${h}px)`,pointerEvents:H?"all":"none",visibility:G?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:me,onMouseMove:ge,onMouseLeave:Re,onContextMenu:$e,onClick:we,onDoubleClick:ce,onKeyDown:T?xe:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":q?void 0:`${FT}-${L}`,"aria-label":Y},pe.createElement(fP,{value:n},pe.createElement(e,{id:n,data:a,type:s,xPos:l,yPos:c,selected:p,isConnectable:C,sourcePosition:A,targetPosition:D,dragging:De,dragHandle:F,zIndex:Z})))};return t.displayName="NodeWrapper",x.memo(t)};const t3=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Sd(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function n3({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=It(),{width:a,height:l,x:c,y:d,transformString:h,userSelectionActive:p}=ht(t3,qt),f=KT(),m=x.useRef(null);if(x.useEffect(()=>{var N;n||(N=m.current)==null||N.focus({preventScroll:!0})},[n]),YT({nodeRef:m}),p||!a||!l)return null;const y=e?N=>{const _=s.getState().getNodes().filter(S=>S.selected);e(N,_)}:void 0,v=N=>{Object.prototype.hasOwnProperty.call(oi,N.key)&&f({x:oi[N.key].x,y:oi[N.key].y,isShiftPressed:N.shiftKey})};return pe.createElement("div",{className:Jt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:h}},pe.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:v,style:{width:a,height:l,top:d,left:c}}))}var r3=x.memo(n3);const s3=e=>e.nodesSelectionActive,XT=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,deleteKeyCode:d,onMove:h,onMoveStart:p,onMoveEnd:f,selectionKeyCode:m,selectionOnDrag:y,selectionMode:v,onSelectionStart:N,onSelectionEnd:_,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:j,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:A,panOnScrollMode:D,zoomOnDoubleClick:O,panOnDrag:$,defaultViewport:F,translateExtent:Z,minZoom:J,maxZoom:I,preventScrolling:X,onSelectionContextMenu:G,noWheelClassName:q,noPanClassName:Y,disableKeyboardA11y:L})=>{const K=ht(s3),P=Bl(m),V=Bl(k),he=V||$,U=V||R,W=P||y&&he!==!0;return zP({deleteKeyCode:d,multiSelectionKeyCode:S}),pe.createElement(GP,{onMove:h,onMoveStart:p,onMoveEnd:f,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:U,panOnScrollSpeed:A,panOnScrollMode:D,zoomOnDoubleClick:O,panOnDrag:!P&&he,defaultViewport:F,translateExtent:Z,minZoom:J,maxZoom:I,zoomActivationKeyCode:j,preventScrolling:X,noWheelClassName:q,noPanClassName:Y},pe.createElement(HT,{onSelectionStart:N,onSelectionEnd:_,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,panOnDrag:he,isSelecting:!!W,selectionMode:v},e,K&&pe.createElement(r3,{onSelectionContextMenu:G,noPanClassName:Y,disableKeyboardA11y:L})))};XT.displayName="FlowRenderer";var a3=x.memo(XT);function o3(e){return ht(x.useCallback(n=>e?ET(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function i3(e){const t={input:bl(e.input||PT),default:bl(e.default||Ev),output:bl(e.output||DT),group:bl(e.group||hx)},n={},s=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,l)=>(a[l]=bl(e[l]||Ev),a),n);return{...t,...s}}const l3=({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]},c3=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),QT=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:a,updateNodeDimensions:l,onError:c}=ht(c3,qt),d=o3(e.onlyRenderVisibleElements),h=x.useRef(),p=x.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(m=>{const y=m.map(v=>({id:v.target.getAttribute("data-id"),nodeElement:v.target,forceUpdate:!0}));l(y)});return h.current=f,f},[]);return x.useEffect(()=>()=>{var f;(f=h==null?void 0:h.current)==null||f.disconnect()},[]),pe.createElement("div",{className:"react-flow__nodes",style:fx},d.map(f=>{var T,R,A;let m=f.type||"default";e.nodeTypes[m]||(c==null||c("003",fs.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,v=!!(f.draggable||t&&typeof f.draggable>"u"),N=!!(f.selectable||a&&typeof f.selectable>"u"),_=!!(f.connectable||n&&typeof f.connectable>"u"),S=!!(f.focusable||s&&typeof f.focusable>"u"),k=e.nodeExtent?ox(f.positionAbsolute,e.nodeExtent):f.positionAbsolute,j=(k==null?void 0:k.x)??0,E=(k==null?void 0:k.y)??0,C=l3({x:j,y:E,width:f.width??0,height:f.height??0,origin:e.nodeOrigin});return pe.createElement(y,{key:f.id,id:f.id,className:f.className,style:f.style,type:m,data:f.data,sourcePosition:f.sourcePosition||Be.Bottom,targetPosition:f.targetPosition||Be.Top,hidden:f.hidden,xPos:j,yPos:E,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!f.selected,isDraggable:v,isSelectable:N,isConnectable:_,isFocusable:S,resizeObserver:p,dragHandle:f.dragHandle,zIndex:((T=f[jt])==null?void 0:T.z)??0,isParent:!!((R=f[jt])!=null&&R.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!f.width&&!!f.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!((A=f[jt])!=null&&A.handleBounds)})}))};QT.displayName="NodeRenderer";var u3=x.memo(QT);const d3=(e,t,n)=>n===Be.Left?e-t:n===Be.Right?e+t:e,h3=(e,t,n)=>n===Be.Top?e-t:n===Be.Bottom?e+t:e,Tk="react-flow__edgeupdater",Ak=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:a,onMouseEnter:l,onMouseOut:c,type:d})=>pe.createElement("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:c,className:Jt([Tk,`${Tk}-${d}`]),cx:d3(t,s,e),cy:h3(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),f3=()=>!0;var Yo=e=>{const t=({id:n,className:s,type:a,data:l,onClick:c,onEdgeDoubleClick:d,selected:h,animated:p,label:f,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:N,labelBgBorderRadius:_,style:S,source:k,target:j,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:A,targetPosition:D,elementsSelectable:O,hidden:$,sourceHandleId:F,targetHandleId:Z,onContextMenu:J,onMouseEnter:I,onMouseMove:X,onMouseLeave:G,reconnectRadius:q,onReconnect:Y,onReconnectStart:L,onReconnectEnd:K,markerEnd:P,markerStart:V,rfId:he,ariaLabel:U,isFocusable:W,isReconnectable:ee,pathOptions:H,interactionWidth:ae,disableKeyboardA11y:me})=>{const ge=x.useRef(null),[Re,$e]=x.useState(!1),[ce,we]=x.useState(!1),xe=It(),De=x.useMemo(()=>`url('#${Sv(V,he)}')`,[V,he]),_e=x.useMemo(()=>`url('#${Sv(P,he)}')`,[P,he]);if($)return null;const Ee=ze=>{var Ve;const{edges:Xe,addSelectedEdges:re,unselectNodesAndEdges:Fe,multiSelectionActive:se}=xe.getState(),Ce=Xe.find(gt=>gt.id===n);Ce&&(O&&(xe.setState({nodesSelectionActive:!1}),Ce.selected&&se?(Fe({nodes:[],edges:[Ce]}),(Ve=ge.current)==null||Ve.blur()):re([n])),c&&c(ze,Ce))},Ge=vl(n,xe.getState,d),st=vl(n,xe.getState,J),Je=vl(n,xe.getState,I),Ze=vl(n,xe.getState,X),Qe=vl(n,xe.getState,G),fe=(ze,Xe)=>{if(ze.button!==0)return;const{edges:re,isValidConnection:Fe}=xe.getState(),se=Xe?j:k,Ce=(Xe?Z:F)||null,Ve=Xe?"target":"source",gt=Fe||f3,xt=Xe,Te=re.find(wt=>wt.id===n);we(!0),L==null||L(ze,Te,Ve);const tt=wt=>{we(!1),K==null||K(wt,Te,Ve)};MT({event:ze,handleId:Ce,nodeId:se,onConnect:wt=>Y==null?void 0:Y(Te,wt),isTarget:xt,getState:xe.getState,setState:xe.setState,isValidConnection:gt,edgeUpdaterType:Ve,onReconnectEnd:tt})},ye=ze=>fe(ze,!0),Se=ze=>fe(ze,!1),Pe=()=>$e(!0),et=()=>$e(!1),ft=!O&&!c,dt=ze=>{var Xe;if(!me&&xT.includes(ze.key)&&O){const{unselectNodesAndEdges:re,addSelectedEdges:Fe,edges:se}=xe.getState();ze.key==="Escape"?((Xe=ge.current)==null||Xe.blur(),re({edges:[se.find(Ve=>Ve.id===n)]})):Fe([n])}};return pe.createElement("g",{className:Jt(["react-flow__edge",`react-flow__edge-${a}`,s,{selected:h,animated:p,inactive:ft,updating:Re}]),onClick:Ee,onDoubleClick:Ge,onContextMenu:st,onMouseEnter:Je,onMouseMove:Ze,onMouseLeave:Qe,onKeyDown:W?dt:void 0,tabIndex:W?0:void 0,role:W?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":U===null?void 0:U||`Edge from ${k} to ${j}`,"aria-describedby":W?`${BT}-${he}`:void 0,ref:ge},!ce&&pe.createElement(e,{id:n,source:k,target:j,selected:h,animated:p,label:f,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:N,labelBgBorderRadius:_,data:l,style:S,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:A,targetPosition:D,sourceHandleId:F,targetHandleId:Z,markerStart:De,markerEnd:_e,pathOptions:H,interactionWidth:ae}),ee&&pe.createElement(pe.Fragment,null,(ee==="source"||ee===!0)&&pe.createElement(Ak,{position:A,centerX:E,centerY:C,radius:q,onMouseDown:ye,onMouseEnter:Pe,onMouseOut:et,type:"source"}),(ee==="target"||ee===!0)&&pe.createElement(Ak,{position:D,centerX:T,centerY:R,radius:q,onMouseDown:Se,onMouseEnter:Pe,onMouseOut:et,type:"target"})))};return t.displayName="EdgeWrapper",x.memo(t)};function p3(e){const t={default:Yo(e.default||id),straight:Yo(e.bezier||cx),step:Yo(e.step||lx),smoothstep:Yo(e.step||Nd),simplebezier:Yo(e.simplebezier||ix)},n={},s=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,l)=>(a[l]=Yo(e[l]||id),a),n);return{...t,...s}}function Rk(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,l=(n==null?void 0:n.width)||t.width,c=(n==null?void 0:n.height)||t.height;switch(e){case Be.Top:return{x:s+l/2,y:a};case Be.Right:return{x:s+l,y:a+c/2};case Be.Bottom:return{x:s+l/2,y:a+c};case Be.Left:return{x:s,y:a+c/2}}}function Mk(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const m3=(e,t,n,s,a,l)=>{const c=Rk(n,e,t),d=Rk(l,s,a);return{sourceX:c.x,sourceY:c.y,targetX:d.x,targetY:d.y}};function g3({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:a,targetHeight:l,width:c,height:d,transform:h}){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+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const f=ql({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:c/h[2],height:d/h[2]}),m=Math.max(0,Math.min(f.x2,p.x2)-Math.max(f.x,p.x)),y=Math.max(0,Math.min(f.y2,p.y2)-Math.max(f.y,p.y));return Math.ceil(m*y)>0}function Ik(e){var s,a,l,c,d;const t=((s=e==null?void 0:e[jt])==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((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)<"u";return[{x:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.x)||0,y:((d=e==null?void 0:e.positionAbsolute)==null?void 0:d.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const y3=[{level:0,isMaxLevel:!0,edges:[]}];function w3(e,t,n=!1){let s=-1;const a=e.reduce((c,d)=>{var f,m;const h=Gn(d.zIndex);let p=h?d.zIndex:0;if(n){const y=t.get(d.target),v=t.get(d.source),N=d.selected||(y==null?void 0:y.selected)||(v==null?void 0:v.selected),_=Math.max(((f=v==null?void 0:v[jt])==null?void 0:f.z)||0,((m=y==null?void 0:y[jt])==null?void 0:m.z)||0,1e3);p=(h?d.zIndex:0)+(N?_:0)}return c[p]?c[p].push(d):c[p]=[d],s=p>s?p:s,c},{}),l=Object.entries(a).map(([c,d])=>{const h=+c;return{edges:d,level:h,isMaxLevel:h===s}});return l.length===0?y3:l}function v3(e,t,n){const s=ht(x.useCallback(a=>e?a.edges.filter(l=>{const c=t.get(l.source),d=t.get(l.target);return(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&(d==null?void 0:d.width)&&(d==null?void 0:d.height)&&g3({sourcePos:c.positionAbsolute||{x:0,y:0},targetPos:d.positionAbsolute||{x:0,y:0},sourceWidth:c.width,sourceHeight:c.height,targetWidth:d.width,targetHeight:d.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return w3(s,t,n)}const x3=({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"}),b3=({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"}),$k={[od.Arrow]:x3,[od.ArrowClosed]:b3};function k3(e){const t=It();return x.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call($k,e)?$k[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",fs.error009(e)),null)},[e])}const _3=({id:e,type:t,color:n,width:s=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:c,orient:d="auto-start-reverse"})=>{const h=k3(t);return h?pe.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:d,refX:"0",refY:"0"},pe.createElement(h,{color:n,strokeWidth:c})):null},N3=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const d=Sv(c,t);s.includes(d)||(a.push({id:d,color:c.color||e,...c}),s.push(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))},ZT=({defaultColor:e,rfId:t})=>{const n=ht(x.useCallback(N3({defaultColor:e,rfId:t}),[e,t]),(s,a)=>!(s.length!==a.length||s.some((l,c)=>l.id!==a[c].id)));return pe.createElement("defs",null,n.map(s=>pe.createElement(_3,{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})))};ZT.displayName="MarkerDefinitions";var S3=x.memo(ZT);const j3=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}),JT=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:a,noPanClassName:l,onEdgeContextMenu:c,onEdgeMouseEnter:d,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:f,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:v,onReconnectEnd:N,reconnectRadius:_,children:S,disableKeyboardA11y:k})=>{const{edgesFocusable:j,edgesUpdatable:E,elementsSelectable:C,width:T,height:R,connectionMode:A,nodeInternals:D,onError:O}=ht(j3,qt),$=v3(t,D,n);return T?pe.createElement(pe.Fragment,null,$.map(({level:F,edges:Z,isMaxLevel:J})=>pe.createElement("svg",{key:F,style:{zIndex:F},width:T,height:R,className:"react-flow__edges react-flow__container"},J&&pe.createElement(S3,{defaultColor:e,rfId:s}),pe.createElement("g",null,Z.map(I=>{const[X,G,q]=Ik(D.get(I.source)),[Y,L,K]=Ik(D.get(I.target));if(!q||!K)return null;let P=I.type||"default";a[P]||(O==null||O("011",fs.error011(P)),P="default");const V=a[P]||a.default,he=A===Ya.Strict?L.target:(L.target??[]).concat(L.source??[]),U=Mk(G.source,I.sourceHandle),W=Mk(he,I.targetHandle),ee=(U==null?void 0:U.position)||Be.Bottom,H=(W==null?void 0:W.position)||Be.Top,ae=!!(I.focusable||j&&typeof I.focusable>"u"),me=I.reconnectable||I.updatable,ge=typeof y<"u"&&(me||E&&typeof me>"u");if(!U||!W)return O==null||O("008",fs.error008(U,I)),null;const{sourceX:Re,sourceY:$e,targetX:ce,targetY:we}=m3(X,U,ee,Y,W,H);return pe.createElement(V,{key:I.id,id:I.id,className:Jt([I.className,l]),type:P,data:I.data,selected:!!I.selected,animated:!!I.animated,hidden:!!I.hidden,label:I.label,labelStyle:I.labelStyle,labelShowBg:I.labelShowBg,labelBgStyle:I.labelBgStyle,labelBgPadding:I.labelBgPadding,labelBgBorderRadius:I.labelBgBorderRadius,style:I.style,source:I.source,target:I.target,sourceHandleId:I.sourceHandle,targetHandleId:I.targetHandle,markerEnd:I.markerEnd,markerStart:I.markerStart,sourceX:Re,sourceY:$e,targetX:ce,targetY:we,sourcePosition:ee,targetPosition:H,elementsSelectable:C,onContextMenu:c,onMouseEnter:d,onMouseMove:h,onMouseLeave:p,onClick:f,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:v,onReconnectEnd:N,reconnectRadius:_,rfId:s,ariaLabel:I.ariaLabel,isFocusable:ae,isReconnectable:ge,pathOptions:"pathOptions"in I?I.pathOptions:void 0,interactionWidth:I.interactionWidth,disableKeyboardA11y:k})})))),S):null};JT.displayName="EdgeRenderer";var E3=x.memo(JT);const C3=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function T3({children:e}){const t=ht(C3);return pe.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function A3(e){const t=Ql(),n=x.useRef(!1);x.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const R3={[Be.Left]:Be.Right,[Be.Right]:Be.Left,[Be.Top]:Be.Bottom,[Be.Bottom]:Be.Top},e2=({nodeId:e,handleType:t,style:n,type:s=Ws.Bezier,CustomComponent:a,connectionStatus:l})=>{var R,A,D;const{fromNode:c,handleId:d,toX:h,toY:p,connectionMode:f}=ht(x.useCallback(O=>({fromNode:O.nodeInternals.get(e),handleId:O.connectionHandleId,toX:(O.connectionPosition.x-O.transform[0])/O.transform[2],toY:(O.connectionPosition.y-O.transform[1])/O.transform[2],connectionMode:O.connectionMode}),[e]),qt),m=(R=c==null?void 0:c[jt])==null?void 0:R.handleBounds;let y=m==null?void 0:m[t];if(f===Ya.Loose&&(y=y||(m==null?void 0:m[t==="source"?"target":"source"])),!c||!y)return null;const v=d?y.find(O=>O.id===d):y[0],N=v?v.x+v.width/2:(c.width??0)/2,_=v?v.y+v.height/2:c.height??0,S=(((A=c.positionAbsolute)==null?void 0:A.x)??0)+N,k=(((D=c.positionAbsolute)==null?void 0:D.y)??0)+_,j=v==null?void 0:v.position,E=j?R3[j]:null;if(!j||!E)return null;if(a)return pe.createElement(a,{connectionLineType:s,connectionLineStyle:n,fromNode:c,fromHandle:v,fromX:S,fromY:k,toX:h,toY:p,fromPosition:j,toPosition:E,connectionStatus:l});let C="";const T={sourceX:S,sourceY:k,sourcePosition:j,targetX:h,targetY:p,targetPosition:E};return s===Ws.Bezier?[C]=ST(T):s===Ws.Step?[C]=Nv({...T,borderRadius:0}):s===Ws.SmoothStep?[C]=Nv(T):s===Ws.SimpleBezier?[C]=NT(T):C=`M${S},${k} ${h},${p}`,pe.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};e2.displayName="ConnectionLine";const M3=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function I3({containerStyle:e,style:t,type:n,component:s}){const{nodeId:a,handleType:l,nodesConnectable:c,width:d,height:h,connectionStatus:p}=ht(M3,qt);return!(a&&l&&d&&c)?null:pe.createElement("svg",{style:e,width:d,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},pe.createElement("g",{className:Jt(["react-flow__connection",p])},pe.createElement(e2,{nodeId:a,handleType:l,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function Ok(e,t){return x.useRef(null),It(),x.useMemo(()=>t(e),[e])}const t2=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:a,onInit:l,onNodeClick:c,onEdgeClick:d,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:v,onSelectionContextMenu:N,onSelectionStart:_,onSelectionEnd:S,connectionLineType:k,connectionLineStyle:j,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:T,selectionOnDrag:R,selectionMode:A,multiSelectionKeyCode:D,panActivationKeyCode:O,zoomActivationKeyCode:$,deleteKeyCode:F,onlyRenderVisibleElements:Z,elementsSelectable:J,selectNodesOnDrag:I,defaultViewport:X,translateExtent:G,minZoom:q,maxZoom:Y,preventScrolling:L,defaultMarkerColor:K,zoomOnScroll:P,zoomOnPinch:V,panOnScroll:he,panOnScrollSpeed:U,panOnScrollMode:W,zoomOnDoubleClick:ee,panOnDrag:H,onPaneClick:ae,onPaneMouseEnter:me,onPaneMouseMove:ge,onPaneMouseLeave:Re,onPaneScroll:$e,onPaneContextMenu:ce,onEdgeContextMenu:we,onEdgeMouseEnter:xe,onEdgeMouseMove:De,onEdgeMouseLeave:_e,onReconnect:Ee,onReconnectStart:Ge,onReconnectEnd:st,reconnectRadius:Je,noDragClassName:Ze,noWheelClassName:Qe,noPanClassName:fe,elevateEdgesOnSelect:ye,disableKeyboardA11y:Se,nodeOrigin:Pe,nodeExtent:et,rfId:ft})=>{const dt=Ok(e,i3),ze=Ok(t,p3);return A3(l),pe.createElement(a3,{onPaneClick:ae,onPaneMouseEnter:me,onPaneMouseMove:ge,onPaneMouseLeave:Re,onPaneContextMenu:ce,onPaneScroll:$e,deleteKeyCode:F,selectionKeyCode:T,selectionOnDrag:R,selectionMode:A,onSelectionStart:_,onSelectionEnd:S,multiSelectionKeyCode:D,panActivationKeyCode:O,zoomActivationKeyCode:$,elementsSelectable:J,onMove:n,onMoveStart:s,onMoveEnd:a,zoomOnScroll:P,zoomOnPinch:V,zoomOnDoubleClick:ee,panOnScroll:he,panOnScrollSpeed:U,panOnScrollMode:W,panOnDrag:H,defaultViewport:X,translateExtent:G,minZoom:q,maxZoom:Y,onSelectionContextMenu:N,preventScrolling:L,noDragClassName:Ze,noWheelClassName:Qe,noPanClassName:fe,disableKeyboardA11y:Se},pe.createElement(T3,null,pe.createElement(E3,{edgeTypes:ze,onEdgeClick:d,onEdgeDoubleClick:p,onlyRenderVisibleElements:Z,onEdgeContextMenu:we,onEdgeMouseEnter:xe,onEdgeMouseMove:De,onEdgeMouseLeave:_e,onReconnect:Ee,onReconnectStart:Ge,onReconnectEnd:st,reconnectRadius:Je,defaultMarkerColor:K,noPanClassName:fe,elevateEdgesOnSelect:!!ye,disableKeyboardA11y:Se,rfId:ft},pe.createElement(I3,{style:j,type:k,component:E,containerStyle:C})),pe.createElement("div",{className:"react-flow__edgelabel-renderer"}),pe.createElement(u3,{nodeTypes:dt,onNodeClick:c,onNodeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:v,selectNodesOnDrag:I,onlyRenderVisibleElements:Z,noPanClassName:fe,noDragClassName:Ze,disableKeyboardA11y:Se,nodeOrigin:Pe,nodeExtent:et,rfId:ft})))};t2.displayName="GraphView";var $3=x.memo(t2);const Tv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Fs={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:Tv,nodeExtent:Tv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Ya.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:iP,isValidConnection:void 0},O3=()=>kM((e,t)=>({...Fs,setNodes:n=>{const{nodeInternals:s,nodeOrigin:a,elevateNodesOnSelect:l}=t();e({nodeInternals:If(n,s,a,l)})},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",l=typeof s<"u",c=a?If(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:c,edges:l?s:[],hasDefaultNodes:a,hasDefaultEdges:l})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:a,fitViewOnInit:l,fitViewOnInitDone:c,fitViewOnInitOptions:d,domNode:h,nodeOrigin:p}=t(),f=h==null?void 0:h.querySelector(".react-flow__viewport");if(!f)return;const m=window.getComputedStyle(f),{m22:y}=new window.DOMMatrixReadOnly(m.transform),v=n.reduce((_,S)=>{const k=a.get(S.id);if(k!=null&&k.hidden)a.set(k.id,{...k,[jt]:{...k[jt],handleBounds:void 0}});else if(k){const j=ax(S.nodeElement);!!(j.width&&j.height&&(k.width!==j.width||k.height!==j.height||S.forceUpdate))&&(a.set(k.id,{...k,[jt]:{...k[jt],handleBounds:{source:Ck(".source",S.nodeElement,y,p),target:Ck(".target",S.nodeElement,y,p)}},...j}),_.push({id:k.id,type:"dimensions",dimensions:j}))}return _},[]);UT(a,p);const N=c||l&&!c&&WT(t,{initial:!0,...d});e({nodeInternals:new Map(a),fitViewOnInitDone:N}),(v==null?void 0:v.length)>0&&(s==null||s(v))},updateNodePositions:(n,s=!0,a=!1)=>{const{triggerNodeChanges:l}=t(),c=n.map(d=>{const h={id:d.id,type:"position",dragging:a};return s&&(h.positionAbsolute=d.positionAbsolute,h.position=d.position),h});l(c)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:a,hasDefaultNodes:l,nodeOrigin:c,getNodes:d,elevateNodesOnSelect:h}=t();if(n!=null&&n.length){if(l){const p=XP(n,d()),f=If(p,a,c,h);e({nodeInternals:f})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:a,getNodes:l}=t();let c,d=null;s?c=n.map(h=>Us(h,!0)):(c=ei(l(),n),d=ei(a,[])),Cu({changedNodes:c,changedEdges:d,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:a,getNodes:l}=t();let c,d=null;s?c=n.map(h=>Us(h,!0)):(c=ei(a,n),d=ei(l(),[])),Cu({changedNodes:d,changedEdges:c,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:a,getNodes:l}=t(),c=n||l(),d=s||a,h=c.map(f=>(f.selected=!1,Us(f.id,!1))),p=d.map(f=>Us(f.id,!1));Cu({changedNodes:h,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(),l=s().filter(d=>d.selected).map(d=>Us(d.id,!1)),c=n.filter(d=>d.selected).map(d=>Us(d.id,!1));Cu({changedNodes:l,changedEdges:c,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(a=>{a.positionAbsolute=ox(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:a,height:l,d3Zoom:c,d3Selection:d,translateExtent:h}=t();if(!c||!d||!n.x&&!n.y)return!1;const p=ds.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),f=[[0,0],[a,l]],m=c==null?void 0:c.constrain()(p,f,h);return c.transform(d,m),s[0]!==m.x||s[1]!==m.y||s[2]!==m.k},cancelConnection:()=>e({connectionNodeId:Fs.connectionNodeId,connectionHandleId:Fs.connectionHandleId,connectionHandleType:Fs.connectionHandleType,connectionStatus:Fs.connectionStatus,connectionStartHandle:Fs.connectionStartHandle,connectionEndHandle:Fs.connectionEndHandle}),reset:()=>e({...Fs})}),Object.is),px=({children:e})=>{const t=x.useRef(null);return t.current||(t.current=O3()),pe.createElement(eP,{value:t.current},e)};px.displayName="ReactFlowProvider";const n2=({children:e})=>x.useContext(_d)?pe.createElement(pe.Fragment,null,e):pe.createElement(px,null,e);n2.displayName="ReactFlowWrapper";const P3={input:PT,default:Ev,output:DT,group:hx},L3={default:id,straight:cx,step:lx,smoothstep:Nd,simplebezier:ix},D3=[0,0],q3=[15,15],F3={x:0,y:0,zoom:1},B3={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},r2=x.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:a,nodeTypes:l=P3,edgeTypes:c=L3,onNodeClick:d,onEdgeClick:h,onInit:p,onMove:f,onMoveStart:m,onMoveEnd:y,onConnect:v,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:k,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,onNodeDragStart:A,onNodeDrag:D,onNodeDragStop:O,onNodesDelete:$,onEdgesDelete:F,onSelectionChange:Z,onSelectionDragStart:J,onSelectionDrag:I,onSelectionDragStop:X,onSelectionContextMenu:G,onSelectionStart:q,onSelectionEnd:Y,connectionMode:L=Ya.Strict,connectionLineType:K=Ws.Bezier,connectionLineStyle:P,connectionLineComponent:V,connectionLineContainerStyle:he,deleteKeyCode:U="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:ee=!1,selectionMode:H=Fl.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:me=ad()?"Meta":"Control",zoomActivationKeyCode:ge=ad()?"Meta":"Control",snapToGrid:Re=!1,snapGrid:$e=q3,onlyRenderVisibleElements:ce=!1,selectNodesOnDrag:we=!0,nodesDraggable:xe,nodesConnectable:De,nodesFocusable:_e,nodeOrigin:Ee=D3,edgesFocusable:Ge,edgesUpdatable:st,elementsSelectable:Je,defaultViewport:Ze=F3,minZoom:Qe=.5,maxZoom:fe=2,translateExtent:ye=Tv,preventScrolling:Se=!0,nodeExtent:Pe,defaultMarkerColor:et="#b1b1b7",zoomOnScroll:ft=!0,zoomOnPinch:dt=!0,panOnScroll:ze=!1,panOnScrollSpeed:Xe=.5,panOnScrollMode:re=Wa.Free,zoomOnDoubleClick:Fe=!0,panOnDrag:se=!0,onPaneClick:Ce,onPaneMouseEnter:Ve,onPaneMouseMove:gt,onPaneMouseLeave:xt,onPaneScroll:Te,onPaneContextMenu:tt,children:pt,onEdgeContextMenu:wt,onEdgeDoubleClick:Yt,onEdgeMouseEnter:Fr,onEdgeMouseMove:Qn,onEdgeMouseLeave:Br,onEdgeUpdate:Zn,onEdgeUpdateStart:to,onEdgeUpdateEnd:zr,onReconnect:Xs,onReconnectStart:Ur,onReconnectEnd:Mn,reconnectRadius:Wr=10,edgeUpdaterRadius:ys=10,onNodesChange:Ft,onEdgesChange:vr,noDragClassName:Qs="nodrag",noWheelClassName:Ni="nowheel",noPanClassName:no="nopan",fitView:In=!1,fitViewOptions:Zs,connectOnClick:Js=!0,attributionPosition:ea,proOptions:ta,defaultEdgeOptions:na,elevateNodesOnSelect:ra=!0,elevateEdgesOnSelect:ro=!1,disableKeyboardA11y:sa=!1,autoPanOnConnect:Si=!0,autoPanOnNodeDrag:mt=!0,connectionRadius:so=20,isValidConnection:aa,onError:Hr,style:Gr,id:Vr,nodeDragThreshold:oa,...Yr},Ot)=>{const ia=Vr||"1";return pe.createElement("div",{...Yr,style:{...Gr,...B3},ref:Ot,className:Jt(["react-flow",a]),"data-testid":"rf__wrapper",id:Vr},pe.createElement(n2,null,pe.createElement($3,{onInit:p,onMove:f,onMoveStart:m,onMoveEnd:y,onNodeClick:d,onEdgeClick:h,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,nodeTypes:l,edgeTypes:c,connectionLineType:K,connectionLineStyle:P,connectionLineComponent:V,connectionLineContainerStyle:he,selectionKeyCode:W,selectionOnDrag:ee,selectionMode:H,deleteKeyCode:U,multiSelectionKeyCode:me,panActivationKeyCode:ae,zoomActivationKeyCode:ge,onlyRenderVisibleElements:ce,selectNodesOnDrag:we,defaultViewport:Ze,translateExtent:ye,minZoom:Qe,maxZoom:fe,preventScrolling:Se,zoomOnScroll:ft,zoomOnPinch:dt,zoomOnDoubleClick:Fe,panOnScroll:ze,panOnScrollSpeed:Xe,panOnScrollMode:re,panOnDrag:se,onPaneClick:Ce,onPaneMouseEnter:Ve,onPaneMouseMove:gt,onPaneMouseLeave:xt,onPaneScroll:Te,onPaneContextMenu:tt,onSelectionContextMenu:G,onSelectionStart:q,onSelectionEnd:Y,onEdgeContextMenu:wt,onEdgeDoubleClick:Yt,onEdgeMouseEnter:Fr,onEdgeMouseMove:Qn,onEdgeMouseLeave:Br,onReconnect:Xs??Zn,onReconnectStart:Ur??to,onReconnectEnd:Mn??zr,reconnectRadius:Wr??ys,defaultMarkerColor:et,noDragClassName:Qs,noWheelClassName:Ni,noPanClassName:no,elevateEdgesOnSelect:ro,rfId:ia,disableKeyboardA11y:sa,nodeOrigin:Ee,nodeExtent:Pe}),pe.createElement(AP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:v,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:k,nodesDraggable:xe,nodesConnectable:De,nodesFocusable:_e,edgesFocusable:Ge,edgesUpdatable:st,elementsSelectable:Je,elevateNodesOnSelect:ra,minZoom:Qe,maxZoom:fe,nodeExtent:Pe,onNodesChange:Ft,onEdgesChange:vr,snapToGrid:Re,snapGrid:$e,connectionMode:L,translateExtent:ye,connectOnClick:Js,defaultEdgeOptions:na,fitView:In,fitViewOptions:Zs,onNodesDelete:$,onEdgesDelete:F,onNodeDragStart:A,onNodeDrag:D,onNodeDragStop:O,onSelectionDrag:I,onSelectionDragStart:J,onSelectionDragStop:X,noPanClassName:no,nodeOrigin:Ee,rfId:ia,autoPanOnConnect:Si,autoPanOnNodeDrag:mt,onError:Hr,connectionRadius:so,isValidConnection:aa,nodeDragThreshold:oa}),pe.createElement(CP,{onSelectionChange:Z}),pt,pe.createElement(nP,{proOptions:ta,position:ea}),pe.createElement(OP,{rfId:ia,disableKeyboardA11y:sa})))});r2.displayName="ReactFlow";const z3=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function s2(){return ht(z3,qt)}const a2=({id:e,x:t,y:n,width:s,height:a,style:l,color:c,strokeColor:d,strokeWidth:h,className:p,borderRadius:f,shapeRendering:m,onClick:y,selected:v})=>{const{background:N,backgroundColor:_}=l||{},S=c||N||_;return pe.createElement("rect",{className:Jt(["react-flow__minimap-node",{selected:v},p]),x:t,y:n,rx:f,ry:f,width:s,height:a,fill:S,stroke:d,strokeWidth:h,shapeRendering:m,onClick:y?k=>y(k,e):void 0})};a2.displayName="MiniMapNode";var U3=x.memo(a2);const W3=e=>e.nodeOrigin,H3=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Lf=e=>e instanceof Function?e:()=>e;function G3({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:l=U3,onClick:c}){const d=ht(H3,qt),h=ht(W3),p=Lf(t),f=Lf(e),m=Lf(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return pe.createElement(pe.Fragment,null,d.map(v=>{const{x:N,y:_}=Ga(v,h).positionAbsolute;return pe.createElement(l,{key:v.id,x:N,y:_,width:v.width,height:v.height,style:v.style,selected:v.selected,className:m(v),color:p(v),borderRadius:s,strokeColor:f(v),strokeWidth:a,shapeRendering:y,onClick:c,id:v.id})}))}var V3=x.memo(G3);const Y3=200,K3=150,X3=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?aP(Sd(t,e.nodeOrigin),n):n,rfId:e.rfId}},Q3="react-flow__minimap-desc";function o2({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:c=2,nodeComponent:d,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:f=1,position:m="bottom-right",onClick:y,onNodeClick:v,pannable:N=!1,zoomable:_=!1,ariaLabel:S="React Flow mini map",inversePan:k=!1,zoomStep:j=10,offsetScale:E=5}){const C=It(),T=x.useRef(null),{boundingRect:R,viewBB:A,rfId:D}=ht(X3,qt),O=(e==null?void 0:e.width)??Y3,$=(e==null?void 0:e.height)??K3,F=R.width/O,Z=R.height/$,J=Math.max(F,Z),I=J*O,X=J*$,G=E*J,q=R.x-(I-R.width)/2-G,Y=R.y-(X-R.height)/2-G,L=I+G*2,K=X+G*2,P=`${Q3}-${D}`,V=x.useRef(0);V.current=J,x.useEffect(()=>{if(T.current){const W=Hn(T.current),ee=me=>{const{transform:ge,d3Selection:Re,d3Zoom:$e}=C.getState();if(me.sourceEvent.type!=="wheel"||!Re||!$e)return;const ce=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*j,we=ge[2]*Math.pow(2,ce);$e.scaleTo(Re,we)},H=me=>{const{transform:ge,d3Selection:Re,d3Zoom:$e,translateExtent:ce,width:we,height:xe}=C.getState();if(me.sourceEvent.type!=="mousemove"||!Re||!$e)return;const De=V.current*Math.max(1,ge[2])*(k?-1:1),_e={x:ge[0]-me.sourceEvent.movementX*De,y:ge[1]-me.sourceEvent.movementY*De},Ee=[[0,0],[we,xe]],Ge=ds.translate(_e.x,_e.y).scale(ge[2]),st=$e.constrain()(Ge,Ee,ce);$e.transform(Re,st)},ae=pT().on("zoom",N?H:null).on("zoom.wheel",_?ee:null);return W.call(ae),()=>{W.on("zoom",null)}}},[N,_,k,j]);const he=y?W=>{const ee=cr(W);y(W,{x:ee[0],y:ee[1]})}:void 0,U=v?(W,ee)=>{const H=C.getState().nodeInternals.get(ee);v(W,H)}:void 0;return pe.createElement(sx,{position:m,style:e,className:Jt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},pe.createElement("svg",{width:O,height:$,viewBox:`${q} ${Y} ${L} ${K}`,role:"img","aria-labelledby":P,ref:T,onClick:he},S&&pe.createElement("title",{id:P},S),pe.createElement(V3,{onClick:U,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:d}),pe.createElement("path",{className:"react-flow__minimap-mask",d:`M${q-G},${Y-G}h${L+G*2}v${K+G*2}h${-L-G*2}z
|
|
57
|
+
M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:f,pointerEvents:"none"})))}o2.displayName="MiniMap";var Z3=x.memo(o2);function J3(){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 eL(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},pe.createElement("path",{d:"M0 0h32v4.2H0z"}))}function tL(){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 nL(){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 rL(){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 Or=({children:e,className:t,...n})=>pe.createElement("button",{type:"button",className:Jt(["react-flow__controls-button",t]),...n},e);Or.displayName="ControlButton";const sL=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),i2=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:c,onFitView:d,onInteractiveChange:h,className:p,children:f,position:m="bottom-left"})=>{const y=It(),[v,N]=x.useState(!1),{isInteractive:_,minZoomReached:S,maxZoomReached:k}=ht(sL,qt),{zoomIn:j,zoomOut:E,fitView:C}=Ql();if(x.useEffect(()=>{N(!0)},[]),!v)return null;const T=()=>{j(),l==null||l()},R=()=>{E(),c==null||c()},A=()=>{C(a),d==null||d()},D=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),h==null||h(!_)};return pe.createElement(sx,{className:Jt(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},t&&pe.createElement(pe.Fragment,null,pe.createElement(Or,{onClick:T,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},pe.createElement(J3,null)),pe.createElement(Or,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},pe.createElement(eL,null))),n&&pe.createElement(Or,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},pe.createElement(tL,null)),s&&pe.createElement(Or,{className:"react-flow__controls-interactive",onClick:D,title:"toggle interactivity","aria-label":"toggle interactivity"},_?pe.createElement(rL,null):pe.createElement(nL,null)),f)};i2.displayName="Controls";var aL=x.memo(i2),pr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(pr||(pr={}));function oL({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 iL({color:e,radius:t}){return pe.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const lL={[pr.Dots]:"#91919a",[pr.Lines]:"#eee",[pr.Cross]:"#e2e2e2"},cL={[pr.Dots]:1,[pr.Lines]:1,[pr.Cross]:6},uL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function l2({id:e,variant:t=pr.Dots,gap:n=20,size:s,lineWidth:a=1,offset:l=2,color:c,style:d,className:h}){const p=x.useRef(null),{transform:f,patternId:m}=ht(uL,qt),y=c||lL[t],v=s||cL[t],N=t===pr.Dots,_=t===pr.Cross,S=Array.isArray(n)?n:[n,n],k=[S[0]*f[2]||1,S[1]*f[2]||1],j=v*f[2],E=_?[j,j]:k,C=N?[j/l,j/l]:[E[0]/l,E[1]/l];return pe.createElement("svg",{className:Jt(["react-flow__background",h]),style:{...d,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},pe.createElement("pattern",{id:m+e,x:f[0]%k[0],y:f[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},N?pe.createElement(iL,{color:y,radius:j/l}):pe.createElement(oL,{dimensions:E,color:y,lineWidth:a})),pe.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}l2.displayName="Background";var dL=x.memo(l2);const hL=["us-gov","global","apac","us","eu","jp","au"],fL=new RegExp(`^(?:(?:${hL.join("|")})\\.)?anthropic\\.`,"i");function Zl(e){return e.replace(fL,"")}const pL=["command","cmd","file_path","path","url","pattern","notebook_path"],Pk=120,Df=e=>e.length>Pk?`${e.slice(0,Pk-1)}…`:e;function mL(e){if(typeof e=="string")return e.trim()?Df(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of pL){const s=t[n];if(typeof s=="string"&&s.trim())return Df(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(a=>typeof a=="string")){const a=s.join(" ").trim();if(a)return Df(a)}}return null}function c2(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function mx(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 gL(e){const t=mx(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 yL(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]=gL(s));return Object.keys(t).length?t:void 0}function u2(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),...mx(n)};for(const s of Object.values(n)){const a=u2(s,t+1);if(a)return a}return null}const wL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function d2(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&wL.test(Zl(n.model)))return n.model;for(const s of Object.values(n)){const a=d2(s,t+1);if(a)return a}return null}function Av(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Gs(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Lk(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Jl(e,t){return`${e}::${t}`}function ld(e){return e.agent_type??e.subagent_type??"subagent"}function Ml(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function ti(e,t,n,s){const a=t;let l=e.agents.get(a);return l||(l={id:a,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:c2()},e.agents.set(a,l),l)}function h2(e,t,n,s){const a=Jl(t,n),l=e.agents.get(a);if(!l)return null;!l.cwd&&s.cwd&&(l.cwd=s.cwd,l.cwdBasename=Gs(s.cwd));const c=ld(s);return c&&(l.label==="subagent"||!l.label)&&(l.label=c),l}function vL(e,t,n){const s=t.session_id??"unknown",a=Ml(t);if(a){const h=h2(e,s,a,t);if(h)return h}const l=e.activeSubagentStack.get(s),c=l&&l.length>0?l[l.length-1]:null;if(c){const h=e.agents.get(Jl(s,c));if(h)return!h.cwd&&t.cwd&&(h.cwd=t.cwd,h.cwdBasename=Gs(t.cwd)),h}const d=ti(e,s,n,t.hook_event_name!=="SessionStart");return!d.cwd&&t.cwd&&(d.cwd=t.cwd,d.cwdBasename=Gs(t.cwd)),d.label==="session"&&t.cwd&&(d.label=Gs(t.cwd)??"session"),d}function xL(e,t,n,s,a){const l=Jl(t,n),c=ti(e,t,a,!0);let d=e.agents.get(l);if(d){!d.cwd&&s.cwd&&(d.cwd=s.cwd,d.cwdBasename=Gs(s.cwd));const h=ld(s);return h&&(d.label==="subagent"||!d.label)&&(d.label=h),d}return d={id:l,sessionId:t,label:ld(s),kind:"subagent",parentId:c.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:s.cwd,cwdBasename:Gs(s.cwd),toolCount:0,childCount:0,usage:c2()},e.agents.set(l,d),c.childCount+=1,d}function bL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function kL(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 Au(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 Dk=200,_L=25;function NL(e,t){const n=t.tools;if(n.length>Dk){const s=n.splice(0,n.length-Dk);for(const a of s)e.toolIndex.get(a.id)===a&&(e.toolIndex.delete(a.id),e.toolOwner.delete(a.id))}for(let s=n.length-_L-1;s>=0;s--){const a=n[s];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function SL(e,t,n){const s=e.toolIndex.get(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 qk=2e3;function jL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const a=e.prompts[s];if(a.at<t-qk)return!1;if(a.text===n&&a.at<=t+qk)return!0}return!1}function f2(e,t){for(const n of t.tools)e.toolIndex.get(n.id)===n&&e.toolIndex.delete(n.id),e.toolOwner.get(n.id)===t.id&&e.toolOwner.delete(n.id)}function ec(e,t){return t&&(e.revision+=1),t}function EL(e,t,n,s){if(e.agents.size<=n)return!1;const a=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>s,l=[],c=new Map;for(const[p,f]of e.agents){if(f.parentId!=null){const m=c.get(f.parentId);m?m.push(p):c.set(f.parentId,[p])}a(f)&&l.push({id:p,endedAt:f.endedAt})}if(l.length===0)return!1;l.sort((p,f)=>p.endedAt-f.endedAt);let d=0;const h=p=>{const f=e.agents.get(p);f&&(f2(e,f),e.agents.delete(p),d++)};for(const p of l){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const f=(c.get(p.id)??[]).map(m=>e.agents.get(m)).filter(m=>m!=null);if(!f.some(m=>!a(m))){for(const m of f)h(m.id);h(p.id)}}return ec(e,d>0)}function CL(e,t,n,s){const a=new Map;for(const[p,f]of e.agents){let m=a.get(f.sessionId);m||(m={ids:[],endedAt:0,live:!1,closed:!1},a.set(f.sessionId,m)),m.ids.push(p),f.kind==="root"&&f.closedAt!=null&&(m.closed=!0),f.state==="done"&&f.endedAt!=null?m.endedAt=Math.max(m.endedAt,f.endedAt):m.live=!0}const l=[...a.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>s).sort((p,f)=>p.closed===f.closed?p.endedAt-f.endedAt:p.closed?-1:1);let d=[...a.values()].filter(p=>!p.live).length-n;if(d<=0)return!1;let h=!1;for(const p of l){if(d<=0)break;for(const f of p.ids){const m=e.agents.get(f);m&&f2(e,m),e.agents.delete(f)}d--,h=!0}return ec(e,h)}function TL(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&&e.toolIndex.has(a)}function AL(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 RL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.provider==="codex")continue;const l=e.agents.get(a.sessionId),c=(l==null?void 0:l.lastEventAt)??(l==null?void 0:l.startedAt);for(const d of a.tools){const h=Math.max(d.startedAt,c??d.startedAt);d.endedAt==null&&t-h>n&&(d.endedAt=h,d.ok=!1,d.errorPreview=d.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(d.id),e.toolOwner.delete(d.id),s=!0)}}return ec(e,s)}const Fk=90*6e4;function ML(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.kind!=="root")continue;const l=a.lastEventAt??a.startedAt;if(!(t-l<=n)){a.waiting&&(a.waiting=null,s=!0),a.closedAt==null&&(a.closedAt=l),a.state==="active"&&(a.state="done",a.endedAt=l,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=l,s=!0);e.activeSubagentStack.delete(a.sessionId)}}return ec(e,s)}function IL(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const $L=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function OL(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 PL=3e4;function LL(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>PL)&&!(e.startedAt>t))return{name:e.name,preview:mL(e.input)??""}}function DL(e,t,n,s,a){if(n!=="permission")return{kind:n,message:s,since:a};const l=OL(e,t),c={kind:n,message:s,since:a};l!=null&&l.explicitSubagentId&&(c.subagentId=l.explicitSubagentId);const d=LL(l,a);return d&&(c.tool=d),c}function qL(e,t,n){if(e.kind==="idle")return!0;const s=Ml(t);return s==null?!0:e.subagentId!=null&&Jl(n,s)===e.subagentId}function Bk(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,l=s.hook_event_name??"Unknown";if(l==="__clear")return{...Av(),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(!$L.has(l)){const f=e.agents.get(c);f!=null&&f.waiting&&qL(f.waiting,s,c)&&(f.waiting=null)}const d=e.agents.get(c);if(d&&a>(d.lastEventAt??0)&&(d.lastEventAt=a,d.reaped&&(d.reaped=!1,d.state="active",d.endedAt=void 0,d.closedAt=void 0)),typeof s.model_context_window=="number"&&s.model_context_window>0){const f=e.agents.get(c);f&&(f.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const f=e.agents.get(c);f&&(f.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const f=e.agents.get(c);f&&(f.context={...f.context??Lk(),currentContextTokens:s.context_tokens})}if(l==="ModelObserved"){const f=typeof s.model=="string"?s.model:null;if(f){const y=e.agents.get(c);y&&(y.model=f)}const m=s.subagentModels;if(m&&typeof m=="object")for(const[y,v]of Object.entries(m)){if(typeof v!="string")continue;const N=`${c}::${y}`,_=e.agents.get(N);_&&(_.model=v)}return e}if(l==="ContextObserved"){const f=s.context??null;if(f){const m=e.agents.get(c);if(m){const y=m.context??Lk(),v=(_,S)=>typeof f[_]=="number"?f[_]:S,N=Array.isArray(f.memoryFiles)?f.memoryFiles:Array.isArray(f.claudeMdFiles)?f.claudeMdFiles:null;m.context={msgsUser:v("msgsUser",y.msgsUser),msgsAssistant:v("msgsAssistant",y.msgsAssistant),toolUses:v("toolUses",y.toolUses),toolResults:v("toolResults",y.toolResults),systemReminders:v("systemReminders",y.systemReminders),currentContextTokens:v("currentContextTokens",y.currentContextTokens),memoryFiles:N??y.memoryFiles}}}return e}if(l==="SessionNamed"){const f=e.agents.get(c);if(f){const m=typeof s.sessionName=="string"?s.sessionName.trim():"",y=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";m&&(f.sessionName=m),y&&(f.sessionTitle=y);const v=f.sessionName??"";f.sessionTitle&&v&&f.sessionTitle.toLowerCase()===v.toLowerCase()&&(f.sessionTitle=void 0)}return e}if(l==="OutputObserved"){const f=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(!f)return e;const y=e.agents.get(c);if(!y||y.lastOutputAt!=null&&m<=y.lastOutputAt)return e;if(y.lastOutputAt=m,f!=="tool_use"){const v=(y.outputs??[]).filter(N=>m-N<FL);v.push(m),y.outputs=v.length>zk?v.slice(-zk):v}return e.revision+=1,e}if(l==="UsageObserved"){const f=s.usage??null;if(f){const m=e.agents.get(c);if(m){m.usage.inputTokens=Number(f.input_tokens??0),m.usage.outputTokens=Number(f.output_tokens??0),m.usage.cacheReadTokens=Number(f.cache_read_input_tokens??f.cached_input_tokens??0),m.usage.cacheCreateTokens=Number(f.cache_creation_input_tokens??f.cache_write_input_tokens??0);const y=mx(f);m.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,m.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof f.reasoning_output_tokens=="number"&&(m.usage.reasoningOutputTokens=Number(f.reasoning_output_tokens)),m.usageByModel=yL(s.usageByModel)}}return e}const h=vL(e,s,a);h.provider||(h.provider=s.provider==="codex"?"codex":"claude");const p=d2(s);switch(p&&(h.model=p),l){case"SessionStart":{const f=ti(e,c,a,!1);f.synthetic=!1,f.state="active",f.closedAt=void 0,f.startedAt=f.startedAt||a,!f.cwd&&s.cwd&&(f.cwd=s.cwd,f.cwdBasename=Gs(s.cwd)),f.label==="session"&&s.cwd&&(f.label=Gs(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 f=ti(e,c,a,!1);f.state="active",f.endedAt=void 0,f.closedAt=void 0,f.exitAt=void 0;const m=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";m&&!jL(f,a,m)&&(f.prompts.push({at:a,text:m}),f.firstPrompt||(f.firstPrompt=Au(m,120)));break}case"PreToolUse":{const f=s.tool_use_id?SL(e,h,s.tool_use_id):null;if(f){s.tool_name&&f.name==="?"&&(f.name=s.tool_name),f.endedAt==null&&!f.trimmed&&s.tool_input!==void 0&&(f.input=s.tool_input,f.inputPreview=Au(s.tool_input));break}const m=s.tool_use_id??`${h.id}:${h.toolCount}`,y=Ml(s),v={id:m,name:s.tool_name??"?",input:s.tool_input,inputPreview:Au(s.tool_input),agentId:h.id,explicitSubagentId:y?Jl(c,y):void 0,startedAt:a};h.tools.push(v),h.toolCount+=1,h.state="active",e.toolIndex.set(m,v),e.toolOwner.set(m,h.id),NL(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const f=s.tool_use_id;if(!f)break;let m=e.toolIndex.get(f),y=!1;if(!m)for(const N of e.agents.values()){const _=N.tools.find(S=>S.id===f);if(_){m=_,y=!0;break}}if(!m||m.outcomeApplied)break;m.outcomeApplied=!0,m.outcomeGap=void 0,m.endedAt=a,m.ok=l==="PostToolUse",m.trimmed||(m.response=s.tool_response),l==="PostToolUseFailure"?m.errorPreview=Au(s.tool_response):y&&(m.errorPreview=void 0);const v=u2(s.tool_response);v&&(m.usage=v),e.toolIndex.delete(f),e.toolOwner.delete(f);break}case"SubagentStart":{const f=Ml(s);if(!f)break;const m=xL(e,c,f,s,a);m.state="active",m.startedAt=m.startedAt||a,m.exitAt=void 0,m.endedAt=void 0;const y=ld(s);y&&(m.label=y),bL(e,c,f);break}case"SubagentStop":{const f=Ml(s);if(!f)break;const m=h2(e,c,f,s);if(!m)break;m.state="done",m.endedAt=a,kL(e,c,f);break}case"Stop":case"SessionEnd":{const f=ti(e,c,a,!1);f.state="done",f.endedAt=a;for(const m of f.provider==="codex"?[]:f.tools)m.endedAt==null&&(m.endedAt=a,m.ok=!1,m.errorPreview=m.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"the turn ended before this call returned",e.toolIndex.delete(m.id),e.toolOwner.delete(m.id));l==="SessionEnd"&&(f.closedAt=a),e.activeSubagentStack.delete(c);break}case"Notification":{const f=IL(s.notification_type);if(!f)break;const m=ti(e,c,a,!1),y=typeof s.message=="string"?s.message:"",v=m.waiting;m.waiting=v&&v.kind===f&&v.message===y?{...v,since:Math.min(v.since,a)}:DL(e,c,f,y,a);break}}return e}const FL=6e4,zk=64;function gx(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 BL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},zL=[{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:BL},{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[-_]5[-_.]6[-_]cyber/i,rates:{input:12.5,output:75,cacheRead:1.25,cacheWrite:0}},{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/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:6.25}},{match:/^gpt[-_]5[-_.]5[-_]pro/i,rates:{input:30,output:180,cacheRead:30,cacheWrite:0}},{match:/^gpt[-_]5[-_.]5\b/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 UL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function yi(e,t=Date.now()){if(!e)return null;const n=Zl(e);for(const s of zL)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function p2(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),l=s+a,c=t.cacheWrite1h??t.cacheWrite;return{tokens5m:l,tokens1h:n,usd5m:l*t.cacheWrite/1e6,usd1h:n*c/1e6}}function m2(e,t,n=Date.now()){if(!UL(t))return e.inputTokens;const s=yi(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 yx(e,t,n=Date.now()){const s=yi(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=m2(e,t,n)*s.input/1e6,l=e.outputTokens*s.output/1e6,c=e.cacheReadTokens*s.cacheRead/1e6,d=p2(e,s),h=d.usd5m+d.usd1h;return{input:a,output:l,cacheRead:c,cacheWrite:h,total:a+l+c+h}}const Uk=2e5,WL=1e6,HL=[/\[1m\]/i,/^claude[-_]opus[-_]5\b/i,/^claude[-_]sonnet[-_]5\b/i,/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b/i,/^claude[-_]sonnet[-_]4[-_.]6\b/i,/^claude[-_](fable|mythos)[-_]5\b/i],GL=[{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 VL(e){if(!e)return Uk;const t=Zl(e);for(const n of HL)if(n.test(t))return WL;for(const n of GL)if(n.match.test(t))return n.window;return Uk}function g2(e,t){return typeof e=="number"&&e>0?e:VL(t)}const Jo="not priced";function ot(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 wx(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${ot(s)}/min`:`${ot(n*3600)}/hr`}function YL(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 KL(e,t){let n=0,s=0,a=0,l=0,c=0,d=0;for(const m of t)n+=m.inputTokens,s+=m.outputTokens,a+=m.cacheReadTokens,l+=m.cacheCreateTokens,c+=m.cacheCreate1hTokens??0,d+=m.cacheCreate5mTokens??0;const h=(m,y)=>Math.max(0,m-y),p={inputTokens:h(e.inputTokens,n),outputTokens:h(e.outputTokens,s),cacheReadTokens:h(e.cacheReadTokens,a),cacheCreateTokens:h(e.cacheCreateTokens,l)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=h(e.cacheCreate1hTokens??0,c),p.cacheCreate5mTokens=h(e.cacheCreate5mTokens??0,d)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function tc(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(l=>({model:l,usage:t[l]})),a=KL(e.usage,s.map(l=>l.usage));if(a){const l=s.findIndex(c=>c.model===e.model);l>=0?s[l]={model:s[l].model,usage:YL(s[l].usage,a)}:s.push({model:e.model,usage:a})}return s}function An(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of tc(e)){const a=yx(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 Rv(e,t=Date.now()){let n=0;for(const s of tc(e))yi(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function y2(e){const t=[];for(const n of tc(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 w2(e){return y2(e).filter(t=>t!==e.model)}const XL=new Set(["untrusted","on-request","on-failure"]);function QL(e){return typeof e!="string"||!e?null:XL.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=QL(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
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
|
|
60
|
-
Likely on: ${n}`:t}function t4(e,t,n,s=!0){if(!s)return[];if(n)return[];const a=[];for(const l of e){if(!
|
|
61
|
-
no published rate in this build — the tokens are counted, the dollars are not`;const s=f=>f.toLocaleString(),a=f=>`$${f}/MTok`,l=yx(e,t),c=
|
|
62
|
-
`)}function
|
|
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 Wk(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Vs(e){const t=Zl(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const a=Wk(n[1]),l=n[2].replace(/[-_]/g,".");return`${a} ${l}`}const s=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(s){const a=s[1].replace(/[-_]/g,"."),l=s[2].split(/[-_]/).filter(Boolean).map(Wk);return[`GPT-${a}`,...l].join(" ")}return e}function jd(e){const t=Zl(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function nc(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function Hk(e){const t=[];for(const n of e)n.kind==="root"&&nc(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 JL(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function Ed(e,t){return`${e}@${t.since}`}function v2(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 e4(e){const t=e.message||"Needs your permission",n=v2(e,t);return n?`${t}
|
|
60
|
+
Likely on: ${n}`:t}function t4(e,t,n,s=!0){if(!s)return[];if(n)return[];const a=[];for(const l of e){if(!nc(l.waiting))continue;const c=Ed(l.id,l.waiting);t.has(c)||a.push({key:c,title:l.label,body:e4(l.waiting),sessionId:l.id})}return a}function n4(e,t,n){const s=new Set;for(const l of e)s.add(Ed(l.id,l.waiting));const a=new Set;for(const l of n)s.has(l)&&a.add(l);for(const l of t)a.add(l.key);return a}function Gk(e){return new Set(e.map(t=>Ed(t.id,t.waiting)))}function r4(e,t){return e!==t}function Mt(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 cd(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 l=Math.floor(a/60),c=a%60;return`${l}m ${String(c).padStart(2,"0")}s`}function x2(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 b2(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 s4=1;function a4(){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 l={dismiss:s,layer:a,seq:t++};return e.push(l),()=>{const c=e.indexOf(l);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 ud=a4();function o4(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function Vk(e){return String(e.tagName??"").toUpperCase()==="BODY"}function i4(e,t){return!e||!e.isConnected||Vk(e)?!1:t==null||Vk(t)}const Yk="a[href], button, input, select, textarea, [tabindex]";function l4(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function c4(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function u4({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 vx(e){return e.ctrlKey||e.metaKey||e.altKey}const d4=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),h4=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),f4=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function k2(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function xx(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=k2(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!d4.has(String(e.type??"text").toLowerCase())}function p4(e){if(!e)return!1;if(xx(e)||h4.has(k2(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(n=>f4.has(n))}function m4({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function _2(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(Yk))return l4({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&c4({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(Yk)!=null})}):[]}function g4(e,t){const n=_2(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 Vt(e,t={}){const{focusRef:n,layer:s}=t,a=x.useRef(null),l=x.useRef(e);l.current=e;const c=x.useRef(null);c.current===null&&(c.current=()=>l.current());const d=c.current;return x.useEffect(()=>ud.push(d,s),[d,s]),x.useEffect(()=>{var p;const h=document.activeElement;return(p=(n==null?void 0:n.current)??_2(a.current)[0])==null||p.focus(),()=>{i4(h,document.activeElement)&&h.focus()}},[]),x.useEffect(()=>{const h=p=>{var _;if(p.key!=="Tab"||vx(p))return;const f=a.current;if(!f)return;const m=document.activeElement;if(!(m!=null&&f.contains(m))&&!ud.isTop(d))return;const v=g4(f,m),N=u4({count:v.length,index:m?v.indexOf(m):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((_=v[N.index])==null||_.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[d]),a}function y4(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 Wn(e){return e.toLocaleString()}function w4(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const v4=60;function x4(e,t=v4){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 b4({agent:e,onClose:t}){var y;const n=x.useRef(null),s=Vt(t,{focusRef:n}),a=e.context,l=e.usage,c=(a==null?void 0:a.currentContextTokens)??0,d=g2(e.contextWindow,e.model),h=Math.min(100,c/d*100),p=An(e),f=l.inputTokens+l.cacheReadTokens+l.cacheCreateTokens,m=y4(e.provider);return i.jsx("div",{className:"ctx-modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:s,className:"ctx-modal",onClick:v=>v.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[i.jsxs("header",{className:"ctx-modal-head",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),i.jsx("div",{className:"ctx-modal-sub",children:m.subtitle})]}),i.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),i.jsxs("section",{className:"ctx-window-row",children:[i.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(h),children:i.jsx("div",{className:"ctx-window-fill",style:{width:`${h}%`}})}),i.jsxs("div",{className:"ctx-window-meta",children:[i.jsxs("span",{className:"ctx-window-pct",children:[h.toFixed(1),"%"]}),i.jsxs("span",{children:[Wn(c)," / ",Wn(d)," tok (",m.windowScope,")"]})]})]}),i.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),i.jsxs("div",{className:"ctx-grid",children:[i.jsx(lr,{label:"input tokens",val:Wn(l.inputTokens)}),i.jsx(lr,{label:"output tokens",val:Wn(l.outputTokens)}),i.jsx(lr,{label:"cache reads",val:Wn(l.cacheReadTokens)}),i.jsx(lr,{label:"cache writes",val:Wn(l.cacheCreateTokens)}),i.jsx(lr,{label:"cumulative total",val:Wn(f)}),i.jsx(lr,{label:"estimated cost",val:ot(p.total),accent:!0})]}),i.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),m.compositionCounted?i.jsxs("div",{className:"ctx-grid",children:[i.jsx(lr,{label:"user messages",val:Wn((a==null?void 0:a.msgsUser)??0)}),i.jsx(lr,{label:"assistant messages",val:Wn((a==null?void 0:a.msgsAssistant)??0)}),i.jsx(lr,{label:"tool uses",val:Wn((a==null?void 0:a.toolUses)??0)}),i.jsx(lr,{label:"tool results",val:Wn((a==null?void 0:a.toolResults)??0)}),i.jsx(lr,{label:"system-reminders",val:Wn((a==null?void 0:a.systemReminders)??0)})]}):i.jsx("div",{className:"ctx-empty",children:m.compositionUncounted}),i.jsx("h3",{className:"ctx-section-title",children:m.memoryHeading}),(((y=a==null?void 0:a.memoryFiles)==null?void 0:y.length)??0)===0?i.jsx("div",{className:"ctx-empty",children:m.memoryEmpty}):i.jsx("ul",{className:"ctx-md-list",children:a.memoryFiles.map(v=>i.jsxs("li",{children:[i.jsx("span",{className:"ctx-md-path",title:v.path,children:x4(v.path)}),i.jsx("span",{className:"ctx-md-size",children:w4(v.bytes)})]},v.path))})]})})}function lr({label:e,val:t,accent:n}){return i.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[i.jsx("span",{className:"ctx-row-label",children:e}),i.jsx("span",{className:"ctx-row-val",children:t})]})}function k4({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:a}){const l=g2(n,t),c=Math.min(1,e/l),d=s/2-3,h=s/2,p=2*Math.PI*d,f=p*c,m=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return i.jsx("button",{type:"button",className:"ctx-donut",onClick:a,title:`context: ${e.toLocaleString()} / ${l.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:i.jsxs("svg",{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[i.jsx("circle",{cx:h,cy:h,r:d,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),i.jsx("circle",{cx:h,cy:h,r:d,stroke:m,strokeWidth:"2.5",fill:"none",strokeDasharray:`${f} ${p-f}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),i.jsx("text",{x:h,y:h+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}function Kk(e,t){const n=yi(t);if(!n)return`model: ${t}
|
|
61
|
+
no published rate in this build — the tokens are counted, the dollars are not`;const s=f=>f.toLocaleString(),a=f=>`$${f}/MTok`,l=yx(e,t),c=p2(e,n),d=c.tokens1h>0?[`cache w5m${s(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${ot(c.usd5m)}`,`cache w1h${s(c.tokens1h).padStart(14)} × ${a(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${ot(c.usd1h)}`]:[`cache w ${s(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${ot(c.usd5m)}`],h=m2(e,t),p=h===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(h).padStart(14)} × ${a(n.input).padEnd(11)} = ${ot(l.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${a(n.output).padEnd(11)} = ${ot(l.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${a(n.cacheRead).padEnd(11)} = ${ot(l.cacheRead)}`,...d,"─────────────────────────────────────────",`total = ${ot(l.total)}`].join(`
|
|
62
|
+
`)}function Xk(e){const t=tc(e);return t.length<=1?Kk(e.usage,e.model):[...t.map(n=>Kk(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${ot(An(e).total)}`].join(`
|
|
63
63
|
`)}function _4({data:e,selected:t}){var v,N;const n=e.now??Date.now(),s=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),a=e.tools.filter(_=>!_.endedAt).length,l=e.tools.filter(_=>_.ok===!1).length,c=gx(e.sessionId),d=((v=e.context)==null?void 0:v.currentContextTokens)??0,h=e.kind==="root"&&d>0,p=e.sessionTitle?e.cwd?`${e.cwd}
|
|
64
|
-
${e.sessionTitle}`:e.sessionTitle:e.cwd,f=
|
|
64
|
+
${e.sessionTitle}`:e.sessionTitle:e.cwd,f=w2(e),m=f.length>0?`${e.model}
|
|
65
65
|
spend on this card also covers:
|
|
66
66
|
${f.join(`
|
|
67
|
-
`)}`:e.model,y=
|
|
68
|
-
burn: ${E}`:"");return i.jsx("span",{className:"cost-meta",title:C,children:i.jsxs("b",{children:[
|
|
69
|
-
Blocked for ${cd(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?i.jsx("span",{className:"ap-pulse","aria-hidden":!0}):i.jsx("span",{className:"waiting-dot","aria-hidden":!0}),i.jsx("span",{className:"waiting-said",children:j4(e)}),i.jsx("b",{children:cd(e.since,void 0,t)})]})}function C4({tools:e,outputs:t,now:n}){const c=new Array(24).fill(0);let d=0;const h=E=>{const C=n-E;if(C<0||C>=6e4)return;const T=23-Math.floor(C/2500);T>=0&&T<24&&(c[T]+=1,d+=1)};for(const E of e)h(E.startedAt);for(const E of t??[])h(E);const p=2,f=Math.max(0,...c),m=132,y=14,v=m/24,N=f/(2500/1e3),_=e.filter(E=>n-E.startedAt>=0&&n-E.startedAt<6e4).length,S=d-_,k=[_>0?`${_} tool ${_===1?"call":"calls"}`:"",S>0?`${S} ${S===1?"block":"blocks"} of thinking and writing`:""].filter(Boolean),j=d===0?"nothing in the last 60s":`${k.join(" · ")} in last 60s · peak ${N.toFixed(1)}/s`;return i.jsxs("div",{className:"tool-spark-row",title:j,children:[i.jsx("svg",{className:"tool-spark",width:m,height:y,viewBox:`0 0 ${m} ${y}`,"aria-hidden":!0,children:c.map((E,C)=>{const T=E===0?1.5:Math.max(1.5,Math.min(1,E/p)*y),R=C===23&&E>0,D=`tool-spark-bar${E>0?" active":""}${R?" latest":""}`;return i.jsx("rect",{x:C*v+.4,y:y-T,width:Math.max(.5,v-1),height:T,rx:.8,className:D},R?`landed:${E}`:C)})}),i.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function T4(e,t){return e?t==="gone"?"entering":t==="leaving"?"here":t:t==="gone"?"gone":"leaving"}function qf(e){return e!=="gone"}function Ff(e,t){const[n,s]=x.useState(()=>e?"here":"gone"),a=x.useRef(null);return x.useEffect(()=>{s(l=>T4(e,l))},[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}function
|
|
70
|
-
drag the wrapper to move the whole session`,onClick:()=>c(h.sessionId),children:[h.label,h.name?i.jsxs(i.Fragment,{children:[Mv,i.jsx("span",{className:"cluster-label-name",children:h.name})]}):null,h.shortId?i.jsx("span",{className:"cluster-label-id",children:Mv+h.shortId}):null]})]},h.sessionId)})})}function q4(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 F4({data:e}){return i.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const
|
|
71
|
-
`:n==="r"?"\r":n==="t"?" ":n)}const _2=600,X4=4,Q4=36,Iv=16,Z4=60,J4=6,n1=220,r1=96,e5=28,s1={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:"📡",...z4};function a1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(s1,e)?s1[e]:"✨"}const o1={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 N2(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 N2(n[1]);for(;;){const l=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!l)break;t=t.slice(l[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const 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 t5(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=Y4(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 n5=new Set(["Bash","PowerShell",...H4]),r5=W4;function s5(e,t){return r5.has(e)||e.startsWith("mcp__")?Math.max(r1,34+t.length*7.5):r1}function a5(e,t){if(!n5.has(e))return null;const n=t5(t);if(!n)return null;const s=N2(n);return s?{emoji:Object.hasOwn(o1,s)?o1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const o5=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),i1={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:"🗄️"},l1={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 i5(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function l5(e){const t=e.toLowerCase();if(Object.hasOwn(l1,t))return l1[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(i1,s))return i1[s]}return"📄"}function c5(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 u5(e,t){if(!o5.has(e))return null;const n=c5(e,t);if(!n)return null;const s=i5(n);return s?{emoji:e==="LS"?"📂":l5(s),label:s,category:"file",detail:n}:null}const c1={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 bx(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 d5(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 S2(e){const t=e.toLowerCase();return Object.hasOwn(c1,t)?c1[t]:void 0}function h5(e,t){const n=bx(e);if(!n)return null;const{server:s,method:a}=n;if(!a)return null;const l=S2(s);return{emoji:(l==null?void 0:l.emoji)??"🔌",label:a,category:"mcp",detail:l?`${l.name} · ${a}`:`${s} · ${a}`}}function f5(e,t){return a5(e,t)??u5(e,t)??h5(e)}const u1=U4,d1=18;function p5(e){const t=[...e];return t.length<=d1?e:t.slice(0,d1-1).join("")+"…"}function j2(e){const t=bx(e);if(t){const s=S2(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:p5(t.server),hue:d5(t.server)}}const n=Object.hasOwn(u1,e)?u1[e]:"";return n?{emoji:a1(e),label:n}:{emoji:a1(e),label:e}}function m5(e){let t=null,n="";for(const s of e){const a=bx(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:j2(n)}function g5(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function y5(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/_2)}function w5(e,t){const n=[],s=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const l=e[a];s.has(l.id)||(s.add(l.id),n.push(l))}return n.reverse()}function v5(e,t,n,s,a,l){const c=[];for(const d of e.values()){if(!t.has(d.id)||d.exitAt!=null&&l-d.exitAt>_2)continue;const h=s.get(d.id)??n.get(d.id);if(!h)continue;const p=w5(d.tools,X4);if(p.length===0)continue;const f=d.exitAt??null,m=a.get(d.id),y=Math.max((m==null?void 0:m.width)??n1,n1),v=(m==null?void 0:m.height)??130,N=h.x,_=h.y,S=N+y,k=_+v/2;p.forEach((j,E)=>{const C=E*Q4,T=N+y+Z4,R=_+J4+C,A=y5(l,f),D=j.inputPreview??"",O=g5(j),$=A<.999,B=j2(j.name);c.push({id:`${d.id}::${j.id}`,toolId:j.id,agentId:d.id,toolName:j.name,name:B.label,emoji:B.emoji,status:O,category:k2(j.name),mcpHue:B.hue,inputPreview:D,fade:A,fading:$,worldX:T,worldY:R,anchorX:S,anchorY:k,spawnDx:S-T,spawnDy:k-(R+Iv)});const Z=f5(j.name,j.input);if(Z){const J=s5(j.name,B.label),I=T+J+e5,X=R,G=T+J,q=R+Iv;c.push({id:`sub:${d.id}::${j.id}`,toolId:j.id,agentId:d.id,toolName:j.name,name:Z.label,emoji:Z.emoji,isSub:!0,status:O,category:Z.category,inputPreview:Z.detail??D,fade:A,fading:$,worldX:I,worldY:X,anchorX:G,anchorY:q,spawnDx:G-I,spawnDy:0})}})}return c}function x5({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:a,spotlight:l,hiddenCategories:c,now:d,onOpenTool:h}){const p=v5(e,t,n,s,a,d),f=c&&c.size>0?p.filter(m=>!c.has(m.category)):p;return i.jsx(b5,{bursts:f,spotlight:l,onOpenTool:h})}function b5({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:a,zoom:l}=n2();return i.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[i.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const d=c.anchorX*l+s,h=c.anchorY*l+a,p=(c.worldX+6)*l+s,f=(c.worldY+Iv)*l+a,m=Math.max(1,p-d),y=Math.min(1,Math.abs(f-h)/m),v=d+m*(.55-.22*y),N=t!=null&&!t.has(c.agentId),_=c.fade*(N?.14:1);return i.jsx("path",{d:`M ${d} ${h} Q ${v} ${h}, ${p} ${f}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:_},`l:${c.id}`)})}),e.map(c=>{const d=c.worldX*l+s,h=c.worldY*l+a,p={left:`${d}px`,top:`${h}px`,transform:`scale(${l})`,transformOrigin:"left top","--spawn-dx":`${c.spawnDx}px`,"--spawn-dy":`${c.spawnDy}px`},f=c.isSub?`${c.toolName} · ${c.name}`:c.toolName,m=c.inputPreview?`${f} · ${c.inputPreview}`:f,y=n!=null,v=c.mcpHue!=null?{"--mcp-hue":c.mcpHue}:{},_=t!=null&&!t.has(c.agentId)?" dim":"";return i.jsx("div",{className:"tool-burst-wrap",style:p,children:i.jsxs("div",{className:`tool-burst cat-${c.category}${c.mcpHue!=null?" mcp-hue":""} status-${c.status}${c.fading?" fading":""}${y?" clickable":""}${c.isSub?" sub":""}${_}`,style:v,title:m,onClick:y?()=>n(c.toolId):void 0,children:[i.jsx("span",{className:"tb-emoji",children:c.emoji}),i.jsx("span",{className:"tb-name",children:c.name}),c.status==="inflight"&&i.jsx("span",{className:"tb-spin"}),c.status==="done"&&i.jsx("span",{className:"tb-mark done",children:"✓"}),c.status==="err"&&i.jsx("span",{className:"tb-mark err",children:"×"})]})},c.id)})]})}function k5(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,a=0,l=0;for(const c of e){const d=An(c);t.input+=d.input,t.output+=d.output,t.cacheRead+=d.cacheRead,t.cacheWrite+=d.cacheWrite,t.total+=d.total,n+=c.usage.inputTokens,s+=c.usage.outputTokens,a+=c.usage.cacheReadTokens,l+=c.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:a,cacheCreateTokens:l,sum:n+s}}const _5="spend on this board",N5="on this board",h1=`Everything on the board right now, and only that.
|
|
67
|
+
`)}`:e.model,y=b2(e.sessionName,e.sessionTitle);return i.jsxs("div",{className:s,style:{"--session-hue":c},children:[i.jsx("span",{className:"accent-stripe"}),i.jsx(hi,{type:"target",position:Be.Left,style:{background:"transparent",border:"none"}}),i.jsxs("div",{className:"head",children:[i.jsxs("div",{className:"title",children:[i.jsx(N4,{state:e.state}),i.jsx("span",{className:"label",title:p,children:e.label}),e.synthetic&&i.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),i.jsxs("div",{className:"head-right",children:[h&&e.onOpenContext&&i.jsx(k4,{currentContextTokens:d,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),i.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:cd(e.startedAt,e.endedAt,n)})]})]}),i.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&i.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?i.jsxs("span",{className:"model-chip","data-family":jd(e.model),title:m,children:[Vs(e.model),f.length>0?` +${f.length}`:""]}):e.provider==="codex"?i.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&y.face&&i.jsx("div",{className:"session-name",title:y.tooltip,children:y.face}),e.waiting&&i.jsx(E4,{waiting:e.waiting,now:n}),(()=>{const _=ZL(e);return _?i.jsxs("div",{className:"approval-blind-row",title:_.detail,children:[i.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),i.jsx("span",{className:"approval-blind-said",children:_.label})]}):null})(),(e.tools.length>0||(((N=e.outputs)==null?void 0:N.length)??0)>0)&&i.jsx(C4,{tools:e.tools,outputs:e.outputs,now:n}),i.jsxs("div",{className:"meta",children:[i.jsxs("span",{children:[i.jsx("b",{children:e.toolCount})," tools"]}),l>0&&i.jsxs("span",{className:"failed-meta",title:`${l} tool ${l===1?"call":"calls"} returned an error`,children:[i.jsx("b",{children:l})," err"]}),a>0&&i.jsxs("span",{className:"inflight-meta",children:[i.jsx("b",{children:a})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&i.jsxs("span",{className:"tokens-meta",title:`in:${e.usage.inputTokens} out:${e.usage.outputTokens} cache-r:${e.usage.cacheReadTokens} cache-c:${e.usage.cacheCreateTokens}${(e.usage.reasoningOutputTokens??0)>0?` reasoning:${e.usage.reasoningOutputTokens}`:""}`,children:[i.jsx("b",{children:Mt(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const _=yi(e.model),S=An(e),k=Rv(e);if(!_&&S.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:i.jsx("span",{className:"cost-unpriced",title:Xk(e),children:Jo});if(S.total<=0)return null;const j=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),E=e.state==="active"?wx(S.total,j):null,C=Xk(e)+(E?`
|
|
68
|
+
burn: ${E}`:"");return i.jsx("span",{className:"cost-meta",title:C,children:i.jsxs("b",{children:[ot(S.total),k>0?"+":""]})})})()]}),i.jsx(hi,{type:"source",position:Be.Right,style:{background:"transparent",border:"none"}})]})}function dd(e){return e==="active"?"live":e==="done"?"done":"err"}function N4({state:e}){return i.jsx("span",{className:`state-pill state-${e}`,children:dd(e)})}function zl(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function S4(e,t){const n=v2(e,t);return n?`Likely on: ${n}`:null}function j4(e){return e.kind==="idle"?"Your turn":zl(e)}function E4({waiting:e,now:t}){const n=nc(e),s=zl(e);return i.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
|
|
69
|
+
Blocked for ${cd(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?i.jsx("span",{className:"ap-pulse","aria-hidden":!0}):i.jsx("span",{className:"waiting-dot","aria-hidden":!0}),i.jsx("span",{className:"waiting-said",children:j4(e)}),i.jsx("b",{children:cd(e.since,void 0,t)})]})}function C4({tools:e,outputs:t,now:n}){const c=new Array(24).fill(0);let d=0;const h=E=>{const C=n-E;if(C<0||C>=6e4)return;const T=23-Math.floor(C/2500);T>=0&&T<24&&(c[T]+=1,d+=1)};for(const E of e)h(E.startedAt);for(const E of t??[])h(E);const p=2,f=Math.max(0,...c),m=132,y=14,v=m/24,N=f/(2500/1e3),_=e.filter(E=>n-E.startedAt>=0&&n-E.startedAt<6e4).length,S=d-_,k=[_>0?`${_} tool ${_===1?"call":"calls"}`:"",S>0?`${S} ${S===1?"block":"blocks"} of thinking and writing`:""].filter(Boolean),j=d===0?"nothing in the last 60s":`${k.join(" · ")} in last 60s · peak ${N.toFixed(1)}/s`;return i.jsxs("div",{className:"tool-spark-row",title:j,children:[i.jsx("svg",{className:"tool-spark",width:m,height:y,viewBox:`0 0 ${m} ${y}`,"aria-hidden":!0,children:c.map((E,C)=>{const T=E===0?1.5:Math.max(1.5,Math.min(1,E/p)*y),R=C===23&&E>0,D=`tool-spark-bar${E>0?" active":""}${R?" latest":""}`;return i.jsx("rect",{x:C*v+.4,y:y-T,width:Math.max(.5,v-1),height:T,rx:.8,className:D},R?`landed:${E}`:C)})}),i.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function T4(e,t){return e?t==="gone"?"entering":t==="leaving"?"here":t:t==="gone"?"gone":"leaving"}function qf(e){return e!=="gone"}function Ff(e,t){const[n,s]=x.useState(()=>e?"here":"gone"),a=x.useRef(null);return x.useEffect(()=>{s(l=>T4(e,l))},[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}function Qk(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function A4({tool:e,onClose:t}){const n=Vt(t),s=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return i.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:n,className:"modal",onClick:a=>a.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{className:`status-dot ${s}`,"aria-hidden":!0}),i.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),i.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),i.jsxs("div",{className:"modal-actions",children:[i.jsx("span",{className:"modal-dur",children:x2(e,"in-flight…")}),i.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),i.jsxs("section",{className:"modal-body",children:[e.trimmed&&i.jsx("div",{className:"modal-section",children:i.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h4",{children:"Input"}),i.jsx("pre",{children:Qk(e.input??e.inputPreview)})]}),i.jsxs("div",{className:"modal-section",children:[i.jsxs("h4",{children:["Response ",s==="err"&&i.jsx("span",{className:"err-tag",children:"error"})]}),i.jsx("pre",{children:e.endedAt==null?"(waiting…)":Qk(e.response??e.errorPreview)})]})]})]})})}const Ru=18,Zk=26,R4=12;function M4(e){return I4(e.nodeInternals.values())}function I4(e){const t=new Map;for(const a of e){if(a.type!=="agent")continue;const l=a.data;if(!(l!=null&&l.sessionId)||l.exitAt!=null||a.width==null||a.height==null)continue;const c=a.position.x,d=a.position.y,h=c+a.width,p=d+a.height,f=t.get(l.sessionId);f?(f.minX=Math.min(f.minX,c),f.minY=Math.min(f.minY,d),f.maxX=Math.max(f.maxX,h),f.maxY=Math.max(f.maxY,p),l.kind==="root"&&(f.label=t1(l)??f.label),l.kind==="root"&&(f.name=n1(l))):t.set(l.sessionId,{minX:c,minY:d,maxX:h,maxY:p,label:t1(l)??l.sessionId,name:n1(l)})}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,l]of t){const c=(n.get(l.label)??0)>1;s.push({sessionId:a,...P4(l.label,l.name,a,c),x:l.minX-Ru,y:l.minY-Ru-Zk,w:l.maxX-l.minX+Ru*2,h:l.maxY-l.minY+Ru*2+Zk})}return s}const Mv=" · ",$4=32,O4=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function Jk(e){return O4.test(e)?2:1}function e1(e,t=$4){const n=[...e];let s=0;for(const c of n)s+=Jk(c);if(s<=t)return e;const a=[];let l=0;for(const c of n){const d=Jk(c);if(l+d>t-1)break;a.push(c),l+=d}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function P4(e,t,n,s){const a=(t==null?void 0:t.trim())??"",l=s?L4(n):void 0,c=[e,a||void 0,l].filter(Boolean);return{label:e1(e),name:a?e1(a):void 0,shortId:l,fullLabel:c.join(Mv)}}function L4(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function t1(e){if(e.kind==="root")return e.label}function n1(e){if(e.kind==="root")return b2(e.sessionName,e.sessionTitle).face}function D4({onFit:e}){const{x:t,y:n,zoom:s}=s2(),a=Ql(),l=ht(M4,q4);if(l.length<=1)return null;const c=h=>{try{const p=a.getNodes().filter(f=>{const m=f.data;return(m==null?void 0:m.sessionId)===h});if(p.length===0)return;a.fitView({padding:.3,duration:500,nodes:p}),e==null||e()}catch{}},d={transform:`translate(${t}px, ${n}px) scale(${s})`};return i.jsx("div",{className:"session-clusters",style:d,children:l.map(h=>{const p=gx(h.sessionId),f={position:"absolute",left:h.x,top:h.y,width:h.w,height:h.h,"--session-hue":p},m={position:"absolute",left:h.x+16,top:h.y-R4,transform:`scale(${Math.min(1,s)/(s||1)})`,transformOrigin:"left top","--session-hue":p};return i.jsxs(pe.Fragment,{children:[i.jsx("div",{className:"cluster-card",style:f,"aria-hidden":!0}),i.jsxs("button",{type:"button",className:"cluster-label",style:m,title:`Fit view to ${h.fullLabel}
|
|
70
|
+
drag the wrapper to move the whole session`,onClick:()=>c(h.sessionId),children:[h.label,h.name?i.jsxs(i.Fragment,{children:[Mv,i.jsx("span",{className:"cluster-label-name",children:h.name})]}):null,h.shortId?i.jsx("span",{className:"cluster-label-id",children:Mv+h.shortId}):null]})]},h.sessionId)})})}function q4(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 F4({data:e}){return i.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const rc={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"}},B4=Object.fromEntries(Object.entries(rc).map(([e,t])=>[e,t.category])),z4=Object.fromEntries(Object.entries(rc).map(([e,t])=>[e,t.emoji])),U4=Object.fromEntries(Object.entries(rc).map(([e,t])=>[e,t.label])),W4=new Set(Object.keys(rc)),H4=new Set(Object.entries(rc).filter(([,e])=>e.shell).map(([e])=>e)),r1={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",...B4};function N2(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(r1,e)?r1[e]:"other"}const G4=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,V4=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function Y4(e){if(typeof e!="string"||!e)return null;const t=G4.exec(e);if(t){const s=K4(t[2]);if(s.trim())return s}const n=V4.exec(e);return n?n[1]:null}function K4(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
71
|
+
`:n==="r"?"\r":n==="t"?" ":n)}const S2=600,X4=4,Q4=36,Iv=16,Z4=60,J4=6,s1=220,a1=96,e5=28,o1={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:"📡",...z4};function i1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(o1,e)?o1[e]:"✨"}const l1={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 j2(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 j2(n[1]);for(;;){const l=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!l)break;t=t.slice(l[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const 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 t5(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=Y4(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 n5=new Set(["Bash","PowerShell",...H4]),r5=W4;function s5(e,t){return r5.has(e)||e.startsWith("mcp__")?Math.max(a1,34+t.length*7.5):a1}function a5(e,t){if(!n5.has(e))return null;const n=t5(t);if(!n)return null;const s=j2(n);return s?{emoji:Object.hasOwn(l1,s)?l1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const o5=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),c1={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:"🗄️"},u1={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 i5(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function l5(e){const t=e.toLowerCase();if(Object.hasOwn(u1,t))return u1[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(c1,s))return c1[s]}return"📄"}function c5(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 u5(e,t){if(!o5.has(e))return null;const n=c5(e,t);if(!n)return null;const s=i5(n);return s?{emoji:e==="LS"?"📂":l5(s),label:s,category:"file",detail:n}:null}const d1={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 bx(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 d5(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 E2(e){const t=e.toLowerCase();return Object.hasOwn(d1,t)?d1[t]:void 0}function h5(e,t){const n=bx(e);if(!n)return null;const{server:s,method:a}=n;if(!a)return null;const l=E2(s);return{emoji:(l==null?void 0:l.emoji)??"🔌",label:a,category:"mcp",detail:l?`${l.name} · ${a}`:`${s} · ${a}`}}function f5(e,t){return a5(e,t)??u5(e,t)??h5(e)}const h1=U4,f1=18;function p5(e){const t=[...e];return t.length<=f1?e:t.slice(0,f1-1).join("")+"…"}function C2(e){const t=bx(e);if(t){const s=E2(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:p5(t.server),hue:d5(t.server)}}const n=Object.hasOwn(h1,e)?h1[e]:"";return n?{emoji:i1(e),label:n}:{emoji:i1(e),label:e}}function m5(e){let t=null,n="";for(const s of e){const a=bx(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:C2(n)}function g5(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function y5(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/S2)}function w5(e,t){const n=[],s=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const l=e[a];s.has(l.id)||(s.add(l.id),n.push(l))}return n.reverse()}function v5(e,t,n,s,a,l){const c=[];for(const d of e.values()){if(!t.has(d.id)||d.exitAt!=null&&l-d.exitAt>S2)continue;const h=s.get(d.id)??n.get(d.id);if(!h)continue;const p=w5(d.tools,X4);if(p.length===0)continue;const f=d.exitAt??null,m=a.get(d.id),y=Math.max((m==null?void 0:m.width)??s1,s1),v=(m==null?void 0:m.height)??130,N=h.x,_=h.y,S=N+y,k=_+v/2;p.forEach((j,E)=>{const C=E*Q4,T=N+y+Z4,R=_+J4+C,A=y5(l,f),D=j.inputPreview??"",O=g5(j),$=A<.999,F=C2(j.name);c.push({id:`${d.id}::${j.id}`,toolId:j.id,agentId:d.id,toolName:j.name,name:F.label,emoji:F.emoji,status:O,category:N2(j.name),mcpHue:F.hue,inputPreview:D,fade:A,fading:$,worldX:T,worldY:R,anchorX:S,anchorY:k,spawnDx:S-T,spawnDy:k-(R+Iv)});const Z=f5(j.name,j.input);if(Z){const J=s5(j.name,F.label),I=T+J+e5,X=R,G=T+J,q=R+Iv;c.push({id:`sub:${d.id}::${j.id}`,toolId:j.id,agentId:d.id,toolName:j.name,name:Z.label,emoji:Z.emoji,isSub:!0,status:O,category:Z.category,inputPreview:Z.detail??D,fade:A,fading:$,worldX:I,worldY:X,anchorX:G,anchorY:q,spawnDx:G-I,spawnDy:0})}})}return c}function x5({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:a,spotlight:l,hiddenCategories:c,now:d,onOpenTool:h}){const p=v5(e,t,n,s,a,d),f=c&&c.size>0?p.filter(m=>!c.has(m.category)):p;return i.jsx(b5,{bursts:f,spotlight:l,onOpenTool:h})}function b5({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:a,zoom:l}=s2();return i.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[i.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const d=c.anchorX*l+s,h=c.anchorY*l+a,p=(c.worldX+6)*l+s,f=(c.worldY+Iv)*l+a,m=Math.max(1,p-d),y=Math.min(1,Math.abs(f-h)/m),v=d+m*(.55-.22*y),N=t!=null&&!t.has(c.agentId),_=c.fade*(N?.14:1);return i.jsx("path",{d:`M ${d} ${h} Q ${v} ${h}, ${p} ${f}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:_},`l:${c.id}`)})}),e.map(c=>{const d=c.worldX*l+s,h=c.worldY*l+a,p={left:`${d}px`,top:`${h}px`,transform:`scale(${l})`,transformOrigin:"left top","--spawn-dx":`${c.spawnDx}px`,"--spawn-dy":`${c.spawnDy}px`},f=c.isSub?`${c.toolName} · ${c.name}`:c.toolName,m=c.inputPreview?`${f} · ${c.inputPreview}`:f,y=n!=null,v=c.mcpHue!=null?{"--mcp-hue":c.mcpHue}:{},_=t!=null&&!t.has(c.agentId)?" dim":"";return i.jsx("div",{className:"tool-burst-wrap",style:p,children:i.jsxs("div",{className:`tool-burst cat-${c.category}${c.mcpHue!=null?" mcp-hue":""} status-${c.status}${c.fading?" fading":""}${y?" clickable":""}${c.isSub?" sub":""}${_}`,style:v,title:m,onClick:y?()=>n(c.toolId):void 0,children:[i.jsx("span",{className:"tb-emoji",children:c.emoji}),i.jsx("span",{className:"tb-name",children:c.name}),c.status==="inflight"&&i.jsx("span",{className:"tb-spin"}),c.status==="done"&&i.jsx("span",{className:"tb-mark done",children:"✓"}),c.status==="err"&&i.jsx("span",{className:"tb-mark err",children:"×"})]})},c.id)})]})}function k5(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,a=0,l=0;for(const c of e){const d=An(c);t.input+=d.input,t.output+=d.output,t.cacheRead+=d.cacheRead,t.cacheWrite+=d.cacheWrite,t.total+=d.total,n+=c.usage.inputTokens,s+=c.usage.outputTokens,a+=c.usage.cacheReadTokens,l+=c.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:a,cacheCreateTokens:l,sum:n+s}}const _5="spend on this board",N5="on this board",p1=`Everything on the board right now, and only that.
|
|
72
72
|
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.
|
|
73
|
-
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,
|
|
74
|
-
`),children:["waiting ",p1(h.waiting.since,void 0,t),h.waiting.tool&&i.jsxs("span",{className:"sl-waiting-tool",children:[" · ",h.waiting.tool.name]})]}):i.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:p1(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]})]})]},h.sessionId)})]})]})}const T5=e=>1-Math.pow(1-e,5),C2=420;function A5(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 R5(e,t,n,s=C2){return n>=s?t:n<=0?e:e+(t-e)*T5(n/s)}function M5(e,t,n,s={}){const a=s.now??(()=>performance.now()),l=s.raf??(v=>requestAnimationFrame(v)),c=s.cancel??(v=>cancelAnimationFrame(v)),d=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),h=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(d()||h()||!A5(e,t))return n(t),()=>{};const p=a();let f=0,m=!0;const y=()=>{if(!m)return;const v=a()-p;n(R5(e,t,v)),v<C2&&(f=l(y))};return f=l(y),()=>{m=!1,f&&c(f)}}const $v={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function m1(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const a=An(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 I5(e,t){if(!e)return $v;const n={...$v};for(const[s,a]of t){const l=e.get(s);if(!l)continue;const c={cost:a.cost-l.cost,inputTokens:a.inputTokens-l.inputTokens,outputTokens:a.outputTokens-l.outputTokens,cacheReadTokens:a.cacheReadTokens-l.cacheReadTokens,cacheCreateTokens:a.cacheCreateTokens-l.cacheCreateTokens};c.cost<0||c.inputTokens<0||c.outputTokens<0||c.cost===0&&c.inputTokens===0&&c.outputTokens===0&&c.cacheReadTokens===0&&c.cacheCreateTokens===0||(n.cost+=c.cost,n.inputTokens+=Math.max(0,c.inputTokens),n.outputTokens+=Math.max(0,c.outputTokens),n.cacheReadTokens+=Math.max(0,c.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,c.cacheCreateTokens),n.sessions+=1)}return n}function Ov(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const Cd=[{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 $5(e,t,n=Cd.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 O5(e,t=new Date){return e==="today"?Ov(1,t):e==="month"?Ov(t.getDate(),t):"20200101"}const Tn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Yu=e=>typeof e=="string"?e:"";function T2(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 l of a){const c=Yu(l==null?void 0:l.modelName);if(!c)continue;let d=n.get(c);d||(d={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,d)),d.cost+=Tn(l==null?void 0:l.cost),d.inputTokens+=Tn(l==null?void 0:l.inputTokens),d.outputTokens+=Tn(l==null?void 0:l.outputTokens),d.cacheReadTokens+=Tn(l==null?void 0:l.cacheReadTokens),d.cacheCreateTokens+=Tn(l==null?void 0:l.cacheCreationTokens)}}return[...n.values()].sort((s,a)=>a.cost-s.cost||a.tokens-s.tokens)}const P5=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function L5(e){var t;return((t=P5.exec(e))==null?void 0:t[0])??e}function D5(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const a of n){const l=Yu(a==null?void 0:a.period);if(!l)continue;const c=L5(l),d=a==null?void 0:a.metadata,h=typeof(d==null?void 0:d.lastActivity)=="string"?Date.parse(d.lastActivity):NaN;s.push({sessionId:c,label:t.get(c)??null,agent:Yu(a==null?void 0:a.agent)||"claude",cost:Tn(a==null?void 0:a.totalCost),tokens:Tn(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(Yu).filter(Boolean):[],lastActivityMs:Number.isFinite(h)?h:null})}return s.sort((a,l)=>l.cost-a.cost||l.tokens-a.tokens)}function A2(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const h=Tn(t.cacheReadTokens),p=Tn(t.cacheCreationTokens),f=Tn(t.inputTokens),m=Tn(t.outputTokens);return{cost:Tn(t.totalCost),inputTokens:f,outputTokens:m,cacheReadTokens:h,cacheCreateTokens:p,tokens:Tn(t.totalTokens)||f+m+h+p}}const n=T2(e),s=h=>n.reduce((p,f)=>p+h(f),0),a=s(h=>h.inputTokens),l=s(h=>h.outputTokens),c=s(h=>h.cacheReadTokens),d=s(h=>h.cacheCreateTokens);return{cost:s(h=>h.cost),inputTokens:a,outputTokens:l,cacheReadTokens:c,cacheCreateTokens:d,tokens:a+l+c+d}}function q5(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 g1(e,t){var n;return((n=Cd.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function F5(e,t,n){const s=e!=null,a=A2(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 B5="1",y1="agent-dag.schema",z5=["agent-dag.layout","agent-dag.viewport"];function gi(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function U5(e,t=B5){let n=null;try{n=e.getItem(y1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const a of z5)try{e.getItem(a)!==null&&(e.removeItem(a),s.push(a))}catch{}try{e.setItem(y1,t)}catch{}return s}const Gt="ccdeck";function R2(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 Pv(e){return R2(Math.floor(e/1e3))}function M2(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),a=Math.floor(n%86400/3600),l=Math.floor(n%3600/60);return s>0?`${s}d ${a}h`:a>0?`${a}h ${l}m`:`${l}m`}function W5(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function H5(e,t,n){const s=new Date(e),a=Pv(t-e);return{label:W5(s,new Date(t))?a:`${a} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function Ys(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function Td(e){return e==null}const Lv="self";function hr(e,t=!1){const n=Ys(e?Lv:null,Lv);return{disabled:t||n.disabled,"aria-busy":n.busy}}function fr(e){return Td(e?Lv:null)}function G5(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function V5(e){return e==null||e==="BODY"||e==="HTML"}const I2="agent-dag.usagePeriod";function Y5(){const e=gi(I2);return Cd.some(t=>t.key===e)?e:"today"}function K5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(I2,e)}catch{}}const $2="agent-dag.usageSessionsOpen";function X5(){return gi($2)==="1"}function Q5(e){if(!(typeof window>"u"))try{window.localStorage.setItem($2,e?"1":"0")}catch{}}function w1(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 Z5(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 Bf="__unknown__";function J5(e,t,n,s){const a=Math.max(0,t-s),l=Math.max(0,n-a);if(l<120)return null;const c=Math.min(100,l/n*100),d=e-c;if(Math.abs(d)<3)return{label:"on pace",color:"var(--ok)",expectedPct:c,isDeficit:!1};if(d>0){const h=100-e,p=l>0?e/l:0,f=p>0?h/p:1/0,m={label:`${Math.round(d)}% ahead`,color:"var(--warn)",expectedPct:c,isDeficit:!0};if(f<a&&f<86400){const y=Math.floor(f/3600),v=Math.floor(f%3600/60);m.runsOutIn=y>0?`${y}h ${v}m`:`${v}m`}return m}return{label:`${Math.round(-d)}% reserve`,color:"var(--ok)",expectedPct:c,isDeficit:!1}}function qa({pct:e,label:t,reset:n,resetAt:s,windowSec:a,limitReached:l,nowSec:c}){const d=Math.min(100,Math.max(0,e)),p=l||d>=90?"var(--err)":d>=70?"var(--warn)":"var(--accent)",f=d===0?"< 1%":`${d}%`,m=d===0?2:d,y=s?M2(s,c):null,v=s&&a?J5(d,s,a,c):null;return i.jsxs("div",{className:"qb-row",children:[i.jsxs("div",{className:"qb-meta",children:[i.jsxs("span",{className:"qb-label",children:[t,l&&i.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),i.jsx("span",{className:"qb-pct",style:{color:p},children:f})]}),i.jsxs("div",{className:"qb-track",children:[i.jsx("div",{className:"qb-fill",style:{width:`${m}%`,background:p,opacity:d===0?.4:1}}),v&&i.jsx("div",{className:"qb-pace-marker",style:{left:`${v.expectedPct}%`,background:v.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(v.expectedPct)}% by now`})]}),i.jsxs("div",{className:"qb-reset-row",children:[y?i.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?i.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,v&&i.jsx("span",{className:"qb-pace",style:{color:v.color},children:v.runsOutIn?`runs out in ${v.runsOutIn}`:v.label})]})]})}const eD=6e4;function tD(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),l=x.useRef(null),c=x.useRef(!1),d=async(p=!1)=>{if(!(p&&!fr(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/quota?refresh=1":"/api/quota");m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return d(!0),l.current=window.setInterval(()=>d(!1),eD),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&d(!0)}}}function nD(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 rD(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 O2=6e4,v1=6e4;function sD(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),l=x.useRef(null),c=x.useRef(!1),d=async(p=!1)=>{if(!(p&&!fr(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 d(!0),l.current=window.setInterval(()=>d(!1),O2),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&d(!0)}}}function aD(e){const[t,n]=x.useState(null),s=x.useRef(null),a=async()=>{try{const l=await fetch("/api/codex-usage");l.ok&&n(await l.json())}catch{}};return x.useEffect(()=>{if(e)return a(),s.current=window.setInterval(a,O2),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function oD(e,t,n){const[s,a]=x.useState(null),[l,c]=x.useState(!1),[d,h]=x.useState(0),p=x.useRef(0);x.useEffect(()=>{const m=()=>document.visibilityState==="visible",y=()=>{m()&&h(_=>_+1)},v=window.setInterval(y,v1),N=()=>{m()&&Date.now()-p.current>=v1&&h(_=>_+1)};return document.addEventListener("visibilitychange",N),()=>{window.clearInterval(v),document.removeEventListener("visibilitychange",N)}},[]);const f=x.useRef(t);return x.useEffect(()=>{let m=!0;const y=t!==f.current;f.current=t;const v=e,N=O5(v);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:v,data:_,baseline:n()}))}).catch(()=>{}).finally(()=>{m&&c(!1)}),()=>{m=!1}},[e,t,d]),{...q5(s,e),loading:l}}function bl(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 M5(s.current,e,c=>{s.current=c,n(c)})},[e]),t}function iD({state:e,now:t,providers:n,leaving:s,onClose:a}){var Qe,fe;const{quota:l,loading:c,refresh:d}=tD(n.claude),{data:h,loading:p,refresh:f}=sD(n.codex),{data:m}=aD(n.codex),[y,v]=x.useState(()=>Math.floor(Date.now()/1e3));x.useEffect(()=>{const ye=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ye)},[]);const{byModel:N,totalCost:_,totalTokens:S,burnRate:k}=x.useMemo(()=>{const ye=new Map;for(const ze of e.agents.values())for(const Xe of ec(ze)){const re=Xe.model??Bf,Fe=yx(Xe.usage,Xe.model),se=ye.get(re);se?(se.inputTokens+=Xe.usage.inputTokens,se.outputTokens+=Xe.usage.outputTokens,se.cacheReadTokens+=Xe.usage.cacheReadTokens,se.cacheCreateTokens+=Xe.usage.cacheCreateTokens,se.cost.total+=Fe.total,se.cost.input+=Fe.input,se.cost.output+=Fe.output,se.cost.cacheRead+=Fe.cacheRead,se.cost.cacheWrite+=Fe.cacheWrite,se.agentCount++):ye.set(re,{model:re,inputTokens:Xe.usage.inputTokens,outputTokens:Xe.usage.outputTokens,cacheReadTokens:Xe.usage.cacheReadTokens,cacheCreateTokens:Xe.usage.cacheCreateTokens,cost:{...Fe},agentCount:1,priced:mi(Xe.model)!=null})}const Se=Array.from(ye.values()).sort((ze,Xe)=>Xe.cost.total-ze.cost.total||Xe.inputTokens+Xe.outputTokens-(ze.inputTokens+ze.outputTokens));let Pe=0,et=0;for(const ze of e.agents.values()){if(ze.state!=="active")continue;const Xe=An(ze);Pe+=Xe.total,et=Math.max(et,((ze.endedAt??t)-ze.startedAt)/1e3)}const ft=et>0?wx(Pe,et):null,dt=k5(e.agents.values());return{byModel:Se,totalCost:dt.cost,totalTokens:dt,burnRate:ft}},[e,e.revision,t]),j=x.useMemo(()=>{const ye=[];for(const Se of e.agents.values()){if(Se.kind!=="root")continue;let Pe=An(Se).total,et=Se.usage.inputTokens,ft=Se.usage.outputTokens,dt=Rv(Se);for(const ze of e.agents.values())ze.sessionId!==Se.sessionId||ze.kind==="root"||(Pe+=An(ze).total,et+=ze.usage.inputTokens,ft+=ze.usage.outputTokens,dt+=Rv(ze));ye.push({sessionId:Se.sessionId,label:Se.label||Se.cwdBasename||"session",state:Se.state,cost:Pe,inputTokens:et,outputTokens:ft,unpricedTokens:dt})}return ye.sort((Se,Pe)=>Pe.cost-Se.cost||Pe.inputTokens+Pe.outputTokens-(Se.inputTokens+Se.outputTokens)).slice(0,12)},[e,e.revision]),[E,C]=x.useState(Y5);x.useEffect(()=>{K5(E)},[E]);const[T,R]=x.useState(X5);x.useEffect(()=>{Q5(T)},[T]);const A=x.useRef([]),[D,O]=x.useState(0),$=x.useRef(()=>new Map);$.current=()=>m1(e.agents.values(),t);const B=x.useCallback(()=>$.current(),[]),{data:Z,shown:J,stale:I,loading:X,baseline:G}=oD(E,D,B),q=Z!=null,Y=X&&I,L=x.useMemo(()=>{const ye=new Map;for(const Se of e.agents.values()){if(Se.kind!=="root"||!Se.sessionId)continue;const Pe=Se.label||Se.cwdBasename;Pe&&ye.set(Se.sessionId,Pe)}return ye},[e,e.revision]),K=x.useMemo(()=>{const ye=new Map;for(const Se of e.agents.values())Se.kind!=="root"||!Se.sessionId||ye.set(Se.sessionId,Se.state);return ye},[e,e.revision]),P=x.useMemo(()=>q?T2(Z):[],[Z,q]),V=x.useMemo(()=>{if(!q)return[];const ye=D5(Z,L).slice(0,12),Se=new Map;for(const Pe of ye)Pe.label&&Se.set(Pe.label,(Se.get(Pe.label)??0)+1);return ye.map(Pe=>Pe.label&&(Se.get(Pe.label)??0)>1?{...Pe,label:`${Pe.label} ${Pe.sessionId.slice(0,4)}`}:Pe)},[Z,q,L]),he=x.useMemo(()=>A2(Z),[Z]),z=g1(J,E),W=I?" up-stale":"",ee=x.useMemo(()=>q?I5(G,m1(e.agents.values(),t)):$v,[e,e.revision,G,q,t]),H=F5(Z,{...S,cost:_},ee),ae=H.hasCost,me=H.tokenSum,ge=bl(H.cost),Re=bl(H.inputTokens),$e=bl(H.outputTokens),ce=bl(H.cacheReadTokens),we=bl(H.cacheCreateTokens),xe=N.filter(ye=>ye.cost.total>0||ye.inputTokens+ye.outputTokens>0),De=j.filter(ye=>ye.cost>0||ye.inputTokens+ye.outputTokens>0),_e=q?P.some(ye=>ye.cost<=0&&ye.tokens>0):xe.some(ye=>!ye.priced),Ee=c||p,Ge=w1(l==null?void 0:l.fetchedAt,y),st=w1(h==null?void 0:h.fetchedAt,y),Je=()=>{d(),f(),O(ye=>ye+1)},Ze=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return i.jsxs("aside",{className:`usage-panel${s?" leaving":""}`,id:"usage-panel","aria-label":"Usage",children:[i.jsxs("div",{className:"up-header",children:[i.jsx("h2",{children:"Usage"}),k&&i.jsx("span",{className:"up-rate",children:k}),i.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&i.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:Je,...hr(Ee),"aria-label":Ze,title:Ze,children:Ee?"…":"↻"}),i.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:a,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&i.jsxs("section",{className:"up-section up-quota-section",children:[i.jsxs("h3",{className:"up-section-title",children:["Claude quota",Ge&&!c&&i.jsx("span",{className:"up-section-age",title:Z5(l==null?void 0:l.source),children:Ge})]}),l!=null&&l.ok?i.jsxs("div",{className:"up-quota-bars",children:[l.session5hPct!=null&&i.jsx(qa,{label:"5-hour window",pct:l.session5hPct,reset:l.session5hReset,resetAt:l.session5hResetAt,windowSec:l.session5hWindowSec,nowSec:y}),l.week7dPct!=null&&i.jsx(qa,{label:"7-day window",pct:l.week7dPct,reset:l.week7dReset,resetAt:l.week7dResetAt,windowSec:l.week7dWindowSec,nowSec:y}),l.weekSonnetPct!=null&&i.jsx(qa,{label:"Sonnet (7d)",pct:l.weekSonnetPct,nowSec:y}),l.weekOpusPct!=null&&i.jsx(qa,{label:"Opus (7d)",pct:l.weekOpusPct,nowSec:y})]}):(l==null?void 0:l.ok)===!1?i.jsxs("div",{className:"up-quota-na",children:[i.jsx("span",{children:l.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),i.jsx("span",{className:"up-quota-hint",children:nD(l.reason)})]}):i.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&i.jsxs("section",{className:"up-section up-quota-section",children:[i.jsxs("h3",{className:"up-section-title",children:["Codex quota",(h==null?void 0:h.ok)&&h.planLabel&&i.jsx("span",{className:"up-plan-badge",children:h.planLabel}),st&&!p&&i.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:st})]}),h!=null&&h.ok?i.jsxs("div",{className:"up-quota-bars",children:[(Qe=h.windows)==null?void 0:Qe.map(ye=>i.jsx(qa,{label:ye.label,pct:ye.pct,reset:ye.reset??void 0,resetAt:ye.resetAt??void 0,windowSec:ye.windowSec??void 0,limitReached:h.limitReached&&ye.pct>=100,nowSec:y},ye.id)),(fe=h.extraWindows)==null?void 0:fe.map(ye=>i.jsx(qa,{label:ye.label,pct:ye.pct,reset:ye.reset??void 0,resetAt:ye.resetAt??void 0,windowSec:ye.windowSec??void 0,nowSec:y},ye.id)),h.creditLimit&&i.jsx(qa,{label:`spend cap · $${Math.round(h.creditLimit.used)} of $${Math.round(h.creditLimit.limit)}`,pct:h.creditLimit.usedPct,reset:h.creditLimit.reset??void 0,resetAt:h.creditLimit.resetAt??void 0,limitReached:h.spendControlReached,nowSec:y}),h.creditsBalance&&!h.creditsUnlimited&&i.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",h.creditsBalance,h.overageReached&&" · overage limit reached"]}),h.creditsUnlimited&&i.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),h.resetCredits&&h.resetCredits.availableCount>0&&i.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Gt} only reports them`,children:[h.resetCredits.availableCount," rate-limit reset",h.resetCredits.availableCount!==1?"s":""," available",h.resetCredits.nextExpiryAt&&` · expires ${new Date(h.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),h.promo&&i.jsx("div",{className:"up-quota-sub",children:h.promo}),h.partial&&i.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(h==null?void 0:h.ok)===!1?i.jsxs("div",{className:"up-quota-na",children:[i.jsx("span",{children:"Quota unavailable."}),i.jsx("span",{className:"up-quota-hint",children:rD(h.reason)})]}):i.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(m==null?void 0:m.ok)&&m.window7d&&m.window7d.sessionCount>0&&i.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${m.window5h?`
|
|
75
|
-
last 5h: ${Mt(m.window5h.totalTokens)} tokens · ${m.window5h.sessionCount} session${m.window5h.sessionCount!==1?"s":""}`:""}`,children:[Mt(m.window7d.totalTokens)," tokens · ",m.window7d.sessionCount," session",m.window7d.sessionCount!==1?"s":""," (7d)"]})]}),q&&i.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":Y||void 0,onKeyDown:ye=>{var et;const Se=A.current.indexOf(ye.target);if(Se<0)return;const Pe=$5(ye.key,Se);Pe!==null&&(ye.preventDefault(),(et=A.current[Pe])==null||et.focus())},children:Cd.map((ye,Se)=>i.jsx("button",{type:"button",ref:Pe=>{A.current[Se]=Pe},tabIndex:E===ye.key?0:-1,"aria-pressed":E===ye.key,"data-pending":E===ye.key&&Y?"":void 0,title:E===ye.key&&Y?`Reading ${ye.noun} from the transcripts on this machine…`:ye.hint,className:"uh-range-btn",onClick:()=>C(ye.key),children:ye.label},ye.key))}),q&&i.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Y?`Reading ${
|
|
76
|
-
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 ",
|
|
77
|
-
${Se.sessionId}`:Se.sessionId,children:Se.label??Se.sessionId.slice(0,8)}),i.jsx("span",{className:"up-session-tokens",children:Mt(Se.tokens)}),Se.cost>0?i.jsx("span",{className:"up-session-cost",title:Se.models.join(", ")||void 0,children:at(Se.cost)}):i.jsx("span",{className:"up-session-cost up-unpriced",children:Qo})]},Se.sessionId)}),!q&&De.map(Se=>i.jsxs("div",{className:"up-session-row",children:[i.jsx("span",{className:`sl-dot state-${Se.state}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:dd(Se.state)}),i.jsx("span",{className:"up-session-label",children:Se.label}),i.jsx("span",{className:"up-session-tokens",children:Mt(Se.inputTokens+Se.outputTokens)}),Se.cost>0?i.jsxs("span",{className:"up-session-cost",title:Se.unpricedTokens>0?`${Mt(Se.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[at(Se.cost),Se.unpricedTokens>0?"+":""]}):i.jsx("span",{className:"up-session-cost up-unpriced",children:Qo})]},Se.sessionId))]})]})})(),_e&&i.jsxs("div",{className:"up-hint",children:["“",Qo,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):i.jsx("div",{className:"up-empty",children:q?i.jsxs(i.Fragment,{children:["No usage ",z,".",i.jsx("br",{}),"Try a longer period."]}):i.jsxs(i.Fragment,{children:["No usage data yet.",i.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const Zt={l:30,r:6,t:6,b:2},Bs={l:0,r:0,t:2,b:1},Ad=104,lD=64;function dr(e,t=100,n=Ad,s=Zt){const a=n-s.t-s.b;return s.t+a*(1-Math.max(0,Math.min(t,e))/t)}function P2(e,t,n,s=100,a=Ad,l=Zt){if(!e.length)return"";const c=e[e.length-1].t-e[0].t,d=f=>{const m=t-l.l-l.r;return l.l+(c>0?m*(f-e[0].t)/c:m/2)};let h="",p=null;for(const f of e){const m=p&&f.t-p.t<=n*2?"L":"M";h+=`${m}${d(f.t).toFixed(1)} ${dr(f.v,s,a,l).toFixed(1)}`,p=f}return h}function L2(e,t,n,s=100,a=Ad,l=Zt){if(e.length<2)return"";const c=a-l.b,d=e[e.length-1].t-e[0].t,h=t-l.l-l.r,p=v=>l.l+(d>0?h*(v-e[0].t)/d:h/2);let f="",m=[];const y=()=>{if(m.length>=2){let v=`M${p(m[0].t).toFixed(1)} ${c}`;for(const N of m)v+=`L${p(N.t).toFixed(1)} ${dr(N.v,s,a,l).toFixed(1)}`;f+=`${v}L${p(m[m.length-1].t).toFixed(1)} ${c}Z`}m=[]};for(const v of e)m.length&&v.t-m[m.length-1].t>n*2&&y(),m.push(v);return y(),f}function cD(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 D2(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function uD(e,t,n=s=>Ml(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),l=s[s.length-1];return`held back for ${a===1?"1 minute":`${a} minutes`}, last at ${n(l.t)}`}function Ml(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function _x(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 dD({group:e,title:t,onClose:n}){const s=Vt(n),[a,l]=x.useState(null);x.useEffect(()=>{let p=!0;const f=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const v=await y.json();p&&(v!=null&&v.ok)&&l(v)}catch{}};f();const m=window.setInterval(f,2e4);return()=>{p=!1,window.clearInterval(m)}},[e]);const c=(a==null?void 0:a.series)??[],[d,h]=x.useMemo(()=>{let p=1/0,f=0;for(const m of c)m.points.length&&(p=Math.min(p,m.points[0].t),f=Math.max(f,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,f]},[c,a==null?void 0:a.sinceMs]);return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[i.jsxs("div",{className:"modal-head",children:[i.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),a&&d>0&&i.jsxs("span",{className:"hist-since",children:["since ",Ml(d)," · ",_x(d,h||Date.now())]}),i.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),i.jsx("div",{className:"hist-body",children:a==null?i.jsx("p",{className:"hist-empty",children:"Reading…"}):c.length===0?i.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):c.map(p=>i.jsx(hD,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function hD({series:e,stepMs:t}){const n=x.useRef(null),[s,a]=x.useState(560),[l,c]=x.useState(null);x.useEffect(()=>{const A=n.current;if(!A||typeof ResizeObserver>"u")return;const D=new ResizeObserver(([O])=>a(Math.max(160,O.contentRect.width)));return D.observe(A),()=>D.disconnect()},[]);const{points:d,unit:h,warnAt:p,critAt:f,label:m,top:y,restsAtZero:v}=e,N=v?lD:Ad,{now:_,peak:S}=cD(d),k=h==="C"?"°C":h,j=m==="Throttling"?uD(d,t):null,E=l!=null?d[l]:null,C=d.length>1?d[d.length-1].t-d[0].t:0,T=A=>{const D=s-Zt.l-Zt.r;return Zt.l+(C>0?D*(A-d[0].t)/C:D/2)},R=A=>{if(d.length<2)return;const D=A.currentTarget.getBoundingClientRect(),O=(A.clientX-D.left-Zt.l)/Math.max(1,D.width-Zt.l-Zt.r),$=d[0].t+C*Math.max(0,Math.min(1,O));let B=0;for(let Z=1;Z<d.length;Z++)Math.abs(d[Z].t-$)<Math.abs(d[B].t-$)&&(B=Z);c(B)};return i.jsxs("section",{className:"hist-series","aria-label":`${m} history`,children:[i.jsxs("div",{className:"hist-head",children:[i.jsx("span",{className:"hist-label",children:m}),i.jsxs("span",{className:"hist-stats",children:[_!=null&&i.jsxs(i.Fragment,{children:[i.jsx("b",{children:_}),i.jsxs("span",{children:[k," now"]})]}),S!=null&&i.jsxs(i.Fragment,{children:[i.jsx("b",{className:D2(S,p,f),children:S}),i.jsxs("span",{children:[k," peak"]})]})]})]}),i.jsx("div",{className:"hist-plot",ref:n,children:i.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 ${S}${k}, over ${_x(d[0].t,d[d.length-1].t)}`,onPointerMove:R,onPointerLeave:()=>c(null),children:[[["warn",p],["hot",f]].map(([A,D])=>D==null||D>y?null:i.jsxs("g",{children:[i.jsx("line",{className:`hist-rule ${A}`,x1:Zt.l,x2:s-Zt.r,y1:dr(D,y,N),y2:dr(D,y,N)}),i.jsx("text",{className:`hist-rule-tag ${A}`,x:2,y:dr(D,y,N)+3,children:D})]},A)),i.jsx("line",{className:"hist-floor",x1:Zt.l,x2:s-Zt.r,y1:N-Zt.b,y2:N-Zt.b}),i.jsx("path",{className:"hist-area",d:L2(d,s,t,y,N)}),i.jsx("path",{className:"hist-line",d:P2(d,s,t,y,N)}),d.length===1&&i.jsx("circle",{className:"hist-dot",cx:T(d[0].t),cy:dr(d[0].v,y,N),r:3}),E&&i.jsxs("g",{children:[i.jsx("line",{className:"hist-cross",x1:T(E.t),x2:T(E.t),y1:Zt.t,y2:N-Zt.b}),i.jsx("circle",{className:"hist-dot",cx:T(E.t),cy:dr(E.v,y,N),r:3})]})]})}),i.jsx("div",{className:"hist-axis",children:E?i.jsxs("span",{className:"hist-at",children:[Ml(E.t)," — ",i.jsx("b",{children:E.v}),k]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:d.length?Ml(d[0].t):""}),i.jsx("span",{children:d.length?Ml(d[d.length-1].t):""})]})}),j&&i.jsx("div",{className:"hist-note",children:j})]})}const fD="thermal:Throttling";function pD(e){var n,s,a,l;const t={};e.cpu!=null&&(t["cpu:all"]=e.cpu),(n=e.perCore)!=null&&n.length&&(t["cpu:busiest"]=Math.max(...e.perCore)),e.memory&&(t["mem:physical"]=e.memory.usedPct),e.swap&&e.swap.total>0&&(t["mem:swap"]=Math.round(e.swap.used/e.swap.total*1e3)/10),(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(l=e.thermal)!=null&&l.throttle&&(t[fD]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function Ku(e,t){return t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function Mu(e,t){return Number.isInteger(e)?t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`:Ku(e,t)}const x1=["cores","memory","load","thermal"],Fa=116,$r=24,mD=60,gD=6e4;function yD(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function wD(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function vD(e,t=mD){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function xD({sys:e}){const[t,n]=x.useState({});x.useEffect(()=>{let c=!0;const d=async()=>{const p=await Promise.all(x1.map(async f=>{try{const m=await fetch(`/api/system/history?group=${f}`);return m.ok?[f,await m.json()]:[f,null]}catch{return[f,null]}}));c&&n(f=>{const m={...f};for(const[y,v]of p)v!=null&&v.ok&&(m[y]=v);return m})};d();const h=setInterval(()=>void d(),gD);return()=>{c=!1,clearInterval(h)}},[]);const s=x.useMemo(()=>pD(e),[e]),a=x.useMemo(()=>x1.flatMap(c=>{const d=t[c];return d?d.series.filter(yD).map(h=>({series:vD(h),stepMs:d.stepMs})):[]}),[t]),l=x.useMemo(()=>{let c=1/0,d=-1/0;for(const{series:h}of a){const p=h.points;p.length&&(c=Math.min(c,p[0].t),d=Math.max(d,p[p.length-1].t))}return Number.isFinite(c)?_x(c,d):"less than a minute"},[a]);return Object.keys(s).length?i.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${l}`,children:a.map(({series:c,stepMs:d})=>i.jsx(bD,{series:c,stepMs:d,now:s[c.key],span:l},c.key))}):null}function bD({series:e,stepMs:t,now:n,span:s}){var v;const{points:a,top:l,unit:c,warnAt:d,critAt:h}=e,p=wD(e),f=n??((v=a[a.length-1])==null?void 0:v.v),m=f==null?"":D2(f,d,h),y=Math.max(...a.map(N=>N.v));return i.jsxs("div",{className:`pl-cell${m?` ${m}`:""}`,title:[`${p} · peak ${Ku(y,c)} over the last ${s}`,d!=null?`over ${Mu(d,c)} is uncomfortable`:"",h!=null?`over ${Mu(h,c)} the machine acts`:""].filter(Boolean).join(" · "),children:[i.jsxs("div",{className:"pl-cell-head",children:[i.jsx("span",{className:"pl-cell-label",children:p}),i.jsx("span",{className:"pl-cell-now",children:f==null?"—":Ku(f,c)})]}),i.jsxs("svg",{className:"pl-spark",width:Fa,height:$r,viewBox:`0 0 ${Fa} ${$r}`,preserveAspectRatio:"none","aria-hidden":!0,children:[i.jsx("line",{className:"pl-spark-floor",x1:0,x2:Fa,y1:$r-Bs.b,y2:$r-Bs.b}),i.jsx("path",{className:"pl-spark-area",d:L2(a,Fa,t,l,$r,Bs)}),d!=null&&i.jsx("line",{className:"pl-rule warn",x1:0,x2:Fa,y1:dr(d,l,$r,Bs),y2:dr(d,l,$r,Bs)}),h!=null&&i.jsx("line",{className:"pl-rule hot",x1:0,x2:Fa,y1:dr(h,l,$r,Bs),y2:dr(h,l,$r,Bs)}),i.jsx("path",{className:"pl-spark-line",d:P2(a,Fa,t,l,$r,Bs)})]}),i.jsxs("span",{className:"vis-hidden",children:["peak ",Ku(y,c)," over the last ",s,d!=null&&`, uncomfortable over ${Mu(d,c)}`,h!=null&&`, the machine acts over ${Mu(h,c)}`]})]})}const kD={key:"cpu",dir:"desc"};function _D(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function ND(e,t){const n=t.dir==="asc"?1:-1,s=l=>t.key==="cpu"?l.cpu:t.key==="mem"?l.mem:t.key==="rss"?l.rssBytes:t.key==="threads"?l.threads:l.uptimeSec,a=(l,c)=>{if(t.key==="name")return n*l.name.localeCompare(c.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=l.user??"",f=c.user??"";return!p||!f?p===f?0:p?-1:1:n*p.localeCompare(f,void 0,{sensitivity:"base"})}const d=s(l),h=s(c);return d==null||h==null?d==null?h==null?0:1:-1:n*(d-h)};return[...e].sort((l,c)=>a(l,c)||(c.cpu??-1)-(l.cpu??-1)||c.mem-l.mem||l.pid-c.pid)}function SD(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const jD=4e3;function ED(){const[e,t]=x.useState(null);return x.useEffect(()=>{let n=!0;const s=async()=>{if(document.visibilityState!=="hidden")try{const l=await fetch("/api/system/processes?detail=1");if(!l.ok)return;const c=await l.json();n&&(c!=null&&c.ok)&&t({procs:c.procs??[],total:c.total??0})}catch{}};s();const a=window.setInterval(s,jD);return()=>{n=!1,window.clearInterval(a)}},[]),e}function CD(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 TD(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 AD({sys:e,onClose:t}){const n=Vt(t),[s,a]=x.useState(kD),l=ED(),c=l?ND(l.procs,s):null;return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:n,className:"modal pl-modal",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[i.jsxs("div",{className:"modal-head",children:[i.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),l&&i.jsxs("span",{className:"pl-count",children:[c.length," of ",l.total," running"]}),i.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),i.jsxs("div",{className:"pl-split",children:[i.jsx("div",{className:"pl-body",children:c==null?i.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):c.length===0?i.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):i.jsxs("table",{className:"sd-procs pl-table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx(Yo,{col:"cpu",label:"cpu",sort:s,onSort:a}),i.jsx(Yo,{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}),i.jsx(Yo,{col:"threads",label:"threads",sort:s,onSort:a}),i.jsx(Yo,{col:"uptime",label:"up",sort:s,onSort:a}),i.jsx(Yo,{col:"user",label:"user",sort:s,onSort:a}),i.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),i.jsx(Yo,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:s,onSort:a})]})}),i.jsx("tbody",{children:c.map(d=>i.jsxs("tr",{children:[i.jsx("td",{className:"sd-num",children:d.cpu==null?"—":d.cpu.toFixed(0)}),i.jsx("td",{className:"sd-num sd-dim",title:`${d.mem.toFixed(1)}% of installed memory`,children:CD(d.rssBytes)}),i.jsx("td",{className:"sd-num sd-dim",children:d.threads??"—"}),i.jsx("td",{className:"sd-num sd-dim",children:TD(d.uptimeSec)}),i.jsx("td",{className:"sd-dim pl-user",children:d.user??"—"}),i.jsx("td",{className:"sd-num sd-dim pl-pid",children:d.pid}),i.jsxs("td",{className:"pl-name",children:[d.name,d.cmd&&i.jsxs("span",{className:"pl-cmd",title:d.cmd,children:[" ",d.cmd]})]})]},d.pid))})]})}),i.jsx(xD,{sys:e})]})]})}),document.body)}function Yo({col:e,label:t,note:n,sort:s,onSort:a}){const l=SD(s,e);return i.jsx("th",{scope:"col","aria-sort":l,children:i.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
73
|
+
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,T2="session spend";function kx({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(l,c,d)=>{if(l<=0)return null;const h=l/n*100;return i.jsx("span",{className:`cb-seg ${c}`,style:{width:`${h}%`},title:`${d}: ${ot(l)} (${h.toFixed(0)}%)`},c)},a=t==="lg";return i.jsxs("div",{className:a?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[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 S5({state:e,sessionId:t,onClose:n}){const s=x.useMemo(()=>j5(e,t),[e,t]),a=x.useRef(null),l=Vt(n,{focusRef:a});return s?i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:l,className:"modal session-summary",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[i.jsxs("div",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),i.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),i.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),i.jsxs("div",{className:"modal-actions",children:[i.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),i.jsx("button",{type:"button",ref:a,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),i.jsxs("div",{className:"modal-body",children:[i.jsxs("section",{className:"ss-hero",children:[i.jsxs("div",{className:"ss-hero-left",children:[i.jsx("div",{className:"ss-cost-label",children:T2}),i.jsx("div",{className:"ss-cost",children:ot(s.cost.total)}),s.modelChips.length>0&&i.jsx("div",{className:"ss-models",children:s.modelChips.map(c=>i.jsx("span",{className:"model-chip","data-family":jd(c),title:c,children:Vs(c)},c))})]}),i.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&i.jsxs(i.Fragment,{children:[i.jsx(kx,{cost:s.cost,size:"lg"}),i.jsxs("div",{className:"ss-cost-legend",children:[i.jsxs("span",{className:"ssl ssl-in",children:["input ",i.jsx("b",{children:ot(s.cost.input)})]}),i.jsxs("span",{className:"ssl ssl-out",children:["output ",i.jsx("b",{children:ot(s.cost.output)})]}),i.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",i.jsx("b",{children:ot(s.cost.cacheRead)})]}),i.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",i.jsx("b",{children:ot(s.cost.cacheWrite)})]})]})]})})]}),i.jsxs("section",{className:"ss-stats",children:[i.jsx(Ko,{label:"agents",value:s.agentCount}),i.jsx(Ko,{label:"subagents",value:s.subagentCount}),i.jsx(Ko,{label:"tool calls",value:s.toolCount}),i.jsx(Ko,{label:"prompts",value:s.promptCount}),i.jsx(Ko,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&i.jsx(Ko,{label:"errors",value:s.errCount,tone:"err"})]}),s.topTools.length>0&&i.jsxs("section",{className:"modal-section",children:[i.jsx("h4",{children:"Most-used tools"}),i.jsx("div",{className:"ss-top-tools",children:s.topTools.map(([c,d])=>i.jsxs("div",{className:"ss-tt",children:[i.jsx("span",{className:"ss-tt-name",children:c}),i.jsx("span",{className:"ss-tt-bar",children:i.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${d/s.topTools[0][1]*100}%`}})}),i.jsx("span",{className:"ss-tt-count",children:d})]},c))})]}),s.firstPrompt&&i.jsxs("section",{className:"modal-section",children:[i.jsx("h4",{children:"Opening prompt"}),i.jsx("div",{className:"ss-prompt",children:s.firstPrompt})]})]})]})}):null}function Ko({label:e,value:t,tone:n}){return i.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[i.jsx("div",{className:"ss-stat-value",children:t}),i.jsx("div",{className:"ss-stat-label",children:e})]})}function j5(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},l=new Set,c=new Map;let d=0,h=0,p=0,f=0,m=0,y,v=1/0,N=0;for(const E of s){const C=An(E);a.input+=C.input,a.output+=C.output,a.cacheRead+=C.cacheRead,a.cacheWrite+=C.cacheWrite,a.total+=C.total;for(const T of y2(E))l.add(T);E.model&&l.add(E.model),E.kind==="subagent"&&m++,h+=E.prompts.length,!y&&E.prompts.length>0&&(y=E.prompts[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,d+=E.toolCount,v=Math.min(v,E.startedAt),N=Math.max(N,E.endedAt??Date.now());for(const T of E.tools)c.set(T.name,(c.get(T.name)??0)+1),T.ok===!1&&f++}const _=Math.max(0,N-v),S=Math.floor(_/1e3),k=S<60?`${S}s`:S<3600?`${Math.floor(S/60)}m ${String(S%60).padStart(2,"0")}s`:`${Math.floor(S/3600)}h ${Math.floor(S%3600/60)}m`,j=Array.from(c.entries()).sort((E,C)=>C[1]-E[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:k,cost:a,modelChips:Array.from(l),agentCount:s.length,subagentCount:m,toolCount:d,promptCount:h,tokensSum:p,errCount:f,topTools:j,firstPrompt:y}}function m1(e){return e.waiting?nc(e.waiting)?0:1:e.state==="active"?2:3}function E5(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let a=s.toolCount,l=An(s).total,c=s.endedAt??s.startedAt;for(const d of e.agents.values()){if(d.sessionId!==s.sessionId||d.kind==="root")continue;a+=d.toolCount,l+=An(d).total;const h=d.endedAt??d.startedAt;h>c&&(c=h)}n.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",cwdBasename:s.cwdBasename,state:s.state,waiting:s.waiting,modelId:s.model,toolCount:a,cost:l,startedAt:s.startedAt,lastActivity:c})}return n.sort((s,a)=>{const l=m1(s),c=m1(a);return l!==c?l-c:s.waiting&&a.waiting?s.waiting.since-a.waiting.since:a.lastActivity-s.lastActivity}),n}function g1(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 l=Math.floor(a/60);return l<60?`${l}m`:`${Math.floor(l/60)}h ${l%60}m`}function C5({state:e,now:t,selectedIds:n,onSelect:s,onClose:a}){const l=x.useMemo(()=>E5(e),[e,e.revision,t]),c=l.filter(h=>h.state==="active").length,d=l.filter(h=>nc(h.waiting)).length;return i.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[i.jsxs("div",{className:"sl-header",children:[i.jsxs("h2",{children:["Sessions ",i.jsx("span",{className:"sl-count",children:l.length})]}),d>0&&i.jsxs("span",{className:"sl-waiting-count",children:[d," waiting"]}),c>0&&i.jsxs("span",{className:"sl-live-count",children:[c," live"]}),i.jsx("button",{className:"glyph-btn sl-close",onClick:a,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),i.jsxs("div",{className:"sl-rows",children:[l.length===0&&i.jsx("div",{className:"sl-empty",children:"No sessions yet."}),l.map(h=>{const p=n.has(h.sessionId);return i.jsxs("button",{type:"button",className:`sl-row state-${h.state}${p?" selected":""}`,onClick:()=>s(h.sessionId),title:`Focus ${h.label}`,children:[i.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:dd(h.state)}),i.jsxs("div",{className:"sl-row-body",children:[i.jsxs("div",{className:"sl-row-head",children:[i.jsx("span",{className:"sl-label",children:h.label}),h.modelId&&i.jsx("span",{className:"model-chip","data-family":jd(h.modelId),title:h.modelId,children:Vs(h.modelId)})]}),i.jsxs("div",{className:"sl-row-meta",children:[i.jsxs("span",{title:"tool calls",children:[i.jsx("b",{children:h.toolCount})," tools"]}),h.cost>0&&i.jsx("span",{className:"sl-cost",title:T2,children:i.jsx("b",{children:ot(h.cost)})}),h.waiting?i.jsxs("span",{className:"sl-waiting",title:[zl(h.waiting),S4(h.waiting,zl(h.waiting)),`Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
74
|
+
`),children:["waiting ",g1(h.waiting.since,void 0,t),h.waiting.tool&&i.jsxs("span",{className:"sl-waiting-tool",children:[" · ",h.waiting.tool.name]})]}):i.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:g1(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]})]})]},h.sessionId)})]})]})}const T5=e=>1-Math.pow(1-e,5),A2=420;function A5(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 R5(e,t,n,s=A2){return n>=s?t:n<=0?e:e+(t-e)*T5(n/s)}function M5(e,t,n,s={}){const a=s.now??(()=>performance.now()),l=s.raf??(v=>requestAnimationFrame(v)),c=s.cancel??(v=>cancelAnimationFrame(v)),d=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),h=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(d()||h()||!A5(e,t))return n(t),()=>{};const p=a();let f=0,m=!0;const y=()=>{if(!m)return;const v=a()-p;n(R5(e,t,v)),v<A2&&(f=l(y))};return f=l(y),()=>{m=!1,f&&c(f)}}const $v={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function y1(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const a=An(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 I5(e,t){if(!e)return $v;const n={...$v};for(const[s,a]of t){const l=e.get(s);if(!l)continue;const c={cost:a.cost-l.cost,inputTokens:a.inputTokens-l.inputTokens,outputTokens:a.outputTokens-l.outputTokens,cacheReadTokens:a.cacheReadTokens-l.cacheReadTokens,cacheCreateTokens:a.cacheCreateTokens-l.cacheCreateTokens};c.cost<0||c.inputTokens<0||c.outputTokens<0||c.cost===0&&c.inputTokens===0&&c.outputTokens===0&&c.cacheReadTokens===0&&c.cacheCreateTokens===0||(n.cost+=c.cost,n.inputTokens+=Math.max(0,c.inputTokens),n.outputTokens+=Math.max(0,c.outputTokens),n.cacheReadTokens+=Math.max(0,c.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,c.cacheCreateTokens),n.sessions+=1)}return n}function Ov(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const Cd=[{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 $5(e,t,n=Cd.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 O5(e,t=new Date){return e==="today"?Ov(1,t):e==="month"?Ov(t.getDate(),t):"20200101"}const Tn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Yu=e=>typeof e=="string"?e:"";function R2(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 l of a){const c=Yu(l==null?void 0:l.modelName);if(!c)continue;let d=n.get(c);d||(d={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,d)),d.cost+=Tn(l==null?void 0:l.cost),d.inputTokens+=Tn(l==null?void 0:l.inputTokens),d.outputTokens+=Tn(l==null?void 0:l.outputTokens),d.cacheReadTokens+=Tn(l==null?void 0:l.cacheReadTokens),d.cacheCreateTokens+=Tn(l==null?void 0:l.cacheCreationTokens)}}return[...n.values()].sort((s,a)=>a.cost-s.cost||a.tokens-s.tokens)}const P5=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function L5(e){var t;return((t=P5.exec(e))==null?void 0:t[0])??e}function D5(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const a of n){const l=Yu(a==null?void 0:a.period);if(!l)continue;const c=L5(l),d=a==null?void 0:a.metadata,h=typeof(d==null?void 0:d.lastActivity)=="string"?Date.parse(d.lastActivity):NaN;s.push({sessionId:c,label:t.get(c)??null,agent:Yu(a==null?void 0:a.agent)||"claude",cost:Tn(a==null?void 0:a.totalCost),tokens:Tn(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(Yu).filter(Boolean):[],lastActivityMs:Number.isFinite(h)?h:null})}return s.sort((a,l)=>l.cost-a.cost||l.tokens-a.tokens)}function M2(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const h=Tn(t.cacheReadTokens),p=Tn(t.cacheCreationTokens),f=Tn(t.inputTokens),m=Tn(t.outputTokens);return{cost:Tn(t.totalCost),inputTokens:f,outputTokens:m,cacheReadTokens:h,cacheCreateTokens:p,tokens:Tn(t.totalTokens)||f+m+h+p}}const n=R2(e),s=h=>n.reduce((p,f)=>p+h(f),0),a=s(h=>h.inputTokens),l=s(h=>h.outputTokens),c=s(h=>h.cacheReadTokens),d=s(h=>h.cacheCreateTokens);return{cost:s(h=>h.cost),inputTokens:a,outputTokens:l,cacheReadTokens:c,cacheCreateTokens:d,tokens:a+l+c+d}}function q5(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 w1(e,t){var n;return((n=Cd.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function F5(e,t,n){const s=e!=null,a=M2(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 B5="1",v1="agent-dag.schema",z5=["agent-dag.layout","agent-dag.viewport"];function wi(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function U5(e,t=B5){let n=null;try{n=e.getItem(v1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const a of z5)try{e.getItem(a)!==null&&(e.removeItem(a),s.push(a))}catch{}try{e.setItem(v1,t)}catch{}return s}const Gt="ccdeck";function I2(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 Pv(e){return I2(Math.floor(e/1e3))}function $2(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),a=Math.floor(n%86400/3600),l=Math.floor(n%3600/60);return s>0?`${s}d ${a}h`:a>0?`${a}h ${l}m`:`${l}m`}function W5(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function H5(e,t,n){const s=new Date(e),a=Pv(t-e);return{label:W5(s,new Date(t))?a:`${a} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function Ys(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function Td(e){return e==null}const Lv="self";function hr(e,t=!1){const n=Ys(e?Lv:null,Lv);return{disabled:t||n.disabled,"aria-busy":n.busy}}function fr(e){return Td(e?Lv:null)}function G5(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function V5(e){return e==null||e==="BODY"||e==="HTML"}const O2="agent-dag.usagePeriod";function Y5(){const e=wi(O2);return Cd.some(t=>t.key===e)?e:"today"}function K5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(O2,e)}catch{}}const P2="agent-dag.usageSessionsOpen";function X5(){return wi(P2)==="1"}function Q5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(P2,e?"1":"0")}catch{}}function x1(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 Z5(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 Bf="__unknown__";function J5(e,t,n,s){const a=Math.max(0,t-s),l=Math.max(0,n-a);if(l<120)return null;const c=Math.min(100,l/n*100),d=e-c;if(Math.abs(d)<3)return{label:"on pace",color:"var(--ok)",expectedPct:c,isDeficit:!1};if(d>0){const h=100-e,p=l>0?e/l:0,f=p>0?h/p:1/0,m={label:`${Math.round(d)}% ahead`,color:"var(--warn)",expectedPct:c,isDeficit:!0};if(f<a&&f<86400){const y=Math.floor(f/3600),v=Math.floor(f%3600/60);m.runsOutIn=y>0?`${y}h ${v}m`:`${v}m`}return m}return{label:`${Math.round(-d)}% reserve`,color:"var(--ok)",expectedPct:c,isDeficit:!1}}function Fa({pct:e,label:t,reset:n,resetAt:s,windowSec:a,limitReached:l,nowSec:c}){const d=Math.min(100,Math.max(0,e)),p=l||d>=90?"var(--err)":d>=70?"var(--warn)":"var(--accent)",f=d===0?"< 1%":`${d}%`,m=d===0?2:d,y=s?$2(s,c):null,v=s&&a?J5(d,s,a,c):null;return i.jsxs("div",{className:"qb-row",children:[i.jsxs("div",{className:"qb-meta",children:[i.jsxs("span",{className:"qb-label",children:[t,l&&i.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),i.jsx("span",{className:"qb-pct",style:{color:p},children:f})]}),i.jsxs("div",{className:"qb-track",children:[i.jsx("div",{className:"qb-fill",style:{width:`${m}%`,background:p,opacity:d===0?.4:1}}),v&&i.jsx("div",{className:"qb-pace-marker",style:{left:`${v.expectedPct}%`,background:v.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(v.expectedPct)}% by now`})]}),i.jsxs("div",{className:"qb-reset-row",children:[y?i.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?i.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,v&&i.jsx("span",{className:"qb-pace",style:{color:v.color},children:v.runsOutIn?`runs out in ${v.runsOutIn}`:v.label})]})]})}const eD=6e4;function tD(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),l=x.useRef(null),c=x.useRef(!1),d=async(p=!1)=>{if(!(p&&!fr(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/quota?refresh=1":"/api/quota");m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return d(!0),l.current=window.setInterval(()=>d(!1),eD),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&d(!0)}}}function nD(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 rD(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 L2=6e4,b1=6e4;function sD(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),l=x.useRef(null),c=x.useRef(!1),d=async(p=!1)=>{if(!(p&&!fr(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 d(!0),l.current=window.setInterval(()=>d(!1),L2),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&d(!0)}}}function aD(e){const[t,n]=x.useState(null),s=x.useRef(null),a=async()=>{try{const l=await fetch("/api/codex-usage");l.ok&&n(await l.json())}catch{}};return x.useEffect(()=>{if(e)return a(),s.current=window.setInterval(a,L2),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function oD(e,t,n){const[s,a]=x.useState(null),[l,c]=x.useState(!1),[d,h]=x.useState(0),p=x.useRef(0);x.useEffect(()=>{const m=()=>document.visibilityState==="visible",y=()=>{m()&&h(_=>_+1)},v=window.setInterval(y,b1),N=()=>{m()&&Date.now()-p.current>=b1&&h(_=>_+1)};return document.addEventListener("visibilitychange",N),()=>{window.clearInterval(v),document.removeEventListener("visibilitychange",N)}},[]);const f=x.useRef(t);return x.useEffect(()=>{let m=!0;const y=t!==f.current;f.current=t;const v=e,N=O5(v);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:v,data:_,baseline:n()}))}).catch(()=>{}).finally(()=>{m&&c(!1)}),()=>{m=!1}},[e,t,d]),{...q5(s,e),loading:l}}function kl(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 M5(s.current,e,c=>{s.current=c,n(c)})},[e]),t}function iD({state:e,now:t,providers:n,leaving:s,onClose:a}){var Qe,fe;const{quota:l,loading:c,refresh:d}=tD(n.claude),{data:h,loading:p,refresh:f}=sD(n.codex),{data:m}=aD(n.codex),[y,v]=x.useState(()=>Math.floor(Date.now()/1e3));x.useEffect(()=>{const ye=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ye)},[]);const{byModel:N,totalCost:_,totalTokens:S,burnRate:k}=x.useMemo(()=>{const ye=new Map;for(const ze of e.agents.values())for(const Xe of tc(ze)){const re=Xe.model??Bf,Fe=yx(Xe.usage,Xe.model),se=ye.get(re);se?(se.inputTokens+=Xe.usage.inputTokens,se.outputTokens+=Xe.usage.outputTokens,se.cacheReadTokens+=Xe.usage.cacheReadTokens,se.cacheCreateTokens+=Xe.usage.cacheCreateTokens,se.cost.total+=Fe.total,se.cost.input+=Fe.input,se.cost.output+=Fe.output,se.cost.cacheRead+=Fe.cacheRead,se.cost.cacheWrite+=Fe.cacheWrite,se.agentCount++):ye.set(re,{model:re,inputTokens:Xe.usage.inputTokens,outputTokens:Xe.usage.outputTokens,cacheReadTokens:Xe.usage.cacheReadTokens,cacheCreateTokens:Xe.usage.cacheCreateTokens,cost:{...Fe},agentCount:1,priced:yi(Xe.model)!=null})}const Se=Array.from(ye.values()).sort((ze,Xe)=>Xe.cost.total-ze.cost.total||Xe.inputTokens+Xe.outputTokens-(ze.inputTokens+ze.outputTokens));let Pe=0,et=0;for(const ze of e.agents.values()){if(ze.state!=="active")continue;const Xe=An(ze);Pe+=Xe.total,et=Math.max(et,((ze.endedAt??t)-ze.startedAt)/1e3)}const ft=et>0?wx(Pe,et):null,dt=k5(e.agents.values());return{byModel:Se,totalCost:dt.cost,totalTokens:dt,burnRate:ft}},[e,e.revision,t]),j=x.useMemo(()=>{const ye=[];for(const Se of e.agents.values()){if(Se.kind!=="root")continue;let Pe=An(Se).total,et=Se.usage.inputTokens,ft=Se.usage.outputTokens,dt=Rv(Se);for(const ze of e.agents.values())ze.sessionId!==Se.sessionId||ze.kind==="root"||(Pe+=An(ze).total,et+=ze.usage.inputTokens,ft+=ze.usage.outputTokens,dt+=Rv(ze));ye.push({sessionId:Se.sessionId,label:Se.label||Se.cwdBasename||"session",state:Se.state,cost:Pe,inputTokens:et,outputTokens:ft,unpricedTokens:dt})}return ye.sort((Se,Pe)=>Pe.cost-Se.cost||Pe.inputTokens+Pe.outputTokens-(Se.inputTokens+Se.outputTokens)).slice(0,12)},[e,e.revision]),[E,C]=x.useState(Y5);x.useEffect(()=>{K5(E)},[E]);const[T,R]=x.useState(X5);x.useEffect(()=>{Q5(T)},[T]);const A=x.useRef([]),[D,O]=x.useState(0),$=x.useRef(()=>new Map);$.current=()=>y1(e.agents.values(),t);const F=x.useCallback(()=>$.current(),[]),{data:Z,shown:J,stale:I,loading:X,baseline:G}=oD(E,D,F),q=Z!=null,Y=X&&I,L=x.useMemo(()=>{const ye=new Map;for(const Se of e.agents.values()){if(Se.kind!=="root"||!Se.sessionId)continue;const Pe=Se.label||Se.cwdBasename;Pe&&ye.set(Se.sessionId,Pe)}return ye},[e,e.revision]),K=x.useMemo(()=>{const ye=new Map;for(const Se of e.agents.values())Se.kind!=="root"||!Se.sessionId||ye.set(Se.sessionId,Se.state);return ye},[e,e.revision]),P=x.useMemo(()=>q?R2(Z):[],[Z,q]),V=x.useMemo(()=>{if(!q)return[];const ye=D5(Z,L).slice(0,12),Se=new Map;for(const Pe of ye)Pe.label&&Se.set(Pe.label,(Se.get(Pe.label)??0)+1);return ye.map(Pe=>Pe.label&&(Se.get(Pe.label)??0)>1?{...Pe,label:`${Pe.label} ${Pe.sessionId.slice(0,4)}`}:Pe)},[Z,q,L]),he=x.useMemo(()=>M2(Z),[Z]),U=w1(J,E),W=I?" up-stale":"",ee=x.useMemo(()=>q?I5(G,y1(e.agents.values(),t)):$v,[e,e.revision,G,q,t]),H=F5(Z,{...S,cost:_},ee),ae=H.hasCost,me=H.tokenSum,ge=kl(H.cost),Re=kl(H.inputTokens),$e=kl(H.outputTokens),ce=kl(H.cacheReadTokens),we=kl(H.cacheCreateTokens),xe=N.filter(ye=>ye.cost.total>0||ye.inputTokens+ye.outputTokens>0),De=j.filter(ye=>ye.cost>0||ye.inputTokens+ye.outputTokens>0),_e=q?P.some(ye=>ye.cost<=0&&ye.tokens>0):xe.some(ye=>!ye.priced),Ee=c||p,Ge=x1(l==null?void 0:l.fetchedAt,y),st=x1(h==null?void 0:h.fetchedAt,y),Je=()=>{d(),f(),O(ye=>ye+1)},Ze=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return i.jsxs("aside",{className:`usage-panel${s?" leaving":""}`,id:"usage-panel","aria-label":"Usage",children:[i.jsxs("div",{className:"up-header",children:[i.jsx("h2",{children:"Usage"}),k&&i.jsx("span",{className:"up-rate",children:k}),i.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&i.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:Je,...hr(Ee),"aria-label":Ze,title:Ze,children:Ee?"…":"↻"}),i.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:a,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&i.jsxs("section",{className:"up-section up-quota-section",children:[i.jsxs("h3",{className:"up-section-title",children:["Claude quota",Ge&&!c&&i.jsx("span",{className:"up-section-age",title:Z5(l==null?void 0:l.source),children:Ge})]}),l!=null&&l.ok?i.jsxs("div",{className:"up-quota-bars",children:[l.session5hPct!=null&&i.jsx(Fa,{label:"5-hour window",pct:l.session5hPct,reset:l.session5hReset,resetAt:l.session5hResetAt,windowSec:l.session5hWindowSec,nowSec:y}),l.week7dPct!=null&&i.jsx(Fa,{label:"7-day window",pct:l.week7dPct,reset:l.week7dReset,resetAt:l.week7dResetAt,windowSec:l.week7dWindowSec,nowSec:y}),l.weekSonnetPct!=null&&i.jsx(Fa,{label:"Sonnet (7d)",pct:l.weekSonnetPct,nowSec:y}),l.weekOpusPct!=null&&i.jsx(Fa,{label:"Opus (7d)",pct:l.weekOpusPct,nowSec:y})]}):(l==null?void 0:l.ok)===!1?i.jsxs("div",{className:"up-quota-na",children:[i.jsx("span",{children:l.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),i.jsx("span",{className:"up-quota-hint",children:nD(l.reason)})]}):i.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&i.jsxs("section",{className:"up-section up-quota-section",children:[i.jsxs("h3",{className:"up-section-title",children:["Codex quota",(h==null?void 0:h.ok)&&h.planLabel&&i.jsx("span",{className:"up-plan-badge",children:h.planLabel}),st&&!p&&i.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:st})]}),h!=null&&h.ok?i.jsxs("div",{className:"up-quota-bars",children:[(Qe=h.windows)==null?void 0:Qe.map(ye=>i.jsx(Fa,{label:ye.label,pct:ye.pct,reset:ye.reset??void 0,resetAt:ye.resetAt??void 0,windowSec:ye.windowSec??void 0,limitReached:h.limitReached&&ye.pct>=100,nowSec:y},ye.id)),(fe=h.extraWindows)==null?void 0:fe.map(ye=>i.jsx(Fa,{label:ye.label,pct:ye.pct,reset:ye.reset??void 0,resetAt:ye.resetAt??void 0,windowSec:ye.windowSec??void 0,nowSec:y},ye.id)),h.creditLimit&&i.jsx(Fa,{label:`spend cap · $${Math.round(h.creditLimit.used)} of $${Math.round(h.creditLimit.limit)}`,pct:h.creditLimit.usedPct,reset:h.creditLimit.reset??void 0,resetAt:h.creditLimit.resetAt??void 0,limitReached:h.spendControlReached,nowSec:y}),h.creditsBalance&&!h.creditsUnlimited&&i.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",h.creditsBalance,h.overageReached&&" · overage limit reached"]}),h.creditsUnlimited&&i.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),h.resetCredits&&h.resetCredits.availableCount>0&&i.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Gt} only reports them`,children:[h.resetCredits.availableCount," rate-limit reset",h.resetCredits.availableCount!==1?"s":""," available",h.resetCredits.nextExpiryAt&&` · expires ${new Date(h.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),h.promo&&i.jsx("div",{className:"up-quota-sub",children:h.promo}),h.partial&&i.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(h==null?void 0:h.ok)===!1?i.jsxs("div",{className:"up-quota-na",children:[i.jsx("span",{children:"Quota unavailable."}),i.jsx("span",{className:"up-quota-hint",children:rD(h.reason)})]}):i.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(m==null?void 0:m.ok)&&m.window7d&&m.window7d.sessionCount>0&&i.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${m.window5h?`
|
|
75
|
+
last 5h: ${Mt(m.window5h.totalTokens)} tokens · ${m.window5h.sessionCount} session${m.window5h.sessionCount!==1?"s":""}`:""}`,children:[Mt(m.window7d.totalTokens)," tokens · ",m.window7d.sessionCount," session",m.window7d.sessionCount!==1?"s":""," (7d)"]})]}),q&&i.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":Y||void 0,onKeyDown:ye=>{var et;const Se=A.current.indexOf(ye.target);if(Se<0)return;const Pe=$5(ye.key,Se);Pe!==null&&(ye.preventDefault(),(et=A.current[Pe])==null||et.focus())},children:Cd.map((ye,Se)=>i.jsx("button",{type:"button",ref:Pe=>{A.current[Se]=Pe},tabIndex:E===ye.key?0:-1,"aria-pressed":E===ye.key,"data-pending":E===ye.key&&Y?"":void 0,title:E===ye.key&&Y?`Reading ${ye.noun} from the transcripts on this machine…`:ye.hint,className:"uh-range-btn",onClick:()=>C(ye.key),children:ye.label},ye.key))}),q&&i.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Y?`Reading ${w1(E,E)}…`:""}),me>0?i.jsxs(i.Fragment,{children:[ae&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`up-total${W}`,title:q?void 0:p1,children:[i.jsx("span",{className:"up-total-value",children:ot(ge)}),i.jsx("span",{className:"up-total-label",children:q?U:_5})]}),H.showCostBar&&i.jsx(kx,{cost:_})]}),i.jsxs("div",{className:`up-tokens-row${W}`,title:q?void 0:p1,children:[i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"in"}),Mt(Re)]}),i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"out"}),Mt($e)]}),H.cacheReadTokens>0&&i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"cache r"}),Mt(ce)]}),H.cacheCreateTokens>0&&i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"cache c"}),Mt(we)]}),!ae&&i.jsx("span",{className:"up-tok up-scope",children:N5})]}),(q?P.length:xe.length)>0&&i.jsxs("section",{className:`up-section${W}`,children:[i.jsx("h3",{className:"up-section-title",children:"By model"}),i.jsxs("table",{className:"up-table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Model"}),i.jsx("th",{children:"Tokens"}),i.jsx("th",{children:"Cost"})]})}),i.jsx("tbody",{children:q?P.map(ye=>i.jsxs("tr",{children:[i.jsx("td",{className:"up-model-name",title:ye.model,children:Vs(ye.model)}),i.jsx("td",{className:"up-num",children:Mt(ye.tokens)}),ye.cost>0?i.jsx("td",{className:"up-num up-cost-val",children:ot(ye.cost)}):i.jsx("td",{className:"up-num up-unpriced",children:Jo})]},ye.model)):xe.map(ye=>i.jsxs("tr",{children:[i.jsx("td",{className:"up-model-name",title:ye.model===Bf?"no model reported yet":ye.model,children:ye.model===Bf?"unknown":Vs(ye.model)}),i.jsx("td",{className:"up-num",children:Mt(ye.inputTokens+ye.outputTokens)}),ye.priced?i.jsx("td",{className:"up-num up-cost-val",children:ot(ye.cost.total)}):i.jsx("td",{className:"up-num up-unpriced",children:Jo})]},ye.model))})]})]}),q&&V.length===0&&he.tokens>0&&i.jsxs("section",{className:"up-section",children:[i.jsx("h3",{className:"up-section-title",children:"By session"}),i.jsxs("div",{className:"up-hint",children:["No session is dated ",U," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(q?V.length:De.length)>0&&(()=>{const ye=q?V.length:De.length;return i.jsxs("section",{className:`up-section${W}`,children:[i.jsx("h3",{className:"up-section-title",children:i.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":T,"aria-controls":"up-sessions",title:T?"Hide the per-session breakdown":`Show the per-session breakdown — ${ye} session${ye===1?"":"s"}`,onClick:()=>R(Se=>!Se),children:["By session",q&&i.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${U}, each showing what that session has cost since it started.
|
|
76
|
+
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 ",U]}),i.jsx("svg",{className:"up-chev",width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),i.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!T,children:[q&&V.map(Se=>{const Pe=K.get(Se.sessionId);return i.jsxs("div",{className:"up-session-row",children:[Pe?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:`sl-dot state-${Pe}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:dd(Pe)})]}):i.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),i.jsx("span",{className:`up-session-label${Se.label?"":" up-session-id"}`,title:Se.label?`${Se.label}
|
|
77
|
+
${Se.sessionId}`:Se.sessionId,children:Se.label??Se.sessionId.slice(0,8)}),i.jsx("span",{className:"up-session-tokens",children:Mt(Se.tokens)}),Se.cost>0?i.jsx("span",{className:"up-session-cost",title:Se.models.join(", ")||void 0,children:ot(Se.cost)}):i.jsx("span",{className:"up-session-cost up-unpriced",children:Jo})]},Se.sessionId)}),!q&&De.map(Se=>i.jsxs("div",{className:"up-session-row",children:[i.jsx("span",{className:`sl-dot state-${Se.state}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:dd(Se.state)}),i.jsx("span",{className:"up-session-label",children:Se.label}),i.jsx("span",{className:"up-session-tokens",children:Mt(Se.inputTokens+Se.outputTokens)}),Se.cost>0?i.jsxs("span",{className:"up-session-cost",title:Se.unpricedTokens>0?`${Mt(Se.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[ot(Se.cost),Se.unpricedTokens>0?"+":""]}):i.jsx("span",{className:"up-session-cost up-unpriced",children:Jo})]},Se.sessionId))]})]})})(),_e&&i.jsxs("div",{className:"up-hint",children:["“",Jo,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):i.jsx("div",{className:"up-empty",children:q?i.jsxs(i.Fragment,{children:["No usage ",U,".",i.jsx("br",{}),"Try a longer period."]}):i.jsxs(i.Fragment,{children:["No usage data yet.",i.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const Zt={l:30,r:6,t:6,b:2},Bs={l:0,r:0,t:2,b:1},Ad=104,lD=64;function dr(e,t=100,n=Ad,s=Zt){const a=n-s.t-s.b;return s.t+a*(1-Math.max(0,Math.min(t,e))/t)}function D2(e,t,n,s=100,a=Ad,l=Zt){if(!e.length)return"";const c=e[e.length-1].t-e[0].t,d=f=>{const m=t-l.l-l.r;return l.l+(c>0?m*(f-e[0].t)/c:m/2)};let h="",p=null;for(const f of e){const m=p&&f.t-p.t<=n*2?"L":"M";h+=`${m}${d(f.t).toFixed(1)} ${dr(f.v,s,a,l).toFixed(1)}`,p=f}return h}function q2(e,t,n,s=100,a=Ad,l=Zt){if(e.length<2)return"";const c=a-l.b,d=e[e.length-1].t-e[0].t,h=t-l.l-l.r,p=v=>l.l+(d>0?h*(v-e[0].t)/d:h/2);let f="",m=[];const y=()=>{if(m.length>=2){let v=`M${p(m[0].t).toFixed(1)} ${c}`;for(const N of m)v+=`L${p(N.t).toFixed(1)} ${dr(N.v,s,a,l).toFixed(1)}`;f+=`${v}L${p(m[m.length-1].t).toFixed(1)} ${c}Z`}m=[]};for(const v of e)m.length&&v.t-m[m.length-1].t>n*2&&y(),m.push(v);return y(),f}function cD(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 F2(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function uD(e,t,n=s=>Il(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),l=s[s.length-1];return`held back for ${a===1?"1 minute":`${a} minutes`}, last at ${n(l.t)}`}function Il(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function _x(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 dD({group:e,title:t,onClose:n}){const s=Vt(n),[a,l]=x.useState(null);x.useEffect(()=>{let p=!0;const f=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const v=await y.json();p&&(v!=null&&v.ok)&&l(v)}catch{}};f();const m=window.setInterval(f,2e4);return()=>{p=!1,window.clearInterval(m)}},[e]);const c=(a==null?void 0:a.series)??[],[d,h]=x.useMemo(()=>{let p=1/0,f=0;for(const m of c)m.points.length&&(p=Math.min(p,m.points[0].t),f=Math.max(f,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,f]},[c,a==null?void 0:a.sinceMs]);return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[i.jsxs("div",{className:"modal-head",children:[i.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),a&&d>0&&i.jsxs("span",{className:"hist-since",children:["since ",Il(d)," · ",_x(d,h||Date.now())]}),i.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),i.jsx("div",{className:"hist-body",children:a==null?i.jsx("p",{className:"hist-empty",children:"Reading…"}):c.length===0?i.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):c.map(p=>i.jsx(hD,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function hD({series:e,stepMs:t}){const n=x.useRef(null),[s,a]=x.useState(560),[l,c]=x.useState(null);x.useEffect(()=>{const A=n.current;if(!A||typeof ResizeObserver>"u")return;const D=new ResizeObserver(([O])=>a(Math.max(160,O.contentRect.width)));return D.observe(A),()=>D.disconnect()},[]);const{points:d,unit:h,warnAt:p,critAt:f,label:m,top:y,restsAtZero:v}=e,N=v?lD:Ad,{now:_,peak:S}=cD(d),k=h==="C"?"°C":h,j=m==="Throttling"?uD(d,t):null,E=l!=null?d[l]:null,C=d.length>1?d[d.length-1].t-d[0].t:0,T=A=>{const D=s-Zt.l-Zt.r;return Zt.l+(C>0?D*(A-d[0].t)/C:D/2)},R=A=>{if(d.length<2)return;const D=A.currentTarget.getBoundingClientRect(),O=(A.clientX-D.left-Zt.l)/Math.max(1,D.width-Zt.l-Zt.r),$=d[0].t+C*Math.max(0,Math.min(1,O));let F=0;for(let Z=1;Z<d.length;Z++)Math.abs(d[Z].t-$)<Math.abs(d[F].t-$)&&(F=Z);c(F)};return i.jsxs("section",{className:"hist-series","aria-label":`${m} history`,children:[i.jsxs("div",{className:"hist-head",children:[i.jsx("span",{className:"hist-label",children:m}),i.jsxs("span",{className:"hist-stats",children:[_!=null&&i.jsxs(i.Fragment,{children:[i.jsx("b",{children:_}),i.jsxs("span",{children:[k," now"]})]}),S!=null&&i.jsxs(i.Fragment,{children:[i.jsx("b",{className:F2(S,p,f),children:S}),i.jsxs("span",{children:[k," peak"]})]})]})]}),i.jsx("div",{className:"hist-plot",ref:n,children:i.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 ${S}${k}, over ${_x(d[0].t,d[d.length-1].t)}`,onPointerMove:R,onPointerLeave:()=>c(null),children:[[["warn",p],["hot",f]].map(([A,D])=>D==null||D>y?null:i.jsxs("g",{children:[i.jsx("line",{className:`hist-rule ${A}`,x1:Zt.l,x2:s-Zt.r,y1:dr(D,y,N),y2:dr(D,y,N)}),i.jsx("text",{className:`hist-rule-tag ${A}`,x:2,y:dr(D,y,N)+3,children:D})]},A)),i.jsx("line",{className:"hist-floor",x1:Zt.l,x2:s-Zt.r,y1:N-Zt.b,y2:N-Zt.b}),i.jsx("path",{className:"hist-area",d:q2(d,s,t,y,N)}),i.jsx("path",{className:"hist-line",d:D2(d,s,t,y,N)}),d.length===1&&i.jsx("circle",{className:"hist-dot",cx:T(d[0].t),cy:dr(d[0].v,y,N),r:3}),E&&i.jsxs("g",{children:[i.jsx("line",{className:"hist-cross",x1:T(E.t),x2:T(E.t),y1:Zt.t,y2:N-Zt.b}),i.jsx("circle",{className:"hist-dot",cx:T(E.t),cy:dr(E.v,y,N),r:3})]})]})}),i.jsx("div",{className:"hist-axis",children:E?i.jsxs("span",{className:"hist-at",children:[Il(E.t)," — ",i.jsx("b",{children:E.v}),k]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:d.length?Il(d[0].t):""}),i.jsx("span",{children:d.length?Il(d[d.length-1].t):""})]})}),j&&i.jsx("div",{className:"hist-note",children:j})]})}const fD="thermal:Throttling";function pD(e){var n,s,a,l;const t={};e.cpu!=null&&(t["cpu:all"]=e.cpu),(n=e.perCore)!=null&&n.length&&(t["cpu:busiest"]=Math.max(...e.perCore)),e.memory&&(t["mem:physical"]=e.memory.usedPct),e.swap&&e.swap.total>0&&(t["mem:swap"]=Math.round(e.swap.used/e.swap.total*1e3)/10),(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(l=e.thermal)!=null&&l.throttle&&(t[fD]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function Ku(e,t){return t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function Mu(e,t){return Number.isInteger(e)?t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`:Ku(e,t)}const k1=["cores","memory","load","thermal"],Ba=116,$r=24,mD=60,gD=6e4;function yD(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function wD(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function vD(e,t=mD){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function xD({sys:e}){const[t,n]=x.useState({});x.useEffect(()=>{let c=!0;const d=async()=>{const p=await Promise.all(k1.map(async f=>{try{const m=await fetch(`/api/system/history?group=${f}`);return m.ok?[f,await m.json()]:[f,null]}catch{return[f,null]}}));c&&n(f=>{const m={...f};for(const[y,v]of p)v!=null&&v.ok&&(m[y]=v);return m})};d();const h=setInterval(()=>void d(),gD);return()=>{c=!1,clearInterval(h)}},[]);const s=x.useMemo(()=>pD(e),[e]),a=x.useMemo(()=>k1.flatMap(c=>{const d=t[c];return d?d.series.filter(yD).map(h=>({series:vD(h),stepMs:d.stepMs})):[]}),[t]),l=x.useMemo(()=>{let c=1/0,d=-1/0;for(const{series:h}of a){const p=h.points;p.length&&(c=Math.min(c,p[0].t),d=Math.max(d,p[p.length-1].t))}return Number.isFinite(c)?_x(c,d):"less than a minute"},[a]);return Object.keys(s).length?i.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${l}`,children:a.map(({series:c,stepMs:d})=>i.jsx(bD,{series:c,stepMs:d,now:s[c.key],span:l},c.key))}):null}function bD({series:e,stepMs:t,now:n,span:s}){var v;const{points:a,top:l,unit:c,warnAt:d,critAt:h}=e,p=wD(e),f=n??((v=a[a.length-1])==null?void 0:v.v),m=f==null?"":F2(f,d,h),y=Math.max(...a.map(N=>N.v));return i.jsxs("div",{className:`pl-cell${m?` ${m}`:""}`,title:[`${p} · peak ${Ku(y,c)} over the last ${s}`,d!=null?`over ${Mu(d,c)} is uncomfortable`:"",h!=null?`over ${Mu(h,c)} the machine acts`:""].filter(Boolean).join(" · "),children:[i.jsxs("div",{className:"pl-cell-head",children:[i.jsx("span",{className:"pl-cell-label",children:p}),i.jsx("span",{className:"pl-cell-now",children:f==null?"—":Ku(f,c)})]}),i.jsxs("svg",{className:"pl-spark",width:Ba,height:$r,viewBox:`0 0 ${Ba} ${$r}`,preserveAspectRatio:"none","aria-hidden":!0,children:[i.jsx("line",{className:"pl-spark-floor",x1:0,x2:Ba,y1:$r-Bs.b,y2:$r-Bs.b}),i.jsx("path",{className:"pl-spark-area",d:q2(a,Ba,t,l,$r,Bs)}),d!=null&&i.jsx("line",{className:"pl-rule warn",x1:0,x2:Ba,y1:dr(d,l,$r,Bs),y2:dr(d,l,$r,Bs)}),h!=null&&i.jsx("line",{className:"pl-rule hot",x1:0,x2:Ba,y1:dr(h,l,$r,Bs),y2:dr(h,l,$r,Bs)}),i.jsx("path",{className:"pl-spark-line",d:D2(a,Ba,t,l,$r,Bs)})]}),i.jsxs("span",{className:"vis-hidden",children:["peak ",Ku(y,c)," over the last ",s,d!=null&&`, uncomfortable over ${Mu(d,c)}`,h!=null&&`, the machine acts over ${Mu(h,c)}`]})]})}const kD={key:"cpu",dir:"desc"};function _D(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function ND(e,t){const n=t.dir==="asc"?1:-1,s=l=>t.key==="cpu"?l.cpu:t.key==="mem"?l.mem:t.key==="rss"?l.rssBytes:t.key==="threads"?l.threads:l.uptimeSec,a=(l,c)=>{if(t.key==="name")return n*l.name.localeCompare(c.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=l.user??"",f=c.user??"";return!p||!f?p===f?0:p?-1:1:n*p.localeCompare(f,void 0,{sensitivity:"base"})}const d=s(l),h=s(c);return d==null||h==null?d==null?h==null?0:1:-1:n*(d-h)};return[...e].sort((l,c)=>a(l,c)||(c.cpu??-1)-(l.cpu??-1)||c.mem-l.mem||l.pid-c.pid)}function SD(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const jD=4e3;function ED(){const[e,t]=x.useState(null);return x.useEffect(()=>{let n=!0;const s=async()=>{if(document.visibilityState!=="hidden")try{const l=await fetch("/api/system/processes?detail=1");if(!l.ok)return;const c=await l.json();n&&(c!=null&&c.ok)&&t({procs:c.procs??[],total:c.total??0})}catch{}};s();const a=window.setInterval(s,jD);return()=>{n=!1,window.clearInterval(a)}},[]),e}function CD(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 TD(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 AD({sys:e,onClose:t}){const n=Vt(t),[s,a]=x.useState(kD),l=ED(),c=l?ND(l.procs,s):null;return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:n,className:"modal pl-modal",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[i.jsxs("div",{className:"modal-head",children:[i.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),l&&i.jsxs("span",{className:"pl-count",children:[c.length," of ",l.total," running"]}),i.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),i.jsxs("div",{className:"pl-split",children:[i.jsx("div",{className:"pl-body",children:c==null?i.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):c.length===0?i.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):i.jsxs("table",{className:"sd-procs pl-table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx(Xo,{col:"cpu",label:"cpu",sort:s,onSort:a}),i.jsx(Xo,{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}),i.jsx(Xo,{col:"threads",label:"threads",sort:s,onSort:a}),i.jsx(Xo,{col:"uptime",label:"up",sort:s,onSort:a}),i.jsx(Xo,{col:"user",label:"user",sort:s,onSort:a}),i.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),i.jsx(Xo,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:s,onSort:a})]})}),i.jsx("tbody",{children:c.map(d=>i.jsxs("tr",{children:[i.jsx("td",{className:"sd-num",children:d.cpu==null?"—":d.cpu.toFixed(0)}),i.jsx("td",{className:"sd-num sd-dim",title:`${d.mem.toFixed(1)}% of installed memory`,children:CD(d.rssBytes)}),i.jsx("td",{className:"sd-num sd-dim",children:d.threads??"—"}),i.jsx("td",{className:"sd-num sd-dim",children:TD(d.uptimeSec)}),i.jsx("td",{className:"sd-dim pl-user",children:d.user??"—"}),i.jsx("td",{className:"sd-num sd-dim pl-pid",children:d.pid}),i.jsxs("td",{className:"pl-name",children:[d.name,d.cmd&&i.jsxs("span",{className:"pl-cmd",title:d.cmd,children:[" ",d.cmd]})]})]},d.pid))})]})}),i.jsx(xD,{sys:e})]})]})}),document.body)}function Xo({col:e,label:t,note:n,sort:s,onSort:a}){const l=SD(s,e);return i.jsx("th",{scope:"col","aria-sort":l,children:i.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
78
78
|
|
|
79
|
-
${n}`:`Sort by ${t}`,onClick:()=>a(_D(s,e)),children:[t,i.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:l==="none"?"":l==="ascending"?"↑":"↓"})]})})}const RD=3e3;function MD(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function ID(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}% ${$D(t.lastMs,n)}`:"running at full speed, and never held back"}}function $D(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 kl(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 OD(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 PD(){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 h=await fetch("/api/system");if(!h.ok)return;const p=await h.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},l=()=>{n.current==null&&(a(),n.current=window.setInterval(a,RD))},c=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},d=()=>{if(document.visibilityState==="hidden"){c();return}l(),a()};return l(),document.addEventListener("visibilitychange",d),()=>{s=!1,c(),document.removeEventListener("visibilitychange",d)}},[]),e}function b1({usageOpen:e,leaving:t,sub:n,onClose:s,children:a}){return i.jsxs("aside",{className:`sysdetail${e?" shifted":""}${t?" leaving":""}`,id:"system-panel","aria-label":"Machine detail",children:[i.jsxs("div",{className:"sd-head",children:[i.jsx("span",{className:"sd-title",children:"This machine"}),n&&i.jsx("span",{className:"sd-sub",children:n}),i.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:s,"aria-label":"Close",title:"Close",children:"×"})]}),a]})}function LD({usageOpen:e,leaving:t,onClose:n}){const s=PD();if(!s||s.cpu==null||!s.memory)return i.jsx(b1,{usageOpen:e,leaving:t,onClose:n,children:i.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:a,swap:l,perCore:c,loadavg:d,cores:h,uptimeSec:p,platform:f,thermal:m}=s,y=a?a.total-a.available:0,v=f==="win32"?"Commit":"Swap",N=l&&l.total>0?l.used/l.total*100:0;return i.jsxs(b1,{usageOpen:e,leaving:t,sub:`up ${OD(p)} · ${h} cores`,onClose:n,children:[c&&c.length>0&&i.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:i.jsx(Xu,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:i.jsx("div",{className:"sd-cores",style:{"--n":c.length},children:c.map((_,S)=>i.jsx("span",{className:"sd-core",title:`core ${S+1}: ${_}%`,children:i.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,_)/100})`}})},S))})})}),i.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:i.jsxs(Xu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&i.jsx(hd,{label:"Physical",value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:kl(y)})," of ",kl(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${kl(a.available)} available`}),l&&l.total>0&&i.jsx(hd,{label:v,value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:kl(l.used)})," of ",kl(l.total)]}),pct:N,tone:N>=90?"warn":"calm",note:N>=50?"paging to disk":void 0})]})}),d&&i.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:i.jsxs(Xu,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[i.jsx("div",{className:"sd-load",children:d.map((_,S)=>i.jsxs("span",{className:`sd-load-item${_>h?" over":""}`,children:[i.jsx("b",{children:_.toFixed(2)}),i.jsx("span",{children:["1m","5m","15m"][S]})]},S))}),i.jsx("div",{className:"sd-note",children:d[0]>h?`${(d[0]/h).toFixed(1)}× more work queued than cores to run it`:`within ${h} cores`})]})}),i.jsx(DD,{thermal:m}),i.jsx(qD,{sys:s})]})}function Xu({group:e,title:t,action:n,label:s,children:a}){const[l,c]=x.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:"sd-open",onClick:()=>c(!0),title:n,"aria-label":n,children:[i.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",i.jsx("i",{className:"sd-row-more",children:"›"})]}),a]}),l&&i.jsx(dD,{group:e,title:t,onClose:()=>c(!1)})]})}function DD({thermal:e}){if(!e)return null;const t=e.throttle?ID(e.throttle.speedLimit,e.heldBack):null;return i.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:i.jsxs(Xu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>i.jsx(hd,{label:n.label,value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:MD(n.celsius,n.warnAt,n.critAt)},n.label)),t&&i.jsx(hd,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function qD({sys:e}){const[t,n]=x.useState(!1);return i.jsxs("div",{className:"sd-section",children:[i.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:i.jsxs("span",{className:"sd-door-plate",children:[i.jsxs("span",{className:"sd-door-name",children:["Busiest processes",i.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),i.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&i.jsx(AD,{sys:e,onClose:()=>n(!1)})]})}function hd({label:e,value:t,pct:n,tone:s="calm",note:a}){return i.jsxs("div",{className:"sd-row",children:[i.jsxs("div",{className:"sd-row-head",children:[i.jsx("span",{className:"sd-row-label",children:e}),i.jsx("span",{className:"sd-row-val",children:t})]}),i.jsx("span",{className:"sd-track",children:i.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),a&&i.jsx("div",{className:"sd-note",children:a})]})}const k1=18,FD=1100,Ko=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},BD=Array.from({length:k1},(e,t)=>{const n=-72+144*t/(k1-1)+(Ko(t,1)-.5)*9,s=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+Ko(t,2)*.52);return{dx:Math.cos(s)*a,dy:Math.sin(s)*a,rot:(t%2?1:-1)*(100+Ko(t,3)*260),delay:Math.round(Ko(t,4)*90),dur:760+Math.round(Ko(t,5)*260),scale:.8+Ko(t,6)*.45,hue:t%4,round:t%3===0}});function _1({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 l=e.current;if(!l)return;const c=l.getBoundingClientRect();n({x:c.left+c.width/2,y:c.top+c.height/2});const d=window.setTimeout(()=>n(null),FD);return()=>window.clearTimeout(d)},[e,s]),s||!t?null:ps.createPortal(i.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:BD.map((l,c)=>i.jsx("span",{className:`confetti-bit${l.round?" round":""}`,"data-hue":l.hue,style:{"--dx":`${l.dx.toFixed(1)}px`,"--dy":`${l.dy.toFixed(1)}px`,"--rot":`${l.rot}deg`,"--s":l.scale.toFixed(2),animationDelay:`${l.delay}ms`,animationDuration:`${l.dur}ms, ${l.dur}ms`}},c))}),document.body)}const q2=new Set(["awaiting_url","awaiting_code","registering"]);function zD(e){return e!=null&&q2.has(e)}function F2(e){return e!=null&&e!=="done"&&!q2.has(e)}const UD="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",WD="the sign-in did not complete";function HD({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?UD:WD)}}const GD="done";function VD(){let e=!1;return{shouldAnnounce(t){return t!==GD?(e=!1,!1):e?!1:(e=!0,!0)}}}function Nx(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const YD={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 ${Gt}`,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"},KD={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"},XD=`claude-swap could not read the login keychain — start ${Gt} from a Terminal window rather than a background service`;function Dv(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(di(e)))return XD;const n=Nx(KD,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function di(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const QD={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"},ZD="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 JD(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const e6="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",t6="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",n6=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),r6=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,s6=/[\\/]_npx[\\/]/i,a6=`the copy of ccusage ${Gt} installed for itself`;function o6(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function i6(e,t){const n=l6(e,t),s=o6(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 ${_l(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${_l(n)}`;case"managed":return`${a6} failed to run: ${_l(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${_l(n)}`:`the ccusage this deck found on your PATH failed to run: ${_l(n)}`;default:return n}}const _l=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function l6(e,t){const n=di(e);if(n6(n)){if(s6.test(n))return t6;if(r6.test(n))return e6}if(JD(n))return ZD;const s=Nx(QD,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&&F2(e.state))return e.error;const n=Nx(YD,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function c6(e,t,n){if(n<=0||vx(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 B2(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 u6(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}`,l=[];return n.alias&&s&&l.push(s),s&&(t.get(s.toLowerCase())??0)>1&&l.push(n.org||`slot ${n.num}`),{num:n.num,label:a,sub:l.length?l.join(" · "):null}})}function d6(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 h6(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 f6(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(f=>f.state===p).length,s=[],a=n("imported");a&&s.push(`${a} of ${t} imported`);const l=n("healed");l&&s.push(`${l} had a dead token replaced`);const c=n("updated");c&&s.push(`${c} updated`);const d=n("present");d&&s.push(`${d} already here`);const h=n("failed");return h&&s.push(`${h} did not arrive`),`${s.join(", ")}.`}const p6=1500,Iu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],N1="aa-panel",S1=e=>`aa-tab-${e}`;async function Nl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const qv=pe.forwardRef((e,t)=>i.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[i.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),i.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));qv.displayName="SuccessMark";function m6({onClose:e,onChanged:t}){const[n,s]=x.useState("login"),[a,l]=x.useState(null),[c,d]=x.useState(""),[h,p]=x.useState(""),[f,m]=x.useState(!1),[y,v]=x.useState(null),[N,_]=x.useState(null),[S,k]=x.useState(null),[j,E]=x.useState(null),C=x.useRef(""),T=x.useRef(!1),R=x.useRef(!1),A=x.useRef(null),D=x.useRef(null),O=x.useRef(null),$=x.useRef(null),B=x.useRef([]),Z=x.useRef(!1),J=x.useCallback(()=>{T.current&&Nl({action:"login-cancel"}).catch(()=>{}),e()},[e]),I=Vt(J,{focusRef:O}),X=x.useCallback(async()=>{if(!fr(R.current))return;R.current=!0,m(!0),v(null),T.current=!0;const W=await Nl({action:"login"}).catch(()=>null);if(R.current=!1,m(!1),!(W!=null&&W.ok)){v(ei(W,"could not start the sign-in"));return}l(W)},[]);x.useEffect(()=>{if(!zD(a==null?void 0:a.state))return;const W=window.setInterval(async()=>{try{const ee=await fetch("/api/claude-accounts/login");ee.ok&&l(await ee.json())}catch{}},p6);return()=>window.clearInterval(W)},[a]);const G=x.useRef(t);G.current=t;const q=x.useState(VD)[0];x.useEffect(()=>{var W;(a==null?void 0:a.state)==="awaiting_code"&&((W=A.current)==null||W.focus()),q.shouldAnnounce(a==null?void 0:a.state)&&G.current()},[a==null?void 0:a.state,q]),x.useEffect(()=>{var W;n==="paste"&&!Z.current&&((W=D.current)==null||W.focus()),Z.current=!1},[n]);const Y=x.useCallback(W=>{var H;const ee=c6(W,Iu.findIndex(ae=>ae.id===n),Iu.length);ee.kind!=="pass"&&(W.preventDefault(),Z.current=!0,s(Iu[ee.index].id),(H=B.current[ee.index])==null||H.focus())},[n]),L=x.useCallback(async()=>{var ee;if(!fr(R.current))return;R.current=!0,m(!0),v(null);const W=await Nl({action:"login-code",code:c}).catch(()=>null);if(R.current=!1,m(!1),!(W!=null&&W.ok)){v(ei(W,"the code was not accepted")),W!=null&&W.state&&l(W),(ee=A.current)==null||ee.select();return}d(""),l(W)},[c,a]),K=x.useCallback(async()=>{if(!fr(R.current))return;R.current=!0,m(!0),v(null);const W=await Nl({action:"import",blob:h}).catch(()=>null);if(R.current=!1,m(!1),!(W!=null&&W.ok)){v(ei(W,"the import failed"));return}C.current=h,p(""),E(null),_(W.results??[]),t()},[h,t]),P=x.useCallback(async W=>{const ee=`${W.email}|${W.org??""}`;if(!fr(R.current)||!C.current)return;R.current=!0,m(!0),k(ee),E(null);const H=await Nl({action:"import",blob:C.current,force:!0,only:{email:W.email,org:W.org??""}}).catch(()=>null);if(R.current=!1,m(!1),k(null),!(H!=null&&H.ok)){E({key:ee,text:ei(H,"that account could not be updated")});return}const ae=(H.results??[])[0];ae&&_(me=>me&&me.map(ge=>`${ge.email}|${ge.org??""}`===ee?ae:ge)),t()},[t]),V=(a==null?void 0:a.state)==="done"?a.account:null,he=F2(a==null?void 0:a.state)||!!(y&&T.current&&!f),z=HD({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:J,role:"presentation",children:i.jsxs("div",{ref:I,className:"modal aa-modal",onClick:W=>W.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:Y,children:Iu.map((W,ee)=>i.jsx("button",{type:"button",role:"tab",id:S1(W.id),ref:H=>{B.current[ee]=H},"aria-selected":n===W.id,"aria-controls":N1,tabIndex:n===W.id?0:-1,className:`aa-tab${n===W.id?" on":""}`,onClick:()=>{Z.current=!1,s(W.id)},children:W.label},W.id))})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:J,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsx("section",{className:"modal-body aa-body",id:N1,role:"tabpanel","aria-labelledby":S1(n),children:n==="login"?V?i.jsxs("div",{className:"aa-done",children:[i.jsx(qv,{ref:$}),i.jsx(_1,{anchor:$}),i.jsx("h4",{children:V.added?`Account ${V.num} added`:"Credentials refreshed"}),i.jsxs("p",{className:"aa-note",children:[i.jsx("strong",{children:V.email}),V.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),i.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(a==null?void 0:a.state)==="awaiting_code"||(a==null?void 0:a.state)==="registering"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:"1 · Approve in the browser"}),i.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),i.jsx("a",{className:"aa-link",href:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),i.jsx("p",{className:"aa-note",children:"It usually finishes on its own — if the page says you are all set, there is nothing to do here."}),i.jsxs("div",{className:"aa-field",children:[i.jsx("input",{ref:A,type:"text",value:c,onChange:W=>d(W.target.value),onKeyDown:W=>{W.key==="Enter"&&c.trim()&&!f&&L()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),i.jsx("button",{type:"button",className:"btn primary",...hr(f,!c.trim()||a.state==="registering"),onClick:L,children:a.state==="registering"?"registering…":"Continue"})]}),(y||a.error)&&i.jsx("p",{className:"aa-err",children:y??a.error}),i.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):he?i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:z.title}),i.jsx("p",{className:"aa-err",children:z.message}),i.jsx("button",{type:"button",className:"btn",onClick:()=>{T.current=!1,l(null),v(null),X()},children:"Try again"})]}):f||T.current?i.jsx("div",{className:"aa-step",children:i.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):i.jsxs("div",{className:"aa-step aa-primer",children:[i.jsx("h4",{children:"Sign in to Anthropic"}),i.jsx("p",{className:"aa-note",children:"Opens a browser tab where you approve the sign-in. It normally completes by itself; only if the page hands you a code does it need pasting back here. claude-swap records the account when it completes, and the account you are using now stays active."}),i.jsx("div",{className:"aa-actions",children:i.jsx("button",{type:"button",ref:O,className:"btn primary",onClick:X,children:"Open the sign-in page"})})]}):N?(()=>{const W=N.filter(ee=>ee.state==="imported").length;return i.jsxs("div",{className:"aa-done",children:[i.jsx(qv,{ref:$}),W>0&&i.jsx(_1,{anchor:$}),i.jsx("h4",{children:f6(N)}),N.length>0&&i.jsx("ul",{className:"aa-results",children:N.map(ee=>{const H=`${ee.email}|${ee.org??""}`;return i.jsxs("li",{className:`aa-result ${ee.state}`,children:[i.jsx("span",{className:"aa-result-who",children:ee.email||(ee.num?`slot ${ee.num}`:"an account")}),i.jsx("span",{className:"aa-result-what",children:h6(ee.state)}),ee.state==="present"&&i.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":S===H,title:`Overwrite the stored login for ${ee.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>P(ee),children:S===H?"updating…":"update anyway"}),(j==null?void 0:j.key)===H&&i.jsx("span",{className:"aa-result-err",children:j.text})]},H)})}),i.jsxs("p",{className:"aa-note",children:["Nothing changed on the deck you copied this from. An account already here is left as it is, unless its stored login was dead or you pressed",i.jsx("strong",{children:" update anyway"}),"."]}),i.jsxs("div",{className:"aa-actions",children:[i.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),i.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",E(null),_(null)},children:"Import another"})]})]})})():i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:"Paste an account shared from another deck"}),i.jsxs("div",{className:"aa-field",children:[i.jsx("input",{ref:D,type:"text",value:h,onChange:W=>p(W.target.value),onKeyDown:W=>{W.key==="Enter"&&h.trim()&&!f&&K()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),i.jsx("button",{type:"button",className:"btn primary",...hr(f,!h.trim()),onClick:K,children:f?"importing…":"Import"})]}),y&&i.jsx("p",{className:"aa-err",children:y}),i.jsxs("p",{className:"aa-note",children:["Use ",i.jsx("strong",{children:"share"})," on one account in the other deck, or ",i.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})}),document.body)}async function g6(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const y6=1800;function w6({accounts:e,onClose:t,copyText:n}){const[s,a]=x.useState([]),[l,c]=x.useState(null),[d,h]=x.useState(!1),[p,f]=x.useState(null),[m,y]=x.useState(!1),[v,N]=x.useState(()=>Math.floor(Date.now()/1e3)),_=x.useRef(null),S=x.useRef(!1),k=Vt(t,{focusRef:_});x.useEffect(()=>{if(!l)return;N(Math.floor(Date.now()/1e3));const $=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval($)},[l]);const j=u6(e),E=e.filter($=>!s.includes($.num)).map($=>$.num),C=E.length===e.length,T=$=>a(B=>B.includes($)?B.filter(Z=>Z!==$):[...B,$]),R=x.useCallback(async()=>{if(!fr(S.current)||!E.length)return;S.current=!0,h(!0),f(null),y(!1);const $=await g6({action:"share",accounts:E}).catch(()=>null);if(S.current=!1,h(!1),!($!=null&&$.ok)){f(ei($,"the share could not be made"));return}c({blob:$.blob,expiresAt:$.expiresAt,shared:$.shared??[],failed:$.failed??[]})},[e,E]),A=l?B2(l.expiresAt,v):null,D=(A==null?void 0:A.tone)==="gone",O=(l==null?void 0:l.shared.length)??0;return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:k,className:"modal sa-modal",onClick:$=>$.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("h3",{children:"Share accounts"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsx("section",{className:"modal-body sa-body",children:l?i.jsxs("div",{className:"sa-step",children:[i.jsx("h4",{children:D?"This share has expired":O===1?"1 account, ready to paste":`${O} accounts, ready to paste`}),i.jsx("code",{className:`ap-share-blob${D?" sa-dead":""}`,children:l.blob}),i.jsxs("div",{className:"ap-share-foot",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",ref:_,onClick:async()=>{if(D){c(null),R();return}await n(l.blob)&&(y(!0),window.setTimeout(()=>y(!1),y6))},children:D?"make a new share":m?"copied":`copy ${O===1?"the share":"all "+O}`}),i.jsxs("span",{className:"ap-manage-hint",title:"This text is the sign-in for every account in it. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the logins themselves are in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign those accounts out and back in.",children:[i.jsx("span",{className:"ap-share-warn",children:O===1?"this is the password":`this is ${O} passwords`})," · ",i.jsx("span",{className:`ap-share-expiry ${A==null?void 0:A.tone}`,children:A==null?void 0:A.text})]})]}),l.failed.length>0&&i.jsxs("div",{className:"sa-failed",role:"alert",children:[i.jsx("p",{className:"sa-failed-head",children:l.failed.length===1?"One account is not in this bundle:":`${l.failed.length} accounts are not in this bundle:`}),i.jsx("ul",{className:"sa-list",children:l.failed.map($=>{var Z;const B=!!($.email&&((Z=$.detail)!=null&&Z.includes($.email)));return i.jsxs("li",{children:[!B&&i.jsx("span",{className:"sa-who",children:$.email||`account ${$.num}`}),i.jsx("span",{className:"sa-why",children:$.detail||"could not be exported"})]},`${$.num}-${$.email}`)})})]}),i.jsx("p",{className:"sa-note",children:D?i.jsx(i.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):i.jsxs(i.Fragment,{children:["Paste it into the other deck with ",i.jsx("strong",{children:"+"})," → ",i.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),i.jsxs("div",{className:"sa-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>{c(null),y(!1)},children:"Pick again"}),i.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?i.jsxs("div",{className:"sa-step",children:[i.jsx("h4",{children:"Nothing to share"}),i.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",i.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),i.jsx("div",{className:"sa-actions",children:i.jsx("button",{type:"button",className:"btn primary",ref:_,onClick:t,children:"Close"})})]}):i.jsxs("div",{className:"sa-step",children:[i.jsxs("h4",{children:["Which accounts go to the other ",Gt,"?"]}),i.jsx("p",{className:`sa-count${E.length?"":" empty"}`,children:d6(E.length)}),i.jsx("ul",{className:"sa-list sa-pick",children:j.map($=>i.jsx("li",{children:i.jsxs("label",{className:"sa-row",children:[i.jsx("input",{type:"checkbox",checked:E.includes($.num),onChange:()=>T($.num)}),i.jsx("span",{className:"sa-who",children:$.label}),$.sub&&i.jsx("span",{className:"sa-sub",children:$.sub})]})},$.num))}),p&&i.jsx("p",{className:"aa-err",children:p}),i.jsxs("div",{className:"sa-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>a(C?e.map($=>$.num):[]),children:C?"Clear all":"Select all"}),i.jsx("button",{type:"button",className:"btn primary",ref:_,...hr(d,!E.length),onClick:R,children:d?"making the share…":E.length===0?"Share":E.length===1?"Share 1 account":`Share ${E.length} accounts`})]})]})})]})}),document.body)}function v6(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((a,l)=>a-l).map(a=>{const l=a===t?"here":n.has(a)?"swap":"free";return{slot:a,kind:l,label:l==="here"?`slot ${a}`:`slot ${a} · ${l}`}})}function x6(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 b6(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function k6(e,t,n){var a;const s=((a=e.find(l=>l.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 _6(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 j1(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function E1(e){const t=e.filter(d=>!j1(d)),n=e.filter(d=>j1(d)),s=t.length?t:n,a=t.length?n:[],l=s.reduce((d,h)=>d&&d.pct>=h.pct?d:h,null);let c=null;for(const d of a)l&&d.pct<=l.pct||(!c||d.pct>c.pct)&&(c=d);return{shown:s,rest:a,fuller:c,peak:c??l}}function N6(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function S6(e,t,n,s){const a=e==null?"No usage has been collected for this account yet.":`${Math.round(e)}% left on ${t??"the window that runs out first"}, which is the one that runs out first.`,l=n===1?"the other window":`the other ${n} windows`;return`${a} ${s?"Hide":"Show"} ${l}.`}const j6="\0";function Sx(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}${j6}${n}`}function E6(e,t){const n=Sx(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function C6(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(Sx)),s=e.filter(a=>n.has(a));return s.length===e.length?e:s}const T6=64;function A6(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const R6=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function C1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function M6(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=di(t.body);return{text:Dv(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function T1(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 z2({title:e,steps:t,finish:n,aside:s,onClose:a}){const l=x.useRef(null),c=Vt(a,{focusRef:l}),[d,h]=x.useState(0),p=d===t.length-1,f=t[d],m=N=>h(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"?d+1:d-1))},v=()=>{if(!p){m(d+1);return}n?n.act():a()};return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:i.jsxs("div",{ref:c,className:"modal guide",onClick:N=>N.stopPropagation(),onKeyDown:y,role:"dialog","aria-modal":"true","aria-labelledby":"guide-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{id:"guide-title",className:"modal-tool-name",children:e}),i.jsxs("span",{className:"modal-tool-id",children:[d+1," / ",t.length]})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsx("div",{className:"guide-stage",children:f.art},d),i.jsx("p",{className:"guide-line","aria-live":"polite",children:f.line}),i.jsx("p",{className:"guide-tip",children:f.tip??""}),i.jsxs("div",{className:"guide-foot",children:[i.jsx("div",{className:"guide-dots",children:t.map((N,_)=>i.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${_+1} of ${t.length}`,"aria-current":_===d?"step":void 0,onClick:()=>m(_)},_))}),p&&s&&i.jsx("button",{type:"button",className:"ap-lan-word guide-aside",onClick:s.act,children:s.label}),d>0&&i.jsx("button",{type:"button",className:"btn",onClick:()=>m(d-1),children:"Back"}),i.jsx("button",{ref:l,type:"button",className:"btn primary",onClick:v,children:p?(n==null?void 0:n.label)??"Done":"Next"})]})]})]})}),document.body)}const Fv={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function Yn({children:e}){return i.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function Vn({x:e,y:t=34,w:n=176,h:s=132,label:a}){return i.jsxs(i.Fragment,{children:[a&&i.jsx("text",{x:e+2,y:t-9,className:"ga-cap",children:a}),i.jsx("rect",{x:e,y:t,width:n,height:s,rx:10,className:"ga-screen"})]})}function mr({x:e,y:t,email:n,state:s,tone:a,bars:l}){return i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:e+3,cy:t-4,r:3,className:Fv[a]}),i.jsx("text",{x:e+12,y:t,className:"ga-t ga-mono",children:n}),i.jsx("text",{x:e+12,y:t+16,className:`ga-s ${Fv[a]}`,children:s}),l==null?void 0:l.map((c,d)=>i.jsxs("g",{children:[i.jsx("text",{x:e,y:t+40+d*18,className:"ga-s",children:d?"7d":"5h"}),i.jsx("rect",{x:e+22,y:t+35+d*18,width:96,height:4,rx:2,className:"ga-track"}),i.jsx("rect",{x:e+22,y:t+35+d*18,width:96*c/100,height:4,rx:2,className:"ga-accent"}),i.jsxs("text",{x:e+148,y:t+40+d*18,className:"ga-s ga-accent",textAnchor:"end",children:[c,"%"]})]},d))]})}function U2({x:e,y:t,on:n}){return i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:30,height:18,rx:9,className:n?"ga-switch-on":"ga-switch"}),i.jsx("circle",{cx:n?e+21:e+9,cy:t+9,r:6,className:n?"ga-knob-on":"ga-knob"})]})}function $u({x:e,y:t,name:n,here:s=!0}){return i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:e+3,cy:t-4,r:3,className:s?"ga-ok":"ga-dim"}),i.jsx("text",{x:e+12,y:t,className:s?"ga-t":"ga-s",children:n})]})}function A1({x:e,y:t,on:n}){return n?i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:12,height:12,rx:3,className:"ga-accent"}),i.jsx("path",{d:`M${e+3} ${t+6.2}l2.3 2.3 4-4.6`,className:"ga-tick"})]}):i.jsx("rect",{x:e+.5,y:t+.5,width:11,height:11,rx:3,className:"ga-box"})}function R1({x:e,y:t,d:n}){return i.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function jx({x:e,y:t}){return i.jsx("path",{d:`M${e} ${t}l0 13 3.4-3 2.4 5.2 2-.9-2.4-5.1 4.6-.2z`,className:"ga-pointer"})}function Ex(){return i.jsxs(i.Fragment,{children:[i.jsx("circle",{r:9,className:"ga-key-bed"}),i.jsxs("g",{transform:"translate(-6 -6) scale(0.857)",className:"ga-key",children:[i.jsx("circle",{cx:4.6,cy:7,r:2.6}),i.jsx("path",{d:"M7.2 7h5.2M10.6 7v2.2M12.4 7v1.6"})]})]})}function ti({x:e,y:t,w:n,title:s,sub:a,tone:l}){return i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:n,height:40,rx:8,className:"ga-screen"}),i.jsx("rect",{x:e+6,y:t+10,width:3,height:20,rx:1.5,className:Fv[l]}),i.jsx("text",{x:e+16,y:t+17,className:"ga-t ga-strong",children:s}),i.jsx("text",{x:e+16,y:t+31,className:"ga-s",children:a})]})}function ai({x:e,y:t,label:n,live:s}){return i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:46,height:20,rx:10,className:s?"ga-chip-live":"ga-chip"}),i.jsx("text",{x:e+23,y:t+14,className:"ga-s ga-mono",textAnchor:"middle",children:n})]})}function fd({x:e,y:t}){return i.jsxs(i.Fragment,{children:[i.jsx("text",{x:e,y:t,className:"ga-cap",children:"LOCAL NETWORK"}),i.jsx(U2,{x:e+118,y:t-13,on:!0})]})}function I6(){return i.jsxs(Yn,{children:[i.jsx("rect",{x:14,y:14,width:206,height:172,rx:10,className:"ga-screen"}),i.jsx("text",{x:28,y:38,className:"ga-t ga-strong",children:"Sessions"}),i.jsx("text",{x:206,y:38,className:"ga-s ga-warn",textAnchor:"end",children:"1 waiting"}),i.jsx("rect",{x:20,y:50,width:194,height:42,rx:6,className:"ga-bed-warn"}),i.jsx("circle",{cx:33,cy:64,r:7,className:"ga-ring-warn ga-ping"}),i.jsx("circle",{cx:33,cy:64,r:3.5,className:"ga-warn"}),i.jsx("text",{x:44,y:68,className:"ga-t",children:"api-server"}),i.jsx("text",{x:44,y:83,className:"ga-s ga-warn",children:"waiting 6m · Bash"}),i.jsx("circle",{cx:33,cy:108,r:3.5,className:"ga-flight"}),i.jsx("text",{x:44,y:112,className:"ga-t",children:"docs-site"}),i.jsx("text",{x:44,y:127,className:"ga-s",children:"running · 12 tools"}),i.jsx("circle",{cx:33,cy:150,r:3.5,className:"ga-ok"}),i.jsx("text",{x:44,y:154,className:"ga-t",children:"billing"}),i.jsx("text",{x:44,y:169,className:"ga-s",children:"done · $0.84"}),i.jsx("path",{d:"M216 71C234 71 230 100 244 100",className:"ga-arc"}),i.jsx("path",{d:"M239 96l5 4-5 4",className:"ga-arrow"}),i.jsx("rect",{x:248,y:44,width:178,height:112,rx:10,className:"ga-screen"}),i.jsx("text",{x:262,y:64,className:"ga-cap",children:"API-SERVER"}),i.jsx("line",{x1:248,y1:74,x2:426,y2:74,className:"ga-line"}),i.jsx("text",{x:262,y:96,className:"ga-s ga-mono",children:"Bash(npm test)"}),i.jsx("text",{x:262,y:116,className:"ga-t ga-mono ga-warn",children:"Allow this command?"}),i.jsx("text",{x:262,y:136,className:"ga-s ga-mono",children:"> 1. Yes 2. No"})]})}function $6(){return i.jsxs(Yn,{children:[i.jsx("path",{d:"M136 100C166 100 166 38 196 38",className:"ga-edge ga-flow"}),i.jsx("path",{d:"M136 100H196",className:"ga-edge ga-flow"}),i.jsx("path",{d:"M136 100C166 100 166 162 196 162",className:"ga-edge-done"}),i.jsx("path",{d:"M308 38H326M308 100H326",className:"ga-edge"}),i.jsx(ti,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),i.jsx(ti,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),i.jsx(ti,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),i.jsx(ti,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),i.jsx(ai,{x:326,y:28,label:"Read"}),i.jsx(ai,{x:380,y:28,label:"Grep",live:!0}),i.jsx(ai,{x:326,y:90,label:"Bash",live:!0})]})}function M1({x:e,y:t,label:n,pct:s,note:a}){return i.jsxs(i.Fragment,{children:[i.jsx("text",{x:e,y:t,className:"ga-s",children:n}),i.jsxs("text",{x:e+194,y:t,className:"ga-s ga-accent",textAnchor:"end",children:[s,"%"]}),i.jsx("rect",{x:e,y:t+7,width:194,height:5,rx:2.5,className:"ga-track"}),i.jsx("rect",{x:e,y:t+7,width:194*s/100,height:5,rx:2.5,className:"ga-accent"}),i.jsx("text",{x:e,y:t+26,className:"ga-s",children:a})]})}function O6(){return i.jsxs(Yn,{children:[i.jsx("rect",{x:14,y:30,width:172,height:140,rx:10,className:"ga-screen"}),i.jsx("text",{x:30,y:56,className:"ga-cap",children:"THIS SESSION"}),i.jsx("text",{x:30,y:98,className:"ga-big",children:"$3.66"}),i.jsx("text",{x:30,y:122,className:"ga-s",children:"Opus 5 · 1.2M tokens"}),i.jsx("text",{x:30,y:150,className:"ga-s",children:"$21.40 today"}),i.jsx("rect",{x:200,y:30,width:226,height:140,rx:10,className:"ga-screen"}),i.jsx("text",{x:216,y:56,className:"ga-cap",children:"CLAUDE QUOTA"}),i.jsx(M1,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),i.jsx(M1,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function P6(){return i.jsxs(Yn,{children:[i.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),i.jsx(ti,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),i.jsx(jx,{x:156,y:106}),i.jsx("path",{d:"M170 92C186 92 184 60 200 60",className:"ga-arc"}),i.jsx("path",{d:"M195 56l5 4-5 4",className:"ga-arrow"}),i.jsx(Vn,{x:200,y:22,w:226,h:160}),i.jsx("text",{x:214,y:46,className:"ga-t ga-strong",children:"tests"}),i.jsx("text",{x:412,y:46,className:"ga-s",textAnchor:"end",children:"Sonnet 5 · 38s"}),i.jsx("line",{x1:200,y1:56,x2:426,y2:56,className:"ga-line"}),i.jsx("text",{x:214,y:76,className:"ga-cap",children:"PROMPT"}),i.jsx("text",{x:214,y:92,className:"ga-t",children:"Run the suite and fix what fails"}),i.jsx("text",{x:214,y:116,className:"ga-cap",children:"TOOLS · 6"}),i.jsx(ai,{x:214,y:122,label:"Read"}),i.jsx(ai,{x:266,y:122,label:"Edit"}),i.jsx(ai,{x:318,y:122,label:"Bash",live:!0}),i.jsx("text",{x:214,y:164,className:"ga-cap",children:"TOKENS"}),i.jsx("text",{x:214,y:178,className:"ga-s ga-mono",children:"41k in · 2.1k out · $0.12"})]})}function L6(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return i.jsxs(Yn,{children:[i.jsx(Vn,{x:14,y:20,w:412,h:160}),i.jsx("text",{x:28,y:44,className:"ga-t ga-strong",children:"This machine"}),i.jsx("text",{x:412,y:44,className:"ga-s",textAnchor:"end",children:"12 cores · up 10d"}),i.jsx("line",{x1:14,y1:56,x2:426,y2:56,className:"ga-line"}),i.jsx("text",{x:28,y:76,className:"ga-cap",children:"CORES"}),e.map((t,n)=>i.jsxs("g",{children:[i.jsx("rect",{x:28+n*15,y:82,width:10,height:30,rx:2,className:"ga-track"}),i.jsx("rect",{x:28+n*15,y:112-t,width:10,height:t,rx:2,className:"ga-accent"})]},n)),i.jsx("text",{x:28,y:136,className:"ga-cap",children:"MEMORY"}),i.jsx("rect",{x:28,y:143,width:178,height:5,rx:2.5,className:"ga-track"}),i.jsx("rect",{x:28,y:143,width:105,height:5,rx:2.5,className:"ga-accent"}),i.jsx("text",{x:28,y:165,className:"ga-s",children:"18.9 GB of 32.0 GB"}),i.jsx("text",{x:240,y:76,className:"ga-cap",children:"THERMAL"}),i.jsx("text",{x:240,y:100,className:"ga-big",children:"66 °C"}),i.jsx("text",{x:240,y:118,className:"ga-s ga-ok",children:"running at full speed"}),i.jsx("text",{x:240,y:142,className:"ga-cap",children:"BUSIEST PROCESSES"}),i.jsx("text",{x:240,y:160,className:"ga-s ga-mono",children:"node · claude"}),i.jsx("text",{x:412,y:160,className:"ga-s ga-mono",textAnchor:"end",children:"38%"}),i.jsx("text",{x:240,y:176,className:"ga-s ga-mono",children:"esbuild"}),i.jsx("text",{x:412,y:176,className:"ga-s ga-mono",textAnchor:"end",children:"21%"})]})}function D6(){return i.jsxs(Yn,{children:[i.jsx("rect",{x:14,y:40,width:188,height:120,rx:10,className:"ga-screen"}),i.jsx("text",{x:28,y:60,className:"ga-cap",children:"~/MY-PROJECT"}),i.jsx("line",{x1:14,y1:70,x2:202,y2:70,className:"ga-line"}),i.jsxs("text",{x:28,y:100,className:"ga-t ga-mono",children:[i.jsx("tspan",{className:"ga-accent",children:"$"})," claude"]}),i.jsx("rect",{x:86,y:90,width:7,height:13,className:"ga-caret ga-blink"}),i.jsx("text",{x:28,y:130,className:"ga-s ga-mono",children:"or: codex"}),i.jsx("path",{d:"M210 100H238",className:"ga-arc"}),i.jsx("path",{d:"M233 95l6 5-6 5",className:"ga-arrow"}),i.jsx("rect",{x:250,y:40,width:176,height:120,rx:10,className:"ga-canvas"}),i.jsx("g",{className:"ga-pop",children:i.jsx(ti,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function q6(){return i.jsxs(Yn,{children:[i.jsx(Vn,{x:14,y:16,w:232,h:170}),i.jsx("text",{x:28,y:40,className:"ga-t ga-strong",children:"Claude accounts"}),i.jsx(R1,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),i.jsx(R1,{x:220,y:33,d:"M3.3 10.7L10.7 3.3M5.2 3.3h5.5v5.5"}),i.jsx("line",{x1:14,y1:52,x2:246,y2:52,className:"ga-line"}),i.jsx(mr,{x:28,y:74,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),i.jsx("rect",{x:190,y:62,width:44,height:18,rx:9,className:"ga-accent"}),i.jsx("text",{x:212,y:74,className:"ga-s ga-on-accent",textAnchor:"middle",children:"active"}),i.jsx("line",{x1:14,y1:140,x2:246,y2:140,className:"ga-line"}),i.jsx(mr,{x:28,y:160,email:"personal@me.dev",state:"signed in",tone:"ok"}),i.jsx("rect",{x:188,y:148,width:46,height:18,rx:9,className:"ga-chip"}),i.jsx("text",{x:211,y:160,className:"ga-s",textAnchor:"middle",children:"switch"}),i.jsx(jx,{x:221,y:161}),i.jsx("path",{d:"M250 40C270 40 262 78 282 78",className:"ga-arc"}),i.jsx("path",{d:"M277 74l5 4-5 4",className:"ga-arrow"}),i.jsx(Vn,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),i.jsx("g",{className:"ga-pop",children:i.jsx(mr,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function F6(){return i.jsxs(Yn,{children:[i.jsx(Vn,{x:14,label:"THIS MACHINE"}),i.jsx(fd,{x:28,y:60}),i.jsx("g",{className:"ga-swap-out",children:i.jsx(mr,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),i.jsx("g",{className:"ga-swap-in",children:i.jsx(mr,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),i.jsx(Vn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(fd,{x:264,y:60}),i.jsx(mr,{x:264,y:98,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),i.jsx("path",{d:"M246 120C234 80 206 80 194 120",className:"ga-arc"}),i.jsx("g",{className:"ga-travel ga-travel-low",transform:"translate(220 90)",children:i.jsx(Ex,{})})]})}const B6=[{art:i.jsx(I6,{}),line:"Sessions waiting on you top the session list, longest wait first.",tip:"A tone and a system notification when one stops to ask. The speaker in the topbar."},{art:i.jsx($6,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:i.jsx(P6,{}),line:"Click any node: its prompt, every tool call, tokens and timing."},{art:i.jsx(O6,{}),line:"What each session costs, and how much quota is left."},{art:i.jsx(L6,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:i.jsx(q6,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:i.jsx(F6,{}),line:"Your machines repair each other's expired logins over the local network.",tip:"Local network is the last section of the Claude accounts panel."},{art:i.jsx(D6,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function z6(){return i.jsxs(Yn,{children:[i.jsx(Vn,{x:14,label:"THIS MACHINE"}),i.jsx(mr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"}),i.jsx("rect",{x:40,y:94,width:86,height:20,rx:10,className:"ga-pill-warn"}),i.jsx("text",{x:83,y:108,className:"ga-s ga-warn",textAnchor:"middle",children:"sign in again"}),i.jsx("line",{x1:198,y1:100,x2:242,y2:100,className:"ga-off"}),i.jsx(Vn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(mr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function U6(){return i.jsxs(Yn,{children:[i.jsx(Vn,{x:14,label:"THIS MACHINE"}),i.jsx(fd,{x:28,y:60}),i.jsx($u,{x:28,y:92,name:"Ana's MacBook"}),i.jsx($u,{x:28,y:114,name:"Dorin's PC"}),i.jsx(Vn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(fd,{x:264,y:60}),i.jsx($u,{x:264,y:92,name:"Your MacBook"}),i.jsx($u,{x:264,y:114,name:"Dorin's PC"}),i.jsx("line",{x1:196,y1:100,x2:244,y2:100,className:"ga-arc"}),i.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping"}),i.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping ga-ping-2"}),i.jsx("circle",{cx:220,cy:100,r:3,className:"ga-accent"})]})}function W6(){return i.jsxs(Yn,{children:[i.jsx("rect",{x:90,y:18,width:260,height:164,rx:10,className:"ga-screen"}),i.jsx("text",{x:106,y:42,className:"ga-t ga-strong",children:"This deck on the network"}),i.jsx("line",{x1:90,y1:54,x2:350,y2:54,className:"ga-line"}),i.jsx("text",{x:106,y:76,className:"ga-cap",children:"SHARE THESE ACCOUNTS"}),i.jsx(A1,{x:106,y:88,on:!0}),i.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),i.jsx(A1,{x:106,y:112}),i.jsx("text",{x:126,y:122,className:"ga-s ga-mono",children:"personal@me.dev"}),i.jsx("text",{x:106,y:150,className:"ga-cap",children:"PAIRING"}),i.jsx("text",{x:106,y:168,className:"ga-s",children:"Say yes to every deck that asks"}),i.jsx(U2,{x:304,y:157,on:!0}),i.jsx(jx,{x:115,y:97})]})}function H6(){return i.jsxs(Yn,{children:[i.jsx(Vn,{x:14,label:"THIS MACHINE"}),i.jsx("g",{className:"ga-swap-out",children:i.jsx(mr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),i.jsx("g",{className:"ga-swap-in",children:i.jsx(mr,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),i.jsx(Vn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(mr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),i.jsx("path",{d:"M246 96C234 56 206 56 194 96",className:"ga-arc"}),i.jsx("g",{className:"ga-travel",transform:"translate(220 66)",children:i.jsx(Ex,{})})]})}const G6=[{art:i.jsx(z6,{}),line:"A login can expire on one machine while it still works on another."},{art:i.jsx(U6,{}),line:"Both decks are on. They find each other and ask to pair.",tip:"Not showing up? The + in the section reaches a machine by address or invite."},{art:i.jsx(W6,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:i.jsx(H6,{}),line:"An expired login is copied from a paired machine within a minute."}];function V6(){return i.jsxs("svg",{className:"guide-art",viewBox:"0 0 232 60","aria-hidden":!0,focusable:"false",children:[i.jsx("rect",{x:1,y:14,width:78,height:42,rx:7,className:"ga-screen"}),i.jsx("circle",{cx:13,cy:29,r:3,className:"ga-warn"}),i.jsx("rect",{x:21,y:27,width:46,height:4,rx:2,className:"ga-track"}),i.jsx("rect",{x:13,y:39,width:40,height:3,rx:1.5,className:"ga-track"}),i.jsx("rect",{x:153,y:14,width:78,height:42,rx:7,className:"ga-screen"}),i.jsx("circle",{cx:165,cy:29,r:3,className:"ga-ok"}),i.jsx("rect",{x:173,y:27,width:46,height:4,rx:2,className:"ga-track"}),i.jsx("rect",{x:165,y:39,width:40,height:3,rx:1.5,className:"ga-accent"}),i.jsx("path",{d:"M150 36C138 6 94 6 82 36",className:"ga-arc"}),i.jsx("g",{transform:"translate(116 13)",children:i.jsx(Ex,{})})]})}async function zf(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const Y6={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."},K6={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function I1(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||Dt(n,t)}function X6({status:e,manual:t,onClose:n,onChanged:s}){var q,Y;const a=x.useRef(null),l=Vt(n,{focusRef:a}),[c,d]=x.useState(""),[h,p]=x.useState(""),[f,m]=x.useState(null),[y,v]=x.useState(null),[N,_]=x.useState(null),[S,k]=x.useState(null),[j,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=>Td(T.current)?(T.current=L,_(L),!0):!1,[]),A=x.useCallback(()=>{T.current=null,C.current&&_(null)},[]),D=L=>{const K=Ys(N,L);return{disabled:K.disabled,"aria-busy":K.busy}},O=L=>(f==null?void 0:f.field)===L?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},$=L=>m(K=>K&&K.field===L?null:K),B=x.useCallback(async()=>{const L=cq(c);if(!L){m({text:Q6(c),field:"addr"});return}const K=`${L.addr}:${L.port}`,P=e.peers.find(V=>V.addr===L.addr&&V.port===L.port&&V.paired);if(P){m({text:`Already paired with ${P.name} at that address.`,field:"addr"});return}if(t.includes(K)){m({text:"This deck already calls that address.",field:"addr"});return}if(R("add"))try{const V=await zf("/api/prefs",{lan:{manual:[...t,K]}});if(!C.current)return;V!=null&&V.ok?(m(null),d(""),s(),n()):m({text:Dt("add that address",V),field:"addr"})}catch{C.current&&m({text:Dt("add that address",null),field:"addr"})}finally{A()}},[c,t,e.peers,s,n,R,A]),Z=x.useCallback(async L=>{if(!R(`invite:${L}`))return;const K=L==="make"?"make an invite":"cancel that invite";try{const P=await zf("/api/lan/invite",{action:L});if(!C.current)return;P!=null&&P.ok?(m(null),v(null),s()):m({text:I1(K6,P,K)})}catch{C.current&&m({text:Dt(K,null)})}finally{A()}},[s,R,A]),J=x.useCallback(async()=>{const L=h.trim();if(!(!L||!R("join"))){k(null);try{const K=await zf("/api/lan/invite",{action:"join",token:L});if(!C.current)return;K!=null&&K.ok?(p(""),m(null),s(),n()):(K==null?void 0:K.reason)==="unreachable"&&Array.isArray(K.tried)&&K.tried.length?(k(K.tried),m(null)):(k(null),m({text:I1(Y6,K,"use that invite"),field:"join"}))}catch{C.current&&m({text:Dt("use that invite",null),field:"join"})}finally{A()}}},[h,s,n,R,A]),I=x.useCallback(async(L,K)=>{try{await navigator.clipboard.writeText(L),v(K),window.setTimeout(()=>{C.current&&v(P=>P===K?null:P)},1600)}catch{m({text:"Could not copy it — select the text and copy it by hand."})}},[]),X=e.invite&&e.invite.expiresAt>j?e.invite:null,G=((q=e.reach)==null?void 0:q.steps)??[];return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:l,className:"modal lan-add",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[f&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:f.text}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),((Y=e.reach)==null?void 0:Y.blocked)&&i.jsxs("div",{className:"ap-lan-reach",children:[i.jsx("p",{className:"lan-warn",children:e.reach.text}),i.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&&i.jsxs("details",{className:"ap-lan-reach-fix",children:[i.jsx("summary",{children:"or let them find this deck on their own"}),i.jsxs("p",{className:"lan-note",children:["Run this in PowerShell ",i.jsx("strong",{children:"as Administrator"}),", then restart the deck.",e.reach.category==="Public"&&i.jsx(i.Fragment,{children:" The first line marks this network as a home or office one — leave it out on a network you do not trust."})]}),i.jsx("pre",{className:"ap-lan-cmd",children:i.jsx("code",{children:G.join(`
|
|
79
|
+
${n}`:`Sort by ${t}`,onClick:()=>a(_D(s,e)),children:[t,i.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:l==="none"?"":l==="ascending"?"↑":"↓"})]})})}const RD=3e3;function MD(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function ID(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}% ${$D(t.lastMs,n)}`:"running at full speed, and never held back"}}function $D(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 _l(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 OD(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 PD(){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 h=await fetch("/api/system");if(!h.ok)return;const p=await h.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},l=()=>{n.current==null&&(a(),n.current=window.setInterval(a,RD))},c=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},d=()=>{if(document.visibilityState==="hidden"){c();return}l(),a()};return l(),document.addEventListener("visibilitychange",d),()=>{s=!1,c(),document.removeEventListener("visibilitychange",d)}},[]),e}function _1({usageOpen:e,leaving:t,sub:n,onClose:s,children:a}){return i.jsxs("aside",{className:`sysdetail${e?" shifted":""}${t?" leaving":""}`,id:"system-panel","aria-label":"Machine detail",children:[i.jsxs("div",{className:"sd-head",children:[i.jsx("span",{className:"sd-title",children:"This machine"}),n&&i.jsx("span",{className:"sd-sub",children:n}),i.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:s,"aria-label":"Close",title:"Close",children:"×"})]}),a]})}function LD({usageOpen:e,leaving:t,onClose:n}){const s=PD();if(!s||s.cpu==null||!s.memory)return i.jsx(_1,{usageOpen:e,leaving:t,onClose:n,children:i.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:a,swap:l,perCore:c,loadavg:d,cores:h,uptimeSec:p,platform:f,thermal:m}=s,y=a?a.total-a.available:0,v=f==="win32"?"Commit":"Swap",N=l&&l.total>0?l.used/l.total*100:0;return i.jsxs(_1,{usageOpen:e,leaving:t,sub:`up ${OD(p)} · ${h} cores`,onClose:n,children:[c&&c.length>0&&i.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:i.jsx(Xu,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:i.jsx("div",{className:"sd-cores",style:{"--n":c.length},children:c.map((_,S)=>i.jsx("span",{className:"sd-core",title:`core ${S+1}: ${_}%`,children:i.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,_)/100})`}})},S))})})}),i.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:i.jsxs(Xu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&i.jsx(hd,{label:"Physical",value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:_l(y)})," of ",_l(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${_l(a.available)} available`}),l&&l.total>0&&i.jsx(hd,{label:v,value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:_l(l.used)})," of ",_l(l.total)]}),pct:N,tone:N>=90?"warn":"calm",note:N>=50?"paging to disk":void 0})]})}),d&&i.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:i.jsxs(Xu,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[i.jsx("div",{className:"sd-load",children:d.map((_,S)=>i.jsxs("span",{className:`sd-load-item${_>h?" over":""}`,children:[i.jsx("b",{children:_.toFixed(2)}),i.jsx("span",{children:["1m","5m","15m"][S]})]},S))}),i.jsx("div",{className:"sd-note",children:d[0]>h?`${(d[0]/h).toFixed(1)}× more work queued than cores to run it`:`within ${h} cores`})]})}),i.jsx(DD,{thermal:m}),i.jsx(qD,{sys:s})]})}function Xu({group:e,title:t,action:n,label:s,children:a}){const[l,c]=x.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:"sd-open",onClick:()=>c(!0),title:n,"aria-label":n,children:[i.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",i.jsx("i",{className:"sd-row-more",children:"›"})]}),a]}),l&&i.jsx(dD,{group:e,title:t,onClose:()=>c(!1)})]})}function DD({thermal:e}){if(!e)return null;const t=e.throttle?ID(e.throttle.speedLimit,e.heldBack):null;return i.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:i.jsxs(Xu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>i.jsx(hd,{label:n.label,value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:MD(n.celsius,n.warnAt,n.critAt)},n.label)),t&&i.jsx(hd,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function qD({sys:e}){const[t,n]=x.useState(!1);return i.jsxs("div",{className:"sd-section",children:[i.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:i.jsxs("span",{className:"sd-door-plate",children:[i.jsxs("span",{className:"sd-door-name",children:["Busiest processes",i.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),i.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&i.jsx(AD,{sys:e,onClose:()=>n(!1)})]})}function hd({label:e,value:t,pct:n,tone:s="calm",note:a}){return i.jsxs("div",{className:"sd-row",children:[i.jsxs("div",{className:"sd-row-head",children:[i.jsx("span",{className:"sd-row-label",children:e}),i.jsx("span",{className:"sd-row-val",children:t})]}),i.jsx("span",{className:"sd-track",children:i.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),a&&i.jsx("div",{className:"sd-note",children:a})]})}const N1=18,FD=1100,Qo=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},BD=Array.from({length:N1},(e,t)=>{const n=-72+144*t/(N1-1)+(Qo(t,1)-.5)*9,s=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+Qo(t,2)*.52);return{dx:Math.cos(s)*a,dy:Math.sin(s)*a,rot:(t%2?1:-1)*(100+Qo(t,3)*260),delay:Math.round(Qo(t,4)*90),dur:760+Math.round(Qo(t,5)*260),scale:.8+Qo(t,6)*.45,hue:t%4,round:t%3===0}});function S1({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 l=e.current;if(!l)return;const c=l.getBoundingClientRect();n({x:c.left+c.width/2,y:c.top+c.height/2});const d=window.setTimeout(()=>n(null),FD);return()=>window.clearTimeout(d)},[e,s]),s||!t?null:ps.createPortal(i.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:BD.map((l,c)=>i.jsx("span",{className:`confetti-bit${l.round?" round":""}`,"data-hue":l.hue,style:{"--dx":`${l.dx.toFixed(1)}px`,"--dy":`${l.dy.toFixed(1)}px`,"--rot":`${l.rot}deg`,"--s":l.scale.toFixed(2),animationDelay:`${l.delay}ms`,animationDuration:`${l.dur}ms, ${l.dur}ms`}},c))}),document.body)}const B2=new Set(["awaiting_url","awaiting_code","registering"]);function zD(e){return e!=null&&B2.has(e)}function z2(e){return e!=null&&e!=="done"&&!B2.has(e)}const UD="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",WD="the sign-in did not complete";function HD({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?UD:WD)}}const GD="done";function VD(){let e=!1;return{shouldAnnounce(t){return t!==GD?(e=!1,!1):e?!1:(e=!0,!0)}}}function Nx(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const YD={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 ${Gt}`,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"},KD={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"},XD=`claude-swap could not read the login keychain — start ${Gt} from a Terminal window rather than a background service`;function Dv(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(fi(e)))return XD;const n=Nx(KD,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function fi(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const QD={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"},ZD="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 JD(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const e6="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",t6="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",n6=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),r6=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,s6=/[\\/]_npx[\\/]/i,a6=`the copy of ccusage ${Gt} installed for itself`;function o6(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function i6(e,t){const n=l6(e,t),s=o6(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 ${Nl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${Nl(n)}`;case"managed":return`${a6} failed to run: ${Nl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${Nl(n)}`:`the ccusage this deck found on your PATH failed to run: ${Nl(n)}`;default:return n}}const Nl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function l6(e,t){const n=fi(e);if(n6(n)){if(s6.test(n))return t6;if(r6.test(n))return e6}if(JD(n))return ZD;const s=Nx(QD,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function ni(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&z2(e.state))return e.error;const n=Nx(YD,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function c6(e,t,n){if(n<=0||vx(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 U2(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 u6(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}`,l=[];return n.alias&&s&&l.push(s),s&&(t.get(s.toLowerCase())??0)>1&&l.push(n.org||`slot ${n.num}`),{num:n.num,label:a,sub:l.length?l.join(" · "):null}})}function d6(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 h6(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 f6(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(f=>f.state===p).length,s=[],a=n("imported");a&&s.push(`${a} of ${t} imported`);const l=n("healed");l&&s.push(`${l} had a dead token replaced`);const c=n("updated");c&&s.push(`${c} updated`);const d=n("present");d&&s.push(`${d} already here`);const h=n("failed");return h&&s.push(`${h} did not arrive`),`${s.join(", ")}.`}const p6=1500,Iu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],j1="aa-panel",E1=e=>`aa-tab-${e}`;async function Sl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const qv=pe.forwardRef((e,t)=>i.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[i.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),i.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));qv.displayName="SuccessMark";function m6({onClose:e,onChanged:t}){const[n,s]=x.useState("login"),[a,l]=x.useState(null),[c,d]=x.useState(""),[h,p]=x.useState(""),[f,m]=x.useState(!1),[y,v]=x.useState(null),[N,_]=x.useState(null),[S,k]=x.useState(null),[j,E]=x.useState(null),C=x.useRef(""),T=x.useRef(!1),R=x.useRef(!1),A=x.useRef(null),D=x.useRef(null),O=x.useRef(null),$=x.useRef(null),F=x.useRef([]),Z=x.useRef(!1),J=x.useCallback(()=>{T.current&&Sl({action:"login-cancel"}).catch(()=>{}),e()},[e]),I=Vt(J,{focusRef:O}),X=x.useCallback(async()=>{if(!fr(R.current))return;R.current=!0,m(!0),v(null),T.current=!0;const W=await Sl({action:"login"}).catch(()=>null);if(R.current=!1,m(!1),!(W!=null&&W.ok)){v(ni(W,"could not start the sign-in"));return}l(W)},[]);x.useEffect(()=>{if(!zD(a==null?void 0:a.state))return;const W=window.setInterval(async()=>{try{const ee=await fetch("/api/claude-accounts/login");ee.ok&&l(await ee.json())}catch{}},p6);return()=>window.clearInterval(W)},[a]);const G=x.useRef(t);G.current=t;const q=x.useState(VD)[0];x.useEffect(()=>{var W;(a==null?void 0:a.state)==="awaiting_code"&&((W=A.current)==null||W.focus()),q.shouldAnnounce(a==null?void 0:a.state)&&G.current()},[a==null?void 0:a.state,q]),x.useEffect(()=>{var W;n==="paste"&&!Z.current&&((W=D.current)==null||W.focus()),Z.current=!1},[n]);const Y=x.useCallback(W=>{var H;const ee=c6(W,Iu.findIndex(ae=>ae.id===n),Iu.length);ee.kind!=="pass"&&(W.preventDefault(),Z.current=!0,s(Iu[ee.index].id),(H=F.current[ee.index])==null||H.focus())},[n]),L=x.useCallback(async()=>{var ee;if(!fr(R.current))return;R.current=!0,m(!0),v(null);const W=await Sl({action:"login-code",code:c}).catch(()=>null);if(R.current=!1,m(!1),!(W!=null&&W.ok)){v(ni(W,"the code was not accepted")),W!=null&&W.state&&l(W),(ee=A.current)==null||ee.select();return}d(""),l(W)},[c,a]),K=x.useCallback(async()=>{if(!fr(R.current))return;R.current=!0,m(!0),v(null);const W=await Sl({action:"import",blob:h}).catch(()=>null);if(R.current=!1,m(!1),!(W!=null&&W.ok)){v(ni(W,"the import failed"));return}C.current=h,p(""),E(null),_(W.results??[]),t()},[h,t]),P=x.useCallback(async W=>{const ee=`${W.email}|${W.org??""}`;if(!fr(R.current)||!C.current)return;R.current=!0,m(!0),k(ee),E(null);const H=await Sl({action:"import",blob:C.current,force:!0,only:{email:W.email,org:W.org??""}}).catch(()=>null);if(R.current=!1,m(!1),k(null),!(H!=null&&H.ok)){E({key:ee,text:ni(H,"that account could not be updated")});return}const ae=(H.results??[])[0];ae&&_(me=>me&&me.map(ge=>`${ge.email}|${ge.org??""}`===ee?ae:ge)),t()},[t]),V=(a==null?void 0:a.state)==="done"?a.account:null,he=z2(a==null?void 0:a.state)||!!(y&&T.current&&!f),U=HD({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:J,role:"presentation",children:i.jsxs("div",{ref:I,className:"modal aa-modal",onClick:W=>W.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:Y,children:Iu.map((W,ee)=>i.jsx("button",{type:"button",role:"tab",id:E1(W.id),ref:H=>{F.current[ee]=H},"aria-selected":n===W.id,"aria-controls":j1,tabIndex:n===W.id?0:-1,className:`aa-tab${n===W.id?" on":""}`,onClick:()=>{Z.current=!1,s(W.id)},children:W.label},W.id))})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:J,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsx("section",{className:"modal-body aa-body",id:j1,role:"tabpanel","aria-labelledby":E1(n),children:n==="login"?V?i.jsxs("div",{className:"aa-done",children:[i.jsx(qv,{ref:$}),i.jsx(S1,{anchor:$}),i.jsx("h4",{children:V.added?`Account ${V.num} added`:"Credentials refreshed"}),i.jsxs("p",{className:"aa-note",children:[i.jsx("strong",{children:V.email}),V.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),i.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(a==null?void 0:a.state)==="awaiting_code"||(a==null?void 0:a.state)==="registering"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:"1 · Approve in the browser"}),i.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),i.jsx("a",{className:"aa-link",href:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),i.jsx("p",{className:"aa-note",children:"It usually finishes on its own — if the page says you are all set, there is nothing to do here."}),i.jsxs("div",{className:"aa-field",children:[i.jsx("input",{ref:A,type:"text",value:c,onChange:W=>d(W.target.value),onKeyDown:W=>{W.key==="Enter"&&c.trim()&&!f&&L()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),i.jsx("button",{type:"button",className:"btn primary",...hr(f,!c.trim()||a.state==="registering"),onClick:L,children:a.state==="registering"?"registering…":"Continue"})]}),(y||a.error)&&i.jsx("p",{className:"aa-err",children:y??a.error}),i.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):he?i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:U.title}),i.jsx("p",{className:"aa-err",children:U.message}),i.jsx("button",{type:"button",className:"btn",onClick:()=>{T.current=!1,l(null),v(null),X()},children:"Try again"})]}):f||T.current?i.jsx("div",{className:"aa-step",children:i.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):i.jsxs("div",{className:"aa-step aa-primer",children:[i.jsx("h4",{children:"Sign in to Anthropic"}),i.jsx("p",{className:"aa-note",children:"Opens a browser tab where you approve the sign-in. It normally completes by itself; only if the page hands you a code does it need pasting back here. claude-swap records the account when it completes, and the account you are using now stays active."}),i.jsx("div",{className:"aa-actions",children:i.jsx("button",{type:"button",ref:O,className:"btn primary",onClick:X,children:"Open the sign-in page"})})]}):N?(()=>{const W=N.filter(ee=>ee.state==="imported").length;return i.jsxs("div",{className:"aa-done",children:[i.jsx(qv,{ref:$}),W>0&&i.jsx(S1,{anchor:$}),i.jsx("h4",{children:f6(N)}),N.length>0&&i.jsx("ul",{className:"aa-results",children:N.map(ee=>{const H=`${ee.email}|${ee.org??""}`;return i.jsxs("li",{className:`aa-result ${ee.state}`,children:[i.jsx("span",{className:"aa-result-who",children:ee.email||(ee.num?`slot ${ee.num}`:"an account")}),i.jsx("span",{className:"aa-result-what",children:h6(ee.state)}),ee.state==="present"&&i.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":S===H,title:`Overwrite the stored login for ${ee.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>P(ee),children:S===H?"updating…":"update anyway"}),(j==null?void 0:j.key)===H&&i.jsx("span",{className:"aa-result-err",children:j.text})]},H)})}),i.jsxs("p",{className:"aa-note",children:["Nothing changed on the deck you copied this from. An account already here is left as it is, unless its stored login was dead or you pressed",i.jsx("strong",{children:" update anyway"}),"."]}),i.jsxs("div",{className:"aa-actions",children:[i.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),i.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",E(null),_(null)},children:"Import another"})]})]})})():i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:"Paste an account shared from another deck"}),i.jsxs("div",{className:"aa-field",children:[i.jsx("input",{ref:D,type:"text",value:h,onChange:W=>p(W.target.value),onKeyDown:W=>{W.key==="Enter"&&h.trim()&&!f&&K()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),i.jsx("button",{type:"button",className:"btn primary",...hr(f,!h.trim()),onClick:K,children:f?"importing…":"Import"})]}),y&&i.jsx("p",{className:"aa-err",children:y}),i.jsxs("p",{className:"aa-note",children:["Use ",i.jsx("strong",{children:"share"})," on one account in the other deck, or ",i.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})}),document.body)}async function g6(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const y6=1800;function w6({accounts:e,onClose:t,copyText:n}){const[s,a]=x.useState([]),[l,c]=x.useState(null),[d,h]=x.useState(!1),[p,f]=x.useState(null),[m,y]=x.useState(!1),[v,N]=x.useState(()=>Math.floor(Date.now()/1e3)),_=x.useRef(null),S=x.useRef(!1),k=Vt(t,{focusRef:_});x.useEffect(()=>{if(!l)return;N(Math.floor(Date.now()/1e3));const $=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval($)},[l]);const j=u6(e),E=e.filter($=>!s.includes($.num)).map($=>$.num),C=E.length===e.length,T=$=>a(F=>F.includes($)?F.filter(Z=>Z!==$):[...F,$]),R=x.useCallback(async()=>{if(!fr(S.current)||!E.length)return;S.current=!0,h(!0),f(null),y(!1);const $=await g6({action:"share",accounts:E}).catch(()=>null);if(S.current=!1,h(!1),!($!=null&&$.ok)){f(ni($,"the share could not be made"));return}c({blob:$.blob,expiresAt:$.expiresAt,shared:$.shared??[],failed:$.failed??[]})},[e,E]),A=l?U2(l.expiresAt,v):null,D=(A==null?void 0:A.tone)==="gone",O=(l==null?void 0:l.shared.length)??0;return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:k,className:"modal sa-modal",onClick:$=>$.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("h3",{children:"Share accounts"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsx("section",{className:"modal-body sa-body",children:l?i.jsxs("div",{className:"sa-step",children:[i.jsx("h4",{children:D?"This share has expired":O===1?"1 account, ready to paste":`${O} accounts, ready to paste`}),i.jsx("code",{className:`ap-share-blob${D?" sa-dead":""}`,children:l.blob}),i.jsxs("div",{className:"ap-share-foot",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",ref:_,onClick:async()=>{if(D){c(null),R();return}await n(l.blob)&&(y(!0),window.setTimeout(()=>y(!1),y6))},children:D?"make a new share":m?"copied":`copy ${O===1?"the share":"all "+O}`}),i.jsxs("span",{className:"ap-manage-hint",title:"This text is the sign-in for every account in it. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the logins themselves are in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign those accounts out and back in.",children:[i.jsx("span",{className:"ap-share-warn",children:O===1?"this is the password":`this is ${O} passwords`})," · ",i.jsx("span",{className:`ap-share-expiry ${A==null?void 0:A.tone}`,children:A==null?void 0:A.text})]})]}),l.failed.length>0&&i.jsxs("div",{className:"sa-failed",role:"alert",children:[i.jsx("p",{className:"sa-failed-head",children:l.failed.length===1?"One account is not in this bundle:":`${l.failed.length} accounts are not in this bundle:`}),i.jsx("ul",{className:"sa-list",children:l.failed.map($=>{var Z;const F=!!($.email&&((Z=$.detail)!=null&&Z.includes($.email)));return i.jsxs("li",{children:[!F&&i.jsx("span",{className:"sa-who",children:$.email||`account ${$.num}`}),i.jsx("span",{className:"sa-why",children:$.detail||"could not be exported"})]},`${$.num}-${$.email}`)})})]}),i.jsx("p",{className:"sa-note",children:D?i.jsx(i.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):i.jsxs(i.Fragment,{children:["Paste it into the other deck with ",i.jsx("strong",{children:"+"})," → ",i.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),i.jsxs("div",{className:"sa-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>{c(null),y(!1)},children:"Pick again"}),i.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?i.jsxs("div",{className:"sa-step",children:[i.jsx("h4",{children:"Nothing to share"}),i.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",i.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),i.jsx("div",{className:"sa-actions",children:i.jsx("button",{type:"button",className:"btn primary",ref:_,onClick:t,children:"Close"})})]}):i.jsxs("div",{className:"sa-step",children:[i.jsxs("h4",{children:["Which accounts go to the other ",Gt,"?"]}),i.jsx("p",{className:`sa-count${E.length?"":" empty"}`,children:d6(E.length)}),i.jsx("ul",{className:"sa-list sa-pick",children:j.map($=>i.jsx("li",{children:i.jsxs("label",{className:"sa-row",children:[i.jsx("input",{type:"checkbox",checked:E.includes($.num),onChange:()=>T($.num)}),i.jsx("span",{className:"sa-who",children:$.label}),$.sub&&i.jsx("span",{className:"sa-sub",children:$.sub})]})},$.num))}),p&&i.jsx("p",{className:"aa-err",children:p}),i.jsxs("div",{className:"sa-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>a(C?e.map($=>$.num):[]),children:C?"Clear all":"Select all"}),i.jsx("button",{type:"button",className:"btn primary",ref:_,...hr(d,!E.length),onClick:R,children:d?"making the share…":E.length===0?"Share":E.length===1?"Share 1 account":`Share ${E.length} accounts`})]})]})})]})}),document.body)}function v6(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((a,l)=>a-l).map(a=>{const l=a===t?"here":n.has(a)?"swap":"free";return{slot:a,kind:l,label:l==="here"?`slot ${a}`:`slot ${a} · ${l}`}})}function x6(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 b6(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function k6(e,t,n){var a;const s=((a=e.find(l=>l.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 _6(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 C1(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function T1(e){const t=e.filter(d=>!C1(d)),n=e.filter(d=>C1(d)),s=t.length?t:n,a=t.length?n:[],l=s.reduce((d,h)=>d&&d.pct>=h.pct?d:h,null);let c=null;for(const d of a)l&&d.pct<=l.pct||(!c||d.pct>c.pct)&&(c=d);return{shown:s,rest:a,fuller:c,peak:c??l}}function N6(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function S6(e,t,n,s){const a=e==null?"No usage has been collected for this account yet.":`${Math.round(e)}% left on ${t??"the window that runs out first"}, which is the one that runs out first.`,l=n===1?"the other window":`the other ${n} windows`;return`${a} ${s?"Hide":"Show"} ${l}.`}const j6="\0";function Sx(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}${j6}${n}`}function E6(e,t){const n=Sx(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function C6(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(Sx)),s=e.filter(a=>n.has(a));return s.length===e.length?e:s}const T6=64;function A6(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const R6=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function A1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function M6(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=fi(t.body);return{text:Dv(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function R1(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 W2({title:e,steps:t,finish:n,aside:s,onClose:a}){const l=x.useRef(null),c=Vt(a,{focusRef:l}),[d,h]=x.useState(0),p=d===t.length-1,f=t[d],m=N=>h(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"?d+1:d-1))},v=()=>{if(!p){m(d+1);return}n?n.act():a()};return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:i.jsxs("div",{ref:c,className:"modal guide",onClick:N=>N.stopPropagation(),onKeyDown:y,role:"dialog","aria-modal":"true","aria-labelledby":"guide-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{id:"guide-title",className:"modal-tool-name",children:e}),i.jsxs("span",{className:"modal-tool-id",children:[d+1," / ",t.length]})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsx("div",{className:"guide-stage",children:f.art},d),i.jsx("p",{className:"guide-line","aria-live":"polite",children:f.line}),i.jsx("p",{className:"guide-tip",children:f.tip??""}),i.jsxs("div",{className:"guide-foot",children:[i.jsx("div",{className:"guide-dots",children:t.map((N,_)=>i.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${_+1} of ${t.length}`,"aria-current":_===d?"step":void 0,onClick:()=>m(_)},_))}),p&&s&&i.jsx("button",{type:"button",className:"ap-lan-word guide-aside",onClick:s.act,children:s.label}),d>0&&i.jsx("button",{type:"button",className:"btn",onClick:()=>m(d-1),children:"Back"}),i.jsx("button",{ref:l,type:"button",className:"btn primary",onClick:v,children:p?(n==null?void 0:n.label)??"Done":"Next"})]})]})]})}),document.body)}const Fv={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function Yn({children:e}){return i.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function Vn({x:e,y:t=34,w:n=176,h:s=132,label:a}){return i.jsxs(i.Fragment,{children:[a&&i.jsx("text",{x:e+2,y:t-9,className:"ga-cap",children:a}),i.jsx("rect",{x:e,y:t,width:n,height:s,rx:10,className:"ga-screen"})]})}function mr({x:e,y:t,email:n,state:s,tone:a,bars:l}){return i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:e+3,cy:t-4,r:3,className:Fv[a]}),i.jsx("text",{x:e+12,y:t,className:"ga-t ga-mono",children:n}),i.jsx("text",{x:e+12,y:t+16,className:`ga-s ${Fv[a]}`,children:s}),l==null?void 0:l.map((c,d)=>i.jsxs("g",{children:[i.jsx("text",{x:e,y:t+40+d*18,className:"ga-s",children:d?"7d":"5h"}),i.jsx("rect",{x:e+22,y:t+35+d*18,width:96,height:4,rx:2,className:"ga-track"}),i.jsx("rect",{x:e+22,y:t+35+d*18,width:96*c/100,height:4,rx:2,className:"ga-accent"}),i.jsxs("text",{x:e+148,y:t+40+d*18,className:"ga-s ga-accent",textAnchor:"end",children:[c,"%"]})]},d))]})}function H2({x:e,y:t,on:n}){return i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:30,height:18,rx:9,className:n?"ga-switch-on":"ga-switch"}),i.jsx("circle",{cx:n?e+21:e+9,cy:t+9,r:6,className:n?"ga-knob-on":"ga-knob"})]})}function $u({x:e,y:t,name:n,here:s=!0}){return i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:e+3,cy:t-4,r:3,className:s?"ga-ok":"ga-dim"}),i.jsx("text",{x:e+12,y:t,className:s?"ga-t":"ga-s",children:n})]})}function M1({x:e,y:t,on:n}){return n?i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:12,height:12,rx:3,className:"ga-accent"}),i.jsx("path",{d:`M${e+3} ${t+6.2}l2.3 2.3 4-4.6`,className:"ga-tick"})]}):i.jsx("rect",{x:e+.5,y:t+.5,width:11,height:11,rx:3,className:"ga-box"})}function I1({x:e,y:t,d:n}){return i.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function jx({x:e,y:t}){return i.jsx("path",{d:`M${e} ${t}l0 13 3.4-3 2.4 5.2 2-.9-2.4-5.1 4.6-.2z`,className:"ga-pointer"})}function Ex(){return i.jsxs(i.Fragment,{children:[i.jsx("circle",{r:9,className:"ga-key-bed"}),i.jsxs("g",{transform:"translate(-6 -6) scale(0.857)",className:"ga-key",children:[i.jsx("circle",{cx:4.6,cy:7,r:2.6}),i.jsx("path",{d:"M7.2 7h5.2M10.6 7v2.2M12.4 7v1.6"})]})]})}function ri({x:e,y:t,w:n,title:s,sub:a,tone:l}){return i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:n,height:40,rx:8,className:"ga-screen"}),i.jsx("rect",{x:e+6,y:t+10,width:3,height:20,rx:1.5,className:Fv[l]}),i.jsx("text",{x:e+16,y:t+17,className:"ga-t ga-strong",children:s}),i.jsx("text",{x:e+16,y:t+31,className:"ga-s",children:a})]})}function ii({x:e,y:t,label:n,live:s}){return i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:46,height:20,rx:10,className:s?"ga-chip-live":"ga-chip"}),i.jsx("text",{x:e+23,y:t+14,className:"ga-s ga-mono",textAnchor:"middle",children:n})]})}function fd({x:e,y:t}){return i.jsxs(i.Fragment,{children:[i.jsx("text",{x:e,y:t,className:"ga-cap",children:"LOCAL NETWORK"}),i.jsx(H2,{x:e+118,y:t-13,on:!0})]})}function I6(){return i.jsxs(Yn,{children:[i.jsx("rect",{x:14,y:14,width:206,height:172,rx:10,className:"ga-screen"}),i.jsx("text",{x:28,y:38,className:"ga-t ga-strong",children:"Sessions"}),i.jsx("text",{x:206,y:38,className:"ga-s ga-warn",textAnchor:"end",children:"1 waiting"}),i.jsx("rect",{x:20,y:50,width:194,height:42,rx:6,className:"ga-bed-warn"}),i.jsx("circle",{cx:33,cy:64,r:7,className:"ga-ring-warn ga-ping"}),i.jsx("circle",{cx:33,cy:64,r:3.5,className:"ga-warn"}),i.jsx("text",{x:44,y:68,className:"ga-t",children:"api-server"}),i.jsx("text",{x:44,y:83,className:"ga-s ga-warn",children:"waiting 6m · Bash"}),i.jsx("circle",{cx:33,cy:108,r:3.5,className:"ga-flight"}),i.jsx("text",{x:44,y:112,className:"ga-t",children:"docs-site"}),i.jsx("text",{x:44,y:127,className:"ga-s",children:"running · 12 tools"}),i.jsx("circle",{cx:33,cy:150,r:3.5,className:"ga-ok"}),i.jsx("text",{x:44,y:154,className:"ga-t",children:"billing"}),i.jsx("text",{x:44,y:169,className:"ga-s",children:"done · $0.84"}),i.jsx("path",{d:"M216 71C234 71 230 100 244 100",className:"ga-arc"}),i.jsx("path",{d:"M239 96l5 4-5 4",className:"ga-arrow"}),i.jsx("rect",{x:248,y:44,width:178,height:112,rx:10,className:"ga-screen"}),i.jsx("text",{x:262,y:64,className:"ga-cap",children:"API-SERVER"}),i.jsx("line",{x1:248,y1:74,x2:426,y2:74,className:"ga-line"}),i.jsx("text",{x:262,y:96,className:"ga-s ga-mono",children:"Bash(npm test)"}),i.jsx("text",{x:262,y:116,className:"ga-t ga-mono ga-warn",children:"Allow this command?"}),i.jsx("text",{x:262,y:136,className:"ga-s ga-mono",children:"> 1. Yes 2. No"})]})}function $6(){return i.jsxs(Yn,{children:[i.jsx("path",{d:"M136 100C166 100 166 38 196 38",className:"ga-edge ga-flow"}),i.jsx("path",{d:"M136 100H196",className:"ga-edge ga-flow"}),i.jsx("path",{d:"M136 100C166 100 166 162 196 162",className:"ga-edge-done"}),i.jsx("path",{d:"M308 38H326M308 100H326",className:"ga-edge"}),i.jsx(ri,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),i.jsx(ri,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),i.jsx(ri,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),i.jsx(ri,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),i.jsx(ii,{x:326,y:28,label:"Read"}),i.jsx(ii,{x:380,y:28,label:"Grep",live:!0}),i.jsx(ii,{x:326,y:90,label:"Bash",live:!0})]})}function $1({x:e,y:t,label:n,pct:s,note:a}){return i.jsxs(i.Fragment,{children:[i.jsx("text",{x:e,y:t,className:"ga-s",children:n}),i.jsxs("text",{x:e+194,y:t,className:"ga-s ga-accent",textAnchor:"end",children:[s,"%"]}),i.jsx("rect",{x:e,y:t+7,width:194,height:5,rx:2.5,className:"ga-track"}),i.jsx("rect",{x:e,y:t+7,width:194*s/100,height:5,rx:2.5,className:"ga-accent"}),i.jsx("text",{x:e,y:t+26,className:"ga-s",children:a})]})}function O6(){return i.jsxs(Yn,{children:[i.jsx("rect",{x:14,y:30,width:172,height:140,rx:10,className:"ga-screen"}),i.jsx("text",{x:30,y:56,className:"ga-cap",children:"THIS SESSION"}),i.jsx("text",{x:30,y:98,className:"ga-big",children:"$3.66"}),i.jsx("text",{x:30,y:122,className:"ga-s",children:"Opus 5 · 1.2M tokens"}),i.jsx("text",{x:30,y:150,className:"ga-s",children:"$21.40 today"}),i.jsx("rect",{x:200,y:30,width:226,height:140,rx:10,className:"ga-screen"}),i.jsx("text",{x:216,y:56,className:"ga-cap",children:"CLAUDE QUOTA"}),i.jsx($1,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),i.jsx($1,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function P6(){return i.jsxs(Yn,{children:[i.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),i.jsx(ri,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),i.jsx(jx,{x:156,y:106}),i.jsx("path",{d:"M170 92C186 92 184 60 200 60",className:"ga-arc"}),i.jsx("path",{d:"M195 56l5 4-5 4",className:"ga-arrow"}),i.jsx(Vn,{x:200,y:22,w:226,h:160}),i.jsx("text",{x:214,y:46,className:"ga-t ga-strong",children:"tests"}),i.jsx("text",{x:412,y:46,className:"ga-s",textAnchor:"end",children:"Sonnet 5 · 38s"}),i.jsx("line",{x1:200,y1:56,x2:426,y2:56,className:"ga-line"}),i.jsx("text",{x:214,y:76,className:"ga-cap",children:"PROMPT"}),i.jsx("text",{x:214,y:92,className:"ga-t",children:"Run the suite and fix what fails"}),i.jsx("text",{x:214,y:116,className:"ga-cap",children:"TOOLS · 6"}),i.jsx(ii,{x:214,y:122,label:"Read"}),i.jsx(ii,{x:266,y:122,label:"Edit"}),i.jsx(ii,{x:318,y:122,label:"Bash",live:!0}),i.jsx("text",{x:214,y:164,className:"ga-cap",children:"TOKENS"}),i.jsx("text",{x:214,y:178,className:"ga-s ga-mono",children:"41k in · 2.1k out · $0.12"})]})}function L6(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return i.jsxs(Yn,{children:[i.jsx(Vn,{x:14,y:20,w:412,h:160}),i.jsx("text",{x:28,y:44,className:"ga-t ga-strong",children:"This machine"}),i.jsx("text",{x:412,y:44,className:"ga-s",textAnchor:"end",children:"12 cores · up 10d"}),i.jsx("line",{x1:14,y1:56,x2:426,y2:56,className:"ga-line"}),i.jsx("text",{x:28,y:76,className:"ga-cap",children:"CORES"}),e.map((t,n)=>i.jsxs("g",{children:[i.jsx("rect",{x:28+n*15,y:82,width:10,height:30,rx:2,className:"ga-track"}),i.jsx("rect",{x:28+n*15,y:112-t,width:10,height:t,rx:2,className:"ga-accent"})]},n)),i.jsx("text",{x:28,y:136,className:"ga-cap",children:"MEMORY"}),i.jsx("rect",{x:28,y:143,width:178,height:5,rx:2.5,className:"ga-track"}),i.jsx("rect",{x:28,y:143,width:105,height:5,rx:2.5,className:"ga-accent"}),i.jsx("text",{x:28,y:165,className:"ga-s",children:"18.9 GB of 32.0 GB"}),i.jsx("text",{x:240,y:76,className:"ga-cap",children:"THERMAL"}),i.jsx("text",{x:240,y:100,className:"ga-big",children:"66 °C"}),i.jsx("text",{x:240,y:118,className:"ga-s ga-ok",children:"running at full speed"}),i.jsx("text",{x:240,y:142,className:"ga-cap",children:"BUSIEST PROCESSES"}),i.jsx("text",{x:240,y:160,className:"ga-s ga-mono",children:"node · claude"}),i.jsx("text",{x:412,y:160,className:"ga-s ga-mono",textAnchor:"end",children:"38%"}),i.jsx("text",{x:240,y:176,className:"ga-s ga-mono",children:"esbuild"}),i.jsx("text",{x:412,y:176,className:"ga-s ga-mono",textAnchor:"end",children:"21%"})]})}function D6(){return i.jsxs(Yn,{children:[i.jsx("rect",{x:14,y:40,width:188,height:120,rx:10,className:"ga-screen"}),i.jsx("text",{x:28,y:60,className:"ga-cap",children:"~/MY-PROJECT"}),i.jsx("line",{x1:14,y1:70,x2:202,y2:70,className:"ga-line"}),i.jsxs("text",{x:28,y:100,className:"ga-t ga-mono",children:[i.jsx("tspan",{className:"ga-accent",children:"$"})," claude"]}),i.jsx("rect",{x:86,y:90,width:7,height:13,className:"ga-caret ga-blink"}),i.jsx("text",{x:28,y:130,className:"ga-s ga-mono",children:"or: codex"}),i.jsx("path",{d:"M210 100H238",className:"ga-arc"}),i.jsx("path",{d:"M233 95l6 5-6 5",className:"ga-arrow"}),i.jsx("rect",{x:250,y:40,width:176,height:120,rx:10,className:"ga-canvas"}),i.jsx("g",{className:"ga-pop",children:i.jsx(ri,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function q6(){return i.jsxs(Yn,{children:[i.jsx(Vn,{x:14,y:16,w:232,h:170}),i.jsx("text",{x:28,y:40,className:"ga-t ga-strong",children:"Claude accounts"}),i.jsx(I1,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),i.jsx(I1,{x:220,y:33,d:"M3.3 10.7L10.7 3.3M5.2 3.3h5.5v5.5"}),i.jsx("line",{x1:14,y1:52,x2:246,y2:52,className:"ga-line"}),i.jsx(mr,{x:28,y:74,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),i.jsx("rect",{x:190,y:62,width:44,height:18,rx:9,className:"ga-accent"}),i.jsx("text",{x:212,y:74,className:"ga-s ga-on-accent",textAnchor:"middle",children:"active"}),i.jsx("line",{x1:14,y1:140,x2:246,y2:140,className:"ga-line"}),i.jsx(mr,{x:28,y:160,email:"personal@me.dev",state:"signed in",tone:"ok"}),i.jsx("rect",{x:188,y:148,width:46,height:18,rx:9,className:"ga-chip"}),i.jsx("text",{x:211,y:160,className:"ga-s",textAnchor:"middle",children:"switch"}),i.jsx(jx,{x:221,y:161}),i.jsx("path",{d:"M250 40C270 40 262 78 282 78",className:"ga-arc"}),i.jsx("path",{d:"M277 74l5 4-5 4",className:"ga-arrow"}),i.jsx(Vn,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),i.jsx("g",{className:"ga-pop",children:i.jsx(mr,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function F6(){return i.jsxs(Yn,{children:[i.jsx(Vn,{x:14,label:"THIS MACHINE"}),i.jsx(fd,{x:28,y:60}),i.jsx("g",{className:"ga-swap-out",children:i.jsx(mr,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),i.jsx("g",{className:"ga-swap-in",children:i.jsx(mr,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),i.jsx(Vn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(fd,{x:264,y:60}),i.jsx(mr,{x:264,y:98,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),i.jsx("path",{d:"M246 120C234 80 206 80 194 120",className:"ga-arc"}),i.jsx("g",{className:"ga-travel ga-travel-low",transform:"translate(220 90)",children:i.jsx(Ex,{})})]})}const B6=[{art:i.jsx(I6,{}),line:"Sessions waiting on you top the session list, longest wait first.",tip:"A tone and a system notification when one stops to ask. The speaker in the topbar."},{art:i.jsx($6,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:i.jsx(P6,{}),line:"Click any node: its prompt, every tool call, tokens and timing."},{art:i.jsx(O6,{}),line:"What each session costs, and how much quota is left."},{art:i.jsx(L6,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:i.jsx(q6,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:i.jsx(F6,{}),line:"Your machines repair each other's expired logins over the local network.",tip:"Local network is the last section of the Claude accounts panel."},{art:i.jsx(D6,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function z6(){return i.jsxs(Yn,{children:[i.jsx(Vn,{x:14,label:"THIS MACHINE"}),i.jsx(mr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"}),i.jsx("rect",{x:40,y:94,width:86,height:20,rx:10,className:"ga-pill-warn"}),i.jsx("text",{x:83,y:108,className:"ga-s ga-warn",textAnchor:"middle",children:"sign in again"}),i.jsx("line",{x1:198,y1:100,x2:242,y2:100,className:"ga-off"}),i.jsx(Vn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(mr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function U6(){return i.jsxs(Yn,{children:[i.jsx(Vn,{x:14,label:"THIS MACHINE"}),i.jsx(fd,{x:28,y:60}),i.jsx($u,{x:28,y:92,name:"Ana's MacBook"}),i.jsx($u,{x:28,y:114,name:"Dorin's PC"}),i.jsx(Vn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(fd,{x:264,y:60}),i.jsx($u,{x:264,y:92,name:"Your MacBook"}),i.jsx($u,{x:264,y:114,name:"Dorin's PC"}),i.jsx("line",{x1:196,y1:100,x2:244,y2:100,className:"ga-arc"}),i.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping"}),i.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping ga-ping-2"}),i.jsx("circle",{cx:220,cy:100,r:3,className:"ga-accent"})]})}function W6(){return i.jsxs(Yn,{children:[i.jsx("rect",{x:90,y:18,width:260,height:164,rx:10,className:"ga-screen"}),i.jsx("text",{x:106,y:42,className:"ga-t ga-strong",children:"This deck on the network"}),i.jsx("line",{x1:90,y1:54,x2:350,y2:54,className:"ga-line"}),i.jsx("text",{x:106,y:76,className:"ga-cap",children:"SHARE THESE ACCOUNTS"}),i.jsx(M1,{x:106,y:88,on:!0}),i.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),i.jsx(M1,{x:106,y:112}),i.jsx("text",{x:126,y:122,className:"ga-s ga-mono",children:"personal@me.dev"}),i.jsx("text",{x:106,y:150,className:"ga-cap",children:"PAIRING"}),i.jsx("text",{x:106,y:168,className:"ga-s",children:"Say yes to every deck that asks"}),i.jsx(H2,{x:304,y:157,on:!0}),i.jsx(jx,{x:115,y:97})]})}function H6(){return i.jsxs(Yn,{children:[i.jsx(Vn,{x:14,label:"THIS MACHINE"}),i.jsx("g",{className:"ga-swap-out",children:i.jsx(mr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),i.jsx("g",{className:"ga-swap-in",children:i.jsx(mr,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),i.jsx(Vn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(mr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),i.jsx("path",{d:"M246 96C234 56 206 56 194 96",className:"ga-arc"}),i.jsx("g",{className:"ga-travel",transform:"translate(220 66)",children:i.jsx(Ex,{})})]})}const G6=[{art:i.jsx(z6,{}),line:"A login can expire on one machine while it still works on another."},{art:i.jsx(U6,{}),line:"Both decks are on. They find each other and ask to pair.",tip:"Not showing up? The + in the section reaches a machine by address or invite."},{art:i.jsx(W6,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:i.jsx(H6,{}),line:"An expired login is copied from a paired machine within a minute."}];function V6(){return i.jsxs("svg",{className:"guide-art",viewBox:"0 0 232 60","aria-hidden":!0,focusable:"false",children:[i.jsx("rect",{x:1,y:14,width:78,height:42,rx:7,className:"ga-screen"}),i.jsx("circle",{cx:13,cy:29,r:3,className:"ga-warn"}),i.jsx("rect",{x:21,y:27,width:46,height:4,rx:2,className:"ga-track"}),i.jsx("rect",{x:13,y:39,width:40,height:3,rx:1.5,className:"ga-track"}),i.jsx("rect",{x:153,y:14,width:78,height:42,rx:7,className:"ga-screen"}),i.jsx("circle",{cx:165,cy:29,r:3,className:"ga-ok"}),i.jsx("rect",{x:173,y:27,width:46,height:4,rx:2,className:"ga-track"}),i.jsx("rect",{x:165,y:39,width:40,height:3,rx:1.5,className:"ga-accent"}),i.jsx("path",{d:"M150 36C138 6 94 6 82 36",className:"ga-arc"}),i.jsx("g",{transform:"translate(116 13)",children:i.jsx(Ex,{})})]})}async function zf(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const Y6={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."},K6={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function O1(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||Dt(n,t)}function X6({status:e,manual:t,onClose:n,onChanged:s}){var q,Y;const a=x.useRef(null),l=Vt(n,{focusRef:a}),[c,d]=x.useState(""),[h,p]=x.useState(""),[f,m]=x.useState(null),[y,v]=x.useState(null),[N,_]=x.useState(null),[S,k]=x.useState(null),[j,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=>Td(T.current)?(T.current=L,_(L),!0):!1,[]),A=x.useCallback(()=>{T.current=null,C.current&&_(null)},[]),D=L=>{const K=Ys(N,L);return{disabled:K.disabled,"aria-busy":K.busy}},O=L=>(f==null?void 0:f.field)===L?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},$=L=>m(K=>K&&K.field===L?null:K),F=x.useCallback(async()=>{const L=cq(c);if(!L){m({text:Q6(c),field:"addr"});return}const K=`${L.addr}:${L.port}`,P=e.peers.find(V=>V.addr===L.addr&&V.port===L.port&&V.paired);if(P){m({text:`Already paired with ${P.name} at that address.`,field:"addr"});return}if(t.includes(K)){m({text:"This deck already calls that address.",field:"addr"});return}if(R("add"))try{const V=await zf("/api/prefs",{lan:{manual:[...t,K]}});if(!C.current)return;V!=null&&V.ok?(m(null),d(""),s(),n()):m({text:Dt("add that address",V),field:"addr"})}catch{C.current&&m({text:Dt("add that address",null),field:"addr"})}finally{A()}},[c,t,e.peers,s,n,R,A]),Z=x.useCallback(async L=>{if(!R(`invite:${L}`))return;const K=L==="make"?"make an invite":"cancel that invite";try{const P=await zf("/api/lan/invite",{action:L});if(!C.current)return;P!=null&&P.ok?(m(null),v(null),s()):m({text:O1(K6,P,K)})}catch{C.current&&m({text:Dt(K,null)})}finally{A()}},[s,R,A]),J=x.useCallback(async()=>{const L=h.trim();if(!(!L||!R("join"))){k(null);try{const K=await zf("/api/lan/invite",{action:"join",token:L});if(!C.current)return;K!=null&&K.ok?(p(""),m(null),s(),n()):(K==null?void 0:K.reason)==="unreachable"&&Array.isArray(K.tried)&&K.tried.length?(k(K.tried),m(null)):(k(null),m({text:O1(Y6,K,"use that invite"),field:"join"}))}catch{C.current&&m({text:Dt("use that invite",null),field:"join"})}finally{A()}}},[h,s,n,R,A]),I=x.useCallback(async(L,K)=>{try{await navigator.clipboard.writeText(L),v(K),window.setTimeout(()=>{C.current&&v(P=>P===K?null:P)},1600)}catch{m({text:"Could not copy it — select the text and copy it by hand."})}},[]),X=e.invite&&e.invite.expiresAt>j?e.invite:null,G=((q=e.reach)==null?void 0:q.steps)??[];return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:l,className:"modal lan-add",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[f&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:f.text}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),((Y=e.reach)==null?void 0:Y.blocked)&&i.jsxs("div",{className:"ap-lan-reach",children:[i.jsx("p",{className:"lan-warn",children:e.reach.text}),i.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&&i.jsxs("details",{className:"ap-lan-reach-fix",children:[i.jsx("summary",{children:"or let them find this deck on their own"}),i.jsxs("p",{className:"lan-note",children:["Run this in PowerShell ",i.jsx("strong",{children:"as Administrator"}),", then restart the deck.",e.reach.category==="Public"&&i.jsx(i.Fragment,{children:" The first line marks this network as a home or office one — leave it out on a network you do not trust."})]}),i.jsx("pre",{className:"ap-lan-cmd",children:i.jsx("code",{children:G.join(`
|
|
80
80
|
`)})}),i.jsx("button",{type:"button",className:"ap-manage-btn",...D("copy:fix"),onClick:()=>void I(G.join(`
|
|
81
|
-
`),"fix"),title:"Copy these lines, then paste them into an elevated PowerShell",children:y==="fix"?"copied":"copy command"})]})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"By address"}),i.jsxs("div",{className:"ap-lan-row",children:[i.jsx("input",{ref:a,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:c,placeholder:"192.168.1.5:54340",spellCheck:!1,...O("addr"),onChange:L=>{d(L.target.value),$("addr")},onKeyDown:L=>{L.key==="Enter"&&B()}}),c.trim()!==""&&i.jsx("button",{type:"button",className:"ap-manage-btn",...D("add"),onClick:()=>void B(),title:"Add it to the decks this one calls, starting now.",children:"add"})]}),i.jsx("p",{className:"lan-note",children:"This deck calls that address until somebody there accepts."})]}),i.jsxs("div",{className:"modal-section",children:[i.jsxs("h3",{className:"lan-h",children:["With an invite",!X&&i.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...D("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"})]}),i.jsxs("div",{className:"ap-lan-row",children:[i.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:h,placeholder:"paste one you were sent",spellCheck:!1,...O("join"),onChange:L=>{p(L.target.value),k(null),$("join")},onKeyDown:L=>{L.key==="Enter"&&J()}}),h.trim()!==""&&i.jsx("button",{type:"button",className:"ap-manage-btn",...D("join"),onClick:()=>void J(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:N==="join"?"joining…":"join"})]}),i.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),S&&i.jsxs("div",{className:"ap-lan-tried",children:[i.jsx("span",{className:"lan-note",children:"Nothing answered at any address in that invite. Check that deck is running with its Local network switch on."}),S.map(L=>i.jsxs("span",{className:"ap-lan-tried-row",children:[i.jsx("code",{className:"ap-lan-code",children:L.addr}),i.jsx("span",{className:"ap-lan-bad",children:L.why})]},L.addr))]}),X&&i.jsxs("div",{className:"ap-lan-invite",children:[i.jsxs("div",{className:"ap-lan-invite-head",children:[i.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),i.jsxs("span",{className:"ap-lan-invite-left",children:[dq(X.expiresAt,j)," left"]})]}),i.jsx("code",{className:"ap-lan-token",children:X.token}),i.jsxs("div",{className:"ap-lan-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...D("copy:invite"),onClick:()=>void I(X.token,"invite"),title:"Copy it, and send it however you already talk to them",children:y==="invite"?"copied":"copy"}),i.jsx("button",{type:"button",className:"ap-manage-btn",...D("invite:withdraw"),onClick:()=>void Z("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),i.jsx("p",{className:"lan-warn",children:"Anyone who gets this text can pair with this deck until it runs out."})]})]})]})]})}),document.body)}function Q6(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 Z6=1e3;function J6(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=Lr(e,t);return`${n} · ${s==="now"?"just now":s}`}function $1(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}function eq(){return i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M9.6 2.4l2 2L5 11l-2.6.6L3 9z"}),i.jsx("path",{d:"M8.4 3.6l2 2"})]})}function O1(){return i.jsxs("svg",{className:"lan-machine",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("rect",{x:"2.5",y:"3",width:"11",height:"7.5",rx:"1.2"}),i.jsx("path",{d:"M1 13h14"})]})}function Ou({dir:e,gate:t=!1}){const n=t?12:8;return i.jsx("svg",{className:"lan-chev","data-dir":e,"data-gate":t||void 0,width:n,height:"8",viewBox:`0 0 ${n} 8`,fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:e==="out"?"M2.8 1L6 4 2.8 7":t?"M1 1v6M9.6 1L6.4 4l3.2 3":"M5.2 1L2 4l3.2 3"})})}const tq={works:"works here",expired:"expired here",missing:"not on this deck"},nq={works:"works there",broken:"broken there",unknown:"not offered by that deck"};function rq(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${tq[e.here]}, ${nq[e.there]}, ${t}.`}function sq({row:e,source:t,status:n,accounts:s,now:a,busy:l,onClose:c,onRename:d,onCheck:h,onVerb:p,onSettings:f,twins:m=[],onUnpair:y}){var ze,Xe,re,Fe;const v=x.useRef(null),N=Vt(c,{focusRef:v}),[_,S]=x.useState(null),[k,j]=x.useState(null),[E,C]=x.useState(!1),T=x.useRef(0),[R,A]=x.useState(null),[D,O]=x.useState(!1),[$,B]=x.useState(0),Z=x.useRef(null),J=x.useRef(!0);x.useEffect(()=>()=>{J.current=!1},[]);const I=_!=null;x.useEffect(()=>{var se;I&&((se=Z.current)==null||se.select())},[I]),x.useEffect(()=>{if(!E)return;const se=window.setTimeout(()=>C(!1),4e3);return()=>window.clearTimeout(se)},[E]),x.useEffect(()=>{if(!R)return;const se=window.setTimeout(()=>A(null),4e3);return()=>window.clearTimeout(se)},[R]);const X=se=>{const Ce=Ys(l,se);return{disabled:Ce.disabled,"aria-busy":Ce.busy}},G=async se=>{const Ce=await se();return J.current&&j(Ce),Ce==null},{peer:q,stranger:Y}=t,L=e.kind==="paired",K=e.self??e.name,P=e.kind!=="dialling",V=e.kind==="dialling"?null:e.fp,he=q?q.addr?`${q.addr}:${q.port}`:"":Y?Y.port?`${Y.addr}:${Y.port}`:Y.addr:e.addr,z=(q==null?void 0:q.about)??null,W=((ze=n.about)==null?void 0:ze.version)??null,ee=async se=>{const Ce=se.trim()===K?"":se;await G(()=>d(Ce))&&S(null)},H=async()=>{if(V)try{if(await navigator.clipboard.writeText(V),!J.current)return;O(!0),window.setTimeout(()=>{J.current&&O(!1)},1600)}catch{J.current&&j("Could not copy it — select the fingerprint and copy it by hand.")}},ae=L?q!=null&&q.waiting?q.lastSeen!=null?"not said — it runs an older version":"not said yet — it says when it next calls":q!=null&&q.offers?"not said — it runs an older version":"not reached yet":"shown once paired",me=$1(n.about),ge=$1(z),Re=z!=null&&z.version&&W?wq(z.version,W):null,$e=q?W2(q.last,a):null,ce=(Xe=q==null?void 0:q.last)!=null&&Xe.error&&$e&&$e.text!==q.last.error?q.last.error:null,we=((re=q==null?void 0:q.last)==null?void 0:re.done)??[],xe=!!$e&&!!ce&&!e.quiet&&e.state.startsWith($e.text),De=L||e.kind==="dialling",_e=q?q.waiting?null:q.manual?"added by address":"on this network":e.kind==="nearby"?"heard on this network":"asked this deck to pair",Ee=e.tone==="bad"?"bad":L?e.here?"up":"down":"loose",Ge=l===`check:${e.fp}`,st=(q==null?void 0:q.offers)??null,Je=L?xq(q!=null&&q.waiting?null:(st==null?void 0:st.accounts)??null,s,n.shared??[]):[],Ze=Je.filter(se=>se.in==null&&se.out==="cut"),Qe=Je.some(se=>se.in!=null),fe=Je.some(se=>se.out!=null),ye=new Map(we.map(se=>[se.email,se])),Se=we.filter(se=>!Je.some(Ce=>Ce.email===se.email)),Pe=L?q!=null&&q.waiting?"What that deck offers is not known. This deck never asks it — it calls in — so it only shows once this deck can reach it.":st?st.accounts.length===0?"That deck offers nothing. Nobody there has chosen a login to share.":null:(Fe=q==null?void 0:q.last)!=null&&Fe.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,et=st&&(q!=null&&q.last)&&q.last.at-st.at>Z6?Lr(st.at,a):null,ft=[];L&&(q!=null&&q.pairedAt)?ft.push({label:"Paired",value:J6(q.pairedAt,a),tone:"meta"}):e.kind==="declined"&&Y&&ft.push({label:"Paired",value:`no · you said no ${Tx(Y.at,a)}`,tone:"meta"}),ft.push({label:"Fingerprint",value:V?i.jsxs("span",{className:"lan-fp",children:[i.jsx("code",{className:"ap-lan-code",children:V}),i.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void H(),"aria-label":D?"Fingerprint copied":"Copy the fingerprint",children:D?"copied":"copy"})]}):"not known — nothing has answered there",tone:V?void 0:"quiet"});const dt=m.length?[{row:e,peer:q??null},...m]:[];return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:i.jsxs("div",{ref:N,className:"modal lan-peer","data-tone":e.tone,onClick:se=>se.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-peer-title","aria-describedby":"lan-peer-sub",children:[i.jsxs("header",{className:"modal-head lan-peer-head",children:[i.jsx("i",{className:e.here?"ap-pulse":"ap-dot","aria-hidden":!0}),i.jsxs("div",{className:"lan-peer-id",children:[I?i.jsxs("form",{className:"lan-peer-edit",onSubmit:se=>{se.preventDefault(),ee(_??"")},children:[i.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),i.jsx("input",{ref:Z,className:"ap-manage-input lan-peer-input",value:_??"",maxLength:48,placeholder:K,"aria-label":"Name for this deck, shown on this deck only",onChange:se=>S(se.target.value)}),i.jsx("button",{type:"submit",className:"ap-manage-btn",...X(`alias:${e.fp}`),children:"save"}),i.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>S(null),children:"cancel"})]}):i.jsxs("span",{className:"lan-peer-title",children:[i.jsx("span",{id:"lan-peer-title",className:"lan-peer-name",children:e.name}),P&&i.jsx("button",{type:"button",className:"glyph-btn lan-peer-rename",onClick:()=>{j(null),S(e.name)},"aria-label":`Rename ${e.name} on this deck`,title:"Give it a name of your own. Only this deck sees it.",children:i.jsx(eq,{})})]}),i.jsxs("p",{id:"lan-peer-sub",className:"lan-peer-sub",children:[e.self&&i.jsxs(i.Fragment,{children:["calls itself ",i.jsx("span",{className:"lan-peer-self",children:e.self}),I&&i.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...X(`alias:${e.fp}`),onClick:()=>void ee(""),children:"use this name"}),i.jsx("span",{className:"vis-hidden",children:". "}),!e.quiet&&i.jsx("span",{"aria-hidden":!0,children:" · "})]}),i.jsx("span",{className:e.quiet?"vis-hidden":"lan-peer-state",children:e.state})]})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{ref:v,type:"button",className:"glyph-btn",onClick:c,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body lan-peer-body",children:[k&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",children:k}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>j(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),i.jsxs("div",{className:"lan-map","data-link":Ee,"data-asking":Ge||void 0,"data-bus":Je.length>0||void 0,children:[i.jsxs("div",{className:"lan-ends",children:[i.jsxs("p",{className:"lan-end",children:[i.jsx("span",{className:"lan-end-name",children:"This deck"}),me&&i.jsx("span",{className:"lan-end-runs",children:me})]}),i.jsxs("p",{className:"lan-end","data-side":"there",children:[i.jsx("span",{className:"lan-end-name",children:e.name}),e.kind!=="dialling"&&i.jsxs("span",{className:"lan-end-runs",children:[ge??(z?"not said":ae),Re?` · ${Re<0?"older":"newer"}`:null]})]})]}),i.jsxs("div",{className:"lan-link",children:[i.jsx(O1,{}),i.jsxs("span",{className:"lan-span",children:[i.jsxs("span",{className:"lan-wire","aria-hidden":!0,children:[i.jsx("i",{className:"lan-glint","data-dir":"out"}),i.jsx("i",{className:"lan-glint","data-dir":"in"})]}),i.jsx("span",{className:"lan-link-label",children:he?i.jsx("code",{className:"ap-lan-code",children:he}):"none here — it calls this deck"})]}),i.jsx(O1,{}),(he&&_e||De)&&i.jsxs("p",{className:"lan-link-sub",children:[he&&_e,he&&_e&&De&&" · ",De&&($e?xe?i.jsx("code",{className:"ap-lan-code",children:ce}):i.jsx("span",{className:"lan-round","data-tone":$e.tone,children:$e.text.replace(/ · now$/," · just now")}):"not asked yet"),De&&ce&&!xe&&i.jsx("code",{className:"lan-fact-raw",children:ce})]}),Se.length>0&&i.jsx("ul",{className:"lan-done",children:Se.map(se=>i.jsxs("li",{"data-ok":se.ok,children:[se.email," ",i.jsx("span",{className:"lan-done-what",children:se.ok?"arrived":"did not arrive"})]},`${se.email}:${se.action}`))}),(q==null?void 0:q.waiting)&&i.jsx("p",{className:"lan-note lan-link-note",children:e.hint})]}),Je.length>0&&i.jsx("ul",{className:"lan-lanes",role:"list","aria-label":`Logins between this deck and ${e.name}`,children:Je.map((se,Ce)=>{const Ve=ye.get(se.email),gt=se.out==="live"||se.in!=null&&se.in!=="cut";return i.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":se.tone,"data-draw":se.in&&se.out?"both":se.in?"in":"out",style:{"--i":Ce},children:[i.jsx("i",{className:"lan-pip","data-end":"here","data-state":se.here,"aria-hidden":!0}),i.jsxs("span",{className:"lan-track",children:[i.jsxs("span",{className:"lan-wire","data-flow":gt?"live":"cut","aria-hidden":!0,children:[(se.in==="live"||se.in==="wait")&&i.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":se.in}),se.out==="live"&&i.jsx("i",{className:"lan-glint","data-dir":"out"})]}),se.in&&se.in!=="cut"&&i.jsx(Ou,{dir:"in",gate:se.in==="blocked"}),se.out==="live"&&i.jsx(Ou,{dir:"out"}),i.jsx("span",{className:"lan-lane-email",children:se.email})]}),i.jsx("i",{className:"lan-pip","data-end":"there","data-state":se.there,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:rq(se)}),(se.caption||Ve)&&i.jsxs("span",{className:"lan-lane-note",children:[se.caption,se.caption&&Ve&&" · ",Ve&&i.jsx("span",{className:"lan-lane-done","data-ok":Ve.ok,children:Ve.ok?"arrived last round":"did not arrive last round"})]})]},se.key)})},$),L&&i.jsxs(i.Fragment,{children:[Ze.length>0&&i.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",Ze.length===1?Ze[0].email:"the expired ones"," until you sign in again here."]}),Pe&&i.jsx("p",{className:"lan-empty",children:Pe}),et&&i.jsxs("p",{className:"lan-stale",children:["As of ",et==="now"?"just now":et,", when it last answered."]}),i.jsxs("div",{className:"lan-legend",children:[Qe&&i.jsxs("span",{className:"lan-key",children:[i.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:i.jsx(Ou,{dir:"in"})}),"from ",e.name]}),fe?i.jsxs("span",{className:"lan-key",children:[i.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:i.jsx(Ou,{dir:"out"})}),"from this deck, to every paired deck"]}):i.jsx("span",{className:"lan-key",children:"This deck offers nothing yet."}),i.jsx("button",{type:"button",className:"ap-lan-word lan-legend-act",onClick:f,"aria-label":"Change what this deck offers",children:"change"})]})]})]}),i.jsx("dl",{className:"lan-facts",children:ft.map(se=>i.jsxs("div",{className:"lan-fact","data-tone":se.tone,children:[i.jsx("dt",{children:se.label}),i.jsx("dd",{children:se.value})]},se.label))}),dt.length>1&&i.jsxs("div",{className:"modal-section",children:[i.jsxs("h3",{className:"lan-h",children:[dt.length," decks on this machine"]}),i.jsx("ul",{className:"lan-twins",role:"list",children:dt.map((se,Ce)=>{var pt,wt,Yt,Fr;const Ve=(pt=se.peer)!=null&&pt.addr?`${se.peer.addr}:${se.peer.port}`:se.row.addr,gt=Ve||se.row.fp,xt=(wt=se.peer)!=null&&wt.pairedAt?Lr(se.peer.pairedAt,a):null,Te=[(Fr=(Yt=se.peer)==null?void 0:Yt.about)!=null&&Fr.version?`runs ${se.peer.about.version}`:null,xt?`paired ${xt==="now"?"just now":xt}`:null,se.row.state].filter(Boolean).join(" · "),tt=se.row.fp;return i.jsxs("li",{role:"listitem",className:"lan-twin","data-tone":se.row.tone,children:[i.jsx("i",{className:se.row.here?"ap-pulse":"ap-dot","aria-hidden":!0}),Ve?i.jsx("code",{className:"ap-lan-code lan-twin-at",children:Ve}):i.jsx("span",{className:"lan-twin-at lan-twin-none",children:"no address here"}),i.jsx("code",{className:"ap-lan-code lan-twin-fp",children:tt}),Ce>0&&y&&i.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${R===tt?" armed":""}`,...X(`unpair:${tt}`),onKeyDown:Qn=>{Qn.repeat&&Qn.preventDefault()},onClick:()=>{if(R!==tt){A(tt),T.current=Date.now();return}Date.now()-T.current<zv||(A(null),G(()=>y(tt)))},"aria-label":R===tt?`Confirm unpairing ${gt}`:`Unpair ${gt}`,title:R===tt?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this one of the machine's decks",children:l===`unpair:${tt}`?"unpairing…":R===tt?"sure?":"unpair"}),i.jsx("span",{className:"lan-twin-meta",children:Ce===0?`${Te} · shown above`:Te})]},tt)})})]})]}),i.jsxs("footer",{className:"lan-peer-foot",children:[e.kind==="asks"&&i.jsx("p",{className:"lan-foot-note",children:"This deck is now asking to pair. Answer it from the panel behind this."}),L&&!(q!=null&&q.waiting)&&i.jsx("button",{type:"button",className:"btn",...X(`check:${e.fp}`),onClick:()=>void G(h).then(se=>{se&&J.current&&B(Ce=>Ce+1)}),title:"Ask this deck now instead of waiting for the next round",children:l===`check:${e.fp}`?"Checking…":"Check now"}),e.kind==="paired"&&i.jsx("button",{type:"button",className:`btn danger lan-peer-verb${E?" armed":""}`,...X(`unpair:${e.fp}`),onKeyDown:se=>{se.repeat&&se.preventDefault()},onClick:()=>{if(!E){C(!0),T.current=Date.now();return}Date.now()-T.current<zv||(C(!1),G(p))},"aria-label":E?`Confirm unpairing ${e.name}`:`Unpair ${e.name}`,title:E?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:l===`unpair:${e.fp}`?"Unpairing…":E?"Unpair — sure?":"Unpair"}),e.kind==="nearby"&&i.jsx("button",{type:"button",className:"btn primary lan-peer-verb",...X(`accept:${e.fp}`),onClick:()=>void G(p),title:"Send it a request. Somebody at that machine has to accept it before anything is shared.",children:l===`accept:${e.fp}`?"Asking…":"Ask to pair"}),e.kind==="dialling"&&i.jsx("button",{type:"button",className:"btn lan-peer-verb",...X(`drop:${e.fp}`),onClick:()=>void G(p),title:"Stop trying this address. Nothing was ever paired here.",children:l===`drop:${e.fp}`?"Stopping…":"Stop dialling"}),e.kind==="declined"&&i.jsx("button",{type:"button",className:"btn lan-peer-verb",...X(`allow:${e.fp}`),onClick:()=>void G(p),title:"Take the no back. That deck is still trying, so its request comes round again on its own.",children:l===`allow:${e.fp}`?"Allowing…":"Let it ask again"})]})]})}),document.body)}function aq({status:e,accounts:t,onClose:n,onChanged:s}){const a=Vt(n),[l,c]=x.useState(null),[d,h]=x.useState(null),[p,f]=x.useState(null),m=x.useRef(null),y=C=>{const T=Ys(p,C);return{disabled:T.disabled,"aria-busy":T.busy}},v=x.useRef(null),N=x.useRef(!0);x.useEffect(()=>()=>{N.current=!1},[]),x.useEffect(()=>{v.current&&uq(v.current,e.shared??[])&&(v.current=null)},[e.shared]);const _=x.useCallback(async(C,T,R="write")=>{m.current=R,f(R);try{const D=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:C})})).json().catch(()=>null);return N.current?(D!=null&&D.ok?h(null):h(Dt(T,D)),s(),(D==null?void 0:D.ok)===!0):!1}catch{return N.current&&h(Dt(T,null)),!1}finally{m.current=null,N.current&&f(null)}},[s]),S=x.useCallback(async()=>{if(l!=null&&l!==(e.name??"")){if(!await _({name:l},"save the name","name"))return;N.current&&c(null)}n()},[l,e.name,_,n]),k=new Set(v.current??e.shared??[]),j=e.autoAsk!==!1,E=e.autoAccept!==!1;return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:a,className:"modal lan-modal",onClick:C=>C.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[d&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",children:d}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>h(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"Name"}),i.jsxs("div",{className:"ap-lan-row",children:[i.jsx("span",{className:"ap-lan-label",children:"appear as"}),i.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:l??e.name??"",placeholder:"this machine",onChange:C=>c(C.target.value),onKeyDown:C=>{C.key!=="Enter"||l==null||(_({name:l},"save the name","name"),c(null))}}),l!=null&&l!==(e.name??"")&&i.jsx("button",{type:"button",className:"ap-manage-btn",...y("name"),onClick:()=>{_({name:l},"save the name","name"),c(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"Share these accounts"}),i.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&i.jsx("span",{className:"ap-lan-empty",children:"No Claude accounts on this deck yet — add one with + at the top of this panel."}),t.map(C=>i.jsxs("label",{className:"ap-lan-pick",title:C.alive?"Offer this account to the decks you have paired with, so one whose copy has died can heal from yours. Unticking stops it being offered from now on; it does not take back a copy somebody already has.":"This deck cannot use this login, so it has nothing to offer — a deck that can will heal it",children:[i.jsx("input",{type:"checkbox",checked:k.has(C.key),onChange:T=>{const R=new Set(v.current??e.shared??[]);T.target.checked?R.add(C.key):R.delete(C.key),v.current=[...R],_({shared:[...R]},T.target.checked?"share that account":"stop sharing that account")}}),i.jsx("span",{className:"ap-lan-pick-name",children:C.email}),!C.alive&&i.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},C.key))]})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"Pairing"}),i.jsxs("div",{className:"lan-switches",children:[i.jsxs("div",{className:"lan-switch",children:[i.jsx("span",{className:"lan-switch-what",children:"Ask every deck this one finds"}),i.jsx("button",{type:"button",className:`ap-auto-state${j?" live":""}`,role:"switch","aria-checked":j,"aria-label":"Ask every deck this one finds",...y("ask"),onClick:()=>void _({autoAsk:!j},j?"stop asking automatically":"ask every deck this one finds","ask"),title:j?"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."})]}),i.jsxs("div",{className:"lan-switch",children:[i.jsx("span",{className:"lan-switch-what",children:"Say yes to every deck that asks"}),i.jsx("button",{type:"button",className:`ap-auto-state${E?" live":""}`,role:"switch","aria-checked":E,"aria-label":"Say yes to every deck that asks",...y("accept"),onClick:()=>void _({autoAccept:!E},E?"stop accepting automatically":"accept every deck that asks","accept"),title:E?"Stop saying yes for you. A deck that asks waits in the panel again.":"Say yes for you. Every deck on this network that asks is paired without anybody being asked here."})]})]}),E?null:j?i.jsx("p",{className:"lan-note",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."}):i.jsxs("p",{className:"lan-note",children:["Nothing pairs on its own. You press ",i.jsx("strong",{children:"ask"})," on a deck you find, and ",i.jsx("strong",{children:"accept"})," on one that asks. A deck you said no to is never asked about again either way."]})]})]}),i.jsxs("footer",{className:"lan-setup-foot",children:[i.jsx("span",{className:"lan-foot-note",children:"Changes are saved as you make them."}),i.jsx("button",{type:"button",className:"btn primary",...y("name"),onClick:()=>void S(),children:"Done"})]})]})}),document.body)}function Lr(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 Cx={"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"}},oq={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 iq(e){var s;const t=lq[e];if(t)return t;const n=(s=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:s[1];return n&&oq[n]||e}const lq={"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 W2(e,t){if(!e)return null;if(e.error)return Cx[e.error]??{text:iq(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${Lr(e.at,t)}`,tone:"idle"};const s=n.filter(l=>l.ok),a=s.length===1?"login":"logins";return s.length===n.length?{text:`${s.length} ${a} arrived · ${Lr(e.at,t)}`,tone:"ok"}:{text:`${s.length} of ${n.length} logins arrived · ${Lr(e.at,t)}`,tone:"bad"}}const Bv=5e3,H2=6e4,zv=400;function cq(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 Dt(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 uq(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function dq(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function G2(e,t){var n,s;return(n=e.last)!=null&&n.error&&!Cx[e.last.error]?!1:!!((s=e.last)!=null&&s.at&&t-e.last.at<pd||e.lastSeen!=null&&t-e.lastSeen<pd)}const pd=95e3;function hq(e,t){const n=[],s=[];for(const a of e??[])(G2(a,t)?n:s).push(a);return{online:n,offline:s}}function fq(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(v=>v.paired!==!1||v.met);if(!s.length)return{text:"no deck paired yet",tone:"idle"};const a=s.filter(v=>v.waiting),l=s.filter(v=>!v.waiting),c=a.filter(v=>{var N;return!((N=v.last)!=null&&N.error)&&v.lastSeen!=null&&t-v.lastSeen<pd}),{online:d,offline:h}=hq(l,t),p=[...h,...a.filter(v=>!c.includes(v))],f=d.length+c.length,m=d.filter(v=>{var N;return((N=v.last)==null?void 0:N.error)==="waiting for the other deck to accept this one"});if(f&&m.length===f)return{text:f===1?"1 deck found · waiting for them to accept":`${f} decks found · waiting for them to accept`,tone:"wait"};if(!f)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=f===1?"1 deck ready":`${f} decks ready`;return{text:p.length?`${y} · ${p.length} away`:y,tone:"ok"}}function pq(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const s=Lr(e,t);return s==="now"?"checked just now":`checked ${s}`}function Tx(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 mq(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<pd;return{text:n?"online · one-way, it calls in":`one-way · last online ${Lr(e,t)}`,here:n}}function P1(e,t,n){return t?"online":e.lastSeen!=null?`last online ${Lr(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function gq(e,t){var y,v,N,_,S;if(!e)return[];const n=[],s=new Set,a=(k,j)=>k.name.localeCompare(j.name,void 0,{numeric:!0}),l=e.aliases??{},c=(k,j)=>{const E=k?l[k]:void 0;return E&&E!==j?{name:E,self:j}:{name:j}};for(const k of e.pending??[]){if(!(k!=null&&k.fp)||s.has(k.fp))continue;s.add(k.fp);const j=c(k.fp,k.name||k.fp);n.push({fp:k.fp,name:j.name,...j.self?{self:j.self}:{},addr:k.addr??"",kind:"asks",state:`wants to pair · ${Tx(k.at,t)}`,tone:"wait",here:!0,hint:`${j.name} at ${k.addr} is waiting for an answer.`})}const d=[],h=[];for(const k of e.peers??[]){const j=k.peerFp??k.fp;if(!j||s.has(j))continue;s.add(j);const E=W2(k.last,t),C=G2(k,t),T=k.addr?`${k.addr}:${k.port}`:"";if(!k.paired&&k.manual&&!k.met){h.push({fp:T,name:T||k.name||j,addr:k.addr??"",kind:"dialling",state:E?E.text.replace(/ · .*$/,""):"trying…",tone:E?E.tone:"idle",here:!1,hint:(y=k.last)!=null&&y.error?`Nothing has answered at ${T} yet — ${k.last.error}.`:`Dialling ${T} until something answers.`});continue}const R=k.waiting?mq(k.lastSeen,t):null,A=R?R.here:C,D=!R&&E?A?`online · ${E.text.replace(/ · .*$/,"")}`:`${E.text.replace(/ · .*$/,"")} · ${P1(k,A,t)}`:R?R.text:P1(k,A,t),O=(v=k.last)!=null&&v.error?Cx[k.last.error]:null,$=!R&&A&&!((N=k.last)!=null&&N.error)&&!(((_=k.last)==null?void 0:_.done)??[]).length,B=k.manual&&!k.met?{name:T}:c(j,k.name||j);d.push({fp:j,name:B.name,...B.self?{self:B.self}:{},addr:k.addr??"",kind:"paired",state:D,quiet:$,tone:O?O.tone==="bad"?"bad":"wait":E?E.tone:A?"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 ${Lr(k.lastSeen,t)}.`} Add its address with the + at the top of this section to reach it either way.`:`${B.name}${T?` at ${T}`:""}${(S=k.last)!=null&&S.error?` — ${k.last.error}`:""}`})}n.push(...yq(d).sort(a),...h.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 j=c(k.fp,k.name||k.fp);p.push({fp:k.fp,name:j.name,...j.self?{self:j.self}:{},addr:k.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:`${j.name} at ${k.addr} is on this network and nothing is shared with it.`})}n.push(...p.sort(a));const f=[];for(const k of e.declined??[]){if(!(k!=null&&k.fp)||s.has(k.fp))continue;s.add(k.fp);const j=c(k.fp,k.name||k.fp);f.push({fp:k.fp,name:j.name,...j.self?{self:j.self}:{},addr:k.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${j.name} asked and was turned away. It is not asking any more.`})}n.push(...f.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 yq(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(l=>l.addr).map(l=>l.addr))];if(a.length>1){for(const l of a)n.push(L1(s.filter(c=>c.addr===l)));n.push(...s.filter(l=>!l.addr))}else n.push(L1(s))}return n}function L1(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 D1(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function q1(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 wq(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 l=Number(n[a])-Number(s[a]);if(l)return Math.sign(l)}return 0}function vq(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 xq(e,t,n){const s=new Map(t.map(d=>[d.key,d])),a=new Set(n),l=[],c=new Set;for(const d of e??[]){if(c.has(d.key))continue;c.add(d.key);const h=s.get(d.key)??null,p=a.has(d.key),f=vq(d,h,p),m=h?h.alive?"works":"expired":"missing",y=!d.alive&&h&&!h.alive?f.note:[m==="works"?null:f.here,d.alive?null:f.there,f.note].filter(Boolean).join(" · ")||null;l.push({key:d.key,email:d.email,here:m,there:d.alive?"works":"broken",in:d.alive?f.tone==="wait"?"wait":f.tone==="bad"?"blocked":"live":"cut",out:p&&h?h.alive?"live":"cut":null,caption:y,tone:f.tone})}for(const d of n){const h=s.get(d);!h||c.has(d)||(c.add(d),l.push({key:d,email:h.email,here:h.alive?"works":"expired",there:"unknown",in:null,out:h.alive?"live":"cut",caption:h.alive?null:"expired here",tone:h.alive?"ok":"bad"}))}return l}async function Xo(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function bq({accounts:e,onChanged:t}){const[n,s]=x.useState(null),[a,l]=x.useState([]),[c,d]=x.useState(null),[h,p]=x.useState(!1),[f,m]=x.useState(null),y=x.useRef(0),[v,N]=x.useState(!1),[_,S]=x.useState(!1),[k,j]=x.useState(!1),[E,C]=x.useState(null),T=x.useRef(null),R=x.useCallback(ce=>Td(T.current)?(T.current=ce,d(ce),!0):!1,[]),A=x.useCallback(()=>{T.current=null,B.current&&d(null)},[]),D=ce=>{const we=Ys(c,ce);return{disabled:we.disabled,"aria-busy":we.busy}},[O,$]=x.useState(()=>Date.now()),B=x.useRef(!0),Z=x.useRef(Bv),J=x.useCallback(async()=>{var ce,we;try{const[xe,De]=await Promise.all([fetch("/api/lan").then(_e=>_e.json()),fetch("/api/prefs").then(_e=>_e.json())]);if(!B.current)return;xe!=null&&xe.ok&&s(xe),De!=null&&De.ok&&l(Array.isArray((we=(ce=De.prefs)==null?void 0:ce.lan)==null?void 0:we.manual)?De.prefs.lan.manual:[]),Z.current=(xe==null?void 0:xe.enabled)===!0?Bv:H2}catch{}},[]);x.useEffect(()=>{B.current=!0;let ce=0;const we=async()=>{$(Date.now()),await J(),B.current&&(ce=window.setTimeout(we,Z.current))};return we(),()=>{B.current=!1,window.clearTimeout(ce)}},[J]);const I=x.useCallback(async()=>{const ce=(n==null?void 0:n.enabled)===!0;if(R("switch"))try{const we=await Xo("/api/prefs",{lan:{enabled:!ce}});if(!B.current)return;we!=null&&we.ok?(C(null),ce||p(!0)):C(Dt(ce?"turn this off":"turn this on",we)),await J()}catch{B.current&&C(Dt(ce?"turn this off":"turn this on",null))}finally{A()}},[n==null?void 0:n.enabled,J,R,A]),X=x.useCallback(async(ce,we,xe)=>{if(!R(`${ce}:${we}`))return null;let De=null;try{const _e=await Xo("/api/lan/peer",{action:ce,fp:we});if(!B.current)return null;_e!=null&&_e.ok?(s(_e),C(null)):(De=Dt(xe,_e),C(De)),await J()}catch{De=Dt(xe,null),B.current&&C(De)}finally{A()}return De},[J,R,A]),G=x.useCallback(async ce=>{if(!R(`drop:${ce}`))return null;let we=null;try{const xe=await Xo("/api/prefs",{lan:{manual:a.filter(De=>De!==ce)}});if(!B.current)return null;xe!=null&&xe.ok?(C(null),t()):(we=Dt("stop dialling that address",xe),C(we)),await J()}catch{we=Dt("stop dialling that address",null),B.current&&C(we)}finally{A()}return we},[a,J,t,R,A]),[q,Y]=x.useState(null),L=x.useCallback(async(ce,we)=>{if(!R(`alias:${ce}`))return"Something else is still being saved. Try again in a moment.";try{const xe=await Xo("/api/lan/peer",{action:"alias",fp:ce,name:we});return B.current?xe!=null&&xe.ok?(s(xe),null):Dt("rename that deck",xe):null}catch{return Dt("rename that deck",null)}finally{A()}},[R,A]),K=x.useCallback(async ce=>{if(!R(`check:${ce}`))return null;try{const we=await Xo("/api/lan/sync",{fp:ce});return B.current?we!=null&&we.ok?(s(we),t(),null):(we==null?void 0:we.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.":Dt("check that deck",we):null}catch{return Dt("check that deck",null)}finally{A()}},[R,A,t]),P=x.useCallback(async()=>{if(R("check"))try{const ce=await Xo("/api/lan/sync",{});if(!B.current)return;ce!=null&&ce.ok?(s(ce),C(null)):C(Dt("check the other decks",ce)),t()}catch{B.current&&C(Dt("check the other decks",null))}finally{A()}},[R,A,t]),V=(n==null?void 0:n.enabled)===!0,he=gq(n,O),z=q?he.find(ce=>{var we;return ce.fp===q||((we=ce.twins)==null?void 0:we.some(xe=>xe.fp===q))})??null:null;x.useEffect(()=>{q&&n&&!z&&Y(null)},[q,n,z]);const W=he.filter(ce=>ce.kind==="asks"),ee=he.filter(ce=>ce.kind!=="asks"),H=ee.filter(ce=>ce.here),ae=ee.filter(ce=>!ce.here),me=ae.filter(ce=>ce.tone==="bad").length,ge=k||H.length===0,Re=fq(n,O),$e=ee.filter(ce=>ce.kind==="paired").length;return i.jsxs("div",{className:"ap-auto ap-lan",children:[i.jsxs("div",{className:"ap-auto-head",children:[i.jsx("h3",{className:"ap-auto-title",children:"Local network"}),V&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>N(!0),"aria-label":"Add a deck",title:"Reach a deck that has not turned up on its own — by address, or with an invite",children:i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:i.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),V&&$e>0&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...D("check"),onClick:()=>void P(),"aria-label":c==="check"?"Checking every paired deck":"Check every paired deck now",title:"Ask every paired deck now for anything this deck's expired logins need, instead of waiting for the next round",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),i.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),V&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...D("setup"),onClick:()=>p(!0),"aria-label":"This deck's name and shared logins",title:"This deck's name on the network, and which of its logins it offers",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M1.8 4.7h10.4M1.8 9.3h10.4"}),i.jsx("circle",{cx:"9.1",cy:"4.7",r:"1.6",fill:"var(--panel)"}),i.jsx("circle",{cx:"4.9",cy:"9.3",r:"1.6",fill:"var(--panel)"})]})}),i.jsx("button",{type:"button",className:`ap-auto-state${V?" live":""}`,role:"switch","aria-checked":V,"aria-label":"Local network sync",...D("switch"),onClick:()=>void I(),title:V?"Stop talking to other decks. Nothing is shared while this is off.":"Let the decks you pair with repair this one's expired logins"})]}),!V&&i.jsxs("button",{type:"button",className:"ap-lan-intro",onClick:()=>S(!0),title:"Four pictures: what this does, and what to do on each machine",children:[i.jsx(V6,{}),i.jsx("span",{className:"ap-lan-intro-text",children:"Paired machines repair each other's expired logins."}),i.jsx("span",{className:"ap-lan-intro-go",children:"See how it works"})]}),i.jsx("p",{className:`ap-lan-status ${Re.tone}`,role:"status",children:Re.tone==="ok"?"":Re.text}),E&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",children:E}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>C(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),V&&i.jsxs(i.Fragment,{children:[W.length>0&&i.jsx("div",{className:"ap-lan-asks",role:"alert",children:W.map(ce=>i.jsxs("div",{className:"ap-lan-ask",children:[i.jsxs("span",{className:"ap-lan-ask-what",children:[i.jsx("strong",{className:"ap-lan-peer-name",children:ce.name})," at ",i.jsx("code",{className:"ap-lan-code",children:ce.addr})," wants to pair"]}),i.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",i.jsx("code",{className:"ap-lan-code",children:ce.fp})]}),i.jsxs("span",{className:"ap-lan-ask-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...D(`accept:${ce.fp}`),onClick:()=>void X("accept",ce.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${ce.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),i.jsx("button",{type:"button",className:"ap-manage-btn",...D(`dismiss:${ce.fp}`),onClick:()=>void X("dismiss",ce.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},ce.fp))}),(ge?[...H,...ae]:H).length>0&&i.jsx("ul",{className:"ap-lan-here",children:(ge?[...H,...ae]:H).map((ce,we)=>i.jsxs("li",{className:"ap-lan-who","data-tone":ce.tone,children:[i.jsx("i",{className:ce.here?"ap-pulse":"ap-dot","aria-hidden":!0}),i.jsx("span",{className:"ap-lan-who-name","aria-hidden":!0,children:ce.name}),i.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${we}`,onClick:()=>Y(ce.fp),children:i.jsxs("span",{className:"vis-hidden",children:[ce.name,", details"]})}),i.jsx("span",{id:`lan-who-state-${we}`,className:ce.quiet?"vis-hidden":"ap-lan-who-when",children:ce.state}),ce.kind==="nearby"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...D(`accept:${ce.fp}`),onClick:()=>void X("accept",ce.fp,"reach that deck"),"aria-label":`Ask ${ce.name} to pair`,title:`Send ${ce.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${ce.fp}.`,children:"ask"}),ce.kind==="paired"&&i.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${f===ce.fp?" armed":""}`,...D(`unpair:${ce.fp}`),onClick:()=>{if(f!==ce.fp){m(ce.fp),y.current=Date.now(),window.setTimeout(()=>m(xe=>xe===ce.fp?null:xe),4e3);return}Date.now()-y.current<zv||(m(null),X("unpair",ce.fp,"unpair that deck"))},"aria-label":f===ce.fp?`Confirm unpairing ${ce.name}`:`Unpair ${ce.name}`,title:f===ce.fp?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:f===ce.fp?"sure?":"unpair"}),ce.kind==="dialling"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...D(`drop:${ce.fp}`),onClick:()=>void G(ce.fp),"aria-label":`Stop dialling ${ce.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),ce.kind==="declined"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...D(`allow:${ce.fp}`),onClick:()=>void X("allow",ce.fp,"let that deck ask again"),"aria-label":`Let ${ce.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${ce.kind}:${ce.fp}`))}),(H.length>0&&ae.length>0||V&&$e>0)&&i.jsxs("div",{className:"ap-lan-tail",children:[H.length>0&&ae.length>0&&i.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":k,onClick:()=>j(ce=>!ce),title:k?"Show only the decks that are on":`Show the ${ae.length} deck${ae.length===1?"":"s"} that are not answering right now`,children:[i.jsx("span",{className:`ap-lan-chev${k?" open":""}`,"aria-hidden":!0,children:"›"}),k?"fewer":`${ae.length} more`,!k&&me>0&&i.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",me," not answering"]})]}),V&&$e>0&&i.jsx("span",{className:"ap-lan-checked",children:pq(n==null?void 0:n.checkedAt,O,c==="check")})]}),ee.length===0&&W.length===0&&i.jsxs(i.Fragment,{children:[i.jsxs("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, ",i.jsx("strong",{children:"+"})," at the top of this section reaches one by address or by invite."]}),i.jsx("button",{type:"button",className:"ap-lan-word ap-lan-how",onClick:()=>S(!0),children:"How it works"})]})]}),v&&n&&i.jsx(X6,{status:n,manual:a,onClose:()=>N(!1),onChanged:()=>{J(),t()}}),_&&i.jsx(z2,{title:"How Local network works",steps:G6,finish:V?void 0:{label:"Turn it on",act:()=>{S(!1),I()}},onClose:()=>S(!1)}),h&&n&&i.jsx(aq,{status:{...n,manualRows:a},accounts:e,manual:a,onClose:()=>p(!1),onChanged:()=>{J(),t()}}),z&&n&&i.jsx(sq,{row:z,source:q1(n,z),status:n,accounts:e,now:O,busy:c,onClose:()=>Y(null),onRename:ce=>L(z.fp,ce),onCheck:()=>K(z.fp),onVerb:()=>{switch(z.kind){case"paired":return X("unpair",z.fp,"unpair that deck");case"nearby":return X("accept",z.fp,"reach that deck");case"declined":return X("allow",z.fp,"let that deck ask again");case"dialling":return G(z.fp);default:return Promise.resolve(null)}},onSettings:()=>{Y(null),p(!0)},twins:(z.twins??[]).map(ce=>({row:ce,peer:q1(n,ce).peer??null})),onUnpair:ce=>X("unpair",ce,"unpair that deck")})]})}const F1=15e3,kq=8e3,Uf=1800,_q=3e4,Nq=[70,80,85,90,95];function B1(e,t){return R2(t-Math.floor(e/1e3))}function Sq(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 jq(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 Eq(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 z1(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 U1({lane:e,nowSec:t}){const n=Math.min(100,Math.max(0,e.pct)),s=n>=90?"var(--err)":n>=70?"var(--warn)":"var(--accent)",a=e.resetAt?M2(e.resetAt,t):null;return i.jsxs("div",{className:"ap-lane",children:[i.jsx("span",{className:"ap-lane-label",children:e.label}),i.jsx("div",{className:"ap-lane-track",children:i.jsx("div",{className:"ap-lane-fill",style:{width:`${n===0?1.5:n}%`,background:s,opacity:n===0?.4:1}})}),i.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[n,"%"]}),i.jsx("span",{className:"ap-lane-reset",children:a?`resets ${a}`:""})]})}async function W1(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 Cq({onClose:e,leaving:t}){var et,ft,dt,ze,Xe;const[n,s]=x.useState(null),[a,l]=x.useState(null),[c,d]=x.useState(null),[h,p]=x.useState(!1),[f,m]=x.useState(null),[y,v]=x.useState(()=>Math.floor(Date.now()/1e3)),N=x.useRef(null),[_,S]=x.useState(null),[k,j]=x.useState(!1),[E,C]=x.useState(""),[T,R]=x.useState(null),[A,D]=x.useState(null),[O,$]=x.useState(null),[B,Z]=x.useState(!1),[J,I]=x.useState(!1),[X,G]=x.useState(null),[q,Y]=x.useState(null),[L,K]=x.useState(null),[P,V]=x.useState(null),[he,z]=x.useState(!1),W=x.useRef(null),ee=x.useRef(null),[H,ae]=x.useState([]),me=x.useRef(null),ge=x.useCallback(re=>Td(me.current)?(me.current=re,d(re),!0):!1,[]),Re=x.useCallback(()=>{me.current=null,d(null)},[]),$e=(re,Fe=!1)=>{const se=Ys(c,re);return{disabled:se.disabled,"aria-busy":se.busy||Fe}},ce=x.useCallback(re=>{window.requestAnimationFrame(()=>{var Fe;if(V5(((Fe=document.activeElement)==null?void 0:Fe.tagName)??null))for(const se of G5(re)){const Ce=document.querySelector(se);if(Ce){Ce.focus();return}}})},[]),we=x.useCallback(async(re=!1)=>{re&&p(!0);const Fe=new AbortController,se=window.setTimeout(()=>Fe.abort(),_q);try{const[Ce,Ve]=await Promise.all([fetch(`/api/claude-accounts${re?"?refresh=1":""}`,{signal:Fe.signal}),fetch("/api/cswap-auto",{signal:Fe.signal})]);if(Ce.ok){const xt=await Ce.json();s(xt),ae(Te=>C6(Te,xt.accounts))}Ve.ok&&l(await Ve.json());const gt=M6([await C1(Ce),await C1(Ve)]);m(xt=>T1(xt,gt))}catch{m(Ce=>T1(Ce,R6))}finally{window.clearTimeout(se),re&&p(!1)}},[]),xe=x.useCallback(async(re,Fe)=>{if(!ge(Fe))return null;m(null);try{const Ce=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)})).json().catch(()=>null);return Ce!=null&&Ce.ok||m({text:Dv(Ce,"command failed"),raw:di(Ce)}),Ce}catch{return m({text:"server unreachable"}),null}finally{Re()}},[ge,Re]),De=x.useCallback(async(re,Fe)=>{if(!ge(Fe))return null;m(null);try{const Ce=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)})).json().catch(()=>null);return Ce!=null&&Ce.ok||m({text:ei(Ce,"command failed")}),Ce}catch{return m({text:"server unreachable"}),null}finally{Re()}},[ge,Re]);x.useEffect(()=>(we(!0),N.current=window.setInterval(()=>we(!1),F1),()=>{N.current!=null&&window.clearInterval(N.current)}),[we]),x.useEffect(()=>{const re=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(re)},[]);const _e=((et=a==null?void 0:a.settings["autoswitch.threshold"])==null?void 0:et.value)??"90",Ee=P??_e,Ge=_6(Ee,_e),st=(ft=n==null?void 0:n.accounts)==null?void 0:ft.find(re=>re.active),Je=((dt=E1((st==null?void 0:st.lanes)??[]).peak)==null?void 0:dt.pct)??null,Ze=Je!=null&&Je>=Number(_e)-15,Qe=async re=>{if(ge(`switch-${re}`)){m(null);try{const se=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:re})})).json().catch(()=>null);se!=null&&se.ok||m({text:Dv(se,"the switch failed"),raw:di(se)}),await we(!0)}catch{m({text:"server unreachable"})}finally{Re(),ce(re)}}},fe=async(re,Fe)=>{const{commit:se,alias:Ce}=A6(E,Fe);if(se){const Ve=await De({action:"alias",account:re,alias:Ce},`alias-${re}`);if(await we(!0),!(Ve!=null&&Ve.ok))return;C(Ce)}R(re),window.setTimeout(()=>R(Ve=>Ve===re?null:Ve),Uf)},ye=async(re,Fe)=>{const se=await De({action:"move",account:re,slot:Fe},`move-${re}`),Ce=x6({menuFor:_,shareFor:(O==null?void 0:O.num)??null},re,se);if(await we(!0),Ce){S(Ce.menuFor),D(Ce.confirmRemove),Ce.shareFor==null&&($(null),I(!1)),G(Ce.swapNote);const Ve=Ce.swapNote;Ve&&window.setTimeout(()=>G(gt=>gt===Ve?null:gt),kq),Y(null),ce(Ce.menuFor)}return se},Se=async(re,Fe,se)=>{if(se.sends){const Ce=await ye(re,Fe);if(!(Ce!=null&&Ce.ok))return}K(re),window.setTimeout(()=>K(Ce=>Ce===re?null:Ce),Uf)},Pe=async(re,Fe)=>{if(Fe.sends){const se=await xe({action:"setting",key:"autoswitch.threshold",value:re},"threshold");if(await we(!0),!(se!=null&&se.ok))return;V(null)}z(!0),window.setTimeout(()=>{var se;document.activeElement===ee.current&&((se=W.current)==null||se.focus()),z(!1)},Uf)};return i.jsxs("aside",{className:`accounts-panel${t?" leaving":""}`,id:"accounts-panel","aria-label":"Claude accounts",children:[i.jsxs("div",{className:"ap-header",children:[i.jsx("h2",{children:"Claude accounts"}),i.jsxs("div",{className:"ap-header-right",children:[i.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>j(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:i.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),(((ze=n==null?void 0:n.accounts)==null?void 0:ze.length)??0)>0&&i.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>Z(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${Gt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M3.3 10.7L10.7 3.3"}),i.jsx("path",{d:"M5.5 3.3h5.2v5.2"})]})}),i.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>we(!0),...$e("reload",h),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),i.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),i.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:i.jsx("path",{d:"M3.4 3.4l7.2 7.2M10.6 3.4l-7.2 7.2"})})})]})]}),n==null?f?i.jsxs("div",{className:"ap-empty",role:"alert",children:[i.jsx("span",{title:f.raw||void 0,children:f.text}),i.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",F1/1e3," seconds."]}),i.jsx("button",{type:"button",className:"ap-fix",disabled:h,onClick:()=>we(!0),children:h?"trying…":"try again"})]}):i.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?i.jsxs(i.Fragment,{children:[i.jsx("ul",{className:"ap-list",children:(Xe=n.accounts)==null?void 0:Xe.map(re=>{const{shown:Fe,rest:se,fuller:Ce,peak:Ve}=E1(re.lanes),gt=H.includes(Sx(re)),xt=N6(se.length,gt,Ce);return i.jsxs("li",{className:`ap-account${re.active?" active":""}`,children:[i.jsxs("div",{className:"ap-account-head",children:[i.jsx("span",{className:"ap-num",children:re.num}),re.alias&&i.jsx("span",{className:"ap-alias",title:re.alias,children:re.alias}),i.jsx("span",{className:"ap-email",title:re.email??void 0,children:re.email}),i.jsx("button",{type:"button",id:`ap-more-${re.num}`,className:`ap-more${_===re.num?" on":""}`,"aria-label":`Manage account ${re.num}`,"aria-expanded":_===re.num,"aria-controls":_===re.num?`ap-manage-${re.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{S(_===re.num?null:re.num),C(re.alias??""),D(null),$(null),I(!1),G(null),R(null),Y(null),K(null)},children:"⋯"}),re.active&&i.jsx("span",{className:"ap-badge-active",children:"active"}),re.disabled&&i.jsx("span",{className:"ap-badge-held",children:"held out"}),!re.active&&!re.disabled&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...$e(`switch-${re.num}`),onClick:()=>Qe(re.num),title:`Switch to ${re.alias??re.email}`,children:c===`switch-${re.num}`?"…":"switch"})]}),i.jsx("div",{className:"ap-lanes",id:`ap-lanes-${re.num}`,children:Fe.length?i.jsxs(i.Fragment,{children:[Fe.map(Te=>i.jsx(U1,{lane:Te,nowSec:y},Te.id)),gt&&se.map(Te=>i.jsx(U1,{lane:Te,nowSec:y},Te.id))]}):i.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),i.jsxs("div",{className:"ap-meta",children:[re.staleCopy&&(()=>{const Te=jq(re.repair??null,y);return i.jsx("span",{className:"ap-stale-copy",title:Te.hint,children:Te.text})})(),re.stopped&&(()=>{const Te=z1(re.collector??null);return i.jsx("span",{className:"ap-stopped",title:(Te==null?void 0:Te.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.",children:(Te==null?void 0:Te.text)??"not collecting"})})(),re.stopped&&(()=>{var tt;const Te=(tt=z1(re.collector??null))==null?void 0:tt.fix;return Te?i.jsx("button",{type:"button",className:"ap-fix",onClick:()=>j(!0),title:"Open the sign-in dialog. Signing in as this account puts its login in this slot.",children:Te}):null})(),re.error&&(()=>{const Te=Eq(re.error);return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"ap-err",title:Te.hint,children:Te.text}),Te.fixable&&i.jsx("button",{type:"button",className:"ap-fix",onClick:()=>j(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),xt&&i.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":gt,"aria-controls":`ap-lanes-${re.num}`,title:S6(re.headroom,(Ve==null?void 0:Ve.label)??null,se.length,gt),onClick:()=>ae(Te=>E6(Te,re)),children:xt}),(((a==null?void 0:a.enabled)||(a==null?void 0:a.external))&&!re.active||re.disabled)&&i.jsx("button",{type:"button",className:"ap-rotate",...$e(`rot-${re.num}`),onClick:()=>xe({action:"account",account:re.num,enabled:re.disabled},`rot-${re.num}`).then(()=>we(!0)),title:re.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:re.disabled?"put back":"hold out"}),re.fetchedAt?i.jsxs("span",{className:`ap-age${re.stale&&!re.stopped&&!re.error?" 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 ",B1(re.fetchedAt,y),Sq(re.nextAt,y)]}):i.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),_===re.num&&i.jsxs("div",{className:"ap-manage",id:`ap-manage-${re.num}`,role:"group","aria-label":`Manage account ${re.num}`,children:[i.jsxs("div",{className:"ap-manage-name",children:[i.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${re.num}`,children:"Alias"}),i.jsx("input",{id:`ap-alias-${re.num}`,className:"ap-manage-input",type:"text",value:E,onChange:Te=>C(Te.target.value),onKeyDown:Te=>{Te.key==="Enter"&&fe(re.num,re.alias)},maxLength:T6,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),i.jsx("button",{type:"button",className:"ap-manage-btn",...$e(`alias-${re.num}`),onClick:()=>fe(re.num,re.alias),title:"A short name to show instead of the email",children:T===re.num?"saved":"save"})]}),(()=>{const Te=v6((n.accounts??[]).map(wt=>wt.num),re.num),tt=b6(Te,q,re.num),pt=k6(Te,tt,re.num);return i.jsxs("div",{className:"ap-manage-slot",children:[i.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${re.num}`,children:"Slot"}),i.jsx("span",{className:"ap-field",children:i.jsx("select",{id:`ap-slot-${re.num}`,value:String(tt),...$e(`move-${re.num}`),onChange:wt=>Y(Number(wt.target.value)),children:Te.map(wt=>i.jsx("option",{value:wt.slot,children:wt.label},wt.slot))})}),i.jsx("button",{type:"button",className:"ap-manage-btn",...$e(`move-${re.num}`),title:pt.title,onClick:()=>Se(re.num,tt,pt),children:L===re.num?pt.done:pt.label})]})})(),i.jsxs("div",{className:"ap-manage-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...$e(`share-${re.num}`),title:`Copy this account to another ${Gt}. 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:async()=>{I(!1);const Te=await De({action:"share",account:re.num},`share-${re.num}`);Te!=null&&Te.ok&&$({num:re.num,blob:Te.blob,expiresAt:Te.expiresAt})},children:"share"}),i.jsx("button",{type:"button",className:`ap-manage-btn danger${A===re.num?" armed":""}`,...$e(`rm-${re.num}`),title:A===re.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(A!==re.num){D(re.num),window.setTimeout(()=>D(Te=>Te===re.num?null:Te),4e3);return}D(null),De({action:"remove",account:re.num},`rm-${re.num}`).then(()=>{S(null),we(!0),ce(null)})},children:A===re.num?"confirm":"remove"})]}),(X==null?void 0:X.at)===re.num&&(()=>{var pt;const Te=(pt=n.accounts)==null?void 0:pt.find(wt=>wt.num===X.displaced),tt=(Te==null?void 0:Te.alias)??(Te==null?void 0:Te.email)??"the account that was there";return i.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${X.at} was taken, so the two accounts traded places: ${tt} now holds slot ${X.displaced}.`,children:["swapped with slot ",X.displaced]})})(),(O==null?void 0:O.num)===re.num&&(()=>{const Te=B2(O.expiresAt,y),tt=Te.tone==="gone";return i.jsxs("div",{className:`ap-share${tt?" expired":""}`,children:[i.jsx("code",{className:"ap-share-blob",children:O.blob}),i.jsxs("div",{className:"ap-share-foot",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...$e(`share-${re.num}`),onClick:async()=>{if(tt){I(!1);const pt=await De({action:"share",account:re.num},`share-${re.num}`);pt!=null&&pt.ok&&$({num:re.num,blob:pt.blob,expiresAt:pt.expiresAt});return}await W1(O.blob)&&(I(!0),window.setTimeout(()=>I(!1),1800))},children:tt?"make a new share":J?"copied":"copy"}),i.jsxs("span",{className:"ap-manage-hint",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[i.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",i.jsx("span",{className:`ap-share-expiry ${Te.tone}`,children:Te.text})]})]})]})})()]})]},re.num)})}),i.jsx("p",{className:"ap-footnote",title:"Anthropic's usage endpoint allows roughly 28–30 requests per hour per account, shared by every tool on this machine — polling it from here would rate-limit your account. So the deck never fetches: it asks claude-swap to collect while this panel is open, at most once every three minutes, and claude-swap decides whether that touches the network at all.",children:"These numbers only update while this panel is open."}),(a==null?void 0:a.ok)&&i.jsxs("div",{className:"ap-auto",children:[i.jsxs("div",{className:"ap-auto-head",children:[i.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),i.jsx("button",{type:"button",className:`ap-auto-state${a.enabled?" live":""}`,role:"switch","aria-checked":a.enabled,"aria-label":"Auto-switch",...$e("enable"),onClick:()=>xe({action:"enable",enabled:!a.enabled},"enable").then(()=>we(!0)),title:a.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit"})]}),i.jsxs("div",{className:"ap-auto-ctl",children:[Je!=null&&i.jsxs("span",{className:`ap-auto-now${Ze?" near":""}`,title:`The active account has used ${Math.round(Je)}% of its limit. Auto-switch trips at ${_e}%.`,children:[Math.round(Je),"%"]}),i.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:i.jsx("select",{ref:W,"aria-label":"Switch threshold",value:Ee,...$e("threshold"),onChange:re=>V(re.target.value),children:Nq.map(re=>i.jsxs("option",{value:re,children:[re,"%"]},re))})}),(Ge.sends||he)&&i.jsx("button",{ref:ee,type:"button",className:"ap-manage-btn",...$e("threshold"),title:Ge.title,onClick:()=>Pe(Ee,Ge),children:he&&!Ge.sends?Ge.done:Ge.label})]}),a.external&&i.jsxs("p",{className:"ap-auto-note",children:[i.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",i.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",a.enabled?" — this toggle takes over when you stop it.":"."]}),a.lastTick&&i.jsx("div",{className:"ap-auto-foot",children:i.jsxs("span",{className:"ap-auto-result",children:["checked ",B1(a.lastTick.at,y)]})})]}),f&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",title:f.raw||void 0,children:f.text}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),i.jsx(bq,{accounts:((n==null?void 0:n.accounts)??[]).map(re=>({key:`${String(re.email??"").trim().toLowerCase()}@@${re.orgUuid??""}`,email:re.email??"",alive:re.alive===!0})),onChanged:()=>we(!0)})]}):i.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"claude-swap isn't installed."}),i.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),n.hint&&i.jsx("code",{className:"ap-cmd",children:n.hint}),i.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",i.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"No accounts added yet."}),i.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",i.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"Couldn't read the account store."}),i.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})}),k&&i.jsx(m6,{onClose:()=>j(!1),onChanged:()=>we(!0)}),B&&i.jsx(w6,{accounts:((n==null?void 0:n.accounts)??[]).map(re=>({num:re.num,email:re.email,alias:re.alias,org:re.org})),onClose:()=>Z(!1),copyText:W1})]})}const Tq=3e4;function Aq({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function Rq({bundle:e,running:t,pending:n,lastTried:s}){return t?Aq({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function Mq(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function Iq({asked:e,reported:t}){return t?t!==e:!1}function V2(e){const t=e.thresholdMs??Tq;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 $q(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 Oq(e,t){return e?t==null?"auto when idle":`auto in ${$q(t)}`:"auto-restart off"}function H1(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function Pq(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 Lq(e){const t=V2(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}}async function Y2(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}function Dq(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function qq(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 Fq(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function Bq(e,t){const n=Fq(e),s=n?`removes ${n} on the canvas`:null,a=d=>`This ${s?`${s} and ${d}`:d}`;if(!t)return{note:`${a("deletes 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. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.path)return{note:`${a("leaves nothing on disk — this deck keeps no event log")}. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.mine){const d=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,h=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${a(`leaves the event log alone: ${d}${h}`)}. Clearing here empties this canvas only — restart this deck and the log replays back onto it. Layout, pins and selection go with it.`,confirm:"Clear this canvas"}}if(t.decks<=1)return{note:`${a("deletes this deck's event log")} — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};const l=t.decks-1,c=l===1?"That deck keeps what is on its canvas until it restarts, and then it is gone there too.":"Those decks keep what is on their canvases until they restart, and then it is gone there too.";return{note:`${a(`deletes the event log ${l===1?"1 other running deck shares":`${l} other running decks share`} with this one`)} — every session recorded in it, not just the ones drawn here. ${c} This cannot be undone.`,confirm:"Clear everything"}}function zq({agentCount:e,onConfirm:t,onCancel:n}){const s=x.useRef(null),a=Vt(n,{focusRef:s,layer:s4}),[l,c]=x.useState(null);x.useEffect(()=>{let p=!1;return fetch("/api/clear").then(f=>f.ok?f.json():null).then(f=>{p||c(qq(f))}).catch(()=>{}),()=>{p=!0}},[]);const{note:d,confirm:h}=Bq(e,l);return i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{className:"status-dot err","aria-hidden":!0}),i.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsx("p",{className:"modal-note",children:d}),i.jsxs("div",{className:"cc-actions",children:[i.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),i.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const Uq="One-key shortcuts run when nothing on the page has focus. A focused control keeps its own keys — this sheet included, which takes the keyboard while it is open — so Esc is the way back to the canvas.",Wq=[{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:"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:"?",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 Hq({onClose:e,onTour:t}){const n=Vt(e);return i.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:i.jsxs("div",{ref:n,className:"modal key-help",onClick:s=>s.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsx("p",{className:"modal-note",children:Uq}),t&&i.jsxs("div",{className:"guide-door",children:[i.jsx("span",{children:"Eight pictures of what the deck shows."}),i.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),i.jsx("div",{className:"shortcuts",children:Wq.map(s=>i.jsxs(x.Fragment,{children:[i.jsx("h3",{className:"kh-group",children:s.title}),s.rows.map(a=>i.jsxs("div",{className:"sc",children:[i.jsx("kbd",{children:a.cap}),i.jsx("span",{children:a.action})]},`${s.title}:${a.cap}:${a.action}`))]},s.title))})]})]})})}const Gq=["done","needs-input"],Vq=[{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}]}],Yq=[{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}]}],Ax={done:Vq,"needs-input":Yq},hi="two";function Uv(e,t){const n=Ax[e];return n.find(s=>s.id===t)??n.find(s=>s.id===hi)??n[0]}function K2(e,t){return Ax[e].some(s=>s.id===t)?t:hi}Uv("done",hi).notes,Uv("needs-input",hi).notes;const G1=.04,Kq=.24,Qu=0,md=100,Wv=5,zl=50;function Ul(e){if(!Number.isFinite(e))return zl;const t=Math.round(e/Wv)*Wv;return Math.min(md,Math.max(Qu,t))}function Xq(e){if(e==null)return zl;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?Ul(Number(t)):zl}function Qq(e){const t=Ul(e),n=G1+(Kq-G1)*(t/md);return Math.round(n*1e4)/1e4}function Zq(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(Qq(e)*s*1e4)/1e4}const Jq=160,eF="agent-dag.soundLevel.done",tF="agent-dag.soundLevel.needs-input",nF="agent-dag.soundFigure.done",rF="agent-dag.soundFigure.needs-input",X2={done:eF,"needs-input":tF},Q2={done:nF,"needs-input":rF},Hv={done:{level:zl,figure:hi},"needs-input":{level:zl,figure:hi}};function sF(e){const t=n=>({level:Xq(e(X2[n])),figure:K2(n,e(Q2[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const aF={Stop:"done",Notification:"needs-input"};function oF(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:aF[n]??null}function iF(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",l=()=>{var h;return(h=e.onState)==null?void 0:h.call(e,a())};function c(){var h;if(!(!t||s))try{n=n??new t,(h=n.resume)==null||h.call(n).then(l,()=>{}),s=!0,l()}catch{}}function d(h,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const f=(((N=e.prefs)==null?void 0:N.call(e))??Hv)[h]??Hv[h],m=Uv(h,f.figure),y=Zq(f.level,m),v=n.currentTime;for(const _ of m.notes){const S=n.createOscillator(),k=n.createGain();S.type=m.type??"sine",S.frequency.value=_.hz;const j=v+_.at,E=j+_.ms/1e3;k.gain.setValueAtTime(1e-4,j),k.gain.exponentialRampToValueAtTime(y,j+.012),k.gain.exponentialRampToValueAtTime(1e-4,E),S.connect(k).connect(n.destination),S.start(j),S.stop(E+.02)}return!0}return{unlock:c,play:d,state:a,get context(){return n}}}const lF="Notify me when a session needs my attention.",cF="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",V1="Get notified when you're away from this tab.";function uF(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:V1};case"default":return{status:null,ask:!0,ok:!1,note:V1};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 Y1={done:"Turn finished","needs-input":"Claude is asking"},dF={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function hF({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:a,onFigure:l,onPreview:c,openerRef:d,notifyOn:h,onToggleNotify:p,notifyVetoed:f,notifyPermission:m,onAskNotify:y}){const v=uF(m),N=h&&!f,_=Vt(e),S=x.useRef(e);return S.current=e,x.useEffect(()=>{const k=j=>{var C,T;const E=j.target;E&&((C=_.current)!=null&&C.contains(E)||(T=d.current)!=null&&T.contains(E)||S.current())};return window.addEventListener("pointerdown",k,!0),()=>window.removeEventListener("pointerdown",k,!0)},[_,d]),i.jsxs("div",{ref:_,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[i.jsxs("div",{className:"sm-switches",children:[i.jsxs("label",{className:"sm-switch",children:[i.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),i.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-labelledby":"sm-sound-label",className:"sm-toggle",onClick:n,title:"A tone when a turn finishes, and when Claude asks for something",children:i.jsx("span",{className:"sm-toggle-knob"})})]}),i.jsxs("div",{className:"sm-setting",children:[i.jsxs("label",{className:"sm-switch",children:[i.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),i.jsx("button",{type:"button",role:"switch","aria-checked":h,"aria-labelledby":"sm-notify-label",className:"sm-toggle",onClick:p,title:"A system notification when a session blocks on you",children:i.jsx("span",{className:"sm-toggle-knob"})})]}),i.jsx("p",{className:"sm-note",children:f?cF:lF})]})]}),N&&i.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[i.jsxs("div",{className:"sm-channel-head",children:[i.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),v.ask?i.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:y,children:"Enable"}):i.jsxs("span",{className:"sm-channel-state","data-ok":v.ok||void 0,children:[v.ok&&i.jsx("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),v.status]})]}),i.jsx("p",{className:"sm-note",children:v.note})]}),!t&&i.jsx("span",{id:"sm-preview-note",className:"vis-hidden",children:"Plays even when Sounds is off, so you can set a tone before turning sounds back on."}),i.jsx("div",{className:"sm-tones",children:Gq.map(k=>{const j=s[k],E=`sm-level-${k}`,C=`sm-figure-${k}`;return i.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${k}`,children:[i.jsxs("div",{className:"sm-tone-head",children:[i.jsx("h3",{className:"sm-tone-name",id:`sm-name-${k}`,children:Y1[k]}),i.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(k),"aria-label":`Hear the ${Y1[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:[i.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:i.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),i.jsxs("div",{className:"sm-row",children:[i.jsx("label",{htmlFor:E,children:"Volume"}),i.jsx("input",{id:E,type:"range",min:Qu,max:md,step:Wv,value:j.level,onChange:T=>a(k,Number(T.target.value)),style:{"--sm-level":`${(j.level-Qu)/(md-Qu)*100}%`}}),i.jsxs("span",{className:"sm-read",children:[j.level,"%"]})]}),i.jsxs("div",{className:"sm-row",children:[i.jsx("label",{htmlFor:C,children:"Tone"}),i.jsx("select",{id:C,className:"sm-select",value:j.figure,onChange:T=>l(k,T.target.value),children:Ax[k].map(T=>i.jsx("option",{value:T.id,children:T.label},T.id))})]}),i.jsx("p",{className:"sm-note",children:dF[k]})]},k)})}),i.jsxs("p",{className:"sm-foot",children:[i.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const fF=15e3;function pF(e){return e.visibilityState==="visible"&&e.hasFocus()}function mF(e,t){return t||e===!0}function gF(){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 yF={"//":["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."],"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.
|
|
81
|
+
`),"fix"),title:"Copy these lines, then paste them into an elevated PowerShell",children:y==="fix"?"copied":"copy command"})]})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"By address"}),i.jsxs("div",{className:"ap-lan-row",children:[i.jsx("input",{ref:a,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:c,placeholder:"192.168.1.5:54340",spellCheck:!1,...O("addr"),onChange:L=>{d(L.target.value),$("addr")},onKeyDown:L=>{L.key==="Enter"&&F()}}),c.trim()!==""&&i.jsx("button",{type:"button",className:"ap-manage-btn",...D("add"),onClick:()=>void F(),title:"Add it to the decks this one calls, starting now.",children:"add"})]}),i.jsx("p",{className:"lan-note",children:"This deck calls that address until somebody there accepts."})]}),i.jsxs("div",{className:"modal-section",children:[i.jsxs("h3",{className:"lan-h",children:["With an invite",!X&&i.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...D("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"})]}),i.jsxs("div",{className:"ap-lan-row",children:[i.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:h,placeholder:"paste one you were sent",spellCheck:!1,...O("join"),onChange:L=>{p(L.target.value),k(null),$("join")},onKeyDown:L=>{L.key==="Enter"&&J()}}),h.trim()!==""&&i.jsx("button",{type:"button",className:"ap-manage-btn",...D("join"),onClick:()=>void J(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:N==="join"?"joining…":"join"})]}),i.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),S&&i.jsxs("div",{className:"ap-lan-tried",children:[i.jsx("span",{className:"lan-note",children:"Nothing answered at any address in that invite. Check that deck is running with its Local network switch on."}),S.map(L=>i.jsxs("span",{className:"ap-lan-tried-row",children:[i.jsx("code",{className:"ap-lan-code",children:L.addr}),i.jsx("span",{className:"ap-lan-bad",children:L.why})]},L.addr))]}),X&&i.jsxs("div",{className:"ap-lan-invite",children:[i.jsxs("div",{className:"ap-lan-invite-head",children:[i.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),i.jsxs("span",{className:"ap-lan-invite-left",children:[dq(X.expiresAt,j)," left"]})]}),i.jsx("code",{className:"ap-lan-token",children:X.token}),i.jsxs("div",{className:"ap-lan-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...D("copy:invite"),onClick:()=>void I(X.token,"invite"),title:"Copy it, and send it however you already talk to them",children:y==="invite"?"copied":"copy"}),i.jsx("button",{type:"button",className:"ap-manage-btn",...D("invite:withdraw"),onClick:()=>void Z("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),i.jsx("p",{className:"lan-warn",children:"Anyone who gets this text can pair with this deck until it runs out."})]})]})]})]})}),document.body)}function Q6(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 Z6=1e3;function J6(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=Lr(e,t);return`${n} · ${s==="now"?"just now":s}`}function P1(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}function eq(){return i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M9.6 2.4l2 2L5 11l-2.6.6L3 9z"}),i.jsx("path",{d:"M8.4 3.6l2 2"})]})}function L1(){return i.jsxs("svg",{className:"lan-machine",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("rect",{x:"2.5",y:"3",width:"11",height:"7.5",rx:"1.2"}),i.jsx("path",{d:"M1 13h14"})]})}function Ou({dir:e,gate:t=!1}){const n=t?12:8;return i.jsx("svg",{className:"lan-chev","data-dir":e,"data-gate":t||void 0,width:n,height:"8",viewBox:`0 0 ${n} 8`,fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:e==="out"?"M2.8 1L6 4 2.8 7":t?"M1 1v6M9.6 1L6.4 4l3.2 3":"M5.2 1L2 4l3.2 3"})})}const tq={works:"works here",expired:"expired here",missing:"not on this deck"},nq={works:"works there",broken:"broken there",unknown:"not offered by that deck"};function rq(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${tq[e.here]}, ${nq[e.there]}, ${t}.`}function sq({row:e,source:t,status:n,accounts:s,now:a,busy:l,onClose:c,onRename:d,onCheck:h,onVerb:p,onSettings:f,twins:m=[],onUnpair:y}){var ze,Xe,re,Fe;const v=x.useRef(null),N=Vt(c,{focusRef:v}),[_,S]=x.useState(null),[k,j]=x.useState(null),[E,C]=x.useState(!1),T=x.useRef(0),[R,A]=x.useState(null),[D,O]=x.useState(!1),[$,F]=x.useState(0),Z=x.useRef(null),J=x.useRef(!0);x.useEffect(()=>()=>{J.current=!1},[]);const I=_!=null;x.useEffect(()=>{var se;I&&((se=Z.current)==null||se.select())},[I]),x.useEffect(()=>{if(!E)return;const se=window.setTimeout(()=>C(!1),4e3);return()=>window.clearTimeout(se)},[E]),x.useEffect(()=>{if(!R)return;const se=window.setTimeout(()=>A(null),4e3);return()=>window.clearTimeout(se)},[R]);const X=se=>{const Ce=Ys(l,se);return{disabled:Ce.disabled,"aria-busy":Ce.busy}},G=async se=>{const Ce=await se();return J.current&&j(Ce),Ce==null},{peer:q,stranger:Y}=t,L=e.kind==="paired",K=e.self??e.name,P=e.kind!=="dialling",V=e.kind==="dialling"?null:e.fp,he=q?q.addr?`${q.addr}:${q.port}`:"":Y?Y.port?`${Y.addr}:${Y.port}`:Y.addr:e.addr,U=(q==null?void 0:q.about)??null,W=((ze=n.about)==null?void 0:ze.version)??null,ee=async se=>{const Ce=se.trim()===K?"":se;await G(()=>d(Ce))&&S(null)},H=async()=>{if(V)try{if(await navigator.clipboard.writeText(V),!J.current)return;O(!0),window.setTimeout(()=>{J.current&&O(!1)},1600)}catch{J.current&&j("Could not copy it — select the fingerprint and copy it by hand.")}},ae=L?q!=null&&q.waiting?q.lastSeen!=null?"not said — it runs an older version":"not said yet — it says when it next calls":q!=null&&q.offers?"not said — it runs an older version":"not reached yet":"shown once paired",me=P1(n.about),ge=P1(U),Re=U!=null&&U.version&&W?wq(U.version,W):null,$e=q?G2(q.last,a):null,ce=(Xe=q==null?void 0:q.last)!=null&&Xe.error&&$e&&$e.text!==q.last.error?q.last.error:null,we=((re=q==null?void 0:q.last)==null?void 0:re.done)??[],xe=!!$e&&!!ce&&!e.quiet&&e.state.startsWith($e.text),De=L||e.kind==="dialling",_e=q?q.waiting?null:q.manual?"added by address":"on this network":e.kind==="nearby"?"heard on this network":"asked this deck to pair",Ee=e.tone==="bad"?"bad":L?e.here?"up":"down":"loose",Ge=l===`check:${e.fp}`,st=(q==null?void 0:q.offers)??null,Je=L?xq(q!=null&&q.waiting?null:(st==null?void 0:st.accounts)??null,s,n.shared??[]):[],Ze=Je.filter(se=>se.in==null&&se.out==="cut"),Qe=Je.some(se=>se.in!=null),fe=Je.some(se=>se.out!=null),ye=new Map(we.map(se=>[se.email,se])),Se=we.filter(se=>!Je.some(Ce=>Ce.email===se.email)),Pe=L?q!=null&&q.waiting?"What that deck offers is not known. This deck never asks it — it calls in — so it only shows once this deck can reach it.":st?st.accounts.length===0?"That deck offers nothing. Nobody there has chosen a login to share.":null:(Fe=q==null?void 0:q.last)!=null&&Fe.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,et=st&&(q!=null&&q.last)&&q.last.at-st.at>Z6?Lr(st.at,a):null,ft=[];L&&(q!=null&&q.pairedAt)?ft.push({label:"Paired",value:J6(q.pairedAt,a),tone:"meta"}):e.kind==="declined"&&Y&&ft.push({label:"Paired",value:`no · you said no ${Ax(Y.at,a)}`,tone:"meta"}),ft.push({label:"Fingerprint",value:V?i.jsxs("span",{className:"lan-fp",children:[i.jsx("code",{className:"ap-lan-code",children:V}),i.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void H(),"aria-label":D?"Fingerprint copied":"Copy the fingerprint",children:D?"copied":"copy"})]}):"not known — nothing has answered there",tone:V?void 0:"quiet"});const dt=m.length?[{row:e,peer:q??null},...m]:[];return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:i.jsxs("div",{ref:N,className:"modal lan-peer","data-tone":e.tone,onClick:se=>se.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-peer-title","aria-describedby":"lan-peer-sub",children:[i.jsxs("header",{className:"modal-head lan-peer-head",children:[i.jsx("i",{className:e.here?"ap-pulse":"ap-dot","aria-hidden":!0}),i.jsxs("div",{className:"lan-peer-id",children:[I?i.jsxs("form",{className:"lan-peer-edit",onSubmit:se=>{se.preventDefault(),ee(_??"")},children:[i.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),i.jsx("input",{ref:Z,className:"ap-manage-input lan-peer-input",value:_??"",maxLength:48,placeholder:K,"aria-label":"Name for this deck, shown on this deck only",onChange:se=>S(se.target.value)}),i.jsx("button",{type:"submit",className:"ap-manage-btn",...X(`alias:${e.fp}`),children:"save"}),i.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>S(null),children:"cancel"})]}):i.jsxs("span",{className:"lan-peer-title",children:[i.jsx("span",{id:"lan-peer-title",className:"lan-peer-name",children:e.name}),P&&i.jsx("button",{type:"button",className:"glyph-btn lan-peer-rename",onClick:()=>{j(null),S(e.name)},"aria-label":`Rename ${e.name} on this deck`,title:"Give it a name of your own. Only this deck sees it.",children:i.jsx(eq,{})})]}),i.jsxs("p",{id:"lan-peer-sub",className:"lan-peer-sub",children:[e.self&&i.jsxs(i.Fragment,{children:["calls itself ",i.jsx("span",{className:"lan-peer-self",children:e.self}),I&&i.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...X(`alias:${e.fp}`),onClick:()=>void ee(""),children:"use this name"}),i.jsx("span",{className:"vis-hidden",children:". "}),!e.quiet&&i.jsx("span",{"aria-hidden":!0,children:" · "})]}),i.jsx("span",{className:e.quiet?"vis-hidden":"lan-peer-state",children:e.state})]})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{ref:v,type:"button",className:"glyph-btn",onClick:c,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body lan-peer-body",children:[k&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",children:k}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>j(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),i.jsxs("div",{className:"lan-map","data-link":Ee,"data-asking":Ge||void 0,"data-bus":Je.length>0||void 0,children:[i.jsxs("div",{className:"lan-ends",children:[i.jsxs("p",{className:"lan-end",children:[i.jsx("span",{className:"lan-end-name",children:"This deck"}),me&&i.jsx("span",{className:"lan-end-runs",children:me})]}),i.jsxs("p",{className:"lan-end","data-side":"there",children:[i.jsx("span",{className:"lan-end-name",children:e.name}),e.kind!=="dialling"&&i.jsxs("span",{className:"lan-end-runs",children:[ge??(U?"not said":ae),Re?` · ${Re<0?"older":"newer"}`:null]})]})]}),i.jsxs("div",{className:"lan-link",children:[i.jsx(L1,{}),i.jsxs("span",{className:"lan-span",children:[i.jsxs("span",{className:"lan-wire","aria-hidden":!0,children:[i.jsx("i",{className:"lan-glint","data-dir":"out"}),i.jsx("i",{className:"lan-glint","data-dir":"in"})]}),i.jsx("span",{className:"lan-link-label",children:he?i.jsx("code",{className:"ap-lan-code",children:he}):"none here — it calls this deck"})]}),i.jsx(L1,{}),(he&&_e||De)&&i.jsxs("p",{className:"lan-link-sub",children:[he&&_e,he&&_e&&De&&" · ",De&&($e?xe?i.jsx("code",{className:"ap-lan-code",children:ce}):i.jsx("span",{className:"lan-round","data-tone":$e.tone,children:$e.text.replace(/ · now$/," · just now")}):"not asked yet"),De&&ce&&!xe&&i.jsx("code",{className:"lan-fact-raw",children:ce})]}),Se.length>0&&i.jsx("ul",{className:"lan-done",children:Se.map(se=>i.jsxs("li",{"data-ok":se.ok,children:[se.email," ",i.jsx("span",{className:"lan-done-what",children:se.ok?"arrived":"did not arrive"})]},`${se.email}:${se.action}`))}),(q==null?void 0:q.waiting)&&i.jsx("p",{className:"lan-note lan-link-note",children:e.hint})]}),Je.length>0&&i.jsx("ul",{className:"lan-lanes",role:"list","aria-label":`Logins between this deck and ${e.name}`,children:Je.map((se,Ce)=>{const Ve=ye.get(se.email),gt=se.out==="live"||se.in!=null&&se.in!=="cut";return i.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":se.tone,"data-draw":se.in&&se.out?"both":se.in?"in":"out",style:{"--i":Ce},children:[i.jsx("i",{className:"lan-pip","data-end":"here","data-state":se.here,"aria-hidden":!0}),i.jsxs("span",{className:"lan-track",children:[i.jsxs("span",{className:"lan-wire","data-flow":gt?"live":"cut","aria-hidden":!0,children:[(se.in==="live"||se.in==="wait")&&i.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":se.in}),se.out==="live"&&i.jsx("i",{className:"lan-glint","data-dir":"out"})]}),se.in&&se.in!=="cut"&&i.jsx(Ou,{dir:"in",gate:se.in==="blocked"}),se.out==="live"&&i.jsx(Ou,{dir:"out"}),i.jsx("span",{className:"lan-lane-email",children:se.email})]}),i.jsx("i",{className:"lan-pip","data-end":"there","data-state":se.there,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:rq(se)}),(se.caption||Ve)&&i.jsxs("span",{className:"lan-lane-note",children:[se.caption,se.caption&&Ve&&" · ",Ve&&i.jsx("span",{className:"lan-lane-done","data-ok":Ve.ok,children:Ve.ok?"arrived last round":"did not arrive last round"})]})]},se.key)})},$),L&&i.jsxs(i.Fragment,{children:[Ze.length>0&&i.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",Ze.length===1?Ze[0].email:"the expired ones"," until you sign in again here."]}),Pe&&i.jsx("p",{className:"lan-empty",children:Pe}),et&&i.jsxs("p",{className:"lan-stale",children:["As of ",et==="now"?"just now":et,", when it last answered."]}),i.jsxs("div",{className:"lan-legend",children:[Qe&&i.jsxs("span",{className:"lan-key",children:[i.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:i.jsx(Ou,{dir:"in"})}),"from ",e.name]}),fe?i.jsxs("span",{className:"lan-key",children:[i.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:i.jsx(Ou,{dir:"out"})}),"from this deck, to every paired deck"]}):i.jsx("span",{className:"lan-key",children:"This deck offers nothing yet."}),i.jsx("button",{type:"button",className:"ap-lan-word lan-legend-act",onClick:f,"aria-label":"Change what this deck offers",children:"change"})]})]})]}),i.jsx("dl",{className:"lan-facts",children:ft.map(se=>i.jsxs("div",{className:"lan-fact","data-tone":se.tone,children:[i.jsx("dt",{children:se.label}),i.jsx("dd",{children:se.value})]},se.label))}),dt.length>1&&i.jsxs("div",{className:"modal-section",children:[i.jsxs("h3",{className:"lan-h",children:[dt.length," decks on this machine"]}),i.jsx("ul",{className:"lan-twins",role:"list",children:dt.map((se,Ce)=>{var pt,wt,Yt,Fr;const Ve=(pt=se.peer)!=null&&pt.addr?`${se.peer.addr}:${se.peer.port}`:se.row.addr,gt=Ve||se.row.fp,xt=(wt=se.peer)!=null&&wt.pairedAt?Lr(se.peer.pairedAt,a):null,Te=[(Fr=(Yt=se.peer)==null?void 0:Yt.about)!=null&&Fr.version?`runs ${se.peer.about.version}`:null,xt?`paired ${xt==="now"?"just now":xt}`:null,se.row.state].filter(Boolean).join(" · "),tt=se.row.fp;return i.jsxs("li",{role:"listitem",className:"lan-twin","data-tone":se.row.tone,children:[i.jsx("i",{className:se.row.here?"ap-pulse":"ap-dot","aria-hidden":!0}),Ve?i.jsx("code",{className:"ap-lan-code lan-twin-at",children:Ve}):i.jsx("span",{className:"lan-twin-at lan-twin-none",children:"no address here"}),i.jsx("code",{className:"ap-lan-code lan-twin-fp",children:tt}),Ce>0&&y&&i.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${R===tt?" armed":""}`,...X(`unpair:${tt}`),onKeyDown:Qn=>{Qn.repeat&&Qn.preventDefault()},onClick:()=>{if(R!==tt){A(tt),T.current=Date.now();return}Date.now()-T.current<zv||(A(null),G(()=>y(tt)))},"aria-label":R===tt?`Confirm unpairing ${gt}`:`Unpair ${gt}`,title:R===tt?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this one of the machine's decks",children:l===`unpair:${tt}`?"unpairing…":R===tt?"sure?":"unpair"}),i.jsx("span",{className:"lan-twin-meta",children:Ce===0?`${Te} · shown above`:Te})]},tt)})})]})]}),i.jsxs("footer",{className:"lan-peer-foot",children:[e.kind==="asks"&&i.jsx("p",{className:"lan-foot-note",children:"This deck is now asking to pair. Answer it from the panel behind this."}),L&&!(q!=null&&q.waiting)&&i.jsx("button",{type:"button",className:"btn",...X(`check:${e.fp}`),onClick:()=>void G(h).then(se=>{se&&J.current&&F(Ce=>Ce+1)}),title:"Ask this deck now instead of waiting for the next round",children:l===`check:${e.fp}`?"Checking…":"Check now"}),e.kind==="paired"&&i.jsx("button",{type:"button",className:`btn danger lan-peer-verb${E?" armed":""}`,...X(`unpair:${e.fp}`),onKeyDown:se=>{se.repeat&&se.preventDefault()},onClick:()=>{if(!E){C(!0),T.current=Date.now();return}Date.now()-T.current<zv||(C(!1),G(p))},"aria-label":E?`Confirm unpairing ${e.name}`:`Unpair ${e.name}`,title:E?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:l===`unpair:${e.fp}`?"Unpairing…":E?"Unpair — sure?":"Unpair"}),e.kind==="nearby"&&i.jsx("button",{type:"button",className:"btn primary lan-peer-verb",...X(`accept:${e.fp}`),onClick:()=>void G(p),title:"Send it a request. Somebody at that machine has to accept it before anything is shared.",children:l===`accept:${e.fp}`?"Asking…":"Ask to pair"}),e.kind==="dialling"&&i.jsx("button",{type:"button",className:"btn lan-peer-verb",...X(`drop:${e.fp}`),onClick:()=>void G(p),title:"Stop trying this address. Nothing was ever paired here.",children:l===`drop:${e.fp}`?"Stopping…":"Stop dialling"}),e.kind==="declined"&&i.jsx("button",{type:"button",className:"btn lan-peer-verb",...X(`allow:${e.fp}`),onClick:()=>void G(p),title:"Take the no back. That deck is still trying, so its request comes round again on its own.",children:l===`allow:${e.fp}`?"Allowing…":"Let it ask again"})]})]})}),document.body)}async function Cx(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}function aq({status:e,accounts:t,onClose:n,onChanged:s}){const a=Vt(n),[l,c]=x.useState(null),[d,h]=x.useState(null),[p,f]=x.useState(!1),[m,y]=x.useState(null),v=x.useRef(null),N=A=>{const D=Ys(m,A);return{disabled:D.disabled,"aria-busy":D.busy}},_=x.useRef(null),S=x.useRef(!0);x.useEffect(()=>()=>{S.current=!1},[]),x.useEffect(()=>{_.current&&uq(_.current,e.shared??[])&&(_.current=null)},[e.shared]);const k=x.useCallback(async(A,D,O="write")=>{v.current=O,y(O);try{const F=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:A})})).json().catch(()=>null);return S.current?(F!=null&&F.ok?h(null):h(Dt(D,F)),s(),(F==null?void 0:F.ok)===!0):!1}catch{return S.current&&h(Dt(D,null)),!1}finally{v.current=null,S.current&&y(null)}},[s]),j=x.useCallback(async()=>{if(l!=null&&l!==(e.name??"")){if(!await k({name:l},"save the name","name"))return;S.current&&c(null)}n()},[l,e.name,k,n]),E=async()=>{if(!e.fp)return;const A=await Cx(e.fp);if(S.current){if(!A){h("Could not copy it — select the fingerprint and copy it by hand.");return}f(!0),window.setTimeout(()=>{S.current&&f(!1)},1600)}},C=new Set(_.current??e.shared??[]),T=e.autoAsk!==!1,R=e.autoAccept!==!1;return ps.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:a,className:"modal lan-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[d&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",children:d}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>h(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"Name"}),i.jsxs("div",{className:"ap-lan-row",children:[i.jsx("span",{className:"ap-lan-label",children:"appear as"}),i.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:l??e.name??"",placeholder:"this machine",onChange:A=>c(A.target.value),onKeyDown:A=>{A.key!=="Enter"||l==null||(k({name:l},"save the name","name"),c(null))}}),l!=null&&l!==(e.name??"")&&i.jsx("button",{type:"button",className:"ap-manage-btn",...N("name"),onClick:()=>{k({name:l},"save the name","name"),c(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),i.jsxs("div",{className:"ap-lan-row",children:[i.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),e.fp?i.jsxs("span",{className:"lan-fp",children:[i.jsx("code",{className:"ap-lan-code",children:e.fp}),i.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void E(),"aria-label":p?"Fingerprint copied":"Copy this deck's fingerprint",children:p?"copied":"copy"})]}):i.jsx("span",{className:"ap-lan-label",children:"not known yet"})]})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"Share these accounts"}),i.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&i.jsx("span",{className:"ap-lan-empty",children:"No Claude accounts on this deck yet — add one with + at the top of this panel."}),t.map(A=>i.jsxs("label",{className:"ap-lan-pick",title:A.alive?"Offer this account to the decks you have paired with, so one whose copy has died can heal from yours. Unticking stops it being offered from now on; it does not take back a copy somebody already has.":"This deck cannot use this login, so it has nothing to offer — a deck that can will heal it",children:[i.jsx("input",{type:"checkbox",checked:C.has(A.key),onChange:D=>{const O=new Set(_.current??e.shared??[]);D.target.checked?O.add(A.key):O.delete(A.key),_.current=[...O],k({shared:[...O]},D.target.checked?"share that account":"stop sharing that account")}}),i.jsx("span",{className:"ap-lan-pick-name",children:A.email}),!A.alive&&i.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},A.key))]})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"Pairing"}),i.jsxs("div",{className:"lan-switches",children:[i.jsxs("div",{className:"lan-switch",children:[i.jsx("span",{className:"lan-switch-what",children:"Ask every deck this one finds"}),i.jsx("button",{type:"button",className:`ap-auto-state${T?" live":""}`,role:"switch","aria-checked":T,"aria-label":"Ask every deck this one finds",...N("ask"),onClick:()=>void k({autoAsk:!T},T?"stop asking automatically":"ask every deck this one finds","ask"),title:T?"Stop sending requests on their own. You press ask on the row instead.":"Send a pairing request to every deck heard on this network. Somebody over there still has to say yes."})]}),i.jsxs("div",{className:"lan-switch",children:[i.jsx("span",{className:"lan-switch-what",children:"Say yes to every deck that asks"}),i.jsx("button",{type:"button",className:`ap-auto-state${R?" live":""}`,role:"switch","aria-checked":R,"aria-label":"Say yes to every deck that asks",...N("accept"),onClick:()=>void k({autoAccept:!R},R?"stop accepting automatically":"accept every deck that asks","accept"),title:R?"Stop saying yes for you. A deck that asks waits in the panel again.":"Say yes for you. Every deck on this network that asks is paired without anybody being asked here."})]})]}),R?null:T?i.jsx("p",{className:"lan-note",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."}):i.jsxs("p",{className:"lan-note",children:["Nothing pairs on its own. You press ",i.jsx("strong",{children:"ask"})," on a deck you find, and ",i.jsx("strong",{children:"accept"})," on one that asks. A deck you said no to is never asked about again either way."]})]})]}),i.jsxs("footer",{className:"lan-setup-foot",children:[i.jsx("span",{className:"lan-foot-note",children:"Changes are saved as you make them."}),i.jsx("button",{type:"button",className:"btn primary",...N("name"),onClick:()=>void j(),children:"Done"})]})]})}),document.body)}function Lr(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 Tx={"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"}},oq={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 iq(e){var s;const t=lq[e];if(t)return t;const n=(s=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:s[1];return n&&oq[n]||e}const lq={"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 G2(e,t){if(!e)return null;if(e.error)return Tx[e.error]??{text:iq(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${Lr(e.at,t)}`,tone:"idle"};const s=n.filter(l=>l.ok),a=s.length===1?"login":"logins";return s.length===n.length?{text:`${s.length} ${a} arrived · ${Lr(e.at,t)}`,tone:"ok"}:{text:`${s.length} of ${n.length} logins arrived · ${Lr(e.at,t)}`,tone:"bad"}}const Bv=5e3,V2=6e4,zv=400;function cq(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 Dt(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 uq(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function dq(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function Y2(e,t){var n,s;return(n=e.last)!=null&&n.error&&!Tx[e.last.error]?!1:!!((s=e.last)!=null&&s.at&&t-e.last.at<pd||e.lastSeen!=null&&t-e.lastSeen<pd)}const pd=95e3;function hq(e,t){const n=[],s=[];for(const a of e??[])(Y2(a,t)?n:s).push(a);return{online:n,offline:s}}function fq(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(v=>v.paired!==!1||v.met);if(!s.length)return{text:"no deck paired yet",tone:"idle"};const a=s.filter(v=>v.waiting),l=s.filter(v=>!v.waiting),c=a.filter(v=>{var N;return!((N=v.last)!=null&&N.error)&&v.lastSeen!=null&&t-v.lastSeen<pd}),{online:d,offline:h}=hq(l,t),p=[...h,...a.filter(v=>!c.includes(v))],f=d.length+c.length,m=d.filter(v=>{var N;return((N=v.last)==null?void 0:N.error)==="waiting for the other deck to accept this one"});if(f&&m.length===f)return{text:f===1?"1 deck found · waiting for them to accept":`${f} decks found · waiting for them to accept`,tone:"wait"};if(!f)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=f===1?"1 deck ready":`${f} decks ready`;return{text:p.length?`${y} · ${p.length} away`:y,tone:"ok"}}function pq(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const s=Lr(e,t);return s==="now"?"checked just now":`checked ${s}`}function Ax(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 mq(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<pd;return{text:n?"online · one-way, it calls in":`one-way · last online ${Lr(e,t)}`,here:n}}function D1(e,t,n){return t?"online":e.lastSeen!=null?`last online ${Lr(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function gq(e,t){var y,v,N,_,S;if(!e)return[];const n=[],s=new Set,a=(k,j)=>k.name.localeCompare(j.name,void 0,{numeric:!0}),l=e.aliases??{},c=(k,j)=>{const E=k?l[k]:void 0;return E&&E!==j?{name:E,self:j}:{name:j}};for(const k of e.pending??[]){if(!(k!=null&&k.fp)||s.has(k.fp))continue;s.add(k.fp);const j=c(k.fp,k.name||k.fp);n.push({fp:k.fp,name:j.name,...j.self?{self:j.self}:{},addr:k.addr??"",kind:"asks",state:`wants to pair · ${Ax(k.at,t)}`,tone:"wait",here:!0,hint:`${j.name} at ${k.addr} is waiting for an answer.`})}const d=[],h=[];for(const k of e.peers??[]){const j=k.peerFp??k.fp;if(!j||s.has(j))continue;s.add(j);const E=G2(k.last,t),C=Y2(k,t),T=k.addr?`${k.addr}:${k.port}`:"";if(!k.paired&&k.manual&&!k.met){h.push({fp:T,name:T||k.name||j,addr:k.addr??"",kind:"dialling",state:E?E.text.replace(/ · .*$/,""):"trying…",tone:E?E.tone:"idle",here:!1,hint:(y=k.last)!=null&&y.error?`Nothing has answered at ${T} yet — ${k.last.error}.`:`Dialling ${T} until something answers.`});continue}const R=k.waiting?mq(k.lastSeen,t):null,A=R?R.here:C,D=!R&&E?A?`online · ${E.text.replace(/ · .*$/,"")}`:`${E.text.replace(/ · .*$/,"")} · ${D1(k,A,t)}`:R?R.text:D1(k,A,t),O=(v=k.last)!=null&&v.error?Tx[k.last.error]:null,$=!R&&A&&!((N=k.last)!=null&&N.error)&&!(((_=k.last)==null?void 0:_.done)??[]).length,F=k.manual&&!k.met?{name:T}:c(j,k.name||j);d.push({fp:j,name:F.name,...F.self?{self:F.self}:{},addr:k.addr??"",kind:"paired",state:D,quiet:$,tone:O?O.tone==="bad"?"bad":"wait":E?E.tone:A?"ok":"idle",here:R?R.here:C,hint:R?`${F.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 ${Lr(k.lastSeen,t)}.`} Add its address with the + at the top of this section to reach it either way.`:`${F.name}${T?` at ${T}`:""}${(S=k.last)!=null&&S.error?` — ${k.last.error}`:""}`})}n.push(...yq(d).sort(a),...h.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 j=c(k.fp,k.name||k.fp);p.push({fp:k.fp,name:j.name,...j.self?{self:j.self}:{},addr:k.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:`${j.name} at ${k.addr} is on this network and nothing is shared with it.`})}n.push(...p.sort(a));const f=[];for(const k of e.declined??[]){if(!(k!=null&&k.fp)||s.has(k.fp))continue;s.add(k.fp);const j=c(k.fp,k.name||k.fp);f.push({fp:k.fp,name:j.name,...j.self?{self:j.self}:{},addr:k.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${j.name} asked and was turned away. It is not asking any more.`})}n.push(...f.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 yq(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(l=>l.addr).map(l=>l.addr))];if(a.length>1){for(const l of a)n.push(q1(s.filter(c=>c.addr===l)));n.push(...s.filter(l=>!l.addr))}else n.push(q1(s))}return n}function q1(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 F1(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function B1(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 wq(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 l=Number(n[a])-Number(s[a]);if(l)return Math.sign(l)}return 0}function vq(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 xq(e,t,n){const s=new Map(t.map(d=>[d.key,d])),a=new Set(n),l=[],c=new Set;for(const d of e??[]){if(c.has(d.key))continue;c.add(d.key);const h=s.get(d.key)??null,p=a.has(d.key),f=vq(d,h,p),m=h?h.alive?"works":"expired":"missing",y=!d.alive&&h&&!h.alive?f.note:[m==="works"?null:f.here,d.alive?null:f.there,f.note].filter(Boolean).join(" · ")||null;l.push({key:d.key,email:d.email,here:m,there:d.alive?"works":"broken",in:d.alive?f.tone==="wait"?"wait":f.tone==="bad"?"blocked":"live":"cut",out:p&&h?h.alive?"live":"cut":null,caption:y,tone:f.tone})}for(const d of n){const h=s.get(d);!h||c.has(d)||(c.add(d),l.push({key:d,email:h.email,here:h.alive?"works":"expired",there:"unknown",in:null,out:h.alive?"live":"cut",caption:h.alive?null:"expired here",tone:h.alive?"ok":"bad"}))}return l}async function Zo(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function bq({accounts:e,onChanged:t}){const[n,s]=x.useState(null),[a,l]=x.useState([]),[c,d]=x.useState(null),[h,p]=x.useState(!1),[f,m]=x.useState(null),y=x.useRef(0),[v,N]=x.useState(!1),[_,S]=x.useState(!1),[k,j]=x.useState(!1),[E,C]=x.useState(null),T=x.useRef(null),R=x.useCallback(ce=>Td(T.current)?(T.current=ce,d(ce),!0):!1,[]),A=x.useCallback(()=>{T.current=null,F.current&&d(null)},[]),D=ce=>{const we=Ys(c,ce);return{disabled:we.disabled,"aria-busy":we.busy}},[O,$]=x.useState(()=>Date.now()),F=x.useRef(!0),Z=x.useRef(Bv),J=x.useCallback(async()=>{var ce,we;try{const[xe,De]=await Promise.all([fetch("/api/lan").then(_e=>_e.json()),fetch("/api/prefs").then(_e=>_e.json())]);if(!F.current)return;xe!=null&&xe.ok&&s(xe),De!=null&&De.ok&&l(Array.isArray((we=(ce=De.prefs)==null?void 0:ce.lan)==null?void 0:we.manual)?De.prefs.lan.manual:[]),Z.current=(xe==null?void 0:xe.enabled)===!0?Bv:V2}catch{}},[]);x.useEffect(()=>{F.current=!0;let ce=0;const we=async()=>{$(Date.now()),await J(),F.current&&(ce=window.setTimeout(we,Z.current))};return we(),()=>{F.current=!1,window.clearTimeout(ce)}},[J]);const I=x.useCallback(async()=>{const ce=(n==null?void 0:n.enabled)===!0;if(R("switch"))try{const we=await Zo("/api/prefs",{lan:{enabled:!ce}});if(!F.current)return;we!=null&&we.ok?(C(null),ce||p(!0)):C(Dt(ce?"turn this off":"turn this on",we)),await J()}catch{F.current&&C(Dt(ce?"turn this off":"turn this on",null))}finally{A()}},[n==null?void 0:n.enabled,J,R,A]),X=x.useCallback(async(ce,we,xe)=>{if(!R(`${ce}:${we}`))return null;let De=null;try{const _e=await Zo("/api/lan/peer",{action:ce,fp:we});if(!F.current)return null;_e!=null&&_e.ok?(s(_e),C(null)):(De=Dt(xe,_e),C(De)),await J()}catch{De=Dt(xe,null),F.current&&C(De)}finally{A()}return De},[J,R,A]),G=x.useCallback(async ce=>{if(!R(`drop:${ce}`))return null;let we=null;try{const xe=await Zo("/api/prefs",{lan:{manual:a.filter(De=>De!==ce)}});if(!F.current)return null;xe!=null&&xe.ok?(C(null),t()):(we=Dt("stop dialling that address",xe),C(we)),await J()}catch{we=Dt("stop dialling that address",null),F.current&&C(we)}finally{A()}return we},[a,J,t,R,A]),[q,Y]=x.useState(null),L=x.useCallback(async(ce,we)=>{if(!R(`alias:${ce}`))return"Something else is still being saved. Try again in a moment.";try{const xe=await Zo("/api/lan/peer",{action:"alias",fp:ce,name:we});return F.current?xe!=null&&xe.ok?(s(xe),null):Dt("rename that deck",xe):null}catch{return Dt("rename that deck",null)}finally{A()}},[R,A]),K=x.useCallback(async ce=>{if(!R(`check:${ce}`))return null;try{const we=await Zo("/api/lan/sync",{fp:ce});return F.current?we!=null&&we.ok?(s(we),t(),null):(we==null?void 0:we.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.":Dt("check that deck",we):null}catch{return Dt("check that deck",null)}finally{A()}},[R,A,t]),P=x.useCallback(async()=>{if(R("check"))try{const ce=await Zo("/api/lan/sync",{});if(!F.current)return;ce!=null&&ce.ok?(s(ce),C(null)):C(Dt("check the other decks",ce)),t()}catch{F.current&&C(Dt("check the other decks",null))}finally{A()}},[R,A,t]),V=(n==null?void 0:n.enabled)===!0,he=gq(n,O),U=q?he.find(ce=>{var we;return ce.fp===q||((we=ce.twins)==null?void 0:we.some(xe=>xe.fp===q))})??null:null;x.useEffect(()=>{q&&n&&!U&&Y(null)},[q,n,U]);const W=he.filter(ce=>ce.kind==="asks"),ee=he.filter(ce=>ce.kind!=="asks"),H=ee.filter(ce=>ce.here),ae=ee.filter(ce=>!ce.here),me=ae.filter(ce=>ce.tone==="bad").length,ge=k||H.length===0,Re=fq(n,O),$e=ee.filter(ce=>ce.kind==="paired").length;return i.jsxs("div",{className:"ap-auto ap-lan",children:[i.jsxs("div",{className:"ap-auto-head",children:[i.jsx("h3",{className:"ap-auto-title",children:"Local network"}),V&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>N(!0),"aria-label":"Add a deck",title:"Reach a deck that has not turned up on its own — by address, or with an invite",children:i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:i.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),V&&$e>0&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...D("check"),onClick:()=>void P(),"aria-label":c==="check"?"Checking every paired deck":"Check every paired deck now",title:"Ask every paired deck now for anything this deck's expired logins need, instead of waiting for the next round",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),i.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),V&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...D("setup"),onClick:()=>p(!0),"aria-label":"This deck's name and shared logins",title:"This deck's name on the network, and which of its logins it offers",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M1.8 4.7h10.4M1.8 9.3h10.4"}),i.jsx("circle",{cx:"9.1",cy:"4.7",r:"1.6",fill:"var(--panel)"}),i.jsx("circle",{cx:"4.9",cy:"9.3",r:"1.6",fill:"var(--panel)"})]})}),i.jsx("button",{type:"button",className:`ap-auto-state${V?" live":""}`,role:"switch","aria-checked":V,"aria-label":"Local network sync",...D("switch"),onClick:()=>void I(),title:V?"Stop talking to other decks. Nothing is shared while this is off.":"Let the decks you pair with repair this one's expired logins"})]}),!V&&i.jsxs("button",{type:"button",className:"ap-lan-intro",onClick:()=>S(!0),title:"Four pictures: what this does, and what to do on each machine",children:[i.jsx(V6,{}),i.jsx("span",{className:"ap-lan-intro-text",children:"Paired machines repair each other's expired logins."}),i.jsx("span",{className:"ap-lan-intro-go",children:"See how it works"})]}),i.jsx("p",{className:`ap-lan-status ${Re.tone}`,role:"status",children:Re.tone==="ok"?"":Re.text}),E&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",children:E}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>C(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),V&&i.jsxs(i.Fragment,{children:[W.length>0&&i.jsx("div",{className:"ap-lan-asks",role:"alert",children:W.map(ce=>i.jsxs("div",{className:"ap-lan-ask",children:[i.jsxs("span",{className:"ap-lan-ask-what",children:[i.jsx("strong",{className:"ap-lan-peer-name",children:ce.name})," at ",i.jsx("code",{className:"ap-lan-code",children:ce.addr})," wants to pair"]}),i.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",i.jsx("code",{className:"ap-lan-code",children:ce.fp})]}),i.jsxs("span",{className:"ap-lan-ask-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...D(`accept:${ce.fp}`),onClick:()=>void X("accept",ce.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${ce.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),i.jsx("button",{type:"button",className:"ap-manage-btn",...D(`dismiss:${ce.fp}`),onClick:()=>void X("dismiss",ce.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},ce.fp))}),(ge?[...H,...ae]:H).length>0&&i.jsx("ul",{className:"ap-lan-here",children:(ge?[...H,...ae]:H).map((ce,we)=>i.jsxs("li",{className:"ap-lan-who","data-tone":ce.tone,children:[i.jsx("i",{className:ce.here?"ap-pulse":"ap-dot","aria-hidden":!0}),i.jsx("span",{className:"ap-lan-who-name","aria-hidden":!0,children:ce.name}),i.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${we}`,onClick:()=>Y(ce.fp),children:i.jsxs("span",{className:"vis-hidden",children:[ce.name,", details"]})}),i.jsx("span",{id:`lan-who-state-${we}`,className:ce.quiet?"vis-hidden":"ap-lan-who-when",children:ce.state}),ce.kind==="nearby"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...D(`accept:${ce.fp}`),onClick:()=>void X("accept",ce.fp,"reach that deck"),"aria-label":`Ask ${ce.name} to pair`,title:`Send ${ce.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${ce.fp}.`,children:"ask"}),ce.kind==="paired"&&i.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${f===ce.fp?" armed":""}`,...D(`unpair:${ce.fp}`),onClick:()=>{if(f!==ce.fp){m(ce.fp),y.current=Date.now(),window.setTimeout(()=>m(xe=>xe===ce.fp?null:xe),4e3);return}Date.now()-y.current<zv||(m(null),X("unpair",ce.fp,"unpair that deck"))},"aria-label":f===ce.fp?`Confirm unpairing ${ce.name}`:`Unpair ${ce.name}`,title:f===ce.fp?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:f===ce.fp?"sure?":"unpair"}),ce.kind==="dialling"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...D(`drop:${ce.fp}`),onClick:()=>void G(ce.fp),"aria-label":`Stop dialling ${ce.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),ce.kind==="declined"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...D(`allow:${ce.fp}`),onClick:()=>void X("allow",ce.fp,"let that deck ask again"),"aria-label":`Let ${ce.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${ce.kind}:${ce.fp}`))}),(H.length>0&&ae.length>0||V&&$e>0)&&i.jsxs("div",{className:"ap-lan-tail",children:[H.length>0&&ae.length>0&&i.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":k,onClick:()=>j(ce=>!ce),title:k?"Show only the decks that are on":`Show the ${ae.length} deck${ae.length===1?"":"s"} that are not answering right now`,children:[i.jsx("span",{className:`ap-lan-chev${k?" open":""}`,"aria-hidden":!0,children:"›"}),k?"fewer":`${ae.length} more`,!k&&me>0&&i.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",me," not answering"]})]}),V&&$e>0&&i.jsx("span",{className:"ap-lan-checked",children:pq(n==null?void 0:n.checkedAt,O,c==="check")})]}),ee.length===0&&W.length===0&&i.jsxs(i.Fragment,{children:[i.jsxs("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, ",i.jsx("strong",{children:"+"})," at the top of this section reaches one by address or by invite."]}),i.jsx("button",{type:"button",className:"ap-lan-word ap-lan-how",onClick:()=>S(!0),children:"How it works"})]})]}),v&&n&&i.jsx(X6,{status:n,manual:a,onClose:()=>N(!1),onChanged:()=>{J(),t()}}),_&&i.jsx(W2,{title:"How Local network works",steps:G6,finish:V?void 0:{label:"Turn it on",act:()=>{S(!1),I()}},onClose:()=>S(!1)}),h&&n&&i.jsx(aq,{status:{...n,manualRows:a},accounts:e,manual:a,onClose:()=>p(!1),onChanged:()=>{J(),t()}}),U&&n&&i.jsx(sq,{row:U,source:B1(n,U),status:n,accounts:e,now:O,busy:c,onClose:()=>Y(null),onRename:ce=>L(U.fp,ce),onCheck:()=>K(U.fp),onVerb:()=>{switch(U.kind){case"paired":return X("unpair",U.fp,"unpair that deck");case"nearby":return X("accept",U.fp,"reach that deck");case"declined":return X("allow",U.fp,"let that deck ask again");case"dialling":return G(U.fp);default:return Promise.resolve(null)}},onSettings:()=>{Y(null),p(!0)},twins:(U.twins??[]).map(ce=>({row:ce,peer:B1(n,ce).peer??null})),onUnpair:ce=>X("unpair",ce,"unpair that deck")})]})}const z1=15e3,kq=8e3,Uf=1800,_q=3e4,Nq=[70,80,85,90,95];function U1(e,t){return I2(t-Math.floor(e/1e3))}function Sq(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 jq(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 Eq(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 W1(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 H1({lane:e,nowSec:t}){const n=Math.min(100,Math.max(0,e.pct)),s=n>=90?"var(--err)":n>=70?"var(--warn)":"var(--accent)",a=e.resetAt?$2(e.resetAt,t):null;return i.jsxs("div",{className:"ap-lane",children:[i.jsx("span",{className:"ap-lane-label",children:e.label}),i.jsx("div",{className:"ap-lane-track",children:i.jsx("div",{className:"ap-lane-fill",style:{width:`${n===0?1.5:n}%`,background:s,opacity:n===0?.4:1}})}),i.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[n,"%"]}),i.jsx("span",{className:"ap-lane-reset",children:a?`resets ${a}`:""})]})}async function G1(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 Cq({onClose:e,leaving:t}){var et,ft,dt,ze,Xe;const[n,s]=x.useState(null),[a,l]=x.useState(null),[c,d]=x.useState(null),[h,p]=x.useState(!1),[f,m]=x.useState(null),[y,v]=x.useState(()=>Math.floor(Date.now()/1e3)),N=x.useRef(null),[_,S]=x.useState(null),[k,j]=x.useState(!1),[E,C]=x.useState(""),[T,R]=x.useState(null),[A,D]=x.useState(null),[O,$]=x.useState(null),[F,Z]=x.useState(!1),[J,I]=x.useState(!1),[X,G]=x.useState(null),[q,Y]=x.useState(null),[L,K]=x.useState(null),[P,V]=x.useState(null),[he,U]=x.useState(!1),W=x.useRef(null),ee=x.useRef(null),[H,ae]=x.useState([]),me=x.useRef(null),ge=x.useCallback(re=>Td(me.current)?(me.current=re,d(re),!0):!1,[]),Re=x.useCallback(()=>{me.current=null,d(null)},[]),$e=(re,Fe=!1)=>{const se=Ys(c,re);return{disabled:se.disabled,"aria-busy":se.busy||Fe}},ce=x.useCallback(re=>{window.requestAnimationFrame(()=>{var Fe;if(V5(((Fe=document.activeElement)==null?void 0:Fe.tagName)??null))for(const se of G5(re)){const Ce=document.querySelector(se);if(Ce){Ce.focus();return}}})},[]),we=x.useCallback(async(re=!1)=>{re&&p(!0);const Fe=new AbortController,se=window.setTimeout(()=>Fe.abort(),_q);try{const[Ce,Ve]=await Promise.all([fetch(`/api/claude-accounts${re?"?refresh=1":""}`,{signal:Fe.signal}),fetch("/api/cswap-auto",{signal:Fe.signal})]);if(Ce.ok){const xt=await Ce.json();s(xt),ae(Te=>C6(Te,xt.accounts))}Ve.ok&&l(await Ve.json());const gt=M6([await A1(Ce),await A1(Ve)]);m(xt=>R1(xt,gt))}catch{m(Ce=>R1(Ce,R6))}finally{window.clearTimeout(se),re&&p(!1)}},[]),xe=x.useCallback(async(re,Fe)=>{if(!ge(Fe))return null;m(null);try{const Ce=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)})).json().catch(()=>null);return Ce!=null&&Ce.ok||m({text:Dv(Ce,"command failed"),raw:fi(Ce)}),Ce}catch{return m({text:"server unreachable"}),null}finally{Re()}},[ge,Re]),De=x.useCallback(async(re,Fe)=>{if(!ge(Fe))return null;m(null);try{const Ce=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)})).json().catch(()=>null);return Ce!=null&&Ce.ok||m({text:ni(Ce,"command failed")}),Ce}catch{return m({text:"server unreachable"}),null}finally{Re()}},[ge,Re]);x.useEffect(()=>(we(!0),N.current=window.setInterval(()=>we(!1),z1),()=>{N.current!=null&&window.clearInterval(N.current)}),[we]),x.useEffect(()=>{const re=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(re)},[]);const _e=((et=a==null?void 0:a.settings["autoswitch.threshold"])==null?void 0:et.value)??"90",Ee=P??_e,Ge=_6(Ee,_e),st=(ft=n==null?void 0:n.accounts)==null?void 0:ft.find(re=>re.active),Je=((dt=T1((st==null?void 0:st.lanes)??[]).peak)==null?void 0:dt.pct)??null,Ze=Je!=null&&Je>=Number(_e)-15,Qe=async re=>{if(ge(`switch-${re}`)){m(null);try{const se=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:re})})).json().catch(()=>null);se!=null&&se.ok||m({text:Dv(se,"the switch failed"),raw:fi(se)}),await we(!0)}catch{m({text:"server unreachable"})}finally{Re(),ce(re)}}},fe=async(re,Fe)=>{const{commit:se,alias:Ce}=A6(E,Fe);if(se){const Ve=await De({action:"alias",account:re,alias:Ce},`alias-${re}`);if(await we(!0),!(Ve!=null&&Ve.ok))return;C(Ce)}R(re),window.setTimeout(()=>R(Ve=>Ve===re?null:Ve),Uf)},ye=async(re,Fe)=>{const se=await De({action:"move",account:re,slot:Fe},`move-${re}`),Ce=x6({menuFor:_,shareFor:(O==null?void 0:O.num)??null},re,se);if(await we(!0),Ce){S(Ce.menuFor),D(Ce.confirmRemove),Ce.shareFor==null&&($(null),I(!1)),G(Ce.swapNote);const Ve=Ce.swapNote;Ve&&window.setTimeout(()=>G(gt=>gt===Ve?null:gt),kq),Y(null),ce(Ce.menuFor)}return se},Se=async(re,Fe,se)=>{if(se.sends){const Ce=await ye(re,Fe);if(!(Ce!=null&&Ce.ok))return}K(re),window.setTimeout(()=>K(Ce=>Ce===re?null:Ce),Uf)},Pe=async(re,Fe)=>{if(Fe.sends){const se=await xe({action:"setting",key:"autoswitch.threshold",value:re},"threshold");if(await we(!0),!(se!=null&&se.ok))return;V(null)}U(!0),window.setTimeout(()=>{var se;document.activeElement===ee.current&&((se=W.current)==null||se.focus()),U(!1)},Uf)};return i.jsxs("aside",{className:`accounts-panel${t?" leaving":""}`,id:"accounts-panel","aria-label":"Claude accounts",children:[i.jsxs("div",{className:"ap-header",children:[i.jsx("h2",{children:"Claude accounts"}),i.jsxs("div",{className:"ap-header-right",children:[i.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>j(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:i.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),(((ze=n==null?void 0:n.accounts)==null?void 0:ze.length)??0)>0&&i.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>Z(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${Gt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M3.3 10.7L10.7 3.3"}),i.jsx("path",{d:"M5.5 3.3h5.2v5.2"})]})}),i.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>we(!0),...$e("reload",h),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),i.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),i.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:i.jsx("path",{d:"M3.4 3.4l7.2 7.2M10.6 3.4l-7.2 7.2"})})})]})]}),n==null?f?i.jsxs("div",{className:"ap-empty",role:"alert",children:[i.jsx("span",{title:f.raw||void 0,children:f.text}),i.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",z1/1e3," seconds."]}),i.jsx("button",{type:"button",className:"ap-fix",disabled:h,onClick:()=>we(!0),children:h?"trying…":"try again"})]}):i.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?i.jsxs(i.Fragment,{children:[i.jsx("ul",{className:"ap-list",children:(Xe=n.accounts)==null?void 0:Xe.map(re=>{const{shown:Fe,rest:se,fuller:Ce,peak:Ve}=T1(re.lanes),gt=H.includes(Sx(re)),xt=N6(se.length,gt,Ce);return i.jsxs("li",{className:`ap-account${re.active?" active":""}`,children:[i.jsxs("div",{className:"ap-account-head",children:[i.jsx("span",{className:"ap-num",children:re.num}),re.alias&&i.jsx("span",{className:"ap-alias",title:re.alias,children:re.alias}),i.jsx("span",{className:"ap-email",title:re.email??void 0,children:re.email}),i.jsx("button",{type:"button",id:`ap-more-${re.num}`,className:`ap-more${_===re.num?" on":""}`,"aria-label":`Manage account ${re.num}`,"aria-expanded":_===re.num,"aria-controls":_===re.num?`ap-manage-${re.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{S(_===re.num?null:re.num),C(re.alias??""),D(null),$(null),I(!1),G(null),R(null),Y(null),K(null)},children:"⋯"}),re.active&&i.jsx("span",{className:"ap-badge-active",children:"active"}),re.disabled&&i.jsx("span",{className:"ap-badge-held",children:"held out"}),!re.active&&!re.disabled&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...$e(`switch-${re.num}`),onClick:()=>Qe(re.num),title:`Switch to ${re.alias??re.email}`,children:c===`switch-${re.num}`?"…":"switch"})]}),i.jsx("div",{className:"ap-lanes",id:`ap-lanes-${re.num}`,children:Fe.length?i.jsxs(i.Fragment,{children:[Fe.map(Te=>i.jsx(H1,{lane:Te,nowSec:y},Te.id)),gt&&se.map(Te=>i.jsx(H1,{lane:Te,nowSec:y},Te.id))]}):i.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),i.jsxs("div",{className:"ap-meta",children:[re.staleCopy&&(()=>{const Te=jq(re.repair??null,y);return i.jsx("span",{className:"ap-stale-copy",title:Te.hint,children:Te.text})})(),re.stopped&&(()=>{const Te=W1(re.collector??null);return i.jsx("span",{className:"ap-stopped",title:(Te==null?void 0:Te.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.",children:(Te==null?void 0:Te.text)??"not collecting"})})(),re.stopped&&(()=>{var tt;const Te=(tt=W1(re.collector??null))==null?void 0:tt.fix;return Te?i.jsx("button",{type:"button",className:"ap-fix",onClick:()=>j(!0),title:"Open the sign-in dialog. Signing in as this account puts its login in this slot.",children:Te}):null})(),re.error&&(()=>{const Te=Eq(re.error);return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"ap-err",title:Te.hint,children:Te.text}),Te.fixable&&i.jsx("button",{type:"button",className:"ap-fix",onClick:()=>j(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),xt&&i.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":gt,"aria-controls":`ap-lanes-${re.num}`,title:S6(re.headroom,(Ve==null?void 0:Ve.label)??null,se.length,gt),onClick:()=>ae(Te=>E6(Te,re)),children:xt}),(((a==null?void 0:a.enabled)||(a==null?void 0:a.external))&&!re.active||re.disabled)&&i.jsx("button",{type:"button",className:"ap-rotate",...$e(`rot-${re.num}`),onClick:()=>xe({action:"account",account:re.num,enabled:re.disabled},`rot-${re.num}`).then(()=>we(!0)),title:re.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:re.disabled?"put back":"hold out"}),re.fetchedAt?i.jsxs("span",{className:`ap-age${re.stale&&!re.stopped&&!re.error?" 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 ",U1(re.fetchedAt,y),Sq(re.nextAt,y)]}):i.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),_===re.num&&i.jsxs("div",{className:"ap-manage",id:`ap-manage-${re.num}`,role:"group","aria-label":`Manage account ${re.num}`,children:[i.jsxs("div",{className:"ap-manage-name",children:[i.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${re.num}`,children:"Alias"}),i.jsx("input",{id:`ap-alias-${re.num}`,className:"ap-manage-input",type:"text",value:E,onChange:Te=>C(Te.target.value),onKeyDown:Te=>{Te.key==="Enter"&&fe(re.num,re.alias)},maxLength:T6,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),i.jsx("button",{type:"button",className:"ap-manage-btn",...$e(`alias-${re.num}`),onClick:()=>fe(re.num,re.alias),title:"A short name to show instead of the email",children:T===re.num?"saved":"save"})]}),(()=>{const Te=v6((n.accounts??[]).map(wt=>wt.num),re.num),tt=b6(Te,q,re.num),pt=k6(Te,tt,re.num);return i.jsxs("div",{className:"ap-manage-slot",children:[i.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${re.num}`,children:"Slot"}),i.jsx("span",{className:"ap-field",children:i.jsx("select",{id:`ap-slot-${re.num}`,value:String(tt),...$e(`move-${re.num}`),onChange:wt=>Y(Number(wt.target.value)),children:Te.map(wt=>i.jsx("option",{value:wt.slot,children:wt.label},wt.slot))})}),i.jsx("button",{type:"button",className:"ap-manage-btn",...$e(`move-${re.num}`),title:pt.title,onClick:()=>Se(re.num,tt,pt),children:L===re.num?pt.done:pt.label})]})})(),i.jsxs("div",{className:"ap-manage-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...$e(`share-${re.num}`),title:`Copy this account to another ${Gt}. 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:async()=>{I(!1);const Te=await De({action:"share",account:re.num},`share-${re.num}`);Te!=null&&Te.ok&&$({num:re.num,blob:Te.blob,expiresAt:Te.expiresAt})},children:"share"}),i.jsx("button",{type:"button",className:`ap-manage-btn danger${A===re.num?" armed":""}`,...$e(`rm-${re.num}`),title:A===re.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(A!==re.num){D(re.num),window.setTimeout(()=>D(Te=>Te===re.num?null:Te),4e3);return}D(null),De({action:"remove",account:re.num},`rm-${re.num}`).then(()=>{S(null),we(!0),ce(null)})},children:A===re.num?"confirm":"remove"})]}),(X==null?void 0:X.at)===re.num&&(()=>{var pt;const Te=(pt=n.accounts)==null?void 0:pt.find(wt=>wt.num===X.displaced),tt=(Te==null?void 0:Te.alias)??(Te==null?void 0:Te.email)??"the account that was there";return i.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${X.at} was taken, so the two accounts traded places: ${tt} now holds slot ${X.displaced}.`,children:["swapped with slot ",X.displaced]})})(),(O==null?void 0:O.num)===re.num&&(()=>{const Te=U2(O.expiresAt,y),tt=Te.tone==="gone";return i.jsxs("div",{className:`ap-share${tt?" expired":""}`,children:[i.jsx("code",{className:"ap-share-blob",children:O.blob}),i.jsxs("div",{className:"ap-share-foot",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...$e(`share-${re.num}`),onClick:async()=>{if(tt){I(!1);const pt=await De({action:"share",account:re.num},`share-${re.num}`);pt!=null&&pt.ok&&$({num:re.num,blob:pt.blob,expiresAt:pt.expiresAt});return}await G1(O.blob)&&(I(!0),window.setTimeout(()=>I(!1),1800))},children:tt?"make a new share":J?"copied":"copy"}),i.jsxs("span",{className:"ap-manage-hint",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[i.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",i.jsx("span",{className:`ap-share-expiry ${Te.tone}`,children:Te.text})]})]})]})})()]})]},re.num)})}),i.jsx("p",{className:"ap-footnote",title:"Anthropic's usage endpoint allows roughly 28–30 requests per hour per account, shared by every tool on this machine — polling it from here would rate-limit your account. So the deck never fetches: it asks claude-swap to collect while this panel is open, at most once every three minutes, and claude-swap decides whether that touches the network at all.",children:"These numbers only update while this panel is open."}),(a==null?void 0:a.ok)&&i.jsxs("div",{className:"ap-auto",children:[i.jsxs("div",{className:"ap-auto-head",children:[i.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),i.jsx("button",{type:"button",className:`ap-auto-state${a.enabled?" live":""}`,role:"switch","aria-checked":a.enabled,"aria-label":"Auto-switch",...$e("enable"),onClick:()=>xe({action:"enable",enabled:!a.enabled},"enable").then(()=>we(!0)),title:a.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit"})]}),i.jsxs("div",{className:"ap-auto-ctl",children:[Je!=null&&i.jsxs("span",{className:`ap-auto-now${Ze?" near":""}`,title:`The active account has used ${Math.round(Je)}% of its limit. Auto-switch trips at ${_e}%.`,children:[Math.round(Je),"%"]}),i.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:i.jsx("select",{ref:W,"aria-label":"Switch threshold",value:Ee,...$e("threshold"),onChange:re=>V(re.target.value),children:Nq.map(re=>i.jsxs("option",{value:re,children:[re,"%"]},re))})}),(Ge.sends||he)&&i.jsx("button",{ref:ee,type:"button",className:"ap-manage-btn",...$e("threshold"),title:Ge.title,onClick:()=>Pe(Ee,Ge),children:he&&!Ge.sends?Ge.done:Ge.label})]}),a.external&&i.jsxs("p",{className:"ap-auto-note",children:[i.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",i.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",a.enabled?" — this toggle takes over when you stop it.":"."]}),a.lastTick&&i.jsx("div",{className:"ap-auto-foot",children:i.jsxs("span",{className:"ap-auto-result",children:["checked ",U1(a.lastTick.at,y)]})})]}),f&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",title:f.raw||void 0,children:f.text}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),i.jsx(bq,{accounts:((n==null?void 0:n.accounts)??[]).map(re=>({key:`${String(re.email??"").trim().toLowerCase()}@@${re.orgUuid??""}`,email:re.email??"",alive:re.alive===!0})),onChanged:()=>we(!0)})]}):i.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"claude-swap isn't installed."}),i.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),n.hint&&i.jsx("code",{className:"ap-cmd",children:n.hint}),i.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",i.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"No accounts added yet."}),i.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",i.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"Couldn't read the account store."}),i.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})}),k&&i.jsx(m6,{onClose:()=>j(!1),onChanged:()=>we(!0)}),F&&i.jsx(w6,{accounts:((n==null?void 0:n.accounts)??[]).map(re=>({num:re.num,email:re.email,alias:re.alias,org:re.org})),onClose:()=>Z(!1),copyText:G1})]})}const Tq=3e4;function Aq({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function Rq({bundle:e,running:t,pending:n,lastTried:s}){return t?Aq({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function Mq(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function Iq({asked:e,reported:t}){return t?t!==e:!1}function K2(e){const t=e.thresholdMs??Tq;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 $q(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 Oq(e,t){return e?t==null?"auto when idle":`auto in ${$q(t)}`:"auto-restart off"}function V1(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function Pq(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 Lq(e){const t=K2(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 Dq(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function qq(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 Fq(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function Bq(e,t){const n=Fq(e),s=n?`removes ${n} on the canvas`:null,a=d=>`This ${s?`${s} and ${d}`:d}`;if(!t)return{note:`${a("deletes 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. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.path)return{note:`${a("leaves nothing on disk — this deck keeps no event log")}. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.mine){const d=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,h=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${a(`leaves the event log alone: ${d}${h}`)}. Clearing here empties this canvas only — restart this deck and the log replays back onto it. Layout, pins and selection go with it.`,confirm:"Clear this canvas"}}if(t.decks<=1)return{note:`${a("deletes this deck's event log")} — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};const l=t.decks-1,c=l===1?"That deck keeps what is on its canvas until it restarts, and then it is gone there too.":"Those decks keep what is on their canvases until they restart, and then it is gone there too.";return{note:`${a(`deletes the event log ${l===1?"1 other running deck shares":`${l} other running decks share`} with this one`)} — every session recorded in it, not just the ones drawn here. ${c} This cannot be undone.`,confirm:"Clear everything"}}function zq({agentCount:e,onConfirm:t,onCancel:n}){const s=x.useRef(null),a=Vt(n,{focusRef:s,layer:s4}),[l,c]=x.useState(null);x.useEffect(()=>{let p=!1;return fetch("/api/clear").then(f=>f.ok?f.json():null).then(f=>{p||c(qq(f))}).catch(()=>{}),()=>{p=!0}},[]);const{note:d,confirm:h}=Bq(e,l);return i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{className:"status-dot err","aria-hidden":!0}),i.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsx("p",{className:"modal-note",children:d}),i.jsxs("div",{className:"cc-actions",children:[i.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),i.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const Uq="One-key shortcuts run when nothing on the page has focus. A focused control keeps its own keys — this sheet included, which takes the keyboard while it is open — so Esc is the way back to the canvas.",Wq=[{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:"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:"?",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 Hq({onClose:e,onTour:t}){const n=Vt(e);return i.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:i.jsxs("div",{ref:n,className:"modal key-help",onClick:s=>s.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsx("p",{className:"modal-note",children:Uq}),t&&i.jsxs("div",{className:"guide-door",children:[i.jsx("span",{children:"Eight pictures of what the deck shows."}),i.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),i.jsx("div",{className:"shortcuts",children:Wq.map(s=>i.jsxs(x.Fragment,{children:[i.jsx("h3",{className:"kh-group",children:s.title}),s.rows.map(a=>i.jsxs("div",{className:"sc",children:[i.jsx("kbd",{children:a.cap}),i.jsx("span",{children:a.action})]},`${s.title}:${a.cap}:${a.action}`))]},s.title))})]})]})})}const Gq=["done","needs-input"],Vq=[{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}]}],Yq=[{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}]}],Rx={done:Vq,"needs-input":Yq},pi="two";function Uv(e,t){const n=Rx[e];return n.find(s=>s.id===t)??n.find(s=>s.id===pi)??n[0]}function X2(e,t){return Rx[e].some(s=>s.id===t)?t:pi}Uv("done",pi).notes,Uv("needs-input",pi).notes;const Y1=.04,Kq=.24,Qu=0,md=100,Wv=5,Ul=50;function Wl(e){if(!Number.isFinite(e))return Ul;const t=Math.round(e/Wv)*Wv;return Math.min(md,Math.max(Qu,t))}function Xq(e){if(e==null)return Ul;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?Wl(Number(t)):Ul}function Qq(e){const t=Wl(e),n=Y1+(Kq-Y1)*(t/md);return Math.round(n*1e4)/1e4}function Zq(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(Qq(e)*s*1e4)/1e4}const Jq=160,eF="agent-dag.soundLevel.done",tF="agent-dag.soundLevel.needs-input",nF="agent-dag.soundFigure.done",rF="agent-dag.soundFigure.needs-input",Q2={done:eF,"needs-input":tF},Z2={done:nF,"needs-input":rF},Hv={done:{level:Ul,figure:pi},"needs-input":{level:Ul,figure:pi}};function sF(e){const t=n=>({level:Xq(e(Q2[n])),figure:X2(n,e(Z2[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const aF={Stop:"done",Notification:"needs-input"};function oF(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:aF[n]??null}function iF(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",l=()=>{var h;return(h=e.onState)==null?void 0:h.call(e,a())};function c(){var h;if(!(!t||s))try{n=n??new t,(h=n.resume)==null||h.call(n).then(l,()=>{}),s=!0,l()}catch{}}function d(h,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const f=(((N=e.prefs)==null?void 0:N.call(e))??Hv)[h]??Hv[h],m=Uv(h,f.figure),y=Zq(f.level,m),v=n.currentTime;for(const _ of m.notes){const S=n.createOscillator(),k=n.createGain();S.type=m.type??"sine",S.frequency.value=_.hz;const j=v+_.at,E=j+_.ms/1e3;k.gain.setValueAtTime(1e-4,j),k.gain.exponentialRampToValueAtTime(y,j+.012),k.gain.exponentialRampToValueAtTime(1e-4,E),S.connect(k).connect(n.destination),S.start(j),S.stop(E+.02)}return!0}return{unlock:c,play:d,state:a,get context(){return n}}}const lF="Notify me when a session needs my attention.",cF="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",K1="Get notified when you're away from this tab.";function uF(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:K1};case"default":return{status:null,ask:!0,ok:!1,note:K1};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 X1={done:"Turn finished","needs-input":"Claude is asking"},dF={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function hF({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:a,onFigure:l,onPreview:c,openerRef:d,notifyOn:h,onToggleNotify:p,notifyVetoed:f,notifyPermission:m,onAskNotify:y}){const v=uF(m),N=h&&!f,_=Vt(e),S=x.useRef(e);return S.current=e,x.useEffect(()=>{const k=j=>{var C,T;const E=j.target;E&&((C=_.current)!=null&&C.contains(E)||(T=d.current)!=null&&T.contains(E)||S.current())};return window.addEventListener("pointerdown",k,!0),()=>window.removeEventListener("pointerdown",k,!0)},[_,d]),i.jsxs("div",{ref:_,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[i.jsxs("div",{className:"sm-switches",children:[i.jsxs("label",{className:"sm-switch",children:[i.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),i.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-labelledby":"sm-sound-label",className:"sm-toggle",onClick:n,title:"A tone when a turn finishes, and when Claude asks for something",children:i.jsx("span",{className:"sm-toggle-knob"})})]}),i.jsxs("div",{className:"sm-setting",children:[i.jsxs("label",{className:"sm-switch",children:[i.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),i.jsx("button",{type:"button",role:"switch","aria-checked":h,"aria-labelledby":"sm-notify-label",className:"sm-toggle",onClick:p,title:"A system notification when a session blocks on you",children:i.jsx("span",{className:"sm-toggle-knob"})})]}),i.jsx("p",{className:"sm-note",children:f?cF:lF})]})]}),N&&i.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[i.jsxs("div",{className:"sm-channel-head",children:[i.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),v.ask?i.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:y,children:"Enable"}):i.jsxs("span",{className:"sm-channel-state","data-ok":v.ok||void 0,children:[v.ok&&i.jsx("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),v.status]})]}),i.jsx("p",{className:"sm-note",children:v.note})]}),!t&&i.jsx("span",{id:"sm-preview-note",className:"vis-hidden",children:"Plays even when Sounds is off, so you can set a tone before turning sounds back on."}),i.jsx("div",{className:"sm-tones",children:Gq.map(k=>{const j=s[k],E=`sm-level-${k}`,C=`sm-figure-${k}`;return i.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${k}`,children:[i.jsxs("div",{className:"sm-tone-head",children:[i.jsx("h3",{className:"sm-tone-name",id:`sm-name-${k}`,children:X1[k]}),i.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(k),"aria-label":`Hear the ${X1[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:[i.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:i.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),i.jsxs("div",{className:"sm-row",children:[i.jsx("label",{htmlFor:E,children:"Volume"}),i.jsx("input",{id:E,type:"range",min:Qu,max:md,step:Wv,value:j.level,onChange:T=>a(k,Number(T.target.value)),style:{"--sm-level":`${(j.level-Qu)/(md-Qu)*100}%`}}),i.jsxs("span",{className:"sm-read",children:[j.level,"%"]})]}),i.jsxs("div",{className:"sm-row",children:[i.jsx("label",{htmlFor:C,children:"Tone"}),i.jsx("select",{id:C,className:"sm-select",value:j.figure,onChange:T=>l(k,T.target.value),children:Rx[k].map(T=>i.jsx("option",{value:T.id,children:T.label},T.id))})]}),i.jsx("p",{className:"sm-note",children:dF[k]})]},k)})}),i.jsxs("p",{className:"sm-foot",children:[i.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const fF=15e3;function pF(e){return e.visibilityState==="visible"&&e.hasFocus()}function mF(e,t){return t||e===!0}function gF(){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 yF={"//":["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."],"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.
|
|
82
82
|
|
|
83
83
|
\`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.
|
|
84
84
|
|
|
@@ -258,17 +258,17 @@ While it is open it polls this machine once every few seconds, and it stops the
|
|
|
258
258
|
|
|
259
259
|
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.
|
|
260
260
|
|
|
261
|
-
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.`}]},Rx="agent-dag.releaseNotesSeen";function K1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function fi(e,t){const n=K1(e),s=K1(t);for(let a=0;a<Math.max(n.length,s.length);a++){const l=(n[a]??0)-(s[a]??0);if(l!==0)return l<0?-1:1}return 0}function pi(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function wF(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 vF(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!pi(n)||!Array.isArray(s))continue;const a=s.filter(wF);a.length&&t.push({version:n,notes:a})}return t.sort((n,s)=>fi(s.version,n.version))}const X1=vF(yF);function Z2(e,t,n){return e.filter(s=>fi(s.version,n)<=0&&(t===null||fi(s.version,t)>0))}function xF(e,t){return e.filter(n=>fi(n.version,t)===0)}function bF(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 kF({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&&pi(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(!pi(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const l=fi(a,t);return l<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:l>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const _F=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function NF(e){const t=_F.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function Q1(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function SF(e){if(!e)return null;let t=null;try{t=e.getItem(Rx)}catch{return null}return pi(t)?t:null}function jF(e){if(!e)return!1;try{return e.getItem(Rx),!0}catch{return!1}}function EF(e,t){if(!e)return!1;try{return e.setItem(Rx,t),!0}catch{return!1}}const J2="agent-dag.tourSeen";function CF(e){if(!e)return!1;try{return e.getItem(J2)==="1"}catch{return!1}}function TF(e){if(!e)return!1;try{return e.setItem(J2,"1"),!0}catch{return!1}}function AF({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 RF({stored:e,running:t,notes:n,remembers:s=!0}){if(!pi(t))return{show:[],record:null,reason:"no-version"};if(!pi(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const c=xF(n,t);return c.length?{show:c,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=fi(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const l=Z2(n,e,t);return l.length?{show:l,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function MF(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 eA(e,t=!0){const n=[];let s="";const a=()=>{s&&(n.push({kind:"text",text:s}),s="")};let l=0;for(;l<e.length;){if(e[l]==="`"){const c=e.indexOf("`",l+1);if(c>l+1){a(),n.push({kind:"code",text:e.slice(l+1,c)}),l=c+1;continue}}else if(t&&e.startsWith("**",l)){const c=MF(e,l);if(c>0){a(),n.push({kind:"bold",kids:eA(e.slice(l+2,c),!1)}),l=c+2;continue}}s+=e[l],l+=1}return a(),n}function IF({entries:e,since:t,running:n,firstRun:s,onClose:a,onTour:l}){const c=Vt(a),d=bF(e);return i.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:i.jsxs("div",{ref:c,className:"modal release-notes",onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),d&&i.jsx("span",{className:"modal-tool-id",children:d})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsx("p",{className:"modal-note",children:kF({since:t,running:n,firstRun:s,entries:e})}),l&&i.jsxs("div",{className:"guide-door",children:[i.jsx("span",{children:"Eight pictures of what the deck shows."}),i.jsx("button",{type:"button",className:"btn",onClick:l,children:"Take the tour"})]}),e.map(h=>i.jsxs("section",{className:"modal-section",children:[i.jsxs("h3",{className:"rn-version",children:["v",h.version]}),i.jsx("ul",{className:"rn-notes",children:h.notes.map((p,f)=>{const{icon:m,rest:y}=NF(p.title);return i.jsxs("li",{className:"rn-note",children:[i.jsxs("p",{className:"rn-note-title",children:[m&&i.jsx("span",{className:"rn-note-icon",children:m}),y]}),i.jsx("p",{className:"rn-note-body",children:tA(eA(p.body))})]},f)})})]},h.version))]})]})})}function tA(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?i.jsx("code",{className:"rn-code",children:t.text},n):i.jsx("strong",{className:"rn-strong",children:tA(t.kids)},n))}function $F(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function OF(e,t,n){var c;if(e.length===0)return null;const s=$F(e),a=t?s.findIndex(d=>d.id===t):-1,l=a===-1?n===1?0:s.length-1:(a+n+s.length)%s.length;return((c=s[l])==null?void 0:c.id)??null}const PF=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function LF(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:PF.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const DF=new Set(["","BODY","HTML","#DOCUMENT"]);function qF(e){return!e||xx(e)?!1:!DF.has(String(e.tagName??"").toUpperCase())}function Pu(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function FF(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 BF(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function zF(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 l=!0;for(;l;){l=!1;for(const c of e.agents.values())c.parentId&&s.has(c.parentId)&&!s.has(c.id)&&(s.add(c.id),l=!0)}return s}function UF(e,t){const n=new Set;for(const s of t){const a=zF(e,s);if(a)for(const l of a)n.add(l)}return n.size>0?n:null}function Gv(e,t,n){return!t.has(e)||n.has(e)}function WF(e,t,n,s){return!t.has(e)&&Gv(e,n,s)}function HF(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function GF(e,t,n,s){n.set(e,t),s.delete(e)}const VF=40,YF=120;function KF(e,t){let n=null,s=0,a=Number.NEGATIVE_INFINITY;const l=()=>{n=null,a=t.now(),e()},c=()=>{n!=null&&(t.clearTimeout(n),n=null)},d=(h,p,f)=>{if(n!=null){if(s<=h)return;c()}const m=Math.min(f,Math.max(0,h-p));s=h,n=t.setTimeout(l,m)};return{live(h=VF){const p=t.now(),f=Math.max(a+h,p);if(f<=p){c(),l();return}d(f,p,h)},replay(h=YF){c(),s=t.now()+h,n=t.setTimeout(l,h)},flush(){c(),l()},cancel(){c()}}}const XF=1e3;function QF(e={}){const t=Math.max(1,Math.floor(e.limit??XF)),n=e.protect;let s=!1,a=[],l=new Set,c=0,d=0,h=null;return{get paused(){return s},get size(){return a.length},get dropped(){return c},get overflowed(){return c>0},get through(){return d},accept(p){const f=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,m=(p==null?void 0:p.epoch)??null,y=m!==null&&m!==h;y&&(h=m,d=0);const v=f!==null&&!y&&f<=d;if(f!==null&&f>d&&(d=f),!s)return!0;if(v)return!1;if(a.push(p),n!=null&&n(p)&&l.add(p),a.length>t){let N=0;if(l.size<a.length)for(;l.has(a[N]);)N++;const[_]=a.splice(N,1);l.delete(_),c++}return!1},setPaused(p){if(s=p,p)return[];const f=a;return a=[],l=new Set,c=0,f}}}const nA="agent-dag.theme";function ZF(e){return e==="light"?"light":"dark"}function JF(){return ZF(gi(nA))}function e8({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${Gt}`:Gt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const Lu={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Du(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 t8=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Du(Lu.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Du(Lu.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Du(Lu.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Du(Lu.idle,"idle"))}`}),n8="No sessions are waiting for you.";function r8(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 s8(e,t){return t!==""?t:e===""?"":n8}function a8(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function o8(e){return!e.answer||e.answer.range!==e.want?{phase:"busy",stale:!1}:e.answer.ok?{phase:e.answer.days>0?"chart":"empty",stale:e.loading}:{phase:"error",stale:e.loading}}function i8(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const Z1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function Mx(e){const t=e.toLowerCase();return Object.hasOwn(Z1,t)?Z1[t]:t?t[0].toUpperCase()+t.slice(1):""}function l8(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function c8(e,t=[]){const n=t.length?l8(t.map(Mx)):i8(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function u8(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 d8(e,t){const n=t.prefs??Hv,s=Ul(n.done.level),a=Ul(n["needs-input"].level),l=s===a?`${s}%`:`${s}% and ${a}%`,c=t.on?`Sound: on at ${l} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",d=e.codex?`
|
|
261
|
+
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.`}]},Mx="agent-dag.releaseNotesSeen";function Q1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function mi(e,t){const n=Q1(e),s=Q1(t);for(let a=0;a<Math.max(n.length,s.length);a++){const l=(n[a]??0)-(s[a]??0);if(l!==0)return l<0?-1:1}return 0}function gi(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function wF(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 vF(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!gi(n)||!Array.isArray(s))continue;const a=s.filter(wF);a.length&&t.push({version:n,notes:a})}return t.sort((n,s)=>mi(s.version,n.version))}const Z1=vF(yF);function J2(e,t,n){return e.filter(s=>mi(s.version,n)<=0&&(t===null||mi(s.version,t)>0))}function xF(e,t){return e.filter(n=>mi(n.version,t)===0)}function bF(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 kF({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&&gi(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(!gi(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const l=mi(a,t);return l<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:l>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const _F=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function NF(e){const t=_F.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function J1(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function SF(e){if(!e)return null;let t=null;try{t=e.getItem(Mx)}catch{return null}return gi(t)?t:null}function jF(e){if(!e)return!1;try{return e.getItem(Mx),!0}catch{return!1}}function EF(e,t){if(!e)return!1;try{return e.setItem(Mx,t),!0}catch{return!1}}const eA="agent-dag.tourSeen";function CF(e){if(!e)return!1;try{return e.getItem(eA)==="1"}catch{return!1}}function TF(e){if(!e)return!1;try{return e.setItem(eA,"1"),!0}catch{return!1}}function AF({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 RF({stored:e,running:t,notes:n,remembers:s=!0}){if(!gi(t))return{show:[],record:null,reason:"no-version"};if(!gi(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const c=xF(n,t);return c.length?{show:c,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=mi(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const l=J2(n,e,t);return l.length?{show:l,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function MF(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 tA(e,t=!0){const n=[];let s="";const a=()=>{s&&(n.push({kind:"text",text:s}),s="")};let l=0;for(;l<e.length;){if(e[l]==="`"){const c=e.indexOf("`",l+1);if(c>l+1){a(),n.push({kind:"code",text:e.slice(l+1,c)}),l=c+1;continue}}else if(t&&e.startsWith("**",l)){const c=MF(e,l);if(c>0){a(),n.push({kind:"bold",kids:tA(e.slice(l+2,c),!1)}),l=c+2;continue}}s+=e[l],l+=1}return a(),n}function IF({entries:e,since:t,running:n,firstRun:s,onClose:a,onTour:l}){const c=Vt(a),d=bF(e);return i.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:i.jsxs("div",{ref:c,className:"modal release-notes",onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),d&&i.jsx("span",{className:"modal-tool-id",children:d})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsx("p",{className:"modal-note",children:kF({since:t,running:n,firstRun:s,entries:e})}),l&&i.jsxs("div",{className:"guide-door",children:[i.jsx("span",{children:"Eight pictures of what the deck shows."}),i.jsx("button",{type:"button",className:"btn",onClick:l,children:"Take the tour"})]}),e.map(h=>i.jsxs("section",{className:"modal-section",children:[i.jsxs("h3",{className:"rn-version",children:["v",h.version]}),i.jsx("ul",{className:"rn-notes",children:h.notes.map((p,f)=>{const{icon:m,rest:y}=NF(p.title);return i.jsxs("li",{className:"rn-note",children:[i.jsxs("p",{className:"rn-note-title",children:[m&&i.jsx("span",{className:"rn-note-icon",children:m}),y]}),i.jsx("p",{className:"rn-note-body",children:nA(tA(p.body))})]},f)})})]},h.version))]})]})})}function nA(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?i.jsx("code",{className:"rn-code",children:t.text},n):i.jsx("strong",{className:"rn-strong",children:nA(t.kids)},n))}function $F(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function OF(e,t,n){var c;if(e.length===0)return null;const s=$F(e),a=t?s.findIndex(d=>d.id===t):-1,l=a===-1?n===1?0:s.length-1:(a+n+s.length)%s.length;return((c=s[l])==null?void 0:c.id)??null}const PF=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function LF(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:PF.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const DF=new Set(["","BODY","HTML","#DOCUMENT"]);function qF(e){return!e||xx(e)?!1:!DF.has(String(e.tagName??"").toUpperCase())}function Pu(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function FF(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 BF(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function zF(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 l=!0;for(;l;){l=!1;for(const c of e.agents.values())c.parentId&&s.has(c.parentId)&&!s.has(c.id)&&(s.add(c.id),l=!0)}return s}function UF(e,t){const n=new Set;for(const s of t){const a=zF(e,s);if(a)for(const l of a)n.add(l)}return n.size>0?n:null}function Gv(e,t,n){return!t.has(e)||n.has(e)}function WF(e,t,n,s){return!t.has(e)&&Gv(e,n,s)}function HF(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function GF(e,t,n,s){n.set(e,t),s.delete(e)}const VF=40,YF=120;function KF(e,t){let n=null,s=0,a=Number.NEGATIVE_INFINITY;const l=()=>{n=null,a=t.now(),e()},c=()=>{n!=null&&(t.clearTimeout(n),n=null)},d=(h,p,f)=>{if(n!=null){if(s<=h)return;c()}const m=Math.min(f,Math.max(0,h-p));s=h,n=t.setTimeout(l,m)};return{live(h=VF){const p=t.now(),f=Math.max(a+h,p);if(f<=p){c(),l();return}d(f,p,h)},replay(h=YF){c(),s=t.now()+h,n=t.setTimeout(l,h)},flush(){c(),l()},cancel(){c()}}}const XF=1e3;function QF(e={}){const t=Math.max(1,Math.floor(e.limit??XF)),n=e.protect;let s=!1,a=[],l=new Set,c=0,d=0,h=null;return{get paused(){return s},get size(){return a.length},get dropped(){return c},get overflowed(){return c>0},get through(){return d},accept(p){const f=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,m=(p==null?void 0:p.epoch)??null,y=m!==null&&m!==h;y&&(h=m,d=0);const v=f!==null&&!y&&f<=d;if(f!==null&&f>d&&(d=f),!s)return!0;if(v)return!1;if(a.push(p),n!=null&&n(p)&&l.add(p),a.length>t){let N=0;if(l.size<a.length)for(;l.has(a[N]);)N++;const[_]=a.splice(N,1);l.delete(_),c++}return!1},setPaused(p){if(s=p,p)return[];const f=a;return a=[],l=new Set,c=0,f}}}const rA="agent-dag.theme";function ZF(e){return e==="light"?"light":"dark"}function JF(){return ZF(wi(rA))}function e8({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${Gt}`:Gt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const Lu={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Du(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 t8=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Du(Lu.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Du(Lu.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Du(Lu.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Du(Lu.idle,"idle"))}`}),n8="No sessions are waiting for you.";function r8(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 s8(e,t){return t!==""?t:e===""?"":n8}function a8(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function o8(e){return!e.answer||e.answer.range!==e.want?{phase:"busy",stale:!1}:e.answer.ok?{phase:e.answer.days>0?"chart":"empty",stale:e.loading}:{phase:"error",stale:e.loading}}function i8(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const e_={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function Ix(e){const t=e.toLowerCase();return Object.hasOwn(e_,t)?e_[t]:t?t[0].toUpperCase()+t.slice(1):""}function l8(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function c8(e,t=[]){const n=t.length?l8(t.map(Ix)):i8(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function u8(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 d8(e,t){const n=t.prefs??Hv,s=Wl(n.done.level),a=Wl(n["needs-input"].level),l=s===a?`${s}%`:`${s}% and ${a}%`,c=t.on?`Sound: on at ${l} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",d=e.codex?`
|
|
262
262
|
|
|
263
263
|
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.`:"",h=t.on&&t.locked?`
|
|
264
264
|
|
|
265
265
|
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+d+h+`
|
|
266
266
|
|
|
267
|
-
Click to set the volume and the sound of each tone, and to hear either one.`}function rA(e){const t=new Map;for(const n of e)for(const s of n.agents??[]){if(!s||typeof s.agent!="string"||s.agent==="")continue;const a=t.get(s.agent)??{id:s.agent,cost:0,tokens:0};a.cost+=Number.isFinite(s.totalCost)?s.totalCost:0,a.tokens+=Number.isFinite(s.totalTokens)?s.totalTokens:0,t.set(s.agent,a)}return[...t.values()].sort((n,s)=>s.cost-n.cost||n.id.localeCompare(s.id))}function h8(e){const t=rA([{agents:e}]);return t.length<2?null:t.map(n=>`${Mx(n.id)} ${at(n.cost)}`).join(" · ")}function J1(e){switch(e.toLowerCase()){case"claude":return"var(--usage-purple)";case"codex":return"var(--usage-orange)";case"gemini":return"var(--usage-indigo)";case"copilot":return"var(--usage-green)";default:return"var(--usage-zinc)"}}function f8(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function qu(e){const t=e.toLowerCase();return t.includes("opus")?"var(--usage-purple)":t.includes("sonnet")?"var(--usage-blue)":t.includes("haiku")?"var(--usage-green)":t.includes("gpt-5")||t.includes("gpt5")?"var(--usage-amber)":t.includes("gpt")?"var(--usage-red)":t.includes("gemini")?"var(--usage-indigo)":t.includes("codex")?"var(--usage-orange)":"var(--usage-zinc)"}const p8=[7,14,30,90];function m8(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),l=x.useState(a8)[0],c=x.useRef(!1),d=(h=!1)=>{if(h&&!fr(c.current))return;const p=l.begin();c.current=h;const f=e;a(!0);const y=`/api/ccusage?since=${Ov(f)}${h?"&refresh=1":""}`;fetch(y).then(v=>v.json()).then(v=>{p()&&n({range:f,resp:v})}).catch(()=>{p()&&n({range:f,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(c.current=!1,a(!1))})};return x.useEffect(()=>(d(!1),()=>l.cancel()),[e]),{landed:t,loading:s,reload:()=>d(!0)}}function g8({onClose:e,providers:t}){var D;const[n,s]=x.useState(30),[a,l]=x.useState(null),{landed:c,loading:d,reload:h}=m8(n),p=x.useRef(null),f=Vt(e,{focusRef:p}),m=o8({loading:d,want:n,answer:c&&{range:c.range,ok:c.resp.ok===!0,days:((D=c.resp.days)==null?void 0:D.length)??0}}),y=m.phase==="chart"?c.resp.days??[]:[],v=x.useMemo(()=>y.reduce((O,$)=>Math.max(O,$.totalCost),0),[y]),N=x.useRef(null);x.useLayoutEffect(()=>{const O=N.current;O&&(O.scrollLeft=O.scrollWidth)},[y]);const{totalCost:_,totalTok:S,inOut:k,cacheRead:j,modelCosts:E}=x.useMemo(()=>{let O=0,$=0,B=0,Z=0;const J=new Map;for(const I of y){O+=I.totalCost,$+=I.totalTokens,B+=I.inputTokens+I.outputTokens,Z+=I.cacheReadTokens;for(const X of I.modelBreakdowns)J.set(X.modelName,(J.get(X.modelName)??0)+X.cost)}return{totalCost:O,totalTok:$,inOut:B,cacheRead:Z,modelCosts:J}},[y]),C=x.useMemo(()=>Array.from(E.entries()).sort((O,$)=>$[1]-O[1]),[E]),T=x.useMemo(()=>rA(y),[y]),R=T.length>1,A=a?y.find(O=>O.period===a)??null:null;return i.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:i.jsxs("div",{ref:f,className:"uh-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[i.jsxs("header",{className:"uh-head",children:[i.jsxs("div",{className:"uh-titlewrap",children:[i.jsx("div",{className:"uh-title",children:"Usage history"}),i.jsx("div",{className:"uh-sub",children:c8(t,T.map(O=>O.id))})]}),i.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:p8.map(O=>i.jsxs("button",{type:"button","aria-pressed":n===O,className:"uh-range-btn",onClick:()=>{s(O),l(null)},children:[O,"d"]},O))}),i.jsx("button",{className:"glyph-btn uh-reload",onClick:h,...hr(d),title:"Re-run ccusage","aria-label":"Reload",children:d?"…":"↻"}),i.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),m.phase==="busy"?i.jsxs("div",{className:"uh-status uh-status-wait","aria-busy":"true",children:[i.jsx("span",{className:"uh-wait-word",children:c?"running ccusage…":"running ccusage… (first run downloads the package)"}),i.jsx("span",{className:"uh-wait-axis","aria-hidden":!0})]}):m.phase==="error"?i.jsxs("div",{className:"uh-status uh-err",title:di(c.resp)||void 0,children:[i6(c.resp,"ccusage did not report usage"),i.jsx("div",{children:i.jsx("button",{className:"btn uh-retry",onClick:h,...hr(d),children:d?"trying…":"Try again"})})]}):m.phase==="empty"?i.jsx("div",{className:`uh-status${m.stale?" uh-stale":""}`,"aria-busy":m.stale||void 0,children:"no usage in this range"}):i.jsxs("div",{className:m.stale?"uh-stale":void 0,"aria-busy":m.stale||void 0,children:[i.jsxs("div",{className:"uh-totals",children:[i.jsx(Fu,{label:"total cost",val:at(_),accent:!0}),i.jsx(Fu,{label:"tokens",val:Mt(S)}),i.jsx(Fu,{label:"input+output",val:Mt(k)}),i.jsx(Fu,{label:"cache reads",val:Mt(j)})]}),R&&i.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[i.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:T.map(O=>i.jsx("span",{className:"uh-agent-seg",style:{width:`${_>0?O.cost/_*100:0}%`,background:J1(O.id)}},O.id))}),i.jsx("div",{className:"uh-agent-keys",children:T.map(O=>i.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${Mt(O.tokens)} tokens`,children:[i.jsx("span",{className:"uh-legend-dot",style:{background:J1(O.id)}}),Mx(O.id),i.jsx("span",{className:"uh-agent-cost",children:at(O.cost)}),i.jsx("span",{className:"uh-agent-share",children:f8(O.cost,_)})]},O.id))})]}),i.jsx("div",{ref:N,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map((O,$)=>{const B=v>0?O.totalCost/v*100:0,Z=O.period===a,J=`${O.period}, ${at(O.totalCost)}`;return i.jsxs("button",{className:`uh-bar-col${Z?" sel":""}`,onClick:()=>l(Z?null:O.period),"aria-pressed":Z,"aria-label":J,title:`${O.period} · ${at(O.totalCost)}`,style:{flexBasis:`${100/y.length}%`,"--uh-i":$,"--uh-step":`${Math.min(10,200/Math.max(y.length,1))}ms`},children:[i.jsx("div",{className:"uh-bar",style:{height:`${Math.max(B,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort((I,X)=>X.cost-I.cost).map(I=>{const X=O.totalCost>0?I.cost/O.totalCost*100:0;return i.jsx("div",{className:"uh-bar-seg",style:{height:`${X}%`,background:qu(I.modelName)}},I.modelName)})}),i.jsx("span",{className:"uh-bar-label",children:O.period.slice(5)})]},O.period)})}),i.jsx("div",{className:"uh-legend",children:C.map(([O,$])=>i.jsxs("span",{className:"uh-legend-item",title:O,children:[i.jsx("span",{className:"uh-legend-dot",style:{background:qu(O)}}),Vs(O)," ",i.jsx("span",{className:"uh-legend-cost",children:at($)})]},O))}),A&&i.jsxs("div",{className:"uh-detail",children:[i.jsxs("div",{className:"uh-detail-head",children:[i.jsx("span",{className:"uh-detail-date",children:A.period}),i.jsx("span",{className:"uh-detail-cost",children:at(A.totalCost)}),(()=>{var B,Z;const $=h8(A.agents)??((Z=(B=A.metadata)==null?void 0:B.agents)!=null&&Z.length?A.metadata.agents.join(" · "):null);return $?i.jsx("span",{className:"uh-detail-agents",title:$,children:$}):null})()]}),i.jsxs("div",{className:"uh-detail-mini",children:[i.jsx(Bu,{label:"input",val:Mt(A.inputTokens)}),i.jsx(Bu,{label:"output",val:Mt(A.outputTokens)}),i.jsx(Bu,{label:"cache write",val:Mt(A.cacheCreationTokens)}),i.jsx(Bu,{label:"cache read",val:Mt(A.cacheReadTokens)})]}),i.jsx("div",{className:"uh-detail-models",children:A.modelBreakdowns.slice().sort((O,$)=>$.cost-O.cost).map(O=>{const $=A.totalCost>0?O.cost/A.totalCost*100:0;return i.jsxs("div",{className:"uh-model-row",title:O.modelName,children:[i.jsxs("span",{className:"uh-model-name",children:[i.jsx("span",{className:"uh-legend-dot",style:{background:qu(O.modelName)}}),i.jsx("span",{className:"uh-model-label",children:Vs(O.modelName)})]}),i.jsx("span",{className:"uh-model-bar",children:i.jsx("span",{className:"uh-model-bar-fill",style:{width:`${$}%`,background:qu(O.modelName)}})}),i.jsx("span",{className:"uh-model-cost",children:at(O.cost)})]},O.modelName)})})]})]})]})})}function Fu({label:e,val:t,accent:n}){return i.jsxs("div",{className:"uh-stat",children:[i.jsx("span",{className:`uh-stat-val${n?" accent":""}`,children:t}),i.jsx("span",{className:"uh-stat-label",children:e})]})}function Bu({label:e,val:t}){return i.jsxs("div",{className:"uh-ministat",children:[i.jsx("span",{className:"uh-ministat-val",children:t}),i.jsx("span",{className:"uh-ministat-label",children:e})]})}function y8(e){const t=/^#?([0-9a-f]{6})$/i.exec((e??"").trim());if(!t)return!1;const n=parseInt(t[1],16),s=[n>>16&255,n>>8&255,n&255].map(a=>{const l=a/255;return l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4)});return .2126*s[0]+.7152*s[1]+.0722*s[2]>.5}const e_=1e4,w8=12e3;function v8({browsers:e,findings:t,watching:n,palette:s,now:a=()=>Date.now()}){const l=x.useRef(null),c=x.useRef(null);return c.current={browsers:e,findings:t,watching:n},x.useEffect(()=>{var v;const d=l.current;if(!d)return;const h=d.getContext("2d");if(!h)return;const p=((v=window.matchMedia)==null?void 0:v.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let f=0,m=!1;const y=()=>{var q;if(m)return;const N=c.current;if(!N)return;const{browsers:_,findings:S,watching:k}=N,j=s["--accent"]||"#7dd3fc",E=s["--line"]||"#1f2229",C=s["--text-dim"]||"#6e727c",T=y8(s["--bg"]),R=T?42:26,A=T?.85:.65,D=a(),O=Math.min(window.devicePixelRatio||1,2),$=d.clientWidth,B=d.clientHeight;(d.width!==$*O||d.height!==B*O)&&(d.width=$*O,d.height=B*O),h.setTransform(O,0,0,O,0,0),h.clearRect(0,0,$,B);const Z=$/2,J=B/2,I=Math.min($,B)/2-6;h.strokeStyle=E,h.lineWidth=1,h.globalAlpha=T?1:.9;for(const Y of[.4,.7,1])h.beginPath(),h.arc(Z,J,I*Y,0,Math.PI*2),h.stroke();h.beginPath(),h.moveTo(Z-I,J),h.lineTo(Z+I,J),h.moveTo(Z,J-I),h.lineTo(Z,J+I),h.stroke(),h.globalAlpha=1;const G=(k&&!p?D%e_/e_:0)*Math.PI*2-Math.PI/2;if(k){const Y=(q=h.createConicGradient)==null?void 0:q.call(h,G-.85,Z,J);Y&&(Y.addColorStop(0,"transparent"),Y.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${j} ${R}%, transparent)`),Y.addColorStop(1,"transparent"),h.fillStyle=Y,h.beginPath(),h.moveTo(Z,J),h.arc(Z,J,I,G-.85,G),h.closePath(),h.fill()),h.strokeStyle=j,h.globalAlpha=A,h.beginPath(),h.moveTo(Z,J),h.lineTo(Z+Math.cos(G)*I,J+Math.sin(G)*I),h.stroke(),h.globalAlpha=1}_.forEach((Y,L)=>{const K=L/Math.max(_.length,1)*Math.PI*2-Math.PI/2,P=Y.lastReadMs===null?1:Math.min(1,(D-Y.lastReadMs)/12e4),V=I*(.42+P*.5),he=Z+Math.cos(K)*V,z=J+Math.sin(K)*V,W=Math.abs((G-K+Math.PI*3)%(Math.PI*2)-Math.PI),ee=k?Math.max(0,1-W/.55):0;h.beginPath(),h.arc(he,z,3+ee*1.6,0,Math.PI*2),h.fillStyle=Y.running?j:C,h.globalAlpha=Y.running?.55+ee*.45:.35,h.fill(),h.globalAlpha=1});for(const Y of S){const L=(D-Y.atMs)/w8;if(L<0||L>1)continue;const P=Math.max(0,_.findIndex(z=>z.key===Y.browser))/Math.max(_.length,1)*Math.PI*2-Math.PI/2,V=Z+Math.cos(P)*I*.6,he=J+Math.sin(P)*I*.6;h.beginPath(),h.arc(V,he,4+L*22,0,Math.PI*2),h.strokeStyle=j,h.globalAlpha=(1-L)*.8,h.lineWidth=1.5,h.stroke(),h.globalAlpha=1}f=requestAnimationFrame(y)};return y(),()=>{m=!0,cancelAnimationFrame(f)}},[a,s]),i.jsx("canvas",{ref:l,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const t_="agent-dag.browserWatch.seenMs";function x8(e,t){return e.filter(n=>n.startMs>t)}function b8(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function k8(e){const t=Math.ceil(e/1e3),n=Math.floor(t/60),s=t%60;return n>0?`${n}m ${s}s`:`${s}s`}function sA(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function n_(e,t){return t?{kind:"saving",word:"Saving",detail:""}:e.settings.enabled?{kind:"on",word:"Watching",detail:""}:{kind:"off",word:"Paused",detail:"nothing new is recorded"}}function _8(e,t){return e.map(n=>({key:n.key,name:n.name,running:n.running,visits:t.filter(s=>s.browser===n.key).reduce((s,a)=>s+a.programVisits,0)}))}function N8(e,t){if(e===null)return null;const n=Math.max(0,Math.round((t-e)/1e3));if(n<5)return"just now";if(n<60)return`${n} sec ago`;const s=Math.round(n/60);return s<60?`${s} min ago`:`${Math.round(s/60)} hr ago`}function S8(e){const t=e.profiles.filter(s=>s.degraded);if(t.length>0){const s=t[0],a=t.length-1;return{kind:"unreadable",text:`${s.name}/${s.profile} could not be read — ${s.reason??"no reason given"}`+(a>0?`, and ${a} more`:"")+". The watch continues on the profiles it can read."}}const n=sA(e.browsers);return n.length===0?{kind:"no-profiles",text:"No browser on this machine has a profile to read. Open one of the browsers below once and it will be watched from then on."}:n.some(s=>s.running)?null:{kind:"none-running",text:"No watched browser is running, so nothing can be navigated right now. Their history is still read, and anything found while they were open is still here."}}function j8(e){const t=n=>new Date(n).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return e.count===1||e.endMs-e.startMs<6e4?t(e.startMs):`${t(e.startMs)} → ${t(e.endMs)}`}function E8(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function r_(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function C8({onClose:e,onSeen:t,onWatching:n,palette:s}){const a=Vt(e),[l,c]=x.useState(null),[d,h]=x.useState(null),[p,f]=x.useState(null),[m,y]=x.useState(!1),v=x.useRef(!1),[N,_]=x.useState(null),[S,k]=x.useState(null),[j,E]=x.useState(!1),C=x.useRef(!1),[T,R]=x.useState(!1),[A,D]=x.useState(!1),[O,$]=x.useState(!1),[B,Z]=x.useState(!1),[J,I]=x.useState(!1),[X,G]=x.useState(()=>Date.now());x.useEffect(()=>{const H=setInterval(()=>G(Date.now()),1e3);return()=>clearInterval(H)},[]);const q=x.useCallback(async H=>{var ae,me;if(!(H&&!fr(v.current))){v.current=H,y(!0);try{const ge=await fetch(`/api/browser-watch${H?"?refresh=1":""}`);if(!ge.ok)throw new Error(`the deck answered ${ge.status}`);const Re=await ge.json();c(Re),C.current||_(((ae=Re==null?void 0:Re.settings)==null?void 0:ae.quietMinutes)??15),n(((me=Re==null?void 0:Re.settings)==null?void 0:me.enabled)===!0),h(null)}catch(ge){h(ge instanceof Error?ge.message:String(ge))}finally{v.current=!1,y(!1)}}},[n]);x.useEffect(()=>{q(!1)},[q]),x.useEffect(()=>{const H=setInterval(()=>{q(!1)},1e4);return()=>clearInterval(H)},[q]);const Y=x.useCallback(async H=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:H.host,startMs:H.startMs})})}finally{await q(!1)}},[q]),L=x.useCallback(async H=>{C.current=!0,E(!0);try{const ae=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(H)});if(!ae.ok)throw new Error(`the deck answered ${ae.status}`);await q(!1),f(null)}catch(ae){f(ae instanceof Error?ae.message:String(ae))}finally{C.current=!1,E(!1)}},[q]),K=x.useRef(t);K.current=t,x.useEffect(()=>()=>K.current(Date.now()),[]);const P=x.useMemo(()=>{const H=[];for(const ae of(l==null?void 0:l.episodes)??[]){const me=E8(ae.startMs),ge=H[H.length-1];ge&&ge.label===me?ge.episodes.push(ae):H.push({label:me,episodes:[ae]})}return H},[l]),V=sA(l==null?void 0:l.browsers),he=((l==null?void 0:l.browsers)??[]).filter(H=>!(H.installed&&H.profiles>0)),z=l?S8(l):null,W=V.reduce((H,ae)=>H+ae.profiles,0),ee=l?b8(l.coverage.lastHumanMs,l.coverage.quietMs,X):null;return i.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:i.jsxs("div",{ref:a,className:"modal bw-modal",onClick:H=>H.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{className:"modal-tool-name",id:"bw-title",children:"Browser watch"}),i.jsx("span",{className:"modal-tool-id",children:l?`${W} ${W===1?"profile":"profiles"} · local only`:"local only"})]}),i.jsxs("div",{className:"modal-actions",children:[i.jsx("button",{className:"glyph-btn",onClick:()=>void q(!0),...hr(m),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:m?"…":"↻"}),i.jsx("button",{className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),i.jsxs("div",{className:"modal-body bw-body",children:[!l&&!d&&i.jsxs("div",{className:"bw-loading",children:[i.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),i.jsx("p",{children:"Reading each browser's history. The first look copies the file, which takes a moment."})]}),d&&i.jsx("div",{className:"bw-state",children:i.jsxs("div",{className:"bw-row err",children:[i.jsx("span",{className:"bw-dot","aria-hidden":!0}),i.jsx("span",{className:"bw-row-label",children:"Could not read"}),i.jsx("span",{className:"bw-row-detail",children:d})]})}),l&&z&&i.jsx("p",{className:`bw-trouble ${z.kind}`,role:"status",children:z.text}),l&&i.jsxs("div",{className:"bw-work",children:[i.jsxs("aside",{className:"bw-side",children:[i.jsxs("section",{className:"bw-sec",children:[i.jsxs("h4",{className:"bw-sec-head",children:["Activity overview",i.jsx("button",{className:"bw-help",onClick:()=>$(H=>!H),"aria-expanded":O,"aria-label":"What the sweep and the dots mean",children:"?"})]}),i.jsxs("div",{className:"bw-glance",children:[i.jsx(v8,{browsers:V.map(H=>{var ae;return{key:H.key,name:H.name,running:H.running,lastReadMs:((ae=l.profiles.find(me=>me.browser===H.key))==null?void 0:ae.lastWrittenMs)??null}}),findings:l.episodes.slice(0,6).map(H=>({browser:H.browser??null,atMs:H.endMs})),watching:l.settings.enabled,palette:s}),i.jsx("ul",{className:"bw-counts",children:_8(V,l.profiles).map(H=>i.jsxs("li",{children:[i.jsx("span",{className:"bw-count-n",children:H.visits.toLocaleString("en-US")}),i.jsx("span",{className:"bw-count-of",children:H.name})]},H.key))})]}),i.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),l.coverage.checkedMs>0&&i.jsxs("p",{className:"bw-since",children:["Last checked ",N8(l.coverage.checkedMs,X),l.coverage.checks>0&&i.jsxs(i.Fragment,{children:[" · ",l.coverage.checks.toLocaleString("en-US")," ",l.coverage.checks===1?"check":"checks"]})]}),ee!==null&&i.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",k8(ee)]}),O&&i.jsxs("dl",{className:"bw-key",children:[i.jsx("dt",{children:"Sweep"}),i.jsx("dd",{children:"one poll of every watched profile"}),i.jsx("dt",{children:"Dot"}),i.jsx("dd",{children:"a browser, further out the longer since it last wrote history"}),i.jsx("dt",{children:"Ring"}),i.jsx("dd",{children:"a finding, leaving the browser it came from"})]})]}),i.jsxs("section",{className:"bw-sec",children:[i.jsxs("h4",{className:"bw-sec-head",children:["Watched profiles",i.jsx("button",{className:"bw-help",onClick:()=>Z(H=>!H),"aria-expanded":B,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),B&&i.jsxs("dl",{className:"bw-key",children:[i.jsx("dt",{children:"Running"}),i.jsx("dd",{children:"the browser has a process on this machine right now"}),i.jsx("dt",{children:"Connected"}),i.jsx("dd",{children:"an open connection to an address Anthropic's relay uses — which it shares with claude.ai, so an open tab looks the same as an agent channel"})]}),i.jsx("ul",{className:"bw-profiles",children:V.map(H=>i.jsxs("li",{children:[i.jsx("span",{className:`bw-prof-dot${H.running?" on":""}`,"aria-hidden":!0}),i.jsx("span",{className:"bw-prof-name",children:H.name}),i.jsx("span",{className:"bw-prof-state",children:H.running?"running":"idle"}),H.running&&H.relay.state==="live"&&i.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},H.key))}),he.length>0&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>I(H=>!H),"aria-expanded":J,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:J?"▾":"▸"})," ",he.length," not watched"]}),J&&i.jsxs("p",{className:"bw-rest",children:[he.map(H=>H.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]}),l.relay&&i.jsx(T8,{relay:l.relay})]}),i.jsxs("div",{className:"bw-main",children:[i.jsxs("section",{className:"bw-findings",children:[i.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Findings",l.episodes.length>0&&i.jsxs("span",{className:"bw-feed-count",children:[l.episodes.length," ",l.episodes.length===1?"episode":"episodes"]})]}),i.jsx("div",{className:"bw-eps",children:P.length===0?i.jsxs("div",{className:"bw-empty",children:[i.jsx("p",{className:"bw-empty-head",children:"Nothing found yet"}),i.jsxs("p",{className:"bw-empty-note",children:["An episode lands here when a program opens pages in a browser nobody has touched for"," ",l.settings.quietMinutes," ",l.settings.quietMinutes===1?"minute":"minutes",". On most machines that is rare, so an empty list is the ordinary result rather than a sign something is wrong."]}),!l.settings.enabled&&i.jsx("p",{className:"bw-empty-note",children:"Watching is off, so this shows only what this deck has seen since it started. Anything an earlier run recorded comes back when you switch it on."})]}):P.map(H=>i.jsxs("div",{className:"bw-day",children:[i.jsx("h4",{className:"bw-sec-head",children:H.label}),H.episodes.map(ae=>{const me=`${ae.host}-${ae.startMs}`,ge=S===me;return i.jsxs("div",{className:`bw-ep${ge?" open":""}`,children:[i.jsxs("div",{className:"bw-ep-row",children:[i.jsxs("button",{className:"bw-ep-head",onClick:()=>k(ge?null:me),"aria-expanded":ge,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:ge?"▾":"▸"}),i.jsx("span",{className:"bw-ep-host",children:ae.host}),i.jsxs("span",{className:"bw-ep-meta",children:[j8(ae),r_(ae)&&i.jsxs(i.Fragment,{children:[" · ",r_(ae)]})]}),i.jsxs("span",{className:"bw-ep-count",children:[ae.count," ",ae.count===1?"page":"pages"]})]}),i.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void Y(ae),"aria-label":`Dismiss ${ae.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),ge&&i.jsx("ul",{className:"bw-urls",children:ae.urls.map((Re,$e)=>i.jsxs("li",{children:[i.jsx("span",{className:"bw-url-time",children:new Date(Re.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),i.jsx("span",{className:"bw-url",children:Re.url})]},`${Re.url}-${Re.timeMs}-${$e}`))})]},me)})]},H.label))})]}),i.jsxs("section",{className:"bw-feed",children:[i.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Live activity",i.jsxs("span",{className:"bw-feed-count",children:[l.log.length," ",l.log.length===1?"event":"events"]})]}),i.jsx("p",{className:"bw-since bw-feed-note",children:"Pages you opened yourself — counted to run the rule, never written down. Addresses appear under Findings, and only for pages a program opened."}),i.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:l.log.length===0?i.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):l.log.map(H=>i.jsxs("div",{className:`bw-log-line ${H.level}${H.parts?"":" sys"}`,children:[i.jsx("span",{className:"bw-log-time",children:new Date(H.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),H.parts?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"bw-log-browser",children:H.parts.browser}),i.jsx("span",{className:"bw-log-profile",title:H.parts.profile,children:H.parts.profile}),i.jsxs("span",{className:"bw-log-value",children:[H.parts.value,H.parts.flagged>0&&i.jsxs("span",{className:"bw-log-flag",children:[" · ",H.parts.flagged," flagged"]})]})]}):i.jsx("span",{className:"bw-log-sys",children:H.text})]},`${H.atMs}-${H.level}-${H.text}`))})]})]})]}),l&&T&&i.jsxs("div",{className:"bw-settings",children:[i.jsxs("label",{title:"A program opening a page counts as a finding only if nobody had touched the browser for this long. Shorter catches more and reports more of your own work; longer is quieter.",children:[i.jsx("span",{children:"Nobody browsing for"}),i.jsxs("select",{value:N??l.settings.quietMinutes,onChange:H=>{_(Number(H.target.value)),L({quietMinutes:Number(H.target.value)})},children:[i.jsx("option",{value:1,children:"1 min"}),i.jsx("option",{value:5,children:"5 min"}),i.jsx("option",{value:15,children:"15 min"}),i.jsx("option",{value:30,children:"30 min"}),i.jsx("option",{value:60,children:"60 min"})]})]}),i.jsxs("label",{children:[i.jsx("span",{children:"When it finds one"}),i.jsx("select",{value:l.settings.reaction,onChange:H=>void L({reaction:H.target.value}),disabled:!l.settings.enabled,title:l.settings.enabled?"What to do besides writing it down.":"Turn watching on to arm a reaction.",children:(l.reactions??["notify"]).map(H=>i.jsx("option",{value:H,children:H==="notify"?"notify me":H==="close-tab"?"close the tab":"quit the browser"},H))})]}),i.jsxs("div",{className:"bw-settings-note",children:[i.jsxs("p",{children:["Chrome marks a navigation that came from an extension or a command rather than from a click. These are the ones that happened while nobody had touched the browser for the time above. ",i.jsx("strong",{children:"Usually that is your own agent doing what you asked."})]}),i.jsxs("button",{className:"bw-why",onClick:()=>D(H=>!H),"aria-expanded":A,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:A?"▾":"▸"})," What Browser Watch can access"]}),A&&i.jsxs("dl",{className:"bw-access",children:[i.jsx("dt",{children:"Reads"}),i.jsxs("dd",{children:["A copy of each browser's own history database — the live file is locked while the browser holds it. Only rows newer than the moment this deck started:"," ",new Date(l.coverage.startedMs).toLocaleString(),"."]}),i.jsx("dt",{children:"Keeps"}),i.jsxs("dd",{children:["Only while the switch is on, and only the episodes it flagged — never your ordinary browsing. In ",i.jsx("code",{className:"bw-path",children:l.coverage.logPath}),", with every address written in full so you can check it yourself."]}),i.jsx("dt",{children:"Sends"}),i.jsx("dd",{children:"Nothing. No part of this reads or writes over the network; the deck serves on 127.0.0.1 and this panel talks only to it."}),i.jsx("dt",{children:"Never reads"}),i.jsx("dd",{children:"Anything from before this deck started, cookies, saved passwords, page contents, or any browser profile with no history file."})]})]})]}),p&&i.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:i.jsxs("div",{className:"bw-row err",children:[i.jsx("span",{className:"bw-dot","aria-hidden":!0}),i.jsx("span",{className:"bw-row-label",children:"Could not save that setting"}),i.jsxs("span",{className:"bw-row-detail",children:[p," — the switches below show what is stored, not what you pressed."]}),i.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>f(null),"aria-label":"Dismiss",title:"Dismiss",children:"×"})]})}),l&&i.jsxs("footer",{className:"bw-status",children:[i.jsx("span",{className:`bw-mode-dot${l.settings.enabled?" on":""}`,"aria-hidden":!0}),i.jsx("span",{className:"bw-mode-word",children:n_(l,j).word},n_(l,j).kind),i.jsx("span",{className:"bw-status-text",children:l.coverage.archived===0?l.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${l.coverage.archived} ${l.coverage.archived===1?"episode":"episodes"} on disk`}),i.jsx("button",{className:`glyph-btn bw-gear${T?" on":""}`,onClick:()=>R(H=>!H),"aria-expanded":T,"aria-label":"Settings",title:"Settings",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[i.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),i.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),i.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[i.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),i.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":l.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"bw-toggle",onClick:()=>void L({enabled:!l.settings.enabled}),title:l.settings.enabled?"On — every episode it finds is written down, so the list outlives the browsing history being cleared":"Off — showing only what this deck has seen since it started. Anything an earlier run archived is hidden until you switch back on, and nothing new is kept",children:i.jsx("span",{className:"bw-toggle-knob"})})]})]})]})]})})}function T8({relay:e}){const[t,n]=x.useState(!1),[s,a]=x.useState(!1),l=e.killswitch.blocked?"unblock":"block",c=e.command[l],d=x.useCallback(async()=>{await Y2(c.command)&&(a(!0),window.setTimeout(()=>a(!1),1600))},[c.command]),h=e.profiles.filter(f=>{var m;return(m=f.report)==null?void 0:m.present}),p=e.profiles.filter(f=>f.report===null);return i.jsxs("section",{className:"bw-sec",children:[i.jsx("h4",{className:"bw-sec-head",children:"Remote control"}),i.jsx("p",{className:`bw-rc-verdict ${e.verdict}`,role:"status",children:e.verdict==="exposed"?"Claude in Chrome is live here, so any Claude Code session signed in to your Anthropic account can drive this browser — from any machine, with no prompt on this one.":e.verdict==="protected"?`The relay is black-holed in ${e.hostsPath}, so no new connection to it can be made from this machine.`:"Claude in Chrome is not installed and enabled in any profile here, so there is nothing for the relay to drive."}),e.killswitch.foreign.length>0&&i.jsxs("p",{className:"bw-rc-foreign",children:["Another entry for this host is already in ",e.hostsPath,", and ccdeck will not touch it:",e.killswitch.foreign.map(f=>i.jsx("code",{className:"bw-path",children:f},f))]}),i.jsxs("button",{className:"bw-why",onClick:()=>n(f=>!f),"aria-expanded":t,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:t?"▾":"▸"})," ",e.verdict==="protected"?"How to undo the block":"What it can reach, and how to stop it"]}),t&&i.jsxs("div",{className:"bw-rc-body",children:[h.length>0&&i.jsx("dl",{className:"bw-key",children:h.map(f=>i.jsxs(x.Fragment,{children:[i.jsxs("dt",{children:[f.name,f.profile==="Default"?"":` · ${f.profile}`]}),i.jsxs("dd",{children:[f.report.enabled?"enabled":"installed but switched off",f.report.allUrls?", can act on every site":", limited to the sites it was granted",f.report.sensitiveApis.length>0&&i.jsxs(i.Fragment,{children:[" — ",f.report.sensitiveApis.join(", ")]})]})]},`${f.browser}/${f.profile}`))}),p.length>0&&i.jsxs("p",{className:"bw-rc-note",children:[p.map(f=>f.name).join(", ")," — its settings file could not be read, so nothing is claimed about it either way."]}),!e.hostsRead&&i.jsxs("p",{className:"bw-rc-note",children:[e.hostsPath," could not be read, so whether the relay is already blocked is unknown."]}),h.some(f=>f.report.allUrls)&&i.jsxs("p",{className:"bw-rc-note",children:["Narrowing the sites in ",i.jsx("code",{className:"bw-path",children:"chrome://extensions"})," does not change this: the grant is held at the browser level and the per-site list is enforced inside the extension, by the extension."]}),i.jsxs("div",{className:"bw-rc-cmd",children:[i.jsx("code",{children:c.command}),i.jsx("button",{className:"btn bw-rc-copy",onClick:d,children:s?"Copied":"Copy"})]}),i.jsx("p",{className:"bw-rc-note",children:c.note})]})]})}function A8(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,l)=>(a.at??0)-(l.at??0));return{request:s[0],waiting:s.length-1}}function R8({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:l,onLater:c}){const d=x.useRef(null),h=Vt(c,{focusRef:d}),p=Ys(n,"accept"),f=Ys(n,"dismiss");return i.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:i.jsxs("div",{ref:h,className:"modal lan-ask",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("i",{className:"ap-pulse","aria-hidden":!0}),i.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:c,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsxs("p",{className:"lan-ask-who",children:[i.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",i.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",Tx(e.at,s)]}),i.jsx("p",{className:"modal-note",children:"Paired decks repair each other's expired logins. Accept only if you know this machine — what it shares is an account, not a screen."}),i.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",i.jsx("code",{className:"ap-lan-code",children:e.fp})," — it should match the one on their screen."]}),t>0&&i.jsx("p",{className:"lan-ask-more",children:t===1?"One more deck is waiting behind this one.":`${t} more decks are waiting behind this one.`}),i.jsxs("div",{className:"lan-ask-acts",children:[i.jsx("button",{type:"button",ref:d,className:"btn",disabled:f.disabled,"aria-busy":f.busy,onClick:l,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),i.jsx("button",{type:"button",className:"btn primary",disabled:p.disabled,"aria-busy":p.busy,onClick:a,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function Ix(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 Wf,s_;function M8(){if(s_)return Wf;s_=1;function e(){this.__data__=[],this.size=0}return Wf=e,Wf}var Hf,a_;function yi(){if(a_)return Hf;a_=1;function e(t,n){return t===n||t!==t&&n!==n}return Hf=e,Hf}var Gf,o_;function Rd(){if(o_)return Gf;o_=1;var e=yi();function t(n,s){for(var a=n.length;a--;)if(e(n[a][0],s))return a;return-1}return Gf=t,Gf}var Vf,i_;function I8(){if(i_)return Vf;i_=1;var e=Rd(),t=Array.prototype,n=t.splice;function s(a){var l=this.__data__,c=e(l,a);if(c<0)return!1;var d=l.length-1;return c==d?l.pop():n.call(l,c,1),--this.size,!0}return Vf=s,Vf}var Yf,l_;function $8(){if(l_)return Yf;l_=1;var e=Rd();function t(n){var s=this.__data__,a=e(s,n);return a<0?void 0:s[a][1]}return Yf=t,Yf}var Kf,c_;function O8(){if(c_)return Kf;c_=1;var e=Rd();function t(n){return e(this.__data__,n)>-1}return Kf=t,Kf}var Xf,u_;function P8(){if(u_)return Xf;u_=1;var e=Rd();function t(n,s){var a=this.__data__,l=e(a,n);return l<0?(++this.size,a.push([n,s])):a[l][1]=s,this}return Xf=t,Xf}var Qf,d_;function Md(){if(d_)return Qf;d_=1;var e=M8(),t=I8(),n=$8(),s=O8(),a=P8();function l(c){var d=-1,h=c==null?0:c.length;for(this.clear();++d<h;){var p=c[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=s,l.prototype.set=a,Qf=l,Qf}var Zf,h_;function L8(){if(h_)return Zf;h_=1;var e=Md();function t(){this.__data__=new e,this.size=0}return Zf=t,Zf}var Jf,f_;function D8(){if(f_)return Jf;f_=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return Jf=e,Jf}var ep,p_;function q8(){if(p_)return ep;p_=1;function e(t){return this.__data__.get(t)}return ep=e,ep}var tp,m_;function F8(){if(m_)return tp;m_=1;function e(t){return this.__data__.has(t)}return tp=e,tp}var np,g_;function aA(){if(g_)return np;g_=1;var e=typeof vu=="object"&&vu&&vu.Object===Object&&vu;return np=e,np}var rp,y_;function wr(){if(y_)return rp;y_=1;var e=aA(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return rp=n,rp}var sp,w_;function wi(){if(w_)return sp;w_=1;var e=wr(),t=e.Symbol;return sp=t,sp}var ap,v_;function B8(){if(v_)return ap;v_=1;var e=wi(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function l(c){var d=n.call(c,a),h=c[a];try{c[a]=void 0;var p=!0}catch{}var f=s.call(c);return p&&(d?c[a]=h:delete c[a]),f}return ap=l,ap}var op,x_;function z8(){if(x_)return op;x_=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return op=n,op}var ip,b_;function Xa(){if(b_)return ip;b_=1;var e=wi(),t=B8(),n=z8(),s="[object Null]",a="[object Undefined]",l=e?e.toStringTag:void 0;function c(d){return d==null?d===void 0?a:s:l&&l in Object(d)?t(d):n(d)}return ip=c,ip}var lp,k_;function Kn(){if(k_)return lp;k_=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return lp=e,lp}var cp,__;function rc(){if(__)return cp;__=1;var e=Xa(),t=Kn(),n="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",l="[object Proxy]";function c(d){if(!t(d))return!1;var h=e(d);return h==s||h==a||h==n||h==l}return cp=c,cp}var up,N_;function U8(){if(N_)return up;N_=1;var e=wr(),t=e["__core-js_shared__"];return up=t,up}var dp,S_;function W8(){if(S_)return dp;S_=1;var e=U8(),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 dp=n,dp}var hp,j_;function oA(){if(j_)return hp;j_=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 hp=n,hp}var fp,E_;function H8(){if(E_)return fp;E_=1;var e=rc(),t=W8(),n=Kn(),s=oA(),a=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,c=Function.prototype,d=Object.prototype,h=c.toString,p=d.hasOwnProperty,f=RegExp("^"+h.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!n(y)||t(y))return!1;var v=e(y)?f:l;return v.test(s(y))}return fp=m,fp}var pp,C_;function G8(){if(C_)return pp;C_=1;function e(t,n){return t==null?void 0:t[n]}return pp=e,pp}var mp,T_;function Qa(){if(T_)return mp;T_=1;var e=H8(),t=G8();function n(s,a){var l=t(s,a);return e(l)?l:void 0}return mp=n,mp}var gp,A_;function $x(){if(A_)return gp;A_=1;var e=Qa(),t=wr(),n=e(t,"Map");return gp=n,gp}var yp,R_;function Id(){if(R_)return yp;R_=1;var e=Qa(),t=e(Object,"create");return yp=t,yp}var wp,M_;function V8(){if(M_)return wp;M_=1;var e=Id();function t(){this.__data__=e?e(null):{},this.size=0}return wp=t,wp}var vp,I_;function Y8(){if(I_)return vp;I_=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 xp,$_;function K8(){if($_)return xp;$_=1;var e=Id(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function a(l){var c=this.__data__;if(e){var d=c[l];return d===t?void 0:d}return s.call(c,l)?c[l]:void 0}return xp=a,xp}var bp,O_;function X8(){if(O_)return bp;O_=1;var e=Id(),t=Object.prototype,n=t.hasOwnProperty;function s(a){var l=this.__data__;return e?l[a]!==void 0:n.call(l,a)}return bp=s,bp}var kp,P_;function Q8(){if(P_)return kp;P_=1;var e=Id(),t="__lodash_hash_undefined__";function n(s,a){var l=this.__data__;return this.size+=this.has(s)?0:1,l[s]=e&&a===void 0?t:a,this}return kp=n,kp}var _p,L_;function Z8(){if(L_)return _p;L_=1;var e=V8(),t=Y8(),n=K8(),s=X8(),a=Q8();function l(c){var d=-1,h=c==null?0:c.length;for(this.clear();++d<h;){var p=c[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=s,l.prototype.set=a,_p=l,_p}var Np,D_;function J8(){if(D_)return Np;D_=1;var e=Z8(),t=Md(),n=$x();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Np=s,Np}var Sp,q_;function eB(){if(q_)return Sp;q_=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Sp=e,Sp}var jp,F_;function $d(){if(F_)return jp;F_=1;var e=eB();function t(n,s){var a=n.__data__;return e(s)?a[typeof s=="string"?"string":"hash"]:a.map}return jp=t,jp}var Ep,B_;function tB(){if(B_)return Ep;B_=1;var e=$d();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return Ep=t,Ep}var Cp,z_;function nB(){if(z_)return Cp;z_=1;var e=$d();function t(n){return e(this,n).get(n)}return Cp=t,Cp}var Tp,U_;function rB(){if(U_)return Tp;U_=1;var e=$d();function t(n){return e(this,n).has(n)}return Tp=t,Tp}var Ap,W_;function sB(){if(W_)return Ap;W_=1;var e=$d();function t(n,s){var a=e(this,n),l=a.size;return a.set(n,s),this.size+=a.size==l?0:1,this}return Ap=t,Ap}var Rp,H_;function Ox(){if(H_)return Rp;H_=1;var e=J8(),t=tB(),n=nB(),s=rB(),a=sB();function l(c){var d=-1,h=c==null?0:c.length;for(this.clear();++d<h;){var p=c[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=s,l.prototype.set=a,Rp=l,Rp}var Mp,G_;function aB(){if(G_)return Mp;G_=1;var e=Md(),t=$x(),n=Ox(),s=200;function a(l,c){var d=this.__data__;if(d instanceof e){var h=d.__data__;if(!t||h.length<s-1)return h.push([l,c]),this.size=++d.size,this;d=this.__data__=new n(h)}return d.set(l,c),this.size=d.size,this}return Mp=a,Mp}var Ip,V_;function Od(){if(V_)return Ip;V_=1;var e=Md(),t=L8(),n=D8(),s=q8(),a=F8(),l=aB();function c(d){var h=this.__data__=new e(d);this.size=h.size}return c.prototype.clear=t,c.prototype.delete=n,c.prototype.get=s,c.prototype.has=a,c.prototype.set=l,Ip=c,Ip}var $p,Y_;function Px(){if(Y_)return $p;Y_=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 $p=e,$p}var Op,K_;function iA(){if(K_)return Op;K_=1;var e=Qa(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Op=t,Op}var Pp,X_;function Pd(){if(X_)return Pp;X_=1;var e=iA();function t(n,s,a){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[s]=a}return Pp=t,Pp}var Lp,Q_;function Ld(){if(Q_)return Lp;Q_=1;var e=Pd(),t=yi(),n=Object.prototype,s=n.hasOwnProperty;function a(l,c,d){var h=l[c];(!(s.call(l,c)&&t(h,d))||d===void 0&&!(c in l))&&e(l,c,d)}return Lp=a,Lp}var Dp,Z_;function sc(){if(Z_)return Dp;Z_=1;var e=Ld(),t=Pd();function n(s,a,l,c){var d=!l;l||(l={});for(var h=-1,p=a.length;++h<p;){var f=a[h],m=c?c(l[f],s[f],f,l,s):void 0;m===void 0&&(m=s[f]),d?t(l,f,m):e(l,f,m)}return l}return Dp=n,Dp}var qp,J_;function oB(){if(J_)return qp;J_=1;function e(t,n){for(var s=-1,a=Array(t);++s<t;)a[s]=n(s);return a}return qp=e,qp}var Fp,eN;function qr(){if(eN)return Fp;eN=1;function e(t){return t!=null&&typeof t=="object"}return Fp=e,Fp}var Bp,tN;function iB(){if(tN)return Bp;tN=1;var e=Xa(),t=qr(),n="[object Arguments]";function s(a){return t(a)&&e(a)==n}return Bp=s,Bp}var zp,nN;function ac(){if(nN)return zp;nN=1;var e=iB(),t=qr(),n=Object.prototype,s=n.hasOwnProperty,a=n.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(c){return t(c)&&s.call(c,"callee")&&!a.call(c,"callee")};return zp=l,zp}var Up,rN;function $t(){if(rN)return Up;rN=1;var e=Array.isArray;return Up=e,Up}var Cl={exports:{}},Wp,sN;function lB(){if(sN)return Wp;sN=1;function e(){return!1}return Wp=e,Wp}Cl.exports;var aN;function vi(){return aN||(aN=1,(function(e,t){var n=wr(),s=lB(),a=t&&!t.nodeType&&t,l=a&&!0&&e&&!e.nodeType&&e,c=l&&l.exports===a,d=c?n.Buffer:void 0,h=d?d.isBuffer:void 0,p=h||s;e.exports=p})(Cl,Cl.exports)),Cl.exports}var Hp,oN;function Dd(){if(oN)return Hp;oN=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,a){var l=typeof s;return a=a??e,!!a&&(l=="number"||l!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<a}return Hp=n,Hp}var Gp,iN;function Lx(){if(iN)return Gp;iN=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Gp=t,Gp}var Vp,lN;function cB(){if(lN)return Vp;lN=1;var e=Xa(),t=Lx(),n=qr(),s="[object Arguments]",a="[object Array]",l="[object Boolean]",c="[object Date]",d="[object Error]",h="[object Function]",p="[object Map]",f="[object Number]",m="[object Object]",y="[object RegExp]",v="[object Set]",N="[object String]",_="[object WeakMap]",S="[object ArrayBuffer]",k="[object DataView]",j="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",T="[object Int16Array]",R="[object Int32Array]",A="[object Uint8Array]",D="[object Uint8ClampedArray]",O="[object Uint16Array]",$="[object Uint32Array]",B={};B[j]=B[E]=B[C]=B[T]=B[R]=B[A]=B[D]=B[O]=B[$]=!0,B[s]=B[a]=B[S]=B[l]=B[k]=B[c]=B[d]=B[h]=B[p]=B[f]=B[m]=B[y]=B[v]=B[N]=B[_]=!1;function Z(J){return n(J)&&t(J.length)&&!!B[e(J)]}return Vp=Z,Vp}var Yp,cN;function qd(){if(cN)return Yp;cN=1;function e(t){return function(n){return t(n)}}return Yp=e,Yp}var Tl={exports:{}};Tl.exports;var uN;function Dx(){return uN||(uN=1,(function(e,t){var n=aA(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===s,c=l&&n.process,d=(function(){try{var h=a&&a.require&&a.require("util").types;return h||c&&c.binding&&c.binding("util")}catch{}})();e.exports=d})(Tl,Tl.exports)),Tl.exports}var Kp,dN;function oc(){if(dN)return Kp;dN=1;var e=cB(),t=qd(),n=Dx(),s=n&&n.isTypedArray,a=s?t(s):e;return Kp=a,Kp}var Xp,hN;function lA(){if(hN)return Xp;hN=1;var e=oB(),t=ac(),n=$t(),s=vi(),a=Dd(),l=oc(),c=Object.prototype,d=c.hasOwnProperty;function h(p,f){var m=n(p),y=!m&&t(p),v=!m&&!y&&s(p),N=!m&&!y&&!v&&l(p),_=m||y||v||N,S=_?e(p.length,String):[],k=S.length;for(var j in p)(f||d.call(p,j))&&!(_&&(j=="length"||v&&(j=="offset"||j=="parent")||N&&(j=="buffer"||j=="byteLength"||j=="byteOffset")||a(j,k)))&&S.push(j);return S}return Xp=h,Xp}var Qp,fN;function Fd(){if(fN)return Qp;fN=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,a=typeof s=="function"&&s.prototype||e;return n===a}return Qp=t,Qp}var Zp,pN;function cA(){if(pN)return Zp;pN=1;function e(t,n){return function(s){return t(n(s))}}return Zp=e,Zp}var Jp,mN;function uB(){if(mN)return Jp;mN=1;var e=cA(),t=e(Object.keys,Object);return Jp=t,Jp}var em,gN;function qx(){if(gN)return em;gN=1;var e=Fd(),t=uB(),n=Object.prototype,s=n.hasOwnProperty;function a(l){if(!e(l))return t(l);var c=[];for(var d in Object(l))s.call(l,d)&&d!="constructor"&&c.push(d);return c}return em=a,em}var tm,yN;function ms(){if(yN)return tm;yN=1;var e=rc(),t=Lx();function n(s){return s!=null&&t(s.length)&&!e(s)}return tm=n,tm}var nm,wN;function Ks(){if(wN)return nm;wN=1;var e=lA(),t=qx(),n=ms();function s(a){return n(a)?e(a):t(a)}return nm=s,nm}var rm,vN;function dB(){if(vN)return rm;vN=1;var e=sc(),t=Ks();function n(s,a){return s&&e(a,t(a),s)}return rm=n,rm}var sm,xN;function hB(){if(xN)return sm;xN=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return sm=e,sm}var am,bN;function fB(){if(bN)return am;bN=1;var e=Kn(),t=Fd(),n=hB(),s=Object.prototype,a=s.hasOwnProperty;function l(c){if(!e(c))return n(c);var d=t(c),h=[];for(var p in c)p=="constructor"&&(d||!a.call(c,p))||h.push(p);return h}return am=l,am}var om,kN;function Za(){if(kN)return om;kN=1;var e=lA(),t=fB(),n=ms();function s(a){return n(a)?e(a,!0):t(a)}return om=s,om}var im,_N;function pB(){if(_N)return im;_N=1;var e=sc(),t=Za();function n(s,a){return s&&e(a,t(a),s)}return im=n,im}var Al={exports:{}};Al.exports;var NN;function uA(){return NN||(NN=1,(function(e,t){var n=wr(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===s,c=l?n.Buffer:void 0,d=c?c.allocUnsafe:void 0;function h(p,f){if(f)return p.slice();var m=p.length,y=d?d(m):new p.constructor(m);return p.copy(y),y}e.exports=h})(Al,Al.exports)),Al.exports}var lm,SN;function dA(){if(SN)return lm;SN=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 lm=e,lm}var cm,jN;function hA(){if(jN)return cm;jN=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,l=0,c=[];++s<a;){var d=t[s];n(d,s,t)&&(c[l++]=d)}return c}return cm=e,cm}var um,EN;function fA(){if(EN)return um;EN=1;function e(){return[]}return um=e,um}var dm,CN;function Fx(){if(CN)return dm;CN=1;var e=hA(),t=fA(),n=Object.prototype,s=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,l=a?function(c){return c==null?[]:(c=Object(c),e(a(c),function(d){return s.call(c,d)}))}:t;return dm=l,dm}var hm,TN;function mB(){if(TN)return hm;TN=1;var e=sc(),t=Fx();function n(s,a){return e(s,t(s),a)}return hm=n,hm}var fm,AN;function Bx(){if(AN)return fm;AN=1;function e(t,n){for(var s=-1,a=n.length,l=t.length;++s<a;)t[l+s]=n[s];return t}return fm=e,fm}var pm,RN;function Bd(){if(RN)return pm;RN=1;var e=cA(),t=e(Object.getPrototypeOf,Object);return pm=t,pm}var mm,MN;function pA(){if(MN)return mm;MN=1;var e=Bx(),t=Bd(),n=Fx(),s=fA(),a=Object.getOwnPropertySymbols,l=a?function(c){for(var d=[];c;)e(d,n(c)),c=t(c);return d}:s;return mm=l,mm}var gm,IN;function gB(){if(IN)return gm;IN=1;var e=sc(),t=pA();function n(s,a){return e(s,t(s),a)}return gm=n,gm}var ym,$N;function mA(){if($N)return ym;$N=1;var e=Bx(),t=$t();function n(s,a,l){var c=a(s);return t(s)?c:e(c,l(s))}return ym=n,ym}var wm,ON;function gA(){if(ON)return wm;ON=1;var e=mA(),t=Fx(),n=Ks();function s(a){return e(a,n,t)}return wm=s,wm}var vm,PN;function yB(){if(PN)return vm;PN=1;var e=mA(),t=pA(),n=Za();function s(a){return e(a,n,t)}return vm=s,vm}var xm,LN;function wB(){if(LN)return xm;LN=1;var e=Qa(),t=wr(),n=e(t,"DataView");return xm=n,xm}var bm,DN;function vB(){if(DN)return bm;DN=1;var e=Qa(),t=wr(),n=e(t,"Promise");return bm=n,bm}var km,qN;function yA(){if(qN)return km;qN=1;var e=Qa(),t=wr(),n=e(t,"Set");return km=n,km}var _m,FN;function xB(){if(FN)return _m;FN=1;var e=Qa(),t=wr(),n=e(t,"WeakMap");return _m=n,_m}var Nm,BN;function xi(){if(BN)return Nm;BN=1;var e=wB(),t=$x(),n=vB(),s=yA(),a=xB(),l=Xa(),c=oA(),d="[object Map]",h="[object Object]",p="[object Promise]",f="[object Set]",m="[object WeakMap]",y="[object DataView]",v=c(e),N=c(t),_=c(n),S=c(s),k=c(a),j=l;return(e&&j(new e(new ArrayBuffer(1)))!=y||t&&j(new t)!=d||n&&j(n.resolve())!=p||s&&j(new s)!=f||a&&j(new a)!=m)&&(j=function(E){var C=l(E),T=C==h?E.constructor:void 0,R=T?c(T):"";if(R)switch(R){case v:return y;case N:return d;case _:return p;case S:return f;case k:return m}return C}),Nm=j,Nm}var Sm,zN;function bB(){if(zN)return Sm;zN=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var a=s.length,l=new s.constructor(a);return a&&typeof s[0]=="string"&&t.call(s,"index")&&(l.index=s.index,l.input=s.input),l}return Sm=n,Sm}var jm,UN;function wA(){if(UN)return jm;UN=1;var e=wr(),t=e.Uint8Array;return jm=t,jm}var Em,WN;function zx(){if(WN)return Em;WN=1;var e=wA();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return Em=t,Em}var Cm,HN;function kB(){if(HN)return Cm;HN=1;var e=zx();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return Cm=t,Cm}var Tm,GN;function _B(){if(GN)return Tm;GN=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return Tm=t,Tm}var Am,VN;function NB(){if(VN)return Am;VN=1;var e=wi(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(a){return n?Object(n.call(a)):{}}return Am=s,Am}var Rm,YN;function vA(){if(YN)return Rm;YN=1;var e=zx();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return Rm=t,Rm}var Mm,KN;function SB(){if(KN)return Mm;KN=1;var e=zx(),t=kB(),n=_B(),s=NB(),a=vA(),l="[object Boolean]",c="[object Date]",d="[object Map]",h="[object Number]",p="[object RegExp]",f="[object Set]",m="[object String]",y="[object Symbol]",v="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",S="[object Float64Array]",k="[object Int8Array]",j="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",A="[object Uint32Array]";function D(O,$,B){var Z=O.constructor;switch($){case v:return e(O);case l:case c:return new Z(+O);case N:return t(O,B);case _:case S:case k:case j:case E:case C:case T:case R:case A:return a(O,B);case d:return new Z;case h:case m:return new Z(O);case p:return n(O);case f:return new Z;case y:return s(O)}}return Mm=D,Mm}var Im,XN;function xA(){if(XN)return Im;XN=1;var e=Kn(),t=Object.create,n=(function(){function s(){}return function(a){if(!e(a))return{};if(t)return t(a);s.prototype=a;var l=new s;return s.prototype=void 0,l}})();return Im=n,Im}var $m,QN;function bA(){if(QN)return $m;QN=1;var e=xA(),t=Bd(),n=Fd();function s(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return $m=s,$m}var Om,ZN;function jB(){if(ZN)return Om;ZN=1;var e=xi(),t=qr(),n="[object Map]";function s(a){return t(a)&&e(a)==n}return Om=s,Om}var Pm,JN;function EB(){if(JN)return Pm;JN=1;var e=jB(),t=qd(),n=Dx(),s=n&&n.isMap,a=s?t(s):e;return Pm=a,Pm}var Lm,eS;function CB(){if(eS)return Lm;eS=1;var e=xi(),t=qr(),n="[object Set]";function s(a){return t(a)&&e(a)==n}return Lm=s,Lm}var Dm,tS;function TB(){if(tS)return Dm;tS=1;var e=CB(),t=qd(),n=Dx(),s=n&&n.isSet,a=s?t(s):e;return Dm=a,Dm}var qm,nS;function kA(){if(nS)return qm;nS=1;var e=Od(),t=Px(),n=Ld(),s=dB(),a=pB(),l=uA(),c=dA(),d=mB(),h=gB(),p=gA(),f=yB(),m=xi(),y=bB(),v=SB(),N=bA(),_=$t(),S=vi(),k=EB(),j=Kn(),E=TB(),C=Ks(),T=Za(),R=1,A=2,D=4,O="[object Arguments]",$="[object Array]",B="[object Boolean]",Z="[object Date]",J="[object Error]",I="[object Function]",X="[object GeneratorFunction]",G="[object Map]",q="[object Number]",Y="[object Object]",L="[object RegExp]",K="[object Set]",P="[object String]",V="[object Symbol]",he="[object WeakMap]",z="[object ArrayBuffer]",W="[object DataView]",ee="[object Float32Array]",H="[object Float64Array]",ae="[object Int8Array]",me="[object Int16Array]",ge="[object Int32Array]",Re="[object Uint8Array]",$e="[object Uint8ClampedArray]",ce="[object Uint16Array]",we="[object Uint32Array]",xe={};xe[O]=xe[$]=xe[z]=xe[W]=xe[B]=xe[Z]=xe[ee]=xe[H]=xe[ae]=xe[me]=xe[ge]=xe[G]=xe[q]=xe[Y]=xe[L]=xe[K]=xe[P]=xe[V]=xe[Re]=xe[$e]=xe[ce]=xe[we]=!0,xe[J]=xe[I]=xe[he]=!1;function De(_e,Ee,Ge,st,Je,Ze){var Qe,fe=Ee&R,ye=Ee&A,Se=Ee&D;if(Ge&&(Qe=Je?Ge(_e,st,Je,Ze):Ge(_e)),Qe!==void 0)return Qe;if(!j(_e))return _e;var Pe=_(_e);if(Pe){if(Qe=y(_e),!fe)return c(_e,Qe)}else{var et=m(_e),ft=et==I||et==X;if(S(_e))return l(_e,fe);if(et==Y||et==O||ft&&!Je){if(Qe=ye||ft?{}:N(_e),!fe)return ye?h(_e,a(Qe,_e)):d(_e,s(Qe,_e))}else{if(!xe[et])return Je?_e:{};Qe=v(_e,et,fe)}}Ze||(Ze=new e);var dt=Ze.get(_e);if(dt)return dt;Ze.set(_e,Qe),E(_e)?_e.forEach(function(re){Qe.add(De(re,Ee,Ge,re,_e,Ze))}):k(_e)&&_e.forEach(function(re,Fe){Qe.set(Fe,De(re,Ee,Ge,Fe,_e,Ze))});var ze=Se?ye?f:p:ye?T:C,Xe=Pe?void 0:ze(_e);return t(Xe||_e,function(re,Fe){Xe&&(Fe=re,re=_e[Fe]),n(Qe,Fe,De(re,Ee,Ge,Fe,_e,Ze))}),Qe}return qm=De,qm}var Fm,rS;function AB(){if(rS)return Fm;rS=1;var e=kA(),t=4;function n(s){return e(s,t)}return Fm=n,Fm}var Bm,sS;function Ux(){if(sS)return Bm;sS=1;function e(t){return function(){return t}}return Bm=e,Bm}var zm,aS;function RB(){if(aS)return zm;aS=1;function e(t){return function(n,s,a){for(var l=-1,c=Object(n),d=a(n),h=d.length;h--;){var p=d[t?h:++l];if(s(c[p],p,c)===!1)break}return n}}return zm=e,zm}var Um,oS;function Wx(){if(oS)return Um;oS=1;var e=RB(),t=e();return Um=t,Um}var Wm,iS;function Hx(){if(iS)return Wm;iS=1;var e=Wx(),t=Ks();function n(s,a){return s&&e(s,a,t)}return Wm=n,Wm}var Hm,lS;function MB(){if(lS)return Hm;lS=1;var e=ms();function t(n,s){return function(a,l){if(a==null)return a;if(!e(a))return n(a,l);for(var c=a.length,d=s?c:-1,h=Object(a);(s?d--:++d<c)&&l(h[d],d,h)!==!1;);return a}}return Hm=t,Hm}var Gm,cS;function zd(){if(cS)return Gm;cS=1;var e=Hx(),t=MB(),n=t(e);return Gm=n,Gm}var Vm,uS;function Ja(){if(uS)return Vm;uS=1;function e(t){return t}return Vm=e,Vm}var Ym,dS;function _A(){if(dS)return Ym;dS=1;var e=Ja();function t(n){return typeof n=="function"?n:e}return Ym=t,Ym}var Km,hS;function NA(){if(hS)return Km;hS=1;var e=Px(),t=zd(),n=_A(),s=$t();function a(l,c){var d=s(l)?e:t;return d(l,n(c))}return Km=a,Km}var Xm,fS;function SA(){return fS||(fS=1,Xm=NA()),Xm}var Qm,pS;function IB(){if(pS)return Qm;pS=1;var e=zd();function t(n,s){var a=[];return e(n,function(l,c,d){s(l,c,d)&&a.push(l)}),a}return Qm=t,Qm}var Zm,mS;function $B(){if(mS)return Zm;mS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Zm=t,Zm}var Jm,gS;function OB(){if(gS)return Jm;gS=1;function e(t){return this.__data__.has(t)}return Jm=e,Jm}var eg,yS;function jA(){if(yS)return eg;yS=1;var e=Ox(),t=$B(),n=OB();function s(a){var l=-1,c=a==null?0:a.length;for(this.__data__=new e;++l<c;)this.add(a[l])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,eg=s,eg}var tg,wS;function PB(){if(wS)return tg;wS=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 ng,vS;function EA(){if(vS)return ng;vS=1;function e(t,n){return t.has(n)}return ng=e,ng}var rg,xS;function CA(){if(xS)return rg;xS=1;var e=jA(),t=PB(),n=EA(),s=1,a=2;function l(c,d,h,p,f,m){var y=h&s,v=c.length,N=d.length;if(v!=N&&!(y&&N>v))return!1;var _=m.get(c),S=m.get(d);if(_&&S)return _==d&&S==c;var k=-1,j=!0,E=h&a?new e:void 0;for(m.set(c,d),m.set(d,c);++k<v;){var C=c[k],T=d[k];if(p)var R=y?p(T,C,k,d,c,m):p(C,T,k,c,d,m);if(R!==void 0){if(R)continue;j=!1;break}if(E){if(!t(d,function(A,D){if(!n(E,D)&&(C===A||f(C,A,h,p,m)))return E.push(D)})){j=!1;break}}else if(!(C===T||f(C,T,h,p,m))){j=!1;break}}return m.delete(c),m.delete(d),j}return rg=l,rg}var sg,bS;function LB(){if(bS)return sg;bS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a,l){s[++n]=[l,a]}),s}return sg=e,sg}var ag,kS;function Gx(){if(kS)return ag;kS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a){s[++n]=a}),s}return ag=e,ag}var og,_S;function DB(){if(_S)return og;_S=1;var e=wi(),t=wA(),n=yi(),s=CA(),a=LB(),l=Gx(),c=1,d=2,h="[object Boolean]",p="[object Date]",f="[object Error]",m="[object Map]",y="[object Number]",v="[object RegExp]",N="[object Set]",_="[object String]",S="[object Symbol]",k="[object ArrayBuffer]",j="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function T(R,A,D,O,$,B,Z){switch(D){case j:if(R.byteLength!=A.byteLength||R.byteOffset!=A.byteOffset)return!1;R=R.buffer,A=A.buffer;case k:return!(R.byteLength!=A.byteLength||!B(new t(R),new t(A)));case h:case p:case y:return n(+R,+A);case f:return R.name==A.name&&R.message==A.message;case v:case _:return R==A+"";case m:var J=a;case N:var I=O&c;if(J||(J=l),R.size!=A.size&&!I)return!1;var X=Z.get(R);if(X)return X==A;O|=d,Z.set(R,A);var G=s(J(R),J(A),O,$,B,Z);return Z.delete(R),G;case S:if(C)return C.call(R)==C.call(A)}return!1}return og=T,og}var ig,NS;function qB(){if(NS)return ig;NS=1;var e=gA(),t=1,n=Object.prototype,s=n.hasOwnProperty;function a(l,c,d,h,p,f){var m=d&t,y=e(l),v=y.length,N=e(c),_=N.length;if(v!=_&&!m)return!1;for(var S=v;S--;){var k=y[S];if(!(m?k in c:s.call(c,k)))return!1}var j=f.get(l),E=f.get(c);if(j&&E)return j==c&&E==l;var C=!0;f.set(l,c),f.set(c,l);for(var T=m;++S<v;){k=y[S];var R=l[k],A=c[k];if(h)var D=m?h(A,R,k,c,l,f):h(R,A,k,l,c,f);if(!(D===void 0?R===A||p(R,A,d,h,f):D)){C=!1;break}T||(T=k=="constructor")}if(C&&!T){var O=l.constructor,$=c.constructor;O!=$&&"constructor"in l&&"constructor"in c&&!(typeof O=="function"&&O instanceof O&&typeof $=="function"&&$ instanceof $)&&(C=!1)}return f.delete(l),f.delete(c),C}return ig=a,ig}var lg,SS;function FB(){if(SS)return lg;SS=1;var e=Od(),t=CA(),n=DB(),s=qB(),a=xi(),l=$t(),c=vi(),d=oc(),h=1,p="[object Arguments]",f="[object Array]",m="[object Object]",y=Object.prototype,v=y.hasOwnProperty;function N(_,S,k,j,E,C){var T=l(_),R=l(S),A=T?f:a(_),D=R?f:a(S);A=A==p?m:A,D=D==p?m:D;var O=A==m,$=D==m,B=A==D;if(B&&c(_)){if(!c(S))return!1;T=!0,O=!1}if(B&&!O)return C||(C=new e),T||d(_)?t(_,S,k,j,E,C):n(_,S,A,k,j,E,C);if(!(k&h)){var Z=O&&v.call(_,"__wrapped__"),J=$&&v.call(S,"__wrapped__");if(Z||J){var I=Z?_.value():_,X=J?S.value():S;return C||(C=new e),E(I,X,k,j,C)}}return B?(C||(C=new e),s(_,S,k,j,E,C)):!1}return lg=N,lg}var cg,jS;function TA(){if(jS)return cg;jS=1;var e=FB(),t=qr();function n(s,a,l,c,d){return s===a?!0:s==null||a==null||!t(s)&&!t(a)?s!==s&&a!==a:e(s,a,l,c,n,d)}return cg=n,cg}var ug,ES;function BB(){if(ES)return ug;ES=1;var e=Od(),t=TA(),n=1,s=2;function a(l,c,d,h){var p=d.length,f=p,m=!h;if(l==null)return!f;for(l=Object(l);p--;){var y=d[p];if(m&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<f;){y=d[p];var v=y[0],N=l[v],_=y[1];if(m&&y[2]){if(N===void 0&&!(v in l))return!1}else{var S=new e;if(h)var k=h(N,_,v,l,c,S);if(!(k===void 0?t(_,N,n|s,h,S):k))return!1}}return!0}return ug=a,ug}var dg,CS;function AA(){if(CS)return dg;CS=1;var e=Kn();function t(n){return n===n&&!e(n)}return dg=t,dg}var hg,TS;function zB(){if(TS)return hg;TS=1;var e=AA(),t=Ks();function n(s){for(var a=t(s),l=a.length;l--;){var c=a[l],d=s[c];a[l]=[c,d,e(d)]}return a}return hg=n,hg}var fg,AS;function RA(){if(AS)return fg;AS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return fg=e,fg}var pg,RS;function UB(){if(RS)return pg;RS=1;var e=BB(),t=zB(),n=RA();function s(a){var l=t(a);return l.length==1&&l[0][2]?n(l[0][0],l[0][1]):function(c){return c===a||e(c,a,l)}}return pg=s,pg}var mg,MS;function bi(){if(MS)return mg;MS=1;var e=Xa(),t=qr(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return mg=s,mg}var gg,IS;function Vx(){if(IS)return gg;IS=1;var e=$t(),t=bi(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(l,c){if(e(l))return!1;var d=typeof l;return d=="number"||d=="symbol"||d=="boolean"||l==null||t(l)?!0:s.test(l)||!n.test(l)||c!=null&&l in Object(c)}return gg=a,gg}var yg,$S;function WB(){if($S)return yg;$S=1;var e=Ox(),t="Expected a function";function n(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var l=function(){var c=arguments,d=a?a.apply(this,c):c[0],h=l.cache;if(h.has(d))return h.get(d);var p=s.apply(this,c);return l.cache=h.set(d,p)||h,p};return l.cache=new(n.Cache||e),l}return n.Cache=e,yg=n,yg}var wg,OS;function HB(){if(OS)return wg;OS=1;var e=WB(),t=500;function n(s){var a=e(s,function(c){return l.size===t&&l.clear(),c}),l=a.cache;return a}return wg=n,wg}var vg,PS;function GB(){if(PS)return vg;PS=1;var e=HB(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(a){var l=[];return a.charCodeAt(0)===46&&l.push(""),a.replace(t,function(c,d,h,p){l.push(h?p.replace(n,"$1"):d||c)}),l});return vg=s,vg}var xg,LS;function Ud(){if(LS)return xg;LS=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,l=Array(a);++s<a;)l[s]=n(t[s],s,t);return l}return xg=e,xg}var bg,DS;function VB(){if(DS)return bg;DS=1;var e=wi(),t=Ud(),n=$t(),s=bi(),a=e?e.prototype:void 0,l=a?a.toString:void 0;function c(d){if(typeof d=="string")return d;if(n(d))return t(d,c)+"";if(s(d))return l?l.call(d):"";var h=d+"";return h=="0"&&1/d==-1/0?"-0":h}return bg=c,bg}var kg,qS;function MA(){if(qS)return kg;qS=1;var e=VB();function t(n){return n==null?"":e(n)}return kg=t,kg}var _g,FS;function Wd(){if(FS)return _g;FS=1;var e=$t(),t=Vx(),n=GB(),s=MA();function a(l,c){return e(l)?l:t(l,c)?[l]:n(s(l))}return _g=a,_g}var Ng,BS;function ic(){if(BS)return Ng;BS=1;var e=bi();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Ng=t,Ng}var Sg,zS;function Hd(){if(zS)return Sg;zS=1;var e=Wd(),t=ic();function n(s,a){a=e(a,s);for(var l=0,c=a.length;s!=null&&l<c;)s=s[t(a[l++])];return l&&l==c?s:void 0}return Sg=n,Sg}var jg,US;function YB(){if(US)return jg;US=1;var e=Hd();function t(n,s,a){var l=n==null?void 0:e(n,s);return l===void 0?a:l}return jg=t,jg}var Eg,WS;function KB(){if(WS)return Eg;WS=1;function e(t,n){return t!=null&&n in Object(t)}return Eg=e,Eg}var Cg,HS;function IA(){if(HS)return Cg;HS=1;var e=Wd(),t=ac(),n=$t(),s=Dd(),a=Lx(),l=ic();function c(d,h,p){h=e(h,d);for(var f=-1,m=h.length,y=!1;++f<m;){var v=l(h[f]);if(!(y=d!=null&&p(d,v)))break;d=d[v]}return y||++f!=m?y:(m=d==null?0:d.length,!!m&&a(m)&&s(v,m)&&(n(d)||t(d)))}return Cg=c,Cg}var Tg,GS;function $A(){if(GS)return Tg;GS=1;var e=KB(),t=IA();function n(s,a){return s!=null&&t(s,a,e)}return Tg=n,Tg}var Ag,VS;function XB(){if(VS)return Ag;VS=1;var e=TA(),t=YB(),n=$A(),s=Vx(),a=AA(),l=RA(),c=ic(),d=1,h=2;function p(f,m){return s(f)&&a(m)?l(c(f),m):function(y){var v=t(y,f);return v===void 0&&v===m?n(y,f):e(m,v,d|h)}}return Ag=p,Ag}var Rg,YS;function OA(){if(YS)return Rg;YS=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Rg=e,Rg}var Mg,KS;function QB(){if(KS)return Mg;KS=1;var e=Hd();function t(n){return function(s){return e(s,n)}}return Mg=t,Mg}var Ig,XS;function ZB(){if(XS)return Ig;XS=1;var e=OA(),t=QB(),n=Vx(),s=ic();function a(l){return n(l)?e(s(l)):t(l)}return Ig=a,Ig}var $g,QS;function gs(){if(QS)return $g;QS=1;var e=UB(),t=XB(),n=Ja(),s=$t(),a=ZB();function l(c){return typeof c=="function"?c:c==null?n:typeof c=="object"?s(c)?t(c[0],c[1]):e(c):a(c)}return $g=l,$g}var Og,ZS;function PA(){if(ZS)return Og;ZS=1;var e=hA(),t=IB(),n=gs(),s=$t();function a(l,c){var d=s(l)?e:t;return d(l,n(c,3))}return Og=a,Og}var Pg,JS;function JB(){if(JS)return Pg;JS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,a){return s!=null&&t.call(s,a)}return Pg=n,Pg}var Lg,ej;function LA(){if(ej)return Lg;ej=1;var e=JB(),t=IA();function n(s,a){return s!=null&&t(s,a,e)}return Lg=n,Lg}var Dg,tj;function ez(){if(tj)return Dg;tj=1;var e=qx(),t=xi(),n=ac(),s=$t(),a=ms(),l=vi(),c=Fd(),d=oc(),h="[object Map]",p="[object Set]",f=Object.prototype,m=f.hasOwnProperty;function y(v){if(v==null)return!0;if(a(v)&&(s(v)||typeof v=="string"||typeof v.splice=="function"||l(v)||d(v)||n(v)))return!v.length;var N=t(v);if(N==h||N==p)return!v.size;if(c(v))return!e(v).length;for(var _ in v)if(m.call(v,_))return!1;return!0}return Dg=y,Dg}var qg,nj;function DA(){if(nj)return qg;nj=1;function e(t){return t===void 0}return qg=e,qg}var Fg,rj;function qA(){if(rj)return Fg;rj=1;var e=zd(),t=ms();function n(s,a){var l=-1,c=t(s)?Array(s.length):[];return e(s,function(d,h,p){c[++l]=a(d,h,p)}),c}return Fg=n,Fg}var Bg,sj;function FA(){if(sj)return Bg;sj=1;var e=Ud(),t=gs(),n=qA(),s=$t();function a(l,c){var d=s(l)?e:n;return d(l,t(c,3))}return Bg=a,Bg}var zg,aj;function tz(){if(aj)return zg;aj=1;function e(t,n,s,a){var l=-1,c=t==null?0:t.length;for(a&&c&&(s=t[++l]);++l<c;)s=n(s,t[l],l,t);return s}return zg=e,zg}var Ug,oj;function nz(){if(oj)return Ug;oj=1;function e(t,n,s,a,l){return l(t,function(c,d,h){s=a?(a=!1,c):n(s,c,d,h)}),s}return Ug=e,Ug}var Wg,ij;function BA(){if(ij)return Wg;ij=1;var e=tz(),t=zd(),n=gs(),s=nz(),a=$t();function l(c,d,h){var p=a(c)?e:s,f=arguments.length<3;return p(c,n(d,4),h,f,t)}return Wg=l,Wg}var Hg,lj;function rz(){if(lj)return Hg;lj=1;var e=Xa(),t=$t(),n=qr(),s="[object String]";function a(l){return typeof l=="string"||!t(l)&&n(l)&&e(l)==s}return Hg=a,Hg}var Gg,cj;function sz(){if(cj)return Gg;cj=1;var e=OA(),t=e("length");return Gg=t,Gg}var Vg,uj;function az(){if(uj)return Vg;uj=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,l="\\ufe0e\\ufe0f",c="\\u200d",d=RegExp("["+c+e+a+l+"]");function h(p){return d.test(p)}return Vg=h,Vg}var Yg,dj;function oz(){if(dj)return Yg;dj=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,l="\\ufe0e\\ufe0f",c="["+e+"]",d="["+a+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+d+"|"+h+")",f="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",N=p+"?",_="["+l+"]?",S="(?:"+v+"(?:"+[f,m,y].join("|")+")"+_+N+")*",k=_+N+S,j="(?:"+[f+d+"?",d,m,y,c].join("|")+")",E=RegExp(h+"(?="+h+")|"+j+k,"g");function C(T){for(var R=E.lastIndex=0;E.test(T);)++R;return R}return Yg=C,Yg}var Kg,hj;function iz(){if(hj)return Kg;hj=1;var e=sz(),t=az(),n=oz();function s(a){return t(a)?n(a):e(a)}return Kg=s,Kg}var Xg,fj;function lz(){if(fj)return Xg;fj=1;var e=qx(),t=xi(),n=ms(),s=rz(),a=iz(),l="[object Map]",c="[object Set]";function d(h){if(h==null)return 0;if(n(h))return s(h)?a(h):h.length;var p=t(h);return p==l||p==c?h.size:e(h).length}return Xg=d,Xg}var Qg,pj;function cz(){if(pj)return Qg;pj=1;var e=Px(),t=xA(),n=Hx(),s=gs(),a=Bd(),l=$t(),c=vi(),d=rc(),h=Kn(),p=oc();function f(m,y,v){var N=l(m),_=N||c(m)||p(m);if(y=s(y,4),v==null){var S=m&&m.constructor;_?v=N?new S:[]:h(m)?v=d(S)?t(a(m)):{}:v={}}return(_?e:n)(m,function(k,j,E){return y(v,k,j,E)}),v}return Qg=f,Qg}var Zg,mj;function uz(){if(mj)return Zg;mj=1;var e=wi(),t=ac(),n=$t(),s=e?e.isConcatSpreadable:void 0;function a(l){return n(l)||t(l)||!!(s&&l&&l[s])}return Zg=a,Zg}var Jg,gj;function Yx(){if(gj)return Jg;gj=1;var e=Bx(),t=uz();function n(s,a,l,c,d){var h=-1,p=s.length;for(l||(l=t),d||(d=[]);++h<p;){var f=s[h];a>0&&l(f)?a>1?n(f,a-1,l,c,d):e(d,f):c||(d[d.length]=f)}return d}return Jg=n,Jg}var ey,yj;function dz(){if(yj)return ey;yj=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 ey=e,ey}var ty,wj;function zA(){if(wj)return ty;wj=1;var e=dz(),t=Math.max;function n(s,a,l){return a=t(a===void 0?s.length-1:a,0),function(){for(var c=arguments,d=-1,h=t(c.length-a,0),p=Array(h);++d<h;)p[d]=c[a+d];d=-1;for(var f=Array(a+1);++d<a;)f[d]=c[d];return f[a]=l(p),e(s,this,f)}}return ty=n,ty}var ny,vj;function hz(){if(vj)return ny;vj=1;var e=Ux(),t=iA(),n=Ja(),s=t?function(a,l){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:n;return ny=s,ny}var ry,xj;function fz(){if(xj)return ry;xj=1;var e=800,t=16,n=Date.now;function s(a){var l=0,c=0;return function(){var d=n(),h=t-(d-c);if(c=d,h>0){if(++l>=e)return arguments[0]}else l=0;return a.apply(void 0,arguments)}}return ry=s,ry}var sy,bj;function UA(){if(bj)return sy;bj=1;var e=hz(),t=fz(),n=t(e);return sy=n,sy}var ay,kj;function Gd(){if(kj)return ay;kj=1;var e=Ja(),t=zA(),n=UA();function s(a,l){return n(t(a,l,e),a+"")}return ay=s,ay}var oy,_j;function WA(){if(_j)return oy;_j=1;function e(t,n,s,a){for(var l=t.length,c=s+(a?1:-1);a?c--:++c<l;)if(n(t[c],c,t))return c;return-1}return oy=e,oy}var iy,Nj;function pz(){if(Nj)return iy;Nj=1;function e(t){return t!==t}return iy=e,iy}var ly,Sj;function mz(){if(Sj)return ly;Sj=1;function e(t,n,s){for(var a=s-1,l=t.length;++a<l;)if(t[a]===n)return a;return-1}return ly=e,ly}var cy,jj;function gz(){if(jj)return cy;jj=1;var e=WA(),t=pz(),n=mz();function s(a,l,c){return l===l?n(a,l,c):e(a,t,c)}return cy=s,cy}var uy,Ej;function yz(){if(Ej)return uy;Ej=1;var e=gz();function t(n,s){var a=n==null?0:n.length;return!!a&&e(n,s,0)>-1}return uy=t,uy}var dy,Cj;function wz(){if(Cj)return dy;Cj=1;function e(t,n,s){for(var a=-1,l=t==null?0:t.length;++a<l;)if(s(n,t[a]))return!0;return!1}return dy=e,dy}var hy,Tj;function vz(){if(Tj)return hy;Tj=1;function e(){}return hy=e,hy}var fy,Aj;function xz(){if(Aj)return fy;Aj=1;var e=yA(),t=vz(),n=Gx(),s=1/0,a=e&&1/n(new e([,-0]))[1]==s?function(l){return new e(l)}:t;return fy=a,fy}var py,Rj;function bz(){if(Rj)return py;Rj=1;var e=jA(),t=yz(),n=wz(),s=EA(),a=xz(),l=Gx(),c=200;function d(h,p,f){var m=-1,y=t,v=h.length,N=!0,_=[],S=_;if(f)N=!1,y=n;else if(v>=c){var k=p?null:a(h);if(k)return l(k);N=!1,y=s,S=new e}else S=p?[]:_;e:for(;++m<v;){var j=h[m],E=p?p(j):j;if(j=f||j!==0?j:0,N&&E===E){for(var C=S.length;C--;)if(S[C]===E)continue e;p&&S.push(E),_.push(j)}else y(S,E,f)||(S!==_&&S.push(E),_.push(j))}return _}return py=d,py}var my,Mj;function HA(){if(Mj)return my;Mj=1;var e=ms(),t=qr();function n(s){return t(s)&&e(s)}return my=n,my}var gy,Ij;function kz(){if(Ij)return gy;Ij=1;var e=Yx(),t=Gd(),n=bz(),s=HA(),a=t(function(l){return n(e(l,1,s,!0))});return gy=a,gy}var yy,$j;function _z(){if($j)return yy;$j=1;var e=Ud();function t(n,s){return e(s,function(a){return n[a]})}return yy=t,yy}var wy,Oj;function GA(){if(Oj)return wy;Oj=1;var e=_z(),t=Ks();function n(s){return s==null?[]:e(s,t(s))}return wy=n,wy}var vy,Pj;function Xn(){if(Pj)return vy;Pj=1;var e;if(typeof Ix=="function")try{e={clone:AB(),constant:Ux(),each:SA(),filter:PA(),has:LA(),isArray:$t(),isEmpty:ez(),isFunction:rc(),isUndefined:DA(),keys:Ks(),map:FA(),reduce:BA(),size:lz(),transform:cz(),union:kz(),values:GA()}}catch{}return e||(e=window._),vy=e,vy}var xy,Lj;function Kx(){if(Lj)return xy;Lj=1;var e=Xn();xy=a;var t="\0",n="\0",s="";function a(f){this._isDirected=e.has(f,"directed")?f.directed:!0,this._isMultigraph=e.has(f,"multigraph")?f.multigraph:!1,this._isCompound=e.has(f,"compound")?f.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(f){return this._label=f,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultNodeLabelFn=f,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var f=this;return e.filter(this.nodes(),function(m){return e.isEmpty(f._in[m])})},a.prototype.sinks=function(){var f=this;return e.filter(this.nodes(),function(m){return e.isEmpty(f._out[m])})},a.prototype.setNodes=function(f,m){var y=arguments,v=this;return e.each(f,function(N){y.length>1?v.setNode(N,m):v.setNode(N)}),this},a.prototype.setNode=function(f,m){return e.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=m),this):(this._nodes[f]=arguments.length>1?m:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},a.prototype.node=function(f){return this._nodes[f]},a.prototype.hasNode=function(f){return e.has(this._nodes,f)},a.prototype.removeNode=function(f){var m=this;if(e.has(this._nodes,f)){var y=function(v){m.removeEdge(m._edgeObjs[v])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],e.each(this.children(f),function(v){m.setParent(v)}),delete this._children[f]),e.each(e.keys(this._in[f]),y),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),y),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},a.prototype.setParent=function(f,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===f)throw new Error("Setting "+m+" as parent of "+f+" would create a cycle");this.setNode(m)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=m,this._children[m][f]=!0,this},a.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},a.prototype.parent=function(f){if(this._isCompound){var m=this._parent[f];if(m!==n)return m}},a.prototype.children=function(f){if(e.isUndefined(f)&&(f=n),this._isCompound){var m=this._children[f];if(m)return e.keys(m)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},a.prototype.predecessors=function(f){var m=this._preds[f];if(m)return e.keys(m)},a.prototype.successors=function(f){var m=this._sucs[f];if(m)return e.keys(m)},a.prototype.neighbors=function(f){var m=this.predecessors(f);if(m)return e.union(m,this.successors(f))},a.prototype.isLeaf=function(f){var m;return this.isDirected()?m=this.successors(f):m=this.neighbors(f),m.length===0},a.prototype.filterNodes=function(f){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(_,S){f(S)&&m.setNode(S,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var v={};function N(_){var S=y.parent(_);return S===void 0||m.hasNode(S)?(v[_]=S,S):S in v?v[S]:N(S)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,N(_))}),m},a.prototype.setDefaultEdgeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultEdgeLabelFn=f,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(f,m){var y=this,v=arguments;return e.reduce(f,function(N,_){return v.length>1?y.setEdge(N,_,m):y.setEdge(N,_),_}),this},a.prototype.setEdge=function(){var f,m,y,v,N=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(f=_.v,m=_.w,y=_.name,arguments.length===2&&(v=arguments[1],N=!0)):(f=_,m=arguments[1],y=arguments[3],arguments.length>2&&(v=arguments[2],N=!0)),f=""+f,m=""+m,e.isUndefined(y)||(y=""+y);var S=d(this._isDirected,f,m,y);if(e.has(this._edgeLabels,S))return N&&(this._edgeLabels[S]=v),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(m),this._edgeLabels[S]=N?v:this._defaultEdgeLabelFn(f,m,y);var k=h(this._isDirected,f,m,y);return f=k.v,m=k.w,Object.freeze(k),this._edgeObjs[S]=k,l(this._preds[m],f),l(this._sucs[f],m),this._in[m][S]=k,this._out[f][S]=k,this._edgeCount++,this},a.prototype.edge=function(f,m,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,f,m,y);return this._edgeLabels[v]},a.prototype.hasEdge=function(f,m,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,f,m,y);return e.has(this._edgeLabels,v)},a.prototype.removeEdge=function(f,m,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,f,m,y),N=this._edgeObjs[v];return N&&(f=N.v,m=N.w,delete this._edgeLabels[v],delete this._edgeObjs[v],c(this._preds[m],f),c(this._sucs[f],m),delete this._in[m][v],delete this._out[f][v],this._edgeCount--),this},a.prototype.inEdges=function(f,m){var y=this._in[f];if(y){var v=e.values(y);return m?e.filter(v,function(N){return N.v===m}):v}},a.prototype.outEdges=function(f,m){var y=this._out[f];if(y){var v=e.values(y);return m?e.filter(v,function(N){return N.w===m}):v}},a.prototype.nodeEdges=function(f,m){var y=this.inEdges(f,m);if(y)return y.concat(this.outEdges(f,m))};function l(f,m){f[m]?f[m]++:f[m]=1}function c(f,m){--f[m]||delete f[m]}function d(f,m,y,v){var N=""+m,_=""+y;if(!f&&N>_){var S=N;N=_,_=S}return N+s+_+s+(e.isUndefined(v)?t:v)}function h(f,m,y,v){var N=""+m,_=""+y;if(!f&&N>_){var S=N;N=_,_=S}var k={v:N,w:_};return v&&(k.name=v),k}function p(f,m){return d(f,m.v,m.w,m.name)}return xy}var by,Dj;function Nz(){return Dj||(Dj=1,by="2.1.8"),by}var ky,qj;function Sz(){return qj||(qj=1,ky={Graph:Kx(),version:Nz()}),ky}var _y,Fj;function jz(){if(Fj)return _y;Fj=1;var e=Xn(),t=Kx();_y={write:n,read:l};function n(c){var d={options:{directed:c.isDirected(),multigraph:c.isMultigraph(),compound:c.isCompound()},nodes:s(c),edges:a(c)};return e.isUndefined(c.graph())||(d.value=e.clone(c.graph())),d}function s(c){return e.map(c.nodes(),function(d){var h=c.node(d),p=c.parent(d),f={v:d};return e.isUndefined(h)||(f.value=h),e.isUndefined(p)||(f.parent=p),f})}function a(c){return e.map(c.edges(),function(d){var h=c.edge(d),p={v:d.v,w:d.w};return e.isUndefined(d.name)||(p.name=d.name),e.isUndefined(h)||(p.value=h),p})}function l(c){var d=new t(c.options).setGraph(c.value);return e.each(c.nodes,function(h){d.setNode(h.v,h.value),h.parent&&d.setParent(h.v,h.parent)}),e.each(c.edges,function(h){d.setEdge({v:h.v,w:h.w,name:h.name},h.value)}),d}return _y}var Ny,Bj;function Ez(){if(Bj)return Ny;Bj=1;var e=Xn();Ny=t;function t(n){var s={},a=[],l;function c(d){e.has(s,d)||(s[d]=!0,l.push(d),e.each(n.successors(d),c),e.each(n.predecessors(d),c))}return e.each(n.nodes(),function(d){l=[],c(d),l.length&&a.push(l)}),a}return Ny}var Sy,zj;function VA(){if(zj)return Sy;zj=1;var e=Xn();Sy=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 l=this._arr,c=l.length;return a[n]=c,l.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,l=a+1,c=n;a<s.length&&(c=s[a].priority<s[c].priority?a:c,l<s.length&&(c=s[l].priority<s[c].priority?l:c),c!==n&&(this._swap(n,c),this._heapify(c)))},t.prototype._decrease=function(n){for(var s=this._arr,a=s[n].priority,l;n!==0&&(l=n>>1,!(s[l].priority<a));)this._swap(n,l),n=l},t.prototype._swap=function(n,s){var a=this._arr,l=this._keyIndices,c=a[n],d=a[s];a[n]=d,a[s]=c,l[d.key]=n,l[c.key]=s},Sy}var jy,Uj;function YA(){if(Uj)return jy;Uj=1;var e=Xn(),t=VA();jy=s;var n=e.constant(1);function s(l,c,d,h){return a(l,String(c),d||n,h||function(p){return l.outEdges(p)})}function a(l,c,d,h){var p={},f=new t,m,y,v=function(N){var _=N.v!==m?N.v:N.w,S=p[_],k=d(N),j=y.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+k);j<S.distance&&(S.distance=j,S.predecessor=m,f.decrease(_,j))};for(l.nodes().forEach(function(N){var _=N===c?0:Number.POSITIVE_INFINITY;p[N]={distance:_},f.add(N,_)});f.size()>0&&(m=f.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)h(m).forEach(v);return p}return jy}var Ey,Wj;function Cz(){if(Wj)return Ey;Wj=1;var e=YA(),t=Xn();Ey=n;function n(s,a,l){return t.transform(s.nodes(),function(c,d){c[d]=e(s,d,a,l)},{})}return Ey}var Cy,Hj;function KA(){if(Hj)return Cy;Hj=1;var e=Xn();Cy=t;function t(n){var s=0,a=[],l={},c=[];function d(h){var p=l[h]={onStack:!0,lowlink:s,index:s++};if(a.push(h),n.successors(h).forEach(function(y){e.has(l,y)?l[y].onStack&&(p.lowlink=Math.min(p.lowlink,l[y].index)):(d(y),p.lowlink=Math.min(p.lowlink,l[y].lowlink))}),p.lowlink===p.index){var f=[],m;do m=a.pop(),l[m].onStack=!1,f.push(m);while(h!==m);c.push(f)}}return n.nodes().forEach(function(h){e.has(l,h)||d(h)}),c}return Cy}var Ty,Gj;function Tz(){if(Gj)return Ty;Gj=1;var e=Xn(),t=KA();Ty=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 Ty}var Ay,Vj;function Az(){if(Vj)return Ay;Vj=1;var e=Xn();Ay=n;var t=e.constant(1);function n(a,l,c){return s(a,l||t,c||function(d){return a.outEdges(d)})}function s(a,l,c){var d={},h=a.nodes();return h.forEach(function(p){d[p]={},d[p][p]={distance:0},h.forEach(function(f){p!==f&&(d[p][f]={distance:Number.POSITIVE_INFINITY})}),c(p).forEach(function(f){var m=f.v===p?f.w:f.v,y=l(f);d[p][m]={distance:y,predecessor:p}})}),h.forEach(function(p){var f=d[p];h.forEach(function(m){var y=d[m];h.forEach(function(v){var N=y[p],_=f[v],S=y[v],k=N.distance+_.distance;k<S.distance&&(S.distance=k,S.predecessor=_.predecessor)})})}),d}return Ay}var Ry,Yj;function XA(){if(Yj)return Ry;Yj=1;var e=Xn();Ry=t,t.CycleException=n;function t(s){var a={},l={},c=[];function d(h){if(e.has(l,h))throw new n;e.has(a,h)||(l[h]=!0,a[h]=!0,e.each(s.predecessors(h),d),delete l[h],c.push(h))}if(e.each(s.sinks(),d),e.size(a)!==s.nodeCount())throw new n;return c}function n(){}return n.prototype=new Error,Ry}var My,Kj;function Rz(){if(Kj)return My;Kj=1;var e=XA();My=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return My}var Iy,Xj;function QA(){if(Xj)return Iy;Xj=1;var e=Xn();Iy=t;function t(s,a,l){e.isArray(a)||(a=[a]);var c=(s.isDirected()?s.successors:s.neighbors).bind(s),d=[],h={};return e.each(a,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,l==="post",h,c,d)}),d}function n(s,a,l,c,d,h){e.has(c,a)||(c[a]=!0,l||h.push(a),e.each(d(a),function(p){n(s,p,l,c,d,h)}),l&&h.push(a))}return Iy}var $y,Qj;function Mz(){if(Qj)return $y;Qj=1;var e=QA();$y=t;function t(n,s){return e(n,s,"post")}return $y}var Oy,Zj;function Iz(){if(Zj)return Oy;Zj=1;var e=QA();Oy=t;function t(n,s){return e(n,s,"pre")}return Oy}var Py,Jj;function $z(){if(Jj)return Py;Jj=1;var e=Xn(),t=Kx(),n=VA();Py=s;function s(a,l){var c=new t,d={},h=new n,p;function f(y){var v=y.v===p?y.w:y.v,N=h.priority(v);if(N!==void 0){var _=l(y);_<N&&(d[v]=p,h.decrease(v,_))}}if(a.nodeCount()===0)return c;e.each(a.nodes(),function(y){h.add(y,Number.POSITIVE_INFINITY),c.setNode(y)}),h.decrease(a.nodes()[0],0);for(var m=!1;h.size()>0;){if(p=h.removeMin(),e.has(d,p))c.setEdge(p,d[p]);else{if(m)throw new Error("Input graph is not connected: "+a);m=!0}a.nodeEdges(p).forEach(f)}return c}return Py}var Ly,eE;function Oz(){return eE||(eE=1,Ly={components:Ez(),dijkstra:YA(),dijkstraAll:Cz(),findCycles:Tz(),floydWarshall:Az(),isAcyclic:Rz(),postorder:Mz(),preorder:Iz(),prim:$z(),tarjan:KA(),topsort:XA()}),Ly}var Dy,tE;function Pz(){if(tE)return Dy;tE=1;var e=Sz();return Dy={Graph:e.Graph,json:jz(),alg:Oz(),version:e.version},Dy}var qy,nE;function gr(){if(nE)return qy;nE=1;var e;if(typeof Ix=="function")try{e=Pz()}catch{}return e||(e=window.graphlib),qy=e,qy}var Fy,rE;function Lz(){if(rE)return Fy;rE=1;var e=kA(),t=1,n=4;function s(a){return e(a,t|n)}return Fy=s,Fy}var By,sE;function Vd(){if(sE)return By;sE=1;var e=yi(),t=ms(),n=Dd(),s=Kn();function a(l,c,d){if(!s(d))return!1;var h=typeof c;return(h=="number"?t(d)&&n(c,d.length):h=="string"&&c in d)?e(d[c],l):!1}return By=a,By}var zy,aE;function Dz(){if(aE)return zy;aE=1;var e=Gd(),t=yi(),n=Vd(),s=Za(),a=Object.prototype,l=a.hasOwnProperty,c=e(function(d,h){d=Object(d);var p=-1,f=h.length,m=f>2?h[2]:void 0;for(m&&n(h[0],h[1],m)&&(f=1);++p<f;)for(var y=h[p],v=s(y),N=-1,_=v.length;++N<_;){var S=v[N],k=d[S];(k===void 0||t(k,a[S])&&!l.call(d,S))&&(d[S]=y[S])}return d});return zy=c,zy}var Uy,oE;function qz(){if(oE)return Uy;oE=1;var e=gs(),t=ms(),n=Ks();function s(a){return function(l,c,d){var h=Object(l);if(!t(l)){var p=e(c,3);l=n(l),c=function(m){return p(h[m],m,h)}}var f=a(l,c,d);return f>-1?h[p?l[f]:f]:void 0}}return Uy=s,Uy}var Wy,iE;function Fz(){if(iE)return Wy;iE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return Wy=t,Wy}var Hy,lE;function Bz(){if(lE)return Hy;lE=1;var e=Fz(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return Hy=n,Hy}var Gy,cE;function zz(){if(cE)return Gy;cE=1;var e=Bz(),t=Kn(),n=bi(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,d=parseInt;function h(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var f=typeof p.valueOf=="function"?p.valueOf():p;p=t(f)?f+"":f}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=l.test(p);return m||c.test(p)?d(p.slice(2),m?2:8):a.test(p)?s:+p}return Gy=h,Gy}var Vy,uE;function ZA(){if(uE)return Vy;uE=1;var e=zz(),t=1/0,n=17976931348623157e292;function s(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var l=a<0?-1:1;return l*n}return a===a?a:0}return Vy=s,Vy}var Yy,dE;function Uz(){if(dE)return Yy;dE=1;var e=ZA();function t(n){var s=e(n),a=s%1;return s===s?a?s-a:s:0}return Yy=t,Yy}var Ky,hE;function Wz(){if(hE)return Ky;hE=1;var e=WA(),t=gs(),n=Uz(),s=Math.max;function a(l,c,d){var h=l==null?0:l.length;if(!h)return-1;var p=d==null?0:n(d);return p<0&&(p=s(h+p,0)),e(l,t(c,3),p)}return Ky=a,Ky}var Xy,fE;function Hz(){if(fE)return Xy;fE=1;var e=qz(),t=Wz(),n=e(t);return Xy=n,Xy}var Qy,pE;function JA(){if(pE)return Qy;pE=1;var e=Yx();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return Qy=t,Qy}var Zy,mE;function Gz(){if(mE)return Zy;mE=1;var e=Wx(),t=_A(),n=Za();function s(a,l){return a==null?a:e(a,t(l),n)}return Zy=s,Zy}var Jy,gE;function Vz(){if(gE)return Jy;gE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Jy=e,Jy}var ew,yE;function Yz(){if(yE)return ew;yE=1;var e=Pd(),t=Hx(),n=gs();function s(a,l){var c={};return l=n(l,3),t(a,function(d,h,p){e(c,h,l(d,h,p))}),c}return ew=s,ew}var tw,wE;function Xx(){if(wE)return tw;wE=1;var e=bi();function t(n,s,a){for(var l=-1,c=n.length;++l<c;){var d=n[l],h=s(d);if(h!=null&&(p===void 0?h===h&&!e(h):a(h,p)))var p=h,f=d}return f}return tw=t,tw}var nw,vE;function Kz(){if(vE)return nw;vE=1;function e(t,n){return t>n}return nw=e,nw}var rw,xE;function Xz(){if(xE)return rw;xE=1;var e=Xx(),t=Kz(),n=Ja();function s(a){return a&&a.length?e(a,n,t):void 0}return rw=s,rw}var sw,bE;function eR(){if(bE)return sw;bE=1;var e=Pd(),t=yi();function n(s,a,l){(l!==void 0&&!t(s[a],l)||l===void 0&&!(a in s))&&e(s,a,l)}return sw=n,sw}var aw,kE;function Qz(){if(kE)return aw;kE=1;var e=Xa(),t=Bd(),n=qr(),s="[object Object]",a=Function.prototype,l=Object.prototype,c=a.toString,d=l.hasOwnProperty,h=c.call(Object);function p(f){if(!n(f)||e(f)!=s)return!1;var m=t(f);if(m===null)return!0;var y=d.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&c.call(y)==h}return aw=p,aw}var ow,_E;function tR(){if(_E)return ow;_E=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return ow=e,ow}var iw,NE;function Zz(){if(NE)return iw;NE=1;var e=sc(),t=Za();function n(s){return e(s,t(s))}return iw=n,iw}var lw,SE;function Jz(){if(SE)return lw;SE=1;var e=eR(),t=uA(),n=vA(),s=dA(),a=bA(),l=ac(),c=$t(),d=HA(),h=vi(),p=rc(),f=Kn(),m=Qz(),y=oc(),v=tR(),N=Zz();function _(S,k,j,E,C,T,R){var A=v(S,j),D=v(k,j),O=R.get(D);if(O){e(S,j,O);return}var $=T?T(A,D,j+"",S,k,R):void 0,B=$===void 0;if(B){var Z=c(D),J=!Z&&h(D),I=!Z&&!J&&y(D);$=D,Z||J||I?c(A)?$=A:d(A)?$=s(A):J?(B=!1,$=t(D,!0)):I?(B=!1,$=n(D,!0)):$=[]:m(D)||l(D)?($=A,l(A)?$=N(A):(!f(A)||p(A))&&($=a(D))):B=!1}B&&(R.set(D,$),C($,D,E,T,R),R.delete(D)),e(S,j,$)}return lw=_,lw}var cw,jE;function eU(){if(jE)return cw;jE=1;var e=Od(),t=eR(),n=Wx(),s=Jz(),a=Kn(),l=Za(),c=tR();function d(h,p,f,m,y){h!==p&&n(p,function(v,N){if(y||(y=new e),a(v))s(h,p,N,f,d,m,y);else{var _=m?m(c(h,N),v,N+"",h,p,y):void 0;_===void 0&&(_=v),t(h,N,_)}},l)}return cw=d,cw}var uw,EE;function tU(){if(EE)return uw;EE=1;var e=Gd(),t=Vd();function n(s){return e(function(a,l){var c=-1,d=l.length,h=d>1?l[d-1]:void 0,p=d>2?l[2]:void 0;for(h=s.length>3&&typeof h=="function"?(d--,h):void 0,p&&t(l[0],l[1],p)&&(h=d<3?void 0:h,d=1),a=Object(a);++c<d;){var f=l[c];f&&s(a,f,c,h)}return a})}return uw=n,uw}var dw,CE;function nU(){if(CE)return dw;CE=1;var e=eU(),t=tU(),n=t(function(s,a,l){e(s,a,l)});return dw=n,dw}var hw,TE;function nR(){if(TE)return hw;TE=1;function e(t,n){return t<n}return hw=e,hw}var fw,AE;function rU(){if(AE)return fw;AE=1;var e=Xx(),t=nR(),n=Ja();function s(a){return a&&a.length?e(a,n,t):void 0}return fw=s,fw}var pw,RE;function sU(){if(RE)return pw;RE=1;var e=Xx(),t=gs(),n=nR();function s(a,l){return a&&a.length?e(a,t(l,2),n):void 0}return pw=s,pw}var mw,ME;function aU(){if(ME)return mw;ME=1;var e=wr(),t=function(){return e.Date.now()};return mw=t,mw}var gw,IE;function oU(){if(IE)return gw;IE=1;var e=Ld(),t=Wd(),n=Dd(),s=Kn(),a=ic();function l(c,d,h,p){if(!s(c))return c;d=t(d,c);for(var f=-1,m=d.length,y=m-1,v=c;v!=null&&++f<m;){var N=a(d[f]),_=h;if(N==="__proto__"||N==="constructor"||N==="prototype")return c;if(f!=y){var S=v[N];_=p?p(S,N,v):void 0,_===void 0&&(_=s(S)?S:n(d[f+1])?[]:{})}e(v,N,_),v=v[N]}return c}return gw=l,gw}var yw,$E;function iU(){if($E)return yw;$E=1;var e=Hd(),t=oU(),n=Wd();function s(a,l,c){for(var d=-1,h=l.length,p={};++d<h;){var f=l[d],m=e(a,f);c(m,f)&&t(p,n(f,a),m)}return p}return yw=s,yw}var ww,OE;function lU(){if(OE)return ww;OE=1;var e=iU(),t=$A();function n(s,a){return e(s,a,function(l,c){return t(s,c)})}return ww=n,ww}var vw,PE;function cU(){if(PE)return vw;PE=1;var e=JA(),t=zA(),n=UA();function s(a){return n(t(a,void 0,e),a+"")}return vw=s,vw}var xw,LE;function uU(){if(LE)return xw;LE=1;var e=lU(),t=cU(),n=t(function(s,a){return s==null?{}:e(s,a)});return xw=n,xw}var bw,DE;function dU(){if(DE)return bw;DE=1;var e=Math.ceil,t=Math.max;function n(s,a,l,c){for(var d=-1,h=t(e((a-s)/(l||1)),0),p=Array(h);h--;)p[c?h:++d]=s,s+=l;return p}return bw=n,bw}var kw,qE;function hU(){if(qE)return kw;qE=1;var e=dU(),t=Vd(),n=ZA();function s(a){return function(l,c,d){return d&&typeof d!="number"&&t(l,c,d)&&(c=d=void 0),l=n(l),c===void 0?(c=l,l=0):c=n(c),d=d===void 0?l<c?1:-1:n(d),e(l,c,d,a)}}return kw=s,kw}var _w,FE;function fU(){if(FE)return _w;FE=1;var e=hU(),t=e();return _w=t,_w}var Nw,BE;function pU(){if(BE)return Nw;BE=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Nw=e,Nw}var Sw,zE;function mU(){if(zE)return Sw;zE=1;var e=bi();function t(n,s){if(n!==s){var a=n!==void 0,l=n===null,c=n===n,d=e(n),h=s!==void 0,p=s===null,f=s===s,m=e(s);if(!p&&!m&&!d&&n>s||d&&h&&f&&!p&&!m||l&&h&&f||!a&&f||!c)return 1;if(!l&&!d&&!m&&n<s||m&&a&&c&&!l&&!d||p&&a&&c||!h&&c||!f)return-1}return 0}return Sw=t,Sw}var jw,UE;function gU(){if(UE)return jw;UE=1;var e=mU();function t(n,s,a){for(var l=-1,c=n.criteria,d=s.criteria,h=c.length,p=a.length;++l<h;){var f=e(c[l],d[l]);if(f){if(l>=p)return f;var m=a[l];return f*(m=="desc"?-1:1)}}return n.index-s.index}return jw=t,jw}var Ew,WE;function yU(){if(WE)return Ew;WE=1;var e=Ud(),t=Hd(),n=gs(),s=qA(),a=pU(),l=qd(),c=gU(),d=Ja(),h=$t();function p(f,m,y){m.length?m=e(m,function(_){return h(_)?function(S){return t(S,_.length===1?_[0]:_)}:_}):m=[d];var v=-1;m=e(m,l(n));var N=s(f,function(_,S,k){var j=e(m,function(E){return E(_)});return{criteria:j,index:++v,value:_}});return a(N,function(_,S){return c(_,S,y)})}return Ew=p,Ew}var Cw,HE;function wU(){if(HE)return Cw;HE=1;var e=Yx(),t=yU(),n=Gd(),s=Vd(),a=n(function(l,c){if(l==null)return[];var d=c.length;return d>1&&s(l,c[0],c[1])?c=[]:d>2&&s(c[0],c[1],c[2])&&(c=[c[0]]),t(l,e(c,1),[])});return Cw=a,Cw}var Tw,GE;function vU(){if(GE)return Tw;GE=1;var e=MA(),t=0;function n(s){var a=++t;return e(s)+a}return Tw=n,Tw}var Aw,VE;function xU(){if(VE)return Aw;VE=1;function e(t,n,s){for(var a=-1,l=t.length,c=n.length,d={};++a<l;){var h=a<c?n[a]:void 0;s(d,t[a],h)}return d}return Aw=e,Aw}var Rw,YE;function bU(){if(YE)return Rw;YE=1;var e=Ld(),t=xU();function n(s,a){return t(s||[],a||[],e)}return Rw=n,Rw}var Mw,KE;function kt(){if(KE)return Mw;KE=1;var e;if(typeof Ix=="function")try{e={cloneDeep:Lz(),constant:Ux(),defaults:Dz(),each:SA(),filter:PA(),find:Hz(),flatten:JA(),forEach:NA(),forIn:Gz(),has:LA(),isUndefined:DA(),last:Vz(),map:FA(),mapValues:Yz(),max:Xz(),merge:nU(),min:rU(),minBy:sU(),now:aU(),pick:uU(),range:fU(),reduce:BA(),sortBy:wU(),uniqueId:vU(),values:GA(),zipObject:bU()}}catch{}return e||(e=window._),Mw=e,Mw}var Iw,XE;function kU(){if(XE)return Iw;XE=1,Iw=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,l=a._prev;l!==a;)s.push(JSON.stringify(l,n)),l=l._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 Iw}var $w,QE;function _U(){if(QE)return $w;QE=1;var e=kt(),t=gr().Graph,n=kU();$w=a;var s=e.constant(1);function a(p,f){if(p.nodeCount()<=1)return[];var m=d(p,f||s),y=l(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(v){return p.outEdges(v.v,v.w)}),!0)}function l(p,f,m){for(var y=[],v=f[f.length-1],N=f[0],_;p.nodeCount();){for(;_=N.dequeue();)c(p,f,m,_);for(;_=v.dequeue();)c(p,f,m,_);if(p.nodeCount()){for(var S=f.length-2;S>0;--S)if(_=f[S].dequeue(),_){y=y.concat(c(p,f,m,_,!0));break}}}return y}function c(p,f,m,y,v){var N=v?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var S=p.edge(_),k=p.node(_.v);v&&N.push({v:_.v,w:_.w}),k.out-=S,h(f,m,k)}),e.forEach(p.outEdges(y.v),function(_){var S=p.edge(_),k=_.w,j=p.node(k);j.in-=S,h(f,m,j)}),p.removeNode(y.v),N}function d(p,f){var m=new t,y=0,v=0;e.forEach(p.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),e.forEach(p.edges(),function(S){var k=m.edge(S.v,S.w)||0,j=f(S),E=k+j;m.setEdge(S.v,S.w,E),v=Math.max(v,m.node(S.v).out+=j),y=Math.max(y,m.node(S.w).in+=j)});var N=e.range(v+y+3).map(function(){return new n}),_=y+1;return e.forEach(m.nodes(),function(S){h(N,_,m.node(S))}),{graph:m,buckets:N,zeroIdx:_}}function h(p,f,m){m.out?m.in?p[m.out-m.in+f].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return $w}var Ow,ZE;function NU(){if(ZE)return Ow;ZE=1;var e=kt(),t=_U();Ow={run:n,undo:a};function n(l){var c=l.graph().acyclicer==="greedy"?t(l,d(l)):s(l);e.forEach(c,function(h){var p=l.edge(h);l.removeEdge(h),p.forwardName=h.name,p.reversed=!0,l.setEdge(h.w,h.v,p,e.uniqueId("rev"))});function d(h){return function(p){return h.edge(p).weight}}}function s(l){var c=[],d={},h={};function p(f){e.has(h,f)||(h[f]=!0,d[f]=!0,e.forEach(l.outEdges(f),function(m){e.has(d,m.w)?c.push(m):p(m.w)}),delete d[f])}return e.forEach(l.nodes(),p),c}function a(l){e.forEach(l.edges(),function(c){var d=l.edge(c);if(d.reversed){l.removeEdge(c);var h=d.forwardName;delete d.reversed,delete d.forwardName,l.setEdge(c.w,c.v,d,h)}})}return Ow}var Pw,JE;function kn(){if(JE)return Pw;JE=1;var e=kt(),t=gr().Graph;Pw={addDummyNode:n,simplify:s,asNonCompoundGraph:a,successorWeights:l,predecessorWeights:c,intersectRect:d,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:f,addBorderNode:m,maxRank:y,partition:v,time:N,notime:_};function n(S,k,j,E){var C;do C=e.uniqueId(E);while(S.hasNode(C));return j.dummy=k,S.setNode(C,j),C}function s(S){var k=new t().setGraph(S.graph());return e.forEach(S.nodes(),function(j){k.setNode(j,S.node(j))}),e.forEach(S.edges(),function(j){var E=k.edge(j.v,j.w)||{weight:0,minlen:1},C=S.edge(j);k.setEdge(j.v,j.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),k}function a(S){var k=new t({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(j){S.children(j).length||k.setNode(j,S.node(j))}),e.forEach(S.edges(),function(j){k.setEdge(j,S.edge(j))}),k}function l(S){var k=e.map(S.nodes(),function(j){var E={};return e.forEach(S.outEdges(j),function(C){E[C.w]=(E[C.w]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),k)}function c(S){var k=e.map(S.nodes(),function(j){var E={};return e.forEach(S.inEdges(j),function(C){E[C.v]=(E[C.v]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),k)}function d(S,k){var j=S.x,E=S.y,C=k.x-j,T=k.y-E,R=S.width/2,A=S.height/2;if(!C&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var D,O;return Math.abs(T)*R>Math.abs(C)*A?(T<0&&(A=-A),D=A*C/T,O=A):(C<0&&(R=-R),D=R,O=R*T/C),{x:j+D,y:E+O}}function h(S){var k=e.map(e.range(y(S)+1),function(){return[]});return e.forEach(S.nodes(),function(j){var E=S.node(j),C=E.rank;e.isUndefined(C)||(k[C][E.order]=j)}),k}function p(S){var k=e.min(e.map(S.nodes(),function(j){return S.node(j).rank}));e.forEach(S.nodes(),function(j){var E=S.node(j);e.has(E,"rank")&&(E.rank-=k)})}function f(S){var k=e.min(e.map(S.nodes(),function(T){return S.node(T).rank})),j=[];e.forEach(S.nodes(),function(T){var R=S.node(T).rank-k;j[R]||(j[R]=[]),j[R].push(T)});var E=0,C=S.graph().nodeRankFactor;e.forEach(j,function(T,R){e.isUndefined(T)&&R%C!==0?--E:E&&e.forEach(T,function(A){S.node(A).rank+=E})})}function m(S,k,j,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=j,C.order=E),n(S,"border",C,k)}function y(S){return e.max(e.map(S.nodes(),function(k){var j=S.node(k).rank;if(!e.isUndefined(j))return j}))}function v(S,k){var j={lhs:[],rhs:[]};return e.forEach(S,function(E){k(E)?j.lhs.push(E):j.rhs.push(E)}),j}function N(S,k){var j=e.now();try{return k()}finally{console.log(S+" time: "+(e.now()-j)+"ms")}}function _(S,k){return k()}return Pw}var Lw,eC;function SU(){if(eC)return Lw;eC=1;var e=kt(),t=kn();Lw={run:n,undo:a};function n(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(c){s(l,c)})}function s(l,c){var d=c.v,h=l.node(d).rank,p=c.w,f=l.node(p).rank,m=c.name,y=l.edge(c),v=y.labelRank;if(f!==h+1){l.removeEdge(c);var N,_,S;for(S=0,++h;h<f;++S,++h)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:c,rank:h},N=t.addDummyNode(l,"edge",_,"_d"),h===v&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),l.setEdge(d,N,{weight:y.weight},m),S===0&&l.graph().dummyChains.push(N),d=N;l.setEdge(d,p,{weight:y.weight},m)}}function a(l){e.forEach(l.graph().dummyChains,function(c){var d=l.node(c),h=d.edgeLabel,p;for(l.setEdge(d.edgeObj,h);d.dummy;)p=l.successors(c)[0],l.removeNode(c),h.points.push({x:d.x,y:d.y}),d.dummy==="edge-label"&&(h.x=d.x,h.y=d.y,h.width=d.width,h.height=d.height),c=p,d=l.node(c)})}return Lw}var Dw,tC;function gd(){if(tC)return Dw;tC=1;var e=kt();Dw={longestPath:t,slack:n};function t(s){var a={};function l(c){var d=s.node(c);if(e.has(a,c))return d.rank;a[c]=!0;var h=e.min(e.map(s.outEdges(c),function(p){return l(p.w)-s.edge(p).minlen}));return(h===Number.POSITIVE_INFINITY||h===void 0||h===null)&&(h=0),d.rank=h}e.forEach(s.sources(),l)}function n(s,a){return s.node(a.w).rank-s.node(a.v).rank-s.edge(a).minlen}return Dw}var qw,nC;function rR(){if(nC)return qw;nC=1;var e=kt(),t=gr().Graph,n=gd().slack;qw=s;function s(d){var h=new t({directed:!1}),p=d.nodes()[0],f=d.nodeCount();h.setNode(p,{});for(var m,y;a(h,d)<f;)m=l(h,d),y=h.hasNode(m.v)?n(d,m):-n(d,m),c(h,d,y);return h}function a(d,h){function p(f){e.forEach(h.nodeEdges(f),function(m){var y=m.v,v=f===y?m.w:y;!d.hasNode(v)&&!n(h,m)&&(d.setNode(v,{}),d.setEdge(f,v,{}),p(v))})}return e.forEach(d.nodes(),p),d.nodeCount()}function l(d,h){return e.minBy(h.edges(),function(p){if(d.hasNode(p.v)!==d.hasNode(p.w))return n(h,p)})}function c(d,h,p){e.forEach(d.nodes(),function(f){h.node(f).rank+=p})}return qw}var Fw,rC;function jU(){if(rC)return Fw;rC=1;var e=kt(),t=rR(),n=gd().slack,s=gd().longestPath,a=gr().alg.preorder,l=gr().alg.postorder,c=kn().simplify;Fw=d,d.initLowLimValues=m,d.initCutValues=h,d.calcCutValue=f,d.leaveEdge=v,d.enterEdge=N,d.exchangeEdges=_;function d(E){E=c(E),s(E);var C=t(E);m(C),h(C,E);for(var T,R;T=v(C);)R=N(C,E,T),_(C,E,T,R)}function h(E,C){var T=l(E,E.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(R){p(E,C,R)})}function p(E,C,T){var R=E.node(T),A=R.parent;E.edge(T,A).cutvalue=f(E,C,T)}function f(E,C,T){var R=E.node(T),A=R.parent,D=!0,O=C.edge(T,A),$=0;return O||(D=!1,O=C.edge(A,T)),$=O.weight,e.forEach(C.nodeEdges(T),function(B){var Z=B.v===T,J=Z?B.w:B.v;if(J!==A){var I=Z===D,X=C.edge(B).weight;if($+=I?X:-X,k(E,T,J)){var G=E.edge(T,J).cutvalue;$+=I?-G:G}}}),$}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,T,R,A){var D=T,O=E.node(R);return C[R]=!0,e.forEach(E.neighbors(R),function($){e.has(C,$)||(T=y(E,C,T,$,R))}),O.low=D,O.lim=T++,A?O.parent=A:delete O.parent,T}function v(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function N(E,C,T){var R=T.v,A=T.w;C.hasEdge(R,A)||(R=T.w,A=T.v);var D=E.node(R),O=E.node(A),$=D,B=!1;D.lim>O.lim&&($=O,B=!0);var Z=e.filter(C.edges(),function(J){return B===j(E,E.node(J.v),$)&&B!==j(E,E.node(J.w),$)});return e.minBy(Z,function(J){return n(C,J)})}function _(E,C,T,R){var A=T.v,D=T.w;E.removeEdge(A,D),E.setEdge(R.v,R.w,{}),m(E),h(E,C),S(E,C)}function S(E,C){var T=e.find(E.nodes(),function(A){return!C.node(A).parent}),R=a(E,T);R=R.slice(1),e.forEach(R,function(A){var D=E.node(A).parent,O=C.edge(A,D),$=!1;O||(O=C.edge(D,A),$=!0),C.node(A).rank=C.node(D).rank+($?O.minlen:-O.minlen)})}function k(E,C,T){return E.hasEdge(C,T)}function j(E,C,T){return T.low<=C.lim&&C.lim<=T.lim}return Fw}var Bw,sC;function EU(){if(sC)return Bw;sC=1;var e=gd(),t=e.longestPath,n=rR(),s=jU();Bw=a;function a(h){switch(h.graph().ranker){case"network-simplex":d(h);break;case"tight-tree":c(h);break;case"longest-path":l(h);break;default:d(h)}}var l=t;function c(h){t(h),n(h)}function d(h){s(h)}return Bw}var zw,aC;function CU(){if(aC)return zw;aC=1;var e=kt();zw=t;function t(a){var l=s(a);e.forEach(a.graph().dummyChains,function(c){for(var d=a.node(c),h=d.edgeObj,p=n(a,l,h.v,h.w),f=p.path,m=p.lca,y=0,v=f[y],N=!0;c!==h.w;){if(d=a.node(c),N){for(;(v=f[y])!==m&&a.node(v).maxRank<d.rank;)y++;v===m&&(N=!1)}if(!N){for(;y<f.length-1&&a.node(v=f[y+1]).minRank<=d.rank;)y++;v=f[y]}a.setParent(c,v),c=a.successors(c)[0]}})}function n(a,l,c,d){var h=[],p=[],f=Math.min(l[c].low,l[d].low),m=Math.max(l[c].lim,l[d].lim),y,v;y=c;do y=a.parent(y),h.push(y);while(y&&(l[y].low>f||m>l[y].lim));for(v=y,y=d;(y=a.parent(y))!==v;)p.push(y);return{path:h.concat(p.reverse()),lca:v}}function s(a){var l={},c=0;function d(h){var p=c;e.forEach(a.children(h),d),l[h]={low:p,lim:c++}}return e.forEach(a.children(),d),l}return zw}var Uw,oC;function TU(){if(oC)return Uw;oC=1;var e=kt(),t=kn();Uw={run:n,cleanup:c};function n(d){var h=t.addDummyNode(d,"root",{},"_root"),p=a(d),f=e.max(e.values(p))-1,m=2*f+1;d.graph().nestingRoot=h,e.forEach(d.edges(),function(v){d.edge(v).minlen*=m});var y=l(d)+1;e.forEach(d.children(),function(v){s(d,h,m,y,f,p,v)}),d.graph().nodeRankFactor=m}function s(d,h,p,f,m,y,v){var N=d.children(v);if(!N.length){v!==h&&d.setEdge(h,v,{weight:0,minlen:p});return}var _=t.addBorderNode(d,"_bt"),S=t.addBorderNode(d,"_bb"),k=d.node(v);d.setParent(_,v),k.borderTop=_,d.setParent(S,v),k.borderBottom=S,e.forEach(N,function(j){s(d,h,p,f,m,y,j);var E=d.node(j),C=E.borderTop?E.borderTop:j,T=E.borderBottom?E.borderBottom:j,R=E.borderTop?f:2*f,A=C!==T?1:m-y[v]+1;d.setEdge(_,C,{weight:R,minlen:A,nestingEdge:!0}),d.setEdge(T,S,{weight:R,minlen:A,nestingEdge:!0})}),d.parent(v)||d.setEdge(h,_,{weight:0,minlen:m+y[v]})}function a(d){var h={};function p(f,m){var y=d.children(f);y&&y.length&&e.forEach(y,function(v){p(v,m+1)}),h[f]=m}return e.forEach(d.children(),function(f){p(f,1)}),h}function l(d){return e.reduce(d.edges(),function(h,p){return h+d.edge(p).weight},0)}function c(d){var h=d.graph();d.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(d.edges(),function(p){var f=d.edge(p);f.nestingEdge&&d.removeEdge(p)})}return Uw}var Ww,iC;function AU(){if(iC)return Ww;iC=1;var e=kt(),t=kn();Ww=n;function n(a){function l(c){var d=a.children(c),h=a.node(c);if(d.length&&e.forEach(d,l),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,f=h.maxRank+1;p<f;++p)s(a,"borderLeft","_bl",c,h,p),s(a,"borderRight","_br",c,h,p)}}e.forEach(a.children(),l)}function s(a,l,c,d,h,p){var f={width:0,height:0,rank:p,borderType:l},m=h[l][p-1],y=t.addDummyNode(a,"border",f,c);h[l][p]=y,a.setParent(y,d),m&&a.setEdge(m,y,{weight:1})}return Ww}var Hw,lC;function RU(){if(lC)return Hw;lC=1;var e=kt();Hw={adjust:t,undo:n};function t(p){var f=p.graph().rankdir.toLowerCase();(f==="lr"||f==="rl")&&s(p)}function n(p){var f=p.graph().rankdir.toLowerCase();(f==="bt"||f==="rl")&&l(p),(f==="lr"||f==="rl")&&(d(p),s(p))}function s(p){e.forEach(p.nodes(),function(f){a(p.node(f))}),e.forEach(p.edges(),function(f){a(p.edge(f))})}function a(p){var f=p.width;p.width=p.height,p.height=f}function l(p){e.forEach(p.nodes(),function(f){c(p.node(f))}),e.forEach(p.edges(),function(f){var m=p.edge(f);e.forEach(m.points,c),e.has(m,"y")&&c(m)})}function c(p){p.y=-p.y}function d(p){e.forEach(p.nodes(),function(f){h(p.node(f))}),e.forEach(p.edges(),function(f){var m=p.edge(f);e.forEach(m.points,h),e.has(m,"x")&&h(m)})}function h(p){var f=p.x;p.x=p.y,p.y=f}return Hw}var Gw,cC;function MU(){if(cC)return Gw;cC=1;var e=kt();Gw=t;function t(n){var s={},a=e.filter(n.nodes(),function(p){return!n.children(p).length}),l=e.max(e.map(a,function(p){return n.node(p).rank})),c=e.map(e.range(l+1),function(){return[]});function d(p){if(!e.has(s,p)){s[p]=!0;var f=n.node(p);c[f.rank].push(p),e.forEach(n.successors(p),d)}}var h=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(h,d),c}return Gw}var Vw,uC;function IU(){if(uC)return Vw;uC=1;var e=kt();Vw=t;function t(s,a){for(var l=0,c=1;c<a.length;++c)l+=n(s,a[c-1],a[c]);return l}function n(s,a,l){for(var c=e.zipObject(l,e.map(l,function(y,v){return v})),d=e.flatten(e.map(a,function(y){return e.sortBy(e.map(s.outEdges(y),function(v){return{pos:c[v.w],weight:s.edge(v).weight}}),"pos")}),!0),h=1;h<l.length;)h<<=1;var p=2*h-1;h-=1;var f=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(d.forEach(function(y){var v=y.pos+h;f[v]+=y.weight;for(var N=0;v>0;)v%2&&(N+=f[v+1]),v=v-1>>1,f[v]+=y.weight;m+=y.weight*N})),m}return Vw}var Yw,dC;function $U(){if(dC)return Yw;dC=1;var e=kt();Yw=t;function t(n,s){return e.map(s,function(a){var l=n.inEdges(a);if(l.length){var c=e.reduce(l,function(d,h){var p=n.edge(h),f=n.node(h.v);return{sum:d.sum+p.weight*f.order,weight:d.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:a}})}return Yw}var Kw,hC;function OU(){if(hC)return Kw;hC=1;var e=kt();Kw=t;function t(a,l){var c={};e.forEach(a,function(h,p){var f=c[h.v]={indegree:0,in:[],out:[],vs:[h.v],i:p};e.isUndefined(h.barycenter)||(f.barycenter=h.barycenter,f.weight=h.weight)}),e.forEach(l.edges(),function(h){var p=c[h.v],f=c[h.w];!e.isUndefined(p)&&!e.isUndefined(f)&&(f.indegree++,p.out.push(c[h.w]))});var d=e.filter(c,function(h){return!h.indegree});return n(d)}function n(a){var l=[];function c(p){return function(f){f.merged||(e.isUndefined(f.barycenter)||e.isUndefined(p.barycenter)||f.barycenter>=p.barycenter)&&s(p,f)}}function d(p){return function(f){f.in.push(p),--f.indegree===0&&a.push(f)}}for(;a.length;){var h=a.pop();l.push(h),e.forEach(h.in.reverse(),c(h)),e.forEach(h.out,d(h))}return e.map(e.filter(l,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(a,l){var c=0,d=0;a.weight&&(c+=a.barycenter*a.weight,d+=a.weight),l.weight&&(c+=l.barycenter*l.weight,d+=l.weight),a.vs=l.vs.concat(a.vs),a.barycenter=c/d,a.weight=d,a.i=Math.min(l.i,a.i),l.merged=!0}return Kw}var Xw,fC;function PU(){if(fC)return Xw;fC=1;var e=kt(),t=kn();Xw=n;function n(l,c){var d=t.partition(l,function(_){return e.has(_,"barycenter")}),h=d.lhs,p=e.sortBy(d.rhs,function(_){return-_.i}),f=[],m=0,y=0,v=0;h.sort(a(!!c)),v=s(f,p,v),e.forEach(h,function(_){v+=_.vs.length,f.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,v=s(f,p,v)});var N={vs:e.flatten(f,!0)};return y&&(N.barycenter=m/y,N.weight=y),N}function s(l,c,d){for(var h;c.length&&(h=e.last(c)).i<=d;)c.pop(),l.push(h.vs),d++;return d}function a(l){return function(c,d){return c.barycenter<d.barycenter?-1:c.barycenter>d.barycenter?1:l?d.i-c.i:c.i-d.i}}return Xw}var Qw,pC;function LU(){if(pC)return Qw;pC=1;var e=kt(),t=$U(),n=OU(),s=PU();Qw=a;function a(d,h,p,f){var m=d.children(h),y=d.node(h),v=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,_={};v&&(m=e.filter(m,function(T){return T!==v&&T!==N}));var S=t(d,m);e.forEach(S,function(T){if(d.children(T.v).length){var R=a(d,T.v,p,f);_[T.v]=R,e.has(R,"barycenter")&&c(T,R)}});var k=n(S,p);l(k,_);var j=s(k,f);if(v&&(j.vs=e.flatten([v,j.vs,N],!0),d.predecessors(v).length)){var E=d.node(d.predecessors(v)[0]),C=d.node(d.predecessors(N)[0]);e.has(j,"barycenter")||(j.barycenter=0,j.weight=0),j.barycenter=(j.barycenter*j.weight+E.order+C.order)/(j.weight+2),j.weight+=2}return j}function l(d,h){e.forEach(d,function(p){p.vs=e.flatten(p.vs.map(function(f){return h[f]?h[f].vs:f}),!0)})}function c(d,h){e.isUndefined(d.barycenter)?(d.barycenter=h.barycenter,d.weight=h.weight):(d.barycenter=(d.barycenter*d.weight+h.barycenter*h.weight)/(d.weight+h.weight),d.weight+=h.weight)}return Qw}var Zw,mC;function DU(){if(mC)return Zw;mC=1;var e=kt(),t=gr().Graph;Zw=n;function n(a,l,c){var d=s(a),h=new t({compound:!0}).setGraph({root:d}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var f=a.node(p),m=a.parent(p);(f.rank===l||f.minRank<=l&&l<=f.maxRank)&&(h.setNode(p),h.setParent(p,m||d),e.forEach(a[c](p),function(y){var v=y.v===p?y.w:y.v,N=h.edge(v,p),_=e.isUndefined(N)?0:N.weight;h.setEdge(v,p,{weight:a.edge(y).weight+_})}),e.has(f,"minRank")&&h.setNode(p,{borderLeft:f.borderLeft[l],borderRight:f.borderRight[l]}))}),h}function s(a){for(var l;a.hasNode(l=e.uniqueId("_root")););return l}return Zw}var Jw,gC;function qU(){if(gC)return Jw;gC=1;var e=kt();Jw=t;function t(n,s,a){var l={},c;e.forEach(a,function(d){for(var h=n.parent(d),p,f;h;){if(p=n.parent(h),p?(f=l[p],l[p]=h):(f=c,c=h),f&&f!==h){s.setEdge(f,h);return}h=p}})}return Jw}var ev,yC;function FU(){if(yC)return ev;yC=1;var e=kt(),t=MU(),n=IU(),s=LU(),a=DU(),l=qU(),c=gr().Graph,d=kn();ev=h;function h(y){var v=d.maxRank(y),N=p(y,e.range(1,v+1),"inEdges"),_=p(y,e.range(v-1,-1,-1),"outEdges"),S=t(y);m(y,S);for(var k=Number.POSITIVE_INFINITY,j,E=0,C=0;C<4;++E,++C){f(E%2?N:_,E%4>=2),S=d.buildLayerMatrix(y);var T=n(y,S);T<k&&(C=0,j=e.cloneDeep(S),k=T)}m(y,j)}function p(y,v,N){return e.map(v,function(_){return a(y,_,N)})}function f(y,v){var N=new c;e.forEach(y,function(_){var S=_.graph().root,k=s(_,S,N,v);e.forEach(k.vs,function(j,E){_.node(j).order=E}),l(_,N,k.vs)})}function m(y,v){e.forEach(v,function(N){e.forEach(N,function(_,S){y.node(_).order=S})})}return ev}var tv,wC;function BU(){if(wC)return tv;wC=1;var e=kt(),t=gr().Graph,n=kn();tv={positionX:N,findType1Conflicts:s,findType2Conflicts:a,addConflict:c,hasConflict:d,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:v};function s(k,j){var E={};function C(T,R){var A=0,D=0,O=T.length,$=e.last(R);return e.forEach(R,function(B,Z){var J=l(k,B),I=J?k.node(J).order:O;(J||B===$)&&(e.forEach(R.slice(D,Z+1),function(X){e.forEach(k.predecessors(X),function(G){var q=k.node(G),Y=q.order;(Y<A||I<Y)&&!(q.dummy&&k.node(X).dummy)&&c(E,G,X)})}),D=Z+1,A=I)}),R}return e.reduce(j,C),E}function a(k,j){var E={};function C(R,A,D,O,$){var B;e.forEach(e.range(A,D),function(Z){B=R[Z],k.node(B).dummy&&e.forEach(k.predecessors(B),function(J){var I=k.node(J);I.dummy&&(I.order<O||I.order>$)&&c(E,J,B)})})}function T(R,A){var D=-1,O,$=0;return e.forEach(A,function(B,Z){if(k.node(B).dummy==="border"){var J=k.predecessors(B);J.length&&(O=k.node(J[0]).order,C(A,$,Z,D,O),$=Z,D=O)}C(A,$,A.length,O,R.length)}),A}return e.reduce(j,T),E}function l(k,j){if(k.node(j).dummy)return e.find(k.predecessors(j),function(E){return k.node(E).dummy})}function c(k,j,E){if(j>E){var C=j;j=E,E=C}var T=k[j];T||(k[j]=T={}),T[E]=!0}function d(k,j,E){if(j>E){var C=j;j=E,E=C}return e.has(k[j],E)}function h(k,j,E,C){var T={},R={},A={};return e.forEach(j,function(D){e.forEach(D,function(O,$){T[O]=O,R[O]=O,A[O]=$})}),e.forEach(j,function(D){var O=-1;e.forEach(D,function($){var B=C($);if(B.length){B=e.sortBy(B,function(G){return A[G]});for(var Z=(B.length-1)/2,J=Math.floor(Z),I=Math.ceil(Z);J<=I;++J){var X=B[J];R[$]===$&&O<A[X]&&!d(E,$,X)&&(R[X]=$,R[$]=T[$]=T[X],O=A[X])}}})}),{root:T,align:R}}function p(k,j,E,C,T){var R={},A=f(k,j,E,T),D=T?"borderLeft":"borderRight";function O(Z,J){for(var I=A.nodes(),X=I.pop(),G={};X;)G[X]?Z(X):(G[X]=!0,I.push(X),I=I.concat(J(X))),X=I.pop()}function $(Z){R[Z]=A.inEdges(Z).reduce(function(J,I){return Math.max(J,R[I.v]+A.edge(I))},0)}function B(Z){var J=A.outEdges(Z).reduce(function(X,G){return Math.min(X,R[G.w]-A.edge(G))},Number.POSITIVE_INFINITY),I=k.node(Z);J!==Number.POSITIVE_INFINITY&&I.borderType!==D&&(R[Z]=Math.max(R[Z],J))}return O($,A.predecessors.bind(A)),O(B,A.successors.bind(A)),e.forEach(C,function(Z){R[Z]=R[E[Z]]}),R}function f(k,j,E,C){var T=new t,R=k.graph(),A=_(R.nodesep,R.edgesep,C);return e.forEach(j,function(D){var O;e.forEach(D,function($){var B=E[$];if(T.setNode(B),O){var Z=E[O],J=T.edge(Z,B);T.setEdge(Z,B,Math.max(A(k,$,O),J||0))}O=$})}),T}function m(k,j){return e.minBy(e.values(j),function(E){var C=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(E,function(R,A){var D=S(k,A)/2;C=Math.max(R+D,C),T=Math.min(R-D,T)}),C-T})}function y(k,j){var E=e.values(j),C=e.min(E),T=e.max(E);e.forEach(["u","d"],function(R){e.forEach(["l","r"],function(A){var D=R+A,O=k[D],$;if(O!==j){var B=e.values(O);$=A==="l"?C-e.min(B):T-e.max(B),$&&(k[D]=e.mapValues(O,function(Z){return Z+$}))}})})}function v(k,j){return e.mapValues(k.ul,function(E,C){if(j)return k[j.toLowerCase()][C];var T=e.sortBy(e.map(k,C));return(T[1]+T[2])/2})}function N(k){var j=n.buildLayerMatrix(k),E=e.merge(s(k,j),a(k,j)),C={},T;e.forEach(["u","d"],function(A){T=A==="u"?j:e.values(j).reverse(),e.forEach(["l","r"],function(D){D==="r"&&(T=e.map(T,function(Z){return e.values(Z).reverse()}));var O=(A==="u"?k.predecessors:k.successors).bind(k),$=h(k,T,E,O),B=p(k,T,$.root,$.align,D==="r");D==="r"&&(B=e.mapValues(B,function(Z){return-Z})),C[A+D]=B})});var R=m(k,C);return y(C,R),v(C,k.graph().align)}function _(k,j,E){return function(C,T,R){var A=C.node(T),D=C.node(R),O=0,$;if(O+=A.width/2,e.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":$=-A.width/2;break;case"r":$=A.width/2;break}if($&&(O+=E?$:-$),$=0,O+=(A.dummy?j:k)/2,O+=(D.dummy?j:k)/2,O+=D.width/2,e.has(D,"labelpos"))switch(D.labelpos.toLowerCase()){case"l":$=D.width/2;break;case"r":$=-D.width/2;break}return $&&(O+=E?$:-$),$=0,O}}function S(k,j){return k.node(j).width}return tv}var nv,vC;function zU(){if(vC)return nv;vC=1;var e=kt(),t=kn(),n=BU().positionX;nv=s;function s(l){l=t.asNonCompoundGraph(l),a(l),e.forEach(n(l),function(c,d){l.node(d).x=c})}function a(l){var c=t.buildLayerMatrix(l),d=l.graph().ranksep,h=0;e.forEach(c,function(p){var f=e.max(e.map(p,function(m){return l.node(m).height}));e.forEach(p,function(m){l.node(m).y=h+f/2}),h+=f+d})}return nv}var rv,xC;function UU(){if(xC)return rv;xC=1;var e=kt(),t=NU(),n=SU(),s=EU(),a=kn().normalizeRanks,l=CU(),c=kn().removeEmptyRanks,d=TU(),h=AU(),p=RU(),f=FU(),m=zU(),y=kn(),v=gr().Graph;rv=N;function N(z,W){var ee=W&&W.debugTiming?y.time:y.notime;ee("layout",function(){var H=ee(" buildLayoutGraph",function(){return O(z)});ee(" runLayout",function(){_(H,ee)}),ee(" updateInputGraph",function(){S(z,H)})})}function _(z,W){W(" makeSpaceForEdgeLabels",function(){$(z)}),W(" removeSelfEdges",function(){L(z)}),W(" acyclic",function(){t.run(z)}),W(" nestingGraph.run",function(){d.run(z)}),W(" rank",function(){s(y.asNonCompoundGraph(z))}),W(" injectEdgeLabelProxies",function(){B(z)}),W(" removeEmptyRanks",function(){c(z)}),W(" nestingGraph.cleanup",function(){d.cleanup(z)}),W(" normalizeRanks",function(){a(z)}),W(" assignRankMinMax",function(){Z(z)}),W(" removeEdgeLabelProxies",function(){J(z)}),W(" normalize.run",function(){n.run(z)}),W(" parentDummyChains",function(){l(z)}),W(" addBorderSegments",function(){h(z)}),W(" order",function(){f(z)}),W(" insertSelfEdges",function(){K(z)}),W(" adjustCoordinateSystem",function(){p.adjust(z)}),W(" position",function(){m(z)}),W(" positionSelfEdges",function(){P(z)}),W(" removeBorderNodes",function(){Y(z)}),W(" normalize.undo",function(){n.undo(z)}),W(" fixupEdgeLabelCoords",function(){G(z)}),W(" undoCoordinateSystem",function(){p.undo(z)}),W(" translateGraph",function(){I(z)}),W(" assignNodeIntersects",function(){X(z)}),W(" reversePoints",function(){q(z)}),W(" acyclic.undo",function(){t.undo(z)})}function S(z,W){e.forEach(z.nodes(),function(ee){var H=z.node(ee),ae=W.node(ee);H&&(H.x=ae.x,H.y=ae.y,W.children(ee).length&&(H.width=ae.width,H.height=ae.height))}),e.forEach(z.edges(),function(ee){var H=z.edge(ee),ae=W.edge(ee);H.points=ae.points,e.has(ae,"x")&&(H.x=ae.x,H.y=ae.y)}),z.graph().width=W.graph().width,z.graph().height=W.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],j={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],T={width:0,height:0},R=["minlen","weight","width","height","labeloffset"],A={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},D=["labelpos"];function O(z){var W=new v({multigraph:!0,compound:!0}),ee=he(z.graph());return W.setGraph(e.merge({},j,V(ee,k),e.pick(ee,E))),e.forEach(z.nodes(),function(H){var ae=he(z.node(H));W.setNode(H,e.defaults(V(ae,C),T)),W.setParent(H,z.parent(H))}),e.forEach(z.edges(),function(H){var ae=he(z.edge(H));W.setEdge(H,e.merge({},A,V(ae,R),e.pick(ae,D)))}),W}function $(z){var W=z.graph();W.ranksep/=2,e.forEach(z.edges(),function(ee){var H=z.edge(ee);H.minlen*=2,H.labelpos.toLowerCase()!=="c"&&(W.rankdir==="TB"||W.rankdir==="BT"?H.width+=H.labeloffset:H.height+=H.labeloffset)})}function B(z){e.forEach(z.edges(),function(W){var ee=z.edge(W);if(ee.width&&ee.height){var H=z.node(W.v),ae=z.node(W.w),me={rank:(ae.rank-H.rank)/2+H.rank,e:W};y.addDummyNode(z,"edge-proxy",me,"_ep")}})}function Z(z){var W=0;e.forEach(z.nodes(),function(ee){var H=z.node(ee);H.borderTop&&(H.minRank=z.node(H.borderTop).rank,H.maxRank=z.node(H.borderBottom).rank,W=e.max(W,H.maxRank))}),z.graph().maxRank=W}function J(z){e.forEach(z.nodes(),function(W){var ee=z.node(W);ee.dummy==="edge-proxy"&&(z.edge(ee.e).labelRank=ee.rank,z.removeNode(W))})}function I(z){var W=Number.POSITIVE_INFINITY,ee=0,H=Number.POSITIVE_INFINITY,ae=0,me=z.graph(),ge=me.marginx||0,Re=me.marginy||0;function $e(ce){var we=ce.x,xe=ce.y,De=ce.width,_e=ce.height;W=Math.min(W,we-De/2),ee=Math.max(ee,we+De/2),H=Math.min(H,xe-_e/2),ae=Math.max(ae,xe+_e/2)}e.forEach(z.nodes(),function(ce){$e(z.node(ce))}),e.forEach(z.edges(),function(ce){var we=z.edge(ce);e.has(we,"x")&&$e(we)}),W-=ge,H-=Re,e.forEach(z.nodes(),function(ce){var we=z.node(ce);we.x-=W,we.y-=H}),e.forEach(z.edges(),function(ce){var we=z.edge(ce);e.forEach(we.points,function(xe){xe.x-=W,xe.y-=H}),e.has(we,"x")&&(we.x-=W),e.has(we,"y")&&(we.y-=H)}),me.width=ee-W+ge,me.height=ae-H+Re}function X(z){e.forEach(z.edges(),function(W){var ee=z.edge(W),H=z.node(W.v),ae=z.node(W.w),me,ge;ee.points?(me=ee.points[0],ge=ee.points[ee.points.length-1]):(ee.points=[],me=ae,ge=H),ee.points.unshift(y.intersectRect(H,me)),ee.points.push(y.intersectRect(ae,ge))})}function G(z){e.forEach(z.edges(),function(W){var ee=z.edge(W);if(e.has(ee,"x"))switch((ee.labelpos==="l"||ee.labelpos==="r")&&(ee.width-=ee.labeloffset),ee.labelpos){case"l":ee.x-=ee.width/2+ee.labeloffset;break;case"r":ee.x+=ee.width/2+ee.labeloffset;break}})}function q(z){e.forEach(z.edges(),function(W){var ee=z.edge(W);ee.reversed&&ee.points.reverse()})}function Y(z){e.forEach(z.nodes(),function(W){if(z.children(W).length){var ee=z.node(W),H=z.node(ee.borderTop),ae=z.node(ee.borderBottom),me=z.node(e.last(ee.borderLeft)),ge=z.node(e.last(ee.borderRight));ee.width=Math.abs(ge.x-me.x),ee.height=Math.abs(ae.y-H.y),ee.x=me.x+ee.width/2,ee.y=H.y+ee.height/2}}),e.forEach(z.nodes(),function(W){z.node(W).dummy==="border"&&z.removeNode(W)})}function L(z){e.forEach(z.edges(),function(W){if(W.v===W.w){var ee=z.node(W.v);ee.selfEdges||(ee.selfEdges=[]),ee.selfEdges.push({e:W,label:z.edge(W)}),z.removeEdge(W)}})}function K(z){var W=y.buildLayerMatrix(z);e.forEach(W,function(ee){var H=0;e.forEach(ee,function(ae,me){var ge=z.node(ae);ge.order=me+H,e.forEach(ge.selfEdges,function(Re){y.addDummyNode(z,"selfedge",{width:Re.label.width,height:Re.label.height,rank:ge.rank,order:me+ ++H,e:Re.e,label:Re.label},"_se")}),delete ge.selfEdges})})}function P(z){e.forEach(z.nodes(),function(W){var ee=z.node(W);if(ee.dummy==="selfedge"){var H=z.node(ee.e.v),ae=H.x+H.width/2,me=H.y,ge=ee.x-ae,Re=H.height/2;z.setEdge(ee.e,ee.label),z.removeNode(W),ee.label.points=[{x:ae+2*ge/3,y:me-Re},{x:ae+5*ge/6,y:me-Re},{x:ae+ge,y:me},{x:ae+5*ge/6,y:me+Re},{x:ae+2*ge/3,y:me+Re}],ee.label.x=ee.x,ee.label.y=ee.y}})}function V(z,W){return e.mapValues(e.pick(z,W),Number)}function he(z){var W={};return e.forEach(z,function(ee,H){W[H.toLowerCase()]=ee}),W}return rv}var sv,bC;function WU(){if(bC)return sv;bC=1;var e=kt(),t=kn(),n=gr().Graph;sv={debugOrdering:s};function s(a){var l=t.buildLayerMatrix(a),c=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(d){c.setNode(d,{label:d}),c.setParent(d,"layer"+a.node(d).rank)}),e.forEach(a.edges(),function(d){c.setEdge(d.v,d.w,{},d.name)}),e.forEach(l,function(d,h){var p="layer"+h;c.setNode(p,{rank:"same"}),e.reduce(d,function(f,m){return c.setEdge(f,m,{style:"invis"}),m})}),c}return sv}var av,kC;function HU(){return kC||(kC=1,av="0.8.5"),av}var ov,_C;function GU(){return _C||(_C=1,ov={graphlib:gr(),layout:UU(),debug:WU(),util:{time:kn().time,notime:kn().notime},version:HU()}),ov}var VU=GU();const NC=Qv(VU),Ya=240,Wl=130,oi=74,Yd=72,Sl=oi+Yd;function sR(e,t){var s;let n=Ya;for(const a of e)n=Math.max(n,((s=t.get(a.id))==null?void 0:s.width)??Ya);return n}const yd=420,aR=1;function YU(e,t,n,s){return Math.min(aR,n/Math.max(1,e),s/Math.max(1,t))}function Ka(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function KU(e,t){return((t==null?void 0:t.get(e))??0)>0?yd:0}function XU(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Hl(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??Ya)+KU(e,n),h:Math.max((s==null?void 0:s.height)??Wl,XU(e,n))}}function QU(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function ZU(e,t,n,s,a,l){const c=new NC.graphlib.Graph;c.setDefaultEdgeLabel(()=>({})),c.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const d=e.filter(k=>!a.has(k)),h=new Set(d);for(const k of d){const{w:j,h:E}=Hl(k,s,l);c.setNode(k,{width:j,height:E})}for(const k of t)h.has(k.source)&&h.has(k.target)&&c.setEdge(k.source,k.target);NC.layout(c);const p=new Map;let f=1/0,m=1/0,y=-1/0,v=-1/0;for(const k of d){const j=c.node(k);if(!j)continue;const E=s.get(k),C=(E==null?void 0:E.width)??Ya,T=(E==null?void 0:E.height)??Wl,R=Hl(k,s,l),A=j.x-R.w/2,D=j.y-R.h/2;p.set(k,{x:A,y:D}),A<f&&(f=A),D<m&&(m=D),A+C>y&&(y=A+C),D+T>v&&(v=D+T)}if(Number.isFinite(f)&&Number.isFinite(m))for(const[k,j]of p)p.set(k,{x:j.x-f,y:j.y-m});const N=Number.isFinite(y)?y-f:0,_=Number.isFinite(v)?v-m:0;let S=null;for(const k of e){const j=a.get(k);if(!j)continue;const E=s.get(k),C=(E==null?void 0:E.width)??Ya,T=(E==null?void 0:E.height)??Wl;S=S===null?{minX:j.x,minY:j.y,maxX:j.x+C,maxY:j.y+T}:{minX:Math.min(S.minX,j.x),minY:Math.min(S.minY,j.y),maxX:Math.max(S.maxX,j.x+C),maxY:Math.max(S.maxY,j.y+T)}}return{positions:p,width:N,height:_,pinnedBox:S}}function JU(e,t,n={}){const s=n.direction??"LR",a=n.pinned??new Map,l=n.measured??new Map,c=n.lanes,d=new Map;for(const T of e){const R=Ka(T),A=d.get(R);A?A.push(T.id):d.set(R,[T.id])}const p=Array.from(d.keys()).sort().map(T=>({sid:T,...ZU(d.get(T),t,s,l,a,c)})),f=sR(e,l),m=T=>T.reduce((R,A)=>Math.max(R,A.width),0)+yd,y=T=>T.reduce((R,A)=>R+A.height,0)+Sl*Math.max(0,T.length-1),v=T=>{const R=[[]];let A=0;for(const D of p)A>0&&A+D.height>T&&(R.push([]),A=0),R[R.length-1].push(D),A+=D.height+Sl;return R},N=[];for(let T=0;T<p.length;T++){let R=-Sl;for(let A=T;A<p.length;A++)N.push(R+=p[A].height+Sl)}N.sort((T,R)=>T-R);const _=T=>{let R=0,A=N.length-1;for(;R<A;){const D=R+A>>1;v(N[D]).length<=T?A=D:R=D+1}return v(N[R])};let S=[p];const k=n.availableWidth??0,j=n.availableHeight??0;if(k>0&&j>0){const T=A=>YU(A.reduce((D,O)=>D+m(O),0)+f*(A.length-1),Math.max(...A.map(y)),k,j);let R=T(S);for(let A=2;A<=p.length;A++){const D=_(A),O=T(D);O>R+1e-9&&(R=O,S=D)}}const E=new Map;let C=0;for(const T of S){const R=m(T);let A=0;for(const{positions:D,height:O,pinnedBox:$}of T){for(const[Z,J]of D)E.set(Z,{x:J.x+C,y:J.y+A});let B=A+O;$&&$.maxY>B&&$.minX<C+R&&C<$.maxX&&(B=$.maxY),A=B+Sl}C+=R+f}return e.map(T=>{const R=a.get(T.id);if(R)return{...T,position:R};const A=E.get(T.id);return A?{...T,position:A}:T})}function eW(e,t,n,s,a){const c=oi+Yd,d=60,h=v=>Hl(v,s,a),p=new Map(e.map(v=>[v.id,Ka(v)])),f=[],m=e.map(v=>({id:v.id,pos:n.get(v.id)??t.get(v.id)})).filter(v=>v.pos!=null).sort((v,N)=>v.pos.y-N.pos.y||v.pos.x-N.pos.x||v.id.localeCompare(N.id)),y=[];for(const{id:v,pos:N}of m){const{w:_,h:S}=h(v),k=p.get(v)??"_default";if(n.has(v)){f.push({x:N.x,y:N.y,w:_,h:S,sid:k});continue}let j=N.y;for(let E=0;E<f.length+1;E++){const C=f.find(T=>{const R=T.sid===k?24:d,A=T.sid===k?24:c;return N.x<T.x+T.w+R&&T.x<N.x+_+R&&j<T.y+T.h+A&&T.y<j+S+A});if(!C)break;j=C.y+C.h+(C.sid===k?24:c)}j!==N.y&&(t.set(v,{x:N.x,y:j}),y.push(v)),f.push({x:N.x,y:j,w:_,h:S,sid:k})}return y}function tW(e,t,n,s,a,l,c){const d=E=>Hl(E,s,l),h=E=>n.get(E)??t.get(E),p=E=>{const C=s.get(E);return{cw:(C==null?void 0:C.width)??Ya,ch:(C==null?void 0:C.height)??Wl}},f=c!=null&&c.width>0&&c.height>0,m=new Map;for(const E of e){if(!h(E.id))continue;const C=Ka(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 v=new Map,N=[];for(const E of e){const C=h(E.id);if(!C)continue;const{w:T,h:R}=d(E.id),A=Ka(E);y.has(A)?(v.get(A)??v.set(A,[]).get(A)).push(E):N.push({x:C.x,y:C.y,w:T,h:R,...p(E.id)})}if(v.size===0||f&&N.length===0)return[];const _=oi+Yd,S=(E,C,T,R)=>N.some(A=>E<A.x+A.w+oi&&A.x<E+T+oi&&C<A.y+A.h+_&&A.y<C+R+_),k=sR(e,s),j=[];for(const E of[...v.keys()].sort()){const C=v.get(E);let T=1/0,R=1/0,A=-1/0,D=-1/0,O=-1/0,$=-1/0;for(const q of C){const Y=h(q.id),{w:L,h:K}=d(q.id),{cw:P,ch:V}=p(q.id);T=Math.min(T,Y.x),R=Math.min(R,Y.y),A=Math.max(A,Y.x+L),D=Math.max(D,Y.y+K),O=Math.max(O,Y.x+P),$=Math.max($,Y.y+V)}const B=A-T,Z=D-R,J=[...new Set(N.map(q=>Math.round(q.x)))].sort((q,Y)=>q-Y),I=J.length?J:[T],X=[0,...N.map(q=>q.y+q.h+_)].sort((q,Y)=>q-Y);let G=null;if(f){let q=1/0,Y=1/0,L=-1/0,K=-1/0;for(const ee of N)q=Math.min(q,ee.x),Y=Math.min(Y,ee.y),L=Math.max(L,ee.x+ee.cw),K=Math.max(K,ee.y+ee.ch);const P=(ee,H)=>{const ae=c.width/(Math.max(L,ee+O-T)-Math.min(q,ee)+yd),me=c.height/(Math.max(K,H+$-R)-Math.min(Y,H));return[Math.min(aR,ae,me),Math.min(ae,me),Math.max(ae,me)]},V=(ee,H)=>{for(let ae=0;ae<ee.length;ae++){if(ee[ae]>H[ae]+1e-9)return!0;if(ee[ae]<H[ae]-1e-9)return!1}return!1},he=Math.round(L+yd+k),z=[...new Set([...X,Y])].sort((ee,H)=>ee-H);let W=null;for(const ee of[...I,he])for(const H of z){if(S(ee,H,B,Z))continue;const ae=P(ee,H);(W===null||V(ae,W))&&(W=ae,G={x:ee,y:H})}G&&G.x===T&&G.y===R&&(G=null)}else e:for(const q of I)for(const Y of X){if(Y>=R)break;if(!S(q,Y,B,Z)){G={x:q,y:Y};break e}}if(G){const q=G.x-T,Y=G.y-R;for(const L of C){const K=h(L.id);t.set(L.id,{x:K.x+q,y:K.y+Y})}j.push(E)}for(const q of C){const Y=h(q.id),{w:L,h:K}=d(q.id);N.push({x:Y.x,y:Y.y,w:L,h:K,...p(q.id)})}}return j}function nW(e,t,n){const s=new Map;for(const a of e){if(t.has(a.id)||!n(a.id))continue;const l=Ka(a);(s.get(l)??s.set(l,[]).get(l)).push(a)}if(s.size===0)return e;for(const a of s.values())a.sort((l,c)=>l.id.localeCompare(c.id));return e.map(a=>{var p;if(t.has(a.id)||n(a.id))return a;const l=s.get(Ka(a));if(!l)return a;const c=(p=a.data)==null?void 0:p.parentId,d=l.find(f=>f.id===c)??l[0],h=n(d.id);return{...a,position:{x:a.position.x+h.x-d.position.x,y:a.position.y+h.y-d.position.y}}})}function rW(e,t,n,s,a,l=!1,c){const p=oi+Yd+1,f=8,m=1.75,y=200,v=.7,N=.01,_=$=>Hl($,s,c),S=$=>n.get($)??t.get($),k=new Map;for(const $ of e){if(!S($.id))continue;const B=Ka($),Z=k.get(B);Z?Z.push($):k.set(B,[$])}const j=[],E=new Set,C=new Set,T=a.size===0;for(const $ of[...k.keys()].sort()){const B=k.get($);let Z=1/0,J=1/0,I=-1/0,X=-1/0,G=!1;for(const K of B){const P=S(K.id),{w:V,h:he}=_(K.id);Z=Math.min(Z,P.x),J=Math.min(J,P.y),I=Math.max(I,P.x+V),X=Math.max(X,P.y+he),n.has(K.id)&&(G=!0)}const q=I-Z,Y=X-J;C.add($);const L=a.get($);L&&(q>L.w+f||Y>L.h+f)&&E.add($),a.set($,{w:q,h:Y}),j.push({sid:$,members:B.map(K=>K.id),x:Z,y:J,w:q,h:Y,anchored:G,mass:1})}for(const $ of[...a.keys()])C.has($)||a.delete($);if(l||T)return[];let R=!1;for(let $=0;$<j.length&&!R;$++)for(let B=$+1;B<j.length;B++){const Z=j[$],J=j[B];if(!(Z.anchored&&J.anchored)&&Math.abs(Z.x+Z.w/2-(J.x+J.w/2))<(Z.w+J.w)/2+61&&Math.abs(Z.y+Z.h/2-(J.y+J.h/2))<(Z.h+J.h)/2+p){R=!0;break}}if(E.size===0&&!R)return[];if(E.size>0)for(const $ of j)E.has($.sid)&&($.mass=8);else for(const $ of j)$.mass=Math.max(1,$.w*$.h/(Ya*Wl));const A=new Map(j.map($=>[$.sid,$.x])),D=new Map(j.map($=>[$.sid,$.y]));for(let $=0;$<y;$++){const B=new Map,Z=new Map;let J=0;for(let I=0;I<j.length;I++)for(let X=I+1;X<j.length;X++){const G=j[I],q=j[X];if(G.anchored&&q.anchored)continue;const Y=G.x+G.w/2,L=G.y+G.h/2,K=q.x+q.w/2,P=q.y+q.h/2,V=(G.w+q.w)/2+61-Math.abs(Y-K),he=(G.h+q.h)/2+p-Math.abs(L-P);if(V<=0||he<=0)continue;const z=(Qe,fe)=>!Qe.anchored&&!(fe<0&&Qe.x<=0),W=(Qe,fe)=>!Qe.anchored&&!(fe<0&&Qe.y<=0),ee=(Qe,fe,ye)=>{const Se=Qe===fe,Pe=Se?G.sid<q.sid?-1:1:Math.sign(Qe-fe);return ye(G,Pe)||ye(q,-Pe)?Pe:Se&&(ye(G,-Pe)||ye(q,Pe))?-Pe:0},H=ee(Y,K,z),ae=ee(L,P,W),me=H!==0,ge=ae!==0;if(!me&&!ge)continue;const Re=me&&(!ge||V*m<he),[$e,ce,we,xe]=Re?[H,V,B,z]:[ae,he,Z,W],De=xe(G,$e),_e=xe(q,-$e),Ee=G.mass,Ge=q.mass,st=De?_e?Ge/(Ee+Ge):1:0,Je=_e?De?Ee/(Ee+Ge):1:0,Ze=ce*v;we.set(G.sid,(we.get(G.sid)??0)+$e*Ze*st),we.set(q.sid,(we.get(q.sid)??0)-$e*Ze*Je),J+=Ze}for(const I of j)I.anchored||(I.x=Math.max(0,I.x+(B.get(I.sid)??0)),I.y=Math.max(0,I.y+(Z.get(I.sid)??0)));if(J<N)break}const O=[];for(const $ of j){const B=$.x-A.get($.sid),Z=$.y-D.get($.sid);if(!(Math.abs(B)<1&&Math.abs(Z)<1)){for(const J of $.members){if(n.has(J))continue;const I=t.get(J);I&&t.set(J,{x:I.x+B,y:I.y+Z})}O.push($.sid)}}return O}const sW=600;function Vv(e,t){return!(e.exitAt!=null&&t-e.exitAt>sW||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function aW(e,t){const n=new Set;for(const s of e.agents.values())Vv(s,t)&&n.add(s.id);return n}function oW(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 iW(e,t,n=0){if(!e)return!1;for(const s of t)if(oW(e,s,n))return!0;return!1}const oR="sessionGroup";function lW(e,t){var s;if(e.type===oR)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const iR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function SC(e){const t={};for(const n of iR)t[n]=e(n);return t}function cW(e){return t=>e[t]??""}function uW(e,t){return iR.every(n=>e[n]===t[n])}function dW(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[a,l]of e.positions)n.set(a,l),t.has(a)&&s.set(a,l);return{positions:n,pinned:s}}const hW=1200,fW=1e3;function jC(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<hW?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<fW}function Zu({durationMs:e,documentHidden:t,reducedMotion:n=pW()}){return t||n?!1:Number.isFinite(e)&&e>0}function pW(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function iv(e){const t=typeof document<"u"&&document.hidden;return Zu({durationMs:e,documentHidden:t})?e:0}function mW(e,t,n){const s=e.x*t.zoom+t.x,a=e.y*t.zoom+t.y,l=(e.x+e.width)*t.zoom+t.x,c=(e.y+e.height)*t.zoom+t.y;return l>0&&s<n.width&&c>0&&a<n.height}function gW({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,mW(a,t,e))return!1;return s}const yW="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",lv="click for what's new";function wW(e){if(e.checkDisabled)return`${yW} · ${lv}`;if(e.checking)return`Asking npm for the newest release… · ${lv}`;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.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${lv}, and to check npm now`}function vW(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`:`${t} and check npm for a newer release`}function xW(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 bW(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 Yv={kind:"assumed",claude:!0,codex:!0};function kW(e){if(!e||typeof e!="object")return Yv;const t=e.providers;if(!t||typeof t!="object")return Yv;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function wd(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const EC=99;function _W(e){const t=Math.max(0,Math.floor(e));return t>EC?`${EC}+`:String(t)}const NW="Pause the canvas";function SW(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 jW(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 lR="paused · full",EW=(e,t)=>t>0?lR:e>0?`paused · ${_W(e)}`:"paused";function CW(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:EW(e.held,t),widest:lR,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"}}function CC(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const TW={agent:_4,sessionGroup:F4},cR="react-flow__node";function TC(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,cR))===!0}const cv=80,uv=.86;function AC(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 AW(e){try{const t=document.querySelector(`.${cR}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const RW=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),MW=420;function IW(e){return e<.35?"far":e<.55?"mid":"full"}const zu=18,$W=200,OW=5*6e4,PW=6,LW=2*6e4,RC=400,Qx="agent-dag.layout",Zx="agent-dag.viewport",uR="agent-dag.summariesDismissed",dR="agent-dag.sessionListOpen",hR="agent-dag.detailOpen",fR="agent-dag.usagePanelOpen",pR="agent-dag.systemPanelOpen",MC="agent-dag.accountsPanelOpen",dv="agent-dag.versionNoticeDismissed",IC="agent-dag.oldNameNoticeDismissed",DW=15*6e4,hv={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:"},Uu="agent-dag.autoRestart",$C="agent-dag.bundleReloadedFor";function qW(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(dR)==="1"}catch{return!1}}function FW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(dR,e?"1":"0")}catch{}}function BW(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(hR)==="1"}catch{return!1}}function zW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(hR,e?"1":"0")}catch{}}function UW(){const e=gi(fR);return e===null?!0:e==="1"}function WW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(fR,e?"1":"0")}catch{}}function HW(){const e=gi(pR);return e===null?!0:e==="1"}function GW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(pR,e?"1":"0")}catch{}}function VW(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(uR);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(n=>typeof n=="string"):[])}catch{return new Set}}function OC(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(uR,JSON.stringify(n))}catch{}}function YW(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Qx);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const a=Object.entries(n).filter(([,l])=>l&&typeof l.x=="number"&&typeof l.y=="number");return{positions:a,pins:a.map(([l])=>l)}}return{positions:Object.entries(n.positions??{}).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function fv(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(Qx,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function KW(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Zx);if(!e)return null;const t=JSON.parse(e);return typeof(t==null?void 0:t.x)!="number"||typeof(t==null?void 0:t.y)!="number"||typeof(t==null?void 0:t.zoom)!="number"?null:t}catch{return null}}function XW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Zx,JSON.stringify(e))}catch{}}function PC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Qx)}catch{}try{window.localStorage.removeItem(Zx)}catch{}}}function QW(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const f of e.agents.values())f.sessionId===t&&s.push(f);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(f=>({id:f.id,kind:f.kind,label:f.label,parentId:f.parentId,state:f.state,startedAt:f.startedAt,endedAt:f.endedAt,model:f.model,cwd:f.cwd,usage:f.usage,prompts:f.prompts,tools:f.tools.map(m=>({id:m.id,name:m.name,inputPreview:m.inputPreview,startedAt:m.startedAt,endedAt:m.endedAt,ok:m.ok,errorPreview:m.errorPreview,usage:m.usage}))}))},l=JSON.stringify(a,null,2),c=new Blob([l],{type:"application/json"}),d=URL.createObjectURL(c),h=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");h.href=d,h.download=`${Gt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(d),1e3)}const Kv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Xv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},mR=k2;function ZW(e,t,n,s,a,l,c,d,h,p,f,m,y,v,N,_,S,k){const j=[],E=[];for(const $ of e.agents.values()){if(!S.has($.id))continue;const B=$.exitAt!=null,Z=_!=null&&!_.has($.id),J=[B?"rf-exiting":"",Z?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,I=l.get($.id);if(j.push({id:$.id,type:"agent",position:{x:0,y:0},data:{...$,now:t,onOpenContext:k},className:J,...I?{width:I.width,height:I.height}:null}),$.parentId&&S.has($.parentId)){const X=gx($.sessionId),G=B,q=N.size>0&&(N.has($.id)||N.has($.parentId)),Y=_!=null&&!_.has($.id)&&!_.has($.parentId),L=$.state==="active"?2:1.5,K=q?L+1.5:L,P=G?.2:Y?.12:1,V=["sess-edge",$.state==="active"?"sess-live":"sess-idle",G?"rf-edge-exiting":"",q?"rf-edge-selected":""].filter(Boolean).join(" ");E.push({id:`e:${$.parentId}->${$.id}`,source:$.parentId,target:$.id,animated:($.state==="active"||q)&&!G,type:"smoothstep",style:{"--session-hue":X,strokeWidth:K,opacity:P,transition:"var(--edge-transition)"},className:V})}}const C=new Map;for(const $ of e.agents.values())$.tools.length>0&&C.set($.id,Math.min(4,$.tools.length));const T=`${y}#lanes:${QU(C)}`,R=j.filter($=>WF($.id,a,f,m));if(R.length>0||T!==v.current){if(R.length>0){const $=nW(JU(j,E,{direction:"LR",pinned:a,measured:l,availableWidth:n,availableHeight:s,lanes:C}),a,B=>Gv(B,f,m)?void 0:f.get(B));for(const B of $)Gv(B.id,f,m)&&GF(B.id,B.position,f,m);tW(j,f,a,l,new Set(R.map(B=>B.id)),C,{width:n,height:s})}eW(j,f,a,l,C),v.current=T}const A=rW(j,f,a,l,c,!h||p,C);A.length>0&&d(A),Pu(f,e.agents),Pu(m,e.agents),Pu(a,e.agents),Pu(l,BF(e.agents.values()));const D=[];let O=!1;for(const $ of j){let B=a.get($.id)??f.get($.id);B||(B=HF($.id,f,m),O=!0),D.push({...$,position:B})}return O&&(v.current=""),{nodes:D,edges:E}}function JW(){return i.jsx(px,{children:i.jsx(eH,{})})}function eH(){var Yi,Ki,Xi,nr;const e=Xl(),t=It(),n=x.useState(Av)[0],s=x.useRef(n),[,a]=x.useState(0),l=x.useCallback(()=>a(F=>F+1),[]),[c,d]=x.useState(()=>new Set),[h,p]=x.useState(null),[f,m]=x.useState(null),y=x.useCallback((F,U)=>{d(oe=>{if(!U)return new Set([F]);const le=new Set(oe);return le.has(F)?le.delete(F):le.add(F),le}),p(oe=>U&&oe===F?oe:F)},[]),v=x.useCallback(()=>{d(new Set),p(null)},[]),[N,_]=x.useState(null),[S,k]=x.useState(null),j=x.useCallback(F=>k(F),[]),[E,C]=x.useState(!1),[T,R]=x.useState(!1),[A,D]=x.useState(!1),O=x.useRef(null),$=x.useState(VW)[0],[B,Z]=x.useState(qW);x.useEffect(()=>{FW(B)},[B]);const[J,I]=x.useState(BW);x.useEffect(()=>{zW(J)},[J]);const[X,G]=x.useState(UW);x.useEffect(()=>{WW(X)},[X]);const[q,Y]=x.useState(HW);x.useEffect(()=>{GW(q)},[q]);const[L,K]=x.useState(()=>{try{const F=window.localStorage.getItem(MC);return F===null?!0:F==="1"}catch{return!0}});x.useEffect(()=>{try{window.localStorage.setItem(MC,L?"1":"0")}catch{}},[L]);const P=Ff(L,200),V=Ff(X,130),he=Ff(q,130),[z,W]=x.useState(null);x.useEffect(()=>{let F=null;try{F=localStorage.getItem("agent-dag.sound")}catch{}W(F===null?!0:F==="on")},[]);const ee=x.useCallback(()=>{W(F=>{var oe;const U=F!==!0;try{localStorage.setItem("agent-dag.sound",U?"on":"off")}catch{}return U&&((oe=Ge.current)==null||oe.unlock()),U})},[]),H=x.useCallback(F=>{ee()},[ee]),ae=x.useRef(H);ae.current=H;const me=x.useRef(z);me.current=z;const[ge,Re]=x.useState(()=>sF(gi)),$e=x.useRef(ge);$e.current=ge;const ce=x.useRef(null),we=x.useCallback((F,U=!1)=>{var oe,le;if((oe=Ge.current)==null||oe.unlock(),ce.current!==null&&clearTimeout(ce.current),ce.current=null,!U){(le=Ge.current)==null||le.play(F,!0);return}ce.current=setTimeout(()=>{var je;ce.current=null,(je=Ge.current)==null||je.play(F,!0)},Jq)},[]),xe=x.useCallback((F,U)=>{Re(oe=>{const le={level:Ul(U.level??oe[F].level),figure:K2(F,U.figure??oe[F].figure)};try{localStorage.setItem(X2[F],String(le.level)),localStorage.setItem(Q2[F],le.figure)}catch{}return{...oe,[F]:le}}),we(F,!0)},[we]);x.useEffect(()=>()=>{ce.current!==null&&clearTimeout(ce.current)},[]);const[De,_e]=x.useState(!1),Ee=x.useRef(null),Ge=x.useRef(null),[st,Je]=x.useState("locked");x.useEffect(()=>{const F=iF({enabled:()=>me.current===!0,prefs:()=>$e.current,onState:Je});Ge.current=F,Je(F.state());const U=()=>F.unlock();return window.addEventListener("pointerdown",U,{once:!0,capture:!0}),window.addEventListener("keydown",U,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",U,{capture:!0}),window.removeEventListener("keydown",U,{capture:!0})}},[]);const[Ze,Qe]=x.useState(!1),[fe,ye]=x.useState(null),[Se,Pe]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(dv)??""}catch{return""}}),[et,ft]=x.useState(!1),dt=x.useRef(0),[ze,Xe]=x.useState(!1),re=x.useCallback((F=!1)=>(F&&(dt.current=Date.now(),Xe(!0)),fetch(F?"/api/version?refresh=1":"/api/version").then(U=>U.ok?U.json():null).then(U=>{U&&ye(U)}).catch(()=>{}).finally(()=>{F&&Xe(!1)})),[]),Fe=x.useCallback(()=>{re(Date.now()-dt.current>=DW)},[re]);x.useEffect(()=>{re();const F=window.setInterval(Fe,5*6e4),U=()=>{document.visibilityState==="visible"&&Fe()};return document.addEventListener("visibilitychange",U),()=>{window.clearInterval(F),document.removeEventListener("visibilitychange",U)}},[re,Fe]),x.useEffect(()=>{Ze&&re()},[Ze,re]),x.useEffect(()=>{const F=gF();let U=null;const oe=Ue=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:F,looking:Ue}),keepalive:!0}).catch(()=>{})},le=()=>{const Ue=pF(document);mF(U,Ue)&&oe(Ue),U=Ue},je=()=>{U&&oe(!1),U=!1};le();const Me=window.setInterval(le,fF);return window.addEventListener("focus",le),window.addEventListener("blur",le),document.addEventListener("visibilitychange",le),window.addEventListener("pagehide",je),()=>{window.clearInterval(Me),window.removeEventListener("focus",le),window.removeEventListener("blur",le),document.removeEventListener("visibilitychange",le),window.removeEventListener("pagehide",je),je()}},[]);const se=(fe==null?void 0:fe.notice)??null,[Ce,Ve]=x.useState(null),gt=x.useRef(!1);x.useEffect(()=>{if(gt.current)return;const F=Q1(),U=SF(F),oe=RF({stored:U,running:(fe==null?void 0:fe.running)??null,notes:X1,remembers:jF(F)});if(oe.reason==="no-version")return;gt.current=!0,oe.record&&EF(F,oe.record);const le=AF({tourSeen:CF(F),decision:oe}),je=oe.show.length?{entries:oe.show,since:U,firstRun:!1}:null;le.tour&&D(!0),le.notes==="now"?Ve(je):le.notes==="after"&&(O.current=je)},[fe==null?void 0:fe.running]);const xt=(fe==null?void 0:fe.running)??"3.22.11",Te=x.useMemo(()=>Z2(X1,null,xt),[xt]),tt=x.useCallback(()=>{Ve({entries:Te,since:null,firstRun:!1})},[Te]),[pt,wt]=x.useState(null),[Yt,Fr]=x.useState(Yv);x.useEffect(()=>{let F=!1;return fetch("/api/health").then(U=>U.ok?U.json():null).then(U=>{F||(Fr(kW(U)),!(!U||typeof U.workspace!="string")&&wt(U.workspace))}).catch(()=>{}),()=>{F=!0}},[Ze]);const Qn=x.useRef(Yt);Qn.current=Yt;const Br=se?`${se.kind}:${se.to}`:"",Zn=se!=null&&Se!==Br,eo=x.useCallback(()=>{Pe("");try{window.localStorage.setItem(dv,"")}catch{}},[]),zr=x.useCallback(()=>{if(se){Pe(Br);try{window.localStorage.setItem(dv,Br)}catch{}}},[se,Br]),[Xs,Ur]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(IC)??""}catch{return""}}),Mn=fe!=null&&fe.invokedAs&&fe.invokedAs!==Gt?fe.invokedAs:null,Wr=Mn!=null&&Xs!==Mn,ys=x.useCallback(()=>{if(Mn){Ur(Mn);try{window.localStorage.setItem(IC,Mn)}catch{}}},[Mn]),Ft=((Yi=fe==null?void 0:fe.upgrade)==null?void 0:Yi.state)??"idle",vr=Mq(fe==null?void 0:fe.upgrade),Qs=x.useRef(!1),ki=x.useCallback(async()=>{if(fr(Qs.current||Ft==="running")){Qs.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await re(),Qs.current=!1}},[Ft,re]);x.useEffect(()=>{if(Ft!=="running")return;const F=window.setInterval(re,3e3);return()=>window.clearInterval(F)},[Ft,re]);const to=x.useCallback(async()=>{const F=fe==null?void 0:fe.command;!F||!await Y2(F)||(ft(!0),window.setTimeout(()=>ft(!1),1600))},[fe==null?void 0:fe.command]),In=x.useCallback(()=>{Z(F=>(F||K(!1),!F))},[]),Zs=x.useCallback(()=>{K(F=>(F||Z(!1),!F))},[]),[Js,ea]=x.useState(!1),[ta,na]=x.useState(!1),[ra,no]=x.useState(()=>{try{return Number(localStorage.getItem(t_))||0}catch{return 0}}),[sa,_i]=x.useState([]),[mt,ro]=x.useState(!1);x.useEffect(()=>{let F=!0;const U=()=>{fetch("/api/browser-watch?live=0").then(le=>le.ok?le.json():null).then(le=>{var je;!F||!(le!=null&&le.ok)||(_i(le.episodes??[]),ro(((je=le.settings)==null?void 0:je.enabled)===!0))}).catch(()=>{})};U();const oe=setInterval(U,5*6e4);return()=>{F=!1,clearInterval(oe)}},[]);const[aa,Hr]=x.useState([]),Gr=x.useRef(new Set),[Vr,oa]=x.useState(null);x.useEffect(()=>{let F=!0,U=0;const oe=()=>{fetch("/api/lan").then(le=>le.ok?le.json():null).then(le=>F?(le!=null&&le.ok&&Hr(D1(Array.isArray(le.pending)?le.pending:[],le.aliases)),le):null).catch(()=>null).then(le=>{F&&(U=window.setTimeout(oe,(le==null?void 0:le.enabled)===!0?Bv:H2))})};return oe(),()=>{F=!1,window.clearTimeout(U)}},[]);const Yr=x.useCallback(async(F,U)=>{if(!Vr){oa(F);try{const le=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:F,fp:U})})).json().catch(()=>null);le&&Array.isArray(le.pending)?Hr(D1(le.pending,le.aliases)):Hr(je=>je.filter(Me=>Me.fp!==U))}catch{}finally{oa(null)}}},[Vr]),Ot=x.useMemo(()=>x8(sa,ra).length,[sa,ra]),[ia,dn]=x.useState(0),lc=x.useRef(null),[Kd,cc]=x.useState(!1),xr=x.useRef(null),[so,ws]=x.useState(0),en=x.useState(()=>QF({protect:F=>CL(s.current,F)}))[0],[ao,Xd]=x.useState(!1),la=x.useCallback(()=>{const F=en.paused&&en.dropped>0,U=en.setPaused(!en.paused);F&&TL(s.current);for(const oe of U)s.current=Fk(s.current,oe);Xd(en.paused)},[en]),[Tt,Ni]=x.useState(Date.now()),[on,oo]=x.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(Uu)!=="0"}catch{return!0}}),io=x.useRef(!1),ct=x.useCallback(()=>{const F=!on;io.current=!0;try{window.localStorage.removeItem(Uu)}catch{}oo(F),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:F})}).then(U=>U.ok?U.json():null).then(U=>{var oe;U!=null&&U.ok&&oo(((oe=U.prefs)==null?void 0:oe.autoUpdate)!==!1)}).catch(()=>{})},[on]),[Jn,ca]=x.useState(!1),[Si,uc]=x.useState("restart"),[ji,Ei]=x.useState(null),br=x.useRef(!1),ua=x.useRef(null),er=x.useRef(0),_n=x.useCallback(async F=>{if(!fr(br.current))return;const U=(F==null?void 0:F.upgrade)===!0;br.current=!0,ua.current=vr;const oe=++er.current;uc(U?"npx":"restart"),ca(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(se==null?void 0:se.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:U})})}catch{}window.setTimeout(()=>{if(er.current===oe&&br.current){br.current=!1,ca(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},U?18e4:3e4)},[se==null?void 0:se.to,vr]),$n=x.useRef(null);x.useEffect(()=>{const F=H1(s.current.agents.values())>0,U=Lq({enabled:on,kind:se==null?void 0:se.kind,canRestart:(fe==null?void 0:fe.canRestart)===!0,noticeOpen:Zn,visible:document.visibilityState==="visible",busy:F,idleSince:$n.current,now:Tt});$n.current=U.idleSince,U.restart&&_n()},[on,se==null?void 0:se.kind,fe==null?void 0:fe.canRestart,Zn,Tt,_n]);const vs=H1(s.current.agents.values()),xs=Pq(vs),tr=V2({enabled:on,kind:se==null?void 0:se.kind,canRestart:(fe==null?void 0:fe.canRestart)===!0,noticeOpen:Zn,visible:document.visibilityState==="visible",busy:vs>0,idleSince:$n.current,now:Tt});x.useEffect(()=>{const F=fe==null?void 0:fe.running;let U=null,oe=null;try{U=window.sessionStorage.getItem("agent-dag.restartPending"),oe=window.sessionStorage.getItem($C)}catch{return}const le=Rq({bundle:"3.22.11",running:F,pending:U,lastTried:oe});if(le==="reload"){try{window.sessionStorage.setItem($C,F??"")}catch{return}window.location.reload();return}if(le!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}br.current=!1,ca(!1),Ei(F??null);const je=window.setTimeout(()=>Ei(null),6e3);return()=>window.clearTimeout(je)},[fe==null?void 0:fe.running]),x.useEffect(()=>{if(Jn&&Iq({asked:ua.current,reported:vr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}br.current=!1,ca(!1)}},[Jn,vr]);const dc=x.useState(()=>dW(YW()))[0],tn=x.useRef(dc.pinned),kr=x.useRef(null),lo=x.useState(()=>KW())[0],[co,uo]=x.useState(()=>new Set),[Kr,hc]=x.useState(JF),[hn,da]=x.useState(()=>SC(CC)),Xr=x.useMemo(()=>cW(hn),[hn]),ho=x.useCallback(F=>lW(F,Xr),[Xr]),Qd=x.useMemo(()=>({background:hn["--panel"],border:`1px solid ${hn["--line"]}`,borderRadius:8}),[hn]),[fc,Ci]=x.useState(!1);x.useEffect(()=>{document.documentElement.dataset.theme=Kr;try{window.localStorage.setItem(nA,Kr)}catch{}da(F=>{const U=SC(CC);return uW(F,U)?F:U})},[Kr]);const On=x.useCallback((F,U)=>{if(Zu({durationMs:U,documentHidden:document.hidden})){e.setViewport(F,{duration:U});return}const{d3Zoom:oe,d3Selection:le}=t.getState(),je=le==null?void 0:le.property("__zoom");if(oe&&le&&je&&je.k>0&&F.zoom>0){oe.transform(le,je.scale(F.zoom/je.k).translate((F.x-je.x)/F.zoom,(F.y-je.y)/F.zoom));return}e.setViewport(F,{duration:0})},[e,t]),Qr=x.useRef(null);x.useEffect(()=>{if(!lo)return;const F=window.setTimeout(()=>{try{On(lo,0)}catch{}Nn.current=Date.now()},60);return()=>window.clearTimeout(F)},[On,lo]);const Ti=x.useRef(!0);x.useEffect(()=>{const F=new EventSource("/events"),U=KF(l,{now:()=>Date.now(),setTimeout:(oe,le)=>window.setTimeout(oe,le),clearTimeout:oe=>window.clearTimeout(oe)});return F.addEventListener("open",()=>{Qe(!0),Ci(!0)}),F.addEventListener("error",()=>Qe(!1)),F.addEventListener("replay-end",()=>{Ti.current=!1,U.flush()}),F.addEventListener("hook",oe=>{var le;try{const je=JSON.parse(oe.data);if(!en.accept(je))return;s.current=Fk(s.current,je);const Me=je.replay===!0||Ti.current||Date.now()-je.receivedAt>3e4;Me?U.replay():U.live();const Ue=oF(je,Me);Ue&&((le=Ge.current)==null||le.play(Ue))}catch{}}),()=>{F.close(),U.cancel()}},[l]),x.useEffect(()=>{const F=setInterval(()=>{const U=Date.now();Ni(U);let oe=AL(s.current,U,qk);RL(s.current,U,qk)&&(oe=!0),jL(s.current,U,$W,OW)&&(oe=!0),EL(s.current,U,PW,LW)&&(oe=!0),d(le=>FF(le,s.current.agents)),p(le=>le!=null&&!s.current.agents.has(le)?null:le),k(le=>le!=null&&!s.current.agents.has(le)?null:le),_(le=>le!=null&&!s.current.agents.has(le)?null:le),oe&&l()},250);return()=>clearInterval(F)},[l]);const Pn=x.useRef(null),Nn=x.useRef(0),fo=420,Sn=x.useCallback((F=500)=>{const U=cv,oe=1,le=.2,je=uv;try{const Me=document.querySelector(".canvas-wrap"),Ue=Array.from(document.querySelectorAll(".react-flow__node")).filter(Et=>Et.offsetWidth>0);if(!Me||Ue.length===0)return;const ot=Me.getBoundingClientRect(),Ye=e.getViewport();if(!Number.isFinite(Ye.zoom)||Ye.zoom<=0)return;const ut=Et=>(Et-ot.left-Ye.x)/Ye.zoom,Kt=Et=>(Et-ot.top-Ye.y)/Ye.zoom,Tr=Ue.map(Et=>Et.getBoundingClientRect()),Qi=Math.min(...Tr.map(Et=>ut(Et.left))),Zi=Math.max(...Tr.map(Et=>ut(Et.right))),js=Math.min(...Tr.map(Et=>Kt(Et.top))),So=Math.max(...Tr.map(Et=>Kt(Et.bottom))),es=Zi-Qi,jo=So-js;if(!(es>0&&jo>0))return;const Na=Math.max(le,Math.min(oe,(ot.width-AC(Me)-U*2)/(es+fo)*je,(ot.height-U*2)/jo*je)),Sa={x:U-Qi*Na,y:Math.max(U,(ot.height-jo*Na)/2)-js*Na,zoom:Na};On(Sa,F),Nn.current=Date.now(),Qr.current=Zu({durationMs:F,documentHidden:document.hidden})?{target:Sa,until:Date.now()+F+60}:null,window.setTimeout(()=>{var Et;try{((Et=Qr.current)==null?void 0:Et.target)===Sa&&(Qr.current=null);const ja=e.getViewport();(Math.abs(ja.zoom-Na)>.01||Math.abs(ja.x-Sa.x)>2)&&On(Sa,0)}catch{}},F+60)}catch{}},[e,On]);x.useEffect(()=>{const F=()=>{if(!document.hidden)return;const U=Qr.current;if(Qr.current=null,!(!U||Date.now()>U.until)){try{On(U.target,0)}catch{}Nn.current=Date.now()}};return document.addEventListener("visibilitychange",F),()=>document.removeEventListener("visibilitychange",F)},[On]);const bs=x.useRef(""),ks=x.useRef(null),Ai=x.useRef(0),Bt=x.useCallback(()=>{Ai.current=Date.now()},[]),_r=x.useRef(null),po=x.useRef(0),Zr=x.useCallback(()=>{po.current=Date.now()},[]),pc=x.useCallback(F=>({hasSourceEvent:!!F,at:Date.now(),lastDeckFitAt:Nn.current,lastCanvasInputAt:po.current}),[]),ha="agent-dag.autoFitDisabled",mo=x.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(ha)==="1"}catch{return!1}})[0],Ln=x.useRef(mo),[fa,Ri]=x.useState(mo),Mi=x.useCallback(()=>{if(!Ln.current){Ln.current=!0,Ri(!0);try{window.localStorage.setItem(ha,"1")}catch{}}},[]),Zd=x.useCallback(()=>{Ln.current=!1,Ri(!1);try{window.localStorage.removeItem(ha)}catch{}Sn(400)},[e,Sn]);x.useEffect(()=>{const F=setInterval(()=>{if(Ln.current||Date.now()-Ai.current<800)return;const U=s.current,oe=Date.now(),le=[];for(const Me of U.agents.values())Vv(Me,oe)&&le.push({id:Me.id});if(le.length===0)return;const je=[];for(const{id:Me}of le){const Ue=Nr.current.get(Me),ot=tn.current.get(Me)??ln.current.get(Me);!Ue||!ot||je.push({x:ot.x,y:ot.y,width:Ue.width,height:Ue.height})}gW({pane:_r.current,viewport:e.getViewport(),boxes:je})&&Sn(600)},1500);return()=>clearInterval(F)},[e]);const Ii=x.useRef(!1),Nr=x.useRef(new Map),mc=x.useRef(0),Jd=x.useCallback(F=>{const U=Nr.current;let oe=!1;for(const le of F.nodeInternals.values()){const je=le.width,Me=le.height;if(je==null||Me==null)continue;const Ue=U.get(le.id);Ue?(Math.abs(Ue.height-Me)>4||Math.abs(Ue.width-je)>4)&&(U.set(le.id,{width:je,height:Me}),oe=!0):(U.set(le.id,{width:je,height:Me}),oe=!0)}return oe&&(mc.current+=1),mc.current},[]),gc=ht(Jd),[yc,eh]=x.useState(0);x.useEffect(()=>{let F=0;const U=()=>{const le=Nr.current;let je=!1;for(const Me of document.querySelectorAll(".react-flow__node[data-id]")){const Ue=Me.getAttribute("data-id");if(!Ue)continue;const ot=Me.offsetWidth,Ye=Me.offsetHeight;if(!ot||!Ye)continue;const ut=le.get(Ue);(!ut||Math.abs(ut.width-ot)>4||Math.abs(ut.height-Ye)>4)&&(le.set(Ue,{width:ot,height:Ye}),je=!0)}je&&eh(Me=>Me+1)};if(Ii.current)return;let oe=0;return document.visibilityState==="hidden"?oe=window.setTimeout(U,32):F=requestAnimationFrame(U),()=>{cancelAnimationFrame(F),window.clearTimeout(oe)}});const ln=x.useRef(dc.positions),th=x.useRef(new Set),$i=x.useRef(""),_s=x.useMemo(()=>{const F=[];for(const U of s.current.agents.values())Vv(U,Tt)&&F.push(U.id+(U.parentId?`>${U.parentId}`:""));return F.sort(),`${F.join("|")}#sv${gc}.${yc}`},[s.current,s.current.revision,Tt,gc,yc]),pa=x.useRef(null);x.useEffect(()=>(pa.current!=null&&window.clearTimeout(pa.current),pa.current=window.setTimeout(()=>{fv(ln.current,tn.current)},1500),()=>{pa.current!=null&&window.clearTimeout(pa.current)}),[_s]),x.useEffect(()=>{if(bs.current===_s)return;const F=bs.current;if(bs.current=_s,!F||Ln.current)return;Date.now()-Nn.current>1200&&Sn(400),Pn.current&&window.clearTimeout(Pn.current),Pn.current=window.setTimeout(()=>{Ln.current||Sn(500)},280)},[_s,e,Sn]);const ma=x.useMemo(()=>UF(s.current,c),[s.current,s.current.revision,c]),Oi=x.useMemo(()=>aW(s.current,Tt),[s.current,s.current.revision,Tt]),Pi=x.useRef(null),[go,Li]=x.useState({w:0,h:0});x.useEffect(()=>{const F=Pi.current;if(!F||typeof ResizeObserver>"u")return;const U=new ResizeObserver(oe=>{var je;const le=(je=oe[0])==null?void 0:je.contentRect;le&&(_r.current={width:le.width,height:le.height},Li(Me=>Math.abs(Me.w-le.width)>40||Math.abs(Me.h-le.height)>40?{w:le.width,h:le.height}:Me))});return U.observe(F),_r.current={width:F.clientWidth,height:F.clientHeight},Li({w:F.clientWidth,h:F.clientHeight}),()=>U.disconnect()},[]);const nh=x.useCallback(F=>{var oe,le;const U=F.target;!(U!=null&&U.closest)||U.closest(RW)!==F.currentTarget||(F.preventDefault(),(le=(oe=document.activeElement)==null?void 0:oe.blur)==null||le.call(oe))},[]),rh=x.useRef(new Map),[wc,sh]=x.useState(!1);x.useEffect(()=>{const F=window.setTimeout(()=>sh(!0),2500);return()=>window.clearTimeout(F)},[]);const[ah,Di]=x.useState(!1),Sr=x.useRef(null),[ga,Ns]=x.useState(!1),[oh,vc]=x.useState("full"),qi=x.useRef("full"),xc=x.useCallback(()=>{Sr.current&&(window.clearTimeout(Sr.current),Sr.current=null),Di(!1)},[]),bc=x.useCallback(F=>{F.length!==0&&queueMicrotask(()=>{Di(!0),Sr.current&&window.clearTimeout(Sr.current),Sr.current=window.setTimeout(()=>Di(!1),MW+80)})},[]);x.useEffect(()=>()=>{Sr.current&&window.clearTimeout(Sr.current)},[]);const[kc,Ss]=x.useState(0);x.useEffect(()=>{const F=AC(Pi.current);Ss(U=>Math.abs(U-F)>40?F:U)});const _c=go.w>0?Math.max(0,(go.w-kc-cv*2)*uv):0,Nc=go.h>0?Math.max(0,(go.h-cv*2)*uv):0,{nodes:jr,edges:Sc}=x.useMemo(()=>ZW(s.current,Tt,_c,Nc,tn.current,Nr.current,rh.current,bc,wc,ga,ln.current,th.current,_s,$i,c,ma,Oi,j),[s.current,s.current.revision,Tt,_c,Nc,wc,ga,_s,c,ma,Oi,j,ia]),Fi=x.useMemo(()=>{const F=new Map;for(const oe of jr){const le=oe.data;if(!(le!=null&&le.sessionId)||le.exitAt!=null)continue;const je=oe.width,Me=oe.height;if(je==null||Me==null)continue;const Ue=oe.position.x,ot=oe.position.y,Ye=Ue+je,ut=ot+Me,Kt=F.get(le.sessionId);Kt?(Kt.minX=Math.min(Kt.minX,Ue),Kt.minY=Math.min(Kt.minY,ot),Kt.maxX=Math.max(Kt.maxX,Ye),Kt.maxY=Math.max(Kt.maxY,ut)):F.set(le.sessionId,{minX:Ue,minY:ot,maxX:Ye,maxY:ut})}const U=[];for(const[oe,le]of F){const je=le.maxX-le.minX+zu*2,Me=le.maxY-le.minY+zu*2;U.push({id:`group:${oe}`,type:oR,position:{x:le.minX-zu,y:le.minY-zu},data:{sessionId:oe,w:je,h:Me},width:je,height:Me,style:{width:je,height:Me},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return U},[jr,Tt]),ya=x.useMemo(()=>{const F=[...Fi,...jr],U=xr.current;return!U||U.size===0?F:F.map(oe=>{const le=U.get(oe.id);return le?{...oe,position:le}:oe})},[Fi,jr,so]),Er=x.useMemo(()=>{const F=new Set;for(const U of s.current.agents.values())for(const oe of U.tools)F.add(mR(oe.name));return Object.keys(Kv).filter(U=>F.has(U))},[s.current,s.current.revision]);x.useEffect(()=>{if(Er.length<=1){cc(!1);return}let F=0;const U=()=>{const oe=lc.current;if(oe&&!document.hidden){const le=oe.getBoundingClientRect(),je=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Ue=>Ue.getBoundingClientRect()),Me=iW(le,je,8);cc(Ue=>Ue===Me?Ue:Me)}F=window.setTimeout(U,300)};return U(),()=>window.clearTimeout(F)},[Er.length]);const ih=x.useCallback(F=>{uo(U=>{const oe=new Set(U);return oe.has(F)?oe.delete(F):oe.add(F),oe})},[]),zt=h?s.current.agents.get(h):null,Bi=f?Array.from(s.current.agents.values()).flatMap(F=>F.tools).find(F=>F.id===f)??null:null,zi=x.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=Av(),tn.current.clear(),Nr.current.clear(),ln.current.clear(),$i.current="",PC(),v(),l()},[l,v]),yo=x.useRef(E);yo.current=E;const wo=x.useRef(T);wo.current=T;const vo=x.useRef(!1);vo.current=Bi!=null||Js||S!=null||A||N!=null||ta||T||Ce!=null;const wa=x.useCallback(F=>{const U=Dq(F,{confirmOpen:yo.current,modalOpen:vo.current});U==="confirm"?C(!0):U==="clear"&&(C(!1),zi())},[zi]),xo=x.useCallback(()=>{tn.current.clear(),ln.current.clear(),$i.current="",PC(),l(),window.setTimeout(()=>Sn(500),80)},[l,e,Sn]),jc=x.useCallback(()=>Sn(500),[Sn]),bo=x.useRef(jr);bo.current=jr;const Ec=x.useRef(h);Ec.current=h;const Ui=x.useCallback(F=>{const U=bo.current,oe=OF(U.map(Me=>({id:Me.id,x:Me.position.x,y:Me.position.y})),Ec.current,F),le=oe?U.find(Me=>Me.id===oe):void 0;if(!le)return;const je=TC(document.activeElement);y(le.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:iv(350),nodes:[le]})}catch{}Nn.current=Date.now(),je&&AW(le.id)},30)},[y,e]),Wi=x.useCallback(F=>{y(F,!1),window.setTimeout(()=>{try{const U=bo.current.find(oe=>oe.id===F);U&&e.fitView({padding:.3,duration:iv(500),nodes:[U]}),Nn.current=Date.now()}catch{}},60)},[y,e]);x.useEffect(()=>{const F=U=>{var ot,Ye;const oe=U.target,le={tagName:oe==null?void 0:oe.tagName,isContentEditable:oe==null?void 0:oe.isContentEditable,role:(ot=oe==null?void 0:oe.getAttribute)==null?void 0:ot.call(oe,"role"),type:oe==null?void 0:oe.type};if(U.key==="Escape"){const ut=o4({overlayOpen:ud.depth()>0,typing:xx(le)});ut==="dismiss"?ud.dismissTop():ut==="blur"?oe==null||oe.blur():(qF(le)&&(oe==null||oe.blur()),v());return}if(vx(U))return;const je=TC(oe)?(Ye=oe==null?void 0:oe.getAttribute)==null?void 0:Ye.call(oe,"data-id"):null,Me=je&&bo.current.some(ut=>ut.id===je)?je:null,Ue=LF(U,Me);if(Ue.kind==="activate"){U.preventDefault(),y(Ue.nodeId,Ue.additive);return}Ue.kind!=="node"&&(Ue.nodeId==null&&p4(le)||m4({key:U.key,modalOpen:vo.current,sheetOpen:wo.current})||(U.key===" "&&(U.preventDefault(),la()),(U.key==="c"||U.key==="C")&&wa("shortcut"),(U.key==="r"||U.key==="R")&&xo(),(U.key==="f"||U.key==="F")&&jc(),(U.key==="l"||U.key==="L")&&In(),(U.key==="d"||U.key==="D")&&I(ut=>!ut),(U.key==="h"||U.key==="H")&&ea(ut=>!ut),(U.key==="u"||U.key==="U")&&G(ut=>!ut),(U.key==="a"||U.key==="A")&&Qn.current.claude&&Zs(),(U.key==="j"||U.key==="J")&&Ui(1),(U.key==="k"||U.key==="K")&&Ui(-1),(U.key==="t"||U.key==="T")&&hc(ut=>ut==="dark"?"light":"dark"),(U.key==="m"||U.key==="M")&&Qn.current.claude&&me.current!==null&&ae.current(U.shiftKey),U.key==="?"&&R(ut=>!ut)))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[wa,xo,jc,v,y,Ui,la]);const fn=s.current.agents.size,At=x.useMemo(()=>ZL(s.current.agents.values()),[s.current,s.current.revision]),Hi=x.useMemo(()=>JL(s.current.agents.values()),[s.current,s.current.revision]),Gi=x.useRef(null);x.useEffect(()=>{const F=e8({waiting:At.length,running:Hi,connected:Ze}),U=Gi.current;if(Gi.current=F,(U==null?void 0:U.title)!==F.title&&(document.title=F.title),(U==null?void 0:U.icon)!==F.icon){const oe=document.querySelector('link[rel="icon"]');oe&&(oe.href=t8[F.icon])}},[At.length,Hi,Ze]);const[Cc,Tc]=x.useState(""),ko=r8(At);x.useEffect(()=>{Tc(F=>s8(F,ko))},[ko]);const[_o,lh]=x.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[pn,va]=x.useState(null),[Cr,xa]=x.useState(!1),[Ac,ba]=x.useState(!1);x.useEffect(()=>{let F=!0;return fetch("/api/prefs").then(U=>U.ok?U.json():null).then(U=>{var oe,le,je;if(!(!F||!(U!=null&&U.ok))){if(!io.current){let Me=!1;try{Me=window.localStorage.getItem(Uu)==="0",window.localStorage.removeItem(Uu)}catch{}Me&&((oe=U.prefs)==null?void 0:oe.autoUpdate)!==!1?(oo(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):oo(((le=U.prefs)==null?void 0:le.autoUpdate)!==!1)}xa(((je=U.prefs)==null?void 0:je.notifications)===!0),ba(U.notificationsVetoed===!0)}}).catch(()=>{}),()=>{F=!1}},[]);const Jr=x.useRef(()=>{}),Vi=x.useCallback(()=>{const F=!Cr;xa(F),F&&typeof Notification<"u"&&Notification.permission==="default"&&Jr.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:F})}).then(U=>U.ok?U.json():null).then(U=>{var oe;U!=null&&U.ok&&(xa(((oe=U.prefs)==null?void 0:oe.notifications)===!0),ba(U.notificationsVetoed===!0))}).catch(()=>{})},[Cr]),Rc=typeof Notification<"u";x.useEffect(()=>{if(!pn)return;const U=setTimeout(()=>va(null),pn==="blocked"?8e3:4e3);return()=>clearTimeout(U)},[pn]);const ka=x.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(F=>{const U=F;lh(U),U==="granted"?va("on"):U==="denied"&&va("blocked")})},[]);Jr.current=ka;const _a=x.useRef(new Set),No=x.useRef(null),Mc=At.map(F=>Ed(F.id,F.waiting)).join("|");return x.useEffect(()=>{r4(No.current,_o)&&(No.current=_o,_a.current=Wk(At))},[_o]),x.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||No.current===null)return;const F=typeof document>"u"||!document.hidden,U=t4(At,_a.current,F,Cr);for(const oe of U)try{const le=new Notification(oe.title,{body:oe.body,tag:oe.key});le.onclick=()=>{window.focus(),Wi(oe.sessionId),le.close()}}catch{}_a.current=F?Wk(At):n4(At,U,_a.current)},[Mc]),i.jsxs("div",{className:"app",children:[i.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),i.jsxs("header",{className:"topbar",children:[i.jsxs("div",{className:"readout",children:[i.jsxs("div",{className:"brand",children:[i.jsx("span",{className:"logo"}),i.jsx("h1",{children:Gt}),se?i.jsxs("button",{type:"button",className:"v stale",onClick:()=>{tt(),eo()},"aria-haspopup":"dialog","aria-label":xW({...se,open:Zn}),title:se.kind==="restart"?`Running v${se.from}; v${se.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${se.from}; v${se.to} is on npm · click for what's new`,children:["v",se.from,i.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const F={running:xt,latest:fe==null?void 0:fe.latest,latestPending:fe==null?void 0:fe.latestPending,checkedAgo:fe!=null&&fe.checkedAt?Pv(Tt-fe.checkedAt):null,checkDisabled:fe==null?void 0:fe.checkDisabled,checking:ze};return i.jsxs("button",{type:"button",className:ze?"v checking":"v",onClick:()=>{tt(),re(!0)},"aria-busy":ze||void 0,"aria-haspopup":"dialog","aria-label":vW(F),title:wW(F),children:["v",F.running]})})()]}),i.jsx("span",{className:"status",children:(()=>{const F=CW({connected:Ze,paused:ao,held:en.size,dropped:en.dropped});return F.resting?null:i.jsx("span",{className:`pill ${F.tone}`,title:F.title,children:i.jsxs("span",{className:"pill-box",children:[i.jsx("span",{className:"pill-widest","aria-hidden":!0,children:F.widest}),i.jsx("span",{className:"pill-label",children:F.label})]})})})()}),i.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Cc}),At.length>0&&i.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>Wi(At[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
268
|
-
${At.map(
|
|
269
|
-
`)}`,"aria-label":`${At.length} session${At.length===1?"":"s"} waiting for you`,children:[i.jsx("span",{className:"ap-pulse","aria-hidden":!0}),i.jsx("b",{children:At.length})," waiting"]}),pn&&i.jsx("span",{className:pn==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:pn==="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:pn==="on"?"notifications on":"notifications blocked"})]}),zt&&(()=>{const
|
|
267
|
+
Click to set the volume and the sound of each tone, and to hear either one.`}function sA(e){const t=new Map;for(const n of e)for(const s of n.agents??[]){if(!s||typeof s.agent!="string"||s.agent==="")continue;const a=t.get(s.agent)??{id:s.agent,cost:0,tokens:0};a.cost+=Number.isFinite(s.totalCost)?s.totalCost:0,a.tokens+=Number.isFinite(s.totalTokens)?s.totalTokens:0,t.set(s.agent,a)}return[...t.values()].sort((n,s)=>s.cost-n.cost||n.id.localeCompare(s.id))}function h8(e){const t=sA([{agents:e}]);return t.length<2?null:t.map(n=>`${Ix(n.id)} ${ot(n.cost)}`).join(" · ")}function t_(e){switch(e.toLowerCase()){case"claude":return"var(--usage-purple)";case"codex":return"var(--usage-orange)";case"gemini":return"var(--usage-indigo)";case"copilot":return"var(--usage-green)";default:return"var(--usage-zinc)"}}function f8(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function qu(e){const t=e.toLowerCase();return t.includes("opus")?"var(--usage-purple)":t.includes("sonnet")?"var(--usage-blue)":t.includes("haiku")?"var(--usage-green)":t.includes("gpt-5")||t.includes("gpt5")?"var(--usage-amber)":t.includes("gpt")?"var(--usage-red)":t.includes("gemini")?"var(--usage-indigo)":t.includes("codex")?"var(--usage-orange)":"var(--usage-zinc)"}const p8=[7,14,30,90];function m8(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),l=x.useState(a8)[0],c=x.useRef(!1),d=(h=!1)=>{if(h&&!fr(c.current))return;const p=l.begin();c.current=h;const f=e;a(!0);const y=`/api/ccusage?since=${Ov(f)}${h?"&refresh=1":""}`;fetch(y).then(v=>v.json()).then(v=>{p()&&n({range:f,resp:v})}).catch(()=>{p()&&n({range:f,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(c.current=!1,a(!1))})};return x.useEffect(()=>(d(!1),()=>l.cancel()),[e]),{landed:t,loading:s,reload:()=>d(!0)}}function g8({onClose:e,providers:t}){var D;const[n,s]=x.useState(30),[a,l]=x.useState(null),{landed:c,loading:d,reload:h}=m8(n),p=x.useRef(null),f=Vt(e,{focusRef:p}),m=o8({loading:d,want:n,answer:c&&{range:c.range,ok:c.resp.ok===!0,days:((D=c.resp.days)==null?void 0:D.length)??0}}),y=m.phase==="chart"?c.resp.days??[]:[],v=x.useMemo(()=>y.reduce((O,$)=>Math.max(O,$.totalCost),0),[y]),N=x.useRef(null);x.useLayoutEffect(()=>{const O=N.current;O&&(O.scrollLeft=O.scrollWidth)},[y]);const{totalCost:_,totalTok:S,inOut:k,cacheRead:j,modelCosts:E}=x.useMemo(()=>{let O=0,$=0,F=0,Z=0;const J=new Map;for(const I of y){O+=I.totalCost,$+=I.totalTokens,F+=I.inputTokens+I.outputTokens,Z+=I.cacheReadTokens;for(const X of I.modelBreakdowns)J.set(X.modelName,(J.get(X.modelName)??0)+X.cost)}return{totalCost:O,totalTok:$,inOut:F,cacheRead:Z,modelCosts:J}},[y]),C=x.useMemo(()=>Array.from(E.entries()).sort((O,$)=>$[1]-O[1]),[E]),T=x.useMemo(()=>sA(y),[y]),R=T.length>1,A=a?y.find(O=>O.period===a)??null:null;return i.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:i.jsxs("div",{ref:f,className:"uh-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[i.jsxs("header",{className:"uh-head",children:[i.jsxs("div",{className:"uh-titlewrap",children:[i.jsx("div",{className:"uh-title",children:"Usage history"}),i.jsx("div",{className:"uh-sub",children:c8(t,T.map(O=>O.id))})]}),i.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:p8.map(O=>i.jsxs("button",{type:"button","aria-pressed":n===O,className:"uh-range-btn",onClick:()=>{s(O),l(null)},children:[O,"d"]},O))}),i.jsx("button",{className:"glyph-btn uh-reload",onClick:h,...hr(d),title:"Re-run ccusage","aria-label":"Reload",children:d?"…":"↻"}),i.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),m.phase==="busy"?i.jsxs("div",{className:"uh-status uh-status-wait","aria-busy":"true",children:[i.jsx("span",{className:"uh-wait-word",children:c?"running ccusage…":"running ccusage… (first run downloads the package)"}),i.jsx("span",{className:"uh-wait-axis","aria-hidden":!0})]}):m.phase==="error"?i.jsxs("div",{className:"uh-status uh-err",title:fi(c.resp)||void 0,children:[i6(c.resp,"ccusage did not report usage"),i.jsx("div",{children:i.jsx("button",{className:"btn uh-retry",onClick:h,...hr(d),children:d?"trying…":"Try again"})})]}):m.phase==="empty"?i.jsx("div",{className:`uh-status${m.stale?" uh-stale":""}`,"aria-busy":m.stale||void 0,children:"no usage in this range"}):i.jsxs("div",{className:m.stale?"uh-stale":void 0,"aria-busy":m.stale||void 0,children:[i.jsxs("div",{className:"uh-totals",children:[i.jsx(Fu,{label:"total cost",val:ot(_),accent:!0}),i.jsx(Fu,{label:"tokens",val:Mt(S)}),i.jsx(Fu,{label:"input+output",val:Mt(k)}),i.jsx(Fu,{label:"cache reads",val:Mt(j)})]}),R&&i.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[i.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:T.map(O=>i.jsx("span",{className:"uh-agent-seg",style:{width:`${_>0?O.cost/_*100:0}%`,background:t_(O.id)}},O.id))}),i.jsx("div",{className:"uh-agent-keys",children:T.map(O=>i.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${Mt(O.tokens)} tokens`,children:[i.jsx("span",{className:"uh-legend-dot",style:{background:t_(O.id)}}),Ix(O.id),i.jsx("span",{className:"uh-agent-cost",children:ot(O.cost)}),i.jsx("span",{className:"uh-agent-share",children:f8(O.cost,_)})]},O.id))})]}),i.jsx("div",{ref:N,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map((O,$)=>{const F=v>0?O.totalCost/v*100:0,Z=O.period===a,J=`${O.period}, ${ot(O.totalCost)}`;return i.jsxs("button",{className:`uh-bar-col${Z?" sel":""}`,onClick:()=>l(Z?null:O.period),"aria-pressed":Z,"aria-label":J,title:`${O.period} · ${ot(O.totalCost)}`,style:{flexBasis:`${100/y.length}%`,"--uh-i":$,"--uh-step":`${Math.min(10,200/Math.max(y.length,1))}ms`},children:[i.jsx("div",{className:"uh-bar",style:{height:`${Math.max(F,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort((I,X)=>X.cost-I.cost).map(I=>{const X=O.totalCost>0?I.cost/O.totalCost*100:0;return i.jsx("div",{className:"uh-bar-seg",style:{height:`${X}%`,background:qu(I.modelName)}},I.modelName)})}),i.jsx("span",{className:"uh-bar-label",children:O.period.slice(5)})]},O.period)})}),i.jsx("div",{className:"uh-legend",children:C.map(([O,$])=>i.jsxs("span",{className:"uh-legend-item",title:O,children:[i.jsx("span",{className:"uh-legend-dot",style:{background:qu(O)}}),Vs(O)," ",i.jsx("span",{className:"uh-legend-cost",children:ot($)})]},O))}),A&&i.jsxs("div",{className:"uh-detail",children:[i.jsxs("div",{className:"uh-detail-head",children:[i.jsx("span",{className:"uh-detail-date",children:A.period}),i.jsx("span",{className:"uh-detail-cost",children:ot(A.totalCost)}),(()=>{var F,Z;const $=h8(A.agents)??((Z=(F=A.metadata)==null?void 0:F.agents)!=null&&Z.length?A.metadata.agents.join(" · "):null);return $?i.jsx("span",{className:"uh-detail-agents",title:$,children:$}):null})()]}),i.jsxs("div",{className:"uh-detail-mini",children:[i.jsx(Bu,{label:"input",val:Mt(A.inputTokens)}),i.jsx(Bu,{label:"output",val:Mt(A.outputTokens)}),i.jsx(Bu,{label:"cache write",val:Mt(A.cacheCreationTokens)}),i.jsx(Bu,{label:"cache read",val:Mt(A.cacheReadTokens)})]}),i.jsx("div",{className:"uh-detail-models",children:A.modelBreakdowns.slice().sort((O,$)=>$.cost-O.cost).map(O=>{const $=A.totalCost>0?O.cost/A.totalCost*100:0;return i.jsxs("div",{className:"uh-model-row",title:O.modelName,children:[i.jsxs("span",{className:"uh-model-name",children:[i.jsx("span",{className:"uh-legend-dot",style:{background:qu(O.modelName)}}),i.jsx("span",{className:"uh-model-label",children:Vs(O.modelName)})]}),i.jsx("span",{className:"uh-model-bar",children:i.jsx("span",{className:"uh-model-bar-fill",style:{width:`${$}%`,background:qu(O.modelName)}})}),i.jsx("span",{className:"uh-model-cost",children:ot(O.cost)})]},O.modelName)})})]})]})]})})}function Fu({label:e,val:t,accent:n}){return i.jsxs("div",{className:"uh-stat",children:[i.jsx("span",{className:`uh-stat-val${n?" accent":""}`,children:t}),i.jsx("span",{className:"uh-stat-label",children:e})]})}function Bu({label:e,val:t}){return i.jsxs("div",{className:"uh-ministat",children:[i.jsx("span",{className:"uh-ministat-val",children:t}),i.jsx("span",{className:"uh-ministat-label",children:e})]})}function y8(e){const t=/^#?([0-9a-f]{6})$/i.exec((e??"").trim());if(!t)return!1;const n=parseInt(t[1],16),s=[n>>16&255,n>>8&255,n&255].map(a=>{const l=a/255;return l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4)});return .2126*s[0]+.7152*s[1]+.0722*s[2]>.5}const n_=1e4,w8=12e3;function v8({browsers:e,findings:t,watching:n,palette:s,now:a=()=>Date.now()}){const l=x.useRef(null),c=x.useRef(null);return c.current={browsers:e,findings:t,watching:n},x.useEffect(()=>{var v;const d=l.current;if(!d)return;const h=d.getContext("2d");if(!h)return;const p=((v=window.matchMedia)==null?void 0:v.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let f=0,m=!1;const y=()=>{var q;if(m)return;const N=c.current;if(!N)return;const{browsers:_,findings:S,watching:k}=N,j=s["--accent"]||"#7dd3fc",E=s["--line"]||"#1f2229",C=s["--text-dim"]||"#6e727c",T=y8(s["--bg"]),R=T?42:26,A=T?.85:.65,D=a(),O=Math.min(window.devicePixelRatio||1,2),$=d.clientWidth,F=d.clientHeight;(d.width!==$*O||d.height!==F*O)&&(d.width=$*O,d.height=F*O),h.setTransform(O,0,0,O,0,0),h.clearRect(0,0,$,F);const Z=$/2,J=F/2,I=Math.min($,F)/2-6;h.strokeStyle=E,h.lineWidth=1,h.globalAlpha=T?1:.9;for(const Y of[.4,.7,1])h.beginPath(),h.arc(Z,J,I*Y,0,Math.PI*2),h.stroke();h.beginPath(),h.moveTo(Z-I,J),h.lineTo(Z+I,J),h.moveTo(Z,J-I),h.lineTo(Z,J+I),h.stroke(),h.globalAlpha=1;const G=(k&&!p?D%n_/n_:0)*Math.PI*2-Math.PI/2;if(k){const Y=(q=h.createConicGradient)==null?void 0:q.call(h,G-.85,Z,J);Y&&(Y.addColorStop(0,"transparent"),Y.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${j} ${R}%, transparent)`),Y.addColorStop(1,"transparent"),h.fillStyle=Y,h.beginPath(),h.moveTo(Z,J),h.arc(Z,J,I,G-.85,G),h.closePath(),h.fill()),h.strokeStyle=j,h.globalAlpha=A,h.beginPath(),h.moveTo(Z,J),h.lineTo(Z+Math.cos(G)*I,J+Math.sin(G)*I),h.stroke(),h.globalAlpha=1}_.forEach((Y,L)=>{const K=L/Math.max(_.length,1)*Math.PI*2-Math.PI/2,P=Y.lastReadMs===null?1:Math.min(1,(D-Y.lastReadMs)/12e4),V=I*(.42+P*.5),he=Z+Math.cos(K)*V,U=J+Math.sin(K)*V,W=Math.abs((G-K+Math.PI*3)%(Math.PI*2)-Math.PI),ee=k?Math.max(0,1-W/.55):0;h.beginPath(),h.arc(he,U,3+ee*1.6,0,Math.PI*2),h.fillStyle=Y.running?j:C,h.globalAlpha=Y.running?.55+ee*.45:.35,h.fill(),h.globalAlpha=1});for(const Y of S){const L=(D-Y.atMs)/w8;if(L<0||L>1)continue;const P=Math.max(0,_.findIndex(U=>U.key===Y.browser))/Math.max(_.length,1)*Math.PI*2-Math.PI/2,V=Z+Math.cos(P)*I*.6,he=J+Math.sin(P)*I*.6;h.beginPath(),h.arc(V,he,4+L*22,0,Math.PI*2),h.strokeStyle=j,h.globalAlpha=(1-L)*.8,h.lineWidth=1.5,h.stroke(),h.globalAlpha=1}f=requestAnimationFrame(y)};return y(),()=>{m=!0,cancelAnimationFrame(f)}},[a,s]),i.jsx("canvas",{ref:l,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const r_="agent-dag.browserWatch.seenMs";function x8(e,t){return e.filter(n=>n.startMs>t)}function b8(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function k8(e){const t=Math.ceil(e/1e3),n=Math.floor(t/60),s=t%60;return n>0?`${n}m ${s}s`:`${s}s`}function aA(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function s_(e,t){return t?{kind:"saving",word:"Saving",detail:""}:e.settings.enabled?{kind:"on",word:"Watching",detail:""}:{kind:"off",word:"Paused",detail:"nothing new is recorded"}}function _8(e,t){return e.map(n=>({key:n.key,name:n.name,running:n.running,visits:t.filter(s=>s.browser===n.key).reduce((s,a)=>s+a.programVisits,0)}))}function N8(e,t){if(e===null)return null;const n=Math.max(0,Math.round((t-e)/1e3));if(n<5)return"just now";if(n<60)return`${n} sec ago`;const s=Math.round(n/60);return s<60?`${s} min ago`:`${Math.round(s/60)} hr ago`}function S8(e){const t=e.profiles.filter(s=>s.degraded);if(t.length>0){const s=t[0],a=t.length-1;return{kind:"unreadable",text:`${s.name}/${s.profile} could not be read — ${s.reason??"no reason given"}`+(a>0?`, and ${a} more`:"")+". The watch continues on the profiles it can read."}}const n=aA(e.browsers);return n.length===0?{kind:"no-profiles",text:"No browser on this machine has a profile to read. Open one of the browsers below once and it will be watched from then on."}:n.some(s=>s.running)?null:{kind:"none-running",text:"No watched browser is running, so nothing can be navigated right now. Their history is still read, and anything found while they were open is still here."}}function j8(e){const t=n=>new Date(n).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return e.count===1||e.endMs-e.startMs<6e4?t(e.startMs):`${t(e.startMs)} → ${t(e.endMs)}`}function E8(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function a_(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function C8({onClose:e,onSeen:t,onWatching:n,palette:s}){const a=Vt(e),[l,c]=x.useState(null),[d,h]=x.useState(null),[p,f]=x.useState(null),[m,y]=x.useState(!1),v=x.useRef(!1),[N,_]=x.useState(null),[S,k]=x.useState(null),[j,E]=x.useState(!1),C=x.useRef(!1),[T,R]=x.useState(!1),[A,D]=x.useState(!1),[O,$]=x.useState(!1),[F,Z]=x.useState(!1),[J,I]=x.useState(!1),[X,G]=x.useState(()=>Date.now());x.useEffect(()=>{const H=setInterval(()=>G(Date.now()),1e3);return()=>clearInterval(H)},[]);const q=x.useCallback(async H=>{var ae,me;if(!(H&&!fr(v.current))){v.current=H,y(!0);try{const ge=await fetch(`/api/browser-watch${H?"?refresh=1":""}`);if(!ge.ok)throw new Error(`the deck answered ${ge.status}`);const Re=await ge.json();c(Re),C.current||_(((ae=Re==null?void 0:Re.settings)==null?void 0:ae.quietMinutes)??15),n(((me=Re==null?void 0:Re.settings)==null?void 0:me.enabled)===!0),h(null)}catch(ge){h(ge instanceof Error?ge.message:String(ge))}finally{v.current=!1,y(!1)}}},[n]);x.useEffect(()=>{q(!1)},[q]),x.useEffect(()=>{const H=setInterval(()=>{q(!1)},1e4);return()=>clearInterval(H)},[q]);const Y=x.useCallback(async H=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:H.host,startMs:H.startMs})})}finally{await q(!1)}},[q]),L=x.useCallback(async H=>{C.current=!0,E(!0);try{const ae=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(H)});if(!ae.ok)throw new Error(`the deck answered ${ae.status}`);await q(!1),f(null)}catch(ae){f(ae instanceof Error?ae.message:String(ae))}finally{C.current=!1,E(!1)}},[q]),K=x.useRef(t);K.current=t,x.useEffect(()=>()=>K.current(Date.now()),[]);const P=x.useMemo(()=>{const H=[];for(const ae of(l==null?void 0:l.episodes)??[]){const me=E8(ae.startMs),ge=H[H.length-1];ge&&ge.label===me?ge.episodes.push(ae):H.push({label:me,episodes:[ae]})}return H},[l]),V=aA(l==null?void 0:l.browsers),he=((l==null?void 0:l.browsers)??[]).filter(H=>!(H.installed&&H.profiles>0)),U=l?S8(l):null,W=V.reduce((H,ae)=>H+ae.profiles,0),ee=l?b8(l.coverage.lastHumanMs,l.coverage.quietMs,X):null;return i.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:i.jsxs("div",{ref:a,className:"modal bw-modal",onClick:H=>H.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{className:"modal-tool-name",id:"bw-title",children:"Browser watch"}),i.jsx("span",{className:"modal-tool-id",children:l?`${W} ${W===1?"profile":"profiles"} · local only`:"local only"})]}),i.jsxs("div",{className:"modal-actions",children:[i.jsx("button",{className:"glyph-btn",onClick:()=>void q(!0),...hr(m),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:m?"…":"↻"}),i.jsx("button",{className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),i.jsxs("div",{className:"modal-body bw-body",children:[!l&&!d&&i.jsxs("div",{className:"bw-loading",children:[i.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),i.jsx("p",{children:"Reading each browser's history. The first look copies the file, which takes a moment."})]}),d&&i.jsx("div",{className:"bw-state",children:i.jsxs("div",{className:"bw-row err",children:[i.jsx("span",{className:"bw-dot","aria-hidden":!0}),i.jsx("span",{className:"bw-row-label",children:"Could not read"}),i.jsx("span",{className:"bw-row-detail",children:d})]})}),l&&U&&i.jsx("p",{className:`bw-trouble ${U.kind}`,role:"status",children:U.text}),l&&i.jsxs("div",{className:"bw-work",children:[i.jsxs("aside",{className:"bw-side",children:[i.jsxs("section",{className:"bw-sec",children:[i.jsxs("h4",{className:"bw-sec-head",children:["Activity overview",i.jsx("button",{className:"bw-help",onClick:()=>$(H=>!H),"aria-expanded":O,"aria-label":"What the sweep and the dots mean",children:"?"})]}),i.jsxs("div",{className:"bw-glance",children:[i.jsx(v8,{browsers:V.map(H=>{var ae;return{key:H.key,name:H.name,running:H.running,lastReadMs:((ae=l.profiles.find(me=>me.browser===H.key))==null?void 0:ae.lastWrittenMs)??null}}),findings:l.episodes.slice(0,6).map(H=>({browser:H.browser??null,atMs:H.endMs})),watching:l.settings.enabled,palette:s}),i.jsx("ul",{className:"bw-counts",children:_8(V,l.profiles).map(H=>i.jsxs("li",{children:[i.jsx("span",{className:"bw-count-n",children:H.visits.toLocaleString("en-US")}),i.jsx("span",{className:"bw-count-of",children:H.name})]},H.key))})]}),i.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),l.coverage.checkedMs>0&&i.jsxs("p",{className:"bw-since",children:["Last checked ",N8(l.coverage.checkedMs,X),l.coverage.checks>0&&i.jsxs(i.Fragment,{children:[" · ",l.coverage.checks.toLocaleString("en-US")," ",l.coverage.checks===1?"check":"checks"]})]}),ee!==null&&i.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",k8(ee)]}),O&&i.jsxs("dl",{className:"bw-key",children:[i.jsx("dt",{children:"Sweep"}),i.jsx("dd",{children:"one poll of every watched profile"}),i.jsx("dt",{children:"Dot"}),i.jsx("dd",{children:"a browser, further out the longer since it last wrote history"}),i.jsx("dt",{children:"Ring"}),i.jsx("dd",{children:"a finding, leaving the browser it came from"})]})]}),i.jsxs("section",{className:"bw-sec",children:[i.jsxs("h4",{className:"bw-sec-head",children:["Watched profiles",i.jsx("button",{className:"bw-help",onClick:()=>Z(H=>!H),"aria-expanded":F,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),F&&i.jsxs("dl",{className:"bw-key",children:[i.jsx("dt",{children:"Running"}),i.jsx("dd",{children:"the browser has a process on this machine right now"}),i.jsx("dt",{children:"Connected"}),i.jsx("dd",{children:"an open connection to an address Anthropic's relay uses — which it shares with claude.ai, so an open tab looks the same as an agent channel"})]}),i.jsx("ul",{className:"bw-profiles",children:V.map(H=>i.jsxs("li",{children:[i.jsx("span",{className:`bw-prof-dot${H.running?" on":""}`,"aria-hidden":!0}),i.jsx("span",{className:"bw-prof-name",children:H.name}),i.jsx("span",{className:"bw-prof-state",children:H.running?"running":"idle"}),H.running&&H.relay.state==="live"&&i.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},H.key))}),he.length>0&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>I(H=>!H),"aria-expanded":J,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:J?"▾":"▸"})," ",he.length," not watched"]}),J&&i.jsxs("p",{className:"bw-rest",children:[he.map(H=>H.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]}),l.relay&&i.jsx(T8,{relay:l.relay})]}),i.jsxs("div",{className:"bw-main",children:[i.jsxs("section",{className:"bw-findings",children:[i.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Findings",l.episodes.length>0&&i.jsxs("span",{className:"bw-feed-count",children:[l.episodes.length," ",l.episodes.length===1?"episode":"episodes"]})]}),i.jsx("div",{className:"bw-eps",children:P.length===0?i.jsxs("div",{className:"bw-empty",children:[i.jsx("p",{className:"bw-empty-head",children:"Nothing found yet"}),i.jsxs("p",{className:"bw-empty-note",children:["An episode lands here when a program opens pages in a browser nobody has touched for"," ",l.settings.quietMinutes," ",l.settings.quietMinutes===1?"minute":"minutes",". On most machines that is rare, so an empty list is the ordinary result rather than a sign something is wrong."]}),!l.settings.enabled&&i.jsx("p",{className:"bw-empty-note",children:"Watching is off, so this shows only what this deck has seen since it started. Anything an earlier run recorded comes back when you switch it on."})]}):P.map(H=>i.jsxs("div",{className:"bw-day",children:[i.jsx("h4",{className:"bw-sec-head",children:H.label}),H.episodes.map(ae=>{const me=`${ae.host}-${ae.startMs}`,ge=S===me;return i.jsxs("div",{className:`bw-ep${ge?" open":""}`,children:[i.jsxs("div",{className:"bw-ep-row",children:[i.jsxs("button",{className:"bw-ep-head",onClick:()=>k(ge?null:me),"aria-expanded":ge,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:ge?"▾":"▸"}),i.jsx("span",{className:"bw-ep-host",children:ae.host}),i.jsxs("span",{className:"bw-ep-meta",children:[j8(ae),a_(ae)&&i.jsxs(i.Fragment,{children:[" · ",a_(ae)]})]}),i.jsxs("span",{className:"bw-ep-count",children:[ae.count," ",ae.count===1?"page":"pages"]})]}),i.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void Y(ae),"aria-label":`Dismiss ${ae.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),ge&&i.jsx("ul",{className:"bw-urls",children:ae.urls.map((Re,$e)=>i.jsxs("li",{children:[i.jsx("span",{className:"bw-url-time",children:new Date(Re.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),i.jsx("span",{className:"bw-url",children:Re.url})]},`${Re.url}-${Re.timeMs}-${$e}`))})]},me)})]},H.label))})]}),i.jsxs("section",{className:"bw-feed",children:[i.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Live activity",i.jsxs("span",{className:"bw-feed-count",children:[l.log.length," ",l.log.length===1?"event":"events"]})]}),i.jsx("p",{className:"bw-since bw-feed-note",children:"Pages you opened yourself — counted to run the rule, never written down. Addresses appear under Findings, and only for pages a program opened."}),i.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:l.log.length===0?i.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):l.log.map(H=>i.jsxs("div",{className:`bw-log-line ${H.level}${H.parts?"":" sys"}`,children:[i.jsx("span",{className:"bw-log-time",children:new Date(H.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),H.parts?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"bw-log-browser",children:H.parts.browser}),i.jsx("span",{className:"bw-log-profile",title:H.parts.profile,children:H.parts.profile}),i.jsxs("span",{className:"bw-log-value",children:[H.parts.value,H.parts.flagged>0&&i.jsxs("span",{className:"bw-log-flag",children:[" · ",H.parts.flagged," flagged"]})]})]}):i.jsx("span",{className:"bw-log-sys",children:H.text})]},`${H.atMs}-${H.level}-${H.text}`))})]})]})]}),l&&T&&i.jsxs("div",{className:"bw-settings",children:[i.jsxs("label",{title:"A program opening a page counts as a finding only if nobody had touched the browser for this long. Shorter catches more and reports more of your own work; longer is quieter.",children:[i.jsx("span",{children:"Nobody browsing for"}),i.jsxs("select",{value:N??l.settings.quietMinutes,onChange:H=>{_(Number(H.target.value)),L({quietMinutes:Number(H.target.value)})},children:[i.jsx("option",{value:1,children:"1 min"}),i.jsx("option",{value:5,children:"5 min"}),i.jsx("option",{value:15,children:"15 min"}),i.jsx("option",{value:30,children:"30 min"}),i.jsx("option",{value:60,children:"60 min"})]})]}),i.jsxs("label",{children:[i.jsx("span",{children:"When it finds one"}),i.jsx("select",{value:l.settings.reaction,onChange:H=>void L({reaction:H.target.value}),disabled:!l.settings.enabled,title:l.settings.enabled?"What to do besides writing it down.":"Turn watching on to arm a reaction.",children:(l.reactions??["notify"]).map(H=>i.jsx("option",{value:H,children:H==="notify"?"notify me":H==="close-tab"?"close the tab":"quit the browser"},H))})]}),i.jsxs("div",{className:"bw-settings-note",children:[i.jsxs("p",{children:["Chrome marks a navigation that came from an extension or a command rather than from a click. These are the ones that happened while nobody had touched the browser for the time above. ",i.jsx("strong",{children:"Usually that is your own agent doing what you asked."})]}),i.jsxs("button",{className:"bw-why",onClick:()=>D(H=>!H),"aria-expanded":A,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:A?"▾":"▸"})," What Browser Watch can access"]}),A&&i.jsxs("dl",{className:"bw-access",children:[i.jsx("dt",{children:"Reads"}),i.jsxs("dd",{children:["A copy of each browser's own history database — the live file is locked while the browser holds it. Only rows newer than the moment this deck started:"," ",new Date(l.coverage.startedMs).toLocaleString(),"."]}),i.jsx("dt",{children:"Keeps"}),i.jsxs("dd",{children:["Only while the switch is on, and only the episodes it flagged — never your ordinary browsing. In ",i.jsx("code",{className:"bw-path",children:l.coverage.logPath}),", with every address written in full so you can check it yourself."]}),i.jsx("dt",{children:"Sends"}),i.jsx("dd",{children:"Nothing. No part of this reads or writes over the network; the deck serves on 127.0.0.1 and this panel talks only to it."}),i.jsx("dt",{children:"Never reads"}),i.jsx("dd",{children:"Anything from before this deck started, cookies, saved passwords, page contents, or any browser profile with no history file."})]})]})]}),p&&i.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:i.jsxs("div",{className:"bw-row err",children:[i.jsx("span",{className:"bw-dot","aria-hidden":!0}),i.jsx("span",{className:"bw-row-label",children:"Could not save that setting"}),i.jsxs("span",{className:"bw-row-detail",children:[p," — the switches below show what is stored, not what you pressed."]}),i.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>f(null),"aria-label":"Dismiss",title:"Dismiss",children:"×"})]})}),l&&i.jsxs("footer",{className:"bw-status",children:[i.jsx("span",{className:`bw-mode-dot${l.settings.enabled?" on":""}`,"aria-hidden":!0}),i.jsx("span",{className:"bw-mode-word",children:s_(l,j).word},s_(l,j).kind),i.jsx("span",{className:"bw-status-text",children:l.coverage.archived===0?l.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${l.coverage.archived} ${l.coverage.archived===1?"episode":"episodes"} on disk`}),i.jsx("button",{className:`glyph-btn bw-gear${T?" on":""}`,onClick:()=>R(H=>!H),"aria-expanded":T,"aria-label":"Settings",title:"Settings",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[i.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),i.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),i.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[i.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),i.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":l.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"bw-toggle",onClick:()=>void L({enabled:!l.settings.enabled}),title:l.settings.enabled?"On — every episode it finds is written down, so the list outlives the browsing history being cleared":"Off — showing only what this deck has seen since it started. Anything an earlier run archived is hidden until you switch back on, and nothing new is kept",children:i.jsx("span",{className:"bw-toggle-knob"})})]})]})]})]})})}function T8({relay:e}){const[t,n]=x.useState(!1),[s,a]=x.useState(!1),l=e.killswitch.blocked?"unblock":"block",c=e.command[l],d=x.useCallback(async()=>{await Cx(c.command)&&(a(!0),window.setTimeout(()=>a(!1),1600))},[c.command]),h=e.profiles.filter(f=>{var m;return(m=f.report)==null?void 0:m.present}),p=e.profiles.filter(f=>f.report===null);return i.jsxs("section",{className:"bw-sec",children:[i.jsx("h4",{className:"bw-sec-head",children:"Remote control"}),i.jsx("p",{className:`bw-rc-verdict ${e.verdict}`,role:"status",children:e.verdict==="exposed"?"Claude in Chrome is live here, so any Claude Code session signed in to your Anthropic account can drive this browser — from any machine, with no prompt on this one.":e.verdict==="protected"?`The relay is black-holed in ${e.hostsPath}, so no new connection to it can be made from this machine.`:"Claude in Chrome is not installed and enabled in any profile here, so there is nothing for the relay to drive."}),e.killswitch.foreign.length>0&&i.jsxs("p",{className:"bw-rc-foreign",children:["Another entry for this host is already in ",e.hostsPath,", and ccdeck will not touch it:",e.killswitch.foreign.map(f=>i.jsx("code",{className:"bw-path",children:f},f))]}),i.jsxs("button",{className:"bw-why",onClick:()=>n(f=>!f),"aria-expanded":t,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:t?"▾":"▸"})," ",e.verdict==="protected"?"How to undo the block":"What it can reach, and how to stop it"]}),t&&i.jsxs("div",{className:"bw-rc-body",children:[h.length>0&&i.jsx("dl",{className:"bw-key",children:h.map(f=>i.jsxs(x.Fragment,{children:[i.jsxs("dt",{children:[f.name,f.profile==="Default"?"":` · ${f.profile}`]}),i.jsxs("dd",{children:[f.report.enabled?"enabled":"installed but switched off",f.report.allUrls?", can act on every site":", limited to the sites it was granted",f.report.sensitiveApis.length>0&&i.jsxs(i.Fragment,{children:[" — ",f.report.sensitiveApis.join(", ")]})]})]},`${f.browser}/${f.profile}`))}),p.length>0&&i.jsxs("p",{className:"bw-rc-note",children:[p.map(f=>f.name).join(", ")," — its settings file could not be read, so nothing is claimed about it either way."]}),!e.hostsRead&&i.jsxs("p",{className:"bw-rc-note",children:[e.hostsPath," could not be read, so whether the relay is already blocked is unknown."]}),h.some(f=>f.report.allUrls)&&i.jsxs("p",{className:"bw-rc-note",children:["Narrowing the sites in ",i.jsx("code",{className:"bw-path",children:"chrome://extensions"})," does not change this: the grant is held at the browser level and the per-site list is enforced inside the extension, by the extension."]}),i.jsxs("div",{className:"bw-rc-cmd",children:[i.jsx("code",{children:c.command}),i.jsx("button",{className:"btn bw-rc-copy",onClick:d,children:s?"Copied":"Copy"})]}),i.jsx("p",{className:"bw-rc-note",children:c.note})]})]})}function A8(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,l)=>(a.at??0)-(l.at??0));return{request:s[0],waiting:s.length-1}}function R8({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:l,onLater:c}){const d=x.useRef(null),h=Vt(c,{focusRef:d}),p=Ys(n,"accept"),f=Ys(n,"dismiss");return i.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:i.jsxs("div",{ref:h,className:"modal lan-ask",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("i",{className:"ap-pulse","aria-hidden":!0}),i.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:c,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsxs("p",{className:"lan-ask-who",children:[i.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",i.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",Ax(e.at,s)]}),i.jsx("p",{className:"modal-note",children:"Paired decks repair each other's expired logins. Accept only if you know this machine — what it shares is an account, not a screen."}),i.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",i.jsx("code",{className:"ap-lan-code",children:e.fp})," — that machine shows its own under This deck on the network; the two should match."]}),t>0&&i.jsx("p",{className:"lan-ask-more",children:t===1?"One more deck is waiting behind this one.":`${t} more decks are waiting behind this one.`}),i.jsxs("div",{className:"lan-ask-acts",children:[i.jsx("button",{type:"button",ref:d,className:"btn",disabled:f.disabled,"aria-busy":f.busy,onClick:l,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),i.jsx("button",{type:"button",className:"btn primary",disabled:p.disabled,"aria-busy":p.busy,onClick:a,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function $x(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 Wf,o_;function M8(){if(o_)return Wf;o_=1;function e(){this.__data__=[],this.size=0}return Wf=e,Wf}var Hf,i_;function vi(){if(i_)return Hf;i_=1;function e(t,n){return t===n||t!==t&&n!==n}return Hf=e,Hf}var Gf,l_;function Rd(){if(l_)return Gf;l_=1;var e=vi();function t(n,s){for(var a=n.length;a--;)if(e(n[a][0],s))return a;return-1}return Gf=t,Gf}var Vf,c_;function I8(){if(c_)return Vf;c_=1;var e=Rd(),t=Array.prototype,n=t.splice;function s(a){var l=this.__data__,c=e(l,a);if(c<0)return!1;var d=l.length-1;return c==d?l.pop():n.call(l,c,1),--this.size,!0}return Vf=s,Vf}var Yf,u_;function $8(){if(u_)return Yf;u_=1;var e=Rd();function t(n){var s=this.__data__,a=e(s,n);return a<0?void 0:s[a][1]}return Yf=t,Yf}var Kf,d_;function O8(){if(d_)return Kf;d_=1;var e=Rd();function t(n){return e(this.__data__,n)>-1}return Kf=t,Kf}var Xf,h_;function P8(){if(h_)return Xf;h_=1;var e=Rd();function t(n,s){var a=this.__data__,l=e(a,n);return l<0?(++this.size,a.push([n,s])):a[l][1]=s,this}return Xf=t,Xf}var Qf,f_;function Md(){if(f_)return Qf;f_=1;var e=M8(),t=I8(),n=$8(),s=O8(),a=P8();function l(c){var d=-1,h=c==null?0:c.length;for(this.clear();++d<h;){var p=c[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=s,l.prototype.set=a,Qf=l,Qf}var Zf,p_;function L8(){if(p_)return Zf;p_=1;var e=Md();function t(){this.__data__=new e,this.size=0}return Zf=t,Zf}var Jf,m_;function D8(){if(m_)return Jf;m_=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return Jf=e,Jf}var ep,g_;function q8(){if(g_)return ep;g_=1;function e(t){return this.__data__.get(t)}return ep=e,ep}var tp,y_;function F8(){if(y_)return tp;y_=1;function e(t){return this.__data__.has(t)}return tp=e,tp}var np,w_;function oA(){if(w_)return np;w_=1;var e=typeof vu=="object"&&vu&&vu.Object===Object&&vu;return np=e,np}var rp,v_;function wr(){if(v_)return rp;v_=1;var e=oA(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return rp=n,rp}var sp,x_;function xi(){if(x_)return sp;x_=1;var e=wr(),t=e.Symbol;return sp=t,sp}var ap,b_;function B8(){if(b_)return ap;b_=1;var e=xi(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function l(c){var d=n.call(c,a),h=c[a];try{c[a]=void 0;var p=!0}catch{}var f=s.call(c);return p&&(d?c[a]=h:delete c[a]),f}return ap=l,ap}var op,k_;function z8(){if(k_)return op;k_=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return op=n,op}var ip,__;function Qa(){if(__)return ip;__=1;var e=xi(),t=B8(),n=z8(),s="[object Null]",a="[object Undefined]",l=e?e.toStringTag:void 0;function c(d){return d==null?d===void 0?a:s:l&&l in Object(d)?t(d):n(d)}return ip=c,ip}var lp,N_;function Kn(){if(N_)return lp;N_=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return lp=e,lp}var cp,S_;function sc(){if(S_)return cp;S_=1;var e=Qa(),t=Kn(),n="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",l="[object Proxy]";function c(d){if(!t(d))return!1;var h=e(d);return h==s||h==a||h==n||h==l}return cp=c,cp}var up,j_;function U8(){if(j_)return up;j_=1;var e=wr(),t=e["__core-js_shared__"];return up=t,up}var dp,E_;function W8(){if(E_)return dp;E_=1;var e=U8(),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 dp=n,dp}var hp,C_;function iA(){if(C_)return hp;C_=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 hp=n,hp}var fp,T_;function H8(){if(T_)return fp;T_=1;var e=sc(),t=W8(),n=Kn(),s=iA(),a=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,c=Function.prototype,d=Object.prototype,h=c.toString,p=d.hasOwnProperty,f=RegExp("^"+h.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!n(y)||t(y))return!1;var v=e(y)?f:l;return v.test(s(y))}return fp=m,fp}var pp,A_;function G8(){if(A_)return pp;A_=1;function e(t,n){return t==null?void 0:t[n]}return pp=e,pp}var mp,R_;function Za(){if(R_)return mp;R_=1;var e=H8(),t=G8();function n(s,a){var l=t(s,a);return e(l)?l:void 0}return mp=n,mp}var gp,M_;function Ox(){if(M_)return gp;M_=1;var e=Za(),t=wr(),n=e(t,"Map");return gp=n,gp}var yp,I_;function Id(){if(I_)return yp;I_=1;var e=Za(),t=e(Object,"create");return yp=t,yp}var wp,$_;function V8(){if($_)return wp;$_=1;var e=Id();function t(){this.__data__=e?e(null):{},this.size=0}return wp=t,wp}var vp,O_;function Y8(){if(O_)return vp;O_=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 xp,P_;function K8(){if(P_)return xp;P_=1;var e=Id(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function a(l){var c=this.__data__;if(e){var d=c[l];return d===t?void 0:d}return s.call(c,l)?c[l]:void 0}return xp=a,xp}var bp,L_;function X8(){if(L_)return bp;L_=1;var e=Id(),t=Object.prototype,n=t.hasOwnProperty;function s(a){var l=this.__data__;return e?l[a]!==void 0:n.call(l,a)}return bp=s,bp}var kp,D_;function Q8(){if(D_)return kp;D_=1;var e=Id(),t="__lodash_hash_undefined__";function n(s,a){var l=this.__data__;return this.size+=this.has(s)?0:1,l[s]=e&&a===void 0?t:a,this}return kp=n,kp}var _p,q_;function Z8(){if(q_)return _p;q_=1;var e=V8(),t=Y8(),n=K8(),s=X8(),a=Q8();function l(c){var d=-1,h=c==null?0:c.length;for(this.clear();++d<h;){var p=c[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=s,l.prototype.set=a,_p=l,_p}var Np,F_;function J8(){if(F_)return Np;F_=1;var e=Z8(),t=Md(),n=Ox();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Np=s,Np}var Sp,B_;function eB(){if(B_)return Sp;B_=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Sp=e,Sp}var jp,z_;function $d(){if(z_)return jp;z_=1;var e=eB();function t(n,s){var a=n.__data__;return e(s)?a[typeof s=="string"?"string":"hash"]:a.map}return jp=t,jp}var Ep,U_;function tB(){if(U_)return Ep;U_=1;var e=$d();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return Ep=t,Ep}var Cp,W_;function nB(){if(W_)return Cp;W_=1;var e=$d();function t(n){return e(this,n).get(n)}return Cp=t,Cp}var Tp,H_;function rB(){if(H_)return Tp;H_=1;var e=$d();function t(n){return e(this,n).has(n)}return Tp=t,Tp}var Ap,G_;function sB(){if(G_)return Ap;G_=1;var e=$d();function t(n,s){var a=e(this,n),l=a.size;return a.set(n,s),this.size+=a.size==l?0:1,this}return Ap=t,Ap}var Rp,V_;function Px(){if(V_)return Rp;V_=1;var e=J8(),t=tB(),n=nB(),s=rB(),a=sB();function l(c){var d=-1,h=c==null?0:c.length;for(this.clear();++d<h;){var p=c[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=s,l.prototype.set=a,Rp=l,Rp}var Mp,Y_;function aB(){if(Y_)return Mp;Y_=1;var e=Md(),t=Ox(),n=Px(),s=200;function a(l,c){var d=this.__data__;if(d instanceof e){var h=d.__data__;if(!t||h.length<s-1)return h.push([l,c]),this.size=++d.size,this;d=this.__data__=new n(h)}return d.set(l,c),this.size=d.size,this}return Mp=a,Mp}var Ip,K_;function Od(){if(K_)return Ip;K_=1;var e=Md(),t=L8(),n=D8(),s=q8(),a=F8(),l=aB();function c(d){var h=this.__data__=new e(d);this.size=h.size}return c.prototype.clear=t,c.prototype.delete=n,c.prototype.get=s,c.prototype.has=a,c.prototype.set=l,Ip=c,Ip}var $p,X_;function Lx(){if(X_)return $p;X_=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 $p=e,$p}var Op,Q_;function lA(){if(Q_)return Op;Q_=1;var e=Za(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Op=t,Op}var Pp,Z_;function Pd(){if(Z_)return Pp;Z_=1;var e=lA();function t(n,s,a){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[s]=a}return Pp=t,Pp}var Lp,J_;function Ld(){if(J_)return Lp;J_=1;var e=Pd(),t=vi(),n=Object.prototype,s=n.hasOwnProperty;function a(l,c,d){var h=l[c];(!(s.call(l,c)&&t(h,d))||d===void 0&&!(c in l))&&e(l,c,d)}return Lp=a,Lp}var Dp,eN;function ac(){if(eN)return Dp;eN=1;var e=Ld(),t=Pd();function n(s,a,l,c){var d=!l;l||(l={});for(var h=-1,p=a.length;++h<p;){var f=a[h],m=c?c(l[f],s[f],f,l,s):void 0;m===void 0&&(m=s[f]),d?t(l,f,m):e(l,f,m)}return l}return Dp=n,Dp}var qp,tN;function oB(){if(tN)return qp;tN=1;function e(t,n){for(var s=-1,a=Array(t);++s<t;)a[s]=n(s);return a}return qp=e,qp}var Fp,nN;function qr(){if(nN)return Fp;nN=1;function e(t){return t!=null&&typeof t=="object"}return Fp=e,Fp}var Bp,rN;function iB(){if(rN)return Bp;rN=1;var e=Qa(),t=qr(),n="[object Arguments]";function s(a){return t(a)&&e(a)==n}return Bp=s,Bp}var zp,sN;function oc(){if(sN)return zp;sN=1;var e=iB(),t=qr(),n=Object.prototype,s=n.hasOwnProperty,a=n.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(c){return t(c)&&s.call(c,"callee")&&!a.call(c,"callee")};return zp=l,zp}var Up,aN;function $t(){if(aN)return Up;aN=1;var e=Array.isArray;return Up=e,Up}var Tl={exports:{}},Wp,oN;function lB(){if(oN)return Wp;oN=1;function e(){return!1}return Wp=e,Wp}Tl.exports;var iN;function bi(){return iN||(iN=1,(function(e,t){var n=wr(),s=lB(),a=t&&!t.nodeType&&t,l=a&&!0&&e&&!e.nodeType&&e,c=l&&l.exports===a,d=c?n.Buffer:void 0,h=d?d.isBuffer:void 0,p=h||s;e.exports=p})(Tl,Tl.exports)),Tl.exports}var Hp,lN;function Dd(){if(lN)return Hp;lN=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,a){var l=typeof s;return a=a??e,!!a&&(l=="number"||l!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<a}return Hp=n,Hp}var Gp,cN;function Dx(){if(cN)return Gp;cN=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Gp=t,Gp}var Vp,uN;function cB(){if(uN)return Vp;uN=1;var e=Qa(),t=Dx(),n=qr(),s="[object Arguments]",a="[object Array]",l="[object Boolean]",c="[object Date]",d="[object Error]",h="[object Function]",p="[object Map]",f="[object Number]",m="[object Object]",y="[object RegExp]",v="[object Set]",N="[object String]",_="[object WeakMap]",S="[object ArrayBuffer]",k="[object DataView]",j="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",T="[object Int16Array]",R="[object Int32Array]",A="[object Uint8Array]",D="[object Uint8ClampedArray]",O="[object Uint16Array]",$="[object Uint32Array]",F={};F[j]=F[E]=F[C]=F[T]=F[R]=F[A]=F[D]=F[O]=F[$]=!0,F[s]=F[a]=F[S]=F[l]=F[k]=F[c]=F[d]=F[h]=F[p]=F[f]=F[m]=F[y]=F[v]=F[N]=F[_]=!1;function Z(J){return n(J)&&t(J.length)&&!!F[e(J)]}return Vp=Z,Vp}var Yp,dN;function qd(){if(dN)return Yp;dN=1;function e(t){return function(n){return t(n)}}return Yp=e,Yp}var Al={exports:{}};Al.exports;var hN;function qx(){return hN||(hN=1,(function(e,t){var n=oA(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===s,c=l&&n.process,d=(function(){try{var h=a&&a.require&&a.require("util").types;return h||c&&c.binding&&c.binding("util")}catch{}})();e.exports=d})(Al,Al.exports)),Al.exports}var Kp,fN;function ic(){if(fN)return Kp;fN=1;var e=cB(),t=qd(),n=qx(),s=n&&n.isTypedArray,a=s?t(s):e;return Kp=a,Kp}var Xp,pN;function cA(){if(pN)return Xp;pN=1;var e=oB(),t=oc(),n=$t(),s=bi(),a=Dd(),l=ic(),c=Object.prototype,d=c.hasOwnProperty;function h(p,f){var m=n(p),y=!m&&t(p),v=!m&&!y&&s(p),N=!m&&!y&&!v&&l(p),_=m||y||v||N,S=_?e(p.length,String):[],k=S.length;for(var j in p)(f||d.call(p,j))&&!(_&&(j=="length"||v&&(j=="offset"||j=="parent")||N&&(j=="buffer"||j=="byteLength"||j=="byteOffset")||a(j,k)))&&S.push(j);return S}return Xp=h,Xp}var Qp,mN;function Fd(){if(mN)return Qp;mN=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,a=typeof s=="function"&&s.prototype||e;return n===a}return Qp=t,Qp}var Zp,gN;function uA(){if(gN)return Zp;gN=1;function e(t,n){return function(s){return t(n(s))}}return Zp=e,Zp}var Jp,yN;function uB(){if(yN)return Jp;yN=1;var e=uA(),t=e(Object.keys,Object);return Jp=t,Jp}var em,wN;function Fx(){if(wN)return em;wN=1;var e=Fd(),t=uB(),n=Object.prototype,s=n.hasOwnProperty;function a(l){if(!e(l))return t(l);var c=[];for(var d in Object(l))s.call(l,d)&&d!="constructor"&&c.push(d);return c}return em=a,em}var tm,vN;function ms(){if(vN)return tm;vN=1;var e=sc(),t=Dx();function n(s){return s!=null&&t(s.length)&&!e(s)}return tm=n,tm}var nm,xN;function Ks(){if(xN)return nm;xN=1;var e=cA(),t=Fx(),n=ms();function s(a){return n(a)?e(a):t(a)}return nm=s,nm}var rm,bN;function dB(){if(bN)return rm;bN=1;var e=ac(),t=Ks();function n(s,a){return s&&e(a,t(a),s)}return rm=n,rm}var sm,kN;function hB(){if(kN)return sm;kN=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return sm=e,sm}var am,_N;function fB(){if(_N)return am;_N=1;var e=Kn(),t=Fd(),n=hB(),s=Object.prototype,a=s.hasOwnProperty;function l(c){if(!e(c))return n(c);var d=t(c),h=[];for(var p in c)p=="constructor"&&(d||!a.call(c,p))||h.push(p);return h}return am=l,am}var om,NN;function Ja(){if(NN)return om;NN=1;var e=cA(),t=fB(),n=ms();function s(a){return n(a)?e(a,!0):t(a)}return om=s,om}var im,SN;function pB(){if(SN)return im;SN=1;var e=ac(),t=Ja();function n(s,a){return s&&e(a,t(a),s)}return im=n,im}var Rl={exports:{}};Rl.exports;var jN;function dA(){return jN||(jN=1,(function(e,t){var n=wr(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===s,c=l?n.Buffer:void 0,d=c?c.allocUnsafe:void 0;function h(p,f){if(f)return p.slice();var m=p.length,y=d?d(m):new p.constructor(m);return p.copy(y),y}e.exports=h})(Rl,Rl.exports)),Rl.exports}var lm,EN;function hA(){if(EN)return lm;EN=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 lm=e,lm}var cm,CN;function fA(){if(CN)return cm;CN=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,l=0,c=[];++s<a;){var d=t[s];n(d,s,t)&&(c[l++]=d)}return c}return cm=e,cm}var um,TN;function pA(){if(TN)return um;TN=1;function e(){return[]}return um=e,um}var dm,AN;function Bx(){if(AN)return dm;AN=1;var e=fA(),t=pA(),n=Object.prototype,s=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,l=a?function(c){return c==null?[]:(c=Object(c),e(a(c),function(d){return s.call(c,d)}))}:t;return dm=l,dm}var hm,RN;function mB(){if(RN)return hm;RN=1;var e=ac(),t=Bx();function n(s,a){return e(s,t(s),a)}return hm=n,hm}var fm,MN;function zx(){if(MN)return fm;MN=1;function e(t,n){for(var s=-1,a=n.length,l=t.length;++s<a;)t[l+s]=n[s];return t}return fm=e,fm}var pm,IN;function Bd(){if(IN)return pm;IN=1;var e=uA(),t=e(Object.getPrototypeOf,Object);return pm=t,pm}var mm,$N;function mA(){if($N)return mm;$N=1;var e=zx(),t=Bd(),n=Bx(),s=pA(),a=Object.getOwnPropertySymbols,l=a?function(c){for(var d=[];c;)e(d,n(c)),c=t(c);return d}:s;return mm=l,mm}var gm,ON;function gB(){if(ON)return gm;ON=1;var e=ac(),t=mA();function n(s,a){return e(s,t(s),a)}return gm=n,gm}var ym,PN;function gA(){if(PN)return ym;PN=1;var e=zx(),t=$t();function n(s,a,l){var c=a(s);return t(s)?c:e(c,l(s))}return ym=n,ym}var wm,LN;function yA(){if(LN)return wm;LN=1;var e=gA(),t=Bx(),n=Ks();function s(a){return e(a,n,t)}return wm=s,wm}var vm,DN;function yB(){if(DN)return vm;DN=1;var e=gA(),t=mA(),n=Ja();function s(a){return e(a,n,t)}return vm=s,vm}var xm,qN;function wB(){if(qN)return xm;qN=1;var e=Za(),t=wr(),n=e(t,"DataView");return xm=n,xm}var bm,FN;function vB(){if(FN)return bm;FN=1;var e=Za(),t=wr(),n=e(t,"Promise");return bm=n,bm}var km,BN;function wA(){if(BN)return km;BN=1;var e=Za(),t=wr(),n=e(t,"Set");return km=n,km}var _m,zN;function xB(){if(zN)return _m;zN=1;var e=Za(),t=wr(),n=e(t,"WeakMap");return _m=n,_m}var Nm,UN;function ki(){if(UN)return Nm;UN=1;var e=wB(),t=Ox(),n=vB(),s=wA(),a=xB(),l=Qa(),c=iA(),d="[object Map]",h="[object Object]",p="[object Promise]",f="[object Set]",m="[object WeakMap]",y="[object DataView]",v=c(e),N=c(t),_=c(n),S=c(s),k=c(a),j=l;return(e&&j(new e(new ArrayBuffer(1)))!=y||t&&j(new t)!=d||n&&j(n.resolve())!=p||s&&j(new s)!=f||a&&j(new a)!=m)&&(j=function(E){var C=l(E),T=C==h?E.constructor:void 0,R=T?c(T):"";if(R)switch(R){case v:return y;case N:return d;case _:return p;case S:return f;case k:return m}return C}),Nm=j,Nm}var Sm,WN;function bB(){if(WN)return Sm;WN=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var a=s.length,l=new s.constructor(a);return a&&typeof s[0]=="string"&&t.call(s,"index")&&(l.index=s.index,l.input=s.input),l}return Sm=n,Sm}var jm,HN;function vA(){if(HN)return jm;HN=1;var e=wr(),t=e.Uint8Array;return jm=t,jm}var Em,GN;function Ux(){if(GN)return Em;GN=1;var e=vA();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return Em=t,Em}var Cm,VN;function kB(){if(VN)return Cm;VN=1;var e=Ux();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return Cm=t,Cm}var Tm,YN;function _B(){if(YN)return Tm;YN=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return Tm=t,Tm}var Am,KN;function NB(){if(KN)return Am;KN=1;var e=xi(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(a){return n?Object(n.call(a)):{}}return Am=s,Am}var Rm,XN;function xA(){if(XN)return Rm;XN=1;var e=Ux();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return Rm=t,Rm}var Mm,QN;function SB(){if(QN)return Mm;QN=1;var e=Ux(),t=kB(),n=_B(),s=NB(),a=xA(),l="[object Boolean]",c="[object Date]",d="[object Map]",h="[object Number]",p="[object RegExp]",f="[object Set]",m="[object String]",y="[object Symbol]",v="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",S="[object Float64Array]",k="[object Int8Array]",j="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",A="[object Uint32Array]";function D(O,$,F){var Z=O.constructor;switch($){case v:return e(O);case l:case c:return new Z(+O);case N:return t(O,F);case _:case S:case k:case j:case E:case C:case T:case R:case A:return a(O,F);case d:return new Z;case h:case m:return new Z(O);case p:return n(O);case f:return new Z;case y:return s(O)}}return Mm=D,Mm}var Im,ZN;function bA(){if(ZN)return Im;ZN=1;var e=Kn(),t=Object.create,n=(function(){function s(){}return function(a){if(!e(a))return{};if(t)return t(a);s.prototype=a;var l=new s;return s.prototype=void 0,l}})();return Im=n,Im}var $m,JN;function kA(){if(JN)return $m;JN=1;var e=bA(),t=Bd(),n=Fd();function s(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return $m=s,$m}var Om,eS;function jB(){if(eS)return Om;eS=1;var e=ki(),t=qr(),n="[object Map]";function s(a){return t(a)&&e(a)==n}return Om=s,Om}var Pm,tS;function EB(){if(tS)return Pm;tS=1;var e=jB(),t=qd(),n=qx(),s=n&&n.isMap,a=s?t(s):e;return Pm=a,Pm}var Lm,nS;function CB(){if(nS)return Lm;nS=1;var e=ki(),t=qr(),n="[object Set]";function s(a){return t(a)&&e(a)==n}return Lm=s,Lm}var Dm,rS;function TB(){if(rS)return Dm;rS=1;var e=CB(),t=qd(),n=qx(),s=n&&n.isSet,a=s?t(s):e;return Dm=a,Dm}var qm,sS;function _A(){if(sS)return qm;sS=1;var e=Od(),t=Lx(),n=Ld(),s=dB(),a=pB(),l=dA(),c=hA(),d=mB(),h=gB(),p=yA(),f=yB(),m=ki(),y=bB(),v=SB(),N=kA(),_=$t(),S=bi(),k=EB(),j=Kn(),E=TB(),C=Ks(),T=Ja(),R=1,A=2,D=4,O="[object Arguments]",$="[object Array]",F="[object Boolean]",Z="[object Date]",J="[object Error]",I="[object Function]",X="[object GeneratorFunction]",G="[object Map]",q="[object Number]",Y="[object Object]",L="[object RegExp]",K="[object Set]",P="[object String]",V="[object Symbol]",he="[object WeakMap]",U="[object ArrayBuffer]",W="[object DataView]",ee="[object Float32Array]",H="[object Float64Array]",ae="[object Int8Array]",me="[object Int16Array]",ge="[object Int32Array]",Re="[object Uint8Array]",$e="[object Uint8ClampedArray]",ce="[object Uint16Array]",we="[object Uint32Array]",xe={};xe[O]=xe[$]=xe[U]=xe[W]=xe[F]=xe[Z]=xe[ee]=xe[H]=xe[ae]=xe[me]=xe[ge]=xe[G]=xe[q]=xe[Y]=xe[L]=xe[K]=xe[P]=xe[V]=xe[Re]=xe[$e]=xe[ce]=xe[we]=!0,xe[J]=xe[I]=xe[he]=!1;function De(_e,Ee,Ge,st,Je,Ze){var Qe,fe=Ee&R,ye=Ee&A,Se=Ee&D;if(Ge&&(Qe=Je?Ge(_e,st,Je,Ze):Ge(_e)),Qe!==void 0)return Qe;if(!j(_e))return _e;var Pe=_(_e);if(Pe){if(Qe=y(_e),!fe)return c(_e,Qe)}else{var et=m(_e),ft=et==I||et==X;if(S(_e))return l(_e,fe);if(et==Y||et==O||ft&&!Je){if(Qe=ye||ft?{}:N(_e),!fe)return ye?h(_e,a(Qe,_e)):d(_e,s(Qe,_e))}else{if(!xe[et])return Je?_e:{};Qe=v(_e,et,fe)}}Ze||(Ze=new e);var dt=Ze.get(_e);if(dt)return dt;Ze.set(_e,Qe),E(_e)?_e.forEach(function(re){Qe.add(De(re,Ee,Ge,re,_e,Ze))}):k(_e)&&_e.forEach(function(re,Fe){Qe.set(Fe,De(re,Ee,Ge,Fe,_e,Ze))});var ze=Se?ye?f:p:ye?T:C,Xe=Pe?void 0:ze(_e);return t(Xe||_e,function(re,Fe){Xe&&(Fe=re,re=_e[Fe]),n(Qe,Fe,De(re,Ee,Ge,Fe,_e,Ze))}),Qe}return qm=De,qm}var Fm,aS;function AB(){if(aS)return Fm;aS=1;var e=_A(),t=4;function n(s){return e(s,t)}return Fm=n,Fm}var Bm,oS;function Wx(){if(oS)return Bm;oS=1;function e(t){return function(){return t}}return Bm=e,Bm}var zm,iS;function RB(){if(iS)return zm;iS=1;function e(t){return function(n,s,a){for(var l=-1,c=Object(n),d=a(n),h=d.length;h--;){var p=d[t?h:++l];if(s(c[p],p,c)===!1)break}return n}}return zm=e,zm}var Um,lS;function Hx(){if(lS)return Um;lS=1;var e=RB(),t=e();return Um=t,Um}var Wm,cS;function Gx(){if(cS)return Wm;cS=1;var e=Hx(),t=Ks();function n(s,a){return s&&e(s,a,t)}return Wm=n,Wm}var Hm,uS;function MB(){if(uS)return Hm;uS=1;var e=ms();function t(n,s){return function(a,l){if(a==null)return a;if(!e(a))return n(a,l);for(var c=a.length,d=s?c:-1,h=Object(a);(s?d--:++d<c)&&l(h[d],d,h)!==!1;);return a}}return Hm=t,Hm}var Gm,dS;function zd(){if(dS)return Gm;dS=1;var e=Gx(),t=MB(),n=t(e);return Gm=n,Gm}var Vm,hS;function eo(){if(hS)return Vm;hS=1;function e(t){return t}return Vm=e,Vm}var Ym,fS;function NA(){if(fS)return Ym;fS=1;var e=eo();function t(n){return typeof n=="function"?n:e}return Ym=t,Ym}var Km,pS;function SA(){if(pS)return Km;pS=1;var e=Lx(),t=zd(),n=NA(),s=$t();function a(l,c){var d=s(l)?e:t;return d(l,n(c))}return Km=a,Km}var Xm,mS;function jA(){return mS||(mS=1,Xm=SA()),Xm}var Qm,gS;function IB(){if(gS)return Qm;gS=1;var e=zd();function t(n,s){var a=[];return e(n,function(l,c,d){s(l,c,d)&&a.push(l)}),a}return Qm=t,Qm}var Zm,yS;function $B(){if(yS)return Zm;yS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Zm=t,Zm}var Jm,wS;function OB(){if(wS)return Jm;wS=1;function e(t){return this.__data__.has(t)}return Jm=e,Jm}var eg,vS;function EA(){if(vS)return eg;vS=1;var e=Px(),t=$B(),n=OB();function s(a){var l=-1,c=a==null?0:a.length;for(this.__data__=new e;++l<c;)this.add(a[l])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,eg=s,eg}var tg,xS;function PB(){if(xS)return tg;xS=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 ng,bS;function CA(){if(bS)return ng;bS=1;function e(t,n){return t.has(n)}return ng=e,ng}var rg,kS;function TA(){if(kS)return rg;kS=1;var e=EA(),t=PB(),n=CA(),s=1,a=2;function l(c,d,h,p,f,m){var y=h&s,v=c.length,N=d.length;if(v!=N&&!(y&&N>v))return!1;var _=m.get(c),S=m.get(d);if(_&&S)return _==d&&S==c;var k=-1,j=!0,E=h&a?new e:void 0;for(m.set(c,d),m.set(d,c);++k<v;){var C=c[k],T=d[k];if(p)var R=y?p(T,C,k,d,c,m):p(C,T,k,c,d,m);if(R!==void 0){if(R)continue;j=!1;break}if(E){if(!t(d,function(A,D){if(!n(E,D)&&(C===A||f(C,A,h,p,m)))return E.push(D)})){j=!1;break}}else if(!(C===T||f(C,T,h,p,m))){j=!1;break}}return m.delete(c),m.delete(d),j}return rg=l,rg}var sg,_S;function LB(){if(_S)return sg;_S=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a,l){s[++n]=[l,a]}),s}return sg=e,sg}var ag,NS;function Vx(){if(NS)return ag;NS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a){s[++n]=a}),s}return ag=e,ag}var og,SS;function DB(){if(SS)return og;SS=1;var e=xi(),t=vA(),n=vi(),s=TA(),a=LB(),l=Vx(),c=1,d=2,h="[object Boolean]",p="[object Date]",f="[object Error]",m="[object Map]",y="[object Number]",v="[object RegExp]",N="[object Set]",_="[object String]",S="[object Symbol]",k="[object ArrayBuffer]",j="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function T(R,A,D,O,$,F,Z){switch(D){case j:if(R.byteLength!=A.byteLength||R.byteOffset!=A.byteOffset)return!1;R=R.buffer,A=A.buffer;case k:return!(R.byteLength!=A.byteLength||!F(new t(R),new t(A)));case h:case p:case y:return n(+R,+A);case f:return R.name==A.name&&R.message==A.message;case v:case _:return R==A+"";case m:var J=a;case N:var I=O&c;if(J||(J=l),R.size!=A.size&&!I)return!1;var X=Z.get(R);if(X)return X==A;O|=d,Z.set(R,A);var G=s(J(R),J(A),O,$,F,Z);return Z.delete(R),G;case S:if(C)return C.call(R)==C.call(A)}return!1}return og=T,og}var ig,jS;function qB(){if(jS)return ig;jS=1;var e=yA(),t=1,n=Object.prototype,s=n.hasOwnProperty;function a(l,c,d,h,p,f){var m=d&t,y=e(l),v=y.length,N=e(c),_=N.length;if(v!=_&&!m)return!1;for(var S=v;S--;){var k=y[S];if(!(m?k in c:s.call(c,k)))return!1}var j=f.get(l),E=f.get(c);if(j&&E)return j==c&&E==l;var C=!0;f.set(l,c),f.set(c,l);for(var T=m;++S<v;){k=y[S];var R=l[k],A=c[k];if(h)var D=m?h(A,R,k,c,l,f):h(R,A,k,l,c,f);if(!(D===void 0?R===A||p(R,A,d,h,f):D)){C=!1;break}T||(T=k=="constructor")}if(C&&!T){var O=l.constructor,$=c.constructor;O!=$&&"constructor"in l&&"constructor"in c&&!(typeof O=="function"&&O instanceof O&&typeof $=="function"&&$ instanceof $)&&(C=!1)}return f.delete(l),f.delete(c),C}return ig=a,ig}var lg,ES;function FB(){if(ES)return lg;ES=1;var e=Od(),t=TA(),n=DB(),s=qB(),a=ki(),l=$t(),c=bi(),d=ic(),h=1,p="[object Arguments]",f="[object Array]",m="[object Object]",y=Object.prototype,v=y.hasOwnProperty;function N(_,S,k,j,E,C){var T=l(_),R=l(S),A=T?f:a(_),D=R?f:a(S);A=A==p?m:A,D=D==p?m:D;var O=A==m,$=D==m,F=A==D;if(F&&c(_)){if(!c(S))return!1;T=!0,O=!1}if(F&&!O)return C||(C=new e),T||d(_)?t(_,S,k,j,E,C):n(_,S,A,k,j,E,C);if(!(k&h)){var Z=O&&v.call(_,"__wrapped__"),J=$&&v.call(S,"__wrapped__");if(Z||J){var I=Z?_.value():_,X=J?S.value():S;return C||(C=new e),E(I,X,k,j,C)}}return F?(C||(C=new e),s(_,S,k,j,E,C)):!1}return lg=N,lg}var cg,CS;function AA(){if(CS)return cg;CS=1;var e=FB(),t=qr();function n(s,a,l,c,d){return s===a?!0:s==null||a==null||!t(s)&&!t(a)?s!==s&&a!==a:e(s,a,l,c,n,d)}return cg=n,cg}var ug,TS;function BB(){if(TS)return ug;TS=1;var e=Od(),t=AA(),n=1,s=2;function a(l,c,d,h){var p=d.length,f=p,m=!h;if(l==null)return!f;for(l=Object(l);p--;){var y=d[p];if(m&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<f;){y=d[p];var v=y[0],N=l[v],_=y[1];if(m&&y[2]){if(N===void 0&&!(v in l))return!1}else{var S=new e;if(h)var k=h(N,_,v,l,c,S);if(!(k===void 0?t(_,N,n|s,h,S):k))return!1}}return!0}return ug=a,ug}var dg,AS;function RA(){if(AS)return dg;AS=1;var e=Kn();function t(n){return n===n&&!e(n)}return dg=t,dg}var hg,RS;function zB(){if(RS)return hg;RS=1;var e=RA(),t=Ks();function n(s){for(var a=t(s),l=a.length;l--;){var c=a[l],d=s[c];a[l]=[c,d,e(d)]}return a}return hg=n,hg}var fg,MS;function MA(){if(MS)return fg;MS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return fg=e,fg}var pg,IS;function UB(){if(IS)return pg;IS=1;var e=BB(),t=zB(),n=MA();function s(a){var l=t(a);return l.length==1&&l[0][2]?n(l[0][0],l[0][1]):function(c){return c===a||e(c,a,l)}}return pg=s,pg}var mg,$S;function _i(){if($S)return mg;$S=1;var e=Qa(),t=qr(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return mg=s,mg}var gg,OS;function Yx(){if(OS)return gg;OS=1;var e=$t(),t=_i(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(l,c){if(e(l))return!1;var d=typeof l;return d=="number"||d=="symbol"||d=="boolean"||l==null||t(l)?!0:s.test(l)||!n.test(l)||c!=null&&l in Object(c)}return gg=a,gg}var yg,PS;function WB(){if(PS)return yg;PS=1;var e=Px(),t="Expected a function";function n(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var l=function(){var c=arguments,d=a?a.apply(this,c):c[0],h=l.cache;if(h.has(d))return h.get(d);var p=s.apply(this,c);return l.cache=h.set(d,p)||h,p};return l.cache=new(n.Cache||e),l}return n.Cache=e,yg=n,yg}var wg,LS;function HB(){if(LS)return wg;LS=1;var e=WB(),t=500;function n(s){var a=e(s,function(c){return l.size===t&&l.clear(),c}),l=a.cache;return a}return wg=n,wg}var vg,DS;function GB(){if(DS)return vg;DS=1;var e=HB(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(a){var l=[];return a.charCodeAt(0)===46&&l.push(""),a.replace(t,function(c,d,h,p){l.push(h?p.replace(n,"$1"):d||c)}),l});return vg=s,vg}var xg,qS;function Ud(){if(qS)return xg;qS=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,l=Array(a);++s<a;)l[s]=n(t[s],s,t);return l}return xg=e,xg}var bg,FS;function VB(){if(FS)return bg;FS=1;var e=xi(),t=Ud(),n=$t(),s=_i(),a=e?e.prototype:void 0,l=a?a.toString:void 0;function c(d){if(typeof d=="string")return d;if(n(d))return t(d,c)+"";if(s(d))return l?l.call(d):"";var h=d+"";return h=="0"&&1/d==-1/0?"-0":h}return bg=c,bg}var kg,BS;function IA(){if(BS)return kg;BS=1;var e=VB();function t(n){return n==null?"":e(n)}return kg=t,kg}var _g,zS;function Wd(){if(zS)return _g;zS=1;var e=$t(),t=Yx(),n=GB(),s=IA();function a(l,c){return e(l)?l:t(l,c)?[l]:n(s(l))}return _g=a,_g}var Ng,US;function lc(){if(US)return Ng;US=1;var e=_i();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Ng=t,Ng}var Sg,WS;function Hd(){if(WS)return Sg;WS=1;var e=Wd(),t=lc();function n(s,a){a=e(a,s);for(var l=0,c=a.length;s!=null&&l<c;)s=s[t(a[l++])];return l&&l==c?s:void 0}return Sg=n,Sg}var jg,HS;function YB(){if(HS)return jg;HS=1;var e=Hd();function t(n,s,a){var l=n==null?void 0:e(n,s);return l===void 0?a:l}return jg=t,jg}var Eg,GS;function KB(){if(GS)return Eg;GS=1;function e(t,n){return t!=null&&n in Object(t)}return Eg=e,Eg}var Cg,VS;function $A(){if(VS)return Cg;VS=1;var e=Wd(),t=oc(),n=$t(),s=Dd(),a=Dx(),l=lc();function c(d,h,p){h=e(h,d);for(var f=-1,m=h.length,y=!1;++f<m;){var v=l(h[f]);if(!(y=d!=null&&p(d,v)))break;d=d[v]}return y||++f!=m?y:(m=d==null?0:d.length,!!m&&a(m)&&s(v,m)&&(n(d)||t(d)))}return Cg=c,Cg}var Tg,YS;function OA(){if(YS)return Tg;YS=1;var e=KB(),t=$A();function n(s,a){return s!=null&&t(s,a,e)}return Tg=n,Tg}var Ag,KS;function XB(){if(KS)return Ag;KS=1;var e=AA(),t=YB(),n=OA(),s=Yx(),a=RA(),l=MA(),c=lc(),d=1,h=2;function p(f,m){return s(f)&&a(m)?l(c(f),m):function(y){var v=t(y,f);return v===void 0&&v===m?n(y,f):e(m,v,d|h)}}return Ag=p,Ag}var Rg,XS;function PA(){if(XS)return Rg;XS=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Rg=e,Rg}var Mg,QS;function QB(){if(QS)return Mg;QS=1;var e=Hd();function t(n){return function(s){return e(s,n)}}return Mg=t,Mg}var Ig,ZS;function ZB(){if(ZS)return Ig;ZS=1;var e=PA(),t=QB(),n=Yx(),s=lc();function a(l){return n(l)?e(s(l)):t(l)}return Ig=a,Ig}var $g,JS;function gs(){if(JS)return $g;JS=1;var e=UB(),t=XB(),n=eo(),s=$t(),a=ZB();function l(c){return typeof c=="function"?c:c==null?n:typeof c=="object"?s(c)?t(c[0],c[1]):e(c):a(c)}return $g=l,$g}var Og,ej;function LA(){if(ej)return Og;ej=1;var e=fA(),t=IB(),n=gs(),s=$t();function a(l,c){var d=s(l)?e:t;return d(l,n(c,3))}return Og=a,Og}var Pg,tj;function JB(){if(tj)return Pg;tj=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,a){return s!=null&&t.call(s,a)}return Pg=n,Pg}var Lg,nj;function DA(){if(nj)return Lg;nj=1;var e=JB(),t=$A();function n(s,a){return s!=null&&t(s,a,e)}return Lg=n,Lg}var Dg,rj;function ez(){if(rj)return Dg;rj=1;var e=Fx(),t=ki(),n=oc(),s=$t(),a=ms(),l=bi(),c=Fd(),d=ic(),h="[object Map]",p="[object Set]",f=Object.prototype,m=f.hasOwnProperty;function y(v){if(v==null)return!0;if(a(v)&&(s(v)||typeof v=="string"||typeof v.splice=="function"||l(v)||d(v)||n(v)))return!v.length;var N=t(v);if(N==h||N==p)return!v.size;if(c(v))return!e(v).length;for(var _ in v)if(m.call(v,_))return!1;return!0}return Dg=y,Dg}var qg,sj;function qA(){if(sj)return qg;sj=1;function e(t){return t===void 0}return qg=e,qg}var Fg,aj;function FA(){if(aj)return Fg;aj=1;var e=zd(),t=ms();function n(s,a){var l=-1,c=t(s)?Array(s.length):[];return e(s,function(d,h,p){c[++l]=a(d,h,p)}),c}return Fg=n,Fg}var Bg,oj;function BA(){if(oj)return Bg;oj=1;var e=Ud(),t=gs(),n=FA(),s=$t();function a(l,c){var d=s(l)?e:n;return d(l,t(c,3))}return Bg=a,Bg}var zg,ij;function tz(){if(ij)return zg;ij=1;function e(t,n,s,a){var l=-1,c=t==null?0:t.length;for(a&&c&&(s=t[++l]);++l<c;)s=n(s,t[l],l,t);return s}return zg=e,zg}var Ug,lj;function nz(){if(lj)return Ug;lj=1;function e(t,n,s,a,l){return l(t,function(c,d,h){s=a?(a=!1,c):n(s,c,d,h)}),s}return Ug=e,Ug}var Wg,cj;function zA(){if(cj)return Wg;cj=1;var e=tz(),t=zd(),n=gs(),s=nz(),a=$t();function l(c,d,h){var p=a(c)?e:s,f=arguments.length<3;return p(c,n(d,4),h,f,t)}return Wg=l,Wg}var Hg,uj;function rz(){if(uj)return Hg;uj=1;var e=Qa(),t=$t(),n=qr(),s="[object String]";function a(l){return typeof l=="string"||!t(l)&&n(l)&&e(l)==s}return Hg=a,Hg}var Gg,dj;function sz(){if(dj)return Gg;dj=1;var e=PA(),t=e("length");return Gg=t,Gg}var Vg,hj;function az(){if(hj)return Vg;hj=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,l="\\ufe0e\\ufe0f",c="\\u200d",d=RegExp("["+c+e+a+l+"]");function h(p){return d.test(p)}return Vg=h,Vg}var Yg,fj;function oz(){if(fj)return Yg;fj=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,l="\\ufe0e\\ufe0f",c="["+e+"]",d="["+a+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+d+"|"+h+")",f="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",N=p+"?",_="["+l+"]?",S="(?:"+v+"(?:"+[f,m,y].join("|")+")"+_+N+")*",k=_+N+S,j="(?:"+[f+d+"?",d,m,y,c].join("|")+")",E=RegExp(h+"(?="+h+")|"+j+k,"g");function C(T){for(var R=E.lastIndex=0;E.test(T);)++R;return R}return Yg=C,Yg}var Kg,pj;function iz(){if(pj)return Kg;pj=1;var e=sz(),t=az(),n=oz();function s(a){return t(a)?n(a):e(a)}return Kg=s,Kg}var Xg,mj;function lz(){if(mj)return Xg;mj=1;var e=Fx(),t=ki(),n=ms(),s=rz(),a=iz(),l="[object Map]",c="[object Set]";function d(h){if(h==null)return 0;if(n(h))return s(h)?a(h):h.length;var p=t(h);return p==l||p==c?h.size:e(h).length}return Xg=d,Xg}var Qg,gj;function cz(){if(gj)return Qg;gj=1;var e=Lx(),t=bA(),n=Gx(),s=gs(),a=Bd(),l=$t(),c=bi(),d=sc(),h=Kn(),p=ic();function f(m,y,v){var N=l(m),_=N||c(m)||p(m);if(y=s(y,4),v==null){var S=m&&m.constructor;_?v=N?new S:[]:h(m)?v=d(S)?t(a(m)):{}:v={}}return(_?e:n)(m,function(k,j,E){return y(v,k,j,E)}),v}return Qg=f,Qg}var Zg,yj;function uz(){if(yj)return Zg;yj=1;var e=xi(),t=oc(),n=$t(),s=e?e.isConcatSpreadable:void 0;function a(l){return n(l)||t(l)||!!(s&&l&&l[s])}return Zg=a,Zg}var Jg,wj;function Kx(){if(wj)return Jg;wj=1;var e=zx(),t=uz();function n(s,a,l,c,d){var h=-1,p=s.length;for(l||(l=t),d||(d=[]);++h<p;){var f=s[h];a>0&&l(f)?a>1?n(f,a-1,l,c,d):e(d,f):c||(d[d.length]=f)}return d}return Jg=n,Jg}var ey,vj;function dz(){if(vj)return ey;vj=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 ey=e,ey}var ty,xj;function UA(){if(xj)return ty;xj=1;var e=dz(),t=Math.max;function n(s,a,l){return a=t(a===void 0?s.length-1:a,0),function(){for(var c=arguments,d=-1,h=t(c.length-a,0),p=Array(h);++d<h;)p[d]=c[a+d];d=-1;for(var f=Array(a+1);++d<a;)f[d]=c[d];return f[a]=l(p),e(s,this,f)}}return ty=n,ty}var ny,bj;function hz(){if(bj)return ny;bj=1;var e=Wx(),t=lA(),n=eo(),s=t?function(a,l){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:n;return ny=s,ny}var ry,kj;function fz(){if(kj)return ry;kj=1;var e=800,t=16,n=Date.now;function s(a){var l=0,c=0;return function(){var d=n(),h=t-(d-c);if(c=d,h>0){if(++l>=e)return arguments[0]}else l=0;return a.apply(void 0,arguments)}}return ry=s,ry}var sy,_j;function WA(){if(_j)return sy;_j=1;var e=hz(),t=fz(),n=t(e);return sy=n,sy}var ay,Nj;function Gd(){if(Nj)return ay;Nj=1;var e=eo(),t=UA(),n=WA();function s(a,l){return n(t(a,l,e),a+"")}return ay=s,ay}var oy,Sj;function HA(){if(Sj)return oy;Sj=1;function e(t,n,s,a){for(var l=t.length,c=s+(a?1:-1);a?c--:++c<l;)if(n(t[c],c,t))return c;return-1}return oy=e,oy}var iy,jj;function pz(){if(jj)return iy;jj=1;function e(t){return t!==t}return iy=e,iy}var ly,Ej;function mz(){if(Ej)return ly;Ej=1;function e(t,n,s){for(var a=s-1,l=t.length;++a<l;)if(t[a]===n)return a;return-1}return ly=e,ly}var cy,Cj;function gz(){if(Cj)return cy;Cj=1;var e=HA(),t=pz(),n=mz();function s(a,l,c){return l===l?n(a,l,c):e(a,t,c)}return cy=s,cy}var uy,Tj;function yz(){if(Tj)return uy;Tj=1;var e=gz();function t(n,s){var a=n==null?0:n.length;return!!a&&e(n,s,0)>-1}return uy=t,uy}var dy,Aj;function wz(){if(Aj)return dy;Aj=1;function e(t,n,s){for(var a=-1,l=t==null?0:t.length;++a<l;)if(s(n,t[a]))return!0;return!1}return dy=e,dy}var hy,Rj;function vz(){if(Rj)return hy;Rj=1;function e(){}return hy=e,hy}var fy,Mj;function xz(){if(Mj)return fy;Mj=1;var e=wA(),t=vz(),n=Vx(),s=1/0,a=e&&1/n(new e([,-0]))[1]==s?function(l){return new e(l)}:t;return fy=a,fy}var py,Ij;function bz(){if(Ij)return py;Ij=1;var e=EA(),t=yz(),n=wz(),s=CA(),a=xz(),l=Vx(),c=200;function d(h,p,f){var m=-1,y=t,v=h.length,N=!0,_=[],S=_;if(f)N=!1,y=n;else if(v>=c){var k=p?null:a(h);if(k)return l(k);N=!1,y=s,S=new e}else S=p?[]:_;e:for(;++m<v;){var j=h[m],E=p?p(j):j;if(j=f||j!==0?j:0,N&&E===E){for(var C=S.length;C--;)if(S[C]===E)continue e;p&&S.push(E),_.push(j)}else y(S,E,f)||(S!==_&&S.push(E),_.push(j))}return _}return py=d,py}var my,$j;function GA(){if($j)return my;$j=1;var e=ms(),t=qr();function n(s){return t(s)&&e(s)}return my=n,my}var gy,Oj;function kz(){if(Oj)return gy;Oj=1;var e=Kx(),t=Gd(),n=bz(),s=GA(),a=t(function(l){return n(e(l,1,s,!0))});return gy=a,gy}var yy,Pj;function _z(){if(Pj)return yy;Pj=1;var e=Ud();function t(n,s){return e(s,function(a){return n[a]})}return yy=t,yy}var wy,Lj;function VA(){if(Lj)return wy;Lj=1;var e=_z(),t=Ks();function n(s){return s==null?[]:e(s,t(s))}return wy=n,wy}var vy,Dj;function Xn(){if(Dj)return vy;Dj=1;var e;if(typeof $x=="function")try{e={clone:AB(),constant:Wx(),each:jA(),filter:LA(),has:DA(),isArray:$t(),isEmpty:ez(),isFunction:sc(),isUndefined:qA(),keys:Ks(),map:BA(),reduce:zA(),size:lz(),transform:cz(),union:kz(),values:VA()}}catch{}return e||(e=window._),vy=e,vy}var xy,qj;function Xx(){if(qj)return xy;qj=1;var e=Xn();xy=a;var t="\0",n="\0",s="";function a(f){this._isDirected=e.has(f,"directed")?f.directed:!0,this._isMultigraph=e.has(f,"multigraph")?f.multigraph:!1,this._isCompound=e.has(f,"compound")?f.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(f){return this._label=f,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultNodeLabelFn=f,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var f=this;return e.filter(this.nodes(),function(m){return e.isEmpty(f._in[m])})},a.prototype.sinks=function(){var f=this;return e.filter(this.nodes(),function(m){return e.isEmpty(f._out[m])})},a.prototype.setNodes=function(f,m){var y=arguments,v=this;return e.each(f,function(N){y.length>1?v.setNode(N,m):v.setNode(N)}),this},a.prototype.setNode=function(f,m){return e.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=m),this):(this._nodes[f]=arguments.length>1?m:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},a.prototype.node=function(f){return this._nodes[f]},a.prototype.hasNode=function(f){return e.has(this._nodes,f)},a.prototype.removeNode=function(f){var m=this;if(e.has(this._nodes,f)){var y=function(v){m.removeEdge(m._edgeObjs[v])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],e.each(this.children(f),function(v){m.setParent(v)}),delete this._children[f]),e.each(e.keys(this._in[f]),y),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),y),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},a.prototype.setParent=function(f,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===f)throw new Error("Setting "+m+" as parent of "+f+" would create a cycle");this.setNode(m)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=m,this._children[m][f]=!0,this},a.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},a.prototype.parent=function(f){if(this._isCompound){var m=this._parent[f];if(m!==n)return m}},a.prototype.children=function(f){if(e.isUndefined(f)&&(f=n),this._isCompound){var m=this._children[f];if(m)return e.keys(m)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},a.prototype.predecessors=function(f){var m=this._preds[f];if(m)return e.keys(m)},a.prototype.successors=function(f){var m=this._sucs[f];if(m)return e.keys(m)},a.prototype.neighbors=function(f){var m=this.predecessors(f);if(m)return e.union(m,this.successors(f))},a.prototype.isLeaf=function(f){var m;return this.isDirected()?m=this.successors(f):m=this.neighbors(f),m.length===0},a.prototype.filterNodes=function(f){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(_,S){f(S)&&m.setNode(S,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var v={};function N(_){var S=y.parent(_);return S===void 0||m.hasNode(S)?(v[_]=S,S):S in v?v[S]:N(S)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,N(_))}),m},a.prototype.setDefaultEdgeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultEdgeLabelFn=f,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(f,m){var y=this,v=arguments;return e.reduce(f,function(N,_){return v.length>1?y.setEdge(N,_,m):y.setEdge(N,_),_}),this},a.prototype.setEdge=function(){var f,m,y,v,N=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(f=_.v,m=_.w,y=_.name,arguments.length===2&&(v=arguments[1],N=!0)):(f=_,m=arguments[1],y=arguments[3],arguments.length>2&&(v=arguments[2],N=!0)),f=""+f,m=""+m,e.isUndefined(y)||(y=""+y);var S=d(this._isDirected,f,m,y);if(e.has(this._edgeLabels,S))return N&&(this._edgeLabels[S]=v),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(m),this._edgeLabels[S]=N?v:this._defaultEdgeLabelFn(f,m,y);var k=h(this._isDirected,f,m,y);return f=k.v,m=k.w,Object.freeze(k),this._edgeObjs[S]=k,l(this._preds[m],f),l(this._sucs[f],m),this._in[m][S]=k,this._out[f][S]=k,this._edgeCount++,this},a.prototype.edge=function(f,m,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,f,m,y);return this._edgeLabels[v]},a.prototype.hasEdge=function(f,m,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,f,m,y);return e.has(this._edgeLabels,v)},a.prototype.removeEdge=function(f,m,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,f,m,y),N=this._edgeObjs[v];return N&&(f=N.v,m=N.w,delete this._edgeLabels[v],delete this._edgeObjs[v],c(this._preds[m],f),c(this._sucs[f],m),delete this._in[m][v],delete this._out[f][v],this._edgeCount--),this},a.prototype.inEdges=function(f,m){var y=this._in[f];if(y){var v=e.values(y);return m?e.filter(v,function(N){return N.v===m}):v}},a.prototype.outEdges=function(f,m){var y=this._out[f];if(y){var v=e.values(y);return m?e.filter(v,function(N){return N.w===m}):v}},a.prototype.nodeEdges=function(f,m){var y=this.inEdges(f,m);if(y)return y.concat(this.outEdges(f,m))};function l(f,m){f[m]?f[m]++:f[m]=1}function c(f,m){--f[m]||delete f[m]}function d(f,m,y,v){var N=""+m,_=""+y;if(!f&&N>_){var S=N;N=_,_=S}return N+s+_+s+(e.isUndefined(v)?t:v)}function h(f,m,y,v){var N=""+m,_=""+y;if(!f&&N>_){var S=N;N=_,_=S}var k={v:N,w:_};return v&&(k.name=v),k}function p(f,m){return d(f,m.v,m.w,m.name)}return xy}var by,Fj;function Nz(){return Fj||(Fj=1,by="2.1.8"),by}var ky,Bj;function Sz(){return Bj||(Bj=1,ky={Graph:Xx(),version:Nz()}),ky}var _y,zj;function jz(){if(zj)return _y;zj=1;var e=Xn(),t=Xx();_y={write:n,read:l};function n(c){var d={options:{directed:c.isDirected(),multigraph:c.isMultigraph(),compound:c.isCompound()},nodes:s(c),edges:a(c)};return e.isUndefined(c.graph())||(d.value=e.clone(c.graph())),d}function s(c){return e.map(c.nodes(),function(d){var h=c.node(d),p=c.parent(d),f={v:d};return e.isUndefined(h)||(f.value=h),e.isUndefined(p)||(f.parent=p),f})}function a(c){return e.map(c.edges(),function(d){var h=c.edge(d),p={v:d.v,w:d.w};return e.isUndefined(d.name)||(p.name=d.name),e.isUndefined(h)||(p.value=h),p})}function l(c){var d=new t(c.options).setGraph(c.value);return e.each(c.nodes,function(h){d.setNode(h.v,h.value),h.parent&&d.setParent(h.v,h.parent)}),e.each(c.edges,function(h){d.setEdge({v:h.v,w:h.w,name:h.name},h.value)}),d}return _y}var Ny,Uj;function Ez(){if(Uj)return Ny;Uj=1;var e=Xn();Ny=t;function t(n){var s={},a=[],l;function c(d){e.has(s,d)||(s[d]=!0,l.push(d),e.each(n.successors(d),c),e.each(n.predecessors(d),c))}return e.each(n.nodes(),function(d){l=[],c(d),l.length&&a.push(l)}),a}return Ny}var Sy,Wj;function YA(){if(Wj)return Sy;Wj=1;var e=Xn();Sy=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 l=this._arr,c=l.length;return a[n]=c,l.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,l=a+1,c=n;a<s.length&&(c=s[a].priority<s[c].priority?a:c,l<s.length&&(c=s[l].priority<s[c].priority?l:c),c!==n&&(this._swap(n,c),this._heapify(c)))},t.prototype._decrease=function(n){for(var s=this._arr,a=s[n].priority,l;n!==0&&(l=n>>1,!(s[l].priority<a));)this._swap(n,l),n=l},t.prototype._swap=function(n,s){var a=this._arr,l=this._keyIndices,c=a[n],d=a[s];a[n]=d,a[s]=c,l[d.key]=n,l[c.key]=s},Sy}var jy,Hj;function KA(){if(Hj)return jy;Hj=1;var e=Xn(),t=YA();jy=s;var n=e.constant(1);function s(l,c,d,h){return a(l,String(c),d||n,h||function(p){return l.outEdges(p)})}function a(l,c,d,h){var p={},f=new t,m,y,v=function(N){var _=N.v!==m?N.v:N.w,S=p[_],k=d(N),j=y.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+k);j<S.distance&&(S.distance=j,S.predecessor=m,f.decrease(_,j))};for(l.nodes().forEach(function(N){var _=N===c?0:Number.POSITIVE_INFINITY;p[N]={distance:_},f.add(N,_)});f.size()>0&&(m=f.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)h(m).forEach(v);return p}return jy}var Ey,Gj;function Cz(){if(Gj)return Ey;Gj=1;var e=KA(),t=Xn();Ey=n;function n(s,a,l){return t.transform(s.nodes(),function(c,d){c[d]=e(s,d,a,l)},{})}return Ey}var Cy,Vj;function XA(){if(Vj)return Cy;Vj=1;var e=Xn();Cy=t;function t(n){var s=0,a=[],l={},c=[];function d(h){var p=l[h]={onStack:!0,lowlink:s,index:s++};if(a.push(h),n.successors(h).forEach(function(y){e.has(l,y)?l[y].onStack&&(p.lowlink=Math.min(p.lowlink,l[y].index)):(d(y),p.lowlink=Math.min(p.lowlink,l[y].lowlink))}),p.lowlink===p.index){var f=[],m;do m=a.pop(),l[m].onStack=!1,f.push(m);while(h!==m);c.push(f)}}return n.nodes().forEach(function(h){e.has(l,h)||d(h)}),c}return Cy}var Ty,Yj;function Tz(){if(Yj)return Ty;Yj=1;var e=Xn(),t=XA();Ty=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 Ty}var Ay,Kj;function Az(){if(Kj)return Ay;Kj=1;var e=Xn();Ay=n;var t=e.constant(1);function n(a,l,c){return s(a,l||t,c||function(d){return a.outEdges(d)})}function s(a,l,c){var d={},h=a.nodes();return h.forEach(function(p){d[p]={},d[p][p]={distance:0},h.forEach(function(f){p!==f&&(d[p][f]={distance:Number.POSITIVE_INFINITY})}),c(p).forEach(function(f){var m=f.v===p?f.w:f.v,y=l(f);d[p][m]={distance:y,predecessor:p}})}),h.forEach(function(p){var f=d[p];h.forEach(function(m){var y=d[m];h.forEach(function(v){var N=y[p],_=f[v],S=y[v],k=N.distance+_.distance;k<S.distance&&(S.distance=k,S.predecessor=_.predecessor)})})}),d}return Ay}var Ry,Xj;function QA(){if(Xj)return Ry;Xj=1;var e=Xn();Ry=t,t.CycleException=n;function t(s){var a={},l={},c=[];function d(h){if(e.has(l,h))throw new n;e.has(a,h)||(l[h]=!0,a[h]=!0,e.each(s.predecessors(h),d),delete l[h],c.push(h))}if(e.each(s.sinks(),d),e.size(a)!==s.nodeCount())throw new n;return c}function n(){}return n.prototype=new Error,Ry}var My,Qj;function Rz(){if(Qj)return My;Qj=1;var e=QA();My=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return My}var Iy,Zj;function ZA(){if(Zj)return Iy;Zj=1;var e=Xn();Iy=t;function t(s,a,l){e.isArray(a)||(a=[a]);var c=(s.isDirected()?s.successors:s.neighbors).bind(s),d=[],h={};return e.each(a,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,l==="post",h,c,d)}),d}function n(s,a,l,c,d,h){e.has(c,a)||(c[a]=!0,l||h.push(a),e.each(d(a),function(p){n(s,p,l,c,d,h)}),l&&h.push(a))}return Iy}var $y,Jj;function Mz(){if(Jj)return $y;Jj=1;var e=ZA();$y=t;function t(n,s){return e(n,s,"post")}return $y}var Oy,eE;function Iz(){if(eE)return Oy;eE=1;var e=ZA();Oy=t;function t(n,s){return e(n,s,"pre")}return Oy}var Py,tE;function $z(){if(tE)return Py;tE=1;var e=Xn(),t=Xx(),n=YA();Py=s;function s(a,l){var c=new t,d={},h=new n,p;function f(y){var v=y.v===p?y.w:y.v,N=h.priority(v);if(N!==void 0){var _=l(y);_<N&&(d[v]=p,h.decrease(v,_))}}if(a.nodeCount()===0)return c;e.each(a.nodes(),function(y){h.add(y,Number.POSITIVE_INFINITY),c.setNode(y)}),h.decrease(a.nodes()[0],0);for(var m=!1;h.size()>0;){if(p=h.removeMin(),e.has(d,p))c.setEdge(p,d[p]);else{if(m)throw new Error("Input graph is not connected: "+a);m=!0}a.nodeEdges(p).forEach(f)}return c}return Py}var Ly,nE;function Oz(){return nE||(nE=1,Ly={components:Ez(),dijkstra:KA(),dijkstraAll:Cz(),findCycles:Tz(),floydWarshall:Az(),isAcyclic:Rz(),postorder:Mz(),preorder:Iz(),prim:$z(),tarjan:XA(),topsort:QA()}),Ly}var Dy,rE;function Pz(){if(rE)return Dy;rE=1;var e=Sz();return Dy={Graph:e.Graph,json:jz(),alg:Oz(),version:e.version},Dy}var qy,sE;function gr(){if(sE)return qy;sE=1;var e;if(typeof $x=="function")try{e=Pz()}catch{}return e||(e=window.graphlib),qy=e,qy}var Fy,aE;function Lz(){if(aE)return Fy;aE=1;var e=_A(),t=1,n=4;function s(a){return e(a,t|n)}return Fy=s,Fy}var By,oE;function Vd(){if(oE)return By;oE=1;var e=vi(),t=ms(),n=Dd(),s=Kn();function a(l,c,d){if(!s(d))return!1;var h=typeof c;return(h=="number"?t(d)&&n(c,d.length):h=="string"&&c in d)?e(d[c],l):!1}return By=a,By}var zy,iE;function Dz(){if(iE)return zy;iE=1;var e=Gd(),t=vi(),n=Vd(),s=Ja(),a=Object.prototype,l=a.hasOwnProperty,c=e(function(d,h){d=Object(d);var p=-1,f=h.length,m=f>2?h[2]:void 0;for(m&&n(h[0],h[1],m)&&(f=1);++p<f;)for(var y=h[p],v=s(y),N=-1,_=v.length;++N<_;){var S=v[N],k=d[S];(k===void 0||t(k,a[S])&&!l.call(d,S))&&(d[S]=y[S])}return d});return zy=c,zy}var Uy,lE;function qz(){if(lE)return Uy;lE=1;var e=gs(),t=ms(),n=Ks();function s(a){return function(l,c,d){var h=Object(l);if(!t(l)){var p=e(c,3);l=n(l),c=function(m){return p(h[m],m,h)}}var f=a(l,c,d);return f>-1?h[p?l[f]:f]:void 0}}return Uy=s,Uy}var Wy,cE;function Fz(){if(cE)return Wy;cE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return Wy=t,Wy}var Hy,uE;function Bz(){if(uE)return Hy;uE=1;var e=Fz(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return Hy=n,Hy}var Gy,dE;function zz(){if(dE)return Gy;dE=1;var e=Bz(),t=Kn(),n=_i(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,d=parseInt;function h(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var f=typeof p.valueOf=="function"?p.valueOf():p;p=t(f)?f+"":f}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=l.test(p);return m||c.test(p)?d(p.slice(2),m?2:8):a.test(p)?s:+p}return Gy=h,Gy}var Vy,hE;function JA(){if(hE)return Vy;hE=1;var e=zz(),t=1/0,n=17976931348623157e292;function s(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var l=a<0?-1:1;return l*n}return a===a?a:0}return Vy=s,Vy}var Yy,fE;function Uz(){if(fE)return Yy;fE=1;var e=JA();function t(n){var s=e(n),a=s%1;return s===s?a?s-a:s:0}return Yy=t,Yy}var Ky,pE;function Wz(){if(pE)return Ky;pE=1;var e=HA(),t=gs(),n=Uz(),s=Math.max;function a(l,c,d){var h=l==null?0:l.length;if(!h)return-1;var p=d==null?0:n(d);return p<0&&(p=s(h+p,0)),e(l,t(c,3),p)}return Ky=a,Ky}var Xy,mE;function Hz(){if(mE)return Xy;mE=1;var e=qz(),t=Wz(),n=e(t);return Xy=n,Xy}var Qy,gE;function eR(){if(gE)return Qy;gE=1;var e=Kx();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return Qy=t,Qy}var Zy,yE;function Gz(){if(yE)return Zy;yE=1;var e=Hx(),t=NA(),n=Ja();function s(a,l){return a==null?a:e(a,t(l),n)}return Zy=s,Zy}var Jy,wE;function Vz(){if(wE)return Jy;wE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Jy=e,Jy}var ew,vE;function Yz(){if(vE)return ew;vE=1;var e=Pd(),t=Gx(),n=gs();function s(a,l){var c={};return l=n(l,3),t(a,function(d,h,p){e(c,h,l(d,h,p))}),c}return ew=s,ew}var tw,xE;function Qx(){if(xE)return tw;xE=1;var e=_i();function t(n,s,a){for(var l=-1,c=n.length;++l<c;){var d=n[l],h=s(d);if(h!=null&&(p===void 0?h===h&&!e(h):a(h,p)))var p=h,f=d}return f}return tw=t,tw}var nw,bE;function Kz(){if(bE)return nw;bE=1;function e(t,n){return t>n}return nw=e,nw}var rw,kE;function Xz(){if(kE)return rw;kE=1;var e=Qx(),t=Kz(),n=eo();function s(a){return a&&a.length?e(a,n,t):void 0}return rw=s,rw}var sw,_E;function tR(){if(_E)return sw;_E=1;var e=Pd(),t=vi();function n(s,a,l){(l!==void 0&&!t(s[a],l)||l===void 0&&!(a in s))&&e(s,a,l)}return sw=n,sw}var aw,NE;function Qz(){if(NE)return aw;NE=1;var e=Qa(),t=Bd(),n=qr(),s="[object Object]",a=Function.prototype,l=Object.prototype,c=a.toString,d=l.hasOwnProperty,h=c.call(Object);function p(f){if(!n(f)||e(f)!=s)return!1;var m=t(f);if(m===null)return!0;var y=d.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&c.call(y)==h}return aw=p,aw}var ow,SE;function nR(){if(SE)return ow;SE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return ow=e,ow}var iw,jE;function Zz(){if(jE)return iw;jE=1;var e=ac(),t=Ja();function n(s){return e(s,t(s))}return iw=n,iw}var lw,EE;function Jz(){if(EE)return lw;EE=1;var e=tR(),t=dA(),n=xA(),s=hA(),a=kA(),l=oc(),c=$t(),d=GA(),h=bi(),p=sc(),f=Kn(),m=Qz(),y=ic(),v=nR(),N=Zz();function _(S,k,j,E,C,T,R){var A=v(S,j),D=v(k,j),O=R.get(D);if(O){e(S,j,O);return}var $=T?T(A,D,j+"",S,k,R):void 0,F=$===void 0;if(F){var Z=c(D),J=!Z&&h(D),I=!Z&&!J&&y(D);$=D,Z||J||I?c(A)?$=A:d(A)?$=s(A):J?(F=!1,$=t(D,!0)):I?(F=!1,$=n(D,!0)):$=[]:m(D)||l(D)?($=A,l(A)?$=N(A):(!f(A)||p(A))&&($=a(D))):F=!1}F&&(R.set(D,$),C($,D,E,T,R),R.delete(D)),e(S,j,$)}return lw=_,lw}var cw,CE;function eU(){if(CE)return cw;CE=1;var e=Od(),t=tR(),n=Hx(),s=Jz(),a=Kn(),l=Ja(),c=nR();function d(h,p,f,m,y){h!==p&&n(p,function(v,N){if(y||(y=new e),a(v))s(h,p,N,f,d,m,y);else{var _=m?m(c(h,N),v,N+"",h,p,y):void 0;_===void 0&&(_=v),t(h,N,_)}},l)}return cw=d,cw}var uw,TE;function tU(){if(TE)return uw;TE=1;var e=Gd(),t=Vd();function n(s){return e(function(a,l){var c=-1,d=l.length,h=d>1?l[d-1]:void 0,p=d>2?l[2]:void 0;for(h=s.length>3&&typeof h=="function"?(d--,h):void 0,p&&t(l[0],l[1],p)&&(h=d<3?void 0:h,d=1),a=Object(a);++c<d;){var f=l[c];f&&s(a,f,c,h)}return a})}return uw=n,uw}var dw,AE;function nU(){if(AE)return dw;AE=1;var e=eU(),t=tU(),n=t(function(s,a,l){e(s,a,l)});return dw=n,dw}var hw,RE;function rR(){if(RE)return hw;RE=1;function e(t,n){return t<n}return hw=e,hw}var fw,ME;function rU(){if(ME)return fw;ME=1;var e=Qx(),t=rR(),n=eo();function s(a){return a&&a.length?e(a,n,t):void 0}return fw=s,fw}var pw,IE;function sU(){if(IE)return pw;IE=1;var e=Qx(),t=gs(),n=rR();function s(a,l){return a&&a.length?e(a,t(l,2),n):void 0}return pw=s,pw}var mw,$E;function aU(){if($E)return mw;$E=1;var e=wr(),t=function(){return e.Date.now()};return mw=t,mw}var gw,OE;function oU(){if(OE)return gw;OE=1;var e=Ld(),t=Wd(),n=Dd(),s=Kn(),a=lc();function l(c,d,h,p){if(!s(c))return c;d=t(d,c);for(var f=-1,m=d.length,y=m-1,v=c;v!=null&&++f<m;){var N=a(d[f]),_=h;if(N==="__proto__"||N==="constructor"||N==="prototype")return c;if(f!=y){var S=v[N];_=p?p(S,N,v):void 0,_===void 0&&(_=s(S)?S:n(d[f+1])?[]:{})}e(v,N,_),v=v[N]}return c}return gw=l,gw}var yw,PE;function iU(){if(PE)return yw;PE=1;var e=Hd(),t=oU(),n=Wd();function s(a,l,c){for(var d=-1,h=l.length,p={};++d<h;){var f=l[d],m=e(a,f);c(m,f)&&t(p,n(f,a),m)}return p}return yw=s,yw}var ww,LE;function lU(){if(LE)return ww;LE=1;var e=iU(),t=OA();function n(s,a){return e(s,a,function(l,c){return t(s,c)})}return ww=n,ww}var vw,DE;function cU(){if(DE)return vw;DE=1;var e=eR(),t=UA(),n=WA();function s(a){return n(t(a,void 0,e),a+"")}return vw=s,vw}var xw,qE;function uU(){if(qE)return xw;qE=1;var e=lU(),t=cU(),n=t(function(s,a){return s==null?{}:e(s,a)});return xw=n,xw}var bw,FE;function dU(){if(FE)return bw;FE=1;var e=Math.ceil,t=Math.max;function n(s,a,l,c){for(var d=-1,h=t(e((a-s)/(l||1)),0),p=Array(h);h--;)p[c?h:++d]=s,s+=l;return p}return bw=n,bw}var kw,BE;function hU(){if(BE)return kw;BE=1;var e=dU(),t=Vd(),n=JA();function s(a){return function(l,c,d){return d&&typeof d!="number"&&t(l,c,d)&&(c=d=void 0),l=n(l),c===void 0?(c=l,l=0):c=n(c),d=d===void 0?l<c?1:-1:n(d),e(l,c,d,a)}}return kw=s,kw}var _w,zE;function fU(){if(zE)return _w;zE=1;var e=hU(),t=e();return _w=t,_w}var Nw,UE;function pU(){if(UE)return Nw;UE=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Nw=e,Nw}var Sw,WE;function mU(){if(WE)return Sw;WE=1;var e=_i();function t(n,s){if(n!==s){var a=n!==void 0,l=n===null,c=n===n,d=e(n),h=s!==void 0,p=s===null,f=s===s,m=e(s);if(!p&&!m&&!d&&n>s||d&&h&&f&&!p&&!m||l&&h&&f||!a&&f||!c)return 1;if(!l&&!d&&!m&&n<s||m&&a&&c&&!l&&!d||p&&a&&c||!h&&c||!f)return-1}return 0}return Sw=t,Sw}var jw,HE;function gU(){if(HE)return jw;HE=1;var e=mU();function t(n,s,a){for(var l=-1,c=n.criteria,d=s.criteria,h=c.length,p=a.length;++l<h;){var f=e(c[l],d[l]);if(f){if(l>=p)return f;var m=a[l];return f*(m=="desc"?-1:1)}}return n.index-s.index}return jw=t,jw}var Ew,GE;function yU(){if(GE)return Ew;GE=1;var e=Ud(),t=Hd(),n=gs(),s=FA(),a=pU(),l=qd(),c=gU(),d=eo(),h=$t();function p(f,m,y){m.length?m=e(m,function(_){return h(_)?function(S){return t(S,_.length===1?_[0]:_)}:_}):m=[d];var v=-1;m=e(m,l(n));var N=s(f,function(_,S,k){var j=e(m,function(E){return E(_)});return{criteria:j,index:++v,value:_}});return a(N,function(_,S){return c(_,S,y)})}return Ew=p,Ew}var Cw,VE;function wU(){if(VE)return Cw;VE=1;var e=Kx(),t=yU(),n=Gd(),s=Vd(),a=n(function(l,c){if(l==null)return[];var d=c.length;return d>1&&s(l,c[0],c[1])?c=[]:d>2&&s(c[0],c[1],c[2])&&(c=[c[0]]),t(l,e(c,1),[])});return Cw=a,Cw}var Tw,YE;function vU(){if(YE)return Tw;YE=1;var e=IA(),t=0;function n(s){var a=++t;return e(s)+a}return Tw=n,Tw}var Aw,KE;function xU(){if(KE)return Aw;KE=1;function e(t,n,s){for(var a=-1,l=t.length,c=n.length,d={};++a<l;){var h=a<c?n[a]:void 0;s(d,t[a],h)}return d}return Aw=e,Aw}var Rw,XE;function bU(){if(XE)return Rw;XE=1;var e=Ld(),t=xU();function n(s,a){return t(s||[],a||[],e)}return Rw=n,Rw}var Mw,QE;function kt(){if(QE)return Mw;QE=1;var e;if(typeof $x=="function")try{e={cloneDeep:Lz(),constant:Wx(),defaults:Dz(),each:jA(),filter:LA(),find:Hz(),flatten:eR(),forEach:SA(),forIn:Gz(),has:DA(),isUndefined:qA(),last:Vz(),map:BA(),mapValues:Yz(),max:Xz(),merge:nU(),min:rU(),minBy:sU(),now:aU(),pick:uU(),range:fU(),reduce:zA(),sortBy:wU(),uniqueId:vU(),values:VA(),zipObject:bU()}}catch{}return e||(e=window._),Mw=e,Mw}var Iw,ZE;function kU(){if(ZE)return Iw;ZE=1,Iw=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,l=a._prev;l!==a;)s.push(JSON.stringify(l,n)),l=l._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 Iw}var $w,JE;function _U(){if(JE)return $w;JE=1;var e=kt(),t=gr().Graph,n=kU();$w=a;var s=e.constant(1);function a(p,f){if(p.nodeCount()<=1)return[];var m=d(p,f||s),y=l(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(v){return p.outEdges(v.v,v.w)}),!0)}function l(p,f,m){for(var y=[],v=f[f.length-1],N=f[0],_;p.nodeCount();){for(;_=N.dequeue();)c(p,f,m,_);for(;_=v.dequeue();)c(p,f,m,_);if(p.nodeCount()){for(var S=f.length-2;S>0;--S)if(_=f[S].dequeue(),_){y=y.concat(c(p,f,m,_,!0));break}}}return y}function c(p,f,m,y,v){var N=v?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var S=p.edge(_),k=p.node(_.v);v&&N.push({v:_.v,w:_.w}),k.out-=S,h(f,m,k)}),e.forEach(p.outEdges(y.v),function(_){var S=p.edge(_),k=_.w,j=p.node(k);j.in-=S,h(f,m,j)}),p.removeNode(y.v),N}function d(p,f){var m=new t,y=0,v=0;e.forEach(p.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),e.forEach(p.edges(),function(S){var k=m.edge(S.v,S.w)||0,j=f(S),E=k+j;m.setEdge(S.v,S.w,E),v=Math.max(v,m.node(S.v).out+=j),y=Math.max(y,m.node(S.w).in+=j)});var N=e.range(v+y+3).map(function(){return new n}),_=y+1;return e.forEach(m.nodes(),function(S){h(N,_,m.node(S))}),{graph:m,buckets:N,zeroIdx:_}}function h(p,f,m){m.out?m.in?p[m.out-m.in+f].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return $w}var Ow,eC;function NU(){if(eC)return Ow;eC=1;var e=kt(),t=_U();Ow={run:n,undo:a};function n(l){var c=l.graph().acyclicer==="greedy"?t(l,d(l)):s(l);e.forEach(c,function(h){var p=l.edge(h);l.removeEdge(h),p.forwardName=h.name,p.reversed=!0,l.setEdge(h.w,h.v,p,e.uniqueId("rev"))});function d(h){return function(p){return h.edge(p).weight}}}function s(l){var c=[],d={},h={};function p(f){e.has(h,f)||(h[f]=!0,d[f]=!0,e.forEach(l.outEdges(f),function(m){e.has(d,m.w)?c.push(m):p(m.w)}),delete d[f])}return e.forEach(l.nodes(),p),c}function a(l){e.forEach(l.edges(),function(c){var d=l.edge(c);if(d.reversed){l.removeEdge(c);var h=d.forwardName;delete d.reversed,delete d.forwardName,l.setEdge(c.w,c.v,d,h)}})}return Ow}var Pw,tC;function kn(){if(tC)return Pw;tC=1;var e=kt(),t=gr().Graph;Pw={addDummyNode:n,simplify:s,asNonCompoundGraph:a,successorWeights:l,predecessorWeights:c,intersectRect:d,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:f,addBorderNode:m,maxRank:y,partition:v,time:N,notime:_};function n(S,k,j,E){var C;do C=e.uniqueId(E);while(S.hasNode(C));return j.dummy=k,S.setNode(C,j),C}function s(S){var k=new t().setGraph(S.graph());return e.forEach(S.nodes(),function(j){k.setNode(j,S.node(j))}),e.forEach(S.edges(),function(j){var E=k.edge(j.v,j.w)||{weight:0,minlen:1},C=S.edge(j);k.setEdge(j.v,j.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),k}function a(S){var k=new t({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(j){S.children(j).length||k.setNode(j,S.node(j))}),e.forEach(S.edges(),function(j){k.setEdge(j,S.edge(j))}),k}function l(S){var k=e.map(S.nodes(),function(j){var E={};return e.forEach(S.outEdges(j),function(C){E[C.w]=(E[C.w]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),k)}function c(S){var k=e.map(S.nodes(),function(j){var E={};return e.forEach(S.inEdges(j),function(C){E[C.v]=(E[C.v]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),k)}function d(S,k){var j=S.x,E=S.y,C=k.x-j,T=k.y-E,R=S.width/2,A=S.height/2;if(!C&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var D,O;return Math.abs(T)*R>Math.abs(C)*A?(T<0&&(A=-A),D=A*C/T,O=A):(C<0&&(R=-R),D=R,O=R*T/C),{x:j+D,y:E+O}}function h(S){var k=e.map(e.range(y(S)+1),function(){return[]});return e.forEach(S.nodes(),function(j){var E=S.node(j),C=E.rank;e.isUndefined(C)||(k[C][E.order]=j)}),k}function p(S){var k=e.min(e.map(S.nodes(),function(j){return S.node(j).rank}));e.forEach(S.nodes(),function(j){var E=S.node(j);e.has(E,"rank")&&(E.rank-=k)})}function f(S){var k=e.min(e.map(S.nodes(),function(T){return S.node(T).rank})),j=[];e.forEach(S.nodes(),function(T){var R=S.node(T).rank-k;j[R]||(j[R]=[]),j[R].push(T)});var E=0,C=S.graph().nodeRankFactor;e.forEach(j,function(T,R){e.isUndefined(T)&&R%C!==0?--E:E&&e.forEach(T,function(A){S.node(A).rank+=E})})}function m(S,k,j,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=j,C.order=E),n(S,"border",C,k)}function y(S){return e.max(e.map(S.nodes(),function(k){var j=S.node(k).rank;if(!e.isUndefined(j))return j}))}function v(S,k){var j={lhs:[],rhs:[]};return e.forEach(S,function(E){k(E)?j.lhs.push(E):j.rhs.push(E)}),j}function N(S,k){var j=e.now();try{return k()}finally{console.log(S+" time: "+(e.now()-j)+"ms")}}function _(S,k){return k()}return Pw}var Lw,nC;function SU(){if(nC)return Lw;nC=1;var e=kt(),t=kn();Lw={run:n,undo:a};function n(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(c){s(l,c)})}function s(l,c){var d=c.v,h=l.node(d).rank,p=c.w,f=l.node(p).rank,m=c.name,y=l.edge(c),v=y.labelRank;if(f!==h+1){l.removeEdge(c);var N,_,S;for(S=0,++h;h<f;++S,++h)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:c,rank:h},N=t.addDummyNode(l,"edge",_,"_d"),h===v&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),l.setEdge(d,N,{weight:y.weight},m),S===0&&l.graph().dummyChains.push(N),d=N;l.setEdge(d,p,{weight:y.weight},m)}}function a(l){e.forEach(l.graph().dummyChains,function(c){var d=l.node(c),h=d.edgeLabel,p;for(l.setEdge(d.edgeObj,h);d.dummy;)p=l.successors(c)[0],l.removeNode(c),h.points.push({x:d.x,y:d.y}),d.dummy==="edge-label"&&(h.x=d.x,h.y=d.y,h.width=d.width,h.height=d.height),c=p,d=l.node(c)})}return Lw}var Dw,rC;function gd(){if(rC)return Dw;rC=1;var e=kt();Dw={longestPath:t,slack:n};function t(s){var a={};function l(c){var d=s.node(c);if(e.has(a,c))return d.rank;a[c]=!0;var h=e.min(e.map(s.outEdges(c),function(p){return l(p.w)-s.edge(p).minlen}));return(h===Number.POSITIVE_INFINITY||h===void 0||h===null)&&(h=0),d.rank=h}e.forEach(s.sources(),l)}function n(s,a){return s.node(a.w).rank-s.node(a.v).rank-s.edge(a).minlen}return Dw}var qw,sC;function sR(){if(sC)return qw;sC=1;var e=kt(),t=gr().Graph,n=gd().slack;qw=s;function s(d){var h=new t({directed:!1}),p=d.nodes()[0],f=d.nodeCount();h.setNode(p,{});for(var m,y;a(h,d)<f;)m=l(h,d),y=h.hasNode(m.v)?n(d,m):-n(d,m),c(h,d,y);return h}function a(d,h){function p(f){e.forEach(h.nodeEdges(f),function(m){var y=m.v,v=f===y?m.w:y;!d.hasNode(v)&&!n(h,m)&&(d.setNode(v,{}),d.setEdge(f,v,{}),p(v))})}return e.forEach(d.nodes(),p),d.nodeCount()}function l(d,h){return e.minBy(h.edges(),function(p){if(d.hasNode(p.v)!==d.hasNode(p.w))return n(h,p)})}function c(d,h,p){e.forEach(d.nodes(),function(f){h.node(f).rank+=p})}return qw}var Fw,aC;function jU(){if(aC)return Fw;aC=1;var e=kt(),t=sR(),n=gd().slack,s=gd().longestPath,a=gr().alg.preorder,l=gr().alg.postorder,c=kn().simplify;Fw=d,d.initLowLimValues=m,d.initCutValues=h,d.calcCutValue=f,d.leaveEdge=v,d.enterEdge=N,d.exchangeEdges=_;function d(E){E=c(E),s(E);var C=t(E);m(C),h(C,E);for(var T,R;T=v(C);)R=N(C,E,T),_(C,E,T,R)}function h(E,C){var T=l(E,E.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(R){p(E,C,R)})}function p(E,C,T){var R=E.node(T),A=R.parent;E.edge(T,A).cutvalue=f(E,C,T)}function f(E,C,T){var R=E.node(T),A=R.parent,D=!0,O=C.edge(T,A),$=0;return O||(D=!1,O=C.edge(A,T)),$=O.weight,e.forEach(C.nodeEdges(T),function(F){var Z=F.v===T,J=Z?F.w:F.v;if(J!==A){var I=Z===D,X=C.edge(F).weight;if($+=I?X:-X,k(E,T,J)){var G=E.edge(T,J).cutvalue;$+=I?-G:G}}}),$}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,T,R,A){var D=T,O=E.node(R);return C[R]=!0,e.forEach(E.neighbors(R),function($){e.has(C,$)||(T=y(E,C,T,$,R))}),O.low=D,O.lim=T++,A?O.parent=A:delete O.parent,T}function v(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function N(E,C,T){var R=T.v,A=T.w;C.hasEdge(R,A)||(R=T.w,A=T.v);var D=E.node(R),O=E.node(A),$=D,F=!1;D.lim>O.lim&&($=O,F=!0);var Z=e.filter(C.edges(),function(J){return F===j(E,E.node(J.v),$)&&F!==j(E,E.node(J.w),$)});return e.minBy(Z,function(J){return n(C,J)})}function _(E,C,T,R){var A=T.v,D=T.w;E.removeEdge(A,D),E.setEdge(R.v,R.w,{}),m(E),h(E,C),S(E,C)}function S(E,C){var T=e.find(E.nodes(),function(A){return!C.node(A).parent}),R=a(E,T);R=R.slice(1),e.forEach(R,function(A){var D=E.node(A).parent,O=C.edge(A,D),$=!1;O||(O=C.edge(D,A),$=!0),C.node(A).rank=C.node(D).rank+($?O.minlen:-O.minlen)})}function k(E,C,T){return E.hasEdge(C,T)}function j(E,C,T){return T.low<=C.lim&&C.lim<=T.lim}return Fw}var Bw,oC;function EU(){if(oC)return Bw;oC=1;var e=gd(),t=e.longestPath,n=sR(),s=jU();Bw=a;function a(h){switch(h.graph().ranker){case"network-simplex":d(h);break;case"tight-tree":c(h);break;case"longest-path":l(h);break;default:d(h)}}var l=t;function c(h){t(h),n(h)}function d(h){s(h)}return Bw}var zw,iC;function CU(){if(iC)return zw;iC=1;var e=kt();zw=t;function t(a){var l=s(a);e.forEach(a.graph().dummyChains,function(c){for(var d=a.node(c),h=d.edgeObj,p=n(a,l,h.v,h.w),f=p.path,m=p.lca,y=0,v=f[y],N=!0;c!==h.w;){if(d=a.node(c),N){for(;(v=f[y])!==m&&a.node(v).maxRank<d.rank;)y++;v===m&&(N=!1)}if(!N){for(;y<f.length-1&&a.node(v=f[y+1]).minRank<=d.rank;)y++;v=f[y]}a.setParent(c,v),c=a.successors(c)[0]}})}function n(a,l,c,d){var h=[],p=[],f=Math.min(l[c].low,l[d].low),m=Math.max(l[c].lim,l[d].lim),y,v;y=c;do y=a.parent(y),h.push(y);while(y&&(l[y].low>f||m>l[y].lim));for(v=y,y=d;(y=a.parent(y))!==v;)p.push(y);return{path:h.concat(p.reverse()),lca:v}}function s(a){var l={},c=0;function d(h){var p=c;e.forEach(a.children(h),d),l[h]={low:p,lim:c++}}return e.forEach(a.children(),d),l}return zw}var Uw,lC;function TU(){if(lC)return Uw;lC=1;var e=kt(),t=kn();Uw={run:n,cleanup:c};function n(d){var h=t.addDummyNode(d,"root",{},"_root"),p=a(d),f=e.max(e.values(p))-1,m=2*f+1;d.graph().nestingRoot=h,e.forEach(d.edges(),function(v){d.edge(v).minlen*=m});var y=l(d)+1;e.forEach(d.children(),function(v){s(d,h,m,y,f,p,v)}),d.graph().nodeRankFactor=m}function s(d,h,p,f,m,y,v){var N=d.children(v);if(!N.length){v!==h&&d.setEdge(h,v,{weight:0,minlen:p});return}var _=t.addBorderNode(d,"_bt"),S=t.addBorderNode(d,"_bb"),k=d.node(v);d.setParent(_,v),k.borderTop=_,d.setParent(S,v),k.borderBottom=S,e.forEach(N,function(j){s(d,h,p,f,m,y,j);var E=d.node(j),C=E.borderTop?E.borderTop:j,T=E.borderBottom?E.borderBottom:j,R=E.borderTop?f:2*f,A=C!==T?1:m-y[v]+1;d.setEdge(_,C,{weight:R,minlen:A,nestingEdge:!0}),d.setEdge(T,S,{weight:R,minlen:A,nestingEdge:!0})}),d.parent(v)||d.setEdge(h,_,{weight:0,minlen:m+y[v]})}function a(d){var h={};function p(f,m){var y=d.children(f);y&&y.length&&e.forEach(y,function(v){p(v,m+1)}),h[f]=m}return e.forEach(d.children(),function(f){p(f,1)}),h}function l(d){return e.reduce(d.edges(),function(h,p){return h+d.edge(p).weight},0)}function c(d){var h=d.graph();d.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(d.edges(),function(p){var f=d.edge(p);f.nestingEdge&&d.removeEdge(p)})}return Uw}var Ww,cC;function AU(){if(cC)return Ww;cC=1;var e=kt(),t=kn();Ww=n;function n(a){function l(c){var d=a.children(c),h=a.node(c);if(d.length&&e.forEach(d,l),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,f=h.maxRank+1;p<f;++p)s(a,"borderLeft","_bl",c,h,p),s(a,"borderRight","_br",c,h,p)}}e.forEach(a.children(),l)}function s(a,l,c,d,h,p){var f={width:0,height:0,rank:p,borderType:l},m=h[l][p-1],y=t.addDummyNode(a,"border",f,c);h[l][p]=y,a.setParent(y,d),m&&a.setEdge(m,y,{weight:1})}return Ww}var Hw,uC;function RU(){if(uC)return Hw;uC=1;var e=kt();Hw={adjust:t,undo:n};function t(p){var f=p.graph().rankdir.toLowerCase();(f==="lr"||f==="rl")&&s(p)}function n(p){var f=p.graph().rankdir.toLowerCase();(f==="bt"||f==="rl")&&l(p),(f==="lr"||f==="rl")&&(d(p),s(p))}function s(p){e.forEach(p.nodes(),function(f){a(p.node(f))}),e.forEach(p.edges(),function(f){a(p.edge(f))})}function a(p){var f=p.width;p.width=p.height,p.height=f}function l(p){e.forEach(p.nodes(),function(f){c(p.node(f))}),e.forEach(p.edges(),function(f){var m=p.edge(f);e.forEach(m.points,c),e.has(m,"y")&&c(m)})}function c(p){p.y=-p.y}function d(p){e.forEach(p.nodes(),function(f){h(p.node(f))}),e.forEach(p.edges(),function(f){var m=p.edge(f);e.forEach(m.points,h),e.has(m,"x")&&h(m)})}function h(p){var f=p.x;p.x=p.y,p.y=f}return Hw}var Gw,dC;function MU(){if(dC)return Gw;dC=1;var e=kt();Gw=t;function t(n){var s={},a=e.filter(n.nodes(),function(p){return!n.children(p).length}),l=e.max(e.map(a,function(p){return n.node(p).rank})),c=e.map(e.range(l+1),function(){return[]});function d(p){if(!e.has(s,p)){s[p]=!0;var f=n.node(p);c[f.rank].push(p),e.forEach(n.successors(p),d)}}var h=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(h,d),c}return Gw}var Vw,hC;function IU(){if(hC)return Vw;hC=1;var e=kt();Vw=t;function t(s,a){for(var l=0,c=1;c<a.length;++c)l+=n(s,a[c-1],a[c]);return l}function n(s,a,l){for(var c=e.zipObject(l,e.map(l,function(y,v){return v})),d=e.flatten(e.map(a,function(y){return e.sortBy(e.map(s.outEdges(y),function(v){return{pos:c[v.w],weight:s.edge(v).weight}}),"pos")}),!0),h=1;h<l.length;)h<<=1;var p=2*h-1;h-=1;var f=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(d.forEach(function(y){var v=y.pos+h;f[v]+=y.weight;for(var N=0;v>0;)v%2&&(N+=f[v+1]),v=v-1>>1,f[v]+=y.weight;m+=y.weight*N})),m}return Vw}var Yw,fC;function $U(){if(fC)return Yw;fC=1;var e=kt();Yw=t;function t(n,s){return e.map(s,function(a){var l=n.inEdges(a);if(l.length){var c=e.reduce(l,function(d,h){var p=n.edge(h),f=n.node(h.v);return{sum:d.sum+p.weight*f.order,weight:d.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:a}})}return Yw}var Kw,pC;function OU(){if(pC)return Kw;pC=1;var e=kt();Kw=t;function t(a,l){var c={};e.forEach(a,function(h,p){var f=c[h.v]={indegree:0,in:[],out:[],vs:[h.v],i:p};e.isUndefined(h.barycenter)||(f.barycenter=h.barycenter,f.weight=h.weight)}),e.forEach(l.edges(),function(h){var p=c[h.v],f=c[h.w];!e.isUndefined(p)&&!e.isUndefined(f)&&(f.indegree++,p.out.push(c[h.w]))});var d=e.filter(c,function(h){return!h.indegree});return n(d)}function n(a){var l=[];function c(p){return function(f){f.merged||(e.isUndefined(f.barycenter)||e.isUndefined(p.barycenter)||f.barycenter>=p.barycenter)&&s(p,f)}}function d(p){return function(f){f.in.push(p),--f.indegree===0&&a.push(f)}}for(;a.length;){var h=a.pop();l.push(h),e.forEach(h.in.reverse(),c(h)),e.forEach(h.out,d(h))}return e.map(e.filter(l,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(a,l){var c=0,d=0;a.weight&&(c+=a.barycenter*a.weight,d+=a.weight),l.weight&&(c+=l.barycenter*l.weight,d+=l.weight),a.vs=l.vs.concat(a.vs),a.barycenter=c/d,a.weight=d,a.i=Math.min(l.i,a.i),l.merged=!0}return Kw}var Xw,mC;function PU(){if(mC)return Xw;mC=1;var e=kt(),t=kn();Xw=n;function n(l,c){var d=t.partition(l,function(_){return e.has(_,"barycenter")}),h=d.lhs,p=e.sortBy(d.rhs,function(_){return-_.i}),f=[],m=0,y=0,v=0;h.sort(a(!!c)),v=s(f,p,v),e.forEach(h,function(_){v+=_.vs.length,f.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,v=s(f,p,v)});var N={vs:e.flatten(f,!0)};return y&&(N.barycenter=m/y,N.weight=y),N}function s(l,c,d){for(var h;c.length&&(h=e.last(c)).i<=d;)c.pop(),l.push(h.vs),d++;return d}function a(l){return function(c,d){return c.barycenter<d.barycenter?-1:c.barycenter>d.barycenter?1:l?d.i-c.i:c.i-d.i}}return Xw}var Qw,gC;function LU(){if(gC)return Qw;gC=1;var e=kt(),t=$U(),n=OU(),s=PU();Qw=a;function a(d,h,p,f){var m=d.children(h),y=d.node(h),v=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,_={};v&&(m=e.filter(m,function(T){return T!==v&&T!==N}));var S=t(d,m);e.forEach(S,function(T){if(d.children(T.v).length){var R=a(d,T.v,p,f);_[T.v]=R,e.has(R,"barycenter")&&c(T,R)}});var k=n(S,p);l(k,_);var j=s(k,f);if(v&&(j.vs=e.flatten([v,j.vs,N],!0),d.predecessors(v).length)){var E=d.node(d.predecessors(v)[0]),C=d.node(d.predecessors(N)[0]);e.has(j,"barycenter")||(j.barycenter=0,j.weight=0),j.barycenter=(j.barycenter*j.weight+E.order+C.order)/(j.weight+2),j.weight+=2}return j}function l(d,h){e.forEach(d,function(p){p.vs=e.flatten(p.vs.map(function(f){return h[f]?h[f].vs:f}),!0)})}function c(d,h){e.isUndefined(d.barycenter)?(d.barycenter=h.barycenter,d.weight=h.weight):(d.barycenter=(d.barycenter*d.weight+h.barycenter*h.weight)/(d.weight+h.weight),d.weight+=h.weight)}return Qw}var Zw,yC;function DU(){if(yC)return Zw;yC=1;var e=kt(),t=gr().Graph;Zw=n;function n(a,l,c){var d=s(a),h=new t({compound:!0}).setGraph({root:d}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var f=a.node(p),m=a.parent(p);(f.rank===l||f.minRank<=l&&l<=f.maxRank)&&(h.setNode(p),h.setParent(p,m||d),e.forEach(a[c](p),function(y){var v=y.v===p?y.w:y.v,N=h.edge(v,p),_=e.isUndefined(N)?0:N.weight;h.setEdge(v,p,{weight:a.edge(y).weight+_})}),e.has(f,"minRank")&&h.setNode(p,{borderLeft:f.borderLeft[l],borderRight:f.borderRight[l]}))}),h}function s(a){for(var l;a.hasNode(l=e.uniqueId("_root")););return l}return Zw}var Jw,wC;function qU(){if(wC)return Jw;wC=1;var e=kt();Jw=t;function t(n,s,a){var l={},c;e.forEach(a,function(d){for(var h=n.parent(d),p,f;h;){if(p=n.parent(h),p?(f=l[p],l[p]=h):(f=c,c=h),f&&f!==h){s.setEdge(f,h);return}h=p}})}return Jw}var ev,vC;function FU(){if(vC)return ev;vC=1;var e=kt(),t=MU(),n=IU(),s=LU(),a=DU(),l=qU(),c=gr().Graph,d=kn();ev=h;function h(y){var v=d.maxRank(y),N=p(y,e.range(1,v+1),"inEdges"),_=p(y,e.range(v-1,-1,-1),"outEdges"),S=t(y);m(y,S);for(var k=Number.POSITIVE_INFINITY,j,E=0,C=0;C<4;++E,++C){f(E%2?N:_,E%4>=2),S=d.buildLayerMatrix(y);var T=n(y,S);T<k&&(C=0,j=e.cloneDeep(S),k=T)}m(y,j)}function p(y,v,N){return e.map(v,function(_){return a(y,_,N)})}function f(y,v){var N=new c;e.forEach(y,function(_){var S=_.graph().root,k=s(_,S,N,v);e.forEach(k.vs,function(j,E){_.node(j).order=E}),l(_,N,k.vs)})}function m(y,v){e.forEach(v,function(N){e.forEach(N,function(_,S){y.node(_).order=S})})}return ev}var tv,xC;function BU(){if(xC)return tv;xC=1;var e=kt(),t=gr().Graph,n=kn();tv={positionX:N,findType1Conflicts:s,findType2Conflicts:a,addConflict:c,hasConflict:d,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:v};function s(k,j){var E={};function C(T,R){var A=0,D=0,O=T.length,$=e.last(R);return e.forEach(R,function(F,Z){var J=l(k,F),I=J?k.node(J).order:O;(J||F===$)&&(e.forEach(R.slice(D,Z+1),function(X){e.forEach(k.predecessors(X),function(G){var q=k.node(G),Y=q.order;(Y<A||I<Y)&&!(q.dummy&&k.node(X).dummy)&&c(E,G,X)})}),D=Z+1,A=I)}),R}return e.reduce(j,C),E}function a(k,j){var E={};function C(R,A,D,O,$){var F;e.forEach(e.range(A,D),function(Z){F=R[Z],k.node(F).dummy&&e.forEach(k.predecessors(F),function(J){var I=k.node(J);I.dummy&&(I.order<O||I.order>$)&&c(E,J,F)})})}function T(R,A){var D=-1,O,$=0;return e.forEach(A,function(F,Z){if(k.node(F).dummy==="border"){var J=k.predecessors(F);J.length&&(O=k.node(J[0]).order,C(A,$,Z,D,O),$=Z,D=O)}C(A,$,A.length,O,R.length)}),A}return e.reduce(j,T),E}function l(k,j){if(k.node(j).dummy)return e.find(k.predecessors(j),function(E){return k.node(E).dummy})}function c(k,j,E){if(j>E){var C=j;j=E,E=C}var T=k[j];T||(k[j]=T={}),T[E]=!0}function d(k,j,E){if(j>E){var C=j;j=E,E=C}return e.has(k[j],E)}function h(k,j,E,C){var T={},R={},A={};return e.forEach(j,function(D){e.forEach(D,function(O,$){T[O]=O,R[O]=O,A[O]=$})}),e.forEach(j,function(D){var O=-1;e.forEach(D,function($){var F=C($);if(F.length){F=e.sortBy(F,function(G){return A[G]});for(var Z=(F.length-1)/2,J=Math.floor(Z),I=Math.ceil(Z);J<=I;++J){var X=F[J];R[$]===$&&O<A[X]&&!d(E,$,X)&&(R[X]=$,R[$]=T[$]=T[X],O=A[X])}}})}),{root:T,align:R}}function p(k,j,E,C,T){var R={},A=f(k,j,E,T),D=T?"borderLeft":"borderRight";function O(Z,J){for(var I=A.nodes(),X=I.pop(),G={};X;)G[X]?Z(X):(G[X]=!0,I.push(X),I=I.concat(J(X))),X=I.pop()}function $(Z){R[Z]=A.inEdges(Z).reduce(function(J,I){return Math.max(J,R[I.v]+A.edge(I))},0)}function F(Z){var J=A.outEdges(Z).reduce(function(X,G){return Math.min(X,R[G.w]-A.edge(G))},Number.POSITIVE_INFINITY),I=k.node(Z);J!==Number.POSITIVE_INFINITY&&I.borderType!==D&&(R[Z]=Math.max(R[Z],J))}return O($,A.predecessors.bind(A)),O(F,A.successors.bind(A)),e.forEach(C,function(Z){R[Z]=R[E[Z]]}),R}function f(k,j,E,C){var T=new t,R=k.graph(),A=_(R.nodesep,R.edgesep,C);return e.forEach(j,function(D){var O;e.forEach(D,function($){var F=E[$];if(T.setNode(F),O){var Z=E[O],J=T.edge(Z,F);T.setEdge(Z,F,Math.max(A(k,$,O),J||0))}O=$})}),T}function m(k,j){return e.minBy(e.values(j),function(E){var C=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(E,function(R,A){var D=S(k,A)/2;C=Math.max(R+D,C),T=Math.min(R-D,T)}),C-T})}function y(k,j){var E=e.values(j),C=e.min(E),T=e.max(E);e.forEach(["u","d"],function(R){e.forEach(["l","r"],function(A){var D=R+A,O=k[D],$;if(O!==j){var F=e.values(O);$=A==="l"?C-e.min(F):T-e.max(F),$&&(k[D]=e.mapValues(O,function(Z){return Z+$}))}})})}function v(k,j){return e.mapValues(k.ul,function(E,C){if(j)return k[j.toLowerCase()][C];var T=e.sortBy(e.map(k,C));return(T[1]+T[2])/2})}function N(k){var j=n.buildLayerMatrix(k),E=e.merge(s(k,j),a(k,j)),C={},T;e.forEach(["u","d"],function(A){T=A==="u"?j:e.values(j).reverse(),e.forEach(["l","r"],function(D){D==="r"&&(T=e.map(T,function(Z){return e.values(Z).reverse()}));var O=(A==="u"?k.predecessors:k.successors).bind(k),$=h(k,T,E,O),F=p(k,T,$.root,$.align,D==="r");D==="r"&&(F=e.mapValues(F,function(Z){return-Z})),C[A+D]=F})});var R=m(k,C);return y(C,R),v(C,k.graph().align)}function _(k,j,E){return function(C,T,R){var A=C.node(T),D=C.node(R),O=0,$;if(O+=A.width/2,e.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":$=-A.width/2;break;case"r":$=A.width/2;break}if($&&(O+=E?$:-$),$=0,O+=(A.dummy?j:k)/2,O+=(D.dummy?j:k)/2,O+=D.width/2,e.has(D,"labelpos"))switch(D.labelpos.toLowerCase()){case"l":$=D.width/2;break;case"r":$=-D.width/2;break}return $&&(O+=E?$:-$),$=0,O}}function S(k,j){return k.node(j).width}return tv}var nv,bC;function zU(){if(bC)return nv;bC=1;var e=kt(),t=kn(),n=BU().positionX;nv=s;function s(l){l=t.asNonCompoundGraph(l),a(l),e.forEach(n(l),function(c,d){l.node(d).x=c})}function a(l){var c=t.buildLayerMatrix(l),d=l.graph().ranksep,h=0;e.forEach(c,function(p){var f=e.max(e.map(p,function(m){return l.node(m).height}));e.forEach(p,function(m){l.node(m).y=h+f/2}),h+=f+d})}return nv}var rv,kC;function UU(){if(kC)return rv;kC=1;var e=kt(),t=NU(),n=SU(),s=EU(),a=kn().normalizeRanks,l=CU(),c=kn().removeEmptyRanks,d=TU(),h=AU(),p=RU(),f=FU(),m=zU(),y=kn(),v=gr().Graph;rv=N;function N(U,W){var ee=W&&W.debugTiming?y.time:y.notime;ee("layout",function(){var H=ee(" buildLayoutGraph",function(){return O(U)});ee(" runLayout",function(){_(H,ee)}),ee(" updateInputGraph",function(){S(U,H)})})}function _(U,W){W(" makeSpaceForEdgeLabels",function(){$(U)}),W(" removeSelfEdges",function(){L(U)}),W(" acyclic",function(){t.run(U)}),W(" nestingGraph.run",function(){d.run(U)}),W(" rank",function(){s(y.asNonCompoundGraph(U))}),W(" injectEdgeLabelProxies",function(){F(U)}),W(" removeEmptyRanks",function(){c(U)}),W(" nestingGraph.cleanup",function(){d.cleanup(U)}),W(" normalizeRanks",function(){a(U)}),W(" assignRankMinMax",function(){Z(U)}),W(" removeEdgeLabelProxies",function(){J(U)}),W(" normalize.run",function(){n.run(U)}),W(" parentDummyChains",function(){l(U)}),W(" addBorderSegments",function(){h(U)}),W(" order",function(){f(U)}),W(" insertSelfEdges",function(){K(U)}),W(" adjustCoordinateSystem",function(){p.adjust(U)}),W(" position",function(){m(U)}),W(" positionSelfEdges",function(){P(U)}),W(" removeBorderNodes",function(){Y(U)}),W(" normalize.undo",function(){n.undo(U)}),W(" fixupEdgeLabelCoords",function(){G(U)}),W(" undoCoordinateSystem",function(){p.undo(U)}),W(" translateGraph",function(){I(U)}),W(" assignNodeIntersects",function(){X(U)}),W(" reversePoints",function(){q(U)}),W(" acyclic.undo",function(){t.undo(U)})}function S(U,W){e.forEach(U.nodes(),function(ee){var H=U.node(ee),ae=W.node(ee);H&&(H.x=ae.x,H.y=ae.y,W.children(ee).length&&(H.width=ae.width,H.height=ae.height))}),e.forEach(U.edges(),function(ee){var H=U.edge(ee),ae=W.edge(ee);H.points=ae.points,e.has(ae,"x")&&(H.x=ae.x,H.y=ae.y)}),U.graph().width=W.graph().width,U.graph().height=W.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],j={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],T={width:0,height:0},R=["minlen","weight","width","height","labeloffset"],A={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},D=["labelpos"];function O(U){var W=new v({multigraph:!0,compound:!0}),ee=he(U.graph());return W.setGraph(e.merge({},j,V(ee,k),e.pick(ee,E))),e.forEach(U.nodes(),function(H){var ae=he(U.node(H));W.setNode(H,e.defaults(V(ae,C),T)),W.setParent(H,U.parent(H))}),e.forEach(U.edges(),function(H){var ae=he(U.edge(H));W.setEdge(H,e.merge({},A,V(ae,R),e.pick(ae,D)))}),W}function $(U){var W=U.graph();W.ranksep/=2,e.forEach(U.edges(),function(ee){var H=U.edge(ee);H.minlen*=2,H.labelpos.toLowerCase()!=="c"&&(W.rankdir==="TB"||W.rankdir==="BT"?H.width+=H.labeloffset:H.height+=H.labeloffset)})}function F(U){e.forEach(U.edges(),function(W){var ee=U.edge(W);if(ee.width&&ee.height){var H=U.node(W.v),ae=U.node(W.w),me={rank:(ae.rank-H.rank)/2+H.rank,e:W};y.addDummyNode(U,"edge-proxy",me,"_ep")}})}function Z(U){var W=0;e.forEach(U.nodes(),function(ee){var H=U.node(ee);H.borderTop&&(H.minRank=U.node(H.borderTop).rank,H.maxRank=U.node(H.borderBottom).rank,W=e.max(W,H.maxRank))}),U.graph().maxRank=W}function J(U){e.forEach(U.nodes(),function(W){var ee=U.node(W);ee.dummy==="edge-proxy"&&(U.edge(ee.e).labelRank=ee.rank,U.removeNode(W))})}function I(U){var W=Number.POSITIVE_INFINITY,ee=0,H=Number.POSITIVE_INFINITY,ae=0,me=U.graph(),ge=me.marginx||0,Re=me.marginy||0;function $e(ce){var we=ce.x,xe=ce.y,De=ce.width,_e=ce.height;W=Math.min(W,we-De/2),ee=Math.max(ee,we+De/2),H=Math.min(H,xe-_e/2),ae=Math.max(ae,xe+_e/2)}e.forEach(U.nodes(),function(ce){$e(U.node(ce))}),e.forEach(U.edges(),function(ce){var we=U.edge(ce);e.has(we,"x")&&$e(we)}),W-=ge,H-=Re,e.forEach(U.nodes(),function(ce){var we=U.node(ce);we.x-=W,we.y-=H}),e.forEach(U.edges(),function(ce){var we=U.edge(ce);e.forEach(we.points,function(xe){xe.x-=W,xe.y-=H}),e.has(we,"x")&&(we.x-=W),e.has(we,"y")&&(we.y-=H)}),me.width=ee-W+ge,me.height=ae-H+Re}function X(U){e.forEach(U.edges(),function(W){var ee=U.edge(W),H=U.node(W.v),ae=U.node(W.w),me,ge;ee.points?(me=ee.points[0],ge=ee.points[ee.points.length-1]):(ee.points=[],me=ae,ge=H),ee.points.unshift(y.intersectRect(H,me)),ee.points.push(y.intersectRect(ae,ge))})}function G(U){e.forEach(U.edges(),function(W){var ee=U.edge(W);if(e.has(ee,"x"))switch((ee.labelpos==="l"||ee.labelpos==="r")&&(ee.width-=ee.labeloffset),ee.labelpos){case"l":ee.x-=ee.width/2+ee.labeloffset;break;case"r":ee.x+=ee.width/2+ee.labeloffset;break}})}function q(U){e.forEach(U.edges(),function(W){var ee=U.edge(W);ee.reversed&&ee.points.reverse()})}function Y(U){e.forEach(U.nodes(),function(W){if(U.children(W).length){var ee=U.node(W),H=U.node(ee.borderTop),ae=U.node(ee.borderBottom),me=U.node(e.last(ee.borderLeft)),ge=U.node(e.last(ee.borderRight));ee.width=Math.abs(ge.x-me.x),ee.height=Math.abs(ae.y-H.y),ee.x=me.x+ee.width/2,ee.y=H.y+ee.height/2}}),e.forEach(U.nodes(),function(W){U.node(W).dummy==="border"&&U.removeNode(W)})}function L(U){e.forEach(U.edges(),function(W){if(W.v===W.w){var ee=U.node(W.v);ee.selfEdges||(ee.selfEdges=[]),ee.selfEdges.push({e:W,label:U.edge(W)}),U.removeEdge(W)}})}function K(U){var W=y.buildLayerMatrix(U);e.forEach(W,function(ee){var H=0;e.forEach(ee,function(ae,me){var ge=U.node(ae);ge.order=me+H,e.forEach(ge.selfEdges,function(Re){y.addDummyNode(U,"selfedge",{width:Re.label.width,height:Re.label.height,rank:ge.rank,order:me+ ++H,e:Re.e,label:Re.label},"_se")}),delete ge.selfEdges})})}function P(U){e.forEach(U.nodes(),function(W){var ee=U.node(W);if(ee.dummy==="selfedge"){var H=U.node(ee.e.v),ae=H.x+H.width/2,me=H.y,ge=ee.x-ae,Re=H.height/2;U.setEdge(ee.e,ee.label),U.removeNode(W),ee.label.points=[{x:ae+2*ge/3,y:me-Re},{x:ae+5*ge/6,y:me-Re},{x:ae+ge,y:me},{x:ae+5*ge/6,y:me+Re},{x:ae+2*ge/3,y:me+Re}],ee.label.x=ee.x,ee.label.y=ee.y}})}function V(U,W){return e.mapValues(e.pick(U,W),Number)}function he(U){var W={};return e.forEach(U,function(ee,H){W[H.toLowerCase()]=ee}),W}return rv}var sv,_C;function WU(){if(_C)return sv;_C=1;var e=kt(),t=kn(),n=gr().Graph;sv={debugOrdering:s};function s(a){var l=t.buildLayerMatrix(a),c=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(d){c.setNode(d,{label:d}),c.setParent(d,"layer"+a.node(d).rank)}),e.forEach(a.edges(),function(d){c.setEdge(d.v,d.w,{},d.name)}),e.forEach(l,function(d,h){var p="layer"+h;c.setNode(p,{rank:"same"}),e.reduce(d,function(f,m){return c.setEdge(f,m,{style:"invis"}),m})}),c}return sv}var av,NC;function HU(){return NC||(NC=1,av="0.8.5"),av}var ov,SC;function GU(){return SC||(SC=1,ov={graphlib:gr(),layout:UU(),debug:WU(),util:{time:kn().time,notime:kn().notime},version:HU()}),ov}var VU=GU();const jC=Qv(VU),Ka=240,Hl=130,li=74,Yd=72,jl=li+Yd;function aR(e,t){var s;let n=Ka;for(const a of e)n=Math.max(n,((s=t.get(a.id))==null?void 0:s.width)??Ka);return n}const yd=420,oR=1;function YU(e,t,n,s){return Math.min(oR,n/Math.max(1,e),s/Math.max(1,t))}function Xa(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function KU(e,t){return((t==null?void 0:t.get(e))??0)>0?yd:0}function XU(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Gl(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??Ka)+KU(e,n),h:Math.max((s==null?void 0:s.height)??Hl,XU(e,n))}}function QU(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function ZU(e,t,n,s,a,l){const c=new jC.graphlib.Graph;c.setDefaultEdgeLabel(()=>({})),c.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const d=e.filter(k=>!a.has(k)),h=new Set(d);for(const k of d){const{w:j,h:E}=Gl(k,s,l);c.setNode(k,{width:j,height:E})}for(const k of t)h.has(k.source)&&h.has(k.target)&&c.setEdge(k.source,k.target);jC.layout(c);const p=new Map;let f=1/0,m=1/0,y=-1/0,v=-1/0;for(const k of d){const j=c.node(k);if(!j)continue;const E=s.get(k),C=(E==null?void 0:E.width)??Ka,T=(E==null?void 0:E.height)??Hl,R=Gl(k,s,l),A=j.x-R.w/2,D=j.y-R.h/2;p.set(k,{x:A,y:D}),A<f&&(f=A),D<m&&(m=D),A+C>y&&(y=A+C),D+T>v&&(v=D+T)}if(Number.isFinite(f)&&Number.isFinite(m))for(const[k,j]of p)p.set(k,{x:j.x-f,y:j.y-m});const N=Number.isFinite(y)?y-f:0,_=Number.isFinite(v)?v-m:0;let S=null;for(const k of e){const j=a.get(k);if(!j)continue;const E=s.get(k),C=(E==null?void 0:E.width)??Ka,T=(E==null?void 0:E.height)??Hl;S=S===null?{minX:j.x,minY:j.y,maxX:j.x+C,maxY:j.y+T}:{minX:Math.min(S.minX,j.x),minY:Math.min(S.minY,j.y),maxX:Math.max(S.maxX,j.x+C),maxY:Math.max(S.maxY,j.y+T)}}return{positions:p,width:N,height:_,pinnedBox:S}}function JU(e,t,n={}){const s=n.direction??"LR",a=n.pinned??new Map,l=n.measured??new Map,c=n.lanes,d=new Map;for(const T of e){const R=Xa(T),A=d.get(R);A?A.push(T.id):d.set(R,[T.id])}const p=Array.from(d.keys()).sort().map(T=>({sid:T,...ZU(d.get(T),t,s,l,a,c)})),f=aR(e,l),m=T=>T.reduce((R,A)=>Math.max(R,A.width),0)+yd,y=T=>T.reduce((R,A)=>R+A.height,0)+jl*Math.max(0,T.length-1),v=T=>{const R=[[]];let A=0;for(const D of p)A>0&&A+D.height>T&&(R.push([]),A=0),R[R.length-1].push(D),A+=D.height+jl;return R},N=[];for(let T=0;T<p.length;T++){let R=-jl;for(let A=T;A<p.length;A++)N.push(R+=p[A].height+jl)}N.sort((T,R)=>T-R);const _=T=>{let R=0,A=N.length-1;for(;R<A;){const D=R+A>>1;v(N[D]).length<=T?A=D:R=D+1}return v(N[R])};let S=[p];const k=n.availableWidth??0,j=n.availableHeight??0;if(k>0&&j>0){const T=A=>YU(A.reduce((D,O)=>D+m(O),0)+f*(A.length-1),Math.max(...A.map(y)),k,j);let R=T(S);for(let A=2;A<=p.length;A++){const D=_(A),O=T(D);O>R+1e-9&&(R=O,S=D)}}const E=new Map;let C=0;for(const T of S){const R=m(T);let A=0;for(const{positions:D,height:O,pinnedBox:$}of T){for(const[Z,J]of D)E.set(Z,{x:J.x+C,y:J.y+A});let F=A+O;$&&$.maxY>F&&$.minX<C+R&&C<$.maxX&&(F=$.maxY),A=F+jl}C+=R+f}return e.map(T=>{const R=a.get(T.id);if(R)return{...T,position:R};const A=E.get(T.id);return A?{...T,position:A}:T})}function eW(e,t,n,s,a){const c=li+Yd,d=60,h=v=>Gl(v,s,a),p=new Map(e.map(v=>[v.id,Xa(v)])),f=[],m=e.map(v=>({id:v.id,pos:n.get(v.id)??t.get(v.id)})).filter(v=>v.pos!=null).sort((v,N)=>v.pos.y-N.pos.y||v.pos.x-N.pos.x||v.id.localeCompare(N.id)),y=[];for(const{id:v,pos:N}of m){const{w:_,h:S}=h(v),k=p.get(v)??"_default";if(n.has(v)){f.push({x:N.x,y:N.y,w:_,h:S,sid:k});continue}let j=N.y;for(let E=0;E<f.length+1;E++){const C=f.find(T=>{const R=T.sid===k?24:d,A=T.sid===k?24:c;return N.x<T.x+T.w+R&&T.x<N.x+_+R&&j<T.y+T.h+A&&T.y<j+S+A});if(!C)break;j=C.y+C.h+(C.sid===k?24:c)}j!==N.y&&(t.set(v,{x:N.x,y:j}),y.push(v)),f.push({x:N.x,y:j,w:_,h:S,sid:k})}return y}function tW(e,t,n,s,a,l,c){const d=E=>Gl(E,s,l),h=E=>n.get(E)??t.get(E),p=E=>{const C=s.get(E);return{cw:(C==null?void 0:C.width)??Ka,ch:(C==null?void 0:C.height)??Hl}},f=c!=null&&c.width>0&&c.height>0,m=new Map;for(const E of e){if(!h(E.id))continue;const C=Xa(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 v=new Map,N=[];for(const E of e){const C=h(E.id);if(!C)continue;const{w:T,h:R}=d(E.id),A=Xa(E);y.has(A)?(v.get(A)??v.set(A,[]).get(A)).push(E):N.push({x:C.x,y:C.y,w:T,h:R,...p(E.id)})}if(v.size===0||f&&N.length===0)return[];const _=li+Yd,S=(E,C,T,R)=>N.some(A=>E<A.x+A.w+li&&A.x<E+T+li&&C<A.y+A.h+_&&A.y<C+R+_),k=aR(e,s),j=[];for(const E of[...v.keys()].sort()){const C=v.get(E);let T=1/0,R=1/0,A=-1/0,D=-1/0,O=-1/0,$=-1/0;for(const q of C){const Y=h(q.id),{w:L,h:K}=d(q.id),{cw:P,ch:V}=p(q.id);T=Math.min(T,Y.x),R=Math.min(R,Y.y),A=Math.max(A,Y.x+L),D=Math.max(D,Y.y+K),O=Math.max(O,Y.x+P),$=Math.max($,Y.y+V)}const F=A-T,Z=D-R,J=[...new Set(N.map(q=>Math.round(q.x)))].sort((q,Y)=>q-Y),I=J.length?J:[T],X=[0,...N.map(q=>q.y+q.h+_)].sort((q,Y)=>q-Y);let G=null;if(f){let q=1/0,Y=1/0,L=-1/0,K=-1/0;for(const ee of N)q=Math.min(q,ee.x),Y=Math.min(Y,ee.y),L=Math.max(L,ee.x+ee.cw),K=Math.max(K,ee.y+ee.ch);const P=(ee,H)=>{const ae=c.width/(Math.max(L,ee+O-T)-Math.min(q,ee)+yd),me=c.height/(Math.max(K,H+$-R)-Math.min(Y,H));return[Math.min(oR,ae,me),Math.min(ae,me),Math.max(ae,me)]},V=(ee,H)=>{for(let ae=0;ae<ee.length;ae++){if(ee[ae]>H[ae]+1e-9)return!0;if(ee[ae]<H[ae]-1e-9)return!1}return!1},he=Math.round(L+yd+k),U=[...new Set([...X,Y])].sort((ee,H)=>ee-H);let W=null;for(const ee of[...I,he])for(const H of U){if(S(ee,H,F,Z))continue;const ae=P(ee,H);(W===null||V(ae,W))&&(W=ae,G={x:ee,y:H})}G&&G.x===T&&G.y===R&&(G=null)}else e:for(const q of I)for(const Y of X){if(Y>=R)break;if(!S(q,Y,F,Z)){G={x:q,y:Y};break e}}if(G){const q=G.x-T,Y=G.y-R;for(const L of C){const K=h(L.id);t.set(L.id,{x:K.x+q,y:K.y+Y})}j.push(E)}for(const q of C){const Y=h(q.id),{w:L,h:K}=d(q.id);N.push({x:Y.x,y:Y.y,w:L,h:K,...p(q.id)})}}return j}function nW(e,t,n){const s=new Map;for(const a of e){if(t.has(a.id)||!n(a.id))continue;const l=Xa(a);(s.get(l)??s.set(l,[]).get(l)).push(a)}if(s.size===0)return e;for(const a of s.values())a.sort((l,c)=>l.id.localeCompare(c.id));return e.map(a=>{var p;if(t.has(a.id)||n(a.id))return a;const l=s.get(Xa(a));if(!l)return a;const c=(p=a.data)==null?void 0:p.parentId,d=l.find(f=>f.id===c)??l[0],h=n(d.id);return{...a,position:{x:a.position.x+h.x-d.position.x,y:a.position.y+h.y-d.position.y}}})}function rW(e,t,n,s,a,l=!1,c){const p=li+Yd+1,f=8,m=1.75,y=200,v=.7,N=.01,_=$=>Gl($,s,c),S=$=>n.get($)??t.get($),k=new Map;for(const $ of e){if(!S($.id))continue;const F=Xa($),Z=k.get(F);Z?Z.push($):k.set(F,[$])}const j=[],E=new Set,C=new Set,T=a.size===0;for(const $ of[...k.keys()].sort()){const F=k.get($);let Z=1/0,J=1/0,I=-1/0,X=-1/0,G=!1;for(const K of F){const P=S(K.id),{w:V,h:he}=_(K.id);Z=Math.min(Z,P.x),J=Math.min(J,P.y),I=Math.max(I,P.x+V),X=Math.max(X,P.y+he),n.has(K.id)&&(G=!0)}const q=I-Z,Y=X-J;C.add($);const L=a.get($);L&&(q>L.w+f||Y>L.h+f)&&E.add($),a.set($,{w:q,h:Y}),j.push({sid:$,members:F.map(K=>K.id),x:Z,y:J,w:q,h:Y,anchored:G,mass:1})}for(const $ of[...a.keys()])C.has($)||a.delete($);if(l||T)return[];let R=!1;for(let $=0;$<j.length&&!R;$++)for(let F=$+1;F<j.length;F++){const Z=j[$],J=j[F];if(!(Z.anchored&&J.anchored)&&Math.abs(Z.x+Z.w/2-(J.x+J.w/2))<(Z.w+J.w)/2+61&&Math.abs(Z.y+Z.h/2-(J.y+J.h/2))<(Z.h+J.h)/2+p){R=!0;break}}if(E.size===0&&!R)return[];if(E.size>0)for(const $ of j)E.has($.sid)&&($.mass=8);else for(const $ of j)$.mass=Math.max(1,$.w*$.h/(Ka*Hl));const A=new Map(j.map($=>[$.sid,$.x])),D=new Map(j.map($=>[$.sid,$.y]));for(let $=0;$<y;$++){const F=new Map,Z=new Map;let J=0;for(let I=0;I<j.length;I++)for(let X=I+1;X<j.length;X++){const G=j[I],q=j[X];if(G.anchored&&q.anchored)continue;const Y=G.x+G.w/2,L=G.y+G.h/2,K=q.x+q.w/2,P=q.y+q.h/2,V=(G.w+q.w)/2+61-Math.abs(Y-K),he=(G.h+q.h)/2+p-Math.abs(L-P);if(V<=0||he<=0)continue;const U=(Qe,fe)=>!Qe.anchored&&!(fe<0&&Qe.x<=0),W=(Qe,fe)=>!Qe.anchored&&!(fe<0&&Qe.y<=0),ee=(Qe,fe,ye)=>{const Se=Qe===fe,Pe=Se?G.sid<q.sid?-1:1:Math.sign(Qe-fe);return ye(G,Pe)||ye(q,-Pe)?Pe:Se&&(ye(G,-Pe)||ye(q,Pe))?-Pe:0},H=ee(Y,K,U),ae=ee(L,P,W),me=H!==0,ge=ae!==0;if(!me&&!ge)continue;const Re=me&&(!ge||V*m<he),[$e,ce,we,xe]=Re?[H,V,F,U]:[ae,he,Z,W],De=xe(G,$e),_e=xe(q,-$e),Ee=G.mass,Ge=q.mass,st=De?_e?Ge/(Ee+Ge):1:0,Je=_e?De?Ee/(Ee+Ge):1:0,Ze=ce*v;we.set(G.sid,(we.get(G.sid)??0)+$e*Ze*st),we.set(q.sid,(we.get(q.sid)??0)-$e*Ze*Je),J+=Ze}for(const I of j)I.anchored||(I.x=Math.max(0,I.x+(F.get(I.sid)??0)),I.y=Math.max(0,I.y+(Z.get(I.sid)??0)));if(J<N)break}const O=[];for(const $ of j){const F=$.x-A.get($.sid),Z=$.y-D.get($.sid);if(!(Math.abs(F)<1&&Math.abs(Z)<1)){for(const J of $.members){if(n.has(J))continue;const I=t.get(J);I&&t.set(J,{x:I.x+F,y:I.y+Z})}O.push($.sid)}}return O}const sW=600;function Vv(e,t){return!(e.exitAt!=null&&t-e.exitAt>sW||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function aW(e,t){const n=new Set;for(const s of e.agents.values())Vv(s,t)&&n.add(s.id);return n}function oW(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 iW(e,t,n=0){if(!e)return!1;for(const s of t)if(oW(e,s,n))return!0;return!1}const iR="sessionGroup";function lW(e,t){var s;if(e.type===iR)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const lR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function EC(e){const t={};for(const n of lR)t[n]=e(n);return t}function cW(e){return t=>e[t]??""}function uW(e,t){return lR.every(n=>e[n]===t[n])}function dW(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[a,l]of e.positions)n.set(a,l),t.has(a)&&s.set(a,l);return{positions:n,pinned:s}}const hW=1200,fW=1e3;function CC(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<hW?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<fW}function Zu({durationMs:e,documentHidden:t,reducedMotion:n=pW()}){return t||n?!1:Number.isFinite(e)&&e>0}function pW(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function iv(e){const t=typeof document<"u"&&document.hidden;return Zu({durationMs:e,documentHidden:t})?e:0}function mW(e,t,n){const s=e.x*t.zoom+t.x,a=e.y*t.zoom+t.y,l=(e.x+e.width)*t.zoom+t.x,c=(e.y+e.height)*t.zoom+t.y;return l>0&&s<n.width&&c>0&&a<n.height}function gW({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,mW(a,t,e))return!1;return s}const yW="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",lv="click for what's new";function wW(e){if(e.checkDisabled)return`${yW} · ${lv}`;if(e.checking)return`Asking npm for the newest release… · ${lv}`;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.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${lv}, and to check npm now`}function vW(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`:`${t} and check npm for a newer release`}function xW(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 bW(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 Yv={kind:"assumed",claude:!0,codex:!0};function kW(e){if(!e||typeof e!="object")return Yv;const t=e.providers;if(!t||typeof t!="object")return Yv;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function wd(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const TC=99;function _W(e){const t=Math.max(0,Math.floor(e));return t>TC?`${TC}+`:String(t)}const NW="Pause the canvas";function SW(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 jW(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 cR="paused · full",EW=(e,t)=>t>0?cR:e>0?`paused · ${_W(e)}`:"paused";function CW(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:EW(e.held,t),widest:cR,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"}}function AC(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const TW={agent:_4,sessionGroup:F4},uR="react-flow__node";function RC(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,uR))===!0}const cv=80,uv=.86;function MC(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 AW(e){try{const t=document.querySelector(`.${uR}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const RW=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),MW=420;function IW(e){return e<.35?"far":e<.55?"mid":"full"}const zu=18,$W=200,OW=5*6e4,PW=6,LW=2*6e4,IC=400,Zx="agent-dag.layout",Jx="agent-dag.viewport",dR="agent-dag.summariesDismissed",hR="agent-dag.sessionListOpen",fR="agent-dag.detailOpen",pR="agent-dag.usagePanelOpen",mR="agent-dag.systemPanelOpen",$C="agent-dag.accountsPanelOpen",dv="agent-dag.versionNoticeDismissed",OC="agent-dag.oldNameNoticeDismissed",DW=15*6e4,hv={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:"},Uu="agent-dag.autoRestart",PC="agent-dag.bundleReloadedFor";function qW(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(hR)==="1"}catch{return!1}}function FW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(hR,e?"1":"0")}catch{}}function BW(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(fR)==="1"}catch{return!1}}function zW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(fR,e?"1":"0")}catch{}}function UW(){const e=wi(pR);return e===null?!0:e==="1"}function WW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(pR,e?"1":"0")}catch{}}function HW(){const e=wi(mR);return e===null?!0:e==="1"}function GW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(mR,e?"1":"0")}catch{}}function VW(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(dR);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(n=>typeof n=="string"):[])}catch{return new Set}}function LC(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(dR,JSON.stringify(n))}catch{}}function YW(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Zx);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const a=Object.entries(n).filter(([,l])=>l&&typeof l.x=="number"&&typeof l.y=="number");return{positions:a,pins:a.map(([l])=>l)}}return{positions:Object.entries(n.positions??{}).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function fv(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(Zx,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function KW(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Jx);if(!e)return null;const t=JSON.parse(e);return typeof(t==null?void 0:t.x)!="number"||typeof(t==null?void 0:t.y)!="number"||typeof(t==null?void 0:t.zoom)!="number"?null:t}catch{return null}}function XW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Jx,JSON.stringify(e))}catch{}}function DC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Zx)}catch{}try{window.localStorage.removeItem(Jx)}catch{}}}function QW(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const f of e.agents.values())f.sessionId===t&&s.push(f);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(f=>({id:f.id,kind:f.kind,label:f.label,parentId:f.parentId,state:f.state,startedAt:f.startedAt,endedAt:f.endedAt,model:f.model,cwd:f.cwd,usage:f.usage,prompts:f.prompts,tools:f.tools.map(m=>({id:m.id,name:m.name,inputPreview:m.inputPreview,startedAt:m.startedAt,endedAt:m.endedAt,ok:m.ok,errorPreview:m.errorPreview,usage:m.usage}))}))},l=JSON.stringify(a,null,2),c=new Blob([l],{type:"application/json"}),d=URL.createObjectURL(c),h=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");h.href=d,h.download=`${Gt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(d),1e3)}const Kv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Xv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},gR=N2;function ZW(e,t,n,s,a,l,c,d,h,p,f,m,y,v,N,_,S,k){const j=[],E=[];for(const $ of e.agents.values()){if(!S.has($.id))continue;const F=$.exitAt!=null,Z=_!=null&&!_.has($.id),J=[F?"rf-exiting":"",Z?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,I=l.get($.id);if(j.push({id:$.id,type:"agent",position:{x:0,y:0},data:{...$,now:t,onOpenContext:k},className:J,...I?{width:I.width,height:I.height}:null}),$.parentId&&S.has($.parentId)){const X=gx($.sessionId),G=F,q=N.size>0&&(N.has($.id)||N.has($.parentId)),Y=_!=null&&!_.has($.id)&&!_.has($.parentId),L=$.state==="active"?2:1.5,K=q?L+1.5:L,P=G?.2:Y?.12:1,V=["sess-edge",$.state==="active"?"sess-live":"sess-idle",G?"rf-edge-exiting":"",q?"rf-edge-selected":""].filter(Boolean).join(" ");E.push({id:`e:${$.parentId}->${$.id}`,source:$.parentId,target:$.id,animated:($.state==="active"||q)&&!G,type:"smoothstep",style:{"--session-hue":X,strokeWidth:K,opacity:P,transition:"var(--edge-transition)"},className:V})}}const C=new Map;for(const $ of e.agents.values())$.tools.length>0&&C.set($.id,Math.min(4,$.tools.length));const T=`${y}#lanes:${QU(C)}`,R=j.filter($=>WF($.id,a,f,m));if(R.length>0||T!==v.current){if(R.length>0){const $=nW(JU(j,E,{direction:"LR",pinned:a,measured:l,availableWidth:n,availableHeight:s,lanes:C}),a,F=>Gv(F,f,m)?void 0:f.get(F));for(const F of $)Gv(F.id,f,m)&&GF(F.id,F.position,f,m);tW(j,f,a,l,new Set(R.map(F=>F.id)),C,{width:n,height:s})}eW(j,f,a,l,C),v.current=T}const A=rW(j,f,a,l,c,!h||p,C);A.length>0&&d(A),Pu(f,e.agents),Pu(m,e.agents),Pu(a,e.agents),Pu(l,BF(e.agents.values()));const D=[];let O=!1;for(const $ of j){let F=a.get($.id)??f.get($.id);F||(F=HF($.id,f,m),O=!0),D.push({...$,position:F})}return O&&(v.current=""),{nodes:D,edges:E}}function JW(){return i.jsx(px,{children:i.jsx(eH,{})})}function eH(){var Ki,Xi,Qi,nr;const e=Ql(),t=It(),n=x.useState(Av)[0],s=x.useRef(n),[,a]=x.useState(0),l=x.useCallback(()=>a(B=>B+1),[]),[c,d]=x.useState(BW);x.useEffect(()=>{zW(c)},[c]);const[h,p]=x.useState(()=>new Set),[f,m]=x.useState(null),[y,v]=x.useState(null),N=x.useCallback((B,z)=>{p(oe=>{if(!z)return new Set([B]);const le=new Set(oe);return le.has(B)?le.delete(B):le.add(B),le}),m(oe=>z&&oe===B?oe:B),z||d(!0)},[]),_=x.useCallback(()=>{p(new Set),m(null)},[]),[S,k]=x.useState(null),[j,E]=x.useState(null),C=x.useCallback(B=>E(B),[]),[T,R]=x.useState(!1),[A,D]=x.useState(!1),[O,$]=x.useState(!1),F=x.useRef(null),Z=x.useState(VW)[0],[J,I]=x.useState(qW);x.useEffect(()=>{FW(J)},[J]);const[X,G]=x.useState(UW);x.useEffect(()=>{WW(X)},[X]);const[q,Y]=x.useState(HW);x.useEffect(()=>{GW(q)},[q]);const[L,K]=x.useState(()=>{try{const B=window.localStorage.getItem($C);return B===null?!0:B==="1"}catch{return!0}});x.useEffect(()=>{try{window.localStorage.setItem($C,L?"1":"0")}catch{}},[L]);const P=Ff(L,200),V=Ff(X,130),he=Ff(q,130),[U,W]=x.useState(null);x.useEffect(()=>{let B=null;try{B=localStorage.getItem("agent-dag.sound")}catch{}W(B===null?!0:B==="on")},[]);const ee=x.useCallback(()=>{W(B=>{var oe;const z=B!==!0;try{localStorage.setItem("agent-dag.sound",z?"on":"off")}catch{}return z&&((oe=Ge.current)==null||oe.unlock()),z})},[]),H=x.useCallback(B=>{ee()},[ee]),ae=x.useRef(H);ae.current=H;const me=x.useRef(U);me.current=U;const[ge,Re]=x.useState(()=>sF(wi)),$e=x.useRef(ge);$e.current=ge;const ce=x.useRef(null),we=x.useCallback((B,z=!1)=>{var oe,le;if((oe=Ge.current)==null||oe.unlock(),ce.current!==null&&clearTimeout(ce.current),ce.current=null,!z){(le=Ge.current)==null||le.play(B,!0);return}ce.current=setTimeout(()=>{var je;ce.current=null,(je=Ge.current)==null||je.play(B,!0)},Jq)},[]),xe=x.useCallback((B,z)=>{Re(oe=>{const le={level:Wl(z.level??oe[B].level),figure:X2(B,z.figure??oe[B].figure)};try{localStorage.setItem(Q2[B],String(le.level)),localStorage.setItem(Z2[B],le.figure)}catch{}return{...oe,[B]:le}}),we(B,!0)},[we]);x.useEffect(()=>()=>{ce.current!==null&&clearTimeout(ce.current)},[]);const[De,_e]=x.useState(!1),Ee=x.useRef(null),Ge=x.useRef(null),[st,Je]=x.useState("locked");x.useEffect(()=>{const B=iF({enabled:()=>me.current===!0,prefs:()=>$e.current,onState:Je});Ge.current=B,Je(B.state());const z=()=>B.unlock();return window.addEventListener("pointerdown",z,{once:!0,capture:!0}),window.addEventListener("keydown",z,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",z,{capture:!0}),window.removeEventListener("keydown",z,{capture:!0})}},[]);const[Ze,Qe]=x.useState(!1),[fe,ye]=x.useState(null),[Se,Pe]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(dv)??""}catch{return""}}),[et,ft]=x.useState(!1),dt=x.useRef(0),[ze,Xe]=x.useState(!1),re=x.useCallback((B=!1)=>(B&&(dt.current=Date.now(),Xe(!0)),fetch(B?"/api/version?refresh=1":"/api/version").then(z=>z.ok?z.json():null).then(z=>{z&&ye(z)}).catch(()=>{}).finally(()=>{B&&Xe(!1)})),[]),Fe=x.useCallback(()=>{re(Date.now()-dt.current>=DW)},[re]);x.useEffect(()=>{re();const B=window.setInterval(Fe,5*6e4),z=()=>{document.visibilityState==="visible"&&Fe()};return document.addEventListener("visibilitychange",z),()=>{window.clearInterval(B),document.removeEventListener("visibilitychange",z)}},[re,Fe]),x.useEffect(()=>{Ze&&re()},[Ze,re]),x.useEffect(()=>{const B=gF();let z=null;const oe=Ue=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:B,looking:Ue}),keepalive:!0}).catch(()=>{})},le=()=>{const Ue=pF(document);mF(z,Ue)&&oe(Ue),z=Ue},je=()=>{z&&oe(!1),z=!1};le();const Me=window.setInterval(le,fF);return window.addEventListener("focus",le),window.addEventListener("blur",le),document.addEventListener("visibilitychange",le),window.addEventListener("pagehide",je),()=>{window.clearInterval(Me),window.removeEventListener("focus",le),window.removeEventListener("blur",le),document.removeEventListener("visibilitychange",le),window.removeEventListener("pagehide",je),je()}},[]);const se=(fe==null?void 0:fe.notice)??null,[Ce,Ve]=x.useState(null),gt=x.useRef(!1);x.useEffect(()=>{if(gt.current)return;const B=J1(),z=SF(B),oe=RF({stored:z,running:(fe==null?void 0:fe.running)??null,notes:Z1,remembers:jF(B)});if(oe.reason==="no-version")return;gt.current=!0,oe.record&&EF(B,oe.record);const le=AF({tourSeen:CF(B),decision:oe}),je=oe.show.length?{entries:oe.show,since:z,firstRun:!1}:null;le.tour&&$(!0),le.notes==="now"?Ve(je):le.notes==="after"&&(F.current=je)},[fe==null?void 0:fe.running]);const xt=(fe==null?void 0:fe.running)??"3.22.12",Te=x.useMemo(()=>J2(Z1,null,xt),[xt]),tt=x.useCallback(()=>{Ve({entries:Te,since:null,firstRun:!1})},[Te]),[pt,wt]=x.useState(null),[Yt,Fr]=x.useState(Yv);x.useEffect(()=>{let B=!1;return fetch("/api/health").then(z=>z.ok?z.json():null).then(z=>{B||(Fr(kW(z)),!(!z||typeof z.workspace!="string")&&wt(z.workspace))}).catch(()=>{}),()=>{B=!0}},[Ze]);const Qn=x.useRef(Yt);Qn.current=Yt;const Br=se?`${se.kind}:${se.to}`:"",Zn=se!=null&&Se!==Br,to=x.useCallback(()=>{Pe("");try{window.localStorage.setItem(dv,"")}catch{}},[]),zr=x.useCallback(()=>{if(se){Pe(Br);try{window.localStorage.setItem(dv,Br)}catch{}}},[se,Br]),[Xs,Ur]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(OC)??""}catch{return""}}),Mn=fe!=null&&fe.invokedAs&&fe.invokedAs!==Gt?fe.invokedAs:null,Wr=Mn!=null&&Xs!==Mn,ys=x.useCallback(()=>{if(Mn){Ur(Mn);try{window.localStorage.setItem(OC,Mn)}catch{}}},[Mn]),Ft=((Ki=fe==null?void 0:fe.upgrade)==null?void 0:Ki.state)??"idle",vr=Mq(fe==null?void 0:fe.upgrade),Qs=x.useRef(!1),Ni=x.useCallback(async()=>{if(fr(Qs.current||Ft==="running")){Qs.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await re(),Qs.current=!1}},[Ft,re]);x.useEffect(()=>{if(Ft!=="running")return;const B=window.setInterval(re,3e3);return()=>window.clearInterval(B)},[Ft,re]);const no=x.useCallback(async()=>{const B=fe==null?void 0:fe.command;!B||!await Cx(B)||(ft(!0),window.setTimeout(()=>ft(!1),1600))},[fe==null?void 0:fe.command]),In=x.useCallback(()=>{I(B=>(B||K(!1),!B))},[]),Zs=x.useCallback(()=>{K(B=>(B||I(!1),!B))},[]),[Js,ea]=x.useState(!1),[ta,na]=x.useState(!1),[ra,ro]=x.useState(()=>{try{return Number(localStorage.getItem(r_))||0}catch{return 0}}),[sa,Si]=x.useState([]),[mt,so]=x.useState(!1);x.useEffect(()=>{let B=!0;const z=()=>{fetch("/api/browser-watch?live=0").then(le=>le.ok?le.json():null).then(le=>{var je;!B||!(le!=null&&le.ok)||(Si(le.episodes??[]),so(((je=le.settings)==null?void 0:je.enabled)===!0))}).catch(()=>{})};z();const oe=setInterval(z,5*6e4);return()=>{B=!1,clearInterval(oe)}},[]);const[aa,Hr]=x.useState([]),Gr=x.useRef(new Set),[Vr,oa]=x.useState(null);x.useEffect(()=>{let B=!0,z=0;const oe=()=>{fetch("/api/lan").then(le=>le.ok?le.json():null).then(le=>B?(le!=null&&le.ok&&Hr(F1(Array.isArray(le.pending)?le.pending:[],le.aliases)),le):null).catch(()=>null).then(le=>{B&&(z=window.setTimeout(oe,(le==null?void 0:le.enabled)===!0?Bv:V2))})};return oe(),()=>{B=!1,window.clearTimeout(z)}},[]);const Yr=x.useCallback(async(B,z)=>{if(!Vr){oa(B);try{const le=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:B,fp:z})})).json().catch(()=>null);le&&Array.isArray(le.pending)?Hr(F1(le.pending,le.aliases)):Hr(je=>je.filter(Me=>Me.fp!==z))}catch{}finally{oa(null)}}},[Vr]),Ot=x.useMemo(()=>x8(sa,ra).length,[sa,ra]),[ia,dn]=x.useState(0),cc=x.useRef(null),[Kd,uc]=x.useState(!1),xr=x.useRef(null),[ao,ws]=x.useState(0),en=x.useState(()=>QF({protect:B=>TL(s.current,B)}))[0],[oo,Xd]=x.useState(!1),la=x.useCallback(()=>{const B=en.paused&&en.dropped>0,z=en.setPaused(!en.paused);B&&AL(s.current);for(const oe of z)s.current=Bk(s.current,oe);Xd(en.paused)},[en]),[Tt,ji]=x.useState(Date.now()),[on,io]=x.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(Uu)!=="0"}catch{return!0}}),lo=x.useRef(!1),ut=x.useCallback(()=>{const B=!on;lo.current=!0;try{window.localStorage.removeItem(Uu)}catch{}io(B),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:B})}).then(z=>z.ok?z.json():null).then(z=>{var oe;z!=null&&z.ok&&io(((oe=z.prefs)==null?void 0:oe.autoUpdate)!==!1)}).catch(()=>{})},[on]),[Jn,ca]=x.useState(!1),[Ei,dc]=x.useState("restart"),[Ci,Ti]=x.useState(null),br=x.useRef(!1),ua=x.useRef(null),er=x.useRef(0),_n=x.useCallback(async B=>{if(!fr(br.current))return;const z=(B==null?void 0:B.upgrade)===!0;br.current=!0,ua.current=vr;const oe=++er.current;dc(z?"npx":"restart"),ca(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(se==null?void 0:se.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:z})})}catch{}window.setTimeout(()=>{if(er.current===oe&&br.current){br.current=!1,ca(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},z?18e4:3e4)},[se==null?void 0:se.to,vr]),$n=x.useRef(null);x.useEffect(()=>{const B=V1(s.current.agents.values())>0,z=Lq({enabled:on,kind:se==null?void 0:se.kind,canRestart:(fe==null?void 0:fe.canRestart)===!0,noticeOpen:Zn,visible:document.visibilityState==="visible",busy:B,idleSince:$n.current,now:Tt});$n.current=z.idleSince,z.restart&&_n()},[on,se==null?void 0:se.kind,fe==null?void 0:fe.canRestart,Zn,Tt,_n]);const vs=V1(s.current.agents.values()),xs=Pq(vs),tr=K2({enabled:on,kind:se==null?void 0:se.kind,canRestart:(fe==null?void 0:fe.canRestart)===!0,noticeOpen:Zn,visible:document.visibilityState==="visible",busy:vs>0,idleSince:$n.current,now:Tt});x.useEffect(()=>{const B=fe==null?void 0:fe.running;let z=null,oe=null;try{z=window.sessionStorage.getItem("agent-dag.restartPending"),oe=window.sessionStorage.getItem(PC)}catch{return}const le=Rq({bundle:"3.22.12",running:B,pending:z,lastTried:oe});if(le==="reload"){try{window.sessionStorage.setItem(PC,B??"")}catch{return}window.location.reload();return}if(le!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}br.current=!1,ca(!1),Ti(B??null);const je=window.setTimeout(()=>Ti(null),6e3);return()=>window.clearTimeout(je)},[fe==null?void 0:fe.running]),x.useEffect(()=>{if(Jn&&Iq({asked:ua.current,reported:vr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}br.current=!1,ca(!1)}},[Jn,vr]);const hc=x.useState(()=>dW(YW()))[0],tn=x.useRef(hc.pinned),kr=x.useRef(null),co=x.useState(()=>KW())[0],[uo,ho]=x.useState(()=>new Set),[Kr,fc]=x.useState(JF),[hn,da]=x.useState(()=>EC(AC)),Xr=x.useMemo(()=>cW(hn),[hn]),fo=x.useCallback(B=>lW(B,Xr),[Xr]),Qd=x.useMemo(()=>({background:hn["--panel"],border:`1px solid ${hn["--line"]}`,borderRadius:8}),[hn]),[pc,Ai]=x.useState(!1);x.useEffect(()=>{document.documentElement.dataset.theme=Kr;try{window.localStorage.setItem(rA,Kr)}catch{}da(B=>{const z=EC(AC);return uW(B,z)?B:z})},[Kr]);const On=x.useCallback((B,z)=>{if(Zu({durationMs:z,documentHidden:document.hidden})){e.setViewport(B,{duration:z});return}const{d3Zoom:oe,d3Selection:le}=t.getState(),je=le==null?void 0:le.property("__zoom");if(oe&&le&&je&&je.k>0&&B.zoom>0){oe.transform(le,je.scale(B.zoom/je.k).translate((B.x-je.x)/B.zoom,(B.y-je.y)/B.zoom));return}e.setViewport(B,{duration:0})},[e,t]),Qr=x.useRef(null);x.useEffect(()=>{if(!co)return;const B=window.setTimeout(()=>{try{On(co,0)}catch{}Nn.current=Date.now()},60);return()=>window.clearTimeout(B)},[On,co]);const Ri=x.useRef(!0);x.useEffect(()=>{const B=new EventSource("/events"),z=KF(l,{now:()=>Date.now(),setTimeout:(oe,le)=>window.setTimeout(oe,le),clearTimeout:oe=>window.clearTimeout(oe)});return B.addEventListener("open",()=>{Qe(!0),Ai(!0)}),B.addEventListener("error",()=>Qe(!1)),B.addEventListener("replay-end",()=>{Ri.current=!1,z.flush()}),B.addEventListener("hook",oe=>{var le;try{const je=JSON.parse(oe.data);if(!en.accept(je))return;s.current=Bk(s.current,je);const Me=je.replay===!0||Ri.current||Date.now()-je.receivedAt>3e4;Me?z.replay():z.live();const Ue=oF(je,Me);Ue&&((le=Ge.current)==null||le.play(Ue))}catch{}}),()=>{B.close(),z.cancel()}},[l]),x.useEffect(()=>{const B=setInterval(()=>{const z=Date.now();ji(z);let oe=RL(s.current,z,Fk);ML(s.current,z,Fk)&&(oe=!0),EL(s.current,z,$W,OW)&&(oe=!0),CL(s.current,z,PW,LW)&&(oe=!0),p(le=>FF(le,s.current.agents)),m(le=>le!=null&&!s.current.agents.has(le)?null:le),E(le=>le!=null&&!s.current.agents.has(le)?null:le),k(le=>le!=null&&!s.current.agents.has(le)?null:le),oe&&l()},250);return()=>clearInterval(B)},[l]);const Pn=x.useRef(null),Nn=x.useRef(0),po=420,Sn=x.useCallback((B=500)=>{const z=cv,oe=1,le=.2,je=uv;try{const Me=document.querySelector(".canvas-wrap"),Ue=Array.from(document.querySelectorAll(".react-flow__node")).filter(Et=>Et.offsetWidth>0);if(!Me||Ue.length===0)return;const it=Me.getBoundingClientRect(),Ye=e.getViewport();if(!Number.isFinite(Ye.zoom)||Ye.zoom<=0)return;const at=Et=>(Et-it.left-Ye.x)/Ye.zoom,Kt=Et=>(Et-it.top-Ye.y)/Ye.zoom,Tr=Ue.map(Et=>Et.getBoundingClientRect()),Zi=Math.min(...Tr.map(Et=>at(Et.left))),Ji=Math.max(...Tr.map(Et=>at(Et.right))),js=Math.min(...Tr.map(Et=>Kt(Et.top))),Eo=Math.max(...Tr.map(Et=>Kt(Et.bottom))),es=Ji-Zi,Co=Eo-js;if(!(es>0&&Co>0))return;const Sa=Math.max(le,Math.min(oe,(it.width-MC(Me)-z*2)/(es+po)*je,(it.height-z*2)/Co*je)),ja={x:z-Zi*Sa,y:Math.max(z,(it.height-Co*Sa)/2)-js*Sa,zoom:Sa};On(ja,B),Nn.current=Date.now(),Qr.current=Zu({durationMs:B,documentHidden:document.hidden})?{target:ja,until:Date.now()+B+60}:null,window.setTimeout(()=>{var Et;try{((Et=Qr.current)==null?void 0:Et.target)===ja&&(Qr.current=null);const Ea=e.getViewport();(Math.abs(Ea.zoom-Sa)>.01||Math.abs(Ea.x-ja.x)>2)&&On(ja,0)}catch{}},B+60)}catch{}},[e,On]);x.useEffect(()=>{const B=()=>{if(!document.hidden)return;const z=Qr.current;if(Qr.current=null,!(!z||Date.now()>z.until)){try{On(z.target,0)}catch{}Nn.current=Date.now()}};return document.addEventListener("visibilitychange",B),()=>document.removeEventListener("visibilitychange",B)},[On]);const bs=x.useRef(""),ks=x.useRef(null),Mi=x.useRef(0),Bt=x.useCallback(()=>{Mi.current=Date.now()},[]),_r=x.useRef(null),mo=x.useRef(0),Zr=x.useCallback(()=>{mo.current=Date.now()},[]),mc=x.useCallback(B=>({hasSourceEvent:!!B,at:Date.now(),lastDeckFitAt:Nn.current,lastCanvasInputAt:mo.current}),[]),ha="agent-dag.autoFitDisabled",go=x.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(ha)==="1"}catch{return!1}})[0],Ln=x.useRef(go),[fa,Ii]=x.useState(go),$i=x.useCallback(()=>{if(!Ln.current){Ln.current=!0,Ii(!0);try{window.localStorage.setItem(ha,"1")}catch{}}},[]),Zd=x.useCallback(()=>{Ln.current=!1,Ii(!1);try{window.localStorage.removeItem(ha)}catch{}Sn(400)},[e,Sn]);x.useEffect(()=>{const B=setInterval(()=>{if(Ln.current||Date.now()-Mi.current<800)return;const z=s.current,oe=Date.now(),le=[];for(const Me of z.agents.values())Vv(Me,oe)&&le.push({id:Me.id});if(le.length===0)return;const je=[];for(const{id:Me}of le){const Ue=Nr.current.get(Me),it=tn.current.get(Me)??ln.current.get(Me);!Ue||!it||je.push({x:it.x,y:it.y,width:Ue.width,height:Ue.height})}gW({pane:_r.current,viewport:e.getViewport(),boxes:je})&&Sn(600)},1500);return()=>clearInterval(B)},[e]);const Oi=x.useRef(!1),Nr=x.useRef(new Map),gc=x.useRef(0),Jd=x.useCallback(B=>{const z=Nr.current;let oe=!1;for(const le of B.nodeInternals.values()){const je=le.width,Me=le.height;if(je==null||Me==null)continue;const Ue=z.get(le.id);Ue?(Math.abs(Ue.height-Me)>4||Math.abs(Ue.width-je)>4)&&(z.set(le.id,{width:je,height:Me}),oe=!0):(z.set(le.id,{width:je,height:Me}),oe=!0)}return oe&&(gc.current+=1),gc.current},[]),yc=ht(Jd),[wc,eh]=x.useState(0);x.useEffect(()=>{let B=0;const z=()=>{const le=Nr.current;let je=!1;for(const Me of document.querySelectorAll(".react-flow__node[data-id]")){const Ue=Me.getAttribute("data-id");if(!Ue)continue;const it=Me.offsetWidth,Ye=Me.offsetHeight;if(!it||!Ye)continue;const at=le.get(Ue);(!at||Math.abs(at.width-it)>4||Math.abs(at.height-Ye)>4)&&(le.set(Ue,{width:it,height:Ye}),je=!0)}je&&eh(Me=>Me+1)};if(Oi.current)return;let oe=0;return document.visibilityState==="hidden"?oe=window.setTimeout(z,32):B=requestAnimationFrame(z),()=>{cancelAnimationFrame(B),window.clearTimeout(oe)}});const ln=x.useRef(hc.positions),th=x.useRef(new Set),Pi=x.useRef(""),_s=x.useMemo(()=>{const B=[];for(const z of s.current.agents.values())Vv(z,Tt)&&B.push(z.id+(z.parentId?`>${z.parentId}`:""));return B.sort(),`${B.join("|")}#sv${yc}.${wc}`},[s.current,s.current.revision,Tt,yc,wc]),pa=x.useRef(null);x.useEffect(()=>(pa.current!=null&&window.clearTimeout(pa.current),pa.current=window.setTimeout(()=>{fv(ln.current,tn.current)},1500),()=>{pa.current!=null&&window.clearTimeout(pa.current)}),[_s]),x.useEffect(()=>{if(bs.current===_s)return;const B=bs.current;if(bs.current=_s,!B||Ln.current)return;Date.now()-Nn.current>1200&&Sn(400),Pn.current&&window.clearTimeout(Pn.current),Pn.current=window.setTimeout(()=>{Ln.current||Sn(500)},280)},[_s,e,Sn]);const ma=x.useMemo(()=>UF(s.current,h),[s.current,s.current.revision,h]),Li=x.useMemo(()=>aW(s.current,Tt),[s.current,s.current.revision,Tt]),Di=x.useRef(null),[yo,qi]=x.useState({w:0,h:0});x.useEffect(()=>{const B=Di.current;if(!B||typeof ResizeObserver>"u")return;const z=new ResizeObserver(oe=>{var je;const le=(je=oe[0])==null?void 0:je.contentRect;le&&(_r.current={width:le.width,height:le.height},qi(Me=>Math.abs(Me.w-le.width)>40||Math.abs(Me.h-le.height)>40?{w:le.width,h:le.height}:Me))});return z.observe(B),_r.current={width:B.clientWidth,height:B.clientHeight},qi({w:B.clientWidth,h:B.clientHeight}),()=>z.disconnect()},[]);const nh=x.useCallback(B=>{var oe,le;const z=B.target;!(z!=null&&z.closest)||z.closest(RW)!==B.currentTarget||(B.preventDefault(),(le=(oe=document.activeElement)==null?void 0:oe.blur)==null||le.call(oe))},[]),rh=x.useRef(new Map),[vc,sh]=x.useState(!1);x.useEffect(()=>{const B=window.setTimeout(()=>sh(!0),2500);return()=>window.clearTimeout(B)},[]);const[ah,Fi]=x.useState(!1),Sr=x.useRef(null),[ga,Ns]=x.useState(!1),[oh,xc]=x.useState("full"),Bi=x.useRef("full"),bc=x.useCallback(()=>{Sr.current&&(window.clearTimeout(Sr.current),Sr.current=null),Fi(!1)},[]),kc=x.useCallback(B=>{B.length!==0&&queueMicrotask(()=>{Fi(!0),Sr.current&&window.clearTimeout(Sr.current),Sr.current=window.setTimeout(()=>Fi(!1),MW+80)})},[]);x.useEffect(()=>()=>{Sr.current&&window.clearTimeout(Sr.current)},[]);const[_c,Ss]=x.useState(0);x.useEffect(()=>{const B=MC(Di.current);Ss(z=>Math.abs(z-B)>40?B:z)});const Nc=yo.w>0?Math.max(0,(yo.w-_c-cv*2)*uv):0,Sc=yo.h>0?Math.max(0,(yo.h-cv*2)*uv):0,{nodes:jr,edges:jc}=x.useMemo(()=>ZW(s.current,Tt,Nc,Sc,tn.current,Nr.current,rh.current,kc,vc,ga,ln.current,th.current,_s,Pi,h,ma,Li,C),[s.current,s.current.revision,Tt,Nc,Sc,vc,ga,_s,h,ma,Li,C,ia]),zi=x.useMemo(()=>{const B=new Map;for(const oe of jr){const le=oe.data;if(!(le!=null&&le.sessionId)||le.exitAt!=null)continue;const je=oe.width,Me=oe.height;if(je==null||Me==null)continue;const Ue=oe.position.x,it=oe.position.y,Ye=Ue+je,at=it+Me,Kt=B.get(le.sessionId);Kt?(Kt.minX=Math.min(Kt.minX,Ue),Kt.minY=Math.min(Kt.minY,it),Kt.maxX=Math.max(Kt.maxX,Ye),Kt.maxY=Math.max(Kt.maxY,at)):B.set(le.sessionId,{minX:Ue,minY:it,maxX:Ye,maxY:at})}const z=[];for(const[oe,le]of B){const je=le.maxX-le.minX+zu*2,Me=le.maxY-le.minY+zu*2;z.push({id:`group:${oe}`,type:iR,position:{x:le.minX-zu,y:le.minY-zu},data:{sessionId:oe,w:je,h:Me},width:je,height:Me,style:{width:je,height:Me},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return z},[jr,Tt]),ya=x.useMemo(()=>{const B=[...zi,...jr],z=xr.current;return!z||z.size===0?B:B.map(oe=>{const le=z.get(oe.id);return le?{...oe,position:le}:oe})},[zi,jr,ao]),Er=x.useMemo(()=>{const B=new Set;for(const z of s.current.agents.values())for(const oe of z.tools)B.add(gR(oe.name));return Object.keys(Kv).filter(z=>B.has(z))},[s.current,s.current.revision]);x.useEffect(()=>{if(Er.length<=1){uc(!1);return}let B=0;const z=()=>{const oe=cc.current;if(oe&&!document.hidden){const le=oe.getBoundingClientRect(),je=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Ue=>Ue.getBoundingClientRect()),Me=iW(le,je,8);uc(Ue=>Ue===Me?Ue:Me)}B=window.setTimeout(z,300)};return z(),()=>window.clearTimeout(B)},[Er.length]);const ih=x.useCallback(B=>{ho(z=>{const oe=new Set(z);return oe.has(B)?oe.delete(B):oe.add(B),oe})},[]),zt=f?s.current.agents.get(f):null,Ui=y?Array.from(s.current.agents.values()).flatMap(B=>B.tools).find(B=>B.id===y)??null:null,Wi=x.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=Av(),tn.current.clear(),Nr.current.clear(),ln.current.clear(),Pi.current="",DC(),_(),l()},[l,_]),wo=x.useRef(T);wo.current=T;const vo=x.useRef(A);vo.current=A;const xo=x.useRef(!1);xo.current=Ui!=null||Js||j!=null||O||S!=null||ta||A||Ce!=null;const wa=x.useCallback(B=>{const z=Dq(B,{confirmOpen:wo.current,modalOpen:xo.current});z==="confirm"?R(!0):z==="clear"&&(R(!1),Wi())},[Wi]),bo=x.useCallback(()=>{tn.current.clear(),ln.current.clear(),Pi.current="",DC(),l(),window.setTimeout(()=>Sn(500),80)},[l,e,Sn]),Ec=x.useCallback(()=>Sn(500),[Sn]),ko=x.useRef(jr);ko.current=jr;const Hi=x.useRef(f);Hi.current=f;const _o=x.useCallback(B=>{const z=ko.current,oe=OF(z.map(Me=>({id:Me.id,x:Me.position.x,y:Me.position.y})),Hi.current,B),le=oe?z.find(Me=>Me.id===oe):void 0;if(!le)return;const je=RC(document.activeElement);N(le.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:iv(350),nodes:[le]})}catch{}Nn.current=Date.now(),je&&AW(le.id)},30)},[N,e]),va=x.useCallback(B=>{N(B,!1),window.setTimeout(()=>{try{const z=ko.current.find(oe=>oe.id===B);z&&e.fitView({padding:.3,duration:iv(500),nodes:[z]}),Nn.current=Date.now()}catch{}},60)},[N,e]);x.useEffect(()=>{const B=z=>{var it,Ye;const oe=z.target,le={tagName:oe==null?void 0:oe.tagName,isContentEditable:oe==null?void 0:oe.isContentEditable,role:(it=oe==null?void 0:oe.getAttribute)==null?void 0:it.call(oe,"role"),type:oe==null?void 0:oe.type};if(z.key==="Escape"){const at=o4({overlayOpen:ud.depth()>0,typing:xx(le)});at==="dismiss"?ud.dismissTop():at==="blur"?oe==null||oe.blur():(qF(le)&&(oe==null||oe.blur()),_());return}if(vx(z))return;const je=RC(oe)?(Ye=oe==null?void 0:oe.getAttribute)==null?void 0:Ye.call(oe,"data-id"):null,Me=je&&ko.current.some(at=>at.id===je)?je:null,Ue=LF(z,Me);if(Ue.kind==="activate"){z.preventDefault(),N(Ue.nodeId,Ue.additive);return}if(Ue.kind!=="node"&&!(Ue.nodeId==null&&p4(le))&&!m4({key:z.key,modalOpen:xo.current,sheetOpen:vo.current})){if(z.key===" "&&(z.preventDefault(),la()),(z.key==="c"||z.key==="C")&&wa("shortcut"),(z.key==="r"||z.key==="R")&&bo(),(z.key==="f"||z.key==="F")&&Ec(),(z.key==="l"||z.key==="L")&&In(),z.key==="d"||z.key==="D")if(Hi.current)d(at=>!at);else{const at=Hk(s.current.agents.values());at.length>0?va(at[0].id):_o(1)}(z.key==="h"||z.key==="H")&&ea(at=>!at),(z.key==="u"||z.key==="U")&&G(at=>!at),(z.key==="a"||z.key==="A")&&Qn.current.claude&&Zs(),(z.key==="j"||z.key==="J")&&_o(1),(z.key==="k"||z.key==="K")&&_o(-1),(z.key==="t"||z.key==="T")&&fc(at=>at==="dark"?"light":"dark"),(z.key==="m"||z.key==="M")&&Qn.current.claude&&me.current!==null&&ae.current(z.shiftKey),z.key==="?"&&D(at=>!at)}};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[wa,bo,Ec,_,N,_o,va,la]);const fn=s.current.agents.size,At=x.useMemo(()=>Hk(s.current.agents.values()),[s.current,s.current.revision]),Gi=x.useMemo(()=>JL(s.current.agents.values()),[s.current,s.current.revision]),Vi=x.useRef(null);x.useEffect(()=>{const B=e8({waiting:At.length,running:Gi,connected:Ze}),z=Vi.current;if(Vi.current=B,(z==null?void 0:z.title)!==B.title&&(document.title=B.title),(z==null?void 0:z.icon)!==B.icon){const oe=document.querySelector('link[rel="icon"]');oe&&(oe.href=t8[B.icon])}},[At.length,Gi,Ze]);const[Cc,Tc]=x.useState(""),No=r8(At);x.useEffect(()=>{Tc(B=>s8(B,No))},[No]);const[So,lh]=x.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[pn,xa]=x.useState(null),[Cr,ba]=x.useState(!1),[Ac,ka]=x.useState(!1);x.useEffect(()=>{let B=!0;return fetch("/api/prefs").then(z=>z.ok?z.json():null).then(z=>{var oe,le,je;if(!(!B||!(z!=null&&z.ok))){if(!lo.current){let Me=!1;try{Me=window.localStorage.getItem(Uu)==="0",window.localStorage.removeItem(Uu)}catch{}Me&&((oe=z.prefs)==null?void 0:oe.autoUpdate)!==!1?(io(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):io(((le=z.prefs)==null?void 0:le.autoUpdate)!==!1)}ba(((je=z.prefs)==null?void 0:je.notifications)===!0),ka(z.notificationsVetoed===!0)}}).catch(()=>{}),()=>{B=!1}},[]);const Jr=x.useRef(()=>{}),Yi=x.useCallback(()=>{const B=!Cr;ba(B),B&&typeof Notification<"u"&&Notification.permission==="default"&&Jr.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:B})}).then(z=>z.ok?z.json():null).then(z=>{var oe;z!=null&&z.ok&&(ba(((oe=z.prefs)==null?void 0:oe.notifications)===!0),ka(z.notificationsVetoed===!0))}).catch(()=>{})},[Cr]),Rc=typeof Notification<"u";x.useEffect(()=>{if(!pn)return;const z=setTimeout(()=>xa(null),pn==="blocked"?8e3:4e3);return()=>clearTimeout(z)},[pn]);const _a=x.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(B=>{const z=B;lh(z),z==="granted"?xa("on"):z==="denied"&&xa("blocked")})},[]);Jr.current=_a;const Na=x.useRef(new Set),jo=x.useRef(null),Mc=At.map(B=>Ed(B.id,B.waiting)).join("|");return x.useEffect(()=>{r4(jo.current,So)&&(jo.current=So,Na.current=Gk(At))},[So]),x.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||jo.current===null)return;const B=typeof document>"u"||!document.hidden,z=t4(At,Na.current,B,Cr);for(const oe of z)try{const le=new Notification(oe.title,{body:oe.body,tag:oe.key});le.onclick=()=>{window.focus(),va(oe.sessionId),le.close()}}catch{}Na.current=B?Gk(At):n4(At,z,Na.current)},[Mc]),i.jsxs("div",{className:"app",children:[i.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),i.jsxs("header",{className:"topbar",children:[i.jsxs("div",{className:"readout",children:[i.jsxs("div",{className:"brand",children:[i.jsx("span",{className:"logo"}),i.jsx("h1",{children:Gt}),se?i.jsxs("button",{type:"button",className:"v stale",onClick:()=>{tt(),to()},"aria-haspopup":"dialog","aria-label":xW({...se,open:Zn}),title:se.kind==="restart"?`Running v${se.from}; v${se.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${se.from}; v${se.to} is on npm · click for what's new`,children:["v",se.from,i.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const B={running:xt,latest:fe==null?void 0:fe.latest,latestPending:fe==null?void 0:fe.latestPending,checkedAgo:fe!=null&&fe.checkedAt?Pv(Tt-fe.checkedAt):null,checkDisabled:fe==null?void 0:fe.checkDisabled,checking:ze};return i.jsxs("button",{type:"button",className:ze?"v checking":"v",onClick:()=>{tt(),re(!0)},"aria-busy":ze||void 0,"aria-haspopup":"dialog","aria-label":vW(B),title:wW(B),children:["v",B.running]})})()]}),i.jsx("span",{className:"status",children:(()=>{const B=CW({connected:Ze,paused:oo,held:en.size,dropped:en.dropped});return B.resting?null:i.jsx("span",{className:`pill ${B.tone}`,title:B.title,children:i.jsxs("span",{className:"pill-box",children:[i.jsx("span",{className:"pill-widest","aria-hidden":!0,children:B.widest}),i.jsx("span",{className:"pill-label",children:B.label})]})})})()}),i.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Cc}),At.length>0&&i.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>va(At[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
268
|
+
${At.map(B=>` ${B.label}: ${zl(B.waiting)} (${Pv(Tt-B.waiting.since)})`).join(`
|
|
269
|
+
`)}`,"aria-label":`${At.length} session${At.length===1?"":"s"} waiting for you`,children:[i.jsx("span",{className:"ap-pulse","aria-hidden":!0}),i.jsx("b",{children:At.length})," waiting"]}),pn&&i.jsx("span",{className:pn==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:pn==="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:pn==="on"?"notifications on":"notifications blocked"})]}),zt&&(()=>{const B=An(zt),z=Math.max(0,((zt.endedAt??Tt)-zt.startedAt)/1e3),oe=zt.state==="active"?wx(B.total,z):null,le=h.size-1;return i.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${zt.label}`,onClick:()=>{try{const je=jr.find(Me=>Me.id===zt.id);je&&e.fitView({padding:.35,duration:iv(500),nodes:[je]}),Nn.current=Date.now()}catch{}},children:[i.jsx("span",{className:`state-pill state-${zt.state}`,children:zt.state==="active"?"live":zt.state}),i.jsx("span",{className:"selected-label",children:zt.label}),B.total>0&&i.jsxs("span",{className:"selected-cost",children:[ot(B.total),oe?i.jsxs("span",{className:"selected-rate",children:[" · ",oe]}):null]}),le>0&&i.jsxs("span",{className:"selected-extra",children:["+",le]}),i.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:je=>{je.stopPropagation(),_()},children:"×"})]})})(),i.jsxs("div",{className:"actions",children:[i.jsxs("div",{className:"action-run",children:[i.jsx("button",{className:"btn icon-btn",onClick:In,title:`${J?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":J,"aria-controls":J?"session-list":void 0,children:"☰"}),i.jsx("button",{className:"btn icon-btn",onClick:()=>G(B=>!B),title:`${X?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":X,"aria-controls":X?"usage-panel":void 0,children:"$"}),Yt.claude&&i.jsx("button",{className:"btn icon-btn",onClick:Zs,title:`${L?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":L,"aria-controls":L?"accounts-panel":void 0,children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),i.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),i.jsx("button",{className:"btn icon-btn",onClick:()=>Y(B=>!B),title:`${q?"Hide":"Show"} this machine — cores, memory, temperature`,"aria-label":"Toggle machine detail","aria-expanded":q,"aria-controls":q?"system-panel":void 0,children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[i.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),i.jsx("path",{d:"M5.8 1.4v2.2M8.2 1.4v2.2M5.8 10.4v2.2M8.2 10.4v2.2M1.4 5.8h2.2M1.4 8.2h2.2M10.4 5.8h2.2M10.4 8.2h2.2"})]})}),i.jsx("button",{className:"btn icon-btn",onClick:()=>ea(B=>!B),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[i.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),i.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),i.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),i.jsxs("button",{className:`btn icon-btn bw-btn${Ot>0?" has-findings":mt?" watching":""}`,onClick:()=>na(B=>!B),title:mt?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${mt?"watching":"not watching"}`+(Ot>0?`, ${Ot} unread`:""),"aria-haspopup":"dialog",children:[i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":!0,children:[i.jsx("path",{d:"M0.9 7s2.2-4 6.1-4 6.1 4 6.1 4-2.2 4-6.1 4S0.9 7 0.9 7Z"}),mt||Ot>0?i.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):i.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),Ot>0&&i.jsx("span",{className:"bw-badge","aria-hidden":!0,children:Ot})]})]}),i.jsxs("div",{className:"action-run",children:[Yt.claude&&U!==null&&i.jsxs("div",{className:"sound-slot",children:[i.jsx("button",{ref:Ee,className:"btn icon-btn",onClick:()=>_e(B=>!B),...hr(!1),title:d8(Yt,{on:U===!0,locked:st==="locked",prefs:ge}),"aria-label":"Sound settings","aria-haspopup":"dialog","aria-expanded":De,"aria-controls":De?"sound-menu":void 0,children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),U?i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),i.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M10 5.6l2.6 2.8"}),i.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),De&&i.jsx(hF,{onClose:()=>_e(!1),soundOn:U===!0,onToggleSound:ee,prefs:ge,onLevel:(B,z)=>xe(B,{level:z}),onFigure:(B,z)=>xe(B,{figure:z}),onPreview:B=>we(B),notifyOn:Cr,onToggleNotify:Yi,notifyVetoed:Ac,notifyPermission:Rc?So:"unsupported",onAskNotify:_a,openerRef:Ee})]}),i.jsx("button",{className:"btn icon-btn",onClick:()=>fc(B=>B==="dark"?"light":"dark"),title:`Switch to ${Kr==="dark"?"light":"dark"} mode (T)`,"aria-label":`Switch to ${Kr==="dark"?"light":"dark"} mode`,children:Kr==="dark"?"☀":"☾"})]})]})]}),Ci?i.jsxs("div",{className:"ver-banner done",role:"status",children:[i.jsx("span",{className:"ver-dot"}),i.jsxs("strong",{children:["Restarted — now running v",Ci,"."]}),i.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):pc&&!Ze?i.jsxs("div",{className:"conn-banner",role:"alert",children:[i.jsx("span",{className:"conn-dot"}),Jn?Ei==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Gt}…`:(()=>{const B=jW({connected:Ze,paused:oo});return i.jsxs(i.Fragment,{children:[`Lost connection to the ${Gt} server. Reconnecting…`,B&&i.jsx("span",{className:"conn-sub",children:B})]})})()]}):Zn&&se?i.jsxs("div",{className:`ver-banner ${se.kind}`,role:"status",children:[i.jsx("span",{className:`ver-dot${tr==null?"":" armed"}`}),se.kind==="restart"?i.jsxs(i.Fragment,{children:[i.jsxs("strong",{children:["v",se.to," is installed — this deck still runs v",se.from,"."]}),fe!=null&&fe.canRestart?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"ver-act",onClick:()=>_n(),...hr(Jn),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
270
270
|
|
|
271
|
-
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:Jn?"restarting…":xs.label}),!Jn&&i.jsx("span",{className:"ver-sub",children:xs.clause}),i.jsxs("button",{type:"button",className:`ver-auto${on?" on":""}`,role:"switch","aria-checked":on,onClick:ct,"aria-label":"Auto-restart when idle",title:on?"Updates on its own. While you are here it restarts once nothing has been running for 30 seconds; while you are away it also installs the new version first. Click to require a click instead.":"Only updates when you click. Click to let it update itself when idle or while you are away.",children:[i.jsx("i",{"aria-hidden":!0}),i.jsx("span",{"aria-hidden":!0,children:Oq(on,tr)})]})]}):i.jsx("span",{className:"ver-sub",title:"Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.",children:"Restart it to pick up the new code."})]}):i.jsxs(i.Fragment,{children:[i.jsxs("strong",{children:[Gt," v",se.to," is out — you are on v",se.from,"."]}),(fe==null?void 0:fe.upgradeMode)==="install"&&Ft!=="failed"&&i.jsx("button",{type:"button",className:"ver-act",onClick:ki,...hr(Ft==="running",Ft==="done"),title:`Runs ${((Ki=fe==null?void 0:fe.upgrade)==null?void 0:Ki.command)??(fe==null?void 0:fe.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Ft==="running"?"installing…":Ft==="done"?"installed":"Update now"}),(fe==null?void 0:fe.upgradeMode)==="npx"&&(fe==null?void 0:fe.canRestart)&&i.jsx("button",{type:"button",className:"ver-act",onClick:()=>_n({upgrade:!0}),...hr(Jn),title:`Runs ${fe==null?void 0:fe.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Jn?"fetching…":Ft==="failed"?"Retry update":"Update & restart"}),Ft==="failed"?i.jsxs("span",{className:"ver-sub fail",title:((Xi=fe==null?void 0:fe.upgrade)==null?void 0:Xi.error)??"",children:[(fe==null?void 0:fe.upgradeMode)==="npx"?"update failed":"install failed",": ",((nr=fe==null?void 0:fe.upgrade)==null?void 0:nr.error)??"unknown error"," — run it yourself:"]}):(fe==null?void 0:fe.upgradeMode)==="npx"?i.jsx("span",{className:"ver-sub",children:fe!=null&&fe.canRestart?"npx cannot upgrade in place, so the deck re-runs:":hv.npx}):fe!=null&&fe.upgradeBlocked?i.jsx("span",{className:"ver-sub",children:Object.hasOwn(hv,fe.upgradeBlocked)?hv[fe.upgradeBlocked]:"cannot install from here"}):null,i.jsxs("button",{type:"button",className:"ver-cmd",onClick:to,title:"Copy to clipboard",children:[i.jsx("code",{children:fe==null?void 0:fe.command}),i.jsx("span",{className:"ver-cmd-hint",children:et?"copied":"copy"})]})]}),i.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:zr,children:"×"})]}):Wr&&Mn?i.jsxs("div",{className:"ver-banner",role:"status",children:[i.jsx("span",{className:"ver-dot"}),i.jsxs("strong",{children:[Mn," still works — the deck is called ",Gt," now."]}),fe!=null&&fe.renameFix?i.jsx("span",{className:"ver-sub",children:fe.renameFix}):null,i.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:ys,children:"×"})]}):null,qf(V)&&i.jsx(iD,{state:s.current,now:Tt,providers:Yt,leaving:V==="leaving",onClose:()=>G(!1)}),qf(P)&&Yt.claude&&i.jsx(Cq,{leaving:P==="leaving",onClose:()=>K(!1)}),qf(he)&&i.jsx(LD,{usageOpen:X,leaving:he==="leaving",onClose:()=>Y(!1)}),B&&i.jsx(C5,{state:s.current,now:Tt,selectedIds:c,onSelect:Wi,onClose:()=>Z(!1)}),i.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${ah?" bubbling":""}${ga?" dragging-any":""}`,"data-detail":oh,ref:Pi,onMouseDownCapture:nh,onPointerDownCapture:Zr,onPointerUpCapture:Zr,onWheelCapture:Zr,children:[fn===0&&i.jsx(tH,{live:Ze,everConnected:fc,providers:Yt,workspace:pt,onTour:()=>D(!0)}),(Er.length>1||co.size>0)&&i.jsx("div",{ref:lc,className:`cat-filter-bar${Kd?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Er.map(F=>{const U=co.has(F);return i.jsxs("button",{type:"button",className:`cat-filter${U?" off":""}`,onClick:()=>ih(F),"aria-pressed":!U,title:`${U?"Show":"Hide"} ${Xv[F]} tools`,children:[i.jsx("span",{className:"cat-emoji",children:Kv[F]}),i.jsx("span",{className:"cat-name",children:Xv[F]})]},F)})}),i.jsxs(t2,{nodes:ya,edges:Sc,nodeTypes:TW,fitView:!lo,fitViewOptions:{padding:.25,duration:Zu({durationMs:RC,documentHidden:document.hidden})?RC:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(F,U)=>{if(U.type==="sessionGroup"){v();return}y(U.id,F.shiftKey)},onPaneClick:()=>v(),onMoveStart:F=>{jC(pc(F))&&Mi()},onMove:(F,U)=>{Bt(),jC(pc(F))&&Mi();const oe=IW(U.zoom);oe!==qi.current&&(qi.current=oe,vc(oe)),ks.current&&window.clearTimeout(ks.current),ks.current=window.setTimeout(()=>XW(U),250)},onNodeDragStart:(F,U)=>{var oe;if(xc(),Ii.current=!0,xr.current=new Map,Ns(!0),Bt(),Mi(),U.type==="sessionGroup"){const le=(oe=U.data)==null?void 0:oe.sessionId,je=new Map;if(le)for(const Me of jr){const Ue=Me.data;(Ue==null?void 0:Ue.sessionId)===le&&je.set(Me.id,{x:Me.position.x,y:Me.position.y})}kr.current={start:{x:U.position.x,y:U.position.y},members:je};return}tn.current.set(U.id,{x:U.position.x,y:U.position.y})},onNodeDrag:(F,U)=>{var oe;if(Bt(),U.type==="sessionGroup"){const le=kr.current;if(!le)return;const je=U.position.x-le.start.x,Me=U.position.y-le.start.y;for(const[ot,Ye]of le.members){const ut={x:Ye.x+je,y:Ye.y+Me};tn.current.set(ot,ut),ln.current.set(ot,ut)}const Ue=xr.current;if(Ue){for(const[ot,Ye]of le.members)Ue.set(ot,{x:Ye.x+je,y:Ye.y+Me});Ue.set(U.id,{x:U.position.x,y:U.position.y})}ws(ot=>ot+1);return}tn.current.set(U.id,{x:U.position.x,y:U.position.y}),ln.current.set(U.id,{x:U.position.x,y:U.position.y}),(oe=xr.current)==null||oe.set(U.id,{x:U.position.x,y:U.position.y}),ws(le=>le+1)},onNodeDragStop:(F,U)=>{if(Bt(),Ii.current=!1,xr.current=null,Ns(!1),dn(oe=>oe+1),U.type==="sessionGroup"){const oe=kr.current;if(oe){const le=U.position.x-oe.start.x,je=U.position.y-oe.start.y;for(const[Me,Ue]of oe.members){const ot={x:Ue.x+le,y:Ue.y+je};tn.current.set(Me,ot),ln.current.set(Me,ot)}}kr.current=null,fv(ln.current,tn.current),dn(le=>le+1);return}tn.current.set(U.id,{x:U.position.x,y:U.position.y}),ln.current.set(U.id,{x:U.position.x,y:U.position.y}),fv(ln.current,tn.current)},children:[i.jsx(uL,{gap:28,size:1,color:hn["--grid-line"]}),i.jsx(D4,{onFit:()=>{Nn.current=Date.now()}}),i.jsx(x5,{agents:s.current.agents,visibleAgentIds:Oi,positions:ln.current,pinned:tn.current,measured:Nr.current,spotlight:ma,hiddenCategories:co,now:Tt,onOpenTool:m}),i.jsxs(sL,{showInteractive:!1,children:[i.jsx(Or,{onClick:Zd,title:fa?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:fa?{color:"var(--accent)"}:void 0,children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),i.jsx(Or,{onClick:la,title:SW({paused:ao,held:en.size,dropped:en.dropped}),"aria-label":NW,"aria-pressed":ao,children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:i.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),i.jsx(Or,{onClick:xo,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),i.jsx(Or,{onClick:()=>wa("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),i.jsx("path",{d:"M9 6.2V4.4a1.6 1.6 0 0 1 1.6-1.6h2.8a1.6 1.6 0 0 1 1.6 1.6v1.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),i.jsx("path",{d:"M17.4 6.4 16.7 20a2 2 0 0 1-2 1.9H9.3a2 2 0 0 1-2-1.9L6.6 6.4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),i.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),i.jsx(Or,{onClick:()=>R(F=>!F),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("path",{d:"M8.6 8.4a3.5 3.5 0 1 1 4.6 3.35c-.85.3-1.2 1-1.2 1.85v1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),i.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),i.jsx(Q3,{zoomable:!0,pannable:!0,nodeColor:ho,nodeStrokeWidth:2,maskColor:hn["--minimap-mask"],style:Qd})]})]}),J&&zt?i.jsxs("aside",{className:"detail","aria-label":"Detail",children:[i.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>I(!1),children:"×"}),i.jsx(rH,{agent:zt,now:Tt,onOpenTool:m,onShowSummary:F=>{$.has(F)&&($.delete(F),OC($)),_(F)},onExportSession:F=>QW(s.current,F)})]}):null,Bi&&i.jsx(A4,{tool:Bi,onClose:()=>m(null)}),Js&&i.jsx(g8,{providers:Yt,onClose:()=>ea(!1)}),ta&&i.jsx(C8,{onClose:()=>na(!1),onSeen:F=>{no(F);try{localStorage.setItem(t_,String(F))}catch{}},onWatching:ro,palette:hn}),S&&(()=>{const F=s.current.agents.get(S);return F?i.jsx(b4,{agent:F,onClose:()=>k(null)}):null})(),N&&i.jsx(S5,{state:s.current,sessionId:N,onClose:()=>{$.add(N),OC($),_(null)}}),Ce&&i.jsx(IF,{entries:Ce.entries,since:Ce.since,firstRun:Ce.firstRun,running:xt,onClose:()=>Ve(null),onTour:()=>{Ve(null),D(!0)}}),(()=>{const{request:F,waiting:U}=A8(aa,Gr.current);return F?i.jsx(R8,{request:F,waiting:U,busy:Vr,now:Date.now(),onAccept:()=>void Yr("accept",F.fp),onDecline:()=>void Yr("dismiss",F.fp),onLater:()=>{Vr||(Gr.current.add(F.fp),Hr(oe=>[...oe]))}}):null})(),T&&i.jsx(Hq,{onClose:()=>R(!1),onTour:()=>{R(!1),D(!0)}}),A&&i.jsx(z2,{title:"What the deck shows you",steps:B6,onClose:()=>{D(!1),TF(Q1());const F=O.current;O.current=null,F&&Ve(F)}}),E&&i.jsx(zq,{agentCount:fn,onConfirm:()=>wa("confirmation"),onCancel:()=>C(!1)})]})}function tH({live:e,everConnected:t,providers:n,workspace:s,onTour:a}){const l=!e;return i.jsxs("div",{className:"empty-hero",children:[i.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[i.jsx("div",{className:"core"}),i.jsxs("div",{className:"orbit r1",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]}),i.jsxs("div",{className:"orbit r2",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]}),i.jsxs("div",{className:"orbit r3",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]})]}),l?i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),i.jsxs("p",{children:["The browser cannot reach ",i.jsx("code",{children:"/events"}),". Check that",i.jsx("code",{children:Gt})," is still running in your terminal, then this page will resume automatically."]})]}):nH(n,s),!l&&i.jsx("button",{type:"button",className:"btn empty-tour",onClick:a,children:"Take the tour"})]})}function nH(e,t){const n=bW(t);return i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?i.jsxs("p",{children:[n.lead," ",i.jsx("code",{children:n.workspace}),n.tail]}):i.jsxs("p",{children:["Run ",i.jsx("code",{children:"claude"})," or ",i.jsx("code",{children:"codex"})," in any folder. As soon as a session sends an event, a node appears here and grows as subagents fork and tools are called."]}),i.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",i.jsx("code",{children:Gt})," is running."]}),u8(e).map(s=>i.jsx("p",{className:"hint-row",children:s.spans.map((a,l)=>a.code?i.jsx("code",{children:a.text},l):i.jsx("span",{children:a.text},l))},s.provider))]})}function rH({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:a}){const l=cd(e.startedAt,e.endedAt,t),c=An(e),d=c.total>0,h=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const _=mR(N.name);p.set(_,(p.get(_)??0)+1)}const f=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]),v=p.has("mcp")?m5(e.tools.map(N=>N.name)):null;return i.jsxs(i.Fragment,{children:[i.jsxs("header",{className:"detail-hero",children:[i.jsxs("div",{className:"hero-line",children:[i.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),i.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),i.jsxs("div",{className:"hero-meta",children:[i.jsx("span",{className:"hero-meta-item",children:e.kind}),i.jsx("span",{className:"hero-sep",children:"·"}),i.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:l}),e.model&&(()=>{const N=g2(e);return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"hero-sep",children:"·"}),i.jsxs("span",{className:"model-chip","data-family":jd(e.model),title:N.length>0?`${e.model}
|
|
271
|
+
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:Jn?"restarting…":xs.label}),!Jn&&i.jsx("span",{className:"ver-sub",children:xs.clause}),i.jsxs("button",{type:"button",className:`ver-auto${on?" on":""}`,role:"switch","aria-checked":on,onClick:ut,"aria-label":"Auto-restart when idle",title:on?"Updates on its own. While you are here it restarts once nothing has been running for 30 seconds; while you are away it also installs the new version first. Click to require a click instead.":"Only updates when you click. Click to let it update itself when idle or while you are away.",children:[i.jsx("i",{"aria-hidden":!0}),i.jsx("span",{"aria-hidden":!0,children:Oq(on,tr)})]})]}):i.jsx("span",{className:"ver-sub",title:"Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.",children:"Restart it to pick up the new code."})]}):i.jsxs(i.Fragment,{children:[i.jsxs("strong",{children:[Gt," v",se.to," is out — you are on v",se.from,"."]}),(fe==null?void 0:fe.upgradeMode)==="install"&&Ft!=="failed"&&i.jsx("button",{type:"button",className:"ver-act",onClick:Ni,...hr(Ft==="running",Ft==="done"),title:`Runs ${((Xi=fe==null?void 0:fe.upgrade)==null?void 0:Xi.command)??(fe==null?void 0:fe.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Ft==="running"?"installing…":Ft==="done"?"installed":"Update now"}),(fe==null?void 0:fe.upgradeMode)==="npx"&&(fe==null?void 0:fe.canRestart)&&i.jsx("button",{type:"button",className:"ver-act",onClick:()=>_n({upgrade:!0}),...hr(Jn),title:`Runs ${fe==null?void 0:fe.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Jn?"fetching…":Ft==="failed"?"Retry update":"Update & restart"}),Ft==="failed"?i.jsxs("span",{className:"ver-sub fail",title:((Qi=fe==null?void 0:fe.upgrade)==null?void 0:Qi.error)??"",children:[(fe==null?void 0:fe.upgradeMode)==="npx"?"update failed":"install failed",": ",((nr=fe==null?void 0:fe.upgrade)==null?void 0:nr.error)??"unknown error"," — run it yourself:"]}):(fe==null?void 0:fe.upgradeMode)==="npx"?i.jsx("span",{className:"ver-sub",children:fe!=null&&fe.canRestart?"npx cannot upgrade in place, so the deck re-runs:":hv.npx}):fe!=null&&fe.upgradeBlocked?i.jsx("span",{className:"ver-sub",children:Object.hasOwn(hv,fe.upgradeBlocked)?hv[fe.upgradeBlocked]:"cannot install from here"}):null,i.jsxs("button",{type:"button",className:"ver-cmd",onClick:no,title:"Copy to clipboard",children:[i.jsx("code",{children:fe==null?void 0:fe.command}),i.jsx("span",{className:"ver-cmd-hint",children:et?"copied":"copy"})]})]}),i.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:zr,children:"×"})]}):Wr&&Mn?i.jsxs("div",{className:"ver-banner",role:"status",children:[i.jsx("span",{className:"ver-dot"}),i.jsxs("strong",{children:[Mn," still works — the deck is called ",Gt," now."]}),fe!=null&&fe.renameFix?i.jsx("span",{className:"ver-sub",children:fe.renameFix}):null,i.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:ys,children:"×"})]}):null,qf(V)&&i.jsx(iD,{state:s.current,now:Tt,providers:Yt,leaving:V==="leaving",onClose:()=>G(!1)}),qf(P)&&Yt.claude&&i.jsx(Cq,{leaving:P==="leaving",onClose:()=>K(!1)}),qf(he)&&i.jsx(LD,{usageOpen:X,leaving:he==="leaving",onClose:()=>Y(!1)}),J&&i.jsx(C5,{state:s.current,now:Tt,selectedIds:h,onSelect:va,onClose:()=>I(!1)}),i.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${ah?" bubbling":""}${ga?" dragging-any":""}`,"data-detail":oh,ref:Di,onMouseDownCapture:nh,onPointerDownCapture:Zr,onPointerUpCapture:Zr,onWheelCapture:Zr,children:[fn===0&&i.jsx(tH,{live:Ze,everConnected:pc,providers:Yt,workspace:pt,onTour:()=>$(!0)}),(Er.length>1||uo.size>0)&&i.jsx("div",{ref:cc,className:`cat-filter-bar${Kd?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Er.map(B=>{const z=uo.has(B);return i.jsxs("button",{type:"button",className:`cat-filter${z?" off":""}`,onClick:()=>ih(B),"aria-pressed":!z,title:`${z?"Show":"Hide"} ${Xv[B]} tools`,children:[i.jsx("span",{className:"cat-emoji",children:Kv[B]}),i.jsx("span",{className:"cat-name",children:Xv[B]})]},B)})}),i.jsxs(r2,{nodes:ya,edges:jc,nodeTypes:TW,fitView:!co,fitViewOptions:{padding:.25,duration:Zu({durationMs:IC,documentHidden:document.hidden})?IC:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(B,z)=>{if(z.type==="sessionGroup"){_();return}N(z.id,B.shiftKey)},onPaneClick:()=>_(),onMoveStart:B=>{CC(mc(B))&&$i()},onMove:(B,z)=>{Bt(),CC(mc(B))&&$i();const oe=IW(z.zoom);oe!==Bi.current&&(Bi.current=oe,xc(oe)),ks.current&&window.clearTimeout(ks.current),ks.current=window.setTimeout(()=>XW(z),250)},onNodeDragStart:(B,z)=>{var oe;if(bc(),Oi.current=!0,xr.current=new Map,Ns(!0),Bt(),$i(),z.type==="sessionGroup"){const le=(oe=z.data)==null?void 0:oe.sessionId,je=new Map;if(le)for(const Me of jr){const Ue=Me.data;(Ue==null?void 0:Ue.sessionId)===le&&je.set(Me.id,{x:Me.position.x,y:Me.position.y})}kr.current={start:{x:z.position.x,y:z.position.y},members:je};return}tn.current.set(z.id,{x:z.position.x,y:z.position.y})},onNodeDrag:(B,z)=>{var oe;if(Bt(),z.type==="sessionGroup"){const le=kr.current;if(!le)return;const je=z.position.x-le.start.x,Me=z.position.y-le.start.y;for(const[it,Ye]of le.members){const at={x:Ye.x+je,y:Ye.y+Me};tn.current.set(it,at),ln.current.set(it,at)}const Ue=xr.current;if(Ue){for(const[it,Ye]of le.members)Ue.set(it,{x:Ye.x+je,y:Ye.y+Me});Ue.set(z.id,{x:z.position.x,y:z.position.y})}ws(it=>it+1);return}tn.current.set(z.id,{x:z.position.x,y:z.position.y}),ln.current.set(z.id,{x:z.position.x,y:z.position.y}),(oe=xr.current)==null||oe.set(z.id,{x:z.position.x,y:z.position.y}),ws(le=>le+1)},onNodeDragStop:(B,z)=>{if(Bt(),Oi.current=!1,xr.current=null,Ns(!1),dn(oe=>oe+1),z.type==="sessionGroup"){const oe=kr.current;if(oe){const le=z.position.x-oe.start.x,je=z.position.y-oe.start.y;for(const[Me,Ue]of oe.members){const it={x:Ue.x+le,y:Ue.y+je};tn.current.set(Me,it),ln.current.set(Me,it)}}kr.current=null,fv(ln.current,tn.current),dn(le=>le+1);return}tn.current.set(z.id,{x:z.position.x,y:z.position.y}),ln.current.set(z.id,{x:z.position.x,y:z.position.y}),fv(ln.current,tn.current)},children:[i.jsx(dL,{gap:28,size:1,color:hn["--grid-line"]}),i.jsx(D4,{onFit:()=>{Nn.current=Date.now()}}),i.jsx(x5,{agents:s.current.agents,visibleAgentIds:Li,positions:ln.current,pinned:tn.current,measured:Nr.current,spotlight:ma,hiddenCategories:uo,now:Tt,onOpenTool:v}),i.jsxs(aL,{showInteractive:!1,children:[i.jsx(Or,{onClick:Zd,title:fa?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:fa?{color:"var(--accent)"}:void 0,children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),i.jsx(Or,{onClick:la,title:SW({paused:oo,held:en.size,dropped:en.dropped}),"aria-label":NW,"aria-pressed":oo,children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:i.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),i.jsx(Or,{onClick:bo,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),i.jsx(Or,{onClick:()=>wa("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),i.jsx("path",{d:"M9 6.2V4.4a1.6 1.6 0 0 1 1.6-1.6h2.8a1.6 1.6 0 0 1 1.6 1.6v1.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),i.jsx("path",{d:"M17.4 6.4 16.7 20a2 2 0 0 1-2 1.9H9.3a2 2 0 0 1-2-1.9L6.6 6.4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),i.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),i.jsx(Or,{onClick:()=>D(B=>!B),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("path",{d:"M8.6 8.4a3.5 3.5 0 1 1 4.6 3.35c-.85.3-1.2 1-1.2 1.85v1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),i.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),i.jsx(Z3,{zoomable:!0,pannable:!0,nodeColor:fo,nodeStrokeWidth:2,maskColor:hn["--minimap-mask"],style:Qd})]})]}),c&&zt?i.jsxs("aside",{className:"detail","aria-label":"Detail",children:[i.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>d(!1),children:"×"}),i.jsx(rH,{agent:zt,now:Tt,onOpenTool:v,onShowSummary:B=>{Z.has(B)&&(Z.delete(B),LC(Z)),k(B)},onExportSession:B=>QW(s.current,B)})]}):null,Ui&&i.jsx(A4,{tool:Ui,onClose:()=>v(null)}),Js&&i.jsx(g8,{providers:Yt,onClose:()=>ea(!1)}),ta&&i.jsx(C8,{onClose:()=>na(!1),onSeen:B=>{ro(B);try{localStorage.setItem(r_,String(B))}catch{}},onWatching:so,palette:hn}),j&&(()=>{const B=s.current.agents.get(j);return B?i.jsx(b4,{agent:B,onClose:()=>E(null)}):null})(),S&&i.jsx(S5,{state:s.current,sessionId:S,onClose:()=>{Z.add(S),LC(Z),k(null)}}),Ce&&i.jsx(IF,{entries:Ce.entries,since:Ce.since,firstRun:Ce.firstRun,running:xt,onClose:()=>Ve(null),onTour:()=>{Ve(null),$(!0)}}),(()=>{const{request:B,waiting:z}=A8(aa,Gr.current);return B?i.jsx(R8,{request:B,waiting:z,busy:Vr,now:Date.now(),onAccept:()=>void Yr("accept",B.fp),onDecline:()=>void Yr("dismiss",B.fp),onLater:()=>{Vr||(Gr.current.add(B.fp),Hr(oe=>[...oe]))}}):null})(),A&&i.jsx(Hq,{onClose:()=>D(!1),onTour:()=>{D(!1),$(!0)}}),O&&i.jsx(W2,{title:"What the deck shows you",steps:B6,onClose:()=>{$(!1),TF(J1());const B=F.current;F.current=null,B&&Ve(B)}}),T&&i.jsx(zq,{agentCount:fn,onConfirm:()=>wa("confirmation"),onCancel:()=>R(!1)})]})}function tH({live:e,everConnected:t,providers:n,workspace:s,onTour:a}){const l=!e;return i.jsxs("div",{className:"empty-hero",children:[i.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[i.jsx("div",{className:"core"}),i.jsxs("div",{className:"orbit r1",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]}),i.jsxs("div",{className:"orbit r2",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]}),i.jsxs("div",{className:"orbit r3",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]})]}),l?i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),i.jsxs("p",{children:["The browser cannot reach ",i.jsx("code",{children:"/events"}),". Check that",i.jsx("code",{children:Gt})," is still running in your terminal, then this page will resume automatically."]})]}):nH(n,s),!l&&i.jsx("button",{type:"button",className:"btn empty-tour",onClick:a,children:"Take the tour"})]})}function nH(e,t){const n=bW(t);return i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?i.jsxs("p",{children:[n.lead," ",i.jsx("code",{children:n.workspace}),n.tail]}):i.jsxs("p",{children:["Run ",i.jsx("code",{children:"claude"})," or ",i.jsx("code",{children:"codex"})," in any folder. As soon as a session sends an event, a node appears here and grows as subagents fork and tools are called."]}),i.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",i.jsx("code",{children:Gt})," is running."]}),u8(e).map(s=>i.jsx("p",{className:"hint-row",children:s.spans.map((a,l)=>a.code?i.jsx("code",{children:a.text},l):i.jsx("span",{children:a.text},l))},s.provider))]})}function rH({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:a}){const l=cd(e.startedAt,e.endedAt,t),c=An(e),d=c.total>0,h=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const _=gR(N.name);p.set(_,(p.get(_)??0)+1)}const f=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]),v=p.has("mcp")?m5(e.tools.map(N=>N.name)):null;return i.jsxs(i.Fragment,{children:[i.jsxs("header",{className:"detail-hero",children:[i.jsxs("div",{className:"hero-line",children:[i.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),i.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),i.jsxs("div",{className:"hero-meta",children:[i.jsx("span",{className:"hero-meta-item",children:e.kind}),i.jsx("span",{className:"hero-sep",children:"·"}),i.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:l}),e.model&&(()=>{const N=w2(e);return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"hero-sep",children:"·"}),i.jsxs("span",{className:"model-chip","data-family":jd(e.model),title:N.length>0?`${e.model}
|
|
272
272
|
spend on this panel also covers:
|
|
273
273
|
${N.join(`
|
|
274
|
-
`)}`:e.model,children:[Vs(e.model),N.length>0?` +${N.length}`:""]})]})})()]}),d&&i.jsxs("div",{className:"hero-cost",children:[i.jsxs("div",{className:"hero-cost-headline",children:[i.jsx("span",{className:"hero-cost-value",children:
|
|
274
|
+
`)}`:e.model,children:[Vs(e.model),N.length>0?` +${N.length}`:""]})]})})()]}),d&&i.jsxs("div",{className:"hero-cost",children:[i.jsxs("div",{className:"hero-cost-headline",children:[i.jsx("span",{className:"hero-cost-value",children:ot(c.total)}),i.jsx("span",{className:"hero-cost-label",children:"spend"})]}),i.jsx(kx,{cost:c})]}),i.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&i.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&&i.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>a(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&i.jsxs("section",{className:"detail-section",children:[i.jsx("h3",{children:"Activity"}),i.jsxs("div",{className:"activity-row",children:[i.jsxs("div",{className:"activity-counters",children:[i.jsxs("span",{className:"ac-item",children:[i.jsx("b",{children:e.toolCount})," calls"]}),m>0&&i.jsxs("span",{className:"ac-item ac-live",children:[i.jsx("b",{children:m})," live"]}),f>0&&i.jsxs("span",{className:"ac-item ac-err",children:[i.jsx("b",{children:f})," err"]})]}),i.jsx("div",{className:"cat-strip",children:y.map(([N,_])=>{const S=N==="mcp"?v:null,k=S==null?void 0:S.hue,j=`${_} ${Xv[N]} call${_===1?"":"s"}`;return i.jsxs("span",{className:`cat-chip cat-${N}${k!=null?" mcp-hue":""}`,style:k!=null?{"--mcp-hue":k}:void 0,title:S?`${j}, all to ${S.label}`:j,children:[i.jsx("span",{className:"cat-emoji",children:Kv[N]}),i.jsx("span",{className:"cat-count",children:_}),S&&i.jsx("span",{className:"cat-server",children:S.label})]},N)})})]})]}),h>0&&i.jsxs("section",{className:"detail-section",children:[i.jsx("h3",{children:"Tokens"}),i.jsxs("div",{className:"tokens-grid",children:[i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"in"}),i.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"out"}),i.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"cache r"}),i.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"cache c"}),i.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),i.jsxs("section",{className:"detail-section",children:[i.jsx("h3",{children:"Identity"}),i.jsxs("div",{children:[e.cwd&&i.jsxs("div",{className:"row",children:[i.jsx("span",{className:"k",children:"cwd"}),i.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),i.jsxs("div",{className:"row",children:[i.jsx("span",{className:"k",children:"session"}),i.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&i.jsxs("div",{className:"row",children:[i.jsx("span",{className:"k",children:"parent"}),i.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&i.jsxs("section",{className:"detail-section",children:[i.jsxs("h3",{children:["Prompts ",i.jsx("span",{className:"section-count",children:e.prompts.length})]}),i.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((N,_)=>{const S=H5(N.at,t);return i.jsxs("div",{className:"prompt-entry",children:[i.jsx("div",{className:"prompt-time",title:S.title,children:S.label}),i.jsx("div",{className:"prompt-text",children:N.text})]},_)})})]}),i.jsxs("section",{className:"detail-section",children:[i.jsxs("h3",{children:["Tool calls ",i.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&i.jsx("div",{className:"empty",children:"No tool calls yet."}),i.jsx("div",{children:e.tools.slice().reverse().map(N=>i.jsx(aH,{t:N,onClick:()=>n(N.id)},N.id))})]})]})}const sH={inflight:"in-flight",done:"done",err:"error"};function aH({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=x2(e,"…");return i.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[i.jsxs("span",{className:"name",children:[i.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:sH[n]}),e.name]}),i.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{U5(window.localStorage)}catch{}const oH=uM.createRoot(document.getElementById("root"));oH.render(i.jsx(JW,{}));
|