agent-dag 3.18.0 → 3.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/{index-DYh8wtpn.js → index-BLZ602Di.js} +33 -33
- package/dist/web/assets/{index-Dp5_CD7C.css → index-Ba2dbqwU.css} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/release-notes.json +6 -0
- package/src/server/lan-engine.mjs +43 -2
- package/src/server/lan-socket.mjs +14 -4
- package/src/server/lan-sync.mjs +74 -5
|
@@ -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 lb;function gM(){if(lb)return Ke;lb=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.iterator;function y(L){return L===null||typeof L!="object"?null:(L=g&&L[g]||L["@@iterator"],typeof L=="function"?L:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,k={};function E(L,K,ue){this.props=L,this.context=K,this.refs=k,this.updater=ue||w}E.prototype.isReactComponent={},E.prototype.setState=function(L,K){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,K,"setState")},E.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function _(){}_.prototype=E.prototype;function S(L,K,ue){this.props=L,this.context=K,this.refs=k,this.updater=ue||w}var j=S.prototype=new _;j.constructor=S,N(j,E.prototype),j.isPureReactComponent=!0;var C=Array.isArray,M=Object.prototype.hasOwnProperty,$={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function z(L,K,ue){var G,U={},ee=null,Y=null;if(K!=null)for(G in K.ref!==void 0&&(Y=K.ref),K.key!==void 0&&(ee=""+K.key),K)M.call(K,G)&&!I.hasOwnProperty(G)&&(U[G]=K[G]);var le=arguments.length-2;if(le===1)U.children=ue;else if(1<le){for(var fe=Array(le),me=0;me<le;me++)fe[me]=arguments[me+2];U.children=fe}if(L&&L.defaultProps)for(G in le=L.defaultProps,le)U[G]===void 0&&(U[G]=le[G]);return{$$typeof:e,type:L,key:ee,ref:Y,props:U,_owner:$.current}}function O(L,K){return{$$typeof:e,type:L.type,key:K,ref:L.ref,props:L.props,_owner:L._owner}}function A(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function D(L){var K={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(ue){return K[ue]})}var H=/\/+/g;function X(L,K){return typeof L=="object"&&L!==null&&L.key!=null?D(""+L.key):K.toString(36)}function R(L,K,ue,G,U){var ee=typeof L;(ee==="undefined"||ee==="boolean")&&(L=null);var Y=!1;if(L===null)Y=!0;else switch(ee){case"string":case"number":Y=!0;break;case"object":switch(L.$$typeof){case e:case t:Y=!0}}if(Y)return Y=L,U=U(Y),L=G===""?"."+X(Y,0):G,C(U)?(ue="",L!=null&&(ue=L.replace(H,"$&/")+"/"),R(U,K,ue,"",function(me){return me})):U!=null&&(A(U)&&(U=O(U,ue+(!U.key||Y&&Y.key===U.key?"":(""+U.key).replace(H,"$&/")+"/")+L)),K.push(U)),1;if(Y=0,G=G===""?".":G+":",C(L))for(var le=0;le<L.length;le++){ee=L[le];var fe=G+X(ee,le);Y+=R(ee,K,ue,fe,U)}else if(fe=y(L),typeof fe=="function")for(L=fe.call(L),le=0;!(ee=L.next()).done;)ee=ee.value,fe=G+X(ee,le++),Y+=R(ee,K,ue,fe,U);else if(ee==="object")throw K=String(L),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.");return Y}function Z(L,K,ue){if(L==null)return L;var G=[],U=0;return R(L,G,"","",function(ee){return K.call(ue,ee,U++)}),G}function B(L){if(L._status===-1){var K=L._result;K=K(),K.then(function(ue){(L._status===0||L._status===-1)&&(L._status=1,L._result=ue)},function(ue){(L._status===0||L._status===-1)&&(L._status=2,L._result=ue)}),L._status===-1&&(L._status=0,L._result=K)}if(L._status===1)return L._result.default;throw L._result}var Q={current:null},P={transition:null},F={ReactCurrentDispatcher:Q,ReactCurrentBatchConfig:P,ReactCurrentOwner:$};function J(){throw Error("act(...) is not supported in production builds of React.")}return Ke.Children={map:Z,forEach:function(L,K,ue){Z(L,function(){K.apply(this,arguments)},ue)},count:function(L){var K=0;return Z(L,function(){K++}),K},toArray:function(L){return Z(L,function(K){return K})||[]},only:function(L){if(!A(L))throw Error("React.Children.only expected to receive a single React element child.");return L}},Ke.Component=E,Ke.Fragment=n,Ke.Profiler=a,Ke.PureComponent=S,Ke.StrictMode=s,Ke.Suspense=f,Ke.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=F,Ke.act=J,Ke.cloneElement=function(L,K,ue){if(L==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+L+".");var G=N({},L.props),U=L.key,ee=L.ref,Y=L._owner;if(K!=null){if(K.ref!==void 0&&(ee=K.ref,Y=$.current),K.key!==void 0&&(U=""+K.key),L.type&&L.type.defaultProps)var le=L.type.defaultProps;for(fe in K)M.call(K,fe)&&!I.hasOwnProperty(fe)&&(G[fe]=K[fe]===void 0&&le!==void 0?le[fe]:K[fe])}var fe=arguments.length-2;if(fe===1)G.children=ue;else if(1<fe){le=Array(fe);for(var me=0;me<fe;me++)le[me]=arguments[me+2];G.children=le}return{$$typeof:e,type:L.type,key:U,ref:ee,props:G,_owner:Y}},Ke.createContext=function(L){return L={$$typeof:l,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},L.Provider={$$typeof:i,_context:L},L.Consumer=L},Ke.createElement=z,Ke.createFactory=function(L){var K=z.bind(null,L);return K.type=L,K},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(L){return{$$typeof:d,render:L}},Ke.isValidElement=A,Ke.lazy=function(L){return{$$typeof:h,_payload:{_status:-1,_result:L},_init:B}},Ke.memo=function(L,K){return{$$typeof:p,type:L,compare:K===void 0?null:K}},Ke.startTransition=function(L){var K=P.transition;P.transition={};try{L()}finally{P.transition=K}},Ke.unstable_act=J,Ke.useCallback=function(L,K){return Q.current.useCallback(L,K)},Ke.useContext=function(L){return Q.current.useContext(L)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(L){return Q.current.useDeferredValue(L)},Ke.useEffect=function(L,K){return Q.current.useEffect(L,K)},Ke.useId=function(){return Q.current.useId()},Ke.useImperativeHandle=function(L,K,ue){return Q.current.useImperativeHandle(L,K,ue)},Ke.useInsertionEffect=function(L,K){return Q.current.useInsertionEffect(L,K)},Ke.useLayoutEffect=function(L,K){return Q.current.useLayoutEffect(L,K)},Ke.useMemo=function(L,K){return Q.current.useMemo(L,K)},Ke.useReducer=function(L,K,ue){return Q.current.useReducer(L,K,ue)},Ke.useRef=function(L){return Q.current.useRef(L)},Ke.useState=function(L){return Q.current.useState(L)},Ke.useSyncExternalStore=function(L,K,ue){return Q.current.useSyncExternalStore(L,K,ue)},Ke.useTransition=function(){return Q.current.useTransition()},Ke.version="18.3.1",Ke}var cb;function $l(){return cb||(cb=1,nf.exports=gM()),nf.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 ub;function yM(){if(ub)return sl;ub=1;var e=$l(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function l(d,f,p){var h,g={},y=null,w=null;p!==void 0&&(y=""+p),f.key!==void 0&&(y=""+f.key),f.ref!==void 0&&(w=f.ref);for(h in f)s.call(f,h)&&!i.hasOwnProperty(h)&&(g[h]=f[h]);if(d&&d.defaultProps)for(h in f=d.defaultProps,f)g[h]===void 0&&(g[h]=f[h]);return{$$typeof:t,type:d,key:y,ref:w,props:g,_owner:a.current}}return sl.Fragment=n,sl.jsx=l,sl.jsxs=l,sl}var db;function vM(){return db||(db=1,tf.exports=yM()),tf.exports}var c=vM(),su={},rf={exports:{}},gn={},sf={exports:{}},af={};/**
|
|
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 hb;function wM(){return hb||(hb=1,(function(e){function t(P,F){var J=P.length;P.push(F);e:for(;0<J;){var L=J-1>>>1,K=P[L];if(0<a(K,F))P[L]=F,P[J]=K,J=L;else break e}}function n(P){return P.length===0?null:P[0]}function s(P){if(P.length===0)return null;var F=P[0],J=P.pop();if(J!==F){P[0]=J;e:for(var L=0,K=P.length,ue=K>>>1;L<ue;){var G=2*(L+1)-1,U=P[G],ee=G+1,Y=P[ee];if(0>a(U,J))ee<K&&0>a(Y,U)?(P[L]=Y,P[ee]=J,L=ee):(P[L]=U,P[G]=J,L=G);else if(ee<K&&0>a(Y,J))P[L]=Y,P[ee]=J,L=ee;else break e}}return F}function a(P,F){var J=P.sortIndex-F.sortIndex;return J!==0?J:P.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,d=l.now();e.unstable_now=function(){return l.now()-d}}var f=[],p=[],h=1,g=null,y=3,w=!1,N=!1,k=!1,E=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(P){for(var F=n(p);F!==null;){if(F.callback===null)s(p);else if(F.startTime<=P)s(p),F.sortIndex=F.expirationTime,t(f,F);else break;F=n(p)}}function C(P){if(k=!1,j(P),!N)if(n(f)!==null)N=!0,B(M);else{var F=n(p);F!==null&&Q(C,F.startTime-P)}}function M(P,F){N=!1,k&&(k=!1,_(z),z=-1),w=!0;var J=y;try{for(j(F),g=n(f);g!==null&&(!(g.expirationTime>F)||P&&!D());){var L=g.callback;if(typeof L=="function"){g.callback=null,y=g.priorityLevel;var K=L(g.expirationTime<=F);F=e.unstable_now(),typeof K=="function"?g.callback=K:g===n(f)&&s(f),j(F)}else s(f);g=n(f)}if(g!==null)var ue=!0;else{var G=n(p);G!==null&&Q(C,G.startTime-F),ue=!1}return ue}finally{g=null,y=J,w=!1}}var $=!1,I=null,z=-1,O=5,A=-1;function D(){return!(e.unstable_now()-A<O)}function H(){if(I!==null){var P=e.unstable_now();A=P;var F=!0;try{F=I(!0,P)}finally{F?X():($=!1,I=null)}}else $=!1}var X;if(typeof S=="function")X=function(){S(H)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,Z=R.port2;R.port1.onmessage=H,X=function(){Z.postMessage(null)}}else X=function(){E(H,0)};function B(P){I=P,$||($=!0,X())}function Q(P,F){z=E(function(){P(e.unstable_now())},F)}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(P){P.callback=null},e.unstable_continueExecution=function(){N||w||(N=!0,B(M))},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(P){switch(y){case 1:case 2:case 3:var F=3;break;default:F=y}var J=y;y=F;try{return P()}finally{y=J}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(P,F){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var J=y;y=P;try{return F()}finally{y=J}},e.unstable_scheduleCallback=function(P,F,J){var L=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?L+J:L):J=L,P){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=J+K,P={id:h++,callback:F,priorityLevel:P,startTime:J,expirationTime:K,sortIndex:-1},J>L?(P.sortIndex=J,t(p,P),n(f)===null&&P===n(p)&&(k?(_(z),z=-1):k=!0,Q(C,J-L))):(P.sortIndex=K,t(f,P),N||w||(N=!0,B(M))),P},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(P){var F=y;return function(){var J=y;y=F;try{return P.apply(this,arguments)}finally{y=J}}}})(af)),af}var fb;function xM(){return fb||(fb=1,sf.exports=wM()),sf.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
|
|
33
|
+
*/var pb;function bM(){if(pb)return gn;pb=1;var e=$l(),t=xM();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 i(r,o){l(r,o),l(r+"Capture",o)}function l(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"),f=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},g={};function y(r){return f.call(g,r)?!0:f.call(h,r)?!1:p.test(r)?g[r]=!0:(h[r]=!0,!1)}function w(r,o,u,m){if(u!==null&&u.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return m?!1:u!==null?!u.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function N(r,o,u,m){if(o===null||typeof o>"u"||w(r,o,u,m))return!0;if(m)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 k(r,o,u,m,v,x,T){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=m,this.attributeNamespace=v,this.mustUseProperty=u,this.propertyName=r,this.type=o,this.sanitizeURL=x,this.removeEmptyString=T}var E={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){E[r]=new k(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];E[o]=new k(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){E[r]=new k(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){E[r]=new k(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){E[r]=new k(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){E[r]=new k(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){E[r]=new k(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){E[r]=new k(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){E[r]=new k(r,5,!1,r.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function S(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var o=r.replace(_,S);E[o]=new k(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(_,S);E[o]=new k(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(_,S);E[o]=new k(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){E[r]=new k(r,1,!1,r.toLowerCase(),null,!1,!1)}),E.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){E[r]=new k(r,1,!1,r.toLowerCase(),null,!0,!0)});function j(r,o,u,m){var v=E.hasOwnProperty(o)?E[o]:null;(v!==null?v.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(N(o,u,v,m)&&(u=null),m||v===null?y(o)&&(u===null?r.removeAttribute(o):r.setAttribute(o,""+u)):v.mustUseProperty?r[v.propertyName]=u===null?v.type===3?!1:"":u:(o=v.attributeName,m=v.attributeNamespace,u===null?r.removeAttribute(o):(v=v.type,u=v===3||v===4&&u===!0?"":""+u,m?r.setAttributeNS(m,o,u):r.setAttribute(o,u))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,M=Symbol.for("react.element"),$=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),D=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),Q=Symbol.for("react.offscreen"),P=Symbol.iterator;function F(r){return r===null||typeof r!="object"?null:(r=P&&r[P]||r["@@iterator"],typeof r=="function"?r:null)}var J=Object.assign,L;function K(r){if(L===void 0)try{throw Error()}catch(u){var o=u.stack.trim().match(/\n( *(at )?)/);L=o&&o[1]||""}return`
|
|
34
34
|
`+L+r}var ue=!1;function G(r,o){if(!r||ue)return"";ue=!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(ce){var m=ce}Reflect.construct(r,[],o)}else{try{o.call()}catch(ce){m=ce}r.call(o.prototype)}else{try{throw Error()}catch(ce){m=ce}r()}}catch(ce){if(ce&&m&&typeof ce.stack=="string"){for(var v=ce.stack.split(`
|
|
35
35
|
`),x=m.stack.split(`
|
|
36
36
|
`),T=v.length-1,V=x.length-1;1<=T&&0<=V&&v[T]!==x[V];)V--;for(;1<=T&&0<=V;T--,V--)if(v[T]!==x[V]){if(T!==1||V!==1)do if(T--,V--,0>V||v[T]!==x[V]){var te=`
|
|
37
|
-
`+v[T].replace(" at new "," at ");return r.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",r.displayName)),te}while(1<=T&&0<=V);break}}}finally{ue=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?K(r):""}function U(r){switch(r.tag){case 5:return K(r.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("SuspenseList");case 0:case 2:case 15:return r=G(r.type,!1),r;case 11:return r=G(r.type.render,!1),r;case 1:return r=G(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 I:return"Fragment";case $:return"Portal";case O:return"Profiler";case z:return"StrictMode";case X:return"Suspense";case R:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case D:return(r.displayName||"Context")+".Consumer";case A:return(r._context.displayName||"Context")+".Provider";case H:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Z:return o=r.displayName||null,o!==null?o:ee(r.type)||"Memo";case B:o=r._payload,r=r._init;try{return ee(r(o))}catch{}}return null}function Y(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===z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function le(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function fe(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function me(r){var o=fe(r)?"checked":"value",u=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),m=""+r[o];if(!r.hasOwnProperty(o)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var v=u.get,x=u.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return v.call(this)},set:function(T){m=""+T,x.call(this,T)}}),Object.defineProperty(r,o,{enumerable:u.enumerable}),{getValue:function(){return m},setValue:function(T){m=""+T},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function ke(r){r._valueTracker||(r._valueTracker=me(r))}function Ve(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var u=o.getValue(),m="";return r&&(m=fe(r)?r.checked?"true":"false":r.value),r=m,r!==u?(o.setValue(r),!0):!1}function Le(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 qe(r,o){var u=o.checked;return J({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??r._wrapperState.initialChecked})}function Ne(r,o){var u=o.defaultValue==null?"":o.defaultValue,m=o.checked!=null?o.checked:o.defaultChecked;u=le(o.value!=null?o.value:u),r._wrapperState={initialChecked:m,initialValue:u,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function Ge(r,o){o=o.checked,o!=null&&j(r,"checked",o,!1)}function be(r,o){Ge(r,o);var u=le(o.value),m=o.type;if(u!=null)m==="number"?(u===0&&r.value===""||r.value!=u)&&(r.value=""+u):r.value!==""+u&&(r.value=""+u);else if(m==="submit"||m==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Qe(r,o.type,u):o.hasOwnProperty("defaultValue")&&Qe(r,o.type,le(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function re(r,o,u){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var m=o.type;if(!(m!=="submit"&&m!=="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 Qe(r,o,u){(o!=="number"||Le(r.ownerDocument)!==r)&&(u==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+u&&(r.defaultValue=""+u))}var ft=Array.isArray;function ut(r,o,u,m){if(r=r.options,o){o={};for(var v=0;v<u.length;v++)o["$"+u[v]]=!0;for(u=0;u<r.length;u++)v=o.hasOwnProperty("$"+r[u].value),r[u].selected!==v&&(r[u].selected=v),v&&m&&(r[u].defaultSelected=!0)}else{for(u=""+le(u),o=null,v=0;v<r.length;v++){if(r[v].value===u){r[v].selected=!0,m&&(r[v].defaultSelected=!0);return}o!==null||r[v].disabled||(o=r[v])}o!==null&&(o.selected=!0)}}function at(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return J({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Ye(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(ft(u)){if(1<u.length)throw Error(n(93));u=u[0]}o=u}o==null&&(o=""),u=o}r._wrapperState={initialValue:le(u)}}function pe(r,o){var u=le(o.value),m=le(o.defaultValue);u!=null&&(u=""+u,u!==r.value&&(r.value=u),o.defaultValue==null&&r.defaultValue!==u&&(r.defaultValue=u)),m!=null&&(r.defaultValue=""+m)}function we(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function Pe(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 Ue(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?Pe(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var ot,$e=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,u,m,v){MSApp.execUnsafeLocalFunction(function(){return r(o,u,m,v)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(ot=ot||document.createElement("div"),ot.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=ot.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function se(r,o){if(o){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=o;return}}r.textContent=o}var Se={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},De=["Webkit","ms","Moz","O"];Object.keys(Se).forEach(function(r){De.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Se[o]=Se[r]})});function _e(r,o,u){return o==null||typeof o=="boolean"||o===""?"":u||typeof o!="number"||o===0||Se.hasOwnProperty(r)&&Se[r]?(""+o).trim():o+"px"}function Be(r,o){r=r.style;for(var u in o)if(o.hasOwnProperty(u)){var m=u.indexOf("--")===0,v=_e(u,o[u],m);u==="float"&&(u="cssFloat"),m?r.setProperty(u,v):r[u]=v}}var _t=J({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 vt(r,o){if(o){if(_t[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 Ae(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 it=null;function wt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var xt=null,nn=null,rn=null;function In(r){if(r=Ui(r)){if(typeof xt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=vc(o),xt(r.stateNode,r.type,o))}}function Da(r){nn?rn?rn.push(r):rn=[r]:nn=r}function qa(){if(nn){var r=nn,o=rn;if(rn=nn=null,In(r),o)for(r=0;r<o.length;r++)In(o[r])}}function Fa(r,o){return r(o)}function wn(){}var Bs=!1;function za(r,o,u){if(Bs)return r(o,u);Bs=!0;try{return Fa(r,o,u)}finally{Bs=!1,(nn!==null||rn!==null)&&(wn(),qa())}}function $t(r,o){var u=r.stateNode;if(u===null)return null;var m=vc(u);if(m===null)return null;u=m[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":(m=!m.disabled)||(r=r.type,m=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!m;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(n(231,o,typeof u));return u}var mr=!1;if(d)try{var Kn={};Object.defineProperty(Kn,"passive",{get:function(){mr=!0}}),window.addEventListener("test",Kn,Kn),window.removeEventListener("test",Kn,Kn)}catch{mr=!1}function li(r,o,u,m,v,x,T,V,te){var ce=Array.prototype.slice.call(arguments,3);try{o.apply(u,ce)}catch(ye){this.onError(ye)}}var Rr=!1,Ar=null,Mr=!1,is=null,Us={onError:function(r){Rr=!0,Ar=r}};function Ba(r,o,u,m,v,x,T,V,te){Rr=!1,Ar=null,li.apply(Us,arguments)}function Ws(r,o,u,m,v,x,T,V,te){if(Ba.apply(this,arguments),Rr){if(Rr){var ce=Ar;Rr=!1,Ar=null}else throw Error(n(198));Mr||(Mr=!0,is=ce)}}function $n(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 Ua(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 Hs(r){if($n(r)!==r)throw Error(n(188))}function ci(r){var o=r.alternate;if(!o){if(o=$n(r),o===null)throw Error(n(188));return o!==r?null:r}for(var u=r,m=o;;){var v=u.return;if(v===null)break;var x=v.alternate;if(x===null){if(m=v.return,m!==null){u=m;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===u)return Hs(v),r;if(x===m)return Hs(v),o;x=x.sibling}throw Error(n(188))}if(u.return!==m.return)u=v,m=x;else{for(var T=!1,V=v.child;V;){if(V===u){T=!0,u=v,m=x;break}if(V===m){T=!0,m=v,u=x;break}V=V.sibling}if(!T){for(V=x.child;V;){if(V===u){T=!0,u=x,m=v;break}if(V===m){T=!0,m=x,u=v;break}V=V.sibling}if(!T)throw Error(n(189))}}if(u.alternate!==m)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?r:o}function Ir(r){return r=ci(r),r!==null?Gs(r):null}function Gs(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=Gs(r);if(o!==null)return o;r=r.sibling}return null}var Wa=t.unstable_scheduleCallback,$r=t.unstable_cancelCallback,Vs=t.unstable_shouldYield,ls=t.unstable_requestPaint,dt=t.unstable_now,Ha=t.unstable_getCurrentPriorityLevel,On=t.unstable_ImmediatePriority,Ga=t.unstable_UserBlockingPriority,Or=t.unstable_NormalPriority,Ys=t.unstable_LowPriority,Va=t.unstable_IdlePriority,Pr=null,qt=null;function Ks(r){if(qt&&typeof qt.onCommitFiberRoot=="function")try{qt.onCommitFiberRoot(Pr,r,void 0,(r.current.flags&128)===128)}catch{}}var on=Math.clz32?Math.clz32:Td,xn=Math.log,Ya=Math.LN2;function Td(r){return r>>>=0,r===0?32:31-(xn(r)/Ya|0)|0}var cs=64,St=4194304;function Xs(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 Pn(r,o){var u=r.pendingLanes;if(u===0)return 0;var m=0,v=r.suspendedLanes,x=r.pingedLanes,T=u&268435455;if(T!==0){var V=T&~v;V!==0?m=Xs(V):(x&=T,x!==0&&(m=Xs(x)))}else T=u&~v,T!==0?m=Xs(T):x!==0&&(m=Xs(x));if(m===0)return 0;if(o!==0&&o!==m&&(o&v)===0&&(v=m&-m,x=o&-o,v>=x||v===16&&(x&4194240)!==0))return o;if((m&4)!==0&&(m|=u&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=m;0<o;)u=31-on(o),v=1<<u,m|=r[u],o&=~v;return m}function Rd(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 Ad(r,o){for(var u=r.suspendedLanes,m=r.pingedLanes,v=r.expirationTimes,x=r.pendingLanes;0<x;){var T=31-on(x),V=1<<T,te=v[T];te===-1?((V&u)===0||(V&m)!==0)&&(v[T]=Rd(V,o)):te<=o&&(r.expiredLanes|=V),x&=~V}}function Ln(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Qs(){var r=cs;return cs<<=1,(cs&4194240)===0&&(cs=64),r}function ui(r){for(var o=[],u=0;31>u;u++)o.push(r);return o}function Zs(r,o,u){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-on(o),r[o]=u}function Xl(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 m=r.eventTimes;for(r=r.expirationTimes;0<u;){var v=31-on(u),x=1<<v;o[v]=0,m[v]=-1,r[v]=-1,u&=~x}}function Ka(r,o){var u=r.entangledLanes|=o;for(r=r.entanglements;u;){var m=31-on(u),v=1<<m;v&o|r[m]&o&&(r[m]|=o),u&=~v}}var Ze=0;function di(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var hi,us,Xa,fi,pi,Qa=!1,Js=[],Nt=null,bn=null,kn=null,Lr=new Map,ea=new Map,ln=[],Ql="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 Xn(r,o){switch(r){case"focusin":case"focusout":Nt=null;break;case"dragenter":case"dragleave":bn=null;break;case"mouseover":case"mouseout":kn=null;break;case"pointerover":case"pointerout":Lr.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":ea.delete(o.pointerId)}}function ta(r,o,u,m,v,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:u,eventSystemFlags:m,nativeEvent:x,targetContainers:[v]},o!==null&&(o=Ui(o),o!==null&&us(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),r)}function Zl(r,o,u,m,v){switch(o){case"focusin":return Nt=ta(Nt,r,o,u,m,v),!0;case"dragenter":return bn=ta(bn,r,o,u,m,v),!0;case"mouseover":return kn=ta(kn,r,o,u,m,v),!0;case"pointerover":var x=v.pointerId;return Lr.set(x,ta(Lr.get(x)||null,r,o,u,m,v)),!0;case"gotpointercapture":return x=v.pointerId,ea.set(x,ta(ea.get(x)||null,r,o,u,m,v)),!0}return!1}function Jl(r){var o=ha(r.target);if(o!==null){var u=$n(o);if(u!==null){if(o=u.tag,o===13){if(o=Ua(u),o!==null){r.blockedOn=o,pi(r.priority,function(){Xa(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 Za(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var u=na(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(u===null){u=r.nativeEvent;var m=new u.constructor(u.type,u);it=m,u.target.dispatchEvent(m),it=null}else return o=Ui(u),o!==null&&us(o),r.blockedOn=u,!1;o.shift()}return!0}function mi(r,o,u){Za(r)&&u.delete(o)}function Md(){Qa=!1,Nt!==null&&Za(Nt)&&(Nt=null),bn!==null&&Za(bn)&&(bn=null),kn!==null&&Za(kn)&&(kn=null),Lr.forEach(mi),ea.forEach(mi)}function _n(r,o){r.blockedOn===o&&(r.blockedOn=null,Qa||(Qa=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Md)))}function Qn(r){function o(v){return _n(v,r)}if(0<Js.length){_n(Js[0],r);for(var u=1;u<Js.length;u++){var m=Js[u];m.blockedOn===r&&(m.blockedOn=null)}}for(Nt!==null&&_n(Nt,r),bn!==null&&_n(bn,r),kn!==null&&_n(kn,r),Lr.forEach(o),ea.forEach(o),u=0;u<ln.length;u++)m=ln[u],m.blockedOn===r&&(m.blockedOn=null);for(;0<ln.length&&(u=ln[0],u.blockedOn===null);)Jl(u),u.blockedOn===null&&ln.shift()}var Dr=C.ReactCurrentBatchConfig,ds=!0;function Zn(r,o,u,m){var v=Ze,x=Dr.transition;Dr.transition=null;try{Ze=1,cn(r,o,u,m)}finally{Ze=v,Dr.transition=x}}function Id(r,o,u,m){var v=Ze,x=Dr.transition;Dr.transition=null;try{Ze=4,cn(r,o,u,m)}finally{Ze=v,Dr.transition=x}}function cn(r,o,u,m){if(ds){var v=na(r,o,u,m);if(v===null)Hd(r,o,m,hs,u),Xn(r,m);else if(Zl(v,r,o,u,m))m.stopPropagation();else if(Xn(r,m),o&4&&-1<Ql.indexOf(r)){for(;v!==null;){var x=Ui(v);if(x!==null&&hi(x),x=na(r,o,u,m),x===null&&Hd(r,o,m,hs,u),x===v)break;v=x}v!==null&&m.stopPropagation()}else Hd(r,o,m,null,u)}}var hs=null;function na(r,o,u,m){if(hs=null,r=wt(m),r=ha(r),r!==null)if(o=$n(r),o===null)r=null;else if(u=o.tag,u===13){if(r=Ua(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 hs=r,null}function gi(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(Ha()){case On:return 1;case Ga:return 4;case Or:case Ys:return 16;case Va:return 536870912;default:return 16}default:return 16}}var Sn=null,ra=null,sa=null;function Ja(){if(sa)return sa;var r,o=ra,u=o.length,m,v="value"in Sn?Sn.value:Sn.textContent,x=v.length;for(r=0;r<u&&o[r]===v[r];r++);var T=u-r;for(m=1;m<=T&&o[u-m]===v[x-m];m++);return sa=v.slice(r,1<m?1-m:void 0)}function aa(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 fs(){return!0}function yi(){return!1}function Tt(r){function o(u,m,v,x,T){this._reactName=u,this._targetInst=v,this.type=m,this.nativeEvent=x,this.target=T,this.currentTarget=null;for(var V in r)r.hasOwnProperty(V)&&(u=r[V],this[V]=u?u(x):x[V]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?fs:yi,this.isPropagationStopped=yi,this}return J(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=fs)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=fs)},persist:function(){},isPersistent:fs}),o}var qr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},eo=Tt(qr),Fr=J({},qr,{view:0,detail:0}),$d=Tt(Fr),oa,gr,ps,to=J({},Fr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ro,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!==ps&&(ps&&r.type==="mousemove"?(oa=r.screenX-ps.screenX,gr=r.screenY-ps.screenY):gr=oa=0,ps=r),oa)},movementY:function(r){return"movementY"in r?r.movementY:gr}}),vi=Tt(to),ec=J({},to,{dataTransfer:0}),Od=Tt(ec),un=J({},Fr,{relatedTarget:0}),wi=Tt(un),xi=J({},qr,{animationName:0,elapsedTime:0,pseudoElement:0}),ms=Tt(xi),ia=J({},qr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),bi=Tt(ia),ki=J({},qr,{data:0}),_i=Tt(ki),no={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},tc={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"},Pd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ld(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Pd[r])?!!o[r]:!1}function ro(){return Ld}var Dd=J({},Fr,{key:function(r){if(r.key){var o=no[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=aa(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?tc[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ro,charCode:function(r){return r.type==="keypress"?aa(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?aa(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),qd=Tt(Dd),Si=J({},to,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jn=Tt(Si),Ni=J({},Fr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ro}),nc=Tt(Ni),Fd=J({},qr,{propertyName:0,elapsedTime:0,pseudoElement:0}),zd=Tt(Fd),rc=J({},to,{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}),sc=Tt(rc),yr=[9,13,27,32],Ei=d&&"CompositionEvent"in window,gs=null;d&&"documentMode"in document&&(gs=document.documentMode);var Bd=d&&"TextEvent"in window&&!gs,la=d&&(!Ei||gs&&8<gs&&11>=gs),ac=" ",Yt=!1;function so(r,o){switch(r){case"keyup":return yr.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ji(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var zr=!1;function oc(r,o){switch(r){case"compositionend":return ji(o);case"keypress":return o.which!==32?null:(Yt=!0,ac);case"textInput":return r=o.data,r===ac&&Yt?null:r;default:return null}}function Ci(r,o){if(zr)return r==="compositionend"||!Ei&&so(r,o)?(r=Ja(),sa=ra=Sn=null,zr=!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 la&&o.locale!=="ko"?null:o.data;default:return null}}var ao={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 oo(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!ao[r.type]:o==="textarea"}function Ti(r,o,u,m){Da(m),o=mc(o,"onChange"),0<o.length&&(u=new eo("onChange","change",null,u,m),r.push({event:u,listeners:o}))}var vr=null,ys=null;function Ri(r){qi(r,0)}function vs(r){var o=mo(r);if(Ve(o))return r}function ic(r,o){if(r==="change")return o}var Ot=!1;if(d){var io;if(d){var lo="oninput"in document;if(!lo){var lc=document.createElement("div");lc.setAttribute("oninput","return;"),lo=typeof lc.oninput=="function"}io=lo}else io=!1;Ot=io&&(!document.documentMode||9<document.documentMode)}function cc(){vr&&(vr.detachEvent("onpropertychange",Ai),ys=vr=null)}function Ai(r){if(r.propertyName==="value"&&vs(ys)){var o=[];Ti(o,ys,r,wt(r)),za(Ri,o)}}function ca(r,o,u){r==="focusin"?(cc(),vr=o,ys=u,vr.attachEvent("onpropertychange",Ai)):r==="focusout"&&cc()}function Ud(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return vs(ys)}function Br(r,o){if(r==="click")return vs(o)}function Mi(r,o){if(r==="input"||r==="change")return vs(o)}function Wd(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var Nn=typeof Object.is=="function"?Object.is:Wd;function En(r,o){if(Nn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var u=Object.keys(r),m=Object.keys(o);if(u.length!==m.length)return!1;for(m=0;m<u.length;m++){var v=u[m];if(!f.call(o,v)||!Nn(r[v],o[v]))return!1}return!0}function co(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function uc(r,o){var u=co(r);r=0;for(var m;u;){if(u.nodeType===3){if(m=r+u.textContent.length,r<=o&&m>=o)return{node:u,offset:o-r};r=m}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=co(u)}}function Ii(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Ii(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function $i(){for(var r=window,o=Le();o instanceof r.HTMLIFrameElement;){try{var u=typeof o.contentWindow.location.href=="string"}catch{u=!1}if(u)r=o.contentWindow;else break;o=Le(r.document)}return o}function Oi(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 dc(r){var o=$i(),u=r.focusedElem,m=r.selectionRange;if(o!==u&&u&&u.ownerDocument&&Ii(u.ownerDocument.documentElement,u)){if(m!==null&&Oi(u)){if(o=m.start,r=m.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 v=u.textContent.length,x=Math.min(m.start,v);m=m.end===void 0?x:Math.min(m.end,v),!r.extend&&x>m&&(v=m,m=x,x=v),v=uc(u,x);var T=uc(u,m);v&&T&&(r.rangeCount!==1||r.anchorNode!==v.node||r.anchorOffset!==v.offset||r.focusNode!==T.node||r.focusOffset!==T.offset)&&(o=o.createRange(),o.setStart(v.node,v.offset),r.removeAllRanges(),x>m?(r.addRange(o),r.extend(T.node,T.offset)):(o.setEnd(T.node,T.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 Pi=d&&"documentMode"in document&&11>=document.documentMode,wr=null,ws=null,Ur=null,Li=!1;function Di(r,o,u){var m=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Li||wr==null||wr!==Le(m)||(m=wr,"selectionStart"in m&&Oi(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Ur&&En(Ur,m)||(Ur=m,m=mc(ws,"onSelect"),0<m.length&&(o=new eo("onSelect","select",null,o,u),r.push({event:o,listeners:m}),o.target=wr)))}function ua(r,o){var u={};return u[r.toLowerCase()]=o.toLowerCase(),u["Webkit"+r]="webkit"+o,u["Moz"+r]="moz"+o,u}var Wr={animationend:ua("Animation","AnimationEnd"),animationiteration:ua("Animation","AnimationIteration"),animationstart:ua("Animation","AnimationStart"),transitionend:ua("Transition","TransitionEnd")},uo={},q={};d&&(q=document.createElement("div").style,"AnimationEvent"in window||(delete Wr.animationend.animation,delete Wr.animationiteration.animation,delete Wr.animationstart.animation),"TransitionEvent"in window||delete Wr.transitionend.transition);function W(r){if(uo[r])return uo[r];if(!Wr[r])return r;var o=Wr[r],u;for(u in o)if(o.hasOwnProperty(u)&&u in q)return uo[r]=o[u];return r}var ie=W("animationend"),de=W("animationiteration"),je=W("animationstart"),Re=W("transitionend"),He=new Map,et="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 rt(r,o){He.set(r,o),i(o,[r])}for(var st=0;st<et.length;st++){var Kt=et[st],ho=Kt.toLowerCase(),hc=Kt[0].toUpperCase()+Kt.slice(1);rt(ho,"on"+hc)}rt(ie,"onAnimationEnd"),rt(de,"onAnimationIteration"),rt(je,"onAnimationStart"),rt("dblclick","onDoubleClick"),rt("focusin","onFocus"),rt("focusout","onBlur"),rt(Re,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var da="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(" "),fc=new Set("cancel close invalid load scroll toggle".split(" ").concat(da));function pc(r,o,u){var m=r.type||"unknown-event";r.currentTarget=u,Ws(m,o,void 0,r),r.currentTarget=null}function qi(r,o){o=(o&4)!==0;for(var u=0;u<r.length;u++){var m=r[u],v=m.event;m=m.listeners;e:{var x=void 0;if(o)for(var T=m.length-1;0<=T;T--){var V=m[T],te=V.instance,ce=V.currentTarget;if(V=V.listener,te!==x&&v.isPropagationStopped())break e;pc(v,V,ce),x=te}else for(T=0;T<m.length;T++){if(V=m[T],te=V.instance,ce=V.currentTarget,V=V.listener,te!==x&&v.isPropagationStopped())break e;pc(v,V,ce),x=te}}}if(Mr)throw r=is,Mr=!1,is=null,r}function lt(r,o){var u=o[Qd];u===void 0&&(u=o[Qd]=new Set);var m=r+"__bubble";u.has(m)||(Fi(o,r,2,!1),u.add(m))}function Hr(r,o,u){var m=0;o&&(m|=4),Fi(u,r,m,o)}var xr="_reactListening"+Math.random().toString(36).slice(2);function mt(r){if(!r[xr]){r[xr]=!0,s.forEach(function(u){u!=="selectionchange"&&(fc.has(u)||Hr(u,!1,r),Hr(u,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[xr]||(o[xr]=!0,Hr("selectionchange",!1,o))}}function Fi(r,o,u,m){switch(gi(o)){case 1:var v=Zn;break;case 4:v=Id;break;default:v=cn}u=v.bind(null,o,u,r),v=void 0,!mr||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),m?v!==void 0?r.addEventListener(o,u,{capture:!0,passive:v}):r.addEventListener(o,u,!0):v!==void 0?r.addEventListener(o,u,{passive:v}):r.addEventListener(o,u,!1)}function Hd(r,o,u,m,v){var x=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var V=m.stateNode.containerInfo;if(V===v||V.nodeType===8&&V.parentNode===v)break;if(T===4)for(T=m.return;T!==null;){var te=T.tag;if((te===3||te===4)&&(te=T.stateNode.containerInfo,te===v||te.nodeType===8&&te.parentNode===v))return;T=T.return}for(;V!==null;){if(T=ha(V),T===null)return;if(te=T.tag,te===5||te===6){m=x=T;continue e}V=V.parentNode}}m=m.return}za(function(){var ce=x,ye=wt(u),ve=[];e:{var ge=He.get(r);if(ge!==void 0){var Ee=eo,Te=r;switch(r){case"keypress":if(aa(u)===0)break e;case"keydown":case"keyup":Ee=qd;break;case"focusin":Te="focus",Ee=wi;break;case"focusout":Te="blur",Ee=wi;break;case"beforeblur":case"afterblur":Ee=wi;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":Ee=vi;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ee=Od;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ee=nc;break;case ie:case de:case je:Ee=ms;break;case Re:Ee=zd;break;case"scroll":Ee=$d;break;case"wheel":Ee=sc;break;case"copy":case"cut":case"paste":Ee=bi;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ee=Jn}var Me=(o&4)!==0,Ct=!Me&&r==="scroll",ae=Me?ge!==null?ge+"Capture":null:ge;Me=[];for(var ne=ce,oe;ne!==null;){oe=ne;var xe=oe.stateNode;if(oe.tag===5&&xe!==null&&(oe=xe,ae!==null&&(xe=$t(ne,ae),xe!=null&&Me.push(zi(ne,xe,oe)))),Ct)break;ne=ne.return}0<Me.length&&(ge=new Ee(ge,Te,null,u,ye),ve.push({event:ge,listeners:Me}))}}if((o&7)===0){e:{if(ge=r==="mouseover"||r==="pointerover",Ee=r==="mouseout"||r==="pointerout",ge&&u!==it&&(Te=u.relatedTarget||u.fromElement)&&(ha(Te)||Te[Gr]))break e;if((Ee||ge)&&(ge=ye.window===ye?ye:(ge=ye.ownerDocument)?ge.defaultView||ge.parentWindow:window,Ee?(Te=u.relatedTarget||u.toElement,Ee=ce,Te=Te?ha(Te):null,Te!==null&&(Ct=$n(Te),Te!==Ct||Te.tag!==5&&Te.tag!==6)&&(Te=null)):(Ee=null,Te=ce),Ee!==Te)){if(Me=vi,xe="onMouseLeave",ae="onMouseEnter",ne="mouse",(r==="pointerout"||r==="pointerover")&&(Me=Jn,xe="onPointerLeave",ae="onPointerEnter",ne="pointer"),Ct=Ee==null?ge:mo(Ee),oe=Te==null?ge:mo(Te),ge=new Me(xe,ne+"leave",Ee,u,ye),ge.target=Ct,ge.relatedTarget=oe,xe=null,ha(ye)===ce&&(Me=new Me(ae,ne+"enter",Te,u,ye),Me.target=oe,Me.relatedTarget=Ct,xe=Me),Ct=xe,Ee&&Te)t:{for(Me=Ee,ae=Te,ne=0,oe=Me;oe;oe=fo(oe))ne++;for(oe=0,xe=ae;xe;xe=fo(xe))oe++;for(;0<ne-oe;)Me=fo(Me),ne--;for(;0<oe-ne;)ae=fo(ae),oe--;for(;ne--;){if(Me===ae||ae!==null&&Me===ae.alternate)break t;Me=fo(Me),ae=fo(ae)}Me=null}else Me=null;Ee!==null&&N0(ve,ge,Ee,Me,!1),Te!==null&&Ct!==null&&N0(ve,Ct,Te,Me,!0)}}e:{if(ge=ce?mo(ce):window,Ee=ge.nodeName&&ge.nodeName.toLowerCase(),Ee==="select"||Ee==="input"&&ge.type==="file")var Ie=ic;else if(oo(ge))if(Ot)Ie=Mi;else{Ie=Ud;var Fe=ca}else(Ee=ge.nodeName)&&Ee.toLowerCase()==="input"&&(ge.type==="checkbox"||ge.type==="radio")&&(Ie=Br);if(Ie&&(Ie=Ie(r,ce))){Ti(ve,Ie,u,ye);break e}Fe&&Fe(r,ge,ce),r==="focusout"&&(Fe=ge._wrapperState)&&Fe.controlled&&ge.type==="number"&&Qe(ge,"number",ge.value)}switch(Fe=ce?mo(ce):window,r){case"focusin":(oo(Fe)||Fe.contentEditable==="true")&&(wr=Fe,ws=ce,Ur=null);break;case"focusout":Ur=ws=wr=null;break;case"mousedown":Li=!0;break;case"contextmenu":case"mouseup":case"dragend":Li=!1,Di(ve,u,ye);break;case"selectionchange":if(Pi)break;case"keydown":case"keyup":Di(ve,u,ye)}var ze;if(Ei)e:{switch(r){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else zr?so(r,u)&&(We="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(We="onCompositionStart");We&&(la&&u.locale!=="ko"&&(zr||We!=="onCompositionStart"?We==="onCompositionEnd"&&zr&&(ze=Ja()):(Sn=ye,ra="value"in Sn?Sn.value:Sn.textContent,zr=!0)),Fe=mc(ce,We),0<Fe.length&&(We=new _i(We,r,null,u,ye),ve.push({event:We,listeners:Fe}),ze?We.data=ze:(ze=ji(u),ze!==null&&(We.data=ze)))),(ze=Bd?oc(r,u):Ci(r,u))&&(ce=mc(ce,"onBeforeInput"),0<ce.length&&(ye=new _i("onBeforeInput","beforeinput",null,u,ye),ve.push({event:ye,listeners:ce}),ye.data=ze))}qi(ve,o)})}function zi(r,o,u){return{instance:r,listener:o,currentTarget:u}}function mc(r,o){for(var u=o+"Capture",m=[];r!==null;){var v=r,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=$t(r,u),x!=null&&m.unshift(zi(r,x,v)),x=$t(r,o),x!=null&&m.push(zi(r,x,v))),r=r.return}return m}function fo(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function N0(r,o,u,m,v){for(var x=o._reactName,T=[];u!==null&&u!==m;){var V=u,te=V.alternate,ce=V.stateNode;if(te!==null&&te===m)break;V.tag===5&&ce!==null&&(V=ce,v?(te=$t(u,x),te!=null&&T.unshift(zi(u,te,V))):v||(te=$t(u,x),te!=null&&T.push(zi(u,te,V)))),u=u.return}T.length!==0&&r.push({event:o,listeners:T})}var jA=/\r\n?/g,CA=/\u0000|\uFFFD/g;function E0(r){return(typeof r=="string"?r:""+r).replace(jA,`
|
|
38
|
-
`).replace(CA,"")}function gc(r,o,u){if(o=E0(o),E0(r)!==o&&u)throw Error(n(425))}function yc(){}var Gd=null,Vd=null;function Yd(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 Kd=typeof setTimeout=="function"?setTimeout:void 0,TA=typeof clearTimeout=="function"?clearTimeout:void 0,j0=typeof Promise=="function"?Promise:void 0,RA=typeof queueMicrotask=="function"?queueMicrotask:typeof j0<"u"?function(r){return j0.resolve(null).then(r).catch(AA)}:Kd;function AA(r){setTimeout(function(){throw r})}function Xd(r,o){var u=o,m=0;do{var v=u.nextSibling;if(r.removeChild(u),v&&v.nodeType===8)if(u=v.data,u==="/$"){if(m===0){r.removeChild(v),Qn(o);return}m--}else u!=="$"&&u!=="$?"&&u!=="$!"||m++;u=v}while(u);Qn(o)}function xs(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 C0(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 po=Math.random().toString(36).slice(2),br="__reactFiber$"+po,Bi="__reactProps$"+po,Gr="__reactContainer$"+po,Qd="__reactEvents$"+po,MA="__reactListeners$"+po,IA="__reactHandles$"+po;function ha(r){var o=r[br];if(o)return o;for(var u=r.parentNode;u;){if(o=u[Gr]||u[br]){if(u=o.alternate,o.child!==null||u!==null&&u.child!==null)for(r=C0(r);r!==null;){if(u=r[br])return u;r=C0(r)}return o}r=u,u=r.parentNode}return null}function Ui(r){return r=r[br]||r[Gr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function mo(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function vc(r){return r[Bi]||null}var Zd=[],go=-1;function bs(r){return{current:r}}function pt(r){0>go||(r.current=Zd[go],Zd[go]=null,go--)}function ht(r,o){go++,Zd[go]=r.current,r.current=o}var ks={},Xt=bs(ks),dn=bs(!1),fa=ks;function yo(r,o){var u=r.type.contextTypes;if(!u)return ks;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var v={},x;for(x in u)v[x]=o[x];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=v),v}function hn(r){return r=r.childContextTypes,r!=null}function wc(){pt(dn),pt(Xt)}function T0(r,o,u){if(Xt.current!==ks)throw Error(n(168));ht(Xt,o),ht(dn,u)}function R0(r,o,u){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return u;m=m.getChildContext();for(var v in m)if(!(v in o))throw Error(n(108,Y(r)||"Unknown",v));return J({},u,m)}function xc(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||ks,fa=Xt.current,ht(Xt,r),ht(dn,dn.current),!0}function A0(r,o,u){var m=r.stateNode;if(!m)throw Error(n(169));u?(r=R0(r,o,fa),m.__reactInternalMemoizedMergedChildContext=r,pt(dn),pt(Xt),ht(Xt,r)):pt(dn),ht(dn,u)}var Vr=null,bc=!1,Jd=!1;function M0(r){Vr===null?Vr=[r]:Vr.push(r)}function $A(r){bc=!0,M0(r)}function _s(){if(!Jd&&Vr!==null){Jd=!0;var r=0,o=Ze;try{var u=Vr;for(Ze=1;r<u.length;r++){var m=u[r];do m=m(!0);while(m!==null)}Vr=null,bc=!1}catch(v){throw Vr!==null&&(Vr=Vr.slice(r+1)),Wa(On,_s),v}finally{Ze=o,Jd=!1}}return null}var vo=[],wo=0,kc=null,_c=0,Dn=[],qn=0,pa=null,Yr=1,Kr="";function ma(r,o){vo[wo++]=_c,vo[wo++]=kc,kc=r,_c=o}function I0(r,o,u){Dn[qn++]=Yr,Dn[qn++]=Kr,Dn[qn++]=pa,pa=r;var m=Yr;r=Kr;var v=32-on(m)-1;m&=~(1<<v),u+=1;var x=32-on(o)+v;if(30<x){var T=v-v%5;x=(m&(1<<T)-1).toString(32),m>>=T,v-=T,Yr=1<<32-on(o)+v|u<<v|m,Kr=x+r}else Yr=1<<x|u<<v|m,Kr=r}function eh(r){r.return!==null&&(ma(r,1),I0(r,1,0))}function th(r){for(;r===kc;)kc=vo[--wo],vo[wo]=null,_c=vo[--wo],vo[wo]=null;for(;r===pa;)pa=Dn[--qn],Dn[qn]=null,Kr=Dn[--qn],Dn[qn]=null,Yr=Dn[--qn],Dn[qn]=null}var jn=null,Cn=null,gt=!1,er=null;function $0(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 O0(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,Cn=xs(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,jn=r,Cn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(u=pa!==null?{id:Yr,overflow:Kr}: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,Cn=null,!0):!1;default:return!1}}function nh(r){return(r.mode&1)!==0&&(r.flags&128)===0}function rh(r){if(gt){var o=Cn;if(o){var u=o;if(!O0(r,o)){if(nh(r))throw Error(n(418));o=xs(u.nextSibling);var m=jn;o&&O0(r,o)?$0(m,u):(r.flags=r.flags&-4097|2,gt=!1,jn=r)}}else{if(nh(r))throw Error(n(418));r.flags=r.flags&-4097|2,gt=!1,jn=r}}}function P0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;jn=r}function Sc(r){if(r!==jn)return!1;if(!gt)return P0(r),gt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Yd(r.type,r.memoizedProps)),o&&(o=Cn)){if(nh(r))throw L0(),Error(n(418));for(;o;)$0(r,o),o=xs(o.nextSibling)}if(P0(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){Cn=xs(r.nextSibling);break e}o--}else u!=="$"&&u!=="$!"&&u!=="$?"||o++}r=r.nextSibling}Cn=null}}else Cn=jn?xs(r.stateNode.nextSibling):null;return!0}function L0(){for(var r=Cn;r;)r=xs(r.nextSibling)}function xo(){Cn=jn=null,gt=!1}function sh(r){er===null?er=[r]:er.push(r)}var OA=C.ReactCurrentBatchConfig;function Wi(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 m=u.stateNode}if(!m)throw Error(n(147,r));var v=m,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(T){var V=v.refs;T===null?delete V[x]:V[x]=T},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,r))}return r}function Nc(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 q0(r){function o(ae,ne){if(r){var oe=ae.deletions;oe===null?(ae.deletions=[ne],ae.flags|=16):oe.push(ne)}}function u(ae,ne){if(!r)return null;for(;ne!==null;)o(ae,ne),ne=ne.sibling;return null}function m(ae,ne){for(ae=new Map;ne!==null;)ne.key!==null?ae.set(ne.key,ne):ae.set(ne.index,ne),ne=ne.sibling;return ae}function v(ae,ne){return ae=As(ae,ne),ae.index=0,ae.sibling=null,ae}function x(ae,ne,oe){return ae.index=oe,r?(oe=ae.alternate,oe!==null?(oe=oe.index,oe<ne?(ae.flags|=2,ne):oe):(ae.flags|=2,ne)):(ae.flags|=1048576,ne)}function T(ae){return r&&ae.alternate===null&&(ae.flags|=2),ae}function V(ae,ne,oe,xe){return ne===null||ne.tag!==6?(ne=Kh(oe,ae.mode,xe),ne.return=ae,ne):(ne=v(ne,oe),ne.return=ae,ne)}function te(ae,ne,oe,xe){var Ie=oe.type;return Ie===I?ye(ae,ne,oe.props.children,xe,oe.key):ne!==null&&(ne.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===B&&D0(Ie)===ne.type)?(xe=v(ne,oe.props),xe.ref=Wi(ae,ne,oe),xe.return=ae,xe):(xe=Kc(oe.type,oe.key,oe.props,null,ae.mode,xe),xe.ref=Wi(ae,ne,oe),xe.return=ae,xe)}function ce(ae,ne,oe,xe){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==oe.containerInfo||ne.stateNode.implementation!==oe.implementation?(ne=Xh(oe,ae.mode,xe),ne.return=ae,ne):(ne=v(ne,oe.children||[]),ne.return=ae,ne)}function ye(ae,ne,oe,xe,Ie){return ne===null||ne.tag!==7?(ne=_a(oe,ae.mode,xe,Ie),ne.return=ae,ne):(ne=v(ne,oe),ne.return=ae,ne)}function ve(ae,ne,oe){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=Kh(""+ne,ae.mode,oe),ne.return=ae,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case M:return oe=Kc(ne.type,ne.key,ne.props,null,ae.mode,oe),oe.ref=Wi(ae,null,ne),oe.return=ae,oe;case $:return ne=Xh(ne,ae.mode,oe),ne.return=ae,ne;case B:var xe=ne._init;return ve(ae,xe(ne._payload),oe)}if(ft(ne)||F(ne))return ne=_a(ne,ae.mode,oe,null),ne.return=ae,ne;Nc(ae,ne)}return null}function ge(ae,ne,oe,xe){var Ie=ne!==null?ne.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number")return Ie!==null?null:V(ae,ne,""+oe,xe);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case M:return oe.key===Ie?te(ae,ne,oe,xe):null;case $:return oe.key===Ie?ce(ae,ne,oe,xe):null;case B:return Ie=oe._init,ge(ae,ne,Ie(oe._payload),xe)}if(ft(oe)||F(oe))return Ie!==null?null:ye(ae,ne,oe,xe,null);Nc(ae,oe)}return null}function Ee(ae,ne,oe,xe,Ie){if(typeof xe=="string"&&xe!==""||typeof xe=="number")return ae=ae.get(oe)||null,V(ne,ae,""+xe,Ie);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case M:return ae=ae.get(xe.key===null?oe:xe.key)||null,te(ne,ae,xe,Ie);case $:return ae=ae.get(xe.key===null?oe:xe.key)||null,ce(ne,ae,xe,Ie);case B:var Fe=xe._init;return Ee(ae,ne,oe,Fe(xe._payload),Ie)}if(ft(xe)||F(xe))return ae=ae.get(oe)||null,ye(ne,ae,xe,Ie,null);Nc(ne,xe)}return null}function Te(ae,ne,oe,xe){for(var Ie=null,Fe=null,ze=ne,We=ne=0,Bt=null;ze!==null&&We<oe.length;We++){ze.index>We?(Bt=ze,ze=null):Bt=ze.sibling;var nt=ge(ae,ze,oe[We],xe);if(nt===null){ze===null&&(ze=Bt);break}r&&ze&&nt.alternate===null&&o(ae,ze),ne=x(nt,ne,We),Fe===null?Ie=nt:Fe.sibling=nt,Fe=nt,ze=Bt}if(We===oe.length)return u(ae,ze),gt&&ma(ae,We),Ie;if(ze===null){for(;We<oe.length;We++)ze=ve(ae,oe[We],xe),ze!==null&&(ne=x(ze,ne,We),Fe===null?Ie=ze:Fe.sibling=ze,Fe=ze);return gt&&ma(ae,We),Ie}for(ze=m(ae,ze);We<oe.length;We++)Bt=Ee(ze,ae,We,oe[We],xe),Bt!==null&&(r&&Bt.alternate!==null&&ze.delete(Bt.key===null?We:Bt.key),ne=x(Bt,ne,We),Fe===null?Ie=Bt:Fe.sibling=Bt,Fe=Bt);return r&&ze.forEach(function(Ms){return o(ae,Ms)}),gt&&ma(ae,We),Ie}function Me(ae,ne,oe,xe){var Ie=F(oe);if(typeof Ie!="function")throw Error(n(150));if(oe=Ie.call(oe),oe==null)throw Error(n(151));for(var Fe=Ie=null,ze=ne,We=ne=0,Bt=null,nt=oe.next();ze!==null&&!nt.done;We++,nt=oe.next()){ze.index>We?(Bt=ze,ze=null):Bt=ze.sibling;var Ms=ge(ae,ze,nt.value,xe);if(Ms===null){ze===null&&(ze=Bt);break}r&&ze&&Ms.alternate===null&&o(ae,ze),ne=x(Ms,ne,We),Fe===null?Ie=Ms:Fe.sibling=Ms,Fe=Ms,ze=Bt}if(nt.done)return u(ae,ze),gt&&ma(ae,We),Ie;if(ze===null){for(;!nt.done;We++,nt=oe.next())nt=ve(ae,nt.value,xe),nt!==null&&(ne=x(nt,ne,We),Fe===null?Ie=nt:Fe.sibling=nt,Fe=nt);return gt&&ma(ae,We),Ie}for(ze=m(ae,ze);!nt.done;We++,nt=oe.next())nt=Ee(ze,ae,We,nt.value,xe),nt!==null&&(r&&nt.alternate!==null&&ze.delete(nt.key===null?We:nt.key),ne=x(nt,ne,We),Fe===null?Ie=nt:Fe.sibling=nt,Fe=nt);return r&&ze.forEach(function(pM){return o(ae,pM)}),gt&&ma(ae,We),Ie}function Ct(ae,ne,oe,xe){if(typeof oe=="object"&&oe!==null&&oe.type===I&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case M:e:{for(var Ie=oe.key,Fe=ne;Fe!==null;){if(Fe.key===Ie){if(Ie=oe.type,Ie===I){if(Fe.tag===7){u(ae,Fe.sibling),ne=v(Fe,oe.props.children),ne.return=ae,ae=ne;break e}}else if(Fe.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===B&&D0(Ie)===Fe.type){u(ae,Fe.sibling),ne=v(Fe,oe.props),ne.ref=Wi(ae,Fe,oe),ne.return=ae,ae=ne;break e}u(ae,Fe);break}else o(ae,Fe);Fe=Fe.sibling}oe.type===I?(ne=_a(oe.props.children,ae.mode,xe,oe.key),ne.return=ae,ae=ne):(xe=Kc(oe.type,oe.key,oe.props,null,ae.mode,xe),xe.ref=Wi(ae,ne,oe),xe.return=ae,ae=xe)}return T(ae);case $:e:{for(Fe=oe.key;ne!==null;){if(ne.key===Fe)if(ne.tag===4&&ne.stateNode.containerInfo===oe.containerInfo&&ne.stateNode.implementation===oe.implementation){u(ae,ne.sibling),ne=v(ne,oe.children||[]),ne.return=ae,ae=ne;break e}else{u(ae,ne);break}else o(ae,ne);ne=ne.sibling}ne=Xh(oe,ae.mode,xe),ne.return=ae,ae=ne}return T(ae);case B:return Fe=oe._init,Ct(ae,ne,Fe(oe._payload),xe)}if(ft(oe))return Te(ae,ne,oe,xe);if(F(oe))return Me(ae,ne,oe,xe);Nc(ae,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"?(oe=""+oe,ne!==null&&ne.tag===6?(u(ae,ne.sibling),ne=v(ne,oe),ne.return=ae,ae=ne):(u(ae,ne),ne=Kh(oe,ae.mode,xe),ne.return=ae,ae=ne),T(ae)):u(ae,ne)}return Ct}var bo=q0(!0),F0=q0(!1),Ec=bs(null),jc=null,ko=null,ah=null;function oh(){ah=ko=jc=null}function ih(r){var o=Ec.current;pt(Ec),r._currentValue=o}function lh(r,o,u){for(;r!==null;){var m=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,m!==null&&(m.childLanes|=o)):m!==null&&(m.childLanes&o)!==o&&(m.childLanes|=o),r===u)break;r=r.return}}function _o(r,o){jc=r,ah=ko=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(fn=!0),r.firstContext=null)}function Fn(r){var o=r._currentValue;if(ah!==r)if(r={context:r,memoizedValue:o,next:null},ko===null){if(jc===null)throw Error(n(308));ko=r,jc.dependencies={lanes:0,firstContext:r}}else ko=ko.next=r;return o}var ga=null;function ch(r){ga===null?ga=[r]:ga.push(r)}function z0(r,o,u,m){var v=o.interleaved;return v===null?(u.next=u,ch(o)):(u.next=v.next,v.next=u),o.interleaved=u,Xr(r,m)}function Xr(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 Ss=!1;function uh(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function B0(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 Qr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Ns(r,o,u){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(tt&2)!==0){var v=m.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),m.pending=o,Xr(r,u)}return v=m.interleaved,v===null?(o.next=o,ch(m)):(o.next=v.next,v.next=o),m.interleaved=o,Xr(r,u)}function Cc(r,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194240)!==0)){var m=o.lanes;m&=r.pendingLanes,u|=m,o.lanes=u,Ka(r,u)}}function U0(r,o){var u=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,u===m)){var v=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var T={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};x===null?v=x=T:x=x.next=T,u=u.next}while(u!==null);x===null?v=x=o:x=x.next=o}else v=x=o;u={baseState:m.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:m.shared,effects:m.effects},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=o:r.next=o,u.lastBaseUpdate=o}function Tc(r,o,u,m){var v=r.updateQueue;Ss=!1;var x=v.firstBaseUpdate,T=v.lastBaseUpdate,V=v.shared.pending;if(V!==null){v.shared.pending=null;var te=V,ce=te.next;te.next=null,T===null?x=ce:T.next=ce,T=te;var ye=r.alternate;ye!==null&&(ye=ye.updateQueue,V=ye.lastBaseUpdate,V!==T&&(V===null?ye.firstBaseUpdate=ce:V.next=ce,ye.lastBaseUpdate=te))}if(x!==null){var ve=v.baseState;T=0,ye=ce=te=null,V=x;do{var ge=V.lane,Ee=V.eventTime;if((m&ge)===ge){ye!==null&&(ye=ye.next={eventTime:Ee,lane:0,tag:V.tag,payload:V.payload,callback:V.callback,next:null});e:{var Te=r,Me=V;switch(ge=o,Ee=u,Me.tag){case 1:if(Te=Me.payload,typeof Te=="function"){ve=Te.call(Ee,ve,ge);break e}ve=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Me.payload,ge=typeof Te=="function"?Te.call(Ee,ve,ge):Te,ge==null)break e;ve=J({},ve,ge);break e;case 2:Ss=!0}}V.callback!==null&&V.lane!==0&&(r.flags|=64,ge=v.effects,ge===null?v.effects=[V]:ge.push(V))}else Ee={eventTime:Ee,lane:ge,tag:V.tag,payload:V.payload,callback:V.callback,next:null},ye===null?(ce=ye=Ee,te=ve):ye=ye.next=Ee,T|=ge;if(V=V.next,V===null){if(V=v.shared.pending,V===null)break;ge=V,V=ge.next,ge.next=null,v.lastBaseUpdate=ge,v.shared.pending=null}}while(!0);if(ye===null&&(te=ve),v.baseState=te,v.firstBaseUpdate=ce,v.lastBaseUpdate=ye,o=v.shared.interleaved,o!==null){v=o;do T|=v.lane,v=v.next;while(v!==o)}else x===null&&(v.shared.lanes=0);wa|=T,r.lanes=T,r.memoizedState=ve}}function W0(r,o,u){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],v=m.callback;if(v!==null){if(m.callback=null,m=u,typeof v!="function")throw Error(n(191,v));v.call(m)}}}var Hi={},kr=bs(Hi),Gi=bs(Hi),Vi=bs(Hi);function ya(r){if(r===Hi)throw Error(n(174));return r}function dh(r,o){switch(ht(Vi,o),ht(Gi,r),ht(kr,Hi),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:Ue(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=Ue(o,r)}pt(kr),ht(kr,o)}function So(){pt(kr),pt(Gi),pt(Vi)}function H0(r){ya(Vi.current);var o=ya(kr.current),u=Ue(o,r.type);o!==u&&(ht(Gi,r),ht(kr,u))}function hh(r){Gi.current===r&&(pt(kr),pt(Gi))}var bt=bs(0);function Rc(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 fh=[];function ph(){for(var r=0;r<fh.length;r++)fh[r]._workInProgressVersionPrimary=null;fh.length=0}var Ac=C.ReactCurrentDispatcher,mh=C.ReactCurrentBatchConfig,va=0,kt=null,Pt=null,Ft=null,Mc=!1,Yi=!1,Ki=0,PA=0;function Qt(){throw Error(n(321))}function gh(r,o){if(o===null)return!1;for(var u=0;u<o.length&&u<r.length;u++)if(!Nn(r[u],o[u]))return!1;return!0}function yh(r,o,u,m,v,x){if(va=x,kt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Ac.current=r===null||r.memoizedState===null?FA:zA,r=u(m,v),Yi){x=0;do{if(Yi=!1,Ki=0,25<=x)throw Error(n(301));x+=1,Ft=Pt=null,o.updateQueue=null,Ac.current=BA,r=u(m,v)}while(Yi)}if(Ac.current=Oc,o=Pt!==null&&Pt.next!==null,va=0,Ft=Pt=kt=null,Mc=!1,o)throw Error(n(300));return r}function vh(){var r=Ki!==0;return Ki=0,r}function _r(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ft===null?kt.memoizedState=Ft=r:Ft=Ft.next=r,Ft}function zn(){if(Pt===null){var r=kt.alternate;r=r!==null?r.memoizedState:null}else r=Pt.next;var o=Ft===null?kt.memoizedState:Ft.next;if(o!==null)Ft=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},Ft===null?kt.memoizedState=Ft=r:Ft=Ft.next=r}return Ft}function Xi(r,o){return typeof o=="function"?o(r):o}function wh(r){var o=zn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var m=Pt,v=m.baseQueue,x=u.pending;if(x!==null){if(v!==null){var T=v.next;v.next=x.next,x.next=T}m.baseQueue=v=x,u.pending=null}if(v!==null){x=v.next,m=m.baseState;var V=T=null,te=null,ce=x;do{var ye=ce.lane;if((va&ye)===ye)te!==null&&(te=te.next={lane:0,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),m=ce.hasEagerState?ce.eagerState:r(m,ce.action);else{var ve={lane:ye,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null};te===null?(V=te=ve,T=m):te=te.next=ve,kt.lanes|=ye,wa|=ye}ce=ce.next}while(ce!==null&&ce!==x);te===null?T=m:te.next=V,Nn(m,o.memoizedState)||(fn=!0),o.memoizedState=m,o.baseState=T,o.baseQueue=te,u.lastRenderedState=m}if(r=u.interleaved,r!==null){v=r;do x=v.lane,kt.lanes|=x,wa|=x,v=v.next;while(v!==r)}else v===null&&(u.lanes=0);return[o.memoizedState,u.dispatch]}function xh(r){var o=zn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var m=u.dispatch,v=u.pending,x=o.memoizedState;if(v!==null){u.pending=null;var T=v=v.next;do x=r(x,T.action),T=T.next;while(T!==v);Nn(x,o.memoizedState)||(fn=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),u.lastRenderedState=x}return[x,m]}function G0(){}function V0(r,o){var u=kt,m=zn(),v=o(),x=!Nn(m.memoizedState,v);if(x&&(m.memoizedState=v,fn=!0),m=m.queue,bh(X0.bind(null,u,m,r),[r]),m.getSnapshot!==o||x||Ft!==null&&Ft.memoizedState.tag&1){if(u.flags|=2048,Qi(9,K0.bind(null,u,m,v,o),void 0,null),zt===null)throw Error(n(349));(va&30)!==0||Y0(u,o,v)}return v}function Y0(r,o,u){r.flags|=16384,r={getSnapshot:o,value:u},o=kt.updateQueue,o===null?(o={lastEffect:null,stores:null},kt.updateQueue=o,o.stores=[r]):(u=o.stores,u===null?o.stores=[r]:u.push(r))}function K0(r,o,u,m){o.value=u,o.getSnapshot=m,Q0(o)&&Z0(r)}function X0(r,o,u){return u(function(){Q0(o)&&Z0(r)})}function Q0(r){var o=r.getSnapshot;r=r.value;try{var u=o();return!Nn(r,u)}catch{return!0}}function Z0(r){var o=Xr(r,1);o!==null&&sr(o,r,1,-1)}function J0(r){var o=_r();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Xi,lastRenderedState:r},o.queue=r,r=r.dispatch=qA.bind(null,kt,r),[o.memoizedState,r]}function Qi(r,o,u,m){return r={tag:r,create:o,destroy:u,deps:m,next:null},o=kt.updateQueue,o===null?(o={lastEffect:null,stores:null},kt.updateQueue=o,o.lastEffect=r.next=r):(u=o.lastEffect,u===null?o.lastEffect=r.next=r:(m=u.next,u.next=r,r.next=m,o.lastEffect=r)),r}function ex(){return zn().memoizedState}function Ic(r,o,u,m){var v=_r();kt.flags|=r,v.memoizedState=Qi(1|o,u,void 0,m===void 0?null:m)}function $c(r,o,u,m){var v=zn();m=m===void 0?null:m;var x=void 0;if(Pt!==null){var T=Pt.memoizedState;if(x=T.destroy,m!==null&&gh(m,T.deps)){v.memoizedState=Qi(o,u,x,m);return}}kt.flags|=r,v.memoizedState=Qi(1|o,u,x,m)}function tx(r,o){return Ic(8390656,8,r,o)}function bh(r,o){return $c(2048,8,r,o)}function nx(r,o){return $c(4,2,r,o)}function rx(r,o){return $c(4,4,r,o)}function sx(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 ax(r,o,u){return u=u!=null?u.concat([r]):null,$c(4,4,sx.bind(null,o,r),u)}function kh(){}function ox(r,o){var u=zn();o=o===void 0?null:o;var m=u.memoizedState;return m!==null&&o!==null&&gh(o,m[1])?m[0]:(u.memoizedState=[r,o],r)}function ix(r,o){var u=zn();o=o===void 0?null:o;var m=u.memoizedState;return m!==null&&o!==null&&gh(o,m[1])?m[0]:(r=r(),u.memoizedState=[r,o],r)}function lx(r,o,u){return(va&21)===0?(r.baseState&&(r.baseState=!1,fn=!0),r.memoizedState=u):(Nn(u,o)||(u=Qs(),kt.lanes|=u,wa|=u,r.baseState=!0),o)}function LA(r,o){var u=Ze;Ze=u!==0&&4>u?u:4,r(!0);var m=mh.transition;mh.transition={};try{r(!1),o()}finally{Ze=u,mh.transition=m}}function cx(){return zn().memoizedState}function DA(r,o,u){var m=Ts(r);if(u={lane:m,action:u,hasEagerState:!1,eagerState:null,next:null},ux(r))dx(o,u);else if(u=z0(r,o,u,m),u!==null){var v=an();sr(u,r,m,v),hx(u,o,m)}}function qA(r,o,u){var m=Ts(r),v={lane:m,action:u,hasEagerState:!1,eagerState:null,next:null};if(ux(r))dx(o,v);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var T=o.lastRenderedState,V=x(T,u);if(v.hasEagerState=!0,v.eagerState=V,Nn(V,T)){var te=o.interleaved;te===null?(v.next=v,ch(o)):(v.next=te.next,te.next=v),o.interleaved=v;return}}catch{}finally{}u=z0(r,o,v,m),u!==null&&(v=an(),sr(u,r,m,v),hx(u,o,m))}}function ux(r){var o=r.alternate;return r===kt||o!==null&&o===kt}function dx(r,o){Yi=Mc=!0;var u=r.pending;u===null?o.next=o:(o.next=u.next,u.next=o),r.pending=o}function hx(r,o,u){if((u&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,u|=m,o.lanes=u,Ka(r,u)}}var Oc={readContext:Fn,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useInsertionEffect:Qt,useLayoutEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useMutableSource:Qt,useSyncExternalStore:Qt,useId:Qt,unstable_isNewReconciler:!1},FA={readContext:Fn,useCallback:function(r,o){return _r().memoizedState=[r,o===void 0?null:o],r},useContext:Fn,useEffect:tx,useImperativeHandle:function(r,o,u){return u=u!=null?u.concat([r]):null,Ic(4194308,4,sx.bind(null,o,r),u)},useLayoutEffect:function(r,o){return Ic(4194308,4,r,o)},useInsertionEffect:function(r,o){return Ic(4,2,r,o)},useMemo:function(r,o){var u=_r();return o=o===void 0?null:o,r=r(),u.memoizedState=[r,o],r},useReducer:function(r,o,u){var m=_r();return o=u!==void 0?u(o):o,m.memoizedState=m.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},m.queue=r,r=r.dispatch=DA.bind(null,kt,r),[m.memoizedState,r]},useRef:function(r){var o=_r();return r={current:r},o.memoizedState=r},useState:J0,useDebugValue:kh,useDeferredValue:function(r){return _r().memoizedState=r},useTransition:function(){var r=J0(!1),o=r[0];return r=LA.bind(null,r[1]),_r().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,u){var m=kt,v=_r();if(gt){if(u===void 0)throw Error(n(407));u=u()}else{if(u=o(),zt===null)throw Error(n(349));(va&30)!==0||Y0(m,o,u)}v.memoizedState=u;var x={value:u,getSnapshot:o};return v.queue=x,tx(X0.bind(null,m,x,r),[r]),m.flags|=2048,Qi(9,K0.bind(null,m,x,u,o),void 0,null),u},useId:function(){var r=_r(),o=zt.identifierPrefix;if(gt){var u=Kr,m=Yr;u=(m&~(1<<32-on(m)-1)).toString(32)+u,o=":"+o+"R"+u,u=Ki++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=PA++,o=":"+o+"r"+u.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},zA={readContext:Fn,useCallback:ox,useContext:Fn,useEffect:bh,useImperativeHandle:ax,useInsertionEffect:nx,useLayoutEffect:rx,useMemo:ix,useReducer:wh,useRef:ex,useState:function(){return wh(Xi)},useDebugValue:kh,useDeferredValue:function(r){var o=zn();return lx(o,Pt.memoizedState,r)},useTransition:function(){var r=wh(Xi)[0],o=zn().memoizedState;return[r,o]},useMutableSource:G0,useSyncExternalStore:V0,useId:cx,unstable_isNewReconciler:!1},BA={readContext:Fn,useCallback:ox,useContext:Fn,useEffect:bh,useImperativeHandle:ax,useInsertionEffect:nx,useLayoutEffect:rx,useMemo:ix,useReducer:xh,useRef:ex,useState:function(){return xh(Xi)},useDebugValue:kh,useDeferredValue:function(r){var o=zn();return Pt===null?o.memoizedState=r:lx(o,Pt.memoizedState,r)},useTransition:function(){var r=xh(Xi)[0],o=zn().memoizedState;return[r,o]},useMutableSource:G0,useSyncExternalStore:V0,useId:cx,unstable_isNewReconciler:!1};function tr(r,o){if(r&&r.defaultProps){o=J({},o),r=r.defaultProps;for(var u in r)o[u]===void 0&&(o[u]=r[u]);return o}return o}function _h(r,o,u,m){o=r.memoizedState,u=u(m,o),u=u==null?o:J({},o,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Pc={isMounted:function(r){return(r=r._reactInternals)?$n(r)===r:!1},enqueueSetState:function(r,o,u){r=r._reactInternals;var m=an(),v=Ts(r),x=Qr(m,v);x.payload=o,u!=null&&(x.callback=u),o=Ns(r,x,v),o!==null&&(sr(o,r,v,m),Cc(o,r,v))},enqueueReplaceState:function(r,o,u){r=r._reactInternals;var m=an(),v=Ts(r),x=Qr(m,v);x.tag=1,x.payload=o,u!=null&&(x.callback=u),o=Ns(r,x,v),o!==null&&(sr(o,r,v,m),Cc(o,r,v))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var u=an(),m=Ts(r),v=Qr(u,m);v.tag=2,o!=null&&(v.callback=o),o=Ns(r,v,m),o!==null&&(sr(o,r,m,u),Cc(o,r,m))}};function fx(r,o,u,m,v,x,T){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,x,T):o.prototype&&o.prototype.isPureReactComponent?!En(u,m)||!En(v,x):!0}function px(r,o,u){var m=!1,v=ks,x=o.contextType;return typeof x=="object"&&x!==null?x=Fn(x):(v=hn(o)?fa:Xt.current,m=o.contextTypes,x=(m=m!=null)?yo(r,v):ks),o=new o(u,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Pc,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=v,r.__reactInternalMemoizedMaskedChildContext=x),o}function mx(r,o,u,m){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,m),o.state!==r&&Pc.enqueueReplaceState(o,o.state,null)}function Sh(r,o,u,m){var v=r.stateNode;v.props=u,v.state=r.memoizedState,v.refs={},uh(r);var x=o.contextType;typeof x=="object"&&x!==null?v.context=Fn(x):(x=hn(o)?fa:Xt.current,v.context=yo(r,x)),v.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(_h(r,o,x,u),v.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(o=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),o!==v.state&&Pc.enqueueReplaceState(v,v.state,null),Tc(r,u,v,m),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308)}function No(r,o){try{var u="",m=o;do u+=U(m),m=m.return;while(m);var v=u}catch(x){v=`
|
|
37
|
+
`+v[T].replace(" at new "," at ");return r.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",r.displayName)),te}while(1<=T&&0<=V);break}}}finally{ue=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?K(r):""}function U(r){switch(r.tag){case 5:return K(r.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("SuspenseList");case 0:case 2:case 15:return r=G(r.type,!1),r;case 11:return r=G(r.type.render,!1),r;case 1:return r=G(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 I:return"Fragment";case $:return"Portal";case O:return"Profiler";case z:return"StrictMode";case X:return"Suspense";case R:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case D:return(r.displayName||"Context")+".Consumer";case A:return(r._context.displayName||"Context")+".Provider";case H:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Z:return o=r.displayName||null,o!==null?o:ee(r.type)||"Memo";case B:o=r._payload,r=r._init;try{return ee(r(o))}catch{}}return null}function Y(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===z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function le(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function fe(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function me(r){var o=fe(r)?"checked":"value",u=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),m=""+r[o];if(!r.hasOwnProperty(o)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var v=u.get,x=u.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return v.call(this)},set:function(T){m=""+T,x.call(this,T)}}),Object.defineProperty(r,o,{enumerable:u.enumerable}),{getValue:function(){return m},setValue:function(T){m=""+T},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function ke(r){r._valueTracker||(r._valueTracker=me(r))}function Ve(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var u=o.getValue(),m="";return r&&(m=fe(r)?r.checked?"true":"false":r.value),r=m,r!==u?(o.setValue(r),!0):!1}function Le(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 qe(r,o){var u=o.checked;return J({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??r._wrapperState.initialChecked})}function Ne(r,o){var u=o.defaultValue==null?"":o.defaultValue,m=o.checked!=null?o.checked:o.defaultChecked;u=le(o.value!=null?o.value:u),r._wrapperState={initialChecked:m,initialValue:u,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function Ge(r,o){o=o.checked,o!=null&&j(r,"checked",o,!1)}function be(r,o){Ge(r,o);var u=le(o.value),m=o.type;if(u!=null)m==="number"?(u===0&&r.value===""||r.value!=u)&&(r.value=""+u):r.value!==""+u&&(r.value=""+u);else if(m==="submit"||m==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Qe(r,o.type,u):o.hasOwnProperty("defaultValue")&&Qe(r,o.type,le(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function re(r,o,u){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var m=o.type;if(!(m!=="submit"&&m!=="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 Qe(r,o,u){(o!=="number"||Le(r.ownerDocument)!==r)&&(u==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+u&&(r.defaultValue=""+u))}var ft=Array.isArray;function ut(r,o,u,m){if(r=r.options,o){o={};for(var v=0;v<u.length;v++)o["$"+u[v]]=!0;for(u=0;u<r.length;u++)v=o.hasOwnProperty("$"+r[u].value),r[u].selected!==v&&(r[u].selected=v),v&&m&&(r[u].defaultSelected=!0)}else{for(u=""+le(u),o=null,v=0;v<r.length;v++){if(r[v].value===u){r[v].selected=!0,m&&(r[v].defaultSelected=!0);return}o!==null||r[v].disabled||(o=r[v])}o!==null&&(o.selected=!0)}}function at(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return J({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Ye(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(ft(u)){if(1<u.length)throw Error(n(93));u=u[0]}o=u}o==null&&(o=""),u=o}r._wrapperState={initialValue:le(u)}}function pe(r,o){var u=le(o.value),m=le(o.defaultValue);u!=null&&(u=""+u,u!==r.value&&(r.value=u),o.defaultValue==null&&r.defaultValue!==u&&(r.defaultValue=u)),m!=null&&(r.defaultValue=""+m)}function we(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function Pe(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 Ue(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?Pe(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var ot,$e=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,u,m,v){MSApp.execUnsafeLocalFunction(function(){return r(o,u,m,v)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(ot=ot||document.createElement("div"),ot.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=ot.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function se(r,o){if(o){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=o;return}}r.textContent=o}var Se={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},De=["Webkit","ms","Moz","O"];Object.keys(Se).forEach(function(r){De.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Se[o]=Se[r]})});function _e(r,o,u){return o==null||typeof o=="boolean"||o===""?"":u||typeof o!="number"||o===0||Se.hasOwnProperty(r)&&Se[r]?(""+o).trim():o+"px"}function Be(r,o){r=r.style;for(var u in o)if(o.hasOwnProperty(u)){var m=u.indexOf("--")===0,v=_e(u,o[u],m);u==="float"&&(u="cssFloat"),m?r.setProperty(u,v):r[u]=v}}var _t=J({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 vt(r,o){if(o){if(_t[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 Ae(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 it=null;function wt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var xt=null,nn=null,rn=null;function In(r){if(r=Ui(r)){if(typeof xt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=vc(o),xt(r.stateNode,r.type,o))}}function Da(r){nn?rn?rn.push(r):rn=[r]:nn=r}function qa(){if(nn){var r=nn,o=rn;if(rn=nn=null,In(r),o)for(r=0;r<o.length;r++)In(o[r])}}function Fa(r,o){return r(o)}function wn(){}var Bs=!1;function za(r,o,u){if(Bs)return r(o,u);Bs=!0;try{return Fa(r,o,u)}finally{Bs=!1,(nn!==null||rn!==null)&&(wn(),qa())}}function $t(r,o){var u=r.stateNode;if(u===null)return null;var m=vc(u);if(m===null)return null;u=m[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":(m=!m.disabled)||(r=r.type,m=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!m;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(n(231,o,typeof u));return u}var mr=!1;if(d)try{var Kn={};Object.defineProperty(Kn,"passive",{get:function(){mr=!0}}),window.addEventListener("test",Kn,Kn),window.removeEventListener("test",Kn,Kn)}catch{mr=!1}function li(r,o,u,m,v,x,T,V,te){var ce=Array.prototype.slice.call(arguments,3);try{o.apply(u,ce)}catch(ye){this.onError(ye)}}var Rr=!1,Ar=null,Mr=!1,is=null,Us={onError:function(r){Rr=!0,Ar=r}};function Ba(r,o,u,m,v,x,T,V,te){Rr=!1,Ar=null,li.apply(Us,arguments)}function Ws(r,o,u,m,v,x,T,V,te){if(Ba.apply(this,arguments),Rr){if(Rr){var ce=Ar;Rr=!1,Ar=null}else throw Error(n(198));Mr||(Mr=!0,is=ce)}}function $n(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 Ua(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 Hs(r){if($n(r)!==r)throw Error(n(188))}function ci(r){var o=r.alternate;if(!o){if(o=$n(r),o===null)throw Error(n(188));return o!==r?null:r}for(var u=r,m=o;;){var v=u.return;if(v===null)break;var x=v.alternate;if(x===null){if(m=v.return,m!==null){u=m;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===u)return Hs(v),r;if(x===m)return Hs(v),o;x=x.sibling}throw Error(n(188))}if(u.return!==m.return)u=v,m=x;else{for(var T=!1,V=v.child;V;){if(V===u){T=!0,u=v,m=x;break}if(V===m){T=!0,m=v,u=x;break}V=V.sibling}if(!T){for(V=x.child;V;){if(V===u){T=!0,u=x,m=v;break}if(V===m){T=!0,m=x,u=v;break}V=V.sibling}if(!T)throw Error(n(189))}}if(u.alternate!==m)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?r:o}function Ir(r){return r=ci(r),r!==null?Gs(r):null}function Gs(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=Gs(r);if(o!==null)return o;r=r.sibling}return null}var Wa=t.unstable_scheduleCallback,$r=t.unstable_cancelCallback,Vs=t.unstable_shouldYield,ls=t.unstable_requestPaint,dt=t.unstable_now,Ha=t.unstable_getCurrentPriorityLevel,On=t.unstable_ImmediatePriority,Ga=t.unstable_UserBlockingPriority,Or=t.unstable_NormalPriority,Ys=t.unstable_LowPriority,Va=t.unstable_IdlePriority,Pr=null,qt=null;function Ks(r){if(qt&&typeof qt.onCommitFiberRoot=="function")try{qt.onCommitFiberRoot(Pr,r,void 0,(r.current.flags&128)===128)}catch{}}var on=Math.clz32?Math.clz32:Td,xn=Math.log,Ya=Math.LN2;function Td(r){return r>>>=0,r===0?32:31-(xn(r)/Ya|0)|0}var cs=64,St=4194304;function Xs(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 Pn(r,o){var u=r.pendingLanes;if(u===0)return 0;var m=0,v=r.suspendedLanes,x=r.pingedLanes,T=u&268435455;if(T!==0){var V=T&~v;V!==0?m=Xs(V):(x&=T,x!==0&&(m=Xs(x)))}else T=u&~v,T!==0?m=Xs(T):x!==0&&(m=Xs(x));if(m===0)return 0;if(o!==0&&o!==m&&(o&v)===0&&(v=m&-m,x=o&-o,v>=x||v===16&&(x&4194240)!==0))return o;if((m&4)!==0&&(m|=u&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=m;0<o;)u=31-on(o),v=1<<u,m|=r[u],o&=~v;return m}function Rd(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 Ad(r,o){for(var u=r.suspendedLanes,m=r.pingedLanes,v=r.expirationTimes,x=r.pendingLanes;0<x;){var T=31-on(x),V=1<<T,te=v[T];te===-1?((V&u)===0||(V&m)!==0)&&(v[T]=Rd(V,o)):te<=o&&(r.expiredLanes|=V),x&=~V}}function Ln(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Qs(){var r=cs;return cs<<=1,(cs&4194240)===0&&(cs=64),r}function ui(r){for(var o=[],u=0;31>u;u++)o.push(r);return o}function Zs(r,o,u){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-on(o),r[o]=u}function Xl(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 m=r.eventTimes;for(r=r.expirationTimes;0<u;){var v=31-on(u),x=1<<v;o[v]=0,m[v]=-1,r[v]=-1,u&=~x}}function Ka(r,o){var u=r.entangledLanes|=o;for(r=r.entanglements;u;){var m=31-on(u),v=1<<m;v&o|r[m]&o&&(r[m]|=o),u&=~v}}var Ze=0;function di(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var hi,us,Xa,fi,pi,Qa=!1,Js=[],Nt=null,bn=null,kn=null,Lr=new Map,ea=new Map,ln=[],Ql="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 Xn(r,o){switch(r){case"focusin":case"focusout":Nt=null;break;case"dragenter":case"dragleave":bn=null;break;case"mouseover":case"mouseout":kn=null;break;case"pointerover":case"pointerout":Lr.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":ea.delete(o.pointerId)}}function ta(r,o,u,m,v,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:u,eventSystemFlags:m,nativeEvent:x,targetContainers:[v]},o!==null&&(o=Ui(o),o!==null&&us(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),r)}function Zl(r,o,u,m,v){switch(o){case"focusin":return Nt=ta(Nt,r,o,u,m,v),!0;case"dragenter":return bn=ta(bn,r,o,u,m,v),!0;case"mouseover":return kn=ta(kn,r,o,u,m,v),!0;case"pointerover":var x=v.pointerId;return Lr.set(x,ta(Lr.get(x)||null,r,o,u,m,v)),!0;case"gotpointercapture":return x=v.pointerId,ea.set(x,ta(ea.get(x)||null,r,o,u,m,v)),!0}return!1}function Jl(r){var o=ha(r.target);if(o!==null){var u=$n(o);if(u!==null){if(o=u.tag,o===13){if(o=Ua(u),o!==null){r.blockedOn=o,pi(r.priority,function(){Xa(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 Za(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var u=na(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(u===null){u=r.nativeEvent;var m=new u.constructor(u.type,u);it=m,u.target.dispatchEvent(m),it=null}else return o=Ui(u),o!==null&&us(o),r.blockedOn=u,!1;o.shift()}return!0}function mi(r,o,u){Za(r)&&u.delete(o)}function Md(){Qa=!1,Nt!==null&&Za(Nt)&&(Nt=null),bn!==null&&Za(bn)&&(bn=null),kn!==null&&Za(kn)&&(kn=null),Lr.forEach(mi),ea.forEach(mi)}function _n(r,o){r.blockedOn===o&&(r.blockedOn=null,Qa||(Qa=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Md)))}function Qn(r){function o(v){return _n(v,r)}if(0<Js.length){_n(Js[0],r);for(var u=1;u<Js.length;u++){var m=Js[u];m.blockedOn===r&&(m.blockedOn=null)}}for(Nt!==null&&_n(Nt,r),bn!==null&&_n(bn,r),kn!==null&&_n(kn,r),Lr.forEach(o),ea.forEach(o),u=0;u<ln.length;u++)m=ln[u],m.blockedOn===r&&(m.blockedOn=null);for(;0<ln.length&&(u=ln[0],u.blockedOn===null);)Jl(u),u.blockedOn===null&&ln.shift()}var Dr=C.ReactCurrentBatchConfig,ds=!0;function Zn(r,o,u,m){var v=Ze,x=Dr.transition;Dr.transition=null;try{Ze=1,cn(r,o,u,m)}finally{Ze=v,Dr.transition=x}}function Id(r,o,u,m){var v=Ze,x=Dr.transition;Dr.transition=null;try{Ze=4,cn(r,o,u,m)}finally{Ze=v,Dr.transition=x}}function cn(r,o,u,m){if(ds){var v=na(r,o,u,m);if(v===null)Hd(r,o,m,hs,u),Xn(r,m);else if(Zl(v,r,o,u,m))m.stopPropagation();else if(Xn(r,m),o&4&&-1<Ql.indexOf(r)){for(;v!==null;){var x=Ui(v);if(x!==null&&hi(x),x=na(r,o,u,m),x===null&&Hd(r,o,m,hs,u),x===v)break;v=x}v!==null&&m.stopPropagation()}else Hd(r,o,m,null,u)}}var hs=null;function na(r,o,u,m){if(hs=null,r=wt(m),r=ha(r),r!==null)if(o=$n(r),o===null)r=null;else if(u=o.tag,u===13){if(r=Ua(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 hs=r,null}function gi(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(Ha()){case On:return 1;case Ga:return 4;case Or:case Ys:return 16;case Va:return 536870912;default:return 16}default:return 16}}var Sn=null,ra=null,sa=null;function Ja(){if(sa)return sa;var r,o=ra,u=o.length,m,v="value"in Sn?Sn.value:Sn.textContent,x=v.length;for(r=0;r<u&&o[r]===v[r];r++);var T=u-r;for(m=1;m<=T&&o[u-m]===v[x-m];m++);return sa=v.slice(r,1<m?1-m:void 0)}function aa(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 fs(){return!0}function yi(){return!1}function Tt(r){function o(u,m,v,x,T){this._reactName=u,this._targetInst=v,this.type=m,this.nativeEvent=x,this.target=T,this.currentTarget=null;for(var V in r)r.hasOwnProperty(V)&&(u=r[V],this[V]=u?u(x):x[V]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?fs:yi,this.isPropagationStopped=yi,this}return J(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=fs)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=fs)},persist:function(){},isPersistent:fs}),o}var qr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},eo=Tt(qr),Fr=J({},qr,{view:0,detail:0}),$d=Tt(Fr),oa,gr,ps,to=J({},Fr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ro,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!==ps&&(ps&&r.type==="mousemove"?(oa=r.screenX-ps.screenX,gr=r.screenY-ps.screenY):gr=oa=0,ps=r),oa)},movementY:function(r){return"movementY"in r?r.movementY:gr}}),vi=Tt(to),ec=J({},to,{dataTransfer:0}),Od=Tt(ec),un=J({},Fr,{relatedTarget:0}),wi=Tt(un),xi=J({},qr,{animationName:0,elapsedTime:0,pseudoElement:0}),ms=Tt(xi),ia=J({},qr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),bi=Tt(ia),ki=J({},qr,{data:0}),_i=Tt(ki),no={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},tc={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"},Pd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ld(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Pd[r])?!!o[r]:!1}function ro(){return Ld}var Dd=J({},Fr,{key:function(r){if(r.key){var o=no[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=aa(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?tc[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ro,charCode:function(r){return r.type==="keypress"?aa(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?aa(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),qd=Tt(Dd),Si=J({},to,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jn=Tt(Si),Ni=J({},Fr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ro}),nc=Tt(Ni),Fd=J({},qr,{propertyName:0,elapsedTime:0,pseudoElement:0}),zd=Tt(Fd),rc=J({},to,{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}),sc=Tt(rc),yr=[9,13,27,32],Ei=d&&"CompositionEvent"in window,gs=null;d&&"documentMode"in document&&(gs=document.documentMode);var Bd=d&&"TextEvent"in window&&!gs,la=d&&(!Ei||gs&&8<gs&&11>=gs),ac=" ",Yt=!1;function so(r,o){switch(r){case"keyup":return yr.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ji(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var zr=!1;function oc(r,o){switch(r){case"compositionend":return ji(o);case"keypress":return o.which!==32?null:(Yt=!0,ac);case"textInput":return r=o.data,r===ac&&Yt?null:r;default:return null}}function Ci(r,o){if(zr)return r==="compositionend"||!Ei&&so(r,o)?(r=Ja(),sa=ra=Sn=null,zr=!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 la&&o.locale!=="ko"?null:o.data;default:return null}}var ao={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 oo(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!ao[r.type]:o==="textarea"}function Ti(r,o,u,m){Da(m),o=mc(o,"onChange"),0<o.length&&(u=new eo("onChange","change",null,u,m),r.push({event:u,listeners:o}))}var vr=null,ys=null;function Ri(r){qi(r,0)}function vs(r){var o=mo(r);if(Ve(o))return r}function ic(r,o){if(r==="change")return o}var Ot=!1;if(d){var io;if(d){var lo="oninput"in document;if(!lo){var lc=document.createElement("div");lc.setAttribute("oninput","return;"),lo=typeof lc.oninput=="function"}io=lo}else io=!1;Ot=io&&(!document.documentMode||9<document.documentMode)}function cc(){vr&&(vr.detachEvent("onpropertychange",Ai),ys=vr=null)}function Ai(r){if(r.propertyName==="value"&&vs(ys)){var o=[];Ti(o,ys,r,wt(r)),za(Ri,o)}}function ca(r,o,u){r==="focusin"?(cc(),vr=o,ys=u,vr.attachEvent("onpropertychange",Ai)):r==="focusout"&&cc()}function Ud(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return vs(ys)}function Br(r,o){if(r==="click")return vs(o)}function Mi(r,o){if(r==="input"||r==="change")return vs(o)}function Wd(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var Nn=typeof Object.is=="function"?Object.is:Wd;function En(r,o){if(Nn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var u=Object.keys(r),m=Object.keys(o);if(u.length!==m.length)return!1;for(m=0;m<u.length;m++){var v=u[m];if(!f.call(o,v)||!Nn(r[v],o[v]))return!1}return!0}function co(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function uc(r,o){var u=co(r);r=0;for(var m;u;){if(u.nodeType===3){if(m=r+u.textContent.length,r<=o&&m>=o)return{node:u,offset:o-r};r=m}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=co(u)}}function Ii(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Ii(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function $i(){for(var r=window,o=Le();o instanceof r.HTMLIFrameElement;){try{var u=typeof o.contentWindow.location.href=="string"}catch{u=!1}if(u)r=o.contentWindow;else break;o=Le(r.document)}return o}function Oi(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 dc(r){var o=$i(),u=r.focusedElem,m=r.selectionRange;if(o!==u&&u&&u.ownerDocument&&Ii(u.ownerDocument.documentElement,u)){if(m!==null&&Oi(u)){if(o=m.start,r=m.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 v=u.textContent.length,x=Math.min(m.start,v);m=m.end===void 0?x:Math.min(m.end,v),!r.extend&&x>m&&(v=m,m=x,x=v),v=uc(u,x);var T=uc(u,m);v&&T&&(r.rangeCount!==1||r.anchorNode!==v.node||r.anchorOffset!==v.offset||r.focusNode!==T.node||r.focusOffset!==T.offset)&&(o=o.createRange(),o.setStart(v.node,v.offset),r.removeAllRanges(),x>m?(r.addRange(o),r.extend(T.node,T.offset)):(o.setEnd(T.node,T.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 Pi=d&&"documentMode"in document&&11>=document.documentMode,wr=null,ws=null,Ur=null,Li=!1;function Di(r,o,u){var m=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Li||wr==null||wr!==Le(m)||(m=wr,"selectionStart"in m&&Oi(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Ur&&En(Ur,m)||(Ur=m,m=mc(ws,"onSelect"),0<m.length&&(o=new eo("onSelect","select",null,o,u),r.push({event:o,listeners:m}),o.target=wr)))}function ua(r,o){var u={};return u[r.toLowerCase()]=o.toLowerCase(),u["Webkit"+r]="webkit"+o,u["Moz"+r]="moz"+o,u}var Wr={animationend:ua("Animation","AnimationEnd"),animationiteration:ua("Animation","AnimationIteration"),animationstart:ua("Animation","AnimationStart"),transitionend:ua("Transition","TransitionEnd")},uo={},q={};d&&(q=document.createElement("div").style,"AnimationEvent"in window||(delete Wr.animationend.animation,delete Wr.animationiteration.animation,delete Wr.animationstart.animation),"TransitionEvent"in window||delete Wr.transitionend.transition);function W(r){if(uo[r])return uo[r];if(!Wr[r])return r;var o=Wr[r],u;for(u in o)if(o.hasOwnProperty(u)&&u in q)return uo[r]=o[u];return r}var ie=W("animationend"),de=W("animationiteration"),je=W("animationstart"),Re=W("transitionend"),He=new Map,et="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 rt(r,o){He.set(r,o),i(o,[r])}for(var st=0;st<et.length;st++){var Kt=et[st],ho=Kt.toLowerCase(),hc=Kt[0].toUpperCase()+Kt.slice(1);rt(ho,"on"+hc)}rt(ie,"onAnimationEnd"),rt(de,"onAnimationIteration"),rt(je,"onAnimationStart"),rt("dblclick","onDoubleClick"),rt("focusin","onFocus"),rt("focusout","onBlur"),rt(Re,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var da="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(" "),fc=new Set("cancel close invalid load scroll toggle".split(" ").concat(da));function pc(r,o,u){var m=r.type||"unknown-event";r.currentTarget=u,Ws(m,o,void 0,r),r.currentTarget=null}function qi(r,o){o=(o&4)!==0;for(var u=0;u<r.length;u++){var m=r[u],v=m.event;m=m.listeners;e:{var x=void 0;if(o)for(var T=m.length-1;0<=T;T--){var V=m[T],te=V.instance,ce=V.currentTarget;if(V=V.listener,te!==x&&v.isPropagationStopped())break e;pc(v,V,ce),x=te}else for(T=0;T<m.length;T++){if(V=m[T],te=V.instance,ce=V.currentTarget,V=V.listener,te!==x&&v.isPropagationStopped())break e;pc(v,V,ce),x=te}}}if(Mr)throw r=is,Mr=!1,is=null,r}function lt(r,o){var u=o[Qd];u===void 0&&(u=o[Qd]=new Set);var m=r+"__bubble";u.has(m)||(Fi(o,r,2,!1),u.add(m))}function Hr(r,o,u){var m=0;o&&(m|=4),Fi(u,r,m,o)}var xr="_reactListening"+Math.random().toString(36).slice(2);function mt(r){if(!r[xr]){r[xr]=!0,s.forEach(function(u){u!=="selectionchange"&&(fc.has(u)||Hr(u,!1,r),Hr(u,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[xr]||(o[xr]=!0,Hr("selectionchange",!1,o))}}function Fi(r,o,u,m){switch(gi(o)){case 1:var v=Zn;break;case 4:v=Id;break;default:v=cn}u=v.bind(null,o,u,r),v=void 0,!mr||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),m?v!==void 0?r.addEventListener(o,u,{capture:!0,passive:v}):r.addEventListener(o,u,!0):v!==void 0?r.addEventListener(o,u,{passive:v}):r.addEventListener(o,u,!1)}function Hd(r,o,u,m,v){var x=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var V=m.stateNode.containerInfo;if(V===v||V.nodeType===8&&V.parentNode===v)break;if(T===4)for(T=m.return;T!==null;){var te=T.tag;if((te===3||te===4)&&(te=T.stateNode.containerInfo,te===v||te.nodeType===8&&te.parentNode===v))return;T=T.return}for(;V!==null;){if(T=ha(V),T===null)return;if(te=T.tag,te===5||te===6){m=x=T;continue e}V=V.parentNode}}m=m.return}za(function(){var ce=x,ye=wt(u),ve=[];e:{var ge=He.get(r);if(ge!==void 0){var Ee=eo,Te=r;switch(r){case"keypress":if(aa(u)===0)break e;case"keydown":case"keyup":Ee=qd;break;case"focusin":Te="focus",Ee=wi;break;case"focusout":Te="blur",Ee=wi;break;case"beforeblur":case"afterblur":Ee=wi;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":Ee=vi;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ee=Od;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ee=nc;break;case ie:case de:case je:Ee=ms;break;case Re:Ee=zd;break;case"scroll":Ee=$d;break;case"wheel":Ee=sc;break;case"copy":case"cut":case"paste":Ee=bi;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ee=Jn}var Me=(o&4)!==0,Ct=!Me&&r==="scroll",ae=Me?ge!==null?ge+"Capture":null:ge;Me=[];for(var ne=ce,oe;ne!==null;){oe=ne;var xe=oe.stateNode;if(oe.tag===5&&xe!==null&&(oe=xe,ae!==null&&(xe=$t(ne,ae),xe!=null&&Me.push(zi(ne,xe,oe)))),Ct)break;ne=ne.return}0<Me.length&&(ge=new Ee(ge,Te,null,u,ye),ve.push({event:ge,listeners:Me}))}}if((o&7)===0){e:{if(ge=r==="mouseover"||r==="pointerover",Ee=r==="mouseout"||r==="pointerout",ge&&u!==it&&(Te=u.relatedTarget||u.fromElement)&&(ha(Te)||Te[Gr]))break e;if((Ee||ge)&&(ge=ye.window===ye?ye:(ge=ye.ownerDocument)?ge.defaultView||ge.parentWindow:window,Ee?(Te=u.relatedTarget||u.toElement,Ee=ce,Te=Te?ha(Te):null,Te!==null&&(Ct=$n(Te),Te!==Ct||Te.tag!==5&&Te.tag!==6)&&(Te=null)):(Ee=null,Te=ce),Ee!==Te)){if(Me=vi,xe="onMouseLeave",ae="onMouseEnter",ne="mouse",(r==="pointerout"||r==="pointerover")&&(Me=Jn,xe="onPointerLeave",ae="onPointerEnter",ne="pointer"),Ct=Ee==null?ge:mo(Ee),oe=Te==null?ge:mo(Te),ge=new Me(xe,ne+"leave",Ee,u,ye),ge.target=Ct,ge.relatedTarget=oe,xe=null,ha(ye)===ce&&(Me=new Me(ae,ne+"enter",Te,u,ye),Me.target=oe,Me.relatedTarget=Ct,xe=Me),Ct=xe,Ee&&Te)t:{for(Me=Ee,ae=Te,ne=0,oe=Me;oe;oe=fo(oe))ne++;for(oe=0,xe=ae;xe;xe=fo(xe))oe++;for(;0<ne-oe;)Me=fo(Me),ne--;for(;0<oe-ne;)ae=fo(ae),oe--;for(;ne--;){if(Me===ae||ae!==null&&Me===ae.alternate)break t;Me=fo(Me),ae=fo(ae)}Me=null}else Me=null;Ee!==null&&E0(ve,ge,Ee,Me,!1),Te!==null&&Ct!==null&&E0(ve,Ct,Te,Me,!0)}}e:{if(ge=ce?mo(ce):window,Ee=ge.nodeName&&ge.nodeName.toLowerCase(),Ee==="select"||Ee==="input"&&ge.type==="file")var Ie=ic;else if(oo(ge))if(Ot)Ie=Mi;else{Ie=Ud;var Fe=ca}else(Ee=ge.nodeName)&&Ee.toLowerCase()==="input"&&(ge.type==="checkbox"||ge.type==="radio")&&(Ie=Br);if(Ie&&(Ie=Ie(r,ce))){Ti(ve,Ie,u,ye);break e}Fe&&Fe(r,ge,ce),r==="focusout"&&(Fe=ge._wrapperState)&&Fe.controlled&&ge.type==="number"&&Qe(ge,"number",ge.value)}switch(Fe=ce?mo(ce):window,r){case"focusin":(oo(Fe)||Fe.contentEditable==="true")&&(wr=Fe,ws=ce,Ur=null);break;case"focusout":Ur=ws=wr=null;break;case"mousedown":Li=!0;break;case"contextmenu":case"mouseup":case"dragend":Li=!1,Di(ve,u,ye);break;case"selectionchange":if(Pi)break;case"keydown":case"keyup":Di(ve,u,ye)}var ze;if(Ei)e:{switch(r){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else zr?so(r,u)&&(We="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(We="onCompositionStart");We&&(la&&u.locale!=="ko"&&(zr||We!=="onCompositionStart"?We==="onCompositionEnd"&&zr&&(ze=Ja()):(Sn=ye,ra="value"in Sn?Sn.value:Sn.textContent,zr=!0)),Fe=mc(ce,We),0<Fe.length&&(We=new _i(We,r,null,u,ye),ve.push({event:We,listeners:Fe}),ze?We.data=ze:(ze=ji(u),ze!==null&&(We.data=ze)))),(ze=Bd?oc(r,u):Ci(r,u))&&(ce=mc(ce,"onBeforeInput"),0<ce.length&&(ye=new _i("onBeforeInput","beforeinput",null,u,ye),ve.push({event:ye,listeners:ce}),ye.data=ze))}qi(ve,o)})}function zi(r,o,u){return{instance:r,listener:o,currentTarget:u}}function mc(r,o){for(var u=o+"Capture",m=[];r!==null;){var v=r,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=$t(r,u),x!=null&&m.unshift(zi(r,x,v)),x=$t(r,o),x!=null&&m.push(zi(r,x,v))),r=r.return}return m}function fo(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function E0(r,o,u,m,v){for(var x=o._reactName,T=[];u!==null&&u!==m;){var V=u,te=V.alternate,ce=V.stateNode;if(te!==null&&te===m)break;V.tag===5&&ce!==null&&(V=ce,v?(te=$t(u,x),te!=null&&T.unshift(zi(u,te,V))):v||(te=$t(u,x),te!=null&&T.push(zi(u,te,V)))),u=u.return}T.length!==0&&r.push({event:o,listeners:T})}var CA=/\r\n?/g,TA=/\u0000|\uFFFD/g;function j0(r){return(typeof r=="string"?r:""+r).replace(CA,`
|
|
38
|
+
`).replace(TA,"")}function gc(r,o,u){if(o=j0(o),j0(r)!==o&&u)throw Error(n(425))}function yc(){}var Gd=null,Vd=null;function Yd(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 Kd=typeof setTimeout=="function"?setTimeout:void 0,RA=typeof clearTimeout=="function"?clearTimeout:void 0,C0=typeof Promise=="function"?Promise:void 0,AA=typeof queueMicrotask=="function"?queueMicrotask:typeof C0<"u"?function(r){return C0.resolve(null).then(r).catch(MA)}:Kd;function MA(r){setTimeout(function(){throw r})}function Xd(r,o){var u=o,m=0;do{var v=u.nextSibling;if(r.removeChild(u),v&&v.nodeType===8)if(u=v.data,u==="/$"){if(m===0){r.removeChild(v),Qn(o);return}m--}else u!=="$"&&u!=="$?"&&u!=="$!"||m++;u=v}while(u);Qn(o)}function xs(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 po=Math.random().toString(36).slice(2),br="__reactFiber$"+po,Bi="__reactProps$"+po,Gr="__reactContainer$"+po,Qd="__reactEvents$"+po,IA="__reactListeners$"+po,$A="__reactHandles$"+po;function ha(r){var o=r[br];if(o)return o;for(var u=r.parentNode;u;){if(o=u[Gr]||u[br]){if(u=o.alternate,o.child!==null||u!==null&&u.child!==null)for(r=T0(r);r!==null;){if(u=r[br])return u;r=T0(r)}return o}r=u,u=r.parentNode}return null}function Ui(r){return r=r[br]||r[Gr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function mo(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function vc(r){return r[Bi]||null}var Zd=[],go=-1;function bs(r){return{current:r}}function pt(r){0>go||(r.current=Zd[go],Zd[go]=null,go--)}function ht(r,o){go++,Zd[go]=r.current,r.current=o}var ks={},Xt=bs(ks),dn=bs(!1),fa=ks;function yo(r,o){var u=r.type.contextTypes;if(!u)return ks;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var v={},x;for(x in u)v[x]=o[x];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=v),v}function hn(r){return r=r.childContextTypes,r!=null}function wc(){pt(dn),pt(Xt)}function R0(r,o,u){if(Xt.current!==ks)throw Error(n(168));ht(Xt,o),ht(dn,u)}function A0(r,o,u){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return u;m=m.getChildContext();for(var v in m)if(!(v in o))throw Error(n(108,Y(r)||"Unknown",v));return J({},u,m)}function xc(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||ks,fa=Xt.current,ht(Xt,r),ht(dn,dn.current),!0}function M0(r,o,u){var m=r.stateNode;if(!m)throw Error(n(169));u?(r=A0(r,o,fa),m.__reactInternalMemoizedMergedChildContext=r,pt(dn),pt(Xt),ht(Xt,r)):pt(dn),ht(dn,u)}var Vr=null,bc=!1,Jd=!1;function I0(r){Vr===null?Vr=[r]:Vr.push(r)}function OA(r){bc=!0,I0(r)}function _s(){if(!Jd&&Vr!==null){Jd=!0;var r=0,o=Ze;try{var u=Vr;for(Ze=1;r<u.length;r++){var m=u[r];do m=m(!0);while(m!==null)}Vr=null,bc=!1}catch(v){throw Vr!==null&&(Vr=Vr.slice(r+1)),Wa(On,_s),v}finally{Ze=o,Jd=!1}}return null}var vo=[],wo=0,kc=null,_c=0,Dn=[],qn=0,pa=null,Yr=1,Kr="";function ma(r,o){vo[wo++]=_c,vo[wo++]=kc,kc=r,_c=o}function $0(r,o,u){Dn[qn++]=Yr,Dn[qn++]=Kr,Dn[qn++]=pa,pa=r;var m=Yr;r=Kr;var v=32-on(m)-1;m&=~(1<<v),u+=1;var x=32-on(o)+v;if(30<x){var T=v-v%5;x=(m&(1<<T)-1).toString(32),m>>=T,v-=T,Yr=1<<32-on(o)+v|u<<v|m,Kr=x+r}else Yr=1<<x|u<<v|m,Kr=r}function eh(r){r.return!==null&&(ma(r,1),$0(r,1,0))}function th(r){for(;r===kc;)kc=vo[--wo],vo[wo]=null,_c=vo[--wo],vo[wo]=null;for(;r===pa;)pa=Dn[--qn],Dn[qn]=null,Kr=Dn[--qn],Dn[qn]=null,Yr=Dn[--qn],Dn[qn]=null}var jn=null,Cn=null,gt=!1,er=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 P0(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,Cn=xs(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,jn=r,Cn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(u=pa!==null?{id:Yr,overflow:Kr}: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,Cn=null,!0):!1;default:return!1}}function nh(r){return(r.mode&1)!==0&&(r.flags&128)===0}function rh(r){if(gt){var o=Cn;if(o){var u=o;if(!P0(r,o)){if(nh(r))throw Error(n(418));o=xs(u.nextSibling);var m=jn;o&&P0(r,o)?O0(m,u):(r.flags=r.flags&-4097|2,gt=!1,jn=r)}}else{if(nh(r))throw Error(n(418));r.flags=r.flags&-4097|2,gt=!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 Sc(r){if(r!==jn)return!1;if(!gt)return L0(r),gt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Yd(r.type,r.memoizedProps)),o&&(o=Cn)){if(nh(r))throw D0(),Error(n(418));for(;o;)O0(r,o),o=xs(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){Cn=xs(r.nextSibling);break e}o--}else u!=="$"&&u!=="$!"&&u!=="$?"||o++}r=r.nextSibling}Cn=null}}else Cn=jn?xs(r.stateNode.nextSibling):null;return!0}function D0(){for(var r=Cn;r;)r=xs(r.nextSibling)}function xo(){Cn=jn=null,gt=!1}function sh(r){er===null?er=[r]:er.push(r)}var PA=C.ReactCurrentBatchConfig;function Wi(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 m=u.stateNode}if(!m)throw Error(n(147,r));var v=m,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(T){var V=v.refs;T===null?delete V[x]:V[x]=T},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,r))}return r}function Nc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function q0(r){var o=r._init;return o(r._payload)}function F0(r){function o(ae,ne){if(r){var oe=ae.deletions;oe===null?(ae.deletions=[ne],ae.flags|=16):oe.push(ne)}}function u(ae,ne){if(!r)return null;for(;ne!==null;)o(ae,ne),ne=ne.sibling;return null}function m(ae,ne){for(ae=new Map;ne!==null;)ne.key!==null?ae.set(ne.key,ne):ae.set(ne.index,ne),ne=ne.sibling;return ae}function v(ae,ne){return ae=As(ae,ne),ae.index=0,ae.sibling=null,ae}function x(ae,ne,oe){return ae.index=oe,r?(oe=ae.alternate,oe!==null?(oe=oe.index,oe<ne?(ae.flags|=2,ne):oe):(ae.flags|=2,ne)):(ae.flags|=1048576,ne)}function T(ae){return r&&ae.alternate===null&&(ae.flags|=2),ae}function V(ae,ne,oe,xe){return ne===null||ne.tag!==6?(ne=Kh(oe,ae.mode,xe),ne.return=ae,ne):(ne=v(ne,oe),ne.return=ae,ne)}function te(ae,ne,oe,xe){var Ie=oe.type;return Ie===I?ye(ae,ne,oe.props.children,xe,oe.key):ne!==null&&(ne.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===B&&q0(Ie)===ne.type)?(xe=v(ne,oe.props),xe.ref=Wi(ae,ne,oe),xe.return=ae,xe):(xe=Kc(oe.type,oe.key,oe.props,null,ae.mode,xe),xe.ref=Wi(ae,ne,oe),xe.return=ae,xe)}function ce(ae,ne,oe,xe){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==oe.containerInfo||ne.stateNode.implementation!==oe.implementation?(ne=Xh(oe,ae.mode,xe),ne.return=ae,ne):(ne=v(ne,oe.children||[]),ne.return=ae,ne)}function ye(ae,ne,oe,xe,Ie){return ne===null||ne.tag!==7?(ne=_a(oe,ae.mode,xe,Ie),ne.return=ae,ne):(ne=v(ne,oe),ne.return=ae,ne)}function ve(ae,ne,oe){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=Kh(""+ne,ae.mode,oe),ne.return=ae,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case M:return oe=Kc(ne.type,ne.key,ne.props,null,ae.mode,oe),oe.ref=Wi(ae,null,ne),oe.return=ae,oe;case $:return ne=Xh(ne,ae.mode,oe),ne.return=ae,ne;case B:var xe=ne._init;return ve(ae,xe(ne._payload),oe)}if(ft(ne)||F(ne))return ne=_a(ne,ae.mode,oe,null),ne.return=ae,ne;Nc(ae,ne)}return null}function ge(ae,ne,oe,xe){var Ie=ne!==null?ne.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number")return Ie!==null?null:V(ae,ne,""+oe,xe);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case M:return oe.key===Ie?te(ae,ne,oe,xe):null;case $:return oe.key===Ie?ce(ae,ne,oe,xe):null;case B:return Ie=oe._init,ge(ae,ne,Ie(oe._payload),xe)}if(ft(oe)||F(oe))return Ie!==null?null:ye(ae,ne,oe,xe,null);Nc(ae,oe)}return null}function Ee(ae,ne,oe,xe,Ie){if(typeof xe=="string"&&xe!==""||typeof xe=="number")return ae=ae.get(oe)||null,V(ne,ae,""+xe,Ie);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case M:return ae=ae.get(xe.key===null?oe:xe.key)||null,te(ne,ae,xe,Ie);case $:return ae=ae.get(xe.key===null?oe:xe.key)||null,ce(ne,ae,xe,Ie);case B:var Fe=xe._init;return Ee(ae,ne,oe,Fe(xe._payload),Ie)}if(ft(xe)||F(xe))return ae=ae.get(oe)||null,ye(ne,ae,xe,Ie,null);Nc(ne,xe)}return null}function Te(ae,ne,oe,xe){for(var Ie=null,Fe=null,ze=ne,We=ne=0,Bt=null;ze!==null&&We<oe.length;We++){ze.index>We?(Bt=ze,ze=null):Bt=ze.sibling;var nt=ge(ae,ze,oe[We],xe);if(nt===null){ze===null&&(ze=Bt);break}r&&ze&&nt.alternate===null&&o(ae,ze),ne=x(nt,ne,We),Fe===null?Ie=nt:Fe.sibling=nt,Fe=nt,ze=Bt}if(We===oe.length)return u(ae,ze),gt&&ma(ae,We),Ie;if(ze===null){for(;We<oe.length;We++)ze=ve(ae,oe[We],xe),ze!==null&&(ne=x(ze,ne,We),Fe===null?Ie=ze:Fe.sibling=ze,Fe=ze);return gt&&ma(ae,We),Ie}for(ze=m(ae,ze);We<oe.length;We++)Bt=Ee(ze,ae,We,oe[We],xe),Bt!==null&&(r&&Bt.alternate!==null&&ze.delete(Bt.key===null?We:Bt.key),ne=x(Bt,ne,We),Fe===null?Ie=Bt:Fe.sibling=Bt,Fe=Bt);return r&&ze.forEach(function(Ms){return o(ae,Ms)}),gt&&ma(ae,We),Ie}function Me(ae,ne,oe,xe){var Ie=F(oe);if(typeof Ie!="function")throw Error(n(150));if(oe=Ie.call(oe),oe==null)throw Error(n(151));for(var Fe=Ie=null,ze=ne,We=ne=0,Bt=null,nt=oe.next();ze!==null&&!nt.done;We++,nt=oe.next()){ze.index>We?(Bt=ze,ze=null):Bt=ze.sibling;var Ms=ge(ae,ze,nt.value,xe);if(Ms===null){ze===null&&(ze=Bt);break}r&&ze&&Ms.alternate===null&&o(ae,ze),ne=x(Ms,ne,We),Fe===null?Ie=Ms:Fe.sibling=Ms,Fe=Ms,ze=Bt}if(nt.done)return u(ae,ze),gt&&ma(ae,We),Ie;if(ze===null){for(;!nt.done;We++,nt=oe.next())nt=ve(ae,nt.value,xe),nt!==null&&(ne=x(nt,ne,We),Fe===null?Ie=nt:Fe.sibling=nt,Fe=nt);return gt&&ma(ae,We),Ie}for(ze=m(ae,ze);!nt.done;We++,nt=oe.next())nt=Ee(ze,ae,We,nt.value,xe),nt!==null&&(r&&nt.alternate!==null&&ze.delete(nt.key===null?We:nt.key),ne=x(nt,ne,We),Fe===null?Ie=nt:Fe.sibling=nt,Fe=nt);return r&&ze.forEach(function(mM){return o(ae,mM)}),gt&&ma(ae,We),Ie}function Ct(ae,ne,oe,xe){if(typeof oe=="object"&&oe!==null&&oe.type===I&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case M:e:{for(var Ie=oe.key,Fe=ne;Fe!==null;){if(Fe.key===Ie){if(Ie=oe.type,Ie===I){if(Fe.tag===7){u(ae,Fe.sibling),ne=v(Fe,oe.props.children),ne.return=ae,ae=ne;break e}}else if(Fe.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===B&&q0(Ie)===Fe.type){u(ae,Fe.sibling),ne=v(Fe,oe.props),ne.ref=Wi(ae,Fe,oe),ne.return=ae,ae=ne;break e}u(ae,Fe);break}else o(ae,Fe);Fe=Fe.sibling}oe.type===I?(ne=_a(oe.props.children,ae.mode,xe,oe.key),ne.return=ae,ae=ne):(xe=Kc(oe.type,oe.key,oe.props,null,ae.mode,xe),xe.ref=Wi(ae,ne,oe),xe.return=ae,ae=xe)}return T(ae);case $:e:{for(Fe=oe.key;ne!==null;){if(ne.key===Fe)if(ne.tag===4&&ne.stateNode.containerInfo===oe.containerInfo&&ne.stateNode.implementation===oe.implementation){u(ae,ne.sibling),ne=v(ne,oe.children||[]),ne.return=ae,ae=ne;break e}else{u(ae,ne);break}else o(ae,ne);ne=ne.sibling}ne=Xh(oe,ae.mode,xe),ne.return=ae,ae=ne}return T(ae);case B:return Fe=oe._init,Ct(ae,ne,Fe(oe._payload),xe)}if(ft(oe))return Te(ae,ne,oe,xe);if(F(oe))return Me(ae,ne,oe,xe);Nc(ae,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"?(oe=""+oe,ne!==null&&ne.tag===6?(u(ae,ne.sibling),ne=v(ne,oe),ne.return=ae,ae=ne):(u(ae,ne),ne=Kh(oe,ae.mode,xe),ne.return=ae,ae=ne),T(ae)):u(ae,ne)}return Ct}var bo=F0(!0),z0=F0(!1),Ec=bs(null),jc=null,ko=null,ah=null;function oh(){ah=ko=jc=null}function ih(r){var o=Ec.current;pt(Ec),r._currentValue=o}function lh(r,o,u){for(;r!==null;){var m=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,m!==null&&(m.childLanes|=o)):m!==null&&(m.childLanes&o)!==o&&(m.childLanes|=o),r===u)break;r=r.return}}function _o(r,o){jc=r,ah=ko=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(fn=!0),r.firstContext=null)}function Fn(r){var o=r._currentValue;if(ah!==r)if(r={context:r,memoizedValue:o,next:null},ko===null){if(jc===null)throw Error(n(308));ko=r,jc.dependencies={lanes:0,firstContext:r}}else ko=ko.next=r;return o}var ga=null;function ch(r){ga===null?ga=[r]:ga.push(r)}function B0(r,o,u,m){var v=o.interleaved;return v===null?(u.next=u,ch(o)):(u.next=v.next,v.next=u),o.interleaved=u,Xr(r,m)}function Xr(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 Ss=!1;function uh(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function U0(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 Qr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Ns(r,o,u){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(tt&2)!==0){var v=m.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),m.pending=o,Xr(r,u)}return v=m.interleaved,v===null?(o.next=o,ch(m)):(o.next=v.next,v.next=o),m.interleaved=o,Xr(r,u)}function Cc(r,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194240)!==0)){var m=o.lanes;m&=r.pendingLanes,u|=m,o.lanes=u,Ka(r,u)}}function W0(r,o){var u=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,u===m)){var v=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var T={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};x===null?v=x=T:x=x.next=T,u=u.next}while(u!==null);x===null?v=x=o:x=x.next=o}else v=x=o;u={baseState:m.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:m.shared,effects:m.effects},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=o:r.next=o,u.lastBaseUpdate=o}function Tc(r,o,u,m){var v=r.updateQueue;Ss=!1;var x=v.firstBaseUpdate,T=v.lastBaseUpdate,V=v.shared.pending;if(V!==null){v.shared.pending=null;var te=V,ce=te.next;te.next=null,T===null?x=ce:T.next=ce,T=te;var ye=r.alternate;ye!==null&&(ye=ye.updateQueue,V=ye.lastBaseUpdate,V!==T&&(V===null?ye.firstBaseUpdate=ce:V.next=ce,ye.lastBaseUpdate=te))}if(x!==null){var ve=v.baseState;T=0,ye=ce=te=null,V=x;do{var ge=V.lane,Ee=V.eventTime;if((m&ge)===ge){ye!==null&&(ye=ye.next={eventTime:Ee,lane:0,tag:V.tag,payload:V.payload,callback:V.callback,next:null});e:{var Te=r,Me=V;switch(ge=o,Ee=u,Me.tag){case 1:if(Te=Me.payload,typeof Te=="function"){ve=Te.call(Ee,ve,ge);break e}ve=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Me.payload,ge=typeof Te=="function"?Te.call(Ee,ve,ge):Te,ge==null)break e;ve=J({},ve,ge);break e;case 2:Ss=!0}}V.callback!==null&&V.lane!==0&&(r.flags|=64,ge=v.effects,ge===null?v.effects=[V]:ge.push(V))}else Ee={eventTime:Ee,lane:ge,tag:V.tag,payload:V.payload,callback:V.callback,next:null},ye===null?(ce=ye=Ee,te=ve):ye=ye.next=Ee,T|=ge;if(V=V.next,V===null){if(V=v.shared.pending,V===null)break;ge=V,V=ge.next,ge.next=null,v.lastBaseUpdate=ge,v.shared.pending=null}}while(!0);if(ye===null&&(te=ve),v.baseState=te,v.firstBaseUpdate=ce,v.lastBaseUpdate=ye,o=v.shared.interleaved,o!==null){v=o;do T|=v.lane,v=v.next;while(v!==o)}else x===null&&(v.shared.lanes=0);wa|=T,r.lanes=T,r.memoizedState=ve}}function H0(r,o,u){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],v=m.callback;if(v!==null){if(m.callback=null,m=u,typeof v!="function")throw Error(n(191,v));v.call(m)}}}var Hi={},kr=bs(Hi),Gi=bs(Hi),Vi=bs(Hi);function ya(r){if(r===Hi)throw Error(n(174));return r}function dh(r,o){switch(ht(Vi,o),ht(Gi,r),ht(kr,Hi),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:Ue(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=Ue(o,r)}pt(kr),ht(kr,o)}function So(){pt(kr),pt(Gi),pt(Vi)}function G0(r){ya(Vi.current);var o=ya(kr.current),u=Ue(o,r.type);o!==u&&(ht(Gi,r),ht(kr,u))}function hh(r){Gi.current===r&&(pt(kr),pt(Gi))}var bt=bs(0);function Rc(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 fh=[];function ph(){for(var r=0;r<fh.length;r++)fh[r]._workInProgressVersionPrimary=null;fh.length=0}var Ac=C.ReactCurrentDispatcher,mh=C.ReactCurrentBatchConfig,va=0,kt=null,Pt=null,Ft=null,Mc=!1,Yi=!1,Ki=0,LA=0;function Qt(){throw Error(n(321))}function gh(r,o){if(o===null)return!1;for(var u=0;u<o.length&&u<r.length;u++)if(!Nn(r[u],o[u]))return!1;return!0}function yh(r,o,u,m,v,x){if(va=x,kt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Ac.current=r===null||r.memoizedState===null?zA:BA,r=u(m,v),Yi){x=0;do{if(Yi=!1,Ki=0,25<=x)throw Error(n(301));x+=1,Ft=Pt=null,o.updateQueue=null,Ac.current=UA,r=u(m,v)}while(Yi)}if(Ac.current=Oc,o=Pt!==null&&Pt.next!==null,va=0,Ft=Pt=kt=null,Mc=!1,o)throw Error(n(300));return r}function vh(){var r=Ki!==0;return Ki=0,r}function _r(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ft===null?kt.memoizedState=Ft=r:Ft=Ft.next=r,Ft}function zn(){if(Pt===null){var r=kt.alternate;r=r!==null?r.memoizedState:null}else r=Pt.next;var o=Ft===null?kt.memoizedState:Ft.next;if(o!==null)Ft=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},Ft===null?kt.memoizedState=Ft=r:Ft=Ft.next=r}return Ft}function Xi(r,o){return typeof o=="function"?o(r):o}function wh(r){var o=zn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var m=Pt,v=m.baseQueue,x=u.pending;if(x!==null){if(v!==null){var T=v.next;v.next=x.next,x.next=T}m.baseQueue=v=x,u.pending=null}if(v!==null){x=v.next,m=m.baseState;var V=T=null,te=null,ce=x;do{var ye=ce.lane;if((va&ye)===ye)te!==null&&(te=te.next={lane:0,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),m=ce.hasEagerState?ce.eagerState:r(m,ce.action);else{var ve={lane:ye,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null};te===null?(V=te=ve,T=m):te=te.next=ve,kt.lanes|=ye,wa|=ye}ce=ce.next}while(ce!==null&&ce!==x);te===null?T=m:te.next=V,Nn(m,o.memoizedState)||(fn=!0),o.memoizedState=m,o.baseState=T,o.baseQueue=te,u.lastRenderedState=m}if(r=u.interleaved,r!==null){v=r;do x=v.lane,kt.lanes|=x,wa|=x,v=v.next;while(v!==r)}else v===null&&(u.lanes=0);return[o.memoizedState,u.dispatch]}function xh(r){var o=zn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var m=u.dispatch,v=u.pending,x=o.memoizedState;if(v!==null){u.pending=null;var T=v=v.next;do x=r(x,T.action),T=T.next;while(T!==v);Nn(x,o.memoizedState)||(fn=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),u.lastRenderedState=x}return[x,m]}function V0(){}function Y0(r,o){var u=kt,m=zn(),v=o(),x=!Nn(m.memoizedState,v);if(x&&(m.memoizedState=v,fn=!0),m=m.queue,bh(Q0.bind(null,u,m,r),[r]),m.getSnapshot!==o||x||Ft!==null&&Ft.memoizedState.tag&1){if(u.flags|=2048,Qi(9,X0.bind(null,u,m,v,o),void 0,null),zt===null)throw Error(n(349));(va&30)!==0||K0(u,o,v)}return v}function K0(r,o,u){r.flags|=16384,r={getSnapshot:o,value:u},o=kt.updateQueue,o===null?(o={lastEffect:null,stores:null},kt.updateQueue=o,o.stores=[r]):(u=o.stores,u===null?o.stores=[r]:u.push(r))}function X0(r,o,u,m){o.value=u,o.getSnapshot=m,Z0(o)&&J0(r)}function Q0(r,o,u){return u(function(){Z0(o)&&J0(r)})}function Z0(r){var o=r.getSnapshot;r=r.value;try{var u=o();return!Nn(r,u)}catch{return!0}}function J0(r){var o=Xr(r,1);o!==null&&sr(o,r,1,-1)}function ex(r){var o=_r();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Xi,lastRenderedState:r},o.queue=r,r=r.dispatch=FA.bind(null,kt,r),[o.memoizedState,r]}function Qi(r,o,u,m){return r={tag:r,create:o,destroy:u,deps:m,next:null},o=kt.updateQueue,o===null?(o={lastEffect:null,stores:null},kt.updateQueue=o,o.lastEffect=r.next=r):(u=o.lastEffect,u===null?o.lastEffect=r.next=r:(m=u.next,u.next=r,r.next=m,o.lastEffect=r)),r}function tx(){return zn().memoizedState}function Ic(r,o,u,m){var v=_r();kt.flags|=r,v.memoizedState=Qi(1|o,u,void 0,m===void 0?null:m)}function $c(r,o,u,m){var v=zn();m=m===void 0?null:m;var x=void 0;if(Pt!==null){var T=Pt.memoizedState;if(x=T.destroy,m!==null&&gh(m,T.deps)){v.memoizedState=Qi(o,u,x,m);return}}kt.flags|=r,v.memoizedState=Qi(1|o,u,x,m)}function nx(r,o){return Ic(8390656,8,r,o)}function bh(r,o){return $c(2048,8,r,o)}function rx(r,o){return $c(4,2,r,o)}function sx(r,o){return $c(4,4,r,o)}function ax(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 ox(r,o,u){return u=u!=null?u.concat([r]):null,$c(4,4,ax.bind(null,o,r),u)}function kh(){}function ix(r,o){var u=zn();o=o===void 0?null:o;var m=u.memoizedState;return m!==null&&o!==null&&gh(o,m[1])?m[0]:(u.memoizedState=[r,o],r)}function lx(r,o){var u=zn();o=o===void 0?null:o;var m=u.memoizedState;return m!==null&&o!==null&&gh(o,m[1])?m[0]:(r=r(),u.memoizedState=[r,o],r)}function cx(r,o,u){return(va&21)===0?(r.baseState&&(r.baseState=!1,fn=!0),r.memoizedState=u):(Nn(u,o)||(u=Qs(),kt.lanes|=u,wa|=u,r.baseState=!0),o)}function DA(r,o){var u=Ze;Ze=u!==0&&4>u?u:4,r(!0);var m=mh.transition;mh.transition={};try{r(!1),o()}finally{Ze=u,mh.transition=m}}function ux(){return zn().memoizedState}function qA(r,o,u){var m=Ts(r);if(u={lane:m,action:u,hasEagerState:!1,eagerState:null,next:null},dx(r))hx(o,u);else if(u=B0(r,o,u,m),u!==null){var v=an();sr(u,r,m,v),fx(u,o,m)}}function FA(r,o,u){var m=Ts(r),v={lane:m,action:u,hasEagerState:!1,eagerState:null,next:null};if(dx(r))hx(o,v);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var T=o.lastRenderedState,V=x(T,u);if(v.hasEagerState=!0,v.eagerState=V,Nn(V,T)){var te=o.interleaved;te===null?(v.next=v,ch(o)):(v.next=te.next,te.next=v),o.interleaved=v;return}}catch{}finally{}u=B0(r,o,v,m),u!==null&&(v=an(),sr(u,r,m,v),fx(u,o,m))}}function dx(r){var o=r.alternate;return r===kt||o!==null&&o===kt}function hx(r,o){Yi=Mc=!0;var u=r.pending;u===null?o.next=o:(o.next=u.next,u.next=o),r.pending=o}function fx(r,o,u){if((u&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,u|=m,o.lanes=u,Ka(r,u)}}var Oc={readContext:Fn,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useInsertionEffect:Qt,useLayoutEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useMutableSource:Qt,useSyncExternalStore:Qt,useId:Qt,unstable_isNewReconciler:!1},zA={readContext:Fn,useCallback:function(r,o){return _r().memoizedState=[r,o===void 0?null:o],r},useContext:Fn,useEffect:nx,useImperativeHandle:function(r,o,u){return u=u!=null?u.concat([r]):null,Ic(4194308,4,ax.bind(null,o,r),u)},useLayoutEffect:function(r,o){return Ic(4194308,4,r,o)},useInsertionEffect:function(r,o){return Ic(4,2,r,o)},useMemo:function(r,o){var u=_r();return o=o===void 0?null:o,r=r(),u.memoizedState=[r,o],r},useReducer:function(r,o,u){var m=_r();return o=u!==void 0?u(o):o,m.memoizedState=m.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},m.queue=r,r=r.dispatch=qA.bind(null,kt,r),[m.memoizedState,r]},useRef:function(r){var o=_r();return r={current:r},o.memoizedState=r},useState:ex,useDebugValue:kh,useDeferredValue:function(r){return _r().memoizedState=r},useTransition:function(){var r=ex(!1),o=r[0];return r=DA.bind(null,r[1]),_r().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,u){var m=kt,v=_r();if(gt){if(u===void 0)throw Error(n(407));u=u()}else{if(u=o(),zt===null)throw Error(n(349));(va&30)!==0||K0(m,o,u)}v.memoizedState=u;var x={value:u,getSnapshot:o};return v.queue=x,nx(Q0.bind(null,m,x,r),[r]),m.flags|=2048,Qi(9,X0.bind(null,m,x,u,o),void 0,null),u},useId:function(){var r=_r(),o=zt.identifierPrefix;if(gt){var u=Kr,m=Yr;u=(m&~(1<<32-on(m)-1)).toString(32)+u,o=":"+o+"R"+u,u=Ki++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=LA++,o=":"+o+"r"+u.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},BA={readContext:Fn,useCallback:ix,useContext:Fn,useEffect:bh,useImperativeHandle:ox,useInsertionEffect:rx,useLayoutEffect:sx,useMemo:lx,useReducer:wh,useRef:tx,useState:function(){return wh(Xi)},useDebugValue:kh,useDeferredValue:function(r){var o=zn();return cx(o,Pt.memoizedState,r)},useTransition:function(){var r=wh(Xi)[0],o=zn().memoizedState;return[r,o]},useMutableSource:V0,useSyncExternalStore:Y0,useId:ux,unstable_isNewReconciler:!1},UA={readContext:Fn,useCallback:ix,useContext:Fn,useEffect:bh,useImperativeHandle:ox,useInsertionEffect:rx,useLayoutEffect:sx,useMemo:lx,useReducer:xh,useRef:tx,useState:function(){return xh(Xi)},useDebugValue:kh,useDeferredValue:function(r){var o=zn();return Pt===null?o.memoizedState=r:cx(o,Pt.memoizedState,r)},useTransition:function(){var r=xh(Xi)[0],o=zn().memoizedState;return[r,o]},useMutableSource:V0,useSyncExternalStore:Y0,useId:ux,unstable_isNewReconciler:!1};function tr(r,o){if(r&&r.defaultProps){o=J({},o),r=r.defaultProps;for(var u in r)o[u]===void 0&&(o[u]=r[u]);return o}return o}function _h(r,o,u,m){o=r.memoizedState,u=u(m,o),u=u==null?o:J({},o,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Pc={isMounted:function(r){return(r=r._reactInternals)?$n(r)===r:!1},enqueueSetState:function(r,o,u){r=r._reactInternals;var m=an(),v=Ts(r),x=Qr(m,v);x.payload=o,u!=null&&(x.callback=u),o=Ns(r,x,v),o!==null&&(sr(o,r,v,m),Cc(o,r,v))},enqueueReplaceState:function(r,o,u){r=r._reactInternals;var m=an(),v=Ts(r),x=Qr(m,v);x.tag=1,x.payload=o,u!=null&&(x.callback=u),o=Ns(r,x,v),o!==null&&(sr(o,r,v,m),Cc(o,r,v))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var u=an(),m=Ts(r),v=Qr(u,m);v.tag=2,o!=null&&(v.callback=o),o=Ns(r,v,m),o!==null&&(sr(o,r,m,u),Cc(o,r,m))}};function px(r,o,u,m,v,x,T){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,x,T):o.prototype&&o.prototype.isPureReactComponent?!En(u,m)||!En(v,x):!0}function mx(r,o,u){var m=!1,v=ks,x=o.contextType;return typeof x=="object"&&x!==null?x=Fn(x):(v=hn(o)?fa:Xt.current,m=o.contextTypes,x=(m=m!=null)?yo(r,v):ks),o=new o(u,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Pc,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=v,r.__reactInternalMemoizedMaskedChildContext=x),o}function gx(r,o,u,m){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,m),o.state!==r&&Pc.enqueueReplaceState(o,o.state,null)}function Sh(r,o,u,m){var v=r.stateNode;v.props=u,v.state=r.memoizedState,v.refs={},uh(r);var x=o.contextType;typeof x=="object"&&x!==null?v.context=Fn(x):(x=hn(o)?fa:Xt.current,v.context=yo(r,x)),v.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(_h(r,o,x,u),v.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(o=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),o!==v.state&&Pc.enqueueReplaceState(v,v.state,null),Tc(r,u,v,m),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308)}function No(r,o){try{var u="",m=o;do u+=U(m),m=m.return;while(m);var v=u}catch(x){v=`
|
|
39
39
|
Error generating stack: `+x.message+`
|
|
40
|
-
`+x.stack}return{value:r,source:o,stack:v,digest:null}}function Nh(r,o,u){return{value:r,source:null,stack:u??null,digest:o??null}}function Eh(r,o){try{console.error(o.value)}catch(u){setTimeout(function(){throw u})}}var UA=typeof WeakMap=="function"?WeakMap:Map;function gx(r,o,u){u=Qr(-1,u),u.tag=3,u.payload={element:null};var m=o.value;return u.callback=function(){Uc||(Uc=!0,zh=m),Eh(r,o)},u}function yx(r,o,u){u=Qr(-1,u),u.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var v=o.value;u.payload=function(){return m(v)},u.callback=function(){Eh(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(u.callback=function(){Eh(r,o),typeof m!="function"&&(js===null?js=new Set([this]):js.add(this));var T=o.stack;this.componentDidCatch(o.value,{componentStack:T!==null?T:""})}),u}function vx(r,o,u){var m=r.pingCache;if(m===null){m=r.pingCache=new UA;var v=new Set;m.set(o,v)}else v=m.get(o),v===void 0&&(v=new Set,m.set(o,v));v.has(u)||(v.add(u),r=rM.bind(null,r,o,u),o.then(r,r))}function wx(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 xx(r,o,u,m,v){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=Qr(-1,1),o.tag=2,Ns(u,o,1))),u.lanes|=1),r):(r.flags|=65536,r.lanes=v,r)}var WA=C.ReactCurrentOwner,fn=!1;function sn(r,o,u,m){o.child=r===null?F0(o,null,u,m):bo(o,r.child,u,m)}function bx(r,o,u,m,v){u=u.render;var x=o.ref;return _o(o,v),m=yh(r,o,u,m,x,v),u=vh(),r!==null&&!fn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,Zr(r,o,v)):(gt&&u&&eh(o),o.flags|=1,sn(r,o,m,v),o.child)}function kx(r,o,u,m,v){if(r===null){var x=u.type;return typeof x=="function"&&!Yh(x)&&x.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(o.tag=15,o.type=x,_x(r,o,x,m,v)):(r=Kc(u.type,null,m,o,o.mode,v),r.ref=o.ref,r.return=o,o.child=r)}if(x=r.child,(r.lanes&v)===0){var T=x.memoizedProps;if(u=u.compare,u=u!==null?u:En,u(T,m)&&r.ref===o.ref)return Zr(r,o,v)}return o.flags|=1,r=As(x,m),r.ref=o.ref,r.return=o,o.child=r}function _x(r,o,u,m,v){if(r!==null){var x=r.memoizedProps;if(En(x,m)&&r.ref===o.ref)if(fn=!1,o.pendingProps=m=x,(r.lanes&v)!==0)(r.flags&131072)!==0&&(fn=!0);else return o.lanes=r.lanes,Zr(r,o,v)}return jh(r,o,u,m,v)}function Sx(r,o,u){var m=o.pendingProps,v=m.children,x=r!==null?r.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},ht(jo,Tn),Tn|=u;else{if((u&1073741824)===0)return r=x!==null?x.baseLanes|u:u,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,ht(jo,Tn),Tn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=x!==null?x.baseLanes:u,ht(jo,Tn),Tn|=m}else x!==null?(m=x.baseLanes|u,o.memoizedState=null):m=u,ht(jo,Tn),Tn|=m;return sn(r,o,v,u),o.child}function Nx(r,o){var u=o.ref;(r===null&&u!==null||r!==null&&r.ref!==u)&&(o.flags|=512,o.flags|=2097152)}function jh(r,o,u,m,v){var x=hn(u)?fa:Xt.current;return x=yo(o,x),_o(o,v),u=yh(r,o,u,m,x,v),m=vh(),r!==null&&!fn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,Zr(r,o,v)):(gt&&m&&eh(o),o.flags|=1,sn(r,o,u,v),o.child)}function Ex(r,o,u,m,v){if(hn(u)){var x=!0;xc(o)}else x=!1;if(_o(o,v),o.stateNode===null)Dc(r,o),px(o,u,m),Sh(o,u,m,v),m=!0;else if(r===null){var T=o.stateNode,V=o.memoizedProps;T.props=V;var te=T.context,ce=u.contextType;typeof ce=="object"&&ce!==null?ce=Fn(ce):(ce=hn(u)?fa:Xt.current,ce=yo(o,ce));var ye=u.getDerivedStateFromProps,ve=typeof ye=="function"||typeof T.getSnapshotBeforeUpdate=="function";ve||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(V!==m||te!==ce)&&mx(o,T,m,ce),Ss=!1;var ge=o.memoizedState;T.state=ge,Tc(o,m,T,v),te=o.memoizedState,V!==m||ge!==te||dn.current||Ss?(typeof ye=="function"&&(_h(o,u,ye,m),te=o.memoizedState),(V=Ss||fx(o,u,V,m,ge,te,ce))?(ve||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(o.flags|=4194308)):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=te),T.props=m,T.state=te,T.context=ce,m=V):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{T=o.stateNode,B0(r,o),V=o.memoizedProps,ce=o.type===o.elementType?V:tr(o.type,V),T.props=ce,ve=o.pendingProps,ge=T.context,te=u.contextType,typeof te=="object"&&te!==null?te=Fn(te):(te=hn(u)?fa:Xt.current,te=yo(o,te));var Ee=u.getDerivedStateFromProps;(ye=typeof Ee=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(V!==ve||ge!==te)&&mx(o,T,m,te),Ss=!1,ge=o.memoizedState,T.state=ge,Tc(o,m,T,v);var Te=o.memoizedState;V!==ve||ge!==Te||dn.current||Ss?(typeof Ee=="function"&&(_h(o,u,Ee,m),Te=o.memoizedState),(ce=Ss||fx(o,u,ce,m,ge,Te,te)||!1)?(ye||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(m,Te,te),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(m,Te,te)),typeof T.componentDidUpdate=="function"&&(o.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof T.componentDidUpdate!="function"||V===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||V===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=Te),T.props=m,T.state=Te,T.context=te,m=ce):(typeof T.componentDidUpdate!="function"||V===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||V===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),m=!1)}return Ch(r,o,u,m,x,v)}function Ch(r,o,u,m,v,x){Nx(r,o);var T=(o.flags&128)!==0;if(!m&&!T)return v&&A0(o,u,!1),Zr(r,o,x);m=o.stateNode,WA.current=o;var V=T&&typeof u.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&T?(o.child=bo(o,r.child,null,x),o.child=bo(o,null,V,x)):sn(r,o,V,x),o.memoizedState=m.state,v&&A0(o,u,!0),o.child}function jx(r){var o=r.stateNode;o.pendingContext?T0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&T0(r,o.context,!1),dh(r,o.containerInfo)}function Cx(r,o,u,m,v){return xo(),sh(v),o.flags|=256,sn(r,o,u,m),o.child}var Th={dehydrated:null,treeContext:null,retryLane:0};function Rh(r){return{baseLanes:r,cachePool:null,transitions:null}}function Tx(r,o,u){var m=o.pendingProps,v=bt.current,x=!1,T=(o.flags&128)!==0,V;if((V=T)||(V=r!==null&&r.memoizedState===null?!1:(v&2)!==0),V?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(v|=1),ht(bt,v&1),r===null)return rh(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):(T=m.children,r=m.fallback,x?(m=o.mode,x=o.child,T={mode:"hidden",children:T},(m&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=T):x=Xc(T,m,0,null),r=_a(r,m,u,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=Rh(u),o.memoizedState=Th,r):Ah(o,T));if(v=r.memoizedState,v!==null&&(V=v.dehydrated,V!==null))return HA(r,o,T,m,V,v,u);if(x){x=m.fallback,T=o.mode,v=r.child,V=v.sibling;var te={mode:"hidden",children:m.children};return(T&1)===0&&o.child!==v?(m=o.child,m.childLanes=0,m.pendingProps=te,o.deletions=null):(m=As(v,te),m.subtreeFlags=v.subtreeFlags&14680064),V!==null?x=As(V,x):(x=_a(x,T,u,null),x.flags|=2),x.return=o,m.return=o,m.sibling=x,o.child=m,m=x,x=o.child,T=r.child.memoizedState,T=T===null?Rh(u):{baseLanes:T.baseLanes|u,cachePool:null,transitions:T.transitions},x.memoizedState=T,x.childLanes=r.childLanes&~u,o.memoizedState=Th,m}return x=r.child,r=x.sibling,m=As(x,{mode:"visible",children:m.children}),(o.mode&1)===0&&(m.lanes=u),m.return=o,m.sibling=null,r!==null&&(u=o.deletions,u===null?(o.deletions=[r],o.flags|=16):u.push(r)),o.child=m,o.memoizedState=null,m}function Ah(r,o){return o=Xc({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Lc(r,o,u,m){return m!==null&&sh(m),bo(o,r.child,null,u),r=Ah(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function HA(r,o,u,m,v,x,T){if(u)return o.flags&256?(o.flags&=-257,m=Nh(Error(n(422))),Lc(r,o,T,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=m.fallback,v=o.mode,m=Xc({mode:"visible",children:m.children},v,0,null),x=_a(x,v,T,null),x.flags|=2,m.return=o,x.return=o,m.sibling=x,o.child=m,(o.mode&1)!==0&&bo(o,r.child,null,T),o.child.memoizedState=Rh(T),o.memoizedState=Th,x);if((o.mode&1)===0)return Lc(r,o,T,null);if(v.data==="$!"){if(m=v.nextSibling&&v.nextSibling.dataset,m)var V=m.dgst;return m=V,x=Error(n(419)),m=Nh(x,m,void 0),Lc(r,o,T,m)}if(V=(T&r.childLanes)!==0,fn||V){if(m=zt,m!==null){switch(T&-T){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(m.suspendedLanes|T))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Xr(r,v),sr(m,r,v,-1))}return Vh(),m=Nh(Error(n(421))),Lc(r,o,T,m)}return v.data==="$?"?(o.flags|=128,o.child=r.child,o=sM.bind(null,r),v._reactRetry=o,null):(r=x.treeContext,Cn=xs(v.nextSibling),jn=o,gt=!0,er=null,r!==null&&(Dn[qn++]=Yr,Dn[qn++]=Kr,Dn[qn++]=pa,Yr=r.id,Kr=r.overflow,pa=o),o=Ah(o,m.children),o.flags|=4096,o)}function Rx(r,o,u){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),lh(r.return,o,u)}function Mh(r,o,u,m,v){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:u,tailMode:v}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=m,x.tail=u,x.tailMode=v)}function Ax(r,o,u){var m=o.pendingProps,v=m.revealOrder,x=m.tail;if(sn(r,o,m.children,u),m=bt.current,(m&2)!==0)m=m&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&&Rx(r,u,o);else if(r.tag===19)Rx(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}m&=1}if(ht(bt,m),(o.mode&1)===0)o.memoizedState=null;else switch(v){case"forwards":for(u=o.child,v=null;u!==null;)r=u.alternate,r!==null&&Rc(r)===null&&(v=u),u=u.sibling;u=v,u===null?(v=o.child,o.child=null):(v=u.sibling,u.sibling=null),Mh(o,!1,v,u,x);break;case"backwards":for(u=null,v=o.child,o.child=null;v!==null;){if(r=v.alternate,r!==null&&Rc(r)===null){o.child=v;break}r=v.sibling,v.sibling=u,u=v,v=r}Mh(o,!0,u,null,x);break;case"together":Mh(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Dc(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Zr(r,o,u){if(r!==null&&(o.dependencies=r.dependencies),wa|=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=As(r,r.pendingProps),o.child=u,u.return=o;r.sibling!==null;)r=r.sibling,u=u.sibling=As(r,r.pendingProps),u.return=o;u.sibling=null}return o.child}function GA(r,o,u){switch(o.tag){case 3:jx(o),xo();break;case 5:H0(o);break;case 1:hn(o.type)&&xc(o);break;case 4:dh(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,v=o.memoizedProps.value;ht(Ec,m._currentValue),m._currentValue=v;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(ht(bt,bt.current&1),o.flags|=128,null):(u&o.child.childLanes)!==0?Tx(r,o,u):(ht(bt,bt.current&1),r=Zr(r,o,u),r!==null?r.sibling:null);ht(bt,bt.current&1);break;case 19:if(m=(u&o.childLanes)!==0,(r.flags&128)!==0){if(m)return Ax(r,o,u);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),ht(bt,bt.current),m)break;return null;case 22:case 23:return o.lanes=0,Sx(r,o,u)}return Zr(r,o,u)}var Mx,Ih,Ix,$x;Mx=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}},Ih=function(){},Ix=function(r,o,u,m){var v=r.memoizedProps;if(v!==m){r=o.stateNode,ya(kr.current);var x=null;switch(u){case"input":v=qe(r,v),m=qe(r,m),x=[];break;case"select":v=J({},v,{value:void 0}),m=J({},m,{value:void 0}),x=[];break;case"textarea":v=at(r,v),m=at(r,m),x=[];break;default:typeof v.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=yc)}vt(u,m);var T;u=null;for(ce in v)if(!m.hasOwnProperty(ce)&&v.hasOwnProperty(ce)&&v[ce]!=null)if(ce==="style"){var V=v[ce];for(T in V)V.hasOwnProperty(T)&&(u||(u={}),u[T]="")}else ce!=="dangerouslySetInnerHTML"&&ce!=="children"&&ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&ce!=="autoFocus"&&(a.hasOwnProperty(ce)?x||(x=[]):(x=x||[]).push(ce,null));for(ce in m){var te=m[ce];if(V=v!=null?v[ce]:void 0,m.hasOwnProperty(ce)&&te!==V&&(te!=null||V!=null))if(ce==="style")if(V){for(T in V)!V.hasOwnProperty(T)||te&&te.hasOwnProperty(T)||(u||(u={}),u[T]="");for(T in te)te.hasOwnProperty(T)&&V[T]!==te[T]&&(u||(u={}),u[T]=te[T])}else u||(x||(x=[]),x.push(ce,u)),u=te;else ce==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,V=V?V.__html:void 0,te!=null&&V!==te&&(x=x||[]).push(ce,te)):ce==="children"?typeof te!="string"&&typeof te!="number"||(x=x||[]).push(ce,""+te):ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&(a.hasOwnProperty(ce)?(te!=null&&ce==="onScroll"&<("scroll",r),x||V===te||(x=[])):(x=x||[]).push(ce,te))}u&&(x=x||[]).push("style",u);var ce=x;(o.updateQueue=ce)&&(o.flags|=4)}},$x=function(r,o,u,m){u!==m&&(o.flags|=4)};function Zi(r,o){if(!gt)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 m=null;u!==null;)u.alternate!==null&&(m=u),u=u.sibling;m===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function Zt(r){var o=r.alternate!==null&&r.alternate.child===r.child,u=0,m=0;if(o)for(var v=r.child;v!==null;)u|=v.lanes|v.childLanes,m|=v.subtreeFlags&14680064,m|=v.flags&14680064,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)u|=v.lanes|v.childLanes,m|=v.subtreeFlags,m|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=m,r.childLanes=u,o}function VA(r,o,u){var m=o.pendingProps;switch(th(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Zt(o),null;case 1:return hn(o.type)&&wc(),Zt(o),null;case 3:return m=o.stateNode,So(),pt(dn),pt(Xt),ph(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(Sc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,er!==null&&(Wh(er),er=null))),Ih(r,o),Zt(o),null;case 5:hh(o);var v=ya(Vi.current);if(u=o.type,r!==null&&o.stateNode!=null)Ix(r,o,u,m,v),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return Zt(o),null}if(r=ya(kr.current),Sc(o)){m=o.stateNode,u=o.type;var x=o.memoizedProps;switch(m[br]=o,m[Bi]=x,r=(o.mode&1)!==0,u){case"dialog":lt("cancel",m),lt("close",m);break;case"iframe":case"object":case"embed":lt("load",m);break;case"video":case"audio":for(v=0;v<da.length;v++)lt(da[v],m);break;case"source":lt("error",m);break;case"img":case"image":case"link":lt("error",m),lt("load",m);break;case"details":lt("toggle",m);break;case"input":Ne(m,x),lt("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!x.multiple},lt("invalid",m);break;case"textarea":Ye(m,x),lt("invalid",m)}vt(u,x),v=null;for(var T in x)if(x.hasOwnProperty(T)){var V=x[T];T==="children"?typeof V=="string"?m.textContent!==V&&(x.suppressHydrationWarning!==!0&&gc(m.textContent,V,r),v=["children",V]):typeof V=="number"&&m.textContent!==""+V&&(x.suppressHydrationWarning!==!0&&gc(m.textContent,V,r),v=["children",""+V]):a.hasOwnProperty(T)&&V!=null&&T==="onScroll"&<("scroll",m)}switch(u){case"input":ke(m),re(m,x,!0);break;case"textarea":ke(m),we(m);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(m.onclick=yc)}m=v,o.updateQueue=m,m!==null&&(o.flags|=4)}else{T=v.nodeType===9?v:v.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=Pe(u)),r==="http://www.w3.org/1999/xhtml"?u==="script"?(r=T.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=T.createElement(u,{is:m.is}):(r=T.createElement(u),u==="select"&&(T=r,m.multiple?T.multiple=!0:m.size&&(T.size=m.size))):r=T.createElementNS(r,u),r[br]=o,r[Bi]=m,Mx(r,o,!1,!1),o.stateNode=r;e:{switch(T=Ae(u,m),u){case"dialog":lt("cancel",r),lt("close",r),v=m;break;case"iframe":case"object":case"embed":lt("load",r),v=m;break;case"video":case"audio":for(v=0;v<da.length;v++)lt(da[v],r);v=m;break;case"source":lt("error",r),v=m;break;case"img":case"image":case"link":lt("error",r),lt("load",r),v=m;break;case"details":lt("toggle",r),v=m;break;case"input":Ne(r,m),v=qe(r,m),lt("invalid",r);break;case"option":v=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},v=J({},m,{value:void 0}),lt("invalid",r);break;case"textarea":Ye(r,m),v=at(r,m),lt("invalid",r);break;default:v=m}vt(u,v),V=v;for(x in V)if(V.hasOwnProperty(x)){var te=V[x];x==="style"?Be(r,te):x==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,te!=null&&$e(r,te)):x==="children"?typeof te=="string"?(u!=="textarea"||te!=="")&&se(r,te):typeof te=="number"&&se(r,""+te):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(a.hasOwnProperty(x)?te!=null&&x==="onScroll"&<("scroll",r):te!=null&&j(r,x,te,T))}switch(u){case"input":ke(r),re(r,m,!1);break;case"textarea":ke(r),we(r);break;case"option":m.value!=null&&r.setAttribute("value",""+le(m.value));break;case"select":r.multiple=!!m.multiple,x=m.value,x!=null?ut(r,!!m.multiple,x,!1):m.defaultValue!=null&&ut(r,!!m.multiple,m.defaultValue,!0);break;default:typeof v.onClick=="function"&&(r.onclick=yc)}switch(u){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return Zt(o),null;case 6:if(r&&o.stateNode!=null)$x(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(u=ya(Vi.current),ya(kr.current),Sc(o)){if(m=o.stateNode,u=o.memoizedProps,m[br]=o,(x=m.nodeValue!==u)&&(r=jn,r!==null))switch(r.tag){case 3:gc(m.nodeValue,u,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&gc(m.nodeValue,u,(r.mode&1)!==0)}x&&(o.flags|=4)}else m=(u.nodeType===9?u:u.ownerDocument).createTextNode(m),m[br]=o,o.stateNode=m}return Zt(o),null;case 13:if(pt(bt),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(gt&&Cn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)L0(),xo(),o.flags|=98560,x=!1;else if(x=Sc(o),m!==null&&m.dehydrated!==null){if(r===null){if(!x)throw Error(n(318));if(x=o.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(n(317));x[br]=o}else xo(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Zt(o),x=!1}else er!==null&&(Wh(er),er=null),x=!0;if(!x)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=u,o):(m=m!==null,m!==(r!==null&&r.memoizedState!==null)&&m&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(bt.current&1)!==0?Lt===0&&(Lt=3):Vh())),o.updateQueue!==null&&(o.flags|=4),Zt(o),null);case 4:return So(),Ih(r,o),r===null&&mt(o.stateNode.containerInfo),Zt(o),null;case 10:return ih(o.type._context),Zt(o),null;case 17:return hn(o.type)&&wc(),Zt(o),null;case 19:if(pt(bt),x=o.memoizedState,x===null)return Zt(o),null;if(m=(o.flags&128)!==0,T=x.rendering,T===null)if(m)Zi(x,!1);else{if(Lt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(T=Rc(r),T!==null){for(o.flags|=128,Zi(x,!1),m=T.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=u,u=o.child;u!==null;)x=u,r=m,x.flags&=14680066,T=x.alternate,T===null?(x.childLanes=0,x.lanes=r,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=T.childLanes,x.lanes=T.lanes,x.child=T.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=T.memoizedProps,x.memoizedState=T.memoizedState,x.updateQueue=T.updateQueue,x.type=T.type,r=T.dependencies,x.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),u=u.sibling;return ht(bt,bt.current&1|2),o.child}r=r.sibling}x.tail!==null&&dt()>Co&&(o.flags|=128,m=!0,Zi(x,!1),o.lanes=4194304)}else{if(!m)if(r=Rc(T),r!==null){if(o.flags|=128,m=!0,u=r.updateQueue,u!==null&&(o.updateQueue=u,o.flags|=4),Zi(x,!0),x.tail===null&&x.tailMode==="hidden"&&!T.alternate&&!gt)return Zt(o),null}else 2*dt()-x.renderingStartTime>Co&&u!==1073741824&&(o.flags|=128,m=!0,Zi(x,!1),o.lanes=4194304);x.isBackwards?(T.sibling=o.child,o.child=T):(u=x.last,u!==null?u.sibling=T:o.child=T,x.last=T)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=dt(),o.sibling=null,u=bt.current,ht(bt,m?u&1|2:u&1),o):(Zt(o),null);case 22:case 23:return Gh(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(Tn&1073741824)!==0&&(Zt(o),o.subtreeFlags&6&&(o.flags|=8192)):Zt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function YA(r,o){switch(th(o),o.tag){case 1:return hn(o.type)&&wc(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return So(),pt(dn),pt(Xt),ph(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return hh(o),null;case 13:if(pt(bt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));xo()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return pt(bt),null;case 4:return So(),null;case 10:return ih(o.type._context),null;case 22:case 23:return Gh(),null;case 24:return null;default:return null}}var qc=!1,Jt=!1,KA=typeof WeakSet=="function"?WeakSet:Set,Ce=null;function Eo(r,o){var u=r.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(m){Et(r,o,m)}else u.current=null}function $h(r,o,u){try{u()}catch(m){Et(r,o,m)}}var Ox=!1;function XA(r,o){if(Gd=ds,r=$i(),Oi(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var m=u.getSelection&&u.getSelection();if(m&&m.rangeCount!==0){u=m.anchorNode;var v=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{u.nodeType,x.nodeType}catch{u=null;break e}var T=0,V=-1,te=-1,ce=0,ye=0,ve=r,ge=null;t:for(;;){for(var Ee;ve!==u||v!==0&&ve.nodeType!==3||(V=T+v),ve!==x||m!==0&&ve.nodeType!==3||(te=T+m),ve.nodeType===3&&(T+=ve.nodeValue.length),(Ee=ve.firstChild)!==null;)ge=ve,ve=Ee;for(;;){if(ve===r)break t;if(ge===u&&++ce===v&&(V=T),ge===x&&++ye===m&&(te=T),(Ee=ve.nextSibling)!==null)break;ve=ge,ge=ve.parentNode}ve=Ee}u=V===-1||te===-1?null:{start:V,end:te}}else u=null}u=u||{start:0,end:0}}else u=null;for(Vd={focusedElem:r,selectionRange:u},ds=!1,Ce=o;Ce!==null;)if(o=Ce,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,Ce=r;else for(;Ce!==null;){o=Ce;try{var Te=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Te!==null){var Me=Te.memoizedProps,Ct=Te.memoizedState,ae=o.stateNode,ne=ae.getSnapshotBeforeUpdate(o.elementType===o.type?Me:tr(o.type,Me),Ct);ae.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var oe=o.stateNode.containerInfo;oe.nodeType===1?oe.textContent="":oe.nodeType===9&&oe.documentElement&&oe.removeChild(oe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(xe){Et(o,o.return,xe)}if(r=o.sibling,r!==null){r.return=o.return,Ce=r;break}Ce=o.return}return Te=Ox,Ox=!1,Te}function Ji(r,o,u){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var v=m=m.next;do{if((v.tag&r)===r){var x=v.destroy;v.destroy=void 0,x!==void 0&&$h(o,u,x)}v=v.next}while(v!==m)}}function Fc(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 m=u.create;u.destroy=m()}u=u.next}while(u!==o)}}function Oh(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 Px(r){var o=r.alternate;o!==null&&(r.alternate=null,Px(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[br],delete o[Bi],delete o[Qd],delete o[MA],delete o[IA])),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 Lx(r){return r.tag===5||r.tag===3||r.tag===4}function Dx(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Lx(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 Ph(r,o,u){var m=r.tag;if(m===5||m===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=yc));else if(m!==4&&(r=r.child,r!==null))for(Ph(r,o,u),r=r.sibling;r!==null;)Ph(r,o,u),r=r.sibling}function Lh(r,o,u){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?u.insertBefore(r,o):u.appendChild(r);else if(m!==4&&(r=r.child,r!==null))for(Lh(r,o,u),r=r.sibling;r!==null;)Lh(r,o,u),r=r.sibling}var Wt=null,nr=!1;function Es(r,o,u){for(u=u.child;u!==null;)qx(r,o,u),u=u.sibling}function qx(r,o,u){if(qt&&typeof qt.onCommitFiberUnmount=="function")try{qt.onCommitFiberUnmount(Pr,u)}catch{}switch(u.tag){case 5:Jt||Eo(u,o);case 6:var m=Wt,v=nr;Wt=null,Es(r,o,u),Wt=m,nr=v,Wt!==null&&(nr?(r=Wt,u=u.stateNode,r.nodeType===8?r.parentNode.removeChild(u):r.removeChild(u)):Wt.removeChild(u.stateNode));break;case 18:Wt!==null&&(nr?(r=Wt,u=u.stateNode,r.nodeType===8?Xd(r.parentNode,u):r.nodeType===1&&Xd(r,u),Qn(r)):Xd(Wt,u.stateNode));break;case 4:m=Wt,v=nr,Wt=u.stateNode.containerInfo,nr=!0,Es(r,o,u),Wt=m,nr=v;break;case 0:case 11:case 14:case 15:if(!Jt&&(m=u.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){v=m=m.next;do{var x=v,T=x.destroy;x=x.tag,T!==void 0&&((x&2)!==0||(x&4)!==0)&&$h(u,o,T),v=v.next}while(v!==m)}Es(r,o,u);break;case 1:if(!Jt&&(Eo(u,o),m=u.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=u.memoizedProps,m.state=u.memoizedState,m.componentWillUnmount()}catch(V){Et(u,o,V)}Es(r,o,u);break;case 21:Es(r,o,u);break;case 22:u.mode&1?(Jt=(m=Jt)||u.memoizedState!==null,Es(r,o,u),Jt=m):Es(r,o,u);break;default:Es(r,o,u)}}function Fx(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var u=r.stateNode;u===null&&(u=r.stateNode=new KA),o.forEach(function(m){var v=aM.bind(null,r,m);u.has(m)||(u.add(m),m.then(v,v))})}}function rr(r,o){var u=o.deletions;if(u!==null)for(var m=0;m<u.length;m++){var v=u[m];try{var x=r,T=o,V=T;e:for(;V!==null;){switch(V.tag){case 5:Wt=V.stateNode,nr=!1;break e;case 3:Wt=V.stateNode.containerInfo,nr=!0;break e;case 4:Wt=V.stateNode.containerInfo,nr=!0;break e}V=V.return}if(Wt===null)throw Error(n(160));qx(x,T,v),Wt=null,nr=!1;var te=v.alternate;te!==null&&(te.return=null),v.return=null}catch(ce){Et(v,o,ce)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)zx(o,r),o=o.sibling}function zx(r,o){var u=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(rr(o,r),Sr(r),m&4){try{Ji(3,r,r.return),Fc(3,r)}catch(Me){Et(r,r.return,Me)}try{Ji(5,r,r.return)}catch(Me){Et(r,r.return,Me)}}break;case 1:rr(o,r),Sr(r),m&512&&u!==null&&Eo(u,u.return);break;case 5:if(rr(o,r),Sr(r),m&512&&u!==null&&Eo(u,u.return),r.flags&32){var v=r.stateNode;try{se(v,"")}catch(Me){Et(r,r.return,Me)}}if(m&4&&(v=r.stateNode,v!=null)){var x=r.memoizedProps,T=u!==null?u.memoizedProps:x,V=r.type,te=r.updateQueue;if(r.updateQueue=null,te!==null)try{V==="input"&&x.type==="radio"&&x.name!=null&&Ge(v,x),Ae(V,T);var ce=Ae(V,x);for(T=0;T<te.length;T+=2){var ye=te[T],ve=te[T+1];ye==="style"?Be(v,ve):ye==="dangerouslySetInnerHTML"?$e(v,ve):ye==="children"?se(v,ve):j(v,ye,ve,ce)}switch(V){case"input":be(v,x);break;case"textarea":pe(v,x);break;case"select":var ge=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!x.multiple;var Ee=x.value;Ee!=null?ut(v,!!x.multiple,Ee,!1):ge!==!!x.multiple&&(x.defaultValue!=null?ut(v,!!x.multiple,x.defaultValue,!0):ut(v,!!x.multiple,x.multiple?[]:"",!1))}v[Bi]=x}catch(Me){Et(r,r.return,Me)}}break;case 6:if(rr(o,r),Sr(r),m&4){if(r.stateNode===null)throw Error(n(162));v=r.stateNode,x=r.memoizedProps;try{v.nodeValue=x}catch(Me){Et(r,r.return,Me)}}break;case 3:if(rr(o,r),Sr(r),m&4&&u!==null&&u.memoizedState.isDehydrated)try{Qn(o.containerInfo)}catch(Me){Et(r,r.return,Me)}break;case 4:rr(o,r),Sr(r);break;case 13:rr(o,r),Sr(r),v=r.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(Fh=dt())),m&4&&Fx(r);break;case 22:if(ye=u!==null&&u.memoizedState!==null,r.mode&1?(Jt=(ce=Jt)||ye,rr(o,r),Jt=ce):rr(o,r),Sr(r),m&8192){if(ce=r.memoizedState!==null,(r.stateNode.isHidden=ce)&&!ye&&(r.mode&1)!==0)for(Ce=r,ye=r.child;ye!==null;){for(ve=Ce=ye;Ce!==null;){switch(ge=Ce,Ee=ge.child,ge.tag){case 0:case 11:case 14:case 15:Ji(4,ge,ge.return);break;case 1:Eo(ge,ge.return);var Te=ge.stateNode;if(typeof Te.componentWillUnmount=="function"){m=ge,u=ge.return;try{o=m,Te.props=o.memoizedProps,Te.state=o.memoizedState,Te.componentWillUnmount()}catch(Me){Et(m,u,Me)}}break;case 5:Eo(ge,ge.return);break;case 22:if(ge.memoizedState!==null){Wx(ve);continue}}Ee!==null?(Ee.return=ge,Ce=Ee):Wx(ve)}ye=ye.sibling}e:for(ye=null,ve=r;;){if(ve.tag===5){if(ye===null){ye=ve;try{v=ve.stateNode,ce?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(V=ve.stateNode,te=ve.memoizedProps.style,T=te!=null&&te.hasOwnProperty("display")?te.display:null,V.style.display=_e("display",T))}catch(Me){Et(r,r.return,Me)}}}else if(ve.tag===6){if(ye===null)try{ve.stateNode.nodeValue=ce?"":ve.memoizedProps}catch(Me){Et(r,r.return,Me)}}else if((ve.tag!==22&&ve.tag!==23||ve.memoizedState===null||ve===r)&&ve.child!==null){ve.child.return=ve,ve=ve.child;continue}if(ve===r)break e;for(;ve.sibling===null;){if(ve.return===null||ve.return===r)break e;ye===ve&&(ye=null),ve=ve.return}ye===ve&&(ye=null),ve.sibling.return=ve.return,ve=ve.sibling}}break;case 19:rr(o,r),Sr(r),m&4&&Fx(r);break;case 21:break;default:rr(o,r),Sr(r)}}function Sr(r){var o=r.flags;if(o&2){try{e:{for(var u=r.return;u!==null;){if(Lx(u)){var m=u;break e}u=u.return}throw Error(n(160))}switch(m.tag){case 5:var v=m.stateNode;m.flags&32&&(se(v,""),m.flags&=-33);var x=Dx(r);Lh(r,x,v);break;case 3:case 4:var T=m.stateNode.containerInfo,V=Dx(r);Ph(r,V,T);break;default:throw Error(n(161))}}catch(te){Et(r,r.return,te)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function QA(r,o,u){Ce=r,Bx(r)}function Bx(r,o,u){for(var m=(r.mode&1)!==0;Ce!==null;){var v=Ce,x=v.child;if(v.tag===22&&m){var T=v.memoizedState!==null||qc;if(!T){var V=v.alternate,te=V!==null&&V.memoizedState!==null||Jt;V=qc;var ce=Jt;if(qc=T,(Jt=te)&&!ce)for(Ce=v;Ce!==null;)T=Ce,te=T.child,T.tag===22&&T.memoizedState!==null?Hx(v):te!==null?(te.return=T,Ce=te):Hx(v);for(;x!==null;)Ce=x,Bx(x),x=x.sibling;Ce=v,qc=V,Jt=ce}Ux(r)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,Ce=x):Ux(r)}}function Ux(r){for(;Ce!==null;){var o=Ce;if((o.flags&8772)!==0){var u=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:Jt||Fc(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!Jt)if(u===null)m.componentDidMount();else{var v=o.elementType===o.type?u.memoizedProps:tr(o.type,u.memoizedProps);m.componentDidUpdate(v,u.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&W0(o,x,m);break;case 3:var T=o.updateQueue;if(T!==null){if(u=null,o.child!==null)switch(o.child.tag){case 5:u=o.child.stateNode;break;case 1:u=o.child.stateNode}W0(o,T,u)}break;case 5:var V=o.stateNode;if(u===null&&o.flags&4){u=V;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 ce=o.alternate;if(ce!==null){var ye=ce.memoizedState;if(ye!==null){var ve=ye.dehydrated;ve!==null&&Qn(ve)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Jt||o.flags&512&&Oh(o)}catch(ge){Et(o,o.return,ge)}}if(o===r){Ce=null;break}if(u=o.sibling,u!==null){u.return=o.return,Ce=u;break}Ce=o.return}}function Wx(r){for(;Ce!==null;){var o=Ce;if(o===r){Ce=null;break}var u=o.sibling;if(u!==null){u.return=o.return,Ce=u;break}Ce=o.return}}function Hx(r){for(;Ce!==null;){var o=Ce;try{switch(o.tag){case 0:case 11:case 15:var u=o.return;try{Fc(4,o)}catch(te){Et(o,u,te)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var v=o.return;try{m.componentDidMount()}catch(te){Et(o,v,te)}}var x=o.return;try{Oh(o)}catch(te){Et(o,x,te)}break;case 5:var T=o.return;try{Oh(o)}catch(te){Et(o,T,te)}}}catch(te){Et(o,o.return,te)}if(o===r){Ce=null;break}var V=o.sibling;if(V!==null){V.return=o.return,Ce=V;break}Ce=o.return}}var ZA=Math.ceil,zc=C.ReactCurrentDispatcher,Dh=C.ReactCurrentOwner,Bn=C.ReactCurrentBatchConfig,tt=0,zt=null,Rt=null,Ht=0,Tn=0,jo=bs(0),Lt=0,el=null,wa=0,Bc=0,qh=0,tl=null,pn=null,Fh=0,Co=1/0,Jr=null,Uc=!1,zh=null,js=null,Wc=!1,Cs=null,Hc=0,nl=0,Bh=null,Gc=-1,Vc=0;function an(){return(tt&6)!==0?dt():Gc!==-1?Gc:Gc=dt()}function Ts(r){return(r.mode&1)===0?1:(tt&2)!==0&&Ht!==0?Ht&-Ht:OA.transition!==null?(Vc===0&&(Vc=Qs()),Vc):(r=Ze,r!==0||(r=window.event,r=r===void 0?16:gi(r.type)),r)}function sr(r,o,u,m){if(50<nl)throw nl=0,Bh=null,Error(n(185));Zs(r,u,m),((tt&2)===0||r!==zt)&&(r===zt&&((tt&2)===0&&(Bc|=u),Lt===4&&Rs(r,Ht)),mn(r,m),u===1&&tt===0&&(o.mode&1)===0&&(Co=dt()+500,bc&&_s()))}function mn(r,o){var u=r.callbackNode;Ad(r,o);var m=Pn(r,r===zt?Ht:0);if(m===0)u!==null&&$r(u),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(u!=null&&$r(u),o===1)r.tag===0?$A(Vx.bind(null,r)):M0(Vx.bind(null,r)),RA(function(){(tt&6)===0&&_s()}),u=null;else{switch(di(m)){case 1:u=On;break;case 4:u=Ga;break;case 16:u=Or;break;case 536870912:u=Va;break;default:u=Or}u=tb(u,Gx.bind(null,r))}r.callbackPriority=o,r.callbackNode=u}}function Gx(r,o){if(Gc=-1,Vc=0,(tt&6)!==0)throw Error(n(327));var u=r.callbackNode;if(To()&&r.callbackNode!==u)return null;var m=Pn(r,r===zt?Ht:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=Yc(r,m);else{o=m;var v=tt;tt|=2;var x=Kx();(zt!==r||Ht!==o)&&(Jr=null,Co=dt()+500,ba(r,o));do try{tM();break}catch(V){Yx(r,V)}while(!0);oh(),zc.current=x,tt=v,Rt!==null?o=0:(zt=null,Ht=0,o=Lt)}if(o!==0){if(o===2&&(v=Ln(r),v!==0&&(m=v,o=Uh(r,v))),o===1)throw u=el,ba(r,0),Rs(r,m),mn(r,dt()),u;if(o===6)Rs(r,m);else{if(v=r.current.alternate,(m&30)===0&&!JA(v)&&(o=Yc(r,m),o===2&&(x=Ln(r),x!==0&&(m=x,o=Uh(r,x))),o===1))throw u=el,ba(r,0),Rs(r,m),mn(r,dt()),u;switch(r.finishedWork=v,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:ka(r,pn,Jr);break;case 3:if(Rs(r,m),(m&130023424)===m&&(o=Fh+500-dt(),10<o)){if(Pn(r,0)!==0)break;if(v=r.suspendedLanes,(v&m)!==m){an(),r.pingedLanes|=r.suspendedLanes&v;break}r.timeoutHandle=Kd(ka.bind(null,r,pn,Jr),o);break}ka(r,pn,Jr);break;case 4:if(Rs(r,m),(m&4194240)===m)break;for(o=r.eventTimes,v=-1;0<m;){var T=31-on(m);x=1<<T,T=o[T],T>v&&(v=T),m&=~x}if(m=v,m=dt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*ZA(m/1960))-m,10<m){r.timeoutHandle=Kd(ka.bind(null,r,pn,Jr),m);break}ka(r,pn,Jr);break;case 5:ka(r,pn,Jr);break;default:throw Error(n(329))}}}return mn(r,dt()),r.callbackNode===u?Gx.bind(null,r):null}function Uh(r,o){var u=tl;return r.current.memoizedState.isDehydrated&&(ba(r,o).flags|=256),r=Yc(r,o),r!==2&&(o=pn,pn=u,o!==null&&Wh(o)),r}function Wh(r){pn===null?pn=r:pn.push.apply(pn,r)}function JA(r){for(var o=r;;){if(o.flags&16384){var u=o.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var m=0;m<u.length;m++){var v=u[m],x=v.getSnapshot;v=v.value;try{if(!Nn(x(),v))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 Rs(r,o){for(o&=~qh,o&=~Bc,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var u=31-on(o),m=1<<u;r[u]=-1,o&=~m}}function Vx(r){if((tt&6)!==0)throw Error(n(327));To();var o=Pn(r,0);if((o&1)===0)return mn(r,dt()),null;var u=Yc(r,o);if(r.tag!==0&&u===2){var m=Ln(r);m!==0&&(o=m,u=Uh(r,m))}if(u===1)throw u=el,ba(r,0),Rs(r,o),mn(r,dt()),u;if(u===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,ka(r,pn,Jr),mn(r,dt()),null}function Hh(r,o){var u=tt;tt|=1;try{return r(o)}finally{tt=u,tt===0&&(Co=dt()+500,bc&&_s())}}function xa(r){Cs!==null&&Cs.tag===0&&(tt&6)===0&&To();var o=tt;tt|=1;var u=Bn.transition,m=Ze;try{if(Bn.transition=null,Ze=1,r)return r()}finally{Ze=m,Bn.transition=u,tt=o,(tt&6)===0&&_s()}}function Gh(){Tn=jo.current,pt(jo)}function ba(r,o){r.finishedWork=null,r.finishedLanes=0;var u=r.timeoutHandle;if(u!==-1&&(r.timeoutHandle=-1,TA(u)),Rt!==null)for(u=Rt.return;u!==null;){var m=u;switch(th(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&wc();break;case 3:So(),pt(dn),pt(Xt),ph();break;case 5:hh(m);break;case 4:So();break;case 13:pt(bt);break;case 19:pt(bt);break;case 10:ih(m.type._context);break;case 22:case 23:Gh()}u=u.return}if(zt=r,Rt=r=As(r.current,null),Ht=Tn=o,Lt=0,el=null,qh=Bc=wa=0,pn=tl=null,ga!==null){for(o=0;o<ga.length;o++)if(u=ga[o],m=u.interleaved,m!==null){u.interleaved=null;var v=m.next,x=u.pending;if(x!==null){var T=x.next;x.next=v,m.next=T}u.pending=m}ga=null}return r}function Yx(r,o){do{var u=Rt;try{if(oh(),Ac.current=Oc,Mc){for(var m=kt.memoizedState;m!==null;){var v=m.queue;v!==null&&(v.pending=null),m=m.next}Mc=!1}if(va=0,Ft=Pt=kt=null,Yi=!1,Ki=0,Dh.current=null,u===null||u.return===null){Lt=1,el=o,Rt=null;break}e:{var x=r,T=u.return,V=u,te=o;if(o=Ht,V.flags|=32768,te!==null&&typeof te=="object"&&typeof te.then=="function"){var ce=te,ye=V,ve=ye.tag;if((ye.mode&1)===0&&(ve===0||ve===11||ve===15)){var ge=ye.alternate;ge?(ye.updateQueue=ge.updateQueue,ye.memoizedState=ge.memoizedState,ye.lanes=ge.lanes):(ye.updateQueue=null,ye.memoizedState=null)}var Ee=wx(T);if(Ee!==null){Ee.flags&=-257,xx(Ee,T,V,x,o),Ee.mode&1&&vx(x,ce,o),o=Ee,te=ce;var Te=o.updateQueue;if(Te===null){var Me=new Set;Me.add(te),o.updateQueue=Me}else Te.add(te);break e}else{if((o&1)===0){vx(x,ce,o),Vh();break e}te=Error(n(426))}}else if(gt&&V.mode&1){var Ct=wx(T);if(Ct!==null){(Ct.flags&65536)===0&&(Ct.flags|=256),xx(Ct,T,V,x,o),sh(No(te,V));break e}}x=te=No(te,V),Lt!==4&&(Lt=2),tl===null?tl=[x]:tl.push(x),x=T;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var ae=gx(x,te,o);U0(x,ae);break e;case 1:V=te;var ne=x.type,oe=x.stateNode;if((x.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||oe!==null&&typeof oe.componentDidCatch=="function"&&(js===null||!js.has(oe)))){x.flags|=65536,o&=-o,x.lanes|=o;var xe=yx(x,V,o);U0(x,xe);break e}}x=x.return}while(x!==null)}Qx(u)}catch(Ie){o=Ie,Rt===u&&u!==null&&(Rt=u=u.return);continue}break}while(!0)}function Kx(){var r=zc.current;return zc.current=Oc,r===null?Oc:r}function Vh(){(Lt===0||Lt===3||Lt===2)&&(Lt=4),zt===null||(wa&268435455)===0&&(Bc&268435455)===0||Rs(zt,Ht)}function Yc(r,o){var u=tt;tt|=2;var m=Kx();(zt!==r||Ht!==o)&&(Jr=null,ba(r,o));do try{eM();break}catch(v){Yx(r,v)}while(!0);if(oh(),tt=u,zc.current=m,Rt!==null)throw Error(n(261));return zt=null,Ht=0,Lt}function eM(){for(;Rt!==null;)Xx(Rt)}function tM(){for(;Rt!==null&&!Vs();)Xx(Rt)}function Xx(r){var o=eb(r.alternate,r,Tn);r.memoizedProps=r.pendingProps,o===null?Qx(r):Rt=o,Dh.current=null}function Qx(r){var o=r;do{var u=o.alternate;if(r=o.return,(o.flags&32768)===0){if(u=VA(u,o,Tn),u!==null){Rt=u;return}}else{if(u=YA(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 ka(r,o,u){var m=Ze,v=Bn.transition;try{Bn.transition=null,Ze=1,nM(r,o,u,m)}finally{Bn.transition=v,Ze=m}return null}function nM(r,o,u,m){do To();while(Cs!==null);if((tt&6)!==0)throw Error(n(327));u=r.finishedWork;var v=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 x=u.lanes|u.childLanes;if(Xl(r,x),r===zt&&(Rt=zt=null,Ht=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||Wc||(Wc=!0,tb(Or,function(){return To(),null})),x=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||x){x=Bn.transition,Bn.transition=null;var T=Ze;Ze=1;var V=tt;tt|=4,Dh.current=null,XA(r,u),zx(u,r),dc(Vd),ds=!!Gd,Vd=Gd=null,r.current=u,QA(u),ls(),tt=V,Ze=T,Bn.transition=x}else r.current=u;if(Wc&&(Wc=!1,Cs=r,Hc=v),x=r.pendingLanes,x===0&&(js=null),Ks(u.stateNode),mn(r,dt()),o!==null)for(m=r.onRecoverableError,u=0;u<o.length;u++)v=o[u],m(v.value,{componentStack:v.stack,digest:v.digest});if(Uc)throw Uc=!1,r=zh,zh=null,r;return(Hc&1)!==0&&r.tag!==0&&To(),x=r.pendingLanes,(x&1)!==0?r===Bh?nl++:(nl=0,Bh=r):nl=0,_s(),null}function To(){if(Cs!==null){var r=di(Hc),o=Bn.transition,u=Ze;try{if(Bn.transition=null,Ze=16>r?16:r,Cs===null)var m=!1;else{if(r=Cs,Cs=null,Hc=0,(tt&6)!==0)throw Error(n(331));var v=tt;for(tt|=4,Ce=r.current;Ce!==null;){var x=Ce,T=x.child;if((Ce.flags&16)!==0){var V=x.deletions;if(V!==null){for(var te=0;te<V.length;te++){var ce=V[te];for(Ce=ce;Ce!==null;){var ye=Ce;switch(ye.tag){case 0:case 11:case 15:Ji(8,ye,x)}var ve=ye.child;if(ve!==null)ve.return=ye,Ce=ve;else for(;Ce!==null;){ye=Ce;var ge=ye.sibling,Ee=ye.return;if(Px(ye),ye===ce){Ce=null;break}if(ge!==null){ge.return=Ee,Ce=ge;break}Ce=Ee}}}var Te=x.alternate;if(Te!==null){var Me=Te.child;if(Me!==null){Te.child=null;do{var Ct=Me.sibling;Me.sibling=null,Me=Ct}while(Me!==null)}}Ce=x}}if((x.subtreeFlags&2064)!==0&&T!==null)T.return=x,Ce=T;else e:for(;Ce!==null;){if(x=Ce,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Ji(9,x,x.return)}var ae=x.sibling;if(ae!==null){ae.return=x.return,Ce=ae;break e}Ce=x.return}}var ne=r.current;for(Ce=ne;Ce!==null;){T=Ce;var oe=T.child;if((T.subtreeFlags&2064)!==0&&oe!==null)oe.return=T,Ce=oe;else e:for(T=ne;Ce!==null;){if(V=Ce,(V.flags&2048)!==0)try{switch(V.tag){case 0:case 11:case 15:Fc(9,V)}}catch(Ie){Et(V,V.return,Ie)}if(V===T){Ce=null;break e}var xe=V.sibling;if(xe!==null){xe.return=V.return,Ce=xe;break e}Ce=V.return}}if(tt=v,_s(),qt&&typeof qt.onPostCommitFiberRoot=="function")try{qt.onPostCommitFiberRoot(Pr,r)}catch{}m=!0}return m}finally{Ze=u,Bn.transition=o}}return!1}function Zx(r,o,u){o=No(u,o),o=gx(r,o,1),r=Ns(r,o,1),o=an(),r!==null&&(Zs(r,1,o),mn(r,o))}function Et(r,o,u){if(r.tag===3)Zx(r,r,u);else for(;o!==null;){if(o.tag===3){Zx(o,r,u);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(js===null||!js.has(m))){r=No(u,r),r=yx(o,r,1),o=Ns(o,r,1),r=an(),o!==null&&(Zs(o,1,r),mn(o,r));break}}o=o.return}}function rM(r,o,u){var m=r.pingCache;m!==null&&m.delete(o),o=an(),r.pingedLanes|=r.suspendedLanes&u,zt===r&&(Ht&u)===u&&(Lt===4||Lt===3&&(Ht&130023424)===Ht&&500>dt()-Fh?ba(r,0):qh|=u),mn(r,o)}function Jx(r,o){o===0&&((r.mode&1)===0?o=1:(o=St,St<<=1,(St&130023424)===0&&(St=4194304)));var u=an();r=Xr(r,o),r!==null&&(Zs(r,o,u),mn(r,u))}function sM(r){var o=r.memoizedState,u=0;o!==null&&(u=o.retryLane),Jx(r,u)}function aM(r,o){var u=0;switch(r.tag){case 13:var m=r.stateNode,v=r.memoizedState;v!==null&&(u=v.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),Jx(r,u)}var eb;eb=function(r,o,u){if(r!==null)if(r.memoizedProps!==o.pendingProps||dn.current)fn=!0;else{if((r.lanes&u)===0&&(o.flags&128)===0)return fn=!1,GA(r,o,u);fn=(r.flags&131072)!==0}else fn=!1,gt&&(o.flags&1048576)!==0&&I0(o,_c,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;Dc(r,o),r=o.pendingProps;var v=yo(o,Xt.current);_o(o,u),v=yh(null,o,m,r,v,u);var x=vh();return o.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,hn(m)?(x=!0,xc(o)):x=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,uh(o),v.updater=Pc,o.stateNode=v,v._reactInternals=o,Sh(o,m,r,u),o=Ch(null,o,m,!0,x,u)):(o.tag=0,gt&&x&&eh(o),sn(null,o,v,u),o=o.child),o;case 16:m=o.elementType;e:{switch(Dc(r,o),r=o.pendingProps,v=m._init,m=v(m._payload),o.type=m,v=o.tag=iM(m),r=tr(m,r),v){case 0:o=jh(null,o,m,r,u);break e;case 1:o=Ex(null,o,m,r,u);break e;case 11:o=bx(null,o,m,r,u);break e;case 14:o=kx(null,o,m,tr(m.type,r),u);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:tr(m,v),jh(r,o,m,v,u);case 1:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:tr(m,v),Ex(r,o,m,v,u);case 3:e:{if(jx(o),r===null)throw Error(n(387));m=o.pendingProps,x=o.memoizedState,v=x.element,B0(r,o),Tc(o,m,null,u);var T=o.memoizedState;if(m=T.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){v=No(Error(n(423)),o),o=Cx(r,o,m,u,v);break e}else if(m!==v){v=No(Error(n(424)),o),o=Cx(r,o,m,u,v);break e}else for(Cn=xs(o.stateNode.containerInfo.firstChild),jn=o,gt=!0,er=null,u=F0(o,null,m,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(xo(),m===v){o=Zr(r,o,u);break e}sn(r,o,m,u)}o=o.child}return o;case 5:return H0(o),r===null&&rh(o),m=o.type,v=o.pendingProps,x=r!==null?r.memoizedProps:null,T=v.children,Yd(m,v)?T=null:x!==null&&Yd(m,x)&&(o.flags|=32),Nx(r,o),sn(r,o,T,u),o.child;case 6:return r===null&&rh(o),null;case 13:return Tx(r,o,u);case 4:return dh(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=bo(o,null,m,u):sn(r,o,m,u),o.child;case 11:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:tr(m,v),bx(r,o,m,v,u);case 7:return sn(r,o,o.pendingProps,u),o.child;case 8:return sn(r,o,o.pendingProps.children,u),o.child;case 12:return sn(r,o,o.pendingProps.children,u),o.child;case 10:e:{if(m=o.type._context,v=o.pendingProps,x=o.memoizedProps,T=v.value,ht(Ec,m._currentValue),m._currentValue=T,x!==null)if(Nn(x.value,T)){if(x.children===v.children&&!dn.current){o=Zr(r,o,u);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var V=x.dependencies;if(V!==null){T=x.child;for(var te=V.firstContext;te!==null;){if(te.context===m){if(x.tag===1){te=Qr(-1,u&-u),te.tag=2;var ce=x.updateQueue;if(ce!==null){ce=ce.shared;var ye=ce.pending;ye===null?te.next=te:(te.next=ye.next,ye.next=te),ce.pending=te}}x.lanes|=u,te=x.alternate,te!==null&&(te.lanes|=u),lh(x.return,u,o),V.lanes|=u;break}te=te.next}}else if(x.tag===10)T=x.type===o.type?null:x.child;else if(x.tag===18){if(T=x.return,T===null)throw Error(n(341));T.lanes|=u,V=T.alternate,V!==null&&(V.lanes|=u),lh(T,u,o),T=x.sibling}else T=x.child;if(T!==null)T.return=x;else for(T=x;T!==null;){if(T===o){T=null;break}if(x=T.sibling,x!==null){x.return=T.return,T=x;break}T=T.return}x=T}sn(r,o,v.children,u),o=o.child}return o;case 9:return v=o.type,m=o.pendingProps.children,_o(o,u),v=Fn(v),m=m(v),o.flags|=1,sn(r,o,m,u),o.child;case 14:return m=o.type,v=tr(m,o.pendingProps),v=tr(m.type,v),kx(r,o,m,v,u);case 15:return _x(r,o,o.type,o.pendingProps,u);case 17:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:tr(m,v),Dc(r,o),o.tag=1,hn(m)?(r=!0,xc(o)):r=!1,_o(o,u),px(o,m,v),Sh(o,m,v,u),Ch(null,o,m,!0,r,u);case 19:return Ax(r,o,u);case 22:return Sx(r,o,u)}throw Error(n(156,o.tag))};function tb(r,o){return Wa(r,o)}function oM(r,o,u,m){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=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Un(r,o,u,m){return new oM(r,o,u,m)}function Yh(r){return r=r.prototype,!(!r||!r.isReactComponent)}function iM(r){if(typeof r=="function")return Yh(r)?1:0;if(r!=null){if(r=r.$$typeof,r===H)return 11;if(r===Z)return 14}return 2}function As(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 Kc(r,o,u,m,v,x){var T=2;if(m=r,typeof r=="function")Yh(r)&&(T=1);else if(typeof r=="string")T=5;else e:switch(r){case I:return _a(u.children,v,x,o);case z:T=8,v|=8;break;case O:return r=Un(12,u,o,v|2),r.elementType=O,r.lanes=x,r;case X:return r=Un(13,u,o,v),r.elementType=X,r.lanes=x,r;case R:return r=Un(19,u,o,v),r.elementType=R,r.lanes=x,r;case Q:return Xc(u,v,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:T=10;break e;case D:T=9;break e;case H:T=11;break e;case Z:T=14;break e;case B:T=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Un(T,u,o,v),o.elementType=r,o.type=m,o.lanes=x,o}function _a(r,o,u,m){return r=Un(7,r,m,o),r.lanes=u,r}function Xc(r,o,u,m){return r=Un(22,r,m,o),r.elementType=Q,r.lanes=u,r.stateNode={isHidden:!1},r}function Kh(r,o,u){return r=Un(6,r,null,o),r.lanes=u,r}function Xh(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 lM(r,o,u,m,v){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ui(0),this.expirationTimes=ui(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ui(0),this.identifierPrefix=m,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Qh(r,o,u,m,v,x,T,V,te){return r=new lM(r,o,u,V,te),o===1?(o=1,x===!0&&(o|=8)):o=0,x=Un(3,null,null,o),r.current=x,x.stateNode=r,x.memoizedState={element:m,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},uh(x),r}function cM(r,o,u){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:$,key:m==null?null:""+m,children:r,containerInfo:o,implementation:u}}function nb(r){if(!r)return ks;r=r._reactInternals;e:{if($n(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(hn(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(hn(u))return R0(r,u,o)}return o}function rb(r,o,u,m,v,x,T,V,te){return r=Qh(u,m,!0,r,v,x,T,V,te),r.context=nb(null),u=r.current,m=an(),v=Ts(u),x=Qr(m,v),x.callback=o??null,Ns(u,x,v),r.current.lanes=v,Zs(r,v,m),mn(r,m),r}function Qc(r,o,u,m){var v=o.current,x=an(),T=Ts(v);return u=nb(u),o.context===null?o.context=u:o.pendingContext=u,o=Qr(x,T),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=Ns(v,o,T),r!==null&&(sr(r,v,T,x),Cc(r,v,T)),T}function Zc(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 sb(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<o?u:o}}function Zh(r,o){sb(r,o),(r=r.alternate)&&sb(r,o)}function uM(){return null}var ab=typeof reportError=="function"?reportError:function(r){console.error(r)};function Jh(r){this._internalRoot=r}Jc.prototype.render=Jh.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Qc(r,o,null,null)},Jc.prototype.unmount=Jh.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;xa(function(){Qc(null,r,null,null)}),o[Gr]=null}};function Jc(r){this._internalRoot=r}Jc.prototype.unstable_scheduleHydration=function(r){if(r){var o=fi();r={blockedOn:null,target:r,priority:o};for(var u=0;u<ln.length&&o!==0&&o<ln[u].priority;u++);ln.splice(u,0,r),u===0&&Jl(r)}};function ef(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function eu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function ob(){}function dM(r,o,u,m,v){if(v){if(typeof m=="function"){var x=m;m=function(){var ce=Zc(T);x.call(ce)}}var T=rb(o,m,r,0,null,!1,!1,"",ob);return r._reactRootContainer=T,r[Gr]=T.current,mt(r.nodeType===8?r.parentNode:r),xa(),T}for(;v=r.lastChild;)r.removeChild(v);if(typeof m=="function"){var V=m;m=function(){var ce=Zc(te);V.call(ce)}}var te=Qh(r,0,!1,null,null,!1,!1,"",ob);return r._reactRootContainer=te,r[Gr]=te.current,mt(r.nodeType===8?r.parentNode:r),xa(function(){Qc(o,te,u,m)}),te}function tu(r,o,u,m,v){var x=u._reactRootContainer;if(x){var T=x;if(typeof v=="function"){var V=v;v=function(){var te=Zc(T);V.call(te)}}Qc(o,T,r,v)}else T=dM(u,o,r,v,m);return Zc(T)}hi=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var u=Xs(o.pendingLanes);u!==0&&(Ka(o,u|1),mn(o,dt()),(tt&6)===0&&(Co=dt()+500,_s()))}break;case 13:xa(function(){var m=Xr(r,1);if(m!==null){var v=an();sr(m,r,1,v)}}),Zh(r,1)}},us=function(r){if(r.tag===13){var o=Xr(r,134217728);if(o!==null){var u=an();sr(o,r,134217728,u)}Zh(r,134217728)}},Xa=function(r){if(r.tag===13){var o=Ts(r),u=Xr(r,o);if(u!==null){var m=an();sr(u,r,o,m)}Zh(r,o)}},fi=function(){return Ze},pi=function(r,o){var u=Ze;try{return Ze=r,o()}finally{Ze=u}},xt=function(r,o,u){switch(o){case"input":if(be(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 m=u[o];if(m!==r&&m.form===r.form){var v=vc(m);if(!v)throw Error(n(90));Ve(m),be(m,v)}}}break;case"textarea":pe(r,u);break;case"select":o=u.value,o!=null&&ut(r,!!u.multiple,o,!1)}},Fa=Hh,wn=xa;var hM={usingClientEntryPoint:!1,Events:[Ui,mo,vc,Da,qa,Hh]},rl={findFiberByHostInstance:ha,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},fM={bundleType:rl.bundleType,version:rl.version,rendererPackageName:rl.rendererPackageName,rendererConfig:rl.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=Ir(r),r===null?null:r.stateNode},findFiberByHostInstance:rl.findFiberByHostInstance||uM,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nu.isDisabled&&nu.supportsFiber)try{Pr=nu.inject(fM),qt=nu}catch{}}return gn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=hM,gn.createPortal=function(r,o){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ef(o))throw Error(n(200));return cM(r,o,null,u)},gn.createRoot=function(r,o){if(!ef(r))throw Error(n(299));var u=!1,m="",v=ab;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=Qh(r,1,!1,null,null,u,!1,m,v),r[Gr]=o.current,mt(r.nodeType===8?r.parentNode:r),new Jh(o)},gn.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=Ir(o),r=r===null?null:r.stateNode,r},gn.flushSync=function(r){return xa(r)},gn.hydrate=function(r,o,u){if(!eu(o))throw Error(n(200));return tu(null,r,o,!0,u)},gn.hydrateRoot=function(r,o,u){if(!ef(r))throw Error(n(405));var m=u!=null&&u.hydratedSources||null,v=!1,x="",T=ab;if(u!=null&&(u.unstable_strictMode===!0&&(v=!0),u.identifierPrefix!==void 0&&(x=u.identifierPrefix),u.onRecoverableError!==void 0&&(T=u.onRecoverableError)),o=rb(o,null,r,1,u??null,v,!1,x,T),r[Gr]=o.current,mt(r),m)for(r=0;r<m.length;r++)u=m[r],v=u._getVersion,v=v(u._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[u,v]:o.mutableSourceEagerHydrationData.push(u,v);return new Jc(o)},gn.render=function(r,o,u){if(!eu(o))throw Error(n(200));return tu(null,r,o,!1,u)},gn.unmountComponentAtNode=function(r){if(!eu(r))throw Error(n(40));return r._reactRootContainer?(xa(function(){tu(null,null,r,!1,function(){r._reactRootContainer=null,r[Gr]=null})}),!0):!1},gn.unstable_batchedUpdates=Hh,gn.unstable_renderSubtreeIntoContainer=function(r,o,u,m){if(!eu(u))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return tu(r,o,u,!1,m)},gn.version="18.3.1-next-f1338f8080-20240426",gn}var pb;function Zj(){if(pb)return rf.exports;pb=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(),rf.exports=xM(),rf.exports}var mb;function bM(){if(mb)return su;mb=1;var e=Zj();return su.createRoot=e.createRoot,su.hydrateRoot=e.hydrateRoot,su}var kM=bM(),b=$l();const he=Ew(b);function Vt(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=Vt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var of={exports:{}},lf={},cf={exports:{}},uf={};/**
|
|
40
|
+
`+x.stack}return{value:r,source:o,stack:v,digest:null}}function Nh(r,o,u){return{value:r,source:null,stack:u??null,digest:o??null}}function Eh(r,o){try{console.error(o.value)}catch(u){setTimeout(function(){throw u})}}var WA=typeof WeakMap=="function"?WeakMap:Map;function yx(r,o,u){u=Qr(-1,u),u.tag=3,u.payload={element:null};var m=o.value;return u.callback=function(){Uc||(Uc=!0,zh=m),Eh(r,o)},u}function vx(r,o,u){u=Qr(-1,u),u.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var v=o.value;u.payload=function(){return m(v)},u.callback=function(){Eh(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(u.callback=function(){Eh(r,o),typeof m!="function"&&(js===null?js=new Set([this]):js.add(this));var T=o.stack;this.componentDidCatch(o.value,{componentStack:T!==null?T:""})}),u}function wx(r,o,u){var m=r.pingCache;if(m===null){m=r.pingCache=new WA;var v=new Set;m.set(o,v)}else v=m.get(o),v===void 0&&(v=new Set,m.set(o,v));v.has(u)||(v.add(u),r=sM.bind(null,r,o,u),o.then(r,r))}function xx(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 bx(r,o,u,m,v){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=Qr(-1,1),o.tag=2,Ns(u,o,1))),u.lanes|=1),r):(r.flags|=65536,r.lanes=v,r)}var HA=C.ReactCurrentOwner,fn=!1;function sn(r,o,u,m){o.child=r===null?z0(o,null,u,m):bo(o,r.child,u,m)}function kx(r,o,u,m,v){u=u.render;var x=o.ref;return _o(o,v),m=yh(r,o,u,m,x,v),u=vh(),r!==null&&!fn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,Zr(r,o,v)):(gt&&u&&eh(o),o.flags|=1,sn(r,o,m,v),o.child)}function _x(r,o,u,m,v){if(r===null){var x=u.type;return typeof x=="function"&&!Yh(x)&&x.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(o.tag=15,o.type=x,Sx(r,o,x,m,v)):(r=Kc(u.type,null,m,o,o.mode,v),r.ref=o.ref,r.return=o,o.child=r)}if(x=r.child,(r.lanes&v)===0){var T=x.memoizedProps;if(u=u.compare,u=u!==null?u:En,u(T,m)&&r.ref===o.ref)return Zr(r,o,v)}return o.flags|=1,r=As(x,m),r.ref=o.ref,r.return=o,o.child=r}function Sx(r,o,u,m,v){if(r!==null){var x=r.memoizedProps;if(En(x,m)&&r.ref===o.ref)if(fn=!1,o.pendingProps=m=x,(r.lanes&v)!==0)(r.flags&131072)!==0&&(fn=!0);else return o.lanes=r.lanes,Zr(r,o,v)}return jh(r,o,u,m,v)}function Nx(r,o,u){var m=o.pendingProps,v=m.children,x=r!==null?r.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},ht(jo,Tn),Tn|=u;else{if((u&1073741824)===0)return r=x!==null?x.baseLanes|u:u,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,ht(jo,Tn),Tn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=x!==null?x.baseLanes:u,ht(jo,Tn),Tn|=m}else x!==null?(m=x.baseLanes|u,o.memoizedState=null):m=u,ht(jo,Tn),Tn|=m;return sn(r,o,v,u),o.child}function Ex(r,o){var u=o.ref;(r===null&&u!==null||r!==null&&r.ref!==u)&&(o.flags|=512,o.flags|=2097152)}function jh(r,o,u,m,v){var x=hn(u)?fa:Xt.current;return x=yo(o,x),_o(o,v),u=yh(r,o,u,m,x,v),m=vh(),r!==null&&!fn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,Zr(r,o,v)):(gt&&m&&eh(o),o.flags|=1,sn(r,o,u,v),o.child)}function jx(r,o,u,m,v){if(hn(u)){var x=!0;xc(o)}else x=!1;if(_o(o,v),o.stateNode===null)Dc(r,o),mx(o,u,m),Sh(o,u,m,v),m=!0;else if(r===null){var T=o.stateNode,V=o.memoizedProps;T.props=V;var te=T.context,ce=u.contextType;typeof ce=="object"&&ce!==null?ce=Fn(ce):(ce=hn(u)?fa:Xt.current,ce=yo(o,ce));var ye=u.getDerivedStateFromProps,ve=typeof ye=="function"||typeof T.getSnapshotBeforeUpdate=="function";ve||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(V!==m||te!==ce)&&gx(o,T,m,ce),Ss=!1;var ge=o.memoizedState;T.state=ge,Tc(o,m,T,v),te=o.memoizedState,V!==m||ge!==te||dn.current||Ss?(typeof ye=="function"&&(_h(o,u,ye,m),te=o.memoizedState),(V=Ss||px(o,u,V,m,ge,te,ce))?(ve||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(o.flags|=4194308)):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=te),T.props=m,T.state=te,T.context=ce,m=V):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{T=o.stateNode,U0(r,o),V=o.memoizedProps,ce=o.type===o.elementType?V:tr(o.type,V),T.props=ce,ve=o.pendingProps,ge=T.context,te=u.contextType,typeof te=="object"&&te!==null?te=Fn(te):(te=hn(u)?fa:Xt.current,te=yo(o,te));var Ee=u.getDerivedStateFromProps;(ye=typeof Ee=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(V!==ve||ge!==te)&&gx(o,T,m,te),Ss=!1,ge=o.memoizedState,T.state=ge,Tc(o,m,T,v);var Te=o.memoizedState;V!==ve||ge!==Te||dn.current||Ss?(typeof Ee=="function"&&(_h(o,u,Ee,m),Te=o.memoizedState),(ce=Ss||px(o,u,ce,m,ge,Te,te)||!1)?(ye||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(m,Te,te),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(m,Te,te)),typeof T.componentDidUpdate=="function"&&(o.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof T.componentDidUpdate!="function"||V===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||V===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=Te),T.props=m,T.state=Te,T.context=te,m=ce):(typeof T.componentDidUpdate!="function"||V===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||V===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),m=!1)}return Ch(r,o,u,m,x,v)}function Ch(r,o,u,m,v,x){Ex(r,o);var T=(o.flags&128)!==0;if(!m&&!T)return v&&M0(o,u,!1),Zr(r,o,x);m=o.stateNode,HA.current=o;var V=T&&typeof u.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&T?(o.child=bo(o,r.child,null,x),o.child=bo(o,null,V,x)):sn(r,o,V,x),o.memoizedState=m.state,v&&M0(o,u,!0),o.child}function Cx(r){var o=r.stateNode;o.pendingContext?R0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&R0(r,o.context,!1),dh(r,o.containerInfo)}function Tx(r,o,u,m,v){return xo(),sh(v),o.flags|=256,sn(r,o,u,m),o.child}var Th={dehydrated:null,treeContext:null,retryLane:0};function Rh(r){return{baseLanes:r,cachePool:null,transitions:null}}function Rx(r,o,u){var m=o.pendingProps,v=bt.current,x=!1,T=(o.flags&128)!==0,V;if((V=T)||(V=r!==null&&r.memoizedState===null?!1:(v&2)!==0),V?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(v|=1),ht(bt,v&1),r===null)return rh(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):(T=m.children,r=m.fallback,x?(m=o.mode,x=o.child,T={mode:"hidden",children:T},(m&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=T):x=Xc(T,m,0,null),r=_a(r,m,u,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=Rh(u),o.memoizedState=Th,r):Ah(o,T));if(v=r.memoizedState,v!==null&&(V=v.dehydrated,V!==null))return GA(r,o,T,m,V,v,u);if(x){x=m.fallback,T=o.mode,v=r.child,V=v.sibling;var te={mode:"hidden",children:m.children};return(T&1)===0&&o.child!==v?(m=o.child,m.childLanes=0,m.pendingProps=te,o.deletions=null):(m=As(v,te),m.subtreeFlags=v.subtreeFlags&14680064),V!==null?x=As(V,x):(x=_a(x,T,u,null),x.flags|=2),x.return=o,m.return=o,m.sibling=x,o.child=m,m=x,x=o.child,T=r.child.memoizedState,T=T===null?Rh(u):{baseLanes:T.baseLanes|u,cachePool:null,transitions:T.transitions},x.memoizedState=T,x.childLanes=r.childLanes&~u,o.memoizedState=Th,m}return x=r.child,r=x.sibling,m=As(x,{mode:"visible",children:m.children}),(o.mode&1)===0&&(m.lanes=u),m.return=o,m.sibling=null,r!==null&&(u=o.deletions,u===null?(o.deletions=[r],o.flags|=16):u.push(r)),o.child=m,o.memoizedState=null,m}function Ah(r,o){return o=Xc({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Lc(r,o,u,m){return m!==null&&sh(m),bo(o,r.child,null,u),r=Ah(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function GA(r,o,u,m,v,x,T){if(u)return o.flags&256?(o.flags&=-257,m=Nh(Error(n(422))),Lc(r,o,T,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=m.fallback,v=o.mode,m=Xc({mode:"visible",children:m.children},v,0,null),x=_a(x,v,T,null),x.flags|=2,m.return=o,x.return=o,m.sibling=x,o.child=m,(o.mode&1)!==0&&bo(o,r.child,null,T),o.child.memoizedState=Rh(T),o.memoizedState=Th,x);if((o.mode&1)===0)return Lc(r,o,T,null);if(v.data==="$!"){if(m=v.nextSibling&&v.nextSibling.dataset,m)var V=m.dgst;return m=V,x=Error(n(419)),m=Nh(x,m,void 0),Lc(r,o,T,m)}if(V=(T&r.childLanes)!==0,fn||V){if(m=zt,m!==null){switch(T&-T){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(m.suspendedLanes|T))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Xr(r,v),sr(m,r,v,-1))}return Vh(),m=Nh(Error(n(421))),Lc(r,o,T,m)}return v.data==="$?"?(o.flags|=128,o.child=r.child,o=aM.bind(null,r),v._reactRetry=o,null):(r=x.treeContext,Cn=xs(v.nextSibling),jn=o,gt=!0,er=null,r!==null&&(Dn[qn++]=Yr,Dn[qn++]=Kr,Dn[qn++]=pa,Yr=r.id,Kr=r.overflow,pa=o),o=Ah(o,m.children),o.flags|=4096,o)}function Ax(r,o,u){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),lh(r.return,o,u)}function Mh(r,o,u,m,v){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:u,tailMode:v}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=m,x.tail=u,x.tailMode=v)}function Mx(r,o,u){var m=o.pendingProps,v=m.revealOrder,x=m.tail;if(sn(r,o,m.children,u),m=bt.current,(m&2)!==0)m=m&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&&Ax(r,u,o);else if(r.tag===19)Ax(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}m&=1}if(ht(bt,m),(o.mode&1)===0)o.memoizedState=null;else switch(v){case"forwards":for(u=o.child,v=null;u!==null;)r=u.alternate,r!==null&&Rc(r)===null&&(v=u),u=u.sibling;u=v,u===null?(v=o.child,o.child=null):(v=u.sibling,u.sibling=null),Mh(o,!1,v,u,x);break;case"backwards":for(u=null,v=o.child,o.child=null;v!==null;){if(r=v.alternate,r!==null&&Rc(r)===null){o.child=v;break}r=v.sibling,v.sibling=u,u=v,v=r}Mh(o,!0,u,null,x);break;case"together":Mh(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Dc(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Zr(r,o,u){if(r!==null&&(o.dependencies=r.dependencies),wa|=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=As(r,r.pendingProps),o.child=u,u.return=o;r.sibling!==null;)r=r.sibling,u=u.sibling=As(r,r.pendingProps),u.return=o;u.sibling=null}return o.child}function VA(r,o,u){switch(o.tag){case 3:Cx(o),xo();break;case 5:G0(o);break;case 1:hn(o.type)&&xc(o);break;case 4:dh(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,v=o.memoizedProps.value;ht(Ec,m._currentValue),m._currentValue=v;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(ht(bt,bt.current&1),o.flags|=128,null):(u&o.child.childLanes)!==0?Rx(r,o,u):(ht(bt,bt.current&1),r=Zr(r,o,u),r!==null?r.sibling:null);ht(bt,bt.current&1);break;case 19:if(m=(u&o.childLanes)!==0,(r.flags&128)!==0){if(m)return Mx(r,o,u);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),ht(bt,bt.current),m)break;return null;case 22:case 23:return o.lanes=0,Nx(r,o,u)}return Zr(r,o,u)}var Ix,Ih,$x,Ox;Ix=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}},Ih=function(){},$x=function(r,o,u,m){var v=r.memoizedProps;if(v!==m){r=o.stateNode,ya(kr.current);var x=null;switch(u){case"input":v=qe(r,v),m=qe(r,m),x=[];break;case"select":v=J({},v,{value:void 0}),m=J({},m,{value:void 0}),x=[];break;case"textarea":v=at(r,v),m=at(r,m),x=[];break;default:typeof v.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=yc)}vt(u,m);var T;u=null;for(ce in v)if(!m.hasOwnProperty(ce)&&v.hasOwnProperty(ce)&&v[ce]!=null)if(ce==="style"){var V=v[ce];for(T in V)V.hasOwnProperty(T)&&(u||(u={}),u[T]="")}else ce!=="dangerouslySetInnerHTML"&&ce!=="children"&&ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&ce!=="autoFocus"&&(a.hasOwnProperty(ce)?x||(x=[]):(x=x||[]).push(ce,null));for(ce in m){var te=m[ce];if(V=v!=null?v[ce]:void 0,m.hasOwnProperty(ce)&&te!==V&&(te!=null||V!=null))if(ce==="style")if(V){for(T in V)!V.hasOwnProperty(T)||te&&te.hasOwnProperty(T)||(u||(u={}),u[T]="");for(T in te)te.hasOwnProperty(T)&&V[T]!==te[T]&&(u||(u={}),u[T]=te[T])}else u||(x||(x=[]),x.push(ce,u)),u=te;else ce==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,V=V?V.__html:void 0,te!=null&&V!==te&&(x=x||[]).push(ce,te)):ce==="children"?typeof te!="string"&&typeof te!="number"||(x=x||[]).push(ce,""+te):ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&(a.hasOwnProperty(ce)?(te!=null&&ce==="onScroll"&<("scroll",r),x||V===te||(x=[])):(x=x||[]).push(ce,te))}u&&(x=x||[]).push("style",u);var ce=x;(o.updateQueue=ce)&&(o.flags|=4)}},Ox=function(r,o,u,m){u!==m&&(o.flags|=4)};function Zi(r,o){if(!gt)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 m=null;u!==null;)u.alternate!==null&&(m=u),u=u.sibling;m===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function Zt(r){var o=r.alternate!==null&&r.alternate.child===r.child,u=0,m=0;if(o)for(var v=r.child;v!==null;)u|=v.lanes|v.childLanes,m|=v.subtreeFlags&14680064,m|=v.flags&14680064,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)u|=v.lanes|v.childLanes,m|=v.subtreeFlags,m|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=m,r.childLanes=u,o}function YA(r,o,u){var m=o.pendingProps;switch(th(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Zt(o),null;case 1:return hn(o.type)&&wc(),Zt(o),null;case 3:return m=o.stateNode,So(),pt(dn),pt(Xt),ph(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(Sc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,er!==null&&(Wh(er),er=null))),Ih(r,o),Zt(o),null;case 5:hh(o);var v=ya(Vi.current);if(u=o.type,r!==null&&o.stateNode!=null)$x(r,o,u,m,v),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return Zt(o),null}if(r=ya(kr.current),Sc(o)){m=o.stateNode,u=o.type;var x=o.memoizedProps;switch(m[br]=o,m[Bi]=x,r=(o.mode&1)!==0,u){case"dialog":lt("cancel",m),lt("close",m);break;case"iframe":case"object":case"embed":lt("load",m);break;case"video":case"audio":for(v=0;v<da.length;v++)lt(da[v],m);break;case"source":lt("error",m);break;case"img":case"image":case"link":lt("error",m),lt("load",m);break;case"details":lt("toggle",m);break;case"input":Ne(m,x),lt("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!x.multiple},lt("invalid",m);break;case"textarea":Ye(m,x),lt("invalid",m)}vt(u,x),v=null;for(var T in x)if(x.hasOwnProperty(T)){var V=x[T];T==="children"?typeof V=="string"?m.textContent!==V&&(x.suppressHydrationWarning!==!0&&gc(m.textContent,V,r),v=["children",V]):typeof V=="number"&&m.textContent!==""+V&&(x.suppressHydrationWarning!==!0&&gc(m.textContent,V,r),v=["children",""+V]):a.hasOwnProperty(T)&&V!=null&&T==="onScroll"&<("scroll",m)}switch(u){case"input":ke(m),re(m,x,!0);break;case"textarea":ke(m),we(m);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(m.onclick=yc)}m=v,o.updateQueue=m,m!==null&&(o.flags|=4)}else{T=v.nodeType===9?v:v.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=Pe(u)),r==="http://www.w3.org/1999/xhtml"?u==="script"?(r=T.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=T.createElement(u,{is:m.is}):(r=T.createElement(u),u==="select"&&(T=r,m.multiple?T.multiple=!0:m.size&&(T.size=m.size))):r=T.createElementNS(r,u),r[br]=o,r[Bi]=m,Ix(r,o,!1,!1),o.stateNode=r;e:{switch(T=Ae(u,m),u){case"dialog":lt("cancel",r),lt("close",r),v=m;break;case"iframe":case"object":case"embed":lt("load",r),v=m;break;case"video":case"audio":for(v=0;v<da.length;v++)lt(da[v],r);v=m;break;case"source":lt("error",r),v=m;break;case"img":case"image":case"link":lt("error",r),lt("load",r),v=m;break;case"details":lt("toggle",r),v=m;break;case"input":Ne(r,m),v=qe(r,m),lt("invalid",r);break;case"option":v=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},v=J({},m,{value:void 0}),lt("invalid",r);break;case"textarea":Ye(r,m),v=at(r,m),lt("invalid",r);break;default:v=m}vt(u,v),V=v;for(x in V)if(V.hasOwnProperty(x)){var te=V[x];x==="style"?Be(r,te):x==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,te!=null&&$e(r,te)):x==="children"?typeof te=="string"?(u!=="textarea"||te!=="")&&se(r,te):typeof te=="number"&&se(r,""+te):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(a.hasOwnProperty(x)?te!=null&&x==="onScroll"&<("scroll",r):te!=null&&j(r,x,te,T))}switch(u){case"input":ke(r),re(r,m,!1);break;case"textarea":ke(r),we(r);break;case"option":m.value!=null&&r.setAttribute("value",""+le(m.value));break;case"select":r.multiple=!!m.multiple,x=m.value,x!=null?ut(r,!!m.multiple,x,!1):m.defaultValue!=null&&ut(r,!!m.multiple,m.defaultValue,!0);break;default:typeof v.onClick=="function"&&(r.onclick=yc)}switch(u){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return Zt(o),null;case 6:if(r&&o.stateNode!=null)Ox(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(u=ya(Vi.current),ya(kr.current),Sc(o)){if(m=o.stateNode,u=o.memoizedProps,m[br]=o,(x=m.nodeValue!==u)&&(r=jn,r!==null))switch(r.tag){case 3:gc(m.nodeValue,u,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&gc(m.nodeValue,u,(r.mode&1)!==0)}x&&(o.flags|=4)}else m=(u.nodeType===9?u:u.ownerDocument).createTextNode(m),m[br]=o,o.stateNode=m}return Zt(o),null;case 13:if(pt(bt),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(gt&&Cn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)D0(),xo(),o.flags|=98560,x=!1;else if(x=Sc(o),m!==null&&m.dehydrated!==null){if(r===null){if(!x)throw Error(n(318));if(x=o.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(n(317));x[br]=o}else xo(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Zt(o),x=!1}else er!==null&&(Wh(er),er=null),x=!0;if(!x)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=u,o):(m=m!==null,m!==(r!==null&&r.memoizedState!==null)&&m&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(bt.current&1)!==0?Lt===0&&(Lt=3):Vh())),o.updateQueue!==null&&(o.flags|=4),Zt(o),null);case 4:return So(),Ih(r,o),r===null&&mt(o.stateNode.containerInfo),Zt(o),null;case 10:return ih(o.type._context),Zt(o),null;case 17:return hn(o.type)&&wc(),Zt(o),null;case 19:if(pt(bt),x=o.memoizedState,x===null)return Zt(o),null;if(m=(o.flags&128)!==0,T=x.rendering,T===null)if(m)Zi(x,!1);else{if(Lt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(T=Rc(r),T!==null){for(o.flags|=128,Zi(x,!1),m=T.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=u,u=o.child;u!==null;)x=u,r=m,x.flags&=14680066,T=x.alternate,T===null?(x.childLanes=0,x.lanes=r,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=T.childLanes,x.lanes=T.lanes,x.child=T.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=T.memoizedProps,x.memoizedState=T.memoizedState,x.updateQueue=T.updateQueue,x.type=T.type,r=T.dependencies,x.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),u=u.sibling;return ht(bt,bt.current&1|2),o.child}r=r.sibling}x.tail!==null&&dt()>Co&&(o.flags|=128,m=!0,Zi(x,!1),o.lanes=4194304)}else{if(!m)if(r=Rc(T),r!==null){if(o.flags|=128,m=!0,u=r.updateQueue,u!==null&&(o.updateQueue=u,o.flags|=4),Zi(x,!0),x.tail===null&&x.tailMode==="hidden"&&!T.alternate&&!gt)return Zt(o),null}else 2*dt()-x.renderingStartTime>Co&&u!==1073741824&&(o.flags|=128,m=!0,Zi(x,!1),o.lanes=4194304);x.isBackwards?(T.sibling=o.child,o.child=T):(u=x.last,u!==null?u.sibling=T:o.child=T,x.last=T)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=dt(),o.sibling=null,u=bt.current,ht(bt,m?u&1|2:u&1),o):(Zt(o),null);case 22:case 23:return Gh(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(Tn&1073741824)!==0&&(Zt(o),o.subtreeFlags&6&&(o.flags|=8192)):Zt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function KA(r,o){switch(th(o),o.tag){case 1:return hn(o.type)&&wc(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return So(),pt(dn),pt(Xt),ph(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return hh(o),null;case 13:if(pt(bt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));xo()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return pt(bt),null;case 4:return So(),null;case 10:return ih(o.type._context),null;case 22:case 23:return Gh(),null;case 24:return null;default:return null}}var qc=!1,Jt=!1,XA=typeof WeakSet=="function"?WeakSet:Set,Ce=null;function Eo(r,o){var u=r.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(m){Et(r,o,m)}else u.current=null}function $h(r,o,u){try{u()}catch(m){Et(r,o,m)}}var Px=!1;function QA(r,o){if(Gd=ds,r=$i(),Oi(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var m=u.getSelection&&u.getSelection();if(m&&m.rangeCount!==0){u=m.anchorNode;var v=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{u.nodeType,x.nodeType}catch{u=null;break e}var T=0,V=-1,te=-1,ce=0,ye=0,ve=r,ge=null;t:for(;;){for(var Ee;ve!==u||v!==0&&ve.nodeType!==3||(V=T+v),ve!==x||m!==0&&ve.nodeType!==3||(te=T+m),ve.nodeType===3&&(T+=ve.nodeValue.length),(Ee=ve.firstChild)!==null;)ge=ve,ve=Ee;for(;;){if(ve===r)break t;if(ge===u&&++ce===v&&(V=T),ge===x&&++ye===m&&(te=T),(Ee=ve.nextSibling)!==null)break;ve=ge,ge=ve.parentNode}ve=Ee}u=V===-1||te===-1?null:{start:V,end:te}}else u=null}u=u||{start:0,end:0}}else u=null;for(Vd={focusedElem:r,selectionRange:u},ds=!1,Ce=o;Ce!==null;)if(o=Ce,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,Ce=r;else for(;Ce!==null;){o=Ce;try{var Te=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Te!==null){var Me=Te.memoizedProps,Ct=Te.memoizedState,ae=o.stateNode,ne=ae.getSnapshotBeforeUpdate(o.elementType===o.type?Me:tr(o.type,Me),Ct);ae.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var oe=o.stateNode.containerInfo;oe.nodeType===1?oe.textContent="":oe.nodeType===9&&oe.documentElement&&oe.removeChild(oe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(xe){Et(o,o.return,xe)}if(r=o.sibling,r!==null){r.return=o.return,Ce=r;break}Ce=o.return}return Te=Px,Px=!1,Te}function Ji(r,o,u){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var v=m=m.next;do{if((v.tag&r)===r){var x=v.destroy;v.destroy=void 0,x!==void 0&&$h(o,u,x)}v=v.next}while(v!==m)}}function Fc(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 m=u.create;u.destroy=m()}u=u.next}while(u!==o)}}function Oh(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 Lx(r){var o=r.alternate;o!==null&&(r.alternate=null,Lx(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[br],delete o[Bi],delete o[Qd],delete o[IA],delete o[$A])),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 Dx(r){return r.tag===5||r.tag===3||r.tag===4}function qx(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Dx(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 Ph(r,o,u){var m=r.tag;if(m===5||m===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=yc));else if(m!==4&&(r=r.child,r!==null))for(Ph(r,o,u),r=r.sibling;r!==null;)Ph(r,o,u),r=r.sibling}function Lh(r,o,u){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?u.insertBefore(r,o):u.appendChild(r);else if(m!==4&&(r=r.child,r!==null))for(Lh(r,o,u),r=r.sibling;r!==null;)Lh(r,o,u),r=r.sibling}var Wt=null,nr=!1;function Es(r,o,u){for(u=u.child;u!==null;)Fx(r,o,u),u=u.sibling}function Fx(r,o,u){if(qt&&typeof qt.onCommitFiberUnmount=="function")try{qt.onCommitFiberUnmount(Pr,u)}catch{}switch(u.tag){case 5:Jt||Eo(u,o);case 6:var m=Wt,v=nr;Wt=null,Es(r,o,u),Wt=m,nr=v,Wt!==null&&(nr?(r=Wt,u=u.stateNode,r.nodeType===8?r.parentNode.removeChild(u):r.removeChild(u)):Wt.removeChild(u.stateNode));break;case 18:Wt!==null&&(nr?(r=Wt,u=u.stateNode,r.nodeType===8?Xd(r.parentNode,u):r.nodeType===1&&Xd(r,u),Qn(r)):Xd(Wt,u.stateNode));break;case 4:m=Wt,v=nr,Wt=u.stateNode.containerInfo,nr=!0,Es(r,o,u),Wt=m,nr=v;break;case 0:case 11:case 14:case 15:if(!Jt&&(m=u.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){v=m=m.next;do{var x=v,T=x.destroy;x=x.tag,T!==void 0&&((x&2)!==0||(x&4)!==0)&&$h(u,o,T),v=v.next}while(v!==m)}Es(r,o,u);break;case 1:if(!Jt&&(Eo(u,o),m=u.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=u.memoizedProps,m.state=u.memoizedState,m.componentWillUnmount()}catch(V){Et(u,o,V)}Es(r,o,u);break;case 21:Es(r,o,u);break;case 22:u.mode&1?(Jt=(m=Jt)||u.memoizedState!==null,Es(r,o,u),Jt=m):Es(r,o,u);break;default:Es(r,o,u)}}function zx(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var u=r.stateNode;u===null&&(u=r.stateNode=new XA),o.forEach(function(m){var v=oM.bind(null,r,m);u.has(m)||(u.add(m),m.then(v,v))})}}function rr(r,o){var u=o.deletions;if(u!==null)for(var m=0;m<u.length;m++){var v=u[m];try{var x=r,T=o,V=T;e:for(;V!==null;){switch(V.tag){case 5:Wt=V.stateNode,nr=!1;break e;case 3:Wt=V.stateNode.containerInfo,nr=!0;break e;case 4:Wt=V.stateNode.containerInfo,nr=!0;break e}V=V.return}if(Wt===null)throw Error(n(160));Fx(x,T,v),Wt=null,nr=!1;var te=v.alternate;te!==null&&(te.return=null),v.return=null}catch(ce){Et(v,o,ce)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Bx(o,r),o=o.sibling}function Bx(r,o){var u=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(rr(o,r),Sr(r),m&4){try{Ji(3,r,r.return),Fc(3,r)}catch(Me){Et(r,r.return,Me)}try{Ji(5,r,r.return)}catch(Me){Et(r,r.return,Me)}}break;case 1:rr(o,r),Sr(r),m&512&&u!==null&&Eo(u,u.return);break;case 5:if(rr(o,r),Sr(r),m&512&&u!==null&&Eo(u,u.return),r.flags&32){var v=r.stateNode;try{se(v,"")}catch(Me){Et(r,r.return,Me)}}if(m&4&&(v=r.stateNode,v!=null)){var x=r.memoizedProps,T=u!==null?u.memoizedProps:x,V=r.type,te=r.updateQueue;if(r.updateQueue=null,te!==null)try{V==="input"&&x.type==="radio"&&x.name!=null&&Ge(v,x),Ae(V,T);var ce=Ae(V,x);for(T=0;T<te.length;T+=2){var ye=te[T],ve=te[T+1];ye==="style"?Be(v,ve):ye==="dangerouslySetInnerHTML"?$e(v,ve):ye==="children"?se(v,ve):j(v,ye,ve,ce)}switch(V){case"input":be(v,x);break;case"textarea":pe(v,x);break;case"select":var ge=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!x.multiple;var Ee=x.value;Ee!=null?ut(v,!!x.multiple,Ee,!1):ge!==!!x.multiple&&(x.defaultValue!=null?ut(v,!!x.multiple,x.defaultValue,!0):ut(v,!!x.multiple,x.multiple?[]:"",!1))}v[Bi]=x}catch(Me){Et(r,r.return,Me)}}break;case 6:if(rr(o,r),Sr(r),m&4){if(r.stateNode===null)throw Error(n(162));v=r.stateNode,x=r.memoizedProps;try{v.nodeValue=x}catch(Me){Et(r,r.return,Me)}}break;case 3:if(rr(o,r),Sr(r),m&4&&u!==null&&u.memoizedState.isDehydrated)try{Qn(o.containerInfo)}catch(Me){Et(r,r.return,Me)}break;case 4:rr(o,r),Sr(r);break;case 13:rr(o,r),Sr(r),v=r.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(Fh=dt())),m&4&&zx(r);break;case 22:if(ye=u!==null&&u.memoizedState!==null,r.mode&1?(Jt=(ce=Jt)||ye,rr(o,r),Jt=ce):rr(o,r),Sr(r),m&8192){if(ce=r.memoizedState!==null,(r.stateNode.isHidden=ce)&&!ye&&(r.mode&1)!==0)for(Ce=r,ye=r.child;ye!==null;){for(ve=Ce=ye;Ce!==null;){switch(ge=Ce,Ee=ge.child,ge.tag){case 0:case 11:case 14:case 15:Ji(4,ge,ge.return);break;case 1:Eo(ge,ge.return);var Te=ge.stateNode;if(typeof Te.componentWillUnmount=="function"){m=ge,u=ge.return;try{o=m,Te.props=o.memoizedProps,Te.state=o.memoizedState,Te.componentWillUnmount()}catch(Me){Et(m,u,Me)}}break;case 5:Eo(ge,ge.return);break;case 22:if(ge.memoizedState!==null){Hx(ve);continue}}Ee!==null?(Ee.return=ge,Ce=Ee):Hx(ve)}ye=ye.sibling}e:for(ye=null,ve=r;;){if(ve.tag===5){if(ye===null){ye=ve;try{v=ve.stateNode,ce?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(V=ve.stateNode,te=ve.memoizedProps.style,T=te!=null&&te.hasOwnProperty("display")?te.display:null,V.style.display=_e("display",T))}catch(Me){Et(r,r.return,Me)}}}else if(ve.tag===6){if(ye===null)try{ve.stateNode.nodeValue=ce?"":ve.memoizedProps}catch(Me){Et(r,r.return,Me)}}else if((ve.tag!==22&&ve.tag!==23||ve.memoizedState===null||ve===r)&&ve.child!==null){ve.child.return=ve,ve=ve.child;continue}if(ve===r)break e;for(;ve.sibling===null;){if(ve.return===null||ve.return===r)break e;ye===ve&&(ye=null),ve=ve.return}ye===ve&&(ye=null),ve.sibling.return=ve.return,ve=ve.sibling}}break;case 19:rr(o,r),Sr(r),m&4&&zx(r);break;case 21:break;default:rr(o,r),Sr(r)}}function Sr(r){var o=r.flags;if(o&2){try{e:{for(var u=r.return;u!==null;){if(Dx(u)){var m=u;break e}u=u.return}throw Error(n(160))}switch(m.tag){case 5:var v=m.stateNode;m.flags&32&&(se(v,""),m.flags&=-33);var x=qx(r);Lh(r,x,v);break;case 3:case 4:var T=m.stateNode.containerInfo,V=qx(r);Ph(r,V,T);break;default:throw Error(n(161))}}catch(te){Et(r,r.return,te)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function ZA(r,o,u){Ce=r,Ux(r)}function Ux(r,o,u){for(var m=(r.mode&1)!==0;Ce!==null;){var v=Ce,x=v.child;if(v.tag===22&&m){var T=v.memoizedState!==null||qc;if(!T){var V=v.alternate,te=V!==null&&V.memoizedState!==null||Jt;V=qc;var ce=Jt;if(qc=T,(Jt=te)&&!ce)for(Ce=v;Ce!==null;)T=Ce,te=T.child,T.tag===22&&T.memoizedState!==null?Gx(v):te!==null?(te.return=T,Ce=te):Gx(v);for(;x!==null;)Ce=x,Ux(x),x=x.sibling;Ce=v,qc=V,Jt=ce}Wx(r)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,Ce=x):Wx(r)}}function Wx(r){for(;Ce!==null;){var o=Ce;if((o.flags&8772)!==0){var u=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:Jt||Fc(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!Jt)if(u===null)m.componentDidMount();else{var v=o.elementType===o.type?u.memoizedProps:tr(o.type,u.memoizedProps);m.componentDidUpdate(v,u.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&H0(o,x,m);break;case 3:var T=o.updateQueue;if(T!==null){if(u=null,o.child!==null)switch(o.child.tag){case 5:u=o.child.stateNode;break;case 1:u=o.child.stateNode}H0(o,T,u)}break;case 5:var V=o.stateNode;if(u===null&&o.flags&4){u=V;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 ce=o.alternate;if(ce!==null){var ye=ce.memoizedState;if(ye!==null){var ve=ye.dehydrated;ve!==null&&Qn(ve)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Jt||o.flags&512&&Oh(o)}catch(ge){Et(o,o.return,ge)}}if(o===r){Ce=null;break}if(u=o.sibling,u!==null){u.return=o.return,Ce=u;break}Ce=o.return}}function Hx(r){for(;Ce!==null;){var o=Ce;if(o===r){Ce=null;break}var u=o.sibling;if(u!==null){u.return=o.return,Ce=u;break}Ce=o.return}}function Gx(r){for(;Ce!==null;){var o=Ce;try{switch(o.tag){case 0:case 11:case 15:var u=o.return;try{Fc(4,o)}catch(te){Et(o,u,te)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var v=o.return;try{m.componentDidMount()}catch(te){Et(o,v,te)}}var x=o.return;try{Oh(o)}catch(te){Et(o,x,te)}break;case 5:var T=o.return;try{Oh(o)}catch(te){Et(o,T,te)}}}catch(te){Et(o,o.return,te)}if(o===r){Ce=null;break}var V=o.sibling;if(V!==null){V.return=o.return,Ce=V;break}Ce=o.return}}var JA=Math.ceil,zc=C.ReactCurrentDispatcher,Dh=C.ReactCurrentOwner,Bn=C.ReactCurrentBatchConfig,tt=0,zt=null,Rt=null,Ht=0,Tn=0,jo=bs(0),Lt=0,el=null,wa=0,Bc=0,qh=0,tl=null,pn=null,Fh=0,Co=1/0,Jr=null,Uc=!1,zh=null,js=null,Wc=!1,Cs=null,Hc=0,nl=0,Bh=null,Gc=-1,Vc=0;function an(){return(tt&6)!==0?dt():Gc!==-1?Gc:Gc=dt()}function Ts(r){return(r.mode&1)===0?1:(tt&2)!==0&&Ht!==0?Ht&-Ht:PA.transition!==null?(Vc===0&&(Vc=Qs()),Vc):(r=Ze,r!==0||(r=window.event,r=r===void 0?16:gi(r.type)),r)}function sr(r,o,u,m){if(50<nl)throw nl=0,Bh=null,Error(n(185));Zs(r,u,m),((tt&2)===0||r!==zt)&&(r===zt&&((tt&2)===0&&(Bc|=u),Lt===4&&Rs(r,Ht)),mn(r,m),u===1&&tt===0&&(o.mode&1)===0&&(Co=dt()+500,bc&&_s()))}function mn(r,o){var u=r.callbackNode;Ad(r,o);var m=Pn(r,r===zt?Ht:0);if(m===0)u!==null&&$r(u),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(u!=null&&$r(u),o===1)r.tag===0?OA(Yx.bind(null,r)):I0(Yx.bind(null,r)),AA(function(){(tt&6)===0&&_s()}),u=null;else{switch(di(m)){case 1:u=On;break;case 4:u=Ga;break;case 16:u=Or;break;case 536870912:u=Va;break;default:u=Or}u=nb(u,Vx.bind(null,r))}r.callbackPriority=o,r.callbackNode=u}}function Vx(r,o){if(Gc=-1,Vc=0,(tt&6)!==0)throw Error(n(327));var u=r.callbackNode;if(To()&&r.callbackNode!==u)return null;var m=Pn(r,r===zt?Ht:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=Yc(r,m);else{o=m;var v=tt;tt|=2;var x=Xx();(zt!==r||Ht!==o)&&(Jr=null,Co=dt()+500,ba(r,o));do try{nM();break}catch(V){Kx(r,V)}while(!0);oh(),zc.current=x,tt=v,Rt!==null?o=0:(zt=null,Ht=0,o=Lt)}if(o!==0){if(o===2&&(v=Ln(r),v!==0&&(m=v,o=Uh(r,v))),o===1)throw u=el,ba(r,0),Rs(r,m),mn(r,dt()),u;if(o===6)Rs(r,m);else{if(v=r.current.alternate,(m&30)===0&&!eM(v)&&(o=Yc(r,m),o===2&&(x=Ln(r),x!==0&&(m=x,o=Uh(r,x))),o===1))throw u=el,ba(r,0),Rs(r,m),mn(r,dt()),u;switch(r.finishedWork=v,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:ka(r,pn,Jr);break;case 3:if(Rs(r,m),(m&130023424)===m&&(o=Fh+500-dt(),10<o)){if(Pn(r,0)!==0)break;if(v=r.suspendedLanes,(v&m)!==m){an(),r.pingedLanes|=r.suspendedLanes&v;break}r.timeoutHandle=Kd(ka.bind(null,r,pn,Jr),o);break}ka(r,pn,Jr);break;case 4:if(Rs(r,m),(m&4194240)===m)break;for(o=r.eventTimes,v=-1;0<m;){var T=31-on(m);x=1<<T,T=o[T],T>v&&(v=T),m&=~x}if(m=v,m=dt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*JA(m/1960))-m,10<m){r.timeoutHandle=Kd(ka.bind(null,r,pn,Jr),m);break}ka(r,pn,Jr);break;case 5:ka(r,pn,Jr);break;default:throw Error(n(329))}}}return mn(r,dt()),r.callbackNode===u?Vx.bind(null,r):null}function Uh(r,o){var u=tl;return r.current.memoizedState.isDehydrated&&(ba(r,o).flags|=256),r=Yc(r,o),r!==2&&(o=pn,pn=u,o!==null&&Wh(o)),r}function Wh(r){pn===null?pn=r:pn.push.apply(pn,r)}function eM(r){for(var o=r;;){if(o.flags&16384){var u=o.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var m=0;m<u.length;m++){var v=u[m],x=v.getSnapshot;v=v.value;try{if(!Nn(x(),v))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 Rs(r,o){for(o&=~qh,o&=~Bc,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var u=31-on(o),m=1<<u;r[u]=-1,o&=~m}}function Yx(r){if((tt&6)!==0)throw Error(n(327));To();var o=Pn(r,0);if((o&1)===0)return mn(r,dt()),null;var u=Yc(r,o);if(r.tag!==0&&u===2){var m=Ln(r);m!==0&&(o=m,u=Uh(r,m))}if(u===1)throw u=el,ba(r,0),Rs(r,o),mn(r,dt()),u;if(u===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,ka(r,pn,Jr),mn(r,dt()),null}function Hh(r,o){var u=tt;tt|=1;try{return r(o)}finally{tt=u,tt===0&&(Co=dt()+500,bc&&_s())}}function xa(r){Cs!==null&&Cs.tag===0&&(tt&6)===0&&To();var o=tt;tt|=1;var u=Bn.transition,m=Ze;try{if(Bn.transition=null,Ze=1,r)return r()}finally{Ze=m,Bn.transition=u,tt=o,(tt&6)===0&&_s()}}function Gh(){Tn=jo.current,pt(jo)}function ba(r,o){r.finishedWork=null,r.finishedLanes=0;var u=r.timeoutHandle;if(u!==-1&&(r.timeoutHandle=-1,RA(u)),Rt!==null)for(u=Rt.return;u!==null;){var m=u;switch(th(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&wc();break;case 3:So(),pt(dn),pt(Xt),ph();break;case 5:hh(m);break;case 4:So();break;case 13:pt(bt);break;case 19:pt(bt);break;case 10:ih(m.type._context);break;case 22:case 23:Gh()}u=u.return}if(zt=r,Rt=r=As(r.current,null),Ht=Tn=o,Lt=0,el=null,qh=Bc=wa=0,pn=tl=null,ga!==null){for(o=0;o<ga.length;o++)if(u=ga[o],m=u.interleaved,m!==null){u.interleaved=null;var v=m.next,x=u.pending;if(x!==null){var T=x.next;x.next=v,m.next=T}u.pending=m}ga=null}return r}function Kx(r,o){do{var u=Rt;try{if(oh(),Ac.current=Oc,Mc){for(var m=kt.memoizedState;m!==null;){var v=m.queue;v!==null&&(v.pending=null),m=m.next}Mc=!1}if(va=0,Ft=Pt=kt=null,Yi=!1,Ki=0,Dh.current=null,u===null||u.return===null){Lt=1,el=o,Rt=null;break}e:{var x=r,T=u.return,V=u,te=o;if(o=Ht,V.flags|=32768,te!==null&&typeof te=="object"&&typeof te.then=="function"){var ce=te,ye=V,ve=ye.tag;if((ye.mode&1)===0&&(ve===0||ve===11||ve===15)){var ge=ye.alternate;ge?(ye.updateQueue=ge.updateQueue,ye.memoizedState=ge.memoizedState,ye.lanes=ge.lanes):(ye.updateQueue=null,ye.memoizedState=null)}var Ee=xx(T);if(Ee!==null){Ee.flags&=-257,bx(Ee,T,V,x,o),Ee.mode&1&&wx(x,ce,o),o=Ee,te=ce;var Te=o.updateQueue;if(Te===null){var Me=new Set;Me.add(te),o.updateQueue=Me}else Te.add(te);break e}else{if((o&1)===0){wx(x,ce,o),Vh();break e}te=Error(n(426))}}else if(gt&&V.mode&1){var Ct=xx(T);if(Ct!==null){(Ct.flags&65536)===0&&(Ct.flags|=256),bx(Ct,T,V,x,o),sh(No(te,V));break e}}x=te=No(te,V),Lt!==4&&(Lt=2),tl===null?tl=[x]:tl.push(x),x=T;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var ae=yx(x,te,o);W0(x,ae);break e;case 1:V=te;var ne=x.type,oe=x.stateNode;if((x.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||oe!==null&&typeof oe.componentDidCatch=="function"&&(js===null||!js.has(oe)))){x.flags|=65536,o&=-o,x.lanes|=o;var xe=vx(x,V,o);W0(x,xe);break e}}x=x.return}while(x!==null)}Zx(u)}catch(Ie){o=Ie,Rt===u&&u!==null&&(Rt=u=u.return);continue}break}while(!0)}function Xx(){var r=zc.current;return zc.current=Oc,r===null?Oc:r}function Vh(){(Lt===0||Lt===3||Lt===2)&&(Lt=4),zt===null||(wa&268435455)===0&&(Bc&268435455)===0||Rs(zt,Ht)}function Yc(r,o){var u=tt;tt|=2;var m=Xx();(zt!==r||Ht!==o)&&(Jr=null,ba(r,o));do try{tM();break}catch(v){Kx(r,v)}while(!0);if(oh(),tt=u,zc.current=m,Rt!==null)throw Error(n(261));return zt=null,Ht=0,Lt}function tM(){for(;Rt!==null;)Qx(Rt)}function nM(){for(;Rt!==null&&!Vs();)Qx(Rt)}function Qx(r){var o=tb(r.alternate,r,Tn);r.memoizedProps=r.pendingProps,o===null?Zx(r):Rt=o,Dh.current=null}function Zx(r){var o=r;do{var u=o.alternate;if(r=o.return,(o.flags&32768)===0){if(u=YA(u,o,Tn),u!==null){Rt=u;return}}else{if(u=KA(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 ka(r,o,u){var m=Ze,v=Bn.transition;try{Bn.transition=null,Ze=1,rM(r,o,u,m)}finally{Bn.transition=v,Ze=m}return null}function rM(r,o,u,m){do To();while(Cs!==null);if((tt&6)!==0)throw Error(n(327));u=r.finishedWork;var v=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 x=u.lanes|u.childLanes;if(Xl(r,x),r===zt&&(Rt=zt=null,Ht=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||Wc||(Wc=!0,nb(Or,function(){return To(),null})),x=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||x){x=Bn.transition,Bn.transition=null;var T=Ze;Ze=1;var V=tt;tt|=4,Dh.current=null,QA(r,u),Bx(u,r),dc(Vd),ds=!!Gd,Vd=Gd=null,r.current=u,ZA(u),ls(),tt=V,Ze=T,Bn.transition=x}else r.current=u;if(Wc&&(Wc=!1,Cs=r,Hc=v),x=r.pendingLanes,x===0&&(js=null),Ks(u.stateNode),mn(r,dt()),o!==null)for(m=r.onRecoverableError,u=0;u<o.length;u++)v=o[u],m(v.value,{componentStack:v.stack,digest:v.digest});if(Uc)throw Uc=!1,r=zh,zh=null,r;return(Hc&1)!==0&&r.tag!==0&&To(),x=r.pendingLanes,(x&1)!==0?r===Bh?nl++:(nl=0,Bh=r):nl=0,_s(),null}function To(){if(Cs!==null){var r=di(Hc),o=Bn.transition,u=Ze;try{if(Bn.transition=null,Ze=16>r?16:r,Cs===null)var m=!1;else{if(r=Cs,Cs=null,Hc=0,(tt&6)!==0)throw Error(n(331));var v=tt;for(tt|=4,Ce=r.current;Ce!==null;){var x=Ce,T=x.child;if((Ce.flags&16)!==0){var V=x.deletions;if(V!==null){for(var te=0;te<V.length;te++){var ce=V[te];for(Ce=ce;Ce!==null;){var ye=Ce;switch(ye.tag){case 0:case 11:case 15:Ji(8,ye,x)}var ve=ye.child;if(ve!==null)ve.return=ye,Ce=ve;else for(;Ce!==null;){ye=Ce;var ge=ye.sibling,Ee=ye.return;if(Lx(ye),ye===ce){Ce=null;break}if(ge!==null){ge.return=Ee,Ce=ge;break}Ce=Ee}}}var Te=x.alternate;if(Te!==null){var Me=Te.child;if(Me!==null){Te.child=null;do{var Ct=Me.sibling;Me.sibling=null,Me=Ct}while(Me!==null)}}Ce=x}}if((x.subtreeFlags&2064)!==0&&T!==null)T.return=x,Ce=T;else e:for(;Ce!==null;){if(x=Ce,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Ji(9,x,x.return)}var ae=x.sibling;if(ae!==null){ae.return=x.return,Ce=ae;break e}Ce=x.return}}var ne=r.current;for(Ce=ne;Ce!==null;){T=Ce;var oe=T.child;if((T.subtreeFlags&2064)!==0&&oe!==null)oe.return=T,Ce=oe;else e:for(T=ne;Ce!==null;){if(V=Ce,(V.flags&2048)!==0)try{switch(V.tag){case 0:case 11:case 15:Fc(9,V)}}catch(Ie){Et(V,V.return,Ie)}if(V===T){Ce=null;break e}var xe=V.sibling;if(xe!==null){xe.return=V.return,Ce=xe;break e}Ce=V.return}}if(tt=v,_s(),qt&&typeof qt.onPostCommitFiberRoot=="function")try{qt.onPostCommitFiberRoot(Pr,r)}catch{}m=!0}return m}finally{Ze=u,Bn.transition=o}}return!1}function Jx(r,o,u){o=No(u,o),o=yx(r,o,1),r=Ns(r,o,1),o=an(),r!==null&&(Zs(r,1,o),mn(r,o))}function Et(r,o,u){if(r.tag===3)Jx(r,r,u);else for(;o!==null;){if(o.tag===3){Jx(o,r,u);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(js===null||!js.has(m))){r=No(u,r),r=vx(o,r,1),o=Ns(o,r,1),r=an(),o!==null&&(Zs(o,1,r),mn(o,r));break}}o=o.return}}function sM(r,o,u){var m=r.pingCache;m!==null&&m.delete(o),o=an(),r.pingedLanes|=r.suspendedLanes&u,zt===r&&(Ht&u)===u&&(Lt===4||Lt===3&&(Ht&130023424)===Ht&&500>dt()-Fh?ba(r,0):qh|=u),mn(r,o)}function eb(r,o){o===0&&((r.mode&1)===0?o=1:(o=St,St<<=1,(St&130023424)===0&&(St=4194304)));var u=an();r=Xr(r,o),r!==null&&(Zs(r,o,u),mn(r,u))}function aM(r){var o=r.memoizedState,u=0;o!==null&&(u=o.retryLane),eb(r,u)}function oM(r,o){var u=0;switch(r.tag){case 13:var m=r.stateNode,v=r.memoizedState;v!==null&&(u=v.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),eb(r,u)}var tb;tb=function(r,o,u){if(r!==null)if(r.memoizedProps!==o.pendingProps||dn.current)fn=!0;else{if((r.lanes&u)===0&&(o.flags&128)===0)return fn=!1,VA(r,o,u);fn=(r.flags&131072)!==0}else fn=!1,gt&&(o.flags&1048576)!==0&&$0(o,_c,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;Dc(r,o),r=o.pendingProps;var v=yo(o,Xt.current);_o(o,u),v=yh(null,o,m,r,v,u);var x=vh();return o.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,hn(m)?(x=!0,xc(o)):x=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,uh(o),v.updater=Pc,o.stateNode=v,v._reactInternals=o,Sh(o,m,r,u),o=Ch(null,o,m,!0,x,u)):(o.tag=0,gt&&x&&eh(o),sn(null,o,v,u),o=o.child),o;case 16:m=o.elementType;e:{switch(Dc(r,o),r=o.pendingProps,v=m._init,m=v(m._payload),o.type=m,v=o.tag=lM(m),r=tr(m,r),v){case 0:o=jh(null,o,m,r,u);break e;case 1:o=jx(null,o,m,r,u);break e;case 11:o=kx(null,o,m,r,u);break e;case 14:o=_x(null,o,m,tr(m.type,r),u);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:tr(m,v),jh(r,o,m,v,u);case 1:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:tr(m,v),jx(r,o,m,v,u);case 3:e:{if(Cx(o),r===null)throw Error(n(387));m=o.pendingProps,x=o.memoizedState,v=x.element,U0(r,o),Tc(o,m,null,u);var T=o.memoizedState;if(m=T.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){v=No(Error(n(423)),o),o=Tx(r,o,m,u,v);break e}else if(m!==v){v=No(Error(n(424)),o),o=Tx(r,o,m,u,v);break e}else for(Cn=xs(o.stateNode.containerInfo.firstChild),jn=o,gt=!0,er=null,u=z0(o,null,m,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(xo(),m===v){o=Zr(r,o,u);break e}sn(r,o,m,u)}o=o.child}return o;case 5:return G0(o),r===null&&rh(o),m=o.type,v=o.pendingProps,x=r!==null?r.memoizedProps:null,T=v.children,Yd(m,v)?T=null:x!==null&&Yd(m,x)&&(o.flags|=32),Ex(r,o),sn(r,o,T,u),o.child;case 6:return r===null&&rh(o),null;case 13:return Rx(r,o,u);case 4:return dh(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=bo(o,null,m,u):sn(r,o,m,u),o.child;case 11:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:tr(m,v),kx(r,o,m,v,u);case 7:return sn(r,o,o.pendingProps,u),o.child;case 8:return sn(r,o,o.pendingProps.children,u),o.child;case 12:return sn(r,o,o.pendingProps.children,u),o.child;case 10:e:{if(m=o.type._context,v=o.pendingProps,x=o.memoizedProps,T=v.value,ht(Ec,m._currentValue),m._currentValue=T,x!==null)if(Nn(x.value,T)){if(x.children===v.children&&!dn.current){o=Zr(r,o,u);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var V=x.dependencies;if(V!==null){T=x.child;for(var te=V.firstContext;te!==null;){if(te.context===m){if(x.tag===1){te=Qr(-1,u&-u),te.tag=2;var ce=x.updateQueue;if(ce!==null){ce=ce.shared;var ye=ce.pending;ye===null?te.next=te:(te.next=ye.next,ye.next=te),ce.pending=te}}x.lanes|=u,te=x.alternate,te!==null&&(te.lanes|=u),lh(x.return,u,o),V.lanes|=u;break}te=te.next}}else if(x.tag===10)T=x.type===o.type?null:x.child;else if(x.tag===18){if(T=x.return,T===null)throw Error(n(341));T.lanes|=u,V=T.alternate,V!==null&&(V.lanes|=u),lh(T,u,o),T=x.sibling}else T=x.child;if(T!==null)T.return=x;else for(T=x;T!==null;){if(T===o){T=null;break}if(x=T.sibling,x!==null){x.return=T.return,T=x;break}T=T.return}x=T}sn(r,o,v.children,u),o=o.child}return o;case 9:return v=o.type,m=o.pendingProps.children,_o(o,u),v=Fn(v),m=m(v),o.flags|=1,sn(r,o,m,u),o.child;case 14:return m=o.type,v=tr(m,o.pendingProps),v=tr(m.type,v),_x(r,o,m,v,u);case 15:return Sx(r,o,o.type,o.pendingProps,u);case 17:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:tr(m,v),Dc(r,o),o.tag=1,hn(m)?(r=!0,xc(o)):r=!1,_o(o,u),mx(o,m,v),Sh(o,m,v,u),Ch(null,o,m,!0,r,u);case 19:return Mx(r,o,u);case 22:return Nx(r,o,u)}throw Error(n(156,o.tag))};function nb(r,o){return Wa(r,o)}function iM(r,o,u,m){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=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Un(r,o,u,m){return new iM(r,o,u,m)}function Yh(r){return r=r.prototype,!(!r||!r.isReactComponent)}function lM(r){if(typeof r=="function")return Yh(r)?1:0;if(r!=null){if(r=r.$$typeof,r===H)return 11;if(r===Z)return 14}return 2}function As(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 Kc(r,o,u,m,v,x){var T=2;if(m=r,typeof r=="function")Yh(r)&&(T=1);else if(typeof r=="string")T=5;else e:switch(r){case I:return _a(u.children,v,x,o);case z:T=8,v|=8;break;case O:return r=Un(12,u,o,v|2),r.elementType=O,r.lanes=x,r;case X:return r=Un(13,u,o,v),r.elementType=X,r.lanes=x,r;case R:return r=Un(19,u,o,v),r.elementType=R,r.lanes=x,r;case Q:return Xc(u,v,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:T=10;break e;case D:T=9;break e;case H:T=11;break e;case Z:T=14;break e;case B:T=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Un(T,u,o,v),o.elementType=r,o.type=m,o.lanes=x,o}function _a(r,o,u,m){return r=Un(7,r,m,o),r.lanes=u,r}function Xc(r,o,u,m){return r=Un(22,r,m,o),r.elementType=Q,r.lanes=u,r.stateNode={isHidden:!1},r}function Kh(r,o,u){return r=Un(6,r,null,o),r.lanes=u,r}function Xh(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 cM(r,o,u,m,v){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ui(0),this.expirationTimes=ui(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ui(0),this.identifierPrefix=m,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Qh(r,o,u,m,v,x,T,V,te){return r=new cM(r,o,u,V,te),o===1?(o=1,x===!0&&(o|=8)):o=0,x=Un(3,null,null,o),r.current=x,x.stateNode=r,x.memoizedState={element:m,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},uh(x),r}function uM(r,o,u){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:$,key:m==null?null:""+m,children:r,containerInfo:o,implementation:u}}function rb(r){if(!r)return ks;r=r._reactInternals;e:{if($n(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(hn(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(hn(u))return A0(r,u,o)}return o}function sb(r,o,u,m,v,x,T,V,te){return r=Qh(u,m,!0,r,v,x,T,V,te),r.context=rb(null),u=r.current,m=an(),v=Ts(u),x=Qr(m,v),x.callback=o??null,Ns(u,x,v),r.current.lanes=v,Zs(r,v,m),mn(r,m),r}function Qc(r,o,u,m){var v=o.current,x=an(),T=Ts(v);return u=rb(u),o.context===null?o.context=u:o.pendingContext=u,o=Qr(x,T),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=Ns(v,o,T),r!==null&&(sr(r,v,T,x),Cc(r,v,T)),T}function Zc(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 Zh(r,o){ab(r,o),(r=r.alternate)&&ab(r,o)}function dM(){return null}var ob=typeof reportError=="function"?reportError:function(r){console.error(r)};function Jh(r){this._internalRoot=r}Jc.prototype.render=Jh.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Qc(r,o,null,null)},Jc.prototype.unmount=Jh.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;xa(function(){Qc(null,r,null,null)}),o[Gr]=null}};function Jc(r){this._internalRoot=r}Jc.prototype.unstable_scheduleHydration=function(r){if(r){var o=fi();r={blockedOn:null,target:r,priority:o};for(var u=0;u<ln.length&&o!==0&&o<ln[u].priority;u++);ln.splice(u,0,r),u===0&&Jl(r)}};function ef(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function eu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function ib(){}function hM(r,o,u,m,v){if(v){if(typeof m=="function"){var x=m;m=function(){var ce=Zc(T);x.call(ce)}}var T=sb(o,m,r,0,null,!1,!1,"",ib);return r._reactRootContainer=T,r[Gr]=T.current,mt(r.nodeType===8?r.parentNode:r),xa(),T}for(;v=r.lastChild;)r.removeChild(v);if(typeof m=="function"){var V=m;m=function(){var ce=Zc(te);V.call(ce)}}var te=Qh(r,0,!1,null,null,!1,!1,"",ib);return r._reactRootContainer=te,r[Gr]=te.current,mt(r.nodeType===8?r.parentNode:r),xa(function(){Qc(o,te,u,m)}),te}function tu(r,o,u,m,v){var x=u._reactRootContainer;if(x){var T=x;if(typeof v=="function"){var V=v;v=function(){var te=Zc(T);V.call(te)}}Qc(o,T,r,v)}else T=hM(u,o,r,v,m);return Zc(T)}hi=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var u=Xs(o.pendingLanes);u!==0&&(Ka(o,u|1),mn(o,dt()),(tt&6)===0&&(Co=dt()+500,_s()))}break;case 13:xa(function(){var m=Xr(r,1);if(m!==null){var v=an();sr(m,r,1,v)}}),Zh(r,1)}},us=function(r){if(r.tag===13){var o=Xr(r,134217728);if(o!==null){var u=an();sr(o,r,134217728,u)}Zh(r,134217728)}},Xa=function(r){if(r.tag===13){var o=Ts(r),u=Xr(r,o);if(u!==null){var m=an();sr(u,r,o,m)}Zh(r,o)}},fi=function(){return Ze},pi=function(r,o){var u=Ze;try{return Ze=r,o()}finally{Ze=u}},xt=function(r,o,u){switch(o){case"input":if(be(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 m=u[o];if(m!==r&&m.form===r.form){var v=vc(m);if(!v)throw Error(n(90));Ve(m),be(m,v)}}}break;case"textarea":pe(r,u);break;case"select":o=u.value,o!=null&&ut(r,!!u.multiple,o,!1)}},Fa=Hh,wn=xa;var fM={usingClientEntryPoint:!1,Events:[Ui,mo,vc,Da,qa,Hh]},rl={findFiberByHostInstance:ha,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},pM={bundleType:rl.bundleType,version:rl.version,rendererPackageName:rl.rendererPackageName,rendererConfig:rl.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=Ir(r),r===null?null:r.stateNode},findFiberByHostInstance:rl.findFiberByHostInstance||dM,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 nu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nu.isDisabled&&nu.supportsFiber)try{Pr=nu.inject(pM),qt=nu}catch{}}return gn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=fM,gn.createPortal=function(r,o){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ef(o))throw Error(n(200));return uM(r,o,null,u)},gn.createRoot=function(r,o){if(!ef(r))throw Error(n(299));var u=!1,m="",v=ob;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=Qh(r,1,!1,null,null,u,!1,m,v),r[Gr]=o.current,mt(r.nodeType===8?r.parentNode:r),new Jh(o)},gn.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=Ir(o),r=r===null?null:r.stateNode,r},gn.flushSync=function(r){return xa(r)},gn.hydrate=function(r,o,u){if(!eu(o))throw Error(n(200));return tu(null,r,o,!0,u)},gn.hydrateRoot=function(r,o,u){if(!ef(r))throw Error(n(405));var m=u!=null&&u.hydratedSources||null,v=!1,x="",T=ob;if(u!=null&&(u.unstable_strictMode===!0&&(v=!0),u.identifierPrefix!==void 0&&(x=u.identifierPrefix),u.onRecoverableError!==void 0&&(T=u.onRecoverableError)),o=sb(o,null,r,1,u??null,v,!1,x,T),r[Gr]=o.current,mt(r),m)for(r=0;r<m.length;r++)u=m[r],v=u._getVersion,v=v(u._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[u,v]:o.mutableSourceEagerHydrationData.push(u,v);return new Jc(o)},gn.render=function(r,o,u){if(!eu(o))throw Error(n(200));return tu(null,r,o,!1,u)},gn.unmountComponentAtNode=function(r){if(!eu(r))throw Error(n(40));return r._reactRootContainer?(xa(function(){tu(null,null,r,!1,function(){r._reactRootContainer=null,r[Gr]=null})}),!0):!1},gn.unstable_batchedUpdates=Hh,gn.unstable_renderSubtreeIntoContainer=function(r,o,u,m){if(!eu(u))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return tu(r,o,u,!1,m)},gn.version="18.3.1-next-f1338f8080-20240426",gn}var mb;function Jj(){if(mb)return rf.exports;mb=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(),rf.exports=bM(),rf.exports}var gb;function kM(){if(gb)return su;gb=1;var e=Jj();return su.createRoot=e.createRoot,su.hydrateRoot=e.hydrateRoot,su}var _M=kM(),b=$l();const he=Ew(b);function Vt(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=Vt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var of={exports:{}},lf={},cf={exports:{}},uf={};/**
|
|
41
41
|
* @license React
|
|
42
42
|
* use-sync-external-store-shim.production.js
|
|
43
43
|
*
|
|
@@ -45,7 +45,7 @@ Error generating stack: `+x.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 yb;function SM(){if(yb)return uf;yb=1;var e=$l();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,a=e.useEffect,i=e.useLayoutEffect,l=e.useDebugValue;function d(g,y){var w=y(),N=s({inst:{value:w,getSnapshot:y}}),k=N[0].inst,E=N[1];return i(function(){k.value=w,k.getSnapshot=y,f(k)&&E({inst:k})},[g,w,y]),a(function(){return f(k)&&E({inst:k}),g(function(){f(k)&&E({inst:k})})},[g]),l(w),w}function f(g){var y=g.getSnapshot;g=g.value;try{var w=y();return!n(g,w)}catch{return!0}}function p(g,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:d;return uf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,uf}var vb;function NM(){return vb||(vb=1,cf.exports=SM()),cf.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: `+x.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 vb;function NM(){if(vb)return lf;vb=1;var e=$l(),t=SM();function n(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var s=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,i=e.useRef,l=e.useEffect,d=e.useMemo,f=e.useDebugValue;return lf.useSyncExternalStoreWithSelector=function(p,h,g,y,w){var N=i(null);if(N.current===null){var k={hasValue:!1,value:null};N.current=k}else k=N.current;N=d(function(){function _($){if(!S){if(S=!0,j=$,$=y($),w!==void 0&&k.hasValue){var I=k.value;if(w(I,$))return C=I}return C=$}if(I=C,s(j,$))return I;var z=y($);return w!==void 0&&w(I,z)?(j=$,I):(j=$,C=z)}var S=!1,j,C,M=g===void 0?null:g;return[function(){return _(h())},M===null?void 0:function(){return _(M())}]},[h,g,y,w]);var E=a(p,N[0],N[1]);return l(function(){k.hasValue=!0,k.value=E},[E]),f(E),E},lf}var wb;function EM(){return wb||(wb=1,of.exports=NM()),of.exports}var jM=EM();const CM=Ew(jM),TM={},xb=e=>{let t;const n=new Set,s=(h,g)=>{const y=typeof h=="function"?h(t):h;if(!Object.is(y,t)){const w=t;t=g??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(N=>N(t,w))}},a=()=>t,f={setState:s,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(TM?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=t=e(s,a,f);return f},RM=e=>e?xb(e):xb,{useDebugValue:AM}=he,{useSyncExternalStoreWithSelector:MM}=CM,IM=e=>e;function Jj(e,t=IM,n){const s=MM(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return AM(s),s}const bb=(e,t)=>{const n=RM(e),s=(a,i=t)=>Jj(n,a,i);return Object.assign(s,n),s},$M=(e,t)=>e?bb(e,t):bb;function Dt(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 OM={value:()=>{}};function Ju(){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 Eu(n)}function Eu(e){this._=e}function PM(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}})}Eu.prototype=Ju.prototype={constructor:Eu,on:function(e,t){var n=this._,s=PM(e+"",n),a,i=-1,l=s.length;if(arguments.length<2){for(;++i<l;)if((a=(e=s[i]).type)&&(a=LM(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<l;)if(a=(e=s[i]).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 Eu(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),s=0,a,i;s<a;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],s=0,a=i.length;s<a;++s)i[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],a=0,i=s.length;a<i;++a)s[a].value.apply(t,n)}};function LM(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]=OM,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var Vv="http://www.w3.org/1999/xhtml";const _b={svg:"http://www.w3.org/2000/svg",xhtml:Vv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ed(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),_b.hasOwnProperty(t)?{space:_b[t],local:e}:e}function DM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Vv&&t.documentElement.namespaceURI===Vv?t.createElement(e):t.createElementNS(n,e)}}function qM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function eC(e){var t=ed(e);return(t.local?qM:DM)(t)}function FM(){}function jw(e){return e==null?FM:function(){return this.querySelector(e)}}function zM(e){typeof e!="function"&&(e=jw(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],l=i.length,d=s[a]=new Array(l),f,p,h=0;h<l;++h)(f=i[h])&&(p=e.call(f,f.__data__,h,i))&&("__data__"in f&&(p.__data__=f.__data__),d[h]=p);return new Mn(s,this._parents)}function BM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function UM(){return[]}function tC(e){return e==null?UM:function(){return this.querySelectorAll(e)}}function WM(e){return function(){return BM(e.apply(this,arguments))}}function HM(e){typeof e=="function"?e=WM(e):e=tC(e);for(var t=this._groups,n=t.length,s=[],a=[],i=0;i<n;++i)for(var l=t[i],d=l.length,f,p=0;p<d;++p)(f=l[p])&&(s.push(e.call(f,f.__data__,p,l)),a.push(f));return new Mn(s,a)}function nC(e){return function(){return this.matches(e)}}function rC(e){return function(t){return t.matches(e)}}var GM=Array.prototype.find;function VM(e){return function(){return GM.call(this.children,e)}}function YM(){return this.firstElementChild}function KM(e){return this.select(e==null?YM:VM(typeof e=="function"?e:rC(e)))}var XM=Array.prototype.filter;function QM(){return Array.from(this.children)}function ZM(e){return function(){return XM.call(this.children,e)}}function JM(e){return this.selectAll(e==null?QM:ZM(typeof e=="function"?e:rC(e)))}function e2(e){typeof e!="function"&&(e=nC(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],l=i.length,d=s[a]=[],f,p=0;p<l;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&d.push(f);return new Mn(s,this._parents)}function sC(e){return new Array(e.length)}function t2(){return new Mn(this._enter||this._groups.map(sC),this._parents)}function $u(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}$u.prototype={constructor:$u,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 n2(e){return function(){return e}}function r2(e,t,n,s,a,i){for(var l=0,d,f=t.length,p=i.length;l<p;++l)(d=t[l])?(d.__data__=i[l],s[l]=d):n[l]=new $u(e,i[l]);for(;l<f;++l)(d=t[l])&&(a[l]=d)}function s2(e,t,n,s,a,i,l){var d,f,p=new Map,h=t.length,g=i.length,y=new Array(h),w;for(d=0;d<h;++d)(f=t[d])&&(y[d]=w=l.call(f,f.__data__,d,t)+"",p.has(w)?a[d]=f:p.set(w,f));for(d=0;d<g;++d)w=l.call(e,i[d],d,i)+"",(f=p.get(w))?(s[d]=f,f.__data__=i[d],p.delete(w)):n[d]=new $u(e,i[d]);for(d=0;d<h;++d)(f=t[d])&&p.get(y[d])===f&&(a[d]=f)}function a2(e){return e.__data__}function o2(e,t){if(!arguments.length)return Array.from(this,a2);var n=t?s2:r2,s=this._parents,a=this._groups;typeof e!="function"&&(e=n2(e));for(var i=a.length,l=new Array(i),d=new Array(i),f=new Array(i),p=0;p<i;++p){var h=s[p],g=a[p],y=g.length,w=i2(e.call(h,h&&h.__data__,p,s)),N=w.length,k=d[p]=new Array(N),E=l[p]=new Array(N),_=f[p]=new Array(y);n(h,g,k,E,_,w,t);for(var S=0,j=0,C,M;S<N;++S)if(C=k[S]){for(S>=j&&(j=S+1);!(M=E[j])&&++j<N;);C._next=M||null}}return l=new Mn(l,s),l._enter=d,l._exit=f,l}function i2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function l2(){return new Mn(this._exit||this._groups.map(sC),this._parents)}function c2(e,t,n){var s=this.enter(),a=this,i=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?i.remove():n(i),s&&a?s.merge(a).order():a}function u2(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,a=n.length,i=s.length,l=Math.min(a,i),d=new Array(a),f=0;f<l;++f)for(var p=n[f],h=s[f],g=p.length,y=d[f]=new Array(g),w,N=0;N<g;++N)(w=p[N]||h[N])&&(y[N]=w);for(;f<a;++f)d[f]=n[f];return new Mn(d,this._parents)}function d2(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],a=s.length-1,i=s[a],l;--a>=0;)(l=s[a])&&(i&&l.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(l,i),i=l);return this}function h2(e){e||(e=f2);function t(g,y){return g&&y?e(g.__data__,y.__data__):!g-!y}for(var n=this._groups,s=n.length,a=new Array(s),i=0;i<s;++i){for(var l=n[i],d=l.length,f=a[i]=new Array(d),p,h=0;h<d;++h)(p=l[h])&&(f[h]=p);f.sort(t)}return new Mn(a,this._parents).order()}function f2(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function p2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function m2(){return Array.from(this)}function g2(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,i=s.length;a<i;++a){var l=s[a];if(l)return l}return null}function y2(){let e=0;for(const t of this)++e;return e}function v2(){return!this.node()}function w2(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var a=t[n],i=0,l=a.length,d;i<l;++i)(d=a[i])&&e.call(d,d.__data__,i,a);return this}function x2(e){return function(){this.removeAttribute(e)}}function b2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function k2(e,t){return function(){this.setAttribute(e,t)}}function _2(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function S2(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function N2(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 E2(e,t){var n=ed(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?b2:x2:typeof t=="function"?n.local?N2:S2:n.local?_2:k2)(n,t))}function aC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function j2(e){return function(){this.style.removeProperty(e)}}function C2(e,t,n){return function(){this.style.setProperty(e,t,n)}}function T2(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function R2(e,t,n){return arguments.length>1?this.each((t==null?j2:typeof t=="function"?T2:C2)(e,t,n??"")):Go(this.node(),e)}function Go(e,t){return e.style.getPropertyValue(t)||aC(e).getComputedStyle(e,null).getPropertyValue(t)}function A2(e){return function(){delete this[e]}}function M2(e,t){return function(){this[e]=t}}function I2(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function $2(e,t){return arguments.length>1?this.each((t==null?A2:typeof t=="function"?I2:M2)(e,t)):this.node()[e]}function oC(e){return e.trim().split(/^|\s+/)}function Cw(e){return e.classList||new iC(e)}function iC(e){this._node=e,this._names=oC(e.getAttribute("class")||"")}iC.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 lC(e,t){for(var n=Cw(e),s=-1,a=t.length;++s<a;)n.add(t[s])}function cC(e,t){for(var n=Cw(e),s=-1,a=t.length;++s<a;)n.remove(t[s])}function O2(e){return function(){lC(this,e)}}function P2(e){return function(){cC(this,e)}}function L2(e,t){return function(){(t.apply(this,arguments)?lC:cC)(this,e)}}function D2(e,t){var n=oC(e+"");if(arguments.length<2){for(var s=Cw(this.node()),a=-1,i=n.length;++a<i;)if(!s.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?L2:t?O2:P2)(n,t))}function q2(){this.textContent=""}function F2(e){return function(){this.textContent=e}}function z2(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function B2(e){return arguments.length?this.each(e==null?q2:(typeof e=="function"?z2:F2)(e)):this.node().textContent}function U2(){this.innerHTML=""}function W2(e){return function(){this.innerHTML=e}}function H2(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function G2(e){return arguments.length?this.each(e==null?U2:(typeof e=="function"?H2:W2)(e)):this.node().innerHTML}function V2(){this.nextSibling&&this.parentNode.appendChild(this)}function Y2(){return this.each(V2)}function K2(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function X2(){return this.each(K2)}function Q2(e){var t=typeof e=="function"?e:eC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Z2(){return null}function J2(e,t){var n=typeof e=="function"?e:eC(e),s=t==null?Z2:typeof t=="function"?t:jw(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function eI(){var e=this.parentNode;e&&e.removeChild(this)}function tI(){return this.each(eI)}function nI(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rI(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function sI(e){return this.select(e?rI:nI)}function aI(e){return arguments.length?this.property("__data__",e):this.node().__data__}function oI(e){return function(t){e.call(this,t,this.__data__)}}function iI(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 lI(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,a=t.length,i;n<a;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++s]=i;++s?t.length=s:delete this.__on}}}function cI(e,t,n){return function(){var s=this.__on,a,i=oI(t);if(s){for(var l=0,d=s.length;l<d;++l)if((a=s[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=i,a.options=n),a.value=t;return}}this.addEventListener(e.type,i,n),a={type:e.type,name:e.name,value:t,listener:i,options:n},s?s.push(a):this.__on=[a]}}function uI(e,t,n){var s=iI(e+""),a,i=s.length,l;if(arguments.length<2){var d=this.node().__on;if(d){for(var f=0,p=d.length,h;f<p;++f)for(a=0,h=d[f];a<i;++a)if((l=s[a]).type===h.type&&l.name===h.name)return h.value}return}for(d=t?cI:lI,a=0;a<i;++a)this.each(d(s[a],t,n));return this}function uC(e,t,n){var s=aC(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 dI(e,t){return function(){return uC(this,e,t)}}function hI(e,t){return function(){return uC(this,e,t.apply(this,arguments))}}function fI(e,t){return this.each((typeof t=="function"?hI:dI)(e,t))}function*pI(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,i=s.length,l;a<i;++a)(l=s[a])&&(yield l)}var dC=[null];function Mn(e,t){this._groups=e,this._parents=t}function Ol(){return new Mn([[document.documentElement]],dC)}function mI(){return this}Mn.prototype=Ol.prototype={constructor:Mn,select:zM,selectAll:HM,selectChild:KM,selectChildren:JM,filter:e2,data:o2,enter:t2,exit:l2,join:c2,merge:u2,selection:mI,order:d2,sort:h2,call:p2,nodes:m2,node:g2,size:y2,empty:v2,each:w2,attr:E2,style:R2,property:$2,classed:D2,text:B2,html:G2,raise:Y2,lower:X2,append:Q2,insert:J2,remove:tI,clone:sI,datum:aI,on:uI,dispatch:fI,[Symbol.iterator]:pI};function Hn(e){return typeof e=="string"?new Mn([[document.querySelector(e)]],[document.documentElement]):new Mn([[e]],dC)}function gI(e){let t;for(;t=e.sourceEvent;)e=t;return e}function or(e,t){if(e=gI(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 yI={passive:!1},bl={capture:!0,passive:!1};function df(e){e.stopImmediatePropagation()}function zo(e){e.preventDefault(),e.stopImmediatePropagation()}function hC(e){var t=e.document.documentElement,n=Hn(e).on("dragstart.drag",zo,bl);"onselectstart"in t?n.on("selectstart.drag",zo,bl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function fC(e,t){var n=e.document.documentElement,s=Hn(e).on("dragstart.drag",null);t&&(s.on("click.drag",zo,bl),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 au=e=>()=>e;function Yv(e,{sourceEvent:t,subject:n,target:s,identifier:a,active:i,x:l,y:d,dx:f,dy:p,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:d,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:h}})}Yv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function vI(e){return!e.ctrlKey&&!e.button}function wI(){return this.parentNode}function xI(e,t){return t??{x:e.x,y:e.y}}function bI(){return navigator.maxTouchPoints||"ontouchstart"in this}function kI(){var e=vI,t=wI,n=xI,s=bI,a={},i=Ju("start","drag","end"),l=0,d,f,p,h,g=0;function y(C){C.on("mousedown.drag",w).filter(s).on("touchstart.drag",E).on("touchmove.drag",_,yI).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,M){if(!(h||!e.call(this,C,M))){var $=j(this,t.call(this,C,M),C,M,"mouse");$&&(Hn(C.view).on("mousemove.drag",N,bl).on("mouseup.drag",k,bl),hC(C.view),df(C),p=!1,d=C.clientX,f=C.clientY,$("start",C))}}function N(C){if(zo(C),!p){var M=C.clientX-d,$=C.clientY-f;p=M*M+$*$>g}a.mouse("drag",C)}function k(C){Hn(C.view).on("mousemove.drag mouseup.drag",null),fC(C.view,p),zo(C),a.mouse("end",C)}function E(C,M){if(e.call(this,C,M)){var $=C.changedTouches,I=t.call(this,C,M),z=$.length,O,A;for(O=0;O<z;++O)(A=j(this,I,C,M,$[O].identifier,$[O]))&&(df(C),A("start",C,$[O]))}}function _(C){var M=C.changedTouches,$=M.length,I,z;for(I=0;I<$;++I)(z=a[M[I].identifier])&&(zo(C),z("drag",C,M[I]))}function S(C){var M=C.changedTouches,$=M.length,I,z;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),I=0;I<$;++I)(z=a[M[I].identifier])&&(df(C),z("end",C,M[I]))}function j(C,M,$,I,z,O){var A=i.copy(),D=or(O||$,M),H,X,R;if((R=n.call(C,new Yv("beforestart",{sourceEvent:$,target:y,identifier:z,active:l,x:D[0],y:D[1],dx:0,dy:0,dispatch:A}),I))!=null)return H=R.x-D[0]||0,X=R.y-D[1]||0,function Z(B,Q,P){var F=D,J;switch(B){case"start":a[z]=Z,J=l++;break;case"end":delete a[z],--l;case"drag":D=or(P||Q,M),J=l;break}A.call(B,C,new Yv(B,{sourceEvent:Q,subject:R,target:y,identifier:z,active:J,x:D[0]+H,y:D[1]+X,dx:D[0]-F[0],dy:D[1]-F[1],dispatch:A}),I)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:au(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:au(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:au(C),y):n},y.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:au(!!C),y):s},y.on=function(){var C=i.on.apply(i,arguments);return C===i?y:C},y.clickDistance=function(C){return arguments.length?(g=(C=+C)*C,y):Math.sqrt(g)},y}function Tw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function pC(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Pl(){}var kl=.7,Ou=1/kl,Bo="\\s*([+-]?\\d+)\\s*",_l="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",jr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_I=/^#([0-9a-f]{3,8})$/,SI=new RegExp(`^rgb\\(${Bo},${Bo},${Bo}\\)$`),NI=new RegExp(`^rgb\\(${jr},${jr},${jr}\\)$`),EI=new RegExp(`^rgba\\(${Bo},${Bo},${Bo},${_l}\\)$`),jI=new RegExp(`^rgba\\(${jr},${jr},${jr},${_l}\\)$`),CI=new RegExp(`^hsl\\(${_l},${jr},${jr}\\)$`),TI=new RegExp(`^hsla\\(${_l},${jr},${jr},${_l}\\)$`),Sb={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};Tw(Pl,Sl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Nb,formatHex:Nb,formatHex8:RI,formatHsl:AI,formatRgb:Eb,toString:Eb});function Nb(){return this.rgb().formatHex()}function RI(){return this.rgb().formatHex8()}function AI(){return mC(this).formatHsl()}function Eb(){return this.rgb().formatRgb()}function Sl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_I.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?jb(t):n===3?new yn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ou(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ou(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=SI.exec(e))?new yn(t[1],t[2],t[3],1):(t=NI.exec(e))?new yn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=EI.exec(e))?ou(t[1],t[2],t[3],t[4]):(t=jI.exec(e))?ou(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=CI.exec(e))?Rb(t[1],t[2]/100,t[3]/100,1):(t=TI.exec(e))?Rb(t[1],t[2]/100,t[3]/100,t[4]):Sb.hasOwnProperty(e)?jb(Sb[e]):e==="transparent"?new yn(NaN,NaN,NaN,0):null}function jb(e){return new yn(e>>16&255,e>>8&255,e&255,1)}function ou(e,t,n,s){return s<=0&&(e=t=n=NaN),new yn(e,t,n,s)}function MI(e){return e instanceof Pl||(e=Sl(e)),e?(e=e.rgb(),new yn(e.r,e.g,e.b,e.opacity)):new yn}function Kv(e,t,n,s){return arguments.length===1?MI(e):new yn(e,t,n,s??1)}function yn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}Tw(yn,Kv,pC(Pl,{brighter(e){return e=e==null?Ou:Math.pow(Ou,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?kl:Math.pow(kl,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yn(Ta(this.r),Ta(this.g),Ta(this.b),Pu(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:Cb,formatHex:Cb,formatHex8:II,formatRgb:Tb,toString:Tb}));function Cb(){return`#${ja(this.r)}${ja(this.g)}${ja(this.b)}`}function II(){return`#${ja(this.r)}${ja(this.g)}${ja(this.b)}${ja((isNaN(this.opacity)?1:this.opacity)*255)}`}function Tb(){const e=Pu(this.opacity);return`${e===1?"rgb(":"rgba("}${Ta(this.r)}, ${Ta(this.g)}, ${Ta(this.b)}${e===1?")":`, ${e})`}`}function Pu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ta(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ja(e){return e=Ta(e),(e<16?"0":"")+e.toString(16)}function Rb(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ir(e,t,n,s)}function mC(e){if(e instanceof ir)return new ir(e.h,e.s,e.l,e.opacity);if(e instanceof Pl||(e=Sl(e)),!e)return new ir;if(e instanceof ir)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,a=Math.min(t,n,s),i=Math.max(t,n,s),l=NaN,d=i-a,f=(i+a)/2;return d?(t===i?l=(n-s)/d+(n<s)*6:n===i?l=(s-t)/d+2:l=(t-n)/d+4,d/=f<.5?i+a:2-i-a,l*=60):d=f>0&&f<1?0:l,new ir(l,d,f,e.opacity)}function $I(e,t,n,s){return arguments.length===1?mC(e):new ir(e,t,n,s??1)}function ir(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}Tw(ir,$I,pC(Pl,{brighter(e){return e=e==null?Ou:Math.pow(Ou,e),new ir(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?kl:Math.pow(kl,e),new ir(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 yn(hf(e>=240?e-240:e+120,a,s),hf(e,a,s),hf(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new ir(Ab(this.h),iu(this.s),iu(this.l),Pu(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=Pu(this.opacity);return`${e===1?"hsl(":"hsla("}${Ab(this.h)}, ${iu(this.s)*100}%, ${iu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ab(e){return e=(e||0)%360,e<0?e+360:e}function iu(e){return Math.max(0,Math.min(1,e||0))}function hf(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 gC=e=>()=>e;function OI(e,t){return function(n){return e+n*t}}function PI(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 LI(e){return(e=+e)==1?yC:function(t,n){return n-t?PI(t,n,e):gC(isNaN(t)?n:t)}}function yC(e,t){var n=t-e;return n?OI(e,n):gC(isNaN(e)?t:e)}const Mb=(function e(t){var n=LI(t);function s(a,i){var l=n((a=Kv(a)).r,(i=Kv(i)).r),d=n(a.g,i.g),f=n(a.b,i.b),p=yC(a.opacity,i.opacity);return function(h){return a.r=l(h),a.g=d(h),a.b=f(h),a.opacity=p(h),a+""}}return s.gamma=e,s})(1);function Os(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Xv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ff=new RegExp(Xv.source,"g");function DI(e){return function(){return e}}function qI(e){return function(t){return e(t)+""}}function FI(e,t){var n=Xv.lastIndex=ff.lastIndex=0,s,a,i,l=-1,d=[],f=[];for(e=e+"",t=t+"";(s=Xv.exec(e))&&(a=ff.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),d[l]?d[l]+=i:d[++l]=i),(s=s[0])===(a=a[0])?d[l]?d[l]+=a:d[++l]=a:(d[++l]=null,f.push({i:l,x:Os(s,a)})),n=ff.lastIndex;return n<t.length&&(i=t.slice(n),d[l]?d[l]+=i:d[++l]=i),d.length<2?f[0]?qI(f[0].x):DI(t):(t=f.length,function(p){for(var h=0,g;h<t;++h)d[(g=f[h]).i]=g.x(p);return d.join("")})}var Ib=180/Math.PI,Qv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function vC(e,t,n,s,a,i){var l,d,f;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(f=e*n+t*s)&&(n-=e*f,s-=t*f),(d=Math.sqrt(n*n+s*s))&&(n/=d,s/=d,f/=d),e*s<t*n&&(e=-e,t=-t,f=-f,l=-l),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*Ib,skewX:Math.atan(f)*Ib,scaleX:l,scaleY:d}}var lu;function zI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Qv:vC(t.a,t.b,t.c,t.d,t.e,t.f)}function BI(e){return e==null||(lu||(lu=document.createElementNS("http://www.w3.org/2000/svg","g")),lu.setAttribute("transform",e),!(e=lu.transform.baseVal.consolidate()))?Qv:(e=e.matrix,vC(e.a,e.b,e.c,e.d,e.e,e.f))}function wC(e,t,n,s){function a(p){return p.length?p.pop()+" ":""}function i(p,h,g,y,w,N){if(p!==g||h!==y){var k=w.push("translate(",null,t,null,n);N.push({i:k-4,x:Os(p,g)},{i:k-2,x:Os(h,y)})}else(g||y)&&w.push("translate("+g+t+y+n)}function l(p,h,g,y){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),y.push({i:g.push(a(g)+"rotate(",null,s)-2,x:Os(p,h)})):h&&g.push(a(g)+"rotate("+h+s)}function d(p,h,g,y){p!==h?y.push({i:g.push(a(g)+"skewX(",null,s)-2,x:Os(p,h)}):h&&g.push(a(g)+"skewX("+h+s)}function f(p,h,g,y,w,N){if(p!==g||h!==y){var k=w.push(a(w)+"scale(",null,",",null,")");N.push({i:k-4,x:Os(p,g)},{i:k-2,x:Os(h,y)})}else(g!==1||y!==1)&&w.push(a(w)+"scale("+g+","+y+")")}return function(p,h){var g=[],y=[];return p=e(p),h=e(h),i(p.translateX,p.translateY,h.translateX,h.translateY,g,y),l(p.rotate,h.rotate,g,y),d(p.skewX,h.skewX,g,y),f(p.scaleX,p.scaleY,h.scaleX,h.scaleY,g,y),p=h=null,function(w){for(var N=-1,k=y.length,E;++N<k;)g[(E=y[N]).i]=E.x(w);return g.join("")}}}var UI=wC(zI,"px, ","px)","deg)"),WI=wC(BI,", ",")",")"),HI=1e-12;function $b(e){return((e=Math.exp(e))+1/e)/2}function GI(e){return((e=Math.exp(e))-1/e)/2}function VI(e){return((e=Math.exp(2*e))-1)/(e+1)}const YI=(function e(t,n,s){function a(i,l){var d=i[0],f=i[1],p=i[2],h=l[0],g=l[1],y=l[2],w=h-d,N=g-f,k=w*w+N*N,E,_;if(k<HI)_=Math.log(y/p)/t,E=function(I){return[d+I*w,f+I*N,p*Math.exp(t*I*_)]};else{var S=Math.sqrt(k),j=(y*y-p*p+s*k)/(2*p*n*S),C=(y*y-p*p-s*k)/(2*y*n*S),M=Math.log(Math.sqrt(j*j+1)-j),$=Math.log(Math.sqrt(C*C+1)-C);_=($-M)/t,E=function(I){var z=I*_,O=$b(M),A=p/(n*S)*(O*VI(t*z+M)-GI(M));return[d+A*w,f+A*N,p*O/$b(t*z+M)]}}return E.duration=_*1e3*t/Math.SQRT2,E}return a.rho=function(i){var l=Math.max(.001,+i),d=l*l,f=d*d;return e(l,d,f)},a})(Math.SQRT2,2,4);var Vo=0,pl=0,al=0,xC=1e3,Lu,ml,Du=0,Aa=0,td=0,Nl=typeof performance=="object"&&performance.now?performance:Date,bC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Rw(){return Aa||(bC(KI),Aa=Nl.now()+td)}function KI(){Aa=0}function qu(){this._call=this._time=this._next=null}qu.prototype=kC.prototype={constructor:qu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Rw():+n)+(t==null?0:+t),!this._next&&ml!==this&&(ml?ml._next=this:Lu=this,ml=this),this._call=e,this._time=n,Zv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zv())}};function kC(e,t,n){var s=new qu;return s.restart(e,t,n),s}function XI(){Rw(),++Vo;for(var e=Lu,t;e;)(t=Aa-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Vo}function Ob(){Aa=(Du=Nl.now())+td,Vo=pl=0;try{XI()}finally{Vo=0,ZI(),Aa=0}}function QI(){var e=Nl.now(),t=e-Du;t>xC&&(td-=t,Du=e)}function ZI(){for(var e,t=Lu,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:Lu=n);ml=e,Zv(s)}function Zv(e){if(!Vo){pl&&(pl=clearTimeout(pl));var t=e-Aa;t>24?(e<1/0&&(pl=setTimeout(Ob,e-Nl.now()-td)),al&&(al=clearInterval(al))):(al||(Du=Nl.now(),al=setInterval(QI,xC)),Vo=1,bC(Ob))}}function Pb(e,t,n){var s=new qu;return t=t==null?0:+t,s.restart(a=>{s.stop(),e(a+t)},t,n),s}var JI=Ju("start","end","cancel","interrupt"),e$=[],_C=0,Lb=1,Jv=2,ju=3,Db=4,ew=5,Cu=6;function nd(e,t,n,s,a,i){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;t$(e,n,{name:t,index:s,group:a,on:JI,tween:e$,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:_C})}function Aw(e,t){var n=fr(e,t);if(n.state>_C)throw new Error("too late; already scheduled");return n}function Cr(e,t){var n=fr(e,t);if(n.state>ju)throw new Error("too late; already running");return n}function fr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function t$(e,t,n){var s=e.__transition,a;s[t]=n,n.timer=kC(i,0,n.time);function i(p){n.state=Lb,n.timer.restart(l,n.delay,n.time),n.delay<=p&&l(p-n.delay)}function l(p){var h,g,y,w;if(n.state!==Lb)return f();for(h in s)if(w=s[h],w.name===n.name){if(w.state===ju)return Pb(l);w.state===Db?(w.state=Cu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[h]):+h<t&&(w.state=Cu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[h])}if(Pb(function(){n.state===ju&&(n.state=Db,n.timer.restart(d,n.delay,n.time),d(p))}),n.state=Jv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Jv){for(n.state=ju,a=new Array(y=n.tween.length),h=0,g=-1;h<y;++h)(w=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(a[++g]=w);a.length=g+1}}function d(p){for(var h=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=ew,1),g=-1,y=a.length;++g<y;)a[g].call(e,h);n.state===ew&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=Cu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function Tu(e,t){var n=e.__transition,s,a,i=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((s=n[l]).name!==t){i=!1;continue}a=s.state>Jv&&s.state<ew,s.state=Cu,s.timer.stop(),s.on.call(a?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}i&&delete e.__transition}}function n$(e){return this.each(function(){Tu(this,e)})}function r$(e,t){var n,s;return function(){var a=Cr(this,e),i=a.tween;if(i!==n){s=n=i;for(var l=0,d=s.length;l<d;++l)if(s[l].name===t){s=s.slice(),s.splice(l,1);break}}a.tween=s}}function s$(e,t,n){var s,a;if(typeof n!="function")throw new Error;return function(){var i=Cr(this,e),l=i.tween;if(l!==s){a=(s=l).slice();for(var d={name:t,value:n},f=0,p=a.length;f<p;++f)if(a[f].name===t){a[f]=d;break}f===p&&a.push(d)}i.tween=a}}function a$(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=fr(this.node(),n).tween,a=0,i=s.length,l;a<i;++a)if((l=s[a]).name===e)return l.value;return null}return this.each((t==null?r$:s$)(n,e,t))}function Mw(e,t,n){var s=e._id;return e.each(function(){var a=Cr(this,s);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return fr(a,s).value[t]}}function SC(e,t){var n;return(typeof t=="number"?Os:t instanceof Sl?Mb:(n=Sl(t))?(t=n,Mb):FI)(e,t)}function o$(e){return function(){this.removeAttribute(e)}}function i$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function l$(e,t,n){var s,a=n+"",i;return function(){var l=this.getAttribute(e);return l===a?null:l===s?i:i=t(s=l,n)}}function c$(e,t,n){var s,a=n+"",i;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===s?i:i=t(s=l,n)}}function u$(e,t,n){var s,a,i;return function(){var l,d=n(this),f;return d==null?void this.removeAttribute(e):(l=this.getAttribute(e),f=d+"",l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,d)))}}function d$(e,t,n){var s,a,i;return function(){var l,d=n(this),f;return d==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),f=d+"",l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,d)))}}function h$(e,t){var n=ed(e),s=n==="transform"?WI:SC;return this.attrTween(e,typeof t=="function"?(n.local?d$:u$)(n,s,Mw(this,"attr."+e,t)):t==null?(n.local?i$:o$)(n):(n.local?c$:l$)(n,s,t))}function f$(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function p$(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function m$(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&p$(e,i)),n}return a._value=t,a}function g$(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&f$(e,i)),n}return a._value=t,a}function y$(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=ed(e);return this.tween(n,(s.local?m$:g$)(s,t))}function v$(e,t){return function(){Aw(this,e).delay=+t.apply(this,arguments)}}function w$(e,t){return t=+t,function(){Aw(this,e).delay=t}}function x$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?v$:w$)(t,e)):fr(this.node(),t).delay}function b$(e,t){return function(){Cr(this,e).duration=+t.apply(this,arguments)}}function k$(e,t){return t=+t,function(){Cr(this,e).duration=t}}function _$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?b$:k$)(t,e)):fr(this.node(),t).duration}function S$(e,t){if(typeof t!="function")throw new Error;return function(){Cr(this,e).ease=t}}function N$(e){var t=this._id;return arguments.length?this.each(S$(t,e)):fr(this.node(),t).ease}function E$(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Cr(this,e).ease=n}}function j$(e){if(typeof e!="function")throw new Error;return this.each(E$(this._id,e))}function C$(e){typeof e!="function"&&(e=nC(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],l=i.length,d=s[a]=[],f,p=0;p<l;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&d.push(f);return new rs(s,this._parents,this._name,this._id)}function T$(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,a=n.length,i=Math.min(s,a),l=new Array(s),d=0;d<i;++d)for(var f=t[d],p=n[d],h=f.length,g=l[d]=new Array(h),y,w=0;w<h;++w)(y=f[w]||p[w])&&(g[w]=y);for(;d<s;++d)l[d]=t[d];return new rs(l,this._parents,this._name,this._id)}function R$(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 A$(e,t,n){var s,a,i=R$(t)?Aw:Cr;return function(){var l=i(this,e),d=l.on;d!==s&&(a=(s=d).copy()).on(t,n),l.on=a}}function M$(e,t){var n=this._id;return arguments.length<2?fr(this.node(),n).on.on(e):this.each(A$(n,e,t))}function I$(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function $$(){return this.on("end.remove",I$(this._id))}function O$(e){var t=this._name,n=this._id;typeof e!="function"&&(e=jw(e));for(var s=this._groups,a=s.length,i=new Array(a),l=0;l<a;++l)for(var d=s[l],f=d.length,p=i[l]=new Array(f),h,g,y=0;y<f;++y)(h=d[y])&&(g=e.call(h,h.__data__,y,d))&&("__data__"in h&&(g.__data__=h.__data__),p[y]=g,nd(p[y],t,n,y,p,fr(h,n)));return new rs(i,this._parents,t,n)}function P$(e){var t=this._name,n=this._id;typeof e!="function"&&(e=tC(e));for(var s=this._groups,a=s.length,i=[],l=[],d=0;d<a;++d)for(var f=s[d],p=f.length,h,g=0;g<p;++g)if(h=f[g]){for(var y=e.call(h,h.__data__,g,f),w,N=fr(h,n),k=0,E=y.length;k<E;++k)(w=y[k])&&nd(w,t,n,k,y,N);i.push(y),l.push(h)}return new rs(i,l,t,n)}var L$=Ol.prototype.constructor;function D$(){return new L$(this._groups,this._parents)}function q$(e,t){var n,s,a;return function(){var i=Go(this,e),l=(this.style.removeProperty(e),Go(this,e));return i===l?null:i===n&&l===s?a:a=t(n=i,s=l)}}function NC(e){return function(){this.style.removeProperty(e)}}function F$(e,t,n){var s,a=n+"",i;return function(){var l=Go(this,e);return l===a?null:l===s?i:i=t(s=l,n)}}function z$(e,t,n){var s,a,i;return function(){var l=Go(this,e),d=n(this),f=d+"";return d==null&&(f=d=(this.style.removeProperty(e),Go(this,e))),l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,d))}}function B$(e,t){var n,s,a,i="style."+t,l="end."+i,d;return function(){var f=Cr(this,e),p=f.on,h=f.value[i]==null?d||(d=NC(t)):void 0;(p!==n||a!==h)&&(s=(n=p).copy()).on(l,a=h),f.on=s}}function U$(e,t,n){var s=(e+="")=="transform"?UI:SC;return t==null?this.styleTween(e,q$(e,s)).on("end.style."+e,NC(e)):typeof t=="function"?this.styleTween(e,z$(e,s,Mw(this,"style."+e,t))).each(B$(this._id,e)):this.styleTween(e,F$(e,s,t),n).on("end.style."+e,null)}function W$(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function H$(e,t,n){var s,a;function i(){var l=t.apply(this,arguments);return l!==a&&(s=(a=l)&&W$(e,l,n)),s}return i._value=t,i}function G$(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,H$(e,t,n??""))}function V$(e){return function(){this.textContent=e}}function Y$(e){return function(){var t=e(this);this.textContent=t??""}}function K$(e){return this.tween("text",typeof e=="function"?Y$(Mw(this,"text",e)):V$(e==null?"":e+""))}function X$(e){return function(t){this.textContent=e.call(this,t)}}function Q$(e){var t,n;function s(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&X$(a)),t}return s._value=e,s}function Z$(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,Q$(e))}function J$(){for(var e=this._name,t=this._id,n=EC(),s=this._groups,a=s.length,i=0;i<a;++i)for(var l=s[i],d=l.length,f,p=0;p<d;++p)if(f=l[p]){var h=fr(f,t);nd(f,e,n,p,l,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new rs(s,this._parents,e,n)}function eO(){var e,t,n=this,s=n._id,a=n.size();return new Promise(function(i,l){var d={value:l},f={value:function(){--a===0&&i()}};n.each(function(){var p=Cr(this,s),h=p.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(d),t._.interrupt.push(d),t._.end.push(f)),p.on=t}),a===0&&i()})}var tO=0;function rs(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function EC(){return++tO}var es=Ol.prototype;rs.prototype={constructor:rs,select:O$,selectAll:P$,selectChild:es.selectChild,selectChildren:es.selectChildren,filter:C$,merge:T$,selection:D$,transition:J$,call:es.call,nodes:es.nodes,node:es.node,size:es.size,empty:es.empty,each:es.each,on:M$,attr:h$,attrTween:y$,style:U$,styleTween:G$,text:K$,textTween:Z$,remove:$$,tween:a$,delay:x$,duration:_$,ease:N$,easeVarying:j$,end:eO,[Symbol.iterator]:es[Symbol.iterator]};function nO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var rO={time:null,delay:0,duration:250,ease:nO};function sO(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 aO(e){var t,n;e instanceof rs?(t=e._id,e=e._name):(t=EC(),(n=rO).time=Rw(),e=e==null?null:e+"");for(var s=this._groups,a=s.length,i=0;i<a;++i)for(var l=s[i],d=l.length,f,p=0;p<d;++p)(f=l[p])&&nd(f,e,t,p,l,n||sO(f,t));return new rs(s,this._parents,e,t)}Ol.prototype.interrupt=n$;Ol.prototype.transition=aO;const cu=e=>()=>e;function oO(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 ts(e,t,n){this.k=e,this.x=t,this.y=n}ts.prototype={constructor:ts,scale:function(e){return e===1?this:new ts(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ts(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 ns=new ts(1,0,0);ts.prototype;function pf(e){e.stopImmediatePropagation()}function ol(e){e.preventDefault(),e.stopImmediatePropagation()}function iO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function lO(){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 qb(){return this.__zoom||ns}function cO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function uO(){return navigator.maxTouchPoints||"ontouchstart"in this}function dO(e,t,n){var s=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a),l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l))}function jC(){var e=iO,t=lO,n=dO,s=cO,a=uO,i=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],d=250,f=YI,p=Ju("start","zoom","end"),h,g,y,w=500,N=150,k=0,E=10;function _(R){R.property("__zoom",qb).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",A).filter(a).on("touchstart.zoom",D).on("touchmove.zoom",H).on("touchend.zoom touchcancel.zoom",X).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(R,Z,B,Q){var P=R.selection?R.selection():R;P.property("__zoom",qb),R!==P?M(R,Z,B,Q):P.interrupt().each(function(){$(this,arguments).event(Q).start().zoom(null,typeof Z=="function"?Z.apply(this,arguments):Z).end()})},_.scaleBy=function(R,Z,B,Q){_.scaleTo(R,function(){var P=this.__zoom.k,F=typeof Z=="function"?Z.apply(this,arguments):Z;return P*F},B,Q)},_.scaleTo=function(R,Z,B,Q){_.transform(R,function(){var P=t.apply(this,arguments),F=this.__zoom,J=B==null?C(P):typeof B=="function"?B.apply(this,arguments):B,L=F.invert(J),K=typeof Z=="function"?Z.apply(this,arguments):Z;return n(j(S(F,K),J,L),P,l)},B,Q)},_.translateBy=function(R,Z,B,Q){_.transform(R,function(){return n(this.__zoom.translate(typeof Z=="function"?Z.apply(this,arguments):Z,typeof B=="function"?B.apply(this,arguments):B),t.apply(this,arguments),l)},null,Q)},_.translateTo=function(R,Z,B,Q,P){_.transform(R,function(){var F=t.apply(this,arguments),J=this.__zoom,L=Q==null?C(F):typeof Q=="function"?Q.apply(this,arguments):Q;return n(ns.translate(L[0],L[1]).scale(J.k).translate(typeof Z=="function"?-Z.apply(this,arguments):-Z,typeof B=="function"?-B.apply(this,arguments):-B),F,l)},Q,P)};function S(R,Z){return Z=Math.max(i[0],Math.min(i[1],Z)),Z===R.k?R:new ts(Z,R.x,R.y)}function j(R,Z,B){var Q=Z[0]-B[0]*R.k,P=Z[1]-B[1]*R.k;return Q===R.x&&P===R.y?R:new ts(R.k,Q,P)}function C(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function M(R,Z,B,Q){R.on("start.zoom",function(){$(this,arguments).event(Q).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(Q).end()}).tween("zoom",function(){var P=this,F=arguments,J=$(P,F).event(Q),L=t.apply(P,F),K=B==null?C(L):typeof B=="function"?B.apply(P,F):B,ue=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),G=P.__zoom,U=typeof Z=="function"?Z.apply(P,F):Z,ee=f(G.invert(K).concat(ue/G.k),U.invert(K).concat(ue/U.k));return function(Y){if(Y===1)Y=U;else{var le=ee(Y),fe=ue/le[2];Y=new ts(fe,K[0]-le[0]*fe,K[1]-le[1]*fe)}J.zoom(null,Y)}})}function $(R,Z,B){return!B&&R.__zooming||new I(R,Z)}function I(R,Z){this.that=R,this.args=Z,this.active=0,this.sourceEvent=null,this.extent=t.apply(R,Z),this.taps=0}I.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,Z){return this.mouse&&R!=="mouse"&&(this.mouse[1]=Z.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=Z.invert(this.touch0[0])),this.touch1&&R!=="touch"&&(this.touch1[1]=Z.invert(this.touch1[0])),this.that.__zoom=Z,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(R){var Z=Hn(this.that).datum();p.call(R,this.that,new oO(R,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:p}),Z)}};function z(R,...Z){if(!e.apply(this,arguments))return;var B=$(this,Z).event(R),Q=this.__zoom,P=Math.max(i[0],Math.min(i[1],Q.k*Math.pow(2,s.apply(this,arguments)))),F=or(R);if(B.wheel)(B.mouse[0][0]!==F[0]||B.mouse[0][1]!==F[1])&&(B.mouse[1]=Q.invert(B.mouse[0]=F)),clearTimeout(B.wheel);else{if(Q.k===P)return;B.mouse=[F,Q.invert(F)],Tu(this),B.start()}ol(R),B.wheel=setTimeout(J,N),B.zoom("mouse",n(j(S(Q,P),B.mouse[0],B.mouse[1]),B.extent,l));function J(){B.wheel=null,B.end()}}function O(R,...Z){if(y||!e.apply(this,arguments))return;var B=R.currentTarget,Q=$(this,Z,!0).event(R),P=Hn(R.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",ue,!0),F=or(R,B),J=R.clientX,L=R.clientY;hC(R.view),pf(R),Q.mouse=[F,this.__zoom.invert(F)],Tu(this),Q.start();function K(G){if(ol(G),!Q.moved){var U=G.clientX-J,ee=G.clientY-L;Q.moved=U*U+ee*ee>k}Q.event(G).zoom("mouse",n(j(Q.that.__zoom,Q.mouse[0]=or(G,B),Q.mouse[1]),Q.extent,l))}function ue(G){P.on("mousemove.zoom mouseup.zoom",null),fC(G.view,Q.moved),ol(G),Q.event(G).end()}}function A(R,...Z){if(e.apply(this,arguments)){var B=this.__zoom,Q=or(R.changedTouches?R.changedTouches[0]:R,this),P=B.invert(Q),F=B.k*(R.shiftKey?.5:2),J=n(j(S(B,F),Q,P),t.apply(this,Z),l);ol(R),d>0?Hn(this).transition().duration(d).call(M,J,Q,R):Hn(this).call(_.transform,J,Q,R)}}function D(R,...Z){if(e.apply(this,arguments)){var B=R.touches,Q=B.length,P=$(this,Z,R.changedTouches.length===Q).event(R),F,J,L,K;for(pf(R),J=0;J<Q;++J)L=B[J],K=or(L,this),K=[K,this.__zoom.invert(K),L.identifier],P.touch0?!P.touch1&&P.touch0[2]!==K[2]&&(P.touch1=K,P.taps=0):(P.touch0=K,F=!0,P.taps=1+!!h);h&&(h=clearTimeout(h)),F&&(P.taps<2&&(g=K[0],h=setTimeout(function(){h=null},w)),Tu(this),P.start())}}function H(R,...Z){if(this.__zooming){var B=$(this,Z).event(R),Q=R.changedTouches,P=Q.length,F,J,L,K;for(ol(R),F=0;F<P;++F)J=Q[F],L=or(J,this),B.touch0&&B.touch0[2]===J.identifier?B.touch0[0]=L:B.touch1&&B.touch1[2]===J.identifier&&(B.touch1[0]=L);if(J=B.that.__zoom,B.touch1){var ue=B.touch0[0],G=B.touch0[1],U=B.touch1[0],ee=B.touch1[1],Y=(Y=U[0]-ue[0])*Y+(Y=U[1]-ue[1])*Y,le=(le=ee[0]-G[0])*le+(le=ee[1]-G[1])*le;J=S(J,Math.sqrt(Y/le)),L=[(ue[0]+U[0])/2,(ue[1]+U[1])/2],K=[(G[0]+ee[0])/2,(G[1]+ee[1])/2]}else if(B.touch0)L=B.touch0[0],K=B.touch0[1];else return;B.zoom("touch",n(j(J,L,K),B.extent,l))}}function X(R,...Z){if(this.__zooming){var B=$(this,Z).event(R),Q=R.changedTouches,P=Q.length,F,J;for(pf(R),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),F=0;F<P;++F)J=Q[F],B.touch0&&B.touch0[2]===J.identifier?delete B.touch0:B.touch1&&B.touch1[2]===J.identifier&&delete B.touch1;if(B.touch1&&!B.touch0&&(B.touch0=B.touch1,delete B.touch1),B.touch0)B.touch0[1]=this.__zoom.invert(B.touch0[0]);else if(B.end(),B.taps===2&&(J=or(J,this),Math.hypot(g[0]-J[0],g[1]-J[1])<E)){var L=Hn(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return _.wheelDelta=function(R){return arguments.length?(s=typeof R=="function"?R:cu(+R),_):s},_.filter=function(R){return arguments.length?(e=typeof R=="function"?R:cu(!!R),_):e},_.touchable=function(R){return arguments.length?(a=typeof R=="function"?R:cu(!!R),_):a},_.extent=function(R){return arguments.length?(t=typeof R=="function"?R:cu([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),_):t},_.scaleExtent=function(R){return arguments.length?(i[0]=+R[0],i[1]=+R[1],_):[i[0],i[1]]},_.translateExtent=function(R){return arguments.length?(l[0][0]=+R[0][0],l[1][0]=+R[1][0],l[0][1]=+R[0][1],l[1][1]=+R[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(R){return arguments.length?(n=R,_):n},_.duration=function(R){return arguments.length?(d=+R,_):d},_.interpolate=function(R){return arguments.length?(f=R,_):f},_.on=function(){var R=p.on.apply(p,arguments);return R===p?_:R},_.clickDistance=function(R){return arguments.length?(k=(R=+R)*R,_):Math.sqrt(k)},_.tapDistance=function(R){return arguments.length?(E=+R,_):E},_}var Iw=Zj();const rd=b.createContext(null),hO=rd.Provider,ss={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.`},CC=ss.error001();function ct(e,t){const n=b.useContext(rd);if(n===null)throw new Error(CC);return Jj(n,e,t)}const Mt=()=>{const e=b.useContext(rd);if(e===null)throw new Error(CC);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},fO=e=>e.userSelectionActive?"none":"all";function $w({position:e,children:t,className:n,style:s,...a}){const i=ct(fO),l=`${e}`.split("-");return he.createElement("div",{className:Vt(["react-flow__panel",n,...l]),style:{...s,pointerEvents:i},...a},t)}function pO({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:he.createElement($w,{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"},he.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const mO=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:a=!0,labelBgStyle:i={},labelBgPadding:l=[2,4],labelBgBorderRadius:d=2,children:f,className:p,...h})=>{const g=b.useRef(null),[y,w]=b.useState({x:0,y:0,width:0,height:0}),N=Vt(["react-flow__edge-textwrapper",p]);return b.useEffect(()=>{if(g.current){const k=g.current.getBBox();w({x:k.x,y:k.y,width:k.width,height:k.height})}},[n]),typeof n>"u"||!n?null:he.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:N,visibility:y.width?"visible":"hidden",...h},a&&he.createElement("rect",{width:y.width+2*l[0],x:-l[0],y:-l[1],height:y.height+2*l[1],className:"react-flow__edge-textbg",style:i,rx:d,ry:d}),he.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:g,style:s},n),f)};var gO=b.memo(mO);const Ow=e=>({width:e.offsetWidth,height:e.offsetHeight}),Yo=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Pw=(e={x:0,y:0},t)=>({x:Yo(e.x,t[0][0],t[1][0]),y:Yo(e.y,t[0][1],t[1][1])}),Fb=(e,t,n)=>e<t?Yo(Math.abs(e-t),1,50)/50:e>n?-Yo(Math.abs(e-n),1,50)/50:0,TC=(e,t)=>{const n=Fb(e.x,35,t.width-35)*20,s=Fb(e.y,35,t.height-35)*20;return[n,s]},RC=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},AC=(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)}),El=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),MC=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),zb=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),yO=(e,t)=>MC(AC(El(e),El(t))),tw=(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)},vO=e=>Gn(e.width)&&Gn(e.height)&&Gn(e.x)&&Gn(e.y),Gn=e=>!isNaN(e)&&isFinite(e),jt=Symbol.for("internals"),IC=["Enter"," ","Escape"],wO=(e,t)=>{},xO=e=>"nativeEvent"in e;function nw(e){var a,i;const t=xO(e)?e.nativeEvent:e,n=((i=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const $C=e=>"clientX"in e,Ds=(e,t)=>{var i,l;const n=$C(e),s=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,a=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},Fu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Ll=({id:e,path:t,labelX:n,labelY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:y,interactionWidth:w=20})=>he.createElement(he.Fragment,null,he.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:y}),w&&he.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),a&&Gn(n)&&Gn(s)?he.createElement(gO,{x:n,y:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p}):null);Ll.displayName="BaseEdge";function il(e,t,n){return n===void 0?n:s=>{const a=t().edges.find(i=>i.id===e);a&&n(s,{...a})}}function OC({sourceX:e,sourceY:t,targetX:n,targetY:s}){const a=Math.abs(n-e)/2,i=n<e?n+a:n-a,l=Math.abs(s-t)/2,d=s<t?s+l:s-l;return[i,d,a,l]}function PC({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:a,sourceControlY:i,targetControlX:l,targetControlY:d}){const f=e*.125+a*.375+l*.375+n*.125,p=t*.125+i*.375+d*.375+s*.125,h=Math.abs(f-e),g=Math.abs(p-t);return[f,p,h,g]}var Ma;(function(e){e.Strict="strict",e.Loose="loose"})(Ma||(Ma={}));var Ca;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ca||(Ca={}));var jl;(function(e){e.Partial="partial",e.Full="full"})(jl||(jl={}));var Ls;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ls||(Ls={}));var zu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(zu||(zu={}));var Oe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Oe||(Oe={}));function Bb({pos:e,x1:t,y1:n,x2:s,y2:a}){return e===Oe.Left||e===Oe.Right?[.5*(t+s),n]:[t,.5*(n+a)]}function LC({sourceX:e,sourceY:t,sourcePosition:n=Oe.Bottom,targetX:s,targetY:a,targetPosition:i=Oe.Top}){const[l,d]=Bb({pos:n,x1:e,y1:t,x2:s,y2:a}),[f,p]=Bb({pos:i,x1:s,y1:a,x2:e,y2:t}),[h,g,y,w]=PC({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:l,sourceControlY:d,targetControlX:f,targetControlY:p});return[`M${e},${t} C${l},${d} ${f},${p} ${s},${a}`,h,g,y,w]}const Lw=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=Oe.Bottom,targetPosition:i=Oe.Top,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:k})=>{const[E,_,S]=LC({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i});return he.createElement(Ll,{path:E,labelX:_,labelY:S,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:k})});Lw.displayName="SimpleBezierEdge";const Ub={[Oe.Left]:{x:-1,y:0},[Oe.Right]:{x:1,y:0},[Oe.Top]:{x:0,y:-1},[Oe.Bottom]:{x:0,y:1}},bO=({source:e,sourcePosition:t=Oe.Bottom,target:n})=>t===Oe.Left||t===Oe.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},Wb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function kO({source:e,sourcePosition:t=Oe.Bottom,target:n,targetPosition:s=Oe.Top,center:a,offset:i}){const l=Ub[t],d=Ub[s],f={x:e.x+l.x*i,y:e.y+l.y*i},p={x:n.x+d.x*i,y:n.y+d.y*i},h=bO({source:f,sourcePosition:t,target:p}),g=h.x!==0?"x":"y",y=h[g];let w=[],N,k;const E={x:0,y:0},_={x:0,y:0},[S,j,C,M]=OC({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*d[g]===-1){N=a.x??S,k=a.y??j;const I=[{x:N,y:f.y},{x:N,y:p.y}],z=[{x:f.x,y:k},{x:p.x,y:k}];l[g]===y?w=g==="x"?I:z:w=g==="x"?z:I}else{const I=[{x:f.x,y:p.y}],z=[{x:p.x,y:f.y}];if(g==="x"?w=l.x===y?z:I:w=l.y===y?I:z,t===s){const X=Math.abs(e[g]-n[g]);if(X<=i){const R=Math.min(i-1,i-X);l[g]===y?E[g]=(f[g]>e[g]?-1:1)*R:_[g]=(p[g]>n[g]?-1:1)*R}}if(t!==s){const X=g==="x"?"y":"x",R=l[g]===d[X],Z=f[X]>p[X],B=f[X]<p[X];(l[g]===1&&(!R&&Z||R&&B)||l[g]!==1&&(!R&&B||R&&Z))&&(w=g==="x"?I:z)}const O={x:f.x+E.x,y:f.y+E.y},A={x:p.x+_.x,y:p.y+_.y},D=Math.max(Math.abs(O.x-w[0].x),Math.abs(A.x-w[0].x)),H=Math.max(Math.abs(O.y-w[0].y),Math.abs(A.y-w[0].y));D>=H?(N=(O.x+A.x)/2,k=w[0].y):(N=w[0].x,k=(O.y+A.y)/2)}return[[e,{x:f.x+E.x,y:f.y+E.y},...w,{x:p.x+_.x,y:p.y+_.y},n],N,k,C,M]}function _O(e,t,n,s){const a=Math.min(Wb(e,t)/2,Wb(t,n)/2,s),{x:i,y:l}=t;if(e.x===i&&i===n.x||e.y===l&&l===n.y)return`L${i} ${l}`;if(e.y===l){const p=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${i+a*p},${l}Q ${i},${l} ${i},${l+a*h}`}const d=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${i},${l+a*f}Q ${i},${l} ${i+a*d},${l}`}function rw({sourceX:e,sourceY:t,sourcePosition:n=Oe.Bottom,targetX:s,targetY:a,targetPosition:i=Oe.Top,borderRadius:l=5,centerX:d,centerY:f,offset:p=20}){const[h,g,y,w,N]=kO({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:a},targetPosition:i,center:{x:d,y:f},offset:p});return[h.reduce((E,_,S)=>{let j="";return S>0&&S<h.length-1?j=_O(h[S-1],_,h[S+1],l):j=`${S===0?"M":"L"}${_.x} ${_.y}`,E+=j,E},""),g,y,w,N]}const sd=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,sourcePosition:g=Oe.Bottom,targetPosition:y=Oe.Top,markerEnd:w,markerStart:N,pathOptions:k,interactionWidth:E})=>{const[_,S,j]=rw({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:y,borderRadius:k==null?void 0:k.borderRadius,offset:k==null?void 0:k.offset});return he.createElement(Ll,{path:_,labelX:S,labelY:j,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:N,interactionWidth:E})});sd.displayName="SmoothStepEdge";const Dw=b.memo(e=>{var t;return he.createElement(sd,{...e,pathOptions:b.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Dw.displayName="StepEdge";function SO({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[a,i,l,d]=OC({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,a,i,l,d]}const qw=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:y,interactionWidth:w})=>{const[N,k,E]=SO({sourceX:e,sourceY:t,targetX:n,targetY:s});return he.createElement(Ll,{path:N,labelX:k,labelY:E,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:y,interactionWidth:w})});qw.displayName="StraightEdge";function uu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Hb({pos:e,x1:t,y1:n,x2:s,y2:a,c:i}){switch(e){case Oe.Left:return[t-uu(t-s,i),n];case Oe.Right:return[t+uu(s-t,i),n];case Oe.Top:return[t,n-uu(n-a,i)];case Oe.Bottom:return[t,n+uu(a-n,i)]}}function DC({sourceX:e,sourceY:t,sourcePosition:n=Oe.Bottom,targetX:s,targetY:a,targetPosition:i=Oe.Top,curvature:l=.25}){const[d,f]=Hb({pos:n,x1:e,y1:t,x2:s,y2:a,c:l}),[p,h]=Hb({pos:i,x1:s,y1:a,x2:e,y2:t,c:l}),[g,y,w,N]=PC({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:d,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${d},${f} ${p},${h} ${s},${a}`,g,y,w,N]}const Bu=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=Oe.Bottom,targetPosition:i=Oe.Top,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,pathOptions:k,interactionWidth:E})=>{const[_,S,j]=DC({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i,curvature:k==null?void 0:k.curvature});return he.createElement(Ll,{path:_,labelX:S,labelY:j,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:E})});Bu.displayName="BezierEdge";const Fw=b.createContext(null),NO=Fw.Provider;Fw.Consumer;const EO=()=>b.useContext(Fw),jO=e=>"id"in e&&"source"in e&&"target"in e,CO=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,sw=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,TO=(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)),RO=(e,t)=>{if(!e.source||!e.target)return t;let n;return jO(e)?n={...e}:n={...e,id:CO(e)},TO(n,t)?t:t.concat(n)},aw=({x:e,y:t},[n,s,a],i,[l,d])=>{const f={x:(e-n)/a,y:(t-s)/a};return i?{x:l*Math.round(f.x/l),y:d*Math.round(f.y/d)}:f},qC=({x:e,y:t},[n,s,a])=>({x:e*a+n,y:t*a+s}),Ra=(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}},ad=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,a)=>{const{x:i,y:l}=Ra(a,t).positionAbsolute;return AC(s,El({x:i,y:l,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return MC(n)},FC=(e,t,[n,s,a]=[0,0,1],i=!1,l=!1,d=[0,0])=>{const f={x:(t.x-n)/a,y:(t.y-s)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(h=>{const{width:g,height:y,selectable:w=!0,hidden:N=!1}=h;if(l&&!w||N)return!1;const{positionAbsolute:k}=Ra(h,d),E={x:k.x,y:k.y,width:g||0,height:y||0},_=tw(f,E),S=typeof g>"u"||typeof y>"u"||g===null||y===null,j=i&&_>0,C=(g||0)*(y||0);(S||j||_>=C||h.dragging)&&p.push(h)}),p},zC=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},BC=(e,t,n,s,a,i=.1)=>{const l=t/(e.width*(1+i)),d=n/(e.height*(1+i)),f=Math.min(l,d),p=Yo(f,s,a),h=e.x+e.width/2,g=e.y+e.height/2,y=t/2-h*p,w=n/2-g*p;return{x:y,y:w,zoom:p}},Ea=(e,t=0)=>e.transition().duration(t);function Gb(e,t,n,s){return(t[n]||[]).reduce((a,i)=>{var l,d;return`${e.id}-${i.id}-${n}`!==s&&a.push({id:i.id||null,type:n,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+i.x+i.width/2,y:(((d=e.positionAbsolute)==null?void 0:d.y)??0)+i.y+i.height/2}),a},[])}function AO(e,t,n,s,a,i){const{x:l,y:d}=Ds(e),p=t.elementsFromPoint(l,d).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const k=zw(void 0,p),E=p.getAttribute("data-handleid"),_=i({nodeId:N,id:E,type:k});if(_){const S=a.find(j=>j.nodeId===N&&j.type===k&&j.id===E);return{handle:{id:E,type:k,nodeId:N,x:(S==null?void 0:S.x)||n.x,y:(S==null?void 0:S.y)||n.y},validHandleResult:_}}}}let h=[],g=1/0;if(a.forEach(N=>{const k=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(k<=s){const E=i(N);k<=g&&(k<g?h=[{handle:N,validHandleResult:E}]:k===g&&h.push({handle:N,validHandleResult:E}),g=k)}}),!h.length)return{handle:null,validHandleResult:UC()};if(h.length===1)return h[0];const y=h.some(({validHandleResult:N})=>N.isValid),w=h.some(({handle:N})=>N.type==="target");return h.find(({handle:N,validHandleResult:k})=>w?N.type==="target":y?k.isValid:!0)||h[0]}const MO={source:null,target:null,sourceHandle:null,targetHandle:null},UC=()=>({handleDomNode:null,isValid:!1,connection:MO,endHandle:null});function WC(e,t,n,s,a,i,l){const d=a==="target",f=l.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...UC(),handleDomNode:f};if(f){const h=zw(void 0,f),g=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),N=f.classList.contains("connectableend"),k={source:d?g:n,sourceHandle:d?y:s,target:d?n:g,targetHandle:d?s:y};p.connection=k,w&&N&&(t===Ma.Strict?d&&h==="source"||!d&&h==="target":g!==n||y!==s)&&(p.endHandle={nodeId:g,handleId:y,type:h},p.isValid=i(k))}return p}function IO({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((a,i)=>{if(i[jt]){const{handleBounds:l}=i[jt];let d=[],f=[];l&&(d=Gb(i,l,"source",`${t}-${n}-${s}`),f=Gb(i,l,"target",`${t}-${n}-${s}`)),a.push(...d,...f)}return a},[])}function zw(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 $O(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function HC({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:a,getState:i,setState:l,isValidConnection:d,edgeUpdaterType:f,onReconnectEnd:p}){const h=RC(e.target),{connectionMode:g,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:k,panBy:E,getNodes:_,cancelConnection:S}=i();let j=0,C;const{x:M,y:$}=Ds(e),I=h==null?void 0:h.elementFromPoint(M,$),z=zw(f,I),O=y==null?void 0:y.getBoundingClientRect();if(!O||!z)return;let A,D=Ds(e,O),H=!1,X=null,R=!1,Z=null;const B=IO({nodes:_(),nodeId:n,handleId:t,handleType:z}),Q=()=>{if(!w)return;const[J,L]=TC(D,O);E({x:J,y:L}),j=requestAnimationFrame(Q)};l({connectionPosition:D,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:z,connectionStartHandle:{nodeId:n,handleId:t,type:z},connectionEndHandle:null}),k==null||k(e,{nodeId:n,handleId:t,handleType:z});function P(J){const{transform:L}=i();D=Ds(J,O);const{handle:K,validHandleResult:ue}=AO(J,h,aw(D,L,!1,[1,1]),N,B,G=>WC(G,g,n,t,a?"target":"source",d,h));if(C=K,H||(Q(),H=!0),Z=ue.handleDomNode,X=ue.connection,R=ue.isValid,l({connectionPosition:C&&R?qC({x:C.x,y:C.y},L):D,connectionStatus:$O(!!C,R),connectionEndHandle:ue.endHandle}),!C&&!R&&!Z)return mf(A);X.source!==X.target&&Z&&(mf(A),A=Z,Z.classList.add("connecting","react-flow__handle-connecting"),Z.classList.toggle("valid",R),Z.classList.toggle("react-flow__handle-valid",R))}function F(J){var L,K;(C||Z)&&X&&R&&(s==null||s(X)),(K=(L=i()).onConnectEnd)==null||K.call(L,J),f&&(p==null||p(J)),mf(A),S(),cancelAnimationFrame(j),H=!1,R=!1,X=null,Z=null,h.removeEventListener("mousemove",P),h.removeEventListener("mouseup",F),h.removeEventListener("touchmove",P),h.removeEventListener("touchend",F)}h.addEventListener("mousemove",P),h.addEventListener("mouseup",F),h.addEventListener("touchmove",P),h.addEventListener("touchend",F)}const Vb=()=>!0,OO=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),PO=(e,t,n)=>s=>{const{connectionStartHandle:a,connectionEndHandle:i,connectionClickStartHandle:l}=s;return{connecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n}},GC=b.forwardRef(({type:e="source",position:t=Oe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:i=!0,id:l,onConnect:d,children:f,className:p,onMouseDown:h,onTouchStart:g,...y},w)=>{var O,A;const N=l||null,k=e==="target",E=Mt(),_=EO(),{connectOnClick:S,noPanClassName:j}=ct(OO,Dt),{connecting:C,clickConnecting:M}=ct(PO(_,N,e),Dt);_||(A=(O=E.getState()).onError)==null||A.call(O,"010",ss.error010());const $=D=>{const{defaultEdgeOptions:H,onConnect:X,hasDefaultEdges:R}=E.getState(),Z={...H,...D};if(R){const{edges:B,setEdges:Q}=E.getState();Q(RO(Z,B))}X==null||X(Z),d==null||d(Z)},I=D=>{if(!_)return;const H=$C(D);a&&(H&&D.button===0||!H)&&HC({event:D,handleId:N,nodeId:_,onConnect:$,isTarget:k,getState:E.getState,setState:E.setState,isValidConnection:n||E.getState().isValidConnection||Vb}),H?h==null||h(D):g==null||g(D)},z=D=>{const{onClickConnectStart:H,onClickConnectEnd:X,connectionClickStartHandle:R,connectionMode:Z,isValidConnection:B}=E.getState();if(!_||!R&&!a)return;if(!R){H==null||H(D,{nodeId:_,handleId:N,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:N}});return}const Q=RC(D.target),P=n||B||Vb,{connection:F,isValid:J}=WC({nodeId:_,id:N,type:e},Z,R.nodeId,R.handleId||null,R.type,P,Q);J&&$(F),X==null||X(D),E.setState({connectionClickStartHandle:null})};return he.createElement("div",{"data-handleid":N,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${N}-${e}`,className:Vt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",j,p,{source:!k,target:k,connectable:s,connectablestart:a,connectableend:i,connecting:M,connectionindicator:s&&(a&&!C||i&&C)}]),onMouseDown:I,onTouchStart:I,onClick:S?z:void 0,ref:w,...y},f)});GC.displayName="Handle";var Ko=b.memo(GC);const VC=({data:e,isConnectable:t,targetPosition:n=Oe.Top,sourcePosition:s=Oe.Bottom})=>he.createElement(he.Fragment,null,he.createElement(Ko,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,he.createElement(Ko,{type:"source",position:s,isConnectable:t}));VC.displayName="DefaultNode";var ow=b.memo(VC);const YC=({data:e,isConnectable:t,sourcePosition:n=Oe.Bottom})=>he.createElement(he.Fragment,null,e==null?void 0:e.label,he.createElement(Ko,{type:"source",position:n,isConnectable:t}));YC.displayName="InputNode";var KC=b.memo(YC);const XC=({data:e,isConnectable:t,targetPosition:n=Oe.Top})=>he.createElement(he.Fragment,null,he.createElement(Ko,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);XC.displayName="OutputNode";var QC=b.memo(XC);const Bw=()=>null;Bw.displayName="GroupNode";const LO=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),du=e=>e.id;function DO(e,t){return Dt(e.selectedNodes.map(du),t.selectedNodes.map(du))&&Dt(e.selectedEdges.map(du),t.selectedEdges.map(du))}const ZC=b.memo(({onSelectionChange:e})=>{const t=Mt(),{selectedNodes:n,selectedEdges:s}=ct(LO,DO);return b.useEffect(()=>{const a={nodes:n,edges:s};e==null||e(a),t.getState().onSelectionChange.forEach(i=>i(a))},[n,s,e]),null});ZC.displayName="SelectionListener";const qO=e=>!!e.onSelectionChange;function FO({onSelectionChange:e}){const t=ct(qO);return e||t?he.createElement(ZC,{onSelectionChange:e}):null}const zO=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 Ro(e,t){b.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Xe(e,t,n){b.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const BO=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:a,onConnectStart:i,onConnectEnd:l,onClickConnectStart:d,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:h,nodesFocusable:g,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:k,maxZoom:E,nodeExtent:_,onNodesChange:S,onEdgesChange:j,elementsSelectable:C,connectionMode:M,snapGrid:$,snapToGrid:I,translateExtent:z,connectOnClick:O,defaultEdgeOptions:A,fitView:D,fitViewOptions:H,onNodesDelete:X,onEdgesDelete:R,onNodeDrag:Z,onNodeDragStart:B,onNodeDragStop:Q,onSelectionDrag:P,onSelectionDragStart:F,onSelectionDragStop:J,noPanClassName:L,nodeOrigin:K,rfId:ue,autoPanOnConnect:G,autoPanOnNodeDrag:U,onError:ee,connectionRadius:Y,isValidConnection:le,nodeDragThreshold:fe})=>{const{setNodes:me,setEdges:ke,setDefaultNodesAndEdges:Ve,setMinZoom:Le,setMaxZoom:qe,setTranslateExtent:Ne,setNodeExtent:Ge,reset:be}=ct(zO,Dt),re=Mt();return b.useEffect(()=>{const Qe=s==null?void 0:s.map(ft=>({...ft,...A}));return Ve(n,Qe),()=>{be()}},[]),Xe("defaultEdgeOptions",A,re.setState),Xe("connectionMode",M,re.setState),Xe("onConnect",a,re.setState),Xe("onConnectStart",i,re.setState),Xe("onConnectEnd",l,re.setState),Xe("onClickConnectStart",d,re.setState),Xe("onClickConnectEnd",f,re.setState),Xe("nodesDraggable",p,re.setState),Xe("nodesConnectable",h,re.setState),Xe("nodesFocusable",g,re.setState),Xe("edgesFocusable",y,re.setState),Xe("edgesUpdatable",w,re.setState),Xe("elementsSelectable",C,re.setState),Xe("elevateNodesOnSelect",N,re.setState),Xe("snapToGrid",I,re.setState),Xe("snapGrid",$,re.setState),Xe("onNodesChange",S,re.setState),Xe("onEdgesChange",j,re.setState),Xe("connectOnClick",O,re.setState),Xe("fitViewOnInit",D,re.setState),Xe("fitViewOnInitOptions",H,re.setState),Xe("onNodesDelete",X,re.setState),Xe("onEdgesDelete",R,re.setState),Xe("onNodeDrag",Z,re.setState),Xe("onNodeDragStart",B,re.setState),Xe("onNodeDragStop",Q,re.setState),Xe("onSelectionDrag",P,re.setState),Xe("onSelectionDragStart",F,re.setState),Xe("onSelectionDragStop",J,re.setState),Xe("noPanClassName",L,re.setState),Xe("nodeOrigin",K,re.setState),Xe("rfId",ue,re.setState),Xe("autoPanOnConnect",G,re.setState),Xe("autoPanOnNodeDrag",U,re.setState),Xe("onError",ee,re.setState),Xe("connectionRadius",Y,re.setState),Xe("isValidConnection",le,re.setState),Xe("nodeDragThreshold",fe,re.setState),Ro(e,me),Ro(t,ke),Ro(k,Le),Ro(E,qe),Ro(z,Ne),Ro(_,Ge),null},Yb={display:"none"},UO={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},JC="react-flow__node-desc",eT="react-flow__edge-desc",WO="react-flow__aria-live",HO=e=>e.ariaLiveMessage;function GO({rfId:e}){const t=ct(HO);return he.createElement("div",{id:`${WO}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:UO},t)}function VO({rfId:e,disableKeyboardA11y:t}){return he.createElement(he.Fragment,null,he.createElement("div",{id:`${JC}-${e}`,style:Yb},"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."," "),he.createElement("div",{id:`${eT}-${e}`,style:Yb},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&he.createElement(GO,{rfId:e}))}var Cl=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=b.useState(!1),a=b.useRef(!1),i=b.useRef(new Set([])),[l,d]=b.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),h=p.reduce((g,y)=>g.concat(...y),[]);return[p,h]}return[[],[]]},[e]);return b.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const h=w=>{if(a.current=w.ctrlKey||w.metaKey||w.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&nw(w))return!1;const k=Xb(w.code,d);i.current.add(w[k]),Kb(l,i.current,!1)&&(w.preventDefault(),s(!0))},g=w=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&nw(w))return!1;const k=Xb(w.code,d);Kb(l,i.current,!0)?(s(!1),i.current.clear()):i.current.delete(w[k]),w.key==="Meta"&&i.current.clear(),a.current=!1},y=()=>{i.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",h),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",h),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",y)}}},[e,s]),n};function Kb(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(a=>t.has(a)))}function Xb(e,t){return t.includes(e)?"code":"key"}function tT(e,t,n,s){var d,f;const a=e.parentNode||e.parentId;if(!a)return n;const i=t.get(a),l=Ra(i,s);return tT(i,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((d=i[jt])==null?void 0:d.z)??0)>(n.z??0)?((f=i[jt])==null?void 0:f.z)??0:n.z??0},s)}function nT(e,t,n){e.forEach(s=>{var i;const a=s.parentNode||s.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||n!=null&&n[s.id]){const{x:l,y:d,z:f}=tT(s,e,{...s.position,z:((i=s[jt])==null?void 0:i.z)??0},t);s.positionAbsolute={x:l,y:d},s[jt].z=f,n!=null&&n[s.id]&&(s[jt].isParent=!0)}})}function gf(e,t,n,s){const a=new Map,i={},l=s?1e3:0;return e.forEach(d=>{var w;const f=(Gn(d.zIndex)?d.zIndex:0)+(d.selected?l:0),p=t.get(d.id),h={...d,positionAbsolute:{x:d.position.x,y:d.position.y}},g=d.parentNode||d.parentId;g&&(i[g]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==d.type;Object.defineProperty(h,jt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[jt])==null?void 0:w.handleBounds,z:f}}),a.set(d.id,h)}),nT(a,n,i),a}function rT(e,t={}){const{getNodes:n,width:s,height:a,minZoom:i,maxZoom:l,d3Zoom:d,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:g}=e(),y=t.initial&&!p&&h;if(d&&f&&(y||!t.initial)){const N=n().filter(E=>{var S;const _=t.includeHiddenNodes?E.width&&E.height:!E.hidden;return(S=t.nodes)!=null&&S.length?_&&t.nodes.some(j=>j.id===E.id):_}),k=N.every(E=>E.width&&E.height);if(N.length>0&&k){const E=ad(N,g),{x:_,y:S,zoom:j}=BC(E,s,a,t.minZoom??i,t.maxZoom??l,t.padding??.1),C=ns.translate(_,S).scale(j);return typeof t.duration=="number"&&t.duration>0?d.transform(Ea(f,t.duration),C):d.transform(f,C),!0}}return!1}function YO(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 KO(e,t){return t.map(n=>{const s=e.find(a=>a.id===n.id);return s&&(n.selected=s.selected),n})}function hu({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:a,edges:i,onNodesChange:l,onEdgesChange:d,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&s({nodeInternals:YO(e,a)}),l==null||l(e)),t!=null&&t.length&&(p&&s({edges:KO(t,i)}),d==null||d(t))}const Ao=()=>{},XO={zoomIn:Ao,zoomOut:Ao,zoomTo:Ao,getZoom:()=>1,setViewport:Ao,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ao,fitBounds:Ao,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},QO=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),ZO=()=>{const e=Mt(),{d3Zoom:t,d3Selection:n}=ct(QO,Dt);return b.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(Ea(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(Ea(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,i)=>t.scaleTo(Ea(n,i==null?void 0:i.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,i)=>{const[l,d,f]=e.getState().transform,p=ns.translate(a.x??l,a.y??d).scale(a.zoom??f);t.transform(Ea(n,i==null?void 0:i.duration),p)},getViewport:()=>{const[a,i,l]=e.getState().transform;return{x:a,y:i,zoom:l}},fitView:a=>rT(e.getState,a),setCenter:(a,i,l)=>{const{width:d,height:f,maxZoom:p}=e.getState(),h=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:p,g=d/2-a*h,y=f/2-i*h,w=ns.translate(g,y).scale(h);t.transform(Ea(n,l==null?void 0:l.duration),w)},fitBounds:(a,i)=>{const{width:l,height:d,minZoom:f,maxZoom:p}=e.getState(),{x:h,y:g,zoom:y}=BC(a,l,d,f,p,(i==null?void 0:i.padding)??.1),w=ns.translate(h,g).scale(y);t.transform(Ea(n,i==null?void 0:i.duration),w)},project:a=>{const{transform:i,snapToGrid:l,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"),aw(a,i,l,d)},screenToFlowPosition:a=>{const{transform:i,snapToGrid:l,snapGrid:d,domNode:f}=e.getState();if(!f)return a;const{x:p,y:h}=f.getBoundingClientRect(),g={x:a.x-p,y:a.y-h};return aw(g,i,l,d)},flowToScreenPosition:a=>{const{transform:i,domNode:l}=e.getState();if(!l)return a;const{x:d,y:f}=l.getBoundingClientRect(),p=qC(a,i);return{x:p.x+d,y:p.y+f}},viewportInitialized:!0}:XO,[t,n])};function Dl(){const e=ZO(),t=Mt(),n=b.useCallback(()=>t.getState().getNodes().map(k=>({...k})),[]),s=b.useCallback(k=>t.getState().nodeInternals.get(k),[]),a=b.useCallback(()=>{const{edges:k=[]}=t.getState();return k.map(E=>({...E}))},[]),i=b.useCallback(k=>{const{edges:E=[]}=t.getState();return E.find(_=>_.id===k)},[]),l=b.useCallback(k=>{const{getNodes:E,setNodes:_,hasDefaultNodes:S,onNodesChange:j}=t.getState(),C=E(),M=typeof k=="function"?k(C):k;if(S)_(M);else if(j){const $=M.length===0?C.map(I=>({type:"remove",id:I.id})):M.map(I=>({item:I,type:"reset"}));j($)}},[]),d=b.useCallback(k=>{const{edges:E=[],setEdges:_,hasDefaultEdges:S,onEdgesChange:j}=t.getState(),C=typeof k=="function"?k(E):k;if(S)_(C);else if(j){const M=C.length===0?E.map($=>({type:"remove",id:$.id})):C.map($=>({item:$,type:"reset"}));j(M)}},[]),f=b.useCallback(k=>{const E=Array.isArray(k)?k:[k],{getNodes:_,setNodes:S,hasDefaultNodes:j,onNodesChange:C}=t.getState();if(j){const $=[..._(),...E];S($)}else if(C){const M=E.map($=>({item:$,type:"add"}));C(M)}},[]),p=b.useCallback(k=>{const E=Array.isArray(k)?k:[k],{edges:_=[],setEdges:S,hasDefaultEdges:j,onEdgesChange:C}=t.getState();if(j)S([..._,...E]);else if(C){const M=E.map($=>({item:$,type:"add"}));C(M)}},[]),h=b.useCallback(()=>{const{getNodes:k,edges:E=[],transform:_}=t.getState(),[S,j,C]=_;return{nodes:k().map(M=>({...M})),edges:E.map(M=>({...M})),viewport:{x:S,y:j,zoom:C}}},[]),g=b.useCallback(({nodes:k,edges:E})=>{const{nodeInternals:_,getNodes:S,edges:j,hasDefaultNodes:C,hasDefaultEdges:M,onNodesDelete:$,onEdgesDelete:I,onNodesChange:z,onEdgesChange:O}=t.getState(),A=(k||[]).map(Z=>Z.id),D=(E||[]).map(Z=>Z.id),H=S().reduce((Z,B)=>{const Q=B.parentNode||B.parentId,P=!A.includes(B.id)&&Q&&Z.find(J=>J.id===Q);return(typeof B.deletable=="boolean"?B.deletable:!0)&&(A.includes(B.id)||P)&&Z.push(B),Z},[]),X=j.filter(Z=>typeof Z.deletable=="boolean"?Z.deletable:!0),R=X.filter(Z=>D.includes(Z.id));if(H||R){const Z=zC(H,X),B=[...R,...Z],Q=B.reduce((P,F)=>(P.includes(F.id)||P.push(F.id),P),[]);if((M||C)&&(M&&t.setState({edges:j.filter(P=>!Q.includes(P.id))}),C&&(H.forEach(P=>{_.delete(P.id)}),t.setState({nodeInternals:new Map(_)}))),Q.length>0&&(I==null||I(B),O&&O(Q.map(P=>({id:P,type:"remove"})))),H.length>0&&($==null||$(H),z)){const P=H.map(F=>({id:F.id,type:"remove"}));z(P)}}},[]),y=b.useCallback(k=>{const E=vO(k),_=E?null:t.getState().nodeInternals.get(k.id);return!E&&!_?[null,null,E]:[E?k:zb(_),_,E]},[]),w=b.useCallback((k,E=!0,_)=>{const[S,j,C]=y(k);return S?(_||t.getState().getNodes()).filter(M=>{if(!C&&(M.id===j.id||!M.positionAbsolute))return!1;const $=zb(M),I=tw($,S);return E&&I>0||I>=S.width*S.height}):[]},[]),N=b.useCallback((k,E,_=!0)=>{const[S]=y(k);if(!S)return!1;const j=tw(S,E);return _&&j>0||j>=S.width*S.height},[]);return b.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:a,getEdge:i,setNodes:l,setEdges:d,addNodes:f,addEdges:p,toObject:h,deleteElements:g,getIntersectingNodes:w,isNodeIntersecting:N}),[e,n,s,a,i,l,d,f,p,h,g,w,N])}const JO={actInsideInputWithModifier:!1};var eP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Mt(),{deleteElements:s}=Dl(),a=Cl(e,JO),i=Cl(t);b.useEffect(()=>{if(a){const{edges:l,getNodes:d}=n.getState(),f=d().filter(h=>h.selected),p=l.filter(h=>h.selected);s({nodes:f,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function tP(e){const t=Mt();b.useEffect(()=>{let n;const s=()=>{var i,l;if(!e.current)return;const a=Ow(e.current);(a.height===0||a.width===0)&&((l=(i=t.getState()).onError)==null||l.call(i,"004",ss.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 Uw={position:"absolute",width:"100%",height:"100%",top:0,left:0},nP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,fu=e=>({x:e.x,y:e.y,zoom:e.k}),Mo=(e,t)=>e.target.closest(`.${t}`),Qb=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Zb=e=>{const t=e.ctrlKey&&Fu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},rP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),sP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:a=!0,zoomOnPinch:i=!0,panOnScroll:l=!1,panOnScrollSpeed:d=.5,panOnScrollMode:f=Ca.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:g=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:k,zoomActivationKeyCode:E,preventScrolling:_=!0,children:S,noWheelClassName:j,noPanClassName:C})=>{const M=b.useRef(),$=Mt(),I=b.useRef(!1),z=b.useRef(!1),O=b.useRef(null),A=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:D,d3Selection:H,d3ZoomHandler:X,userSelectionActive:R}=ct(rP,Dt),Z=Cl(E),B=b.useRef(0),Q=b.useRef(!1),P=b.useRef();return tP(O),b.useEffect(()=>{if(O.current){const F=O.current.getBoundingClientRect(),J=jC().scaleExtent([N,k]).translateExtent(w),L=Hn(O.current).call(J),K=ns.translate(y.x,y.y).scale(Yo(y.zoom,N,k)),ue=[[0,0],[F.width,F.height]],G=J.constrain()(K,ue,w);J.transform(L,G),J.wheelDelta(Zb),$.setState({d3Zoom:J,d3Selection:L,d3ZoomHandler:L.on("wheel.zoom"),transform:[G.x,G.y,G.k],domNode:O.current.closest(".react-flow")})}},[]),b.useEffect(()=>{H&&D&&(l&&!Z&&!R?H.on("wheel.zoom",F=>{if(Mo(F,j))return!1;F.preventDefault(),F.stopImmediatePropagation();const J=H.property("__zoom").k||1;if(F.ctrlKey&&i){const le=or(F),fe=Zb(F),me=J*Math.pow(2,fe);D.scaleTo(H,me,le,F);return}const L=F.deltaMode===1?20:1;let K=f===Ca.Vertical?0:F.deltaX*L,ue=f===Ca.Horizontal?0:F.deltaY*L;!Fu()&&F.shiftKey&&f!==Ca.Vertical&&(K=F.deltaY*L,ue=0),D.translateBy(H,-(K/J)*d,-(ue/J)*d,{internal:!0});const G=fu(H.property("__zoom")),{onViewportChangeStart:U,onViewportChange:ee,onViewportChangeEnd:Y}=$.getState();clearTimeout(P.current),Q.current||(Q.current=!0,t==null||t(F,G),U==null||U(G)),Q.current&&(e==null||e(F,G),ee==null||ee(G),P.current=setTimeout(()=>{n==null||n(F,G),Y==null||Y(G),Q.current=!1},150))},{passive:!1}):typeof X<"u"&&H.on("wheel.zoom",function(F,J){if(!_&&F.type==="wheel"&&!F.ctrlKey||Mo(F,j))return null;F.preventDefault(),X.call(this,F,J)},{passive:!1}))},[R,l,f,H,D,X,Z,i,_,j,t,e,n]),b.useEffect(()=>{D&&D.on("start",F=>{var K,ue;if(!F.sourceEvent||F.sourceEvent.internal)return null;B.current=(K=F.sourceEvent)==null?void 0:K.button;const{onViewportChangeStart:J}=$.getState(),L=fu(F.transform);I.current=!0,A.current=L,((ue=F.sourceEvent)==null?void 0:ue.type)==="mousedown"&&$.setState({paneDragging:!0}),J==null||J(L),t==null||t(F.sourceEvent,L)})},[D,t]),b.useEffect(()=>{D&&(R&&!I.current?D.on("zoom",null):R||D.on("zoom",F=>{var L;const{onViewportChange:J}=$.getState();if($.setState({transform:[F.transform.x,F.transform.y,F.transform.k]}),z.current=!!(s&&Qb(g,B.current??0)),(e||J)&&!((L=F.sourceEvent)!=null&&L.internal)){const K=fu(F.transform);J==null||J(K),e==null||e(F.sourceEvent,K)}}))},[R,D,e,g,s]),b.useEffect(()=>{D&&D.on("end",F=>{if(!F.sourceEvent||F.sourceEvent.internal)return null;const{onViewportChangeEnd:J}=$.getState();if(I.current=!1,$.setState({paneDragging:!1}),s&&Qb(g,B.current??0)&&!z.current&&s(F.sourceEvent),z.current=!1,(n||J)&&nP(A.current,F.transform)){const L=fu(F.transform);A.current=L,clearTimeout(M.current),M.current=setTimeout(()=>{J==null||J(L),n==null||n(F.sourceEvent,L)},l?150:0)}})},[D,l,g,n,s]),b.useEffect(()=>{D&&D.filter(F=>{const J=Z||a,L=i&&F.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&F.button===1&&F.type==="mousedown"&&(Mo(F,"react-flow__node")||Mo(F,"react-flow__edge")))return!0;if(!g&&!J&&!l&&!p&&!i||R||!p&&F.type==="dblclick"||Mo(F,j)&&F.type==="wheel"||Mo(F,C)&&(F.type!=="wheel"||l&&F.type==="wheel"&&!Z)||!i&&F.ctrlKey&&F.type==="wheel"||!J&&!l&&!L&&F.type==="wheel"||!g&&(F.type==="mousedown"||F.type==="touchstart")||Array.isArray(g)&&!g.includes(F.button)&&F.type==="mousedown")return!1;const K=Array.isArray(g)&&g.includes(F.button)||!F.button||F.button<=1;return(!F.ctrlKey||F.type==="wheel")&&K})},[R,D,a,i,l,p,g,h,Z]),he.createElement("div",{className:"react-flow__renderer",ref:O,style:Uw},S)},aP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function oP(){const{userSelectionActive:e,userSelectionRect:t}=ct(aP,Dt);return e&&t?he.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 Jb(e,t){const n=t.parentNode||t.parentId,s=e.find(a=>a.id===n);if(s){const a=t.position.x+t.width-s.width,i=t.position.y+t.height-s.height;if(a>0||i>0||t.position.x<0||t.position.y<0){if(s.style={...s.style},s.style.width=s.style.width??s.width,s.style.height=s.style.height??s.height,a>0&&(s.style.width+=a),i>0&&(s.style.height+=i),t.position.x<0){const l=Math.abs(t.position.x);s.position.x=s.position.x-l,s.style.width+=l,t.position.x=0}if(t.position.y<0){const l=Math.abs(t.position.y);s.position.y=s.position.y-l,s.style.height+=l,t.position.y=0}s.width=s.style.width,s.height=s.style.height}}}function iP(e,t){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const n=e.filter(s=>s.type==="add").map(s=>s.item);return t.reduce((s,a)=>{const i=e.filter(d=>d.id===a.id);if(i.length===0)return s.push(a),s;const l={...a};for(const d of i)if(d)switch(d.type){case"select":{l.selected=d.selected;break}case"position":{typeof d.position<"u"&&(l.position=d.position),typeof d.positionAbsolute<"u"&&(l.positionAbsolute=d.positionAbsolute),typeof d.dragging<"u"&&(l.dragging=d.dragging),l.expandParent&&Jb(s,l);break}case"dimensions":{typeof d.dimensions<"u"&&(l.width=d.dimensions.width,l.height=d.dimensions.height),typeof d.updateStyle<"u"&&(l.style={...l.style||{},...d.dimensions}),typeof d.resizing=="boolean"&&(l.resizing=d.resizing),l.expandParent&&Jb(s,l);break}case"remove":return s}return s.push(l),s},n)}function lP(e,t){return iP(e,t)}const Ps=(e,t)=>({id:e,type:"select",selected:t});function Do(e,t){return e.reduce((n,s)=>{const a=t.includes(s.id);return!s.selected&&a?(s.selected=!0,n.push(Ps(s.id,!0))):s.selected&&!a&&(s.selected=!1,n.push(Ps(s.id,!1))),n},[])}const yf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},cP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),sT=b.memo(({isSelecting:e,selectionMode:t=jl.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:a,onPaneClick:i,onPaneContextMenu:l,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:g})=>{const y=b.useRef(null),w=Mt(),N=b.useRef(0),k=b.useRef(0),E=b.useRef(),{userSelectionActive:_,elementsSelectable:S,dragging:j}=ct(cP,Dt),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,k.current=0},M=X=>{i==null||i(X),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},$=X=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){X.preventDefault();return}l==null||l(X)},I=d?X=>d(X):void 0,z=X=>{const{resetSelectedElements:R,domNode:Z}=w.getState();if(E.current=Z==null?void 0:Z.getBoundingClientRect(),!S||!e||X.button!==0||X.target!==y.current||!E.current)return;const{x:B,y:Q}=Ds(X,E.current);R(),w.setState({userSelectionRect:{width:0,height:0,startX:B,startY:Q,x:B,y:Q}}),s==null||s(X)},O=X=>{const{userSelectionRect:R,nodeInternals:Z,edges:B,transform:Q,onNodesChange:P,onEdgesChange:F,nodeOrigin:J,getNodes:L}=w.getState();if(!e||!E.current||!R)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const K=Ds(X,E.current),ue=R.startX??0,G=R.startY??0,U={...R,x:K.x<ue?K.x:ue,y:K.y<G?K.y:G,width:Math.abs(K.x-ue),height:Math.abs(K.y-G)},ee=L(),Y=FC(Z,U,Q,t===jl.Partial,!0,J),le=zC(Y,B).map(me=>me.id),fe=Y.map(me=>me.id);if(N.current!==fe.length){N.current=fe.length;const me=Do(ee,fe);me.length&&(P==null||P(me))}if(k.current!==le.length){k.current=le.length;const me=Do(B,le);me.length&&(F==null||F(me))}w.setState({userSelectionRect:U})},A=X=>{if(X.button!==0)return;const{userSelectionRect:R}=w.getState();!_&&R&&X.target===y.current&&(M==null||M(X)),w.setState({nodesSelectionActive:N.current>0}),C(),a==null||a(X)},D=X=>{_&&(w.setState({nodesSelectionActive:N.current>0}),a==null||a(X)),C()},H=S&&(e||_);return he.createElement("div",{className:Vt(["react-flow__pane",{dragging:j,selection:e}]),onClick:H?void 0:yf(M,y),onContextMenu:yf($,y),onWheel:yf(I,y),onMouseEnter:H?void 0:f,onMouseDown:H?z:void 0,onMouseMove:H?O:p,onMouseUp:H?A:void 0,onMouseLeave:H?D:h,ref:y,style:Uw},g,he.createElement(oP,null))});sT.displayName="Pane";function aT(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:aT(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 uP(e,t,n,s){return Array.from(e.values()).filter(a=>(a.selected||a.id===s)&&(!a.parentNode||a.parentId||!aT(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var i,l;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=a.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((l=a.positionAbsolute)==null?void 0:l.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 dP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function oT(e,t,n,s,a=[0,0],i){const l=dP(e,e.extent||s);let d=l;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const g=n.get(f),{x:y,y:w}=Ra(g,a).positionAbsolute;d=g&&Gn(y)&&Gn(w)&&Gn(g.width)&&Gn(g.height)?[[y+e.width*a[0],w+e.height*a[1]],[y+g.width-e.width+e.width*a[0],w+g.height-e.height+e.height*a[1]]]:d}else i==null||i("005",ss.error005()),d=l;else if(e.extent&&f&&e.extent!=="parent"){const g=n.get(f),{x:y,y:w}=Ra(g,a).positionAbsolute;d=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(f){const g=n.get(f);p=Ra(g,a).positionAbsolute}const h=d&&d!=="parent"?Pw(t,d):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function vf({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 tk=(e,t,n,s)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const i=Array.from(a),l=t.getBoundingClientRect(),d={x:l.width*s[0],y:l.height*s[1]};return i.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-l.left-d.x)/n,y:(p.top-l.top-d.y)/n,...Ow(f)}})};function ll(e,t,n){return n===void 0?n:s=>{const a=t().nodeInternals.get(e);a&&n(s,{...a})}}function iw({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:a,unselectNodesAndEdges:i,multiSelectionActive:l,nodeInternals:d,onError:f}=t.getState(),p=d.get(e);if(!p){f==null||f("012",ss.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&l)&&(i({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var h;return(h=s==null?void 0:s.current)==null?void 0:h.blur()})):a([e])}function hP(){const e=Mt();return b.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:a,snapToGrid:i}=e.getState(),l=n.touches?n.touches[0].clientX:n.clientX,d=n.touches?n.touches[0].clientY:n.clientY,f={x:(l-s[0])/s[2],y:(d-s[1])/s[2]};return{xSnapped:i?a[0]*Math.round(f.x/a[0]):f.x,ySnapped:i?a[1]*Math.round(f.y/a[1]):f.y,...f}},[])}function wf(e){return(t,n,s)=>e==null?void 0:e(t,s)}function iT({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:a,isSelectable:i,selectNodesOnDrag:l}){const d=Mt(),[f,p]=b.useState(!1),h=b.useRef([]),g=b.useRef({x:null,y:null}),y=b.useRef(0),w=b.useRef(null),N=b.useRef({x:0,y:0}),k=b.useRef(null),E=b.useRef(!1),_=b.useRef(!1),S=b.useRef(!1),j=hP();return b.useEffect(()=>{if(e!=null&&e.current){const C=Hn(e.current),M=({x:z,y:O})=>{const{nodeInternals:A,onNodeDrag:D,onSelectionDrag:H,updateNodePositions:X,nodeExtent:R,snapGrid:Z,snapToGrid:B,nodeOrigin:Q,onError:P}=d.getState();g.current={x:z,y:O};let F=!1,J={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&R){const K=ad(h.current,Q);J=El(K)}if(h.current=h.current.map(K=>{const ue={x:z-K.distance.x,y:O-K.distance.y};B&&(ue.x=Z[0]*Math.round(ue.x/Z[0]),ue.y=Z[1]*Math.round(ue.y/Z[1]));const G=[[R[0][0],R[0][1]],[R[1][0],R[1][1]]];h.current.length>1&&R&&!K.extent&&(G[0][0]=K.positionAbsolute.x-J.x+R[0][0],G[1][0]=K.positionAbsolute.x+(K.width??0)-J.x2+R[1][0],G[0][1]=K.positionAbsolute.y-J.y+R[0][1],G[1][1]=K.positionAbsolute.y+(K.height??0)-J.y2+R[1][1]);const U=oT(K,ue,A,G,Q,P);return F=F||K.position.x!==U.position.x||K.position.y!==U.position.y,K.position=U.position,K.positionAbsolute=U.positionAbsolute,K}),!F)return;X(h.current,!0,!0),p(!0);const L=a?D:wf(H);if(L&&k.current){const[K,ue]=vf({nodeId:a,dragItems:h.current,nodeInternals:A});L(k.current,K,ue)}},$=()=>{if(!w.current)return;const[z,O]=TC(N.current,w.current);if(z!==0||O!==0){const{transform:A,panBy:D}=d.getState();g.current.x=(g.current.x??0)-z/A[2],g.current.y=(g.current.y??0)-O/A[2],D({x:z,y:O})&&M(g.current)}y.current=requestAnimationFrame($)},I=z=>{var Q;const{nodeInternals:O,multiSelectionActive:A,nodesDraggable:D,unselectNodesAndEdges:H,onNodeDragStart:X,onSelectionDragStart:R}=d.getState();_.current=!0;const Z=a?X:wf(R);(!l||!i)&&!A&&a&&((Q=O.get(a))!=null&&Q.selected||H()),a&&i&&l&&iw({id:a,store:d,nodeRef:e});const B=j(z);if(g.current=B,h.current=uP(O,D,B,a),Z&&h.current){const[P,F]=vf({nodeId:a,dragItems:h.current,nodeInternals:O});Z(z.sourceEvent,P,F)}};if(t)C.on(".drag",null);else{const z=kI().on("start",O=>{const{domNode:A,nodeDragThreshold:D}=d.getState();D===0&&I(O),S.current=!1;const H=j(O);g.current=H,w.current=(A==null?void 0:A.getBoundingClientRect())||null,N.current=Ds(O.sourceEvent,w.current)}).on("drag",O=>{var X,R;const A=j(O),{autoPanOnNodeDrag:D,nodeDragThreshold:H}=d.getState();if(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1&&(S.current=!0),!S.current){if(!E.current&&_.current&&D&&(E.current=!0,$()),!_.current){const Z=A.xSnapped-(((X=g==null?void 0:g.current)==null?void 0:X.x)??0),B=A.ySnapped-(((R=g==null?void 0:g.current)==null?void 0:R.y)??0);Math.sqrt(Z*Z+B*B)>H&&I(O)}(g.current.x!==A.xSnapped||g.current.y!==A.ySnapped)&&h.current&&_.current&&(k.current=O.sourceEvent,N.current=Ds(O.sourceEvent,w.current),M(A))}}).on("end",O=>{if(!(!_.current||S.current)&&(p(!1),E.current=!1,_.current=!1,cancelAnimationFrame(y.current),h.current)){const{updateNodePositions:A,nodeInternals:D,onNodeDragStop:H,onSelectionDragStop:X}=d.getState(),R=a?H:wf(X);if(A(h.current,!1,!1),R){const[Z,B]=vf({nodeId:a,dragItems:h.current,nodeInternals:D});R(O.sourceEvent,Z,B)}}}).filter(O=>{const A=O.target;return!O.button&&(!n||!ek(A,`.${n}`,e))&&(!s||ek(A,s,e))});return C.call(z),()=>{C.on(".drag",null)}}}},[e,t,n,s,i,d,a,l,j]),f}function lT(){const e=Mt();return b.useCallback(n=>{const{nodeInternals:s,nodeExtent:a,updateNodePositions:i,getNodes:l,snapToGrid:d,snapGrid:f,onError:p,nodesDraggable:h}=e.getState(),g=l().filter(S=>S.selected&&(S.draggable||h&&typeof S.draggable>"u")),y=d?f[0]:5,w=d?f[1]:5,N=n.isShiftPressed?4:1,k=n.x*y*N,E=n.y*w*N,_=g.map(S=>{if(S.positionAbsolute){const j={x:S.positionAbsolute.x+k,y:S.positionAbsolute.y+E};d&&(j.x=f[0]*Math.round(j.x/f[0]),j.y=f[1]*Math.round(j.y/f[1]));const{positionAbsolute:C,position:M}=oT(S,j,s,a,void 0,p);S.position=M,S.positionAbsolute=C}return S});i(_,!0,!1)},[])}const Uo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var cl=e=>{const t=({id:n,type:s,data:a,xPos:i,yPos:l,xPosOrigin:d,yPosOrigin:f,selected:p,onClick:h,onMouseEnter:g,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:k,style:E,className:_,isDraggable:S,isSelectable:j,isConnectable:C,isFocusable:M,selectNodesOnDrag:$,sourcePosition:I,targetPosition:z,hidden:O,resizeObserver:A,dragHandle:D,zIndex:H,isParent:X,noDragClassName:R,noPanClassName:Z,initialized:B,disableKeyboardA11y:Q,ariaLabel:P,rfId:F,hasHandleBounds:J})=>{const L=Mt(),K=b.useRef(null),ue=b.useRef(null),G=b.useRef(I),U=b.useRef(z),ee=b.useRef(s),Y=j||S||h||g||y||w,le=lT(),fe=ll(n,L.getState,g),me=ll(n,L.getState,y),ke=ll(n,L.getState,w),Ve=ll(n,L.getState,N),Le=ll(n,L.getState,k),qe=be=>{const{nodeDragThreshold:re}=L.getState();if(j&&(!$||!S||re>0)&&iw({id:n,store:L,nodeRef:K}),h){const Qe=L.getState().nodeInternals.get(n);Qe&&h(be,{...Qe})}},Ne=be=>{if(!nw(be)&&!Q)if(IC.includes(be.key)&&j){const re=be.key==="Escape";iw({id:n,store:L,unselect:re,nodeRef:K})}else S&&p&&Object.prototype.hasOwnProperty.call(Uo,be.key)&&(L.setState({ariaLiveMessage:`Moved selected node ${be.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~l}`}),le({x:Uo[be.key].x,y:Uo[be.key].y,isShiftPressed:be.shiftKey}))};b.useEffect(()=>()=>{ue.current&&(A==null||A.unobserve(ue.current),ue.current=null)},[]),b.useEffect(()=>{if(K.current&&!O){const be=K.current;(!B||!J||ue.current!==be)&&(ue.current&&(A==null||A.unobserve(ue.current)),A==null||A.observe(be),ue.current=be)}},[O,B,J]),b.useEffect(()=>{const be=ee.current!==s,re=G.current!==I,Qe=U.current!==z;K.current&&(be||re||Qe)&&(be&&(ee.current=s),re&&(G.current=I),Qe&&(U.current=z),L.getState().updateNodeDimensions([{id:n,nodeElement:K.current,forceUpdate:!0}]))},[n,s,I,z]);const Ge=iT({nodeRef:K,disabled:O||!S,noDragClassName:R,handleSelector:D,nodeId:n,isSelectable:j,selectNodesOnDrag:$});return O?null:he.createElement("div",{className:Vt(["react-flow__node",`react-flow__node-${s}`,{[Z]:S},_,{selected:p,selectable:j,parent:X,dragging:Ge}]),ref:K,style:{zIndex:H,transform:`translate(${d}px,${f}px)`,pointerEvents:Y?"all":"none",visibility:B?"visible":"hidden",...E},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:fe,onMouseMove:me,onMouseLeave:ke,onContextMenu:Ve,onClick:qe,onDoubleClick:Le,onKeyDown:M?Ne:void 0,tabIndex:M?0:void 0,role:M?"button":void 0,"aria-describedby":Q?void 0:`${JC}-${F}`,"aria-label":P},he.createElement(NO,{value:n},he.createElement(e,{id:n,data:a,type:s,xPos:i,yPos:l,selected:p,isConnectable:C,sourcePosition:I,targetPosition:z,dragging:Ge,dragHandle:D,zIndex:H})))};return t.displayName="NodeWrapper",b.memo(t)};const fP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...ad(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function pP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Mt(),{width:a,height:i,x:l,y:d,transformString:f,userSelectionActive:p}=ct(fP,Dt),h=lT(),g=b.useRef(null);if(b.useEffect(()=>{var N;n||(N=g.current)==null||N.focus({preventScroll:!0})},[n]),iT({nodeRef:g}),p||!a||!i)return null;const y=e?N=>{const k=s.getState().getNodes().filter(E=>E.selected);e(N,k)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(Uo,N.key)&&h({x:Uo[N.key].x,y:Uo[N.key].y,isShiftPressed:N.shiftKey})};return he.createElement("div",{className:Vt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},he.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:a,height:i,top:d,left:l}}))}var mP=b.memo(pP);const gP=e=>e.nodesSelectionActive,cT=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:l,deleteKeyCode:d,onMove:f,onMoveStart:p,onMoveEnd:h,selectionKeyCode:g,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:k,multiSelectionKeyCode:E,panActivationKeyCode:_,zoomActivationKeyCode:S,elementsSelectable:j,zoomOnScroll:C,zoomOnPinch:M,panOnScroll:$,panOnScrollSpeed:I,panOnScrollMode:z,zoomOnDoubleClick:O,panOnDrag:A,defaultViewport:D,translateExtent:H,minZoom:X,maxZoom:R,preventScrolling:Z,onSelectionContextMenu:B,noWheelClassName:Q,noPanClassName:P,disableKeyboardA11y:F})=>{const J=ct(gP),L=Cl(g),K=Cl(_),ue=K||A,G=K||$,U=L||y&&ue!==!0;return eP({deleteKeyCode:d,multiSelectionKeyCode:E}),he.createElement(sP,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:j,zoomOnScroll:C,zoomOnPinch:M,panOnScroll:G,panOnScrollSpeed:I,panOnScrollMode:z,zoomOnDoubleClick:O,panOnDrag:!L&&ue,defaultViewport:D,translateExtent:H,minZoom:X,maxZoom:R,zoomActivationKeyCode:S,preventScrolling:Z,noWheelClassName:Q,noPanClassName:P},he.createElement(sT,{onSelectionStart:N,onSelectionEnd:k,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:l,panOnDrag:ue,isSelecting:!!U,selectionMode:w},e,J&&he.createElement(mP,{onSelectionContextMenu:B,noPanClassName:P,disableKeyboardA11y:F})))};cT.displayName="FlowRenderer";var yP=b.memo(cT);function vP(e){return ct(b.useCallback(n=>e?FC(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function wP(e){const t={input:cl(e.input||KC),default:cl(e.default||ow),output:cl(e.output||QC),group:cl(e.group||Bw)},n={},s=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,i)=>(a[i]=cl(e[i]||ow),a),n);return{...t,...s}}const xP=({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]},bP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),uT=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:a,updateNodeDimensions:i,onError:l}=ct(bP,Dt),d=vP(e.onlyRenderVisibleElements),f=b.useRef(),p=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(g=>{const y=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));i(y)});return f.current=h,h},[]);return b.useEffect(()=>()=>{var h;(h=f==null?void 0:f.current)==null||h.disconnect()},[]),he.createElement("div",{className:"react-flow__nodes",style:Uw},d.map(h=>{var M,$,I;let g=h.type||"default";e.nodeTypes[g]||(l==null||l("003",ss.error003(g)),g="default");const y=e.nodeTypes[g]||e.nodeTypes.default,w=!!(h.draggable||t&&typeof h.draggable>"u"),N=!!(h.selectable||a&&typeof h.selectable>"u"),k=!!(h.connectable||n&&typeof h.connectable>"u"),E=!!(h.focusable||s&&typeof h.focusable>"u"),_=e.nodeExtent?Pw(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,S=(_==null?void 0:_.x)??0,j=(_==null?void 0:_.y)??0,C=xP({x:S,y:j,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return he.createElement(y,{key:h.id,id:h.id,className:h.className,style:h.style,type:g,data:h.data,sourcePosition:h.sourcePosition||Oe.Bottom,targetPosition:h.targetPosition||Oe.Top,hidden:h.hidden,xPos:S,yPos:j,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!h.selected,isDraggable:w,isSelectable:N,isConnectable:k,isFocusable:E,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((M=h[jt])==null?void 0:M.z)??0,isParent:!!(($=h[jt])!=null&&$.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((I=h[jt])!=null&&I.handleBounds)})}))};uT.displayName="NodeRenderer";var kP=b.memo(uT);const _P=(e,t,n)=>n===Oe.Left?e-t:n===Oe.Right?e+t:e,SP=(e,t,n)=>n===Oe.Top?e-t:n===Oe.Bottom?e+t:e,nk="react-flow__edgeupdater",rk=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:a,onMouseEnter:i,onMouseOut:l,type:d})=>he.createElement("circle",{onMouseDown:a,onMouseEnter:i,onMouseOut:l,className:Vt([nk,`${nk}-${d}`]),cx:_P(t,s,e),cy:SP(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),NP=()=>!0;var Io=e=>{const t=({id:n,className:s,type:a,data:i,onClick:l,onEdgeDoubleClick:d,selected:f,animated:p,label:h,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:k,style:E,source:_,target:S,sourceX:j,sourceY:C,targetX:M,targetY:$,sourcePosition:I,targetPosition:z,elementsSelectable:O,hidden:A,sourceHandleId:D,targetHandleId:H,onContextMenu:X,onMouseEnter:R,onMouseMove:Z,onMouseLeave:B,reconnectRadius:Q,onReconnect:P,onReconnectStart:F,onReconnectEnd:J,markerEnd:L,markerStart:K,rfId:ue,ariaLabel:G,isFocusable:U,isReconnectable:ee,pathOptions:Y,interactionWidth:le,disableKeyboardA11y:fe})=>{const me=b.useRef(null),[ke,Ve]=b.useState(!1),[Le,qe]=b.useState(!1),Ne=Mt(),Ge=b.useMemo(()=>`url('#${sw(K,ue)}')`,[K,ue]),be=b.useMemo(()=>`url('#${sw(L,ue)}')`,[L,ue]);if(A)return null;const re=Se=>{var Ae;const{edges:De,addSelectedEdges:_e,unselectNodesAndEdges:Be,multiSelectionActive:_t}=Ne.getState(),vt=De.find(it=>it.id===n);vt&&(O&&(Ne.setState({nodesSelectionActive:!1}),vt.selected&&_t?(Be({nodes:[],edges:[vt]}),(Ae=me.current)==null||Ae.blur()):_e([n])),l&&l(Se,vt))},Qe=il(n,Ne.getState,d),ft=il(n,Ne.getState,X),ut=il(n,Ne.getState,R),at=il(n,Ne.getState,Z),Ye=il(n,Ne.getState,B),pe=(Se,De)=>{if(Se.button!==0)return;const{edges:_e,isValidConnection:Be}=Ne.getState(),_t=De?S:_,vt=(De?H:D)||null,Ae=De?"target":"source",it=Be||NP,wt=De,xt=_e.find(In=>In.id===n);qe(!0),F==null||F(Se,xt,Ae);const nn=In=>{qe(!1),J==null||J(In,xt,Ae)};HC({event:Se,handleId:vt,nodeId:_t,onConnect:In=>P==null?void 0:P(xt,In),isTarget:wt,getState:Ne.getState,setState:Ne.setState,isValidConnection:it,edgeUpdaterType:Ae,onReconnectEnd:nn})},we=Se=>pe(Se,!0),Pe=Se=>pe(Se,!1),Ue=()=>Ve(!0),ot=()=>Ve(!1),$e=!O&&!l,se=Se=>{var De;if(!fe&&IC.includes(Se.key)&&O){const{unselectNodesAndEdges:_e,addSelectedEdges:Be,edges:_t}=Ne.getState();Se.key==="Escape"?((De=me.current)==null||De.blur(),_e({edges:[_t.find(Ae=>Ae.id===n)]})):Be([n])}};return he.createElement("g",{className:Vt(["react-flow__edge",`react-flow__edge-${a}`,s,{selected:f,animated:p,inactive:$e,updating:ke}]),onClick:re,onDoubleClick:Qe,onContextMenu:ft,onMouseEnter:ut,onMouseMove:at,onMouseLeave:Ye,onKeyDown:U?se:void 0,tabIndex:U?0:void 0,role:U?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":G===null?void 0:G||`Edge from ${_} to ${S}`,"aria-describedby":U?`${eT}-${ue}`:void 0,ref:me},!Le&&he.createElement(e,{id:n,source:_,target:S,selected:f,animated:p,label:h,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:k,data:i,style:E,sourceX:j,sourceY:C,targetX:M,targetY:$,sourcePosition:I,targetPosition:z,sourceHandleId:D,targetHandleId:H,markerStart:Ge,markerEnd:be,pathOptions:Y,interactionWidth:le}),ee&&he.createElement(he.Fragment,null,(ee==="source"||ee===!0)&&he.createElement(rk,{position:I,centerX:j,centerY:C,radius:Q,onMouseDown:we,onMouseEnter:Ue,onMouseOut:ot,type:"source"}),(ee==="target"||ee===!0)&&he.createElement(rk,{position:z,centerX:M,centerY:$,radius:Q,onMouseDown:Pe,onMouseEnter:Ue,onMouseOut:ot,type:"target"})))};return t.displayName="EdgeWrapper",b.memo(t)};function EP(e){const t={default:Io(e.default||Bu),straight:Io(e.bezier||qw),step:Io(e.step||Dw),smoothstep:Io(e.step||sd),simplebezier:Io(e.simplebezier||Lw)},n={},s=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,i)=>(a[i]=Io(e[i]||Bu),a),n);return{...t,...s}}function sk(e,t,n=null){const s=((n==null?void 0:n.x)||0)+t.x,a=((n==null?void 0:n.y)||0)+t.y,i=(n==null?void 0:n.width)||t.width,l=(n==null?void 0:n.height)||t.height;switch(e){case Oe.Top:return{x:s+i/2,y:a};case Oe.Right:return{x:s+i,y:a+l/2};case Oe.Bottom:return{x:s+i/2,y:a+l};case Oe.Left:return{x:s,y:a+l/2}}}function ak(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const jP=(e,t,n,s,a,i)=>{const l=sk(n,e,t),d=sk(i,s,a);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y}};function CP({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:a,targetHeight:i,width:l,height:d,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+a),y2:Math.max(e.y+s,t.y+i)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const h=El({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:l/f[2],height:d/f[2]}),g=Math.max(0,Math.min(h.x2,p.x2)-Math.max(h.x,p.x)),y=Math.max(0,Math.min(h.y2,p.y2)-Math.max(h.y,p.y));return Math.ceil(g*y)>0}function ok(e){var s,a,i,l,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((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.y)<"u";return[{x:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.x)||0,y:((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 TP=[{level:0,isMaxLevel:!0,edges:[]}];function RP(e,t,n=!1){let s=-1;const a=e.reduce((l,d)=>{var h,g;const f=Gn(d.zIndex);let p=f?d.zIndex:0;if(n){const y=t.get(d.target),w=t.get(d.source),N=d.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),k=Math.max(((h=w==null?void 0:w[jt])==null?void 0:h.z)||0,((g=y==null?void 0:y[jt])==null?void 0:g.z)||0,1e3);p=(f?d.zIndex:0)+(N?k:0)}return l[p]?l[p].push(d):l[p]=[d],s=p>s?p:s,l},{}),i=Object.entries(a).map(([l,d])=>{const f=+l;return{edges:d,level:f,isMaxLevel:f===s}});return i.length===0?TP:i}function AP(e,t,n){const s=ct(b.useCallback(a=>e?a.edges.filter(i=>{const l=t.get(i.source),d=t.get(i.target);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&(d==null?void 0:d.width)&&(d==null?void 0:d.height)&&CP({sourcePos:l.positionAbsolute||{x:0,y:0},targetPos:d.positionAbsolute||{x:0,y:0},sourceWidth:l.width,sourceHeight:l.height,targetWidth:d.width,targetHeight:d.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return RP(s,t,n)}const MP=({color:e="none",strokeWidth:t=1})=>he.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),IP=({color:e="none",strokeWidth:t=1})=>he.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),ik={[zu.Arrow]:MP,[zu.ArrowClosed]:IP};function $P(e){const t=Mt();return b.useMemo(()=>{var a,i;return Object.prototype.hasOwnProperty.call(ik,e)?ik[e]:((i=(a=t.getState()).onError)==null||i.call(a,"009",ss.error009(e)),null)},[e])}const OP=({id:e,type:t,color:n,width:s=12.5,height:a=12.5,markerUnits:i="strokeWidth",strokeWidth:l,orient:d="auto-start-reverse"})=>{const f=$P(t);return f?he.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:d,refX:"0",refY:"0"},he.createElement(f,{color:n,strokeWidth:l})):null},PP=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((a,i)=>([i.markerStart,i.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const d=sw(l,t);s.includes(d)||(a.push({id:d,color:l.color||e,...l}),s.push(d))}}),a),[]).sort((a,i)=>a.id.localeCompare(i.id))},dT=({defaultColor:e,rfId:t})=>{const n=ct(b.useCallback(PP({defaultColor:e,rfId:t}),[e,t]),(s,a)=>!(s.length!==a.length||s.some((i,l)=>i.id!==a[l].id)));return he.createElement("defs",null,n.map(s=>he.createElement(OP,{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})))};dT.displayName="MarkerDefinitions";var LP=b.memo(dT);const DP=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}),hT=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:a,noPanClassName:i,onEdgeContextMenu:l,onEdgeMouseEnter:d,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:k,children:E,disableKeyboardA11y:_})=>{const{edgesFocusable:S,edgesUpdatable:j,elementsSelectable:C,width:M,height:$,connectionMode:I,nodeInternals:z,onError:O}=ct(DP,Dt),A=AP(t,z,n);return M?he.createElement(he.Fragment,null,A.map(({level:D,edges:H,isMaxLevel:X})=>he.createElement("svg",{key:D,style:{zIndex:D},width:M,height:$,className:"react-flow__edges react-flow__container"},X&&he.createElement(LP,{defaultColor:e,rfId:s}),he.createElement("g",null,H.map(R=>{const[Z,B,Q]=ok(z.get(R.source)),[P,F,J]=ok(z.get(R.target));if(!Q||!J)return null;let L=R.type||"default";a[L]||(O==null||O("011",ss.error011(L)),L="default");const K=a[L]||a.default,ue=I===Ma.Strict?F.target:(F.target??[]).concat(F.source??[]),G=ak(B.source,R.sourceHandle),U=ak(ue,R.targetHandle),ee=(G==null?void 0:G.position)||Oe.Bottom,Y=(U==null?void 0:U.position)||Oe.Top,le=!!(R.focusable||S&&typeof R.focusable>"u"),fe=R.reconnectable||R.updatable,me=typeof y<"u"&&(fe||j&&typeof fe>"u");if(!G||!U)return O==null||O("008",ss.error008(G,R)),null;const{sourceX:ke,sourceY:Ve,targetX:Le,targetY:qe}=jP(Z,G,ee,P,U,Y);return he.createElement(K,{key:R.id,id:R.id,className:Vt([R.className,i]),type:L,data:R.data,selected:!!R.selected,animated:!!R.animated,hidden:!!R.hidden,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,style:R.style,source:R.source,target:R.target,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerEnd:R.markerEnd,markerStart:R.markerStart,sourceX:ke,sourceY:Ve,targetX:Le,targetY:qe,sourcePosition:ee,targetPosition:Y,elementsSelectable:C,onContextMenu:l,onMouseEnter:d,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:k,rfId:s,ariaLabel:R.ariaLabel,isFocusable:le,isReconnectable:me,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth,disableKeyboardA11y:_})})))),E):null};hT.displayName="EdgeRenderer";var qP=b.memo(hT);const FP=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function zP({children:e}){const t=ct(FP);return he.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function BP(e){const t=Dl(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const UP={[Oe.Left]:Oe.Right,[Oe.Right]:Oe.Left,[Oe.Top]:Oe.Bottom,[Oe.Bottom]:Oe.Top},fT=({nodeId:e,handleType:t,style:n,type:s=Ls.Bezier,CustomComponent:a,connectionStatus:i})=>{var $,I,z;const{fromNode:l,handleId:d,toX:f,toY:p,connectionMode:h}=ct(b.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]),Dt),g=($=l==null?void 0:l[jt])==null?void 0:$.handleBounds;let y=g==null?void 0:g[t];if(h===Ma.Loose&&(y=y||(g==null?void 0:g[t==="source"?"target":"source"])),!l||!y)return null;const w=d?y.find(O=>O.id===d):y[0],N=w?w.x+w.width/2:(l.width??0)/2,k=w?w.y+w.height/2:l.height??0,E=(((I=l.positionAbsolute)==null?void 0:I.x)??0)+N,_=(((z=l.positionAbsolute)==null?void 0:z.y)??0)+k,S=w==null?void 0:w.position,j=S?UP[S]:null;if(!S||!j)return null;if(a)return he.createElement(a,{connectionLineType:s,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:E,fromY:_,toX:f,toY:p,fromPosition:S,toPosition:j,connectionStatus:i});let C="";const M={sourceX:E,sourceY:_,sourcePosition:S,targetX:f,targetY:p,targetPosition:j};return s===Ls.Bezier?[C]=DC(M):s===Ls.Step?[C]=rw({...M,borderRadius:0}):s===Ls.SmoothStep?[C]=rw(M):s===Ls.SimpleBezier?[C]=LC(M):C=`M${E},${_} ${f},${p}`,he.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};fT.displayName="ConnectionLine";const WP=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function HP({containerStyle:e,style:t,type:n,component:s}){const{nodeId:a,handleType:i,nodesConnectable:l,width:d,height:f,connectionStatus:p}=ct(WP,Dt);return!(a&&i&&d&&l)?null:he.createElement("svg",{style:e,width:d,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},he.createElement("g",{className:Vt(["react-flow__connection",p])},he.createElement(fT,{nodeId:a,handleType:i,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function lk(e,t){return b.useRef(null),Mt(),b.useMemo(()=>t(e),[e])}const pT=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:a,onInit:i,onNodeClick:l,onEdgeClick:d,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:k,onSelectionEnd:E,connectionLineType:_,connectionLineStyle:S,connectionLineComponent:j,connectionLineContainerStyle:C,selectionKeyCode:M,selectionOnDrag:$,selectionMode:I,multiSelectionKeyCode:z,panActivationKeyCode:O,zoomActivationKeyCode:A,deleteKeyCode:D,onlyRenderVisibleElements:H,elementsSelectable:X,selectNodesOnDrag:R,defaultViewport:Z,translateExtent:B,minZoom:Q,maxZoom:P,preventScrolling:F,defaultMarkerColor:J,zoomOnScroll:L,zoomOnPinch:K,panOnScroll:ue,panOnScrollSpeed:G,panOnScrollMode:U,zoomOnDoubleClick:ee,panOnDrag:Y,onPaneClick:le,onPaneMouseEnter:fe,onPaneMouseMove:me,onPaneMouseLeave:ke,onPaneScroll:Ve,onPaneContextMenu:Le,onEdgeContextMenu:qe,onEdgeMouseEnter:Ne,onEdgeMouseMove:Ge,onEdgeMouseLeave:be,onReconnect:re,onReconnectStart:Qe,onReconnectEnd:ft,reconnectRadius:ut,noDragClassName:at,noWheelClassName:Ye,noPanClassName:pe,elevateEdgesOnSelect:we,disableKeyboardA11y:Pe,nodeOrigin:Ue,nodeExtent:ot,rfId:$e})=>{const se=lk(e,wP),Se=lk(t,EP);return BP(i),he.createElement(yP,{onPaneClick:le,onPaneMouseEnter:fe,onPaneMouseMove:me,onPaneMouseLeave:ke,onPaneContextMenu:Le,onPaneScroll:Ve,deleteKeyCode:D,selectionKeyCode:M,selectionOnDrag:$,selectionMode:I,onSelectionStart:k,onSelectionEnd:E,multiSelectionKeyCode:z,panActivationKeyCode:O,zoomActivationKeyCode:A,elementsSelectable:X,onMove:n,onMoveStart:s,onMoveEnd:a,zoomOnScroll:L,zoomOnPinch:K,zoomOnDoubleClick:ee,panOnScroll:ue,panOnScrollSpeed:G,panOnScrollMode:U,panOnDrag:Y,defaultViewport:Z,translateExtent:B,minZoom:Q,maxZoom:P,onSelectionContextMenu:N,preventScrolling:F,noDragClassName:at,noWheelClassName:Ye,noPanClassName:pe,disableKeyboardA11y:Pe},he.createElement(zP,null,he.createElement(qP,{edgeTypes:Se,onEdgeClick:d,onEdgeDoubleClick:p,onlyRenderVisibleElements:H,onEdgeContextMenu:qe,onEdgeMouseEnter:Ne,onEdgeMouseMove:Ge,onEdgeMouseLeave:be,onReconnect:re,onReconnectStart:Qe,onReconnectEnd:ft,reconnectRadius:ut,defaultMarkerColor:J,noPanClassName:pe,elevateEdgesOnSelect:!!we,disableKeyboardA11y:Pe,rfId:$e},he.createElement(HP,{style:S,type:_,component:j,containerStyle:C})),he.createElement("div",{className:"react-flow__edgelabel-renderer"}),he.createElement(kP,{nodeTypes:se,onNodeClick:l,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:R,onlyRenderVisibleElements:H,noPanClassName:pe,noDragClassName:at,disableKeyboardA11y:Pe,nodeOrigin:Ue,nodeExtent:ot,rfId:$e})))};pT.displayName="GraphView";var GP=b.memo(pT);const lw=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Is={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:lw,nodeExtent:lw,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Ma.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:wO,isValidConnection:void 0},VP=()=>$M((e,t)=>({...Is,setNodes:n=>{const{nodeInternals:s,nodeOrigin:a,elevateNodesOnSelect:i}=t();e({nodeInternals:gf(n,s,a,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:s={}}=t();e({edges:n.map(a=>({...s,...a}))})},setDefaultNodesAndEdges:(n,s)=>{const a=typeof n<"u",i=typeof s<"u",l=a?gf(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:i?s:[],hasDefaultNodes:a,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:a,fitViewOnInit:i,fitViewOnInitDone:l,fitViewOnInitOptions:d,domNode:f,nodeOrigin:p}=t(),h=f==null?void 0:f.querySelector(".react-flow__viewport");if(!h)return;const g=window.getComputedStyle(h),{m22:y}=new window.DOMMatrixReadOnly(g.transform),w=n.reduce((k,E)=>{const _=a.get(E.id);if(_!=null&&_.hidden)a.set(_.id,{..._,[jt]:{..._[jt],handleBounds:void 0}});else if(_){const S=Ow(E.nodeElement);!!(S.width&&S.height&&(_.width!==S.width||_.height!==S.height||E.forceUpdate))&&(a.set(_.id,{..._,[jt]:{..._[jt],handleBounds:{source:tk(".source",E.nodeElement,y,p),target:tk(".target",E.nodeElement,y,p)}},...S}),k.push({id:_.id,type:"dimensions",dimensions:S}))}return k},[]);nT(a,p);const N=l||i&&!l&&rT(t,{initial:!0,...d});e({nodeInternals:new Map(a),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(s==null||s(w))},updateNodePositions:(n,s=!0,a=!1)=>{const{triggerNodeChanges:i}=t(),l=n.map(d=>{const f={id:d.id,type:"position",dragging:a};return s&&(f.positionAbsolute=d.positionAbsolute,f.position=d.position),f});i(l)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:a,hasDefaultNodes:i,nodeOrigin:l,getNodes:d,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(i){const p=lP(n,d()),h=gf(p,a,l,f);e({nodeInternals:h})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let l,d=null;s?l=n.map(f=>Ps(f,!0)):(l=Do(i(),n),d=Do(a,[])),hu({changedNodes:l,changedEdges:d,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let l,d=null;s?l=n.map(f=>Ps(f,!0)):(l=Do(a,n),d=Do(i(),[])),hu({changedNodes:d,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:a,getNodes:i}=t(),l=n||i(),d=s||a,f=l.map(h=>(h.selected=!1,Ps(h.id,!1))),p=d.map(h=>Ps(h.id,!1));hu({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:a}=t();s==null||s.scaleExtent([n,a]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:a}=t();s==null||s.scaleExtent([a,n]),e({maxZoom:n})},setTranslateExtent:n=>{var s;(s=t().d3Zoom)==null||s.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:s}=t(),i=s().filter(d=>d.selected).map(d=>Ps(d.id,!1)),l=n.filter(d=>d.selected).map(d=>Ps(d.id,!1));hu({changedNodes:i,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(a=>{a.positionAbsolute=Pw(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:a,height:i,d3Zoom:l,d3Selection:d,translateExtent:f}=t();if(!l||!d||!n.x&&!n.y)return!1;const p=ns.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),h=[[0,0],[a,i]],g=l==null?void 0:l.constrain()(p,h,f);return l.transform(d,g),s[0]!==g.x||s[1]!==g.y||s[2]!==g.k},cancelConnection:()=>e({connectionNodeId:Is.connectionNodeId,connectionHandleId:Is.connectionHandleId,connectionHandleType:Is.connectionHandleType,connectionStatus:Is.connectionStatus,connectionStartHandle:Is.connectionStartHandle,connectionEndHandle:Is.connectionEndHandle}),reset:()=>e({...Is})}),Object.is),Ww=({children:e})=>{const t=b.useRef(null);return t.current||(t.current=VP()),he.createElement(hO,{value:t.current},e)};Ww.displayName="ReactFlowProvider";const mT=({children:e})=>b.useContext(rd)?he.createElement(he.Fragment,null,e):he.createElement(Ww,null,e);mT.displayName="ReactFlowWrapper";const YP={input:KC,default:ow,output:QC,group:Bw},KP={default:Bu,straight:qw,step:Dw,smoothstep:sd,simplebezier:Lw},XP=[0,0],QP=[15,15],ZP={x:0,y:0,zoom:1},JP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},gT=b.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:a,nodeTypes:i=YP,edgeTypes:l=KP,onNodeClick:d,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:g,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:k,onClickConnectStart:E,onClickConnectEnd:_,onNodeMouseEnter:S,onNodeMouseMove:j,onNodeMouseLeave:C,onNodeContextMenu:M,onNodeDoubleClick:$,onNodeDragStart:I,onNodeDrag:z,onNodeDragStop:O,onNodesDelete:A,onEdgesDelete:D,onSelectionChange:H,onSelectionDragStart:X,onSelectionDrag:R,onSelectionDragStop:Z,onSelectionContextMenu:B,onSelectionStart:Q,onSelectionEnd:P,connectionMode:F=Ma.Strict,connectionLineType:J=Ls.Bezier,connectionLineStyle:L,connectionLineComponent:K,connectionLineContainerStyle:ue,deleteKeyCode:G="Backspace",selectionKeyCode:U="Shift",selectionOnDrag:ee=!1,selectionMode:Y=jl.Full,panActivationKeyCode:le="Space",multiSelectionKeyCode:fe=Fu()?"Meta":"Control",zoomActivationKeyCode:me=Fu()?"Meta":"Control",snapToGrid:ke=!1,snapGrid:Ve=QP,onlyRenderVisibleElements:Le=!1,selectNodesOnDrag:qe=!0,nodesDraggable:Ne,nodesConnectable:Ge,nodesFocusable:be,nodeOrigin:re=XP,edgesFocusable:Qe,edgesUpdatable:ft,elementsSelectable:ut,defaultViewport:at=ZP,minZoom:Ye=.5,maxZoom:pe=2,translateExtent:we=lw,preventScrolling:Pe=!0,nodeExtent:Ue,defaultMarkerColor:ot="#b1b1b7",zoomOnScroll:$e=!0,zoomOnPinch:se=!0,panOnScroll:Se=!1,panOnScrollSpeed:De=.5,panOnScrollMode:_e=Ca.Free,zoomOnDoubleClick:Be=!0,panOnDrag:_t=!0,onPaneClick:vt,onPaneMouseEnter:Ae,onPaneMouseMove:it,onPaneMouseLeave:wt,onPaneScroll:xt,onPaneContextMenu:nn,children:rn,onEdgeContextMenu:In,onEdgeDoubleClick:Da,onEdgeMouseEnter:qa,onEdgeMouseMove:Fa,onEdgeMouseLeave:wn,onEdgeUpdate:Bs,onEdgeUpdateStart:za,onEdgeUpdateEnd:$t,onReconnect:mr,onReconnectStart:Kn,onReconnectEnd:li,reconnectRadius:Rr=10,edgeUpdaterRadius:Ar=10,onNodesChange:Mr,onEdgesChange:is,noDragClassName:Us="nodrag",noWheelClassName:Ba="nowheel",noPanClassName:Ws="nopan",fitView:$n=!1,fitViewOptions:Ua,connectOnClick:Hs=!0,attributionPosition:ci,proOptions:Ir,defaultEdgeOptions:Gs,elevateNodesOnSelect:Wa=!0,elevateEdgesOnSelect:$r=!1,disableKeyboardA11y:Vs=!1,autoPanOnConnect:ls=!0,autoPanOnNodeDrag:dt=!0,connectionRadius:Ha=20,isValidConnection:On,onError:Ga,style:Or,id:Ys,nodeDragThreshold:Va,...Pr},qt)=>{const Ks=Ys||"1";return he.createElement("div",{...Pr,style:{...Or,...JP},ref:qt,className:Vt(["react-flow",a]),"data-testid":"rf__wrapper",id:Ys},he.createElement(mT,null,he.createElement(GP,{onInit:p,onMove:h,onMoveStart:g,onMoveEnd:y,onNodeClick:d,onEdgeClick:f,onNodeMouseEnter:S,onNodeMouseMove:j,onNodeMouseLeave:C,onNodeContextMenu:M,onNodeDoubleClick:$,nodeTypes:i,edgeTypes:l,connectionLineType:J,connectionLineStyle:L,connectionLineComponent:K,connectionLineContainerStyle:ue,selectionKeyCode:U,selectionOnDrag:ee,selectionMode:Y,deleteKeyCode:G,multiSelectionKeyCode:fe,panActivationKeyCode:le,zoomActivationKeyCode:me,onlyRenderVisibleElements:Le,selectNodesOnDrag:qe,defaultViewport:at,translateExtent:we,minZoom:Ye,maxZoom:pe,preventScrolling:Pe,zoomOnScroll:$e,zoomOnPinch:se,zoomOnDoubleClick:Be,panOnScroll:Se,panOnScrollSpeed:De,panOnScrollMode:_e,panOnDrag:_t,onPaneClick:vt,onPaneMouseEnter:Ae,onPaneMouseMove:it,onPaneMouseLeave:wt,onPaneScroll:xt,onPaneContextMenu:nn,onSelectionContextMenu:B,onSelectionStart:Q,onSelectionEnd:P,onEdgeContextMenu:In,onEdgeDoubleClick:Da,onEdgeMouseEnter:qa,onEdgeMouseMove:Fa,onEdgeMouseLeave:wn,onReconnect:mr??Bs,onReconnectStart:Kn??za,onReconnectEnd:li??$t,reconnectRadius:Rr??Ar,defaultMarkerColor:ot,noDragClassName:Us,noWheelClassName:Ba,noPanClassName:Ws,elevateEdgesOnSelect:$r,rfId:Ks,disableKeyboardA11y:Vs,nodeOrigin:re,nodeExtent:Ue}),he.createElement(BO,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:N,onConnectEnd:k,onClickConnectStart:E,onClickConnectEnd:_,nodesDraggable:Ne,nodesConnectable:Ge,nodesFocusable:be,edgesFocusable:Qe,edgesUpdatable:ft,elementsSelectable:ut,elevateNodesOnSelect:Wa,minZoom:Ye,maxZoom:pe,nodeExtent:Ue,onNodesChange:Mr,onEdgesChange:is,snapToGrid:ke,snapGrid:Ve,connectionMode:F,translateExtent:we,connectOnClick:Hs,defaultEdgeOptions:Gs,fitView:$n,fitViewOptions:Ua,onNodesDelete:A,onEdgesDelete:D,onNodeDragStart:I,onNodeDrag:z,onNodeDragStop:O,onSelectionDrag:R,onSelectionDragStart:X,onSelectionDragStop:Z,noPanClassName:Ws,nodeOrigin:re,rfId:Ks,autoPanOnConnect:ls,autoPanOnNodeDrag:dt,onError:Ga,connectionRadius:Ha,isValidConnection:On,nodeDragThreshold:Va}),he.createElement(FO,{onSelectionChange:H}),rn,he.createElement(pO,{proOptions:Ir,position:ci}),he.createElement(VO,{rfId:Ks,disableKeyboardA11y:Vs})))});gT.displayName="ReactFlow";const eL=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function yT(){return ct(eL,Dt)}const vT=({id:e,x:t,y:n,width:s,height:a,style:i,color:l,strokeColor:d,strokeWidth:f,className:p,borderRadius:h,shapeRendering:g,onClick:y,selected:w})=>{const{background:N,backgroundColor:k}=i||{},E=l||N||k;return he.createElement("rect",{className:Vt(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:h,ry:h,width:s,height:a,fill:E,stroke:d,strokeWidth:f,shapeRendering:g,onClick:y?_=>y(_,e):void 0})};vT.displayName="MiniMapNode";var tL=b.memo(vT);const nL=e=>e.nodeOrigin,rL=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),xf=e=>e instanceof Function?e:()=>e;function sL({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:i=tL,onClick:l}){const d=ct(rL,Dt),f=ct(nL),p=xf(t),h=xf(e),g=xf(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return he.createElement(he.Fragment,null,d.map(w=>{const{x:N,y:k}=Ra(w,f).positionAbsolute;return he.createElement(i,{key:w.id,x:N,y:k,width:w.width,height:w.height,style:w.style,selected:w.selected,className:g(w),color:p(w),borderRadius:s,strokeColor:h(w),strokeWidth:a,shapeRendering:y,onClick:l,id:w.id})}))}var aL=b.memo(sL);const oL=200,iL=150,lL=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?yO(ad(t,e.nodeOrigin),n):n,rfId:e.rfId}},cL="react-flow__minimap-desc";function wT({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:a="",nodeBorderRadius:i=5,nodeStrokeWidth:l=2,nodeComponent:d,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:g="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:k=!1,ariaLabel:E="React Flow mini map",inversePan:_=!1,zoomStep:S=10,offsetScale:j=5}){const C=Mt(),M=b.useRef(null),{boundingRect:$,viewBB:I,rfId:z}=ct(lL,Dt),O=(e==null?void 0:e.width)??oL,A=(e==null?void 0:e.height)??iL,D=$.width/O,H=$.height/A,X=Math.max(D,H),R=X*O,Z=X*A,B=j*X,Q=$.x-(R-$.width)/2-B,P=$.y-(Z-$.height)/2-B,F=R+B*2,J=Z+B*2,L=`${cL}-${z}`,K=b.useRef(0);K.current=X,b.useEffect(()=>{if(M.current){const U=Hn(M.current),ee=fe=>{const{transform:me,d3Selection:ke,d3Zoom:Ve}=C.getState();if(fe.sourceEvent.type!=="wheel"||!ke||!Ve)return;const Le=-fe.sourceEvent.deltaY*(fe.sourceEvent.deltaMode===1?.05:fe.sourceEvent.deltaMode?1:.002)*S,qe=me[2]*Math.pow(2,Le);Ve.scaleTo(ke,qe)},Y=fe=>{const{transform:me,d3Selection:ke,d3Zoom:Ve,translateExtent:Le,width:qe,height:Ne}=C.getState();if(fe.sourceEvent.type!=="mousemove"||!ke||!Ve)return;const Ge=K.current*Math.max(1,me[2])*(_?-1:1),be={x:me[0]-fe.sourceEvent.movementX*Ge,y:me[1]-fe.sourceEvent.movementY*Ge},re=[[0,0],[qe,Ne]],Qe=ns.translate(be.x,be.y).scale(me[2]),ft=Ve.constrain()(Qe,re,Le);Ve.transform(ke,ft)},le=jC().on("zoom",N?Y:null).on("zoom.wheel",k?ee:null);return U.call(le),()=>{U.on("zoom",null)}}},[N,k,_,S]);const ue=y?U=>{const ee=or(U);y(U,{x:ee[0],y:ee[1]})}:void 0,G=w?(U,ee)=>{const Y=C.getState().nodeInternals.get(ee);w(U,Y)}:void 0;return he.createElement($w,{position:g,style:e,className:Vt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},he.createElement("svg",{width:O,height:A,viewBox:`${Q} ${P} ${F} ${J}`,role:"img","aria-labelledby":L,ref:M,onClick:ue},E&&he.createElement("title",{id:L},E),he.createElement(aL,{onClick:G,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:a,nodeStrokeWidth:l,nodeComponent:d}),he.createElement("path",{className:"react-flow__minimap-mask",d:`M${Q-B},${P-B}h${F+B*2}v${J+B*2}h${-F-B*2}z
|
|
57
|
-
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}wT.displayName="MiniMap";var uL=b.memo(wT);function dL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},he.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function hL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},he.createElement("path",{d:"M0 0h32v4.2H0z"}))}function fL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},he.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 pL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.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 mL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.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 Er=({children:e,className:t,...n})=>he.createElement("button",{type:"button",className:Vt(["react-flow__controls-button",t]),...n},e);Er.displayName="ControlButton";const gL=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),xT=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:a,onZoomIn:i,onZoomOut:l,onFitView:d,onInteractiveChange:f,className:p,children:h,position:g="bottom-left"})=>{const y=Mt(),[w,N]=b.useState(!1),{isInteractive:k,minZoomReached:E,maxZoomReached:_}=ct(gL,Dt),{zoomIn:S,zoomOut:j,fitView:C}=Dl();if(b.useEffect(()=>{N(!0)},[]),!w)return null;const M=()=>{S(),i==null||i()},$=()=>{j(),l==null||l()},I=()=>{C(a),d==null||d()},z=()=>{y.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),f==null||f(!k)};return he.createElement($w,{className:Vt(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&he.createElement(he.Fragment,null,he.createElement(Er,{onClick:M,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:_},he.createElement(dL,null)),he.createElement(Er,{onClick:$,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:E},he.createElement(hL,null))),n&&he.createElement(Er,{className:"react-flow__controls-fitview",onClick:I,title:"fit view","aria-label":"fit view"},he.createElement(fL,null)),s&&he.createElement(Er,{className:"react-flow__controls-interactive",onClick:z,title:"toggle interactivity","aria-label":"toggle interactivity"},k?he.createElement(mL,null):he.createElement(pL,null)),h)};xT.displayName="Controls";var yL=b.memo(xT),dr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(dr||(dr={}));function vL({color:e,dimensions:t,lineWidth:n}){return he.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function wL({color:e,radius:t}){return he.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const xL={[dr.Dots]:"#91919a",[dr.Lines]:"#eee",[dr.Cross]:"#e2e2e2"},bL={[dr.Dots]:1,[dr.Lines]:1,[dr.Cross]:6},kL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function bT({id:e,variant:t=dr.Dots,gap:n=20,size:s,lineWidth:a=1,offset:i=2,color:l,style:d,className:f}){const p=b.useRef(null),{transform:h,patternId:g}=ct(kL,Dt),y=l||xL[t],w=s||bL[t],N=t===dr.Dots,k=t===dr.Cross,E=Array.isArray(n)?n:[n,n],_=[E[0]*h[2]||1,E[1]*h[2]||1],S=w*h[2],j=k?[S,S]:_,C=N?[S/i,S/i]:[j[0]/i,j[1]/i];return he.createElement("svg",{className:Vt(["react-flow__background",f]),style:{...d,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},he.createElement("pattern",{id:g+e,x:h[0]%_[0],y:h[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},N?he.createElement(wL,{color:y,radius:S/i}):he.createElement(vL,{dimensions:j,color:y,lineWidth:a})),he.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}bT.displayName="Background";var _L=b.memo(bT);const SL=["us-gov","global","apac","us","eu","jp","au"],NL=new RegExp(`^(?:(?:${SL.join("|")})\\.)?anthropic\\.`,"i");function ql(e){return e.replace(NL,"")}const EL=["command","cmd","file_path","path","url","pattern","notebook_path"],ck=120,bf=e=>e.length>ck?`${e.slice(0,ck-1)}…`:e;function jL(e){if(typeof e=="string")return e.trim()?bf(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of EL){const s=t[n];if(typeof s=="string"&&s.trim())return bf(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(a=>typeof a=="string")){const a=s.join(" ").trim();if(a)return bf(a)}}return null}function kT(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function Hw(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 CL(e){const t=Hw(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 TL(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]=CL(s));return Object.keys(t).length?t:void 0}function _T(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),...Hw(n)};for(const s of Object.values(n)){const a=_T(s,t+1);if(a)return a}return null}const RL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function ST(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&RL.test(ql(n.model)))return n.model;for(const s of Object.values(n)){const a=ST(s,t+1);if(a)return a}return null}function cw(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function qs(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function uk(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Fl(e,t){return`${e}::${t}`}function Uu(e){return e.agent_type??e.subagent_type??"subagent"}function wl(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function qo(e,t,n,s){const a=t;let i=e.agents.get(a);return i||(i={id:a,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:kT()},e.agents.set(a,i),i)}function NT(e,t,n,s){const a=Fl(t,n),i=e.agents.get(a);if(!i)return null;!i.cwd&&s.cwd&&(i.cwd=s.cwd,i.cwdBasename=qs(s.cwd));const l=Uu(s);return l&&(i.label==="subagent"||!i.label)&&(i.label=l),i}function AL(e,t,n){const s=t.session_id??"unknown",a=wl(t);if(a){const f=NT(e,s,a,t);if(f)return f}const i=e.activeSubagentStack.get(s),l=i&&i.length>0?i[i.length-1]:null;if(l){const f=e.agents.get(Fl(s,l));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=qs(t.cwd)),f}const d=qo(e,s,n,t.hook_event_name!=="SessionStart");return!d.cwd&&t.cwd&&(d.cwd=t.cwd,d.cwdBasename=qs(t.cwd)),d.label==="session"&&t.cwd&&(d.label=qs(t.cwd)??"session"),d}function ML(e,t,n,s,a){const i=Fl(t,n),l=qo(e,t,a,!0);let d=e.agents.get(i);if(d){!d.cwd&&s.cwd&&(d.cwd=s.cwd,d.cwdBasename=qs(s.cwd));const f=Uu(s);return f&&(d.label==="subagent"||!d.label)&&(d.label=f),d}return d={id:i,sessionId:t,label:Uu(s),kind:"subagent",parentId:l.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:s.cwd,cwdBasename:qs(s.cwd),toolCount:0,childCount:0,usage:kT()},e.agents.set(i,d),l.childCount+=1,d}function IL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function $L(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 pu(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,OL=25;function PL(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-OL-1;s>=0;s--){const a=n[s];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function LL(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 hk=2e3;function DL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const a=e.prompts[s];if(a.at<t-hk)return!1;if(a.text===n&&a.at<=t+hk)return!0}return!1}function ET(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 zl(e,t){return t&&(e.revision+=1),t}function qL(e,t,n,s){if(e.agents.size<=n)return!1;const a=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>s,i=[],l=new Map;for(const[p,h]of e.agents){if(h.parentId!=null){const g=l.get(h.parentId);g?g.push(p):l.set(h.parentId,[p])}a(h)&&i.push({id:p,endedAt:h.endedAt})}if(i.length===0)return!1;i.sort((p,h)=>p.endedAt-h.endedAt);let d=0;const f=p=>{const h=e.agents.get(p);h&&(ET(e,h),e.agents.delete(p),d++)};for(const p of i){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const h=(l.get(p.id)??[]).map(g=>e.agents.get(g)).filter(g=>g!=null);if(!h.some(g=>!a(g))){for(const g of h)f(g.id);f(p.id)}}return zl(e,d>0)}function FL(e,t,n,s){const a=new Map;for(const[p,h]of e.agents){let g=a.get(h.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},a.set(h.sessionId,g)),g.ids.push(p),h.kind==="root"&&h.closedAt!=null&&(g.closed=!0),h.state==="done"&&h.endedAt!=null?g.endedAt=Math.max(g.endedAt,h.endedAt):g.live=!0}const i=[...a.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>s).sort((p,h)=>p.closed===h.closed?p.endedAt-h.endedAt:p.closed?-1:1);let d=[...a.values()].filter(p=>!p.live).length-n;if(d<=0)return!1;let f=!1;for(const p of i){if(d<=0)break;for(const h of p.ids){const g=e.agents.get(h);g&&ET(e,g),e.agents.delete(h)}d--,f=!0}return zl(e,f)}function zL(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 BL(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 zl(e,t)}function UL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.provider==="codex")continue;const i=e.agents.get(a.sessionId),l=(i==null?void 0:i.lastEventAt)??(i==null?void 0:i.startedAt);for(const d of a.tools){const f=Math.max(d.startedAt,l??d.startedAt);d.endedAt==null&&t-f>n&&(d.endedAt=f,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 zl(e,s)}const fk=90*6e4;function WL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.kind!=="root")continue;const i=a.lastEventAt??a.startedAt;if(!(t-i<=n)){a.waiting&&(a.waiting=null,s=!0),a.closedAt==null&&(a.closedAt=i),a.state==="active"&&(a.state="done",a.endedAt=i,a.reaped=!0,s=!0);for(const l of e.agents.values())l.sessionId!==a.sessionId||l.kind==="root"||l.state!=="active"||(l.state="done",l.endedAt=i,s=!0);e.activeSubagentStack.delete(a.sessionId)}}return zl(e,s)}function HL(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const GL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function VL(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 YL=3e4;function KL(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>YL)&&!(e.startedAt>t))return{name:e.name,preview:jL(e.input)??""}}function XL(e,t,n,s,a){if(n!=="permission")return{kind:n,message:s,since:a};const i=VL(e,t),l={kind:n,message:s,since:a};i!=null&&i.explicitSubagentId&&(l.subagentId=i.explicitSubagentId);const d=KL(i,a);return d&&(l.tool=d),l}function QL(e,t,n){if(e.kind==="idle")return!0;const s=wl(t);return s==null?!0:e.subagentId!=null&&Fl(n,s)===e.subagentId}function pk(e,t){const n=t.epoch??null;if(n!==null&&n!==e.seqEpoch)e.seqEpoch=n,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const s=t.payload??{},a=t.receivedAt,i=s.hook_event_name??"Unknown";if(i==="__clear")return{...cw(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const l=s.session_id??"unknown";if(!GL.has(i)){const h=e.agents.get(l);h!=null&&h.waiting&&QL(h.waiting,s,l)&&(h.waiting=null)}const d=e.agents.get(l);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 h=e.agents.get(l);h&&(h.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const h=e.agents.get(l);h&&(h.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const h=e.agents.get(l);h&&(h.context={...h.context??uk(),currentContextTokens:s.context_tokens})}if(i==="ModelObserved"){const h=typeof s.model=="string"?s.model:null;if(h){const y=e.agents.get(l);y&&(y.model=h)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[y,w]of Object.entries(g)){if(typeof w!="string")continue;const N=`${l}::${y}`,k=e.agents.get(N);k&&(k.model=w)}return e}if(i==="ContextObserved"){const h=s.context??null;if(h){const g=e.agents.get(l);if(g){const y=g.context??uk(),w=(k,E)=>typeof h[k]=="number"?h[k]:E,N=Array.isArray(h.memoryFiles)?h.memoryFiles:Array.isArray(h.claudeMdFiles)?h.claudeMdFiles:null;g.context={msgsUser:w("msgsUser",y.msgsUser),msgsAssistant:w("msgsAssistant",y.msgsAssistant),toolUses:w("toolUses",y.toolUses),toolResults:w("toolResults",y.toolResults),systemReminders:w("systemReminders",y.systemReminders),currentContextTokens:w("currentContextTokens",y.currentContextTokens),memoryFiles:N??y.memoryFiles}}}return e}if(i==="SessionNamed"){const h=e.agents.get(l);if(h){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",y=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(h.sessionName=g),y&&(h.sessionTitle=y);const w=h.sessionName??"";h.sessionTitle&&w&&h.sessionTitle.toLowerCase()===w.toLowerCase()&&(h.sessionTitle=void 0)}return e}if(i==="UsageObserved"){const h=s.usage??null;if(h){const g=e.agents.get(l);if(g){g.usage.inputTokens=Number(h.input_tokens??0),g.usage.outputTokens=Number(h.output_tokens??0),g.usage.cacheReadTokens=Number(h.cache_read_input_tokens??h.cached_input_tokens??0),g.usage.cacheCreateTokens=Number(h.cache_creation_input_tokens??h.cache_write_input_tokens??0);const y=Hw(h);g.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof h.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(h.reasoning_output_tokens)),g.usageByModel=TL(s.usageByModel)}}return e}const f=AL(e,s,a);f.provider||(f.provider=s.provider==="codex"?"codex":"claude");const p=ST(s);switch(p&&(f.model=p),i){case"SessionStart":{const h=qo(e,l,a,!1);h.synthetic=!1,h.state="active",h.closedAt=void 0,h.startedAt=h.startedAt||a,!h.cwd&&s.cwd&&(h.cwd=s.cwd,h.cwdBasename=qs(s.cwd)),h.label==="session"&&s.cwd&&(h.label=qs(s.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===l&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<a&&(y.exitAt=a);const h=qo(e,l,a,!1);h.state="active",h.endedAt=void 0,h.closedAt=void 0,h.exitAt=void 0;const g=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";g&&!DL(h,a,g)&&(h.prompts.push({at:a,text:g}),h.firstPrompt||(h.firstPrompt=pu(g,120)));break}case"PreToolUse":{const h=s.tool_use_id?LL(e,f,s.tool_use_id):null;if(h){s.tool_name&&h.name==="?"&&(h.name=s.tool_name),h.endedAt==null&&!h.trimmed&&s.tool_input!==void 0&&(h.input=s.tool_input,h.inputPreview=pu(s.tool_input));break}const g=s.tool_use_id??`${f.id}:${f.toolCount}`,y=wl(s),w={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:pu(s.tool_input),agentId:f.id,explicitSubagentId:y?Fl(l,y):void 0,startedAt:a};f.tools.push(w),f.toolCount+=1,f.state="active",e.toolIndex.set(g,w),e.toolOwner.set(g,f.id),PL(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=s.tool_use_id;if(!h)break;let g=e.toolIndex.get(h),y=!1;if(!g)for(const N of e.agents.values()){const k=N.tools.find(E=>E.id===h);if(k){g=k,y=!0;break}}if(!g||g.outcomeApplied)break;g.outcomeApplied=!0,g.outcomeGap=void 0,g.endedAt=a,g.ok=i==="PostToolUse",g.trimmed||(g.response=s.tool_response),i==="PostToolUseFailure"?g.errorPreview=pu(s.tool_response):y&&(g.errorPreview=void 0);const w=_T(s.tool_response);w&&(g.usage=w),e.toolIndex.delete(h),e.toolOwner.delete(h);break}case"SubagentStart":{const h=wl(s);if(!h)break;const g=ML(e,l,h,s,a);g.state="active",g.startedAt=g.startedAt||a,g.exitAt=void 0,g.endedAt=void 0;const y=Uu(s);y&&(g.label=y),IL(e,l,h);break}case"SubagentStop":{const h=wl(s);if(!h)break;const g=NT(e,l,h,s);if(!g)break;g.state="done",g.endedAt=a,$L(e,l,h);break}case"Stop":case"SessionEnd":{const h=qo(e,l,a,!1);h.state="done",h.endedAt=a,i==="SessionEnd"&&(h.closedAt=a),e.activeSubagentStack.delete(l);break}case"Notification":{const h=HL(s.notification_type);if(!h)break;const g=qo(e,l,a,!1),y=typeof s.message=="string"?s.message:"",w=g.waiting;g.waiting=w&&w.kind===h&&w.message===y?{...w,since:Math.min(w.since,a)}:XL(e,l,h,y,a);break}}return e}function Gw(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 ZL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},JL=[{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:ZL},{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 e3(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function ti(e,t=Date.now()){if(!e)return null;const n=ql(e);for(const s of JL)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function jT(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),s=Math.max(0,e.cacheCreate5mTokens??0),a=Math.max(0,e.cacheCreateTokens-n-s),i=s+a,l=t.cacheWrite1h??t.cacheWrite;return{tokens5m:i,tokens1h:n,usd5m:i*t.cacheWrite/1e6,usd1h:n*l/1e6}}function CT(e,t,n=Date.now()){if(!e3(t))return e.inputTokens;const s=ti(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 Vw(e,t,n=Date.now()){const s=ti(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=CT(e,t,n)*s.input/1e6,i=e.outputTokens*s.output/1e6,l=e.cacheReadTokens*s.cacheRead/1e6,d=jT(e,s),f=d.usd5m+d.usd1h;return{input:a,output:i,cacheRead:l,cacheWrite:f,total:a+i+l+f}}const mk=2e5,t3=1e6,n3=[/\[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],r3=[{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 s3(e){if(!e)return mk;const t=ql(e);for(const n of n3)if(n.test(t))return t3;for(const n of r3)if(n.match.test(t))return n.window;return mk}function TT(e,t){return typeof e=="number"&&e>0?e:s3(t)}const Lo="not priced";function Je(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 Yw(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${Je(s)}/min`:`${Je(n*3600)}/hr`}function a3(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 o3(e,t){let n=0,s=0,a=0,i=0,l=0,d=0;for(const g of t)n+=g.inputTokens,s+=g.outputTokens,a+=g.cacheReadTokens,i+=g.cacheCreateTokens,l+=g.cacheCreate1hTokens??0,d+=g.cacheCreate5mTokens??0;const f=(g,y)=>Math.max(0,g-y),p={inputTokens:f(e.inputTokens,n),outputTokens:f(e.outputTokens,s),cacheReadTokens:f(e.cacheReadTokens,a),cacheCreateTokens:f(e.cacheCreateTokens,i)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=f(e.cacheCreate1hTokens??0,l),p.cacheCreate5mTokens=f(e.cacheCreate5mTokens??0,d)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function Bl(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const s=n.map(i=>({model:i,usage:t[i]})),a=o3(e.usage,s.map(i=>i.usage));if(a){const i=s.findIndex(l=>l.model===e.model);i>=0?s[i]={model:s[i].model,usage:a3(s[i].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 Bl(e)){const a=Vw(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 uw(e,t=Date.now()){let n=0;for(const s of Bl(e))ti(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function RT(e){const t=[];for(const n of Bl(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 AT(e){return RT(e).filter(t=>t!==e.model)}const i3=new Set(["untrusted","on-request","on-failure"]);function l3(e){return typeof e!="string"||!e?null:i3.has(e)?!0:e==="never"?!1:null}function c3(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=l3(e.approvalPolicy);return t===!1?null:{label:"approvals not visible",detail:`${t===!0?`This session's approval policy is "${e.approvalPolicy}", so Codex can stop and ask you to approve a command.`:"This session's approval policy has not been read yet, so it may be able to stop and ask you to approve a command."}
|
|
58
|
-
|
|
59
|
-
Codex writes no approval request to its rollout files, which are the only thing this deck can read — so when it does ask, this card, the sidebar, the topbar count, the tab title and the favicon will all stay silent. Check the terminal.`}}function
|
|
60
|
-
Likely on: ${n}`:t}function
|
|
61
|
-
no published rate in this build — the tokens are counted, the dollars are not`;const s=h=>h.toLocaleString(),a=h=>`$${h}/MTok`,i=Vw(e,t),l=
|
|
62
|
-
`)}function
|
|
63
|
-
`)}function
|
|
64
|
-
${e.sessionTitle}`:e.sessionTitle:e.cwd,p=
|
|
56
|
+
*/var wb;function EM(){if(wb)return lf;wb=1;var e=$l(),t=NM();function n(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var s=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,i=e.useRef,l=e.useEffect,d=e.useMemo,f=e.useDebugValue;return lf.useSyncExternalStoreWithSelector=function(p,h,g,y,w){var N=i(null);if(N.current===null){var k={hasValue:!1,value:null};N.current=k}else k=N.current;N=d(function(){function _($){if(!S){if(S=!0,j=$,$=y($),w!==void 0&&k.hasValue){var I=k.value;if(w(I,$))return C=I}return C=$}if(I=C,s(j,$))return I;var z=y($);return w!==void 0&&w(I,z)?(j=$,I):(j=$,C=z)}var S=!1,j,C,M=g===void 0?null:g;return[function(){return _(h())},M===null?void 0:function(){return _(M())}]},[h,g,y,w]);var E=a(p,N[0],N[1]);return l(function(){k.hasValue=!0,k.value=E},[E]),f(E),E},lf}var xb;function jM(){return xb||(xb=1,of.exports=EM()),of.exports}var CM=jM();const TM=Ew(CM),RM={},bb=e=>{let t;const n=new Set,s=(h,g)=>{const y=typeof h=="function"?h(t):h;if(!Object.is(y,t)){const w=t;t=g??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(N=>N(t,w))}},a=()=>t,f={setState:s,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(RM?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=t=e(s,a,f);return f},AM=e=>e?bb(e):bb,{useDebugValue:MM}=he,{useSyncExternalStoreWithSelector:IM}=TM,$M=e=>e;function eC(e,t=$M,n){const s=IM(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return MM(s),s}const kb=(e,t)=>{const n=AM(e),s=(a,i=t)=>eC(n,a,i);return Object.assign(s,n),s},OM=(e,t)=>e?kb(e,t):kb;function Dt(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 PM={value:()=>{}};function Ju(){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 Eu(n)}function Eu(e){this._=e}function LM(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}})}Eu.prototype=Ju.prototype={constructor:Eu,on:function(e,t){var n=this._,s=LM(e+"",n),a,i=-1,l=s.length;if(arguments.length<2){for(;++i<l;)if((a=(e=s[i]).type)&&(a=DM(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<l;)if(a=(e=s[i]).type)n[a]=_b(n[a],e.name,t);else if(t==null)for(a in n)n[a]=_b(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 Eu(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),s=0,a,i;s<a;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],s=0,a=i.length;s<a;++s)i[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],a=0,i=s.length;a<i;++a)s[a].value.apply(t,n)}};function DM(e,t){for(var n=0,s=e.length,a;n<s;++n)if((a=e[n]).name===t)return a.value}function _b(e,t,n){for(var s=0,a=e.length;s<a;++s)if(e[s].name===t){e[s]=PM,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var Vv="http://www.w3.org/1999/xhtml";const Sb={svg:"http://www.w3.org/2000/svg",xhtml:Vv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ed(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Sb.hasOwnProperty(t)?{space:Sb[t],local:e}:e}function qM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Vv&&t.documentElement.namespaceURI===Vv?t.createElement(e):t.createElementNS(n,e)}}function FM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function tC(e){var t=ed(e);return(t.local?FM:qM)(t)}function zM(){}function jw(e){return e==null?zM:function(){return this.querySelector(e)}}function BM(e){typeof e!="function"&&(e=jw(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],l=i.length,d=s[a]=new Array(l),f,p,h=0;h<l;++h)(f=i[h])&&(p=e.call(f,f.__data__,h,i))&&("__data__"in f&&(p.__data__=f.__data__),d[h]=p);return new Mn(s,this._parents)}function UM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function WM(){return[]}function nC(e){return e==null?WM:function(){return this.querySelectorAll(e)}}function HM(e){return function(){return UM(e.apply(this,arguments))}}function GM(e){typeof e=="function"?e=HM(e):e=nC(e);for(var t=this._groups,n=t.length,s=[],a=[],i=0;i<n;++i)for(var l=t[i],d=l.length,f,p=0;p<d;++p)(f=l[p])&&(s.push(e.call(f,f.__data__,p,l)),a.push(f));return new Mn(s,a)}function rC(e){return function(){return this.matches(e)}}function sC(e){return function(t){return t.matches(e)}}var VM=Array.prototype.find;function YM(e){return function(){return VM.call(this.children,e)}}function KM(){return this.firstElementChild}function XM(e){return this.select(e==null?KM:YM(typeof e=="function"?e:sC(e)))}var QM=Array.prototype.filter;function ZM(){return Array.from(this.children)}function JM(e){return function(){return QM.call(this.children,e)}}function e2(e){return this.selectAll(e==null?ZM:JM(typeof e=="function"?e:sC(e)))}function t2(e){typeof e!="function"&&(e=rC(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],l=i.length,d=s[a]=[],f,p=0;p<l;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&d.push(f);return new Mn(s,this._parents)}function aC(e){return new Array(e.length)}function n2(){return new Mn(this._enter||this._groups.map(aC),this._parents)}function $u(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}$u.prototype={constructor:$u,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 r2(e){return function(){return e}}function s2(e,t,n,s,a,i){for(var l=0,d,f=t.length,p=i.length;l<p;++l)(d=t[l])?(d.__data__=i[l],s[l]=d):n[l]=new $u(e,i[l]);for(;l<f;++l)(d=t[l])&&(a[l]=d)}function a2(e,t,n,s,a,i,l){var d,f,p=new Map,h=t.length,g=i.length,y=new Array(h),w;for(d=0;d<h;++d)(f=t[d])&&(y[d]=w=l.call(f,f.__data__,d,t)+"",p.has(w)?a[d]=f:p.set(w,f));for(d=0;d<g;++d)w=l.call(e,i[d],d,i)+"",(f=p.get(w))?(s[d]=f,f.__data__=i[d],p.delete(w)):n[d]=new $u(e,i[d]);for(d=0;d<h;++d)(f=t[d])&&p.get(y[d])===f&&(a[d]=f)}function o2(e){return e.__data__}function i2(e,t){if(!arguments.length)return Array.from(this,o2);var n=t?a2:s2,s=this._parents,a=this._groups;typeof e!="function"&&(e=r2(e));for(var i=a.length,l=new Array(i),d=new Array(i),f=new Array(i),p=0;p<i;++p){var h=s[p],g=a[p],y=g.length,w=l2(e.call(h,h&&h.__data__,p,s)),N=w.length,k=d[p]=new Array(N),E=l[p]=new Array(N),_=f[p]=new Array(y);n(h,g,k,E,_,w,t);for(var S=0,j=0,C,M;S<N;++S)if(C=k[S]){for(S>=j&&(j=S+1);!(M=E[j])&&++j<N;);C._next=M||null}}return l=new Mn(l,s),l._enter=d,l._exit=f,l}function l2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function c2(){return new Mn(this._exit||this._groups.map(aC),this._parents)}function u2(e,t,n){var s=this.enter(),a=this,i=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?i.remove():n(i),s&&a?s.merge(a).order():a}function d2(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,a=n.length,i=s.length,l=Math.min(a,i),d=new Array(a),f=0;f<l;++f)for(var p=n[f],h=s[f],g=p.length,y=d[f]=new Array(g),w,N=0;N<g;++N)(w=p[N]||h[N])&&(y[N]=w);for(;f<a;++f)d[f]=n[f];return new Mn(d,this._parents)}function h2(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],a=s.length-1,i=s[a],l;--a>=0;)(l=s[a])&&(i&&l.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(l,i),i=l);return this}function f2(e){e||(e=p2);function t(g,y){return g&&y?e(g.__data__,y.__data__):!g-!y}for(var n=this._groups,s=n.length,a=new Array(s),i=0;i<s;++i){for(var l=n[i],d=l.length,f=a[i]=new Array(d),p,h=0;h<d;++h)(p=l[h])&&(f[h]=p);f.sort(t)}return new Mn(a,this._parents).order()}function p2(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function m2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function g2(){return Array.from(this)}function y2(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,i=s.length;a<i;++a){var l=s[a];if(l)return l}return null}function v2(){let e=0;for(const t of this)++e;return e}function w2(){return!this.node()}function x2(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var a=t[n],i=0,l=a.length,d;i<l;++i)(d=a[i])&&e.call(d,d.__data__,i,a);return this}function b2(e){return function(){this.removeAttribute(e)}}function k2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _2(e,t){return function(){this.setAttribute(e,t)}}function S2(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function N2(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function E2(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 j2(e,t){var n=ed(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?k2:b2:typeof t=="function"?n.local?E2:N2:n.local?S2:_2)(n,t))}function oC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function C2(e){return function(){this.style.removeProperty(e)}}function T2(e,t,n){return function(){this.style.setProperty(e,t,n)}}function R2(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function A2(e,t,n){return arguments.length>1?this.each((t==null?C2:typeof t=="function"?R2:T2)(e,t,n??"")):Go(this.node(),e)}function Go(e,t){return e.style.getPropertyValue(t)||oC(e).getComputedStyle(e,null).getPropertyValue(t)}function M2(e){return function(){delete this[e]}}function I2(e,t){return function(){this[e]=t}}function $2(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function O2(e,t){return arguments.length>1?this.each((t==null?M2:typeof t=="function"?$2:I2)(e,t)):this.node()[e]}function iC(e){return e.trim().split(/^|\s+/)}function Cw(e){return e.classList||new lC(e)}function lC(e){this._node=e,this._names=iC(e.getAttribute("class")||"")}lC.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 cC(e,t){for(var n=Cw(e),s=-1,a=t.length;++s<a;)n.add(t[s])}function uC(e,t){for(var n=Cw(e),s=-1,a=t.length;++s<a;)n.remove(t[s])}function P2(e){return function(){cC(this,e)}}function L2(e){return function(){uC(this,e)}}function D2(e,t){return function(){(t.apply(this,arguments)?cC:uC)(this,e)}}function q2(e,t){var n=iC(e+"");if(arguments.length<2){for(var s=Cw(this.node()),a=-1,i=n.length;++a<i;)if(!s.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?D2:t?P2:L2)(n,t))}function F2(){this.textContent=""}function z2(e){return function(){this.textContent=e}}function B2(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function U2(e){return arguments.length?this.each(e==null?F2:(typeof e=="function"?B2:z2)(e)):this.node().textContent}function W2(){this.innerHTML=""}function H2(e){return function(){this.innerHTML=e}}function G2(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function V2(e){return arguments.length?this.each(e==null?W2:(typeof e=="function"?G2:H2)(e)):this.node().innerHTML}function Y2(){this.nextSibling&&this.parentNode.appendChild(this)}function K2(){return this.each(Y2)}function X2(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Q2(){return this.each(X2)}function Z2(e){var t=typeof e=="function"?e:tC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function J2(){return null}function eI(e,t){var n=typeof e=="function"?e:tC(e),s=t==null?J2:typeof t=="function"?t:jw(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function tI(){var e=this.parentNode;e&&e.removeChild(this)}function nI(){return this.each(tI)}function rI(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function sI(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function aI(e){return this.select(e?sI:rI)}function oI(e){return arguments.length?this.property("__data__",e):this.node().__data__}function iI(e){return function(t){e.call(this,t,this.__data__)}}function lI(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 cI(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,a=t.length,i;n<a;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++s]=i;++s?t.length=s:delete this.__on}}}function uI(e,t,n){return function(){var s=this.__on,a,i=iI(t);if(s){for(var l=0,d=s.length;l<d;++l)if((a=s[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=i,a.options=n),a.value=t;return}}this.addEventListener(e.type,i,n),a={type:e.type,name:e.name,value:t,listener:i,options:n},s?s.push(a):this.__on=[a]}}function dI(e,t,n){var s=lI(e+""),a,i=s.length,l;if(arguments.length<2){var d=this.node().__on;if(d){for(var f=0,p=d.length,h;f<p;++f)for(a=0,h=d[f];a<i;++a)if((l=s[a]).type===h.type&&l.name===h.name)return h.value}return}for(d=t?uI:cI,a=0;a<i;++a)this.each(d(s[a],t,n));return this}function dC(e,t,n){var s=oC(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 hI(e,t){return function(){return dC(this,e,t)}}function fI(e,t){return function(){return dC(this,e,t.apply(this,arguments))}}function pI(e,t){return this.each((typeof t=="function"?fI:hI)(e,t))}function*mI(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,i=s.length,l;a<i;++a)(l=s[a])&&(yield l)}var hC=[null];function Mn(e,t){this._groups=e,this._parents=t}function Ol(){return new Mn([[document.documentElement]],hC)}function gI(){return this}Mn.prototype=Ol.prototype={constructor:Mn,select:BM,selectAll:GM,selectChild:XM,selectChildren:e2,filter:t2,data:i2,enter:n2,exit:c2,join:u2,merge:d2,selection:gI,order:h2,sort:f2,call:m2,nodes:g2,node:y2,size:v2,empty:w2,each:x2,attr:j2,style:A2,property:O2,classed:q2,text:U2,html:V2,raise:K2,lower:Q2,append:Z2,insert:eI,remove:nI,clone:aI,datum:oI,on:dI,dispatch:pI,[Symbol.iterator]:mI};function Hn(e){return typeof e=="string"?new Mn([[document.querySelector(e)]],[document.documentElement]):new Mn([[e]],hC)}function yI(e){let t;for(;t=e.sourceEvent;)e=t;return e}function or(e,t){if(e=yI(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 vI={passive:!1},bl={capture:!0,passive:!1};function df(e){e.stopImmediatePropagation()}function zo(e){e.preventDefault(),e.stopImmediatePropagation()}function fC(e){var t=e.document.documentElement,n=Hn(e).on("dragstart.drag",zo,bl);"onselectstart"in t?n.on("selectstart.drag",zo,bl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function pC(e,t){var n=e.document.documentElement,s=Hn(e).on("dragstart.drag",null);t&&(s.on("click.drag",zo,bl),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 au=e=>()=>e;function Yv(e,{sourceEvent:t,subject:n,target:s,identifier:a,active:i,x:l,y:d,dx:f,dy:p,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:d,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:h}})}Yv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function wI(e){return!e.ctrlKey&&!e.button}function xI(){return this.parentNode}function bI(e,t){return t??{x:e.x,y:e.y}}function kI(){return navigator.maxTouchPoints||"ontouchstart"in this}function _I(){var e=wI,t=xI,n=bI,s=kI,a={},i=Ju("start","drag","end"),l=0,d,f,p,h,g=0;function y(C){C.on("mousedown.drag",w).filter(s).on("touchstart.drag",E).on("touchmove.drag",_,vI).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,M){if(!(h||!e.call(this,C,M))){var $=j(this,t.call(this,C,M),C,M,"mouse");$&&(Hn(C.view).on("mousemove.drag",N,bl).on("mouseup.drag",k,bl),fC(C.view),df(C),p=!1,d=C.clientX,f=C.clientY,$("start",C))}}function N(C){if(zo(C),!p){var M=C.clientX-d,$=C.clientY-f;p=M*M+$*$>g}a.mouse("drag",C)}function k(C){Hn(C.view).on("mousemove.drag mouseup.drag",null),pC(C.view,p),zo(C),a.mouse("end",C)}function E(C,M){if(e.call(this,C,M)){var $=C.changedTouches,I=t.call(this,C,M),z=$.length,O,A;for(O=0;O<z;++O)(A=j(this,I,C,M,$[O].identifier,$[O]))&&(df(C),A("start",C,$[O]))}}function _(C){var M=C.changedTouches,$=M.length,I,z;for(I=0;I<$;++I)(z=a[M[I].identifier])&&(zo(C),z("drag",C,M[I]))}function S(C){var M=C.changedTouches,$=M.length,I,z;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),I=0;I<$;++I)(z=a[M[I].identifier])&&(df(C),z("end",C,M[I]))}function j(C,M,$,I,z,O){var A=i.copy(),D=or(O||$,M),H,X,R;if((R=n.call(C,new Yv("beforestart",{sourceEvent:$,target:y,identifier:z,active:l,x:D[0],y:D[1],dx:0,dy:0,dispatch:A}),I))!=null)return H=R.x-D[0]||0,X=R.y-D[1]||0,function Z(B,Q,P){var F=D,J;switch(B){case"start":a[z]=Z,J=l++;break;case"end":delete a[z],--l;case"drag":D=or(P||Q,M),J=l;break}A.call(B,C,new Yv(B,{sourceEvent:Q,subject:R,target:y,identifier:z,active:J,x:D[0]+H,y:D[1]+X,dx:D[0]-F[0],dy:D[1]-F[1],dispatch:A}),I)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:au(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:au(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:au(C),y):n},y.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:au(!!C),y):s},y.on=function(){var C=i.on.apply(i,arguments);return C===i?y:C},y.clickDistance=function(C){return arguments.length?(g=(C=+C)*C,y):Math.sqrt(g)},y}function Tw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function mC(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Pl(){}var kl=.7,Ou=1/kl,Bo="\\s*([+-]?\\d+)\\s*",_l="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",jr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",SI=/^#([0-9a-f]{3,8})$/,NI=new RegExp(`^rgb\\(${Bo},${Bo},${Bo}\\)$`),EI=new RegExp(`^rgb\\(${jr},${jr},${jr}\\)$`),jI=new RegExp(`^rgba\\(${Bo},${Bo},${Bo},${_l}\\)$`),CI=new RegExp(`^rgba\\(${jr},${jr},${jr},${_l}\\)$`),TI=new RegExp(`^hsl\\(${_l},${jr},${jr}\\)$`),RI=new RegExp(`^hsla\\(${_l},${jr},${jr},${_l}\\)$`),Nb={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};Tw(Pl,Sl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Eb,formatHex:Eb,formatHex8:AI,formatHsl:MI,formatRgb:jb,toString:jb});function Eb(){return this.rgb().formatHex()}function AI(){return this.rgb().formatHex8()}function MI(){return gC(this).formatHsl()}function jb(){return this.rgb().formatRgb()}function Sl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=SI.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Cb(t):n===3?new yn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ou(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ou(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=NI.exec(e))?new yn(t[1],t[2],t[3],1):(t=EI.exec(e))?new yn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=jI.exec(e))?ou(t[1],t[2],t[3],t[4]):(t=CI.exec(e))?ou(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=TI.exec(e))?Ab(t[1],t[2]/100,t[3]/100,1):(t=RI.exec(e))?Ab(t[1],t[2]/100,t[3]/100,t[4]):Nb.hasOwnProperty(e)?Cb(Nb[e]):e==="transparent"?new yn(NaN,NaN,NaN,0):null}function Cb(e){return new yn(e>>16&255,e>>8&255,e&255,1)}function ou(e,t,n,s){return s<=0&&(e=t=n=NaN),new yn(e,t,n,s)}function II(e){return e instanceof Pl||(e=Sl(e)),e?(e=e.rgb(),new yn(e.r,e.g,e.b,e.opacity)):new yn}function Kv(e,t,n,s){return arguments.length===1?II(e):new yn(e,t,n,s??1)}function yn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}Tw(yn,Kv,mC(Pl,{brighter(e){return e=e==null?Ou:Math.pow(Ou,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?kl:Math.pow(kl,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yn(Ta(this.r),Ta(this.g),Ta(this.b),Pu(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:Tb,formatHex:Tb,formatHex8:$I,formatRgb:Rb,toString:Rb}));function Tb(){return`#${ja(this.r)}${ja(this.g)}${ja(this.b)}`}function $I(){return`#${ja(this.r)}${ja(this.g)}${ja(this.b)}${ja((isNaN(this.opacity)?1:this.opacity)*255)}`}function Rb(){const e=Pu(this.opacity);return`${e===1?"rgb(":"rgba("}${Ta(this.r)}, ${Ta(this.g)}, ${Ta(this.b)}${e===1?")":`, ${e})`}`}function Pu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ta(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ja(e){return e=Ta(e),(e<16?"0":"")+e.toString(16)}function Ab(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ir(e,t,n,s)}function gC(e){if(e instanceof ir)return new ir(e.h,e.s,e.l,e.opacity);if(e instanceof Pl||(e=Sl(e)),!e)return new ir;if(e instanceof ir)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,a=Math.min(t,n,s),i=Math.max(t,n,s),l=NaN,d=i-a,f=(i+a)/2;return d?(t===i?l=(n-s)/d+(n<s)*6:n===i?l=(s-t)/d+2:l=(t-n)/d+4,d/=f<.5?i+a:2-i-a,l*=60):d=f>0&&f<1?0:l,new ir(l,d,f,e.opacity)}function OI(e,t,n,s){return arguments.length===1?gC(e):new ir(e,t,n,s??1)}function ir(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}Tw(ir,OI,mC(Pl,{brighter(e){return e=e==null?Ou:Math.pow(Ou,e),new ir(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?kl:Math.pow(kl,e),new ir(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 yn(hf(e>=240?e-240:e+120,a,s),hf(e,a,s),hf(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new ir(Mb(this.h),iu(this.s),iu(this.l),Pu(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=Pu(this.opacity);return`${e===1?"hsl(":"hsla("}${Mb(this.h)}, ${iu(this.s)*100}%, ${iu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Mb(e){return e=(e||0)%360,e<0?e+360:e}function iu(e){return Math.max(0,Math.min(1,e||0))}function hf(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 yC=e=>()=>e;function PI(e,t){return function(n){return e+n*t}}function LI(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 DI(e){return(e=+e)==1?vC:function(t,n){return n-t?LI(t,n,e):yC(isNaN(t)?n:t)}}function vC(e,t){var n=t-e;return n?PI(e,n):yC(isNaN(e)?t:e)}const Ib=(function e(t){var n=DI(t);function s(a,i){var l=n((a=Kv(a)).r,(i=Kv(i)).r),d=n(a.g,i.g),f=n(a.b,i.b),p=vC(a.opacity,i.opacity);return function(h){return a.r=l(h),a.g=d(h),a.b=f(h),a.opacity=p(h),a+""}}return s.gamma=e,s})(1);function Os(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Xv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ff=new RegExp(Xv.source,"g");function qI(e){return function(){return e}}function FI(e){return function(t){return e(t)+""}}function zI(e,t){var n=Xv.lastIndex=ff.lastIndex=0,s,a,i,l=-1,d=[],f=[];for(e=e+"",t=t+"";(s=Xv.exec(e))&&(a=ff.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),d[l]?d[l]+=i:d[++l]=i),(s=s[0])===(a=a[0])?d[l]?d[l]+=a:d[++l]=a:(d[++l]=null,f.push({i:l,x:Os(s,a)})),n=ff.lastIndex;return n<t.length&&(i=t.slice(n),d[l]?d[l]+=i:d[++l]=i),d.length<2?f[0]?FI(f[0].x):qI(t):(t=f.length,function(p){for(var h=0,g;h<t;++h)d[(g=f[h]).i]=g.x(p);return d.join("")})}var $b=180/Math.PI,Qv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function wC(e,t,n,s,a,i){var l,d,f;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(f=e*n+t*s)&&(n-=e*f,s-=t*f),(d=Math.sqrt(n*n+s*s))&&(n/=d,s/=d,f/=d),e*s<t*n&&(e=-e,t=-t,f=-f,l=-l),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*$b,skewX:Math.atan(f)*$b,scaleX:l,scaleY:d}}var lu;function BI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Qv:wC(t.a,t.b,t.c,t.d,t.e,t.f)}function UI(e){return e==null||(lu||(lu=document.createElementNS("http://www.w3.org/2000/svg","g")),lu.setAttribute("transform",e),!(e=lu.transform.baseVal.consolidate()))?Qv:(e=e.matrix,wC(e.a,e.b,e.c,e.d,e.e,e.f))}function xC(e,t,n,s){function a(p){return p.length?p.pop()+" ":""}function i(p,h,g,y,w,N){if(p!==g||h!==y){var k=w.push("translate(",null,t,null,n);N.push({i:k-4,x:Os(p,g)},{i:k-2,x:Os(h,y)})}else(g||y)&&w.push("translate("+g+t+y+n)}function l(p,h,g,y){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),y.push({i:g.push(a(g)+"rotate(",null,s)-2,x:Os(p,h)})):h&&g.push(a(g)+"rotate("+h+s)}function d(p,h,g,y){p!==h?y.push({i:g.push(a(g)+"skewX(",null,s)-2,x:Os(p,h)}):h&&g.push(a(g)+"skewX("+h+s)}function f(p,h,g,y,w,N){if(p!==g||h!==y){var k=w.push(a(w)+"scale(",null,",",null,")");N.push({i:k-4,x:Os(p,g)},{i:k-2,x:Os(h,y)})}else(g!==1||y!==1)&&w.push(a(w)+"scale("+g+","+y+")")}return function(p,h){var g=[],y=[];return p=e(p),h=e(h),i(p.translateX,p.translateY,h.translateX,h.translateY,g,y),l(p.rotate,h.rotate,g,y),d(p.skewX,h.skewX,g,y),f(p.scaleX,p.scaleY,h.scaleX,h.scaleY,g,y),p=h=null,function(w){for(var N=-1,k=y.length,E;++N<k;)g[(E=y[N]).i]=E.x(w);return g.join("")}}}var WI=xC(BI,"px, ","px)","deg)"),HI=xC(UI,", ",")",")"),GI=1e-12;function Ob(e){return((e=Math.exp(e))+1/e)/2}function VI(e){return((e=Math.exp(e))-1/e)/2}function YI(e){return((e=Math.exp(2*e))-1)/(e+1)}const KI=(function e(t,n,s){function a(i,l){var d=i[0],f=i[1],p=i[2],h=l[0],g=l[1],y=l[2],w=h-d,N=g-f,k=w*w+N*N,E,_;if(k<GI)_=Math.log(y/p)/t,E=function(I){return[d+I*w,f+I*N,p*Math.exp(t*I*_)]};else{var S=Math.sqrt(k),j=(y*y-p*p+s*k)/(2*p*n*S),C=(y*y-p*p-s*k)/(2*y*n*S),M=Math.log(Math.sqrt(j*j+1)-j),$=Math.log(Math.sqrt(C*C+1)-C);_=($-M)/t,E=function(I){var z=I*_,O=Ob(M),A=p/(n*S)*(O*YI(t*z+M)-VI(M));return[d+A*w,f+A*N,p*O/Ob(t*z+M)]}}return E.duration=_*1e3*t/Math.SQRT2,E}return a.rho=function(i){var l=Math.max(.001,+i),d=l*l,f=d*d;return e(l,d,f)},a})(Math.SQRT2,2,4);var Vo=0,pl=0,al=0,bC=1e3,Lu,ml,Du=0,Aa=0,td=0,Nl=typeof performance=="object"&&performance.now?performance:Date,kC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Rw(){return Aa||(kC(XI),Aa=Nl.now()+td)}function XI(){Aa=0}function qu(){this._call=this._time=this._next=null}qu.prototype=_C.prototype={constructor:qu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Rw():+n)+(t==null?0:+t),!this._next&&ml!==this&&(ml?ml._next=this:Lu=this,ml=this),this._call=e,this._time=n,Zv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zv())}};function _C(e,t,n){var s=new qu;return s.restart(e,t,n),s}function QI(){Rw(),++Vo;for(var e=Lu,t;e;)(t=Aa-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Vo}function Pb(){Aa=(Du=Nl.now())+td,Vo=pl=0;try{QI()}finally{Vo=0,JI(),Aa=0}}function ZI(){var e=Nl.now(),t=e-Du;t>bC&&(td-=t,Du=e)}function JI(){for(var e,t=Lu,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:Lu=n);ml=e,Zv(s)}function Zv(e){if(!Vo){pl&&(pl=clearTimeout(pl));var t=e-Aa;t>24?(e<1/0&&(pl=setTimeout(Pb,e-Nl.now()-td)),al&&(al=clearInterval(al))):(al||(Du=Nl.now(),al=setInterval(ZI,bC)),Vo=1,kC(Pb))}}function Lb(e,t,n){var s=new qu;return t=t==null?0:+t,s.restart(a=>{s.stop(),e(a+t)},t,n),s}var e$=Ju("start","end","cancel","interrupt"),t$=[],SC=0,Db=1,Jv=2,ju=3,qb=4,ew=5,Cu=6;function nd(e,t,n,s,a,i){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;n$(e,n,{name:t,index:s,group:a,on:e$,tween:t$,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:SC})}function Aw(e,t){var n=fr(e,t);if(n.state>SC)throw new Error("too late; already scheduled");return n}function Cr(e,t){var n=fr(e,t);if(n.state>ju)throw new Error("too late; already running");return n}function fr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function n$(e,t,n){var s=e.__transition,a;s[t]=n,n.timer=_C(i,0,n.time);function i(p){n.state=Db,n.timer.restart(l,n.delay,n.time),n.delay<=p&&l(p-n.delay)}function l(p){var h,g,y,w;if(n.state!==Db)return f();for(h in s)if(w=s[h],w.name===n.name){if(w.state===ju)return Lb(l);w.state===qb?(w.state=Cu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[h]):+h<t&&(w.state=Cu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[h])}if(Lb(function(){n.state===ju&&(n.state=qb,n.timer.restart(d,n.delay,n.time),d(p))}),n.state=Jv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Jv){for(n.state=ju,a=new Array(y=n.tween.length),h=0,g=-1;h<y;++h)(w=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(a[++g]=w);a.length=g+1}}function d(p){for(var h=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=ew,1),g=-1,y=a.length;++g<y;)a[g].call(e,h);n.state===ew&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=Cu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function Tu(e,t){var n=e.__transition,s,a,i=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((s=n[l]).name!==t){i=!1;continue}a=s.state>Jv&&s.state<ew,s.state=Cu,s.timer.stop(),s.on.call(a?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}i&&delete e.__transition}}function r$(e){return this.each(function(){Tu(this,e)})}function s$(e,t){var n,s;return function(){var a=Cr(this,e),i=a.tween;if(i!==n){s=n=i;for(var l=0,d=s.length;l<d;++l)if(s[l].name===t){s=s.slice(),s.splice(l,1);break}}a.tween=s}}function a$(e,t,n){var s,a;if(typeof n!="function")throw new Error;return function(){var i=Cr(this,e),l=i.tween;if(l!==s){a=(s=l).slice();for(var d={name:t,value:n},f=0,p=a.length;f<p;++f)if(a[f].name===t){a[f]=d;break}f===p&&a.push(d)}i.tween=a}}function o$(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=fr(this.node(),n).tween,a=0,i=s.length,l;a<i;++a)if((l=s[a]).name===e)return l.value;return null}return this.each((t==null?s$:a$)(n,e,t))}function Mw(e,t,n){var s=e._id;return e.each(function(){var a=Cr(this,s);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return fr(a,s).value[t]}}function NC(e,t){var n;return(typeof t=="number"?Os:t instanceof Sl?Ib:(n=Sl(t))?(t=n,Ib):zI)(e,t)}function i$(e){return function(){this.removeAttribute(e)}}function l$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function c$(e,t,n){var s,a=n+"",i;return function(){var l=this.getAttribute(e);return l===a?null:l===s?i:i=t(s=l,n)}}function u$(e,t,n){var s,a=n+"",i;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===s?i:i=t(s=l,n)}}function d$(e,t,n){var s,a,i;return function(){var l,d=n(this),f;return d==null?void this.removeAttribute(e):(l=this.getAttribute(e),f=d+"",l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,d)))}}function h$(e,t,n){var s,a,i;return function(){var l,d=n(this),f;return d==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),f=d+"",l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,d)))}}function f$(e,t){var n=ed(e),s=n==="transform"?HI:NC;return this.attrTween(e,typeof t=="function"?(n.local?h$:d$)(n,s,Mw(this,"attr."+e,t)):t==null?(n.local?l$:i$)(n):(n.local?u$:c$)(n,s,t))}function p$(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function m$(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function g$(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&m$(e,i)),n}return a._value=t,a}function y$(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&p$(e,i)),n}return a._value=t,a}function v$(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=ed(e);return this.tween(n,(s.local?g$:y$)(s,t))}function w$(e,t){return function(){Aw(this,e).delay=+t.apply(this,arguments)}}function x$(e,t){return t=+t,function(){Aw(this,e).delay=t}}function b$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?w$:x$)(t,e)):fr(this.node(),t).delay}function k$(e,t){return function(){Cr(this,e).duration=+t.apply(this,arguments)}}function _$(e,t){return t=+t,function(){Cr(this,e).duration=t}}function S$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?k$:_$)(t,e)):fr(this.node(),t).duration}function N$(e,t){if(typeof t!="function")throw new Error;return function(){Cr(this,e).ease=t}}function E$(e){var t=this._id;return arguments.length?this.each(N$(t,e)):fr(this.node(),t).ease}function j$(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Cr(this,e).ease=n}}function C$(e){if(typeof e!="function")throw new Error;return this.each(j$(this._id,e))}function T$(e){typeof e!="function"&&(e=rC(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],l=i.length,d=s[a]=[],f,p=0;p<l;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&d.push(f);return new rs(s,this._parents,this._name,this._id)}function R$(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,a=n.length,i=Math.min(s,a),l=new Array(s),d=0;d<i;++d)for(var f=t[d],p=n[d],h=f.length,g=l[d]=new Array(h),y,w=0;w<h;++w)(y=f[w]||p[w])&&(g[w]=y);for(;d<s;++d)l[d]=t[d];return new rs(l,this._parents,this._name,this._id)}function A$(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 M$(e,t,n){var s,a,i=A$(t)?Aw:Cr;return function(){var l=i(this,e),d=l.on;d!==s&&(a=(s=d).copy()).on(t,n),l.on=a}}function I$(e,t){var n=this._id;return arguments.length<2?fr(this.node(),n).on.on(e):this.each(M$(n,e,t))}function $$(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function O$(){return this.on("end.remove",$$(this._id))}function P$(e){var t=this._name,n=this._id;typeof e!="function"&&(e=jw(e));for(var s=this._groups,a=s.length,i=new Array(a),l=0;l<a;++l)for(var d=s[l],f=d.length,p=i[l]=new Array(f),h,g,y=0;y<f;++y)(h=d[y])&&(g=e.call(h,h.__data__,y,d))&&("__data__"in h&&(g.__data__=h.__data__),p[y]=g,nd(p[y],t,n,y,p,fr(h,n)));return new rs(i,this._parents,t,n)}function L$(e){var t=this._name,n=this._id;typeof e!="function"&&(e=nC(e));for(var s=this._groups,a=s.length,i=[],l=[],d=0;d<a;++d)for(var f=s[d],p=f.length,h,g=0;g<p;++g)if(h=f[g]){for(var y=e.call(h,h.__data__,g,f),w,N=fr(h,n),k=0,E=y.length;k<E;++k)(w=y[k])&&nd(w,t,n,k,y,N);i.push(y),l.push(h)}return new rs(i,l,t,n)}var D$=Ol.prototype.constructor;function q$(){return new D$(this._groups,this._parents)}function F$(e,t){var n,s,a;return function(){var i=Go(this,e),l=(this.style.removeProperty(e),Go(this,e));return i===l?null:i===n&&l===s?a:a=t(n=i,s=l)}}function EC(e){return function(){this.style.removeProperty(e)}}function z$(e,t,n){var s,a=n+"",i;return function(){var l=Go(this,e);return l===a?null:l===s?i:i=t(s=l,n)}}function B$(e,t,n){var s,a,i;return function(){var l=Go(this,e),d=n(this),f=d+"";return d==null&&(f=d=(this.style.removeProperty(e),Go(this,e))),l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,d))}}function U$(e,t){var n,s,a,i="style."+t,l="end."+i,d;return function(){var f=Cr(this,e),p=f.on,h=f.value[i]==null?d||(d=EC(t)):void 0;(p!==n||a!==h)&&(s=(n=p).copy()).on(l,a=h),f.on=s}}function W$(e,t,n){var s=(e+="")=="transform"?WI:NC;return t==null?this.styleTween(e,F$(e,s)).on("end.style."+e,EC(e)):typeof t=="function"?this.styleTween(e,B$(e,s,Mw(this,"style."+e,t))).each(U$(this._id,e)):this.styleTween(e,z$(e,s,t),n).on("end.style."+e,null)}function H$(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function G$(e,t,n){var s,a;function i(){var l=t.apply(this,arguments);return l!==a&&(s=(a=l)&&H$(e,l,n)),s}return i._value=t,i}function V$(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,G$(e,t,n??""))}function Y$(e){return function(){this.textContent=e}}function K$(e){return function(){var t=e(this);this.textContent=t??""}}function X$(e){return this.tween("text",typeof e=="function"?K$(Mw(this,"text",e)):Y$(e==null?"":e+""))}function Q$(e){return function(t){this.textContent=e.call(this,t)}}function Z$(e){var t,n;function s(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&Q$(a)),t}return s._value=e,s}function J$(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,Z$(e))}function eO(){for(var e=this._name,t=this._id,n=jC(),s=this._groups,a=s.length,i=0;i<a;++i)for(var l=s[i],d=l.length,f,p=0;p<d;++p)if(f=l[p]){var h=fr(f,t);nd(f,e,n,p,l,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new rs(s,this._parents,e,n)}function tO(){var e,t,n=this,s=n._id,a=n.size();return new Promise(function(i,l){var d={value:l},f={value:function(){--a===0&&i()}};n.each(function(){var p=Cr(this,s),h=p.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(d),t._.interrupt.push(d),t._.end.push(f)),p.on=t}),a===0&&i()})}var nO=0;function rs(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function jC(){return++nO}var es=Ol.prototype;rs.prototype={constructor:rs,select:P$,selectAll:L$,selectChild:es.selectChild,selectChildren:es.selectChildren,filter:T$,merge:R$,selection:q$,transition:eO,call:es.call,nodes:es.nodes,node:es.node,size:es.size,empty:es.empty,each:es.each,on:I$,attr:f$,attrTween:v$,style:W$,styleTween:V$,text:X$,textTween:J$,remove:O$,tween:o$,delay:b$,duration:S$,ease:E$,easeVarying:C$,end:tO,[Symbol.iterator]:es[Symbol.iterator]};function rO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var sO={time:null,delay:0,duration:250,ease:rO};function aO(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 oO(e){var t,n;e instanceof rs?(t=e._id,e=e._name):(t=jC(),(n=sO).time=Rw(),e=e==null?null:e+"");for(var s=this._groups,a=s.length,i=0;i<a;++i)for(var l=s[i],d=l.length,f,p=0;p<d;++p)(f=l[p])&&nd(f,e,t,p,l,n||aO(f,t));return new rs(s,this._parents,e,t)}Ol.prototype.interrupt=r$;Ol.prototype.transition=oO;const cu=e=>()=>e;function iO(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 ts(e,t,n){this.k=e,this.x=t,this.y=n}ts.prototype={constructor:ts,scale:function(e){return e===1?this:new ts(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ts(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 ns=new ts(1,0,0);ts.prototype;function pf(e){e.stopImmediatePropagation()}function ol(e){e.preventDefault(),e.stopImmediatePropagation()}function lO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function cO(){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 Fb(){return this.__zoom||ns}function uO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function dO(){return navigator.maxTouchPoints||"ontouchstart"in this}function hO(e,t,n){var s=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a),l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l))}function CC(){var e=lO,t=cO,n=hO,s=uO,a=dO,i=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],d=250,f=KI,p=Ju("start","zoom","end"),h,g,y,w=500,N=150,k=0,E=10;function _(R){R.property("__zoom",Fb).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",A).filter(a).on("touchstart.zoom",D).on("touchmove.zoom",H).on("touchend.zoom touchcancel.zoom",X).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(R,Z,B,Q){var P=R.selection?R.selection():R;P.property("__zoom",Fb),R!==P?M(R,Z,B,Q):P.interrupt().each(function(){$(this,arguments).event(Q).start().zoom(null,typeof Z=="function"?Z.apply(this,arguments):Z).end()})},_.scaleBy=function(R,Z,B,Q){_.scaleTo(R,function(){var P=this.__zoom.k,F=typeof Z=="function"?Z.apply(this,arguments):Z;return P*F},B,Q)},_.scaleTo=function(R,Z,B,Q){_.transform(R,function(){var P=t.apply(this,arguments),F=this.__zoom,J=B==null?C(P):typeof B=="function"?B.apply(this,arguments):B,L=F.invert(J),K=typeof Z=="function"?Z.apply(this,arguments):Z;return n(j(S(F,K),J,L),P,l)},B,Q)},_.translateBy=function(R,Z,B,Q){_.transform(R,function(){return n(this.__zoom.translate(typeof Z=="function"?Z.apply(this,arguments):Z,typeof B=="function"?B.apply(this,arguments):B),t.apply(this,arguments),l)},null,Q)},_.translateTo=function(R,Z,B,Q,P){_.transform(R,function(){var F=t.apply(this,arguments),J=this.__zoom,L=Q==null?C(F):typeof Q=="function"?Q.apply(this,arguments):Q;return n(ns.translate(L[0],L[1]).scale(J.k).translate(typeof Z=="function"?-Z.apply(this,arguments):-Z,typeof B=="function"?-B.apply(this,arguments):-B),F,l)},Q,P)};function S(R,Z){return Z=Math.max(i[0],Math.min(i[1],Z)),Z===R.k?R:new ts(Z,R.x,R.y)}function j(R,Z,B){var Q=Z[0]-B[0]*R.k,P=Z[1]-B[1]*R.k;return Q===R.x&&P===R.y?R:new ts(R.k,Q,P)}function C(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function M(R,Z,B,Q){R.on("start.zoom",function(){$(this,arguments).event(Q).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(Q).end()}).tween("zoom",function(){var P=this,F=arguments,J=$(P,F).event(Q),L=t.apply(P,F),K=B==null?C(L):typeof B=="function"?B.apply(P,F):B,ue=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),G=P.__zoom,U=typeof Z=="function"?Z.apply(P,F):Z,ee=f(G.invert(K).concat(ue/G.k),U.invert(K).concat(ue/U.k));return function(Y){if(Y===1)Y=U;else{var le=ee(Y),fe=ue/le[2];Y=new ts(fe,K[0]-le[0]*fe,K[1]-le[1]*fe)}J.zoom(null,Y)}})}function $(R,Z,B){return!B&&R.__zooming||new I(R,Z)}function I(R,Z){this.that=R,this.args=Z,this.active=0,this.sourceEvent=null,this.extent=t.apply(R,Z),this.taps=0}I.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,Z){return this.mouse&&R!=="mouse"&&(this.mouse[1]=Z.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=Z.invert(this.touch0[0])),this.touch1&&R!=="touch"&&(this.touch1[1]=Z.invert(this.touch1[0])),this.that.__zoom=Z,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(R){var Z=Hn(this.that).datum();p.call(R,this.that,new iO(R,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:p}),Z)}};function z(R,...Z){if(!e.apply(this,arguments))return;var B=$(this,Z).event(R),Q=this.__zoom,P=Math.max(i[0],Math.min(i[1],Q.k*Math.pow(2,s.apply(this,arguments)))),F=or(R);if(B.wheel)(B.mouse[0][0]!==F[0]||B.mouse[0][1]!==F[1])&&(B.mouse[1]=Q.invert(B.mouse[0]=F)),clearTimeout(B.wheel);else{if(Q.k===P)return;B.mouse=[F,Q.invert(F)],Tu(this),B.start()}ol(R),B.wheel=setTimeout(J,N),B.zoom("mouse",n(j(S(Q,P),B.mouse[0],B.mouse[1]),B.extent,l));function J(){B.wheel=null,B.end()}}function O(R,...Z){if(y||!e.apply(this,arguments))return;var B=R.currentTarget,Q=$(this,Z,!0).event(R),P=Hn(R.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",ue,!0),F=or(R,B),J=R.clientX,L=R.clientY;fC(R.view),pf(R),Q.mouse=[F,this.__zoom.invert(F)],Tu(this),Q.start();function K(G){if(ol(G),!Q.moved){var U=G.clientX-J,ee=G.clientY-L;Q.moved=U*U+ee*ee>k}Q.event(G).zoom("mouse",n(j(Q.that.__zoom,Q.mouse[0]=or(G,B),Q.mouse[1]),Q.extent,l))}function ue(G){P.on("mousemove.zoom mouseup.zoom",null),pC(G.view,Q.moved),ol(G),Q.event(G).end()}}function A(R,...Z){if(e.apply(this,arguments)){var B=this.__zoom,Q=or(R.changedTouches?R.changedTouches[0]:R,this),P=B.invert(Q),F=B.k*(R.shiftKey?.5:2),J=n(j(S(B,F),Q,P),t.apply(this,Z),l);ol(R),d>0?Hn(this).transition().duration(d).call(M,J,Q,R):Hn(this).call(_.transform,J,Q,R)}}function D(R,...Z){if(e.apply(this,arguments)){var B=R.touches,Q=B.length,P=$(this,Z,R.changedTouches.length===Q).event(R),F,J,L,K;for(pf(R),J=0;J<Q;++J)L=B[J],K=or(L,this),K=[K,this.__zoom.invert(K),L.identifier],P.touch0?!P.touch1&&P.touch0[2]!==K[2]&&(P.touch1=K,P.taps=0):(P.touch0=K,F=!0,P.taps=1+!!h);h&&(h=clearTimeout(h)),F&&(P.taps<2&&(g=K[0],h=setTimeout(function(){h=null},w)),Tu(this),P.start())}}function H(R,...Z){if(this.__zooming){var B=$(this,Z).event(R),Q=R.changedTouches,P=Q.length,F,J,L,K;for(ol(R),F=0;F<P;++F)J=Q[F],L=or(J,this),B.touch0&&B.touch0[2]===J.identifier?B.touch0[0]=L:B.touch1&&B.touch1[2]===J.identifier&&(B.touch1[0]=L);if(J=B.that.__zoom,B.touch1){var ue=B.touch0[0],G=B.touch0[1],U=B.touch1[0],ee=B.touch1[1],Y=(Y=U[0]-ue[0])*Y+(Y=U[1]-ue[1])*Y,le=(le=ee[0]-G[0])*le+(le=ee[1]-G[1])*le;J=S(J,Math.sqrt(Y/le)),L=[(ue[0]+U[0])/2,(ue[1]+U[1])/2],K=[(G[0]+ee[0])/2,(G[1]+ee[1])/2]}else if(B.touch0)L=B.touch0[0],K=B.touch0[1];else return;B.zoom("touch",n(j(J,L,K),B.extent,l))}}function X(R,...Z){if(this.__zooming){var B=$(this,Z).event(R),Q=R.changedTouches,P=Q.length,F,J;for(pf(R),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),F=0;F<P;++F)J=Q[F],B.touch0&&B.touch0[2]===J.identifier?delete B.touch0:B.touch1&&B.touch1[2]===J.identifier&&delete B.touch1;if(B.touch1&&!B.touch0&&(B.touch0=B.touch1,delete B.touch1),B.touch0)B.touch0[1]=this.__zoom.invert(B.touch0[0]);else if(B.end(),B.taps===2&&(J=or(J,this),Math.hypot(g[0]-J[0],g[1]-J[1])<E)){var L=Hn(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return _.wheelDelta=function(R){return arguments.length?(s=typeof R=="function"?R:cu(+R),_):s},_.filter=function(R){return arguments.length?(e=typeof R=="function"?R:cu(!!R),_):e},_.touchable=function(R){return arguments.length?(a=typeof R=="function"?R:cu(!!R),_):a},_.extent=function(R){return arguments.length?(t=typeof R=="function"?R:cu([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),_):t},_.scaleExtent=function(R){return arguments.length?(i[0]=+R[0],i[1]=+R[1],_):[i[0],i[1]]},_.translateExtent=function(R){return arguments.length?(l[0][0]=+R[0][0],l[1][0]=+R[1][0],l[0][1]=+R[0][1],l[1][1]=+R[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(R){return arguments.length?(n=R,_):n},_.duration=function(R){return arguments.length?(d=+R,_):d},_.interpolate=function(R){return arguments.length?(f=R,_):f},_.on=function(){var R=p.on.apply(p,arguments);return R===p?_:R},_.clickDistance=function(R){return arguments.length?(k=(R=+R)*R,_):Math.sqrt(k)},_.tapDistance=function(R){return arguments.length?(E=+R,_):E},_}var Iw=Jj();const rd=b.createContext(null),fO=rd.Provider,ss={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.`},TC=ss.error001();function ct(e,t){const n=b.useContext(rd);if(n===null)throw new Error(TC);return eC(n,e,t)}const Mt=()=>{const e=b.useContext(rd);if(e===null)throw new Error(TC);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},pO=e=>e.userSelectionActive?"none":"all";function $w({position:e,children:t,className:n,style:s,...a}){const i=ct(pO),l=`${e}`.split("-");return he.createElement("div",{className:Vt(["react-flow__panel",n,...l]),style:{...s,pointerEvents:i},...a},t)}function mO({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:he.createElement($w,{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"},he.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const gO=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:a=!0,labelBgStyle:i={},labelBgPadding:l=[2,4],labelBgBorderRadius:d=2,children:f,className:p,...h})=>{const g=b.useRef(null),[y,w]=b.useState({x:0,y:0,width:0,height:0}),N=Vt(["react-flow__edge-textwrapper",p]);return b.useEffect(()=>{if(g.current){const k=g.current.getBBox();w({x:k.x,y:k.y,width:k.width,height:k.height})}},[n]),typeof n>"u"||!n?null:he.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:N,visibility:y.width?"visible":"hidden",...h},a&&he.createElement("rect",{width:y.width+2*l[0],x:-l[0],y:-l[1],height:y.height+2*l[1],className:"react-flow__edge-textbg",style:i,rx:d,ry:d}),he.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:g,style:s},n),f)};var yO=b.memo(gO);const Ow=e=>({width:e.offsetWidth,height:e.offsetHeight}),Yo=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Pw=(e={x:0,y:0},t)=>({x:Yo(e.x,t[0][0],t[1][0]),y:Yo(e.y,t[0][1],t[1][1])}),zb=(e,t,n)=>e<t?Yo(Math.abs(e-t),1,50)/50:e>n?-Yo(Math.abs(e-n),1,50)/50:0,RC=(e,t)=>{const n=zb(e.x,35,t.width-35)*20,s=zb(e.y,35,t.height-35)*20;return[n,s]},AC=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},MC=(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)}),El=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),IC=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Bb=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),vO=(e,t)=>IC(MC(El(e),El(t))),tw=(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)},wO=e=>Gn(e.width)&&Gn(e.height)&&Gn(e.x)&&Gn(e.y),Gn=e=>!isNaN(e)&&isFinite(e),jt=Symbol.for("internals"),$C=["Enter"," ","Escape"],xO=(e,t)=>{},bO=e=>"nativeEvent"in e;function nw(e){var a,i;const t=bO(e)?e.nativeEvent:e,n=((i=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const OC=e=>"clientX"in e,Ds=(e,t)=>{var i,l;const n=OC(e),s=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,a=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},Fu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Ll=({id:e,path:t,labelX:n,labelY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:y,interactionWidth:w=20})=>he.createElement(he.Fragment,null,he.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:y}),w&&he.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),a&&Gn(n)&&Gn(s)?he.createElement(yO,{x:n,y:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p}):null);Ll.displayName="BaseEdge";function il(e,t,n){return n===void 0?n:s=>{const a=t().edges.find(i=>i.id===e);a&&n(s,{...a})}}function PC({sourceX:e,sourceY:t,targetX:n,targetY:s}){const a=Math.abs(n-e)/2,i=n<e?n+a:n-a,l=Math.abs(s-t)/2,d=s<t?s+l:s-l;return[i,d,a,l]}function LC({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:a,sourceControlY:i,targetControlX:l,targetControlY:d}){const f=e*.125+a*.375+l*.375+n*.125,p=t*.125+i*.375+d*.375+s*.125,h=Math.abs(f-e),g=Math.abs(p-t);return[f,p,h,g]}var Ma;(function(e){e.Strict="strict",e.Loose="loose"})(Ma||(Ma={}));var Ca;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ca||(Ca={}));var jl;(function(e){e.Partial="partial",e.Full="full"})(jl||(jl={}));var Ls;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ls||(Ls={}));var zu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(zu||(zu={}));var Oe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Oe||(Oe={}));function Ub({pos:e,x1:t,y1:n,x2:s,y2:a}){return e===Oe.Left||e===Oe.Right?[.5*(t+s),n]:[t,.5*(n+a)]}function DC({sourceX:e,sourceY:t,sourcePosition:n=Oe.Bottom,targetX:s,targetY:a,targetPosition:i=Oe.Top}){const[l,d]=Ub({pos:n,x1:e,y1:t,x2:s,y2:a}),[f,p]=Ub({pos:i,x1:s,y1:a,x2:e,y2:t}),[h,g,y,w]=LC({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:l,sourceControlY:d,targetControlX:f,targetControlY:p});return[`M${e},${t} C${l},${d} ${f},${p} ${s},${a}`,h,g,y,w]}const Lw=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=Oe.Bottom,targetPosition:i=Oe.Top,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:k})=>{const[E,_,S]=DC({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i});return he.createElement(Ll,{path:E,labelX:_,labelY:S,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:k})});Lw.displayName="SimpleBezierEdge";const Wb={[Oe.Left]:{x:-1,y:0},[Oe.Right]:{x:1,y:0},[Oe.Top]:{x:0,y:-1},[Oe.Bottom]:{x:0,y:1}},kO=({source:e,sourcePosition:t=Oe.Bottom,target:n})=>t===Oe.Left||t===Oe.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},Hb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function _O({source:e,sourcePosition:t=Oe.Bottom,target:n,targetPosition:s=Oe.Top,center:a,offset:i}){const l=Wb[t],d=Wb[s],f={x:e.x+l.x*i,y:e.y+l.y*i},p={x:n.x+d.x*i,y:n.y+d.y*i},h=kO({source:f,sourcePosition:t,target:p}),g=h.x!==0?"x":"y",y=h[g];let w=[],N,k;const E={x:0,y:0},_={x:0,y:0},[S,j,C,M]=PC({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*d[g]===-1){N=a.x??S,k=a.y??j;const I=[{x:N,y:f.y},{x:N,y:p.y}],z=[{x:f.x,y:k},{x:p.x,y:k}];l[g]===y?w=g==="x"?I:z:w=g==="x"?z:I}else{const I=[{x:f.x,y:p.y}],z=[{x:p.x,y:f.y}];if(g==="x"?w=l.x===y?z:I:w=l.y===y?I:z,t===s){const X=Math.abs(e[g]-n[g]);if(X<=i){const R=Math.min(i-1,i-X);l[g]===y?E[g]=(f[g]>e[g]?-1:1)*R:_[g]=(p[g]>n[g]?-1:1)*R}}if(t!==s){const X=g==="x"?"y":"x",R=l[g]===d[X],Z=f[X]>p[X],B=f[X]<p[X];(l[g]===1&&(!R&&Z||R&&B)||l[g]!==1&&(!R&&B||R&&Z))&&(w=g==="x"?I:z)}const O={x:f.x+E.x,y:f.y+E.y},A={x:p.x+_.x,y:p.y+_.y},D=Math.max(Math.abs(O.x-w[0].x),Math.abs(A.x-w[0].x)),H=Math.max(Math.abs(O.y-w[0].y),Math.abs(A.y-w[0].y));D>=H?(N=(O.x+A.x)/2,k=w[0].y):(N=w[0].x,k=(O.y+A.y)/2)}return[[e,{x:f.x+E.x,y:f.y+E.y},...w,{x:p.x+_.x,y:p.y+_.y},n],N,k,C,M]}function SO(e,t,n,s){const a=Math.min(Hb(e,t)/2,Hb(t,n)/2,s),{x:i,y:l}=t;if(e.x===i&&i===n.x||e.y===l&&l===n.y)return`L${i} ${l}`;if(e.y===l){const p=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${i+a*p},${l}Q ${i},${l} ${i},${l+a*h}`}const d=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${i},${l+a*f}Q ${i},${l} ${i+a*d},${l}`}function rw({sourceX:e,sourceY:t,sourcePosition:n=Oe.Bottom,targetX:s,targetY:a,targetPosition:i=Oe.Top,borderRadius:l=5,centerX:d,centerY:f,offset:p=20}){const[h,g,y,w,N]=_O({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:a},targetPosition:i,center:{x:d,y:f},offset:p});return[h.reduce((E,_,S)=>{let j="";return S>0&&S<h.length-1?j=SO(h[S-1],_,h[S+1],l):j=`${S===0?"M":"L"}${_.x} ${_.y}`,E+=j,E},""),g,y,w,N]}const sd=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,sourcePosition:g=Oe.Bottom,targetPosition:y=Oe.Top,markerEnd:w,markerStart:N,pathOptions:k,interactionWidth:E})=>{const[_,S,j]=rw({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:y,borderRadius:k==null?void 0:k.borderRadius,offset:k==null?void 0:k.offset});return he.createElement(Ll,{path:_,labelX:S,labelY:j,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:N,interactionWidth:E})});sd.displayName="SmoothStepEdge";const Dw=b.memo(e=>{var t;return he.createElement(sd,{...e,pathOptions:b.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Dw.displayName="StepEdge";function NO({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[a,i,l,d]=PC({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,a,i,l,d]}const qw=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:y,interactionWidth:w})=>{const[N,k,E]=NO({sourceX:e,sourceY:t,targetX:n,targetY:s});return he.createElement(Ll,{path:N,labelX:k,labelY:E,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:y,interactionWidth:w})});qw.displayName="StraightEdge";function uu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Gb({pos:e,x1:t,y1:n,x2:s,y2:a,c:i}){switch(e){case Oe.Left:return[t-uu(t-s,i),n];case Oe.Right:return[t+uu(s-t,i),n];case Oe.Top:return[t,n-uu(n-a,i)];case Oe.Bottom:return[t,n+uu(a-n,i)]}}function qC({sourceX:e,sourceY:t,sourcePosition:n=Oe.Bottom,targetX:s,targetY:a,targetPosition:i=Oe.Top,curvature:l=.25}){const[d,f]=Gb({pos:n,x1:e,y1:t,x2:s,y2:a,c:l}),[p,h]=Gb({pos:i,x1:s,y1:a,x2:e,y2:t,c:l}),[g,y,w,N]=LC({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:d,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${d},${f} ${p},${h} ${s},${a}`,g,y,w,N]}const Bu=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=Oe.Bottom,targetPosition:i=Oe.Top,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,pathOptions:k,interactionWidth:E})=>{const[_,S,j]=qC({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i,curvature:k==null?void 0:k.curvature});return he.createElement(Ll,{path:_,labelX:S,labelY:j,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:E})});Bu.displayName="BezierEdge";const Fw=b.createContext(null),EO=Fw.Provider;Fw.Consumer;const jO=()=>b.useContext(Fw),CO=e=>"id"in e&&"source"in e&&"target"in e,TO=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,sw=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,RO=(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)),AO=(e,t)=>{if(!e.source||!e.target)return t;let n;return CO(e)?n={...e}:n={...e,id:TO(e)},RO(n,t)?t:t.concat(n)},aw=({x:e,y:t},[n,s,a],i,[l,d])=>{const f={x:(e-n)/a,y:(t-s)/a};return i?{x:l*Math.round(f.x/l),y:d*Math.round(f.y/d)}:f},FC=({x:e,y:t},[n,s,a])=>({x:e*a+n,y:t*a+s}),Ra=(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}},ad=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,a)=>{const{x:i,y:l}=Ra(a,t).positionAbsolute;return MC(s,El({x:i,y:l,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return IC(n)},zC=(e,t,[n,s,a]=[0,0,1],i=!1,l=!1,d=[0,0])=>{const f={x:(t.x-n)/a,y:(t.y-s)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(h=>{const{width:g,height:y,selectable:w=!0,hidden:N=!1}=h;if(l&&!w||N)return!1;const{positionAbsolute:k}=Ra(h,d),E={x:k.x,y:k.y,width:g||0,height:y||0},_=tw(f,E),S=typeof g>"u"||typeof y>"u"||g===null||y===null,j=i&&_>0,C=(g||0)*(y||0);(S||j||_>=C||h.dragging)&&p.push(h)}),p},BC=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},UC=(e,t,n,s,a,i=.1)=>{const l=t/(e.width*(1+i)),d=n/(e.height*(1+i)),f=Math.min(l,d),p=Yo(f,s,a),h=e.x+e.width/2,g=e.y+e.height/2,y=t/2-h*p,w=n/2-g*p;return{x:y,y:w,zoom:p}},Ea=(e,t=0)=>e.transition().duration(t);function Vb(e,t,n,s){return(t[n]||[]).reduce((a,i)=>{var l,d;return`${e.id}-${i.id}-${n}`!==s&&a.push({id:i.id||null,type:n,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+i.x+i.width/2,y:(((d=e.positionAbsolute)==null?void 0:d.y)??0)+i.y+i.height/2}),a},[])}function MO(e,t,n,s,a,i){const{x:l,y:d}=Ds(e),p=t.elementsFromPoint(l,d).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const k=zw(void 0,p),E=p.getAttribute("data-handleid"),_=i({nodeId:N,id:E,type:k});if(_){const S=a.find(j=>j.nodeId===N&&j.type===k&&j.id===E);return{handle:{id:E,type:k,nodeId:N,x:(S==null?void 0:S.x)||n.x,y:(S==null?void 0:S.y)||n.y},validHandleResult:_}}}}let h=[],g=1/0;if(a.forEach(N=>{const k=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(k<=s){const E=i(N);k<=g&&(k<g?h=[{handle:N,validHandleResult:E}]:k===g&&h.push({handle:N,validHandleResult:E}),g=k)}}),!h.length)return{handle:null,validHandleResult:WC()};if(h.length===1)return h[0];const y=h.some(({validHandleResult:N})=>N.isValid),w=h.some(({handle:N})=>N.type==="target");return h.find(({handle:N,validHandleResult:k})=>w?N.type==="target":y?k.isValid:!0)||h[0]}const IO={source:null,target:null,sourceHandle:null,targetHandle:null},WC=()=>({handleDomNode:null,isValid:!1,connection:IO,endHandle:null});function HC(e,t,n,s,a,i,l){const d=a==="target",f=l.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...WC(),handleDomNode:f};if(f){const h=zw(void 0,f),g=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),N=f.classList.contains("connectableend"),k={source:d?g:n,sourceHandle:d?y:s,target:d?n:g,targetHandle:d?s:y};p.connection=k,w&&N&&(t===Ma.Strict?d&&h==="source"||!d&&h==="target":g!==n||y!==s)&&(p.endHandle={nodeId:g,handleId:y,type:h},p.isValid=i(k))}return p}function $O({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((a,i)=>{if(i[jt]){const{handleBounds:l}=i[jt];let d=[],f=[];l&&(d=Vb(i,l,"source",`${t}-${n}-${s}`),f=Vb(i,l,"target",`${t}-${n}-${s}`)),a.push(...d,...f)}return a},[])}function zw(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 OO(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function GC({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:a,getState:i,setState:l,isValidConnection:d,edgeUpdaterType:f,onReconnectEnd:p}){const h=AC(e.target),{connectionMode:g,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:k,panBy:E,getNodes:_,cancelConnection:S}=i();let j=0,C;const{x:M,y:$}=Ds(e),I=h==null?void 0:h.elementFromPoint(M,$),z=zw(f,I),O=y==null?void 0:y.getBoundingClientRect();if(!O||!z)return;let A,D=Ds(e,O),H=!1,X=null,R=!1,Z=null;const B=$O({nodes:_(),nodeId:n,handleId:t,handleType:z}),Q=()=>{if(!w)return;const[J,L]=RC(D,O);E({x:J,y:L}),j=requestAnimationFrame(Q)};l({connectionPosition:D,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:z,connectionStartHandle:{nodeId:n,handleId:t,type:z},connectionEndHandle:null}),k==null||k(e,{nodeId:n,handleId:t,handleType:z});function P(J){const{transform:L}=i();D=Ds(J,O);const{handle:K,validHandleResult:ue}=MO(J,h,aw(D,L,!1,[1,1]),N,B,G=>HC(G,g,n,t,a?"target":"source",d,h));if(C=K,H||(Q(),H=!0),Z=ue.handleDomNode,X=ue.connection,R=ue.isValid,l({connectionPosition:C&&R?FC({x:C.x,y:C.y},L):D,connectionStatus:OO(!!C,R),connectionEndHandle:ue.endHandle}),!C&&!R&&!Z)return mf(A);X.source!==X.target&&Z&&(mf(A),A=Z,Z.classList.add("connecting","react-flow__handle-connecting"),Z.classList.toggle("valid",R),Z.classList.toggle("react-flow__handle-valid",R))}function F(J){var L,K;(C||Z)&&X&&R&&(s==null||s(X)),(K=(L=i()).onConnectEnd)==null||K.call(L,J),f&&(p==null||p(J)),mf(A),S(),cancelAnimationFrame(j),H=!1,R=!1,X=null,Z=null,h.removeEventListener("mousemove",P),h.removeEventListener("mouseup",F),h.removeEventListener("touchmove",P),h.removeEventListener("touchend",F)}h.addEventListener("mousemove",P),h.addEventListener("mouseup",F),h.addEventListener("touchmove",P),h.addEventListener("touchend",F)}const Yb=()=>!0,PO=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),LO=(e,t,n)=>s=>{const{connectionStartHandle:a,connectionEndHandle:i,connectionClickStartHandle:l}=s;return{connecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n}},VC=b.forwardRef(({type:e="source",position:t=Oe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:i=!0,id:l,onConnect:d,children:f,className:p,onMouseDown:h,onTouchStart:g,...y},w)=>{var O,A;const N=l||null,k=e==="target",E=Mt(),_=jO(),{connectOnClick:S,noPanClassName:j}=ct(PO,Dt),{connecting:C,clickConnecting:M}=ct(LO(_,N,e),Dt);_||(A=(O=E.getState()).onError)==null||A.call(O,"010",ss.error010());const $=D=>{const{defaultEdgeOptions:H,onConnect:X,hasDefaultEdges:R}=E.getState(),Z={...H,...D};if(R){const{edges:B,setEdges:Q}=E.getState();Q(AO(Z,B))}X==null||X(Z),d==null||d(Z)},I=D=>{if(!_)return;const H=OC(D);a&&(H&&D.button===0||!H)&&GC({event:D,handleId:N,nodeId:_,onConnect:$,isTarget:k,getState:E.getState,setState:E.setState,isValidConnection:n||E.getState().isValidConnection||Yb}),H?h==null||h(D):g==null||g(D)},z=D=>{const{onClickConnectStart:H,onClickConnectEnd:X,connectionClickStartHandle:R,connectionMode:Z,isValidConnection:B}=E.getState();if(!_||!R&&!a)return;if(!R){H==null||H(D,{nodeId:_,handleId:N,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:N}});return}const Q=AC(D.target),P=n||B||Yb,{connection:F,isValid:J}=HC({nodeId:_,id:N,type:e},Z,R.nodeId,R.handleId||null,R.type,P,Q);J&&$(F),X==null||X(D),E.setState({connectionClickStartHandle:null})};return he.createElement("div",{"data-handleid":N,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${N}-${e}`,className:Vt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",j,p,{source:!k,target:k,connectable:s,connectablestart:a,connectableend:i,connecting:M,connectionindicator:s&&(a&&!C||i&&C)}]),onMouseDown:I,onTouchStart:I,onClick:S?z:void 0,ref:w,...y},f)});VC.displayName="Handle";var Ko=b.memo(VC);const YC=({data:e,isConnectable:t,targetPosition:n=Oe.Top,sourcePosition:s=Oe.Bottom})=>he.createElement(he.Fragment,null,he.createElement(Ko,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,he.createElement(Ko,{type:"source",position:s,isConnectable:t}));YC.displayName="DefaultNode";var ow=b.memo(YC);const KC=({data:e,isConnectable:t,sourcePosition:n=Oe.Bottom})=>he.createElement(he.Fragment,null,e==null?void 0:e.label,he.createElement(Ko,{type:"source",position:n,isConnectable:t}));KC.displayName="InputNode";var XC=b.memo(KC);const QC=({data:e,isConnectable:t,targetPosition:n=Oe.Top})=>he.createElement(he.Fragment,null,he.createElement(Ko,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);QC.displayName="OutputNode";var ZC=b.memo(QC);const Bw=()=>null;Bw.displayName="GroupNode";const DO=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),du=e=>e.id;function qO(e,t){return Dt(e.selectedNodes.map(du),t.selectedNodes.map(du))&&Dt(e.selectedEdges.map(du),t.selectedEdges.map(du))}const JC=b.memo(({onSelectionChange:e})=>{const t=Mt(),{selectedNodes:n,selectedEdges:s}=ct(DO,qO);return b.useEffect(()=>{const a={nodes:n,edges:s};e==null||e(a),t.getState().onSelectionChange.forEach(i=>i(a))},[n,s,e]),null});JC.displayName="SelectionListener";const FO=e=>!!e.onSelectionChange;function zO({onSelectionChange:e}){const t=ct(FO);return e||t?he.createElement(JC,{onSelectionChange:e}):null}const BO=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 Ro(e,t){b.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Xe(e,t,n){b.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const UO=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:a,onConnectStart:i,onConnectEnd:l,onClickConnectStart:d,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:h,nodesFocusable:g,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:k,maxZoom:E,nodeExtent:_,onNodesChange:S,onEdgesChange:j,elementsSelectable:C,connectionMode:M,snapGrid:$,snapToGrid:I,translateExtent:z,connectOnClick:O,defaultEdgeOptions:A,fitView:D,fitViewOptions:H,onNodesDelete:X,onEdgesDelete:R,onNodeDrag:Z,onNodeDragStart:B,onNodeDragStop:Q,onSelectionDrag:P,onSelectionDragStart:F,onSelectionDragStop:J,noPanClassName:L,nodeOrigin:K,rfId:ue,autoPanOnConnect:G,autoPanOnNodeDrag:U,onError:ee,connectionRadius:Y,isValidConnection:le,nodeDragThreshold:fe})=>{const{setNodes:me,setEdges:ke,setDefaultNodesAndEdges:Ve,setMinZoom:Le,setMaxZoom:qe,setTranslateExtent:Ne,setNodeExtent:Ge,reset:be}=ct(BO,Dt),re=Mt();return b.useEffect(()=>{const Qe=s==null?void 0:s.map(ft=>({...ft,...A}));return Ve(n,Qe),()=>{be()}},[]),Xe("defaultEdgeOptions",A,re.setState),Xe("connectionMode",M,re.setState),Xe("onConnect",a,re.setState),Xe("onConnectStart",i,re.setState),Xe("onConnectEnd",l,re.setState),Xe("onClickConnectStart",d,re.setState),Xe("onClickConnectEnd",f,re.setState),Xe("nodesDraggable",p,re.setState),Xe("nodesConnectable",h,re.setState),Xe("nodesFocusable",g,re.setState),Xe("edgesFocusable",y,re.setState),Xe("edgesUpdatable",w,re.setState),Xe("elementsSelectable",C,re.setState),Xe("elevateNodesOnSelect",N,re.setState),Xe("snapToGrid",I,re.setState),Xe("snapGrid",$,re.setState),Xe("onNodesChange",S,re.setState),Xe("onEdgesChange",j,re.setState),Xe("connectOnClick",O,re.setState),Xe("fitViewOnInit",D,re.setState),Xe("fitViewOnInitOptions",H,re.setState),Xe("onNodesDelete",X,re.setState),Xe("onEdgesDelete",R,re.setState),Xe("onNodeDrag",Z,re.setState),Xe("onNodeDragStart",B,re.setState),Xe("onNodeDragStop",Q,re.setState),Xe("onSelectionDrag",P,re.setState),Xe("onSelectionDragStart",F,re.setState),Xe("onSelectionDragStop",J,re.setState),Xe("noPanClassName",L,re.setState),Xe("nodeOrigin",K,re.setState),Xe("rfId",ue,re.setState),Xe("autoPanOnConnect",G,re.setState),Xe("autoPanOnNodeDrag",U,re.setState),Xe("onError",ee,re.setState),Xe("connectionRadius",Y,re.setState),Xe("isValidConnection",le,re.setState),Xe("nodeDragThreshold",fe,re.setState),Ro(e,me),Ro(t,ke),Ro(k,Le),Ro(E,qe),Ro(z,Ne),Ro(_,Ge),null},Kb={display:"none"},WO={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},eT="react-flow__node-desc",tT="react-flow__edge-desc",HO="react-flow__aria-live",GO=e=>e.ariaLiveMessage;function VO({rfId:e}){const t=ct(GO);return he.createElement("div",{id:`${HO}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:WO},t)}function YO({rfId:e,disableKeyboardA11y:t}){return he.createElement(he.Fragment,null,he.createElement("div",{id:`${eT}-${e}`,style:Kb},"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."," "),he.createElement("div",{id:`${tT}-${e}`,style:Kb},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&he.createElement(VO,{rfId:e}))}var Cl=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=b.useState(!1),a=b.useRef(!1),i=b.useRef(new Set([])),[l,d]=b.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),h=p.reduce((g,y)=>g.concat(...y),[]);return[p,h]}return[[],[]]},[e]);return b.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const h=w=>{if(a.current=w.ctrlKey||w.metaKey||w.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&nw(w))return!1;const k=Qb(w.code,d);i.current.add(w[k]),Xb(l,i.current,!1)&&(w.preventDefault(),s(!0))},g=w=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&nw(w))return!1;const k=Qb(w.code,d);Xb(l,i.current,!0)?(s(!1),i.current.clear()):i.current.delete(w[k]),w.key==="Meta"&&i.current.clear(),a.current=!1},y=()=>{i.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",h),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",h),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",y)}}},[e,s]),n};function Xb(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(a=>t.has(a)))}function Qb(e,t){return t.includes(e)?"code":"key"}function nT(e,t,n,s){var d,f;const a=e.parentNode||e.parentId;if(!a)return n;const i=t.get(a),l=Ra(i,s);return nT(i,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((d=i[jt])==null?void 0:d.z)??0)>(n.z??0)?((f=i[jt])==null?void 0:f.z)??0:n.z??0},s)}function rT(e,t,n){e.forEach(s=>{var i;const a=s.parentNode||s.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||n!=null&&n[s.id]){const{x:l,y:d,z:f}=nT(s,e,{...s.position,z:((i=s[jt])==null?void 0:i.z)??0},t);s.positionAbsolute={x:l,y:d},s[jt].z=f,n!=null&&n[s.id]&&(s[jt].isParent=!0)}})}function gf(e,t,n,s){const a=new Map,i={},l=s?1e3:0;return e.forEach(d=>{var w;const f=(Gn(d.zIndex)?d.zIndex:0)+(d.selected?l:0),p=t.get(d.id),h={...d,positionAbsolute:{x:d.position.x,y:d.position.y}},g=d.parentNode||d.parentId;g&&(i[g]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==d.type;Object.defineProperty(h,jt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[jt])==null?void 0:w.handleBounds,z:f}}),a.set(d.id,h)}),rT(a,n,i),a}function sT(e,t={}){const{getNodes:n,width:s,height:a,minZoom:i,maxZoom:l,d3Zoom:d,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:g}=e(),y=t.initial&&!p&&h;if(d&&f&&(y||!t.initial)){const N=n().filter(E=>{var S;const _=t.includeHiddenNodes?E.width&&E.height:!E.hidden;return(S=t.nodes)!=null&&S.length?_&&t.nodes.some(j=>j.id===E.id):_}),k=N.every(E=>E.width&&E.height);if(N.length>0&&k){const E=ad(N,g),{x:_,y:S,zoom:j}=UC(E,s,a,t.minZoom??i,t.maxZoom??l,t.padding??.1),C=ns.translate(_,S).scale(j);return typeof t.duration=="number"&&t.duration>0?d.transform(Ea(f,t.duration),C):d.transform(f,C),!0}}return!1}function KO(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 XO(e,t){return t.map(n=>{const s=e.find(a=>a.id===n.id);return s&&(n.selected=s.selected),n})}function hu({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:a,edges:i,onNodesChange:l,onEdgesChange:d,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&s({nodeInternals:KO(e,a)}),l==null||l(e)),t!=null&&t.length&&(p&&s({edges:XO(t,i)}),d==null||d(t))}const Ao=()=>{},QO={zoomIn:Ao,zoomOut:Ao,zoomTo:Ao,getZoom:()=>1,setViewport:Ao,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ao,fitBounds:Ao,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},ZO=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),JO=()=>{const e=Mt(),{d3Zoom:t,d3Selection:n}=ct(ZO,Dt);return b.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(Ea(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(Ea(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,i)=>t.scaleTo(Ea(n,i==null?void 0:i.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,i)=>{const[l,d,f]=e.getState().transform,p=ns.translate(a.x??l,a.y??d).scale(a.zoom??f);t.transform(Ea(n,i==null?void 0:i.duration),p)},getViewport:()=>{const[a,i,l]=e.getState().transform;return{x:a,y:i,zoom:l}},fitView:a=>sT(e.getState,a),setCenter:(a,i,l)=>{const{width:d,height:f,maxZoom:p}=e.getState(),h=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:p,g=d/2-a*h,y=f/2-i*h,w=ns.translate(g,y).scale(h);t.transform(Ea(n,l==null?void 0:l.duration),w)},fitBounds:(a,i)=>{const{width:l,height:d,minZoom:f,maxZoom:p}=e.getState(),{x:h,y:g,zoom:y}=UC(a,l,d,f,p,(i==null?void 0:i.padding)??.1),w=ns.translate(h,g).scale(y);t.transform(Ea(n,i==null?void 0:i.duration),w)},project:a=>{const{transform:i,snapToGrid:l,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"),aw(a,i,l,d)},screenToFlowPosition:a=>{const{transform:i,snapToGrid:l,snapGrid:d,domNode:f}=e.getState();if(!f)return a;const{x:p,y:h}=f.getBoundingClientRect(),g={x:a.x-p,y:a.y-h};return aw(g,i,l,d)},flowToScreenPosition:a=>{const{transform:i,domNode:l}=e.getState();if(!l)return a;const{x:d,y:f}=l.getBoundingClientRect(),p=FC(a,i);return{x:p.x+d,y:p.y+f}},viewportInitialized:!0}:QO,[t,n])};function Dl(){const e=JO(),t=Mt(),n=b.useCallback(()=>t.getState().getNodes().map(k=>({...k})),[]),s=b.useCallback(k=>t.getState().nodeInternals.get(k),[]),a=b.useCallback(()=>{const{edges:k=[]}=t.getState();return k.map(E=>({...E}))},[]),i=b.useCallback(k=>{const{edges:E=[]}=t.getState();return E.find(_=>_.id===k)},[]),l=b.useCallback(k=>{const{getNodes:E,setNodes:_,hasDefaultNodes:S,onNodesChange:j}=t.getState(),C=E(),M=typeof k=="function"?k(C):k;if(S)_(M);else if(j){const $=M.length===0?C.map(I=>({type:"remove",id:I.id})):M.map(I=>({item:I,type:"reset"}));j($)}},[]),d=b.useCallback(k=>{const{edges:E=[],setEdges:_,hasDefaultEdges:S,onEdgesChange:j}=t.getState(),C=typeof k=="function"?k(E):k;if(S)_(C);else if(j){const M=C.length===0?E.map($=>({type:"remove",id:$.id})):C.map($=>({item:$,type:"reset"}));j(M)}},[]),f=b.useCallback(k=>{const E=Array.isArray(k)?k:[k],{getNodes:_,setNodes:S,hasDefaultNodes:j,onNodesChange:C}=t.getState();if(j){const $=[..._(),...E];S($)}else if(C){const M=E.map($=>({item:$,type:"add"}));C(M)}},[]),p=b.useCallback(k=>{const E=Array.isArray(k)?k:[k],{edges:_=[],setEdges:S,hasDefaultEdges:j,onEdgesChange:C}=t.getState();if(j)S([..._,...E]);else if(C){const M=E.map($=>({item:$,type:"add"}));C(M)}},[]),h=b.useCallback(()=>{const{getNodes:k,edges:E=[],transform:_}=t.getState(),[S,j,C]=_;return{nodes:k().map(M=>({...M})),edges:E.map(M=>({...M})),viewport:{x:S,y:j,zoom:C}}},[]),g=b.useCallback(({nodes:k,edges:E})=>{const{nodeInternals:_,getNodes:S,edges:j,hasDefaultNodes:C,hasDefaultEdges:M,onNodesDelete:$,onEdgesDelete:I,onNodesChange:z,onEdgesChange:O}=t.getState(),A=(k||[]).map(Z=>Z.id),D=(E||[]).map(Z=>Z.id),H=S().reduce((Z,B)=>{const Q=B.parentNode||B.parentId,P=!A.includes(B.id)&&Q&&Z.find(J=>J.id===Q);return(typeof B.deletable=="boolean"?B.deletable:!0)&&(A.includes(B.id)||P)&&Z.push(B),Z},[]),X=j.filter(Z=>typeof Z.deletable=="boolean"?Z.deletable:!0),R=X.filter(Z=>D.includes(Z.id));if(H||R){const Z=BC(H,X),B=[...R,...Z],Q=B.reduce((P,F)=>(P.includes(F.id)||P.push(F.id),P),[]);if((M||C)&&(M&&t.setState({edges:j.filter(P=>!Q.includes(P.id))}),C&&(H.forEach(P=>{_.delete(P.id)}),t.setState({nodeInternals:new Map(_)}))),Q.length>0&&(I==null||I(B),O&&O(Q.map(P=>({id:P,type:"remove"})))),H.length>0&&($==null||$(H),z)){const P=H.map(F=>({id:F.id,type:"remove"}));z(P)}}},[]),y=b.useCallback(k=>{const E=wO(k),_=E?null:t.getState().nodeInternals.get(k.id);return!E&&!_?[null,null,E]:[E?k:Bb(_),_,E]},[]),w=b.useCallback((k,E=!0,_)=>{const[S,j,C]=y(k);return S?(_||t.getState().getNodes()).filter(M=>{if(!C&&(M.id===j.id||!M.positionAbsolute))return!1;const $=Bb(M),I=tw($,S);return E&&I>0||I>=S.width*S.height}):[]},[]),N=b.useCallback((k,E,_=!0)=>{const[S]=y(k);if(!S)return!1;const j=tw(S,E);return _&&j>0||j>=S.width*S.height},[]);return b.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:a,getEdge:i,setNodes:l,setEdges:d,addNodes:f,addEdges:p,toObject:h,deleteElements:g,getIntersectingNodes:w,isNodeIntersecting:N}),[e,n,s,a,i,l,d,f,p,h,g,w,N])}const eP={actInsideInputWithModifier:!1};var tP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Mt(),{deleteElements:s}=Dl(),a=Cl(e,eP),i=Cl(t);b.useEffect(()=>{if(a){const{edges:l,getNodes:d}=n.getState(),f=d().filter(h=>h.selected),p=l.filter(h=>h.selected);s({nodes:f,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function nP(e){const t=Mt();b.useEffect(()=>{let n;const s=()=>{var i,l;if(!e.current)return;const a=Ow(e.current);(a.height===0||a.width===0)&&((l=(i=t.getState()).onError)==null||l.call(i,"004",ss.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 Uw={position:"absolute",width:"100%",height:"100%",top:0,left:0},rP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,fu=e=>({x:e.x,y:e.y,zoom:e.k}),Mo=(e,t)=>e.target.closest(`.${t}`),Zb=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Jb=e=>{const t=e.ctrlKey&&Fu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},sP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),aP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:a=!0,zoomOnPinch:i=!0,panOnScroll:l=!1,panOnScrollSpeed:d=.5,panOnScrollMode:f=Ca.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:g=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:k,zoomActivationKeyCode:E,preventScrolling:_=!0,children:S,noWheelClassName:j,noPanClassName:C})=>{const M=b.useRef(),$=Mt(),I=b.useRef(!1),z=b.useRef(!1),O=b.useRef(null),A=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:D,d3Selection:H,d3ZoomHandler:X,userSelectionActive:R}=ct(sP,Dt),Z=Cl(E),B=b.useRef(0),Q=b.useRef(!1),P=b.useRef();return nP(O),b.useEffect(()=>{if(O.current){const F=O.current.getBoundingClientRect(),J=CC().scaleExtent([N,k]).translateExtent(w),L=Hn(O.current).call(J),K=ns.translate(y.x,y.y).scale(Yo(y.zoom,N,k)),ue=[[0,0],[F.width,F.height]],G=J.constrain()(K,ue,w);J.transform(L,G),J.wheelDelta(Jb),$.setState({d3Zoom:J,d3Selection:L,d3ZoomHandler:L.on("wheel.zoom"),transform:[G.x,G.y,G.k],domNode:O.current.closest(".react-flow")})}},[]),b.useEffect(()=>{H&&D&&(l&&!Z&&!R?H.on("wheel.zoom",F=>{if(Mo(F,j))return!1;F.preventDefault(),F.stopImmediatePropagation();const J=H.property("__zoom").k||1;if(F.ctrlKey&&i){const le=or(F),fe=Jb(F),me=J*Math.pow(2,fe);D.scaleTo(H,me,le,F);return}const L=F.deltaMode===1?20:1;let K=f===Ca.Vertical?0:F.deltaX*L,ue=f===Ca.Horizontal?0:F.deltaY*L;!Fu()&&F.shiftKey&&f!==Ca.Vertical&&(K=F.deltaY*L,ue=0),D.translateBy(H,-(K/J)*d,-(ue/J)*d,{internal:!0});const G=fu(H.property("__zoom")),{onViewportChangeStart:U,onViewportChange:ee,onViewportChangeEnd:Y}=$.getState();clearTimeout(P.current),Q.current||(Q.current=!0,t==null||t(F,G),U==null||U(G)),Q.current&&(e==null||e(F,G),ee==null||ee(G),P.current=setTimeout(()=>{n==null||n(F,G),Y==null||Y(G),Q.current=!1},150))},{passive:!1}):typeof X<"u"&&H.on("wheel.zoom",function(F,J){if(!_&&F.type==="wheel"&&!F.ctrlKey||Mo(F,j))return null;F.preventDefault(),X.call(this,F,J)},{passive:!1}))},[R,l,f,H,D,X,Z,i,_,j,t,e,n]),b.useEffect(()=>{D&&D.on("start",F=>{var K,ue;if(!F.sourceEvent||F.sourceEvent.internal)return null;B.current=(K=F.sourceEvent)==null?void 0:K.button;const{onViewportChangeStart:J}=$.getState(),L=fu(F.transform);I.current=!0,A.current=L,((ue=F.sourceEvent)==null?void 0:ue.type)==="mousedown"&&$.setState({paneDragging:!0}),J==null||J(L),t==null||t(F.sourceEvent,L)})},[D,t]),b.useEffect(()=>{D&&(R&&!I.current?D.on("zoom",null):R||D.on("zoom",F=>{var L;const{onViewportChange:J}=$.getState();if($.setState({transform:[F.transform.x,F.transform.y,F.transform.k]}),z.current=!!(s&&Zb(g,B.current??0)),(e||J)&&!((L=F.sourceEvent)!=null&&L.internal)){const K=fu(F.transform);J==null||J(K),e==null||e(F.sourceEvent,K)}}))},[R,D,e,g,s]),b.useEffect(()=>{D&&D.on("end",F=>{if(!F.sourceEvent||F.sourceEvent.internal)return null;const{onViewportChangeEnd:J}=$.getState();if(I.current=!1,$.setState({paneDragging:!1}),s&&Zb(g,B.current??0)&&!z.current&&s(F.sourceEvent),z.current=!1,(n||J)&&rP(A.current,F.transform)){const L=fu(F.transform);A.current=L,clearTimeout(M.current),M.current=setTimeout(()=>{J==null||J(L),n==null||n(F.sourceEvent,L)},l?150:0)}})},[D,l,g,n,s]),b.useEffect(()=>{D&&D.filter(F=>{const J=Z||a,L=i&&F.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&F.button===1&&F.type==="mousedown"&&(Mo(F,"react-flow__node")||Mo(F,"react-flow__edge")))return!0;if(!g&&!J&&!l&&!p&&!i||R||!p&&F.type==="dblclick"||Mo(F,j)&&F.type==="wheel"||Mo(F,C)&&(F.type!=="wheel"||l&&F.type==="wheel"&&!Z)||!i&&F.ctrlKey&&F.type==="wheel"||!J&&!l&&!L&&F.type==="wheel"||!g&&(F.type==="mousedown"||F.type==="touchstart")||Array.isArray(g)&&!g.includes(F.button)&&F.type==="mousedown")return!1;const K=Array.isArray(g)&&g.includes(F.button)||!F.button||F.button<=1;return(!F.ctrlKey||F.type==="wheel")&&K})},[R,D,a,i,l,p,g,h,Z]),he.createElement("div",{className:"react-flow__renderer",ref:O,style:Uw},S)},oP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function iP(){const{userSelectionActive:e,userSelectionRect:t}=ct(oP,Dt);return e&&t?he.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 ek(e,t){const n=t.parentNode||t.parentId,s=e.find(a=>a.id===n);if(s){const a=t.position.x+t.width-s.width,i=t.position.y+t.height-s.height;if(a>0||i>0||t.position.x<0||t.position.y<0){if(s.style={...s.style},s.style.width=s.style.width??s.width,s.style.height=s.style.height??s.height,a>0&&(s.style.width+=a),i>0&&(s.style.height+=i),t.position.x<0){const l=Math.abs(t.position.x);s.position.x=s.position.x-l,s.style.width+=l,t.position.x=0}if(t.position.y<0){const l=Math.abs(t.position.y);s.position.y=s.position.y-l,s.style.height+=l,t.position.y=0}s.width=s.style.width,s.height=s.style.height}}}function lP(e,t){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const n=e.filter(s=>s.type==="add").map(s=>s.item);return t.reduce((s,a)=>{const i=e.filter(d=>d.id===a.id);if(i.length===0)return s.push(a),s;const l={...a};for(const d of i)if(d)switch(d.type){case"select":{l.selected=d.selected;break}case"position":{typeof d.position<"u"&&(l.position=d.position),typeof d.positionAbsolute<"u"&&(l.positionAbsolute=d.positionAbsolute),typeof d.dragging<"u"&&(l.dragging=d.dragging),l.expandParent&&ek(s,l);break}case"dimensions":{typeof d.dimensions<"u"&&(l.width=d.dimensions.width,l.height=d.dimensions.height),typeof d.updateStyle<"u"&&(l.style={...l.style||{},...d.dimensions}),typeof d.resizing=="boolean"&&(l.resizing=d.resizing),l.expandParent&&ek(s,l);break}case"remove":return s}return s.push(l),s},n)}function cP(e,t){return lP(e,t)}const Ps=(e,t)=>({id:e,type:"select",selected:t});function Do(e,t){return e.reduce((n,s)=>{const a=t.includes(s.id);return!s.selected&&a?(s.selected=!0,n.push(Ps(s.id,!0))):s.selected&&!a&&(s.selected=!1,n.push(Ps(s.id,!1))),n},[])}const yf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},uP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),aT=b.memo(({isSelecting:e,selectionMode:t=jl.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:a,onPaneClick:i,onPaneContextMenu:l,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:g})=>{const y=b.useRef(null),w=Mt(),N=b.useRef(0),k=b.useRef(0),E=b.useRef(),{userSelectionActive:_,elementsSelectable:S,dragging:j}=ct(uP,Dt),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,k.current=0},M=X=>{i==null||i(X),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},$=X=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){X.preventDefault();return}l==null||l(X)},I=d?X=>d(X):void 0,z=X=>{const{resetSelectedElements:R,domNode:Z}=w.getState();if(E.current=Z==null?void 0:Z.getBoundingClientRect(),!S||!e||X.button!==0||X.target!==y.current||!E.current)return;const{x:B,y:Q}=Ds(X,E.current);R(),w.setState({userSelectionRect:{width:0,height:0,startX:B,startY:Q,x:B,y:Q}}),s==null||s(X)},O=X=>{const{userSelectionRect:R,nodeInternals:Z,edges:B,transform:Q,onNodesChange:P,onEdgesChange:F,nodeOrigin:J,getNodes:L}=w.getState();if(!e||!E.current||!R)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const K=Ds(X,E.current),ue=R.startX??0,G=R.startY??0,U={...R,x:K.x<ue?K.x:ue,y:K.y<G?K.y:G,width:Math.abs(K.x-ue),height:Math.abs(K.y-G)},ee=L(),Y=zC(Z,U,Q,t===jl.Partial,!0,J),le=BC(Y,B).map(me=>me.id),fe=Y.map(me=>me.id);if(N.current!==fe.length){N.current=fe.length;const me=Do(ee,fe);me.length&&(P==null||P(me))}if(k.current!==le.length){k.current=le.length;const me=Do(B,le);me.length&&(F==null||F(me))}w.setState({userSelectionRect:U})},A=X=>{if(X.button!==0)return;const{userSelectionRect:R}=w.getState();!_&&R&&X.target===y.current&&(M==null||M(X)),w.setState({nodesSelectionActive:N.current>0}),C(),a==null||a(X)},D=X=>{_&&(w.setState({nodesSelectionActive:N.current>0}),a==null||a(X)),C()},H=S&&(e||_);return he.createElement("div",{className:Vt(["react-flow__pane",{dragging:j,selection:e}]),onClick:H?void 0:yf(M,y),onContextMenu:yf($,y),onWheel:yf(I,y),onMouseEnter:H?void 0:f,onMouseDown:H?z:void 0,onMouseMove:H?O:p,onMouseUp:H?A:void 0,onMouseLeave:H?D:h,ref:y,style:Uw},g,he.createElement(iP,null))});aT.displayName="Pane";function oT(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:oT(s,t):!1}function tk(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 dP(e,t,n,s){return Array.from(e.values()).filter(a=>(a.selected||a.id===s)&&(!a.parentNode||a.parentId||!oT(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var i,l;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=a.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((l=a.positionAbsolute)==null?void 0:l.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 hP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function iT(e,t,n,s,a=[0,0],i){const l=hP(e,e.extent||s);let d=l;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const g=n.get(f),{x:y,y:w}=Ra(g,a).positionAbsolute;d=g&&Gn(y)&&Gn(w)&&Gn(g.width)&&Gn(g.height)?[[y+e.width*a[0],w+e.height*a[1]],[y+g.width-e.width+e.width*a[0],w+g.height-e.height+e.height*a[1]]]:d}else i==null||i("005",ss.error005()),d=l;else if(e.extent&&f&&e.extent!=="parent"){const g=n.get(f),{x:y,y:w}=Ra(g,a).positionAbsolute;d=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(f){const g=n.get(f);p=Ra(g,a).positionAbsolute}const h=d&&d!=="parent"?Pw(t,d):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function vf({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 nk=(e,t,n,s)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const i=Array.from(a),l=t.getBoundingClientRect(),d={x:l.width*s[0],y:l.height*s[1]};return i.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-l.left-d.x)/n,y:(p.top-l.top-d.y)/n,...Ow(f)}})};function ll(e,t,n){return n===void 0?n:s=>{const a=t().nodeInternals.get(e);a&&n(s,{...a})}}function iw({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:a,unselectNodesAndEdges:i,multiSelectionActive:l,nodeInternals:d,onError:f}=t.getState(),p=d.get(e);if(!p){f==null||f("012",ss.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&l)&&(i({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var h;return(h=s==null?void 0:s.current)==null?void 0:h.blur()})):a([e])}function fP(){const e=Mt();return b.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:a,snapToGrid:i}=e.getState(),l=n.touches?n.touches[0].clientX:n.clientX,d=n.touches?n.touches[0].clientY:n.clientY,f={x:(l-s[0])/s[2],y:(d-s[1])/s[2]};return{xSnapped:i?a[0]*Math.round(f.x/a[0]):f.x,ySnapped:i?a[1]*Math.round(f.y/a[1]):f.y,...f}},[])}function wf(e){return(t,n,s)=>e==null?void 0:e(t,s)}function lT({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:a,isSelectable:i,selectNodesOnDrag:l}){const d=Mt(),[f,p]=b.useState(!1),h=b.useRef([]),g=b.useRef({x:null,y:null}),y=b.useRef(0),w=b.useRef(null),N=b.useRef({x:0,y:0}),k=b.useRef(null),E=b.useRef(!1),_=b.useRef(!1),S=b.useRef(!1),j=fP();return b.useEffect(()=>{if(e!=null&&e.current){const C=Hn(e.current),M=({x:z,y:O})=>{const{nodeInternals:A,onNodeDrag:D,onSelectionDrag:H,updateNodePositions:X,nodeExtent:R,snapGrid:Z,snapToGrid:B,nodeOrigin:Q,onError:P}=d.getState();g.current={x:z,y:O};let F=!1,J={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&R){const K=ad(h.current,Q);J=El(K)}if(h.current=h.current.map(K=>{const ue={x:z-K.distance.x,y:O-K.distance.y};B&&(ue.x=Z[0]*Math.round(ue.x/Z[0]),ue.y=Z[1]*Math.round(ue.y/Z[1]));const G=[[R[0][0],R[0][1]],[R[1][0],R[1][1]]];h.current.length>1&&R&&!K.extent&&(G[0][0]=K.positionAbsolute.x-J.x+R[0][0],G[1][0]=K.positionAbsolute.x+(K.width??0)-J.x2+R[1][0],G[0][1]=K.positionAbsolute.y-J.y+R[0][1],G[1][1]=K.positionAbsolute.y+(K.height??0)-J.y2+R[1][1]);const U=iT(K,ue,A,G,Q,P);return F=F||K.position.x!==U.position.x||K.position.y!==U.position.y,K.position=U.position,K.positionAbsolute=U.positionAbsolute,K}),!F)return;X(h.current,!0,!0),p(!0);const L=a?D:wf(H);if(L&&k.current){const[K,ue]=vf({nodeId:a,dragItems:h.current,nodeInternals:A});L(k.current,K,ue)}},$=()=>{if(!w.current)return;const[z,O]=RC(N.current,w.current);if(z!==0||O!==0){const{transform:A,panBy:D}=d.getState();g.current.x=(g.current.x??0)-z/A[2],g.current.y=(g.current.y??0)-O/A[2],D({x:z,y:O})&&M(g.current)}y.current=requestAnimationFrame($)},I=z=>{var Q;const{nodeInternals:O,multiSelectionActive:A,nodesDraggable:D,unselectNodesAndEdges:H,onNodeDragStart:X,onSelectionDragStart:R}=d.getState();_.current=!0;const Z=a?X:wf(R);(!l||!i)&&!A&&a&&((Q=O.get(a))!=null&&Q.selected||H()),a&&i&&l&&iw({id:a,store:d,nodeRef:e});const B=j(z);if(g.current=B,h.current=dP(O,D,B,a),Z&&h.current){const[P,F]=vf({nodeId:a,dragItems:h.current,nodeInternals:O});Z(z.sourceEvent,P,F)}};if(t)C.on(".drag",null);else{const z=_I().on("start",O=>{const{domNode:A,nodeDragThreshold:D}=d.getState();D===0&&I(O),S.current=!1;const H=j(O);g.current=H,w.current=(A==null?void 0:A.getBoundingClientRect())||null,N.current=Ds(O.sourceEvent,w.current)}).on("drag",O=>{var X,R;const A=j(O),{autoPanOnNodeDrag:D,nodeDragThreshold:H}=d.getState();if(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1&&(S.current=!0),!S.current){if(!E.current&&_.current&&D&&(E.current=!0,$()),!_.current){const Z=A.xSnapped-(((X=g==null?void 0:g.current)==null?void 0:X.x)??0),B=A.ySnapped-(((R=g==null?void 0:g.current)==null?void 0:R.y)??0);Math.sqrt(Z*Z+B*B)>H&&I(O)}(g.current.x!==A.xSnapped||g.current.y!==A.ySnapped)&&h.current&&_.current&&(k.current=O.sourceEvent,N.current=Ds(O.sourceEvent,w.current),M(A))}}).on("end",O=>{if(!(!_.current||S.current)&&(p(!1),E.current=!1,_.current=!1,cancelAnimationFrame(y.current),h.current)){const{updateNodePositions:A,nodeInternals:D,onNodeDragStop:H,onSelectionDragStop:X}=d.getState(),R=a?H:wf(X);if(A(h.current,!1,!1),R){const[Z,B]=vf({nodeId:a,dragItems:h.current,nodeInternals:D});R(O.sourceEvent,Z,B)}}}).filter(O=>{const A=O.target;return!O.button&&(!n||!tk(A,`.${n}`,e))&&(!s||tk(A,s,e))});return C.call(z),()=>{C.on(".drag",null)}}}},[e,t,n,s,i,d,a,l,j]),f}function cT(){const e=Mt();return b.useCallback(n=>{const{nodeInternals:s,nodeExtent:a,updateNodePositions:i,getNodes:l,snapToGrid:d,snapGrid:f,onError:p,nodesDraggable:h}=e.getState(),g=l().filter(S=>S.selected&&(S.draggable||h&&typeof S.draggable>"u")),y=d?f[0]:5,w=d?f[1]:5,N=n.isShiftPressed?4:1,k=n.x*y*N,E=n.y*w*N,_=g.map(S=>{if(S.positionAbsolute){const j={x:S.positionAbsolute.x+k,y:S.positionAbsolute.y+E};d&&(j.x=f[0]*Math.round(j.x/f[0]),j.y=f[1]*Math.round(j.y/f[1]));const{positionAbsolute:C,position:M}=iT(S,j,s,a,void 0,p);S.position=M,S.positionAbsolute=C}return S});i(_,!0,!1)},[])}const Uo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var cl=e=>{const t=({id:n,type:s,data:a,xPos:i,yPos:l,xPosOrigin:d,yPosOrigin:f,selected:p,onClick:h,onMouseEnter:g,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:k,style:E,className:_,isDraggable:S,isSelectable:j,isConnectable:C,isFocusable:M,selectNodesOnDrag:$,sourcePosition:I,targetPosition:z,hidden:O,resizeObserver:A,dragHandle:D,zIndex:H,isParent:X,noDragClassName:R,noPanClassName:Z,initialized:B,disableKeyboardA11y:Q,ariaLabel:P,rfId:F,hasHandleBounds:J})=>{const L=Mt(),K=b.useRef(null),ue=b.useRef(null),G=b.useRef(I),U=b.useRef(z),ee=b.useRef(s),Y=j||S||h||g||y||w,le=cT(),fe=ll(n,L.getState,g),me=ll(n,L.getState,y),ke=ll(n,L.getState,w),Ve=ll(n,L.getState,N),Le=ll(n,L.getState,k),qe=be=>{const{nodeDragThreshold:re}=L.getState();if(j&&(!$||!S||re>0)&&iw({id:n,store:L,nodeRef:K}),h){const Qe=L.getState().nodeInternals.get(n);Qe&&h(be,{...Qe})}},Ne=be=>{if(!nw(be)&&!Q)if($C.includes(be.key)&&j){const re=be.key==="Escape";iw({id:n,store:L,unselect:re,nodeRef:K})}else S&&p&&Object.prototype.hasOwnProperty.call(Uo,be.key)&&(L.setState({ariaLiveMessage:`Moved selected node ${be.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~l}`}),le({x:Uo[be.key].x,y:Uo[be.key].y,isShiftPressed:be.shiftKey}))};b.useEffect(()=>()=>{ue.current&&(A==null||A.unobserve(ue.current),ue.current=null)},[]),b.useEffect(()=>{if(K.current&&!O){const be=K.current;(!B||!J||ue.current!==be)&&(ue.current&&(A==null||A.unobserve(ue.current)),A==null||A.observe(be),ue.current=be)}},[O,B,J]),b.useEffect(()=>{const be=ee.current!==s,re=G.current!==I,Qe=U.current!==z;K.current&&(be||re||Qe)&&(be&&(ee.current=s),re&&(G.current=I),Qe&&(U.current=z),L.getState().updateNodeDimensions([{id:n,nodeElement:K.current,forceUpdate:!0}]))},[n,s,I,z]);const Ge=lT({nodeRef:K,disabled:O||!S,noDragClassName:R,handleSelector:D,nodeId:n,isSelectable:j,selectNodesOnDrag:$});return O?null:he.createElement("div",{className:Vt(["react-flow__node",`react-flow__node-${s}`,{[Z]:S},_,{selected:p,selectable:j,parent:X,dragging:Ge}]),ref:K,style:{zIndex:H,transform:`translate(${d}px,${f}px)`,pointerEvents:Y?"all":"none",visibility:B?"visible":"hidden",...E},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:fe,onMouseMove:me,onMouseLeave:ke,onContextMenu:Ve,onClick:qe,onDoubleClick:Le,onKeyDown:M?Ne:void 0,tabIndex:M?0:void 0,role:M?"button":void 0,"aria-describedby":Q?void 0:`${eT}-${F}`,"aria-label":P},he.createElement(EO,{value:n},he.createElement(e,{id:n,data:a,type:s,xPos:i,yPos:l,selected:p,isConnectable:C,sourcePosition:I,targetPosition:z,dragging:Ge,dragHandle:D,zIndex:H})))};return t.displayName="NodeWrapper",b.memo(t)};const pP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...ad(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function mP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Mt(),{width:a,height:i,x:l,y:d,transformString:f,userSelectionActive:p}=ct(pP,Dt),h=cT(),g=b.useRef(null);if(b.useEffect(()=>{var N;n||(N=g.current)==null||N.focus({preventScroll:!0})},[n]),lT({nodeRef:g}),p||!a||!i)return null;const y=e?N=>{const k=s.getState().getNodes().filter(E=>E.selected);e(N,k)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(Uo,N.key)&&h({x:Uo[N.key].x,y:Uo[N.key].y,isShiftPressed:N.shiftKey})};return he.createElement("div",{className:Vt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},he.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:a,height:i,top:d,left:l}}))}var gP=b.memo(mP);const yP=e=>e.nodesSelectionActive,uT=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:l,deleteKeyCode:d,onMove:f,onMoveStart:p,onMoveEnd:h,selectionKeyCode:g,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:k,multiSelectionKeyCode:E,panActivationKeyCode:_,zoomActivationKeyCode:S,elementsSelectable:j,zoomOnScroll:C,zoomOnPinch:M,panOnScroll:$,panOnScrollSpeed:I,panOnScrollMode:z,zoomOnDoubleClick:O,panOnDrag:A,defaultViewport:D,translateExtent:H,minZoom:X,maxZoom:R,preventScrolling:Z,onSelectionContextMenu:B,noWheelClassName:Q,noPanClassName:P,disableKeyboardA11y:F})=>{const J=ct(yP),L=Cl(g),K=Cl(_),ue=K||A,G=K||$,U=L||y&&ue!==!0;return tP({deleteKeyCode:d,multiSelectionKeyCode:E}),he.createElement(aP,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:j,zoomOnScroll:C,zoomOnPinch:M,panOnScroll:G,panOnScrollSpeed:I,panOnScrollMode:z,zoomOnDoubleClick:O,panOnDrag:!L&&ue,defaultViewport:D,translateExtent:H,minZoom:X,maxZoom:R,zoomActivationKeyCode:S,preventScrolling:Z,noWheelClassName:Q,noPanClassName:P},he.createElement(aT,{onSelectionStart:N,onSelectionEnd:k,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:l,panOnDrag:ue,isSelecting:!!U,selectionMode:w},e,J&&he.createElement(gP,{onSelectionContextMenu:B,noPanClassName:P,disableKeyboardA11y:F})))};uT.displayName="FlowRenderer";var vP=b.memo(uT);function wP(e){return ct(b.useCallback(n=>e?zC(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function xP(e){const t={input:cl(e.input||XC),default:cl(e.default||ow),output:cl(e.output||ZC),group:cl(e.group||Bw)},n={},s=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,i)=>(a[i]=cl(e[i]||ow),a),n);return{...t,...s}}const bP=({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]},kP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),dT=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:a,updateNodeDimensions:i,onError:l}=ct(kP,Dt),d=wP(e.onlyRenderVisibleElements),f=b.useRef(),p=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(g=>{const y=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));i(y)});return f.current=h,h},[]);return b.useEffect(()=>()=>{var h;(h=f==null?void 0:f.current)==null||h.disconnect()},[]),he.createElement("div",{className:"react-flow__nodes",style:Uw},d.map(h=>{var M,$,I;let g=h.type||"default";e.nodeTypes[g]||(l==null||l("003",ss.error003(g)),g="default");const y=e.nodeTypes[g]||e.nodeTypes.default,w=!!(h.draggable||t&&typeof h.draggable>"u"),N=!!(h.selectable||a&&typeof h.selectable>"u"),k=!!(h.connectable||n&&typeof h.connectable>"u"),E=!!(h.focusable||s&&typeof h.focusable>"u"),_=e.nodeExtent?Pw(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,S=(_==null?void 0:_.x)??0,j=(_==null?void 0:_.y)??0,C=bP({x:S,y:j,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return he.createElement(y,{key:h.id,id:h.id,className:h.className,style:h.style,type:g,data:h.data,sourcePosition:h.sourcePosition||Oe.Bottom,targetPosition:h.targetPosition||Oe.Top,hidden:h.hidden,xPos:S,yPos:j,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!h.selected,isDraggable:w,isSelectable:N,isConnectable:k,isFocusable:E,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((M=h[jt])==null?void 0:M.z)??0,isParent:!!(($=h[jt])!=null&&$.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((I=h[jt])!=null&&I.handleBounds)})}))};dT.displayName="NodeRenderer";var _P=b.memo(dT);const SP=(e,t,n)=>n===Oe.Left?e-t:n===Oe.Right?e+t:e,NP=(e,t,n)=>n===Oe.Top?e-t:n===Oe.Bottom?e+t:e,rk="react-flow__edgeupdater",sk=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:a,onMouseEnter:i,onMouseOut:l,type:d})=>he.createElement("circle",{onMouseDown:a,onMouseEnter:i,onMouseOut:l,className:Vt([rk,`${rk}-${d}`]),cx:SP(t,s,e),cy:NP(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),EP=()=>!0;var Io=e=>{const t=({id:n,className:s,type:a,data:i,onClick:l,onEdgeDoubleClick:d,selected:f,animated:p,label:h,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:k,style:E,source:_,target:S,sourceX:j,sourceY:C,targetX:M,targetY:$,sourcePosition:I,targetPosition:z,elementsSelectable:O,hidden:A,sourceHandleId:D,targetHandleId:H,onContextMenu:X,onMouseEnter:R,onMouseMove:Z,onMouseLeave:B,reconnectRadius:Q,onReconnect:P,onReconnectStart:F,onReconnectEnd:J,markerEnd:L,markerStart:K,rfId:ue,ariaLabel:G,isFocusable:U,isReconnectable:ee,pathOptions:Y,interactionWidth:le,disableKeyboardA11y:fe})=>{const me=b.useRef(null),[ke,Ve]=b.useState(!1),[Le,qe]=b.useState(!1),Ne=Mt(),Ge=b.useMemo(()=>`url('#${sw(K,ue)}')`,[K,ue]),be=b.useMemo(()=>`url('#${sw(L,ue)}')`,[L,ue]);if(A)return null;const re=Se=>{var Ae;const{edges:De,addSelectedEdges:_e,unselectNodesAndEdges:Be,multiSelectionActive:_t}=Ne.getState(),vt=De.find(it=>it.id===n);vt&&(O&&(Ne.setState({nodesSelectionActive:!1}),vt.selected&&_t?(Be({nodes:[],edges:[vt]}),(Ae=me.current)==null||Ae.blur()):_e([n])),l&&l(Se,vt))},Qe=il(n,Ne.getState,d),ft=il(n,Ne.getState,X),ut=il(n,Ne.getState,R),at=il(n,Ne.getState,Z),Ye=il(n,Ne.getState,B),pe=(Se,De)=>{if(Se.button!==0)return;const{edges:_e,isValidConnection:Be}=Ne.getState(),_t=De?S:_,vt=(De?H:D)||null,Ae=De?"target":"source",it=Be||EP,wt=De,xt=_e.find(In=>In.id===n);qe(!0),F==null||F(Se,xt,Ae);const nn=In=>{qe(!1),J==null||J(In,xt,Ae)};GC({event:Se,handleId:vt,nodeId:_t,onConnect:In=>P==null?void 0:P(xt,In),isTarget:wt,getState:Ne.getState,setState:Ne.setState,isValidConnection:it,edgeUpdaterType:Ae,onReconnectEnd:nn})},we=Se=>pe(Se,!0),Pe=Se=>pe(Se,!1),Ue=()=>Ve(!0),ot=()=>Ve(!1),$e=!O&&!l,se=Se=>{var De;if(!fe&&$C.includes(Se.key)&&O){const{unselectNodesAndEdges:_e,addSelectedEdges:Be,edges:_t}=Ne.getState();Se.key==="Escape"?((De=me.current)==null||De.blur(),_e({edges:[_t.find(Ae=>Ae.id===n)]})):Be([n])}};return he.createElement("g",{className:Vt(["react-flow__edge",`react-flow__edge-${a}`,s,{selected:f,animated:p,inactive:$e,updating:ke}]),onClick:re,onDoubleClick:Qe,onContextMenu:ft,onMouseEnter:ut,onMouseMove:at,onMouseLeave:Ye,onKeyDown:U?se:void 0,tabIndex:U?0:void 0,role:U?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":G===null?void 0:G||`Edge from ${_} to ${S}`,"aria-describedby":U?`${tT}-${ue}`:void 0,ref:me},!Le&&he.createElement(e,{id:n,source:_,target:S,selected:f,animated:p,label:h,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:k,data:i,style:E,sourceX:j,sourceY:C,targetX:M,targetY:$,sourcePosition:I,targetPosition:z,sourceHandleId:D,targetHandleId:H,markerStart:Ge,markerEnd:be,pathOptions:Y,interactionWidth:le}),ee&&he.createElement(he.Fragment,null,(ee==="source"||ee===!0)&&he.createElement(sk,{position:I,centerX:j,centerY:C,radius:Q,onMouseDown:we,onMouseEnter:Ue,onMouseOut:ot,type:"source"}),(ee==="target"||ee===!0)&&he.createElement(sk,{position:z,centerX:M,centerY:$,radius:Q,onMouseDown:Pe,onMouseEnter:Ue,onMouseOut:ot,type:"target"})))};return t.displayName="EdgeWrapper",b.memo(t)};function jP(e){const t={default:Io(e.default||Bu),straight:Io(e.bezier||qw),step:Io(e.step||Dw),smoothstep:Io(e.step||sd),simplebezier:Io(e.simplebezier||Lw)},n={},s=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,i)=>(a[i]=Io(e[i]||Bu),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,i=(n==null?void 0:n.width)||t.width,l=(n==null?void 0:n.height)||t.height;switch(e){case Oe.Top:return{x:s+i/2,y:a};case Oe.Right:return{x:s+i,y:a+l/2};case Oe.Bottom:return{x:s+i/2,y:a+l};case Oe.Left:return{x:s,y:a+l/2}}}function ok(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const CP=(e,t,n,s,a,i)=>{const l=ak(n,e,t),d=ak(i,s,a);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y}};function TP({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:a,targetHeight:i,width:l,height:d,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+a),y2:Math.max(e.y+s,t.y+i)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const h=El({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:l/f[2],height:d/f[2]}),g=Math.max(0,Math.min(h.x2,p.x2)-Math.max(h.x,p.x)),y=Math.max(0,Math.min(h.y2,p.y2)-Math.max(h.y,p.y));return Math.ceil(g*y)>0}function ik(e){var s,a,i,l,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((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.y)<"u";return[{x:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.x)||0,y:((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 RP=[{level:0,isMaxLevel:!0,edges:[]}];function AP(e,t,n=!1){let s=-1;const a=e.reduce((l,d)=>{var h,g;const f=Gn(d.zIndex);let p=f?d.zIndex:0;if(n){const y=t.get(d.target),w=t.get(d.source),N=d.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),k=Math.max(((h=w==null?void 0:w[jt])==null?void 0:h.z)||0,((g=y==null?void 0:y[jt])==null?void 0:g.z)||0,1e3);p=(f?d.zIndex:0)+(N?k:0)}return l[p]?l[p].push(d):l[p]=[d],s=p>s?p:s,l},{}),i=Object.entries(a).map(([l,d])=>{const f=+l;return{edges:d,level:f,isMaxLevel:f===s}});return i.length===0?RP:i}function MP(e,t,n){const s=ct(b.useCallback(a=>e?a.edges.filter(i=>{const l=t.get(i.source),d=t.get(i.target);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&(d==null?void 0:d.width)&&(d==null?void 0:d.height)&&TP({sourcePos:l.positionAbsolute||{x:0,y:0},targetPos:d.positionAbsolute||{x:0,y:0},sourceWidth:l.width,sourceHeight:l.height,targetWidth:d.width,targetHeight:d.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return AP(s,t,n)}const IP=({color:e="none",strokeWidth:t=1})=>he.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),$P=({color:e="none",strokeWidth:t=1})=>he.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),lk={[zu.Arrow]:IP,[zu.ArrowClosed]:$P};function OP(e){const t=Mt();return b.useMemo(()=>{var a,i;return Object.prototype.hasOwnProperty.call(lk,e)?lk[e]:((i=(a=t.getState()).onError)==null||i.call(a,"009",ss.error009(e)),null)},[e])}const PP=({id:e,type:t,color:n,width:s=12.5,height:a=12.5,markerUnits:i="strokeWidth",strokeWidth:l,orient:d="auto-start-reverse"})=>{const f=OP(t);return f?he.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:d,refX:"0",refY:"0"},he.createElement(f,{color:n,strokeWidth:l})):null},LP=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((a,i)=>([i.markerStart,i.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const d=sw(l,t);s.includes(d)||(a.push({id:d,color:l.color||e,...l}),s.push(d))}}),a),[]).sort((a,i)=>a.id.localeCompare(i.id))},hT=({defaultColor:e,rfId:t})=>{const n=ct(b.useCallback(LP({defaultColor:e,rfId:t}),[e,t]),(s,a)=>!(s.length!==a.length||s.some((i,l)=>i.id!==a[l].id)));return he.createElement("defs",null,n.map(s=>he.createElement(PP,{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})))};hT.displayName="MarkerDefinitions";var DP=b.memo(hT);const qP=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}),fT=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:a,noPanClassName:i,onEdgeContextMenu:l,onEdgeMouseEnter:d,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:k,children:E,disableKeyboardA11y:_})=>{const{edgesFocusable:S,edgesUpdatable:j,elementsSelectable:C,width:M,height:$,connectionMode:I,nodeInternals:z,onError:O}=ct(qP,Dt),A=MP(t,z,n);return M?he.createElement(he.Fragment,null,A.map(({level:D,edges:H,isMaxLevel:X})=>he.createElement("svg",{key:D,style:{zIndex:D},width:M,height:$,className:"react-flow__edges react-flow__container"},X&&he.createElement(DP,{defaultColor:e,rfId:s}),he.createElement("g",null,H.map(R=>{const[Z,B,Q]=ik(z.get(R.source)),[P,F,J]=ik(z.get(R.target));if(!Q||!J)return null;let L=R.type||"default";a[L]||(O==null||O("011",ss.error011(L)),L="default");const K=a[L]||a.default,ue=I===Ma.Strict?F.target:(F.target??[]).concat(F.source??[]),G=ok(B.source,R.sourceHandle),U=ok(ue,R.targetHandle),ee=(G==null?void 0:G.position)||Oe.Bottom,Y=(U==null?void 0:U.position)||Oe.Top,le=!!(R.focusable||S&&typeof R.focusable>"u"),fe=R.reconnectable||R.updatable,me=typeof y<"u"&&(fe||j&&typeof fe>"u");if(!G||!U)return O==null||O("008",ss.error008(G,R)),null;const{sourceX:ke,sourceY:Ve,targetX:Le,targetY:qe}=CP(Z,G,ee,P,U,Y);return he.createElement(K,{key:R.id,id:R.id,className:Vt([R.className,i]),type:L,data:R.data,selected:!!R.selected,animated:!!R.animated,hidden:!!R.hidden,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,style:R.style,source:R.source,target:R.target,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerEnd:R.markerEnd,markerStart:R.markerStart,sourceX:ke,sourceY:Ve,targetX:Le,targetY:qe,sourcePosition:ee,targetPosition:Y,elementsSelectable:C,onContextMenu:l,onMouseEnter:d,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:k,rfId:s,ariaLabel:R.ariaLabel,isFocusable:le,isReconnectable:me,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth,disableKeyboardA11y:_})})))),E):null};fT.displayName="EdgeRenderer";var FP=b.memo(fT);const zP=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function BP({children:e}){const t=ct(zP);return he.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function UP(e){const t=Dl(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const WP={[Oe.Left]:Oe.Right,[Oe.Right]:Oe.Left,[Oe.Top]:Oe.Bottom,[Oe.Bottom]:Oe.Top},pT=({nodeId:e,handleType:t,style:n,type:s=Ls.Bezier,CustomComponent:a,connectionStatus:i})=>{var $,I,z;const{fromNode:l,handleId:d,toX:f,toY:p,connectionMode:h}=ct(b.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]),Dt),g=($=l==null?void 0:l[jt])==null?void 0:$.handleBounds;let y=g==null?void 0:g[t];if(h===Ma.Loose&&(y=y||(g==null?void 0:g[t==="source"?"target":"source"])),!l||!y)return null;const w=d?y.find(O=>O.id===d):y[0],N=w?w.x+w.width/2:(l.width??0)/2,k=w?w.y+w.height/2:l.height??0,E=(((I=l.positionAbsolute)==null?void 0:I.x)??0)+N,_=(((z=l.positionAbsolute)==null?void 0:z.y)??0)+k,S=w==null?void 0:w.position,j=S?WP[S]:null;if(!S||!j)return null;if(a)return he.createElement(a,{connectionLineType:s,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:E,fromY:_,toX:f,toY:p,fromPosition:S,toPosition:j,connectionStatus:i});let C="";const M={sourceX:E,sourceY:_,sourcePosition:S,targetX:f,targetY:p,targetPosition:j};return s===Ls.Bezier?[C]=qC(M):s===Ls.Step?[C]=rw({...M,borderRadius:0}):s===Ls.SmoothStep?[C]=rw(M):s===Ls.SimpleBezier?[C]=DC(M):C=`M${E},${_} ${f},${p}`,he.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};pT.displayName="ConnectionLine";const HP=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function GP({containerStyle:e,style:t,type:n,component:s}){const{nodeId:a,handleType:i,nodesConnectable:l,width:d,height:f,connectionStatus:p}=ct(HP,Dt);return!(a&&i&&d&&l)?null:he.createElement("svg",{style:e,width:d,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},he.createElement("g",{className:Vt(["react-flow__connection",p])},he.createElement(pT,{nodeId:a,handleType:i,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function ck(e,t){return b.useRef(null),Mt(),b.useMemo(()=>t(e),[e])}const mT=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:a,onInit:i,onNodeClick:l,onEdgeClick:d,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:k,onSelectionEnd:E,connectionLineType:_,connectionLineStyle:S,connectionLineComponent:j,connectionLineContainerStyle:C,selectionKeyCode:M,selectionOnDrag:$,selectionMode:I,multiSelectionKeyCode:z,panActivationKeyCode:O,zoomActivationKeyCode:A,deleteKeyCode:D,onlyRenderVisibleElements:H,elementsSelectable:X,selectNodesOnDrag:R,defaultViewport:Z,translateExtent:B,minZoom:Q,maxZoom:P,preventScrolling:F,defaultMarkerColor:J,zoomOnScroll:L,zoomOnPinch:K,panOnScroll:ue,panOnScrollSpeed:G,panOnScrollMode:U,zoomOnDoubleClick:ee,panOnDrag:Y,onPaneClick:le,onPaneMouseEnter:fe,onPaneMouseMove:me,onPaneMouseLeave:ke,onPaneScroll:Ve,onPaneContextMenu:Le,onEdgeContextMenu:qe,onEdgeMouseEnter:Ne,onEdgeMouseMove:Ge,onEdgeMouseLeave:be,onReconnect:re,onReconnectStart:Qe,onReconnectEnd:ft,reconnectRadius:ut,noDragClassName:at,noWheelClassName:Ye,noPanClassName:pe,elevateEdgesOnSelect:we,disableKeyboardA11y:Pe,nodeOrigin:Ue,nodeExtent:ot,rfId:$e})=>{const se=ck(e,xP),Se=ck(t,jP);return UP(i),he.createElement(vP,{onPaneClick:le,onPaneMouseEnter:fe,onPaneMouseMove:me,onPaneMouseLeave:ke,onPaneContextMenu:Le,onPaneScroll:Ve,deleteKeyCode:D,selectionKeyCode:M,selectionOnDrag:$,selectionMode:I,onSelectionStart:k,onSelectionEnd:E,multiSelectionKeyCode:z,panActivationKeyCode:O,zoomActivationKeyCode:A,elementsSelectable:X,onMove:n,onMoveStart:s,onMoveEnd:a,zoomOnScroll:L,zoomOnPinch:K,zoomOnDoubleClick:ee,panOnScroll:ue,panOnScrollSpeed:G,panOnScrollMode:U,panOnDrag:Y,defaultViewport:Z,translateExtent:B,minZoom:Q,maxZoom:P,onSelectionContextMenu:N,preventScrolling:F,noDragClassName:at,noWheelClassName:Ye,noPanClassName:pe,disableKeyboardA11y:Pe},he.createElement(BP,null,he.createElement(FP,{edgeTypes:Se,onEdgeClick:d,onEdgeDoubleClick:p,onlyRenderVisibleElements:H,onEdgeContextMenu:qe,onEdgeMouseEnter:Ne,onEdgeMouseMove:Ge,onEdgeMouseLeave:be,onReconnect:re,onReconnectStart:Qe,onReconnectEnd:ft,reconnectRadius:ut,defaultMarkerColor:J,noPanClassName:pe,elevateEdgesOnSelect:!!we,disableKeyboardA11y:Pe,rfId:$e},he.createElement(GP,{style:S,type:_,component:j,containerStyle:C})),he.createElement("div",{className:"react-flow__edgelabel-renderer"}),he.createElement(_P,{nodeTypes:se,onNodeClick:l,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:R,onlyRenderVisibleElements:H,noPanClassName:pe,noDragClassName:at,disableKeyboardA11y:Pe,nodeOrigin:Ue,nodeExtent:ot,rfId:$e})))};mT.displayName="GraphView";var VP=b.memo(mT);const lw=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Is={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:lw,nodeExtent:lw,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Ma.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:xO,isValidConnection:void 0},YP=()=>OM((e,t)=>({...Is,setNodes:n=>{const{nodeInternals:s,nodeOrigin:a,elevateNodesOnSelect:i}=t();e({nodeInternals:gf(n,s,a,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:s={}}=t();e({edges:n.map(a=>({...s,...a}))})},setDefaultNodesAndEdges:(n,s)=>{const a=typeof n<"u",i=typeof s<"u",l=a?gf(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:i?s:[],hasDefaultNodes:a,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:a,fitViewOnInit:i,fitViewOnInitDone:l,fitViewOnInitOptions:d,domNode:f,nodeOrigin:p}=t(),h=f==null?void 0:f.querySelector(".react-flow__viewport");if(!h)return;const g=window.getComputedStyle(h),{m22:y}=new window.DOMMatrixReadOnly(g.transform),w=n.reduce((k,E)=>{const _=a.get(E.id);if(_!=null&&_.hidden)a.set(_.id,{..._,[jt]:{..._[jt],handleBounds:void 0}});else if(_){const S=Ow(E.nodeElement);!!(S.width&&S.height&&(_.width!==S.width||_.height!==S.height||E.forceUpdate))&&(a.set(_.id,{..._,[jt]:{..._[jt],handleBounds:{source:nk(".source",E.nodeElement,y,p),target:nk(".target",E.nodeElement,y,p)}},...S}),k.push({id:_.id,type:"dimensions",dimensions:S}))}return k},[]);rT(a,p);const N=l||i&&!l&&sT(t,{initial:!0,...d});e({nodeInternals:new Map(a),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(s==null||s(w))},updateNodePositions:(n,s=!0,a=!1)=>{const{triggerNodeChanges:i}=t(),l=n.map(d=>{const f={id:d.id,type:"position",dragging:a};return s&&(f.positionAbsolute=d.positionAbsolute,f.position=d.position),f});i(l)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:a,hasDefaultNodes:i,nodeOrigin:l,getNodes:d,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(i){const p=cP(n,d()),h=gf(p,a,l,f);e({nodeInternals:h})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let l,d=null;s?l=n.map(f=>Ps(f,!0)):(l=Do(i(),n),d=Do(a,[])),hu({changedNodes:l,changedEdges:d,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let l,d=null;s?l=n.map(f=>Ps(f,!0)):(l=Do(a,n),d=Do(i(),[])),hu({changedNodes:d,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:a,getNodes:i}=t(),l=n||i(),d=s||a,f=l.map(h=>(h.selected=!1,Ps(h.id,!1))),p=d.map(h=>Ps(h.id,!1));hu({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:a}=t();s==null||s.scaleExtent([n,a]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:a}=t();s==null||s.scaleExtent([a,n]),e({maxZoom:n})},setTranslateExtent:n=>{var s;(s=t().d3Zoom)==null||s.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:s}=t(),i=s().filter(d=>d.selected).map(d=>Ps(d.id,!1)),l=n.filter(d=>d.selected).map(d=>Ps(d.id,!1));hu({changedNodes:i,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(a=>{a.positionAbsolute=Pw(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:a,height:i,d3Zoom:l,d3Selection:d,translateExtent:f}=t();if(!l||!d||!n.x&&!n.y)return!1;const p=ns.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),h=[[0,0],[a,i]],g=l==null?void 0:l.constrain()(p,h,f);return l.transform(d,g),s[0]!==g.x||s[1]!==g.y||s[2]!==g.k},cancelConnection:()=>e({connectionNodeId:Is.connectionNodeId,connectionHandleId:Is.connectionHandleId,connectionHandleType:Is.connectionHandleType,connectionStatus:Is.connectionStatus,connectionStartHandle:Is.connectionStartHandle,connectionEndHandle:Is.connectionEndHandle}),reset:()=>e({...Is})}),Object.is),Ww=({children:e})=>{const t=b.useRef(null);return t.current||(t.current=YP()),he.createElement(fO,{value:t.current},e)};Ww.displayName="ReactFlowProvider";const gT=({children:e})=>b.useContext(rd)?he.createElement(he.Fragment,null,e):he.createElement(Ww,null,e);gT.displayName="ReactFlowWrapper";const KP={input:XC,default:ow,output:ZC,group:Bw},XP={default:Bu,straight:qw,step:Dw,smoothstep:sd,simplebezier:Lw},QP=[0,0],ZP=[15,15],JP={x:0,y:0,zoom:1},eL={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},yT=b.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:a,nodeTypes:i=KP,edgeTypes:l=XP,onNodeClick:d,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:g,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:k,onClickConnectStart:E,onClickConnectEnd:_,onNodeMouseEnter:S,onNodeMouseMove:j,onNodeMouseLeave:C,onNodeContextMenu:M,onNodeDoubleClick:$,onNodeDragStart:I,onNodeDrag:z,onNodeDragStop:O,onNodesDelete:A,onEdgesDelete:D,onSelectionChange:H,onSelectionDragStart:X,onSelectionDrag:R,onSelectionDragStop:Z,onSelectionContextMenu:B,onSelectionStart:Q,onSelectionEnd:P,connectionMode:F=Ma.Strict,connectionLineType:J=Ls.Bezier,connectionLineStyle:L,connectionLineComponent:K,connectionLineContainerStyle:ue,deleteKeyCode:G="Backspace",selectionKeyCode:U="Shift",selectionOnDrag:ee=!1,selectionMode:Y=jl.Full,panActivationKeyCode:le="Space",multiSelectionKeyCode:fe=Fu()?"Meta":"Control",zoomActivationKeyCode:me=Fu()?"Meta":"Control",snapToGrid:ke=!1,snapGrid:Ve=ZP,onlyRenderVisibleElements:Le=!1,selectNodesOnDrag:qe=!0,nodesDraggable:Ne,nodesConnectable:Ge,nodesFocusable:be,nodeOrigin:re=QP,edgesFocusable:Qe,edgesUpdatable:ft,elementsSelectable:ut,defaultViewport:at=JP,minZoom:Ye=.5,maxZoom:pe=2,translateExtent:we=lw,preventScrolling:Pe=!0,nodeExtent:Ue,defaultMarkerColor:ot="#b1b1b7",zoomOnScroll:$e=!0,zoomOnPinch:se=!0,panOnScroll:Se=!1,panOnScrollSpeed:De=.5,panOnScrollMode:_e=Ca.Free,zoomOnDoubleClick:Be=!0,panOnDrag:_t=!0,onPaneClick:vt,onPaneMouseEnter:Ae,onPaneMouseMove:it,onPaneMouseLeave:wt,onPaneScroll:xt,onPaneContextMenu:nn,children:rn,onEdgeContextMenu:In,onEdgeDoubleClick:Da,onEdgeMouseEnter:qa,onEdgeMouseMove:Fa,onEdgeMouseLeave:wn,onEdgeUpdate:Bs,onEdgeUpdateStart:za,onEdgeUpdateEnd:$t,onReconnect:mr,onReconnectStart:Kn,onReconnectEnd:li,reconnectRadius:Rr=10,edgeUpdaterRadius:Ar=10,onNodesChange:Mr,onEdgesChange:is,noDragClassName:Us="nodrag",noWheelClassName:Ba="nowheel",noPanClassName:Ws="nopan",fitView:$n=!1,fitViewOptions:Ua,connectOnClick:Hs=!0,attributionPosition:ci,proOptions:Ir,defaultEdgeOptions:Gs,elevateNodesOnSelect:Wa=!0,elevateEdgesOnSelect:$r=!1,disableKeyboardA11y:Vs=!1,autoPanOnConnect:ls=!0,autoPanOnNodeDrag:dt=!0,connectionRadius:Ha=20,isValidConnection:On,onError:Ga,style:Or,id:Ys,nodeDragThreshold:Va,...Pr},qt)=>{const Ks=Ys||"1";return he.createElement("div",{...Pr,style:{...Or,...eL},ref:qt,className:Vt(["react-flow",a]),"data-testid":"rf__wrapper",id:Ys},he.createElement(gT,null,he.createElement(VP,{onInit:p,onMove:h,onMoveStart:g,onMoveEnd:y,onNodeClick:d,onEdgeClick:f,onNodeMouseEnter:S,onNodeMouseMove:j,onNodeMouseLeave:C,onNodeContextMenu:M,onNodeDoubleClick:$,nodeTypes:i,edgeTypes:l,connectionLineType:J,connectionLineStyle:L,connectionLineComponent:K,connectionLineContainerStyle:ue,selectionKeyCode:U,selectionOnDrag:ee,selectionMode:Y,deleteKeyCode:G,multiSelectionKeyCode:fe,panActivationKeyCode:le,zoomActivationKeyCode:me,onlyRenderVisibleElements:Le,selectNodesOnDrag:qe,defaultViewport:at,translateExtent:we,minZoom:Ye,maxZoom:pe,preventScrolling:Pe,zoomOnScroll:$e,zoomOnPinch:se,zoomOnDoubleClick:Be,panOnScroll:Se,panOnScrollSpeed:De,panOnScrollMode:_e,panOnDrag:_t,onPaneClick:vt,onPaneMouseEnter:Ae,onPaneMouseMove:it,onPaneMouseLeave:wt,onPaneScroll:xt,onPaneContextMenu:nn,onSelectionContextMenu:B,onSelectionStart:Q,onSelectionEnd:P,onEdgeContextMenu:In,onEdgeDoubleClick:Da,onEdgeMouseEnter:qa,onEdgeMouseMove:Fa,onEdgeMouseLeave:wn,onReconnect:mr??Bs,onReconnectStart:Kn??za,onReconnectEnd:li??$t,reconnectRadius:Rr??Ar,defaultMarkerColor:ot,noDragClassName:Us,noWheelClassName:Ba,noPanClassName:Ws,elevateEdgesOnSelect:$r,rfId:Ks,disableKeyboardA11y:Vs,nodeOrigin:re,nodeExtent:Ue}),he.createElement(UO,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:N,onConnectEnd:k,onClickConnectStart:E,onClickConnectEnd:_,nodesDraggable:Ne,nodesConnectable:Ge,nodesFocusable:be,edgesFocusable:Qe,edgesUpdatable:ft,elementsSelectable:ut,elevateNodesOnSelect:Wa,minZoom:Ye,maxZoom:pe,nodeExtent:Ue,onNodesChange:Mr,onEdgesChange:is,snapToGrid:ke,snapGrid:Ve,connectionMode:F,translateExtent:we,connectOnClick:Hs,defaultEdgeOptions:Gs,fitView:$n,fitViewOptions:Ua,onNodesDelete:A,onEdgesDelete:D,onNodeDragStart:I,onNodeDrag:z,onNodeDragStop:O,onSelectionDrag:R,onSelectionDragStart:X,onSelectionDragStop:Z,noPanClassName:Ws,nodeOrigin:re,rfId:Ks,autoPanOnConnect:ls,autoPanOnNodeDrag:dt,onError:Ga,connectionRadius:Ha,isValidConnection:On,nodeDragThreshold:Va}),he.createElement(zO,{onSelectionChange:H}),rn,he.createElement(mO,{proOptions:Ir,position:ci}),he.createElement(YO,{rfId:Ks,disableKeyboardA11y:Vs})))});yT.displayName="ReactFlow";const tL=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function vT(){return ct(tL,Dt)}const wT=({id:e,x:t,y:n,width:s,height:a,style:i,color:l,strokeColor:d,strokeWidth:f,className:p,borderRadius:h,shapeRendering:g,onClick:y,selected:w})=>{const{background:N,backgroundColor:k}=i||{},E=l||N||k;return he.createElement("rect",{className:Vt(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:h,ry:h,width:s,height:a,fill:E,stroke:d,strokeWidth:f,shapeRendering:g,onClick:y?_=>y(_,e):void 0})};wT.displayName="MiniMapNode";var nL=b.memo(wT);const rL=e=>e.nodeOrigin,sL=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),xf=e=>e instanceof Function?e:()=>e;function aL({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:i=nL,onClick:l}){const d=ct(sL,Dt),f=ct(rL),p=xf(t),h=xf(e),g=xf(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return he.createElement(he.Fragment,null,d.map(w=>{const{x:N,y:k}=Ra(w,f).positionAbsolute;return he.createElement(i,{key:w.id,x:N,y:k,width:w.width,height:w.height,style:w.style,selected:w.selected,className:g(w),color:p(w),borderRadius:s,strokeColor:h(w),strokeWidth:a,shapeRendering:y,onClick:l,id:w.id})}))}var oL=b.memo(aL);const iL=200,lL=150,cL=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?vO(ad(t,e.nodeOrigin),n):n,rfId:e.rfId}},uL="react-flow__minimap-desc";function xT({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:a="",nodeBorderRadius:i=5,nodeStrokeWidth:l=2,nodeComponent:d,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:g="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:k=!1,ariaLabel:E="React Flow mini map",inversePan:_=!1,zoomStep:S=10,offsetScale:j=5}){const C=Mt(),M=b.useRef(null),{boundingRect:$,viewBB:I,rfId:z}=ct(cL,Dt),O=(e==null?void 0:e.width)??iL,A=(e==null?void 0:e.height)??lL,D=$.width/O,H=$.height/A,X=Math.max(D,H),R=X*O,Z=X*A,B=j*X,Q=$.x-(R-$.width)/2-B,P=$.y-(Z-$.height)/2-B,F=R+B*2,J=Z+B*2,L=`${uL}-${z}`,K=b.useRef(0);K.current=X,b.useEffect(()=>{if(M.current){const U=Hn(M.current),ee=fe=>{const{transform:me,d3Selection:ke,d3Zoom:Ve}=C.getState();if(fe.sourceEvent.type!=="wheel"||!ke||!Ve)return;const Le=-fe.sourceEvent.deltaY*(fe.sourceEvent.deltaMode===1?.05:fe.sourceEvent.deltaMode?1:.002)*S,qe=me[2]*Math.pow(2,Le);Ve.scaleTo(ke,qe)},Y=fe=>{const{transform:me,d3Selection:ke,d3Zoom:Ve,translateExtent:Le,width:qe,height:Ne}=C.getState();if(fe.sourceEvent.type!=="mousemove"||!ke||!Ve)return;const Ge=K.current*Math.max(1,me[2])*(_?-1:1),be={x:me[0]-fe.sourceEvent.movementX*Ge,y:me[1]-fe.sourceEvent.movementY*Ge},re=[[0,0],[qe,Ne]],Qe=ns.translate(be.x,be.y).scale(me[2]),ft=Ve.constrain()(Qe,re,Le);Ve.transform(ke,ft)},le=CC().on("zoom",N?Y:null).on("zoom.wheel",k?ee:null);return U.call(le),()=>{U.on("zoom",null)}}},[N,k,_,S]);const ue=y?U=>{const ee=or(U);y(U,{x:ee[0],y:ee[1]})}:void 0,G=w?(U,ee)=>{const Y=C.getState().nodeInternals.get(ee);w(U,Y)}:void 0;return he.createElement($w,{position:g,style:e,className:Vt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},he.createElement("svg",{width:O,height:A,viewBox:`${Q} ${P} ${F} ${J}`,role:"img","aria-labelledby":L,ref:M,onClick:ue},E&&he.createElement("title",{id:L},E),he.createElement(oL,{onClick:G,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:a,nodeStrokeWidth:l,nodeComponent:d}),he.createElement("path",{className:"react-flow__minimap-mask",d:`M${Q-B},${P-B}h${F+B*2}v${J+B*2}h${-F-B*2}z
|
|
57
|
+
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}xT.displayName="MiniMap";var dL=b.memo(xT);function hL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},he.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function fL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},he.createElement("path",{d:"M0 0h32v4.2H0z"}))}function pL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},he.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 mL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.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 gL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.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 Er=({children:e,className:t,...n})=>he.createElement("button",{type:"button",className:Vt(["react-flow__controls-button",t]),...n},e);Er.displayName="ControlButton";const yL=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),bT=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:a,onZoomIn:i,onZoomOut:l,onFitView:d,onInteractiveChange:f,className:p,children:h,position:g="bottom-left"})=>{const y=Mt(),[w,N]=b.useState(!1),{isInteractive:k,minZoomReached:E,maxZoomReached:_}=ct(yL,Dt),{zoomIn:S,zoomOut:j,fitView:C}=Dl();if(b.useEffect(()=>{N(!0)},[]),!w)return null;const M=()=>{S(),i==null||i()},$=()=>{j(),l==null||l()},I=()=>{C(a),d==null||d()},z=()=>{y.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),f==null||f(!k)};return he.createElement($w,{className:Vt(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&he.createElement(he.Fragment,null,he.createElement(Er,{onClick:M,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:_},he.createElement(hL,null)),he.createElement(Er,{onClick:$,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:E},he.createElement(fL,null))),n&&he.createElement(Er,{className:"react-flow__controls-fitview",onClick:I,title:"fit view","aria-label":"fit view"},he.createElement(pL,null)),s&&he.createElement(Er,{className:"react-flow__controls-interactive",onClick:z,title:"toggle interactivity","aria-label":"toggle interactivity"},k?he.createElement(gL,null):he.createElement(mL,null)),h)};bT.displayName="Controls";var vL=b.memo(bT),dr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(dr||(dr={}));function wL({color:e,dimensions:t,lineWidth:n}){return he.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function xL({color:e,radius:t}){return he.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const bL={[dr.Dots]:"#91919a",[dr.Lines]:"#eee",[dr.Cross]:"#e2e2e2"},kL={[dr.Dots]:1,[dr.Lines]:1,[dr.Cross]:6},_L=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function kT({id:e,variant:t=dr.Dots,gap:n=20,size:s,lineWidth:a=1,offset:i=2,color:l,style:d,className:f}){const p=b.useRef(null),{transform:h,patternId:g}=ct(_L,Dt),y=l||bL[t],w=s||kL[t],N=t===dr.Dots,k=t===dr.Cross,E=Array.isArray(n)?n:[n,n],_=[E[0]*h[2]||1,E[1]*h[2]||1],S=w*h[2],j=k?[S,S]:_,C=N?[S/i,S/i]:[j[0]/i,j[1]/i];return he.createElement("svg",{className:Vt(["react-flow__background",f]),style:{...d,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},he.createElement("pattern",{id:g+e,x:h[0]%_[0],y:h[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},N?he.createElement(xL,{color:y,radius:S/i}):he.createElement(wL,{dimensions:j,color:y,lineWidth:a})),he.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}kT.displayName="Background";var SL=b.memo(kT);const NL=["us-gov","global","apac","us","eu","jp","au"],EL=new RegExp(`^(?:(?:${NL.join("|")})\\.)?anthropic\\.`,"i");function ql(e){return e.replace(EL,"")}const jL=["command","cmd","file_path","path","url","pattern","notebook_path"],uk=120,bf=e=>e.length>uk?`${e.slice(0,uk-1)}…`:e;function CL(e){if(typeof e=="string")return e.trim()?bf(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of jL){const s=t[n];if(typeof s=="string"&&s.trim())return bf(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(a=>typeof a=="string")){const a=s.join(" ").trim();if(a)return bf(a)}}return null}function _T(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function Hw(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 TL(e){const t=Hw(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 RL(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]=TL(s));return Object.keys(t).length?t:void 0}function ST(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),...Hw(n)};for(const s of Object.values(n)){const a=ST(s,t+1);if(a)return a}return null}const AL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function NT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&AL.test(ql(n.model)))return n.model;for(const s of Object.values(n)){const a=NT(s,t+1);if(a)return a}return null}function cw(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function qs(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function dk(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Fl(e,t){return`${e}::${t}`}function Uu(e){return e.agent_type??e.subagent_type??"subagent"}function wl(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function qo(e,t,n,s){const a=t;let i=e.agents.get(a);return i||(i={id:a,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:_T()},e.agents.set(a,i),i)}function ET(e,t,n,s){const a=Fl(t,n),i=e.agents.get(a);if(!i)return null;!i.cwd&&s.cwd&&(i.cwd=s.cwd,i.cwdBasename=qs(s.cwd));const l=Uu(s);return l&&(i.label==="subagent"||!i.label)&&(i.label=l),i}function ML(e,t,n){const s=t.session_id??"unknown",a=wl(t);if(a){const f=ET(e,s,a,t);if(f)return f}const i=e.activeSubagentStack.get(s),l=i&&i.length>0?i[i.length-1]:null;if(l){const f=e.agents.get(Fl(s,l));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=qs(t.cwd)),f}const d=qo(e,s,n,t.hook_event_name!=="SessionStart");return!d.cwd&&t.cwd&&(d.cwd=t.cwd,d.cwdBasename=qs(t.cwd)),d.label==="session"&&t.cwd&&(d.label=qs(t.cwd)??"session"),d}function IL(e,t,n,s,a){const i=Fl(t,n),l=qo(e,t,a,!0);let d=e.agents.get(i);if(d){!d.cwd&&s.cwd&&(d.cwd=s.cwd,d.cwdBasename=qs(s.cwd));const f=Uu(s);return f&&(d.label==="subagent"||!d.label)&&(d.label=f),d}return d={id:i,sessionId:t,label:Uu(s),kind:"subagent",parentId:l.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:s.cwd,cwdBasename:qs(s.cwd),toolCount:0,childCount:0,usage:_T()},e.agents.set(i,d),l.childCount+=1,d}function $L(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function OL(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 pu(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 hk=200,PL=25;function LL(e,t){const n=t.tools;if(n.length>hk){const s=n.splice(0,n.length-hk);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-PL-1;s>=0;s--){const a=n[s];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function DL(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 fk=2e3;function qL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const a=e.prompts[s];if(a.at<t-fk)return!1;if(a.text===n&&a.at<=t+fk)return!0}return!1}function jT(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 zl(e,t){return t&&(e.revision+=1),t}function FL(e,t,n,s){if(e.agents.size<=n)return!1;const a=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>s,i=[],l=new Map;for(const[p,h]of e.agents){if(h.parentId!=null){const g=l.get(h.parentId);g?g.push(p):l.set(h.parentId,[p])}a(h)&&i.push({id:p,endedAt:h.endedAt})}if(i.length===0)return!1;i.sort((p,h)=>p.endedAt-h.endedAt);let d=0;const f=p=>{const h=e.agents.get(p);h&&(jT(e,h),e.agents.delete(p),d++)};for(const p of i){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const h=(l.get(p.id)??[]).map(g=>e.agents.get(g)).filter(g=>g!=null);if(!h.some(g=>!a(g))){for(const g of h)f(g.id);f(p.id)}}return zl(e,d>0)}function zL(e,t,n,s){const a=new Map;for(const[p,h]of e.agents){let g=a.get(h.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},a.set(h.sessionId,g)),g.ids.push(p),h.kind==="root"&&h.closedAt!=null&&(g.closed=!0),h.state==="done"&&h.endedAt!=null?g.endedAt=Math.max(g.endedAt,h.endedAt):g.live=!0}const i=[...a.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>s).sort((p,h)=>p.closed===h.closed?p.endedAt-h.endedAt:p.closed?-1:1);let d=[...a.values()].filter(p=>!p.live).length-n;if(d<=0)return!1;let f=!1;for(const p of i){if(d<=0)break;for(const h of p.ids){const g=e.agents.get(h);g&&jT(e,g),e.agents.delete(h)}d--,f=!0}return zl(e,f)}function BL(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 UL(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 zl(e,t)}function WL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.provider==="codex")continue;const i=e.agents.get(a.sessionId),l=(i==null?void 0:i.lastEventAt)??(i==null?void 0:i.startedAt);for(const d of a.tools){const f=Math.max(d.startedAt,l??d.startedAt);d.endedAt==null&&t-f>n&&(d.endedAt=f,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 zl(e,s)}const pk=90*6e4;function HL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.kind!=="root")continue;const i=a.lastEventAt??a.startedAt;if(!(t-i<=n)){a.waiting&&(a.waiting=null,s=!0),a.closedAt==null&&(a.closedAt=i),a.state==="active"&&(a.state="done",a.endedAt=i,a.reaped=!0,s=!0);for(const l of e.agents.values())l.sessionId!==a.sessionId||l.kind==="root"||l.state!=="active"||(l.state="done",l.endedAt=i,s=!0);e.activeSubagentStack.delete(a.sessionId)}}return zl(e,s)}function GL(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const VL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function YL(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 KL=3e4;function XL(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>KL)&&!(e.startedAt>t))return{name:e.name,preview:CL(e.input)??""}}function QL(e,t,n,s,a){if(n!=="permission")return{kind:n,message:s,since:a};const i=YL(e,t),l={kind:n,message:s,since:a};i!=null&&i.explicitSubagentId&&(l.subagentId=i.explicitSubagentId);const d=XL(i,a);return d&&(l.tool=d),l}function ZL(e,t,n){if(e.kind==="idle")return!0;const s=wl(t);return s==null?!0:e.subagentId!=null&&Fl(n,s)===e.subagentId}function mk(e,t){const n=t.epoch??null;if(n!==null&&n!==e.seqEpoch)e.seqEpoch=n,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const s=t.payload??{},a=t.receivedAt,i=s.hook_event_name??"Unknown";if(i==="__clear")return{...cw(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const l=s.session_id??"unknown";if(!VL.has(i)){const h=e.agents.get(l);h!=null&&h.waiting&&ZL(h.waiting,s,l)&&(h.waiting=null)}const d=e.agents.get(l);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 h=e.agents.get(l);h&&(h.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const h=e.agents.get(l);h&&(h.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const h=e.agents.get(l);h&&(h.context={...h.context??dk(),currentContextTokens:s.context_tokens})}if(i==="ModelObserved"){const h=typeof s.model=="string"?s.model:null;if(h){const y=e.agents.get(l);y&&(y.model=h)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[y,w]of Object.entries(g)){if(typeof w!="string")continue;const N=`${l}::${y}`,k=e.agents.get(N);k&&(k.model=w)}return e}if(i==="ContextObserved"){const h=s.context??null;if(h){const g=e.agents.get(l);if(g){const y=g.context??dk(),w=(k,E)=>typeof h[k]=="number"?h[k]:E,N=Array.isArray(h.memoryFiles)?h.memoryFiles:Array.isArray(h.claudeMdFiles)?h.claudeMdFiles:null;g.context={msgsUser:w("msgsUser",y.msgsUser),msgsAssistant:w("msgsAssistant",y.msgsAssistant),toolUses:w("toolUses",y.toolUses),toolResults:w("toolResults",y.toolResults),systemReminders:w("systemReminders",y.systemReminders),currentContextTokens:w("currentContextTokens",y.currentContextTokens),memoryFiles:N??y.memoryFiles}}}return e}if(i==="SessionNamed"){const h=e.agents.get(l);if(h){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",y=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(h.sessionName=g),y&&(h.sessionTitle=y);const w=h.sessionName??"";h.sessionTitle&&w&&h.sessionTitle.toLowerCase()===w.toLowerCase()&&(h.sessionTitle=void 0)}return e}if(i==="UsageObserved"){const h=s.usage??null;if(h){const g=e.agents.get(l);if(g){g.usage.inputTokens=Number(h.input_tokens??0),g.usage.outputTokens=Number(h.output_tokens??0),g.usage.cacheReadTokens=Number(h.cache_read_input_tokens??h.cached_input_tokens??0),g.usage.cacheCreateTokens=Number(h.cache_creation_input_tokens??h.cache_write_input_tokens??0);const y=Hw(h);g.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof h.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(h.reasoning_output_tokens)),g.usageByModel=RL(s.usageByModel)}}return e}const f=ML(e,s,a);f.provider||(f.provider=s.provider==="codex"?"codex":"claude");const p=NT(s);switch(p&&(f.model=p),i){case"SessionStart":{const h=qo(e,l,a,!1);h.synthetic=!1,h.state="active",h.closedAt=void 0,h.startedAt=h.startedAt||a,!h.cwd&&s.cwd&&(h.cwd=s.cwd,h.cwdBasename=qs(s.cwd)),h.label==="session"&&s.cwd&&(h.label=qs(s.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===l&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<a&&(y.exitAt=a);const h=qo(e,l,a,!1);h.state="active",h.endedAt=void 0,h.closedAt=void 0,h.exitAt=void 0;const g=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";g&&!qL(h,a,g)&&(h.prompts.push({at:a,text:g}),h.firstPrompt||(h.firstPrompt=pu(g,120)));break}case"PreToolUse":{const h=s.tool_use_id?DL(e,f,s.tool_use_id):null;if(h){s.tool_name&&h.name==="?"&&(h.name=s.tool_name),h.endedAt==null&&!h.trimmed&&s.tool_input!==void 0&&(h.input=s.tool_input,h.inputPreview=pu(s.tool_input));break}const g=s.tool_use_id??`${f.id}:${f.toolCount}`,y=wl(s),w={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:pu(s.tool_input),agentId:f.id,explicitSubagentId:y?Fl(l,y):void 0,startedAt:a};f.tools.push(w),f.toolCount+=1,f.state="active",e.toolIndex.set(g,w),e.toolOwner.set(g,f.id),LL(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=s.tool_use_id;if(!h)break;let g=e.toolIndex.get(h),y=!1;if(!g)for(const N of e.agents.values()){const k=N.tools.find(E=>E.id===h);if(k){g=k,y=!0;break}}if(!g||g.outcomeApplied)break;g.outcomeApplied=!0,g.outcomeGap=void 0,g.endedAt=a,g.ok=i==="PostToolUse",g.trimmed||(g.response=s.tool_response),i==="PostToolUseFailure"?g.errorPreview=pu(s.tool_response):y&&(g.errorPreview=void 0);const w=ST(s.tool_response);w&&(g.usage=w),e.toolIndex.delete(h),e.toolOwner.delete(h);break}case"SubagentStart":{const h=wl(s);if(!h)break;const g=IL(e,l,h,s,a);g.state="active",g.startedAt=g.startedAt||a,g.exitAt=void 0,g.endedAt=void 0;const y=Uu(s);y&&(g.label=y),$L(e,l,h);break}case"SubagentStop":{const h=wl(s);if(!h)break;const g=ET(e,l,h,s);if(!g)break;g.state="done",g.endedAt=a,OL(e,l,h);break}case"Stop":case"SessionEnd":{const h=qo(e,l,a,!1);h.state="done",h.endedAt=a,i==="SessionEnd"&&(h.closedAt=a),e.activeSubagentStack.delete(l);break}case"Notification":{const h=GL(s.notification_type);if(!h)break;const g=qo(e,l,a,!1),y=typeof s.message=="string"?s.message:"",w=g.waiting;g.waiting=w&&w.kind===h&&w.message===y?{...w,since:Math.min(w.since,a)}:QL(e,l,h,y,a);break}}return e}function Gw(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 JL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},e3=[{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:JL},{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 t3(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function ti(e,t=Date.now()){if(!e)return null;const n=ql(e);for(const s of e3)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function CT(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),s=Math.max(0,e.cacheCreate5mTokens??0),a=Math.max(0,e.cacheCreateTokens-n-s),i=s+a,l=t.cacheWrite1h??t.cacheWrite;return{tokens5m:i,tokens1h:n,usd5m:i*t.cacheWrite/1e6,usd1h:n*l/1e6}}function TT(e,t,n=Date.now()){if(!t3(t))return e.inputTokens;const s=ti(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 Vw(e,t,n=Date.now()){const s=ti(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=TT(e,t,n)*s.input/1e6,i=e.outputTokens*s.output/1e6,l=e.cacheReadTokens*s.cacheRead/1e6,d=CT(e,s),f=d.usd5m+d.usd1h;return{input:a,output:i,cacheRead:l,cacheWrite:f,total:a+i+l+f}}const gk=2e5,n3=1e6,r3=[/\[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],s3=[{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 a3(e){if(!e)return gk;const t=ql(e);for(const n of r3)if(n.test(t))return n3;for(const n of s3)if(n.match.test(t))return n.window;return gk}function RT(e,t){return typeof e=="number"&&e>0?e:a3(t)}const Lo="not priced";function Je(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 Yw(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${Je(s)}/min`:`${Je(n*3600)}/hr`}function o3(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 i3(e,t){let n=0,s=0,a=0,i=0,l=0,d=0;for(const g of t)n+=g.inputTokens,s+=g.outputTokens,a+=g.cacheReadTokens,i+=g.cacheCreateTokens,l+=g.cacheCreate1hTokens??0,d+=g.cacheCreate5mTokens??0;const f=(g,y)=>Math.max(0,g-y),p={inputTokens:f(e.inputTokens,n),outputTokens:f(e.outputTokens,s),cacheReadTokens:f(e.cacheReadTokens,a),cacheCreateTokens:f(e.cacheCreateTokens,i)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=f(e.cacheCreate1hTokens??0,l),p.cacheCreate5mTokens=f(e.cacheCreate5mTokens??0,d)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function Bl(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const s=n.map(i=>({model:i,usage:t[i]})),a=i3(e.usage,s.map(i=>i.usage));if(a){const i=s.findIndex(l=>l.model===e.model);i>=0?s[i]={model:s[i].model,usage:o3(s[i].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 Bl(e)){const a=Vw(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 uw(e,t=Date.now()){let n=0;for(const s of Bl(e))ti(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function AT(e){const t=[];for(const n of Bl(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 MT(e){return AT(e).filter(t=>t!==e.model)}const l3=new Set(["untrusted","on-request","on-failure"]);function c3(e){return typeof e!="string"||!e?null:l3.has(e)?!0:e==="never"?!1:null}function u3(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=c3(e.approvalPolicy);return t===!1?null:{label:"approvals not visible",detail:`${t===!0?`This session's approval policy is "${e.approvalPolicy}", so Codex can stop and ask you to approve a command.`:"This session's approval policy has not been read yet, so it may be able to stop and ask you to approve a command."}
|
|
58
|
+
|
|
59
|
+
Codex writes no approval request to its rollout files, which are the only thing this deck can read — so when it does ask, this card, the sidebar, the topbar count, the tab title and the favicon will all stay silent. Check the terminal.`}}function yk(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Fs(e){const t=ql(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const a=yk(n[1]),i=n[2].replace(/[-_]/g,".");return`${a} ${i}`}const s=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(s){const a=s[1].replace(/[-_]/g,"."),i=s[2].split(/[-_]/).filter(Boolean).map(yk);return[`GPT-${a}`,...i].join(" ")}return e}function od(e){const t=ql(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function Ul(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function d3(e){const t=[];for(const n of e)n.kind==="root"&&Ul(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 h3(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function id(e,t){return`${e}@${t.since}`}function IT(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 f3(e){const t=e.message||"Needs your permission",n=IT(e,t);return n?`${t}
|
|
60
|
+
Likely on: ${n}`:t}function p3(e,t,n,s=!0){if(!s)return[];if(n)return[];const a=[];for(const i of e){if(!Ul(i.waiting))continue;const l=id(i.id,i.waiting);t.has(l)||a.push({key:l,title:i.label,body:f3(i.waiting),sessionId:i.id})}return a}function m3(e,t,n){const s=new Set;for(const i of e)s.add(id(i.id,i.waiting));const a=new Set;for(const i of n)s.has(i)&&a.add(i);for(const i of t)a.add(i.key);return a}function vk(e){return new Set(e.map(t=>id(t.id,t.waiting)))}function g3(e,t){return e!==t}function y3(e,t){return t&&e==="default"}function At(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 Wu(e,t,n){const s=(t??n)-e;if(s<1e3)return`${Math.max(0,s)}ms`;const a=Math.floor(s/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60),l=a%60;return`${i}m ${String(l).padStart(2,"0")}s`}function $T(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 OT(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 v3=1;function w3(){const e=[];let t=0;function n(){let s;for(const a of e)(!s||a.layer>s.layer||a.layer===s.layer&&a.seq>s.seq)&&(s=a);return s}return{push(s,a=0){const i={dismiss:s,layer:a,seq:t++};return e.push(i),()=>{const l=e.indexOf(i);l!==-1&&e.splice(l,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 Hu=w3();function x3(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function wk(e){return String(e.tagName??"").toUpperCase()==="BODY"}function b3(e,t){return!e||!e.isConnected||wk(e)?!1:t==null||wk(t)}const xk="a[href], button, input, select, textarea, [tabindex]";function k3(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function _3(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function S3({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 Kw(e){return e.ctrlKey||e.metaKey||e.altKey}const N3=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),E3=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),j3=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function PT(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function Xw(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=PT(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!N3.has(String(e.type??"text").toLowerCase())}function C3(e){if(!e)return!1;if(Xw(e)||E3.has(PT(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(n=>j3.has(n))}function T3({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function LT(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(xk))return k3({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&_3({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(xk)!=null})}):[]}function R3(e,t){const n=LT(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 tn(e,t={}){const{focusRef:n,layer:s}=t,a=b.useRef(null),i=b.useRef(e);i.current=e;const l=b.useRef(null);l.current===null&&(l.current=()=>i.current());const d=l.current;return b.useEffect(()=>Hu.push(d,s),[d,s]),b.useEffect(()=>{var p;const f=document.activeElement;return(p=(n==null?void 0:n.current)??LT(a.current)[0])==null||p.focus(),()=>{b3(f,document.activeElement)&&f.focus()}},[]),b.useEffect(()=>{const f=p=>{var k;if(p.key!=="Tab"||Kw(p))return;const h=a.current;if(!h)return;const g=document.activeElement;if(!(g!=null&&h.contains(g))&&!Hu.isTop(d))return;const w=R3(h,g),N=S3({count:w.length,index:g?w.indexOf(g):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((k=w[N.index])==null||k.focus()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[d]),a}function A3(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 M3(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const I3=60;function $3(e,t=I3){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 O3({agent:e,onClose:t}){var y;const n=b.useRef(null),s=tn(t,{focusRef:n}),a=e.context,i=e.usage,l=(a==null?void 0:a.currentContextTokens)??0,d=RT(e.contextWindow,e.model),f=Math.min(100,l/d*100),p=An(e),h=i.inputTokens+i.cacheReadTokens+i.cacheCreateTokens,g=A3(e.provider);return c.jsx("div",{className:"ctx-modal-backdrop",onClick:t,role:"presentation",children:c.jsxs("div",{ref:s,className:"ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[c.jsxs("header",{className:"ctx-modal-head",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),c.jsx("div",{className:"ctx-modal-sub",children:g.subtitle})]}),c.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),c.jsxs("section",{className:"ctx-window-row",children:[c.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f),children:c.jsx("div",{className:"ctx-window-fill",style:{width:`${f}%`}})}),c.jsxs("div",{className:"ctx-window-meta",children:[c.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),c.jsxs("span",{children:[Wn(l)," / ",Wn(d)," tok (",g.windowScope,")"]})]})]}),c.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),c.jsxs("div",{className:"ctx-grid",children:[c.jsx(ar,{label:"input tokens",val:Wn(i.inputTokens)}),c.jsx(ar,{label:"output tokens",val:Wn(i.outputTokens)}),c.jsx(ar,{label:"cache reads",val:Wn(i.cacheReadTokens)}),c.jsx(ar,{label:"cache writes",val:Wn(i.cacheCreateTokens)}),c.jsx(ar,{label:"cumulative total",val:Wn(h)}),c.jsx(ar,{label:"estimated cost",val:Je(p.total),accent:!0})]}),c.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),g.compositionCounted?c.jsxs("div",{className:"ctx-grid",children:[c.jsx(ar,{label:"user messages",val:Wn((a==null?void 0:a.msgsUser)??0)}),c.jsx(ar,{label:"assistant messages",val:Wn((a==null?void 0:a.msgsAssistant)??0)}),c.jsx(ar,{label:"tool uses",val:Wn((a==null?void 0:a.toolUses)??0)}),c.jsx(ar,{label:"tool results",val:Wn((a==null?void 0:a.toolResults)??0)}),c.jsx(ar,{label:"system-reminders",val:Wn((a==null?void 0:a.systemReminders)??0)})]}):c.jsx("div",{className:"ctx-empty",children:g.compositionUncounted}),c.jsx("h3",{className:"ctx-section-title",children:g.memoryHeading}),(((y=a==null?void 0:a.memoryFiles)==null?void 0:y.length)??0)===0?c.jsx("div",{className:"ctx-empty",children:g.memoryEmpty}):c.jsx("ul",{className:"ctx-md-list",children:a.memoryFiles.map(w=>c.jsxs("li",{children:[c.jsx("span",{className:"ctx-md-path",title:w.path,children:$3(w.path)}),c.jsx("span",{className:"ctx-md-size",children:M3(w.bytes)})]},w.path))})]})})}function ar({label:e,val:t,accent:n}){return c.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[c.jsx("span",{className:"ctx-row-label",children:e}),c.jsx("span",{className:"ctx-row-val",children:t})]})}function P3({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:a}){const i=RT(n,t),l=Math.min(1,e/i),d=s/2-3,f=s/2,p=2*Math.PI*d,h=p*l,g=l>.9?"var(--err)":l>.7?"var(--inflight)":"var(--accent)";return c.jsx("button",{type:"button",className:"ctx-donut",onClick:a,title:`context: ${e.toLocaleString()} / ${i.toLocaleString()} (${(l*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:c.jsxs("svg",{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[c.jsx("circle",{cx:f,cy:f,r:d,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),c.jsx("circle",{cx:f,cy:f,r:d,stroke:g,strokeWidth:"2.5",fill:"none",strokeDasharray:`${h} ${p-h}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),c.jsx("text",{x:f,y:f+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(l*100)})]})})}function bk(e,t){const n=ti(t);if(!n)return`model: ${t}
|
|
61
|
+
no published rate in this build — the tokens are counted, the dollars are not`;const s=h=>h.toLocaleString(),a=h=>`$${h}/MTok`,i=Vw(e,t),l=CT(e,n),d=l.tokens1h>0?[`cache w5m${s(l.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${Je(l.usd5m)}`,`cache w1h${s(l.tokens1h).padStart(14)} × ${a(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${Je(l.usd1h)}`]:[`cache w ${s(l.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${Je(l.usd5m)}`],f=TT(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(f).padStart(14)} × ${a(n.input).padEnd(11)} = ${Je(i.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${a(n.output).padEnd(11)} = ${Je(i.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${a(n.cacheRead).padEnd(11)} = ${Je(i.cacheRead)}`,...d,"─────────────────────────────────────────",`total = ${Je(i.total)}`].join(`
|
|
62
|
+
`)}function kk(e){const t=Bl(e);return t.length<=1?bk(e.usage,e.model):[...t.map(n=>bk(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${Je(An(e).total)}`].join(`
|
|
63
|
+
`)}function L3({data:e,selected:t}){var y;const n=e.now??Date.now(),s=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),a=e.tools.filter(w=>!w.endedAt).length,i=Gw(e.sessionId),l=((y=e.context)==null?void 0:y.currentContextTokens)??0,d=e.kind==="root"&&l>0,f=e.sessionTitle?e.cwd?`${e.cwd}
|
|
64
|
+
${e.sessionTitle}`:e.sessionTitle:e.cwd,p=MT(e),h=p.length>0?`${e.model}
|
|
65
65
|
spend on this card also covers:
|
|
66
66
|
${p.join(`
|
|
67
|
-
`)}`:e.model,g
|
|
68
|
-
burn: ${_}`:"");return c.jsxs("span",{className:"cost-meta",title:S,children:[c.jsxs("b",{children:[Je(N.total),k>0?"+":""]}),_&&c.jsx("span",{className:"cost-rate",children:_})]})})()]}),c.jsx(Ko,{type:"source",position:Oe.Right,style:{background:"transparent",border:"none"}})]})}function Gu(e){return e==="active"?"live":e==="done"?"done":"err"}function
|
|
69
|
-
Blocked for ${Wu(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?c.jsx("span",{className:"ap-pulse","aria-hidden":!0}):c.jsx("span",{className:"waiting-dot","aria-hidden":!0}),c.jsx("span",{className:"waiting-said",children:
|
|
70
|
-
drag the wrapper to move the whole session`,onClick:()=>l(f.sessionId),children:[f.label,f.name?c.jsxs(c.Fragment,{children:[dw,c.jsx("span",{className:"cluster-label-name",children:f.name})]}):null,f.shortId?dw+f.shortId:null]})]},f.sessionId)})})}function
|
|
71
|
-
`:n==="r"?"\r":n==="t"?" ":n)}const DT=600,c4=4,u4=36,hw=16,d4=60,h4=6,Ck=220,Tk=96,f4=28,Rk={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:"📡",...t4};function Ak(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(Rk,e)?Rk[e]:"✨"}const Mk={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 qT(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 qT(n[1]);for(;;){const i=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!i)break;t=t.slice(i[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const s=t.match(/^([^\s|;&<>(]+)/);if(!s)return null;let a=s[1];return a=a.replace(/^.*[/\\]/,""),a=a.replace(/\.(exe|cmd|bat|ps1)$/i,""),a||null}function p4(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=i4(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 m4=new Set(["Bash","PowerShell",...s4]),g4=r4;function y4(e,t){return g4.has(e)||e.startsWith("mcp__")?Math.max(Tk,34+t.length*7.5):Tk}function v4(e,t){if(!m4.has(e))return null;const n=p4(t);if(!n)return null;const s=qT(n);return s?{emoji:Object.hasOwn(Mk,s)?Mk[s]:"⚙️",label:s,category:"shell",detail:n}:null}const w4=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),Ik={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:"🗄️"},$k={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 x4(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function b4(e){const t=e.toLowerCase();if(Object.hasOwn($k,t))return $k[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(Ik,s))return Ik[s]}return"📄"}function k4(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 _4(e,t){if(!w4.has(e))return null;const n=k4(e,t);if(!n)return null;const s=x4(n);return s?{emoji:e==="LS"?"📂":b4(s),label:s,category:"file",detail:n}:null}const Ok={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 Qw(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 S4(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 FT(e){const t=e.toLowerCase();return Object.hasOwn(Ok,t)?Ok[t]:void 0}function N4(e,t){const n=Qw(e);if(!n)return null;const{server:s,method:a}=n;if(!a)return null;const i=FT(s);return{emoji:(i==null?void 0:i.emoji)??"🔌",label:a,category:"mcp",detail:i?`${i.name} · ${a}`:`${s} · ${a}`}}function E4(e,t){return v4(e,t)??_4(e,t)??N4(e)}const Pk=n4;function zT(e){const t=Qw(e);if(t){const s=FT(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:t.server,hue:S4(t.server)}}const n=Object.hasOwn(Pk,e)?Pk[e]:"";return n?{emoji:Ak(e),label:n}:{emoji:Ak(e),label:e}}function j4(e){let t=null,n="";for(const s of e){const a=Qw(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:zT(n)}function C4(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function T4(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/DT)}function R4(e,t){const n=[],s=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const i=e[a];s.has(i.id)||(s.add(i.id),n.push(i))}return n.reverse()}function A4(e,t,n,s,a,i){const l=[];for(const d of e.values()){if(!t.has(d.id)||d.exitAt!=null&&i-d.exitAt>DT)continue;const f=s.get(d.id)??n.get(d.id);if(!f)continue;const p=R4(d.tools,c4);if(p.length===0)continue;const h=d.exitAt??null,g=a.get(d.id),y=Math.max((g==null?void 0:g.width)??Ck,Ck),w=(g==null?void 0:g.height)??130,N=f.x,k=f.y,E=N+y,_=k+w/2;p.forEach((S,j)=>{const C=j*u4,M=N+y+d4,$=k+h4+C,I=T4(i,h),z=S.inputPreview??"",O=C4(S),A=I<.999,D=zT(S.name);l.push({id:`${d.id}::${S.id}`,toolId:S.id,agentId:d.id,toolName:S.name,name:D.label,emoji:D.emoji,status:O,category:LT(S.name),mcpHue:D.hue,inputPreview:z,fade:I,fading:A,worldX:M,worldY:$,anchorX:E,anchorY:_,spawnDx:E-M,spawnDy:_-($+hw)});const H=E4(S.name,S.input);if(H){const X=y4(S.name,D.label),R=M+X+f4,Z=$,B=M+X,Q=$+hw;l.push({id:`sub:${d.id}::${S.id}`,toolId:S.id,agentId:d.id,toolName:S.name,name:H.label,emoji:H.emoji,isSub:!0,status:O,category:H.category,inputPreview:H.detail??z,fade:I,fading:A,worldX:R,worldY:Z,anchorX:B,anchorY:Q,spawnDx:B-R,spawnDy:0})}})}return l}function M4({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:a,spotlight:i,hiddenCategories:l,now:d,onOpenTool:f}){const p=A4(e,t,n,s,a,d),h=l&&l.size>0?p.filter(g=>!l.has(g.category)):p;return c.jsx(I4,{bursts:h,spotlight:i,onOpenTool:f})}function I4({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:a,zoom:i}=yT();return c.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[c.jsx("svg",{className:"tool-bursts-svg",children:e.map(l=>{const d=l.anchorX*i+s,f=l.anchorY*i+a,p=(l.worldX+6)*i+s,h=(l.worldY+hw)*i+a,g=d+(p-d)*.55,y=t!=null&&!t.has(l.agentId),w=l.fade*(y?.14:1);return c.jsx("path",{d:`M ${d} ${f} Q ${g} ${f}, ${p} ${h}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:w},`l:${l.id}`)})}),e.map(l=>{const d=l.worldX*i+s,f=l.worldY*i+a,p={left:`${d}px`,top:`${f}px`,transform:`scale(${i})`,transformOrigin:"left top","--spawn-dx":`${l.spawnDx}px`,"--spawn-dy":`${l.spawnDy}px`},h=l.isSub?`${l.toolName} · ${l.name}`:l.toolName,g=l.inputPreview?`${h} · ${l.inputPreview}`:h,y=n!=null,w=l.mcpHue!=null?{"--mcp-hue":l.mcpHue}:{},k=t!=null&&!t.has(l.agentId)?" dim":"";return c.jsx("div",{className:"tool-burst-wrap",style:p,children:c.jsxs("div",{className:`tool-burst cat-${l.category}${l.mcpHue!=null?" mcp-hue":""} status-${l.status}${l.fading?" fading":""}${y?" clickable":""}${l.isSub?" sub":""}${k}`,style:w,title:g,onClick:y?()=>n(l.toolId):void 0,children:[c.jsx("span",{className:"tb-emoji",children:l.emoji}),c.jsx("span",{className:"tb-name",children:l.name}),l.status==="inflight"&&c.jsx("span",{className:"tb-spin"}),l.status==="done"&&c.jsx("span",{className:"tb-mark done",children:"✓"}),l.status==="err"&&c.jsx("span",{className:"tb-mark err",children:"×"})]})},l.id)})]})}function $4(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,a=0,i=0;for(const l of e){const d=An(l);t.input+=d.input,t.output+=d.output,t.cacheRead+=d.cacheRead,t.cacheWrite+=d.cacheWrite,t.total+=d.total,n+=l.usage.inputTokens,s+=l.usage.outputTokens,a+=l.usage.cacheReadTokens,i+=l.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:a,cacheCreateTokens:i,sum:n+s}}const O4="spend on this board",P4="on this board",Lk=`Everything on the board right now, and only that.
|
|
67
|
+
`)}`:e.model,g=OT(e.sessionName,e.sessionTitle);return c.jsxs("div",{className:s,style:{"--session-hue":i},children:[c.jsx("span",{className:"accent-stripe"}),c.jsx(Ko,{type:"target",position:Oe.Left,style:{background:"transparent",border:"none"}}),c.jsxs("div",{className:"head",children:[c.jsxs("div",{className:"title",children:[c.jsx(D3,{state:e.state}),c.jsx("span",{className:"label",title:f,children:e.label}),e.synthetic&&c.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),c.jsxs("div",{className:"head-right",children:[d&&e.onOpenContext&&c.jsx(P3,{currentContextTokens:l,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),c.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:Wu(e.startedAt,e.endedAt,n)})]})]}),c.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&c.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?c.jsxs("span",{className:"model-chip","data-family":od(e.model),title:h,children:[Fs(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?c.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&g.face&&c.jsx("div",{className:"session-name",title:g.tooltip,children:g.face}),e.waiting&&c.jsx(z3,{waiting:e.waiting,now:n}),(()=>{const w=u3(e);return w?c.jsxs("div",{className:"approval-blind-row",title:w.detail,children:[c.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),c.jsx("span",{className:"approval-blind-said",children:w.label})]}):null})(),e.tools.length>0&&c.jsx(B3,{tools:e.tools,now:n}),c.jsxs("div",{className:"meta",children:[c.jsxs("span",{children:[c.jsx("b",{children:e.toolCount})," tools"]}),a>0&&c.jsxs("span",{className:"inflight-meta",children:[c.jsx("b",{children:a})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&c.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:[c.jsx("b",{children:At(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const w=ti(e.model),N=An(e),k=uw(e);if(!w&&N.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:c.jsx("span",{className:"cost-unpriced",title:kk(e),children:Lo});if(N.total<=0)return null;const E=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),_=e.state==="active"?Yw(N.total,E):null,S=kk(e)+(_?`
|
|
68
|
+
burn: ${_}`:"");return c.jsxs("span",{className:"cost-meta",title:S,children:[c.jsxs("b",{children:[Je(N.total),k>0?"+":""]}),_&&c.jsx("span",{className:"cost-rate",children:_})]})})()]}),c.jsx(Ko,{type:"source",position:Oe.Right,style:{background:"transparent",border:"none"}})]})}function Gu(e){return e==="active"?"live":e==="done"?"done":"err"}function D3({state:e}){return c.jsx("span",{className:`state-pill state-${e}`,children:Gu(e)})}function Tl(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function q3(e,t){const n=IT(e,t);return n?`Likely on: ${n}`:null}function F3(e){return e.kind==="idle"?"Your turn":Tl(e)}function z3({waiting:e,now:t}){const n=Ul(e),s=Tl(e);return c.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
|
|
69
|
+
Blocked for ${Wu(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?c.jsx("span",{className:"ap-pulse","aria-hidden":!0}):c.jsx("span",{className:"waiting-dot","aria-hidden":!0}),c.jsx("span",{className:"waiting-said",children:F3(e)}),c.jsx("b",{children:Wu(e.since,void 0,t)})]})}function B3({tools:e,now:t}){const i=new Array(24).fill(0);let l=0;for(const N of e){const k=t-N.startedAt;if(k<0||k>=6e4)continue;const E=23-Math.floor(k/2500);E>=0&&E<24&&(i[E]+=1,l+=1)}const d=Math.max(1,...i),f=Math.max(0,...i),p=132,h=14,g=p/24,y=f/(2500/1e3),w=l===0?"no tool calls in the last 60s":`${l} tool calls in last 60s · peak ${y.toFixed(1)}/s`;return c.jsxs("div",{className:"tool-spark-row",title:w,children:[c.jsx("svg",{className:"tool-spark",width:p,height:h,viewBox:`0 0 ${p} ${h}`,"aria-hidden":!0,children:i.map((N,k)=>{const E=N===0?1.5:Math.max(1.5,N/d*h),_=k===23&&N>0,j=`tool-spark-bar${N>0?" active":""}${_?" latest":""}`;return c.jsx("rect",{x:k*g+.4,y:h-E,width:Math.max(.5,g-1),height:E,rx:.8,className:j},k)})}),c.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function _k(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function U3({tool:e,onClose:t}){const n=tn(t),s=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return c.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:c.jsxs("div",{ref:n,className:"modal",onClick:a=>a.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{className:`status-dot ${s}`,"aria-hidden":!0}),c.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),c.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),c.jsxs("div",{className:"modal-actions",children:[c.jsx("span",{className:"modal-dur",children:$T(e,"in-flight…")}),c.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),c.jsxs("section",{className:"modal-body",children:[e.trimmed&&c.jsx("div",{className:"modal-section",children:c.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h4",{children:"Input"}),c.jsx("pre",{children:_k(e.input??e.inputPreview)})]}),c.jsxs("div",{className:"modal-section",children:[c.jsxs("h4",{children:["Response ",s==="err"&&c.jsx("span",{className:"err-tag",children:"error"})]}),c.jsx("pre",{children:e.endedAt==null?"(waiting…)":_k(e.response??e.errorPreview)})]})]})]})})}const mu=18,Sk=26,W3=12;function H3(e){return G3(e.nodeInternals.values())}function G3(e){const t=new Map;for(const a of e){if(a.type!=="agent")continue;const i=a.data;if(!(i!=null&&i.sessionId)||i.exitAt!=null||a.width==null||a.height==null)continue;const l=a.position.x,d=a.position.y,f=l+a.width,p=d+a.height,h=t.get(i.sessionId);h?(h.minX=Math.min(h.minX,l),h.minY=Math.min(h.minY,d),h.maxX=Math.max(h.maxX,f),h.maxY=Math.max(h.maxY,p),i.kind==="root"&&(h.label=Ek(i)??h.label),i.kind==="root"&&(h.name=jk(i))):t.set(i.sessionId,{minX:l,minY:d,maxX:f,maxY:p,label:Ek(i)??i.sessionId,name:jk(i)})}const n=new Map;for(const a of t.values())n.set(a.label,(n.get(a.label)??0)+1);const s=[];for(const[a,i]of t){const l=(n.get(i.label)??0)>1;s.push({sessionId:a,...X3(i.label,i.name,a,l),x:i.minX-mu,y:i.minY-mu-Sk,w:i.maxX-i.minX+mu*2,h:i.maxY-i.minY+mu*2+Sk})}return s}const dw=" · ",V3=32,Y3=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function Nk(e){return Y3.test(e)?2:1}function K3(e,t=V3){const n=[...e];let s=0;for(const l of n)s+=Nk(l);if(s<=t)return e;const a=[];let i=0;for(const l of n){const d=Nk(l);if(i+d>t-1)break;a.push(l),i+=d}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function X3(e,t,n,s){const a=(t==null?void 0:t.trim())??"",i=s?Q3(n):void 0,l=[e,a||void 0,i].filter(Boolean);return{label:e,name:a?K3(a):void 0,shortId:i,fullLabel:l.join(dw)}}function Q3(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function Ek(e){if(e.kind==="root")return e.label}function jk(e){if(e.kind==="root")return OT(e.sessionName,e.sessionTitle).face}function Z3({onFit:e}){const{x:t,y:n,zoom:s}=vT(),a=Dl(),i=ct(H3,J3);if(i.length<=1)return null;const l=f=>{try{const p=a.getNodes().filter(h=>{const g=h.data;return(g==null?void 0:g.sessionId)===f});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 c.jsx("div",{className:"session-clusters",style:d,children:i.map(f=>{const p=Gw(f.sessionId),h={position:"absolute",left:f.x,top:f.y,width:f.w,height:f.h,"--session-hue":p},g={position:"absolute",left:f.x+16,top:f.y-W3,transform:`scale(${Math.min(1,s)/(s||1)})`,transformOrigin:"left top","--session-hue":p};return c.jsxs(he.Fragment,{children:[c.jsx("div",{className:"cluster-card",style:h,"aria-hidden":!0}),c.jsxs("button",{type:"button",className:"cluster-label",style:g,title:`Fit view to ${f.fullLabel}
|
|
70
|
+
drag the wrapper to move the whole session`,onClick:()=>l(f.sessionId),children:[f.label,f.name?c.jsxs(c.Fragment,{children:[dw,c.jsx("span",{className:"cluster-label-name",children:f.name})]}):null,f.shortId?dw+f.shortId:null]})]},f.sessionId)})})}function J3(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 e4({data:e}){return c.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const Wl={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"}},t4=Object.fromEntries(Object.entries(Wl).map(([e,t])=>[e,t.category])),n4=Object.fromEntries(Object.entries(Wl).map(([e,t])=>[e,t.emoji])),r4=Object.fromEntries(Object.entries(Wl).map(([e,t])=>[e,t.label])),s4=new Set(Object.keys(Wl)),a4=new Set(Object.entries(Wl).filter(([,e])=>e.shell).map(([e])=>e)),Ck={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",...t4};function DT(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(Ck,e)?Ck[e]:"other"}const o4=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,i4=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function l4(e){if(typeof e!="string"||!e)return null;const t=o4.exec(e);if(t){const s=c4(t[2]);if(s.trim())return s}const n=i4.exec(e);return n?n[1]:null}function c4(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
71
|
+
`:n==="r"?"\r":n==="t"?" ":n)}const qT=600,u4=4,d4=36,hw=16,h4=60,f4=6,Tk=220,Rk=96,p4=28,Ak={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:"📡",...n4};function Mk(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(Ak,e)?Ak[e]:"✨"}const Ik={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 FT(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 FT(n[1]);for(;;){const i=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!i)break;t=t.slice(i[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const s=t.match(/^([^\s|;&<>(]+)/);if(!s)return null;let a=s[1];return a=a.replace(/^.*[/\\]/,""),a=a.replace(/\.(exe|cmd|bat|ps1)$/i,""),a||null}function m4(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=l4(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 g4=new Set(["Bash","PowerShell",...a4]),y4=s4;function v4(e,t){return y4.has(e)||e.startsWith("mcp__")?Math.max(Rk,34+t.length*7.5):Rk}function w4(e,t){if(!g4.has(e))return null;const n=m4(t);if(!n)return null;const s=FT(n);return s?{emoji:Object.hasOwn(Ik,s)?Ik[s]:"⚙️",label:s,category:"shell",detail:n}:null}const x4=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),$k={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:"🗄️"},Ok={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 b4(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function k4(e){const t=e.toLowerCase();if(Object.hasOwn(Ok,t))return Ok[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($k,s))return $k[s]}return"📄"}function _4(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 S4(e,t){if(!x4.has(e))return null;const n=_4(e,t);if(!n)return null;const s=b4(n);return s?{emoji:e==="LS"?"📂":k4(s),label:s,category:"file",detail:n}:null}const Pk={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 Qw(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 N4(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 zT(e){const t=e.toLowerCase();return Object.hasOwn(Pk,t)?Pk[t]:void 0}function E4(e,t){const n=Qw(e);if(!n)return null;const{server:s,method:a}=n;if(!a)return null;const i=zT(s);return{emoji:(i==null?void 0:i.emoji)??"🔌",label:a,category:"mcp",detail:i?`${i.name} · ${a}`:`${s} · ${a}`}}function j4(e,t){return w4(e,t)??S4(e,t)??E4(e)}const Lk=r4;function BT(e){const t=Qw(e);if(t){const s=zT(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:t.server,hue:N4(t.server)}}const n=Object.hasOwn(Lk,e)?Lk[e]:"";return n?{emoji:Mk(e),label:n}:{emoji:Mk(e),label:e}}function C4(e){let t=null,n="";for(const s of e){const a=Qw(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:BT(n)}function T4(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function R4(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/qT)}function A4(e,t){const n=[],s=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const i=e[a];s.has(i.id)||(s.add(i.id),n.push(i))}return n.reverse()}function M4(e,t,n,s,a,i){const l=[];for(const d of e.values()){if(!t.has(d.id)||d.exitAt!=null&&i-d.exitAt>qT)continue;const f=s.get(d.id)??n.get(d.id);if(!f)continue;const p=A4(d.tools,u4);if(p.length===0)continue;const h=d.exitAt??null,g=a.get(d.id),y=Math.max((g==null?void 0:g.width)??Tk,Tk),w=(g==null?void 0:g.height)??130,N=f.x,k=f.y,E=N+y,_=k+w/2;p.forEach((S,j)=>{const C=j*d4,M=N+y+h4,$=k+f4+C,I=R4(i,h),z=S.inputPreview??"",O=T4(S),A=I<.999,D=BT(S.name);l.push({id:`${d.id}::${S.id}`,toolId:S.id,agentId:d.id,toolName:S.name,name:D.label,emoji:D.emoji,status:O,category:DT(S.name),mcpHue:D.hue,inputPreview:z,fade:I,fading:A,worldX:M,worldY:$,anchorX:E,anchorY:_,spawnDx:E-M,spawnDy:_-($+hw)});const H=j4(S.name,S.input);if(H){const X=v4(S.name,D.label),R=M+X+p4,Z=$,B=M+X,Q=$+hw;l.push({id:`sub:${d.id}::${S.id}`,toolId:S.id,agentId:d.id,toolName:S.name,name:H.label,emoji:H.emoji,isSub:!0,status:O,category:H.category,inputPreview:H.detail??z,fade:I,fading:A,worldX:R,worldY:Z,anchorX:B,anchorY:Q,spawnDx:B-R,spawnDy:0})}})}return l}function I4({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:a,spotlight:i,hiddenCategories:l,now:d,onOpenTool:f}){const p=M4(e,t,n,s,a,d),h=l&&l.size>0?p.filter(g=>!l.has(g.category)):p;return c.jsx($4,{bursts:h,spotlight:i,onOpenTool:f})}function $4({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:a,zoom:i}=vT();return c.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[c.jsx("svg",{className:"tool-bursts-svg",children:e.map(l=>{const d=l.anchorX*i+s,f=l.anchorY*i+a,p=(l.worldX+6)*i+s,h=(l.worldY+hw)*i+a,g=d+(p-d)*.55,y=t!=null&&!t.has(l.agentId),w=l.fade*(y?.14:1);return c.jsx("path",{d:`M ${d} ${f} Q ${g} ${f}, ${p} ${h}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:w},`l:${l.id}`)})}),e.map(l=>{const d=l.worldX*i+s,f=l.worldY*i+a,p={left:`${d}px`,top:`${f}px`,transform:`scale(${i})`,transformOrigin:"left top","--spawn-dx":`${l.spawnDx}px`,"--spawn-dy":`${l.spawnDy}px`},h=l.isSub?`${l.toolName} · ${l.name}`:l.toolName,g=l.inputPreview?`${h} · ${l.inputPreview}`:h,y=n!=null,w=l.mcpHue!=null?{"--mcp-hue":l.mcpHue}:{},k=t!=null&&!t.has(l.agentId)?" dim":"";return c.jsx("div",{className:"tool-burst-wrap",style:p,children:c.jsxs("div",{className:`tool-burst cat-${l.category}${l.mcpHue!=null?" mcp-hue":""} status-${l.status}${l.fading?" fading":""}${y?" clickable":""}${l.isSub?" sub":""}${k}`,style:w,title:g,onClick:y?()=>n(l.toolId):void 0,children:[c.jsx("span",{className:"tb-emoji",children:l.emoji}),c.jsx("span",{className:"tb-name",children:l.name}),l.status==="inflight"&&c.jsx("span",{className:"tb-spin"}),l.status==="done"&&c.jsx("span",{className:"tb-mark done",children:"✓"}),l.status==="err"&&c.jsx("span",{className:"tb-mark err",children:"×"})]})},l.id)})]})}function O4(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,a=0,i=0;for(const l of e){const d=An(l);t.input+=d.input,t.output+=d.output,t.cacheRead+=d.cacheRead,t.cacheWrite+=d.cacheWrite,t.total+=d.total,n+=l.usage.inputTokens,s+=l.usage.outputTokens,a+=l.usage.cacheReadTokens,i+=l.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:a,cacheCreateTokens:i,sum:n+s}}const P4="spend on this board",L4="on this board",Dk=`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 ",qk(f.waiting.since,void 0,t),f.waiting.tool&&c.jsxs("span",{className:"sl-waiting-tool",children:[" · ",f.waiting.tool.name]})]}):c.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:qk(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]})]})]},f.sessionId)})]})]})}const z4=e=>1-Math.pow(1-e,5),UT=420;function B4(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 U4(e,t,n,s=UT){return n>=s?t:n<=0?e:e+(t-e)*z4(n/s)}function W4(e,t,n,s={}){const a=s.now??(()=>performance.now()),i=s.raf??(w=>requestAnimationFrame(w)),l=s.cancel??(w=>cancelAnimationFrame(w)),d=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),f=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(d()||f()||!B4(e,t))return n(t),()=>{};const p=a();let h=0,g=!0;const y=()=>{if(!g)return;const w=a()-p;n(U4(e,t,w)),w<UT&&(h=i(y))};return h=i(y),()=>{g=!1,h&&l(h)}}const fw={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function Fk(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 H4(e,t){if(!e)return fw;const n={...fw};for(const[s,a]of t){const i=e.get(s);if(!i)continue;const l={cost:a.cost-i.cost,inputTokens:a.inputTokens-i.inputTokens,outputTokens:a.outputTokens-i.outputTokens,cacheReadTokens:a.cacheReadTokens-i.cacheReadTokens,cacheCreateTokens:a.cacheCreateTokens-i.cacheCreateTokens};l.cost<0||l.inputTokens<0||l.outputTokens<0||l.cost===0&&l.inputTokens===0&&l.outputTokens===0&&l.cacheReadTokens===0&&l.cacheCreateTokens===0||(n.cost+=l.cost,n.inputTokens+=Math.max(0,l.inputTokens),n.outputTokens+=Math.max(0,l.outputTokens),n.cacheReadTokens+=Math.max(0,l.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,l.cacheCreateTokens),n.sessions+=1)}return n}function pw(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const ld=[{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 G4(e,t,n=ld.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 V4(e,t=new Date){return e==="today"?pw(1,t):e==="month"?pw(t.getDate(),t):"20200101"}const Rn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Ru=e=>typeof e=="string"?e:"";function WT(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const s of t){const a=Array.isArray(s==null?void 0:s.modelBreakdowns)?s.modelBreakdowns:[];for(const i of a){const l=Ru(i==null?void 0:i.modelName);if(!l)continue;let d=n.get(l);d||(d={model:l,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(l,d)),d.cost+=Rn(i==null?void 0:i.cost),d.inputTokens+=Rn(i==null?void 0:i.inputTokens),d.outputTokens+=Rn(i==null?void 0:i.outputTokens),d.cacheReadTokens+=Rn(i==null?void 0:i.cacheReadTokens),d.cacheCreateTokens+=Rn(i==null?void 0:i.cacheCreationTokens)}}return[...n.values()].sort((s,a)=>a.cost-s.cost||a.tokens-s.tokens)}function Y4(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const a of n){const i=Ru(a==null?void 0:a.period);if(!i)continue;const l=a==null?void 0:a.metadata,d=typeof(l==null?void 0:l.lastActivity)=="string"?Date.parse(l.lastActivity):NaN;s.push({sessionId:i,label:t.get(i)??null,agent:Ru(a==null?void 0:a.agent)||"claude",cost:Rn(a==null?void 0:a.totalCost),tokens:Rn(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(Ru).filter(Boolean):[],lastActivityMs:Number.isFinite(d)?d:null})}return s.sort((a,i)=>i.cost-a.cost||i.tokens-a.tokens)}function HT(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=Rn(t.cacheReadTokens),p=Rn(t.cacheCreationTokens),h=Rn(t.inputTokens),g=Rn(t.outputTokens);return{cost:Rn(t.totalCost),inputTokens:h,outputTokens:g,cacheReadTokens:f,cacheCreateTokens:p,tokens:Rn(t.totalTokens)||h+g+f+p}}const n=WT(e),s=f=>n.reduce((p,h)=>p+f(h),0),a=s(f=>f.inputTokens),i=s(f=>f.outputTokens),l=s(f=>f.cacheReadTokens),d=s(f=>f.cacheCreateTokens);return{cost:s(f=>f.cost),inputTokens:a,outputTokens:i,cacheReadTokens:l,cacheCreateTokens:d,tokens:a+i+l+d}}function K4(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 zk(e,t){var n;return((n=ld.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function X4(e,t,n){const s=e!=null,a=HT(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 Q4="1",Bk="agent-dag.schema",Z4=["agent-dag.layout","agent-dag.viewport"];function ni(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function J4(e,t=Q4){let n=null;try{n=e.getItem(Bk)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const a of Z4)try{e.getItem(a)!==null&&(e.removeItem(a),s.push(a))}catch{}try{e.setItem(Bk,t)}catch{}return s}const Ut="ccdeck";function GT(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 mw(e){return GT(Math.floor(e/1e3))}function VT(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),a=Math.floor(n%86400/3600),i=Math.floor(n%3600/60);return s>0?`${s}d ${a}h`:a>0?`${a}h ${i}m`:`${i}m`}function eD(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function tD(e,t,n){const s=new Date(e),a=mw(t-e);return{label:eD(s,new Date(t))?a:`${a} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function Ia(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function cd(e){return e==null}const gw="self";function cr(e,t=!1){const n=Ia(e?gw:null,gw);return{disabled:t||n.disabled,"aria-busy":n.busy}}function ur(e){return cd(e?gw:null)}function nD(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function rD(e){return e==null||e==="BODY"||e==="HTML"}const YT="agent-dag.usagePeriod";function sD(){const e=ni(YT);return ld.some(t=>t.key===e)?e:"today"}function aD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(YT,e)}catch{}}const KT="agent-dag.usageSessionsOpen";function oD(){return ni(KT)==="1"}function iD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(KT,e?"1":"0")}catch{}}function Uk(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 lD(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 kf="__unknown__";function cD(e,t,n,s){const a=Math.max(0,t-s),i=Math.max(0,n-a);if(i<120)return null;const l=Math.min(100,i/n*100),d=e-l;if(Math.abs(d)<3)return{label:"on pace",color:"var(--ok)",expectedPct:l,isDeficit:!1};if(d>0){const f=100-e,p=i>0?e/i:0,h=p>0?f/p:1/0,g={label:`${Math.round(d)}% ahead`,color:"var(--warn)",expectedPct:l,isDeficit:!0};if(h<a&&h<86400){const y=Math.floor(h/3600),w=Math.floor(h%3600/60);g.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return g}return{label:`${Math.round(-d)}% reserve`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function Sa({pct:e,label:t,reset:n,resetAt:s,windowSec:a,limitReached:i,nowSec:l}){const d=Math.min(100,Math.max(0,e)),p=i||d>=90?"var(--err)":d>=70?"var(--warn)":"var(--accent)",h=d===0?"< 1%":`${d}%`,g=d===0?2:d,y=s?VT(s,l):null,w=s&&a?cD(d,s,a,l):null;return c.jsxs("div",{className:"qb-row",children:[c.jsxs("div",{className:"qb-meta",children:[c.jsxs("span",{className:"qb-label",children:[t,i&&c.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),c.jsx("span",{className:"qb-pct",style:{color:p},children:h})]}),c.jsxs("div",{className:"qb-track",children:[c.jsx("div",{className:"qb-fill",style:{width:`${g}%`,background:p,opacity:d===0?.4:1}}),w&&c.jsx("div",{className:"qb-pace-marker",style:{left:`${w.expectedPct}%`,background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})]}),c.jsxs("div",{className:"qb-reset-row",children:[y?c.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?c.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&c.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const uD=6e4;function dD(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),i=b.useRef(null),l=b.useRef(!1),d=async(p=!1)=>{if(!(p&&!ur(l.current))){p&&(l.current=!0,a(!0));try{const g=await fetch(p?"/api/quota?refresh=1":"/api/quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,a(!1))}}};return b.useEffect(()=>{if(e)return d(!0),i.current=window.setInterval(()=>d(!1),uD),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&d(!0)}}}function hD(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 fD(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 XT=6e4,Wk=6e4;function pD(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),i=b.useRef(null),l=b.useRef(!1),d=async(p=!1)=>{if(!(p&&!ur(l.current))){p&&(l.current=!0,a(!0));try{const g=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,a(!1))}}};return b.useEffect(()=>{if(e)return d(!0),i.current=window.setInterval(()=>d(!1),XT),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&d(!0)}}}function mD(e){const[t,n]=b.useState(null),s=b.useRef(null),a=async()=>{try{const i=await fetch("/api/codex-usage");i.ok&&n(await i.json())}catch{}};return b.useEffect(()=>{if(e)return a(),s.current=window.setInterval(a,XT),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function gD(e,t,n){const[s,a]=b.useState(null),[i,l]=b.useState(!1),[d,f]=b.useState(0),p=b.useRef(0);b.useEffect(()=>{const g=()=>document.visibilityState==="visible",y=()=>{g()&&f(k=>k+1)},w=window.setInterval(y,Wk),N=()=>{g()&&Date.now()-p.current>=Wk&&f(k=>k+1)};return document.addEventListener("visibilitychange",N),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",N)}},[]);const h=b.useRef(t);return b.useEffect(()=>{let g=!0;const y=t!==h.current;h.current=t;const w=e,N=V4(w);return l(!0),fetch(`/api/ccusage?since=${N}${y?"&refresh=1":""}`).then(k=>k.ok?k.json():null).then(k=>{!g||!(k!=null&&k.ok)||(p.current=Date.now(),a({period:w,data:k,baseline:n()}))}).catch(()=>{}).finally(()=>{g&&l(!1)}),()=>{g=!1}},[e,t,d]),{...K4(s,e),loading:i}}function ul(e){const[t,n]=b.useState(e),s=b.useRef(e),a=b.useRef(!0);return b.useEffect(()=>{s.current=t},[t]),b.useEffect(()=>{if(a.current){a.current=!1,s.current=e,n(e);return}return W4(s.current,e,l=>{s.current=l,n(l)})},[e]),t}function yD({state:e,now:t,providers:n,onClose:s}){var at,Ye;const{quota:a,loading:i,refresh:l}=dD(n.claude),{data:d,loading:f,refresh:p}=pD(n.codex),{data:h}=mD(n.codex),[g,y]=b.useState(()=>Math.floor(Date.now()/1e3));b.useEffect(()=>{const pe=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(pe)},[]);const{byModel:w,totalCost:N,totalTokens:k,burnRate:E}=b.useMemo(()=>{const pe=new Map;for(const se of e.agents.values())for(const Se of Bl(se)){const De=Se.model??kf,_e=Vw(Se.usage,Se.model),Be=pe.get(De);Be?(Be.inputTokens+=Se.usage.inputTokens,Be.outputTokens+=Se.usage.outputTokens,Be.cacheReadTokens+=Se.usage.cacheReadTokens,Be.cacheCreateTokens+=Se.usage.cacheCreateTokens,Be.cost.total+=_e.total,Be.cost.input+=_e.input,Be.cost.output+=_e.output,Be.cost.cacheRead+=_e.cacheRead,Be.cost.cacheWrite+=_e.cacheWrite,Be.agentCount++):pe.set(De,{model:De,inputTokens:Se.usage.inputTokens,outputTokens:Se.usage.outputTokens,cacheReadTokens:Se.usage.cacheReadTokens,cacheCreateTokens:Se.usage.cacheCreateTokens,cost:{..._e},agentCount:1,priced:ti(Se.model)!=null})}const we=Array.from(pe.values()).sort((se,Se)=>Se.cost.total-se.cost.total||Se.inputTokens+Se.outputTokens-(se.inputTokens+se.outputTokens));let Pe=0,Ue=0;for(const se of e.agents.values()){if(se.state!=="active")continue;const Se=An(se);Pe+=Se.total,Ue=Math.max(Ue,((se.endedAt??t)-se.startedAt)/1e3)}const ot=Ue>0?Yw(Pe,Ue):null,$e=$4(e.agents.values());return{byModel:we,totalCost:$e.cost,totalTokens:$e,burnRate:ot}},[e,e.revision,t]),_=b.useMemo(()=>{const pe=[];for(const we of e.agents.values()){if(we.kind!=="root")continue;let Pe=An(we).total,Ue=we.usage.inputTokens,ot=we.usage.outputTokens,$e=uw(we);for(const se of e.agents.values())se.sessionId!==we.sessionId||se.kind==="root"||(Pe+=An(se).total,Ue+=se.usage.inputTokens,ot+=se.usage.outputTokens,$e+=uw(se));pe.push({sessionId:we.sessionId,label:we.label||we.cwdBasename||"session",state:we.state,cost:Pe,inputTokens:Ue,outputTokens:ot,unpricedTokens:$e})}return pe.sort((we,Pe)=>Pe.cost-we.cost||Pe.inputTokens+Pe.outputTokens-(we.inputTokens+we.outputTokens)).slice(0,12)},[e,e.revision]),[S,j]=b.useState(sD);b.useEffect(()=>{aD(S)},[S]);const[C,M]=b.useState(oD);b.useEffect(()=>{iD(C)},[C]);const $=b.useRef([]),[I,z]=b.useState(0),O=b.useRef(()=>new Map);O.current=()=>Fk(e.agents.values(),t);const A=b.useCallback(()=>O.current(),[]),{data:D,shown:H,stale:X,loading:R,baseline:Z}=gD(S,I,A),B=D!=null,Q=R&&X,P=b.useMemo(()=>{const pe=new Map;for(const we of e.agents.values()){if(we.kind!=="root"||!we.sessionId)continue;const Pe=we.label||we.cwdBasename;Pe&&pe.set(we.sessionId,Pe)}return pe},[e,e.revision]),F=b.useMemo(()=>{const pe=new Map;for(const we of e.agents.values())we.kind!=="root"||!we.sessionId||pe.set(we.sessionId,we.state);return pe},[e,e.revision]),J=b.useMemo(()=>B?WT(D):[],[D,B]),L=b.useMemo(()=>{if(!B)return[];const pe=Y4(D,P).slice(0,12),we=new Map;for(const Pe of pe)Pe.label&&we.set(Pe.label,(we.get(Pe.label)??0)+1);return pe.map(Pe=>Pe.label&&(we.get(Pe.label)??0)>1?{...Pe,label:`${Pe.label} ${Pe.sessionId.slice(0,4)}`}:Pe)},[D,B,P]),K=b.useMemo(()=>HT(D),[D]),ue=zk(H,S),G=X?" up-stale":"",U=b.useMemo(()=>B?H4(Z,Fk(e.agents.values(),t)):fw,[e,e.revision,Z,B,t]),ee=X4(D,{...k,cost:N},U),Y=ee.hasCost,le=ee.tokenSum,fe=ul(ee.cost),me=ul(ee.inputTokens),ke=ul(ee.outputTokens),Ve=ul(ee.cacheReadTokens),Le=ul(ee.cacheCreateTokens),qe=w.filter(pe=>pe.cost.total>0||pe.inputTokens+pe.outputTokens>0),Ne=_.filter(pe=>pe.cost>0||pe.inputTokens+pe.outputTokens>0),Ge=B?J.some(pe=>pe.cost<=0&&pe.tokens>0):qe.some(pe=>!pe.priced),be=i||f,re=Uk(a==null?void 0:a.fetchedAt,g),Qe=Uk(d==null?void 0:d.fetchedAt,g),ft=()=>{l(),p(),z(pe=>pe+1)},ut=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return c.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[c.jsxs("div",{className:"up-header",children:[c.jsx("h2",{children:"Usage"}),E&&c.jsx("span",{className:"up-rate",children:E}),c.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&c.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:ft,...cr(be),"aria-label":ut,title:ut,children:be?"…":"↻"}),c.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:s,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&c.jsxs("section",{className:"up-section up-quota-section",children:[c.jsxs("h3",{className:"up-section-title",children:["Claude quota",re&&!i&&c.jsx("span",{className:"up-section-age",title:lD(a==null?void 0:a.source),children:re})]}),a!=null&&a.ok?c.jsxs("div",{className:"up-quota-bars",children:[a.session5hPct!=null&&c.jsx(Sa,{label:"5-hour window",pct:a.session5hPct,reset:a.session5hReset,resetAt:a.session5hResetAt,windowSec:a.session5hWindowSec,nowSec:g}),a.week7dPct!=null&&c.jsx(Sa,{label:"7-day window",pct:a.week7dPct,reset:a.week7dReset,resetAt:a.week7dResetAt,windowSec:a.week7dWindowSec,nowSec:g}),a.weekSonnetPct!=null&&c.jsx(Sa,{label:"Sonnet (7d)",pct:a.weekSonnetPct,nowSec:g}),a.weekOpusPct!=null&&c.jsx(Sa,{label:"Opus (7d)",pct:a.weekOpusPct,nowSec:g})]}):(a==null?void 0:a.ok)===!1?c.jsxs("div",{className:"up-quota-na",children:[c.jsx("span",{children:a.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),c.jsx("span",{className:"up-quota-hint",children:hD(a.reason)})]}):c.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&c.jsxs("section",{className:"up-section up-quota-section",children:[c.jsxs("h3",{className:"up-section-title",children:["Codex quota",(d==null?void 0:d.ok)&&d.planLabel&&c.jsx("span",{className:"up-plan-badge",children:d.planLabel}),Qe&&!f&&c.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:Qe})]}),d!=null&&d.ok?c.jsxs("div",{className:"up-quota-bars",children:[(at=d.windows)==null?void 0:at.map(pe=>c.jsx(Sa,{label:pe.label,pct:pe.pct,reset:pe.reset??void 0,resetAt:pe.resetAt??void 0,windowSec:pe.windowSec??void 0,limitReached:d.limitReached&&pe.pct>=100,nowSec:g},pe.id)),(Ye=d.extraWindows)==null?void 0:Ye.map(pe=>c.jsx(Sa,{label:pe.label,pct:pe.pct,reset:pe.reset??void 0,resetAt:pe.resetAt??void 0,windowSec:pe.windowSec??void 0,nowSec:g},pe.id)),d.creditLimit&&c.jsx(Sa,{label:`spend cap · $${Math.round(d.creditLimit.used)} of $${Math.round(d.creditLimit.limit)}`,pct:d.creditLimit.usedPct,reset:d.creditLimit.reset??void 0,resetAt:d.creditLimit.resetAt??void 0,limitReached:d.spendControlReached,nowSec:g}),d.creditsBalance&&!d.creditsUnlimited&&c.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",d.creditsBalance,d.overageReached&&" · overage limit reached"]}),d.creditsUnlimited&&c.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),d.resetCredits&&d.resetCredits.availableCount>0&&c.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Ut} only reports them`,children:[d.resetCredits.availableCount," rate-limit reset",d.resetCredits.availableCount!==1?"s":""," available",d.resetCredits.nextExpiryAt&&` · expires ${new Date(d.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),d.promo&&c.jsx("div",{className:"up-quota-sub",children:d.promo}),d.partial&&c.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(d==null?void 0:d.ok)===!1?c.jsxs("div",{className:"up-quota-na",children:[c.jsx("span",{children:"Quota unavailable."}),c.jsx("span",{className:"up-quota-hint",children:fD(d.reason)})]}):c.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(h==null?void 0:h.ok)&&h.window7d&&h.window7d.sessionCount>0&&c.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${h.window5h?`
|
|
75
|
-
last 5h: ${At(h.window5h.totalTokens)} tokens · ${h.window5h.sessionCount} session${h.window5h.sessionCount!==1?"s":""}`:""}`,children:[At(h.window7d.totalTokens)," tokens · ",h.window7d.sessionCount," session",h.window7d.sessionCount!==1?"s":""," (7d)"]})]}),B&&c.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":Q||void 0,onKeyDown:pe=>{var Ue;const we=$.current.indexOf(pe.target);if(we<0)return;const Pe=
|
|
73
|
+
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,UT="session spend";function Zw({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(i,l,d)=>{if(i<=0)return null;const f=i/n*100;return c.jsx("span",{className:`cb-seg ${l}`,style:{width:`${f}%`},title:`${d}: ${Je(i)} (${f.toFixed(0)}%)`},l)},a=t==="lg";return c.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 D4({state:e,sessionId:t,onClose:n}){const s=b.useMemo(()=>q4(e,t),[e,t]),a=b.useRef(null),i=tn(n,{focusRef:a});return s?c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:i,className:"modal session-summary",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[c.jsxs("div",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),c.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),c.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),c.jsxs("div",{className:"modal-actions",children:[c.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),c.jsx("button",{type:"button",ref:a,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),c.jsxs("div",{className:"modal-body",children:[c.jsxs("section",{className:"ss-hero",children:[c.jsxs("div",{className:"ss-hero-left",children:[c.jsx("div",{className:"ss-cost-label",children:UT}),c.jsx("div",{className:"ss-cost",children:Je(s.cost.total)}),s.modelChips.length>0&&c.jsx("div",{className:"ss-models",children:s.modelChips.map(l=>c.jsx("span",{className:"model-chip","data-family":od(l),title:l,children:Fs(l)},l))})]}),c.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&c.jsxs(c.Fragment,{children:[c.jsx(Zw,{cost:s.cost,size:"lg"}),c.jsxs("div",{className:"ss-cost-legend",children:[c.jsxs("span",{className:"ssl ssl-in",children:["input ",c.jsx("b",{children:Je(s.cost.input)})]}),c.jsxs("span",{className:"ssl ssl-out",children:["output ",c.jsx("b",{children:Je(s.cost.output)})]}),c.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",c.jsx("b",{children:Je(s.cost.cacheRead)})]}),c.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",c.jsx("b",{children:Je(s.cost.cacheWrite)})]})]})]})})]}),c.jsxs("section",{className:"ss-stats",children:[c.jsx($o,{label:"agents",value:s.agentCount}),c.jsx($o,{label:"subagents",value:s.subagentCount}),c.jsx($o,{label:"tool calls",value:s.toolCount}),c.jsx($o,{label:"prompts",value:s.promptCount}),c.jsx($o,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&c.jsx($o,{label:"errors",value:s.errCount,tone:"err"})]}),s.topTools.length>0&&c.jsxs("section",{className:"modal-section",children:[c.jsx("h4",{children:"Most-used tools"}),c.jsx("div",{className:"ss-top-tools",children:s.topTools.map(([l,d])=>c.jsxs("div",{className:"ss-tt",children:[c.jsx("span",{className:"ss-tt-name",children:l}),c.jsx("span",{className:"ss-tt-bar",children:c.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${d/s.topTools[0][1]*100}%`}})}),c.jsx("span",{className:"ss-tt-count",children:d})]},l))})]}),s.firstPrompt&&c.jsxs("section",{className:"modal-section",children:[c.jsx("h4",{children:"Opening prompt"}),c.jsx("div",{className:"ss-prompt",children:s.firstPrompt})]})]})]})}):null}function $o({label:e,value:t,tone:n}){return c.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[c.jsx("div",{className:"ss-stat-value",children:t}),c.jsx("div",{className:"ss-stat-label",children:e})]})}function q4(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const j of e.agents.values())j.sessionId===t&&s.push(j);if(s.length===0)return null;const a={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},i=new Set,l=new Map;let d=0,f=0,p=0,h=0,g=0,y,w=1/0,N=0;for(const j of s){const C=An(j);a.input+=C.input,a.output+=C.output,a.cacheRead+=C.cacheRead,a.cacheWrite+=C.cacheWrite,a.total+=C.total;for(const M of AT(j))i.add(M);j.model&&i.add(j.model),j.kind==="subagent"&&g++,f+=j.prompts.length,!y&&j.prompts.length>0&&(y=j.prompts[0].text),p+=j.usage.inputTokens+j.usage.outputTokens,d+=j.toolCount,w=Math.min(w,j.startedAt),N=Math.max(N,j.endedAt??Date.now());for(const M of j.tools)l.set(M.name,(l.get(M.name)??0)+1),M.ok===!1&&h++}const k=Math.max(0,N-w),E=Math.floor(k/1e3),_=E<60?`${E}s`:E<3600?`${Math.floor(E/60)}m ${String(E%60).padStart(2,"0")}s`:`${Math.floor(E/3600)}h ${Math.floor(E%3600/60)}m`,S=Array.from(l.entries()).sort((j,C)=>C[1]-j[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:_,cost:a,modelChips:Array.from(i),agentCount:s.length,subagentCount:g,toolCount:d,promptCount:f,tokensSum:p,errCount:h,topTools:S,firstPrompt:y}}function qk(e){return e.waiting?Ul(e.waiting)?0:1:e.state==="active"?2:3}function F4(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let a=s.toolCount,i=An(s).total,l=s.endedAt??s.startedAt;for(const d of e.agents.values()){if(d.sessionId!==s.sessionId||d.kind==="root")continue;a+=d.toolCount,i+=An(d).total;const f=d.endedAt??d.startedAt;f>l&&(l=f)}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:i,startedAt:s.startedAt,lastActivity:l})}return n.sort((s,a)=>{const i=qk(s),l=qk(a);return i!==l?i-l:s.waiting&&a.waiting?s.waiting.since-a.waiting.since:a.lastActivity-s.lastActivity}),n}function Fk(e,t,n){const s=(t??n)-e;if(s<1e3)return"<1s";const a=Math.floor(s/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60);return i<60?`${i}m`:`${Math.floor(i/60)}h ${i%60}m`}function z4({state:e,now:t,selectedIds:n,onSelect:s,onClose:a}){const i=b.useMemo(()=>F4(e),[e,e.revision,t]),l=i.filter(f=>f.state==="active").length,d=i.filter(f=>Ul(f.waiting)).length;return c.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[c.jsxs("div",{className:"sl-header",children:[c.jsxs("h2",{children:["Sessions ",c.jsx("span",{className:"sl-count",children:i.length})]}),d>0&&c.jsxs("span",{className:"sl-waiting-count",children:[d," waiting"]}),l>0&&c.jsxs("span",{className:"sl-live-count",children:[l," live"]}),c.jsx("button",{className:"glyph-btn sl-close",onClick:a,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),c.jsxs("div",{className:"sl-rows",children:[i.length===0&&c.jsx("div",{className:"sl-empty",children:"No sessions yet."}),i.map(f=>{const p=n.has(f.sessionId);return c.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}`,onClick:()=>s(f.sessionId),title:`Focus ${f.label}`,children:[c.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),c.jsx("span",{className:"vis-hidden",children:Gu(f.state)}),c.jsxs("div",{className:"sl-row-body",children:[c.jsxs("div",{className:"sl-row-head",children:[c.jsx("span",{className:"sl-label",children:f.label}),f.modelId&&c.jsx("span",{className:"model-chip","data-family":od(f.modelId),title:f.modelId,children:Fs(f.modelId)})]}),c.jsxs("div",{className:"sl-row-meta",children:[c.jsxs("span",{title:"tool calls",children:[c.jsx("b",{children:f.toolCount})," tools"]}),f.cost>0&&c.jsx("span",{className:"sl-cost",title:UT,children:c.jsx("b",{children:Je(f.cost)})}),f.waiting?c.jsxs("span",{className:"sl-waiting",title:[Tl(f.waiting),q3(f.waiting,Tl(f.waiting)),`Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
74
|
+
`),children:["waiting ",Fk(f.waiting.since,void 0,t),f.waiting.tool&&c.jsxs("span",{className:"sl-waiting-tool",children:[" · ",f.waiting.tool.name]})]}):c.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:Fk(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]})]})]},f.sessionId)})]})]})}const B4=e=>1-Math.pow(1-e,5),WT=420;function U4(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 W4(e,t,n,s=WT){return n>=s?t:n<=0?e:e+(t-e)*B4(n/s)}function H4(e,t,n,s={}){const a=s.now??(()=>performance.now()),i=s.raf??(w=>requestAnimationFrame(w)),l=s.cancel??(w=>cancelAnimationFrame(w)),d=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),f=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(d()||f()||!U4(e,t))return n(t),()=>{};const p=a();let h=0,g=!0;const y=()=>{if(!g)return;const w=a()-p;n(W4(e,t,w)),w<WT&&(h=i(y))};return h=i(y),()=>{g=!1,h&&l(h)}}const fw={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function zk(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 G4(e,t){if(!e)return fw;const n={...fw};for(const[s,a]of t){const i=e.get(s);if(!i)continue;const l={cost:a.cost-i.cost,inputTokens:a.inputTokens-i.inputTokens,outputTokens:a.outputTokens-i.outputTokens,cacheReadTokens:a.cacheReadTokens-i.cacheReadTokens,cacheCreateTokens:a.cacheCreateTokens-i.cacheCreateTokens};l.cost<0||l.inputTokens<0||l.outputTokens<0||l.cost===0&&l.inputTokens===0&&l.outputTokens===0&&l.cacheReadTokens===0&&l.cacheCreateTokens===0||(n.cost+=l.cost,n.inputTokens+=Math.max(0,l.inputTokens),n.outputTokens+=Math.max(0,l.outputTokens),n.cacheReadTokens+=Math.max(0,l.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,l.cacheCreateTokens),n.sessions+=1)}return n}function pw(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const ld=[{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 V4(e,t,n=ld.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 Y4(e,t=new Date){return e==="today"?pw(1,t):e==="month"?pw(t.getDate(),t):"20200101"}const Rn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Ru=e=>typeof e=="string"?e:"";function HT(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const s of t){const a=Array.isArray(s==null?void 0:s.modelBreakdowns)?s.modelBreakdowns:[];for(const i of a){const l=Ru(i==null?void 0:i.modelName);if(!l)continue;let d=n.get(l);d||(d={model:l,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(l,d)),d.cost+=Rn(i==null?void 0:i.cost),d.inputTokens+=Rn(i==null?void 0:i.inputTokens),d.outputTokens+=Rn(i==null?void 0:i.outputTokens),d.cacheReadTokens+=Rn(i==null?void 0:i.cacheReadTokens),d.cacheCreateTokens+=Rn(i==null?void 0:i.cacheCreationTokens)}}return[...n.values()].sort((s,a)=>a.cost-s.cost||a.tokens-s.tokens)}function K4(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const a of n){const i=Ru(a==null?void 0:a.period);if(!i)continue;const l=a==null?void 0:a.metadata,d=typeof(l==null?void 0:l.lastActivity)=="string"?Date.parse(l.lastActivity):NaN;s.push({sessionId:i,label:t.get(i)??null,agent:Ru(a==null?void 0:a.agent)||"claude",cost:Rn(a==null?void 0:a.totalCost),tokens:Rn(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(Ru).filter(Boolean):[],lastActivityMs:Number.isFinite(d)?d:null})}return s.sort((a,i)=>i.cost-a.cost||i.tokens-a.tokens)}function GT(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=Rn(t.cacheReadTokens),p=Rn(t.cacheCreationTokens),h=Rn(t.inputTokens),g=Rn(t.outputTokens);return{cost:Rn(t.totalCost),inputTokens:h,outputTokens:g,cacheReadTokens:f,cacheCreateTokens:p,tokens:Rn(t.totalTokens)||h+g+f+p}}const n=HT(e),s=f=>n.reduce((p,h)=>p+f(h),0),a=s(f=>f.inputTokens),i=s(f=>f.outputTokens),l=s(f=>f.cacheReadTokens),d=s(f=>f.cacheCreateTokens);return{cost:s(f=>f.cost),inputTokens:a,outputTokens:i,cacheReadTokens:l,cacheCreateTokens:d,tokens:a+i+l+d}}function X4(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 Bk(e,t){var n;return((n=ld.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function Q4(e,t,n){const s=e!=null,a=GT(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 Z4="1",Uk="agent-dag.schema",J4=["agent-dag.layout","agent-dag.viewport"];function ni(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function eD(e,t=Z4){let n=null;try{n=e.getItem(Uk)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const a of J4)try{e.getItem(a)!==null&&(e.removeItem(a),s.push(a))}catch{}try{e.setItem(Uk,t)}catch{}return s}const Ut="ccdeck";function VT(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 mw(e){return VT(Math.floor(e/1e3))}function YT(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),a=Math.floor(n%86400/3600),i=Math.floor(n%3600/60);return s>0?`${s}d ${a}h`:a>0?`${a}h ${i}m`:`${i}m`}function tD(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function nD(e,t,n){const s=new Date(e),a=mw(t-e);return{label:tD(s,new Date(t))?a:`${a} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function Ia(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function cd(e){return e==null}const gw="self";function cr(e,t=!1){const n=Ia(e?gw:null,gw);return{disabled:t||n.disabled,"aria-busy":n.busy}}function ur(e){return cd(e?gw:null)}function rD(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function sD(e){return e==null||e==="BODY"||e==="HTML"}const KT="agent-dag.usagePeriod";function aD(){const e=ni(KT);return ld.some(t=>t.key===e)?e:"today"}function oD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(KT,e)}catch{}}const XT="agent-dag.usageSessionsOpen";function iD(){return ni(XT)==="1"}function lD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(XT,e?"1":"0")}catch{}}function Wk(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 cD(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 kf="__unknown__";function uD(e,t,n,s){const a=Math.max(0,t-s),i=Math.max(0,n-a);if(i<120)return null;const l=Math.min(100,i/n*100),d=e-l;if(Math.abs(d)<3)return{label:"on pace",color:"var(--ok)",expectedPct:l,isDeficit:!1};if(d>0){const f=100-e,p=i>0?e/i:0,h=p>0?f/p:1/0,g={label:`${Math.round(d)}% ahead`,color:"var(--warn)",expectedPct:l,isDeficit:!0};if(h<a&&h<86400){const y=Math.floor(h/3600),w=Math.floor(h%3600/60);g.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return g}return{label:`${Math.round(-d)}% reserve`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function Sa({pct:e,label:t,reset:n,resetAt:s,windowSec:a,limitReached:i,nowSec:l}){const d=Math.min(100,Math.max(0,e)),p=i||d>=90?"var(--err)":d>=70?"var(--warn)":"var(--accent)",h=d===0?"< 1%":`${d}%`,g=d===0?2:d,y=s?YT(s,l):null,w=s&&a?uD(d,s,a,l):null;return c.jsxs("div",{className:"qb-row",children:[c.jsxs("div",{className:"qb-meta",children:[c.jsxs("span",{className:"qb-label",children:[t,i&&c.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),c.jsx("span",{className:"qb-pct",style:{color:p},children:h})]}),c.jsxs("div",{className:"qb-track",children:[c.jsx("div",{className:"qb-fill",style:{width:`${g}%`,background:p,opacity:d===0?.4:1}}),w&&c.jsx("div",{className:"qb-pace-marker",style:{left:`${w.expectedPct}%`,background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})]}),c.jsxs("div",{className:"qb-reset-row",children:[y?c.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?c.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&c.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const dD=6e4;function hD(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),i=b.useRef(null),l=b.useRef(!1),d=async(p=!1)=>{if(!(p&&!ur(l.current))){p&&(l.current=!0,a(!0));try{const g=await fetch(p?"/api/quota?refresh=1":"/api/quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,a(!1))}}};return b.useEffect(()=>{if(e)return d(!0),i.current=window.setInterval(()=>d(!1),dD),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&d(!0)}}}function fD(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 pD(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 QT=6e4,Hk=6e4;function mD(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),i=b.useRef(null),l=b.useRef(!1),d=async(p=!1)=>{if(!(p&&!ur(l.current))){p&&(l.current=!0,a(!0));try{const g=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,a(!1))}}};return b.useEffect(()=>{if(e)return d(!0),i.current=window.setInterval(()=>d(!1),QT),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&d(!0)}}}function gD(e){const[t,n]=b.useState(null),s=b.useRef(null),a=async()=>{try{const i=await fetch("/api/codex-usage");i.ok&&n(await i.json())}catch{}};return b.useEffect(()=>{if(e)return a(),s.current=window.setInterval(a,QT),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function yD(e,t,n){const[s,a]=b.useState(null),[i,l]=b.useState(!1),[d,f]=b.useState(0),p=b.useRef(0);b.useEffect(()=>{const g=()=>document.visibilityState==="visible",y=()=>{g()&&f(k=>k+1)},w=window.setInterval(y,Hk),N=()=>{g()&&Date.now()-p.current>=Hk&&f(k=>k+1)};return document.addEventListener("visibilitychange",N),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",N)}},[]);const h=b.useRef(t);return b.useEffect(()=>{let g=!0;const y=t!==h.current;h.current=t;const w=e,N=Y4(w);return l(!0),fetch(`/api/ccusage?since=${N}${y?"&refresh=1":""}`).then(k=>k.ok?k.json():null).then(k=>{!g||!(k!=null&&k.ok)||(p.current=Date.now(),a({period:w,data:k,baseline:n()}))}).catch(()=>{}).finally(()=>{g&&l(!1)}),()=>{g=!1}},[e,t,d]),{...X4(s,e),loading:i}}function ul(e){const[t,n]=b.useState(e),s=b.useRef(e),a=b.useRef(!0);return b.useEffect(()=>{s.current=t},[t]),b.useEffect(()=>{if(a.current){a.current=!1,s.current=e,n(e);return}return H4(s.current,e,l=>{s.current=l,n(l)})},[e]),t}function vD({state:e,now:t,providers:n,onClose:s}){var at,Ye;const{quota:a,loading:i,refresh:l}=hD(n.claude),{data:d,loading:f,refresh:p}=mD(n.codex),{data:h}=gD(n.codex),[g,y]=b.useState(()=>Math.floor(Date.now()/1e3));b.useEffect(()=>{const pe=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(pe)},[]);const{byModel:w,totalCost:N,totalTokens:k,burnRate:E}=b.useMemo(()=>{const pe=new Map;for(const se of e.agents.values())for(const Se of Bl(se)){const De=Se.model??kf,_e=Vw(Se.usage,Se.model),Be=pe.get(De);Be?(Be.inputTokens+=Se.usage.inputTokens,Be.outputTokens+=Se.usage.outputTokens,Be.cacheReadTokens+=Se.usage.cacheReadTokens,Be.cacheCreateTokens+=Se.usage.cacheCreateTokens,Be.cost.total+=_e.total,Be.cost.input+=_e.input,Be.cost.output+=_e.output,Be.cost.cacheRead+=_e.cacheRead,Be.cost.cacheWrite+=_e.cacheWrite,Be.agentCount++):pe.set(De,{model:De,inputTokens:Se.usage.inputTokens,outputTokens:Se.usage.outputTokens,cacheReadTokens:Se.usage.cacheReadTokens,cacheCreateTokens:Se.usage.cacheCreateTokens,cost:{..._e},agentCount:1,priced:ti(Se.model)!=null})}const we=Array.from(pe.values()).sort((se,Se)=>Se.cost.total-se.cost.total||Se.inputTokens+Se.outputTokens-(se.inputTokens+se.outputTokens));let Pe=0,Ue=0;for(const se of e.agents.values()){if(se.state!=="active")continue;const Se=An(se);Pe+=Se.total,Ue=Math.max(Ue,((se.endedAt??t)-se.startedAt)/1e3)}const ot=Ue>0?Yw(Pe,Ue):null,$e=O4(e.agents.values());return{byModel:we,totalCost:$e.cost,totalTokens:$e,burnRate:ot}},[e,e.revision,t]),_=b.useMemo(()=>{const pe=[];for(const we of e.agents.values()){if(we.kind!=="root")continue;let Pe=An(we).total,Ue=we.usage.inputTokens,ot=we.usage.outputTokens,$e=uw(we);for(const se of e.agents.values())se.sessionId!==we.sessionId||se.kind==="root"||(Pe+=An(se).total,Ue+=se.usage.inputTokens,ot+=se.usage.outputTokens,$e+=uw(se));pe.push({sessionId:we.sessionId,label:we.label||we.cwdBasename||"session",state:we.state,cost:Pe,inputTokens:Ue,outputTokens:ot,unpricedTokens:$e})}return pe.sort((we,Pe)=>Pe.cost-we.cost||Pe.inputTokens+Pe.outputTokens-(we.inputTokens+we.outputTokens)).slice(0,12)},[e,e.revision]),[S,j]=b.useState(aD);b.useEffect(()=>{oD(S)},[S]);const[C,M]=b.useState(iD);b.useEffect(()=>{lD(C)},[C]);const $=b.useRef([]),[I,z]=b.useState(0),O=b.useRef(()=>new Map);O.current=()=>zk(e.agents.values(),t);const A=b.useCallback(()=>O.current(),[]),{data:D,shown:H,stale:X,loading:R,baseline:Z}=yD(S,I,A),B=D!=null,Q=R&&X,P=b.useMemo(()=>{const pe=new Map;for(const we of e.agents.values()){if(we.kind!=="root"||!we.sessionId)continue;const Pe=we.label||we.cwdBasename;Pe&&pe.set(we.sessionId,Pe)}return pe},[e,e.revision]),F=b.useMemo(()=>{const pe=new Map;for(const we of e.agents.values())we.kind!=="root"||!we.sessionId||pe.set(we.sessionId,we.state);return pe},[e,e.revision]),J=b.useMemo(()=>B?HT(D):[],[D,B]),L=b.useMemo(()=>{if(!B)return[];const pe=K4(D,P).slice(0,12),we=new Map;for(const Pe of pe)Pe.label&&we.set(Pe.label,(we.get(Pe.label)??0)+1);return pe.map(Pe=>Pe.label&&(we.get(Pe.label)??0)>1?{...Pe,label:`${Pe.label} ${Pe.sessionId.slice(0,4)}`}:Pe)},[D,B,P]),K=b.useMemo(()=>GT(D),[D]),ue=Bk(H,S),G=X?" up-stale":"",U=b.useMemo(()=>B?G4(Z,zk(e.agents.values(),t)):fw,[e,e.revision,Z,B,t]),ee=Q4(D,{...k,cost:N},U),Y=ee.hasCost,le=ee.tokenSum,fe=ul(ee.cost),me=ul(ee.inputTokens),ke=ul(ee.outputTokens),Ve=ul(ee.cacheReadTokens),Le=ul(ee.cacheCreateTokens),qe=w.filter(pe=>pe.cost.total>0||pe.inputTokens+pe.outputTokens>0),Ne=_.filter(pe=>pe.cost>0||pe.inputTokens+pe.outputTokens>0),Ge=B?J.some(pe=>pe.cost<=0&&pe.tokens>0):qe.some(pe=>!pe.priced),be=i||f,re=Wk(a==null?void 0:a.fetchedAt,g),Qe=Wk(d==null?void 0:d.fetchedAt,g),ft=()=>{l(),p(),z(pe=>pe+1)},ut=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return c.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[c.jsxs("div",{className:"up-header",children:[c.jsx("h2",{children:"Usage"}),E&&c.jsx("span",{className:"up-rate",children:E}),c.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&c.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:ft,...cr(be),"aria-label":ut,title:ut,children:be?"…":"↻"}),c.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:s,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&c.jsxs("section",{className:"up-section up-quota-section",children:[c.jsxs("h3",{className:"up-section-title",children:["Claude quota",re&&!i&&c.jsx("span",{className:"up-section-age",title:cD(a==null?void 0:a.source),children:re})]}),a!=null&&a.ok?c.jsxs("div",{className:"up-quota-bars",children:[a.session5hPct!=null&&c.jsx(Sa,{label:"5-hour window",pct:a.session5hPct,reset:a.session5hReset,resetAt:a.session5hResetAt,windowSec:a.session5hWindowSec,nowSec:g}),a.week7dPct!=null&&c.jsx(Sa,{label:"7-day window",pct:a.week7dPct,reset:a.week7dReset,resetAt:a.week7dResetAt,windowSec:a.week7dWindowSec,nowSec:g}),a.weekSonnetPct!=null&&c.jsx(Sa,{label:"Sonnet (7d)",pct:a.weekSonnetPct,nowSec:g}),a.weekOpusPct!=null&&c.jsx(Sa,{label:"Opus (7d)",pct:a.weekOpusPct,nowSec:g})]}):(a==null?void 0:a.ok)===!1?c.jsxs("div",{className:"up-quota-na",children:[c.jsx("span",{children:a.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),c.jsx("span",{className:"up-quota-hint",children:fD(a.reason)})]}):c.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&c.jsxs("section",{className:"up-section up-quota-section",children:[c.jsxs("h3",{className:"up-section-title",children:["Codex quota",(d==null?void 0:d.ok)&&d.planLabel&&c.jsx("span",{className:"up-plan-badge",children:d.planLabel}),Qe&&!f&&c.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:Qe})]}),d!=null&&d.ok?c.jsxs("div",{className:"up-quota-bars",children:[(at=d.windows)==null?void 0:at.map(pe=>c.jsx(Sa,{label:pe.label,pct:pe.pct,reset:pe.reset??void 0,resetAt:pe.resetAt??void 0,windowSec:pe.windowSec??void 0,limitReached:d.limitReached&&pe.pct>=100,nowSec:g},pe.id)),(Ye=d.extraWindows)==null?void 0:Ye.map(pe=>c.jsx(Sa,{label:pe.label,pct:pe.pct,reset:pe.reset??void 0,resetAt:pe.resetAt??void 0,windowSec:pe.windowSec??void 0,nowSec:g},pe.id)),d.creditLimit&&c.jsx(Sa,{label:`spend cap · $${Math.round(d.creditLimit.used)} of $${Math.round(d.creditLimit.limit)}`,pct:d.creditLimit.usedPct,reset:d.creditLimit.reset??void 0,resetAt:d.creditLimit.resetAt??void 0,limitReached:d.spendControlReached,nowSec:g}),d.creditsBalance&&!d.creditsUnlimited&&c.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",d.creditsBalance,d.overageReached&&" · overage limit reached"]}),d.creditsUnlimited&&c.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),d.resetCredits&&d.resetCredits.availableCount>0&&c.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Ut} only reports them`,children:[d.resetCredits.availableCount," rate-limit reset",d.resetCredits.availableCount!==1?"s":""," available",d.resetCredits.nextExpiryAt&&` · expires ${new Date(d.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),d.promo&&c.jsx("div",{className:"up-quota-sub",children:d.promo}),d.partial&&c.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(d==null?void 0:d.ok)===!1?c.jsxs("div",{className:"up-quota-na",children:[c.jsx("span",{children:"Quota unavailable."}),c.jsx("span",{className:"up-quota-hint",children:pD(d.reason)})]}):c.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(h==null?void 0:h.ok)&&h.window7d&&h.window7d.sessionCount>0&&c.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${h.window5h?`
|
|
75
|
+
last 5h: ${At(h.window5h.totalTokens)} tokens · ${h.window5h.sessionCount} session${h.window5h.sessionCount!==1?"s":""}`:""}`,children:[At(h.window7d.totalTokens)," tokens · ",h.window7d.sessionCount," session",h.window7d.sessionCount!==1?"s":""," (7d)"]})]}),B&&c.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":Q||void 0,onKeyDown:pe=>{var Ue;const we=$.current.indexOf(pe.target);if(we<0)return;const Pe=V4(pe.key,we);Pe!==null&&(pe.preventDefault(),(Ue=$.current[Pe])==null||Ue.focus())},children:ld.map((pe,we)=>c.jsx("button",{type:"button",ref:Pe=>{$.current[we]=Pe},tabIndex:S===pe.key?0:-1,"aria-pressed":S===pe.key,"data-pending":S===pe.key&&Q?"":void 0,title:S===pe.key&&Q?`Reading ${pe.noun} from the transcripts on this machine…`:pe.hint,className:"uh-range-btn",onClick:()=>j(pe.key),children:pe.label},pe.key))}),B&&c.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Q?`Reading ${Bk(S,S)}…`:""}),le>0?c.jsxs(c.Fragment,{children:[Y&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:`up-total${G}`,title:B?void 0:Dk,children:[c.jsx("span",{className:"up-total-value",children:Je(fe)}),c.jsx("span",{className:"up-total-label",children:B?ue:P4})]}),ee.showCostBar&&c.jsx(Zw,{cost:N})]}),c.jsxs("div",{className:`up-tokens-row${G}`,title:B?void 0:Dk,children:[c.jsxs("span",{className:"up-tok",children:[c.jsx("span",{className:"up-k",children:"in"}),At(me)]}),c.jsxs("span",{className:"up-tok",children:[c.jsx("span",{className:"up-k",children:"out"}),At(ke)]}),ee.cacheReadTokens>0&&c.jsxs("span",{className:"up-tok",children:[c.jsx("span",{className:"up-k",children:"cache r"}),At(Ve)]}),ee.cacheCreateTokens>0&&c.jsxs("span",{className:"up-tok",children:[c.jsx("span",{className:"up-k",children:"cache c"}),At(Le)]}),!Y&&c.jsx("span",{className:"up-tok up-scope",children:L4})]}),(B?J.length:qe.length)>0&&c.jsxs("section",{className:`up-section${G}`,children:[c.jsx("h3",{className:"up-section-title",children:"By model"}),c.jsxs("table",{className:"up-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:"Model"}),c.jsx("th",{children:"Tokens"}),c.jsx("th",{children:"Cost"})]})}),c.jsx("tbody",{children:B?J.map(pe=>c.jsxs("tr",{children:[c.jsx("td",{className:"up-model-name",title:pe.model,children:Fs(pe.model)}),c.jsx("td",{className:"up-num",children:At(pe.tokens)}),pe.cost>0?c.jsx("td",{className:"up-num up-cost-val",children:Je(pe.cost)}):c.jsx("td",{className:"up-num up-unpriced",children:Lo})]},pe.model)):qe.map(pe=>c.jsxs("tr",{children:[c.jsx("td",{className:"up-model-name",title:pe.model===kf?"no model reported yet":pe.model,children:pe.model===kf?"unknown":Fs(pe.model)}),c.jsx("td",{className:"up-num",children:At(pe.inputTokens+pe.outputTokens)}),pe.priced?c.jsx("td",{className:"up-num up-cost-val",children:Je(pe.cost.total)}):c.jsx("td",{className:"up-num up-unpriced",children:Lo})]},pe.model))})]})]}),B&&L.length===0&&K.tokens>0&&c.jsxs("section",{className:"up-section",children:[c.jsx("h3",{className:"up-section-title",children:"By session"}),c.jsxs("div",{className:"up-hint",children:["No session is dated ",ue," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(B?L.length:Ne.length)>0&&(()=>{const pe=B?L.length:Ne.length;return c.jsxs("section",{className:`up-section${G}`,children:[c.jsx("h3",{className:"up-section-title",children:c.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":C,"aria-controls":"up-sessions",title:C?"Hide the per-session breakdown":`Show the per-session breakdown — ${pe} session${pe===1?"":"s"}`,onClick:()=>M(we=>!we),children:["By session",B&&c.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${ue}, each showing what that session has cost since it started.
|
|
76
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 ",ue]}),c.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:c.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),c.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!C,children:[B&&L.map(we=>{const Pe=F.get(we.sessionId);return c.jsxs("div",{className:"up-session-row",children:[Pe?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:`sl-dot state-${Pe}`,"aria-hidden":!0}),c.jsx("span",{className:"vis-hidden",children:Gu(Pe)})]}):c.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),c.jsx("span",{className:`up-session-label${we.label?"":" up-session-id"}`,title:we.label?`${we.label}
|
|
77
|
-
${we.sessionId}`:we.sessionId,children:we.label??we.sessionId.slice(0,8)}),c.jsx("span",{className:"up-session-tokens",children:At(we.tokens)}),we.cost>0?c.jsx("span",{className:"up-session-cost",title:we.models.join(", ")||void 0,children:Je(we.cost)}):c.jsx("span",{className:"up-session-cost up-unpriced",children:Lo})]},we.sessionId)}),!B&&Ne.map(we=>c.jsxs("div",{className:"up-session-row",children:[c.jsx("span",{className:`sl-dot state-${we.state}`,"aria-hidden":!0}),c.jsx("span",{className:"vis-hidden",children:Gu(we.state)}),c.jsx("span",{className:"up-session-label",children:we.label}),c.jsx("span",{className:"up-session-tokens",children:At(we.inputTokens+we.outputTokens)}),we.cost>0?c.jsxs("span",{className:"up-session-cost",title:we.unpricedTokens>0?`${At(we.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Je(we.cost),we.unpricedTokens>0?"+":""]}):c.jsx("span",{className:"up-session-cost up-unpriced",children:Lo})]},we.sessionId))]})]})})(),Ge&&c.jsxs("div",{className:"up-hint",children:["“",Lo,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):c.jsx("div",{className:"up-empty",children:B?c.jsxs(c.Fragment,{children:["No usage ",ue,".",c.jsx("br",{}),"Try a longer period."]}):c.jsxs(c.Fragment,{children:["No usage data yet.",c.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const Gt={l:30,r:6,t:6,b:2},$s={l:0,r:0,t:2,b:1},ud=104,vD=64;function lr(e,t=100,n=ud,s=Gt){const a=n-s.t-s.b;return s.t+a*(1-Math.max(0,Math.min(t,e))/t)}function QT(e,t,n,s=100,a=ud,i=Gt){if(!e.length)return"";const l=e[e.length-1].t-e[0].t,d=h=>{const g=t-i.l-i.r;return i.l+(l>0?g*(h-e[0].t)/l:g/2)};let f="",p=null;for(const h of e){const g=p&&h.t-p.t<=n*2?"L":"M";f+=`${g}${d(h.t).toFixed(1)} ${lr(h.v,s,a,i).toFixed(1)}`,p=h}return f}function ZT(e,t,n,s=100,a=ud,i=Gt){if(e.length<2)return"";const l=a-i.b,d=e[e.length-1].t-e[0].t,f=t-i.l-i.r,p=w=>i.l+(d>0?f*(w-e[0].t)/d:f/2);let h="",g=[];const y=()=>{if(g.length>=2){let w=`M${p(g[0].t).toFixed(1)} ${l}`;for(const N of g)w+=`L${p(N.t).toFixed(1)} ${lr(N.v,s,a,i).toFixed(1)}`;h+=`${w}L${p(g[g.length-1].t).toFixed(1)} ${l}Z`}g=[]};for(const w of e)g.length&&w.t-g[g.length-1].t>n*2&&y(),g.push(w);return y(),h}function wD(e){return e.length?{now:e[e.length-1].v,peak:e.reduce((t,n)=>Math.max(t,n.v),e[0].v)}:{now:null,peak:null}}function JT(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function xD(e,t,n=s=>xl(s)){const s=e.filter(l=>l.v>0);if(!e.length)return null;if(!s.length)return"never held back";const a=s.length*(t/6e4),i=s[s.length-1];return`held back for ${a===1?"1 minute":`${a} minutes`}, last at ${n(i.t)}`}function xl(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Jw(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 bD({group:e,title:t,onClose:n}){const s=tn(n),[a,i]=b.useState(null);b.useEffect(()=>{let p=!0;const h=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const w=await y.json();p&&(w!=null&&w.ok)&&i(w)}catch{}};h();const g=window.setInterval(h,2e4);return()=>{p=!1,window.clearInterval(g)}},[e]);const l=(a==null?void 0:a.series)??[],[d,f]=b.useMemo(()=>{let p=1/0,h=0;for(const g of l)g.points.length&&(p=Math.min(p,g.points[0].t),h=Math.max(h,g.points[g.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(a==null?void 0:a.sinceMs)??0):(a==null?void 0:a.sinceMs)??0,h]},[l,a==null?void 0:a.sinceMs]);return Iw.createPortal(c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[c.jsxs("div",{className:"modal-head",children:[c.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),a&&d>0&&c.jsxs("span",{className:"hist-since",children:["since ",xl(d)," · ",Jw(d,f||Date.now())]}),c.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),c.jsx("div",{className:"hist-body",children:a==null?c.jsx("p",{className:"hist-empty",children:"Reading…"}):l.length===0?c.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):l.map(p=>c.jsx(kD,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function kD({series:e,stepMs:t}){const n=b.useRef(null),[s,a]=b.useState(560),[i,l]=b.useState(null);b.useEffect(()=>{const I=n.current;if(!I||typeof ResizeObserver>"u")return;const z=new ResizeObserver(([O])=>a(Math.max(160,O.contentRect.width)));return z.observe(I),()=>z.disconnect()},[]);const{points:d,unit:f,warnAt:p,critAt:h,label:g,top:y,restsAtZero:w}=e,N=w?vD:ud,{now:k,peak:E}=wD(d),_=f==="C"?"°C":f,S=g==="Throttling"?xD(d,t):null,j=i!=null?d[i]:null,C=d.length>1?d[d.length-1].t-d[0].t:0,M=I=>{const z=s-Gt.l-Gt.r;return Gt.l+(C>0?z*(I-d[0].t)/C:z/2)},$=I=>{if(d.length<2)return;const z=I.currentTarget.getBoundingClientRect(),O=(I.clientX-z.left-Gt.l)/Math.max(1,z.width-Gt.l-Gt.r),A=d[0].t+C*Math.max(0,Math.min(1,O));let D=0;for(let H=1;H<d.length;H++)Math.abs(d[H].t-A)<Math.abs(d[D].t-A)&&(D=H);l(D)};return c.jsxs("section",{className:"hist-series","aria-label":`${g} history`,children:[c.jsxs("div",{className:"hist-head",children:[c.jsx("span",{className:"hist-label",children:g}),c.jsxs("span",{className:"hist-stats",children:[k!=null&&c.jsxs(c.Fragment,{children:[c.jsx("b",{children:k}),c.jsxs("span",{children:[_," now"]})]}),E!=null&&c.jsxs(c.Fragment,{children:[c.jsx("b",{className:JT(E,p,h),children:E}),c.jsxs("span",{children:[_," peak"]})]})]})]}),c.jsx("div",{className:"hist-plot",ref:n,children:c.jsxs("svg",{className:"hist-chart",width:"100%",height:N,viewBox:`0 0 ${s} ${N}`,preserveAspectRatio:"none",role:"img","aria-label":k==null?`${g}: nothing measured yet`:`${g}: ${k}${_} now, peak ${E}${_}, over ${Jw(d[0].t,d[d.length-1].t)}`,onPointerMove:$,onPointerLeave:()=>l(null),children:[[["warn",p],["hot",h]].map(([I,z])=>z==null||z>y?null:c.jsxs("g",{children:[c.jsx("line",{className:`hist-rule ${I}`,x1:Gt.l,x2:s-Gt.r,y1:lr(z,y,N),y2:lr(z,y,N)}),c.jsx("text",{className:`hist-rule-tag ${I}`,x:2,y:lr(z,y,N)+3,children:z})]},I)),c.jsx("line",{className:"hist-floor",x1:Gt.l,x2:s-Gt.r,y1:N-Gt.b,y2:N-Gt.b}),c.jsx("path",{className:"hist-area",d:ZT(d,s,t,y,N)}),c.jsx("path",{className:"hist-line",d:QT(d,s,t,y,N)}),d.length===1&&c.jsx("circle",{className:"hist-dot",cx:M(d[0].t),cy:lr(d[0].v,y,N),r:3}),j&&c.jsxs("g",{children:[c.jsx("line",{className:"hist-cross",x1:M(j.t),x2:M(j.t),y1:Gt.t,y2:N-Gt.b}),c.jsx("circle",{className:"hist-dot",cx:M(j.t),cy:lr(j.v,y,N),r:3})]})]})}),c.jsx("div",{className:"hist-axis",children:j?c.jsxs("span",{className:"hist-at",children:[xl(j.t)," — ",c.jsx("b",{children:j.v}),_]}):c.jsxs(c.Fragment,{children:[c.jsx("span",{children:d.length?xl(d[0].t):""}),c.jsx("span",{children:d.length?xl(d[d.length-1].t):""})]})}),S&&c.jsx("div",{className:"hist-note",children:S})]})}const _D="thermal:Throttling";function SD(e){var n,s,a,i;const t={};e.cpu!=null&&(t["cpu:all"]=e.cpu),(n=e.perCore)!=null&&n.length&&(t["cpu:busiest"]=Math.max(...e.perCore)),e.memory&&(t["mem:physical"]=e.memory.usedPct),e.swap&&e.swap.total>0&&(t["mem:swap"]=Math.round(e.swap.used/e.swap.total*1e3)/10),(s=e.loadavg)!=null&&s.length&&(t["load:1m"]=e.loadavg[0]);for(const l of((a=e.thermal)==null?void 0:a.celsius)??[])t[`thermal:${l.label}`]=l.celsius;return(i=e.thermal)!=null&&i.throttle&&(t[_D]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function Au(e,t){return t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function gu(e,t){return Number.isInteger(e)?t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`:Au(e,t)}const Hk=["cores","memory","load","thermal"],Na=116,Nr=24,ND=60,ED=6e4;function jD(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function CD(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function TD(e,t=ND){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function RD({sys:e}){const[t,n]=b.useState({});b.useEffect(()=>{let l=!0;const d=async()=>{const p=await Promise.all(Hk.map(async h=>{try{const g=await fetch(`/api/system/history?group=${h}`);return g.ok?[h,await g.json()]:[h,null]}catch{return[h,null]}}));l&&n(h=>{const g={...h};for(const[y,w]of p)w!=null&&w.ok&&(g[y]=w);return g})};d();const f=setInterval(()=>void d(),ED);return()=>{l=!1,clearInterval(f)}},[]);const s=b.useMemo(()=>SD(e),[e]),a=b.useMemo(()=>Hk.flatMap(l=>{const d=t[l];return d?d.series.filter(jD).map(f=>({series:TD(f),stepMs:d.stepMs})):[]}),[t]),i=b.useMemo(()=>{let l=1/0,d=-1/0;for(const{series:f}of a){const p=f.points;p.length&&(l=Math.min(l,p[0].t),d=Math.max(d,p[p.length-1].t))}return Number.isFinite(l)?Jw(l,d):"less than a minute"},[a]);return Object.keys(s).length?c.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${i}`,children:a.map(({series:l,stepMs:d})=>c.jsx(AD,{series:l,stepMs:d,now:s[l.key],span:i},l.key))}):null}function AD({series:e,stepMs:t,now:n,span:s}){var w;const{points:a,top:i,unit:l,warnAt:d,critAt:f}=e,p=CD(e),h=n??((w=a[a.length-1])==null?void 0:w.v),g=h==null?"":JT(h,d,f),y=Math.max(...a.map(N=>N.v));return c.jsxs("div",{className:`pl-cell${g?` ${g}`:""}`,title:[`${p} · peak ${Au(y,l)} over the last ${s}`,d!=null?`over ${gu(d,l)} is uncomfortable`:"",f!=null?`over ${gu(f,l)} the machine acts`:""].filter(Boolean).join(" · "),children:[c.jsxs("div",{className:"pl-cell-head",children:[c.jsx("span",{className:"pl-cell-label",children:p}),c.jsx("span",{className:"pl-cell-now",children:h==null?"—":Au(h,l)})]}),c.jsxs("svg",{className:"pl-spark",width:Na,height:Nr,viewBox:`0 0 ${Na} ${Nr}`,preserveAspectRatio:"none","aria-hidden":!0,children:[c.jsx("line",{className:"pl-spark-floor",x1:0,x2:Na,y1:Nr-$s.b,y2:Nr-$s.b}),c.jsx("path",{className:"pl-spark-area",d:ZT(a,Na,t,i,Nr,$s)}),d!=null&&c.jsx("line",{className:"pl-rule warn",x1:0,x2:Na,y1:lr(d,i,Nr,$s),y2:lr(d,i,Nr,$s)}),f!=null&&c.jsx("line",{className:"pl-rule hot",x1:0,x2:Na,y1:lr(f,i,Nr,$s),y2:lr(f,i,Nr,$s)}),c.jsx("path",{className:"pl-spark-line",d:QT(a,Na,t,i,Nr,$s)})]}),c.jsxs("span",{className:"vis-hidden",children:["peak ",Au(y,l)," over the last ",s,d!=null&&`, uncomfortable over ${gu(d,l)}`,f!=null&&`, the machine acts over ${gu(f,l)}`]})]})}const MD={key:"cpu",dir:"desc"};function ID(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function $D(e,t){const n=t.dir==="asc"?1:-1,s=i=>t.key==="cpu"?i.cpu:t.key==="mem"?i.mem:t.key==="rss"?i.rssBytes:t.key==="threads"?i.threads:i.uptimeSec,a=(i,l)=>{if(t.key==="name")return n*i.name.localeCompare(l.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=i.user??"",h=l.user??"";return!p||!h?p===h?0:p?-1:1:n*p.localeCompare(h,void 0,{sensitivity:"base"})}const d=s(i),f=s(l);return d==null||f==null?d==null?f==null?0:1:-1:n*(d-f)};return[...e].sort((i,l)=>a(i,l)||(l.cpu??-1)-(i.cpu??-1)||l.mem-i.mem||i.pid-l.pid)}function OD(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const PD=4e3;function LD(){const[e,t]=b.useState(null);return b.useEffect(()=>{let n=!0;const s=async()=>{if(document.visibilityState!=="hidden")try{const i=await fetch("/api/system/processes?detail=1");if(!i.ok)return;const l=await i.json();n&&(l!=null&&l.ok)&&t({procs:l.procs??[],total:l.total??0})}catch{}};s();const a=window.setInterval(s,PD);return()=>{n=!1,window.clearInterval(a)}},[]),e}function DD(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 qD(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 FD({sys:e,onClose:t}){const n=tn(t),[s,a]=b.useState(MD),i=LD(),l=i?$D(i.procs,s):null;return Iw.createPortal(c.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:c.jsxs("div",{ref:n,className:"modal pl-modal",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[c.jsxs("div",{className:"modal-head",children:[c.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),i&&c.jsxs("span",{className:"pl-count",children:[l.length," of ",i.total," running"]}),c.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),c.jsxs("div",{className:"pl-split",children:[c.jsx("div",{className:"pl-body",children:l==null?c.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):l.length===0?c.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):c.jsxs("table",{className:"sd-procs pl-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx(Oo,{col:"cpu",label:"cpu",sort:s,onSort:a}),c.jsx(Oo,{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}),c.jsx(Oo,{col:"threads",label:"threads",sort:s,onSort:a}),c.jsx(Oo,{col:"uptime",label:"up",sort:s,onSort:a}),c.jsx(Oo,{col:"user",label:"user",sort:s,onSort:a}),c.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),c.jsx(Oo,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:s,onSort:a})]})}),c.jsx("tbody",{children:l.map(d=>c.jsxs("tr",{children:[c.jsx("td",{className:"sd-num",children:d.cpu==null?"—":d.cpu.toFixed(0)}),c.jsx("td",{className:"sd-num sd-dim",title:`${d.mem.toFixed(1)}% of installed memory`,children:DD(d.rssBytes)}),c.jsx("td",{className:"sd-num sd-dim",children:d.threads??"—"}),c.jsx("td",{className:"sd-num sd-dim",children:qD(d.uptimeSec)}),c.jsx("td",{className:"sd-dim pl-user",children:d.user??"—"}),c.jsx("td",{className:"sd-num sd-dim pl-pid",children:d.pid}),c.jsxs("td",{className:"pl-name",children:[d.name,d.cmd&&c.jsxs("span",{className:"pl-cmd",title:d.cmd,children:[" ",d.cmd]})]})]},d.pid))})]})}),c.jsx(RD,{sys:e})]})]})}),document.body)}function Oo({col:e,label:t,note:n,sort:s,onSort:a}){const i=OD(s,e);return c.jsx("th",{scope:"col","aria-sort":i,children:c.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
77
|
+
${we.sessionId}`:we.sessionId,children:we.label??we.sessionId.slice(0,8)}),c.jsx("span",{className:"up-session-tokens",children:At(we.tokens)}),we.cost>0?c.jsx("span",{className:"up-session-cost",title:we.models.join(", ")||void 0,children:Je(we.cost)}):c.jsx("span",{className:"up-session-cost up-unpriced",children:Lo})]},we.sessionId)}),!B&&Ne.map(we=>c.jsxs("div",{className:"up-session-row",children:[c.jsx("span",{className:`sl-dot state-${we.state}`,"aria-hidden":!0}),c.jsx("span",{className:"vis-hidden",children:Gu(we.state)}),c.jsx("span",{className:"up-session-label",children:we.label}),c.jsx("span",{className:"up-session-tokens",children:At(we.inputTokens+we.outputTokens)}),we.cost>0?c.jsxs("span",{className:"up-session-cost",title:we.unpricedTokens>0?`${At(we.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Je(we.cost),we.unpricedTokens>0?"+":""]}):c.jsx("span",{className:"up-session-cost up-unpriced",children:Lo})]},we.sessionId))]})]})})(),Ge&&c.jsxs("div",{className:"up-hint",children:["“",Lo,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):c.jsx("div",{className:"up-empty",children:B?c.jsxs(c.Fragment,{children:["No usage ",ue,".",c.jsx("br",{}),"Try a longer period."]}):c.jsxs(c.Fragment,{children:["No usage data yet.",c.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const Gt={l:30,r:6,t:6,b:2},$s={l:0,r:0,t:2,b:1},ud=104,wD=64;function lr(e,t=100,n=ud,s=Gt){const a=n-s.t-s.b;return s.t+a*(1-Math.max(0,Math.min(t,e))/t)}function ZT(e,t,n,s=100,a=ud,i=Gt){if(!e.length)return"";const l=e[e.length-1].t-e[0].t,d=h=>{const g=t-i.l-i.r;return i.l+(l>0?g*(h-e[0].t)/l:g/2)};let f="",p=null;for(const h of e){const g=p&&h.t-p.t<=n*2?"L":"M";f+=`${g}${d(h.t).toFixed(1)} ${lr(h.v,s,a,i).toFixed(1)}`,p=h}return f}function JT(e,t,n,s=100,a=ud,i=Gt){if(e.length<2)return"";const l=a-i.b,d=e[e.length-1].t-e[0].t,f=t-i.l-i.r,p=w=>i.l+(d>0?f*(w-e[0].t)/d:f/2);let h="",g=[];const y=()=>{if(g.length>=2){let w=`M${p(g[0].t).toFixed(1)} ${l}`;for(const N of g)w+=`L${p(N.t).toFixed(1)} ${lr(N.v,s,a,i).toFixed(1)}`;h+=`${w}L${p(g[g.length-1].t).toFixed(1)} ${l}Z`}g=[]};for(const w of e)g.length&&w.t-g[g.length-1].t>n*2&&y(),g.push(w);return y(),h}function xD(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 eR(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function bD(e,t,n=s=>xl(s)){const s=e.filter(l=>l.v>0);if(!e.length)return null;if(!s.length)return"never held back";const a=s.length*(t/6e4),i=s[s.length-1];return`held back for ${a===1?"1 minute":`${a} minutes`}, last at ${n(i.t)}`}function xl(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Jw(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 kD({group:e,title:t,onClose:n}){const s=tn(n),[a,i]=b.useState(null);b.useEffect(()=>{let p=!0;const h=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const w=await y.json();p&&(w!=null&&w.ok)&&i(w)}catch{}};h();const g=window.setInterval(h,2e4);return()=>{p=!1,window.clearInterval(g)}},[e]);const l=(a==null?void 0:a.series)??[],[d,f]=b.useMemo(()=>{let p=1/0,h=0;for(const g of l)g.points.length&&(p=Math.min(p,g.points[0].t),h=Math.max(h,g.points[g.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(a==null?void 0:a.sinceMs)??0):(a==null?void 0:a.sinceMs)??0,h]},[l,a==null?void 0:a.sinceMs]);return Iw.createPortal(c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[c.jsxs("div",{className:"modal-head",children:[c.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),a&&d>0&&c.jsxs("span",{className:"hist-since",children:["since ",xl(d)," · ",Jw(d,f||Date.now())]}),c.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),c.jsx("div",{className:"hist-body",children:a==null?c.jsx("p",{className:"hist-empty",children:"Reading…"}):l.length===0?c.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):l.map(p=>c.jsx(_D,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function _D({series:e,stepMs:t}){const n=b.useRef(null),[s,a]=b.useState(560),[i,l]=b.useState(null);b.useEffect(()=>{const I=n.current;if(!I||typeof ResizeObserver>"u")return;const z=new ResizeObserver(([O])=>a(Math.max(160,O.contentRect.width)));return z.observe(I),()=>z.disconnect()},[]);const{points:d,unit:f,warnAt:p,critAt:h,label:g,top:y,restsAtZero:w}=e,N=w?wD:ud,{now:k,peak:E}=xD(d),_=f==="C"?"°C":f,S=g==="Throttling"?bD(d,t):null,j=i!=null?d[i]:null,C=d.length>1?d[d.length-1].t-d[0].t:0,M=I=>{const z=s-Gt.l-Gt.r;return Gt.l+(C>0?z*(I-d[0].t)/C:z/2)},$=I=>{if(d.length<2)return;const z=I.currentTarget.getBoundingClientRect(),O=(I.clientX-z.left-Gt.l)/Math.max(1,z.width-Gt.l-Gt.r),A=d[0].t+C*Math.max(0,Math.min(1,O));let D=0;for(let H=1;H<d.length;H++)Math.abs(d[H].t-A)<Math.abs(d[D].t-A)&&(D=H);l(D)};return c.jsxs("section",{className:"hist-series","aria-label":`${g} history`,children:[c.jsxs("div",{className:"hist-head",children:[c.jsx("span",{className:"hist-label",children:g}),c.jsxs("span",{className:"hist-stats",children:[k!=null&&c.jsxs(c.Fragment,{children:[c.jsx("b",{children:k}),c.jsxs("span",{children:[_," now"]})]}),E!=null&&c.jsxs(c.Fragment,{children:[c.jsx("b",{className:eR(E,p,h),children:E}),c.jsxs("span",{children:[_," peak"]})]})]})]}),c.jsx("div",{className:"hist-plot",ref:n,children:c.jsxs("svg",{className:"hist-chart",width:"100%",height:N,viewBox:`0 0 ${s} ${N}`,preserveAspectRatio:"none",role:"img","aria-label":k==null?`${g}: nothing measured yet`:`${g}: ${k}${_} now, peak ${E}${_}, over ${Jw(d[0].t,d[d.length-1].t)}`,onPointerMove:$,onPointerLeave:()=>l(null),children:[[["warn",p],["hot",h]].map(([I,z])=>z==null||z>y?null:c.jsxs("g",{children:[c.jsx("line",{className:`hist-rule ${I}`,x1:Gt.l,x2:s-Gt.r,y1:lr(z,y,N),y2:lr(z,y,N)}),c.jsx("text",{className:`hist-rule-tag ${I}`,x:2,y:lr(z,y,N)+3,children:z})]},I)),c.jsx("line",{className:"hist-floor",x1:Gt.l,x2:s-Gt.r,y1:N-Gt.b,y2:N-Gt.b}),c.jsx("path",{className:"hist-area",d:JT(d,s,t,y,N)}),c.jsx("path",{className:"hist-line",d:ZT(d,s,t,y,N)}),d.length===1&&c.jsx("circle",{className:"hist-dot",cx:M(d[0].t),cy:lr(d[0].v,y,N),r:3}),j&&c.jsxs("g",{children:[c.jsx("line",{className:"hist-cross",x1:M(j.t),x2:M(j.t),y1:Gt.t,y2:N-Gt.b}),c.jsx("circle",{className:"hist-dot",cx:M(j.t),cy:lr(j.v,y,N),r:3})]})]})}),c.jsx("div",{className:"hist-axis",children:j?c.jsxs("span",{className:"hist-at",children:[xl(j.t)," — ",c.jsx("b",{children:j.v}),_]}):c.jsxs(c.Fragment,{children:[c.jsx("span",{children:d.length?xl(d[0].t):""}),c.jsx("span",{children:d.length?xl(d[d.length-1].t):""})]})}),S&&c.jsx("div",{className:"hist-note",children:S})]})}const SD="thermal:Throttling";function ND(e){var n,s,a,i;const t={};e.cpu!=null&&(t["cpu:all"]=e.cpu),(n=e.perCore)!=null&&n.length&&(t["cpu:busiest"]=Math.max(...e.perCore)),e.memory&&(t["mem:physical"]=e.memory.usedPct),e.swap&&e.swap.total>0&&(t["mem:swap"]=Math.round(e.swap.used/e.swap.total*1e3)/10),(s=e.loadavg)!=null&&s.length&&(t["load:1m"]=e.loadavg[0]);for(const l of((a=e.thermal)==null?void 0:a.celsius)??[])t[`thermal:${l.label}`]=l.celsius;return(i=e.thermal)!=null&&i.throttle&&(t[SD]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function Au(e,t){return t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function gu(e,t){return Number.isInteger(e)?t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`:Au(e,t)}const Gk=["cores","memory","load","thermal"],Na=116,Nr=24,ED=60,jD=6e4;function CD(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function TD(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function RD(e,t=ED){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function AD({sys:e}){const[t,n]=b.useState({});b.useEffect(()=>{let l=!0;const d=async()=>{const p=await Promise.all(Gk.map(async h=>{try{const g=await fetch(`/api/system/history?group=${h}`);return g.ok?[h,await g.json()]:[h,null]}catch{return[h,null]}}));l&&n(h=>{const g={...h};for(const[y,w]of p)w!=null&&w.ok&&(g[y]=w);return g})};d();const f=setInterval(()=>void d(),jD);return()=>{l=!1,clearInterval(f)}},[]);const s=b.useMemo(()=>ND(e),[e]),a=b.useMemo(()=>Gk.flatMap(l=>{const d=t[l];return d?d.series.filter(CD).map(f=>({series:RD(f),stepMs:d.stepMs})):[]}),[t]),i=b.useMemo(()=>{let l=1/0,d=-1/0;for(const{series:f}of a){const p=f.points;p.length&&(l=Math.min(l,p[0].t),d=Math.max(d,p[p.length-1].t))}return Number.isFinite(l)?Jw(l,d):"less than a minute"},[a]);return Object.keys(s).length?c.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${i}`,children:a.map(({series:l,stepMs:d})=>c.jsx(MD,{series:l,stepMs:d,now:s[l.key],span:i},l.key))}):null}function MD({series:e,stepMs:t,now:n,span:s}){var w;const{points:a,top:i,unit:l,warnAt:d,critAt:f}=e,p=TD(e),h=n??((w=a[a.length-1])==null?void 0:w.v),g=h==null?"":eR(h,d,f),y=Math.max(...a.map(N=>N.v));return c.jsxs("div",{className:`pl-cell${g?` ${g}`:""}`,title:[`${p} · peak ${Au(y,l)} over the last ${s}`,d!=null?`over ${gu(d,l)} is uncomfortable`:"",f!=null?`over ${gu(f,l)} the machine acts`:""].filter(Boolean).join(" · "),children:[c.jsxs("div",{className:"pl-cell-head",children:[c.jsx("span",{className:"pl-cell-label",children:p}),c.jsx("span",{className:"pl-cell-now",children:h==null?"—":Au(h,l)})]}),c.jsxs("svg",{className:"pl-spark",width:Na,height:Nr,viewBox:`0 0 ${Na} ${Nr}`,preserveAspectRatio:"none","aria-hidden":!0,children:[c.jsx("line",{className:"pl-spark-floor",x1:0,x2:Na,y1:Nr-$s.b,y2:Nr-$s.b}),c.jsx("path",{className:"pl-spark-area",d:JT(a,Na,t,i,Nr,$s)}),d!=null&&c.jsx("line",{className:"pl-rule warn",x1:0,x2:Na,y1:lr(d,i,Nr,$s),y2:lr(d,i,Nr,$s)}),f!=null&&c.jsx("line",{className:"pl-rule hot",x1:0,x2:Na,y1:lr(f,i,Nr,$s),y2:lr(f,i,Nr,$s)}),c.jsx("path",{className:"pl-spark-line",d:ZT(a,Na,t,i,Nr,$s)})]}),c.jsxs("span",{className:"vis-hidden",children:["peak ",Au(y,l)," over the last ",s,d!=null&&`, uncomfortable over ${gu(d,l)}`,f!=null&&`, the machine acts over ${gu(f,l)}`]})]})}const ID={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 OD(e,t){const n=t.dir==="asc"?1:-1,s=i=>t.key==="cpu"?i.cpu:t.key==="mem"?i.mem:t.key==="rss"?i.rssBytes:t.key==="threads"?i.threads:i.uptimeSec,a=(i,l)=>{if(t.key==="name")return n*i.name.localeCompare(l.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=i.user??"",h=l.user??"";return!p||!h?p===h?0:p?-1:1:n*p.localeCompare(h,void 0,{sensitivity:"base"})}const d=s(i),f=s(l);return d==null||f==null?d==null?f==null?0:1:-1:n*(d-f)};return[...e].sort((i,l)=>a(i,l)||(l.cpu??-1)-(i.cpu??-1)||l.mem-i.mem||i.pid-l.pid)}function PD(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const LD=4e3;function DD(){const[e,t]=b.useState(null);return b.useEffect(()=>{let n=!0;const s=async()=>{if(document.visibilityState!=="hidden")try{const i=await fetch("/api/system/processes?detail=1");if(!i.ok)return;const l=await i.json();n&&(l!=null&&l.ok)&&t({procs:l.procs??[],total:l.total??0})}catch{}};s();const a=window.setInterval(s,LD);return()=>{n=!1,window.clearInterval(a)}},[]),e}function qD(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 FD(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 zD({sys:e,onClose:t}){const n=tn(t),[s,a]=b.useState(ID),i=DD(),l=i?OD(i.procs,s):null;return Iw.createPortal(c.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:c.jsxs("div",{ref:n,className:"modal pl-modal",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[c.jsxs("div",{className:"modal-head",children:[c.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),i&&c.jsxs("span",{className:"pl-count",children:[l.length," of ",i.total," running"]}),c.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),c.jsxs("div",{className:"pl-split",children:[c.jsx("div",{className:"pl-body",children:l==null?c.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):l.length===0?c.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):c.jsxs("table",{className:"sd-procs pl-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx(Oo,{col:"cpu",label:"cpu",sort:s,onSort:a}),c.jsx(Oo,{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}),c.jsx(Oo,{col:"threads",label:"threads",sort:s,onSort:a}),c.jsx(Oo,{col:"uptime",label:"up",sort:s,onSort:a}),c.jsx(Oo,{col:"user",label:"user",sort:s,onSort:a}),c.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),c.jsx(Oo,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:s,onSort:a})]})}),c.jsx("tbody",{children:l.map(d=>c.jsxs("tr",{children:[c.jsx("td",{className:"sd-num",children:d.cpu==null?"—":d.cpu.toFixed(0)}),c.jsx("td",{className:"sd-num sd-dim",title:`${d.mem.toFixed(1)}% of installed memory`,children:qD(d.rssBytes)}),c.jsx("td",{className:"sd-num sd-dim",children:d.threads??"—"}),c.jsx("td",{className:"sd-num sd-dim",children:FD(d.uptimeSec)}),c.jsx("td",{className:"sd-dim pl-user",children:d.user??"—"}),c.jsx("td",{className:"sd-num sd-dim pl-pid",children:d.pid}),c.jsxs("td",{className:"pl-name",children:[d.name,d.cmd&&c.jsxs("span",{className:"pl-cmd",title:d.cmd,children:[" ",d.cmd]})]})]},d.pid))})]})}),c.jsx(AD,{sys:e})]})]})}),document.body)}function Oo({col:e,label:t,note:n,sort:s,onSort:a}){const i=PD(s,e);return c.jsx("th",{scope:"col","aria-sort":i,children:c.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
78
78
|
|
|
79
|
-
${n}`:`Sort by ${t}`,onClick:()=>a(ID(s,e)),children:[t,c.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}const zD=3e3;function BD(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function UD(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}% ${WD(t.lastMs,n)}`:"running at full speed, and never held back"}}function WD(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 dl(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 HD(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 GD(){const[e,t]=b.useState(null),n=b.useRef(null);return b.useEffect(()=>{let s=!0;const a=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},i=()=>{n.current==null&&(a(),n.current=window.setInterval(a,zD))},l=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},d=()=>{if(document.visibilityState==="hidden"){l();return}i(),a()};return i(),document.addEventListener("visibilitychange",d),()=>{s=!1,l(),document.removeEventListener("visibilitychange",d)}},[]),e}function Gk({usageOpen:e,sub:t,onClose:n,children:s}){return c.jsxs("aside",{className:`sysdetail${e?" shifted":""}`,id:"system-panel","aria-label":"Machine detail",children:[c.jsxs("div",{className:"sd-head",children:[c.jsx("span",{className:"sd-title",children:"This machine"}),t&&c.jsx("span",{className:"sd-sub",children:t}),c.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:n,"aria-label":"Close",title:"Close",children:"×"})]}),s]})}function VD({usageOpen:e,onClose:t}){const n=GD();if(!n||n.cpu==null||!n.memory)return c.jsx(Gk,{usageOpen:e,onClose:t,children:c.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:s,swap:a,perCore:i,loadavg:l,cores:d,uptimeSec:f,platform:p,thermal:h}=n,g=s?s.total-s.available:0,y=p==="win32"?"Commit":"Swap",w=a&&a.total>0?a.used/a.total*100:0;return c.jsxs(Gk,{usageOpen:e,sub:`up ${HD(f)} · ${d} cores`,onClose:t,children:[i&&i.length>0&&c.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:c.jsx(Mu,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:c.jsx("div",{className:"sd-cores",style:{"--n":i.length},children:i.map((N,k)=>c.jsx("span",{className:"sd-core",title:`core ${k+1}: ${N}%`,children:c.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,N)/100})`}})},k))})})}),c.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:c.jsxs(Mu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[s&&c.jsx(Vu,{label:"Physical",value:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:dl(g)})," of ",dl(s.total)]}),pct:s.usedPct,tone:s.usedPct>=90?"warn":"calm",note:`${dl(s.available)} available`}),a&&a.total>0&&c.jsx(Vu,{label:y,value:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:dl(a.used)})," of ",dl(a.total)]}),pct:w,tone:w>=90?"warn":"calm",note:w>=50?"paging to disk":void 0})]})}),l&&c.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:c.jsxs(Mu,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[c.jsx("div",{className:"sd-load",children:l.map((N,k)=>c.jsxs("span",{className:`sd-load-item${N>d?" over":""}`,children:[c.jsx("b",{children:N.toFixed(2)}),c.jsx("span",{children:["1m","5m","15m"][k]})]},k))}),c.jsx("div",{className:"sd-note",children:l[0]>d?`${(l[0]/d).toFixed(1)}× more work queued than cores to run it`:`within ${d} cores`})]})}),c.jsx(YD,{thermal:h}),c.jsx(KD,{sys:n})]})}function Mu({group:e,title:t,action:n,label:s,children:a}){const[i,l]=b.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",className:"sd-open",onClick:()=>l(!0),title:n,"aria-label":n,children:[c.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",c.jsx("i",{className:"sd-row-more",children:"›"})]}),a]}),i&&c.jsx(bD,{group:e,title:t,onClose:()=>l(!1)})]})}function YD({thermal:e}){if(!e)return null;const t=e.throttle?UD(e.throttle.speedLimit,e.heldBack):null;return c.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:c.jsxs(Mu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>c.jsx(Vu,{label:n.label,value:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:BD(n.celsius,n.warnAt,n.critAt)},n.label)),t&&c.jsx(Vu,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function KD({sys:e}){const[t,n]=b.useState(!1);return c.jsxs("div",{className:"sd-section",children:[c.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:c.jsxs("span",{className:"sd-door-plate",children:[c.jsxs("span",{className:"sd-door-name",children:["Busiest processes",c.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),c.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&c.jsx(FD,{sys:e,onClose:()=>n(!1)})]})}function Vu({label:e,value:t,pct:n,tone:s="calm",note:a}){return c.jsxs("div",{className:"sd-row",children:[c.jsxs("div",{className:"sd-row-head",children:[c.jsx("span",{className:"sd-row-label",children:e}),c.jsx("span",{className:"sd-row-val",children:t})]}),c.jsx("span",{className:"sd-track",children:c.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),a&&c.jsx("div",{className:"sd-note",children:a})]})}const Vk=18,XD=1100,Po=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},QD=Array.from({length:Vk},(e,t)=>{const n=-72+144*t/(Vk-1)+(Po(t,1)-.5)*9,s=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+Po(t,2)*.52);return{dx:Math.cos(s)*a,dy:Math.sin(s)*a,rot:(t%2?1:-1)*(100+Po(t,3)*260),delay:Math.round(Po(t,4)*90),dur:760+Math.round(Po(t,5)*260),scale:.8+Po(t,6)*.45,hue:t%4,round:t%3===0}});function Yk({anchor:e}){var a;const[t,n]=b.useState(null),s=typeof window<"u"&&((a=window.matchMedia)==null?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches);return b.useEffect(()=>{if(s)return;const i=e.current;if(!i)return;const l=i.getBoundingClientRect();n({x:l.left+l.width/2,y:l.top+l.height/2});const d=window.setTimeout(()=>n(null),XD);return()=>window.clearTimeout(d)},[e,s]),s||!t?null:Iw.createPortal(c.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:QD.map((i,l)=>c.jsx("span",{className:`confetti-bit${i.round?" round":""}`,"data-hue":i.hue,style:{"--dx":`${i.dx.toFixed(1)}px`,"--dy":`${i.dy.toFixed(1)}px`,"--rot":`${i.rot}deg`,"--s":i.scale.toFixed(2),animationDelay:`${i.delay}ms`,animationDuration:`${i.dur}ms, ${i.dur}ms`}},l))}),document.body)}const eR=new Set(["awaiting_url","awaiting_code","registering"]);function ZD(e){return e!=null&&eR.has(e)}function tR(e){return e!=null&&e!=="done"&&!eR.has(e)}const JD="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",eq="the sign-in did not complete";function tq({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?JD:eq)}}const nq="done";function rq(){let e=!1;return{shouldAnnounce(t){return t!==nq?(e=!1,!1):e?!1:(e=!0,!0)}}}function e0(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const sq={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 ${Ut}`,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"},aq={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"},oq=`claude-swap could not read the login keychain — start ${Ut} from a Terminal window rather than a background service`;function yw(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Xo(e)))return oq;const n=e0(aq,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function Xo(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const iq={no_install:"ccusage is not installed, and AGENTS_DECK_NO_INSTALL=1 forbids fetching it — unset that variable and restart the deck, or install ccusage yourself so it is on this deck's PATH",bad_override:"AGENTS_DECK_CCUSAGE names a file that is not there — correct it to the full path of your ccusage, or unset it to let the deck find its own",timeout:"ccusage took more than 90 seconds and was stopped — a narrower range usually finishes",bad_output:"ccusage ran but printed no usage data — try again, and run ccusage daily --json in a terminal if it keeps happening",run_failed:"ccusage could not report usage — try again",bad_range:"that date range is not a YYYYMMDD date — reopen the modal and pick one of the presets",unreachable:"the deck did not answer — check it is still running, then try again"},lq="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 cq(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const uq="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",dq="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",hq=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),fq=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,pq=/[\\/]_npx[\\/]/i,mq=`the copy of ccusage ${Ut} installed for itself`;function gq(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function yq(e,t){const n=vq(e,t),s=gq(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 ${hl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${hl(n)}`;case"managed":return`${mq} failed to run: ${hl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${hl(n)}`:`the ccusage this deck found on your PATH failed to run: ${hl(n)}`;default:return n}}const hl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function vq(e,t){const n=Xo(e);if(hq(n)){if(pq.test(n))return dq;if(fq.test(n))return uq}if(cq(n))return lq;const s=e0(iq,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Fo(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&tR(e.state))return e.error;const n=e0(sq,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function wq(e,t,n){if(n<=0||Kw(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 nR(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 xq(e){const t=new Map;for(const n of e){const s=(n.email??"").trim().toLowerCase();s&&t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=(n.email??"").trim(),a=n.alias||s||`account ${n.num}`,i=[];return n.alias&&s&&i.push(s),s&&(t.get(s.toLowerCase())??0)>1&&i.push(n.org||`slot ${n.num}`),{num:n.num,label:a,sub:i.length?i.join(" · "):null}})}function bq(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 kq(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 _q(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(h=>h.state===p).length,s=[],a=n("imported");a&&s.push(`${a} of ${t} imported`);const i=n("healed");i&&s.push(`${i} had a dead token replaced`);const l=n("updated");l&&s.push(`${l} updated`);const d=n("present");d&&s.push(`${d} already here`);const f=n("failed");return f&&s.push(`${f} did not arrive`),`${s.join(", ")}.`}const Sq=1500,yu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],Kk="aa-panel",Xk=e=>`aa-tab-${e}`;async function fl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const vw=he.forwardRef((e,t)=>c.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[c.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),c.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));vw.displayName="SuccessMark";function Nq({onClose:e,onChanged:t}){const[n,s]=b.useState("login"),[a,i]=b.useState(null),[l,d]=b.useState(""),[f,p]=b.useState(""),[h,g]=b.useState(!1),[y,w]=b.useState(null),[N,k]=b.useState(null),[E,_]=b.useState(null),[S,j]=b.useState(null),C=b.useRef(""),M=b.useRef(!1),$=b.useRef(!1),I=b.useRef(null),z=b.useRef(null),O=b.useRef(null),A=b.useRef(null),D=b.useRef([]),H=b.useRef(!1),X=b.useCallback(()=>{M.current&&fl({action:"login-cancel"}).catch(()=>{}),e()},[e]),R=tn(X,{focusRef:O}),Z=b.useCallback(async()=>{if(!ur($.current))return;$.current=!0,g(!0),w(null),M.current=!0;const U=await fl({action:"login"}).catch(()=>null);if($.current=!1,g(!1),!(U!=null&&U.ok)){w(Fo(U,"could not start the sign-in"));return}i(U)},[]);b.useEffect(()=>{if(!ZD(a==null?void 0:a.state))return;const U=window.setInterval(async()=>{try{const ee=await fetch("/api/claude-accounts/login");ee.ok&&i(await ee.json())}catch{}},Sq);return()=>window.clearInterval(U)},[a]);const B=b.useRef(t);B.current=t;const Q=b.useState(rq)[0];b.useEffect(()=>{var U;(a==null?void 0:a.state)==="awaiting_code"&&((U=I.current)==null||U.focus()),Q.shouldAnnounce(a==null?void 0:a.state)&&B.current()},[a==null?void 0:a.state,Q]),b.useEffect(()=>{var U;n==="paste"&&!H.current&&((U=z.current)==null||U.focus()),H.current=!1},[n]);const P=b.useCallback(U=>{var Y;const ee=wq(U,yu.findIndex(le=>le.id===n),yu.length);ee.kind!=="pass"&&(U.preventDefault(),H.current=!0,s(yu[ee.index].id),(Y=D.current[ee.index])==null||Y.focus())},[n]),F=b.useCallback(async()=>{var ee;if(!ur($.current))return;$.current=!0,g(!0),w(null);const U=await fl({action:"login-code",code:l}).catch(()=>null);if($.current=!1,g(!1),!(U!=null&&U.ok)){w(Fo(U,"the code was not accepted")),U!=null&&U.state&&i(U),(ee=I.current)==null||ee.select();return}d(""),i(U)},[l,a]),J=b.useCallback(async()=>{if(!ur($.current))return;$.current=!0,g(!0),w(null);const U=await fl({action:"import",blob:f}).catch(()=>null);if($.current=!1,g(!1),!(U!=null&&U.ok)){w(Fo(U,"the import failed"));return}C.current=f,p(""),j(null),k(U.results??[]),t()},[f,t]),L=b.useCallback(async U=>{const ee=`${U.email}|${U.org??""}`;if(!ur($.current)||!C.current)return;$.current=!0,g(!0),_(ee),j(null);const Y=await fl({action:"import",blob:C.current,force:!0,only:{email:U.email,org:U.org??""}}).catch(()=>null);if($.current=!1,g(!1),_(null),!(Y!=null&&Y.ok)){j({key:ee,text:Fo(Y,"that account could not be updated")});return}const le=(Y.results??[])[0];le&&k(fe=>fe&&fe.map(me=>`${me.email}|${me.org??""}`===ee?le:me)),t()},[t]),K=(a==null?void 0:a.state)==="done"?a.account:null,ue=tR(a==null?void 0:a.state)||!!(y&&M.current&&!h),G=tq({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return c.jsx("div",{className:"modal-backdrop",onClick:X,role:"presentation",children:c.jsxs("div",{ref:R,className:"modal aa-modal",onClick:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:P,children:yu.map((U,ee)=>c.jsx("button",{type:"button",role:"tab",id:Xk(U.id),ref:Y=>{D.current[ee]=Y},"aria-selected":n===U.id,"aria-controls":Kk,tabIndex:n===U.id?0:-1,className:`aa-tab${n===U.id?" on":""}`,onClick:()=>{H.current=!1,s(U.id)},children:U.label},U.id))})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:X,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsx("section",{className:"modal-body aa-body",id:Kk,role:"tabpanel","aria-labelledby":Xk(n),children:n==="login"?K?c.jsxs("div",{className:"aa-done",children:[c.jsx(vw,{ref:A}),c.jsx(Yk,{anchor:A}),c.jsx("h4",{children:K.added?`Account ${K.num} added`:"Credentials refreshed"}),c.jsxs("p",{className:"aa-note",children:[c.jsx("strong",{children:K.email}),K.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),c.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"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:"1 · Approve in the browser"}),c.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),c.jsx("a",{className:"aa-link",href:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),c.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."}),c.jsxs("div",{className:"aa-field",children:[c.jsx("input",{ref:I,type:"text",value:l,onChange:U=>d(U.target.value),onKeyDown:U=>{U.key==="Enter"&&l.trim()&&!h&&F()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),c.jsx("button",{type:"button",className:"btn primary",...cr(h,!l.trim()||a.state==="registering"),onClick:F,children:a.state==="registering"?"registering…":"Continue"})]}),(y||a.error)&&c.jsx("p",{className:"aa-err",children:y??a.error}),c.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."})]})]}):ue?c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:G.title}),c.jsx("p",{className:"aa-err",children:G.message}),c.jsx("button",{type:"button",className:"btn",onClick:()=>{M.current=!1,i(null),w(null),Z()},children:"Try again"})]}):h||M.current?c.jsx("div",{className:"aa-step",children:c.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):c.jsxs("div",{className:"aa-step aa-primer",children:[c.jsx("h4",{children:"Sign in to Anthropic"}),c.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."}),c.jsx("div",{className:"aa-actions",children:c.jsx("button",{type:"button",ref:O,className:"btn primary",onClick:Z,children:"Open the sign-in page"})})]}):N?(()=>{const U=N.filter(ee=>ee.state==="imported").length;return c.jsxs("div",{className:"aa-done",children:[c.jsx(vw,{ref:A}),U>0&&c.jsx(Yk,{anchor:A}),c.jsx("h4",{children:_q(N)}),N.length>0&&c.jsx("ul",{className:"aa-results",children:N.map(ee=>{const Y=`${ee.email}|${ee.org??""}`;return c.jsxs("li",{className:`aa-result ${ee.state}`,children:[c.jsx("span",{className:"aa-result-who",children:ee.email||(ee.num?`slot ${ee.num}`:"an account")}),c.jsx("span",{className:"aa-result-what",children:kq(ee.state)}),ee.state==="present"&&c.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":E===Y,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:()=>L(ee),children:E===Y?"updating…":"update anyway"}),(S==null?void 0:S.key)===Y&&c.jsx("span",{className:"aa-result-err",children:S.text})]},Y)})}),c.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",c.jsx("strong",{children:" update anyway"}),"."]}),c.jsxs("div",{className:"aa-actions",children:[c.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),c.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",j(null),k(null)},children:"Import another"})]})]})})():c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:"Paste an account shared from another deck"}),c.jsxs("div",{className:"aa-field",children:[c.jsx("input",{ref:z,type:"text",value:f,onChange:U=>p(U.target.value),onKeyDown:U=>{U.key==="Enter"&&f.trim()&&!h&&J()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),c.jsx("button",{type:"button",className:"btn primary",...cr(h,!f.trim()),onClick:J,children:h?"importing…":"Import"})]}),y&&c.jsx("p",{className:"aa-err",children:y}),c.jsxs("p",{className:"aa-note",children:["Use ",c.jsx("strong",{children:"share"})," on one account in the other deck, or ",c.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."]})]})})]})})}async function Eq(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const jq=1800;function Cq({accounts:e,onClose:t,copyText:n}){const[s,a]=b.useState([]),[i,l]=b.useState(null),[d,f]=b.useState(!1),[p,h]=b.useState(null),[g,y]=b.useState(!1),[w,N]=b.useState(()=>Math.floor(Date.now()/1e3)),k=b.useRef(null),E=b.useRef(!1),_=tn(t,{focusRef:k});b.useEffect(()=>{if(!i)return;N(Math.floor(Date.now()/1e3));const A=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(A)},[i]);const S=xq(e),j=e.filter(A=>!s.includes(A.num)).map(A=>A.num),C=j.length===e.length,M=A=>a(D=>D.includes(A)?D.filter(H=>H!==A):[...D,A]),$=b.useCallback(async()=>{if(!ur(E.current)||!j.length)return;E.current=!0,f(!0),h(null),y(!1);const A=await Eq({action:"share",accounts:j}).catch(()=>null);if(E.current=!1,f(!1),!(A!=null&&A.ok)){h(Fo(A,"the share could not be made"));return}l({blob:A.blob,expiresAt:A.expiresAt,shared:A.shared??[],failed:A.failed??[]})},[e,j]),I=i?nR(i.expiresAt,w):null,z=(I==null?void 0:I.tone)==="gone",O=(i==null?void 0:i.shared.length)??0;return c.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:c.jsxs("div",{ref:_,className:"modal sa-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("h3",{children:"Share accounts"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsx("section",{className:"modal-body sa-body",children:i?c.jsxs("div",{className:"sa-step",children:[c.jsx("h4",{children:z?"This share has expired":O===1?"1 account, ready to paste":`${O} accounts, ready to paste`}),c.jsx("code",{className:`ap-share-blob${z?" sa-dead":""}`,children:i.blob}),c.jsxs("div",{className:"ap-share-foot",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",ref:k,onClick:async()=>{if(z){l(null),$();return}await n(i.blob)&&(y(!0),window.setTimeout(()=>y(!1),jq))},children:z?"make a new share":g?"copied":`copy ${O===1?"the share":"all "+O}`}),c.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:[c.jsx("span",{className:"ap-share-warn",children:O===1?"this is the password":`this is ${O} passwords`})," · ",c.jsx("span",{className:`ap-share-expiry ${I==null?void 0:I.tone}`,children:I==null?void 0:I.text})]})]}),i.failed.length>0&&c.jsxs("div",{className:"sa-failed",role:"alert",children:[c.jsx("p",{className:"sa-failed-head",children:i.failed.length===1?"One account is not in this bundle:":`${i.failed.length} accounts are not in this bundle:`}),c.jsx("ul",{className:"sa-list",children:i.failed.map(A=>{var H;const D=!!(A.email&&((H=A.detail)!=null&&H.includes(A.email)));return c.jsxs("li",{children:[!D&&c.jsx("span",{className:"sa-who",children:A.email||`account ${A.num}`}),c.jsx("span",{className:"sa-why",children:A.detail||"could not be exported"})]},`${A.num}-${A.email}`)})})]}),c.jsx("p",{className:"sa-note",children:z?c.jsx(c.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):c.jsxs(c.Fragment,{children:["Paste it into the other deck with ",c.jsx("strong",{children:"+"})," → ",c.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),c.jsxs("div",{className:"sa-actions",children:[c.jsx("button",{type:"button",className:"btn",onClick:()=>{l(null),y(!1)},children:"Pick again"}),c.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?c.jsxs("div",{className:"sa-step",children:[c.jsx("h4",{children:"Nothing to share"}),c.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",c.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),c.jsx("div",{className:"sa-actions",children:c.jsx("button",{type:"button",className:"btn primary",ref:k,onClick:t,children:"Close"})})]}):c.jsxs("div",{className:"sa-step",children:[c.jsxs("h4",{children:["Which accounts go to the other ",Ut,"?"]}),c.jsx("p",{className:`sa-count${j.length?"":" empty"}`,children:bq(j.length)}),c.jsx("ul",{className:"sa-list sa-pick",children:S.map(A=>c.jsx("li",{children:c.jsxs("label",{className:"sa-row",children:[c.jsx("input",{type:"checkbox",checked:j.includes(A.num),onChange:()=>M(A.num)}),c.jsx("span",{className:"sa-who",children:A.label}),A.sub&&c.jsx("span",{className:"sa-sub",children:A.sub})]})},A.num))}),p&&c.jsx("p",{className:"aa-err",children:p}),c.jsxs("div",{className:"sa-actions",children:[c.jsx("button",{type:"button",className:"btn",onClick:()=>a(C?e.map(A=>A.num):[]),children:C?"Clear all":"Select all"}),c.jsx("button",{type:"button",className:"btn primary",ref:k,...cr(d,!j.length),onClick:$,children:d?"making the share…":j.length===0?"Share":j.length===1?"Share 1 account":`Share ${j.length} accounts`})]})]})})]})})}function Tq(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((a,i)=>a-i).map(a=>{const i=a===t?"here":n.has(a)?"swap":"free";return{slot:a,kind:i,label:i==="here"?`slot ${a}`:`slot ${a} · ${i}`}})}function Rq(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 Aq(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function Mq(e,t,n){var a;const s=((a=e.find(i=>i.slot===t))==null?void 0:a.kind)??"here";return s==="swap"?{label:"swap",done:"swapped",sends:!0,swaps:!0,title:`Send this account to slot ${t}. That slot is taken, so the two accounts trade places and the one standing there moves to slot ${n}.`}:s==="free"?{label:"move",done:"moved",sends:!0,swaps:!1,title:`Send this account to slot ${t}. That slot is empty, so no other account moves.`}:{label:"move",done:"here",sends:!1,swaps:!1,title:`This account already holds slot ${n}.`}}function Iq(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 Qk(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function Zk(e){const t=e.filter(d=>!Qk(d)),n=e.filter(d=>Qk(d)),s=t.length?t:n,a=t.length?n:[],i=s.reduce((d,f)=>d&&d.pct>=f.pct?d:f,null);let l=null;for(const d of a)i&&d.pct<=i.pct||(!l||d.pct>l.pct)&&(l=d);return{shown:s,rest:a,fuller:l,peak:l??i}}function $q(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function Oq(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.`,i=n===1?"the other window":`the other ${n} windows`;return`${a} ${s?"Hide":"Show"} ${i}.`}const Pq="\0";function t0(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}${Pq}${n}`}function Lq(e,t){const n=t0(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function Dq(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(t0)),s=e.filter(a=>n.has(a));return s.length===e.length?e:s}const qq=64;function Fq(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const zq=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function Jk(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function Bq(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=Xo(t.body);return{text:yw(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function e1(e,t){return t?e!=null&&e.reload&&e.text===t.text&&e.raw===t.raw?e:t:e!=null&&e.reload?null:e}async function _f(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function Uq({status:e,manual:t,onClose:n,onChanged:s}){var Z,B;const a=b.useRef(null),i=tn(n,{focusRef:a}),[l,d]=b.useState(""),[f,p]=b.useState(""),[h,g]=b.useState(null),[y,w]=b.useState(null),[N,k]=b.useState(null),[E,_]=b.useState(null),[S,j]=b.useState(()=>Date.now());b.useEffect(()=>{const Q=window.setInterval(()=>j(Date.now()),1e3);return()=>window.clearInterval(Q)},[]);const C=b.useRef(!0);b.useEffect(()=>()=>{C.current=!1},[]);const M=b.useRef(null),$=b.useCallback(Q=>cd(M.current)?(M.current=Q,k(Q),!0):!1,[]),I=b.useCallback(()=>{M.current=null,C.current&&k(null)},[]),z=Q=>{const P=Ia(N,Q);return{disabled:P.disabled,"aria-busy":P.busy}},O=b.useCallback(async()=>{const Q=Yq(l);if(!Q){g("That is not an address and a port — try 192.168.1.5:54340.");return}if($("add"))try{const P=`${Q.addr}:${Q.port}`,F=await _f("/api/prefs",{lan:{manual:[...t.filter(J=>J!==P),P]}});if(!C.current)return;F!=null&&F.ok?(g(null),d(""),s(),n()):g(en("add that address",F))}catch{C.current&&g(en("add that address",null))}finally{I()}},[l,t,s,n,$,I]),A=b.useCallback(async Q=>{if($(`invite:${Q}`))try{const P=await _f("/api/lan/invite",{action:Q});if(!C.current)return;P!=null&&P.ok?(g(null),w(null),s()):g(en(Q==="make"?"make an invite":"cancel that invite",P))}catch{C.current&&g(en(Q==="make"?"make an invite":"cancel that invite",null))}finally{I()}},[s,$,I]),D=b.useCallback(async()=>{const Q=f.trim();if(!(!Q||!$("join"))){_(null);try{const P=await _f("/api/lan/invite",{action:"join",token:Q});if(!C.current)return;P!=null&&P.ok?(p(""),g(null),s(),n()):(_(Array.isArray(P==null?void 0:P.tried)?P.tried:null),g(en("use that invite",P)))}catch{C.current&&g(en("use that invite",null))}finally{I()}}},[f,s,n,$,I]),H=b.useCallback(async(Q,P)=>{try{await navigator.clipboard.writeText(Q),w(P),window.setTimeout(()=>{C.current&&w(F=>F===P?null:F)},1600)}catch{g("Could not copy it — select the text and copy it by hand.")}},[]),X=e.invite&&e.invite.expiresAt>S?e.invite:null,R=((Z=e.reach)==null?void 0:Z.steps)??[];return c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:i,className:"modal lan-add",onClick:Q=>Q.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[h&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{className:"ap-failure-text",children:h}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>g(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),((B=e.reach)==null?void 0:B.blocked)&&c.jsxs("div",{className:"ap-lan-reach",children:[c.jsx("p",{className:"lan-warn",children:e.reach.text}),c.jsxs("p",{className:"lan-note",children:["Nothing here is stuck: a deck that dials out first needs none of this."," ",c.jsx("strong",{children:"Ask them for an invite and paste it below"})," — an invite is dialled by whoever pastes it, so on this machine it has to be pasted rather than made. Typing their address works the same way."]}),R.length>0&&c.jsxs("details",{className:"ap-lan-reach-fix",children:[c.jsx("summary",{children:"or let them find this deck on their own"}),c.jsxs("p",{className:"lan-note",children:["Run this in PowerShell ",c.jsx("strong",{children:"as Administrator"}),", then restart the deck.",e.reach.category==="Public"&&c.jsx(c.Fragment,{children:" The first line marks this network as a home or office one — leave it out on a network you do not trust."})]}),c.jsx("pre",{className:"ap-lan-cmd",children:c.jsx("code",{children:R.join(`
|
|
79
|
+
${n}`:`Sort by ${t}`,onClick:()=>a($D(s,e)),children:[t,c.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}const BD=3e3;function UD(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function WD(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}% ${HD(t.lastMs,n)}`:"running at full speed, and never held back"}}function HD(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 dl(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 GD(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 VD(){const[e,t]=b.useState(null),n=b.useRef(null);return b.useEffect(()=>{let s=!0;const a=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},i=()=>{n.current==null&&(a(),n.current=window.setInterval(a,BD))},l=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},d=()=>{if(document.visibilityState==="hidden"){l();return}i(),a()};return i(),document.addEventListener("visibilitychange",d),()=>{s=!1,l(),document.removeEventListener("visibilitychange",d)}},[]),e}function Vk({usageOpen:e,sub:t,onClose:n,children:s}){return c.jsxs("aside",{className:`sysdetail${e?" shifted":""}`,id:"system-panel","aria-label":"Machine detail",children:[c.jsxs("div",{className:"sd-head",children:[c.jsx("span",{className:"sd-title",children:"This machine"}),t&&c.jsx("span",{className:"sd-sub",children:t}),c.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:n,"aria-label":"Close",title:"Close",children:"×"})]}),s]})}function YD({usageOpen:e,onClose:t}){const n=VD();if(!n||n.cpu==null||!n.memory)return c.jsx(Vk,{usageOpen:e,onClose:t,children:c.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:s,swap:a,perCore:i,loadavg:l,cores:d,uptimeSec:f,platform:p,thermal:h}=n,g=s?s.total-s.available:0,y=p==="win32"?"Commit":"Swap",w=a&&a.total>0?a.used/a.total*100:0;return c.jsxs(Vk,{usageOpen:e,sub:`up ${GD(f)} · ${d} cores`,onClose:t,children:[i&&i.length>0&&c.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:c.jsx(Mu,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:c.jsx("div",{className:"sd-cores",style:{"--n":i.length},children:i.map((N,k)=>c.jsx("span",{className:"sd-core",title:`core ${k+1}: ${N}%`,children:c.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,N)/100})`}})},k))})})}),c.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:c.jsxs(Mu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[s&&c.jsx(Vu,{label:"Physical",value:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:dl(g)})," of ",dl(s.total)]}),pct:s.usedPct,tone:s.usedPct>=90?"warn":"calm",note:`${dl(s.available)} available`}),a&&a.total>0&&c.jsx(Vu,{label:y,value:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:dl(a.used)})," of ",dl(a.total)]}),pct:w,tone:w>=90?"warn":"calm",note:w>=50?"paging to disk":void 0})]})}),l&&c.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:c.jsxs(Mu,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[c.jsx("div",{className:"sd-load",children:l.map((N,k)=>c.jsxs("span",{className:`sd-load-item${N>d?" over":""}`,children:[c.jsx("b",{children:N.toFixed(2)}),c.jsx("span",{children:["1m","5m","15m"][k]})]},k))}),c.jsx("div",{className:"sd-note",children:l[0]>d?`${(l[0]/d).toFixed(1)}× more work queued than cores to run it`:`within ${d} cores`})]})}),c.jsx(KD,{thermal:h}),c.jsx(XD,{sys:n})]})}function Mu({group:e,title:t,action:n,label:s,children:a}){const[i,l]=b.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",className:"sd-open",onClick:()=>l(!0),title:n,"aria-label":n,children:[c.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",c.jsx("i",{className:"sd-row-more",children:"›"})]}),a]}),i&&c.jsx(kD,{group:e,title:t,onClose:()=>l(!1)})]})}function KD({thermal:e}){if(!e)return null;const t=e.throttle?WD(e.throttle.speedLimit,e.heldBack):null;return c.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:c.jsxs(Mu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>c.jsx(Vu,{label:n.label,value:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:UD(n.celsius,n.warnAt,n.critAt)},n.label)),t&&c.jsx(Vu,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function XD({sys:e}){const[t,n]=b.useState(!1);return c.jsxs("div",{className:"sd-section",children:[c.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:c.jsxs("span",{className:"sd-door-plate",children:[c.jsxs("span",{className:"sd-door-name",children:["Busiest processes",c.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),c.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&c.jsx(zD,{sys:e,onClose:()=>n(!1)})]})}function Vu({label:e,value:t,pct:n,tone:s="calm",note:a}){return c.jsxs("div",{className:"sd-row",children:[c.jsxs("div",{className:"sd-row-head",children:[c.jsx("span",{className:"sd-row-label",children:e}),c.jsx("span",{className:"sd-row-val",children:t})]}),c.jsx("span",{className:"sd-track",children:c.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),a&&c.jsx("div",{className:"sd-note",children:a})]})}const Yk=18,QD=1100,Po=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},ZD=Array.from({length:Yk},(e,t)=>{const n=-72+144*t/(Yk-1)+(Po(t,1)-.5)*9,s=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+Po(t,2)*.52);return{dx:Math.cos(s)*a,dy:Math.sin(s)*a,rot:(t%2?1:-1)*(100+Po(t,3)*260),delay:Math.round(Po(t,4)*90),dur:760+Math.round(Po(t,5)*260),scale:.8+Po(t,6)*.45,hue:t%4,round:t%3===0}});function Kk({anchor:e}){var a;const[t,n]=b.useState(null),s=typeof window<"u"&&((a=window.matchMedia)==null?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches);return b.useEffect(()=>{if(s)return;const i=e.current;if(!i)return;const l=i.getBoundingClientRect();n({x:l.left+l.width/2,y:l.top+l.height/2});const d=window.setTimeout(()=>n(null),QD);return()=>window.clearTimeout(d)},[e,s]),s||!t?null:Iw.createPortal(c.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:ZD.map((i,l)=>c.jsx("span",{className:`confetti-bit${i.round?" round":""}`,"data-hue":i.hue,style:{"--dx":`${i.dx.toFixed(1)}px`,"--dy":`${i.dy.toFixed(1)}px`,"--rot":`${i.rot}deg`,"--s":i.scale.toFixed(2),animationDelay:`${i.delay}ms`,animationDuration:`${i.dur}ms, ${i.dur}ms`}},l))}),document.body)}const tR=new Set(["awaiting_url","awaiting_code","registering"]);function JD(e){return e!=null&&tR.has(e)}function nR(e){return e!=null&&e!=="done"&&!tR.has(e)}const eq="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",tq="the sign-in did not complete";function nq({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?eq:tq)}}const rq="done";function sq(){let e=!1;return{shouldAnnounce(t){return t!==rq?(e=!1,!1):e?!1:(e=!0,!0)}}}function e0(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const aq={already_running:"a sign-in is already in progress",no_url:"the claude CLI did not offer a sign-in link — is it installed?",not_waiting:"that sign-in is no longer waiting for a code",not_prompted:"the CLI has not asked for a code yet",code_rejected:"that code was not accepted — copy it again from the browser",no_verdict:"the claude CLI has not answered — try the code again",empty_code:"paste the code from the browser first",login_failed:"the code was not accepted",no_identity:"signed in, but the CLI still reports nobody logged in",add_failed:"signed in, but claude-swap could not record the account",not_a_share:"that does not look like a shared account — it should start with ccdeck2:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${Ut}`,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"},oq={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"},iq=`claude-swap could not read the login keychain — start ${Ut} from a Terminal window rather than a background service`;function yw(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Xo(e)))return iq;const n=e0(oq,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function Xo(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const lq={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"},cq="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 uq(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const dq="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",hq="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",fq=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),pq=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,mq=/[\\/]_npx[\\/]/i,gq=`the copy of ccusage ${Ut} installed for itself`;function yq(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function vq(e,t){const n=wq(e,t),s=yq(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 ${hl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${hl(n)}`;case"managed":return`${gq} failed to run: ${hl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${hl(n)}`:`the ccusage this deck found on your PATH failed to run: ${hl(n)}`;default:return n}}const hl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function wq(e,t){const n=Xo(e);if(fq(n)){if(mq.test(n))return hq;if(pq.test(n))return dq}if(uq(n))return cq;const s=e0(lq,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Fo(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&nR(e.state))return e.error;const n=e0(aq,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function xq(e,t,n){if(n<=0||Kw(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 rR(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 bq(e){const t=new Map;for(const n of e){const s=(n.email??"").trim().toLowerCase();s&&t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=(n.email??"").trim(),a=n.alias||s||`account ${n.num}`,i=[];return n.alias&&s&&i.push(s),s&&(t.get(s.toLowerCase())??0)>1&&i.push(n.org||`slot ${n.num}`),{num:n.num,label:a,sub:i.length?i.join(" · "):null}})}function kq(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 _q(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 Sq(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(h=>h.state===p).length,s=[],a=n("imported");a&&s.push(`${a} of ${t} imported`);const i=n("healed");i&&s.push(`${i} had a dead token replaced`);const l=n("updated");l&&s.push(`${l} updated`);const d=n("present");d&&s.push(`${d} already here`);const f=n("failed");return f&&s.push(`${f} did not arrive`),`${s.join(", ")}.`}const Nq=1500,yu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],Xk="aa-panel",Qk=e=>`aa-tab-${e}`;async function fl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const vw=he.forwardRef((e,t)=>c.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[c.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),c.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));vw.displayName="SuccessMark";function Eq({onClose:e,onChanged:t}){const[n,s]=b.useState("login"),[a,i]=b.useState(null),[l,d]=b.useState(""),[f,p]=b.useState(""),[h,g]=b.useState(!1),[y,w]=b.useState(null),[N,k]=b.useState(null),[E,_]=b.useState(null),[S,j]=b.useState(null),C=b.useRef(""),M=b.useRef(!1),$=b.useRef(!1),I=b.useRef(null),z=b.useRef(null),O=b.useRef(null),A=b.useRef(null),D=b.useRef([]),H=b.useRef(!1),X=b.useCallback(()=>{M.current&&fl({action:"login-cancel"}).catch(()=>{}),e()},[e]),R=tn(X,{focusRef:O}),Z=b.useCallback(async()=>{if(!ur($.current))return;$.current=!0,g(!0),w(null),M.current=!0;const U=await fl({action:"login"}).catch(()=>null);if($.current=!1,g(!1),!(U!=null&&U.ok)){w(Fo(U,"could not start the sign-in"));return}i(U)},[]);b.useEffect(()=>{if(!JD(a==null?void 0:a.state))return;const U=window.setInterval(async()=>{try{const ee=await fetch("/api/claude-accounts/login");ee.ok&&i(await ee.json())}catch{}},Nq);return()=>window.clearInterval(U)},[a]);const B=b.useRef(t);B.current=t;const Q=b.useState(sq)[0];b.useEffect(()=>{var U;(a==null?void 0:a.state)==="awaiting_code"&&((U=I.current)==null||U.focus()),Q.shouldAnnounce(a==null?void 0:a.state)&&B.current()},[a==null?void 0:a.state,Q]),b.useEffect(()=>{var U;n==="paste"&&!H.current&&((U=z.current)==null||U.focus()),H.current=!1},[n]);const P=b.useCallback(U=>{var Y;const ee=xq(U,yu.findIndex(le=>le.id===n),yu.length);ee.kind!=="pass"&&(U.preventDefault(),H.current=!0,s(yu[ee.index].id),(Y=D.current[ee.index])==null||Y.focus())},[n]),F=b.useCallback(async()=>{var ee;if(!ur($.current))return;$.current=!0,g(!0),w(null);const U=await fl({action:"login-code",code:l}).catch(()=>null);if($.current=!1,g(!1),!(U!=null&&U.ok)){w(Fo(U,"the code was not accepted")),U!=null&&U.state&&i(U),(ee=I.current)==null||ee.select();return}d(""),i(U)},[l,a]),J=b.useCallback(async()=>{if(!ur($.current))return;$.current=!0,g(!0),w(null);const U=await fl({action:"import",blob:f}).catch(()=>null);if($.current=!1,g(!1),!(U!=null&&U.ok)){w(Fo(U,"the import failed"));return}C.current=f,p(""),j(null),k(U.results??[]),t()},[f,t]),L=b.useCallback(async U=>{const ee=`${U.email}|${U.org??""}`;if(!ur($.current)||!C.current)return;$.current=!0,g(!0),_(ee),j(null);const Y=await fl({action:"import",blob:C.current,force:!0,only:{email:U.email,org:U.org??""}}).catch(()=>null);if($.current=!1,g(!1),_(null),!(Y!=null&&Y.ok)){j({key:ee,text:Fo(Y,"that account could not be updated")});return}const le=(Y.results??[])[0];le&&k(fe=>fe&&fe.map(me=>`${me.email}|${me.org??""}`===ee?le:me)),t()},[t]),K=(a==null?void 0:a.state)==="done"?a.account:null,ue=nR(a==null?void 0:a.state)||!!(y&&M.current&&!h),G=nq({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return c.jsx("div",{className:"modal-backdrop",onClick:X,role:"presentation",children:c.jsxs("div",{ref:R,className:"modal aa-modal",onClick:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:P,children:yu.map((U,ee)=>c.jsx("button",{type:"button",role:"tab",id:Qk(U.id),ref:Y=>{D.current[ee]=Y},"aria-selected":n===U.id,"aria-controls":Xk,tabIndex:n===U.id?0:-1,className:`aa-tab${n===U.id?" on":""}`,onClick:()=>{H.current=!1,s(U.id)},children:U.label},U.id))})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:X,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsx("section",{className:"modal-body aa-body",id:Xk,role:"tabpanel","aria-labelledby":Qk(n),children:n==="login"?K?c.jsxs("div",{className:"aa-done",children:[c.jsx(vw,{ref:A}),c.jsx(Kk,{anchor:A}),c.jsx("h4",{children:K.added?`Account ${K.num} added`:"Credentials refreshed"}),c.jsxs("p",{className:"aa-note",children:[c.jsx("strong",{children:K.email}),K.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),c.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"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:"1 · Approve in the browser"}),c.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),c.jsx("a",{className:"aa-link",href:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),c.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."}),c.jsxs("div",{className:"aa-field",children:[c.jsx("input",{ref:I,type:"text",value:l,onChange:U=>d(U.target.value),onKeyDown:U=>{U.key==="Enter"&&l.trim()&&!h&&F()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),c.jsx("button",{type:"button",className:"btn primary",...cr(h,!l.trim()||a.state==="registering"),onClick:F,children:a.state==="registering"?"registering…":"Continue"})]}),(y||a.error)&&c.jsx("p",{className:"aa-err",children:y??a.error}),c.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."})]})]}):ue?c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:G.title}),c.jsx("p",{className:"aa-err",children:G.message}),c.jsx("button",{type:"button",className:"btn",onClick:()=>{M.current=!1,i(null),w(null),Z()},children:"Try again"})]}):h||M.current?c.jsx("div",{className:"aa-step",children:c.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):c.jsxs("div",{className:"aa-step aa-primer",children:[c.jsx("h4",{children:"Sign in to Anthropic"}),c.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."}),c.jsx("div",{className:"aa-actions",children:c.jsx("button",{type:"button",ref:O,className:"btn primary",onClick:Z,children:"Open the sign-in page"})})]}):N?(()=>{const U=N.filter(ee=>ee.state==="imported").length;return c.jsxs("div",{className:"aa-done",children:[c.jsx(vw,{ref:A}),U>0&&c.jsx(Kk,{anchor:A}),c.jsx("h4",{children:Sq(N)}),N.length>0&&c.jsx("ul",{className:"aa-results",children:N.map(ee=>{const Y=`${ee.email}|${ee.org??""}`;return c.jsxs("li",{className:`aa-result ${ee.state}`,children:[c.jsx("span",{className:"aa-result-who",children:ee.email||(ee.num?`slot ${ee.num}`:"an account")}),c.jsx("span",{className:"aa-result-what",children:_q(ee.state)}),ee.state==="present"&&c.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":E===Y,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:()=>L(ee),children:E===Y?"updating…":"update anyway"}),(S==null?void 0:S.key)===Y&&c.jsx("span",{className:"aa-result-err",children:S.text})]},Y)})}),c.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",c.jsx("strong",{children:" update anyway"}),"."]}),c.jsxs("div",{className:"aa-actions",children:[c.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),c.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",j(null),k(null)},children:"Import another"})]})]})})():c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:"Paste an account shared from another deck"}),c.jsxs("div",{className:"aa-field",children:[c.jsx("input",{ref:z,type:"text",value:f,onChange:U=>p(U.target.value),onKeyDown:U=>{U.key==="Enter"&&f.trim()&&!h&&J()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),c.jsx("button",{type:"button",className:"btn primary",...cr(h,!f.trim()),onClick:J,children:h?"importing…":"Import"})]}),y&&c.jsx("p",{className:"aa-err",children:y}),c.jsxs("p",{className:"aa-note",children:["Use ",c.jsx("strong",{children:"share"})," on one account in the other deck, or ",c.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."]})]})})]})})}async function jq(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Cq=1800;function Tq({accounts:e,onClose:t,copyText:n}){const[s,a]=b.useState([]),[i,l]=b.useState(null),[d,f]=b.useState(!1),[p,h]=b.useState(null),[g,y]=b.useState(!1),[w,N]=b.useState(()=>Math.floor(Date.now()/1e3)),k=b.useRef(null),E=b.useRef(!1),_=tn(t,{focusRef:k});b.useEffect(()=>{if(!i)return;N(Math.floor(Date.now()/1e3));const A=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(A)},[i]);const S=bq(e),j=e.filter(A=>!s.includes(A.num)).map(A=>A.num),C=j.length===e.length,M=A=>a(D=>D.includes(A)?D.filter(H=>H!==A):[...D,A]),$=b.useCallback(async()=>{if(!ur(E.current)||!j.length)return;E.current=!0,f(!0),h(null),y(!1);const A=await jq({action:"share",accounts:j}).catch(()=>null);if(E.current=!1,f(!1),!(A!=null&&A.ok)){h(Fo(A,"the share could not be made"));return}l({blob:A.blob,expiresAt:A.expiresAt,shared:A.shared??[],failed:A.failed??[]})},[e,j]),I=i?rR(i.expiresAt,w):null,z=(I==null?void 0:I.tone)==="gone",O=(i==null?void 0:i.shared.length)??0;return c.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:c.jsxs("div",{ref:_,className:"modal sa-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("h3",{children:"Share accounts"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsx("section",{className:"modal-body sa-body",children:i?c.jsxs("div",{className:"sa-step",children:[c.jsx("h4",{children:z?"This share has expired":O===1?"1 account, ready to paste":`${O} accounts, ready to paste`}),c.jsx("code",{className:`ap-share-blob${z?" sa-dead":""}`,children:i.blob}),c.jsxs("div",{className:"ap-share-foot",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",ref:k,onClick:async()=>{if(z){l(null),$();return}await n(i.blob)&&(y(!0),window.setTimeout(()=>y(!1),Cq))},children:z?"make a new share":g?"copied":`copy ${O===1?"the share":"all "+O}`}),c.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:[c.jsx("span",{className:"ap-share-warn",children:O===1?"this is the password":`this is ${O} passwords`})," · ",c.jsx("span",{className:`ap-share-expiry ${I==null?void 0:I.tone}`,children:I==null?void 0:I.text})]})]}),i.failed.length>0&&c.jsxs("div",{className:"sa-failed",role:"alert",children:[c.jsx("p",{className:"sa-failed-head",children:i.failed.length===1?"One account is not in this bundle:":`${i.failed.length} accounts are not in this bundle:`}),c.jsx("ul",{className:"sa-list",children:i.failed.map(A=>{var H;const D=!!(A.email&&((H=A.detail)!=null&&H.includes(A.email)));return c.jsxs("li",{children:[!D&&c.jsx("span",{className:"sa-who",children:A.email||`account ${A.num}`}),c.jsx("span",{className:"sa-why",children:A.detail||"could not be exported"})]},`${A.num}-${A.email}`)})})]}),c.jsx("p",{className:"sa-note",children:z?c.jsx(c.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):c.jsxs(c.Fragment,{children:["Paste it into the other deck with ",c.jsx("strong",{children:"+"})," → ",c.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),c.jsxs("div",{className:"sa-actions",children:[c.jsx("button",{type:"button",className:"btn",onClick:()=>{l(null),y(!1)},children:"Pick again"}),c.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?c.jsxs("div",{className:"sa-step",children:[c.jsx("h4",{children:"Nothing to share"}),c.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",c.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),c.jsx("div",{className:"sa-actions",children:c.jsx("button",{type:"button",className:"btn primary",ref:k,onClick:t,children:"Close"})})]}):c.jsxs("div",{className:"sa-step",children:[c.jsxs("h4",{children:["Which accounts go to the other ",Ut,"?"]}),c.jsx("p",{className:`sa-count${j.length?"":" empty"}`,children:kq(j.length)}),c.jsx("ul",{className:"sa-list sa-pick",children:S.map(A=>c.jsx("li",{children:c.jsxs("label",{className:"sa-row",children:[c.jsx("input",{type:"checkbox",checked:j.includes(A.num),onChange:()=>M(A.num)}),c.jsx("span",{className:"sa-who",children:A.label}),A.sub&&c.jsx("span",{className:"sa-sub",children:A.sub})]})},A.num))}),p&&c.jsx("p",{className:"aa-err",children:p}),c.jsxs("div",{className:"sa-actions",children:[c.jsx("button",{type:"button",className:"btn",onClick:()=>a(C?e.map(A=>A.num):[]),children:C?"Clear all":"Select all"}),c.jsx("button",{type:"button",className:"btn primary",ref:k,...cr(d,!j.length),onClick:$,children:d?"making the share…":j.length===0?"Share":j.length===1?"Share 1 account":`Share ${j.length} accounts`})]})]})})]})})}function Rq(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((a,i)=>a-i).map(a=>{const i=a===t?"here":n.has(a)?"swap":"free";return{slot:a,kind:i,label:i==="here"?`slot ${a}`:`slot ${a} · ${i}`}})}function Aq(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 Mq(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function Iq(e,t,n){var a;const s=((a=e.find(i=>i.slot===t))==null?void 0:a.kind)??"here";return s==="swap"?{label:"swap",done:"swapped",sends:!0,swaps:!0,title:`Send this account to slot ${t}. That slot is taken, so the two accounts trade places and the one standing there moves to slot ${n}.`}:s==="free"?{label:"move",done:"moved",sends:!0,swaps:!1,title:`Send this account to slot ${t}. That slot is empty, so no other account moves.`}:{label:"move",done:"here",sends:!1,swaps:!1,title:`This account already holds slot ${n}.`}}function $q(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 Zk(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function Jk(e){const t=e.filter(d=>!Zk(d)),n=e.filter(d=>Zk(d)),s=t.length?t:n,a=t.length?n:[],i=s.reduce((d,f)=>d&&d.pct>=f.pct?d:f,null);let l=null;for(const d of a)i&&d.pct<=i.pct||(!l||d.pct>l.pct)&&(l=d);return{shown:s,rest:a,fuller:l,peak:l??i}}function Oq(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function Pq(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.`,i=n===1?"the other window":`the other ${n} windows`;return`${a} ${s?"Hide":"Show"} ${i}.`}const Lq="\0";function t0(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}${Lq}${n}`}function Dq(e,t){const n=t0(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function qq(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(t0)),s=e.filter(a=>n.has(a));return s.length===e.length?e:s}const Fq=64;function zq(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const Bq=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function e1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function Uq(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=Xo(t.body);return{text:yw(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}async function _f(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function Wq({status:e,manual:t,onClose:n,onChanged:s}){var Z,B;const a=b.useRef(null),i=tn(n,{focusRef:a}),[l,d]=b.useState(""),[f,p]=b.useState(""),[h,g]=b.useState(null),[y,w]=b.useState(null),[N,k]=b.useState(null),[E,_]=b.useState(null),[S,j]=b.useState(()=>Date.now());b.useEffect(()=>{const Q=window.setInterval(()=>j(Date.now()),1e3);return()=>window.clearInterval(Q)},[]);const C=b.useRef(!0);b.useEffect(()=>()=>{C.current=!1},[]);const M=b.useRef(null),$=b.useCallback(Q=>cd(M.current)?(M.current=Q,k(Q),!0):!1,[]),I=b.useCallback(()=>{M.current=null,C.current&&k(null)},[]),z=Q=>{const P=Ia(N,Q);return{disabled:P.disabled,"aria-busy":P.busy}},O=b.useCallback(async()=>{const Q=Xq(l);if(!Q){g("That is not an address and a port — try 192.168.1.5:54340.");return}if($("add"))try{const P=`${Q.addr}:${Q.port}`,F=await _f("/api/prefs",{lan:{manual:[...t.filter(J=>J!==P),P]}});if(!C.current)return;F!=null&&F.ok?(g(null),d(""),s(),n()):g(en("add that address",F))}catch{C.current&&g(en("add that address",null))}finally{I()}},[l,t,s,n,$,I]),A=b.useCallback(async Q=>{if($(`invite:${Q}`))try{const P=await _f("/api/lan/invite",{action:Q});if(!C.current)return;P!=null&&P.ok?(g(null),w(null),s()):g(en(Q==="make"?"make an invite":"cancel that invite",P))}catch{C.current&&g(en(Q==="make"?"make an invite":"cancel that invite",null))}finally{I()}},[s,$,I]),D=b.useCallback(async()=>{const Q=f.trim();if(!(!Q||!$("join"))){_(null);try{const P=await _f("/api/lan/invite",{action:"join",token:Q});if(!C.current)return;P!=null&&P.ok?(p(""),g(null),s(),n()):(_(Array.isArray(P==null?void 0:P.tried)?P.tried:null),g(en("use that invite",P)))}catch{C.current&&g(en("use that invite",null))}finally{I()}}},[f,s,n,$,I]),H=b.useCallback(async(Q,P)=>{try{await navigator.clipboard.writeText(Q),w(P),window.setTimeout(()=>{C.current&&w(F=>F===P?null:F)},1600)}catch{g("Could not copy it — select the text and copy it by hand.")}},[]),X=e.invite&&e.invite.expiresAt>S?e.invite:null,R=((Z=e.reach)==null?void 0:Z.steps)??[];return c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:i,className:"modal lan-add",onClick:Q=>Q.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[h&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{className:"ap-failure-text",children:h}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>g(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),((B=e.reach)==null?void 0:B.blocked)&&c.jsxs("div",{className:"ap-lan-reach",children:[c.jsx("p",{className:"lan-warn",children:e.reach.text}),c.jsxs("p",{className:"lan-note",children:["Nothing here is stuck: a deck that dials out first needs none of this."," ",c.jsx("strong",{children:"Ask them for an invite and paste it below"})," — an invite is dialled by whoever pastes it, so on this machine it has to be pasted rather than made. Typing their address works the same way."]}),R.length>0&&c.jsxs("details",{className:"ap-lan-reach-fix",children:[c.jsx("summary",{children:"or let them find this deck on their own"}),c.jsxs("p",{className:"lan-note",children:["Run this in PowerShell ",c.jsx("strong",{children:"as Administrator"}),", then restart the deck.",e.reach.category==="Public"&&c.jsx(c.Fragment,{children:" The first line marks this network as a home or office one — leave it out on a network you do not trust."})]}),c.jsx("pre",{className:"ap-lan-cmd",children:c.jsx("code",{children:R.join(`
|
|
80
80
|
`)})}),c.jsx("button",{type:"button",className:"ap-manage-btn",...z("copy:fix"),onClick:()=>void H(R.join(`
|
|
81
|
-
`),"fix"),title:"Copy these lines, then paste them into an elevated PowerShell",children:y==="fix"?"copied":"copy command"})]})]}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h3",{className:"lan-h",children:"By address"}),c.jsxs("div",{className:"ap-lan-row",children:[c.jsx("input",{ref:a,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:l,placeholder:"192.168.1.5:54340",spellCheck:!1,onChange:Q=>d(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&O()}}),l.trim()!==""&&c.jsx("button",{type:"button",className:"ap-manage-btn",...z("add"),onClick:()=>void O(),title:"Try this address every minute, starting now.",children:"add"})]}),c.jsx("p",{className:"lan-note",children:"This deck dials that one and asks to pair; somebody there has to accept. Use it when a deck has not turned up on its own — another subnet, a VPN, or a firewall in the way."})]}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h3",{className:"lan-h",children:"With an invite"}),c.jsxs("div",{className:"ap-lan-row",children:[c.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:f,placeholder:"paste one you were sent",spellCheck:!1,onChange:Q=>{p(Q.target.value),_(null)},onKeyDown:Q=>{Q.key==="Enter"&&D()}}),f.trim()!==""&&c.jsx("button",{type:"button",className:"ap-manage-btn",...z("join"),onClick:()=>void D(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:N==="join"?"joining…":"join"})]}),c.jsx("p",{className:"lan-note",children:"Pasting one pairs the two decks on the spot — nothing to press on either side."}),E&&c.jsxs("div",{className:"ap-lan-tried",children:[c.jsx("span",{className:"lan-note",children:"Nothing answered at any address in that invite. Check that deck is running and that its Local network switch is on."}),E.map(Q=>c.jsxs("span",{className:"ap-lan-tried-row",children:[c.jsx("code",{className:"ap-lan-code",children:Q.addr}),c.jsx("span",{className:"ap-lan-bad",children:Q.why})]},Q.addr))]}),X?c.jsxs("div",{className:"ap-lan-invite",children:[c.jsxs("div",{className:"ap-lan-invite-head",children:[c.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),c.jsxs("span",{className:"ap-lan-invite-left",children:[Xq(X.expiresAt,S)," left"]})]}),c.jsx("code",{className:"ap-lan-token",children:X.token}),c.jsxs("div",{className:"ap-lan-acts",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...z("copy:invite"),onClick:()=>void H(X.token,"invite"),title:"Copy it, and send it however you already talk to them",children:y==="invite"?"copied":"copy"}),c.jsx("button",{type:"button",className:"ap-manage-btn",...z("invite:withdraw"),onClick:()=>void A("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),c.jsx("p",{className:"lan-note",children:"It carries every address this deck has, so they do not have to know which one works."}),c.jsx("p",{className:"lan-warn",children:"Anyone who gets hold of this text can pair with this deck until it runs out."})]}):c.jsx("button",{type:"button",className:"ap-manage-btn lan-add-mint",...z("invite:make"),onClick:()=>void A("make"),title:"One piece of text you send them. They paste it and the two decks pair.",children:"make an invite for them"})]})]})]})})}function Wq({status:e,accounts:t,onClose:n,onChanged:s}){const a=tn(n),[i,l]=b.useState(null),[d,f]=b.useState(null),[p,h]=b.useState(null),g=b.useRef(null),y=_=>{const S=Ia(p,_);return{disabled:S.disabled,"aria-busy":S.busy}},w=b.useRef(null),N=b.useRef(!0);b.useEffect(()=>()=>{N.current=!1},[]),b.useEffect(()=>{w.current&&Kq(w.current,e.shared??[])&&(w.current=null)},[e.shared]);const k=b.useCallback(async(_,S,j="write")=>{g.current=j,h(j);try{const M=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:_})})).json().catch(()=>null);return N.current?(M!=null&&M.ok?f(null):f(en(S,M)),s(),(M==null?void 0:M.ok)===!0):!1}catch{return N.current&&f(en(S,null)),!1}finally{g.current=null,N.current&&h(null)}},[s]),E=new Set(w.current??e.shared??[]);return c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:a,className:"modal lan-modal",onClick:_=>_.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[d&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{className:"ap-failure-text",children:d}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h3",{className:"lan-h",children:"Name"}),c.jsxs("div",{className:"ap-lan-row",children:[c.jsx("span",{className:"ap-lan-label",children:"appear as"}),c.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:i??e.name??"",placeholder:"this machine",onChange:_=>l(_.target.value),onKeyDown:_=>{_.key!=="Enter"||i==null||(k({name:i},"save the name","name"),l(null))}}),i!=null&&i!==(e.name??"")&&c.jsx("button",{type:"button",className:"ap-manage-btn",...y("name"),onClick:()=>{k({name:i},"save the name","name"),l(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),c.jsx("p",{className:"lan-note",children:"Everyone on this network can see this name."}),e.fp&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"ap-lan-row",children:[c.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),c.jsx("code",{className:"ap-lan-code",children:e.fp})]}),c.jsx("p",{className:"lan-note",children:"Read this out when somebody is deciding whether to accept this deck."})]})]}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h3",{className:"lan-h",children:"Share these accounts"}),c.jsx("p",{className:"lan-warn",children:"A login you tick here is a working one, and another deck keeps its own copy. Unticking stops it being offered from now on — it does not take back a copy somebody already has."}),c.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&c.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.jsxs("label",{className:"ap-lan-pick",title:_.alive?"Offer this account to the decks you have paired with, so one whose copy has died can heal from yours":"This deck cannot use this login, so it has nothing to offer — a deck that can will heal it",children:[c.jsx("input",{type:"checkbox",checked:E.has(_.key),onChange:S=>{const j=new Set(w.current??e.shared??[]);S.target.checked?j.add(_.key):j.delete(_.key),w.current=[...j],k({shared:[...j]},S.target.checked?"share that account":"stop sharing that account")}}),c.jsx("span",{className:"ap-lan-pick-name",children:_.email}),!_.alive&&c.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},_.key))]})]})]})]})})}function Wo(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 Hq={"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"}},Gq={"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 Vq(e,t){if(!e)return null;if(e.error)return Hq[e.error]??{text:Gq[e.error]??e.error,tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${Wo(e.at,t)}`,tone:"idle"};const s=n.filter(i=>i.ok),a=s.length===1?"login":"logins";return s.length===n.length?{text:`${s.length} ${a} arrived · ${Wo(e.at,t)}`,tone:"ok"}:{text:`${s.length} of ${n.length} logins arrived · ${Wo(e.at,t)}`,tone:"bad"}}function Yq(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?null:{addr:s,port:a}}function en(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 Kq(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function Xq(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function rR(e,t){var n,s;return(n=e.last)!=null&&n.error?!1:!!((s=e.last)!=null&&s.at&&t-e.last.at<Yu||e.lastSeen!=null&&t-e.lastSeen<Yu)}const Yu=95e3;function Qq(e,t){const n=[],s=[];for(const a of e??[])(rR(a,t)?n:s).push(a);return{online:n,offline:s}}function Zq(e,t){if(!e)return{text:"checking…",tone:"idle"};if(!e.enabled)return{text:"off — this deck is not on the network",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(y=>y.paired!==!1||y.met);if(!s.length)return{text:"no deck paired yet",tone:"idle"};const a=s.filter(y=>y.waiting),i=s.filter(y=>!y.waiting),l=a.filter(y=>{var w;return!((w=y.last)!=null&&w.error)&&y.lastSeen!=null&&t-y.lastSeen<Yu}),{online:d,offline:f}=Qq(i,t),p=[...f,...a.filter(y=>!l.includes(y))],h=d.length+l.length;if(!h)return{text:p.length===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${p.length} decks`,tone:"bad"};const g=h===1?"1 deck ready":`${h} decks ready`;return{text:p.length?`${g} · ${p.length} away`:g,tone:"ok"}}function sR(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 Jq(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<Yu;return{text:n?"online · one-way, it calls in":`one-way · last online ${Wo(e,t)}`,here:n}}function t1(e,t,n){return t?"online":e.lastSeen!=null?`last online ${Wo(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function e5(e,t){if(!e)return[];const n=[],s=new Set,a=(p,h)=>p.name.localeCompare(h.name,void 0,{numeric:!0});for(const p of e.pending??[])!(p!=null&&p.fp)||s.has(p.fp)||(s.add(p.fp),n.push({fp:p.fp,name:p.name||p.fp,addr:p.addr??"",kind:"asks",state:`wants to pair · ${sR(p.at,t)}`,tone:"wait",here:!0,hint:`${p.name||p.fp} at ${p.addr} is waiting for an answer.`}));const i=[],l=[];for(const p of e.peers??[]){const h=p.peerFp??p.fp;if(!h||s.has(h))continue;s.add(h);const g=Vq(p.last,t),y=rR(p,t),w=p.addr?`${p.addr}:${p.port}`:"";if(!p.paired&&p.manual&&!p.met){l.push({fp:w,name:w||p.name||h,addr:p.addr??"",kind:"dialling",state:g?g.text.replace(/ · .*$/,""):"trying…",tone:g?g.tone:"idle",here:!1,hint:g?`Nothing has answered at ${w} yet — ${g.text}.`:`Dialling ${w} every minute until something answers.`});continue}const N=p.waiting?Jq(p.lastSeen,t):null,k=N?N.here:y,E=!N&&g?k?`online · ${g.text.replace(/ · .*$/,"")}`:`${g.text.replace(/ · .*$/,"")} · ${t1(p,k,t)}`:N?N.text:t1(p,k,t);i.push({fp:h,name:p.manual&&!p.met?w:p.name||h,addr:p.addr??"",kind:"paired",state:E,tone:g?g.tone:k?"ok":"idle",here:N?N.here:y,hint:N?`${p.name||h} 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. ${p.lastSeen==null?"It has not called since this deck started.":`It last called ${Wo(p.lastSeen,t)}.`} Add its address with + add a deck to reach it either way.`:`${p.name||h}${w?` at ${w}`:""}`})}n.push(...i.sort(a),...l.sort(a));const d=[];for(const p of e.strangers??[])!(p!=null&&p.fp)||s.has(p.fp)||(s.add(p.fp),d.push({fp:p.fp,name:p.name||p.fp,addr:p.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:`${p.name||p.fp} at ${p.addr} is on this network and nothing is shared with it.`}));n.push(...d.sort(a));const f=[];for(const p of e.declined??[])!(p!=null&&p.fp)||s.has(p.fp)||(s.add(p.fp),f.push({fp:p.fp,name:p.name||p.fp,addr:p.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${p.name||p.fp} asked and was turned away. It is not asking any more.`}));return n.push(...f.sort(a)),n}async function vu(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function t5({accounts:e,onChanged:t}){const[n,s]=b.useState(null),[a,i]=b.useState([]),[l,d]=b.useState(null),[f,p]=b.useState(!1),[h,g]=b.useState(null),[y,w]=b.useState(!1),[N,k]=b.useState(null),E=b.useRef(null),_=b.useCallback(P=>cd(E.current)?(E.current=P,d(P),!0):!1,[]),S=b.useCallback(()=>{E.current=null,$.current&&d(null)},[]),j=P=>{const F=Ia(l,P);return{disabled:F.disabled,"aria-busy":F.busy}},[C,M]=b.useState(()=>Date.now()),$=b.useRef(!0),I=b.useCallback(async()=>{var P,F;try{const[J,L]=await Promise.all([fetch("/api/lan").then(K=>K.json()),fetch("/api/prefs").then(K=>K.json())]);if(!$.current)return;J!=null&&J.ok&&s(J),L!=null&&L.ok&&i(Array.isArray((F=(P=L.prefs)==null?void 0:P.lan)==null?void 0:F.manual)?L.prefs.lan.manual:[])}catch{}},[]);b.useEffect(()=>{$.current=!0,I();const P=window.setInterval(()=>{M(Date.now()),I()},5e3);return()=>{$.current=!1,window.clearInterval(P)}},[I]);const z=b.useCallback(async()=>{const P=(n==null?void 0:n.enabled)===!0;if(_("switch"))try{const F=await vu("/api/prefs",{lan:{enabled:!P}});if(!$.current)return;F!=null&&F.ok?k(null):k(en(P?"turn this off":"turn this on",F)),await I()}catch{$.current&&k(en(P?"turn this off":"turn this on",null))}finally{S()}},[n==null?void 0:n.enabled,I,_,S]),O=b.useCallback(async(P,F,J)=>{if(_(`${P}:${F}`))try{const L=await vu("/api/lan/peer",{action:P,fp:F});if(!$.current)return;L!=null&&L.ok?(s(L),k(null)):k(en(J,L)),await I()}catch{$.current&&k(en(J,null))}finally{S()}},[I,_,S]),A=b.useCallback(async P=>{if(_(`drop:${P}`))try{const F=await vu("/api/prefs",{lan:{manual:a.filter(J=>J!==P)}});if(!$.current)return;F!=null&&F.ok?(k(null),t()):k(en("stop dialling that address",F)),await I()}catch{$.current&&k(en("stop dialling that address",null))}finally{S()}},[a,I,t,_,S]),D=b.useCallback(async()=>{if(_("check"))try{const P=await vu("/api/lan/sync",{});if(!$.current)return;P!=null&&P.ok?(s(P),k(null)):k(en("check the other decks",P)),t()}catch{$.current&&k(en("check the other decks",null))}finally{S()}},[_,S,t]),H=(n==null?void 0:n.enabled)===!0,X=e5(n,C),R=X.filter(P=>P.kind==="asks"),Z=X.filter(P=>P.kind!=="asks"),B=Zq(n,C),Q=Z.filter(P=>P.kind==="paired").length;return c.jsxs("div",{className:"ap-auto ap-lan",children:[c.jsxs("div",{className:"ap-auto-head",children:[c.jsx("h3",{className:"ap-auto-title",children:"Local network"}),c.jsxs("button",{type:"button",className:`ap-auto-state${H?" live":""}`,role:"switch","aria-checked":H,"aria-label":"Local network sync",...j("switch"),onClick:()=>void z(),title:H?"Stop talking to other decks. Nothing is shared while this is off.":"Let the decks you pair with repair this one's expired logins",children:[c.jsx("i",{className:H?"ap-pulse":"ap-dot","aria-hidden":!0}),H?"on":"off"]})]}),c.jsx("p",{className:"ap-auto-note",children:"Decks you pair with repair each other's expired logins."}),c.jsx("p",{className:`ap-lan-status ${B.tone}`,role:"status",children:B.text}),N&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{className:"ap-failure-text",children:N}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>k(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),H&&c.jsxs(c.Fragment,{children:[R.length>0&&c.jsx("div",{className:"ap-lan-asks",role:"alert",children:R.map(P=>c.jsxs("div",{className:"ap-lan-ask",children:[c.jsxs("span",{className:"ap-lan-ask-what",children:[c.jsx("strong",{className:"ap-lan-peer-name",children:P.name})," at ",c.jsx("code",{className:"ap-lan-code",children:P.addr})," wants to pair"]}),c.jsxs("span",{className:"ap-lan-ask-acts",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...j(`accept:${P.fp}`),onClick:()=>void O("accept",P.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${P.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),c.jsx("button",{type:"button",className:"ap-manage-btn",...j(`dismiss:${P.fp}`),onClick:()=>void O("dismiss",P.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},P.fp))}),Z.length>0&&c.jsx("ul",{className:"ap-lan-here",children:Z.map(P=>c.jsxs("li",{className:"ap-lan-who","data-tone":P.tone,title:P.hint,children:[c.jsx("i",{className:P.here?"ap-pulse":"ap-dot","aria-hidden":!0}),c.jsx("span",{className:"ap-lan-who-name",children:P.name}),c.jsx("span",{className:"ap-lan-who-when",children:P.state}),P.kind==="nearby"&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...j(`accept:${P.fp}`),onClick:()=>void O("accept",P.fp,"reach that deck"),"aria-label":`Ask ${P.name} to pair`,title:`Send ${P.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${P.fp}.`,children:"ask"}),P.kind==="paired"&&c.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${h===P.fp?" armed":""}`,...j(`unpair:${P.fp}`),onClick:()=>{if(h!==P.fp){g(P.fp),window.setTimeout(()=>g(F=>F===P.fp?null:F),4e3);return}g(null),O("unpair",P.fp,"unpair that deck")},"aria-label":h===P.fp?`Confirm unpairing ${P.name}`:`Unpair ${P.name}`,title:h===P.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:h===P.fp?"sure?":"unpair"}),P.kind==="dialling"&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...j(`drop:${P.fp}`),onClick:()=>void A(P.fp),"aria-label":`Stop dialling ${P.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),P.kind==="declined"&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...j(`allow:${P.fp}`),onClick:()=>void O("allow",P.fp,"let that deck ask again"),"aria-label":`Let ${P.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${P.kind}:${P.fp}`))}),Z.length===0&&R.length===0&&c.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, ",c.jsx("strong",{children:"+ add a deck"})," reaches one by address or by invite."]}),Q>0&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-check",...j("check"),onClick:()=>void D(),title:"Ask every paired deck now for anything this deck's expired logins need, instead of waiting for the next minute",children:l==="check"?"checking…":"check now"}),c.jsxs("div",{className:"ap-lan-foot",children:[c.jsx("button",{type:"button",className:"ap-lan-word",onClick:()=>w(!0),title:"Reach a deck that has not turned up on its own — by address, or with an invite",children:"+ add a deck"}),c.jsx("button",{type:"button",className:"ap-lan-word",...j("setup"),onClick:()=>p(!0),title:"This deck's name on the network, and which of its logins it offers",children:"name & shared logins"})]})]}),y&&n&&c.jsx(Uq,{status:n,manual:a,onClose:()=>w(!1),onChanged:()=>{I(),t()}}),f&&n&&c.jsx(Wq,{status:{...n,manualRows:a},accounts:e,manual:a,onClose:()=>p(!1),onChanged:()=>{I(),t()}})]})}const n1=15e3,n5=8e3,Sf=1800,r5=3e4,s5=[70,80,85,90,95];function r1(e,t){return GT(t-Math.floor(e/1e3))}function a5(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 o5(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 s1({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?VT(e.resetAt,t):null;return c.jsxs("div",{className:"ap-lane",children:[c.jsx("span",{className:"ap-lane-label",children:e.label}),c.jsx("div",{className:"ap-lane-track",children:c.jsx("div",{className:"ap-lane-fill",style:{width:`${n===0?1.5:n}%`,background:s,opacity:n===0?.4:1}})}),c.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[n,"%"]}),c.jsx("span",{className:"ap-lane-reset",children:a?`resets ${a}`:""})]})}async function a1(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 i5({onClose:e}){var we,Pe,Ue,ot,$e;const[t,n]=b.useState(null),[s,a]=b.useState(null),[i,l]=b.useState(null),[d,f]=b.useState(!1),[p,h]=b.useState(null),[g,y]=b.useState(()=>Math.floor(Date.now()/1e3)),w=b.useRef(null),[N,k]=b.useState(null),[E,_]=b.useState(!1),[S,j]=b.useState(""),[C,M]=b.useState(null),[$,I]=b.useState(null),[z,O]=b.useState(null),[A,D]=b.useState(!1),[H,X]=b.useState(!1),[R,Z]=b.useState(null),[B,Q]=b.useState(null),[P,F]=b.useState(null),[J,L]=b.useState(null),[K,ue]=b.useState(!1),[G,U]=b.useState([]),ee=b.useRef(null),Y=b.useCallback(se=>cd(ee.current)?(ee.current=se,l(se),!0):!1,[]),le=b.useCallback(()=>{ee.current=null,l(null)},[]),fe=(se,Se=!1)=>{const De=Ia(i,se);return{disabled:De.disabled,"aria-busy":De.busy||Se}},me=b.useCallback(se=>{window.requestAnimationFrame(()=>{var Se;if(rD(((Se=document.activeElement)==null?void 0:Se.tagName)??null))for(const De of nD(se)){const _e=document.querySelector(De);if(_e){_e.focus();return}}})},[]),ke=b.useCallback(async(se=!1)=>{se&&f(!0);const Se=new AbortController,De=window.setTimeout(()=>Se.abort(),r5);try{const[_e,Be]=await Promise.all([fetch(`/api/claude-accounts${se?"?refresh=1":""}`,{signal:Se.signal}),fetch("/api/cswap-auto",{signal:Se.signal})]);if(_e.ok){const vt=await _e.json();n(vt),U(Ae=>Dq(Ae,vt.accounts))}Be.ok&&a(await Be.json());const _t=Bq([await Jk(_e),await Jk(Be)]);h(vt=>e1(vt,_t))}catch{h(_e=>e1(_e,zq))}finally{window.clearTimeout(De),se&&f(!1)}},[]),Ve=b.useCallback(async(se,Se)=>{if(!Y(Se))return null;h(null);try{const _e=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)})).json().catch(()=>null);return _e!=null&&_e.ok||h({text:yw(_e,"command failed"),raw:Xo(_e)}),_e}catch{return h({text:"server unreachable"}),null}finally{le()}},[Y,le]),Le=b.useCallback(async(se,Se)=>{if(!Y(Se))return null;h(null);try{const _e=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)})).json().catch(()=>null);return _e!=null&&_e.ok||h({text:Fo(_e,"command failed")}),_e}catch{return h({text:"server unreachable"}),null}finally{le()}},[Y,le]);b.useEffect(()=>(ke(!0),w.current=window.setInterval(()=>ke(!1),n1),()=>{w.current!=null&&window.clearInterval(w.current)}),[ke]),b.useEffect(()=>{const se=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(se)},[]);const qe=((we=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:we.value)??"90",Ne=J??qe,Ge=Iq(Ne,qe),be=(Pe=t==null?void 0:t.accounts)==null?void 0:Pe.find(se=>se.active),re=((Ue=Zk((be==null?void 0:be.lanes)??[]).peak)==null?void 0:Ue.pct)??null,Qe=re!=null&&re>=Number(qe)-15,ft=async se=>{if(Y(`switch-${se}`)){h(null);try{const De=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:se})})).json().catch(()=>null);De!=null&&De.ok||h({text:yw(De,"the switch failed"),raw:Xo(De)}),await ke(!0)}catch{h({text:"server unreachable"})}finally{le(),me(se)}}},ut=async(se,Se)=>{const{commit:De,alias:_e}=Fq(S,Se);if(De){const Be=await Le({action:"alias",account:se,alias:_e},`alias-${se}`);if(await ke(!0),!(Be!=null&&Be.ok))return;j(_e)}M(se),window.setTimeout(()=>M(Be=>Be===se?null:Be),Sf)},at=async(se,Se)=>{const De=await Le({action:"move",account:se,slot:Se},`move-${se}`),_e=Rq({menuFor:N,shareFor:(z==null?void 0:z.num)??null},se,De);if(await ke(!0),_e){k(_e.menuFor),I(_e.confirmRemove),_e.shareFor==null&&(O(null),X(!1)),Z(_e.swapNote);const Be=_e.swapNote;Be&&window.setTimeout(()=>Z(_t=>_t===Be?null:_t),n5),Q(null),me(_e.menuFor)}return De},Ye=async(se,Se,De)=>{if(De.sends){const _e=await at(se,Se);if(!(_e!=null&&_e.ok))return}F(se),window.setTimeout(()=>F(_e=>_e===se?null:_e),Sf)},pe=async(se,Se)=>{if(Se.sends){const De=await Ve({action:"setting",key:"autoswitch.threshold",value:se},"threshold");if(await ke(!0),!(De!=null&&De.ok))return;L(null)}ue(!0),window.setTimeout(()=>ue(!1),Sf)};return c.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[c.jsxs("div",{className:"ap-header",children:[c.jsx("h2",{children:"Accounts"}),c.jsxs("div",{className:"ap-header-right",children:[c.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>_(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),(((ot=t==null?void 0:t.accounts)==null?void 0:ot.length)??0)>0&&c.jsx("button",{type:"button",className:"glyph-btn ap-share-set",onClick:()=>D(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${Ut} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:"↗"}),c.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>ke(!0),...fe("reload",d),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:d?"…":"↻"}),c.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),t==null?p?c.jsxs("div",{className:"ap-empty",role:"alert",children:[c.jsx("span",{title:p.raw||void 0,children:p.text}),c.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",n1/1e3," seconds."]}),c.jsx("button",{type:"button",className:"ap-fix",disabled:d,onClick:()=>ke(!0),children:d?"trying…":"try again"})]}):c.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?c.jsxs(c.Fragment,{children:[c.jsx("ul",{className:"ap-list",children:($e=t.accounts)==null?void 0:$e.map(se=>{const{shown:Se,rest:De,fuller:_e,peak:Be}=Zk(se.lanes),_t=G.includes(t0(se)),vt=$q(De.length,_t,_e);return c.jsxs("li",{className:`ap-account${se.active?" active":""}`,children:[c.jsxs("div",{className:"ap-account-head",children:[c.jsx("span",{className:"ap-num",children:se.num}),se.alias&&c.jsx("span",{className:"ap-alias",title:se.alias,children:se.alias}),c.jsx("span",{className:"ap-email",title:se.email??void 0,children:se.email}),c.jsx("button",{type:"button",id:`ap-more-${se.num}`,className:`ap-more${N===se.num?" on":""}`,"aria-label":`Manage account ${se.num}`,"aria-expanded":N===se.num,"aria-controls":N===se.num?`ap-manage-${se.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{k(N===se.num?null:se.num),j(se.alias??""),I(null),O(null),X(!1),Z(null),M(null),Q(null),F(null)},children:"⋯"}),se.active&&c.jsx("span",{className:"ap-badge-active",children:"active"}),se.disabled&&c.jsx("span",{className:"ap-badge-held",children:"held out"}),!se.active&&!se.disabled&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...fe(`switch-${se.num}`),onClick:()=>ft(se.num),title:`Switch to ${se.alias??se.email}`,children:i===`switch-${se.num}`?"…":"switch"})]}),c.jsx("div",{className:"ap-lanes",id:`ap-lanes-${se.num}`,children:Se.length?c.jsxs(c.Fragment,{children:[Se.map(Ae=>c.jsx(s1,{lane:Ae,nowSec:g},Ae.id)),_t&&De.map(Ae=>c.jsx(s1,{lane:Ae,nowSec:g},Ae.id))]}):c.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),c.jsxs("div",{className:"ap-meta",children:[se.staleCopy&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"ap-stale-copy",title:"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. Resume re-captures the copy from the login you already have.",children:"numbers paused"}),c.jsx("button",{type:"button",className:"ap-fix",...fe("recapture"),onClick:async()=>{const Ae=await Le({action:"recapture"},"recapture");Ae!=null&&Ae.ok&&ke(!0)},title:"Re-capture this account's stored credentials from the login you already have. No sign-in, no switch.",children:i==="recapture"?"resuming…":"resume"})]}),se.error&&(()=>{const Ae=o5(se.error);return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"ap-err",title:Ae.hint,children:Ae.text}),Ae.fixable&&c.jsx("button",{type:"button",className:"ap-fix",onClick:()=>_(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),vt&&c.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":_t,"aria-controls":`ap-lanes-${se.num}`,title:Oq(se.headroom,(Be==null?void 0:Be.label)??null,De.length,_t),onClick:()=>U(Ae=>Lq(Ae,se)),children:vt}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!se.active||se.disabled)&&c.jsx("button",{type:"button",className:"ap-rotate",...fe(`rot-${se.num}`),onClick:()=>Ve({action:"account",account:se.num,enabled:se.disabled},`rot-${se.num}`).then(()=>ke(!0)),title:se.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:se.disabled?"put back":"hold out"}),se.fetchedAt?c.jsxs("span",{className:`ap-age${se.stale?" 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 ",r1(se.fetchedAt,g),a5(se.nextAt,g)]}):c.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),N===se.num&&c.jsxs("div",{className:"ap-manage",id:`ap-manage-${se.num}`,role:"group","aria-label":`Manage account ${se.num}`,children:[c.jsxs("div",{className:"ap-manage-name",children:[c.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${se.num}`,children:"Alias"}),c.jsx("input",{id:`ap-alias-${se.num}`,className:"ap-manage-input",type:"text",value:S,onChange:Ae=>j(Ae.target.value),onKeyDown:Ae=>{Ae.key==="Enter"&&ut(se.num,se.alias)},maxLength:qq,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),c.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`alias-${se.num}`),onClick:()=>ut(se.num,se.alias),title:"A short name to show instead of the email",children:C===se.num?"saved":"save"})]}),(()=>{const Ae=Tq((t.accounts??[]).map(xt=>xt.num),se.num),it=Aq(Ae,B,se.num),wt=Mq(Ae,it,se.num);return c.jsxs("div",{className:"ap-manage-slot",children:[c.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${se.num}`,children:"Slot"}),c.jsx("span",{className:"ap-field",children:c.jsx("select",{id:`ap-slot-${se.num}`,value:String(it),...fe(`move-${se.num}`),onChange:xt=>Q(Number(xt.target.value)),children:Ae.map(xt=>c.jsx("option",{value:xt.slot,children:xt.label},xt.slot))})}),c.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`move-${se.num}`),title:wt.title,onClick:()=>Ye(se.num,it,wt),children:P===se.num?wt.done:wt.label})]})})(),c.jsxs("div",{className:"ap-manage-acts",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`share-${se.num}`),title:`Copy this account to another ${Ut}. 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()=>{X(!1);const Ae=await Le({action:"share",account:se.num},`share-${se.num}`);Ae!=null&&Ae.ok&&O({num:se.num,blob:Ae.blob,expiresAt:Ae.expiresAt})},children:"share"}),c.jsx("button",{type:"button",className:`ap-manage-btn danger${$===se.num?" armed":""}`,...fe(`rm-${se.num}`),title:$===se.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if($!==se.num){I(se.num),window.setTimeout(()=>I(Ae=>Ae===se.num?null:Ae),4e3);return}I(null),Le({action:"remove",account:se.num},`rm-${se.num}`).then(()=>{k(null),ke(!0),me(null)})},children:$===se.num?"confirm":"remove"})]}),(R==null?void 0:R.at)===se.num&&(()=>{var wt;const Ae=(wt=t.accounts)==null?void 0:wt.find(xt=>xt.num===R.displaced),it=(Ae==null?void 0:Ae.alias)??(Ae==null?void 0:Ae.email)??"the account that was there";return c.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${R.at} was taken, so the two accounts traded places: ${it} now holds slot ${R.displaced}.`,children:["swapped with slot ",R.displaced]})})(),(z==null?void 0:z.num)===se.num&&(()=>{const Ae=nR(z.expiresAt,g),it=Ae.tone==="gone";return c.jsxs("div",{className:`ap-share${it?" expired":""}`,children:[c.jsx("code",{className:"ap-share-blob",children:z.blob}),c.jsxs("div",{className:"ap-share-foot",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`share-${se.num}`),onClick:async()=>{if(it){X(!1);const wt=await Le({action:"share",account:se.num},`share-${se.num}`);wt!=null&&wt.ok&&O({num:se.num,blob:wt.blob,expiresAt:wt.expiresAt});return}await a1(z.blob)&&(X(!0),window.setTimeout(()=>X(!1),1800))},children:it?"make a new share":H?"copied":"copy"}),c.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:[c.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",c.jsx("span",{className:`ap-share-expiry ${Ae.tone}`,children:Ae.text})]})]})]})})()]})]},se.num)})}),(s==null?void 0:s.ok)&&c.jsxs("div",{className:"ap-auto",children:[c.jsxs("div",{className:"ap-auto-head",children:[c.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),c.jsxs("span",{className:"ap-auto-ctl",children:[re!=null&&c.jsxs("span",{className:`ap-auto-now${Qe?" near":""}`,children:[Math.round(re),"%"]}),c.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:c.jsx("select",{"aria-label":"Switch threshold",value:Ne,...fe("threshold"),onChange:se=>L(se.target.value),children:s5.map(se=>c.jsxs("option",{value:se,children:[se,"%"]},se))})}),c.jsx("button",{type:"button",className:"ap-manage-btn",...fe("threshold"),title:Ge.title,onClick:()=>pe(Ne,Ge),children:K?Ge.done:Ge.label}),c.jsxs("button",{type:"button",className:`ap-auto-state${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",...fe("enable"),onClick:()=>Ve({action:"enable",enabled:!s.enabled},"enable").then(()=>ke(!0)),title:s.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[c.jsx("i",{className:s.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),s.enabled?"on":"off"]})]})]}),s.external&&c.jsxs("p",{className:"ap-auto-note",children:[c.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",c.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",s.enabled?" — this toggle takes over when you stop it.":"."]}),s.lastTick&&c.jsx("div",{className:"ap-auto-foot",children:c.jsxs("span",{className:"ap-auto-result",children:["checked ",r1(s.lastTick.at,g)]})})]}),p&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>h(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),c.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."}),c.jsx(t5,{accounts:((t==null?void 0:t.accounts)??[]).map(se=>({key:`${String(se.email??"").trim().toLowerCase()}@@${se.orgUuid??""}`,email:se.email??"",alive:se.alive===!0})),onChanged:()=>ke(!0)})]}):c.jsx("div",{className:"ap-empty",children:t.reason==="no_cswap"?c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"claude-swap isn't installed."}),c.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."}),t.hint&&c.jsx("code",{className:"ap-cmd",children:t.hint}),c.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",c.jsx("strong",{children:"+"})," button above."]})]}):t.reason==="no_accounts"?c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"No accounts added yet."}),c.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",c.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"Couldn't read the account store."}),c.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",t.reason?` (${t.reason})`:"","."]})]})}),E&&c.jsx(Nq,{onClose:()=>_(!1),onChanged:()=>ke(!0)}),A&&c.jsx(Cq,{accounts:((t==null?void 0:t.accounts)??[]).map(se=>({num:se.num,email:se.email,alias:se.alias,org:se.org})),onClose:()=>D(!1),copyText:a1})]})}const l5=3e4;function c5({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function u5({bundle:e,running:t,pending:n,lastTried:s}){return t?c5({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function d5(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function h5({asked:e,reported:t}){return t?t!==e:!1}function aR(e){const t=e.thresholdMs??l5;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 f5(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 p5(e,t){return e?t==null?"auto when idle":`auto in ${f5(t)}`:"auto-restart off"}function o1(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function m5(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 g5(e){const t=aR(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 oR(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 y5(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function v5(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 w5(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function x5(e,t){const n=w5(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`,f=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${a(`leaves the event log alone: ${d}${f}`)}. 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 i=t.decks-1,l=i===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 ${i===1?"1 other running deck shares":`${i} other running decks share`} with this one`)} — every session recorded in it, not just the ones drawn here. ${l} This cannot be undone.`,confirm:"Clear everything"}}function b5({agentCount:e,onConfirm:t,onCancel:n}){const s=b.useRef(null),a=tn(n,{focusRef:s,layer:y3}),[i,l]=b.useState(null);b.useEffect(()=>{let p=!1;return fetch("/api/clear").then(h=>h.ok?h.json():null).then(h=>{p||l(v5(h))}).catch(()=>{}),()=>{p=!0}},[]);const{note:d,confirm:f}=x5(e,i);return c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{className:"status-dot err","aria-hidden":!0}),c.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsx("p",{className:"modal-note",children:d}),c.jsxs("div",{className:"cc-actions",children:[c.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),c.jsx("button",{type:"button",className:"btn danger",onClick:t,children:f})]})]})]})})}const k5="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.",_5=[{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 S5({onClose:e}){const t=tn(e);return c.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:c.jsxs("div",{ref:t,className:"modal key-help",onClick:n=>n.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsx("p",{className:"modal-note",children:k5}),c.jsx("div",{className:"shortcuts",children:_5.map(n=>c.jsxs(b.Fragment,{children:[c.jsx("h3",{className:"kh-group",children:n.title}),n.rows.map(s=>c.jsxs("div",{className:"sc",children:[c.jsx("kbd",{children:s.cap}),c.jsx("span",{children:s.action})]},`${n.title}:${s.cap}:${s.action}`))]},n.title))})]})]})})}const N5=["done","needs-input"],E5=[{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}]}],j5=[{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}]}],n0={done:E5,"needs-input":j5},Qo="two";function ww(e,t){const n=n0[e];return n.find(s=>s.id===t)??n.find(s=>s.id===Qo)??n[0]}function iR(e,t){return n0[e].some(s=>s.id===t)?t:Qo}ww("done",Qo).notes,ww("needs-input",Qo).notes;const i1=.04,C5=.24,Iu=0,Ku=100,xw=5,Rl=50;function Al(e){if(!Number.isFinite(e))return Rl;const t=Math.round(e/xw)*xw;return Math.min(Ku,Math.max(Iu,t))}function T5(e){if(e==null)return Rl;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?Al(Number(t)):Rl}function R5(e){const t=Al(e),n=i1+(C5-i1)*(t/Ku);return Math.round(n*1e4)/1e4}function A5(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(R5(e)*s*1e4)/1e4}const M5=160,I5="agent-dag.soundLevel.done",$5="agent-dag.soundLevel.needs-input",O5="agent-dag.soundFigure.done",P5="agent-dag.soundFigure.needs-input",lR={done:I5,"needs-input":$5},cR={done:O5,"needs-input":P5},bw={done:{level:Rl,figure:Qo},"needs-input":{level:Rl,figure:Qo}};function L5(e){const t=n=>({level:T5(e(lR[n])),figure:iR(n,e(cR[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const D5={Stop:"done",Notification:"needs-input"};function q5(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:D5[n]??null}function F5(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,s=!1;const a=()=>e.enabled()?s&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",i=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,a())};function l(){var f;if(!(!t||s))try{n=n??new t,(f=n.resume)==null||f.call(n).then(i,()=>{}),s=!0,i()}catch{}}function d(f,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const h=(((N=e.prefs)==null?void 0:N.call(e))??bw)[f]??bw[f],g=ww(f,h.figure),y=A5(h.level,g),w=n.currentTime;for(const k of g.notes){const E=n.createOscillator(),_=n.createGain();E.type=g.type??"sine",E.frequency.value=k.hz;const S=w+k.at,j=S+k.ms/1e3;_.gain.setValueAtTime(1e-4,S),_.gain.exponentialRampToValueAtTime(y,S+.012),_.gain.exponentialRampToValueAtTime(1e-4,j),E.connect(_).connect(n.destination),E.start(S),E.stop(j+.02)}return!0}return{unlock:l,play:d,state:a,get context(){return n}}}const z5="Notify me when a session needs my attention.",B5="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",l1="Get notified when you're away from this tab.";function U5(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:l1};case"default":return{status:null,ask:!0,ok:!1,note:l1};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 c1={done:"Turn finished","needs-input":"Claude is asking"},W5={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function H5({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:a,onFigure:i,onPreview:l,openerRef:d,notifyOn:f,onToggleNotify:p,notifyVetoed:h,notifyPermission:g,onAskNotify:y}){const w=U5(g),N=f&&!h,k=tn(e),E=b.useRef(e);return E.current=e,b.useEffect(()=>{const _=S=>{var C,M;const j=S.target;j&&((C=k.current)!=null&&C.contains(j)||(M=d.current)!=null&&M.contains(j)||E.current())};return window.addEventListener("pointerdown",_,!0),()=>window.removeEventListener("pointerdown",_,!0)},[k,d]),c.jsxs("div",{ref:k,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[c.jsxs("div",{className:"sm-switches",children:[c.jsxs("label",{className:"sm-switch",children:[c.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),c.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:c.jsx("span",{className:"sm-toggle-knob"})})]}),c.jsxs("div",{className:"sm-setting",children:[c.jsxs("label",{className:"sm-switch",children:[c.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),c.jsx("button",{type:"button",role:"switch","aria-checked":f,"aria-labelledby":"sm-notify-label",className:"sm-toggle",onClick:p,title:"A system notification when a session blocks on you",children:c.jsx("span",{className:"sm-toggle-knob"})})]}),c.jsx("p",{className:"sm-note",children:h?B5:z5})]})]}),N&&c.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[c.jsxs("div",{className:"sm-channel-head",children:[c.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),w.ask?c.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:y,children:"Enable"}):c.jsxs("span",{className:"sm-channel-state","data-ok":w.ok||void 0,children:[w.ok&&c.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:c.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),w.status]})]}),c.jsx("p",{className:"sm-note",children:w.note})]}),!t&&c.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."}),c.jsx("div",{className:"sm-tones",children:N5.map(_=>{const S=s[_],j=`sm-level-${_}`,C=`sm-figure-${_}`;return c.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${_}`,children:[c.jsxs("div",{className:"sm-tone-head",children:[c.jsx("h3",{className:"sm-tone-name",id:`sm-name-${_}`,children:c1[_]}),c.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(_),"aria-label":`Hear the ${c1[_].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:[c.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:c.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),c.jsxs("div",{className:"sm-row",children:[c.jsx("label",{htmlFor:j,children:"Volume"}),c.jsx("input",{id:j,type:"range",min:Iu,max:Ku,step:xw,value:S.level,onChange:M=>a(_,Number(M.target.value)),style:{"--sm-level":`${(S.level-Iu)/(Ku-Iu)*100}%`}}),c.jsxs("span",{className:"sm-read",children:[S.level,"%"]})]}),c.jsxs("div",{className:"sm-row",children:[c.jsx("label",{htmlFor:C,children:"Tone"}),c.jsx("select",{id:C,className:"sm-select",value:S.figure,onChange:M=>i(_,M.target.value),children:n0[_].map(M=>c.jsx("option",{value:M.id,children:M.label},M.id))})]}),c.jsx("p",{className:"sm-note",children:W5[_]})]},_)})}),c.jsxs("p",{className:"sm-foot",children:[c.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const G5={"//":["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.18.0":[{title:"🟢 A deck that is switched off no longer reads as on",body:"A paired deck this one has no address for was drawn **live** on the strength of being paired — a machine closed an hour ago still sat under `1 deck ready`. Every row now leads with whether that machine is actually there, and when it last was: `online · 1 login arrived`, `no answer · last online 20m ago`, `never reached`. The mark beside the name is a traffic light — green for a deck that answered, amber for one that cannot be reached, grey for one nothing has heard from.\n\n**+ add a deck** opens a dialog now instead of unfolding inside the panel. An address, an invite and the firewall note never fitted a 288px column, and unfolded they turned a list of machines into a form."}],"3.17.0":[{title:"🔔 Pairing is two presses",body:`When another deck asks to pair, the question now arrives **over the deck** rather than in a row three sections down a panel: its name, its address, the fingerprint to compare, **Accept** or **Decline**. Escape means later — the request stays in the panel until you answer it.
|
|
81
|
+
`),"fix"),title:"Copy these lines, then paste them into an elevated PowerShell",children:y==="fix"?"copied":"copy command"})]})]}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h3",{className:"lan-h",children:"By address"}),c.jsxs("div",{className:"ap-lan-row",children:[c.jsx("input",{ref:a,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:l,placeholder:"192.168.1.5:54340",spellCheck:!1,onChange:Q=>d(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&O()}}),l.trim()!==""&&c.jsx("button",{type:"button",className:"ap-manage-btn",...z("add"),onClick:()=>void O(),title:"Try this address every minute, starting now.",children:"add"})]}),c.jsx("p",{className:"lan-note",children:"This deck dials that one and asks to pair; somebody there has to accept. Use it when a deck has not turned up on its own — another subnet, a VPN, or a firewall in the way."})]}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h3",{className:"lan-h",children:"With an invite"}),c.jsxs("div",{className:"ap-lan-row",children:[c.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:f,placeholder:"paste one you were sent",spellCheck:!1,onChange:Q=>{p(Q.target.value),_(null)},onKeyDown:Q=>{Q.key==="Enter"&&D()}}),f.trim()!==""&&c.jsx("button",{type:"button",className:"ap-manage-btn",...z("join"),onClick:()=>void D(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:N==="join"?"joining…":"join"})]}),c.jsx("p",{className:"lan-note",children:"Pasting one pairs the two decks on the spot — nothing to press on either side."}),E&&c.jsxs("div",{className:"ap-lan-tried",children:[c.jsx("span",{className:"lan-note",children:"Nothing answered at any address in that invite. Check that deck is running and that its Local network switch is on."}),E.map(Q=>c.jsxs("span",{className:"ap-lan-tried-row",children:[c.jsx("code",{className:"ap-lan-code",children:Q.addr}),c.jsx("span",{className:"ap-lan-bad",children:Q.why})]},Q.addr))]}),X?c.jsxs("div",{className:"ap-lan-invite",children:[c.jsxs("div",{className:"ap-lan-invite-head",children:[c.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),c.jsxs("span",{className:"ap-lan-invite-left",children:[Zq(X.expiresAt,S)," left"]})]}),c.jsx("code",{className:"ap-lan-token",children:X.token}),c.jsxs("div",{className:"ap-lan-acts",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...z("copy:invite"),onClick:()=>void H(X.token,"invite"),title:"Copy it, and send it however you already talk to them",children:y==="invite"?"copied":"copy"}),c.jsx("button",{type:"button",className:"ap-manage-btn",...z("invite:withdraw"),onClick:()=>void A("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),c.jsx("p",{className:"lan-note",children:"It carries every address this deck has, so they do not have to know which one works."}),c.jsx("p",{className:"lan-warn",children:"Anyone who gets hold of this text can pair with this deck until it runs out."})]}):c.jsx("button",{type:"button",className:"ap-manage-btn lan-add-mint",...z("invite:make"),onClick:()=>void A("make"),title:"One piece of text you send them. They paste it and the two decks pair.",children:"make an invite for them"})]})]})]})})}function Hq({status:e,accounts:t,onClose:n,onChanged:s}){const a=tn(n),[i,l]=b.useState(null),[d,f]=b.useState(null),[p,h]=b.useState(null),g=b.useRef(null),y=_=>{const S=Ia(p,_);return{disabled:S.disabled,"aria-busy":S.busy}},w=b.useRef(null),N=b.useRef(!0);b.useEffect(()=>()=>{N.current=!1},[]),b.useEffect(()=>{w.current&&Qq(w.current,e.shared??[])&&(w.current=null)},[e.shared]);const k=b.useCallback(async(_,S,j="write")=>{g.current=j,h(j);try{const M=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:_})})).json().catch(()=>null);return N.current?(M!=null&&M.ok?f(null):f(en(S,M)),s(),(M==null?void 0:M.ok)===!0):!1}catch{return N.current&&f(en(S,null)),!1}finally{g.current=null,N.current&&h(null)}},[s]),E=new Set(w.current??e.shared??[]);return c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:a,className:"modal lan-modal",onClick:_=>_.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[d&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{className:"ap-failure-text",children:d}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h3",{className:"lan-h",children:"Name"}),c.jsxs("div",{className:"ap-lan-row",children:[c.jsx("span",{className:"ap-lan-label",children:"appear as"}),c.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:i??e.name??"",placeholder:"this machine",onChange:_=>l(_.target.value),onKeyDown:_=>{_.key!=="Enter"||i==null||(k({name:i},"save the name","name"),l(null))}}),i!=null&&i!==(e.name??"")&&c.jsx("button",{type:"button",className:"ap-manage-btn",...y("name"),onClick:()=>{k({name:i},"save the name","name"),l(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),c.jsx("p",{className:"lan-note",children:"Everyone on this network can see this name."}),e.fp&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"ap-lan-row",children:[c.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),c.jsx("code",{className:"ap-lan-code",children:e.fp})]}),c.jsx("p",{className:"lan-note",children:"Read this out when somebody is deciding whether to accept this deck."})]})]}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h3",{className:"lan-h",children:"Share these accounts"}),c.jsx("p",{className:"lan-warn",children:"A login you tick here is a working one, and another deck keeps its own copy. Unticking stops it being offered from now on — it does not take back a copy somebody already has."}),c.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&c.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.jsxs("label",{className:"ap-lan-pick",title:_.alive?"Offer this account to the decks you have paired with, so one whose copy has died can heal from yours":"This deck cannot use this login, so it has nothing to offer — a deck that can will heal it",children:[c.jsx("input",{type:"checkbox",checked:E.has(_.key),onChange:S=>{const j=new Set(w.current??e.shared??[]);S.target.checked?j.add(_.key):j.delete(_.key),w.current=[...j],k({shared:[...j]},S.target.checked?"share that account":"stop sharing that account")}}),c.jsx("span",{className:"ap-lan-pick-name",children:_.email}),!_.alive&&c.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},_.key))]})]})]})]})})}function Wo(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 n0={"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"}},Gq={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 Vq(e){var s;const t=Yq[e];if(t)return t;const n=(s=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:s[1];return n&&Gq[n]||e}const Yq={"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 Kq(e,t){if(!e)return null;if(e.error)return n0[e.error]??{text:Vq(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${Wo(e.at,t)}`,tone:"idle"};const s=n.filter(i=>i.ok),a=s.length===1?"login":"logins";return s.length===n.length?{text:`${s.length} ${a} arrived · ${Wo(e.at,t)}`,tone:"ok"}:{text:`${s.length} of ${n.length} logins arrived · ${Wo(e.at,t)}`,tone:"bad"}}function Xq(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?null:{addr:s,port:a}}function en(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 Qq(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function Zq(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function sR(e,t){var n,s;return(n=e.last)!=null&&n.error&&!n0[e.last.error]?!1:!!((s=e.last)!=null&&s.at&&t-e.last.at<Yu||e.lastSeen!=null&&t-e.lastSeen<Yu)}const Yu=95e3;function Jq(e,t){const n=[],s=[];for(const a of e??[])(sR(a,t)?n:s).push(a);return{online:n,offline:s}}function e5(e,t){if(!e)return{text:"checking…",tone:"idle"};if(!e.enabled)return{text:"off — this deck is not on the network",tone:"idle"};if(e.stalled)return{text:`could not start — ${e.stalled}`,tone:"bad"};if(!e.running)return{text:"starting…",tone:"wait"};const n=(e.pending??[]).length;if(n)return{text:n===1?"1 deck is waiting for your answer":`${n} decks are waiting for your answer`,tone:"wait"};const s=(e.peers??[]).filter(w=>w.paired!==!1||w.met);if(!s.length)return{text:"no deck paired yet",tone:"idle"};const a=s.filter(w=>w.waiting),i=s.filter(w=>!w.waiting),l=a.filter(w=>{var N;return!((N=w.last)!=null&&N.error)&&w.lastSeen!=null&&t-w.lastSeen<Yu}),{online:d,offline:f}=Jq(i,t),p=[...f,...a.filter(w=>!l.includes(w))],h=d.length+l.length,g=d.filter(w=>{var N;return((N=w.last)==null?void 0:N.error)==="waiting for the other deck to accept this one"});if(h&&g.length===h)return{text:h===1?"1 deck found · waiting for them to accept":`${h} decks found · waiting for them to accept`,tone:"wait"};if(!h)return{text:p.length===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${p.length} decks`,tone:"bad"};const y=h===1?"1 deck ready":`${h} decks ready`;return{text:p.length?`${y} · ${p.length} away`:y,tone:"ok"}}function aR(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 t5(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<Yu;return{text:n?"online · one-way, it calls in":`one-way · last online ${Wo(e,t)}`,here:n}}function n1(e,t,n){return t?"online":e.lastSeen!=null?`last online ${Wo(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function n5(e,t){var p,h,g;if(!e)return[];const n=[],s=new Set,a=(y,w)=>y.name.localeCompare(w.name,void 0,{numeric:!0});for(const y of e.pending??[])!(y!=null&&y.fp)||s.has(y.fp)||(s.add(y.fp),n.push({fp:y.fp,name:y.name||y.fp,addr:y.addr??"",kind:"asks",state:`wants to pair · ${aR(y.at,t)}`,tone:"wait",here:!0,hint:`${y.name||y.fp} at ${y.addr} is waiting for an answer.`}));const i=[],l=[];for(const y of e.peers??[]){const w=y.peerFp??y.fp;if(!w||s.has(w))continue;s.add(w);const N=Kq(y.last,t),k=sR(y,t),E=y.addr?`${y.addr}:${y.port}`:"";if(!y.paired&&y.manual&&!y.met){l.push({fp:E,name:E||y.name||w,addr:y.addr??"",kind:"dialling",state:N?N.text.replace(/ · .*$/,""):"trying…",tone:N?N.tone:"idle",here:!1,hint:(p=y.last)!=null&&p.error?`Nothing has answered at ${E} yet — ${y.last.error}.`:`Dialling ${E} until something answers.`});continue}const _=y.waiting?t5(y.lastSeen,t):null,S=_?_.here:k,j=!_&&N?S?`online · ${N.text.replace(/ · .*$/,"")}`:`${N.text.replace(/ · .*$/,"")} · ${n1(y,S,t)}`:_?_.text:n1(y,S,t),C=(h=y.last)!=null&&h.error?n0[y.last.error]:null;i.push({fp:w,name:y.manual&&!y.met?E:y.name||w,addr:y.addr??"",kind:"paired",state:j,tone:C?C.tone==="bad"?"bad":"wait":N?N.tone:S?"ok":"idle",here:_?_.here:k,hint:_?`${y.name||w} 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. ${y.lastSeen==null?"It has not called since this deck started.":`It last called ${Wo(y.lastSeen,t)}.`} Add its address with + add a deck to reach it either way.`:`${y.name||w}${E?` at ${E}`:""}${(g=y.last)!=null&&g.error?` — ${y.last.error}`:""}`})}n.push(...i.sort(a),...l.sort(a));const d=[];for(const y of e.strangers??[])!(y!=null&&y.fp)||s.has(y.fp)||(s.add(y.fp),d.push({fp:y.fp,name:y.name||y.fp,addr:y.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:`${y.name||y.fp} at ${y.addr} is on this network and nothing is shared with it.`}));n.push(...d.sort(a));const f=[];for(const y of e.declined??[])!(y!=null&&y.fp)||s.has(y.fp)||(s.add(y.fp),f.push({fp:y.fp,name:y.name||y.fp,addr:y.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${y.name||y.fp} asked and was turned away. It is not asking any more.`}));return n.push(...f.sort(a)),n}async function vu(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function r5({accounts:e,onChanged:t}){const[n,s]=b.useState(null),[a,i]=b.useState([]),[l,d]=b.useState(null),[f,p]=b.useState(!1),[h,g]=b.useState(null),[y,w]=b.useState(!1),[N,k]=b.useState(null),E=b.useRef(null),_=b.useCallback(P=>cd(E.current)?(E.current=P,d(P),!0):!1,[]),S=b.useCallback(()=>{E.current=null,$.current&&d(null)},[]),j=P=>{const F=Ia(l,P);return{disabled:F.disabled,"aria-busy":F.busy}},[C,M]=b.useState(()=>Date.now()),$=b.useRef(!0),I=b.useCallback(async()=>{var P,F;try{const[J,L]=await Promise.all([fetch("/api/lan").then(K=>K.json()),fetch("/api/prefs").then(K=>K.json())]);if(!$.current)return;J!=null&&J.ok&&s(J),L!=null&&L.ok&&i(Array.isArray((F=(P=L.prefs)==null?void 0:P.lan)==null?void 0:F.manual)?L.prefs.lan.manual:[])}catch{}},[]);b.useEffect(()=>{$.current=!0,I();const P=window.setInterval(()=>{M(Date.now()),I()},5e3);return()=>{$.current=!1,window.clearInterval(P)}},[I]);const z=b.useCallback(async()=>{const P=(n==null?void 0:n.enabled)===!0;if(_("switch"))try{const F=await vu("/api/prefs",{lan:{enabled:!P}});if(!$.current)return;F!=null&&F.ok?k(null):k(en(P?"turn this off":"turn this on",F)),await I()}catch{$.current&&k(en(P?"turn this off":"turn this on",null))}finally{S()}},[n==null?void 0:n.enabled,I,_,S]),O=b.useCallback(async(P,F,J)=>{if(_(`${P}:${F}`))try{const L=await vu("/api/lan/peer",{action:P,fp:F});if(!$.current)return;L!=null&&L.ok?(s(L),k(null)):k(en(J,L)),await I()}catch{$.current&&k(en(J,null))}finally{S()}},[I,_,S]),A=b.useCallback(async P=>{if(_(`drop:${P}`))try{const F=await vu("/api/prefs",{lan:{manual:a.filter(J=>J!==P)}});if(!$.current)return;F!=null&&F.ok?(k(null),t()):k(en("stop dialling that address",F)),await I()}catch{$.current&&k(en("stop dialling that address",null))}finally{S()}},[a,I,t,_,S]),D=b.useCallback(async()=>{if(_("check"))try{const P=await vu("/api/lan/sync",{});if(!$.current)return;P!=null&&P.ok?(s(P),k(null)):k(en("check the other decks",P)),t()}catch{$.current&&k(en("check the other decks",null))}finally{S()}},[_,S,t]),H=(n==null?void 0:n.enabled)===!0,X=n5(n,C),R=X.filter(P=>P.kind==="asks"),Z=X.filter(P=>P.kind!=="asks"),B=e5(n,C),Q=Z.filter(P=>P.kind==="paired").length;return c.jsxs("div",{className:"ap-auto ap-lan",children:[c.jsxs("div",{className:"ap-auto-head",children:[c.jsx("h3",{className:"ap-auto-title",children:"Local network"}),c.jsxs("button",{type:"button",className:`ap-auto-state${H?" live":""}`,role:"switch","aria-checked":H,"aria-label":"Local network sync",...j("switch"),onClick:()=>void z(),title:H?"Stop talking to other decks. Nothing is shared while this is off.":"Let the decks you pair with repair this one's expired logins",children:[c.jsx("i",{className:H?"ap-pulse":"ap-dot","aria-hidden":!0}),H?"on":"off"]})]}),c.jsx("p",{className:"ap-auto-note",children:"Decks you pair with repair each other's expired logins."}),c.jsx("p",{className:`ap-lan-status ${B.tone}`,role:"status",children:B.text}),N&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{className:"ap-failure-text",children:N}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>k(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),H&&c.jsxs(c.Fragment,{children:[R.length>0&&c.jsx("div",{className:"ap-lan-asks",role:"alert",children:R.map(P=>c.jsxs("div",{className:"ap-lan-ask",children:[c.jsxs("span",{className:"ap-lan-ask-what",children:[c.jsx("strong",{className:"ap-lan-peer-name",children:P.name})," at ",c.jsx("code",{className:"ap-lan-code",children:P.addr})," wants to pair"]}),c.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",c.jsx("code",{className:"ap-lan-code",children:P.fp})]}),c.jsxs("span",{className:"ap-lan-ask-acts",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...j(`accept:${P.fp}`),onClick:()=>void O("accept",P.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${P.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),c.jsx("button",{type:"button",className:"ap-manage-btn",...j(`dismiss:${P.fp}`),onClick:()=>void O("dismiss",P.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},P.fp))}),Z.length>0&&c.jsx("ul",{className:"ap-lan-here",children:Z.map(P=>c.jsxs("li",{className:"ap-lan-who","data-tone":P.tone,title:P.hint,children:[c.jsx("i",{className:P.here?"ap-pulse":"ap-dot","aria-hidden":!0}),c.jsx("span",{className:"ap-lan-who-name",children:P.name}),c.jsx("span",{className:"ap-lan-who-when",children:P.state}),P.kind==="nearby"&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...j(`accept:${P.fp}`),onClick:()=>void O("accept",P.fp,"reach that deck"),"aria-label":`Ask ${P.name} to pair`,title:`Send ${P.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${P.fp}.`,children:"ask"}),P.kind==="paired"&&c.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${h===P.fp?" armed":""}`,...j(`unpair:${P.fp}`),onClick:()=>{if(h!==P.fp){g(P.fp),window.setTimeout(()=>g(F=>F===P.fp?null:F),4e3);return}g(null),O("unpair",P.fp,"unpair that deck")},"aria-label":h===P.fp?`Confirm unpairing ${P.name}`:`Unpair ${P.name}`,title:h===P.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:h===P.fp?"sure?":"unpair"}),P.kind==="dialling"&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...j(`drop:${P.fp}`),onClick:()=>void A(P.fp),"aria-label":`Stop dialling ${P.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),P.kind==="declined"&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...j(`allow:${P.fp}`),onClick:()=>void O("allow",P.fp,"let that deck ask again"),"aria-label":`Let ${P.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${P.kind}:${P.fp}`))}),Z.length===0&&R.length===0&&c.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, ",c.jsx("strong",{children:"+ add a deck"})," reaches one by address or by invite."]}),Q>0&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-check",...j("check"),onClick:()=>void D(),title:"Ask every paired deck now for anything this deck's expired logins need, instead of waiting for the next minute",children:l==="check"?"checking…":"check now"}),c.jsxs("div",{className:"ap-lan-foot",children:[c.jsx("button",{type:"button",className:"ap-lan-word",onClick:()=>w(!0),title:"Reach a deck that has not turned up on its own — by address, or with an invite",children:"+ add a deck"}),c.jsx("button",{type:"button",className:"ap-lan-word",...j("setup"),onClick:()=>p(!0),title:"This deck's name on the network, and which of its logins it offers",children:"name & shared logins"})]})]}),y&&n&&c.jsx(Wq,{status:n,manual:a,onClose:()=>w(!1),onChanged:()=>{I(),t()}}),f&&n&&c.jsx(Hq,{status:{...n,manualRows:a},accounts:e,manual:a,onClose:()=>p(!1),onChanged:()=>{I(),t()}})]})}const r1=15e3,s5=8e3,Sf=1800,a5=3e4,o5=[70,80,85,90,95];function s1(e,t){return VT(t-Math.floor(e/1e3))}function i5(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 l5(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 a1({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?YT(e.resetAt,t):null;return c.jsxs("div",{className:"ap-lane",children:[c.jsx("span",{className:"ap-lane-label",children:e.label}),c.jsx("div",{className:"ap-lane-track",children:c.jsx("div",{className:"ap-lane-fill",style:{width:`${n===0?1.5:n}%`,background:s,opacity:n===0?.4:1}})}),c.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[n,"%"]}),c.jsx("span",{className:"ap-lane-reset",children:a?`resets ${a}`:""})]})}async function o1(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 c5({onClose:e}){var we,Pe,Ue,ot,$e;const[t,n]=b.useState(null),[s,a]=b.useState(null),[i,l]=b.useState(null),[d,f]=b.useState(!1),[p,h]=b.useState(null),[g,y]=b.useState(()=>Math.floor(Date.now()/1e3)),w=b.useRef(null),[N,k]=b.useState(null),[E,_]=b.useState(!1),[S,j]=b.useState(""),[C,M]=b.useState(null),[$,I]=b.useState(null),[z,O]=b.useState(null),[A,D]=b.useState(!1),[H,X]=b.useState(!1),[R,Z]=b.useState(null),[B,Q]=b.useState(null),[P,F]=b.useState(null),[J,L]=b.useState(null),[K,ue]=b.useState(!1),[G,U]=b.useState([]),ee=b.useRef(null),Y=b.useCallback(se=>cd(ee.current)?(ee.current=se,l(se),!0):!1,[]),le=b.useCallback(()=>{ee.current=null,l(null)},[]),fe=(se,Se=!1)=>{const De=Ia(i,se);return{disabled:De.disabled,"aria-busy":De.busy||Se}},me=b.useCallback(se=>{window.requestAnimationFrame(()=>{var Se;if(sD(((Se=document.activeElement)==null?void 0:Se.tagName)??null))for(const De of rD(se)){const _e=document.querySelector(De);if(_e){_e.focus();return}}})},[]),ke=b.useCallback(async(se=!1)=>{se&&f(!0);const Se=new AbortController,De=window.setTimeout(()=>Se.abort(),a5);try{const[_e,Be]=await Promise.all([fetch(`/api/claude-accounts${se?"?refresh=1":""}`,{signal:Se.signal}),fetch("/api/cswap-auto",{signal:Se.signal})]);if(_e.ok){const vt=await _e.json();n(vt),U(Ae=>qq(Ae,vt.accounts))}Be.ok&&a(await Be.json());const _t=Uq([await e1(_e),await e1(Be)]);h(vt=>t1(vt,_t))}catch{h(_e=>t1(_e,Bq))}finally{window.clearTimeout(De),se&&f(!1)}},[]),Ve=b.useCallback(async(se,Se)=>{if(!Y(Se))return null;h(null);try{const _e=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)})).json().catch(()=>null);return _e!=null&&_e.ok||h({text:yw(_e,"command failed"),raw:Xo(_e)}),_e}catch{return h({text:"server unreachable"}),null}finally{le()}},[Y,le]),Le=b.useCallback(async(se,Se)=>{if(!Y(Se))return null;h(null);try{const _e=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)})).json().catch(()=>null);return _e!=null&&_e.ok||h({text:Fo(_e,"command failed")}),_e}catch{return h({text:"server unreachable"}),null}finally{le()}},[Y,le]);b.useEffect(()=>(ke(!0),w.current=window.setInterval(()=>ke(!1),r1),()=>{w.current!=null&&window.clearInterval(w.current)}),[ke]),b.useEffect(()=>{const se=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(se)},[]);const qe=((we=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:we.value)??"90",Ne=J??qe,Ge=$q(Ne,qe),be=(Pe=t==null?void 0:t.accounts)==null?void 0:Pe.find(se=>se.active),re=((Ue=Jk((be==null?void 0:be.lanes)??[]).peak)==null?void 0:Ue.pct)??null,Qe=re!=null&&re>=Number(qe)-15,ft=async se=>{if(Y(`switch-${se}`)){h(null);try{const De=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:se})})).json().catch(()=>null);De!=null&&De.ok||h({text:yw(De,"the switch failed"),raw:Xo(De)}),await ke(!0)}catch{h({text:"server unreachable"})}finally{le(),me(se)}}},ut=async(se,Se)=>{const{commit:De,alias:_e}=zq(S,Se);if(De){const Be=await Le({action:"alias",account:se,alias:_e},`alias-${se}`);if(await ke(!0),!(Be!=null&&Be.ok))return;j(_e)}M(se),window.setTimeout(()=>M(Be=>Be===se?null:Be),Sf)},at=async(se,Se)=>{const De=await Le({action:"move",account:se,slot:Se},`move-${se}`),_e=Aq({menuFor:N,shareFor:(z==null?void 0:z.num)??null},se,De);if(await ke(!0),_e){k(_e.menuFor),I(_e.confirmRemove),_e.shareFor==null&&(O(null),X(!1)),Z(_e.swapNote);const Be=_e.swapNote;Be&&window.setTimeout(()=>Z(_t=>_t===Be?null:_t),s5),Q(null),me(_e.menuFor)}return De},Ye=async(se,Se,De)=>{if(De.sends){const _e=await at(se,Se);if(!(_e!=null&&_e.ok))return}F(se),window.setTimeout(()=>F(_e=>_e===se?null:_e),Sf)},pe=async(se,Se)=>{if(Se.sends){const De=await Ve({action:"setting",key:"autoswitch.threshold",value:se},"threshold");if(await ke(!0),!(De!=null&&De.ok))return;L(null)}ue(!0),window.setTimeout(()=>ue(!1),Sf)};return c.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[c.jsxs("div",{className:"ap-header",children:[c.jsx("h2",{children:"Accounts"}),c.jsxs("div",{className:"ap-header-right",children:[c.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>_(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),(((ot=t==null?void 0:t.accounts)==null?void 0:ot.length)??0)>0&&c.jsx("button",{type:"button",className:"glyph-btn ap-share-set",onClick:()=>D(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${Ut} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:"↗"}),c.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>ke(!0),...fe("reload",d),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:d?"…":"↻"}),c.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),t==null?p?c.jsxs("div",{className:"ap-empty",role:"alert",children:[c.jsx("span",{title:p.raw||void 0,children:p.text}),c.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",r1/1e3," seconds."]}),c.jsx("button",{type:"button",className:"ap-fix",disabled:d,onClick:()=>ke(!0),children:d?"trying…":"try again"})]}):c.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?c.jsxs(c.Fragment,{children:[c.jsx("ul",{className:"ap-list",children:($e=t.accounts)==null?void 0:$e.map(se=>{const{shown:Se,rest:De,fuller:_e,peak:Be}=Jk(se.lanes),_t=G.includes(t0(se)),vt=Oq(De.length,_t,_e);return c.jsxs("li",{className:`ap-account${se.active?" active":""}`,children:[c.jsxs("div",{className:"ap-account-head",children:[c.jsx("span",{className:"ap-num",children:se.num}),se.alias&&c.jsx("span",{className:"ap-alias",title:se.alias,children:se.alias}),c.jsx("span",{className:"ap-email",title:se.email??void 0,children:se.email}),c.jsx("button",{type:"button",id:`ap-more-${se.num}`,className:`ap-more${N===se.num?" on":""}`,"aria-label":`Manage account ${se.num}`,"aria-expanded":N===se.num,"aria-controls":N===se.num?`ap-manage-${se.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{k(N===se.num?null:se.num),j(se.alias??""),I(null),O(null),X(!1),Z(null),M(null),Q(null),F(null)},children:"⋯"}),se.active&&c.jsx("span",{className:"ap-badge-active",children:"active"}),se.disabled&&c.jsx("span",{className:"ap-badge-held",children:"held out"}),!se.active&&!se.disabled&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...fe(`switch-${se.num}`),onClick:()=>ft(se.num),title:`Switch to ${se.alias??se.email}`,children:i===`switch-${se.num}`?"…":"switch"})]}),c.jsx("div",{className:"ap-lanes",id:`ap-lanes-${se.num}`,children:Se.length?c.jsxs(c.Fragment,{children:[Se.map(Ae=>c.jsx(a1,{lane:Ae,nowSec:g},Ae.id)),_t&&De.map(Ae=>c.jsx(a1,{lane:Ae,nowSec:g},Ae.id))]}):c.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),c.jsxs("div",{className:"ap-meta",children:[se.staleCopy&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"ap-stale-copy",title:"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. Resume re-captures the copy from the login you already have.",children:"numbers paused"}),c.jsx("button",{type:"button",className:"ap-fix",...fe("recapture"),onClick:async()=>{const Ae=await Le({action:"recapture"},"recapture");Ae!=null&&Ae.ok&&ke(!0)},title:"Re-capture this account's stored credentials from the login you already have. No sign-in, no switch.",children:i==="recapture"?"resuming…":"resume"})]}),se.error&&(()=>{const Ae=l5(se.error);return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"ap-err",title:Ae.hint,children:Ae.text}),Ae.fixable&&c.jsx("button",{type:"button",className:"ap-fix",onClick:()=>_(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),vt&&c.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":_t,"aria-controls":`ap-lanes-${se.num}`,title:Pq(se.headroom,(Be==null?void 0:Be.label)??null,De.length,_t),onClick:()=>U(Ae=>Dq(Ae,se)),children:vt}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!se.active||se.disabled)&&c.jsx("button",{type:"button",className:"ap-rotate",...fe(`rot-${se.num}`),onClick:()=>Ve({action:"account",account:se.num,enabled:se.disabled},`rot-${se.num}`).then(()=>ke(!0)),title:se.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:se.disabled?"put back":"hold out"}),se.fetchedAt?c.jsxs("span",{className:`ap-age${se.stale?" 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 ",s1(se.fetchedAt,g),i5(se.nextAt,g)]}):c.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),N===se.num&&c.jsxs("div",{className:"ap-manage",id:`ap-manage-${se.num}`,role:"group","aria-label":`Manage account ${se.num}`,children:[c.jsxs("div",{className:"ap-manage-name",children:[c.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${se.num}`,children:"Alias"}),c.jsx("input",{id:`ap-alias-${se.num}`,className:"ap-manage-input",type:"text",value:S,onChange:Ae=>j(Ae.target.value),onKeyDown:Ae=>{Ae.key==="Enter"&&ut(se.num,se.alias)},maxLength:Fq,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),c.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`alias-${se.num}`),onClick:()=>ut(se.num,se.alias),title:"A short name to show instead of the email",children:C===se.num?"saved":"save"})]}),(()=>{const Ae=Rq((t.accounts??[]).map(xt=>xt.num),se.num),it=Mq(Ae,B,se.num),wt=Iq(Ae,it,se.num);return c.jsxs("div",{className:"ap-manage-slot",children:[c.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${se.num}`,children:"Slot"}),c.jsx("span",{className:"ap-field",children:c.jsx("select",{id:`ap-slot-${se.num}`,value:String(it),...fe(`move-${se.num}`),onChange:xt=>Q(Number(xt.target.value)),children:Ae.map(xt=>c.jsx("option",{value:xt.slot,children:xt.label},xt.slot))})}),c.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`move-${se.num}`),title:wt.title,onClick:()=>Ye(se.num,it,wt),children:P===se.num?wt.done:wt.label})]})})(),c.jsxs("div",{className:"ap-manage-acts",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`share-${se.num}`),title:`Copy this account to another ${Ut}. 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()=>{X(!1);const Ae=await Le({action:"share",account:se.num},`share-${se.num}`);Ae!=null&&Ae.ok&&O({num:se.num,blob:Ae.blob,expiresAt:Ae.expiresAt})},children:"share"}),c.jsx("button",{type:"button",className:`ap-manage-btn danger${$===se.num?" armed":""}`,...fe(`rm-${se.num}`),title:$===se.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if($!==se.num){I(se.num),window.setTimeout(()=>I(Ae=>Ae===se.num?null:Ae),4e3);return}I(null),Le({action:"remove",account:se.num},`rm-${se.num}`).then(()=>{k(null),ke(!0),me(null)})},children:$===se.num?"confirm":"remove"})]}),(R==null?void 0:R.at)===se.num&&(()=>{var wt;const Ae=(wt=t.accounts)==null?void 0:wt.find(xt=>xt.num===R.displaced),it=(Ae==null?void 0:Ae.alias)??(Ae==null?void 0:Ae.email)??"the account that was there";return c.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${R.at} was taken, so the two accounts traded places: ${it} now holds slot ${R.displaced}.`,children:["swapped with slot ",R.displaced]})})(),(z==null?void 0:z.num)===se.num&&(()=>{const Ae=rR(z.expiresAt,g),it=Ae.tone==="gone";return c.jsxs("div",{className:`ap-share${it?" expired":""}`,children:[c.jsx("code",{className:"ap-share-blob",children:z.blob}),c.jsxs("div",{className:"ap-share-foot",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`share-${se.num}`),onClick:async()=>{if(it){X(!1);const wt=await Le({action:"share",account:se.num},`share-${se.num}`);wt!=null&&wt.ok&&O({num:se.num,blob:wt.blob,expiresAt:wt.expiresAt});return}await o1(z.blob)&&(X(!0),window.setTimeout(()=>X(!1),1800))},children:it?"make a new share":H?"copied":"copy"}),c.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:[c.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",c.jsx("span",{className:`ap-share-expiry ${Ae.tone}`,children:Ae.text})]})]})]})})()]})]},se.num)})}),(s==null?void 0:s.ok)&&c.jsxs("div",{className:"ap-auto",children:[c.jsxs("div",{className:"ap-auto-head",children:[c.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),c.jsxs("span",{className:"ap-auto-ctl",children:[re!=null&&c.jsxs("span",{className:`ap-auto-now${Qe?" near":""}`,children:[Math.round(re),"%"]}),c.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:c.jsx("select",{"aria-label":"Switch threshold",value:Ne,...fe("threshold"),onChange:se=>L(se.target.value),children:o5.map(se=>c.jsxs("option",{value:se,children:[se,"%"]},se))})}),c.jsx("button",{type:"button",className:"ap-manage-btn",...fe("threshold"),title:Ge.title,onClick:()=>pe(Ne,Ge),children:K?Ge.done:Ge.label}),c.jsxs("button",{type:"button",className:`ap-auto-state${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",...fe("enable"),onClick:()=>Ve({action:"enable",enabled:!s.enabled},"enable").then(()=>ke(!0)),title:s.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[c.jsx("i",{className:s.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),s.enabled?"on":"off"]})]})]}),s.external&&c.jsxs("p",{className:"ap-auto-note",children:[c.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",c.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",s.enabled?" — this toggle takes over when you stop it.":"."]}),s.lastTick&&c.jsx("div",{className:"ap-auto-foot",children:c.jsxs("span",{className:"ap-auto-result",children:["checked ",s1(s.lastTick.at,g)]})})]}),p&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>h(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),c.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."}),c.jsx(r5,{accounts:((t==null?void 0:t.accounts)??[]).map(se=>({key:`${String(se.email??"").trim().toLowerCase()}@@${se.orgUuid??""}`,email:se.email??"",alive:se.alive===!0})),onChanged:()=>ke(!0)})]}):c.jsx("div",{className:"ap-empty",children:t.reason==="no_cswap"?c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"claude-swap isn't installed."}),c.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."}),t.hint&&c.jsx("code",{className:"ap-cmd",children:t.hint}),c.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",c.jsx("strong",{children:"+"})," button above."]})]}):t.reason==="no_accounts"?c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"No accounts added yet."}),c.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",c.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"Couldn't read the account store."}),c.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",t.reason?` (${t.reason})`:"","."]})]})}),E&&c.jsx(Eq,{onClose:()=>_(!1),onChanged:()=>ke(!0)}),A&&c.jsx(Tq,{accounts:((t==null?void 0:t.accounts)??[]).map(se=>({num:se.num,email:se.email,alias:se.alias,org:se.org})),onClose:()=>D(!1),copyText:o1})]})}const u5=3e4;function d5({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function h5({bundle:e,running:t,pending:n,lastTried:s}){return t?d5({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function f5(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function p5({asked:e,reported:t}){return t?t!==e:!1}function oR(e){const t=e.thresholdMs??u5;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 m5(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 g5(e,t){return e?t==null?"auto when idle":`auto in ${m5(t)}`:"auto-restart off"}function i1(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function y5(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 v5(e){const t=oR(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 iR(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 w5(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function x5(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 b5(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function k5(e,t){const n=b5(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`,f=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${a(`leaves the event log alone: ${d}${f}`)}. 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 i=t.decks-1,l=i===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 ${i===1?"1 other running deck shares":`${i} other running decks share`} with this one`)} — every session recorded in it, not just the ones drawn here. ${l} This cannot be undone.`,confirm:"Clear everything"}}function _5({agentCount:e,onConfirm:t,onCancel:n}){const s=b.useRef(null),a=tn(n,{focusRef:s,layer:v3}),[i,l]=b.useState(null);b.useEffect(()=>{let p=!1;return fetch("/api/clear").then(h=>h.ok?h.json():null).then(h=>{p||l(x5(h))}).catch(()=>{}),()=>{p=!0}},[]);const{note:d,confirm:f}=k5(e,i);return c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{className:"status-dot err","aria-hidden":!0}),c.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsx("p",{className:"modal-note",children:d}),c.jsxs("div",{className:"cc-actions",children:[c.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),c.jsx("button",{type:"button",className:"btn danger",onClick:t,children:f})]})]})]})})}const S5="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.",N5=[{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 E5({onClose:e}){const t=tn(e);return c.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:c.jsxs("div",{ref:t,className:"modal key-help",onClick:n=>n.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsx("p",{className:"modal-note",children:S5}),c.jsx("div",{className:"shortcuts",children:N5.map(n=>c.jsxs(b.Fragment,{children:[c.jsx("h3",{className:"kh-group",children:n.title}),n.rows.map(s=>c.jsxs("div",{className:"sc",children:[c.jsx("kbd",{children:s.cap}),c.jsx("span",{children:s.action})]},`${n.title}:${s.cap}:${s.action}`))]},n.title))})]})]})})}const j5=["done","needs-input"],C5=[{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}]}],T5=[{id:"two",label:"Two notes",notes:[{at:0,hz:440,ms:90},{at:.085,hz:740,ms:150}]},{id:"arc",label:"Ascent",notes:[{at:0,hz:440,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:988,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:440,ms:55},{at:.055,hz:440,ms:55},{at:.165,hz:740,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:440,ms:110},{at:.1,hz:740,ms:170},{at:.1,hz:988,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:440,ms:120},{at:.11,hz:740,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:440,ms:55},{at:.06,hz:740,ms:90}]}],r0={done:C5,"needs-input":T5},Qo="two";function ww(e,t){const n=r0[e];return n.find(s=>s.id===t)??n.find(s=>s.id===Qo)??n[0]}function lR(e,t){return r0[e].some(s=>s.id===t)?t:Qo}ww("done",Qo).notes,ww("needs-input",Qo).notes;const l1=.04,R5=.24,Iu=0,Ku=100,xw=5,Rl=50;function Al(e){if(!Number.isFinite(e))return Rl;const t=Math.round(e/xw)*xw;return Math.min(Ku,Math.max(Iu,t))}function A5(e){if(e==null)return Rl;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?Al(Number(t)):Rl}function M5(e){const t=Al(e),n=l1+(R5-l1)*(t/Ku);return Math.round(n*1e4)/1e4}function I5(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(M5(e)*s*1e4)/1e4}const $5=160,O5="agent-dag.soundLevel.done",P5="agent-dag.soundLevel.needs-input",L5="agent-dag.soundFigure.done",D5="agent-dag.soundFigure.needs-input",cR={done:O5,"needs-input":P5},uR={done:L5,"needs-input":D5},bw={done:{level:Rl,figure:Qo},"needs-input":{level:Rl,figure:Qo}};function q5(e){const t=n=>({level:A5(e(cR[n])),figure:lR(n,e(uR[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const F5={Stop:"done",Notification:"needs-input"};function z5(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:F5[n]??null}function B5(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,s=!1;const a=()=>e.enabled()?s&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",i=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,a())};function l(){var f;if(!(!t||s))try{n=n??new t,(f=n.resume)==null||f.call(n).then(i,()=>{}),s=!0,i()}catch{}}function d(f,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const h=(((N=e.prefs)==null?void 0:N.call(e))??bw)[f]??bw[f],g=ww(f,h.figure),y=I5(h.level,g),w=n.currentTime;for(const k of g.notes){const E=n.createOscillator(),_=n.createGain();E.type=g.type??"sine",E.frequency.value=k.hz;const S=w+k.at,j=S+k.ms/1e3;_.gain.setValueAtTime(1e-4,S),_.gain.exponentialRampToValueAtTime(y,S+.012),_.gain.exponentialRampToValueAtTime(1e-4,j),E.connect(_).connect(n.destination),E.start(S),E.stop(j+.02)}return!0}return{unlock:l,play:d,state:a,get context(){return n}}}const U5="Notify me when a session needs my attention.",W5="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",c1="Get notified when you're away from this tab.";function H5(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:c1};case"default":return{status:null,ask:!0,ok:!1,note:c1};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 u1={done:"Turn finished","needs-input":"Claude is asking"},G5={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function V5({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:a,onFigure:i,onPreview:l,openerRef:d,notifyOn:f,onToggleNotify:p,notifyVetoed:h,notifyPermission:g,onAskNotify:y}){const w=H5(g),N=f&&!h,k=tn(e),E=b.useRef(e);return E.current=e,b.useEffect(()=>{const _=S=>{var C,M;const j=S.target;j&&((C=k.current)!=null&&C.contains(j)||(M=d.current)!=null&&M.contains(j)||E.current())};return window.addEventListener("pointerdown",_,!0),()=>window.removeEventListener("pointerdown",_,!0)},[k,d]),c.jsxs("div",{ref:k,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[c.jsxs("div",{className:"sm-switches",children:[c.jsxs("label",{className:"sm-switch",children:[c.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),c.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:c.jsx("span",{className:"sm-toggle-knob"})})]}),c.jsxs("div",{className:"sm-setting",children:[c.jsxs("label",{className:"sm-switch",children:[c.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),c.jsx("button",{type:"button",role:"switch","aria-checked":f,"aria-labelledby":"sm-notify-label",className:"sm-toggle",onClick:p,title:"A system notification when a session blocks on you",children:c.jsx("span",{className:"sm-toggle-knob"})})]}),c.jsx("p",{className:"sm-note",children:h?W5:U5})]})]}),N&&c.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[c.jsxs("div",{className:"sm-channel-head",children:[c.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),w.ask?c.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:y,children:"Enable"}):c.jsxs("span",{className:"sm-channel-state","data-ok":w.ok||void 0,children:[w.ok&&c.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:c.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),w.status]})]}),c.jsx("p",{className:"sm-note",children:w.note})]}),!t&&c.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."}),c.jsx("div",{className:"sm-tones",children:j5.map(_=>{const S=s[_],j=`sm-level-${_}`,C=`sm-figure-${_}`;return c.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${_}`,children:[c.jsxs("div",{className:"sm-tone-head",children:[c.jsx("h3",{className:"sm-tone-name",id:`sm-name-${_}`,children:u1[_]}),c.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(_),"aria-label":`Hear the ${u1[_].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:[c.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:c.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),c.jsxs("div",{className:"sm-row",children:[c.jsx("label",{htmlFor:j,children:"Volume"}),c.jsx("input",{id:j,type:"range",min:Iu,max:Ku,step:xw,value:S.level,onChange:M=>a(_,Number(M.target.value)),style:{"--sm-level":`${(S.level-Iu)/(Ku-Iu)*100}%`}}),c.jsxs("span",{className:"sm-read",children:[S.level,"%"]})]}),c.jsxs("div",{className:"sm-row",children:[c.jsx("label",{htmlFor:C,children:"Tone"}),c.jsx("select",{id:C,className:"sm-select",value:S.figure,onChange:M=>i(_,M.target.value),children:r0[_].map(M=>c.jsx("option",{value:M.id,children:M.label},M.id))})]}),c.jsx("p",{className:"sm-note",children:G5[_]})]},_)})}),c.jsxs("p",{className:"sm-foot",children:[c.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const Y5={"//":["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.18.1":[{title:"🔁 A deck stops asking to pair over and over",body:"Several decks on one computer share a config directory, so they start with one key. Each read the others' beacons as somebody wearing its name, took a fresh key, and wrote it to the file the others read — a loop that never settles. Every new key is a **new deck** to everyone else on the network, so one machine sent a fresh pairing request every few seconds and accepting one accomplished nothing: the deck that asked no longer existed by the time the answer arrived.\n\nDecks on one computer now recognise each other as the same machine and leave the key alone. The clash still worth healing — a `~/.claude` copied to a second machine — is unchanged.\n\nThis also collapses the rows: a computer that has run the deck a few times appeared several times on everybody else's panel and is one row now. **Both machines need this version** for that to take effect on the other one's screen.\n\nA deck that answered is no longer counted as unreachable, the list refreshes itself in seconds while somebody is deciding rather than at the next minute, and a failed round says what happened — `not listening`, `no route to it` — with the address and the raw error on the hover."}],"3.18.0":[{title:"🟢 A deck that is switched off no longer reads as on",body:"A paired deck this one has no address for was drawn **live** on the strength of being paired — a machine closed an hour ago still sat under `1 deck ready`. Every row now leads with whether that machine is actually there, and when it last was: `online · 1 login arrived`, `no answer · last online 20m ago`, `never reached`. The mark beside the name is a traffic light — green for a deck that answered, amber for one that cannot be reached, grey for one nothing has heard from.\n\n**+ add a deck** opens a dialog now instead of unfolding inside the panel. An address, an invite and the firewall note never fitted a 288px column, and unfolded they turned a list of machines into a form."}],"3.17.0":[{title:"🔔 Pairing is two presses",body:`When another deck asks to pair, the question now arrives **over the deck** rather than in a row three sections down a panel: its name, its address, the fingerprint to compare, **Accept** or **Decline**. Escape means later — the request stays in the panel until you answer it.
|
|
82
82
|
|
|
83
83
|
The rest is one list. Every deck you are paired with, every deck on the network, and every one you turned away, each a row with its state under the name and one verb at the end — and a deck that cannot be reached now reads differently from one that is fine. Saying no also reaches the other machine now, instead of leaving it waiting forever; you can take it back.
|
|
84
84
|
|
|
@@ -244,17 +244,17 @@ Decks on the same router still find each other on their own and appear under **o
|
|
|
244
244
|
|
|
245
245
|
The invite lasts 10 minutes and is used once. Anyone who gets hold of the text can pair with your deck until it runs out, so send it the way you would send anything else you would not want forwarded.`},{title:"⚠️ Both machines have to be on this version",body:`The two decks no longer speak the old protocol, and there is no fallback: a 3.15 deck and a 3.16 deck cannot see each other at all. Update both.
|
|
246
246
|
|
|
247
|
-
The group passphrase is gone. If you had one set, that pairing is not carried over — make an invite and pair again. It was replaced because a passphrase that differs by one character produced a closed socket and no other symptom on either machine, and a secret is the one thing a panel must never print, so neither person could check theirs against the other's.`}]},r0="agent-dag.releaseNotesSeen";function u1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Zo(e,t){const n=u1(e),s=u1(t);for(let a=0;a<Math.max(n.length,s.length);a++){const i=(n[a]??0)-(s[a]??0);if(i!==0)return i<0?-1:1}return 0}function Jo(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function V5(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 Y5(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!Jo(n)||!Array.isArray(s))continue;const a=s.filter(V5);a.length&&t.push({version:n,notes:a})}return t.sort((n,s)=>Zo(s.version,n.version))}const d1=Y5(G5);function uR(e,t,n){return e.filter(s=>Zo(s.version,n)<=0&&(t===null||Zo(s.version,t)>0))}function K5(e,t){return e.filter(n=>Zo(n.version,t)===0)}function X5(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 Q5({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 l=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${l} changed something you would notice. Clicking the version in the topbar brings this back.`}if(s&&Jo(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(!Jo(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const i=Zo(a,t);return i<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:i>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const Z5=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function J5(e){const t=Z5.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function eF(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function tF(e){if(!e)return null;let t=null;try{t=e.getItem(r0)}catch{return null}return Jo(t)?t:null}function nF(e){if(!e)return!1;try{return e.getItem(r0),!0}catch{return!1}}function rF(e,t){if(!e)return!1;try{return e.setItem(r0,t),!0}catch{return!1}}function sF({stored:e,running:t,notes:n,remembers:s=!0}){if(!Jo(t))return{show:[],record:null,reason:"no-version"};if(!Jo(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const l=K5(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=Zo(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const i=uR(n,e,t);return i.length?{show:i,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function aF(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 dR(e,t=!0){const n=[];let s="";const a=()=>{s&&(n.push({kind:"text",text:s}),s="")};let i=0;for(;i<e.length;){if(e[i]==="`"){const l=e.indexOf("`",i+1);if(l>i+1){a(),n.push({kind:"code",text:e.slice(i+1,l)}),i=l+1;continue}}else if(t&&e.startsWith("**",i)){const l=aF(e,i);if(l>0){a(),n.push({kind:"bold",kids:dR(e.slice(i+2,l),!1)}),i=l+2;continue}}s+=e[i],i+=1}return a(),n}function oF({entries:e,since:t,running:n,firstRun:s,onClose:a}){const i=tn(a),l=X5(e);return c.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:c.jsxs("div",{ref:i,className:"modal release-notes",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),l&&c.jsx("span",{className:"modal-tool-id",children:l})]}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsx("p",{className:"modal-note",children:Q5({since:t,running:n,firstRun:s,entries:e})}),e.map(d=>c.jsxs("section",{className:"modal-section",children:[c.jsxs("h3",{className:"rn-version",children:["v",d.version]}),c.jsx("ul",{className:"rn-notes",children:d.notes.map((f,p)=>{const{icon:h,rest:g}=J5(f.title);return c.jsxs("li",{className:"rn-note",children:[c.jsxs("p",{className:"rn-note-title",children:[h&&c.jsx("span",{className:"rn-note-icon",children:h}),g]}),c.jsx("p",{className:"rn-note-body",children:hR(dR(f.body))})]},p)})})]},d.version))]})]})})}function hR(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?c.jsx("code",{className:"rn-code",children:t.text},n):c.jsx("strong",{className:"rn-strong",children:hR(t.kids)},n))}function iF(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function lF(e,t,n){var l;if(e.length===0)return null;const s=iF(e),a=t?s.findIndex(d=>d.id===t):-1,i=a===-1?n===1?0:s.length-1:(a+n+s.length)%s.length;return((l=s[i])==null?void 0:l.id)??null}const cF=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function uF(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:cF.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const dF=new Set(["","BODY","HTML","#DOCUMENT"]);function hF(e){return!e||Xw(e)?!1:!dF.has(String(e.tagName??"").toUpperCase())}function wu(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 pF(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function mF(e,t){if(!t||!e.agents.get(t))return null;const s=new Set([t]);let a=t;for(;a;){const l=e.agents.get(a);if(!(l!=null&&l.parentId)||s.has(l.parentId))break;s.add(l.parentId),a=l.parentId}let i=!0;for(;i;){i=!1;for(const l of e.agents.values())l.parentId&&s.has(l.parentId)&&!s.has(l.id)&&(s.add(l.id),i=!0)}return s}function gF(e,t){const n=new Set;for(const s of t){const a=mF(e,s);if(a)for(const i of a)n.add(i)}return n.size>0?n:null}function fR(e,t,n){return!t.has(e)||n.has(e)}function yF(e,t,n,s){return!t.has(e)&&fR(e,n,s)}function vF(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function wF(e,t,n,s){n.set(e,t),s.delete(e)}const xF=40,bF=120;function kF(e,t){let n=null,s=0,a=Number.NEGATIVE_INFINITY;const i=()=>{n=null,a=t.now(),e()},l=()=>{n!=null&&(t.clearTimeout(n),n=null)},d=(f,p,h)=>{if(n!=null){if(s<=f)return;l()}const g=Math.min(h,Math.max(0,f-p));s=f,n=t.setTimeout(i,g)};return{live(f=xF){const p=t.now(),h=Math.max(a+f,p);if(h<=p){l(),i();return}d(h,p,f)},replay(f=bF){l(),s=t.now()+f,n=t.setTimeout(i,f)},flush(){l(),i()},cancel(){l()}}}const _F=1e3;function SF(e={}){const t=Math.max(1,Math.floor(e.limit??_F)),n=e.protect;let s=!1,a=[],i=new Set,l=0,d=0,f=null;return{get paused(){return s},get size(){return a.length},get dropped(){return l},get overflowed(){return l>0},get through(){return d},accept(p){const h=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,g=(p==null?void 0:p.epoch)??null,y=g!==null&&g!==f;y&&(f=g,d=0);const w=h!==null&&!y&&h<=d;if(h!==null&&h>d&&(d=h),!s)return!0;if(w)return!1;if(a.push(p),n!=null&&n(p)&&i.add(p),a.length>t){let N=0;if(i.size<a.length)for(;i.has(a[N]);)N++;const[k]=a.splice(N,1);i.delete(k),l++}return!1},setPaused(p){if(s=p,p)return[];const h=a;return a=[],i=new Set,l=0,h}}}const pR="agent-dag.theme";function NF(e){return e==="light"?"light":"dark"}function EF(){return NF(ni(pR))}function jF({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${Ut}`:Ut,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const xu={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function bu(e,t){const a=l=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${l}/>`;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${t==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:t==="offline"?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 CF=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(bu(xu.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(bu(xu.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(bu(xu.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(bu(xu.idle,"idle"))}`}),TF="No sessions are waiting for you.";function RF(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 AF(e,t){return t!==""?t:e===""?"":TF}function MF(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function IF(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 $F(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const h1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function s0(e){const t=e.toLowerCase();return Object.hasOwn(h1,t)?h1[t]:t?t[0].toUpperCase()+t.slice(1):""}function OF(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function PF(e,t=[]){const n=t.length?OF(t.map(s0)):$F(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function LF(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 DF(e,t){const n=t.prefs??bw,s=Al(n.done.level),a=Al(n["needs-input"].level),i=s===a?`${s}%`:`${s}% and ${a}%`,l=t.on?`Sound: on at ${i} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",d=e.codex?`
|
|
247
|
+
The group passphrase is gone. If you had one set, that pairing is not carried over — make an invite and pair again. It was replaced because a passphrase that differs by one character produced a closed socket and no other symptom on either machine, and a secret is the one thing a panel must never print, so neither person could check theirs against the other's.`}]},s0="agent-dag.releaseNotesSeen";function d1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Zo(e,t){const n=d1(e),s=d1(t);for(let a=0;a<Math.max(n.length,s.length);a++){const i=(n[a]??0)-(s[a]??0);if(i!==0)return i<0?-1:1}return 0}function Jo(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function K5(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 X5(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!Jo(n)||!Array.isArray(s))continue;const a=s.filter(K5);a.length&&t.push({version:n,notes:a})}return t.sort((n,s)=>Zo(s.version,n.version))}const h1=X5(Y5);function dR(e,t,n){return e.filter(s=>Zo(s.version,n)<=0&&(t===null||Zo(s.version,t)>0))}function Q5(e,t){return e.filter(n=>Zo(n.version,t)===0)}function Z5(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 J5({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 l=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${l} changed something you would notice. Clicking the version in the topbar brings this back.`}if(s&&Jo(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(!Jo(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const i=Zo(a,t);return i<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:i>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const eF=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function tF(e){const t=eF.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function nF(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function rF(e){if(!e)return null;let t=null;try{t=e.getItem(s0)}catch{return null}return Jo(t)?t:null}function sF(e){if(!e)return!1;try{return e.getItem(s0),!0}catch{return!1}}function aF(e,t){if(!e)return!1;try{return e.setItem(s0,t),!0}catch{return!1}}function oF({stored:e,running:t,notes:n,remembers:s=!0}){if(!Jo(t))return{show:[],record:null,reason:"no-version"};if(!Jo(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const l=Q5(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=Zo(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const i=dR(n,e,t);return i.length?{show:i,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function iF(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 hR(e,t=!0){const n=[];let s="";const a=()=>{s&&(n.push({kind:"text",text:s}),s="")};let i=0;for(;i<e.length;){if(e[i]==="`"){const l=e.indexOf("`",i+1);if(l>i+1){a(),n.push({kind:"code",text:e.slice(i+1,l)}),i=l+1;continue}}else if(t&&e.startsWith("**",i)){const l=iF(e,i);if(l>0){a(),n.push({kind:"bold",kids:hR(e.slice(i+2,l),!1)}),i=l+2;continue}}s+=e[i],i+=1}return a(),n}function lF({entries:e,since:t,running:n,firstRun:s,onClose:a}){const i=tn(a),l=Z5(e);return c.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:c.jsxs("div",{ref:i,className:"modal release-notes",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),l&&c.jsx("span",{className:"modal-tool-id",children:l})]}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsx("p",{className:"modal-note",children:J5({since:t,running:n,firstRun:s,entries:e})}),e.map(d=>c.jsxs("section",{className:"modal-section",children:[c.jsxs("h3",{className:"rn-version",children:["v",d.version]}),c.jsx("ul",{className:"rn-notes",children:d.notes.map((f,p)=>{const{icon:h,rest:g}=tF(f.title);return c.jsxs("li",{className:"rn-note",children:[c.jsxs("p",{className:"rn-note-title",children:[h&&c.jsx("span",{className:"rn-note-icon",children:h}),g]}),c.jsx("p",{className:"rn-note-body",children:fR(hR(f.body))})]},p)})})]},d.version))]})]})})}function fR(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?c.jsx("code",{className:"rn-code",children:t.text},n):c.jsx("strong",{className:"rn-strong",children:fR(t.kids)},n))}function cF(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function uF(e,t,n){var l;if(e.length===0)return null;const s=cF(e),a=t?s.findIndex(d=>d.id===t):-1,i=a===-1?n===1?0:s.length-1:(a+n+s.length)%s.length;return((l=s[i])==null?void 0:l.id)??null}const dF=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function hF(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:dF.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const fF=new Set(["","BODY","HTML","#DOCUMENT"]);function pF(e){return!e||Xw(e)?!1:!fF.has(String(e.tagName??"").toUpperCase())}function wu(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function mF(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 gF(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function yF(e,t){if(!t||!e.agents.get(t))return null;const s=new Set([t]);let a=t;for(;a;){const l=e.agents.get(a);if(!(l!=null&&l.parentId)||s.has(l.parentId))break;s.add(l.parentId),a=l.parentId}let i=!0;for(;i;){i=!1;for(const l of e.agents.values())l.parentId&&s.has(l.parentId)&&!s.has(l.id)&&(s.add(l.id),i=!0)}return s}function vF(e,t){const n=new Set;for(const s of t){const a=yF(e,s);if(a)for(const i of a)n.add(i)}return n.size>0?n:null}function pR(e,t,n){return!t.has(e)||n.has(e)}function wF(e,t,n,s){return!t.has(e)&&pR(e,n,s)}function xF(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function bF(e,t,n,s){n.set(e,t),s.delete(e)}const kF=40,_F=120;function SF(e,t){let n=null,s=0,a=Number.NEGATIVE_INFINITY;const i=()=>{n=null,a=t.now(),e()},l=()=>{n!=null&&(t.clearTimeout(n),n=null)},d=(f,p,h)=>{if(n!=null){if(s<=f)return;l()}const g=Math.min(h,Math.max(0,f-p));s=f,n=t.setTimeout(i,g)};return{live(f=kF){const p=t.now(),h=Math.max(a+f,p);if(h<=p){l(),i();return}d(h,p,f)},replay(f=_F){l(),s=t.now()+f,n=t.setTimeout(i,f)},flush(){l(),i()},cancel(){l()}}}const NF=1e3;function EF(e={}){const t=Math.max(1,Math.floor(e.limit??NF)),n=e.protect;let s=!1,a=[],i=new Set,l=0,d=0,f=null;return{get paused(){return s},get size(){return a.length},get dropped(){return l},get overflowed(){return l>0},get through(){return d},accept(p){const h=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,g=(p==null?void 0:p.epoch)??null,y=g!==null&&g!==f;y&&(f=g,d=0);const w=h!==null&&!y&&h<=d;if(h!==null&&h>d&&(d=h),!s)return!0;if(w)return!1;if(a.push(p),n!=null&&n(p)&&i.add(p),a.length>t){let N=0;if(i.size<a.length)for(;i.has(a[N]);)N++;const[k]=a.splice(N,1);i.delete(k),l++}return!1},setPaused(p){if(s=p,p)return[];const h=a;return a=[],i=new Set,l=0,h}}}const mR="agent-dag.theme";function jF(e){return e==="light"?"light":"dark"}function CF(){return jF(ni(mR))}function TF({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${Ut}`:Ut,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const xu={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function bu(e,t){const a=l=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${l}/>`;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${t==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:t==="offline"?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 RF=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(bu(xu.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(bu(xu.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(bu(xu.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(bu(xu.idle,"idle"))}`}),AF="No sessions are waiting for you.";function MF(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 IF(e,t){return t!==""?t:e===""?"":AF}function $F(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function OF(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 PF(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const f1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function a0(e){const t=e.toLowerCase();return Object.hasOwn(f1,t)?f1[t]:t?t[0].toUpperCase()+t.slice(1):""}function LF(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function DF(e,t=[]){const n=t.length?LF(t.map(a0)):PF(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function qF(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 FF(e,t){const n=t.prefs??bw,s=Al(n.done.level),a=Al(n["needs-input"].level),i=s===a?`${s}%`:`${s}% and ${a}%`,l=t.on?`Sound: on at ${i} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",d=e.codex?`
|
|
248
248
|
|
|
249
249
|
Both CLIs get the finish tone. The second tone — Claude is waiting for you — has no Codex equivalent to fire on, so it only ever plays for Claude Code.`:"",f=t.on&&t.locked?`
|
|
250
250
|
|
|
251
251
|
Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return l+d+f+`
|
|
252
252
|
|
|
253
|
-
Click to set the volume and the sound of each tone, and to hear either one.`}function mR(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 qF(e){const t=mR([{agents:e}]);return t.length<2?null:t.map(n=>`${s0(n.id)} ${Je(n.cost)}`).join(" · ")}function f1(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 FF(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function ku(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 zF=[7,14,30,90];function BF(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),i=b.useState(MF)[0],l=b.useRef(!1),d=(f=!1)=>{if(f&&!ur(l.current))return;const p=i.begin();l.current=f;const h=e;a(!0);const y=`/api/ccusage?since=${pw(h)}${f?"&refresh=1":""}`;fetch(y).then(w=>w.json()).then(w=>{p()&&n({range:h,resp:w})}).catch(()=>{p()&&n({range:h,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(l.current=!1,a(!1))})};return b.useEffect(()=>(d(!1),()=>i.cancel()),[e]),{landed:t,loading:s,reload:()=>d(!0)}}function UF({onClose:e,providers:t}){var z;const[n,s]=b.useState(30),[a,i]=b.useState(null),{landed:l,loading:d,reload:f}=BF(n),p=b.useRef(null),h=tn(e,{focusRef:p}),g=IF({loading:d,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((z=l.resp.days)==null?void 0:z.length)??0}}),y=g.phase==="chart"?l.resp.days??[]:[],w=b.useMemo(()=>y.reduce((O,A)=>Math.max(O,A.totalCost),0),[y]),N=b.useRef(null);b.useLayoutEffect(()=>{const O=N.current;O&&(O.scrollLeft=O.scrollWidth)},[y]);const{totalCost:k,totalTok:E,inOut:_,cacheRead:S,modelCosts:j}=b.useMemo(()=>{let O=0,A=0,D=0,H=0;const X=new Map;for(const R of y){O+=R.totalCost,A+=R.totalTokens,D+=R.inputTokens+R.outputTokens,H+=R.cacheReadTokens;for(const Z of R.modelBreakdowns)X.set(Z.modelName,(X.get(Z.modelName)??0)+Z.cost)}return{totalCost:O,totalTok:A,inOut:D,cacheRead:H,modelCosts:X}},[y]),C=b.useMemo(()=>Array.from(j.entries()).sort((O,A)=>A[1]-O[1]),[j]),M=b.useMemo(()=>mR(y),[y]),$=M.length>1,I=a?y.find(O=>O.period===a)??null:null;return c.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:c.jsxs("div",{ref:h,className:"uh-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[c.jsxs("header",{className:"uh-head",children:[c.jsxs("div",{className:"uh-titlewrap",children:[c.jsx("div",{className:"uh-title",children:"Usage history"}),c.jsx("div",{className:"uh-sub",children:PF(t,M.map(O=>O.id))})]}),c.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:zF.map(O=>c.jsxs("button",{type:"button","aria-pressed":n===O,className:"uh-range-btn",onClick:()=>{s(O),i(null)},children:[O,"d"]},O))}),c.jsx("button",{className:"glyph-btn uh-reload",onClick:f,...cr(d),title:"Re-run ccusage","aria-label":"Reload",children:d?"…":"↻"}),c.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.phase==="busy"?c.jsxs("div",{className:"uh-status uh-status-wait","aria-busy":"true",children:[c.jsx("span",{className:"uh-wait-word",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}),c.jsx("span",{className:"uh-wait-axis","aria-hidden":!0})]}):g.phase==="error"?c.jsxs("div",{className:"uh-status uh-err",title:Xo(l.resp)||void 0,children:[yq(l.resp,"ccusage did not report usage"),c.jsx("div",{children:c.jsx("button",{className:"btn uh-retry",onClick:f,...cr(d),children:d?"trying…":"Try again"})})]}):g.phase==="empty"?c.jsx("div",{className:`uh-status${g.stale?" uh-stale":""}`,"aria-busy":g.stale||void 0,children:"no usage in this range"}):c.jsxs("div",{className:g.stale?"uh-stale":void 0,"aria-busy":g.stale||void 0,children:[c.jsxs("div",{className:"uh-totals",children:[c.jsx(_u,{label:"total cost",val:Je(k),accent:!0}),c.jsx(_u,{label:"tokens",val:At(E)}),c.jsx(_u,{label:"input+output",val:At(_)}),c.jsx(_u,{label:"cache reads",val:At(S)})]}),$&&c.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[c.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:M.map(O=>c.jsx("span",{className:"uh-agent-seg",style:{width:`${k>0?O.cost/k*100:0}%`,background:f1(O.id)}},O.id))}),c.jsx("div",{className:"uh-agent-keys",children:M.map(O=>c.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${At(O.tokens)} tokens`,children:[c.jsx("span",{className:"uh-legend-dot",style:{background:f1(O.id)}}),s0(O.id),c.jsx("span",{className:"uh-agent-cost",children:Je(O.cost)}),c.jsx("span",{className:"uh-agent-share",children:FF(O.cost,k)})]},O.id))})]}),c.jsx("div",{ref:N,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map((O,A)=>{const D=w>0?O.totalCost/w*100:0,H=O.period===a,X=`${O.period}, ${Je(O.totalCost)}`;return c.jsxs("button",{className:`uh-bar-col${H?" sel":""}`,onClick:()=>i(H?null:O.period),"aria-pressed":H,"aria-label":X,title:`${O.period} · ${Je(O.totalCost)}`,style:{flexBasis:`${100/y.length}%`,"--uh-i":A,"--uh-step":`${Math.min(10,200/Math.max(y.length,1))}ms`},children:[c.jsx("div",{className:"uh-bar",style:{height:`${Math.max(D,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort((R,Z)=>Z.cost-R.cost).map(R=>{const Z=O.totalCost>0?R.cost/O.totalCost*100:0;return c.jsx("div",{className:"uh-bar-seg",style:{height:`${Z}%`,background:ku(R.modelName)}},R.modelName)})}),c.jsx("span",{className:"uh-bar-label",children:O.period.slice(5)})]},O.period)})}),c.jsx("div",{className:"uh-legend",children:C.map(([O,A])=>c.jsxs("span",{className:"uh-legend-item",title:O,children:[c.jsx("span",{className:"uh-legend-dot",style:{background:ku(O)}}),Fs(O)," ",c.jsx("span",{className:"uh-legend-cost",children:Je(A)})]},O))}),I&&c.jsxs("div",{className:"uh-detail",children:[c.jsxs("div",{className:"uh-detail-head",children:[c.jsx("span",{className:"uh-detail-date",children:I.period}),c.jsx("span",{className:"uh-detail-cost",children:Je(I.totalCost)}),(()=>{var D,H;const A=qF(I.agents)??((H=(D=I.metadata)==null?void 0:D.agents)!=null&&H.length?I.metadata.agents.join(" · "):null);return A?c.jsx("span",{className:"uh-detail-agents",title:A,children:A}):null})()]}),c.jsxs("div",{className:"uh-detail-mini",children:[c.jsx(Su,{label:"input",val:At(I.inputTokens)}),c.jsx(Su,{label:"output",val:At(I.outputTokens)}),c.jsx(Su,{label:"cache write",val:At(I.cacheCreationTokens)}),c.jsx(Su,{label:"cache read",val:At(I.cacheReadTokens)})]}),c.jsx("div",{className:"uh-detail-models",children:I.modelBreakdowns.slice().sort((O,A)=>A.cost-O.cost).map(O=>{const A=I.totalCost>0?O.cost/I.totalCost*100:0;return c.jsxs("div",{className:"uh-model-row",title:O.modelName,children:[c.jsxs("span",{className:"uh-model-name",children:[c.jsx("span",{className:"uh-legend-dot",style:{background:ku(O.modelName)}}),c.jsx("span",{className:"uh-model-label",children:Fs(O.modelName)})]}),c.jsx("span",{className:"uh-model-bar",children:c.jsx("span",{className:"uh-model-bar-fill",style:{width:`${A}%`,background:ku(O.modelName)}})}),c.jsx("span",{className:"uh-model-cost",children:Je(O.cost)})]},O.modelName)})})]})]})]})})}function _u({label:e,val:t,accent:n}){return c.jsxs("div",{className:"uh-stat",children:[c.jsx("span",{className:`uh-stat-val${n?" accent":""}`,children:t}),c.jsx("span",{className:"uh-stat-label",children:e})]})}function Su({label:e,val:t}){return c.jsxs("div",{className:"uh-ministat",children:[c.jsx("span",{className:"uh-ministat-val",children:t}),c.jsx("span",{className:"uh-ministat-label",children:e})]})}function WF(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 i=a/255;return i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)});return .2126*s[0]+.7152*s[1]+.0722*s[2]>.5}const p1=1e4,HF=12e3;function GF({browsers:e,findings:t,watching:n,palette:s,now:a=()=>Date.now()}){const i=b.useRef(null),l=b.useRef(null);return l.current={browsers:e,findings:t,watching:n},b.useEffect(()=>{var w;const d=i.current;if(!d)return;const f=d.getContext("2d");if(!f)return;const p=((w=window.matchMedia)==null?void 0:w.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let h=0,g=!1;const y=()=>{var Q;if(g)return;const N=l.current;if(!N)return;const{browsers:k,findings:E,watching:_}=N,S=s["--accent"]||"#7dd3fc",j=s["--line"]||"#1f2229",C=s["--text-dim"]||"#6e727c",M=WF(s["--bg"]),$=M?42:26,I=M?.85:.65,z=a(),O=Math.min(window.devicePixelRatio||1,2),A=d.clientWidth,D=d.clientHeight;(d.width!==A*O||d.height!==D*O)&&(d.width=A*O,d.height=D*O),f.setTransform(O,0,0,O,0,0),f.clearRect(0,0,A,D);const H=A/2,X=D/2,R=Math.min(A,D)/2-6;f.strokeStyle=j,f.lineWidth=1,f.globalAlpha=M?1:.9;for(const P of[.4,.7,1])f.beginPath(),f.arc(H,X,R*P,0,Math.PI*2),f.stroke();f.beginPath(),f.moveTo(H-R,X),f.lineTo(H+R,X),f.moveTo(H,X-R),f.lineTo(H,X+R),f.stroke(),f.globalAlpha=1;const B=(_&&!p?z%p1/p1:0)*Math.PI*2-Math.PI/2;if(_){const P=(Q=f.createConicGradient)==null?void 0:Q.call(f,B-.85,H,X);P&&(P.addColorStop(0,"transparent"),P.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${S} ${$}%, transparent)`),P.addColorStop(1,"transparent"),f.fillStyle=P,f.beginPath(),f.moveTo(H,X),f.arc(H,X,R,B-.85,B),f.closePath(),f.fill()),f.strokeStyle=S,f.globalAlpha=I,f.beginPath(),f.moveTo(H,X),f.lineTo(H+Math.cos(B)*R,X+Math.sin(B)*R),f.stroke(),f.globalAlpha=1}k.forEach((P,F)=>{const J=F/Math.max(k.length,1)*Math.PI*2-Math.PI/2,L=P.lastReadMs===null?1:Math.min(1,(z-P.lastReadMs)/12e4),K=R*(.42+L*.5),ue=H+Math.cos(J)*K,G=X+Math.sin(J)*K,U=Math.abs((B-J+Math.PI*3)%(Math.PI*2)-Math.PI),ee=_?Math.max(0,1-U/.55):0;f.beginPath(),f.arc(ue,G,3+ee*1.6,0,Math.PI*2),f.fillStyle=P.running?S:C,f.globalAlpha=P.running?.55+ee*.45:.35,f.fill(),f.globalAlpha=1});for(const P of E){const F=(z-P.atMs)/HF;if(F<0||F>1)continue;const L=Math.max(0,k.findIndex(G=>G.key===P.browser))/Math.max(k.length,1)*Math.PI*2-Math.PI/2,K=H+Math.cos(L)*R*.6,ue=X+Math.sin(L)*R*.6;f.beginPath(),f.arc(K,ue,4+F*22,0,Math.PI*2),f.strokeStyle=S,f.globalAlpha=(1-F)*.8,f.lineWidth=1.5,f.stroke(),f.globalAlpha=1}h=requestAnimationFrame(y)};return y(),()=>{g=!0,cancelAnimationFrame(h)}},[a,s]),c.jsx("canvas",{ref:i,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const m1="agent-dag.browserWatch.seenMs";function VF(e,t){return e.filter(n=>n.startMs>t)}function YF(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function KF(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 gR(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function g1(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 XF(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 QF(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 ZF(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=gR(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 JF(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 e6(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function y1(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function t6({onClose:e,onSeen:t,onWatching:n,palette:s}){const a=tn(e),[i,l]=b.useState(null),[d,f]=b.useState(null),[p,h]=b.useState(null),[g,y]=b.useState(!1),w=b.useRef(!1),[N,k]=b.useState(null),[E,_]=b.useState(null),[S,j]=b.useState(!1),C=b.useRef(!1),[M,$]=b.useState(!1),[I,z]=b.useState(!1),[O,A]=b.useState(!1),[D,H]=b.useState(!1),[X,R]=b.useState(!1),[Z,B]=b.useState(()=>Date.now());b.useEffect(()=>{const Y=setInterval(()=>B(Date.now()),1e3);return()=>clearInterval(Y)},[]);const Q=b.useCallback(async Y=>{var le,fe;if(!(Y&&!ur(w.current))){w.current=Y,y(!0);try{const me=await fetch(`/api/browser-watch${Y?"?refresh=1":""}`);if(!me.ok)throw new Error(`the deck answered ${me.status}`);const ke=await me.json();l(ke),C.current||k(((le=ke==null?void 0:ke.settings)==null?void 0:le.quietMinutes)??15),n(((fe=ke==null?void 0:ke.settings)==null?void 0:fe.enabled)===!0),f(null)}catch(me){f(me instanceof Error?me.message:String(me))}finally{w.current=!1,y(!1)}}},[n]);b.useEffect(()=>{Q(!1)},[Q]),b.useEffect(()=>{const Y=setInterval(()=>{Q(!1)},1e4);return()=>clearInterval(Y)},[Q]);const P=b.useCallback(async Y=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:Y.host,startMs:Y.startMs})})}finally{await Q(!1)}},[Q]),F=b.useCallback(async Y=>{C.current=!0,j(!0);try{const le=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Y)});if(!le.ok)throw new Error(`the deck answered ${le.status}`);await Q(!1),h(null)}catch(le){h(le instanceof Error?le.message:String(le))}finally{C.current=!1,j(!1)}},[Q]),J=b.useRef(t);J.current=t,b.useEffect(()=>()=>J.current(Date.now()),[]);const L=b.useMemo(()=>{const Y=[];for(const le of(i==null?void 0:i.episodes)??[]){const fe=e6(le.startMs),me=Y[Y.length-1];me&&me.label===fe?me.episodes.push(le):Y.push({label:fe,episodes:[le]})}return Y},[i]),K=gR(i==null?void 0:i.browsers),ue=((i==null?void 0:i.browsers)??[]).filter(Y=>!(Y.installed&&Y.profiles>0)),G=i?ZF(i):null,U=K.reduce((Y,le)=>Y+le.profiles,0),ee=i?YF(i.coverage.lastHumanMs,i.coverage.quietMs,Z):null;return c.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:c.jsxs("div",{ref:a,className:"modal bw-modal",onClick:Y=>Y.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{className:"modal-tool-name",id:"bw-title",children:"Browser watch"}),c.jsx("span",{className:"modal-tool-id",children:i?`${U} ${U===1?"profile":"profiles"} · local only`:"local only"})]}),c.jsxs("div",{className:"modal-actions",children:[c.jsx("button",{className:"glyph-btn",onClick:()=>void Q(!0),...cr(g),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:g?"…":"↻"}),c.jsx("button",{className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),c.jsxs("div",{className:"modal-body bw-body",children:[!i&&!d&&c.jsxs("div",{className:"bw-loading",children:[c.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),c.jsx("p",{children:"Reading each browser's history. The first look copies the file, which takes a moment."})]}),d&&c.jsx("div",{className:"bw-state",children:c.jsxs("div",{className:"bw-row err",children:[c.jsx("span",{className:"bw-dot","aria-hidden":!0}),c.jsx("span",{className:"bw-row-label",children:"Could not read"}),c.jsx("span",{className:"bw-row-detail",children:d})]})}),i&&G&&c.jsx("p",{className:`bw-trouble ${G.kind}`,role:"status",children:G.text}),i&&c.jsxs("div",{className:"bw-work",children:[c.jsxs("aside",{className:"bw-side",children:[c.jsxs("section",{className:"bw-sec",children:[c.jsxs("h4",{className:"bw-sec-head",children:["Activity overview",c.jsx("button",{className:"bw-help",onClick:()=>A(Y=>!Y),"aria-expanded":O,"aria-label":"What the sweep and the dots mean",children:"?"})]}),c.jsxs("div",{className:"bw-glance",children:[c.jsx(GF,{browsers:K.map(Y=>{var le;return{key:Y.key,name:Y.name,running:Y.running,lastReadMs:((le=i.profiles.find(fe=>fe.browser===Y.key))==null?void 0:le.lastWrittenMs)??null}}),findings:i.episodes.slice(0,6).map(Y=>({browser:Y.browser??null,atMs:Y.endMs})),watching:i.settings.enabled,palette:s}),c.jsx("ul",{className:"bw-counts",children:XF(K,i.profiles).map(Y=>c.jsxs("li",{children:[c.jsx("span",{className:"bw-count-n",children:Y.visits.toLocaleString("en-US")}),c.jsx("span",{className:"bw-count-of",children:Y.name})]},Y.key))})]}),c.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),i.coverage.checkedMs>0&&c.jsxs("p",{className:"bw-since",children:["Last checked ",QF(i.coverage.checkedMs,Z),i.coverage.checks>0&&c.jsxs(c.Fragment,{children:[" · ",i.coverage.checks.toLocaleString("en-US")," ",i.coverage.checks===1?"check":"checks"]})]}),ee!==null&&c.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",KF(ee)]}),O&&c.jsxs("dl",{className:"bw-key",children:[c.jsx("dt",{children:"Sweep"}),c.jsx("dd",{children:"one poll of every watched profile"}),c.jsx("dt",{children:"Dot"}),c.jsx("dd",{children:"a browser, further out the longer since it last wrote history"}),c.jsx("dt",{children:"Ring"}),c.jsx("dd",{children:"a finding, leaving the browser it came from"})]})]}),c.jsxs("section",{className:"bw-sec",children:[c.jsxs("h4",{className:"bw-sec-head",children:["Watched profiles",c.jsx("button",{className:"bw-help",onClick:()=>H(Y=>!Y),"aria-expanded":D,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),D&&c.jsxs("dl",{className:"bw-key",children:[c.jsx("dt",{children:"Running"}),c.jsx("dd",{children:"the browser has a process on this machine right now"}),c.jsx("dt",{children:"Connected"}),c.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"})]}),c.jsx("ul",{className:"bw-profiles",children:K.map(Y=>c.jsxs("li",{children:[c.jsx("span",{className:`bw-prof-dot${Y.running?" on":""}`,"aria-hidden":!0}),c.jsx("span",{className:"bw-prof-name",children:Y.name}),c.jsx("span",{className:"bw-prof-state",children:Y.running?"running":"idle"}),Y.running&&Y.relay.state==="live"&&c.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},Y.key))}),ue.length>0&&c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>R(Y=>!Y),"aria-expanded":X,children:[c.jsx("span",{className:"bw-chev","aria-hidden":!0,children:X?"▾":"▸"})," ",ue.length," not watched"]}),X&&c.jsxs("p",{className:"bw-rest",children:[ue.map(Y=>Y.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]}),i.relay&&c.jsx(n6,{relay:i.relay})]}),c.jsxs("div",{className:"bw-main",children:[c.jsxs("section",{className:"bw-findings",children:[c.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Findings",i.episodes.length>0&&c.jsxs("span",{className:"bw-feed-count",children:[i.episodes.length," ",i.episodes.length===1?"episode":"episodes"]})]}),c.jsx("div",{className:"bw-eps",children:L.length===0?c.jsxs("div",{className:"bw-empty",children:[c.jsx("p",{className:"bw-empty-head",children:"Nothing found yet"}),c.jsxs("p",{className:"bw-empty-note",children:["An episode lands here when a program opens pages in a browser nobody has touched for"," ",i.settings.quietMinutes," ",i.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."]}),!i.settings.enabled&&c.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."})]}):L.map(Y=>c.jsxs("div",{className:"bw-day",children:[c.jsx("h4",{className:"bw-sec-head",children:Y.label}),Y.episodes.map(le=>{const fe=`${le.host}-${le.startMs}`,me=E===fe;return c.jsxs("div",{className:`bw-ep${me?" open":""}`,children:[c.jsxs("div",{className:"bw-ep-row",children:[c.jsxs("button",{className:"bw-ep-head",onClick:()=>_(me?null:fe),"aria-expanded":me,children:[c.jsx("span",{className:"bw-chev","aria-hidden":!0,children:me?"▾":"▸"}),c.jsx("span",{className:"bw-ep-host",children:le.host}),c.jsxs("span",{className:"bw-ep-meta",children:[JF(le),y1(le)&&c.jsxs(c.Fragment,{children:[" · ",y1(le)]})]}),c.jsxs("span",{className:"bw-ep-count",children:[le.count," ",le.count===1?"page":"pages"]})]}),c.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void P(le),"aria-label":`Dismiss ${le.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),me&&c.jsx("ul",{className:"bw-urls",children:le.urls.map((ke,Ve)=>c.jsxs("li",{children:[c.jsx("span",{className:"bw-url-time",children:new Date(ke.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),c.jsx("span",{className:"bw-url",children:ke.url})]},`${ke.url}-${ke.timeMs}-${Ve}`))})]},fe)})]},Y.label))})]}),c.jsxs("section",{className:"bw-feed",children:[c.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Live activity",c.jsxs("span",{className:"bw-feed-count",children:[i.log.length," ",i.log.length===1?"event":"events"]})]}),c.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."}),c.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:i.log.length===0?c.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):i.log.map(Y=>c.jsxs("div",{className:`bw-log-line ${Y.level}${Y.parts?"":" sys"}`,children:[c.jsx("span",{className:"bw-log-time",children:new Date(Y.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),Y.parts?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"bw-log-browser",children:Y.parts.browser}),c.jsx("span",{className:"bw-log-profile",title:Y.parts.profile,children:Y.parts.profile}),c.jsxs("span",{className:"bw-log-value",children:[Y.parts.value,Y.parts.flagged>0&&c.jsxs("span",{className:"bw-log-flag",children:[" · ",Y.parts.flagged," flagged"]})]})]}):c.jsx("span",{className:"bw-log-sys",children:Y.text})]},`${Y.atMs}-${Y.level}-${Y.text}`))})]})]})]}),i&&M&&c.jsxs("div",{className:"bw-settings",children:[c.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:[c.jsx("span",{children:"Nobody browsing for"}),c.jsxs("select",{value:N??i.settings.quietMinutes,onChange:Y=>{k(Number(Y.target.value)),F({quietMinutes:Number(Y.target.value)})},children:[c.jsx("option",{value:1,children:"1 min"}),c.jsx("option",{value:5,children:"5 min"}),c.jsx("option",{value:15,children:"15 min"}),c.jsx("option",{value:30,children:"30 min"}),c.jsx("option",{value:60,children:"60 min"})]})]}),c.jsxs("label",{children:[c.jsx("span",{children:"When it finds one"}),c.jsx("select",{value:i.settings.reaction,onChange:Y=>void F({reaction:Y.target.value}),disabled:!i.settings.enabled,title:i.settings.enabled?"What to do besides writing it down.":"Turn watching on to arm a reaction.",children:(i.reactions??["notify"]).map(Y=>c.jsx("option",{value:Y,children:Y==="notify"?"notify me":Y==="close-tab"?"close the tab":"quit the browser"},Y))})]}),c.jsxs("div",{className:"bw-settings-note",children:[c.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. ",c.jsx("strong",{children:"Usually that is your own agent doing what you asked."})]}),c.jsxs("button",{className:"bw-why",onClick:()=>z(Y=>!Y),"aria-expanded":I,children:[c.jsx("span",{className:"bw-chev","aria-hidden":!0,children:I?"▾":"▸"})," What Browser Watch can access"]}),I&&c.jsxs("dl",{className:"bw-access",children:[c.jsx("dt",{children:"Reads"}),c.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(i.coverage.startedMs).toLocaleString(),"."]}),c.jsx("dt",{children:"Keeps"}),c.jsxs("dd",{children:["Only while the switch is on, and only the episodes it flagged — never your ordinary browsing. In ",c.jsx("code",{className:"bw-path",children:i.coverage.logPath}),", with every address written in full so you can check it yourself."]}),c.jsx("dt",{children:"Sends"}),c.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."}),c.jsx("dt",{children:"Never reads"}),c.jsx("dd",{children:"Anything from before this deck started, cookies, saved passwords, page contents, or any browser profile with no history file."})]})]})]}),p&&c.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:c.jsxs("div",{className:"bw-row err",children:[c.jsx("span",{className:"bw-dot","aria-hidden":!0}),c.jsx("span",{className:"bw-row-label",children:"Could not save that setting"}),c.jsxs("span",{className:"bw-row-detail",children:[p," — the switches below show what is stored, not what you pressed."]}),c.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>h(null),"aria-label":"Dismiss",title:"Dismiss",children:"×"})]})}),i&&c.jsxs("footer",{className:"bw-status",children:[c.jsx("span",{className:`bw-mode-dot${i.settings.enabled?" on":""}`,"aria-hidden":!0}),c.jsx("span",{className:"bw-mode-word",children:g1(i,S).word},g1(i,S).kind),c.jsx("span",{className:"bw-status-text",children:i.coverage.archived===0?i.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${i.coverage.archived} ${i.coverage.archived===1?"episode":"episodes"} on disk`}),c.jsx("button",{className:`glyph-btn bw-gear${M?" on":""}`,onClick:()=>$(Y=>!Y),"aria-expanded":M,"aria-label":"Settings",title:"Settings",children:c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[c.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),c.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"})]})}),c.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[c.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),c.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":i.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"bw-toggle",onClick:()=>void F({enabled:!i.settings.enabled}),title:i.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:c.jsx("span",{className:"bw-toggle-knob"})})]})]})]})]})})}function n6({relay:e}){const[t,n]=b.useState(!1),[s,a]=b.useState(!1),i=e.killswitch.blocked?"unblock":"block",l=e.command[i],d=b.useCallback(async()=>{await oR(l.command)&&(a(!0),window.setTimeout(()=>a(!1),1600))},[l.command]),f=e.profiles.filter(h=>{var g;return(g=h.report)==null?void 0:g.present}),p=e.profiles.filter(h=>h.report===null);return c.jsxs("section",{className:"bw-sec",children:[c.jsx("h4",{className:"bw-sec-head",children:"Remote control"}),c.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&&c.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(h=>c.jsx("code",{className:"bw-path",children:h},h))]}),c.jsxs("button",{className:"bw-why",onClick:()=>n(h=>!h),"aria-expanded":t,children:[c.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&&c.jsxs("div",{className:"bw-rc-body",children:[f.length>0&&c.jsx("dl",{className:"bw-key",children:f.map(h=>c.jsxs(b.Fragment,{children:[c.jsxs("dt",{children:[h.name,h.profile==="Default"?"":` · ${h.profile}`]}),c.jsxs("dd",{children:[h.report.enabled?"enabled":"installed but switched off",h.report.allUrls?", can act on every site":", limited to the sites it was granted",h.report.sensitiveApis.length>0&&c.jsxs(c.Fragment,{children:[" — ",h.report.sensitiveApis.join(", ")]})]})]},`${h.browser}/${h.profile}`))}),p.length>0&&c.jsxs("p",{className:"bw-rc-note",children:[p.map(h=>h.name).join(", ")," — its settings file could not be read, so nothing is claimed about it either way."]}),!e.hostsRead&&c.jsxs("p",{className:"bw-rc-note",children:[e.hostsPath," could not be read, so whether the relay is already blocked is unknown."]}),f.some(h=>h.report.allUrls)&&c.jsxs("p",{className:"bw-rc-note",children:["Narrowing the sites in ",c.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."]}),c.jsxs("div",{className:"bw-rc-cmd",children:[c.jsx("code",{children:l.command}),c.jsx("button",{className:"btn bw-rc-copy",onClick:d,children:s?"Copied":"Copy"})]}),c.jsx("p",{className:"bw-rc-note",children:l.note})]})]})}function r6(e,t){const n=(e??[]).filter(a=>a&&typeof a.fp=="string"&&!t.has(a.fp));if(!n.length)return{request:null,waiting:0};const s=[...n].sort((a,i)=>(a.at??0)-(i.at??0));return{request:s[0],waiting:s.length-1}}function s6({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:i,onLater:l}){const d=b.useRef(null),f=tn(l,{focusRef:d}),p=Ia(n,"accept"),h=Ia(n,"dismiss");return c.jsx("div",{className:"modal-backdrop",onClick:l,role:"presentation",children:c.jsxs("div",{ref:f,className:"modal lan-ask",onClick:g=>g.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("i",{className:"ap-pulse","aria-hidden":!0}),c.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:l,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsxs("p",{className:"lan-ask-who",children:[c.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",c.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",sR(e.at,s)]}),c.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."}),c.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",c.jsx("code",{className:"ap-lan-code",children:e.fp})," — it should match the one on their screen."]}),t>0&&c.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.`}),c.jsxs("div",{className:"lan-ask-acts",children:[c.jsx("button",{type:"button",ref:d,className:"btn",disabled:h.disabled,"aria-busy":h.busy,onClick:i,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),c.jsx("button",{type:"button",className:"btn primary",disabled:p.disabled,"aria-busy":p.busy,onClick:a,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function a0(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Nf,v1;function a6(){if(v1)return Nf;v1=1;function e(){this.__data__=[],this.size=0}return Nf=e,Nf}var Ef,w1;function ri(){if(w1)return Ef;w1=1;function e(t,n){return t===n||t!==t&&n!==n}return Ef=e,Ef}var jf,x1;function dd(){if(x1)return jf;x1=1;var e=ri();function t(n,s){for(var a=n.length;a--;)if(e(n[a][0],s))return a;return-1}return jf=t,jf}var Cf,b1;function o6(){if(b1)return Cf;b1=1;var e=dd(),t=Array.prototype,n=t.splice;function s(a){var i=this.__data__,l=e(i,a);if(l<0)return!1;var d=i.length-1;return l==d?i.pop():n.call(i,l,1),--this.size,!0}return Cf=s,Cf}var Tf,k1;function i6(){if(k1)return Tf;k1=1;var e=dd();function t(n){var s=this.__data__,a=e(s,n);return a<0?void 0:s[a][1]}return Tf=t,Tf}var Rf,_1;function l6(){if(_1)return Rf;_1=1;var e=dd();function t(n){return e(this.__data__,n)>-1}return Rf=t,Rf}var Af,S1;function c6(){if(S1)return Af;S1=1;var e=dd();function t(n,s){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,s])):a[i][1]=s,this}return Af=t,Af}var Mf,N1;function hd(){if(N1)return Mf;N1=1;var e=a6(),t=o6(),n=i6(),s=l6(),a=c6();function i(l){var d=-1,f=l==null?0:l.length;for(this.clear();++d<f;){var p=l[d];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,Mf=i,Mf}var If,E1;function u6(){if(E1)return If;E1=1;var e=hd();function t(){this.__data__=new e,this.size=0}return If=t,If}var $f,j1;function d6(){if(j1)return $f;j1=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return $f=e,$f}var Of,C1;function h6(){if(C1)return Of;C1=1;function e(t){return this.__data__.get(t)}return Of=e,Of}var Pf,T1;function f6(){if(T1)return Pf;T1=1;function e(t){return this.__data__.has(t)}return Pf=e,Pf}var Lf,R1;function yR(){if(R1)return Lf;R1=1;var e=typeof ru=="object"&&ru&&ru.Object===Object&&ru;return Lf=e,Lf}var Df,A1;function pr(){if(A1)return Df;A1=1;var e=yR(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Df=n,Df}var qf,M1;function si(){if(M1)return qf;M1=1;var e=pr(),t=e.Symbol;return qf=t,qf}var Ff,I1;function p6(){if(I1)return Ff;I1=1;var e=si(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function i(l){var d=n.call(l,a),f=l[a];try{l[a]=void 0;var p=!0}catch{}var h=s.call(l);return p&&(d?l[a]=f:delete l[a]),h}return Ff=i,Ff}var zf,$1;function m6(){if($1)return zf;$1=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return zf=n,zf}var Bf,O1;function $a(){if(O1)return Bf;O1=1;var e=si(),t=p6(),n=m6(),s="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function l(d){return d==null?d===void 0?a:s:i&&i in Object(d)?t(d):n(d)}return Bf=l,Bf}var Uf,P1;function Vn(){if(P1)return Uf;P1=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Uf=e,Uf}var Wf,L1;function Hl(){if(L1)return Wf;L1=1;var e=$a(),t=Vn(),n="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function l(d){if(!t(d))return!1;var f=e(d);return f==s||f==a||f==n||f==i}return Wf=l,Wf}var Hf,D1;function g6(){if(D1)return Hf;D1=1;var e=pr(),t=e["__core-js_shared__"];return Hf=t,Hf}var Gf,q1;function y6(){if(q1)return Gf;q1=1;var e=g6(),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 Gf=n,Gf}var Vf,F1;function vR(){if(F1)return Vf;F1=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 Vf=n,Vf}var Yf,z1;function v6(){if(z1)return Yf;z1=1;var e=Hl(),t=y6(),n=Vn(),s=vR(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,l=Function.prototype,d=Object.prototype,f=l.toString,p=d.hasOwnProperty,h=RegExp("^"+f.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(y){if(!n(y)||t(y))return!1;var w=e(y)?h:i;return w.test(s(y))}return Yf=g,Yf}var Kf,B1;function w6(){if(B1)return Kf;B1=1;function e(t,n){return t==null?void 0:t[n]}return Kf=e,Kf}var Xf,U1;function Oa(){if(U1)return Xf;U1=1;var e=v6(),t=w6();function n(s,a){var i=t(s,a);return e(i)?i:void 0}return Xf=n,Xf}var Qf,W1;function o0(){if(W1)return Qf;W1=1;var e=Oa(),t=pr(),n=e(t,"Map");return Qf=n,Qf}var Zf,H1;function fd(){if(H1)return Zf;H1=1;var e=Oa(),t=e(Object,"create");return Zf=t,Zf}var Jf,G1;function x6(){if(G1)return Jf;G1=1;var e=fd();function t(){this.__data__=e?e(null):{},this.size=0}return Jf=t,Jf}var ep,V1;function b6(){if(V1)return ep;V1=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return ep=e,ep}var tp,Y1;function k6(){if(Y1)return tp;Y1=1;var e=fd(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function a(i){var l=this.__data__;if(e){var d=l[i];return d===t?void 0:d}return s.call(l,i)?l[i]:void 0}return tp=a,tp}var np,K1;function _6(){if(K1)return np;K1=1;var e=fd(),t=Object.prototype,n=t.hasOwnProperty;function s(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return np=s,np}var rp,X1;function S6(){if(X1)return rp;X1=1;var e=fd(),t="__lodash_hash_undefined__";function n(s,a){var i=this.__data__;return this.size+=this.has(s)?0:1,i[s]=e&&a===void 0?t:a,this}return rp=n,rp}var sp,Q1;function N6(){if(Q1)return sp;Q1=1;var e=x6(),t=b6(),n=k6(),s=_6(),a=S6();function i(l){var d=-1,f=l==null?0:l.length;for(this.clear();++d<f;){var p=l[d];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,sp=i,sp}var ap,Z1;function E6(){if(Z1)return ap;Z1=1;var e=N6(),t=hd(),n=o0();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return ap=s,ap}var op,J1;function j6(){if(J1)return op;J1=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return op=e,op}var ip,e_;function pd(){if(e_)return ip;e_=1;var e=j6();function t(n,s){var a=n.__data__;return e(s)?a[typeof s=="string"?"string":"hash"]:a.map}return ip=t,ip}var lp,t_;function C6(){if(t_)return lp;t_=1;var e=pd();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return lp=t,lp}var cp,n_;function T6(){if(n_)return cp;n_=1;var e=pd();function t(n){return e(this,n).get(n)}return cp=t,cp}var up,r_;function R6(){if(r_)return up;r_=1;var e=pd();function t(n){return e(this,n).has(n)}return up=t,up}var dp,s_;function A6(){if(s_)return dp;s_=1;var e=pd();function t(n,s){var a=e(this,n),i=a.size;return a.set(n,s),this.size+=a.size==i?0:1,this}return dp=t,dp}var hp,a_;function i0(){if(a_)return hp;a_=1;var e=E6(),t=C6(),n=T6(),s=R6(),a=A6();function i(l){var d=-1,f=l==null?0:l.length;for(this.clear();++d<f;){var p=l[d];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,hp=i,hp}var fp,o_;function M6(){if(o_)return fp;o_=1;var e=hd(),t=o0(),n=i0(),s=200;function a(i,l){var d=this.__data__;if(d instanceof e){var f=d.__data__;if(!t||f.length<s-1)return f.push([i,l]),this.size=++d.size,this;d=this.__data__=new n(f)}return d.set(i,l),this.size=d.size,this}return fp=a,fp}var pp,i_;function md(){if(i_)return pp;i_=1;var e=hd(),t=u6(),n=d6(),s=h6(),a=f6(),i=M6();function l(d){var f=this.__data__=new e(d);this.size=f.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=s,l.prototype.has=a,l.prototype.set=i,pp=l,pp}var mp,l_;function l0(){if(l_)return mp;l_=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 mp=e,mp}var gp,c_;function wR(){if(c_)return gp;c_=1;var e=Oa(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return gp=t,gp}var yp,u_;function gd(){if(u_)return yp;u_=1;var e=wR();function t(n,s,a){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[s]=a}return yp=t,yp}var vp,d_;function yd(){if(d_)return vp;d_=1;var e=gd(),t=ri(),n=Object.prototype,s=n.hasOwnProperty;function a(i,l,d){var f=i[l];(!(s.call(i,l)&&t(f,d))||d===void 0&&!(l in i))&&e(i,l,d)}return vp=a,vp}var wp,h_;function Gl(){if(h_)return wp;h_=1;var e=yd(),t=gd();function n(s,a,i,l){var d=!i;i||(i={});for(var f=-1,p=a.length;++f<p;){var h=a[f],g=l?l(i[h],s[h],h,i,s):void 0;g===void 0&&(g=s[h]),d?t(i,h,g):e(i,h,g)}return i}return wp=n,wp}var xp,f_;function I6(){if(f_)return xp;f_=1;function e(t,n){for(var s=-1,a=Array(t);++s<t;)a[s]=n(s);return a}return xp=e,xp}var bp,p_;function Tr(){if(p_)return bp;p_=1;function e(t){return t!=null&&typeof t=="object"}return bp=e,bp}var kp,m_;function $6(){if(m_)return kp;m_=1;var e=$a(),t=Tr(),n="[object Arguments]";function s(a){return t(a)&&e(a)==n}return kp=s,kp}var _p,g_;function Vl(){if(g_)return _p;g_=1;var e=$6(),t=Tr(),n=Object.prototype,s=n.hasOwnProperty,a=n.propertyIsEnumerable,i=e((function(){return arguments})())?e:function(l){return t(l)&&s.call(l,"callee")&&!a.call(l,"callee")};return _p=i,_p}var Sp,y_;function It(){if(y_)return Sp;y_=1;var e=Array.isArray;return Sp=e,Sp}var gl={exports:{}},Np,v_;function O6(){if(v_)return Np;v_=1;function e(){return!1}return Np=e,Np}gl.exports;var w_;function ai(){return w_||(w_=1,(function(e,t){var n=pr(),s=O6(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,l=i&&i.exports===a,d=l?n.Buffer:void 0,f=d?d.isBuffer:void 0,p=f||s;e.exports=p})(gl,gl.exports)),gl.exports}var Ep,x_;function vd(){if(x_)return Ep;x_=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,a){var i=typeof s;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<a}return Ep=n,Ep}var jp,b_;function c0(){if(b_)return jp;b_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return jp=t,jp}var Cp,k_;function P6(){if(k_)return Cp;k_=1;var e=$a(),t=c0(),n=Tr(),s="[object Arguments]",a="[object Array]",i="[object Boolean]",l="[object Date]",d="[object Error]",f="[object Function]",p="[object Map]",h="[object Number]",g="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",k="[object WeakMap]",E="[object ArrayBuffer]",_="[object DataView]",S="[object Float32Array]",j="[object Float64Array]",C="[object Int8Array]",M="[object Int16Array]",$="[object Int32Array]",I="[object Uint8Array]",z="[object Uint8ClampedArray]",O="[object Uint16Array]",A="[object Uint32Array]",D={};D[S]=D[j]=D[C]=D[M]=D[$]=D[I]=D[z]=D[O]=D[A]=!0,D[s]=D[a]=D[E]=D[i]=D[_]=D[l]=D[d]=D[f]=D[p]=D[h]=D[g]=D[y]=D[w]=D[N]=D[k]=!1;function H(X){return n(X)&&t(X.length)&&!!D[e(X)]}return Cp=H,Cp}var Tp,__;function wd(){if(__)return Tp;__=1;function e(t){return function(n){return t(n)}}return Tp=e,Tp}var yl={exports:{}};yl.exports;var S_;function u0(){return S_||(S_=1,(function(e,t){var n=yR(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,l=i&&n.process,d=(function(){try{var f=a&&a.require&&a.require("util").types;return f||l&&l.binding&&l.binding("util")}catch{}})();e.exports=d})(yl,yl.exports)),yl.exports}var Rp,N_;function Yl(){if(N_)return Rp;N_=1;var e=P6(),t=wd(),n=u0(),s=n&&n.isTypedArray,a=s?t(s):e;return Rp=a,Rp}var Ap,E_;function xR(){if(E_)return Ap;E_=1;var e=I6(),t=Vl(),n=It(),s=ai(),a=vd(),i=Yl(),l=Object.prototype,d=l.hasOwnProperty;function f(p,h){var g=n(p),y=!g&&t(p),w=!g&&!y&&s(p),N=!g&&!y&&!w&&i(p),k=g||y||w||N,E=k?e(p.length,String):[],_=E.length;for(var S in p)(h||d.call(p,S))&&!(k&&(S=="length"||w&&(S=="offset"||S=="parent")||N&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||a(S,_)))&&E.push(S);return E}return Ap=f,Ap}var Mp,j_;function xd(){if(j_)return Mp;j_=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,a=typeof s=="function"&&s.prototype||e;return n===a}return Mp=t,Mp}var Ip,C_;function bR(){if(C_)return Ip;C_=1;function e(t,n){return function(s){return t(n(s))}}return Ip=e,Ip}var $p,T_;function L6(){if(T_)return $p;T_=1;var e=bR(),t=e(Object.keys,Object);return $p=t,$p}var Op,R_;function d0(){if(R_)return Op;R_=1;var e=xd(),t=L6(),n=Object.prototype,s=n.hasOwnProperty;function a(i){if(!e(i))return t(i);var l=[];for(var d in Object(i))s.call(i,d)&&d!="constructor"&&l.push(d);return l}return Op=a,Op}var Pp,A_;function as(){if(A_)return Pp;A_=1;var e=Hl(),t=c0();function n(s){return s!=null&&t(s.length)&&!e(s)}return Pp=n,Pp}var Lp,M_;function zs(){if(M_)return Lp;M_=1;var e=xR(),t=d0(),n=as();function s(a){return n(a)?e(a):t(a)}return Lp=s,Lp}var Dp,I_;function D6(){if(I_)return Dp;I_=1;var e=Gl(),t=zs();function n(s,a){return s&&e(a,t(a),s)}return Dp=n,Dp}var qp,$_;function q6(){if($_)return qp;$_=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return qp=e,qp}var Fp,O_;function F6(){if(O_)return Fp;O_=1;var e=Vn(),t=xd(),n=q6(),s=Object.prototype,a=s.hasOwnProperty;function i(l){if(!e(l))return n(l);var d=t(l),f=[];for(var p in l)p=="constructor"&&(d||!a.call(l,p))||f.push(p);return f}return Fp=i,Fp}var zp,P_;function Pa(){if(P_)return zp;P_=1;var e=xR(),t=F6(),n=as();function s(a){return n(a)?e(a,!0):t(a)}return zp=s,zp}var Bp,L_;function z6(){if(L_)return Bp;L_=1;var e=Gl(),t=Pa();function n(s,a){return s&&e(a,t(a),s)}return Bp=n,Bp}var vl={exports:{}};vl.exports;var D_;function kR(){return D_||(D_=1,(function(e,t){var n=pr(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,l=i?n.Buffer:void 0,d=l?l.allocUnsafe:void 0;function f(p,h){if(h)return p.slice();var g=p.length,y=d?d(g):new p.constructor(g);return p.copy(y),y}e.exports=f})(vl,vl.exports)),vl.exports}var Up,q_;function _R(){if(q_)return Up;q_=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 Up=e,Up}var Wp,F_;function SR(){if(F_)return Wp;F_=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=0,l=[];++s<a;){var d=t[s];n(d,s,t)&&(l[i++]=d)}return l}return Wp=e,Wp}var Hp,z_;function NR(){if(z_)return Hp;z_=1;function e(){return[]}return Hp=e,Hp}var Gp,B_;function h0(){if(B_)return Gp;B_=1;var e=SR(),t=NR(),n=Object.prototype,s=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(l){return l==null?[]:(l=Object(l),e(a(l),function(d){return s.call(l,d)}))}:t;return Gp=i,Gp}var Vp,U_;function B6(){if(U_)return Vp;U_=1;var e=Gl(),t=h0();function n(s,a){return e(s,t(s),a)}return Vp=n,Vp}var Yp,W_;function f0(){if(W_)return Yp;W_=1;function e(t,n){for(var s=-1,a=n.length,i=t.length;++s<a;)t[i+s]=n[s];return t}return Yp=e,Yp}var Kp,H_;function bd(){if(H_)return Kp;H_=1;var e=bR(),t=e(Object.getPrototypeOf,Object);return Kp=t,Kp}var Xp,G_;function ER(){if(G_)return Xp;G_=1;var e=f0(),t=bd(),n=h0(),s=NR(),a=Object.getOwnPropertySymbols,i=a?function(l){for(var d=[];l;)e(d,n(l)),l=t(l);return d}:s;return Xp=i,Xp}var Qp,V_;function U6(){if(V_)return Qp;V_=1;var e=Gl(),t=ER();function n(s,a){return e(s,t(s),a)}return Qp=n,Qp}var Zp,Y_;function jR(){if(Y_)return Zp;Y_=1;var e=f0(),t=It();function n(s,a,i){var l=a(s);return t(s)?l:e(l,i(s))}return Zp=n,Zp}var Jp,K_;function CR(){if(K_)return Jp;K_=1;var e=jR(),t=h0(),n=zs();function s(a){return e(a,n,t)}return Jp=s,Jp}var em,X_;function W6(){if(X_)return em;X_=1;var e=jR(),t=ER(),n=Pa();function s(a){return e(a,n,t)}return em=s,em}var tm,Q_;function H6(){if(Q_)return tm;Q_=1;var e=Oa(),t=pr(),n=e(t,"DataView");return tm=n,tm}var nm,Z_;function G6(){if(Z_)return nm;Z_=1;var e=Oa(),t=pr(),n=e(t,"Promise");return nm=n,nm}var rm,J_;function TR(){if(J_)return rm;J_=1;var e=Oa(),t=pr(),n=e(t,"Set");return rm=n,rm}var sm,eS;function V6(){if(eS)return sm;eS=1;var e=Oa(),t=pr(),n=e(t,"WeakMap");return sm=n,sm}var am,tS;function oi(){if(tS)return am;tS=1;var e=H6(),t=o0(),n=G6(),s=TR(),a=V6(),i=$a(),l=vR(),d="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",g="[object WeakMap]",y="[object DataView]",w=l(e),N=l(t),k=l(n),E=l(s),_=l(a),S=i;return(e&&S(new e(new ArrayBuffer(1)))!=y||t&&S(new t)!=d||n&&S(n.resolve())!=p||s&&S(new s)!=h||a&&S(new a)!=g)&&(S=function(j){var C=i(j),M=C==f?j.constructor:void 0,$=M?l(M):"";if($)switch($){case w:return y;case N:return d;case k:return p;case E:return h;case _:return g}return C}),am=S,am}var om,nS;function Y6(){if(nS)return om;nS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var a=s.length,i=new s.constructor(a);return a&&typeof s[0]=="string"&&t.call(s,"index")&&(i.index=s.index,i.input=s.input),i}return om=n,om}var im,rS;function RR(){if(rS)return im;rS=1;var e=pr(),t=e.Uint8Array;return im=t,im}var lm,sS;function p0(){if(sS)return lm;sS=1;var e=RR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return lm=t,lm}var cm,aS;function K6(){if(aS)return cm;aS=1;var e=p0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return cm=t,cm}var um,oS;function X6(){if(oS)return um;oS=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return um=t,um}var dm,iS;function Q6(){if(iS)return dm;iS=1;var e=si(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(a){return n?Object(n.call(a)):{}}return dm=s,dm}var hm,lS;function AR(){if(lS)return hm;lS=1;var e=p0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return hm=t,hm}var fm,cS;function Z6(){if(cS)return fm;cS=1;var e=p0(),t=K6(),n=X6(),s=Q6(),a=AR(),i="[object Boolean]",l="[object Date]",d="[object Map]",f="[object Number]",p="[object RegExp]",h="[object Set]",g="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",k="[object Float32Array]",E="[object Float64Array]",_="[object Int8Array]",S="[object Int16Array]",j="[object Int32Array]",C="[object Uint8Array]",M="[object Uint8ClampedArray]",$="[object Uint16Array]",I="[object Uint32Array]";function z(O,A,D){var H=O.constructor;switch(A){case w:return e(O);case i:case l:return new H(+O);case N:return t(O,D);case k:case E:case _:case S:case j:case C:case M:case $:case I:return a(O,D);case d:return new H;case f:case g:return new H(O);case p:return n(O);case h:return new H;case y:return s(O)}}return fm=z,fm}var pm,uS;function MR(){if(uS)return pm;uS=1;var e=Vn(),t=Object.create,n=(function(){function s(){}return function(a){if(!e(a))return{};if(t)return t(a);s.prototype=a;var i=new s;return s.prototype=void 0,i}})();return pm=n,pm}var mm,dS;function IR(){if(dS)return mm;dS=1;var e=MR(),t=bd(),n=xd();function s(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return mm=s,mm}var gm,hS;function J6(){if(hS)return gm;hS=1;var e=oi(),t=Tr(),n="[object Map]";function s(a){return t(a)&&e(a)==n}return gm=s,gm}var ym,fS;function ez(){if(fS)return ym;fS=1;var e=J6(),t=wd(),n=u0(),s=n&&n.isMap,a=s?t(s):e;return ym=a,ym}var vm,pS;function tz(){if(pS)return vm;pS=1;var e=oi(),t=Tr(),n="[object Set]";function s(a){return t(a)&&e(a)==n}return vm=s,vm}var wm,mS;function nz(){if(mS)return wm;mS=1;var e=tz(),t=wd(),n=u0(),s=n&&n.isSet,a=s?t(s):e;return wm=a,wm}var xm,gS;function $R(){if(gS)return xm;gS=1;var e=md(),t=l0(),n=yd(),s=D6(),a=z6(),i=kR(),l=_R(),d=B6(),f=U6(),p=CR(),h=W6(),g=oi(),y=Y6(),w=Z6(),N=IR(),k=It(),E=ai(),_=ez(),S=Vn(),j=nz(),C=zs(),M=Pa(),$=1,I=2,z=4,O="[object Arguments]",A="[object Array]",D="[object Boolean]",H="[object Date]",X="[object Error]",R="[object Function]",Z="[object GeneratorFunction]",B="[object Map]",Q="[object Number]",P="[object Object]",F="[object RegExp]",J="[object Set]",L="[object String]",K="[object Symbol]",ue="[object WeakMap]",G="[object ArrayBuffer]",U="[object DataView]",ee="[object Float32Array]",Y="[object Float64Array]",le="[object Int8Array]",fe="[object Int16Array]",me="[object Int32Array]",ke="[object Uint8Array]",Ve="[object Uint8ClampedArray]",Le="[object Uint16Array]",qe="[object Uint32Array]",Ne={};Ne[O]=Ne[A]=Ne[G]=Ne[U]=Ne[D]=Ne[H]=Ne[ee]=Ne[Y]=Ne[le]=Ne[fe]=Ne[me]=Ne[B]=Ne[Q]=Ne[P]=Ne[F]=Ne[J]=Ne[L]=Ne[K]=Ne[ke]=Ne[Ve]=Ne[Le]=Ne[qe]=!0,Ne[X]=Ne[R]=Ne[ue]=!1;function Ge(be,re,Qe,ft,ut,at){var Ye,pe=re&$,we=re&I,Pe=re&z;if(Qe&&(Ye=ut?Qe(be,ft,ut,at):Qe(be)),Ye!==void 0)return Ye;if(!S(be))return be;var Ue=k(be);if(Ue){if(Ye=y(be),!pe)return l(be,Ye)}else{var ot=g(be),$e=ot==R||ot==Z;if(E(be))return i(be,pe);if(ot==P||ot==O||$e&&!ut){if(Ye=we||$e?{}:N(be),!pe)return we?f(be,a(Ye,be)):d(be,s(Ye,be))}else{if(!Ne[ot])return ut?be:{};Ye=w(be,ot,pe)}}at||(at=new e);var se=at.get(be);if(se)return se;at.set(be,Ye),j(be)?be.forEach(function(_e){Ye.add(Ge(_e,re,Qe,_e,be,at))}):_(be)&&be.forEach(function(_e,Be){Ye.set(Be,Ge(_e,re,Qe,Be,be,at))});var Se=Pe?we?h:p:we?M:C,De=Ue?void 0:Se(be);return t(De||be,function(_e,Be){De&&(Be=_e,_e=be[Be]),n(Ye,Be,Ge(_e,re,Qe,Be,be,at))}),Ye}return xm=Ge,xm}var bm,yS;function rz(){if(yS)return bm;yS=1;var e=$R(),t=4;function n(s){return e(s,t)}return bm=n,bm}var km,vS;function m0(){if(vS)return km;vS=1;function e(t){return function(){return t}}return km=e,km}var _m,wS;function sz(){if(wS)return _m;wS=1;function e(t){return function(n,s,a){for(var i=-1,l=Object(n),d=a(n),f=d.length;f--;){var p=d[t?f:++i];if(s(l[p],p,l)===!1)break}return n}}return _m=e,_m}var Sm,xS;function g0(){if(xS)return Sm;xS=1;var e=sz(),t=e();return Sm=t,Sm}var Nm,bS;function y0(){if(bS)return Nm;bS=1;var e=g0(),t=zs();function n(s,a){return s&&e(s,a,t)}return Nm=n,Nm}var Em,kS;function az(){if(kS)return Em;kS=1;var e=as();function t(n,s){return function(a,i){if(a==null)return a;if(!e(a))return n(a,i);for(var l=a.length,d=s?l:-1,f=Object(a);(s?d--:++d<l)&&i(f[d],d,f)!==!1;);return a}}return Em=t,Em}var jm,_S;function kd(){if(_S)return jm;_S=1;var e=y0(),t=az(),n=t(e);return jm=n,jm}var Cm,SS;function La(){if(SS)return Cm;SS=1;function e(t){return t}return Cm=e,Cm}var Tm,NS;function OR(){if(NS)return Tm;NS=1;var e=La();function t(n){return typeof n=="function"?n:e}return Tm=t,Tm}var Rm,ES;function PR(){if(ES)return Rm;ES=1;var e=l0(),t=kd(),n=OR(),s=It();function a(i,l){var d=s(i)?e:t;return d(i,n(l))}return Rm=a,Rm}var Am,jS;function LR(){return jS||(jS=1,Am=PR()),Am}var Mm,CS;function oz(){if(CS)return Mm;CS=1;var e=kd();function t(n,s){var a=[];return e(n,function(i,l,d){s(i,l,d)&&a.push(i)}),a}return Mm=t,Mm}var Im,TS;function iz(){if(TS)return Im;TS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Im=t,Im}var $m,RS;function lz(){if(RS)return $m;RS=1;function e(t){return this.__data__.has(t)}return $m=e,$m}var Om,AS;function DR(){if(AS)return Om;AS=1;var e=i0(),t=iz(),n=lz();function s(a){var i=-1,l=a==null?0:a.length;for(this.__data__=new e;++i<l;)this.add(a[i])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,Om=s,Om}var Pm,MS;function cz(){if(MS)return Pm;MS=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 Pm=e,Pm}var Lm,IS;function qR(){if(IS)return Lm;IS=1;function e(t,n){return t.has(n)}return Lm=e,Lm}var Dm,$S;function FR(){if($S)return Dm;$S=1;var e=DR(),t=cz(),n=qR(),s=1,a=2;function i(l,d,f,p,h,g){var y=f&s,w=l.length,N=d.length;if(w!=N&&!(y&&N>w))return!1;var k=g.get(l),E=g.get(d);if(k&&E)return k==d&&E==l;var _=-1,S=!0,j=f&a?new e:void 0;for(g.set(l,d),g.set(d,l);++_<w;){var C=l[_],M=d[_];if(p)var $=y?p(M,C,_,d,l,g):p(C,M,_,l,d,g);if($!==void 0){if($)continue;S=!1;break}if(j){if(!t(d,function(I,z){if(!n(j,z)&&(C===I||h(C,I,f,p,g)))return j.push(z)})){S=!1;break}}else if(!(C===M||h(C,M,f,p,g))){S=!1;break}}return g.delete(l),g.delete(d),S}return Dm=i,Dm}var qm,OS;function uz(){if(OS)return qm;OS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a,i){s[++n]=[i,a]}),s}return qm=e,qm}var Fm,PS;function v0(){if(PS)return Fm;PS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a){s[++n]=a}),s}return Fm=e,Fm}var zm,LS;function dz(){if(LS)return zm;LS=1;var e=si(),t=RR(),n=ri(),s=FR(),a=uz(),i=v0(),l=1,d=2,f="[object Boolean]",p="[object Date]",h="[object Error]",g="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",k="[object String]",E="[object Symbol]",_="[object ArrayBuffer]",S="[object DataView]",j=e?e.prototype:void 0,C=j?j.valueOf:void 0;function M($,I,z,O,A,D,H){switch(z){case S:if($.byteLength!=I.byteLength||$.byteOffset!=I.byteOffset)return!1;$=$.buffer,I=I.buffer;case _:return!($.byteLength!=I.byteLength||!D(new t($),new t(I)));case f:case p:case y:return n(+$,+I);case h:return $.name==I.name&&$.message==I.message;case w:case k:return $==I+"";case g:var X=a;case N:var R=O&l;if(X||(X=i),$.size!=I.size&&!R)return!1;var Z=H.get($);if(Z)return Z==I;O|=d,H.set($,I);var B=s(X($),X(I),O,A,D,H);return H.delete($),B;case E:if(C)return C.call($)==C.call(I)}return!1}return zm=M,zm}var Bm,DS;function hz(){if(DS)return Bm;DS=1;var e=CR(),t=1,n=Object.prototype,s=n.hasOwnProperty;function a(i,l,d,f,p,h){var g=d&t,y=e(i),w=y.length,N=e(l),k=N.length;if(w!=k&&!g)return!1;for(var E=w;E--;){var _=y[E];if(!(g?_ in l:s.call(l,_)))return!1}var S=h.get(i),j=h.get(l);if(S&&j)return S==l&&j==i;var C=!0;h.set(i,l),h.set(l,i);for(var M=g;++E<w;){_=y[E];var $=i[_],I=l[_];if(f)var z=g?f(I,$,_,l,i,h):f($,I,_,i,l,h);if(!(z===void 0?$===I||p($,I,d,f,h):z)){C=!1;break}M||(M=_=="constructor")}if(C&&!M){var O=i.constructor,A=l.constructor;O!=A&&"constructor"in i&&"constructor"in l&&!(typeof O=="function"&&O instanceof O&&typeof A=="function"&&A instanceof A)&&(C=!1)}return h.delete(i),h.delete(l),C}return Bm=a,Bm}var Um,qS;function fz(){if(qS)return Um;qS=1;var e=md(),t=FR(),n=dz(),s=hz(),a=oi(),i=It(),l=ai(),d=Yl(),f=1,p="[object Arguments]",h="[object Array]",g="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(k,E,_,S,j,C){var M=i(k),$=i(E),I=M?h:a(k),z=$?h:a(E);I=I==p?g:I,z=z==p?g:z;var O=I==g,A=z==g,D=I==z;if(D&&l(k)){if(!l(E))return!1;M=!0,O=!1}if(D&&!O)return C||(C=new e),M||d(k)?t(k,E,_,S,j,C):n(k,E,I,_,S,j,C);if(!(_&f)){var H=O&&w.call(k,"__wrapped__"),X=A&&w.call(E,"__wrapped__");if(H||X){var R=H?k.value():k,Z=X?E.value():E;return C||(C=new e),j(R,Z,_,S,C)}}return D?(C||(C=new e),s(k,E,_,S,j,C)):!1}return Um=N,Um}var Wm,FS;function zR(){if(FS)return Wm;FS=1;var e=fz(),t=Tr();function n(s,a,i,l,d){return s===a?!0:s==null||a==null||!t(s)&&!t(a)?s!==s&&a!==a:e(s,a,i,l,n,d)}return Wm=n,Wm}var Hm,zS;function pz(){if(zS)return Hm;zS=1;var e=md(),t=zR(),n=1,s=2;function a(i,l,d,f){var p=d.length,h=p,g=!f;if(i==null)return!h;for(i=Object(i);p--;){var y=d[p];if(g&&y[2]?y[1]!==i[y[0]]:!(y[0]in i))return!1}for(;++p<h;){y=d[p];var w=y[0],N=i[w],k=y[1];if(g&&y[2]){if(N===void 0&&!(w in i))return!1}else{var E=new e;if(f)var _=f(N,k,w,i,l,E);if(!(_===void 0?t(k,N,n|s,f,E):_))return!1}}return!0}return Hm=a,Hm}var Gm,BS;function BR(){if(BS)return Gm;BS=1;var e=Vn();function t(n){return n===n&&!e(n)}return Gm=t,Gm}var Vm,US;function mz(){if(US)return Vm;US=1;var e=BR(),t=zs();function n(s){for(var a=t(s),i=a.length;i--;){var l=a[i],d=s[l];a[i]=[l,d,e(d)]}return a}return Vm=n,Vm}var Ym,WS;function UR(){if(WS)return Ym;WS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return Ym=e,Ym}var Km,HS;function gz(){if(HS)return Km;HS=1;var e=pz(),t=mz(),n=UR();function s(a){var i=t(a);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(l){return l===a||e(l,a,i)}}return Km=s,Km}var Xm,GS;function ii(){if(GS)return Xm;GS=1;var e=$a(),t=Tr(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return Xm=s,Xm}var Qm,VS;function w0(){if(VS)return Qm;VS=1;var e=It(),t=ii(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(i,l){if(e(i))return!1;var d=typeof i;return d=="number"||d=="symbol"||d=="boolean"||i==null||t(i)?!0:s.test(i)||!n.test(i)||l!=null&&i in Object(l)}return Qm=a,Qm}var Zm,YS;function yz(){if(YS)return Zm;YS=1;var e=i0(),t="Expected a function";function n(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var l=arguments,d=a?a.apply(this,l):l[0],f=i.cache;if(f.has(d))return f.get(d);var p=s.apply(this,l);return i.cache=f.set(d,p)||f,p};return i.cache=new(n.Cache||e),i}return n.Cache=e,Zm=n,Zm}var Jm,KS;function vz(){if(KS)return Jm;KS=1;var e=yz(),t=500;function n(s){var a=e(s,function(l){return i.size===t&&i.clear(),l}),i=a.cache;return a}return Jm=n,Jm}var eg,XS;function wz(){if(XS)return eg;XS=1;var e=vz(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(l,d,f,p){i.push(f?p.replace(n,"$1"):d||l)}),i});return eg=s,eg}var tg,QS;function _d(){if(QS)return tg;QS=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=Array(a);++s<a;)i[s]=n(t[s],s,t);return i}return tg=e,tg}var ng,ZS;function xz(){if(ZS)return ng;ZS=1;var e=si(),t=_d(),n=It(),s=ii(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function l(d){if(typeof d=="string")return d;if(n(d))return t(d,l)+"";if(s(d))return i?i.call(d):"";var f=d+"";return f=="0"&&1/d==-1/0?"-0":f}return ng=l,ng}var rg,JS;function WR(){if(JS)return rg;JS=1;var e=xz();function t(n){return n==null?"":e(n)}return rg=t,rg}var sg,eN;function Sd(){if(eN)return sg;eN=1;var e=It(),t=w0(),n=wz(),s=WR();function a(i,l){return e(i)?i:t(i,l)?[i]:n(s(i))}return sg=a,sg}var ag,tN;function Kl(){if(tN)return ag;tN=1;var e=ii();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return ag=t,ag}var og,nN;function Nd(){if(nN)return og;nN=1;var e=Sd(),t=Kl();function n(s,a){a=e(a,s);for(var i=0,l=a.length;s!=null&&i<l;)s=s[t(a[i++])];return i&&i==l?s:void 0}return og=n,og}var ig,rN;function bz(){if(rN)return ig;rN=1;var e=Nd();function t(n,s,a){var i=n==null?void 0:e(n,s);return i===void 0?a:i}return ig=t,ig}var lg,sN;function kz(){if(sN)return lg;sN=1;function e(t,n){return t!=null&&n in Object(t)}return lg=e,lg}var cg,aN;function HR(){if(aN)return cg;aN=1;var e=Sd(),t=Vl(),n=It(),s=vd(),a=c0(),i=Kl();function l(d,f,p){f=e(f,d);for(var h=-1,g=f.length,y=!1;++h<g;){var w=i(f[h]);if(!(y=d!=null&&p(d,w)))break;d=d[w]}return y||++h!=g?y:(g=d==null?0:d.length,!!g&&a(g)&&s(w,g)&&(n(d)||t(d)))}return cg=l,cg}var ug,oN;function GR(){if(oN)return ug;oN=1;var e=kz(),t=HR();function n(s,a){return s!=null&&t(s,a,e)}return ug=n,ug}var dg,iN;function _z(){if(iN)return dg;iN=1;var e=zR(),t=bz(),n=GR(),s=w0(),a=BR(),i=UR(),l=Kl(),d=1,f=2;function p(h,g){return s(h)&&a(g)?i(l(h),g):function(y){var w=t(y,h);return w===void 0&&w===g?n(y,h):e(g,w,d|f)}}return dg=p,dg}var hg,lN;function VR(){if(lN)return hg;lN=1;function e(t){return function(n){return n==null?void 0:n[t]}}return hg=e,hg}var fg,cN;function Sz(){if(cN)return fg;cN=1;var e=Nd();function t(n){return function(s){return e(s,n)}}return fg=t,fg}var pg,uN;function Nz(){if(uN)return pg;uN=1;var e=VR(),t=Sz(),n=w0(),s=Kl();function a(i){return n(i)?e(s(i)):t(i)}return pg=a,pg}var mg,dN;function os(){if(dN)return mg;dN=1;var e=gz(),t=_z(),n=La(),s=It(),a=Nz();function i(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?s(l)?t(l[0],l[1]):e(l):a(l)}return mg=i,mg}var gg,hN;function YR(){if(hN)return gg;hN=1;var e=SR(),t=oz(),n=os(),s=It();function a(i,l){var d=s(i)?e:t;return d(i,n(l,3))}return gg=a,gg}var yg,fN;function Ez(){if(fN)return yg;fN=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,a){return s!=null&&t.call(s,a)}return yg=n,yg}var vg,pN;function KR(){if(pN)return vg;pN=1;var e=Ez(),t=HR();function n(s,a){return s!=null&&t(s,a,e)}return vg=n,vg}var wg,mN;function jz(){if(mN)return wg;mN=1;var e=d0(),t=oi(),n=Vl(),s=It(),a=as(),i=ai(),l=xd(),d=Yl(),f="[object Map]",p="[object Set]",h=Object.prototype,g=h.hasOwnProperty;function y(w){if(w==null)return!0;if(a(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||i(w)||d(w)||n(w)))return!w.length;var N=t(w);if(N==f||N==p)return!w.size;if(l(w))return!e(w).length;for(var k in w)if(g.call(w,k))return!1;return!0}return wg=y,wg}var xg,gN;function XR(){if(gN)return xg;gN=1;function e(t){return t===void 0}return xg=e,xg}var bg,yN;function QR(){if(yN)return bg;yN=1;var e=kd(),t=as();function n(s,a){var i=-1,l=t(s)?Array(s.length):[];return e(s,function(d,f,p){l[++i]=a(d,f,p)}),l}return bg=n,bg}var kg,vN;function ZR(){if(vN)return kg;vN=1;var e=_d(),t=os(),n=QR(),s=It();function a(i,l){var d=s(i)?e:n;return d(i,t(l,3))}return kg=a,kg}var _g,wN;function Cz(){if(wN)return _g;wN=1;function e(t,n,s,a){var i=-1,l=t==null?0:t.length;for(a&&l&&(s=t[++i]);++i<l;)s=n(s,t[i],i,t);return s}return _g=e,_g}var Sg,xN;function Tz(){if(xN)return Sg;xN=1;function e(t,n,s,a,i){return i(t,function(l,d,f){s=a?(a=!1,l):n(s,l,d,f)}),s}return Sg=e,Sg}var Ng,bN;function JR(){if(bN)return Ng;bN=1;var e=Cz(),t=kd(),n=os(),s=Tz(),a=It();function i(l,d,f){var p=a(l)?e:s,h=arguments.length<3;return p(l,n(d,4),f,h,t)}return Ng=i,Ng}var Eg,kN;function Rz(){if(kN)return Eg;kN=1;var e=$a(),t=It(),n=Tr(),s="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==s}return Eg=a,Eg}var jg,_N;function Az(){if(_N)return jg;_N=1;var e=VR(),t=e("length");return jg=t,jg}var Cg,SN;function Mz(){if(SN)return Cg;SN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",l="\\u200d",d=RegExp("["+l+e+a+i+"]");function f(p){return d.test(p)}return Cg=f,Cg}var Tg,NN;function Iz(){if(NN)return Tg;NN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",l="["+e+"]",d="["+a+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+d+"|"+f+")",h="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",k="["+i+"]?",E="(?:"+w+"(?:"+[h,g,y].join("|")+")"+k+N+")*",_=k+N+E,S="(?:"+[h+d+"?",d,g,y,l].join("|")+")",j=RegExp(f+"(?="+f+")|"+S+_,"g");function C(M){for(var $=j.lastIndex=0;j.test(M);)++$;return $}return Tg=C,Tg}var Rg,EN;function $z(){if(EN)return Rg;EN=1;var e=Az(),t=Mz(),n=Iz();function s(a){return t(a)?n(a):e(a)}return Rg=s,Rg}var Ag,jN;function Oz(){if(jN)return Ag;jN=1;var e=d0(),t=oi(),n=as(),s=Rz(),a=$z(),i="[object Map]",l="[object Set]";function d(f){if(f==null)return 0;if(n(f))return s(f)?a(f):f.length;var p=t(f);return p==i||p==l?f.size:e(f).length}return Ag=d,Ag}var Mg,CN;function Pz(){if(CN)return Mg;CN=1;var e=l0(),t=MR(),n=y0(),s=os(),a=bd(),i=It(),l=ai(),d=Hl(),f=Vn(),p=Yl();function h(g,y,w){var N=i(g),k=N||l(g)||p(g);if(y=s(y,4),w==null){var E=g&&g.constructor;k?w=N?new E:[]:f(g)?w=d(E)?t(a(g)):{}:w={}}return(k?e:n)(g,function(_,S,j){return y(w,_,S,j)}),w}return Mg=h,Mg}var Ig,TN;function Lz(){if(TN)return Ig;TN=1;var e=si(),t=Vl(),n=It(),s=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(s&&i&&i[s])}return Ig=a,Ig}var $g,RN;function x0(){if(RN)return $g;RN=1;var e=f0(),t=Lz();function n(s,a,i,l,d){var f=-1,p=s.length;for(i||(i=t),d||(d=[]);++f<p;){var h=s[f];a>0&&i(h)?a>1?n(h,a-1,i,l,d):e(d,h):l||(d[d.length]=h)}return d}return $g=n,$g}var Og,AN;function Dz(){if(AN)return Og;AN=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 Og=e,Og}var Pg,MN;function eA(){if(MN)return Pg;MN=1;var e=Dz(),t=Math.max;function n(s,a,i){return a=t(a===void 0?s.length-1:a,0),function(){for(var l=arguments,d=-1,f=t(l.length-a,0),p=Array(f);++d<f;)p[d]=l[a+d];d=-1;for(var h=Array(a+1);++d<a;)h[d]=l[d];return h[a]=i(p),e(s,this,h)}}return Pg=n,Pg}var Lg,IN;function qz(){if(IN)return Lg;IN=1;var e=m0(),t=wR(),n=La(),s=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return Lg=s,Lg}var Dg,$N;function Fz(){if($N)return Dg;$N=1;var e=800,t=16,n=Date.now;function s(a){var i=0,l=0;return function(){var d=n(),f=t-(d-l);if(l=d,f>0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return Dg=s,Dg}var qg,ON;function tA(){if(ON)return qg;ON=1;var e=qz(),t=Fz(),n=t(e);return qg=n,qg}var Fg,PN;function Ed(){if(PN)return Fg;PN=1;var e=La(),t=eA(),n=tA();function s(a,i){return n(t(a,i,e),a+"")}return Fg=s,Fg}var zg,LN;function nA(){if(LN)return zg;LN=1;function e(t,n,s,a){for(var i=t.length,l=s+(a?1:-1);a?l--:++l<i;)if(n(t[l],l,t))return l;return-1}return zg=e,zg}var Bg,DN;function zz(){if(DN)return Bg;DN=1;function e(t){return t!==t}return Bg=e,Bg}var Ug,qN;function Bz(){if(qN)return Ug;qN=1;function e(t,n,s){for(var a=s-1,i=t.length;++a<i;)if(t[a]===n)return a;return-1}return Ug=e,Ug}var Wg,FN;function Uz(){if(FN)return Wg;FN=1;var e=nA(),t=zz(),n=Bz();function s(a,i,l){return i===i?n(a,i,l):e(a,t,l)}return Wg=s,Wg}var Hg,zN;function Wz(){if(zN)return Hg;zN=1;var e=Uz();function t(n,s){var a=n==null?0:n.length;return!!a&&e(n,s,0)>-1}return Hg=t,Hg}var Gg,BN;function Hz(){if(BN)return Gg;BN=1;function e(t,n,s){for(var a=-1,i=t==null?0:t.length;++a<i;)if(s(n,t[a]))return!0;return!1}return Gg=e,Gg}var Vg,UN;function Gz(){if(UN)return Vg;UN=1;function e(){}return Vg=e,Vg}var Yg,WN;function Vz(){if(WN)return Yg;WN=1;var e=TR(),t=Gz(),n=v0(),s=1/0,a=e&&1/n(new e([,-0]))[1]==s?function(i){return new e(i)}:t;return Yg=a,Yg}var Kg,HN;function Yz(){if(HN)return Kg;HN=1;var e=DR(),t=Wz(),n=Hz(),s=qR(),a=Vz(),i=v0(),l=200;function d(f,p,h){var g=-1,y=t,w=f.length,N=!0,k=[],E=k;if(h)N=!1,y=n;else if(w>=l){var _=p?null:a(f);if(_)return i(_);N=!1,y=s,E=new e}else E=p?[]:k;e:for(;++g<w;){var S=f[g],j=p?p(S):S;if(S=h||S!==0?S:0,N&&j===j){for(var C=E.length;C--;)if(E[C]===j)continue e;p&&E.push(j),k.push(S)}else y(E,j,h)||(E!==k&&E.push(j),k.push(S))}return k}return Kg=d,Kg}var Xg,GN;function rA(){if(GN)return Xg;GN=1;var e=as(),t=Tr();function n(s){return t(s)&&e(s)}return Xg=n,Xg}var Qg,VN;function Kz(){if(VN)return Qg;VN=1;var e=x0(),t=Ed(),n=Yz(),s=rA(),a=t(function(i){return n(e(i,1,s,!0))});return Qg=a,Qg}var Zg,YN;function Xz(){if(YN)return Zg;YN=1;var e=_d();function t(n,s){return e(s,function(a){return n[a]})}return Zg=t,Zg}var Jg,KN;function sA(){if(KN)return Jg;KN=1;var e=Xz(),t=zs();function n(s){return s==null?[]:e(s,t(s))}return Jg=n,Jg}var ey,XN;function Yn(){if(XN)return ey;XN=1;var e;if(typeof a0=="function")try{e={clone:rz(),constant:m0(),each:LR(),filter:YR(),has:KR(),isArray:It(),isEmpty:jz(),isFunction:Hl(),isUndefined:XR(),keys:zs(),map:ZR(),reduce:JR(),size:Oz(),transform:Pz(),union:Kz(),values:sA()}}catch{}return e||(e=window._),ey=e,ey}var ty,QN;function b0(){if(QN)return ty;QN=1;var e=Yn();ty=a;var t="\0",n="\0",s="";function a(h){this._isDirected=e.has(h,"directed")?h.directed:!0,this._isMultigraph=e.has(h,"multigraph")?h.multigraph:!1,this._isCompound=e.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(h){return this._label=h,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(g){return e.isEmpty(h._in[g])})},a.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(g){return e.isEmpty(h._out[g])})},a.prototype.setNodes=function(h,g){var y=arguments,w=this;return e.each(h,function(N){y.length>1?w.setNode(N,g):w.setNode(N)}),this},a.prototype.setNode=function(h,g){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=g),this):(this._nodes[h]=arguments.length>1?g:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},a.prototype.node=function(h){return this._nodes[h]},a.prototype.hasNode=function(h){return e.has(this._nodes,h)},a.prototype.removeNode=function(h){var g=this;if(e.has(this._nodes,h)){var y=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(w){g.setParent(w)}),delete this._children[h]),e.each(e.keys(this._in[h]),y),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),y),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},a.prototype.setParent=function(h,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=n;else{g+="";for(var y=g;!e.isUndefined(y);y=this.parent(y))if(y===h)throw new Error("Setting "+g+" as parent of "+h+" would create a cycle");this.setNode(g)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=g,this._children[g][h]=!0,this},a.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},a.prototype.parent=function(h){if(this._isCompound){var g=this._parent[h];if(g!==n)return g}},a.prototype.children=function(h){if(e.isUndefined(h)&&(h=n),this._isCompound){var g=this._children[h];if(g)return e.keys(g)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},a.prototype.predecessors=function(h){var g=this._preds[h];if(g)return e.keys(g)},a.prototype.successors=function(h){var g=this._sucs[h];if(g)return e.keys(g)},a.prototype.neighbors=function(h){var g=this.predecessors(h);if(g)return e.union(g,this.successors(h))},a.prototype.isLeaf=function(h){var g;return this.isDirected()?g=this.successors(h):g=this.neighbors(h),g.length===0},a.prototype.filterNodes=function(h){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var y=this;e.each(this._nodes,function(k,E){h(E)&&g.setNode(E,k)}),e.each(this._edgeObjs,function(k){g.hasNode(k.v)&&g.hasNode(k.w)&&g.setEdge(k,y.edge(k))});var w={};function N(k){var E=y.parent(k);return E===void 0||g.hasNode(E)?(w[k]=E,E):E in w?w[E]:N(E)}return this._isCompound&&e.each(g.nodes(),function(k){g.setParent(k,N(k))}),g},a.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(h,g){var y=this,w=arguments;return e.reduce(h,function(N,k){return w.length>1?y.setEdge(N,k,g):y.setEdge(N,k),k}),this},a.prototype.setEdge=function(){var h,g,y,w,N=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(h=k.v,g=k.w,y=k.name,arguments.length===2&&(w=arguments[1],N=!0)):(h=k,g=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),h=""+h,g=""+g,e.isUndefined(y)||(y=""+y);var E=d(this._isDirected,h,g,y);if(e.has(this._edgeLabels,E))return N&&(this._edgeLabels[E]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(g),this._edgeLabels[E]=N?w:this._defaultEdgeLabelFn(h,g,y);var _=f(this._isDirected,h,g,y);return h=_.v,g=_.w,Object.freeze(_),this._edgeObjs[E]=_,i(this._preds[g],h),i(this._sucs[h],g),this._in[g][E]=_,this._out[h][E]=_,this._edgeCount++,this},a.prototype.edge=function(h,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,h,g,y);return this._edgeLabels[w]},a.prototype.hasEdge=function(h,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,h,g,y);return e.has(this._edgeLabels,w)},a.prototype.removeEdge=function(h,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,h,g,y),N=this._edgeObjs[w];return N&&(h=N.v,g=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],l(this._preds[g],h),l(this._sucs[h],g),delete this._in[g][w],delete this._out[h][w],this._edgeCount--),this},a.prototype.inEdges=function(h,g){var y=this._in[h];if(y){var w=e.values(y);return g?e.filter(w,function(N){return N.v===g}):w}},a.prototype.outEdges=function(h,g){var y=this._out[h];if(y){var w=e.values(y);return g?e.filter(w,function(N){return N.w===g}):w}},a.prototype.nodeEdges=function(h,g){var y=this.inEdges(h,g);if(y)return y.concat(this.outEdges(h,g))};function i(h,g){h[g]?h[g]++:h[g]=1}function l(h,g){--h[g]||delete h[g]}function d(h,g,y,w){var N=""+g,k=""+y;if(!h&&N>k){var E=N;N=k,k=E}return N+s+k+s+(e.isUndefined(w)?t:w)}function f(h,g,y,w){var N=""+g,k=""+y;if(!h&&N>k){var E=N;N=k,k=E}var _={v:N,w:k};return w&&(_.name=w),_}function p(h,g){return d(h,g.v,g.w,g.name)}return ty}var ny,ZN;function Qz(){return ZN||(ZN=1,ny="2.1.8"),ny}var ry,JN;function Zz(){return JN||(JN=1,ry={Graph:b0(),version:Qz()}),ry}var sy,eE;function Jz(){if(eE)return sy;eE=1;var e=Yn(),t=b0();sy={write:n,read:i};function n(l){var d={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:s(l),edges:a(l)};return e.isUndefined(l.graph())||(d.value=e.clone(l.graph())),d}function s(l){return e.map(l.nodes(),function(d){var f=l.node(d),p=l.parent(d),h={v:d};return e.isUndefined(f)||(h.value=f),e.isUndefined(p)||(h.parent=p),h})}function a(l){return e.map(l.edges(),function(d){var f=l.edge(d),p={v:d.v,w:d.w};return e.isUndefined(d.name)||(p.name=d.name),e.isUndefined(f)||(p.value=f),p})}function i(l){var d=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(f){d.setNode(f.v,f.value),f.parent&&d.setParent(f.v,f.parent)}),e.each(l.edges,function(f){d.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),d}return sy}var ay,tE;function eB(){if(tE)return ay;tE=1;var e=Yn();ay=t;function t(n){var s={},a=[],i;function l(d){e.has(s,d)||(s[d]=!0,i.push(d),e.each(n.successors(d),l),e.each(n.predecessors(d),l))}return e.each(n.nodes(),function(d){i=[],l(d),i.length&&a.push(i)}),a}return ay}var oy,nE;function aA(){if(nE)return oy;nE=1;var e=Yn();oy=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var s=this._keyIndices[n];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,s){var a=this._keyIndices;if(n=String(n),!e.has(a,n)){var i=this._arr,l=i.length;return a[n]=l,i.push({key:n,priority:s}),this._decrease(l),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,s){var a=this._keyIndices[n];if(s>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+s);this._arr[a].priority=s,this._decrease(a)},t.prototype._heapify=function(n){var s=this._arr,a=2*n,i=a+1,l=n;a<s.length&&(l=s[a].priority<s[l].priority?a:l,i<s.length&&(l=s[i].priority<s[l].priority?i:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var s=this._arr,a=s[n].priority,i;n!==0&&(i=n>>1,!(s[i].priority<a));)this._swap(n,i),n=i},t.prototype._swap=function(n,s){var a=this._arr,i=this._keyIndices,l=a[n],d=a[s];a[n]=d,a[s]=l,i[d.key]=n,i[l.key]=s},oy}var iy,rE;function oA(){if(rE)return iy;rE=1;var e=Yn(),t=aA();iy=s;var n=e.constant(1);function s(i,l,d,f){return a(i,String(l),d||n,f||function(p){return i.outEdges(p)})}function a(i,l,d,f){var p={},h=new t,g,y,w=function(N){var k=N.v!==g?N.v:N.w,E=p[k],_=d(N),S=y.distance+_;if(_<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+_);S<E.distance&&(E.distance=S,E.predecessor=g,h.decrease(k,S))};for(i.nodes().forEach(function(N){var k=N===l?0:Number.POSITIVE_INFINITY;p[N]={distance:k},h.add(N,k)});h.size()>0&&(g=h.removeMin(),y=p[g],y.distance!==Number.POSITIVE_INFINITY);)f(g).forEach(w);return p}return iy}var ly,sE;function tB(){if(sE)return ly;sE=1;var e=oA(),t=Yn();ly=n;function n(s,a,i){return t.transform(s.nodes(),function(l,d){l[d]=e(s,d,a,i)},{})}return ly}var cy,aE;function iA(){if(aE)return cy;aE=1;var e=Yn();cy=t;function t(n){var s=0,a=[],i={},l=[];function d(f){var p=i[f]={onStack:!0,lowlink:s,index:s++};if(a.push(f),n.successors(f).forEach(function(y){e.has(i,y)?i[y].onStack&&(p.lowlink=Math.min(p.lowlink,i[y].index)):(d(y),p.lowlink=Math.min(p.lowlink,i[y].lowlink))}),p.lowlink===p.index){var h=[],g;do g=a.pop(),i[g].onStack=!1,h.push(g);while(f!==g);l.push(h)}}return n.nodes().forEach(function(f){e.has(i,f)||d(f)}),l}return cy}var uy,oE;function nB(){if(oE)return uy;oE=1;var e=Yn(),t=iA();uy=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 uy}var dy,iE;function rB(){if(iE)return dy;iE=1;var e=Yn();dy=n;var t=e.constant(1);function n(a,i,l){return s(a,i||t,l||function(d){return a.outEdges(d)})}function s(a,i,l){var d={},f=a.nodes();return f.forEach(function(p){d[p]={},d[p][p]={distance:0},f.forEach(function(h){p!==h&&(d[p][h]={distance:Number.POSITIVE_INFINITY})}),l(p).forEach(function(h){var g=h.v===p?h.w:h.v,y=i(h);d[p][g]={distance:y,predecessor:p}})}),f.forEach(function(p){var h=d[p];f.forEach(function(g){var y=d[g];f.forEach(function(w){var N=y[p],k=h[w],E=y[w],_=N.distance+k.distance;_<E.distance&&(E.distance=_,E.predecessor=k.predecessor)})})}),d}return dy}var hy,lE;function lA(){if(lE)return hy;lE=1;var e=Yn();hy=t,t.CycleException=n;function t(s){var a={},i={},l=[];function d(f){if(e.has(i,f))throw new n;e.has(a,f)||(i[f]=!0,a[f]=!0,e.each(s.predecessors(f),d),delete i[f],l.push(f))}if(e.each(s.sinks(),d),e.size(a)!==s.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,hy}var fy,cE;function sB(){if(cE)return fy;cE=1;var e=lA();fy=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return fy}var py,uE;function cA(){if(uE)return py;uE=1;var e=Yn();py=t;function t(s,a,i){e.isArray(a)||(a=[a]);var l=(s.isDirected()?s.successors:s.neighbors).bind(s),d=[],f={};return e.each(a,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,i==="post",f,l,d)}),d}function n(s,a,i,l,d,f){e.has(l,a)||(l[a]=!0,i||f.push(a),e.each(d(a),function(p){n(s,p,i,l,d,f)}),i&&f.push(a))}return py}var my,dE;function aB(){if(dE)return my;dE=1;var e=cA();my=t;function t(n,s){return e(n,s,"post")}return my}var gy,hE;function oB(){if(hE)return gy;hE=1;var e=cA();gy=t;function t(n,s){return e(n,s,"pre")}return gy}var yy,fE;function iB(){if(fE)return yy;fE=1;var e=Yn(),t=b0(),n=aA();yy=s;function s(a,i){var l=new t,d={},f=new n,p;function h(y){var w=y.v===p?y.w:y.v,N=f.priority(w);if(N!==void 0){var k=i(y);k<N&&(d[w]=p,f.decrease(w,k))}}if(a.nodeCount()===0)return l;e.each(a.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),l.setNode(y)}),f.decrease(a.nodes()[0],0);for(var g=!1;f.size()>0;){if(p=f.removeMin(),e.has(d,p))l.setEdge(p,d[p]);else{if(g)throw new Error("Input graph is not connected: "+a);g=!0}a.nodeEdges(p).forEach(h)}return l}return yy}var vy,pE;function lB(){return pE||(pE=1,vy={components:eB(),dijkstra:oA(),dijkstraAll:tB(),findCycles:nB(),floydWarshall:rB(),isAcyclic:sB(),postorder:aB(),preorder:oB(),prim:iB(),tarjan:iA(),topsort:lA()}),vy}var wy,mE;function cB(){if(mE)return wy;mE=1;var e=Zz();return wy={Graph:e.Graph,json:Jz(),alg:lB(),version:e.version},wy}var xy,gE;function hr(){if(gE)return xy;gE=1;var e;if(typeof a0=="function")try{e=cB()}catch{}return e||(e=window.graphlib),xy=e,xy}var by,yE;function uB(){if(yE)return by;yE=1;var e=$R(),t=1,n=4;function s(a){return e(a,t|n)}return by=s,by}var ky,vE;function jd(){if(vE)return ky;vE=1;var e=ri(),t=as(),n=vd(),s=Vn();function a(i,l,d){if(!s(d))return!1;var f=typeof l;return(f=="number"?t(d)&&n(l,d.length):f=="string"&&l in d)?e(d[l],i):!1}return ky=a,ky}var _y,wE;function dB(){if(wE)return _y;wE=1;var e=Ed(),t=ri(),n=jd(),s=Pa(),a=Object.prototype,i=a.hasOwnProperty,l=e(function(d,f){d=Object(d);var p=-1,h=f.length,g=h>2?f[2]:void 0;for(g&&n(f[0],f[1],g)&&(h=1);++p<h;)for(var y=f[p],w=s(y),N=-1,k=w.length;++N<k;){var E=w[N],_=d[E];(_===void 0||t(_,a[E])&&!i.call(d,E))&&(d[E]=y[E])}return d});return _y=l,_y}var Sy,xE;function hB(){if(xE)return Sy;xE=1;var e=os(),t=as(),n=zs();function s(a){return function(i,l,d){var f=Object(i);if(!t(i)){var p=e(l,3);i=n(i),l=function(g){return p(f[g],g,f)}}var h=a(i,l,d);return h>-1?f[p?i[h]:h]:void 0}}return Sy=s,Sy}var Ny,bE;function fB(){if(bE)return Ny;bE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return Ny=t,Ny}var Ey,kE;function pB(){if(kE)return Ey;kE=1;var e=fB(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return Ey=n,Ey}var jy,_E;function mB(){if(_E)return jy;_E=1;var e=pB(),t=Vn(),n=ii(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,l=/^0o[0-7]+$/i,d=parseInt;function f(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var h=typeof p.valueOf=="function"?p.valueOf():p;p=t(h)?h+"":h}if(typeof p!="string")return p===0?p:+p;p=e(p);var g=i.test(p);return g||l.test(p)?d(p.slice(2),g?2:8):a.test(p)?s:+p}return jy=f,jy}var Cy,SE;function uA(){if(SE)return Cy;SE=1;var e=mB(),t=1/0,n=17976931348623157e292;function s(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var i=a<0?-1:1;return i*n}return a===a?a:0}return Cy=s,Cy}var Ty,NE;function gB(){if(NE)return Ty;NE=1;var e=uA();function t(n){var s=e(n),a=s%1;return s===s?a?s-a:s:0}return Ty=t,Ty}var Ry,EE;function yB(){if(EE)return Ry;EE=1;var e=nA(),t=os(),n=gB(),s=Math.max;function a(i,l,d){var f=i==null?0:i.length;if(!f)return-1;var p=d==null?0:n(d);return p<0&&(p=s(f+p,0)),e(i,t(l,3),p)}return Ry=a,Ry}var Ay,jE;function vB(){if(jE)return Ay;jE=1;var e=hB(),t=yB(),n=e(t);return Ay=n,Ay}var My,CE;function dA(){if(CE)return My;CE=1;var e=x0();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return My=t,My}var Iy,TE;function wB(){if(TE)return Iy;TE=1;var e=g0(),t=OR(),n=Pa();function s(a,i){return a==null?a:e(a,t(i),n)}return Iy=s,Iy}var $y,RE;function xB(){if(RE)return $y;RE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return $y=e,$y}var Oy,AE;function bB(){if(AE)return Oy;AE=1;var e=gd(),t=y0(),n=os();function s(a,i){var l={};return i=n(i,3),t(a,function(d,f,p){e(l,f,i(d,f,p))}),l}return Oy=s,Oy}var Py,ME;function k0(){if(ME)return Py;ME=1;var e=ii();function t(n,s,a){for(var i=-1,l=n.length;++i<l;){var d=n[i],f=s(d);if(f!=null&&(p===void 0?f===f&&!e(f):a(f,p)))var p=f,h=d}return h}return Py=t,Py}var Ly,IE;function kB(){if(IE)return Ly;IE=1;function e(t,n){return t>n}return Ly=e,Ly}var Dy,$E;function _B(){if($E)return Dy;$E=1;var e=k0(),t=kB(),n=La();function s(a){return a&&a.length?e(a,n,t):void 0}return Dy=s,Dy}var qy,OE;function hA(){if(OE)return qy;OE=1;var e=gd(),t=ri();function n(s,a,i){(i!==void 0&&!t(s[a],i)||i===void 0&&!(a in s))&&e(s,a,i)}return qy=n,qy}var Fy,PE;function SB(){if(PE)return Fy;PE=1;var e=$a(),t=bd(),n=Tr(),s="[object Object]",a=Function.prototype,i=Object.prototype,l=a.toString,d=i.hasOwnProperty,f=l.call(Object);function p(h){if(!n(h)||e(h)!=s)return!1;var g=t(h);if(g===null)return!0;var y=d.call(g,"constructor")&&g.constructor;return typeof y=="function"&&y instanceof y&&l.call(y)==f}return Fy=p,Fy}var zy,LE;function fA(){if(LE)return zy;LE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return zy=e,zy}var By,DE;function NB(){if(DE)return By;DE=1;var e=Gl(),t=Pa();function n(s){return e(s,t(s))}return By=n,By}var Uy,qE;function EB(){if(qE)return Uy;qE=1;var e=hA(),t=kR(),n=AR(),s=_R(),a=IR(),i=Vl(),l=It(),d=rA(),f=ai(),p=Hl(),h=Vn(),g=SB(),y=Yl(),w=fA(),N=NB();function k(E,_,S,j,C,M,$){var I=w(E,S),z=w(_,S),O=$.get(z);if(O){e(E,S,O);return}var A=M?M(I,z,S+"",E,_,$):void 0,D=A===void 0;if(D){var H=l(z),X=!H&&f(z),R=!H&&!X&&y(z);A=z,H||X||R?l(I)?A=I:d(I)?A=s(I):X?(D=!1,A=t(z,!0)):R?(D=!1,A=n(z,!0)):A=[]:g(z)||i(z)?(A=I,i(I)?A=N(I):(!h(I)||p(I))&&(A=a(z))):D=!1}D&&($.set(z,A),C(A,z,j,M,$),$.delete(z)),e(E,S,A)}return Uy=k,Uy}var Wy,FE;function jB(){if(FE)return Wy;FE=1;var e=md(),t=hA(),n=g0(),s=EB(),a=Vn(),i=Pa(),l=fA();function d(f,p,h,g,y){f!==p&&n(p,function(w,N){if(y||(y=new e),a(w))s(f,p,N,h,d,g,y);else{var k=g?g(l(f,N),w,N+"",f,p,y):void 0;k===void 0&&(k=w),t(f,N,k)}},i)}return Wy=d,Wy}var Hy,zE;function CB(){if(zE)return Hy;zE=1;var e=Ed(),t=jd();function n(s){return e(function(a,i){var l=-1,d=i.length,f=d>1?i[d-1]:void 0,p=d>2?i[2]:void 0;for(f=s.length>3&&typeof f=="function"?(d--,f):void 0,p&&t(i[0],i[1],p)&&(f=d<3?void 0:f,d=1),a=Object(a);++l<d;){var h=i[l];h&&s(a,h,l,f)}return a})}return Hy=n,Hy}var Gy,BE;function TB(){if(BE)return Gy;BE=1;var e=jB(),t=CB(),n=t(function(s,a,i){e(s,a,i)});return Gy=n,Gy}var Vy,UE;function pA(){if(UE)return Vy;UE=1;function e(t,n){return t<n}return Vy=e,Vy}var Yy,WE;function RB(){if(WE)return Yy;WE=1;var e=k0(),t=pA(),n=La();function s(a){return a&&a.length?e(a,n,t):void 0}return Yy=s,Yy}var Ky,HE;function AB(){if(HE)return Ky;HE=1;var e=k0(),t=os(),n=pA();function s(a,i){return a&&a.length?e(a,t(i,2),n):void 0}return Ky=s,Ky}var Xy,GE;function MB(){if(GE)return Xy;GE=1;var e=pr(),t=function(){return e.Date.now()};return Xy=t,Xy}var Qy,VE;function IB(){if(VE)return Qy;VE=1;var e=yd(),t=Sd(),n=vd(),s=Vn(),a=Kl();function i(l,d,f,p){if(!s(l))return l;d=t(d,l);for(var h=-1,g=d.length,y=g-1,w=l;w!=null&&++h<g;){var N=a(d[h]),k=f;if(N==="__proto__"||N==="constructor"||N==="prototype")return l;if(h!=y){var E=w[N];k=p?p(E,N,w):void 0,k===void 0&&(k=s(E)?E:n(d[h+1])?[]:{})}e(w,N,k),w=w[N]}return l}return Qy=i,Qy}var Zy,YE;function $B(){if(YE)return Zy;YE=1;var e=Nd(),t=IB(),n=Sd();function s(a,i,l){for(var d=-1,f=i.length,p={};++d<f;){var h=i[d],g=e(a,h);l(g,h)&&t(p,n(h,a),g)}return p}return Zy=s,Zy}var Jy,KE;function OB(){if(KE)return Jy;KE=1;var e=$B(),t=GR();function n(s,a){return e(s,a,function(i,l){return t(s,l)})}return Jy=n,Jy}var ev,XE;function PB(){if(XE)return ev;XE=1;var e=dA(),t=eA(),n=tA();function s(a){return n(t(a,void 0,e),a+"")}return ev=s,ev}var tv,QE;function LB(){if(QE)return tv;QE=1;var e=OB(),t=PB(),n=t(function(s,a){return s==null?{}:e(s,a)});return tv=n,tv}var nv,ZE;function DB(){if(ZE)return nv;ZE=1;var e=Math.ceil,t=Math.max;function n(s,a,i,l){for(var d=-1,f=t(e((a-s)/(i||1)),0),p=Array(f);f--;)p[l?f:++d]=s,s+=i;return p}return nv=n,nv}var rv,JE;function qB(){if(JE)return rv;JE=1;var e=DB(),t=jd(),n=uA();function s(a){return function(i,l,d){return d&&typeof d!="number"&&t(i,l,d)&&(l=d=void 0),i=n(i),l===void 0?(l=i,i=0):l=n(l),d=d===void 0?i<l?1:-1:n(d),e(i,l,d,a)}}return rv=s,rv}var sv,ej;function FB(){if(ej)return sv;ej=1;var e=qB(),t=e();return sv=t,sv}var av,tj;function zB(){if(tj)return av;tj=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return av=e,av}var ov,nj;function BB(){if(nj)return ov;nj=1;var e=ii();function t(n,s){if(n!==s){var a=n!==void 0,i=n===null,l=n===n,d=e(n),f=s!==void 0,p=s===null,h=s===s,g=e(s);if(!p&&!g&&!d&&n>s||d&&f&&h&&!p&&!g||i&&f&&h||!a&&h||!l)return 1;if(!i&&!d&&!g&&n<s||g&&a&&l&&!i&&!d||p&&a&&l||!f&&l||!h)return-1}return 0}return ov=t,ov}var iv,rj;function UB(){if(rj)return iv;rj=1;var e=BB();function t(n,s,a){for(var i=-1,l=n.criteria,d=s.criteria,f=l.length,p=a.length;++i<f;){var h=e(l[i],d[i]);if(h){if(i>=p)return h;var g=a[i];return h*(g=="desc"?-1:1)}}return n.index-s.index}return iv=t,iv}var lv,sj;function WB(){if(sj)return lv;sj=1;var e=_d(),t=Nd(),n=os(),s=QR(),a=zB(),i=wd(),l=UB(),d=La(),f=It();function p(h,g,y){g.length?g=e(g,function(k){return f(k)?function(E){return t(E,k.length===1?k[0]:k)}:k}):g=[d];var w=-1;g=e(g,i(n));var N=s(h,function(k,E,_){var S=e(g,function(j){return j(k)});return{criteria:S,index:++w,value:k}});return a(N,function(k,E){return l(k,E,y)})}return lv=p,lv}var cv,aj;function HB(){if(aj)return cv;aj=1;var e=x0(),t=WB(),n=Ed(),s=jd(),a=n(function(i,l){if(i==null)return[];var d=l.length;return d>1&&s(i,l[0],l[1])?l=[]:d>2&&s(l[0],l[1],l[2])&&(l=[l[0]]),t(i,e(l,1),[])});return cv=a,cv}var uv,oj;function GB(){if(oj)return uv;oj=1;var e=WR(),t=0;function n(s){var a=++t;return e(s)+a}return uv=n,uv}var dv,ij;function VB(){if(ij)return dv;ij=1;function e(t,n,s){for(var a=-1,i=t.length,l=n.length,d={};++a<i;){var f=a<l?n[a]:void 0;s(d,t[a],f)}return d}return dv=e,dv}var hv,lj;function YB(){if(lj)return hv;lj=1;var e=yd(),t=VB();function n(s,a){return t(s||[],a||[],e)}return hv=n,hv}var fv,cj;function yt(){if(cj)return fv;cj=1;var e;if(typeof a0=="function")try{e={cloneDeep:uB(),constant:m0(),defaults:dB(),each:LR(),filter:YR(),find:vB(),flatten:dA(),forEach:PR(),forIn:wB(),has:KR(),isUndefined:XR(),last:xB(),map:ZR(),mapValues:bB(),max:_B(),merge:TB(),min:RB(),minBy:AB(),now:MB(),pick:LB(),range:FB(),reduce:JR(),sortBy:HB(),uniqueId:GB(),values:sA(),zipObject:YB()}}catch{}return e||(e=window._),fv=e,fv}var pv,uj;function KB(){if(uj)return pv;uj=1,pv=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,a=s._prev;if(a!==s)return t(a),a},e.prototype.enqueue=function(s){var a=this._sentinel;s._prev&&s._next&&t(s),s._next=a._next,a._next._prev=s,a._next=s,s._prev=a},e.prototype.toString=function(){for(var s=[],a=this._sentinel,i=a._prev;i!==a;)s.push(JSON.stringify(i,n)),i=i._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function n(s,a){if(s!=="_next"&&s!=="_prev")return a}return pv}var mv,dj;function XB(){if(dj)return mv;dj=1;var e=yt(),t=hr().Graph,n=KB();mv=a;var s=e.constant(1);function a(p,h){if(p.nodeCount()<=1)return[];var g=d(p,h||s),y=i(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function i(p,h,g){for(var y=[],w=h[h.length-1],N=h[0],k;p.nodeCount();){for(;k=N.dequeue();)l(p,h,g,k);for(;k=w.dequeue();)l(p,h,g,k);if(p.nodeCount()){for(var E=h.length-2;E>0;--E)if(k=h[E].dequeue(),k){y=y.concat(l(p,h,g,k,!0));break}}}return y}function l(p,h,g,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(k){var E=p.edge(k),_=p.node(k.v);w&&N.push({v:k.v,w:k.w}),_.out-=E,f(h,g,_)}),e.forEach(p.outEdges(y.v),function(k){var E=p.edge(k),_=k.w,S=p.node(_);S.in-=E,f(h,g,S)}),p.removeNode(y.v),N}function d(p,h){var g=new t,y=0,w=0;e.forEach(p.nodes(),function(E){g.setNode(E,{v:E,in:0,out:0})}),e.forEach(p.edges(),function(E){var _=g.edge(E.v,E.w)||0,S=h(E),j=_+S;g.setEdge(E.v,E.w,j),w=Math.max(w,g.node(E.v).out+=S),y=Math.max(y,g.node(E.w).in+=S)});var N=e.range(w+y+3).map(function(){return new n}),k=y+1;return e.forEach(g.nodes(),function(E){f(N,k,g.node(E))}),{graph:g,buckets:N,zeroIdx:k}}function f(p,h,g){g.out?g.in?p[g.out-g.in+h].enqueue(g):p[p.length-1].enqueue(g):p[0].enqueue(g)}return mv}var gv,hj;function QB(){if(hj)return gv;hj=1;var e=yt(),t=XB();gv={run:n,undo:a};function n(i){var l=i.graph().acyclicer==="greedy"?t(i,d(i)):s(i);e.forEach(l,function(f){var p=i.edge(f);i.removeEdge(f),p.forwardName=f.name,p.reversed=!0,i.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function d(f){return function(p){return f.edge(p).weight}}}function s(i){var l=[],d={},f={};function p(h){e.has(f,h)||(f[h]=!0,d[h]=!0,e.forEach(i.outEdges(h),function(g){e.has(d,g.w)?l.push(g):p(g.w)}),delete d[h])}return e.forEach(i.nodes(),p),l}function a(i){e.forEach(i.edges(),function(l){var d=i.edge(l);if(d.reversed){i.removeEdge(l);var f=d.forwardName;delete d.reversed,delete d.forwardName,i.setEdge(l.w,l.v,d,f)}})}return gv}var yv,fj;function vn(){if(fj)return yv;fj=1;var e=yt(),t=hr().Graph;yv={addDummyNode:n,simplify:s,asNonCompoundGraph:a,successorWeights:i,predecessorWeights:l,intersectRect:d,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:g,maxRank:y,partition:w,time:N,notime:k};function n(E,_,S,j){var C;do C=e.uniqueId(j);while(E.hasNode(C));return S.dummy=_,E.setNode(C,S),C}function s(E){var _=new t().setGraph(E.graph());return e.forEach(E.nodes(),function(S){_.setNode(S,E.node(S))}),e.forEach(E.edges(),function(S){var j=_.edge(S.v,S.w)||{weight:0,minlen:1},C=E.edge(S);_.setEdge(S.v,S.w,{weight:j.weight+C.weight,minlen:Math.max(j.minlen,C.minlen)})}),_}function a(E){var _=new t({multigraph:E.isMultigraph()}).setGraph(E.graph());return e.forEach(E.nodes(),function(S){E.children(S).length||_.setNode(S,E.node(S))}),e.forEach(E.edges(),function(S){_.setEdge(S,E.edge(S))}),_}function i(E){var _=e.map(E.nodes(),function(S){var j={};return e.forEach(E.outEdges(S),function(C){j[C.w]=(j[C.w]||0)+E.edge(C).weight}),j});return e.zipObject(E.nodes(),_)}function l(E){var _=e.map(E.nodes(),function(S){var j={};return e.forEach(E.inEdges(S),function(C){j[C.v]=(j[C.v]||0)+E.edge(C).weight}),j});return e.zipObject(E.nodes(),_)}function d(E,_){var S=E.x,j=E.y,C=_.x-S,M=_.y-j,$=E.width/2,I=E.height/2;if(!C&&!M)throw new Error("Not possible to find intersection inside of the rectangle");var z,O;return Math.abs(M)*$>Math.abs(C)*I?(M<0&&(I=-I),z=I*C/M,O=I):(C<0&&($=-$),z=$,O=$*M/C),{x:S+z,y:j+O}}function f(E){var _=e.map(e.range(y(E)+1),function(){return[]});return e.forEach(E.nodes(),function(S){var j=E.node(S),C=j.rank;e.isUndefined(C)||(_[C][j.order]=S)}),_}function p(E){var _=e.min(e.map(E.nodes(),function(S){return E.node(S).rank}));e.forEach(E.nodes(),function(S){var j=E.node(S);e.has(j,"rank")&&(j.rank-=_)})}function h(E){var _=e.min(e.map(E.nodes(),function(M){return E.node(M).rank})),S=[];e.forEach(E.nodes(),function(M){var $=E.node(M).rank-_;S[$]||(S[$]=[]),S[$].push(M)});var j=0,C=E.graph().nodeRankFactor;e.forEach(S,function(M,$){e.isUndefined(M)&&$%C!==0?--j:j&&e.forEach(M,function(I){E.node(I).rank+=j})})}function g(E,_,S,j){var C={width:0,height:0};return arguments.length>=4&&(C.rank=S,C.order=j),n(E,"border",C,_)}function y(E){return e.max(e.map(E.nodes(),function(_){var S=E.node(_).rank;if(!e.isUndefined(S))return S}))}function w(E,_){var S={lhs:[],rhs:[]};return e.forEach(E,function(j){_(j)?S.lhs.push(j):S.rhs.push(j)}),S}function N(E,_){var S=e.now();try{return _()}finally{console.log(E+" time: "+(e.now()-S)+"ms")}}function k(E,_){return _()}return yv}var vv,pj;function ZB(){if(pj)return vv;pj=1;var e=yt(),t=vn();vv={run:n,undo:a};function n(i){i.graph().dummyChains=[],e.forEach(i.edges(),function(l){s(i,l)})}function s(i,l){var d=l.v,f=i.node(d).rank,p=l.w,h=i.node(p).rank,g=l.name,y=i.edge(l),w=y.labelRank;if(h!==f+1){i.removeEdge(l);var N,k,E;for(E=0,++f;f<h;++E,++f)y.points=[],k={width:0,height:0,edgeLabel:y,edgeObj:l,rank:f},N=t.addDummyNode(i,"edge",k,"_d"),f===w&&(k.width=y.width,k.height=y.height,k.dummy="edge-label",k.labelpos=y.labelpos),i.setEdge(d,N,{weight:y.weight},g),E===0&&i.graph().dummyChains.push(N),d=N;i.setEdge(d,p,{weight:y.weight},g)}}function a(i){e.forEach(i.graph().dummyChains,function(l){var d=i.node(l),f=d.edgeLabel,p;for(i.setEdge(d.edgeObj,f);d.dummy;)p=i.successors(l)[0],i.removeNode(l),f.points.push({x:d.x,y:d.y}),d.dummy==="edge-label"&&(f.x=d.x,f.y=d.y,f.width=d.width,f.height=d.height),l=p,d=i.node(l)})}return vv}var wv,mj;function Xu(){if(mj)return wv;mj=1;var e=yt();wv={longestPath:t,slack:n};function t(s){var a={};function i(l){var d=s.node(l);if(e.has(a,l))return d.rank;a[l]=!0;var f=e.min(e.map(s.outEdges(l),function(p){return i(p.w)-s.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),d.rank=f}e.forEach(s.sources(),i)}function n(s,a){return s.node(a.w).rank-s.node(a.v).rank-s.edge(a).minlen}return wv}var xv,gj;function mA(){if(gj)return xv;gj=1;var e=yt(),t=hr().Graph,n=Xu().slack;xv=s;function s(d){var f=new t({directed:!1}),p=d.nodes()[0],h=d.nodeCount();f.setNode(p,{});for(var g,y;a(f,d)<h;)g=i(f,d),y=f.hasNode(g.v)?n(d,g):-n(d,g),l(f,d,y);return f}function a(d,f){function p(h){e.forEach(f.nodeEdges(h),function(g){var y=g.v,w=h===y?g.w:y;!d.hasNode(w)&&!n(f,g)&&(d.setNode(w,{}),d.setEdge(h,w,{}),p(w))})}return e.forEach(d.nodes(),p),d.nodeCount()}function i(d,f){return e.minBy(f.edges(),function(p){if(d.hasNode(p.v)!==d.hasNode(p.w))return n(f,p)})}function l(d,f,p){e.forEach(d.nodes(),function(h){f.node(h).rank+=p})}return xv}var bv,yj;function JB(){if(yj)return bv;yj=1;var e=yt(),t=mA(),n=Xu().slack,s=Xu().longestPath,a=hr().alg.preorder,i=hr().alg.postorder,l=vn().simplify;bv=d,d.initLowLimValues=g,d.initCutValues=f,d.calcCutValue=h,d.leaveEdge=w,d.enterEdge=N,d.exchangeEdges=k;function d(j){j=l(j),s(j);var C=t(j);g(C),f(C,j);for(var M,$;M=w(C);)$=N(C,j,M),k(C,j,M,$)}function f(j,C){var M=i(j,j.nodes());M=M.slice(0,M.length-1),e.forEach(M,function($){p(j,C,$)})}function p(j,C,M){var $=j.node(M),I=$.parent;j.edge(M,I).cutvalue=h(j,C,M)}function h(j,C,M){var $=j.node(M),I=$.parent,z=!0,O=C.edge(M,I),A=0;return O||(z=!1,O=C.edge(I,M)),A=O.weight,e.forEach(C.nodeEdges(M),function(D){var H=D.v===M,X=H?D.w:D.v;if(X!==I){var R=H===z,Z=C.edge(D).weight;if(A+=R?Z:-Z,_(j,M,X)){var B=j.edge(M,X).cutvalue;A+=R?-B:B}}}),A}function g(j,C){arguments.length<2&&(C=j.nodes()[0]),y(j,{},1,C)}function y(j,C,M,$,I){var z=M,O=j.node($);return C[$]=!0,e.forEach(j.neighbors($),function(A){e.has(C,A)||(M=y(j,C,M,A,$))}),O.low=z,O.lim=M++,I?O.parent=I:delete O.parent,M}function w(j){return e.find(j.edges(),function(C){return j.edge(C).cutvalue<0})}function N(j,C,M){var $=M.v,I=M.w;C.hasEdge($,I)||($=M.w,I=M.v);var z=j.node($),O=j.node(I),A=z,D=!1;z.lim>O.lim&&(A=O,D=!0);var H=e.filter(C.edges(),function(X){return D===S(j,j.node(X.v),A)&&D!==S(j,j.node(X.w),A)});return e.minBy(H,function(X){return n(C,X)})}function k(j,C,M,$){var I=M.v,z=M.w;j.removeEdge(I,z),j.setEdge($.v,$.w,{}),g(j),f(j,C),E(j,C)}function E(j,C){var M=e.find(j.nodes(),function(I){return!C.node(I).parent}),$=a(j,M);$=$.slice(1),e.forEach($,function(I){var z=j.node(I).parent,O=C.edge(I,z),A=!1;O||(O=C.edge(z,I),A=!0),C.node(I).rank=C.node(z).rank+(A?O.minlen:-O.minlen)})}function _(j,C,M){return j.hasEdge(C,M)}function S(j,C,M){return M.low<=C.lim&&C.lim<=M.lim}return bv}var kv,vj;function e8(){if(vj)return kv;vj=1;var e=Xu(),t=e.longestPath,n=mA(),s=JB();kv=a;function a(f){switch(f.graph().ranker){case"network-simplex":d(f);break;case"tight-tree":l(f);break;case"longest-path":i(f);break;default:d(f)}}var i=t;function l(f){t(f),n(f)}function d(f){s(f)}return kv}var _v,wj;function t8(){if(wj)return _v;wj=1;var e=yt();_v=t;function t(a){var i=s(a);e.forEach(a.graph().dummyChains,function(l){for(var d=a.node(l),f=d.edgeObj,p=n(a,i,f.v,f.w),h=p.path,g=p.lca,y=0,w=h[y],N=!0;l!==f.w;){if(d=a.node(l),N){for(;(w=h[y])!==g&&a.node(w).maxRank<d.rank;)y++;w===g&&(N=!1)}if(!N){for(;y<h.length-1&&a.node(w=h[y+1]).minRank<=d.rank;)y++;w=h[y]}a.setParent(l,w),l=a.successors(l)[0]}})}function n(a,i,l,d){var f=[],p=[],h=Math.min(i[l].low,i[d].low),g=Math.max(i[l].lim,i[d].lim),y,w;y=l;do y=a.parent(y),f.push(y);while(y&&(i[y].low>h||g>i[y].lim));for(w=y,y=d;(y=a.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function s(a){var i={},l=0;function d(f){var p=l;e.forEach(a.children(f),d),i[f]={low:p,lim:l++}}return e.forEach(a.children(),d),i}return _v}var Sv,xj;function n8(){if(xj)return Sv;xj=1;var e=yt(),t=vn();Sv={run:n,cleanup:l};function n(d){var f=t.addDummyNode(d,"root",{},"_root"),p=a(d),h=e.max(e.values(p))-1,g=2*h+1;d.graph().nestingRoot=f,e.forEach(d.edges(),function(w){d.edge(w).minlen*=g});var y=i(d)+1;e.forEach(d.children(),function(w){s(d,f,g,y,h,p,w)}),d.graph().nodeRankFactor=g}function s(d,f,p,h,g,y,w){var N=d.children(w);if(!N.length){w!==f&&d.setEdge(f,w,{weight:0,minlen:p});return}var k=t.addBorderNode(d,"_bt"),E=t.addBorderNode(d,"_bb"),_=d.node(w);d.setParent(k,w),_.borderTop=k,d.setParent(E,w),_.borderBottom=E,e.forEach(N,function(S){s(d,f,p,h,g,y,S);var j=d.node(S),C=j.borderTop?j.borderTop:S,M=j.borderBottom?j.borderBottom:S,$=j.borderTop?h:2*h,I=C!==M?1:g-y[w]+1;d.setEdge(k,C,{weight:$,minlen:I,nestingEdge:!0}),d.setEdge(M,E,{weight:$,minlen:I,nestingEdge:!0})}),d.parent(w)||d.setEdge(f,k,{weight:0,minlen:g+y[w]})}function a(d){var f={};function p(h,g){var y=d.children(h);y&&y.length&&e.forEach(y,function(w){p(w,g+1)}),f[h]=g}return e.forEach(d.children(),function(h){p(h,1)}),f}function i(d){return e.reduce(d.edges(),function(f,p){return f+d.edge(p).weight},0)}function l(d){var f=d.graph();d.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(d.edges(),function(p){var h=d.edge(p);h.nestingEdge&&d.removeEdge(p)})}return Sv}var Nv,bj;function r8(){if(bj)return Nv;bj=1;var e=yt(),t=vn();Nv=n;function n(a){function i(l){var d=a.children(l),f=a.node(l);if(d.length&&e.forEach(d,i),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,h=f.maxRank+1;p<h;++p)s(a,"borderLeft","_bl",l,f,p),s(a,"borderRight","_br",l,f,p)}}e.forEach(a.children(),i)}function s(a,i,l,d,f,p){var h={width:0,height:0,rank:p,borderType:i},g=f[i][p-1],y=t.addDummyNode(a,"border",h,l);f[i][p]=y,a.setParent(y,d),g&&a.setEdge(g,y,{weight:1})}return Nv}var Ev,kj;function s8(){if(kj)return Ev;kj=1;var e=yt();Ev={adjust:t,undo:n};function t(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&s(p)}function n(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&i(p),(h==="lr"||h==="rl")&&(d(p),s(p))}function s(p){e.forEach(p.nodes(),function(h){a(p.node(h))}),e.forEach(p.edges(),function(h){a(p.edge(h))})}function a(p){var h=p.width;p.width=p.height,p.height=h}function i(p){e.forEach(p.nodes(),function(h){l(p.node(h))}),e.forEach(p.edges(),function(h){var g=p.edge(h);e.forEach(g.points,l),e.has(g,"y")&&l(g)})}function l(p){p.y=-p.y}function d(p){e.forEach(p.nodes(),function(h){f(p.node(h))}),e.forEach(p.edges(),function(h){var g=p.edge(h);e.forEach(g.points,f),e.has(g,"x")&&f(g)})}function f(p){var h=p.x;p.x=p.y,p.y=h}return Ev}var jv,_j;function a8(){if(_j)return jv;_j=1;var e=yt();jv=t;function t(n){var s={},a=e.filter(n.nodes(),function(p){return!n.children(p).length}),i=e.max(e.map(a,function(p){return n.node(p).rank})),l=e.map(e.range(i+1),function(){return[]});function d(p){if(!e.has(s,p)){s[p]=!0;var h=n.node(p);l[h.rank].push(p),e.forEach(n.successors(p),d)}}var f=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(f,d),l}return jv}var Cv,Sj;function o8(){if(Sj)return Cv;Sj=1;var e=yt();Cv=t;function t(s,a){for(var i=0,l=1;l<a.length;++l)i+=n(s,a[l-1],a[l]);return i}function n(s,a,i){for(var l=e.zipObject(i,e.map(i,function(y,w){return w})),d=e.flatten(e.map(a,function(y){return e.sortBy(e.map(s.outEdges(y),function(w){return{pos:l[w.w],weight:s.edge(w).weight}}),"pos")}),!0),f=1;f<i.length;)f<<=1;var p=2*f-1;f-=1;var h=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(d.forEach(function(y){var w=y.pos+f;h[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=h[w+1]),w=w-1>>1,h[w]+=y.weight;g+=y.weight*N})),g}return Cv}var Tv,Nj;function i8(){if(Nj)return Tv;Nj=1;var e=yt();Tv=t;function t(n,s){return e.map(s,function(a){var i=n.inEdges(a);if(i.length){var l=e.reduce(i,function(d,f){var p=n.edge(f),h=n.node(f.v);return{sum:d.sum+p.weight*h.order,weight:d.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:a}})}return Tv}var Rv,Ej;function l8(){if(Ej)return Rv;Ej=1;var e=yt();Rv=t;function t(a,i){var l={};e.forEach(a,function(f,p){var h=l[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(h.barycenter=f.barycenter,h.weight=f.weight)}),e.forEach(i.edges(),function(f){var p=l[f.v],h=l[f.w];!e.isUndefined(p)&&!e.isUndefined(h)&&(h.indegree++,p.out.push(l[f.w]))});var d=e.filter(l,function(f){return!f.indegree});return n(d)}function n(a){var i=[];function l(p){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(p.barycenter)||h.barycenter>=p.barycenter)&&s(p,h)}}function d(p){return function(h){h.in.push(p),--h.indegree===0&&a.push(h)}}for(;a.length;){var f=a.pop();i.push(f),e.forEach(f.in.reverse(),l(f)),e.forEach(f.out,d(f))}return e.map(e.filter(i,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(a,i){var l=0,d=0;a.weight&&(l+=a.barycenter*a.weight,d+=a.weight),i.weight&&(l+=i.barycenter*i.weight,d+=i.weight),a.vs=i.vs.concat(a.vs),a.barycenter=l/d,a.weight=d,a.i=Math.min(i.i,a.i),i.merged=!0}return Rv}var Av,jj;function c8(){if(jj)return Av;jj=1;var e=yt(),t=vn();Av=n;function n(i,l){var d=t.partition(i,function(k){return e.has(k,"barycenter")}),f=d.lhs,p=e.sortBy(d.rhs,function(k){return-k.i}),h=[],g=0,y=0,w=0;f.sort(a(!!l)),w=s(h,p,w),e.forEach(f,function(k){w+=k.vs.length,h.push(k.vs),g+=k.barycenter*k.weight,y+=k.weight,w=s(h,p,w)});var N={vs:e.flatten(h,!0)};return y&&(N.barycenter=g/y,N.weight=y),N}function s(i,l,d){for(var f;l.length&&(f=e.last(l)).i<=d;)l.pop(),i.push(f.vs),d++;return d}function a(i){return function(l,d){return l.barycenter<d.barycenter?-1:l.barycenter>d.barycenter?1:i?d.i-l.i:l.i-d.i}}return Av}var Mv,Cj;function u8(){if(Cj)return Mv;Cj=1;var e=yt(),t=i8(),n=l8(),s=c8();Mv=a;function a(d,f,p,h){var g=d.children(f),y=d.node(f),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,k={};w&&(g=e.filter(g,function(M){return M!==w&&M!==N}));var E=t(d,g);e.forEach(E,function(M){if(d.children(M.v).length){var $=a(d,M.v,p,h);k[M.v]=$,e.has($,"barycenter")&&l(M,$)}});var _=n(E,p);i(_,k);var S=s(_,h);if(w&&(S.vs=e.flatten([w,S.vs,N],!0),d.predecessors(w).length)){var j=d.node(d.predecessors(w)[0]),C=d.node(d.predecessors(N)[0]);e.has(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+j.order+C.order)/(S.weight+2),S.weight+=2}return S}function i(d,f){e.forEach(d,function(p){p.vs=e.flatten(p.vs.map(function(h){return f[h]?f[h].vs:h}),!0)})}function l(d,f){e.isUndefined(d.barycenter)?(d.barycenter=f.barycenter,d.weight=f.weight):(d.barycenter=(d.barycenter*d.weight+f.barycenter*f.weight)/(d.weight+f.weight),d.weight+=f.weight)}return Mv}var Iv,Tj;function d8(){if(Tj)return Iv;Tj=1;var e=yt(),t=hr().Graph;Iv=n;function n(a,i,l){var d=s(a),f=new t({compound:!0}).setGraph({root:d}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var h=a.node(p),g=a.parent(p);(h.rank===i||h.minRank<=i&&i<=h.maxRank)&&(f.setNode(p),f.setParent(p,g||d),e.forEach(a[l](p),function(y){var w=y.v===p?y.w:y.v,N=f.edge(w,p),k=e.isUndefined(N)?0:N.weight;f.setEdge(w,p,{weight:a.edge(y).weight+k})}),e.has(h,"minRank")&&f.setNode(p,{borderLeft:h.borderLeft[i],borderRight:h.borderRight[i]}))}),f}function s(a){for(var i;a.hasNode(i=e.uniqueId("_root")););return i}return Iv}var $v,Rj;function h8(){if(Rj)return $v;Rj=1;var e=yt();$v=t;function t(n,s,a){var i={},l;e.forEach(a,function(d){for(var f=n.parent(d),p,h;f;){if(p=n.parent(f),p?(h=i[p],i[p]=f):(h=l,l=f),h&&h!==f){s.setEdge(h,f);return}f=p}})}return $v}var Ov,Aj;function f8(){if(Aj)return Ov;Aj=1;var e=yt(),t=a8(),n=o8(),s=u8(),a=d8(),i=h8(),l=hr().Graph,d=vn();Ov=f;function f(y){var w=d.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),k=p(y,e.range(w-1,-1,-1),"outEdges"),E=t(y);g(y,E);for(var _=Number.POSITIVE_INFINITY,S,j=0,C=0;C<4;++j,++C){h(j%2?N:k,j%4>=2),E=d.buildLayerMatrix(y);var M=n(y,E);M<_&&(C=0,S=e.cloneDeep(E),_=M)}g(y,S)}function p(y,w,N){return e.map(w,function(k){return a(y,k,N)})}function h(y,w){var N=new l;e.forEach(y,function(k){var E=k.graph().root,_=s(k,E,N,w);e.forEach(_.vs,function(S,j){k.node(S).order=j}),i(k,N,_.vs)})}function g(y,w){e.forEach(w,function(N){e.forEach(N,function(k,E){y.node(k).order=E})})}return Ov}var Pv,Mj;function p8(){if(Mj)return Pv;Mj=1;var e=yt(),t=hr().Graph,n=vn();Pv={positionX:N,findType1Conflicts:s,findType2Conflicts:a,addConflict:l,hasConflict:d,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:g,balance:w};function s(_,S){var j={};function C(M,$){var I=0,z=0,O=M.length,A=e.last($);return e.forEach($,function(D,H){var X=i(_,D),R=X?_.node(X).order:O;(X||D===A)&&(e.forEach($.slice(z,H+1),function(Z){e.forEach(_.predecessors(Z),function(B){var Q=_.node(B),P=Q.order;(P<I||R<P)&&!(Q.dummy&&_.node(Z).dummy)&&l(j,B,Z)})}),z=H+1,I=R)}),$}return e.reduce(S,C),j}function a(_,S){var j={};function C($,I,z,O,A){var D;e.forEach(e.range(I,z),function(H){D=$[H],_.node(D).dummy&&e.forEach(_.predecessors(D),function(X){var R=_.node(X);R.dummy&&(R.order<O||R.order>A)&&l(j,X,D)})})}function M($,I){var z=-1,O,A=0;return e.forEach(I,function(D,H){if(_.node(D).dummy==="border"){var X=_.predecessors(D);X.length&&(O=_.node(X[0]).order,C(I,A,H,z,O),A=H,z=O)}C(I,A,I.length,O,$.length)}),I}return e.reduce(S,M),j}function i(_,S){if(_.node(S).dummy)return e.find(_.predecessors(S),function(j){return _.node(j).dummy})}function l(_,S,j){if(S>j){var C=S;S=j,j=C}var M=_[S];M||(_[S]=M={}),M[j]=!0}function d(_,S,j){if(S>j){var C=S;S=j,j=C}return e.has(_[S],j)}function f(_,S,j,C){var M={},$={},I={};return e.forEach(S,function(z){e.forEach(z,function(O,A){M[O]=O,$[O]=O,I[O]=A})}),e.forEach(S,function(z){var O=-1;e.forEach(z,function(A){var D=C(A);if(D.length){D=e.sortBy(D,function(B){return I[B]});for(var H=(D.length-1)/2,X=Math.floor(H),R=Math.ceil(H);X<=R;++X){var Z=D[X];$[A]===A&&O<I[Z]&&!d(j,A,Z)&&($[Z]=A,$[A]=M[A]=M[Z],O=I[Z])}}})}),{root:M,align:$}}function p(_,S,j,C,M){var $={},I=h(_,S,j,M),z=M?"borderLeft":"borderRight";function O(H,X){for(var R=I.nodes(),Z=R.pop(),B={};Z;)B[Z]?H(Z):(B[Z]=!0,R.push(Z),R=R.concat(X(Z))),Z=R.pop()}function A(H){$[H]=I.inEdges(H).reduce(function(X,R){return Math.max(X,$[R.v]+I.edge(R))},0)}function D(H){var X=I.outEdges(H).reduce(function(Z,B){return Math.min(Z,$[B.w]-I.edge(B))},Number.POSITIVE_INFINITY),R=_.node(H);X!==Number.POSITIVE_INFINITY&&R.borderType!==z&&($[H]=Math.max($[H],X))}return O(A,I.predecessors.bind(I)),O(D,I.successors.bind(I)),e.forEach(C,function(H){$[H]=$[j[H]]}),$}function h(_,S,j,C){var M=new t,$=_.graph(),I=k($.nodesep,$.edgesep,C);return e.forEach(S,function(z){var O;e.forEach(z,function(A){var D=j[A];if(M.setNode(D),O){var H=j[O],X=M.edge(H,D);M.setEdge(H,D,Math.max(I(_,A,O),X||0))}O=A})}),M}function g(_,S){return e.minBy(e.values(S),function(j){var C=Number.NEGATIVE_INFINITY,M=Number.POSITIVE_INFINITY;return e.forIn(j,function($,I){var z=E(_,I)/2;C=Math.max($+z,C),M=Math.min($-z,M)}),C-M})}function y(_,S){var j=e.values(S),C=e.min(j),M=e.max(j);e.forEach(["u","d"],function($){e.forEach(["l","r"],function(I){var z=$+I,O=_[z],A;if(O!==S){var D=e.values(O);A=I==="l"?C-e.min(D):M-e.max(D),A&&(_[z]=e.mapValues(O,function(H){return H+A}))}})})}function w(_,S){return e.mapValues(_.ul,function(j,C){if(S)return _[S.toLowerCase()][C];var M=e.sortBy(e.map(_,C));return(M[1]+M[2])/2})}function N(_){var S=n.buildLayerMatrix(_),j=e.merge(s(_,S),a(_,S)),C={},M;e.forEach(["u","d"],function(I){M=I==="u"?S:e.values(S).reverse(),e.forEach(["l","r"],function(z){z==="r"&&(M=e.map(M,function(H){return e.values(H).reverse()}));var O=(I==="u"?_.predecessors:_.successors).bind(_),A=f(_,M,j,O),D=p(_,M,A.root,A.align,z==="r");z==="r"&&(D=e.mapValues(D,function(H){return-H})),C[I+z]=D})});var $=g(_,C);return y(C,$),w(C,_.graph().align)}function k(_,S,j){return function(C,M,$){var I=C.node(M),z=C.node($),O=0,A;if(O+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":A=-I.width/2;break;case"r":A=I.width/2;break}if(A&&(O+=j?A:-A),A=0,O+=(I.dummy?S:_)/2,O+=(z.dummy?S:_)/2,O+=z.width/2,e.has(z,"labelpos"))switch(z.labelpos.toLowerCase()){case"l":A=z.width/2;break;case"r":A=-z.width/2;break}return A&&(O+=j?A:-A),A=0,O}}function E(_,S){return _.node(S).width}return Pv}var Lv,Ij;function m8(){if(Ij)return Lv;Ij=1;var e=yt(),t=vn(),n=p8().positionX;Lv=s;function s(i){i=t.asNonCompoundGraph(i),a(i),e.forEach(n(i),function(l,d){i.node(d).x=l})}function a(i){var l=t.buildLayerMatrix(i),d=i.graph().ranksep,f=0;e.forEach(l,function(p){var h=e.max(e.map(p,function(g){return i.node(g).height}));e.forEach(p,function(g){i.node(g).y=f+h/2}),f+=h+d})}return Lv}var Dv,$j;function g8(){if($j)return Dv;$j=1;var e=yt(),t=QB(),n=ZB(),s=e8(),a=vn().normalizeRanks,i=t8(),l=vn().removeEmptyRanks,d=n8(),f=r8(),p=s8(),h=f8(),g=m8(),y=vn(),w=hr().Graph;Dv=N;function N(G,U){var ee=U&&U.debugTiming?y.time:y.notime;ee("layout",function(){var Y=ee(" buildLayoutGraph",function(){return O(G)});ee(" runLayout",function(){k(Y,ee)}),ee(" updateInputGraph",function(){E(G,Y)})})}function k(G,U){U(" makeSpaceForEdgeLabels",function(){A(G)}),U(" removeSelfEdges",function(){F(G)}),U(" acyclic",function(){t.run(G)}),U(" nestingGraph.run",function(){d.run(G)}),U(" rank",function(){s(y.asNonCompoundGraph(G))}),U(" injectEdgeLabelProxies",function(){D(G)}),U(" removeEmptyRanks",function(){l(G)}),U(" nestingGraph.cleanup",function(){d.cleanup(G)}),U(" normalizeRanks",function(){a(G)}),U(" assignRankMinMax",function(){H(G)}),U(" removeEdgeLabelProxies",function(){X(G)}),U(" normalize.run",function(){n.run(G)}),U(" parentDummyChains",function(){i(G)}),U(" addBorderSegments",function(){f(G)}),U(" order",function(){h(G)}),U(" insertSelfEdges",function(){J(G)}),U(" adjustCoordinateSystem",function(){p.adjust(G)}),U(" position",function(){g(G)}),U(" positionSelfEdges",function(){L(G)}),U(" removeBorderNodes",function(){P(G)}),U(" normalize.undo",function(){n.undo(G)}),U(" fixupEdgeLabelCoords",function(){B(G)}),U(" undoCoordinateSystem",function(){p.undo(G)}),U(" translateGraph",function(){R(G)}),U(" assignNodeIntersects",function(){Z(G)}),U(" reversePoints",function(){Q(G)}),U(" acyclic.undo",function(){t.undo(G)})}function E(G,U){e.forEach(G.nodes(),function(ee){var Y=G.node(ee),le=U.node(ee);Y&&(Y.x=le.x,Y.y=le.y,U.children(ee).length&&(Y.width=le.width,Y.height=le.height))}),e.forEach(G.edges(),function(ee){var Y=G.edge(ee),le=U.edge(ee);Y.points=le.points,e.has(le,"x")&&(Y.x=le.x,Y.y=le.y)}),G.graph().width=U.graph().width,G.graph().height=U.graph().height}var _=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},j=["acyclicer","ranker","rankdir","align"],C=["width","height"],M={width:0,height:0},$=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},z=["labelpos"];function O(G){var U=new w({multigraph:!0,compound:!0}),ee=ue(G.graph());return U.setGraph(e.merge({},S,K(ee,_),e.pick(ee,j))),e.forEach(G.nodes(),function(Y){var le=ue(G.node(Y));U.setNode(Y,e.defaults(K(le,C),M)),U.setParent(Y,G.parent(Y))}),e.forEach(G.edges(),function(Y){var le=ue(G.edge(Y));U.setEdge(Y,e.merge({},I,K(le,$),e.pick(le,z)))}),U}function A(G){var U=G.graph();U.ranksep/=2,e.forEach(G.edges(),function(ee){var Y=G.edge(ee);Y.minlen*=2,Y.labelpos.toLowerCase()!=="c"&&(U.rankdir==="TB"||U.rankdir==="BT"?Y.width+=Y.labeloffset:Y.height+=Y.labeloffset)})}function D(G){e.forEach(G.edges(),function(U){var ee=G.edge(U);if(ee.width&&ee.height){var Y=G.node(U.v),le=G.node(U.w),fe={rank:(le.rank-Y.rank)/2+Y.rank,e:U};y.addDummyNode(G,"edge-proxy",fe,"_ep")}})}function H(G){var U=0;e.forEach(G.nodes(),function(ee){var Y=G.node(ee);Y.borderTop&&(Y.minRank=G.node(Y.borderTop).rank,Y.maxRank=G.node(Y.borderBottom).rank,U=e.max(U,Y.maxRank))}),G.graph().maxRank=U}function X(G){e.forEach(G.nodes(),function(U){var ee=G.node(U);ee.dummy==="edge-proxy"&&(G.edge(ee.e).labelRank=ee.rank,G.removeNode(U))})}function R(G){var U=Number.POSITIVE_INFINITY,ee=0,Y=Number.POSITIVE_INFINITY,le=0,fe=G.graph(),me=fe.marginx||0,ke=fe.marginy||0;function Ve(Le){var qe=Le.x,Ne=Le.y,Ge=Le.width,be=Le.height;U=Math.min(U,qe-Ge/2),ee=Math.max(ee,qe+Ge/2),Y=Math.min(Y,Ne-be/2),le=Math.max(le,Ne+be/2)}e.forEach(G.nodes(),function(Le){Ve(G.node(Le))}),e.forEach(G.edges(),function(Le){var qe=G.edge(Le);e.has(qe,"x")&&Ve(qe)}),U-=me,Y-=ke,e.forEach(G.nodes(),function(Le){var qe=G.node(Le);qe.x-=U,qe.y-=Y}),e.forEach(G.edges(),function(Le){var qe=G.edge(Le);e.forEach(qe.points,function(Ne){Ne.x-=U,Ne.y-=Y}),e.has(qe,"x")&&(qe.x-=U),e.has(qe,"y")&&(qe.y-=Y)}),fe.width=ee-U+me,fe.height=le-Y+ke}function Z(G){e.forEach(G.edges(),function(U){var ee=G.edge(U),Y=G.node(U.v),le=G.node(U.w),fe,me;ee.points?(fe=ee.points[0],me=ee.points[ee.points.length-1]):(ee.points=[],fe=le,me=Y),ee.points.unshift(y.intersectRect(Y,fe)),ee.points.push(y.intersectRect(le,me))})}function B(G){e.forEach(G.edges(),function(U){var ee=G.edge(U);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(G){e.forEach(G.edges(),function(U){var ee=G.edge(U);ee.reversed&&ee.points.reverse()})}function P(G){e.forEach(G.nodes(),function(U){if(G.children(U).length){var ee=G.node(U),Y=G.node(ee.borderTop),le=G.node(ee.borderBottom),fe=G.node(e.last(ee.borderLeft)),me=G.node(e.last(ee.borderRight));ee.width=Math.abs(me.x-fe.x),ee.height=Math.abs(le.y-Y.y),ee.x=fe.x+ee.width/2,ee.y=Y.y+ee.height/2}}),e.forEach(G.nodes(),function(U){G.node(U).dummy==="border"&&G.removeNode(U)})}function F(G){e.forEach(G.edges(),function(U){if(U.v===U.w){var ee=G.node(U.v);ee.selfEdges||(ee.selfEdges=[]),ee.selfEdges.push({e:U,label:G.edge(U)}),G.removeEdge(U)}})}function J(G){var U=y.buildLayerMatrix(G);e.forEach(U,function(ee){var Y=0;e.forEach(ee,function(le,fe){var me=G.node(le);me.order=fe+Y,e.forEach(me.selfEdges,function(ke){y.addDummyNode(G,"selfedge",{width:ke.label.width,height:ke.label.height,rank:me.rank,order:fe+ ++Y,e:ke.e,label:ke.label},"_se")}),delete me.selfEdges})})}function L(G){e.forEach(G.nodes(),function(U){var ee=G.node(U);if(ee.dummy==="selfedge"){var Y=G.node(ee.e.v),le=Y.x+Y.width/2,fe=Y.y,me=ee.x-le,ke=Y.height/2;G.setEdge(ee.e,ee.label),G.removeNode(U),ee.label.points=[{x:le+2*me/3,y:fe-ke},{x:le+5*me/6,y:fe-ke},{x:le+me,y:fe},{x:le+5*me/6,y:fe+ke},{x:le+2*me/3,y:fe+ke}],ee.label.x=ee.x,ee.label.y=ee.y}})}function K(G,U){return e.mapValues(e.pick(G,U),Number)}function ue(G){var U={};return e.forEach(G,function(ee,Y){U[Y.toLowerCase()]=ee}),U}return Dv}var qv,Oj;function y8(){if(Oj)return qv;Oj=1;var e=yt(),t=vn(),n=hr().Graph;qv={debugOrdering:s};function s(a){var i=t.buildLayerMatrix(a),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(d){l.setNode(d,{label:d}),l.setParent(d,"layer"+a.node(d).rank)}),e.forEach(a.edges(),function(d){l.setEdge(d.v,d.w,{},d.name)}),e.forEach(i,function(d,f){var p="layer"+f;l.setNode(p,{rank:"same"}),e.reduce(d,function(h,g){return l.setEdge(h,g,{style:"invis"}),g})}),l}return qv}var Fv,Pj;function v8(){return Pj||(Pj=1,Fv="0.8.5"),Fv}var zv,Lj;function w8(){return Lj||(Lj=1,zv={graphlib:hr(),layout:g8(),debug:y8(),util:{time:vn().time,notime:vn().notime},version:v8()}),zv}var x8=w8();const Dj=Ew(x8),ei=240,Qu=130,Ho=74,Cd=72,qj=Ho+Cd;function b8(e,t){var s;let n=ei;for(const a of e)n=Math.max(n,((s=t.get(a.id))==null?void 0:s.width)??ei);return n}const gA=420,k8=2;function Ml(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function _8(e,t){return((t==null?void 0:t.get(e))??0)>0?gA:0}function S8(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Il(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??ei)+_8(e,n),h:Math.max((s==null?void 0:s.height)??Qu,S8(e,n))}}function N8(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function E8(e,t,n,s,a,i){const l=new Dj.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const d=e.filter(_=>!a.has(_)),f=new Set(d);for(const _ of d){const{w:S,h:j}=Il(_,s,i);l.setNode(_,{width:S,height:j})}for(const _ of t)f.has(_.source)&&f.has(_.target)&&l.setEdge(_.source,_.target);Dj.layout(l);const p=new Map;let h=1/0,g=1/0,y=-1/0,w=-1/0;for(const _ of d){const S=l.node(_);if(!S)continue;const j=s.get(_),C=(j==null?void 0:j.width)??ei,M=(j==null?void 0:j.height)??Qu,$=Il(_,s,i),I=S.x-$.w/2,z=S.y-$.h/2;p.set(_,{x:I,y:z}),I<h&&(h=I),z<g&&(g=z),I+C>y&&(y=I+C),z+M>w&&(w=z+M)}if(Number.isFinite(h)&&Number.isFinite(g))for(const[_,S]of p)p.set(_,{x:S.x-h,y:S.y-g});const N=Number.isFinite(y)?y-h:0,k=Number.isFinite(w)?w-g:0;let E=null;for(const _ of e){const S=a.get(_);if(!S)continue;const j=s.get(_),C=(j==null?void 0:j.width)??ei,M=(j==null?void 0:j.height)??Qu;E=E===null?{minX:S.x,minY:S.y,maxX:S.x+C,maxY:S.y+M}:{minX:Math.min(E.minX,S.x),minY:Math.min(E.minY,S.y),maxX:Math.max(E.maxX,S.x+C),maxY:Math.max(E.maxY,S.y+M)}}return{positions:p,width:N,height:k,pinnedBox:E}}function j8(e,t,n={}){const s=n.direction??"LR",a=n.pinned??new Map,i=n.measured??new Map,l=n.lanes,d=new Map;for(const _ of e){const S=Ml(_),j=d.get(S);j?j.push(_.id):d.set(S,[_.id])}const p=Array.from(d.keys()).sort().map(_=>({sid:_,...E8(d.get(_),t,s,i,a,l)})),h=b8(e,i),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,y=_=>{const S=[[]];let j=0;for(const C of p)S.length<_&&j>0&&j+C.height>g&&(S.push([]),j=0),S[S.length-1].push(C),j+=C.height+qj;return S},w=_=>_.reduce((S,j)=>Math.max(S,j.width),0)+gA;let N=y(n.availableWidth?k8:1);N.length>1&&N.reduce((S,j)=>S+w(j),0)+h*(N.length-1)>(n.availableWidth??0)&&(N=y(1));const k=new Map;let E=0;for(const _ of N){const S=w(_);let j=0;for(const{positions:C,height:M,pinnedBox:$}of _){for(const[z,O]of C)k.set(z,{x:O.x+E,y:O.y+j});let I=j+M;$&&$.maxY>I&&$.minX<E+S&&E<$.maxX&&(I=$.maxY),j=I+qj}E+=S+h}return e.map(_=>{const S=a.get(_.id);if(S)return{..._,position:S};const j=k.get(_.id);return j?{..._,position:j}:_})}function C8(e,t,n,s,a){const l=Ho+Cd,d=60,f=w=>Il(w,s,a),p=new Map(e.map(w=>[w.id,Ml(w)])),h=[],g=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),y=[];for(const{id:w,pos:N}of g){const{w:k,h:E}=f(w),_=p.get(w)??"_default";if(n.has(w)){h.push({x:N.x,y:N.y,w:k,h:E,sid:_});continue}let S=N.y;for(let j=0;j<h.length+1;j++){const C=h.find(M=>{const $=M.sid===_?24:d,I=M.sid===_?24:l;return N.x<M.x+M.w+$&&M.x<N.x+k+$&&S<M.y+M.h+I&&M.y<S+E+I});if(!C)break;S=C.y+C.h+(C.sid===_?24:l)}S!==N.y&&(t.set(w,{x:N.x,y:S}),y.push(w)),h.push({x:N.x,y:S,w:k,h:E,sid:_})}return y}function T8(e,t,n,s,a,i){const l=k=>Il(k,s,i),d=k=>n.get(k)??t.get(k),f=new Map;for(const k of e){if(!d(k.id))continue;const E=Ml(k),_=f.get(E);_?_.push(k):f.set(E,[k])}const p=new Set;for(const[k,E]of f)E.every(_=>a.has(_.id)&&!n.has(_.id))&&p.add(k);const h=new Map,g=[];for(const k of e){const E=d(k.id);if(!E)continue;const{w:_,h:S}=l(k.id),j=Ml(k);p.has(j)?(h.get(j)??h.set(j,[]).get(j)).push(k):g.push({x:E.x,y:E.y,w:_,h:S})}if(h.size===0)return[];const y=Ho+Cd,w=(k,E,_,S)=>g.some(j=>k<j.x+j.w+Ho&&j.x<k+_+Ho&&E<j.y+j.h+y&&j.y<E+S+y),N=[];for(const k of[...h.keys()].sort()){const E=h.get(k);let _=1/0,S=1/0,j=-1/0,C=-1/0;for(const D of E){const H=d(D.id),{w:X,h:R}=l(D.id);_=Math.min(_,H.x),S=Math.min(S,H.y),j=Math.max(j,H.x+X),C=Math.max(C,H.y+R)}const M=j-_,$=C-S,I=[...new Set(g.map(D=>Math.round(D.x)))].sort((D,H)=>D-H),z=I.length?I:[_],O=[0,...g.map(D=>D.y+D.h+y)].sort((D,H)=>D-H);let A=null;e:for(const D of z)for(const H of O){if(H>=S)break;if(!w(D,H,M,$)){A={x:D,y:H};break e}}if(A){const D=A.x-_,H=A.y-S;for(const X of E){const R=d(X.id);t.set(X.id,{x:R.x+D,y:R.y+H})}N.push(k)}for(const D of E){const H=d(D.id),{w:X,h:R}=l(D.id);g.push({x:H.x,y:H.y,w:X,h:R})}}return N}function R8(e,t,n,s,a,i=!1,l){const p=Ho+Cd+1,h=8,g=1.75,y=200,w=.7,N=.01,k=A=>Il(A,s,l),E=A=>n.get(A)??t.get(A),_=new Map;for(const A of e){if(!E(A.id))continue;const D=Ml(A),H=_.get(D);H?H.push(A):_.set(D,[A])}const S=[],j=new Set,C=new Set,M=a.size===0;for(const A of[..._.keys()].sort()){const D=_.get(A);let H=1/0,X=1/0,R=-1/0,Z=-1/0,B=!1;for(const J of D){const L=E(J.id),{w:K,h:ue}=k(J.id);H=Math.min(H,L.x),X=Math.min(X,L.y),R=Math.max(R,L.x+K),Z=Math.max(Z,L.y+ue),n.has(J.id)&&(B=!0)}const Q=R-H,P=Z-X;C.add(A);const F=a.get(A);F&&(Q>F.w+h||P>F.h+h)&&j.add(A),a.set(A,{w:Q,h:P}),S.push({sid:A,members:D.map(J=>J.id),x:H,y:X,w:Q,h:P,anchored:B,mass:1})}for(const A of[...a.keys()])C.has(A)||a.delete(A);if(i||M)return[];let $=!1;for(let A=0;A<S.length&&!$;A++)for(let D=A+1;D<S.length;D++){const H=S[A],X=S[D];if(!(H.anchored&&X.anchored)&&Math.abs(H.x+H.w/2-(X.x+X.w/2))<(H.w+X.w)/2+61&&Math.abs(H.y+H.h/2-(X.y+X.h/2))<(H.h+X.h)/2+p){$=!0;break}}if(j.size===0&&!$)return[];if(j.size>0)for(const A of S)j.has(A.sid)&&(A.mass=8);else for(const A of S)A.mass=Math.max(1,A.w*A.h/(ei*Qu));const I=new Map(S.map(A=>[A.sid,A.x])),z=new Map(S.map(A=>[A.sid,A.y]));for(let A=0;A<y;A++){const D=new Map,H=new Map;let X=0;for(let R=0;R<S.length;R++)for(let Z=R+1;Z<S.length;Z++){const B=S[R],Q=S[Z];if(B.anchored&&Q.anchored)continue;const P=B.x+B.w/2,F=B.y+B.h/2,J=Q.x+Q.w/2,L=Q.y+Q.h/2,K=(B.w+Q.w)/2+61-Math.abs(P-J),ue=(B.h+Q.h)/2+p-Math.abs(F-L);if(K<=0||ue<=0)continue;const G=(Ye,pe)=>!Ye.anchored&&!(pe<0&&Ye.x<=0),U=(Ye,pe)=>!Ye.anchored&&!(pe<0&&Ye.y<=0),ee=(Ye,pe,we)=>{const Pe=Ye===pe,Ue=Pe?B.sid<Q.sid?-1:1:Math.sign(Ye-pe);return we(B,Ue)||we(Q,-Ue)?Ue:Pe&&(we(B,-Ue)||we(Q,Ue))?-Ue:0},Y=ee(P,J,G),le=ee(F,L,U),fe=Y!==0,me=le!==0;if(!fe&&!me)continue;const ke=fe&&(!me||K*g<ue),[Ve,Le,qe,Ne]=ke?[Y,K,D,G]:[le,ue,H,U],Ge=Ne(B,Ve),be=Ne(Q,-Ve),re=B.mass,Qe=Q.mass,ft=Ge?be?Qe/(re+Qe):1:0,ut=be?Ge?re/(re+Qe):1:0,at=Le*w;qe.set(B.sid,(qe.get(B.sid)??0)+Ve*at*ft),qe.set(Q.sid,(qe.get(Q.sid)??0)-Ve*at*ut),X+=at}for(const R of S)R.anchored||(R.x=Math.max(0,R.x+(D.get(R.sid)??0)),R.y=Math.max(0,R.y+(H.get(R.sid)??0)));if(X<N)break}const O=[];for(const A of S){const D=A.x-I.get(A.sid),H=A.y-z.get(A.sid);if(!(Math.abs(D)<1&&Math.abs(H)<1)){for(const X of A.members){if(n.has(X))continue;const R=t.get(X);R&&t.set(X,{x:R.x+D,y:R.y+H})}O.push(A.sid)}}return O}const A8=600;function kw(e,t){return!(e.exitAt!=null&&t-e.exitAt>A8||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function M8(e,t){const n=new Set;for(const s of e.agents.values())kw(s,t)&&n.add(s.id);return n}function I8(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 $8(e,t,n=0){if(!e)return!1;for(const s of t)if(I8(e,s,n))return!0;return!1}const yA="sessionGroup";function O8(e,t){var s;if(e.type===yA)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const vA=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function Fj(e){const t={};for(const n of vA)t[n]=e(n);return t}function P8(e){return t=>e[t]??""}function L8(e,t){return vA.every(n=>e[n]===t[n])}function D8(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[a,i]of e.positions)n.set(a,i),t.has(a)&&s.set(a,i);return{positions:n,pinned:s}}const q8=1200,F8=1e3;function zj(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<q8?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<F8}function Bv({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function z8(e,t,n){const s=e.x*t.zoom+t.x,a=e.y*t.zoom+t.y,i=(e.x+e.width)*t.zoom+t.x,l=(e.y+e.height)*t.zoom+t.y;return i>0&&s<n.width&&l>0&&a<n.height}function B8({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,z8(a,t,e))return!1;return s}const U8="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Uv="click for what's new";function W8(e){if(e.checkDisabled)return`${U8} · ${Uv}`;if(e.checking)return`Asking npm for the newest release… · ${Uv}`;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 · ${Uv}, and to check npm now`}function H8(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 G8(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 V8(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 _w={kind:"assumed",claude:!0,codex:!0};function Y8(e){if(!e||typeof e!="object")return _w;const t=e.providers;if(!t||typeof t!="object")return _w;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Zu(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const Bj=99;function K8(e){const t=Math.max(0,Math.floor(e));return t>Bj?`${Bj}+`:String(t)}const X8="Pause the canvas";function Q8(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 — ${Zu(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)":`${Zu(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function Z8(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 wA="paused · full",J8=(e,t)=>t>0?wA:e>0?`paused · ${K8(e)}`:"paused";function eU(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:J8(e.held,t),widest:wA,title:t>0?`Connected — the pause is full at ${Zu(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Zu(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 Uj(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const tU={agent:P3,sessionGroup:J3},xA="react-flow__node";function Wj(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,xA))===!0}function nU(e){try{const t=document.querySelector(`.${xA}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const rU=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),sU=420,Nu=18,aU=200,oU=5*6e4,iU=6,lU=2*6e4,Hj=400,_0="agent-dag.layout",S0="agent-dag.viewport",bA="agent-dag.summariesDismissed",kA="agent-dag.sessionListOpen",_A="agent-dag.detailOpen",SA="agent-dag.usagePanelOpen",NA="agent-dag.systemPanelOpen",Gj="agent-dag.accountsPanelOpen",Wv="agent-dag.versionNoticeDismissed",Vj="agent-dag.oldNameNoticeDismissed",cU=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:"},Yj="agent-dag.autoRestart",Kj="agent-dag.bundleReloadedFor";function uU(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(kA)==="1"}catch{return!1}}function dU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(kA,e?"1":"0")}catch{}}function hU(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(_A)==="1"}catch{return!1}}function fU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(_A,e?"1":"0")}catch{}}function pU(){const e=ni(SA);return e===null?!0:e==="1"}function mU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(SA,e?"1":"0")}catch{}}function gU(){return ni(NA)==="1"}function yU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(NA,e?"1":"0")}catch{}}function vU(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(bA);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 Xj(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(bA,JSON.stringify(n))}catch{}}function wU(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(_0);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const a=Object.entries(n).filter(([,i])=>i&&typeof i.x=="number"&&typeof i.y=="number");return{positions:a,pins:a.map(([i])=>i)}}return{positions:Object.entries(n.positions??{}).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function Gv(e,t){if(!(typeof window>"u"))try{const n={};for(const[s,a]of e)n[s]=a;for(const[s,a]of t)n[s]=a;window.localStorage.setItem(_0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function xU(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(S0);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 bU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(S0,JSON.stringify(e))}catch{}}function Qj(){if(!(typeof window>"u")){try{window.localStorage.removeItem(_0)}catch{}try{window.localStorage.removeItem(S0)}catch{}}}function kU(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const h of e.agents.values())h.sessionId===t&&s.push(h);const a={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:s.map(h=>({id:h.id,kind:h.kind,label:h.label,parentId:h.parentId,state:h.state,startedAt:h.startedAt,endedAt:h.endedAt,model:h.model,cwd:h.cwd,usage:h.usage,prompts:h.prompts,tools:h.tools.map(g=>({id:g.id,name:g.name,inputPreview:g.inputPreview,startedAt:g.startedAt,endedAt:g.endedAt,ok:g.ok,errorPreview:g.errorPreview,usage:g.usage}))}))},i=JSON.stringify(a,null,2),l=new Blob([i],{type:"application/json"}),d=URL.createObjectURL(l),f=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=d,f.download=`${Ut}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(d),1e3)}const Sw={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Nw={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},EA=LT;function _U(e,t,n,s,a,i,l,d,f,p,h,g,y,w,N,k,E,_){const S=[],j=[];for(const A of e.agents.values()){if(!E.has(A.id))continue;const D=A.exitAt!=null,H=k!=null&&!k.has(A.id),X=[D?"rf-exiting":"",H?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,R=i.get(A.id);if(S.push({id:A.id,type:"agent",position:{x:0,y:0},data:{...A,now:t,onOpenContext:_},className:X,...R?{width:R.width,height:R.height}:null}),A.parentId&&E.has(A.parentId)){const Z=Gw(A.sessionId),B=D,Q=N.size>0&&(N.has(A.id)||N.has(A.parentId)),P=k!=null&&!k.has(A.id)&&!k.has(A.parentId),F=A.state==="active"?2:1.5,J=Q?F+1.5:F,L=B?.2:P?.12:1,K=["sess-edge",A.state==="active"?"sess-live":"sess-idle",B?"rf-edge-exiting":"",Q?"rf-edge-selected":""].filter(Boolean).join(" ");j.push({id:`e:${A.parentId}->${A.id}`,source:A.parentId,target:A.id,animated:(A.state==="active"||Q)&&!B,type:"smoothstep",style:{"--session-hue":Z,strokeWidth:J,opacity:L,transition:"var(--edge-transition)"},className:K})}}const C=new Map;for(const A of e.agents.values())A.tools.length>0&&C.set(A.id,Math.min(4,A.tools.length));const M=`${y}#lanes:${N8(C)}`,$=S.filter(A=>yF(A.id,a,h,g));if($.length>0||M!==w.current){if($.length>0){const A=j8(S,j,{direction:"LR",pinned:a,measured:i,availableWidth:n,availableHeight:s,lanes:C});for(const D of A)fR(D.id,h,g)&&wF(D.id,D.position,h,g);T8(S,h,a,i,new Set($.map(D=>D.id)),C)}C8(S,h,a,i,C),w.current=M}const I=R8(S,h,a,i,l,!f||p,C);I.length>0&&d(I),wu(h,e.agents),wu(g,e.agents),wu(a,e.agents),wu(i,pF(e.agents.values()));const z=[];let O=!1;for(const A of S){let D=a.get(A.id)??h.get(A.id);D||(D=vF(A.id,h,g),O=!0),z.push({...A,position:D})}return O&&(w.current=""),{nodes:z,edges:j}}function SU(){return c.jsx(Ww,{children:c.jsx(NU,{})})}function NU(){var Di,ua,Wr,uo;const e=Dl(),t=Mt(),n=b.useState(cw)[0],s=b.useRef(n),[,a]=b.useState(0),i=b.useCallback(()=>a(q=>q+1),[]),[l,d]=b.useState(()=>new Set),[f,p]=b.useState(null),[h,g]=b.useState(null),y=b.useCallback((q,W)=>{d(ie=>{if(!W)return new Set([q]);const de=new Set(ie);return de.has(q)?de.delete(q):de.add(q),de}),p(ie=>W&&ie===q?ie:q)},[]),w=b.useCallback(()=>{d(new Set),p(null)},[]),[N,k]=b.useState(null),[E,_]=b.useState(null),S=b.useCallback(q=>_(q),[]),[j,C]=b.useState(!1),[M,$]=b.useState(!1),I=b.useState(vU)[0],[z,O]=b.useState(uU);b.useEffect(()=>{dU(z)},[z]);const[A,D]=b.useState(hU);b.useEffect(()=>{fU(A)},[A]);const[H,X]=b.useState(pU);b.useEffect(()=>{mU(H)},[H]);const[R,Z]=b.useState(gU);b.useEffect(()=>{yU(R)},[R]);const[B,Q]=b.useState(()=>{try{const q=window.localStorage.getItem(Gj);return q===null?!0:q==="1"}catch{return!0}});b.useEffect(()=>{try{window.localStorage.setItem(Gj,B?"1":"0")}catch{}},[B]);const[P,F]=b.useState(null);b.useEffect(()=>{let q=null;try{q=localStorage.getItem("agent-dag.sound")}catch{}F(q===null?!0:q==="on")},[]);const J=b.useCallback(()=>{F(q=>{var ie;const W=q!==!0;try{localStorage.setItem("agent-dag.sound",W?"on":"off")}catch{}return W&&((ie=Le.current)==null||ie.unlock()),W})},[]),L=b.useCallback(q=>{J()},[J]),K=b.useRef(L);K.current=L;const ue=b.useRef(P);ue.current=P;const[G,U]=b.useState(()=>L5(ni)),ee=b.useRef(G);ee.current=G;const Y=b.useRef(null),le=b.useCallback((q,W=!1)=>{var ie,de;if((ie=Le.current)==null||ie.unlock(),Y.current!==null&&clearTimeout(Y.current),Y.current=null,!W){(de=Le.current)==null||de.play(q,!0);return}Y.current=setTimeout(()=>{var je;Y.current=null,(je=Le.current)==null||je.play(q,!0)},M5)},[]),fe=b.useCallback((q,W)=>{U(ie=>{const de={level:Al(W.level??ie[q].level),figure:iR(q,W.figure??ie[q].figure)};try{localStorage.setItem(lR[q],String(de.level)),localStorage.setItem(cR[q],de.figure)}catch{}return{...ie,[q]:de}}),le(q,!0)},[le]);b.useEffect(()=>()=>{Y.current!==null&&clearTimeout(Y.current)},[]);const[me,ke]=b.useState(!1),Ve=b.useRef(null),Le=b.useRef(null),[qe,Ne]=b.useState("locked");b.useEffect(()=>{const q=F5({enabled:()=>ue.current===!0,prefs:()=>ee.current,onState:Ne});Le.current=q,Ne(q.state());const W=()=>q.unlock();return window.addEventListener("pointerdown",W,{once:!0,capture:!0}),window.addEventListener("keydown",W,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",W,{capture:!0}),window.removeEventListener("keydown",W,{capture:!0})}},[]);const[Ge,be]=b.useState(!1),[re,Qe]=b.useState(null),[ft,ut]=b.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Wv)??""}catch{return""}}),[at,Ye]=b.useState(!1),pe=b.useRef(0),[we,Pe]=b.useState(!1),Ue=b.useCallback((q=!1)=>(q&&(pe.current=Date.now(),Pe(!0)),fetch(q?"/api/version?refresh=1":"/api/version").then(W=>W.ok?W.json():null).then(W=>{W&&Qe(W)}).catch(()=>{}).finally(()=>{q&&Pe(!1)})),[]),ot=b.useCallback(()=>{Ue(Date.now()-pe.current>=cU)},[Ue]);b.useEffect(()=>{Ue();const q=window.setInterval(ot,5*6e4),W=()=>{document.visibilityState==="visible"&&ot()};return document.addEventListener("visibilitychange",W),()=>{window.clearInterval(q),document.removeEventListener("visibilitychange",W)}},[Ue,ot]),b.useEffect(()=>{Ge&&Ue()},[Ge,Ue]);const $e=(re==null?void 0:re.notice)??null,[se,Se]=b.useState(null),De=b.useRef(!1);b.useEffect(()=>{if(De.current)return;const q=eF(),W=tF(q),ie=sF({stored:W,running:(re==null?void 0:re.running)??null,notes:d1,remembers:nF(q)});ie.reason!=="no-version"&&(De.current=!0,ie.record&&rF(q,ie.record),ie.show.length&&Se({entries:ie.show,since:W,firstRun:ie.reason==="welcome"}))},[re==null?void 0:re.running]);const _e=(re==null?void 0:re.running)??"3.18.0",Be=b.useMemo(()=>uR(d1,null,_e),[_e]),_t=b.useCallback(()=>{Se({entries:Be,since:null,firstRun:!1})},[Be]),[vt,Ae]=b.useState(null),[it,wt]=b.useState(_w);b.useEffect(()=>{let q=!1;return fetch("/api/health").then(W=>W.ok?W.json():null).then(W=>{q||(wt(Y8(W)),!(!W||typeof W.workspace!="string")&&Ae(W.workspace))}).catch(()=>{}),()=>{q=!0}},[Ge]);const xt=b.useRef(it);xt.current=it;const nn=$e?`${$e.kind}:${$e.to}`:"",rn=$e!=null&&ft!==nn,In=b.useCallback(()=>{ut("");try{window.localStorage.setItem(Wv,"")}catch{}},[]),Da=b.useCallback(()=>{if($e){ut(nn);try{window.localStorage.setItem(Wv,nn)}catch{}}},[$e,nn]),[qa,Fa]=b.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Vj)??""}catch{return""}}),wn=re!=null&&re.invokedAs&&re.invokedAs!==Ut?re.invokedAs:null,Bs=wn!=null&&qa!==wn,za=b.useCallback(()=>{if(wn){Fa(wn);try{window.localStorage.setItem(Vj,wn)}catch{}}},[wn]),$t=((Di=re==null?void 0:re.upgrade)==null?void 0:Di.state)??"idle",mr=d5(re==null?void 0:re.upgrade),Kn=b.useRef(!1),li=b.useCallback(async()=>{if(ur(Kn.current||$t==="running")){Kn.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Ue(),Kn.current=!1}},[$t,Ue]);b.useEffect(()=>{if($t!=="running")return;const q=window.setInterval(Ue,3e3);return()=>window.clearInterval(q)},[$t,Ue]);const Rr=b.useCallback(async()=>{const q=re==null?void 0:re.command;!q||!await oR(q)||(Ye(!0),window.setTimeout(()=>Ye(!1),1600))},[re==null?void 0:re.command]),Ar=b.useCallback(()=>{O(q=>(q||Q(!1),!q))},[]),Mr=b.useCallback(()=>{Q(q=>(q||O(!1),!q))},[]),[is,Us]=b.useState(!1),[Ba,Ws]=b.useState(!1),[$n,Ua]=b.useState(()=>{try{return Number(localStorage.getItem(m1))||0}catch{return 0}}),[Hs,ci]=b.useState([]),[Ir,Gs]=b.useState(!1);b.useEffect(()=>{let q=!0;const W=()=>{fetch("/api/browser-watch?live=0").then(de=>de.ok?de.json():null).then(de=>{var je;!q||!(de!=null&&de.ok)||(ci(de.episodes??[]),Gs(((je=de.settings)==null?void 0:je.enabled)===!0))}).catch(()=>{})};W();const ie=setInterval(W,5*6e4);return()=>{q=!1,clearInterval(ie)}},[]);const[Wa,$r]=b.useState([]),Vs=b.useRef(new Set),[ls,dt]=b.useState(null);b.useEffect(()=>{let q=!0;const W=()=>{fetch("/api/lan").then(de=>de.ok?de.json():null).then(de=>{!q||!(de!=null&&de.ok)||$r(Array.isArray(de.pending)?de.pending:[])}).catch(()=>{})};W();const ie=setInterval(W,5e3);return()=>{q=!1,clearInterval(ie)}},[]);const Ha=b.useCallback(async(q,W)=>{if(!ls){dt(q);try{const de=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:q,fp:W})})).json().catch(()=>null);de&&Array.isArray(de.pending)?$r(de.pending):$r(je=>je.filter(Re=>Re.fp!==W))}catch{}finally{dt(null)}}},[ls]),On=b.useMemo(()=>VF(Hs,$n).length,[Hs,$n]),[Ga,Or]=b.useState(0),Ys=b.useRef(null),[Va,Pr]=b.useState(!1),qt=b.useRef(null),[Ks,on]=b.useState(0),xn=b.useState(()=>SF({protect:q=>zL(s.current,q)}))[0],[Ya,Td]=b.useState(!1),cs=b.useCallback(()=>{const q=xn.paused&&xn.dropped>0,W=xn.setPaused(!xn.paused);q&&BL(s.current);for(const ie of W)s.current=pk(s.current,ie);Td(xn.paused)},[xn]),[St,Xs]=b.useState(Date.now()),[Pn,Rd]=b.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(Yj)!=="0"}catch{return!0}}),Ad=b.useCallback(()=>{Rd(q=>{const W=!q;try{window.localStorage.setItem(Yj,W?"1":"0")}catch{}return W})},[]),[Ln,Qs]=b.useState(!1),[ui,Zs]=b.useState("restart"),[Xl,Ka]=b.useState(null),Ze=b.useRef(!1),di=b.useRef(null),hi=b.useRef(0),us=b.useCallback(async q=>{if(!ur(Ze.current))return;const W=(q==null?void 0:q.upgrade)===!0;Ze.current=!0,di.current=mr;const ie=++hi.current;Zs(W?"npx":"restart"),Qs(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",($e==null?void 0:$e.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:W})})}catch{}window.setTimeout(()=>{if(hi.current===ie&&Ze.current){Ze.current=!1,Qs(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},W?18e4:3e4)},[$e==null?void 0:$e.to,mr]),Xa=b.useRef(null);b.useEffect(()=>{const q=o1(s.current.agents.values())>0,W=g5({enabled:Pn,kind:$e==null?void 0:$e.kind,canRestart:(re==null?void 0:re.canRestart)===!0,noticeOpen:rn,visible:document.visibilityState==="visible",busy:q,idleSince:Xa.current,now:St});Xa.current=W.idleSince,W.restart&&us()},[Pn,$e==null?void 0:$e.kind,re==null?void 0:re.canRestart,rn,St,us]);const fi=o1(s.current.agents.values()),pi=m5(fi),Qa=aR({enabled:Pn,kind:$e==null?void 0:$e.kind,canRestart:(re==null?void 0:re.canRestart)===!0,noticeOpen:rn,visible:document.visibilityState==="visible",busy:fi>0,idleSince:Xa.current,now:St});b.useEffect(()=>{const q=re==null?void 0:re.running;let W=null,ie=null;try{W=window.sessionStorage.getItem("agent-dag.restartPending"),ie=window.sessionStorage.getItem(Kj)}catch{return}const de=u5({bundle:"3.18.0",running:q,pending:W,lastTried:ie});if(de==="reload"){try{window.sessionStorage.setItem(Kj,q??"")}catch{return}window.location.reload();return}if(de!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Ze.current=!1,Qs(!1),Ka(q??null);const je=window.setTimeout(()=>Ka(null),6e3);return()=>window.clearTimeout(je)},[re==null?void 0:re.running]),b.useEffect(()=>{if(Ln&&h5({asked:di.current,reported:mr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Ze.current=!1,Qs(!1)}},[Ln,mr]);const Js=b.useState(()=>D8(wU()))[0],Nt=b.useRef(Js.pinned),bn=b.useRef(null),kn=b.useState(()=>xU())[0],[Lr,ea]=b.useState(()=>new Set),[ln,Ql]=b.useState(EF),[Xn,ta]=b.useState(()=>Fj(Uj)),Zl=b.useMemo(()=>P8(Xn),[Xn]),Jl=b.useCallback(q=>O8(q,Zl),[Zl]),Za=b.useMemo(()=>({background:Xn["--panel"],border:`1px solid ${Xn["--line"]}`,borderRadius:8}),[Xn]),[mi,Md]=b.useState(!1);b.useEffect(()=>{document.documentElement.dataset.theme=ln;try{window.localStorage.setItem(pR,ln)}catch{}ta(q=>{const W=Fj(Uj);return L8(q,W)?q:W})},[ln]);const _n=b.useCallback((q,W)=>{if(Bv({durationMs:W,documentHidden:document.hidden})){e.setViewport(q,{duration:W});return}const{d3Zoom:ie,d3Selection:de}=t.getState(),je=de==null?void 0:de.property("__zoom");if(ie&&de&&je&&je.k>0&&q.zoom>0){ie.transform(de,je.scale(q.zoom/je.k).translate((q.x-je.x)/q.zoom,(q.y-je.y)/q.zoom));return}e.setViewport(q,{duration:0})},[e,t]),Qn=b.useRef(null);b.useEffect(()=>{if(!kn)return;const q=window.setTimeout(()=>{try{_n(kn,0)}catch{}Zn.current=Date.now()},60);return()=>window.clearTimeout(q)},[_n,kn]);const Dr=b.useRef(!0);b.useEffect(()=>{const q=new EventSource("/events"),W=kF(i,{now:()=>Date.now(),setTimeout:(ie,de)=>window.setTimeout(ie,de),clearTimeout:ie=>window.clearTimeout(ie)});return q.addEventListener("open",()=>{be(!0),Md(!0)}),q.addEventListener("error",()=>be(!1)),q.addEventListener("replay-end",()=>{Dr.current=!1,W.flush()}),q.addEventListener("hook",ie=>{var de;try{const je=JSON.parse(ie.data);if(!xn.accept(je))return;s.current=pk(s.current,je);const Re=je.replay===!0||Dr.current||Date.now()-je.receivedAt>3e4;Re?W.replay():W.live();const He=q5(je,Re);He&&((de=Le.current)==null||de.play(He))}catch{}}),()=>{q.close(),W.cancel()}},[i]),b.useEffect(()=>{const q=setInterval(()=>{const W=Date.now();Xs(W);let ie=UL(s.current,W,fk);WL(s.current,W,fk)&&(ie=!0),qL(s.current,W,aU,oU)&&(ie=!0),FL(s.current,W,iU,lU)&&(ie=!0),d(de=>fF(de,s.current.agents)),p(de=>de!=null&&!s.current.agents.has(de)?null:de),_(de=>de!=null&&!s.current.agents.has(de)?null:de),k(de=>de!=null&&!s.current.agents.has(de)?null:de),ie&&i()},250);return()=>clearInterval(q)},[i]);const ds=b.useRef(null),Zn=b.useRef(0),Id=420,cn=b.useCallback((q=500)=>{try{const Re=document.querySelector(".canvas-wrap"),He=Array.from(document.querySelectorAll(".react-flow__node")).filter(mt=>mt.offsetWidth>0);if(!Re||He.length===0)return;const et=Re.getBoundingClientRect(),rt=e.getViewport();if(!Number.isFinite(rt.zoom)||rt.zoom<=0)return;const st=mt=>(mt-et.left-rt.x)/rt.zoom,Kt=mt=>(mt-et.top-rt.y)/rt.zoom,ho=He.map(mt=>mt.getBoundingClientRect()),hc=Math.min(...ho.map(mt=>st(mt.left))),da=Math.max(...ho.map(mt=>st(mt.right))),fc=Math.min(...ho.map(mt=>Kt(mt.top))),pc=Math.max(...ho.map(mt=>Kt(mt.bottom))),qi=da-hc,lt=pc-fc;if(!(qi>0&<>0))return;const Hr=Math.max(.2,Math.min(1,(et.width-160)/(qi+Id)*.86,(et.height-160)/lt*.86)),xr={x:80-hc*Hr,y:Math.max(80,(et.height-lt*Hr)/2)-fc*Hr,zoom:Hr};_n(xr,q),Zn.current=Date.now(),Qn.current=Bv({durationMs:q,documentHidden:document.hidden})?{target:xr,until:Date.now()+q+60}:null,window.setTimeout(()=>{var mt;try{((mt=Qn.current)==null?void 0:mt.target)===xr&&(Qn.current=null);const Fi=e.getViewport();(Math.abs(Fi.zoom-Hr)>.01||Math.abs(Fi.x-xr.x)>2)&&_n(xr,0)}catch{}},q+60)}catch{}},[e,_n]);b.useEffect(()=>{const q=()=>{if(!document.hidden)return;const W=Qn.current;if(Qn.current=null,!(!W||Date.now()>W.until)){try{_n(W.target,0)}catch{}Zn.current=Date.now()}};return document.addEventListener("visibilitychange",q),()=>document.removeEventListener("visibilitychange",q)},[_n]);const hs=b.useRef(""),na=b.useRef(null),gi=b.useRef(0),Sn=b.useCallback(()=>{gi.current=Date.now()},[]),ra=b.useRef(null),sa=b.useRef(0),Ja=b.useCallback(()=>{sa.current=Date.now()},[]),aa=b.useCallback(q=>({hasSourceEvent:!!q,at:Date.now(),lastDeckFitAt:Zn.current,lastCanvasInputAt:sa.current}),[]),fs="agent-dag.autoFitDisabled",yi=b.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(fs)==="1"}catch{return!1}})[0],Tt=b.useRef(yi),[qr,eo]=b.useState(yi),Fr=b.useCallback(()=>{if(!Tt.current){Tt.current=!0,eo(!0);try{window.localStorage.setItem(fs,"1")}catch{}}},[]),$d=b.useCallback(()=>{Tt.current=!1,eo(!1);try{window.localStorage.removeItem(fs)}catch{}cn(400)},[e,cn]);b.useEffect(()=>{const q=setInterval(()=>{if(Tt.current||Date.now()-gi.current<800)return;const W=s.current,ie=Date.now(),de=[];for(const Re of W.agents.values())kw(Re,ie)&&de.push({id:Re.id});if(de.length===0)return;const je=[];for(const{id:Re}of de){const He=gr.current.get(Re),et=Nt.current.get(Re)??un.current.get(Re);!He||!et||je.push({x:et.x,y:et.y,width:He.width,height:He.height})}B8({pane:ra.current,viewport:e.getViewport(),boxes:je})&&cn(600)},1500);return()=>clearInterval(q)},[e]);const oa=b.useRef(!1),gr=b.useRef(new Map),ps=b.useRef(0),to=b.useCallback(q=>{const W=gr.current;let ie=!1;for(const de of q.nodeInternals.values()){const je=de.width,Re=de.height;if(je==null||Re==null)continue;const He=W.get(de.id);He?(Math.abs(He.height-Re)>4||Math.abs(He.width-je)>4)&&(W.set(de.id,{width:je,height:Re}),ie=!0):(W.set(de.id,{width:je,height:Re}),ie=!0)}return ie&&(ps.current+=1),ps.current},[]),vi=ct(to),[ec,Od]=b.useState(0);b.useEffect(()=>{let q=0;const W=()=>{const de=gr.current;let je=!1;for(const Re of document.querySelectorAll(".react-flow__node[data-id]")){const He=Re.getAttribute("data-id");if(!He)continue;const et=Re.offsetWidth,rt=Re.offsetHeight;if(!et||!rt)continue;const st=de.get(He);(!st||Math.abs(st.width-et)>4||Math.abs(st.height-rt)>4)&&(de.set(He,{width:et,height:rt}),je=!0)}je&&Od(Re=>Re+1)};if(oa.current)return;let ie=0;return document.visibilityState==="hidden"?ie=window.setTimeout(W,32):q=requestAnimationFrame(W),()=>{cancelAnimationFrame(q),window.clearTimeout(ie)}});const un=b.useRef(Js.positions),wi=b.useRef(new Set),xi=b.useRef(""),ms=b.useMemo(()=>{const q=[];for(const W of s.current.agents.values())kw(W,St)&&q.push(W.id+(W.parentId?`>${W.parentId}`:""));return q.sort(),`${q.join("|")}#sv${vi}.${ec}`},[s.current,s.current.revision,St,vi,ec]),ia=b.useRef(null);b.useEffect(()=>(ia.current!=null&&window.clearTimeout(ia.current),ia.current=window.setTimeout(()=>{Gv(un.current,Nt.current)},1500),()=>{ia.current!=null&&window.clearTimeout(ia.current)}),[ms]),b.useEffect(()=>{if(hs.current===ms)return;const q=hs.current;if(hs.current=ms,!q||Tt.current)return;Date.now()-Zn.current>1200&&cn(400),ds.current&&window.clearTimeout(ds.current),ds.current=window.setTimeout(()=>{Tt.current||cn(500)},280)},[ms,e,cn]);const bi=b.useMemo(()=>gF(s.current,l),[s.current,s.current.revision,l]),ki=b.useMemo(()=>M8(s.current,St),[s.current,s.current.revision,St]),_i=b.useRef(null),[no,tc]=b.useState({w:0,h:0});b.useEffect(()=>{const q=_i.current;if(!q||typeof ResizeObserver>"u")return;const W=new ResizeObserver(ie=>{var je;const de=(je=ie[0])==null?void 0:je.contentRect;de&&(ra.current={width:de.width,height:de.height},tc(Re=>Math.abs(Re.w-de.width)>40||Math.abs(Re.h-de.height)>40?{w:de.width,h:de.height}:Re))});return W.observe(q),ra.current={width:q.clientWidth,height:q.clientHeight},tc({w:q.clientWidth,h:q.clientHeight}),()=>W.disconnect()},[]);const Pd=b.useCallback(q=>{var ie,de;const W=q.target;!(W!=null&&W.closest)||W.closest(rU)!==q.currentTarget||(q.preventDefault(),(de=(ie=document.activeElement)==null?void 0:ie.blur)==null||de.call(ie))},[]),Ld=b.useRef(new Map),[ro,Dd]=b.useState(!1);b.useEffect(()=>{const q=window.setTimeout(()=>Dd(!0),2500);return()=>window.clearTimeout(q)},[]);const[qd,Si]=b.useState(!1),Jn=b.useRef(null),[Ni,nc]=b.useState(!1),Fd=b.useCallback(()=>{Jn.current&&(window.clearTimeout(Jn.current),Jn.current=null),Si(!1)},[]),zd=b.useCallback(q=>{q.length!==0&&queueMicrotask(()=>{Si(!0),Jn.current&&window.clearTimeout(Jn.current),Jn.current=window.setTimeout(()=>Si(!1),sU+80)})},[]);b.useEffect(()=>()=>{Jn.current&&window.clearTimeout(Jn.current)},[]);const rc=no.w>0?no.w*.92:0,sc=no.h>0?no.h:0,{nodes:yr,edges:Ei}=b.useMemo(()=>_U(s.current,St,rc,sc,Nt.current,gr.current,Ld.current,zd,ro,Ni,un.current,wi.current,ms,xi,l,bi,ki,S),[s.current,s.current.revision,St,rc,sc,ro,Ni,ms,l,bi,ki,S,Ga]),gs=b.useMemo(()=>{const q=new Map;for(const ie of yr){const de=ie.data;if(!(de!=null&&de.sessionId)||de.exitAt!=null)continue;const je=ie.width,Re=ie.height;if(je==null||Re==null)continue;const He=ie.position.x,et=ie.position.y,rt=He+je,st=et+Re,Kt=q.get(de.sessionId);Kt?(Kt.minX=Math.min(Kt.minX,He),Kt.minY=Math.min(Kt.minY,et),Kt.maxX=Math.max(Kt.maxX,rt),Kt.maxY=Math.max(Kt.maxY,st)):q.set(de.sessionId,{minX:He,minY:et,maxX:rt,maxY:st})}const W=[];for(const[ie,de]of q){const je=de.maxX-de.minX+Nu*2,Re=de.maxY-de.minY+Nu*2;W.push({id:`group:${ie}`,type:yA,position:{x:de.minX-Nu,y:de.minY-Nu},data:{sessionId:ie,w:je,h:Re},width:je,height:Re,style:{width:je,height:Re},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return W},[yr,St]),Bd=b.useMemo(()=>{const q=[...gs,...yr],W=qt.current;return!W||W.size===0?q:q.map(ie=>{const de=W.get(ie.id);return de?{...ie,position:de}:ie})},[gs,yr,Ks]),la=b.useMemo(()=>{const q=new Set;for(const W of s.current.agents.values())for(const ie of W.tools)q.add(EA(ie.name));return Object.keys(Sw).filter(W=>q.has(W))},[s.current,s.current.revision]);b.useEffect(()=>{if(la.length<=1){Pr(!1);return}let q=0;const W=()=>{const ie=Ys.current;if(ie&&!document.hidden){const de=ie.getBoundingClientRect(),je=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(He=>He.getBoundingClientRect()),Re=$8(de,je,8);Pr(He=>He===Re?He:Re)}q=window.setTimeout(W,300)};return W(),()=>window.clearTimeout(q)},[la.length]);const ac=b.useCallback(q=>{ea(W=>{const ie=new Set(W);return ie.has(q)?ie.delete(q):ie.add(q),ie})},[]),Yt=f?s.current.agents.get(f):null,so=h?Array.from(s.current.agents.values()).flatMap(q=>q.tools).find(q=>q.id===h)??null:null,ji=b.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=cw(),Nt.current.clear(),gr.current.clear(),un.current.clear(),xi.current="",Qj(),w(),i()},[i,w]),zr=b.useRef(j);zr.current=j;const oc=b.useRef(M);oc.current=M;const Ci=b.useRef(!1);Ci.current=so!=null||is||E!=null||N!=null||Ba||M||se!=null;const ao=b.useCallback(q=>{const W=y5(q,{confirmOpen:zr.current,modalOpen:Ci.current});W==="confirm"?C(!0):W==="clear"&&(C(!1),ji())},[ji]),oo=b.useCallback(()=>{Nt.current.clear(),un.current.clear(),xi.current="",Qj(),i(),window.setTimeout(()=>cn(500),80)},[i,e,cn]),Ti=b.useCallback(()=>cn(500),[cn]),vr=b.useRef(yr);vr.current=yr;const ys=b.useRef(f);ys.current=f;const Ri=b.useCallback(q=>{const W=vr.current,ie=lF(W.map(Re=>({id:Re.id,x:Re.position.x,y:Re.position.y})),ys.current,q),de=ie?W.find(Re=>Re.id===ie):void 0;if(!de)return;const je=Wj(document.activeElement);y(de.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[de]})}catch{}Zn.current=Date.now(),je&&nU(de.id)},30)},[y,e]),vs=b.useCallback(q=>{y(q,!1),window.setTimeout(()=>{try{const W=vr.current.find(ie=>ie.id===q);W&&e.fitView({padding:.3,duration:500,nodes:[W]}),Zn.current=Date.now()}catch{}},60)},[y,e]);b.useEffect(()=>{const q=W=>{var et,rt;const ie=W.target,de={tagName:ie==null?void 0:ie.tagName,isContentEditable:ie==null?void 0:ie.isContentEditable,role:(et=ie==null?void 0:ie.getAttribute)==null?void 0:et.call(ie,"role"),type:ie==null?void 0:ie.type};if(W.key==="Escape"){const st=w3({overlayOpen:Hu.depth()>0,typing:Xw(de)});st==="dismiss"?Hu.dismissTop():st==="blur"?ie==null||ie.blur():(hF(de)&&(ie==null||ie.blur()),w());return}if(Kw(W))return;const je=Wj(ie)?(rt=ie==null?void 0:ie.getAttribute)==null?void 0:rt.call(ie,"data-id"):null,Re=je&&vr.current.some(st=>st.id===je)?je:null,He=uF(W,Re);if(He.kind==="activate"){W.preventDefault(),y(He.nodeId,He.additive);return}He.kind!=="node"&&(He.nodeId==null&&j3(de)||C3({key:W.key,modalOpen:Ci.current,sheetOpen:oc.current})||(W.key===" "&&(W.preventDefault(),cs()),(W.key==="c"||W.key==="C")&&ao("shortcut"),(W.key==="r"||W.key==="R")&&oo(),(W.key==="f"||W.key==="F")&&Ti(),(W.key==="l"||W.key==="L")&&Ar(),(W.key==="d"||W.key==="D")&&D(st=>!st),(W.key==="h"||W.key==="H")&&Us(st=>!st),(W.key==="u"||W.key==="U")&&X(st=>!st),(W.key==="a"||W.key==="A")&&xt.current.claude&&Mr(),(W.key==="j"||W.key==="J")&&Ri(1),(W.key==="k"||W.key==="K")&&Ri(-1),(W.key==="t"||W.key==="T")&&Ql(st=>st==="dark"?"light":"dark"),(W.key==="m"||W.key==="M")&&xt.current.claude&&ue.current!==null&&K.current(W.shiftKey),W.key==="?"&&$(st=>!st)))};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[ao,oo,Ti,w,y,Ri,cs]);const ic=s.current.agents.size,Ot=b.useMemo(()=>u3(s.current.agents.values()),[s.current,s.current.revision]),io=b.useMemo(()=>d3(s.current.agents.values()),[s.current,s.current.revision]),lo=b.useRef(null);b.useEffect(()=>{const q=jF({waiting:Ot.length,running:io,connected:Ge}),W=lo.current;if(lo.current=q,(W==null?void 0:W.title)!==q.title&&(document.title=q.title),(W==null?void 0:W.icon)!==q.icon){const ie=document.querySelector('link[rel="icon"]');ie&&(ie.href=CF[q.icon])}},[Ot.length,io,Ge]);const[lc,cc]=b.useState(""),Ai=RF(Ot);b.useEffect(()=>{cc(q=>AF(q,Ai))},[Ai]);const[ca,Ud]=b.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[Br,Mi]=b.useState(null),[Wd,Nn]=b.useState(!1),[En,co]=b.useState(!0),[uc,Ii]=b.useState(!1);b.useEffect(()=>{let q=!0;return fetch("/api/prefs").then(W=>W.ok?W.json():null).then(W=>{var ie;!q||!(W!=null&&W.ok)||(co(((ie=W.prefs)==null?void 0:ie.notifications)!==!1),Ii(W.notificationsVetoed===!0))}).catch(()=>{}),()=>{q=!1}},[]);const $i=b.useRef(()=>{}),Oi=b.useCallback(()=>{const q=!En;co(q),q&&typeof Notification<"u"&&Notification.permission==="default"&&$i.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:q})}).then(W=>W.ok?W.json():null).then(W=>{var ie;W!=null&&W.ok&&(co(((ie=W.prefs)==null?void 0:ie.notifications)!==!1),Ii(W.notificationsVetoed===!0))}).catch(()=>{})},[En]),dc=typeof Notification<"u",Pi=g3(ca,dc);b.useEffect(()=>{Pi&&En&&Ot.length>0&&Nn(!0)},[Pi,En,Ot.length]),b.useEffect(()=>{if(!Br)return;const W=setTimeout(()=>Mi(null),Br==="blocked"?8e3:4e3);return()=>clearTimeout(W)},[Br]);const wr=b.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(q=>{const W=q;Ud(W),W==="granted"?Mi("on"):W==="denied"&&Mi("blocked")})},[]);$i.current=wr;const ws=b.useRef(new Set),Ur=b.useRef(null),Li=Ot.map(q=>id(q.id,q.waiting)).join("|");return b.useEffect(()=>{m3(Ur.current,ca)&&(Ur.current=ca,ws.current=yk(Ot))},[ca]),b.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||Ur.current===null)return;const q=typeof document>"u"||!document.hidden,W=f3(Ot,ws.current,q,En);for(const ie of W)try{const de=new Notification(ie.title,{body:ie.body,tag:ie.key});de.onclick=()=>{window.focus(),vs(ie.sessionId),de.close()}}catch{}ws.current=q?yk(Ot):p3(Ot,W,ws.current)},[Li]),c.jsxs("div",{className:"app",children:[c.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),c.jsxs("header",{className:"topbar",children:[c.jsxs("div",{className:"readout",children:[c.jsxs("div",{className:"brand",children:[c.jsx("span",{className:"logo"}),c.jsx("h1",{children:Ut}),$e?c.jsxs("button",{type:"button",className:"v stale",onClick:()=>{_t(),In()},"aria-haspopup":"dialog","aria-label":G8({...$e,open:rn}),title:$e.kind==="restart"?`Running v${$e.from}; v${$e.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${$e.from}; v${$e.to} is on npm · click for what's new`,children:["v",$e.from,c.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const q={running:_e,latest:re==null?void 0:re.latest,latestPending:re==null?void 0:re.latestPending,checkedAgo:re!=null&&re.checkedAt?mw(St-re.checkedAt):null,checkDisabled:re==null?void 0:re.checkDisabled,checking:we};return c.jsxs("button",{type:"button",className:we?"v checking":"v",onClick:()=>{_t(),Ue(!0)},"aria-busy":we||void 0,"aria-haspopup":"dialog","aria-label":H8(q),title:W8(q),children:["v",q.running]})})()]}),c.jsx("span",{className:"status",children:(()=>{const q=eU({connected:Ge,paused:Ya,held:xn.size,dropped:xn.dropped});return q.resting?null:c.jsx("span",{className:`pill ${q.tone}`,title:q.title,children:c.jsxs("span",{className:"pill-box",children:[c.jsx("span",{className:"pill-widest","aria-hidden":!0,children:q.widest}),c.jsx("span",{className:"pill-label",children:q.label})]})})})()}),c.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:lc}),Ot.length>0&&c.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>vs(Ot[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
253
|
+
Click to set the volume and the sound of each tone, and to hear either one.`}function gR(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 zF(e){const t=gR([{agents:e}]);return t.length<2?null:t.map(n=>`${a0(n.id)} ${Je(n.cost)}`).join(" · ")}function p1(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 BF(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function ku(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 UF=[7,14,30,90];function WF(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),i=b.useState($F)[0],l=b.useRef(!1),d=(f=!1)=>{if(f&&!ur(l.current))return;const p=i.begin();l.current=f;const h=e;a(!0);const y=`/api/ccusage?since=${pw(h)}${f?"&refresh=1":""}`;fetch(y).then(w=>w.json()).then(w=>{p()&&n({range:h,resp:w})}).catch(()=>{p()&&n({range:h,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(l.current=!1,a(!1))})};return b.useEffect(()=>(d(!1),()=>i.cancel()),[e]),{landed:t,loading:s,reload:()=>d(!0)}}function HF({onClose:e,providers:t}){var z;const[n,s]=b.useState(30),[a,i]=b.useState(null),{landed:l,loading:d,reload:f}=WF(n),p=b.useRef(null),h=tn(e,{focusRef:p}),g=OF({loading:d,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((z=l.resp.days)==null?void 0:z.length)??0}}),y=g.phase==="chart"?l.resp.days??[]:[],w=b.useMemo(()=>y.reduce((O,A)=>Math.max(O,A.totalCost),0),[y]),N=b.useRef(null);b.useLayoutEffect(()=>{const O=N.current;O&&(O.scrollLeft=O.scrollWidth)},[y]);const{totalCost:k,totalTok:E,inOut:_,cacheRead:S,modelCosts:j}=b.useMemo(()=>{let O=0,A=0,D=0,H=0;const X=new Map;for(const R of y){O+=R.totalCost,A+=R.totalTokens,D+=R.inputTokens+R.outputTokens,H+=R.cacheReadTokens;for(const Z of R.modelBreakdowns)X.set(Z.modelName,(X.get(Z.modelName)??0)+Z.cost)}return{totalCost:O,totalTok:A,inOut:D,cacheRead:H,modelCosts:X}},[y]),C=b.useMemo(()=>Array.from(j.entries()).sort((O,A)=>A[1]-O[1]),[j]),M=b.useMemo(()=>gR(y),[y]),$=M.length>1,I=a?y.find(O=>O.period===a)??null:null;return c.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:c.jsxs("div",{ref:h,className:"uh-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[c.jsxs("header",{className:"uh-head",children:[c.jsxs("div",{className:"uh-titlewrap",children:[c.jsx("div",{className:"uh-title",children:"Usage history"}),c.jsx("div",{className:"uh-sub",children:DF(t,M.map(O=>O.id))})]}),c.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:UF.map(O=>c.jsxs("button",{type:"button","aria-pressed":n===O,className:"uh-range-btn",onClick:()=>{s(O),i(null)},children:[O,"d"]},O))}),c.jsx("button",{className:"glyph-btn uh-reload",onClick:f,...cr(d),title:"Re-run ccusage","aria-label":"Reload",children:d?"…":"↻"}),c.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.phase==="busy"?c.jsxs("div",{className:"uh-status uh-status-wait","aria-busy":"true",children:[c.jsx("span",{className:"uh-wait-word",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}),c.jsx("span",{className:"uh-wait-axis","aria-hidden":!0})]}):g.phase==="error"?c.jsxs("div",{className:"uh-status uh-err",title:Xo(l.resp)||void 0,children:[vq(l.resp,"ccusage did not report usage"),c.jsx("div",{children:c.jsx("button",{className:"btn uh-retry",onClick:f,...cr(d),children:d?"trying…":"Try again"})})]}):g.phase==="empty"?c.jsx("div",{className:`uh-status${g.stale?" uh-stale":""}`,"aria-busy":g.stale||void 0,children:"no usage in this range"}):c.jsxs("div",{className:g.stale?"uh-stale":void 0,"aria-busy":g.stale||void 0,children:[c.jsxs("div",{className:"uh-totals",children:[c.jsx(_u,{label:"total cost",val:Je(k),accent:!0}),c.jsx(_u,{label:"tokens",val:At(E)}),c.jsx(_u,{label:"input+output",val:At(_)}),c.jsx(_u,{label:"cache reads",val:At(S)})]}),$&&c.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[c.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:M.map(O=>c.jsx("span",{className:"uh-agent-seg",style:{width:`${k>0?O.cost/k*100:0}%`,background:p1(O.id)}},O.id))}),c.jsx("div",{className:"uh-agent-keys",children:M.map(O=>c.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${At(O.tokens)} tokens`,children:[c.jsx("span",{className:"uh-legend-dot",style:{background:p1(O.id)}}),a0(O.id),c.jsx("span",{className:"uh-agent-cost",children:Je(O.cost)}),c.jsx("span",{className:"uh-agent-share",children:BF(O.cost,k)})]},O.id))})]}),c.jsx("div",{ref:N,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map((O,A)=>{const D=w>0?O.totalCost/w*100:0,H=O.period===a,X=`${O.period}, ${Je(O.totalCost)}`;return c.jsxs("button",{className:`uh-bar-col${H?" sel":""}`,onClick:()=>i(H?null:O.period),"aria-pressed":H,"aria-label":X,title:`${O.period} · ${Je(O.totalCost)}`,style:{flexBasis:`${100/y.length}%`,"--uh-i":A,"--uh-step":`${Math.min(10,200/Math.max(y.length,1))}ms`},children:[c.jsx("div",{className:"uh-bar",style:{height:`${Math.max(D,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort((R,Z)=>Z.cost-R.cost).map(R=>{const Z=O.totalCost>0?R.cost/O.totalCost*100:0;return c.jsx("div",{className:"uh-bar-seg",style:{height:`${Z}%`,background:ku(R.modelName)}},R.modelName)})}),c.jsx("span",{className:"uh-bar-label",children:O.period.slice(5)})]},O.period)})}),c.jsx("div",{className:"uh-legend",children:C.map(([O,A])=>c.jsxs("span",{className:"uh-legend-item",title:O,children:[c.jsx("span",{className:"uh-legend-dot",style:{background:ku(O)}}),Fs(O)," ",c.jsx("span",{className:"uh-legend-cost",children:Je(A)})]},O))}),I&&c.jsxs("div",{className:"uh-detail",children:[c.jsxs("div",{className:"uh-detail-head",children:[c.jsx("span",{className:"uh-detail-date",children:I.period}),c.jsx("span",{className:"uh-detail-cost",children:Je(I.totalCost)}),(()=>{var D,H;const A=zF(I.agents)??((H=(D=I.metadata)==null?void 0:D.agents)!=null&&H.length?I.metadata.agents.join(" · "):null);return A?c.jsx("span",{className:"uh-detail-agents",title:A,children:A}):null})()]}),c.jsxs("div",{className:"uh-detail-mini",children:[c.jsx(Su,{label:"input",val:At(I.inputTokens)}),c.jsx(Su,{label:"output",val:At(I.outputTokens)}),c.jsx(Su,{label:"cache write",val:At(I.cacheCreationTokens)}),c.jsx(Su,{label:"cache read",val:At(I.cacheReadTokens)})]}),c.jsx("div",{className:"uh-detail-models",children:I.modelBreakdowns.slice().sort((O,A)=>A.cost-O.cost).map(O=>{const A=I.totalCost>0?O.cost/I.totalCost*100:0;return c.jsxs("div",{className:"uh-model-row",title:O.modelName,children:[c.jsxs("span",{className:"uh-model-name",children:[c.jsx("span",{className:"uh-legend-dot",style:{background:ku(O.modelName)}}),c.jsx("span",{className:"uh-model-label",children:Fs(O.modelName)})]}),c.jsx("span",{className:"uh-model-bar",children:c.jsx("span",{className:"uh-model-bar-fill",style:{width:`${A}%`,background:ku(O.modelName)}})}),c.jsx("span",{className:"uh-model-cost",children:Je(O.cost)})]},O.modelName)})})]})]})]})})}function _u({label:e,val:t,accent:n}){return c.jsxs("div",{className:"uh-stat",children:[c.jsx("span",{className:`uh-stat-val${n?" accent":""}`,children:t}),c.jsx("span",{className:"uh-stat-label",children:e})]})}function Su({label:e,val:t}){return c.jsxs("div",{className:"uh-ministat",children:[c.jsx("span",{className:"uh-ministat-val",children:t}),c.jsx("span",{className:"uh-ministat-label",children:e})]})}function GF(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 i=a/255;return i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)});return .2126*s[0]+.7152*s[1]+.0722*s[2]>.5}const m1=1e4,VF=12e3;function YF({browsers:e,findings:t,watching:n,palette:s,now:a=()=>Date.now()}){const i=b.useRef(null),l=b.useRef(null);return l.current={browsers:e,findings:t,watching:n},b.useEffect(()=>{var w;const d=i.current;if(!d)return;const f=d.getContext("2d");if(!f)return;const p=((w=window.matchMedia)==null?void 0:w.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let h=0,g=!1;const y=()=>{var Q;if(g)return;const N=l.current;if(!N)return;const{browsers:k,findings:E,watching:_}=N,S=s["--accent"]||"#7dd3fc",j=s["--line"]||"#1f2229",C=s["--text-dim"]||"#6e727c",M=GF(s["--bg"]),$=M?42:26,I=M?.85:.65,z=a(),O=Math.min(window.devicePixelRatio||1,2),A=d.clientWidth,D=d.clientHeight;(d.width!==A*O||d.height!==D*O)&&(d.width=A*O,d.height=D*O),f.setTransform(O,0,0,O,0,0),f.clearRect(0,0,A,D);const H=A/2,X=D/2,R=Math.min(A,D)/2-6;f.strokeStyle=j,f.lineWidth=1,f.globalAlpha=M?1:.9;for(const P of[.4,.7,1])f.beginPath(),f.arc(H,X,R*P,0,Math.PI*2),f.stroke();f.beginPath(),f.moveTo(H-R,X),f.lineTo(H+R,X),f.moveTo(H,X-R),f.lineTo(H,X+R),f.stroke(),f.globalAlpha=1;const B=(_&&!p?z%m1/m1:0)*Math.PI*2-Math.PI/2;if(_){const P=(Q=f.createConicGradient)==null?void 0:Q.call(f,B-.85,H,X);P&&(P.addColorStop(0,"transparent"),P.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${S} ${$}%, transparent)`),P.addColorStop(1,"transparent"),f.fillStyle=P,f.beginPath(),f.moveTo(H,X),f.arc(H,X,R,B-.85,B),f.closePath(),f.fill()),f.strokeStyle=S,f.globalAlpha=I,f.beginPath(),f.moveTo(H,X),f.lineTo(H+Math.cos(B)*R,X+Math.sin(B)*R),f.stroke(),f.globalAlpha=1}k.forEach((P,F)=>{const J=F/Math.max(k.length,1)*Math.PI*2-Math.PI/2,L=P.lastReadMs===null?1:Math.min(1,(z-P.lastReadMs)/12e4),K=R*(.42+L*.5),ue=H+Math.cos(J)*K,G=X+Math.sin(J)*K,U=Math.abs((B-J+Math.PI*3)%(Math.PI*2)-Math.PI),ee=_?Math.max(0,1-U/.55):0;f.beginPath(),f.arc(ue,G,3+ee*1.6,0,Math.PI*2),f.fillStyle=P.running?S:C,f.globalAlpha=P.running?.55+ee*.45:.35,f.fill(),f.globalAlpha=1});for(const P of E){const F=(z-P.atMs)/VF;if(F<0||F>1)continue;const L=Math.max(0,k.findIndex(G=>G.key===P.browser))/Math.max(k.length,1)*Math.PI*2-Math.PI/2,K=H+Math.cos(L)*R*.6,ue=X+Math.sin(L)*R*.6;f.beginPath(),f.arc(K,ue,4+F*22,0,Math.PI*2),f.strokeStyle=S,f.globalAlpha=(1-F)*.8,f.lineWidth=1.5,f.stroke(),f.globalAlpha=1}h=requestAnimationFrame(y)};return y(),()=>{g=!0,cancelAnimationFrame(h)}},[a,s]),c.jsx("canvas",{ref:i,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const g1="agent-dag.browserWatch.seenMs";function KF(e,t){return e.filter(n=>n.startMs>t)}function XF(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function QF(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 yR(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function y1(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 ZF(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 JF(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 e6(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=yR(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 t6(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 n6(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function v1(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function r6({onClose:e,onSeen:t,onWatching:n,palette:s}){const a=tn(e),[i,l]=b.useState(null),[d,f]=b.useState(null),[p,h]=b.useState(null),[g,y]=b.useState(!1),w=b.useRef(!1),[N,k]=b.useState(null),[E,_]=b.useState(null),[S,j]=b.useState(!1),C=b.useRef(!1),[M,$]=b.useState(!1),[I,z]=b.useState(!1),[O,A]=b.useState(!1),[D,H]=b.useState(!1),[X,R]=b.useState(!1),[Z,B]=b.useState(()=>Date.now());b.useEffect(()=>{const Y=setInterval(()=>B(Date.now()),1e3);return()=>clearInterval(Y)},[]);const Q=b.useCallback(async Y=>{var le,fe;if(!(Y&&!ur(w.current))){w.current=Y,y(!0);try{const me=await fetch(`/api/browser-watch${Y?"?refresh=1":""}`);if(!me.ok)throw new Error(`the deck answered ${me.status}`);const ke=await me.json();l(ke),C.current||k(((le=ke==null?void 0:ke.settings)==null?void 0:le.quietMinutes)??15),n(((fe=ke==null?void 0:ke.settings)==null?void 0:fe.enabled)===!0),f(null)}catch(me){f(me instanceof Error?me.message:String(me))}finally{w.current=!1,y(!1)}}},[n]);b.useEffect(()=>{Q(!1)},[Q]),b.useEffect(()=>{const Y=setInterval(()=>{Q(!1)},1e4);return()=>clearInterval(Y)},[Q]);const P=b.useCallback(async Y=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:Y.host,startMs:Y.startMs})})}finally{await Q(!1)}},[Q]),F=b.useCallback(async Y=>{C.current=!0,j(!0);try{const le=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Y)});if(!le.ok)throw new Error(`the deck answered ${le.status}`);await Q(!1),h(null)}catch(le){h(le instanceof Error?le.message:String(le))}finally{C.current=!1,j(!1)}},[Q]),J=b.useRef(t);J.current=t,b.useEffect(()=>()=>J.current(Date.now()),[]);const L=b.useMemo(()=>{const Y=[];for(const le of(i==null?void 0:i.episodes)??[]){const fe=n6(le.startMs),me=Y[Y.length-1];me&&me.label===fe?me.episodes.push(le):Y.push({label:fe,episodes:[le]})}return Y},[i]),K=yR(i==null?void 0:i.browsers),ue=((i==null?void 0:i.browsers)??[]).filter(Y=>!(Y.installed&&Y.profiles>0)),G=i?e6(i):null,U=K.reduce((Y,le)=>Y+le.profiles,0),ee=i?XF(i.coverage.lastHumanMs,i.coverage.quietMs,Z):null;return c.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:c.jsxs("div",{ref:a,className:"modal bw-modal",onClick:Y=>Y.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{className:"modal-tool-name",id:"bw-title",children:"Browser watch"}),c.jsx("span",{className:"modal-tool-id",children:i?`${U} ${U===1?"profile":"profiles"} · local only`:"local only"})]}),c.jsxs("div",{className:"modal-actions",children:[c.jsx("button",{className:"glyph-btn",onClick:()=>void Q(!0),...cr(g),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:g?"…":"↻"}),c.jsx("button",{className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),c.jsxs("div",{className:"modal-body bw-body",children:[!i&&!d&&c.jsxs("div",{className:"bw-loading",children:[c.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),c.jsx("p",{children:"Reading each browser's history. The first look copies the file, which takes a moment."})]}),d&&c.jsx("div",{className:"bw-state",children:c.jsxs("div",{className:"bw-row err",children:[c.jsx("span",{className:"bw-dot","aria-hidden":!0}),c.jsx("span",{className:"bw-row-label",children:"Could not read"}),c.jsx("span",{className:"bw-row-detail",children:d})]})}),i&&G&&c.jsx("p",{className:`bw-trouble ${G.kind}`,role:"status",children:G.text}),i&&c.jsxs("div",{className:"bw-work",children:[c.jsxs("aside",{className:"bw-side",children:[c.jsxs("section",{className:"bw-sec",children:[c.jsxs("h4",{className:"bw-sec-head",children:["Activity overview",c.jsx("button",{className:"bw-help",onClick:()=>A(Y=>!Y),"aria-expanded":O,"aria-label":"What the sweep and the dots mean",children:"?"})]}),c.jsxs("div",{className:"bw-glance",children:[c.jsx(YF,{browsers:K.map(Y=>{var le;return{key:Y.key,name:Y.name,running:Y.running,lastReadMs:((le=i.profiles.find(fe=>fe.browser===Y.key))==null?void 0:le.lastWrittenMs)??null}}),findings:i.episodes.slice(0,6).map(Y=>({browser:Y.browser??null,atMs:Y.endMs})),watching:i.settings.enabled,palette:s}),c.jsx("ul",{className:"bw-counts",children:ZF(K,i.profiles).map(Y=>c.jsxs("li",{children:[c.jsx("span",{className:"bw-count-n",children:Y.visits.toLocaleString("en-US")}),c.jsx("span",{className:"bw-count-of",children:Y.name})]},Y.key))})]}),c.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),i.coverage.checkedMs>0&&c.jsxs("p",{className:"bw-since",children:["Last checked ",JF(i.coverage.checkedMs,Z),i.coverage.checks>0&&c.jsxs(c.Fragment,{children:[" · ",i.coverage.checks.toLocaleString("en-US")," ",i.coverage.checks===1?"check":"checks"]})]}),ee!==null&&c.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",QF(ee)]}),O&&c.jsxs("dl",{className:"bw-key",children:[c.jsx("dt",{children:"Sweep"}),c.jsx("dd",{children:"one poll of every watched profile"}),c.jsx("dt",{children:"Dot"}),c.jsx("dd",{children:"a browser, further out the longer since it last wrote history"}),c.jsx("dt",{children:"Ring"}),c.jsx("dd",{children:"a finding, leaving the browser it came from"})]})]}),c.jsxs("section",{className:"bw-sec",children:[c.jsxs("h4",{className:"bw-sec-head",children:["Watched profiles",c.jsx("button",{className:"bw-help",onClick:()=>H(Y=>!Y),"aria-expanded":D,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),D&&c.jsxs("dl",{className:"bw-key",children:[c.jsx("dt",{children:"Running"}),c.jsx("dd",{children:"the browser has a process on this machine right now"}),c.jsx("dt",{children:"Connected"}),c.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"})]}),c.jsx("ul",{className:"bw-profiles",children:K.map(Y=>c.jsxs("li",{children:[c.jsx("span",{className:`bw-prof-dot${Y.running?" on":""}`,"aria-hidden":!0}),c.jsx("span",{className:"bw-prof-name",children:Y.name}),c.jsx("span",{className:"bw-prof-state",children:Y.running?"running":"idle"}),Y.running&&Y.relay.state==="live"&&c.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},Y.key))}),ue.length>0&&c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>R(Y=>!Y),"aria-expanded":X,children:[c.jsx("span",{className:"bw-chev","aria-hidden":!0,children:X?"▾":"▸"})," ",ue.length," not watched"]}),X&&c.jsxs("p",{className:"bw-rest",children:[ue.map(Y=>Y.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]}),i.relay&&c.jsx(s6,{relay:i.relay})]}),c.jsxs("div",{className:"bw-main",children:[c.jsxs("section",{className:"bw-findings",children:[c.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Findings",i.episodes.length>0&&c.jsxs("span",{className:"bw-feed-count",children:[i.episodes.length," ",i.episodes.length===1?"episode":"episodes"]})]}),c.jsx("div",{className:"bw-eps",children:L.length===0?c.jsxs("div",{className:"bw-empty",children:[c.jsx("p",{className:"bw-empty-head",children:"Nothing found yet"}),c.jsxs("p",{className:"bw-empty-note",children:["An episode lands here when a program opens pages in a browser nobody has touched for"," ",i.settings.quietMinutes," ",i.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."]}),!i.settings.enabled&&c.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."})]}):L.map(Y=>c.jsxs("div",{className:"bw-day",children:[c.jsx("h4",{className:"bw-sec-head",children:Y.label}),Y.episodes.map(le=>{const fe=`${le.host}-${le.startMs}`,me=E===fe;return c.jsxs("div",{className:`bw-ep${me?" open":""}`,children:[c.jsxs("div",{className:"bw-ep-row",children:[c.jsxs("button",{className:"bw-ep-head",onClick:()=>_(me?null:fe),"aria-expanded":me,children:[c.jsx("span",{className:"bw-chev","aria-hidden":!0,children:me?"▾":"▸"}),c.jsx("span",{className:"bw-ep-host",children:le.host}),c.jsxs("span",{className:"bw-ep-meta",children:[t6(le),v1(le)&&c.jsxs(c.Fragment,{children:[" · ",v1(le)]})]}),c.jsxs("span",{className:"bw-ep-count",children:[le.count," ",le.count===1?"page":"pages"]})]}),c.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void P(le),"aria-label":`Dismiss ${le.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),me&&c.jsx("ul",{className:"bw-urls",children:le.urls.map((ke,Ve)=>c.jsxs("li",{children:[c.jsx("span",{className:"bw-url-time",children:new Date(ke.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),c.jsx("span",{className:"bw-url",children:ke.url})]},`${ke.url}-${ke.timeMs}-${Ve}`))})]},fe)})]},Y.label))})]}),c.jsxs("section",{className:"bw-feed",children:[c.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Live activity",c.jsxs("span",{className:"bw-feed-count",children:[i.log.length," ",i.log.length===1?"event":"events"]})]}),c.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."}),c.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:i.log.length===0?c.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):i.log.map(Y=>c.jsxs("div",{className:`bw-log-line ${Y.level}${Y.parts?"":" sys"}`,children:[c.jsx("span",{className:"bw-log-time",children:new Date(Y.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),Y.parts?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"bw-log-browser",children:Y.parts.browser}),c.jsx("span",{className:"bw-log-profile",title:Y.parts.profile,children:Y.parts.profile}),c.jsxs("span",{className:"bw-log-value",children:[Y.parts.value,Y.parts.flagged>0&&c.jsxs("span",{className:"bw-log-flag",children:[" · ",Y.parts.flagged," flagged"]})]})]}):c.jsx("span",{className:"bw-log-sys",children:Y.text})]},`${Y.atMs}-${Y.level}-${Y.text}`))})]})]})]}),i&&M&&c.jsxs("div",{className:"bw-settings",children:[c.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:[c.jsx("span",{children:"Nobody browsing for"}),c.jsxs("select",{value:N??i.settings.quietMinutes,onChange:Y=>{k(Number(Y.target.value)),F({quietMinutes:Number(Y.target.value)})},children:[c.jsx("option",{value:1,children:"1 min"}),c.jsx("option",{value:5,children:"5 min"}),c.jsx("option",{value:15,children:"15 min"}),c.jsx("option",{value:30,children:"30 min"}),c.jsx("option",{value:60,children:"60 min"})]})]}),c.jsxs("label",{children:[c.jsx("span",{children:"When it finds one"}),c.jsx("select",{value:i.settings.reaction,onChange:Y=>void F({reaction:Y.target.value}),disabled:!i.settings.enabled,title:i.settings.enabled?"What to do besides writing it down.":"Turn watching on to arm a reaction.",children:(i.reactions??["notify"]).map(Y=>c.jsx("option",{value:Y,children:Y==="notify"?"notify me":Y==="close-tab"?"close the tab":"quit the browser"},Y))})]}),c.jsxs("div",{className:"bw-settings-note",children:[c.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. ",c.jsx("strong",{children:"Usually that is your own agent doing what you asked."})]}),c.jsxs("button",{className:"bw-why",onClick:()=>z(Y=>!Y),"aria-expanded":I,children:[c.jsx("span",{className:"bw-chev","aria-hidden":!0,children:I?"▾":"▸"})," What Browser Watch can access"]}),I&&c.jsxs("dl",{className:"bw-access",children:[c.jsx("dt",{children:"Reads"}),c.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(i.coverage.startedMs).toLocaleString(),"."]}),c.jsx("dt",{children:"Keeps"}),c.jsxs("dd",{children:["Only while the switch is on, and only the episodes it flagged — never your ordinary browsing. In ",c.jsx("code",{className:"bw-path",children:i.coverage.logPath}),", with every address written in full so you can check it yourself."]}),c.jsx("dt",{children:"Sends"}),c.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."}),c.jsx("dt",{children:"Never reads"}),c.jsx("dd",{children:"Anything from before this deck started, cookies, saved passwords, page contents, or any browser profile with no history file."})]})]})]}),p&&c.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:c.jsxs("div",{className:"bw-row err",children:[c.jsx("span",{className:"bw-dot","aria-hidden":!0}),c.jsx("span",{className:"bw-row-label",children:"Could not save that setting"}),c.jsxs("span",{className:"bw-row-detail",children:[p," — the switches below show what is stored, not what you pressed."]}),c.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>h(null),"aria-label":"Dismiss",title:"Dismiss",children:"×"})]})}),i&&c.jsxs("footer",{className:"bw-status",children:[c.jsx("span",{className:`bw-mode-dot${i.settings.enabled?" on":""}`,"aria-hidden":!0}),c.jsx("span",{className:"bw-mode-word",children:y1(i,S).word},y1(i,S).kind),c.jsx("span",{className:"bw-status-text",children:i.coverage.archived===0?i.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${i.coverage.archived} ${i.coverage.archived===1?"episode":"episodes"} on disk`}),c.jsx("button",{className:`glyph-btn bw-gear${M?" on":""}`,onClick:()=>$(Y=>!Y),"aria-expanded":M,"aria-label":"Settings",title:"Settings",children:c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[c.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),c.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"})]})}),c.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[c.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),c.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":i.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"bw-toggle",onClick:()=>void F({enabled:!i.settings.enabled}),title:i.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:c.jsx("span",{className:"bw-toggle-knob"})})]})]})]})]})})}function s6({relay:e}){const[t,n]=b.useState(!1),[s,a]=b.useState(!1),i=e.killswitch.blocked?"unblock":"block",l=e.command[i],d=b.useCallback(async()=>{await iR(l.command)&&(a(!0),window.setTimeout(()=>a(!1),1600))},[l.command]),f=e.profiles.filter(h=>{var g;return(g=h.report)==null?void 0:g.present}),p=e.profiles.filter(h=>h.report===null);return c.jsxs("section",{className:"bw-sec",children:[c.jsx("h4",{className:"bw-sec-head",children:"Remote control"}),c.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&&c.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(h=>c.jsx("code",{className:"bw-path",children:h},h))]}),c.jsxs("button",{className:"bw-why",onClick:()=>n(h=>!h),"aria-expanded":t,children:[c.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&&c.jsxs("div",{className:"bw-rc-body",children:[f.length>0&&c.jsx("dl",{className:"bw-key",children:f.map(h=>c.jsxs(b.Fragment,{children:[c.jsxs("dt",{children:[h.name,h.profile==="Default"?"":` · ${h.profile}`]}),c.jsxs("dd",{children:[h.report.enabled?"enabled":"installed but switched off",h.report.allUrls?", can act on every site":", limited to the sites it was granted",h.report.sensitiveApis.length>0&&c.jsxs(c.Fragment,{children:[" — ",h.report.sensitiveApis.join(", ")]})]})]},`${h.browser}/${h.profile}`))}),p.length>0&&c.jsxs("p",{className:"bw-rc-note",children:[p.map(h=>h.name).join(", ")," — its settings file could not be read, so nothing is claimed about it either way."]}),!e.hostsRead&&c.jsxs("p",{className:"bw-rc-note",children:[e.hostsPath," could not be read, so whether the relay is already blocked is unknown."]}),f.some(h=>h.report.allUrls)&&c.jsxs("p",{className:"bw-rc-note",children:["Narrowing the sites in ",c.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."]}),c.jsxs("div",{className:"bw-rc-cmd",children:[c.jsx("code",{children:l.command}),c.jsx("button",{className:"btn bw-rc-copy",onClick:d,children:s?"Copied":"Copy"})]}),c.jsx("p",{className:"bw-rc-note",children:l.note})]})]})}function a6(e,t){const n=(e??[]).filter(a=>a&&typeof a.fp=="string"&&!t.has(a.fp));if(!n.length)return{request:null,waiting:0};const s=[...n].sort((a,i)=>(a.at??0)-(i.at??0));return{request:s[0],waiting:s.length-1}}function o6({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:i,onLater:l}){const d=b.useRef(null),f=tn(l,{focusRef:d}),p=Ia(n,"accept"),h=Ia(n,"dismiss");return c.jsx("div",{className:"modal-backdrop",onClick:l,role:"presentation",children:c.jsxs("div",{ref:f,className:"modal lan-ask",onClick:g=>g.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("i",{className:"ap-pulse","aria-hidden":!0}),c.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:l,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsxs("p",{className:"lan-ask-who",children:[c.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",c.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",aR(e.at,s)]}),c.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."}),c.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",c.jsx("code",{className:"ap-lan-code",children:e.fp})," — it should match the one on their screen."]}),t>0&&c.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.`}),c.jsxs("div",{className:"lan-ask-acts",children:[c.jsx("button",{type:"button",ref:d,className:"btn",disabled:h.disabled,"aria-busy":h.busy,onClick:i,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),c.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 o0(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 Nf,w1;function i6(){if(w1)return Nf;w1=1;function e(){this.__data__=[],this.size=0}return Nf=e,Nf}var Ef,x1;function ri(){if(x1)return Ef;x1=1;function e(t,n){return t===n||t!==t&&n!==n}return Ef=e,Ef}var jf,b1;function dd(){if(b1)return jf;b1=1;var e=ri();function t(n,s){for(var a=n.length;a--;)if(e(n[a][0],s))return a;return-1}return jf=t,jf}var Cf,k1;function l6(){if(k1)return Cf;k1=1;var e=dd(),t=Array.prototype,n=t.splice;function s(a){var i=this.__data__,l=e(i,a);if(l<0)return!1;var d=i.length-1;return l==d?i.pop():n.call(i,l,1),--this.size,!0}return Cf=s,Cf}var Tf,_1;function c6(){if(_1)return Tf;_1=1;var e=dd();function t(n){var s=this.__data__,a=e(s,n);return a<0?void 0:s[a][1]}return Tf=t,Tf}var Rf,S1;function u6(){if(S1)return Rf;S1=1;var e=dd();function t(n){return e(this.__data__,n)>-1}return Rf=t,Rf}var Af,N1;function d6(){if(N1)return Af;N1=1;var e=dd();function t(n,s){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,s])):a[i][1]=s,this}return Af=t,Af}var Mf,E1;function hd(){if(E1)return Mf;E1=1;var e=i6(),t=l6(),n=c6(),s=u6(),a=d6();function i(l){var d=-1,f=l==null?0:l.length;for(this.clear();++d<f;){var p=l[d];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,Mf=i,Mf}var If,j1;function h6(){if(j1)return If;j1=1;var e=hd();function t(){this.__data__=new e,this.size=0}return If=t,If}var $f,C1;function f6(){if(C1)return $f;C1=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return $f=e,$f}var Of,T1;function p6(){if(T1)return Of;T1=1;function e(t){return this.__data__.get(t)}return Of=e,Of}var Pf,R1;function m6(){if(R1)return Pf;R1=1;function e(t){return this.__data__.has(t)}return Pf=e,Pf}var Lf,A1;function vR(){if(A1)return Lf;A1=1;var e=typeof ru=="object"&&ru&&ru.Object===Object&&ru;return Lf=e,Lf}var Df,M1;function pr(){if(M1)return Df;M1=1;var e=vR(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Df=n,Df}var qf,I1;function si(){if(I1)return qf;I1=1;var e=pr(),t=e.Symbol;return qf=t,qf}var Ff,$1;function g6(){if($1)return Ff;$1=1;var e=si(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function i(l){var d=n.call(l,a),f=l[a];try{l[a]=void 0;var p=!0}catch{}var h=s.call(l);return p&&(d?l[a]=f:delete l[a]),h}return Ff=i,Ff}var zf,O1;function y6(){if(O1)return zf;O1=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return zf=n,zf}var Bf,P1;function $a(){if(P1)return Bf;P1=1;var e=si(),t=g6(),n=y6(),s="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function l(d){return d==null?d===void 0?a:s:i&&i in Object(d)?t(d):n(d)}return Bf=l,Bf}var Uf,L1;function Vn(){if(L1)return Uf;L1=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Uf=e,Uf}var Wf,D1;function Hl(){if(D1)return Wf;D1=1;var e=$a(),t=Vn(),n="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function l(d){if(!t(d))return!1;var f=e(d);return f==s||f==a||f==n||f==i}return Wf=l,Wf}var Hf,q1;function v6(){if(q1)return Hf;q1=1;var e=pr(),t=e["__core-js_shared__"];return Hf=t,Hf}var Gf,F1;function w6(){if(F1)return Gf;F1=1;var e=v6(),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 Gf=n,Gf}var Vf,z1;function wR(){if(z1)return Vf;z1=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 Vf=n,Vf}var Yf,B1;function x6(){if(B1)return Yf;B1=1;var e=Hl(),t=w6(),n=Vn(),s=wR(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,l=Function.prototype,d=Object.prototype,f=l.toString,p=d.hasOwnProperty,h=RegExp("^"+f.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(y){if(!n(y)||t(y))return!1;var w=e(y)?h:i;return w.test(s(y))}return Yf=g,Yf}var Kf,U1;function b6(){if(U1)return Kf;U1=1;function e(t,n){return t==null?void 0:t[n]}return Kf=e,Kf}var Xf,W1;function Oa(){if(W1)return Xf;W1=1;var e=x6(),t=b6();function n(s,a){var i=t(s,a);return e(i)?i:void 0}return Xf=n,Xf}var Qf,H1;function i0(){if(H1)return Qf;H1=1;var e=Oa(),t=pr(),n=e(t,"Map");return Qf=n,Qf}var Zf,G1;function fd(){if(G1)return Zf;G1=1;var e=Oa(),t=e(Object,"create");return Zf=t,Zf}var Jf,V1;function k6(){if(V1)return Jf;V1=1;var e=fd();function t(){this.__data__=e?e(null):{},this.size=0}return Jf=t,Jf}var ep,Y1;function _6(){if(Y1)return ep;Y1=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return ep=e,ep}var tp,K1;function S6(){if(K1)return tp;K1=1;var e=fd(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function a(i){var l=this.__data__;if(e){var d=l[i];return d===t?void 0:d}return s.call(l,i)?l[i]:void 0}return tp=a,tp}var np,X1;function N6(){if(X1)return np;X1=1;var e=fd(),t=Object.prototype,n=t.hasOwnProperty;function s(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return np=s,np}var rp,Q1;function E6(){if(Q1)return rp;Q1=1;var e=fd(),t="__lodash_hash_undefined__";function n(s,a){var i=this.__data__;return this.size+=this.has(s)?0:1,i[s]=e&&a===void 0?t:a,this}return rp=n,rp}var sp,Z1;function j6(){if(Z1)return sp;Z1=1;var e=k6(),t=_6(),n=S6(),s=N6(),a=E6();function i(l){var d=-1,f=l==null?0:l.length;for(this.clear();++d<f;){var p=l[d];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,sp=i,sp}var ap,J1;function C6(){if(J1)return ap;J1=1;var e=j6(),t=hd(),n=i0();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return ap=s,ap}var op,e_;function T6(){if(e_)return op;e_=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return op=e,op}var ip,t_;function pd(){if(t_)return ip;t_=1;var e=T6();function t(n,s){var a=n.__data__;return e(s)?a[typeof s=="string"?"string":"hash"]:a.map}return ip=t,ip}var lp,n_;function R6(){if(n_)return lp;n_=1;var e=pd();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return lp=t,lp}var cp,r_;function A6(){if(r_)return cp;r_=1;var e=pd();function t(n){return e(this,n).get(n)}return cp=t,cp}var up,s_;function M6(){if(s_)return up;s_=1;var e=pd();function t(n){return e(this,n).has(n)}return up=t,up}var dp,a_;function I6(){if(a_)return dp;a_=1;var e=pd();function t(n,s){var a=e(this,n),i=a.size;return a.set(n,s),this.size+=a.size==i?0:1,this}return dp=t,dp}var hp,o_;function l0(){if(o_)return hp;o_=1;var e=C6(),t=R6(),n=A6(),s=M6(),a=I6();function i(l){var d=-1,f=l==null?0:l.length;for(this.clear();++d<f;){var p=l[d];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,hp=i,hp}var fp,i_;function $6(){if(i_)return fp;i_=1;var e=hd(),t=i0(),n=l0(),s=200;function a(i,l){var d=this.__data__;if(d instanceof e){var f=d.__data__;if(!t||f.length<s-1)return f.push([i,l]),this.size=++d.size,this;d=this.__data__=new n(f)}return d.set(i,l),this.size=d.size,this}return fp=a,fp}var pp,l_;function md(){if(l_)return pp;l_=1;var e=hd(),t=h6(),n=f6(),s=p6(),a=m6(),i=$6();function l(d){var f=this.__data__=new e(d);this.size=f.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=s,l.prototype.has=a,l.prototype.set=i,pp=l,pp}var mp,c_;function c0(){if(c_)return mp;c_=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 mp=e,mp}var gp,u_;function xR(){if(u_)return gp;u_=1;var e=Oa(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return gp=t,gp}var yp,d_;function gd(){if(d_)return yp;d_=1;var e=xR();function t(n,s,a){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[s]=a}return yp=t,yp}var vp,h_;function yd(){if(h_)return vp;h_=1;var e=gd(),t=ri(),n=Object.prototype,s=n.hasOwnProperty;function a(i,l,d){var f=i[l];(!(s.call(i,l)&&t(f,d))||d===void 0&&!(l in i))&&e(i,l,d)}return vp=a,vp}var wp,f_;function Gl(){if(f_)return wp;f_=1;var e=yd(),t=gd();function n(s,a,i,l){var d=!i;i||(i={});for(var f=-1,p=a.length;++f<p;){var h=a[f],g=l?l(i[h],s[h],h,i,s):void 0;g===void 0&&(g=s[h]),d?t(i,h,g):e(i,h,g)}return i}return wp=n,wp}var xp,p_;function O6(){if(p_)return xp;p_=1;function e(t,n){for(var s=-1,a=Array(t);++s<t;)a[s]=n(s);return a}return xp=e,xp}var bp,m_;function Tr(){if(m_)return bp;m_=1;function e(t){return t!=null&&typeof t=="object"}return bp=e,bp}var kp,g_;function P6(){if(g_)return kp;g_=1;var e=$a(),t=Tr(),n="[object Arguments]";function s(a){return t(a)&&e(a)==n}return kp=s,kp}var _p,y_;function Vl(){if(y_)return _p;y_=1;var e=P6(),t=Tr(),n=Object.prototype,s=n.hasOwnProperty,a=n.propertyIsEnumerable,i=e((function(){return arguments})())?e:function(l){return t(l)&&s.call(l,"callee")&&!a.call(l,"callee")};return _p=i,_p}var Sp,v_;function It(){if(v_)return Sp;v_=1;var e=Array.isArray;return Sp=e,Sp}var gl={exports:{}},Np,w_;function L6(){if(w_)return Np;w_=1;function e(){return!1}return Np=e,Np}gl.exports;var x_;function ai(){return x_||(x_=1,(function(e,t){var n=pr(),s=L6(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,l=i&&i.exports===a,d=l?n.Buffer:void 0,f=d?d.isBuffer:void 0,p=f||s;e.exports=p})(gl,gl.exports)),gl.exports}var Ep,b_;function vd(){if(b_)return Ep;b_=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,a){var i=typeof s;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<a}return Ep=n,Ep}var jp,k_;function u0(){if(k_)return jp;k_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return jp=t,jp}var Cp,__;function D6(){if(__)return Cp;__=1;var e=$a(),t=u0(),n=Tr(),s="[object Arguments]",a="[object Array]",i="[object Boolean]",l="[object Date]",d="[object Error]",f="[object Function]",p="[object Map]",h="[object Number]",g="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",k="[object WeakMap]",E="[object ArrayBuffer]",_="[object DataView]",S="[object Float32Array]",j="[object Float64Array]",C="[object Int8Array]",M="[object Int16Array]",$="[object Int32Array]",I="[object Uint8Array]",z="[object Uint8ClampedArray]",O="[object Uint16Array]",A="[object Uint32Array]",D={};D[S]=D[j]=D[C]=D[M]=D[$]=D[I]=D[z]=D[O]=D[A]=!0,D[s]=D[a]=D[E]=D[i]=D[_]=D[l]=D[d]=D[f]=D[p]=D[h]=D[g]=D[y]=D[w]=D[N]=D[k]=!1;function H(X){return n(X)&&t(X.length)&&!!D[e(X)]}return Cp=H,Cp}var Tp,S_;function wd(){if(S_)return Tp;S_=1;function e(t){return function(n){return t(n)}}return Tp=e,Tp}var yl={exports:{}};yl.exports;var N_;function d0(){return N_||(N_=1,(function(e,t){var n=vR(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,l=i&&n.process,d=(function(){try{var f=a&&a.require&&a.require("util").types;return f||l&&l.binding&&l.binding("util")}catch{}})();e.exports=d})(yl,yl.exports)),yl.exports}var Rp,E_;function Yl(){if(E_)return Rp;E_=1;var e=D6(),t=wd(),n=d0(),s=n&&n.isTypedArray,a=s?t(s):e;return Rp=a,Rp}var Ap,j_;function bR(){if(j_)return Ap;j_=1;var e=O6(),t=Vl(),n=It(),s=ai(),a=vd(),i=Yl(),l=Object.prototype,d=l.hasOwnProperty;function f(p,h){var g=n(p),y=!g&&t(p),w=!g&&!y&&s(p),N=!g&&!y&&!w&&i(p),k=g||y||w||N,E=k?e(p.length,String):[],_=E.length;for(var S in p)(h||d.call(p,S))&&!(k&&(S=="length"||w&&(S=="offset"||S=="parent")||N&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||a(S,_)))&&E.push(S);return E}return Ap=f,Ap}var Mp,C_;function xd(){if(C_)return Mp;C_=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,a=typeof s=="function"&&s.prototype||e;return n===a}return Mp=t,Mp}var Ip,T_;function kR(){if(T_)return Ip;T_=1;function e(t,n){return function(s){return t(n(s))}}return Ip=e,Ip}var $p,R_;function q6(){if(R_)return $p;R_=1;var e=kR(),t=e(Object.keys,Object);return $p=t,$p}var Op,A_;function h0(){if(A_)return Op;A_=1;var e=xd(),t=q6(),n=Object.prototype,s=n.hasOwnProperty;function a(i){if(!e(i))return t(i);var l=[];for(var d in Object(i))s.call(i,d)&&d!="constructor"&&l.push(d);return l}return Op=a,Op}var Pp,M_;function as(){if(M_)return Pp;M_=1;var e=Hl(),t=u0();function n(s){return s!=null&&t(s.length)&&!e(s)}return Pp=n,Pp}var Lp,I_;function zs(){if(I_)return Lp;I_=1;var e=bR(),t=h0(),n=as();function s(a){return n(a)?e(a):t(a)}return Lp=s,Lp}var Dp,$_;function F6(){if($_)return Dp;$_=1;var e=Gl(),t=zs();function n(s,a){return s&&e(a,t(a),s)}return Dp=n,Dp}var qp,O_;function z6(){if(O_)return qp;O_=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return qp=e,qp}var Fp,P_;function B6(){if(P_)return Fp;P_=1;var e=Vn(),t=xd(),n=z6(),s=Object.prototype,a=s.hasOwnProperty;function i(l){if(!e(l))return n(l);var d=t(l),f=[];for(var p in l)p=="constructor"&&(d||!a.call(l,p))||f.push(p);return f}return Fp=i,Fp}var zp,L_;function Pa(){if(L_)return zp;L_=1;var e=bR(),t=B6(),n=as();function s(a){return n(a)?e(a,!0):t(a)}return zp=s,zp}var Bp,D_;function U6(){if(D_)return Bp;D_=1;var e=Gl(),t=Pa();function n(s,a){return s&&e(a,t(a),s)}return Bp=n,Bp}var vl={exports:{}};vl.exports;var q_;function _R(){return q_||(q_=1,(function(e,t){var n=pr(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,l=i?n.Buffer:void 0,d=l?l.allocUnsafe:void 0;function f(p,h){if(h)return p.slice();var g=p.length,y=d?d(g):new p.constructor(g);return p.copy(y),y}e.exports=f})(vl,vl.exports)),vl.exports}var Up,F_;function SR(){if(F_)return Up;F_=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 Up=e,Up}var Wp,z_;function NR(){if(z_)return Wp;z_=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=0,l=[];++s<a;){var d=t[s];n(d,s,t)&&(l[i++]=d)}return l}return Wp=e,Wp}var Hp,B_;function ER(){if(B_)return Hp;B_=1;function e(){return[]}return Hp=e,Hp}var Gp,U_;function f0(){if(U_)return Gp;U_=1;var e=NR(),t=ER(),n=Object.prototype,s=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(l){return l==null?[]:(l=Object(l),e(a(l),function(d){return s.call(l,d)}))}:t;return Gp=i,Gp}var Vp,W_;function W6(){if(W_)return Vp;W_=1;var e=Gl(),t=f0();function n(s,a){return e(s,t(s),a)}return Vp=n,Vp}var Yp,H_;function p0(){if(H_)return Yp;H_=1;function e(t,n){for(var s=-1,a=n.length,i=t.length;++s<a;)t[i+s]=n[s];return t}return Yp=e,Yp}var Kp,G_;function bd(){if(G_)return Kp;G_=1;var e=kR(),t=e(Object.getPrototypeOf,Object);return Kp=t,Kp}var Xp,V_;function jR(){if(V_)return Xp;V_=1;var e=p0(),t=bd(),n=f0(),s=ER(),a=Object.getOwnPropertySymbols,i=a?function(l){for(var d=[];l;)e(d,n(l)),l=t(l);return d}:s;return Xp=i,Xp}var Qp,Y_;function H6(){if(Y_)return Qp;Y_=1;var e=Gl(),t=jR();function n(s,a){return e(s,t(s),a)}return Qp=n,Qp}var Zp,K_;function CR(){if(K_)return Zp;K_=1;var e=p0(),t=It();function n(s,a,i){var l=a(s);return t(s)?l:e(l,i(s))}return Zp=n,Zp}var Jp,X_;function TR(){if(X_)return Jp;X_=1;var e=CR(),t=f0(),n=zs();function s(a){return e(a,n,t)}return Jp=s,Jp}var em,Q_;function G6(){if(Q_)return em;Q_=1;var e=CR(),t=jR(),n=Pa();function s(a){return e(a,n,t)}return em=s,em}var tm,Z_;function V6(){if(Z_)return tm;Z_=1;var e=Oa(),t=pr(),n=e(t,"DataView");return tm=n,tm}var nm,J_;function Y6(){if(J_)return nm;J_=1;var e=Oa(),t=pr(),n=e(t,"Promise");return nm=n,nm}var rm,eS;function RR(){if(eS)return rm;eS=1;var e=Oa(),t=pr(),n=e(t,"Set");return rm=n,rm}var sm,tS;function K6(){if(tS)return sm;tS=1;var e=Oa(),t=pr(),n=e(t,"WeakMap");return sm=n,sm}var am,nS;function oi(){if(nS)return am;nS=1;var e=V6(),t=i0(),n=Y6(),s=RR(),a=K6(),i=$a(),l=wR(),d="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",g="[object WeakMap]",y="[object DataView]",w=l(e),N=l(t),k=l(n),E=l(s),_=l(a),S=i;return(e&&S(new e(new ArrayBuffer(1)))!=y||t&&S(new t)!=d||n&&S(n.resolve())!=p||s&&S(new s)!=h||a&&S(new a)!=g)&&(S=function(j){var C=i(j),M=C==f?j.constructor:void 0,$=M?l(M):"";if($)switch($){case w:return y;case N:return d;case k:return p;case E:return h;case _:return g}return C}),am=S,am}var om,rS;function X6(){if(rS)return om;rS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var a=s.length,i=new s.constructor(a);return a&&typeof s[0]=="string"&&t.call(s,"index")&&(i.index=s.index,i.input=s.input),i}return om=n,om}var im,sS;function AR(){if(sS)return im;sS=1;var e=pr(),t=e.Uint8Array;return im=t,im}var lm,aS;function m0(){if(aS)return lm;aS=1;var e=AR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return lm=t,lm}var cm,oS;function Q6(){if(oS)return cm;oS=1;var e=m0();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 um,iS;function Z6(){if(iS)return um;iS=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return um=t,um}var dm,lS;function J6(){if(lS)return dm;lS=1;var e=si(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(a){return n?Object(n.call(a)):{}}return dm=s,dm}var hm,cS;function MR(){if(cS)return hm;cS=1;var e=m0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return hm=t,hm}var fm,uS;function ez(){if(uS)return fm;uS=1;var e=m0(),t=Q6(),n=Z6(),s=J6(),a=MR(),i="[object Boolean]",l="[object Date]",d="[object Map]",f="[object Number]",p="[object RegExp]",h="[object Set]",g="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",k="[object Float32Array]",E="[object Float64Array]",_="[object Int8Array]",S="[object Int16Array]",j="[object Int32Array]",C="[object Uint8Array]",M="[object Uint8ClampedArray]",$="[object Uint16Array]",I="[object Uint32Array]";function z(O,A,D){var H=O.constructor;switch(A){case w:return e(O);case i:case l:return new H(+O);case N:return t(O,D);case k:case E:case _:case S:case j:case C:case M:case $:case I:return a(O,D);case d:return new H;case f:case g:return new H(O);case p:return n(O);case h:return new H;case y:return s(O)}}return fm=z,fm}var pm,dS;function IR(){if(dS)return pm;dS=1;var e=Vn(),t=Object.create,n=(function(){function s(){}return function(a){if(!e(a))return{};if(t)return t(a);s.prototype=a;var i=new s;return s.prototype=void 0,i}})();return pm=n,pm}var mm,hS;function $R(){if(hS)return mm;hS=1;var e=IR(),t=bd(),n=xd();function s(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return mm=s,mm}var gm,fS;function tz(){if(fS)return gm;fS=1;var e=oi(),t=Tr(),n="[object Map]";function s(a){return t(a)&&e(a)==n}return gm=s,gm}var ym,pS;function nz(){if(pS)return ym;pS=1;var e=tz(),t=wd(),n=d0(),s=n&&n.isMap,a=s?t(s):e;return ym=a,ym}var vm,mS;function rz(){if(mS)return vm;mS=1;var e=oi(),t=Tr(),n="[object Set]";function s(a){return t(a)&&e(a)==n}return vm=s,vm}var wm,gS;function sz(){if(gS)return wm;gS=1;var e=rz(),t=wd(),n=d0(),s=n&&n.isSet,a=s?t(s):e;return wm=a,wm}var xm,yS;function OR(){if(yS)return xm;yS=1;var e=md(),t=c0(),n=yd(),s=F6(),a=U6(),i=_R(),l=SR(),d=W6(),f=H6(),p=TR(),h=G6(),g=oi(),y=X6(),w=ez(),N=$R(),k=It(),E=ai(),_=nz(),S=Vn(),j=sz(),C=zs(),M=Pa(),$=1,I=2,z=4,O="[object Arguments]",A="[object Array]",D="[object Boolean]",H="[object Date]",X="[object Error]",R="[object Function]",Z="[object GeneratorFunction]",B="[object Map]",Q="[object Number]",P="[object Object]",F="[object RegExp]",J="[object Set]",L="[object String]",K="[object Symbol]",ue="[object WeakMap]",G="[object ArrayBuffer]",U="[object DataView]",ee="[object Float32Array]",Y="[object Float64Array]",le="[object Int8Array]",fe="[object Int16Array]",me="[object Int32Array]",ke="[object Uint8Array]",Ve="[object Uint8ClampedArray]",Le="[object Uint16Array]",qe="[object Uint32Array]",Ne={};Ne[O]=Ne[A]=Ne[G]=Ne[U]=Ne[D]=Ne[H]=Ne[ee]=Ne[Y]=Ne[le]=Ne[fe]=Ne[me]=Ne[B]=Ne[Q]=Ne[P]=Ne[F]=Ne[J]=Ne[L]=Ne[K]=Ne[ke]=Ne[Ve]=Ne[Le]=Ne[qe]=!0,Ne[X]=Ne[R]=Ne[ue]=!1;function Ge(be,re,Qe,ft,ut,at){var Ye,pe=re&$,we=re&I,Pe=re&z;if(Qe&&(Ye=ut?Qe(be,ft,ut,at):Qe(be)),Ye!==void 0)return Ye;if(!S(be))return be;var Ue=k(be);if(Ue){if(Ye=y(be),!pe)return l(be,Ye)}else{var ot=g(be),$e=ot==R||ot==Z;if(E(be))return i(be,pe);if(ot==P||ot==O||$e&&!ut){if(Ye=we||$e?{}:N(be),!pe)return we?f(be,a(Ye,be)):d(be,s(Ye,be))}else{if(!Ne[ot])return ut?be:{};Ye=w(be,ot,pe)}}at||(at=new e);var se=at.get(be);if(se)return se;at.set(be,Ye),j(be)?be.forEach(function(_e){Ye.add(Ge(_e,re,Qe,_e,be,at))}):_(be)&&be.forEach(function(_e,Be){Ye.set(Be,Ge(_e,re,Qe,Be,be,at))});var Se=Pe?we?h:p:we?M:C,De=Ue?void 0:Se(be);return t(De||be,function(_e,Be){De&&(Be=_e,_e=be[Be]),n(Ye,Be,Ge(_e,re,Qe,Be,be,at))}),Ye}return xm=Ge,xm}var bm,vS;function az(){if(vS)return bm;vS=1;var e=OR(),t=4;function n(s){return e(s,t)}return bm=n,bm}var km,wS;function g0(){if(wS)return km;wS=1;function e(t){return function(){return t}}return km=e,km}var _m,xS;function oz(){if(xS)return _m;xS=1;function e(t){return function(n,s,a){for(var i=-1,l=Object(n),d=a(n),f=d.length;f--;){var p=d[t?f:++i];if(s(l[p],p,l)===!1)break}return n}}return _m=e,_m}var Sm,bS;function y0(){if(bS)return Sm;bS=1;var e=oz(),t=e();return Sm=t,Sm}var Nm,kS;function v0(){if(kS)return Nm;kS=1;var e=y0(),t=zs();function n(s,a){return s&&e(s,a,t)}return Nm=n,Nm}var Em,_S;function iz(){if(_S)return Em;_S=1;var e=as();function t(n,s){return function(a,i){if(a==null)return a;if(!e(a))return n(a,i);for(var l=a.length,d=s?l:-1,f=Object(a);(s?d--:++d<l)&&i(f[d],d,f)!==!1;);return a}}return Em=t,Em}var jm,SS;function kd(){if(SS)return jm;SS=1;var e=v0(),t=iz(),n=t(e);return jm=n,jm}var Cm,NS;function La(){if(NS)return Cm;NS=1;function e(t){return t}return Cm=e,Cm}var Tm,ES;function PR(){if(ES)return Tm;ES=1;var e=La();function t(n){return typeof n=="function"?n:e}return Tm=t,Tm}var Rm,jS;function LR(){if(jS)return Rm;jS=1;var e=c0(),t=kd(),n=PR(),s=It();function a(i,l){var d=s(i)?e:t;return d(i,n(l))}return Rm=a,Rm}var Am,CS;function DR(){return CS||(CS=1,Am=LR()),Am}var Mm,TS;function lz(){if(TS)return Mm;TS=1;var e=kd();function t(n,s){var a=[];return e(n,function(i,l,d){s(i,l,d)&&a.push(i)}),a}return Mm=t,Mm}var Im,RS;function cz(){if(RS)return Im;RS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Im=t,Im}var $m,AS;function uz(){if(AS)return $m;AS=1;function e(t){return this.__data__.has(t)}return $m=e,$m}var Om,MS;function qR(){if(MS)return Om;MS=1;var e=l0(),t=cz(),n=uz();function s(a){var i=-1,l=a==null?0:a.length;for(this.__data__=new e;++i<l;)this.add(a[i])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,Om=s,Om}var Pm,IS;function dz(){if(IS)return Pm;IS=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 Pm=e,Pm}var Lm,$S;function FR(){if($S)return Lm;$S=1;function e(t,n){return t.has(n)}return Lm=e,Lm}var Dm,OS;function zR(){if(OS)return Dm;OS=1;var e=qR(),t=dz(),n=FR(),s=1,a=2;function i(l,d,f,p,h,g){var y=f&s,w=l.length,N=d.length;if(w!=N&&!(y&&N>w))return!1;var k=g.get(l),E=g.get(d);if(k&&E)return k==d&&E==l;var _=-1,S=!0,j=f&a?new e:void 0;for(g.set(l,d),g.set(d,l);++_<w;){var C=l[_],M=d[_];if(p)var $=y?p(M,C,_,d,l,g):p(C,M,_,l,d,g);if($!==void 0){if($)continue;S=!1;break}if(j){if(!t(d,function(I,z){if(!n(j,z)&&(C===I||h(C,I,f,p,g)))return j.push(z)})){S=!1;break}}else if(!(C===M||h(C,M,f,p,g))){S=!1;break}}return g.delete(l),g.delete(d),S}return Dm=i,Dm}var qm,PS;function hz(){if(PS)return qm;PS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a,i){s[++n]=[i,a]}),s}return qm=e,qm}var Fm,LS;function w0(){if(LS)return Fm;LS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a){s[++n]=a}),s}return Fm=e,Fm}var zm,DS;function fz(){if(DS)return zm;DS=1;var e=si(),t=AR(),n=ri(),s=zR(),a=hz(),i=w0(),l=1,d=2,f="[object Boolean]",p="[object Date]",h="[object Error]",g="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",k="[object String]",E="[object Symbol]",_="[object ArrayBuffer]",S="[object DataView]",j=e?e.prototype:void 0,C=j?j.valueOf:void 0;function M($,I,z,O,A,D,H){switch(z){case S:if($.byteLength!=I.byteLength||$.byteOffset!=I.byteOffset)return!1;$=$.buffer,I=I.buffer;case _:return!($.byteLength!=I.byteLength||!D(new t($),new t(I)));case f:case p:case y:return n(+$,+I);case h:return $.name==I.name&&$.message==I.message;case w:case k:return $==I+"";case g:var X=a;case N:var R=O&l;if(X||(X=i),$.size!=I.size&&!R)return!1;var Z=H.get($);if(Z)return Z==I;O|=d,H.set($,I);var B=s(X($),X(I),O,A,D,H);return H.delete($),B;case E:if(C)return C.call($)==C.call(I)}return!1}return zm=M,zm}var Bm,qS;function pz(){if(qS)return Bm;qS=1;var e=TR(),t=1,n=Object.prototype,s=n.hasOwnProperty;function a(i,l,d,f,p,h){var g=d&t,y=e(i),w=y.length,N=e(l),k=N.length;if(w!=k&&!g)return!1;for(var E=w;E--;){var _=y[E];if(!(g?_ in l:s.call(l,_)))return!1}var S=h.get(i),j=h.get(l);if(S&&j)return S==l&&j==i;var C=!0;h.set(i,l),h.set(l,i);for(var M=g;++E<w;){_=y[E];var $=i[_],I=l[_];if(f)var z=g?f(I,$,_,l,i,h):f($,I,_,i,l,h);if(!(z===void 0?$===I||p($,I,d,f,h):z)){C=!1;break}M||(M=_=="constructor")}if(C&&!M){var O=i.constructor,A=l.constructor;O!=A&&"constructor"in i&&"constructor"in l&&!(typeof O=="function"&&O instanceof O&&typeof A=="function"&&A instanceof A)&&(C=!1)}return h.delete(i),h.delete(l),C}return Bm=a,Bm}var Um,FS;function mz(){if(FS)return Um;FS=1;var e=md(),t=zR(),n=fz(),s=pz(),a=oi(),i=It(),l=ai(),d=Yl(),f=1,p="[object Arguments]",h="[object Array]",g="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(k,E,_,S,j,C){var M=i(k),$=i(E),I=M?h:a(k),z=$?h:a(E);I=I==p?g:I,z=z==p?g:z;var O=I==g,A=z==g,D=I==z;if(D&&l(k)){if(!l(E))return!1;M=!0,O=!1}if(D&&!O)return C||(C=new e),M||d(k)?t(k,E,_,S,j,C):n(k,E,I,_,S,j,C);if(!(_&f)){var H=O&&w.call(k,"__wrapped__"),X=A&&w.call(E,"__wrapped__");if(H||X){var R=H?k.value():k,Z=X?E.value():E;return C||(C=new e),j(R,Z,_,S,C)}}return D?(C||(C=new e),s(k,E,_,S,j,C)):!1}return Um=N,Um}var Wm,zS;function BR(){if(zS)return Wm;zS=1;var e=mz(),t=Tr();function n(s,a,i,l,d){return s===a?!0:s==null||a==null||!t(s)&&!t(a)?s!==s&&a!==a:e(s,a,i,l,n,d)}return Wm=n,Wm}var Hm,BS;function gz(){if(BS)return Hm;BS=1;var e=md(),t=BR(),n=1,s=2;function a(i,l,d,f){var p=d.length,h=p,g=!f;if(i==null)return!h;for(i=Object(i);p--;){var y=d[p];if(g&&y[2]?y[1]!==i[y[0]]:!(y[0]in i))return!1}for(;++p<h;){y=d[p];var w=y[0],N=i[w],k=y[1];if(g&&y[2]){if(N===void 0&&!(w in i))return!1}else{var E=new e;if(f)var _=f(N,k,w,i,l,E);if(!(_===void 0?t(k,N,n|s,f,E):_))return!1}}return!0}return Hm=a,Hm}var Gm,US;function UR(){if(US)return Gm;US=1;var e=Vn();function t(n){return n===n&&!e(n)}return Gm=t,Gm}var Vm,WS;function yz(){if(WS)return Vm;WS=1;var e=UR(),t=zs();function n(s){for(var a=t(s),i=a.length;i--;){var l=a[i],d=s[l];a[i]=[l,d,e(d)]}return a}return Vm=n,Vm}var Ym,HS;function WR(){if(HS)return Ym;HS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return Ym=e,Ym}var Km,GS;function vz(){if(GS)return Km;GS=1;var e=gz(),t=yz(),n=WR();function s(a){var i=t(a);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(l){return l===a||e(l,a,i)}}return Km=s,Km}var Xm,VS;function ii(){if(VS)return Xm;VS=1;var e=$a(),t=Tr(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return Xm=s,Xm}var Qm,YS;function x0(){if(YS)return Qm;YS=1;var e=It(),t=ii(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(i,l){if(e(i))return!1;var d=typeof i;return d=="number"||d=="symbol"||d=="boolean"||i==null||t(i)?!0:s.test(i)||!n.test(i)||l!=null&&i in Object(l)}return Qm=a,Qm}var Zm,KS;function wz(){if(KS)return Zm;KS=1;var e=l0(),t="Expected a function";function n(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var l=arguments,d=a?a.apply(this,l):l[0],f=i.cache;if(f.has(d))return f.get(d);var p=s.apply(this,l);return i.cache=f.set(d,p)||f,p};return i.cache=new(n.Cache||e),i}return n.Cache=e,Zm=n,Zm}var Jm,XS;function xz(){if(XS)return Jm;XS=1;var e=wz(),t=500;function n(s){var a=e(s,function(l){return i.size===t&&i.clear(),l}),i=a.cache;return a}return Jm=n,Jm}var eg,QS;function bz(){if(QS)return eg;QS=1;var e=xz(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(l,d,f,p){i.push(f?p.replace(n,"$1"):d||l)}),i});return eg=s,eg}var tg,ZS;function _d(){if(ZS)return tg;ZS=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=Array(a);++s<a;)i[s]=n(t[s],s,t);return i}return tg=e,tg}var ng,JS;function kz(){if(JS)return ng;JS=1;var e=si(),t=_d(),n=It(),s=ii(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function l(d){if(typeof d=="string")return d;if(n(d))return t(d,l)+"";if(s(d))return i?i.call(d):"";var f=d+"";return f=="0"&&1/d==-1/0?"-0":f}return ng=l,ng}var rg,eN;function HR(){if(eN)return rg;eN=1;var e=kz();function t(n){return n==null?"":e(n)}return rg=t,rg}var sg,tN;function Sd(){if(tN)return sg;tN=1;var e=It(),t=x0(),n=bz(),s=HR();function a(i,l){return e(i)?i:t(i,l)?[i]:n(s(i))}return sg=a,sg}var ag,nN;function Kl(){if(nN)return ag;nN=1;var e=ii();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return ag=t,ag}var og,rN;function Nd(){if(rN)return og;rN=1;var e=Sd(),t=Kl();function n(s,a){a=e(a,s);for(var i=0,l=a.length;s!=null&&i<l;)s=s[t(a[i++])];return i&&i==l?s:void 0}return og=n,og}var ig,sN;function _z(){if(sN)return ig;sN=1;var e=Nd();function t(n,s,a){var i=n==null?void 0:e(n,s);return i===void 0?a:i}return ig=t,ig}var lg,aN;function Sz(){if(aN)return lg;aN=1;function e(t,n){return t!=null&&n in Object(t)}return lg=e,lg}var cg,oN;function GR(){if(oN)return cg;oN=1;var e=Sd(),t=Vl(),n=It(),s=vd(),a=u0(),i=Kl();function l(d,f,p){f=e(f,d);for(var h=-1,g=f.length,y=!1;++h<g;){var w=i(f[h]);if(!(y=d!=null&&p(d,w)))break;d=d[w]}return y||++h!=g?y:(g=d==null?0:d.length,!!g&&a(g)&&s(w,g)&&(n(d)||t(d)))}return cg=l,cg}var ug,iN;function VR(){if(iN)return ug;iN=1;var e=Sz(),t=GR();function n(s,a){return s!=null&&t(s,a,e)}return ug=n,ug}var dg,lN;function Nz(){if(lN)return dg;lN=1;var e=BR(),t=_z(),n=VR(),s=x0(),a=UR(),i=WR(),l=Kl(),d=1,f=2;function p(h,g){return s(h)&&a(g)?i(l(h),g):function(y){var w=t(y,h);return w===void 0&&w===g?n(y,h):e(g,w,d|f)}}return dg=p,dg}var hg,cN;function YR(){if(cN)return hg;cN=1;function e(t){return function(n){return n==null?void 0:n[t]}}return hg=e,hg}var fg,uN;function Ez(){if(uN)return fg;uN=1;var e=Nd();function t(n){return function(s){return e(s,n)}}return fg=t,fg}var pg,dN;function jz(){if(dN)return pg;dN=1;var e=YR(),t=Ez(),n=x0(),s=Kl();function a(i){return n(i)?e(s(i)):t(i)}return pg=a,pg}var mg,hN;function os(){if(hN)return mg;hN=1;var e=vz(),t=Nz(),n=La(),s=It(),a=jz();function i(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?s(l)?t(l[0],l[1]):e(l):a(l)}return mg=i,mg}var gg,fN;function KR(){if(fN)return gg;fN=1;var e=NR(),t=lz(),n=os(),s=It();function a(i,l){var d=s(i)?e:t;return d(i,n(l,3))}return gg=a,gg}var yg,pN;function Cz(){if(pN)return yg;pN=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,a){return s!=null&&t.call(s,a)}return yg=n,yg}var vg,mN;function XR(){if(mN)return vg;mN=1;var e=Cz(),t=GR();function n(s,a){return s!=null&&t(s,a,e)}return vg=n,vg}var wg,gN;function Tz(){if(gN)return wg;gN=1;var e=h0(),t=oi(),n=Vl(),s=It(),a=as(),i=ai(),l=xd(),d=Yl(),f="[object Map]",p="[object Set]",h=Object.prototype,g=h.hasOwnProperty;function y(w){if(w==null)return!0;if(a(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||i(w)||d(w)||n(w)))return!w.length;var N=t(w);if(N==f||N==p)return!w.size;if(l(w))return!e(w).length;for(var k in w)if(g.call(w,k))return!1;return!0}return wg=y,wg}var xg,yN;function QR(){if(yN)return xg;yN=1;function e(t){return t===void 0}return xg=e,xg}var bg,vN;function ZR(){if(vN)return bg;vN=1;var e=kd(),t=as();function n(s,a){var i=-1,l=t(s)?Array(s.length):[];return e(s,function(d,f,p){l[++i]=a(d,f,p)}),l}return bg=n,bg}var kg,wN;function JR(){if(wN)return kg;wN=1;var e=_d(),t=os(),n=ZR(),s=It();function a(i,l){var d=s(i)?e:n;return d(i,t(l,3))}return kg=a,kg}var _g,xN;function Rz(){if(xN)return _g;xN=1;function e(t,n,s,a){var i=-1,l=t==null?0:t.length;for(a&&l&&(s=t[++i]);++i<l;)s=n(s,t[i],i,t);return s}return _g=e,_g}var Sg,bN;function Az(){if(bN)return Sg;bN=1;function e(t,n,s,a,i){return i(t,function(l,d,f){s=a?(a=!1,l):n(s,l,d,f)}),s}return Sg=e,Sg}var Ng,kN;function eA(){if(kN)return Ng;kN=1;var e=Rz(),t=kd(),n=os(),s=Az(),a=It();function i(l,d,f){var p=a(l)?e:s,h=arguments.length<3;return p(l,n(d,4),f,h,t)}return Ng=i,Ng}var Eg,_N;function Mz(){if(_N)return Eg;_N=1;var e=$a(),t=It(),n=Tr(),s="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==s}return Eg=a,Eg}var jg,SN;function Iz(){if(SN)return jg;SN=1;var e=YR(),t=e("length");return jg=t,jg}var Cg,NN;function $z(){if(NN)return Cg;NN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",l="\\u200d",d=RegExp("["+l+e+a+i+"]");function f(p){return d.test(p)}return Cg=f,Cg}var Tg,EN;function Oz(){if(EN)return Tg;EN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",l="["+e+"]",d="["+a+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+d+"|"+f+")",h="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",k="["+i+"]?",E="(?:"+w+"(?:"+[h,g,y].join("|")+")"+k+N+")*",_=k+N+E,S="(?:"+[h+d+"?",d,g,y,l].join("|")+")",j=RegExp(f+"(?="+f+")|"+S+_,"g");function C(M){for(var $=j.lastIndex=0;j.test(M);)++$;return $}return Tg=C,Tg}var Rg,jN;function Pz(){if(jN)return Rg;jN=1;var e=Iz(),t=$z(),n=Oz();function s(a){return t(a)?n(a):e(a)}return Rg=s,Rg}var Ag,CN;function Lz(){if(CN)return Ag;CN=1;var e=h0(),t=oi(),n=as(),s=Mz(),a=Pz(),i="[object Map]",l="[object Set]";function d(f){if(f==null)return 0;if(n(f))return s(f)?a(f):f.length;var p=t(f);return p==i||p==l?f.size:e(f).length}return Ag=d,Ag}var Mg,TN;function Dz(){if(TN)return Mg;TN=1;var e=c0(),t=IR(),n=v0(),s=os(),a=bd(),i=It(),l=ai(),d=Hl(),f=Vn(),p=Yl();function h(g,y,w){var N=i(g),k=N||l(g)||p(g);if(y=s(y,4),w==null){var E=g&&g.constructor;k?w=N?new E:[]:f(g)?w=d(E)?t(a(g)):{}:w={}}return(k?e:n)(g,function(_,S,j){return y(w,_,S,j)}),w}return Mg=h,Mg}var Ig,RN;function qz(){if(RN)return Ig;RN=1;var e=si(),t=Vl(),n=It(),s=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(s&&i&&i[s])}return Ig=a,Ig}var $g,AN;function b0(){if(AN)return $g;AN=1;var e=p0(),t=qz();function n(s,a,i,l,d){var f=-1,p=s.length;for(i||(i=t),d||(d=[]);++f<p;){var h=s[f];a>0&&i(h)?a>1?n(h,a-1,i,l,d):e(d,h):l||(d[d.length]=h)}return d}return $g=n,$g}var Og,MN;function Fz(){if(MN)return Og;MN=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 Og=e,Og}var Pg,IN;function tA(){if(IN)return Pg;IN=1;var e=Fz(),t=Math.max;function n(s,a,i){return a=t(a===void 0?s.length-1:a,0),function(){for(var l=arguments,d=-1,f=t(l.length-a,0),p=Array(f);++d<f;)p[d]=l[a+d];d=-1;for(var h=Array(a+1);++d<a;)h[d]=l[d];return h[a]=i(p),e(s,this,h)}}return Pg=n,Pg}var Lg,$N;function zz(){if($N)return Lg;$N=1;var e=g0(),t=xR(),n=La(),s=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return Lg=s,Lg}var Dg,ON;function Bz(){if(ON)return Dg;ON=1;var e=800,t=16,n=Date.now;function s(a){var i=0,l=0;return function(){var d=n(),f=t-(d-l);if(l=d,f>0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return Dg=s,Dg}var qg,PN;function nA(){if(PN)return qg;PN=1;var e=zz(),t=Bz(),n=t(e);return qg=n,qg}var Fg,LN;function Ed(){if(LN)return Fg;LN=1;var e=La(),t=tA(),n=nA();function s(a,i){return n(t(a,i,e),a+"")}return Fg=s,Fg}var zg,DN;function rA(){if(DN)return zg;DN=1;function e(t,n,s,a){for(var i=t.length,l=s+(a?1:-1);a?l--:++l<i;)if(n(t[l],l,t))return l;return-1}return zg=e,zg}var Bg,qN;function Uz(){if(qN)return Bg;qN=1;function e(t){return t!==t}return Bg=e,Bg}var Ug,FN;function Wz(){if(FN)return Ug;FN=1;function e(t,n,s){for(var a=s-1,i=t.length;++a<i;)if(t[a]===n)return a;return-1}return Ug=e,Ug}var Wg,zN;function Hz(){if(zN)return Wg;zN=1;var e=rA(),t=Uz(),n=Wz();function s(a,i,l){return i===i?n(a,i,l):e(a,t,l)}return Wg=s,Wg}var Hg,BN;function Gz(){if(BN)return Hg;BN=1;var e=Hz();function t(n,s){var a=n==null?0:n.length;return!!a&&e(n,s,0)>-1}return Hg=t,Hg}var Gg,UN;function Vz(){if(UN)return Gg;UN=1;function e(t,n,s){for(var a=-1,i=t==null?0:t.length;++a<i;)if(s(n,t[a]))return!0;return!1}return Gg=e,Gg}var Vg,WN;function Yz(){if(WN)return Vg;WN=1;function e(){}return Vg=e,Vg}var Yg,HN;function Kz(){if(HN)return Yg;HN=1;var e=RR(),t=Yz(),n=w0(),s=1/0,a=e&&1/n(new e([,-0]))[1]==s?function(i){return new e(i)}:t;return Yg=a,Yg}var Kg,GN;function Xz(){if(GN)return Kg;GN=1;var e=qR(),t=Gz(),n=Vz(),s=FR(),a=Kz(),i=w0(),l=200;function d(f,p,h){var g=-1,y=t,w=f.length,N=!0,k=[],E=k;if(h)N=!1,y=n;else if(w>=l){var _=p?null:a(f);if(_)return i(_);N=!1,y=s,E=new e}else E=p?[]:k;e:for(;++g<w;){var S=f[g],j=p?p(S):S;if(S=h||S!==0?S:0,N&&j===j){for(var C=E.length;C--;)if(E[C]===j)continue e;p&&E.push(j),k.push(S)}else y(E,j,h)||(E!==k&&E.push(j),k.push(S))}return k}return Kg=d,Kg}var Xg,VN;function sA(){if(VN)return Xg;VN=1;var e=as(),t=Tr();function n(s){return t(s)&&e(s)}return Xg=n,Xg}var Qg,YN;function Qz(){if(YN)return Qg;YN=1;var e=b0(),t=Ed(),n=Xz(),s=sA(),a=t(function(i){return n(e(i,1,s,!0))});return Qg=a,Qg}var Zg,KN;function Zz(){if(KN)return Zg;KN=1;var e=_d();function t(n,s){return e(s,function(a){return n[a]})}return Zg=t,Zg}var Jg,XN;function aA(){if(XN)return Jg;XN=1;var e=Zz(),t=zs();function n(s){return s==null?[]:e(s,t(s))}return Jg=n,Jg}var ey,QN;function Yn(){if(QN)return ey;QN=1;var e;if(typeof o0=="function")try{e={clone:az(),constant:g0(),each:DR(),filter:KR(),has:XR(),isArray:It(),isEmpty:Tz(),isFunction:Hl(),isUndefined:QR(),keys:zs(),map:JR(),reduce:eA(),size:Lz(),transform:Dz(),union:Qz(),values:aA()}}catch{}return e||(e=window._),ey=e,ey}var ty,ZN;function k0(){if(ZN)return ty;ZN=1;var e=Yn();ty=a;var t="\0",n="\0",s="";function a(h){this._isDirected=e.has(h,"directed")?h.directed:!0,this._isMultigraph=e.has(h,"multigraph")?h.multigraph:!1,this._isCompound=e.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(h){return this._label=h,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(g){return e.isEmpty(h._in[g])})},a.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(g){return e.isEmpty(h._out[g])})},a.prototype.setNodes=function(h,g){var y=arguments,w=this;return e.each(h,function(N){y.length>1?w.setNode(N,g):w.setNode(N)}),this},a.prototype.setNode=function(h,g){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=g),this):(this._nodes[h]=arguments.length>1?g:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},a.prototype.node=function(h){return this._nodes[h]},a.prototype.hasNode=function(h){return e.has(this._nodes,h)},a.prototype.removeNode=function(h){var g=this;if(e.has(this._nodes,h)){var y=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(w){g.setParent(w)}),delete this._children[h]),e.each(e.keys(this._in[h]),y),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),y),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},a.prototype.setParent=function(h,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=n;else{g+="";for(var y=g;!e.isUndefined(y);y=this.parent(y))if(y===h)throw new Error("Setting "+g+" as parent of "+h+" would create a cycle");this.setNode(g)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=g,this._children[g][h]=!0,this},a.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},a.prototype.parent=function(h){if(this._isCompound){var g=this._parent[h];if(g!==n)return g}},a.prototype.children=function(h){if(e.isUndefined(h)&&(h=n),this._isCompound){var g=this._children[h];if(g)return e.keys(g)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},a.prototype.predecessors=function(h){var g=this._preds[h];if(g)return e.keys(g)},a.prototype.successors=function(h){var g=this._sucs[h];if(g)return e.keys(g)},a.prototype.neighbors=function(h){var g=this.predecessors(h);if(g)return e.union(g,this.successors(h))},a.prototype.isLeaf=function(h){var g;return this.isDirected()?g=this.successors(h):g=this.neighbors(h),g.length===0},a.prototype.filterNodes=function(h){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var y=this;e.each(this._nodes,function(k,E){h(E)&&g.setNode(E,k)}),e.each(this._edgeObjs,function(k){g.hasNode(k.v)&&g.hasNode(k.w)&&g.setEdge(k,y.edge(k))});var w={};function N(k){var E=y.parent(k);return E===void 0||g.hasNode(E)?(w[k]=E,E):E in w?w[E]:N(E)}return this._isCompound&&e.each(g.nodes(),function(k){g.setParent(k,N(k))}),g},a.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(h,g){var y=this,w=arguments;return e.reduce(h,function(N,k){return w.length>1?y.setEdge(N,k,g):y.setEdge(N,k),k}),this},a.prototype.setEdge=function(){var h,g,y,w,N=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(h=k.v,g=k.w,y=k.name,arguments.length===2&&(w=arguments[1],N=!0)):(h=k,g=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),h=""+h,g=""+g,e.isUndefined(y)||(y=""+y);var E=d(this._isDirected,h,g,y);if(e.has(this._edgeLabels,E))return N&&(this._edgeLabels[E]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(g),this._edgeLabels[E]=N?w:this._defaultEdgeLabelFn(h,g,y);var _=f(this._isDirected,h,g,y);return h=_.v,g=_.w,Object.freeze(_),this._edgeObjs[E]=_,i(this._preds[g],h),i(this._sucs[h],g),this._in[g][E]=_,this._out[h][E]=_,this._edgeCount++,this},a.prototype.edge=function(h,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,h,g,y);return this._edgeLabels[w]},a.prototype.hasEdge=function(h,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,h,g,y);return e.has(this._edgeLabels,w)},a.prototype.removeEdge=function(h,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,h,g,y),N=this._edgeObjs[w];return N&&(h=N.v,g=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],l(this._preds[g],h),l(this._sucs[h],g),delete this._in[g][w],delete this._out[h][w],this._edgeCount--),this},a.prototype.inEdges=function(h,g){var y=this._in[h];if(y){var w=e.values(y);return g?e.filter(w,function(N){return N.v===g}):w}},a.prototype.outEdges=function(h,g){var y=this._out[h];if(y){var w=e.values(y);return g?e.filter(w,function(N){return N.w===g}):w}},a.prototype.nodeEdges=function(h,g){var y=this.inEdges(h,g);if(y)return y.concat(this.outEdges(h,g))};function i(h,g){h[g]?h[g]++:h[g]=1}function l(h,g){--h[g]||delete h[g]}function d(h,g,y,w){var N=""+g,k=""+y;if(!h&&N>k){var E=N;N=k,k=E}return N+s+k+s+(e.isUndefined(w)?t:w)}function f(h,g,y,w){var N=""+g,k=""+y;if(!h&&N>k){var E=N;N=k,k=E}var _={v:N,w:k};return w&&(_.name=w),_}function p(h,g){return d(h,g.v,g.w,g.name)}return ty}var ny,JN;function Jz(){return JN||(JN=1,ny="2.1.8"),ny}var ry,eE;function eB(){return eE||(eE=1,ry={Graph:k0(),version:Jz()}),ry}var sy,tE;function tB(){if(tE)return sy;tE=1;var e=Yn(),t=k0();sy={write:n,read:i};function n(l){var d={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:s(l),edges:a(l)};return e.isUndefined(l.graph())||(d.value=e.clone(l.graph())),d}function s(l){return e.map(l.nodes(),function(d){var f=l.node(d),p=l.parent(d),h={v:d};return e.isUndefined(f)||(h.value=f),e.isUndefined(p)||(h.parent=p),h})}function a(l){return e.map(l.edges(),function(d){var f=l.edge(d),p={v:d.v,w:d.w};return e.isUndefined(d.name)||(p.name=d.name),e.isUndefined(f)||(p.value=f),p})}function i(l){var d=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(f){d.setNode(f.v,f.value),f.parent&&d.setParent(f.v,f.parent)}),e.each(l.edges,function(f){d.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),d}return sy}var ay,nE;function nB(){if(nE)return ay;nE=1;var e=Yn();ay=t;function t(n){var s={},a=[],i;function l(d){e.has(s,d)||(s[d]=!0,i.push(d),e.each(n.successors(d),l),e.each(n.predecessors(d),l))}return e.each(n.nodes(),function(d){i=[],l(d),i.length&&a.push(i)}),a}return ay}var oy,rE;function oA(){if(rE)return oy;rE=1;var e=Yn();oy=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var s=this._keyIndices[n];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,s){var a=this._keyIndices;if(n=String(n),!e.has(a,n)){var i=this._arr,l=i.length;return a[n]=l,i.push({key:n,priority:s}),this._decrease(l),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,s){var a=this._keyIndices[n];if(s>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+s);this._arr[a].priority=s,this._decrease(a)},t.prototype._heapify=function(n){var s=this._arr,a=2*n,i=a+1,l=n;a<s.length&&(l=s[a].priority<s[l].priority?a:l,i<s.length&&(l=s[i].priority<s[l].priority?i:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var s=this._arr,a=s[n].priority,i;n!==0&&(i=n>>1,!(s[i].priority<a));)this._swap(n,i),n=i},t.prototype._swap=function(n,s){var a=this._arr,i=this._keyIndices,l=a[n],d=a[s];a[n]=d,a[s]=l,i[d.key]=n,i[l.key]=s},oy}var iy,sE;function iA(){if(sE)return iy;sE=1;var e=Yn(),t=oA();iy=s;var n=e.constant(1);function s(i,l,d,f){return a(i,String(l),d||n,f||function(p){return i.outEdges(p)})}function a(i,l,d,f){var p={},h=new t,g,y,w=function(N){var k=N.v!==g?N.v:N.w,E=p[k],_=d(N),S=y.distance+_;if(_<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+_);S<E.distance&&(E.distance=S,E.predecessor=g,h.decrease(k,S))};for(i.nodes().forEach(function(N){var k=N===l?0:Number.POSITIVE_INFINITY;p[N]={distance:k},h.add(N,k)});h.size()>0&&(g=h.removeMin(),y=p[g],y.distance!==Number.POSITIVE_INFINITY);)f(g).forEach(w);return p}return iy}var ly,aE;function rB(){if(aE)return ly;aE=1;var e=iA(),t=Yn();ly=n;function n(s,a,i){return t.transform(s.nodes(),function(l,d){l[d]=e(s,d,a,i)},{})}return ly}var cy,oE;function lA(){if(oE)return cy;oE=1;var e=Yn();cy=t;function t(n){var s=0,a=[],i={},l=[];function d(f){var p=i[f]={onStack:!0,lowlink:s,index:s++};if(a.push(f),n.successors(f).forEach(function(y){e.has(i,y)?i[y].onStack&&(p.lowlink=Math.min(p.lowlink,i[y].index)):(d(y),p.lowlink=Math.min(p.lowlink,i[y].lowlink))}),p.lowlink===p.index){var h=[],g;do g=a.pop(),i[g].onStack=!1,h.push(g);while(f!==g);l.push(h)}}return n.nodes().forEach(function(f){e.has(i,f)||d(f)}),l}return cy}var uy,iE;function sB(){if(iE)return uy;iE=1;var e=Yn(),t=lA();uy=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 uy}var dy,lE;function aB(){if(lE)return dy;lE=1;var e=Yn();dy=n;var t=e.constant(1);function n(a,i,l){return s(a,i||t,l||function(d){return a.outEdges(d)})}function s(a,i,l){var d={},f=a.nodes();return f.forEach(function(p){d[p]={},d[p][p]={distance:0},f.forEach(function(h){p!==h&&(d[p][h]={distance:Number.POSITIVE_INFINITY})}),l(p).forEach(function(h){var g=h.v===p?h.w:h.v,y=i(h);d[p][g]={distance:y,predecessor:p}})}),f.forEach(function(p){var h=d[p];f.forEach(function(g){var y=d[g];f.forEach(function(w){var N=y[p],k=h[w],E=y[w],_=N.distance+k.distance;_<E.distance&&(E.distance=_,E.predecessor=k.predecessor)})})}),d}return dy}var hy,cE;function cA(){if(cE)return hy;cE=1;var e=Yn();hy=t,t.CycleException=n;function t(s){var a={},i={},l=[];function d(f){if(e.has(i,f))throw new n;e.has(a,f)||(i[f]=!0,a[f]=!0,e.each(s.predecessors(f),d),delete i[f],l.push(f))}if(e.each(s.sinks(),d),e.size(a)!==s.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,hy}var fy,uE;function oB(){if(uE)return fy;uE=1;var e=cA();fy=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return fy}var py,dE;function uA(){if(dE)return py;dE=1;var e=Yn();py=t;function t(s,a,i){e.isArray(a)||(a=[a]);var l=(s.isDirected()?s.successors:s.neighbors).bind(s),d=[],f={};return e.each(a,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,i==="post",f,l,d)}),d}function n(s,a,i,l,d,f){e.has(l,a)||(l[a]=!0,i||f.push(a),e.each(d(a),function(p){n(s,p,i,l,d,f)}),i&&f.push(a))}return py}var my,hE;function iB(){if(hE)return my;hE=1;var e=uA();my=t;function t(n,s){return e(n,s,"post")}return my}var gy,fE;function lB(){if(fE)return gy;fE=1;var e=uA();gy=t;function t(n,s){return e(n,s,"pre")}return gy}var yy,pE;function cB(){if(pE)return yy;pE=1;var e=Yn(),t=k0(),n=oA();yy=s;function s(a,i){var l=new t,d={},f=new n,p;function h(y){var w=y.v===p?y.w:y.v,N=f.priority(w);if(N!==void 0){var k=i(y);k<N&&(d[w]=p,f.decrease(w,k))}}if(a.nodeCount()===0)return l;e.each(a.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),l.setNode(y)}),f.decrease(a.nodes()[0],0);for(var g=!1;f.size()>0;){if(p=f.removeMin(),e.has(d,p))l.setEdge(p,d[p]);else{if(g)throw new Error("Input graph is not connected: "+a);g=!0}a.nodeEdges(p).forEach(h)}return l}return yy}var vy,mE;function uB(){return mE||(mE=1,vy={components:nB(),dijkstra:iA(),dijkstraAll:rB(),findCycles:sB(),floydWarshall:aB(),isAcyclic:oB(),postorder:iB(),preorder:lB(),prim:cB(),tarjan:lA(),topsort:cA()}),vy}var wy,gE;function dB(){if(gE)return wy;gE=1;var e=eB();return wy={Graph:e.Graph,json:tB(),alg:uB(),version:e.version},wy}var xy,yE;function hr(){if(yE)return xy;yE=1;var e;if(typeof o0=="function")try{e=dB()}catch{}return e||(e=window.graphlib),xy=e,xy}var by,vE;function hB(){if(vE)return by;vE=1;var e=OR(),t=1,n=4;function s(a){return e(a,t|n)}return by=s,by}var ky,wE;function jd(){if(wE)return ky;wE=1;var e=ri(),t=as(),n=vd(),s=Vn();function a(i,l,d){if(!s(d))return!1;var f=typeof l;return(f=="number"?t(d)&&n(l,d.length):f=="string"&&l in d)?e(d[l],i):!1}return ky=a,ky}var _y,xE;function fB(){if(xE)return _y;xE=1;var e=Ed(),t=ri(),n=jd(),s=Pa(),a=Object.prototype,i=a.hasOwnProperty,l=e(function(d,f){d=Object(d);var p=-1,h=f.length,g=h>2?f[2]:void 0;for(g&&n(f[0],f[1],g)&&(h=1);++p<h;)for(var y=f[p],w=s(y),N=-1,k=w.length;++N<k;){var E=w[N],_=d[E];(_===void 0||t(_,a[E])&&!i.call(d,E))&&(d[E]=y[E])}return d});return _y=l,_y}var Sy,bE;function pB(){if(bE)return Sy;bE=1;var e=os(),t=as(),n=zs();function s(a){return function(i,l,d){var f=Object(i);if(!t(i)){var p=e(l,3);i=n(i),l=function(g){return p(f[g],g,f)}}var h=a(i,l,d);return h>-1?f[p?i[h]:h]:void 0}}return Sy=s,Sy}var Ny,kE;function mB(){if(kE)return Ny;kE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return Ny=t,Ny}var Ey,_E;function gB(){if(_E)return Ey;_E=1;var e=mB(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return Ey=n,Ey}var jy,SE;function yB(){if(SE)return jy;SE=1;var e=gB(),t=Vn(),n=ii(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,l=/^0o[0-7]+$/i,d=parseInt;function f(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var h=typeof p.valueOf=="function"?p.valueOf():p;p=t(h)?h+"":h}if(typeof p!="string")return p===0?p:+p;p=e(p);var g=i.test(p);return g||l.test(p)?d(p.slice(2),g?2:8):a.test(p)?s:+p}return jy=f,jy}var Cy,NE;function dA(){if(NE)return Cy;NE=1;var e=yB(),t=1/0,n=17976931348623157e292;function s(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var i=a<0?-1:1;return i*n}return a===a?a:0}return Cy=s,Cy}var Ty,EE;function vB(){if(EE)return Ty;EE=1;var e=dA();function t(n){var s=e(n),a=s%1;return s===s?a?s-a:s:0}return Ty=t,Ty}var Ry,jE;function wB(){if(jE)return Ry;jE=1;var e=rA(),t=os(),n=vB(),s=Math.max;function a(i,l,d){var f=i==null?0:i.length;if(!f)return-1;var p=d==null?0:n(d);return p<0&&(p=s(f+p,0)),e(i,t(l,3),p)}return Ry=a,Ry}var Ay,CE;function xB(){if(CE)return Ay;CE=1;var e=pB(),t=wB(),n=e(t);return Ay=n,Ay}var My,TE;function hA(){if(TE)return My;TE=1;var e=b0();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return My=t,My}var Iy,RE;function bB(){if(RE)return Iy;RE=1;var e=y0(),t=PR(),n=Pa();function s(a,i){return a==null?a:e(a,t(i),n)}return Iy=s,Iy}var $y,AE;function kB(){if(AE)return $y;AE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return $y=e,$y}var Oy,ME;function _B(){if(ME)return Oy;ME=1;var e=gd(),t=v0(),n=os();function s(a,i){var l={};return i=n(i,3),t(a,function(d,f,p){e(l,f,i(d,f,p))}),l}return Oy=s,Oy}var Py,IE;function _0(){if(IE)return Py;IE=1;var e=ii();function t(n,s,a){for(var i=-1,l=n.length;++i<l;){var d=n[i],f=s(d);if(f!=null&&(p===void 0?f===f&&!e(f):a(f,p)))var p=f,h=d}return h}return Py=t,Py}var Ly,$E;function SB(){if($E)return Ly;$E=1;function e(t,n){return t>n}return Ly=e,Ly}var Dy,OE;function NB(){if(OE)return Dy;OE=1;var e=_0(),t=SB(),n=La();function s(a){return a&&a.length?e(a,n,t):void 0}return Dy=s,Dy}var qy,PE;function fA(){if(PE)return qy;PE=1;var e=gd(),t=ri();function n(s,a,i){(i!==void 0&&!t(s[a],i)||i===void 0&&!(a in s))&&e(s,a,i)}return qy=n,qy}var Fy,LE;function EB(){if(LE)return Fy;LE=1;var e=$a(),t=bd(),n=Tr(),s="[object Object]",a=Function.prototype,i=Object.prototype,l=a.toString,d=i.hasOwnProperty,f=l.call(Object);function p(h){if(!n(h)||e(h)!=s)return!1;var g=t(h);if(g===null)return!0;var y=d.call(g,"constructor")&&g.constructor;return typeof y=="function"&&y instanceof y&&l.call(y)==f}return Fy=p,Fy}var zy,DE;function pA(){if(DE)return zy;DE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return zy=e,zy}var By,qE;function jB(){if(qE)return By;qE=1;var e=Gl(),t=Pa();function n(s){return e(s,t(s))}return By=n,By}var Uy,FE;function CB(){if(FE)return Uy;FE=1;var e=fA(),t=_R(),n=MR(),s=SR(),a=$R(),i=Vl(),l=It(),d=sA(),f=ai(),p=Hl(),h=Vn(),g=EB(),y=Yl(),w=pA(),N=jB();function k(E,_,S,j,C,M,$){var I=w(E,S),z=w(_,S),O=$.get(z);if(O){e(E,S,O);return}var A=M?M(I,z,S+"",E,_,$):void 0,D=A===void 0;if(D){var H=l(z),X=!H&&f(z),R=!H&&!X&&y(z);A=z,H||X||R?l(I)?A=I:d(I)?A=s(I):X?(D=!1,A=t(z,!0)):R?(D=!1,A=n(z,!0)):A=[]:g(z)||i(z)?(A=I,i(I)?A=N(I):(!h(I)||p(I))&&(A=a(z))):D=!1}D&&($.set(z,A),C(A,z,j,M,$),$.delete(z)),e(E,S,A)}return Uy=k,Uy}var Wy,zE;function TB(){if(zE)return Wy;zE=1;var e=md(),t=fA(),n=y0(),s=CB(),a=Vn(),i=Pa(),l=pA();function d(f,p,h,g,y){f!==p&&n(p,function(w,N){if(y||(y=new e),a(w))s(f,p,N,h,d,g,y);else{var k=g?g(l(f,N),w,N+"",f,p,y):void 0;k===void 0&&(k=w),t(f,N,k)}},i)}return Wy=d,Wy}var Hy,BE;function RB(){if(BE)return Hy;BE=1;var e=Ed(),t=jd();function n(s){return e(function(a,i){var l=-1,d=i.length,f=d>1?i[d-1]:void 0,p=d>2?i[2]:void 0;for(f=s.length>3&&typeof f=="function"?(d--,f):void 0,p&&t(i[0],i[1],p)&&(f=d<3?void 0:f,d=1),a=Object(a);++l<d;){var h=i[l];h&&s(a,h,l,f)}return a})}return Hy=n,Hy}var Gy,UE;function AB(){if(UE)return Gy;UE=1;var e=TB(),t=RB(),n=t(function(s,a,i){e(s,a,i)});return Gy=n,Gy}var Vy,WE;function mA(){if(WE)return Vy;WE=1;function e(t,n){return t<n}return Vy=e,Vy}var Yy,HE;function MB(){if(HE)return Yy;HE=1;var e=_0(),t=mA(),n=La();function s(a){return a&&a.length?e(a,n,t):void 0}return Yy=s,Yy}var Ky,GE;function IB(){if(GE)return Ky;GE=1;var e=_0(),t=os(),n=mA();function s(a,i){return a&&a.length?e(a,t(i,2),n):void 0}return Ky=s,Ky}var Xy,VE;function $B(){if(VE)return Xy;VE=1;var e=pr(),t=function(){return e.Date.now()};return Xy=t,Xy}var Qy,YE;function OB(){if(YE)return Qy;YE=1;var e=yd(),t=Sd(),n=vd(),s=Vn(),a=Kl();function i(l,d,f,p){if(!s(l))return l;d=t(d,l);for(var h=-1,g=d.length,y=g-1,w=l;w!=null&&++h<g;){var N=a(d[h]),k=f;if(N==="__proto__"||N==="constructor"||N==="prototype")return l;if(h!=y){var E=w[N];k=p?p(E,N,w):void 0,k===void 0&&(k=s(E)?E:n(d[h+1])?[]:{})}e(w,N,k),w=w[N]}return l}return Qy=i,Qy}var Zy,KE;function PB(){if(KE)return Zy;KE=1;var e=Nd(),t=OB(),n=Sd();function s(a,i,l){for(var d=-1,f=i.length,p={};++d<f;){var h=i[d],g=e(a,h);l(g,h)&&t(p,n(h,a),g)}return p}return Zy=s,Zy}var Jy,XE;function LB(){if(XE)return Jy;XE=1;var e=PB(),t=VR();function n(s,a){return e(s,a,function(i,l){return t(s,l)})}return Jy=n,Jy}var ev,QE;function DB(){if(QE)return ev;QE=1;var e=hA(),t=tA(),n=nA();function s(a){return n(t(a,void 0,e),a+"")}return ev=s,ev}var tv,ZE;function qB(){if(ZE)return tv;ZE=1;var e=LB(),t=DB(),n=t(function(s,a){return s==null?{}:e(s,a)});return tv=n,tv}var nv,JE;function FB(){if(JE)return nv;JE=1;var e=Math.ceil,t=Math.max;function n(s,a,i,l){for(var d=-1,f=t(e((a-s)/(i||1)),0),p=Array(f);f--;)p[l?f:++d]=s,s+=i;return p}return nv=n,nv}var rv,ej;function zB(){if(ej)return rv;ej=1;var e=FB(),t=jd(),n=dA();function s(a){return function(i,l,d){return d&&typeof d!="number"&&t(i,l,d)&&(l=d=void 0),i=n(i),l===void 0?(l=i,i=0):l=n(l),d=d===void 0?i<l?1:-1:n(d),e(i,l,d,a)}}return rv=s,rv}var sv,tj;function BB(){if(tj)return sv;tj=1;var e=zB(),t=e();return sv=t,sv}var av,nj;function UB(){if(nj)return av;nj=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return av=e,av}var ov,rj;function WB(){if(rj)return ov;rj=1;var e=ii();function t(n,s){if(n!==s){var a=n!==void 0,i=n===null,l=n===n,d=e(n),f=s!==void 0,p=s===null,h=s===s,g=e(s);if(!p&&!g&&!d&&n>s||d&&f&&h&&!p&&!g||i&&f&&h||!a&&h||!l)return 1;if(!i&&!d&&!g&&n<s||g&&a&&l&&!i&&!d||p&&a&&l||!f&&l||!h)return-1}return 0}return ov=t,ov}var iv,sj;function HB(){if(sj)return iv;sj=1;var e=WB();function t(n,s,a){for(var i=-1,l=n.criteria,d=s.criteria,f=l.length,p=a.length;++i<f;){var h=e(l[i],d[i]);if(h){if(i>=p)return h;var g=a[i];return h*(g=="desc"?-1:1)}}return n.index-s.index}return iv=t,iv}var lv,aj;function GB(){if(aj)return lv;aj=1;var e=_d(),t=Nd(),n=os(),s=ZR(),a=UB(),i=wd(),l=HB(),d=La(),f=It();function p(h,g,y){g.length?g=e(g,function(k){return f(k)?function(E){return t(E,k.length===1?k[0]:k)}:k}):g=[d];var w=-1;g=e(g,i(n));var N=s(h,function(k,E,_){var S=e(g,function(j){return j(k)});return{criteria:S,index:++w,value:k}});return a(N,function(k,E){return l(k,E,y)})}return lv=p,lv}var cv,oj;function VB(){if(oj)return cv;oj=1;var e=b0(),t=GB(),n=Ed(),s=jd(),a=n(function(i,l){if(i==null)return[];var d=l.length;return d>1&&s(i,l[0],l[1])?l=[]:d>2&&s(l[0],l[1],l[2])&&(l=[l[0]]),t(i,e(l,1),[])});return cv=a,cv}var uv,ij;function YB(){if(ij)return uv;ij=1;var e=HR(),t=0;function n(s){var a=++t;return e(s)+a}return uv=n,uv}var dv,lj;function KB(){if(lj)return dv;lj=1;function e(t,n,s){for(var a=-1,i=t.length,l=n.length,d={};++a<i;){var f=a<l?n[a]:void 0;s(d,t[a],f)}return d}return dv=e,dv}var hv,cj;function XB(){if(cj)return hv;cj=1;var e=yd(),t=KB();function n(s,a){return t(s||[],a||[],e)}return hv=n,hv}var fv,uj;function yt(){if(uj)return fv;uj=1;var e;if(typeof o0=="function")try{e={cloneDeep:hB(),constant:g0(),defaults:fB(),each:DR(),filter:KR(),find:xB(),flatten:hA(),forEach:LR(),forIn:bB(),has:XR(),isUndefined:QR(),last:kB(),map:JR(),mapValues:_B(),max:NB(),merge:AB(),min:MB(),minBy:IB(),now:$B(),pick:qB(),range:BB(),reduce:eA(),sortBy:VB(),uniqueId:YB(),values:aA(),zipObject:XB()}}catch{}return e||(e=window._),fv=e,fv}var pv,dj;function QB(){if(dj)return pv;dj=1,pv=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,a=s._prev;if(a!==s)return t(a),a},e.prototype.enqueue=function(s){var a=this._sentinel;s._prev&&s._next&&t(s),s._next=a._next,a._next._prev=s,a._next=s,s._prev=a},e.prototype.toString=function(){for(var s=[],a=this._sentinel,i=a._prev;i!==a;)s.push(JSON.stringify(i,n)),i=i._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function n(s,a){if(s!=="_next"&&s!=="_prev")return a}return pv}var mv,hj;function ZB(){if(hj)return mv;hj=1;var e=yt(),t=hr().Graph,n=QB();mv=a;var s=e.constant(1);function a(p,h){if(p.nodeCount()<=1)return[];var g=d(p,h||s),y=i(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function i(p,h,g){for(var y=[],w=h[h.length-1],N=h[0],k;p.nodeCount();){for(;k=N.dequeue();)l(p,h,g,k);for(;k=w.dequeue();)l(p,h,g,k);if(p.nodeCount()){for(var E=h.length-2;E>0;--E)if(k=h[E].dequeue(),k){y=y.concat(l(p,h,g,k,!0));break}}}return y}function l(p,h,g,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(k){var E=p.edge(k),_=p.node(k.v);w&&N.push({v:k.v,w:k.w}),_.out-=E,f(h,g,_)}),e.forEach(p.outEdges(y.v),function(k){var E=p.edge(k),_=k.w,S=p.node(_);S.in-=E,f(h,g,S)}),p.removeNode(y.v),N}function d(p,h){var g=new t,y=0,w=0;e.forEach(p.nodes(),function(E){g.setNode(E,{v:E,in:0,out:0})}),e.forEach(p.edges(),function(E){var _=g.edge(E.v,E.w)||0,S=h(E),j=_+S;g.setEdge(E.v,E.w,j),w=Math.max(w,g.node(E.v).out+=S),y=Math.max(y,g.node(E.w).in+=S)});var N=e.range(w+y+3).map(function(){return new n}),k=y+1;return e.forEach(g.nodes(),function(E){f(N,k,g.node(E))}),{graph:g,buckets:N,zeroIdx:k}}function f(p,h,g){g.out?g.in?p[g.out-g.in+h].enqueue(g):p[p.length-1].enqueue(g):p[0].enqueue(g)}return mv}var gv,fj;function JB(){if(fj)return gv;fj=1;var e=yt(),t=ZB();gv={run:n,undo:a};function n(i){var l=i.graph().acyclicer==="greedy"?t(i,d(i)):s(i);e.forEach(l,function(f){var p=i.edge(f);i.removeEdge(f),p.forwardName=f.name,p.reversed=!0,i.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function d(f){return function(p){return f.edge(p).weight}}}function s(i){var l=[],d={},f={};function p(h){e.has(f,h)||(f[h]=!0,d[h]=!0,e.forEach(i.outEdges(h),function(g){e.has(d,g.w)?l.push(g):p(g.w)}),delete d[h])}return e.forEach(i.nodes(),p),l}function a(i){e.forEach(i.edges(),function(l){var d=i.edge(l);if(d.reversed){i.removeEdge(l);var f=d.forwardName;delete d.reversed,delete d.forwardName,i.setEdge(l.w,l.v,d,f)}})}return gv}var yv,pj;function vn(){if(pj)return yv;pj=1;var e=yt(),t=hr().Graph;yv={addDummyNode:n,simplify:s,asNonCompoundGraph:a,successorWeights:i,predecessorWeights:l,intersectRect:d,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:g,maxRank:y,partition:w,time:N,notime:k};function n(E,_,S,j){var C;do C=e.uniqueId(j);while(E.hasNode(C));return S.dummy=_,E.setNode(C,S),C}function s(E){var _=new t().setGraph(E.graph());return e.forEach(E.nodes(),function(S){_.setNode(S,E.node(S))}),e.forEach(E.edges(),function(S){var j=_.edge(S.v,S.w)||{weight:0,minlen:1},C=E.edge(S);_.setEdge(S.v,S.w,{weight:j.weight+C.weight,minlen:Math.max(j.minlen,C.minlen)})}),_}function a(E){var _=new t({multigraph:E.isMultigraph()}).setGraph(E.graph());return e.forEach(E.nodes(),function(S){E.children(S).length||_.setNode(S,E.node(S))}),e.forEach(E.edges(),function(S){_.setEdge(S,E.edge(S))}),_}function i(E){var _=e.map(E.nodes(),function(S){var j={};return e.forEach(E.outEdges(S),function(C){j[C.w]=(j[C.w]||0)+E.edge(C).weight}),j});return e.zipObject(E.nodes(),_)}function l(E){var _=e.map(E.nodes(),function(S){var j={};return e.forEach(E.inEdges(S),function(C){j[C.v]=(j[C.v]||0)+E.edge(C).weight}),j});return e.zipObject(E.nodes(),_)}function d(E,_){var S=E.x,j=E.y,C=_.x-S,M=_.y-j,$=E.width/2,I=E.height/2;if(!C&&!M)throw new Error("Not possible to find intersection inside of the rectangle");var z,O;return Math.abs(M)*$>Math.abs(C)*I?(M<0&&(I=-I),z=I*C/M,O=I):(C<0&&($=-$),z=$,O=$*M/C),{x:S+z,y:j+O}}function f(E){var _=e.map(e.range(y(E)+1),function(){return[]});return e.forEach(E.nodes(),function(S){var j=E.node(S),C=j.rank;e.isUndefined(C)||(_[C][j.order]=S)}),_}function p(E){var _=e.min(e.map(E.nodes(),function(S){return E.node(S).rank}));e.forEach(E.nodes(),function(S){var j=E.node(S);e.has(j,"rank")&&(j.rank-=_)})}function h(E){var _=e.min(e.map(E.nodes(),function(M){return E.node(M).rank})),S=[];e.forEach(E.nodes(),function(M){var $=E.node(M).rank-_;S[$]||(S[$]=[]),S[$].push(M)});var j=0,C=E.graph().nodeRankFactor;e.forEach(S,function(M,$){e.isUndefined(M)&&$%C!==0?--j:j&&e.forEach(M,function(I){E.node(I).rank+=j})})}function g(E,_,S,j){var C={width:0,height:0};return arguments.length>=4&&(C.rank=S,C.order=j),n(E,"border",C,_)}function y(E){return e.max(e.map(E.nodes(),function(_){var S=E.node(_).rank;if(!e.isUndefined(S))return S}))}function w(E,_){var S={lhs:[],rhs:[]};return e.forEach(E,function(j){_(j)?S.lhs.push(j):S.rhs.push(j)}),S}function N(E,_){var S=e.now();try{return _()}finally{console.log(E+" time: "+(e.now()-S)+"ms")}}function k(E,_){return _()}return yv}var vv,mj;function e8(){if(mj)return vv;mj=1;var e=yt(),t=vn();vv={run:n,undo:a};function n(i){i.graph().dummyChains=[],e.forEach(i.edges(),function(l){s(i,l)})}function s(i,l){var d=l.v,f=i.node(d).rank,p=l.w,h=i.node(p).rank,g=l.name,y=i.edge(l),w=y.labelRank;if(h!==f+1){i.removeEdge(l);var N,k,E;for(E=0,++f;f<h;++E,++f)y.points=[],k={width:0,height:0,edgeLabel:y,edgeObj:l,rank:f},N=t.addDummyNode(i,"edge",k,"_d"),f===w&&(k.width=y.width,k.height=y.height,k.dummy="edge-label",k.labelpos=y.labelpos),i.setEdge(d,N,{weight:y.weight},g),E===0&&i.graph().dummyChains.push(N),d=N;i.setEdge(d,p,{weight:y.weight},g)}}function a(i){e.forEach(i.graph().dummyChains,function(l){var d=i.node(l),f=d.edgeLabel,p;for(i.setEdge(d.edgeObj,f);d.dummy;)p=i.successors(l)[0],i.removeNode(l),f.points.push({x:d.x,y:d.y}),d.dummy==="edge-label"&&(f.x=d.x,f.y=d.y,f.width=d.width,f.height=d.height),l=p,d=i.node(l)})}return vv}var wv,gj;function Xu(){if(gj)return wv;gj=1;var e=yt();wv={longestPath:t,slack:n};function t(s){var a={};function i(l){var d=s.node(l);if(e.has(a,l))return d.rank;a[l]=!0;var f=e.min(e.map(s.outEdges(l),function(p){return i(p.w)-s.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),d.rank=f}e.forEach(s.sources(),i)}function n(s,a){return s.node(a.w).rank-s.node(a.v).rank-s.edge(a).minlen}return wv}var xv,yj;function gA(){if(yj)return xv;yj=1;var e=yt(),t=hr().Graph,n=Xu().slack;xv=s;function s(d){var f=new t({directed:!1}),p=d.nodes()[0],h=d.nodeCount();f.setNode(p,{});for(var g,y;a(f,d)<h;)g=i(f,d),y=f.hasNode(g.v)?n(d,g):-n(d,g),l(f,d,y);return f}function a(d,f){function p(h){e.forEach(f.nodeEdges(h),function(g){var y=g.v,w=h===y?g.w:y;!d.hasNode(w)&&!n(f,g)&&(d.setNode(w,{}),d.setEdge(h,w,{}),p(w))})}return e.forEach(d.nodes(),p),d.nodeCount()}function i(d,f){return e.minBy(f.edges(),function(p){if(d.hasNode(p.v)!==d.hasNode(p.w))return n(f,p)})}function l(d,f,p){e.forEach(d.nodes(),function(h){f.node(h).rank+=p})}return xv}var bv,vj;function t8(){if(vj)return bv;vj=1;var e=yt(),t=gA(),n=Xu().slack,s=Xu().longestPath,a=hr().alg.preorder,i=hr().alg.postorder,l=vn().simplify;bv=d,d.initLowLimValues=g,d.initCutValues=f,d.calcCutValue=h,d.leaveEdge=w,d.enterEdge=N,d.exchangeEdges=k;function d(j){j=l(j),s(j);var C=t(j);g(C),f(C,j);for(var M,$;M=w(C);)$=N(C,j,M),k(C,j,M,$)}function f(j,C){var M=i(j,j.nodes());M=M.slice(0,M.length-1),e.forEach(M,function($){p(j,C,$)})}function p(j,C,M){var $=j.node(M),I=$.parent;j.edge(M,I).cutvalue=h(j,C,M)}function h(j,C,M){var $=j.node(M),I=$.parent,z=!0,O=C.edge(M,I),A=0;return O||(z=!1,O=C.edge(I,M)),A=O.weight,e.forEach(C.nodeEdges(M),function(D){var H=D.v===M,X=H?D.w:D.v;if(X!==I){var R=H===z,Z=C.edge(D).weight;if(A+=R?Z:-Z,_(j,M,X)){var B=j.edge(M,X).cutvalue;A+=R?-B:B}}}),A}function g(j,C){arguments.length<2&&(C=j.nodes()[0]),y(j,{},1,C)}function y(j,C,M,$,I){var z=M,O=j.node($);return C[$]=!0,e.forEach(j.neighbors($),function(A){e.has(C,A)||(M=y(j,C,M,A,$))}),O.low=z,O.lim=M++,I?O.parent=I:delete O.parent,M}function w(j){return e.find(j.edges(),function(C){return j.edge(C).cutvalue<0})}function N(j,C,M){var $=M.v,I=M.w;C.hasEdge($,I)||($=M.w,I=M.v);var z=j.node($),O=j.node(I),A=z,D=!1;z.lim>O.lim&&(A=O,D=!0);var H=e.filter(C.edges(),function(X){return D===S(j,j.node(X.v),A)&&D!==S(j,j.node(X.w),A)});return e.minBy(H,function(X){return n(C,X)})}function k(j,C,M,$){var I=M.v,z=M.w;j.removeEdge(I,z),j.setEdge($.v,$.w,{}),g(j),f(j,C),E(j,C)}function E(j,C){var M=e.find(j.nodes(),function(I){return!C.node(I).parent}),$=a(j,M);$=$.slice(1),e.forEach($,function(I){var z=j.node(I).parent,O=C.edge(I,z),A=!1;O||(O=C.edge(z,I),A=!0),C.node(I).rank=C.node(z).rank+(A?O.minlen:-O.minlen)})}function _(j,C,M){return j.hasEdge(C,M)}function S(j,C,M){return M.low<=C.lim&&C.lim<=M.lim}return bv}var kv,wj;function n8(){if(wj)return kv;wj=1;var e=Xu(),t=e.longestPath,n=gA(),s=t8();kv=a;function a(f){switch(f.graph().ranker){case"network-simplex":d(f);break;case"tight-tree":l(f);break;case"longest-path":i(f);break;default:d(f)}}var i=t;function l(f){t(f),n(f)}function d(f){s(f)}return kv}var _v,xj;function r8(){if(xj)return _v;xj=1;var e=yt();_v=t;function t(a){var i=s(a);e.forEach(a.graph().dummyChains,function(l){for(var d=a.node(l),f=d.edgeObj,p=n(a,i,f.v,f.w),h=p.path,g=p.lca,y=0,w=h[y],N=!0;l!==f.w;){if(d=a.node(l),N){for(;(w=h[y])!==g&&a.node(w).maxRank<d.rank;)y++;w===g&&(N=!1)}if(!N){for(;y<h.length-1&&a.node(w=h[y+1]).minRank<=d.rank;)y++;w=h[y]}a.setParent(l,w),l=a.successors(l)[0]}})}function n(a,i,l,d){var f=[],p=[],h=Math.min(i[l].low,i[d].low),g=Math.max(i[l].lim,i[d].lim),y,w;y=l;do y=a.parent(y),f.push(y);while(y&&(i[y].low>h||g>i[y].lim));for(w=y,y=d;(y=a.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function s(a){var i={},l=0;function d(f){var p=l;e.forEach(a.children(f),d),i[f]={low:p,lim:l++}}return e.forEach(a.children(),d),i}return _v}var Sv,bj;function s8(){if(bj)return Sv;bj=1;var e=yt(),t=vn();Sv={run:n,cleanup:l};function n(d){var f=t.addDummyNode(d,"root",{},"_root"),p=a(d),h=e.max(e.values(p))-1,g=2*h+1;d.graph().nestingRoot=f,e.forEach(d.edges(),function(w){d.edge(w).minlen*=g});var y=i(d)+1;e.forEach(d.children(),function(w){s(d,f,g,y,h,p,w)}),d.graph().nodeRankFactor=g}function s(d,f,p,h,g,y,w){var N=d.children(w);if(!N.length){w!==f&&d.setEdge(f,w,{weight:0,minlen:p});return}var k=t.addBorderNode(d,"_bt"),E=t.addBorderNode(d,"_bb"),_=d.node(w);d.setParent(k,w),_.borderTop=k,d.setParent(E,w),_.borderBottom=E,e.forEach(N,function(S){s(d,f,p,h,g,y,S);var j=d.node(S),C=j.borderTop?j.borderTop:S,M=j.borderBottom?j.borderBottom:S,$=j.borderTop?h:2*h,I=C!==M?1:g-y[w]+1;d.setEdge(k,C,{weight:$,minlen:I,nestingEdge:!0}),d.setEdge(M,E,{weight:$,minlen:I,nestingEdge:!0})}),d.parent(w)||d.setEdge(f,k,{weight:0,minlen:g+y[w]})}function a(d){var f={};function p(h,g){var y=d.children(h);y&&y.length&&e.forEach(y,function(w){p(w,g+1)}),f[h]=g}return e.forEach(d.children(),function(h){p(h,1)}),f}function i(d){return e.reduce(d.edges(),function(f,p){return f+d.edge(p).weight},0)}function l(d){var f=d.graph();d.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(d.edges(),function(p){var h=d.edge(p);h.nestingEdge&&d.removeEdge(p)})}return Sv}var Nv,kj;function a8(){if(kj)return Nv;kj=1;var e=yt(),t=vn();Nv=n;function n(a){function i(l){var d=a.children(l),f=a.node(l);if(d.length&&e.forEach(d,i),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,h=f.maxRank+1;p<h;++p)s(a,"borderLeft","_bl",l,f,p),s(a,"borderRight","_br",l,f,p)}}e.forEach(a.children(),i)}function s(a,i,l,d,f,p){var h={width:0,height:0,rank:p,borderType:i},g=f[i][p-1],y=t.addDummyNode(a,"border",h,l);f[i][p]=y,a.setParent(y,d),g&&a.setEdge(g,y,{weight:1})}return Nv}var Ev,_j;function o8(){if(_j)return Ev;_j=1;var e=yt();Ev={adjust:t,undo:n};function t(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&s(p)}function n(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&i(p),(h==="lr"||h==="rl")&&(d(p),s(p))}function s(p){e.forEach(p.nodes(),function(h){a(p.node(h))}),e.forEach(p.edges(),function(h){a(p.edge(h))})}function a(p){var h=p.width;p.width=p.height,p.height=h}function i(p){e.forEach(p.nodes(),function(h){l(p.node(h))}),e.forEach(p.edges(),function(h){var g=p.edge(h);e.forEach(g.points,l),e.has(g,"y")&&l(g)})}function l(p){p.y=-p.y}function d(p){e.forEach(p.nodes(),function(h){f(p.node(h))}),e.forEach(p.edges(),function(h){var g=p.edge(h);e.forEach(g.points,f),e.has(g,"x")&&f(g)})}function f(p){var h=p.x;p.x=p.y,p.y=h}return Ev}var jv,Sj;function i8(){if(Sj)return jv;Sj=1;var e=yt();jv=t;function t(n){var s={},a=e.filter(n.nodes(),function(p){return!n.children(p).length}),i=e.max(e.map(a,function(p){return n.node(p).rank})),l=e.map(e.range(i+1),function(){return[]});function d(p){if(!e.has(s,p)){s[p]=!0;var h=n.node(p);l[h.rank].push(p),e.forEach(n.successors(p),d)}}var f=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(f,d),l}return jv}var Cv,Nj;function l8(){if(Nj)return Cv;Nj=1;var e=yt();Cv=t;function t(s,a){for(var i=0,l=1;l<a.length;++l)i+=n(s,a[l-1],a[l]);return i}function n(s,a,i){for(var l=e.zipObject(i,e.map(i,function(y,w){return w})),d=e.flatten(e.map(a,function(y){return e.sortBy(e.map(s.outEdges(y),function(w){return{pos:l[w.w],weight:s.edge(w).weight}}),"pos")}),!0),f=1;f<i.length;)f<<=1;var p=2*f-1;f-=1;var h=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(d.forEach(function(y){var w=y.pos+f;h[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=h[w+1]),w=w-1>>1,h[w]+=y.weight;g+=y.weight*N})),g}return Cv}var Tv,Ej;function c8(){if(Ej)return Tv;Ej=1;var e=yt();Tv=t;function t(n,s){return e.map(s,function(a){var i=n.inEdges(a);if(i.length){var l=e.reduce(i,function(d,f){var p=n.edge(f),h=n.node(f.v);return{sum:d.sum+p.weight*h.order,weight:d.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:a}})}return Tv}var Rv,jj;function u8(){if(jj)return Rv;jj=1;var e=yt();Rv=t;function t(a,i){var l={};e.forEach(a,function(f,p){var h=l[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(h.barycenter=f.barycenter,h.weight=f.weight)}),e.forEach(i.edges(),function(f){var p=l[f.v],h=l[f.w];!e.isUndefined(p)&&!e.isUndefined(h)&&(h.indegree++,p.out.push(l[f.w]))});var d=e.filter(l,function(f){return!f.indegree});return n(d)}function n(a){var i=[];function l(p){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(p.barycenter)||h.barycenter>=p.barycenter)&&s(p,h)}}function d(p){return function(h){h.in.push(p),--h.indegree===0&&a.push(h)}}for(;a.length;){var f=a.pop();i.push(f),e.forEach(f.in.reverse(),l(f)),e.forEach(f.out,d(f))}return e.map(e.filter(i,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(a,i){var l=0,d=0;a.weight&&(l+=a.barycenter*a.weight,d+=a.weight),i.weight&&(l+=i.barycenter*i.weight,d+=i.weight),a.vs=i.vs.concat(a.vs),a.barycenter=l/d,a.weight=d,a.i=Math.min(i.i,a.i),i.merged=!0}return Rv}var Av,Cj;function d8(){if(Cj)return Av;Cj=1;var e=yt(),t=vn();Av=n;function n(i,l){var d=t.partition(i,function(k){return e.has(k,"barycenter")}),f=d.lhs,p=e.sortBy(d.rhs,function(k){return-k.i}),h=[],g=0,y=0,w=0;f.sort(a(!!l)),w=s(h,p,w),e.forEach(f,function(k){w+=k.vs.length,h.push(k.vs),g+=k.barycenter*k.weight,y+=k.weight,w=s(h,p,w)});var N={vs:e.flatten(h,!0)};return y&&(N.barycenter=g/y,N.weight=y),N}function s(i,l,d){for(var f;l.length&&(f=e.last(l)).i<=d;)l.pop(),i.push(f.vs),d++;return d}function a(i){return function(l,d){return l.barycenter<d.barycenter?-1:l.barycenter>d.barycenter?1:i?d.i-l.i:l.i-d.i}}return Av}var Mv,Tj;function h8(){if(Tj)return Mv;Tj=1;var e=yt(),t=c8(),n=u8(),s=d8();Mv=a;function a(d,f,p,h){var g=d.children(f),y=d.node(f),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,k={};w&&(g=e.filter(g,function(M){return M!==w&&M!==N}));var E=t(d,g);e.forEach(E,function(M){if(d.children(M.v).length){var $=a(d,M.v,p,h);k[M.v]=$,e.has($,"barycenter")&&l(M,$)}});var _=n(E,p);i(_,k);var S=s(_,h);if(w&&(S.vs=e.flatten([w,S.vs,N],!0),d.predecessors(w).length)){var j=d.node(d.predecessors(w)[0]),C=d.node(d.predecessors(N)[0]);e.has(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+j.order+C.order)/(S.weight+2),S.weight+=2}return S}function i(d,f){e.forEach(d,function(p){p.vs=e.flatten(p.vs.map(function(h){return f[h]?f[h].vs:h}),!0)})}function l(d,f){e.isUndefined(d.barycenter)?(d.barycenter=f.barycenter,d.weight=f.weight):(d.barycenter=(d.barycenter*d.weight+f.barycenter*f.weight)/(d.weight+f.weight),d.weight+=f.weight)}return Mv}var Iv,Rj;function f8(){if(Rj)return Iv;Rj=1;var e=yt(),t=hr().Graph;Iv=n;function n(a,i,l){var d=s(a),f=new t({compound:!0}).setGraph({root:d}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var h=a.node(p),g=a.parent(p);(h.rank===i||h.minRank<=i&&i<=h.maxRank)&&(f.setNode(p),f.setParent(p,g||d),e.forEach(a[l](p),function(y){var w=y.v===p?y.w:y.v,N=f.edge(w,p),k=e.isUndefined(N)?0:N.weight;f.setEdge(w,p,{weight:a.edge(y).weight+k})}),e.has(h,"minRank")&&f.setNode(p,{borderLeft:h.borderLeft[i],borderRight:h.borderRight[i]}))}),f}function s(a){for(var i;a.hasNode(i=e.uniqueId("_root")););return i}return Iv}var $v,Aj;function p8(){if(Aj)return $v;Aj=1;var e=yt();$v=t;function t(n,s,a){var i={},l;e.forEach(a,function(d){for(var f=n.parent(d),p,h;f;){if(p=n.parent(f),p?(h=i[p],i[p]=f):(h=l,l=f),h&&h!==f){s.setEdge(h,f);return}f=p}})}return $v}var Ov,Mj;function m8(){if(Mj)return Ov;Mj=1;var e=yt(),t=i8(),n=l8(),s=h8(),a=f8(),i=p8(),l=hr().Graph,d=vn();Ov=f;function f(y){var w=d.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),k=p(y,e.range(w-1,-1,-1),"outEdges"),E=t(y);g(y,E);for(var _=Number.POSITIVE_INFINITY,S,j=0,C=0;C<4;++j,++C){h(j%2?N:k,j%4>=2),E=d.buildLayerMatrix(y);var M=n(y,E);M<_&&(C=0,S=e.cloneDeep(E),_=M)}g(y,S)}function p(y,w,N){return e.map(w,function(k){return a(y,k,N)})}function h(y,w){var N=new l;e.forEach(y,function(k){var E=k.graph().root,_=s(k,E,N,w);e.forEach(_.vs,function(S,j){k.node(S).order=j}),i(k,N,_.vs)})}function g(y,w){e.forEach(w,function(N){e.forEach(N,function(k,E){y.node(k).order=E})})}return Ov}var Pv,Ij;function g8(){if(Ij)return Pv;Ij=1;var e=yt(),t=hr().Graph,n=vn();Pv={positionX:N,findType1Conflicts:s,findType2Conflicts:a,addConflict:l,hasConflict:d,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:g,balance:w};function s(_,S){var j={};function C(M,$){var I=0,z=0,O=M.length,A=e.last($);return e.forEach($,function(D,H){var X=i(_,D),R=X?_.node(X).order:O;(X||D===A)&&(e.forEach($.slice(z,H+1),function(Z){e.forEach(_.predecessors(Z),function(B){var Q=_.node(B),P=Q.order;(P<I||R<P)&&!(Q.dummy&&_.node(Z).dummy)&&l(j,B,Z)})}),z=H+1,I=R)}),$}return e.reduce(S,C),j}function a(_,S){var j={};function C($,I,z,O,A){var D;e.forEach(e.range(I,z),function(H){D=$[H],_.node(D).dummy&&e.forEach(_.predecessors(D),function(X){var R=_.node(X);R.dummy&&(R.order<O||R.order>A)&&l(j,X,D)})})}function M($,I){var z=-1,O,A=0;return e.forEach(I,function(D,H){if(_.node(D).dummy==="border"){var X=_.predecessors(D);X.length&&(O=_.node(X[0]).order,C(I,A,H,z,O),A=H,z=O)}C(I,A,I.length,O,$.length)}),I}return e.reduce(S,M),j}function i(_,S){if(_.node(S).dummy)return e.find(_.predecessors(S),function(j){return _.node(j).dummy})}function l(_,S,j){if(S>j){var C=S;S=j,j=C}var M=_[S];M||(_[S]=M={}),M[j]=!0}function d(_,S,j){if(S>j){var C=S;S=j,j=C}return e.has(_[S],j)}function f(_,S,j,C){var M={},$={},I={};return e.forEach(S,function(z){e.forEach(z,function(O,A){M[O]=O,$[O]=O,I[O]=A})}),e.forEach(S,function(z){var O=-1;e.forEach(z,function(A){var D=C(A);if(D.length){D=e.sortBy(D,function(B){return I[B]});for(var H=(D.length-1)/2,X=Math.floor(H),R=Math.ceil(H);X<=R;++X){var Z=D[X];$[A]===A&&O<I[Z]&&!d(j,A,Z)&&($[Z]=A,$[A]=M[A]=M[Z],O=I[Z])}}})}),{root:M,align:$}}function p(_,S,j,C,M){var $={},I=h(_,S,j,M),z=M?"borderLeft":"borderRight";function O(H,X){for(var R=I.nodes(),Z=R.pop(),B={};Z;)B[Z]?H(Z):(B[Z]=!0,R.push(Z),R=R.concat(X(Z))),Z=R.pop()}function A(H){$[H]=I.inEdges(H).reduce(function(X,R){return Math.max(X,$[R.v]+I.edge(R))},0)}function D(H){var X=I.outEdges(H).reduce(function(Z,B){return Math.min(Z,$[B.w]-I.edge(B))},Number.POSITIVE_INFINITY),R=_.node(H);X!==Number.POSITIVE_INFINITY&&R.borderType!==z&&($[H]=Math.max($[H],X))}return O(A,I.predecessors.bind(I)),O(D,I.successors.bind(I)),e.forEach(C,function(H){$[H]=$[j[H]]}),$}function h(_,S,j,C){var M=new t,$=_.graph(),I=k($.nodesep,$.edgesep,C);return e.forEach(S,function(z){var O;e.forEach(z,function(A){var D=j[A];if(M.setNode(D),O){var H=j[O],X=M.edge(H,D);M.setEdge(H,D,Math.max(I(_,A,O),X||0))}O=A})}),M}function g(_,S){return e.minBy(e.values(S),function(j){var C=Number.NEGATIVE_INFINITY,M=Number.POSITIVE_INFINITY;return e.forIn(j,function($,I){var z=E(_,I)/2;C=Math.max($+z,C),M=Math.min($-z,M)}),C-M})}function y(_,S){var j=e.values(S),C=e.min(j),M=e.max(j);e.forEach(["u","d"],function($){e.forEach(["l","r"],function(I){var z=$+I,O=_[z],A;if(O!==S){var D=e.values(O);A=I==="l"?C-e.min(D):M-e.max(D),A&&(_[z]=e.mapValues(O,function(H){return H+A}))}})})}function w(_,S){return e.mapValues(_.ul,function(j,C){if(S)return _[S.toLowerCase()][C];var M=e.sortBy(e.map(_,C));return(M[1]+M[2])/2})}function N(_){var S=n.buildLayerMatrix(_),j=e.merge(s(_,S),a(_,S)),C={},M;e.forEach(["u","d"],function(I){M=I==="u"?S:e.values(S).reverse(),e.forEach(["l","r"],function(z){z==="r"&&(M=e.map(M,function(H){return e.values(H).reverse()}));var O=(I==="u"?_.predecessors:_.successors).bind(_),A=f(_,M,j,O),D=p(_,M,A.root,A.align,z==="r");z==="r"&&(D=e.mapValues(D,function(H){return-H})),C[I+z]=D})});var $=g(_,C);return y(C,$),w(C,_.graph().align)}function k(_,S,j){return function(C,M,$){var I=C.node(M),z=C.node($),O=0,A;if(O+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":A=-I.width/2;break;case"r":A=I.width/2;break}if(A&&(O+=j?A:-A),A=0,O+=(I.dummy?S:_)/2,O+=(z.dummy?S:_)/2,O+=z.width/2,e.has(z,"labelpos"))switch(z.labelpos.toLowerCase()){case"l":A=z.width/2;break;case"r":A=-z.width/2;break}return A&&(O+=j?A:-A),A=0,O}}function E(_,S){return _.node(S).width}return Pv}var Lv,$j;function y8(){if($j)return Lv;$j=1;var e=yt(),t=vn(),n=g8().positionX;Lv=s;function s(i){i=t.asNonCompoundGraph(i),a(i),e.forEach(n(i),function(l,d){i.node(d).x=l})}function a(i){var l=t.buildLayerMatrix(i),d=i.graph().ranksep,f=0;e.forEach(l,function(p){var h=e.max(e.map(p,function(g){return i.node(g).height}));e.forEach(p,function(g){i.node(g).y=f+h/2}),f+=h+d})}return Lv}var Dv,Oj;function v8(){if(Oj)return Dv;Oj=1;var e=yt(),t=JB(),n=e8(),s=n8(),a=vn().normalizeRanks,i=r8(),l=vn().removeEmptyRanks,d=s8(),f=a8(),p=o8(),h=m8(),g=y8(),y=vn(),w=hr().Graph;Dv=N;function N(G,U){var ee=U&&U.debugTiming?y.time:y.notime;ee("layout",function(){var Y=ee(" buildLayoutGraph",function(){return O(G)});ee(" runLayout",function(){k(Y,ee)}),ee(" updateInputGraph",function(){E(G,Y)})})}function k(G,U){U(" makeSpaceForEdgeLabels",function(){A(G)}),U(" removeSelfEdges",function(){F(G)}),U(" acyclic",function(){t.run(G)}),U(" nestingGraph.run",function(){d.run(G)}),U(" rank",function(){s(y.asNonCompoundGraph(G))}),U(" injectEdgeLabelProxies",function(){D(G)}),U(" removeEmptyRanks",function(){l(G)}),U(" nestingGraph.cleanup",function(){d.cleanup(G)}),U(" normalizeRanks",function(){a(G)}),U(" assignRankMinMax",function(){H(G)}),U(" removeEdgeLabelProxies",function(){X(G)}),U(" normalize.run",function(){n.run(G)}),U(" parentDummyChains",function(){i(G)}),U(" addBorderSegments",function(){f(G)}),U(" order",function(){h(G)}),U(" insertSelfEdges",function(){J(G)}),U(" adjustCoordinateSystem",function(){p.adjust(G)}),U(" position",function(){g(G)}),U(" positionSelfEdges",function(){L(G)}),U(" removeBorderNodes",function(){P(G)}),U(" normalize.undo",function(){n.undo(G)}),U(" fixupEdgeLabelCoords",function(){B(G)}),U(" undoCoordinateSystem",function(){p.undo(G)}),U(" translateGraph",function(){R(G)}),U(" assignNodeIntersects",function(){Z(G)}),U(" reversePoints",function(){Q(G)}),U(" acyclic.undo",function(){t.undo(G)})}function E(G,U){e.forEach(G.nodes(),function(ee){var Y=G.node(ee),le=U.node(ee);Y&&(Y.x=le.x,Y.y=le.y,U.children(ee).length&&(Y.width=le.width,Y.height=le.height))}),e.forEach(G.edges(),function(ee){var Y=G.edge(ee),le=U.edge(ee);Y.points=le.points,e.has(le,"x")&&(Y.x=le.x,Y.y=le.y)}),G.graph().width=U.graph().width,G.graph().height=U.graph().height}var _=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},j=["acyclicer","ranker","rankdir","align"],C=["width","height"],M={width:0,height:0},$=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},z=["labelpos"];function O(G){var U=new w({multigraph:!0,compound:!0}),ee=ue(G.graph());return U.setGraph(e.merge({},S,K(ee,_),e.pick(ee,j))),e.forEach(G.nodes(),function(Y){var le=ue(G.node(Y));U.setNode(Y,e.defaults(K(le,C),M)),U.setParent(Y,G.parent(Y))}),e.forEach(G.edges(),function(Y){var le=ue(G.edge(Y));U.setEdge(Y,e.merge({},I,K(le,$),e.pick(le,z)))}),U}function A(G){var U=G.graph();U.ranksep/=2,e.forEach(G.edges(),function(ee){var Y=G.edge(ee);Y.minlen*=2,Y.labelpos.toLowerCase()!=="c"&&(U.rankdir==="TB"||U.rankdir==="BT"?Y.width+=Y.labeloffset:Y.height+=Y.labeloffset)})}function D(G){e.forEach(G.edges(),function(U){var ee=G.edge(U);if(ee.width&&ee.height){var Y=G.node(U.v),le=G.node(U.w),fe={rank:(le.rank-Y.rank)/2+Y.rank,e:U};y.addDummyNode(G,"edge-proxy",fe,"_ep")}})}function H(G){var U=0;e.forEach(G.nodes(),function(ee){var Y=G.node(ee);Y.borderTop&&(Y.minRank=G.node(Y.borderTop).rank,Y.maxRank=G.node(Y.borderBottom).rank,U=e.max(U,Y.maxRank))}),G.graph().maxRank=U}function X(G){e.forEach(G.nodes(),function(U){var ee=G.node(U);ee.dummy==="edge-proxy"&&(G.edge(ee.e).labelRank=ee.rank,G.removeNode(U))})}function R(G){var U=Number.POSITIVE_INFINITY,ee=0,Y=Number.POSITIVE_INFINITY,le=0,fe=G.graph(),me=fe.marginx||0,ke=fe.marginy||0;function Ve(Le){var qe=Le.x,Ne=Le.y,Ge=Le.width,be=Le.height;U=Math.min(U,qe-Ge/2),ee=Math.max(ee,qe+Ge/2),Y=Math.min(Y,Ne-be/2),le=Math.max(le,Ne+be/2)}e.forEach(G.nodes(),function(Le){Ve(G.node(Le))}),e.forEach(G.edges(),function(Le){var qe=G.edge(Le);e.has(qe,"x")&&Ve(qe)}),U-=me,Y-=ke,e.forEach(G.nodes(),function(Le){var qe=G.node(Le);qe.x-=U,qe.y-=Y}),e.forEach(G.edges(),function(Le){var qe=G.edge(Le);e.forEach(qe.points,function(Ne){Ne.x-=U,Ne.y-=Y}),e.has(qe,"x")&&(qe.x-=U),e.has(qe,"y")&&(qe.y-=Y)}),fe.width=ee-U+me,fe.height=le-Y+ke}function Z(G){e.forEach(G.edges(),function(U){var ee=G.edge(U),Y=G.node(U.v),le=G.node(U.w),fe,me;ee.points?(fe=ee.points[0],me=ee.points[ee.points.length-1]):(ee.points=[],fe=le,me=Y),ee.points.unshift(y.intersectRect(Y,fe)),ee.points.push(y.intersectRect(le,me))})}function B(G){e.forEach(G.edges(),function(U){var ee=G.edge(U);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(G){e.forEach(G.edges(),function(U){var ee=G.edge(U);ee.reversed&&ee.points.reverse()})}function P(G){e.forEach(G.nodes(),function(U){if(G.children(U).length){var ee=G.node(U),Y=G.node(ee.borderTop),le=G.node(ee.borderBottom),fe=G.node(e.last(ee.borderLeft)),me=G.node(e.last(ee.borderRight));ee.width=Math.abs(me.x-fe.x),ee.height=Math.abs(le.y-Y.y),ee.x=fe.x+ee.width/2,ee.y=Y.y+ee.height/2}}),e.forEach(G.nodes(),function(U){G.node(U).dummy==="border"&&G.removeNode(U)})}function F(G){e.forEach(G.edges(),function(U){if(U.v===U.w){var ee=G.node(U.v);ee.selfEdges||(ee.selfEdges=[]),ee.selfEdges.push({e:U,label:G.edge(U)}),G.removeEdge(U)}})}function J(G){var U=y.buildLayerMatrix(G);e.forEach(U,function(ee){var Y=0;e.forEach(ee,function(le,fe){var me=G.node(le);me.order=fe+Y,e.forEach(me.selfEdges,function(ke){y.addDummyNode(G,"selfedge",{width:ke.label.width,height:ke.label.height,rank:me.rank,order:fe+ ++Y,e:ke.e,label:ke.label},"_se")}),delete me.selfEdges})})}function L(G){e.forEach(G.nodes(),function(U){var ee=G.node(U);if(ee.dummy==="selfedge"){var Y=G.node(ee.e.v),le=Y.x+Y.width/2,fe=Y.y,me=ee.x-le,ke=Y.height/2;G.setEdge(ee.e,ee.label),G.removeNode(U),ee.label.points=[{x:le+2*me/3,y:fe-ke},{x:le+5*me/6,y:fe-ke},{x:le+me,y:fe},{x:le+5*me/6,y:fe+ke},{x:le+2*me/3,y:fe+ke}],ee.label.x=ee.x,ee.label.y=ee.y}})}function K(G,U){return e.mapValues(e.pick(G,U),Number)}function ue(G){var U={};return e.forEach(G,function(ee,Y){U[Y.toLowerCase()]=ee}),U}return Dv}var qv,Pj;function w8(){if(Pj)return qv;Pj=1;var e=yt(),t=vn(),n=hr().Graph;qv={debugOrdering:s};function s(a){var i=t.buildLayerMatrix(a),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(d){l.setNode(d,{label:d}),l.setParent(d,"layer"+a.node(d).rank)}),e.forEach(a.edges(),function(d){l.setEdge(d.v,d.w,{},d.name)}),e.forEach(i,function(d,f){var p="layer"+f;l.setNode(p,{rank:"same"}),e.reduce(d,function(h,g){return l.setEdge(h,g,{style:"invis"}),g})}),l}return qv}var Fv,Lj;function x8(){return Lj||(Lj=1,Fv="0.8.5"),Fv}var zv,Dj;function b8(){return Dj||(Dj=1,zv={graphlib:hr(),layout:v8(),debug:w8(),util:{time:vn().time,notime:vn().notime},version:x8()}),zv}var k8=b8();const qj=Ew(k8),ei=240,Qu=130,Ho=74,Cd=72,Fj=Ho+Cd;function _8(e,t){var s;let n=ei;for(const a of e)n=Math.max(n,((s=t.get(a.id))==null?void 0:s.width)??ei);return n}const yA=420,S8=2;function Ml(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function N8(e,t){return((t==null?void 0:t.get(e))??0)>0?yA:0}function E8(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Il(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??ei)+N8(e,n),h:Math.max((s==null?void 0:s.height)??Qu,E8(e,n))}}function j8(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function C8(e,t,n,s,a,i){const l=new qj.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const d=e.filter(_=>!a.has(_)),f=new Set(d);for(const _ of d){const{w:S,h:j}=Il(_,s,i);l.setNode(_,{width:S,height:j})}for(const _ of t)f.has(_.source)&&f.has(_.target)&&l.setEdge(_.source,_.target);qj.layout(l);const p=new Map;let h=1/0,g=1/0,y=-1/0,w=-1/0;for(const _ of d){const S=l.node(_);if(!S)continue;const j=s.get(_),C=(j==null?void 0:j.width)??ei,M=(j==null?void 0:j.height)??Qu,$=Il(_,s,i),I=S.x-$.w/2,z=S.y-$.h/2;p.set(_,{x:I,y:z}),I<h&&(h=I),z<g&&(g=z),I+C>y&&(y=I+C),z+M>w&&(w=z+M)}if(Number.isFinite(h)&&Number.isFinite(g))for(const[_,S]of p)p.set(_,{x:S.x-h,y:S.y-g});const N=Number.isFinite(y)?y-h:0,k=Number.isFinite(w)?w-g:0;let E=null;for(const _ of e){const S=a.get(_);if(!S)continue;const j=s.get(_),C=(j==null?void 0:j.width)??ei,M=(j==null?void 0:j.height)??Qu;E=E===null?{minX:S.x,minY:S.y,maxX:S.x+C,maxY:S.y+M}:{minX:Math.min(E.minX,S.x),minY:Math.min(E.minY,S.y),maxX:Math.max(E.maxX,S.x+C),maxY:Math.max(E.maxY,S.y+M)}}return{positions:p,width:N,height:k,pinnedBox:E}}function T8(e,t,n={}){const s=n.direction??"LR",a=n.pinned??new Map,i=n.measured??new Map,l=n.lanes,d=new Map;for(const _ of e){const S=Ml(_),j=d.get(S);j?j.push(_.id):d.set(S,[_.id])}const p=Array.from(d.keys()).sort().map(_=>({sid:_,...C8(d.get(_),t,s,i,a,l)})),h=_8(e,i),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,y=_=>{const S=[[]];let j=0;for(const C of p)S.length<_&&j>0&&j+C.height>g&&(S.push([]),j=0),S[S.length-1].push(C),j+=C.height+Fj;return S},w=_=>_.reduce((S,j)=>Math.max(S,j.width),0)+yA;let N=y(n.availableWidth?S8:1);N.length>1&&N.reduce((S,j)=>S+w(j),0)+h*(N.length-1)>(n.availableWidth??0)&&(N=y(1));const k=new Map;let E=0;for(const _ of N){const S=w(_);let j=0;for(const{positions:C,height:M,pinnedBox:$}of _){for(const[z,O]of C)k.set(z,{x:O.x+E,y:O.y+j});let I=j+M;$&&$.maxY>I&&$.minX<E+S&&E<$.maxX&&(I=$.maxY),j=I+Fj}E+=S+h}return e.map(_=>{const S=a.get(_.id);if(S)return{..._,position:S};const j=k.get(_.id);return j?{..._,position:j}:_})}function R8(e,t,n,s,a){const l=Ho+Cd,d=60,f=w=>Il(w,s,a),p=new Map(e.map(w=>[w.id,Ml(w)])),h=[],g=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),y=[];for(const{id:w,pos:N}of g){const{w:k,h:E}=f(w),_=p.get(w)??"_default";if(n.has(w)){h.push({x:N.x,y:N.y,w:k,h:E,sid:_});continue}let S=N.y;for(let j=0;j<h.length+1;j++){const C=h.find(M=>{const $=M.sid===_?24:d,I=M.sid===_?24:l;return N.x<M.x+M.w+$&&M.x<N.x+k+$&&S<M.y+M.h+I&&M.y<S+E+I});if(!C)break;S=C.y+C.h+(C.sid===_?24:l)}S!==N.y&&(t.set(w,{x:N.x,y:S}),y.push(w)),h.push({x:N.x,y:S,w:k,h:E,sid:_})}return y}function A8(e,t,n,s,a,i){const l=k=>Il(k,s,i),d=k=>n.get(k)??t.get(k),f=new Map;for(const k of e){if(!d(k.id))continue;const E=Ml(k),_=f.get(E);_?_.push(k):f.set(E,[k])}const p=new Set;for(const[k,E]of f)E.every(_=>a.has(_.id)&&!n.has(_.id))&&p.add(k);const h=new Map,g=[];for(const k of e){const E=d(k.id);if(!E)continue;const{w:_,h:S}=l(k.id),j=Ml(k);p.has(j)?(h.get(j)??h.set(j,[]).get(j)).push(k):g.push({x:E.x,y:E.y,w:_,h:S})}if(h.size===0)return[];const y=Ho+Cd,w=(k,E,_,S)=>g.some(j=>k<j.x+j.w+Ho&&j.x<k+_+Ho&&E<j.y+j.h+y&&j.y<E+S+y),N=[];for(const k of[...h.keys()].sort()){const E=h.get(k);let _=1/0,S=1/0,j=-1/0,C=-1/0;for(const D of E){const H=d(D.id),{w:X,h:R}=l(D.id);_=Math.min(_,H.x),S=Math.min(S,H.y),j=Math.max(j,H.x+X),C=Math.max(C,H.y+R)}const M=j-_,$=C-S,I=[...new Set(g.map(D=>Math.round(D.x)))].sort((D,H)=>D-H),z=I.length?I:[_],O=[0,...g.map(D=>D.y+D.h+y)].sort((D,H)=>D-H);let A=null;e:for(const D of z)for(const H of O){if(H>=S)break;if(!w(D,H,M,$)){A={x:D,y:H};break e}}if(A){const D=A.x-_,H=A.y-S;for(const X of E){const R=d(X.id);t.set(X.id,{x:R.x+D,y:R.y+H})}N.push(k)}for(const D of E){const H=d(D.id),{w:X,h:R}=l(D.id);g.push({x:H.x,y:H.y,w:X,h:R})}}return N}function M8(e,t,n,s,a,i=!1,l){const p=Ho+Cd+1,h=8,g=1.75,y=200,w=.7,N=.01,k=A=>Il(A,s,l),E=A=>n.get(A)??t.get(A),_=new Map;for(const A of e){if(!E(A.id))continue;const D=Ml(A),H=_.get(D);H?H.push(A):_.set(D,[A])}const S=[],j=new Set,C=new Set,M=a.size===0;for(const A of[..._.keys()].sort()){const D=_.get(A);let H=1/0,X=1/0,R=-1/0,Z=-1/0,B=!1;for(const J of D){const L=E(J.id),{w:K,h:ue}=k(J.id);H=Math.min(H,L.x),X=Math.min(X,L.y),R=Math.max(R,L.x+K),Z=Math.max(Z,L.y+ue),n.has(J.id)&&(B=!0)}const Q=R-H,P=Z-X;C.add(A);const F=a.get(A);F&&(Q>F.w+h||P>F.h+h)&&j.add(A),a.set(A,{w:Q,h:P}),S.push({sid:A,members:D.map(J=>J.id),x:H,y:X,w:Q,h:P,anchored:B,mass:1})}for(const A of[...a.keys()])C.has(A)||a.delete(A);if(i||M)return[];let $=!1;for(let A=0;A<S.length&&!$;A++)for(let D=A+1;D<S.length;D++){const H=S[A],X=S[D];if(!(H.anchored&&X.anchored)&&Math.abs(H.x+H.w/2-(X.x+X.w/2))<(H.w+X.w)/2+61&&Math.abs(H.y+H.h/2-(X.y+X.h/2))<(H.h+X.h)/2+p){$=!0;break}}if(j.size===0&&!$)return[];if(j.size>0)for(const A of S)j.has(A.sid)&&(A.mass=8);else for(const A of S)A.mass=Math.max(1,A.w*A.h/(ei*Qu));const I=new Map(S.map(A=>[A.sid,A.x])),z=new Map(S.map(A=>[A.sid,A.y]));for(let A=0;A<y;A++){const D=new Map,H=new Map;let X=0;for(let R=0;R<S.length;R++)for(let Z=R+1;Z<S.length;Z++){const B=S[R],Q=S[Z];if(B.anchored&&Q.anchored)continue;const P=B.x+B.w/2,F=B.y+B.h/2,J=Q.x+Q.w/2,L=Q.y+Q.h/2,K=(B.w+Q.w)/2+61-Math.abs(P-J),ue=(B.h+Q.h)/2+p-Math.abs(F-L);if(K<=0||ue<=0)continue;const G=(Ye,pe)=>!Ye.anchored&&!(pe<0&&Ye.x<=0),U=(Ye,pe)=>!Ye.anchored&&!(pe<0&&Ye.y<=0),ee=(Ye,pe,we)=>{const Pe=Ye===pe,Ue=Pe?B.sid<Q.sid?-1:1:Math.sign(Ye-pe);return we(B,Ue)||we(Q,-Ue)?Ue:Pe&&(we(B,-Ue)||we(Q,Ue))?-Ue:0},Y=ee(P,J,G),le=ee(F,L,U),fe=Y!==0,me=le!==0;if(!fe&&!me)continue;const ke=fe&&(!me||K*g<ue),[Ve,Le,qe,Ne]=ke?[Y,K,D,G]:[le,ue,H,U],Ge=Ne(B,Ve),be=Ne(Q,-Ve),re=B.mass,Qe=Q.mass,ft=Ge?be?Qe/(re+Qe):1:0,ut=be?Ge?re/(re+Qe):1:0,at=Le*w;qe.set(B.sid,(qe.get(B.sid)??0)+Ve*at*ft),qe.set(Q.sid,(qe.get(Q.sid)??0)-Ve*at*ut),X+=at}for(const R of S)R.anchored||(R.x=Math.max(0,R.x+(D.get(R.sid)??0)),R.y=Math.max(0,R.y+(H.get(R.sid)??0)));if(X<N)break}const O=[];for(const A of S){const D=A.x-I.get(A.sid),H=A.y-z.get(A.sid);if(!(Math.abs(D)<1&&Math.abs(H)<1)){for(const X of A.members){if(n.has(X))continue;const R=t.get(X);R&&t.set(X,{x:R.x+D,y:R.y+H})}O.push(A.sid)}}return O}const I8=600;function kw(e,t){return!(e.exitAt!=null&&t-e.exitAt>I8||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function $8(e,t){const n=new Set;for(const s of e.agents.values())kw(s,t)&&n.add(s.id);return n}function O8(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 P8(e,t,n=0){if(!e)return!1;for(const s of t)if(O8(e,s,n))return!0;return!1}const vA="sessionGroup";function L8(e,t){var s;if(e.type===vA)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const wA=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function zj(e){const t={};for(const n of wA)t[n]=e(n);return t}function D8(e){return t=>e[t]??""}function q8(e,t){return wA.every(n=>e[n]===t[n])}function F8(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[a,i]of e.positions)n.set(a,i),t.has(a)&&s.set(a,i);return{positions:n,pinned:s}}const z8=1200,B8=1e3;function Bj(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<z8?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<B8}function Bv({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function U8(e,t,n){const s=e.x*t.zoom+t.x,a=e.y*t.zoom+t.y,i=(e.x+e.width)*t.zoom+t.x,l=(e.y+e.height)*t.zoom+t.y;return i>0&&s<n.width&&l>0&&a<n.height}function W8({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,U8(a,t,e))return!1;return s}const H8="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Uv="click for what's new";function G8(e){if(e.checkDisabled)return`${H8} · ${Uv}`;if(e.checking)return`Asking npm for the newest release… · ${Uv}`;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 · ${Uv}, and to check npm now`}function V8(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 Y8(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 K8(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 _w={kind:"assumed",claude:!0,codex:!0};function X8(e){if(!e||typeof e!="object")return _w;const t=e.providers;if(!t||typeof t!="object")return _w;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Zu(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const Uj=99;function Q8(e){const t=Math.max(0,Math.floor(e));return t>Uj?`${Uj}+`:String(t)}const Z8="Pause the canvas";function J8(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 — ${Zu(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)":`${Zu(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function eU(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 xA="paused · full",tU=(e,t)=>t>0?xA:e>0?`paused · ${Q8(e)}`:"paused";function nU(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:tU(e.held,t),widest:xA,title:t>0?`Connected — the pause is full at ${Zu(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Zu(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 Wj(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const rU={agent:L3,sessionGroup:e4},bA="react-flow__node";function Hj(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,bA))===!0}function sU(e){try{const t=document.querySelector(`.${bA}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const aU=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),oU=420,Nu=18,iU=200,lU=5*6e4,cU=6,uU=2*6e4,Gj=400,S0="agent-dag.layout",N0="agent-dag.viewport",kA="agent-dag.summariesDismissed",_A="agent-dag.sessionListOpen",SA="agent-dag.detailOpen",NA="agent-dag.usagePanelOpen",EA="agent-dag.systemPanelOpen",Vj="agent-dag.accountsPanelOpen",Wv="agent-dag.versionNoticeDismissed",Yj="agent-dag.oldNameNoticeDismissed",dU=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:"},Kj="agent-dag.autoRestart",Xj="agent-dag.bundleReloadedFor";function hU(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(_A)==="1"}catch{return!1}}function fU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(_A,e?"1":"0")}catch{}}function pU(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(SA)==="1"}catch{return!1}}function mU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(SA,e?"1":"0")}catch{}}function gU(){const e=ni(NA);return e===null?!0:e==="1"}function yU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(NA,e?"1":"0")}catch{}}function vU(){return ni(EA)==="1"}function wU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(EA,e?"1":"0")}catch{}}function xU(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(kA);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 Qj(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(kA,JSON.stringify(n))}catch{}}function bU(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(S0);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const a=Object.entries(n).filter(([,i])=>i&&typeof i.x=="number"&&typeof i.y=="number");return{positions:a,pins:a.map(([i])=>i)}}return{positions:Object.entries(n.positions??{}).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function Gv(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(S0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function kU(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(N0);if(!e)return null;const t=JSON.parse(e);return typeof(t==null?void 0:t.x)!="number"||typeof(t==null?void 0:t.y)!="number"||typeof(t==null?void 0:t.zoom)!="number"?null:t}catch{return null}}function _U(e){if(!(typeof window>"u"))try{window.localStorage.setItem(N0,JSON.stringify(e))}catch{}}function Zj(){if(!(typeof window>"u")){try{window.localStorage.removeItem(S0)}catch{}try{window.localStorage.removeItem(N0)}catch{}}}function SU(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const h of e.agents.values())h.sessionId===t&&s.push(h);const a={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:s.map(h=>({id:h.id,kind:h.kind,label:h.label,parentId:h.parentId,state:h.state,startedAt:h.startedAt,endedAt:h.endedAt,model:h.model,cwd:h.cwd,usage:h.usage,prompts:h.prompts,tools:h.tools.map(g=>({id:g.id,name:g.name,inputPreview:g.inputPreview,startedAt:g.startedAt,endedAt:g.endedAt,ok:g.ok,errorPreview:g.errorPreview,usage:g.usage}))}))},i=JSON.stringify(a,null,2),l=new Blob([i],{type:"application/json"}),d=URL.createObjectURL(l),f=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=d,f.download=`${Ut}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(d),1e3)}const Sw={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Nw={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},jA=DT;function NU(e,t,n,s,a,i,l,d,f,p,h,g,y,w,N,k,E,_){const S=[],j=[];for(const A of e.agents.values()){if(!E.has(A.id))continue;const D=A.exitAt!=null,H=k!=null&&!k.has(A.id),X=[D?"rf-exiting":"",H?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,R=i.get(A.id);if(S.push({id:A.id,type:"agent",position:{x:0,y:0},data:{...A,now:t,onOpenContext:_},className:X,...R?{width:R.width,height:R.height}:null}),A.parentId&&E.has(A.parentId)){const Z=Gw(A.sessionId),B=D,Q=N.size>0&&(N.has(A.id)||N.has(A.parentId)),P=k!=null&&!k.has(A.id)&&!k.has(A.parentId),F=A.state==="active"?2:1.5,J=Q?F+1.5:F,L=B?.2:P?.12:1,K=["sess-edge",A.state==="active"?"sess-live":"sess-idle",B?"rf-edge-exiting":"",Q?"rf-edge-selected":""].filter(Boolean).join(" ");j.push({id:`e:${A.parentId}->${A.id}`,source:A.parentId,target:A.id,animated:(A.state==="active"||Q)&&!B,type:"smoothstep",style:{"--session-hue":Z,strokeWidth:J,opacity:L,transition:"var(--edge-transition)"},className:K})}}const C=new Map;for(const A of e.agents.values())A.tools.length>0&&C.set(A.id,Math.min(4,A.tools.length));const M=`${y}#lanes:${j8(C)}`,$=S.filter(A=>wF(A.id,a,h,g));if($.length>0||M!==w.current){if($.length>0){const A=T8(S,j,{direction:"LR",pinned:a,measured:i,availableWidth:n,availableHeight:s,lanes:C});for(const D of A)pR(D.id,h,g)&&bF(D.id,D.position,h,g);A8(S,h,a,i,new Set($.map(D=>D.id)),C)}R8(S,h,a,i,C),w.current=M}const I=M8(S,h,a,i,l,!f||p,C);I.length>0&&d(I),wu(h,e.agents),wu(g,e.agents),wu(a,e.agents),wu(i,gF(e.agents.values()));const z=[];let O=!1;for(const A of S){let D=a.get(A.id)??h.get(A.id);D||(D=xF(A.id,h,g),O=!0),z.push({...A,position:D})}return O&&(w.current=""),{nodes:z,edges:j}}function EU(){return c.jsx(Ww,{children:c.jsx(jU,{})})}function jU(){var Di,ua,Wr,uo;const e=Dl(),t=Mt(),n=b.useState(cw)[0],s=b.useRef(n),[,a]=b.useState(0),i=b.useCallback(()=>a(q=>q+1),[]),[l,d]=b.useState(()=>new Set),[f,p]=b.useState(null),[h,g]=b.useState(null),y=b.useCallback((q,W)=>{d(ie=>{if(!W)return new Set([q]);const de=new Set(ie);return de.has(q)?de.delete(q):de.add(q),de}),p(ie=>W&&ie===q?ie:q)},[]),w=b.useCallback(()=>{d(new Set),p(null)},[]),[N,k]=b.useState(null),[E,_]=b.useState(null),S=b.useCallback(q=>_(q),[]),[j,C]=b.useState(!1),[M,$]=b.useState(!1),I=b.useState(xU)[0],[z,O]=b.useState(hU);b.useEffect(()=>{fU(z)},[z]);const[A,D]=b.useState(pU);b.useEffect(()=>{mU(A)},[A]);const[H,X]=b.useState(gU);b.useEffect(()=>{yU(H)},[H]);const[R,Z]=b.useState(vU);b.useEffect(()=>{wU(R)},[R]);const[B,Q]=b.useState(()=>{try{const q=window.localStorage.getItem(Vj);return q===null?!0:q==="1"}catch{return!0}});b.useEffect(()=>{try{window.localStorage.setItem(Vj,B?"1":"0")}catch{}},[B]);const[P,F]=b.useState(null);b.useEffect(()=>{let q=null;try{q=localStorage.getItem("agent-dag.sound")}catch{}F(q===null?!0:q==="on")},[]);const J=b.useCallback(()=>{F(q=>{var ie;const W=q!==!0;try{localStorage.setItem("agent-dag.sound",W?"on":"off")}catch{}return W&&((ie=Le.current)==null||ie.unlock()),W})},[]),L=b.useCallback(q=>{J()},[J]),K=b.useRef(L);K.current=L;const ue=b.useRef(P);ue.current=P;const[G,U]=b.useState(()=>q5(ni)),ee=b.useRef(G);ee.current=G;const Y=b.useRef(null),le=b.useCallback((q,W=!1)=>{var ie,de;if((ie=Le.current)==null||ie.unlock(),Y.current!==null&&clearTimeout(Y.current),Y.current=null,!W){(de=Le.current)==null||de.play(q,!0);return}Y.current=setTimeout(()=>{var je;Y.current=null,(je=Le.current)==null||je.play(q,!0)},$5)},[]),fe=b.useCallback((q,W)=>{U(ie=>{const de={level:Al(W.level??ie[q].level),figure:lR(q,W.figure??ie[q].figure)};try{localStorage.setItem(cR[q],String(de.level)),localStorage.setItem(uR[q],de.figure)}catch{}return{...ie,[q]:de}}),le(q,!0)},[le]);b.useEffect(()=>()=>{Y.current!==null&&clearTimeout(Y.current)},[]);const[me,ke]=b.useState(!1),Ve=b.useRef(null),Le=b.useRef(null),[qe,Ne]=b.useState("locked");b.useEffect(()=>{const q=B5({enabled:()=>ue.current===!0,prefs:()=>ee.current,onState:Ne});Le.current=q,Ne(q.state());const W=()=>q.unlock();return window.addEventListener("pointerdown",W,{once:!0,capture:!0}),window.addEventListener("keydown",W,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",W,{capture:!0}),window.removeEventListener("keydown",W,{capture:!0})}},[]);const[Ge,be]=b.useState(!1),[re,Qe]=b.useState(null),[ft,ut]=b.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Wv)??""}catch{return""}}),[at,Ye]=b.useState(!1),pe=b.useRef(0),[we,Pe]=b.useState(!1),Ue=b.useCallback((q=!1)=>(q&&(pe.current=Date.now(),Pe(!0)),fetch(q?"/api/version?refresh=1":"/api/version").then(W=>W.ok?W.json():null).then(W=>{W&&Qe(W)}).catch(()=>{}).finally(()=>{q&&Pe(!1)})),[]),ot=b.useCallback(()=>{Ue(Date.now()-pe.current>=dU)},[Ue]);b.useEffect(()=>{Ue();const q=window.setInterval(ot,5*6e4),W=()=>{document.visibilityState==="visible"&&ot()};return document.addEventListener("visibilitychange",W),()=>{window.clearInterval(q),document.removeEventListener("visibilitychange",W)}},[Ue,ot]),b.useEffect(()=>{Ge&&Ue()},[Ge,Ue]);const $e=(re==null?void 0:re.notice)??null,[se,Se]=b.useState(null),De=b.useRef(!1);b.useEffect(()=>{if(De.current)return;const q=nF(),W=rF(q),ie=oF({stored:W,running:(re==null?void 0:re.running)??null,notes:h1,remembers:sF(q)});ie.reason!=="no-version"&&(De.current=!0,ie.record&&aF(q,ie.record),ie.show.length&&Se({entries:ie.show,since:W,firstRun:ie.reason==="welcome"}))},[re==null?void 0:re.running]);const _e=(re==null?void 0:re.running)??"3.18.1",Be=b.useMemo(()=>dR(h1,null,_e),[_e]),_t=b.useCallback(()=>{Se({entries:Be,since:null,firstRun:!1})},[Be]),[vt,Ae]=b.useState(null),[it,wt]=b.useState(_w);b.useEffect(()=>{let q=!1;return fetch("/api/health").then(W=>W.ok?W.json():null).then(W=>{q||(wt(X8(W)),!(!W||typeof W.workspace!="string")&&Ae(W.workspace))}).catch(()=>{}),()=>{q=!0}},[Ge]);const xt=b.useRef(it);xt.current=it;const nn=$e?`${$e.kind}:${$e.to}`:"",rn=$e!=null&&ft!==nn,In=b.useCallback(()=>{ut("");try{window.localStorage.setItem(Wv,"")}catch{}},[]),Da=b.useCallback(()=>{if($e){ut(nn);try{window.localStorage.setItem(Wv,nn)}catch{}}},[$e,nn]),[qa,Fa]=b.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Yj)??""}catch{return""}}),wn=re!=null&&re.invokedAs&&re.invokedAs!==Ut?re.invokedAs:null,Bs=wn!=null&&qa!==wn,za=b.useCallback(()=>{if(wn){Fa(wn);try{window.localStorage.setItem(Yj,wn)}catch{}}},[wn]),$t=((Di=re==null?void 0:re.upgrade)==null?void 0:Di.state)??"idle",mr=f5(re==null?void 0:re.upgrade),Kn=b.useRef(!1),li=b.useCallback(async()=>{if(ur(Kn.current||$t==="running")){Kn.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Ue(),Kn.current=!1}},[$t,Ue]);b.useEffect(()=>{if($t!=="running")return;const q=window.setInterval(Ue,3e3);return()=>window.clearInterval(q)},[$t,Ue]);const Rr=b.useCallback(async()=>{const q=re==null?void 0:re.command;!q||!await iR(q)||(Ye(!0),window.setTimeout(()=>Ye(!1),1600))},[re==null?void 0:re.command]),Ar=b.useCallback(()=>{O(q=>(q||Q(!1),!q))},[]),Mr=b.useCallback(()=>{Q(q=>(q||O(!1),!q))},[]),[is,Us]=b.useState(!1),[Ba,Ws]=b.useState(!1),[$n,Ua]=b.useState(()=>{try{return Number(localStorage.getItem(g1))||0}catch{return 0}}),[Hs,ci]=b.useState([]),[Ir,Gs]=b.useState(!1);b.useEffect(()=>{let q=!0;const W=()=>{fetch("/api/browser-watch?live=0").then(de=>de.ok?de.json():null).then(de=>{var je;!q||!(de!=null&&de.ok)||(ci(de.episodes??[]),Gs(((je=de.settings)==null?void 0:je.enabled)===!0))}).catch(()=>{})};W();const ie=setInterval(W,5*6e4);return()=>{q=!1,clearInterval(ie)}},[]);const[Wa,$r]=b.useState([]),Vs=b.useRef(new Set),[ls,dt]=b.useState(null);b.useEffect(()=>{let q=!0;const W=()=>{fetch("/api/lan").then(de=>de.ok?de.json():null).then(de=>{!q||!(de!=null&&de.ok)||$r(Array.isArray(de.pending)?de.pending:[])}).catch(()=>{})};W();const ie=setInterval(W,5e3);return()=>{q=!1,clearInterval(ie)}},[]);const Ha=b.useCallback(async(q,W)=>{if(!ls){dt(q);try{const de=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:q,fp:W})})).json().catch(()=>null);de&&Array.isArray(de.pending)?$r(de.pending):$r(je=>je.filter(Re=>Re.fp!==W))}catch{}finally{dt(null)}}},[ls]),On=b.useMemo(()=>KF(Hs,$n).length,[Hs,$n]),[Ga,Or]=b.useState(0),Ys=b.useRef(null),[Va,Pr]=b.useState(!1),qt=b.useRef(null),[Ks,on]=b.useState(0),xn=b.useState(()=>EF({protect:q=>BL(s.current,q)}))[0],[Ya,Td]=b.useState(!1),cs=b.useCallback(()=>{const q=xn.paused&&xn.dropped>0,W=xn.setPaused(!xn.paused);q&&UL(s.current);for(const ie of W)s.current=mk(s.current,ie);Td(xn.paused)},[xn]),[St,Xs]=b.useState(Date.now()),[Pn,Rd]=b.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(Kj)!=="0"}catch{return!0}}),Ad=b.useCallback(()=>{Rd(q=>{const W=!q;try{window.localStorage.setItem(Kj,W?"1":"0")}catch{}return W})},[]),[Ln,Qs]=b.useState(!1),[ui,Zs]=b.useState("restart"),[Xl,Ka]=b.useState(null),Ze=b.useRef(!1),di=b.useRef(null),hi=b.useRef(0),us=b.useCallback(async q=>{if(!ur(Ze.current))return;const W=(q==null?void 0:q.upgrade)===!0;Ze.current=!0,di.current=mr;const ie=++hi.current;Zs(W?"npx":"restart"),Qs(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",($e==null?void 0:$e.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:W})})}catch{}window.setTimeout(()=>{if(hi.current===ie&&Ze.current){Ze.current=!1,Qs(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},W?18e4:3e4)},[$e==null?void 0:$e.to,mr]),Xa=b.useRef(null);b.useEffect(()=>{const q=i1(s.current.agents.values())>0,W=v5({enabled:Pn,kind:$e==null?void 0:$e.kind,canRestart:(re==null?void 0:re.canRestart)===!0,noticeOpen:rn,visible:document.visibilityState==="visible",busy:q,idleSince:Xa.current,now:St});Xa.current=W.idleSince,W.restart&&us()},[Pn,$e==null?void 0:$e.kind,re==null?void 0:re.canRestart,rn,St,us]);const fi=i1(s.current.agents.values()),pi=y5(fi),Qa=oR({enabled:Pn,kind:$e==null?void 0:$e.kind,canRestart:(re==null?void 0:re.canRestart)===!0,noticeOpen:rn,visible:document.visibilityState==="visible",busy:fi>0,idleSince:Xa.current,now:St});b.useEffect(()=>{const q=re==null?void 0:re.running;let W=null,ie=null;try{W=window.sessionStorage.getItem("agent-dag.restartPending"),ie=window.sessionStorage.getItem(Xj)}catch{return}const de=h5({bundle:"3.18.1",running:q,pending:W,lastTried:ie});if(de==="reload"){try{window.sessionStorage.setItem(Xj,q??"")}catch{return}window.location.reload();return}if(de!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Ze.current=!1,Qs(!1),Ka(q??null);const je=window.setTimeout(()=>Ka(null),6e3);return()=>window.clearTimeout(je)},[re==null?void 0:re.running]),b.useEffect(()=>{if(Ln&&p5({asked:di.current,reported:mr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Ze.current=!1,Qs(!1)}},[Ln,mr]);const Js=b.useState(()=>F8(bU()))[0],Nt=b.useRef(Js.pinned),bn=b.useRef(null),kn=b.useState(()=>kU())[0],[Lr,ea]=b.useState(()=>new Set),[ln,Ql]=b.useState(CF),[Xn,ta]=b.useState(()=>zj(Wj)),Zl=b.useMemo(()=>D8(Xn),[Xn]),Jl=b.useCallback(q=>L8(q,Zl),[Zl]),Za=b.useMemo(()=>({background:Xn["--panel"],border:`1px solid ${Xn["--line"]}`,borderRadius:8}),[Xn]),[mi,Md]=b.useState(!1);b.useEffect(()=>{document.documentElement.dataset.theme=ln;try{window.localStorage.setItem(mR,ln)}catch{}ta(q=>{const W=zj(Wj);return q8(q,W)?q:W})},[ln]);const _n=b.useCallback((q,W)=>{if(Bv({durationMs:W,documentHidden:document.hidden})){e.setViewport(q,{duration:W});return}const{d3Zoom:ie,d3Selection:de}=t.getState(),je=de==null?void 0:de.property("__zoom");if(ie&&de&&je&&je.k>0&&q.zoom>0){ie.transform(de,je.scale(q.zoom/je.k).translate((q.x-je.x)/q.zoom,(q.y-je.y)/q.zoom));return}e.setViewport(q,{duration:0})},[e,t]),Qn=b.useRef(null);b.useEffect(()=>{if(!kn)return;const q=window.setTimeout(()=>{try{_n(kn,0)}catch{}Zn.current=Date.now()},60);return()=>window.clearTimeout(q)},[_n,kn]);const Dr=b.useRef(!0);b.useEffect(()=>{const q=new EventSource("/events"),W=SF(i,{now:()=>Date.now(),setTimeout:(ie,de)=>window.setTimeout(ie,de),clearTimeout:ie=>window.clearTimeout(ie)});return q.addEventListener("open",()=>{be(!0),Md(!0)}),q.addEventListener("error",()=>be(!1)),q.addEventListener("replay-end",()=>{Dr.current=!1,W.flush()}),q.addEventListener("hook",ie=>{var de;try{const je=JSON.parse(ie.data);if(!xn.accept(je))return;s.current=mk(s.current,je);const Re=je.replay===!0||Dr.current||Date.now()-je.receivedAt>3e4;Re?W.replay():W.live();const He=z5(je,Re);He&&((de=Le.current)==null||de.play(He))}catch{}}),()=>{q.close(),W.cancel()}},[i]),b.useEffect(()=>{const q=setInterval(()=>{const W=Date.now();Xs(W);let ie=WL(s.current,W,pk);HL(s.current,W,pk)&&(ie=!0),FL(s.current,W,iU,lU)&&(ie=!0),zL(s.current,W,cU,uU)&&(ie=!0),d(de=>mF(de,s.current.agents)),p(de=>de!=null&&!s.current.agents.has(de)?null:de),_(de=>de!=null&&!s.current.agents.has(de)?null:de),k(de=>de!=null&&!s.current.agents.has(de)?null:de),ie&&i()},250);return()=>clearInterval(q)},[i]);const ds=b.useRef(null),Zn=b.useRef(0),Id=420,cn=b.useCallback((q=500)=>{try{const Re=document.querySelector(".canvas-wrap"),He=Array.from(document.querySelectorAll(".react-flow__node")).filter(mt=>mt.offsetWidth>0);if(!Re||He.length===0)return;const et=Re.getBoundingClientRect(),rt=e.getViewport();if(!Number.isFinite(rt.zoom)||rt.zoom<=0)return;const st=mt=>(mt-et.left-rt.x)/rt.zoom,Kt=mt=>(mt-et.top-rt.y)/rt.zoom,ho=He.map(mt=>mt.getBoundingClientRect()),hc=Math.min(...ho.map(mt=>st(mt.left))),da=Math.max(...ho.map(mt=>st(mt.right))),fc=Math.min(...ho.map(mt=>Kt(mt.top))),pc=Math.max(...ho.map(mt=>Kt(mt.bottom))),qi=da-hc,lt=pc-fc;if(!(qi>0&<>0))return;const Hr=Math.max(.2,Math.min(1,(et.width-160)/(qi+Id)*.86,(et.height-160)/lt*.86)),xr={x:80-hc*Hr,y:Math.max(80,(et.height-lt*Hr)/2)-fc*Hr,zoom:Hr};_n(xr,q),Zn.current=Date.now(),Qn.current=Bv({durationMs:q,documentHidden:document.hidden})?{target:xr,until:Date.now()+q+60}:null,window.setTimeout(()=>{var mt;try{((mt=Qn.current)==null?void 0:mt.target)===xr&&(Qn.current=null);const Fi=e.getViewport();(Math.abs(Fi.zoom-Hr)>.01||Math.abs(Fi.x-xr.x)>2)&&_n(xr,0)}catch{}},q+60)}catch{}},[e,_n]);b.useEffect(()=>{const q=()=>{if(!document.hidden)return;const W=Qn.current;if(Qn.current=null,!(!W||Date.now()>W.until)){try{_n(W.target,0)}catch{}Zn.current=Date.now()}};return document.addEventListener("visibilitychange",q),()=>document.removeEventListener("visibilitychange",q)},[_n]);const hs=b.useRef(""),na=b.useRef(null),gi=b.useRef(0),Sn=b.useCallback(()=>{gi.current=Date.now()},[]),ra=b.useRef(null),sa=b.useRef(0),Ja=b.useCallback(()=>{sa.current=Date.now()},[]),aa=b.useCallback(q=>({hasSourceEvent:!!q,at:Date.now(),lastDeckFitAt:Zn.current,lastCanvasInputAt:sa.current}),[]),fs="agent-dag.autoFitDisabled",yi=b.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(fs)==="1"}catch{return!1}})[0],Tt=b.useRef(yi),[qr,eo]=b.useState(yi),Fr=b.useCallback(()=>{if(!Tt.current){Tt.current=!0,eo(!0);try{window.localStorage.setItem(fs,"1")}catch{}}},[]),$d=b.useCallback(()=>{Tt.current=!1,eo(!1);try{window.localStorage.removeItem(fs)}catch{}cn(400)},[e,cn]);b.useEffect(()=>{const q=setInterval(()=>{if(Tt.current||Date.now()-gi.current<800)return;const W=s.current,ie=Date.now(),de=[];for(const Re of W.agents.values())kw(Re,ie)&&de.push({id:Re.id});if(de.length===0)return;const je=[];for(const{id:Re}of de){const He=gr.current.get(Re),et=Nt.current.get(Re)??un.current.get(Re);!He||!et||je.push({x:et.x,y:et.y,width:He.width,height:He.height})}W8({pane:ra.current,viewport:e.getViewport(),boxes:je})&&cn(600)},1500);return()=>clearInterval(q)},[e]);const oa=b.useRef(!1),gr=b.useRef(new Map),ps=b.useRef(0),to=b.useCallback(q=>{const W=gr.current;let ie=!1;for(const de of q.nodeInternals.values()){const je=de.width,Re=de.height;if(je==null||Re==null)continue;const He=W.get(de.id);He?(Math.abs(He.height-Re)>4||Math.abs(He.width-je)>4)&&(W.set(de.id,{width:je,height:Re}),ie=!0):(W.set(de.id,{width:je,height:Re}),ie=!0)}return ie&&(ps.current+=1),ps.current},[]),vi=ct(to),[ec,Od]=b.useState(0);b.useEffect(()=>{let q=0;const W=()=>{const de=gr.current;let je=!1;for(const Re of document.querySelectorAll(".react-flow__node[data-id]")){const He=Re.getAttribute("data-id");if(!He)continue;const et=Re.offsetWidth,rt=Re.offsetHeight;if(!et||!rt)continue;const st=de.get(He);(!st||Math.abs(st.width-et)>4||Math.abs(st.height-rt)>4)&&(de.set(He,{width:et,height:rt}),je=!0)}je&&Od(Re=>Re+1)};if(oa.current)return;let ie=0;return document.visibilityState==="hidden"?ie=window.setTimeout(W,32):q=requestAnimationFrame(W),()=>{cancelAnimationFrame(q),window.clearTimeout(ie)}});const un=b.useRef(Js.positions),wi=b.useRef(new Set),xi=b.useRef(""),ms=b.useMemo(()=>{const q=[];for(const W of s.current.agents.values())kw(W,St)&&q.push(W.id+(W.parentId?`>${W.parentId}`:""));return q.sort(),`${q.join("|")}#sv${vi}.${ec}`},[s.current,s.current.revision,St,vi,ec]),ia=b.useRef(null);b.useEffect(()=>(ia.current!=null&&window.clearTimeout(ia.current),ia.current=window.setTimeout(()=>{Gv(un.current,Nt.current)},1500),()=>{ia.current!=null&&window.clearTimeout(ia.current)}),[ms]),b.useEffect(()=>{if(hs.current===ms)return;const q=hs.current;if(hs.current=ms,!q||Tt.current)return;Date.now()-Zn.current>1200&&cn(400),ds.current&&window.clearTimeout(ds.current),ds.current=window.setTimeout(()=>{Tt.current||cn(500)},280)},[ms,e,cn]);const bi=b.useMemo(()=>vF(s.current,l),[s.current,s.current.revision,l]),ki=b.useMemo(()=>$8(s.current,St),[s.current,s.current.revision,St]),_i=b.useRef(null),[no,tc]=b.useState({w:0,h:0});b.useEffect(()=>{const q=_i.current;if(!q||typeof ResizeObserver>"u")return;const W=new ResizeObserver(ie=>{var je;const de=(je=ie[0])==null?void 0:je.contentRect;de&&(ra.current={width:de.width,height:de.height},tc(Re=>Math.abs(Re.w-de.width)>40||Math.abs(Re.h-de.height)>40?{w:de.width,h:de.height}:Re))});return W.observe(q),ra.current={width:q.clientWidth,height:q.clientHeight},tc({w:q.clientWidth,h:q.clientHeight}),()=>W.disconnect()},[]);const Pd=b.useCallback(q=>{var ie,de;const W=q.target;!(W!=null&&W.closest)||W.closest(aU)!==q.currentTarget||(q.preventDefault(),(de=(ie=document.activeElement)==null?void 0:ie.blur)==null||de.call(ie))},[]),Ld=b.useRef(new Map),[ro,Dd]=b.useState(!1);b.useEffect(()=>{const q=window.setTimeout(()=>Dd(!0),2500);return()=>window.clearTimeout(q)},[]);const[qd,Si]=b.useState(!1),Jn=b.useRef(null),[Ni,nc]=b.useState(!1),Fd=b.useCallback(()=>{Jn.current&&(window.clearTimeout(Jn.current),Jn.current=null),Si(!1)},[]),zd=b.useCallback(q=>{q.length!==0&&queueMicrotask(()=>{Si(!0),Jn.current&&window.clearTimeout(Jn.current),Jn.current=window.setTimeout(()=>Si(!1),oU+80)})},[]);b.useEffect(()=>()=>{Jn.current&&window.clearTimeout(Jn.current)},[]);const rc=no.w>0?no.w*.92:0,sc=no.h>0?no.h:0,{nodes:yr,edges:Ei}=b.useMemo(()=>NU(s.current,St,rc,sc,Nt.current,gr.current,Ld.current,zd,ro,Ni,un.current,wi.current,ms,xi,l,bi,ki,S),[s.current,s.current.revision,St,rc,sc,ro,Ni,ms,l,bi,ki,S,Ga]),gs=b.useMemo(()=>{const q=new Map;for(const ie of yr){const de=ie.data;if(!(de!=null&&de.sessionId)||de.exitAt!=null)continue;const je=ie.width,Re=ie.height;if(je==null||Re==null)continue;const He=ie.position.x,et=ie.position.y,rt=He+je,st=et+Re,Kt=q.get(de.sessionId);Kt?(Kt.minX=Math.min(Kt.minX,He),Kt.minY=Math.min(Kt.minY,et),Kt.maxX=Math.max(Kt.maxX,rt),Kt.maxY=Math.max(Kt.maxY,st)):q.set(de.sessionId,{minX:He,minY:et,maxX:rt,maxY:st})}const W=[];for(const[ie,de]of q){const je=de.maxX-de.minX+Nu*2,Re=de.maxY-de.minY+Nu*2;W.push({id:`group:${ie}`,type:vA,position:{x:de.minX-Nu,y:de.minY-Nu},data:{sessionId:ie,w:je,h:Re},width:je,height:Re,style:{width:je,height:Re},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return W},[yr,St]),Bd=b.useMemo(()=>{const q=[...gs,...yr],W=qt.current;return!W||W.size===0?q:q.map(ie=>{const de=W.get(ie.id);return de?{...ie,position:de}:ie})},[gs,yr,Ks]),la=b.useMemo(()=>{const q=new Set;for(const W of s.current.agents.values())for(const ie of W.tools)q.add(jA(ie.name));return Object.keys(Sw).filter(W=>q.has(W))},[s.current,s.current.revision]);b.useEffect(()=>{if(la.length<=1){Pr(!1);return}let q=0;const W=()=>{const ie=Ys.current;if(ie&&!document.hidden){const de=ie.getBoundingClientRect(),je=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(He=>He.getBoundingClientRect()),Re=P8(de,je,8);Pr(He=>He===Re?He:Re)}q=window.setTimeout(W,300)};return W(),()=>window.clearTimeout(q)},[la.length]);const ac=b.useCallback(q=>{ea(W=>{const ie=new Set(W);return ie.has(q)?ie.delete(q):ie.add(q),ie})},[]),Yt=f?s.current.agents.get(f):null,so=h?Array.from(s.current.agents.values()).flatMap(q=>q.tools).find(q=>q.id===h)??null:null,ji=b.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=cw(),Nt.current.clear(),gr.current.clear(),un.current.clear(),xi.current="",Zj(),w(),i()},[i,w]),zr=b.useRef(j);zr.current=j;const oc=b.useRef(M);oc.current=M;const Ci=b.useRef(!1);Ci.current=so!=null||is||E!=null||N!=null||Ba||M||se!=null;const ao=b.useCallback(q=>{const W=w5(q,{confirmOpen:zr.current,modalOpen:Ci.current});W==="confirm"?C(!0):W==="clear"&&(C(!1),ji())},[ji]),oo=b.useCallback(()=>{Nt.current.clear(),un.current.clear(),xi.current="",Zj(),i(),window.setTimeout(()=>cn(500),80)},[i,e,cn]),Ti=b.useCallback(()=>cn(500),[cn]),vr=b.useRef(yr);vr.current=yr;const ys=b.useRef(f);ys.current=f;const Ri=b.useCallback(q=>{const W=vr.current,ie=uF(W.map(Re=>({id:Re.id,x:Re.position.x,y:Re.position.y})),ys.current,q),de=ie?W.find(Re=>Re.id===ie):void 0;if(!de)return;const je=Hj(document.activeElement);y(de.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[de]})}catch{}Zn.current=Date.now(),je&&sU(de.id)},30)},[y,e]),vs=b.useCallback(q=>{y(q,!1),window.setTimeout(()=>{try{const W=vr.current.find(ie=>ie.id===q);W&&e.fitView({padding:.3,duration:500,nodes:[W]}),Zn.current=Date.now()}catch{}},60)},[y,e]);b.useEffect(()=>{const q=W=>{var et,rt;const ie=W.target,de={tagName:ie==null?void 0:ie.tagName,isContentEditable:ie==null?void 0:ie.isContentEditable,role:(et=ie==null?void 0:ie.getAttribute)==null?void 0:et.call(ie,"role"),type:ie==null?void 0:ie.type};if(W.key==="Escape"){const st=x3({overlayOpen:Hu.depth()>0,typing:Xw(de)});st==="dismiss"?Hu.dismissTop():st==="blur"?ie==null||ie.blur():(pF(de)&&(ie==null||ie.blur()),w());return}if(Kw(W))return;const je=Hj(ie)?(rt=ie==null?void 0:ie.getAttribute)==null?void 0:rt.call(ie,"data-id"):null,Re=je&&vr.current.some(st=>st.id===je)?je:null,He=hF(W,Re);if(He.kind==="activate"){W.preventDefault(),y(He.nodeId,He.additive);return}He.kind!=="node"&&(He.nodeId==null&&C3(de)||T3({key:W.key,modalOpen:Ci.current,sheetOpen:oc.current})||(W.key===" "&&(W.preventDefault(),cs()),(W.key==="c"||W.key==="C")&&ao("shortcut"),(W.key==="r"||W.key==="R")&&oo(),(W.key==="f"||W.key==="F")&&Ti(),(W.key==="l"||W.key==="L")&&Ar(),(W.key==="d"||W.key==="D")&&D(st=>!st),(W.key==="h"||W.key==="H")&&Us(st=>!st),(W.key==="u"||W.key==="U")&&X(st=>!st),(W.key==="a"||W.key==="A")&&xt.current.claude&&Mr(),(W.key==="j"||W.key==="J")&&Ri(1),(W.key==="k"||W.key==="K")&&Ri(-1),(W.key==="t"||W.key==="T")&&Ql(st=>st==="dark"?"light":"dark"),(W.key==="m"||W.key==="M")&&xt.current.claude&&ue.current!==null&&K.current(W.shiftKey),W.key==="?"&&$(st=>!st)))};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[ao,oo,Ti,w,y,Ri,cs]);const ic=s.current.agents.size,Ot=b.useMemo(()=>d3(s.current.agents.values()),[s.current,s.current.revision]),io=b.useMemo(()=>h3(s.current.agents.values()),[s.current,s.current.revision]),lo=b.useRef(null);b.useEffect(()=>{const q=TF({waiting:Ot.length,running:io,connected:Ge}),W=lo.current;if(lo.current=q,(W==null?void 0:W.title)!==q.title&&(document.title=q.title),(W==null?void 0:W.icon)!==q.icon){const ie=document.querySelector('link[rel="icon"]');ie&&(ie.href=RF[q.icon])}},[Ot.length,io,Ge]);const[lc,cc]=b.useState(""),Ai=MF(Ot);b.useEffect(()=>{cc(q=>IF(q,Ai))},[Ai]);const[ca,Ud]=b.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[Br,Mi]=b.useState(null),[Wd,Nn]=b.useState(!1),[En,co]=b.useState(!0),[uc,Ii]=b.useState(!1);b.useEffect(()=>{let q=!0;return fetch("/api/prefs").then(W=>W.ok?W.json():null).then(W=>{var ie;!q||!(W!=null&&W.ok)||(co(((ie=W.prefs)==null?void 0:ie.notifications)!==!1),Ii(W.notificationsVetoed===!0))}).catch(()=>{}),()=>{q=!1}},[]);const $i=b.useRef(()=>{}),Oi=b.useCallback(()=>{const q=!En;co(q),q&&typeof Notification<"u"&&Notification.permission==="default"&&$i.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:q})}).then(W=>W.ok?W.json():null).then(W=>{var ie;W!=null&&W.ok&&(co(((ie=W.prefs)==null?void 0:ie.notifications)!==!1),Ii(W.notificationsVetoed===!0))}).catch(()=>{})},[En]),dc=typeof Notification<"u",Pi=y3(ca,dc);b.useEffect(()=>{Pi&&En&&Ot.length>0&&Nn(!0)},[Pi,En,Ot.length]),b.useEffect(()=>{if(!Br)return;const W=setTimeout(()=>Mi(null),Br==="blocked"?8e3:4e3);return()=>clearTimeout(W)},[Br]);const wr=b.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(q=>{const W=q;Ud(W),W==="granted"?Mi("on"):W==="denied"&&Mi("blocked")})},[]);$i.current=wr;const ws=b.useRef(new Set),Ur=b.useRef(null),Li=Ot.map(q=>id(q.id,q.waiting)).join("|");return b.useEffect(()=>{g3(Ur.current,ca)&&(Ur.current=ca,ws.current=vk(Ot))},[ca]),b.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||Ur.current===null)return;const q=typeof document>"u"||!document.hidden,W=p3(Ot,ws.current,q,En);for(const ie of W)try{const de=new Notification(ie.title,{body:ie.body,tag:ie.key});de.onclick=()=>{window.focus(),vs(ie.sessionId),de.close()}}catch{}ws.current=q?vk(Ot):m3(Ot,W,ws.current)},[Li]),c.jsxs("div",{className:"app",children:[c.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),c.jsxs("header",{className:"topbar",children:[c.jsxs("div",{className:"readout",children:[c.jsxs("div",{className:"brand",children:[c.jsx("span",{className:"logo"}),c.jsx("h1",{children:Ut}),$e?c.jsxs("button",{type:"button",className:"v stale",onClick:()=>{_t(),In()},"aria-haspopup":"dialog","aria-label":Y8({...$e,open:rn}),title:$e.kind==="restart"?`Running v${$e.from}; v${$e.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${$e.from}; v${$e.to} is on npm · click for what's new`,children:["v",$e.from,c.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const q={running:_e,latest:re==null?void 0:re.latest,latestPending:re==null?void 0:re.latestPending,checkedAgo:re!=null&&re.checkedAt?mw(St-re.checkedAt):null,checkDisabled:re==null?void 0:re.checkDisabled,checking:we};return c.jsxs("button",{type:"button",className:we?"v checking":"v",onClick:()=>{_t(),Ue(!0)},"aria-busy":we||void 0,"aria-haspopup":"dialog","aria-label":V8(q),title:G8(q),children:["v",q.running]})})()]}),c.jsx("span",{className:"status",children:(()=>{const q=nU({connected:Ge,paused:Ya,held:xn.size,dropped:xn.dropped});return q.resting?null:c.jsx("span",{className:`pill ${q.tone}`,title:q.title,children:c.jsxs("span",{className:"pill-box",children:[c.jsx("span",{className:"pill-widest","aria-hidden":!0,children:q.widest}),c.jsx("span",{className:"pill-label",children:q.label})]})})})()}),c.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:lc}),Ot.length>0&&c.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>vs(Ot[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
254
254
|
${Ot.map(q=>` ${q.label}: ${Tl(q.waiting)} (${mw(St-q.waiting.since)})`).join(`
|
|
255
|
-
`)}`,"aria-label":`${Ot.length} session${Ot.length===1?"":"s"} waiting for you`,children:[c.jsx("span",{className:"ap-pulse","aria-hidden":!0}),c.jsx("b",{children:Ot.length})," waiting"]}),Wd&&Pi&&En&&c.jsx("button",{type:"button",className:"notify-ask",onClick:wr,title:"Get a system notification when a session blocks on you, so the deck can reach you with this tab in the background",children:"notify me"}),Br&&c.jsx("span",{className:Br==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:Br==="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:Br==="on"?"notifications on":"notifications blocked"})]}),Yt&&(()=>{const q=An(Yt),W=Math.max(0,((Yt.endedAt??St)-Yt.startedAt)/1e3),ie=Yt.state==="active"?Yw(q.total,W):null,de=l.size-1;return c.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${Yt.label}`,onClick:()=>{try{const je=yr.find(Re=>Re.id===Yt.id);je&&e.fitView({padding:.35,duration:500,nodes:[je]}),Zn.current=Date.now()}catch{}},children:[c.jsx("span",{className:`state-pill state-${Yt.state}`,children:Yt.state==="active"?"live":Yt.state}),c.jsx("span",{className:"selected-label",children:Yt.label}),q.total>0&&c.jsxs("span",{className:"selected-cost",children:[Je(q.total),ie?c.jsxs("span",{className:"selected-rate",children:[" · ",ie]}):null]}),de>0&&c.jsxs("span",{className:"selected-extra",children:["+",de]}),c.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:je=>{je.stopPropagation(),w()},children:"×"})]})})(),c.jsxs("div",{className:"actions",children:[c.jsxs("div",{className:"action-run",children:[c.jsx("button",{className:"btn icon-btn",onClick:Ar,title:`${z?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":z,"aria-controls":z?"session-list":void 0,children:"☰"}),c.jsx("button",{className:"btn icon-btn",onClick:()=>X(q=>!q),title:`${H?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":H,"aria-controls":H?"usage-panel":void 0,children:"$"}),it.claude&&c.jsx("button",{className:"btn icon-btn",onClick:Mr,title:`${B?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":B,"aria-controls":B?"accounts-panel":void 0,children:c.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:[c.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),c.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),c.jsx("button",{className:"btn icon-btn",onClick:()=>Z(q=>!q),title:`${R?"Hide":"Show"} this machine — cores, memory, temperature`,"aria-label":"Toggle machine detail","aria-expanded":R,"aria-controls":R?"system-panel":void 0,children:c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[c.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),c.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"})]})}),c.jsx("button",{className:"btn icon-btn",onClick:()=>Us(q=>!q),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[c.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),c.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),c.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),c.jsxs("button",{className:`btn icon-btn bw-btn${On>0?" has-findings":Ir?" watching":""}`,onClick:()=>Ws(q=>!q),title:Ir?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${Ir?"watching":"not watching"}`+(On>0?`, ${On} unread`:""),"aria-haspopup":"dialog",children:[c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":!0,children:[c.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"}),Ir||On>0?c.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):c.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),On>0&&c.jsx("span",{className:"bw-badge","aria-hidden":!0,children:On})]})]}),c.jsxs("div",{className:"action-run",children:[it.claude&&P!==null&&c.jsxs("div",{className:"sound-slot",children:[c.jsx("button",{ref:Ve,className:"btn icon-btn",onClick:()=>ke(q=>!q),...cr(!1),title:
|
|
255
|
+
`)}`,"aria-label":`${Ot.length} session${Ot.length===1?"":"s"} waiting for you`,children:[c.jsx("span",{className:"ap-pulse","aria-hidden":!0}),c.jsx("b",{children:Ot.length})," waiting"]}),Wd&&Pi&&En&&c.jsx("button",{type:"button",className:"notify-ask",onClick:wr,title:"Get a system notification when a session blocks on you, so the deck can reach you with this tab in the background",children:"notify me"}),Br&&c.jsx("span",{className:Br==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:Br==="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:Br==="on"?"notifications on":"notifications blocked"})]}),Yt&&(()=>{const q=An(Yt),W=Math.max(0,((Yt.endedAt??St)-Yt.startedAt)/1e3),ie=Yt.state==="active"?Yw(q.total,W):null,de=l.size-1;return c.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${Yt.label}`,onClick:()=>{try{const je=yr.find(Re=>Re.id===Yt.id);je&&e.fitView({padding:.35,duration:500,nodes:[je]}),Zn.current=Date.now()}catch{}},children:[c.jsx("span",{className:`state-pill state-${Yt.state}`,children:Yt.state==="active"?"live":Yt.state}),c.jsx("span",{className:"selected-label",children:Yt.label}),q.total>0&&c.jsxs("span",{className:"selected-cost",children:[Je(q.total),ie?c.jsxs("span",{className:"selected-rate",children:[" · ",ie]}):null]}),de>0&&c.jsxs("span",{className:"selected-extra",children:["+",de]}),c.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:je=>{je.stopPropagation(),w()},children:"×"})]})})(),c.jsxs("div",{className:"actions",children:[c.jsxs("div",{className:"action-run",children:[c.jsx("button",{className:"btn icon-btn",onClick:Ar,title:`${z?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":z,"aria-controls":z?"session-list":void 0,children:"☰"}),c.jsx("button",{className:"btn icon-btn",onClick:()=>X(q=>!q),title:`${H?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":H,"aria-controls":H?"usage-panel":void 0,children:"$"}),it.claude&&c.jsx("button",{className:"btn icon-btn",onClick:Mr,title:`${B?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":B,"aria-controls":B?"accounts-panel":void 0,children:c.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:[c.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),c.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),c.jsx("button",{className:"btn icon-btn",onClick:()=>Z(q=>!q),title:`${R?"Hide":"Show"} this machine — cores, memory, temperature`,"aria-label":"Toggle machine detail","aria-expanded":R,"aria-controls":R?"system-panel":void 0,children:c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[c.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),c.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"})]})}),c.jsx("button",{className:"btn icon-btn",onClick:()=>Us(q=>!q),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[c.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),c.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),c.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),c.jsxs("button",{className:`btn icon-btn bw-btn${On>0?" has-findings":Ir?" watching":""}`,onClick:()=>Ws(q=>!q),title:Ir?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${Ir?"watching":"not watching"}`+(On>0?`, ${On} unread`:""),"aria-haspopup":"dialog",children:[c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":!0,children:[c.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"}),Ir||On>0?c.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):c.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),On>0&&c.jsx("span",{className:"bw-badge","aria-hidden":!0,children:On})]})]}),c.jsxs("div",{className:"action-run",children:[it.claude&&P!==null&&c.jsxs("div",{className:"sound-slot",children:[c.jsx("button",{ref:Ve,className:"btn icon-btn",onClick:()=>ke(q=>!q),...cr(!1),title:FF(it,{on:P===!0,locked:qe==="locked",prefs:G}),"aria-label":"Sound settings","aria-haspopup":"dialog","aria-expanded":me,"aria-controls":me?"sound-menu":void 0,children:c.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:[c.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),P?c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),c.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M10 5.6l2.6 2.8"}),c.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),me&&c.jsx(V5,{onClose:()=>ke(!1),soundOn:P===!0,onToggleSound:J,prefs:G,onLevel:(q,W)=>fe(q,{level:W}),onFigure:(q,W)=>fe(q,{figure:W}),onPreview:q=>le(q),notifyOn:En,onToggleNotify:Oi,notifyVetoed:uc,notifyPermission:dc?ca:"unsupported",onAskNotify:wr,openerRef:Ve})]}),c.jsx("button",{className:"btn icon-btn",onClick:()=>Ql(q=>q==="dark"?"light":"dark"),title:`Switch to ${ln==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:ln==="dark"?"☀":"☾"})]})]})]}),Xl?c.jsxs("div",{className:"ver-banner done",role:"status",children:[c.jsx("span",{className:"ver-dot"}),c.jsxs("strong",{children:["Restarted — now running v",Xl,"."]}),c.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):mi&&!Ge?c.jsxs("div",{className:"conn-banner",role:"alert",children:[c.jsx("span",{className:"conn-dot"}),Ln?ui==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Ut}…`:(()=>{const q=eU({connected:Ge,paused:Ya});return c.jsxs(c.Fragment,{children:[`Lost connection to the ${Ut} server. Reconnecting…`,q&&c.jsx("span",{className:"conn-sub",children:q})]})})()]}):rn&&$e?c.jsxs("div",{className:`ver-banner ${$e.kind}`,role:"status",children:[c.jsx("span",{className:`ver-dot${Qa==null?"":" armed"}`}),$e.kind==="restart"?c.jsxs(c.Fragment,{children:[c.jsxs("strong",{children:["v",$e.to," is installed — this deck still runs v",$e.from,"."]}),re!=null&&re.canRestart?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"ver-act",onClick:()=>us(),...cr(Ln),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
256
256
|
|
|
257
|
-
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:Ln?"restarting…":pi.label}),!Ln&&c.jsx("span",{className:"ver-sub",children:pi.clause}),c.jsxs("button",{type:"button",className:`ver-auto${Pn?" on":""}`,role:"switch","aria-checked":Pn,onClick:Ad,"aria-label":"Auto-restart when idle",title:Pn?"Restarts on its own once nothing has been running for 30 seconds. Click to require a click instead.":"Only restarts when you click. Click to let it restart itself while idle.",children:[c.jsx("i",{"aria-hidden":!0}),c.jsx("span",{"aria-hidden":!0,children:p5(Pn,Qa)})]})]}):c.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."})]}):c.jsxs(c.Fragment,{children:[c.jsxs("strong",{children:[Ut," v",$e.to," is out — you are on v",$e.from,"."]}),(re==null?void 0:re.upgradeMode)==="install"&&$t!=="failed"&&c.jsx("button",{type:"button",className:"ver-act",onClick:li,...cr($t==="running",$t==="done"),title:`Runs ${((ua=re==null?void 0:re.upgrade)==null?void 0:ua.command)??(re==null?void 0:re.command)??"npm i -g"} here, then restarts once nothing is running.`,children:$t==="running"?"installing…":$t==="done"?"installed":"Update now"}),(re==null?void 0:re.upgradeMode)==="npx"&&(re==null?void 0:re.canRestart)&&c.jsx("button",{type:"button",className:"ver-act",onClick:()=>us({upgrade:!0}),...cr(Ln),title:`Runs ${re==null?void 0:re.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Ln?"fetching…":$t==="failed"?"Retry update":"Update & restart"}),$t==="failed"?c.jsxs("span",{className:"ver-sub fail",title:((Wr=re==null?void 0:re.upgrade)==null?void 0:Wr.error)??"",children:[(re==null?void 0:re.upgradeMode)==="npx"?"update failed":"install failed",": ",((uo=re==null?void 0:re.upgrade)==null?void 0:uo.error)??"unknown error"," — run it yourself:"]}):(re==null?void 0:re.upgradeMode)==="npx"?c.jsx("span",{className:"ver-sub",children:re!=null&&re.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Hv.npx}):re!=null&&re.upgradeBlocked?c.jsx("span",{className:"ver-sub",children:Object.hasOwn(Hv,re.upgradeBlocked)?Hv[re.upgradeBlocked]:"cannot install from here"}):null,c.jsxs("button",{type:"button",className:"ver-cmd",onClick:Rr,title:"Copy to clipboard",children:[c.jsx("code",{children:re==null?void 0:re.command}),c.jsx("span",{className:"ver-cmd-hint",children:at?"copied":"copy"})]})]}),c.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Da,children:"×"})]}):Bs&&wn?c.jsxs("div",{className:"ver-banner",role:"status",children:[c.jsx("span",{className:"ver-dot"}),c.jsxs("strong",{children:[wn," still works — the deck is called ",Ut," now."]}),re!=null&&re.renameFix?c.jsx("span",{className:"ver-sub",children:re.renameFix}):null,c.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:za,children:"×"})]}):null,H&&c.jsx(yD,{state:s.current,now:St,providers:it,onClose:()=>X(!1)}),B&&it.claude&&c.jsx(i5,{onClose:()=>Q(!1)}),R&&c.jsx(VD,{usageOpen:H,onClose:()=>Z(!1)}),z&&c.jsx(F4,{state:s.current,now:St,selectedIds:l,onSelect:vs,onClose:()=>O(!1)}),c.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${qd?" bubbling":""}${Ni?" dragging-any":""}`,ref:_i,onMouseDownCapture:Pd,onPointerDownCapture:Ja,onPointerUpCapture:Ja,onWheelCapture:Ja,children:[ic===0&&c.jsx(EU,{live:Ge,everConnected:mi,providers:it,workspace:vt}),(la.length>1||Lr.size>0)&&c.jsx("div",{ref:Ys,className:`cat-filter-bar${Va?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:la.map(q=>{const W=Lr.has(q);return c.jsxs("button",{type:"button",className:`cat-filter${W?" off":""}`,onClick:()=>ac(q),"aria-pressed":!W,title:`${W?"Show":"Hide"} ${Nw[q]} tools`,children:[c.jsx("span",{className:"cat-emoji",children:Sw[q]}),c.jsx("span",{className:"cat-name",children:Nw[q]})]},q)})}),c.jsxs(gT,{nodes:Bd,edges:Ei,nodeTypes:tU,fitView:!kn,fitViewOptions:{padding:.25,duration:Bv({durationMs:Hj,documentHidden:document.hidden})?Hj:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(q,W)=>{if(W.type==="sessionGroup"){w();return}y(W.id,q.shiftKey)},onPaneClick:()=>w(),onMoveStart:q=>{zj(aa(q))&&Fr()},onMove:(q,W)=>{Sn(),zj(aa(q))&&Fr(),na.current&&window.clearTimeout(na.current),na.current=window.setTimeout(()=>bU(W),250)},onNodeDragStart:(q,W)=>{var ie;if(Fd(),oa.current=!0,qt.current=new Map,nc(!0),Sn(),Fr(),W.type==="sessionGroup"){const de=(ie=W.data)==null?void 0:ie.sessionId,je=new Map;if(de)for(const Re of yr){const He=Re.data;(He==null?void 0:He.sessionId)===de&&je.set(Re.id,{x:Re.position.x,y:Re.position.y})}bn.current={start:{x:W.position.x,y:W.position.y},members:je};return}Nt.current.set(W.id,{x:W.position.x,y:W.position.y})},onNodeDrag:(q,W)=>{var ie;if(Sn(),W.type==="sessionGroup"){const de=bn.current;if(!de)return;const je=W.position.x-de.start.x,Re=W.position.y-de.start.y;for(const[et,rt]of de.members){const st={x:rt.x+je,y:rt.y+Re};Nt.current.set(et,st),un.current.set(et,st)}const He=qt.current;if(He){for(const[et,rt]of de.members)He.set(et,{x:rt.x+je,y:rt.y+Re});He.set(W.id,{x:W.position.x,y:W.position.y})}on(et=>et+1);return}Nt.current.set(W.id,{x:W.position.x,y:W.position.y}),un.current.set(W.id,{x:W.position.x,y:W.position.y}),(ie=qt.current)==null||ie.set(W.id,{x:W.position.x,y:W.position.y}),on(de=>de+1)},onNodeDragStop:(q,W)=>{if(Sn(),oa.current=!1,qt.current=null,nc(!1),Or(ie=>ie+1),W.type==="sessionGroup"){const ie=bn.current;if(ie){const de=W.position.x-ie.start.x,je=W.position.y-ie.start.y;for(const[Re,He]of ie.members){const et={x:He.x+de,y:He.y+je};Nt.current.set(Re,et),un.current.set(Re,et)}}bn.current=null,Gv(un.current,Nt.current),Or(de=>de+1);return}Nt.current.set(W.id,{x:W.position.x,y:W.position.y}),un.current.set(W.id,{x:W.position.x,y:W.position.y}),Gv(un.current,Nt.current)},children:[c.jsx(_L,{gap:28,size:1,color:Xn["--grid-line"]}),c.jsx(Q3,{onFit:()=>{Zn.current=Date.now()}}),c.jsx(M4,{agents:s.current.agents,visibleAgentIds:ki,positions:un.current,pinned:Nt.current,measured:gr.current,spotlight:bi,hiddenCategories:Lr,now:St,onOpenTool:g}),c.jsxs(yL,{showInteractive:!1,children:[c.jsx(Er,{onClick:$d,title:qr?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:qr?{color:"var(--accent)"}:void 0,children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),c.jsx(Er,{onClick:cs,title:Q8({paused:Ya,held:xn.size,dropped:xn.dropped}),"aria-label":X8,"aria-pressed":Ya,children:c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:c.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),c.jsx(Er,{onClick:oo,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),c.jsx(Er,{onClick:()=>ao("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),c.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"}),c.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"}),c.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),c.jsx(Er,{onClick:()=>$(q=>!q),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.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"}),c.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),c.jsx(uL,{zoomable:!0,pannable:!0,nodeColor:Jl,nodeStrokeWidth:2,maskColor:Xn["--minimap-mask"],style:Za})]})]}),A&&Yt?c.jsxs("aside",{className:"detail","aria-label":"Detail",children:[c.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>D(!1),children:"×"}),c.jsx(CU,{agent:Yt,now:St,onOpenTool:g,onShowSummary:q=>{I.has(q)&&(I.delete(q),Xj(I)),k(q)},onExportSession:q=>kU(s.current,q)})]}):null,so&&c.jsx(B3,{tool:so,onClose:()=>g(null)}),is&&c.jsx(UF,{providers:it,onClose:()=>Us(!1)}),Ba&&c.jsx(t6,{onClose:()=>Ws(!1),onSeen:q=>{Ua(q);try{localStorage.setItem(m1,String(q))}catch{}},onWatching:Gs,palette:Xn}),E&&(()=>{const q=s.current.agents.get(E);return q?c.jsx($3,{agent:q,onClose:()=>_(null)}):null})(),N&&c.jsx(L4,{state:s.current,sessionId:N,onClose:()=>{I.add(N),Xj(I),k(null)}}),se&&c.jsx(oF,{entries:se.entries,since:se.since,firstRun:se.firstRun,running:_e,onClose:()=>Se(null)}),(()=>{const{request:q,waiting:W}=r6(Wa,Vs.current);return q?c.jsx(s6,{request:q,waiting:W,busy:ls,now:Date.now(),onAccept:()=>void Ha("accept",q.fp),onDecline:()=>void Ha("dismiss",q.fp),onLater:()=>{ls||(Vs.current.add(q.fp),$r(ie=>[...ie]))}}):null})(),M&&c.jsx(S5,{onClose:()=>$(!1)}),j&&c.jsx(b5,{agentCount:ic,onConfirm:()=>ao("confirmation"),onCancel:()=>C(!1)})]})}function EU({live:e,everConnected:t,providers:n,workspace:s}){const a=!e;return c.jsxs("div",{className:"empty-hero",children:[c.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[c.jsx("div",{className:"core"}),c.jsxs("div",{className:"orbit r1",children:[c.jsx("span",{className:"dot"}),c.jsx("span",{className:"dot b"})]}),c.jsxs("div",{className:"orbit r2",children:[c.jsx("span",{className:"dot"}),c.jsx("span",{className:"dot b"})]}),c.jsxs("div",{className:"orbit r3",children:[c.jsx("span",{className:"dot"}),c.jsx("span",{className:"dot b"})]})]}),a?c.jsxs(c.Fragment,{children:[c.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),c.jsxs("p",{children:["The browser cannot reach ",c.jsx("code",{children:"/events"}),". Check that",c.jsx("code",{children:Ut})," is still running in your terminal, then this page will resume automatically."]})]}):jU(n,s)]})}function jU(e,t){const n=V8(t);return c.jsxs(c.Fragment,{children:[c.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?c.jsxs("p",{children:[n.lead," ",c.jsx("code",{children:n.workspace}),n.tail]}):c.jsxs("p",{children:["Run ",c.jsx("code",{children:"claude"})," or ",c.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."]}),c.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",c.jsx("code",{children:Ut})," is running."]}),LF(e).map(s=>c.jsx("p",{className:"hint-row",children:s.spans.map((a,i)=>a.code?c.jsx("code",{children:a.text},i):c.jsx("span",{children:a.text},i))},s.provider))]})}function CU({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:a}){const i=Wu(e.startedAt,e.endedAt,t),l=An(e),d=l.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const k=EA(N.name);p.set(k,(p.get(k)??0)+1)}const h=e.tools.filter(N=>N.ok===!1).length,g=e.tools.filter(N=>!N.endedAt).length,y=Array.from(p.entries()).sort((N,k)=>k[1]-N[1]),w=p.has("mcp")?j4(e.tools.map(N=>N.name)):null;return c.jsxs(c.Fragment,{children:[c.jsxs("header",{className:"detail-hero",children:[c.jsxs("div",{className:"hero-line",children:[c.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),c.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),c.jsxs("div",{className:"hero-meta",children:[c.jsx("span",{className:"hero-meta-item",children:e.kind}),c.jsx("span",{className:"hero-sep",children:"·"}),c.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:i}),e.model&&(()=>{const N=AT(e);return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hero-sep",children:"·"}),c.jsxs("span",{className:"model-chip","data-family":od(e.model),title:N.length>0?`${e.model}
|
|
257
|
+
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:Ln?"restarting…":pi.label}),!Ln&&c.jsx("span",{className:"ver-sub",children:pi.clause}),c.jsxs("button",{type:"button",className:`ver-auto${Pn?" on":""}`,role:"switch","aria-checked":Pn,onClick:Ad,"aria-label":"Auto-restart when idle",title:Pn?"Restarts on its own once nothing has been running for 30 seconds. Click to require a click instead.":"Only restarts when you click. Click to let it restart itself while idle.",children:[c.jsx("i",{"aria-hidden":!0}),c.jsx("span",{"aria-hidden":!0,children:g5(Pn,Qa)})]})]}):c.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."})]}):c.jsxs(c.Fragment,{children:[c.jsxs("strong",{children:[Ut," v",$e.to," is out — you are on v",$e.from,"."]}),(re==null?void 0:re.upgradeMode)==="install"&&$t!=="failed"&&c.jsx("button",{type:"button",className:"ver-act",onClick:li,...cr($t==="running",$t==="done"),title:`Runs ${((ua=re==null?void 0:re.upgrade)==null?void 0:ua.command)??(re==null?void 0:re.command)??"npm i -g"} here, then restarts once nothing is running.`,children:$t==="running"?"installing…":$t==="done"?"installed":"Update now"}),(re==null?void 0:re.upgradeMode)==="npx"&&(re==null?void 0:re.canRestart)&&c.jsx("button",{type:"button",className:"ver-act",onClick:()=>us({upgrade:!0}),...cr(Ln),title:`Runs ${re==null?void 0:re.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Ln?"fetching…":$t==="failed"?"Retry update":"Update & restart"}),$t==="failed"?c.jsxs("span",{className:"ver-sub fail",title:((Wr=re==null?void 0:re.upgrade)==null?void 0:Wr.error)??"",children:[(re==null?void 0:re.upgradeMode)==="npx"?"update failed":"install failed",": ",((uo=re==null?void 0:re.upgrade)==null?void 0:uo.error)??"unknown error"," — run it yourself:"]}):(re==null?void 0:re.upgradeMode)==="npx"?c.jsx("span",{className:"ver-sub",children:re!=null&&re.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Hv.npx}):re!=null&&re.upgradeBlocked?c.jsx("span",{className:"ver-sub",children:Object.hasOwn(Hv,re.upgradeBlocked)?Hv[re.upgradeBlocked]:"cannot install from here"}):null,c.jsxs("button",{type:"button",className:"ver-cmd",onClick:Rr,title:"Copy to clipboard",children:[c.jsx("code",{children:re==null?void 0:re.command}),c.jsx("span",{className:"ver-cmd-hint",children:at?"copied":"copy"})]})]}),c.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Da,children:"×"})]}):Bs&&wn?c.jsxs("div",{className:"ver-banner",role:"status",children:[c.jsx("span",{className:"ver-dot"}),c.jsxs("strong",{children:[wn," still works — the deck is called ",Ut," now."]}),re!=null&&re.renameFix?c.jsx("span",{className:"ver-sub",children:re.renameFix}):null,c.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:za,children:"×"})]}):null,H&&c.jsx(vD,{state:s.current,now:St,providers:it,onClose:()=>X(!1)}),B&&it.claude&&c.jsx(c5,{onClose:()=>Q(!1)}),R&&c.jsx(YD,{usageOpen:H,onClose:()=>Z(!1)}),z&&c.jsx(z4,{state:s.current,now:St,selectedIds:l,onSelect:vs,onClose:()=>O(!1)}),c.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${qd?" bubbling":""}${Ni?" dragging-any":""}`,ref:_i,onMouseDownCapture:Pd,onPointerDownCapture:Ja,onPointerUpCapture:Ja,onWheelCapture:Ja,children:[ic===0&&c.jsx(CU,{live:Ge,everConnected:mi,providers:it,workspace:vt}),(la.length>1||Lr.size>0)&&c.jsx("div",{ref:Ys,className:`cat-filter-bar${Va?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:la.map(q=>{const W=Lr.has(q);return c.jsxs("button",{type:"button",className:`cat-filter${W?" off":""}`,onClick:()=>ac(q),"aria-pressed":!W,title:`${W?"Show":"Hide"} ${Nw[q]} tools`,children:[c.jsx("span",{className:"cat-emoji",children:Sw[q]}),c.jsx("span",{className:"cat-name",children:Nw[q]})]},q)})}),c.jsxs(yT,{nodes:Bd,edges:Ei,nodeTypes:rU,fitView:!kn,fitViewOptions:{padding:.25,duration:Bv({durationMs:Gj,documentHidden:document.hidden})?Gj:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(q,W)=>{if(W.type==="sessionGroup"){w();return}y(W.id,q.shiftKey)},onPaneClick:()=>w(),onMoveStart:q=>{Bj(aa(q))&&Fr()},onMove:(q,W)=>{Sn(),Bj(aa(q))&&Fr(),na.current&&window.clearTimeout(na.current),na.current=window.setTimeout(()=>_U(W),250)},onNodeDragStart:(q,W)=>{var ie;if(Fd(),oa.current=!0,qt.current=new Map,nc(!0),Sn(),Fr(),W.type==="sessionGroup"){const de=(ie=W.data)==null?void 0:ie.sessionId,je=new Map;if(de)for(const Re of yr){const He=Re.data;(He==null?void 0:He.sessionId)===de&&je.set(Re.id,{x:Re.position.x,y:Re.position.y})}bn.current={start:{x:W.position.x,y:W.position.y},members:je};return}Nt.current.set(W.id,{x:W.position.x,y:W.position.y})},onNodeDrag:(q,W)=>{var ie;if(Sn(),W.type==="sessionGroup"){const de=bn.current;if(!de)return;const je=W.position.x-de.start.x,Re=W.position.y-de.start.y;for(const[et,rt]of de.members){const st={x:rt.x+je,y:rt.y+Re};Nt.current.set(et,st),un.current.set(et,st)}const He=qt.current;if(He){for(const[et,rt]of de.members)He.set(et,{x:rt.x+je,y:rt.y+Re});He.set(W.id,{x:W.position.x,y:W.position.y})}on(et=>et+1);return}Nt.current.set(W.id,{x:W.position.x,y:W.position.y}),un.current.set(W.id,{x:W.position.x,y:W.position.y}),(ie=qt.current)==null||ie.set(W.id,{x:W.position.x,y:W.position.y}),on(de=>de+1)},onNodeDragStop:(q,W)=>{if(Sn(),oa.current=!1,qt.current=null,nc(!1),Or(ie=>ie+1),W.type==="sessionGroup"){const ie=bn.current;if(ie){const de=W.position.x-ie.start.x,je=W.position.y-ie.start.y;for(const[Re,He]of ie.members){const et={x:He.x+de,y:He.y+je};Nt.current.set(Re,et),un.current.set(Re,et)}}bn.current=null,Gv(un.current,Nt.current),Or(de=>de+1);return}Nt.current.set(W.id,{x:W.position.x,y:W.position.y}),un.current.set(W.id,{x:W.position.x,y:W.position.y}),Gv(un.current,Nt.current)},children:[c.jsx(SL,{gap:28,size:1,color:Xn["--grid-line"]}),c.jsx(Z3,{onFit:()=>{Zn.current=Date.now()}}),c.jsx(I4,{agents:s.current.agents,visibleAgentIds:ki,positions:un.current,pinned:Nt.current,measured:gr.current,spotlight:bi,hiddenCategories:Lr,now:St,onOpenTool:g}),c.jsxs(vL,{showInteractive:!1,children:[c.jsx(Er,{onClick:$d,title:qr?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:qr?{color:"var(--accent)"}:void 0,children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),c.jsx(Er,{onClick:cs,title:J8({paused:Ya,held:xn.size,dropped:xn.dropped}),"aria-label":Z8,"aria-pressed":Ya,children:c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:c.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),c.jsx(Er,{onClick:oo,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),c.jsx(Er,{onClick:()=>ao("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),c.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"}),c.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"}),c.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),c.jsx(Er,{onClick:()=>$(q=>!q),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.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"}),c.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),c.jsx(dL,{zoomable:!0,pannable:!0,nodeColor:Jl,nodeStrokeWidth:2,maskColor:Xn["--minimap-mask"],style:Za})]})]}),A&&Yt?c.jsxs("aside",{className:"detail","aria-label":"Detail",children:[c.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>D(!1),children:"×"}),c.jsx(RU,{agent:Yt,now:St,onOpenTool:g,onShowSummary:q=>{I.has(q)&&(I.delete(q),Qj(I)),k(q)},onExportSession:q=>SU(s.current,q)})]}):null,so&&c.jsx(U3,{tool:so,onClose:()=>g(null)}),is&&c.jsx(HF,{providers:it,onClose:()=>Us(!1)}),Ba&&c.jsx(r6,{onClose:()=>Ws(!1),onSeen:q=>{Ua(q);try{localStorage.setItem(g1,String(q))}catch{}},onWatching:Gs,palette:Xn}),E&&(()=>{const q=s.current.agents.get(E);return q?c.jsx(O3,{agent:q,onClose:()=>_(null)}):null})(),N&&c.jsx(D4,{state:s.current,sessionId:N,onClose:()=>{I.add(N),Qj(I),k(null)}}),se&&c.jsx(lF,{entries:se.entries,since:se.since,firstRun:se.firstRun,running:_e,onClose:()=>Se(null)}),(()=>{const{request:q,waiting:W}=a6(Wa,Vs.current);return q?c.jsx(o6,{request:q,waiting:W,busy:ls,now:Date.now(),onAccept:()=>void Ha("accept",q.fp),onDecline:()=>void Ha("dismiss",q.fp),onLater:()=>{ls||(Vs.current.add(q.fp),$r(ie=>[...ie]))}}):null})(),M&&c.jsx(E5,{onClose:()=>$(!1)}),j&&c.jsx(_5,{agentCount:ic,onConfirm:()=>ao("confirmation"),onCancel:()=>C(!1)})]})}function CU({live:e,everConnected:t,providers:n,workspace:s}){const a=!e;return c.jsxs("div",{className:"empty-hero",children:[c.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[c.jsx("div",{className:"core"}),c.jsxs("div",{className:"orbit r1",children:[c.jsx("span",{className:"dot"}),c.jsx("span",{className:"dot b"})]}),c.jsxs("div",{className:"orbit r2",children:[c.jsx("span",{className:"dot"}),c.jsx("span",{className:"dot b"})]}),c.jsxs("div",{className:"orbit r3",children:[c.jsx("span",{className:"dot"}),c.jsx("span",{className:"dot b"})]})]}),a?c.jsxs(c.Fragment,{children:[c.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),c.jsxs("p",{children:["The browser cannot reach ",c.jsx("code",{children:"/events"}),". Check that",c.jsx("code",{children:Ut})," is still running in your terminal, then this page will resume automatically."]})]}):TU(n,s)]})}function TU(e,t){const n=K8(t);return c.jsxs(c.Fragment,{children:[c.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?c.jsxs("p",{children:[n.lead," ",c.jsx("code",{children:n.workspace}),n.tail]}):c.jsxs("p",{children:["Run ",c.jsx("code",{children:"claude"})," or ",c.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."]}),c.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",c.jsx("code",{children:Ut})," is running."]}),qF(e).map(s=>c.jsx("p",{className:"hint-row",children:s.spans.map((a,i)=>a.code?c.jsx("code",{children:a.text},i):c.jsx("span",{children:a.text},i))},s.provider))]})}function RU({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:a}){const i=Wu(e.startedAt,e.endedAt,t),l=An(e),d=l.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const k=jA(N.name);p.set(k,(p.get(k)??0)+1)}const h=e.tools.filter(N=>N.ok===!1).length,g=e.tools.filter(N=>!N.endedAt).length,y=Array.from(p.entries()).sort((N,k)=>k[1]-N[1]),w=p.has("mcp")?C4(e.tools.map(N=>N.name)):null;return c.jsxs(c.Fragment,{children:[c.jsxs("header",{className:"detail-hero",children:[c.jsxs("div",{className:"hero-line",children:[c.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),c.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),c.jsxs("div",{className:"hero-meta",children:[c.jsx("span",{className:"hero-meta-item",children:e.kind}),c.jsx("span",{className:"hero-sep",children:"·"}),c.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:i}),e.model&&(()=>{const N=MT(e);return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hero-sep",children:"·"}),c.jsxs("span",{className:"model-chip","data-family":od(e.model),title:N.length>0?`${e.model}
|
|
258
258
|
spend on this panel also covers:
|
|
259
259
|
${N.join(`
|
|
260
|
-
`)}`:e.model,children:[Fs(e.model),N.length>0?` +${N.length}`:""]})]})})()]}),d&&c.jsxs("div",{className:"hero-cost",children:[c.jsxs("div",{className:"hero-cost-headline",children:[c.jsx("span",{className:"hero-cost-value",children:Je(l.total)}),c.jsx("span",{className:"hero-cost-label",children:"spend"})]}),c.jsx(Zw,{cost:l})]}),c.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&c.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&&c.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&&c.jsxs("section",{className:"detail-section",children:[c.jsx("h3",{children:"Activity"}),c.jsxs("div",{className:"activity-row",children:[c.jsxs("div",{className:"activity-counters",children:[c.jsxs("span",{className:"ac-item",children:[c.jsx("b",{children:e.toolCount})," calls"]}),g>0&&c.jsxs("span",{className:"ac-item ac-live",children:[c.jsx("b",{children:g})," live"]}),h>0&&c.jsxs("span",{className:"ac-item ac-err",children:[c.jsx("b",{children:h})," err"]})]}),c.jsx("div",{className:"cat-strip",children:y.map(([N,k])=>{const E=N==="mcp"?w:null,_=E==null?void 0:E.hue,S=`${k} ${Nw[N]} call${k===1?"":"s"}`;return c.jsxs("span",{className:`cat-chip cat-${N}${_!=null?" mcp-hue":""}`,style:_!=null?{"--mcp-hue":_}:void 0,title:E?`${S}, all to ${E.label}`:S,children:[c.jsx("span",{className:"cat-emoji",children:Sw[N]}),c.jsx("span",{className:"cat-count",children:k}),E&&c.jsx("span",{className:"cat-server",children:E.label})]},N)})})]})]}),f>0&&c.jsxs("section",{className:"detail-section",children:[c.jsx("h3",{children:"Tokens"}),c.jsxs("div",{className:"tokens-grid",children:[c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"in"}),c.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"out"}),c.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"cache r"}),c.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"cache c"}),c.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),c.jsxs("section",{className:"detail-section",children:[c.jsx("h3",{children:"Identity"}),c.jsxs("div",{children:[e.cwd&&c.jsxs("div",{className:"row",children:[c.jsx("span",{className:"k",children:"cwd"}),c.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),c.jsxs("div",{className:"row",children:[c.jsx("span",{className:"k",children:"session"}),c.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&c.jsxs("div",{className:"row",children:[c.jsx("span",{className:"k",children:"parent"}),c.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&c.jsxs("section",{className:"detail-section",children:[c.jsxs("h3",{children:["Prompts ",c.jsx("span",{className:"section-count",children:e.prompts.length})]}),c.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((N,k)=>{const E=
|
|
260
|
+
`)}`:e.model,children:[Fs(e.model),N.length>0?` +${N.length}`:""]})]})})()]}),d&&c.jsxs("div",{className:"hero-cost",children:[c.jsxs("div",{className:"hero-cost-headline",children:[c.jsx("span",{className:"hero-cost-value",children:Je(l.total)}),c.jsx("span",{className:"hero-cost-label",children:"spend"})]}),c.jsx(Zw,{cost:l})]}),c.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&c.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&&c.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&&c.jsxs("section",{className:"detail-section",children:[c.jsx("h3",{children:"Activity"}),c.jsxs("div",{className:"activity-row",children:[c.jsxs("div",{className:"activity-counters",children:[c.jsxs("span",{className:"ac-item",children:[c.jsx("b",{children:e.toolCount})," calls"]}),g>0&&c.jsxs("span",{className:"ac-item ac-live",children:[c.jsx("b",{children:g})," live"]}),h>0&&c.jsxs("span",{className:"ac-item ac-err",children:[c.jsx("b",{children:h})," err"]})]}),c.jsx("div",{className:"cat-strip",children:y.map(([N,k])=>{const E=N==="mcp"?w:null,_=E==null?void 0:E.hue,S=`${k} ${Nw[N]} call${k===1?"":"s"}`;return c.jsxs("span",{className:`cat-chip cat-${N}${_!=null?" mcp-hue":""}`,style:_!=null?{"--mcp-hue":_}:void 0,title:E?`${S}, all to ${E.label}`:S,children:[c.jsx("span",{className:"cat-emoji",children:Sw[N]}),c.jsx("span",{className:"cat-count",children:k}),E&&c.jsx("span",{className:"cat-server",children:E.label})]},N)})})]})]}),f>0&&c.jsxs("section",{className:"detail-section",children:[c.jsx("h3",{children:"Tokens"}),c.jsxs("div",{className:"tokens-grid",children:[c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"in"}),c.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"out"}),c.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"cache r"}),c.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"cache c"}),c.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),c.jsxs("section",{className:"detail-section",children:[c.jsx("h3",{children:"Identity"}),c.jsxs("div",{children:[e.cwd&&c.jsxs("div",{className:"row",children:[c.jsx("span",{className:"k",children:"cwd"}),c.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),c.jsxs("div",{className:"row",children:[c.jsx("span",{className:"k",children:"session"}),c.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&c.jsxs("div",{className:"row",children:[c.jsx("span",{className:"k",children:"parent"}),c.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&c.jsxs("section",{className:"detail-section",children:[c.jsxs("h3",{children:["Prompts ",c.jsx("span",{className:"section-count",children:e.prompts.length})]}),c.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((N,k)=>{const E=nD(N.at,t);return c.jsxs("div",{className:"prompt-entry",children:[c.jsx("div",{className:"prompt-time",title:E.title,children:E.label}),c.jsx("div",{className:"prompt-text",children:N.text})]},k)})})]}),c.jsxs("section",{className:"detail-section",children:[c.jsxs("h3",{children:["Tool calls ",c.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&c.jsx("div",{className:"empty",children:"No tool calls yet."}),c.jsx("div",{children:e.tools.slice().reverse().map(N=>c.jsx(MU,{t:N,onClick:()=>n(N.id)},N.id))})]})]})}const AU={inflight:"in-flight",done:"done",err:"error"};function MU({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=$T(e,"…");return c.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[c.jsxs("span",{className:"name",children:[c.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),c.jsx("span",{className:"vis-hidden",children:AU[n]}),e.name]}),c.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{eD(window.localStorage)}catch{}const IU=_M.createRoot(document.getElementById("root"));IU.render(c.jsx(EU,{}));
|