agent-dag 1.35.13 → 1.35.15

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.
@@ -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 Mw;function VR(){if(Mw)return Le;Mw=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),m=Symbol.iterator;function y(M){return M===null||typeof M!="object"?null:(M=m&&M[m]||M["@@iterator"],typeof M=="function"?M:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,_={};function b(M,G,Y){this.props=M,this.context=G,this.refs=_,this.updater=Y||w}b.prototype.isReactComponent={},b.prototype.setState=function(M,G){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,G,"setState")},b.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function S(){}S.prototype=b.prototype;function k(M,G,Y){this.props=M,this.context=G,this.refs=_,this.updater=Y||w}var E=k.prototype=new S;E.constructor=k,N(E,b.prototype),E.isPureReactComponent=!0;var T=Array.isArray,I=Object.prototype.hasOwnProperty,O={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function U(M,G,Y){var $,Q={},ne=null,oe=null;if(G!=null)for($ in G.ref!==void 0&&(oe=G.ref),G.key!==void 0&&(ne=""+G.key),G)I.call(G,$)&&!A.hasOwnProperty($)&&(Q[$]=G[$]);var fe=arguments.length-2;if(fe===1)Q.children=Y;else if(1<fe){for(var te=Array(fe),ce=0;ce<fe;ce++)te[ce]=arguments[ce+2];Q.children=te}if(M&&M.defaultProps)for($ in fe=M.defaultProps,fe)Q[$]===void 0&&(Q[$]=fe[$]);return{$$typeof:e,type:M,key:ne,ref:oe,props:Q,_owner:O.current}}function z(M,G){return{$$typeof:e,type:M.type,key:G,ref:M.ref,props:M.props,_owner:M._owner}}function P(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function D(M){var G={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(Y){return G[Y]})}var V=/\/+/g;function B(M,G){return typeof M=="object"&&M!==null&&M.key!=null?D(""+M.key):G.toString(36)}function C(M,G,Y,$,Q){var ne=typeof M;(ne==="undefined"||ne==="boolean")&&(M=null);var oe=!1;if(M===null)oe=!0;else switch(ne){case"string":case"number":oe=!0;break;case"object":switch(M.$$typeof){case e:case n:oe=!0}}if(oe)return oe=M,Q=Q(oe),M=$===""?"."+B(oe,0):$,T(Q)?(Y="",M!=null&&(Y=M.replace(V,"$&/")+"/"),C(Q,G,Y,"",function(ce){return ce})):Q!=null&&(P(Q)&&(Q=z(Q,Y+(!Q.key||oe&&oe.key===Q.key?"":(""+Q.key).replace(V,"$&/")+"/")+M)),G.push(Q)),1;if(oe=0,$=$===""?".":$+":",T(M))for(var fe=0;fe<M.length;fe++){ne=M[fe];var te=$+B(ne,fe);oe+=C(ne,G,Y,te,Q)}else if(te=y(M),typeof te=="function")for(M=te.call(M),fe=0;!(ne=M.next()).done;)ne=ne.value,te=$+B(ne,fe++),oe+=C(ne,G,Y,te,Q);else if(ne==="object")throw G=String(M),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return oe}function q(M,G,Y){if(M==null)return M;var $=[],Q=0;return C(M,$,"","",function(ne){return G.call(Y,ne,Q++)}),$}function L(M){if(M._status===-1){var G=M._result;G=G(),G.then(function(Y){(M._status===0||M._status===-1)&&(M._status=1,M._result=Y)},function(Y){(M._status===0||M._status===-1)&&(M._status=2,M._result=Y)}),M._status===-1&&(M._status=0,M._result=G)}if(M._status===1)return M._result.default;throw M._result}var re={current:null},Z={transition:null},H={ReactCurrentDispatcher:re,ReactCurrentBatchConfig:Z,ReactCurrentOwner:O};function J(){throw Error("act(...) is not supported in production builds of React.")}return Le.Children={map:q,forEach:function(M,G,Y){q(M,function(){G.apply(this,arguments)},Y)},count:function(M){var G=0;return q(M,function(){G++}),G},toArray:function(M){return q(M,function(G){return G})||[]},only:function(M){if(!P(M))throw Error("React.Children.only expected to receive a single React element child.");return M}},Le.Component=b,Le.Fragment=r,Le.Profiler=o,Le.PureComponent=k,Le.StrictMode=i,Le.Suspense=h,Le.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,Le.act=J,Le.cloneElement=function(M,G,Y){if(M==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+M+".");var $=N({},M.props),Q=M.key,ne=M.ref,oe=M._owner;if(G!=null){if(G.ref!==void 0&&(ne=G.ref,oe=O.current),G.key!==void 0&&(Q=""+G.key),M.type&&M.type.defaultProps)var fe=M.type.defaultProps;for(te in G)I.call(G,te)&&!A.hasOwnProperty(te)&&($[te]=G[te]===void 0&&fe!==void 0?fe[te]:G[te])}var te=arguments.length-2;if(te===1)$.children=Y;else if(1<te){fe=Array(te);for(var ce=0;ce<te;ce++)fe[ce]=arguments[ce+2];$.children=fe}return{$$typeof:e,type:M.type,key:Q,ref:ne,props:$,_owner:oe}},Le.createContext=function(M){return M={$$typeof:u,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},M.Provider={$$typeof:l,_context:M},M.Consumer=M},Le.createElement=U,Le.createFactory=function(M){var G=U.bind(null,M);return G.type=M,G},Le.createRef=function(){return{current:null}},Le.forwardRef=function(M){return{$$typeof:c,render:M}},Le.isValidElement=P,Le.lazy=function(M){return{$$typeof:d,_payload:{_status:-1,_result:M},_init:L}},Le.memo=function(M,G){return{$$typeof:p,type:M,compare:G===void 0?null:G}},Le.startTransition=function(M){var G=Z.transition;Z.transition={};try{M()}finally{Z.transition=G}},Le.unstable_act=J,Le.useCallback=function(M,G){return re.current.useCallback(M,G)},Le.useContext=function(M){return re.current.useContext(M)},Le.useDebugValue=function(){},Le.useDeferredValue=function(M){return re.current.useDeferredValue(M)},Le.useEffect=function(M,G){return re.current.useEffect(M,G)},Le.useId=function(){return re.current.useId()},Le.useImperativeHandle=function(M,G,Y){return re.current.useImperativeHandle(M,G,Y)},Le.useInsertionEffect=function(M,G){return re.current.useInsertionEffect(M,G)},Le.useLayoutEffect=function(M,G){return re.current.useLayoutEffect(M,G)},Le.useMemo=function(M,G){return re.current.useMemo(M,G)},Le.useReducer=function(M,G,Y){return re.current.useReducer(M,G,Y)},Le.useRef=function(M){return re.current.useRef(M)},Le.useState=function(M){return re.current.useState(M)},Le.useSyncExternalStore=function(M,G,Y){return re.current.useSyncExternalStore(M,G,Y)},Le.useTransition=function(){return re.current.useTransition()},Le.version="18.3.1",Le}var Ow;function ka(){return Ow||(Ow=1,Ed.exports=VR()),Ed.exports}/**
9
+ */var Mw;function GR(){if(Mw)return Le;Mw=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),m=Symbol.iterator;function y(M){return M===null||typeof M!="object"?null:(M=m&&M[m]||M["@@iterator"],typeof M=="function"?M:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,_={};function b(M,G,Y){this.props=M,this.context=G,this.refs=_,this.updater=Y||w}b.prototype.isReactComponent={},b.prototype.setState=function(M,G){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,G,"setState")},b.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function S(){}S.prototype=b.prototype;function k(M,G,Y){this.props=M,this.context=G,this.refs=_,this.updater=Y||w}var E=k.prototype=new S;E.constructor=k,N(E,b.prototype),E.isPureReactComponent=!0;var T=Array.isArray,I=Object.prototype.hasOwnProperty,O={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function U(M,G,Y){var $,Q={},ne=null,oe=null;if(G!=null)for($ in G.ref!==void 0&&(oe=G.ref),G.key!==void 0&&(ne=""+G.key),G)I.call(G,$)&&!A.hasOwnProperty($)&&(Q[$]=G[$]);var fe=arguments.length-2;if(fe===1)Q.children=Y;else if(1<fe){for(var te=Array(fe),ce=0;ce<fe;ce++)te[ce]=arguments[ce+2];Q.children=te}if(M&&M.defaultProps)for($ in fe=M.defaultProps,fe)Q[$]===void 0&&(Q[$]=fe[$]);return{$$typeof:e,type:M,key:ne,ref:oe,props:Q,_owner:O.current}}function z(M,G){return{$$typeof:e,type:M.type,key:G,ref:M.ref,props:M.props,_owner:M._owner}}function P(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function D(M){var G={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(Y){return G[Y]})}var V=/\/+/g;function B(M,G){return typeof M=="object"&&M!==null&&M.key!=null?D(""+M.key):G.toString(36)}function C(M,G,Y,$,Q){var ne=typeof M;(ne==="undefined"||ne==="boolean")&&(M=null);var oe=!1;if(M===null)oe=!0;else switch(ne){case"string":case"number":oe=!0;break;case"object":switch(M.$$typeof){case e:case n:oe=!0}}if(oe)return oe=M,Q=Q(oe),M=$===""?"."+B(oe,0):$,T(Q)?(Y="",M!=null&&(Y=M.replace(V,"$&/")+"/"),C(Q,G,Y,"",function(ce){return ce})):Q!=null&&(P(Q)&&(Q=z(Q,Y+(!Q.key||oe&&oe.key===Q.key?"":(""+Q.key).replace(V,"$&/")+"/")+M)),G.push(Q)),1;if(oe=0,$=$===""?".":$+":",T(M))for(var fe=0;fe<M.length;fe++){ne=M[fe];var te=$+B(ne,fe);oe+=C(ne,G,Y,te,Q)}else if(te=y(M),typeof te=="function")for(M=te.call(M),fe=0;!(ne=M.next()).done;)ne=ne.value,te=$+B(ne,fe++),oe+=C(ne,G,Y,te,Q);else if(ne==="object")throw G=String(M),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return oe}function q(M,G,Y){if(M==null)return M;var $=[],Q=0;return C(M,$,"","",function(ne){return G.call(Y,ne,Q++)}),$}function L(M){if(M._status===-1){var G=M._result;G=G(),G.then(function(Y){(M._status===0||M._status===-1)&&(M._status=1,M._result=Y)},function(Y){(M._status===0||M._status===-1)&&(M._status=2,M._result=Y)}),M._status===-1&&(M._status=0,M._result=G)}if(M._status===1)return M._result.default;throw M._result}var re={current:null},J={transition:null},H={ReactCurrentDispatcher:re,ReactCurrentBatchConfig:J,ReactCurrentOwner:O};function Z(){throw Error("act(...) is not supported in production builds of React.")}return Le.Children={map:q,forEach:function(M,G,Y){q(M,function(){G.apply(this,arguments)},Y)},count:function(M){var G=0;return q(M,function(){G++}),G},toArray:function(M){return q(M,function(G){return G})||[]},only:function(M){if(!P(M))throw Error("React.Children.only expected to receive a single React element child.");return M}},Le.Component=b,Le.Fragment=r,Le.Profiler=o,Le.PureComponent=k,Le.StrictMode=i,Le.Suspense=h,Le.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,Le.act=Z,Le.cloneElement=function(M,G,Y){if(M==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+M+".");var $=N({},M.props),Q=M.key,ne=M.ref,oe=M._owner;if(G!=null){if(G.ref!==void 0&&(ne=G.ref,oe=O.current),G.key!==void 0&&(Q=""+G.key),M.type&&M.type.defaultProps)var fe=M.type.defaultProps;for(te in G)I.call(G,te)&&!A.hasOwnProperty(te)&&($[te]=G[te]===void 0&&fe!==void 0?fe[te]:G[te])}var te=arguments.length-2;if(te===1)$.children=Y;else if(1<te){fe=Array(te);for(var ce=0;ce<te;ce++)fe[ce]=arguments[ce+2];$.children=fe}return{$$typeof:e,type:M.type,key:Q,ref:ne,props:$,_owner:oe}},Le.createContext=function(M){return M={$$typeof:u,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},M.Provider={$$typeof:l,_context:M},M.Consumer=M},Le.createElement=U,Le.createFactory=function(M){var G=U.bind(null,M);return G.type=M,G},Le.createRef=function(){return{current:null}},Le.forwardRef=function(M){return{$$typeof:c,render:M}},Le.isValidElement=P,Le.lazy=function(M){return{$$typeof:d,_payload:{_status:-1,_result:M},_init:L}},Le.memo=function(M,G){return{$$typeof:p,type:M,compare:G===void 0?null:G}},Le.startTransition=function(M){var G=J.transition;J.transition={};try{M()}finally{J.transition=G}},Le.unstable_act=Z,Le.useCallback=function(M,G){return re.current.useCallback(M,G)},Le.useContext=function(M){return re.current.useContext(M)},Le.useDebugValue=function(){},Le.useDeferredValue=function(M){return re.current.useDeferredValue(M)},Le.useEffect=function(M,G){return re.current.useEffect(M,G)},Le.useId=function(){return re.current.useId()},Le.useImperativeHandle=function(M,G,Y){return re.current.useImperativeHandle(M,G,Y)},Le.useInsertionEffect=function(M,G){return re.current.useInsertionEffect(M,G)},Le.useLayoutEffect=function(M,G){return re.current.useLayoutEffect(M,G)},Le.useMemo=function(M,G){return re.current.useMemo(M,G)},Le.useReducer=function(M,G,Y){return re.current.useReducer(M,G,Y)},Le.useRef=function(M){return re.current.useRef(M)},Le.useState=function(M){return re.current.useState(M)},Le.useSyncExternalStore=function(M,G,Y){return re.current.useSyncExternalStore(M,G,Y)},Le.useTransition=function(){return re.current.useTransition()},Le.version="18.3.1",Le}var Ow;function ka(){return Ow||(Ow=1,Ed.exports=GR()),Ed.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 Pw;function GR(){if(Pw)return ta;Pw=1;var e=ka(),n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(c,h,p){var d,m={},y=null,w=null;p!==void 0&&(y=""+p),h.key!==void 0&&(y=""+h.key),h.ref!==void 0&&(w=h.ref);for(d in h)i.call(h,d)&&!l.hasOwnProperty(d)&&(m[d]=h[d]);if(c&&c.defaultProps)for(d in h=c.defaultProps,h)m[d]===void 0&&(m[d]=h[d]);return{$$typeof:n,type:c,key:y,ref:w,props:m,_owner:o.current}}return ta.Fragment=r,ta.jsx=u,ta.jsxs=u,ta}var Lw;function YR(){return Lw||(Lw=1,kd.exports=GR()),kd.exports}var g=YR(),Hl={},Nd={exports:{}},un={},Cd={exports:{}},Td={};/**
17
+ */var Pw;function YR(){if(Pw)return ta;Pw=1;var e=ka(),n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(c,h,p){var d,m={},y=null,w=null;p!==void 0&&(y=""+p),h.key!==void 0&&(y=""+h.key),h.ref!==void 0&&(w=h.ref);for(d in h)i.call(h,d)&&!l.hasOwnProperty(d)&&(m[d]=h[d]);if(c&&c.defaultProps)for(d in h=c.defaultProps,h)m[d]===void 0&&(m[d]=h[d]);return{$$typeof:n,type:c,key:y,ref:w,props:m,_owner:o.current}}return ta.Fragment=r,ta.jsx=u,ta.jsxs=u,ta}var Lw;function KR(){return Lw||(Lw=1,kd.exports=YR()),kd.exports}var g=KR(),Hl={},Nd={exports:{}},un={},Cd={exports:{}},Td={};/**
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 $w;function KR(){return $w||($w=1,(function(e){function n(Z,H){var J=Z.length;Z.push(H);e:for(;0<J;){var M=J-1>>>1,G=Z[M];if(0<o(G,H))Z[M]=H,Z[J]=G,J=M;else break e}}function r(Z){return Z.length===0?null:Z[0]}function i(Z){if(Z.length===0)return null;var H=Z[0],J=Z.pop();if(J!==H){Z[0]=J;e:for(var M=0,G=Z.length,Y=G>>>1;M<Y;){var $=2*(M+1)-1,Q=Z[$],ne=$+1,oe=Z[ne];if(0>o(Q,J))ne<G&&0>o(oe,Q)?(Z[M]=oe,Z[ne]=J,M=ne):(Z[M]=Q,Z[$]=J,M=$);else if(ne<G&&0>o(oe,J))Z[M]=oe,Z[ne]=J,M=ne;else break e}}return H}function o(Z,H){var J=Z.sortIndex-H.sortIndex;return J!==0?J:Z.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,c=u.now();e.unstable_now=function(){return u.now()-c}}var h=[],p=[],d=1,m=null,y=3,w=!1,N=!1,_=!1,b=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(Z){for(var H=r(p);H!==null;){if(H.callback===null)i(p);else if(H.startTime<=Z)i(p),H.sortIndex=H.expirationTime,n(h,H);else break;H=r(p)}}function T(Z){if(_=!1,E(Z),!N)if(r(h)!==null)N=!0,L(I);else{var H=r(p);H!==null&&re(T,H.startTime-Z)}}function I(Z,H){N=!1,_&&(_=!1,S(U),U=-1),w=!0;var J=y;try{for(E(H),m=r(h);m!==null&&(!(m.expirationTime>H)||Z&&!D());){var M=m.callback;if(typeof M=="function"){m.callback=null,y=m.priorityLevel;var G=M(m.expirationTime<=H);H=e.unstable_now(),typeof G=="function"?m.callback=G:m===r(h)&&i(h),E(H)}else i(h);m=r(h)}if(m!==null)var Y=!0;else{var $=r(p);$!==null&&re(T,$.startTime-H),Y=!1}return Y}finally{m=null,y=J,w=!1}}var O=!1,A=null,U=-1,z=5,P=-1;function D(){return!(e.unstable_now()-P<z)}function V(){if(A!==null){var Z=e.unstable_now();P=Z;var H=!0;try{H=A(!0,Z)}finally{H?B():(O=!1,A=null)}}else O=!1}var B;if(typeof k=="function")B=function(){k(V)};else if(typeof MessageChannel<"u"){var C=new MessageChannel,q=C.port2;C.port1.onmessage=V,B=function(){q.postMessage(null)}}else B=function(){b(V,0)};function L(Z){A=Z,O||(O=!0,B())}function re(Z,H){U=b(function(){Z(e.unstable_now())},H)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Z){Z.callback=null},e.unstable_continueExecution=function(){N||w||(N=!0,L(I))},e.unstable_forceFrameRate=function(Z){0>Z||125<Z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<Z?Math.floor(1e3/Z):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return r(h)},e.unstable_next=function(Z){switch(y){case 1:case 2:case 3:var H=3;break;default:H=y}var J=y;y=H;try{return Z()}finally{y=J}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Z,H){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var J=y;y=Z;try{return H()}finally{y=J}},e.unstable_scheduleCallback=function(Z,H,J){var M=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?M+J:M):J=M,Z){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=J+G,Z={id:d++,callback:H,priorityLevel:Z,startTime:J,expirationTime:G,sortIndex:-1},J>M?(Z.sortIndex=J,n(p,Z),r(h)===null&&Z===r(p)&&(_?(S(U),U=-1):_=!0,re(T,J-M))):(Z.sortIndex=G,n(h,Z),N||w||(N=!0,L(I))),Z},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(Z){var H=y;return function(){var J=y;y=H;try{return Z.apply(this,arguments)}finally{y=J}}}})(Td)),Td}var qw;function XR(){return qw||(qw=1,Cd.exports=KR()),Cd.exports}/**
25
+ */var $w;function XR(){return $w||($w=1,(function(e){function n(J,H){var Z=J.length;J.push(H);e:for(;0<Z;){var M=Z-1>>>1,G=J[M];if(0<o(G,H))J[M]=H,J[Z]=G,Z=M;else break e}}function r(J){return J.length===0?null:J[0]}function i(J){if(J.length===0)return null;var H=J[0],Z=J.pop();if(Z!==H){J[0]=Z;e:for(var M=0,G=J.length,Y=G>>>1;M<Y;){var $=2*(M+1)-1,Q=J[$],ne=$+1,oe=J[ne];if(0>o(Q,Z))ne<G&&0>o(oe,Q)?(J[M]=oe,J[ne]=Z,M=ne):(J[M]=Q,J[$]=Z,M=$);else if(ne<G&&0>o(oe,Z))J[M]=oe,J[ne]=Z,M=ne;else break e}}return H}function o(J,H){var Z=J.sortIndex-H.sortIndex;return Z!==0?Z:J.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,c=u.now();e.unstable_now=function(){return u.now()-c}}var h=[],p=[],d=1,m=null,y=3,w=!1,N=!1,_=!1,b=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(J){for(var H=r(p);H!==null;){if(H.callback===null)i(p);else if(H.startTime<=J)i(p),H.sortIndex=H.expirationTime,n(h,H);else break;H=r(p)}}function T(J){if(_=!1,E(J),!N)if(r(h)!==null)N=!0,L(I);else{var H=r(p);H!==null&&re(T,H.startTime-J)}}function I(J,H){N=!1,_&&(_=!1,S(U),U=-1),w=!0;var Z=y;try{for(E(H),m=r(h);m!==null&&(!(m.expirationTime>H)||J&&!D());){var M=m.callback;if(typeof M=="function"){m.callback=null,y=m.priorityLevel;var G=M(m.expirationTime<=H);H=e.unstable_now(),typeof G=="function"?m.callback=G:m===r(h)&&i(h),E(H)}else i(h);m=r(h)}if(m!==null)var Y=!0;else{var $=r(p);$!==null&&re(T,$.startTime-H),Y=!1}return Y}finally{m=null,y=Z,w=!1}}var O=!1,A=null,U=-1,z=5,P=-1;function D(){return!(e.unstable_now()-P<z)}function V(){if(A!==null){var J=e.unstable_now();P=J;var H=!0;try{H=A(!0,J)}finally{H?B():(O=!1,A=null)}}else O=!1}var B;if(typeof k=="function")B=function(){k(V)};else if(typeof MessageChannel<"u"){var C=new MessageChannel,q=C.port2;C.port1.onmessage=V,B=function(){q.postMessage(null)}}else B=function(){b(V,0)};function L(J){A=J,O||(O=!0,B())}function re(J,H){U=b(function(){J(e.unstable_now())},H)}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(J){J.callback=null},e.unstable_continueExecution=function(){N||w||(N=!0,L(I))},e.unstable_forceFrameRate=function(J){0>J||125<J?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<J?Math.floor(1e3/J):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return r(h)},e.unstable_next=function(J){switch(y){case 1:case 2:case 3:var H=3;break;default:H=y}var Z=y;y=H;try{return J()}finally{y=Z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(J,H){switch(J){case 1:case 2:case 3:case 4:case 5:break;default:J=3}var Z=y;y=J;try{return H()}finally{y=Z}},e.unstable_scheduleCallback=function(J,H,Z){var M=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?M+Z:M):Z=M,J){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=Z+G,J={id:d++,callback:H,priorityLevel:J,startTime:Z,expirationTime:G,sortIndex:-1},Z>M?(J.sortIndex=Z,n(p,J),r(h)===null&&J===r(p)&&(_?(S(U),U=-1):_=!0,re(T,Z-M))):(J.sortIndex=G,n(h,J),N||w||(N=!0,L(I))),J},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(J){var H=y;return function(){var Z=y;y=H;try{return J.apply(this,arguments)}finally{y=Z}}}})(Td)),Td}var qw;function QR(){return qw||(qw=1,Cd.exports=XR()),Cd.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 Dw;function QR(){if(Dw)return un;Dw=1;var e=ka(),n=XR();function r(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,a=1;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,o={};function l(t,s){u(t,s),u(t+"Capture",s)}function u(t,s){for(o[t]=s,t=0;t<s.length;t++)i.add(s[t])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},m={};function y(t){return h.call(m,t)?!0:h.call(d,t)?!1:p.test(t)?m[t]=!0:(d[t]=!0,!1)}function w(t,s,a,f){if(a!==null&&a.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return f?!1:a!==null?!a.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function N(t,s,a,f){if(s===null||typeof s>"u"||w(t,s,a,f))return!0;if(f)return!1;if(a!==null)switch(a.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function _(t,s,a,f,v,x,R){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=f,this.attributeNamespace=v,this.mustUseProperty=a,this.propertyName=t,this.type=s,this.sanitizeURL=x,this.removeEmptyString=R}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){b[t]=new _(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var s=t[0];b[s]=new _(s,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){b[t]=new _(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){b[t]=new _(t,2,!1,t,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(t){b[t]=new _(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){b[t]=new _(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){b[t]=new _(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){b[t]=new _(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){b[t]=new _(t,5,!1,t.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function k(t){return t[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(t){var s=t.replace(S,k);b[s]=new _(s,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var s=t.replace(S,k);b[s]=new _(s,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var s=t.replace(S,k);b[s]=new _(s,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){b[t]=new _(t,1,!1,t.toLowerCase(),null,!1,!1)}),b.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){b[t]=new _(t,1,!1,t.toLowerCase(),null,!0,!0)});function E(t,s,a,f){var v=b.hasOwnProperty(s)?b[s]:null;(v!==null?v.type!==0:f||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(N(s,a,v,f)&&(a=null),f||v===null?y(s)&&(a===null?t.removeAttribute(s):t.setAttribute(s,""+a)):v.mustUseProperty?t[v.propertyName]=a===null?v.type===3?!1:"":a:(s=v.attributeName,f=v.attributeNamespace,a===null?t.removeAttribute(s):(v=v.type,a=v===3||v===4&&a===!0?"":""+a,f?t.setAttributeNS(f,s,a):t.setAttribute(s,a))))}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),O=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),P=Symbol.for("react.provider"),D=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),re=Symbol.for("react.offscreen"),Z=Symbol.iterator;function H(t){return t===null||typeof t!="object"?null:(t=Z&&t[Z]||t["@@iterator"],typeof t=="function"?t:null)}var J=Object.assign,M;function G(t){if(M===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);M=s&&s[1]||""}return`
33
+ */var Dw;function ZR(){if(Dw)return un;Dw=1;var e=ka(),n=QR();function r(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,a=1;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,o={};function l(t,s){u(t,s),u(t+"Capture",s)}function u(t,s){for(o[t]=s,t=0;t<s.length;t++)i.add(s[t])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},m={};function y(t){return h.call(m,t)?!0:h.call(d,t)?!1:p.test(t)?m[t]=!0:(d[t]=!0,!1)}function w(t,s,a,f){if(a!==null&&a.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return f?!1:a!==null?!a.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function N(t,s,a,f){if(s===null||typeof s>"u"||w(t,s,a,f))return!0;if(f)return!1;if(a!==null)switch(a.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function _(t,s,a,f,v,x,R){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=f,this.attributeNamespace=v,this.mustUseProperty=a,this.propertyName=t,this.type=s,this.sanitizeURL=x,this.removeEmptyString=R}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){b[t]=new _(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var s=t[0];b[s]=new _(s,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){b[t]=new _(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){b[t]=new _(t,2,!1,t,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(t){b[t]=new _(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){b[t]=new _(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){b[t]=new _(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){b[t]=new _(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){b[t]=new _(t,5,!1,t.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function k(t){return t[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(t){var s=t.replace(S,k);b[s]=new _(s,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var s=t.replace(S,k);b[s]=new _(s,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var s=t.replace(S,k);b[s]=new _(s,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){b[t]=new _(t,1,!1,t.toLowerCase(),null,!1,!1)}),b.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){b[t]=new _(t,1,!1,t.toLowerCase(),null,!0,!0)});function E(t,s,a,f){var v=b.hasOwnProperty(s)?b[s]:null;(v!==null?v.type!==0:f||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(N(s,a,v,f)&&(a=null),f||v===null?y(s)&&(a===null?t.removeAttribute(s):t.setAttribute(s,""+a)):v.mustUseProperty?t[v.propertyName]=a===null?v.type===3?!1:"":a:(s=v.attributeName,f=v.attributeNamespace,a===null?t.removeAttribute(s):(v=v.type,a=v===3||v===4&&a===!0?"":""+a,f?t.setAttributeNS(f,s,a):t.setAttribute(s,a))))}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),O=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),P=Symbol.for("react.provider"),D=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),re=Symbol.for("react.offscreen"),J=Symbol.iterator;function H(t){return t===null||typeof t!="object"?null:(t=J&&t[J]||t["@@iterator"],typeof t=="function"?t:null)}var Z=Object.assign,M;function G(t){if(M===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);M=s&&s[1]||""}return`
34
34
  `+M+t}var Y=!1;function $(t,s){if(!t||Y)return"";Y=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(ae){var f=ae}Reflect.construct(t,[],s)}else{try{s.call()}catch(ae){f=ae}t.call(s.prototype)}else{try{throw Error()}catch(ae){f=ae}t()}}catch(ae){if(ae&&f&&typeof ae.stack=="string"){for(var v=ae.stack.split(`
35
35
  `),x=f.stack.split(`
36
36
  `),R=v.length-1,F=x.length-1;1<=R&&0<=F&&v[R]!==x[F];)F--;for(;1<=R&&0<=F;R--,F--)if(v[R]!==x[F]){if(R!==1||F!==1)do if(R--,F--,0>F||v[R]!==x[F]){var X=`
37
- `+v[R].replace(" at new "," at ");return t.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",t.displayName)),X}while(1<=R&&0<=F);break}}}finally{Y=!1,Error.prepareStackTrace=a}return(t=t?t.displayName||t.name:"")?G(t):""}function Q(t){switch(t.tag){case 5:return G(t.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return t=$(t.type,!1),t;case 11:return t=$(t.type.render,!1),t;case 1:return t=$(t.type,!0),t;default:return""}}function ne(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case A:return"Fragment";case O:return"Portal";case z:return"Profiler";case U:return"StrictMode";case B:return"Suspense";case C:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case D:return(t.displayName||"Context")+".Consumer";case P:return(t._context.displayName||"Context")+".Provider";case V:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case q:return s=t.displayName||null,s!==null?s:ne(t.type)||"Memo";case L:s=t._payload,t=t._init;try{return ne(t(s))}catch{}}return null}function oe(t){var s=t.type;switch(t.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=s.render,t=t.displayName||t.name||"",s.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ne(s);case 8:return s===U?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function fe(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function te(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ce(t){var s=te(t)?"checked":"value",a=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),f=""+t[s];if(!t.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var v=a.get,x=a.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return v.call(this)},set:function(R){f=""+R,x.call(this,R)}}),Object.defineProperty(t,s,{enumerable:a.enumerable}),{getValue:function(){return f},setValue:function(R){f=""+R},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function Ce(t){t._valueTracker||(t._valueTracker=ce(t))}function ve(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var a=s.getValue(),f="";return t&&(f=te(t)?t.checked?"true":"false":t.value),t=f,t!==a?(s.setValue(t),!0):!1}function je(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function ye(t,s){var a=s.checked;return J({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??t._wrapperState.initialChecked})}function ke(t,s){var a=s.defaultValue==null?"":s.defaultValue,f=s.checked!=null?s.checked:s.defaultChecked;a=fe(s.value!=null?s.value:a),t._wrapperState={initialChecked:f,initialValue:a,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Ye(t,s){s=s.checked,s!=null&&E(t,"checked",s,!1)}function we(t,s){Ye(t,s);var a=fe(s.value),f=s.type;if(a!=null)f==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+a):t.value!==""+a&&(t.value=""+a);else if(f==="submit"||f==="reset"){t.removeAttribute("value");return}s.hasOwnProperty("value")?Be(t,s.type,a):s.hasOwnProperty("defaultValue")&&Be(t,s.type,fe(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(t.defaultChecked=!!s.defaultChecked)}function _e(t,s,a){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var f=s.type;if(!(f!=="submit"&&f!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+t._wrapperState.initialValue,a||s===t.value||(t.value=s),t.defaultValue=s}a=t.name,a!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,a!==""&&(t.name=a)}function Be(t,s,a){(s!=="number"||je(t.ownerDocument)!==t)&&(a==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+a&&(t.defaultValue=""+a))}var it=Array.isArray;function pt(t,s,a,f){if(t=t.options,s){s={};for(var v=0;v<a.length;v++)s["$"+a[v]]=!0;for(a=0;a<t.length;a++)v=s.hasOwnProperty("$"+t[a].value),t[a].selected!==v&&(t[a].selected=v),v&&f&&(t[a].defaultSelected=!0)}else{for(a=""+fe(a),s=null,v=0;v<t.length;v++){if(t[v].value===a){t[v].selected=!0,f&&(t[v].defaultSelected=!0);return}s!==null||t[v].disabled||(s=t[v])}s!==null&&(s.selected=!0)}}function Ze(t,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return J({},s,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Fe(t,s){var a=s.value;if(a==null){if(a=s.children,s=s.defaultValue,a!=null){if(s!=null)throw Error(r(92));if(it(a)){if(1<a.length)throw Error(r(93));a=a[0]}s=a}s==null&&(s=""),a=s}t._wrapperState={initialValue:fe(a)}}function Je(t,s){var a=fe(s.value),f=fe(s.defaultValue);a!=null&&(a=""+a,a!==t.value&&(t.value=a),s.defaultValue==null&&t.defaultValue!==a&&(t.defaultValue=a)),f!=null&&(t.defaultValue=""+f)}function Xe(t){var s=t.textContent;s===t._wrapperState.initialValue&&s!==""&&s!==null&&(t.value=s)}function Mt(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ut(t,s){return t==null||t==="http://www.w3.org/1999/xhtml"?Mt(s):t==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Qe,Ot=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,a,f,v){MSApp.execUnsafeLocalFunction(function(){return t(s,a,f,v)})}:t})(function(t,s){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=s;else{for(Qe=Qe||document.createElement("div"),Qe.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Qe.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;s.firstChild;)t.appendChild(s.firstChild)}});function Ft(t,s){if(s){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=s;return}}t.textContent=s}var et={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},St=["Webkit","ms","Moz","O"];Object.keys(et).forEach(function(t){St.forEach(function(s){s=s+t.charAt(0).toUpperCase()+t.substring(1),et[s]=et[t]})});function mt(t,s,a){return s==null||typeof s=="boolean"||s===""?"":a||typeof s!="number"||s===0||et.hasOwnProperty(t)&&et[t]?(""+s).trim():s+"px"}function wt(t,s){t=t.style;for(var a in s)if(s.hasOwnProperty(a)){var f=a.indexOf("--")===0,v=mt(a,s[a],f);a==="float"&&(a="cssFloat"),f?t.setProperty(a,v):t[a]=v}}var hn=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 Yt(t,s){if(s){if(hn[t]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,t));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function Pt(t,s){if(t.indexOf("-")===-1)return typeof s.is=="string";switch(t){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 Sn=null;function gr(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var kn=null,zt=null,Fn=null;function pn(t){if(t=Fo(t)){if(typeof kn!="function")throw Error(r(280));var s=t.stateNode;s&&(s=sl(s),kn(t.stateNode,t.type,s))}}function vr(t){zt?Fn?Fn.push(t):Fn=[t]:zt=t}function Wr(){if(zt){var t=zt,s=Fn;if(Fn=zt=null,pn(t),s)for(t=0;t<s.length;t++)pn(s[t])}}function gi(t,s){return t(s)}function Vr(){}var ct=!1;function vi(t,s,a){if(ct)return t(s,a);ct=!0;try{return gi(t,s,a)}finally{ct=!1,(zt!==null||Fn!==null)&&(Vr(),Wr())}}function mn(t,s){var a=t.stateNode;if(a===null)return null;var f=sl(a);if(f===null)return null;a=f[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(t=t.type,f=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!f;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(r(231,s,typeof a));return a}var Ts=!1;if(c)try{var yr={};Object.defineProperty(yr,"passive",{get:function(){Ts=!0}}),window.addEventListener("test",yr,yr),window.removeEventListener("test",yr,yr)}catch{Ts=!1}function zn(t,s,a,f,v,x,R,F,X){var ae=Array.prototype.slice.call(arguments,3);try{s.apply(a,ae)}catch(pe){this.onError(pe)}}var En=!1,Gr=null,Yr=!1,Kr=null,yi={onError:function(t){En=!0,Gr=t}};function ir(t,s,a,f,v,x,R,F,X){En=!1,Gr=null,zn.apply(yi,arguments)}function Rs(t,s,a,f,v,x,R,F,X){if(ir.apply(this,arguments),En){if(En){var ae=Gr;En=!1,Gr=null}else throw Error(r(198));Yr||(Yr=!0,Kr=ae)}}function Nn(t){var s=t,a=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(a=s.return),t=s.return;while(t)}return s.tag===3?a:null}function wr(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function js(t){if(Nn(t)!==t)throw Error(r(188))}function As(t){var s=t.alternate;if(!s){if(s=Nn(t),s===null)throw Error(r(188));return s!==t?null:t}for(var a=t,f=s;;){var v=a.return;if(v===null)break;var x=v.alternate;if(x===null){if(f=v.return,f!==null){a=f;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===a)return js(v),t;if(x===f)return js(v),s;x=x.sibling}throw Error(r(188))}if(a.return!==f.return)a=v,f=x;else{for(var R=!1,F=v.child;F;){if(F===a){R=!0,a=v,f=x;break}if(F===f){R=!0,f=v,a=x;break}F=F.sibling}if(!R){for(F=x.child;F;){if(F===a){R=!0,a=x,f=v;break}if(F===f){R=!0,f=x,a=v;break}F=F.sibling}if(!R)throw Error(r(189))}}if(a.alternate!==f)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?t:s}function Rt(t){return t=As(t),t!==null?xr(t):null}function xr(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var s=xr(t);if(s!==null)return s;t=t.sibling}return null}var _r=n.unstable_scheduleCallback,Kt=n.unstable_cancelCallback,Xr=n.unstable_shouldYield,wi=n.unstable_requestPaint,nt=n.unstable_now,br=n.unstable_getCurrentPriorityLevel,Qr=n.unstable_ImmediatePriority,Is=n.unstable_UserBlockingPriority,Zr=n.unstable_NormalPriority,Jr=n.unstable_LowPriority,Ms=n.unstable_IdlePriority,or=null,kt=null;function Os(t){if(kt&&typeof kt.onCommitFiberRoot=="function")try{kt.onCommitFiberRoot(or,t,void 0,(t.current.flags&128)===128)}catch{}}var gt=Math.clz32?Math.clz32:La,_o=Math.log,bo=Math.LN2;function La(t){return t>>>=0,t===0?32:31-(_o(t)/bo|0)|0}var Sr=64,es=4194304;function gn(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ps(t,s){var a=t.pendingLanes;if(a===0)return 0;var f=0,v=t.suspendedLanes,x=t.pingedLanes,R=a&268435455;if(R!==0){var F=R&~v;F!==0?f=gn(F):(x&=R,x!==0&&(f=gn(x)))}else R=a&~v,R!==0?f=gn(R):x!==0&&(f=gn(x));if(f===0)return 0;if(s!==0&&s!==f&&(s&v)===0&&(v=f&-f,x=s&-s,v>=x||v===16&&(x&4194240)!==0))return s;if((f&4)!==0&&(f|=a&16),s=t.entangledLanes,s!==0)for(t=t.entanglements,s&=f;0<s;)a=31-gt(s),v=1<<a,f|=t[a],s&=~v;return f}function $a(t,s){switch(t){case 1:case 2:case 4:return s+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 s+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 qa(t,s){for(var a=t.suspendedLanes,f=t.pingedLanes,v=t.expirationTimes,x=t.pendingLanes;0<x;){var R=31-gt(x),F=1<<R,X=v[R];X===-1?((F&a)===0||(F&f)!==0)&&(v[R]=$a(F,s)):X<=s&&(t.expiredLanes|=F),x&=~F}}function So(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function xi(){var t=Sr;return Sr<<=1,(Sr&4194240)===0&&(Sr=64),t}function ar(t){for(var s=[],a=0;31>a;a++)s.push(t);return s}function ts(t,s,a){t.pendingLanes|=s,s!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,s=31-gt(s),t[s]=a}function ec(t,s){var a=t.pendingLanes&~s;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=s,t.mutableReadLanes&=s,t.entangledLanes&=s,s=t.entanglements;var f=t.eventTimes;for(t=t.expirationTimes;0<a;){var v=31-gt(a),x=1<<v;s[v]=0,f[v]=-1,t[v]=-1,a&=~x}}function _i(t,s){var a=t.entangledLanes|=s;for(t=t.entanglements;a;){var f=31-gt(a),v=1<<f;v&s|t[f]&s&&(t[f]|=s),a&=~v}}var He=0;function Da(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var Xt,ko,bi,kr,ns,Ls=!1,Cn=[],Bn=null,vn=null,Un=null,$s=new Map,rs=new Map,lr=[],tc="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 Si(t,s){switch(t){case"focusin":case"focusout":Bn=null;break;case"dragenter":case"dragleave":vn=null;break;case"mouseover":case"mouseout":Un=null;break;case"pointerover":case"pointerout":$s.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":rs.delete(s.pointerId)}}function tn(t,s,a,f,v,x){return t===null||t.nativeEvent!==x?(t={blockedOn:s,domEventName:a,eventSystemFlags:f,nativeEvent:x,targetContainers:[v]},s!==null&&(s=Fo(s),s!==null&&ko(s)),t):(t.eventSystemFlags|=f,s=t.targetContainers,v!==null&&s.indexOf(v)===-1&&s.push(v),t)}function Eo(t,s,a,f,v){switch(s){case"focusin":return Bn=tn(Bn,t,s,a,f,v),!0;case"dragenter":return vn=tn(vn,t,s,a,f,v),!0;case"mouseover":return Un=tn(Un,t,s,a,f,v),!0;case"pointerover":var x=v.pointerId;return $s.set(x,tn($s.get(x)||null,t,s,a,f,v)),!0;case"gotpointercapture":return x=v.pointerId,rs.set(x,tn(rs.get(x)||null,t,s,a,f,v)),!0}return!1}function No(t){var s=Vs(t.target);if(s!==null){var a=Nn(s);if(a!==null){if(s=a.tag,s===13){if(s=wr(a),s!==null){t.blockedOn=s,ns(t.priority,function(){bi(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ki(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var a=Nr(t.domEventName,t.eventSystemFlags,s[0],t.nativeEvent);if(a===null){a=t.nativeEvent;var f=new a.constructor(a.type,a);Sn=f,a.target.dispatchEvent(f),Sn=null}else return s=Fo(a),s!==null&&ko(s),t.blockedOn=a,!1;s.shift()}return!0}function Fa(t,s,a){ki(t)&&a.delete(s)}function za(){Ls=!1,Bn!==null&&ki(Bn)&&(Bn=null),vn!==null&&ki(vn)&&(vn=null),Un!==null&&ki(Un)&&(Un=null),$s.forEach(Fa),rs.forEach(Fa)}function ss(t,s){t.blockedOn===s&&(t.blockedOn=null,Ls||(Ls=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,za)))}function nn(t){function s(v){return ss(v,t)}if(0<Cn.length){ss(Cn[0],t);for(var a=1;a<Cn.length;a++){var f=Cn[a];f.blockedOn===t&&(f.blockedOn=null)}}for(Bn!==null&&ss(Bn,t),vn!==null&&ss(vn,t),Un!==null&&ss(Un,t),$s.forEach(s),rs.forEach(s),a=0;a<lr.length;a++)f=lr[a],f.blockedOn===t&&(f.blockedOn=null);for(;0<lr.length&&(a=lr[0],a.blockedOn===null);)No(a),a.blockedOn===null&&lr.shift()}var is=T.ReactCurrentBatchConfig,qs=!0;function nc(t,s,a,f){var v=He,x=is.transition;is.transition=null;try{He=1,Hn(t,s,a,f)}finally{He=v,is.transition=x}}function Ds(t,s,a,f){var v=He,x=is.transition;is.transition=null;try{He=4,Hn(t,s,a,f)}finally{He=v,is.transition=x}}function Hn(t,s,a,f){if(qs){var v=Nr(t,s,a,f);if(v===null)pc(t,s,f,Er,a),Si(t,f);else if(Eo(v,t,s,a,f))f.stopPropagation();else if(Si(t,f),s&4&&-1<tc.indexOf(t)){for(;v!==null;){var x=Fo(v);if(x!==null&&Xt(x),x=Nr(t,s,a,f),x===null&&pc(t,s,f,Er,a),x===v)break;v=x}v!==null&&f.stopPropagation()}else pc(t,s,f,null,a)}}var Er=null;function Nr(t,s,a,f){if(Er=null,t=gr(f),t=Vs(t),t!==null)if(s=Nn(t),s===null)t=null;else if(a=s.tag,a===13){if(t=wr(s),t!==null)return t;t=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null);return Er=t,null}function Ba(t){switch(t){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(br()){case Qr:return 1;case Is:return 4;case Zr:case Jr:return 16;case Ms:return 536870912;default:return 16}default:return 16}}var dt=null,Fs=null,zs=null;function Co(){if(zs)return zs;var t,s=Fs,a=s.length,f,v="value"in dt?dt.value:dt.textContent,x=v.length;for(t=0;t<a&&s[t]===v[t];t++);var R=a-t;for(f=1;f<=R&&s[a-f]===v[x-f];f++);return zs=v.slice(t,1<f?1-f:void 0)}function Bs(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function Cr(){return!0}function Ei(){return!1}function Bt(t){function s(a,f,v,x,R){this._reactName=a,this._targetInst=v,this.type=f,this.nativeEvent=x,this.target=R,this.currentTarget=null;for(var F in t)t.hasOwnProperty(F)&&(a=t[F],this[F]=a?a(x):x[F]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Cr:Ei,this.isPropagationStopped=Ei,this}return J(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Cr)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Cr)},persist:function(){},isPersistent:Cr}),s}var Wn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ni=Bt(Wn),Tr=J({},Wn,{view:0,detail:0}),Ua=Bt(Tr),Rr,To,Qt,Us=J({},Tr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Oe,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Qt&&(Qt&&t.type==="mousemove"?(Rr=t.screenX-Qt.screenX,To=t.screenY-Qt.screenY):To=Rr=0,Qt=t),Rr)},movementY:function(t){return"movementY"in t?t.movementY:To}}),Ro=Bt(Us),rc=J({},Us,{dataTransfer:0}),sc=Bt(rc),Ha=J({},Tr,{relatedTarget:0}),Ut=Bt(Ha),Wa=J({},Wn,{animationName:0,elapsedTime:0,pseudoElement:0}),Va=Bt(Wa),Ga=J({},Wn,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Ya=Bt(Ga),W=J({},Wn,{data:0}),K=Bt(W),le={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},de={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"},xe={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ee(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=xe[t])?!!s[t]:!1}function Oe(){return Ee}var ze=J({},Tr,{key:function(t){if(t.key){var s=le[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=Bs(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?de[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Oe,charCode:function(t){return t.type==="keypress"?Bs(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Bs(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Ge=Bt(ze),Ve=J({},Us,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qe=Bt(Ve),Tn=J({},Tr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Oe}),Hs=Bt(Tn),jo=J({},Wn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ws=Bt(jo),Ao=J({},Us,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Ka=Bt(Ao),Ci=[9,13,27,32],yn=c&&"CompositionEvent"in window,ot=null;c&&"documentMode"in document&&(ot=document.documentMode);var Xa=c&&"TextEvent"in window&&!ot,Ey=c&&(!yn||ot&&8<ot&&11>=ot),Ny=" ",Cy=!1;function Ty(t,s){switch(t){case"keyup":return Ci.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ry(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ti=!1;function UT(t,s){switch(t){case"compositionend":return Ry(s);case"keypress":return s.which!==32?null:(Cy=!0,Ny);case"textInput":return t=s.data,t===Ny&&Cy?null:t;default:return null}}function HT(t,s){if(Ti)return t==="compositionend"||!yn&&Ty(t,s)?(t=Co(),zs=Fs=dt=null,Ti=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Ey&&s.locale!=="ko"?null:s.data;default:return null}}var WT={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 jy(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!WT[t.type]:s==="textarea"}function Ay(t,s,a,f){vr(f),s=tl(s,"onChange"),0<s.length&&(a=new Ni("onChange","change",null,a,f),t.push({event:a,listeners:s}))}var Io=null,Mo=null;function VT(t){Ky(t,0)}function Qa(t){var s=Mi(t);if(ve(s))return t}function GT(t,s){if(t==="change")return s}var Iy=!1;if(c){var ic;if(c){var oc="oninput"in document;if(!oc){var My=document.createElement("div");My.setAttribute("oninput","return;"),oc=typeof My.oninput=="function"}ic=oc}else ic=!1;Iy=ic&&(!document.documentMode||9<document.documentMode)}function Oy(){Io&&(Io.detachEvent("onpropertychange",Py),Mo=Io=null)}function Py(t){if(t.propertyName==="value"&&Qa(Mo)){var s=[];Ay(s,Mo,t,gr(t)),vi(VT,s)}}function YT(t,s,a){t==="focusin"?(Oy(),Io=s,Mo=a,Io.attachEvent("onpropertychange",Py)):t==="focusout"&&Oy()}function KT(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Qa(Mo)}function XT(t,s){if(t==="click")return Qa(s)}function QT(t,s){if(t==="input"||t==="change")return Qa(s)}function ZT(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var Vn=typeof Object.is=="function"?Object.is:ZT;function Oo(t,s){if(Vn(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var a=Object.keys(t),f=Object.keys(s);if(a.length!==f.length)return!1;for(f=0;f<a.length;f++){var v=a[f];if(!h.call(s,v)||!Vn(t[v],s[v]))return!1}return!0}function Ly(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function $y(t,s){var a=Ly(t);t=0;for(var f;a;){if(a.nodeType===3){if(f=t+a.textContent.length,t<=s&&f>=s)return{node:a,offset:s-t};t=f}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Ly(a)}}function qy(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?qy(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function Dy(){for(var t=window,s=je();s instanceof t.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)t=s.contentWindow;else break;s=je(t.document)}return s}function ac(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}function JT(t){var s=Dy(),a=t.focusedElem,f=t.selectionRange;if(s!==a&&a&&a.ownerDocument&&qy(a.ownerDocument.documentElement,a)){if(f!==null&&ac(a)){if(s=f.start,t=f.end,t===void 0&&(t=s),"selectionStart"in a)a.selectionStart=s,a.selectionEnd=Math.min(t,a.value.length);else if(t=(s=a.ownerDocument||document)&&s.defaultView||window,t.getSelection){t=t.getSelection();var v=a.textContent.length,x=Math.min(f.start,v);f=f.end===void 0?x:Math.min(f.end,v),!t.extend&&x>f&&(v=f,f=x,x=v),v=$y(a,x);var R=$y(a,f);v&&R&&(t.rangeCount!==1||t.anchorNode!==v.node||t.anchorOffset!==v.offset||t.focusNode!==R.node||t.focusOffset!==R.offset)&&(s=s.createRange(),s.setStart(v.node,v.offset),t.removeAllRanges(),x>f?(t.addRange(s),t.extend(R.node,R.offset)):(s.setEnd(R.node,R.offset),t.addRange(s)))}}for(s=[],t=a;t=t.parentNode;)t.nodeType===1&&s.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<s.length;a++)t=s[a],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var eR=c&&"documentMode"in document&&11>=document.documentMode,Ri=null,lc=null,Po=null,uc=!1;function Fy(t,s,a){var f=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;uc||Ri==null||Ri!==je(f)||(f=Ri,"selectionStart"in f&&ac(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Po&&Oo(Po,f)||(Po=f,f=tl(lc,"onSelect"),0<f.length&&(s=new Ni("onSelect","select",null,s,a),t.push({event:s,listeners:f}),s.target=Ri)))}function Za(t,s){var a={};return a[t.toLowerCase()]=s.toLowerCase(),a["Webkit"+t]="webkit"+s,a["Moz"+t]="moz"+s,a}var ji={animationend:Za("Animation","AnimationEnd"),animationiteration:Za("Animation","AnimationIteration"),animationstart:Za("Animation","AnimationStart"),transitionend:Za("Transition","TransitionEnd")},cc={},zy={};c&&(zy=document.createElement("div").style,"AnimationEvent"in window||(delete ji.animationend.animation,delete ji.animationiteration.animation,delete ji.animationstart.animation),"TransitionEvent"in window||delete ji.transitionend.transition);function Ja(t){if(cc[t])return cc[t];if(!ji[t])return t;var s=ji[t],a;for(a in s)if(s.hasOwnProperty(a)&&a in zy)return cc[t]=s[a];return t}var By=Ja("animationend"),Uy=Ja("animationiteration"),Hy=Ja("animationstart"),Wy=Ja("transitionend"),Vy=new Map,Gy="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 os(t,s){Vy.set(t,s),l(s,[t])}for(var dc=0;dc<Gy.length;dc++){var fc=Gy[dc],tR=fc.toLowerCase(),nR=fc[0].toUpperCase()+fc.slice(1);os(tR,"on"+nR)}os(By,"onAnimationEnd"),os(Uy,"onAnimationIteration"),os(Hy,"onAnimationStart"),os("dblclick","onDoubleClick"),os("focusin","onFocus"),os("focusout","onBlur"),os(Wy,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Lo="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(" "),rR=new Set("cancel close invalid load scroll toggle".split(" ").concat(Lo));function Yy(t,s,a){var f=t.type||"unknown-event";t.currentTarget=a,Rs(f,s,void 0,t),t.currentTarget=null}function Ky(t,s){s=(s&4)!==0;for(var a=0;a<t.length;a++){var f=t[a],v=f.event;f=f.listeners;e:{var x=void 0;if(s)for(var R=f.length-1;0<=R;R--){var F=f[R],X=F.instance,ae=F.currentTarget;if(F=F.listener,X!==x&&v.isPropagationStopped())break e;Yy(v,F,ae),x=X}else for(R=0;R<f.length;R++){if(F=f[R],X=F.instance,ae=F.currentTarget,F=F.listener,X!==x&&v.isPropagationStopped())break e;Yy(v,F,ae),x=X}}}if(Yr)throw t=Kr,Yr=!1,Kr=null,t}function rt(t,s){var a=s[xc];a===void 0&&(a=s[xc]=new Set);var f=t+"__bubble";a.has(f)||(Xy(s,t,2,!1),a.add(f))}function hc(t,s,a){var f=0;s&&(f|=4),Xy(a,t,f,s)}var el="_reactListening"+Math.random().toString(36).slice(2);function $o(t){if(!t[el]){t[el]=!0,i.forEach(function(a){a!=="selectionchange"&&(rR.has(a)||hc(a,!1,t),hc(a,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[el]||(s[el]=!0,hc("selectionchange",!1,s))}}function Xy(t,s,a,f){switch(Ba(s)){case 1:var v=nc;break;case 4:v=Ds;break;default:v=Hn}a=v.bind(null,s,a,t),v=void 0,!Ts||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(v=!0),f?v!==void 0?t.addEventListener(s,a,{capture:!0,passive:v}):t.addEventListener(s,a,!0):v!==void 0?t.addEventListener(s,a,{passive:v}):t.addEventListener(s,a,!1)}function pc(t,s,a,f,v){var x=f;if((s&1)===0&&(s&2)===0&&f!==null)e:for(;;){if(f===null)return;var R=f.tag;if(R===3||R===4){var F=f.stateNode.containerInfo;if(F===v||F.nodeType===8&&F.parentNode===v)break;if(R===4)for(R=f.return;R!==null;){var X=R.tag;if((X===3||X===4)&&(X=R.stateNode.containerInfo,X===v||X.nodeType===8&&X.parentNode===v))return;R=R.return}for(;F!==null;){if(R=Vs(F),R===null)return;if(X=R.tag,X===5||X===6){f=x=R;continue e}F=F.parentNode}}f=f.return}vi(function(){var ae=x,pe=gr(a),me=[];e:{var he=Vy.get(t);if(he!==void 0){var be=Ni,Ne=t;switch(t){case"keypress":if(Bs(a)===0)break e;case"keydown":case"keyup":be=Ge;break;case"focusin":Ne="focus",be=Ut;break;case"focusout":Ne="blur",be=Ut;break;case"beforeblur":case"afterblur":be=Ut;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":be=Ro;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":be=sc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":be=Hs;break;case By:case Uy:case Hy:be=Va;break;case Wy:be=Ws;break;case"scroll":be=Ua;break;case"wheel":be=Ka;break;case"copy":case"cut":case"paste":be=Ya;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":be=qe}var Te=(s&4)!==0,xt=!Te&&t==="scroll",se=Te?he!==null?he+"Capture":null:he;Te=[];for(var ee=ae,ie;ee!==null;){ie=ee;var ge=ie.stateNode;if(ie.tag===5&&ge!==null&&(ie=ge,se!==null&&(ge=mn(ee,se),ge!=null&&Te.push(qo(ee,ge,ie)))),xt)break;ee=ee.return}0<Te.length&&(he=new be(he,Ne,null,a,pe),me.push({event:he,listeners:Te}))}}if((s&7)===0){e:{if(he=t==="mouseover"||t==="pointerover",be=t==="mouseout"||t==="pointerout",he&&a!==Sn&&(Ne=a.relatedTarget||a.fromElement)&&(Vs(Ne)||Ne[jr]))break e;if((be||he)&&(he=pe.window===pe?pe:(he=pe.ownerDocument)?he.defaultView||he.parentWindow:window,be?(Ne=a.relatedTarget||a.toElement,be=ae,Ne=Ne?Vs(Ne):null,Ne!==null&&(xt=Nn(Ne),Ne!==xt||Ne.tag!==5&&Ne.tag!==6)&&(Ne=null)):(be=null,Ne=ae),be!==Ne)){if(Te=Ro,ge="onMouseLeave",se="onMouseEnter",ee="mouse",(t==="pointerout"||t==="pointerover")&&(Te=qe,ge="onPointerLeave",se="onPointerEnter",ee="pointer"),xt=be==null?he:Mi(be),ie=Ne==null?he:Mi(Ne),he=new Te(ge,ee+"leave",be,a,pe),he.target=xt,he.relatedTarget=ie,ge=null,Vs(pe)===ae&&(Te=new Te(se,ee+"enter",Ne,a,pe),Te.target=ie,Te.relatedTarget=xt,ge=Te),xt=ge,be&&Ne)t:{for(Te=be,se=Ne,ee=0,ie=Te;ie;ie=Ai(ie))ee++;for(ie=0,ge=se;ge;ge=Ai(ge))ie++;for(;0<ee-ie;)Te=Ai(Te),ee--;for(;0<ie-ee;)se=Ai(se),ie--;for(;ee--;){if(Te===se||se!==null&&Te===se.alternate)break t;Te=Ai(Te),se=Ai(se)}Te=null}else Te=null;be!==null&&Qy(me,he,be,Te,!1),Ne!==null&&xt!==null&&Qy(me,xt,Ne,Te,!0)}}e:{if(he=ae?Mi(ae):window,be=he.nodeName&&he.nodeName.toLowerCase(),be==="select"||be==="input"&&he.type==="file")var Re=GT;else if(jy(he))if(Iy)Re=QT;else{Re=KT;var Ie=YT}else(be=he.nodeName)&&be.toLowerCase()==="input"&&(he.type==="checkbox"||he.type==="radio")&&(Re=XT);if(Re&&(Re=Re(t,ae))){Ay(me,Re,a,pe);break e}Ie&&Ie(t,he,ae),t==="focusout"&&(Ie=he._wrapperState)&&Ie.controlled&&he.type==="number"&&Be(he,"number",he.value)}switch(Ie=ae?Mi(ae):window,t){case"focusin":(jy(Ie)||Ie.contentEditable==="true")&&(Ri=Ie,lc=ae,Po=null);break;case"focusout":Po=lc=Ri=null;break;case"mousedown":uc=!0;break;case"contextmenu":case"mouseup":case"dragend":uc=!1,Fy(me,a,pe);break;case"selectionchange":if(eR)break;case"keydown":case"keyup":Fy(me,a,pe)}var Me;if(yn)e:{switch(t){case"compositionstart":var Pe="onCompositionStart";break e;case"compositionend":Pe="onCompositionEnd";break e;case"compositionupdate":Pe="onCompositionUpdate";break e}Pe=void 0}else Ti?Ty(t,a)&&(Pe="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(Pe="onCompositionStart");Pe&&(Ey&&a.locale!=="ko"&&(Ti||Pe!=="onCompositionStart"?Pe==="onCompositionEnd"&&Ti&&(Me=Co()):(dt=pe,Fs="value"in dt?dt.value:dt.textContent,Ti=!0)),Ie=tl(ae,Pe),0<Ie.length&&(Pe=new K(Pe,t,null,a,pe),me.push({event:Pe,listeners:Ie}),Me?Pe.data=Me:(Me=Ry(a),Me!==null&&(Pe.data=Me)))),(Me=Xa?UT(t,a):HT(t,a))&&(ae=tl(ae,"onBeforeInput"),0<ae.length&&(pe=new K("onBeforeInput","beforeinput",null,a,pe),me.push({event:pe,listeners:ae}),pe.data=Me))}Ky(me,s)})}function qo(t,s,a){return{instance:t,listener:s,currentTarget:a}}function tl(t,s){for(var a=s+"Capture",f=[];t!==null;){var v=t,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=mn(t,a),x!=null&&f.unshift(qo(t,x,v)),x=mn(t,s),x!=null&&f.push(qo(t,x,v))),t=t.return}return f}function Ai(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Qy(t,s,a,f,v){for(var x=s._reactName,R=[];a!==null&&a!==f;){var F=a,X=F.alternate,ae=F.stateNode;if(X!==null&&X===f)break;F.tag===5&&ae!==null&&(F=ae,v?(X=mn(a,x),X!=null&&R.unshift(qo(a,X,F))):v||(X=mn(a,x),X!=null&&R.push(qo(a,X,F)))),a=a.return}R.length!==0&&t.push({event:s,listeners:R})}var sR=/\r\n?/g,iR=/\u0000|\uFFFD/g;function Zy(t){return(typeof t=="string"?t:""+t).replace(sR,`
38
- `).replace(iR,"")}function nl(t,s,a){if(s=Zy(s),Zy(t)!==s&&a)throw Error(r(425))}function rl(){}var mc=null,gc=null;function vc(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var yc=typeof setTimeout=="function"?setTimeout:void 0,oR=typeof clearTimeout=="function"?clearTimeout:void 0,Jy=typeof Promise=="function"?Promise:void 0,aR=typeof queueMicrotask=="function"?queueMicrotask:typeof Jy<"u"?function(t){return Jy.resolve(null).then(t).catch(lR)}:yc;function lR(t){setTimeout(function(){throw t})}function wc(t,s){var a=s,f=0;do{var v=a.nextSibling;if(t.removeChild(a),v&&v.nodeType===8)if(a=v.data,a==="/$"){if(f===0){t.removeChild(v),nn(s);return}f--}else a!=="$"&&a!=="$?"&&a!=="$!"||f++;a=v}while(a);nn(s)}function as(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return t}function e0(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"){if(s===0)return t;s--}else a==="/$"&&s++}t=t.previousSibling}return null}var Ii=Math.random().toString(36).slice(2),ur="__reactFiber$"+Ii,Do="__reactProps$"+Ii,jr="__reactContainer$"+Ii,xc="__reactEvents$"+Ii,uR="__reactListeners$"+Ii,cR="__reactHandles$"+Ii;function Vs(t){var s=t[ur];if(s)return s;for(var a=t.parentNode;a;){if(s=a[jr]||a[ur]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(t=e0(t);t!==null;){if(a=t[ur])return a;t=e0(t)}return s}t=a,a=t.parentNode}return null}function Fo(t){return t=t[ur]||t[jr],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Mi(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(r(33))}function sl(t){return t[Do]||null}var _c=[],Oi=-1;function ls(t){return{current:t}}function st(t){0>Oi||(t.current=_c[Oi],_c[Oi]=null,Oi--)}function tt(t,s){Oi++,_c[Oi]=t.current,t.current=s}var us={},Ht=ls(us),rn=ls(!1),Gs=us;function Pi(t,s){var a=t.type.contextTypes;if(!a)return us;var f=t.stateNode;if(f&&f.__reactInternalMemoizedUnmaskedChildContext===s)return f.__reactInternalMemoizedMaskedChildContext;var v={},x;for(x in a)v[x]=s[x];return f&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=v),v}function sn(t){return t=t.childContextTypes,t!=null}function il(){st(rn),st(Ht)}function t0(t,s,a){if(Ht.current!==us)throw Error(r(168));tt(Ht,s),tt(rn,a)}function n0(t,s,a){var f=t.stateNode;if(s=s.childContextTypes,typeof f.getChildContext!="function")return a;f=f.getChildContext();for(var v in f)if(!(v in s))throw Error(r(108,oe(t)||"Unknown",v));return J({},a,f)}function ol(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||us,Gs=Ht.current,tt(Ht,t),tt(rn,rn.current),!0}function r0(t,s,a){var f=t.stateNode;if(!f)throw Error(r(169));a?(t=n0(t,s,Gs),f.__reactInternalMemoizedMergedChildContext=t,st(rn),st(Ht),tt(Ht,t)):st(rn),tt(rn,a)}var Ar=null,al=!1,bc=!1;function s0(t){Ar===null?Ar=[t]:Ar.push(t)}function dR(t){al=!0,s0(t)}function cs(){if(!bc&&Ar!==null){bc=!0;var t=0,s=He;try{var a=Ar;for(He=1;t<a.length;t++){var f=a[t];do f=f(!0);while(f!==null)}Ar=null,al=!1}catch(v){throw Ar!==null&&(Ar=Ar.slice(t+1)),_r(Qr,cs),v}finally{He=s,bc=!1}}return null}var Li=[],$i=0,ll=null,ul=0,Rn=[],jn=0,Ys=null,Ir=1,Mr="";function Ks(t,s){Li[$i++]=ul,Li[$i++]=ll,ll=t,ul=s}function i0(t,s,a){Rn[jn++]=Ir,Rn[jn++]=Mr,Rn[jn++]=Ys,Ys=t;var f=Ir;t=Mr;var v=32-gt(f)-1;f&=~(1<<v),a+=1;var x=32-gt(s)+v;if(30<x){var R=v-v%5;x=(f&(1<<R)-1).toString(32),f>>=R,v-=R,Ir=1<<32-gt(s)+v|a<<v|f,Mr=x+t}else Ir=1<<x|a<<v|f,Mr=t}function Sc(t){t.return!==null&&(Ks(t,1),i0(t,1,0))}function kc(t){for(;t===ll;)ll=Li[--$i],Li[$i]=null,ul=Li[--$i],Li[$i]=null;for(;t===Ys;)Ys=Rn[--jn],Rn[jn]=null,Mr=Rn[--jn],Rn[jn]=null,Ir=Rn[--jn],Rn[jn]=null}var wn=null,xn=null,at=!1,Gn=null;function o0(t,s){var a=On(5,null,null,0);a.elementType="DELETED",a.stateNode=s,a.return=t,s=t.deletions,s===null?(t.deletions=[a],t.flags|=16):s.push(a)}function a0(t,s){switch(t.tag){case 5:var a=t.type;return s=s.nodeType!==1||a.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(t.stateNode=s,wn=t,xn=as(s.firstChild),!0):!1;case 6:return s=t.pendingProps===""||s.nodeType!==3?null:s,s!==null?(t.stateNode=s,wn=t,xn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(a=Ys!==null?{id:Ir,overflow:Mr}:null,t.memoizedState={dehydrated:s,treeContext:a,retryLane:1073741824},a=On(18,null,null,0),a.stateNode=s,a.return=t,t.child=a,wn=t,xn=null,!0):!1;default:return!1}}function Ec(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Nc(t){if(at){var s=xn;if(s){var a=s;if(!a0(t,s)){if(Ec(t))throw Error(r(418));s=as(a.nextSibling);var f=wn;s&&a0(t,s)?o0(f,a):(t.flags=t.flags&-4097|2,at=!1,wn=t)}}else{if(Ec(t))throw Error(r(418));t.flags=t.flags&-4097|2,at=!1,wn=t}}}function l0(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;wn=t}function cl(t){if(t!==wn)return!1;if(!at)return l0(t),at=!0,!1;var s;if((s=t.tag!==3)&&!(s=t.tag!==5)&&(s=t.type,s=s!=="head"&&s!=="body"&&!vc(t.type,t.memoizedProps)),s&&(s=xn)){if(Ec(t))throw u0(),Error(r(418));for(;s;)o0(t,s),s=as(s.nextSibling)}if(l0(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));e:{for(t=t.nextSibling,s=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"){if(s===0){xn=as(t.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++}t=t.nextSibling}xn=null}}else xn=wn?as(t.stateNode.nextSibling):null;return!0}function u0(){for(var t=xn;t;)t=as(t.nextSibling)}function qi(){xn=wn=null,at=!1}function Cc(t){Gn===null?Gn=[t]:Gn.push(t)}var fR=T.ReactCurrentBatchConfig;function zo(t,s,a){if(t=a.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(r(309));var f=a.stateNode}if(!f)throw Error(r(147,t));var v=f,x=""+t;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===x?s.ref:(s=function(R){var F=v.refs;R===null?delete F[x]:F[x]=R},s._stringRef=x,s)}if(typeof t!="string")throw Error(r(284));if(!a._owner)throw Error(r(290,t))}return t}function dl(t,s){throw t=Object.prototype.toString.call(s),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t))}function c0(t){var s=t._init;return s(t._payload)}function d0(t){function s(se,ee){if(t){var ie=se.deletions;ie===null?(se.deletions=[ee],se.flags|=16):ie.push(ee)}}function a(se,ee){if(!t)return null;for(;ee!==null;)s(se,ee),ee=ee.sibling;return null}function f(se,ee){for(se=new Map;ee!==null;)ee.key!==null?se.set(ee.key,ee):se.set(ee.index,ee),ee=ee.sibling;return se}function v(se,ee){return se=ys(se,ee),se.index=0,se.sibling=null,se}function x(se,ee,ie){return se.index=ie,t?(ie=se.alternate,ie!==null?(ie=ie.index,ie<ee?(se.flags|=2,ee):ie):(se.flags|=2,ee)):(se.flags|=1048576,ee)}function R(se){return t&&se.alternate===null&&(se.flags|=2),se}function F(se,ee,ie,ge){return ee===null||ee.tag!==6?(ee=yd(ie,se.mode,ge),ee.return=se,ee):(ee=v(ee,ie),ee.return=se,ee)}function X(se,ee,ie,ge){var Re=ie.type;return Re===A?pe(se,ee,ie.props.children,ge,ie.key):ee!==null&&(ee.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===L&&c0(Re)===ee.type)?(ge=v(ee,ie.props),ge.ref=zo(se,ee,ie),ge.return=se,ge):(ge=Pl(ie.type,ie.key,ie.props,null,se.mode,ge),ge.ref=zo(se,ee,ie),ge.return=se,ge)}function ae(se,ee,ie,ge){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ie.containerInfo||ee.stateNode.implementation!==ie.implementation?(ee=wd(ie,se.mode,ge),ee.return=se,ee):(ee=v(ee,ie.children||[]),ee.return=se,ee)}function pe(se,ee,ie,ge,Re){return ee===null||ee.tag!==7?(ee=ri(ie,se.mode,ge,Re),ee.return=se,ee):(ee=v(ee,ie),ee.return=se,ee)}function me(se,ee,ie){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=yd(""+ee,se.mode,ie),ee.return=se,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case I:return ie=Pl(ee.type,ee.key,ee.props,null,se.mode,ie),ie.ref=zo(se,null,ee),ie.return=se,ie;case O:return ee=wd(ee,se.mode,ie),ee.return=se,ee;case L:var ge=ee._init;return me(se,ge(ee._payload),ie)}if(it(ee)||H(ee))return ee=ri(ee,se.mode,ie,null),ee.return=se,ee;dl(se,ee)}return null}function he(se,ee,ie,ge){var Re=ee!==null?ee.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return Re!==null?null:F(se,ee,""+ie,ge);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:return ie.key===Re?X(se,ee,ie,ge):null;case O:return ie.key===Re?ae(se,ee,ie,ge):null;case L:return Re=ie._init,he(se,ee,Re(ie._payload),ge)}if(it(ie)||H(ie))return Re!==null?null:pe(se,ee,ie,ge,null);dl(se,ie)}return null}function be(se,ee,ie,ge,Re){if(typeof ge=="string"&&ge!==""||typeof ge=="number")return se=se.get(ie)||null,F(ee,se,""+ge,Re);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case I:return se=se.get(ge.key===null?ie:ge.key)||null,X(ee,se,ge,Re);case O:return se=se.get(ge.key===null?ie:ge.key)||null,ae(ee,se,ge,Re);case L:var Ie=ge._init;return be(se,ee,ie,Ie(ge._payload),Re)}if(it(ge)||H(ge))return se=se.get(ie)||null,pe(ee,se,ge,Re,null);dl(ee,ge)}return null}function Ne(se,ee,ie,ge){for(var Re=null,Ie=null,Me=ee,Pe=ee=0,It=null;Me!==null&&Pe<ie.length;Pe++){Me.index>Pe?(It=Me,Me=null):It=Me.sibling;var We=he(se,Me,ie[Pe],ge);if(We===null){Me===null&&(Me=It);break}t&&Me&&We.alternate===null&&s(se,Me),ee=x(We,ee,Pe),Ie===null?Re=We:Ie.sibling=We,Ie=We,Me=It}if(Pe===ie.length)return a(se,Me),at&&Ks(se,Pe),Re;if(Me===null){for(;Pe<ie.length;Pe++)Me=me(se,ie[Pe],ge),Me!==null&&(ee=x(Me,ee,Pe),Ie===null?Re=Me:Ie.sibling=Me,Ie=Me);return at&&Ks(se,Pe),Re}for(Me=f(se,Me);Pe<ie.length;Pe++)It=be(Me,se,Pe,ie[Pe],ge),It!==null&&(t&&It.alternate!==null&&Me.delete(It.key===null?Pe:It.key),ee=x(It,ee,Pe),Ie===null?Re=It:Ie.sibling=It,Ie=It);return t&&Me.forEach(function(ws){return s(se,ws)}),at&&Ks(se,Pe),Re}function Te(se,ee,ie,ge){var Re=H(ie);if(typeof Re!="function")throw Error(r(150));if(ie=Re.call(ie),ie==null)throw Error(r(151));for(var Ie=Re=null,Me=ee,Pe=ee=0,It=null,We=ie.next();Me!==null&&!We.done;Pe++,We=ie.next()){Me.index>Pe?(It=Me,Me=null):It=Me.sibling;var ws=he(se,Me,We.value,ge);if(ws===null){Me===null&&(Me=It);break}t&&Me&&ws.alternate===null&&s(se,Me),ee=x(ws,ee,Pe),Ie===null?Re=ws:Ie.sibling=ws,Ie=ws,Me=It}if(We.done)return a(se,Me),at&&Ks(se,Pe),Re;if(Me===null){for(;!We.done;Pe++,We=ie.next())We=me(se,We.value,ge),We!==null&&(ee=x(We,ee,Pe),Ie===null?Re=We:Ie.sibling=We,Ie=We);return at&&Ks(se,Pe),Re}for(Me=f(se,Me);!We.done;Pe++,We=ie.next())We=be(Me,se,Pe,We.value,ge),We!==null&&(t&&We.alternate!==null&&Me.delete(We.key===null?Pe:We.key),ee=x(We,ee,Pe),Ie===null?Re=We:Ie.sibling=We,Ie=We);return t&&Me.forEach(function(WR){return s(se,WR)}),at&&Ks(se,Pe),Re}function xt(se,ee,ie,ge){if(typeof ie=="object"&&ie!==null&&ie.type===A&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:e:{for(var Re=ie.key,Ie=ee;Ie!==null;){if(Ie.key===Re){if(Re=ie.type,Re===A){if(Ie.tag===7){a(se,Ie.sibling),ee=v(Ie,ie.props.children),ee.return=se,se=ee;break e}}else if(Ie.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===L&&c0(Re)===Ie.type){a(se,Ie.sibling),ee=v(Ie,ie.props),ee.ref=zo(se,Ie,ie),ee.return=se,se=ee;break e}a(se,Ie);break}else s(se,Ie);Ie=Ie.sibling}ie.type===A?(ee=ri(ie.props.children,se.mode,ge,ie.key),ee.return=se,se=ee):(ge=Pl(ie.type,ie.key,ie.props,null,se.mode,ge),ge.ref=zo(se,ee,ie),ge.return=se,se=ge)}return R(se);case O:e:{for(Ie=ie.key;ee!==null;){if(ee.key===Ie)if(ee.tag===4&&ee.stateNode.containerInfo===ie.containerInfo&&ee.stateNode.implementation===ie.implementation){a(se,ee.sibling),ee=v(ee,ie.children||[]),ee.return=se,se=ee;break e}else{a(se,ee);break}else s(se,ee);ee=ee.sibling}ee=wd(ie,se.mode,ge),ee.return=se,se=ee}return R(se);case L:return Ie=ie._init,xt(se,ee,Ie(ie._payload),ge)}if(it(ie))return Ne(se,ee,ie,ge);if(H(ie))return Te(se,ee,ie,ge);dl(se,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,ee!==null&&ee.tag===6?(a(se,ee.sibling),ee=v(ee,ie),ee.return=se,se=ee):(a(se,ee),ee=yd(ie,se.mode,ge),ee.return=se,se=ee),R(se)):a(se,ee)}return xt}var Di=d0(!0),f0=d0(!1),fl=ls(null),hl=null,Fi=null,Tc=null;function Rc(){Tc=Fi=hl=null}function jc(t){var s=fl.current;st(fl),t._currentValue=s}function Ac(t,s,a){for(;t!==null;){var f=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,f!==null&&(f.childLanes|=s)):f!==null&&(f.childLanes&s)!==s&&(f.childLanes|=s),t===a)break;t=t.return}}function zi(t,s){hl=t,Tc=Fi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&s)!==0&&(on=!0),t.firstContext=null)}function An(t){var s=t._currentValue;if(Tc!==t)if(t={context:t,memoizedValue:s,next:null},Fi===null){if(hl===null)throw Error(r(308));Fi=t,hl.dependencies={lanes:0,firstContext:t}}else Fi=Fi.next=t;return s}var Xs=null;function Ic(t){Xs===null?Xs=[t]:Xs.push(t)}function h0(t,s,a,f){var v=s.interleaved;return v===null?(a.next=a,Ic(s)):(a.next=v.next,v.next=a),s.interleaved=a,Or(t,f)}function Or(t,s){t.lanes|=s;var a=t.alternate;for(a!==null&&(a.lanes|=s),a=t,t=t.return;t!==null;)t.childLanes|=s,a=t.alternate,a!==null&&(a.childLanes|=s),a=t,t=t.return;return a.tag===3?a.stateNode:null}var ds=!1;function Mc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function p0(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Pr(t,s){return{eventTime:t,lane:s,tag:0,payload:null,callback:null,next:null}}function fs(t,s,a){var f=t.updateQueue;if(f===null)return null;if(f=f.shared,(Ue&2)!==0){var v=f.pending;return v===null?s.next=s:(s.next=v.next,v.next=s),f.pending=s,Or(t,a)}return v=f.interleaved,v===null?(s.next=s,Ic(f)):(s.next=v.next,v.next=s),f.interleaved=s,Or(t,a)}function pl(t,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194240)!==0)){var f=s.lanes;f&=t.pendingLanes,a|=f,s.lanes=a,_i(t,a)}}function m0(t,s){var a=t.updateQueue,f=t.alternate;if(f!==null&&(f=f.updateQueue,a===f)){var v=null,x=null;if(a=a.firstBaseUpdate,a!==null){do{var R={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};x===null?v=x=R:x=x.next=R,a=a.next}while(a!==null);x===null?v=x=s:x=x.next=s}else v=x=s;a={baseState:f.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:f.shared,effects:f.effects},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=s:t.next=s,a.lastBaseUpdate=s}function ml(t,s,a,f){var v=t.updateQueue;ds=!1;var x=v.firstBaseUpdate,R=v.lastBaseUpdate,F=v.shared.pending;if(F!==null){v.shared.pending=null;var X=F,ae=X.next;X.next=null,R===null?x=ae:R.next=ae,R=X;var pe=t.alternate;pe!==null&&(pe=pe.updateQueue,F=pe.lastBaseUpdate,F!==R&&(F===null?pe.firstBaseUpdate=ae:F.next=ae,pe.lastBaseUpdate=X))}if(x!==null){var me=v.baseState;R=0,pe=ae=X=null,F=x;do{var he=F.lane,be=F.eventTime;if((f&he)===he){pe!==null&&(pe=pe.next={eventTime:be,lane:0,tag:F.tag,payload:F.payload,callback:F.callback,next:null});e:{var Ne=t,Te=F;switch(he=s,be=a,Te.tag){case 1:if(Ne=Te.payload,typeof Ne=="function"){me=Ne.call(be,me,he);break e}me=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Te.payload,he=typeof Ne=="function"?Ne.call(be,me,he):Ne,he==null)break e;me=J({},me,he);break e;case 2:ds=!0}}F.callback!==null&&F.lane!==0&&(t.flags|=64,he=v.effects,he===null?v.effects=[F]:he.push(F))}else be={eventTime:be,lane:he,tag:F.tag,payload:F.payload,callback:F.callback,next:null},pe===null?(ae=pe=be,X=me):pe=pe.next=be,R|=he;if(F=F.next,F===null){if(F=v.shared.pending,F===null)break;he=F,F=he.next,he.next=null,v.lastBaseUpdate=he,v.shared.pending=null}}while(!0);if(pe===null&&(X=me),v.baseState=X,v.firstBaseUpdate=ae,v.lastBaseUpdate=pe,s=v.shared.interleaved,s!==null){v=s;do R|=v.lane,v=v.next;while(v!==s)}else x===null&&(v.shared.lanes=0);Js|=R,t.lanes=R,t.memoizedState=me}}function g0(t,s,a){if(t=s.effects,s.effects=null,t!==null)for(s=0;s<t.length;s++){var f=t[s],v=f.callback;if(v!==null){if(f.callback=null,f=a,typeof v!="function")throw Error(r(191,v));v.call(f)}}}var Bo={},cr=ls(Bo),Uo=ls(Bo),Ho=ls(Bo);function Qs(t){if(t===Bo)throw Error(r(174));return t}function Oc(t,s){switch(tt(Ho,s),tt(Uo,t),tt(cr,Bo),t=s.nodeType,t){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:ut(null,"");break;default:t=t===8?s.parentNode:s,s=t.namespaceURI||null,t=t.tagName,s=ut(s,t)}st(cr),tt(cr,s)}function Bi(){st(cr),st(Uo),st(Ho)}function v0(t){Qs(Ho.current);var s=Qs(cr.current),a=ut(s,t.type);s!==a&&(tt(Uo,t),tt(cr,a))}function Pc(t){Uo.current===t&&(st(cr),st(Uo))}var ft=ls(0);function gl(t){for(var s=t;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Lc=[];function $c(){for(var t=0;t<Lc.length;t++)Lc[t]._workInProgressVersionPrimary=null;Lc.length=0}var vl=T.ReactCurrentDispatcher,qc=T.ReactCurrentBatchConfig,Zs=0,ht=null,Et=null,jt=null,yl=!1,Wo=!1,Vo=0,hR=0;function Wt(){throw Error(r(321))}function Dc(t,s){if(s===null)return!1;for(var a=0;a<s.length&&a<t.length;a++)if(!Vn(t[a],s[a]))return!1;return!0}function Fc(t,s,a,f,v,x){if(Zs=x,ht=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,vl.current=t===null||t.memoizedState===null?vR:yR,t=a(f,v),Wo){x=0;do{if(Wo=!1,Vo=0,25<=x)throw Error(r(301));x+=1,jt=Et=null,s.updateQueue=null,vl.current=wR,t=a(f,v)}while(Wo)}if(vl.current=_l,s=Et!==null&&Et.next!==null,Zs=0,jt=Et=ht=null,yl=!1,s)throw Error(r(300));return t}function zc(){var t=Vo!==0;return Vo=0,t}function dr(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jt===null?ht.memoizedState=jt=t:jt=jt.next=t,jt}function In(){if(Et===null){var t=ht.alternate;t=t!==null?t.memoizedState:null}else t=Et.next;var s=jt===null?ht.memoizedState:jt.next;if(s!==null)jt=s,Et=t;else{if(t===null)throw Error(r(310));Et=t,t={memoizedState:Et.memoizedState,baseState:Et.baseState,baseQueue:Et.baseQueue,queue:Et.queue,next:null},jt===null?ht.memoizedState=jt=t:jt=jt.next=t}return jt}function Go(t,s){return typeof s=="function"?s(t):s}function Bc(t){var s=In(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=t;var f=Et,v=f.baseQueue,x=a.pending;if(x!==null){if(v!==null){var R=v.next;v.next=x.next,x.next=R}f.baseQueue=v=x,a.pending=null}if(v!==null){x=v.next,f=f.baseState;var F=R=null,X=null,ae=x;do{var pe=ae.lane;if((Zs&pe)===pe)X!==null&&(X=X.next={lane:0,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),f=ae.hasEagerState?ae.eagerState:t(f,ae.action);else{var me={lane:pe,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null};X===null?(F=X=me,R=f):X=X.next=me,ht.lanes|=pe,Js|=pe}ae=ae.next}while(ae!==null&&ae!==x);X===null?R=f:X.next=F,Vn(f,s.memoizedState)||(on=!0),s.memoizedState=f,s.baseState=R,s.baseQueue=X,a.lastRenderedState=f}if(t=a.interleaved,t!==null){v=t;do x=v.lane,ht.lanes|=x,Js|=x,v=v.next;while(v!==t)}else v===null&&(a.lanes=0);return[s.memoizedState,a.dispatch]}function Uc(t){var s=In(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=t;var f=a.dispatch,v=a.pending,x=s.memoizedState;if(v!==null){a.pending=null;var R=v=v.next;do x=t(x,R.action),R=R.next;while(R!==v);Vn(x,s.memoizedState)||(on=!0),s.memoizedState=x,s.baseQueue===null&&(s.baseState=x),a.lastRenderedState=x}return[x,f]}function y0(){}function w0(t,s){var a=ht,f=In(),v=s(),x=!Vn(f.memoizedState,v);if(x&&(f.memoizedState=v,on=!0),f=f.queue,Hc(b0.bind(null,a,f,t),[t]),f.getSnapshot!==s||x||jt!==null&&jt.memoizedState.tag&1){if(a.flags|=2048,Yo(9,_0.bind(null,a,f,v,s),void 0,null),At===null)throw Error(r(349));(Zs&30)!==0||x0(a,s,v)}return v}function x0(t,s,a){t.flags|=16384,t={getSnapshot:s,value:a},s=ht.updateQueue,s===null?(s={lastEffect:null,stores:null},ht.updateQueue=s,s.stores=[t]):(a=s.stores,a===null?s.stores=[t]:a.push(t))}function _0(t,s,a,f){s.value=a,s.getSnapshot=f,S0(s)&&k0(t)}function b0(t,s,a){return a(function(){S0(s)&&k0(t)})}function S0(t){var s=t.getSnapshot;t=t.value;try{var a=s();return!Vn(t,a)}catch{return!0}}function k0(t){var s=Or(t,1);s!==null&&Qn(s,t,1,-1)}function E0(t){var s=dr();return typeof t=="function"&&(t=t()),s.memoizedState=s.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Go,lastRenderedState:t},s.queue=t,t=t.dispatch=gR.bind(null,ht,t),[s.memoizedState,t]}function Yo(t,s,a,f){return t={tag:t,create:s,destroy:a,deps:f,next:null},s=ht.updateQueue,s===null?(s={lastEffect:null,stores:null},ht.updateQueue=s,s.lastEffect=t.next=t):(a=s.lastEffect,a===null?s.lastEffect=t.next=t:(f=a.next,a.next=t,t.next=f,s.lastEffect=t)),t}function N0(){return In().memoizedState}function wl(t,s,a,f){var v=dr();ht.flags|=t,v.memoizedState=Yo(1|s,a,void 0,f===void 0?null:f)}function xl(t,s,a,f){var v=In();f=f===void 0?null:f;var x=void 0;if(Et!==null){var R=Et.memoizedState;if(x=R.destroy,f!==null&&Dc(f,R.deps)){v.memoizedState=Yo(s,a,x,f);return}}ht.flags|=t,v.memoizedState=Yo(1|s,a,x,f)}function C0(t,s){return wl(8390656,8,t,s)}function Hc(t,s){return xl(2048,8,t,s)}function T0(t,s){return xl(4,2,t,s)}function R0(t,s){return xl(4,4,t,s)}function j0(t,s){if(typeof s=="function")return t=t(),s(t),function(){s(null)};if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function A0(t,s,a){return a=a!=null?a.concat([t]):null,xl(4,4,j0.bind(null,s,t),a)}function Wc(){}function I0(t,s){var a=In();s=s===void 0?null:s;var f=a.memoizedState;return f!==null&&s!==null&&Dc(s,f[1])?f[0]:(a.memoizedState=[t,s],t)}function M0(t,s){var a=In();s=s===void 0?null:s;var f=a.memoizedState;return f!==null&&s!==null&&Dc(s,f[1])?f[0]:(t=t(),a.memoizedState=[t,s],t)}function O0(t,s,a){return(Zs&21)===0?(t.baseState&&(t.baseState=!1,on=!0),t.memoizedState=a):(Vn(a,s)||(a=xi(),ht.lanes|=a,Js|=a,t.baseState=!0),s)}function pR(t,s){var a=He;He=a!==0&&4>a?a:4,t(!0);var f=qc.transition;qc.transition={};try{t(!1),s()}finally{He=a,qc.transition=f}}function P0(){return In().memoizedState}function mR(t,s,a){var f=gs(t);if(a={lane:f,action:a,hasEagerState:!1,eagerState:null,next:null},L0(t))$0(s,a);else if(a=h0(t,s,a,f),a!==null){var v=Jt();Qn(a,t,f,v),q0(a,s,f)}}function gR(t,s,a){var f=gs(t),v={lane:f,action:a,hasEagerState:!1,eagerState:null,next:null};if(L0(t))$0(s,v);else{var x=t.alternate;if(t.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var R=s.lastRenderedState,F=x(R,a);if(v.hasEagerState=!0,v.eagerState=F,Vn(F,R)){var X=s.interleaved;X===null?(v.next=v,Ic(s)):(v.next=X.next,X.next=v),s.interleaved=v;return}}catch{}finally{}a=h0(t,s,v,f),a!==null&&(v=Jt(),Qn(a,t,f,v),q0(a,s,f))}}function L0(t){var s=t.alternate;return t===ht||s!==null&&s===ht}function $0(t,s){Wo=yl=!0;var a=t.pending;a===null?s.next=s:(s.next=a.next,a.next=s),t.pending=s}function q0(t,s,a){if((a&4194240)!==0){var f=s.lanes;f&=t.pendingLanes,a|=f,s.lanes=a,_i(t,a)}}var _l={readContext:An,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useInsertionEffect:Wt,useLayoutEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useMutableSource:Wt,useSyncExternalStore:Wt,useId:Wt,unstable_isNewReconciler:!1},vR={readContext:An,useCallback:function(t,s){return dr().memoizedState=[t,s===void 0?null:s],t},useContext:An,useEffect:C0,useImperativeHandle:function(t,s,a){return a=a!=null?a.concat([t]):null,wl(4194308,4,j0.bind(null,s,t),a)},useLayoutEffect:function(t,s){return wl(4194308,4,t,s)},useInsertionEffect:function(t,s){return wl(4,2,t,s)},useMemo:function(t,s){var a=dr();return s=s===void 0?null:s,t=t(),a.memoizedState=[t,s],t},useReducer:function(t,s,a){var f=dr();return s=a!==void 0?a(s):s,f.memoizedState=f.baseState=s,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:s},f.queue=t,t=t.dispatch=mR.bind(null,ht,t),[f.memoizedState,t]},useRef:function(t){var s=dr();return t={current:t},s.memoizedState=t},useState:E0,useDebugValue:Wc,useDeferredValue:function(t){return dr().memoizedState=t},useTransition:function(){var t=E0(!1),s=t[0];return t=pR.bind(null,t[1]),dr().memoizedState=t,[s,t]},useMutableSource:function(){},useSyncExternalStore:function(t,s,a){var f=ht,v=dr();if(at){if(a===void 0)throw Error(r(407));a=a()}else{if(a=s(),At===null)throw Error(r(349));(Zs&30)!==0||x0(f,s,a)}v.memoizedState=a;var x={value:a,getSnapshot:s};return v.queue=x,C0(b0.bind(null,f,x,t),[t]),f.flags|=2048,Yo(9,_0.bind(null,f,x,a,s),void 0,null),a},useId:function(){var t=dr(),s=At.identifierPrefix;if(at){var a=Mr,f=Ir;a=(f&~(1<<32-gt(f)-1)).toString(32)+a,s=":"+s+"R"+a,a=Vo++,0<a&&(s+="H"+a.toString(32)),s+=":"}else a=hR++,s=":"+s+"r"+a.toString(32)+":";return t.memoizedState=s},unstable_isNewReconciler:!1},yR={readContext:An,useCallback:I0,useContext:An,useEffect:Hc,useImperativeHandle:A0,useInsertionEffect:T0,useLayoutEffect:R0,useMemo:M0,useReducer:Bc,useRef:N0,useState:function(){return Bc(Go)},useDebugValue:Wc,useDeferredValue:function(t){var s=In();return O0(s,Et.memoizedState,t)},useTransition:function(){var t=Bc(Go)[0],s=In().memoizedState;return[t,s]},useMutableSource:y0,useSyncExternalStore:w0,useId:P0,unstable_isNewReconciler:!1},wR={readContext:An,useCallback:I0,useContext:An,useEffect:Hc,useImperativeHandle:A0,useInsertionEffect:T0,useLayoutEffect:R0,useMemo:M0,useReducer:Uc,useRef:N0,useState:function(){return Uc(Go)},useDebugValue:Wc,useDeferredValue:function(t){var s=In();return Et===null?s.memoizedState=t:O0(s,Et.memoizedState,t)},useTransition:function(){var t=Uc(Go)[0],s=In().memoizedState;return[t,s]},useMutableSource:y0,useSyncExternalStore:w0,useId:P0,unstable_isNewReconciler:!1};function Yn(t,s){if(t&&t.defaultProps){s=J({},s),t=t.defaultProps;for(var a in t)s[a]===void 0&&(s[a]=t[a]);return s}return s}function Vc(t,s,a,f){s=t.memoizedState,a=a(f,s),a=a==null?s:J({},s,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var bl={isMounted:function(t){return(t=t._reactInternals)?Nn(t)===t:!1},enqueueSetState:function(t,s,a){t=t._reactInternals;var f=Jt(),v=gs(t),x=Pr(f,v);x.payload=s,a!=null&&(x.callback=a),s=fs(t,x,v),s!==null&&(Qn(s,t,v,f),pl(s,t,v))},enqueueReplaceState:function(t,s,a){t=t._reactInternals;var f=Jt(),v=gs(t),x=Pr(f,v);x.tag=1,x.payload=s,a!=null&&(x.callback=a),s=fs(t,x,v),s!==null&&(Qn(s,t,v,f),pl(s,t,v))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var a=Jt(),f=gs(t),v=Pr(a,f);v.tag=2,s!=null&&(v.callback=s),s=fs(t,v,f),s!==null&&(Qn(s,t,f,a),pl(s,t,f))}};function D0(t,s,a,f,v,x,R){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(f,x,R):s.prototype&&s.prototype.isPureReactComponent?!Oo(a,f)||!Oo(v,x):!0}function F0(t,s,a){var f=!1,v=us,x=s.contextType;return typeof x=="object"&&x!==null?x=An(x):(v=sn(s)?Gs:Ht.current,f=s.contextTypes,x=(f=f!=null)?Pi(t,v):us),s=new s(a,x),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=bl,t.stateNode=s,s._reactInternals=t,f&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=v,t.__reactInternalMemoizedMaskedChildContext=x),s}function z0(t,s,a,f){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,f),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,f),s.state!==t&&bl.enqueueReplaceState(s,s.state,null)}function Gc(t,s,a,f){var v=t.stateNode;v.props=a,v.state=t.memoizedState,v.refs={},Mc(t);var x=s.contextType;typeof x=="object"&&x!==null?v.context=An(x):(x=sn(s)?Gs:Ht.current,v.context=Pi(t,x)),v.state=t.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(Vc(t,s,x,a),v.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(s=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),s!==v.state&&bl.enqueueReplaceState(v,v.state,null),ml(t,a,v,f),v.state=t.memoizedState),typeof v.componentDidMount=="function"&&(t.flags|=4194308)}function Ui(t,s){try{var a="",f=s;do a+=Q(f),f=f.return;while(f);var v=a}catch(x){v=`
37
+ `+v[R].replace(" at new "," at ");return t.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",t.displayName)),X}while(1<=R&&0<=F);break}}}finally{Y=!1,Error.prepareStackTrace=a}return(t=t?t.displayName||t.name:"")?G(t):""}function Q(t){switch(t.tag){case 5:return G(t.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return t=$(t.type,!1),t;case 11:return t=$(t.type.render,!1),t;case 1:return t=$(t.type,!0),t;default:return""}}function ne(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case A:return"Fragment";case O:return"Portal";case z:return"Profiler";case U:return"StrictMode";case B:return"Suspense";case C:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case D:return(t.displayName||"Context")+".Consumer";case P:return(t._context.displayName||"Context")+".Provider";case V:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case q:return s=t.displayName||null,s!==null?s:ne(t.type)||"Memo";case L:s=t._payload,t=t._init;try{return ne(t(s))}catch{}}return null}function oe(t){var s=t.type;switch(t.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=s.render,t=t.displayName||t.name||"",s.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ne(s);case 8:return s===U?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function fe(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function te(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ce(t){var s=te(t)?"checked":"value",a=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),f=""+t[s];if(!t.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var v=a.get,x=a.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return v.call(this)},set:function(R){f=""+R,x.call(this,R)}}),Object.defineProperty(t,s,{enumerable:a.enumerable}),{getValue:function(){return f},setValue:function(R){f=""+R},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function Ce(t){t._valueTracker||(t._valueTracker=ce(t))}function ve(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var a=s.getValue(),f="";return t&&(f=te(t)?t.checked?"true":"false":t.value),t=f,t!==a?(s.setValue(t),!0):!1}function je(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function ye(t,s){var a=s.checked;return Z({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??t._wrapperState.initialChecked})}function ke(t,s){var a=s.defaultValue==null?"":s.defaultValue,f=s.checked!=null?s.checked:s.defaultChecked;a=fe(s.value!=null?s.value:a),t._wrapperState={initialChecked:f,initialValue:a,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Ye(t,s){s=s.checked,s!=null&&E(t,"checked",s,!1)}function we(t,s){Ye(t,s);var a=fe(s.value),f=s.type;if(a!=null)f==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+a):t.value!==""+a&&(t.value=""+a);else if(f==="submit"||f==="reset"){t.removeAttribute("value");return}s.hasOwnProperty("value")?Be(t,s.type,a):s.hasOwnProperty("defaultValue")&&Be(t,s.type,fe(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(t.defaultChecked=!!s.defaultChecked)}function _e(t,s,a){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var f=s.type;if(!(f!=="submit"&&f!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+t._wrapperState.initialValue,a||s===t.value||(t.value=s),t.defaultValue=s}a=t.name,a!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,a!==""&&(t.name=a)}function Be(t,s,a){(s!=="number"||je(t.ownerDocument)!==t)&&(a==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+a&&(t.defaultValue=""+a))}var it=Array.isArray;function pt(t,s,a,f){if(t=t.options,s){s={};for(var v=0;v<a.length;v++)s["$"+a[v]]=!0;for(a=0;a<t.length;a++)v=s.hasOwnProperty("$"+t[a].value),t[a].selected!==v&&(t[a].selected=v),v&&f&&(t[a].defaultSelected=!0)}else{for(a=""+fe(a),s=null,v=0;v<t.length;v++){if(t[v].value===a){t[v].selected=!0,f&&(t[v].defaultSelected=!0);return}s!==null||t[v].disabled||(s=t[v])}s!==null&&(s.selected=!0)}}function Ze(t,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return Z({},s,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Fe(t,s){var a=s.value;if(a==null){if(a=s.children,s=s.defaultValue,a!=null){if(s!=null)throw Error(r(92));if(it(a)){if(1<a.length)throw Error(r(93));a=a[0]}s=a}s==null&&(s=""),a=s}t._wrapperState={initialValue:fe(a)}}function Je(t,s){var a=fe(s.value),f=fe(s.defaultValue);a!=null&&(a=""+a,a!==t.value&&(t.value=a),s.defaultValue==null&&t.defaultValue!==a&&(t.defaultValue=a)),f!=null&&(t.defaultValue=""+f)}function Xe(t){var s=t.textContent;s===t._wrapperState.initialValue&&s!==""&&s!==null&&(t.value=s)}function Mt(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ut(t,s){return t==null||t==="http://www.w3.org/1999/xhtml"?Mt(s):t==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Qe,Ot=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,a,f,v){MSApp.execUnsafeLocalFunction(function(){return t(s,a,f,v)})}:t})(function(t,s){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=s;else{for(Qe=Qe||document.createElement("div"),Qe.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Qe.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;s.firstChild;)t.appendChild(s.firstChild)}});function Ft(t,s){if(s){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=s;return}}t.textContent=s}var et={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},St=["Webkit","ms","Moz","O"];Object.keys(et).forEach(function(t){St.forEach(function(s){s=s+t.charAt(0).toUpperCase()+t.substring(1),et[s]=et[t]})});function mt(t,s,a){return s==null||typeof s=="boolean"||s===""?"":a||typeof s!="number"||s===0||et.hasOwnProperty(t)&&et[t]?(""+s).trim():s+"px"}function wt(t,s){t=t.style;for(var a in s)if(s.hasOwnProperty(a)){var f=a.indexOf("--")===0,v=mt(a,s[a],f);a==="float"&&(a="cssFloat"),f?t.setProperty(a,v):t[a]=v}}var hn=Z({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 Yt(t,s){if(s){if(hn[t]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,t));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function Pt(t,s){if(t.indexOf("-")===-1)return typeof s.is=="string";switch(t){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 Sn=null;function gr(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var kn=null,zt=null,Fn=null;function pn(t){if(t=Fo(t)){if(typeof kn!="function")throw Error(r(280));var s=t.stateNode;s&&(s=sl(s),kn(t.stateNode,t.type,s))}}function vr(t){zt?Fn?Fn.push(t):Fn=[t]:zt=t}function Wr(){if(zt){var t=zt,s=Fn;if(Fn=zt=null,pn(t),s)for(t=0;t<s.length;t++)pn(s[t])}}function gi(t,s){return t(s)}function Vr(){}var ct=!1;function vi(t,s,a){if(ct)return t(s,a);ct=!0;try{return gi(t,s,a)}finally{ct=!1,(zt!==null||Fn!==null)&&(Vr(),Wr())}}function mn(t,s){var a=t.stateNode;if(a===null)return null;var f=sl(a);if(f===null)return null;a=f[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(t=t.type,f=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!f;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(r(231,s,typeof a));return a}var Ts=!1;if(c)try{var yr={};Object.defineProperty(yr,"passive",{get:function(){Ts=!0}}),window.addEventListener("test",yr,yr),window.removeEventListener("test",yr,yr)}catch{Ts=!1}function zn(t,s,a,f,v,x,R,F,X){var ae=Array.prototype.slice.call(arguments,3);try{s.apply(a,ae)}catch(pe){this.onError(pe)}}var En=!1,Gr=null,Yr=!1,Kr=null,yi={onError:function(t){En=!0,Gr=t}};function ir(t,s,a,f,v,x,R,F,X){En=!1,Gr=null,zn.apply(yi,arguments)}function Rs(t,s,a,f,v,x,R,F,X){if(ir.apply(this,arguments),En){if(En){var ae=Gr;En=!1,Gr=null}else throw Error(r(198));Yr||(Yr=!0,Kr=ae)}}function Nn(t){var s=t,a=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(a=s.return),t=s.return;while(t)}return s.tag===3?a:null}function wr(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function js(t){if(Nn(t)!==t)throw Error(r(188))}function As(t){var s=t.alternate;if(!s){if(s=Nn(t),s===null)throw Error(r(188));return s!==t?null:t}for(var a=t,f=s;;){var v=a.return;if(v===null)break;var x=v.alternate;if(x===null){if(f=v.return,f!==null){a=f;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===a)return js(v),t;if(x===f)return js(v),s;x=x.sibling}throw Error(r(188))}if(a.return!==f.return)a=v,f=x;else{for(var R=!1,F=v.child;F;){if(F===a){R=!0,a=v,f=x;break}if(F===f){R=!0,f=v,a=x;break}F=F.sibling}if(!R){for(F=x.child;F;){if(F===a){R=!0,a=x,f=v;break}if(F===f){R=!0,f=x,a=v;break}F=F.sibling}if(!R)throw Error(r(189))}}if(a.alternate!==f)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?t:s}function Rt(t){return t=As(t),t!==null?xr(t):null}function xr(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var s=xr(t);if(s!==null)return s;t=t.sibling}return null}var _r=n.unstable_scheduleCallback,Kt=n.unstable_cancelCallback,Xr=n.unstable_shouldYield,wi=n.unstable_requestPaint,nt=n.unstable_now,br=n.unstable_getCurrentPriorityLevel,Qr=n.unstable_ImmediatePriority,Is=n.unstable_UserBlockingPriority,Zr=n.unstable_NormalPriority,Jr=n.unstable_LowPriority,Ms=n.unstable_IdlePriority,or=null,kt=null;function Os(t){if(kt&&typeof kt.onCommitFiberRoot=="function")try{kt.onCommitFiberRoot(or,t,void 0,(t.current.flags&128)===128)}catch{}}var gt=Math.clz32?Math.clz32:La,_o=Math.log,bo=Math.LN2;function La(t){return t>>>=0,t===0?32:31-(_o(t)/bo|0)|0}var Sr=64,es=4194304;function gn(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ps(t,s){var a=t.pendingLanes;if(a===0)return 0;var f=0,v=t.suspendedLanes,x=t.pingedLanes,R=a&268435455;if(R!==0){var F=R&~v;F!==0?f=gn(F):(x&=R,x!==0&&(f=gn(x)))}else R=a&~v,R!==0?f=gn(R):x!==0&&(f=gn(x));if(f===0)return 0;if(s!==0&&s!==f&&(s&v)===0&&(v=f&-f,x=s&-s,v>=x||v===16&&(x&4194240)!==0))return s;if((f&4)!==0&&(f|=a&16),s=t.entangledLanes,s!==0)for(t=t.entanglements,s&=f;0<s;)a=31-gt(s),v=1<<a,f|=t[a],s&=~v;return f}function $a(t,s){switch(t){case 1:case 2:case 4:return s+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 s+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 qa(t,s){for(var a=t.suspendedLanes,f=t.pingedLanes,v=t.expirationTimes,x=t.pendingLanes;0<x;){var R=31-gt(x),F=1<<R,X=v[R];X===-1?((F&a)===0||(F&f)!==0)&&(v[R]=$a(F,s)):X<=s&&(t.expiredLanes|=F),x&=~F}}function So(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function xi(){var t=Sr;return Sr<<=1,(Sr&4194240)===0&&(Sr=64),t}function ar(t){for(var s=[],a=0;31>a;a++)s.push(t);return s}function ts(t,s,a){t.pendingLanes|=s,s!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,s=31-gt(s),t[s]=a}function ec(t,s){var a=t.pendingLanes&~s;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=s,t.mutableReadLanes&=s,t.entangledLanes&=s,s=t.entanglements;var f=t.eventTimes;for(t=t.expirationTimes;0<a;){var v=31-gt(a),x=1<<v;s[v]=0,f[v]=-1,t[v]=-1,a&=~x}}function _i(t,s){var a=t.entangledLanes|=s;for(t=t.entanglements;a;){var f=31-gt(a),v=1<<f;v&s|t[f]&s&&(t[f]|=s),a&=~v}}var He=0;function Da(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var Xt,ko,bi,kr,ns,Ls=!1,Cn=[],Bn=null,vn=null,Un=null,$s=new Map,rs=new Map,lr=[],tc="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 Si(t,s){switch(t){case"focusin":case"focusout":Bn=null;break;case"dragenter":case"dragleave":vn=null;break;case"mouseover":case"mouseout":Un=null;break;case"pointerover":case"pointerout":$s.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":rs.delete(s.pointerId)}}function tn(t,s,a,f,v,x){return t===null||t.nativeEvent!==x?(t={blockedOn:s,domEventName:a,eventSystemFlags:f,nativeEvent:x,targetContainers:[v]},s!==null&&(s=Fo(s),s!==null&&ko(s)),t):(t.eventSystemFlags|=f,s=t.targetContainers,v!==null&&s.indexOf(v)===-1&&s.push(v),t)}function Eo(t,s,a,f,v){switch(s){case"focusin":return Bn=tn(Bn,t,s,a,f,v),!0;case"dragenter":return vn=tn(vn,t,s,a,f,v),!0;case"mouseover":return Un=tn(Un,t,s,a,f,v),!0;case"pointerover":var x=v.pointerId;return $s.set(x,tn($s.get(x)||null,t,s,a,f,v)),!0;case"gotpointercapture":return x=v.pointerId,rs.set(x,tn(rs.get(x)||null,t,s,a,f,v)),!0}return!1}function No(t){var s=Vs(t.target);if(s!==null){var a=Nn(s);if(a!==null){if(s=a.tag,s===13){if(s=wr(a),s!==null){t.blockedOn=s,ns(t.priority,function(){bi(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ki(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var a=Nr(t.domEventName,t.eventSystemFlags,s[0],t.nativeEvent);if(a===null){a=t.nativeEvent;var f=new a.constructor(a.type,a);Sn=f,a.target.dispatchEvent(f),Sn=null}else return s=Fo(a),s!==null&&ko(s),t.blockedOn=a,!1;s.shift()}return!0}function Fa(t,s,a){ki(t)&&a.delete(s)}function za(){Ls=!1,Bn!==null&&ki(Bn)&&(Bn=null),vn!==null&&ki(vn)&&(vn=null),Un!==null&&ki(Un)&&(Un=null),$s.forEach(Fa),rs.forEach(Fa)}function ss(t,s){t.blockedOn===s&&(t.blockedOn=null,Ls||(Ls=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,za)))}function nn(t){function s(v){return ss(v,t)}if(0<Cn.length){ss(Cn[0],t);for(var a=1;a<Cn.length;a++){var f=Cn[a];f.blockedOn===t&&(f.blockedOn=null)}}for(Bn!==null&&ss(Bn,t),vn!==null&&ss(vn,t),Un!==null&&ss(Un,t),$s.forEach(s),rs.forEach(s),a=0;a<lr.length;a++)f=lr[a],f.blockedOn===t&&(f.blockedOn=null);for(;0<lr.length&&(a=lr[0],a.blockedOn===null);)No(a),a.blockedOn===null&&lr.shift()}var is=T.ReactCurrentBatchConfig,qs=!0;function nc(t,s,a,f){var v=He,x=is.transition;is.transition=null;try{He=1,Hn(t,s,a,f)}finally{He=v,is.transition=x}}function Ds(t,s,a,f){var v=He,x=is.transition;is.transition=null;try{He=4,Hn(t,s,a,f)}finally{He=v,is.transition=x}}function Hn(t,s,a,f){if(qs){var v=Nr(t,s,a,f);if(v===null)pc(t,s,f,Er,a),Si(t,f);else if(Eo(v,t,s,a,f))f.stopPropagation();else if(Si(t,f),s&4&&-1<tc.indexOf(t)){for(;v!==null;){var x=Fo(v);if(x!==null&&Xt(x),x=Nr(t,s,a,f),x===null&&pc(t,s,f,Er,a),x===v)break;v=x}v!==null&&f.stopPropagation()}else pc(t,s,f,null,a)}}var Er=null;function Nr(t,s,a,f){if(Er=null,t=gr(f),t=Vs(t),t!==null)if(s=Nn(t),s===null)t=null;else if(a=s.tag,a===13){if(t=wr(s),t!==null)return t;t=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null);return Er=t,null}function Ba(t){switch(t){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(br()){case Qr:return 1;case Is:return 4;case Zr:case Jr:return 16;case Ms:return 536870912;default:return 16}default:return 16}}var dt=null,Fs=null,zs=null;function Co(){if(zs)return zs;var t,s=Fs,a=s.length,f,v="value"in dt?dt.value:dt.textContent,x=v.length;for(t=0;t<a&&s[t]===v[t];t++);var R=a-t;for(f=1;f<=R&&s[a-f]===v[x-f];f++);return zs=v.slice(t,1<f?1-f:void 0)}function Bs(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function Cr(){return!0}function Ei(){return!1}function Bt(t){function s(a,f,v,x,R){this._reactName=a,this._targetInst=v,this.type=f,this.nativeEvent=x,this.target=R,this.currentTarget=null;for(var F in t)t.hasOwnProperty(F)&&(a=t[F],this[F]=a?a(x):x[F]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Cr:Ei,this.isPropagationStopped=Ei,this}return Z(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Cr)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Cr)},persist:function(){},isPersistent:Cr}),s}var Wn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ni=Bt(Wn),Tr=Z({},Wn,{view:0,detail:0}),Ua=Bt(Tr),Rr,To,Qt,Us=Z({},Tr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Oe,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Qt&&(Qt&&t.type==="mousemove"?(Rr=t.screenX-Qt.screenX,To=t.screenY-Qt.screenY):To=Rr=0,Qt=t),Rr)},movementY:function(t){return"movementY"in t?t.movementY:To}}),Ro=Bt(Us),rc=Z({},Us,{dataTransfer:0}),sc=Bt(rc),Ha=Z({},Tr,{relatedTarget:0}),Ut=Bt(Ha),Wa=Z({},Wn,{animationName:0,elapsedTime:0,pseudoElement:0}),Va=Bt(Wa),Ga=Z({},Wn,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Ya=Bt(Ga),W=Z({},Wn,{data:0}),K=Bt(W),le={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},de={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"},xe={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ee(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=xe[t])?!!s[t]:!1}function Oe(){return Ee}var ze=Z({},Tr,{key:function(t){if(t.key){var s=le[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=Bs(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?de[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Oe,charCode:function(t){return t.type==="keypress"?Bs(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Bs(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Ge=Bt(ze),Ve=Z({},Us,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qe=Bt(Ve),Tn=Z({},Tr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Oe}),Hs=Bt(Tn),jo=Z({},Wn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ws=Bt(jo),Ao=Z({},Us,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Ka=Bt(Ao),Ci=[9,13,27,32],yn=c&&"CompositionEvent"in window,ot=null;c&&"documentMode"in document&&(ot=document.documentMode);var Xa=c&&"TextEvent"in window&&!ot,Ey=c&&(!yn||ot&&8<ot&&11>=ot),Ny=" ",Cy=!1;function Ty(t,s){switch(t){case"keyup":return Ci.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ry(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ti=!1;function HT(t,s){switch(t){case"compositionend":return Ry(s);case"keypress":return s.which!==32?null:(Cy=!0,Ny);case"textInput":return t=s.data,t===Ny&&Cy?null:t;default:return null}}function WT(t,s){if(Ti)return t==="compositionend"||!yn&&Ty(t,s)?(t=Co(),zs=Fs=dt=null,Ti=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Ey&&s.locale!=="ko"?null:s.data;default:return null}}var VT={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 jy(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!VT[t.type]:s==="textarea"}function Ay(t,s,a,f){vr(f),s=tl(s,"onChange"),0<s.length&&(a=new Ni("onChange","change",null,a,f),t.push({event:a,listeners:s}))}var Io=null,Mo=null;function GT(t){Ky(t,0)}function Qa(t){var s=Mi(t);if(ve(s))return t}function YT(t,s){if(t==="change")return s}var Iy=!1;if(c){var ic;if(c){var oc="oninput"in document;if(!oc){var My=document.createElement("div");My.setAttribute("oninput","return;"),oc=typeof My.oninput=="function"}ic=oc}else ic=!1;Iy=ic&&(!document.documentMode||9<document.documentMode)}function Oy(){Io&&(Io.detachEvent("onpropertychange",Py),Mo=Io=null)}function Py(t){if(t.propertyName==="value"&&Qa(Mo)){var s=[];Ay(s,Mo,t,gr(t)),vi(GT,s)}}function KT(t,s,a){t==="focusin"?(Oy(),Io=s,Mo=a,Io.attachEvent("onpropertychange",Py)):t==="focusout"&&Oy()}function XT(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Qa(Mo)}function QT(t,s){if(t==="click")return Qa(s)}function ZT(t,s){if(t==="input"||t==="change")return Qa(s)}function JT(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var Vn=typeof Object.is=="function"?Object.is:JT;function Oo(t,s){if(Vn(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var a=Object.keys(t),f=Object.keys(s);if(a.length!==f.length)return!1;for(f=0;f<a.length;f++){var v=a[f];if(!h.call(s,v)||!Vn(t[v],s[v]))return!1}return!0}function Ly(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function $y(t,s){var a=Ly(t);t=0;for(var f;a;){if(a.nodeType===3){if(f=t+a.textContent.length,t<=s&&f>=s)return{node:a,offset:s-t};t=f}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Ly(a)}}function qy(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?qy(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function Dy(){for(var t=window,s=je();s instanceof t.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)t=s.contentWindow;else break;s=je(t.document)}return s}function ac(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}function eR(t){var s=Dy(),a=t.focusedElem,f=t.selectionRange;if(s!==a&&a&&a.ownerDocument&&qy(a.ownerDocument.documentElement,a)){if(f!==null&&ac(a)){if(s=f.start,t=f.end,t===void 0&&(t=s),"selectionStart"in a)a.selectionStart=s,a.selectionEnd=Math.min(t,a.value.length);else if(t=(s=a.ownerDocument||document)&&s.defaultView||window,t.getSelection){t=t.getSelection();var v=a.textContent.length,x=Math.min(f.start,v);f=f.end===void 0?x:Math.min(f.end,v),!t.extend&&x>f&&(v=f,f=x,x=v),v=$y(a,x);var R=$y(a,f);v&&R&&(t.rangeCount!==1||t.anchorNode!==v.node||t.anchorOffset!==v.offset||t.focusNode!==R.node||t.focusOffset!==R.offset)&&(s=s.createRange(),s.setStart(v.node,v.offset),t.removeAllRanges(),x>f?(t.addRange(s),t.extend(R.node,R.offset)):(s.setEnd(R.node,R.offset),t.addRange(s)))}}for(s=[],t=a;t=t.parentNode;)t.nodeType===1&&s.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<s.length;a++)t=s[a],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var tR=c&&"documentMode"in document&&11>=document.documentMode,Ri=null,lc=null,Po=null,uc=!1;function Fy(t,s,a){var f=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;uc||Ri==null||Ri!==je(f)||(f=Ri,"selectionStart"in f&&ac(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Po&&Oo(Po,f)||(Po=f,f=tl(lc,"onSelect"),0<f.length&&(s=new Ni("onSelect","select",null,s,a),t.push({event:s,listeners:f}),s.target=Ri)))}function Za(t,s){var a={};return a[t.toLowerCase()]=s.toLowerCase(),a["Webkit"+t]="webkit"+s,a["Moz"+t]="moz"+s,a}var ji={animationend:Za("Animation","AnimationEnd"),animationiteration:Za("Animation","AnimationIteration"),animationstart:Za("Animation","AnimationStart"),transitionend:Za("Transition","TransitionEnd")},cc={},zy={};c&&(zy=document.createElement("div").style,"AnimationEvent"in window||(delete ji.animationend.animation,delete ji.animationiteration.animation,delete ji.animationstart.animation),"TransitionEvent"in window||delete ji.transitionend.transition);function Ja(t){if(cc[t])return cc[t];if(!ji[t])return t;var s=ji[t],a;for(a in s)if(s.hasOwnProperty(a)&&a in zy)return cc[t]=s[a];return t}var By=Ja("animationend"),Uy=Ja("animationiteration"),Hy=Ja("animationstart"),Wy=Ja("transitionend"),Vy=new Map,Gy="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 os(t,s){Vy.set(t,s),l(s,[t])}for(var dc=0;dc<Gy.length;dc++){var fc=Gy[dc],nR=fc.toLowerCase(),rR=fc[0].toUpperCase()+fc.slice(1);os(nR,"on"+rR)}os(By,"onAnimationEnd"),os(Uy,"onAnimationIteration"),os(Hy,"onAnimationStart"),os("dblclick","onDoubleClick"),os("focusin","onFocus"),os("focusout","onBlur"),os(Wy,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Lo="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(" "),sR=new Set("cancel close invalid load scroll toggle".split(" ").concat(Lo));function Yy(t,s,a){var f=t.type||"unknown-event";t.currentTarget=a,Rs(f,s,void 0,t),t.currentTarget=null}function Ky(t,s){s=(s&4)!==0;for(var a=0;a<t.length;a++){var f=t[a],v=f.event;f=f.listeners;e:{var x=void 0;if(s)for(var R=f.length-1;0<=R;R--){var F=f[R],X=F.instance,ae=F.currentTarget;if(F=F.listener,X!==x&&v.isPropagationStopped())break e;Yy(v,F,ae),x=X}else for(R=0;R<f.length;R++){if(F=f[R],X=F.instance,ae=F.currentTarget,F=F.listener,X!==x&&v.isPropagationStopped())break e;Yy(v,F,ae),x=X}}}if(Yr)throw t=Kr,Yr=!1,Kr=null,t}function rt(t,s){var a=s[xc];a===void 0&&(a=s[xc]=new Set);var f=t+"__bubble";a.has(f)||(Xy(s,t,2,!1),a.add(f))}function hc(t,s,a){var f=0;s&&(f|=4),Xy(a,t,f,s)}var el="_reactListening"+Math.random().toString(36).slice(2);function $o(t){if(!t[el]){t[el]=!0,i.forEach(function(a){a!=="selectionchange"&&(sR.has(a)||hc(a,!1,t),hc(a,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[el]||(s[el]=!0,hc("selectionchange",!1,s))}}function Xy(t,s,a,f){switch(Ba(s)){case 1:var v=nc;break;case 4:v=Ds;break;default:v=Hn}a=v.bind(null,s,a,t),v=void 0,!Ts||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(v=!0),f?v!==void 0?t.addEventListener(s,a,{capture:!0,passive:v}):t.addEventListener(s,a,!0):v!==void 0?t.addEventListener(s,a,{passive:v}):t.addEventListener(s,a,!1)}function pc(t,s,a,f,v){var x=f;if((s&1)===0&&(s&2)===0&&f!==null)e:for(;;){if(f===null)return;var R=f.tag;if(R===3||R===4){var F=f.stateNode.containerInfo;if(F===v||F.nodeType===8&&F.parentNode===v)break;if(R===4)for(R=f.return;R!==null;){var X=R.tag;if((X===3||X===4)&&(X=R.stateNode.containerInfo,X===v||X.nodeType===8&&X.parentNode===v))return;R=R.return}for(;F!==null;){if(R=Vs(F),R===null)return;if(X=R.tag,X===5||X===6){f=x=R;continue e}F=F.parentNode}}f=f.return}vi(function(){var ae=x,pe=gr(a),me=[];e:{var he=Vy.get(t);if(he!==void 0){var be=Ni,Ne=t;switch(t){case"keypress":if(Bs(a)===0)break e;case"keydown":case"keyup":be=Ge;break;case"focusin":Ne="focus",be=Ut;break;case"focusout":Ne="blur",be=Ut;break;case"beforeblur":case"afterblur":be=Ut;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":be=Ro;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":be=sc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":be=Hs;break;case By:case Uy:case Hy:be=Va;break;case Wy:be=Ws;break;case"scroll":be=Ua;break;case"wheel":be=Ka;break;case"copy":case"cut":case"paste":be=Ya;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":be=qe}var Te=(s&4)!==0,xt=!Te&&t==="scroll",se=Te?he!==null?he+"Capture":null:he;Te=[];for(var ee=ae,ie;ee!==null;){ie=ee;var ge=ie.stateNode;if(ie.tag===5&&ge!==null&&(ie=ge,se!==null&&(ge=mn(ee,se),ge!=null&&Te.push(qo(ee,ge,ie)))),xt)break;ee=ee.return}0<Te.length&&(he=new be(he,Ne,null,a,pe),me.push({event:he,listeners:Te}))}}if((s&7)===0){e:{if(he=t==="mouseover"||t==="pointerover",be=t==="mouseout"||t==="pointerout",he&&a!==Sn&&(Ne=a.relatedTarget||a.fromElement)&&(Vs(Ne)||Ne[jr]))break e;if((be||he)&&(he=pe.window===pe?pe:(he=pe.ownerDocument)?he.defaultView||he.parentWindow:window,be?(Ne=a.relatedTarget||a.toElement,be=ae,Ne=Ne?Vs(Ne):null,Ne!==null&&(xt=Nn(Ne),Ne!==xt||Ne.tag!==5&&Ne.tag!==6)&&(Ne=null)):(be=null,Ne=ae),be!==Ne)){if(Te=Ro,ge="onMouseLeave",se="onMouseEnter",ee="mouse",(t==="pointerout"||t==="pointerover")&&(Te=qe,ge="onPointerLeave",se="onPointerEnter",ee="pointer"),xt=be==null?he:Mi(be),ie=Ne==null?he:Mi(Ne),he=new Te(ge,ee+"leave",be,a,pe),he.target=xt,he.relatedTarget=ie,ge=null,Vs(pe)===ae&&(Te=new Te(se,ee+"enter",Ne,a,pe),Te.target=ie,Te.relatedTarget=xt,ge=Te),xt=ge,be&&Ne)t:{for(Te=be,se=Ne,ee=0,ie=Te;ie;ie=Ai(ie))ee++;for(ie=0,ge=se;ge;ge=Ai(ge))ie++;for(;0<ee-ie;)Te=Ai(Te),ee--;for(;0<ie-ee;)se=Ai(se),ie--;for(;ee--;){if(Te===se||se!==null&&Te===se.alternate)break t;Te=Ai(Te),se=Ai(se)}Te=null}else Te=null;be!==null&&Qy(me,he,be,Te,!1),Ne!==null&&xt!==null&&Qy(me,xt,Ne,Te,!0)}}e:{if(he=ae?Mi(ae):window,be=he.nodeName&&he.nodeName.toLowerCase(),be==="select"||be==="input"&&he.type==="file")var Re=YT;else if(jy(he))if(Iy)Re=ZT;else{Re=XT;var Ie=KT}else(be=he.nodeName)&&be.toLowerCase()==="input"&&(he.type==="checkbox"||he.type==="radio")&&(Re=QT);if(Re&&(Re=Re(t,ae))){Ay(me,Re,a,pe);break e}Ie&&Ie(t,he,ae),t==="focusout"&&(Ie=he._wrapperState)&&Ie.controlled&&he.type==="number"&&Be(he,"number",he.value)}switch(Ie=ae?Mi(ae):window,t){case"focusin":(jy(Ie)||Ie.contentEditable==="true")&&(Ri=Ie,lc=ae,Po=null);break;case"focusout":Po=lc=Ri=null;break;case"mousedown":uc=!0;break;case"contextmenu":case"mouseup":case"dragend":uc=!1,Fy(me,a,pe);break;case"selectionchange":if(tR)break;case"keydown":case"keyup":Fy(me,a,pe)}var Me;if(yn)e:{switch(t){case"compositionstart":var Pe="onCompositionStart";break e;case"compositionend":Pe="onCompositionEnd";break e;case"compositionupdate":Pe="onCompositionUpdate";break e}Pe=void 0}else Ti?Ty(t,a)&&(Pe="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(Pe="onCompositionStart");Pe&&(Ey&&a.locale!=="ko"&&(Ti||Pe!=="onCompositionStart"?Pe==="onCompositionEnd"&&Ti&&(Me=Co()):(dt=pe,Fs="value"in dt?dt.value:dt.textContent,Ti=!0)),Ie=tl(ae,Pe),0<Ie.length&&(Pe=new K(Pe,t,null,a,pe),me.push({event:Pe,listeners:Ie}),Me?Pe.data=Me:(Me=Ry(a),Me!==null&&(Pe.data=Me)))),(Me=Xa?HT(t,a):WT(t,a))&&(ae=tl(ae,"onBeforeInput"),0<ae.length&&(pe=new K("onBeforeInput","beforeinput",null,a,pe),me.push({event:pe,listeners:ae}),pe.data=Me))}Ky(me,s)})}function qo(t,s,a){return{instance:t,listener:s,currentTarget:a}}function tl(t,s){for(var a=s+"Capture",f=[];t!==null;){var v=t,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=mn(t,a),x!=null&&f.unshift(qo(t,x,v)),x=mn(t,s),x!=null&&f.push(qo(t,x,v))),t=t.return}return f}function Ai(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Qy(t,s,a,f,v){for(var x=s._reactName,R=[];a!==null&&a!==f;){var F=a,X=F.alternate,ae=F.stateNode;if(X!==null&&X===f)break;F.tag===5&&ae!==null&&(F=ae,v?(X=mn(a,x),X!=null&&R.unshift(qo(a,X,F))):v||(X=mn(a,x),X!=null&&R.push(qo(a,X,F)))),a=a.return}R.length!==0&&t.push({event:s,listeners:R})}var iR=/\r\n?/g,oR=/\u0000|\uFFFD/g;function Zy(t){return(typeof t=="string"?t:""+t).replace(iR,`
38
+ `).replace(oR,"")}function nl(t,s,a){if(s=Zy(s),Zy(t)!==s&&a)throw Error(r(425))}function rl(){}var mc=null,gc=null;function vc(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var yc=typeof setTimeout=="function"?setTimeout:void 0,aR=typeof clearTimeout=="function"?clearTimeout:void 0,Jy=typeof Promise=="function"?Promise:void 0,lR=typeof queueMicrotask=="function"?queueMicrotask:typeof Jy<"u"?function(t){return Jy.resolve(null).then(t).catch(uR)}:yc;function uR(t){setTimeout(function(){throw t})}function wc(t,s){var a=s,f=0;do{var v=a.nextSibling;if(t.removeChild(a),v&&v.nodeType===8)if(a=v.data,a==="/$"){if(f===0){t.removeChild(v),nn(s);return}f--}else a!=="$"&&a!=="$?"&&a!=="$!"||f++;a=v}while(a);nn(s)}function as(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return t}function e0(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"){if(s===0)return t;s--}else a==="/$"&&s++}t=t.previousSibling}return null}var Ii=Math.random().toString(36).slice(2),ur="__reactFiber$"+Ii,Do="__reactProps$"+Ii,jr="__reactContainer$"+Ii,xc="__reactEvents$"+Ii,cR="__reactListeners$"+Ii,dR="__reactHandles$"+Ii;function Vs(t){var s=t[ur];if(s)return s;for(var a=t.parentNode;a;){if(s=a[jr]||a[ur]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(t=e0(t);t!==null;){if(a=t[ur])return a;t=e0(t)}return s}t=a,a=t.parentNode}return null}function Fo(t){return t=t[ur]||t[jr],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Mi(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(r(33))}function sl(t){return t[Do]||null}var _c=[],Oi=-1;function ls(t){return{current:t}}function st(t){0>Oi||(t.current=_c[Oi],_c[Oi]=null,Oi--)}function tt(t,s){Oi++,_c[Oi]=t.current,t.current=s}var us={},Ht=ls(us),rn=ls(!1),Gs=us;function Pi(t,s){var a=t.type.contextTypes;if(!a)return us;var f=t.stateNode;if(f&&f.__reactInternalMemoizedUnmaskedChildContext===s)return f.__reactInternalMemoizedMaskedChildContext;var v={},x;for(x in a)v[x]=s[x];return f&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=v),v}function sn(t){return t=t.childContextTypes,t!=null}function il(){st(rn),st(Ht)}function t0(t,s,a){if(Ht.current!==us)throw Error(r(168));tt(Ht,s),tt(rn,a)}function n0(t,s,a){var f=t.stateNode;if(s=s.childContextTypes,typeof f.getChildContext!="function")return a;f=f.getChildContext();for(var v in f)if(!(v in s))throw Error(r(108,oe(t)||"Unknown",v));return Z({},a,f)}function ol(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||us,Gs=Ht.current,tt(Ht,t),tt(rn,rn.current),!0}function r0(t,s,a){var f=t.stateNode;if(!f)throw Error(r(169));a?(t=n0(t,s,Gs),f.__reactInternalMemoizedMergedChildContext=t,st(rn),st(Ht),tt(Ht,t)):st(rn),tt(rn,a)}var Ar=null,al=!1,bc=!1;function s0(t){Ar===null?Ar=[t]:Ar.push(t)}function fR(t){al=!0,s0(t)}function cs(){if(!bc&&Ar!==null){bc=!0;var t=0,s=He;try{var a=Ar;for(He=1;t<a.length;t++){var f=a[t];do f=f(!0);while(f!==null)}Ar=null,al=!1}catch(v){throw Ar!==null&&(Ar=Ar.slice(t+1)),_r(Qr,cs),v}finally{He=s,bc=!1}}return null}var Li=[],$i=0,ll=null,ul=0,Rn=[],jn=0,Ys=null,Ir=1,Mr="";function Ks(t,s){Li[$i++]=ul,Li[$i++]=ll,ll=t,ul=s}function i0(t,s,a){Rn[jn++]=Ir,Rn[jn++]=Mr,Rn[jn++]=Ys,Ys=t;var f=Ir;t=Mr;var v=32-gt(f)-1;f&=~(1<<v),a+=1;var x=32-gt(s)+v;if(30<x){var R=v-v%5;x=(f&(1<<R)-1).toString(32),f>>=R,v-=R,Ir=1<<32-gt(s)+v|a<<v|f,Mr=x+t}else Ir=1<<x|a<<v|f,Mr=t}function Sc(t){t.return!==null&&(Ks(t,1),i0(t,1,0))}function kc(t){for(;t===ll;)ll=Li[--$i],Li[$i]=null,ul=Li[--$i],Li[$i]=null;for(;t===Ys;)Ys=Rn[--jn],Rn[jn]=null,Mr=Rn[--jn],Rn[jn]=null,Ir=Rn[--jn],Rn[jn]=null}var wn=null,xn=null,at=!1,Gn=null;function o0(t,s){var a=On(5,null,null,0);a.elementType="DELETED",a.stateNode=s,a.return=t,s=t.deletions,s===null?(t.deletions=[a],t.flags|=16):s.push(a)}function a0(t,s){switch(t.tag){case 5:var a=t.type;return s=s.nodeType!==1||a.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(t.stateNode=s,wn=t,xn=as(s.firstChild),!0):!1;case 6:return s=t.pendingProps===""||s.nodeType!==3?null:s,s!==null?(t.stateNode=s,wn=t,xn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(a=Ys!==null?{id:Ir,overflow:Mr}:null,t.memoizedState={dehydrated:s,treeContext:a,retryLane:1073741824},a=On(18,null,null,0),a.stateNode=s,a.return=t,t.child=a,wn=t,xn=null,!0):!1;default:return!1}}function Ec(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Nc(t){if(at){var s=xn;if(s){var a=s;if(!a0(t,s)){if(Ec(t))throw Error(r(418));s=as(a.nextSibling);var f=wn;s&&a0(t,s)?o0(f,a):(t.flags=t.flags&-4097|2,at=!1,wn=t)}}else{if(Ec(t))throw Error(r(418));t.flags=t.flags&-4097|2,at=!1,wn=t}}}function l0(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;wn=t}function cl(t){if(t!==wn)return!1;if(!at)return l0(t),at=!0,!1;var s;if((s=t.tag!==3)&&!(s=t.tag!==5)&&(s=t.type,s=s!=="head"&&s!=="body"&&!vc(t.type,t.memoizedProps)),s&&(s=xn)){if(Ec(t))throw u0(),Error(r(418));for(;s;)o0(t,s),s=as(s.nextSibling)}if(l0(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));e:{for(t=t.nextSibling,s=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"){if(s===0){xn=as(t.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++}t=t.nextSibling}xn=null}}else xn=wn?as(t.stateNode.nextSibling):null;return!0}function u0(){for(var t=xn;t;)t=as(t.nextSibling)}function qi(){xn=wn=null,at=!1}function Cc(t){Gn===null?Gn=[t]:Gn.push(t)}var hR=T.ReactCurrentBatchConfig;function zo(t,s,a){if(t=a.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(r(309));var f=a.stateNode}if(!f)throw Error(r(147,t));var v=f,x=""+t;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===x?s.ref:(s=function(R){var F=v.refs;R===null?delete F[x]:F[x]=R},s._stringRef=x,s)}if(typeof t!="string")throw Error(r(284));if(!a._owner)throw Error(r(290,t))}return t}function dl(t,s){throw t=Object.prototype.toString.call(s),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t))}function c0(t){var s=t._init;return s(t._payload)}function d0(t){function s(se,ee){if(t){var ie=se.deletions;ie===null?(se.deletions=[ee],se.flags|=16):ie.push(ee)}}function a(se,ee){if(!t)return null;for(;ee!==null;)s(se,ee),ee=ee.sibling;return null}function f(se,ee){for(se=new Map;ee!==null;)ee.key!==null?se.set(ee.key,ee):se.set(ee.index,ee),ee=ee.sibling;return se}function v(se,ee){return se=ys(se,ee),se.index=0,se.sibling=null,se}function x(se,ee,ie){return se.index=ie,t?(ie=se.alternate,ie!==null?(ie=ie.index,ie<ee?(se.flags|=2,ee):ie):(se.flags|=2,ee)):(se.flags|=1048576,ee)}function R(se){return t&&se.alternate===null&&(se.flags|=2),se}function F(se,ee,ie,ge){return ee===null||ee.tag!==6?(ee=yd(ie,se.mode,ge),ee.return=se,ee):(ee=v(ee,ie),ee.return=se,ee)}function X(se,ee,ie,ge){var Re=ie.type;return Re===A?pe(se,ee,ie.props.children,ge,ie.key):ee!==null&&(ee.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===L&&c0(Re)===ee.type)?(ge=v(ee,ie.props),ge.ref=zo(se,ee,ie),ge.return=se,ge):(ge=Pl(ie.type,ie.key,ie.props,null,se.mode,ge),ge.ref=zo(se,ee,ie),ge.return=se,ge)}function ae(se,ee,ie,ge){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ie.containerInfo||ee.stateNode.implementation!==ie.implementation?(ee=wd(ie,se.mode,ge),ee.return=se,ee):(ee=v(ee,ie.children||[]),ee.return=se,ee)}function pe(se,ee,ie,ge,Re){return ee===null||ee.tag!==7?(ee=ri(ie,se.mode,ge,Re),ee.return=se,ee):(ee=v(ee,ie),ee.return=se,ee)}function me(se,ee,ie){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=yd(""+ee,se.mode,ie),ee.return=se,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case I:return ie=Pl(ee.type,ee.key,ee.props,null,se.mode,ie),ie.ref=zo(se,null,ee),ie.return=se,ie;case O:return ee=wd(ee,se.mode,ie),ee.return=se,ee;case L:var ge=ee._init;return me(se,ge(ee._payload),ie)}if(it(ee)||H(ee))return ee=ri(ee,se.mode,ie,null),ee.return=se,ee;dl(se,ee)}return null}function he(se,ee,ie,ge){var Re=ee!==null?ee.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return Re!==null?null:F(se,ee,""+ie,ge);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:return ie.key===Re?X(se,ee,ie,ge):null;case O:return ie.key===Re?ae(se,ee,ie,ge):null;case L:return Re=ie._init,he(se,ee,Re(ie._payload),ge)}if(it(ie)||H(ie))return Re!==null?null:pe(se,ee,ie,ge,null);dl(se,ie)}return null}function be(se,ee,ie,ge,Re){if(typeof ge=="string"&&ge!==""||typeof ge=="number")return se=se.get(ie)||null,F(ee,se,""+ge,Re);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case I:return se=se.get(ge.key===null?ie:ge.key)||null,X(ee,se,ge,Re);case O:return se=se.get(ge.key===null?ie:ge.key)||null,ae(ee,se,ge,Re);case L:var Ie=ge._init;return be(se,ee,ie,Ie(ge._payload),Re)}if(it(ge)||H(ge))return se=se.get(ie)||null,pe(ee,se,ge,Re,null);dl(ee,ge)}return null}function Ne(se,ee,ie,ge){for(var Re=null,Ie=null,Me=ee,Pe=ee=0,It=null;Me!==null&&Pe<ie.length;Pe++){Me.index>Pe?(It=Me,Me=null):It=Me.sibling;var We=he(se,Me,ie[Pe],ge);if(We===null){Me===null&&(Me=It);break}t&&Me&&We.alternate===null&&s(se,Me),ee=x(We,ee,Pe),Ie===null?Re=We:Ie.sibling=We,Ie=We,Me=It}if(Pe===ie.length)return a(se,Me),at&&Ks(se,Pe),Re;if(Me===null){for(;Pe<ie.length;Pe++)Me=me(se,ie[Pe],ge),Me!==null&&(ee=x(Me,ee,Pe),Ie===null?Re=Me:Ie.sibling=Me,Ie=Me);return at&&Ks(se,Pe),Re}for(Me=f(se,Me);Pe<ie.length;Pe++)It=be(Me,se,Pe,ie[Pe],ge),It!==null&&(t&&It.alternate!==null&&Me.delete(It.key===null?Pe:It.key),ee=x(It,ee,Pe),Ie===null?Re=It:Ie.sibling=It,Ie=It);return t&&Me.forEach(function(ws){return s(se,ws)}),at&&Ks(se,Pe),Re}function Te(se,ee,ie,ge){var Re=H(ie);if(typeof Re!="function")throw Error(r(150));if(ie=Re.call(ie),ie==null)throw Error(r(151));for(var Ie=Re=null,Me=ee,Pe=ee=0,It=null,We=ie.next();Me!==null&&!We.done;Pe++,We=ie.next()){Me.index>Pe?(It=Me,Me=null):It=Me.sibling;var ws=he(se,Me,We.value,ge);if(ws===null){Me===null&&(Me=It);break}t&&Me&&ws.alternate===null&&s(se,Me),ee=x(ws,ee,Pe),Ie===null?Re=ws:Ie.sibling=ws,Ie=ws,Me=It}if(We.done)return a(se,Me),at&&Ks(se,Pe),Re;if(Me===null){for(;!We.done;Pe++,We=ie.next())We=me(se,We.value,ge),We!==null&&(ee=x(We,ee,Pe),Ie===null?Re=We:Ie.sibling=We,Ie=We);return at&&Ks(se,Pe),Re}for(Me=f(se,Me);!We.done;Pe++,We=ie.next())We=be(Me,se,Pe,We.value,ge),We!==null&&(t&&We.alternate!==null&&Me.delete(We.key===null?Pe:We.key),ee=x(We,ee,Pe),Ie===null?Re=We:Ie.sibling=We,Ie=We);return t&&Me.forEach(function(VR){return s(se,VR)}),at&&Ks(se,Pe),Re}function xt(se,ee,ie,ge){if(typeof ie=="object"&&ie!==null&&ie.type===A&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:e:{for(var Re=ie.key,Ie=ee;Ie!==null;){if(Ie.key===Re){if(Re=ie.type,Re===A){if(Ie.tag===7){a(se,Ie.sibling),ee=v(Ie,ie.props.children),ee.return=se,se=ee;break e}}else if(Ie.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===L&&c0(Re)===Ie.type){a(se,Ie.sibling),ee=v(Ie,ie.props),ee.ref=zo(se,Ie,ie),ee.return=se,se=ee;break e}a(se,Ie);break}else s(se,Ie);Ie=Ie.sibling}ie.type===A?(ee=ri(ie.props.children,se.mode,ge,ie.key),ee.return=se,se=ee):(ge=Pl(ie.type,ie.key,ie.props,null,se.mode,ge),ge.ref=zo(se,ee,ie),ge.return=se,se=ge)}return R(se);case O:e:{for(Ie=ie.key;ee!==null;){if(ee.key===Ie)if(ee.tag===4&&ee.stateNode.containerInfo===ie.containerInfo&&ee.stateNode.implementation===ie.implementation){a(se,ee.sibling),ee=v(ee,ie.children||[]),ee.return=se,se=ee;break e}else{a(se,ee);break}else s(se,ee);ee=ee.sibling}ee=wd(ie,se.mode,ge),ee.return=se,se=ee}return R(se);case L:return Ie=ie._init,xt(se,ee,Ie(ie._payload),ge)}if(it(ie))return Ne(se,ee,ie,ge);if(H(ie))return Te(se,ee,ie,ge);dl(se,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,ee!==null&&ee.tag===6?(a(se,ee.sibling),ee=v(ee,ie),ee.return=se,se=ee):(a(se,ee),ee=yd(ie,se.mode,ge),ee.return=se,se=ee),R(se)):a(se,ee)}return xt}var Di=d0(!0),f0=d0(!1),fl=ls(null),hl=null,Fi=null,Tc=null;function Rc(){Tc=Fi=hl=null}function jc(t){var s=fl.current;st(fl),t._currentValue=s}function Ac(t,s,a){for(;t!==null;){var f=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,f!==null&&(f.childLanes|=s)):f!==null&&(f.childLanes&s)!==s&&(f.childLanes|=s),t===a)break;t=t.return}}function zi(t,s){hl=t,Tc=Fi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&s)!==0&&(on=!0),t.firstContext=null)}function An(t){var s=t._currentValue;if(Tc!==t)if(t={context:t,memoizedValue:s,next:null},Fi===null){if(hl===null)throw Error(r(308));Fi=t,hl.dependencies={lanes:0,firstContext:t}}else Fi=Fi.next=t;return s}var Xs=null;function Ic(t){Xs===null?Xs=[t]:Xs.push(t)}function h0(t,s,a,f){var v=s.interleaved;return v===null?(a.next=a,Ic(s)):(a.next=v.next,v.next=a),s.interleaved=a,Or(t,f)}function Or(t,s){t.lanes|=s;var a=t.alternate;for(a!==null&&(a.lanes|=s),a=t,t=t.return;t!==null;)t.childLanes|=s,a=t.alternate,a!==null&&(a.childLanes|=s),a=t,t=t.return;return a.tag===3?a.stateNode:null}var ds=!1;function Mc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function p0(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Pr(t,s){return{eventTime:t,lane:s,tag:0,payload:null,callback:null,next:null}}function fs(t,s,a){var f=t.updateQueue;if(f===null)return null;if(f=f.shared,(Ue&2)!==0){var v=f.pending;return v===null?s.next=s:(s.next=v.next,v.next=s),f.pending=s,Or(t,a)}return v=f.interleaved,v===null?(s.next=s,Ic(f)):(s.next=v.next,v.next=s),f.interleaved=s,Or(t,a)}function pl(t,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194240)!==0)){var f=s.lanes;f&=t.pendingLanes,a|=f,s.lanes=a,_i(t,a)}}function m0(t,s){var a=t.updateQueue,f=t.alternate;if(f!==null&&(f=f.updateQueue,a===f)){var v=null,x=null;if(a=a.firstBaseUpdate,a!==null){do{var R={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};x===null?v=x=R:x=x.next=R,a=a.next}while(a!==null);x===null?v=x=s:x=x.next=s}else v=x=s;a={baseState:f.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:f.shared,effects:f.effects},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=s:t.next=s,a.lastBaseUpdate=s}function ml(t,s,a,f){var v=t.updateQueue;ds=!1;var x=v.firstBaseUpdate,R=v.lastBaseUpdate,F=v.shared.pending;if(F!==null){v.shared.pending=null;var X=F,ae=X.next;X.next=null,R===null?x=ae:R.next=ae,R=X;var pe=t.alternate;pe!==null&&(pe=pe.updateQueue,F=pe.lastBaseUpdate,F!==R&&(F===null?pe.firstBaseUpdate=ae:F.next=ae,pe.lastBaseUpdate=X))}if(x!==null){var me=v.baseState;R=0,pe=ae=X=null,F=x;do{var he=F.lane,be=F.eventTime;if((f&he)===he){pe!==null&&(pe=pe.next={eventTime:be,lane:0,tag:F.tag,payload:F.payload,callback:F.callback,next:null});e:{var Ne=t,Te=F;switch(he=s,be=a,Te.tag){case 1:if(Ne=Te.payload,typeof Ne=="function"){me=Ne.call(be,me,he);break e}me=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Te.payload,he=typeof Ne=="function"?Ne.call(be,me,he):Ne,he==null)break e;me=Z({},me,he);break e;case 2:ds=!0}}F.callback!==null&&F.lane!==0&&(t.flags|=64,he=v.effects,he===null?v.effects=[F]:he.push(F))}else be={eventTime:be,lane:he,tag:F.tag,payload:F.payload,callback:F.callback,next:null},pe===null?(ae=pe=be,X=me):pe=pe.next=be,R|=he;if(F=F.next,F===null){if(F=v.shared.pending,F===null)break;he=F,F=he.next,he.next=null,v.lastBaseUpdate=he,v.shared.pending=null}}while(!0);if(pe===null&&(X=me),v.baseState=X,v.firstBaseUpdate=ae,v.lastBaseUpdate=pe,s=v.shared.interleaved,s!==null){v=s;do R|=v.lane,v=v.next;while(v!==s)}else x===null&&(v.shared.lanes=0);Js|=R,t.lanes=R,t.memoizedState=me}}function g0(t,s,a){if(t=s.effects,s.effects=null,t!==null)for(s=0;s<t.length;s++){var f=t[s],v=f.callback;if(v!==null){if(f.callback=null,f=a,typeof v!="function")throw Error(r(191,v));v.call(f)}}}var Bo={},cr=ls(Bo),Uo=ls(Bo),Ho=ls(Bo);function Qs(t){if(t===Bo)throw Error(r(174));return t}function Oc(t,s){switch(tt(Ho,s),tt(Uo,t),tt(cr,Bo),t=s.nodeType,t){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:ut(null,"");break;default:t=t===8?s.parentNode:s,s=t.namespaceURI||null,t=t.tagName,s=ut(s,t)}st(cr),tt(cr,s)}function Bi(){st(cr),st(Uo),st(Ho)}function v0(t){Qs(Ho.current);var s=Qs(cr.current),a=ut(s,t.type);s!==a&&(tt(Uo,t),tt(cr,a))}function Pc(t){Uo.current===t&&(st(cr),st(Uo))}var ft=ls(0);function gl(t){for(var s=t;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Lc=[];function $c(){for(var t=0;t<Lc.length;t++)Lc[t]._workInProgressVersionPrimary=null;Lc.length=0}var vl=T.ReactCurrentDispatcher,qc=T.ReactCurrentBatchConfig,Zs=0,ht=null,Et=null,jt=null,yl=!1,Wo=!1,Vo=0,pR=0;function Wt(){throw Error(r(321))}function Dc(t,s){if(s===null)return!1;for(var a=0;a<s.length&&a<t.length;a++)if(!Vn(t[a],s[a]))return!1;return!0}function Fc(t,s,a,f,v,x){if(Zs=x,ht=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,vl.current=t===null||t.memoizedState===null?yR:wR,t=a(f,v),Wo){x=0;do{if(Wo=!1,Vo=0,25<=x)throw Error(r(301));x+=1,jt=Et=null,s.updateQueue=null,vl.current=xR,t=a(f,v)}while(Wo)}if(vl.current=_l,s=Et!==null&&Et.next!==null,Zs=0,jt=Et=ht=null,yl=!1,s)throw Error(r(300));return t}function zc(){var t=Vo!==0;return Vo=0,t}function dr(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jt===null?ht.memoizedState=jt=t:jt=jt.next=t,jt}function In(){if(Et===null){var t=ht.alternate;t=t!==null?t.memoizedState:null}else t=Et.next;var s=jt===null?ht.memoizedState:jt.next;if(s!==null)jt=s,Et=t;else{if(t===null)throw Error(r(310));Et=t,t={memoizedState:Et.memoizedState,baseState:Et.baseState,baseQueue:Et.baseQueue,queue:Et.queue,next:null},jt===null?ht.memoizedState=jt=t:jt=jt.next=t}return jt}function Go(t,s){return typeof s=="function"?s(t):s}function Bc(t){var s=In(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=t;var f=Et,v=f.baseQueue,x=a.pending;if(x!==null){if(v!==null){var R=v.next;v.next=x.next,x.next=R}f.baseQueue=v=x,a.pending=null}if(v!==null){x=v.next,f=f.baseState;var F=R=null,X=null,ae=x;do{var pe=ae.lane;if((Zs&pe)===pe)X!==null&&(X=X.next={lane:0,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),f=ae.hasEagerState?ae.eagerState:t(f,ae.action);else{var me={lane:pe,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null};X===null?(F=X=me,R=f):X=X.next=me,ht.lanes|=pe,Js|=pe}ae=ae.next}while(ae!==null&&ae!==x);X===null?R=f:X.next=F,Vn(f,s.memoizedState)||(on=!0),s.memoizedState=f,s.baseState=R,s.baseQueue=X,a.lastRenderedState=f}if(t=a.interleaved,t!==null){v=t;do x=v.lane,ht.lanes|=x,Js|=x,v=v.next;while(v!==t)}else v===null&&(a.lanes=0);return[s.memoizedState,a.dispatch]}function Uc(t){var s=In(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=t;var f=a.dispatch,v=a.pending,x=s.memoizedState;if(v!==null){a.pending=null;var R=v=v.next;do x=t(x,R.action),R=R.next;while(R!==v);Vn(x,s.memoizedState)||(on=!0),s.memoizedState=x,s.baseQueue===null&&(s.baseState=x),a.lastRenderedState=x}return[x,f]}function y0(){}function w0(t,s){var a=ht,f=In(),v=s(),x=!Vn(f.memoizedState,v);if(x&&(f.memoizedState=v,on=!0),f=f.queue,Hc(b0.bind(null,a,f,t),[t]),f.getSnapshot!==s||x||jt!==null&&jt.memoizedState.tag&1){if(a.flags|=2048,Yo(9,_0.bind(null,a,f,v,s),void 0,null),At===null)throw Error(r(349));(Zs&30)!==0||x0(a,s,v)}return v}function x0(t,s,a){t.flags|=16384,t={getSnapshot:s,value:a},s=ht.updateQueue,s===null?(s={lastEffect:null,stores:null},ht.updateQueue=s,s.stores=[t]):(a=s.stores,a===null?s.stores=[t]:a.push(t))}function _0(t,s,a,f){s.value=a,s.getSnapshot=f,S0(s)&&k0(t)}function b0(t,s,a){return a(function(){S0(s)&&k0(t)})}function S0(t){var s=t.getSnapshot;t=t.value;try{var a=s();return!Vn(t,a)}catch{return!0}}function k0(t){var s=Or(t,1);s!==null&&Qn(s,t,1,-1)}function E0(t){var s=dr();return typeof t=="function"&&(t=t()),s.memoizedState=s.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Go,lastRenderedState:t},s.queue=t,t=t.dispatch=vR.bind(null,ht,t),[s.memoizedState,t]}function Yo(t,s,a,f){return t={tag:t,create:s,destroy:a,deps:f,next:null},s=ht.updateQueue,s===null?(s={lastEffect:null,stores:null},ht.updateQueue=s,s.lastEffect=t.next=t):(a=s.lastEffect,a===null?s.lastEffect=t.next=t:(f=a.next,a.next=t,t.next=f,s.lastEffect=t)),t}function N0(){return In().memoizedState}function wl(t,s,a,f){var v=dr();ht.flags|=t,v.memoizedState=Yo(1|s,a,void 0,f===void 0?null:f)}function xl(t,s,a,f){var v=In();f=f===void 0?null:f;var x=void 0;if(Et!==null){var R=Et.memoizedState;if(x=R.destroy,f!==null&&Dc(f,R.deps)){v.memoizedState=Yo(s,a,x,f);return}}ht.flags|=t,v.memoizedState=Yo(1|s,a,x,f)}function C0(t,s){return wl(8390656,8,t,s)}function Hc(t,s){return xl(2048,8,t,s)}function T0(t,s){return xl(4,2,t,s)}function R0(t,s){return xl(4,4,t,s)}function j0(t,s){if(typeof s=="function")return t=t(),s(t),function(){s(null)};if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function A0(t,s,a){return a=a!=null?a.concat([t]):null,xl(4,4,j0.bind(null,s,t),a)}function Wc(){}function I0(t,s){var a=In();s=s===void 0?null:s;var f=a.memoizedState;return f!==null&&s!==null&&Dc(s,f[1])?f[0]:(a.memoizedState=[t,s],t)}function M0(t,s){var a=In();s=s===void 0?null:s;var f=a.memoizedState;return f!==null&&s!==null&&Dc(s,f[1])?f[0]:(t=t(),a.memoizedState=[t,s],t)}function O0(t,s,a){return(Zs&21)===0?(t.baseState&&(t.baseState=!1,on=!0),t.memoizedState=a):(Vn(a,s)||(a=xi(),ht.lanes|=a,Js|=a,t.baseState=!0),s)}function mR(t,s){var a=He;He=a!==0&&4>a?a:4,t(!0);var f=qc.transition;qc.transition={};try{t(!1),s()}finally{He=a,qc.transition=f}}function P0(){return In().memoizedState}function gR(t,s,a){var f=gs(t);if(a={lane:f,action:a,hasEagerState:!1,eagerState:null,next:null},L0(t))$0(s,a);else if(a=h0(t,s,a,f),a!==null){var v=Jt();Qn(a,t,f,v),q0(a,s,f)}}function vR(t,s,a){var f=gs(t),v={lane:f,action:a,hasEagerState:!1,eagerState:null,next:null};if(L0(t))$0(s,v);else{var x=t.alternate;if(t.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var R=s.lastRenderedState,F=x(R,a);if(v.hasEagerState=!0,v.eagerState=F,Vn(F,R)){var X=s.interleaved;X===null?(v.next=v,Ic(s)):(v.next=X.next,X.next=v),s.interleaved=v;return}}catch{}finally{}a=h0(t,s,v,f),a!==null&&(v=Jt(),Qn(a,t,f,v),q0(a,s,f))}}function L0(t){var s=t.alternate;return t===ht||s!==null&&s===ht}function $0(t,s){Wo=yl=!0;var a=t.pending;a===null?s.next=s:(s.next=a.next,a.next=s),t.pending=s}function q0(t,s,a){if((a&4194240)!==0){var f=s.lanes;f&=t.pendingLanes,a|=f,s.lanes=a,_i(t,a)}}var _l={readContext:An,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useInsertionEffect:Wt,useLayoutEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useMutableSource:Wt,useSyncExternalStore:Wt,useId:Wt,unstable_isNewReconciler:!1},yR={readContext:An,useCallback:function(t,s){return dr().memoizedState=[t,s===void 0?null:s],t},useContext:An,useEffect:C0,useImperativeHandle:function(t,s,a){return a=a!=null?a.concat([t]):null,wl(4194308,4,j0.bind(null,s,t),a)},useLayoutEffect:function(t,s){return wl(4194308,4,t,s)},useInsertionEffect:function(t,s){return wl(4,2,t,s)},useMemo:function(t,s){var a=dr();return s=s===void 0?null:s,t=t(),a.memoizedState=[t,s],t},useReducer:function(t,s,a){var f=dr();return s=a!==void 0?a(s):s,f.memoizedState=f.baseState=s,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:s},f.queue=t,t=t.dispatch=gR.bind(null,ht,t),[f.memoizedState,t]},useRef:function(t){var s=dr();return t={current:t},s.memoizedState=t},useState:E0,useDebugValue:Wc,useDeferredValue:function(t){return dr().memoizedState=t},useTransition:function(){var t=E0(!1),s=t[0];return t=mR.bind(null,t[1]),dr().memoizedState=t,[s,t]},useMutableSource:function(){},useSyncExternalStore:function(t,s,a){var f=ht,v=dr();if(at){if(a===void 0)throw Error(r(407));a=a()}else{if(a=s(),At===null)throw Error(r(349));(Zs&30)!==0||x0(f,s,a)}v.memoizedState=a;var x={value:a,getSnapshot:s};return v.queue=x,C0(b0.bind(null,f,x,t),[t]),f.flags|=2048,Yo(9,_0.bind(null,f,x,a,s),void 0,null),a},useId:function(){var t=dr(),s=At.identifierPrefix;if(at){var a=Mr,f=Ir;a=(f&~(1<<32-gt(f)-1)).toString(32)+a,s=":"+s+"R"+a,a=Vo++,0<a&&(s+="H"+a.toString(32)),s+=":"}else a=pR++,s=":"+s+"r"+a.toString(32)+":";return t.memoizedState=s},unstable_isNewReconciler:!1},wR={readContext:An,useCallback:I0,useContext:An,useEffect:Hc,useImperativeHandle:A0,useInsertionEffect:T0,useLayoutEffect:R0,useMemo:M0,useReducer:Bc,useRef:N0,useState:function(){return Bc(Go)},useDebugValue:Wc,useDeferredValue:function(t){var s=In();return O0(s,Et.memoizedState,t)},useTransition:function(){var t=Bc(Go)[0],s=In().memoizedState;return[t,s]},useMutableSource:y0,useSyncExternalStore:w0,useId:P0,unstable_isNewReconciler:!1},xR={readContext:An,useCallback:I0,useContext:An,useEffect:Hc,useImperativeHandle:A0,useInsertionEffect:T0,useLayoutEffect:R0,useMemo:M0,useReducer:Uc,useRef:N0,useState:function(){return Uc(Go)},useDebugValue:Wc,useDeferredValue:function(t){var s=In();return Et===null?s.memoizedState=t:O0(s,Et.memoizedState,t)},useTransition:function(){var t=Uc(Go)[0],s=In().memoizedState;return[t,s]},useMutableSource:y0,useSyncExternalStore:w0,useId:P0,unstable_isNewReconciler:!1};function Yn(t,s){if(t&&t.defaultProps){s=Z({},s),t=t.defaultProps;for(var a in t)s[a]===void 0&&(s[a]=t[a]);return s}return s}function Vc(t,s,a,f){s=t.memoizedState,a=a(f,s),a=a==null?s:Z({},s,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var bl={isMounted:function(t){return(t=t._reactInternals)?Nn(t)===t:!1},enqueueSetState:function(t,s,a){t=t._reactInternals;var f=Jt(),v=gs(t),x=Pr(f,v);x.payload=s,a!=null&&(x.callback=a),s=fs(t,x,v),s!==null&&(Qn(s,t,v,f),pl(s,t,v))},enqueueReplaceState:function(t,s,a){t=t._reactInternals;var f=Jt(),v=gs(t),x=Pr(f,v);x.tag=1,x.payload=s,a!=null&&(x.callback=a),s=fs(t,x,v),s!==null&&(Qn(s,t,v,f),pl(s,t,v))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var a=Jt(),f=gs(t),v=Pr(a,f);v.tag=2,s!=null&&(v.callback=s),s=fs(t,v,f),s!==null&&(Qn(s,t,f,a),pl(s,t,f))}};function D0(t,s,a,f,v,x,R){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(f,x,R):s.prototype&&s.prototype.isPureReactComponent?!Oo(a,f)||!Oo(v,x):!0}function F0(t,s,a){var f=!1,v=us,x=s.contextType;return typeof x=="object"&&x!==null?x=An(x):(v=sn(s)?Gs:Ht.current,f=s.contextTypes,x=(f=f!=null)?Pi(t,v):us),s=new s(a,x),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=bl,t.stateNode=s,s._reactInternals=t,f&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=v,t.__reactInternalMemoizedMaskedChildContext=x),s}function z0(t,s,a,f){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,f),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,f),s.state!==t&&bl.enqueueReplaceState(s,s.state,null)}function Gc(t,s,a,f){var v=t.stateNode;v.props=a,v.state=t.memoizedState,v.refs={},Mc(t);var x=s.contextType;typeof x=="object"&&x!==null?v.context=An(x):(x=sn(s)?Gs:Ht.current,v.context=Pi(t,x)),v.state=t.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(Vc(t,s,x,a),v.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(s=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),s!==v.state&&bl.enqueueReplaceState(v,v.state,null),ml(t,a,v,f),v.state=t.memoizedState),typeof v.componentDidMount=="function"&&(t.flags|=4194308)}function Ui(t,s){try{var a="",f=s;do a+=Q(f),f=f.return;while(f);var v=a}catch(x){v=`
39
39
  Error generating stack: `+x.message+`
40
- `+x.stack}return{value:t,source:s,stack:v,digest:null}}function Yc(t,s,a){return{value:t,source:null,stack:a??null,digest:s??null}}function Kc(t,s){try{console.error(s.value)}catch(a){setTimeout(function(){throw a})}}var xR=typeof WeakMap=="function"?WeakMap:Map;function B0(t,s,a){a=Pr(-1,a),a.tag=3,a.payload={element:null};var f=s.value;return a.callback=function(){Rl||(Rl=!0,cd=f),Kc(t,s)},a}function U0(t,s,a){a=Pr(-1,a),a.tag=3;var f=t.type.getDerivedStateFromError;if(typeof f=="function"){var v=s.value;a.payload=function(){return f(v)},a.callback=function(){Kc(t,s)}}var x=t.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(a.callback=function(){Kc(t,s),typeof f!="function"&&(ps===null?ps=new Set([this]):ps.add(this));var R=s.stack;this.componentDidCatch(s.value,{componentStack:R!==null?R:""})}),a}function H0(t,s,a){var f=t.pingCache;if(f===null){f=t.pingCache=new xR;var v=new Set;f.set(s,v)}else v=f.get(s),v===void 0&&(v=new Set,f.set(s,v));v.has(a)||(v.add(a),t=OR.bind(null,t,s,a),s.then(t,t))}function W0(t){do{var s;if((s=t.tag===13)&&(s=t.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return t;t=t.return}while(t!==null);return null}function V0(t,s,a,f,v){return(t.mode&1)===0?(t===s?t.flags|=65536:(t.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(s=Pr(-1,1),s.tag=2,fs(a,s,1))),a.lanes|=1),t):(t.flags|=65536,t.lanes=v,t)}var _R=T.ReactCurrentOwner,on=!1;function Zt(t,s,a,f){s.child=t===null?f0(s,null,a,f):Di(s,t.child,a,f)}function G0(t,s,a,f,v){a=a.render;var x=s.ref;return zi(s,v),f=Fc(t,s,a,f,x,v),a=zc(),t!==null&&!on?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~v,Lr(t,s,v)):(at&&a&&Sc(s),s.flags|=1,Zt(t,s,f,v),s.child)}function Y0(t,s,a,f,v){if(t===null){var x=a.type;return typeof x=="function"&&!vd(x)&&x.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(s.tag=15,s.type=x,K0(t,s,x,f,v)):(t=Pl(a.type,null,f,s,s.mode,v),t.ref=s.ref,t.return=s,s.child=t)}if(x=t.child,(t.lanes&v)===0){var R=x.memoizedProps;if(a=a.compare,a=a!==null?a:Oo,a(R,f)&&t.ref===s.ref)return Lr(t,s,v)}return s.flags|=1,t=ys(x,f),t.ref=s.ref,t.return=s,s.child=t}function K0(t,s,a,f,v){if(t!==null){var x=t.memoizedProps;if(Oo(x,f)&&t.ref===s.ref)if(on=!1,s.pendingProps=f=x,(t.lanes&v)!==0)(t.flags&131072)!==0&&(on=!0);else return s.lanes=t.lanes,Lr(t,s,v)}return Xc(t,s,a,f,v)}function X0(t,s,a){var f=s.pendingProps,v=f.children,x=t!==null?t.memoizedState:null;if(f.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},tt(Wi,_n),_n|=a;else{if((a&1073741824)===0)return t=x!==null?x.baseLanes|a:a,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:t,cachePool:null,transitions:null},s.updateQueue=null,tt(Wi,_n),_n|=t,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},f=x!==null?x.baseLanes:a,tt(Wi,_n),_n|=f}else x!==null?(f=x.baseLanes|a,s.memoizedState=null):f=a,tt(Wi,_n),_n|=f;return Zt(t,s,v,a),s.child}function Q0(t,s){var a=s.ref;(t===null&&a!==null||t!==null&&t.ref!==a)&&(s.flags|=512,s.flags|=2097152)}function Xc(t,s,a,f,v){var x=sn(a)?Gs:Ht.current;return x=Pi(s,x),zi(s,v),a=Fc(t,s,a,f,x,v),f=zc(),t!==null&&!on?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~v,Lr(t,s,v)):(at&&f&&Sc(s),s.flags|=1,Zt(t,s,a,v),s.child)}function Z0(t,s,a,f,v){if(sn(a)){var x=!0;ol(s)}else x=!1;if(zi(s,v),s.stateNode===null)kl(t,s),F0(s,a,f),Gc(s,a,f,v),f=!0;else if(t===null){var R=s.stateNode,F=s.memoizedProps;R.props=F;var X=R.context,ae=a.contextType;typeof ae=="object"&&ae!==null?ae=An(ae):(ae=sn(a)?Gs:Ht.current,ae=Pi(s,ae));var pe=a.getDerivedStateFromProps,me=typeof pe=="function"||typeof R.getSnapshotBeforeUpdate=="function";me||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(F!==f||X!==ae)&&z0(s,R,f,ae),ds=!1;var he=s.memoizedState;R.state=he,ml(s,f,R,v),X=s.memoizedState,F!==f||he!==X||rn.current||ds?(typeof pe=="function"&&(Vc(s,a,pe,f),X=s.memoizedState),(F=ds||D0(s,a,F,f,he,X,ae))?(me||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount()),typeof R.componentDidMount=="function"&&(s.flags|=4194308)):(typeof R.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=f,s.memoizedState=X),R.props=f,R.state=X,R.context=ae,f=F):(typeof R.componentDidMount=="function"&&(s.flags|=4194308),f=!1)}else{R=s.stateNode,p0(t,s),F=s.memoizedProps,ae=s.type===s.elementType?F:Yn(s.type,F),R.props=ae,me=s.pendingProps,he=R.context,X=a.contextType,typeof X=="object"&&X!==null?X=An(X):(X=sn(a)?Gs:Ht.current,X=Pi(s,X));var be=a.getDerivedStateFromProps;(pe=typeof be=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(F!==me||he!==X)&&z0(s,R,f,X),ds=!1,he=s.memoizedState,R.state=he,ml(s,f,R,v);var Ne=s.memoizedState;F!==me||he!==Ne||rn.current||ds?(typeof be=="function"&&(Vc(s,a,be,f),Ne=s.memoizedState),(ae=ds||D0(s,a,ae,f,he,Ne,X)||!1)?(pe||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(f,Ne,X),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(f,Ne,X)),typeof R.componentDidUpdate=="function"&&(s.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof R.componentDidUpdate!="function"||F===t.memoizedProps&&he===t.memoizedState||(s.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||F===t.memoizedProps&&he===t.memoizedState||(s.flags|=1024),s.memoizedProps=f,s.memoizedState=Ne),R.props=f,R.state=Ne,R.context=X,f=ae):(typeof R.componentDidUpdate!="function"||F===t.memoizedProps&&he===t.memoizedState||(s.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||F===t.memoizedProps&&he===t.memoizedState||(s.flags|=1024),f=!1)}return Qc(t,s,a,f,x,v)}function Qc(t,s,a,f,v,x){Q0(t,s);var R=(s.flags&128)!==0;if(!f&&!R)return v&&r0(s,a,!1),Lr(t,s,x);f=s.stateNode,_R.current=s;var F=R&&typeof a.getDerivedStateFromError!="function"?null:f.render();return s.flags|=1,t!==null&&R?(s.child=Di(s,t.child,null,x),s.child=Di(s,null,F,x)):Zt(t,s,F,x),s.memoizedState=f.state,v&&r0(s,a,!0),s.child}function J0(t){var s=t.stateNode;s.pendingContext?t0(t,s.pendingContext,s.pendingContext!==s.context):s.context&&t0(t,s.context,!1),Oc(t,s.containerInfo)}function ew(t,s,a,f,v){return qi(),Cc(v),s.flags|=256,Zt(t,s,a,f),s.child}var Zc={dehydrated:null,treeContext:null,retryLane:0};function Jc(t){return{baseLanes:t,cachePool:null,transitions:null}}function tw(t,s,a){var f=s.pendingProps,v=ft.current,x=!1,R=(s.flags&128)!==0,F;if((F=R)||(F=t!==null&&t.memoizedState===null?!1:(v&2)!==0),F?(x=!0,s.flags&=-129):(t===null||t.memoizedState!==null)&&(v|=1),tt(ft,v&1),t===null)return Nc(s),t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((s.mode&1)===0?s.lanes=1:t.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(R=f.children,t=f.fallback,x?(f=s.mode,x=s.child,R={mode:"hidden",children:R},(f&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=R):x=Ll(R,f,0,null),t=ri(t,f,a,null),x.return=s,t.return=s,x.sibling=t,s.child=x,s.child.memoizedState=Jc(a),s.memoizedState=Zc,t):ed(s,R));if(v=t.memoizedState,v!==null&&(F=v.dehydrated,F!==null))return bR(t,s,R,f,F,v,a);if(x){x=f.fallback,R=s.mode,v=t.child,F=v.sibling;var X={mode:"hidden",children:f.children};return(R&1)===0&&s.child!==v?(f=s.child,f.childLanes=0,f.pendingProps=X,s.deletions=null):(f=ys(v,X),f.subtreeFlags=v.subtreeFlags&14680064),F!==null?x=ys(F,x):(x=ri(x,R,a,null),x.flags|=2),x.return=s,f.return=s,f.sibling=x,s.child=f,f=x,x=s.child,R=t.child.memoizedState,R=R===null?Jc(a):{baseLanes:R.baseLanes|a,cachePool:null,transitions:R.transitions},x.memoizedState=R,x.childLanes=t.childLanes&~a,s.memoizedState=Zc,f}return x=t.child,t=x.sibling,f=ys(x,{mode:"visible",children:f.children}),(s.mode&1)===0&&(f.lanes=a),f.return=s,f.sibling=null,t!==null&&(a=s.deletions,a===null?(s.deletions=[t],s.flags|=16):a.push(t)),s.child=f,s.memoizedState=null,f}function ed(t,s){return s=Ll({mode:"visible",children:s},t.mode,0,null),s.return=t,t.child=s}function Sl(t,s,a,f){return f!==null&&Cc(f),Di(s,t.child,null,a),t=ed(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function bR(t,s,a,f,v,x,R){if(a)return s.flags&256?(s.flags&=-257,f=Yc(Error(r(422))),Sl(t,s,R,f)):s.memoizedState!==null?(s.child=t.child,s.flags|=128,null):(x=f.fallback,v=s.mode,f=Ll({mode:"visible",children:f.children},v,0,null),x=ri(x,v,R,null),x.flags|=2,f.return=s,x.return=s,f.sibling=x,s.child=f,(s.mode&1)!==0&&Di(s,t.child,null,R),s.child.memoizedState=Jc(R),s.memoizedState=Zc,x);if((s.mode&1)===0)return Sl(t,s,R,null);if(v.data==="$!"){if(f=v.nextSibling&&v.nextSibling.dataset,f)var F=f.dgst;return f=F,x=Error(r(419)),f=Yc(x,f,void 0),Sl(t,s,R,f)}if(F=(R&t.childLanes)!==0,on||F){if(f=At,f!==null){switch(R&-R){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&(f.suspendedLanes|R))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Or(t,v),Qn(f,t,v,-1))}return gd(),f=Yc(Error(r(421))),Sl(t,s,R,f)}return v.data==="$?"?(s.flags|=128,s.child=t.child,s=PR.bind(null,t),v._reactRetry=s,null):(t=x.treeContext,xn=as(v.nextSibling),wn=s,at=!0,Gn=null,t!==null&&(Rn[jn++]=Ir,Rn[jn++]=Mr,Rn[jn++]=Ys,Ir=t.id,Mr=t.overflow,Ys=s),s=ed(s,f.children),s.flags|=4096,s)}function nw(t,s,a){t.lanes|=s;var f=t.alternate;f!==null&&(f.lanes|=s),Ac(t.return,s,a)}function td(t,s,a,f,v){var x=t.memoizedState;x===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:f,tail:a,tailMode:v}:(x.isBackwards=s,x.rendering=null,x.renderingStartTime=0,x.last=f,x.tail=a,x.tailMode=v)}function rw(t,s,a){var f=s.pendingProps,v=f.revealOrder,x=f.tail;if(Zt(t,s,f.children,a),f=ft.current,(f&2)!==0)f=f&1|2,s.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&nw(t,a,s);else if(t.tag===19)nw(t,a,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}f&=1}if(tt(ft,f),(s.mode&1)===0)s.memoizedState=null;else switch(v){case"forwards":for(a=s.child,v=null;a!==null;)t=a.alternate,t!==null&&gl(t)===null&&(v=a),a=a.sibling;a=v,a===null?(v=s.child,s.child=null):(v=a.sibling,a.sibling=null),td(s,!1,v,a,x);break;case"backwards":for(a=null,v=s.child,s.child=null;v!==null;){if(t=v.alternate,t!==null&&gl(t)===null){s.child=v;break}t=v.sibling,v.sibling=a,a=v,v=t}td(s,!0,a,null,x);break;case"together":td(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function kl(t,s){(s.mode&1)===0&&t!==null&&(t.alternate=null,s.alternate=null,s.flags|=2)}function Lr(t,s,a){if(t!==null&&(s.dependencies=t.dependencies),Js|=s.lanes,(a&s.childLanes)===0)return null;if(t!==null&&s.child!==t.child)throw Error(r(153));if(s.child!==null){for(t=s.child,a=ys(t,t.pendingProps),s.child=a,a.return=s;t.sibling!==null;)t=t.sibling,a=a.sibling=ys(t,t.pendingProps),a.return=s;a.sibling=null}return s.child}function SR(t,s,a){switch(s.tag){case 3:J0(s),qi();break;case 5:v0(s);break;case 1:sn(s.type)&&ol(s);break;case 4:Oc(s,s.stateNode.containerInfo);break;case 10:var f=s.type._context,v=s.memoizedProps.value;tt(fl,f._currentValue),f._currentValue=v;break;case 13:if(f=s.memoizedState,f!==null)return f.dehydrated!==null?(tt(ft,ft.current&1),s.flags|=128,null):(a&s.child.childLanes)!==0?tw(t,s,a):(tt(ft,ft.current&1),t=Lr(t,s,a),t!==null?t.sibling:null);tt(ft,ft.current&1);break;case 19:if(f=(a&s.childLanes)!==0,(t.flags&128)!==0){if(f)return rw(t,s,a);s.flags|=128}if(v=s.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),tt(ft,ft.current),f)break;return null;case 22:case 23:return s.lanes=0,X0(t,s,a)}return Lr(t,s,a)}var sw,nd,iw,ow;sw=function(t,s){for(var a=s.child;a!==null;){if(a.tag===5||a.tag===6)t.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},nd=function(){},iw=function(t,s,a,f){var v=t.memoizedProps;if(v!==f){t=s.stateNode,Qs(cr.current);var x=null;switch(a){case"input":v=ye(t,v),f=ye(t,f),x=[];break;case"select":v=J({},v,{value:void 0}),f=J({},f,{value:void 0}),x=[];break;case"textarea":v=Ze(t,v),f=Ze(t,f),x=[];break;default:typeof v.onClick!="function"&&typeof f.onClick=="function"&&(t.onclick=rl)}Yt(a,f);var R;a=null;for(ae in v)if(!f.hasOwnProperty(ae)&&v.hasOwnProperty(ae)&&v[ae]!=null)if(ae==="style"){var F=v[ae];for(R in F)F.hasOwnProperty(R)&&(a||(a={}),a[R]="")}else ae!=="dangerouslySetInnerHTML"&&ae!=="children"&&ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&ae!=="autoFocus"&&(o.hasOwnProperty(ae)?x||(x=[]):(x=x||[]).push(ae,null));for(ae in f){var X=f[ae];if(F=v!=null?v[ae]:void 0,f.hasOwnProperty(ae)&&X!==F&&(X!=null||F!=null))if(ae==="style")if(F){for(R in F)!F.hasOwnProperty(R)||X&&X.hasOwnProperty(R)||(a||(a={}),a[R]="");for(R in X)X.hasOwnProperty(R)&&F[R]!==X[R]&&(a||(a={}),a[R]=X[R])}else a||(x||(x=[]),x.push(ae,a)),a=X;else ae==="dangerouslySetInnerHTML"?(X=X?X.__html:void 0,F=F?F.__html:void 0,X!=null&&F!==X&&(x=x||[]).push(ae,X)):ae==="children"?typeof X!="string"&&typeof X!="number"||(x=x||[]).push(ae,""+X):ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&(o.hasOwnProperty(ae)?(X!=null&&ae==="onScroll"&&rt("scroll",t),x||F===X||(x=[])):(x=x||[]).push(ae,X))}a&&(x=x||[]).push("style",a);var ae=x;(s.updateQueue=ae)&&(s.flags|=4)}},ow=function(t,s,a,f){a!==f&&(s.flags|=4)};function Ko(t,s){if(!at)switch(t.tailMode){case"hidden":s=t.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var f=null;a!==null;)a.alternate!==null&&(f=a),a=a.sibling;f===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:f.sibling=null}}function Vt(t){var s=t.alternate!==null&&t.alternate.child===t.child,a=0,f=0;if(s)for(var v=t.child;v!==null;)a|=v.lanes|v.childLanes,f|=v.subtreeFlags&14680064,f|=v.flags&14680064,v.return=t,v=v.sibling;else for(v=t.child;v!==null;)a|=v.lanes|v.childLanes,f|=v.subtreeFlags,f|=v.flags,v.return=t,v=v.sibling;return t.subtreeFlags|=f,t.childLanes=a,s}function kR(t,s,a){var f=s.pendingProps;switch(kc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vt(s),null;case 1:return sn(s.type)&&il(),Vt(s),null;case 3:return f=s.stateNode,Bi(),st(rn),st(Ht),$c(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(t===null||t.child===null)&&(cl(s)?s.flags|=4:t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Gn!==null&&(hd(Gn),Gn=null))),nd(t,s),Vt(s),null;case 5:Pc(s);var v=Qs(Ho.current);if(a=s.type,t!==null&&s.stateNode!=null)iw(t,s,a,f,v),t.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!f){if(s.stateNode===null)throw Error(r(166));return Vt(s),null}if(t=Qs(cr.current),cl(s)){f=s.stateNode,a=s.type;var x=s.memoizedProps;switch(f[ur]=s,f[Do]=x,t=(s.mode&1)!==0,a){case"dialog":rt("cancel",f),rt("close",f);break;case"iframe":case"object":case"embed":rt("load",f);break;case"video":case"audio":for(v=0;v<Lo.length;v++)rt(Lo[v],f);break;case"source":rt("error",f);break;case"img":case"image":case"link":rt("error",f),rt("load",f);break;case"details":rt("toggle",f);break;case"input":ke(f,x),rt("invalid",f);break;case"select":f._wrapperState={wasMultiple:!!x.multiple},rt("invalid",f);break;case"textarea":Fe(f,x),rt("invalid",f)}Yt(a,x),v=null;for(var R in x)if(x.hasOwnProperty(R)){var F=x[R];R==="children"?typeof F=="string"?f.textContent!==F&&(x.suppressHydrationWarning!==!0&&nl(f.textContent,F,t),v=["children",F]):typeof F=="number"&&f.textContent!==""+F&&(x.suppressHydrationWarning!==!0&&nl(f.textContent,F,t),v=["children",""+F]):o.hasOwnProperty(R)&&F!=null&&R==="onScroll"&&rt("scroll",f)}switch(a){case"input":Ce(f),_e(f,x,!0);break;case"textarea":Ce(f),Xe(f);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(f.onclick=rl)}f=v,s.updateQueue=f,f!==null&&(s.flags|=4)}else{R=v.nodeType===9?v:v.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Mt(a)),t==="http://www.w3.org/1999/xhtml"?a==="script"?(t=R.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof f.is=="string"?t=R.createElement(a,{is:f.is}):(t=R.createElement(a),a==="select"&&(R=t,f.multiple?R.multiple=!0:f.size&&(R.size=f.size))):t=R.createElementNS(t,a),t[ur]=s,t[Do]=f,sw(t,s,!1,!1),s.stateNode=t;e:{switch(R=Pt(a,f),a){case"dialog":rt("cancel",t),rt("close",t),v=f;break;case"iframe":case"object":case"embed":rt("load",t),v=f;break;case"video":case"audio":for(v=0;v<Lo.length;v++)rt(Lo[v],t);v=f;break;case"source":rt("error",t),v=f;break;case"img":case"image":case"link":rt("error",t),rt("load",t),v=f;break;case"details":rt("toggle",t),v=f;break;case"input":ke(t,f),v=ye(t,f),rt("invalid",t);break;case"option":v=f;break;case"select":t._wrapperState={wasMultiple:!!f.multiple},v=J({},f,{value:void 0}),rt("invalid",t);break;case"textarea":Fe(t,f),v=Ze(t,f),rt("invalid",t);break;default:v=f}Yt(a,v),F=v;for(x in F)if(F.hasOwnProperty(x)){var X=F[x];x==="style"?wt(t,X):x==="dangerouslySetInnerHTML"?(X=X?X.__html:void 0,X!=null&&Ot(t,X)):x==="children"?typeof X=="string"?(a!=="textarea"||X!=="")&&Ft(t,X):typeof X=="number"&&Ft(t,""+X):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(o.hasOwnProperty(x)?X!=null&&x==="onScroll"&&rt("scroll",t):X!=null&&E(t,x,X,R))}switch(a){case"input":Ce(t),_e(t,f,!1);break;case"textarea":Ce(t),Xe(t);break;case"option":f.value!=null&&t.setAttribute("value",""+fe(f.value));break;case"select":t.multiple=!!f.multiple,x=f.value,x!=null?pt(t,!!f.multiple,x,!1):f.defaultValue!=null&&pt(t,!!f.multiple,f.defaultValue,!0);break;default:typeof v.onClick=="function"&&(t.onclick=rl)}switch(a){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}}f&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Vt(s),null;case 6:if(t&&s.stateNode!=null)ow(t,s,t.memoizedProps,f);else{if(typeof f!="string"&&s.stateNode===null)throw Error(r(166));if(a=Qs(Ho.current),Qs(cr.current),cl(s)){if(f=s.stateNode,a=s.memoizedProps,f[ur]=s,(x=f.nodeValue!==a)&&(t=wn,t!==null))switch(t.tag){case 3:nl(f.nodeValue,a,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&nl(f.nodeValue,a,(t.mode&1)!==0)}x&&(s.flags|=4)}else f=(a.nodeType===9?a:a.ownerDocument).createTextNode(f),f[ur]=s,s.stateNode=f}return Vt(s),null;case 13:if(st(ft),f=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(at&&xn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)u0(),qi(),s.flags|=98560,x=!1;else if(x=cl(s),f!==null&&f.dehydrated!==null){if(t===null){if(!x)throw Error(r(318));if(x=s.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[ur]=s}else qi(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Vt(s),x=!1}else Gn!==null&&(hd(Gn),Gn=null),x=!0;if(!x)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=a,s):(f=f!==null,f!==(t!==null&&t.memoizedState!==null)&&f&&(s.child.flags|=8192,(s.mode&1)!==0&&(t===null||(ft.current&1)!==0?Nt===0&&(Nt=3):gd())),s.updateQueue!==null&&(s.flags|=4),Vt(s),null);case 4:return Bi(),nd(t,s),t===null&&$o(s.stateNode.containerInfo),Vt(s),null;case 10:return jc(s.type._context),Vt(s),null;case 17:return sn(s.type)&&il(),Vt(s),null;case 19:if(st(ft),x=s.memoizedState,x===null)return Vt(s),null;if(f=(s.flags&128)!==0,R=x.rendering,R===null)if(f)Ko(x,!1);else{if(Nt!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(R=gl(t),R!==null){for(s.flags|=128,Ko(x,!1),f=R.updateQueue,f!==null&&(s.updateQueue=f,s.flags|=4),s.subtreeFlags=0,f=a,a=s.child;a!==null;)x=a,t=f,x.flags&=14680066,R=x.alternate,R===null?(x.childLanes=0,x.lanes=t,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=R.childLanes,x.lanes=R.lanes,x.child=R.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=R.memoizedProps,x.memoizedState=R.memoizedState,x.updateQueue=R.updateQueue,x.type=R.type,t=R.dependencies,x.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),a=a.sibling;return tt(ft,ft.current&1|2),s.child}t=t.sibling}x.tail!==null&&nt()>Vi&&(s.flags|=128,f=!0,Ko(x,!1),s.lanes=4194304)}else{if(!f)if(t=gl(R),t!==null){if(s.flags|=128,f=!0,a=t.updateQueue,a!==null&&(s.updateQueue=a,s.flags|=4),Ko(x,!0),x.tail===null&&x.tailMode==="hidden"&&!R.alternate&&!at)return Vt(s),null}else 2*nt()-x.renderingStartTime>Vi&&a!==1073741824&&(s.flags|=128,f=!0,Ko(x,!1),s.lanes=4194304);x.isBackwards?(R.sibling=s.child,s.child=R):(a=x.last,a!==null?a.sibling=R:s.child=R,x.last=R)}return x.tail!==null?(s=x.tail,x.rendering=s,x.tail=s.sibling,x.renderingStartTime=nt(),s.sibling=null,a=ft.current,tt(ft,f?a&1|2:a&1),s):(Vt(s),null);case 22:case 23:return md(),f=s.memoizedState!==null,t!==null&&t.memoizedState!==null!==f&&(s.flags|=8192),f&&(s.mode&1)!==0?(_n&1073741824)!==0&&(Vt(s),s.subtreeFlags&6&&(s.flags|=8192)):Vt(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function ER(t,s){switch(kc(s),s.tag){case 1:return sn(s.type)&&il(),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return Bi(),st(rn),st(Ht),$c(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 5:return Pc(s),null;case 13:if(st(ft),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(r(340));qi()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return st(ft),null;case 4:return Bi(),null;case 10:return jc(s.type._context),null;case 22:case 23:return md(),null;case 24:return null;default:return null}}var El=!1,Gt=!1,NR=typeof WeakSet=="function"?WeakSet:Set,Se=null;function Hi(t,s){var a=t.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(f){vt(t,s,f)}else a.current=null}function rd(t,s,a){try{a()}catch(f){vt(t,s,f)}}var aw=!1;function CR(t,s){if(mc=qs,t=Dy(),ac(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var f=a.getSelection&&a.getSelection();if(f&&f.rangeCount!==0){a=f.anchorNode;var v=f.anchorOffset,x=f.focusNode;f=f.focusOffset;try{a.nodeType,x.nodeType}catch{a=null;break e}var R=0,F=-1,X=-1,ae=0,pe=0,me=t,he=null;t:for(;;){for(var be;me!==a||v!==0&&me.nodeType!==3||(F=R+v),me!==x||f!==0&&me.nodeType!==3||(X=R+f),me.nodeType===3&&(R+=me.nodeValue.length),(be=me.firstChild)!==null;)he=me,me=be;for(;;){if(me===t)break t;if(he===a&&++ae===v&&(F=R),he===x&&++pe===f&&(X=R),(be=me.nextSibling)!==null)break;me=he,he=me.parentNode}me=be}a=F===-1||X===-1?null:{start:F,end:X}}else a=null}a=a||{start:0,end:0}}else a=null;for(gc={focusedElem:t,selectionRange:a},qs=!1,Se=s;Se!==null;)if(s=Se,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,Se=t;else for(;Se!==null;){s=Se;try{var Ne=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Ne!==null){var Te=Ne.memoizedProps,xt=Ne.memoizedState,se=s.stateNode,ee=se.getSnapshotBeforeUpdate(s.elementType===s.type?Te:Yn(s.type,Te),xt);se.__reactInternalSnapshotBeforeUpdate=ee}break;case 3:var ie=s.stateNode.containerInfo;ie.nodeType===1?ie.textContent="":ie.nodeType===9&&ie.documentElement&&ie.removeChild(ie.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ge){vt(s,s.return,ge)}if(t=s.sibling,t!==null){t.return=s.return,Se=t;break}Se=s.return}return Ne=aw,aw=!1,Ne}function Xo(t,s,a){var f=s.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&t)===t){var x=v.destroy;v.destroy=void 0,x!==void 0&&rd(s,a,x)}v=v.next}while(v!==f)}}function Nl(t,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&t)===t){var f=a.create;a.destroy=f()}a=a.next}while(a!==s)}}function sd(t){var s=t.ref;if(s!==null){var a=t.stateNode;switch(t.tag){case 5:t=a;break;default:t=a}typeof s=="function"?s(t):s.current=t}}function lw(t){var s=t.alternate;s!==null&&(t.alternate=null,lw(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&(delete s[ur],delete s[Do],delete s[xc],delete s[uR],delete s[cR])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function uw(t){return t.tag===5||t.tag===3||t.tag===4}function cw(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||uw(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function id(t,s,a){var f=t.tag;if(f===5||f===6)t=t.stateNode,s?a.nodeType===8?a.parentNode.insertBefore(t,s):a.insertBefore(t,s):(a.nodeType===8?(s=a.parentNode,s.insertBefore(t,a)):(s=a,s.appendChild(t)),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=rl));else if(f!==4&&(t=t.child,t!==null))for(id(t,s,a),t=t.sibling;t!==null;)id(t,s,a),t=t.sibling}function od(t,s,a){var f=t.tag;if(f===5||f===6)t=t.stateNode,s?a.insertBefore(t,s):a.appendChild(t);else if(f!==4&&(t=t.child,t!==null))for(od(t,s,a),t=t.sibling;t!==null;)od(t,s,a),t=t.sibling}var Lt=null,Kn=!1;function hs(t,s,a){for(a=a.child;a!==null;)dw(t,s,a),a=a.sibling}function dw(t,s,a){if(kt&&typeof kt.onCommitFiberUnmount=="function")try{kt.onCommitFiberUnmount(or,a)}catch{}switch(a.tag){case 5:Gt||Hi(a,s);case 6:var f=Lt,v=Kn;Lt=null,hs(t,s,a),Lt=f,Kn=v,Lt!==null&&(Kn?(t=Lt,a=a.stateNode,t.nodeType===8?t.parentNode.removeChild(a):t.removeChild(a)):Lt.removeChild(a.stateNode));break;case 18:Lt!==null&&(Kn?(t=Lt,a=a.stateNode,t.nodeType===8?wc(t.parentNode,a):t.nodeType===1&&wc(t,a),nn(t)):wc(Lt,a.stateNode));break;case 4:f=Lt,v=Kn,Lt=a.stateNode.containerInfo,Kn=!0,hs(t,s,a),Lt=f,Kn=v;break;case 0:case 11:case 14:case 15:if(!Gt&&(f=a.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){v=f=f.next;do{var x=v,R=x.destroy;x=x.tag,R!==void 0&&((x&2)!==0||(x&4)!==0)&&rd(a,s,R),v=v.next}while(v!==f)}hs(t,s,a);break;case 1:if(!Gt&&(Hi(a,s),f=a.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=a.memoizedProps,f.state=a.memoizedState,f.componentWillUnmount()}catch(F){vt(a,s,F)}hs(t,s,a);break;case 21:hs(t,s,a);break;case 22:a.mode&1?(Gt=(f=Gt)||a.memoizedState!==null,hs(t,s,a),Gt=f):hs(t,s,a);break;default:hs(t,s,a)}}function fw(t){var s=t.updateQueue;if(s!==null){t.updateQueue=null;var a=t.stateNode;a===null&&(a=t.stateNode=new NR),s.forEach(function(f){var v=LR.bind(null,t,f);a.has(f)||(a.add(f),f.then(v,v))})}}function Xn(t,s){var a=s.deletions;if(a!==null)for(var f=0;f<a.length;f++){var v=a[f];try{var x=t,R=s,F=R;e:for(;F!==null;){switch(F.tag){case 5:Lt=F.stateNode,Kn=!1;break e;case 3:Lt=F.stateNode.containerInfo,Kn=!0;break e;case 4:Lt=F.stateNode.containerInfo,Kn=!0;break e}F=F.return}if(Lt===null)throw Error(r(160));dw(x,R,v),Lt=null,Kn=!1;var X=v.alternate;X!==null&&(X.return=null),v.return=null}catch(ae){vt(v,s,ae)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)hw(s,t),s=s.sibling}function hw(t,s){var a=t.alternate,f=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Xn(s,t),fr(t),f&4){try{Xo(3,t,t.return),Nl(3,t)}catch(Te){vt(t,t.return,Te)}try{Xo(5,t,t.return)}catch(Te){vt(t,t.return,Te)}}break;case 1:Xn(s,t),fr(t),f&512&&a!==null&&Hi(a,a.return);break;case 5:if(Xn(s,t),fr(t),f&512&&a!==null&&Hi(a,a.return),t.flags&32){var v=t.stateNode;try{Ft(v,"")}catch(Te){vt(t,t.return,Te)}}if(f&4&&(v=t.stateNode,v!=null)){var x=t.memoizedProps,R=a!==null?a.memoizedProps:x,F=t.type,X=t.updateQueue;if(t.updateQueue=null,X!==null)try{F==="input"&&x.type==="radio"&&x.name!=null&&Ye(v,x),Pt(F,R);var ae=Pt(F,x);for(R=0;R<X.length;R+=2){var pe=X[R],me=X[R+1];pe==="style"?wt(v,me):pe==="dangerouslySetInnerHTML"?Ot(v,me):pe==="children"?Ft(v,me):E(v,pe,me,ae)}switch(F){case"input":we(v,x);break;case"textarea":Je(v,x);break;case"select":var he=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!x.multiple;var be=x.value;be!=null?pt(v,!!x.multiple,be,!1):he!==!!x.multiple&&(x.defaultValue!=null?pt(v,!!x.multiple,x.defaultValue,!0):pt(v,!!x.multiple,x.multiple?[]:"",!1))}v[Do]=x}catch(Te){vt(t,t.return,Te)}}break;case 6:if(Xn(s,t),fr(t),f&4){if(t.stateNode===null)throw Error(r(162));v=t.stateNode,x=t.memoizedProps;try{v.nodeValue=x}catch(Te){vt(t,t.return,Te)}}break;case 3:if(Xn(s,t),fr(t),f&4&&a!==null&&a.memoizedState.isDehydrated)try{nn(s.containerInfo)}catch(Te){vt(t,t.return,Te)}break;case 4:Xn(s,t),fr(t);break;case 13:Xn(s,t),fr(t),v=t.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(ud=nt())),f&4&&fw(t);break;case 22:if(pe=a!==null&&a.memoizedState!==null,t.mode&1?(Gt=(ae=Gt)||pe,Xn(s,t),Gt=ae):Xn(s,t),fr(t),f&8192){if(ae=t.memoizedState!==null,(t.stateNode.isHidden=ae)&&!pe&&(t.mode&1)!==0)for(Se=t,pe=t.child;pe!==null;){for(me=Se=pe;Se!==null;){switch(he=Se,be=he.child,he.tag){case 0:case 11:case 14:case 15:Xo(4,he,he.return);break;case 1:Hi(he,he.return);var Ne=he.stateNode;if(typeof Ne.componentWillUnmount=="function"){f=he,a=he.return;try{s=f,Ne.props=s.memoizedProps,Ne.state=s.memoizedState,Ne.componentWillUnmount()}catch(Te){vt(f,a,Te)}}break;case 5:Hi(he,he.return);break;case 22:if(he.memoizedState!==null){gw(me);continue}}be!==null?(be.return=he,Se=be):gw(me)}pe=pe.sibling}e:for(pe=null,me=t;;){if(me.tag===5){if(pe===null){pe=me;try{v=me.stateNode,ae?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(F=me.stateNode,X=me.memoizedProps.style,R=X!=null&&X.hasOwnProperty("display")?X.display:null,F.style.display=mt("display",R))}catch(Te){vt(t,t.return,Te)}}}else if(me.tag===6){if(pe===null)try{me.stateNode.nodeValue=ae?"":me.memoizedProps}catch(Te){vt(t,t.return,Te)}}else if((me.tag!==22&&me.tag!==23||me.memoizedState===null||me===t)&&me.child!==null){me.child.return=me,me=me.child;continue}if(me===t)break e;for(;me.sibling===null;){if(me.return===null||me.return===t)break e;pe===me&&(pe=null),me=me.return}pe===me&&(pe=null),me.sibling.return=me.return,me=me.sibling}}break;case 19:Xn(s,t),fr(t),f&4&&fw(t);break;case 21:break;default:Xn(s,t),fr(t)}}function fr(t){var s=t.flags;if(s&2){try{e:{for(var a=t.return;a!==null;){if(uw(a)){var f=a;break e}a=a.return}throw Error(r(160))}switch(f.tag){case 5:var v=f.stateNode;f.flags&32&&(Ft(v,""),f.flags&=-33);var x=cw(t);od(t,x,v);break;case 3:case 4:var R=f.stateNode.containerInfo,F=cw(t);id(t,F,R);break;default:throw Error(r(161))}}catch(X){vt(t,t.return,X)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function TR(t,s,a){Se=t,pw(t)}function pw(t,s,a){for(var f=(t.mode&1)!==0;Se!==null;){var v=Se,x=v.child;if(v.tag===22&&f){var R=v.memoizedState!==null||El;if(!R){var F=v.alternate,X=F!==null&&F.memoizedState!==null||Gt;F=El;var ae=Gt;if(El=R,(Gt=X)&&!ae)for(Se=v;Se!==null;)R=Se,X=R.child,R.tag===22&&R.memoizedState!==null?vw(v):X!==null?(X.return=R,Se=X):vw(v);for(;x!==null;)Se=x,pw(x),x=x.sibling;Se=v,El=F,Gt=ae}mw(t)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,Se=x):mw(t)}}function mw(t){for(;Se!==null;){var s=Se;if((s.flags&8772)!==0){var a=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Gt||Nl(5,s);break;case 1:var f=s.stateNode;if(s.flags&4&&!Gt)if(a===null)f.componentDidMount();else{var v=s.elementType===s.type?a.memoizedProps:Yn(s.type,a.memoizedProps);f.componentDidUpdate(v,a.memoizedState,f.__reactInternalSnapshotBeforeUpdate)}var x=s.updateQueue;x!==null&&g0(s,x,f);break;case 3:var R=s.updateQueue;if(R!==null){if(a=null,s.child!==null)switch(s.child.tag){case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}g0(s,R,a)}break;case 5:var F=s.stateNode;if(a===null&&s.flags&4){a=F;var X=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":X.autoFocus&&a.focus();break;case"img":X.src&&(a.src=X.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var ae=s.alternate;if(ae!==null){var pe=ae.memoizedState;if(pe!==null){var me=pe.dehydrated;me!==null&&nn(me)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Gt||s.flags&512&&sd(s)}catch(he){vt(s,s.return,he)}}if(s===t){Se=null;break}if(a=s.sibling,a!==null){a.return=s.return,Se=a;break}Se=s.return}}function gw(t){for(;Se!==null;){var s=Se;if(s===t){Se=null;break}var a=s.sibling;if(a!==null){a.return=s.return,Se=a;break}Se=s.return}}function vw(t){for(;Se!==null;){var s=Se;try{switch(s.tag){case 0:case 11:case 15:var a=s.return;try{Nl(4,s)}catch(X){vt(s,a,X)}break;case 1:var f=s.stateNode;if(typeof f.componentDidMount=="function"){var v=s.return;try{f.componentDidMount()}catch(X){vt(s,v,X)}}var x=s.return;try{sd(s)}catch(X){vt(s,x,X)}break;case 5:var R=s.return;try{sd(s)}catch(X){vt(s,R,X)}}}catch(X){vt(s,s.return,X)}if(s===t){Se=null;break}var F=s.sibling;if(F!==null){F.return=s.return,Se=F;break}Se=s.return}}var RR=Math.ceil,Cl=T.ReactCurrentDispatcher,ad=T.ReactCurrentOwner,Mn=T.ReactCurrentBatchConfig,Ue=0,At=null,_t=null,$t=0,_n=0,Wi=ls(0),Nt=0,Qo=null,Js=0,Tl=0,ld=0,Zo=null,an=null,ud=0,Vi=1/0,$r=null,Rl=!1,cd=null,ps=null,jl=!1,ms=null,Al=0,Jo=0,dd=null,Il=-1,Ml=0;function Jt(){return(Ue&6)!==0?nt():Il!==-1?Il:Il=nt()}function gs(t){return(t.mode&1)===0?1:(Ue&2)!==0&&$t!==0?$t&-$t:fR.transition!==null?(Ml===0&&(Ml=xi()),Ml):(t=He,t!==0||(t=window.event,t=t===void 0?16:Ba(t.type)),t)}function Qn(t,s,a,f){if(50<Jo)throw Jo=0,dd=null,Error(r(185));ts(t,a,f),((Ue&2)===0||t!==At)&&(t===At&&((Ue&2)===0&&(Tl|=a),Nt===4&&vs(t,$t)),ln(t,f),a===1&&Ue===0&&(s.mode&1)===0&&(Vi=nt()+500,al&&cs()))}function ln(t,s){var a=t.callbackNode;qa(t,s);var f=Ps(t,t===At?$t:0);if(f===0)a!==null&&Kt(a),t.callbackNode=null,t.callbackPriority=0;else if(s=f&-f,t.callbackPriority!==s){if(a!=null&&Kt(a),s===1)t.tag===0?dR(ww.bind(null,t)):s0(ww.bind(null,t)),aR(function(){(Ue&6)===0&&cs()}),a=null;else{switch(Da(f)){case 1:a=Qr;break;case 4:a=Is;break;case 16:a=Zr;break;case 536870912:a=Ms;break;default:a=Zr}a=Cw(a,yw.bind(null,t))}t.callbackPriority=s,t.callbackNode=a}}function yw(t,s){if(Il=-1,Ml=0,(Ue&6)!==0)throw Error(r(327));var a=t.callbackNode;if(Gi()&&t.callbackNode!==a)return null;var f=Ps(t,t===At?$t:0);if(f===0)return null;if((f&30)!==0||(f&t.expiredLanes)!==0||s)s=Ol(t,f);else{s=f;var v=Ue;Ue|=2;var x=_w();(At!==t||$t!==s)&&($r=null,Vi=nt()+500,ti(t,s));do try{IR();break}catch(F){xw(t,F)}while(!0);Rc(),Cl.current=x,Ue=v,_t!==null?s=0:(At=null,$t=0,s=Nt)}if(s!==0){if(s===2&&(v=So(t),v!==0&&(f=v,s=fd(t,v))),s===1)throw a=Qo,ti(t,0),vs(t,f),ln(t,nt()),a;if(s===6)vs(t,f);else{if(v=t.current.alternate,(f&30)===0&&!jR(v)&&(s=Ol(t,f),s===2&&(x=So(t),x!==0&&(f=x,s=fd(t,x))),s===1))throw a=Qo,ti(t,0),vs(t,f),ln(t,nt()),a;switch(t.finishedWork=v,t.finishedLanes=f,s){case 0:case 1:throw Error(r(345));case 2:ni(t,an,$r);break;case 3:if(vs(t,f),(f&130023424)===f&&(s=ud+500-nt(),10<s)){if(Ps(t,0)!==0)break;if(v=t.suspendedLanes,(v&f)!==f){Jt(),t.pingedLanes|=t.suspendedLanes&v;break}t.timeoutHandle=yc(ni.bind(null,t,an,$r),s);break}ni(t,an,$r);break;case 4:if(vs(t,f),(f&4194240)===f)break;for(s=t.eventTimes,v=-1;0<f;){var R=31-gt(f);x=1<<R,R=s[R],R>v&&(v=R),f&=~x}if(f=v,f=nt()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*RR(f/1960))-f,10<f){t.timeoutHandle=yc(ni.bind(null,t,an,$r),f);break}ni(t,an,$r);break;case 5:ni(t,an,$r);break;default:throw Error(r(329))}}}return ln(t,nt()),t.callbackNode===a?yw.bind(null,t):null}function fd(t,s){var a=Zo;return t.current.memoizedState.isDehydrated&&(ti(t,s).flags|=256),t=Ol(t,s),t!==2&&(s=an,an=a,s!==null&&hd(s)),t}function hd(t){an===null?an=t:an.push.apply(an,t)}function jR(t){for(var s=t;;){if(s.flags&16384){var a=s.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var f=0;f<a.length;f++){var v=a[f],x=v.getSnapshot;v=v.value;try{if(!Vn(x(),v))return!1}catch{return!1}}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function vs(t,s){for(s&=~ld,s&=~Tl,t.suspendedLanes|=s,t.pingedLanes&=~s,t=t.expirationTimes;0<s;){var a=31-gt(s),f=1<<a;t[a]=-1,s&=~f}}function ww(t){if((Ue&6)!==0)throw Error(r(327));Gi();var s=Ps(t,0);if((s&1)===0)return ln(t,nt()),null;var a=Ol(t,s);if(t.tag!==0&&a===2){var f=So(t);f!==0&&(s=f,a=fd(t,f))}if(a===1)throw a=Qo,ti(t,0),vs(t,s),ln(t,nt()),a;if(a===6)throw Error(r(345));return t.finishedWork=t.current.alternate,t.finishedLanes=s,ni(t,an,$r),ln(t,nt()),null}function pd(t,s){var a=Ue;Ue|=1;try{return t(s)}finally{Ue=a,Ue===0&&(Vi=nt()+500,al&&cs())}}function ei(t){ms!==null&&ms.tag===0&&(Ue&6)===0&&Gi();var s=Ue;Ue|=1;var a=Mn.transition,f=He;try{if(Mn.transition=null,He=1,t)return t()}finally{He=f,Mn.transition=a,Ue=s,(Ue&6)===0&&cs()}}function md(){_n=Wi.current,st(Wi)}function ti(t,s){t.finishedWork=null,t.finishedLanes=0;var a=t.timeoutHandle;if(a!==-1&&(t.timeoutHandle=-1,oR(a)),_t!==null)for(a=_t.return;a!==null;){var f=a;switch(kc(f),f.tag){case 1:f=f.type.childContextTypes,f!=null&&il();break;case 3:Bi(),st(rn),st(Ht),$c();break;case 5:Pc(f);break;case 4:Bi();break;case 13:st(ft);break;case 19:st(ft);break;case 10:jc(f.type._context);break;case 22:case 23:md()}a=a.return}if(At=t,_t=t=ys(t.current,null),$t=_n=s,Nt=0,Qo=null,ld=Tl=Js=0,an=Zo=null,Xs!==null){for(s=0;s<Xs.length;s++)if(a=Xs[s],f=a.interleaved,f!==null){a.interleaved=null;var v=f.next,x=a.pending;if(x!==null){var R=x.next;x.next=v,f.next=R}a.pending=f}Xs=null}return t}function xw(t,s){do{var a=_t;try{if(Rc(),vl.current=_l,yl){for(var f=ht.memoizedState;f!==null;){var v=f.queue;v!==null&&(v.pending=null),f=f.next}yl=!1}if(Zs=0,jt=Et=ht=null,Wo=!1,Vo=0,ad.current=null,a===null||a.return===null){Nt=1,Qo=s,_t=null;break}e:{var x=t,R=a.return,F=a,X=s;if(s=$t,F.flags|=32768,X!==null&&typeof X=="object"&&typeof X.then=="function"){var ae=X,pe=F,me=pe.tag;if((pe.mode&1)===0&&(me===0||me===11||me===15)){var he=pe.alternate;he?(pe.updateQueue=he.updateQueue,pe.memoizedState=he.memoizedState,pe.lanes=he.lanes):(pe.updateQueue=null,pe.memoizedState=null)}var be=W0(R);if(be!==null){be.flags&=-257,V0(be,R,F,x,s),be.mode&1&&H0(x,ae,s),s=be,X=ae;var Ne=s.updateQueue;if(Ne===null){var Te=new Set;Te.add(X),s.updateQueue=Te}else Ne.add(X);break e}else{if((s&1)===0){H0(x,ae,s),gd();break e}X=Error(r(426))}}else if(at&&F.mode&1){var xt=W0(R);if(xt!==null){(xt.flags&65536)===0&&(xt.flags|=256),V0(xt,R,F,x,s),Cc(Ui(X,F));break e}}x=X=Ui(X,F),Nt!==4&&(Nt=2),Zo===null?Zo=[x]:Zo.push(x),x=R;do{switch(x.tag){case 3:x.flags|=65536,s&=-s,x.lanes|=s;var se=B0(x,X,s);m0(x,se);break e;case 1:F=X;var ee=x.type,ie=x.stateNode;if((x.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(ps===null||!ps.has(ie)))){x.flags|=65536,s&=-s,x.lanes|=s;var ge=U0(x,F,s);m0(x,ge);break e}}x=x.return}while(x!==null)}Sw(a)}catch(Re){s=Re,_t===a&&a!==null&&(_t=a=a.return);continue}break}while(!0)}function _w(){var t=Cl.current;return Cl.current=_l,t===null?_l:t}function gd(){(Nt===0||Nt===3||Nt===2)&&(Nt=4),At===null||(Js&268435455)===0&&(Tl&268435455)===0||vs(At,$t)}function Ol(t,s){var a=Ue;Ue|=2;var f=_w();(At!==t||$t!==s)&&($r=null,ti(t,s));do try{AR();break}catch(v){xw(t,v)}while(!0);if(Rc(),Ue=a,Cl.current=f,_t!==null)throw Error(r(261));return At=null,$t=0,Nt}function AR(){for(;_t!==null;)bw(_t)}function IR(){for(;_t!==null&&!Xr();)bw(_t)}function bw(t){var s=Nw(t.alternate,t,_n);t.memoizedProps=t.pendingProps,s===null?Sw(t):_t=s,ad.current=null}function Sw(t){var s=t;do{var a=s.alternate;if(t=s.return,(s.flags&32768)===0){if(a=kR(a,s,_n),a!==null){_t=a;return}}else{if(a=ER(a,s),a!==null){a.flags&=32767,_t=a;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Nt=6,_t=null;return}}if(s=s.sibling,s!==null){_t=s;return}_t=s=t}while(s!==null);Nt===0&&(Nt=5)}function ni(t,s,a){var f=He,v=Mn.transition;try{Mn.transition=null,He=1,MR(t,s,a,f)}finally{Mn.transition=v,He=f}return null}function MR(t,s,a,f){do Gi();while(ms!==null);if((Ue&6)!==0)throw Error(r(327));a=t.finishedWork;var v=t.finishedLanes;if(a===null)return null;if(t.finishedWork=null,t.finishedLanes=0,a===t.current)throw Error(r(177));t.callbackNode=null,t.callbackPriority=0;var x=a.lanes|a.childLanes;if(ec(t,x),t===At&&(_t=At=null,$t=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||jl||(jl=!0,Cw(Zr,function(){return Gi(),null})),x=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||x){x=Mn.transition,Mn.transition=null;var R=He;He=1;var F=Ue;Ue|=4,ad.current=null,CR(t,a),hw(a,t),JT(gc),qs=!!mc,gc=mc=null,t.current=a,TR(a),wi(),Ue=F,He=R,Mn.transition=x}else t.current=a;if(jl&&(jl=!1,ms=t,Al=v),x=t.pendingLanes,x===0&&(ps=null),Os(a.stateNode),ln(t,nt()),s!==null)for(f=t.onRecoverableError,a=0;a<s.length;a++)v=s[a],f(v.value,{componentStack:v.stack,digest:v.digest});if(Rl)throw Rl=!1,t=cd,cd=null,t;return(Al&1)!==0&&t.tag!==0&&Gi(),x=t.pendingLanes,(x&1)!==0?t===dd?Jo++:(Jo=0,dd=t):Jo=0,cs(),null}function Gi(){if(ms!==null){var t=Da(Al),s=Mn.transition,a=He;try{if(Mn.transition=null,He=16>t?16:t,ms===null)var f=!1;else{if(t=ms,ms=null,Al=0,(Ue&6)!==0)throw Error(r(331));var v=Ue;for(Ue|=4,Se=t.current;Se!==null;){var x=Se,R=x.child;if((Se.flags&16)!==0){var F=x.deletions;if(F!==null){for(var X=0;X<F.length;X++){var ae=F[X];for(Se=ae;Se!==null;){var pe=Se;switch(pe.tag){case 0:case 11:case 15:Xo(8,pe,x)}var me=pe.child;if(me!==null)me.return=pe,Se=me;else for(;Se!==null;){pe=Se;var he=pe.sibling,be=pe.return;if(lw(pe),pe===ae){Se=null;break}if(he!==null){he.return=be,Se=he;break}Se=be}}}var Ne=x.alternate;if(Ne!==null){var Te=Ne.child;if(Te!==null){Ne.child=null;do{var xt=Te.sibling;Te.sibling=null,Te=xt}while(Te!==null)}}Se=x}}if((x.subtreeFlags&2064)!==0&&R!==null)R.return=x,Se=R;else e:for(;Se!==null;){if(x=Se,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Xo(9,x,x.return)}var se=x.sibling;if(se!==null){se.return=x.return,Se=se;break e}Se=x.return}}var ee=t.current;for(Se=ee;Se!==null;){R=Se;var ie=R.child;if((R.subtreeFlags&2064)!==0&&ie!==null)ie.return=R,Se=ie;else e:for(R=ee;Se!==null;){if(F=Se,(F.flags&2048)!==0)try{switch(F.tag){case 0:case 11:case 15:Nl(9,F)}}catch(Re){vt(F,F.return,Re)}if(F===R){Se=null;break e}var ge=F.sibling;if(ge!==null){ge.return=F.return,Se=ge;break e}Se=F.return}}if(Ue=v,cs(),kt&&typeof kt.onPostCommitFiberRoot=="function")try{kt.onPostCommitFiberRoot(or,t)}catch{}f=!0}return f}finally{He=a,Mn.transition=s}}return!1}function kw(t,s,a){s=Ui(a,s),s=B0(t,s,1),t=fs(t,s,1),s=Jt(),t!==null&&(ts(t,1,s),ln(t,s))}function vt(t,s,a){if(t.tag===3)kw(t,t,a);else for(;s!==null;){if(s.tag===3){kw(s,t,a);break}else if(s.tag===1){var f=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(ps===null||!ps.has(f))){t=Ui(a,t),t=U0(s,t,1),s=fs(s,t,1),t=Jt(),s!==null&&(ts(s,1,t),ln(s,t));break}}s=s.return}}function OR(t,s,a){var f=t.pingCache;f!==null&&f.delete(s),s=Jt(),t.pingedLanes|=t.suspendedLanes&a,At===t&&($t&a)===a&&(Nt===4||Nt===3&&($t&130023424)===$t&&500>nt()-ud?ti(t,0):ld|=a),ln(t,s)}function Ew(t,s){s===0&&((t.mode&1)===0?s=1:(s=es,es<<=1,(es&130023424)===0&&(es=4194304)));var a=Jt();t=Or(t,s),t!==null&&(ts(t,s,a),ln(t,a))}function PR(t){var s=t.memoizedState,a=0;s!==null&&(a=s.retryLane),Ew(t,a)}function LR(t,s){var a=0;switch(t.tag){case 13:var f=t.stateNode,v=t.memoizedState;v!==null&&(a=v.retryLane);break;case 19:f=t.stateNode;break;default:throw Error(r(314))}f!==null&&f.delete(s),Ew(t,a)}var Nw;Nw=function(t,s,a){if(t!==null)if(t.memoizedProps!==s.pendingProps||rn.current)on=!0;else{if((t.lanes&a)===0&&(s.flags&128)===0)return on=!1,SR(t,s,a);on=(t.flags&131072)!==0}else on=!1,at&&(s.flags&1048576)!==0&&i0(s,ul,s.index);switch(s.lanes=0,s.tag){case 2:var f=s.type;kl(t,s),t=s.pendingProps;var v=Pi(s,Ht.current);zi(s,a),v=Fc(null,s,f,t,v,a);var x=zc();return s.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,sn(f)?(x=!0,ol(s)):x=!1,s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Mc(s),v.updater=bl,s.stateNode=v,v._reactInternals=s,Gc(s,f,t,a),s=Qc(null,s,f,!0,x,a)):(s.tag=0,at&&x&&Sc(s),Zt(null,s,v,a),s=s.child),s;case 16:f=s.elementType;e:{switch(kl(t,s),t=s.pendingProps,v=f._init,f=v(f._payload),s.type=f,v=s.tag=qR(f),t=Yn(f,t),v){case 0:s=Xc(null,s,f,t,a);break e;case 1:s=Z0(null,s,f,t,a);break e;case 11:s=G0(null,s,f,t,a);break e;case 14:s=Y0(null,s,f,Yn(f.type,t),a);break e}throw Error(r(306,f,""))}return s;case 0:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Yn(f,v),Xc(t,s,f,v,a);case 1:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Yn(f,v),Z0(t,s,f,v,a);case 3:e:{if(J0(s),t===null)throw Error(r(387));f=s.pendingProps,x=s.memoizedState,v=x.element,p0(t,s),ml(s,f,null,a);var R=s.memoizedState;if(f=R.element,x.isDehydrated)if(x={element:f,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){v=Ui(Error(r(423)),s),s=ew(t,s,f,a,v);break e}else if(f!==v){v=Ui(Error(r(424)),s),s=ew(t,s,f,a,v);break e}else for(xn=as(s.stateNode.containerInfo.firstChild),wn=s,at=!0,Gn=null,a=f0(s,null,f,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(qi(),f===v){s=Lr(t,s,a);break e}Zt(t,s,f,a)}s=s.child}return s;case 5:return v0(s),t===null&&Nc(s),f=s.type,v=s.pendingProps,x=t!==null?t.memoizedProps:null,R=v.children,vc(f,v)?R=null:x!==null&&vc(f,x)&&(s.flags|=32),Q0(t,s),Zt(t,s,R,a),s.child;case 6:return t===null&&Nc(s),null;case 13:return tw(t,s,a);case 4:return Oc(s,s.stateNode.containerInfo),f=s.pendingProps,t===null?s.child=Di(s,null,f,a):Zt(t,s,f,a),s.child;case 11:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Yn(f,v),G0(t,s,f,v,a);case 7:return Zt(t,s,s.pendingProps,a),s.child;case 8:return Zt(t,s,s.pendingProps.children,a),s.child;case 12:return Zt(t,s,s.pendingProps.children,a),s.child;case 10:e:{if(f=s.type._context,v=s.pendingProps,x=s.memoizedProps,R=v.value,tt(fl,f._currentValue),f._currentValue=R,x!==null)if(Vn(x.value,R)){if(x.children===v.children&&!rn.current){s=Lr(t,s,a);break e}}else for(x=s.child,x!==null&&(x.return=s);x!==null;){var F=x.dependencies;if(F!==null){R=x.child;for(var X=F.firstContext;X!==null;){if(X.context===f){if(x.tag===1){X=Pr(-1,a&-a),X.tag=2;var ae=x.updateQueue;if(ae!==null){ae=ae.shared;var pe=ae.pending;pe===null?X.next=X:(X.next=pe.next,pe.next=X),ae.pending=X}}x.lanes|=a,X=x.alternate,X!==null&&(X.lanes|=a),Ac(x.return,a,s),F.lanes|=a;break}X=X.next}}else if(x.tag===10)R=x.type===s.type?null:x.child;else if(x.tag===18){if(R=x.return,R===null)throw Error(r(341));R.lanes|=a,F=R.alternate,F!==null&&(F.lanes|=a),Ac(R,a,s),R=x.sibling}else R=x.child;if(R!==null)R.return=x;else for(R=x;R!==null;){if(R===s){R=null;break}if(x=R.sibling,x!==null){x.return=R.return,R=x;break}R=R.return}x=R}Zt(t,s,v.children,a),s=s.child}return s;case 9:return v=s.type,f=s.pendingProps.children,zi(s,a),v=An(v),f=f(v),s.flags|=1,Zt(t,s,f,a),s.child;case 14:return f=s.type,v=Yn(f,s.pendingProps),v=Yn(f.type,v),Y0(t,s,f,v,a);case 15:return K0(t,s,s.type,s.pendingProps,a);case 17:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Yn(f,v),kl(t,s),s.tag=1,sn(f)?(t=!0,ol(s)):t=!1,zi(s,a),F0(s,f,v),Gc(s,f,v,a),Qc(null,s,f,!0,t,a);case 19:return rw(t,s,a);case 22:return X0(t,s,a)}throw Error(r(156,s.tag))};function Cw(t,s){return _r(t,s)}function $R(t,s,a,f){this.tag=t,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function On(t,s,a,f){return new $R(t,s,a,f)}function vd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function qR(t){if(typeof t=="function")return vd(t)?1:0;if(t!=null){if(t=t.$$typeof,t===V)return 11;if(t===q)return 14}return 2}function ys(t,s){var a=t.alternate;return a===null?(a=On(t.tag,s,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=s,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&14680064,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,s=t.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a}function Pl(t,s,a,f,v,x){var R=2;if(f=t,typeof t=="function")vd(t)&&(R=1);else if(typeof t=="string")R=5;else e:switch(t){case A:return ri(a.children,v,x,s);case U:R=8,v|=8;break;case z:return t=On(12,a,s,v|2),t.elementType=z,t.lanes=x,t;case B:return t=On(13,a,s,v),t.elementType=B,t.lanes=x,t;case C:return t=On(19,a,s,v),t.elementType=C,t.lanes=x,t;case re:return Ll(a,v,x,s);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case P:R=10;break e;case D:R=9;break e;case V:R=11;break e;case q:R=14;break e;case L:R=16,f=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return s=On(R,a,s,v),s.elementType=t,s.type=f,s.lanes=x,s}function ri(t,s,a,f){return t=On(7,t,f,s),t.lanes=a,t}function Ll(t,s,a,f){return t=On(22,t,f,s),t.elementType=re,t.lanes=a,t.stateNode={isHidden:!1},t}function yd(t,s,a){return t=On(6,t,null,s),t.lanes=a,t}function wd(t,s,a){return s=On(4,t.children!==null?t.children:[],t.key,s),s.lanes=a,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}function DR(t,s,a,f,v){this.tag=s,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ar(0),this.expirationTimes=ar(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ar(0),this.identifierPrefix=f,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function xd(t,s,a,f,v,x,R,F,X){return t=new DR(t,s,a,F,X),s===1?(s=1,x===!0&&(s|=8)):s=0,x=On(3,null,null,s),t.current=x,x.stateNode=t,x.memoizedState={element:f,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Mc(x),t}function FR(t,s,a){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:f==null?null:""+f,children:t,containerInfo:s,implementation:a}}function Tw(t){if(!t)return us;t=t._reactInternals;e:{if(Nn(t)!==t||t.tag!==1)throw Error(r(170));var s=t;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(sn(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(t.tag===1){var a=t.type;if(sn(a))return n0(t,a,s)}return s}function Rw(t,s,a,f,v,x,R,F,X){return t=xd(a,f,!0,t,v,x,R,F,X),t.context=Tw(null),a=t.current,f=Jt(),v=gs(a),x=Pr(f,v),x.callback=s??null,fs(a,x,v),t.current.lanes=v,ts(t,v,f),ln(t,f),t}function $l(t,s,a,f){var v=s.current,x=Jt(),R=gs(v);return a=Tw(a),s.context===null?s.context=a:s.pendingContext=a,s=Pr(x,R),s.payload={element:t},f=f===void 0?null:f,f!==null&&(s.callback=f),t=fs(v,s,R),t!==null&&(Qn(t,v,R,x),pl(t,v,R)),R}function ql(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function jw(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<s?a:s}}function _d(t,s){jw(t,s),(t=t.alternate)&&jw(t,s)}function zR(){return null}var Aw=typeof reportError=="function"?reportError:function(t){console.error(t)};function bd(t){this._internalRoot=t}Dl.prototype.render=bd.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(r(409));$l(t,s,null,null)},Dl.prototype.unmount=bd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;ei(function(){$l(null,t,null,null)}),s[jr]=null}};function Dl(t){this._internalRoot=t}Dl.prototype.unstable_scheduleHydration=function(t){if(t){var s=kr();t={blockedOn:null,target:t,priority:s};for(var a=0;a<lr.length&&s!==0&&s<lr[a].priority;a++);lr.splice(a,0,t),a===0&&No(t)}};function Sd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Fl(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Iw(){}function BR(t,s,a,f,v){if(v){if(typeof f=="function"){var x=f;f=function(){var ae=ql(R);x.call(ae)}}var R=Rw(s,f,t,0,null,!1,!1,"",Iw);return t._reactRootContainer=R,t[jr]=R.current,$o(t.nodeType===8?t.parentNode:t),ei(),R}for(;v=t.lastChild;)t.removeChild(v);if(typeof f=="function"){var F=f;f=function(){var ae=ql(X);F.call(ae)}}var X=xd(t,0,!1,null,null,!1,!1,"",Iw);return t._reactRootContainer=X,t[jr]=X.current,$o(t.nodeType===8?t.parentNode:t),ei(function(){$l(s,X,a,f)}),X}function zl(t,s,a,f,v){var x=a._reactRootContainer;if(x){var R=x;if(typeof v=="function"){var F=v;v=function(){var X=ql(R);F.call(X)}}$l(s,R,t,v)}else R=BR(a,s,t,v,f);return ql(R)}Xt=function(t){switch(t.tag){case 3:var s=t.stateNode;if(s.current.memoizedState.isDehydrated){var a=gn(s.pendingLanes);a!==0&&(_i(s,a|1),ln(s,nt()),(Ue&6)===0&&(Vi=nt()+500,cs()))}break;case 13:ei(function(){var f=Or(t,1);if(f!==null){var v=Jt();Qn(f,t,1,v)}}),_d(t,1)}},ko=function(t){if(t.tag===13){var s=Or(t,134217728);if(s!==null){var a=Jt();Qn(s,t,134217728,a)}_d(t,134217728)}},bi=function(t){if(t.tag===13){var s=gs(t),a=Or(t,s);if(a!==null){var f=Jt();Qn(a,t,s,f)}_d(t,s)}},kr=function(){return He},ns=function(t,s){var a=He;try{return He=t,s()}finally{He=a}},kn=function(t,s,a){switch(s){case"input":if(we(t,a),s=a.name,a.type==="radio"&&s!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<a.length;s++){var f=a[s];if(f!==t&&f.form===t.form){var v=sl(f);if(!v)throw Error(r(90));ve(f),we(f,v)}}}break;case"textarea":Je(t,a);break;case"select":s=a.value,s!=null&&pt(t,!!a.multiple,s,!1)}},gi=pd,Vr=ei;var UR={usingClientEntryPoint:!1,Events:[Fo,Mi,sl,vr,Wr,pd]},ea={findFiberByHostInstance:Vs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},HR={bundleType:ea.bundleType,version:ea.version,rendererPackageName:ea.rendererPackageName,rendererConfig:ea.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Rt(t),t===null?null:t.stateNode},findFiberByHostInstance:ea.findFiberByHostInstance||zR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bl.isDisabled&&Bl.supportsFiber)try{or=Bl.inject(HR),kt=Bl}catch{}}return un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=UR,un.createPortal=function(t,s){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Sd(s))throw Error(r(200));return FR(t,s,null,a)},un.createRoot=function(t,s){if(!Sd(t))throw Error(r(299));var a=!1,f="",v=Aw;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(f=s.identifierPrefix),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=xd(t,1,!1,null,null,a,!1,f,v),t[jr]=s.current,$o(t.nodeType===8?t.parentNode:t),new bd(s)},un.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=Rt(s),t=t===null?null:t.stateNode,t},un.flushSync=function(t){return ei(t)},un.hydrate=function(t,s,a){if(!Fl(s))throw Error(r(200));return zl(null,t,s,!0,a)},un.hydrateRoot=function(t,s,a){if(!Sd(t))throw Error(r(405));var f=a!=null&&a.hydratedSources||null,v=!1,x="",R=Aw;if(a!=null&&(a.unstable_strictMode===!0&&(v=!0),a.identifierPrefix!==void 0&&(x=a.identifierPrefix),a.onRecoverableError!==void 0&&(R=a.onRecoverableError)),s=Rw(s,null,t,1,a??null,v,!1,x,R),t[jr]=s.current,$o(t),f)for(t=0;t<f.length;t++)a=f[t],v=a._getVersion,v=v(a._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[a,v]:s.mutableSourceEagerHydrationData.push(a,v);return new Dl(s)},un.render=function(t,s,a){if(!Fl(s))throw Error(r(200));return zl(null,t,s,!1,a)},un.unmountComponentAtNode=function(t){if(!Fl(t))throw Error(r(40));return t._reactRootContainer?(ei(function(){zl(null,null,t,!1,function(){t._reactRootContainer=null,t[jr]=null})}),!0):!1},un.unstable_batchedUpdates=pd,un.unstable_renderSubtreeIntoContainer=function(t,s,a,f){if(!Fl(a))throw Error(r(200));if(t==null||t._reactInternals===void 0)throw Error(r(38));return zl(t,s,a,!1,f)},un.version="18.3.1-next-f1338f8080-20240426",un}var Fw;function zE(){if(Fw)return Nd.exports;Fw=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(n){console.error(n)}}return e(),Nd.exports=QR(),Nd.exports}var zw;function ZR(){if(zw)return Hl;zw=1;var e=zE();return Hl.createRoot=e.createRoot,Hl.hydrateRoot=e.hydrateRoot,Hl}var JR=ZR(),j=ka();const ue=$v(j);function Dt(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let r=0,i;r<e.length;r++)(i=Dt(e[r]))!==""&&(n+=(n&&" ")+i);else for(let r in e)e[r]&&(n+=(n&&" ")+r);return n}var Rd={exports:{}},jd={},Ad={exports:{}},Id={};/**
40
+ `+x.stack}return{value:t,source:s,stack:v,digest:null}}function Yc(t,s,a){return{value:t,source:null,stack:a??null,digest:s??null}}function Kc(t,s){try{console.error(s.value)}catch(a){setTimeout(function(){throw a})}}var _R=typeof WeakMap=="function"?WeakMap:Map;function B0(t,s,a){a=Pr(-1,a),a.tag=3,a.payload={element:null};var f=s.value;return a.callback=function(){Rl||(Rl=!0,cd=f),Kc(t,s)},a}function U0(t,s,a){a=Pr(-1,a),a.tag=3;var f=t.type.getDerivedStateFromError;if(typeof f=="function"){var v=s.value;a.payload=function(){return f(v)},a.callback=function(){Kc(t,s)}}var x=t.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(a.callback=function(){Kc(t,s),typeof f!="function"&&(ps===null?ps=new Set([this]):ps.add(this));var R=s.stack;this.componentDidCatch(s.value,{componentStack:R!==null?R:""})}),a}function H0(t,s,a){var f=t.pingCache;if(f===null){f=t.pingCache=new _R;var v=new Set;f.set(s,v)}else v=f.get(s),v===void 0&&(v=new Set,f.set(s,v));v.has(a)||(v.add(a),t=PR.bind(null,t,s,a),s.then(t,t))}function W0(t){do{var s;if((s=t.tag===13)&&(s=t.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return t;t=t.return}while(t!==null);return null}function V0(t,s,a,f,v){return(t.mode&1)===0?(t===s?t.flags|=65536:(t.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(s=Pr(-1,1),s.tag=2,fs(a,s,1))),a.lanes|=1),t):(t.flags|=65536,t.lanes=v,t)}var bR=T.ReactCurrentOwner,on=!1;function Zt(t,s,a,f){s.child=t===null?f0(s,null,a,f):Di(s,t.child,a,f)}function G0(t,s,a,f,v){a=a.render;var x=s.ref;return zi(s,v),f=Fc(t,s,a,f,x,v),a=zc(),t!==null&&!on?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~v,Lr(t,s,v)):(at&&a&&Sc(s),s.flags|=1,Zt(t,s,f,v),s.child)}function Y0(t,s,a,f,v){if(t===null){var x=a.type;return typeof x=="function"&&!vd(x)&&x.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(s.tag=15,s.type=x,K0(t,s,x,f,v)):(t=Pl(a.type,null,f,s,s.mode,v),t.ref=s.ref,t.return=s,s.child=t)}if(x=t.child,(t.lanes&v)===0){var R=x.memoizedProps;if(a=a.compare,a=a!==null?a:Oo,a(R,f)&&t.ref===s.ref)return Lr(t,s,v)}return s.flags|=1,t=ys(x,f),t.ref=s.ref,t.return=s,s.child=t}function K0(t,s,a,f,v){if(t!==null){var x=t.memoizedProps;if(Oo(x,f)&&t.ref===s.ref)if(on=!1,s.pendingProps=f=x,(t.lanes&v)!==0)(t.flags&131072)!==0&&(on=!0);else return s.lanes=t.lanes,Lr(t,s,v)}return Xc(t,s,a,f,v)}function X0(t,s,a){var f=s.pendingProps,v=f.children,x=t!==null?t.memoizedState:null;if(f.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},tt(Wi,_n),_n|=a;else{if((a&1073741824)===0)return t=x!==null?x.baseLanes|a:a,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:t,cachePool:null,transitions:null},s.updateQueue=null,tt(Wi,_n),_n|=t,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},f=x!==null?x.baseLanes:a,tt(Wi,_n),_n|=f}else x!==null?(f=x.baseLanes|a,s.memoizedState=null):f=a,tt(Wi,_n),_n|=f;return Zt(t,s,v,a),s.child}function Q0(t,s){var a=s.ref;(t===null&&a!==null||t!==null&&t.ref!==a)&&(s.flags|=512,s.flags|=2097152)}function Xc(t,s,a,f,v){var x=sn(a)?Gs:Ht.current;return x=Pi(s,x),zi(s,v),a=Fc(t,s,a,f,x,v),f=zc(),t!==null&&!on?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~v,Lr(t,s,v)):(at&&f&&Sc(s),s.flags|=1,Zt(t,s,a,v),s.child)}function Z0(t,s,a,f,v){if(sn(a)){var x=!0;ol(s)}else x=!1;if(zi(s,v),s.stateNode===null)kl(t,s),F0(s,a,f),Gc(s,a,f,v),f=!0;else if(t===null){var R=s.stateNode,F=s.memoizedProps;R.props=F;var X=R.context,ae=a.contextType;typeof ae=="object"&&ae!==null?ae=An(ae):(ae=sn(a)?Gs:Ht.current,ae=Pi(s,ae));var pe=a.getDerivedStateFromProps,me=typeof pe=="function"||typeof R.getSnapshotBeforeUpdate=="function";me||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(F!==f||X!==ae)&&z0(s,R,f,ae),ds=!1;var he=s.memoizedState;R.state=he,ml(s,f,R,v),X=s.memoizedState,F!==f||he!==X||rn.current||ds?(typeof pe=="function"&&(Vc(s,a,pe,f),X=s.memoizedState),(F=ds||D0(s,a,F,f,he,X,ae))?(me||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount()),typeof R.componentDidMount=="function"&&(s.flags|=4194308)):(typeof R.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=f,s.memoizedState=X),R.props=f,R.state=X,R.context=ae,f=F):(typeof R.componentDidMount=="function"&&(s.flags|=4194308),f=!1)}else{R=s.stateNode,p0(t,s),F=s.memoizedProps,ae=s.type===s.elementType?F:Yn(s.type,F),R.props=ae,me=s.pendingProps,he=R.context,X=a.contextType,typeof X=="object"&&X!==null?X=An(X):(X=sn(a)?Gs:Ht.current,X=Pi(s,X));var be=a.getDerivedStateFromProps;(pe=typeof be=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(F!==me||he!==X)&&z0(s,R,f,X),ds=!1,he=s.memoizedState,R.state=he,ml(s,f,R,v);var Ne=s.memoizedState;F!==me||he!==Ne||rn.current||ds?(typeof be=="function"&&(Vc(s,a,be,f),Ne=s.memoizedState),(ae=ds||D0(s,a,ae,f,he,Ne,X)||!1)?(pe||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(f,Ne,X),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(f,Ne,X)),typeof R.componentDidUpdate=="function"&&(s.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof R.componentDidUpdate!="function"||F===t.memoizedProps&&he===t.memoizedState||(s.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||F===t.memoizedProps&&he===t.memoizedState||(s.flags|=1024),s.memoizedProps=f,s.memoizedState=Ne),R.props=f,R.state=Ne,R.context=X,f=ae):(typeof R.componentDidUpdate!="function"||F===t.memoizedProps&&he===t.memoizedState||(s.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||F===t.memoizedProps&&he===t.memoizedState||(s.flags|=1024),f=!1)}return Qc(t,s,a,f,x,v)}function Qc(t,s,a,f,v,x){Q0(t,s);var R=(s.flags&128)!==0;if(!f&&!R)return v&&r0(s,a,!1),Lr(t,s,x);f=s.stateNode,bR.current=s;var F=R&&typeof a.getDerivedStateFromError!="function"?null:f.render();return s.flags|=1,t!==null&&R?(s.child=Di(s,t.child,null,x),s.child=Di(s,null,F,x)):Zt(t,s,F,x),s.memoizedState=f.state,v&&r0(s,a,!0),s.child}function J0(t){var s=t.stateNode;s.pendingContext?t0(t,s.pendingContext,s.pendingContext!==s.context):s.context&&t0(t,s.context,!1),Oc(t,s.containerInfo)}function ew(t,s,a,f,v){return qi(),Cc(v),s.flags|=256,Zt(t,s,a,f),s.child}var Zc={dehydrated:null,treeContext:null,retryLane:0};function Jc(t){return{baseLanes:t,cachePool:null,transitions:null}}function tw(t,s,a){var f=s.pendingProps,v=ft.current,x=!1,R=(s.flags&128)!==0,F;if((F=R)||(F=t!==null&&t.memoizedState===null?!1:(v&2)!==0),F?(x=!0,s.flags&=-129):(t===null||t.memoizedState!==null)&&(v|=1),tt(ft,v&1),t===null)return Nc(s),t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((s.mode&1)===0?s.lanes=1:t.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(R=f.children,t=f.fallback,x?(f=s.mode,x=s.child,R={mode:"hidden",children:R},(f&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=R):x=Ll(R,f,0,null),t=ri(t,f,a,null),x.return=s,t.return=s,x.sibling=t,s.child=x,s.child.memoizedState=Jc(a),s.memoizedState=Zc,t):ed(s,R));if(v=t.memoizedState,v!==null&&(F=v.dehydrated,F!==null))return SR(t,s,R,f,F,v,a);if(x){x=f.fallback,R=s.mode,v=t.child,F=v.sibling;var X={mode:"hidden",children:f.children};return(R&1)===0&&s.child!==v?(f=s.child,f.childLanes=0,f.pendingProps=X,s.deletions=null):(f=ys(v,X),f.subtreeFlags=v.subtreeFlags&14680064),F!==null?x=ys(F,x):(x=ri(x,R,a,null),x.flags|=2),x.return=s,f.return=s,f.sibling=x,s.child=f,f=x,x=s.child,R=t.child.memoizedState,R=R===null?Jc(a):{baseLanes:R.baseLanes|a,cachePool:null,transitions:R.transitions},x.memoizedState=R,x.childLanes=t.childLanes&~a,s.memoizedState=Zc,f}return x=t.child,t=x.sibling,f=ys(x,{mode:"visible",children:f.children}),(s.mode&1)===0&&(f.lanes=a),f.return=s,f.sibling=null,t!==null&&(a=s.deletions,a===null?(s.deletions=[t],s.flags|=16):a.push(t)),s.child=f,s.memoizedState=null,f}function ed(t,s){return s=Ll({mode:"visible",children:s},t.mode,0,null),s.return=t,t.child=s}function Sl(t,s,a,f){return f!==null&&Cc(f),Di(s,t.child,null,a),t=ed(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function SR(t,s,a,f,v,x,R){if(a)return s.flags&256?(s.flags&=-257,f=Yc(Error(r(422))),Sl(t,s,R,f)):s.memoizedState!==null?(s.child=t.child,s.flags|=128,null):(x=f.fallback,v=s.mode,f=Ll({mode:"visible",children:f.children},v,0,null),x=ri(x,v,R,null),x.flags|=2,f.return=s,x.return=s,f.sibling=x,s.child=f,(s.mode&1)!==0&&Di(s,t.child,null,R),s.child.memoizedState=Jc(R),s.memoizedState=Zc,x);if((s.mode&1)===0)return Sl(t,s,R,null);if(v.data==="$!"){if(f=v.nextSibling&&v.nextSibling.dataset,f)var F=f.dgst;return f=F,x=Error(r(419)),f=Yc(x,f,void 0),Sl(t,s,R,f)}if(F=(R&t.childLanes)!==0,on||F){if(f=At,f!==null){switch(R&-R){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&(f.suspendedLanes|R))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Or(t,v),Qn(f,t,v,-1))}return gd(),f=Yc(Error(r(421))),Sl(t,s,R,f)}return v.data==="$?"?(s.flags|=128,s.child=t.child,s=LR.bind(null,t),v._reactRetry=s,null):(t=x.treeContext,xn=as(v.nextSibling),wn=s,at=!0,Gn=null,t!==null&&(Rn[jn++]=Ir,Rn[jn++]=Mr,Rn[jn++]=Ys,Ir=t.id,Mr=t.overflow,Ys=s),s=ed(s,f.children),s.flags|=4096,s)}function nw(t,s,a){t.lanes|=s;var f=t.alternate;f!==null&&(f.lanes|=s),Ac(t.return,s,a)}function td(t,s,a,f,v){var x=t.memoizedState;x===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:f,tail:a,tailMode:v}:(x.isBackwards=s,x.rendering=null,x.renderingStartTime=0,x.last=f,x.tail=a,x.tailMode=v)}function rw(t,s,a){var f=s.pendingProps,v=f.revealOrder,x=f.tail;if(Zt(t,s,f.children,a),f=ft.current,(f&2)!==0)f=f&1|2,s.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&nw(t,a,s);else if(t.tag===19)nw(t,a,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}f&=1}if(tt(ft,f),(s.mode&1)===0)s.memoizedState=null;else switch(v){case"forwards":for(a=s.child,v=null;a!==null;)t=a.alternate,t!==null&&gl(t)===null&&(v=a),a=a.sibling;a=v,a===null?(v=s.child,s.child=null):(v=a.sibling,a.sibling=null),td(s,!1,v,a,x);break;case"backwards":for(a=null,v=s.child,s.child=null;v!==null;){if(t=v.alternate,t!==null&&gl(t)===null){s.child=v;break}t=v.sibling,v.sibling=a,a=v,v=t}td(s,!0,a,null,x);break;case"together":td(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function kl(t,s){(s.mode&1)===0&&t!==null&&(t.alternate=null,s.alternate=null,s.flags|=2)}function Lr(t,s,a){if(t!==null&&(s.dependencies=t.dependencies),Js|=s.lanes,(a&s.childLanes)===0)return null;if(t!==null&&s.child!==t.child)throw Error(r(153));if(s.child!==null){for(t=s.child,a=ys(t,t.pendingProps),s.child=a,a.return=s;t.sibling!==null;)t=t.sibling,a=a.sibling=ys(t,t.pendingProps),a.return=s;a.sibling=null}return s.child}function kR(t,s,a){switch(s.tag){case 3:J0(s),qi();break;case 5:v0(s);break;case 1:sn(s.type)&&ol(s);break;case 4:Oc(s,s.stateNode.containerInfo);break;case 10:var f=s.type._context,v=s.memoizedProps.value;tt(fl,f._currentValue),f._currentValue=v;break;case 13:if(f=s.memoizedState,f!==null)return f.dehydrated!==null?(tt(ft,ft.current&1),s.flags|=128,null):(a&s.child.childLanes)!==0?tw(t,s,a):(tt(ft,ft.current&1),t=Lr(t,s,a),t!==null?t.sibling:null);tt(ft,ft.current&1);break;case 19:if(f=(a&s.childLanes)!==0,(t.flags&128)!==0){if(f)return rw(t,s,a);s.flags|=128}if(v=s.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),tt(ft,ft.current),f)break;return null;case 22:case 23:return s.lanes=0,X0(t,s,a)}return Lr(t,s,a)}var sw,nd,iw,ow;sw=function(t,s){for(var a=s.child;a!==null;){if(a.tag===5||a.tag===6)t.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},nd=function(){},iw=function(t,s,a,f){var v=t.memoizedProps;if(v!==f){t=s.stateNode,Qs(cr.current);var x=null;switch(a){case"input":v=ye(t,v),f=ye(t,f),x=[];break;case"select":v=Z({},v,{value:void 0}),f=Z({},f,{value:void 0}),x=[];break;case"textarea":v=Ze(t,v),f=Ze(t,f),x=[];break;default:typeof v.onClick!="function"&&typeof f.onClick=="function"&&(t.onclick=rl)}Yt(a,f);var R;a=null;for(ae in v)if(!f.hasOwnProperty(ae)&&v.hasOwnProperty(ae)&&v[ae]!=null)if(ae==="style"){var F=v[ae];for(R in F)F.hasOwnProperty(R)&&(a||(a={}),a[R]="")}else ae!=="dangerouslySetInnerHTML"&&ae!=="children"&&ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&ae!=="autoFocus"&&(o.hasOwnProperty(ae)?x||(x=[]):(x=x||[]).push(ae,null));for(ae in f){var X=f[ae];if(F=v!=null?v[ae]:void 0,f.hasOwnProperty(ae)&&X!==F&&(X!=null||F!=null))if(ae==="style")if(F){for(R in F)!F.hasOwnProperty(R)||X&&X.hasOwnProperty(R)||(a||(a={}),a[R]="");for(R in X)X.hasOwnProperty(R)&&F[R]!==X[R]&&(a||(a={}),a[R]=X[R])}else a||(x||(x=[]),x.push(ae,a)),a=X;else ae==="dangerouslySetInnerHTML"?(X=X?X.__html:void 0,F=F?F.__html:void 0,X!=null&&F!==X&&(x=x||[]).push(ae,X)):ae==="children"?typeof X!="string"&&typeof X!="number"||(x=x||[]).push(ae,""+X):ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&(o.hasOwnProperty(ae)?(X!=null&&ae==="onScroll"&&rt("scroll",t),x||F===X||(x=[])):(x=x||[]).push(ae,X))}a&&(x=x||[]).push("style",a);var ae=x;(s.updateQueue=ae)&&(s.flags|=4)}},ow=function(t,s,a,f){a!==f&&(s.flags|=4)};function Ko(t,s){if(!at)switch(t.tailMode){case"hidden":s=t.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var f=null;a!==null;)a.alternate!==null&&(f=a),a=a.sibling;f===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:f.sibling=null}}function Vt(t){var s=t.alternate!==null&&t.alternate.child===t.child,a=0,f=0;if(s)for(var v=t.child;v!==null;)a|=v.lanes|v.childLanes,f|=v.subtreeFlags&14680064,f|=v.flags&14680064,v.return=t,v=v.sibling;else for(v=t.child;v!==null;)a|=v.lanes|v.childLanes,f|=v.subtreeFlags,f|=v.flags,v.return=t,v=v.sibling;return t.subtreeFlags|=f,t.childLanes=a,s}function ER(t,s,a){var f=s.pendingProps;switch(kc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vt(s),null;case 1:return sn(s.type)&&il(),Vt(s),null;case 3:return f=s.stateNode,Bi(),st(rn),st(Ht),$c(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(t===null||t.child===null)&&(cl(s)?s.flags|=4:t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Gn!==null&&(hd(Gn),Gn=null))),nd(t,s),Vt(s),null;case 5:Pc(s);var v=Qs(Ho.current);if(a=s.type,t!==null&&s.stateNode!=null)iw(t,s,a,f,v),t.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!f){if(s.stateNode===null)throw Error(r(166));return Vt(s),null}if(t=Qs(cr.current),cl(s)){f=s.stateNode,a=s.type;var x=s.memoizedProps;switch(f[ur]=s,f[Do]=x,t=(s.mode&1)!==0,a){case"dialog":rt("cancel",f),rt("close",f);break;case"iframe":case"object":case"embed":rt("load",f);break;case"video":case"audio":for(v=0;v<Lo.length;v++)rt(Lo[v],f);break;case"source":rt("error",f);break;case"img":case"image":case"link":rt("error",f),rt("load",f);break;case"details":rt("toggle",f);break;case"input":ke(f,x),rt("invalid",f);break;case"select":f._wrapperState={wasMultiple:!!x.multiple},rt("invalid",f);break;case"textarea":Fe(f,x),rt("invalid",f)}Yt(a,x),v=null;for(var R in x)if(x.hasOwnProperty(R)){var F=x[R];R==="children"?typeof F=="string"?f.textContent!==F&&(x.suppressHydrationWarning!==!0&&nl(f.textContent,F,t),v=["children",F]):typeof F=="number"&&f.textContent!==""+F&&(x.suppressHydrationWarning!==!0&&nl(f.textContent,F,t),v=["children",""+F]):o.hasOwnProperty(R)&&F!=null&&R==="onScroll"&&rt("scroll",f)}switch(a){case"input":Ce(f),_e(f,x,!0);break;case"textarea":Ce(f),Xe(f);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(f.onclick=rl)}f=v,s.updateQueue=f,f!==null&&(s.flags|=4)}else{R=v.nodeType===9?v:v.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Mt(a)),t==="http://www.w3.org/1999/xhtml"?a==="script"?(t=R.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof f.is=="string"?t=R.createElement(a,{is:f.is}):(t=R.createElement(a),a==="select"&&(R=t,f.multiple?R.multiple=!0:f.size&&(R.size=f.size))):t=R.createElementNS(t,a),t[ur]=s,t[Do]=f,sw(t,s,!1,!1),s.stateNode=t;e:{switch(R=Pt(a,f),a){case"dialog":rt("cancel",t),rt("close",t),v=f;break;case"iframe":case"object":case"embed":rt("load",t),v=f;break;case"video":case"audio":for(v=0;v<Lo.length;v++)rt(Lo[v],t);v=f;break;case"source":rt("error",t),v=f;break;case"img":case"image":case"link":rt("error",t),rt("load",t),v=f;break;case"details":rt("toggle",t),v=f;break;case"input":ke(t,f),v=ye(t,f),rt("invalid",t);break;case"option":v=f;break;case"select":t._wrapperState={wasMultiple:!!f.multiple},v=Z({},f,{value:void 0}),rt("invalid",t);break;case"textarea":Fe(t,f),v=Ze(t,f),rt("invalid",t);break;default:v=f}Yt(a,v),F=v;for(x in F)if(F.hasOwnProperty(x)){var X=F[x];x==="style"?wt(t,X):x==="dangerouslySetInnerHTML"?(X=X?X.__html:void 0,X!=null&&Ot(t,X)):x==="children"?typeof X=="string"?(a!=="textarea"||X!=="")&&Ft(t,X):typeof X=="number"&&Ft(t,""+X):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(o.hasOwnProperty(x)?X!=null&&x==="onScroll"&&rt("scroll",t):X!=null&&E(t,x,X,R))}switch(a){case"input":Ce(t),_e(t,f,!1);break;case"textarea":Ce(t),Xe(t);break;case"option":f.value!=null&&t.setAttribute("value",""+fe(f.value));break;case"select":t.multiple=!!f.multiple,x=f.value,x!=null?pt(t,!!f.multiple,x,!1):f.defaultValue!=null&&pt(t,!!f.multiple,f.defaultValue,!0);break;default:typeof v.onClick=="function"&&(t.onclick=rl)}switch(a){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}}f&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Vt(s),null;case 6:if(t&&s.stateNode!=null)ow(t,s,t.memoizedProps,f);else{if(typeof f!="string"&&s.stateNode===null)throw Error(r(166));if(a=Qs(Ho.current),Qs(cr.current),cl(s)){if(f=s.stateNode,a=s.memoizedProps,f[ur]=s,(x=f.nodeValue!==a)&&(t=wn,t!==null))switch(t.tag){case 3:nl(f.nodeValue,a,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&nl(f.nodeValue,a,(t.mode&1)!==0)}x&&(s.flags|=4)}else f=(a.nodeType===9?a:a.ownerDocument).createTextNode(f),f[ur]=s,s.stateNode=f}return Vt(s),null;case 13:if(st(ft),f=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(at&&xn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)u0(),qi(),s.flags|=98560,x=!1;else if(x=cl(s),f!==null&&f.dehydrated!==null){if(t===null){if(!x)throw Error(r(318));if(x=s.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[ur]=s}else qi(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Vt(s),x=!1}else Gn!==null&&(hd(Gn),Gn=null),x=!0;if(!x)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=a,s):(f=f!==null,f!==(t!==null&&t.memoizedState!==null)&&f&&(s.child.flags|=8192,(s.mode&1)!==0&&(t===null||(ft.current&1)!==0?Nt===0&&(Nt=3):gd())),s.updateQueue!==null&&(s.flags|=4),Vt(s),null);case 4:return Bi(),nd(t,s),t===null&&$o(s.stateNode.containerInfo),Vt(s),null;case 10:return jc(s.type._context),Vt(s),null;case 17:return sn(s.type)&&il(),Vt(s),null;case 19:if(st(ft),x=s.memoizedState,x===null)return Vt(s),null;if(f=(s.flags&128)!==0,R=x.rendering,R===null)if(f)Ko(x,!1);else{if(Nt!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(R=gl(t),R!==null){for(s.flags|=128,Ko(x,!1),f=R.updateQueue,f!==null&&(s.updateQueue=f,s.flags|=4),s.subtreeFlags=0,f=a,a=s.child;a!==null;)x=a,t=f,x.flags&=14680066,R=x.alternate,R===null?(x.childLanes=0,x.lanes=t,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=R.childLanes,x.lanes=R.lanes,x.child=R.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=R.memoizedProps,x.memoizedState=R.memoizedState,x.updateQueue=R.updateQueue,x.type=R.type,t=R.dependencies,x.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),a=a.sibling;return tt(ft,ft.current&1|2),s.child}t=t.sibling}x.tail!==null&&nt()>Vi&&(s.flags|=128,f=!0,Ko(x,!1),s.lanes=4194304)}else{if(!f)if(t=gl(R),t!==null){if(s.flags|=128,f=!0,a=t.updateQueue,a!==null&&(s.updateQueue=a,s.flags|=4),Ko(x,!0),x.tail===null&&x.tailMode==="hidden"&&!R.alternate&&!at)return Vt(s),null}else 2*nt()-x.renderingStartTime>Vi&&a!==1073741824&&(s.flags|=128,f=!0,Ko(x,!1),s.lanes=4194304);x.isBackwards?(R.sibling=s.child,s.child=R):(a=x.last,a!==null?a.sibling=R:s.child=R,x.last=R)}return x.tail!==null?(s=x.tail,x.rendering=s,x.tail=s.sibling,x.renderingStartTime=nt(),s.sibling=null,a=ft.current,tt(ft,f?a&1|2:a&1),s):(Vt(s),null);case 22:case 23:return md(),f=s.memoizedState!==null,t!==null&&t.memoizedState!==null!==f&&(s.flags|=8192),f&&(s.mode&1)!==0?(_n&1073741824)!==0&&(Vt(s),s.subtreeFlags&6&&(s.flags|=8192)):Vt(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function NR(t,s){switch(kc(s),s.tag){case 1:return sn(s.type)&&il(),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return Bi(),st(rn),st(Ht),$c(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 5:return Pc(s),null;case 13:if(st(ft),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(r(340));qi()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return st(ft),null;case 4:return Bi(),null;case 10:return jc(s.type._context),null;case 22:case 23:return md(),null;case 24:return null;default:return null}}var El=!1,Gt=!1,CR=typeof WeakSet=="function"?WeakSet:Set,Se=null;function Hi(t,s){var a=t.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(f){vt(t,s,f)}else a.current=null}function rd(t,s,a){try{a()}catch(f){vt(t,s,f)}}var aw=!1;function TR(t,s){if(mc=qs,t=Dy(),ac(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var f=a.getSelection&&a.getSelection();if(f&&f.rangeCount!==0){a=f.anchorNode;var v=f.anchorOffset,x=f.focusNode;f=f.focusOffset;try{a.nodeType,x.nodeType}catch{a=null;break e}var R=0,F=-1,X=-1,ae=0,pe=0,me=t,he=null;t:for(;;){for(var be;me!==a||v!==0&&me.nodeType!==3||(F=R+v),me!==x||f!==0&&me.nodeType!==3||(X=R+f),me.nodeType===3&&(R+=me.nodeValue.length),(be=me.firstChild)!==null;)he=me,me=be;for(;;){if(me===t)break t;if(he===a&&++ae===v&&(F=R),he===x&&++pe===f&&(X=R),(be=me.nextSibling)!==null)break;me=he,he=me.parentNode}me=be}a=F===-1||X===-1?null:{start:F,end:X}}else a=null}a=a||{start:0,end:0}}else a=null;for(gc={focusedElem:t,selectionRange:a},qs=!1,Se=s;Se!==null;)if(s=Se,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,Se=t;else for(;Se!==null;){s=Se;try{var Ne=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Ne!==null){var Te=Ne.memoizedProps,xt=Ne.memoizedState,se=s.stateNode,ee=se.getSnapshotBeforeUpdate(s.elementType===s.type?Te:Yn(s.type,Te),xt);se.__reactInternalSnapshotBeforeUpdate=ee}break;case 3:var ie=s.stateNode.containerInfo;ie.nodeType===1?ie.textContent="":ie.nodeType===9&&ie.documentElement&&ie.removeChild(ie.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ge){vt(s,s.return,ge)}if(t=s.sibling,t!==null){t.return=s.return,Se=t;break}Se=s.return}return Ne=aw,aw=!1,Ne}function Xo(t,s,a){var f=s.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&t)===t){var x=v.destroy;v.destroy=void 0,x!==void 0&&rd(s,a,x)}v=v.next}while(v!==f)}}function Nl(t,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&t)===t){var f=a.create;a.destroy=f()}a=a.next}while(a!==s)}}function sd(t){var s=t.ref;if(s!==null){var a=t.stateNode;switch(t.tag){case 5:t=a;break;default:t=a}typeof s=="function"?s(t):s.current=t}}function lw(t){var s=t.alternate;s!==null&&(t.alternate=null,lw(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&(delete s[ur],delete s[Do],delete s[xc],delete s[cR],delete s[dR])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function uw(t){return t.tag===5||t.tag===3||t.tag===4}function cw(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||uw(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function id(t,s,a){var f=t.tag;if(f===5||f===6)t=t.stateNode,s?a.nodeType===8?a.parentNode.insertBefore(t,s):a.insertBefore(t,s):(a.nodeType===8?(s=a.parentNode,s.insertBefore(t,a)):(s=a,s.appendChild(t)),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=rl));else if(f!==4&&(t=t.child,t!==null))for(id(t,s,a),t=t.sibling;t!==null;)id(t,s,a),t=t.sibling}function od(t,s,a){var f=t.tag;if(f===5||f===6)t=t.stateNode,s?a.insertBefore(t,s):a.appendChild(t);else if(f!==4&&(t=t.child,t!==null))for(od(t,s,a),t=t.sibling;t!==null;)od(t,s,a),t=t.sibling}var Lt=null,Kn=!1;function hs(t,s,a){for(a=a.child;a!==null;)dw(t,s,a),a=a.sibling}function dw(t,s,a){if(kt&&typeof kt.onCommitFiberUnmount=="function")try{kt.onCommitFiberUnmount(or,a)}catch{}switch(a.tag){case 5:Gt||Hi(a,s);case 6:var f=Lt,v=Kn;Lt=null,hs(t,s,a),Lt=f,Kn=v,Lt!==null&&(Kn?(t=Lt,a=a.stateNode,t.nodeType===8?t.parentNode.removeChild(a):t.removeChild(a)):Lt.removeChild(a.stateNode));break;case 18:Lt!==null&&(Kn?(t=Lt,a=a.stateNode,t.nodeType===8?wc(t.parentNode,a):t.nodeType===1&&wc(t,a),nn(t)):wc(Lt,a.stateNode));break;case 4:f=Lt,v=Kn,Lt=a.stateNode.containerInfo,Kn=!0,hs(t,s,a),Lt=f,Kn=v;break;case 0:case 11:case 14:case 15:if(!Gt&&(f=a.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){v=f=f.next;do{var x=v,R=x.destroy;x=x.tag,R!==void 0&&((x&2)!==0||(x&4)!==0)&&rd(a,s,R),v=v.next}while(v!==f)}hs(t,s,a);break;case 1:if(!Gt&&(Hi(a,s),f=a.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=a.memoizedProps,f.state=a.memoizedState,f.componentWillUnmount()}catch(F){vt(a,s,F)}hs(t,s,a);break;case 21:hs(t,s,a);break;case 22:a.mode&1?(Gt=(f=Gt)||a.memoizedState!==null,hs(t,s,a),Gt=f):hs(t,s,a);break;default:hs(t,s,a)}}function fw(t){var s=t.updateQueue;if(s!==null){t.updateQueue=null;var a=t.stateNode;a===null&&(a=t.stateNode=new CR),s.forEach(function(f){var v=$R.bind(null,t,f);a.has(f)||(a.add(f),f.then(v,v))})}}function Xn(t,s){var a=s.deletions;if(a!==null)for(var f=0;f<a.length;f++){var v=a[f];try{var x=t,R=s,F=R;e:for(;F!==null;){switch(F.tag){case 5:Lt=F.stateNode,Kn=!1;break e;case 3:Lt=F.stateNode.containerInfo,Kn=!0;break e;case 4:Lt=F.stateNode.containerInfo,Kn=!0;break e}F=F.return}if(Lt===null)throw Error(r(160));dw(x,R,v),Lt=null,Kn=!1;var X=v.alternate;X!==null&&(X.return=null),v.return=null}catch(ae){vt(v,s,ae)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)hw(s,t),s=s.sibling}function hw(t,s){var a=t.alternate,f=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Xn(s,t),fr(t),f&4){try{Xo(3,t,t.return),Nl(3,t)}catch(Te){vt(t,t.return,Te)}try{Xo(5,t,t.return)}catch(Te){vt(t,t.return,Te)}}break;case 1:Xn(s,t),fr(t),f&512&&a!==null&&Hi(a,a.return);break;case 5:if(Xn(s,t),fr(t),f&512&&a!==null&&Hi(a,a.return),t.flags&32){var v=t.stateNode;try{Ft(v,"")}catch(Te){vt(t,t.return,Te)}}if(f&4&&(v=t.stateNode,v!=null)){var x=t.memoizedProps,R=a!==null?a.memoizedProps:x,F=t.type,X=t.updateQueue;if(t.updateQueue=null,X!==null)try{F==="input"&&x.type==="radio"&&x.name!=null&&Ye(v,x),Pt(F,R);var ae=Pt(F,x);for(R=0;R<X.length;R+=2){var pe=X[R],me=X[R+1];pe==="style"?wt(v,me):pe==="dangerouslySetInnerHTML"?Ot(v,me):pe==="children"?Ft(v,me):E(v,pe,me,ae)}switch(F){case"input":we(v,x);break;case"textarea":Je(v,x);break;case"select":var he=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!x.multiple;var be=x.value;be!=null?pt(v,!!x.multiple,be,!1):he!==!!x.multiple&&(x.defaultValue!=null?pt(v,!!x.multiple,x.defaultValue,!0):pt(v,!!x.multiple,x.multiple?[]:"",!1))}v[Do]=x}catch(Te){vt(t,t.return,Te)}}break;case 6:if(Xn(s,t),fr(t),f&4){if(t.stateNode===null)throw Error(r(162));v=t.stateNode,x=t.memoizedProps;try{v.nodeValue=x}catch(Te){vt(t,t.return,Te)}}break;case 3:if(Xn(s,t),fr(t),f&4&&a!==null&&a.memoizedState.isDehydrated)try{nn(s.containerInfo)}catch(Te){vt(t,t.return,Te)}break;case 4:Xn(s,t),fr(t);break;case 13:Xn(s,t),fr(t),v=t.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(ud=nt())),f&4&&fw(t);break;case 22:if(pe=a!==null&&a.memoizedState!==null,t.mode&1?(Gt=(ae=Gt)||pe,Xn(s,t),Gt=ae):Xn(s,t),fr(t),f&8192){if(ae=t.memoizedState!==null,(t.stateNode.isHidden=ae)&&!pe&&(t.mode&1)!==0)for(Se=t,pe=t.child;pe!==null;){for(me=Se=pe;Se!==null;){switch(he=Se,be=he.child,he.tag){case 0:case 11:case 14:case 15:Xo(4,he,he.return);break;case 1:Hi(he,he.return);var Ne=he.stateNode;if(typeof Ne.componentWillUnmount=="function"){f=he,a=he.return;try{s=f,Ne.props=s.memoizedProps,Ne.state=s.memoizedState,Ne.componentWillUnmount()}catch(Te){vt(f,a,Te)}}break;case 5:Hi(he,he.return);break;case 22:if(he.memoizedState!==null){gw(me);continue}}be!==null?(be.return=he,Se=be):gw(me)}pe=pe.sibling}e:for(pe=null,me=t;;){if(me.tag===5){if(pe===null){pe=me;try{v=me.stateNode,ae?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(F=me.stateNode,X=me.memoizedProps.style,R=X!=null&&X.hasOwnProperty("display")?X.display:null,F.style.display=mt("display",R))}catch(Te){vt(t,t.return,Te)}}}else if(me.tag===6){if(pe===null)try{me.stateNode.nodeValue=ae?"":me.memoizedProps}catch(Te){vt(t,t.return,Te)}}else if((me.tag!==22&&me.tag!==23||me.memoizedState===null||me===t)&&me.child!==null){me.child.return=me,me=me.child;continue}if(me===t)break e;for(;me.sibling===null;){if(me.return===null||me.return===t)break e;pe===me&&(pe=null),me=me.return}pe===me&&(pe=null),me.sibling.return=me.return,me=me.sibling}}break;case 19:Xn(s,t),fr(t),f&4&&fw(t);break;case 21:break;default:Xn(s,t),fr(t)}}function fr(t){var s=t.flags;if(s&2){try{e:{for(var a=t.return;a!==null;){if(uw(a)){var f=a;break e}a=a.return}throw Error(r(160))}switch(f.tag){case 5:var v=f.stateNode;f.flags&32&&(Ft(v,""),f.flags&=-33);var x=cw(t);od(t,x,v);break;case 3:case 4:var R=f.stateNode.containerInfo,F=cw(t);id(t,F,R);break;default:throw Error(r(161))}}catch(X){vt(t,t.return,X)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function RR(t,s,a){Se=t,pw(t)}function pw(t,s,a){for(var f=(t.mode&1)!==0;Se!==null;){var v=Se,x=v.child;if(v.tag===22&&f){var R=v.memoizedState!==null||El;if(!R){var F=v.alternate,X=F!==null&&F.memoizedState!==null||Gt;F=El;var ae=Gt;if(El=R,(Gt=X)&&!ae)for(Se=v;Se!==null;)R=Se,X=R.child,R.tag===22&&R.memoizedState!==null?vw(v):X!==null?(X.return=R,Se=X):vw(v);for(;x!==null;)Se=x,pw(x),x=x.sibling;Se=v,El=F,Gt=ae}mw(t)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,Se=x):mw(t)}}function mw(t){for(;Se!==null;){var s=Se;if((s.flags&8772)!==0){var a=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Gt||Nl(5,s);break;case 1:var f=s.stateNode;if(s.flags&4&&!Gt)if(a===null)f.componentDidMount();else{var v=s.elementType===s.type?a.memoizedProps:Yn(s.type,a.memoizedProps);f.componentDidUpdate(v,a.memoizedState,f.__reactInternalSnapshotBeforeUpdate)}var x=s.updateQueue;x!==null&&g0(s,x,f);break;case 3:var R=s.updateQueue;if(R!==null){if(a=null,s.child!==null)switch(s.child.tag){case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}g0(s,R,a)}break;case 5:var F=s.stateNode;if(a===null&&s.flags&4){a=F;var X=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":X.autoFocus&&a.focus();break;case"img":X.src&&(a.src=X.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var ae=s.alternate;if(ae!==null){var pe=ae.memoizedState;if(pe!==null){var me=pe.dehydrated;me!==null&&nn(me)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Gt||s.flags&512&&sd(s)}catch(he){vt(s,s.return,he)}}if(s===t){Se=null;break}if(a=s.sibling,a!==null){a.return=s.return,Se=a;break}Se=s.return}}function gw(t){for(;Se!==null;){var s=Se;if(s===t){Se=null;break}var a=s.sibling;if(a!==null){a.return=s.return,Se=a;break}Se=s.return}}function vw(t){for(;Se!==null;){var s=Se;try{switch(s.tag){case 0:case 11:case 15:var a=s.return;try{Nl(4,s)}catch(X){vt(s,a,X)}break;case 1:var f=s.stateNode;if(typeof f.componentDidMount=="function"){var v=s.return;try{f.componentDidMount()}catch(X){vt(s,v,X)}}var x=s.return;try{sd(s)}catch(X){vt(s,x,X)}break;case 5:var R=s.return;try{sd(s)}catch(X){vt(s,R,X)}}}catch(X){vt(s,s.return,X)}if(s===t){Se=null;break}var F=s.sibling;if(F!==null){F.return=s.return,Se=F;break}Se=s.return}}var jR=Math.ceil,Cl=T.ReactCurrentDispatcher,ad=T.ReactCurrentOwner,Mn=T.ReactCurrentBatchConfig,Ue=0,At=null,_t=null,$t=0,_n=0,Wi=ls(0),Nt=0,Qo=null,Js=0,Tl=0,ld=0,Zo=null,an=null,ud=0,Vi=1/0,$r=null,Rl=!1,cd=null,ps=null,jl=!1,ms=null,Al=0,Jo=0,dd=null,Il=-1,Ml=0;function Jt(){return(Ue&6)!==0?nt():Il!==-1?Il:Il=nt()}function gs(t){return(t.mode&1)===0?1:(Ue&2)!==0&&$t!==0?$t&-$t:hR.transition!==null?(Ml===0&&(Ml=xi()),Ml):(t=He,t!==0||(t=window.event,t=t===void 0?16:Ba(t.type)),t)}function Qn(t,s,a,f){if(50<Jo)throw Jo=0,dd=null,Error(r(185));ts(t,a,f),((Ue&2)===0||t!==At)&&(t===At&&((Ue&2)===0&&(Tl|=a),Nt===4&&vs(t,$t)),ln(t,f),a===1&&Ue===0&&(s.mode&1)===0&&(Vi=nt()+500,al&&cs()))}function ln(t,s){var a=t.callbackNode;qa(t,s);var f=Ps(t,t===At?$t:0);if(f===0)a!==null&&Kt(a),t.callbackNode=null,t.callbackPriority=0;else if(s=f&-f,t.callbackPriority!==s){if(a!=null&&Kt(a),s===1)t.tag===0?fR(ww.bind(null,t)):s0(ww.bind(null,t)),lR(function(){(Ue&6)===0&&cs()}),a=null;else{switch(Da(f)){case 1:a=Qr;break;case 4:a=Is;break;case 16:a=Zr;break;case 536870912:a=Ms;break;default:a=Zr}a=Cw(a,yw.bind(null,t))}t.callbackPriority=s,t.callbackNode=a}}function yw(t,s){if(Il=-1,Ml=0,(Ue&6)!==0)throw Error(r(327));var a=t.callbackNode;if(Gi()&&t.callbackNode!==a)return null;var f=Ps(t,t===At?$t:0);if(f===0)return null;if((f&30)!==0||(f&t.expiredLanes)!==0||s)s=Ol(t,f);else{s=f;var v=Ue;Ue|=2;var x=_w();(At!==t||$t!==s)&&($r=null,Vi=nt()+500,ti(t,s));do try{MR();break}catch(F){xw(t,F)}while(!0);Rc(),Cl.current=x,Ue=v,_t!==null?s=0:(At=null,$t=0,s=Nt)}if(s!==0){if(s===2&&(v=So(t),v!==0&&(f=v,s=fd(t,v))),s===1)throw a=Qo,ti(t,0),vs(t,f),ln(t,nt()),a;if(s===6)vs(t,f);else{if(v=t.current.alternate,(f&30)===0&&!AR(v)&&(s=Ol(t,f),s===2&&(x=So(t),x!==0&&(f=x,s=fd(t,x))),s===1))throw a=Qo,ti(t,0),vs(t,f),ln(t,nt()),a;switch(t.finishedWork=v,t.finishedLanes=f,s){case 0:case 1:throw Error(r(345));case 2:ni(t,an,$r);break;case 3:if(vs(t,f),(f&130023424)===f&&(s=ud+500-nt(),10<s)){if(Ps(t,0)!==0)break;if(v=t.suspendedLanes,(v&f)!==f){Jt(),t.pingedLanes|=t.suspendedLanes&v;break}t.timeoutHandle=yc(ni.bind(null,t,an,$r),s);break}ni(t,an,$r);break;case 4:if(vs(t,f),(f&4194240)===f)break;for(s=t.eventTimes,v=-1;0<f;){var R=31-gt(f);x=1<<R,R=s[R],R>v&&(v=R),f&=~x}if(f=v,f=nt()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*jR(f/1960))-f,10<f){t.timeoutHandle=yc(ni.bind(null,t,an,$r),f);break}ni(t,an,$r);break;case 5:ni(t,an,$r);break;default:throw Error(r(329))}}}return ln(t,nt()),t.callbackNode===a?yw.bind(null,t):null}function fd(t,s){var a=Zo;return t.current.memoizedState.isDehydrated&&(ti(t,s).flags|=256),t=Ol(t,s),t!==2&&(s=an,an=a,s!==null&&hd(s)),t}function hd(t){an===null?an=t:an.push.apply(an,t)}function AR(t){for(var s=t;;){if(s.flags&16384){var a=s.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var f=0;f<a.length;f++){var v=a[f],x=v.getSnapshot;v=v.value;try{if(!Vn(x(),v))return!1}catch{return!1}}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function vs(t,s){for(s&=~ld,s&=~Tl,t.suspendedLanes|=s,t.pingedLanes&=~s,t=t.expirationTimes;0<s;){var a=31-gt(s),f=1<<a;t[a]=-1,s&=~f}}function ww(t){if((Ue&6)!==0)throw Error(r(327));Gi();var s=Ps(t,0);if((s&1)===0)return ln(t,nt()),null;var a=Ol(t,s);if(t.tag!==0&&a===2){var f=So(t);f!==0&&(s=f,a=fd(t,f))}if(a===1)throw a=Qo,ti(t,0),vs(t,s),ln(t,nt()),a;if(a===6)throw Error(r(345));return t.finishedWork=t.current.alternate,t.finishedLanes=s,ni(t,an,$r),ln(t,nt()),null}function pd(t,s){var a=Ue;Ue|=1;try{return t(s)}finally{Ue=a,Ue===0&&(Vi=nt()+500,al&&cs())}}function ei(t){ms!==null&&ms.tag===0&&(Ue&6)===0&&Gi();var s=Ue;Ue|=1;var a=Mn.transition,f=He;try{if(Mn.transition=null,He=1,t)return t()}finally{He=f,Mn.transition=a,Ue=s,(Ue&6)===0&&cs()}}function md(){_n=Wi.current,st(Wi)}function ti(t,s){t.finishedWork=null,t.finishedLanes=0;var a=t.timeoutHandle;if(a!==-1&&(t.timeoutHandle=-1,aR(a)),_t!==null)for(a=_t.return;a!==null;){var f=a;switch(kc(f),f.tag){case 1:f=f.type.childContextTypes,f!=null&&il();break;case 3:Bi(),st(rn),st(Ht),$c();break;case 5:Pc(f);break;case 4:Bi();break;case 13:st(ft);break;case 19:st(ft);break;case 10:jc(f.type._context);break;case 22:case 23:md()}a=a.return}if(At=t,_t=t=ys(t.current,null),$t=_n=s,Nt=0,Qo=null,ld=Tl=Js=0,an=Zo=null,Xs!==null){for(s=0;s<Xs.length;s++)if(a=Xs[s],f=a.interleaved,f!==null){a.interleaved=null;var v=f.next,x=a.pending;if(x!==null){var R=x.next;x.next=v,f.next=R}a.pending=f}Xs=null}return t}function xw(t,s){do{var a=_t;try{if(Rc(),vl.current=_l,yl){for(var f=ht.memoizedState;f!==null;){var v=f.queue;v!==null&&(v.pending=null),f=f.next}yl=!1}if(Zs=0,jt=Et=ht=null,Wo=!1,Vo=0,ad.current=null,a===null||a.return===null){Nt=1,Qo=s,_t=null;break}e:{var x=t,R=a.return,F=a,X=s;if(s=$t,F.flags|=32768,X!==null&&typeof X=="object"&&typeof X.then=="function"){var ae=X,pe=F,me=pe.tag;if((pe.mode&1)===0&&(me===0||me===11||me===15)){var he=pe.alternate;he?(pe.updateQueue=he.updateQueue,pe.memoizedState=he.memoizedState,pe.lanes=he.lanes):(pe.updateQueue=null,pe.memoizedState=null)}var be=W0(R);if(be!==null){be.flags&=-257,V0(be,R,F,x,s),be.mode&1&&H0(x,ae,s),s=be,X=ae;var Ne=s.updateQueue;if(Ne===null){var Te=new Set;Te.add(X),s.updateQueue=Te}else Ne.add(X);break e}else{if((s&1)===0){H0(x,ae,s),gd();break e}X=Error(r(426))}}else if(at&&F.mode&1){var xt=W0(R);if(xt!==null){(xt.flags&65536)===0&&(xt.flags|=256),V0(xt,R,F,x,s),Cc(Ui(X,F));break e}}x=X=Ui(X,F),Nt!==4&&(Nt=2),Zo===null?Zo=[x]:Zo.push(x),x=R;do{switch(x.tag){case 3:x.flags|=65536,s&=-s,x.lanes|=s;var se=B0(x,X,s);m0(x,se);break e;case 1:F=X;var ee=x.type,ie=x.stateNode;if((x.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(ps===null||!ps.has(ie)))){x.flags|=65536,s&=-s,x.lanes|=s;var ge=U0(x,F,s);m0(x,ge);break e}}x=x.return}while(x!==null)}Sw(a)}catch(Re){s=Re,_t===a&&a!==null&&(_t=a=a.return);continue}break}while(!0)}function _w(){var t=Cl.current;return Cl.current=_l,t===null?_l:t}function gd(){(Nt===0||Nt===3||Nt===2)&&(Nt=4),At===null||(Js&268435455)===0&&(Tl&268435455)===0||vs(At,$t)}function Ol(t,s){var a=Ue;Ue|=2;var f=_w();(At!==t||$t!==s)&&($r=null,ti(t,s));do try{IR();break}catch(v){xw(t,v)}while(!0);if(Rc(),Ue=a,Cl.current=f,_t!==null)throw Error(r(261));return At=null,$t=0,Nt}function IR(){for(;_t!==null;)bw(_t)}function MR(){for(;_t!==null&&!Xr();)bw(_t)}function bw(t){var s=Nw(t.alternate,t,_n);t.memoizedProps=t.pendingProps,s===null?Sw(t):_t=s,ad.current=null}function Sw(t){var s=t;do{var a=s.alternate;if(t=s.return,(s.flags&32768)===0){if(a=ER(a,s,_n),a!==null){_t=a;return}}else{if(a=NR(a,s),a!==null){a.flags&=32767,_t=a;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Nt=6,_t=null;return}}if(s=s.sibling,s!==null){_t=s;return}_t=s=t}while(s!==null);Nt===0&&(Nt=5)}function ni(t,s,a){var f=He,v=Mn.transition;try{Mn.transition=null,He=1,OR(t,s,a,f)}finally{Mn.transition=v,He=f}return null}function OR(t,s,a,f){do Gi();while(ms!==null);if((Ue&6)!==0)throw Error(r(327));a=t.finishedWork;var v=t.finishedLanes;if(a===null)return null;if(t.finishedWork=null,t.finishedLanes=0,a===t.current)throw Error(r(177));t.callbackNode=null,t.callbackPriority=0;var x=a.lanes|a.childLanes;if(ec(t,x),t===At&&(_t=At=null,$t=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||jl||(jl=!0,Cw(Zr,function(){return Gi(),null})),x=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||x){x=Mn.transition,Mn.transition=null;var R=He;He=1;var F=Ue;Ue|=4,ad.current=null,TR(t,a),hw(a,t),eR(gc),qs=!!mc,gc=mc=null,t.current=a,RR(a),wi(),Ue=F,He=R,Mn.transition=x}else t.current=a;if(jl&&(jl=!1,ms=t,Al=v),x=t.pendingLanes,x===0&&(ps=null),Os(a.stateNode),ln(t,nt()),s!==null)for(f=t.onRecoverableError,a=0;a<s.length;a++)v=s[a],f(v.value,{componentStack:v.stack,digest:v.digest});if(Rl)throw Rl=!1,t=cd,cd=null,t;return(Al&1)!==0&&t.tag!==0&&Gi(),x=t.pendingLanes,(x&1)!==0?t===dd?Jo++:(Jo=0,dd=t):Jo=0,cs(),null}function Gi(){if(ms!==null){var t=Da(Al),s=Mn.transition,a=He;try{if(Mn.transition=null,He=16>t?16:t,ms===null)var f=!1;else{if(t=ms,ms=null,Al=0,(Ue&6)!==0)throw Error(r(331));var v=Ue;for(Ue|=4,Se=t.current;Se!==null;){var x=Se,R=x.child;if((Se.flags&16)!==0){var F=x.deletions;if(F!==null){for(var X=0;X<F.length;X++){var ae=F[X];for(Se=ae;Se!==null;){var pe=Se;switch(pe.tag){case 0:case 11:case 15:Xo(8,pe,x)}var me=pe.child;if(me!==null)me.return=pe,Se=me;else for(;Se!==null;){pe=Se;var he=pe.sibling,be=pe.return;if(lw(pe),pe===ae){Se=null;break}if(he!==null){he.return=be,Se=he;break}Se=be}}}var Ne=x.alternate;if(Ne!==null){var Te=Ne.child;if(Te!==null){Ne.child=null;do{var xt=Te.sibling;Te.sibling=null,Te=xt}while(Te!==null)}}Se=x}}if((x.subtreeFlags&2064)!==0&&R!==null)R.return=x,Se=R;else e:for(;Se!==null;){if(x=Se,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Xo(9,x,x.return)}var se=x.sibling;if(se!==null){se.return=x.return,Se=se;break e}Se=x.return}}var ee=t.current;for(Se=ee;Se!==null;){R=Se;var ie=R.child;if((R.subtreeFlags&2064)!==0&&ie!==null)ie.return=R,Se=ie;else e:for(R=ee;Se!==null;){if(F=Se,(F.flags&2048)!==0)try{switch(F.tag){case 0:case 11:case 15:Nl(9,F)}}catch(Re){vt(F,F.return,Re)}if(F===R){Se=null;break e}var ge=F.sibling;if(ge!==null){ge.return=F.return,Se=ge;break e}Se=F.return}}if(Ue=v,cs(),kt&&typeof kt.onPostCommitFiberRoot=="function")try{kt.onPostCommitFiberRoot(or,t)}catch{}f=!0}return f}finally{He=a,Mn.transition=s}}return!1}function kw(t,s,a){s=Ui(a,s),s=B0(t,s,1),t=fs(t,s,1),s=Jt(),t!==null&&(ts(t,1,s),ln(t,s))}function vt(t,s,a){if(t.tag===3)kw(t,t,a);else for(;s!==null;){if(s.tag===3){kw(s,t,a);break}else if(s.tag===1){var f=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(ps===null||!ps.has(f))){t=Ui(a,t),t=U0(s,t,1),s=fs(s,t,1),t=Jt(),s!==null&&(ts(s,1,t),ln(s,t));break}}s=s.return}}function PR(t,s,a){var f=t.pingCache;f!==null&&f.delete(s),s=Jt(),t.pingedLanes|=t.suspendedLanes&a,At===t&&($t&a)===a&&(Nt===4||Nt===3&&($t&130023424)===$t&&500>nt()-ud?ti(t,0):ld|=a),ln(t,s)}function Ew(t,s){s===0&&((t.mode&1)===0?s=1:(s=es,es<<=1,(es&130023424)===0&&(es=4194304)));var a=Jt();t=Or(t,s),t!==null&&(ts(t,s,a),ln(t,a))}function LR(t){var s=t.memoizedState,a=0;s!==null&&(a=s.retryLane),Ew(t,a)}function $R(t,s){var a=0;switch(t.tag){case 13:var f=t.stateNode,v=t.memoizedState;v!==null&&(a=v.retryLane);break;case 19:f=t.stateNode;break;default:throw Error(r(314))}f!==null&&f.delete(s),Ew(t,a)}var Nw;Nw=function(t,s,a){if(t!==null)if(t.memoizedProps!==s.pendingProps||rn.current)on=!0;else{if((t.lanes&a)===0&&(s.flags&128)===0)return on=!1,kR(t,s,a);on=(t.flags&131072)!==0}else on=!1,at&&(s.flags&1048576)!==0&&i0(s,ul,s.index);switch(s.lanes=0,s.tag){case 2:var f=s.type;kl(t,s),t=s.pendingProps;var v=Pi(s,Ht.current);zi(s,a),v=Fc(null,s,f,t,v,a);var x=zc();return s.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,sn(f)?(x=!0,ol(s)):x=!1,s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Mc(s),v.updater=bl,s.stateNode=v,v._reactInternals=s,Gc(s,f,t,a),s=Qc(null,s,f,!0,x,a)):(s.tag=0,at&&x&&Sc(s),Zt(null,s,v,a),s=s.child),s;case 16:f=s.elementType;e:{switch(kl(t,s),t=s.pendingProps,v=f._init,f=v(f._payload),s.type=f,v=s.tag=DR(f),t=Yn(f,t),v){case 0:s=Xc(null,s,f,t,a);break e;case 1:s=Z0(null,s,f,t,a);break e;case 11:s=G0(null,s,f,t,a);break e;case 14:s=Y0(null,s,f,Yn(f.type,t),a);break e}throw Error(r(306,f,""))}return s;case 0:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Yn(f,v),Xc(t,s,f,v,a);case 1:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Yn(f,v),Z0(t,s,f,v,a);case 3:e:{if(J0(s),t===null)throw Error(r(387));f=s.pendingProps,x=s.memoizedState,v=x.element,p0(t,s),ml(s,f,null,a);var R=s.memoizedState;if(f=R.element,x.isDehydrated)if(x={element:f,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){v=Ui(Error(r(423)),s),s=ew(t,s,f,a,v);break e}else if(f!==v){v=Ui(Error(r(424)),s),s=ew(t,s,f,a,v);break e}else for(xn=as(s.stateNode.containerInfo.firstChild),wn=s,at=!0,Gn=null,a=f0(s,null,f,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(qi(),f===v){s=Lr(t,s,a);break e}Zt(t,s,f,a)}s=s.child}return s;case 5:return v0(s),t===null&&Nc(s),f=s.type,v=s.pendingProps,x=t!==null?t.memoizedProps:null,R=v.children,vc(f,v)?R=null:x!==null&&vc(f,x)&&(s.flags|=32),Q0(t,s),Zt(t,s,R,a),s.child;case 6:return t===null&&Nc(s),null;case 13:return tw(t,s,a);case 4:return Oc(s,s.stateNode.containerInfo),f=s.pendingProps,t===null?s.child=Di(s,null,f,a):Zt(t,s,f,a),s.child;case 11:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Yn(f,v),G0(t,s,f,v,a);case 7:return Zt(t,s,s.pendingProps,a),s.child;case 8:return Zt(t,s,s.pendingProps.children,a),s.child;case 12:return Zt(t,s,s.pendingProps.children,a),s.child;case 10:e:{if(f=s.type._context,v=s.pendingProps,x=s.memoizedProps,R=v.value,tt(fl,f._currentValue),f._currentValue=R,x!==null)if(Vn(x.value,R)){if(x.children===v.children&&!rn.current){s=Lr(t,s,a);break e}}else for(x=s.child,x!==null&&(x.return=s);x!==null;){var F=x.dependencies;if(F!==null){R=x.child;for(var X=F.firstContext;X!==null;){if(X.context===f){if(x.tag===1){X=Pr(-1,a&-a),X.tag=2;var ae=x.updateQueue;if(ae!==null){ae=ae.shared;var pe=ae.pending;pe===null?X.next=X:(X.next=pe.next,pe.next=X),ae.pending=X}}x.lanes|=a,X=x.alternate,X!==null&&(X.lanes|=a),Ac(x.return,a,s),F.lanes|=a;break}X=X.next}}else if(x.tag===10)R=x.type===s.type?null:x.child;else if(x.tag===18){if(R=x.return,R===null)throw Error(r(341));R.lanes|=a,F=R.alternate,F!==null&&(F.lanes|=a),Ac(R,a,s),R=x.sibling}else R=x.child;if(R!==null)R.return=x;else for(R=x;R!==null;){if(R===s){R=null;break}if(x=R.sibling,x!==null){x.return=R.return,R=x;break}R=R.return}x=R}Zt(t,s,v.children,a),s=s.child}return s;case 9:return v=s.type,f=s.pendingProps.children,zi(s,a),v=An(v),f=f(v),s.flags|=1,Zt(t,s,f,a),s.child;case 14:return f=s.type,v=Yn(f,s.pendingProps),v=Yn(f.type,v),Y0(t,s,f,v,a);case 15:return K0(t,s,s.type,s.pendingProps,a);case 17:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Yn(f,v),kl(t,s),s.tag=1,sn(f)?(t=!0,ol(s)):t=!1,zi(s,a),F0(s,f,v),Gc(s,f,v,a),Qc(null,s,f,!0,t,a);case 19:return rw(t,s,a);case 22:return X0(t,s,a)}throw Error(r(156,s.tag))};function Cw(t,s){return _r(t,s)}function qR(t,s,a,f){this.tag=t,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function On(t,s,a,f){return new qR(t,s,a,f)}function vd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function DR(t){if(typeof t=="function")return vd(t)?1:0;if(t!=null){if(t=t.$$typeof,t===V)return 11;if(t===q)return 14}return 2}function ys(t,s){var a=t.alternate;return a===null?(a=On(t.tag,s,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=s,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&14680064,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,s=t.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a}function Pl(t,s,a,f,v,x){var R=2;if(f=t,typeof t=="function")vd(t)&&(R=1);else if(typeof t=="string")R=5;else e:switch(t){case A:return ri(a.children,v,x,s);case U:R=8,v|=8;break;case z:return t=On(12,a,s,v|2),t.elementType=z,t.lanes=x,t;case B:return t=On(13,a,s,v),t.elementType=B,t.lanes=x,t;case C:return t=On(19,a,s,v),t.elementType=C,t.lanes=x,t;case re:return Ll(a,v,x,s);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case P:R=10;break e;case D:R=9;break e;case V:R=11;break e;case q:R=14;break e;case L:R=16,f=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return s=On(R,a,s,v),s.elementType=t,s.type=f,s.lanes=x,s}function ri(t,s,a,f){return t=On(7,t,f,s),t.lanes=a,t}function Ll(t,s,a,f){return t=On(22,t,f,s),t.elementType=re,t.lanes=a,t.stateNode={isHidden:!1},t}function yd(t,s,a){return t=On(6,t,null,s),t.lanes=a,t}function wd(t,s,a){return s=On(4,t.children!==null?t.children:[],t.key,s),s.lanes=a,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}function FR(t,s,a,f,v){this.tag=s,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ar(0),this.expirationTimes=ar(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ar(0),this.identifierPrefix=f,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function xd(t,s,a,f,v,x,R,F,X){return t=new FR(t,s,a,F,X),s===1?(s=1,x===!0&&(s|=8)):s=0,x=On(3,null,null,s),t.current=x,x.stateNode=t,x.memoizedState={element:f,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Mc(x),t}function zR(t,s,a){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:f==null?null:""+f,children:t,containerInfo:s,implementation:a}}function Tw(t){if(!t)return us;t=t._reactInternals;e:{if(Nn(t)!==t||t.tag!==1)throw Error(r(170));var s=t;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(sn(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(t.tag===1){var a=t.type;if(sn(a))return n0(t,a,s)}return s}function Rw(t,s,a,f,v,x,R,F,X){return t=xd(a,f,!0,t,v,x,R,F,X),t.context=Tw(null),a=t.current,f=Jt(),v=gs(a),x=Pr(f,v),x.callback=s??null,fs(a,x,v),t.current.lanes=v,ts(t,v,f),ln(t,f),t}function $l(t,s,a,f){var v=s.current,x=Jt(),R=gs(v);return a=Tw(a),s.context===null?s.context=a:s.pendingContext=a,s=Pr(x,R),s.payload={element:t},f=f===void 0?null:f,f!==null&&(s.callback=f),t=fs(v,s,R),t!==null&&(Qn(t,v,R,x),pl(t,v,R)),R}function ql(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function jw(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<s?a:s}}function _d(t,s){jw(t,s),(t=t.alternate)&&jw(t,s)}function BR(){return null}var Aw=typeof reportError=="function"?reportError:function(t){console.error(t)};function bd(t){this._internalRoot=t}Dl.prototype.render=bd.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(r(409));$l(t,s,null,null)},Dl.prototype.unmount=bd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;ei(function(){$l(null,t,null,null)}),s[jr]=null}};function Dl(t){this._internalRoot=t}Dl.prototype.unstable_scheduleHydration=function(t){if(t){var s=kr();t={blockedOn:null,target:t,priority:s};for(var a=0;a<lr.length&&s!==0&&s<lr[a].priority;a++);lr.splice(a,0,t),a===0&&No(t)}};function Sd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Fl(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Iw(){}function UR(t,s,a,f,v){if(v){if(typeof f=="function"){var x=f;f=function(){var ae=ql(R);x.call(ae)}}var R=Rw(s,f,t,0,null,!1,!1,"",Iw);return t._reactRootContainer=R,t[jr]=R.current,$o(t.nodeType===8?t.parentNode:t),ei(),R}for(;v=t.lastChild;)t.removeChild(v);if(typeof f=="function"){var F=f;f=function(){var ae=ql(X);F.call(ae)}}var X=xd(t,0,!1,null,null,!1,!1,"",Iw);return t._reactRootContainer=X,t[jr]=X.current,$o(t.nodeType===8?t.parentNode:t),ei(function(){$l(s,X,a,f)}),X}function zl(t,s,a,f,v){var x=a._reactRootContainer;if(x){var R=x;if(typeof v=="function"){var F=v;v=function(){var X=ql(R);F.call(X)}}$l(s,R,t,v)}else R=UR(a,s,t,v,f);return ql(R)}Xt=function(t){switch(t.tag){case 3:var s=t.stateNode;if(s.current.memoizedState.isDehydrated){var a=gn(s.pendingLanes);a!==0&&(_i(s,a|1),ln(s,nt()),(Ue&6)===0&&(Vi=nt()+500,cs()))}break;case 13:ei(function(){var f=Or(t,1);if(f!==null){var v=Jt();Qn(f,t,1,v)}}),_d(t,1)}},ko=function(t){if(t.tag===13){var s=Or(t,134217728);if(s!==null){var a=Jt();Qn(s,t,134217728,a)}_d(t,134217728)}},bi=function(t){if(t.tag===13){var s=gs(t),a=Or(t,s);if(a!==null){var f=Jt();Qn(a,t,s,f)}_d(t,s)}},kr=function(){return He},ns=function(t,s){var a=He;try{return He=t,s()}finally{He=a}},kn=function(t,s,a){switch(s){case"input":if(we(t,a),s=a.name,a.type==="radio"&&s!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<a.length;s++){var f=a[s];if(f!==t&&f.form===t.form){var v=sl(f);if(!v)throw Error(r(90));ve(f),we(f,v)}}}break;case"textarea":Je(t,a);break;case"select":s=a.value,s!=null&&pt(t,!!a.multiple,s,!1)}},gi=pd,Vr=ei;var HR={usingClientEntryPoint:!1,Events:[Fo,Mi,sl,vr,Wr,pd]},ea={findFiberByHostInstance:Vs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},WR={bundleType:ea.bundleType,version:ea.version,rendererPackageName:ea.rendererPackageName,rendererConfig:ea.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Rt(t),t===null?null:t.stateNode},findFiberByHostInstance:ea.findFiberByHostInstance||BR,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 Bl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bl.isDisabled&&Bl.supportsFiber)try{or=Bl.inject(WR),kt=Bl}catch{}}return un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=HR,un.createPortal=function(t,s){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Sd(s))throw Error(r(200));return zR(t,s,null,a)},un.createRoot=function(t,s){if(!Sd(t))throw Error(r(299));var a=!1,f="",v=Aw;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(f=s.identifierPrefix),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=xd(t,1,!1,null,null,a,!1,f,v),t[jr]=s.current,$o(t.nodeType===8?t.parentNode:t),new bd(s)},un.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=Rt(s),t=t===null?null:t.stateNode,t},un.flushSync=function(t){return ei(t)},un.hydrate=function(t,s,a){if(!Fl(s))throw Error(r(200));return zl(null,t,s,!0,a)},un.hydrateRoot=function(t,s,a){if(!Sd(t))throw Error(r(405));var f=a!=null&&a.hydratedSources||null,v=!1,x="",R=Aw;if(a!=null&&(a.unstable_strictMode===!0&&(v=!0),a.identifierPrefix!==void 0&&(x=a.identifierPrefix),a.onRecoverableError!==void 0&&(R=a.onRecoverableError)),s=Rw(s,null,t,1,a??null,v,!1,x,R),t[jr]=s.current,$o(t),f)for(t=0;t<f.length;t++)a=f[t],v=a._getVersion,v=v(a._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[a,v]:s.mutableSourceEagerHydrationData.push(a,v);return new Dl(s)},un.render=function(t,s,a){if(!Fl(s))throw Error(r(200));return zl(null,t,s,!1,a)},un.unmountComponentAtNode=function(t){if(!Fl(t))throw Error(r(40));return t._reactRootContainer?(ei(function(){zl(null,null,t,!1,function(){t._reactRootContainer=null,t[jr]=null})}),!0):!1},un.unstable_batchedUpdates=pd,un.unstable_renderSubtreeIntoContainer=function(t,s,a,f){if(!Fl(a))throw Error(r(200));if(t==null||t._reactInternals===void 0)throw Error(r(38));return zl(t,s,a,!1,f)},un.version="18.3.1-next-f1338f8080-20240426",un}var Fw;function BE(){if(Fw)return Nd.exports;Fw=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(n){console.error(n)}}return e(),Nd.exports=ZR(),Nd.exports}var zw;function JR(){if(zw)return Hl;zw=1;var e=BE();return Hl.createRoot=e.createRoot,Hl.hydrateRoot=e.hydrateRoot,Hl}var ej=JR(),j=ka();const ue=$v(j);function Dt(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let r=0,i;r<e.length;r++)(i=Dt(e[r]))!==""&&(n+=(n&&" ")+i);else for(let r in e)e[r]&&(n+=(n&&" ")+r);return n}var Rd={exports:{}},jd={},Ad={exports:{}},Id={};/**
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 Bw;function ej(){if(Bw)return Id;Bw=1;var e=ka();function n(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var r=typeof Object.is=="function"?Object.is:n,i=e.useState,o=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function c(m,y){var w=y(),N=i({inst:{value:w,getSnapshot:y}}),_=N[0].inst,b=N[1];return l(function(){_.value=w,_.getSnapshot=y,h(_)&&b({inst:_})},[m,w,y]),o(function(){return h(_)&&b({inst:_}),m(function(){h(_)&&b({inst:_})})},[m]),u(w),w}function h(m){var y=m.getSnapshot;m=m.value;try{var w=y();return!r(m,w)}catch{return!0}}function p(m,y){return y()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:c;return Id.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Id}var Uw;function tj(){return Uw||(Uw=1,Ad.exports=ej()),Ad.exports}/**
48
+ */var Bw;function tj(){if(Bw)return Id;Bw=1;var e=ka();function n(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var r=typeof Object.is=="function"?Object.is:n,i=e.useState,o=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function c(m,y){var w=y(),N=i({inst:{value:w,getSnapshot:y}}),_=N[0].inst,b=N[1];return l(function(){_.value=w,_.getSnapshot=y,h(_)&&b({inst:_})},[m,w,y]),o(function(){return h(_)&&b({inst:_}),m(function(){h(_)&&b({inst:_})})},[m]),u(w),w}function h(m){var y=m.getSnapshot;m=m.value;try{var w=y();return!r(m,w)}catch{return!0}}function p(m,y){return y()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:c;return Id.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Id}var Uw;function nj(){return Uw||(Uw=1,Ad.exports=tj()),Ad.exports}/**
49
49
  * @license React
50
50
  * use-sync-external-store-shim/with-selector.production.js
51
51
  *
@@ -53,23 +53,25 @@ 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 Hw;function nj(){if(Hw)return jd;Hw=1;var e=ka(),n=tj();function r(p,d){return p===d&&(p!==0||1/p===1/d)||p!==p&&d!==d}var i=typeof Object.is=="function"?Object.is:r,o=n.useSyncExternalStore,l=e.useRef,u=e.useEffect,c=e.useMemo,h=e.useDebugValue;return jd.useSyncExternalStoreWithSelector=function(p,d,m,y,w){var N=l(null);if(N.current===null){var _={hasValue:!1,value:null};N.current=_}else _=N.current;N=c(function(){function S(O){if(!k){if(k=!0,E=O,O=y(O),w!==void 0&&_.hasValue){var A=_.value;if(w(A,O))return T=A}return T=O}if(A=T,i(E,O))return A;var U=y(O);return w!==void 0&&w(A,U)?(E=O,A):(E=O,T=U)}var k=!1,E,T,I=m===void 0?null:m;return[function(){return S(d())},I===null?void 0:function(){return S(I())}]},[d,m,y,w]);var b=o(p,N[0],N[1]);return u(function(){_.hasValue=!0,_.value=b},[b]),h(b),b},jd}var Ww;function rj(){return Ww||(Ww=1,Rd.exports=nj()),Rd.exports}var sj=rj();const ij=$v(sj),oj={},Vw=e=>{let n;const r=new Set,i=(d,m)=>{const y=typeof d=="function"?d(n):d;if(!Object.is(y,n)){const w=n;n=m??(typeof y!="object"||y===null)?y:Object.assign({},n,y),r.forEach(N=>N(n,w))}},o=()=>n,h={setState:i,getState:o,getInitialState:()=>p,subscribe:d=>(r.add(d),()=>r.delete(d)),destroy:()=>{(oj?"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."),r.clear()}},p=n=e(i,o,h);return h},aj=e=>e?Vw(e):Vw,{useDebugValue:lj}=ue,{useSyncExternalStoreWithSelector:uj}=ij,cj=e=>e;function BE(e,n=cj,r){const i=uj(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,r);return lj(i),i}const Gw=(e,n)=>{const r=aj(e),i=(o,l=n)=>BE(r,o,l);return Object.assign(i,r),i},dj=(e,n)=>e?Gw(e,n):Gw;function Ct(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[i,o]of e)if(!Object.is(o,n.get(i)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const i of e)if(!n.has(i))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;for(const i of r)if(!Object.prototype.hasOwnProperty.call(n,i)||!Object.is(e[i],n[i]))return!1;return!0}var fj={value:()=>{}};function Tu(){for(var e=0,n=arguments.length,r={},i;e<n;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new lu(r)}function lu(e){this._=e}function hj(e,n){return e.trim().split(/^|\s+/).map(function(r){var i="",o=r.indexOf(".");if(o>=0&&(i=r.slice(o+1),r=r.slice(0,o)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}lu.prototype=Tu.prototype={constructor:lu,on:function(e,n){var r=this._,i=hj(e+"",r),o,l=-1,u=i.length;if(arguments.length<2){for(;++l<u;)if((o=(e=i[l]).type)&&(o=pj(r[o],e.name)))return o;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++l<u;)if(o=(e=i[l]).type)r[o]=Yw(r[o],e.name,n);else if(n==null)for(o in r)r[o]=Yw(r[o],e.name,null);return this},copy:function(){var e={},n=this._;for(var r in n)e[r]=n[r].slice();return new lu(e)},call:function(e,n){if((o=arguments.length-2)>0)for(var r=new Array(o),i=0,o,l;i<o;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,o=l.length;i<o;++i)l[i].value.apply(n,r)},apply:function(e,n,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],o=0,l=i.length;o<l;++o)i[o].value.apply(n,r)}};function pj(e,n){for(var r=0,i=e.length,o;r<i;++r)if((o=e[r]).name===n)return o.value}function Yw(e,n,r){for(var i=0,o=e.length;i<o;++i)if(e[i].name===n){e[i]=fj,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:n,value:r}),e}var dv="http://www.w3.org/1999/xhtml";const Kw={svg:"http://www.w3.org/2000/svg",xhtml:dv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ru(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Kw.hasOwnProperty(n)?{space:Kw[n],local:e}:e}function mj(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===dv&&n.documentElement.namespaceURI===dv?n.createElement(e):n.createElementNS(r,e)}}function gj(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function UE(e){var n=Ru(e);return(n.local?gj:mj)(n)}function vj(){}function qv(e){return e==null?vj:function(){return this.querySelector(e)}}function yj(e){typeof e!="function"&&(e=qv(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=new Array(u),h,p,d=0;d<u;++d)(h=l[d])&&(p=e.call(h,h.__data__,d,l))&&("__data__"in h&&(p.__data__=h.__data__),c[d]=p);return new bn(i,this._parents)}function wj(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function xj(){return[]}function HE(e){return e==null?xj:function(){return this.querySelectorAll(e)}}function _j(e){return function(){return wj(e.apply(this,arguments))}}function bj(e){typeof e=="function"?e=_j(e):e=HE(e);for(var n=this._groups,r=n.length,i=[],o=[],l=0;l<r;++l)for(var u=n[l],c=u.length,h,p=0;p<c;++p)(h=u[p])&&(i.push(e.call(h,h.__data__,p,u)),o.push(h));return new bn(i,o)}function WE(e){return function(){return this.matches(e)}}function VE(e){return function(n){return n.matches(e)}}var Sj=Array.prototype.find;function kj(e){return function(){return Sj.call(this.children,e)}}function Ej(){return this.firstElementChild}function Nj(e){return this.select(e==null?Ej:kj(typeof e=="function"?e:VE(e)))}var Cj=Array.prototype.filter;function Tj(){return Array.from(this.children)}function Rj(e){return function(){return Cj.call(this.children,e)}}function jj(e){return this.selectAll(e==null?Tj:Rj(typeof e=="function"?e:VE(e)))}function Aj(e){typeof e!="function"&&(e=WE(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=[],h,p=0;p<u;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&c.push(h);return new bn(i,this._parents)}function GE(e){return new Array(e.length)}function Ij(){return new bn(this._enter||this._groups.map(GE),this._parents)}function pu(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}pu.prototype={constructor:pu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Mj(e){return function(){return e}}function Oj(e,n,r,i,o,l){for(var u=0,c,h=n.length,p=l.length;u<p;++u)(c=n[u])?(c.__data__=l[u],i[u]=c):r[u]=new pu(e,l[u]);for(;u<h;++u)(c=n[u])&&(o[u]=c)}function Pj(e,n,r,i,o,l,u){var c,h,p=new Map,d=n.length,m=l.length,y=new Array(d),w;for(c=0;c<d;++c)(h=n[c])&&(y[c]=w=u.call(h,h.__data__,c,n)+"",p.has(w)?o[c]=h:p.set(w,h));for(c=0;c<m;++c)w=u.call(e,l[c],c,l)+"",(h=p.get(w))?(i[c]=h,h.__data__=l[c],p.delete(w)):r[c]=new pu(e,l[c]);for(c=0;c<d;++c)(h=n[c])&&p.get(y[c])===h&&(o[c]=h)}function Lj(e){return e.__data__}function $j(e,n){if(!arguments.length)return Array.from(this,Lj);var r=n?Pj:Oj,i=this._parents,o=this._groups;typeof e!="function"&&(e=Mj(e));for(var l=o.length,u=new Array(l),c=new Array(l),h=new Array(l),p=0;p<l;++p){var d=i[p],m=o[p],y=m.length,w=qj(e.call(d,d&&d.__data__,p,i)),N=w.length,_=c[p]=new Array(N),b=u[p]=new Array(N),S=h[p]=new Array(y);r(d,m,_,b,S,w,n);for(var k=0,E=0,T,I;k<N;++k)if(T=_[k]){for(k>=E&&(E=k+1);!(I=b[E])&&++E<N;);T._next=I||null}}return u=new bn(u,i),u._enter=c,u._exit=h,u}function qj(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Dj(){return new bn(this._exit||this._groups.map(GE),this._parents)}function Fj(e,n,r){var i=this.enter(),o=this,l=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(o=n(o),o&&(o=o.selection())),r==null?l.remove():r(l),i&&o?i.merge(o).order():o}function zj(e){for(var n=e.selection?e.selection():e,r=this._groups,i=n._groups,o=r.length,l=i.length,u=Math.min(o,l),c=new Array(o),h=0;h<u;++h)for(var p=r[h],d=i[h],m=p.length,y=c[h]=new Array(m),w,N=0;N<m;++N)(w=p[N]||d[N])&&(y[N]=w);for(;h<o;++h)c[h]=r[h];return new bn(c,this._parents)}function Bj(){for(var e=this._groups,n=-1,r=e.length;++n<r;)for(var i=e[n],o=i.length-1,l=i[o],u;--o>=0;)(u=i[o])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function Uj(e){e||(e=Hj);function n(m,y){return m&&y?e(m.__data__,y.__data__):!m-!y}for(var r=this._groups,i=r.length,o=new Array(i),l=0;l<i;++l){for(var u=r[l],c=u.length,h=o[l]=new Array(c),p,d=0;d<c;++d)(p=u[d])&&(h[d]=p);h.sort(n)}return new bn(o,this._parents).order()}function Hj(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function Wj(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Vj(){return Array.from(this)}function Gj(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,l=i.length;o<l;++o){var u=i[o];if(u)return u}return null}function Yj(){let e=0;for(const n of this)++e;return e}function Kj(){return!this.node()}function Xj(e){for(var n=this._groups,r=0,i=n.length;r<i;++r)for(var o=n[r],l=0,u=o.length,c;l<u;++l)(c=o[l])&&e.call(c,c.__data__,l,o);return this}function Qj(e){return function(){this.removeAttribute(e)}}function Zj(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Jj(e,n){return function(){this.setAttribute(e,n)}}function eA(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function tA(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function nA(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function rA(e,n){var r=Ru(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((n==null?r.local?Zj:Qj:typeof n=="function"?r.local?nA:tA:r.local?eA:Jj)(r,n))}function YE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function sA(e){return function(){this.style.removeProperty(e)}}function iA(e,n,r){return function(){this.style.setProperty(e,n,r)}}function oA(e,n,r){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function aA(e,n,r){return arguments.length>1?this.each((n==null?sA:typeof n=="function"?oA:iA)(e,n,r??"")):ao(this.node(),e)}function ao(e,n){return e.style.getPropertyValue(n)||YE(e).getComputedStyle(e,null).getPropertyValue(n)}function lA(e){return function(){delete this[e]}}function uA(e,n){return function(){this[e]=n}}function cA(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function dA(e,n){return arguments.length>1?this.each((n==null?lA:typeof n=="function"?cA:uA)(e,n)):this.node()[e]}function KE(e){return e.trim().split(/^|\s+/)}function Dv(e){return e.classList||new XE(e)}function XE(e){this._node=e,this._names=KE(e.getAttribute("class")||"")}XE.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function QE(e,n){for(var r=Dv(e),i=-1,o=n.length;++i<o;)r.add(n[i])}function ZE(e,n){for(var r=Dv(e),i=-1,o=n.length;++i<o;)r.remove(n[i])}function fA(e){return function(){QE(this,e)}}function hA(e){return function(){ZE(this,e)}}function pA(e,n){return function(){(n.apply(this,arguments)?QE:ZE)(this,e)}}function mA(e,n){var r=KE(e+"");if(arguments.length<2){for(var i=Dv(this.node()),o=-1,l=r.length;++o<l;)if(!i.contains(r[o]))return!1;return!0}return this.each((typeof n=="function"?pA:n?fA:hA)(r,n))}function gA(){this.textContent=""}function vA(e){return function(){this.textContent=e}}function yA(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function wA(e){return arguments.length?this.each(e==null?gA:(typeof e=="function"?yA:vA)(e)):this.node().textContent}function xA(){this.innerHTML=""}function _A(e){return function(){this.innerHTML=e}}function bA(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function SA(e){return arguments.length?this.each(e==null?xA:(typeof e=="function"?bA:_A)(e)):this.node().innerHTML}function kA(){this.nextSibling&&this.parentNode.appendChild(this)}function EA(){return this.each(kA)}function NA(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function CA(){return this.each(NA)}function TA(e){var n=typeof e=="function"?e:UE(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function RA(){return null}function jA(e,n){var r=typeof e=="function"?e:UE(e),i=n==null?RA:typeof n=="function"?n:qv(n);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function AA(){var e=this.parentNode;e&&e.removeChild(this)}function IA(){return this.each(AA)}function MA(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function OA(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function PA(e){return this.select(e?OA:MA)}function LA(e){return arguments.length?this.property("__data__",e):this.node().__data__}function $A(e){return function(n){e.call(this,n,this.__data__)}}function qA(e){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");return i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function DA(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,o=n.length,l;r<o;++r)l=n[r],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):n[++i]=l;++i?n.length=i:delete this.__on}}}function FA(e,n,r){return function(){var i=this.__on,o,l=$A(n);if(i){for(var u=0,c=i.length;u<c;++u)if((o=i[u]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=l,o.options=r),o.value=n;return}}this.addEventListener(e.type,l,r),o={type:e.type,name:e.name,value:n,listener:l,options:r},i?i.push(o):this.__on=[o]}}function zA(e,n,r){var i=qA(e+""),o,l=i.length,u;if(arguments.length<2){var c=this.node().__on;if(c){for(var h=0,p=c.length,d;h<p;++h)for(o=0,d=c[h];o<l;++o)if((u=i[o]).type===d.type&&u.name===d.name)return d.value}return}for(c=n?FA:DA,o=0;o<l;++o)this.each(c(i[o],n,r));return this}function JE(e,n,r){var i=YE(e),o=i.CustomEvent;typeof o=="function"?o=new o(n,r):(o=i.document.createEvent("Event"),r?(o.initEvent(n,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function BA(e,n){return function(){return JE(this,e,n)}}function UA(e,n){return function(){return JE(this,e,n.apply(this,arguments))}}function HA(e,n){return this.each((typeof n=="function"?UA:BA)(e,n))}function*WA(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,l=i.length,u;o<l;++o)(u=i[o])&&(yield u)}var eN=[null];function bn(e,n){this._groups=e,this._parents=n}function Ea(){return new bn([[document.documentElement]],eN)}function VA(){return this}bn.prototype=Ea.prototype={constructor:bn,select:yj,selectAll:bj,selectChild:Nj,selectChildren:jj,filter:Aj,data:$j,enter:Ij,exit:Dj,join:Fj,merge:zj,selection:VA,order:Bj,sort:Uj,call:Wj,nodes:Vj,node:Gj,size:Yj,empty:Kj,each:Xj,attr:rA,style:aA,property:dA,classed:mA,text:wA,html:SA,raise:EA,lower:CA,append:TA,insert:jA,remove:IA,clone:PA,datum:LA,on:zA,dispatch:HA,[Symbol.iterator]:WA};function Ln(e){return typeof e=="string"?new bn([[document.querySelector(e)]],[document.documentElement]):new bn([[e]],eN)}function GA(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Jn(e,n){if(e=GA(e),n===void 0&&(n=e.currentTarget),n){var r=n.ownerSVGElement||n;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}const YA={passive:!1},pa={capture:!0,passive:!1};function Md(e){e.stopImmediatePropagation()}function ro(e){e.preventDefault(),e.stopImmediatePropagation()}function tN(e){var n=e.document.documentElement,r=Ln(e).on("dragstart.drag",ro,pa);"onselectstart"in n?r.on("selectstart.drag",ro,pa):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function nN(e,n){var r=e.document.documentElement,i=Ln(e).on("dragstart.drag",null);n&&(i.on("click.drag",ro,pa),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in r?i.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const Wl=e=>()=>e;function fv(e,{sourceEvent:n,subject:r,target:i,identifier:o,active:l,x:u,y:c,dx:h,dy:p,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:d}})}fv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function KA(e){return!e.ctrlKey&&!e.button}function XA(){return this.parentNode}function QA(e,n){return n??{x:e.x,y:e.y}}function ZA(){return navigator.maxTouchPoints||"ontouchstart"in this}function JA(){var e=KA,n=XA,r=QA,i=ZA,o={},l=Tu("start","drag","end"),u=0,c,h,p,d,m=0;function y(T){T.on("mousedown.drag",w).filter(i).on("touchstart.drag",b).on("touchmove.drag",S,YA).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(T,I){if(!(d||!e.call(this,T,I))){var O=E(this,n.call(this,T,I),T,I,"mouse");O&&(Ln(T.view).on("mousemove.drag",N,pa).on("mouseup.drag",_,pa),tN(T.view),Md(T),p=!1,c=T.clientX,h=T.clientY,O("start",T))}}function N(T){if(ro(T),!p){var I=T.clientX-c,O=T.clientY-h;p=I*I+O*O>m}o.mouse("drag",T)}function _(T){Ln(T.view).on("mousemove.drag mouseup.drag",null),nN(T.view,p),ro(T),o.mouse("end",T)}function b(T,I){if(e.call(this,T,I)){var O=T.changedTouches,A=n.call(this,T,I),U=O.length,z,P;for(z=0;z<U;++z)(P=E(this,A,T,I,O[z].identifier,O[z]))&&(Md(T),P("start",T,O[z]))}}function S(T){var I=T.changedTouches,O=I.length,A,U;for(A=0;A<O;++A)(U=o[I[A].identifier])&&(ro(T),U("drag",T,I[A]))}function k(T){var I=T.changedTouches,O=I.length,A,U;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),A=0;A<O;++A)(U=o[I[A].identifier])&&(Md(T),U("end",T,I[A]))}function E(T,I,O,A,U,z){var P=l.copy(),D=Jn(z||O,I),V,B,C;if((C=r.call(T,new fv("beforestart",{sourceEvent:O,target:y,identifier:U,active:u,x:D[0],y:D[1],dx:0,dy:0,dispatch:P}),A))!=null)return V=C.x-D[0]||0,B=C.y-D[1]||0,function q(L,re,Z){var H=D,J;switch(L){case"start":o[U]=q,J=u++;break;case"end":delete o[U],--u;case"drag":D=Jn(Z||re,I),J=u;break}P.call(L,T,new fv(L,{sourceEvent:re,subject:C,target:y,identifier:U,active:J,x:D[0]+V,y:D[1]+B,dx:D[0]-H[0],dy:D[1]-H[1],dispatch:P}),A)}}return y.filter=function(T){return arguments.length?(e=typeof T=="function"?T:Wl(!!T),y):e},y.container=function(T){return arguments.length?(n=typeof T=="function"?T:Wl(T),y):n},y.subject=function(T){return arguments.length?(r=typeof T=="function"?T:Wl(T),y):r},y.touchable=function(T){return arguments.length?(i=typeof T=="function"?T:Wl(!!T),y):i},y.on=function(){var T=l.on.apply(l,arguments);return T===l?y:T},y.clickDistance=function(T){return arguments.length?(m=(T=+T)*T,y):Math.sqrt(m)},y}function Fv(e,n,r){e.prototype=n.prototype=r,r.constructor=e}function rN(e,n){var r=Object.create(e.prototype);for(var i in n)r[i]=n[i];return r}function Na(){}var ma=.7,mu=1/ma,so="\\s*([+-]?\\d+)\\s*",ga="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",hr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",e2=/^#([0-9a-f]{3,8})$/,t2=new RegExp(`^rgb\\(${so},${so},${so}\\)$`),n2=new RegExp(`^rgb\\(${hr},${hr},${hr}\\)$`),r2=new RegExp(`^rgba\\(${so},${so},${so},${ga}\\)$`),s2=new RegExp(`^rgba\\(${hr},${hr},${hr},${ga}\\)$`),i2=new RegExp(`^hsl\\(${ga},${hr},${hr}\\)$`),o2=new RegExp(`^hsla\\(${ga},${hr},${hr},${ga}\\)$`),Xw={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};Fv(Na,va,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Qw,formatHex:Qw,formatHex8:a2,formatHsl:l2,formatRgb:Zw,toString:Zw});function Qw(){return this.rgb().formatHex()}function a2(){return this.rgb().formatHex8()}function l2(){return sN(this).formatHsl()}function Zw(){return this.rgb().formatRgb()}function va(e){var n,r;return e=(e+"").trim().toLowerCase(),(n=e2.exec(e))?(r=n[1].length,n=parseInt(n[1],16),r===6?Jw(n):r===3?new cn(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?Vl(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?Vl(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=t2.exec(e))?new cn(n[1],n[2],n[3],1):(n=n2.exec(e))?new cn(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=r2.exec(e))?Vl(n[1],n[2],n[3],n[4]):(n=s2.exec(e))?Vl(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=i2.exec(e))?nx(n[1],n[2]/100,n[3]/100,1):(n=o2.exec(e))?nx(n[1],n[2]/100,n[3]/100,n[4]):Xw.hasOwnProperty(e)?Jw(Xw[e]):e==="transparent"?new cn(NaN,NaN,NaN,0):null}function Jw(e){return new cn(e>>16&255,e>>8&255,e&255,1)}function Vl(e,n,r,i){return i<=0&&(e=n=r=NaN),new cn(e,n,r,i)}function u2(e){return e instanceof Na||(e=va(e)),e?(e=e.rgb(),new cn(e.r,e.g,e.b,e.opacity)):new cn}function hv(e,n,r,i){return arguments.length===1?u2(e):new cn(e,n,r,i??1)}function cn(e,n,r,i){this.r=+e,this.g=+n,this.b=+r,this.opacity=+i}Fv(cn,hv,rN(Na,{brighter(e){return e=e==null?mu:Math.pow(mu,e),new cn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ma:Math.pow(ma,e),new cn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new cn(li(this.r),li(this.g),li(this.b),gu(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:ex,formatHex:ex,formatHex8:c2,formatRgb:tx,toString:tx}));function ex(){return`#${oi(this.r)}${oi(this.g)}${oi(this.b)}`}function c2(){return`#${oi(this.r)}${oi(this.g)}${oi(this.b)}${oi((isNaN(this.opacity)?1:this.opacity)*255)}`}function tx(){const e=gu(this.opacity);return`${e===1?"rgb(":"rgba("}${li(this.r)}, ${li(this.g)}, ${li(this.b)}${e===1?")":`, ${e})`}`}function gu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function li(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function oi(e){return e=li(e),(e<16?"0":"")+e.toString(16)}function nx(e,n,r,i){return i<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new er(e,n,r,i)}function sN(e){if(e instanceof er)return new er(e.h,e.s,e.l,e.opacity);if(e instanceof Na||(e=va(e)),!e)return new er;if(e instanceof er)return e;e=e.rgb();var n=e.r/255,r=e.g/255,i=e.b/255,o=Math.min(n,r,i),l=Math.max(n,r,i),u=NaN,c=l-o,h=(l+o)/2;return c?(n===l?u=(r-i)/c+(r<i)*6:r===l?u=(i-n)/c+2:u=(n-r)/c+4,c/=h<.5?l+o:2-l-o,u*=60):c=h>0&&h<1?0:u,new er(u,c,h,e.opacity)}function d2(e,n,r,i){return arguments.length===1?sN(e):new er(e,n,r,i??1)}function er(e,n,r,i){this.h=+e,this.s=+n,this.l=+r,this.opacity=+i}Fv(er,d2,rN(Na,{brighter(e){return e=e==null?mu:Math.pow(mu,e),new er(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ma:Math.pow(ma,e),new er(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*n,o=2*r-i;return new cn(Od(e>=240?e-240:e+120,o,i),Od(e,o,i),Od(e<120?e+240:e-120,o,i),this.opacity)},clamp(){return new er(rx(this.h),Gl(this.s),Gl(this.l),gu(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=gu(this.opacity);return`${e===1?"hsl(":"hsla("}${rx(this.h)}, ${Gl(this.s)*100}%, ${Gl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function rx(e){return e=(e||0)%360,e<0?e+360:e}function Gl(e){return Math.max(0,Math.min(1,e||0))}function Od(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const iN=e=>()=>e;function f2(e,n){return function(r){return e+r*n}}function h2(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(i){return Math.pow(e+i*n,r)}}function p2(e){return(e=+e)==1?oN:function(n,r){return r-n?h2(n,r,e):iN(isNaN(n)?r:n)}}function oN(e,n){var r=n-e;return r?f2(e,r):iN(isNaN(e)?n:e)}const sx=(function e(n){var r=p2(n);function i(o,l){var u=r((o=hv(o)).r,(l=hv(l)).r),c=r(o.g,l.g),h=r(o.b,l.b),p=oN(o.opacity,l.opacity);return function(d){return o.r=u(d),o.g=c(d),o.b=h(d),o.opacity=p(d),o+""}}return i.gamma=e,i})(1);function _s(e,n){return e=+e,n=+n,function(r){return e*(1-r)+n*r}}var pv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Pd=new RegExp(pv.source,"g");function m2(e){return function(){return e}}function g2(e){return function(n){return e(n)+""}}function v2(e,n){var r=pv.lastIndex=Pd.lastIndex=0,i,o,l,u=-1,c=[],h=[];for(e=e+"",n=n+"";(i=pv.exec(e))&&(o=Pd.exec(n));)(l=o.index)>r&&(l=n.slice(r,l),c[u]?c[u]+=l:c[++u]=l),(i=i[0])===(o=o[0])?c[u]?c[u]+=o:c[++u]=o:(c[++u]=null,h.push({i:u,x:_s(i,o)})),r=Pd.lastIndex;return r<n.length&&(l=n.slice(r),c[u]?c[u]+=l:c[++u]=l),c.length<2?h[0]?g2(h[0].x):m2(n):(n=h.length,function(p){for(var d=0,m;d<n;++d)c[(m=h[d]).i]=m.x(p);return c.join("")})}var ix=180/Math.PI,mv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function aN(e,n,r,i,o,l){var u,c,h;return(u=Math.sqrt(e*e+n*n))&&(e/=u,n/=u),(h=e*r+n*i)&&(r-=e*h,i-=n*h),(c=Math.sqrt(r*r+i*i))&&(r/=c,i/=c,h/=c),e*i<n*r&&(e=-e,n=-n,h=-h,u=-u),{translateX:o,translateY:l,rotate:Math.atan2(n,e)*ix,skewX:Math.atan(h)*ix,scaleX:u,scaleY:c}}var Yl;function y2(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?mv:aN(n.a,n.b,n.c,n.d,n.e,n.f)}function w2(e){return e==null||(Yl||(Yl=document.createElementNS("http://www.w3.org/2000/svg","g")),Yl.setAttribute("transform",e),!(e=Yl.transform.baseVal.consolidate()))?mv:(e=e.matrix,aN(e.a,e.b,e.c,e.d,e.e,e.f))}function lN(e,n,r,i){function o(p){return p.length?p.pop()+" ":""}function l(p,d,m,y,w,N){if(p!==m||d!==y){var _=w.push("translate(",null,n,null,r);N.push({i:_-4,x:_s(p,m)},{i:_-2,x:_s(d,y)})}else(m||y)&&w.push("translate("+m+n+y+r)}function u(p,d,m,y){p!==d?(p-d>180?d+=360:d-p>180&&(p+=360),y.push({i:m.push(o(m)+"rotate(",null,i)-2,x:_s(p,d)})):d&&m.push(o(m)+"rotate("+d+i)}function c(p,d,m,y){p!==d?y.push({i:m.push(o(m)+"skewX(",null,i)-2,x:_s(p,d)}):d&&m.push(o(m)+"skewX("+d+i)}function h(p,d,m,y,w,N){if(p!==m||d!==y){var _=w.push(o(w)+"scale(",null,",",null,")");N.push({i:_-4,x:_s(p,m)},{i:_-2,x:_s(d,y)})}else(m!==1||y!==1)&&w.push(o(w)+"scale("+m+","+y+")")}return function(p,d){var m=[],y=[];return p=e(p),d=e(d),l(p.translateX,p.translateY,d.translateX,d.translateY,m,y),u(p.rotate,d.rotate,m,y),c(p.skewX,d.skewX,m,y),h(p.scaleX,p.scaleY,d.scaleX,d.scaleY,m,y),p=d=null,function(w){for(var N=-1,_=y.length,b;++N<_;)m[(b=y[N]).i]=b.x(w);return m.join("")}}}var x2=lN(y2,"px, ","px)","deg)"),_2=lN(w2,", ",")",")"),b2=1e-12;function ox(e){return((e=Math.exp(e))+1/e)/2}function S2(e){return((e=Math.exp(e))-1/e)/2}function k2(e){return((e=Math.exp(2*e))-1)/(e+1)}const E2=(function e(n,r,i){function o(l,u){var c=l[0],h=l[1],p=l[2],d=u[0],m=u[1],y=u[2],w=d-c,N=m-h,_=w*w+N*N,b,S;if(_<b2)S=Math.log(y/p)/n,b=function(A){return[c+A*w,h+A*N,p*Math.exp(n*A*S)]};else{var k=Math.sqrt(_),E=(y*y-p*p+i*_)/(2*p*r*k),T=(y*y-p*p-i*_)/(2*y*r*k),I=Math.log(Math.sqrt(E*E+1)-E),O=Math.log(Math.sqrt(T*T+1)-T);S=(O-I)/n,b=function(A){var U=A*S,z=ox(I),P=p/(r*k)*(z*k2(n*U+I)-S2(I));return[c+P*w,h+P*N,p*z/ox(n*U+I)]}}return b.duration=S*1e3*n/Math.SQRT2,b}return o.rho=function(l){var u=Math.max(.001,+l),c=u*u,h=c*c;return e(u,c,h)},o})(Math.SQRT2,2,4);var lo=0,la=0,na=0,uN=1e3,vu,ua,yu=0,ci=0,ju=0,ya=typeof performance=="object"&&performance.now?performance:Date,cN=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function zv(){return ci||(cN(N2),ci=ya.now()+ju)}function N2(){ci=0}function wu(){this._call=this._time=this._next=null}wu.prototype=dN.prototype={constructor:wu,restart:function(e,n,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?zv():+r)+(n==null?0:+n),!this._next&&ua!==this&&(ua?ua._next=this:vu=this,ua=this),this._call=e,this._time=r,gv()},stop:function(){this._call&&(this._call=null,this._time=1/0,gv())}};function dN(e,n,r){var i=new wu;return i.restart(e,n,r),i}function C2(){zv(),++lo;for(var e=vu,n;e;)(n=ci-e._time)>=0&&e._call.call(void 0,n),e=e._next;--lo}function ax(){ci=(yu=ya.now())+ju,lo=la=0;try{C2()}finally{lo=0,R2(),ci=0}}function T2(){var e=ya.now(),n=e-yu;n>uN&&(ju-=n,yu=e)}function R2(){for(var e,n=vu,r,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:vu=r);ua=e,gv(i)}function gv(e){if(!lo){la&&(la=clearTimeout(la));var n=e-ci;n>24?(e<1/0&&(la=setTimeout(ax,e-ya.now()-ju)),na&&(na=clearInterval(na))):(na||(yu=ya.now(),na=setInterval(T2,uN)),lo=1,cN(ax))}}function lx(e,n,r){var i=new wu;return n=n==null?0:+n,i.restart(o=>{i.stop(),e(o+n)},n,r),i}var j2=Tu("start","end","cancel","interrupt"),A2=[],fN=0,ux=1,vv=2,uu=3,cx=4,yv=5,cu=6;function Au(e,n,r,i,o,l){var u=e.__transition;if(!u)e.__transition={};else if(r in u)return;I2(e,r,{name:n,index:i,group:o,on:j2,tween:A2,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:fN})}function Bv(e,n){var r=rr(e,n);if(r.state>fN)throw new Error("too late; already scheduled");return r}function pr(e,n){var r=rr(e,n);if(r.state>uu)throw new Error("too late; already running");return r}function rr(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function I2(e,n,r){var i=e.__transition,o;i[n]=r,r.timer=dN(l,0,r.time);function l(p){r.state=ux,r.timer.restart(u,r.delay,r.time),r.delay<=p&&u(p-r.delay)}function u(p){var d,m,y,w;if(r.state!==ux)return h();for(d in i)if(w=i[d],w.name===r.name){if(w.state===uu)return lx(u);w.state===cx?(w.state=cu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete i[d]):+d<n&&(w.state=cu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete i[d])}if(lx(function(){r.state===uu&&(r.state=cx,r.timer.restart(c,r.delay,r.time),c(p))}),r.state=vv,r.on.call("start",e,e.__data__,r.index,r.group),r.state===vv){for(r.state=uu,o=new Array(y=r.tween.length),d=0,m=-1;d<y;++d)(w=r.tween[d].value.call(e,e.__data__,r.index,r.group))&&(o[++m]=w);o.length=m+1}}function c(p){for(var d=p<r.duration?r.ease.call(null,p/r.duration):(r.timer.restart(h),r.state=yv,1),m=-1,y=o.length;++m<y;)o[m].call(e,d);r.state===yv&&(r.on.call("end",e,e.__data__,r.index,r.group),h())}function h(){r.state=cu,r.timer.stop(),delete i[n];for(var p in i)return;delete e.__transition}}function du(e,n){var r=e.__transition,i,o,l=!0,u;if(r){n=n==null?null:n+"";for(u in r){if((i=r[u]).name!==n){l=!1;continue}o=i.state>vv&&i.state<yv,i.state=cu,i.timer.stop(),i.on.call(o?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[u]}l&&delete e.__transition}}function M2(e){return this.each(function(){du(this,e)})}function O2(e,n){var r,i;return function(){var o=pr(this,e),l=o.tween;if(l!==r){i=r=l;for(var u=0,c=i.length;u<c;++u)if(i[u].name===n){i=i.slice(),i.splice(u,1);break}}o.tween=i}}function P2(e,n,r){var i,o;if(typeof r!="function")throw new Error;return function(){var l=pr(this,e),u=l.tween;if(u!==i){o=(i=u).slice();for(var c={name:n,value:r},h=0,p=o.length;h<p;++h)if(o[h].name===n){o[h]=c;break}h===p&&o.push(c)}l.tween=o}}function L2(e,n){var r=this._id;if(e+="",arguments.length<2){for(var i=rr(this.node(),r).tween,o=0,l=i.length,u;o<l;++o)if((u=i[o]).name===e)return u.value;return null}return this.each((n==null?O2:P2)(r,e,n))}function Uv(e,n,r){var i=e._id;return e.each(function(){var o=pr(this,i);(o.value||(o.value={}))[n]=r.apply(this,arguments)}),function(o){return rr(o,i).value[n]}}function hN(e,n){var r;return(typeof n=="number"?_s:n instanceof va?sx:(r=va(n))?(n=r,sx):v2)(e,n)}function $2(e){return function(){this.removeAttribute(e)}}function q2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function D2(e,n,r){var i,o=r+"",l;return function(){var u=this.getAttribute(e);return u===o?null:u===i?l:l=n(i=u,r)}}function F2(e,n,r){var i,o=r+"",l;return function(){var u=this.getAttributeNS(e.space,e.local);return u===o?null:u===i?l:l=n(i=u,r)}}function z2(e,n,r){var i,o,l;return function(){var u,c=r(this),h;return c==null?void this.removeAttribute(e):(u=this.getAttribute(e),h=c+"",u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c)))}}function B2(e,n,r){var i,o,l;return function(){var u,c=r(this),h;return c==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),h=c+"",u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c)))}}function U2(e,n){var r=Ru(e),i=r==="transform"?_2:hN;return this.attrTween(e,typeof n=="function"?(r.local?B2:z2)(r,i,Uv(this,"attr."+e,n)):n==null?(r.local?q2:$2)(r):(r.local?F2:D2)(r,i,n))}function H2(e,n){return function(r){this.setAttribute(e,n.call(this,r))}}function W2(e,n){return function(r){this.setAttributeNS(e.space,e.local,n.call(this,r))}}function V2(e,n){var r,i;function o(){var l=n.apply(this,arguments);return l!==i&&(r=(i=l)&&W2(e,l)),r}return o._value=n,o}function G2(e,n){var r,i;function o(){var l=n.apply(this,arguments);return l!==i&&(r=(i=l)&&H2(e,l)),r}return o._value=n,o}function Y2(e,n){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;var i=Ru(e);return this.tween(r,(i.local?V2:G2)(i,n))}function K2(e,n){return function(){Bv(this,e).delay=+n.apply(this,arguments)}}function X2(e,n){return n=+n,function(){Bv(this,e).delay=n}}function Q2(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?K2:X2)(n,e)):rr(this.node(),n).delay}function Z2(e,n){return function(){pr(this,e).duration=+n.apply(this,arguments)}}function J2(e,n){return n=+n,function(){pr(this,e).duration=n}}function eI(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?Z2:J2)(n,e)):rr(this.node(),n).duration}function tI(e,n){if(typeof n!="function")throw new Error;return function(){pr(this,e).ease=n}}function nI(e){var n=this._id;return arguments.length?this.each(tI(n,e)):rr(this.node(),n).ease}function rI(e,n){return function(){var r=n.apply(this,arguments);if(typeof r!="function")throw new Error;pr(this,e).ease=r}}function sI(e){if(typeof e!="function")throw new Error;return this.each(rI(this._id,e))}function iI(e){typeof e!="function"&&(e=WE(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=[],h,p=0;p<u;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&c.push(h);return new zr(i,this._parents,this._name,this._id)}function oI(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,r=e._groups,i=n.length,o=r.length,l=Math.min(i,o),u=new Array(i),c=0;c<l;++c)for(var h=n[c],p=r[c],d=h.length,m=u[c]=new Array(d),y,w=0;w<d;++w)(y=h[w]||p[w])&&(m[w]=y);for(;c<i;++c)u[c]=n[c];return new zr(u,this._parents,this._name,this._id)}function aI(e){return(e+"").trim().split(/^|\s+/).every(function(n){var r=n.indexOf(".");return r>=0&&(n=n.slice(0,r)),!n||n==="start"})}function lI(e,n,r){var i,o,l=aI(n)?Bv:pr;return function(){var u=l(this,e),c=u.on;c!==i&&(o=(i=c).copy()).on(n,r),u.on=o}}function uI(e,n){var r=this._id;return arguments.length<2?rr(this.node(),r).on.on(e):this.each(lI(r,e,n))}function cI(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function dI(){return this.on("end.remove",cI(this._id))}function fI(e){var n=this._name,r=this._id;typeof e!="function"&&(e=qv(e));for(var i=this._groups,o=i.length,l=new Array(o),u=0;u<o;++u)for(var c=i[u],h=c.length,p=l[u]=new Array(h),d,m,y=0;y<h;++y)(d=c[y])&&(m=e.call(d,d.__data__,y,c))&&("__data__"in d&&(m.__data__=d.__data__),p[y]=m,Au(p[y],n,r,y,p,rr(d,r)));return new zr(l,this._parents,n,r)}function hI(e){var n=this._name,r=this._id;typeof e!="function"&&(e=HE(e));for(var i=this._groups,o=i.length,l=[],u=[],c=0;c<o;++c)for(var h=i[c],p=h.length,d,m=0;m<p;++m)if(d=h[m]){for(var y=e.call(d,d.__data__,m,h),w,N=rr(d,r),_=0,b=y.length;_<b;++_)(w=y[_])&&Au(w,n,r,_,y,N);l.push(y),u.push(d)}return new zr(l,u,n,r)}var pI=Ea.prototype.constructor;function mI(){return new pI(this._groups,this._parents)}function gI(e,n){var r,i,o;return function(){var l=ao(this,e),u=(this.style.removeProperty(e),ao(this,e));return l===u?null:l===r&&u===i?o:o=n(r=l,i=u)}}function pN(e){return function(){this.style.removeProperty(e)}}function vI(e,n,r){var i,o=r+"",l;return function(){var u=ao(this,e);return u===o?null:u===i?l:l=n(i=u,r)}}function yI(e,n,r){var i,o,l;return function(){var u=ao(this,e),c=r(this),h=c+"";return c==null&&(h=c=(this.style.removeProperty(e),ao(this,e))),u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c))}}function wI(e,n){var r,i,o,l="style."+n,u="end."+l,c;return function(){var h=pr(this,e),p=h.on,d=h.value[l]==null?c||(c=pN(n)):void 0;(p!==r||o!==d)&&(i=(r=p).copy()).on(u,o=d),h.on=i}}function xI(e,n,r){var i=(e+="")=="transform"?x2:hN;return n==null?this.styleTween(e,gI(e,i)).on("end.style."+e,pN(e)):typeof n=="function"?this.styleTween(e,yI(e,i,Uv(this,"style."+e,n))).each(wI(this._id,e)):this.styleTween(e,vI(e,i,n),r).on("end.style."+e,null)}function _I(e,n,r){return function(i){this.style.setProperty(e,n.call(this,i),r)}}function bI(e,n,r){var i,o;function l(){var u=n.apply(this,arguments);return u!==o&&(i=(o=u)&&_I(e,u,r)),i}return l._value=n,l}function SI(e,n,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,bI(e,n,r??""))}function kI(e){return function(){this.textContent=e}}function EI(e){return function(){var n=e(this);this.textContent=n??""}}function NI(e){return this.tween("text",typeof e=="function"?EI(Uv(this,"text",e)):kI(e==null?"":e+""))}function CI(e){return function(n){this.textContent=e.call(this,n)}}function TI(e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&CI(o)),n}return i._value=e,i}function RI(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,TI(e))}function jI(){for(var e=this._name,n=this._id,r=mN(),i=this._groups,o=i.length,l=0;l<o;++l)for(var u=i[l],c=u.length,h,p=0;p<c;++p)if(h=u[p]){var d=rr(h,n);Au(h,e,r,p,u,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new zr(i,this._parents,e,r)}function AI(){var e,n,r=this,i=r._id,o=r.size();return new Promise(function(l,u){var c={value:u},h={value:function(){--o===0&&l()}};r.each(function(){var p=pr(this,i),d=p.on;d!==e&&(n=(e=d).copy(),n._.cancel.push(c),n._.interrupt.push(c),n._.end.push(h)),p.on=n}),o===0&&l()})}var II=0;function zr(e,n,r,i){this._groups=e,this._parents=n,this._name=r,this._id=i}function mN(){return++II}var qr=Ea.prototype;zr.prototype={constructor:zr,select:fI,selectAll:hI,selectChild:qr.selectChild,selectChildren:qr.selectChildren,filter:iI,merge:oI,selection:mI,transition:jI,call:qr.call,nodes:qr.nodes,node:qr.node,size:qr.size,empty:qr.empty,each:qr.each,on:uI,attr:U2,attrTween:Y2,style:xI,styleTween:SI,text:NI,textTween:RI,remove:dI,tween:L2,delay:Q2,duration:eI,ease:nI,easeVarying:sI,end:AI,[Symbol.iterator]:qr[Symbol.iterator]};function MI(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var OI={time:null,delay:0,duration:250,ease:MI};function PI(e,n){for(var r;!(r=e.__transition)||!(r=r[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return r}function LI(e){var n,r;e instanceof zr?(n=e._id,e=e._name):(n=mN(),(r=OI).time=zv(),e=e==null?null:e+"");for(var i=this._groups,o=i.length,l=0;l<o;++l)for(var u=i[l],c=u.length,h,p=0;p<c;++p)(h=u[p])&&Au(h,e,n,p,u,r||PI(h,n));return new zr(i,this._parents,e,n)}Ea.prototype.interrupt=M2;Ea.prototype.transition=LI;const Kl=e=>()=>e;function $I(e,{sourceEvent:n,target:r,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Dr(e,n,r){this.k=e,this.x=n,this.y=r}Dr.prototype={constructor:Dr,scale:function(e){return e===1?this:new Dr(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Dr(this.k,this.x+this.k*e,this.y+this.k*n)},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 Fr=new Dr(1,0,0);Dr.prototype;function Ld(e){e.stopImmediatePropagation()}function ra(e){e.preventDefault(),e.stopImmediatePropagation()}function qI(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function DI(){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 dx(){return this.__zoom||Fr}function FI(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function zI(){return navigator.maxTouchPoints||"ontouchstart"in this}function BI(e,n,r){var i=e.invertX(n[0][0])-r[0][0],o=e.invertX(n[1][0])-r[1][0],l=e.invertY(n[0][1])-r[0][1],u=e.invertY(n[1][1])-r[1][1];return e.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function gN(){var e=qI,n=DI,r=BI,i=FI,o=zI,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],c=250,h=E2,p=Tu("start","zoom","end"),d,m,y,w=500,N=150,_=0,b=10;function S(C){C.property("__zoom",dx).on("wheel.zoom",U,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",P).filter(o).on("touchstart.zoom",D).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(C,q,L,re){var Z=C.selection?C.selection():C;Z.property("__zoom",dx),C!==Z?I(C,q,L,re):Z.interrupt().each(function(){O(this,arguments).event(re).start().zoom(null,typeof q=="function"?q.apply(this,arguments):q).end()})},S.scaleBy=function(C,q,L,re){S.scaleTo(C,function(){var Z=this.__zoom.k,H=typeof q=="function"?q.apply(this,arguments):q;return Z*H},L,re)},S.scaleTo=function(C,q,L,re){S.transform(C,function(){var Z=n.apply(this,arguments),H=this.__zoom,J=L==null?T(Z):typeof L=="function"?L.apply(this,arguments):L,M=H.invert(J),G=typeof q=="function"?q.apply(this,arguments):q;return r(E(k(H,G),J,M),Z,u)},L,re)},S.translateBy=function(C,q,L,re){S.transform(C,function(){return r(this.__zoom.translate(typeof q=="function"?q.apply(this,arguments):q,typeof L=="function"?L.apply(this,arguments):L),n.apply(this,arguments),u)},null,re)},S.translateTo=function(C,q,L,re,Z){S.transform(C,function(){var H=n.apply(this,arguments),J=this.__zoom,M=re==null?T(H):typeof re=="function"?re.apply(this,arguments):re;return r(Fr.translate(M[0],M[1]).scale(J.k).translate(typeof q=="function"?-q.apply(this,arguments):-q,typeof L=="function"?-L.apply(this,arguments):-L),H,u)},re,Z)};function k(C,q){return q=Math.max(l[0],Math.min(l[1],q)),q===C.k?C:new Dr(q,C.x,C.y)}function E(C,q,L){var re=q[0]-L[0]*C.k,Z=q[1]-L[1]*C.k;return re===C.x&&Z===C.y?C:new Dr(C.k,re,Z)}function T(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function I(C,q,L,re){C.on("start.zoom",function(){O(this,arguments).event(re).start()}).on("interrupt.zoom end.zoom",function(){O(this,arguments).event(re).end()}).tween("zoom",function(){var Z=this,H=arguments,J=O(Z,H).event(re),M=n.apply(Z,H),G=L==null?T(M):typeof L=="function"?L.apply(Z,H):L,Y=Math.max(M[1][0]-M[0][0],M[1][1]-M[0][1]),$=Z.__zoom,Q=typeof q=="function"?q.apply(Z,H):q,ne=h($.invert(G).concat(Y/$.k),Q.invert(G).concat(Y/Q.k));return function(oe){if(oe===1)oe=Q;else{var fe=ne(oe),te=Y/fe[2];oe=new Dr(te,G[0]-fe[0]*te,G[1]-fe[1]*te)}J.zoom(null,oe)}})}function O(C,q,L){return!L&&C.__zooming||new A(C,q)}function A(C,q){this.that=C,this.args=q,this.active=0,this.sourceEvent=null,this.extent=n.apply(C,q),this.taps=0}A.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,q){return this.mouse&&C!=="mouse"&&(this.mouse[1]=q.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=q.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=q.invert(this.touch1[0])),this.that.__zoom=q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var q=Ln(this.that).datum();p.call(C,this.that,new $I(C,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:p}),q)}};function U(C,...q){if(!e.apply(this,arguments))return;var L=O(this,q).event(C),re=this.__zoom,Z=Math.max(l[0],Math.min(l[1],re.k*Math.pow(2,i.apply(this,arguments)))),H=Jn(C);if(L.wheel)(L.mouse[0][0]!==H[0]||L.mouse[0][1]!==H[1])&&(L.mouse[1]=re.invert(L.mouse[0]=H)),clearTimeout(L.wheel);else{if(re.k===Z)return;L.mouse=[H,re.invert(H)],du(this),L.start()}ra(C),L.wheel=setTimeout(J,N),L.zoom("mouse",r(E(k(re,Z),L.mouse[0],L.mouse[1]),L.extent,u));function J(){L.wheel=null,L.end()}}function z(C,...q){if(y||!e.apply(this,arguments))return;var L=C.currentTarget,re=O(this,q,!0).event(C),Z=Ln(C.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",Y,!0),H=Jn(C,L),J=C.clientX,M=C.clientY;tN(C.view),Ld(C),re.mouse=[H,this.__zoom.invert(H)],du(this),re.start();function G($){if(ra($),!re.moved){var Q=$.clientX-J,ne=$.clientY-M;re.moved=Q*Q+ne*ne>_}re.event($).zoom("mouse",r(E(re.that.__zoom,re.mouse[0]=Jn($,L),re.mouse[1]),re.extent,u))}function Y($){Z.on("mousemove.zoom mouseup.zoom",null),nN($.view,re.moved),ra($),re.event($).end()}}function P(C,...q){if(e.apply(this,arguments)){var L=this.__zoom,re=Jn(C.changedTouches?C.changedTouches[0]:C,this),Z=L.invert(re),H=L.k*(C.shiftKey?.5:2),J=r(E(k(L,H),re,Z),n.apply(this,q),u);ra(C),c>0?Ln(this).transition().duration(c).call(I,J,re,C):Ln(this).call(S.transform,J,re,C)}}function D(C,...q){if(e.apply(this,arguments)){var L=C.touches,re=L.length,Z=O(this,q,C.changedTouches.length===re).event(C),H,J,M,G;for(Ld(C),J=0;J<re;++J)M=L[J],G=Jn(M,this),G=[G,this.__zoom.invert(G),M.identifier],Z.touch0?!Z.touch1&&Z.touch0[2]!==G[2]&&(Z.touch1=G,Z.taps=0):(Z.touch0=G,H=!0,Z.taps=1+!!d);d&&(d=clearTimeout(d)),H&&(Z.taps<2&&(m=G[0],d=setTimeout(function(){d=null},w)),du(this),Z.start())}}function V(C,...q){if(this.__zooming){var L=O(this,q).event(C),re=C.changedTouches,Z=re.length,H,J,M,G;for(ra(C),H=0;H<Z;++H)J=re[H],M=Jn(J,this),L.touch0&&L.touch0[2]===J.identifier?L.touch0[0]=M:L.touch1&&L.touch1[2]===J.identifier&&(L.touch1[0]=M);if(J=L.that.__zoom,L.touch1){var Y=L.touch0[0],$=L.touch0[1],Q=L.touch1[0],ne=L.touch1[1],oe=(oe=Q[0]-Y[0])*oe+(oe=Q[1]-Y[1])*oe,fe=(fe=ne[0]-$[0])*fe+(fe=ne[1]-$[1])*fe;J=k(J,Math.sqrt(oe/fe)),M=[(Y[0]+Q[0])/2,(Y[1]+Q[1])/2],G=[($[0]+ne[0])/2,($[1]+ne[1])/2]}else if(L.touch0)M=L.touch0[0],G=L.touch0[1];else return;L.zoom("touch",r(E(J,M,G),L.extent,u))}}function B(C,...q){if(this.__zooming){var L=O(this,q).event(C),re=C.changedTouches,Z=re.length,H,J;for(Ld(C),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),H=0;H<Z;++H)J=re[H],L.touch0&&L.touch0[2]===J.identifier?delete L.touch0:L.touch1&&L.touch1[2]===J.identifier&&delete L.touch1;if(L.touch1&&!L.touch0&&(L.touch0=L.touch1,delete L.touch1),L.touch0)L.touch0[1]=this.__zoom.invert(L.touch0[0]);else if(L.end(),L.taps===2&&(J=Jn(J,this),Math.hypot(m[0]-J[0],m[1]-J[1])<b)){var M=Ln(this).on("dblclick.zoom");M&&M.apply(this,arguments)}}}return S.wheelDelta=function(C){return arguments.length?(i=typeof C=="function"?C:Kl(+C),S):i},S.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Kl(!!C),S):e},S.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:Kl(!!C),S):o},S.extent=function(C){return arguments.length?(n=typeof C=="function"?C:Kl([[+C[0][0],+C[0][1]],[+C[1][0],+C[1][1]]]),S):n},S.scaleExtent=function(C){return arguments.length?(l[0]=+C[0],l[1]=+C[1],S):[l[0],l[1]]},S.translateExtent=function(C){return arguments.length?(u[0][0]=+C[0][0],u[1][0]=+C[1][0],u[0][1]=+C[0][1],u[1][1]=+C[1][1],S):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},S.constrain=function(C){return arguments.length?(r=C,S):r},S.duration=function(C){return arguments.length?(c=+C,S):c},S.interpolate=function(C){return arguments.length?(h=C,S):h},S.on=function(){var C=p.on.apply(p,arguments);return C===p?S:C},S.clickDistance=function(C){return arguments.length?(_=(C=+C)*C,S):Math.sqrt(_)},S.tapDistance=function(C){return arguments.length?(b=+C,S):b},S}var UI=zE();const Iu=j.createContext(null),HI=Iu.Provider,Br={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,n)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?n.targetHandle:n.sourceHandle}", edge id: ${n.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.`},vN=Br.error001();function Ke(e,n){const r=j.useContext(Iu);if(r===null)throw new Error(vN);return BE(r,e,n)}const Tt=()=>{const e=j.useContext(Iu);if(e===null)throw new Error(vN);return j.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},WI=e=>e.userSelectionActive?"none":"all";function Hv({position:e,children:n,className:r,style:i,...o}){const l=Ke(WI),u=`${e}`.split("-");return ue.createElement("div",{className:Dt(["react-flow__panel",r,...u]),style:{...i,pointerEvents:l},...o},n)}function VI({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:ue.createElement(Hv,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},ue.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const GI=({x:e,y:n,label:r,labelStyle:i={},labelShowBg:o=!0,labelBgStyle:l={},labelBgPadding:u=[2,4],labelBgBorderRadius:c=2,children:h,className:p,...d})=>{const m=j.useRef(null),[y,w]=j.useState({x:0,y:0,width:0,height:0}),N=Dt(["react-flow__edge-textwrapper",p]);return j.useEffect(()=>{if(m.current){const _=m.current.getBBox();w({x:_.x,y:_.y,width:_.width,height:_.height})}},[r]),typeof r>"u"||!r?null:ue.createElement("g",{transform:`translate(${e-y.width/2} ${n-y.height/2})`,className:N,visibility:y.width?"visible":"hidden",...d},o&&ue.createElement("rect",{width:y.width+2*u[0],x:-u[0],y:-u[1],height:y.height+2*u[1],className:"react-flow__edge-textbg",style:l,rx:c,ry:c}),ue.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:i},r),h)};var YI=j.memo(GI);const Wv=e=>({width:e.offsetWidth,height:e.offsetHeight}),uo=(e,n=0,r=1)=>Math.min(Math.max(e,n),r),Vv=(e={x:0,y:0},n)=>({x:uo(e.x,n[0][0],n[1][0]),y:uo(e.y,n[0][1],n[1][1])}),fx=(e,n,r)=>e<n?uo(Math.abs(e-n),1,50)/50:e>r?-uo(Math.abs(e-r),1,50)/50:0,yN=(e,n)=>{const r=fx(e.x,35,n.width-35)*20,i=fx(e.y,35,n.height-35)*20;return[r,i]},wN=e=>{var n;return((n=e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},xN=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),wa=({x:e,y:n,width:r,height:i})=>({x:e,y:n,x2:e+r,y2:n+i}),_N=({x:e,y:n,x2:r,y2:i})=>({x:e,y:n,width:r-e,height:i-n}),hx=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),KI=(e,n)=>_N(xN(wa(e),wa(n))),wv=(e,n)=>{const r=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(r*i)},XI=e=>$n(e.width)&&$n(e.height)&&$n(e.x)&&$n(e.y),$n=e=>!isNaN(e)&&isFinite(e),yt=Symbol.for("internals"),bN=["Enter"," ","Escape"],QI=(e,n)=>{},ZI=e=>"nativeEvent"in e;function xv(e){var o,l;const n=ZI(e)?e.nativeEvent:e,r=((l=(o=n.composedPath)==null?void 0:o.call(n))==null?void 0:l[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(r==null?void 0:r.nodeName)||(r==null?void 0:r.hasAttribute("contenteditable"))||!!(r!=null&&r.closest(".nokey"))}const SN=e=>"clientX"in e,ks=(e,n)=>{var l,u;const r=SN(e),i=r?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,o=r?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:i-((n==null?void 0:n.left)??0),y:o-((n==null?void 0:n.top)??0)}},xu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Ca=({id:e,path:n,labelX:r,labelY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w=20})=>ue.createElement(ue.Fragment,null,ue.createElement("path",{id:e,style:d,d:n,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),w&&ue.createElement("path",{d:n,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),o&&$n(r)&&$n(i)?ue.createElement(YI,{x:r,y:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p}):null);Ca.displayName="BaseEdge";function sa(e,n,r){return r===void 0?r:i=>{const o=n().edges.find(l=>l.id===e);o&&r(i,{...o})}}function kN({sourceX:e,sourceY:n,targetX:r,targetY:i}){const o=Math.abs(r-e)/2,l=r<e?r+o:r-o,u=Math.abs(i-n)/2,c=i<n?i+u:i-u;return[l,c,o,u]}function EN({sourceX:e,sourceY:n,targetX:r,targetY:i,sourceControlX:o,sourceControlY:l,targetControlX:u,targetControlY:c}){const h=e*.125+o*.375+u*.375+r*.125,p=n*.125+l*.375+c*.375+i*.125,d=Math.abs(h-e),m=Math.abs(p-n);return[h,p,d,m]}var di;(function(e){e.Strict="strict",e.Loose="loose"})(di||(di={}));var ai;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ai||(ai={}));var xa;(function(e){e.Partial="partial",e.Full="full"})(xa||(xa={}));var Ss;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ss||(Ss={}));var _u;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(_u||(_u={}));var Ae;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ae||(Ae={}));function px({pos:e,x1:n,y1:r,x2:i,y2:o}){return e===Ae.Left||e===Ae.Right?[.5*(n+i),r]:[n,.5*(r+o)]}function NN({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top}){const[u,c]=px({pos:r,x1:e,y1:n,x2:i,y2:o}),[h,p]=px({pos:l,x1:i,y1:o,x2:e,y2:n}),[d,m,y,w]=EN({sourceX:e,sourceY:n,targetX:i,targetY:o,sourceControlX:u,sourceControlY:c,targetControlX:h,targetControlY:p});return[`M${e},${n} C${u},${c} ${h},${p} ${i},${o}`,d,m,y,w]}const Gv=j.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,sourcePosition:o=Ae.Bottom,targetPosition:l=Ae.Top,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})=>{const[b,S,k]=NN({sourceX:e,sourceY:n,sourcePosition:o,targetX:r,targetY:i,targetPosition:l});return ue.createElement(Ca,{path:b,labelX:S,labelY:k,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})});Gv.displayName="SimpleBezierEdge";const mx={[Ae.Left]:{x:-1,y:0},[Ae.Right]:{x:1,y:0},[Ae.Top]:{x:0,y:-1},[Ae.Bottom]:{x:0,y:1}},JI=({source:e,sourcePosition:n=Ae.Bottom,target:r})=>n===Ae.Left||n===Ae.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},gx=(e,n)=>Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function eM({source:e,sourcePosition:n=Ae.Bottom,target:r,targetPosition:i=Ae.Top,center:o,offset:l}){const u=mx[n],c=mx[i],h={x:e.x+u.x*l,y:e.y+u.y*l},p={x:r.x+c.x*l,y:r.y+c.y*l},d=JI({source:h,sourcePosition:n,target:p}),m=d.x!==0?"x":"y",y=d[m];let w=[],N,_;const b={x:0,y:0},S={x:0,y:0},[k,E,T,I]=kN({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(u[m]*c[m]===-1){N=o.x??k,_=o.y??E;const A=[{x:N,y:h.y},{x:N,y:p.y}],U=[{x:h.x,y:_},{x:p.x,y:_}];u[m]===y?w=m==="x"?A:U:w=m==="x"?U:A}else{const A=[{x:h.x,y:p.y}],U=[{x:p.x,y:h.y}];if(m==="x"?w=u.x===y?U:A:w=u.y===y?A:U,n===i){const B=Math.abs(e[m]-r[m]);if(B<=l){const C=Math.min(l-1,l-B);u[m]===y?b[m]=(h[m]>e[m]?-1:1)*C:S[m]=(p[m]>r[m]?-1:1)*C}}if(n!==i){const B=m==="x"?"y":"x",C=u[m]===c[B],q=h[B]>p[B],L=h[B]<p[B];(u[m]===1&&(!C&&q||C&&L)||u[m]!==1&&(!C&&L||C&&q))&&(w=m==="x"?A:U)}const z={x:h.x+b.x,y:h.y+b.y},P={x:p.x+S.x,y:p.y+S.y},D=Math.max(Math.abs(z.x-w[0].x),Math.abs(P.x-w[0].x)),V=Math.max(Math.abs(z.y-w[0].y),Math.abs(P.y-w[0].y));D>=V?(N=(z.x+P.x)/2,_=w[0].y):(N=w[0].x,_=(z.y+P.y)/2)}return[[e,{x:h.x+b.x,y:h.y+b.y},...w,{x:p.x+S.x,y:p.y+S.y},r],N,_,T,I]}function tM(e,n,r,i){const o=Math.min(gx(e,n)/2,gx(n,r)/2,i),{x:l,y:u}=n;if(e.x===l&&l===r.x||e.y===u&&u===r.y)return`L${l} ${u}`;if(e.y===u){const p=e.x<r.x?-1:1,d=e.y<r.y?1:-1;return`L ${l+o*p},${u}Q ${l},${u} ${l},${u+o*d}`}const c=e.x<r.x?1:-1,h=e.y<r.y?-1:1;return`L ${l},${u+o*h}Q ${l},${u} ${l+o*c},${u}`}function _v({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top,borderRadius:u=5,centerX:c,centerY:h,offset:p=20}){const[d,m,y,w,N]=eM({source:{x:e,y:n},sourcePosition:r,target:{x:i,y:o},targetPosition:l,center:{x:c,y:h},offset:p});return[d.reduce((b,S,k)=>{let E="";return k>0&&k<d.length-1?E=tM(d[k-1],S,d[k+1],u):E=`${k===0?"M":"L"}${S.x} ${S.y}`,b+=E,b},""),m,y,w,N]}const Mu=j.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,sourcePosition:m=Ae.Bottom,targetPosition:y=Ae.Top,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:b})=>{const[S,k,E]=_v({sourceX:e,sourceY:n,sourcePosition:m,targetX:r,targetY:i,targetPosition:y,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset});return ue.createElement(Ca,{path:S,labelX:k,labelY:E,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:w,markerStart:N,interactionWidth:b})});Mu.displayName="SmoothStepEdge";const Yv=j.memo(e=>{var n;return ue.createElement(Mu,{...e,pathOptions:j.useMemo(()=>{var r;return{borderRadius:0,offset:(r=e.pathOptions)==null?void 0:r.offset}},[(n=e.pathOptions)==null?void 0:n.offset])})});Yv.displayName="StepEdge";function nM({sourceX:e,sourceY:n,targetX:r,targetY:i}){const[o,l,u,c]=kN({sourceX:e,sourceY:n,targetX:r,targetY:i});return[`M ${e},${n}L ${r},${i}`,o,l,u,c]}const Kv=j.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[N,_,b]=nM({sourceX:e,sourceY:n,targetX:r,targetY:i});return ue.createElement(Ca,{path:N,labelX:_,labelY:b,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w})});Kv.displayName="StraightEdge";function Xl(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function vx({pos:e,x1:n,y1:r,x2:i,y2:o,c:l}){switch(e){case Ae.Left:return[n-Xl(n-i,l),r];case Ae.Right:return[n+Xl(i-n,l),r];case Ae.Top:return[n,r-Xl(r-o,l)];case Ae.Bottom:return[n,r+Xl(o-r,l)]}}function CN({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top,curvature:u=.25}){const[c,h]=vx({pos:r,x1:e,y1:n,x2:i,y2:o,c:u}),[p,d]=vx({pos:l,x1:i,y1:o,x2:e,y2:n,c:u}),[m,y,w,N]=EN({sourceX:e,sourceY:n,targetX:i,targetY:o,sourceControlX:c,sourceControlY:h,targetControlX:p,targetControlY:d});return[`M${e},${n} C${c},${h} ${p},${d} ${i},${o}`,m,y,w,N]}const bu=j.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,sourcePosition:o=Ae.Bottom,targetPosition:l=Ae.Top,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:b})=>{const[S,k,E]=CN({sourceX:e,sourceY:n,sourcePosition:o,targetX:r,targetY:i,targetPosition:l,curvature:_==null?void 0:_.curvature});return ue.createElement(Ca,{path:S,labelX:k,labelY:E,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:b})});bu.displayName="BezierEdge";const Xv=j.createContext(null),rM=Xv.Provider;Xv.Consumer;const sM=()=>j.useContext(Xv),iM=e=>"id"in e&&"source"in e&&"target"in e,oM=({source:e,sourceHandle:n,target:r,targetHandle:i})=>`reactflow__edge-${e}${n||""}-${r}${i||""}`,bv=(e,n)=>typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`,aM=(e,n)=>n.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),lM=(e,n)=>{if(!e.source||!e.target)return n;let r;return iM(e)?r={...e}:r={...e,id:oM(e)},aM(r,n)?n:n.concat(r)},Sv=({x:e,y:n},[r,i,o],l,[u,c])=>{const h={x:(e-r)/o,y:(n-i)/o};return l?{x:u*Math.round(h.x/u),y:c*Math.round(h.y/c)}:h},TN=({x:e,y:n},[r,i,o])=>({x:e*o+r,y:n*o+i}),ui=(e,n=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const r=(e.width??0)*n[0],i=(e.height??0)*n[1],o={x:e.position.x-r,y:e.position.y-i};return{...o,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-r,y:e.positionAbsolute.y-i}:o}},Ou=(e,n=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((i,o)=>{const{x:l,y:u}=ui(o,n).positionAbsolute;return xN(i,wa({x:l,y:u,width:o.width||0,height:o.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return _N(r)},RN=(e,n,[r,i,o]=[0,0,1],l=!1,u=!1,c=[0,0])=>{const h={x:(n.x-r)/o,y:(n.y-i)/o,width:n.width/o,height:n.height/o},p=[];return e.forEach(d=>{const{width:m,height:y,selectable:w=!0,hidden:N=!1}=d;if(u&&!w||N)return!1;const{positionAbsolute:_}=ui(d,c),b={x:_.x,y:_.y,width:m||0,height:y||0},S=wv(h,b),k=typeof m>"u"||typeof y>"u"||m===null||y===null,E=l&&S>0,T=(m||0)*(y||0);(k||E||S>=T||d.dragging)&&p.push(d)}),p},jN=(e,n)=>{const r=e.map(i=>i.id);return n.filter(i=>r.includes(i.source)||r.includes(i.target))},AN=(e,n,r,i,o,l=.1)=>{const u=n/(e.width*(1+l)),c=r/(e.height*(1+l)),h=Math.min(u,c),p=uo(h,i,o),d=e.x+e.width/2,m=e.y+e.height/2,y=n/2-d*p,w=r/2-m*p;return{x:y,y:w,zoom:p}},ii=(e,n=0)=>e.transition().duration(n);function yx(e,n,r,i){return(n[r]||[]).reduce((o,l)=>{var u,c;return`${e.id}-${l.id}-${r}`!==i&&o.push({id:l.id||null,type:r,nodeId:e.id,x:(((u=e.positionAbsolute)==null?void 0:u.x)??0)+l.x+l.width/2,y:(((c=e.positionAbsolute)==null?void 0:c.y)??0)+l.y+l.height/2}),o},[])}function uM(e,n,r,i,o,l){const{x:u,y:c}=ks(e),p=n.elementsFromPoint(u,c).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const _=Qv(void 0,p),b=p.getAttribute("data-handleid"),S=l({nodeId:N,id:b,type:_});if(S){const k=o.find(E=>E.nodeId===N&&E.type===_&&E.id===b);return{handle:{id:b,type:_,nodeId:N,x:(k==null?void 0:k.x)||r.x,y:(k==null?void 0:k.y)||r.y},validHandleResult:S}}}}let d=[],m=1/0;if(o.forEach(N=>{const _=Math.sqrt((N.x-r.x)**2+(N.y-r.y)**2);if(_<=i){const b=l(N);_<=m&&(_<m?d=[{handle:N,validHandleResult:b}]:_===m&&d.push({handle:N,validHandleResult:b}),m=_)}}),!d.length)return{handle:null,validHandleResult:IN()};if(d.length===1)return d[0];const y=d.some(({validHandleResult:N})=>N.isValid),w=d.some(({handle:N})=>N.type==="target");return d.find(({handle:N,validHandleResult:_})=>w?N.type==="target":y?_.isValid:!0)||d[0]}const cM={source:null,target:null,sourceHandle:null,targetHandle:null},IN=()=>({handleDomNode:null,isValid:!1,connection:cM,endHandle:null});function MN(e,n,r,i,o,l,u){const c=o==="target",h=u.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={...IN(),handleDomNode:h};if(h){const d=Qv(void 0,h),m=h.getAttribute("data-nodeid"),y=h.getAttribute("data-handleid"),w=h.classList.contains("connectable"),N=h.classList.contains("connectableend"),_={source:c?m:r,sourceHandle:c?y:i,target:c?r:m,targetHandle:c?i:y};p.connection=_,w&&N&&(n===di.Strict?c&&d==="source"||!c&&d==="target":m!==r||y!==i)&&(p.endHandle={nodeId:m,handleId:y,type:d},p.isValid=l(_))}return p}function dM({nodes:e,nodeId:n,handleId:r,handleType:i}){return e.reduce((o,l)=>{if(l[yt]){const{handleBounds:u}=l[yt];let c=[],h=[];u&&(c=yx(l,u,"source",`${n}-${r}-${i}`),h=yx(l,u,"target",`${n}-${r}-${i}`)),o.push(...c,...h)}return o},[])}function Qv(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function $d(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function fM(e,n){let r=null;return n?r="valid":e&&!n&&(r="invalid"),r}function ON({event:e,handleId:n,nodeId:r,onConnect:i,isTarget:o,getState:l,setState:u,isValidConnection:c,edgeUpdaterType:h,onReconnectEnd:p}){const d=wN(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:_,panBy:b,getNodes:S,cancelConnection:k}=l();let E=0,T;const{x:I,y:O}=ks(e),A=d==null?void 0:d.elementFromPoint(I,O),U=Qv(h,A),z=y==null?void 0:y.getBoundingClientRect();if(!z||!U)return;let P,D=ks(e,z),V=!1,B=null,C=!1,q=null;const L=dM({nodes:S(),nodeId:r,handleId:n,handleType:U}),re=()=>{if(!w)return;const[J,M]=yN(D,z);b({x:J,y:M}),E=requestAnimationFrame(re)};u({connectionPosition:D,connectionStatus:null,connectionNodeId:r,connectionHandleId:n,connectionHandleType:U,connectionStartHandle:{nodeId:r,handleId:n,type:U},connectionEndHandle:null}),_==null||_(e,{nodeId:r,handleId:n,handleType:U});function Z(J){const{transform:M}=l();D=ks(J,z);const{handle:G,validHandleResult:Y}=uM(J,d,Sv(D,M,!1,[1,1]),N,L,$=>MN($,m,r,n,o?"target":"source",c,d));if(T=G,V||(re(),V=!0),q=Y.handleDomNode,B=Y.connection,C=Y.isValid,u({connectionPosition:T&&C?TN({x:T.x,y:T.y},M):D,connectionStatus:fM(!!T,C),connectionEndHandle:Y.endHandle}),!T&&!C&&!q)return $d(P);B.source!==B.target&&q&&($d(P),P=q,q.classList.add("connecting","react-flow__handle-connecting"),q.classList.toggle("valid",C),q.classList.toggle("react-flow__handle-valid",C))}function H(J){var M,G;(T||q)&&B&&C&&(i==null||i(B)),(G=(M=l()).onConnectEnd)==null||G.call(M,J),h&&(p==null||p(J)),$d(P),k(),cancelAnimationFrame(E),V=!1,C=!1,B=null,q=null,d.removeEventListener("mousemove",Z),d.removeEventListener("mouseup",H),d.removeEventListener("touchmove",Z),d.removeEventListener("touchend",H)}d.addEventListener("mousemove",Z),d.addEventListener("mouseup",H),d.addEventListener("touchmove",Z),d.addEventListener("touchend",H)}const wx=()=>!0,hM=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),pM=(e,n,r)=>i=>{const{connectionStartHandle:o,connectionEndHandle:l,connectionClickStartHandle:u}=i;return{connecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===n&&(o==null?void 0:o.type)===r||(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===n&&(l==null?void 0:l.type)===r,clickConnecting:(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.handleId)===n&&(u==null?void 0:u.type)===r}},PN=j.forwardRef(({type:e="source",position:n=Ae.Top,isValidConnection:r,isConnectable:i=!0,isConnectableStart:o=!0,isConnectableEnd:l=!0,id:u,onConnect:c,children:h,className:p,onMouseDown:d,onTouchStart:m,...y},w)=>{var z,P;const N=u||null,_=e==="target",b=Tt(),S=sM(),{connectOnClick:k,noPanClassName:E}=Ke(hM,Ct),{connecting:T,clickConnecting:I}=Ke(pM(S,N,e),Ct);S||(P=(z=b.getState()).onError)==null||P.call(z,"010",Br.error010());const O=D=>{const{defaultEdgeOptions:V,onConnect:B,hasDefaultEdges:C}=b.getState(),q={...V,...D};if(C){const{edges:L,setEdges:re}=b.getState();re(lM(q,L))}B==null||B(q),c==null||c(q)},A=D=>{if(!S)return;const V=SN(D);o&&(V&&D.button===0||!V)&&ON({event:D,handleId:N,nodeId:S,onConnect:O,isTarget:_,getState:b.getState,setState:b.setState,isValidConnection:r||b.getState().isValidConnection||wx}),V?d==null||d(D):m==null||m(D)},U=D=>{const{onClickConnectStart:V,onClickConnectEnd:B,connectionClickStartHandle:C,connectionMode:q,isValidConnection:L}=b.getState();if(!S||!C&&!o)return;if(!C){V==null||V(D,{nodeId:S,handleId:N,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:S,type:e,handleId:N}});return}const re=wN(D.target),Z=r||L||wx,{connection:H,isValid:J}=MN({nodeId:S,id:N,type:e},q,C.nodeId,C.handleId||null,C.type,Z,re);J&&O(H),B==null||B(D),b.setState({connectionClickStartHandle:null})};return ue.createElement("div",{"data-handleid":N,"data-nodeid":S,"data-handlepos":n,"data-id":`${S}-${N}-${e}`,className:Dt(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",E,p,{source:!_,target:_,connectable:i,connectablestart:o,connectableend:l,connecting:I,connectionindicator:i&&(o&&!T||l&&T)}]),onMouseDown:A,onTouchStart:A,onClick:k?U:void 0,ref:w,...y},h)});PN.displayName="Handle";var co=j.memo(PN);const LN=({data:e,isConnectable:n,targetPosition:r=Ae.Top,sourcePosition:i=Ae.Bottom})=>ue.createElement(ue.Fragment,null,ue.createElement(co,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label,ue.createElement(co,{type:"source",position:i,isConnectable:n}));LN.displayName="DefaultNode";var kv=j.memo(LN);const $N=({data:e,isConnectable:n,sourcePosition:r=Ae.Bottom})=>ue.createElement(ue.Fragment,null,e==null?void 0:e.label,ue.createElement(co,{type:"source",position:r,isConnectable:n}));$N.displayName="InputNode";var qN=j.memo($N);const DN=({data:e,isConnectable:n,targetPosition:r=Ae.Top})=>ue.createElement(ue.Fragment,null,ue.createElement(co,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label);DN.displayName="OutputNode";var FN=j.memo(DN);const Zv=()=>null;Zv.displayName="GroupNode";const mM=e=>({selectedNodes:e.getNodes().filter(n=>n.selected),selectedEdges:e.edges.filter(n=>n.selected).map(n=>({...n}))}),Ql=e=>e.id;function gM(e,n){return Ct(e.selectedNodes.map(Ql),n.selectedNodes.map(Ql))&&Ct(e.selectedEdges.map(Ql),n.selectedEdges.map(Ql))}const zN=j.memo(({onSelectionChange:e})=>{const n=Tt(),{selectedNodes:r,selectedEdges:i}=Ke(mM,gM);return j.useEffect(()=>{const o={nodes:r,edges:i};e==null||e(o),n.getState().onSelectionChange.forEach(l=>l(o))},[r,i,e]),null});zN.displayName="SelectionListener";const vM=e=>!!e.onSelectionChange;function yM({onSelectionChange:e}){const n=Ke(vM);return e||n?ue.createElement(zN,{onSelectionChange:e}):null}const wM=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 Yi(e,n){j.useEffect(()=>{typeof e<"u"&&n(e)},[e])}function $e(e,n,r){j.useEffect(()=>{typeof n<"u"&&r({[e]:n})},[n])}const xM=({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,onConnect:o,onConnectStart:l,onConnectEnd:u,onClickConnectStart:c,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:d,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:_,maxZoom:b,nodeExtent:S,onNodesChange:k,onEdgesChange:E,elementsSelectable:T,connectionMode:I,snapGrid:O,snapToGrid:A,translateExtent:U,connectOnClick:z,defaultEdgeOptions:P,fitView:D,fitViewOptions:V,onNodesDelete:B,onEdgesDelete:C,onNodeDrag:q,onNodeDragStart:L,onNodeDragStop:re,onSelectionDrag:Z,onSelectionDragStart:H,onSelectionDragStop:J,noPanClassName:M,nodeOrigin:G,rfId:Y,autoPanOnConnect:$,autoPanOnNodeDrag:Q,onError:ne,connectionRadius:oe,isValidConnection:fe,nodeDragThreshold:te})=>{const{setNodes:ce,setEdges:Ce,setDefaultNodesAndEdges:ve,setMinZoom:je,setMaxZoom:ye,setTranslateExtent:ke,setNodeExtent:Ye,reset:we}=Ke(wM,Ct),_e=Tt();return j.useEffect(()=>{const Be=i==null?void 0:i.map(it=>({...it,...P}));return ve(r,Be),()=>{we()}},[]),$e("defaultEdgeOptions",P,_e.setState),$e("connectionMode",I,_e.setState),$e("onConnect",o,_e.setState),$e("onConnectStart",l,_e.setState),$e("onConnectEnd",u,_e.setState),$e("onClickConnectStart",c,_e.setState),$e("onClickConnectEnd",h,_e.setState),$e("nodesDraggable",p,_e.setState),$e("nodesConnectable",d,_e.setState),$e("nodesFocusable",m,_e.setState),$e("edgesFocusable",y,_e.setState),$e("edgesUpdatable",w,_e.setState),$e("elementsSelectable",T,_e.setState),$e("elevateNodesOnSelect",N,_e.setState),$e("snapToGrid",A,_e.setState),$e("snapGrid",O,_e.setState),$e("onNodesChange",k,_e.setState),$e("onEdgesChange",E,_e.setState),$e("connectOnClick",z,_e.setState),$e("fitViewOnInit",D,_e.setState),$e("fitViewOnInitOptions",V,_e.setState),$e("onNodesDelete",B,_e.setState),$e("onEdgesDelete",C,_e.setState),$e("onNodeDrag",q,_e.setState),$e("onNodeDragStart",L,_e.setState),$e("onNodeDragStop",re,_e.setState),$e("onSelectionDrag",Z,_e.setState),$e("onSelectionDragStart",H,_e.setState),$e("onSelectionDragStop",J,_e.setState),$e("noPanClassName",M,_e.setState),$e("nodeOrigin",G,_e.setState),$e("rfId",Y,_e.setState),$e("autoPanOnConnect",$,_e.setState),$e("autoPanOnNodeDrag",Q,_e.setState),$e("onError",ne,_e.setState),$e("connectionRadius",oe,_e.setState),$e("isValidConnection",fe,_e.setState),$e("nodeDragThreshold",te,_e.setState),Yi(e,ce),Yi(n,Ce),Yi(_,je),Yi(b,ye),Yi(U,ke),Yi(S,Ye),null},xx={display:"none"},_M={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},BN="react-flow__node-desc",UN="react-flow__edge-desc",bM="react-flow__aria-live",SM=e=>e.ariaLiveMessage;function kM({rfId:e}){const n=Ke(SM);return ue.createElement("div",{id:`${bM}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:_M},n)}function EM({rfId:e,disableKeyboardA11y:n}){return ue.createElement(ue.Fragment,null,ue.createElement("div",{id:`${BN}-${e}`,style:xx},"Press enter or space to select a node.",!n&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),ue.createElement("div",{id:`${UN}-${e}`,style:xx},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!n&&ue.createElement(kM,{rfId:e}))}var _a=(e=null,n={actInsideInputWithModifier:!0})=>{const[r,i]=j.useState(!1),o=j.useRef(!1),l=j.useRef(new Set([])),[u,c]=j.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),d=p.reduce((m,y)=>m.concat(...y),[]);return[p,d]}return[[],[]]},[e]);return j.useEffect(()=>{const h=typeof document<"u"?document:null,p=(n==null?void 0:n.target)||h;if(e!==null){const d=w=>{if(o.current=w.ctrlKey||w.metaKey||w.shiftKey,(!o.current||o.current&&!n.actInsideInputWithModifier)&&xv(w))return!1;const _=bx(w.code,c);l.current.add(w[_]),_x(u,l.current,!1)&&(w.preventDefault(),i(!0))},m=w=>{if((!o.current||o.current&&!n.actInsideInputWithModifier)&&xv(w))return!1;const _=bx(w.code,c);_x(u,l.current,!0)?(i(!1),l.current.clear()):l.current.delete(w[_]),w.key==="Meta"&&l.current.clear(),o.current=!1},y=()=>{l.current.clear(),i(!1)};return p==null||p.addEventListener("keydown",d),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",d),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,i]),r};function _x(e,n,r){return e.filter(i=>r||i.length===n.size).some(i=>i.every(o=>n.has(o)))}function bx(e,n){return n.includes(e)?"code":"key"}function HN(e,n,r,i){var c,h;const o=e.parentNode||e.parentId;if(!o)return r;const l=n.get(o),u=ui(l,i);return HN(l,n,{x:(r.x??0)+u.x,y:(r.y??0)+u.y,z:(((c=l[yt])==null?void 0:c.z)??0)>(r.z??0)?((h=l[yt])==null?void 0:h.z)??0:r.z??0},i)}function WN(e,n,r){e.forEach(i=>{var l;const o=i.parentNode||i.parentId;if(o&&!e.has(o))throw new Error(`Parent node ${o} not found`);if(o||r!=null&&r[i.id]){const{x:u,y:c,z:h}=HN(i,e,{...i.position,z:((l=i[yt])==null?void 0:l.z)??0},n);i.positionAbsolute={x:u,y:c},i[yt].z=h,r!=null&&r[i.id]&&(i[yt].isParent=!0)}})}function qd(e,n,r,i){const o=new Map,l={},u=i?1e3:0;return e.forEach(c=>{var w;const h=($n(c.zIndex)?c.zIndex:0)+(c.selected?u:0),p=n.get(c.id),d={...c,positionAbsolute:{x:c.position.x,y:c.position.y}},m=c.parentNode||c.parentId;m&&(l[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==c.type;Object.defineProperty(d,yt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[yt])==null?void 0:w.handleBounds,z:h}}),o.set(c.id,d)}),WN(o,r,l),o}function VN(e,n={}){const{getNodes:r,width:i,height:o,minZoom:l,maxZoom:u,d3Zoom:c,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:d,nodeOrigin:m}=e(),y=n.initial&&!p&&d;if(c&&h&&(y||!n.initial)){const N=r().filter(b=>{var k;const S=n.includeHiddenNodes?b.width&&b.height:!b.hidden;return(k=n.nodes)!=null&&k.length?S&&n.nodes.some(E=>E.id===b.id):S}),_=N.every(b=>b.width&&b.height);if(N.length>0&&_){const b=Ou(N,m),{x:S,y:k,zoom:E}=AN(b,i,o,n.minZoom??l,n.maxZoom??u,n.padding??.1),T=Fr.translate(S,k).scale(E);return typeof n.duration=="number"&&n.duration>0?c.transform(ii(h,n.duration),T):c.transform(h,T),!0}}return!1}function NM(e,n){return e.forEach(r=>{const i=n.get(r.id);i&&n.set(i.id,{...i,[yt]:i[yt],selected:r.selected})}),new Map(n)}function CM(e,n){return n.map(r=>{const i=e.find(o=>o.id===r.id);return i&&(r.selected=i.selected),r})}function Zl({changedNodes:e,changedEdges:n,get:r,set:i}){const{nodeInternals:o,edges:l,onNodesChange:u,onEdgesChange:c,hasDefaultNodes:h,hasDefaultEdges:p}=r();e!=null&&e.length&&(h&&i({nodeInternals:NM(e,o)}),u==null||u(e)),n!=null&&n.length&&(p&&i({edges:CM(n,l)}),c==null||c(n))}const Ki=()=>{},TM={zoomIn:Ki,zoomOut:Ki,zoomTo:Ki,getZoom:()=>1,setViewport:Ki,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ki,fitBounds:Ki,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},RM=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),jM=()=>{const e=Tt(),{d3Zoom:n,d3Selection:r}=Ke(RM,Ct);return j.useMemo(()=>r&&n?{zoomIn:o=>n.scaleBy(ii(r,o==null?void 0:o.duration),1.2),zoomOut:o=>n.scaleBy(ii(r,o==null?void 0:o.duration),1/1.2),zoomTo:(o,l)=>n.scaleTo(ii(r,l==null?void 0:l.duration),o),getZoom:()=>e.getState().transform[2],setViewport:(o,l)=>{const[u,c,h]=e.getState().transform,p=Fr.translate(o.x??u,o.y??c).scale(o.zoom??h);n.transform(ii(r,l==null?void 0:l.duration),p)},getViewport:()=>{const[o,l,u]=e.getState().transform;return{x:o,y:l,zoom:u}},fitView:o=>VN(e.getState,o),setCenter:(o,l,u)=>{const{width:c,height:h,maxZoom:p}=e.getState(),d=typeof(u==null?void 0:u.zoom)<"u"?u.zoom:p,m=c/2-o*d,y=h/2-l*d,w=Fr.translate(m,y).scale(d);n.transform(ii(r,u==null?void 0:u.duration),w)},fitBounds:(o,l)=>{const{width:u,height:c,minZoom:h,maxZoom:p}=e.getState(),{x:d,y:m,zoom:y}=AN(o,u,c,h,p,(l==null?void 0:l.padding)??.1),w=Fr.translate(d,m).scale(y);n.transform(ii(r,l==null?void 0:l.duration),w)},project:o=>{const{transform:l,snapToGrid:u,snapGrid:c}=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"),Sv(o,l,u,c)},screenToFlowPosition:o=>{const{transform:l,snapToGrid:u,snapGrid:c,domNode:h}=e.getState();if(!h)return o;const{x:p,y:d}=h.getBoundingClientRect(),m={x:o.x-p,y:o.y-d};return Sv(m,l,u,c)},flowToScreenPosition:o=>{const{transform:l,domNode:u}=e.getState();if(!u)return o;const{x:c,y:h}=u.getBoundingClientRect(),p=TN(o,l);return{x:p.x+c,y:p.y+h}},viewportInitialized:!0}:TM,[n,r])};function Ta(){const e=jM(),n=Tt(),r=j.useCallback(()=>n.getState().getNodes().map(_=>({..._})),[]),i=j.useCallback(_=>n.getState().nodeInternals.get(_),[]),o=j.useCallback(()=>{const{edges:_=[]}=n.getState();return _.map(b=>({...b}))},[]),l=j.useCallback(_=>{const{edges:b=[]}=n.getState();return b.find(S=>S.id===_)},[]),u=j.useCallback(_=>{const{getNodes:b,setNodes:S,hasDefaultNodes:k,onNodesChange:E}=n.getState(),T=b(),I=typeof _=="function"?_(T):_;if(k)S(I);else if(E){const O=I.length===0?T.map(A=>({type:"remove",id:A.id})):I.map(A=>({item:A,type:"reset"}));E(O)}},[]),c=j.useCallback(_=>{const{edges:b=[],setEdges:S,hasDefaultEdges:k,onEdgesChange:E}=n.getState(),T=typeof _=="function"?_(b):_;if(k)S(T);else if(E){const I=T.length===0?b.map(O=>({type:"remove",id:O.id})):T.map(O=>({item:O,type:"reset"}));E(I)}},[]),h=j.useCallback(_=>{const b=Array.isArray(_)?_:[_],{getNodes:S,setNodes:k,hasDefaultNodes:E,onNodesChange:T}=n.getState();if(E){const O=[...S(),...b];k(O)}else if(T){const I=b.map(O=>({item:O,type:"add"}));T(I)}},[]),p=j.useCallback(_=>{const b=Array.isArray(_)?_:[_],{edges:S=[],setEdges:k,hasDefaultEdges:E,onEdgesChange:T}=n.getState();if(E)k([...S,...b]);else if(T){const I=b.map(O=>({item:O,type:"add"}));T(I)}},[]),d=j.useCallback(()=>{const{getNodes:_,edges:b=[],transform:S}=n.getState(),[k,E,T]=S;return{nodes:_().map(I=>({...I})),edges:b.map(I=>({...I})),viewport:{x:k,y:E,zoom:T}}},[]),m=j.useCallback(({nodes:_,edges:b})=>{const{nodeInternals:S,getNodes:k,edges:E,hasDefaultNodes:T,hasDefaultEdges:I,onNodesDelete:O,onEdgesDelete:A,onNodesChange:U,onEdgesChange:z}=n.getState(),P=(_||[]).map(q=>q.id),D=(b||[]).map(q=>q.id),V=k().reduce((q,L)=>{const re=L.parentNode||L.parentId,Z=!P.includes(L.id)&&re&&q.find(J=>J.id===re);return(typeof L.deletable=="boolean"?L.deletable:!0)&&(P.includes(L.id)||Z)&&q.push(L),q},[]),B=E.filter(q=>typeof q.deletable=="boolean"?q.deletable:!0),C=B.filter(q=>D.includes(q.id));if(V||C){const q=jN(V,B),L=[...C,...q],re=L.reduce((Z,H)=>(Z.includes(H.id)||Z.push(H.id),Z),[]);if((I||T)&&(I&&n.setState({edges:E.filter(Z=>!re.includes(Z.id))}),T&&(V.forEach(Z=>{S.delete(Z.id)}),n.setState({nodeInternals:new Map(S)}))),re.length>0&&(A==null||A(L),z&&z(re.map(Z=>({id:Z,type:"remove"})))),V.length>0&&(O==null||O(V),U)){const Z=V.map(H=>({id:H.id,type:"remove"}));U(Z)}}},[]),y=j.useCallback(_=>{const b=XI(_),S=b?null:n.getState().nodeInternals.get(_.id);return!b&&!S?[null,null,b]:[b?_:hx(S),S,b]},[]),w=j.useCallback((_,b=!0,S)=>{const[k,E,T]=y(_);return k?(S||n.getState().getNodes()).filter(I=>{if(!T&&(I.id===E.id||!I.positionAbsolute))return!1;const O=hx(I),A=wv(O,k);return b&&A>0||A>=k.width*k.height}):[]},[]),N=j.useCallback((_,b,S=!0)=>{const[k]=y(_);if(!k)return!1;const E=wv(k,b);return S&&E>0||E>=k.width*k.height},[]);return j.useMemo(()=>({...e,getNodes:r,getNode:i,getEdges:o,getEdge:l,setNodes:u,setEdges:c,addNodes:h,addEdges:p,toObject:d,deleteElements:m,getIntersectingNodes:w,isNodeIntersecting:N}),[e,r,i,o,l,u,c,h,p,d,m,w,N])}const AM={actInsideInputWithModifier:!1};var IM=({deleteKeyCode:e,multiSelectionKeyCode:n})=>{const r=Tt(),{deleteElements:i}=Ta(),o=_a(e,AM),l=_a(n);j.useEffect(()=>{if(o){const{edges:u,getNodes:c}=r.getState(),h=c().filter(d=>d.selected),p=u.filter(d=>d.selected);i({nodes:h,edges:p}),r.setState({nodesSelectionActive:!1})}},[o]),j.useEffect(()=>{r.setState({multiSelectionActive:l})},[l])};function MM(e){const n=Tt();j.useEffect(()=>{let r;const i=()=>{var l,u;if(!e.current)return;const o=Wv(e.current);(o.height===0||o.width===0)&&((u=(l=n.getState()).onError)==null||u.call(l,"004",Br.error004())),n.setState({width:o.width||500,height:o.height||500})};return i(),window.addEventListener("resize",i),e.current&&(r=new ResizeObserver(()=>i()),r.observe(e.current)),()=>{window.removeEventListener("resize",i),r&&e.current&&r.unobserve(e.current)}},[])}const Jv={position:"absolute",width:"100%",height:"100%",top:0,left:0},OM=(e,n)=>e.x!==n.x||e.y!==n.y||e.zoom!==n.k,Jl=e=>({x:e.x,y:e.y,zoom:e.k}),Xi=(e,n)=>e.target.closest(`.${n}`),Sx=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),kx=e=>{const n=e.ctrlKey&&xu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n},PM=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),LM=({onMove:e,onMoveStart:n,onMoveEnd:r,onPaneContextMenu:i,zoomOnScroll:o=!0,zoomOnPinch:l=!0,panOnScroll:u=!1,panOnScrollSpeed:c=.5,panOnScrollMode:h=ai.Free,zoomOnDoubleClick:p=!0,elementsSelectable:d,panOnDrag:m=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:_,zoomActivationKeyCode:b,preventScrolling:S=!0,children:k,noWheelClassName:E,noPanClassName:T})=>{const I=j.useRef(),O=Tt(),A=j.useRef(!1),U=j.useRef(!1),z=j.useRef(null),P=j.useRef({x:0,y:0,zoom:0}),{d3Zoom:D,d3Selection:V,d3ZoomHandler:B,userSelectionActive:C}=Ke(PM,Ct),q=_a(b),L=j.useRef(0),re=j.useRef(!1),Z=j.useRef();return MM(z),j.useEffect(()=>{if(z.current){const H=z.current.getBoundingClientRect(),J=gN().scaleExtent([N,_]).translateExtent(w),M=Ln(z.current).call(J),G=Fr.translate(y.x,y.y).scale(uo(y.zoom,N,_)),Y=[[0,0],[H.width,H.height]],$=J.constrain()(G,Y,w);J.transform(M,$),J.wheelDelta(kx),O.setState({d3Zoom:J,d3Selection:M,d3ZoomHandler:M.on("wheel.zoom"),transform:[$.x,$.y,$.k],domNode:z.current.closest(".react-flow")})}},[]),j.useEffect(()=>{V&&D&&(u&&!q&&!C?V.on("wheel.zoom",H=>{if(Xi(H,E))return!1;H.preventDefault(),H.stopImmediatePropagation();const J=V.property("__zoom").k||1;if(H.ctrlKey&&l){const fe=Jn(H),te=kx(H),ce=J*Math.pow(2,te);D.scaleTo(V,ce,fe,H);return}const M=H.deltaMode===1?20:1;let G=h===ai.Vertical?0:H.deltaX*M,Y=h===ai.Horizontal?0:H.deltaY*M;!xu()&&H.shiftKey&&h!==ai.Vertical&&(G=H.deltaY*M,Y=0),D.translateBy(V,-(G/J)*c,-(Y/J)*c,{internal:!0});const $=Jl(V.property("__zoom")),{onViewportChangeStart:Q,onViewportChange:ne,onViewportChangeEnd:oe}=O.getState();clearTimeout(Z.current),re.current||(re.current=!0,n==null||n(H,$),Q==null||Q($)),re.current&&(e==null||e(H,$),ne==null||ne($),Z.current=setTimeout(()=>{r==null||r(H,$),oe==null||oe($),re.current=!1},150))},{passive:!1}):typeof B<"u"&&V.on("wheel.zoom",function(H,J){if(!S&&H.type==="wheel"&&!H.ctrlKey||Xi(H,E))return null;H.preventDefault(),B.call(this,H,J)},{passive:!1}))},[C,u,h,V,D,B,q,l,S,E,n,e,r]),j.useEffect(()=>{D&&D.on("start",H=>{var G,Y;if(!H.sourceEvent||H.sourceEvent.internal)return null;L.current=(G=H.sourceEvent)==null?void 0:G.button;const{onViewportChangeStart:J}=O.getState(),M=Jl(H.transform);A.current=!0,P.current=M,((Y=H.sourceEvent)==null?void 0:Y.type)==="mousedown"&&O.setState({paneDragging:!0}),J==null||J(M),n==null||n(H.sourceEvent,M)})},[D,n]),j.useEffect(()=>{D&&(C&&!A.current?D.on("zoom",null):C||D.on("zoom",H=>{var M;const{onViewportChange:J}=O.getState();if(O.setState({transform:[H.transform.x,H.transform.y,H.transform.k]}),U.current=!!(i&&Sx(m,L.current??0)),(e||J)&&!((M=H.sourceEvent)!=null&&M.internal)){const G=Jl(H.transform);J==null||J(G),e==null||e(H.sourceEvent,G)}}))},[C,D,e,m,i]),j.useEffect(()=>{D&&D.on("end",H=>{if(!H.sourceEvent||H.sourceEvent.internal)return null;const{onViewportChangeEnd:J}=O.getState();if(A.current=!1,O.setState({paneDragging:!1}),i&&Sx(m,L.current??0)&&!U.current&&i(H.sourceEvent),U.current=!1,(r||J)&&OM(P.current,H.transform)){const M=Jl(H.transform);P.current=M,clearTimeout(I.current),I.current=setTimeout(()=>{J==null||J(M),r==null||r(H.sourceEvent,M)},u?150:0)}})},[D,u,m,r,i]),j.useEffect(()=>{D&&D.filter(H=>{const J=q||o,M=l&&H.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&H.button===1&&H.type==="mousedown"&&(Xi(H,"react-flow__node")||Xi(H,"react-flow__edge")))return!0;if(!m&&!J&&!u&&!p&&!l||C||!p&&H.type==="dblclick"||Xi(H,E)&&H.type==="wheel"||Xi(H,T)&&(H.type!=="wheel"||u&&H.type==="wheel"&&!q)||!l&&H.ctrlKey&&H.type==="wheel"||!J&&!u&&!M&&H.type==="wheel"||!m&&(H.type==="mousedown"||H.type==="touchstart")||Array.isArray(m)&&!m.includes(H.button)&&H.type==="mousedown")return!1;const G=Array.isArray(m)&&m.includes(H.button)||!H.button||H.button<=1;return(!H.ctrlKey||H.type==="wheel")&&G})},[C,D,o,l,u,p,m,d,q]),ue.createElement("div",{className:"react-flow__renderer",ref:z,style:Jv},k)},$M=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function qM(){const{userSelectionActive:e,userSelectionRect:n}=Ke($M,Ct);return e&&n?ue.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}function Ex(e,n){const r=n.parentNode||n.parentId,i=e.find(o=>o.id===r);if(i){const o=n.position.x+n.width-i.width,l=n.position.y+n.height-i.height;if(o>0||l>0||n.position.x<0||n.position.y<0){if(i.style={...i.style},i.style.width=i.style.width??i.width,i.style.height=i.style.height??i.height,o>0&&(i.style.width+=o),l>0&&(i.style.height+=l),n.position.x<0){const u=Math.abs(n.position.x);i.position.x=i.position.x-u,i.style.width+=u,n.position.x=0}if(n.position.y<0){const u=Math.abs(n.position.y);i.position.y=i.position.y-u,i.style.height+=u,n.position.y=0}i.width=i.style.width,i.height=i.style.height}}}function DM(e,n){if(e.some(i=>i.type==="reset"))return e.filter(i=>i.type==="reset").map(i=>i.item);const r=e.filter(i=>i.type==="add").map(i=>i.item);return n.reduce((i,o)=>{const l=e.filter(c=>c.id===o.id);if(l.length===0)return i.push(o),i;const u={...o};for(const c of l)if(c)switch(c.type){case"select":{u.selected=c.selected;break}case"position":{typeof c.position<"u"&&(u.position=c.position),typeof c.positionAbsolute<"u"&&(u.positionAbsolute=c.positionAbsolute),typeof c.dragging<"u"&&(u.dragging=c.dragging),u.expandParent&&Ex(i,u);break}case"dimensions":{typeof c.dimensions<"u"&&(u.width=c.dimensions.width,u.height=c.dimensions.height),typeof c.updateStyle<"u"&&(u.style={...u.style||{},...c.dimensions}),typeof c.resizing=="boolean"&&(u.resizing=c.resizing),u.expandParent&&Ex(i,u);break}case"remove":return i}return i.push(u),i},r)}function FM(e,n){return DM(e,n)}const bs=(e,n)=>({id:e,type:"select",selected:n});function eo(e,n){return e.reduce((r,i)=>{const o=n.includes(i.id);return!i.selected&&o?(i.selected=!0,r.push(bs(i.id,!0))):i.selected&&!o&&(i.selected=!1,r.push(bs(i.id,!1))),r},[])}const Dd=(e,n)=>r=>{r.target===n.current&&(e==null||e(r))},zM=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),GN=j.memo(({isSelecting:e,selectionMode:n=xa.Full,panOnDrag:r,onSelectionStart:i,onSelectionEnd:o,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:c,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:d,children:m})=>{const y=j.useRef(null),w=Tt(),N=j.useRef(0),_=j.useRef(0),b=j.useRef(),{userSelectionActive:S,elementsSelectable:k,dragging:E}=Ke(zM,Ct),T=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,_.current=0},I=B=>{l==null||l(B),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},O=B=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){B.preventDefault();return}u==null||u(B)},A=c?B=>c(B):void 0,U=B=>{const{resetSelectedElements:C,domNode:q}=w.getState();if(b.current=q==null?void 0:q.getBoundingClientRect(),!k||!e||B.button!==0||B.target!==y.current||!b.current)return;const{x:L,y:re}=ks(B,b.current);C(),w.setState({userSelectionRect:{width:0,height:0,startX:L,startY:re,x:L,y:re}}),i==null||i(B)},z=B=>{const{userSelectionRect:C,nodeInternals:q,edges:L,transform:re,onNodesChange:Z,onEdgesChange:H,nodeOrigin:J,getNodes:M}=w.getState();if(!e||!b.current||!C)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=ks(B,b.current),Y=C.startX??0,$=C.startY??0,Q={...C,x:G.x<Y?G.x:Y,y:G.y<$?G.y:$,width:Math.abs(G.x-Y),height:Math.abs(G.y-$)},ne=M(),oe=RN(q,Q,re,n===xa.Partial,!0,J),fe=jN(oe,L).map(ce=>ce.id),te=oe.map(ce=>ce.id);if(N.current!==te.length){N.current=te.length;const ce=eo(ne,te);ce.length&&(Z==null||Z(ce))}if(_.current!==fe.length){_.current=fe.length;const ce=eo(L,fe);ce.length&&(H==null||H(ce))}w.setState({userSelectionRect:Q})},P=B=>{if(B.button!==0)return;const{userSelectionRect:C}=w.getState();!S&&C&&B.target===y.current&&(I==null||I(B)),w.setState({nodesSelectionActive:N.current>0}),T(),o==null||o(B)},D=B=>{S&&(w.setState({nodesSelectionActive:N.current>0}),o==null||o(B)),T()},V=k&&(e||S);return ue.createElement("div",{className:Dt(["react-flow__pane",{dragging:E,selection:e}]),onClick:V?void 0:Dd(I,y),onContextMenu:Dd(O,y),onWheel:Dd(A,y),onMouseEnter:V?void 0:h,onMouseDown:V?U:void 0,onMouseMove:V?z:p,onMouseUp:V?P:void 0,onMouseLeave:V?D:d,ref:y,style:Jv},m,ue.createElement(qM,null))});GN.displayName="Pane";function YN(e,n){const r=e.parentNode||e.parentId;if(!r)return!1;const i=n.get(r);return i?i.selected?!0:YN(i,n):!1}function Nx(e,n,r){let i=e;do{if(i!=null&&i.matches(n))return!0;if(i===r.current)return!1;i=i.parentElement}while(i);return!1}function BM(e,n,r,i){return Array.from(e.values()).filter(o=>(o.selected||o.id===i)&&(!o.parentNode||o.parentId||!YN(o,e))&&(o.draggable||n&&typeof o.draggable>"u")).map(o=>{var l,u;return{id:o.id,position:o.position||{x:0,y:0},positionAbsolute:o.positionAbsolute||{x:0,y:0},distance:{x:r.x-(((l=o.positionAbsolute)==null?void 0:l.x)??0),y:r.y-(((u=o.positionAbsolute)==null?void 0:u.y)??0)},delta:{x:0,y:0},extent:o.extent,parentNode:o.parentNode||o.parentId,parentId:o.parentNode||o.parentId,width:o.width,height:o.height,expandParent:o.expandParent}})}function UM(e,n){return!n||n==="parent"?n:[n[0],[n[1][0]-(e.width||0),n[1][1]-(e.height||0)]]}function KN(e,n,r,i,o=[0,0],l){const u=UM(e,e.extent||i);let c=u;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const m=r.get(h),{x:y,y:w}=ui(m,o).positionAbsolute;c=m&&$n(y)&&$n(w)&&$n(m.width)&&$n(m.height)?[[y+e.width*o[0],w+e.height*o[1]],[y+m.width-e.width+e.width*o[0],w+m.height-e.height+e.height*o[1]]]:c}else l==null||l("005",Br.error005()),c=u;else if(e.extent&&h&&e.extent!=="parent"){const m=r.get(h),{x:y,y:w}=ui(m,o).positionAbsolute;c=[[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(h){const m=r.get(h);p=ui(m,o).positionAbsolute}const d=c&&c!=="parent"?Vv(n,c):n;return{position:{x:d.x-p.x,y:d.y-p.y},positionAbsolute:d}}function Fd({nodeId:e,dragItems:n,nodeInternals:r}){const i=n.map(o=>({...r.get(o.id),position:o.position,positionAbsolute:o.positionAbsolute}));return[e?i.find(o=>o.id===e):i[0],i]}const Cx=(e,n,r,i)=>{const o=n.querySelectorAll(e);if(!o||!o.length)return null;const l=Array.from(o),u=n.getBoundingClientRect(),c={x:u.width*i[0],y:u.height*i[1]};return l.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-u.left-c.x)/r,y:(p.top-u.top-c.y)/r,...Wv(h)}})};function ia(e,n,r){return r===void 0?r:i=>{const o=n().nodeInternals.get(e);o&&r(i,{...o})}}function Ev({id:e,store:n,unselect:r=!1,nodeRef:i}){const{addSelectedNodes:o,unselectNodesAndEdges:l,multiSelectionActive:u,nodeInternals:c,onError:h}=n.getState(),p=c.get(e);if(!p){h==null||h("012",Br.error012(e));return}n.setState({nodesSelectionActive:!1}),p.selected?(r||p.selected&&u)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):o([e])}function HM(){const e=Tt();return j.useCallback(({sourceEvent:r})=>{const{transform:i,snapGrid:o,snapToGrid:l}=e.getState(),u=r.touches?r.touches[0].clientX:r.clientX,c=r.touches?r.touches[0].clientY:r.clientY,h={x:(u-i[0])/i[2],y:(c-i[1])/i[2]};return{xSnapped:l?o[0]*Math.round(h.x/o[0]):h.x,ySnapped:l?o[1]*Math.round(h.y/o[1]):h.y,...h}},[])}function zd(e){return(n,r,i)=>e==null?void 0:e(n,i)}function XN({nodeRef:e,disabled:n=!1,noDragClassName:r,handleSelector:i,nodeId:o,isSelectable:l,selectNodesOnDrag:u}){const c=Tt(),[h,p]=j.useState(!1),d=j.useRef([]),m=j.useRef({x:null,y:null}),y=j.useRef(0),w=j.useRef(null),N=j.useRef({x:0,y:0}),_=j.useRef(null),b=j.useRef(!1),S=j.useRef(!1),k=j.useRef(!1),E=HM();return j.useEffect(()=>{if(e!=null&&e.current){const T=Ln(e.current),I=({x:U,y:z})=>{const{nodeInternals:P,onNodeDrag:D,onSelectionDrag:V,updateNodePositions:B,nodeExtent:C,snapGrid:q,snapToGrid:L,nodeOrigin:re,onError:Z}=c.getState();m.current={x:U,y:z};let H=!1,J={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&C){const G=Ou(d.current,re);J=wa(G)}if(d.current=d.current.map(G=>{const Y={x:U-G.distance.x,y:z-G.distance.y};L&&(Y.x=q[0]*Math.round(Y.x/q[0]),Y.y=q[1]*Math.round(Y.y/q[1]));const $=[[C[0][0],C[0][1]],[C[1][0],C[1][1]]];d.current.length>1&&C&&!G.extent&&($[0][0]=G.positionAbsolute.x-J.x+C[0][0],$[1][0]=G.positionAbsolute.x+(G.width??0)-J.x2+C[1][0],$[0][1]=G.positionAbsolute.y-J.y+C[0][1],$[1][1]=G.positionAbsolute.y+(G.height??0)-J.y2+C[1][1]);const Q=KN(G,Y,P,$,re,Z);return H=H||G.position.x!==Q.position.x||G.position.y!==Q.position.y,G.position=Q.position,G.positionAbsolute=Q.positionAbsolute,G}),!H)return;B(d.current,!0,!0),p(!0);const M=o?D:zd(V);if(M&&_.current){const[G,Y]=Fd({nodeId:o,dragItems:d.current,nodeInternals:P});M(_.current,G,Y)}},O=()=>{if(!w.current)return;const[U,z]=yN(N.current,w.current);if(U!==0||z!==0){const{transform:P,panBy:D}=c.getState();m.current.x=(m.current.x??0)-U/P[2],m.current.y=(m.current.y??0)-z/P[2],D({x:U,y:z})&&I(m.current)}y.current=requestAnimationFrame(O)},A=U=>{var re;const{nodeInternals:z,multiSelectionActive:P,nodesDraggable:D,unselectNodesAndEdges:V,onNodeDragStart:B,onSelectionDragStart:C}=c.getState();S.current=!0;const q=o?B:zd(C);(!u||!l)&&!P&&o&&((re=z.get(o))!=null&&re.selected||V()),o&&l&&u&&Ev({id:o,store:c,nodeRef:e});const L=E(U);if(m.current=L,d.current=BM(z,D,L,o),q&&d.current){const[Z,H]=Fd({nodeId:o,dragItems:d.current,nodeInternals:z});q(U.sourceEvent,Z,H)}};if(n)T.on(".drag",null);else{const U=JA().on("start",z=>{const{domNode:P,nodeDragThreshold:D}=c.getState();D===0&&A(z),k.current=!1;const V=E(z);m.current=V,w.current=(P==null?void 0:P.getBoundingClientRect())||null,N.current=ks(z.sourceEvent,w.current)}).on("drag",z=>{var B,C;const P=E(z),{autoPanOnNodeDrag:D,nodeDragThreshold:V}=c.getState();if(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1&&(k.current=!0),!k.current){if(!b.current&&S.current&&D&&(b.current=!0,O()),!S.current){const q=P.xSnapped-(((B=m==null?void 0:m.current)==null?void 0:B.x)??0),L=P.ySnapped-(((C=m==null?void 0:m.current)==null?void 0:C.y)??0);Math.sqrt(q*q+L*L)>V&&A(z)}(m.current.x!==P.xSnapped||m.current.y!==P.ySnapped)&&d.current&&S.current&&(_.current=z.sourceEvent,N.current=ks(z.sourceEvent,w.current),I(P))}}).on("end",z=>{if(!(!S.current||k.current)&&(p(!1),b.current=!1,S.current=!1,cancelAnimationFrame(y.current),d.current)){const{updateNodePositions:P,nodeInternals:D,onNodeDragStop:V,onSelectionDragStop:B}=c.getState(),C=o?V:zd(B);if(P(d.current,!1,!1),C){const[q,L]=Fd({nodeId:o,dragItems:d.current,nodeInternals:D});C(z.sourceEvent,q,L)}}}).filter(z=>{const P=z.target;return!z.button&&(!r||!Nx(P,`.${r}`,e))&&(!i||Nx(P,i,e))});return T.call(U),()=>{T.on(".drag",null)}}}},[e,n,r,i,l,c,o,u,E]),h}function QN(){const e=Tt();return j.useCallback(r=>{const{nodeInternals:i,nodeExtent:o,updateNodePositions:l,getNodes:u,snapToGrid:c,snapGrid:h,onError:p,nodesDraggable:d}=e.getState(),m=u().filter(k=>k.selected&&(k.draggable||d&&typeof k.draggable>"u")),y=c?h[0]:5,w=c?h[1]:5,N=r.isShiftPressed?4:1,_=r.x*y*N,b=r.y*w*N,S=m.map(k=>{if(k.positionAbsolute){const E={x:k.positionAbsolute.x+_,y:k.positionAbsolute.y+b};c&&(E.x=h[0]*Math.round(E.x/h[0]),E.y=h[1]*Math.round(E.y/h[1]));const{positionAbsolute:T,position:I}=KN(k,E,i,o,void 0,p);k.position=I,k.positionAbsolute=T}return k});l(S,!0,!1)},[])}const io={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var oa=e=>{const n=({id:r,type:i,data:o,xPos:l,yPos:u,xPosOrigin:c,yPosOrigin:h,selected:p,onClick:d,onMouseEnter:m,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:_,style:b,className:S,isDraggable:k,isSelectable:E,isConnectable:T,isFocusable:I,selectNodesOnDrag:O,sourcePosition:A,targetPosition:U,hidden:z,resizeObserver:P,dragHandle:D,zIndex:V,isParent:B,noDragClassName:C,noPanClassName:q,initialized:L,disableKeyboardA11y:re,ariaLabel:Z,rfId:H,hasHandleBounds:J})=>{const M=Tt(),G=j.useRef(null),Y=j.useRef(null),$=j.useRef(A),Q=j.useRef(U),ne=j.useRef(i),oe=E||k||d||m||y||w,fe=QN(),te=ia(r,M.getState,m),ce=ia(r,M.getState,y),Ce=ia(r,M.getState,w),ve=ia(r,M.getState,N),je=ia(r,M.getState,_),ye=we=>{const{nodeDragThreshold:_e}=M.getState();if(E&&(!O||!k||_e>0)&&Ev({id:r,store:M,nodeRef:G}),d){const Be=M.getState().nodeInternals.get(r);Be&&d(we,{...Be})}},ke=we=>{if(!xv(we)&&!re)if(bN.includes(we.key)&&E){const _e=we.key==="Escape";Ev({id:r,store:M,unselect:_e,nodeRef:G})}else k&&p&&Object.prototype.hasOwnProperty.call(io,we.key)&&(M.setState({ariaLiveMessage:`Moved selected node ${we.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~u}`}),fe({x:io[we.key].x,y:io[we.key].y,isShiftPressed:we.shiftKey}))};j.useEffect(()=>()=>{Y.current&&(P==null||P.unobserve(Y.current),Y.current=null)},[]),j.useEffect(()=>{if(G.current&&!z){const we=G.current;(!L||!J||Y.current!==we)&&(Y.current&&(P==null||P.unobserve(Y.current)),P==null||P.observe(we),Y.current=we)}},[z,L,J]),j.useEffect(()=>{const we=ne.current!==i,_e=$.current!==A,Be=Q.current!==U;G.current&&(we||_e||Be)&&(we&&(ne.current=i),_e&&($.current=A),Be&&(Q.current=U),M.getState().updateNodeDimensions([{id:r,nodeElement:G.current,forceUpdate:!0}]))},[r,i,A,U]);const Ye=XN({nodeRef:G,disabled:z||!k,noDragClassName:C,handleSelector:D,nodeId:r,isSelectable:E,selectNodesOnDrag:O});return z?null:ue.createElement("div",{className:Dt(["react-flow__node",`react-flow__node-${i}`,{[q]:k},S,{selected:p,selectable:E,parent:B,dragging:Ye}]),ref:G,style:{zIndex:V,transform:`translate(${c}px,${h}px)`,pointerEvents:oe?"all":"none",visibility:L?"visible":"hidden",...b},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:te,onMouseMove:ce,onMouseLeave:Ce,onContextMenu:ve,onClick:ye,onDoubleClick:je,onKeyDown:I?ke:void 0,tabIndex:I?0:void 0,role:I?"button":void 0,"aria-describedby":re?void 0:`${BN}-${H}`,"aria-label":Z},ue.createElement(rM,{value:r},ue.createElement(e,{id:r,data:o,type:i,xPos:l,yPos:u,selected:p,isConnectable:T,sourcePosition:A,targetPosition:U,dragging:Ye,dragHandle:D,zIndex:V})))};return n.displayName="NodeWrapper",j.memo(n)};const WM=e=>{const n=e.getNodes().filter(r=>r.selected);return{...Ou(n,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function VM({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:r}){const i=Tt(),{width:o,height:l,x:u,y:c,transformString:h,userSelectionActive:p}=Ke(WM,Ct),d=QN(),m=j.useRef(null);if(j.useEffect(()=>{var N;r||(N=m.current)==null||N.focus({preventScroll:!0})},[r]),XN({nodeRef:m}),p||!o||!l)return null;const y=e?N=>{const _=i.getState().getNodes().filter(b=>b.selected);e(N,_)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(io,N.key)&&d({x:io[N.key].x,y:io[N.key].y,isShiftPressed:N.shiftKey})};return ue.createElement("div",{className:Dt(["react-flow__nodesselection","react-flow__container",n]),style:{transform:h}},ue.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:r?void 0:-1,onKeyDown:r?void 0:w,style:{width:o,height:l,top:c,left:u}}))}var GM=j.memo(VM);const YM=e=>e.nodesSelectionActive,ZN=({children:e,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,deleteKeyCode:c,onMove:h,onMoveStart:p,onMoveEnd:d,selectionKeyCode:m,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:_,multiSelectionKeyCode:b,panActivationKeyCode:S,zoomActivationKeyCode:k,elementsSelectable:E,zoomOnScroll:T,zoomOnPinch:I,panOnScroll:O,panOnScrollSpeed:A,panOnScrollMode:U,zoomOnDoubleClick:z,panOnDrag:P,defaultViewport:D,translateExtent:V,minZoom:B,maxZoom:C,preventScrolling:q,onSelectionContextMenu:L,noWheelClassName:re,noPanClassName:Z,disableKeyboardA11y:H})=>{const J=Ke(YM),M=_a(m),G=_a(S),Y=G||P,$=G||O,Q=M||y&&Y!==!0;return IM({deleteKeyCode:c,multiSelectionKeyCode:b}),ue.createElement(LM,{onMove:h,onMoveStart:p,onMoveEnd:d,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:T,zoomOnPinch:I,panOnScroll:$,panOnScrollSpeed:A,panOnScrollMode:U,zoomOnDoubleClick:z,panOnDrag:!M&&Y,defaultViewport:D,translateExtent:V,minZoom:B,maxZoom:C,zoomActivationKeyCode:k,preventScrolling:q,noWheelClassName:re,noPanClassName:Z},ue.createElement(GN,{onSelectionStart:N,onSelectionEnd:_,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:Y,isSelecting:!!Q,selectionMode:w},e,J&&ue.createElement(GM,{onSelectionContextMenu:L,noPanClassName:Z,disableKeyboardA11y:H})))};ZN.displayName="FlowRenderer";var KM=j.memo(ZN);function XM(e){return Ke(j.useCallback(r=>e?RN(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function QM(e){const n={input:oa(e.input||qN),default:oa(e.default||kv),output:oa(e.output||FN),group:oa(e.group||Zv)},r={},i=Object.keys(e).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,l)=>(o[l]=oa(e[l]||kv),o),r);return{...n,...i}}const ZM=({x:e,y:n,width:r,height:i,origin:o})=>!r||!i?{x:e,y:n}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:e,y:n}:{x:e-r*o[0],y:n-i*o[1]},JM=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),JN=e=>{const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:i,elementsSelectable:o,updateNodeDimensions:l,onError:u}=Ke(JM,Ct),c=XM(e.onlyRenderVisibleElements),h=j.useRef(),p=j.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const d=new ResizeObserver(m=>{const y=m.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));l(y)});return h.current=d,d},[]);return j.useEffect(()=>()=>{var d;(d=h==null?void 0:h.current)==null||d.disconnect()},[]),ue.createElement("div",{className:"react-flow__nodes",style:Jv},c.map(d=>{var I,O,A;let m=d.type||"default";e.nodeTypes[m]||(u==null||u("003",Br.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,w=!!(d.draggable||n&&typeof d.draggable>"u"),N=!!(d.selectable||o&&typeof d.selectable>"u"),_=!!(d.connectable||r&&typeof d.connectable>"u"),b=!!(d.focusable||i&&typeof d.focusable>"u"),S=e.nodeExtent?Vv(d.positionAbsolute,e.nodeExtent):d.positionAbsolute,k=(S==null?void 0:S.x)??0,E=(S==null?void 0:S.y)??0,T=ZM({x:k,y:E,width:d.width??0,height:d.height??0,origin:e.nodeOrigin});return ue.createElement(y,{key:d.id,id:d.id,className:d.className,style:d.style,type:m,data:d.data,sourcePosition:d.sourcePosition||Ae.Bottom,targetPosition:d.targetPosition||Ae.Top,hidden:d.hidden,xPos:k,yPos:E,xPosOrigin:T.x,yPosOrigin:T.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!d.selected,isDraggable:w,isSelectable:N,isConnectable:_,isFocusable:b,resizeObserver:p,dragHandle:d.dragHandle,zIndex:((I=d[yt])==null?void 0:I.z)??0,isParent:!!((O=d[yt])!=null&&O.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!d.width&&!!d.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:d.ariaLabel,hasHandleBounds:!!((A=d[yt])!=null&&A.handleBounds)})}))};JN.displayName="NodeRenderer";var eO=j.memo(JN);const tO=(e,n,r)=>r===Ae.Left?e-n:r===Ae.Right?e+n:e,nO=(e,n,r)=>r===Ae.Top?e-n:r===Ae.Bottom?e+n:e,Tx="react-flow__edgeupdater",Rx=({position:e,centerX:n,centerY:r,radius:i=10,onMouseDown:o,onMouseEnter:l,onMouseOut:u,type:c})=>ue.createElement("circle",{onMouseDown:o,onMouseEnter:l,onMouseOut:u,className:Dt([Tx,`${Tx}-${c}`]),cx:tO(n,i,e),cy:nO(r,i,e),r:i,stroke:"transparent",fill:"transparent"}),rO=()=>!0;var Qi=e=>{const n=({id:r,className:i,type:o,data:l,onClick:u,onEdgeDoubleClick:c,selected:h,animated:p,label:d,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,style:b,source:S,target:k,sourceX:E,sourceY:T,targetX:I,targetY:O,sourcePosition:A,targetPosition:U,elementsSelectable:z,hidden:P,sourceHandleId:D,targetHandleId:V,onContextMenu:B,onMouseEnter:C,onMouseMove:q,onMouseLeave:L,reconnectRadius:re,onReconnect:Z,onReconnectStart:H,onReconnectEnd:J,markerEnd:M,markerStart:G,rfId:Y,ariaLabel:$,isFocusable:Q,isReconnectable:ne,pathOptions:oe,interactionWidth:fe,disableKeyboardA11y:te})=>{const ce=j.useRef(null),[Ce,ve]=j.useState(!1),[je,ye]=j.useState(!1),ke=Tt(),Ye=j.useMemo(()=>`url('#${bv(G,Y)}')`,[G,Y]),we=j.useMemo(()=>`url('#${bv(M,Y)}')`,[M,Y]);if(P)return null;const _e=et=>{var Pt;const{edges:St,addSelectedEdges:mt,unselectNodesAndEdges:wt,multiSelectionActive:hn}=ke.getState(),Yt=St.find(Sn=>Sn.id===r);Yt&&(z&&(ke.setState({nodesSelectionActive:!1}),Yt.selected&&hn?(wt({nodes:[],edges:[Yt]}),(Pt=ce.current)==null||Pt.blur()):mt([r])),u&&u(et,Yt))},Be=sa(r,ke.getState,c),it=sa(r,ke.getState,B),pt=sa(r,ke.getState,C),Ze=sa(r,ke.getState,q),Fe=sa(r,ke.getState,L),Je=(et,St)=>{if(et.button!==0)return;const{edges:mt,isValidConnection:wt}=ke.getState(),hn=St?k:S,Yt=(St?V:D)||null,Pt=St?"target":"source",Sn=wt||rO,gr=St,kn=mt.find(pn=>pn.id===r);ye(!0),H==null||H(et,kn,Pt);const zt=pn=>{ye(!1),J==null||J(pn,kn,Pt)};ON({event:et,handleId:Yt,nodeId:hn,onConnect:pn=>Z==null?void 0:Z(kn,pn),isTarget:gr,getState:ke.getState,setState:ke.setState,isValidConnection:Sn,edgeUpdaterType:Pt,onReconnectEnd:zt})},Xe=et=>Je(et,!0),Mt=et=>Je(et,!1),ut=()=>ve(!0),Qe=()=>ve(!1),Ot=!z&&!u,Ft=et=>{var St;if(!te&&bN.includes(et.key)&&z){const{unselectNodesAndEdges:mt,addSelectedEdges:wt,edges:hn}=ke.getState();et.key==="Escape"?((St=ce.current)==null||St.blur(),mt({edges:[hn.find(Pt=>Pt.id===r)]})):wt([r])}};return ue.createElement("g",{className:Dt(["react-flow__edge",`react-flow__edge-${o}`,i,{selected:h,animated:p,inactive:Ot,updating:Ce}]),onClick:_e,onDoubleClick:Be,onContextMenu:it,onMouseEnter:pt,onMouseMove:Ze,onMouseLeave:Fe,onKeyDown:Q?Ft:void 0,tabIndex:Q?0:void 0,role:Q?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":$===null?void 0:$||`Edge from ${S} to ${k}`,"aria-describedby":Q?`${UN}-${Y}`:void 0,ref:ce},!je&&ue.createElement(e,{id:r,source:S,target:k,selected:h,animated:p,label:d,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,data:l,style:b,sourceX:E,sourceY:T,targetX:I,targetY:O,sourcePosition:A,targetPosition:U,sourceHandleId:D,targetHandleId:V,markerStart:Ye,markerEnd:we,pathOptions:oe,interactionWidth:fe}),ne&&ue.createElement(ue.Fragment,null,(ne==="source"||ne===!0)&&ue.createElement(Rx,{position:A,centerX:E,centerY:T,radius:re,onMouseDown:Xe,onMouseEnter:ut,onMouseOut:Qe,type:"source"}),(ne==="target"||ne===!0)&&ue.createElement(Rx,{position:U,centerX:I,centerY:O,radius:re,onMouseDown:Mt,onMouseEnter:ut,onMouseOut:Qe,type:"target"})))};return n.displayName="EdgeWrapper",j.memo(n)};function sO(e){const n={default:Qi(e.default||bu),straight:Qi(e.bezier||Kv),step:Qi(e.step||Yv),smoothstep:Qi(e.step||Mu),simplebezier:Qi(e.simplebezier||Gv)},r={},i=Object.keys(e).filter(o=>!["default","bezier"].includes(o)).reduce((o,l)=>(o[l]=Qi(e[l]||bu),o),r);return{...n,...i}}function jx(e,n,r=null){const i=((r==null?void 0:r.x)||0)+n.x,o=((r==null?void 0:r.y)||0)+n.y,l=(r==null?void 0:r.width)||n.width,u=(r==null?void 0:r.height)||n.height;switch(e){case Ae.Top:return{x:i+l/2,y:o};case Ae.Right:return{x:i+l,y:o+u/2};case Ae.Bottom:return{x:i+l/2,y:o+u};case Ae.Left:return{x:i,y:o+u/2}}}function Ax(e,n){return e?e.length===1||!n?e[0]:n&&e.find(r=>r.id===n)||null:null}const iO=(e,n,r,i,o,l)=>{const u=jx(r,e,n),c=jx(l,i,o);return{sourceX:u.x,sourceY:u.y,targetX:c.x,targetY:c.y}};function oO({sourcePos:e,targetPos:n,sourceWidth:r,sourceHeight:i,targetWidth:o,targetHeight:l,width:u,height:c,transform:h}){const p={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+r,n.x+o),y2:Math.max(e.y+i,n.y+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const d=wa({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:u/h[2],height:c/h[2]}),m=Math.max(0,Math.min(d.x2,p.x2)-Math.max(d.x,p.x)),y=Math.max(0,Math.min(d.y2,p.y2)-Math.max(d.y,p.y));return Math.ceil(m*y)>0}function Ix(e){var i,o,l,u,c;const n=((i=e==null?void 0:e[yt])==null?void 0:i.handleBounds)||null,r=n&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.x)<"u"&&typeof((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)<"u";return[{x:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.x)||0,y:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},n,!!r]}const aO=[{level:0,isMaxLevel:!0,edges:[]}];function lO(e,n,r=!1){let i=-1;const o=e.reduce((u,c)=>{var d,m;const h=$n(c.zIndex);let p=h?c.zIndex:0;if(r){const y=n.get(c.target),w=n.get(c.source),N=c.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),_=Math.max(((d=w==null?void 0:w[yt])==null?void 0:d.z)||0,((m=y==null?void 0:y[yt])==null?void 0:m.z)||0,1e3);p=(h?c.zIndex:0)+(N?_:0)}return u[p]?u[p].push(c):u[p]=[c],i=p>i?p:i,u},{}),l=Object.entries(o).map(([u,c])=>{const h=+u;return{edges:c,level:h,isMaxLevel:h===i}});return l.length===0?aO:l}function uO(e,n,r){const i=Ke(j.useCallback(o=>e?o.edges.filter(l=>{const u=n.get(l.source),c=n.get(l.target);return(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&oO({sourcePos:u.positionAbsolute||{x:0,y:0},targetPos:c.positionAbsolute||{x:0,y:0},sourceWidth:u.width,sourceHeight:u.height,targetWidth:c.width,targetHeight:c.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[e,n]));return lO(i,n,r)}const cO=({color:e="none",strokeWidth:n=1})=>ue.createElement("polyline",{style:{stroke:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),dO=({color:e="none",strokeWidth:n=1})=>ue.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Mx={[_u.Arrow]:cO,[_u.ArrowClosed]:dO};function fO(e){const n=Tt();return j.useMemo(()=>{var o,l;return Object.prototype.hasOwnProperty.call(Mx,e)?Mx[e]:((l=(o=n.getState()).onError)==null||l.call(o,"009",Br.error009(e)),null)},[e])}const hO=({id:e,type:n,color:r,width:i=12.5,height:o=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:c="auto-start-reverse"})=>{const h=fO(n);return h?ue.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:c,refX:"0",refY:"0"},ue.createElement(h,{color:r,strokeWidth:u})):null},pO=({defaultColor:e,rfId:n})=>r=>{const i=[];return r.edges.reduce((o,l)=>([l.markerStart,l.markerEnd].forEach(u=>{if(u&&typeof u=="object"){const c=bv(u,n);i.includes(c)||(o.push({id:c,color:u.color||e,...u}),i.push(c))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))},eC=({defaultColor:e,rfId:n})=>{const r=Ke(j.useCallback(pO({defaultColor:e,rfId:n}),[e,n]),(i,o)=>!(i.length!==o.length||i.some((l,u)=>l.id!==o[u].id)));return ue.createElement("defs",null,r.map(i=>ue.createElement(hO,{id:i.id,key:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient})))};eC.displayName="MarkerDefinitions";var mO=j.memo(eC);const gO=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}),tC=({defaultMarkerColor:e,onlyRenderVisibleElements:n,elevateEdgesOnSelect:r,rfId:i,edgeTypes:o,noPanClassName:l,onEdgeContextMenu:u,onEdgeMouseEnter:c,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:d,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,children:b,disableKeyboardA11y:S})=>{const{edgesFocusable:k,edgesUpdatable:E,elementsSelectable:T,width:I,height:O,connectionMode:A,nodeInternals:U,onError:z}=Ke(gO,Ct),P=uO(n,U,r);return I?ue.createElement(ue.Fragment,null,P.map(({level:D,edges:V,isMaxLevel:B})=>ue.createElement("svg",{key:D,style:{zIndex:D},width:I,height:O,className:"react-flow__edges react-flow__container"},B&&ue.createElement(mO,{defaultColor:e,rfId:i}),ue.createElement("g",null,V.map(C=>{const[q,L,re]=Ix(U.get(C.source)),[Z,H,J]=Ix(U.get(C.target));if(!re||!J)return null;let M=C.type||"default";o[M]||(z==null||z("011",Br.error011(M)),M="default");const G=o[M]||o.default,Y=A===di.Strict?H.target:(H.target??[]).concat(H.source??[]),$=Ax(L.source,C.sourceHandle),Q=Ax(Y,C.targetHandle),ne=($==null?void 0:$.position)||Ae.Bottom,oe=(Q==null?void 0:Q.position)||Ae.Top,fe=!!(C.focusable||k&&typeof C.focusable>"u"),te=C.reconnectable||C.updatable,ce=typeof y<"u"&&(te||E&&typeof te>"u");if(!$||!Q)return z==null||z("008",Br.error008($,C)),null;const{sourceX:Ce,sourceY:ve,targetX:je,targetY:ye}=iO(q,$,ne,Z,Q,oe);return ue.createElement(G,{key:C.id,id:C.id,className:Dt([C.className,l]),type:M,data:C.data,selected:!!C.selected,animated:!!C.animated,hidden:!!C.hidden,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,style:C.style,source:C.source,target:C.target,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerEnd:C.markerEnd,markerStart:C.markerStart,sourceX:Ce,sourceY:ve,targetX:je,targetY:ye,sourcePosition:ne,targetPosition:oe,elementsSelectable:T,onContextMenu:u,onMouseEnter:c,onMouseMove:h,onMouseLeave:p,onClick:d,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,rfId:i,ariaLabel:C.ariaLabel,isFocusable:fe,isReconnectable:ce,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth,disableKeyboardA11y:S})})))),b):null};tC.displayName="EdgeRenderer";var vO=j.memo(tC);const yO=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function wO({children:e}){const n=Ke(yO);return ue.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:n}},e)}function xO(e){const n=Ta(),r=j.useRef(!1);j.useEffect(()=>{!r.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),r.current=!0)},[e,n.viewportInitialized])}const _O={[Ae.Left]:Ae.Right,[Ae.Right]:Ae.Left,[Ae.Top]:Ae.Bottom,[Ae.Bottom]:Ae.Top},nC=({nodeId:e,handleType:n,style:r,type:i=Ss.Bezier,CustomComponent:o,connectionStatus:l})=>{var O,A,U;const{fromNode:u,handleId:c,toX:h,toY:p,connectionMode:d}=Ke(j.useCallback(z=>({fromNode:z.nodeInternals.get(e),handleId:z.connectionHandleId,toX:(z.connectionPosition.x-z.transform[0])/z.transform[2],toY:(z.connectionPosition.y-z.transform[1])/z.transform[2],connectionMode:z.connectionMode}),[e]),Ct),m=(O=u==null?void 0:u[yt])==null?void 0:O.handleBounds;let y=m==null?void 0:m[n];if(d===di.Loose&&(y=y||(m==null?void 0:m[n==="source"?"target":"source"])),!u||!y)return null;const w=c?y.find(z=>z.id===c):y[0],N=w?w.x+w.width/2:(u.width??0)/2,_=w?w.y+w.height/2:u.height??0,b=(((A=u.positionAbsolute)==null?void 0:A.x)??0)+N,S=(((U=u.positionAbsolute)==null?void 0:U.y)??0)+_,k=w==null?void 0:w.position,E=k?_O[k]:null;if(!k||!E)return null;if(o)return ue.createElement(o,{connectionLineType:i,connectionLineStyle:r,fromNode:u,fromHandle:w,fromX:b,fromY:S,toX:h,toY:p,fromPosition:k,toPosition:E,connectionStatus:l});let T="";const I={sourceX:b,sourceY:S,sourcePosition:k,targetX:h,targetY:p,targetPosition:E};return i===Ss.Bezier?[T]=CN(I):i===Ss.Step?[T]=_v({...I,borderRadius:0}):i===Ss.SmoothStep?[T]=_v(I):i===Ss.SimpleBezier?[T]=NN(I):T=`M${b},${S} ${h},${p}`,ue.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:r})};nC.displayName="ConnectionLine";const bO=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function SO({containerStyle:e,style:n,type:r,component:i}){const{nodeId:o,handleType:l,nodesConnectable:u,width:c,height:h,connectionStatus:p}=Ke(bO,Ct);return!(o&&l&&c&&u)?null:ue.createElement("svg",{style:e,width:c,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},ue.createElement("g",{className:Dt(["react-flow__connection",p])},ue.createElement(nC,{nodeId:o,handleType:l,style:n,type:r,CustomComponent:i,connectionStatus:p})))}function Ox(e,n){return j.useRef(null),Tt(),j.useMemo(()=>n(e),[e])}const rC=({nodeTypes:e,edgeTypes:n,onMove:r,onMoveStart:i,onMoveEnd:o,onInit:l,onNodeClick:u,onEdgeClick:c,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:d,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:_,onSelectionEnd:b,connectionLineType:S,connectionLineStyle:k,connectionLineComponent:E,connectionLineContainerStyle:T,selectionKeyCode:I,selectionOnDrag:O,selectionMode:A,multiSelectionKeyCode:U,panActivationKeyCode:z,zoomActivationKeyCode:P,deleteKeyCode:D,onlyRenderVisibleElements:V,elementsSelectable:B,selectNodesOnDrag:C,defaultViewport:q,translateExtent:L,minZoom:re,maxZoom:Z,preventScrolling:H,defaultMarkerColor:J,zoomOnScroll:M,zoomOnPinch:G,panOnScroll:Y,panOnScrollSpeed:$,panOnScrollMode:Q,zoomOnDoubleClick:ne,panOnDrag:oe,onPaneClick:fe,onPaneMouseEnter:te,onPaneMouseMove:ce,onPaneMouseLeave:Ce,onPaneScroll:ve,onPaneContextMenu:je,onEdgeContextMenu:ye,onEdgeMouseEnter:ke,onEdgeMouseMove:Ye,onEdgeMouseLeave:we,onReconnect:_e,onReconnectStart:Be,onReconnectEnd:it,reconnectRadius:pt,noDragClassName:Ze,noWheelClassName:Fe,noPanClassName:Je,elevateEdgesOnSelect:Xe,disableKeyboardA11y:Mt,nodeOrigin:ut,nodeExtent:Qe,rfId:Ot})=>{const Ft=Ox(e,QM),et=Ox(n,sO);return xO(l),ue.createElement(KM,{onPaneClick:fe,onPaneMouseEnter:te,onPaneMouseMove:ce,onPaneMouseLeave:Ce,onPaneContextMenu:je,onPaneScroll:ve,deleteKeyCode:D,selectionKeyCode:I,selectionOnDrag:O,selectionMode:A,onSelectionStart:_,onSelectionEnd:b,multiSelectionKeyCode:U,panActivationKeyCode:z,zoomActivationKeyCode:P,elementsSelectable:B,onMove:r,onMoveStart:i,onMoveEnd:o,zoomOnScroll:M,zoomOnPinch:G,zoomOnDoubleClick:ne,panOnScroll:Y,panOnScrollSpeed:$,panOnScrollMode:Q,panOnDrag:oe,defaultViewport:q,translateExtent:L,minZoom:re,maxZoom:Z,onSelectionContextMenu:N,preventScrolling:H,noDragClassName:Ze,noWheelClassName:Fe,noPanClassName:Je,disableKeyboardA11y:Mt},ue.createElement(wO,null,ue.createElement(vO,{edgeTypes:et,onEdgeClick:c,onEdgeDoubleClick:p,onlyRenderVisibleElements:V,onEdgeContextMenu:ye,onEdgeMouseEnter:ke,onEdgeMouseMove:Ye,onEdgeMouseLeave:we,onReconnect:_e,onReconnectStart:Be,onReconnectEnd:it,reconnectRadius:pt,defaultMarkerColor:J,noPanClassName:Je,elevateEdgesOnSelect:!!Xe,disableKeyboardA11y:Mt,rfId:Ot},ue.createElement(SO,{style:k,type:S,component:E,containerStyle:T})),ue.createElement("div",{className:"react-flow__edgelabel-renderer"}),ue.createElement(eO,{nodeTypes:Ft,onNodeClick:u,onNodeDoubleClick:h,onNodeMouseEnter:d,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:C,onlyRenderVisibleElements:V,noPanClassName:Je,noDragClassName:Ze,disableKeyboardA11y:Mt,nodeOrigin:ut,nodeExtent:Qe,rfId:Ot})))};rC.displayName="GraphView";var kO=j.memo(rC);const Nv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],xs={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:Nv,nodeExtent:Nv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:di.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:QI,isValidConnection:void 0},EO=()=>dj((e,n)=>({...xs,setNodes:r=>{const{nodeInternals:i,nodeOrigin:o,elevateNodesOnSelect:l}=n();e({nodeInternals:qd(r,i,o,l)})},getNodes:()=>Array.from(n().nodeInternals.values()),setEdges:r=>{const{defaultEdgeOptions:i={}}=n();e({edges:r.map(o=>({...i,...o}))})},setDefaultNodesAndEdges:(r,i)=>{const o=typeof r<"u",l=typeof i<"u",u=o?qd(r,new Map,n().nodeOrigin,n().elevateNodesOnSelect):new Map;e({nodeInternals:u,edges:l?i:[],hasDefaultNodes:o,hasDefaultEdges:l})},updateNodeDimensions:r=>{const{onNodesChange:i,nodeInternals:o,fitViewOnInit:l,fitViewOnInitDone:u,fitViewOnInitOptions:c,domNode:h,nodeOrigin:p}=n(),d=h==null?void 0:h.querySelector(".react-flow__viewport");if(!d)return;const m=window.getComputedStyle(d),{m22:y}=new window.DOMMatrixReadOnly(m.transform),w=r.reduce((_,b)=>{const S=o.get(b.id);if(S!=null&&S.hidden)o.set(S.id,{...S,[yt]:{...S[yt],handleBounds:void 0}});else if(S){const k=Wv(b.nodeElement);!!(k.width&&k.height&&(S.width!==k.width||S.height!==k.height||b.forceUpdate))&&(o.set(S.id,{...S,[yt]:{...S[yt],handleBounds:{source:Cx(".source",b.nodeElement,y,p),target:Cx(".target",b.nodeElement,y,p)}},...k}),_.push({id:S.id,type:"dimensions",dimensions:k}))}return _},[]);WN(o,p);const N=u||l&&!u&&VN(n,{initial:!0,...c});e({nodeInternals:new Map(o),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(i==null||i(w))},updateNodePositions:(r,i=!0,o=!1)=>{const{triggerNodeChanges:l}=n(),u=r.map(c=>{const h={id:c.id,type:"position",dragging:o};return i&&(h.positionAbsolute=c.positionAbsolute,h.position=c.position),h});l(u)},triggerNodeChanges:r=>{const{onNodesChange:i,nodeInternals:o,hasDefaultNodes:l,nodeOrigin:u,getNodes:c,elevateNodesOnSelect:h}=n();if(r!=null&&r.length){if(l){const p=FM(r,c()),d=qd(p,o,u,h);e({nodeInternals:d})}i==null||i(r)}},addSelectedNodes:r=>{const{multiSelectionActive:i,edges:o,getNodes:l}=n();let u,c=null;i?u=r.map(h=>bs(h,!0)):(u=eo(l(),r),c=eo(o,[])),Zl({changedNodes:u,changedEdges:c,get:n,set:e})},addSelectedEdges:r=>{const{multiSelectionActive:i,edges:o,getNodes:l}=n();let u,c=null;i?u=r.map(h=>bs(h,!0)):(u=eo(o,r),c=eo(l(),[])),Zl({changedNodes:c,changedEdges:u,get:n,set:e})},unselectNodesAndEdges:({nodes:r,edges:i}={})=>{const{edges:o,getNodes:l}=n(),u=r||l(),c=i||o,h=u.map(d=>(d.selected=!1,bs(d.id,!1))),p=c.map(d=>bs(d.id,!1));Zl({changedNodes:h,changedEdges:p,get:n,set:e})},setMinZoom:r=>{const{d3Zoom:i,maxZoom:o}=n();i==null||i.scaleExtent([r,o]),e({minZoom:r})},setMaxZoom:r=>{const{d3Zoom:i,minZoom:o}=n();i==null||i.scaleExtent([o,r]),e({maxZoom:r})},setTranslateExtent:r=>{var i;(i=n().d3Zoom)==null||i.translateExtent(r),e({translateExtent:r})},resetSelectedElements:()=>{const{edges:r,getNodes:i}=n(),l=i().filter(c=>c.selected).map(c=>bs(c.id,!1)),u=r.filter(c=>c.selected).map(c=>bs(c.id,!1));Zl({changedNodes:l,changedEdges:u,get:n,set:e})},setNodeExtent:r=>{const{nodeInternals:i}=n();i.forEach(o=>{o.positionAbsolute=Vv(o.position,r)}),e({nodeExtent:r,nodeInternals:new Map(i)})},panBy:r=>{const{transform:i,width:o,height:l,d3Zoom:u,d3Selection:c,translateExtent:h}=n();if(!u||!c||!r.x&&!r.y)return!1;const p=Fr.translate(i[0]+r.x,i[1]+r.y).scale(i[2]),d=[[0,0],[o,l]],m=u==null?void 0:u.constrain()(p,d,h);return u.transform(c,m),i[0]!==m.x||i[1]!==m.y||i[2]!==m.k},cancelConnection:()=>e({connectionNodeId:xs.connectionNodeId,connectionHandleId:xs.connectionHandleId,connectionHandleType:xs.connectionHandleType,connectionStatus:xs.connectionStatus,connectionStartHandle:xs.connectionStartHandle,connectionEndHandle:xs.connectionEndHandle}),reset:()=>e({...xs})}),Object.is),ey=({children:e})=>{const n=j.useRef(null);return n.current||(n.current=EO()),ue.createElement(HI,{value:n.current},e)};ey.displayName="ReactFlowProvider";const sC=({children:e})=>j.useContext(Iu)?ue.createElement(ue.Fragment,null,e):ue.createElement(ey,null,e);sC.displayName="ReactFlowWrapper";const NO={input:qN,default:kv,output:FN,group:Zv},CO={default:bu,straight:Kv,step:Yv,smoothstep:Mu,simplebezier:Gv},TO=[0,0],RO=[15,15],jO={x:0,y:0,zoom:1},AO={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},iC=j.forwardRef(({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,className:o,nodeTypes:l=NO,edgeTypes:u=CO,onNodeClick:c,onEdgeClick:h,onInit:p,onMove:d,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:b,onClickConnectEnd:S,onNodeMouseEnter:k,onNodeMouseMove:E,onNodeMouseLeave:T,onNodeContextMenu:I,onNodeDoubleClick:O,onNodeDragStart:A,onNodeDrag:U,onNodeDragStop:z,onNodesDelete:P,onEdgesDelete:D,onSelectionChange:V,onSelectionDragStart:B,onSelectionDrag:C,onSelectionDragStop:q,onSelectionContextMenu:L,onSelectionStart:re,onSelectionEnd:Z,connectionMode:H=di.Strict,connectionLineType:J=Ss.Bezier,connectionLineStyle:M,connectionLineComponent:G,connectionLineContainerStyle:Y,deleteKeyCode:$="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:ne=!1,selectionMode:oe=xa.Full,panActivationKeyCode:fe="Space",multiSelectionKeyCode:te=xu()?"Meta":"Control",zoomActivationKeyCode:ce=xu()?"Meta":"Control",snapToGrid:Ce=!1,snapGrid:ve=RO,onlyRenderVisibleElements:je=!1,selectNodesOnDrag:ye=!0,nodesDraggable:ke,nodesConnectable:Ye,nodesFocusable:we,nodeOrigin:_e=TO,edgesFocusable:Be,edgesUpdatable:it,elementsSelectable:pt,defaultViewport:Ze=jO,minZoom:Fe=.5,maxZoom:Je=2,translateExtent:Xe=Nv,preventScrolling:Mt=!0,nodeExtent:ut,defaultMarkerColor:Qe="#b1b1b7",zoomOnScroll:Ot=!0,zoomOnPinch:Ft=!0,panOnScroll:et=!1,panOnScrollSpeed:St=.5,panOnScrollMode:mt=ai.Free,zoomOnDoubleClick:wt=!0,panOnDrag:hn=!0,onPaneClick:Yt,onPaneMouseEnter:Pt,onPaneMouseMove:Sn,onPaneMouseLeave:gr,onPaneScroll:kn,onPaneContextMenu:zt,children:Fn,onEdgeContextMenu:pn,onEdgeDoubleClick:vr,onEdgeMouseEnter:Wr,onEdgeMouseMove:gi,onEdgeMouseLeave:Vr,onEdgeUpdate:ct,onEdgeUpdateStart:vi,onEdgeUpdateEnd:mn,onReconnect:Ts,onReconnectStart:yr,onReconnectEnd:zn,reconnectRadius:En=10,edgeUpdaterRadius:Gr=10,onNodesChange:Yr,onEdgesChange:Kr,noDragClassName:yi="nodrag",noWheelClassName:ir="nowheel",noPanClassName:Rs="nopan",fitView:Nn=!1,fitViewOptions:wr,connectOnClick:js=!0,attributionPosition:As,proOptions:Rt,defaultEdgeOptions:xr,elevateNodesOnSelect:_r=!0,elevateEdgesOnSelect:Kt=!1,disableKeyboardA11y:Xr=!1,autoPanOnConnect:wi=!0,autoPanOnNodeDrag:nt=!0,connectionRadius:br=20,isValidConnection:Qr,onError:Is,style:Zr,id:Jr,nodeDragThreshold:Ms,...or},kt)=>{const Os=Jr||"1";return ue.createElement("div",{...or,style:{...Zr,...AO},ref:kt,className:Dt(["react-flow",o]),"data-testid":"rf__wrapper",id:Jr},ue.createElement(sC,null,ue.createElement(kO,{onInit:p,onMove:d,onMoveStart:m,onMoveEnd:y,onNodeClick:c,onEdgeClick:h,onNodeMouseEnter:k,onNodeMouseMove:E,onNodeMouseLeave:T,onNodeContextMenu:I,onNodeDoubleClick:O,nodeTypes:l,edgeTypes:u,connectionLineType:J,connectionLineStyle:M,connectionLineComponent:G,connectionLineContainerStyle:Y,selectionKeyCode:Q,selectionOnDrag:ne,selectionMode:oe,deleteKeyCode:$,multiSelectionKeyCode:te,panActivationKeyCode:fe,zoomActivationKeyCode:ce,onlyRenderVisibleElements:je,selectNodesOnDrag:ye,defaultViewport:Ze,translateExtent:Xe,minZoom:Fe,maxZoom:Je,preventScrolling:Mt,zoomOnScroll:Ot,zoomOnPinch:Ft,zoomOnDoubleClick:wt,panOnScroll:et,panOnScrollSpeed:St,panOnScrollMode:mt,panOnDrag:hn,onPaneClick:Yt,onPaneMouseEnter:Pt,onPaneMouseMove:Sn,onPaneMouseLeave:gr,onPaneScroll:kn,onPaneContextMenu:zt,onSelectionContextMenu:L,onSelectionStart:re,onSelectionEnd:Z,onEdgeContextMenu:pn,onEdgeDoubleClick:vr,onEdgeMouseEnter:Wr,onEdgeMouseMove:gi,onEdgeMouseLeave:Vr,onReconnect:Ts??ct,onReconnectStart:yr??vi,onReconnectEnd:zn??mn,reconnectRadius:En??Gr,defaultMarkerColor:Qe,noDragClassName:yi,noWheelClassName:ir,noPanClassName:Rs,elevateEdgesOnSelect:Kt,rfId:Os,disableKeyboardA11y:Xr,nodeOrigin:_e,nodeExtent:ut}),ue.createElement(xM,{nodes:e,edges:n,defaultNodes:r,defaultEdges:i,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:b,onClickConnectEnd:S,nodesDraggable:ke,nodesConnectable:Ye,nodesFocusable:we,edgesFocusable:Be,edgesUpdatable:it,elementsSelectable:pt,elevateNodesOnSelect:_r,minZoom:Fe,maxZoom:Je,nodeExtent:ut,onNodesChange:Yr,onEdgesChange:Kr,snapToGrid:Ce,snapGrid:ve,connectionMode:H,translateExtent:Xe,connectOnClick:js,defaultEdgeOptions:xr,fitView:Nn,fitViewOptions:wr,onNodesDelete:P,onEdgesDelete:D,onNodeDragStart:A,onNodeDrag:U,onNodeDragStop:z,onSelectionDrag:C,onSelectionDragStart:B,onSelectionDragStop:q,noPanClassName:Rs,nodeOrigin:_e,rfId:Os,autoPanOnConnect:wi,autoPanOnNodeDrag:nt,onError:Is,connectionRadius:br,isValidConnection:Qr,nodeDragThreshold:Ms}),ue.createElement(yM,{onSelectionChange:V}),Fn,ue.createElement(VI,{proOptions:Rt,position:As}),ue.createElement(EM,{rfId:Os,disableKeyboardA11y:Xr})))});iC.displayName="ReactFlow";const IO=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function oC(){return Ke(IO,Ct)}const aC=({id:e,x:n,y:r,width:i,height:o,style:l,color:u,strokeColor:c,strokeWidth:h,className:p,borderRadius:d,shapeRendering:m,onClick:y,selected:w})=>{const{background:N,backgroundColor:_}=l||{},b=u||N||_;return ue.createElement("rect",{className:Dt(["react-flow__minimap-node",{selected:w},p]),x:n,y:r,rx:d,ry:d,width:i,height:o,fill:b,stroke:c,strokeWidth:h,shapeRendering:m,onClick:y?S=>y(S,e):void 0})};aC.displayName="MiniMapNode";var MO=j.memo(aC);const OO=e=>e.nodeOrigin,PO=e=>e.getNodes().filter(n=>!n.hidden&&n.width&&n.height),Bd=e=>e instanceof Function?e:()=>e;function LO({nodeStrokeColor:e="transparent",nodeColor:n="#e2e2e2",nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:o=2,nodeComponent:l=MO,onClick:u}){const c=Ke(PO,Ct),h=Ke(OO),p=Bd(n),d=Bd(e),m=Bd(r),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ue.createElement(ue.Fragment,null,c.map(w=>{const{x:N,y:_}=ui(w,h).positionAbsolute;return ue.createElement(l,{key:w.id,x:N,y:_,width:w.width,height:w.height,style:w.style,selected:w.selected,className:m(w),color:p(w),borderRadius:i,strokeColor:d(w),strokeWidth:o,shapeRendering:y,onClick:u,id:w.id})}))}var $O=j.memo(LO);const qO=200,DO=150,FO=e=>{const n=e.getNodes(),r={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:r,boundingRect:n.length>0?KI(Ou(n,e.nodeOrigin),r):r,rfId:e.rfId}},zO="react-flow__minimap-desc";function lC({style:e,className:n,nodeStrokeColor:r="transparent",nodeColor:i="#e2e2e2",nodeClassName:o="",nodeBorderRadius:l=5,nodeStrokeWidth:u=2,nodeComponent:c,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:d=1,position:m="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:_=!1,ariaLabel:b="React Flow mini map",inversePan:S=!1,zoomStep:k=10,offsetScale:E=5}){const T=Tt(),I=j.useRef(null),{boundingRect:O,viewBB:A,rfId:U}=Ke(FO,Ct),z=(e==null?void 0:e.width)??qO,P=(e==null?void 0:e.height)??DO,D=O.width/z,V=O.height/P,B=Math.max(D,V),C=B*z,q=B*P,L=E*B,re=O.x-(C-O.width)/2-L,Z=O.y-(q-O.height)/2-L,H=C+L*2,J=q+L*2,M=`${zO}-${U}`,G=j.useRef(0);G.current=B,j.useEffect(()=>{if(I.current){const Q=Ln(I.current),ne=te=>{const{transform:ce,d3Selection:Ce,d3Zoom:ve}=T.getState();if(te.sourceEvent.type!=="wheel"||!Ce||!ve)return;const je=-te.sourceEvent.deltaY*(te.sourceEvent.deltaMode===1?.05:te.sourceEvent.deltaMode?1:.002)*k,ye=ce[2]*Math.pow(2,je);ve.scaleTo(Ce,ye)},oe=te=>{const{transform:ce,d3Selection:Ce,d3Zoom:ve,translateExtent:je,width:ye,height:ke}=T.getState();if(te.sourceEvent.type!=="mousemove"||!Ce||!ve)return;const Ye=G.current*Math.max(1,ce[2])*(S?-1:1),we={x:ce[0]-te.sourceEvent.movementX*Ye,y:ce[1]-te.sourceEvent.movementY*Ye},_e=[[0,0],[ye,ke]],Be=Fr.translate(we.x,we.y).scale(ce[2]),it=ve.constrain()(Be,_e,je);ve.transform(Ce,it)},fe=gN().on("zoom",N?oe:null).on("zoom.wheel",_?ne:null);return Q.call(fe),()=>{Q.on("zoom",null)}}},[N,_,S,k]);const Y=y?Q=>{const ne=Jn(Q);y(Q,{x:ne[0],y:ne[1]})}:void 0,$=w?(Q,ne)=>{const oe=T.getState().nodeInternals.get(ne);w(Q,oe)}:void 0;return ue.createElement(Hv,{position:m,style:e,className:Dt(["react-flow__minimap",n]),"data-testid":"rf__minimap"},ue.createElement("svg",{width:z,height:P,viewBox:`${re} ${Z} ${H} ${J}`,role:"img","aria-labelledby":M,ref:I,onClick:Y},b&&ue.createElement("title",{id:M},b),ue.createElement($O,{onClick:$,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:l,nodeClassName:o,nodeStrokeWidth:u,nodeComponent:c}),ue.createElement("path",{className:"react-flow__minimap-mask",d:`M${re-L},${Z-L}h${H+L*2}v${J+L*2}h${-H-L*2}z
57
- M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:d,pointerEvents:"none"})))}lC.displayName="MiniMap";var BO=j.memo(lC);function UO(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ue.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function HO(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ue.createElement("path",{d:"M0 0h32v4.2H0z"}))}function WO(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ue.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 VO(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.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 GO(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.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 to=({children:e,className:n,...r})=>ue.createElement("button",{type:"button",className:Dt(["react-flow__controls-button",n]),...r},e);to.displayName="ControlButton";const YO=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),uC=({style:e,showZoom:n=!0,showFitView:r=!0,showInteractive:i=!0,fitViewOptions:o,onZoomIn:l,onZoomOut:u,onFitView:c,onInteractiveChange:h,className:p,children:d,position:m="bottom-left"})=>{const y=Tt(),[w,N]=j.useState(!1),{isInteractive:_,minZoomReached:b,maxZoomReached:S}=Ke(YO,Ct),{zoomIn:k,zoomOut:E,fitView:T}=Ta();if(j.useEffect(()=>{N(!0)},[]),!w)return null;const I=()=>{k(),l==null||l()},O=()=>{E(),u==null||u()},A=()=>{T(o),c==null||c()},U=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),h==null||h(!_)};return ue.createElement(Hv,{className:Dt(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},n&&ue.createElement(ue.Fragment,null,ue.createElement(to,{onClick:I,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:S},ue.createElement(UO,null)),ue.createElement(to,{onClick:O,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:b},ue.createElement(HO,null))),r&&ue.createElement(to,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},ue.createElement(WO,null)),i&&ue.createElement(to,{className:"react-flow__controls-interactive",onClick:U,title:"toggle interactivity","aria-label":"toggle interactivity"},_?ue.createElement(GO,null):ue.createElement(VO,null)),d)};uC.displayName="Controls";var KO=j.memo(uC),tr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(tr||(tr={}));function XO({color:e,dimensions:n,lineWidth:r}){return ue.createElement("path",{stroke:e,strokeWidth:r,d:`M${n[0]/2} 0 V${n[1]} M0 ${n[1]/2} H${n[0]}`})}function QO({color:e,radius:n}){return ue.createElement("circle",{cx:n,cy:n,r:n,fill:e})}const ZO={[tr.Dots]:"#91919a",[tr.Lines]:"#eee",[tr.Cross]:"#e2e2e2"},JO={[tr.Dots]:1,[tr.Lines]:1,[tr.Cross]:6},eP=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function cC({id:e,variant:n=tr.Dots,gap:r=20,size:i,lineWidth:o=1,offset:l=2,color:u,style:c,className:h}){const p=j.useRef(null),{transform:d,patternId:m}=Ke(eP,Ct),y=u||ZO[n],w=i||JO[n],N=n===tr.Dots,_=n===tr.Cross,b=Array.isArray(r)?r:[r,r],S=[b[0]*d[2]||1,b[1]*d[2]||1],k=w*d[2],E=_?[k,k]:S,T=N?[k/l,k/l]:[E[0]/l,E[1]/l];return ue.createElement("svg",{className:Dt(["react-flow__background",h]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},ue.createElement("pattern",{id:m+e,x:d[0]%S[0],y:d[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`},N?ue.createElement(QO,{color:y,radius:k/l}):ue.createElement(XO,{dimensions:E,color:y,lineWidth:o})),ue.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}cC.displayName="Background";var tP=j.memo(cC);function dC(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function fC(e){const n=e.cache_creation,r=n&&typeof n=="object"?n:e,i=r.ephemeral_1h_input_tokens,o=r.ephemeral_5m_input_tokens;return typeof i!="number"&&typeof o!="number"?{}:{cacheCreate1hTokens:Number(i??0),cacheCreate5mTokens:Number(o??0)}}function hC(e,n=0){if(!e||typeof e!="object"||n>6)return null;const r=e;if(typeof r.input_tokens=="number"||typeof r.output_tokens=="number"||typeof r.cache_read_input_tokens=="number"||typeof r.cache_creation_input_tokens=="number")return{inputTokens:Number(r.input_tokens??0),outputTokens:Number(r.output_tokens??0),cacheReadTokens:Number(r.cache_read_input_tokens??0),cacheCreateTokens:Number(r.cache_creation_input_tokens??0),...fC(r)};for(const i of Object.values(r)){const o=hC(i,n+1);if(o)return o}return null}function nP(e,n){e.inputTokens+=n.inputTokens,e.outputTokens+=n.outputTokens,e.cacheReadTokens+=n.cacheReadTokens,e.cacheCreateTokens+=n.cacheCreateTokens,(n.cacheCreate1hTokens!==void 0||n.cacheCreate5mTokens!==void 0)&&(e.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(n.cacheCreate1hTokens??0),e.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(n.cacheCreate5mTokens??0))}const rP=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function pC(e,n=0){if(!e||typeof e!="object"||n>6)return null;const r=e;if(typeof r.model=="string"&&rP.test(r.model))return r.model;for(const i of Object.values(r)){const o=pC(i,n+1);if(o)return o}return null}function Cv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0}}function Es(e){if(!e)return;const n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n[n.length-1]}function Ra(e,n){return`${e}::${n}`}function Su(e){return e.agent_type??e.subagent_type??"subagent"}function ha(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function no(e,n,r,i){const o=n;let l=e.agents.get(o);return l||(l={id:o,sessionId:n,label:"session",kind:"root",state:"active",startedAt:r,lastEventAt:r,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:i,usage:dC()},e.agents.set(o,l),l)}function mC(e,n,r,i){const o=Ra(n,r),l=e.agents.get(o);if(!l)return null;!l.cwd&&i.cwd&&(l.cwd=i.cwd,l.cwdBasename=Es(i.cwd));const u=Su(i);return u&&(l.label==="subagent"||!l.label)&&(l.label=u),l}function Px(e,n,r){const i=n.session_id??"unknown",o=ha(n);if(o){const h=mC(e,i,o,n);if(h)return h}const l=e.activeSubagentStack.get(i),u=l&&l.length>0?l[l.length-1]:null;if(u){const h=e.agents.get(Ra(i,u));if(h)return!h.cwd&&n.cwd&&(h.cwd=n.cwd,h.cwdBasename=Es(n.cwd)),h}const c=no(e,i,r,!1);return c.synthetic&&(c.synthetic=!1,c.startedAt=r),!c.cwd&&n.cwd&&(c.cwd=n.cwd,c.cwdBasename=Es(n.cwd)),c.label==="session"&&n.cwd&&(c.label=Es(n.cwd)??"session"),c}function sP(e,n,r,i,o){const l=Ra(n,r),u=no(e,n,o,!0);let c=e.agents.get(l);if(c){!c.cwd&&i.cwd&&(c.cwd=i.cwd,c.cwdBasename=Es(i.cwd));const h=Su(i);return h&&(c.label==="subagent"||!c.label)&&(c.label=h),c}return c={id:l,sessionId:n,label:Su(i),kind:"subagent",parentId:u.id,state:"active",startedAt:o,tools:[],prompts:[],cwd:i.cwd,cwdBasename:Es(i.cwd),toolCount:0,childCount:0,usage:dC()},e.agents.set(l,c),u.childCount+=1,c}function iP(e,n,r){const i=e.activeSubagentStack.get(n)??[];i.includes(r)||(i.push(r),e.activeSubagentStack.set(n,i))}function oP(e,n,r){const i=e.activeSubagentStack.get(n);if(i){for(let o=i.length-1;o>=0;o--)if(i[o]===r){i.splice(o,1);break}i.length===0&&e.activeSubagentStack.delete(n)}}function eu(e,n=80){if(e==null)return"";if(typeof e=="string")return e.length>n?e.slice(0,n-1)+"…":e;try{const r=JSON.stringify(e);return r.length>n?r.slice(0,n-1)+"…":r}catch{return String(e)}}const Lx=200,aP=25;function lP(e,n){const r=n.tools;if(r.length>Lx){const i=r.splice(0,r.length-Lx);for(const o of i)e.toolIndex.delete(o.id),e.toolOwner.delete(o.id)}for(let i=r.length-aP-1;i>=0;i--){const o=r[i];if(o.trimmed)break;o.input=void 0,o.response=void 0,o.trimmed=!0}}function uP(e,n,r){const i=e.toolIndex.get(r);if(i)return i;for(let o=n.tools.length-1;o>=0;o--)if(n.tools[o].id===r)return n.tools[o];return null}const $x=2e3;function cP(e,n,r){for(let i=e.prompts.length-1;i>=0;i--){const o=e.prompts[i];if(o.at<n-$x)return!1;if(o.text===r&&o.at<=n+$x)return!0}return!1}function dP(e,n,r,i){if(e.agents.size<=r)return!1;const o=[];for(const[u,c]of e.agents)c.state==="done"&&c.endedAt!=null&&n-c.endedAt>i&&o.push({id:u,endedAt:c.endedAt});if(o.length===0)return!1;o.sort((u,c)=>u.endedAt-c.endedAt);let l=0;for(const u of o){if(e.agents.size<=r)break;e.agents.delete(u.id),l++}return l>0}function fP(e,n,r,i){const o=new Map;for(const[p,d]of e.agents){let m=o.get(d.sessionId);m||(m={ids:[],endedAt:0,live:!1},o.set(d.sessionId,m)),m.ids.push(p),d.state==="done"&&d.endedAt!=null?m.endedAt=Math.max(m.endedAt,d.endedAt):m.live=!0}const l=[...o.values()].filter(p=>!p.live&&p.endedAt>0&&n-p.endedAt>i).sort((p,d)=>p.endedAt-d.endedAt);let c=[...o.values()].filter(p=>!p.live).length-r;if(c<=0)return!1;let h=!1;for(const p of l){if(c<=0)break;for(const d of p.ids)e.agents.delete(d);c--,h=!0}return h}function hP(e,n,r){let i=!1;for(const o of e.agents.values())if(o.provider!=="codex")for(const l of o.tools)l.endedAt==null&&n-l.startedAt>r&&(l.endedAt=l.startedAt+r,l.ok=!1,l.errorPreview="stale (no PostToolUse received)",e.toolIndex.delete(l.id),e.toolOwner.delete(l.id),i=!0);return i}const pP=90*6e4;function mP(e,n,r){let i=!1;for(const o of e.agents.values()){if(o.kind!=="root")continue;const l=o.lastEventAt??o.startedAt;if(!(n-l<=r)){o.waiting&&(o.waiting=null,i=!0),o.state==="active"&&(o.state="done",o.endedAt=l,o.reaped=!0,i=!0);for(const u of e.agents.values())u.sessionId!==o.sessionId||u.kind==="root"||u.state!=="active"||(u.state="done",u.endedAt=l,i=!0)}}return i}function gP(e){return e==="permission_prompt"?"permission":e==="idle_prompt"?"idle":null}const vP=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved"]);function yP(e,n){let r=null;for(const i of e.toolIndex.values()){const o=i.agentId?e.agents.get(i.agentId):void 0;!o||o.sessionId!==n||(!r||i.startedAt>r.startedAt)&&(r=i)}return r==null?void 0:r.explicitSubagentId}function wP(e,n,r,i,o){const l=r==="permission"?yP(e,n):void 0;return l?{kind:r,message:i,since:o,subagentId:l}:{kind:r,message:i,since:o}}function xP(e,n,r){if(e.kind!=="permission")return!0;const i=ha(n);return i==null?!0:e.subagentId!=null&&Ra(r,i)===e.subagentId}function qx(e,n){const r=n.epoch??null;if(r!==null&&r!==e.seqEpoch)e.seqEpoch=r,e.lastSeq=0;else if(n.seq<=e.lastSeq)return e;const i=n.payload??{},o=n.receivedAt,l=i.hook_event_name??"Unknown";if(l==="__clear")return{...Cv(),lastSeq:n.seq,seqEpoch:e.seqEpoch};e.totalEvents+=1,e.lastSeq=n.seq;const u=i.session_id??"unknown";if(!vP.has(l)){const d=e.agents.get(u);d!=null&&d.waiting&&xP(d.waiting,i,u)&&(d.waiting=null)}const c=e.agents.get(u);if(c&&o>(c.lastEventAt??0)&&(c.lastEventAt=o,c.reaped&&(c.reaped=!1,c.state="active",c.endedAt=void 0)),typeof i.model_context_window=="number"&&i.model_context_window>0){const d=e.agents.get(u);d&&(d.contextWindow=i.model_context_window)}if(typeof i.approval_policy=="string"&&i.approval_policy){const d=e.agents.get(u);d&&(d.approvalPolicy=i.approval_policy)}if(l==="ModelObserved"){const d=typeof i.model=="string"?i.model:null;if(d){const y=e.agents.get(u);y&&(y.model=d)}const m=i.subagentModels;if(m&&typeof m=="object")for(const[y,w]of Object.entries(m)){if(typeof w!="string")continue;const N=`${u}::${y}`,_=e.agents.get(N);_&&(_.model=w)}return e}if(l==="ContextObserved"){const d=i.context??null;if(d){const m=e.agents.get(u);m&&(m.context={msgsUser:Number(d.msgsUser??0),msgsAssistant:Number(d.msgsAssistant??0),toolUses:Number(d.toolUses??0),toolResults:Number(d.toolResults??0),systemReminders:Number(d.systemReminders??0),currentContextTokens:Number(d.currentContextTokens??0),claudeMdFiles:Array.isArray(d.claudeMdFiles)?d.claudeMdFiles:[]})}return e}if(l==="UsageObserved"){const d=i.usage??null;if(d){const m=e.agents.get(u);if(m){m.usage.inputTokens=Number(d.input_tokens??0),m.usage.outputTokens=Number(d.output_tokens??0),m.usage.cacheReadTokens=Number(d.cache_read_input_tokens??d.cached_input_tokens??0),m.usage.cacheCreateTokens=Number(d.cache_creation_input_tokens??d.cache_write_input_tokens??0);const y=fC(d);m.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,m.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof d.reasoning_output_tokens=="number"&&(m.usage.reasoningOutputTokens=Number(d.reasoning_output_tokens))}}return e}const h=Px(e,i,o);h.provider||(h.provider=i.provider==="codex"?"codex":"claude");const p=pC(i);switch(p&&(h.model=p),l){case"SessionStart":{const d=no(e,u,o,!1);d.synthetic=!1,d.state="active",d.startedAt=d.startedAt||o,!d.cwd&&i.cwd&&(d.cwd=i.cwd,d.cwdBasename=Es(i.cwd)),d.label==="session"&&i.cwd&&(d.label=Es(i.cwd)??"session");break}case"UserPromptSubmit":{for(const w of e.agents.values())w.sessionId===u&&w.kind==="subagent"&&w.state==="done"&&w.exitAt==null&&w.endedAt!=null&&w.endedAt<o&&(w.exitAt=o);const d=no(e,u,o,!1);d.state="active",d.endedAt=void 0,d.exitAt=void 0;const m=Px(e,i,o);m.state="active",m.exitAt=void 0,m.endedAt=void 0;const y=(typeof i.prompt=="string"?i.prompt:typeof i.message=="string"?i.message:"")??"";y&&!cP(m,o,y)&&(m.prompts.push({at:o,text:y}),m.firstPrompt||(m.firstPrompt=eu(y,120)));break}case"PreToolUse":{const d=i.tool_use_id?uP(e,h,i.tool_use_id):null;if(d){i.tool_name&&d.name==="?"&&(d.name=i.tool_name),d.endedAt==null&&!d.trimmed&&i.tool_input!==void 0&&(d.input=i.tool_input,d.inputPreview=eu(i.tool_input));break}const m=i.tool_use_id??`${h.id}:${h.toolCount}`,y=ha(i),w={id:m,name:i.tool_name??"?",input:i.tool_input,inputPreview:eu(i.tool_input),agentId:h.id,explicitSubagentId:y?Ra(u,y):void 0,startedAt:o};h.tools.push(w),h.toolCount+=1,h.state="active",e.toolIndex.set(m,w),e.toolOwner.set(m,h.id),lP(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const d=i.tool_use_id;if(!d)break;let m=e.toolIndex.get(d),y=!1;if(!m)for(const _ of e.agents.values()){const b=_.tools.find(S=>S.id===d);if(b){m=b,y=!0;break}}if(!m)break;m.endedAt=o,m.ok=l==="PostToolUse",m.trimmed||(m.response=i.tool_response),l==="PostToolUseFailure"?m.errorPreview=eu(i.tool_response):y&&(m.errorPreview=void 0);const w=hC(i.tool_response);w&&(m.usage=w),e.toolIndex.delete(d);const N=e.toolOwner.get(d)??m.agentId;if(e.toolOwner.delete(d),N&&w){const _=e.agents.get(N);_&&nP(_.usage,w)}break}case"SubagentStart":{const d=ha(i);if(!d)break;const m=sP(e,u,d,i,o);m.state="active",m.startedAt=m.startedAt||o,m.exitAt=void 0,m.endedAt=void 0;const y=Su(i);y&&(m.label=y),iP(e,u,d);break}case"SubagentStop":{const d=ha(i);if(!d)break;const m=mC(e,u,d,i);if(!m)break;m.state="done",m.endedAt=o,oP(e,u,d);break}case"Stop":case"SessionEnd":{const d=no(e,u,o,!1);d.state="done",d.endedAt=o,e.activeSubagentStack.delete(u);break}case"Notification":{const d=gP(i.notification_type);if(!d)break;const m=no(e,u,o,!1),y=typeof i.message=="string"?i.message:"",w=m.waiting;m.waiting=w&&w.kind===d&&w.message===y?{...w,since:Math.min(w.since,o)}:wP(e,u,d,y,o);break}}return e}function ty(e){let n=5381;for(let r=0;r<e.length;r++)n=(n<<5)+n^e.charCodeAt(r);return Math.abs(n)%360}const _P=Date.UTC(2026,8,1);function bP(e){return e<_P?{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}}const SP=[{match:/^claude[-_](fable|mythos)[-_]5\b/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_]opus[-_]5\b/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]sonnet[-_]5\b/i,rates:bP},{match:/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]opus[-_]4(?:[-_.]1)?\b/i,rates:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}},{match:/^claude[-_]sonnet[-_]4[-_.](?:5|6)\b/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]sonnet[-_]4\b/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]haiku[-_]4[-_.]5\b/i,rates:{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}},{match:/^claude[-_]haiku[-_]3[-_.]5\b/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\b/i,rates:{input:15,output:60,cacheRead:7.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/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 kP(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function fo(e,n=Date.now()){if(!e)return null;for(const r of SP)if(r.match.test(e))return typeof r.rates=="function"?r.rates(n):r.rates;return null}function gC(e,n){const r=Math.max(0,e.cacheCreate1hTokens??0),i=Math.max(0,e.cacheCreate5mTokens??0),o=Math.max(0,e.cacheCreateTokens-r-i),l=i+o,u=n.cacheWrite1h??n.cacheWrite;return{tokens5m:l,tokens1h:r,usd5m:l*n.cacheWrite/1e6,usd1h:r*u/1e6}}function vC(e,n,r=Date.now()){if(!kP(n))return e.inputTokens;const i=fo(n,r),o=((i==null?void 0:i.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-o)}function dn(e,n,r=Date.now()){const i=fo(n,r);if(!i)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const o=vC(e,n,r)*i.input/1e6,l=e.outputTokens*i.output/1e6,u=e.cacheReadTokens*i.cacheRead/1e6,c=gC(e,i),h=c.usd5m+c.usd1h;return{input:o,output:l,cacheRead:u,cacheWrite:h,total:o+l+u+h}}const Dx=2e5,EP=1e6,NP=[/\[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],CP=[{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 TP(e){if(!e)return Dx;for(const n of NP)if(n.test(e))return EP;for(const n of CP)if(n.match.test(e))return n.window;return Dx}function yC(e,n){return typeof e=="number"&&e>0?e:TP(n)}const fu="not priced";function De(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const n=(e*100).toFixed(e<.1?1:0);if(Number(n)<100)return`${n}¢`}return e<100?`$${e.toFixed(2)}`:e<1e4?`$${e.toFixed(0)}`:`$${(e/1e3).toFixed(1)}k`}function ku(e,n){if(e<=0||n<10)return null;const r=e/n,i=r*60;return i>=.01?`${De(i)}/min`:`${De(r*3600)}/hr`}const RP=new Set(["untrusted","on-request","on-failure"]);function jP(e){return typeof e!="string"||!e?null:RP.has(e)?!0:e==="never"?!1:null}function AP(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const n=jP(e.approvalPolicy);return n===!1?null:{label:"approvals not visible",detail:`${n===!0?`This session's approval policy is "${e.approvalPolicy}", so Codex can stop and ask you to approve a command.`:"This session's approval policy has not been read yet, so it may be able to stop and ask you to approve a command."}
56
+ */var Hw;function rj(){if(Hw)return jd;Hw=1;var e=ka(),n=nj();function r(p,d){return p===d&&(p!==0||1/p===1/d)||p!==p&&d!==d}var i=typeof Object.is=="function"?Object.is:r,o=n.useSyncExternalStore,l=e.useRef,u=e.useEffect,c=e.useMemo,h=e.useDebugValue;return jd.useSyncExternalStoreWithSelector=function(p,d,m,y,w){var N=l(null);if(N.current===null){var _={hasValue:!1,value:null};N.current=_}else _=N.current;N=c(function(){function S(O){if(!k){if(k=!0,E=O,O=y(O),w!==void 0&&_.hasValue){var A=_.value;if(w(A,O))return T=A}return T=O}if(A=T,i(E,O))return A;var U=y(O);return w!==void 0&&w(A,U)?(E=O,A):(E=O,T=U)}var k=!1,E,T,I=m===void 0?null:m;return[function(){return S(d())},I===null?void 0:function(){return S(I())}]},[d,m,y,w]);var b=o(p,N[0],N[1]);return u(function(){_.hasValue=!0,_.value=b},[b]),h(b),b},jd}var Ww;function sj(){return Ww||(Ww=1,Rd.exports=rj()),Rd.exports}var ij=sj();const oj=$v(ij),aj={},Vw=e=>{let n;const r=new Set,i=(d,m)=>{const y=typeof d=="function"?d(n):d;if(!Object.is(y,n)){const w=n;n=m??(typeof y!="object"||y===null)?y:Object.assign({},n,y),r.forEach(N=>N(n,w))}},o=()=>n,h={setState:i,getState:o,getInitialState:()=>p,subscribe:d=>(r.add(d),()=>r.delete(d)),destroy:()=>{(aj?"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."),r.clear()}},p=n=e(i,o,h);return h},lj=e=>e?Vw(e):Vw,{useDebugValue:uj}=ue,{useSyncExternalStoreWithSelector:cj}=oj,dj=e=>e;function UE(e,n=dj,r){const i=cj(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,r);return uj(i),i}const Gw=(e,n)=>{const r=lj(e),i=(o,l=n)=>UE(r,o,l);return Object.assign(i,r),i},fj=(e,n)=>e?Gw(e,n):Gw;function Ct(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[i,o]of e)if(!Object.is(o,n.get(i)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const i of e)if(!n.has(i))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;for(const i of r)if(!Object.prototype.hasOwnProperty.call(n,i)||!Object.is(e[i],n[i]))return!1;return!0}var hj={value:()=>{}};function Tu(){for(var e=0,n=arguments.length,r={},i;e<n;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new lu(r)}function lu(e){this._=e}function pj(e,n){return e.trim().split(/^|\s+/).map(function(r){var i="",o=r.indexOf(".");if(o>=0&&(i=r.slice(o+1),r=r.slice(0,o)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}lu.prototype=Tu.prototype={constructor:lu,on:function(e,n){var r=this._,i=pj(e+"",r),o,l=-1,u=i.length;if(arguments.length<2){for(;++l<u;)if((o=(e=i[l]).type)&&(o=mj(r[o],e.name)))return o;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++l<u;)if(o=(e=i[l]).type)r[o]=Yw(r[o],e.name,n);else if(n==null)for(o in r)r[o]=Yw(r[o],e.name,null);return this},copy:function(){var e={},n=this._;for(var r in n)e[r]=n[r].slice();return new lu(e)},call:function(e,n){if((o=arguments.length-2)>0)for(var r=new Array(o),i=0,o,l;i<o;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,o=l.length;i<o;++i)l[i].value.apply(n,r)},apply:function(e,n,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],o=0,l=i.length;o<l;++o)i[o].value.apply(n,r)}};function mj(e,n){for(var r=0,i=e.length,o;r<i;++r)if((o=e[r]).name===n)return o.value}function Yw(e,n,r){for(var i=0,o=e.length;i<o;++i)if(e[i].name===n){e[i]=hj,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:n,value:r}),e}var dv="http://www.w3.org/1999/xhtml";const Kw={svg:"http://www.w3.org/2000/svg",xhtml:dv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ru(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Kw.hasOwnProperty(n)?{space:Kw[n],local:e}:e}function gj(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===dv&&n.documentElement.namespaceURI===dv?n.createElement(e):n.createElementNS(r,e)}}function vj(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function HE(e){var n=Ru(e);return(n.local?vj:gj)(n)}function yj(){}function qv(e){return e==null?yj:function(){return this.querySelector(e)}}function wj(e){typeof e!="function"&&(e=qv(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=new Array(u),h,p,d=0;d<u;++d)(h=l[d])&&(p=e.call(h,h.__data__,d,l))&&("__data__"in h&&(p.__data__=h.__data__),c[d]=p);return new bn(i,this._parents)}function xj(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function _j(){return[]}function WE(e){return e==null?_j:function(){return this.querySelectorAll(e)}}function bj(e){return function(){return xj(e.apply(this,arguments))}}function Sj(e){typeof e=="function"?e=bj(e):e=WE(e);for(var n=this._groups,r=n.length,i=[],o=[],l=0;l<r;++l)for(var u=n[l],c=u.length,h,p=0;p<c;++p)(h=u[p])&&(i.push(e.call(h,h.__data__,p,u)),o.push(h));return new bn(i,o)}function VE(e){return function(){return this.matches(e)}}function GE(e){return function(n){return n.matches(e)}}var kj=Array.prototype.find;function Ej(e){return function(){return kj.call(this.children,e)}}function Nj(){return this.firstElementChild}function Cj(e){return this.select(e==null?Nj:Ej(typeof e=="function"?e:GE(e)))}var Tj=Array.prototype.filter;function Rj(){return Array.from(this.children)}function jj(e){return function(){return Tj.call(this.children,e)}}function Aj(e){return this.selectAll(e==null?Rj:jj(typeof e=="function"?e:GE(e)))}function Ij(e){typeof e!="function"&&(e=VE(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=[],h,p=0;p<u;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&c.push(h);return new bn(i,this._parents)}function YE(e){return new Array(e.length)}function Mj(){return new bn(this._enter||this._groups.map(YE),this._parents)}function pu(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}pu.prototype={constructor:pu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Oj(e){return function(){return e}}function Pj(e,n,r,i,o,l){for(var u=0,c,h=n.length,p=l.length;u<p;++u)(c=n[u])?(c.__data__=l[u],i[u]=c):r[u]=new pu(e,l[u]);for(;u<h;++u)(c=n[u])&&(o[u]=c)}function Lj(e,n,r,i,o,l,u){var c,h,p=new Map,d=n.length,m=l.length,y=new Array(d),w;for(c=0;c<d;++c)(h=n[c])&&(y[c]=w=u.call(h,h.__data__,c,n)+"",p.has(w)?o[c]=h:p.set(w,h));for(c=0;c<m;++c)w=u.call(e,l[c],c,l)+"",(h=p.get(w))?(i[c]=h,h.__data__=l[c],p.delete(w)):r[c]=new pu(e,l[c]);for(c=0;c<d;++c)(h=n[c])&&p.get(y[c])===h&&(o[c]=h)}function $j(e){return e.__data__}function qj(e,n){if(!arguments.length)return Array.from(this,$j);var r=n?Lj:Pj,i=this._parents,o=this._groups;typeof e!="function"&&(e=Oj(e));for(var l=o.length,u=new Array(l),c=new Array(l),h=new Array(l),p=0;p<l;++p){var d=i[p],m=o[p],y=m.length,w=Dj(e.call(d,d&&d.__data__,p,i)),N=w.length,_=c[p]=new Array(N),b=u[p]=new Array(N),S=h[p]=new Array(y);r(d,m,_,b,S,w,n);for(var k=0,E=0,T,I;k<N;++k)if(T=_[k]){for(k>=E&&(E=k+1);!(I=b[E])&&++E<N;);T._next=I||null}}return u=new bn(u,i),u._enter=c,u._exit=h,u}function Dj(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Fj(){return new bn(this._exit||this._groups.map(YE),this._parents)}function zj(e,n,r){var i=this.enter(),o=this,l=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(o=n(o),o&&(o=o.selection())),r==null?l.remove():r(l),i&&o?i.merge(o).order():o}function Bj(e){for(var n=e.selection?e.selection():e,r=this._groups,i=n._groups,o=r.length,l=i.length,u=Math.min(o,l),c=new Array(o),h=0;h<u;++h)for(var p=r[h],d=i[h],m=p.length,y=c[h]=new Array(m),w,N=0;N<m;++N)(w=p[N]||d[N])&&(y[N]=w);for(;h<o;++h)c[h]=r[h];return new bn(c,this._parents)}function Uj(){for(var e=this._groups,n=-1,r=e.length;++n<r;)for(var i=e[n],o=i.length-1,l=i[o],u;--o>=0;)(u=i[o])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function Hj(e){e||(e=Wj);function n(m,y){return m&&y?e(m.__data__,y.__data__):!m-!y}for(var r=this._groups,i=r.length,o=new Array(i),l=0;l<i;++l){for(var u=r[l],c=u.length,h=o[l]=new Array(c),p,d=0;d<c;++d)(p=u[d])&&(h[d]=p);h.sort(n)}return new bn(o,this._parents).order()}function Wj(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function Vj(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Gj(){return Array.from(this)}function Yj(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,l=i.length;o<l;++o){var u=i[o];if(u)return u}return null}function Kj(){let e=0;for(const n of this)++e;return e}function Xj(){return!this.node()}function Qj(e){for(var n=this._groups,r=0,i=n.length;r<i;++r)for(var o=n[r],l=0,u=o.length,c;l<u;++l)(c=o[l])&&e.call(c,c.__data__,l,o);return this}function Zj(e){return function(){this.removeAttribute(e)}}function Jj(e){return function(){this.removeAttributeNS(e.space,e.local)}}function eA(e,n){return function(){this.setAttribute(e,n)}}function tA(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function nA(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function rA(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function sA(e,n){var r=Ru(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((n==null?r.local?Jj:Zj:typeof n=="function"?r.local?rA:nA:r.local?tA:eA)(r,n))}function KE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function iA(e){return function(){this.style.removeProperty(e)}}function oA(e,n,r){return function(){this.style.setProperty(e,n,r)}}function aA(e,n,r){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function lA(e,n,r){return arguments.length>1?this.each((n==null?iA:typeof n=="function"?aA:oA)(e,n,r??"")):ao(this.node(),e)}function ao(e,n){return e.style.getPropertyValue(n)||KE(e).getComputedStyle(e,null).getPropertyValue(n)}function uA(e){return function(){delete this[e]}}function cA(e,n){return function(){this[e]=n}}function dA(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function fA(e,n){return arguments.length>1?this.each((n==null?uA:typeof n=="function"?dA:cA)(e,n)):this.node()[e]}function XE(e){return e.trim().split(/^|\s+/)}function Dv(e){return e.classList||new QE(e)}function QE(e){this._node=e,this._names=XE(e.getAttribute("class")||"")}QE.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ZE(e,n){for(var r=Dv(e),i=-1,o=n.length;++i<o;)r.add(n[i])}function JE(e,n){for(var r=Dv(e),i=-1,o=n.length;++i<o;)r.remove(n[i])}function hA(e){return function(){ZE(this,e)}}function pA(e){return function(){JE(this,e)}}function mA(e,n){return function(){(n.apply(this,arguments)?ZE:JE)(this,e)}}function gA(e,n){var r=XE(e+"");if(arguments.length<2){for(var i=Dv(this.node()),o=-1,l=r.length;++o<l;)if(!i.contains(r[o]))return!1;return!0}return this.each((typeof n=="function"?mA:n?hA:pA)(r,n))}function vA(){this.textContent=""}function yA(e){return function(){this.textContent=e}}function wA(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function xA(e){return arguments.length?this.each(e==null?vA:(typeof e=="function"?wA:yA)(e)):this.node().textContent}function _A(){this.innerHTML=""}function bA(e){return function(){this.innerHTML=e}}function SA(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function kA(e){return arguments.length?this.each(e==null?_A:(typeof e=="function"?SA:bA)(e)):this.node().innerHTML}function EA(){this.nextSibling&&this.parentNode.appendChild(this)}function NA(){return this.each(EA)}function CA(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function TA(){return this.each(CA)}function RA(e){var n=typeof e=="function"?e:HE(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function jA(){return null}function AA(e,n){var r=typeof e=="function"?e:HE(e),i=n==null?jA:typeof n=="function"?n:qv(n);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function IA(){var e=this.parentNode;e&&e.removeChild(this)}function MA(){return this.each(IA)}function OA(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function PA(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function LA(e){return this.select(e?PA:OA)}function $A(e){return arguments.length?this.property("__data__",e):this.node().__data__}function qA(e){return function(n){e.call(this,n,this.__data__)}}function DA(e){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");return i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function FA(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,o=n.length,l;r<o;++r)l=n[r],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):n[++i]=l;++i?n.length=i:delete this.__on}}}function zA(e,n,r){return function(){var i=this.__on,o,l=qA(n);if(i){for(var u=0,c=i.length;u<c;++u)if((o=i[u]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=l,o.options=r),o.value=n;return}}this.addEventListener(e.type,l,r),o={type:e.type,name:e.name,value:n,listener:l,options:r},i?i.push(o):this.__on=[o]}}function BA(e,n,r){var i=DA(e+""),o,l=i.length,u;if(arguments.length<2){var c=this.node().__on;if(c){for(var h=0,p=c.length,d;h<p;++h)for(o=0,d=c[h];o<l;++o)if((u=i[o]).type===d.type&&u.name===d.name)return d.value}return}for(c=n?zA:FA,o=0;o<l;++o)this.each(c(i[o],n,r));return this}function eN(e,n,r){var i=KE(e),o=i.CustomEvent;typeof o=="function"?o=new o(n,r):(o=i.document.createEvent("Event"),r?(o.initEvent(n,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function UA(e,n){return function(){return eN(this,e,n)}}function HA(e,n){return function(){return eN(this,e,n.apply(this,arguments))}}function WA(e,n){return this.each((typeof n=="function"?HA:UA)(e,n))}function*VA(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,l=i.length,u;o<l;++o)(u=i[o])&&(yield u)}var tN=[null];function bn(e,n){this._groups=e,this._parents=n}function Ea(){return new bn([[document.documentElement]],tN)}function GA(){return this}bn.prototype=Ea.prototype={constructor:bn,select:wj,selectAll:Sj,selectChild:Cj,selectChildren:Aj,filter:Ij,data:qj,enter:Mj,exit:Fj,join:zj,merge:Bj,selection:GA,order:Uj,sort:Hj,call:Vj,nodes:Gj,node:Yj,size:Kj,empty:Xj,each:Qj,attr:sA,style:lA,property:fA,classed:gA,text:xA,html:kA,raise:NA,lower:TA,append:RA,insert:AA,remove:MA,clone:LA,datum:$A,on:BA,dispatch:WA,[Symbol.iterator]:VA};function Ln(e){return typeof e=="string"?new bn([[document.querySelector(e)]],[document.documentElement]):new bn([[e]],tN)}function YA(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Jn(e,n){if(e=YA(e),n===void 0&&(n=e.currentTarget),n){var r=n.ownerSVGElement||n;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}const KA={passive:!1},pa={capture:!0,passive:!1};function Md(e){e.stopImmediatePropagation()}function ro(e){e.preventDefault(),e.stopImmediatePropagation()}function nN(e){var n=e.document.documentElement,r=Ln(e).on("dragstart.drag",ro,pa);"onselectstart"in n?r.on("selectstart.drag",ro,pa):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function rN(e,n){var r=e.document.documentElement,i=Ln(e).on("dragstart.drag",null);n&&(i.on("click.drag",ro,pa),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in r?i.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const Wl=e=>()=>e;function fv(e,{sourceEvent:n,subject:r,target:i,identifier:o,active:l,x:u,y:c,dx:h,dy:p,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:d}})}fv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function XA(e){return!e.ctrlKey&&!e.button}function QA(){return this.parentNode}function ZA(e,n){return n??{x:e.x,y:e.y}}function JA(){return navigator.maxTouchPoints||"ontouchstart"in this}function e2(){var e=XA,n=QA,r=ZA,i=JA,o={},l=Tu("start","drag","end"),u=0,c,h,p,d,m=0;function y(T){T.on("mousedown.drag",w).filter(i).on("touchstart.drag",b).on("touchmove.drag",S,KA).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(T,I){if(!(d||!e.call(this,T,I))){var O=E(this,n.call(this,T,I),T,I,"mouse");O&&(Ln(T.view).on("mousemove.drag",N,pa).on("mouseup.drag",_,pa),nN(T.view),Md(T),p=!1,c=T.clientX,h=T.clientY,O("start",T))}}function N(T){if(ro(T),!p){var I=T.clientX-c,O=T.clientY-h;p=I*I+O*O>m}o.mouse("drag",T)}function _(T){Ln(T.view).on("mousemove.drag mouseup.drag",null),rN(T.view,p),ro(T),o.mouse("end",T)}function b(T,I){if(e.call(this,T,I)){var O=T.changedTouches,A=n.call(this,T,I),U=O.length,z,P;for(z=0;z<U;++z)(P=E(this,A,T,I,O[z].identifier,O[z]))&&(Md(T),P("start",T,O[z]))}}function S(T){var I=T.changedTouches,O=I.length,A,U;for(A=0;A<O;++A)(U=o[I[A].identifier])&&(ro(T),U("drag",T,I[A]))}function k(T){var I=T.changedTouches,O=I.length,A,U;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),A=0;A<O;++A)(U=o[I[A].identifier])&&(Md(T),U("end",T,I[A]))}function E(T,I,O,A,U,z){var P=l.copy(),D=Jn(z||O,I),V,B,C;if((C=r.call(T,new fv("beforestart",{sourceEvent:O,target:y,identifier:U,active:u,x:D[0],y:D[1],dx:0,dy:0,dispatch:P}),A))!=null)return V=C.x-D[0]||0,B=C.y-D[1]||0,function q(L,re,J){var H=D,Z;switch(L){case"start":o[U]=q,Z=u++;break;case"end":delete o[U],--u;case"drag":D=Jn(J||re,I),Z=u;break}P.call(L,T,new fv(L,{sourceEvent:re,subject:C,target:y,identifier:U,active:Z,x:D[0]+V,y:D[1]+B,dx:D[0]-H[0],dy:D[1]-H[1],dispatch:P}),A)}}return y.filter=function(T){return arguments.length?(e=typeof T=="function"?T:Wl(!!T),y):e},y.container=function(T){return arguments.length?(n=typeof T=="function"?T:Wl(T),y):n},y.subject=function(T){return arguments.length?(r=typeof T=="function"?T:Wl(T),y):r},y.touchable=function(T){return arguments.length?(i=typeof T=="function"?T:Wl(!!T),y):i},y.on=function(){var T=l.on.apply(l,arguments);return T===l?y:T},y.clickDistance=function(T){return arguments.length?(m=(T=+T)*T,y):Math.sqrt(m)},y}function Fv(e,n,r){e.prototype=n.prototype=r,r.constructor=e}function sN(e,n){var r=Object.create(e.prototype);for(var i in n)r[i]=n[i];return r}function Na(){}var ma=.7,mu=1/ma,so="\\s*([+-]?\\d+)\\s*",ga="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",hr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",t2=/^#([0-9a-f]{3,8})$/,n2=new RegExp(`^rgb\\(${so},${so},${so}\\)$`),r2=new RegExp(`^rgb\\(${hr},${hr},${hr}\\)$`),s2=new RegExp(`^rgba\\(${so},${so},${so},${ga}\\)$`),i2=new RegExp(`^rgba\\(${hr},${hr},${hr},${ga}\\)$`),o2=new RegExp(`^hsl\\(${ga},${hr},${hr}\\)$`),a2=new RegExp(`^hsla\\(${ga},${hr},${hr},${ga}\\)$`),Xw={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};Fv(Na,va,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Qw,formatHex:Qw,formatHex8:l2,formatHsl:u2,formatRgb:Zw,toString:Zw});function Qw(){return this.rgb().formatHex()}function l2(){return this.rgb().formatHex8()}function u2(){return iN(this).formatHsl()}function Zw(){return this.rgb().formatRgb()}function va(e){var n,r;return e=(e+"").trim().toLowerCase(),(n=t2.exec(e))?(r=n[1].length,n=parseInt(n[1],16),r===6?Jw(n):r===3?new cn(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?Vl(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?Vl(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=n2.exec(e))?new cn(n[1],n[2],n[3],1):(n=r2.exec(e))?new cn(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=s2.exec(e))?Vl(n[1],n[2],n[3],n[4]):(n=i2.exec(e))?Vl(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=o2.exec(e))?nx(n[1],n[2]/100,n[3]/100,1):(n=a2.exec(e))?nx(n[1],n[2]/100,n[3]/100,n[4]):Xw.hasOwnProperty(e)?Jw(Xw[e]):e==="transparent"?new cn(NaN,NaN,NaN,0):null}function Jw(e){return new cn(e>>16&255,e>>8&255,e&255,1)}function Vl(e,n,r,i){return i<=0&&(e=n=r=NaN),new cn(e,n,r,i)}function c2(e){return e instanceof Na||(e=va(e)),e?(e=e.rgb(),new cn(e.r,e.g,e.b,e.opacity)):new cn}function hv(e,n,r,i){return arguments.length===1?c2(e):new cn(e,n,r,i??1)}function cn(e,n,r,i){this.r=+e,this.g=+n,this.b=+r,this.opacity=+i}Fv(cn,hv,sN(Na,{brighter(e){return e=e==null?mu:Math.pow(mu,e),new cn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ma:Math.pow(ma,e),new cn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new cn(li(this.r),li(this.g),li(this.b),gu(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:ex,formatHex:ex,formatHex8:d2,formatRgb:tx,toString:tx}));function ex(){return`#${oi(this.r)}${oi(this.g)}${oi(this.b)}`}function d2(){return`#${oi(this.r)}${oi(this.g)}${oi(this.b)}${oi((isNaN(this.opacity)?1:this.opacity)*255)}`}function tx(){const e=gu(this.opacity);return`${e===1?"rgb(":"rgba("}${li(this.r)}, ${li(this.g)}, ${li(this.b)}${e===1?")":`, ${e})`}`}function gu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function li(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function oi(e){return e=li(e),(e<16?"0":"")+e.toString(16)}function nx(e,n,r,i){return i<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new er(e,n,r,i)}function iN(e){if(e instanceof er)return new er(e.h,e.s,e.l,e.opacity);if(e instanceof Na||(e=va(e)),!e)return new er;if(e instanceof er)return e;e=e.rgb();var n=e.r/255,r=e.g/255,i=e.b/255,o=Math.min(n,r,i),l=Math.max(n,r,i),u=NaN,c=l-o,h=(l+o)/2;return c?(n===l?u=(r-i)/c+(r<i)*6:r===l?u=(i-n)/c+2:u=(n-r)/c+4,c/=h<.5?l+o:2-l-o,u*=60):c=h>0&&h<1?0:u,new er(u,c,h,e.opacity)}function f2(e,n,r,i){return arguments.length===1?iN(e):new er(e,n,r,i??1)}function er(e,n,r,i){this.h=+e,this.s=+n,this.l=+r,this.opacity=+i}Fv(er,f2,sN(Na,{brighter(e){return e=e==null?mu:Math.pow(mu,e),new er(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ma:Math.pow(ma,e),new er(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*n,o=2*r-i;return new cn(Od(e>=240?e-240:e+120,o,i),Od(e,o,i),Od(e<120?e+240:e-120,o,i),this.opacity)},clamp(){return new er(rx(this.h),Gl(this.s),Gl(this.l),gu(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=gu(this.opacity);return`${e===1?"hsl(":"hsla("}${rx(this.h)}, ${Gl(this.s)*100}%, ${Gl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function rx(e){return e=(e||0)%360,e<0?e+360:e}function Gl(e){return Math.max(0,Math.min(1,e||0))}function Od(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const oN=e=>()=>e;function h2(e,n){return function(r){return e+r*n}}function p2(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(i){return Math.pow(e+i*n,r)}}function m2(e){return(e=+e)==1?aN:function(n,r){return r-n?p2(n,r,e):oN(isNaN(n)?r:n)}}function aN(e,n){var r=n-e;return r?h2(e,r):oN(isNaN(e)?n:e)}const sx=(function e(n){var r=m2(n);function i(o,l){var u=r((o=hv(o)).r,(l=hv(l)).r),c=r(o.g,l.g),h=r(o.b,l.b),p=aN(o.opacity,l.opacity);return function(d){return o.r=u(d),o.g=c(d),o.b=h(d),o.opacity=p(d),o+""}}return i.gamma=e,i})(1);function _s(e,n){return e=+e,n=+n,function(r){return e*(1-r)+n*r}}var pv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Pd=new RegExp(pv.source,"g");function g2(e){return function(){return e}}function v2(e){return function(n){return e(n)+""}}function y2(e,n){var r=pv.lastIndex=Pd.lastIndex=0,i,o,l,u=-1,c=[],h=[];for(e=e+"",n=n+"";(i=pv.exec(e))&&(o=Pd.exec(n));)(l=o.index)>r&&(l=n.slice(r,l),c[u]?c[u]+=l:c[++u]=l),(i=i[0])===(o=o[0])?c[u]?c[u]+=o:c[++u]=o:(c[++u]=null,h.push({i:u,x:_s(i,o)})),r=Pd.lastIndex;return r<n.length&&(l=n.slice(r),c[u]?c[u]+=l:c[++u]=l),c.length<2?h[0]?v2(h[0].x):g2(n):(n=h.length,function(p){for(var d=0,m;d<n;++d)c[(m=h[d]).i]=m.x(p);return c.join("")})}var ix=180/Math.PI,mv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function lN(e,n,r,i,o,l){var u,c,h;return(u=Math.sqrt(e*e+n*n))&&(e/=u,n/=u),(h=e*r+n*i)&&(r-=e*h,i-=n*h),(c=Math.sqrt(r*r+i*i))&&(r/=c,i/=c,h/=c),e*i<n*r&&(e=-e,n=-n,h=-h,u=-u),{translateX:o,translateY:l,rotate:Math.atan2(n,e)*ix,skewX:Math.atan(h)*ix,scaleX:u,scaleY:c}}var Yl;function w2(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?mv:lN(n.a,n.b,n.c,n.d,n.e,n.f)}function x2(e){return e==null||(Yl||(Yl=document.createElementNS("http://www.w3.org/2000/svg","g")),Yl.setAttribute("transform",e),!(e=Yl.transform.baseVal.consolidate()))?mv:(e=e.matrix,lN(e.a,e.b,e.c,e.d,e.e,e.f))}function uN(e,n,r,i){function o(p){return p.length?p.pop()+" ":""}function l(p,d,m,y,w,N){if(p!==m||d!==y){var _=w.push("translate(",null,n,null,r);N.push({i:_-4,x:_s(p,m)},{i:_-2,x:_s(d,y)})}else(m||y)&&w.push("translate("+m+n+y+r)}function u(p,d,m,y){p!==d?(p-d>180?d+=360:d-p>180&&(p+=360),y.push({i:m.push(o(m)+"rotate(",null,i)-2,x:_s(p,d)})):d&&m.push(o(m)+"rotate("+d+i)}function c(p,d,m,y){p!==d?y.push({i:m.push(o(m)+"skewX(",null,i)-2,x:_s(p,d)}):d&&m.push(o(m)+"skewX("+d+i)}function h(p,d,m,y,w,N){if(p!==m||d!==y){var _=w.push(o(w)+"scale(",null,",",null,")");N.push({i:_-4,x:_s(p,m)},{i:_-2,x:_s(d,y)})}else(m!==1||y!==1)&&w.push(o(w)+"scale("+m+","+y+")")}return function(p,d){var m=[],y=[];return p=e(p),d=e(d),l(p.translateX,p.translateY,d.translateX,d.translateY,m,y),u(p.rotate,d.rotate,m,y),c(p.skewX,d.skewX,m,y),h(p.scaleX,p.scaleY,d.scaleX,d.scaleY,m,y),p=d=null,function(w){for(var N=-1,_=y.length,b;++N<_;)m[(b=y[N]).i]=b.x(w);return m.join("")}}}var _2=uN(w2,"px, ","px)","deg)"),b2=uN(x2,", ",")",")"),S2=1e-12;function ox(e){return((e=Math.exp(e))+1/e)/2}function k2(e){return((e=Math.exp(e))-1/e)/2}function E2(e){return((e=Math.exp(2*e))-1)/(e+1)}const N2=(function e(n,r,i){function o(l,u){var c=l[0],h=l[1],p=l[2],d=u[0],m=u[1],y=u[2],w=d-c,N=m-h,_=w*w+N*N,b,S;if(_<S2)S=Math.log(y/p)/n,b=function(A){return[c+A*w,h+A*N,p*Math.exp(n*A*S)]};else{var k=Math.sqrt(_),E=(y*y-p*p+i*_)/(2*p*r*k),T=(y*y-p*p-i*_)/(2*y*r*k),I=Math.log(Math.sqrt(E*E+1)-E),O=Math.log(Math.sqrt(T*T+1)-T);S=(O-I)/n,b=function(A){var U=A*S,z=ox(I),P=p/(r*k)*(z*E2(n*U+I)-k2(I));return[c+P*w,h+P*N,p*z/ox(n*U+I)]}}return b.duration=S*1e3*n/Math.SQRT2,b}return o.rho=function(l){var u=Math.max(.001,+l),c=u*u,h=c*c;return e(u,c,h)},o})(Math.SQRT2,2,4);var lo=0,la=0,na=0,cN=1e3,vu,ua,yu=0,ci=0,ju=0,ya=typeof performance=="object"&&performance.now?performance:Date,dN=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function zv(){return ci||(dN(C2),ci=ya.now()+ju)}function C2(){ci=0}function wu(){this._call=this._time=this._next=null}wu.prototype=fN.prototype={constructor:wu,restart:function(e,n,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?zv():+r)+(n==null?0:+n),!this._next&&ua!==this&&(ua?ua._next=this:vu=this,ua=this),this._call=e,this._time=r,gv()},stop:function(){this._call&&(this._call=null,this._time=1/0,gv())}};function fN(e,n,r){var i=new wu;return i.restart(e,n,r),i}function T2(){zv(),++lo;for(var e=vu,n;e;)(n=ci-e._time)>=0&&e._call.call(void 0,n),e=e._next;--lo}function ax(){ci=(yu=ya.now())+ju,lo=la=0;try{T2()}finally{lo=0,j2(),ci=0}}function R2(){var e=ya.now(),n=e-yu;n>cN&&(ju-=n,yu=e)}function j2(){for(var e,n=vu,r,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:vu=r);ua=e,gv(i)}function gv(e){if(!lo){la&&(la=clearTimeout(la));var n=e-ci;n>24?(e<1/0&&(la=setTimeout(ax,e-ya.now()-ju)),na&&(na=clearInterval(na))):(na||(yu=ya.now(),na=setInterval(R2,cN)),lo=1,dN(ax))}}function lx(e,n,r){var i=new wu;return n=n==null?0:+n,i.restart(o=>{i.stop(),e(o+n)},n,r),i}var A2=Tu("start","end","cancel","interrupt"),I2=[],hN=0,ux=1,vv=2,uu=3,cx=4,yv=5,cu=6;function Au(e,n,r,i,o,l){var u=e.__transition;if(!u)e.__transition={};else if(r in u)return;M2(e,r,{name:n,index:i,group:o,on:A2,tween:I2,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:hN})}function Bv(e,n){var r=rr(e,n);if(r.state>hN)throw new Error("too late; already scheduled");return r}function pr(e,n){var r=rr(e,n);if(r.state>uu)throw new Error("too late; already running");return r}function rr(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function M2(e,n,r){var i=e.__transition,o;i[n]=r,r.timer=fN(l,0,r.time);function l(p){r.state=ux,r.timer.restart(u,r.delay,r.time),r.delay<=p&&u(p-r.delay)}function u(p){var d,m,y,w;if(r.state!==ux)return h();for(d in i)if(w=i[d],w.name===r.name){if(w.state===uu)return lx(u);w.state===cx?(w.state=cu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete i[d]):+d<n&&(w.state=cu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete i[d])}if(lx(function(){r.state===uu&&(r.state=cx,r.timer.restart(c,r.delay,r.time),c(p))}),r.state=vv,r.on.call("start",e,e.__data__,r.index,r.group),r.state===vv){for(r.state=uu,o=new Array(y=r.tween.length),d=0,m=-1;d<y;++d)(w=r.tween[d].value.call(e,e.__data__,r.index,r.group))&&(o[++m]=w);o.length=m+1}}function c(p){for(var d=p<r.duration?r.ease.call(null,p/r.duration):(r.timer.restart(h),r.state=yv,1),m=-1,y=o.length;++m<y;)o[m].call(e,d);r.state===yv&&(r.on.call("end",e,e.__data__,r.index,r.group),h())}function h(){r.state=cu,r.timer.stop(),delete i[n];for(var p in i)return;delete e.__transition}}function du(e,n){var r=e.__transition,i,o,l=!0,u;if(r){n=n==null?null:n+"";for(u in r){if((i=r[u]).name!==n){l=!1;continue}o=i.state>vv&&i.state<yv,i.state=cu,i.timer.stop(),i.on.call(o?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[u]}l&&delete e.__transition}}function O2(e){return this.each(function(){du(this,e)})}function P2(e,n){var r,i;return function(){var o=pr(this,e),l=o.tween;if(l!==r){i=r=l;for(var u=0,c=i.length;u<c;++u)if(i[u].name===n){i=i.slice(),i.splice(u,1);break}}o.tween=i}}function L2(e,n,r){var i,o;if(typeof r!="function")throw new Error;return function(){var l=pr(this,e),u=l.tween;if(u!==i){o=(i=u).slice();for(var c={name:n,value:r},h=0,p=o.length;h<p;++h)if(o[h].name===n){o[h]=c;break}h===p&&o.push(c)}l.tween=o}}function $2(e,n){var r=this._id;if(e+="",arguments.length<2){for(var i=rr(this.node(),r).tween,o=0,l=i.length,u;o<l;++o)if((u=i[o]).name===e)return u.value;return null}return this.each((n==null?P2:L2)(r,e,n))}function Uv(e,n,r){var i=e._id;return e.each(function(){var o=pr(this,i);(o.value||(o.value={}))[n]=r.apply(this,arguments)}),function(o){return rr(o,i).value[n]}}function pN(e,n){var r;return(typeof n=="number"?_s:n instanceof va?sx:(r=va(n))?(n=r,sx):y2)(e,n)}function q2(e){return function(){this.removeAttribute(e)}}function D2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function F2(e,n,r){var i,o=r+"",l;return function(){var u=this.getAttribute(e);return u===o?null:u===i?l:l=n(i=u,r)}}function z2(e,n,r){var i,o=r+"",l;return function(){var u=this.getAttributeNS(e.space,e.local);return u===o?null:u===i?l:l=n(i=u,r)}}function B2(e,n,r){var i,o,l;return function(){var u,c=r(this),h;return c==null?void this.removeAttribute(e):(u=this.getAttribute(e),h=c+"",u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c)))}}function U2(e,n,r){var i,o,l;return function(){var u,c=r(this),h;return c==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),h=c+"",u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c)))}}function H2(e,n){var r=Ru(e),i=r==="transform"?b2:pN;return this.attrTween(e,typeof n=="function"?(r.local?U2:B2)(r,i,Uv(this,"attr."+e,n)):n==null?(r.local?D2:q2)(r):(r.local?z2:F2)(r,i,n))}function W2(e,n){return function(r){this.setAttribute(e,n.call(this,r))}}function V2(e,n){return function(r){this.setAttributeNS(e.space,e.local,n.call(this,r))}}function G2(e,n){var r,i;function o(){var l=n.apply(this,arguments);return l!==i&&(r=(i=l)&&V2(e,l)),r}return o._value=n,o}function Y2(e,n){var r,i;function o(){var l=n.apply(this,arguments);return l!==i&&(r=(i=l)&&W2(e,l)),r}return o._value=n,o}function K2(e,n){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;var i=Ru(e);return this.tween(r,(i.local?G2:Y2)(i,n))}function X2(e,n){return function(){Bv(this,e).delay=+n.apply(this,arguments)}}function Q2(e,n){return n=+n,function(){Bv(this,e).delay=n}}function Z2(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?X2:Q2)(n,e)):rr(this.node(),n).delay}function J2(e,n){return function(){pr(this,e).duration=+n.apply(this,arguments)}}function eI(e,n){return n=+n,function(){pr(this,e).duration=n}}function tI(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?J2:eI)(n,e)):rr(this.node(),n).duration}function nI(e,n){if(typeof n!="function")throw new Error;return function(){pr(this,e).ease=n}}function rI(e){var n=this._id;return arguments.length?this.each(nI(n,e)):rr(this.node(),n).ease}function sI(e,n){return function(){var r=n.apply(this,arguments);if(typeof r!="function")throw new Error;pr(this,e).ease=r}}function iI(e){if(typeof e!="function")throw new Error;return this.each(sI(this._id,e))}function oI(e){typeof e!="function"&&(e=VE(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=[],h,p=0;p<u;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&c.push(h);return new zr(i,this._parents,this._name,this._id)}function aI(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,r=e._groups,i=n.length,o=r.length,l=Math.min(i,o),u=new Array(i),c=0;c<l;++c)for(var h=n[c],p=r[c],d=h.length,m=u[c]=new Array(d),y,w=0;w<d;++w)(y=h[w]||p[w])&&(m[w]=y);for(;c<i;++c)u[c]=n[c];return new zr(u,this._parents,this._name,this._id)}function lI(e){return(e+"").trim().split(/^|\s+/).every(function(n){var r=n.indexOf(".");return r>=0&&(n=n.slice(0,r)),!n||n==="start"})}function uI(e,n,r){var i,o,l=lI(n)?Bv:pr;return function(){var u=l(this,e),c=u.on;c!==i&&(o=(i=c).copy()).on(n,r),u.on=o}}function cI(e,n){var r=this._id;return arguments.length<2?rr(this.node(),r).on.on(e):this.each(uI(r,e,n))}function dI(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function fI(){return this.on("end.remove",dI(this._id))}function hI(e){var n=this._name,r=this._id;typeof e!="function"&&(e=qv(e));for(var i=this._groups,o=i.length,l=new Array(o),u=0;u<o;++u)for(var c=i[u],h=c.length,p=l[u]=new Array(h),d,m,y=0;y<h;++y)(d=c[y])&&(m=e.call(d,d.__data__,y,c))&&("__data__"in d&&(m.__data__=d.__data__),p[y]=m,Au(p[y],n,r,y,p,rr(d,r)));return new zr(l,this._parents,n,r)}function pI(e){var n=this._name,r=this._id;typeof e!="function"&&(e=WE(e));for(var i=this._groups,o=i.length,l=[],u=[],c=0;c<o;++c)for(var h=i[c],p=h.length,d,m=0;m<p;++m)if(d=h[m]){for(var y=e.call(d,d.__data__,m,h),w,N=rr(d,r),_=0,b=y.length;_<b;++_)(w=y[_])&&Au(w,n,r,_,y,N);l.push(y),u.push(d)}return new zr(l,u,n,r)}var mI=Ea.prototype.constructor;function gI(){return new mI(this._groups,this._parents)}function vI(e,n){var r,i,o;return function(){var l=ao(this,e),u=(this.style.removeProperty(e),ao(this,e));return l===u?null:l===r&&u===i?o:o=n(r=l,i=u)}}function mN(e){return function(){this.style.removeProperty(e)}}function yI(e,n,r){var i,o=r+"",l;return function(){var u=ao(this,e);return u===o?null:u===i?l:l=n(i=u,r)}}function wI(e,n,r){var i,o,l;return function(){var u=ao(this,e),c=r(this),h=c+"";return c==null&&(h=c=(this.style.removeProperty(e),ao(this,e))),u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c))}}function xI(e,n){var r,i,o,l="style."+n,u="end."+l,c;return function(){var h=pr(this,e),p=h.on,d=h.value[l]==null?c||(c=mN(n)):void 0;(p!==r||o!==d)&&(i=(r=p).copy()).on(u,o=d),h.on=i}}function _I(e,n,r){var i=(e+="")=="transform"?_2:pN;return n==null?this.styleTween(e,vI(e,i)).on("end.style."+e,mN(e)):typeof n=="function"?this.styleTween(e,wI(e,i,Uv(this,"style."+e,n))).each(xI(this._id,e)):this.styleTween(e,yI(e,i,n),r).on("end.style."+e,null)}function bI(e,n,r){return function(i){this.style.setProperty(e,n.call(this,i),r)}}function SI(e,n,r){var i,o;function l(){var u=n.apply(this,arguments);return u!==o&&(i=(o=u)&&bI(e,u,r)),i}return l._value=n,l}function kI(e,n,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,SI(e,n,r??""))}function EI(e){return function(){this.textContent=e}}function NI(e){return function(){var n=e(this);this.textContent=n??""}}function CI(e){return this.tween("text",typeof e=="function"?NI(Uv(this,"text",e)):EI(e==null?"":e+""))}function TI(e){return function(n){this.textContent=e.call(this,n)}}function RI(e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&TI(o)),n}return i._value=e,i}function jI(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,RI(e))}function AI(){for(var e=this._name,n=this._id,r=gN(),i=this._groups,o=i.length,l=0;l<o;++l)for(var u=i[l],c=u.length,h,p=0;p<c;++p)if(h=u[p]){var d=rr(h,n);Au(h,e,r,p,u,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new zr(i,this._parents,e,r)}function II(){var e,n,r=this,i=r._id,o=r.size();return new Promise(function(l,u){var c={value:u},h={value:function(){--o===0&&l()}};r.each(function(){var p=pr(this,i),d=p.on;d!==e&&(n=(e=d).copy(),n._.cancel.push(c),n._.interrupt.push(c),n._.end.push(h)),p.on=n}),o===0&&l()})}var MI=0;function zr(e,n,r,i){this._groups=e,this._parents=n,this._name=r,this._id=i}function gN(){return++MI}var qr=Ea.prototype;zr.prototype={constructor:zr,select:hI,selectAll:pI,selectChild:qr.selectChild,selectChildren:qr.selectChildren,filter:oI,merge:aI,selection:gI,transition:AI,call:qr.call,nodes:qr.nodes,node:qr.node,size:qr.size,empty:qr.empty,each:qr.each,on:cI,attr:H2,attrTween:K2,style:_I,styleTween:kI,text:CI,textTween:jI,remove:fI,tween:$2,delay:Z2,duration:tI,ease:rI,easeVarying:iI,end:II,[Symbol.iterator]:qr[Symbol.iterator]};function OI(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var PI={time:null,delay:0,duration:250,ease:OI};function LI(e,n){for(var r;!(r=e.__transition)||!(r=r[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return r}function $I(e){var n,r;e instanceof zr?(n=e._id,e=e._name):(n=gN(),(r=PI).time=zv(),e=e==null?null:e+"");for(var i=this._groups,o=i.length,l=0;l<o;++l)for(var u=i[l],c=u.length,h,p=0;p<c;++p)(h=u[p])&&Au(h,e,n,p,u,r||LI(h,n));return new zr(i,this._parents,e,n)}Ea.prototype.interrupt=O2;Ea.prototype.transition=$I;const Kl=e=>()=>e;function qI(e,{sourceEvent:n,target:r,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Dr(e,n,r){this.k=e,this.x=n,this.y=r}Dr.prototype={constructor:Dr,scale:function(e){return e===1?this:new Dr(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Dr(this.k,this.x+this.k*e,this.y+this.k*n)},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 Fr=new Dr(1,0,0);Dr.prototype;function Ld(e){e.stopImmediatePropagation()}function ra(e){e.preventDefault(),e.stopImmediatePropagation()}function DI(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function FI(){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 dx(){return this.__zoom||Fr}function zI(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function BI(){return navigator.maxTouchPoints||"ontouchstart"in this}function UI(e,n,r){var i=e.invertX(n[0][0])-r[0][0],o=e.invertX(n[1][0])-r[1][0],l=e.invertY(n[0][1])-r[0][1],u=e.invertY(n[1][1])-r[1][1];return e.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function vN(){var e=DI,n=FI,r=UI,i=zI,o=BI,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],c=250,h=N2,p=Tu("start","zoom","end"),d,m,y,w=500,N=150,_=0,b=10;function S(C){C.property("__zoom",dx).on("wheel.zoom",U,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",P).filter(o).on("touchstart.zoom",D).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(C,q,L,re){var J=C.selection?C.selection():C;J.property("__zoom",dx),C!==J?I(C,q,L,re):J.interrupt().each(function(){O(this,arguments).event(re).start().zoom(null,typeof q=="function"?q.apply(this,arguments):q).end()})},S.scaleBy=function(C,q,L,re){S.scaleTo(C,function(){var J=this.__zoom.k,H=typeof q=="function"?q.apply(this,arguments):q;return J*H},L,re)},S.scaleTo=function(C,q,L,re){S.transform(C,function(){var J=n.apply(this,arguments),H=this.__zoom,Z=L==null?T(J):typeof L=="function"?L.apply(this,arguments):L,M=H.invert(Z),G=typeof q=="function"?q.apply(this,arguments):q;return r(E(k(H,G),Z,M),J,u)},L,re)},S.translateBy=function(C,q,L,re){S.transform(C,function(){return r(this.__zoom.translate(typeof q=="function"?q.apply(this,arguments):q,typeof L=="function"?L.apply(this,arguments):L),n.apply(this,arguments),u)},null,re)},S.translateTo=function(C,q,L,re,J){S.transform(C,function(){var H=n.apply(this,arguments),Z=this.__zoom,M=re==null?T(H):typeof re=="function"?re.apply(this,arguments):re;return r(Fr.translate(M[0],M[1]).scale(Z.k).translate(typeof q=="function"?-q.apply(this,arguments):-q,typeof L=="function"?-L.apply(this,arguments):-L),H,u)},re,J)};function k(C,q){return q=Math.max(l[0],Math.min(l[1],q)),q===C.k?C:new Dr(q,C.x,C.y)}function E(C,q,L){var re=q[0]-L[0]*C.k,J=q[1]-L[1]*C.k;return re===C.x&&J===C.y?C:new Dr(C.k,re,J)}function T(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function I(C,q,L,re){C.on("start.zoom",function(){O(this,arguments).event(re).start()}).on("interrupt.zoom end.zoom",function(){O(this,arguments).event(re).end()}).tween("zoom",function(){var J=this,H=arguments,Z=O(J,H).event(re),M=n.apply(J,H),G=L==null?T(M):typeof L=="function"?L.apply(J,H):L,Y=Math.max(M[1][0]-M[0][0],M[1][1]-M[0][1]),$=J.__zoom,Q=typeof q=="function"?q.apply(J,H):q,ne=h($.invert(G).concat(Y/$.k),Q.invert(G).concat(Y/Q.k));return function(oe){if(oe===1)oe=Q;else{var fe=ne(oe),te=Y/fe[2];oe=new Dr(te,G[0]-fe[0]*te,G[1]-fe[1]*te)}Z.zoom(null,oe)}})}function O(C,q,L){return!L&&C.__zooming||new A(C,q)}function A(C,q){this.that=C,this.args=q,this.active=0,this.sourceEvent=null,this.extent=n.apply(C,q),this.taps=0}A.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,q){return this.mouse&&C!=="mouse"&&(this.mouse[1]=q.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=q.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=q.invert(this.touch1[0])),this.that.__zoom=q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var q=Ln(this.that).datum();p.call(C,this.that,new qI(C,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:p}),q)}};function U(C,...q){if(!e.apply(this,arguments))return;var L=O(this,q).event(C),re=this.__zoom,J=Math.max(l[0],Math.min(l[1],re.k*Math.pow(2,i.apply(this,arguments)))),H=Jn(C);if(L.wheel)(L.mouse[0][0]!==H[0]||L.mouse[0][1]!==H[1])&&(L.mouse[1]=re.invert(L.mouse[0]=H)),clearTimeout(L.wheel);else{if(re.k===J)return;L.mouse=[H,re.invert(H)],du(this),L.start()}ra(C),L.wheel=setTimeout(Z,N),L.zoom("mouse",r(E(k(re,J),L.mouse[0],L.mouse[1]),L.extent,u));function Z(){L.wheel=null,L.end()}}function z(C,...q){if(y||!e.apply(this,arguments))return;var L=C.currentTarget,re=O(this,q,!0).event(C),J=Ln(C.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",Y,!0),H=Jn(C,L),Z=C.clientX,M=C.clientY;nN(C.view),Ld(C),re.mouse=[H,this.__zoom.invert(H)],du(this),re.start();function G($){if(ra($),!re.moved){var Q=$.clientX-Z,ne=$.clientY-M;re.moved=Q*Q+ne*ne>_}re.event($).zoom("mouse",r(E(re.that.__zoom,re.mouse[0]=Jn($,L),re.mouse[1]),re.extent,u))}function Y($){J.on("mousemove.zoom mouseup.zoom",null),rN($.view,re.moved),ra($),re.event($).end()}}function P(C,...q){if(e.apply(this,arguments)){var L=this.__zoom,re=Jn(C.changedTouches?C.changedTouches[0]:C,this),J=L.invert(re),H=L.k*(C.shiftKey?.5:2),Z=r(E(k(L,H),re,J),n.apply(this,q),u);ra(C),c>0?Ln(this).transition().duration(c).call(I,Z,re,C):Ln(this).call(S.transform,Z,re,C)}}function D(C,...q){if(e.apply(this,arguments)){var L=C.touches,re=L.length,J=O(this,q,C.changedTouches.length===re).event(C),H,Z,M,G;for(Ld(C),Z=0;Z<re;++Z)M=L[Z],G=Jn(M,this),G=[G,this.__zoom.invert(G),M.identifier],J.touch0?!J.touch1&&J.touch0[2]!==G[2]&&(J.touch1=G,J.taps=0):(J.touch0=G,H=!0,J.taps=1+!!d);d&&(d=clearTimeout(d)),H&&(J.taps<2&&(m=G[0],d=setTimeout(function(){d=null},w)),du(this),J.start())}}function V(C,...q){if(this.__zooming){var L=O(this,q).event(C),re=C.changedTouches,J=re.length,H,Z,M,G;for(ra(C),H=0;H<J;++H)Z=re[H],M=Jn(Z,this),L.touch0&&L.touch0[2]===Z.identifier?L.touch0[0]=M:L.touch1&&L.touch1[2]===Z.identifier&&(L.touch1[0]=M);if(Z=L.that.__zoom,L.touch1){var Y=L.touch0[0],$=L.touch0[1],Q=L.touch1[0],ne=L.touch1[1],oe=(oe=Q[0]-Y[0])*oe+(oe=Q[1]-Y[1])*oe,fe=(fe=ne[0]-$[0])*fe+(fe=ne[1]-$[1])*fe;Z=k(Z,Math.sqrt(oe/fe)),M=[(Y[0]+Q[0])/2,(Y[1]+Q[1])/2],G=[($[0]+ne[0])/2,($[1]+ne[1])/2]}else if(L.touch0)M=L.touch0[0],G=L.touch0[1];else return;L.zoom("touch",r(E(Z,M,G),L.extent,u))}}function B(C,...q){if(this.__zooming){var L=O(this,q).event(C),re=C.changedTouches,J=re.length,H,Z;for(Ld(C),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),H=0;H<J;++H)Z=re[H],L.touch0&&L.touch0[2]===Z.identifier?delete L.touch0:L.touch1&&L.touch1[2]===Z.identifier&&delete L.touch1;if(L.touch1&&!L.touch0&&(L.touch0=L.touch1,delete L.touch1),L.touch0)L.touch0[1]=this.__zoom.invert(L.touch0[0]);else if(L.end(),L.taps===2&&(Z=Jn(Z,this),Math.hypot(m[0]-Z[0],m[1]-Z[1])<b)){var M=Ln(this).on("dblclick.zoom");M&&M.apply(this,arguments)}}}return S.wheelDelta=function(C){return arguments.length?(i=typeof C=="function"?C:Kl(+C),S):i},S.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Kl(!!C),S):e},S.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:Kl(!!C),S):o},S.extent=function(C){return arguments.length?(n=typeof C=="function"?C:Kl([[+C[0][0],+C[0][1]],[+C[1][0],+C[1][1]]]),S):n},S.scaleExtent=function(C){return arguments.length?(l[0]=+C[0],l[1]=+C[1],S):[l[0],l[1]]},S.translateExtent=function(C){return arguments.length?(u[0][0]=+C[0][0],u[1][0]=+C[1][0],u[0][1]=+C[0][1],u[1][1]=+C[1][1],S):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},S.constrain=function(C){return arguments.length?(r=C,S):r},S.duration=function(C){return arguments.length?(c=+C,S):c},S.interpolate=function(C){return arguments.length?(h=C,S):h},S.on=function(){var C=p.on.apply(p,arguments);return C===p?S:C},S.clickDistance=function(C){return arguments.length?(_=(C=+C)*C,S):Math.sqrt(_)},S.tapDistance=function(C){return arguments.length?(b=+C,S):b},S}var HI=BE();const Iu=j.createContext(null),WI=Iu.Provider,Br={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,n)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?n.targetHandle:n.sourceHandle}", edge id: ${n.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.`},yN=Br.error001();function Ke(e,n){const r=j.useContext(Iu);if(r===null)throw new Error(yN);return UE(r,e,n)}const Tt=()=>{const e=j.useContext(Iu);if(e===null)throw new Error(yN);return j.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},VI=e=>e.userSelectionActive?"none":"all";function Hv({position:e,children:n,className:r,style:i,...o}){const l=Ke(VI),u=`${e}`.split("-");return ue.createElement("div",{className:Dt(["react-flow__panel",r,...u]),style:{...i,pointerEvents:l},...o},n)}function GI({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:ue.createElement(Hv,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},ue.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const YI=({x:e,y:n,label:r,labelStyle:i={},labelShowBg:o=!0,labelBgStyle:l={},labelBgPadding:u=[2,4],labelBgBorderRadius:c=2,children:h,className:p,...d})=>{const m=j.useRef(null),[y,w]=j.useState({x:0,y:0,width:0,height:0}),N=Dt(["react-flow__edge-textwrapper",p]);return j.useEffect(()=>{if(m.current){const _=m.current.getBBox();w({x:_.x,y:_.y,width:_.width,height:_.height})}},[r]),typeof r>"u"||!r?null:ue.createElement("g",{transform:`translate(${e-y.width/2} ${n-y.height/2})`,className:N,visibility:y.width?"visible":"hidden",...d},o&&ue.createElement("rect",{width:y.width+2*u[0],x:-u[0],y:-u[1],height:y.height+2*u[1],className:"react-flow__edge-textbg",style:l,rx:c,ry:c}),ue.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:i},r),h)};var KI=j.memo(YI);const Wv=e=>({width:e.offsetWidth,height:e.offsetHeight}),uo=(e,n=0,r=1)=>Math.min(Math.max(e,n),r),Vv=(e={x:0,y:0},n)=>({x:uo(e.x,n[0][0],n[1][0]),y:uo(e.y,n[0][1],n[1][1])}),fx=(e,n,r)=>e<n?uo(Math.abs(e-n),1,50)/50:e>r?-uo(Math.abs(e-r),1,50)/50:0,wN=(e,n)=>{const r=fx(e.x,35,n.width-35)*20,i=fx(e.y,35,n.height-35)*20;return[r,i]},xN=e=>{var n;return((n=e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},_N=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),wa=({x:e,y:n,width:r,height:i})=>({x:e,y:n,x2:e+r,y2:n+i}),bN=({x:e,y:n,x2:r,y2:i})=>({x:e,y:n,width:r-e,height:i-n}),hx=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),XI=(e,n)=>bN(_N(wa(e),wa(n))),wv=(e,n)=>{const r=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(r*i)},QI=e=>$n(e.width)&&$n(e.height)&&$n(e.x)&&$n(e.y),$n=e=>!isNaN(e)&&isFinite(e),yt=Symbol.for("internals"),SN=["Enter"," ","Escape"],ZI=(e,n)=>{},JI=e=>"nativeEvent"in e;function xv(e){var o,l;const n=JI(e)?e.nativeEvent:e,r=((l=(o=n.composedPath)==null?void 0:o.call(n))==null?void 0:l[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(r==null?void 0:r.nodeName)||(r==null?void 0:r.hasAttribute("contenteditable"))||!!(r!=null&&r.closest(".nokey"))}const kN=e=>"clientX"in e,ks=(e,n)=>{var l,u;const r=kN(e),i=r?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,o=r?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:i-((n==null?void 0:n.left)??0),y:o-((n==null?void 0:n.top)??0)}},xu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Ca=({id:e,path:n,labelX:r,labelY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w=20})=>ue.createElement(ue.Fragment,null,ue.createElement("path",{id:e,style:d,d:n,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),w&&ue.createElement("path",{d:n,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),o&&$n(r)&&$n(i)?ue.createElement(KI,{x:r,y:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p}):null);Ca.displayName="BaseEdge";function sa(e,n,r){return r===void 0?r:i=>{const o=n().edges.find(l=>l.id===e);o&&r(i,{...o})}}function EN({sourceX:e,sourceY:n,targetX:r,targetY:i}){const o=Math.abs(r-e)/2,l=r<e?r+o:r-o,u=Math.abs(i-n)/2,c=i<n?i+u:i-u;return[l,c,o,u]}function NN({sourceX:e,sourceY:n,targetX:r,targetY:i,sourceControlX:o,sourceControlY:l,targetControlX:u,targetControlY:c}){const h=e*.125+o*.375+u*.375+r*.125,p=n*.125+l*.375+c*.375+i*.125,d=Math.abs(h-e),m=Math.abs(p-n);return[h,p,d,m]}var di;(function(e){e.Strict="strict",e.Loose="loose"})(di||(di={}));var ai;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ai||(ai={}));var xa;(function(e){e.Partial="partial",e.Full="full"})(xa||(xa={}));var Ss;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ss||(Ss={}));var _u;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(_u||(_u={}));var Ae;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ae||(Ae={}));function px({pos:e,x1:n,y1:r,x2:i,y2:o}){return e===Ae.Left||e===Ae.Right?[.5*(n+i),r]:[n,.5*(r+o)]}function CN({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top}){const[u,c]=px({pos:r,x1:e,y1:n,x2:i,y2:o}),[h,p]=px({pos:l,x1:i,y1:o,x2:e,y2:n}),[d,m,y,w]=NN({sourceX:e,sourceY:n,targetX:i,targetY:o,sourceControlX:u,sourceControlY:c,targetControlX:h,targetControlY:p});return[`M${e},${n} C${u},${c} ${h},${p} ${i},${o}`,d,m,y,w]}const Gv=j.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,sourcePosition:o=Ae.Bottom,targetPosition:l=Ae.Top,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})=>{const[b,S,k]=CN({sourceX:e,sourceY:n,sourcePosition:o,targetX:r,targetY:i,targetPosition:l});return ue.createElement(Ca,{path:b,labelX:S,labelY:k,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})});Gv.displayName="SimpleBezierEdge";const mx={[Ae.Left]:{x:-1,y:0},[Ae.Right]:{x:1,y:0},[Ae.Top]:{x:0,y:-1},[Ae.Bottom]:{x:0,y:1}},eM=({source:e,sourcePosition:n=Ae.Bottom,target:r})=>n===Ae.Left||n===Ae.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},gx=(e,n)=>Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function tM({source:e,sourcePosition:n=Ae.Bottom,target:r,targetPosition:i=Ae.Top,center:o,offset:l}){const u=mx[n],c=mx[i],h={x:e.x+u.x*l,y:e.y+u.y*l},p={x:r.x+c.x*l,y:r.y+c.y*l},d=eM({source:h,sourcePosition:n,target:p}),m=d.x!==0?"x":"y",y=d[m];let w=[],N,_;const b={x:0,y:0},S={x:0,y:0},[k,E,T,I]=EN({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(u[m]*c[m]===-1){N=o.x??k,_=o.y??E;const A=[{x:N,y:h.y},{x:N,y:p.y}],U=[{x:h.x,y:_},{x:p.x,y:_}];u[m]===y?w=m==="x"?A:U:w=m==="x"?U:A}else{const A=[{x:h.x,y:p.y}],U=[{x:p.x,y:h.y}];if(m==="x"?w=u.x===y?U:A:w=u.y===y?A:U,n===i){const B=Math.abs(e[m]-r[m]);if(B<=l){const C=Math.min(l-1,l-B);u[m]===y?b[m]=(h[m]>e[m]?-1:1)*C:S[m]=(p[m]>r[m]?-1:1)*C}}if(n!==i){const B=m==="x"?"y":"x",C=u[m]===c[B],q=h[B]>p[B],L=h[B]<p[B];(u[m]===1&&(!C&&q||C&&L)||u[m]!==1&&(!C&&L||C&&q))&&(w=m==="x"?A:U)}const z={x:h.x+b.x,y:h.y+b.y},P={x:p.x+S.x,y:p.y+S.y},D=Math.max(Math.abs(z.x-w[0].x),Math.abs(P.x-w[0].x)),V=Math.max(Math.abs(z.y-w[0].y),Math.abs(P.y-w[0].y));D>=V?(N=(z.x+P.x)/2,_=w[0].y):(N=w[0].x,_=(z.y+P.y)/2)}return[[e,{x:h.x+b.x,y:h.y+b.y},...w,{x:p.x+S.x,y:p.y+S.y},r],N,_,T,I]}function nM(e,n,r,i){const o=Math.min(gx(e,n)/2,gx(n,r)/2,i),{x:l,y:u}=n;if(e.x===l&&l===r.x||e.y===u&&u===r.y)return`L${l} ${u}`;if(e.y===u){const p=e.x<r.x?-1:1,d=e.y<r.y?1:-1;return`L ${l+o*p},${u}Q ${l},${u} ${l},${u+o*d}`}const c=e.x<r.x?1:-1,h=e.y<r.y?-1:1;return`L ${l},${u+o*h}Q ${l},${u} ${l+o*c},${u}`}function _v({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top,borderRadius:u=5,centerX:c,centerY:h,offset:p=20}){const[d,m,y,w,N]=tM({source:{x:e,y:n},sourcePosition:r,target:{x:i,y:o},targetPosition:l,center:{x:c,y:h},offset:p});return[d.reduce((b,S,k)=>{let E="";return k>0&&k<d.length-1?E=nM(d[k-1],S,d[k+1],u):E=`${k===0?"M":"L"}${S.x} ${S.y}`,b+=E,b},""),m,y,w,N]}const Mu=j.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,sourcePosition:m=Ae.Bottom,targetPosition:y=Ae.Top,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:b})=>{const[S,k,E]=_v({sourceX:e,sourceY:n,sourcePosition:m,targetX:r,targetY:i,targetPosition:y,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset});return ue.createElement(Ca,{path:S,labelX:k,labelY:E,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:w,markerStart:N,interactionWidth:b})});Mu.displayName="SmoothStepEdge";const Yv=j.memo(e=>{var n;return ue.createElement(Mu,{...e,pathOptions:j.useMemo(()=>{var r;return{borderRadius:0,offset:(r=e.pathOptions)==null?void 0:r.offset}},[(n=e.pathOptions)==null?void 0:n.offset])})});Yv.displayName="StepEdge";function rM({sourceX:e,sourceY:n,targetX:r,targetY:i}){const[o,l,u,c]=EN({sourceX:e,sourceY:n,targetX:r,targetY:i});return[`M ${e},${n}L ${r},${i}`,o,l,u,c]}const Kv=j.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[N,_,b]=rM({sourceX:e,sourceY:n,targetX:r,targetY:i});return ue.createElement(Ca,{path:N,labelX:_,labelY:b,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w})});Kv.displayName="StraightEdge";function Xl(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function vx({pos:e,x1:n,y1:r,x2:i,y2:o,c:l}){switch(e){case Ae.Left:return[n-Xl(n-i,l),r];case Ae.Right:return[n+Xl(i-n,l),r];case Ae.Top:return[n,r-Xl(r-o,l)];case Ae.Bottom:return[n,r+Xl(o-r,l)]}}function TN({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top,curvature:u=.25}){const[c,h]=vx({pos:r,x1:e,y1:n,x2:i,y2:o,c:u}),[p,d]=vx({pos:l,x1:i,y1:o,x2:e,y2:n,c:u}),[m,y,w,N]=NN({sourceX:e,sourceY:n,targetX:i,targetY:o,sourceControlX:c,sourceControlY:h,targetControlX:p,targetControlY:d});return[`M${e},${n} C${c},${h} ${p},${d} ${i},${o}`,m,y,w,N]}const bu=j.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,sourcePosition:o=Ae.Bottom,targetPosition:l=Ae.Top,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:b})=>{const[S,k,E]=TN({sourceX:e,sourceY:n,sourcePosition:o,targetX:r,targetY:i,targetPosition:l,curvature:_==null?void 0:_.curvature});return ue.createElement(Ca,{path:S,labelX:k,labelY:E,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:b})});bu.displayName="BezierEdge";const Xv=j.createContext(null),sM=Xv.Provider;Xv.Consumer;const iM=()=>j.useContext(Xv),oM=e=>"id"in e&&"source"in e&&"target"in e,aM=({source:e,sourceHandle:n,target:r,targetHandle:i})=>`reactflow__edge-${e}${n||""}-${r}${i||""}`,bv=(e,n)=>typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`,lM=(e,n)=>n.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),uM=(e,n)=>{if(!e.source||!e.target)return n;let r;return oM(e)?r={...e}:r={...e,id:aM(e)},lM(r,n)?n:n.concat(r)},Sv=({x:e,y:n},[r,i,o],l,[u,c])=>{const h={x:(e-r)/o,y:(n-i)/o};return l?{x:u*Math.round(h.x/u),y:c*Math.round(h.y/c)}:h},RN=({x:e,y:n},[r,i,o])=>({x:e*o+r,y:n*o+i}),ui=(e,n=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const r=(e.width??0)*n[0],i=(e.height??0)*n[1],o={x:e.position.x-r,y:e.position.y-i};return{...o,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-r,y:e.positionAbsolute.y-i}:o}},Ou=(e,n=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((i,o)=>{const{x:l,y:u}=ui(o,n).positionAbsolute;return _N(i,wa({x:l,y:u,width:o.width||0,height:o.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return bN(r)},jN=(e,n,[r,i,o]=[0,0,1],l=!1,u=!1,c=[0,0])=>{const h={x:(n.x-r)/o,y:(n.y-i)/o,width:n.width/o,height:n.height/o},p=[];return e.forEach(d=>{const{width:m,height:y,selectable:w=!0,hidden:N=!1}=d;if(u&&!w||N)return!1;const{positionAbsolute:_}=ui(d,c),b={x:_.x,y:_.y,width:m||0,height:y||0},S=wv(h,b),k=typeof m>"u"||typeof y>"u"||m===null||y===null,E=l&&S>0,T=(m||0)*(y||0);(k||E||S>=T||d.dragging)&&p.push(d)}),p},AN=(e,n)=>{const r=e.map(i=>i.id);return n.filter(i=>r.includes(i.source)||r.includes(i.target))},IN=(e,n,r,i,o,l=.1)=>{const u=n/(e.width*(1+l)),c=r/(e.height*(1+l)),h=Math.min(u,c),p=uo(h,i,o),d=e.x+e.width/2,m=e.y+e.height/2,y=n/2-d*p,w=r/2-m*p;return{x:y,y:w,zoom:p}},ii=(e,n=0)=>e.transition().duration(n);function yx(e,n,r,i){return(n[r]||[]).reduce((o,l)=>{var u,c;return`${e.id}-${l.id}-${r}`!==i&&o.push({id:l.id||null,type:r,nodeId:e.id,x:(((u=e.positionAbsolute)==null?void 0:u.x)??0)+l.x+l.width/2,y:(((c=e.positionAbsolute)==null?void 0:c.y)??0)+l.y+l.height/2}),o},[])}function cM(e,n,r,i,o,l){const{x:u,y:c}=ks(e),p=n.elementsFromPoint(u,c).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const _=Qv(void 0,p),b=p.getAttribute("data-handleid"),S=l({nodeId:N,id:b,type:_});if(S){const k=o.find(E=>E.nodeId===N&&E.type===_&&E.id===b);return{handle:{id:b,type:_,nodeId:N,x:(k==null?void 0:k.x)||r.x,y:(k==null?void 0:k.y)||r.y},validHandleResult:S}}}}let d=[],m=1/0;if(o.forEach(N=>{const _=Math.sqrt((N.x-r.x)**2+(N.y-r.y)**2);if(_<=i){const b=l(N);_<=m&&(_<m?d=[{handle:N,validHandleResult:b}]:_===m&&d.push({handle:N,validHandleResult:b}),m=_)}}),!d.length)return{handle:null,validHandleResult:MN()};if(d.length===1)return d[0];const y=d.some(({validHandleResult:N})=>N.isValid),w=d.some(({handle:N})=>N.type==="target");return d.find(({handle:N,validHandleResult:_})=>w?N.type==="target":y?_.isValid:!0)||d[0]}const dM={source:null,target:null,sourceHandle:null,targetHandle:null},MN=()=>({handleDomNode:null,isValid:!1,connection:dM,endHandle:null});function ON(e,n,r,i,o,l,u){const c=o==="target",h=u.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={...MN(),handleDomNode:h};if(h){const d=Qv(void 0,h),m=h.getAttribute("data-nodeid"),y=h.getAttribute("data-handleid"),w=h.classList.contains("connectable"),N=h.classList.contains("connectableend"),_={source:c?m:r,sourceHandle:c?y:i,target:c?r:m,targetHandle:c?i:y};p.connection=_,w&&N&&(n===di.Strict?c&&d==="source"||!c&&d==="target":m!==r||y!==i)&&(p.endHandle={nodeId:m,handleId:y,type:d},p.isValid=l(_))}return p}function fM({nodes:e,nodeId:n,handleId:r,handleType:i}){return e.reduce((o,l)=>{if(l[yt]){const{handleBounds:u}=l[yt];let c=[],h=[];u&&(c=yx(l,u,"source",`${n}-${r}-${i}`),h=yx(l,u,"target",`${n}-${r}-${i}`)),o.push(...c,...h)}return o},[])}function Qv(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function $d(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function hM(e,n){let r=null;return n?r="valid":e&&!n&&(r="invalid"),r}function PN({event:e,handleId:n,nodeId:r,onConnect:i,isTarget:o,getState:l,setState:u,isValidConnection:c,edgeUpdaterType:h,onReconnectEnd:p}){const d=xN(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:_,panBy:b,getNodes:S,cancelConnection:k}=l();let E=0,T;const{x:I,y:O}=ks(e),A=d==null?void 0:d.elementFromPoint(I,O),U=Qv(h,A),z=y==null?void 0:y.getBoundingClientRect();if(!z||!U)return;let P,D=ks(e,z),V=!1,B=null,C=!1,q=null;const L=fM({nodes:S(),nodeId:r,handleId:n,handleType:U}),re=()=>{if(!w)return;const[Z,M]=wN(D,z);b({x:Z,y:M}),E=requestAnimationFrame(re)};u({connectionPosition:D,connectionStatus:null,connectionNodeId:r,connectionHandleId:n,connectionHandleType:U,connectionStartHandle:{nodeId:r,handleId:n,type:U},connectionEndHandle:null}),_==null||_(e,{nodeId:r,handleId:n,handleType:U});function J(Z){const{transform:M}=l();D=ks(Z,z);const{handle:G,validHandleResult:Y}=cM(Z,d,Sv(D,M,!1,[1,1]),N,L,$=>ON($,m,r,n,o?"target":"source",c,d));if(T=G,V||(re(),V=!0),q=Y.handleDomNode,B=Y.connection,C=Y.isValid,u({connectionPosition:T&&C?RN({x:T.x,y:T.y},M):D,connectionStatus:hM(!!T,C),connectionEndHandle:Y.endHandle}),!T&&!C&&!q)return $d(P);B.source!==B.target&&q&&($d(P),P=q,q.classList.add("connecting","react-flow__handle-connecting"),q.classList.toggle("valid",C),q.classList.toggle("react-flow__handle-valid",C))}function H(Z){var M,G;(T||q)&&B&&C&&(i==null||i(B)),(G=(M=l()).onConnectEnd)==null||G.call(M,Z),h&&(p==null||p(Z)),$d(P),k(),cancelAnimationFrame(E),V=!1,C=!1,B=null,q=null,d.removeEventListener("mousemove",J),d.removeEventListener("mouseup",H),d.removeEventListener("touchmove",J),d.removeEventListener("touchend",H)}d.addEventListener("mousemove",J),d.addEventListener("mouseup",H),d.addEventListener("touchmove",J),d.addEventListener("touchend",H)}const wx=()=>!0,pM=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),mM=(e,n,r)=>i=>{const{connectionStartHandle:o,connectionEndHandle:l,connectionClickStartHandle:u}=i;return{connecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===n&&(o==null?void 0:o.type)===r||(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===n&&(l==null?void 0:l.type)===r,clickConnecting:(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.handleId)===n&&(u==null?void 0:u.type)===r}},LN=j.forwardRef(({type:e="source",position:n=Ae.Top,isValidConnection:r,isConnectable:i=!0,isConnectableStart:o=!0,isConnectableEnd:l=!0,id:u,onConnect:c,children:h,className:p,onMouseDown:d,onTouchStart:m,...y},w)=>{var z,P;const N=u||null,_=e==="target",b=Tt(),S=iM(),{connectOnClick:k,noPanClassName:E}=Ke(pM,Ct),{connecting:T,clickConnecting:I}=Ke(mM(S,N,e),Ct);S||(P=(z=b.getState()).onError)==null||P.call(z,"010",Br.error010());const O=D=>{const{defaultEdgeOptions:V,onConnect:B,hasDefaultEdges:C}=b.getState(),q={...V,...D};if(C){const{edges:L,setEdges:re}=b.getState();re(uM(q,L))}B==null||B(q),c==null||c(q)},A=D=>{if(!S)return;const V=kN(D);o&&(V&&D.button===0||!V)&&PN({event:D,handleId:N,nodeId:S,onConnect:O,isTarget:_,getState:b.getState,setState:b.setState,isValidConnection:r||b.getState().isValidConnection||wx}),V?d==null||d(D):m==null||m(D)},U=D=>{const{onClickConnectStart:V,onClickConnectEnd:B,connectionClickStartHandle:C,connectionMode:q,isValidConnection:L}=b.getState();if(!S||!C&&!o)return;if(!C){V==null||V(D,{nodeId:S,handleId:N,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:S,type:e,handleId:N}});return}const re=xN(D.target),J=r||L||wx,{connection:H,isValid:Z}=ON({nodeId:S,id:N,type:e},q,C.nodeId,C.handleId||null,C.type,J,re);Z&&O(H),B==null||B(D),b.setState({connectionClickStartHandle:null})};return ue.createElement("div",{"data-handleid":N,"data-nodeid":S,"data-handlepos":n,"data-id":`${S}-${N}-${e}`,className:Dt(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",E,p,{source:!_,target:_,connectable:i,connectablestart:o,connectableend:l,connecting:I,connectionindicator:i&&(o&&!T||l&&T)}]),onMouseDown:A,onTouchStart:A,onClick:k?U:void 0,ref:w,...y},h)});LN.displayName="Handle";var co=j.memo(LN);const $N=({data:e,isConnectable:n,targetPosition:r=Ae.Top,sourcePosition:i=Ae.Bottom})=>ue.createElement(ue.Fragment,null,ue.createElement(co,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label,ue.createElement(co,{type:"source",position:i,isConnectable:n}));$N.displayName="DefaultNode";var kv=j.memo($N);const qN=({data:e,isConnectable:n,sourcePosition:r=Ae.Bottom})=>ue.createElement(ue.Fragment,null,e==null?void 0:e.label,ue.createElement(co,{type:"source",position:r,isConnectable:n}));qN.displayName="InputNode";var DN=j.memo(qN);const FN=({data:e,isConnectable:n,targetPosition:r=Ae.Top})=>ue.createElement(ue.Fragment,null,ue.createElement(co,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label);FN.displayName="OutputNode";var zN=j.memo(FN);const Zv=()=>null;Zv.displayName="GroupNode";const gM=e=>({selectedNodes:e.getNodes().filter(n=>n.selected),selectedEdges:e.edges.filter(n=>n.selected).map(n=>({...n}))}),Ql=e=>e.id;function vM(e,n){return Ct(e.selectedNodes.map(Ql),n.selectedNodes.map(Ql))&&Ct(e.selectedEdges.map(Ql),n.selectedEdges.map(Ql))}const BN=j.memo(({onSelectionChange:e})=>{const n=Tt(),{selectedNodes:r,selectedEdges:i}=Ke(gM,vM);return j.useEffect(()=>{const o={nodes:r,edges:i};e==null||e(o),n.getState().onSelectionChange.forEach(l=>l(o))},[r,i,e]),null});BN.displayName="SelectionListener";const yM=e=>!!e.onSelectionChange;function wM({onSelectionChange:e}){const n=Ke(yM);return e||n?ue.createElement(BN,{onSelectionChange:e}):null}const xM=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 Yi(e,n){j.useEffect(()=>{typeof e<"u"&&n(e)},[e])}function $e(e,n,r){j.useEffect(()=>{typeof n<"u"&&r({[e]:n})},[n])}const _M=({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,onConnect:o,onConnectStart:l,onConnectEnd:u,onClickConnectStart:c,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:d,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:_,maxZoom:b,nodeExtent:S,onNodesChange:k,onEdgesChange:E,elementsSelectable:T,connectionMode:I,snapGrid:O,snapToGrid:A,translateExtent:U,connectOnClick:z,defaultEdgeOptions:P,fitView:D,fitViewOptions:V,onNodesDelete:B,onEdgesDelete:C,onNodeDrag:q,onNodeDragStart:L,onNodeDragStop:re,onSelectionDrag:J,onSelectionDragStart:H,onSelectionDragStop:Z,noPanClassName:M,nodeOrigin:G,rfId:Y,autoPanOnConnect:$,autoPanOnNodeDrag:Q,onError:ne,connectionRadius:oe,isValidConnection:fe,nodeDragThreshold:te})=>{const{setNodes:ce,setEdges:Ce,setDefaultNodesAndEdges:ve,setMinZoom:je,setMaxZoom:ye,setTranslateExtent:ke,setNodeExtent:Ye,reset:we}=Ke(xM,Ct),_e=Tt();return j.useEffect(()=>{const Be=i==null?void 0:i.map(it=>({...it,...P}));return ve(r,Be),()=>{we()}},[]),$e("defaultEdgeOptions",P,_e.setState),$e("connectionMode",I,_e.setState),$e("onConnect",o,_e.setState),$e("onConnectStart",l,_e.setState),$e("onConnectEnd",u,_e.setState),$e("onClickConnectStart",c,_e.setState),$e("onClickConnectEnd",h,_e.setState),$e("nodesDraggable",p,_e.setState),$e("nodesConnectable",d,_e.setState),$e("nodesFocusable",m,_e.setState),$e("edgesFocusable",y,_e.setState),$e("edgesUpdatable",w,_e.setState),$e("elementsSelectable",T,_e.setState),$e("elevateNodesOnSelect",N,_e.setState),$e("snapToGrid",A,_e.setState),$e("snapGrid",O,_e.setState),$e("onNodesChange",k,_e.setState),$e("onEdgesChange",E,_e.setState),$e("connectOnClick",z,_e.setState),$e("fitViewOnInit",D,_e.setState),$e("fitViewOnInitOptions",V,_e.setState),$e("onNodesDelete",B,_e.setState),$e("onEdgesDelete",C,_e.setState),$e("onNodeDrag",q,_e.setState),$e("onNodeDragStart",L,_e.setState),$e("onNodeDragStop",re,_e.setState),$e("onSelectionDrag",J,_e.setState),$e("onSelectionDragStart",H,_e.setState),$e("onSelectionDragStop",Z,_e.setState),$e("noPanClassName",M,_e.setState),$e("nodeOrigin",G,_e.setState),$e("rfId",Y,_e.setState),$e("autoPanOnConnect",$,_e.setState),$e("autoPanOnNodeDrag",Q,_e.setState),$e("onError",ne,_e.setState),$e("connectionRadius",oe,_e.setState),$e("isValidConnection",fe,_e.setState),$e("nodeDragThreshold",te,_e.setState),Yi(e,ce),Yi(n,Ce),Yi(_,je),Yi(b,ye),Yi(U,ke),Yi(S,Ye),null},xx={display:"none"},bM={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},UN="react-flow__node-desc",HN="react-flow__edge-desc",SM="react-flow__aria-live",kM=e=>e.ariaLiveMessage;function EM({rfId:e}){const n=Ke(kM);return ue.createElement("div",{id:`${SM}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:bM},n)}function NM({rfId:e,disableKeyboardA11y:n}){return ue.createElement(ue.Fragment,null,ue.createElement("div",{id:`${UN}-${e}`,style:xx},"Press enter or space to select a node.",!n&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),ue.createElement("div",{id:`${HN}-${e}`,style:xx},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!n&&ue.createElement(EM,{rfId:e}))}var _a=(e=null,n={actInsideInputWithModifier:!0})=>{const[r,i]=j.useState(!1),o=j.useRef(!1),l=j.useRef(new Set([])),[u,c]=j.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),d=p.reduce((m,y)=>m.concat(...y),[]);return[p,d]}return[[],[]]},[e]);return j.useEffect(()=>{const h=typeof document<"u"?document:null,p=(n==null?void 0:n.target)||h;if(e!==null){const d=w=>{if(o.current=w.ctrlKey||w.metaKey||w.shiftKey,(!o.current||o.current&&!n.actInsideInputWithModifier)&&xv(w))return!1;const _=bx(w.code,c);l.current.add(w[_]),_x(u,l.current,!1)&&(w.preventDefault(),i(!0))},m=w=>{if((!o.current||o.current&&!n.actInsideInputWithModifier)&&xv(w))return!1;const _=bx(w.code,c);_x(u,l.current,!0)?(i(!1),l.current.clear()):l.current.delete(w[_]),w.key==="Meta"&&l.current.clear(),o.current=!1},y=()=>{l.current.clear(),i(!1)};return p==null||p.addEventListener("keydown",d),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",d),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,i]),r};function _x(e,n,r){return e.filter(i=>r||i.length===n.size).some(i=>i.every(o=>n.has(o)))}function bx(e,n){return n.includes(e)?"code":"key"}function WN(e,n,r,i){var c,h;const o=e.parentNode||e.parentId;if(!o)return r;const l=n.get(o),u=ui(l,i);return WN(l,n,{x:(r.x??0)+u.x,y:(r.y??0)+u.y,z:(((c=l[yt])==null?void 0:c.z)??0)>(r.z??0)?((h=l[yt])==null?void 0:h.z)??0:r.z??0},i)}function VN(e,n,r){e.forEach(i=>{var l;const o=i.parentNode||i.parentId;if(o&&!e.has(o))throw new Error(`Parent node ${o} not found`);if(o||r!=null&&r[i.id]){const{x:u,y:c,z:h}=WN(i,e,{...i.position,z:((l=i[yt])==null?void 0:l.z)??0},n);i.positionAbsolute={x:u,y:c},i[yt].z=h,r!=null&&r[i.id]&&(i[yt].isParent=!0)}})}function qd(e,n,r,i){const o=new Map,l={},u=i?1e3:0;return e.forEach(c=>{var w;const h=($n(c.zIndex)?c.zIndex:0)+(c.selected?u:0),p=n.get(c.id),d={...c,positionAbsolute:{x:c.position.x,y:c.position.y}},m=c.parentNode||c.parentId;m&&(l[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==c.type;Object.defineProperty(d,yt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[yt])==null?void 0:w.handleBounds,z:h}}),o.set(c.id,d)}),VN(o,r,l),o}function GN(e,n={}){const{getNodes:r,width:i,height:o,minZoom:l,maxZoom:u,d3Zoom:c,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:d,nodeOrigin:m}=e(),y=n.initial&&!p&&d;if(c&&h&&(y||!n.initial)){const N=r().filter(b=>{var k;const S=n.includeHiddenNodes?b.width&&b.height:!b.hidden;return(k=n.nodes)!=null&&k.length?S&&n.nodes.some(E=>E.id===b.id):S}),_=N.every(b=>b.width&&b.height);if(N.length>0&&_){const b=Ou(N,m),{x:S,y:k,zoom:E}=IN(b,i,o,n.minZoom??l,n.maxZoom??u,n.padding??.1),T=Fr.translate(S,k).scale(E);return typeof n.duration=="number"&&n.duration>0?c.transform(ii(h,n.duration),T):c.transform(h,T),!0}}return!1}function CM(e,n){return e.forEach(r=>{const i=n.get(r.id);i&&n.set(i.id,{...i,[yt]:i[yt],selected:r.selected})}),new Map(n)}function TM(e,n){return n.map(r=>{const i=e.find(o=>o.id===r.id);return i&&(r.selected=i.selected),r})}function Zl({changedNodes:e,changedEdges:n,get:r,set:i}){const{nodeInternals:o,edges:l,onNodesChange:u,onEdgesChange:c,hasDefaultNodes:h,hasDefaultEdges:p}=r();e!=null&&e.length&&(h&&i({nodeInternals:CM(e,o)}),u==null||u(e)),n!=null&&n.length&&(p&&i({edges:TM(n,l)}),c==null||c(n))}const Ki=()=>{},RM={zoomIn:Ki,zoomOut:Ki,zoomTo:Ki,getZoom:()=>1,setViewport:Ki,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ki,fitBounds:Ki,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},jM=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),AM=()=>{const e=Tt(),{d3Zoom:n,d3Selection:r}=Ke(jM,Ct);return j.useMemo(()=>r&&n?{zoomIn:o=>n.scaleBy(ii(r,o==null?void 0:o.duration),1.2),zoomOut:o=>n.scaleBy(ii(r,o==null?void 0:o.duration),1/1.2),zoomTo:(o,l)=>n.scaleTo(ii(r,l==null?void 0:l.duration),o),getZoom:()=>e.getState().transform[2],setViewport:(o,l)=>{const[u,c,h]=e.getState().transform,p=Fr.translate(o.x??u,o.y??c).scale(o.zoom??h);n.transform(ii(r,l==null?void 0:l.duration),p)},getViewport:()=>{const[o,l,u]=e.getState().transform;return{x:o,y:l,zoom:u}},fitView:o=>GN(e.getState,o),setCenter:(o,l,u)=>{const{width:c,height:h,maxZoom:p}=e.getState(),d=typeof(u==null?void 0:u.zoom)<"u"?u.zoom:p,m=c/2-o*d,y=h/2-l*d,w=Fr.translate(m,y).scale(d);n.transform(ii(r,u==null?void 0:u.duration),w)},fitBounds:(o,l)=>{const{width:u,height:c,minZoom:h,maxZoom:p}=e.getState(),{x:d,y:m,zoom:y}=IN(o,u,c,h,p,(l==null?void 0:l.padding)??.1),w=Fr.translate(d,m).scale(y);n.transform(ii(r,l==null?void 0:l.duration),w)},project:o=>{const{transform:l,snapToGrid:u,snapGrid:c}=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"),Sv(o,l,u,c)},screenToFlowPosition:o=>{const{transform:l,snapToGrid:u,snapGrid:c,domNode:h}=e.getState();if(!h)return o;const{x:p,y:d}=h.getBoundingClientRect(),m={x:o.x-p,y:o.y-d};return Sv(m,l,u,c)},flowToScreenPosition:o=>{const{transform:l,domNode:u}=e.getState();if(!u)return o;const{x:c,y:h}=u.getBoundingClientRect(),p=RN(o,l);return{x:p.x+c,y:p.y+h}},viewportInitialized:!0}:RM,[n,r])};function Ta(){const e=AM(),n=Tt(),r=j.useCallback(()=>n.getState().getNodes().map(_=>({..._})),[]),i=j.useCallback(_=>n.getState().nodeInternals.get(_),[]),o=j.useCallback(()=>{const{edges:_=[]}=n.getState();return _.map(b=>({...b}))},[]),l=j.useCallback(_=>{const{edges:b=[]}=n.getState();return b.find(S=>S.id===_)},[]),u=j.useCallback(_=>{const{getNodes:b,setNodes:S,hasDefaultNodes:k,onNodesChange:E}=n.getState(),T=b(),I=typeof _=="function"?_(T):_;if(k)S(I);else if(E){const O=I.length===0?T.map(A=>({type:"remove",id:A.id})):I.map(A=>({item:A,type:"reset"}));E(O)}},[]),c=j.useCallback(_=>{const{edges:b=[],setEdges:S,hasDefaultEdges:k,onEdgesChange:E}=n.getState(),T=typeof _=="function"?_(b):_;if(k)S(T);else if(E){const I=T.length===0?b.map(O=>({type:"remove",id:O.id})):T.map(O=>({item:O,type:"reset"}));E(I)}},[]),h=j.useCallback(_=>{const b=Array.isArray(_)?_:[_],{getNodes:S,setNodes:k,hasDefaultNodes:E,onNodesChange:T}=n.getState();if(E){const O=[...S(),...b];k(O)}else if(T){const I=b.map(O=>({item:O,type:"add"}));T(I)}},[]),p=j.useCallback(_=>{const b=Array.isArray(_)?_:[_],{edges:S=[],setEdges:k,hasDefaultEdges:E,onEdgesChange:T}=n.getState();if(E)k([...S,...b]);else if(T){const I=b.map(O=>({item:O,type:"add"}));T(I)}},[]),d=j.useCallback(()=>{const{getNodes:_,edges:b=[],transform:S}=n.getState(),[k,E,T]=S;return{nodes:_().map(I=>({...I})),edges:b.map(I=>({...I})),viewport:{x:k,y:E,zoom:T}}},[]),m=j.useCallback(({nodes:_,edges:b})=>{const{nodeInternals:S,getNodes:k,edges:E,hasDefaultNodes:T,hasDefaultEdges:I,onNodesDelete:O,onEdgesDelete:A,onNodesChange:U,onEdgesChange:z}=n.getState(),P=(_||[]).map(q=>q.id),D=(b||[]).map(q=>q.id),V=k().reduce((q,L)=>{const re=L.parentNode||L.parentId,J=!P.includes(L.id)&&re&&q.find(Z=>Z.id===re);return(typeof L.deletable=="boolean"?L.deletable:!0)&&(P.includes(L.id)||J)&&q.push(L),q},[]),B=E.filter(q=>typeof q.deletable=="boolean"?q.deletable:!0),C=B.filter(q=>D.includes(q.id));if(V||C){const q=AN(V,B),L=[...C,...q],re=L.reduce((J,H)=>(J.includes(H.id)||J.push(H.id),J),[]);if((I||T)&&(I&&n.setState({edges:E.filter(J=>!re.includes(J.id))}),T&&(V.forEach(J=>{S.delete(J.id)}),n.setState({nodeInternals:new Map(S)}))),re.length>0&&(A==null||A(L),z&&z(re.map(J=>({id:J,type:"remove"})))),V.length>0&&(O==null||O(V),U)){const J=V.map(H=>({id:H.id,type:"remove"}));U(J)}}},[]),y=j.useCallback(_=>{const b=QI(_),S=b?null:n.getState().nodeInternals.get(_.id);return!b&&!S?[null,null,b]:[b?_:hx(S),S,b]},[]),w=j.useCallback((_,b=!0,S)=>{const[k,E,T]=y(_);return k?(S||n.getState().getNodes()).filter(I=>{if(!T&&(I.id===E.id||!I.positionAbsolute))return!1;const O=hx(I),A=wv(O,k);return b&&A>0||A>=k.width*k.height}):[]},[]),N=j.useCallback((_,b,S=!0)=>{const[k]=y(_);if(!k)return!1;const E=wv(k,b);return S&&E>0||E>=k.width*k.height},[]);return j.useMemo(()=>({...e,getNodes:r,getNode:i,getEdges:o,getEdge:l,setNodes:u,setEdges:c,addNodes:h,addEdges:p,toObject:d,deleteElements:m,getIntersectingNodes:w,isNodeIntersecting:N}),[e,r,i,o,l,u,c,h,p,d,m,w,N])}const IM={actInsideInputWithModifier:!1};var MM=({deleteKeyCode:e,multiSelectionKeyCode:n})=>{const r=Tt(),{deleteElements:i}=Ta(),o=_a(e,IM),l=_a(n);j.useEffect(()=>{if(o){const{edges:u,getNodes:c}=r.getState(),h=c().filter(d=>d.selected),p=u.filter(d=>d.selected);i({nodes:h,edges:p}),r.setState({nodesSelectionActive:!1})}},[o]),j.useEffect(()=>{r.setState({multiSelectionActive:l})},[l])};function OM(e){const n=Tt();j.useEffect(()=>{let r;const i=()=>{var l,u;if(!e.current)return;const o=Wv(e.current);(o.height===0||o.width===0)&&((u=(l=n.getState()).onError)==null||u.call(l,"004",Br.error004())),n.setState({width:o.width||500,height:o.height||500})};return i(),window.addEventListener("resize",i),e.current&&(r=new ResizeObserver(()=>i()),r.observe(e.current)),()=>{window.removeEventListener("resize",i),r&&e.current&&r.unobserve(e.current)}},[])}const Jv={position:"absolute",width:"100%",height:"100%",top:0,left:0},PM=(e,n)=>e.x!==n.x||e.y!==n.y||e.zoom!==n.k,Jl=e=>({x:e.x,y:e.y,zoom:e.k}),Xi=(e,n)=>e.target.closest(`.${n}`),Sx=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),kx=e=>{const n=e.ctrlKey&&xu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n},LM=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),$M=({onMove:e,onMoveStart:n,onMoveEnd:r,onPaneContextMenu:i,zoomOnScroll:o=!0,zoomOnPinch:l=!0,panOnScroll:u=!1,panOnScrollSpeed:c=.5,panOnScrollMode:h=ai.Free,zoomOnDoubleClick:p=!0,elementsSelectable:d,panOnDrag:m=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:_,zoomActivationKeyCode:b,preventScrolling:S=!0,children:k,noWheelClassName:E,noPanClassName:T})=>{const I=j.useRef(),O=Tt(),A=j.useRef(!1),U=j.useRef(!1),z=j.useRef(null),P=j.useRef({x:0,y:0,zoom:0}),{d3Zoom:D,d3Selection:V,d3ZoomHandler:B,userSelectionActive:C}=Ke(LM,Ct),q=_a(b),L=j.useRef(0),re=j.useRef(!1),J=j.useRef();return OM(z),j.useEffect(()=>{if(z.current){const H=z.current.getBoundingClientRect(),Z=vN().scaleExtent([N,_]).translateExtent(w),M=Ln(z.current).call(Z),G=Fr.translate(y.x,y.y).scale(uo(y.zoom,N,_)),Y=[[0,0],[H.width,H.height]],$=Z.constrain()(G,Y,w);Z.transform(M,$),Z.wheelDelta(kx),O.setState({d3Zoom:Z,d3Selection:M,d3ZoomHandler:M.on("wheel.zoom"),transform:[$.x,$.y,$.k],domNode:z.current.closest(".react-flow")})}},[]),j.useEffect(()=>{V&&D&&(u&&!q&&!C?V.on("wheel.zoom",H=>{if(Xi(H,E))return!1;H.preventDefault(),H.stopImmediatePropagation();const Z=V.property("__zoom").k||1;if(H.ctrlKey&&l){const fe=Jn(H),te=kx(H),ce=Z*Math.pow(2,te);D.scaleTo(V,ce,fe,H);return}const M=H.deltaMode===1?20:1;let G=h===ai.Vertical?0:H.deltaX*M,Y=h===ai.Horizontal?0:H.deltaY*M;!xu()&&H.shiftKey&&h!==ai.Vertical&&(G=H.deltaY*M,Y=0),D.translateBy(V,-(G/Z)*c,-(Y/Z)*c,{internal:!0});const $=Jl(V.property("__zoom")),{onViewportChangeStart:Q,onViewportChange:ne,onViewportChangeEnd:oe}=O.getState();clearTimeout(J.current),re.current||(re.current=!0,n==null||n(H,$),Q==null||Q($)),re.current&&(e==null||e(H,$),ne==null||ne($),J.current=setTimeout(()=>{r==null||r(H,$),oe==null||oe($),re.current=!1},150))},{passive:!1}):typeof B<"u"&&V.on("wheel.zoom",function(H,Z){if(!S&&H.type==="wheel"&&!H.ctrlKey||Xi(H,E))return null;H.preventDefault(),B.call(this,H,Z)},{passive:!1}))},[C,u,h,V,D,B,q,l,S,E,n,e,r]),j.useEffect(()=>{D&&D.on("start",H=>{var G,Y;if(!H.sourceEvent||H.sourceEvent.internal)return null;L.current=(G=H.sourceEvent)==null?void 0:G.button;const{onViewportChangeStart:Z}=O.getState(),M=Jl(H.transform);A.current=!0,P.current=M,((Y=H.sourceEvent)==null?void 0:Y.type)==="mousedown"&&O.setState({paneDragging:!0}),Z==null||Z(M),n==null||n(H.sourceEvent,M)})},[D,n]),j.useEffect(()=>{D&&(C&&!A.current?D.on("zoom",null):C||D.on("zoom",H=>{var M;const{onViewportChange:Z}=O.getState();if(O.setState({transform:[H.transform.x,H.transform.y,H.transform.k]}),U.current=!!(i&&Sx(m,L.current??0)),(e||Z)&&!((M=H.sourceEvent)!=null&&M.internal)){const G=Jl(H.transform);Z==null||Z(G),e==null||e(H.sourceEvent,G)}}))},[C,D,e,m,i]),j.useEffect(()=>{D&&D.on("end",H=>{if(!H.sourceEvent||H.sourceEvent.internal)return null;const{onViewportChangeEnd:Z}=O.getState();if(A.current=!1,O.setState({paneDragging:!1}),i&&Sx(m,L.current??0)&&!U.current&&i(H.sourceEvent),U.current=!1,(r||Z)&&PM(P.current,H.transform)){const M=Jl(H.transform);P.current=M,clearTimeout(I.current),I.current=setTimeout(()=>{Z==null||Z(M),r==null||r(H.sourceEvent,M)},u?150:0)}})},[D,u,m,r,i]),j.useEffect(()=>{D&&D.filter(H=>{const Z=q||o,M=l&&H.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&H.button===1&&H.type==="mousedown"&&(Xi(H,"react-flow__node")||Xi(H,"react-flow__edge")))return!0;if(!m&&!Z&&!u&&!p&&!l||C||!p&&H.type==="dblclick"||Xi(H,E)&&H.type==="wheel"||Xi(H,T)&&(H.type!=="wheel"||u&&H.type==="wheel"&&!q)||!l&&H.ctrlKey&&H.type==="wheel"||!Z&&!u&&!M&&H.type==="wheel"||!m&&(H.type==="mousedown"||H.type==="touchstart")||Array.isArray(m)&&!m.includes(H.button)&&H.type==="mousedown")return!1;const G=Array.isArray(m)&&m.includes(H.button)||!H.button||H.button<=1;return(!H.ctrlKey||H.type==="wheel")&&G})},[C,D,o,l,u,p,m,d,q]),ue.createElement("div",{className:"react-flow__renderer",ref:z,style:Jv},k)},qM=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function DM(){const{userSelectionActive:e,userSelectionRect:n}=Ke(qM,Ct);return e&&n?ue.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}function Ex(e,n){const r=n.parentNode||n.parentId,i=e.find(o=>o.id===r);if(i){const o=n.position.x+n.width-i.width,l=n.position.y+n.height-i.height;if(o>0||l>0||n.position.x<0||n.position.y<0){if(i.style={...i.style},i.style.width=i.style.width??i.width,i.style.height=i.style.height??i.height,o>0&&(i.style.width+=o),l>0&&(i.style.height+=l),n.position.x<0){const u=Math.abs(n.position.x);i.position.x=i.position.x-u,i.style.width+=u,n.position.x=0}if(n.position.y<0){const u=Math.abs(n.position.y);i.position.y=i.position.y-u,i.style.height+=u,n.position.y=0}i.width=i.style.width,i.height=i.style.height}}}function FM(e,n){if(e.some(i=>i.type==="reset"))return e.filter(i=>i.type==="reset").map(i=>i.item);const r=e.filter(i=>i.type==="add").map(i=>i.item);return n.reduce((i,o)=>{const l=e.filter(c=>c.id===o.id);if(l.length===0)return i.push(o),i;const u={...o};for(const c of l)if(c)switch(c.type){case"select":{u.selected=c.selected;break}case"position":{typeof c.position<"u"&&(u.position=c.position),typeof c.positionAbsolute<"u"&&(u.positionAbsolute=c.positionAbsolute),typeof c.dragging<"u"&&(u.dragging=c.dragging),u.expandParent&&Ex(i,u);break}case"dimensions":{typeof c.dimensions<"u"&&(u.width=c.dimensions.width,u.height=c.dimensions.height),typeof c.updateStyle<"u"&&(u.style={...u.style||{},...c.dimensions}),typeof c.resizing=="boolean"&&(u.resizing=c.resizing),u.expandParent&&Ex(i,u);break}case"remove":return i}return i.push(u),i},r)}function zM(e,n){return FM(e,n)}const bs=(e,n)=>({id:e,type:"select",selected:n});function eo(e,n){return e.reduce((r,i)=>{const o=n.includes(i.id);return!i.selected&&o?(i.selected=!0,r.push(bs(i.id,!0))):i.selected&&!o&&(i.selected=!1,r.push(bs(i.id,!1))),r},[])}const Dd=(e,n)=>r=>{r.target===n.current&&(e==null||e(r))},BM=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),YN=j.memo(({isSelecting:e,selectionMode:n=xa.Full,panOnDrag:r,onSelectionStart:i,onSelectionEnd:o,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:c,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:d,children:m})=>{const y=j.useRef(null),w=Tt(),N=j.useRef(0),_=j.useRef(0),b=j.useRef(),{userSelectionActive:S,elementsSelectable:k,dragging:E}=Ke(BM,Ct),T=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,_.current=0},I=B=>{l==null||l(B),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},O=B=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){B.preventDefault();return}u==null||u(B)},A=c?B=>c(B):void 0,U=B=>{const{resetSelectedElements:C,domNode:q}=w.getState();if(b.current=q==null?void 0:q.getBoundingClientRect(),!k||!e||B.button!==0||B.target!==y.current||!b.current)return;const{x:L,y:re}=ks(B,b.current);C(),w.setState({userSelectionRect:{width:0,height:0,startX:L,startY:re,x:L,y:re}}),i==null||i(B)},z=B=>{const{userSelectionRect:C,nodeInternals:q,edges:L,transform:re,onNodesChange:J,onEdgesChange:H,nodeOrigin:Z,getNodes:M}=w.getState();if(!e||!b.current||!C)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=ks(B,b.current),Y=C.startX??0,$=C.startY??0,Q={...C,x:G.x<Y?G.x:Y,y:G.y<$?G.y:$,width:Math.abs(G.x-Y),height:Math.abs(G.y-$)},ne=M(),oe=jN(q,Q,re,n===xa.Partial,!0,Z),fe=AN(oe,L).map(ce=>ce.id),te=oe.map(ce=>ce.id);if(N.current!==te.length){N.current=te.length;const ce=eo(ne,te);ce.length&&(J==null||J(ce))}if(_.current!==fe.length){_.current=fe.length;const ce=eo(L,fe);ce.length&&(H==null||H(ce))}w.setState({userSelectionRect:Q})},P=B=>{if(B.button!==0)return;const{userSelectionRect:C}=w.getState();!S&&C&&B.target===y.current&&(I==null||I(B)),w.setState({nodesSelectionActive:N.current>0}),T(),o==null||o(B)},D=B=>{S&&(w.setState({nodesSelectionActive:N.current>0}),o==null||o(B)),T()},V=k&&(e||S);return ue.createElement("div",{className:Dt(["react-flow__pane",{dragging:E,selection:e}]),onClick:V?void 0:Dd(I,y),onContextMenu:Dd(O,y),onWheel:Dd(A,y),onMouseEnter:V?void 0:h,onMouseDown:V?U:void 0,onMouseMove:V?z:p,onMouseUp:V?P:void 0,onMouseLeave:V?D:d,ref:y,style:Jv},m,ue.createElement(DM,null))});YN.displayName="Pane";function KN(e,n){const r=e.parentNode||e.parentId;if(!r)return!1;const i=n.get(r);return i?i.selected?!0:KN(i,n):!1}function Nx(e,n,r){let i=e;do{if(i!=null&&i.matches(n))return!0;if(i===r.current)return!1;i=i.parentElement}while(i);return!1}function UM(e,n,r,i){return Array.from(e.values()).filter(o=>(o.selected||o.id===i)&&(!o.parentNode||o.parentId||!KN(o,e))&&(o.draggable||n&&typeof o.draggable>"u")).map(o=>{var l,u;return{id:o.id,position:o.position||{x:0,y:0},positionAbsolute:o.positionAbsolute||{x:0,y:0},distance:{x:r.x-(((l=o.positionAbsolute)==null?void 0:l.x)??0),y:r.y-(((u=o.positionAbsolute)==null?void 0:u.y)??0)},delta:{x:0,y:0},extent:o.extent,parentNode:o.parentNode||o.parentId,parentId:o.parentNode||o.parentId,width:o.width,height:o.height,expandParent:o.expandParent}})}function HM(e,n){return!n||n==="parent"?n:[n[0],[n[1][0]-(e.width||0),n[1][1]-(e.height||0)]]}function XN(e,n,r,i,o=[0,0],l){const u=HM(e,e.extent||i);let c=u;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const m=r.get(h),{x:y,y:w}=ui(m,o).positionAbsolute;c=m&&$n(y)&&$n(w)&&$n(m.width)&&$n(m.height)?[[y+e.width*o[0],w+e.height*o[1]],[y+m.width-e.width+e.width*o[0],w+m.height-e.height+e.height*o[1]]]:c}else l==null||l("005",Br.error005()),c=u;else if(e.extent&&h&&e.extent!=="parent"){const m=r.get(h),{x:y,y:w}=ui(m,o).positionAbsolute;c=[[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(h){const m=r.get(h);p=ui(m,o).positionAbsolute}const d=c&&c!=="parent"?Vv(n,c):n;return{position:{x:d.x-p.x,y:d.y-p.y},positionAbsolute:d}}function Fd({nodeId:e,dragItems:n,nodeInternals:r}){const i=n.map(o=>({...r.get(o.id),position:o.position,positionAbsolute:o.positionAbsolute}));return[e?i.find(o=>o.id===e):i[0],i]}const Cx=(e,n,r,i)=>{const o=n.querySelectorAll(e);if(!o||!o.length)return null;const l=Array.from(o),u=n.getBoundingClientRect(),c={x:u.width*i[0],y:u.height*i[1]};return l.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-u.left-c.x)/r,y:(p.top-u.top-c.y)/r,...Wv(h)}})};function ia(e,n,r){return r===void 0?r:i=>{const o=n().nodeInternals.get(e);o&&r(i,{...o})}}function Ev({id:e,store:n,unselect:r=!1,nodeRef:i}){const{addSelectedNodes:o,unselectNodesAndEdges:l,multiSelectionActive:u,nodeInternals:c,onError:h}=n.getState(),p=c.get(e);if(!p){h==null||h("012",Br.error012(e));return}n.setState({nodesSelectionActive:!1}),p.selected?(r||p.selected&&u)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):o([e])}function WM(){const e=Tt();return j.useCallback(({sourceEvent:r})=>{const{transform:i,snapGrid:o,snapToGrid:l}=e.getState(),u=r.touches?r.touches[0].clientX:r.clientX,c=r.touches?r.touches[0].clientY:r.clientY,h={x:(u-i[0])/i[2],y:(c-i[1])/i[2]};return{xSnapped:l?o[0]*Math.round(h.x/o[0]):h.x,ySnapped:l?o[1]*Math.round(h.y/o[1]):h.y,...h}},[])}function zd(e){return(n,r,i)=>e==null?void 0:e(n,i)}function QN({nodeRef:e,disabled:n=!1,noDragClassName:r,handleSelector:i,nodeId:o,isSelectable:l,selectNodesOnDrag:u}){const c=Tt(),[h,p]=j.useState(!1),d=j.useRef([]),m=j.useRef({x:null,y:null}),y=j.useRef(0),w=j.useRef(null),N=j.useRef({x:0,y:0}),_=j.useRef(null),b=j.useRef(!1),S=j.useRef(!1),k=j.useRef(!1),E=WM();return j.useEffect(()=>{if(e!=null&&e.current){const T=Ln(e.current),I=({x:U,y:z})=>{const{nodeInternals:P,onNodeDrag:D,onSelectionDrag:V,updateNodePositions:B,nodeExtent:C,snapGrid:q,snapToGrid:L,nodeOrigin:re,onError:J}=c.getState();m.current={x:U,y:z};let H=!1,Z={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&C){const G=Ou(d.current,re);Z=wa(G)}if(d.current=d.current.map(G=>{const Y={x:U-G.distance.x,y:z-G.distance.y};L&&(Y.x=q[0]*Math.round(Y.x/q[0]),Y.y=q[1]*Math.round(Y.y/q[1]));const $=[[C[0][0],C[0][1]],[C[1][0],C[1][1]]];d.current.length>1&&C&&!G.extent&&($[0][0]=G.positionAbsolute.x-Z.x+C[0][0],$[1][0]=G.positionAbsolute.x+(G.width??0)-Z.x2+C[1][0],$[0][1]=G.positionAbsolute.y-Z.y+C[0][1],$[1][1]=G.positionAbsolute.y+(G.height??0)-Z.y2+C[1][1]);const Q=XN(G,Y,P,$,re,J);return H=H||G.position.x!==Q.position.x||G.position.y!==Q.position.y,G.position=Q.position,G.positionAbsolute=Q.positionAbsolute,G}),!H)return;B(d.current,!0,!0),p(!0);const M=o?D:zd(V);if(M&&_.current){const[G,Y]=Fd({nodeId:o,dragItems:d.current,nodeInternals:P});M(_.current,G,Y)}},O=()=>{if(!w.current)return;const[U,z]=wN(N.current,w.current);if(U!==0||z!==0){const{transform:P,panBy:D}=c.getState();m.current.x=(m.current.x??0)-U/P[2],m.current.y=(m.current.y??0)-z/P[2],D({x:U,y:z})&&I(m.current)}y.current=requestAnimationFrame(O)},A=U=>{var re;const{nodeInternals:z,multiSelectionActive:P,nodesDraggable:D,unselectNodesAndEdges:V,onNodeDragStart:B,onSelectionDragStart:C}=c.getState();S.current=!0;const q=o?B:zd(C);(!u||!l)&&!P&&o&&((re=z.get(o))!=null&&re.selected||V()),o&&l&&u&&Ev({id:o,store:c,nodeRef:e});const L=E(U);if(m.current=L,d.current=UM(z,D,L,o),q&&d.current){const[J,H]=Fd({nodeId:o,dragItems:d.current,nodeInternals:z});q(U.sourceEvent,J,H)}};if(n)T.on(".drag",null);else{const U=e2().on("start",z=>{const{domNode:P,nodeDragThreshold:D}=c.getState();D===0&&A(z),k.current=!1;const V=E(z);m.current=V,w.current=(P==null?void 0:P.getBoundingClientRect())||null,N.current=ks(z.sourceEvent,w.current)}).on("drag",z=>{var B,C;const P=E(z),{autoPanOnNodeDrag:D,nodeDragThreshold:V}=c.getState();if(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1&&(k.current=!0),!k.current){if(!b.current&&S.current&&D&&(b.current=!0,O()),!S.current){const q=P.xSnapped-(((B=m==null?void 0:m.current)==null?void 0:B.x)??0),L=P.ySnapped-(((C=m==null?void 0:m.current)==null?void 0:C.y)??0);Math.sqrt(q*q+L*L)>V&&A(z)}(m.current.x!==P.xSnapped||m.current.y!==P.ySnapped)&&d.current&&S.current&&(_.current=z.sourceEvent,N.current=ks(z.sourceEvent,w.current),I(P))}}).on("end",z=>{if(!(!S.current||k.current)&&(p(!1),b.current=!1,S.current=!1,cancelAnimationFrame(y.current),d.current)){const{updateNodePositions:P,nodeInternals:D,onNodeDragStop:V,onSelectionDragStop:B}=c.getState(),C=o?V:zd(B);if(P(d.current,!1,!1),C){const[q,L]=Fd({nodeId:o,dragItems:d.current,nodeInternals:D});C(z.sourceEvent,q,L)}}}).filter(z=>{const P=z.target;return!z.button&&(!r||!Nx(P,`.${r}`,e))&&(!i||Nx(P,i,e))});return T.call(U),()=>{T.on(".drag",null)}}}},[e,n,r,i,l,c,o,u,E]),h}function ZN(){const e=Tt();return j.useCallback(r=>{const{nodeInternals:i,nodeExtent:o,updateNodePositions:l,getNodes:u,snapToGrid:c,snapGrid:h,onError:p,nodesDraggable:d}=e.getState(),m=u().filter(k=>k.selected&&(k.draggable||d&&typeof k.draggable>"u")),y=c?h[0]:5,w=c?h[1]:5,N=r.isShiftPressed?4:1,_=r.x*y*N,b=r.y*w*N,S=m.map(k=>{if(k.positionAbsolute){const E={x:k.positionAbsolute.x+_,y:k.positionAbsolute.y+b};c&&(E.x=h[0]*Math.round(E.x/h[0]),E.y=h[1]*Math.round(E.y/h[1]));const{positionAbsolute:T,position:I}=XN(k,E,i,o,void 0,p);k.position=I,k.positionAbsolute=T}return k});l(S,!0,!1)},[])}const io={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var oa=e=>{const n=({id:r,type:i,data:o,xPos:l,yPos:u,xPosOrigin:c,yPosOrigin:h,selected:p,onClick:d,onMouseEnter:m,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:_,style:b,className:S,isDraggable:k,isSelectable:E,isConnectable:T,isFocusable:I,selectNodesOnDrag:O,sourcePosition:A,targetPosition:U,hidden:z,resizeObserver:P,dragHandle:D,zIndex:V,isParent:B,noDragClassName:C,noPanClassName:q,initialized:L,disableKeyboardA11y:re,ariaLabel:J,rfId:H,hasHandleBounds:Z})=>{const M=Tt(),G=j.useRef(null),Y=j.useRef(null),$=j.useRef(A),Q=j.useRef(U),ne=j.useRef(i),oe=E||k||d||m||y||w,fe=ZN(),te=ia(r,M.getState,m),ce=ia(r,M.getState,y),Ce=ia(r,M.getState,w),ve=ia(r,M.getState,N),je=ia(r,M.getState,_),ye=we=>{const{nodeDragThreshold:_e}=M.getState();if(E&&(!O||!k||_e>0)&&Ev({id:r,store:M,nodeRef:G}),d){const Be=M.getState().nodeInternals.get(r);Be&&d(we,{...Be})}},ke=we=>{if(!xv(we)&&!re)if(SN.includes(we.key)&&E){const _e=we.key==="Escape";Ev({id:r,store:M,unselect:_e,nodeRef:G})}else k&&p&&Object.prototype.hasOwnProperty.call(io,we.key)&&(M.setState({ariaLiveMessage:`Moved selected node ${we.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~u}`}),fe({x:io[we.key].x,y:io[we.key].y,isShiftPressed:we.shiftKey}))};j.useEffect(()=>()=>{Y.current&&(P==null||P.unobserve(Y.current),Y.current=null)},[]),j.useEffect(()=>{if(G.current&&!z){const we=G.current;(!L||!Z||Y.current!==we)&&(Y.current&&(P==null||P.unobserve(Y.current)),P==null||P.observe(we),Y.current=we)}},[z,L,Z]),j.useEffect(()=>{const we=ne.current!==i,_e=$.current!==A,Be=Q.current!==U;G.current&&(we||_e||Be)&&(we&&(ne.current=i),_e&&($.current=A),Be&&(Q.current=U),M.getState().updateNodeDimensions([{id:r,nodeElement:G.current,forceUpdate:!0}]))},[r,i,A,U]);const Ye=QN({nodeRef:G,disabled:z||!k,noDragClassName:C,handleSelector:D,nodeId:r,isSelectable:E,selectNodesOnDrag:O});return z?null:ue.createElement("div",{className:Dt(["react-flow__node",`react-flow__node-${i}`,{[q]:k},S,{selected:p,selectable:E,parent:B,dragging:Ye}]),ref:G,style:{zIndex:V,transform:`translate(${c}px,${h}px)`,pointerEvents:oe?"all":"none",visibility:L?"visible":"hidden",...b},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:te,onMouseMove:ce,onMouseLeave:Ce,onContextMenu:ve,onClick:ye,onDoubleClick:je,onKeyDown:I?ke:void 0,tabIndex:I?0:void 0,role:I?"button":void 0,"aria-describedby":re?void 0:`${UN}-${H}`,"aria-label":J},ue.createElement(sM,{value:r},ue.createElement(e,{id:r,data:o,type:i,xPos:l,yPos:u,selected:p,isConnectable:T,sourcePosition:A,targetPosition:U,dragging:Ye,dragHandle:D,zIndex:V})))};return n.displayName="NodeWrapper",j.memo(n)};const VM=e=>{const n=e.getNodes().filter(r=>r.selected);return{...Ou(n,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function GM({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:r}){const i=Tt(),{width:o,height:l,x:u,y:c,transformString:h,userSelectionActive:p}=Ke(VM,Ct),d=ZN(),m=j.useRef(null);if(j.useEffect(()=>{var N;r||(N=m.current)==null||N.focus({preventScroll:!0})},[r]),QN({nodeRef:m}),p||!o||!l)return null;const y=e?N=>{const _=i.getState().getNodes().filter(b=>b.selected);e(N,_)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(io,N.key)&&d({x:io[N.key].x,y:io[N.key].y,isShiftPressed:N.shiftKey})};return ue.createElement("div",{className:Dt(["react-flow__nodesselection","react-flow__container",n]),style:{transform:h}},ue.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:r?void 0:-1,onKeyDown:r?void 0:w,style:{width:o,height:l,top:c,left:u}}))}var YM=j.memo(GM);const KM=e=>e.nodesSelectionActive,JN=({children:e,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,deleteKeyCode:c,onMove:h,onMoveStart:p,onMoveEnd:d,selectionKeyCode:m,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:_,multiSelectionKeyCode:b,panActivationKeyCode:S,zoomActivationKeyCode:k,elementsSelectable:E,zoomOnScroll:T,zoomOnPinch:I,panOnScroll:O,panOnScrollSpeed:A,panOnScrollMode:U,zoomOnDoubleClick:z,panOnDrag:P,defaultViewport:D,translateExtent:V,minZoom:B,maxZoom:C,preventScrolling:q,onSelectionContextMenu:L,noWheelClassName:re,noPanClassName:J,disableKeyboardA11y:H})=>{const Z=Ke(KM),M=_a(m),G=_a(S),Y=G||P,$=G||O,Q=M||y&&Y!==!0;return MM({deleteKeyCode:c,multiSelectionKeyCode:b}),ue.createElement($M,{onMove:h,onMoveStart:p,onMoveEnd:d,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:T,zoomOnPinch:I,panOnScroll:$,panOnScrollSpeed:A,panOnScrollMode:U,zoomOnDoubleClick:z,panOnDrag:!M&&Y,defaultViewport:D,translateExtent:V,minZoom:B,maxZoom:C,zoomActivationKeyCode:k,preventScrolling:q,noWheelClassName:re,noPanClassName:J},ue.createElement(YN,{onSelectionStart:N,onSelectionEnd:_,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:Y,isSelecting:!!Q,selectionMode:w},e,Z&&ue.createElement(YM,{onSelectionContextMenu:L,noPanClassName:J,disableKeyboardA11y:H})))};JN.displayName="FlowRenderer";var XM=j.memo(JN);function QM(e){return Ke(j.useCallback(r=>e?jN(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function ZM(e){const n={input:oa(e.input||DN),default:oa(e.default||kv),output:oa(e.output||zN),group:oa(e.group||Zv)},r={},i=Object.keys(e).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,l)=>(o[l]=oa(e[l]||kv),o),r);return{...n,...i}}const JM=({x:e,y:n,width:r,height:i,origin:o})=>!r||!i?{x:e,y:n}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:e,y:n}:{x:e-r*o[0],y:n-i*o[1]},eO=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),eC=e=>{const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:i,elementsSelectable:o,updateNodeDimensions:l,onError:u}=Ke(eO,Ct),c=QM(e.onlyRenderVisibleElements),h=j.useRef(),p=j.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const d=new ResizeObserver(m=>{const y=m.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));l(y)});return h.current=d,d},[]);return j.useEffect(()=>()=>{var d;(d=h==null?void 0:h.current)==null||d.disconnect()},[]),ue.createElement("div",{className:"react-flow__nodes",style:Jv},c.map(d=>{var I,O,A;let m=d.type||"default";e.nodeTypes[m]||(u==null||u("003",Br.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,w=!!(d.draggable||n&&typeof d.draggable>"u"),N=!!(d.selectable||o&&typeof d.selectable>"u"),_=!!(d.connectable||r&&typeof d.connectable>"u"),b=!!(d.focusable||i&&typeof d.focusable>"u"),S=e.nodeExtent?Vv(d.positionAbsolute,e.nodeExtent):d.positionAbsolute,k=(S==null?void 0:S.x)??0,E=(S==null?void 0:S.y)??0,T=JM({x:k,y:E,width:d.width??0,height:d.height??0,origin:e.nodeOrigin});return ue.createElement(y,{key:d.id,id:d.id,className:d.className,style:d.style,type:m,data:d.data,sourcePosition:d.sourcePosition||Ae.Bottom,targetPosition:d.targetPosition||Ae.Top,hidden:d.hidden,xPos:k,yPos:E,xPosOrigin:T.x,yPosOrigin:T.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!d.selected,isDraggable:w,isSelectable:N,isConnectable:_,isFocusable:b,resizeObserver:p,dragHandle:d.dragHandle,zIndex:((I=d[yt])==null?void 0:I.z)??0,isParent:!!((O=d[yt])!=null&&O.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!d.width&&!!d.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:d.ariaLabel,hasHandleBounds:!!((A=d[yt])!=null&&A.handleBounds)})}))};eC.displayName="NodeRenderer";var tO=j.memo(eC);const nO=(e,n,r)=>r===Ae.Left?e-n:r===Ae.Right?e+n:e,rO=(e,n,r)=>r===Ae.Top?e-n:r===Ae.Bottom?e+n:e,Tx="react-flow__edgeupdater",Rx=({position:e,centerX:n,centerY:r,radius:i=10,onMouseDown:o,onMouseEnter:l,onMouseOut:u,type:c})=>ue.createElement("circle",{onMouseDown:o,onMouseEnter:l,onMouseOut:u,className:Dt([Tx,`${Tx}-${c}`]),cx:nO(n,i,e),cy:rO(r,i,e),r:i,stroke:"transparent",fill:"transparent"}),sO=()=>!0;var Qi=e=>{const n=({id:r,className:i,type:o,data:l,onClick:u,onEdgeDoubleClick:c,selected:h,animated:p,label:d,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,style:b,source:S,target:k,sourceX:E,sourceY:T,targetX:I,targetY:O,sourcePosition:A,targetPosition:U,elementsSelectable:z,hidden:P,sourceHandleId:D,targetHandleId:V,onContextMenu:B,onMouseEnter:C,onMouseMove:q,onMouseLeave:L,reconnectRadius:re,onReconnect:J,onReconnectStart:H,onReconnectEnd:Z,markerEnd:M,markerStart:G,rfId:Y,ariaLabel:$,isFocusable:Q,isReconnectable:ne,pathOptions:oe,interactionWidth:fe,disableKeyboardA11y:te})=>{const ce=j.useRef(null),[Ce,ve]=j.useState(!1),[je,ye]=j.useState(!1),ke=Tt(),Ye=j.useMemo(()=>`url('#${bv(G,Y)}')`,[G,Y]),we=j.useMemo(()=>`url('#${bv(M,Y)}')`,[M,Y]);if(P)return null;const _e=et=>{var Pt;const{edges:St,addSelectedEdges:mt,unselectNodesAndEdges:wt,multiSelectionActive:hn}=ke.getState(),Yt=St.find(Sn=>Sn.id===r);Yt&&(z&&(ke.setState({nodesSelectionActive:!1}),Yt.selected&&hn?(wt({nodes:[],edges:[Yt]}),(Pt=ce.current)==null||Pt.blur()):mt([r])),u&&u(et,Yt))},Be=sa(r,ke.getState,c),it=sa(r,ke.getState,B),pt=sa(r,ke.getState,C),Ze=sa(r,ke.getState,q),Fe=sa(r,ke.getState,L),Je=(et,St)=>{if(et.button!==0)return;const{edges:mt,isValidConnection:wt}=ke.getState(),hn=St?k:S,Yt=(St?V:D)||null,Pt=St?"target":"source",Sn=wt||sO,gr=St,kn=mt.find(pn=>pn.id===r);ye(!0),H==null||H(et,kn,Pt);const zt=pn=>{ye(!1),Z==null||Z(pn,kn,Pt)};PN({event:et,handleId:Yt,nodeId:hn,onConnect:pn=>J==null?void 0:J(kn,pn),isTarget:gr,getState:ke.getState,setState:ke.setState,isValidConnection:Sn,edgeUpdaterType:Pt,onReconnectEnd:zt})},Xe=et=>Je(et,!0),Mt=et=>Je(et,!1),ut=()=>ve(!0),Qe=()=>ve(!1),Ot=!z&&!u,Ft=et=>{var St;if(!te&&SN.includes(et.key)&&z){const{unselectNodesAndEdges:mt,addSelectedEdges:wt,edges:hn}=ke.getState();et.key==="Escape"?((St=ce.current)==null||St.blur(),mt({edges:[hn.find(Pt=>Pt.id===r)]})):wt([r])}};return ue.createElement("g",{className:Dt(["react-flow__edge",`react-flow__edge-${o}`,i,{selected:h,animated:p,inactive:Ot,updating:Ce}]),onClick:_e,onDoubleClick:Be,onContextMenu:it,onMouseEnter:pt,onMouseMove:Ze,onMouseLeave:Fe,onKeyDown:Q?Ft:void 0,tabIndex:Q?0:void 0,role:Q?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":$===null?void 0:$||`Edge from ${S} to ${k}`,"aria-describedby":Q?`${HN}-${Y}`:void 0,ref:ce},!je&&ue.createElement(e,{id:r,source:S,target:k,selected:h,animated:p,label:d,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,data:l,style:b,sourceX:E,sourceY:T,targetX:I,targetY:O,sourcePosition:A,targetPosition:U,sourceHandleId:D,targetHandleId:V,markerStart:Ye,markerEnd:we,pathOptions:oe,interactionWidth:fe}),ne&&ue.createElement(ue.Fragment,null,(ne==="source"||ne===!0)&&ue.createElement(Rx,{position:A,centerX:E,centerY:T,radius:re,onMouseDown:Xe,onMouseEnter:ut,onMouseOut:Qe,type:"source"}),(ne==="target"||ne===!0)&&ue.createElement(Rx,{position:U,centerX:I,centerY:O,radius:re,onMouseDown:Mt,onMouseEnter:ut,onMouseOut:Qe,type:"target"})))};return n.displayName="EdgeWrapper",j.memo(n)};function iO(e){const n={default:Qi(e.default||bu),straight:Qi(e.bezier||Kv),step:Qi(e.step||Yv),smoothstep:Qi(e.step||Mu),simplebezier:Qi(e.simplebezier||Gv)},r={},i=Object.keys(e).filter(o=>!["default","bezier"].includes(o)).reduce((o,l)=>(o[l]=Qi(e[l]||bu),o),r);return{...n,...i}}function jx(e,n,r=null){const i=((r==null?void 0:r.x)||0)+n.x,o=((r==null?void 0:r.y)||0)+n.y,l=(r==null?void 0:r.width)||n.width,u=(r==null?void 0:r.height)||n.height;switch(e){case Ae.Top:return{x:i+l/2,y:o};case Ae.Right:return{x:i+l,y:o+u/2};case Ae.Bottom:return{x:i+l/2,y:o+u};case Ae.Left:return{x:i,y:o+u/2}}}function Ax(e,n){return e?e.length===1||!n?e[0]:n&&e.find(r=>r.id===n)||null:null}const oO=(e,n,r,i,o,l)=>{const u=jx(r,e,n),c=jx(l,i,o);return{sourceX:u.x,sourceY:u.y,targetX:c.x,targetY:c.y}};function aO({sourcePos:e,targetPos:n,sourceWidth:r,sourceHeight:i,targetWidth:o,targetHeight:l,width:u,height:c,transform:h}){const p={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+r,n.x+o),y2:Math.max(e.y+i,n.y+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const d=wa({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:u/h[2],height:c/h[2]}),m=Math.max(0,Math.min(d.x2,p.x2)-Math.max(d.x,p.x)),y=Math.max(0,Math.min(d.y2,p.y2)-Math.max(d.y,p.y));return Math.ceil(m*y)>0}function Ix(e){var i,o,l,u,c;const n=((i=e==null?void 0:e[yt])==null?void 0:i.handleBounds)||null,r=n&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.x)<"u"&&typeof((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)<"u";return[{x:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.x)||0,y:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},n,!!r]}const lO=[{level:0,isMaxLevel:!0,edges:[]}];function uO(e,n,r=!1){let i=-1;const o=e.reduce((u,c)=>{var d,m;const h=$n(c.zIndex);let p=h?c.zIndex:0;if(r){const y=n.get(c.target),w=n.get(c.source),N=c.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),_=Math.max(((d=w==null?void 0:w[yt])==null?void 0:d.z)||0,((m=y==null?void 0:y[yt])==null?void 0:m.z)||0,1e3);p=(h?c.zIndex:0)+(N?_:0)}return u[p]?u[p].push(c):u[p]=[c],i=p>i?p:i,u},{}),l=Object.entries(o).map(([u,c])=>{const h=+u;return{edges:c,level:h,isMaxLevel:h===i}});return l.length===0?lO:l}function cO(e,n,r){const i=Ke(j.useCallback(o=>e?o.edges.filter(l=>{const u=n.get(l.source),c=n.get(l.target);return(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&aO({sourcePos:u.positionAbsolute||{x:0,y:0},targetPos:c.positionAbsolute||{x:0,y:0},sourceWidth:u.width,sourceHeight:u.height,targetWidth:c.width,targetHeight:c.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[e,n]));return uO(i,n,r)}const dO=({color:e="none",strokeWidth:n=1})=>ue.createElement("polyline",{style:{stroke:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),fO=({color:e="none",strokeWidth:n=1})=>ue.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Mx={[_u.Arrow]:dO,[_u.ArrowClosed]:fO};function hO(e){const n=Tt();return j.useMemo(()=>{var o,l;return Object.prototype.hasOwnProperty.call(Mx,e)?Mx[e]:((l=(o=n.getState()).onError)==null||l.call(o,"009",Br.error009(e)),null)},[e])}const pO=({id:e,type:n,color:r,width:i=12.5,height:o=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:c="auto-start-reverse"})=>{const h=hO(n);return h?ue.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:c,refX:"0",refY:"0"},ue.createElement(h,{color:r,strokeWidth:u})):null},mO=({defaultColor:e,rfId:n})=>r=>{const i=[];return r.edges.reduce((o,l)=>([l.markerStart,l.markerEnd].forEach(u=>{if(u&&typeof u=="object"){const c=bv(u,n);i.includes(c)||(o.push({id:c,color:u.color||e,...u}),i.push(c))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))},tC=({defaultColor:e,rfId:n})=>{const r=Ke(j.useCallback(mO({defaultColor:e,rfId:n}),[e,n]),(i,o)=>!(i.length!==o.length||i.some((l,u)=>l.id!==o[u].id)));return ue.createElement("defs",null,r.map(i=>ue.createElement(pO,{id:i.id,key:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient})))};tC.displayName="MarkerDefinitions";var gO=j.memo(tC);const vO=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}),nC=({defaultMarkerColor:e,onlyRenderVisibleElements:n,elevateEdgesOnSelect:r,rfId:i,edgeTypes:o,noPanClassName:l,onEdgeContextMenu:u,onEdgeMouseEnter:c,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:d,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,children:b,disableKeyboardA11y:S})=>{const{edgesFocusable:k,edgesUpdatable:E,elementsSelectable:T,width:I,height:O,connectionMode:A,nodeInternals:U,onError:z}=Ke(vO,Ct),P=cO(n,U,r);return I?ue.createElement(ue.Fragment,null,P.map(({level:D,edges:V,isMaxLevel:B})=>ue.createElement("svg",{key:D,style:{zIndex:D},width:I,height:O,className:"react-flow__edges react-flow__container"},B&&ue.createElement(gO,{defaultColor:e,rfId:i}),ue.createElement("g",null,V.map(C=>{const[q,L,re]=Ix(U.get(C.source)),[J,H,Z]=Ix(U.get(C.target));if(!re||!Z)return null;let M=C.type||"default";o[M]||(z==null||z("011",Br.error011(M)),M="default");const G=o[M]||o.default,Y=A===di.Strict?H.target:(H.target??[]).concat(H.source??[]),$=Ax(L.source,C.sourceHandle),Q=Ax(Y,C.targetHandle),ne=($==null?void 0:$.position)||Ae.Bottom,oe=(Q==null?void 0:Q.position)||Ae.Top,fe=!!(C.focusable||k&&typeof C.focusable>"u"),te=C.reconnectable||C.updatable,ce=typeof y<"u"&&(te||E&&typeof te>"u");if(!$||!Q)return z==null||z("008",Br.error008($,C)),null;const{sourceX:Ce,sourceY:ve,targetX:je,targetY:ye}=oO(q,$,ne,J,Q,oe);return ue.createElement(G,{key:C.id,id:C.id,className:Dt([C.className,l]),type:M,data:C.data,selected:!!C.selected,animated:!!C.animated,hidden:!!C.hidden,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,style:C.style,source:C.source,target:C.target,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerEnd:C.markerEnd,markerStart:C.markerStart,sourceX:Ce,sourceY:ve,targetX:je,targetY:ye,sourcePosition:ne,targetPosition:oe,elementsSelectable:T,onContextMenu:u,onMouseEnter:c,onMouseMove:h,onMouseLeave:p,onClick:d,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,rfId:i,ariaLabel:C.ariaLabel,isFocusable:fe,isReconnectable:ce,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth,disableKeyboardA11y:S})})))),b):null};nC.displayName="EdgeRenderer";var yO=j.memo(nC);const wO=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function xO({children:e}){const n=Ke(wO);return ue.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:n}},e)}function _O(e){const n=Ta(),r=j.useRef(!1);j.useEffect(()=>{!r.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),r.current=!0)},[e,n.viewportInitialized])}const bO={[Ae.Left]:Ae.Right,[Ae.Right]:Ae.Left,[Ae.Top]:Ae.Bottom,[Ae.Bottom]:Ae.Top},rC=({nodeId:e,handleType:n,style:r,type:i=Ss.Bezier,CustomComponent:o,connectionStatus:l})=>{var O,A,U;const{fromNode:u,handleId:c,toX:h,toY:p,connectionMode:d}=Ke(j.useCallback(z=>({fromNode:z.nodeInternals.get(e),handleId:z.connectionHandleId,toX:(z.connectionPosition.x-z.transform[0])/z.transform[2],toY:(z.connectionPosition.y-z.transform[1])/z.transform[2],connectionMode:z.connectionMode}),[e]),Ct),m=(O=u==null?void 0:u[yt])==null?void 0:O.handleBounds;let y=m==null?void 0:m[n];if(d===di.Loose&&(y=y||(m==null?void 0:m[n==="source"?"target":"source"])),!u||!y)return null;const w=c?y.find(z=>z.id===c):y[0],N=w?w.x+w.width/2:(u.width??0)/2,_=w?w.y+w.height/2:u.height??0,b=(((A=u.positionAbsolute)==null?void 0:A.x)??0)+N,S=(((U=u.positionAbsolute)==null?void 0:U.y)??0)+_,k=w==null?void 0:w.position,E=k?bO[k]:null;if(!k||!E)return null;if(o)return ue.createElement(o,{connectionLineType:i,connectionLineStyle:r,fromNode:u,fromHandle:w,fromX:b,fromY:S,toX:h,toY:p,fromPosition:k,toPosition:E,connectionStatus:l});let T="";const I={sourceX:b,sourceY:S,sourcePosition:k,targetX:h,targetY:p,targetPosition:E};return i===Ss.Bezier?[T]=TN(I):i===Ss.Step?[T]=_v({...I,borderRadius:0}):i===Ss.SmoothStep?[T]=_v(I):i===Ss.SimpleBezier?[T]=CN(I):T=`M${b},${S} ${h},${p}`,ue.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:r})};rC.displayName="ConnectionLine";const SO=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function kO({containerStyle:e,style:n,type:r,component:i}){const{nodeId:o,handleType:l,nodesConnectable:u,width:c,height:h,connectionStatus:p}=Ke(SO,Ct);return!(o&&l&&c&&u)?null:ue.createElement("svg",{style:e,width:c,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},ue.createElement("g",{className:Dt(["react-flow__connection",p])},ue.createElement(rC,{nodeId:o,handleType:l,style:n,type:r,CustomComponent:i,connectionStatus:p})))}function Ox(e,n){return j.useRef(null),Tt(),j.useMemo(()=>n(e),[e])}const sC=({nodeTypes:e,edgeTypes:n,onMove:r,onMoveStart:i,onMoveEnd:o,onInit:l,onNodeClick:u,onEdgeClick:c,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:d,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:_,onSelectionEnd:b,connectionLineType:S,connectionLineStyle:k,connectionLineComponent:E,connectionLineContainerStyle:T,selectionKeyCode:I,selectionOnDrag:O,selectionMode:A,multiSelectionKeyCode:U,panActivationKeyCode:z,zoomActivationKeyCode:P,deleteKeyCode:D,onlyRenderVisibleElements:V,elementsSelectable:B,selectNodesOnDrag:C,defaultViewport:q,translateExtent:L,minZoom:re,maxZoom:J,preventScrolling:H,defaultMarkerColor:Z,zoomOnScroll:M,zoomOnPinch:G,panOnScroll:Y,panOnScrollSpeed:$,panOnScrollMode:Q,zoomOnDoubleClick:ne,panOnDrag:oe,onPaneClick:fe,onPaneMouseEnter:te,onPaneMouseMove:ce,onPaneMouseLeave:Ce,onPaneScroll:ve,onPaneContextMenu:je,onEdgeContextMenu:ye,onEdgeMouseEnter:ke,onEdgeMouseMove:Ye,onEdgeMouseLeave:we,onReconnect:_e,onReconnectStart:Be,onReconnectEnd:it,reconnectRadius:pt,noDragClassName:Ze,noWheelClassName:Fe,noPanClassName:Je,elevateEdgesOnSelect:Xe,disableKeyboardA11y:Mt,nodeOrigin:ut,nodeExtent:Qe,rfId:Ot})=>{const Ft=Ox(e,ZM),et=Ox(n,iO);return _O(l),ue.createElement(XM,{onPaneClick:fe,onPaneMouseEnter:te,onPaneMouseMove:ce,onPaneMouseLeave:Ce,onPaneContextMenu:je,onPaneScroll:ve,deleteKeyCode:D,selectionKeyCode:I,selectionOnDrag:O,selectionMode:A,onSelectionStart:_,onSelectionEnd:b,multiSelectionKeyCode:U,panActivationKeyCode:z,zoomActivationKeyCode:P,elementsSelectable:B,onMove:r,onMoveStart:i,onMoveEnd:o,zoomOnScroll:M,zoomOnPinch:G,zoomOnDoubleClick:ne,panOnScroll:Y,panOnScrollSpeed:$,panOnScrollMode:Q,panOnDrag:oe,defaultViewport:q,translateExtent:L,minZoom:re,maxZoom:J,onSelectionContextMenu:N,preventScrolling:H,noDragClassName:Ze,noWheelClassName:Fe,noPanClassName:Je,disableKeyboardA11y:Mt},ue.createElement(xO,null,ue.createElement(yO,{edgeTypes:et,onEdgeClick:c,onEdgeDoubleClick:p,onlyRenderVisibleElements:V,onEdgeContextMenu:ye,onEdgeMouseEnter:ke,onEdgeMouseMove:Ye,onEdgeMouseLeave:we,onReconnect:_e,onReconnectStart:Be,onReconnectEnd:it,reconnectRadius:pt,defaultMarkerColor:Z,noPanClassName:Je,elevateEdgesOnSelect:!!Xe,disableKeyboardA11y:Mt,rfId:Ot},ue.createElement(kO,{style:k,type:S,component:E,containerStyle:T})),ue.createElement("div",{className:"react-flow__edgelabel-renderer"}),ue.createElement(tO,{nodeTypes:Ft,onNodeClick:u,onNodeDoubleClick:h,onNodeMouseEnter:d,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:C,onlyRenderVisibleElements:V,noPanClassName:Je,noDragClassName:Ze,disableKeyboardA11y:Mt,nodeOrigin:ut,nodeExtent:Qe,rfId:Ot})))};sC.displayName="GraphView";var EO=j.memo(sC);const Nv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],xs={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:Nv,nodeExtent:Nv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:di.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:ZI,isValidConnection:void 0},NO=()=>fj((e,n)=>({...xs,setNodes:r=>{const{nodeInternals:i,nodeOrigin:o,elevateNodesOnSelect:l}=n();e({nodeInternals:qd(r,i,o,l)})},getNodes:()=>Array.from(n().nodeInternals.values()),setEdges:r=>{const{defaultEdgeOptions:i={}}=n();e({edges:r.map(o=>({...i,...o}))})},setDefaultNodesAndEdges:(r,i)=>{const o=typeof r<"u",l=typeof i<"u",u=o?qd(r,new Map,n().nodeOrigin,n().elevateNodesOnSelect):new Map;e({nodeInternals:u,edges:l?i:[],hasDefaultNodes:o,hasDefaultEdges:l})},updateNodeDimensions:r=>{const{onNodesChange:i,nodeInternals:o,fitViewOnInit:l,fitViewOnInitDone:u,fitViewOnInitOptions:c,domNode:h,nodeOrigin:p}=n(),d=h==null?void 0:h.querySelector(".react-flow__viewport");if(!d)return;const m=window.getComputedStyle(d),{m22:y}=new window.DOMMatrixReadOnly(m.transform),w=r.reduce((_,b)=>{const S=o.get(b.id);if(S!=null&&S.hidden)o.set(S.id,{...S,[yt]:{...S[yt],handleBounds:void 0}});else if(S){const k=Wv(b.nodeElement);!!(k.width&&k.height&&(S.width!==k.width||S.height!==k.height||b.forceUpdate))&&(o.set(S.id,{...S,[yt]:{...S[yt],handleBounds:{source:Cx(".source",b.nodeElement,y,p),target:Cx(".target",b.nodeElement,y,p)}},...k}),_.push({id:S.id,type:"dimensions",dimensions:k}))}return _},[]);VN(o,p);const N=u||l&&!u&&GN(n,{initial:!0,...c});e({nodeInternals:new Map(o),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(i==null||i(w))},updateNodePositions:(r,i=!0,o=!1)=>{const{triggerNodeChanges:l}=n(),u=r.map(c=>{const h={id:c.id,type:"position",dragging:o};return i&&(h.positionAbsolute=c.positionAbsolute,h.position=c.position),h});l(u)},triggerNodeChanges:r=>{const{onNodesChange:i,nodeInternals:o,hasDefaultNodes:l,nodeOrigin:u,getNodes:c,elevateNodesOnSelect:h}=n();if(r!=null&&r.length){if(l){const p=zM(r,c()),d=qd(p,o,u,h);e({nodeInternals:d})}i==null||i(r)}},addSelectedNodes:r=>{const{multiSelectionActive:i,edges:o,getNodes:l}=n();let u,c=null;i?u=r.map(h=>bs(h,!0)):(u=eo(l(),r),c=eo(o,[])),Zl({changedNodes:u,changedEdges:c,get:n,set:e})},addSelectedEdges:r=>{const{multiSelectionActive:i,edges:o,getNodes:l}=n();let u,c=null;i?u=r.map(h=>bs(h,!0)):(u=eo(o,r),c=eo(l(),[])),Zl({changedNodes:c,changedEdges:u,get:n,set:e})},unselectNodesAndEdges:({nodes:r,edges:i}={})=>{const{edges:o,getNodes:l}=n(),u=r||l(),c=i||o,h=u.map(d=>(d.selected=!1,bs(d.id,!1))),p=c.map(d=>bs(d.id,!1));Zl({changedNodes:h,changedEdges:p,get:n,set:e})},setMinZoom:r=>{const{d3Zoom:i,maxZoom:o}=n();i==null||i.scaleExtent([r,o]),e({minZoom:r})},setMaxZoom:r=>{const{d3Zoom:i,minZoom:o}=n();i==null||i.scaleExtent([o,r]),e({maxZoom:r})},setTranslateExtent:r=>{var i;(i=n().d3Zoom)==null||i.translateExtent(r),e({translateExtent:r})},resetSelectedElements:()=>{const{edges:r,getNodes:i}=n(),l=i().filter(c=>c.selected).map(c=>bs(c.id,!1)),u=r.filter(c=>c.selected).map(c=>bs(c.id,!1));Zl({changedNodes:l,changedEdges:u,get:n,set:e})},setNodeExtent:r=>{const{nodeInternals:i}=n();i.forEach(o=>{o.positionAbsolute=Vv(o.position,r)}),e({nodeExtent:r,nodeInternals:new Map(i)})},panBy:r=>{const{transform:i,width:o,height:l,d3Zoom:u,d3Selection:c,translateExtent:h}=n();if(!u||!c||!r.x&&!r.y)return!1;const p=Fr.translate(i[0]+r.x,i[1]+r.y).scale(i[2]),d=[[0,0],[o,l]],m=u==null?void 0:u.constrain()(p,d,h);return u.transform(c,m),i[0]!==m.x||i[1]!==m.y||i[2]!==m.k},cancelConnection:()=>e({connectionNodeId:xs.connectionNodeId,connectionHandleId:xs.connectionHandleId,connectionHandleType:xs.connectionHandleType,connectionStatus:xs.connectionStatus,connectionStartHandle:xs.connectionStartHandle,connectionEndHandle:xs.connectionEndHandle}),reset:()=>e({...xs})}),Object.is),ey=({children:e})=>{const n=j.useRef(null);return n.current||(n.current=NO()),ue.createElement(WI,{value:n.current},e)};ey.displayName="ReactFlowProvider";const iC=({children:e})=>j.useContext(Iu)?ue.createElement(ue.Fragment,null,e):ue.createElement(ey,null,e);iC.displayName="ReactFlowWrapper";const CO={input:DN,default:kv,output:zN,group:Zv},TO={default:bu,straight:Kv,step:Yv,smoothstep:Mu,simplebezier:Gv},RO=[0,0],jO=[15,15],AO={x:0,y:0,zoom:1},IO={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},oC=j.forwardRef(({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,className:o,nodeTypes:l=CO,edgeTypes:u=TO,onNodeClick:c,onEdgeClick:h,onInit:p,onMove:d,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:b,onClickConnectEnd:S,onNodeMouseEnter:k,onNodeMouseMove:E,onNodeMouseLeave:T,onNodeContextMenu:I,onNodeDoubleClick:O,onNodeDragStart:A,onNodeDrag:U,onNodeDragStop:z,onNodesDelete:P,onEdgesDelete:D,onSelectionChange:V,onSelectionDragStart:B,onSelectionDrag:C,onSelectionDragStop:q,onSelectionContextMenu:L,onSelectionStart:re,onSelectionEnd:J,connectionMode:H=di.Strict,connectionLineType:Z=Ss.Bezier,connectionLineStyle:M,connectionLineComponent:G,connectionLineContainerStyle:Y,deleteKeyCode:$="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:ne=!1,selectionMode:oe=xa.Full,panActivationKeyCode:fe="Space",multiSelectionKeyCode:te=xu()?"Meta":"Control",zoomActivationKeyCode:ce=xu()?"Meta":"Control",snapToGrid:Ce=!1,snapGrid:ve=jO,onlyRenderVisibleElements:je=!1,selectNodesOnDrag:ye=!0,nodesDraggable:ke,nodesConnectable:Ye,nodesFocusable:we,nodeOrigin:_e=RO,edgesFocusable:Be,edgesUpdatable:it,elementsSelectable:pt,defaultViewport:Ze=AO,minZoom:Fe=.5,maxZoom:Je=2,translateExtent:Xe=Nv,preventScrolling:Mt=!0,nodeExtent:ut,defaultMarkerColor:Qe="#b1b1b7",zoomOnScroll:Ot=!0,zoomOnPinch:Ft=!0,panOnScroll:et=!1,panOnScrollSpeed:St=.5,panOnScrollMode:mt=ai.Free,zoomOnDoubleClick:wt=!0,panOnDrag:hn=!0,onPaneClick:Yt,onPaneMouseEnter:Pt,onPaneMouseMove:Sn,onPaneMouseLeave:gr,onPaneScroll:kn,onPaneContextMenu:zt,children:Fn,onEdgeContextMenu:pn,onEdgeDoubleClick:vr,onEdgeMouseEnter:Wr,onEdgeMouseMove:gi,onEdgeMouseLeave:Vr,onEdgeUpdate:ct,onEdgeUpdateStart:vi,onEdgeUpdateEnd:mn,onReconnect:Ts,onReconnectStart:yr,onReconnectEnd:zn,reconnectRadius:En=10,edgeUpdaterRadius:Gr=10,onNodesChange:Yr,onEdgesChange:Kr,noDragClassName:yi="nodrag",noWheelClassName:ir="nowheel",noPanClassName:Rs="nopan",fitView:Nn=!1,fitViewOptions:wr,connectOnClick:js=!0,attributionPosition:As,proOptions:Rt,defaultEdgeOptions:xr,elevateNodesOnSelect:_r=!0,elevateEdgesOnSelect:Kt=!1,disableKeyboardA11y:Xr=!1,autoPanOnConnect:wi=!0,autoPanOnNodeDrag:nt=!0,connectionRadius:br=20,isValidConnection:Qr,onError:Is,style:Zr,id:Jr,nodeDragThreshold:Ms,...or},kt)=>{const Os=Jr||"1";return ue.createElement("div",{...or,style:{...Zr,...IO},ref:kt,className:Dt(["react-flow",o]),"data-testid":"rf__wrapper",id:Jr},ue.createElement(iC,null,ue.createElement(EO,{onInit:p,onMove:d,onMoveStart:m,onMoveEnd:y,onNodeClick:c,onEdgeClick:h,onNodeMouseEnter:k,onNodeMouseMove:E,onNodeMouseLeave:T,onNodeContextMenu:I,onNodeDoubleClick:O,nodeTypes:l,edgeTypes:u,connectionLineType:Z,connectionLineStyle:M,connectionLineComponent:G,connectionLineContainerStyle:Y,selectionKeyCode:Q,selectionOnDrag:ne,selectionMode:oe,deleteKeyCode:$,multiSelectionKeyCode:te,panActivationKeyCode:fe,zoomActivationKeyCode:ce,onlyRenderVisibleElements:je,selectNodesOnDrag:ye,defaultViewport:Ze,translateExtent:Xe,minZoom:Fe,maxZoom:Je,preventScrolling:Mt,zoomOnScroll:Ot,zoomOnPinch:Ft,zoomOnDoubleClick:wt,panOnScroll:et,panOnScrollSpeed:St,panOnScrollMode:mt,panOnDrag:hn,onPaneClick:Yt,onPaneMouseEnter:Pt,onPaneMouseMove:Sn,onPaneMouseLeave:gr,onPaneScroll:kn,onPaneContextMenu:zt,onSelectionContextMenu:L,onSelectionStart:re,onSelectionEnd:J,onEdgeContextMenu:pn,onEdgeDoubleClick:vr,onEdgeMouseEnter:Wr,onEdgeMouseMove:gi,onEdgeMouseLeave:Vr,onReconnect:Ts??ct,onReconnectStart:yr??vi,onReconnectEnd:zn??mn,reconnectRadius:En??Gr,defaultMarkerColor:Qe,noDragClassName:yi,noWheelClassName:ir,noPanClassName:Rs,elevateEdgesOnSelect:Kt,rfId:Os,disableKeyboardA11y:Xr,nodeOrigin:_e,nodeExtent:ut}),ue.createElement(_M,{nodes:e,edges:n,defaultNodes:r,defaultEdges:i,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:b,onClickConnectEnd:S,nodesDraggable:ke,nodesConnectable:Ye,nodesFocusable:we,edgesFocusable:Be,edgesUpdatable:it,elementsSelectable:pt,elevateNodesOnSelect:_r,minZoom:Fe,maxZoom:Je,nodeExtent:ut,onNodesChange:Yr,onEdgesChange:Kr,snapToGrid:Ce,snapGrid:ve,connectionMode:H,translateExtent:Xe,connectOnClick:js,defaultEdgeOptions:xr,fitView:Nn,fitViewOptions:wr,onNodesDelete:P,onEdgesDelete:D,onNodeDragStart:A,onNodeDrag:U,onNodeDragStop:z,onSelectionDrag:C,onSelectionDragStart:B,onSelectionDragStop:q,noPanClassName:Rs,nodeOrigin:_e,rfId:Os,autoPanOnConnect:wi,autoPanOnNodeDrag:nt,onError:Is,connectionRadius:br,isValidConnection:Qr,nodeDragThreshold:Ms}),ue.createElement(wM,{onSelectionChange:V}),Fn,ue.createElement(GI,{proOptions:Rt,position:As}),ue.createElement(NM,{rfId:Os,disableKeyboardA11y:Xr})))});oC.displayName="ReactFlow";const MO=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function aC(){return Ke(MO,Ct)}const lC=({id:e,x:n,y:r,width:i,height:o,style:l,color:u,strokeColor:c,strokeWidth:h,className:p,borderRadius:d,shapeRendering:m,onClick:y,selected:w})=>{const{background:N,backgroundColor:_}=l||{},b=u||N||_;return ue.createElement("rect",{className:Dt(["react-flow__minimap-node",{selected:w},p]),x:n,y:r,rx:d,ry:d,width:i,height:o,fill:b,stroke:c,strokeWidth:h,shapeRendering:m,onClick:y?S=>y(S,e):void 0})};lC.displayName="MiniMapNode";var OO=j.memo(lC);const PO=e=>e.nodeOrigin,LO=e=>e.getNodes().filter(n=>!n.hidden&&n.width&&n.height),Bd=e=>e instanceof Function?e:()=>e;function $O({nodeStrokeColor:e="transparent",nodeColor:n="#e2e2e2",nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:o=2,nodeComponent:l=OO,onClick:u}){const c=Ke(LO,Ct),h=Ke(PO),p=Bd(n),d=Bd(e),m=Bd(r),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ue.createElement(ue.Fragment,null,c.map(w=>{const{x:N,y:_}=ui(w,h).positionAbsolute;return ue.createElement(l,{key:w.id,x:N,y:_,width:w.width,height:w.height,style:w.style,selected:w.selected,className:m(w),color:p(w),borderRadius:i,strokeColor:d(w),strokeWidth:o,shapeRendering:y,onClick:u,id:w.id})}))}var qO=j.memo($O);const DO=200,FO=150,zO=e=>{const n=e.getNodes(),r={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:r,boundingRect:n.length>0?XI(Ou(n,e.nodeOrigin),r):r,rfId:e.rfId}},BO="react-flow__minimap-desc";function uC({style:e,className:n,nodeStrokeColor:r="transparent",nodeColor:i="#e2e2e2",nodeClassName:o="",nodeBorderRadius:l=5,nodeStrokeWidth:u=2,nodeComponent:c,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:d=1,position:m="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:_=!1,ariaLabel:b="React Flow mini map",inversePan:S=!1,zoomStep:k=10,offsetScale:E=5}){const T=Tt(),I=j.useRef(null),{boundingRect:O,viewBB:A,rfId:U}=Ke(zO,Ct),z=(e==null?void 0:e.width)??DO,P=(e==null?void 0:e.height)??FO,D=O.width/z,V=O.height/P,B=Math.max(D,V),C=B*z,q=B*P,L=E*B,re=O.x-(C-O.width)/2-L,J=O.y-(q-O.height)/2-L,H=C+L*2,Z=q+L*2,M=`${BO}-${U}`,G=j.useRef(0);G.current=B,j.useEffect(()=>{if(I.current){const Q=Ln(I.current),ne=te=>{const{transform:ce,d3Selection:Ce,d3Zoom:ve}=T.getState();if(te.sourceEvent.type!=="wheel"||!Ce||!ve)return;const je=-te.sourceEvent.deltaY*(te.sourceEvent.deltaMode===1?.05:te.sourceEvent.deltaMode?1:.002)*k,ye=ce[2]*Math.pow(2,je);ve.scaleTo(Ce,ye)},oe=te=>{const{transform:ce,d3Selection:Ce,d3Zoom:ve,translateExtent:je,width:ye,height:ke}=T.getState();if(te.sourceEvent.type!=="mousemove"||!Ce||!ve)return;const Ye=G.current*Math.max(1,ce[2])*(S?-1:1),we={x:ce[0]-te.sourceEvent.movementX*Ye,y:ce[1]-te.sourceEvent.movementY*Ye},_e=[[0,0],[ye,ke]],Be=Fr.translate(we.x,we.y).scale(ce[2]),it=ve.constrain()(Be,_e,je);ve.transform(Ce,it)},fe=vN().on("zoom",N?oe:null).on("zoom.wheel",_?ne:null);return Q.call(fe),()=>{Q.on("zoom",null)}}},[N,_,S,k]);const Y=y?Q=>{const ne=Jn(Q);y(Q,{x:ne[0],y:ne[1]})}:void 0,$=w?(Q,ne)=>{const oe=T.getState().nodeInternals.get(ne);w(Q,oe)}:void 0;return ue.createElement(Hv,{position:m,style:e,className:Dt(["react-flow__minimap",n]),"data-testid":"rf__minimap"},ue.createElement("svg",{width:z,height:P,viewBox:`${re} ${J} ${H} ${Z}`,role:"img","aria-labelledby":M,ref:I,onClick:Y},b&&ue.createElement("title",{id:M},b),ue.createElement(qO,{onClick:$,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:l,nodeClassName:o,nodeStrokeWidth:u,nodeComponent:c}),ue.createElement("path",{className:"react-flow__minimap-mask",d:`M${re-L},${J-L}h${H+L*2}v${Z+L*2}h${-H-L*2}z
57
+ M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:d,pointerEvents:"none"})))}uC.displayName="MiniMap";var UO=j.memo(uC);function HO(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ue.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function WO(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ue.createElement("path",{d:"M0 0h32v4.2H0z"}))}function VO(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ue.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 GO(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.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 YO(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.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 to=({children:e,className:n,...r})=>ue.createElement("button",{type:"button",className:Dt(["react-flow__controls-button",n]),...r},e);to.displayName="ControlButton";const KO=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),cC=({style:e,showZoom:n=!0,showFitView:r=!0,showInteractive:i=!0,fitViewOptions:o,onZoomIn:l,onZoomOut:u,onFitView:c,onInteractiveChange:h,className:p,children:d,position:m="bottom-left"})=>{const y=Tt(),[w,N]=j.useState(!1),{isInteractive:_,minZoomReached:b,maxZoomReached:S}=Ke(KO,Ct),{zoomIn:k,zoomOut:E,fitView:T}=Ta();if(j.useEffect(()=>{N(!0)},[]),!w)return null;const I=()=>{k(),l==null||l()},O=()=>{E(),u==null||u()},A=()=>{T(o),c==null||c()},U=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),h==null||h(!_)};return ue.createElement(Hv,{className:Dt(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},n&&ue.createElement(ue.Fragment,null,ue.createElement(to,{onClick:I,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:S},ue.createElement(HO,null)),ue.createElement(to,{onClick:O,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:b},ue.createElement(WO,null))),r&&ue.createElement(to,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},ue.createElement(VO,null)),i&&ue.createElement(to,{className:"react-flow__controls-interactive",onClick:U,title:"toggle interactivity","aria-label":"toggle interactivity"},_?ue.createElement(YO,null):ue.createElement(GO,null)),d)};cC.displayName="Controls";var XO=j.memo(cC),tr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(tr||(tr={}));function QO({color:e,dimensions:n,lineWidth:r}){return ue.createElement("path",{stroke:e,strokeWidth:r,d:`M${n[0]/2} 0 V${n[1]} M0 ${n[1]/2} H${n[0]}`})}function ZO({color:e,radius:n}){return ue.createElement("circle",{cx:n,cy:n,r:n,fill:e})}const JO={[tr.Dots]:"#91919a",[tr.Lines]:"#eee",[tr.Cross]:"#e2e2e2"},eP={[tr.Dots]:1,[tr.Lines]:1,[tr.Cross]:6},tP=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function dC({id:e,variant:n=tr.Dots,gap:r=20,size:i,lineWidth:o=1,offset:l=2,color:u,style:c,className:h}){const p=j.useRef(null),{transform:d,patternId:m}=Ke(tP,Ct),y=u||JO[n],w=i||eP[n],N=n===tr.Dots,_=n===tr.Cross,b=Array.isArray(r)?r:[r,r],S=[b[0]*d[2]||1,b[1]*d[2]||1],k=w*d[2],E=_?[k,k]:S,T=N?[k/l,k/l]:[E[0]/l,E[1]/l];return ue.createElement("svg",{className:Dt(["react-flow__background",h]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},ue.createElement("pattern",{id:m+e,x:d[0]%S[0],y:d[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`},N?ue.createElement(ZO,{color:y,radius:k/l}):ue.createElement(QO,{dimensions:E,color:y,lineWidth:o})),ue.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}dC.displayName="Background";var nP=j.memo(dC);function fC(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function hC(e){const n=e.cache_creation,r=n&&typeof n=="object"?n:e,i=r.ephemeral_1h_input_tokens,o=r.ephemeral_5m_input_tokens;return typeof i!="number"&&typeof o!="number"?{}:{cacheCreate1hTokens:Number(i??0),cacheCreate5mTokens:Number(o??0)}}function pC(e,n=0){if(!e||typeof e!="object"||n>6)return null;const r=e;if(typeof r.input_tokens=="number"||typeof r.output_tokens=="number"||typeof r.cache_read_input_tokens=="number"||typeof r.cache_creation_input_tokens=="number")return{inputTokens:Number(r.input_tokens??0),outputTokens:Number(r.output_tokens??0),cacheReadTokens:Number(r.cache_read_input_tokens??0),cacheCreateTokens:Number(r.cache_creation_input_tokens??0),...hC(r)};for(const i of Object.values(r)){const o=pC(i,n+1);if(o)return o}return null}function rP(e,n){e.inputTokens+=n.inputTokens,e.outputTokens+=n.outputTokens,e.cacheReadTokens+=n.cacheReadTokens,e.cacheCreateTokens+=n.cacheCreateTokens,(n.cacheCreate1hTokens!==void 0||n.cacheCreate5mTokens!==void 0)&&(e.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(n.cacheCreate1hTokens??0),e.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(n.cacheCreate5mTokens??0))}const sP=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function mC(e,n=0){if(!e||typeof e!="object"||n>6)return null;const r=e;if(typeof r.model=="string"&&sP.test(r.model))return r.model;for(const i of Object.values(r)){const o=mC(i,n+1);if(o)return o}return null}function Cv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0}}function Es(e){if(!e)return;const n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n[n.length-1]}function Px(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Ra(e,n){return`${e}::${n}`}function Su(e){return e.agent_type??e.subagent_type??"subagent"}function ha(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function no(e,n,r,i){const o=n;let l=e.agents.get(o);return l||(l={id:o,sessionId:n,label:"session",kind:"root",state:"active",startedAt:r,lastEventAt:r,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:i,usage:fC()},e.agents.set(o,l),l)}function gC(e,n,r,i){const o=Ra(n,r),l=e.agents.get(o);if(!l)return null;!l.cwd&&i.cwd&&(l.cwd=i.cwd,l.cwdBasename=Es(i.cwd));const u=Su(i);return u&&(l.label==="subagent"||!l.label)&&(l.label=u),l}function Lx(e,n,r){const i=n.session_id??"unknown",o=ha(n);if(o){const h=gC(e,i,o,n);if(h)return h}const l=e.activeSubagentStack.get(i),u=l&&l.length>0?l[l.length-1]:null;if(u){const h=e.agents.get(Ra(i,u));if(h)return!h.cwd&&n.cwd&&(h.cwd=n.cwd,h.cwdBasename=Es(n.cwd)),h}const c=no(e,i,r,!1);return c.synthetic&&(c.synthetic=!1,c.startedAt=r),!c.cwd&&n.cwd&&(c.cwd=n.cwd,c.cwdBasename=Es(n.cwd)),c.label==="session"&&n.cwd&&(c.label=Es(n.cwd)??"session"),c}function iP(e,n,r,i,o){const l=Ra(n,r),u=no(e,n,o,!0);let c=e.agents.get(l);if(c){!c.cwd&&i.cwd&&(c.cwd=i.cwd,c.cwdBasename=Es(i.cwd));const h=Su(i);return h&&(c.label==="subagent"||!c.label)&&(c.label=h),c}return c={id:l,sessionId:n,label:Su(i),kind:"subagent",parentId:u.id,state:"active",startedAt:o,tools:[],prompts:[],cwd:i.cwd,cwdBasename:Es(i.cwd),toolCount:0,childCount:0,usage:fC()},e.agents.set(l,c),u.childCount+=1,c}function oP(e,n,r){const i=e.activeSubagentStack.get(n)??[];i.includes(r)||(i.push(r),e.activeSubagentStack.set(n,i))}function aP(e,n,r){const i=e.activeSubagentStack.get(n);if(i){for(let o=i.length-1;o>=0;o--)if(i[o]===r){i.splice(o,1);break}i.length===0&&e.activeSubagentStack.delete(n)}}function eu(e,n=80){if(e==null)return"";if(typeof e=="string")return e.length>n?e.slice(0,n-1)+"…":e;try{const r=JSON.stringify(e);return r.length>n?r.slice(0,n-1)+"…":r}catch{return String(e)}}const $x=200,lP=25;function uP(e,n){const r=n.tools;if(r.length>$x){const i=r.splice(0,r.length-$x);for(const o of i)e.toolIndex.delete(o.id),e.toolOwner.delete(o.id)}for(let i=r.length-lP-1;i>=0;i--){const o=r[i];if(o.trimmed)break;o.input=void 0,o.response=void 0,o.trimmed=!0}}function cP(e,n,r){const i=e.toolIndex.get(r);if(i)return i;for(let o=n.tools.length-1;o>=0;o--)if(n.tools[o].id===r)return n.tools[o];return null}const qx=2e3;function dP(e,n,r){for(let i=e.prompts.length-1;i>=0;i--){const o=e.prompts[i];if(o.at<n-qx)return!1;if(o.text===r&&o.at<=n+qx)return!0}return!1}function fP(e,n,r,i){if(e.agents.size<=r)return!1;const o=[];for(const[u,c]of e.agents)c.state==="done"&&c.endedAt!=null&&n-c.endedAt>i&&o.push({id:u,endedAt:c.endedAt});if(o.length===0)return!1;o.sort((u,c)=>u.endedAt-c.endedAt);let l=0;for(const u of o){if(e.agents.size<=r)break;e.agents.delete(u.id),l++}return l>0}function hP(e,n,r,i){const o=new Map;for(const[p,d]of e.agents){let m=o.get(d.sessionId);m||(m={ids:[],endedAt:0,live:!1},o.set(d.sessionId,m)),m.ids.push(p),d.state==="done"&&d.endedAt!=null?m.endedAt=Math.max(m.endedAt,d.endedAt):m.live=!0}const l=[...o.values()].filter(p=>!p.live&&p.endedAt>0&&n-p.endedAt>i).sort((p,d)=>p.endedAt-d.endedAt);let c=[...o.values()].filter(p=>!p.live).length-r;if(c<=0)return!1;let h=!1;for(const p of l){if(c<=0)break;for(const d of p.ids)e.agents.delete(d);c--,h=!0}return h}function pP(e,n,r){let i=!1;for(const o of e.agents.values())if(o.provider!=="codex")for(const l of o.tools)l.endedAt==null&&n-l.startedAt>r&&(l.endedAt=l.startedAt+r,l.ok=!1,l.errorPreview="stale (no PostToolUse received)",e.toolIndex.delete(l.id),e.toolOwner.delete(l.id),i=!0);return i}const mP=90*6e4;function gP(e,n,r){let i=!1;for(const o of e.agents.values()){if(o.kind!=="root")continue;const l=o.lastEventAt??o.startedAt;if(!(n-l<=r)){o.waiting&&(o.waiting=null,i=!0),o.state==="active"&&(o.state="done",o.endedAt=l,o.reaped=!0,i=!0);for(const u of e.agents.values())u.sessionId!==o.sessionId||u.kind==="root"||u.state!=="active"||(u.state="done",u.endedAt=l,i=!0)}}return i}function vP(e){return e==="permission_prompt"?"permission":e==="idle_prompt"?"idle":null}const yP=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved"]);function wP(e,n){let r=null;for(const i of e.toolIndex.values()){const o=i.agentId?e.agents.get(i.agentId):void 0;!o||o.sessionId!==n||(!r||i.startedAt>r.startedAt)&&(r=i)}return r==null?void 0:r.explicitSubagentId}function xP(e,n,r,i,o){const l=r==="permission"?wP(e,n):void 0;return l?{kind:r,message:i,since:o,subagentId:l}:{kind:r,message:i,since:o}}function _P(e,n,r){if(e.kind!=="permission")return!0;const i=ha(n);return i==null?!0:e.subagentId!=null&&Ra(r,i)===e.subagentId}function Dx(e,n){const r=n.epoch??null;if(r!==null&&r!==e.seqEpoch)e.seqEpoch=r,e.lastSeq=0;else if(n.seq<=e.lastSeq)return e;const i=n.payload??{},o=n.receivedAt,l=i.hook_event_name??"Unknown";if(l==="__clear")return{...Cv(),lastSeq:n.seq,seqEpoch:e.seqEpoch};e.totalEvents+=1,e.lastSeq=n.seq;const u=i.session_id??"unknown";if(!yP.has(l)){const d=e.agents.get(u);d!=null&&d.waiting&&_P(d.waiting,i,u)&&(d.waiting=null)}const c=e.agents.get(u);if(c&&o>(c.lastEventAt??0)&&(c.lastEventAt=o,c.reaped&&(c.reaped=!1,c.state="active",c.endedAt=void 0)),typeof i.model_context_window=="number"&&i.model_context_window>0){const d=e.agents.get(u);d&&(d.contextWindow=i.model_context_window)}if(typeof i.approval_policy=="string"&&i.approval_policy){const d=e.agents.get(u);d&&(d.approvalPolicy=i.approval_policy)}if(typeof i.context_tokens=="number"&&i.context_tokens>=0){const d=e.agents.get(u);d&&(d.context={...d.context??Px(),currentContextTokens:i.context_tokens})}if(l==="ModelObserved"){const d=typeof i.model=="string"?i.model:null;if(d){const y=e.agents.get(u);y&&(y.model=d)}const m=i.subagentModels;if(m&&typeof m=="object")for(const[y,w]of Object.entries(m)){if(typeof w!="string")continue;const N=`${u}::${y}`,_=e.agents.get(N);_&&(_.model=w)}return e}if(l==="ContextObserved"){const d=i.context??null;if(d){const m=e.agents.get(u);if(m){const y=m.context??Px(),w=(_,b)=>typeof d[_]=="number"?d[_]:b,N=Array.isArray(d.memoryFiles)?d.memoryFiles:Array.isArray(d.claudeMdFiles)?d.claudeMdFiles:null;m.context={msgsUser:w("msgsUser",y.msgsUser),msgsAssistant:w("msgsAssistant",y.msgsAssistant),toolUses:w("toolUses",y.toolUses),toolResults:w("toolResults",y.toolResults),systemReminders:w("systemReminders",y.systemReminders),currentContextTokens:w("currentContextTokens",y.currentContextTokens),memoryFiles:N??y.memoryFiles}}}return e}if(l==="UsageObserved"){const d=i.usage??null;if(d){const m=e.agents.get(u);if(m){m.usage.inputTokens=Number(d.input_tokens??0),m.usage.outputTokens=Number(d.output_tokens??0),m.usage.cacheReadTokens=Number(d.cache_read_input_tokens??d.cached_input_tokens??0),m.usage.cacheCreateTokens=Number(d.cache_creation_input_tokens??d.cache_write_input_tokens??0);const y=hC(d);m.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,m.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof d.reasoning_output_tokens=="number"&&(m.usage.reasoningOutputTokens=Number(d.reasoning_output_tokens))}}return e}const h=Lx(e,i,o);h.provider||(h.provider=i.provider==="codex"?"codex":"claude");const p=mC(i);switch(p&&(h.model=p),l){case"SessionStart":{const d=no(e,u,o,!1);d.synthetic=!1,d.state="active",d.startedAt=d.startedAt||o,!d.cwd&&i.cwd&&(d.cwd=i.cwd,d.cwdBasename=Es(i.cwd)),d.label==="session"&&i.cwd&&(d.label=Es(i.cwd)??"session");break}case"UserPromptSubmit":{for(const w of e.agents.values())w.sessionId===u&&w.kind==="subagent"&&w.state==="done"&&w.exitAt==null&&w.endedAt!=null&&w.endedAt<o&&(w.exitAt=o);const d=no(e,u,o,!1);d.state="active",d.endedAt=void 0,d.exitAt=void 0;const m=Lx(e,i,o);m.state="active",m.exitAt=void 0,m.endedAt=void 0;const y=(typeof i.prompt=="string"?i.prompt:typeof i.message=="string"?i.message:"")??"";y&&!dP(m,o,y)&&(m.prompts.push({at:o,text:y}),m.firstPrompt||(m.firstPrompt=eu(y,120)));break}case"PreToolUse":{const d=i.tool_use_id?cP(e,h,i.tool_use_id):null;if(d){i.tool_name&&d.name==="?"&&(d.name=i.tool_name),d.endedAt==null&&!d.trimmed&&i.tool_input!==void 0&&(d.input=i.tool_input,d.inputPreview=eu(i.tool_input));break}const m=i.tool_use_id??`${h.id}:${h.toolCount}`,y=ha(i),w={id:m,name:i.tool_name??"?",input:i.tool_input,inputPreview:eu(i.tool_input),agentId:h.id,explicitSubagentId:y?Ra(u,y):void 0,startedAt:o};h.tools.push(w),h.toolCount+=1,h.state="active",e.toolIndex.set(m,w),e.toolOwner.set(m,h.id),uP(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const d=i.tool_use_id;if(!d)break;let m=e.toolIndex.get(d),y=!1;if(!m)for(const _ of e.agents.values()){const b=_.tools.find(S=>S.id===d);if(b){m=b,y=!0;break}}if(!m)break;m.endedAt=o,m.ok=l==="PostToolUse",m.trimmed||(m.response=i.tool_response),l==="PostToolUseFailure"?m.errorPreview=eu(i.tool_response):y&&(m.errorPreview=void 0);const w=pC(i.tool_response);w&&(m.usage=w),e.toolIndex.delete(d);const N=e.toolOwner.get(d)??m.agentId;if(e.toolOwner.delete(d),N&&w){const _=e.agents.get(N);_&&rP(_.usage,w)}break}case"SubagentStart":{const d=ha(i);if(!d)break;const m=iP(e,u,d,i,o);m.state="active",m.startedAt=m.startedAt||o,m.exitAt=void 0,m.endedAt=void 0;const y=Su(i);y&&(m.label=y),oP(e,u,d);break}case"SubagentStop":{const d=ha(i);if(!d)break;const m=gC(e,u,d,i);if(!m)break;m.state="done",m.endedAt=o,aP(e,u,d);break}case"Stop":case"SessionEnd":{const d=no(e,u,o,!1);d.state="done",d.endedAt=o,e.activeSubagentStack.delete(u);break}case"Notification":{const d=vP(i.notification_type);if(!d)break;const m=no(e,u,o,!1),y=typeof i.message=="string"?i.message:"",w=m.waiting;m.waiting=w&&w.kind===d&&w.message===y?{...w,since:Math.min(w.since,o)}:xP(e,u,d,y,o);break}}return e}function ty(e){let n=5381;for(let r=0;r<e.length;r++)n=(n<<5)+n^e.charCodeAt(r);return Math.abs(n)%360}const bP=Date.UTC(2026,8,1);function SP(e){return e<bP?{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}}const kP=[{match:/^claude[-_](fable|mythos)[-_]5\b/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_]opus[-_]5\b/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]sonnet[-_]5\b/i,rates:SP},{match:/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]opus[-_]4(?:[-_.]1)?\b/i,rates:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}},{match:/^claude[-_]sonnet[-_]4[-_.](?:5|6)\b/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]sonnet[-_]4\b/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]haiku[-_]4[-_.]5\b/i,rates:{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}},{match:/^claude[-_]haiku[-_]3[-_.]5\b/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\b/i,rates:{input:15,output:60,cacheRead:7.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/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 EP(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function fo(e,n=Date.now()){if(!e)return null;for(const r of kP)if(r.match.test(e))return typeof r.rates=="function"?r.rates(n):r.rates;return null}function vC(e,n){const r=Math.max(0,e.cacheCreate1hTokens??0),i=Math.max(0,e.cacheCreate5mTokens??0),o=Math.max(0,e.cacheCreateTokens-r-i),l=i+o,u=n.cacheWrite1h??n.cacheWrite;return{tokens5m:l,tokens1h:r,usd5m:l*n.cacheWrite/1e6,usd1h:r*u/1e6}}function yC(e,n,r=Date.now()){if(!EP(n))return e.inputTokens;const i=fo(n,r),o=((i==null?void 0:i.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-o)}function dn(e,n,r=Date.now()){const i=fo(n,r);if(!i)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const o=yC(e,n,r)*i.input/1e6,l=e.outputTokens*i.output/1e6,u=e.cacheReadTokens*i.cacheRead/1e6,c=vC(e,i),h=c.usd5m+c.usd1h;return{input:o,output:l,cacheRead:u,cacheWrite:h,total:o+l+u+h}}const Fx=2e5,NP=1e6,CP=[/\[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],TP=[{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 RP(e){if(!e)return Fx;for(const n of CP)if(n.test(e))return NP;for(const n of TP)if(n.match.test(e))return n.window;return Fx}function wC(e,n){return typeof e=="number"&&e>0?e:RP(n)}const fu="not priced";function De(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const n=(e*100).toFixed(e<.1?1:0);if(Number(n)<100)return`${n}¢`}return e<100?`$${e.toFixed(2)}`:e<1e4?`$${e.toFixed(0)}`:`$${(e/1e3).toFixed(1)}k`}function ku(e,n){if(e<=0||n<10)return null;const r=e/n,i=r*60;return i>=.01?`${De(i)}/min`:`${De(r*3600)}/hr`}const jP=new Set(["untrusted","on-request","on-failure"]);function AP(e){return typeof e!="string"||!e?null:jP.has(e)?!0:e==="never"?!1:null}function IP(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const n=AP(e.approvalPolicy);return n===!1?null:{label:"approvals not visible",detail:`${n===!0?`This session's approval policy is "${e.approvalPolicy}", so Codex can stop and ask you to approve a command.`:"This session's approval policy has not been read yet, so it may be able to stop and ask you to approve a command."}
58
58
 
59
- Codex writes no approval request to its rollout files, which are the only thing this deck can read — so when it does ask, this card, the sidebar, the topbar count, the tab title and the favicon will all stay silent. Check the terminal.`}}const IP=1;function MP(){const e=[];let n=0;function r(){let i;for(const o of e)(!i||o.layer>i.layer||o.layer===i.layer&&o.seq>i.seq)&&(i=o);return i}return{push(i,o=0){const l={dismiss:i,layer:o,seq:n++};return e.push(l),()=>{const u=e.indexOf(l);u!==-1&&e.splice(u,1)}},dismissTop(){const i=r();return i?(i.dismiss(),!0):!1},isTop(i){const o=r();return o!=null&&o.dismiss===i},depth(){return e.length}}}const Eu=MP();function OP(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function Fx(e){return String(e.tagName??"").toUpperCase()==="BODY"}function PP(e,n){return!e||!e.isConnected||Fx(e)?!1:n==null||Fx(n)}const zx="a[href], button, input, select, textarea, [tabindex]";function LP(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function $P(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const n=String(e.overflow??"").toLowerCase();return n==="auto"||n==="scroll"}function qP({count:e,index:n,shiftKey:r}){return e<=0?{kind:"hold"}:n<0||n>=e?{kind:"focus",index:r?e-1:0}:!r&&n===e-1?{kind:"focus",index:0}:r&&n===0?{kind:"focus",index:e-1}:{kind:"allow"}}function wC(e){return e.ctrlKey||e.metaKey||e.altKey}const DP=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),FP=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),zP=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function xC(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function ny(e){if(!e)return!1;if(e.isContentEditable)return!0;const n=xC(e);return n==="TEXTAREA"?!0:n!=="INPUT"?!1:!DP.has(String(e.type??"text").toLowerCase())}function BP(e){if(!e)return!1;if(ny(e)||FP.has(xC(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>zP.has(r))}function _C(e){return e?Array.from(e.querySelectorAll("*")).filter(n=>{if(n.matches(zx))return LP({disabled:n.disabled,tabIndex:n.tabIndex,rendered:n.getClientRects().length>0});const r=n.scrollHeight>n.clientHeight;return r&&$P({overflowing:r,overflow:getComputedStyle(n).overflowY,hasFocusable:n.querySelector(zx)!=null})}):[]}function UP(e,n){const r=_C(e);if(!n||!e.contains(n)||r.includes(n))return r;const i=r.findIndex(o=>(n.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return i===-1?[...r,n]:[...r.slice(0,i),n,...r.slice(i)]}function mo(e,n={}){const{focusRef:r,layer:i}=n,o=j.useRef(null),l=j.useRef(e);l.current=e;const u=j.useRef(null);u.current===null&&(u.current=()=>l.current());const c=u.current;return j.useEffect(()=>Eu.push(c,i),[c,i]),j.useEffect(()=>{var p;const h=document.activeElement;return(p=(r==null?void 0:r.current)??_C(o.current)[0])==null||p.focus(),()=>{PP(h,document.activeElement)&&h.focus()}},[]),j.useEffect(()=>{const h=p=>{var _;if(p.key!=="Tab"||wC(p))return;const d=o.current;if(!d)return;const m=document.activeElement;if(!(m!=null&&d.contains(m))&&!Eu.isTop(c))return;const w=UP(d,m),N=qP({count:w.length,index:m?w.indexOf(m):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((_=w[N.index])==null||_.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[c]),o}function Pn(e){return e.toLocaleString()}function HP(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const WP=60;function VP(e,n=WP){if(e.length<=n)return e;const r=e.slice(e.length-(n-1)),i=r.search(/[/\\]/);return"…"+(i===-1?r:r.slice(i))}function GP({agent:e,onClose:n}){var m;const r=j.useRef(null),i=mo(n,{focusRef:r}),o=e.context,l=e.usage,u=(o==null?void 0:o.currentContextTokens)??0,c=yC(e.contextWindow,e.model),h=Math.min(100,u/c*100),p=dn(l,e.model),d=l.inputTokens+l.cacheReadTokens+l.cacheCreateTokens;return g.jsx("div",{className:"ctx-modal-backdrop",onClick:n,role:"presentation",children:g.jsxs("div",{ref:i,className:"ctx-modal",onClick:y=>y.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[g.jsxs("header",{className:"ctx-modal-head",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),g.jsx("div",{className:"ctx-modal-sub",children:"approximation — CC's /context isn't hook-exposed"})]}),g.jsx("button",{type:"button",ref:r,className:"ctx-modal-close",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),g.jsxs("section",{className:"ctx-window-row",children:[g.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(h),children:g.jsx("div",{className:"ctx-window-fill",style:{width:`${h}%`}})}),g.jsxs("div",{className:"ctx-window-meta",children:[g.jsxs("span",{className:"ctx-window-pct",children:[h.toFixed(1),"%"]}),g.jsxs("span",{children:[Pn(u)," / ",Pn(c)," tok (current turn)"]})]})]}),g.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),g.jsxs("div",{className:"ctx-grid",children:[g.jsx(Zn,{label:"input tokens",val:Pn(l.inputTokens)}),g.jsx(Zn,{label:"output tokens",val:Pn(l.outputTokens)}),g.jsx(Zn,{label:"cache reads",val:Pn(l.cacheReadTokens)}),g.jsx(Zn,{label:"cache writes",val:Pn(l.cacheCreateTokens)}),g.jsx(Zn,{label:"cumulative total",val:Pn(d)}),g.jsx(Zn,{label:"estimated cost",val:De(p.total),accent:!0})]}),g.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),g.jsxs("div",{className:"ctx-grid",children:[g.jsx(Zn,{label:"user messages",val:Pn((o==null?void 0:o.msgsUser)??0)}),g.jsx(Zn,{label:"assistant messages",val:Pn((o==null?void 0:o.msgsAssistant)??0)}),g.jsx(Zn,{label:"tool uses",val:Pn((o==null?void 0:o.toolUses)??0)}),g.jsx(Zn,{label:"tool results",val:Pn((o==null?void 0:o.toolResults)??0)}),g.jsx(Zn,{label:"system-reminders",val:Pn((o==null?void 0:o.systemReminders)??0)})]}),g.jsx("h3",{className:"ctx-section-title",children:"CLAUDE.md files in scope"}),(((m=o==null?void 0:o.claudeMdFiles)==null?void 0:m.length)??0)===0?g.jsx("div",{className:"ctx-empty",children:"No CLAUDE.md files found on the path from cwd to ~/.claude."}):g.jsx("ul",{className:"ctx-md-list",children:o.claudeMdFiles.map(y=>g.jsxs("li",{children:[g.jsx("span",{className:"ctx-md-path",title:y.path,children:VP(y.path)}),g.jsx("span",{className:"ctx-md-size",children:HP(y.bytes)})]},y.path))})]})})}function Zn({label:e,val:n,accent:r}){return g.jsxs("div",{className:`ctx-row${r?" accent":""}`,children:[g.jsx("span",{className:"ctx-row-label",children:e}),g.jsx("span",{className:"ctx-row-val",children:n})]})}function YP({currentContextTokens:e,modelId:n,contextWindow:r,size:i=26,onClick:o,title:l}){const u=yC(r,n),c=Math.min(1,e/u),h=i/2-3,p=i/2,d=2*Math.PI*h,m=d*c,y=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return g.jsx("button",{type:"button",className:"ctx-donut",onClick:o,title:l??`context: ${e.toLocaleString()} / ${u.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:g.jsxs("svg",{width:i,height:i,viewBox:`0 0 ${i} ${i}`,children:[g.jsx("circle",{cx:p,cy:p,r:h,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),g.jsx("circle",{cx:p,cy:p,r:h,stroke:y,strokeWidth:"2.5",fill:"none",strokeDasharray:`${m} ${d-m}`,strokeDashoffset:d/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),g.jsx("text",{x:p,y:p+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}function Bx(e,n){const r=fo(n);if(!r)return`model: ${n}
60
- no published rate in this build — the tokens are counted, the dollars are not`;const i=d=>d.toLocaleString(),o=d=>`$${d}/MTok`,l=dn(e,n),u=gC(e,r),c=u.tokens1h>0?[`cache w5m${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${De(u.usd5m)}`,`cache w1h${i(u.tokens1h).padStart(14)} × ${o(r.cacheWrite1h??r.cacheWrite).padEnd(11)} = ${De(u.usd1h)}`]:[`cache w ${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${De(u.usd5m)}`],h=vC(e,n),p=h===e.inputTokens?"input":"uncached";return[`model: ${n}`,`${p.padEnd(9)}${i(h).padStart(14)} × ${o(r.input).padEnd(11)} = ${De(l.input)}`,`output ${i(e.outputTokens).padStart(14)} × ${o(r.output).padEnd(11)} = ${De(l.output)}`,`cache r ${i(e.cacheReadTokens).padStart(14)} × ${o(r.cacheRead).padEnd(11)} = ${De(l.cacheRead)}`,...c,"─────────────────────────────────────────",`total = ${De(l.total)}`].join(`
61
- `)}function Tv(e,n,r){const i=(n??r)-e;if(i<1e3)return`${Math.max(0,i)}ms`;const o=Math.floor(i/1e3);if(o<60)return`${o}s`;const l=Math.floor(o/60),u=o%60;return`${l}m ${String(u).padStart(2,"0")}s`}function KP({data:e,selected:n}){var h;const r=e.now??Date.now(),i=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",n?"selected":""].filter(Boolean).join(" "),o=e.tools.filter(p=>!p.endedAt).length,l=ty(e.sessionId),u=((h=e.context)==null?void 0:h.currentContextTokens)??0,c=e.kind==="root"&&u>0;return g.jsxs("div",{className:i,style:{"--session-hue":l},children:[g.jsx("span",{className:"accent-stripe"}),g.jsx(co,{type:"target",position:Ae.Left,style:{background:"transparent",border:"none"}}),g.jsxs("div",{className:"head",children:[g.jsxs("div",{className:"title",children:[g.jsx(XP,{state:e.state}),g.jsx("span",{className:"label",title:e.cwd,children:e.label}),e.synthetic&&g.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),g.jsxs("div",{className:"head-right",children:[c&&e.onOpenContext&&g.jsx(YP,{currentContextTokens:u,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),g.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:Tv(e.startedAt,e.endedAt,r)})]})]}),g.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&g.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?g.jsx("span",{className:"model-chip",title:e.model,children:Ns(e.model)}):e.provider==="codex"?g.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.waiting&&g.jsx(ZP,{waiting:e.waiting,now:r}),(()=>{const p=AP(e);return p?g.jsxs("div",{className:"approval-blind-row",title:p.detail,children:[g.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),g.jsx("span",{className:"approval-blind-said",children:p.label})]}):null})(),e.tools.length>0&&g.jsx(eL,{tools:e.tools,now:r}),g.jsxs("div",{className:"meta",children:[g.jsxs("span",{children:[g.jsx("b",{children:e.toolCount})," tools"]}),o>0&&g.jsxs("span",{className:"inflight-meta",children:[g.jsx("b",{children:o})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&g.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:[g.jsx("b",{children:JP(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{if(!fo(e.model))return e.usage.inputTokens+e.usage.outputTokens<=0?null:g.jsx("span",{className:"cost-unpriced",title:Bx(e.usage,e.model),children:fu});const d=dn(e.usage,e.model);if(d.total<=0)return null;const m=Math.max(0,((e.endedAt??r)-e.startedAt)/1e3),y=e.state==="active"?ku(d.total,m):null,w=Bx(e.usage,e.model)+(y?`
62
- burn: ${y}`:"");return g.jsxs("span",{className:"cost-meta",title:w,children:[g.jsx("b",{children:De(d.total)}),y&&g.jsx("span",{className:"cost-rate",children:y})]})})()]}),g.jsx(co,{type:"source",position:Ae.Right,style:{background:"transparent",border:"none"}})]})}function ry(e){return e==="active"?"live":e==="done"?"done":"err"}function XP({state:e}){return g.jsx("span",{className:`state-pill state-${e}`,children:ry(e)})}function Pu(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function QP(e){return e.kind==="permission"?Pu(e):"Your turn"}function ZP({waiting:e,now:n}){const r=e.kind==="permission",i=Pu(e);return g.jsxs("div",{className:r?"waiting-row permission":"waiting-row idle",title:`${i}
63
- Blocked for ${Tv(e.since,void 0,n)} — the answer goes in the terminal, not here.`,children:[r?g.jsx("span",{className:"ap-pulse","aria-hidden":!0}):g.jsx("span",{className:"waiting-dot","aria-hidden":!0}),g.jsx("span",{className:"waiting-said",children:QP(e)}),g.jsx("b",{children:Tv(e.since,void 0,n)})]})}function JP(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(2)}M`}function eL({tools:e,now:n}){const l=new Array(24).fill(0);let u=0;for(const y of e){const w=n-y.startedAt;if(w<0||w>=6e4)continue;const N=23-Math.floor(w/2500);N>=0&&N<24&&(l[N]+=1,u+=1)}const c=Math.max(1,...l),h=132,p=14,d=h/24,m=c/(2500/1e3);return g.jsxs("div",{className:"tool-spark-row",title:`${u} tool calls in last 60s · peak ${m.toFixed(1)}/s`,children:[g.jsx("svg",{className:"tool-spark",width:h,height:p,viewBox:`0 0 ${h} ${p}`,"aria-hidden":!0,children:l.map((y,w)=>{const N=y===0?1.5:Math.max(1.5,y/c*p),_=w===23&&y>0,S=`tool-spark-bar${y>0?" active":""}${_?" latest":""}`;return g.jsx("rect",{x:w*d+.4,y:p-N,width:Math.max(.5,d-1),height:N,rx:.8,className:S},w)})}),g.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function Ns(e){const n=e.replace(/^anthropic\./,"").replace(/[-_]\d{8}(?!\d)/,""),r=n.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(r){const l=r[1][0].toUpperCase()+r[1].slice(1).toLowerCase(),u=r[2].replace(/[-_]/g,".");return`${l} ${u}`}const i=n.match(/^gpt[-_](\d+(?:[-_.]\d+)*)[-_]codex\b/i);if(i)return`GPT-${i[1].replace(/[-_]/g,".")} Codex`;const o=n.match(/^gpt[-_](\d+(?:[-_.]\d+)*)/i);return o?`GPT-${o[1].replace(/[-_]/g,".")}`:e}function Ux(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function tL(e){if(e.endedAt==null)return"in-flight…";const n=e.endedAt-e.startedAt;return n<1e3?`${n}ms`:`${(n/1e3).toFixed(2)}s`}function nL({tool:e,onClose:n}){const r=mo(n),i=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return g.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:g.jsxs("div",{ref:r,className:"modal",onClick:o=>o.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[g.jsxs("header",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:`status-dot ${i}`,"aria-hidden":!0}),g.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),g.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),g.jsxs("div",{className:"modal-actions",children:[g.jsx("span",{className:"modal-dur",children:tL(e)}),g.jsx("button",{className:"btn icon-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),g.jsxs("section",{className:"modal-body",children:[e.trimmed&&g.jsx("div",{className:"modal-section",children:g.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),g.jsxs("div",{className:"modal-section",children:[g.jsx("h4",{children:"Input"}),g.jsx("pre",{children:Ux(e.input??e.inputPreview)})]}),g.jsxs("div",{className:"modal-section",children:[g.jsxs("h4",{children:["Response ",i==="err"&&g.jsx("span",{className:"err-tag",children:"error"})]}),g.jsx("pre",{children:e.endedAt==null?"(waiting…)":Ux(e.response??e.errorPreview)})]})]})]})})}const tu=18,Hx=26,rL=12;function sL(e){return iL(e.nodeInternals.values())}function iL(e){const n=new Map;for(const o of e){if(o.type!=="agent")continue;const l=o.data;if(!(l!=null&&l.sessionId)||l.exitAt!=null||o.width==null||o.height==null)continue;const u=o.position.x,c=o.position.y,h=u+o.width,p=c+o.height,d=n.get(l.sessionId);d?(d.minX=Math.min(d.minX,u),d.minY=Math.min(d.minY,c),d.maxX=Math.max(d.maxX,h),d.maxY=Math.max(d.maxY,p),l.kind==="root"&&(d.label=Wx(l)??d.label)):n.set(l.sessionId,{minX:u,minY:c,maxX:h,maxY:p,label:Wx(l)??l.sessionId})}const r=new Map;for(const o of n.values())r.set(o.label,(r.get(o.label)??0)+1);const i=[];for(const[o,l]of n){const c=(r.get(l.label)??0)>1?`${l.label} · ${oL(o)}`:l.label;i.push({sessionId:o,label:c,x:l.minX-tu,y:l.minY-tu-Hx,w:l.maxX-l.minX+tu*2,h:l.maxY-l.minY+tu*2+Hx})}return i}function oL(e){const n=e.match(/[a-zA-Z0-9]{4}/);return n?n[0]:e.slice(0,4)}function Wx(e){if(e.kind==="root")return e.label}function aL(){const{x:e,y:n,zoom:r}=oC(),i=Ta(),o=Ke(sL,lL);if(o.length<=1)return null;const l=u=>{try{const c=i.getNodes().filter(h=>{const p=h.data;return(p==null?void 0:p.sessionId)===u});if(c.length===0)return;i.fitView({padding:.3,duration:500,nodes:c})}catch{}};return g.jsx("div",{className:"session-clusters",children:o.map(u=>{const c=ty(u.sessionId),h={position:"absolute",left:u.x*r+e,top:u.y*r+n,width:u.w*r,height:u.h*r,"--session-hue":c},p={position:"absolute",left:u.x*r+e+16*r,top:(u.y-rL)*r+n,transform:`scale(${Math.min(1,r)})`,transformOrigin:"left top","--session-hue":c};return g.jsxs(ue.Fragment,{children:[g.jsx("div",{className:"cluster-card",style:h,"aria-hidden":!0}),g.jsx("button",{type:"button",className:"cluster-label",style:p,title:`Fit view to ${u.label} · drag the wrapper to move the whole session`,onClick:()=>l(u.sessionId),children:u.label})]},u.sessionId)})})}function lL(e,n){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++){const i=e[r],o=n[r];if(i.sessionId!==o.sessionId||i.label!==o.label||i.x!==o.x||i.y!==o.y||i.w!==o.w||i.h!==o.h)return!1}return!0}function uL({data:e}){return g.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const ja={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"}},cL=Object.fromEntries(Object.entries(ja).map(([e,n])=>[e,n.category])),dL=Object.fromEntries(Object.entries(ja).map(([e,n])=>[e,n.emoji])),fL=Object.fromEntries(Object.entries(ja).map(([e,n])=>[e,n.label])),hL=new Set(Object.keys(ja)),pL=new Set(Object.entries(ja).filter(([,e])=>e.shell).map(([e])=>e)),mL={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",ScheduleWakeup:"other",CronCreate:"other",CronList:"other",CronDelete:"other",Monitor:"other",PushNotification:"other",RemoteTrigger:"other",ToolSearch:"other",...cL};function bC(e){return e.startsWith("mcp__")?"mcp":mL[e]??"other"}const gL=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,vL=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function yL(e){if(typeof e!="string"||!e)return null;const n=gL.exec(e);if(n){const i=wL(n[2]);if(i.trim())return i}const r=vL.exec(e);return r?r[1]:null}function wL(e){return e.replace(/\\(["'`\\nrt])/g,(n,r)=>r==="n"?`
64
- `:r==="r"?"\r":r==="t"?" ":r)}const SC=600,xL=4,_L=36,Rv=16,bL=60,SL=6,Vx=220,Gx=96,kL=28,EL={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:"📡",...dL};function Yx(e){return e.startsWith("mcp__")?"🔌":EL[e]??"✨"}const NL={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 kC(e){if(!e)return null;let n=e.trim();if(!n)return null;const r=n.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(r)return kC(r[1]);for(;;){const l=n.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!l)break;n=n.slice(l[0].length)}n=n.replace(/^sudo(?:\s+-\S+)*\s+/,""),n=n.replace(/^(?:time|nohup|xargs)\s+/,"");const i=n.match(/^([^\s|;&<>(]+)/);if(!i)return null;let o=i[1];return o=o.replace(/^.*[/\\]/,""),o=o.replace(/\.(exe|cmd|bat|ps1)$/i,""),o||null}function CL(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const n=e;if(typeof n.script=="string"){const r=yL(n.script);if(r)return r}if(typeof n.cmd=="string")return n.cmd;if(typeof n.command=="string")return n.command;if(Array.isArray(n.command)&&n.command.every(r=>typeof r=="string")){const r=n.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(r[0]??"")){const i=r.findIndex(o=>/^(-Command|-c)$/i.test(o));if(i>=0&&i+1<r.length)return r[i+1]}return r.join(" ")}return typeof n.script=="string"?n.script:null}const TL=new Set(["Bash","PowerShell",...pL]),RL=hL;function jL(e,n){return RL.has(e)||e.startsWith("mcp__")?Math.max(Gx,34+n.length*7.5):Gx}function AL(e,n){if(!TL.has(e))return null;const r=CL(n);if(!r)return null;const i=kC(r);return i?{emoji:NL[i]??"⚙️",label:i,category:"shell",detail:r}:null}const IL=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),Kx={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:"🗄️"},Xx={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 ML(e){const r=e.replace(/\\/g,"/").replace(/\/+$/,""),i=r.lastIndexOf("/");return i>=0?r.slice(i+1):r}function OL(e){const n=e.toLowerCase();if(Xx[n])return Xx[n];if(n.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(n))return"🧪";const r=n.lastIndexOf(".");if(r>0&&r<n.length-1){const i=n.slice(r+1);if(Kx[i])return Kx[i]}return"📄"}function PL(e,n){if(!n||typeof n!="object")return null;const r=n;if(e==="apply_patch"&&typeof r.patch=="string"){const i=r.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return i?i[1].trim():null}return typeof r.file_path=="string"?r.file_path:typeof r.notebook_path=="string"?r.notebook_path:typeof r.path=="string"?r.path:e==="Glob"&&typeof r.pattern=="string"?r.pattern:null}function LL(e,n){if(!IL.has(e))return null;const r=PL(e,n);if(!r)return null;const i=ML(r);return i?{emoji:e==="LS"?"📂":OL(i),label:i,category:"file",detail:r}:null}const EC={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 NC(e){if(!e.startsWith("mcp__"))return null;const n=e.slice(5),r=n.indexOf("__");return r<=0?{server:n,method:""}:{server:n.slice(0,r),method:n.slice(r+2)}}function $L(e){let n=5381;for(let r=0;r<e.length;r++)n=(n<<5)+n^e.charCodeAt(r);return Math.abs(n)%360}function qL(e,n){const r=NC(e);if(!r)return null;const{server:i,method:o}=r;if(!o)return null;const l=EC[i.toLowerCase()];return{emoji:(l==null?void 0:l.emoji)??"🔌",label:o,category:"mcp",detail:l?`${l.name} · ${o}`:`${i} · ${o}`}}function DL(e,n){return AL(e,n)??LL(e,n)??qL(e)}const FL=fL;function zL(e){const n=NC(e);if(n){const i=EC[n.server.toLowerCase()];return i?{emoji:i.emoji,label:i.name}:{emoji:"🔌",label:n.server,hue:$L(n.server)}}const r=FL[e];return r?{emoji:Yx(e),label:r}:{emoji:Yx(e),label:e}}function BL(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function UL(e,n,r){if(r==null)return 1;const i=n-r;return i<0?1:Math.max(0,1-i/SC)}function HL(e,n){const r=[],i=new Set;for(let o=e.length-1;o>=0&&r.length<n;o--){const l=e[o];i.has(l.id)||(i.add(l.id),r.push(l))}return r.reverse()}function WL(e,n,r,i,o,l){const u=[];for(const c of e.values()){if(!n.has(c.id)||c.exitAt!=null&&l-c.exitAt>SC)continue;const h=i.get(c.id)??r.get(c.id);if(!h)continue;const p=HL(c.tools,xL);if(p.length===0)continue;const d=c.exitAt??null,m=o.get(c.id),y=Math.max((m==null?void 0:m.width)??Vx,Vx),w=(m==null?void 0:m.height)??130,N=h.x,_=h.y,b=N+y,S=_+w/2;p.forEach((k,E)=>{const T=E*_L,I=N+y+bL,O=_+SL+T,A=UL(k,l,d),U=k.inputPreview??"",z=BL(k),P=A<.999,D=zL(k.name);u.push({id:`${c.id}::${k.id}`,toolId:k.id,agentId:c.id,toolName:k.name,name:D.label,emoji:D.emoji,status:z,category:bC(k.name),mcpHue:D.hue,inputPreview:U,fade:A,fading:P,worldX:I,worldY:O,anchorX:b,anchorY:S,spawnDx:b-I,spawnDy:S-(O+Rv)});const V=DL(k.name,k.input);if(V){const B=jL(k.name,D.label),C=I+B+kL,q=O,L=I+B,re=O+Rv;u.push({id:`sub:${c.id}::${k.id}`,toolId:k.id,agentId:c.id,toolName:k.name,name:V.label,emoji:V.emoji,isSub:!0,status:z,category:V.category,inputPreview:V.detail??U,fade:A,fading:P,worldX:C,worldY:q,anchorX:L,anchorY:re,spawnDx:L-C,spawnDy:0})}})}return u}function VL({agents:e,visibleAgentIds:n,positions:r,pinned:i,measured:o,dimUnmatched:l,spotlight:u,hiddenCategories:c,now:h,onOpenTool:p}){const d=WL(e,n,r,i,o,h),m=c&&c.size>0?d.filter(y=>!c.has(y.category)):d;return g.jsx(GL,{bursts:m,dimUnmatched:l,spotlight:u,onOpenTool:p})}function GL({bursts:e,dimUnmatched:n,spotlight:r,onOpenTool:i}){const{x:o,y:l,zoom:u}=oC();return g.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[g.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const h=c.anchorX*u+o,p=c.anchorY*u+l,d=(c.worldX+6)*u+o,m=(c.worldY+Rv)*u+l,y=h+(d-h)*.55,w=n!=null&&!n.has(c.agentId),N=r!=null&&!r.has(c.agentId),_=c.fade*(w||N?.14:1);return g.jsx("path",{d:`M ${h} ${p} Q ${y} ${p}, ${d} ${m}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:_},`l:${c.id}`)})}),e.map(c=>{const h=c.worldX*u+o,p=c.worldY*u+l,d={left:`${h}px`,top:`${p}px`,transform:`scale(${u})`,transformOrigin:"left top","--spawn-dx":`${c.spawnDx}px`,"--spawn-dy":`${c.spawnDy}px`},m=c.isSub?`${c.toolName} · ${c.name}`:c.toolName,y=c.inputPreview?`${m} · ${c.inputPreview}`:m,w=i!=null,N=c.mcpHue!=null?{"--mcp-hue":c.mcpHue}:{},_=n!=null&&!n.has(c.agentId),b=r!=null&&!r.has(c.agentId),S=_||b?" dim":"";return g.jsx("div",{className:"tool-burst-wrap",style:d,children:g.jsxs("div",{className:`tool-burst cat-${c.category}${c.mcpHue!=null?" mcp-hue":""} status-${c.status}${c.fading?" fading":""}${w?" clickable":""}${c.isSub?" sub":""}${S}`,style:N,title:y,onClick:w?()=>i(c.toolId):void 0,children:[g.jsx("span",{className:"tb-emoji",children:c.emoji}),g.jsx("span",{className:"tb-name",children:c.name}),c.status==="inflight"&&g.jsx("span",{className:"tb-spin"}),c.status==="done"&&g.jsx("span",{className:"tb-mark done",children:"✓"}),c.status==="err"&&g.jsx("span",{className:"tb-mark err",children:"×"})]})},c.id)})]})}function YL({state:e,sessionId:n,onClose:r}){const i=j.useMemo(()=>XL(e,n),[e,n]),o=j.useRef(null),l=mo(r,{focusRef:o});return i?g.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:g.jsxs("div",{ref:l,className:"modal session-summary",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[g.jsxs("div",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),g.jsx("span",{id:"ss-title",className:"modal-tool-name",title:i.cwd??i.sessionId,children:i.label}),g.jsxs("span",{className:"modal-tool-id",children:["· ",i.sessionId.slice(0,8)]})]}),g.jsxs("div",{className:"modal-actions",children:[g.jsx("span",{className:"modal-dur",title:"Total wall time",children:i.durationLabel}),g.jsx("button",{type:"button",ref:o,className:"btn",onClick:r,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),g.jsxs("div",{className:"modal-body",children:[g.jsxs("section",{className:"ss-hero",children:[g.jsxs("div",{className:"ss-hero-left",children:[g.jsx("div",{className:"ss-cost-label",children:"total spend"}),g.jsx("div",{className:"ss-cost",children:De(i.cost.total)}),i.modelChips.length>0&&g.jsx("div",{className:"ss-models",children:i.modelChips.map(u=>g.jsx("span",{className:"model-chip",title:u,children:Ns(u)},u))})]}),g.jsx("div",{className:"ss-hero-right",children:i.cost.total>0&&g.jsxs(g.Fragment,{children:[g.jsx(KL,{cost:i.cost}),g.jsxs("div",{className:"ss-cost-legend",children:[g.jsxs("span",{className:"ssl ssl-in",children:["input ",g.jsx("b",{children:De(i.cost.input)})]}),g.jsxs("span",{className:"ssl ssl-out",children:["output ",g.jsx("b",{children:De(i.cost.output)})]}),g.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",g.jsx("b",{children:De(i.cost.cacheRead)})]}),g.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",g.jsx("b",{children:De(i.cost.cacheWrite)})]})]})]})})]}),g.jsxs("section",{className:"ss-stats",children:[g.jsx(Zi,{label:"agents",value:i.agentCount}),g.jsx(Zi,{label:"subagents",value:i.subagentCount}),g.jsx(Zi,{label:"tool calls",value:i.toolCount}),g.jsx(Zi,{label:"prompts",value:i.promptCount}),g.jsx(Zi,{label:"tokens",value:i.tokensSum.toLocaleString()}),i.errCount>0&&g.jsx(Zi,{label:"errors",value:i.errCount,tone:"err"})]}),i.topTools.length>0&&g.jsxs("section",{className:"modal-section",children:[g.jsx("h4",{children:"Most-used tools"}),g.jsx("div",{className:"ss-top-tools",children:i.topTools.map(([u,c])=>g.jsxs("div",{className:"ss-tt",children:[g.jsx("span",{className:"ss-tt-name",children:u}),g.jsx("span",{className:"ss-tt-bar",children:g.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${c/i.topTools[0][1]*100}%`}})}),g.jsx("span",{className:"ss-tt-count",children:c})]},u))})]}),i.firstPrompt&&g.jsxs("section",{className:"modal-section",children:[g.jsx("h4",{children:"Opening prompt"}),g.jsx("div",{className:"ss-prompt",children:i.firstPrompt})]})]})]})}):null}function Zi({label:e,value:n,tone:r}){return g.jsxs("div",{className:`ss-stat${r?` tone-${r}`:""}`,children:[g.jsx("div",{className:"ss-stat-value",children:n}),g.jsx("div",{className:"ss-stat-label",children:e})]})}function KL({cost:e}){const n=e.total;if(n<=0)return null;const r=(i,o,l)=>{if(i<=0)return null;const u=i/n*100;return g.jsx("span",{className:`cb-seg ${o}`,style:{width:`${u}%`},title:`${l}: ${De(i)} (${u.toFixed(0)}%)`},o)};return g.jsxs("div",{className:"cost-bar cost-bar-lg",role:"img","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}function XL(e,n){const r=e.agents.get(n);if(!r)return null;const i=[];for(const E of e.agents.values())E.sessionId===n&&i.push(E);if(i.length===0)return null;const o={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},l=new Set,u=new Map;let c=0,h=0,p=0,d=0,m=0,y,w=1/0,N=0;for(const E of i){const T=dn(E.usage,E.model);o.input+=T.input,o.output+=T.output,o.cacheRead+=T.cacheRead,o.cacheWrite+=T.cacheWrite,o.total+=T.total,E.model&&l.add(E.model),E.kind==="subagent"&&m++,h+=E.prompts.length,!y&&E.prompts.length>0&&(y=E.prompts[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,c+=E.toolCount,w=Math.min(w,E.startedAt),N=Math.max(N,E.endedAt??Date.now());for(const I of E.tools)u.set(I.name,(u.get(I.name)??0)+1),I.ok===!1&&d++}const _=Math.max(0,N-w),b=Math.floor(_/1e3),S=b<60?`${b}s`:b<3600?`${Math.floor(b/60)}m ${String(b%60).padStart(2,"0")}s`:`${Math.floor(b/3600)}h ${Math.floor(b%3600/60)}m`,k=Array.from(u.entries()).sort((E,T)=>T[1]-E[1]).slice(0,5);return{sessionId:n,label:r.label||r.cwdBasename||"session",cwd:r.cwd,durationLabel:S,cost:o,modelChips:Array.from(l),agentCount:i.length,subagentCount:m,toolCount:c,promptCount:h,tokensSum:p,errCount:d,topTools:k,firstPrompt:y}}function sy(e){return(e==null?void 0:e.kind)==="permission"}function QL(e){const n=[];for(const r of e)r.kind==="root"&&sy(r.waiting)&&n.push({id:r.id,label:r.label,waiting:r.waiting});return n.sort((r,i)=>r.waiting.since-i.waiting.since)}function ZL(e){const n=new Set;for(const r of e)r.state==="active"&&n.add(r.sessionId);return n.size}function Qx(e){return e.waiting?sy(e.waiting)?0:1:e.state==="active"?2:3}function JL(e,n){const r=[];for(const i of e.agents.values()){if(i.kind!=="root")continue;let o=i.toolCount,l=dn(i.usage,i.model).total,u=i.endedAt??i.startedAt;for(const c of e.agents.values()){if(c.sessionId!==i.sessionId||c.kind==="root")continue;o+=c.toolCount,l+=dn(c.usage,c.model).total;const h=c.endedAt??c.startedAt;h>u&&(u=h)}r.push({sessionId:i.sessionId,label:i.label||i.cwdBasename||"session",cwdBasename:i.cwdBasename,state:i.state,waiting:i.waiting,modelId:i.model,toolCount:o,cost:l,startedAt:i.startedAt,lastActivity:u})}return r.sort((i,o)=>{const l=Qx(i),u=Qx(o);return l!==u?l-u:i.waiting&&o.waiting?i.waiting.since-o.waiting.since:o.lastActivity-i.lastActivity}),r}function Zx(e,n,r){const i=(n??r)-e;if(i<1e3)return"<1s";const o=Math.floor(i/1e3);if(o<60)return`${o}s`;const l=Math.floor(o/60);return l<60?`${l}m`:`${Math.floor(l/60)}h ${l%60}m`}function e3({state:e,now:n,selectedIds:r,onSelect:i,onClose:o}){const l=j.useMemo(()=>JL(e),[e,e.lastSeq,n]),u=l.filter(h=>h.state==="active").length,c=l.filter(h=>sy(h.waiting)).length;return g.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[g.jsxs("div",{className:"sl-header",children:[g.jsxs("h2",{children:["Sessions ",g.jsx("span",{className:"sl-count",children:l.length})]}),c>0&&g.jsxs("span",{className:"sl-waiting-count",children:[c," waiting"]}),u>0&&g.jsxs("span",{className:"sl-live-count",children:[u," live"]}),g.jsx("button",{className:"btn icon-btn sl-close",onClick:o,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),g.jsxs("div",{className:"sl-rows",children:[l.length===0&&g.jsx("div",{className:"sl-empty",children:"No sessions yet."}),l.map(h=>{const p=r.has(h.sessionId);return g.jsxs("button",{type:"button",className:`sl-row state-${h.state}${p?" selected":""}`,onClick:()=>i(h.sessionId),title:`Focus ${h.label}`,children:[g.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),g.jsx("span",{className:"vis-hidden",children:ry(h.state)}),g.jsxs("div",{className:"sl-row-body",children:[g.jsxs("div",{className:"sl-row-head",children:[g.jsx("span",{className:"sl-label",children:h.label}),h.modelId&&g.jsx("span",{className:"model-chip",title:h.modelId,children:Ns(h.modelId)})]}),g.jsxs("div",{className:"sl-row-meta",children:[g.jsxs("span",{title:"tool calls",children:[g.jsx("b",{children:h.toolCount})," tools"]}),h.cost>0&&g.jsx("span",{className:"sl-cost",title:"total spend",children:g.jsx("b",{children:De(h.cost)})}),h.waiting?g.jsxs("span",{className:"sl-waiting",title:`${Pu(h.waiting)}
65
- Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`,children:["waiting ",Zx(h.waiting.since,void 0,n)]}):g.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:Zx(h.startedAt,h.state==="active"?void 0:h.lastActivity,n)})]})]})]},h.sessionId)})]})]})}const en="ccdeck";function qt(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:e<1e9?`${(e/1e6).toFixed(2)}M`:`${(e/1e9).toFixed(2)}B`}function Jx(e,n){if(!e)return null;const r=n-Math.floor(e/1e3);return r<10?"just now":r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:`${Math.floor(r/3600)}h ago`}function t3(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 Ud="__unknown__";function n3({cost:e}){const n=e.total;if(n<=0)return null;const r=(i,o,l)=>{if(i<=0)return null;const u=i/n*100;return g.jsx("span",{className:`cb-seg ${o}`,style:{width:`${u}%`},title:`${l}: ${De(i)} (${u.toFixed(0)}%)`},o)};return g.jsxs("div",{className:"cost-bar",role:"img","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}function r3(e,n){const r=e-n;if(r<=0)return null;const i=Math.floor(r/3600),o=Math.floor(r%3600/60);if(i>23){const l=Math.floor(r/86400),u=Math.floor(r%86400/3600);return`${l}d ${u}h`}return i>0?`${i}h ${o}m`:`${o}m`}function s3(e,n,r,i){const o=Math.max(0,n-i),l=Math.max(0,r-o);if(l<120)return null;const u=Math.min(100,l/r*100),c=e-u;if(Math.abs(c)<3)return{label:"on pace",color:"var(--ok)",expectedPct:u,isDeficit:!1};if(c>0){const h=100-e,p=l>0?e/l:0,d=p>0?h/p:1/0,m={label:`${Math.round(c)}% ahead`,color:"var(--warn)",expectedPct:u,isDeficit:!0};if(d<o&&d<86400){const y=Math.floor(d/3600),w=Math.floor(d%3600/60);m.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return m}return{label:`${Math.round(-c)}% reserve`,color:"var(--ok)",expectedPct:u,isDeficit:!1}}function si({pct:e,label:n,reset:r,resetAt:i,windowSec:o,limitReached:l,nowSec:u}){const c=Math.min(100,Math.max(0,e)),p=l||c>=90?"var(--err)":c>=70?"var(--warn)":"var(--accent)",d=c===0?"< 1%":`${c}%`,m=c===0?2:c,y=i?r3(i,u):null,w=i&&o?s3(c,i,o,u):null;return g.jsxs("div",{className:"qb-row",children:[g.jsxs("div",{className:"qb-meta",children:[g.jsxs("span",{className:"qb-label",children:[n,l&&g.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),g.jsx("span",{className:"qb-pct",style:{color:p},children:d})]}),g.jsxs("div",{className:"qb-track",children:[g.jsx("div",{className:"qb-fill",style:{width:`${m}%`,background:p,opacity:c===0?.4:1}}),w&&g.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`})]}),g.jsxs("div",{className:"qb-reset-row",children:[y?g.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):r?g.jsxs("span",{className:"qb-reset",children:["resets ",r]}):null,w&&g.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const i3=6e4;function o3(e){const[n,r]=j.useState(null),[i,o]=j.useState(!1),l=j.useRef(null),u=async(h=!1)=>{h&&o(!0);try{const d=await fetch(h?"/api/quota?refresh=1":"/api/quota");d.ok&&r(await d.json())}catch{}finally{h&&o(!1)}};return j.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),i3),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{quota:n,loading:i,refresh:()=>{e&&u(!0)}}}function a3(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 CC=6e4;function l3(e){const[n,r]=j.useState(null),[i,o]=j.useState(!1),l=j.useRef(null),u=async(h=!1)=>{h&&o(!0);try{const d=await fetch(h?"/api/codex-quota?refresh=1":"/api/codex-quota");d.ok&&r(await d.json())}catch{}finally{h&&o(!1)}};return j.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),CC),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{data:n,loading:i,refresh:()=>{e&&u(!0)}}}function u3(e){const[n,r]=j.useState(null),i=j.useRef(null),o=async()=>{try{const l=await fetch("/api/codex-usage");l.ok&&r(await l.json())}catch{}};return j.useEffect(()=>{if(e)return o(),i.current=window.setInterval(o,CC),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:n}}function c3({state:e,now:n,providers:r,onClose:i}){var V,B;const{quota:o,loading:l,refresh:u}=o3(r.claude),{data:c,loading:h,refresh:p}=l3(r.codex),{data:d}=u3(r.codex),[m,y]=j.useState(()=>Math.floor(Date.now()/1e3));j.useEffect(()=>{const C=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(C)},[]);const{byModel:w,totalCost:N,totalTokens:_,burnRate:b}=j.useMemo(()=>{const C=new Map,q={total:0,input:0,output:0,cacheRead:0,cacheWrite:0};let L=0,re=0,Z=0,H=0;for(const $ of e.agents.values()){const Q=$.model??Ud,ne=dn($.usage,$.model),oe=C.get(Q);oe?(oe.inputTokens+=$.usage.inputTokens,oe.outputTokens+=$.usage.outputTokens,oe.cacheReadTokens+=$.usage.cacheReadTokens,oe.cacheCreateTokens+=$.usage.cacheCreateTokens,oe.cost.total+=ne.total,oe.cost.input+=ne.input,oe.cost.output+=ne.output,oe.cost.cacheRead+=ne.cacheRead,oe.cost.cacheWrite+=ne.cacheWrite,oe.agentCount++):C.set(Q,{model:Q,inputTokens:$.usage.inputTokens,outputTokens:$.usage.outputTokens,cacheReadTokens:$.usage.cacheReadTokens,cacheCreateTokens:$.usage.cacheCreateTokens,cost:{...ne},agentCount:1,priced:fo($.model)!=null}),q.total+=ne.total,q.input+=ne.input,q.output+=ne.output,q.cacheRead+=ne.cacheRead,q.cacheWrite+=ne.cacheWrite,L+=$.usage.inputTokens,re+=$.usage.outputTokens,Z+=$.usage.cacheReadTokens,H+=$.usage.cacheCreateTokens}const J=Array.from(C.values()).sort(($,Q)=>Q.cost.total-$.cost.total||Q.inputTokens+Q.outputTokens-($.inputTokens+$.outputTokens));let M=0,G=0;for(const $ of e.agents.values()){if($.state!=="active")continue;const Q=dn($.usage,$.model);M+=Q.total,G=Math.max(G,(($.endedAt??n)-$.startedAt)/1e3)}const Y=G>0?ku(M,G):null;return{byModel:J,totalCost:q,totalTokens:{in:L,out:re,cacheR:Z,cacheC:H},burnRate:Y}},[e,e.lastSeq,n]),S=j.useMemo(()=>{const C=[],q=L=>fo(L.model)==null?L.usage.inputTokens+L.usage.outputTokens:0;for(const L of e.agents.values()){if(L.kind!=="root")continue;let re=dn(L.usage,L.model).total,Z=L.usage.inputTokens,H=L.usage.outputTokens,J=q(L);for(const M of e.agents.values())M.sessionId!==L.sessionId||M.kind==="root"||(re+=dn(M.usage,M.model).total,Z+=M.usage.inputTokens,H+=M.usage.outputTokens,J+=q(M));C.push({sessionId:L.sessionId,label:L.label||L.cwdBasename||"session",state:L.state,cost:re,inputTokens:Z,outputTokens:H,unpricedTokens:J})}return C.sort((L,re)=>re.cost-L.cost||re.inputTokens+re.outputTokens-(L.inputTokens+L.outputTokens)).slice(0,12)},[e,e.lastSeq]),k=N.total>0,E=_.in+_.out,T=w.filter(C=>C.cost.total>0||C.inputTokens+C.outputTokens>0),I=S.filter(C=>C.cost>0||C.inputTokens+C.outputTokens>0),O=T.some(C=>!C.priced),A=l||h,U=Jx(o==null?void 0:o.fetchedAt,m),z=Jx(c==null?void 0:c.fetchedAt,m),P=()=>{u(),p()},D=r.claude&&r.codex?"Refresh Claude + Codex quota":r.codex?"Refresh Codex quota":"Refresh Claude quota";return g.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[g.jsxs("div",{className:"up-header",children:[g.jsx("h2",{children:"Usage"}),b&&g.jsx("span",{className:"up-rate",children:b}),g.jsxs("div",{className:"up-header-right",children:[(r.claude||r.codex)&&g.jsx("button",{type:"button",className:"btn up-refresh-btn",onClick:P,disabled:A,"aria-label":D,title:D,children:A?"…":"↻"}),g.jsx("button",{type:"button",className:"btn icon-btn up-close",onClick:i,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),r.claude&&g.jsxs("section",{className:"up-section up-quota-section",children:[g.jsxs("h3",{className:"up-section-title",children:["Claude quota",U&&!l&&g.jsx("span",{className:"up-section-age",title:t3(o==null?void 0:o.source),children:U})]}),o!=null&&o.ok?g.jsxs("div",{className:"up-quota-bars",children:[o.session5hPct!=null&&g.jsx(si,{label:"5-hour window",pct:o.session5hPct,reset:o.session5hReset,resetAt:o.session5hResetAt,windowSec:o.session5hWindowSec,nowSec:m}),o.week7dPct!=null&&g.jsx(si,{label:"7-day window",pct:o.week7dPct,reset:o.week7dReset,resetAt:o.week7dResetAt,windowSec:o.week7dWindowSec,nowSec:m}),o.weekSonnetPct!=null&&g.jsx(si,{label:"Sonnet (7d)",pct:o.weekSonnetPct,nowSec:m}),o.weekOpusPct!=null&&g.jsx(si,{label:"Opus (7d)",pct:o.weekOpusPct,nowSec:m})]}):(o==null?void 0:o.ok)===!1?g.jsxs("div",{className:"up-quota-na",children:[g.jsx("span",{children:"Quota unavailable."}),g.jsxs("span",{className:"up-quota-hint",children:["Run ",g.jsx("code",{children:"/usage"})," in a claude session, then click ↻"]})]}):g.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),r.codex&&g.jsxs("section",{className:"up-section up-quota-section",children:[g.jsxs("h3",{className:"up-section-title",children:["Codex quota",(c==null?void 0:c.ok)&&c.planLabel&&g.jsx("span",{className:"up-plan-badge",children:c.planLabel}),z&&!h&&g.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:z})]}),c!=null&&c.ok?g.jsxs("div",{className:"up-quota-bars",children:[(V=c.windows)==null?void 0:V.map(C=>g.jsx(si,{label:C.label,pct:C.pct,reset:C.reset??void 0,resetAt:C.resetAt??void 0,windowSec:C.windowSec??void 0,limitReached:c.limitReached&&C.pct>=100,nowSec:m},C.id)),(B=c.extraWindows)==null?void 0:B.map(C=>g.jsx(si,{label:C.label,pct:C.pct,reset:C.reset??void 0,resetAt:C.resetAt??void 0,windowSec:C.windowSec??void 0,nowSec:m},C.id)),c.creditLimit&&g.jsx(si,{label:`spend cap · $${Math.round(c.creditLimit.used)} of $${Math.round(c.creditLimit.limit)}`,pct:c.creditLimit.usedPct,reset:c.creditLimit.reset??void 0,resetAt:c.creditLimit.resetAt??void 0,limitReached:c.spendControlReached,nowSec:m}),c.creditsBalance&&!c.creditsUnlimited&&g.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",c.creditsBalance,c.overageReached&&" · overage limit reached"]}),c.creditsUnlimited&&g.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),c.resetCredits&&c.resetCredits.availableCount>0&&g.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${en} only reports them`,children:[c.resetCredits.availableCount," rate-limit reset",c.resetCredits.availableCount!==1?"s":""," available",c.resetCredits.nextExpiryAt&&` · expires ${new Date(c.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),c.promo&&g.jsx("div",{className:"up-quota-sub",children:c.promo}),c.partial&&g.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(c==null?void 0:c.ok)===!1?g.jsxs("div",{className:"up-quota-na",children:[g.jsx("span",{children:"Quota unavailable."}),g.jsx("span",{className:"up-quota-hint",children:a3(c.reason)})]}):g.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(d==null?void 0:d.ok)&&d.window7d&&d.window7d.sessionCount>0&&g.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${d.window5h?`
66
- last 5h: ${qt(d.window5h.totalTokens)} tokens · ${d.window5h.sessionCount} session${d.window5h.sessionCount!==1?"s":""}`:""}`,children:[qt(d.window7d.totalTokens)," tokens · ",d.window7d.sessionCount," session",d.window7d.sessionCount!==1?"s":""," (7d)"]})]}),E>0?g.jsxs(g.Fragment,{children:[k&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"up-total",children:[g.jsx("span",{className:"up-total-value",children:De(N.total)}),g.jsx("span",{className:"up-total-label",children:"total spend"})]}),g.jsx(n3,{cost:N})]}),g.jsxs("div",{className:"up-tokens-row",children:[g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"in"}),qt(_.in)]}),g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"out"}),qt(_.out)]}),_.cacheR>0&&g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"cache r"}),qt(_.cacheR)]}),_.cacheC>0&&g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"cache c"}),qt(_.cacheC)]})]}),T.length>0&&g.jsxs("section",{className:"up-section",children:[g.jsx("h3",{className:"up-section-title",children:"By model"}),g.jsxs("table",{className:"up-table",children:[g.jsx("thead",{children:g.jsxs("tr",{children:[g.jsx("th",{children:"Model"}),g.jsx("th",{children:"Tokens"}),g.jsx("th",{children:"Cost"})]})}),g.jsx("tbody",{children:T.map(C=>g.jsxs("tr",{children:[g.jsx("td",{className:"up-model-name",title:C.model===Ud?"no model reported yet":C.model,children:C.model===Ud?"unknown":Ns(C.model)}),g.jsx("td",{className:"up-num",children:qt(C.inputTokens+C.outputTokens)}),C.priced?g.jsx("td",{className:"up-num up-cost-val",children:De(C.cost.total)}):g.jsx("td",{className:"up-num up-unpriced",children:fu})]},C.model))})]})]}),I.length>0&&g.jsxs("section",{className:"up-section",children:[g.jsx("h3",{className:"up-section-title",children:"By session"}),g.jsx("div",{className:"up-sessions",children:I.map(C=>g.jsxs("div",{className:"up-session-row",children:[g.jsx("span",{className:`sl-dot state-${C.state}`,"aria-hidden":!0}),g.jsx("span",{className:"vis-hidden",children:ry(C.state)}),g.jsx("span",{className:"up-session-label",children:C.label}),g.jsx("span",{className:"up-session-tokens",children:qt(C.inputTokens+C.outputTokens)}),C.cost>0?g.jsxs("span",{className:"up-session-cost",title:C.unpricedTokens>0?`${qt(C.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[De(C.cost),C.unpricedTokens>0?"+":""]}):g.jsx("span",{className:"up-session-cost up-unpriced",children:fu})]},C.sessionId))})]}),O&&g.jsxs("div",{className:"up-hint",children:["“",fu,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):g.jsxs("div",{className:"up-empty",children:["No usage data yet.",g.jsx("br",{}),"Start a Claude Code or Codex session."]})]})}const e_=18,d3=1100,Ji=(e,n)=>{const r=Math.sin(e*12.9898+n*78.233)*43758.5453;return r-Math.floor(r)},f3=Array.from({length:e_},(e,n)=>{const r=-72+144*n/(e_-1)+(Ji(n,1)-.5)*9,i=(r-90)*(Math.PI/180),o=(54+32*Math.cos(r*Math.PI/180))*(.74+Ji(n,2)*.52);return{dx:Math.cos(i)*o,dy:Math.sin(i)*o,rot:(n%2?1:-1)*(100+Ji(n,3)*260),delay:Math.round(Ji(n,4)*90),dur:760+Math.round(Ji(n,5)*260),scale:.8+Ji(n,6)*.45,hue:n%4,round:n%3===0}});function t_({anchor:e,lifetimeMs:n=d3}){var l;const[r,i]=j.useState(null),o=typeof window<"u"&&((l=window.matchMedia)==null?void 0:l.call(window,"(prefers-reduced-motion: reduce)").matches);return j.useEffect(()=>{if(o)return;const u=e.current;if(!u)return;const c=u.getBoundingClientRect();i({x:c.left+c.width/2,y:c.top+c.height/2});const h=window.setTimeout(()=>i(null),n);return()=>window.clearTimeout(h)},[e,n,o]),o||!r?null:UI.createPortal(g.jsx("div",{className:"confetti",style:{left:`${r.x}px`,top:`${r.y}px`},"aria-hidden":!0,children:f3.map((u,c)=>g.jsx("span",{className:`confetti-bit${u.round?" round":""}`,"data-hue":u.hue,style:{"--dx":`${u.dx.toFixed(1)}px`,"--dy":`${u.dy.toFixed(1)}px`,"--rot":`${u.rot}deg`,"--s":u.scale.toFixed(2),animationDelay:`${u.delay}ms`,animationDuration:`${u.dur}ms, ${u.dur}ms`}},c))}),document.body)}const TC=new Set(["awaiting_url","awaiting_code","registering"]);function h3(e){return e!=null&&TC.has(e)}function RC(e){return e!=null&&e!=="done"&&!TC.has(e)}const p3="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",m3="the sign-in did not complete";function g3({state:e,serverError:n,localError:r}){const i=e==="idle";return{title:i?"Sign-in ended":"Sign-in failed",message:r||n||(i?p3:m3)}}const v3="done";function y3(){let e=!1;return{shouldAnnounce(n){return n!==v3?(e=!1,!1):e?!1:(e=!0,!0)}}}const n_={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 ccdeck1:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${en}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",bad_value:"an alias can only use letters, numbers, spaces, dots, dashes and underscores, up to 64 characters"},r_={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"},w3=`claude-swap could not read the login keychain — start ${en} from a Terminal window rather than a background service`;function jv(e,n){return(e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(ho(e))?w3:e!=null&&e.reason&&r_[e.reason]?r_[e.reason]:(e==null?void 0:e.reason)||n}function ho(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const s_={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",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"},x3="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 _3(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}function b3(e,n){return _3(ho(e))?x3:e!=null&&e.reason&&s_[e.reason]?s_[e.reason]:(e==null?void 0:e.reason)||n}function hu(e,n){return e!=null&&e.detail?e.detail:e!=null&&e.error&&RC(e.state)?e.error:e!=null&&e.reason&&n_[e.reason]?n_[e.reason]:e!=null&&e.error?e.error:(e==null?void 0:e.reason)||n}const S3=1500;async function nu(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Av=ue.forwardRef((e,n)=>g.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:n,children:[g.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),g.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));Av.displayName="SuccessMark";function k3({onClose:e,onChanged:n}){const[r,i]=j.useState("login"),[o,l]=j.useState(null),[u,c]=j.useState(""),[h,p]=j.useState(""),[d,m]=j.useState(!1),[y,w]=j.useState(null),[N,_]=j.useState(null),b=j.useRef(!1),S=j.useRef(null),k=j.useRef(null),E=j.useRef(null),T=j.useRef(null),I=j.useCallback(()=>{b.current&&nu({action:"login-cancel"}).catch(()=>{}),e()},[e]),O=mo(I,{focusRef:E}),A=j.useCallback(async()=>{m(!0),w(null),b.current=!0;const q=await nu({action:"login"}).catch(()=>null);if(m(!1),!(q!=null&&q.ok)){w(hu(q,"could not start the sign-in"));return}l(q)},[]);j.useEffect(()=>{if(!h3(o==null?void 0:o.state))return;const q=window.setInterval(async()=>{try{const L=await fetch("/api/claude-accounts/login");L.ok&&l(await L.json())}catch{}},S3);return()=>window.clearInterval(q)},[o]);const U=j.useRef(n);U.current=n;const z=j.useRef(y3());j.useEffect(()=>{var q;(o==null?void 0:o.state)==="awaiting_code"&&((q=S.current)==null||q.focus()),z.current.shouldAnnounce(o==null?void 0:o.state)&&U.current()},[o==null?void 0:o.state]),j.useEffect(()=>{var q;r==="paste"&&((q=k.current)==null||q.focus())},[r]);const P=j.useCallback(async()=>{var L;m(!0),w(null);const q=await nu({action:"login-code",code:u}).catch(()=>null);if(m(!1),!(q!=null&&q.ok)){w(hu(q,"the code was not accepted")),q!=null&&q.state&&l(q),(L=S.current)==null||L.select();return}c(""),l(q)},[u,o]),D=j.useCallback(async()=>{m(!0),w(null);const q=await nu({action:"import",blob:h}).catch(()=>null);if(m(!1),!(q!=null&&q.ok)){w(hu(q,"the import failed"));return}p(""),_({added:q.added===!0,num:q.num??null,email:q.email??null}),n()},[h,n]),V=(o==null?void 0:o.state)==="done"?o.account:null,B=RC(o==null?void 0:o.state)||!!(y&&b.current&&!d),C=g3({state:o==null?void 0:o.state,serverError:o==null?void 0:o.error,localError:y});return g.jsx("div",{className:"modal-backdrop",onClick:I,role:"presentation",children:g.jsxs("div",{ref:O,className:"modal aa-modal",onClick:q=>q.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[g.jsxs("header",{className:"modal-head",children:[g.jsx("div",{className:"modal-title",children:g.jsxs("span",{className:"aa-tabs",role:"tablist",children:[g.jsx("button",{type:"button",role:"tab","aria-selected":r==="login",className:`aa-tab${r==="login"?" on":""}`,onClick:()=>i("login"),children:"Sign in"}),g.jsx("button",{type:"button",role:"tab","aria-selected":r==="paste",className:`aa-tab${r==="paste"?" on":""}`,onClick:()=>i("paste"),children:"Paste a share"})]})}),g.jsx("div",{className:"modal-actions",children:g.jsx("button",{type:"button",className:"btn icon-btn",onClick:I,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),g.jsx("section",{className:"modal-body aa-body",children:r==="login"?V?g.jsxs("div",{className:"aa-done",children:[g.jsx(Av,{ref:T}),g.jsx(t_,{anchor:T}),g.jsx("h4",{children:V.added?`Account ${V.num} added`:"Credentials refreshed"}),g.jsxs("p",{className:"aa-note",children:[g.jsx("strong",{children:V.email}),V.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),g.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(o==null?void 0:o.state)==="awaiting_code"||(o==null?void 0:o.state)==="registering"?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"1 · Approve in the browser"}),g.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),g.jsx("a",{className:"aa-link",href:o.url??"#",target:"_blank",rel:"noreferrer noopener",children:o.url})]}),g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"2 · Paste the code it gives you"}),g.jsxs("div",{className:"aa-field",children:[g.jsx("input",{ref:S,type:"text",value:u,onChange:q=>c(q.target.value),onKeyDown:q=>{q.key==="Enter"&&u.trim()&&!d&&P()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:o.state==="registering"}),g.jsx("button",{type:"button",className:"btn primary",disabled:d||!u.trim()||o.state==="registering",onClick:P,children:o.state==="registering"?"registering…":"Continue"})]}),(y||o.error)&&g.jsx("p",{className:"aa-err",children:y??o.error}),g.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."})]})]}):B?g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:C.title}),g.jsx("p",{className:"aa-err",children:C.message}),g.jsx("button",{type:"button",className:"btn",onClick:()=>{b.current=!1,l(null),w(null),A()},children:"Try again"})]}):d||b.current?g.jsx("div",{className:"aa-step",children:g.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):g.jsxs("div",{className:"aa-step aa-primer",children:[g.jsx("h4",{children:"Sign in to Anthropic"}),g.jsx("p",{className:"aa-note",children:"Opens a browser tab where you approve the sign-in, then asks for the code it shows you. claude-swap records the account when it completes, and the account you are using now stays active."}),g.jsx("div",{className:"aa-actions",children:g.jsx("button",{type:"button",ref:E,className:"btn primary",onClick:A,disabled:d,children:"Open the sign-in page"})})]}):N?g.jsxs("div",{className:"aa-done",children:[g.jsx(Av,{ref:T}),N.added&&g.jsx(t_,{anchor:T}),g.jsx("h4",{children:N.added?`Account ${N.num} imported`:"Already here"}),g.jsx("p",{className:"aa-note",children:N.added?g.jsxs(g.Fragment,{children:[N.email?g.jsx("strong",{children:N.email}):"That account"," is in the rotation now. Nothing changed on the deck you copied it from."]}):"This deck already holds that account, so nothing changed."}),g.jsxs("div",{className:"aa-actions",children:[g.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),g.jsx("button",{type:"button",className:"btn",onClick:()=>_(null),children:"Import another"})]})]}):g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"Paste an account shared from another deck"}),g.jsxs("div",{className:"aa-field",children:[g.jsx("input",{ref:k,type:"text",value:h,onChange:q=>p(q.target.value),onKeyDown:q=>{q.key==="Enter"&&h.trim()&&!d&&D()},placeholder:"ccdeck1:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),g.jsx("button",{type:"button",className:"btn primary",disabled:d||!h.trim(),onClick:D,children:d?"importing…":"Import"})]}),y&&g.jsx("p",{className:"aa-err",children:y}),g.jsxs("p",{className:"aa-note",children:["Use ",g.jsx("strong",{children:"share"})," on an account in the other deck. A share carries a live login and expires ten minutes after it is made."]})]})})]})})}function E3(e,n){const r=new Set(e),i=e.length?Math.max(...e):0;return[...new Set([...e,i+1])].sort((o,l)=>o-l).map(o=>{const l=o===n?"here":r.has(o)?"swap":"free";return{slot:o,kind:l,label:l==="here"?`slot ${o}`:`slot ${o} · ${l}`}})}function N3(e,n,r){if(!(r!=null&&r.ok))return null;const i=Number.isInteger(r.to)?r.to:null;if(i==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const o=r.swapped===!0&&i!==n;return{menuFor:e.menuFor===n?i:o&&e.menuFor===i?n:e.menuFor,confirmRemove:null,shareFor:null,swapNote:o?{at:i,displaced:n}:null}}const C3=64;function T3(e,n){const r=e.trim();return{alias:r,commit:r!==(n??"").trim()}}const R3=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function i_(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function j3(e){const n=e.find(i=>!i.ok);if(!n)return null;const r=ho(n.body);return{text:jv(n.body,`the deck server answered ${n.status}`),...r?{raw:r}:{},reload:!0}}function o_(e,n){return n?e!=null&&e.reload&&e.text===n.text&&e.raw===n.raw?e:n:e!=null&&e.reload?null:e}const a_=15e3,A3=8e3,I3=1800,M3=3e4,O3=[70,80,85,90,95];function P3(e,n){const r=e-n;if(r<=0)return null;const i=Math.floor(r/86400),o=Math.floor(r%86400/3600),l=Math.floor(r%3600/60);return i>0?`${i}d ${o}h`:o>0?`${o}h ${l}m`:`${l}m`}function l_(e,n){const r=n-Math.floor(e/1e3);return r<60?"just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}function L3(e,n){if(!e)return"";const r=Math.floor(e/1e3)-n;return r<=0?" · due":r<60?` · next in ${r}s`:` · next in ${Math.round(r/60)}m`}function $3(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 q3({lane:e,nowSec:n}){const r=Math.min(100,Math.max(0,e.pct)),i=r>=90?"var(--err)":r>=70?"var(--warn)":"var(--accent)",o=e.resetAt?P3(e.resetAt,n):null;return g.jsxs("div",{className:"ap-lane",children:[g.jsx("span",{className:"ap-lane-label",children:e.label}),g.jsx("div",{className:"ap-lane-track",children:g.jsx("div",{className:"ap-lane-fill",style:{width:`${r===0?1.5:r}%`,background:i,opacity:r===0?.4:1}})}),g.jsxs("span",{className:"ap-lane-pct",style:{color:i},children:[r,"%"]}),g.jsx("span",{className:"ap-lane-reset",children:o?`resets ${o}`:""})]})}async function D3(e){var r;let n=!1;try{n=await Promise.race([((r=navigator.clipboard)==null?void 0:r.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(i=>window.setTimeout(()=>i(!1),500))])}catch{n=!1}if(n)return!0;try{const i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(i),i.select(),n=document.execCommand("copy"),i.remove()}catch{n=!1}return n}function F3(e,n){const r=Math.round(e/1e3)-n;return r<=0?{text:"expired",tone:"gone"}:r<60?{text:`expires in ${r}s`,tone:"soon"}:{text:`expires in ${Math.round(r/60)}m`,tone:"ok"}}function z3({onClose:e}){var ne,oe,fe;const[n,r]=j.useState(null),[i,o]=j.useState(null),[l,u]=j.useState(null),[c,h]=j.useState(!1),[p,d]=j.useState(null),[m,y]=j.useState(null),[w,N]=j.useState(()=>Math.floor(Date.now()/1e3)),_=j.useRef(null),[b,S]=j.useState(null),[k,E]=j.useState(!1),[T,I]=j.useState(""),[O,A]=j.useState(null),[U,z]=j.useState(null),[P,D]=j.useState(null),[V,B]=j.useState(!1),[C,q]=j.useState(null),L=j.useCallback(async(te=!1)=>{te&&h(!0);const ce=new AbortController,Ce=window.setTimeout(()=>ce.abort(),M3);try{const[ve,je]=await Promise.all([fetch(`/api/claude-accounts${te?"?refresh=1":""}`,{signal:ce.signal}),fetch("/api/cswap-auto",{signal:ce.signal})]);ve.ok&&r(await ve.json()),je.ok&&o(await je.json());const ye=j3([await i_(ve),await i_(je)]);y(ke=>o_(ke,ye))}catch{y(ve=>o_(ve,R3))}finally{window.clearTimeout(Ce),te&&h(!1)}},[]),re=j.useCallback(async(te,ce)=>{u(ce),y(null);try{const ve=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return ve!=null&&ve.ok||y({text:jv(ve,"command failed"),raw:ho(ve)}),ve}catch{return y({text:"server unreachable"}),null}finally{u(null)}},[]),Z=j.useCallback(async(te,ce)=>{u(ce),y(null);try{const ve=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return ve!=null&&ve.ok||y({text:hu(ve,"command failed")}),ve}catch{return y({text:"server unreachable"}),null}finally{u(null)}},[]);j.useEffect(()=>(L(!0),_.current=window.setInterval(()=>L(!1),a_),()=>{_.current!=null&&window.clearInterval(_.current)}),[L]),j.useEffect(()=>{const te=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(te)},[]);const H=((ne=i==null?void 0:i.settings["autoswitch.threshold"])==null?void 0:ne.value)??"90",J=(oe=n==null?void 0:n.accounts)==null?void 0:oe.find(te=>te.active),M=J!=null&&J.lanes.length?Math.max(...J.lanes.map(te=>te.pct)):null,G=M!=null&&M>=Number(H)-15,Y=async te=>{d(te),y(null);try{const Ce=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:te})})).json().catch(()=>null);Ce!=null&&Ce.ok||y({text:jv(Ce,"the switch failed"),raw:ho(Ce)}),await L(!0)}catch{y({text:"server unreachable"})}finally{d(null)}},$=async(te,ce)=>{const{commit:Ce,alias:ve}=T3(T,ce);if(Ce){const je=await Z({action:"alias",account:te,alias:ve},`alias-${te}`);if(await L(!0),!(je!=null&&je.ok))return;I(ve)}A(te),window.setTimeout(()=>A(je=>je===te?null:je),I3)},Q=async(te,ce)=>{const Ce=await Z({action:"move",account:te,slot:ce},`move-${te}`),ve=N3({menuFor:b,shareFor:(P==null?void 0:P.num)??null},te,Ce);if(await L(!0),ve){S(ve.menuFor),z(ve.confirmRemove),ve.shareFor==null&&(D(null),B(!1)),q(ve.swapNote);const je=ve.swapNote;je&&window.setTimeout(()=>q(ye=>ye===je?null:ye),A3)}};return g.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[g.jsxs("div",{className:"ap-header",children:[g.jsx("h2",{children:"Accounts"}),g.jsxs("div",{className:"ap-header-right",children:[g.jsx("button",{type:"button",className:"btn ap-add",onClick:()=>E(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),g.jsx("button",{type:"button",className:"btn ap-refresh",onClick:()=>L(!0),disabled:c,"aria-label":"Reload accounts",title:"Reload from claude-swap",children:c?"…":"↻"}),g.jsx("button",{type:"button",className:"btn icon-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),n==null?m?g.jsxs("div",{className:"ap-empty",role:"alert",children:[g.jsx("span",{title:m.raw||void 0,children:m.text}),g.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",a_/1e3," seconds."]}),g.jsx("button",{type:"button",className:"ap-fix",disabled:c,onClick:()=>L(!0),children:c?"trying…":"try again"})]}):g.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?g.jsxs(g.Fragment,{children:[(fe=n.accounts)==null?void 0:fe.map(te=>g.jsxs("div",{className:`ap-account${te.active?" active":""}${te.disabled?" disabled":""}`,children:[g.jsxs("div",{className:"ap-account-head",children:[g.jsx("span",{className:"ap-num",children:te.num}),te.alias&&g.jsx("span",{className:"ap-alias",title:te.alias,children:te.alias}),g.jsx("span",{className:"ap-email",title:te.org??void 0,children:te.email}),g.jsx("button",{type:"button",className:`ap-more${b===te.num?" on":""}`,"aria-label":`Manage account ${te.num}`,"aria-expanded":b===te.num,"aria-controls":b===te.num?`ap-manage-${te.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{S(b===te.num?null:te.num),I(te.alias??""),z(null),D(null),B(!1),q(null),A(null)},children:"⋯"}),te.active?g.jsx("span",{className:"ap-badge-active",children:"● active"}):g.jsx("button",{type:"button",className:"btn ap-switch",disabled:p!=null||te.disabled,onClick:()=>Y(te.num),title:te.disabled?"Held out of rotation":`Switch to ${te.alias??te.email}`,children:p===te.num?"…":"switch"})]}),te.lanes.length>0?te.lanes.map(ce=>g.jsx(q3,{lane:ce,nowSec:w},ce.id)):g.jsx("div",{className:"ap-hint",children:"No usage recorded yet."}),g.jsxs("div",{className:"ap-meta",children:[te.error&&(()=>{const ce=$3(te.error);return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"ap-err",title:ce.hint,children:ce.text}),ce.fixable&&g.jsx("button",{type:"button",className:"ap-fix",onClick:()=>E(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),((i==null?void 0:i.enabled)||(i==null?void 0:i.external))&&!te.active&&g.jsx("button",{type:"button",className:"ap-rotate",disabled:l!=null,onClick:()=>re({action:"account",account:te.num,enabled:te.disabled},`rot-${te.num}`).then(()=>L(!0)),title:te.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:te.disabled?"held out":"in rotation"}),te.fetchedAt?g.jsxs("span",{className:`ap-age${te.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 ",l_(te.fetchedAt,w),L3(te.nextAt,w)]}):g.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),b===te.num&&g.jsxs("div",{className:"ap-manage",id:`ap-manage-${te.num}`,role:"group","aria-label":`Manage account ${te.num}`,children:[g.jsxs("div",{className:"ap-manage-name",children:[g.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${te.num}`,children:"Alias"}),g.jsx("input",{id:`ap-alias-${te.num}`,className:"ap-manage-input",type:"text",value:T,onChange:ce=>I(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"&&$(te.num,te.alias)},maxLength:C3,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,onClick:()=>$(te.num,te.alias),title:"A short name to show instead of the email",children:O===te.num?"saved":"save"})]}),g.jsxs("div",{className:"ap-manage-acts",children:[g.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${te.num}`,children:"Slot"}),g.jsx("span",{className:"ap-field",children:g.jsx("select",{id:`ap-slot-${te.num}`,value:String(te.num),disabled:l!=null,onChange:ce=>Q(te.num,Number(ce.target.value)),children:E3((n.accounts??[]).map(ce=>ce.num),te.num).map(ce=>g.jsx("option",{value:ce.slot,children:ce.label},ce.slot))})}),g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,title:`Copy this account to another ${en}. 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()=>{B(!1);const ce=await Z({action:"share",account:te.num},`share-${te.num}`);ce!=null&&ce.ok&&D({num:te.num,blob:ce.blob,expiresAt:ce.expiresAt})},children:"share"}),g.jsx("button",{type:"button",className:`ap-manage-btn danger${U===te.num?" armed":""}`,disabled:l!=null,title:U===te.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(U!==te.num){z(te.num),window.setTimeout(()=>z(ce=>ce===te.num?null:ce),4e3);return}z(null),Z({action:"remove",account:te.num},`rm-${te.num}`).then(()=>{S(null),L(!0)})},children:U===te.num?"confirm":"remove"})]}),(C==null?void 0:C.at)===te.num&&(()=>{var ve;const ce=(ve=n.accounts)==null?void 0:ve.find(je=>je.num===C.displaced),Ce=(ce==null?void 0:ce.alias)??(ce==null?void 0:ce.email)??"the account that was there";return g.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${C.at} was taken, so the two accounts traded places: ${Ce} now holds slot ${C.displaced}.`,children:["swapped with slot ",C.displaced]})})(),(P==null?void 0:P.num)===te.num&&(()=>{const ce=F3(P.expiresAt,w),Ce=ce.tone==="gone";return g.jsxs("div",{className:`ap-share${Ce?" expired":""}`,children:[g.jsx("code",{className:"ap-share-blob",children:P.blob}),g.jsxs("div",{className:"ap-share-foot",children:[g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,onClick:async()=>{if(Ce){B(!1);const ve=await Z({action:"share",account:te.num},`share-${te.num}`);ve!=null&&ve.ok&&D({num:te.num,blob:ve.blob,expiresAt:ve.expiresAt});return}await D3(P.blob)&&(B(!0),window.setTimeout(()=>B(!1),1800))},children:Ce?"make a new share":V?"copied":"copy"}),g.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:[g.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",g.jsx("span",{className:`ap-share-expiry ${ce.tone}`,children:ce.text})]})]})]})})()]})]},te.num)),(i==null?void 0:i.ok)&&g.jsxs("div",{className:"ap-auto",children:[g.jsxs("div",{className:"ap-auto-head",children:[g.jsx("span",{className:"ap-auto-title",children:"Auto-switch"}),g.jsxs("span",{className:"ap-auto-ctl",children:[M!=null&&g.jsxs("span",{className:`ap-auto-now${G?" near":""}`,children:[Math.round(M),"%"]}),g.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:g.jsx("select",{"aria-label":"Switch threshold",value:H,disabled:l!=null,onChange:te=>re({action:"setting",key:"autoswitch.threshold",value:te.target.value},"threshold").then(()=>L(!0)),children:O3.map(te=>g.jsxs("option",{value:te,children:[te,"%"]},te))})}),g.jsxs("button",{type:"button",className:`ap-auto-state${i.enabled?" live":""}`,role:"switch","aria-checked":i.enabled,disabled:l!=null,onClick:()=>re({action:"enable",enabled:!i.enabled},"enable").then(()=>L(!0)),title:i.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[g.jsx("i",{className:i.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),i.enabled?"on":"off"]})]})]}),i.external&&g.jsxs("p",{className:"ap-auto-note",children:[g.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",g.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",i.enabled?" — this toggle takes over when you stop it.":"."]}),i.lastTick&&g.jsx("div",{className:"ap-auto-foot",children:g.jsxs("span",{className:"ap-auto-result",children:["checked ",l_(i.lastTick.at,w)]})})]}),m&&g.jsxs("div",{className:"ap-failure",role:"alert",children:[g.jsx("span",{className:"ap-failure-text",title:m.raw||void 0,children:m.text}),g.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>y(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),g.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:"Collected by claude-swap while this panel is open."})]}):g.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"claude-swap isn't installed."}),g.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),n.hint&&g.jsx("code",{className:"ap-cmd",children:n.hint}),g.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",g.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"No accounts added yet."}),g.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",g.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"Couldn't read the account store."}),g.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})}),k&&g.jsx(k3,{onClose:()=>E(!1),onChanged:()=>L(!0)})]})}const B3=3e4;function U3({bundle:e,running:n,lastTried:r}){return!n||e===n?!1:r!==n}function H3({bundle:e,running:n,pending:r,lastTried:i}){return n?U3({bundle:e,running:n,lastTried:i})?"reload":r==null||r&&r!==n?"wait":"confirm":"wait"}function W3(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function V3({asked:e,reported:n}){return n?n!==e:!1}function G3(e){const n=e.thresholdMs??B3;return!e.enabled||e.kind!=="restart"||!e.canRestart?{idleSince:null,restart:!1}:e.busy?{idleSince:null,restart:!1}:e.idleSince==null?{idleSince:e.now,restart:!1}:e.now<e.idleSince?{idleSince:e.now,restart:!1}:{idleSince:e.idleSince,restart:e.now-e.idleSince>=n}}function Y3({agentCount:e,onConfirm:n,onCancel:r}){const i=j.useRef(null),o=mo(r,{focusRef:i,layer:IP}),l=e===0?"This deletes the server's event log":`This removes ${e===1?"the one agent":`all ${e} agents`} on the canvas and deletes the server's event log`;return g.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:g.jsxs("div",{ref:o,className:"modal clear-confirm",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[g.jsxs("header",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:"status-dot err","aria-hidden":!0}),g.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),g.jsx("div",{className:"modal-actions",children:g.jsx("button",{type:"button",className:"btn icon-btn",onClick:r,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),g.jsxs("section",{className:"modal-body",children:[g.jsxs("p",{className:"modal-note",children:[l," — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone."]}),g.jsxs("div",{className:"cc-actions",children:[g.jsx("button",{type:"button",ref:i,className:"btn",onClick:r,children:"Cancel"}),g.jsx("button",{type:"button",className:"btn danger",onClick:n,children:"Clear everything"})]})]})]})})}function K3(e,n){return e==="confirmation"?n.confirmOpen?"clear":"ignore":n.modalOpen||n.confirmOpen?"ignore":"confirm"}function X3(e){return e.slice().sort((n,r)=>n.y-r.y||n.x-r.x)}function Q3(e,n,r){var u;if(e.length===0)return null;const i=X3(e),o=n?i.findIndex(c=>c.id===n):-1,l=o===-1?r===1?0:i.length-1:(o+r+i.length)%i.length;return((u=i[l])==null?void 0:u.id)??null}const Z3=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function J3(e,n){return n==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:n,additive:e.shiftKey}:Z3.has(e.key)?{kind:"node",nodeId:n}:{kind:"deck",nodeId:n}}const e$=new Set(["","BODY","HTML","#DOCUMENT"]);function t$(e){return!e||ny(e)?!1:!e$.has(String(e.tagName??"").toUpperCase())}function ru(e,n){if(n.size!==0)for(const r of Array.from(e.keys()))n.has(r)||e.delete(r)}function n$(e){const n=new Set;for(const r of e)n.add(r.id),n.add(`group:${r.sessionId}`);return n}function jC(e,n,r){return!n.has(e)||r.has(e)}function r$(e,n,r,i){return!n.has(e)&&jC(e,r,i)}function s$(e,n,r){const i={x:0,y:0};return n.set(e,i),r.add(e),i}function i$(e,n,r,i){r.set(e,n),i.delete(e)}const o$=40,a$=120;function l$(e,n){let r=null,i=0,o=Number.NEGATIVE_INFINITY;const l=()=>{r=null,o=n.now(),e()},u=()=>{r!=null&&(n.clearTimeout(r),r=null)},c=(h,p,d)=>{if(r!=null){if(i<=h)return;u()}const m=Math.min(d,Math.max(0,h-p));i=h,r=n.setTimeout(l,m)};return{live(h=o$){const p=n.now(),d=Math.max(o+h,p);if(d<=p){u(),l();return}c(d,p,h)},replay(h=a$){u(),i=n.now()+h,r=n.setTimeout(l,h)},flush(){u(),l()},cancel(){u()}}}function u$(){let e=!1,n=[];return{get paused(){return e},get size(){return n.length},accept(r){return e?(n.push(r),!1):!0},setPaused(r){if(e=r,r||n.length===0)return[];const i=n;return n=[],i}}}const c$="1",u_="agent-dag.schema",d$=["agent-dag.layout","agent-dag.viewport"];function AC(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function f$(e,n=c$){let r=null;try{r=e.getItem(u_)}catch{return[]}if(r===n)return[];const i=[];if(r!==null)for(const o of d$)try{e.getItem(o)!==null&&(e.removeItem(o),i.push(o))}catch{}try{e.setItem(u_,n)}catch{}return i}const IC="agent-dag.theme";function h$(e){return e==="light"?"light":"dark"}function p$(){return h$(AC(IC))}function m$({waiting:e,running:n}){return{title:e>0?`(${e}) ${en}`:en,icon:e>0?"waiting":n>0?"running":"idle"}}const Hd={waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Wd(e,n){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${n==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"/>`+(n==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const g$=Object.freeze({waiting:`data:image/svg+xml,${encodeURIComponent(Wd(Hd.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Wd(Hd.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Wd(Hd.idle,"idle"))}`}),v$="No sessions are waiting for you.";function y$(e){if(e.length===0)return"";const[n,...r]=e;if(r.length===0)return`${n.label} is waiting for your permission.`;const i=`${r.length} more session${r.length===1?"":"s"}`;return`${n.label} and ${i} are waiting for your permission.`}function w$(e,n){return n!==""?n:e===""?"":v$}function x$(){let e=0;return{begin(){const n=++e;return()=>n===e},cancel(){e++}}}function _$(e,n=new Date){return new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}function b$(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 su(e){const n=e.toLowerCase();return n.includes("opus")?"#c4b5fd":n.includes("sonnet")?"#7dd3fc":n.includes("haiku")?"#86efac":n.includes("gpt-5")||n.includes("gpt5")?"#fcd34d":n.includes("gpt")?"#fca5a5":n.includes("gemini")?"#a5b4fc":n.includes("codex")?"#fdba74":"#94a3b8"}const S$=[7,14,30,90];function k$(e){const[n,r]=j.useState(null),[i,o]=j.useState(!1),l=j.useRef(x$()).current,u=(c=!1)=>{const h=l.begin(),p=e;o(!0);const m=`/api/ccusage?since=${_$(p)}${c?"&refresh=1":""}`;fetch(m).then(y=>y.json()).then(y=>{h()&&r({range:p,resp:y})}).catch(()=>{h()&&r({range:p,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{h()&&o(!1)})};return j.useEffect(()=>(u(!1),()=>l.cancel()),[e]),{landed:n,loading:i,reload:()=>u(!0)}}function E$({onClose:e}){var T,I,O;const[n,r]=j.useState(30),[i,o]=j.useState(null),{landed:l,loading:u,reload:c}=k$(n),h=j.useRef(null),p=mo(e,{focusRef:h}),d=b$({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((T=l.resp.days)==null?void 0:T.length)??0}}),m=d.phase==="chart"?l.resp.days??[]:[],y=j.useMemo(()=>m.reduce((A,U)=>Math.max(A,U.totalCost),0),[m]),{totalCost:w,totalTok:N,inOut:_,cacheRead:b,modelCosts:S}=j.useMemo(()=>{let A=0,U=0,z=0,P=0;const D=new Map;for(const V of m){A+=V.totalCost,U+=V.totalTokens,z+=V.inputTokens+V.outputTokens,P+=V.cacheReadTokens;for(const B of V.modelBreakdowns)D.set(B.modelName,(D.get(B.modelName)??0)+B.cost)}return{totalCost:A,totalTok:U,inOut:z,cacheRead:P,modelCosts:D}},[m]),k=j.useMemo(()=>Array.from(S.entries()).sort((A,U)=>U[1]-A[1]),[S]),E=i?m.find(A=>A.period===i)??null:null;return g.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:g.jsxs("div",{ref:p,className:"uh-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[g.jsxs("header",{className:"uh-head",children:[g.jsxs("div",{className:"uh-titlewrap",children:[g.jsx("div",{className:"uh-title",children:"Usage history"}),g.jsx("div",{className:"uh-sub",children:"via ccusage · local Claude / Codex logs"})]}),g.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:S$.map(A=>g.jsxs("button",{type:"button","aria-pressed":n===A,className:`uh-range-btn${n===A?" on":""}`,onClick:()=>{r(A),o(null)},children:[A,"d"]},A))}),g.jsx("button",{className:"btn icon-btn uh-reload",onClick:c,disabled:u,title:"Re-run ccusage","aria-label":"Reload",children:u?"…":"↻"}),g.jsx("button",{ref:h,className:"uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),d.phase==="busy"?g.jsx("div",{className:"uh-status","aria-busy":"true",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}):d.phase==="error"?g.jsxs("div",{className:"uh-status uh-err",title:ho(l.resp)||void 0,children:[b3(l.resp,"ccusage did not report usage"),g.jsx("div",{children:g.jsx("button",{className:"btn uh-retry",onClick:c,disabled:u,children:u?"trying…":"Try again"})})]}):d.phase==="empty"?g.jsx("div",{className:`uh-status${d.stale?" uh-stale":""}`,"aria-busy":d.stale||void 0,children:"no usage in this range"}):g.jsxs("div",{className:d.stale?"uh-stale":void 0,"aria-busy":d.stale||void 0,children:[g.jsxs("div",{className:"uh-totals",children:[g.jsx(iu,{label:"total cost",val:De(w),accent:!0}),g.jsx(iu,{label:"tokens",val:qt(N)}),g.jsx(iu,{label:"input+output",val:qt(_)}),g.jsx(iu,{label:"cache reads",val:qt(b)})]}),g.jsx("div",{className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:m.map(A=>{const U=y>0?A.totalCost/y*100:0,z=A.period===i,P=`${A.period}, ${De(A.totalCost)}`;return g.jsxs("button",{className:`uh-bar-col${z?" sel":""}`,onClick:()=>o(z?null:A.period),"aria-pressed":z,"aria-label":P,title:`${A.period} · ${De(A.totalCost)}`,style:{flexBasis:`${100/m.length}%`},children:[g.jsx("div",{className:"uh-bar",style:{height:`${Math.max(U,A.totalCost>0?2:0)}%`},children:A.modelBreakdowns.slice().sort((D,V)=>V.cost-D.cost).map(D=>{const V=A.totalCost>0?D.cost/A.totalCost*100:0;return g.jsx("div",{className:"uh-bar-seg",style:{height:`${V}%`,background:su(D.modelName)}},D.modelName)})}),g.jsx("span",{className:"uh-bar-label",children:A.period.slice(5)})]},A.period)})}),g.jsx("div",{className:"uh-legend",children:k.map(([A,U])=>g.jsxs("span",{className:"uh-legend-item",children:[g.jsx("span",{className:"uh-legend-dot",style:{background:su(A)}}),Ns(A)," ",g.jsx("span",{className:"uh-legend-cost",children:De(U)})]},A))}),E&&g.jsxs("div",{className:"uh-detail",children:[g.jsxs("div",{className:"uh-detail-head",children:[g.jsx("span",{className:"uh-detail-date",children:E.period}),g.jsx("span",{className:"uh-detail-cost",children:De(E.totalCost)}),(O=(I=E.metadata)==null?void 0:I.agents)!=null&&O.length?g.jsx("span",{className:"uh-detail-agents",children:E.metadata.agents.join(" · ")}):null]}),g.jsxs("div",{className:"uh-detail-mini",children:[g.jsx(ou,{label:"input",val:qt(E.inputTokens)}),g.jsx(ou,{label:"output",val:qt(E.outputTokens)}),g.jsx(ou,{label:"cache write",val:qt(E.cacheCreationTokens)}),g.jsx(ou,{label:"cache read",val:qt(E.cacheReadTokens)})]}),g.jsx("div",{className:"uh-detail-models",children:E.modelBreakdowns.slice().sort((A,U)=>U.cost-A.cost).map(A=>{const U=E.totalCost>0?A.cost/E.totalCost*100:0;return g.jsxs("div",{className:"uh-model-row",children:[g.jsxs("span",{className:"uh-model-name",children:[g.jsx("span",{className:"uh-legend-dot",style:{background:su(A.modelName)}}),Ns(A.modelName)]}),g.jsx("span",{className:"uh-model-bar",children:g.jsx("span",{className:"uh-model-bar-fill",style:{width:`${U}%`,background:su(A.modelName)}})}),g.jsx("span",{className:"uh-model-cost",children:De(A.cost)})]},A.modelName)})})]})]})]})})}function iu({label:e,val:n,accent:r}){return g.jsxs("div",{className:"uh-stat",children:[g.jsx("span",{className:`uh-stat-val${r?" accent":""}`,children:n}),g.jsx("span",{className:"uh-stat-label",children:e})]})}function ou({label:e,val:n}){return g.jsxs("div",{className:"uh-ministat",children:[g.jsx("span",{className:"uh-ministat-val",children:n}),g.jsx("span",{className:"uh-ministat-label",children:e})]})}function iy(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 Vd,c_;function N$(){if(c_)return Vd;c_=1;function e(){this.__data__=[],this.size=0}return Vd=e,Vd}var Gd,d_;function go(){if(d_)return Gd;d_=1;function e(n,r){return n===r||n!==n&&r!==r}return Gd=e,Gd}var Yd,f_;function Lu(){if(f_)return Yd;f_=1;var e=go();function n(r,i){for(var o=r.length;o--;)if(e(r[o][0],i))return o;return-1}return Yd=n,Yd}var Kd,h_;function C$(){if(h_)return Kd;h_=1;var e=Lu(),n=Array.prototype,r=n.splice;function i(o){var l=this.__data__,u=e(l,o);if(u<0)return!1;var c=l.length-1;return u==c?l.pop():r.call(l,u,1),--this.size,!0}return Kd=i,Kd}var Xd,p_;function T$(){if(p_)return Xd;p_=1;var e=Lu();function n(r){var i=this.__data__,o=e(i,r);return o<0?void 0:i[o][1]}return Xd=n,Xd}var Qd,m_;function R$(){if(m_)return Qd;m_=1;var e=Lu();function n(r){return e(this.__data__,r)>-1}return Qd=n,Qd}var Zd,g_;function j$(){if(g_)return Zd;g_=1;var e=Lu();function n(r,i){var o=this.__data__,l=e(o,r);return l<0?(++this.size,o.push([r,i])):o[l][1]=i,this}return Zd=n,Zd}var Jd,v_;function $u(){if(v_)return Jd;v_=1;var e=N$(),n=C$(),r=T$(),i=R$(),o=j$();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,Jd=l,Jd}var ef,y_;function A$(){if(y_)return ef;y_=1;var e=$u();function n(){this.__data__=new e,this.size=0}return ef=n,ef}var tf,w_;function I$(){if(w_)return tf;w_=1;function e(n){var r=this.__data__,i=r.delete(n);return this.size=r.size,i}return tf=e,tf}var nf,x_;function M$(){if(x_)return nf;x_=1;function e(n){return this.__data__.get(n)}return nf=e,nf}var rf,__;function O$(){if(__)return rf;__=1;function e(n){return this.__data__.has(n)}return rf=e,rf}var sf,b_;function MC(){if(b_)return sf;b_=1;var e=typeof Ul=="object"&&Ul&&Ul.Object===Object&&Ul;return sf=e,sf}var of,S_;function sr(){if(S_)return of;S_=1;var e=MC(),n=typeof self=="object"&&self&&self.Object===Object&&self,r=e||n||Function("return this")();return of=r,of}var af,k_;function vo(){if(k_)return af;k_=1;var e=sr(),n=e.Symbol;return af=n,af}var lf,E_;function P$(){if(E_)return lf;E_=1;var e=vo(),n=Object.prototype,r=n.hasOwnProperty,i=n.toString,o=e?e.toStringTag:void 0;function l(u){var c=r.call(u,o),h=u[o];try{u[o]=void 0;var p=!0}catch{}var d=i.call(u);return p&&(c?u[o]=h:delete u[o]),d}return lf=l,lf}var uf,N_;function L$(){if(N_)return uf;N_=1;var e=Object.prototype,n=e.toString;function r(i){return n.call(i)}return uf=r,uf}var cf,C_;function fi(){if(C_)return cf;C_=1;var e=vo(),n=P$(),r=L$(),i="[object Null]",o="[object Undefined]",l=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?o:i:l&&l in Object(c)?n(c):r(c)}return cf=u,cf}var df,T_;function qn(){if(T_)return df;T_=1;function e(n){var r=typeof n;return n!=null&&(r=="object"||r=="function")}return df=e,df}var ff,R_;function Aa(){if(R_)return ff;R_=1;var e=fi(),n=qn(),r="[object AsyncFunction]",i="[object Function]",o="[object GeneratorFunction]",l="[object Proxy]";function u(c){if(!n(c))return!1;var h=e(c);return h==i||h==o||h==r||h==l}return ff=u,ff}var hf,j_;function $$(){if(j_)return hf;j_=1;var e=sr(),n=e["__core-js_shared__"];return hf=n,hf}var pf,A_;function q$(){if(A_)return pf;A_=1;var e=$$(),n=(function(){var i=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function r(i){return!!n&&n in i}return pf=r,pf}var mf,I_;function OC(){if(I_)return mf;I_=1;var e=Function.prototype,n=e.toString;function r(i){if(i!=null){try{return n.call(i)}catch{}try{return i+""}catch{}}return""}return mf=r,mf}var gf,M_;function D$(){if(M_)return gf;M_=1;var e=Aa(),n=q$(),r=qn(),i=OC(),o=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,h=u.toString,p=c.hasOwnProperty,d=RegExp("^"+h.call(p).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!r(y)||n(y))return!1;var w=e(y)?d:l;return w.test(i(y))}return gf=m,gf}var vf,O_;function F$(){if(O_)return vf;O_=1;function e(n,r){return n==null?void 0:n[r]}return vf=e,vf}var yf,P_;function hi(){if(P_)return yf;P_=1;var e=D$(),n=F$();function r(i,o){var l=n(i,o);return e(l)?l:void 0}return yf=r,yf}var wf,L_;function oy(){if(L_)return wf;L_=1;var e=hi(),n=sr(),r=e(n,"Map");return wf=r,wf}var xf,$_;function qu(){if($_)return xf;$_=1;var e=hi(),n=e(Object,"create");return xf=n,xf}var _f,q_;function z$(){if(q_)return _f;q_=1;var e=qu();function n(){this.__data__=e?e(null):{},this.size=0}return _f=n,_f}var bf,D_;function B$(){if(D_)return bf;D_=1;function e(n){var r=this.has(n)&&delete this.__data__[n];return this.size-=r?1:0,r}return bf=e,bf}var Sf,F_;function U$(){if(F_)return Sf;F_=1;var e=qu(),n="__lodash_hash_undefined__",r=Object.prototype,i=r.hasOwnProperty;function o(l){var u=this.__data__;if(e){var c=u[l];return c===n?void 0:c}return i.call(u,l)?u[l]:void 0}return Sf=o,Sf}var kf,z_;function H$(){if(z_)return kf;z_=1;var e=qu(),n=Object.prototype,r=n.hasOwnProperty;function i(o){var l=this.__data__;return e?l[o]!==void 0:r.call(l,o)}return kf=i,kf}var Ef,B_;function W$(){if(B_)return Ef;B_=1;var e=qu(),n="__lodash_hash_undefined__";function r(i,o){var l=this.__data__;return this.size+=this.has(i)?0:1,l[i]=e&&o===void 0?n:o,this}return Ef=r,Ef}var Nf,U_;function V$(){if(U_)return Nf;U_=1;var e=z$(),n=B$(),r=U$(),i=H$(),o=W$();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,Nf=l,Nf}var Cf,H_;function G$(){if(H_)return Cf;H_=1;var e=V$(),n=$u(),r=oy();function i(){this.size=0,this.__data__={hash:new e,map:new(r||n),string:new e}}return Cf=i,Cf}var Tf,W_;function Y$(){if(W_)return Tf;W_=1;function e(n){var r=typeof n;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?n!=="__proto__":n===null}return Tf=e,Tf}var Rf,V_;function Du(){if(V_)return Rf;V_=1;var e=Y$();function n(r,i){var o=r.__data__;return e(i)?o[typeof i=="string"?"string":"hash"]:o.map}return Rf=n,Rf}var jf,G_;function K$(){if(G_)return jf;G_=1;var e=Du();function n(r){var i=e(this,r).delete(r);return this.size-=i?1:0,i}return jf=n,jf}var Af,Y_;function X$(){if(Y_)return Af;Y_=1;var e=Du();function n(r){return e(this,r).get(r)}return Af=n,Af}var If,K_;function Q$(){if(K_)return If;K_=1;var e=Du();function n(r){return e(this,r).has(r)}return If=n,If}var Mf,X_;function Z$(){if(X_)return Mf;X_=1;var e=Du();function n(r,i){var o=e(this,r),l=o.size;return o.set(r,i),this.size+=o.size==l?0:1,this}return Mf=n,Mf}var Of,Q_;function ay(){if(Q_)return Of;Q_=1;var e=G$(),n=K$(),r=X$(),i=Q$(),o=Z$();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,Of=l,Of}var Pf,Z_;function J$(){if(Z_)return Pf;Z_=1;var e=$u(),n=oy(),r=ay(),i=200;function o(l,u){var c=this.__data__;if(c instanceof e){var h=c.__data__;if(!n||h.length<i-1)return h.push([l,u]),this.size=++c.size,this;c=this.__data__=new r(h)}return c.set(l,u),this.size=c.size,this}return Pf=o,Pf}var Lf,J_;function Fu(){if(J_)return Lf;J_=1;var e=$u(),n=A$(),r=I$(),i=M$(),o=O$(),l=J$();function u(c){var h=this.__data__=new e(c);this.size=h.size}return u.prototype.clear=n,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=l,Lf=u,Lf}var $f,e1;function ly(){if(e1)return $f;e1=1;function e(n,r){for(var i=-1,o=n==null?0:n.length;++i<o&&r(n[i],i,n)!==!1;);return n}return $f=e,$f}var qf,t1;function PC(){if(t1)return qf;t1=1;var e=hi(),n=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return qf=n,qf}var Df,n1;function zu(){if(n1)return Df;n1=1;var e=PC();function n(r,i,o){i=="__proto__"&&e?e(r,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[i]=o}return Df=n,Df}var Ff,r1;function Bu(){if(r1)return Ff;r1=1;var e=zu(),n=go(),r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c){var h=l[u];(!(i.call(l,u)&&n(h,c))||c===void 0&&!(u in l))&&e(l,u,c)}return Ff=o,Ff}var zf,s1;function Ia(){if(s1)return zf;s1=1;var e=Bu(),n=zu();function r(i,o,l,u){var c=!l;l||(l={});for(var h=-1,p=o.length;++h<p;){var d=o[h],m=u?u(l[d],i[d],d,l,i):void 0;m===void 0&&(m=i[d]),c?n(l,d,m):e(l,d,m)}return l}return zf=r,zf}var Bf,i1;function eq(){if(i1)return Bf;i1=1;function e(n,r){for(var i=-1,o=Array(n);++i<n;)o[i]=r(i);return o}return Bf=e,Bf}var Uf,o1;function mr(){if(o1)return Uf;o1=1;function e(n){return n!=null&&typeof n=="object"}return Uf=e,Uf}var Hf,a1;function tq(){if(a1)return Hf;a1=1;var e=fi(),n=mr(),r="[object Arguments]";function i(o){return n(o)&&e(o)==r}return Hf=i,Hf}var Wf,l1;function Ma(){if(l1)return Wf;l1=1;var e=tq(),n=mr(),r=Object.prototype,i=r.hasOwnProperty,o=r.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(u){return n(u)&&i.call(u,"callee")&&!o.call(u,"callee")};return Wf=l,Wf}var Vf,u1;function bt(){if(u1)return Vf;u1=1;var e=Array.isArray;return Vf=e,Vf}var ca={exports:{}},Gf,c1;function nq(){if(c1)return Gf;c1=1;function e(){return!1}return Gf=e,Gf}ca.exports;var d1;function yo(){return d1||(d1=1,(function(e,n){var r=sr(),i=nq(),o=n&&!n.nodeType&&n,l=o&&!0&&e&&!e.nodeType&&e,u=l&&l.exports===o,c=u?r.Buffer:void 0,h=c?c.isBuffer:void 0,p=h||i;e.exports=p})(ca,ca.exports)),ca.exports}var Yf,f1;function Uu(){if(f1)return Yf;f1=1;var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;function r(i,o){var l=typeof i;return o=o??e,!!o&&(l=="number"||l!="symbol"&&n.test(i))&&i>-1&&i%1==0&&i<o}return Yf=r,Yf}var Kf,h1;function uy(){if(h1)return Kf;h1=1;var e=9007199254740991;function n(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Kf=n,Kf}var Xf,p1;function rq(){if(p1)return Xf;p1=1;var e=fi(),n=uy(),r=mr(),i="[object Arguments]",o="[object Array]",l="[object Boolean]",u="[object Date]",c="[object Error]",h="[object Function]",p="[object Map]",d="[object Number]",m="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",_="[object WeakMap]",b="[object ArrayBuffer]",S="[object DataView]",k="[object Float32Array]",E="[object Float64Array]",T="[object Int8Array]",I="[object Int16Array]",O="[object Int32Array]",A="[object Uint8Array]",U="[object Uint8ClampedArray]",z="[object Uint16Array]",P="[object Uint32Array]",D={};D[k]=D[E]=D[T]=D[I]=D[O]=D[A]=D[U]=D[z]=D[P]=!0,D[i]=D[o]=D[b]=D[l]=D[S]=D[u]=D[c]=D[h]=D[p]=D[d]=D[m]=D[y]=D[w]=D[N]=D[_]=!1;function V(B){return r(B)&&n(B.length)&&!!D[e(B)]}return Xf=V,Xf}var Qf,m1;function Hu(){if(m1)return Qf;m1=1;function e(n){return function(r){return n(r)}}return Qf=e,Qf}var da={exports:{}};da.exports;var g1;function cy(){return g1||(g1=1,(function(e,n){var r=MC(),i=n&&!n.nodeType&&n,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l&&r.process,c=(function(){try{var h=o&&o.require&&o.require("util").types;return h||u&&u.binding&&u.binding("util")}catch{}})();e.exports=c})(da,da.exports)),da.exports}var Zf,v1;function Oa(){if(v1)return Zf;v1=1;var e=rq(),n=Hu(),r=cy(),i=r&&r.isTypedArray,o=i?n(i):e;return Zf=o,Zf}var Jf,y1;function LC(){if(y1)return Jf;y1=1;var e=eq(),n=Ma(),r=bt(),i=yo(),o=Uu(),l=Oa(),u=Object.prototype,c=u.hasOwnProperty;function h(p,d){var m=r(p),y=!m&&n(p),w=!m&&!y&&i(p),N=!m&&!y&&!w&&l(p),_=m||y||w||N,b=_?e(p.length,String):[],S=b.length;for(var k in p)(d||c.call(p,k))&&!(_&&(k=="length"||w&&(k=="offset"||k=="parent")||N&&(k=="buffer"||k=="byteLength"||k=="byteOffset")||o(k,S)))&&b.push(k);return b}return Jf=h,Jf}var eh,w1;function Wu(){if(w1)return eh;w1=1;var e=Object.prototype;function n(r){var i=r&&r.constructor,o=typeof i=="function"&&i.prototype||e;return r===o}return eh=n,eh}var th,x1;function $C(){if(x1)return th;x1=1;function e(n,r){return function(i){return n(r(i))}}return th=e,th}var nh,_1;function sq(){if(_1)return nh;_1=1;var e=$C(),n=e(Object.keys,Object);return nh=n,nh}var rh,b1;function dy(){if(b1)return rh;b1=1;var e=Wu(),n=sq(),r=Object.prototype,i=r.hasOwnProperty;function o(l){if(!e(l))return n(l);var u=[];for(var c in Object(l))i.call(l,c)&&c!="constructor"&&u.push(c);return u}return rh=o,rh}var sh,S1;function Ur(){if(S1)return sh;S1=1;var e=Aa(),n=uy();function r(i){return i!=null&&n(i.length)&&!e(i)}return sh=r,sh}var ih,k1;function Cs(){if(k1)return ih;k1=1;var e=LC(),n=dy(),r=Ur();function i(o){return r(o)?e(o):n(o)}return ih=i,ih}var oh,E1;function iq(){if(E1)return oh;E1=1;var e=Ia(),n=Cs();function r(i,o){return i&&e(o,n(o),i)}return oh=r,oh}var ah,N1;function oq(){if(N1)return ah;N1=1;function e(n){var r=[];if(n!=null)for(var i in Object(n))r.push(i);return r}return ah=e,ah}var lh,C1;function aq(){if(C1)return lh;C1=1;var e=qn(),n=Wu(),r=oq(),i=Object.prototype,o=i.hasOwnProperty;function l(u){if(!e(u))return r(u);var c=n(u),h=[];for(var p in u)p=="constructor"&&(c||!o.call(u,p))||h.push(p);return h}return lh=l,lh}var uh,T1;function pi(){if(T1)return uh;T1=1;var e=LC(),n=aq(),r=Ur();function i(o){return r(o)?e(o,!0):n(o)}return uh=i,uh}var ch,R1;function lq(){if(R1)return ch;R1=1;var e=Ia(),n=pi();function r(i,o){return i&&e(o,n(o),i)}return ch=r,ch}var fa={exports:{}};fa.exports;var j1;function qC(){return j1||(j1=1,(function(e,n){var r=sr(),i=n&&!n.nodeType&&n,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l?r.Buffer:void 0,c=u?u.allocUnsafe:void 0;function h(p,d){if(d)return p.slice();var m=p.length,y=c?c(m):new p.constructor(m);return p.copy(y),y}e.exports=h})(fa,fa.exports)),fa.exports}var dh,A1;function DC(){if(A1)return dh;A1=1;function e(n,r){var i=-1,o=n.length;for(r||(r=Array(o));++i<o;)r[i]=n[i];return r}return dh=e,dh}var fh,I1;function FC(){if(I1)return fh;I1=1;function e(n,r){for(var i=-1,o=n==null?0:n.length,l=0,u=[];++i<o;){var c=n[i];r(c,i,n)&&(u[l++]=c)}return u}return fh=e,fh}var hh,M1;function zC(){if(M1)return hh;M1=1;function e(){return[]}return hh=e,hh}var ph,O1;function fy(){if(O1)return ph;O1=1;var e=FC(),n=zC(),r=Object.prototype,i=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,l=o?function(u){return u==null?[]:(u=Object(u),e(o(u),function(c){return i.call(u,c)}))}:n;return ph=l,ph}var mh,P1;function uq(){if(P1)return mh;P1=1;var e=Ia(),n=fy();function r(i,o){return e(i,n(i),o)}return mh=r,mh}var gh,L1;function hy(){if(L1)return gh;L1=1;function e(n,r){for(var i=-1,o=r.length,l=n.length;++i<o;)n[l+i]=r[i];return n}return gh=e,gh}var vh,$1;function Vu(){if($1)return vh;$1=1;var e=$C(),n=e(Object.getPrototypeOf,Object);return vh=n,vh}var yh,q1;function BC(){if(q1)return yh;q1=1;var e=hy(),n=Vu(),r=fy(),i=zC(),o=Object.getOwnPropertySymbols,l=o?function(u){for(var c=[];u;)e(c,r(u)),u=n(u);return c}:i;return yh=l,yh}var wh,D1;function cq(){if(D1)return wh;D1=1;var e=Ia(),n=BC();function r(i,o){return e(i,n(i),o)}return wh=r,wh}var xh,F1;function UC(){if(F1)return xh;F1=1;var e=hy(),n=bt();function r(i,o,l){var u=o(i);return n(i)?u:e(u,l(i))}return xh=r,xh}var _h,z1;function HC(){if(z1)return _h;z1=1;var e=UC(),n=fy(),r=Cs();function i(o){return e(o,r,n)}return _h=i,_h}var bh,B1;function dq(){if(B1)return bh;B1=1;var e=UC(),n=BC(),r=pi();function i(o){return e(o,r,n)}return bh=i,bh}var Sh,U1;function fq(){if(U1)return Sh;U1=1;var e=hi(),n=sr(),r=e(n,"DataView");return Sh=r,Sh}var kh,H1;function hq(){if(H1)return kh;H1=1;var e=hi(),n=sr(),r=e(n,"Promise");return kh=r,kh}var Eh,W1;function WC(){if(W1)return Eh;W1=1;var e=hi(),n=sr(),r=e(n,"Set");return Eh=r,Eh}var Nh,V1;function pq(){if(V1)return Nh;V1=1;var e=hi(),n=sr(),r=e(n,"WeakMap");return Nh=r,Nh}var Ch,G1;function wo(){if(G1)return Ch;G1=1;var e=fq(),n=oy(),r=hq(),i=WC(),o=pq(),l=fi(),u=OC(),c="[object Map]",h="[object Object]",p="[object Promise]",d="[object Set]",m="[object WeakMap]",y="[object DataView]",w=u(e),N=u(n),_=u(r),b=u(i),S=u(o),k=l;return(e&&k(new e(new ArrayBuffer(1)))!=y||n&&k(new n)!=c||r&&k(r.resolve())!=p||i&&k(new i)!=d||o&&k(new o)!=m)&&(k=function(E){var T=l(E),I=T==h?E.constructor:void 0,O=I?u(I):"";if(O)switch(O){case w:return y;case N:return c;case _:return p;case b:return d;case S:return m}return T}),Ch=k,Ch}var Th,Y1;function mq(){if(Y1)return Th;Y1=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i){var o=i.length,l=new i.constructor(o);return o&&typeof i[0]=="string"&&n.call(i,"index")&&(l.index=i.index,l.input=i.input),l}return Th=r,Th}var Rh,K1;function VC(){if(K1)return Rh;K1=1;var e=sr(),n=e.Uint8Array;return Rh=n,Rh}var jh,X1;function py(){if(X1)return jh;X1=1;var e=VC();function n(r){var i=new r.constructor(r.byteLength);return new e(i).set(new e(r)),i}return jh=n,jh}var Ah,Q1;function gq(){if(Q1)return Ah;Q1=1;var e=py();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return Ah=n,Ah}var Ih,Z1;function vq(){if(Z1)return Ih;Z1=1;var e=/\w*$/;function n(r){var i=new r.constructor(r.source,e.exec(r));return i.lastIndex=r.lastIndex,i}return Ih=n,Ih}var Mh,J1;function yq(){if(J1)return Mh;J1=1;var e=vo(),n=e?e.prototype:void 0,r=n?n.valueOf:void 0;function i(o){return r?Object(r.call(o)):{}}return Mh=i,Mh}var Oh,eb;function GC(){if(eb)return Oh;eb=1;var e=py();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return Oh=n,Oh}var Ph,tb;function wq(){if(tb)return Ph;tb=1;var e=py(),n=gq(),r=vq(),i=yq(),o=GC(),l="[object Boolean]",u="[object Date]",c="[object Map]",h="[object Number]",p="[object RegExp]",d="[object Set]",m="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",b="[object Float64Array]",S="[object Int8Array]",k="[object Int16Array]",E="[object Int32Array]",T="[object Uint8Array]",I="[object Uint8ClampedArray]",O="[object Uint16Array]",A="[object Uint32Array]";function U(z,P,D){var V=z.constructor;switch(P){case w:return e(z);case l:case u:return new V(+z);case N:return n(z,D);case _:case b:case S:case k:case E:case T:case I:case O:case A:return o(z,D);case c:return new V;case h:case m:return new V(z);case p:return r(z);case d:return new V;case y:return i(z)}}return Ph=U,Ph}var Lh,nb;function YC(){if(nb)return Lh;nb=1;var e=qn(),n=Object.create,r=(function(){function i(){}return function(o){if(!e(o))return{};if(n)return n(o);i.prototype=o;var l=new i;return i.prototype=void 0,l}})();return Lh=r,Lh}var $h,rb;function KC(){if(rb)return $h;rb=1;var e=YC(),n=Vu(),r=Wu();function i(o){return typeof o.constructor=="function"&&!r(o)?e(n(o)):{}}return $h=i,$h}var qh,sb;function xq(){if(sb)return qh;sb=1;var e=wo(),n=mr(),r="[object Map]";function i(o){return n(o)&&e(o)==r}return qh=i,qh}var Dh,ib;function _q(){if(ib)return Dh;ib=1;var e=xq(),n=Hu(),r=cy(),i=r&&r.isMap,o=i?n(i):e;return Dh=o,Dh}var Fh,ob;function bq(){if(ob)return Fh;ob=1;var e=wo(),n=mr(),r="[object Set]";function i(o){return n(o)&&e(o)==r}return Fh=i,Fh}var zh,ab;function Sq(){if(ab)return zh;ab=1;var e=bq(),n=Hu(),r=cy(),i=r&&r.isSet,o=i?n(i):e;return zh=o,zh}var Bh,lb;function XC(){if(lb)return Bh;lb=1;var e=Fu(),n=ly(),r=Bu(),i=iq(),o=lq(),l=qC(),u=DC(),c=uq(),h=cq(),p=HC(),d=dq(),m=wo(),y=mq(),w=wq(),N=KC(),_=bt(),b=yo(),S=_q(),k=qn(),E=Sq(),T=Cs(),I=pi(),O=1,A=2,U=4,z="[object Arguments]",P="[object Array]",D="[object Boolean]",V="[object Date]",B="[object Error]",C="[object Function]",q="[object GeneratorFunction]",L="[object Map]",re="[object Number]",Z="[object Object]",H="[object RegExp]",J="[object Set]",M="[object String]",G="[object Symbol]",Y="[object WeakMap]",$="[object ArrayBuffer]",Q="[object DataView]",ne="[object Float32Array]",oe="[object Float64Array]",fe="[object Int8Array]",te="[object Int16Array]",ce="[object Int32Array]",Ce="[object Uint8Array]",ve="[object Uint8ClampedArray]",je="[object Uint16Array]",ye="[object Uint32Array]",ke={};ke[z]=ke[P]=ke[$]=ke[Q]=ke[D]=ke[V]=ke[ne]=ke[oe]=ke[fe]=ke[te]=ke[ce]=ke[L]=ke[re]=ke[Z]=ke[H]=ke[J]=ke[M]=ke[G]=ke[Ce]=ke[ve]=ke[je]=ke[ye]=!0,ke[B]=ke[C]=ke[Y]=!1;function Ye(we,_e,Be,it,pt,Ze){var Fe,Je=_e&O,Xe=_e&A,Mt=_e&U;if(Be&&(Fe=pt?Be(we,it,pt,Ze):Be(we)),Fe!==void 0)return Fe;if(!k(we))return we;var ut=_(we);if(ut){if(Fe=y(we),!Je)return u(we,Fe)}else{var Qe=m(we),Ot=Qe==C||Qe==q;if(b(we))return l(we,Je);if(Qe==Z||Qe==z||Ot&&!pt){if(Fe=Xe||Ot?{}:N(we),!Je)return Xe?h(we,o(Fe,we)):c(we,i(Fe,we))}else{if(!ke[Qe])return pt?we:{};Fe=w(we,Qe,Je)}}Ze||(Ze=new e);var Ft=Ze.get(we);if(Ft)return Ft;Ze.set(we,Fe),E(we)?we.forEach(function(mt){Fe.add(Ye(mt,_e,Be,mt,we,Ze))}):S(we)&&we.forEach(function(mt,wt){Fe.set(wt,Ye(mt,_e,Be,wt,we,Ze))});var et=Mt?Xe?d:p:Xe?I:T,St=ut?void 0:et(we);return n(St||we,function(mt,wt){St&&(wt=mt,mt=we[wt]),r(Fe,wt,Ye(mt,_e,Be,wt,we,Ze))}),Fe}return Bh=Ye,Bh}var Uh,ub;function kq(){if(ub)return Uh;ub=1;var e=XC(),n=4;function r(i){return e(i,n)}return Uh=r,Uh}var Hh,cb;function my(){if(cb)return Hh;cb=1;function e(n){return function(){return n}}return Hh=e,Hh}var Wh,db;function Eq(){if(db)return Wh;db=1;function e(n){return function(r,i,o){for(var l=-1,u=Object(r),c=o(r),h=c.length;h--;){var p=c[n?h:++l];if(i(u[p],p,u)===!1)break}return r}}return Wh=e,Wh}var Vh,fb;function gy(){if(fb)return Vh;fb=1;var e=Eq(),n=e();return Vh=n,Vh}var Gh,hb;function vy(){if(hb)return Gh;hb=1;var e=gy(),n=Cs();function r(i,o){return i&&e(i,o,n)}return Gh=r,Gh}var Yh,pb;function Nq(){if(pb)return Yh;pb=1;var e=Ur();function n(r,i){return function(o,l){if(o==null)return o;if(!e(o))return r(o,l);for(var u=o.length,c=i?u:-1,h=Object(o);(i?c--:++c<u)&&l(h[c],c,h)!==!1;);return o}}return Yh=n,Yh}var Kh,mb;function Gu(){if(mb)return Kh;mb=1;var e=vy(),n=Nq(),r=n(e);return Kh=r,Kh}var Xh,gb;function mi(){if(gb)return Xh;gb=1;function e(n){return n}return Xh=e,Xh}var Qh,vb;function QC(){if(vb)return Qh;vb=1;var e=mi();function n(r){return typeof r=="function"?r:e}return Qh=n,Qh}var Zh,yb;function ZC(){if(yb)return Zh;yb=1;var e=ly(),n=Gu(),r=QC(),i=bt();function o(l,u){var c=i(l)?e:n;return c(l,r(u))}return Zh=o,Zh}var Jh,wb;function JC(){return wb||(wb=1,Jh=ZC()),Jh}var ep,xb;function Cq(){if(xb)return ep;xb=1;var e=Gu();function n(r,i){var o=[];return e(r,function(l,u,c){i(l,u,c)&&o.push(l)}),o}return ep=n,ep}var tp,_b;function Tq(){if(_b)return tp;_b=1;var e="__lodash_hash_undefined__";function n(r){return this.__data__.set(r,e),this}return tp=n,tp}var np,bb;function Rq(){if(bb)return np;bb=1;function e(n){return this.__data__.has(n)}return np=e,np}var rp,Sb;function eT(){if(Sb)return rp;Sb=1;var e=ay(),n=Tq(),r=Rq();function i(o){var l=-1,u=o==null?0:o.length;for(this.__data__=new e;++l<u;)this.add(o[l])}return i.prototype.add=i.prototype.push=n,i.prototype.has=r,rp=i,rp}var sp,kb;function jq(){if(kb)return sp;kb=1;function e(n,r){for(var i=-1,o=n==null?0:n.length;++i<o;)if(r(n[i],i,n))return!0;return!1}return sp=e,sp}var ip,Eb;function tT(){if(Eb)return ip;Eb=1;function e(n,r){return n.has(r)}return ip=e,ip}var op,Nb;function nT(){if(Nb)return op;Nb=1;var e=eT(),n=jq(),r=tT(),i=1,o=2;function l(u,c,h,p,d,m){var y=h&i,w=u.length,N=c.length;if(w!=N&&!(y&&N>w))return!1;var _=m.get(u),b=m.get(c);if(_&&b)return _==c&&b==u;var S=-1,k=!0,E=h&o?new e:void 0;for(m.set(u,c),m.set(c,u);++S<w;){var T=u[S],I=c[S];if(p)var O=y?p(I,T,S,c,u,m):p(T,I,S,u,c,m);if(O!==void 0){if(O)continue;k=!1;break}if(E){if(!n(c,function(A,U){if(!r(E,U)&&(T===A||d(T,A,h,p,m)))return E.push(U)})){k=!1;break}}else if(!(T===I||d(T,I,h,p,m))){k=!1;break}}return m.delete(u),m.delete(c),k}return op=l,op}var ap,Cb;function Aq(){if(Cb)return ap;Cb=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o,l){i[++r]=[l,o]}),i}return ap=e,ap}var lp,Tb;function yy(){if(Tb)return lp;Tb=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o){i[++r]=o}),i}return lp=e,lp}var up,Rb;function Iq(){if(Rb)return up;Rb=1;var e=vo(),n=VC(),r=go(),i=nT(),o=Aq(),l=yy(),u=1,c=2,h="[object Boolean]",p="[object Date]",d="[object Error]",m="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",_="[object String]",b="[object Symbol]",S="[object ArrayBuffer]",k="[object DataView]",E=e?e.prototype:void 0,T=E?E.valueOf:void 0;function I(O,A,U,z,P,D,V){switch(U){case k:if(O.byteLength!=A.byteLength||O.byteOffset!=A.byteOffset)return!1;O=O.buffer,A=A.buffer;case S:return!(O.byteLength!=A.byteLength||!D(new n(O),new n(A)));case h:case p:case y:return r(+O,+A);case d:return O.name==A.name&&O.message==A.message;case w:case _:return O==A+"";case m:var B=o;case N:var C=z&u;if(B||(B=l),O.size!=A.size&&!C)return!1;var q=V.get(O);if(q)return q==A;z|=c,V.set(O,A);var L=i(B(O),B(A),z,P,D,V);return V.delete(O),L;case b:if(T)return T.call(O)==T.call(A)}return!1}return up=I,up}var cp,jb;function Mq(){if(jb)return cp;jb=1;var e=HC(),n=1,r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c,h,p,d){var m=c&n,y=e(l),w=y.length,N=e(u),_=N.length;if(w!=_&&!m)return!1;for(var b=w;b--;){var S=y[b];if(!(m?S in u:i.call(u,S)))return!1}var k=d.get(l),E=d.get(u);if(k&&E)return k==u&&E==l;var T=!0;d.set(l,u),d.set(u,l);for(var I=m;++b<w;){S=y[b];var O=l[S],A=u[S];if(h)var U=m?h(A,O,S,u,l,d):h(O,A,S,l,u,d);if(!(U===void 0?O===A||p(O,A,c,h,d):U)){T=!1;break}I||(I=S=="constructor")}if(T&&!I){var z=l.constructor,P=u.constructor;z!=P&&"constructor"in l&&"constructor"in u&&!(typeof z=="function"&&z instanceof z&&typeof P=="function"&&P instanceof P)&&(T=!1)}return d.delete(l),d.delete(u),T}return cp=o,cp}var dp,Ab;function Oq(){if(Ab)return dp;Ab=1;var e=Fu(),n=nT(),r=Iq(),i=Mq(),o=wo(),l=bt(),u=yo(),c=Oa(),h=1,p="[object Arguments]",d="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(_,b,S,k,E,T){var I=l(_),O=l(b),A=I?d:o(_),U=O?d:o(b);A=A==p?m:A,U=U==p?m:U;var z=A==m,P=U==m,D=A==U;if(D&&u(_)){if(!u(b))return!1;I=!0,z=!1}if(D&&!z)return T||(T=new e),I||c(_)?n(_,b,S,k,E,T):r(_,b,A,S,k,E,T);if(!(S&h)){var V=z&&w.call(_,"__wrapped__"),B=P&&w.call(b,"__wrapped__");if(V||B){var C=V?_.value():_,q=B?b.value():b;return T||(T=new e),E(C,q,S,k,T)}}return D?(T||(T=new e),i(_,b,S,k,E,T)):!1}return dp=N,dp}var fp,Ib;function rT(){if(Ib)return fp;Ib=1;var e=Oq(),n=mr();function r(i,o,l,u,c){return i===o?!0:i==null||o==null||!n(i)&&!n(o)?i!==i&&o!==o:e(i,o,l,u,r,c)}return fp=r,fp}var hp,Mb;function Pq(){if(Mb)return hp;Mb=1;var e=Fu(),n=rT(),r=1,i=2;function o(l,u,c,h){var p=c.length,d=p,m=!h;if(l==null)return!d;for(l=Object(l);p--;){var y=c[p];if(m&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<d;){y=c[p];var w=y[0],N=l[w],_=y[1];if(m&&y[2]){if(N===void 0&&!(w in l))return!1}else{var b=new e;if(h)var S=h(N,_,w,l,u,b);if(!(S===void 0?n(_,N,r|i,h,b):S))return!1}}return!0}return hp=o,hp}var pp,Ob;function sT(){if(Ob)return pp;Ob=1;var e=qn();function n(r){return r===r&&!e(r)}return pp=n,pp}var mp,Pb;function Lq(){if(Pb)return mp;Pb=1;var e=sT(),n=Cs();function r(i){for(var o=n(i),l=o.length;l--;){var u=o[l],c=i[u];o[l]=[u,c,e(c)]}return o}return mp=r,mp}var gp,Lb;function iT(){if(Lb)return gp;Lb=1;function e(n,r){return function(i){return i==null?!1:i[n]===r&&(r!==void 0||n in Object(i))}}return gp=e,gp}var vp,$b;function $q(){if($b)return vp;$b=1;var e=Pq(),n=Lq(),r=iT();function i(o){var l=n(o);return l.length==1&&l[0][2]?r(l[0][0],l[0][1]):function(u){return u===o||e(u,o,l)}}return vp=i,vp}var yp,qb;function xo(){if(qb)return yp;qb=1;var e=fi(),n=mr(),r="[object Symbol]";function i(o){return typeof o=="symbol"||n(o)&&e(o)==r}return yp=i,yp}var wp,Db;function wy(){if(Db)return wp;Db=1;var e=bt(),n=xo(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;function o(l,u){if(e(l))return!1;var c=typeof l;return c=="number"||c=="symbol"||c=="boolean"||l==null||n(l)?!0:i.test(l)||!r.test(l)||u!=null&&l in Object(u)}return wp=o,wp}var xp,Fb;function qq(){if(Fb)return xp;Fb=1;var e=ay(),n="Expected a function";function r(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new TypeError(n);var l=function(){var u=arguments,c=o?o.apply(this,u):u[0],h=l.cache;if(h.has(c))return h.get(c);var p=i.apply(this,u);return l.cache=h.set(c,p)||h,p};return l.cache=new(r.Cache||e),l}return r.Cache=e,xp=r,xp}var _p,zb;function Dq(){if(zb)return _p;zb=1;var e=qq(),n=500;function r(i){var o=e(i,function(u){return l.size===n&&l.clear(),u}),l=o.cache;return o}return _p=r,_p}var bp,Bb;function Fq(){if(Bb)return bp;Bb=1;var e=Dq(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,i=e(function(o){var l=[];return o.charCodeAt(0)===46&&l.push(""),o.replace(n,function(u,c,h,p){l.push(h?p.replace(r,"$1"):c||u)}),l});return bp=i,bp}var Sp,Ub;function Yu(){if(Ub)return Sp;Ub=1;function e(n,r){for(var i=-1,o=n==null?0:n.length,l=Array(o);++i<o;)l[i]=r(n[i],i,n);return l}return Sp=e,Sp}var kp,Hb;function zq(){if(Hb)return kp;Hb=1;var e=vo(),n=Yu(),r=bt(),i=xo(),o=e?e.prototype:void 0,l=o?o.toString:void 0;function u(c){if(typeof c=="string")return c;if(r(c))return n(c,u)+"";if(i(c))return l?l.call(c):"";var h=c+"";return h=="0"&&1/c==-1/0?"-0":h}return kp=u,kp}var Ep,Wb;function oT(){if(Wb)return Ep;Wb=1;var e=zq();function n(r){return r==null?"":e(r)}return Ep=n,Ep}var Np,Vb;function Ku(){if(Vb)return Np;Vb=1;var e=bt(),n=wy(),r=Fq(),i=oT();function o(l,u){return e(l)?l:n(l,u)?[l]:r(i(l))}return Np=o,Np}var Cp,Gb;function Pa(){if(Gb)return Cp;Gb=1;var e=xo();function n(r){if(typeof r=="string"||e(r))return r;var i=r+"";return i=="0"&&1/r==-1/0?"-0":i}return Cp=n,Cp}var Tp,Yb;function Xu(){if(Yb)return Tp;Yb=1;var e=Ku(),n=Pa();function r(i,o){o=e(o,i);for(var l=0,u=o.length;i!=null&&l<u;)i=i[n(o[l++])];return l&&l==u?i:void 0}return Tp=r,Tp}var Rp,Kb;function Bq(){if(Kb)return Rp;Kb=1;var e=Xu();function n(r,i,o){var l=r==null?void 0:e(r,i);return l===void 0?o:l}return Rp=n,Rp}var jp,Xb;function Uq(){if(Xb)return jp;Xb=1;function e(n,r){return n!=null&&r in Object(n)}return jp=e,jp}var Ap,Qb;function aT(){if(Qb)return Ap;Qb=1;var e=Ku(),n=Ma(),r=bt(),i=Uu(),o=uy(),l=Pa();function u(c,h,p){h=e(h,c);for(var d=-1,m=h.length,y=!1;++d<m;){var w=l(h[d]);if(!(y=c!=null&&p(c,w)))break;c=c[w]}return y||++d!=m?y:(m=c==null?0:c.length,!!m&&o(m)&&i(w,m)&&(r(c)||n(c)))}return Ap=u,Ap}var Ip,Zb;function lT(){if(Zb)return Ip;Zb=1;var e=Uq(),n=aT();function r(i,o){return i!=null&&n(i,o,e)}return Ip=r,Ip}var Mp,Jb;function Hq(){if(Jb)return Mp;Jb=1;var e=rT(),n=Bq(),r=lT(),i=wy(),o=sT(),l=iT(),u=Pa(),c=1,h=2;function p(d,m){return i(d)&&o(m)?l(u(d),m):function(y){var w=n(y,d);return w===void 0&&w===m?r(y,d):e(m,w,c|h)}}return Mp=p,Mp}var Op,eS;function uT(){if(eS)return Op;eS=1;function e(n){return function(r){return r==null?void 0:r[n]}}return Op=e,Op}var Pp,tS;function Wq(){if(tS)return Pp;tS=1;var e=Xu();function n(r){return function(i){return e(i,r)}}return Pp=n,Pp}var Lp,nS;function Vq(){if(nS)return Lp;nS=1;var e=uT(),n=Wq(),r=wy(),i=Pa();function o(l){return r(l)?e(i(l)):n(l)}return Lp=o,Lp}var $p,rS;function Hr(){if(rS)return $p;rS=1;var e=$q(),n=Hq(),r=mi(),i=bt(),o=Vq();function l(u){return typeof u=="function"?u:u==null?r:typeof u=="object"?i(u)?n(u[0],u[1]):e(u):o(u)}return $p=l,$p}var qp,sS;function cT(){if(sS)return qp;sS=1;var e=FC(),n=Cq(),r=Hr(),i=bt();function o(l,u){var c=i(l)?e:n;return c(l,r(u,3))}return qp=o,qp}var Dp,iS;function Gq(){if(iS)return Dp;iS=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i,o){return i!=null&&n.call(i,o)}return Dp=r,Dp}var Fp,oS;function dT(){if(oS)return Fp;oS=1;var e=Gq(),n=aT();function r(i,o){return i!=null&&n(i,o,e)}return Fp=r,Fp}var zp,aS;function Yq(){if(aS)return zp;aS=1;var e=dy(),n=wo(),r=Ma(),i=bt(),o=Ur(),l=yo(),u=Wu(),c=Oa(),h="[object Map]",p="[object Set]",d=Object.prototype,m=d.hasOwnProperty;function y(w){if(w==null)return!0;if(o(w)&&(i(w)||typeof w=="string"||typeof w.splice=="function"||l(w)||c(w)||r(w)))return!w.length;var N=n(w);if(N==h||N==p)return!w.size;if(u(w))return!e(w).length;for(var _ in w)if(m.call(w,_))return!1;return!0}return zp=y,zp}var Bp,lS;function fT(){if(lS)return Bp;lS=1;function e(n){return n===void 0}return Bp=e,Bp}var Up,uS;function hT(){if(uS)return Up;uS=1;var e=Gu(),n=Ur();function r(i,o){var l=-1,u=n(i)?Array(i.length):[];return e(i,function(c,h,p){u[++l]=o(c,h,p)}),u}return Up=r,Up}var Hp,cS;function pT(){if(cS)return Hp;cS=1;var e=Yu(),n=Hr(),r=hT(),i=bt();function o(l,u){var c=i(l)?e:r;return c(l,n(u,3))}return Hp=o,Hp}var Wp,dS;function Kq(){if(dS)return Wp;dS=1;function e(n,r,i,o){var l=-1,u=n==null?0:n.length;for(o&&u&&(i=n[++l]);++l<u;)i=r(i,n[l],l,n);return i}return Wp=e,Wp}var Vp,fS;function Xq(){if(fS)return Vp;fS=1;function e(n,r,i,o,l){return l(n,function(u,c,h){i=o?(o=!1,u):r(i,u,c,h)}),i}return Vp=e,Vp}var Gp,hS;function mT(){if(hS)return Gp;hS=1;var e=Kq(),n=Gu(),r=Hr(),i=Xq(),o=bt();function l(u,c,h){var p=o(u)?e:i,d=arguments.length<3;return p(u,r(c,4),h,d,n)}return Gp=l,Gp}var Yp,pS;function Qq(){if(pS)return Yp;pS=1;var e=fi(),n=bt(),r=mr(),i="[object String]";function o(l){return typeof l=="string"||!n(l)&&r(l)&&e(l)==i}return Yp=o,Yp}var Kp,mS;function Zq(){if(mS)return Kp;mS=1;var e=uT(),n=e("length");return Kp=n,Kp}var Xp,gS;function Jq(){if(gS)return Xp;gS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=n+r+i,l="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+o+l+"]");function h(p){return c.test(p)}return Xp=h,Xp}var Qp,vS;function eD(){if(vS)return Qp;vS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=n+r+i,l="\\ufe0e\\ufe0f",u="["+e+"]",c="["+o+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+c+"|"+h+")",d="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",_="["+l+"]?",b="(?:"+w+"(?:"+[d,m,y].join("|")+")"+_+N+")*",S=_+N+b,k="(?:"+[d+c+"?",c,m,y,u].join("|")+")",E=RegExp(h+"(?="+h+")|"+k+S,"g");function T(I){for(var O=E.lastIndex=0;E.test(I);)++O;return O}return Qp=T,Qp}var Zp,yS;function tD(){if(yS)return Zp;yS=1;var e=Zq(),n=Jq(),r=eD();function i(o){return n(o)?r(o):e(o)}return Zp=i,Zp}var Jp,wS;function nD(){if(wS)return Jp;wS=1;var e=dy(),n=wo(),r=Ur(),i=Qq(),o=tD(),l="[object Map]",u="[object Set]";function c(h){if(h==null)return 0;if(r(h))return i(h)?o(h):h.length;var p=n(h);return p==l||p==u?h.size:e(h).length}return Jp=c,Jp}var em,xS;function rD(){if(xS)return em;xS=1;var e=ly(),n=YC(),r=vy(),i=Hr(),o=Vu(),l=bt(),u=yo(),c=Aa(),h=qn(),p=Oa();function d(m,y,w){var N=l(m),_=N||u(m)||p(m);if(y=i(y,4),w==null){var b=m&&m.constructor;_?w=N?new b:[]:h(m)?w=c(b)?n(o(m)):{}:w={}}return(_?e:r)(m,function(S,k,E){return y(w,S,k,E)}),w}return em=d,em}var tm,_S;function sD(){if(_S)return tm;_S=1;var e=vo(),n=Ma(),r=bt(),i=e?e.isConcatSpreadable:void 0;function o(l){return r(l)||n(l)||!!(i&&l&&l[i])}return tm=o,tm}var nm,bS;function xy(){if(bS)return nm;bS=1;var e=hy(),n=sD();function r(i,o,l,u,c){var h=-1,p=i.length;for(l||(l=n),c||(c=[]);++h<p;){var d=i[h];o>0&&l(d)?o>1?r(d,o-1,l,u,c):e(c,d):u||(c[c.length]=d)}return c}return nm=r,nm}var rm,SS;function iD(){if(SS)return rm;SS=1;function e(n,r,i){switch(i.length){case 0:return n.call(r);case 1:return n.call(r,i[0]);case 2:return n.call(r,i[0],i[1]);case 3:return n.call(r,i[0],i[1],i[2])}return n.apply(r,i)}return rm=e,rm}var sm,kS;function gT(){if(kS)return sm;kS=1;var e=iD(),n=Math.max;function r(i,o,l){return o=n(o===void 0?i.length-1:o,0),function(){for(var u=arguments,c=-1,h=n(u.length-o,0),p=Array(h);++c<h;)p[c]=u[o+c];c=-1;for(var d=Array(o+1);++c<o;)d[c]=u[c];return d[o]=l(p),e(i,this,d)}}return sm=r,sm}var im,ES;function oD(){if(ES)return im;ES=1;var e=my(),n=PC(),r=mi(),i=n?function(o,l){return n(o,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:r;return im=i,im}var om,NS;function aD(){if(NS)return om;NS=1;var e=800,n=16,r=Date.now;function i(o){var l=0,u=0;return function(){var c=r(),h=n-(c-u);if(u=c,h>0){if(++l>=e)return arguments[0]}else l=0;return o.apply(void 0,arguments)}}return om=i,om}var am,CS;function vT(){if(CS)return am;CS=1;var e=oD(),n=aD(),r=n(e);return am=r,am}var lm,TS;function Qu(){if(TS)return lm;TS=1;var e=mi(),n=gT(),r=vT();function i(o,l){return r(n(o,l,e),o+"")}return lm=i,lm}var um,RS;function yT(){if(RS)return um;RS=1;function e(n,r,i,o){for(var l=n.length,u=i+(o?1:-1);o?u--:++u<l;)if(r(n[u],u,n))return u;return-1}return um=e,um}var cm,jS;function lD(){if(jS)return cm;jS=1;function e(n){return n!==n}return cm=e,cm}var dm,AS;function uD(){if(AS)return dm;AS=1;function e(n,r,i){for(var o=i-1,l=n.length;++o<l;)if(n[o]===r)return o;return-1}return dm=e,dm}var fm,IS;function cD(){if(IS)return fm;IS=1;var e=yT(),n=lD(),r=uD();function i(o,l,u){return l===l?r(o,l,u):e(o,n,u)}return fm=i,fm}var hm,MS;function dD(){if(MS)return hm;MS=1;var e=cD();function n(r,i){var o=r==null?0:r.length;return!!o&&e(r,i,0)>-1}return hm=n,hm}var pm,OS;function fD(){if(OS)return pm;OS=1;function e(n,r,i){for(var o=-1,l=n==null?0:n.length;++o<l;)if(i(r,n[o]))return!0;return!1}return pm=e,pm}var mm,PS;function hD(){if(PS)return mm;PS=1;function e(){}return mm=e,mm}var gm,LS;function pD(){if(LS)return gm;LS=1;var e=WC(),n=hD(),r=yy(),i=1/0,o=e&&1/r(new e([,-0]))[1]==i?function(l){return new e(l)}:n;return gm=o,gm}var vm,$S;function mD(){if($S)return vm;$S=1;var e=eT(),n=dD(),r=fD(),i=tT(),o=pD(),l=yy(),u=200;function c(h,p,d){var m=-1,y=n,w=h.length,N=!0,_=[],b=_;if(d)N=!1,y=r;else if(w>=u){var S=p?null:o(h);if(S)return l(S);N=!1,y=i,b=new e}else b=p?[]:_;e:for(;++m<w;){var k=h[m],E=p?p(k):k;if(k=d||k!==0?k:0,N&&E===E){for(var T=b.length;T--;)if(b[T]===E)continue e;p&&b.push(E),_.push(k)}else y(b,E,d)||(b!==_&&b.push(E),_.push(k))}return _}return vm=c,vm}var ym,qS;function wT(){if(qS)return ym;qS=1;var e=Ur(),n=mr();function r(i){return n(i)&&e(i)}return ym=r,ym}var wm,DS;function gD(){if(DS)return wm;DS=1;var e=xy(),n=Qu(),r=mD(),i=wT(),o=n(function(l){return r(e(l,1,i,!0))});return wm=o,wm}var xm,FS;function vD(){if(FS)return xm;FS=1;var e=Yu();function n(r,i){return e(i,function(o){return r[o]})}return xm=n,xm}var _m,zS;function xT(){if(zS)return _m;zS=1;var e=vD(),n=Cs();function r(i){return i==null?[]:e(i,n(i))}return _m=r,_m}var bm,BS;function Dn(){if(BS)return bm;BS=1;var e;if(typeof iy=="function")try{e={clone:kq(),constant:my(),each:JC(),filter:cT(),has:dT(),isArray:bt(),isEmpty:Yq(),isFunction:Aa(),isUndefined:fT(),keys:Cs(),map:pT(),reduce:mT(),size:nD(),transform:rD(),union:gD(),values:xT()}}catch{}return e||(e=window._),bm=e,bm}var Sm,US;function _y(){if(US)return Sm;US=1;var e=Dn();Sm=o;var n="\0",r="\0",i="";function o(d){this._isDirected=e.has(d,"directed")?d.directed:!0,this._isMultigraph=e.has(d,"multigraph")?d.multigraph:!1,this._isCompound=e.has(d,"compound")?d.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[r]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(d){return this._label=d,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultNodeLabelFn=d,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var d=this;return e.filter(this.nodes(),function(m){return e.isEmpty(d._in[m])})},o.prototype.sinks=function(){var d=this;return e.filter(this.nodes(),function(m){return e.isEmpty(d._out[m])})},o.prototype.setNodes=function(d,m){var y=arguments,w=this;return e.each(d,function(N){y.length>1?w.setNode(N,m):w.setNode(N)}),this},o.prototype.setNode=function(d,m){return e.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=m),this):(this._nodes[d]=arguments.length>1?m:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=r,this._children[d]={},this._children[r][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)},o.prototype.node=function(d){return this._nodes[d]},o.prototype.hasNode=function(d){return e.has(this._nodes,d)},o.prototype.removeNode=function(d){var m=this;if(e.has(this._nodes,d)){var y=function(w){m.removeEdge(m._edgeObjs[w])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],e.each(this.children(d),function(w){m.setParent(w)}),delete this._children[d]),e.each(e.keys(this._in[d]),y),delete this._in[d],delete this._preds[d],e.each(e.keys(this._out[d]),y),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this},o.prototype.setParent=function(d,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=r;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===d)throw new Error("Setting "+m+" as parent of "+d+" would create a cycle");this.setNode(m)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=m,this._children[m][d]=!0,this},o.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},o.prototype.parent=function(d){if(this._isCompound){var m=this._parent[d];if(m!==r)return m}},o.prototype.children=function(d){if(e.isUndefined(d)&&(d=r),this._isCompound){var m=this._children[d];if(m)return e.keys(m)}else{if(d===r)return this.nodes();if(this.hasNode(d))return[]}},o.prototype.predecessors=function(d){var m=this._preds[d];if(m)return e.keys(m)},o.prototype.successors=function(d){var m=this._sucs[d];if(m)return e.keys(m)},o.prototype.neighbors=function(d){var m=this.predecessors(d);if(m)return e.union(m,this.successors(d))},o.prototype.isLeaf=function(d){var m;return this.isDirected()?m=this.successors(d):m=this.neighbors(d),m.length===0},o.prototype.filterNodes=function(d){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(_,b){d(b)&&m.setNode(b,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var w={};function N(_){var b=y.parent(_);return b===void 0||m.hasNode(b)?(w[_]=b,b):b in w?w[b]:N(b)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,N(_))}),m},o.prototype.setDefaultEdgeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultEdgeLabelFn=d,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(d,m){var y=this,w=arguments;return e.reduce(d,function(N,_){return w.length>1?y.setEdge(N,_,m):y.setEdge(N,_),_}),this},o.prototype.setEdge=function(){var d,m,y,w,N=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(d=_.v,m=_.w,y=_.name,arguments.length===2&&(w=arguments[1],N=!0)):(d=_,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),d=""+d,m=""+m,e.isUndefined(y)||(y=""+y);var b=c(this._isDirected,d,m,y);if(e.has(this._edgeLabels,b))return N&&(this._edgeLabels[b]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(m),this._edgeLabels[b]=N?w:this._defaultEdgeLabelFn(d,m,y);var S=h(this._isDirected,d,m,y);return d=S.v,m=S.w,Object.freeze(S),this._edgeObjs[b]=S,l(this._preds[m],d),l(this._sucs[d],m),this._in[m][b]=S,this._out[d][b]=S,this._edgeCount++,this},o.prototype.edge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y);return this._edgeLabels[w]},o.prototype.hasEdge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y);return e.has(this._edgeLabels,w)},o.prototype.removeEdge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y),N=this._edgeObjs[w];return N&&(d=N.v,m=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],u(this._preds[m],d),u(this._sucs[d],m),delete this._in[m][w],delete this._out[d][w],this._edgeCount--),this},o.prototype.inEdges=function(d,m){var y=this._in[d];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.v===m}):w}},o.prototype.outEdges=function(d,m){var y=this._out[d];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.w===m}):w}},o.prototype.nodeEdges=function(d,m){var y=this.inEdges(d,m);if(y)return y.concat(this.outEdges(d,m))};function l(d,m){d[m]?d[m]++:d[m]=1}function u(d,m){--d[m]||delete d[m]}function c(d,m,y,w){var N=""+m,_=""+y;if(!d&&N>_){var b=N;N=_,_=b}return N+i+_+i+(e.isUndefined(w)?n:w)}function h(d,m,y,w){var N=""+m,_=""+y;if(!d&&N>_){var b=N;N=_,_=b}var S={v:N,w:_};return w&&(S.name=w),S}function p(d,m){return c(d,m.v,m.w,m.name)}return Sm}var km,HS;function yD(){return HS||(HS=1,km="2.1.8"),km}var Em,WS;function wD(){return WS||(WS=1,Em={Graph:_y(),version:yD()}),Em}var Nm,VS;function xD(){if(VS)return Nm;VS=1;var e=Dn(),n=_y();Nm={write:r,read:l};function r(u){var c={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:i(u),edges:o(u)};return e.isUndefined(u.graph())||(c.value=e.clone(u.graph())),c}function i(u){return e.map(u.nodes(),function(c){var h=u.node(c),p=u.parent(c),d={v:c};return e.isUndefined(h)||(d.value=h),e.isUndefined(p)||(d.parent=p),d})}function o(u){return e.map(u.edges(),function(c){var h=u.edge(c),p={v:c.v,w:c.w};return e.isUndefined(c.name)||(p.name=c.name),e.isUndefined(h)||(p.value=h),p})}function l(u){var c=new n(u.options).setGraph(u.value);return e.each(u.nodes,function(h){c.setNode(h.v,h.value),h.parent&&c.setParent(h.v,h.parent)}),e.each(u.edges,function(h){c.setEdge({v:h.v,w:h.w,name:h.name},h.value)}),c}return Nm}var Cm,GS;function _D(){if(GS)return Cm;GS=1;var e=Dn();Cm=n;function n(r){var i={},o=[],l;function u(c){e.has(i,c)||(i[c]=!0,l.push(c),e.each(r.successors(c),u),e.each(r.predecessors(c),u))}return e.each(r.nodes(),function(c){l=[],u(c),l.length&&o.push(l)}),o}return Cm}var Tm,YS;function _T(){if(YS)return Tm;YS=1;var e=Dn();Tm=n;function n(){this._arr=[],this._keyIndices={}}return n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map(function(r){return r.key})},n.prototype.has=function(r){return e.has(this._keyIndices,r)},n.prototype.priority=function(r){var i=this._keyIndices[r];if(i!==void 0)return this._arr[i].priority},n.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(r,i){var o=this._keyIndices;if(r=String(r),!e.has(o,r)){var l=this._arr,u=l.length;return o[r]=u,l.push({key:r,priority:i}),this._decrease(u),!0}return!1},n.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},n.prototype.decrease=function(r,i){var o=this._keyIndices[r];if(i>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[o].priority+" New: "+i);this._arr[o].priority=i,this._decrease(o)},n.prototype._heapify=function(r){var i=this._arr,o=2*r,l=o+1,u=r;o<i.length&&(u=i[o].priority<i[u].priority?o:u,l<i.length&&(u=i[l].priority<i[u].priority?l:u),u!==r&&(this._swap(r,u),this._heapify(u)))},n.prototype._decrease=function(r){for(var i=this._arr,o=i[r].priority,l;r!==0&&(l=r>>1,!(i[l].priority<o));)this._swap(r,l),r=l},n.prototype._swap=function(r,i){var o=this._arr,l=this._keyIndices,u=o[r],c=o[i];o[r]=c,o[i]=u,l[c.key]=r,l[u.key]=i},Tm}var Rm,KS;function bT(){if(KS)return Rm;KS=1;var e=Dn(),n=_T();Rm=i;var r=e.constant(1);function i(l,u,c,h){return o(l,String(u),c||r,h||function(p){return l.outEdges(p)})}function o(l,u,c,h){var p={},d=new n,m,y,w=function(N){var _=N.v!==m?N.v:N.w,b=p[_],S=c(N),k=y.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+S);k<b.distance&&(b.distance=k,b.predecessor=m,d.decrease(_,k))};for(l.nodes().forEach(function(N){var _=N===u?0:Number.POSITIVE_INFINITY;p[N]={distance:_},d.add(N,_)});d.size()>0&&(m=d.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)h(m).forEach(w);return p}return Rm}var jm,XS;function bD(){if(XS)return jm;XS=1;var e=bT(),n=Dn();jm=r;function r(i,o,l){return n.transform(i.nodes(),function(u,c){u[c]=e(i,c,o,l)},{})}return jm}var Am,QS;function ST(){if(QS)return Am;QS=1;var e=Dn();Am=n;function n(r){var i=0,o=[],l={},u=[];function c(h){var p=l[h]={onStack:!0,lowlink:i,index:i++};if(o.push(h),r.successors(h).forEach(function(y){e.has(l,y)?l[y].onStack&&(p.lowlink=Math.min(p.lowlink,l[y].index)):(c(y),p.lowlink=Math.min(p.lowlink,l[y].lowlink))}),p.lowlink===p.index){var d=[],m;do m=o.pop(),l[m].onStack=!1,d.push(m);while(h!==m);u.push(d)}}return r.nodes().forEach(function(h){e.has(l,h)||c(h)}),u}return Am}var Im,ZS;function SD(){if(ZS)return Im;ZS=1;var e=Dn(),n=ST();Im=r;function r(i){return e.filter(n(i),function(o){return o.length>1||o.length===1&&i.hasEdge(o[0],o[0])})}return Im}var Mm,JS;function kD(){if(JS)return Mm;JS=1;var e=Dn();Mm=r;var n=e.constant(1);function r(o,l,u){return i(o,l||n,u||function(c){return o.outEdges(c)})}function i(o,l,u){var c={},h=o.nodes();return h.forEach(function(p){c[p]={},c[p][p]={distance:0},h.forEach(function(d){p!==d&&(c[p][d]={distance:Number.POSITIVE_INFINITY})}),u(p).forEach(function(d){var m=d.v===p?d.w:d.v,y=l(d);c[p][m]={distance:y,predecessor:p}})}),h.forEach(function(p){var d=c[p];h.forEach(function(m){var y=c[m];h.forEach(function(w){var N=y[p],_=d[w],b=y[w],S=N.distance+_.distance;S<b.distance&&(b.distance=S,b.predecessor=_.predecessor)})})}),c}return Mm}var Om,ek;function kT(){if(ek)return Om;ek=1;var e=Dn();Om=n,n.CycleException=r;function n(i){var o={},l={},u=[];function c(h){if(e.has(l,h))throw new r;e.has(o,h)||(l[h]=!0,o[h]=!0,e.each(i.predecessors(h),c),delete l[h],u.push(h))}if(e.each(i.sinks(),c),e.size(o)!==i.nodeCount())throw new r;return u}function r(){}return r.prototype=new Error,Om}var Pm,tk;function ED(){if(tk)return Pm;tk=1;var e=kT();Pm=n;function n(r){try{e(r)}catch(i){if(i instanceof e.CycleException)return!1;throw i}return!0}return Pm}var Lm,nk;function ET(){if(nk)return Lm;nk=1;var e=Dn();Lm=n;function n(i,o,l){e.isArray(o)||(o=[o]);var u=(i.isDirected()?i.successors:i.neighbors).bind(i),c=[],h={};return e.each(o,function(p){if(!i.hasNode(p))throw new Error("Graph does not have node: "+p);r(i,p,l==="post",h,u,c)}),c}function r(i,o,l,u,c,h){e.has(u,o)||(u[o]=!0,l||h.push(o),e.each(c(o),function(p){r(i,p,l,u,c,h)}),l&&h.push(o))}return Lm}var $m,rk;function ND(){if(rk)return $m;rk=1;var e=ET();$m=n;function n(r,i){return e(r,i,"post")}return $m}var qm,sk;function CD(){if(sk)return qm;sk=1;var e=ET();qm=n;function n(r,i){return e(r,i,"pre")}return qm}var Dm,ik;function TD(){if(ik)return Dm;ik=1;var e=Dn(),n=_y(),r=_T();Dm=i;function i(o,l){var u=new n,c={},h=new r,p;function d(y){var w=y.v===p?y.w:y.v,N=h.priority(w);if(N!==void 0){var _=l(y);_<N&&(c[w]=p,h.decrease(w,_))}}if(o.nodeCount()===0)return u;e.each(o.nodes(),function(y){h.add(y,Number.POSITIVE_INFINITY),u.setNode(y)}),h.decrease(o.nodes()[0],0);for(var m=!1;h.size()>0;){if(p=h.removeMin(),e.has(c,p))u.setEdge(p,c[p]);else{if(m)throw new Error("Input graph is not connected: "+o);m=!0}o.nodeEdges(p).forEach(d)}return u}return Dm}var Fm,ok;function RD(){return ok||(ok=1,Fm={components:_D(),dijkstra:bT(),dijkstraAll:bD(),findCycles:SD(),floydWarshall:kD(),isAcyclic:ED(),postorder:ND(),preorder:CD(),prim:TD(),tarjan:ST(),topsort:kT()}),Fm}var zm,ak;function jD(){if(ak)return zm;ak=1;var e=wD();return zm={Graph:e.Graph,json:xD(),alg:RD(),version:e.version},zm}var Bm,lk;function nr(){if(lk)return Bm;lk=1;var e;if(typeof iy=="function")try{e=jD()}catch{}return e||(e=window.graphlib),Bm=e,Bm}var Um,uk;function AD(){if(uk)return Um;uk=1;var e=XC(),n=1,r=4;function i(o){return e(o,n|r)}return Um=i,Um}var Hm,ck;function Zu(){if(ck)return Hm;ck=1;var e=go(),n=Ur(),r=Uu(),i=qn();function o(l,u,c){if(!i(c))return!1;var h=typeof u;return(h=="number"?n(c)&&r(u,c.length):h=="string"&&u in c)?e(c[u],l):!1}return Hm=o,Hm}var Wm,dk;function ID(){if(dk)return Wm;dk=1;var e=Qu(),n=go(),r=Zu(),i=pi(),o=Object.prototype,l=o.hasOwnProperty,u=e(function(c,h){c=Object(c);var p=-1,d=h.length,m=d>2?h[2]:void 0;for(m&&r(h[0],h[1],m)&&(d=1);++p<d;)for(var y=h[p],w=i(y),N=-1,_=w.length;++N<_;){var b=w[N],S=c[b];(S===void 0||n(S,o[b])&&!l.call(c,b))&&(c[b]=y[b])}return c});return Wm=u,Wm}var Vm,fk;function MD(){if(fk)return Vm;fk=1;var e=Hr(),n=Ur(),r=Cs();function i(o){return function(l,u,c){var h=Object(l);if(!n(l)){var p=e(u,3);l=r(l),u=function(m){return p(h[m],m,h)}}var d=o(l,u,c);return d>-1?h[p?l[d]:d]:void 0}}return Vm=i,Vm}var Gm,hk;function OD(){if(hk)return Gm;hk=1;var e=/\s/;function n(r){for(var i=r.length;i--&&e.test(r.charAt(i)););return i}return Gm=n,Gm}var Ym,pk;function PD(){if(pk)return Ym;pk=1;var e=OD(),n=/^\s+/;function r(i){return i&&i.slice(0,e(i)+1).replace(n,"")}return Ym=r,Ym}var Km,mk;function LD(){if(mk)return Km;mk=1;var e=PD(),n=qn(),r=xo(),i=NaN,o=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;function h(p){if(typeof p=="number")return p;if(r(p))return i;if(n(p)){var d=typeof p.valueOf=="function"?p.valueOf():p;p=n(d)?d+"":d}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=l.test(p);return m||u.test(p)?c(p.slice(2),m?2:8):o.test(p)?i:+p}return Km=h,Km}var Xm,gk;function NT(){if(gk)return Xm;gk=1;var e=LD(),n=1/0,r=17976931348623157e292;function i(o){if(!o)return o===0?o:0;if(o=e(o),o===n||o===-n){var l=o<0?-1:1;return l*r}return o===o?o:0}return Xm=i,Xm}var Qm,vk;function $D(){if(vk)return Qm;vk=1;var e=NT();function n(r){var i=e(r),o=i%1;return i===i?o?i-o:i:0}return Qm=n,Qm}var Zm,yk;function qD(){if(yk)return Zm;yk=1;var e=yT(),n=Hr(),r=$D(),i=Math.max;function o(l,u,c){var h=l==null?0:l.length;if(!h)return-1;var p=c==null?0:r(c);return p<0&&(p=i(h+p,0)),e(l,n(u,3),p)}return Zm=o,Zm}var Jm,wk;function DD(){if(wk)return Jm;wk=1;var e=MD(),n=qD(),r=e(n);return Jm=r,Jm}var eg,xk;function CT(){if(xk)return eg;xk=1;var e=xy();function n(r){var i=r==null?0:r.length;return i?e(r,1):[]}return eg=n,eg}var tg,_k;function FD(){if(_k)return tg;_k=1;var e=gy(),n=QC(),r=pi();function i(o,l){return o==null?o:e(o,n(l),r)}return tg=i,tg}var ng,bk;function zD(){if(bk)return ng;bk=1;function e(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}return ng=e,ng}var rg,Sk;function BD(){if(Sk)return rg;Sk=1;var e=zu(),n=vy(),r=Hr();function i(o,l){var u={};return l=r(l,3),n(o,function(c,h,p){e(u,h,l(c,h,p))}),u}return rg=i,rg}var sg,kk;function by(){if(kk)return sg;kk=1;var e=xo();function n(r,i,o){for(var l=-1,u=r.length;++l<u;){var c=r[l],h=i(c);if(h!=null&&(p===void 0?h===h&&!e(h):o(h,p)))var p=h,d=c}return d}return sg=n,sg}var ig,Ek;function UD(){if(Ek)return ig;Ek=1;function e(n,r){return n>r}return ig=e,ig}var og,Nk;function HD(){if(Nk)return og;Nk=1;var e=by(),n=UD(),r=mi();function i(o){return o&&o.length?e(o,r,n):void 0}return og=i,og}var ag,Ck;function TT(){if(Ck)return ag;Ck=1;var e=zu(),n=go();function r(i,o,l){(l!==void 0&&!n(i[o],l)||l===void 0&&!(o in i))&&e(i,o,l)}return ag=r,ag}var lg,Tk;function WD(){if(Tk)return lg;Tk=1;var e=fi(),n=Vu(),r=mr(),i="[object Object]",o=Function.prototype,l=Object.prototype,u=o.toString,c=l.hasOwnProperty,h=u.call(Object);function p(d){if(!r(d)||e(d)!=i)return!1;var m=n(d);if(m===null)return!0;var y=c.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&u.call(y)==h}return lg=p,lg}var ug,Rk;function RT(){if(Rk)return ug;Rk=1;function e(n,r){if(!(r==="constructor"&&typeof n[r]=="function")&&r!="__proto__")return n[r]}return ug=e,ug}var cg,jk;function VD(){if(jk)return cg;jk=1;var e=Ia(),n=pi();function r(i){return e(i,n(i))}return cg=r,cg}var dg,Ak;function GD(){if(Ak)return dg;Ak=1;var e=TT(),n=qC(),r=GC(),i=DC(),o=KC(),l=Ma(),u=bt(),c=wT(),h=yo(),p=Aa(),d=qn(),m=WD(),y=Oa(),w=RT(),N=VD();function _(b,S,k,E,T,I,O){var A=w(b,k),U=w(S,k),z=O.get(U);if(z){e(b,k,z);return}var P=I?I(A,U,k+"",b,S,O):void 0,D=P===void 0;if(D){var V=u(U),B=!V&&h(U),C=!V&&!B&&y(U);P=U,V||B||C?u(A)?P=A:c(A)?P=i(A):B?(D=!1,P=n(U,!0)):C?(D=!1,P=r(U,!0)):P=[]:m(U)||l(U)?(P=A,l(A)?P=N(A):(!d(A)||p(A))&&(P=o(U))):D=!1}D&&(O.set(U,P),T(P,U,E,I,O),O.delete(U)),e(b,k,P)}return dg=_,dg}var fg,Ik;function YD(){if(Ik)return fg;Ik=1;var e=Fu(),n=TT(),r=gy(),i=GD(),o=qn(),l=pi(),u=RT();function c(h,p,d,m,y){h!==p&&r(p,function(w,N){if(y||(y=new e),o(w))i(h,p,N,d,c,m,y);else{var _=m?m(u(h,N),w,N+"",h,p,y):void 0;_===void 0&&(_=w),n(h,N,_)}},l)}return fg=c,fg}var hg,Mk;function KD(){if(Mk)return hg;Mk=1;var e=Qu(),n=Zu();function r(i){return e(function(o,l){var u=-1,c=l.length,h=c>1?l[c-1]:void 0,p=c>2?l[2]:void 0;for(h=i.length>3&&typeof h=="function"?(c--,h):void 0,p&&n(l[0],l[1],p)&&(h=c<3?void 0:h,c=1),o=Object(o);++u<c;){var d=l[u];d&&i(o,d,u,h)}return o})}return hg=r,hg}var pg,Ok;function XD(){if(Ok)return pg;Ok=1;var e=YD(),n=KD(),r=n(function(i,o,l){e(i,o,l)});return pg=r,pg}var mg,Pk;function jT(){if(Pk)return mg;Pk=1;function e(n,r){return n<r}return mg=e,mg}var gg,Lk;function QD(){if(Lk)return gg;Lk=1;var e=by(),n=jT(),r=mi();function i(o){return o&&o.length?e(o,r,n):void 0}return gg=i,gg}var vg,$k;function ZD(){if($k)return vg;$k=1;var e=by(),n=Hr(),r=jT();function i(o,l){return o&&o.length?e(o,n(l,2),r):void 0}return vg=i,vg}var yg,qk;function JD(){if(qk)return yg;qk=1;var e=sr(),n=function(){return e.Date.now()};return yg=n,yg}var wg,Dk;function e4(){if(Dk)return wg;Dk=1;var e=Bu(),n=Ku(),r=Uu(),i=qn(),o=Pa();function l(u,c,h,p){if(!i(u))return u;c=n(c,u);for(var d=-1,m=c.length,y=m-1,w=u;w!=null&&++d<m;){var N=o(c[d]),_=h;if(N==="__proto__"||N==="constructor"||N==="prototype")return u;if(d!=y){var b=w[N];_=p?p(b,N,w):void 0,_===void 0&&(_=i(b)?b:r(c[d+1])?[]:{})}e(w,N,_),w=w[N]}return u}return wg=l,wg}var xg,Fk;function t4(){if(Fk)return xg;Fk=1;var e=Xu(),n=e4(),r=Ku();function i(o,l,u){for(var c=-1,h=l.length,p={};++c<h;){var d=l[c],m=e(o,d);u(m,d)&&n(p,r(d,o),m)}return p}return xg=i,xg}var _g,zk;function n4(){if(zk)return _g;zk=1;var e=t4(),n=lT();function r(i,o){return e(i,o,function(l,u){return n(i,u)})}return _g=r,_g}var bg,Bk;function r4(){if(Bk)return bg;Bk=1;var e=CT(),n=gT(),r=vT();function i(o){return r(n(o,void 0,e),o+"")}return bg=i,bg}var Sg,Uk;function s4(){if(Uk)return Sg;Uk=1;var e=n4(),n=r4(),r=n(function(i,o){return i==null?{}:e(i,o)});return Sg=r,Sg}var kg,Hk;function i4(){if(Hk)return kg;Hk=1;var e=Math.ceil,n=Math.max;function r(i,o,l,u){for(var c=-1,h=n(e((o-i)/(l||1)),0),p=Array(h);h--;)p[u?h:++c]=i,i+=l;return p}return kg=r,kg}var Eg,Wk;function o4(){if(Wk)return Eg;Wk=1;var e=i4(),n=Zu(),r=NT();function i(o){return function(l,u,c){return c&&typeof c!="number"&&n(l,u,c)&&(u=c=void 0),l=r(l),u===void 0?(u=l,l=0):u=r(u),c=c===void 0?l<u?1:-1:r(c),e(l,u,c,o)}}return Eg=i,Eg}var Ng,Vk;function a4(){if(Vk)return Ng;Vk=1;var e=o4(),n=e();return Ng=n,Ng}var Cg,Gk;function l4(){if(Gk)return Cg;Gk=1;function e(n,r){var i=n.length;for(n.sort(r);i--;)n[i]=n[i].value;return n}return Cg=e,Cg}var Tg,Yk;function u4(){if(Yk)return Tg;Yk=1;var e=xo();function n(r,i){if(r!==i){var o=r!==void 0,l=r===null,u=r===r,c=e(r),h=i!==void 0,p=i===null,d=i===i,m=e(i);if(!p&&!m&&!c&&r>i||c&&h&&d&&!p&&!m||l&&h&&d||!o&&d||!u)return 1;if(!l&&!c&&!m&&r<i||m&&o&&u&&!l&&!c||p&&o&&u||!h&&u||!d)return-1}return 0}return Tg=n,Tg}var Rg,Kk;function c4(){if(Kk)return Rg;Kk=1;var e=u4();function n(r,i,o){for(var l=-1,u=r.criteria,c=i.criteria,h=u.length,p=o.length;++l<h;){var d=e(u[l],c[l]);if(d){if(l>=p)return d;var m=o[l];return d*(m=="desc"?-1:1)}}return r.index-i.index}return Rg=n,Rg}var jg,Xk;function d4(){if(Xk)return jg;Xk=1;var e=Yu(),n=Xu(),r=Hr(),i=hT(),o=l4(),l=Hu(),u=c4(),c=mi(),h=bt();function p(d,m,y){m.length?m=e(m,function(_){return h(_)?function(b){return n(b,_.length===1?_[0]:_)}:_}):m=[c];var w=-1;m=e(m,l(r));var N=i(d,function(_,b,S){var k=e(m,function(E){return E(_)});return{criteria:k,index:++w,value:_}});return o(N,function(_,b){return u(_,b,y)})}return jg=p,jg}var Ag,Qk;function f4(){if(Qk)return Ag;Qk=1;var e=xy(),n=d4(),r=Qu(),i=Zu(),o=r(function(l,u){if(l==null)return[];var c=u.length;return c>1&&i(l,u[0],u[1])?u=[]:c>2&&i(u[0],u[1],u[2])&&(u=[u[0]]),n(l,e(u,1),[])});return Ag=o,Ag}var Ig,Zk;function h4(){if(Zk)return Ig;Zk=1;var e=oT(),n=0;function r(i){var o=++n;return e(i)+o}return Ig=r,Ig}var Mg,Jk;function p4(){if(Jk)return Mg;Jk=1;function e(n,r,i){for(var o=-1,l=n.length,u=r.length,c={};++o<l;){var h=o<u?r[o]:void 0;i(c,n[o],h)}return c}return Mg=e,Mg}var Og,eE;function m4(){if(eE)return Og;eE=1;var e=Bu(),n=p4();function r(i,o){return n(i||[],o||[],e)}return Og=r,Og}var Pg,tE;function lt(){if(tE)return Pg;tE=1;var e;if(typeof iy=="function")try{e={cloneDeep:AD(),constant:my(),defaults:ID(),each:JC(),filter:cT(),find:DD(),flatten:CT(),forEach:ZC(),forIn:FD(),has:dT(),isUndefined:fT(),last:zD(),map:pT(),mapValues:BD(),max:HD(),merge:XD(),min:QD(),minBy:ZD(),now:JD(),pick:s4(),range:a4(),reduce:mT(),sortBy:f4(),uniqueId:h4(),values:xT(),zipObject:m4()}}catch{}return e||(e=window._),Pg=e,Pg}var Lg,nE;function g4(){if(nE)return Lg;nE=1,Lg=e;function e(){var i={};i._next=i._prev=i,this._sentinel=i}e.prototype.dequeue=function(){var i=this._sentinel,o=i._prev;if(o!==i)return n(o),o},e.prototype.enqueue=function(i){var o=this._sentinel;i._prev&&i._next&&n(i),i._next=o._next,o._next._prev=i,o._next=i,i._prev=o},e.prototype.toString=function(){for(var i=[],o=this._sentinel,l=o._prev;l!==o;)i.push(JSON.stringify(l,r)),l=l._prev;return"["+i.join(", ")+"]"};function n(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function r(i,o){if(i!=="_next"&&i!=="_prev")return o}return Lg}var $g,rE;function v4(){if(rE)return $g;rE=1;var e=lt(),n=nr().Graph,r=g4();$g=o;var i=e.constant(1);function o(p,d){if(p.nodeCount()<=1)return[];var m=c(p,d||i),y=l(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function l(p,d,m){for(var y=[],w=d[d.length-1],N=d[0],_;p.nodeCount();){for(;_=N.dequeue();)u(p,d,m,_);for(;_=w.dequeue();)u(p,d,m,_);if(p.nodeCount()){for(var b=d.length-2;b>0;--b)if(_=d[b].dequeue(),_){y=y.concat(u(p,d,m,_,!0));break}}}return y}function u(p,d,m,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var b=p.edge(_),S=p.node(_.v);w&&N.push({v:_.v,w:_.w}),S.out-=b,h(d,m,S)}),e.forEach(p.outEdges(y.v),function(_){var b=p.edge(_),S=_.w,k=p.node(S);k.in-=b,h(d,m,k)}),p.removeNode(y.v),N}function c(p,d){var m=new n,y=0,w=0;e.forEach(p.nodes(),function(b){m.setNode(b,{v:b,in:0,out:0})}),e.forEach(p.edges(),function(b){var S=m.edge(b.v,b.w)||0,k=d(b),E=S+k;m.setEdge(b.v,b.w,E),w=Math.max(w,m.node(b.v).out+=k),y=Math.max(y,m.node(b.w).in+=k)});var N=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(m.nodes(),function(b){h(N,_,m.node(b))}),{graph:m,buckets:N,zeroIdx:_}}function h(p,d,m){m.out?m.in?p[m.out-m.in+d].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return $g}var qg,sE;function y4(){if(sE)return qg;sE=1;var e=lt(),n=v4();qg={run:r,undo:o};function r(l){var u=l.graph().acyclicer==="greedy"?n(l,c(l)):i(l);e.forEach(u,function(h){var p=l.edge(h);l.removeEdge(h),p.forwardName=h.name,p.reversed=!0,l.setEdge(h.w,h.v,p,e.uniqueId("rev"))});function c(h){return function(p){return h.edge(p).weight}}}function i(l){var u=[],c={},h={};function p(d){e.has(h,d)||(h[d]=!0,c[d]=!0,e.forEach(l.outEdges(d),function(m){e.has(c,m.w)?u.push(m):p(m.w)}),delete c[d])}return e.forEach(l.nodes(),p),u}function o(l){e.forEach(l.edges(),function(u){var c=l.edge(u);if(c.reversed){l.removeEdge(u);var h=c.forwardName;delete c.reversed,delete c.forwardName,l.setEdge(u.w,u.v,c,h)}})}return qg}var Dg,iE;function fn(){if(iE)return Dg;iE=1;var e=lt(),n=nr().Graph;Dg={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:l,predecessorWeights:u,intersectRect:c,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:d,addBorderNode:m,maxRank:y,partition:w,time:N,notime:_};function r(b,S,k,E){var T;do T=e.uniqueId(E);while(b.hasNode(T));return k.dummy=S,b.setNode(T,k),T}function i(b){var S=new n().setGraph(b.graph());return e.forEach(b.nodes(),function(k){S.setNode(k,b.node(k))}),e.forEach(b.edges(),function(k){var E=S.edge(k.v,k.w)||{weight:0,minlen:1},T=b.edge(k);S.setEdge(k.v,k.w,{weight:E.weight+T.weight,minlen:Math.max(E.minlen,T.minlen)})}),S}function o(b){var S=new n({multigraph:b.isMultigraph()}).setGraph(b.graph());return e.forEach(b.nodes(),function(k){b.children(k).length||S.setNode(k,b.node(k))}),e.forEach(b.edges(),function(k){S.setEdge(k,b.edge(k))}),S}function l(b){var S=e.map(b.nodes(),function(k){var E={};return e.forEach(b.outEdges(k),function(T){E[T.w]=(E[T.w]||0)+b.edge(T).weight}),E});return e.zipObject(b.nodes(),S)}function u(b){var S=e.map(b.nodes(),function(k){var E={};return e.forEach(b.inEdges(k),function(T){E[T.v]=(E[T.v]||0)+b.edge(T).weight}),E});return e.zipObject(b.nodes(),S)}function c(b,S){var k=b.x,E=b.y,T=S.x-k,I=S.y-E,O=b.width/2,A=b.height/2;if(!T&&!I)throw new Error("Not possible to find intersection inside of the rectangle");var U,z;return Math.abs(I)*O>Math.abs(T)*A?(I<0&&(A=-A),U=A*T/I,z=A):(T<0&&(O=-O),U=O,z=O*I/T),{x:k+U,y:E+z}}function h(b){var S=e.map(e.range(y(b)+1),function(){return[]});return e.forEach(b.nodes(),function(k){var E=b.node(k),T=E.rank;e.isUndefined(T)||(S[T][E.order]=k)}),S}function p(b){var S=e.min(e.map(b.nodes(),function(k){return b.node(k).rank}));e.forEach(b.nodes(),function(k){var E=b.node(k);e.has(E,"rank")&&(E.rank-=S)})}function d(b){var S=e.min(e.map(b.nodes(),function(I){return b.node(I).rank})),k=[];e.forEach(b.nodes(),function(I){var O=b.node(I).rank-S;k[O]||(k[O]=[]),k[O].push(I)});var E=0,T=b.graph().nodeRankFactor;e.forEach(k,function(I,O){e.isUndefined(I)&&O%T!==0?--E:E&&e.forEach(I,function(A){b.node(A).rank+=E})})}function m(b,S,k,E){var T={width:0,height:0};return arguments.length>=4&&(T.rank=k,T.order=E),r(b,"border",T,S)}function y(b){return e.max(e.map(b.nodes(),function(S){var k=b.node(S).rank;if(!e.isUndefined(k))return k}))}function w(b,S){var k={lhs:[],rhs:[]};return e.forEach(b,function(E){S(E)?k.lhs.push(E):k.rhs.push(E)}),k}function N(b,S){var k=e.now();try{return S()}finally{console.log(b+" time: "+(e.now()-k)+"ms")}}function _(b,S){return S()}return Dg}var Fg,oE;function w4(){if(oE)return Fg;oE=1;var e=lt(),n=fn();Fg={run:r,undo:o};function r(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(u){i(l,u)})}function i(l,u){var c=u.v,h=l.node(c).rank,p=u.w,d=l.node(p).rank,m=u.name,y=l.edge(u),w=y.labelRank;if(d!==h+1){l.removeEdge(u);var N,_,b;for(b=0,++h;h<d;++b,++h)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:u,rank:h},N=n.addDummyNode(l,"edge",_,"_d"),h===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),l.setEdge(c,N,{weight:y.weight},m),b===0&&l.graph().dummyChains.push(N),c=N;l.setEdge(c,p,{weight:y.weight},m)}}function o(l){e.forEach(l.graph().dummyChains,function(u){var c=l.node(u),h=c.edgeLabel,p;for(l.setEdge(c.edgeObj,h);c.dummy;)p=l.successors(u)[0],l.removeNode(u),h.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(h.x=c.x,h.y=c.y,h.width=c.width,h.height=c.height),u=p,c=l.node(u)})}return Fg}var zg,aE;function Nu(){if(aE)return zg;aE=1;var e=lt();zg={longestPath:n,slack:r};function n(i){var o={};function l(u){var c=i.node(u);if(e.has(o,u))return c.rank;o[u]=!0;var h=e.min(e.map(i.outEdges(u),function(p){return l(p.w)-i.edge(p).minlen}));return(h===Number.POSITIVE_INFINITY||h===void 0||h===null)&&(h=0),c.rank=h}e.forEach(i.sources(),l)}function r(i,o){return i.node(o.w).rank-i.node(o.v).rank-i.edge(o).minlen}return zg}var Bg,lE;function AT(){if(lE)return Bg;lE=1;var e=lt(),n=nr().Graph,r=Nu().slack;Bg=i;function i(c){var h=new n({directed:!1}),p=c.nodes()[0],d=c.nodeCount();h.setNode(p,{});for(var m,y;o(h,c)<d;)m=l(h,c),y=h.hasNode(m.v)?r(c,m):-r(c,m),u(h,c,y);return h}function o(c,h){function p(d){e.forEach(h.nodeEdges(d),function(m){var y=m.v,w=d===y?m.w:y;!c.hasNode(w)&&!r(h,m)&&(c.setNode(w,{}),c.setEdge(d,w,{}),p(w))})}return e.forEach(c.nodes(),p),c.nodeCount()}function l(c,h){return e.minBy(h.edges(),function(p){if(c.hasNode(p.v)!==c.hasNode(p.w))return r(h,p)})}function u(c,h,p){e.forEach(c.nodes(),function(d){h.node(d).rank+=p})}return Bg}var Ug,uE;function x4(){if(uE)return Ug;uE=1;var e=lt(),n=AT(),r=Nu().slack,i=Nu().longestPath,o=nr().alg.preorder,l=nr().alg.postorder,u=fn().simplify;Ug=c,c.initLowLimValues=m,c.initCutValues=h,c.calcCutValue=d,c.leaveEdge=w,c.enterEdge=N,c.exchangeEdges=_;function c(E){E=u(E),i(E);var T=n(E);m(T),h(T,E);for(var I,O;I=w(T);)O=N(T,E,I),_(T,E,I,O)}function h(E,T){var I=l(E,E.nodes());I=I.slice(0,I.length-1),e.forEach(I,function(O){p(E,T,O)})}function p(E,T,I){var O=E.node(I),A=O.parent;E.edge(I,A).cutvalue=d(E,T,I)}function d(E,T,I){var O=E.node(I),A=O.parent,U=!0,z=T.edge(I,A),P=0;return z||(U=!1,z=T.edge(A,I)),P=z.weight,e.forEach(T.nodeEdges(I),function(D){var V=D.v===I,B=V?D.w:D.v;if(B!==A){var C=V===U,q=T.edge(D).weight;if(P+=C?q:-q,S(E,I,B)){var L=E.edge(I,B).cutvalue;P+=C?-L:L}}}),P}function m(E,T){arguments.length<2&&(T=E.nodes()[0]),y(E,{},1,T)}function y(E,T,I,O,A){var U=I,z=E.node(O);return T[O]=!0,e.forEach(E.neighbors(O),function(P){e.has(T,P)||(I=y(E,T,I,P,O))}),z.low=U,z.lim=I++,A?z.parent=A:delete z.parent,I}function w(E){return e.find(E.edges(),function(T){return E.edge(T).cutvalue<0})}function N(E,T,I){var O=I.v,A=I.w;T.hasEdge(O,A)||(O=I.w,A=I.v);var U=E.node(O),z=E.node(A),P=U,D=!1;U.lim>z.lim&&(P=z,D=!0);var V=e.filter(T.edges(),function(B){return D===k(E,E.node(B.v),P)&&D!==k(E,E.node(B.w),P)});return e.minBy(V,function(B){return r(T,B)})}function _(E,T,I,O){var A=I.v,U=I.w;E.removeEdge(A,U),E.setEdge(O.v,O.w,{}),m(E),h(E,T),b(E,T)}function b(E,T){var I=e.find(E.nodes(),function(A){return!T.node(A).parent}),O=o(E,I);O=O.slice(1),e.forEach(O,function(A){var U=E.node(A).parent,z=T.edge(A,U),P=!1;z||(z=T.edge(U,A),P=!0),T.node(A).rank=T.node(U).rank+(P?z.minlen:-z.minlen)})}function S(E,T,I){return E.hasEdge(T,I)}function k(E,T,I){return I.low<=T.lim&&T.lim<=I.lim}return Ug}var Hg,cE;function _4(){if(cE)return Hg;cE=1;var e=Nu(),n=e.longestPath,r=AT(),i=x4();Hg=o;function o(h){switch(h.graph().ranker){case"network-simplex":c(h);break;case"tight-tree":u(h);break;case"longest-path":l(h);break;default:c(h)}}var l=n;function u(h){n(h),r(h)}function c(h){i(h)}return Hg}var Wg,dE;function b4(){if(dE)return Wg;dE=1;var e=lt();Wg=n;function n(o){var l=i(o);e.forEach(o.graph().dummyChains,function(u){for(var c=o.node(u),h=c.edgeObj,p=r(o,l,h.v,h.w),d=p.path,m=p.lca,y=0,w=d[y],N=!0;u!==h.w;){if(c=o.node(u),N){for(;(w=d[y])!==m&&o.node(w).maxRank<c.rank;)y++;w===m&&(N=!1)}if(!N){for(;y<d.length-1&&o.node(w=d[y+1]).minRank<=c.rank;)y++;w=d[y]}o.setParent(u,w),u=o.successors(u)[0]}})}function r(o,l,u,c){var h=[],p=[],d=Math.min(l[u].low,l[c].low),m=Math.max(l[u].lim,l[c].lim),y,w;y=u;do y=o.parent(y),h.push(y);while(y&&(l[y].low>d||m>l[y].lim));for(w=y,y=c;(y=o.parent(y))!==w;)p.push(y);return{path:h.concat(p.reverse()),lca:w}}function i(o){var l={},u=0;function c(h){var p=u;e.forEach(o.children(h),c),l[h]={low:p,lim:u++}}return e.forEach(o.children(),c),l}return Wg}var Vg,fE;function S4(){if(fE)return Vg;fE=1;var e=lt(),n=fn();Vg={run:r,cleanup:u};function r(c){var h=n.addDummyNode(c,"root",{},"_root"),p=o(c),d=e.max(e.values(p))-1,m=2*d+1;c.graph().nestingRoot=h,e.forEach(c.edges(),function(w){c.edge(w).minlen*=m});var y=l(c)+1;e.forEach(c.children(),function(w){i(c,h,m,y,d,p,w)}),c.graph().nodeRankFactor=m}function i(c,h,p,d,m,y,w){var N=c.children(w);if(!N.length){w!==h&&c.setEdge(h,w,{weight:0,minlen:p});return}var _=n.addBorderNode(c,"_bt"),b=n.addBorderNode(c,"_bb"),S=c.node(w);c.setParent(_,w),S.borderTop=_,c.setParent(b,w),S.borderBottom=b,e.forEach(N,function(k){i(c,h,p,d,m,y,k);var E=c.node(k),T=E.borderTop?E.borderTop:k,I=E.borderBottom?E.borderBottom:k,O=E.borderTop?d:2*d,A=T!==I?1:m-y[w]+1;c.setEdge(_,T,{weight:O,minlen:A,nestingEdge:!0}),c.setEdge(I,b,{weight:O,minlen:A,nestingEdge:!0})}),c.parent(w)||c.setEdge(h,_,{weight:0,minlen:m+y[w]})}function o(c){var h={};function p(d,m){var y=c.children(d);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),h[d]=m}return e.forEach(c.children(),function(d){p(d,1)}),h}function l(c){return e.reduce(c.edges(),function(h,p){return h+c.edge(p).weight},0)}function u(c){var h=c.graph();c.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(c.edges(),function(p){var d=c.edge(p);d.nestingEdge&&c.removeEdge(p)})}return Vg}var Gg,hE;function k4(){if(hE)return Gg;hE=1;var e=lt(),n=fn();Gg=r;function r(o){function l(u){var c=o.children(u),h=o.node(u);if(c.length&&e.forEach(c,l),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,d=h.maxRank+1;p<d;++p)i(o,"borderLeft","_bl",u,h,p),i(o,"borderRight","_br",u,h,p)}}e.forEach(o.children(),l)}function i(o,l,u,c,h,p){var d={width:0,height:0,rank:p,borderType:l},m=h[l][p-1],y=n.addDummyNode(o,"border",d,u);h[l][p]=y,o.setParent(y,c),m&&o.setEdge(m,y,{weight:1})}return Gg}var Yg,pE;function E4(){if(pE)return Yg;pE=1;var e=lt();Yg={adjust:n,undo:r};function n(p){var d=p.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&i(p)}function r(p){var d=p.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&l(p),(d==="lr"||d==="rl")&&(c(p),i(p))}function i(p){e.forEach(p.nodes(),function(d){o(p.node(d))}),e.forEach(p.edges(),function(d){o(p.edge(d))})}function o(p){var d=p.width;p.width=p.height,p.height=d}function l(p){e.forEach(p.nodes(),function(d){u(p.node(d))}),e.forEach(p.edges(),function(d){var m=p.edge(d);e.forEach(m.points,u),e.has(m,"y")&&u(m)})}function u(p){p.y=-p.y}function c(p){e.forEach(p.nodes(),function(d){h(p.node(d))}),e.forEach(p.edges(),function(d){var m=p.edge(d);e.forEach(m.points,h),e.has(m,"x")&&h(m)})}function h(p){var d=p.x;p.x=p.y,p.y=d}return Yg}var Kg,mE;function N4(){if(mE)return Kg;mE=1;var e=lt();Kg=n;function n(r){var i={},o=e.filter(r.nodes(),function(p){return!r.children(p).length}),l=e.max(e.map(o,function(p){return r.node(p).rank})),u=e.map(e.range(l+1),function(){return[]});function c(p){if(!e.has(i,p)){i[p]=!0;var d=r.node(p);u[d.rank].push(p),e.forEach(r.successors(p),c)}}var h=e.sortBy(o,function(p){return r.node(p).rank});return e.forEach(h,c),u}return Kg}var Xg,gE;function C4(){if(gE)return Xg;gE=1;var e=lt();Xg=n;function n(i,o){for(var l=0,u=1;u<o.length;++u)l+=r(i,o[u-1],o[u]);return l}function r(i,o,l){for(var u=e.zipObject(l,e.map(l,function(y,w){return w})),c=e.flatten(e.map(o,function(y){return e.sortBy(e.map(i.outEdges(y),function(w){return{pos:u[w.w],weight:i.edge(w).weight}}),"pos")}),!0),h=1;h<l.length;)h<<=1;var p=2*h-1;h-=1;var d=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(c.forEach(function(y){var w=y.pos+h;d[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=d[w+1]),w=w-1>>1,d[w]+=y.weight;m+=y.weight*N})),m}return Xg}var Qg,vE;function T4(){if(vE)return Qg;vE=1;var e=lt();Qg=n;function n(r,i){return e.map(i,function(o){var l=r.inEdges(o);if(l.length){var u=e.reduce(l,function(c,h){var p=r.edge(h),d=r.node(h.v);return{sum:c.sum+p.weight*d.order,weight:c.weight+p.weight}},{sum:0,weight:0});return{v:o,barycenter:u.sum/u.weight,weight:u.weight}}else return{v:o}})}return Qg}var Zg,yE;function R4(){if(yE)return Zg;yE=1;var e=lt();Zg=n;function n(o,l){var u={};e.forEach(o,function(h,p){var d=u[h.v]={indegree:0,in:[],out:[],vs:[h.v],i:p};e.isUndefined(h.barycenter)||(d.barycenter=h.barycenter,d.weight=h.weight)}),e.forEach(l.edges(),function(h){var p=u[h.v],d=u[h.w];!e.isUndefined(p)&&!e.isUndefined(d)&&(d.indegree++,p.out.push(u[h.w]))});var c=e.filter(u,function(h){return!h.indegree});return r(c)}function r(o){var l=[];function u(p){return function(d){d.merged||(e.isUndefined(d.barycenter)||e.isUndefined(p.barycenter)||d.barycenter>=p.barycenter)&&i(p,d)}}function c(p){return function(d){d.in.push(p),--d.indegree===0&&o.push(d)}}for(;o.length;){var h=o.pop();l.push(h),e.forEach(h.in.reverse(),u(h)),e.forEach(h.out,c(h))}return e.map(e.filter(l,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function i(o,l){var u=0,c=0;o.weight&&(u+=o.barycenter*o.weight,c+=o.weight),l.weight&&(u+=l.barycenter*l.weight,c+=l.weight),o.vs=l.vs.concat(o.vs),o.barycenter=u/c,o.weight=c,o.i=Math.min(l.i,o.i),l.merged=!0}return Zg}var Jg,wE;function j4(){if(wE)return Jg;wE=1;var e=lt(),n=fn();Jg=r;function r(l,u){var c=n.partition(l,function(_){return e.has(_,"barycenter")}),h=c.lhs,p=e.sortBy(c.rhs,function(_){return-_.i}),d=[],m=0,y=0,w=0;h.sort(o(!!u)),w=i(d,p,w),e.forEach(h,function(_){w+=_.vs.length,d.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,w=i(d,p,w)});var N={vs:e.flatten(d,!0)};return y&&(N.barycenter=m/y,N.weight=y),N}function i(l,u,c){for(var h;u.length&&(h=e.last(u)).i<=c;)u.pop(),l.push(h.vs),c++;return c}function o(l){return function(u,c){return u.barycenter<c.barycenter?-1:u.barycenter>c.barycenter?1:l?c.i-u.i:u.i-c.i}}return Jg}var ev,xE;function A4(){if(xE)return ev;xE=1;var e=lt(),n=T4(),r=R4(),i=j4();ev=o;function o(c,h,p,d){var m=c.children(h),y=c.node(h),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,_={};w&&(m=e.filter(m,function(I){return I!==w&&I!==N}));var b=n(c,m);e.forEach(b,function(I){if(c.children(I.v).length){var O=o(c,I.v,p,d);_[I.v]=O,e.has(O,"barycenter")&&u(I,O)}});var S=r(b,p);l(S,_);var k=i(S,d);if(w&&(k.vs=e.flatten([w,k.vs,N],!0),c.predecessors(w).length)){var E=c.node(c.predecessors(w)[0]),T=c.node(c.predecessors(N)[0]);e.has(k,"barycenter")||(k.barycenter=0,k.weight=0),k.barycenter=(k.barycenter*k.weight+E.order+T.order)/(k.weight+2),k.weight+=2}return k}function l(c,h){e.forEach(c,function(p){p.vs=e.flatten(p.vs.map(function(d){return h[d]?h[d].vs:d}),!0)})}function u(c,h){e.isUndefined(c.barycenter)?(c.barycenter=h.barycenter,c.weight=h.weight):(c.barycenter=(c.barycenter*c.weight+h.barycenter*h.weight)/(c.weight+h.weight),c.weight+=h.weight)}return ev}var tv,_E;function I4(){if(_E)return tv;_E=1;var e=lt(),n=nr().Graph;tv=r;function r(o,l,u){var c=i(o),h=new n({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(p){return o.node(p)});return e.forEach(o.nodes(),function(p){var d=o.node(p),m=o.parent(p);(d.rank===l||d.minRank<=l&&l<=d.maxRank)&&(h.setNode(p),h.setParent(p,m||c),e.forEach(o[u](p),function(y){var w=y.v===p?y.w:y.v,N=h.edge(w,p),_=e.isUndefined(N)?0:N.weight;h.setEdge(w,p,{weight:o.edge(y).weight+_})}),e.has(d,"minRank")&&h.setNode(p,{borderLeft:d.borderLeft[l],borderRight:d.borderRight[l]}))}),h}function i(o){for(var l;o.hasNode(l=e.uniqueId("_root")););return l}return tv}var nv,bE;function M4(){if(bE)return nv;bE=1;var e=lt();nv=n;function n(r,i,o){var l={},u;e.forEach(o,function(c){for(var h=r.parent(c),p,d;h;){if(p=r.parent(h),p?(d=l[p],l[p]=h):(d=u,u=h),d&&d!==h){i.setEdge(d,h);return}h=p}})}return nv}var rv,SE;function O4(){if(SE)return rv;SE=1;var e=lt(),n=N4(),r=C4(),i=A4(),o=I4(),l=M4(),u=nr().Graph,c=fn();rv=h;function h(y){var w=c.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),_=p(y,e.range(w-1,-1,-1),"outEdges"),b=n(y);m(y,b);for(var S=Number.POSITIVE_INFINITY,k,E=0,T=0;T<4;++E,++T){d(E%2?N:_,E%4>=2),b=c.buildLayerMatrix(y);var I=r(y,b);I<S&&(T=0,k=e.cloneDeep(b),S=I)}m(y,k)}function p(y,w,N){return e.map(w,function(_){return o(y,_,N)})}function d(y,w){var N=new u;e.forEach(y,function(_){var b=_.graph().root,S=i(_,b,N,w);e.forEach(S.vs,function(k,E){_.node(k).order=E}),l(_,N,S.vs)})}function m(y,w){e.forEach(w,function(N){e.forEach(N,function(_,b){y.node(_).order=b})})}return rv}var sv,kE;function P4(){if(kE)return sv;kE=1;var e=lt(),n=nr().Graph,r=fn();sv={positionX:N,findType1Conflicts:i,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function i(S,k){var E={};function T(I,O){var A=0,U=0,z=I.length,P=e.last(O);return e.forEach(O,function(D,V){var B=l(S,D),C=B?S.node(B).order:z;(B||D===P)&&(e.forEach(O.slice(U,V+1),function(q){e.forEach(S.predecessors(q),function(L){var re=S.node(L),Z=re.order;(Z<A||C<Z)&&!(re.dummy&&S.node(q).dummy)&&u(E,L,q)})}),U=V+1,A=C)}),O}return e.reduce(k,T),E}function o(S,k){var E={};function T(O,A,U,z,P){var D;e.forEach(e.range(A,U),function(V){D=O[V],S.node(D).dummy&&e.forEach(S.predecessors(D),function(B){var C=S.node(B);C.dummy&&(C.order<z||C.order>P)&&u(E,B,D)})})}function I(O,A){var U=-1,z,P=0;return e.forEach(A,function(D,V){if(S.node(D).dummy==="border"){var B=S.predecessors(D);B.length&&(z=S.node(B[0]).order,T(A,P,V,U,z),P=V,U=z)}T(A,P,A.length,z,O.length)}),A}return e.reduce(k,I),E}function l(S,k){if(S.node(k).dummy)return e.find(S.predecessors(k),function(E){return S.node(E).dummy})}function u(S,k,E){if(k>E){var T=k;k=E,E=T}var I=S[k];I||(S[k]=I={}),I[E]=!0}function c(S,k,E){if(k>E){var T=k;k=E,E=T}return e.has(S[k],E)}function h(S,k,E,T){var I={},O={},A={};return e.forEach(k,function(U){e.forEach(U,function(z,P){I[z]=z,O[z]=z,A[z]=P})}),e.forEach(k,function(U){var z=-1;e.forEach(U,function(P){var D=T(P);if(D.length){D=e.sortBy(D,function(L){return A[L]});for(var V=(D.length-1)/2,B=Math.floor(V),C=Math.ceil(V);B<=C;++B){var q=D[B];O[P]===P&&z<A[q]&&!c(E,P,q)&&(O[q]=P,O[P]=I[P]=I[q],z=A[q])}}})}),{root:I,align:O}}function p(S,k,E,T,I){var O={},A=d(S,k,E,I),U=I?"borderLeft":"borderRight";function z(V,B){for(var C=A.nodes(),q=C.pop(),L={};q;)L[q]?V(q):(L[q]=!0,C.push(q),C=C.concat(B(q))),q=C.pop()}function P(V){O[V]=A.inEdges(V).reduce(function(B,C){return Math.max(B,O[C.v]+A.edge(C))},0)}function D(V){var B=A.outEdges(V).reduce(function(q,L){return Math.min(q,O[L.w]-A.edge(L))},Number.POSITIVE_INFINITY),C=S.node(V);B!==Number.POSITIVE_INFINITY&&C.borderType!==U&&(O[V]=Math.max(O[V],B))}return z(P,A.predecessors.bind(A)),z(D,A.successors.bind(A)),e.forEach(T,function(V){O[V]=O[E[V]]}),O}function d(S,k,E,T){var I=new n,O=S.graph(),A=_(O.nodesep,O.edgesep,T);return e.forEach(k,function(U){var z;e.forEach(U,function(P){var D=E[P];if(I.setNode(D),z){var V=E[z],B=I.edge(V,D);I.setEdge(V,D,Math.max(A(S,P,z),B||0))}z=P})}),I}function m(S,k){return e.minBy(e.values(k),function(E){var T=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;return e.forIn(E,function(O,A){var U=b(S,A)/2;T=Math.max(O+U,T),I=Math.min(O-U,I)}),T-I})}function y(S,k){var E=e.values(k),T=e.min(E),I=e.max(E);e.forEach(["u","d"],function(O){e.forEach(["l","r"],function(A){var U=O+A,z=S[U],P;if(z!==k){var D=e.values(z);P=A==="l"?T-e.min(D):I-e.max(D),P&&(S[U]=e.mapValues(z,function(V){return V+P}))}})})}function w(S,k){return e.mapValues(S.ul,function(E,T){if(k)return S[k.toLowerCase()][T];var I=e.sortBy(e.map(S,T));return(I[1]+I[2])/2})}function N(S){var k=r.buildLayerMatrix(S),E=e.merge(i(S,k),o(S,k)),T={},I;e.forEach(["u","d"],function(A){I=A==="u"?k:e.values(k).reverse(),e.forEach(["l","r"],function(U){U==="r"&&(I=e.map(I,function(V){return e.values(V).reverse()}));var z=(A==="u"?S.predecessors:S.successors).bind(S),P=h(S,I,E,z),D=p(S,I,P.root,P.align,U==="r");U==="r"&&(D=e.mapValues(D,function(V){return-V})),T[A+U]=D})});var O=m(S,T);return y(T,O),w(T,S.graph().align)}function _(S,k,E){return function(T,I,O){var A=T.node(I),U=T.node(O),z=0,P;if(z+=A.width/2,e.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":P=-A.width/2;break;case"r":P=A.width/2;break}if(P&&(z+=E?P:-P),P=0,z+=(A.dummy?k:S)/2,z+=(U.dummy?k:S)/2,z+=U.width/2,e.has(U,"labelpos"))switch(U.labelpos.toLowerCase()){case"l":P=U.width/2;break;case"r":P=-U.width/2;break}return P&&(z+=E?P:-P),P=0,z}}function b(S,k){return S.node(k).width}return sv}var iv,EE;function L4(){if(EE)return iv;EE=1;var e=lt(),n=fn(),r=P4().positionX;iv=i;function i(l){l=n.asNonCompoundGraph(l),o(l),e.forEach(r(l),function(u,c){l.node(c).x=u})}function o(l){var u=n.buildLayerMatrix(l),c=l.graph().ranksep,h=0;e.forEach(u,function(p){var d=e.max(e.map(p,function(m){return l.node(m).height}));e.forEach(p,function(m){l.node(m).y=h+d/2}),h+=d+c})}return iv}var ov,NE;function $4(){if(NE)return ov;NE=1;var e=lt(),n=y4(),r=w4(),i=_4(),o=fn().normalizeRanks,l=b4(),u=fn().removeEmptyRanks,c=S4(),h=k4(),p=E4(),d=O4(),m=L4(),y=fn(),w=nr().Graph;ov=N;function N($,Q){var ne=Q&&Q.debugTiming?y.time:y.notime;ne("layout",function(){var oe=ne(" buildLayoutGraph",function(){return z($)});ne(" runLayout",function(){_(oe,ne)}),ne(" updateInputGraph",function(){b($,oe)})})}function _($,Q){Q(" makeSpaceForEdgeLabels",function(){P($)}),Q(" removeSelfEdges",function(){H($)}),Q(" acyclic",function(){n.run($)}),Q(" nestingGraph.run",function(){c.run($)}),Q(" rank",function(){i(y.asNonCompoundGraph($))}),Q(" injectEdgeLabelProxies",function(){D($)}),Q(" removeEmptyRanks",function(){u($)}),Q(" nestingGraph.cleanup",function(){c.cleanup($)}),Q(" normalizeRanks",function(){o($)}),Q(" assignRankMinMax",function(){V($)}),Q(" removeEdgeLabelProxies",function(){B($)}),Q(" normalize.run",function(){r.run($)}),Q(" parentDummyChains",function(){l($)}),Q(" addBorderSegments",function(){h($)}),Q(" order",function(){d($)}),Q(" insertSelfEdges",function(){J($)}),Q(" adjustCoordinateSystem",function(){p.adjust($)}),Q(" position",function(){m($)}),Q(" positionSelfEdges",function(){M($)}),Q(" removeBorderNodes",function(){Z($)}),Q(" normalize.undo",function(){r.undo($)}),Q(" fixupEdgeLabelCoords",function(){L($)}),Q(" undoCoordinateSystem",function(){p.undo($)}),Q(" translateGraph",function(){C($)}),Q(" assignNodeIntersects",function(){q($)}),Q(" reversePoints",function(){re($)}),Q(" acyclic.undo",function(){n.undo($)})}function b($,Q){e.forEach($.nodes(),function(ne){var oe=$.node(ne),fe=Q.node(ne);oe&&(oe.x=fe.x,oe.y=fe.y,Q.children(ne).length&&(oe.width=fe.width,oe.height=fe.height))}),e.forEach($.edges(),function(ne){var oe=$.edge(ne),fe=Q.edge(ne);oe.points=fe.points,e.has(fe,"x")&&(oe.x=fe.x,oe.y=fe.y)}),$.graph().width=Q.graph().width,$.graph().height=Q.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],k={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],T=["width","height"],I={width:0,height:0},O=["minlen","weight","width","height","labeloffset"],A={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},U=["labelpos"];function z($){var Q=new w({multigraph:!0,compound:!0}),ne=Y($.graph());return Q.setGraph(e.merge({},k,G(ne,S),e.pick(ne,E))),e.forEach($.nodes(),function(oe){var fe=Y($.node(oe));Q.setNode(oe,e.defaults(G(fe,T),I)),Q.setParent(oe,$.parent(oe))}),e.forEach($.edges(),function(oe){var fe=Y($.edge(oe));Q.setEdge(oe,e.merge({},A,G(fe,O),e.pick(fe,U)))}),Q}function P($){var Q=$.graph();Q.ranksep/=2,e.forEach($.edges(),function(ne){var oe=$.edge(ne);oe.minlen*=2,oe.labelpos.toLowerCase()!=="c"&&(Q.rankdir==="TB"||Q.rankdir==="BT"?oe.width+=oe.labeloffset:oe.height+=oe.labeloffset)})}function D($){e.forEach($.edges(),function(Q){var ne=$.edge(Q);if(ne.width&&ne.height){var oe=$.node(Q.v),fe=$.node(Q.w),te={rank:(fe.rank-oe.rank)/2+oe.rank,e:Q};y.addDummyNode($,"edge-proxy",te,"_ep")}})}function V($){var Q=0;e.forEach($.nodes(),function(ne){var oe=$.node(ne);oe.borderTop&&(oe.minRank=$.node(oe.borderTop).rank,oe.maxRank=$.node(oe.borderBottom).rank,Q=e.max(Q,oe.maxRank))}),$.graph().maxRank=Q}function B($){e.forEach($.nodes(),function(Q){var ne=$.node(Q);ne.dummy==="edge-proxy"&&($.edge(ne.e).labelRank=ne.rank,$.removeNode(Q))})}function C($){var Q=Number.POSITIVE_INFINITY,ne=0,oe=Number.POSITIVE_INFINITY,fe=0,te=$.graph(),ce=te.marginx||0,Ce=te.marginy||0;function ve(je){var ye=je.x,ke=je.y,Ye=je.width,we=je.height;Q=Math.min(Q,ye-Ye/2),ne=Math.max(ne,ye+Ye/2),oe=Math.min(oe,ke-we/2),fe=Math.max(fe,ke+we/2)}e.forEach($.nodes(),function(je){ve($.node(je))}),e.forEach($.edges(),function(je){var ye=$.edge(je);e.has(ye,"x")&&ve(ye)}),Q-=ce,oe-=Ce,e.forEach($.nodes(),function(je){var ye=$.node(je);ye.x-=Q,ye.y-=oe}),e.forEach($.edges(),function(je){var ye=$.edge(je);e.forEach(ye.points,function(ke){ke.x-=Q,ke.y-=oe}),e.has(ye,"x")&&(ye.x-=Q),e.has(ye,"y")&&(ye.y-=oe)}),te.width=ne-Q+ce,te.height=fe-oe+Ce}function q($){e.forEach($.edges(),function(Q){var ne=$.edge(Q),oe=$.node(Q.v),fe=$.node(Q.w),te,ce;ne.points?(te=ne.points[0],ce=ne.points[ne.points.length-1]):(ne.points=[],te=fe,ce=oe),ne.points.unshift(y.intersectRect(oe,te)),ne.points.push(y.intersectRect(fe,ce))})}function L($){e.forEach($.edges(),function(Q){var ne=$.edge(Q);if(e.has(ne,"x"))switch((ne.labelpos==="l"||ne.labelpos==="r")&&(ne.width-=ne.labeloffset),ne.labelpos){case"l":ne.x-=ne.width/2+ne.labeloffset;break;case"r":ne.x+=ne.width/2+ne.labeloffset;break}})}function re($){e.forEach($.edges(),function(Q){var ne=$.edge(Q);ne.reversed&&ne.points.reverse()})}function Z($){e.forEach($.nodes(),function(Q){if($.children(Q).length){var ne=$.node(Q),oe=$.node(ne.borderTop),fe=$.node(ne.borderBottom),te=$.node(e.last(ne.borderLeft)),ce=$.node(e.last(ne.borderRight));ne.width=Math.abs(ce.x-te.x),ne.height=Math.abs(fe.y-oe.y),ne.x=te.x+ne.width/2,ne.y=oe.y+ne.height/2}}),e.forEach($.nodes(),function(Q){$.node(Q).dummy==="border"&&$.removeNode(Q)})}function H($){e.forEach($.edges(),function(Q){if(Q.v===Q.w){var ne=$.node(Q.v);ne.selfEdges||(ne.selfEdges=[]),ne.selfEdges.push({e:Q,label:$.edge(Q)}),$.removeEdge(Q)}})}function J($){var Q=y.buildLayerMatrix($);e.forEach(Q,function(ne){var oe=0;e.forEach(ne,function(fe,te){var ce=$.node(fe);ce.order=te+oe,e.forEach(ce.selfEdges,function(Ce){y.addDummyNode($,"selfedge",{width:Ce.label.width,height:Ce.label.height,rank:ce.rank,order:te+ ++oe,e:Ce.e,label:Ce.label},"_se")}),delete ce.selfEdges})})}function M($){e.forEach($.nodes(),function(Q){var ne=$.node(Q);if(ne.dummy==="selfedge"){var oe=$.node(ne.e.v),fe=oe.x+oe.width/2,te=oe.y,ce=ne.x-fe,Ce=oe.height/2;$.setEdge(ne.e,ne.label),$.removeNode(Q),ne.label.points=[{x:fe+2*ce/3,y:te-Ce},{x:fe+5*ce/6,y:te-Ce},{x:fe+ce,y:te},{x:fe+5*ce/6,y:te+Ce},{x:fe+2*ce/3,y:te+Ce}],ne.label.x=ne.x,ne.label.y=ne.y}})}function G($,Q){return e.mapValues(e.pick($,Q),Number)}function Y($){var Q={};return e.forEach($,function(ne,oe){Q[oe.toLowerCase()]=ne}),Q}return ov}var av,CE;function q4(){if(CE)return av;CE=1;var e=lt(),n=fn(),r=nr().Graph;av={debugOrdering:i};function i(o){var l=n.buildLayerMatrix(o),u=new r({compound:!0,multigraph:!0}).setGraph({});return e.forEach(o.nodes(),function(c){u.setNode(c,{label:c}),u.setParent(c,"layer"+o.node(c).rank)}),e.forEach(o.edges(),function(c){u.setEdge(c.v,c.w,{},c.name)}),e.forEach(l,function(c,h){var p="layer"+h;u.setNode(p,{rank:"same"}),e.reduce(c,function(d,m){return u.setEdge(d,m,{style:"invis"}),m})}),u}return av}var lv,TE;function D4(){return TE||(TE=1,lv="0.8.5"),lv}var uv,RE;function F4(){return RE||(RE=1,uv={graphlib:nr(),layout:$4(),debug:q4(),util:{time:fn().time,notime:fn().notime},version:D4()}),uv}var z4=F4();const jE=$v(z4),po=240,Cu=130,oo=74,Ju=72,AE=oo+Ju;function B4(e,n){var i;let r=po;for(const o of e)r=Math.max(r,((i=n.get(o.id))==null?void 0:i.width)??po);return r}const IT=420,U4=2;function ba(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function H4(e,n){return((n==null?void 0:n.get(e))??0)>0?IT:0}function W4(e,n){const r=(n==null?void 0:n.get(e))??0;return r>0?6+r*36:0}function Sa(e,n,r){const i=n.get(e);return{w:((i==null?void 0:i.width)??po)+H4(e,r),h:Math.max((i==null?void 0:i.height)??Cu,W4(e,r))}}function V4(e){return[...e.keys()].sort().map(n=>`${n}:${e.get(n)}`).join("|")}function G4(e,n,r,i,o,l){const u=new jE.graphlib.Graph;u.setDefaultEdgeLabel(()=>({})),u.setGraph({rankdir:r,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const c=e.filter(S=>!o.has(S)),h=new Set(c);for(const S of c){const{w:k,h:E}=Sa(S,i,l);u.setNode(S,{width:k,height:E})}for(const S of n)h.has(S.source)&&h.has(S.target)&&u.setEdge(S.source,S.target);jE.layout(u);const p=new Map;let d=1/0,m=1/0,y=-1/0,w=-1/0;for(const S of c){const k=u.node(S);if(!k)continue;const E=i.get(S),T=(E==null?void 0:E.width)??po,I=(E==null?void 0:E.height)??Cu,O=Sa(S,i,l),A=k.x-O.w/2,U=k.y-O.h/2;p.set(S,{x:A,y:U}),A<d&&(d=A),U<m&&(m=U),A+T>y&&(y=A+T),U+I>w&&(w=U+I)}if(Number.isFinite(d)&&Number.isFinite(m))for(const[S,k]of p)p.set(S,{x:k.x-d,y:k.y-m});const N=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-m:0;let b=null;for(const S of e){const k=o.get(S);if(!k)continue;const E=i.get(S),T=(E==null?void 0:E.width)??po,I=(E==null?void 0:E.height)??Cu;b=b===null?{minX:k.x,minY:k.y,maxX:k.x+T,maxY:k.y+I}:{minX:Math.min(b.minX,k.x),minY:Math.min(b.minY,k.y),maxX:Math.max(b.maxX,k.x+T),maxY:Math.max(b.maxY,k.y+I)}}return{positions:p,width:N,height:_,pinnedBox:b}}function Y4(e,n,r={}){const i=r.direction??"LR",o=r.pinned??new Map,l=r.measured??new Map,u=r.lanes,c=new Map;for(const S of e){const k=ba(S),E=c.get(k);E?E.push(S.id):c.set(k,[S.id])}const p=Array.from(c.keys()).sort().map(S=>({sid:S,...G4(c.get(S),n,i,l,o,u)})),d=B4(e,l),m=r.availableHeight&&r.availableHeight>0?r.availableHeight:Number.POSITIVE_INFINITY,y=S=>{const k=[[]];let E=0;for(const T of p)k.length<S&&E>0&&E+T.height>m&&(k.push([]),E=0),k[k.length-1].push(T),E+=T.height+AE;return k},w=S=>S.reduce((k,E)=>Math.max(k,E.width),0)+IT;let N=y(r.availableWidth?U4:1);N.length>1&&N.reduce((k,E)=>k+w(E),0)+d*(N.length-1)>(r.availableWidth??0)&&(N=y(1));const _=new Map;let b=0;for(const S of N){const k=w(S);let E=0;for(const{positions:T,height:I,pinnedBox:O}of S){for(const[U,z]of T)_.set(U,{x:z.x+b,y:z.y+E});let A=E+I;O&&O.maxY>A&&O.minX<b+k&&b<O.maxX&&(A=O.maxY),E=A+AE}b+=k+d}return e.map(S=>{const k=o.get(S.id);if(k)return{...S,position:k};const E=_.get(S.id);return E?{...S,position:E}:S})}function K4(e,n,r,i,o){const u=oo+Ju,c=60,h=w=>Sa(w,i,o),p=new Map(e.map(w=>[w.id,ba(w)])),d=[],m=e.map(w=>({id:w.id,pos:r.get(w.id)??n.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),y=[];for(const{id:w,pos:N}of m){const{w:_,h:b}=h(w),S=p.get(w)??"_default";if(r.has(w)){d.push({x:N.x,y:N.y,w:_,h:b,sid:S});continue}let k=N.y;for(let E=0;E<d.length+1;E++){const T=d.find(I=>{const O=I.sid===S?24:c,A=I.sid===S?24:u;return N.x<I.x+I.w+O&&I.x<N.x+_+O&&k<I.y+I.h+A&&I.y<k+b+A});if(!T)break;k=T.y+T.h+(T.sid===S?24:u)}k!==N.y&&(n.set(w,{x:N.x,y:k}),y.push(w)),d.push({x:N.x,y:k,w:_,h:b,sid:S})}return y}function X4(e,n,r,i,o,l){const u=_=>Sa(_,i,l),c=_=>r.get(_)??n.get(_),h=new Map;for(const _ of e){if(!c(_.id))continue;const b=ba(_),S=h.get(b);S?S.push(_):h.set(b,[_])}const p=new Set;for(const[_,b]of h)b.every(S=>o.has(S.id)&&!r.has(S.id))&&p.add(_);const d=new Map,m=[];for(const _ of e){const b=c(_.id);if(!b)continue;const{w:S,h:k}=u(_.id),E=ba(_);p.has(E)?(d.get(E)??d.set(E,[]).get(E)).push(_):m.push({x:b.x,y:b.y,w:S,h:k})}if(d.size===0)return[];const y=oo+Ju,w=(_,b,S,k)=>m.some(E=>_<E.x+E.w+oo&&E.x<_+S+oo&&b<E.y+E.h+y&&E.y<b+k+y),N=[];for(const _ of[...d.keys()].sort()){const b=d.get(_);let S=1/0,k=1/0,E=-1/0,T=-1/0;for(const D of b){const V=c(D.id),{w:B,h:C}=u(D.id);S=Math.min(S,V.x),k=Math.min(k,V.y),E=Math.max(E,V.x+B),T=Math.max(T,V.y+C)}const I=E-S,O=T-k,A=[...new Set(m.map(D=>Math.round(D.x)))].sort((D,V)=>D-V),U=A.length?A:[S],z=[0,...m.map(D=>D.y+D.h+y)].sort((D,V)=>D-V);let P=null;e:for(const D of U)for(const V of z){if(V>=k)break;if(!w(D,V,I,O)){P={x:D,y:V};break e}}if(P){const D=P.x-S,V=P.y-k;for(const B of b){const C=c(B.id);n.set(B.id,{x:C.x+D,y:C.y+V})}N.push(_)}for(const D of b){const V=c(D.id),{w:B,h:C}=u(D.id);m.push({x:V.x,y:V.y,w:B,h:C})}}return N}function Q4(e,n,r,i,o,l=!1,u){const p=oo+Ju+1,d=8,m=1.75,y=200,w=.7,N=.01,_=P=>Sa(P,i,u),b=P=>r.get(P)??n.get(P),S=new Map;for(const P of e){if(!b(P.id))continue;const D=ba(P),V=S.get(D);V?V.push(P):S.set(D,[P])}const k=[],E=new Set,T=new Set,I=o.size===0;for(const P of[...S.keys()].sort()){const D=S.get(P);let V=1/0,B=1/0,C=-1/0,q=-1/0,L=!1;for(const J of D){const M=b(J.id),{w:G,h:Y}=_(J.id);V=Math.min(V,M.x),B=Math.min(B,M.y),C=Math.max(C,M.x+G),q=Math.max(q,M.y+Y),r.has(J.id)&&(L=!0)}const re=C-V,Z=q-B;T.add(P);const H=o.get(P);H&&(re>H.w+d||Z>H.h+d)&&E.add(P),o.set(P,{w:re,h:Z}),k.push({sid:P,members:D.map(J=>J.id),x:V,y:B,w:re,h:Z,anchored:L,mass:1})}for(const P of[...o.keys()])T.has(P)||o.delete(P);if(l||I)return[];let O=!1;for(let P=0;P<k.length&&!O;P++)for(let D=P+1;D<k.length;D++){const V=k[P],B=k[D];if(!(V.anchored&&B.anchored)&&Math.abs(V.x+V.w/2-(B.x+B.w/2))<(V.w+B.w)/2+61&&Math.abs(V.y+V.h/2-(B.y+B.h/2))<(V.h+B.h)/2+p){O=!0;break}}if(E.size===0&&!O)return[];if(E.size>0)for(const P of k)E.has(P.sid)&&(P.mass=8);else for(const P of k)P.mass=Math.max(1,P.w*P.h/(po*Cu));const A=new Map(k.map(P=>[P.sid,P.x])),U=new Map(k.map(P=>[P.sid,P.y]));for(let P=0;P<y;P++){const D=new Map,V=new Map;let B=0;for(let C=0;C<k.length;C++)for(let q=C+1;q<k.length;q++){const L=k[C],re=k[q];if(L.anchored&&re.anchored)continue;const Z=L.x+L.w/2,H=L.y+L.h/2,J=re.x+re.w/2,M=re.y+re.h/2,G=(L.w+re.w)/2+61-Math.abs(Z-J),Y=(L.h+re.h)/2+p-Math.abs(H-M);if(G<=0||Y<=0)continue;const $=(Fe,Je)=>!Fe.anchored&&!(Je<0&&Fe.x<=0),Q=(Fe,Je)=>!Fe.anchored&&!(Je<0&&Fe.y<=0),ne=(Fe,Je,Xe)=>{const Mt=Fe===Je,ut=Mt?L.sid<re.sid?-1:1:Math.sign(Fe-Je);return Xe(L,ut)||Xe(re,-ut)?ut:Mt&&(Xe(L,-ut)||Xe(re,ut))?-ut:0},oe=ne(Z,J,$),fe=ne(H,M,Q),te=oe!==0,ce=fe!==0;if(!te&&!ce)continue;const Ce=te&&(!ce||G*m<Y),[ve,je,ye,ke]=Ce?[oe,G,D,$]:[fe,Y,V,Q],Ye=ke(L,ve),we=ke(re,-ve),_e=L.mass,Be=re.mass,it=Ye?we?Be/(_e+Be):1:0,pt=we?Ye?_e/(_e+Be):1:0,Ze=je*w;ye.set(L.sid,(ye.get(L.sid)??0)+ve*Ze*it),ye.set(re.sid,(ye.get(re.sid)??0)-ve*Ze*pt),B+=Ze}for(const C of k)C.anchored||(C.x=Math.max(0,C.x+(D.get(C.sid)??0)),C.y=Math.max(0,C.y+(V.get(C.sid)??0)));if(B<N)break}const z=[];for(const P of k){const D=P.x-A.get(P.sid),V=P.y-U.get(P.sid);if(!(Math.abs(D)<1&&Math.abs(V)<1)){for(const B of P.members){if(r.has(B))continue;const C=n.get(B);C&&n.set(B,{x:C.x+D,y:C.y+V})}z.push(P.sid)}}return z}const Z4=600;function Iv(e,n){return!(e.exitAt!=null&&n-e.exitAt>Z4||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function J4(e,n){const r=new Set;for(const i of e.agents.values())Iv(i,n)&&r.add(i.id);return r}function e5(e,n,r=0){return e.right+r>n.left&&e.left-r<n.right&&e.bottom+r>n.top&&e.top-r<n.bottom}function t5(e,n,r=0){if(!e)return!1;for(const i of n)if(e5(e,i,r))return!0;return!1}const MT="sessionGroup";function n5(e,n){var i;if(e.type===MT)return"transparent";const r=(i=e.data)==null?void 0:i.state;return n(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const r5="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1).";function s5(e){if(e.checkDisabled)return r5;if(e.checking)return"Asking npm for the newest release…";const n=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",r=e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${n}${r} · re-checked periodically · click to check npm now`}function i5(e){const n=`Version v${e.running}`;return e.checkDisabled?`${n}, update checks are off`:e.checking?`${n}, checking npm for a newer release`:`${n}, check npm for a newer release`}function o5(e){const n=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`;return`Version v${e.from}, ${n} — ${e.open?"hide":"show"} the notice`}function a5(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 n=e.trim();return n===""?{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:n,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}const Mv={kind:"assumed",claude:!0,codex:!0};function l5(e){if(!e||typeof e!="object")return Mv;const n=e.providers;if(!n||typeof n!="object")return Mv;const r=n;return{kind:"reported",claude:r.claude!==!1,codex:r.codex!==!1}}function u5(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}function c5(e){return e.claude&&e.codex?"Claude Code hooks and Codex rollout files":e.claude?"Claude Code hooks":e.codex?"Codex rollout files":null}function d5(e){const n=u5(e);return n?`Distinct sessions — ${n}`:"Distinct sessions"}function f5(e){const n=c5(e);return n?`Total events received — ${n}`:"Total events received"}function h5(e){const n=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:"."}]},r=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[n,r]}function OT(e){const n=Math.max(0,Math.floor(e));return`${n} event${n===1?"":"s"}`}function p5(e){return e.connected?e.paused?{tone:"paused",label:"paused",title:e.held>0?`Connected — ${OT(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",label:"live",title:"Receiving events"}:{tone:"dead",label:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function m5(e){return e.paused?e.held<=0?{label:"Resume",title:"Nothing has arrived since you paused. Resume to follow the canvas again (Space)"}:{label:`Resume · ${e.held} held`,title:`${OT(e.held)} arrived while paused and will be applied in order when you resume (Space)`}:{label:"Pause",title:"Pause live updates — events keep arriving and are applied when you resume (Space)"}}function PT(e,n){return e!==""&&n>0}function g5(e,n,r){return e===""?{active:!1,matched:n,total:r,count:null,empty:!1,message:null,dim:!1}:{active:!0,matched:n,total:r,count:`${n} of ${r}`,empty:n===0,message:n===0?`No agents match “${e}”`:null,dim:PT(e,n)}}const v5="Search agents, tools, model…";function LT(e,n){var i,o,l,u;if(!n)return!0;const r=n.toLowerCase();if(e.label.toLowerCase().includes(r)||(i=e.cwd)!=null&&i.toLowerCase().includes(r)||(o=e.cwdBasename)!=null&&o.toLowerCase().includes(r)||e.sessionId.toLowerCase().includes(r)||(l=e.firstPrompt)!=null&&l.toLowerCase().includes(r)||e.model&&(e.model.toLowerCase().includes(r)||Ns(e.model).toLowerCase().includes(r))||(u=e.provider)!=null&&u.toLowerCase().startsWith(r))return!0;for(const c of e.tools)if(c.name.toLowerCase().includes(r))return!0;return!1}function Ov(e){const n=Math.max(0,Math.floor(e/1e3));return n<60?"just now":n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function y5(e,n){return e.getFullYear()===n.getFullYear()&&e.getMonth()===n.getMonth()&&e.getDate()===n.getDate()}function w5(e,n,r){const i=new Date(e),o=Ov(n-e);return{label:y5(i,new Date(n))?o:`${o} · ${i.toLocaleDateString(r,{month:"short",day:"numeric"})}`,title:i.toLocaleString(r,{dateStyle:"medium",timeStyle:"medium"})}}function aa(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const x5={agent:KP,sessionGroup:uL},$T="react-flow__node";function IE(e){var n,r;return!!e&&((r=(n=e.classList)==null?void 0:n.contains)==null?void 0:r.call(n,$T))===!0}function _5(e){try{const n=document.querySelector(`.${$T}[data-id="${CSS.escape(e)}"]`);n==null||n.focus({preventScroll:!0})}catch{}}const b5=420,au=18,S5=9e4,k5=200,E5=5*6e4,N5=6,C5=2*6e4,Sy="agent-dag.layout",ky="agent-dag.viewport",qT="agent-dag.summariesDismissed",DT="agent-dag.sessionListOpen",FT="agent-dag.detailOpen",zT="agent-dag.usagePanelOpen",ME="agent-dag.accountsPanelOpen",OE="agent-dag.versionNoticeDismissed",PE="agent-dag.oldNameNoticeDismissed",T5=15*6e4,LE={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:"},$E="agent-dag.autoRestart",qE="agent-dag.bundleReloadedFor";function R5(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(DT)==="1"}catch{return!1}}function j5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(DT,e?"1":"0")}catch{}}function A5(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(FT)==="1"}catch{return!1}}function I5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(FT,e?"1":"0")}catch{}}function M5(){const e=AC(zT);return e===null?!0:e==="1"}function O5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(zT,e?"1":"0")}catch{}}function P5(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(qT);if(!e)return new Set;const n=JSON.parse(e);return new Set(Array.isArray(n)?n.filter(r=>typeof r=="string"):[])}catch{return new Set}}function DE(e){if(!(typeof window>"u"))try{const n=Array.from(e),r=n.length>200?n.slice(-200):n;window.localStorage.setItem(qT,JSON.stringify(r))}catch{}}function L5(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const n=window.localStorage.getItem(Sy);if(!n)return e;const r=JSON.parse(n);if(!("v"in r)){const o=Object.entries(r).filter(([,l])=>l&&typeof l.x=="number"&&typeof l.y=="number");return{positions:o,pins:o.map(([l])=>l)}}return{positions:Object.entries(r.positions??{}).filter(([,o])=>o&&typeof o.x=="number"&&typeof o.y=="number"),pins:Array.isArray(r.pins)?r.pins:[]}}catch{return e}}function cv(e,n){if(!(typeof window>"u"))try{const r={};for(const[i,o]of e)r[i]=o;for(const[i,o]of n)r[i]=o;window.localStorage.setItem(Sy,JSON.stringify({v:2,positions:r,pins:Array.from(n.keys())}))}catch{}}function $5(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(ky);if(!e)return null;const n=JSON.parse(e);return typeof(n==null?void 0:n.x)!="number"||typeof(n==null?void 0:n.y)!="number"||typeof(n==null?void 0:n.zoom)!="number"?null:n}catch{return null}}function q5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ky,JSON.stringify(e))}catch{}}function FE(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Sy)}catch{}try{window.localStorage.removeItem(ky)}catch{}}}function D5(e,n){const r=e.agents.get(n);if(!r)return;const i=[];for(const d of e.agents.values())d.sessionId===n&&i.push(d);const o={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:n,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:i.map(d=>({id:d.id,kind:d.kind,label:d.label,parentId:d.parentId,state:d.state,startedAt:d.startedAt,endedAt:d.endedAt,model:d.model,cwd:d.cwd,usage:d.usage,prompts:d.prompts,tools:d.tools.map(m=>({id:m.id,name:m.name,inputPreview:m.inputPreview,startedAt:m.startedAt,endedAt:m.endedAt,ok:m.ok,errorPreview:m.errorPreview,usage:m.usage}))}))},l=JSON.stringify(o,null,2),u=new Blob([l],{type:"application/json"}),c=URL.createObjectURL(u),h=document.createElement("a"),p=(r.label||"session").replace(/[^a-z0-9._-]/gi,"_");h.href=c,h.download=`${en}-${p}-${n.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const Pv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Lv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},BT=bC;function F5(e,n){if(!n)return null;const r=new Set([n]);let i=n;for(;i;){const l=e.agents.get(i);if(!(l!=null&&l.parentId)||r.has(l.parentId))break;r.add(l.parentId),i=l.parentId}let o=!0;for(;o;){o=!1;for(const l of e.agents.values())l.parentId&&r.has(l.parentId)&&!r.has(l.id)&&(r.add(l.id),o=!0)}return r}function z5(e,n,r,i,o,l,u,c,h,p,d,m,y,w,N,_,b,S,k){const E=[],T=[],I=new Set;if(l)for(const B of e.agents.values())S.has(B.id)&&LT(B,l)&&I.add(B.id);const O=PT(l,I.size);for(const B of e.agents.values()){if(!S.has(B.id))continue;const C=O&&!I.has(B.id),q=B.exitAt!=null,L=b!=null&&!b.has(B.id),re=[C?"rf-dim":"",q?"rf-exiting":"",L?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,Z=u.get(B.id);if(E.push({id:B.id,type:"agent",position:{x:0,y:0},data:{...B,now:n,onOpenContext:k},className:re,...Z?{width:Z.width,height:Z.height}:null}),B.parentId&&S.has(B.parentId)){const H=ty(B.sessionId),J=l&&!I.has(B.id)&&!I.has(B.parentId),M=q,G=_.size>0&&(_.has(B.id)||_.has(B.parentId)),Y=b!=null&&!b.has(B.id)&&!b.has(B.parentId),$=B.state==="active"?2:1.5,Q=G?$+1.5:$,ne=J||M?.2:Y?.12:1,oe=["sess-edge",B.state==="active"?"sess-live":"sess-idle",M?"rf-edge-exiting":"",G?"rf-edge-selected":""].filter(Boolean).join(" ");T.push({id:`e:${B.parentId}->${B.id}`,source:B.parentId,target:B.id,animated:(B.state==="active"||G)&&!J&&!M,type:"smoothstep",style:{"--session-hue":H,strokeWidth:Q,opacity:ne,transition:"var(--edge-transition)"},className:oe})}}const A=new Map;for(const B of e.agents.values())B.tools.length>0&&A.set(B.id,Math.min(4,B.tools.length));const U=`${w}#lanes:${V4(A)}`,z=E.filter(B=>r$(B.id,o,m,y));if(z.length>0||U!==N.current){if(z.length>0){const B=Y4(E,T,{direction:"LR",pinned:o,measured:u,availableWidth:r,availableHeight:i,lanes:A});for(const C of B)jC(C.id,m,y)&&i$(C.id,C.position,m,y);X4(E,m,o,u,new Set(z.map(C=>C.id)),A)}K4(E,m,o,u,A),N.current=U}const P=Q4(E,m,o,u,c,!p||d,A);P.length>0&&h(P),ru(m,e.agents),ru(y,e.agents),ru(o,e.agents),ru(u,n$(e.agents.values()));const D=[];let V=!1;for(const B of E){let C=o.get(B.id)??m.get(B.id);C||(C=s$(B.id,m,y),V=!0),D.push({...B,position:C})}return V&&(N.current=""),{nodes:D,edges:T}}function B5(){return g.jsx(ey,{children:g.jsx(U5,{})})}function U5(){var Wa,Va,Ga,Ya;const e=Ta(),n=j.useRef(Cv()),[,r]=j.useState(0),i=j.useCallback(()=>r(W=>W+1),[]),[o,l]=j.useState(()=>new Set),[u,c]=j.useState(null),[h,p]=j.useState(null),d=j.useCallback((W,K)=>{l(le=>{if(!K)return new Set([W]);const de=new Set(le);return de.has(W)?de.delete(W):de.add(W),de}),c(le=>K&&le===W?le:W)},[]),m=j.useCallback(()=>{l(new Set),c(null)},[]),[y,w]=j.useState(null),[N,_]=j.useState(null),b=j.useCallback(W=>_(W),[]),[S,k]=j.useState(!1),E=j.useRef(P5()),[T,I]=j.useState(R5);j.useEffect(()=>{j5(T)},[T]);const[O,A]=j.useState(A5);j.useEffect(()=>{I5(O)},[O]);const[U,z]=j.useState(M5);j.useEffect(()=>{O5(U)},[U]);const[P,D]=j.useState(()=>{try{const W=window.localStorage.getItem(ME);return W===null?!0:W==="1"}catch{return!0}});j.useEffect(()=>{try{window.localStorage.setItem(ME,P?"1":"0")}catch{}},[P]);const[V,B]=j.useState(null),[C,q]=j.useState(!1),[L,re]=j.useState(0),[Z,H]=j.useState(0);j.useEffect(()=>{fetch("/api/sound-hook").then(W=>W.ok?W.json():null).then(W=>{W!=null&&W.ok&&(B(W.enabled===!0),re((W.foreign??[]).filter(K=>K.worksHere).length),H(typeof W.parked=="number"?W.parked:0))}).catch(()=>{})},[]);const J=j.useCallback(async()=>{q(!0);try{const K=await(await fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!V})})).json().catch(()=>null);K!=null&&K.ok&&B(K.enabled===!0),fetch("/api/sound-hook").then(le=>le.ok?le.json():null).then(le=>{le!=null&&le.ok&&(re((le.foreign??[]).filter(de=>de.worksHere).length),H(typeof le.parked=="number"?le.parked:0))}).catch(()=>{})}catch{}finally{q(!1)}},[V]),[M,G]=j.useState(!1),[Y,$]=j.useState(null),[Q,ne]=j.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(OE)??""}catch{return""}}),[oe,fe]=j.useState(!1),te=j.useRef(0),[ce,Ce]=j.useState(!1),ve=j.useCallback((W=!1)=>{W&&(te.current=Date.now(),Ce(!0)),fetch(W?"/api/version?refresh=1":"/api/version").then(K=>K.ok?K.json():null).then(K=>{K&&$(K)}).catch(()=>{}).finally(()=>{W&&Ce(!1)})},[]),je=j.useCallback(()=>{ve(Date.now()-te.current>=T5)},[ve]);j.useEffect(()=>{ve();const W=window.setInterval(je,5*6e4),K=()=>{document.visibilityState==="visible"&&je()};return document.addEventListener("visibilitychange",K),()=>{window.clearInterval(W),document.removeEventListener("visibilitychange",K)}},[ve,je]),j.useEffect(()=>{M&&ve()},[M,ve]);const ye=(Y==null?void 0:Y.notice)??null,[ke,Ye]=j.useState(null),[we,_e]=j.useState(Mv);j.useEffect(()=>{let W=!1;return fetch("/api/health").then(K=>K.ok?K.json():null).then(K=>{W||(_e(l5(K)),!(!K||typeof K.workspace!="string")&&Ye(K.workspace))}).catch(()=>{}),()=>{W=!0}},[M]);const Be=j.useRef(we);Be.current=we;const it=ye?`${ye.kind}:${ye.to}`:"",pt=ye!=null&&Q!==it,Ze=j.useCallback(()=>{if(!ye)return;const W=Q===it?"":it;ne(W);try{window.localStorage.setItem(OE,W)}catch{}},[ye,it,Q]),[Fe,Je]=j.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(PE)??""}catch{return""}}),Xe=Y!=null&&Y.invokedAs&&Y.invokedAs!==en?Y.invokedAs:null,Mt=Xe!=null&&Fe!==Xe,ut=j.useCallback(()=>{if(Xe){Je(Xe);try{window.localStorage.setItem(PE,Xe)}catch{}}},[Xe]),Qe=((Wa=Y==null?void 0:Y.upgrade)==null?void 0:Wa.state)??"idle",Ot=W3(Y==null?void 0:Y.upgrade),Ft=j.useCallback(async()=>{try{await fetch("/api/upgrade",{method:"POST"})}catch{}ve()},[ve]);j.useEffect(()=>{if(Qe!=="running")return;const W=window.setInterval(ve,3e3);return()=>window.clearInterval(W)},[Qe,ve]);const et=j.useCallback(async()=>{var le;const W=Y==null?void 0:Y.command;if(!W)return;let K=!1;try{K=await Promise.race([((le=navigator.clipboard)==null?void 0:le.writeText(W).then(()=>!0))??Promise.resolve(!1),new Promise(de=>window.setTimeout(()=>de(!1),500))])}catch{K=!1}if(!K)try{const de=document.createElement("textarea");de.value=W,de.setAttribute("readonly",""),de.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(de),de.select(),K=document.execCommand("copy"),de.remove()}catch{K=!1}K&&(fe(!0),window.setTimeout(()=>fe(!1),1600))},[Y==null?void 0:Y.command]),St=j.useCallback(()=>{I(W=>(W||D(!1),!W))},[]),mt=j.useCallback(()=>{D(W=>(W||I(!1),!W))},[]),[wt,hn]=j.useState(!1),[Yt,Pt]=j.useState(0),Sn=j.useRef(null),[gr,kn]=j.useState(!1),zt=j.useRef(null),[Fn,pn]=j.useState(0),vr=j.useRef(u$()),[Wr,gi]=j.useState(!1),Vr=j.useCallback(()=>{const W=vr.current,K=W.setPaused(!W.paused);for(const le of K)n.current=qx(n.current,le);gi(W.paused)},[]),[ct,vi]=j.useState(Date.now()),[mn,Ts]=j.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem($E)!=="0"}catch{return!0}}),yr=j.useCallback(()=>{Ts(W=>{const K=!W;try{window.localStorage.setItem($E,K?"1":"0")}catch{}return K})},[]),[zn,En]=j.useState(!1),[Gr,Yr]=j.useState("restart"),[Kr,yi]=j.useState(null),ir=j.useRef(!1),Rs=j.useRef(null),Nn=j.useRef(0),wr=j.useCallback(async W=>{if(ir.current)return;const K=(W==null?void 0:W.upgrade)===!0;ir.current=!0,Rs.current=Ot;const le=++Nn.current;Yr(K?"npx":"restart"),En(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(ye==null?void 0:ye.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:K})})}catch{}window.setTimeout(()=>{if(Nn.current===le&&ir.current){ir.current=!1,En(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},K?18e4:3e4)},[ye==null?void 0:ye.to,Ot]),js=j.useRef(null);j.useEffect(()=>{let W=!1;for(const le of n.current.agents.values())if(le.state==="active"){W=!0;break}const K=G3({enabled:mn,kind:ye==null?void 0:ye.kind,canRestart:(Y==null?void 0:Y.canRestart)===!0,busy:W,idleSince:js.current,now:ct});js.current=K.idleSince,K.restart&&wr()},[mn,ye==null?void 0:ye.kind,Y==null?void 0:Y.canRestart,ct,wr]),j.useEffect(()=>{const W=Y==null?void 0:Y.running;let K=null,le=null;try{K=window.sessionStorage.getItem("agent-dag.restartPending"),le=window.sessionStorage.getItem(qE)}catch{return}const de=H3({bundle:"1.35.13",running:W,pending:K,lastTried:le});if(de==="reload"){try{window.sessionStorage.setItem(qE,W??"")}catch{return}window.location.reload();return}if(de!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ir.current=!1,En(!1),yi(W??null);const xe=window.setTimeout(()=>yi(null),6e3);return()=>window.clearTimeout(xe)},[Y==null?void 0:Y.running]),j.useEffect(()=>{if(zn&&V3({asked:Rs.current,reported:Ot})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ir.current=!1,En(!1)}},[zn,Ot]);const As=j.useRef(L5()).current;j.useRef(!1);const Rt=j.useRef(new Map(As.positions.filter(([W])=>As.pins.includes(W)))),xr=j.useRef(null),_r=j.useState(()=>$5())[0],[Kt,Xr]=j.useState(""),[wi,nt]=j.useState(()=>new Set),[br,Qr]=j.useState(p$),[Is,Zr]=j.useState(!1),Jr=j.useRef(null);j.useEffect(()=>{document.documentElement.dataset.theme=br;try{window.localStorage.setItem(IC,br)}catch{}},[br]),j.useEffect(()=>{if(!_r)return;const W=window.setTimeout(()=>{try{e.setViewport(_r,{duration:0})}catch{}},60);return()=>window.clearTimeout(W)},[e,_r]);const Ms=j.useRef(!0);j.useEffect(()=>{const W=new EventSource("/events"),K=l$(i,{now:()=>Date.now(),setTimeout:(le,de)=>window.setTimeout(le,de),clearTimeout:le=>window.clearTimeout(le)});return W.addEventListener("open",()=>{G(!0),Zr(!0)}),W.addEventListener("error",()=>G(!1)),W.addEventListener("replay-end",()=>{Ms.current=!1,K.flush()}),W.addEventListener("hook",le=>{try{const de=JSON.parse(le.data);if(!vr.current.accept(de))return;n.current=qx(n.current,de),de.replay===!0||Ms.current||Date.now()-de.receivedAt>3e4?K.replay():K.live()}catch{}}),()=>{W.close(),K.cancel()}},[i]),j.useEffect(()=>{const W=setInterval(()=>{const K=Date.now();vi(K);let le=hP(n.current,K,S5);mP(n.current,K,pP)&&(le=!0),dP(n.current,K,k5,E5)&&(le=!0),fP(n.current,K,N5,C5)&&(le=!0),le&&i()},250);return()=>clearInterval(W)},[i]);const or=j.useRef(null),kt=j.useRef(0),Os=420,gt=j.useCallback((W=500)=>{try{const Ee=document.querySelector(".canvas-wrap"),Oe=Array.from(document.querySelectorAll(".react-flow__node")).filter(ot=>ot.offsetWidth>0);if(!Ee||Oe.length===0)return;const ze=Ee.getBoundingClientRect(),Ge=e.getViewport();if(!Number.isFinite(Ge.zoom)||Ge.zoom<=0)return;const Ve=ot=>(ot-ze.left-Ge.x)/Ge.zoom,qe=ot=>(ot-ze.top-Ge.y)/Ge.zoom,Tn=Oe.map(ot=>ot.getBoundingClientRect()),Hs=Math.min(...Tn.map(ot=>Ve(ot.left))),jo=Math.max(...Tn.map(ot=>Ve(ot.right))),Ws=Math.min(...Tn.map(ot=>qe(ot.top))),Ao=Math.max(...Tn.map(ot=>qe(ot.bottom))),Ka=jo-Hs,Ci=Ao-Ws;if(!(Ka>0&&Ci>0))return;const yn=Math.max(.2,Math.min(1,(ze.width-160)/(Ka+Os)*.86,(ze.height-160)/Ci*.86));e.setViewport({x:80-Hs*yn,y:Math.max(80,(ze.height-Ci*yn)/2)-Ws*yn,zoom:yn},{duration:W}),kt.current=Date.now(),window.setTimeout(()=>{try{const ot={x:80-Hs*yn,y:Math.max(80,(ze.height-Ci*yn)/2)-Ws*yn,zoom:yn},Xa=e.getViewport();(Math.abs(Xa.zoom-yn)>.01||Math.abs(Xa.x-ot.x)>2)&&e.setViewport(ot,{duration:0})}catch{}},W+60)}catch{}},[e]),_o=j.useRef(""),bo=j.useRef(null),La=j.useRef(0),Sr=j.useCallback(()=>{La.current=Date.now()},[]),es="agent-dag.autoFitDisabled",gn=j.useRef((()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(es)==="1"}catch{return!1}})()),[Ps,$a]=j.useState(gn.current),qa=j.useCallback(()=>{if(!gn.current){gn.current=!0,$a(!0);try{window.localStorage.setItem(es,"1")}catch{}}},[]),So=j.useCallback(()=>{gn.current=!1,$a(!1);try{window.localStorage.removeItem(es)}catch{}gt(400)},[e,gt]);j.useEffect(()=>{const W=setInterval(()=>{if(gn.current||Date.now()-La.current<800)return;const K=n.current,le=Date.now(),de=[];for(const Ve of K.agents.values())Iv(Ve,le)&&de.push({id:Ve.id});if(de.length===0)return;const xe=e.getViewport(),Ee=window.innerWidth-360,Oe=window.innerHeight-52;let ze=!1,Ge=!1;for(const{id:Ve}of de){const qe=ar.current.get(Ve),Tn=Rt.current.get(Ve)??Xt.current.get(Ve);if(!qe||!Tn)continue;Ge=!0;const Hs=Tn.x*xe.zoom+xe.x,jo=Tn.y*xe.zoom+xe.y,Ws=(Tn.x+qe.width)*xe.zoom+xe.x,Ao=(Tn.y+qe.height)*xe.zoom+xe.y;if(Ws>0&&Hs<Ee&&Ao>0&&jo<Oe){ze=!0;break}}Ge&&!ze&&gt(600)},1500);return()=>clearInterval(W)},[e]);const xi=j.useRef(!1),ar=j.useRef(new Map),ts=j.useRef(0),ec=j.useCallback(W=>{const K=ar.current;let le=!1;for(const de of W.nodeInternals.values()){const xe=de.width,Ee=de.height;if(xe==null||Ee==null)continue;const Oe=K.get(de.id);Oe?(Math.abs(Oe.height-Ee)>4||Math.abs(Oe.width-xe)>4)&&(K.set(de.id,{width:xe,height:Ee}),le=!0):(K.set(de.id,{width:xe,height:Ee}),le=!0)}return le&&(ts.current+=1),ts.current},[]),_i=Ke(ec),[He,Da]=j.useState(0);j.useEffect(()=>{let W=0;const K=()=>{const de=ar.current;let xe=!1;for(const Ee of document.querySelectorAll(".react-flow__node[data-id]")){const Oe=Ee.getAttribute("data-id");if(!Oe)continue;const ze=Ee.offsetWidth,Ge=Ee.offsetHeight;if(!ze||!Ge)continue;const Ve=de.get(Oe);(!Ve||Math.abs(Ve.width-ze)>4||Math.abs(Ve.height-Ge)>4)&&(de.set(Oe,{width:ze,height:Ge}),xe=!0)}xe&&Da(Ee=>Ee+1)};if(xi.current)return;let le=0;return document.visibilityState==="hidden"?le=window.setTimeout(K,32):W=requestAnimationFrame(K),()=>{cancelAnimationFrame(W),window.clearTimeout(le)}});const Xt=j.useRef(new Map(As.positions)),ko=j.useRef(new Set),bi=j.useRef(""),kr=j.useMemo(()=>{const W=[];for(const K of n.current.agents.values())Iv(K,ct)&&W.push(K.id+(K.parentId?`>${K.parentId}`:""));return W.sort(),`${W.join("|")}#sv${_i}.${He}`},[n.current,n.current.lastSeq,ct,_i,He]),ns=j.useRef(null);j.useEffect(()=>(ns.current!=null&&window.clearTimeout(ns.current),ns.current=window.setTimeout(()=>{cv(Xt.current,Rt.current)},1500),()=>{ns.current!=null&&window.clearTimeout(ns.current)}),[kr]),j.useEffect(()=>{if(_o.current===kr)return;const W=_o.current;if(_o.current=kr,!W||gn.current)return;Date.now()-kt.current>1200&&gt(400),or.current&&window.clearTimeout(or.current),or.current=window.setTimeout(()=>{gn.current||gt(500)},280)},[kr,e,gt]);const Ls=j.useMemo(()=>{if(o.size===0)return null;const W=new Set;for(const K of o){const le=F5(n.current,K);if(le)for(const de of le)W.add(de)}return W.size>0?W:null},[n.current,n.current.lastSeq,o]),Cn=j.useMemo(()=>J4(n.current,ct),[n.current,n.current.lastSeq,ct]),Bn=j.useRef(null),[vn,Un]=j.useState({w:0,h:0});j.useEffect(()=>{const W=Bn.current;if(!W||typeof ResizeObserver>"u")return;const K=new ResizeObserver(le=>{var xe;const de=(xe=le[0])==null?void 0:xe.contentRect;de&&Un(Ee=>Math.abs(Ee.w-de.width)>40||Math.abs(Ee.h-de.height)>40?{w:de.width,h:de.height}:Ee)});return K.observe(W),Un({w:W.clientWidth,h:W.clientHeight}),()=>K.disconnect()},[]);const $s=j.useRef(new Map),[rs,lr]=j.useState(!1);j.useEffect(()=>{const W=window.setTimeout(()=>lr(!0),2500);return()=>window.clearTimeout(W)},[]);const[tc,Si]=j.useState(!1),tn=j.useRef(null),[Eo,No]=j.useState(!1),ki=j.useCallback(()=>{tn.current&&(window.clearTimeout(tn.current),tn.current=null),Si(!1)},[]),Fa=j.useCallback(W=>{W.length!==0&&queueMicrotask(()=>{Si(!0),tn.current&&window.clearTimeout(tn.current),tn.current=window.setTimeout(()=>Si(!1),b5+80)})},[]);j.useEffect(()=>()=>{tn.current&&window.clearTimeout(tn.current)},[]);const za=vn.w>0?vn.w*.92:0,ss=vn.h>0?vn.h:0,{nodes:nn,edges:is}=j.useMemo(()=>z5(n.current,ct,za,ss,Rt.current,Kt,ar.current,$s.current,Fa,rs,Eo,Xt.current,ko.current,kr,bi,o,Ls,Cn,b),[n.current,n.current.lastSeq,ct,za,ss,rs,Eo,Kt,kr,o,Ls,Cn,b,Yt]),qs=j.useMemo(()=>{const W=new Map;for(const le of nn){const de=le.data;if(!(de!=null&&de.sessionId)||de.exitAt!=null)continue;const xe=le.width,Ee=le.height;if(xe==null||Ee==null)continue;const Oe=le.position.x,ze=le.position.y,Ge=Oe+xe,Ve=ze+Ee,qe=W.get(de.sessionId);qe?(qe.minX=Math.min(qe.minX,Oe),qe.minY=Math.min(qe.minY,ze),qe.maxX=Math.max(qe.maxX,Ge),qe.maxY=Math.max(qe.maxY,Ve)):W.set(de.sessionId,{minX:Oe,minY:ze,maxX:Ge,maxY:Ve})}const K=[];for(const[le,de]of W){const xe=de.maxX-de.minX+au*2,Ee=de.maxY-de.minY+au*2;K.push({id:`group:${le}`,type:MT,position:{x:de.minX-au,y:de.minY-au},data:{sessionId:le,w:xe,h:Ee},width:xe,height:Ee,style:{width:xe,height:Ee},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return K},[nn,ct]),nc=j.useMemo(()=>{const W=[...qs,...nn],K=zt.current;return!K||K.size===0?W:W.map(le=>{const de=K.get(le.id);return de?{...le,position:de}:le})},[qs,nn,Fn]),Ds=j.useMemo(()=>{if(!Kt)return null;const W=new Set;for(const K of n.current.agents.values())Cn.has(K.id)&&LT(K,Kt)&&W.add(K.id);return W},[n.current,n.current.lastSeq,Kt,Cn]),Hn=j.useMemo(()=>g5(Kt,(Ds==null?void 0:Ds.size)??0,Cn.size),[Kt,Ds,Cn]),Er=j.useMemo(()=>{const W=new Set;for(const K of n.current.agents.values())for(const le of K.tools)W.add(BT(le.name));return Object.keys(Pv).filter(K=>W.has(K))},[n.current,n.current.lastSeq]);j.useEffect(()=>{if(Er.length<=1){kn(!1);return}let W=0;const K=()=>{const le=Sn.current;if(le&&!document.hidden){const de=le.getBoundingClientRect(),xe=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Oe=>Oe.getBoundingClientRect()),Ee=t5(de,xe,8);kn(Oe=>Oe===Ee?Oe:Ee)}W=window.setTimeout(K,300)};return K(),()=>window.clearTimeout(W)},[Er.length]);const Nr=j.useMemo(()=>{const W=new Map;for(const le of n.current.agents.values())for(const de of le.tools){if(!de.name.startsWith("mcp__"))continue;const xe=de.name.slice(5),Ee=xe.indexOf("__"),Oe=Ee>0?xe.slice(0,Ee):xe;W.set(Oe,(W.get(Oe)??0)+1)}const K=[];for(const[le,de]of W){let xe=5381;for(let Ee=0;Ee<le.length;Ee++)xe=(xe<<5)+xe^le.charCodeAt(Ee);K.push({server:le,count:de,hue:Math.abs(xe)%360})}return K.sort((le,de)=>de.count-le.count),K},[n.current,n.current.lastSeq]),Ba=j.useCallback(W=>{nt(K=>{const le=new Set(K);return le.has(W)?le.delete(W):le.add(W),le})},[]),dt=u?n.current.agents.get(u):null,Fs=h?Array.from(n.current.agents.values()).flatMap(W=>W.tools).find(W=>W.id===h)??null:null,zs=j.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}n.current=Cv(),Rt.current.clear(),ar.current.clear(),Xt.current.clear(),bi.current="",FE(),m(),i()},[i,m]),Co=j.useRef(S);Co.current=S;const Bs=j.useRef(!1);Bs.current=Fs!=null||wt||N!=null||y!=null;const Cr=j.useCallback(W=>{const K=K3(W,{confirmOpen:Co.current,modalOpen:Bs.current});K==="confirm"?k(!0):K==="clear"&&(k(!1),zs())},[zs]),Ei=j.useCallback(()=>{Rt.current.clear(),Xt.current.clear(),bi.current="",FE(),i(),window.setTimeout(()=>gt(500),80)},[i,e,gt]),Bt=j.useCallback(()=>gt(500),[gt]),Wn=j.useRef(nn);Wn.current=nn;const Ni=j.useRef(u);Ni.current=u;const Tr=j.useCallback(W=>{const K=Wn.current,le=Q3(K.map(Ee=>({id:Ee.id,x:Ee.position.x,y:Ee.position.y})),Ni.current,W),de=le?K.find(Ee=>Ee.id===le):void 0;if(!de)return;const xe=IE(document.activeElement);d(de.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[de]})}catch{}kt.current=Date.now(),xe&&_5(de.id)},30)},[d,e]),Ua=j.useCallback(W=>{d(W,!1),window.setTimeout(()=>{try{const K=Wn.current.find(le=>le.id===W);K&&e.fitView({padding:.3,duration:500,nodes:[K]}),kt.current=Date.now()}catch{}},60)},[d,e]);j.useEffect(()=>{const W=K=>{var ze,Ge,Ve;const le=K.target,de={tagName:le==null?void 0:le.tagName,isContentEditable:le==null?void 0:le.isContentEditable,role:(ze=le==null?void 0:le.getAttribute)==null?void 0:ze.call(le,"role"),type:le==null?void 0:le.type};if(K.key==="Escape"){const qe=OP({overlayOpen:Eu.depth()>0,typing:ny(de)});qe==="dismiss"?Eu.dismissTop():qe==="blur"?le==null||le.blur():(t$(de)&&(le==null||le.blur()),m());return}if(wC(K))return;const xe=IE(le)?(Ge=le==null?void 0:le.getAttribute)==null?void 0:Ge.call(le,"data-id"):null,Ee=xe&&Wn.current.some(qe=>qe.id===xe)?xe:null,Oe=J3(K,Ee);if(Oe.kind==="activate"){K.preventDefault(),d(Oe.nodeId,Oe.additive);return}if(Oe.kind!=="node"&&!(Oe.nodeId==null&&BP(de))){if(K.key==="/"){K.preventDefault(),(Ve=Jr.current)==null||Ve.focus();return}K.key===" "&&(K.preventDefault(),Vr()),(K.key==="c"||K.key==="C")&&Cr("shortcut"),(K.key==="r"||K.key==="R")&&Ei(),(K.key==="f"||K.key==="F")&&Bt(),(K.key==="l"||K.key==="L")&&St(),(K.key==="h"||K.key==="H")&&hn(qe=>!qe),(K.key==="u"||K.key==="U")&&z(qe=>!qe),(K.key==="a"||K.key==="A")&&Be.current.claude&&mt(),(K.key==="j"||K.key==="J")&&Tr(1),(K.key==="k"||K.key==="K")&&Tr(-1),(K.key==="t"||K.key==="T")&&Qr(qe=>qe==="dark"?"light":"dark")}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[Cr,Ei,Bt,m,d,Tr,Vr]);const Rr=n.current.agents.size,To=new Set(Array.from(n.current.agents.values()).map(W=>W.sessionId)).size,Qt=j.useMemo(()=>QL(n.current.agents.values()),[n.current,n.current.lastSeq]),Us=j.useMemo(()=>ZL(n.current.agents.values()),[n.current,n.current.lastSeq]),Ro=j.useRef(null);j.useEffect(()=>{const W=m$({waiting:Qt.length,running:Us}),K=Ro.current;if(Ro.current=W,(K==null?void 0:K.title)!==W.title&&(document.title=W.title),(K==null?void 0:K.icon)!==W.icon){const le=document.querySelector('link[rel="icon"]');le&&(le.href=g$[W.icon])}},[Qt.length,Us]);const[rc,sc]=j.useState(""),Ha=y$(Qt);j.useEffect(()=>{sc(W=>w$(W,Ha))},[Ha]);const Ut=j.useMemo(()=>{let W=0,K=0,le=0,de=0,xe=0,Ee=0,Oe=0,ze=0,Ge=0;for(const Ve of n.current.agents.values()){W+=Ve.usage.inputTokens,K+=Ve.usage.outputTokens,le+=Ve.usage.cacheReadTokens,de+=Ve.usage.cacheCreateTokens;const qe=dn(Ve.usage,Ve.model);xe+=qe.total,Ee+=qe.input,Oe+=qe.output,ze+=qe.cacheRead,Ge+=qe.cacheWrite}return{inT:W,outT:K,cacheR:le,cacheC:de,sum:W+K,cost:{total:xe,input:Ee,output:Oe,cacheRead:ze,cacheWrite:Ge}}},[n.current,n.current.lastSeq]);return g.jsxs("div",{className:"app",children:[g.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),g.jsxs("header",{className:"topbar",children:[g.jsxs("div",{className:"brand",children:[g.jsx("span",{className:"logo"}),g.jsx("h1",{children:en}),ye?g.jsxs("button",{type:"button",className:"v stale",onClick:Ze,"aria-label":o5({...ye,open:pt}),title:ye.kind==="restart"?`Running v${ye.from}; v${ye.to} is installed on disk. Restart to pick it up.`:`Running v${ye.from}; v${ye.to} is on npm.`,children:["v",ye.from,g.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const W={running:(Y==null?void 0:Y.running)??"1.35.13",latest:Y==null?void 0:Y.latest,latestPending:Y==null?void 0:Y.latestPending,checkedAgo:Y!=null&&Y.checkedAt?Ov(ct-Y.checkedAt):null,checkDisabled:Y==null?void 0:Y.checkDisabled,checking:ce};return g.jsxs("button",{type:"button",className:ce?"v checking":"v",onClick:()=>ve(!0),"aria-busy":ce||void 0,"aria-label":i5(W),title:s5(W),children:["v",W.running]})})()]}),dt&&(()=>{const W=dn(dt.usage,dt.model),K=Math.max(0,((dt.endedAt??ct)-dt.startedAt)/1e3),le=dt.state==="active"?ku(W.total,K):null,de=o.size-1;return g.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${dt.label}`,onClick:()=>{try{const xe=nn.find(Ee=>Ee.id===dt.id);xe&&e.fitView({padding:.35,duration:500,nodes:[xe]}),kt.current=Date.now()}catch{}},children:[g.jsx("span",{className:`state-pill state-${dt.state}`,children:dt.state==="active"?"live":dt.state}),g.jsx("span",{className:"selected-label",children:dt.label}),W.total>0&&g.jsxs("span",{className:"selected-cost",children:[De(W.total),le?g.jsxs("span",{className:"selected-rate",children:[" · ",le]}):null]}),de>0&&g.jsxs("span",{className:"selected-extra",children:["+",de]}),g.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:xe=>{xe.stopPropagation(),m()},children:"×"})]})})(),g.jsxs("div",{className:"actions",children:[g.jsxs("div",{className:"search",children:[g.jsx("span",{className:"search-icon","aria-hidden":!0,children:"⌕"}),g.jsx("input",{ref:Jr,type:"text",placeholder:v5,value:Kt,onChange:W=>Xr(W.target.value),spellCheck:!1,"aria-label":"Filter the graph"}),Kt?g.jsx("button",{className:"search-clear","aria-label":"Clear search",onClick:()=>Xr(""),children:"×"}):g.jsx("kbd",{className:"search-kbd","aria-hidden":!0,children:"/"}),Hn.count&&g.jsx("span",{className:`search-count${Hn.empty?" none":""}`,"aria-live":"polite",title:`${Hn.count} agents on the canvas match “${Kt}”`,children:Hn.count})]}),g.jsxs("span",{className:"status",children:[(()=>{const W=p5({connected:M,paused:Wr,held:vr.current.size});return g.jsx("span",{className:`pill ${W.tone}`,title:W.title,children:W.label})})(),g.jsxs("span",{className:"stat",title:d5(we),children:[g.jsx("span",{className:"count",children:To}),g.jsx("span",{className:"lbl",children:"sessions"})]}),g.jsxs("span",{className:"stat",title:"Total agents (root + subagents)",children:[g.jsx("span",{className:"count",children:Rr}),g.jsx("span",{className:"lbl",children:"agents"})]}),g.jsxs("span",{className:"stat",title:f5(we),children:[g.jsx("span",{className:"count",children:n.current.totalEvents}),g.jsx("span",{className:"lbl",children:"events"})]}),Ut.sum>0&&g.jsxs("span",{className:"stat",title:`in:${Ut.inT.toLocaleString()} out:${Ut.outT.toLocaleString()} cache-r:${Ut.cacheR.toLocaleString()} cache-c:${Ut.cacheC.toLocaleString()}`,children:[g.jsx("span",{className:"count",children:qt(Ut.sum)}),g.jsx("span",{className:"lbl",children:"tokens"})]}),Nr.length>0&&g.jsxs("span",{className:"stat mcp-legend",title:`MCP servers seen this session:
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.`}}const MP=1;function OP(){const e=[];let n=0;function r(){let i;for(const o of e)(!i||o.layer>i.layer||o.layer===i.layer&&o.seq>i.seq)&&(i=o);return i}return{push(i,o=0){const l={dismiss:i,layer:o,seq:n++};return e.push(l),()=>{const u=e.indexOf(l);u!==-1&&e.splice(u,1)}},dismissTop(){const i=r();return i?(i.dismiss(),!0):!1},isTop(i){const o=r();return o!=null&&o.dismiss===i},depth(){return e.length}}}const Eu=OP();function PP(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function zx(e){return String(e.tagName??"").toUpperCase()==="BODY"}function LP(e,n){return!e||!e.isConnected||zx(e)?!1:n==null||zx(n)}const Bx="a[href], button, input, select, textarea, [tabindex]";function $P(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function qP(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const n=String(e.overflow??"").toLowerCase();return n==="auto"||n==="scroll"}function DP({count:e,index:n,shiftKey:r}){return e<=0?{kind:"hold"}:n<0||n>=e?{kind:"focus",index:r?e-1:0}:!r&&n===e-1?{kind:"focus",index:0}:r&&n===0?{kind:"focus",index:e-1}:{kind:"allow"}}function xC(e){return e.ctrlKey||e.metaKey||e.altKey}const FP=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),zP=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),BP=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function _C(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function ny(e){if(!e)return!1;if(e.isContentEditable)return!0;const n=_C(e);return n==="TEXTAREA"?!0:n!=="INPUT"?!1:!FP.has(String(e.type??"text").toLowerCase())}function UP(e){if(!e)return!1;if(ny(e)||zP.has(_C(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>BP.has(r))}function bC(e){return e?Array.from(e.querySelectorAll("*")).filter(n=>{if(n.matches(Bx))return $P({disabled:n.disabled,tabIndex:n.tabIndex,rendered:n.getClientRects().length>0});const r=n.scrollHeight>n.clientHeight;return r&&qP({overflowing:r,overflow:getComputedStyle(n).overflowY,hasFocusable:n.querySelector(Bx)!=null})}):[]}function HP(e,n){const r=bC(e);if(!n||!e.contains(n)||r.includes(n))return r;const i=r.findIndex(o=>(n.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return i===-1?[...r,n]:[...r.slice(0,i),n,...r.slice(i)]}function mo(e,n={}){const{focusRef:r,layer:i}=n,o=j.useRef(null),l=j.useRef(e);l.current=e;const u=j.useRef(null);u.current===null&&(u.current=()=>l.current());const c=u.current;return j.useEffect(()=>Eu.push(c,i),[c,i]),j.useEffect(()=>{var p;const h=document.activeElement;return(p=(r==null?void 0:r.current)??bC(o.current)[0])==null||p.focus(),()=>{LP(h,document.activeElement)&&h.focus()}},[]),j.useEffect(()=>{const h=p=>{var _;if(p.key!=="Tab"||xC(p))return;const d=o.current;if(!d)return;const m=document.activeElement;if(!(m!=null&&d.contains(m))&&!Eu.isTop(c))return;const w=HP(d,m),N=DP({count:w.length,index:m?w.indexOf(m):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((_=w[N.index])==null||_.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[c]),o}function WP(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 Pn(e){return e.toLocaleString()}function VP(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const GP=60;function YP(e,n=GP){if(e.length<=n)return e;const r=e.slice(e.length-(n-1)),i=r.search(/[/\\]/);return"…"+(i===-1?r:r.slice(i))}function KP({agent:e,onClose:n}){var y;const r=j.useRef(null),i=mo(n,{focusRef:r}),o=e.context,l=e.usage,u=(o==null?void 0:o.currentContextTokens)??0,c=wC(e.contextWindow,e.model),h=Math.min(100,u/c*100),p=dn(l,e.model),d=l.inputTokens+l.cacheReadTokens+l.cacheCreateTokens,m=WP(e.provider);return g.jsx("div",{className:"ctx-modal-backdrop",onClick:n,role:"presentation",children:g.jsxs("div",{ref:i,className:"ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[g.jsxs("header",{className:"ctx-modal-head",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),g.jsx("div",{className:"ctx-modal-sub",children:m.subtitle})]}),g.jsx("button",{type:"button",ref:r,className:"ctx-modal-close",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),g.jsxs("section",{className:"ctx-window-row",children:[g.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(h),children:g.jsx("div",{className:"ctx-window-fill",style:{width:`${h}%`}})}),g.jsxs("div",{className:"ctx-window-meta",children:[g.jsxs("span",{className:"ctx-window-pct",children:[h.toFixed(1),"%"]}),g.jsxs("span",{children:[Pn(u)," / ",Pn(c)," tok (",m.windowScope,")"]})]})]}),g.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),g.jsxs("div",{className:"ctx-grid",children:[g.jsx(Zn,{label:"input tokens",val:Pn(l.inputTokens)}),g.jsx(Zn,{label:"output tokens",val:Pn(l.outputTokens)}),g.jsx(Zn,{label:"cache reads",val:Pn(l.cacheReadTokens)}),g.jsx(Zn,{label:"cache writes",val:Pn(l.cacheCreateTokens)}),g.jsx(Zn,{label:"cumulative total",val:Pn(d)}),g.jsx(Zn,{label:"estimated cost",val:De(p.total),accent:!0})]}),g.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),m.compositionCounted?g.jsxs("div",{className:"ctx-grid",children:[g.jsx(Zn,{label:"user messages",val:Pn((o==null?void 0:o.msgsUser)??0)}),g.jsx(Zn,{label:"assistant messages",val:Pn((o==null?void 0:o.msgsAssistant)??0)}),g.jsx(Zn,{label:"tool uses",val:Pn((o==null?void 0:o.toolUses)??0)}),g.jsx(Zn,{label:"tool results",val:Pn((o==null?void 0:o.toolResults)??0)}),g.jsx(Zn,{label:"system-reminders",val:Pn((o==null?void 0:o.systemReminders)??0)})]}):g.jsx("div",{className:"ctx-empty",children:m.compositionUncounted}),g.jsx("h3",{className:"ctx-section-title",children:m.memoryHeading}),(((y=o==null?void 0:o.memoryFiles)==null?void 0:y.length)??0)===0?g.jsx("div",{className:"ctx-empty",children:m.memoryEmpty}):g.jsx("ul",{className:"ctx-md-list",children:o.memoryFiles.map(w=>g.jsxs("li",{children:[g.jsx("span",{className:"ctx-md-path",title:w.path,children:YP(w.path)}),g.jsx("span",{className:"ctx-md-size",children:VP(w.bytes)})]},w.path))})]})})}function Zn({label:e,val:n,accent:r}){return g.jsxs("div",{className:`ctx-row${r?" accent":""}`,children:[g.jsx("span",{className:"ctx-row-label",children:e}),g.jsx("span",{className:"ctx-row-val",children:n})]})}function XP({currentContextTokens:e,modelId:n,contextWindow:r,size:i=26,onClick:o,title:l}){const u=wC(r,n),c=Math.min(1,e/u),h=i/2-3,p=i/2,d=2*Math.PI*h,m=d*c,y=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return g.jsx("button",{type:"button",className:"ctx-donut",onClick:o,title:l??`context: ${e.toLocaleString()} / ${u.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:g.jsxs("svg",{width:i,height:i,viewBox:`0 0 ${i} ${i}`,children:[g.jsx("circle",{cx:p,cy:p,r:h,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),g.jsx("circle",{cx:p,cy:p,r:h,stroke:y,strokeWidth:"2.5",fill:"none",strokeDasharray:`${m} ${d-m}`,strokeDashoffset:d/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),g.jsx("text",{x:p,y:p+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}function Ux(e,n){const r=fo(n);if(!r)return`model: ${n}
60
+ no published rate in this build — the tokens are counted, the dollars are not`;const i=d=>d.toLocaleString(),o=d=>`$${d}/MTok`,l=dn(e,n),u=vC(e,r),c=u.tokens1h>0?[`cache w5m${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${De(u.usd5m)}`,`cache w1h${i(u.tokens1h).padStart(14)} × ${o(r.cacheWrite1h??r.cacheWrite).padEnd(11)} = ${De(u.usd1h)}`]:[`cache w ${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${De(u.usd5m)}`],h=yC(e,n),p=h===e.inputTokens?"input":"uncached";return[`model: ${n}`,`${p.padEnd(9)}${i(h).padStart(14)} × ${o(r.input).padEnd(11)} = ${De(l.input)}`,`output ${i(e.outputTokens).padStart(14)} × ${o(r.output).padEnd(11)} = ${De(l.output)}`,`cache r ${i(e.cacheReadTokens).padStart(14)} × ${o(r.cacheRead).padEnd(11)} = ${De(l.cacheRead)}`,...c,"─────────────────────────────────────────",`total = ${De(l.total)}`].join(`
61
+ `)}function Tv(e,n,r){const i=(n??r)-e;if(i<1e3)return`${Math.max(0,i)}ms`;const o=Math.floor(i/1e3);if(o<60)return`${o}s`;const l=Math.floor(o/60),u=o%60;return`${l}m ${String(u).padStart(2,"0")}s`}function QP({data:e,selected:n}){var h;const r=e.now??Date.now(),i=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",n?"selected":""].filter(Boolean).join(" "),o=e.tools.filter(p=>!p.endedAt).length,l=ty(e.sessionId),u=((h=e.context)==null?void 0:h.currentContextTokens)??0,c=e.kind==="root"&&u>0;return g.jsxs("div",{className:i,style:{"--session-hue":l},children:[g.jsx("span",{className:"accent-stripe"}),g.jsx(co,{type:"target",position:Ae.Left,style:{background:"transparent",border:"none"}}),g.jsxs("div",{className:"head",children:[g.jsxs("div",{className:"title",children:[g.jsx(ZP,{state:e.state}),g.jsx("span",{className:"label",title:e.cwd,children:e.label}),e.synthetic&&g.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),g.jsxs("div",{className:"head-right",children:[c&&e.onOpenContext&&g.jsx(XP,{currentContextTokens:u,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),g.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:Tv(e.startedAt,e.endedAt,r)})]})]}),g.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&g.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?g.jsx("span",{className:"model-chip",title:e.model,children:Ns(e.model)}):e.provider==="codex"?g.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.waiting&&g.jsx(eL,{waiting:e.waiting,now:r}),(()=>{const p=IP(e);return p?g.jsxs("div",{className:"approval-blind-row",title:p.detail,children:[g.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),g.jsx("span",{className:"approval-blind-said",children:p.label})]}):null})(),e.tools.length>0&&g.jsx(nL,{tools:e.tools,now:r}),g.jsxs("div",{className:"meta",children:[g.jsxs("span",{children:[g.jsx("b",{children:e.toolCount})," tools"]}),o>0&&g.jsxs("span",{className:"inflight-meta",children:[g.jsx("b",{children:o})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&g.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:[g.jsx("b",{children:tL(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{if(!fo(e.model))return e.usage.inputTokens+e.usage.outputTokens<=0?null:g.jsx("span",{className:"cost-unpriced",title:Ux(e.usage,e.model),children:fu});const d=dn(e.usage,e.model);if(d.total<=0)return null;const m=Math.max(0,((e.endedAt??r)-e.startedAt)/1e3),y=e.state==="active"?ku(d.total,m):null,w=Ux(e.usage,e.model)+(y?`
62
+ burn: ${y}`:"");return g.jsxs("span",{className:"cost-meta",title:w,children:[g.jsx("b",{children:De(d.total)}),y&&g.jsx("span",{className:"cost-rate",children:y})]})})()]}),g.jsx(co,{type:"source",position:Ae.Right,style:{background:"transparent",border:"none"}})]})}function ry(e){return e==="active"?"live":e==="done"?"done":"err"}function ZP({state:e}){return g.jsx("span",{className:`state-pill state-${e}`,children:ry(e)})}function Pu(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function JP(e){return e.kind==="permission"?Pu(e):"Your turn"}function eL({waiting:e,now:n}){const r=e.kind==="permission",i=Pu(e);return g.jsxs("div",{className:r?"waiting-row permission":"waiting-row idle",title:`${i}
63
+ Blocked for ${Tv(e.since,void 0,n)} — the answer goes in the terminal, not here.`,children:[r?g.jsx("span",{className:"ap-pulse","aria-hidden":!0}):g.jsx("span",{className:"waiting-dot","aria-hidden":!0}),g.jsx("span",{className:"waiting-said",children:JP(e)}),g.jsx("b",{children:Tv(e.since,void 0,n)})]})}function tL(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(2)}M`}function nL({tools:e,now:n}){const l=new Array(24).fill(0);let u=0;for(const y of e){const w=n-y.startedAt;if(w<0||w>=6e4)continue;const N=23-Math.floor(w/2500);N>=0&&N<24&&(l[N]+=1,u+=1)}const c=Math.max(1,...l),h=132,p=14,d=h/24,m=c/(2500/1e3);return g.jsxs("div",{className:"tool-spark-row",title:`${u} tool calls in last 60s · peak ${m.toFixed(1)}/s`,children:[g.jsx("svg",{className:"tool-spark",width:h,height:p,viewBox:`0 0 ${h} ${p}`,"aria-hidden":!0,children:l.map((y,w)=>{const N=y===0?1.5:Math.max(1.5,y/c*p),_=w===23&&y>0,S=`tool-spark-bar${y>0?" active":""}${_?" latest":""}`;return g.jsx("rect",{x:w*d+.4,y:p-N,width:Math.max(.5,d-1),height:N,rx:.8,className:S},w)})}),g.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function Ns(e){const n=e.replace(/^anthropic\./,"").replace(/[-_]\d{8}(?!\d)/,""),r=n.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(r){const l=r[1][0].toUpperCase()+r[1].slice(1).toLowerCase(),u=r[2].replace(/[-_]/g,".");return`${l} ${u}`}const i=n.match(/^gpt[-_](\d+(?:[-_.]\d+)*)[-_]codex\b/i);if(i)return`GPT-${i[1].replace(/[-_]/g,".")} Codex`;const o=n.match(/^gpt[-_](\d+(?:[-_.]\d+)*)/i);return o?`GPT-${o[1].replace(/[-_]/g,".")}`:e}function Hx(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function rL(e){if(e.endedAt==null)return"in-flight…";const n=e.endedAt-e.startedAt;return n<1e3?`${n}ms`:`${(n/1e3).toFixed(2)}s`}function sL({tool:e,onClose:n}){const r=mo(n),i=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return g.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:g.jsxs("div",{ref:r,className:"modal",onClick:o=>o.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[g.jsxs("header",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:`status-dot ${i}`,"aria-hidden":!0}),g.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),g.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),g.jsxs("div",{className:"modal-actions",children:[g.jsx("span",{className:"modal-dur",children:rL(e)}),g.jsx("button",{className:"btn icon-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),g.jsxs("section",{className:"modal-body",children:[e.trimmed&&g.jsx("div",{className:"modal-section",children:g.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),g.jsxs("div",{className:"modal-section",children:[g.jsx("h4",{children:"Input"}),g.jsx("pre",{children:Hx(e.input??e.inputPreview)})]}),g.jsxs("div",{className:"modal-section",children:[g.jsxs("h4",{children:["Response ",i==="err"&&g.jsx("span",{className:"err-tag",children:"error"})]}),g.jsx("pre",{children:e.endedAt==null?"(waiting…)":Hx(e.response??e.errorPreview)})]})]})]})})}const tu=18,Wx=26,iL=12;function oL(e){return aL(e.nodeInternals.values())}function aL(e){const n=new Map;for(const o of e){if(o.type!=="agent")continue;const l=o.data;if(!(l!=null&&l.sessionId)||l.exitAt!=null||o.width==null||o.height==null)continue;const u=o.position.x,c=o.position.y,h=u+o.width,p=c+o.height,d=n.get(l.sessionId);d?(d.minX=Math.min(d.minX,u),d.minY=Math.min(d.minY,c),d.maxX=Math.max(d.maxX,h),d.maxY=Math.max(d.maxY,p),l.kind==="root"&&(d.label=Vx(l)??d.label)):n.set(l.sessionId,{minX:u,minY:c,maxX:h,maxY:p,label:Vx(l)??l.sessionId})}const r=new Map;for(const o of n.values())r.set(o.label,(r.get(o.label)??0)+1);const i=[];for(const[o,l]of n){const c=(r.get(l.label)??0)>1?`${l.label} · ${lL(o)}`:l.label;i.push({sessionId:o,label:c,x:l.minX-tu,y:l.minY-tu-Wx,w:l.maxX-l.minX+tu*2,h:l.maxY-l.minY+tu*2+Wx})}return i}function lL(e){const n=e.match(/[a-zA-Z0-9]{4}/);return n?n[0]:e.slice(0,4)}function Vx(e){if(e.kind==="root")return e.label}function uL(){const{x:e,y:n,zoom:r}=aC(),i=Ta(),o=Ke(oL,cL);if(o.length<=1)return null;const l=u=>{try{const c=i.getNodes().filter(h=>{const p=h.data;return(p==null?void 0:p.sessionId)===u});if(c.length===0)return;i.fitView({padding:.3,duration:500,nodes:c})}catch{}};return g.jsx("div",{className:"session-clusters",children:o.map(u=>{const c=ty(u.sessionId),h={position:"absolute",left:u.x*r+e,top:u.y*r+n,width:u.w*r,height:u.h*r,"--session-hue":c},p={position:"absolute",left:u.x*r+e+16*r,top:(u.y-iL)*r+n,transform:`scale(${Math.min(1,r)})`,transformOrigin:"left top","--session-hue":c};return g.jsxs(ue.Fragment,{children:[g.jsx("div",{className:"cluster-card",style:h,"aria-hidden":!0}),g.jsx("button",{type:"button",className:"cluster-label",style:p,title:`Fit view to ${u.label} · drag the wrapper to move the whole session`,onClick:()=>l(u.sessionId),children:u.label})]},u.sessionId)})})}function cL(e,n){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++){const i=e[r],o=n[r];if(i.sessionId!==o.sessionId||i.label!==o.label||i.x!==o.x||i.y!==o.y||i.w!==o.w||i.h!==o.h)return!1}return!0}function dL({data:e}){return g.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const ja={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"}},fL=Object.fromEntries(Object.entries(ja).map(([e,n])=>[e,n.category])),hL=Object.fromEntries(Object.entries(ja).map(([e,n])=>[e,n.emoji])),pL=Object.fromEntries(Object.entries(ja).map(([e,n])=>[e,n.label])),mL=new Set(Object.keys(ja)),gL=new Set(Object.entries(ja).filter(([,e])=>e.shell).map(([e])=>e)),vL={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",ScheduleWakeup:"other",CronCreate:"other",CronList:"other",CronDelete:"other",Monitor:"other",PushNotification:"other",RemoteTrigger:"other",ToolSearch:"other",...fL};function SC(e){return e.startsWith("mcp__")?"mcp":vL[e]??"other"}const yL=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,wL=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function xL(e){if(typeof e!="string"||!e)return null;const n=yL.exec(e);if(n){const i=_L(n[2]);if(i.trim())return i}const r=wL.exec(e);return r?r[1]:null}function _L(e){return e.replace(/\\(["'`\\nrt])/g,(n,r)=>r==="n"?`
64
+ `:r==="r"?"\r":r==="t"?" ":r)}const kC=600,bL=4,SL=36,Rv=16,kL=60,EL=6,Gx=220,Yx=96,NL=28,CL={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:"📡",...hL};function Kx(e){return e.startsWith("mcp__")?"🔌":CL[e]??"✨"}const TL={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 EC(e){if(!e)return null;let n=e.trim();if(!n)return null;const r=n.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(r)return EC(r[1]);for(;;){const l=n.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!l)break;n=n.slice(l[0].length)}n=n.replace(/^sudo(?:\s+-\S+)*\s+/,""),n=n.replace(/^(?:time|nohup|xargs)\s+/,"");const i=n.match(/^([^\s|;&<>(]+)/);if(!i)return null;let o=i[1];return o=o.replace(/^.*[/\\]/,""),o=o.replace(/\.(exe|cmd|bat|ps1)$/i,""),o||null}function RL(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const n=e;if(typeof n.script=="string"){const r=xL(n.script);if(r)return r}if(typeof n.cmd=="string")return n.cmd;if(typeof n.command=="string")return n.command;if(Array.isArray(n.command)&&n.command.every(r=>typeof r=="string")){const r=n.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(r[0]??"")){const i=r.findIndex(o=>/^(-Command|-c)$/i.test(o));if(i>=0&&i+1<r.length)return r[i+1]}return r.join(" ")}return typeof n.script=="string"?n.script:null}const jL=new Set(["Bash","PowerShell",...gL]),AL=mL;function IL(e,n){return AL.has(e)||e.startsWith("mcp__")?Math.max(Yx,34+n.length*7.5):Yx}function ML(e,n){if(!jL.has(e))return null;const r=RL(n);if(!r)return null;const i=EC(r);return i?{emoji:TL[i]??"⚙️",label:i,category:"shell",detail:r}:null}const OL=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),Xx={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:"🗄️"},Qx={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 PL(e){const r=e.replace(/\\/g,"/").replace(/\/+$/,""),i=r.lastIndexOf("/");return i>=0?r.slice(i+1):r}function LL(e){const n=e.toLowerCase();if(Qx[n])return Qx[n];if(n.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(n))return"🧪";const r=n.lastIndexOf(".");if(r>0&&r<n.length-1){const i=n.slice(r+1);if(Xx[i])return Xx[i]}return"📄"}function $L(e,n){if(!n||typeof n!="object")return null;const r=n;if(e==="apply_patch"&&typeof r.patch=="string"){const i=r.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return i?i[1].trim():null}return typeof r.file_path=="string"?r.file_path:typeof r.notebook_path=="string"?r.notebook_path:typeof r.path=="string"?r.path:e==="Glob"&&typeof r.pattern=="string"?r.pattern:null}function qL(e,n){if(!OL.has(e))return null;const r=$L(e,n);if(!r)return null;const i=PL(r);return i?{emoji:e==="LS"?"📂":LL(i),label:i,category:"file",detail:r}:null}const NC={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 CC(e){if(!e.startsWith("mcp__"))return null;const n=e.slice(5),r=n.indexOf("__");return r<=0?{server:n,method:""}:{server:n.slice(0,r),method:n.slice(r+2)}}function DL(e){let n=5381;for(let r=0;r<e.length;r++)n=(n<<5)+n^e.charCodeAt(r);return Math.abs(n)%360}function FL(e,n){const r=CC(e);if(!r)return null;const{server:i,method:o}=r;if(!o)return null;const l=NC[i.toLowerCase()];return{emoji:(l==null?void 0:l.emoji)??"🔌",label:o,category:"mcp",detail:l?`${l.name} · ${o}`:`${i} · ${o}`}}function zL(e,n){return ML(e,n)??qL(e,n)??FL(e)}const BL=pL;function UL(e){const n=CC(e);if(n){const i=NC[n.server.toLowerCase()];return i?{emoji:i.emoji,label:i.name}:{emoji:"🔌",label:n.server,hue:DL(n.server)}}const r=BL[e];return r?{emoji:Kx(e),label:r}:{emoji:Kx(e),label:e}}function HL(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function WL(e,n,r){if(r==null)return 1;const i=n-r;return i<0?1:Math.max(0,1-i/kC)}function VL(e,n){const r=[],i=new Set;for(let o=e.length-1;o>=0&&r.length<n;o--){const l=e[o];i.has(l.id)||(i.add(l.id),r.push(l))}return r.reverse()}function GL(e,n,r,i,o,l){const u=[];for(const c of e.values()){if(!n.has(c.id)||c.exitAt!=null&&l-c.exitAt>kC)continue;const h=i.get(c.id)??r.get(c.id);if(!h)continue;const p=VL(c.tools,bL);if(p.length===0)continue;const d=c.exitAt??null,m=o.get(c.id),y=Math.max((m==null?void 0:m.width)??Gx,Gx),w=(m==null?void 0:m.height)??130,N=h.x,_=h.y,b=N+y,S=_+w/2;p.forEach((k,E)=>{const T=E*SL,I=N+y+kL,O=_+EL+T,A=WL(k,l,d),U=k.inputPreview??"",z=HL(k),P=A<.999,D=UL(k.name);u.push({id:`${c.id}::${k.id}`,toolId:k.id,agentId:c.id,toolName:k.name,name:D.label,emoji:D.emoji,status:z,category:SC(k.name),mcpHue:D.hue,inputPreview:U,fade:A,fading:P,worldX:I,worldY:O,anchorX:b,anchorY:S,spawnDx:b-I,spawnDy:S-(O+Rv)});const V=zL(k.name,k.input);if(V){const B=IL(k.name,D.label),C=I+B+NL,q=O,L=I+B,re=O+Rv;u.push({id:`sub:${c.id}::${k.id}`,toolId:k.id,agentId:c.id,toolName:k.name,name:V.label,emoji:V.emoji,isSub:!0,status:z,category:V.category,inputPreview:V.detail??U,fade:A,fading:P,worldX:C,worldY:q,anchorX:L,anchorY:re,spawnDx:L-C,spawnDy:0})}})}return u}function YL({agents:e,visibleAgentIds:n,positions:r,pinned:i,measured:o,dimUnmatched:l,spotlight:u,hiddenCategories:c,now:h,onOpenTool:p}){const d=GL(e,n,r,i,o,h),m=c&&c.size>0?d.filter(y=>!c.has(y.category)):d;return g.jsx(KL,{bursts:m,dimUnmatched:l,spotlight:u,onOpenTool:p})}function KL({bursts:e,dimUnmatched:n,spotlight:r,onOpenTool:i}){const{x:o,y:l,zoom:u}=aC();return g.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[g.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const h=c.anchorX*u+o,p=c.anchorY*u+l,d=(c.worldX+6)*u+o,m=(c.worldY+Rv)*u+l,y=h+(d-h)*.55,w=n!=null&&!n.has(c.agentId),N=r!=null&&!r.has(c.agentId),_=c.fade*(w||N?.14:1);return g.jsx("path",{d:`M ${h} ${p} Q ${y} ${p}, ${d} ${m}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:_},`l:${c.id}`)})}),e.map(c=>{const h=c.worldX*u+o,p=c.worldY*u+l,d={left:`${h}px`,top:`${p}px`,transform:`scale(${u})`,transformOrigin:"left top","--spawn-dx":`${c.spawnDx}px`,"--spawn-dy":`${c.spawnDy}px`},m=c.isSub?`${c.toolName} · ${c.name}`:c.toolName,y=c.inputPreview?`${m} · ${c.inputPreview}`:m,w=i!=null,N=c.mcpHue!=null?{"--mcp-hue":c.mcpHue}:{},_=n!=null&&!n.has(c.agentId),b=r!=null&&!r.has(c.agentId),S=_||b?" dim":"";return g.jsx("div",{className:"tool-burst-wrap",style:d,children:g.jsxs("div",{className:`tool-burst cat-${c.category}${c.mcpHue!=null?" mcp-hue":""} status-${c.status}${c.fading?" fading":""}${w?" clickable":""}${c.isSub?" sub":""}${S}`,style:N,title:y,onClick:w?()=>i(c.toolId):void 0,children:[g.jsx("span",{className:"tb-emoji",children:c.emoji}),g.jsx("span",{className:"tb-name",children:c.name}),c.status==="inflight"&&g.jsx("span",{className:"tb-spin"}),c.status==="done"&&g.jsx("span",{className:"tb-mark done",children:"✓"}),c.status==="err"&&g.jsx("span",{className:"tb-mark err",children:"×"})]})},c.id)})]})}function XL({state:e,sessionId:n,onClose:r}){const i=j.useMemo(()=>ZL(e,n),[e,n]),o=j.useRef(null),l=mo(r,{focusRef:o});return i?g.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:g.jsxs("div",{ref:l,className:"modal session-summary",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[g.jsxs("div",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),g.jsx("span",{id:"ss-title",className:"modal-tool-name",title:i.cwd??i.sessionId,children:i.label}),g.jsxs("span",{className:"modal-tool-id",children:["· ",i.sessionId.slice(0,8)]})]}),g.jsxs("div",{className:"modal-actions",children:[g.jsx("span",{className:"modal-dur",title:"Total wall time",children:i.durationLabel}),g.jsx("button",{type:"button",ref:o,className:"btn",onClick:r,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),g.jsxs("div",{className:"modal-body",children:[g.jsxs("section",{className:"ss-hero",children:[g.jsxs("div",{className:"ss-hero-left",children:[g.jsx("div",{className:"ss-cost-label",children:"total spend"}),g.jsx("div",{className:"ss-cost",children:De(i.cost.total)}),i.modelChips.length>0&&g.jsx("div",{className:"ss-models",children:i.modelChips.map(u=>g.jsx("span",{className:"model-chip",title:u,children:Ns(u)},u))})]}),g.jsx("div",{className:"ss-hero-right",children:i.cost.total>0&&g.jsxs(g.Fragment,{children:[g.jsx(QL,{cost:i.cost}),g.jsxs("div",{className:"ss-cost-legend",children:[g.jsxs("span",{className:"ssl ssl-in",children:["input ",g.jsx("b",{children:De(i.cost.input)})]}),g.jsxs("span",{className:"ssl ssl-out",children:["output ",g.jsx("b",{children:De(i.cost.output)})]}),g.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",g.jsx("b",{children:De(i.cost.cacheRead)})]}),g.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",g.jsx("b",{children:De(i.cost.cacheWrite)})]})]})]})})]}),g.jsxs("section",{className:"ss-stats",children:[g.jsx(Zi,{label:"agents",value:i.agentCount}),g.jsx(Zi,{label:"subagents",value:i.subagentCount}),g.jsx(Zi,{label:"tool calls",value:i.toolCount}),g.jsx(Zi,{label:"prompts",value:i.promptCount}),g.jsx(Zi,{label:"tokens",value:i.tokensSum.toLocaleString()}),i.errCount>0&&g.jsx(Zi,{label:"errors",value:i.errCount,tone:"err"})]}),i.topTools.length>0&&g.jsxs("section",{className:"modal-section",children:[g.jsx("h4",{children:"Most-used tools"}),g.jsx("div",{className:"ss-top-tools",children:i.topTools.map(([u,c])=>g.jsxs("div",{className:"ss-tt",children:[g.jsx("span",{className:"ss-tt-name",children:u}),g.jsx("span",{className:"ss-tt-bar",children:g.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${c/i.topTools[0][1]*100}%`}})}),g.jsx("span",{className:"ss-tt-count",children:c})]},u))})]}),i.firstPrompt&&g.jsxs("section",{className:"modal-section",children:[g.jsx("h4",{children:"Opening prompt"}),g.jsx("div",{className:"ss-prompt",children:i.firstPrompt})]})]})]})}):null}function Zi({label:e,value:n,tone:r}){return g.jsxs("div",{className:`ss-stat${r?` tone-${r}`:""}`,children:[g.jsx("div",{className:"ss-stat-value",children:n}),g.jsx("div",{className:"ss-stat-label",children:e})]})}function QL({cost:e}){const n=e.total;if(n<=0)return null;const r=(i,o,l)=>{if(i<=0)return null;const u=i/n*100;return g.jsx("span",{className:`cb-seg ${o}`,style:{width:`${u}%`},title:`${l}: ${De(i)} (${u.toFixed(0)}%)`},o)};return g.jsxs("div",{className:"cost-bar cost-bar-lg",role:"img","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}function ZL(e,n){const r=e.agents.get(n);if(!r)return null;const i=[];for(const E of e.agents.values())E.sessionId===n&&i.push(E);if(i.length===0)return null;const o={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},l=new Set,u=new Map;let c=0,h=0,p=0,d=0,m=0,y,w=1/0,N=0;for(const E of i){const T=dn(E.usage,E.model);o.input+=T.input,o.output+=T.output,o.cacheRead+=T.cacheRead,o.cacheWrite+=T.cacheWrite,o.total+=T.total,E.model&&l.add(E.model),E.kind==="subagent"&&m++,h+=E.prompts.length,!y&&E.prompts.length>0&&(y=E.prompts[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,c+=E.toolCount,w=Math.min(w,E.startedAt),N=Math.max(N,E.endedAt??Date.now());for(const I of E.tools)u.set(I.name,(u.get(I.name)??0)+1),I.ok===!1&&d++}const _=Math.max(0,N-w),b=Math.floor(_/1e3),S=b<60?`${b}s`:b<3600?`${Math.floor(b/60)}m ${String(b%60).padStart(2,"0")}s`:`${Math.floor(b/3600)}h ${Math.floor(b%3600/60)}m`,k=Array.from(u.entries()).sort((E,T)=>T[1]-E[1]).slice(0,5);return{sessionId:n,label:r.label||r.cwdBasename||"session",cwd:r.cwd,durationLabel:S,cost:o,modelChips:Array.from(l),agentCount:i.length,subagentCount:m,toolCount:c,promptCount:h,tokensSum:p,errCount:d,topTools:k,firstPrompt:y}}function sy(e){return(e==null?void 0:e.kind)==="permission"}function JL(e){const n=[];for(const r of e)r.kind==="root"&&sy(r.waiting)&&n.push({id:r.id,label:r.label,waiting:r.waiting});return n.sort((r,i)=>r.waiting.since-i.waiting.since)}function e3(e){const n=new Set;for(const r of e)r.state==="active"&&n.add(r.sessionId);return n.size}function Zx(e){return e.waiting?sy(e.waiting)?0:1:e.state==="active"?2:3}function t3(e,n){const r=[];for(const i of e.agents.values()){if(i.kind!=="root")continue;let o=i.toolCount,l=dn(i.usage,i.model).total,u=i.endedAt??i.startedAt;for(const c of e.agents.values()){if(c.sessionId!==i.sessionId||c.kind==="root")continue;o+=c.toolCount,l+=dn(c.usage,c.model).total;const h=c.endedAt??c.startedAt;h>u&&(u=h)}r.push({sessionId:i.sessionId,label:i.label||i.cwdBasename||"session",cwdBasename:i.cwdBasename,state:i.state,waiting:i.waiting,modelId:i.model,toolCount:o,cost:l,startedAt:i.startedAt,lastActivity:u})}return r.sort((i,o)=>{const l=Zx(i),u=Zx(o);return l!==u?l-u:i.waiting&&o.waiting?i.waiting.since-o.waiting.since:o.lastActivity-i.lastActivity}),r}function Jx(e,n,r){const i=(n??r)-e;if(i<1e3)return"<1s";const o=Math.floor(i/1e3);if(o<60)return`${o}s`;const l=Math.floor(o/60);return l<60?`${l}m`:`${Math.floor(l/60)}h ${l%60}m`}function n3({state:e,now:n,selectedIds:r,onSelect:i,onClose:o}){const l=j.useMemo(()=>t3(e),[e,e.lastSeq,n]),u=l.filter(h=>h.state==="active").length,c=l.filter(h=>sy(h.waiting)).length;return g.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[g.jsxs("div",{className:"sl-header",children:[g.jsxs("h2",{children:["Sessions ",g.jsx("span",{className:"sl-count",children:l.length})]}),c>0&&g.jsxs("span",{className:"sl-waiting-count",children:[c," waiting"]}),u>0&&g.jsxs("span",{className:"sl-live-count",children:[u," live"]}),g.jsx("button",{className:"btn icon-btn sl-close",onClick:o,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),g.jsxs("div",{className:"sl-rows",children:[l.length===0&&g.jsx("div",{className:"sl-empty",children:"No sessions yet."}),l.map(h=>{const p=r.has(h.sessionId);return g.jsxs("button",{type:"button",className:`sl-row state-${h.state}${p?" selected":""}`,onClick:()=>i(h.sessionId),title:`Focus ${h.label}`,children:[g.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),g.jsx("span",{className:"vis-hidden",children:ry(h.state)}),g.jsxs("div",{className:"sl-row-body",children:[g.jsxs("div",{className:"sl-row-head",children:[g.jsx("span",{className:"sl-label",children:h.label}),h.modelId&&g.jsx("span",{className:"model-chip",title:h.modelId,children:Ns(h.modelId)})]}),g.jsxs("div",{className:"sl-row-meta",children:[g.jsxs("span",{title:"tool calls",children:[g.jsx("b",{children:h.toolCount})," tools"]}),h.cost>0&&g.jsx("span",{className:"sl-cost",title:"total spend",children:g.jsx("b",{children:De(h.cost)})}),h.waiting?g.jsxs("span",{className:"sl-waiting",title:`${Pu(h.waiting)}
65
+ Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`,children:["waiting ",Jx(h.waiting.since,void 0,n)]}):g.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:Jx(h.startedAt,h.state==="active"?void 0:h.lastActivity,n)})]})]})]},h.sessionId)})]})]})}const en="ccdeck";function qt(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:e<1e9?`${(e/1e6).toFixed(2)}M`:`${(e/1e9).toFixed(2)}B`}function e_(e,n){if(!e)return null;const r=n-Math.floor(e/1e3);return r<10?"just now":r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:`${Math.floor(r/3600)}h ago`}function r3(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 Ud="__unknown__";function s3({cost:e}){const n=e.total;if(n<=0)return null;const r=(i,o,l)=>{if(i<=0)return null;const u=i/n*100;return g.jsx("span",{className:`cb-seg ${o}`,style:{width:`${u}%`},title:`${l}: ${De(i)} (${u.toFixed(0)}%)`},o)};return g.jsxs("div",{className:"cost-bar",role:"img","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}function i3(e,n){const r=e-n;if(r<=0)return null;const i=Math.floor(r/3600),o=Math.floor(r%3600/60);if(i>23){const l=Math.floor(r/86400),u=Math.floor(r%86400/3600);return`${l}d ${u}h`}return i>0?`${i}h ${o}m`:`${o}m`}function o3(e,n,r,i){const o=Math.max(0,n-i),l=Math.max(0,r-o);if(l<120)return null;const u=Math.min(100,l/r*100),c=e-u;if(Math.abs(c)<3)return{label:"on pace",color:"var(--ok)",expectedPct:u,isDeficit:!1};if(c>0){const h=100-e,p=l>0?e/l:0,d=p>0?h/p:1/0,m={label:`${Math.round(c)}% ahead`,color:"var(--warn)",expectedPct:u,isDeficit:!0};if(d<o&&d<86400){const y=Math.floor(d/3600),w=Math.floor(d%3600/60);m.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return m}return{label:`${Math.round(-c)}% reserve`,color:"var(--ok)",expectedPct:u,isDeficit:!1}}function si({pct:e,label:n,reset:r,resetAt:i,windowSec:o,limitReached:l,nowSec:u}){const c=Math.min(100,Math.max(0,e)),p=l||c>=90?"var(--err)":c>=70?"var(--warn)":"var(--accent)",d=c===0?"< 1%":`${c}%`,m=c===0?2:c,y=i?i3(i,u):null,w=i&&o?o3(c,i,o,u):null;return g.jsxs("div",{className:"qb-row",children:[g.jsxs("div",{className:"qb-meta",children:[g.jsxs("span",{className:"qb-label",children:[n,l&&g.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),g.jsx("span",{className:"qb-pct",style:{color:p},children:d})]}),g.jsxs("div",{className:"qb-track",children:[g.jsx("div",{className:"qb-fill",style:{width:`${m}%`,background:p,opacity:c===0?.4:1}}),w&&g.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`})]}),g.jsxs("div",{className:"qb-reset-row",children:[y?g.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):r?g.jsxs("span",{className:"qb-reset",children:["resets ",r]}):null,w&&g.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const a3=6e4;function l3(e){const[n,r]=j.useState(null),[i,o]=j.useState(!1),l=j.useRef(null),u=async(h=!1)=>{h&&o(!0);try{const d=await fetch(h?"/api/quota?refresh=1":"/api/quota");d.ok&&r(await d.json())}catch{}finally{h&&o(!1)}};return j.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),a3),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{quota:n,loading:i,refresh:()=>{e&&u(!0)}}}function u3(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 TC=6e4;function c3(e){const[n,r]=j.useState(null),[i,o]=j.useState(!1),l=j.useRef(null),u=async(h=!1)=>{h&&o(!0);try{const d=await fetch(h?"/api/codex-quota?refresh=1":"/api/codex-quota");d.ok&&r(await d.json())}catch{}finally{h&&o(!1)}};return j.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),TC),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{data:n,loading:i,refresh:()=>{e&&u(!0)}}}function d3(e){const[n,r]=j.useState(null),i=j.useRef(null),o=async()=>{try{const l=await fetch("/api/codex-usage");l.ok&&r(await l.json())}catch{}};return j.useEffect(()=>{if(e)return o(),i.current=window.setInterval(o,TC),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:n}}function f3({state:e,now:n,providers:r,onClose:i}){var V,B;const{quota:o,loading:l,refresh:u}=l3(r.claude),{data:c,loading:h,refresh:p}=c3(r.codex),{data:d}=d3(r.codex),[m,y]=j.useState(()=>Math.floor(Date.now()/1e3));j.useEffect(()=>{const C=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(C)},[]);const{byModel:w,totalCost:N,totalTokens:_,burnRate:b}=j.useMemo(()=>{const C=new Map,q={total:0,input:0,output:0,cacheRead:0,cacheWrite:0};let L=0,re=0,J=0,H=0;for(const $ of e.agents.values()){const Q=$.model??Ud,ne=dn($.usage,$.model),oe=C.get(Q);oe?(oe.inputTokens+=$.usage.inputTokens,oe.outputTokens+=$.usage.outputTokens,oe.cacheReadTokens+=$.usage.cacheReadTokens,oe.cacheCreateTokens+=$.usage.cacheCreateTokens,oe.cost.total+=ne.total,oe.cost.input+=ne.input,oe.cost.output+=ne.output,oe.cost.cacheRead+=ne.cacheRead,oe.cost.cacheWrite+=ne.cacheWrite,oe.agentCount++):C.set(Q,{model:Q,inputTokens:$.usage.inputTokens,outputTokens:$.usage.outputTokens,cacheReadTokens:$.usage.cacheReadTokens,cacheCreateTokens:$.usage.cacheCreateTokens,cost:{...ne},agentCount:1,priced:fo($.model)!=null}),q.total+=ne.total,q.input+=ne.input,q.output+=ne.output,q.cacheRead+=ne.cacheRead,q.cacheWrite+=ne.cacheWrite,L+=$.usage.inputTokens,re+=$.usage.outputTokens,J+=$.usage.cacheReadTokens,H+=$.usage.cacheCreateTokens}const Z=Array.from(C.values()).sort(($,Q)=>Q.cost.total-$.cost.total||Q.inputTokens+Q.outputTokens-($.inputTokens+$.outputTokens));let M=0,G=0;for(const $ of e.agents.values()){if($.state!=="active")continue;const Q=dn($.usage,$.model);M+=Q.total,G=Math.max(G,(($.endedAt??n)-$.startedAt)/1e3)}const Y=G>0?ku(M,G):null;return{byModel:Z,totalCost:q,totalTokens:{in:L,out:re,cacheR:J,cacheC:H},burnRate:Y}},[e,e.lastSeq,n]),S=j.useMemo(()=>{const C=[],q=L=>fo(L.model)==null?L.usage.inputTokens+L.usage.outputTokens:0;for(const L of e.agents.values()){if(L.kind!=="root")continue;let re=dn(L.usage,L.model).total,J=L.usage.inputTokens,H=L.usage.outputTokens,Z=q(L);for(const M of e.agents.values())M.sessionId!==L.sessionId||M.kind==="root"||(re+=dn(M.usage,M.model).total,J+=M.usage.inputTokens,H+=M.usage.outputTokens,Z+=q(M));C.push({sessionId:L.sessionId,label:L.label||L.cwdBasename||"session",state:L.state,cost:re,inputTokens:J,outputTokens:H,unpricedTokens:Z})}return C.sort((L,re)=>re.cost-L.cost||re.inputTokens+re.outputTokens-(L.inputTokens+L.outputTokens)).slice(0,12)},[e,e.lastSeq]),k=N.total>0,E=_.in+_.out,T=w.filter(C=>C.cost.total>0||C.inputTokens+C.outputTokens>0),I=S.filter(C=>C.cost>0||C.inputTokens+C.outputTokens>0),O=T.some(C=>!C.priced),A=l||h,U=e_(o==null?void 0:o.fetchedAt,m),z=e_(c==null?void 0:c.fetchedAt,m),P=()=>{u(),p()},D=r.claude&&r.codex?"Refresh Claude + Codex quota":r.codex?"Refresh Codex quota":"Refresh Claude quota";return g.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[g.jsxs("div",{className:"up-header",children:[g.jsx("h2",{children:"Usage"}),b&&g.jsx("span",{className:"up-rate",children:b}),g.jsxs("div",{className:"up-header-right",children:[(r.claude||r.codex)&&g.jsx("button",{type:"button",className:"btn up-refresh-btn",onClick:P,disabled:A,"aria-label":D,title:D,children:A?"…":"↻"}),g.jsx("button",{type:"button",className:"btn icon-btn up-close",onClick:i,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),r.claude&&g.jsxs("section",{className:"up-section up-quota-section",children:[g.jsxs("h3",{className:"up-section-title",children:["Claude quota",U&&!l&&g.jsx("span",{className:"up-section-age",title:r3(o==null?void 0:o.source),children:U})]}),o!=null&&o.ok?g.jsxs("div",{className:"up-quota-bars",children:[o.session5hPct!=null&&g.jsx(si,{label:"5-hour window",pct:o.session5hPct,reset:o.session5hReset,resetAt:o.session5hResetAt,windowSec:o.session5hWindowSec,nowSec:m}),o.week7dPct!=null&&g.jsx(si,{label:"7-day window",pct:o.week7dPct,reset:o.week7dReset,resetAt:o.week7dResetAt,windowSec:o.week7dWindowSec,nowSec:m}),o.weekSonnetPct!=null&&g.jsx(si,{label:"Sonnet (7d)",pct:o.weekSonnetPct,nowSec:m}),o.weekOpusPct!=null&&g.jsx(si,{label:"Opus (7d)",pct:o.weekOpusPct,nowSec:m})]}):(o==null?void 0:o.ok)===!1?g.jsxs("div",{className:"up-quota-na",children:[g.jsx("span",{children:"Quota unavailable."}),g.jsxs("span",{className:"up-quota-hint",children:["Run ",g.jsx("code",{children:"/usage"})," in a claude session, then click ↻"]})]}):g.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),r.codex&&g.jsxs("section",{className:"up-section up-quota-section",children:[g.jsxs("h3",{className:"up-section-title",children:["Codex quota",(c==null?void 0:c.ok)&&c.planLabel&&g.jsx("span",{className:"up-plan-badge",children:c.planLabel}),z&&!h&&g.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:z})]}),c!=null&&c.ok?g.jsxs("div",{className:"up-quota-bars",children:[(V=c.windows)==null?void 0:V.map(C=>g.jsx(si,{label:C.label,pct:C.pct,reset:C.reset??void 0,resetAt:C.resetAt??void 0,windowSec:C.windowSec??void 0,limitReached:c.limitReached&&C.pct>=100,nowSec:m},C.id)),(B=c.extraWindows)==null?void 0:B.map(C=>g.jsx(si,{label:C.label,pct:C.pct,reset:C.reset??void 0,resetAt:C.resetAt??void 0,windowSec:C.windowSec??void 0,nowSec:m},C.id)),c.creditLimit&&g.jsx(si,{label:`spend cap · $${Math.round(c.creditLimit.used)} of $${Math.round(c.creditLimit.limit)}`,pct:c.creditLimit.usedPct,reset:c.creditLimit.reset??void 0,resetAt:c.creditLimit.resetAt??void 0,limitReached:c.spendControlReached,nowSec:m}),c.creditsBalance&&!c.creditsUnlimited&&g.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",c.creditsBalance,c.overageReached&&" · overage limit reached"]}),c.creditsUnlimited&&g.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),c.resetCredits&&c.resetCredits.availableCount>0&&g.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${en} only reports them`,children:[c.resetCredits.availableCount," rate-limit reset",c.resetCredits.availableCount!==1?"s":""," available",c.resetCredits.nextExpiryAt&&` · expires ${new Date(c.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),c.promo&&g.jsx("div",{className:"up-quota-sub",children:c.promo}),c.partial&&g.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(c==null?void 0:c.ok)===!1?g.jsxs("div",{className:"up-quota-na",children:[g.jsx("span",{children:"Quota unavailable."}),g.jsx("span",{className:"up-quota-hint",children:u3(c.reason)})]}):g.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(d==null?void 0:d.ok)&&d.window7d&&d.window7d.sessionCount>0&&g.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${d.window5h?`
66
+ last 5h: ${qt(d.window5h.totalTokens)} tokens · ${d.window5h.sessionCount} session${d.window5h.sessionCount!==1?"s":""}`:""}`,children:[qt(d.window7d.totalTokens)," tokens · ",d.window7d.sessionCount," session",d.window7d.sessionCount!==1?"s":""," (7d)"]})]}),E>0?g.jsxs(g.Fragment,{children:[k&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"up-total",children:[g.jsx("span",{className:"up-total-value",children:De(N.total)}),g.jsx("span",{className:"up-total-label",children:"total spend"})]}),g.jsx(s3,{cost:N})]}),g.jsxs("div",{className:"up-tokens-row",children:[g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"in"}),qt(_.in)]}),g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"out"}),qt(_.out)]}),_.cacheR>0&&g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"cache r"}),qt(_.cacheR)]}),_.cacheC>0&&g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"cache c"}),qt(_.cacheC)]})]}),T.length>0&&g.jsxs("section",{className:"up-section",children:[g.jsx("h3",{className:"up-section-title",children:"By model"}),g.jsxs("table",{className:"up-table",children:[g.jsx("thead",{children:g.jsxs("tr",{children:[g.jsx("th",{children:"Model"}),g.jsx("th",{children:"Tokens"}),g.jsx("th",{children:"Cost"})]})}),g.jsx("tbody",{children:T.map(C=>g.jsxs("tr",{children:[g.jsx("td",{className:"up-model-name",title:C.model===Ud?"no model reported yet":C.model,children:C.model===Ud?"unknown":Ns(C.model)}),g.jsx("td",{className:"up-num",children:qt(C.inputTokens+C.outputTokens)}),C.priced?g.jsx("td",{className:"up-num up-cost-val",children:De(C.cost.total)}):g.jsx("td",{className:"up-num up-unpriced",children:fu})]},C.model))})]})]}),I.length>0&&g.jsxs("section",{className:"up-section",children:[g.jsx("h3",{className:"up-section-title",children:"By session"}),g.jsx("div",{className:"up-sessions",children:I.map(C=>g.jsxs("div",{className:"up-session-row",children:[g.jsx("span",{className:`sl-dot state-${C.state}`,"aria-hidden":!0}),g.jsx("span",{className:"vis-hidden",children:ry(C.state)}),g.jsx("span",{className:"up-session-label",children:C.label}),g.jsx("span",{className:"up-session-tokens",children:qt(C.inputTokens+C.outputTokens)}),C.cost>0?g.jsxs("span",{className:"up-session-cost",title:C.unpricedTokens>0?`${qt(C.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[De(C.cost),C.unpricedTokens>0?"+":""]}):g.jsx("span",{className:"up-session-cost up-unpriced",children:fu})]},C.sessionId))})]}),O&&g.jsxs("div",{className:"up-hint",children:["“",fu,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):g.jsxs("div",{className:"up-empty",children:["No usage data yet.",g.jsx("br",{}),"Start a Claude Code or Codex session."]})]})}const t_=18,h3=1100,Ji=(e,n)=>{const r=Math.sin(e*12.9898+n*78.233)*43758.5453;return r-Math.floor(r)},p3=Array.from({length:t_},(e,n)=>{const r=-72+144*n/(t_-1)+(Ji(n,1)-.5)*9,i=(r-90)*(Math.PI/180),o=(54+32*Math.cos(r*Math.PI/180))*(.74+Ji(n,2)*.52);return{dx:Math.cos(i)*o,dy:Math.sin(i)*o,rot:(n%2?1:-1)*(100+Ji(n,3)*260),delay:Math.round(Ji(n,4)*90),dur:760+Math.round(Ji(n,5)*260),scale:.8+Ji(n,6)*.45,hue:n%4,round:n%3===0}});function n_({anchor:e,lifetimeMs:n=h3}){var l;const[r,i]=j.useState(null),o=typeof window<"u"&&((l=window.matchMedia)==null?void 0:l.call(window,"(prefers-reduced-motion: reduce)").matches);return j.useEffect(()=>{if(o)return;const u=e.current;if(!u)return;const c=u.getBoundingClientRect();i({x:c.left+c.width/2,y:c.top+c.height/2});const h=window.setTimeout(()=>i(null),n);return()=>window.clearTimeout(h)},[e,n,o]),o||!r?null:HI.createPortal(g.jsx("div",{className:"confetti",style:{left:`${r.x}px`,top:`${r.y}px`},"aria-hidden":!0,children:p3.map((u,c)=>g.jsx("span",{className:`confetti-bit${u.round?" round":""}`,"data-hue":u.hue,style:{"--dx":`${u.dx.toFixed(1)}px`,"--dy":`${u.dy.toFixed(1)}px`,"--rot":`${u.rot}deg`,"--s":u.scale.toFixed(2),animationDelay:`${u.delay}ms`,animationDuration:`${u.dur}ms, ${u.dur}ms`}},c))}),document.body)}const RC=new Set(["awaiting_url","awaiting_code","registering"]);function m3(e){return e!=null&&RC.has(e)}function jC(e){return e!=null&&e!=="done"&&!RC.has(e)}const g3="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",v3="the sign-in did not complete";function y3({state:e,serverError:n,localError:r}){const i=e==="idle";return{title:i?"Sign-in ended":"Sign-in failed",message:r||n||(i?g3:v3)}}const w3="done";function x3(){let e=!1;return{shouldAnnounce(n){return n!==w3?(e=!1,!1):e?!1:(e=!0,!0)}}}const r_={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 ccdeck1:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${en}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",bad_value:"an alias can only use letters, numbers, spaces, dots, dashes and underscores, up to 64 characters"},s_={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"},_3=`claude-swap could not read the login keychain — start ${en} from a Terminal window rather than a background service`;function jv(e,n){return(e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(ho(e))?_3:e!=null&&e.reason&&s_[e.reason]?s_[e.reason]:(e==null?void 0:e.reason)||n}function ho(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const i_={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",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"},b3="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 S3(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}function k3(e,n){return S3(ho(e))?b3:e!=null&&e.reason&&i_[e.reason]?i_[e.reason]:(e==null?void 0:e.reason)||n}function hu(e,n){return e!=null&&e.detail?e.detail:e!=null&&e.error&&jC(e.state)?e.error:e!=null&&e.reason&&r_[e.reason]?r_[e.reason]:e!=null&&e.error?e.error:(e==null?void 0:e.reason)||n}const E3=1500;async function nu(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Av=ue.forwardRef((e,n)=>g.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:n,children:[g.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),g.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));Av.displayName="SuccessMark";function N3({onClose:e,onChanged:n}){const[r,i]=j.useState("login"),[o,l]=j.useState(null),[u,c]=j.useState(""),[h,p]=j.useState(""),[d,m]=j.useState(!1),[y,w]=j.useState(null),[N,_]=j.useState(null),b=j.useRef(!1),S=j.useRef(null),k=j.useRef(null),E=j.useRef(null),T=j.useRef(null),I=j.useCallback(()=>{b.current&&nu({action:"login-cancel"}).catch(()=>{}),e()},[e]),O=mo(I,{focusRef:E}),A=j.useCallback(async()=>{m(!0),w(null),b.current=!0;const q=await nu({action:"login"}).catch(()=>null);if(m(!1),!(q!=null&&q.ok)){w(hu(q,"could not start the sign-in"));return}l(q)},[]);j.useEffect(()=>{if(!m3(o==null?void 0:o.state))return;const q=window.setInterval(async()=>{try{const L=await fetch("/api/claude-accounts/login");L.ok&&l(await L.json())}catch{}},E3);return()=>window.clearInterval(q)},[o]);const U=j.useRef(n);U.current=n;const z=j.useRef(x3());j.useEffect(()=>{var q;(o==null?void 0:o.state)==="awaiting_code"&&((q=S.current)==null||q.focus()),z.current.shouldAnnounce(o==null?void 0:o.state)&&U.current()},[o==null?void 0:o.state]),j.useEffect(()=>{var q;r==="paste"&&((q=k.current)==null||q.focus())},[r]);const P=j.useCallback(async()=>{var L;m(!0),w(null);const q=await nu({action:"login-code",code:u}).catch(()=>null);if(m(!1),!(q!=null&&q.ok)){w(hu(q,"the code was not accepted")),q!=null&&q.state&&l(q),(L=S.current)==null||L.select();return}c(""),l(q)},[u,o]),D=j.useCallback(async()=>{m(!0),w(null);const q=await nu({action:"import",blob:h}).catch(()=>null);if(m(!1),!(q!=null&&q.ok)){w(hu(q,"the import failed"));return}p(""),_({added:q.added===!0,num:q.num??null,email:q.email??null}),n()},[h,n]),V=(o==null?void 0:o.state)==="done"?o.account:null,B=jC(o==null?void 0:o.state)||!!(y&&b.current&&!d),C=y3({state:o==null?void 0:o.state,serverError:o==null?void 0:o.error,localError:y});return g.jsx("div",{className:"modal-backdrop",onClick:I,role:"presentation",children:g.jsxs("div",{ref:O,className:"modal aa-modal",onClick:q=>q.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[g.jsxs("header",{className:"modal-head",children:[g.jsx("div",{className:"modal-title",children:g.jsxs("span",{className:"aa-tabs",role:"tablist",children:[g.jsx("button",{type:"button",role:"tab","aria-selected":r==="login",className:`aa-tab${r==="login"?" on":""}`,onClick:()=>i("login"),children:"Sign in"}),g.jsx("button",{type:"button",role:"tab","aria-selected":r==="paste",className:`aa-tab${r==="paste"?" on":""}`,onClick:()=>i("paste"),children:"Paste a share"})]})}),g.jsx("div",{className:"modal-actions",children:g.jsx("button",{type:"button",className:"btn icon-btn",onClick:I,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),g.jsx("section",{className:"modal-body aa-body",children:r==="login"?V?g.jsxs("div",{className:"aa-done",children:[g.jsx(Av,{ref:T}),g.jsx(n_,{anchor:T}),g.jsx("h4",{children:V.added?`Account ${V.num} added`:"Credentials refreshed"}),g.jsxs("p",{className:"aa-note",children:[g.jsx("strong",{children:V.email}),V.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),g.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(o==null?void 0:o.state)==="awaiting_code"||(o==null?void 0:o.state)==="registering"?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"1 · Approve in the browser"}),g.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),g.jsx("a",{className:"aa-link",href:o.url??"#",target:"_blank",rel:"noreferrer noopener",children:o.url})]}),g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"2 · Paste the code it gives you"}),g.jsxs("div",{className:"aa-field",children:[g.jsx("input",{ref:S,type:"text",value:u,onChange:q=>c(q.target.value),onKeyDown:q=>{q.key==="Enter"&&u.trim()&&!d&&P()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:o.state==="registering"}),g.jsx("button",{type:"button",className:"btn primary",disabled:d||!u.trim()||o.state==="registering",onClick:P,children:o.state==="registering"?"registering…":"Continue"})]}),(y||o.error)&&g.jsx("p",{className:"aa-err",children:y??o.error}),g.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."})]})]}):B?g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:C.title}),g.jsx("p",{className:"aa-err",children:C.message}),g.jsx("button",{type:"button",className:"btn",onClick:()=>{b.current=!1,l(null),w(null),A()},children:"Try again"})]}):d||b.current?g.jsx("div",{className:"aa-step",children:g.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):g.jsxs("div",{className:"aa-step aa-primer",children:[g.jsx("h4",{children:"Sign in to Anthropic"}),g.jsx("p",{className:"aa-note",children:"Opens a browser tab where you approve the sign-in, then asks for the code it shows you. claude-swap records the account when it completes, and the account you are using now stays active."}),g.jsx("div",{className:"aa-actions",children:g.jsx("button",{type:"button",ref:E,className:"btn primary",onClick:A,disabled:d,children:"Open the sign-in page"})})]}):N?g.jsxs("div",{className:"aa-done",children:[g.jsx(Av,{ref:T}),N.added&&g.jsx(n_,{anchor:T}),g.jsx("h4",{children:N.added?`Account ${N.num} imported`:"Already here"}),g.jsx("p",{className:"aa-note",children:N.added?g.jsxs(g.Fragment,{children:[N.email?g.jsx("strong",{children:N.email}):"That account"," is in the rotation now. Nothing changed on the deck you copied it from."]}):"This deck already holds that account, so nothing changed."}),g.jsxs("div",{className:"aa-actions",children:[g.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),g.jsx("button",{type:"button",className:"btn",onClick:()=>_(null),children:"Import another"})]})]}):g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"Paste an account shared from another deck"}),g.jsxs("div",{className:"aa-field",children:[g.jsx("input",{ref:k,type:"text",value:h,onChange:q=>p(q.target.value),onKeyDown:q=>{q.key==="Enter"&&h.trim()&&!d&&D()},placeholder:"ccdeck1:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),g.jsx("button",{type:"button",className:"btn primary",disabled:d||!h.trim(),onClick:D,children:d?"importing…":"Import"})]}),y&&g.jsx("p",{className:"aa-err",children:y}),g.jsxs("p",{className:"aa-note",children:["Use ",g.jsx("strong",{children:"share"})," on an account in the other deck. A share carries a live login and expires ten minutes after it is made."]})]})})]})})}function C3(e,n){const r=new Set(e),i=e.length?Math.max(...e):0;return[...new Set([...e,i+1])].sort((o,l)=>o-l).map(o=>{const l=o===n?"here":r.has(o)?"swap":"free";return{slot:o,kind:l,label:l==="here"?`slot ${o}`:`slot ${o} · ${l}`}})}function T3(e,n,r){if(!(r!=null&&r.ok))return null;const i=Number.isInteger(r.to)?r.to:null;if(i==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const o=r.swapped===!0&&i!==n;return{menuFor:e.menuFor===n?i:o&&e.menuFor===i?n:e.menuFor,confirmRemove:null,shareFor:null,swapNote:o?{at:i,displaced:n}:null}}const R3=64;function j3(e,n){const r=e.trim();return{alias:r,commit:r!==(n??"").trim()}}const A3=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function o_(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function I3(e){const n=e.find(i=>!i.ok);if(!n)return null;const r=ho(n.body);return{text:jv(n.body,`the deck server answered ${n.status}`),...r?{raw:r}:{},reload:!0}}function a_(e,n){return n?e!=null&&e.reload&&e.text===n.text&&e.raw===n.raw?e:n:e!=null&&e.reload?null:e}const l_=15e3,M3=8e3,O3=1800,P3=3e4,L3=[70,80,85,90,95];function $3(e,n){const r=e-n;if(r<=0)return null;const i=Math.floor(r/86400),o=Math.floor(r%86400/3600),l=Math.floor(r%3600/60);return i>0?`${i}d ${o}h`:o>0?`${o}h ${l}m`:`${l}m`}function u_(e,n){const r=n-Math.floor(e/1e3);return r<60?"just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}function q3(e,n){if(!e)return"";const r=Math.floor(e/1e3)-n;return r<=0?" · due":r<60?` · next in ${r}s`:` · next in ${Math.round(r/60)}m`}function D3(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 F3({lane:e,nowSec:n}){const r=Math.min(100,Math.max(0,e.pct)),i=r>=90?"var(--err)":r>=70?"var(--warn)":"var(--accent)",o=e.resetAt?$3(e.resetAt,n):null;return g.jsxs("div",{className:"ap-lane",children:[g.jsx("span",{className:"ap-lane-label",children:e.label}),g.jsx("div",{className:"ap-lane-track",children:g.jsx("div",{className:"ap-lane-fill",style:{width:`${r===0?1.5:r}%`,background:i,opacity:r===0?.4:1}})}),g.jsxs("span",{className:"ap-lane-pct",style:{color:i},children:[r,"%"]}),g.jsx("span",{className:"ap-lane-reset",children:o?`resets ${o}`:""})]})}async function z3(e){var r;let n=!1;try{n=await Promise.race([((r=navigator.clipboard)==null?void 0:r.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(i=>window.setTimeout(()=>i(!1),500))])}catch{n=!1}if(n)return!0;try{const i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(i),i.select(),n=document.execCommand("copy"),i.remove()}catch{n=!1}return n}function B3(e,n){const r=Math.round(e/1e3)-n;return r<=0?{text:"expired",tone:"gone"}:r<60?{text:`expires in ${r}s`,tone:"soon"}:{text:`expires in ${Math.round(r/60)}m`,tone:"ok"}}function U3({onClose:e}){var ne,oe,fe;const[n,r]=j.useState(null),[i,o]=j.useState(null),[l,u]=j.useState(null),[c,h]=j.useState(!1),[p,d]=j.useState(null),[m,y]=j.useState(null),[w,N]=j.useState(()=>Math.floor(Date.now()/1e3)),_=j.useRef(null),[b,S]=j.useState(null),[k,E]=j.useState(!1),[T,I]=j.useState(""),[O,A]=j.useState(null),[U,z]=j.useState(null),[P,D]=j.useState(null),[V,B]=j.useState(!1),[C,q]=j.useState(null),L=j.useCallback(async(te=!1)=>{te&&h(!0);const ce=new AbortController,Ce=window.setTimeout(()=>ce.abort(),P3);try{const[ve,je]=await Promise.all([fetch(`/api/claude-accounts${te?"?refresh=1":""}`,{signal:ce.signal}),fetch("/api/cswap-auto",{signal:ce.signal})]);ve.ok&&r(await ve.json()),je.ok&&o(await je.json());const ye=I3([await o_(ve),await o_(je)]);y(ke=>a_(ke,ye))}catch{y(ve=>a_(ve,A3))}finally{window.clearTimeout(Ce),te&&h(!1)}},[]),re=j.useCallback(async(te,ce)=>{u(ce),y(null);try{const ve=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return ve!=null&&ve.ok||y({text:jv(ve,"command failed"),raw:ho(ve)}),ve}catch{return y({text:"server unreachable"}),null}finally{u(null)}},[]),J=j.useCallback(async(te,ce)=>{u(ce),y(null);try{const ve=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return ve!=null&&ve.ok||y({text:hu(ve,"command failed")}),ve}catch{return y({text:"server unreachable"}),null}finally{u(null)}},[]);j.useEffect(()=>(L(!0),_.current=window.setInterval(()=>L(!1),l_),()=>{_.current!=null&&window.clearInterval(_.current)}),[L]),j.useEffect(()=>{const te=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(te)},[]);const H=((ne=i==null?void 0:i.settings["autoswitch.threshold"])==null?void 0:ne.value)??"90",Z=(oe=n==null?void 0:n.accounts)==null?void 0:oe.find(te=>te.active),M=Z!=null&&Z.lanes.length?Math.max(...Z.lanes.map(te=>te.pct)):null,G=M!=null&&M>=Number(H)-15,Y=async te=>{d(te),y(null);try{const Ce=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:te})})).json().catch(()=>null);Ce!=null&&Ce.ok||y({text:jv(Ce,"the switch failed"),raw:ho(Ce)}),await L(!0)}catch{y({text:"server unreachable"})}finally{d(null)}},$=async(te,ce)=>{const{commit:Ce,alias:ve}=j3(T,ce);if(Ce){const je=await J({action:"alias",account:te,alias:ve},`alias-${te}`);if(await L(!0),!(je!=null&&je.ok))return;I(ve)}A(te),window.setTimeout(()=>A(je=>je===te?null:je),O3)},Q=async(te,ce)=>{const Ce=await J({action:"move",account:te,slot:ce},`move-${te}`),ve=T3({menuFor:b,shareFor:(P==null?void 0:P.num)??null},te,Ce);if(await L(!0),ve){S(ve.menuFor),z(ve.confirmRemove),ve.shareFor==null&&(D(null),B(!1)),q(ve.swapNote);const je=ve.swapNote;je&&window.setTimeout(()=>q(ye=>ye===je?null:ye),M3)}};return g.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[g.jsxs("div",{className:"ap-header",children:[g.jsx("h2",{children:"Accounts"}),g.jsxs("div",{className:"ap-header-right",children:[g.jsx("button",{type:"button",className:"btn ap-add",onClick:()=>E(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),g.jsx("button",{type:"button",className:"btn ap-refresh",onClick:()=>L(!0),disabled:c,"aria-label":"Reload accounts",title:"Reload from claude-swap",children:c?"…":"↻"}),g.jsx("button",{type:"button",className:"btn icon-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),n==null?m?g.jsxs("div",{className:"ap-empty",role:"alert",children:[g.jsx("span",{title:m.raw||void 0,children:m.text}),g.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",l_/1e3," seconds."]}),g.jsx("button",{type:"button",className:"ap-fix",disabled:c,onClick:()=>L(!0),children:c?"trying…":"try again"})]}):g.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?g.jsxs(g.Fragment,{children:[(fe=n.accounts)==null?void 0:fe.map(te=>g.jsxs("div",{className:`ap-account${te.active?" active":""}${te.disabled?" disabled":""}`,children:[g.jsxs("div",{className:"ap-account-head",children:[g.jsx("span",{className:"ap-num",children:te.num}),te.alias&&g.jsx("span",{className:"ap-alias",title:te.alias,children:te.alias}),g.jsx("span",{className:"ap-email",title:te.org??void 0,children:te.email}),g.jsx("button",{type:"button",className:`ap-more${b===te.num?" on":""}`,"aria-label":`Manage account ${te.num}`,"aria-expanded":b===te.num,"aria-controls":b===te.num?`ap-manage-${te.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{S(b===te.num?null:te.num),I(te.alias??""),z(null),D(null),B(!1),q(null),A(null)},children:"⋯"}),te.active?g.jsx("span",{className:"ap-badge-active",children:"● active"}):g.jsx("button",{type:"button",className:"btn ap-switch",disabled:p!=null||te.disabled,onClick:()=>Y(te.num),title:te.disabled?"Held out of rotation":`Switch to ${te.alias??te.email}`,children:p===te.num?"…":"switch"})]}),te.lanes.length>0?te.lanes.map(ce=>g.jsx(F3,{lane:ce,nowSec:w},ce.id)):g.jsx("div",{className:"ap-hint",children:"No usage recorded yet."}),g.jsxs("div",{className:"ap-meta",children:[te.error&&(()=>{const ce=D3(te.error);return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"ap-err",title:ce.hint,children:ce.text}),ce.fixable&&g.jsx("button",{type:"button",className:"ap-fix",onClick:()=>E(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),((i==null?void 0:i.enabled)||(i==null?void 0:i.external))&&!te.active&&g.jsx("button",{type:"button",className:"ap-rotate",disabled:l!=null,onClick:()=>re({action:"account",account:te.num,enabled:te.disabled},`rot-${te.num}`).then(()=>L(!0)),title:te.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:te.disabled?"held out":"in rotation"}),te.fetchedAt?g.jsxs("span",{className:`ap-age${te.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 ",u_(te.fetchedAt,w),q3(te.nextAt,w)]}):g.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),b===te.num&&g.jsxs("div",{className:"ap-manage",id:`ap-manage-${te.num}`,role:"group","aria-label":`Manage account ${te.num}`,children:[g.jsxs("div",{className:"ap-manage-name",children:[g.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${te.num}`,children:"Alias"}),g.jsx("input",{id:`ap-alias-${te.num}`,className:"ap-manage-input",type:"text",value:T,onChange:ce=>I(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"&&$(te.num,te.alias)},maxLength:R3,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,onClick:()=>$(te.num,te.alias),title:"A short name to show instead of the email",children:O===te.num?"saved":"save"})]}),g.jsxs("div",{className:"ap-manage-acts",children:[g.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${te.num}`,children:"Slot"}),g.jsx("span",{className:"ap-field",children:g.jsx("select",{id:`ap-slot-${te.num}`,value:String(te.num),disabled:l!=null,onChange:ce=>Q(te.num,Number(ce.target.value)),children:C3((n.accounts??[]).map(ce=>ce.num),te.num).map(ce=>g.jsx("option",{value:ce.slot,children:ce.label},ce.slot))})}),g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,title:`Copy this account to another ${en}. 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()=>{B(!1);const ce=await J({action:"share",account:te.num},`share-${te.num}`);ce!=null&&ce.ok&&D({num:te.num,blob:ce.blob,expiresAt:ce.expiresAt})},children:"share"}),g.jsx("button",{type:"button",className:`ap-manage-btn danger${U===te.num?" armed":""}`,disabled:l!=null,title:U===te.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(U!==te.num){z(te.num),window.setTimeout(()=>z(ce=>ce===te.num?null:ce),4e3);return}z(null),J({action:"remove",account:te.num},`rm-${te.num}`).then(()=>{S(null),L(!0)})},children:U===te.num?"confirm":"remove"})]}),(C==null?void 0:C.at)===te.num&&(()=>{var ve;const ce=(ve=n.accounts)==null?void 0:ve.find(je=>je.num===C.displaced),Ce=(ce==null?void 0:ce.alias)??(ce==null?void 0:ce.email)??"the account that was there";return g.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${C.at} was taken, so the two accounts traded places: ${Ce} now holds slot ${C.displaced}.`,children:["swapped with slot ",C.displaced]})})(),(P==null?void 0:P.num)===te.num&&(()=>{const ce=B3(P.expiresAt,w),Ce=ce.tone==="gone";return g.jsxs("div",{className:`ap-share${Ce?" expired":""}`,children:[g.jsx("code",{className:"ap-share-blob",children:P.blob}),g.jsxs("div",{className:"ap-share-foot",children:[g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,onClick:async()=>{if(Ce){B(!1);const ve=await J({action:"share",account:te.num},`share-${te.num}`);ve!=null&&ve.ok&&D({num:te.num,blob:ve.blob,expiresAt:ve.expiresAt});return}await z3(P.blob)&&(B(!0),window.setTimeout(()=>B(!1),1800))},children:Ce?"make a new share":V?"copied":"copy"}),g.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:[g.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",g.jsx("span",{className:`ap-share-expiry ${ce.tone}`,children:ce.text})]})]})]})})()]})]},te.num)),(i==null?void 0:i.ok)&&g.jsxs("div",{className:"ap-auto",children:[g.jsxs("div",{className:"ap-auto-head",children:[g.jsx("span",{className:"ap-auto-title",children:"Auto-switch"}),g.jsxs("span",{className:"ap-auto-ctl",children:[M!=null&&g.jsxs("span",{className:`ap-auto-now${G?" near":""}`,children:[Math.round(M),"%"]}),g.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:g.jsx("select",{"aria-label":"Switch threshold",value:H,disabled:l!=null,onChange:te=>re({action:"setting",key:"autoswitch.threshold",value:te.target.value},"threshold").then(()=>L(!0)),children:L3.map(te=>g.jsxs("option",{value:te,children:[te,"%"]},te))})}),g.jsxs("button",{type:"button",className:`ap-auto-state${i.enabled?" live":""}`,role:"switch","aria-checked":i.enabled,disabled:l!=null,onClick:()=>re({action:"enable",enabled:!i.enabled},"enable").then(()=>L(!0)),title:i.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[g.jsx("i",{className:i.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),i.enabled?"on":"off"]})]})]}),i.external&&g.jsxs("p",{className:"ap-auto-note",children:[g.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",g.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",i.enabled?" — this toggle takes over when you stop it.":"."]}),i.lastTick&&g.jsx("div",{className:"ap-auto-foot",children:g.jsxs("span",{className:"ap-auto-result",children:["checked ",u_(i.lastTick.at,w)]})})]}),m&&g.jsxs("div",{className:"ap-failure",role:"alert",children:[g.jsx("span",{className:"ap-failure-text",title:m.raw||void 0,children:m.text}),g.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>y(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),g.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:"Collected by claude-swap while this panel is open."})]}):g.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"claude-swap isn't installed."}),g.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),n.hint&&g.jsx("code",{className:"ap-cmd",children:n.hint}),g.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",g.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"No accounts added yet."}),g.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",g.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"Couldn't read the account store."}),g.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})}),k&&g.jsx(N3,{onClose:()=>E(!1),onChanged:()=>L(!0)})]})}const H3=3e4;function W3({bundle:e,running:n,lastTried:r}){return!n||e===n?!1:r!==n}function V3({bundle:e,running:n,pending:r,lastTried:i}){return n?W3({bundle:e,running:n,lastTried:i})?"reload":r==null||r&&r!==n?"wait":"confirm":"wait"}function G3(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function Y3({asked:e,reported:n}){return n?n!==e:!1}function K3(e){const n=e.thresholdMs??H3;return!e.enabled||e.kind!=="restart"||!e.canRestart?{idleSince:null,restart:!1}:e.busy?{idleSince:null,restart:!1}:e.idleSince==null?{idleSince:e.now,restart:!1}:e.now<e.idleSince?{idleSince:e.now,restart:!1}:{idleSince:e.idleSince,restart:e.now-e.idleSince>=n}}function X3({agentCount:e,onConfirm:n,onCancel:r}){const i=j.useRef(null),o=mo(r,{focusRef:i,layer:MP}),l=e===0?"This deletes the server's event log":`This removes ${e===1?"the one agent":`all ${e} agents`} on the canvas and deletes the server's event log`;return g.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:g.jsxs("div",{ref:o,className:"modal clear-confirm",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[g.jsxs("header",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:"status-dot err","aria-hidden":!0}),g.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),g.jsx("div",{className:"modal-actions",children:g.jsx("button",{type:"button",className:"btn icon-btn",onClick:r,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),g.jsxs("section",{className:"modal-body",children:[g.jsxs("p",{className:"modal-note",children:[l," — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone."]}),g.jsxs("div",{className:"cc-actions",children:[g.jsx("button",{type:"button",ref:i,className:"btn",onClick:r,children:"Cancel"}),g.jsx("button",{type:"button",className:"btn danger",onClick:n,children:"Clear everything"})]})]})]})})}function Q3(e,n){return e==="confirmation"?n.confirmOpen?"clear":"ignore":n.modalOpen||n.confirmOpen?"ignore":"confirm"}function Z3(e){return e.slice().sort((n,r)=>n.y-r.y||n.x-r.x)}function J3(e,n,r){var u;if(e.length===0)return null;const i=Z3(e),o=n?i.findIndex(c=>c.id===n):-1,l=o===-1?r===1?0:i.length-1:(o+r+i.length)%i.length;return((u=i[l])==null?void 0:u.id)??null}const e$=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function t$(e,n){return n==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:n,additive:e.shiftKey}:e$.has(e.key)?{kind:"node",nodeId:n}:{kind:"deck",nodeId:n}}const n$=new Set(["","BODY","HTML","#DOCUMENT"]);function r$(e){return!e||ny(e)?!1:!n$.has(String(e.tagName??"").toUpperCase())}function ru(e,n){if(n.size!==0)for(const r of Array.from(e.keys()))n.has(r)||e.delete(r)}function s$(e){const n=new Set;for(const r of e)n.add(r.id),n.add(`group:${r.sessionId}`);return n}function AC(e,n,r){return!n.has(e)||r.has(e)}function i$(e,n,r,i){return!n.has(e)&&AC(e,r,i)}function o$(e,n,r){const i={x:0,y:0};return n.set(e,i),r.add(e),i}function a$(e,n,r,i){r.set(e,n),i.delete(e)}const l$=40,u$=120;function c$(e,n){let r=null,i=0,o=Number.NEGATIVE_INFINITY;const l=()=>{r=null,o=n.now(),e()},u=()=>{r!=null&&(n.clearTimeout(r),r=null)},c=(h,p,d)=>{if(r!=null){if(i<=h)return;u()}const m=Math.min(d,Math.max(0,h-p));i=h,r=n.setTimeout(l,m)};return{live(h=l$){const p=n.now(),d=Math.max(o+h,p);if(d<=p){u(),l();return}c(d,p,h)},replay(h=u$){u(),i=n.now()+h,r=n.setTimeout(l,h)},flush(){u(),l()},cancel(){u()}}}function d$(){let e=!1,n=[];return{get paused(){return e},get size(){return n.length},accept(r){return e?(n.push(r),!1):!0},setPaused(r){if(e=r,r||n.length===0)return[];const i=n;return n=[],i}}}const f$="1",c_="agent-dag.schema",h$=["agent-dag.layout","agent-dag.viewport"];function IC(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function p$(e,n=f$){let r=null;try{r=e.getItem(c_)}catch{return[]}if(r===n)return[];const i=[];if(r!==null)for(const o of h$)try{e.getItem(o)!==null&&(e.removeItem(o),i.push(o))}catch{}try{e.setItem(c_,n)}catch{}return i}const MC="agent-dag.theme";function m$(e){return e==="light"?"light":"dark"}function g$(){return m$(IC(MC))}function v$({waiting:e,running:n}){return{title:e>0?`(${e}) ${en}`:en,icon:e>0?"waiting":n>0?"running":"idle"}}const Hd={waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Wd(e,n){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${n==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"/>`+(n==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const y$=Object.freeze({waiting:`data:image/svg+xml,${encodeURIComponent(Wd(Hd.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Wd(Hd.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Wd(Hd.idle,"idle"))}`}),w$="No sessions are waiting for you.";function x$(e){if(e.length===0)return"";const[n,...r]=e;if(r.length===0)return`${n.label} is waiting for your permission.`;const i=`${r.length} more session${r.length===1?"":"s"}`;return`${n.label} and ${i} are waiting for your permission.`}function _$(e,n){return n!==""?n:e===""?"":w$}function b$(){let e=0;return{begin(){const n=++e;return()=>n===e},cancel(){e++}}}function S$(e,n=new Date){return new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}function k$(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 su(e){const n=e.toLowerCase();return n.includes("opus")?"#c4b5fd":n.includes("sonnet")?"#7dd3fc":n.includes("haiku")?"#86efac":n.includes("gpt-5")||n.includes("gpt5")?"#fcd34d":n.includes("gpt")?"#fca5a5":n.includes("gemini")?"#a5b4fc":n.includes("codex")?"#fdba74":"#94a3b8"}const E$=[7,14,30,90];function N$(e){const[n,r]=j.useState(null),[i,o]=j.useState(!1),l=j.useRef(b$()).current,u=(c=!1)=>{const h=l.begin(),p=e;o(!0);const m=`/api/ccusage?since=${S$(p)}${c?"&refresh=1":""}`;fetch(m).then(y=>y.json()).then(y=>{h()&&r({range:p,resp:y})}).catch(()=>{h()&&r({range:p,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{h()&&o(!1)})};return j.useEffect(()=>(u(!1),()=>l.cancel()),[e]),{landed:n,loading:i,reload:()=>u(!0)}}function C$({onClose:e}){var T,I,O;const[n,r]=j.useState(30),[i,o]=j.useState(null),{landed:l,loading:u,reload:c}=N$(n),h=j.useRef(null),p=mo(e,{focusRef:h}),d=k$({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((T=l.resp.days)==null?void 0:T.length)??0}}),m=d.phase==="chart"?l.resp.days??[]:[],y=j.useMemo(()=>m.reduce((A,U)=>Math.max(A,U.totalCost),0),[m]),{totalCost:w,totalTok:N,inOut:_,cacheRead:b,modelCosts:S}=j.useMemo(()=>{let A=0,U=0,z=0,P=0;const D=new Map;for(const V of m){A+=V.totalCost,U+=V.totalTokens,z+=V.inputTokens+V.outputTokens,P+=V.cacheReadTokens;for(const B of V.modelBreakdowns)D.set(B.modelName,(D.get(B.modelName)??0)+B.cost)}return{totalCost:A,totalTok:U,inOut:z,cacheRead:P,modelCosts:D}},[m]),k=j.useMemo(()=>Array.from(S.entries()).sort((A,U)=>U[1]-A[1]),[S]),E=i?m.find(A=>A.period===i)??null:null;return g.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:g.jsxs("div",{ref:p,className:"uh-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[g.jsxs("header",{className:"uh-head",children:[g.jsxs("div",{className:"uh-titlewrap",children:[g.jsx("div",{className:"uh-title",children:"Usage history"}),g.jsx("div",{className:"uh-sub",children:"via ccusage · local Claude / Codex logs"})]}),g.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:E$.map(A=>g.jsxs("button",{type:"button","aria-pressed":n===A,className:`uh-range-btn${n===A?" on":""}`,onClick:()=>{r(A),o(null)},children:[A,"d"]},A))}),g.jsx("button",{className:"btn icon-btn uh-reload",onClick:c,disabled:u,title:"Re-run ccusage","aria-label":"Reload",children:u?"…":"↻"}),g.jsx("button",{ref:h,className:"uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),d.phase==="busy"?g.jsx("div",{className:"uh-status","aria-busy":"true",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}):d.phase==="error"?g.jsxs("div",{className:"uh-status uh-err",title:ho(l.resp)||void 0,children:[k3(l.resp,"ccusage did not report usage"),g.jsx("div",{children:g.jsx("button",{className:"btn uh-retry",onClick:c,disabled:u,children:u?"trying…":"Try again"})})]}):d.phase==="empty"?g.jsx("div",{className:`uh-status${d.stale?" uh-stale":""}`,"aria-busy":d.stale||void 0,children:"no usage in this range"}):g.jsxs("div",{className:d.stale?"uh-stale":void 0,"aria-busy":d.stale||void 0,children:[g.jsxs("div",{className:"uh-totals",children:[g.jsx(iu,{label:"total cost",val:De(w),accent:!0}),g.jsx(iu,{label:"tokens",val:qt(N)}),g.jsx(iu,{label:"input+output",val:qt(_)}),g.jsx(iu,{label:"cache reads",val:qt(b)})]}),g.jsx("div",{className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:m.map(A=>{const U=y>0?A.totalCost/y*100:0,z=A.period===i,P=`${A.period}, ${De(A.totalCost)}`;return g.jsxs("button",{className:`uh-bar-col${z?" sel":""}`,onClick:()=>o(z?null:A.period),"aria-pressed":z,"aria-label":P,title:`${A.period} · ${De(A.totalCost)}`,style:{flexBasis:`${100/m.length}%`},children:[g.jsx("div",{className:"uh-bar",style:{height:`${Math.max(U,A.totalCost>0?2:0)}%`},children:A.modelBreakdowns.slice().sort((D,V)=>V.cost-D.cost).map(D=>{const V=A.totalCost>0?D.cost/A.totalCost*100:0;return g.jsx("div",{className:"uh-bar-seg",style:{height:`${V}%`,background:su(D.modelName)}},D.modelName)})}),g.jsx("span",{className:"uh-bar-label",children:A.period.slice(5)})]},A.period)})}),g.jsx("div",{className:"uh-legend",children:k.map(([A,U])=>g.jsxs("span",{className:"uh-legend-item",children:[g.jsx("span",{className:"uh-legend-dot",style:{background:su(A)}}),Ns(A)," ",g.jsx("span",{className:"uh-legend-cost",children:De(U)})]},A))}),E&&g.jsxs("div",{className:"uh-detail",children:[g.jsxs("div",{className:"uh-detail-head",children:[g.jsx("span",{className:"uh-detail-date",children:E.period}),g.jsx("span",{className:"uh-detail-cost",children:De(E.totalCost)}),(O=(I=E.metadata)==null?void 0:I.agents)!=null&&O.length?g.jsx("span",{className:"uh-detail-agents",children:E.metadata.agents.join(" · ")}):null]}),g.jsxs("div",{className:"uh-detail-mini",children:[g.jsx(ou,{label:"input",val:qt(E.inputTokens)}),g.jsx(ou,{label:"output",val:qt(E.outputTokens)}),g.jsx(ou,{label:"cache write",val:qt(E.cacheCreationTokens)}),g.jsx(ou,{label:"cache read",val:qt(E.cacheReadTokens)})]}),g.jsx("div",{className:"uh-detail-models",children:E.modelBreakdowns.slice().sort((A,U)=>U.cost-A.cost).map(A=>{const U=E.totalCost>0?A.cost/E.totalCost*100:0;return g.jsxs("div",{className:"uh-model-row",children:[g.jsxs("span",{className:"uh-model-name",children:[g.jsx("span",{className:"uh-legend-dot",style:{background:su(A.modelName)}}),Ns(A.modelName)]}),g.jsx("span",{className:"uh-model-bar",children:g.jsx("span",{className:"uh-model-bar-fill",style:{width:`${U}%`,background:su(A.modelName)}})}),g.jsx("span",{className:"uh-model-cost",children:De(A.cost)})]},A.modelName)})})]})]})]})})}function iu({label:e,val:n,accent:r}){return g.jsxs("div",{className:"uh-stat",children:[g.jsx("span",{className:`uh-stat-val${r?" accent":""}`,children:n}),g.jsx("span",{className:"uh-stat-label",children:e})]})}function ou({label:e,val:n}){return g.jsxs("div",{className:"uh-ministat",children:[g.jsx("span",{className:"uh-ministat-val",children:n}),g.jsx("span",{className:"uh-ministat-label",children:e})]})}function iy(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 Vd,d_;function T$(){if(d_)return Vd;d_=1;function e(){this.__data__=[],this.size=0}return Vd=e,Vd}var Gd,f_;function go(){if(f_)return Gd;f_=1;function e(n,r){return n===r||n!==n&&r!==r}return Gd=e,Gd}var Yd,h_;function Lu(){if(h_)return Yd;h_=1;var e=go();function n(r,i){for(var o=r.length;o--;)if(e(r[o][0],i))return o;return-1}return Yd=n,Yd}var Kd,p_;function R$(){if(p_)return Kd;p_=1;var e=Lu(),n=Array.prototype,r=n.splice;function i(o){var l=this.__data__,u=e(l,o);if(u<0)return!1;var c=l.length-1;return u==c?l.pop():r.call(l,u,1),--this.size,!0}return Kd=i,Kd}var Xd,m_;function j$(){if(m_)return Xd;m_=1;var e=Lu();function n(r){var i=this.__data__,o=e(i,r);return o<0?void 0:i[o][1]}return Xd=n,Xd}var Qd,g_;function A$(){if(g_)return Qd;g_=1;var e=Lu();function n(r){return e(this.__data__,r)>-1}return Qd=n,Qd}var Zd,v_;function I$(){if(v_)return Zd;v_=1;var e=Lu();function n(r,i){var o=this.__data__,l=e(o,r);return l<0?(++this.size,o.push([r,i])):o[l][1]=i,this}return Zd=n,Zd}var Jd,y_;function $u(){if(y_)return Jd;y_=1;var e=T$(),n=R$(),r=j$(),i=A$(),o=I$();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,Jd=l,Jd}var ef,w_;function M$(){if(w_)return ef;w_=1;var e=$u();function n(){this.__data__=new e,this.size=0}return ef=n,ef}var tf,x_;function O$(){if(x_)return tf;x_=1;function e(n){var r=this.__data__,i=r.delete(n);return this.size=r.size,i}return tf=e,tf}var nf,__;function P$(){if(__)return nf;__=1;function e(n){return this.__data__.get(n)}return nf=e,nf}var rf,b_;function L$(){if(b_)return rf;b_=1;function e(n){return this.__data__.has(n)}return rf=e,rf}var sf,S_;function OC(){if(S_)return sf;S_=1;var e=typeof Ul=="object"&&Ul&&Ul.Object===Object&&Ul;return sf=e,sf}var of,k_;function sr(){if(k_)return of;k_=1;var e=OC(),n=typeof self=="object"&&self&&self.Object===Object&&self,r=e||n||Function("return this")();return of=r,of}var af,E_;function vo(){if(E_)return af;E_=1;var e=sr(),n=e.Symbol;return af=n,af}var lf,N_;function $$(){if(N_)return lf;N_=1;var e=vo(),n=Object.prototype,r=n.hasOwnProperty,i=n.toString,o=e?e.toStringTag:void 0;function l(u){var c=r.call(u,o),h=u[o];try{u[o]=void 0;var p=!0}catch{}var d=i.call(u);return p&&(c?u[o]=h:delete u[o]),d}return lf=l,lf}var uf,C_;function q$(){if(C_)return uf;C_=1;var e=Object.prototype,n=e.toString;function r(i){return n.call(i)}return uf=r,uf}var cf,T_;function fi(){if(T_)return cf;T_=1;var e=vo(),n=$$(),r=q$(),i="[object Null]",o="[object Undefined]",l=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?o:i:l&&l in Object(c)?n(c):r(c)}return cf=u,cf}var df,R_;function qn(){if(R_)return df;R_=1;function e(n){var r=typeof n;return n!=null&&(r=="object"||r=="function")}return df=e,df}var ff,j_;function Aa(){if(j_)return ff;j_=1;var e=fi(),n=qn(),r="[object AsyncFunction]",i="[object Function]",o="[object GeneratorFunction]",l="[object Proxy]";function u(c){if(!n(c))return!1;var h=e(c);return h==i||h==o||h==r||h==l}return ff=u,ff}var hf,A_;function D$(){if(A_)return hf;A_=1;var e=sr(),n=e["__core-js_shared__"];return hf=n,hf}var pf,I_;function F$(){if(I_)return pf;I_=1;var e=D$(),n=(function(){var i=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function r(i){return!!n&&n in i}return pf=r,pf}var mf,M_;function PC(){if(M_)return mf;M_=1;var e=Function.prototype,n=e.toString;function r(i){if(i!=null){try{return n.call(i)}catch{}try{return i+""}catch{}}return""}return mf=r,mf}var gf,O_;function z$(){if(O_)return gf;O_=1;var e=Aa(),n=F$(),r=qn(),i=PC(),o=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,h=u.toString,p=c.hasOwnProperty,d=RegExp("^"+h.call(p).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!r(y)||n(y))return!1;var w=e(y)?d:l;return w.test(i(y))}return gf=m,gf}var vf,P_;function B$(){if(P_)return vf;P_=1;function e(n,r){return n==null?void 0:n[r]}return vf=e,vf}var yf,L_;function hi(){if(L_)return yf;L_=1;var e=z$(),n=B$();function r(i,o){var l=n(i,o);return e(l)?l:void 0}return yf=r,yf}var wf,$_;function oy(){if($_)return wf;$_=1;var e=hi(),n=sr(),r=e(n,"Map");return wf=r,wf}var xf,q_;function qu(){if(q_)return xf;q_=1;var e=hi(),n=e(Object,"create");return xf=n,xf}var _f,D_;function U$(){if(D_)return _f;D_=1;var e=qu();function n(){this.__data__=e?e(null):{},this.size=0}return _f=n,_f}var bf,F_;function H$(){if(F_)return bf;F_=1;function e(n){var r=this.has(n)&&delete this.__data__[n];return this.size-=r?1:0,r}return bf=e,bf}var Sf,z_;function W$(){if(z_)return Sf;z_=1;var e=qu(),n="__lodash_hash_undefined__",r=Object.prototype,i=r.hasOwnProperty;function o(l){var u=this.__data__;if(e){var c=u[l];return c===n?void 0:c}return i.call(u,l)?u[l]:void 0}return Sf=o,Sf}var kf,B_;function V$(){if(B_)return kf;B_=1;var e=qu(),n=Object.prototype,r=n.hasOwnProperty;function i(o){var l=this.__data__;return e?l[o]!==void 0:r.call(l,o)}return kf=i,kf}var Ef,U_;function G$(){if(U_)return Ef;U_=1;var e=qu(),n="__lodash_hash_undefined__";function r(i,o){var l=this.__data__;return this.size+=this.has(i)?0:1,l[i]=e&&o===void 0?n:o,this}return Ef=r,Ef}var Nf,H_;function Y$(){if(H_)return Nf;H_=1;var e=U$(),n=H$(),r=W$(),i=V$(),o=G$();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,Nf=l,Nf}var Cf,W_;function K$(){if(W_)return Cf;W_=1;var e=Y$(),n=$u(),r=oy();function i(){this.size=0,this.__data__={hash:new e,map:new(r||n),string:new e}}return Cf=i,Cf}var Tf,V_;function X$(){if(V_)return Tf;V_=1;function e(n){var r=typeof n;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?n!=="__proto__":n===null}return Tf=e,Tf}var Rf,G_;function Du(){if(G_)return Rf;G_=1;var e=X$();function n(r,i){var o=r.__data__;return e(i)?o[typeof i=="string"?"string":"hash"]:o.map}return Rf=n,Rf}var jf,Y_;function Q$(){if(Y_)return jf;Y_=1;var e=Du();function n(r){var i=e(this,r).delete(r);return this.size-=i?1:0,i}return jf=n,jf}var Af,K_;function Z$(){if(K_)return Af;K_=1;var e=Du();function n(r){return e(this,r).get(r)}return Af=n,Af}var If,X_;function J$(){if(X_)return If;X_=1;var e=Du();function n(r){return e(this,r).has(r)}return If=n,If}var Mf,Q_;function eq(){if(Q_)return Mf;Q_=1;var e=Du();function n(r,i){var o=e(this,r),l=o.size;return o.set(r,i),this.size+=o.size==l?0:1,this}return Mf=n,Mf}var Of,Z_;function ay(){if(Z_)return Of;Z_=1;var e=K$(),n=Q$(),r=Z$(),i=J$(),o=eq();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,Of=l,Of}var Pf,J_;function tq(){if(J_)return Pf;J_=1;var e=$u(),n=oy(),r=ay(),i=200;function o(l,u){var c=this.__data__;if(c instanceof e){var h=c.__data__;if(!n||h.length<i-1)return h.push([l,u]),this.size=++c.size,this;c=this.__data__=new r(h)}return c.set(l,u),this.size=c.size,this}return Pf=o,Pf}var Lf,e1;function Fu(){if(e1)return Lf;e1=1;var e=$u(),n=M$(),r=O$(),i=P$(),o=L$(),l=tq();function u(c){var h=this.__data__=new e(c);this.size=h.size}return u.prototype.clear=n,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=l,Lf=u,Lf}var $f,t1;function ly(){if(t1)return $f;t1=1;function e(n,r){for(var i=-1,o=n==null?0:n.length;++i<o&&r(n[i],i,n)!==!1;);return n}return $f=e,$f}var qf,n1;function LC(){if(n1)return qf;n1=1;var e=hi(),n=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return qf=n,qf}var Df,r1;function zu(){if(r1)return Df;r1=1;var e=LC();function n(r,i,o){i=="__proto__"&&e?e(r,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[i]=o}return Df=n,Df}var Ff,s1;function Bu(){if(s1)return Ff;s1=1;var e=zu(),n=go(),r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c){var h=l[u];(!(i.call(l,u)&&n(h,c))||c===void 0&&!(u in l))&&e(l,u,c)}return Ff=o,Ff}var zf,i1;function Ia(){if(i1)return zf;i1=1;var e=Bu(),n=zu();function r(i,o,l,u){var c=!l;l||(l={});for(var h=-1,p=o.length;++h<p;){var d=o[h],m=u?u(l[d],i[d],d,l,i):void 0;m===void 0&&(m=i[d]),c?n(l,d,m):e(l,d,m)}return l}return zf=r,zf}var Bf,o1;function nq(){if(o1)return Bf;o1=1;function e(n,r){for(var i=-1,o=Array(n);++i<n;)o[i]=r(i);return o}return Bf=e,Bf}var Uf,a1;function mr(){if(a1)return Uf;a1=1;function e(n){return n!=null&&typeof n=="object"}return Uf=e,Uf}var Hf,l1;function rq(){if(l1)return Hf;l1=1;var e=fi(),n=mr(),r="[object Arguments]";function i(o){return n(o)&&e(o)==r}return Hf=i,Hf}var Wf,u1;function Ma(){if(u1)return Wf;u1=1;var e=rq(),n=mr(),r=Object.prototype,i=r.hasOwnProperty,o=r.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(u){return n(u)&&i.call(u,"callee")&&!o.call(u,"callee")};return Wf=l,Wf}var Vf,c1;function bt(){if(c1)return Vf;c1=1;var e=Array.isArray;return Vf=e,Vf}var ca={exports:{}},Gf,d1;function sq(){if(d1)return Gf;d1=1;function e(){return!1}return Gf=e,Gf}ca.exports;var f1;function yo(){return f1||(f1=1,(function(e,n){var r=sr(),i=sq(),o=n&&!n.nodeType&&n,l=o&&!0&&e&&!e.nodeType&&e,u=l&&l.exports===o,c=u?r.Buffer:void 0,h=c?c.isBuffer:void 0,p=h||i;e.exports=p})(ca,ca.exports)),ca.exports}var Yf,h1;function Uu(){if(h1)return Yf;h1=1;var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;function r(i,o){var l=typeof i;return o=o??e,!!o&&(l=="number"||l!="symbol"&&n.test(i))&&i>-1&&i%1==0&&i<o}return Yf=r,Yf}var Kf,p1;function uy(){if(p1)return Kf;p1=1;var e=9007199254740991;function n(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Kf=n,Kf}var Xf,m1;function iq(){if(m1)return Xf;m1=1;var e=fi(),n=uy(),r=mr(),i="[object Arguments]",o="[object Array]",l="[object Boolean]",u="[object Date]",c="[object Error]",h="[object Function]",p="[object Map]",d="[object Number]",m="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",_="[object WeakMap]",b="[object ArrayBuffer]",S="[object DataView]",k="[object Float32Array]",E="[object Float64Array]",T="[object Int8Array]",I="[object Int16Array]",O="[object Int32Array]",A="[object Uint8Array]",U="[object Uint8ClampedArray]",z="[object Uint16Array]",P="[object Uint32Array]",D={};D[k]=D[E]=D[T]=D[I]=D[O]=D[A]=D[U]=D[z]=D[P]=!0,D[i]=D[o]=D[b]=D[l]=D[S]=D[u]=D[c]=D[h]=D[p]=D[d]=D[m]=D[y]=D[w]=D[N]=D[_]=!1;function V(B){return r(B)&&n(B.length)&&!!D[e(B)]}return Xf=V,Xf}var Qf,g1;function Hu(){if(g1)return Qf;g1=1;function e(n){return function(r){return n(r)}}return Qf=e,Qf}var da={exports:{}};da.exports;var v1;function cy(){return v1||(v1=1,(function(e,n){var r=OC(),i=n&&!n.nodeType&&n,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l&&r.process,c=(function(){try{var h=o&&o.require&&o.require("util").types;return h||u&&u.binding&&u.binding("util")}catch{}})();e.exports=c})(da,da.exports)),da.exports}var Zf,y1;function Oa(){if(y1)return Zf;y1=1;var e=iq(),n=Hu(),r=cy(),i=r&&r.isTypedArray,o=i?n(i):e;return Zf=o,Zf}var Jf,w1;function $C(){if(w1)return Jf;w1=1;var e=nq(),n=Ma(),r=bt(),i=yo(),o=Uu(),l=Oa(),u=Object.prototype,c=u.hasOwnProperty;function h(p,d){var m=r(p),y=!m&&n(p),w=!m&&!y&&i(p),N=!m&&!y&&!w&&l(p),_=m||y||w||N,b=_?e(p.length,String):[],S=b.length;for(var k in p)(d||c.call(p,k))&&!(_&&(k=="length"||w&&(k=="offset"||k=="parent")||N&&(k=="buffer"||k=="byteLength"||k=="byteOffset")||o(k,S)))&&b.push(k);return b}return Jf=h,Jf}var eh,x1;function Wu(){if(x1)return eh;x1=1;var e=Object.prototype;function n(r){var i=r&&r.constructor,o=typeof i=="function"&&i.prototype||e;return r===o}return eh=n,eh}var th,_1;function qC(){if(_1)return th;_1=1;function e(n,r){return function(i){return n(r(i))}}return th=e,th}var nh,b1;function oq(){if(b1)return nh;b1=1;var e=qC(),n=e(Object.keys,Object);return nh=n,nh}var rh,S1;function dy(){if(S1)return rh;S1=1;var e=Wu(),n=oq(),r=Object.prototype,i=r.hasOwnProperty;function o(l){if(!e(l))return n(l);var u=[];for(var c in Object(l))i.call(l,c)&&c!="constructor"&&u.push(c);return u}return rh=o,rh}var sh,k1;function Ur(){if(k1)return sh;k1=1;var e=Aa(),n=uy();function r(i){return i!=null&&n(i.length)&&!e(i)}return sh=r,sh}var ih,E1;function Cs(){if(E1)return ih;E1=1;var e=$C(),n=dy(),r=Ur();function i(o){return r(o)?e(o):n(o)}return ih=i,ih}var oh,N1;function aq(){if(N1)return oh;N1=1;var e=Ia(),n=Cs();function r(i,o){return i&&e(o,n(o),i)}return oh=r,oh}var ah,C1;function lq(){if(C1)return ah;C1=1;function e(n){var r=[];if(n!=null)for(var i in Object(n))r.push(i);return r}return ah=e,ah}var lh,T1;function uq(){if(T1)return lh;T1=1;var e=qn(),n=Wu(),r=lq(),i=Object.prototype,o=i.hasOwnProperty;function l(u){if(!e(u))return r(u);var c=n(u),h=[];for(var p in u)p=="constructor"&&(c||!o.call(u,p))||h.push(p);return h}return lh=l,lh}var uh,R1;function pi(){if(R1)return uh;R1=1;var e=$C(),n=uq(),r=Ur();function i(o){return r(o)?e(o,!0):n(o)}return uh=i,uh}var ch,j1;function cq(){if(j1)return ch;j1=1;var e=Ia(),n=pi();function r(i,o){return i&&e(o,n(o),i)}return ch=r,ch}var fa={exports:{}};fa.exports;var A1;function DC(){return A1||(A1=1,(function(e,n){var r=sr(),i=n&&!n.nodeType&&n,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l?r.Buffer:void 0,c=u?u.allocUnsafe:void 0;function h(p,d){if(d)return p.slice();var m=p.length,y=c?c(m):new p.constructor(m);return p.copy(y),y}e.exports=h})(fa,fa.exports)),fa.exports}var dh,I1;function FC(){if(I1)return dh;I1=1;function e(n,r){var i=-1,o=n.length;for(r||(r=Array(o));++i<o;)r[i]=n[i];return r}return dh=e,dh}var fh,M1;function zC(){if(M1)return fh;M1=1;function e(n,r){for(var i=-1,o=n==null?0:n.length,l=0,u=[];++i<o;){var c=n[i];r(c,i,n)&&(u[l++]=c)}return u}return fh=e,fh}var hh,O1;function BC(){if(O1)return hh;O1=1;function e(){return[]}return hh=e,hh}var ph,P1;function fy(){if(P1)return ph;P1=1;var e=zC(),n=BC(),r=Object.prototype,i=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,l=o?function(u){return u==null?[]:(u=Object(u),e(o(u),function(c){return i.call(u,c)}))}:n;return ph=l,ph}var mh,L1;function dq(){if(L1)return mh;L1=1;var e=Ia(),n=fy();function r(i,o){return e(i,n(i),o)}return mh=r,mh}var gh,$1;function hy(){if($1)return gh;$1=1;function e(n,r){for(var i=-1,o=r.length,l=n.length;++i<o;)n[l+i]=r[i];return n}return gh=e,gh}var vh,q1;function Vu(){if(q1)return vh;q1=1;var e=qC(),n=e(Object.getPrototypeOf,Object);return vh=n,vh}var yh,D1;function UC(){if(D1)return yh;D1=1;var e=hy(),n=Vu(),r=fy(),i=BC(),o=Object.getOwnPropertySymbols,l=o?function(u){for(var c=[];u;)e(c,r(u)),u=n(u);return c}:i;return yh=l,yh}var wh,F1;function fq(){if(F1)return wh;F1=1;var e=Ia(),n=UC();function r(i,o){return e(i,n(i),o)}return wh=r,wh}var xh,z1;function HC(){if(z1)return xh;z1=1;var e=hy(),n=bt();function r(i,o,l){var u=o(i);return n(i)?u:e(u,l(i))}return xh=r,xh}var _h,B1;function WC(){if(B1)return _h;B1=1;var e=HC(),n=fy(),r=Cs();function i(o){return e(o,r,n)}return _h=i,_h}var bh,U1;function hq(){if(U1)return bh;U1=1;var e=HC(),n=UC(),r=pi();function i(o){return e(o,r,n)}return bh=i,bh}var Sh,H1;function pq(){if(H1)return Sh;H1=1;var e=hi(),n=sr(),r=e(n,"DataView");return Sh=r,Sh}var kh,W1;function mq(){if(W1)return kh;W1=1;var e=hi(),n=sr(),r=e(n,"Promise");return kh=r,kh}var Eh,V1;function VC(){if(V1)return Eh;V1=1;var e=hi(),n=sr(),r=e(n,"Set");return Eh=r,Eh}var Nh,G1;function gq(){if(G1)return Nh;G1=1;var e=hi(),n=sr(),r=e(n,"WeakMap");return Nh=r,Nh}var Ch,Y1;function wo(){if(Y1)return Ch;Y1=1;var e=pq(),n=oy(),r=mq(),i=VC(),o=gq(),l=fi(),u=PC(),c="[object Map]",h="[object Object]",p="[object Promise]",d="[object Set]",m="[object WeakMap]",y="[object DataView]",w=u(e),N=u(n),_=u(r),b=u(i),S=u(o),k=l;return(e&&k(new e(new ArrayBuffer(1)))!=y||n&&k(new n)!=c||r&&k(r.resolve())!=p||i&&k(new i)!=d||o&&k(new o)!=m)&&(k=function(E){var T=l(E),I=T==h?E.constructor:void 0,O=I?u(I):"";if(O)switch(O){case w:return y;case N:return c;case _:return p;case b:return d;case S:return m}return T}),Ch=k,Ch}var Th,K1;function vq(){if(K1)return Th;K1=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i){var o=i.length,l=new i.constructor(o);return o&&typeof i[0]=="string"&&n.call(i,"index")&&(l.index=i.index,l.input=i.input),l}return Th=r,Th}var Rh,X1;function GC(){if(X1)return Rh;X1=1;var e=sr(),n=e.Uint8Array;return Rh=n,Rh}var jh,Q1;function py(){if(Q1)return jh;Q1=1;var e=GC();function n(r){var i=new r.constructor(r.byteLength);return new e(i).set(new e(r)),i}return jh=n,jh}var Ah,Z1;function yq(){if(Z1)return Ah;Z1=1;var e=py();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return Ah=n,Ah}var Ih,J1;function wq(){if(J1)return Ih;J1=1;var e=/\w*$/;function n(r){var i=new r.constructor(r.source,e.exec(r));return i.lastIndex=r.lastIndex,i}return Ih=n,Ih}var Mh,eb;function xq(){if(eb)return Mh;eb=1;var e=vo(),n=e?e.prototype:void 0,r=n?n.valueOf:void 0;function i(o){return r?Object(r.call(o)):{}}return Mh=i,Mh}var Oh,tb;function YC(){if(tb)return Oh;tb=1;var e=py();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return Oh=n,Oh}var Ph,nb;function _q(){if(nb)return Ph;nb=1;var e=py(),n=yq(),r=wq(),i=xq(),o=YC(),l="[object Boolean]",u="[object Date]",c="[object Map]",h="[object Number]",p="[object RegExp]",d="[object Set]",m="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",b="[object Float64Array]",S="[object Int8Array]",k="[object Int16Array]",E="[object Int32Array]",T="[object Uint8Array]",I="[object Uint8ClampedArray]",O="[object Uint16Array]",A="[object Uint32Array]";function U(z,P,D){var V=z.constructor;switch(P){case w:return e(z);case l:case u:return new V(+z);case N:return n(z,D);case _:case b:case S:case k:case E:case T:case I:case O:case A:return o(z,D);case c:return new V;case h:case m:return new V(z);case p:return r(z);case d:return new V;case y:return i(z)}}return Ph=U,Ph}var Lh,rb;function KC(){if(rb)return Lh;rb=1;var e=qn(),n=Object.create,r=(function(){function i(){}return function(o){if(!e(o))return{};if(n)return n(o);i.prototype=o;var l=new i;return i.prototype=void 0,l}})();return Lh=r,Lh}var $h,sb;function XC(){if(sb)return $h;sb=1;var e=KC(),n=Vu(),r=Wu();function i(o){return typeof o.constructor=="function"&&!r(o)?e(n(o)):{}}return $h=i,$h}var qh,ib;function bq(){if(ib)return qh;ib=1;var e=wo(),n=mr(),r="[object Map]";function i(o){return n(o)&&e(o)==r}return qh=i,qh}var Dh,ob;function Sq(){if(ob)return Dh;ob=1;var e=bq(),n=Hu(),r=cy(),i=r&&r.isMap,o=i?n(i):e;return Dh=o,Dh}var Fh,ab;function kq(){if(ab)return Fh;ab=1;var e=wo(),n=mr(),r="[object Set]";function i(o){return n(o)&&e(o)==r}return Fh=i,Fh}var zh,lb;function Eq(){if(lb)return zh;lb=1;var e=kq(),n=Hu(),r=cy(),i=r&&r.isSet,o=i?n(i):e;return zh=o,zh}var Bh,ub;function QC(){if(ub)return Bh;ub=1;var e=Fu(),n=ly(),r=Bu(),i=aq(),o=cq(),l=DC(),u=FC(),c=dq(),h=fq(),p=WC(),d=hq(),m=wo(),y=vq(),w=_q(),N=XC(),_=bt(),b=yo(),S=Sq(),k=qn(),E=Eq(),T=Cs(),I=pi(),O=1,A=2,U=4,z="[object Arguments]",P="[object Array]",D="[object Boolean]",V="[object Date]",B="[object Error]",C="[object Function]",q="[object GeneratorFunction]",L="[object Map]",re="[object Number]",J="[object Object]",H="[object RegExp]",Z="[object Set]",M="[object String]",G="[object Symbol]",Y="[object WeakMap]",$="[object ArrayBuffer]",Q="[object DataView]",ne="[object Float32Array]",oe="[object Float64Array]",fe="[object Int8Array]",te="[object Int16Array]",ce="[object Int32Array]",Ce="[object Uint8Array]",ve="[object Uint8ClampedArray]",je="[object Uint16Array]",ye="[object Uint32Array]",ke={};ke[z]=ke[P]=ke[$]=ke[Q]=ke[D]=ke[V]=ke[ne]=ke[oe]=ke[fe]=ke[te]=ke[ce]=ke[L]=ke[re]=ke[J]=ke[H]=ke[Z]=ke[M]=ke[G]=ke[Ce]=ke[ve]=ke[je]=ke[ye]=!0,ke[B]=ke[C]=ke[Y]=!1;function Ye(we,_e,Be,it,pt,Ze){var Fe,Je=_e&O,Xe=_e&A,Mt=_e&U;if(Be&&(Fe=pt?Be(we,it,pt,Ze):Be(we)),Fe!==void 0)return Fe;if(!k(we))return we;var ut=_(we);if(ut){if(Fe=y(we),!Je)return u(we,Fe)}else{var Qe=m(we),Ot=Qe==C||Qe==q;if(b(we))return l(we,Je);if(Qe==J||Qe==z||Ot&&!pt){if(Fe=Xe||Ot?{}:N(we),!Je)return Xe?h(we,o(Fe,we)):c(we,i(Fe,we))}else{if(!ke[Qe])return pt?we:{};Fe=w(we,Qe,Je)}}Ze||(Ze=new e);var Ft=Ze.get(we);if(Ft)return Ft;Ze.set(we,Fe),E(we)?we.forEach(function(mt){Fe.add(Ye(mt,_e,Be,mt,we,Ze))}):S(we)&&we.forEach(function(mt,wt){Fe.set(wt,Ye(mt,_e,Be,wt,we,Ze))});var et=Mt?Xe?d:p:Xe?I:T,St=ut?void 0:et(we);return n(St||we,function(mt,wt){St&&(wt=mt,mt=we[wt]),r(Fe,wt,Ye(mt,_e,Be,wt,we,Ze))}),Fe}return Bh=Ye,Bh}var Uh,cb;function Nq(){if(cb)return Uh;cb=1;var e=QC(),n=4;function r(i){return e(i,n)}return Uh=r,Uh}var Hh,db;function my(){if(db)return Hh;db=1;function e(n){return function(){return n}}return Hh=e,Hh}var Wh,fb;function Cq(){if(fb)return Wh;fb=1;function e(n){return function(r,i,o){for(var l=-1,u=Object(r),c=o(r),h=c.length;h--;){var p=c[n?h:++l];if(i(u[p],p,u)===!1)break}return r}}return Wh=e,Wh}var Vh,hb;function gy(){if(hb)return Vh;hb=1;var e=Cq(),n=e();return Vh=n,Vh}var Gh,pb;function vy(){if(pb)return Gh;pb=1;var e=gy(),n=Cs();function r(i,o){return i&&e(i,o,n)}return Gh=r,Gh}var Yh,mb;function Tq(){if(mb)return Yh;mb=1;var e=Ur();function n(r,i){return function(o,l){if(o==null)return o;if(!e(o))return r(o,l);for(var u=o.length,c=i?u:-1,h=Object(o);(i?c--:++c<u)&&l(h[c],c,h)!==!1;);return o}}return Yh=n,Yh}var Kh,gb;function Gu(){if(gb)return Kh;gb=1;var e=vy(),n=Tq(),r=n(e);return Kh=r,Kh}var Xh,vb;function mi(){if(vb)return Xh;vb=1;function e(n){return n}return Xh=e,Xh}var Qh,yb;function ZC(){if(yb)return Qh;yb=1;var e=mi();function n(r){return typeof r=="function"?r:e}return Qh=n,Qh}var Zh,wb;function JC(){if(wb)return Zh;wb=1;var e=ly(),n=Gu(),r=ZC(),i=bt();function o(l,u){var c=i(l)?e:n;return c(l,r(u))}return Zh=o,Zh}var Jh,xb;function eT(){return xb||(xb=1,Jh=JC()),Jh}var ep,_b;function Rq(){if(_b)return ep;_b=1;var e=Gu();function n(r,i){var o=[];return e(r,function(l,u,c){i(l,u,c)&&o.push(l)}),o}return ep=n,ep}var tp,bb;function jq(){if(bb)return tp;bb=1;var e="__lodash_hash_undefined__";function n(r){return this.__data__.set(r,e),this}return tp=n,tp}var np,Sb;function Aq(){if(Sb)return np;Sb=1;function e(n){return this.__data__.has(n)}return np=e,np}var rp,kb;function tT(){if(kb)return rp;kb=1;var e=ay(),n=jq(),r=Aq();function i(o){var l=-1,u=o==null?0:o.length;for(this.__data__=new e;++l<u;)this.add(o[l])}return i.prototype.add=i.prototype.push=n,i.prototype.has=r,rp=i,rp}var sp,Eb;function Iq(){if(Eb)return sp;Eb=1;function e(n,r){for(var i=-1,o=n==null?0:n.length;++i<o;)if(r(n[i],i,n))return!0;return!1}return sp=e,sp}var ip,Nb;function nT(){if(Nb)return ip;Nb=1;function e(n,r){return n.has(r)}return ip=e,ip}var op,Cb;function rT(){if(Cb)return op;Cb=1;var e=tT(),n=Iq(),r=nT(),i=1,o=2;function l(u,c,h,p,d,m){var y=h&i,w=u.length,N=c.length;if(w!=N&&!(y&&N>w))return!1;var _=m.get(u),b=m.get(c);if(_&&b)return _==c&&b==u;var S=-1,k=!0,E=h&o?new e:void 0;for(m.set(u,c),m.set(c,u);++S<w;){var T=u[S],I=c[S];if(p)var O=y?p(I,T,S,c,u,m):p(T,I,S,u,c,m);if(O!==void 0){if(O)continue;k=!1;break}if(E){if(!n(c,function(A,U){if(!r(E,U)&&(T===A||d(T,A,h,p,m)))return E.push(U)})){k=!1;break}}else if(!(T===I||d(T,I,h,p,m))){k=!1;break}}return m.delete(u),m.delete(c),k}return op=l,op}var ap,Tb;function Mq(){if(Tb)return ap;Tb=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o,l){i[++r]=[l,o]}),i}return ap=e,ap}var lp,Rb;function yy(){if(Rb)return lp;Rb=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o){i[++r]=o}),i}return lp=e,lp}var up,jb;function Oq(){if(jb)return up;jb=1;var e=vo(),n=GC(),r=go(),i=rT(),o=Mq(),l=yy(),u=1,c=2,h="[object Boolean]",p="[object Date]",d="[object Error]",m="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",_="[object String]",b="[object Symbol]",S="[object ArrayBuffer]",k="[object DataView]",E=e?e.prototype:void 0,T=E?E.valueOf:void 0;function I(O,A,U,z,P,D,V){switch(U){case k:if(O.byteLength!=A.byteLength||O.byteOffset!=A.byteOffset)return!1;O=O.buffer,A=A.buffer;case S:return!(O.byteLength!=A.byteLength||!D(new n(O),new n(A)));case h:case p:case y:return r(+O,+A);case d:return O.name==A.name&&O.message==A.message;case w:case _:return O==A+"";case m:var B=o;case N:var C=z&u;if(B||(B=l),O.size!=A.size&&!C)return!1;var q=V.get(O);if(q)return q==A;z|=c,V.set(O,A);var L=i(B(O),B(A),z,P,D,V);return V.delete(O),L;case b:if(T)return T.call(O)==T.call(A)}return!1}return up=I,up}var cp,Ab;function Pq(){if(Ab)return cp;Ab=1;var e=WC(),n=1,r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c,h,p,d){var m=c&n,y=e(l),w=y.length,N=e(u),_=N.length;if(w!=_&&!m)return!1;for(var b=w;b--;){var S=y[b];if(!(m?S in u:i.call(u,S)))return!1}var k=d.get(l),E=d.get(u);if(k&&E)return k==u&&E==l;var T=!0;d.set(l,u),d.set(u,l);for(var I=m;++b<w;){S=y[b];var O=l[S],A=u[S];if(h)var U=m?h(A,O,S,u,l,d):h(O,A,S,l,u,d);if(!(U===void 0?O===A||p(O,A,c,h,d):U)){T=!1;break}I||(I=S=="constructor")}if(T&&!I){var z=l.constructor,P=u.constructor;z!=P&&"constructor"in l&&"constructor"in u&&!(typeof z=="function"&&z instanceof z&&typeof P=="function"&&P instanceof P)&&(T=!1)}return d.delete(l),d.delete(u),T}return cp=o,cp}var dp,Ib;function Lq(){if(Ib)return dp;Ib=1;var e=Fu(),n=rT(),r=Oq(),i=Pq(),o=wo(),l=bt(),u=yo(),c=Oa(),h=1,p="[object Arguments]",d="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(_,b,S,k,E,T){var I=l(_),O=l(b),A=I?d:o(_),U=O?d:o(b);A=A==p?m:A,U=U==p?m:U;var z=A==m,P=U==m,D=A==U;if(D&&u(_)){if(!u(b))return!1;I=!0,z=!1}if(D&&!z)return T||(T=new e),I||c(_)?n(_,b,S,k,E,T):r(_,b,A,S,k,E,T);if(!(S&h)){var V=z&&w.call(_,"__wrapped__"),B=P&&w.call(b,"__wrapped__");if(V||B){var C=V?_.value():_,q=B?b.value():b;return T||(T=new e),E(C,q,S,k,T)}}return D?(T||(T=new e),i(_,b,S,k,E,T)):!1}return dp=N,dp}var fp,Mb;function sT(){if(Mb)return fp;Mb=1;var e=Lq(),n=mr();function r(i,o,l,u,c){return i===o?!0:i==null||o==null||!n(i)&&!n(o)?i!==i&&o!==o:e(i,o,l,u,r,c)}return fp=r,fp}var hp,Ob;function $q(){if(Ob)return hp;Ob=1;var e=Fu(),n=sT(),r=1,i=2;function o(l,u,c,h){var p=c.length,d=p,m=!h;if(l==null)return!d;for(l=Object(l);p--;){var y=c[p];if(m&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<d;){y=c[p];var w=y[0],N=l[w],_=y[1];if(m&&y[2]){if(N===void 0&&!(w in l))return!1}else{var b=new e;if(h)var S=h(N,_,w,l,u,b);if(!(S===void 0?n(_,N,r|i,h,b):S))return!1}}return!0}return hp=o,hp}var pp,Pb;function iT(){if(Pb)return pp;Pb=1;var e=qn();function n(r){return r===r&&!e(r)}return pp=n,pp}var mp,Lb;function qq(){if(Lb)return mp;Lb=1;var e=iT(),n=Cs();function r(i){for(var o=n(i),l=o.length;l--;){var u=o[l],c=i[u];o[l]=[u,c,e(c)]}return o}return mp=r,mp}var gp,$b;function oT(){if($b)return gp;$b=1;function e(n,r){return function(i){return i==null?!1:i[n]===r&&(r!==void 0||n in Object(i))}}return gp=e,gp}var vp,qb;function Dq(){if(qb)return vp;qb=1;var e=$q(),n=qq(),r=oT();function i(o){var l=n(o);return l.length==1&&l[0][2]?r(l[0][0],l[0][1]):function(u){return u===o||e(u,o,l)}}return vp=i,vp}var yp,Db;function xo(){if(Db)return yp;Db=1;var e=fi(),n=mr(),r="[object Symbol]";function i(o){return typeof o=="symbol"||n(o)&&e(o)==r}return yp=i,yp}var wp,Fb;function wy(){if(Fb)return wp;Fb=1;var e=bt(),n=xo(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;function o(l,u){if(e(l))return!1;var c=typeof l;return c=="number"||c=="symbol"||c=="boolean"||l==null||n(l)?!0:i.test(l)||!r.test(l)||u!=null&&l in Object(u)}return wp=o,wp}var xp,zb;function Fq(){if(zb)return xp;zb=1;var e=ay(),n="Expected a function";function r(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new TypeError(n);var l=function(){var u=arguments,c=o?o.apply(this,u):u[0],h=l.cache;if(h.has(c))return h.get(c);var p=i.apply(this,u);return l.cache=h.set(c,p)||h,p};return l.cache=new(r.Cache||e),l}return r.Cache=e,xp=r,xp}var _p,Bb;function zq(){if(Bb)return _p;Bb=1;var e=Fq(),n=500;function r(i){var o=e(i,function(u){return l.size===n&&l.clear(),u}),l=o.cache;return o}return _p=r,_p}var bp,Ub;function Bq(){if(Ub)return bp;Ub=1;var e=zq(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,i=e(function(o){var l=[];return o.charCodeAt(0)===46&&l.push(""),o.replace(n,function(u,c,h,p){l.push(h?p.replace(r,"$1"):c||u)}),l});return bp=i,bp}var Sp,Hb;function Yu(){if(Hb)return Sp;Hb=1;function e(n,r){for(var i=-1,o=n==null?0:n.length,l=Array(o);++i<o;)l[i]=r(n[i],i,n);return l}return Sp=e,Sp}var kp,Wb;function Uq(){if(Wb)return kp;Wb=1;var e=vo(),n=Yu(),r=bt(),i=xo(),o=e?e.prototype:void 0,l=o?o.toString:void 0;function u(c){if(typeof c=="string")return c;if(r(c))return n(c,u)+"";if(i(c))return l?l.call(c):"";var h=c+"";return h=="0"&&1/c==-1/0?"-0":h}return kp=u,kp}var Ep,Vb;function aT(){if(Vb)return Ep;Vb=1;var e=Uq();function n(r){return r==null?"":e(r)}return Ep=n,Ep}var Np,Gb;function Ku(){if(Gb)return Np;Gb=1;var e=bt(),n=wy(),r=Bq(),i=aT();function o(l,u){return e(l)?l:n(l,u)?[l]:r(i(l))}return Np=o,Np}var Cp,Yb;function Pa(){if(Yb)return Cp;Yb=1;var e=xo();function n(r){if(typeof r=="string"||e(r))return r;var i=r+"";return i=="0"&&1/r==-1/0?"-0":i}return Cp=n,Cp}var Tp,Kb;function Xu(){if(Kb)return Tp;Kb=1;var e=Ku(),n=Pa();function r(i,o){o=e(o,i);for(var l=0,u=o.length;i!=null&&l<u;)i=i[n(o[l++])];return l&&l==u?i:void 0}return Tp=r,Tp}var Rp,Xb;function Hq(){if(Xb)return Rp;Xb=1;var e=Xu();function n(r,i,o){var l=r==null?void 0:e(r,i);return l===void 0?o:l}return Rp=n,Rp}var jp,Qb;function Wq(){if(Qb)return jp;Qb=1;function e(n,r){return n!=null&&r in Object(n)}return jp=e,jp}var Ap,Zb;function lT(){if(Zb)return Ap;Zb=1;var e=Ku(),n=Ma(),r=bt(),i=Uu(),o=uy(),l=Pa();function u(c,h,p){h=e(h,c);for(var d=-1,m=h.length,y=!1;++d<m;){var w=l(h[d]);if(!(y=c!=null&&p(c,w)))break;c=c[w]}return y||++d!=m?y:(m=c==null?0:c.length,!!m&&o(m)&&i(w,m)&&(r(c)||n(c)))}return Ap=u,Ap}var Ip,Jb;function uT(){if(Jb)return Ip;Jb=1;var e=Wq(),n=lT();function r(i,o){return i!=null&&n(i,o,e)}return Ip=r,Ip}var Mp,eS;function Vq(){if(eS)return Mp;eS=1;var e=sT(),n=Hq(),r=uT(),i=wy(),o=iT(),l=oT(),u=Pa(),c=1,h=2;function p(d,m){return i(d)&&o(m)?l(u(d),m):function(y){var w=n(y,d);return w===void 0&&w===m?r(y,d):e(m,w,c|h)}}return Mp=p,Mp}var Op,tS;function cT(){if(tS)return Op;tS=1;function e(n){return function(r){return r==null?void 0:r[n]}}return Op=e,Op}var Pp,nS;function Gq(){if(nS)return Pp;nS=1;var e=Xu();function n(r){return function(i){return e(i,r)}}return Pp=n,Pp}var Lp,rS;function Yq(){if(rS)return Lp;rS=1;var e=cT(),n=Gq(),r=wy(),i=Pa();function o(l){return r(l)?e(i(l)):n(l)}return Lp=o,Lp}var $p,sS;function Hr(){if(sS)return $p;sS=1;var e=Dq(),n=Vq(),r=mi(),i=bt(),o=Yq();function l(u){return typeof u=="function"?u:u==null?r:typeof u=="object"?i(u)?n(u[0],u[1]):e(u):o(u)}return $p=l,$p}var qp,iS;function dT(){if(iS)return qp;iS=1;var e=zC(),n=Rq(),r=Hr(),i=bt();function o(l,u){var c=i(l)?e:n;return c(l,r(u,3))}return qp=o,qp}var Dp,oS;function Kq(){if(oS)return Dp;oS=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i,o){return i!=null&&n.call(i,o)}return Dp=r,Dp}var Fp,aS;function fT(){if(aS)return Fp;aS=1;var e=Kq(),n=lT();function r(i,o){return i!=null&&n(i,o,e)}return Fp=r,Fp}var zp,lS;function Xq(){if(lS)return zp;lS=1;var e=dy(),n=wo(),r=Ma(),i=bt(),o=Ur(),l=yo(),u=Wu(),c=Oa(),h="[object Map]",p="[object Set]",d=Object.prototype,m=d.hasOwnProperty;function y(w){if(w==null)return!0;if(o(w)&&(i(w)||typeof w=="string"||typeof w.splice=="function"||l(w)||c(w)||r(w)))return!w.length;var N=n(w);if(N==h||N==p)return!w.size;if(u(w))return!e(w).length;for(var _ in w)if(m.call(w,_))return!1;return!0}return zp=y,zp}var Bp,uS;function hT(){if(uS)return Bp;uS=1;function e(n){return n===void 0}return Bp=e,Bp}var Up,cS;function pT(){if(cS)return Up;cS=1;var e=Gu(),n=Ur();function r(i,o){var l=-1,u=n(i)?Array(i.length):[];return e(i,function(c,h,p){u[++l]=o(c,h,p)}),u}return Up=r,Up}var Hp,dS;function mT(){if(dS)return Hp;dS=1;var e=Yu(),n=Hr(),r=pT(),i=bt();function o(l,u){var c=i(l)?e:r;return c(l,n(u,3))}return Hp=o,Hp}var Wp,fS;function Qq(){if(fS)return Wp;fS=1;function e(n,r,i,o){var l=-1,u=n==null?0:n.length;for(o&&u&&(i=n[++l]);++l<u;)i=r(i,n[l],l,n);return i}return Wp=e,Wp}var Vp,hS;function Zq(){if(hS)return Vp;hS=1;function e(n,r,i,o,l){return l(n,function(u,c,h){i=o?(o=!1,u):r(i,u,c,h)}),i}return Vp=e,Vp}var Gp,pS;function gT(){if(pS)return Gp;pS=1;var e=Qq(),n=Gu(),r=Hr(),i=Zq(),o=bt();function l(u,c,h){var p=o(u)?e:i,d=arguments.length<3;return p(u,r(c,4),h,d,n)}return Gp=l,Gp}var Yp,mS;function Jq(){if(mS)return Yp;mS=1;var e=fi(),n=bt(),r=mr(),i="[object String]";function o(l){return typeof l=="string"||!n(l)&&r(l)&&e(l)==i}return Yp=o,Yp}var Kp,gS;function eD(){if(gS)return Kp;gS=1;var e=cT(),n=e("length");return Kp=n,Kp}var Xp,vS;function tD(){if(vS)return Xp;vS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=n+r+i,l="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+o+l+"]");function h(p){return c.test(p)}return Xp=h,Xp}var Qp,yS;function nD(){if(yS)return Qp;yS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=n+r+i,l="\\ufe0e\\ufe0f",u="["+e+"]",c="["+o+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+c+"|"+h+")",d="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",_="["+l+"]?",b="(?:"+w+"(?:"+[d,m,y].join("|")+")"+_+N+")*",S=_+N+b,k="(?:"+[d+c+"?",c,m,y,u].join("|")+")",E=RegExp(h+"(?="+h+")|"+k+S,"g");function T(I){for(var O=E.lastIndex=0;E.test(I);)++O;return O}return Qp=T,Qp}var Zp,wS;function rD(){if(wS)return Zp;wS=1;var e=eD(),n=tD(),r=nD();function i(o){return n(o)?r(o):e(o)}return Zp=i,Zp}var Jp,xS;function sD(){if(xS)return Jp;xS=1;var e=dy(),n=wo(),r=Ur(),i=Jq(),o=rD(),l="[object Map]",u="[object Set]";function c(h){if(h==null)return 0;if(r(h))return i(h)?o(h):h.length;var p=n(h);return p==l||p==u?h.size:e(h).length}return Jp=c,Jp}var em,_S;function iD(){if(_S)return em;_S=1;var e=ly(),n=KC(),r=vy(),i=Hr(),o=Vu(),l=bt(),u=yo(),c=Aa(),h=qn(),p=Oa();function d(m,y,w){var N=l(m),_=N||u(m)||p(m);if(y=i(y,4),w==null){var b=m&&m.constructor;_?w=N?new b:[]:h(m)?w=c(b)?n(o(m)):{}:w={}}return(_?e:r)(m,function(S,k,E){return y(w,S,k,E)}),w}return em=d,em}var tm,bS;function oD(){if(bS)return tm;bS=1;var e=vo(),n=Ma(),r=bt(),i=e?e.isConcatSpreadable:void 0;function o(l){return r(l)||n(l)||!!(i&&l&&l[i])}return tm=o,tm}var nm,SS;function xy(){if(SS)return nm;SS=1;var e=hy(),n=oD();function r(i,o,l,u,c){var h=-1,p=i.length;for(l||(l=n),c||(c=[]);++h<p;){var d=i[h];o>0&&l(d)?o>1?r(d,o-1,l,u,c):e(c,d):u||(c[c.length]=d)}return c}return nm=r,nm}var rm,kS;function aD(){if(kS)return rm;kS=1;function e(n,r,i){switch(i.length){case 0:return n.call(r);case 1:return n.call(r,i[0]);case 2:return n.call(r,i[0],i[1]);case 3:return n.call(r,i[0],i[1],i[2])}return n.apply(r,i)}return rm=e,rm}var sm,ES;function vT(){if(ES)return sm;ES=1;var e=aD(),n=Math.max;function r(i,o,l){return o=n(o===void 0?i.length-1:o,0),function(){for(var u=arguments,c=-1,h=n(u.length-o,0),p=Array(h);++c<h;)p[c]=u[o+c];c=-1;for(var d=Array(o+1);++c<o;)d[c]=u[c];return d[o]=l(p),e(i,this,d)}}return sm=r,sm}var im,NS;function lD(){if(NS)return im;NS=1;var e=my(),n=LC(),r=mi(),i=n?function(o,l){return n(o,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:r;return im=i,im}var om,CS;function uD(){if(CS)return om;CS=1;var e=800,n=16,r=Date.now;function i(o){var l=0,u=0;return function(){var c=r(),h=n-(c-u);if(u=c,h>0){if(++l>=e)return arguments[0]}else l=0;return o.apply(void 0,arguments)}}return om=i,om}var am,TS;function yT(){if(TS)return am;TS=1;var e=lD(),n=uD(),r=n(e);return am=r,am}var lm,RS;function Qu(){if(RS)return lm;RS=1;var e=mi(),n=vT(),r=yT();function i(o,l){return r(n(o,l,e),o+"")}return lm=i,lm}var um,jS;function wT(){if(jS)return um;jS=1;function e(n,r,i,o){for(var l=n.length,u=i+(o?1:-1);o?u--:++u<l;)if(r(n[u],u,n))return u;return-1}return um=e,um}var cm,AS;function cD(){if(AS)return cm;AS=1;function e(n){return n!==n}return cm=e,cm}var dm,IS;function dD(){if(IS)return dm;IS=1;function e(n,r,i){for(var o=i-1,l=n.length;++o<l;)if(n[o]===r)return o;return-1}return dm=e,dm}var fm,MS;function fD(){if(MS)return fm;MS=1;var e=wT(),n=cD(),r=dD();function i(o,l,u){return l===l?r(o,l,u):e(o,n,u)}return fm=i,fm}var hm,OS;function hD(){if(OS)return hm;OS=1;var e=fD();function n(r,i){var o=r==null?0:r.length;return!!o&&e(r,i,0)>-1}return hm=n,hm}var pm,PS;function pD(){if(PS)return pm;PS=1;function e(n,r,i){for(var o=-1,l=n==null?0:n.length;++o<l;)if(i(r,n[o]))return!0;return!1}return pm=e,pm}var mm,LS;function mD(){if(LS)return mm;LS=1;function e(){}return mm=e,mm}var gm,$S;function gD(){if($S)return gm;$S=1;var e=VC(),n=mD(),r=yy(),i=1/0,o=e&&1/r(new e([,-0]))[1]==i?function(l){return new e(l)}:n;return gm=o,gm}var vm,qS;function vD(){if(qS)return vm;qS=1;var e=tT(),n=hD(),r=pD(),i=nT(),o=gD(),l=yy(),u=200;function c(h,p,d){var m=-1,y=n,w=h.length,N=!0,_=[],b=_;if(d)N=!1,y=r;else if(w>=u){var S=p?null:o(h);if(S)return l(S);N=!1,y=i,b=new e}else b=p?[]:_;e:for(;++m<w;){var k=h[m],E=p?p(k):k;if(k=d||k!==0?k:0,N&&E===E){for(var T=b.length;T--;)if(b[T]===E)continue e;p&&b.push(E),_.push(k)}else y(b,E,d)||(b!==_&&b.push(E),_.push(k))}return _}return vm=c,vm}var ym,DS;function xT(){if(DS)return ym;DS=1;var e=Ur(),n=mr();function r(i){return n(i)&&e(i)}return ym=r,ym}var wm,FS;function yD(){if(FS)return wm;FS=1;var e=xy(),n=Qu(),r=vD(),i=xT(),o=n(function(l){return r(e(l,1,i,!0))});return wm=o,wm}var xm,zS;function wD(){if(zS)return xm;zS=1;var e=Yu();function n(r,i){return e(i,function(o){return r[o]})}return xm=n,xm}var _m,BS;function _T(){if(BS)return _m;BS=1;var e=wD(),n=Cs();function r(i){return i==null?[]:e(i,n(i))}return _m=r,_m}var bm,US;function Dn(){if(US)return bm;US=1;var e;if(typeof iy=="function")try{e={clone:Nq(),constant:my(),each:eT(),filter:dT(),has:fT(),isArray:bt(),isEmpty:Xq(),isFunction:Aa(),isUndefined:hT(),keys:Cs(),map:mT(),reduce:gT(),size:sD(),transform:iD(),union:yD(),values:_T()}}catch{}return e||(e=window._),bm=e,bm}var Sm,HS;function _y(){if(HS)return Sm;HS=1;var e=Dn();Sm=o;var n="\0",r="\0",i="";function o(d){this._isDirected=e.has(d,"directed")?d.directed:!0,this._isMultigraph=e.has(d,"multigraph")?d.multigraph:!1,this._isCompound=e.has(d,"compound")?d.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[r]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(d){return this._label=d,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultNodeLabelFn=d,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var d=this;return e.filter(this.nodes(),function(m){return e.isEmpty(d._in[m])})},o.prototype.sinks=function(){var d=this;return e.filter(this.nodes(),function(m){return e.isEmpty(d._out[m])})},o.prototype.setNodes=function(d,m){var y=arguments,w=this;return e.each(d,function(N){y.length>1?w.setNode(N,m):w.setNode(N)}),this},o.prototype.setNode=function(d,m){return e.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=m),this):(this._nodes[d]=arguments.length>1?m:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=r,this._children[d]={},this._children[r][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)},o.prototype.node=function(d){return this._nodes[d]},o.prototype.hasNode=function(d){return e.has(this._nodes,d)},o.prototype.removeNode=function(d){var m=this;if(e.has(this._nodes,d)){var y=function(w){m.removeEdge(m._edgeObjs[w])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],e.each(this.children(d),function(w){m.setParent(w)}),delete this._children[d]),e.each(e.keys(this._in[d]),y),delete this._in[d],delete this._preds[d],e.each(e.keys(this._out[d]),y),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this},o.prototype.setParent=function(d,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=r;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===d)throw new Error("Setting "+m+" as parent of "+d+" would create a cycle");this.setNode(m)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=m,this._children[m][d]=!0,this},o.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},o.prototype.parent=function(d){if(this._isCompound){var m=this._parent[d];if(m!==r)return m}},o.prototype.children=function(d){if(e.isUndefined(d)&&(d=r),this._isCompound){var m=this._children[d];if(m)return e.keys(m)}else{if(d===r)return this.nodes();if(this.hasNode(d))return[]}},o.prototype.predecessors=function(d){var m=this._preds[d];if(m)return e.keys(m)},o.prototype.successors=function(d){var m=this._sucs[d];if(m)return e.keys(m)},o.prototype.neighbors=function(d){var m=this.predecessors(d);if(m)return e.union(m,this.successors(d))},o.prototype.isLeaf=function(d){var m;return this.isDirected()?m=this.successors(d):m=this.neighbors(d),m.length===0},o.prototype.filterNodes=function(d){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(_,b){d(b)&&m.setNode(b,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var w={};function N(_){var b=y.parent(_);return b===void 0||m.hasNode(b)?(w[_]=b,b):b in w?w[b]:N(b)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,N(_))}),m},o.prototype.setDefaultEdgeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultEdgeLabelFn=d,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(d,m){var y=this,w=arguments;return e.reduce(d,function(N,_){return w.length>1?y.setEdge(N,_,m):y.setEdge(N,_),_}),this},o.prototype.setEdge=function(){var d,m,y,w,N=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(d=_.v,m=_.w,y=_.name,arguments.length===2&&(w=arguments[1],N=!0)):(d=_,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),d=""+d,m=""+m,e.isUndefined(y)||(y=""+y);var b=c(this._isDirected,d,m,y);if(e.has(this._edgeLabels,b))return N&&(this._edgeLabels[b]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(m),this._edgeLabels[b]=N?w:this._defaultEdgeLabelFn(d,m,y);var S=h(this._isDirected,d,m,y);return d=S.v,m=S.w,Object.freeze(S),this._edgeObjs[b]=S,l(this._preds[m],d),l(this._sucs[d],m),this._in[m][b]=S,this._out[d][b]=S,this._edgeCount++,this},o.prototype.edge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y);return this._edgeLabels[w]},o.prototype.hasEdge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y);return e.has(this._edgeLabels,w)},o.prototype.removeEdge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y),N=this._edgeObjs[w];return N&&(d=N.v,m=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],u(this._preds[m],d),u(this._sucs[d],m),delete this._in[m][w],delete this._out[d][w],this._edgeCount--),this},o.prototype.inEdges=function(d,m){var y=this._in[d];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.v===m}):w}},o.prototype.outEdges=function(d,m){var y=this._out[d];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.w===m}):w}},o.prototype.nodeEdges=function(d,m){var y=this.inEdges(d,m);if(y)return y.concat(this.outEdges(d,m))};function l(d,m){d[m]?d[m]++:d[m]=1}function u(d,m){--d[m]||delete d[m]}function c(d,m,y,w){var N=""+m,_=""+y;if(!d&&N>_){var b=N;N=_,_=b}return N+i+_+i+(e.isUndefined(w)?n:w)}function h(d,m,y,w){var N=""+m,_=""+y;if(!d&&N>_){var b=N;N=_,_=b}var S={v:N,w:_};return w&&(S.name=w),S}function p(d,m){return c(d,m.v,m.w,m.name)}return Sm}var km,WS;function xD(){return WS||(WS=1,km="2.1.8"),km}var Em,VS;function _D(){return VS||(VS=1,Em={Graph:_y(),version:xD()}),Em}var Nm,GS;function bD(){if(GS)return Nm;GS=1;var e=Dn(),n=_y();Nm={write:r,read:l};function r(u){var c={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:i(u),edges:o(u)};return e.isUndefined(u.graph())||(c.value=e.clone(u.graph())),c}function i(u){return e.map(u.nodes(),function(c){var h=u.node(c),p=u.parent(c),d={v:c};return e.isUndefined(h)||(d.value=h),e.isUndefined(p)||(d.parent=p),d})}function o(u){return e.map(u.edges(),function(c){var h=u.edge(c),p={v:c.v,w:c.w};return e.isUndefined(c.name)||(p.name=c.name),e.isUndefined(h)||(p.value=h),p})}function l(u){var c=new n(u.options).setGraph(u.value);return e.each(u.nodes,function(h){c.setNode(h.v,h.value),h.parent&&c.setParent(h.v,h.parent)}),e.each(u.edges,function(h){c.setEdge({v:h.v,w:h.w,name:h.name},h.value)}),c}return Nm}var Cm,YS;function SD(){if(YS)return Cm;YS=1;var e=Dn();Cm=n;function n(r){var i={},o=[],l;function u(c){e.has(i,c)||(i[c]=!0,l.push(c),e.each(r.successors(c),u),e.each(r.predecessors(c),u))}return e.each(r.nodes(),function(c){l=[],u(c),l.length&&o.push(l)}),o}return Cm}var Tm,KS;function bT(){if(KS)return Tm;KS=1;var e=Dn();Tm=n;function n(){this._arr=[],this._keyIndices={}}return n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map(function(r){return r.key})},n.prototype.has=function(r){return e.has(this._keyIndices,r)},n.prototype.priority=function(r){var i=this._keyIndices[r];if(i!==void 0)return this._arr[i].priority},n.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(r,i){var o=this._keyIndices;if(r=String(r),!e.has(o,r)){var l=this._arr,u=l.length;return o[r]=u,l.push({key:r,priority:i}),this._decrease(u),!0}return!1},n.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},n.prototype.decrease=function(r,i){var o=this._keyIndices[r];if(i>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[o].priority+" New: "+i);this._arr[o].priority=i,this._decrease(o)},n.prototype._heapify=function(r){var i=this._arr,o=2*r,l=o+1,u=r;o<i.length&&(u=i[o].priority<i[u].priority?o:u,l<i.length&&(u=i[l].priority<i[u].priority?l:u),u!==r&&(this._swap(r,u),this._heapify(u)))},n.prototype._decrease=function(r){for(var i=this._arr,o=i[r].priority,l;r!==0&&(l=r>>1,!(i[l].priority<o));)this._swap(r,l),r=l},n.prototype._swap=function(r,i){var o=this._arr,l=this._keyIndices,u=o[r],c=o[i];o[r]=c,o[i]=u,l[c.key]=r,l[u.key]=i},Tm}var Rm,XS;function ST(){if(XS)return Rm;XS=1;var e=Dn(),n=bT();Rm=i;var r=e.constant(1);function i(l,u,c,h){return o(l,String(u),c||r,h||function(p){return l.outEdges(p)})}function o(l,u,c,h){var p={},d=new n,m,y,w=function(N){var _=N.v!==m?N.v:N.w,b=p[_],S=c(N),k=y.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+S);k<b.distance&&(b.distance=k,b.predecessor=m,d.decrease(_,k))};for(l.nodes().forEach(function(N){var _=N===u?0:Number.POSITIVE_INFINITY;p[N]={distance:_},d.add(N,_)});d.size()>0&&(m=d.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)h(m).forEach(w);return p}return Rm}var jm,QS;function kD(){if(QS)return jm;QS=1;var e=ST(),n=Dn();jm=r;function r(i,o,l){return n.transform(i.nodes(),function(u,c){u[c]=e(i,c,o,l)},{})}return jm}var Am,ZS;function kT(){if(ZS)return Am;ZS=1;var e=Dn();Am=n;function n(r){var i=0,o=[],l={},u=[];function c(h){var p=l[h]={onStack:!0,lowlink:i,index:i++};if(o.push(h),r.successors(h).forEach(function(y){e.has(l,y)?l[y].onStack&&(p.lowlink=Math.min(p.lowlink,l[y].index)):(c(y),p.lowlink=Math.min(p.lowlink,l[y].lowlink))}),p.lowlink===p.index){var d=[],m;do m=o.pop(),l[m].onStack=!1,d.push(m);while(h!==m);u.push(d)}}return r.nodes().forEach(function(h){e.has(l,h)||c(h)}),u}return Am}var Im,JS;function ED(){if(JS)return Im;JS=1;var e=Dn(),n=kT();Im=r;function r(i){return e.filter(n(i),function(o){return o.length>1||o.length===1&&i.hasEdge(o[0],o[0])})}return Im}var Mm,ek;function ND(){if(ek)return Mm;ek=1;var e=Dn();Mm=r;var n=e.constant(1);function r(o,l,u){return i(o,l||n,u||function(c){return o.outEdges(c)})}function i(o,l,u){var c={},h=o.nodes();return h.forEach(function(p){c[p]={},c[p][p]={distance:0},h.forEach(function(d){p!==d&&(c[p][d]={distance:Number.POSITIVE_INFINITY})}),u(p).forEach(function(d){var m=d.v===p?d.w:d.v,y=l(d);c[p][m]={distance:y,predecessor:p}})}),h.forEach(function(p){var d=c[p];h.forEach(function(m){var y=c[m];h.forEach(function(w){var N=y[p],_=d[w],b=y[w],S=N.distance+_.distance;S<b.distance&&(b.distance=S,b.predecessor=_.predecessor)})})}),c}return Mm}var Om,tk;function ET(){if(tk)return Om;tk=1;var e=Dn();Om=n,n.CycleException=r;function n(i){var o={},l={},u=[];function c(h){if(e.has(l,h))throw new r;e.has(o,h)||(l[h]=!0,o[h]=!0,e.each(i.predecessors(h),c),delete l[h],u.push(h))}if(e.each(i.sinks(),c),e.size(o)!==i.nodeCount())throw new r;return u}function r(){}return r.prototype=new Error,Om}var Pm,nk;function CD(){if(nk)return Pm;nk=1;var e=ET();Pm=n;function n(r){try{e(r)}catch(i){if(i instanceof e.CycleException)return!1;throw i}return!0}return Pm}var Lm,rk;function NT(){if(rk)return Lm;rk=1;var e=Dn();Lm=n;function n(i,o,l){e.isArray(o)||(o=[o]);var u=(i.isDirected()?i.successors:i.neighbors).bind(i),c=[],h={};return e.each(o,function(p){if(!i.hasNode(p))throw new Error("Graph does not have node: "+p);r(i,p,l==="post",h,u,c)}),c}function r(i,o,l,u,c,h){e.has(u,o)||(u[o]=!0,l||h.push(o),e.each(c(o),function(p){r(i,p,l,u,c,h)}),l&&h.push(o))}return Lm}var $m,sk;function TD(){if(sk)return $m;sk=1;var e=NT();$m=n;function n(r,i){return e(r,i,"post")}return $m}var qm,ik;function RD(){if(ik)return qm;ik=1;var e=NT();qm=n;function n(r,i){return e(r,i,"pre")}return qm}var Dm,ok;function jD(){if(ok)return Dm;ok=1;var e=Dn(),n=_y(),r=bT();Dm=i;function i(o,l){var u=new n,c={},h=new r,p;function d(y){var w=y.v===p?y.w:y.v,N=h.priority(w);if(N!==void 0){var _=l(y);_<N&&(c[w]=p,h.decrease(w,_))}}if(o.nodeCount()===0)return u;e.each(o.nodes(),function(y){h.add(y,Number.POSITIVE_INFINITY),u.setNode(y)}),h.decrease(o.nodes()[0],0);for(var m=!1;h.size()>0;){if(p=h.removeMin(),e.has(c,p))u.setEdge(p,c[p]);else{if(m)throw new Error("Input graph is not connected: "+o);m=!0}o.nodeEdges(p).forEach(d)}return u}return Dm}var Fm,ak;function AD(){return ak||(ak=1,Fm={components:SD(),dijkstra:ST(),dijkstraAll:kD(),findCycles:ED(),floydWarshall:ND(),isAcyclic:CD(),postorder:TD(),preorder:RD(),prim:jD(),tarjan:kT(),topsort:ET()}),Fm}var zm,lk;function ID(){if(lk)return zm;lk=1;var e=_D();return zm={Graph:e.Graph,json:bD(),alg:AD(),version:e.version},zm}var Bm,uk;function nr(){if(uk)return Bm;uk=1;var e;if(typeof iy=="function")try{e=ID()}catch{}return e||(e=window.graphlib),Bm=e,Bm}var Um,ck;function MD(){if(ck)return Um;ck=1;var e=QC(),n=1,r=4;function i(o){return e(o,n|r)}return Um=i,Um}var Hm,dk;function Zu(){if(dk)return Hm;dk=1;var e=go(),n=Ur(),r=Uu(),i=qn();function o(l,u,c){if(!i(c))return!1;var h=typeof u;return(h=="number"?n(c)&&r(u,c.length):h=="string"&&u in c)?e(c[u],l):!1}return Hm=o,Hm}var Wm,fk;function OD(){if(fk)return Wm;fk=1;var e=Qu(),n=go(),r=Zu(),i=pi(),o=Object.prototype,l=o.hasOwnProperty,u=e(function(c,h){c=Object(c);var p=-1,d=h.length,m=d>2?h[2]:void 0;for(m&&r(h[0],h[1],m)&&(d=1);++p<d;)for(var y=h[p],w=i(y),N=-1,_=w.length;++N<_;){var b=w[N],S=c[b];(S===void 0||n(S,o[b])&&!l.call(c,b))&&(c[b]=y[b])}return c});return Wm=u,Wm}var Vm,hk;function PD(){if(hk)return Vm;hk=1;var e=Hr(),n=Ur(),r=Cs();function i(o){return function(l,u,c){var h=Object(l);if(!n(l)){var p=e(u,3);l=r(l),u=function(m){return p(h[m],m,h)}}var d=o(l,u,c);return d>-1?h[p?l[d]:d]:void 0}}return Vm=i,Vm}var Gm,pk;function LD(){if(pk)return Gm;pk=1;var e=/\s/;function n(r){for(var i=r.length;i--&&e.test(r.charAt(i)););return i}return Gm=n,Gm}var Ym,mk;function $D(){if(mk)return Ym;mk=1;var e=LD(),n=/^\s+/;function r(i){return i&&i.slice(0,e(i)+1).replace(n,"")}return Ym=r,Ym}var Km,gk;function qD(){if(gk)return Km;gk=1;var e=$D(),n=qn(),r=xo(),i=NaN,o=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;function h(p){if(typeof p=="number")return p;if(r(p))return i;if(n(p)){var d=typeof p.valueOf=="function"?p.valueOf():p;p=n(d)?d+"":d}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=l.test(p);return m||u.test(p)?c(p.slice(2),m?2:8):o.test(p)?i:+p}return Km=h,Km}var Xm,vk;function CT(){if(vk)return Xm;vk=1;var e=qD(),n=1/0,r=17976931348623157e292;function i(o){if(!o)return o===0?o:0;if(o=e(o),o===n||o===-n){var l=o<0?-1:1;return l*r}return o===o?o:0}return Xm=i,Xm}var Qm,yk;function DD(){if(yk)return Qm;yk=1;var e=CT();function n(r){var i=e(r),o=i%1;return i===i?o?i-o:i:0}return Qm=n,Qm}var Zm,wk;function FD(){if(wk)return Zm;wk=1;var e=wT(),n=Hr(),r=DD(),i=Math.max;function o(l,u,c){var h=l==null?0:l.length;if(!h)return-1;var p=c==null?0:r(c);return p<0&&(p=i(h+p,0)),e(l,n(u,3),p)}return Zm=o,Zm}var Jm,xk;function zD(){if(xk)return Jm;xk=1;var e=PD(),n=FD(),r=e(n);return Jm=r,Jm}var eg,_k;function TT(){if(_k)return eg;_k=1;var e=xy();function n(r){var i=r==null?0:r.length;return i?e(r,1):[]}return eg=n,eg}var tg,bk;function BD(){if(bk)return tg;bk=1;var e=gy(),n=ZC(),r=pi();function i(o,l){return o==null?o:e(o,n(l),r)}return tg=i,tg}var ng,Sk;function UD(){if(Sk)return ng;Sk=1;function e(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}return ng=e,ng}var rg,kk;function HD(){if(kk)return rg;kk=1;var e=zu(),n=vy(),r=Hr();function i(o,l){var u={};return l=r(l,3),n(o,function(c,h,p){e(u,h,l(c,h,p))}),u}return rg=i,rg}var sg,Ek;function by(){if(Ek)return sg;Ek=1;var e=xo();function n(r,i,o){for(var l=-1,u=r.length;++l<u;){var c=r[l],h=i(c);if(h!=null&&(p===void 0?h===h&&!e(h):o(h,p)))var p=h,d=c}return d}return sg=n,sg}var ig,Nk;function WD(){if(Nk)return ig;Nk=1;function e(n,r){return n>r}return ig=e,ig}var og,Ck;function VD(){if(Ck)return og;Ck=1;var e=by(),n=WD(),r=mi();function i(o){return o&&o.length?e(o,r,n):void 0}return og=i,og}var ag,Tk;function RT(){if(Tk)return ag;Tk=1;var e=zu(),n=go();function r(i,o,l){(l!==void 0&&!n(i[o],l)||l===void 0&&!(o in i))&&e(i,o,l)}return ag=r,ag}var lg,Rk;function GD(){if(Rk)return lg;Rk=1;var e=fi(),n=Vu(),r=mr(),i="[object Object]",o=Function.prototype,l=Object.prototype,u=o.toString,c=l.hasOwnProperty,h=u.call(Object);function p(d){if(!r(d)||e(d)!=i)return!1;var m=n(d);if(m===null)return!0;var y=c.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&u.call(y)==h}return lg=p,lg}var ug,jk;function jT(){if(jk)return ug;jk=1;function e(n,r){if(!(r==="constructor"&&typeof n[r]=="function")&&r!="__proto__")return n[r]}return ug=e,ug}var cg,Ak;function YD(){if(Ak)return cg;Ak=1;var e=Ia(),n=pi();function r(i){return e(i,n(i))}return cg=r,cg}var dg,Ik;function KD(){if(Ik)return dg;Ik=1;var e=RT(),n=DC(),r=YC(),i=FC(),o=XC(),l=Ma(),u=bt(),c=xT(),h=yo(),p=Aa(),d=qn(),m=GD(),y=Oa(),w=jT(),N=YD();function _(b,S,k,E,T,I,O){var A=w(b,k),U=w(S,k),z=O.get(U);if(z){e(b,k,z);return}var P=I?I(A,U,k+"",b,S,O):void 0,D=P===void 0;if(D){var V=u(U),B=!V&&h(U),C=!V&&!B&&y(U);P=U,V||B||C?u(A)?P=A:c(A)?P=i(A):B?(D=!1,P=n(U,!0)):C?(D=!1,P=r(U,!0)):P=[]:m(U)||l(U)?(P=A,l(A)?P=N(A):(!d(A)||p(A))&&(P=o(U))):D=!1}D&&(O.set(U,P),T(P,U,E,I,O),O.delete(U)),e(b,k,P)}return dg=_,dg}var fg,Mk;function XD(){if(Mk)return fg;Mk=1;var e=Fu(),n=RT(),r=gy(),i=KD(),o=qn(),l=pi(),u=jT();function c(h,p,d,m,y){h!==p&&r(p,function(w,N){if(y||(y=new e),o(w))i(h,p,N,d,c,m,y);else{var _=m?m(u(h,N),w,N+"",h,p,y):void 0;_===void 0&&(_=w),n(h,N,_)}},l)}return fg=c,fg}var hg,Ok;function QD(){if(Ok)return hg;Ok=1;var e=Qu(),n=Zu();function r(i){return e(function(o,l){var u=-1,c=l.length,h=c>1?l[c-1]:void 0,p=c>2?l[2]:void 0;for(h=i.length>3&&typeof h=="function"?(c--,h):void 0,p&&n(l[0],l[1],p)&&(h=c<3?void 0:h,c=1),o=Object(o);++u<c;){var d=l[u];d&&i(o,d,u,h)}return o})}return hg=r,hg}var pg,Pk;function ZD(){if(Pk)return pg;Pk=1;var e=XD(),n=QD(),r=n(function(i,o,l){e(i,o,l)});return pg=r,pg}var mg,Lk;function AT(){if(Lk)return mg;Lk=1;function e(n,r){return n<r}return mg=e,mg}var gg,$k;function JD(){if($k)return gg;$k=1;var e=by(),n=AT(),r=mi();function i(o){return o&&o.length?e(o,r,n):void 0}return gg=i,gg}var vg,qk;function e4(){if(qk)return vg;qk=1;var e=by(),n=Hr(),r=AT();function i(o,l){return o&&o.length?e(o,n(l,2),r):void 0}return vg=i,vg}var yg,Dk;function t4(){if(Dk)return yg;Dk=1;var e=sr(),n=function(){return e.Date.now()};return yg=n,yg}var wg,Fk;function n4(){if(Fk)return wg;Fk=1;var e=Bu(),n=Ku(),r=Uu(),i=qn(),o=Pa();function l(u,c,h,p){if(!i(u))return u;c=n(c,u);for(var d=-1,m=c.length,y=m-1,w=u;w!=null&&++d<m;){var N=o(c[d]),_=h;if(N==="__proto__"||N==="constructor"||N==="prototype")return u;if(d!=y){var b=w[N];_=p?p(b,N,w):void 0,_===void 0&&(_=i(b)?b:r(c[d+1])?[]:{})}e(w,N,_),w=w[N]}return u}return wg=l,wg}var xg,zk;function r4(){if(zk)return xg;zk=1;var e=Xu(),n=n4(),r=Ku();function i(o,l,u){for(var c=-1,h=l.length,p={};++c<h;){var d=l[c],m=e(o,d);u(m,d)&&n(p,r(d,o),m)}return p}return xg=i,xg}var _g,Bk;function s4(){if(Bk)return _g;Bk=1;var e=r4(),n=uT();function r(i,o){return e(i,o,function(l,u){return n(i,u)})}return _g=r,_g}var bg,Uk;function i4(){if(Uk)return bg;Uk=1;var e=TT(),n=vT(),r=yT();function i(o){return r(n(o,void 0,e),o+"")}return bg=i,bg}var Sg,Hk;function o4(){if(Hk)return Sg;Hk=1;var e=s4(),n=i4(),r=n(function(i,o){return i==null?{}:e(i,o)});return Sg=r,Sg}var kg,Wk;function a4(){if(Wk)return kg;Wk=1;var e=Math.ceil,n=Math.max;function r(i,o,l,u){for(var c=-1,h=n(e((o-i)/(l||1)),0),p=Array(h);h--;)p[u?h:++c]=i,i+=l;return p}return kg=r,kg}var Eg,Vk;function l4(){if(Vk)return Eg;Vk=1;var e=a4(),n=Zu(),r=CT();function i(o){return function(l,u,c){return c&&typeof c!="number"&&n(l,u,c)&&(u=c=void 0),l=r(l),u===void 0?(u=l,l=0):u=r(u),c=c===void 0?l<u?1:-1:r(c),e(l,u,c,o)}}return Eg=i,Eg}var Ng,Gk;function u4(){if(Gk)return Ng;Gk=1;var e=l4(),n=e();return Ng=n,Ng}var Cg,Yk;function c4(){if(Yk)return Cg;Yk=1;function e(n,r){var i=n.length;for(n.sort(r);i--;)n[i]=n[i].value;return n}return Cg=e,Cg}var Tg,Kk;function d4(){if(Kk)return Tg;Kk=1;var e=xo();function n(r,i){if(r!==i){var o=r!==void 0,l=r===null,u=r===r,c=e(r),h=i!==void 0,p=i===null,d=i===i,m=e(i);if(!p&&!m&&!c&&r>i||c&&h&&d&&!p&&!m||l&&h&&d||!o&&d||!u)return 1;if(!l&&!c&&!m&&r<i||m&&o&&u&&!l&&!c||p&&o&&u||!h&&u||!d)return-1}return 0}return Tg=n,Tg}var Rg,Xk;function f4(){if(Xk)return Rg;Xk=1;var e=d4();function n(r,i,o){for(var l=-1,u=r.criteria,c=i.criteria,h=u.length,p=o.length;++l<h;){var d=e(u[l],c[l]);if(d){if(l>=p)return d;var m=o[l];return d*(m=="desc"?-1:1)}}return r.index-i.index}return Rg=n,Rg}var jg,Qk;function h4(){if(Qk)return jg;Qk=1;var e=Yu(),n=Xu(),r=Hr(),i=pT(),o=c4(),l=Hu(),u=f4(),c=mi(),h=bt();function p(d,m,y){m.length?m=e(m,function(_){return h(_)?function(b){return n(b,_.length===1?_[0]:_)}:_}):m=[c];var w=-1;m=e(m,l(r));var N=i(d,function(_,b,S){var k=e(m,function(E){return E(_)});return{criteria:k,index:++w,value:_}});return o(N,function(_,b){return u(_,b,y)})}return jg=p,jg}var Ag,Zk;function p4(){if(Zk)return Ag;Zk=1;var e=xy(),n=h4(),r=Qu(),i=Zu(),o=r(function(l,u){if(l==null)return[];var c=u.length;return c>1&&i(l,u[0],u[1])?u=[]:c>2&&i(u[0],u[1],u[2])&&(u=[u[0]]),n(l,e(u,1),[])});return Ag=o,Ag}var Ig,Jk;function m4(){if(Jk)return Ig;Jk=1;var e=aT(),n=0;function r(i){var o=++n;return e(i)+o}return Ig=r,Ig}var Mg,eE;function g4(){if(eE)return Mg;eE=1;function e(n,r,i){for(var o=-1,l=n.length,u=r.length,c={};++o<l;){var h=o<u?r[o]:void 0;i(c,n[o],h)}return c}return Mg=e,Mg}var Og,tE;function v4(){if(tE)return Og;tE=1;var e=Bu(),n=g4();function r(i,o){return n(i||[],o||[],e)}return Og=r,Og}var Pg,nE;function lt(){if(nE)return Pg;nE=1;var e;if(typeof iy=="function")try{e={cloneDeep:MD(),constant:my(),defaults:OD(),each:eT(),filter:dT(),find:zD(),flatten:TT(),forEach:JC(),forIn:BD(),has:fT(),isUndefined:hT(),last:UD(),map:mT(),mapValues:HD(),max:VD(),merge:ZD(),min:JD(),minBy:e4(),now:t4(),pick:o4(),range:u4(),reduce:gT(),sortBy:p4(),uniqueId:m4(),values:_T(),zipObject:v4()}}catch{}return e||(e=window._),Pg=e,Pg}var Lg,rE;function y4(){if(rE)return Lg;rE=1,Lg=e;function e(){var i={};i._next=i._prev=i,this._sentinel=i}e.prototype.dequeue=function(){var i=this._sentinel,o=i._prev;if(o!==i)return n(o),o},e.prototype.enqueue=function(i){var o=this._sentinel;i._prev&&i._next&&n(i),i._next=o._next,o._next._prev=i,o._next=i,i._prev=o},e.prototype.toString=function(){for(var i=[],o=this._sentinel,l=o._prev;l!==o;)i.push(JSON.stringify(l,r)),l=l._prev;return"["+i.join(", ")+"]"};function n(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function r(i,o){if(i!=="_next"&&i!=="_prev")return o}return Lg}var $g,sE;function w4(){if(sE)return $g;sE=1;var e=lt(),n=nr().Graph,r=y4();$g=o;var i=e.constant(1);function o(p,d){if(p.nodeCount()<=1)return[];var m=c(p,d||i),y=l(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function l(p,d,m){for(var y=[],w=d[d.length-1],N=d[0],_;p.nodeCount();){for(;_=N.dequeue();)u(p,d,m,_);for(;_=w.dequeue();)u(p,d,m,_);if(p.nodeCount()){for(var b=d.length-2;b>0;--b)if(_=d[b].dequeue(),_){y=y.concat(u(p,d,m,_,!0));break}}}return y}function u(p,d,m,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var b=p.edge(_),S=p.node(_.v);w&&N.push({v:_.v,w:_.w}),S.out-=b,h(d,m,S)}),e.forEach(p.outEdges(y.v),function(_){var b=p.edge(_),S=_.w,k=p.node(S);k.in-=b,h(d,m,k)}),p.removeNode(y.v),N}function c(p,d){var m=new n,y=0,w=0;e.forEach(p.nodes(),function(b){m.setNode(b,{v:b,in:0,out:0})}),e.forEach(p.edges(),function(b){var S=m.edge(b.v,b.w)||0,k=d(b),E=S+k;m.setEdge(b.v,b.w,E),w=Math.max(w,m.node(b.v).out+=k),y=Math.max(y,m.node(b.w).in+=k)});var N=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(m.nodes(),function(b){h(N,_,m.node(b))}),{graph:m,buckets:N,zeroIdx:_}}function h(p,d,m){m.out?m.in?p[m.out-m.in+d].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return $g}var qg,iE;function x4(){if(iE)return qg;iE=1;var e=lt(),n=w4();qg={run:r,undo:o};function r(l){var u=l.graph().acyclicer==="greedy"?n(l,c(l)):i(l);e.forEach(u,function(h){var p=l.edge(h);l.removeEdge(h),p.forwardName=h.name,p.reversed=!0,l.setEdge(h.w,h.v,p,e.uniqueId("rev"))});function c(h){return function(p){return h.edge(p).weight}}}function i(l){var u=[],c={},h={};function p(d){e.has(h,d)||(h[d]=!0,c[d]=!0,e.forEach(l.outEdges(d),function(m){e.has(c,m.w)?u.push(m):p(m.w)}),delete c[d])}return e.forEach(l.nodes(),p),u}function o(l){e.forEach(l.edges(),function(u){var c=l.edge(u);if(c.reversed){l.removeEdge(u);var h=c.forwardName;delete c.reversed,delete c.forwardName,l.setEdge(u.w,u.v,c,h)}})}return qg}var Dg,oE;function fn(){if(oE)return Dg;oE=1;var e=lt(),n=nr().Graph;Dg={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:l,predecessorWeights:u,intersectRect:c,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:d,addBorderNode:m,maxRank:y,partition:w,time:N,notime:_};function r(b,S,k,E){var T;do T=e.uniqueId(E);while(b.hasNode(T));return k.dummy=S,b.setNode(T,k),T}function i(b){var S=new n().setGraph(b.graph());return e.forEach(b.nodes(),function(k){S.setNode(k,b.node(k))}),e.forEach(b.edges(),function(k){var E=S.edge(k.v,k.w)||{weight:0,minlen:1},T=b.edge(k);S.setEdge(k.v,k.w,{weight:E.weight+T.weight,minlen:Math.max(E.minlen,T.minlen)})}),S}function o(b){var S=new n({multigraph:b.isMultigraph()}).setGraph(b.graph());return e.forEach(b.nodes(),function(k){b.children(k).length||S.setNode(k,b.node(k))}),e.forEach(b.edges(),function(k){S.setEdge(k,b.edge(k))}),S}function l(b){var S=e.map(b.nodes(),function(k){var E={};return e.forEach(b.outEdges(k),function(T){E[T.w]=(E[T.w]||0)+b.edge(T).weight}),E});return e.zipObject(b.nodes(),S)}function u(b){var S=e.map(b.nodes(),function(k){var E={};return e.forEach(b.inEdges(k),function(T){E[T.v]=(E[T.v]||0)+b.edge(T).weight}),E});return e.zipObject(b.nodes(),S)}function c(b,S){var k=b.x,E=b.y,T=S.x-k,I=S.y-E,O=b.width/2,A=b.height/2;if(!T&&!I)throw new Error("Not possible to find intersection inside of the rectangle");var U,z;return Math.abs(I)*O>Math.abs(T)*A?(I<0&&(A=-A),U=A*T/I,z=A):(T<0&&(O=-O),U=O,z=O*I/T),{x:k+U,y:E+z}}function h(b){var S=e.map(e.range(y(b)+1),function(){return[]});return e.forEach(b.nodes(),function(k){var E=b.node(k),T=E.rank;e.isUndefined(T)||(S[T][E.order]=k)}),S}function p(b){var S=e.min(e.map(b.nodes(),function(k){return b.node(k).rank}));e.forEach(b.nodes(),function(k){var E=b.node(k);e.has(E,"rank")&&(E.rank-=S)})}function d(b){var S=e.min(e.map(b.nodes(),function(I){return b.node(I).rank})),k=[];e.forEach(b.nodes(),function(I){var O=b.node(I).rank-S;k[O]||(k[O]=[]),k[O].push(I)});var E=0,T=b.graph().nodeRankFactor;e.forEach(k,function(I,O){e.isUndefined(I)&&O%T!==0?--E:E&&e.forEach(I,function(A){b.node(A).rank+=E})})}function m(b,S,k,E){var T={width:0,height:0};return arguments.length>=4&&(T.rank=k,T.order=E),r(b,"border",T,S)}function y(b){return e.max(e.map(b.nodes(),function(S){var k=b.node(S).rank;if(!e.isUndefined(k))return k}))}function w(b,S){var k={lhs:[],rhs:[]};return e.forEach(b,function(E){S(E)?k.lhs.push(E):k.rhs.push(E)}),k}function N(b,S){var k=e.now();try{return S()}finally{console.log(b+" time: "+(e.now()-k)+"ms")}}function _(b,S){return S()}return Dg}var Fg,aE;function _4(){if(aE)return Fg;aE=1;var e=lt(),n=fn();Fg={run:r,undo:o};function r(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(u){i(l,u)})}function i(l,u){var c=u.v,h=l.node(c).rank,p=u.w,d=l.node(p).rank,m=u.name,y=l.edge(u),w=y.labelRank;if(d!==h+1){l.removeEdge(u);var N,_,b;for(b=0,++h;h<d;++b,++h)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:u,rank:h},N=n.addDummyNode(l,"edge",_,"_d"),h===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),l.setEdge(c,N,{weight:y.weight},m),b===0&&l.graph().dummyChains.push(N),c=N;l.setEdge(c,p,{weight:y.weight},m)}}function o(l){e.forEach(l.graph().dummyChains,function(u){var c=l.node(u),h=c.edgeLabel,p;for(l.setEdge(c.edgeObj,h);c.dummy;)p=l.successors(u)[0],l.removeNode(u),h.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(h.x=c.x,h.y=c.y,h.width=c.width,h.height=c.height),u=p,c=l.node(u)})}return Fg}var zg,lE;function Nu(){if(lE)return zg;lE=1;var e=lt();zg={longestPath:n,slack:r};function n(i){var o={};function l(u){var c=i.node(u);if(e.has(o,u))return c.rank;o[u]=!0;var h=e.min(e.map(i.outEdges(u),function(p){return l(p.w)-i.edge(p).minlen}));return(h===Number.POSITIVE_INFINITY||h===void 0||h===null)&&(h=0),c.rank=h}e.forEach(i.sources(),l)}function r(i,o){return i.node(o.w).rank-i.node(o.v).rank-i.edge(o).minlen}return zg}var Bg,uE;function IT(){if(uE)return Bg;uE=1;var e=lt(),n=nr().Graph,r=Nu().slack;Bg=i;function i(c){var h=new n({directed:!1}),p=c.nodes()[0],d=c.nodeCount();h.setNode(p,{});for(var m,y;o(h,c)<d;)m=l(h,c),y=h.hasNode(m.v)?r(c,m):-r(c,m),u(h,c,y);return h}function o(c,h){function p(d){e.forEach(h.nodeEdges(d),function(m){var y=m.v,w=d===y?m.w:y;!c.hasNode(w)&&!r(h,m)&&(c.setNode(w,{}),c.setEdge(d,w,{}),p(w))})}return e.forEach(c.nodes(),p),c.nodeCount()}function l(c,h){return e.minBy(h.edges(),function(p){if(c.hasNode(p.v)!==c.hasNode(p.w))return r(h,p)})}function u(c,h,p){e.forEach(c.nodes(),function(d){h.node(d).rank+=p})}return Bg}var Ug,cE;function b4(){if(cE)return Ug;cE=1;var e=lt(),n=IT(),r=Nu().slack,i=Nu().longestPath,o=nr().alg.preorder,l=nr().alg.postorder,u=fn().simplify;Ug=c,c.initLowLimValues=m,c.initCutValues=h,c.calcCutValue=d,c.leaveEdge=w,c.enterEdge=N,c.exchangeEdges=_;function c(E){E=u(E),i(E);var T=n(E);m(T),h(T,E);for(var I,O;I=w(T);)O=N(T,E,I),_(T,E,I,O)}function h(E,T){var I=l(E,E.nodes());I=I.slice(0,I.length-1),e.forEach(I,function(O){p(E,T,O)})}function p(E,T,I){var O=E.node(I),A=O.parent;E.edge(I,A).cutvalue=d(E,T,I)}function d(E,T,I){var O=E.node(I),A=O.parent,U=!0,z=T.edge(I,A),P=0;return z||(U=!1,z=T.edge(A,I)),P=z.weight,e.forEach(T.nodeEdges(I),function(D){var V=D.v===I,B=V?D.w:D.v;if(B!==A){var C=V===U,q=T.edge(D).weight;if(P+=C?q:-q,S(E,I,B)){var L=E.edge(I,B).cutvalue;P+=C?-L:L}}}),P}function m(E,T){arguments.length<2&&(T=E.nodes()[0]),y(E,{},1,T)}function y(E,T,I,O,A){var U=I,z=E.node(O);return T[O]=!0,e.forEach(E.neighbors(O),function(P){e.has(T,P)||(I=y(E,T,I,P,O))}),z.low=U,z.lim=I++,A?z.parent=A:delete z.parent,I}function w(E){return e.find(E.edges(),function(T){return E.edge(T).cutvalue<0})}function N(E,T,I){var O=I.v,A=I.w;T.hasEdge(O,A)||(O=I.w,A=I.v);var U=E.node(O),z=E.node(A),P=U,D=!1;U.lim>z.lim&&(P=z,D=!0);var V=e.filter(T.edges(),function(B){return D===k(E,E.node(B.v),P)&&D!==k(E,E.node(B.w),P)});return e.minBy(V,function(B){return r(T,B)})}function _(E,T,I,O){var A=I.v,U=I.w;E.removeEdge(A,U),E.setEdge(O.v,O.w,{}),m(E),h(E,T),b(E,T)}function b(E,T){var I=e.find(E.nodes(),function(A){return!T.node(A).parent}),O=o(E,I);O=O.slice(1),e.forEach(O,function(A){var U=E.node(A).parent,z=T.edge(A,U),P=!1;z||(z=T.edge(U,A),P=!0),T.node(A).rank=T.node(U).rank+(P?z.minlen:-z.minlen)})}function S(E,T,I){return E.hasEdge(T,I)}function k(E,T,I){return I.low<=T.lim&&T.lim<=I.lim}return Ug}var Hg,dE;function S4(){if(dE)return Hg;dE=1;var e=Nu(),n=e.longestPath,r=IT(),i=b4();Hg=o;function o(h){switch(h.graph().ranker){case"network-simplex":c(h);break;case"tight-tree":u(h);break;case"longest-path":l(h);break;default:c(h)}}var l=n;function u(h){n(h),r(h)}function c(h){i(h)}return Hg}var Wg,fE;function k4(){if(fE)return Wg;fE=1;var e=lt();Wg=n;function n(o){var l=i(o);e.forEach(o.graph().dummyChains,function(u){for(var c=o.node(u),h=c.edgeObj,p=r(o,l,h.v,h.w),d=p.path,m=p.lca,y=0,w=d[y],N=!0;u!==h.w;){if(c=o.node(u),N){for(;(w=d[y])!==m&&o.node(w).maxRank<c.rank;)y++;w===m&&(N=!1)}if(!N){for(;y<d.length-1&&o.node(w=d[y+1]).minRank<=c.rank;)y++;w=d[y]}o.setParent(u,w),u=o.successors(u)[0]}})}function r(o,l,u,c){var h=[],p=[],d=Math.min(l[u].low,l[c].low),m=Math.max(l[u].lim,l[c].lim),y,w;y=u;do y=o.parent(y),h.push(y);while(y&&(l[y].low>d||m>l[y].lim));for(w=y,y=c;(y=o.parent(y))!==w;)p.push(y);return{path:h.concat(p.reverse()),lca:w}}function i(o){var l={},u=0;function c(h){var p=u;e.forEach(o.children(h),c),l[h]={low:p,lim:u++}}return e.forEach(o.children(),c),l}return Wg}var Vg,hE;function E4(){if(hE)return Vg;hE=1;var e=lt(),n=fn();Vg={run:r,cleanup:u};function r(c){var h=n.addDummyNode(c,"root",{},"_root"),p=o(c),d=e.max(e.values(p))-1,m=2*d+1;c.graph().nestingRoot=h,e.forEach(c.edges(),function(w){c.edge(w).minlen*=m});var y=l(c)+1;e.forEach(c.children(),function(w){i(c,h,m,y,d,p,w)}),c.graph().nodeRankFactor=m}function i(c,h,p,d,m,y,w){var N=c.children(w);if(!N.length){w!==h&&c.setEdge(h,w,{weight:0,minlen:p});return}var _=n.addBorderNode(c,"_bt"),b=n.addBorderNode(c,"_bb"),S=c.node(w);c.setParent(_,w),S.borderTop=_,c.setParent(b,w),S.borderBottom=b,e.forEach(N,function(k){i(c,h,p,d,m,y,k);var E=c.node(k),T=E.borderTop?E.borderTop:k,I=E.borderBottom?E.borderBottom:k,O=E.borderTop?d:2*d,A=T!==I?1:m-y[w]+1;c.setEdge(_,T,{weight:O,minlen:A,nestingEdge:!0}),c.setEdge(I,b,{weight:O,minlen:A,nestingEdge:!0})}),c.parent(w)||c.setEdge(h,_,{weight:0,minlen:m+y[w]})}function o(c){var h={};function p(d,m){var y=c.children(d);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),h[d]=m}return e.forEach(c.children(),function(d){p(d,1)}),h}function l(c){return e.reduce(c.edges(),function(h,p){return h+c.edge(p).weight},0)}function u(c){var h=c.graph();c.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(c.edges(),function(p){var d=c.edge(p);d.nestingEdge&&c.removeEdge(p)})}return Vg}var Gg,pE;function N4(){if(pE)return Gg;pE=1;var e=lt(),n=fn();Gg=r;function r(o){function l(u){var c=o.children(u),h=o.node(u);if(c.length&&e.forEach(c,l),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,d=h.maxRank+1;p<d;++p)i(o,"borderLeft","_bl",u,h,p),i(o,"borderRight","_br",u,h,p)}}e.forEach(o.children(),l)}function i(o,l,u,c,h,p){var d={width:0,height:0,rank:p,borderType:l},m=h[l][p-1],y=n.addDummyNode(o,"border",d,u);h[l][p]=y,o.setParent(y,c),m&&o.setEdge(m,y,{weight:1})}return Gg}var Yg,mE;function C4(){if(mE)return Yg;mE=1;var e=lt();Yg={adjust:n,undo:r};function n(p){var d=p.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&i(p)}function r(p){var d=p.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&l(p),(d==="lr"||d==="rl")&&(c(p),i(p))}function i(p){e.forEach(p.nodes(),function(d){o(p.node(d))}),e.forEach(p.edges(),function(d){o(p.edge(d))})}function o(p){var d=p.width;p.width=p.height,p.height=d}function l(p){e.forEach(p.nodes(),function(d){u(p.node(d))}),e.forEach(p.edges(),function(d){var m=p.edge(d);e.forEach(m.points,u),e.has(m,"y")&&u(m)})}function u(p){p.y=-p.y}function c(p){e.forEach(p.nodes(),function(d){h(p.node(d))}),e.forEach(p.edges(),function(d){var m=p.edge(d);e.forEach(m.points,h),e.has(m,"x")&&h(m)})}function h(p){var d=p.x;p.x=p.y,p.y=d}return Yg}var Kg,gE;function T4(){if(gE)return Kg;gE=1;var e=lt();Kg=n;function n(r){var i={},o=e.filter(r.nodes(),function(p){return!r.children(p).length}),l=e.max(e.map(o,function(p){return r.node(p).rank})),u=e.map(e.range(l+1),function(){return[]});function c(p){if(!e.has(i,p)){i[p]=!0;var d=r.node(p);u[d.rank].push(p),e.forEach(r.successors(p),c)}}var h=e.sortBy(o,function(p){return r.node(p).rank});return e.forEach(h,c),u}return Kg}var Xg,vE;function R4(){if(vE)return Xg;vE=1;var e=lt();Xg=n;function n(i,o){for(var l=0,u=1;u<o.length;++u)l+=r(i,o[u-1],o[u]);return l}function r(i,o,l){for(var u=e.zipObject(l,e.map(l,function(y,w){return w})),c=e.flatten(e.map(o,function(y){return e.sortBy(e.map(i.outEdges(y),function(w){return{pos:u[w.w],weight:i.edge(w).weight}}),"pos")}),!0),h=1;h<l.length;)h<<=1;var p=2*h-1;h-=1;var d=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(c.forEach(function(y){var w=y.pos+h;d[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=d[w+1]),w=w-1>>1,d[w]+=y.weight;m+=y.weight*N})),m}return Xg}var Qg,yE;function j4(){if(yE)return Qg;yE=1;var e=lt();Qg=n;function n(r,i){return e.map(i,function(o){var l=r.inEdges(o);if(l.length){var u=e.reduce(l,function(c,h){var p=r.edge(h),d=r.node(h.v);return{sum:c.sum+p.weight*d.order,weight:c.weight+p.weight}},{sum:0,weight:0});return{v:o,barycenter:u.sum/u.weight,weight:u.weight}}else return{v:o}})}return Qg}var Zg,wE;function A4(){if(wE)return Zg;wE=1;var e=lt();Zg=n;function n(o,l){var u={};e.forEach(o,function(h,p){var d=u[h.v]={indegree:0,in:[],out:[],vs:[h.v],i:p};e.isUndefined(h.barycenter)||(d.barycenter=h.barycenter,d.weight=h.weight)}),e.forEach(l.edges(),function(h){var p=u[h.v],d=u[h.w];!e.isUndefined(p)&&!e.isUndefined(d)&&(d.indegree++,p.out.push(u[h.w]))});var c=e.filter(u,function(h){return!h.indegree});return r(c)}function r(o){var l=[];function u(p){return function(d){d.merged||(e.isUndefined(d.barycenter)||e.isUndefined(p.barycenter)||d.barycenter>=p.barycenter)&&i(p,d)}}function c(p){return function(d){d.in.push(p),--d.indegree===0&&o.push(d)}}for(;o.length;){var h=o.pop();l.push(h),e.forEach(h.in.reverse(),u(h)),e.forEach(h.out,c(h))}return e.map(e.filter(l,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function i(o,l){var u=0,c=0;o.weight&&(u+=o.barycenter*o.weight,c+=o.weight),l.weight&&(u+=l.barycenter*l.weight,c+=l.weight),o.vs=l.vs.concat(o.vs),o.barycenter=u/c,o.weight=c,o.i=Math.min(l.i,o.i),l.merged=!0}return Zg}var Jg,xE;function I4(){if(xE)return Jg;xE=1;var e=lt(),n=fn();Jg=r;function r(l,u){var c=n.partition(l,function(_){return e.has(_,"barycenter")}),h=c.lhs,p=e.sortBy(c.rhs,function(_){return-_.i}),d=[],m=0,y=0,w=0;h.sort(o(!!u)),w=i(d,p,w),e.forEach(h,function(_){w+=_.vs.length,d.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,w=i(d,p,w)});var N={vs:e.flatten(d,!0)};return y&&(N.barycenter=m/y,N.weight=y),N}function i(l,u,c){for(var h;u.length&&(h=e.last(u)).i<=c;)u.pop(),l.push(h.vs),c++;return c}function o(l){return function(u,c){return u.barycenter<c.barycenter?-1:u.barycenter>c.barycenter?1:l?c.i-u.i:u.i-c.i}}return Jg}var ev,_E;function M4(){if(_E)return ev;_E=1;var e=lt(),n=j4(),r=A4(),i=I4();ev=o;function o(c,h,p,d){var m=c.children(h),y=c.node(h),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,_={};w&&(m=e.filter(m,function(I){return I!==w&&I!==N}));var b=n(c,m);e.forEach(b,function(I){if(c.children(I.v).length){var O=o(c,I.v,p,d);_[I.v]=O,e.has(O,"barycenter")&&u(I,O)}});var S=r(b,p);l(S,_);var k=i(S,d);if(w&&(k.vs=e.flatten([w,k.vs,N],!0),c.predecessors(w).length)){var E=c.node(c.predecessors(w)[0]),T=c.node(c.predecessors(N)[0]);e.has(k,"barycenter")||(k.barycenter=0,k.weight=0),k.barycenter=(k.barycenter*k.weight+E.order+T.order)/(k.weight+2),k.weight+=2}return k}function l(c,h){e.forEach(c,function(p){p.vs=e.flatten(p.vs.map(function(d){return h[d]?h[d].vs:d}),!0)})}function u(c,h){e.isUndefined(c.barycenter)?(c.barycenter=h.barycenter,c.weight=h.weight):(c.barycenter=(c.barycenter*c.weight+h.barycenter*h.weight)/(c.weight+h.weight),c.weight+=h.weight)}return ev}var tv,bE;function O4(){if(bE)return tv;bE=1;var e=lt(),n=nr().Graph;tv=r;function r(o,l,u){var c=i(o),h=new n({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(p){return o.node(p)});return e.forEach(o.nodes(),function(p){var d=o.node(p),m=o.parent(p);(d.rank===l||d.minRank<=l&&l<=d.maxRank)&&(h.setNode(p),h.setParent(p,m||c),e.forEach(o[u](p),function(y){var w=y.v===p?y.w:y.v,N=h.edge(w,p),_=e.isUndefined(N)?0:N.weight;h.setEdge(w,p,{weight:o.edge(y).weight+_})}),e.has(d,"minRank")&&h.setNode(p,{borderLeft:d.borderLeft[l],borderRight:d.borderRight[l]}))}),h}function i(o){for(var l;o.hasNode(l=e.uniqueId("_root")););return l}return tv}var nv,SE;function P4(){if(SE)return nv;SE=1;var e=lt();nv=n;function n(r,i,o){var l={},u;e.forEach(o,function(c){for(var h=r.parent(c),p,d;h;){if(p=r.parent(h),p?(d=l[p],l[p]=h):(d=u,u=h),d&&d!==h){i.setEdge(d,h);return}h=p}})}return nv}var rv,kE;function L4(){if(kE)return rv;kE=1;var e=lt(),n=T4(),r=R4(),i=M4(),o=O4(),l=P4(),u=nr().Graph,c=fn();rv=h;function h(y){var w=c.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),_=p(y,e.range(w-1,-1,-1),"outEdges"),b=n(y);m(y,b);for(var S=Number.POSITIVE_INFINITY,k,E=0,T=0;T<4;++E,++T){d(E%2?N:_,E%4>=2),b=c.buildLayerMatrix(y);var I=r(y,b);I<S&&(T=0,k=e.cloneDeep(b),S=I)}m(y,k)}function p(y,w,N){return e.map(w,function(_){return o(y,_,N)})}function d(y,w){var N=new u;e.forEach(y,function(_){var b=_.graph().root,S=i(_,b,N,w);e.forEach(S.vs,function(k,E){_.node(k).order=E}),l(_,N,S.vs)})}function m(y,w){e.forEach(w,function(N){e.forEach(N,function(_,b){y.node(_).order=b})})}return rv}var sv,EE;function $4(){if(EE)return sv;EE=1;var e=lt(),n=nr().Graph,r=fn();sv={positionX:N,findType1Conflicts:i,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function i(S,k){var E={};function T(I,O){var A=0,U=0,z=I.length,P=e.last(O);return e.forEach(O,function(D,V){var B=l(S,D),C=B?S.node(B).order:z;(B||D===P)&&(e.forEach(O.slice(U,V+1),function(q){e.forEach(S.predecessors(q),function(L){var re=S.node(L),J=re.order;(J<A||C<J)&&!(re.dummy&&S.node(q).dummy)&&u(E,L,q)})}),U=V+1,A=C)}),O}return e.reduce(k,T),E}function o(S,k){var E={};function T(O,A,U,z,P){var D;e.forEach(e.range(A,U),function(V){D=O[V],S.node(D).dummy&&e.forEach(S.predecessors(D),function(B){var C=S.node(B);C.dummy&&(C.order<z||C.order>P)&&u(E,B,D)})})}function I(O,A){var U=-1,z,P=0;return e.forEach(A,function(D,V){if(S.node(D).dummy==="border"){var B=S.predecessors(D);B.length&&(z=S.node(B[0]).order,T(A,P,V,U,z),P=V,U=z)}T(A,P,A.length,z,O.length)}),A}return e.reduce(k,I),E}function l(S,k){if(S.node(k).dummy)return e.find(S.predecessors(k),function(E){return S.node(E).dummy})}function u(S,k,E){if(k>E){var T=k;k=E,E=T}var I=S[k];I||(S[k]=I={}),I[E]=!0}function c(S,k,E){if(k>E){var T=k;k=E,E=T}return e.has(S[k],E)}function h(S,k,E,T){var I={},O={},A={};return e.forEach(k,function(U){e.forEach(U,function(z,P){I[z]=z,O[z]=z,A[z]=P})}),e.forEach(k,function(U){var z=-1;e.forEach(U,function(P){var D=T(P);if(D.length){D=e.sortBy(D,function(L){return A[L]});for(var V=(D.length-1)/2,B=Math.floor(V),C=Math.ceil(V);B<=C;++B){var q=D[B];O[P]===P&&z<A[q]&&!c(E,P,q)&&(O[q]=P,O[P]=I[P]=I[q],z=A[q])}}})}),{root:I,align:O}}function p(S,k,E,T,I){var O={},A=d(S,k,E,I),U=I?"borderLeft":"borderRight";function z(V,B){for(var C=A.nodes(),q=C.pop(),L={};q;)L[q]?V(q):(L[q]=!0,C.push(q),C=C.concat(B(q))),q=C.pop()}function P(V){O[V]=A.inEdges(V).reduce(function(B,C){return Math.max(B,O[C.v]+A.edge(C))},0)}function D(V){var B=A.outEdges(V).reduce(function(q,L){return Math.min(q,O[L.w]-A.edge(L))},Number.POSITIVE_INFINITY),C=S.node(V);B!==Number.POSITIVE_INFINITY&&C.borderType!==U&&(O[V]=Math.max(O[V],B))}return z(P,A.predecessors.bind(A)),z(D,A.successors.bind(A)),e.forEach(T,function(V){O[V]=O[E[V]]}),O}function d(S,k,E,T){var I=new n,O=S.graph(),A=_(O.nodesep,O.edgesep,T);return e.forEach(k,function(U){var z;e.forEach(U,function(P){var D=E[P];if(I.setNode(D),z){var V=E[z],B=I.edge(V,D);I.setEdge(V,D,Math.max(A(S,P,z),B||0))}z=P})}),I}function m(S,k){return e.minBy(e.values(k),function(E){var T=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;return e.forIn(E,function(O,A){var U=b(S,A)/2;T=Math.max(O+U,T),I=Math.min(O-U,I)}),T-I})}function y(S,k){var E=e.values(k),T=e.min(E),I=e.max(E);e.forEach(["u","d"],function(O){e.forEach(["l","r"],function(A){var U=O+A,z=S[U],P;if(z!==k){var D=e.values(z);P=A==="l"?T-e.min(D):I-e.max(D),P&&(S[U]=e.mapValues(z,function(V){return V+P}))}})})}function w(S,k){return e.mapValues(S.ul,function(E,T){if(k)return S[k.toLowerCase()][T];var I=e.sortBy(e.map(S,T));return(I[1]+I[2])/2})}function N(S){var k=r.buildLayerMatrix(S),E=e.merge(i(S,k),o(S,k)),T={},I;e.forEach(["u","d"],function(A){I=A==="u"?k:e.values(k).reverse(),e.forEach(["l","r"],function(U){U==="r"&&(I=e.map(I,function(V){return e.values(V).reverse()}));var z=(A==="u"?S.predecessors:S.successors).bind(S),P=h(S,I,E,z),D=p(S,I,P.root,P.align,U==="r");U==="r"&&(D=e.mapValues(D,function(V){return-V})),T[A+U]=D})});var O=m(S,T);return y(T,O),w(T,S.graph().align)}function _(S,k,E){return function(T,I,O){var A=T.node(I),U=T.node(O),z=0,P;if(z+=A.width/2,e.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":P=-A.width/2;break;case"r":P=A.width/2;break}if(P&&(z+=E?P:-P),P=0,z+=(A.dummy?k:S)/2,z+=(U.dummy?k:S)/2,z+=U.width/2,e.has(U,"labelpos"))switch(U.labelpos.toLowerCase()){case"l":P=U.width/2;break;case"r":P=-U.width/2;break}return P&&(z+=E?P:-P),P=0,z}}function b(S,k){return S.node(k).width}return sv}var iv,NE;function q4(){if(NE)return iv;NE=1;var e=lt(),n=fn(),r=$4().positionX;iv=i;function i(l){l=n.asNonCompoundGraph(l),o(l),e.forEach(r(l),function(u,c){l.node(c).x=u})}function o(l){var u=n.buildLayerMatrix(l),c=l.graph().ranksep,h=0;e.forEach(u,function(p){var d=e.max(e.map(p,function(m){return l.node(m).height}));e.forEach(p,function(m){l.node(m).y=h+d/2}),h+=d+c})}return iv}var ov,CE;function D4(){if(CE)return ov;CE=1;var e=lt(),n=x4(),r=_4(),i=S4(),o=fn().normalizeRanks,l=k4(),u=fn().removeEmptyRanks,c=E4(),h=N4(),p=C4(),d=L4(),m=q4(),y=fn(),w=nr().Graph;ov=N;function N($,Q){var ne=Q&&Q.debugTiming?y.time:y.notime;ne("layout",function(){var oe=ne(" buildLayoutGraph",function(){return z($)});ne(" runLayout",function(){_(oe,ne)}),ne(" updateInputGraph",function(){b($,oe)})})}function _($,Q){Q(" makeSpaceForEdgeLabels",function(){P($)}),Q(" removeSelfEdges",function(){H($)}),Q(" acyclic",function(){n.run($)}),Q(" nestingGraph.run",function(){c.run($)}),Q(" rank",function(){i(y.asNonCompoundGraph($))}),Q(" injectEdgeLabelProxies",function(){D($)}),Q(" removeEmptyRanks",function(){u($)}),Q(" nestingGraph.cleanup",function(){c.cleanup($)}),Q(" normalizeRanks",function(){o($)}),Q(" assignRankMinMax",function(){V($)}),Q(" removeEdgeLabelProxies",function(){B($)}),Q(" normalize.run",function(){r.run($)}),Q(" parentDummyChains",function(){l($)}),Q(" addBorderSegments",function(){h($)}),Q(" order",function(){d($)}),Q(" insertSelfEdges",function(){Z($)}),Q(" adjustCoordinateSystem",function(){p.adjust($)}),Q(" position",function(){m($)}),Q(" positionSelfEdges",function(){M($)}),Q(" removeBorderNodes",function(){J($)}),Q(" normalize.undo",function(){r.undo($)}),Q(" fixupEdgeLabelCoords",function(){L($)}),Q(" undoCoordinateSystem",function(){p.undo($)}),Q(" translateGraph",function(){C($)}),Q(" assignNodeIntersects",function(){q($)}),Q(" reversePoints",function(){re($)}),Q(" acyclic.undo",function(){n.undo($)})}function b($,Q){e.forEach($.nodes(),function(ne){var oe=$.node(ne),fe=Q.node(ne);oe&&(oe.x=fe.x,oe.y=fe.y,Q.children(ne).length&&(oe.width=fe.width,oe.height=fe.height))}),e.forEach($.edges(),function(ne){var oe=$.edge(ne),fe=Q.edge(ne);oe.points=fe.points,e.has(fe,"x")&&(oe.x=fe.x,oe.y=fe.y)}),$.graph().width=Q.graph().width,$.graph().height=Q.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],k={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],T=["width","height"],I={width:0,height:0},O=["minlen","weight","width","height","labeloffset"],A={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},U=["labelpos"];function z($){var Q=new w({multigraph:!0,compound:!0}),ne=Y($.graph());return Q.setGraph(e.merge({},k,G(ne,S),e.pick(ne,E))),e.forEach($.nodes(),function(oe){var fe=Y($.node(oe));Q.setNode(oe,e.defaults(G(fe,T),I)),Q.setParent(oe,$.parent(oe))}),e.forEach($.edges(),function(oe){var fe=Y($.edge(oe));Q.setEdge(oe,e.merge({},A,G(fe,O),e.pick(fe,U)))}),Q}function P($){var Q=$.graph();Q.ranksep/=2,e.forEach($.edges(),function(ne){var oe=$.edge(ne);oe.minlen*=2,oe.labelpos.toLowerCase()!=="c"&&(Q.rankdir==="TB"||Q.rankdir==="BT"?oe.width+=oe.labeloffset:oe.height+=oe.labeloffset)})}function D($){e.forEach($.edges(),function(Q){var ne=$.edge(Q);if(ne.width&&ne.height){var oe=$.node(Q.v),fe=$.node(Q.w),te={rank:(fe.rank-oe.rank)/2+oe.rank,e:Q};y.addDummyNode($,"edge-proxy",te,"_ep")}})}function V($){var Q=0;e.forEach($.nodes(),function(ne){var oe=$.node(ne);oe.borderTop&&(oe.minRank=$.node(oe.borderTop).rank,oe.maxRank=$.node(oe.borderBottom).rank,Q=e.max(Q,oe.maxRank))}),$.graph().maxRank=Q}function B($){e.forEach($.nodes(),function(Q){var ne=$.node(Q);ne.dummy==="edge-proxy"&&($.edge(ne.e).labelRank=ne.rank,$.removeNode(Q))})}function C($){var Q=Number.POSITIVE_INFINITY,ne=0,oe=Number.POSITIVE_INFINITY,fe=0,te=$.graph(),ce=te.marginx||0,Ce=te.marginy||0;function ve(je){var ye=je.x,ke=je.y,Ye=je.width,we=je.height;Q=Math.min(Q,ye-Ye/2),ne=Math.max(ne,ye+Ye/2),oe=Math.min(oe,ke-we/2),fe=Math.max(fe,ke+we/2)}e.forEach($.nodes(),function(je){ve($.node(je))}),e.forEach($.edges(),function(je){var ye=$.edge(je);e.has(ye,"x")&&ve(ye)}),Q-=ce,oe-=Ce,e.forEach($.nodes(),function(je){var ye=$.node(je);ye.x-=Q,ye.y-=oe}),e.forEach($.edges(),function(je){var ye=$.edge(je);e.forEach(ye.points,function(ke){ke.x-=Q,ke.y-=oe}),e.has(ye,"x")&&(ye.x-=Q),e.has(ye,"y")&&(ye.y-=oe)}),te.width=ne-Q+ce,te.height=fe-oe+Ce}function q($){e.forEach($.edges(),function(Q){var ne=$.edge(Q),oe=$.node(Q.v),fe=$.node(Q.w),te,ce;ne.points?(te=ne.points[0],ce=ne.points[ne.points.length-1]):(ne.points=[],te=fe,ce=oe),ne.points.unshift(y.intersectRect(oe,te)),ne.points.push(y.intersectRect(fe,ce))})}function L($){e.forEach($.edges(),function(Q){var ne=$.edge(Q);if(e.has(ne,"x"))switch((ne.labelpos==="l"||ne.labelpos==="r")&&(ne.width-=ne.labeloffset),ne.labelpos){case"l":ne.x-=ne.width/2+ne.labeloffset;break;case"r":ne.x+=ne.width/2+ne.labeloffset;break}})}function re($){e.forEach($.edges(),function(Q){var ne=$.edge(Q);ne.reversed&&ne.points.reverse()})}function J($){e.forEach($.nodes(),function(Q){if($.children(Q).length){var ne=$.node(Q),oe=$.node(ne.borderTop),fe=$.node(ne.borderBottom),te=$.node(e.last(ne.borderLeft)),ce=$.node(e.last(ne.borderRight));ne.width=Math.abs(ce.x-te.x),ne.height=Math.abs(fe.y-oe.y),ne.x=te.x+ne.width/2,ne.y=oe.y+ne.height/2}}),e.forEach($.nodes(),function(Q){$.node(Q).dummy==="border"&&$.removeNode(Q)})}function H($){e.forEach($.edges(),function(Q){if(Q.v===Q.w){var ne=$.node(Q.v);ne.selfEdges||(ne.selfEdges=[]),ne.selfEdges.push({e:Q,label:$.edge(Q)}),$.removeEdge(Q)}})}function Z($){var Q=y.buildLayerMatrix($);e.forEach(Q,function(ne){var oe=0;e.forEach(ne,function(fe,te){var ce=$.node(fe);ce.order=te+oe,e.forEach(ce.selfEdges,function(Ce){y.addDummyNode($,"selfedge",{width:Ce.label.width,height:Ce.label.height,rank:ce.rank,order:te+ ++oe,e:Ce.e,label:Ce.label},"_se")}),delete ce.selfEdges})})}function M($){e.forEach($.nodes(),function(Q){var ne=$.node(Q);if(ne.dummy==="selfedge"){var oe=$.node(ne.e.v),fe=oe.x+oe.width/2,te=oe.y,ce=ne.x-fe,Ce=oe.height/2;$.setEdge(ne.e,ne.label),$.removeNode(Q),ne.label.points=[{x:fe+2*ce/3,y:te-Ce},{x:fe+5*ce/6,y:te-Ce},{x:fe+ce,y:te},{x:fe+5*ce/6,y:te+Ce},{x:fe+2*ce/3,y:te+Ce}],ne.label.x=ne.x,ne.label.y=ne.y}})}function G($,Q){return e.mapValues(e.pick($,Q),Number)}function Y($){var Q={};return e.forEach($,function(ne,oe){Q[oe.toLowerCase()]=ne}),Q}return ov}var av,TE;function F4(){if(TE)return av;TE=1;var e=lt(),n=fn(),r=nr().Graph;av={debugOrdering:i};function i(o){var l=n.buildLayerMatrix(o),u=new r({compound:!0,multigraph:!0}).setGraph({});return e.forEach(o.nodes(),function(c){u.setNode(c,{label:c}),u.setParent(c,"layer"+o.node(c).rank)}),e.forEach(o.edges(),function(c){u.setEdge(c.v,c.w,{},c.name)}),e.forEach(l,function(c,h){var p="layer"+h;u.setNode(p,{rank:"same"}),e.reduce(c,function(d,m){return u.setEdge(d,m,{style:"invis"}),m})}),u}return av}var lv,RE;function z4(){return RE||(RE=1,lv="0.8.5"),lv}var uv,jE;function B4(){return jE||(jE=1,uv={graphlib:nr(),layout:D4(),debug:F4(),util:{time:fn().time,notime:fn().notime},version:z4()}),uv}var U4=B4();const AE=$v(U4),po=240,Cu=130,oo=74,Ju=72,IE=oo+Ju;function H4(e,n){var i;let r=po;for(const o of e)r=Math.max(r,((i=n.get(o.id))==null?void 0:i.width)??po);return r}const MT=420,W4=2;function ba(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function V4(e,n){return((n==null?void 0:n.get(e))??0)>0?MT:0}function G4(e,n){const r=(n==null?void 0:n.get(e))??0;return r>0?6+r*36:0}function Sa(e,n,r){const i=n.get(e);return{w:((i==null?void 0:i.width)??po)+V4(e,r),h:Math.max((i==null?void 0:i.height)??Cu,G4(e,r))}}function Y4(e){return[...e.keys()].sort().map(n=>`${n}:${e.get(n)}`).join("|")}function K4(e,n,r,i,o,l){const u=new AE.graphlib.Graph;u.setDefaultEdgeLabel(()=>({})),u.setGraph({rankdir:r,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const c=e.filter(S=>!o.has(S)),h=new Set(c);for(const S of c){const{w:k,h:E}=Sa(S,i,l);u.setNode(S,{width:k,height:E})}for(const S of n)h.has(S.source)&&h.has(S.target)&&u.setEdge(S.source,S.target);AE.layout(u);const p=new Map;let d=1/0,m=1/0,y=-1/0,w=-1/0;for(const S of c){const k=u.node(S);if(!k)continue;const E=i.get(S),T=(E==null?void 0:E.width)??po,I=(E==null?void 0:E.height)??Cu,O=Sa(S,i,l),A=k.x-O.w/2,U=k.y-O.h/2;p.set(S,{x:A,y:U}),A<d&&(d=A),U<m&&(m=U),A+T>y&&(y=A+T),U+I>w&&(w=U+I)}if(Number.isFinite(d)&&Number.isFinite(m))for(const[S,k]of p)p.set(S,{x:k.x-d,y:k.y-m});const N=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-m:0;let b=null;for(const S of e){const k=o.get(S);if(!k)continue;const E=i.get(S),T=(E==null?void 0:E.width)??po,I=(E==null?void 0:E.height)??Cu;b=b===null?{minX:k.x,minY:k.y,maxX:k.x+T,maxY:k.y+I}:{minX:Math.min(b.minX,k.x),minY:Math.min(b.minY,k.y),maxX:Math.max(b.maxX,k.x+T),maxY:Math.max(b.maxY,k.y+I)}}return{positions:p,width:N,height:_,pinnedBox:b}}function X4(e,n,r={}){const i=r.direction??"LR",o=r.pinned??new Map,l=r.measured??new Map,u=r.lanes,c=new Map;for(const S of e){const k=ba(S),E=c.get(k);E?E.push(S.id):c.set(k,[S.id])}const p=Array.from(c.keys()).sort().map(S=>({sid:S,...K4(c.get(S),n,i,l,o,u)})),d=H4(e,l),m=r.availableHeight&&r.availableHeight>0?r.availableHeight:Number.POSITIVE_INFINITY,y=S=>{const k=[[]];let E=0;for(const T of p)k.length<S&&E>0&&E+T.height>m&&(k.push([]),E=0),k[k.length-1].push(T),E+=T.height+IE;return k},w=S=>S.reduce((k,E)=>Math.max(k,E.width),0)+MT;let N=y(r.availableWidth?W4:1);N.length>1&&N.reduce((k,E)=>k+w(E),0)+d*(N.length-1)>(r.availableWidth??0)&&(N=y(1));const _=new Map;let b=0;for(const S of N){const k=w(S);let E=0;for(const{positions:T,height:I,pinnedBox:O}of S){for(const[U,z]of T)_.set(U,{x:z.x+b,y:z.y+E});let A=E+I;O&&O.maxY>A&&O.minX<b+k&&b<O.maxX&&(A=O.maxY),E=A+IE}b+=k+d}return e.map(S=>{const k=o.get(S.id);if(k)return{...S,position:k};const E=_.get(S.id);return E?{...S,position:E}:S})}function Q4(e,n,r,i,o){const u=oo+Ju,c=60,h=w=>Sa(w,i,o),p=new Map(e.map(w=>[w.id,ba(w)])),d=[],m=e.map(w=>({id:w.id,pos:r.get(w.id)??n.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),y=[];for(const{id:w,pos:N}of m){const{w:_,h:b}=h(w),S=p.get(w)??"_default";if(r.has(w)){d.push({x:N.x,y:N.y,w:_,h:b,sid:S});continue}let k=N.y;for(let E=0;E<d.length+1;E++){const T=d.find(I=>{const O=I.sid===S?24:c,A=I.sid===S?24:u;return N.x<I.x+I.w+O&&I.x<N.x+_+O&&k<I.y+I.h+A&&I.y<k+b+A});if(!T)break;k=T.y+T.h+(T.sid===S?24:u)}k!==N.y&&(n.set(w,{x:N.x,y:k}),y.push(w)),d.push({x:N.x,y:k,w:_,h:b,sid:S})}return y}function Z4(e,n,r,i,o,l){const u=_=>Sa(_,i,l),c=_=>r.get(_)??n.get(_),h=new Map;for(const _ of e){if(!c(_.id))continue;const b=ba(_),S=h.get(b);S?S.push(_):h.set(b,[_])}const p=new Set;for(const[_,b]of h)b.every(S=>o.has(S.id)&&!r.has(S.id))&&p.add(_);const d=new Map,m=[];for(const _ of e){const b=c(_.id);if(!b)continue;const{w:S,h:k}=u(_.id),E=ba(_);p.has(E)?(d.get(E)??d.set(E,[]).get(E)).push(_):m.push({x:b.x,y:b.y,w:S,h:k})}if(d.size===0)return[];const y=oo+Ju,w=(_,b,S,k)=>m.some(E=>_<E.x+E.w+oo&&E.x<_+S+oo&&b<E.y+E.h+y&&E.y<b+k+y),N=[];for(const _ of[...d.keys()].sort()){const b=d.get(_);let S=1/0,k=1/0,E=-1/0,T=-1/0;for(const D of b){const V=c(D.id),{w:B,h:C}=u(D.id);S=Math.min(S,V.x),k=Math.min(k,V.y),E=Math.max(E,V.x+B),T=Math.max(T,V.y+C)}const I=E-S,O=T-k,A=[...new Set(m.map(D=>Math.round(D.x)))].sort((D,V)=>D-V),U=A.length?A:[S],z=[0,...m.map(D=>D.y+D.h+y)].sort((D,V)=>D-V);let P=null;e:for(const D of U)for(const V of z){if(V>=k)break;if(!w(D,V,I,O)){P={x:D,y:V};break e}}if(P){const D=P.x-S,V=P.y-k;for(const B of b){const C=c(B.id);n.set(B.id,{x:C.x+D,y:C.y+V})}N.push(_)}for(const D of b){const V=c(D.id),{w:B,h:C}=u(D.id);m.push({x:V.x,y:V.y,w:B,h:C})}}return N}function J4(e,n,r,i,o,l=!1,u){const p=oo+Ju+1,d=8,m=1.75,y=200,w=.7,N=.01,_=P=>Sa(P,i,u),b=P=>r.get(P)??n.get(P),S=new Map;for(const P of e){if(!b(P.id))continue;const D=ba(P),V=S.get(D);V?V.push(P):S.set(D,[P])}const k=[],E=new Set,T=new Set,I=o.size===0;for(const P of[...S.keys()].sort()){const D=S.get(P);let V=1/0,B=1/0,C=-1/0,q=-1/0,L=!1;for(const Z of D){const M=b(Z.id),{w:G,h:Y}=_(Z.id);V=Math.min(V,M.x),B=Math.min(B,M.y),C=Math.max(C,M.x+G),q=Math.max(q,M.y+Y),r.has(Z.id)&&(L=!0)}const re=C-V,J=q-B;T.add(P);const H=o.get(P);H&&(re>H.w+d||J>H.h+d)&&E.add(P),o.set(P,{w:re,h:J}),k.push({sid:P,members:D.map(Z=>Z.id),x:V,y:B,w:re,h:J,anchored:L,mass:1})}for(const P of[...o.keys()])T.has(P)||o.delete(P);if(l||I)return[];let O=!1;for(let P=0;P<k.length&&!O;P++)for(let D=P+1;D<k.length;D++){const V=k[P],B=k[D];if(!(V.anchored&&B.anchored)&&Math.abs(V.x+V.w/2-(B.x+B.w/2))<(V.w+B.w)/2+61&&Math.abs(V.y+V.h/2-(B.y+B.h/2))<(V.h+B.h)/2+p){O=!0;break}}if(E.size===0&&!O)return[];if(E.size>0)for(const P of k)E.has(P.sid)&&(P.mass=8);else for(const P of k)P.mass=Math.max(1,P.w*P.h/(po*Cu));const A=new Map(k.map(P=>[P.sid,P.x])),U=new Map(k.map(P=>[P.sid,P.y]));for(let P=0;P<y;P++){const D=new Map,V=new Map;let B=0;for(let C=0;C<k.length;C++)for(let q=C+1;q<k.length;q++){const L=k[C],re=k[q];if(L.anchored&&re.anchored)continue;const J=L.x+L.w/2,H=L.y+L.h/2,Z=re.x+re.w/2,M=re.y+re.h/2,G=(L.w+re.w)/2+61-Math.abs(J-Z),Y=(L.h+re.h)/2+p-Math.abs(H-M);if(G<=0||Y<=0)continue;const $=(Fe,Je)=>!Fe.anchored&&!(Je<0&&Fe.x<=0),Q=(Fe,Je)=>!Fe.anchored&&!(Je<0&&Fe.y<=0),ne=(Fe,Je,Xe)=>{const Mt=Fe===Je,ut=Mt?L.sid<re.sid?-1:1:Math.sign(Fe-Je);return Xe(L,ut)||Xe(re,-ut)?ut:Mt&&(Xe(L,-ut)||Xe(re,ut))?-ut:0},oe=ne(J,Z,$),fe=ne(H,M,Q),te=oe!==0,ce=fe!==0;if(!te&&!ce)continue;const Ce=te&&(!ce||G*m<Y),[ve,je,ye,ke]=Ce?[oe,G,D,$]:[fe,Y,V,Q],Ye=ke(L,ve),we=ke(re,-ve),_e=L.mass,Be=re.mass,it=Ye?we?Be/(_e+Be):1:0,pt=we?Ye?_e/(_e+Be):1:0,Ze=je*w;ye.set(L.sid,(ye.get(L.sid)??0)+ve*Ze*it),ye.set(re.sid,(ye.get(re.sid)??0)-ve*Ze*pt),B+=Ze}for(const C of k)C.anchored||(C.x=Math.max(0,C.x+(D.get(C.sid)??0)),C.y=Math.max(0,C.y+(V.get(C.sid)??0)));if(B<N)break}const z=[];for(const P of k){const D=P.x-A.get(P.sid),V=P.y-U.get(P.sid);if(!(Math.abs(D)<1&&Math.abs(V)<1)){for(const B of P.members){if(r.has(B))continue;const C=n.get(B);C&&n.set(B,{x:C.x+D,y:C.y+V})}z.push(P.sid)}}return z}const e5=600;function Iv(e,n){return!(e.exitAt!=null&&n-e.exitAt>e5||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function t5(e,n){const r=new Set;for(const i of e.agents.values())Iv(i,n)&&r.add(i.id);return r}function n5(e,n,r=0){return e.right+r>n.left&&e.left-r<n.right&&e.bottom+r>n.top&&e.top-r<n.bottom}function r5(e,n,r=0){if(!e)return!1;for(const i of n)if(n5(e,i,r))return!0;return!1}const OT="sessionGroup";function s5(e,n){var i;if(e.type===OT)return"transparent";const r=(i=e.data)==null?void 0:i.state;return n(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const i5="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1).";function o5(e){if(e.checkDisabled)return i5;if(e.checking)return"Asking npm for the newest release…";const n=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",r=e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${n}${r} · re-checked periodically · click to check npm now`}function a5(e){const n=`Version v${e.running}`;return e.checkDisabled?`${n}, update checks are off`:e.checking?`${n}, checking npm for a newer release`:`${n}, check npm for a newer release`}function l5(e){const n=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`;return`Version v${e.from}, ${n} — ${e.open?"hide":"show"} the notice`}function u5(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 n=e.trim();return n===""?{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:n,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}const Mv={kind:"assumed",claude:!0,codex:!0};function c5(e){if(!e||typeof e!="object")return Mv;const n=e.providers;if(!n||typeof n!="object")return Mv;const r=n;return{kind:"reported",claude:r.claude!==!1,codex:r.codex!==!1}}function d5(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}function f5(e){return e.claude&&e.codex?"Claude Code hooks and Codex rollout files":e.claude?"Claude Code hooks":e.codex?"Codex rollout files":null}function h5(e){const n=d5(e);return n?`Distinct sessions — ${n}`:"Distinct sessions"}function p5(e){const n=f5(e);return n?`Total events received — ${n}`:"Total events received"}function m5(e){const n=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:"."}]},r=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[n,r]}function g5(e,n){const r=n.on?"Sound on turn finish: on — click to remove the hook":"Sound on turn finish: off — click to add a Stop hook",i=e.codex?`
67
+
68
+ Claude Code turns only. The sound is a Stop hook Claude Code runs itself when a turn ends; the deck installs nothing for Codex and reads its rollout files after the fact, so Codex turns finish in silence.`:"",o=n.clash>0?`
69
+
70
+ ${n.clash} sound hook${n.clash>1?"s":""} of your own in settings.json also run${n.clash>1?"":"s"} here.`:"",l=n.parked>0?`
71
+
72
+ ${n.parked} of your own sound hook${n.parked>1?"s were":" was"} set aside so this switch actually controls the sound. Nothing was deleted — shift-click to put ${n.parked>1?"them":"it"} back.`:"";return r+i+o+l}function PT(e){const n=Math.max(0,Math.floor(e));return`${n} event${n===1?"":"s"}`}function v5(e){return e.connected?e.paused?{tone:"paused",label:"paused",title:e.held>0?`Connected — ${PT(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",label:"live",title:"Receiving events"}:{tone:"dead",label:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function y5(e){return e.paused?e.held<=0?{label:"Resume",title:"Nothing has arrived since you paused. Resume to follow the canvas again (Space)"}:{label:`Resume · ${e.held} held`,title:`${PT(e.held)} arrived while paused and will be applied in order when you resume (Space)`}:{label:"Pause",title:"Pause live updates — events keep arriving and are applied when you resume (Space)"}}function LT(e,n){return e!==""&&n>0}function w5(e,n,r){return e===""?{active:!1,matched:n,total:r,count:null,empty:!1,message:null,dim:!1}:{active:!0,matched:n,total:r,count:`${n} of ${r}`,empty:n===0,message:n===0?`No agents match “${e}”`:null,dim:LT(e,n)}}const x5="Search agents, tools, model…";function $T(e,n){var i,o,l,u;if(!n)return!0;const r=n.toLowerCase();if(e.label.toLowerCase().includes(r)||(i=e.cwd)!=null&&i.toLowerCase().includes(r)||(o=e.cwdBasename)!=null&&o.toLowerCase().includes(r)||e.sessionId.toLowerCase().includes(r)||(l=e.firstPrompt)!=null&&l.toLowerCase().includes(r)||e.model&&(e.model.toLowerCase().includes(r)||Ns(e.model).toLowerCase().includes(r))||(u=e.provider)!=null&&u.toLowerCase().startsWith(r))return!0;for(const c of e.tools)if(c.name.toLowerCase().includes(r))return!0;return!1}function Ov(e){const n=Math.max(0,Math.floor(e/1e3));return n<60?"just now":n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function _5(e,n){return e.getFullYear()===n.getFullYear()&&e.getMonth()===n.getMonth()&&e.getDate()===n.getDate()}function b5(e,n,r){const i=new Date(e),o=Ov(n-e);return{label:_5(i,new Date(n))?o:`${o} · ${i.toLocaleDateString(r,{month:"short",day:"numeric"})}`,title:i.toLocaleString(r,{dateStyle:"medium",timeStyle:"medium"})}}function aa(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const S5={agent:QP,sessionGroup:dL},qT="react-flow__node";function ME(e){var n,r;return!!e&&((r=(n=e.classList)==null?void 0:n.contains)==null?void 0:r.call(n,qT))===!0}function k5(e){try{const n=document.querySelector(`.${qT}[data-id="${CSS.escape(e)}"]`);n==null||n.focus({preventScroll:!0})}catch{}}const E5=420,au=18,N5=9e4,C5=200,T5=5*6e4,R5=6,j5=2*6e4,Sy="agent-dag.layout",ky="agent-dag.viewport",DT="agent-dag.summariesDismissed",FT="agent-dag.sessionListOpen",zT="agent-dag.detailOpen",BT="agent-dag.usagePanelOpen",OE="agent-dag.accountsPanelOpen",PE="agent-dag.versionNoticeDismissed",LE="agent-dag.oldNameNoticeDismissed",A5=15*6e4,$E={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:"},qE="agent-dag.autoRestart",DE="agent-dag.bundleReloadedFor";function I5(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(FT)==="1"}catch{return!1}}function M5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(FT,e?"1":"0")}catch{}}function O5(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(zT)==="1"}catch{return!1}}function P5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(zT,e?"1":"0")}catch{}}function L5(){const e=IC(BT);return e===null?!0:e==="1"}function $5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(BT,e?"1":"0")}catch{}}function q5(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(DT);if(!e)return new Set;const n=JSON.parse(e);return new Set(Array.isArray(n)?n.filter(r=>typeof r=="string"):[])}catch{return new Set}}function FE(e){if(!(typeof window>"u"))try{const n=Array.from(e),r=n.length>200?n.slice(-200):n;window.localStorage.setItem(DT,JSON.stringify(r))}catch{}}function D5(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const n=window.localStorage.getItem(Sy);if(!n)return e;const r=JSON.parse(n);if(!("v"in r)){const o=Object.entries(r).filter(([,l])=>l&&typeof l.x=="number"&&typeof l.y=="number");return{positions:o,pins:o.map(([l])=>l)}}return{positions:Object.entries(r.positions??{}).filter(([,o])=>o&&typeof o.x=="number"&&typeof o.y=="number"),pins:Array.isArray(r.pins)?r.pins:[]}}catch{return e}}function cv(e,n){if(!(typeof window>"u"))try{const r={};for(const[i,o]of e)r[i]=o;for(const[i,o]of n)r[i]=o;window.localStorage.setItem(Sy,JSON.stringify({v:2,positions:r,pins:Array.from(n.keys())}))}catch{}}function F5(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(ky);if(!e)return null;const n=JSON.parse(e);return typeof(n==null?void 0:n.x)!="number"||typeof(n==null?void 0:n.y)!="number"||typeof(n==null?void 0:n.zoom)!="number"?null:n}catch{return null}}function z5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ky,JSON.stringify(e))}catch{}}function zE(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Sy)}catch{}try{window.localStorage.removeItem(ky)}catch{}}}function B5(e,n){const r=e.agents.get(n);if(!r)return;const i=[];for(const d of e.agents.values())d.sessionId===n&&i.push(d);const o={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:n,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:i.map(d=>({id:d.id,kind:d.kind,label:d.label,parentId:d.parentId,state:d.state,startedAt:d.startedAt,endedAt:d.endedAt,model:d.model,cwd:d.cwd,usage:d.usage,prompts:d.prompts,tools:d.tools.map(m=>({id:m.id,name:m.name,inputPreview:m.inputPreview,startedAt:m.startedAt,endedAt:m.endedAt,ok:m.ok,errorPreview:m.errorPreview,usage:m.usage}))}))},l=JSON.stringify(o,null,2),u=new Blob([l],{type:"application/json"}),c=URL.createObjectURL(u),h=document.createElement("a"),p=(r.label||"session").replace(/[^a-z0-9._-]/gi,"_");h.href=c,h.download=`${en}-${p}-${n.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const Pv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Lv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},UT=SC;function U5(e,n){if(!n)return null;const r=new Set([n]);let i=n;for(;i;){const l=e.agents.get(i);if(!(l!=null&&l.parentId)||r.has(l.parentId))break;r.add(l.parentId),i=l.parentId}let o=!0;for(;o;){o=!1;for(const l of e.agents.values())l.parentId&&r.has(l.parentId)&&!r.has(l.id)&&(r.add(l.id),o=!0)}return r}function H5(e,n,r,i,o,l,u,c,h,p,d,m,y,w,N,_,b,S,k){const E=[],T=[],I=new Set;if(l)for(const B of e.agents.values())S.has(B.id)&&$T(B,l)&&I.add(B.id);const O=LT(l,I.size);for(const B of e.agents.values()){if(!S.has(B.id))continue;const C=O&&!I.has(B.id),q=B.exitAt!=null,L=b!=null&&!b.has(B.id),re=[C?"rf-dim":"",q?"rf-exiting":"",L?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,J=u.get(B.id);if(E.push({id:B.id,type:"agent",position:{x:0,y:0},data:{...B,now:n,onOpenContext:k},className:re,...J?{width:J.width,height:J.height}:null}),B.parentId&&S.has(B.parentId)){const H=ty(B.sessionId),Z=l&&!I.has(B.id)&&!I.has(B.parentId),M=q,G=_.size>0&&(_.has(B.id)||_.has(B.parentId)),Y=b!=null&&!b.has(B.id)&&!b.has(B.parentId),$=B.state==="active"?2:1.5,Q=G?$+1.5:$,ne=Z||M?.2:Y?.12:1,oe=["sess-edge",B.state==="active"?"sess-live":"sess-idle",M?"rf-edge-exiting":"",G?"rf-edge-selected":""].filter(Boolean).join(" ");T.push({id:`e:${B.parentId}->${B.id}`,source:B.parentId,target:B.id,animated:(B.state==="active"||G)&&!Z&&!M,type:"smoothstep",style:{"--session-hue":H,strokeWidth:Q,opacity:ne,transition:"var(--edge-transition)"},className:oe})}}const A=new Map;for(const B of e.agents.values())B.tools.length>0&&A.set(B.id,Math.min(4,B.tools.length));const U=`${w}#lanes:${Y4(A)}`,z=E.filter(B=>i$(B.id,o,m,y));if(z.length>0||U!==N.current){if(z.length>0){const B=X4(E,T,{direction:"LR",pinned:o,measured:u,availableWidth:r,availableHeight:i,lanes:A});for(const C of B)AC(C.id,m,y)&&a$(C.id,C.position,m,y);Z4(E,m,o,u,new Set(z.map(C=>C.id)),A)}Q4(E,m,o,u,A),N.current=U}const P=J4(E,m,o,u,c,!p||d,A);P.length>0&&h(P),ru(m,e.agents),ru(y,e.agents),ru(o,e.agents),ru(u,s$(e.agents.values()));const D=[];let V=!1;for(const B of E){let C=o.get(B.id)??m.get(B.id);C||(C=o$(B.id,m,y),V=!0),D.push({...B,position:C})}return V&&(N.current=""),{nodes:D,edges:T}}function W5(){return g.jsx(ey,{children:g.jsx(V5,{})})}function V5(){var Wa,Va,Ga,Ya;const e=Ta(),n=j.useRef(Cv()),[,r]=j.useState(0),i=j.useCallback(()=>r(W=>W+1),[]),[o,l]=j.useState(()=>new Set),[u,c]=j.useState(null),[h,p]=j.useState(null),d=j.useCallback((W,K)=>{l(le=>{if(!K)return new Set([W]);const de=new Set(le);return de.has(W)?de.delete(W):de.add(W),de}),c(le=>K&&le===W?le:W)},[]),m=j.useCallback(()=>{l(new Set),c(null)},[]),[y,w]=j.useState(null),[N,_]=j.useState(null),b=j.useCallback(W=>_(W),[]),[S,k]=j.useState(!1),E=j.useRef(q5()),[T,I]=j.useState(I5);j.useEffect(()=>{M5(T)},[T]);const[O,A]=j.useState(O5);j.useEffect(()=>{P5(O)},[O]);const[U,z]=j.useState(L5);j.useEffect(()=>{$5(U)},[U]);const[P,D]=j.useState(()=>{try{const W=window.localStorage.getItem(OE);return W===null?!0:W==="1"}catch{return!0}});j.useEffect(()=>{try{window.localStorage.setItem(OE,P?"1":"0")}catch{}},[P]);const[V,B]=j.useState(null),[C,q]=j.useState(!1),[L,re]=j.useState(0),[J,H]=j.useState(0);j.useEffect(()=>{fetch("/api/sound-hook").then(W=>W.ok?W.json():null).then(W=>{W!=null&&W.ok&&(B(W.enabled===!0),re((W.foreign??[]).filter(K=>K.worksHere).length),H(typeof W.parked=="number"?W.parked:0))}).catch(()=>{})},[]);const Z=j.useCallback(async()=>{q(!0);try{const K=await(await fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!V})})).json().catch(()=>null);K!=null&&K.ok&&B(K.enabled===!0),fetch("/api/sound-hook").then(le=>le.ok?le.json():null).then(le=>{le!=null&&le.ok&&(re((le.foreign??[]).filter(de=>de.worksHere).length),H(typeof le.parked=="number"?le.parked:0))}).catch(()=>{})}catch{}finally{q(!1)}},[V]),[M,G]=j.useState(!1),[Y,$]=j.useState(null),[Q,ne]=j.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(PE)??""}catch{return""}}),[oe,fe]=j.useState(!1),te=j.useRef(0),[ce,Ce]=j.useState(!1),ve=j.useCallback((W=!1)=>{W&&(te.current=Date.now(),Ce(!0)),fetch(W?"/api/version?refresh=1":"/api/version").then(K=>K.ok?K.json():null).then(K=>{K&&$(K)}).catch(()=>{}).finally(()=>{W&&Ce(!1)})},[]),je=j.useCallback(()=>{ve(Date.now()-te.current>=A5)},[ve]);j.useEffect(()=>{ve();const W=window.setInterval(je,5*6e4),K=()=>{document.visibilityState==="visible"&&je()};return document.addEventListener("visibilitychange",K),()=>{window.clearInterval(W),document.removeEventListener("visibilitychange",K)}},[ve,je]),j.useEffect(()=>{M&&ve()},[M,ve]);const ye=(Y==null?void 0:Y.notice)??null,[ke,Ye]=j.useState(null),[we,_e]=j.useState(Mv);j.useEffect(()=>{let W=!1;return fetch("/api/health").then(K=>K.ok?K.json():null).then(K=>{W||(_e(c5(K)),!(!K||typeof K.workspace!="string")&&Ye(K.workspace))}).catch(()=>{}),()=>{W=!0}},[M]);const Be=j.useRef(we);Be.current=we;const it=ye?`${ye.kind}:${ye.to}`:"",pt=ye!=null&&Q!==it,Ze=j.useCallback(()=>{if(!ye)return;const W=Q===it?"":it;ne(W);try{window.localStorage.setItem(PE,W)}catch{}},[ye,it,Q]),[Fe,Je]=j.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(LE)??""}catch{return""}}),Xe=Y!=null&&Y.invokedAs&&Y.invokedAs!==en?Y.invokedAs:null,Mt=Xe!=null&&Fe!==Xe,ut=j.useCallback(()=>{if(Xe){Je(Xe);try{window.localStorage.setItem(LE,Xe)}catch{}}},[Xe]),Qe=((Wa=Y==null?void 0:Y.upgrade)==null?void 0:Wa.state)??"idle",Ot=G3(Y==null?void 0:Y.upgrade),Ft=j.useCallback(async()=>{try{await fetch("/api/upgrade",{method:"POST"})}catch{}ve()},[ve]);j.useEffect(()=>{if(Qe!=="running")return;const W=window.setInterval(ve,3e3);return()=>window.clearInterval(W)},[Qe,ve]);const et=j.useCallback(async()=>{var le;const W=Y==null?void 0:Y.command;if(!W)return;let K=!1;try{K=await Promise.race([((le=navigator.clipboard)==null?void 0:le.writeText(W).then(()=>!0))??Promise.resolve(!1),new Promise(de=>window.setTimeout(()=>de(!1),500))])}catch{K=!1}if(!K)try{const de=document.createElement("textarea");de.value=W,de.setAttribute("readonly",""),de.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(de),de.select(),K=document.execCommand("copy"),de.remove()}catch{K=!1}K&&(fe(!0),window.setTimeout(()=>fe(!1),1600))},[Y==null?void 0:Y.command]),St=j.useCallback(()=>{I(W=>(W||D(!1),!W))},[]),mt=j.useCallback(()=>{D(W=>(W||I(!1),!W))},[]),[wt,hn]=j.useState(!1),[Yt,Pt]=j.useState(0),Sn=j.useRef(null),[gr,kn]=j.useState(!1),zt=j.useRef(null),[Fn,pn]=j.useState(0),vr=j.useRef(d$()),[Wr,gi]=j.useState(!1),Vr=j.useCallback(()=>{const W=vr.current,K=W.setPaused(!W.paused);for(const le of K)n.current=Dx(n.current,le);gi(W.paused)},[]),[ct,vi]=j.useState(Date.now()),[mn,Ts]=j.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(qE)!=="0"}catch{return!0}}),yr=j.useCallback(()=>{Ts(W=>{const K=!W;try{window.localStorage.setItem(qE,K?"1":"0")}catch{}return K})},[]),[zn,En]=j.useState(!1),[Gr,Yr]=j.useState("restart"),[Kr,yi]=j.useState(null),ir=j.useRef(!1),Rs=j.useRef(null),Nn=j.useRef(0),wr=j.useCallback(async W=>{if(ir.current)return;const K=(W==null?void 0:W.upgrade)===!0;ir.current=!0,Rs.current=Ot;const le=++Nn.current;Yr(K?"npx":"restart"),En(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(ye==null?void 0:ye.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:K})})}catch{}window.setTimeout(()=>{if(Nn.current===le&&ir.current){ir.current=!1,En(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},K?18e4:3e4)},[ye==null?void 0:ye.to,Ot]),js=j.useRef(null);j.useEffect(()=>{let W=!1;for(const le of n.current.agents.values())if(le.state==="active"){W=!0;break}const K=K3({enabled:mn,kind:ye==null?void 0:ye.kind,canRestart:(Y==null?void 0:Y.canRestart)===!0,busy:W,idleSince:js.current,now:ct});js.current=K.idleSince,K.restart&&wr()},[mn,ye==null?void 0:ye.kind,Y==null?void 0:Y.canRestart,ct,wr]),j.useEffect(()=>{const W=Y==null?void 0:Y.running;let K=null,le=null;try{K=window.sessionStorage.getItem("agent-dag.restartPending"),le=window.sessionStorage.getItem(DE)}catch{return}const de=V3({bundle:"1.35.15",running:W,pending:K,lastTried:le});if(de==="reload"){try{window.sessionStorage.setItem(DE,W??"")}catch{return}window.location.reload();return}if(de!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ir.current=!1,En(!1),yi(W??null);const xe=window.setTimeout(()=>yi(null),6e3);return()=>window.clearTimeout(xe)},[Y==null?void 0:Y.running]),j.useEffect(()=>{if(zn&&Y3({asked:Rs.current,reported:Ot})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ir.current=!1,En(!1)}},[zn,Ot]);const As=j.useRef(D5()).current;j.useRef(!1);const Rt=j.useRef(new Map(As.positions.filter(([W])=>As.pins.includes(W)))),xr=j.useRef(null),_r=j.useState(()=>F5())[0],[Kt,Xr]=j.useState(""),[wi,nt]=j.useState(()=>new Set),[br,Qr]=j.useState(g$),[Is,Zr]=j.useState(!1),Jr=j.useRef(null);j.useEffect(()=>{document.documentElement.dataset.theme=br;try{window.localStorage.setItem(MC,br)}catch{}},[br]),j.useEffect(()=>{if(!_r)return;const W=window.setTimeout(()=>{try{e.setViewport(_r,{duration:0})}catch{}},60);return()=>window.clearTimeout(W)},[e,_r]);const Ms=j.useRef(!0);j.useEffect(()=>{const W=new EventSource("/events"),K=c$(i,{now:()=>Date.now(),setTimeout:(le,de)=>window.setTimeout(le,de),clearTimeout:le=>window.clearTimeout(le)});return W.addEventListener("open",()=>{G(!0),Zr(!0)}),W.addEventListener("error",()=>G(!1)),W.addEventListener("replay-end",()=>{Ms.current=!1,K.flush()}),W.addEventListener("hook",le=>{try{const de=JSON.parse(le.data);if(!vr.current.accept(de))return;n.current=Dx(n.current,de),de.replay===!0||Ms.current||Date.now()-de.receivedAt>3e4?K.replay():K.live()}catch{}}),()=>{W.close(),K.cancel()}},[i]),j.useEffect(()=>{const W=setInterval(()=>{const K=Date.now();vi(K);let le=pP(n.current,K,N5);gP(n.current,K,mP)&&(le=!0),fP(n.current,K,C5,T5)&&(le=!0),hP(n.current,K,R5,j5)&&(le=!0),le&&i()},250);return()=>clearInterval(W)},[i]);const or=j.useRef(null),kt=j.useRef(0),Os=420,gt=j.useCallback((W=500)=>{try{const Ee=document.querySelector(".canvas-wrap"),Oe=Array.from(document.querySelectorAll(".react-flow__node")).filter(ot=>ot.offsetWidth>0);if(!Ee||Oe.length===0)return;const ze=Ee.getBoundingClientRect(),Ge=e.getViewport();if(!Number.isFinite(Ge.zoom)||Ge.zoom<=0)return;const Ve=ot=>(ot-ze.left-Ge.x)/Ge.zoom,qe=ot=>(ot-ze.top-Ge.y)/Ge.zoom,Tn=Oe.map(ot=>ot.getBoundingClientRect()),Hs=Math.min(...Tn.map(ot=>Ve(ot.left))),jo=Math.max(...Tn.map(ot=>Ve(ot.right))),Ws=Math.min(...Tn.map(ot=>qe(ot.top))),Ao=Math.max(...Tn.map(ot=>qe(ot.bottom))),Ka=jo-Hs,Ci=Ao-Ws;if(!(Ka>0&&Ci>0))return;const yn=Math.max(.2,Math.min(1,(ze.width-160)/(Ka+Os)*.86,(ze.height-160)/Ci*.86));e.setViewport({x:80-Hs*yn,y:Math.max(80,(ze.height-Ci*yn)/2)-Ws*yn,zoom:yn},{duration:W}),kt.current=Date.now(),window.setTimeout(()=>{try{const ot={x:80-Hs*yn,y:Math.max(80,(ze.height-Ci*yn)/2)-Ws*yn,zoom:yn},Xa=e.getViewport();(Math.abs(Xa.zoom-yn)>.01||Math.abs(Xa.x-ot.x)>2)&&e.setViewport(ot,{duration:0})}catch{}},W+60)}catch{}},[e]),_o=j.useRef(""),bo=j.useRef(null),La=j.useRef(0),Sr=j.useCallback(()=>{La.current=Date.now()},[]),es="agent-dag.autoFitDisabled",gn=j.useRef((()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(es)==="1"}catch{return!1}})()),[Ps,$a]=j.useState(gn.current),qa=j.useCallback(()=>{if(!gn.current){gn.current=!0,$a(!0);try{window.localStorage.setItem(es,"1")}catch{}}},[]),So=j.useCallback(()=>{gn.current=!1,$a(!1);try{window.localStorage.removeItem(es)}catch{}gt(400)},[e,gt]);j.useEffect(()=>{const W=setInterval(()=>{if(gn.current||Date.now()-La.current<800)return;const K=n.current,le=Date.now(),de=[];for(const Ve of K.agents.values())Iv(Ve,le)&&de.push({id:Ve.id});if(de.length===0)return;const xe=e.getViewport(),Ee=window.innerWidth-360,Oe=window.innerHeight-52;let ze=!1,Ge=!1;for(const{id:Ve}of de){const qe=ar.current.get(Ve),Tn=Rt.current.get(Ve)??Xt.current.get(Ve);if(!qe||!Tn)continue;Ge=!0;const Hs=Tn.x*xe.zoom+xe.x,jo=Tn.y*xe.zoom+xe.y,Ws=(Tn.x+qe.width)*xe.zoom+xe.x,Ao=(Tn.y+qe.height)*xe.zoom+xe.y;if(Ws>0&&Hs<Ee&&Ao>0&&jo<Oe){ze=!0;break}}Ge&&!ze&&gt(600)},1500);return()=>clearInterval(W)},[e]);const xi=j.useRef(!1),ar=j.useRef(new Map),ts=j.useRef(0),ec=j.useCallback(W=>{const K=ar.current;let le=!1;for(const de of W.nodeInternals.values()){const xe=de.width,Ee=de.height;if(xe==null||Ee==null)continue;const Oe=K.get(de.id);Oe?(Math.abs(Oe.height-Ee)>4||Math.abs(Oe.width-xe)>4)&&(K.set(de.id,{width:xe,height:Ee}),le=!0):(K.set(de.id,{width:xe,height:Ee}),le=!0)}return le&&(ts.current+=1),ts.current},[]),_i=Ke(ec),[He,Da]=j.useState(0);j.useEffect(()=>{let W=0;const K=()=>{const de=ar.current;let xe=!1;for(const Ee of document.querySelectorAll(".react-flow__node[data-id]")){const Oe=Ee.getAttribute("data-id");if(!Oe)continue;const ze=Ee.offsetWidth,Ge=Ee.offsetHeight;if(!ze||!Ge)continue;const Ve=de.get(Oe);(!Ve||Math.abs(Ve.width-ze)>4||Math.abs(Ve.height-Ge)>4)&&(de.set(Oe,{width:ze,height:Ge}),xe=!0)}xe&&Da(Ee=>Ee+1)};if(xi.current)return;let le=0;return document.visibilityState==="hidden"?le=window.setTimeout(K,32):W=requestAnimationFrame(K),()=>{cancelAnimationFrame(W),window.clearTimeout(le)}});const Xt=j.useRef(new Map(As.positions)),ko=j.useRef(new Set),bi=j.useRef(""),kr=j.useMemo(()=>{const W=[];for(const K of n.current.agents.values())Iv(K,ct)&&W.push(K.id+(K.parentId?`>${K.parentId}`:""));return W.sort(),`${W.join("|")}#sv${_i}.${He}`},[n.current,n.current.lastSeq,ct,_i,He]),ns=j.useRef(null);j.useEffect(()=>(ns.current!=null&&window.clearTimeout(ns.current),ns.current=window.setTimeout(()=>{cv(Xt.current,Rt.current)},1500),()=>{ns.current!=null&&window.clearTimeout(ns.current)}),[kr]),j.useEffect(()=>{if(_o.current===kr)return;const W=_o.current;if(_o.current=kr,!W||gn.current)return;Date.now()-kt.current>1200&&gt(400),or.current&&window.clearTimeout(or.current),or.current=window.setTimeout(()=>{gn.current||gt(500)},280)},[kr,e,gt]);const Ls=j.useMemo(()=>{if(o.size===0)return null;const W=new Set;for(const K of o){const le=U5(n.current,K);if(le)for(const de of le)W.add(de)}return W.size>0?W:null},[n.current,n.current.lastSeq,o]),Cn=j.useMemo(()=>t5(n.current,ct),[n.current,n.current.lastSeq,ct]),Bn=j.useRef(null),[vn,Un]=j.useState({w:0,h:0});j.useEffect(()=>{const W=Bn.current;if(!W||typeof ResizeObserver>"u")return;const K=new ResizeObserver(le=>{var xe;const de=(xe=le[0])==null?void 0:xe.contentRect;de&&Un(Ee=>Math.abs(Ee.w-de.width)>40||Math.abs(Ee.h-de.height)>40?{w:de.width,h:de.height}:Ee)});return K.observe(W),Un({w:W.clientWidth,h:W.clientHeight}),()=>K.disconnect()},[]);const $s=j.useRef(new Map),[rs,lr]=j.useState(!1);j.useEffect(()=>{const W=window.setTimeout(()=>lr(!0),2500);return()=>window.clearTimeout(W)},[]);const[tc,Si]=j.useState(!1),tn=j.useRef(null),[Eo,No]=j.useState(!1),ki=j.useCallback(()=>{tn.current&&(window.clearTimeout(tn.current),tn.current=null),Si(!1)},[]),Fa=j.useCallback(W=>{W.length!==0&&queueMicrotask(()=>{Si(!0),tn.current&&window.clearTimeout(tn.current),tn.current=window.setTimeout(()=>Si(!1),E5+80)})},[]);j.useEffect(()=>()=>{tn.current&&window.clearTimeout(tn.current)},[]);const za=vn.w>0?vn.w*.92:0,ss=vn.h>0?vn.h:0,{nodes:nn,edges:is}=j.useMemo(()=>H5(n.current,ct,za,ss,Rt.current,Kt,ar.current,$s.current,Fa,rs,Eo,Xt.current,ko.current,kr,bi,o,Ls,Cn,b),[n.current,n.current.lastSeq,ct,za,ss,rs,Eo,Kt,kr,o,Ls,Cn,b,Yt]),qs=j.useMemo(()=>{const W=new Map;for(const le of nn){const de=le.data;if(!(de!=null&&de.sessionId)||de.exitAt!=null)continue;const xe=le.width,Ee=le.height;if(xe==null||Ee==null)continue;const Oe=le.position.x,ze=le.position.y,Ge=Oe+xe,Ve=ze+Ee,qe=W.get(de.sessionId);qe?(qe.minX=Math.min(qe.minX,Oe),qe.minY=Math.min(qe.minY,ze),qe.maxX=Math.max(qe.maxX,Ge),qe.maxY=Math.max(qe.maxY,Ve)):W.set(de.sessionId,{minX:Oe,minY:ze,maxX:Ge,maxY:Ve})}const K=[];for(const[le,de]of W){const xe=de.maxX-de.minX+au*2,Ee=de.maxY-de.minY+au*2;K.push({id:`group:${le}`,type:OT,position:{x:de.minX-au,y:de.minY-au},data:{sessionId:le,w:xe,h:Ee},width:xe,height:Ee,style:{width:xe,height:Ee},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return K},[nn,ct]),nc=j.useMemo(()=>{const W=[...qs,...nn],K=zt.current;return!K||K.size===0?W:W.map(le=>{const de=K.get(le.id);return de?{...le,position:de}:le})},[qs,nn,Fn]),Ds=j.useMemo(()=>{if(!Kt)return null;const W=new Set;for(const K of n.current.agents.values())Cn.has(K.id)&&$T(K,Kt)&&W.add(K.id);return W},[n.current,n.current.lastSeq,Kt,Cn]),Hn=j.useMemo(()=>w5(Kt,(Ds==null?void 0:Ds.size)??0,Cn.size),[Kt,Ds,Cn]),Er=j.useMemo(()=>{const W=new Set;for(const K of n.current.agents.values())for(const le of K.tools)W.add(UT(le.name));return Object.keys(Pv).filter(K=>W.has(K))},[n.current,n.current.lastSeq]);j.useEffect(()=>{if(Er.length<=1){kn(!1);return}let W=0;const K=()=>{const le=Sn.current;if(le&&!document.hidden){const de=le.getBoundingClientRect(),xe=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Oe=>Oe.getBoundingClientRect()),Ee=r5(de,xe,8);kn(Oe=>Oe===Ee?Oe:Ee)}W=window.setTimeout(K,300)};return K(),()=>window.clearTimeout(W)},[Er.length]);const Nr=j.useMemo(()=>{const W=new Map;for(const le of n.current.agents.values())for(const de of le.tools){if(!de.name.startsWith("mcp__"))continue;const xe=de.name.slice(5),Ee=xe.indexOf("__"),Oe=Ee>0?xe.slice(0,Ee):xe;W.set(Oe,(W.get(Oe)??0)+1)}const K=[];for(const[le,de]of W){let xe=5381;for(let Ee=0;Ee<le.length;Ee++)xe=(xe<<5)+xe^le.charCodeAt(Ee);K.push({server:le,count:de,hue:Math.abs(xe)%360})}return K.sort((le,de)=>de.count-le.count),K},[n.current,n.current.lastSeq]),Ba=j.useCallback(W=>{nt(K=>{const le=new Set(K);return le.has(W)?le.delete(W):le.add(W),le})},[]),dt=u?n.current.agents.get(u):null,Fs=h?Array.from(n.current.agents.values()).flatMap(W=>W.tools).find(W=>W.id===h)??null:null,zs=j.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}n.current=Cv(),Rt.current.clear(),ar.current.clear(),Xt.current.clear(),bi.current="",zE(),m(),i()},[i,m]),Co=j.useRef(S);Co.current=S;const Bs=j.useRef(!1);Bs.current=Fs!=null||wt||N!=null||y!=null;const Cr=j.useCallback(W=>{const K=Q3(W,{confirmOpen:Co.current,modalOpen:Bs.current});K==="confirm"?k(!0):K==="clear"&&(k(!1),zs())},[zs]),Ei=j.useCallback(()=>{Rt.current.clear(),Xt.current.clear(),bi.current="",zE(),i(),window.setTimeout(()=>gt(500),80)},[i,e,gt]),Bt=j.useCallback(()=>gt(500),[gt]),Wn=j.useRef(nn);Wn.current=nn;const Ni=j.useRef(u);Ni.current=u;const Tr=j.useCallback(W=>{const K=Wn.current,le=J3(K.map(Ee=>({id:Ee.id,x:Ee.position.x,y:Ee.position.y})),Ni.current,W),de=le?K.find(Ee=>Ee.id===le):void 0;if(!de)return;const xe=ME(document.activeElement);d(de.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[de]})}catch{}kt.current=Date.now(),xe&&k5(de.id)},30)},[d,e]),Ua=j.useCallback(W=>{d(W,!1),window.setTimeout(()=>{try{const K=Wn.current.find(le=>le.id===W);K&&e.fitView({padding:.3,duration:500,nodes:[K]}),kt.current=Date.now()}catch{}},60)},[d,e]);j.useEffect(()=>{const W=K=>{var ze,Ge,Ve;const le=K.target,de={tagName:le==null?void 0:le.tagName,isContentEditable:le==null?void 0:le.isContentEditable,role:(ze=le==null?void 0:le.getAttribute)==null?void 0:ze.call(le,"role"),type:le==null?void 0:le.type};if(K.key==="Escape"){const qe=PP({overlayOpen:Eu.depth()>0,typing:ny(de)});qe==="dismiss"?Eu.dismissTop():qe==="blur"?le==null||le.blur():(r$(de)&&(le==null||le.blur()),m());return}if(xC(K))return;const xe=ME(le)?(Ge=le==null?void 0:le.getAttribute)==null?void 0:Ge.call(le,"data-id"):null,Ee=xe&&Wn.current.some(qe=>qe.id===xe)?xe:null,Oe=t$(K,Ee);if(Oe.kind==="activate"){K.preventDefault(),d(Oe.nodeId,Oe.additive);return}if(Oe.kind!=="node"&&!(Oe.nodeId==null&&UP(de))){if(K.key==="/"){K.preventDefault(),(Ve=Jr.current)==null||Ve.focus();return}K.key===" "&&(K.preventDefault(),Vr()),(K.key==="c"||K.key==="C")&&Cr("shortcut"),(K.key==="r"||K.key==="R")&&Ei(),(K.key==="f"||K.key==="F")&&Bt(),(K.key==="l"||K.key==="L")&&St(),(K.key==="h"||K.key==="H")&&hn(qe=>!qe),(K.key==="u"||K.key==="U")&&z(qe=>!qe),(K.key==="a"||K.key==="A")&&Be.current.claude&&mt(),(K.key==="j"||K.key==="J")&&Tr(1),(K.key==="k"||K.key==="K")&&Tr(-1),(K.key==="t"||K.key==="T")&&Qr(qe=>qe==="dark"?"light":"dark")}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[Cr,Ei,Bt,m,d,Tr,Vr]);const Rr=n.current.agents.size,To=new Set(Array.from(n.current.agents.values()).map(W=>W.sessionId)).size,Qt=j.useMemo(()=>JL(n.current.agents.values()),[n.current,n.current.lastSeq]),Us=j.useMemo(()=>e3(n.current.agents.values()),[n.current,n.current.lastSeq]),Ro=j.useRef(null);j.useEffect(()=>{const W=v$({waiting:Qt.length,running:Us}),K=Ro.current;if(Ro.current=W,(K==null?void 0:K.title)!==W.title&&(document.title=W.title),(K==null?void 0:K.icon)!==W.icon){const le=document.querySelector('link[rel="icon"]');le&&(le.href=y$[W.icon])}},[Qt.length,Us]);const[rc,sc]=j.useState(""),Ha=x$(Qt);j.useEffect(()=>{sc(W=>_$(W,Ha))},[Ha]);const Ut=j.useMemo(()=>{let W=0,K=0,le=0,de=0,xe=0,Ee=0,Oe=0,ze=0,Ge=0;for(const Ve of n.current.agents.values()){W+=Ve.usage.inputTokens,K+=Ve.usage.outputTokens,le+=Ve.usage.cacheReadTokens,de+=Ve.usage.cacheCreateTokens;const qe=dn(Ve.usage,Ve.model);xe+=qe.total,Ee+=qe.input,Oe+=qe.output,ze+=qe.cacheRead,Ge+=qe.cacheWrite}return{inT:W,outT:K,cacheR:le,cacheC:de,sum:W+K,cost:{total:xe,input:Ee,output:Oe,cacheRead:ze,cacheWrite:Ge}}},[n.current,n.current.lastSeq]);return g.jsxs("div",{className:"app",children:[g.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),g.jsxs("header",{className:"topbar",children:[g.jsxs("div",{className:"brand",children:[g.jsx("span",{className:"logo"}),g.jsx("h1",{children:en}),ye?g.jsxs("button",{type:"button",className:"v stale",onClick:Ze,"aria-label":l5({...ye,open:pt}),title:ye.kind==="restart"?`Running v${ye.from}; v${ye.to} is installed on disk. Restart to pick it up.`:`Running v${ye.from}; v${ye.to} is on npm.`,children:["v",ye.from,g.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const W={running:(Y==null?void 0:Y.running)??"1.35.15",latest:Y==null?void 0:Y.latest,latestPending:Y==null?void 0:Y.latestPending,checkedAgo:Y!=null&&Y.checkedAt?Ov(ct-Y.checkedAt):null,checkDisabled:Y==null?void 0:Y.checkDisabled,checking:ce};return g.jsxs("button",{type:"button",className:ce?"v checking":"v",onClick:()=>ve(!0),"aria-busy":ce||void 0,"aria-label":a5(W),title:o5(W),children:["v",W.running]})})()]}),dt&&(()=>{const W=dn(dt.usage,dt.model),K=Math.max(0,((dt.endedAt??ct)-dt.startedAt)/1e3),le=dt.state==="active"?ku(W.total,K):null,de=o.size-1;return g.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${dt.label}`,onClick:()=>{try{const xe=nn.find(Ee=>Ee.id===dt.id);xe&&e.fitView({padding:.35,duration:500,nodes:[xe]}),kt.current=Date.now()}catch{}},children:[g.jsx("span",{className:`state-pill state-${dt.state}`,children:dt.state==="active"?"live":dt.state}),g.jsx("span",{className:"selected-label",children:dt.label}),W.total>0&&g.jsxs("span",{className:"selected-cost",children:[De(W.total),le?g.jsxs("span",{className:"selected-rate",children:[" · ",le]}):null]}),de>0&&g.jsxs("span",{className:"selected-extra",children:["+",de]}),g.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:xe=>{xe.stopPropagation(),m()},children:"×"})]})})(),g.jsxs("div",{className:"actions",children:[g.jsxs("div",{className:"search",children:[g.jsx("span",{className:"search-icon","aria-hidden":!0,children:"⌕"}),g.jsx("input",{ref:Jr,type:"text",placeholder:x5,value:Kt,onChange:W=>Xr(W.target.value),spellCheck:!1,"aria-label":"Filter the graph"}),Kt?g.jsx("button",{className:"search-clear","aria-label":"Clear search",onClick:()=>Xr(""),children:"×"}):g.jsx("kbd",{className:"search-kbd","aria-hidden":!0,children:"/"}),Hn.count&&g.jsx("span",{className:`search-count${Hn.empty?" none":""}`,"aria-live":"polite",title:`${Hn.count} agents on the canvas match “${Kt}”`,children:Hn.count})]}),g.jsxs("span",{className:"status",children:[(()=>{const W=v5({connected:M,paused:Wr,held:vr.current.size});return g.jsx("span",{className:`pill ${W.tone}`,title:W.title,children:W.label})})(),g.jsxs("span",{className:"stat",title:h5(we),children:[g.jsx("span",{className:"count",children:To}),g.jsx("span",{className:"lbl",children:"sessions"})]}),g.jsxs("span",{className:"stat",title:"Total agents (root + subagents)",children:[g.jsx("span",{className:"count",children:Rr}),g.jsx("span",{className:"lbl",children:"agents"})]}),g.jsxs("span",{className:"stat",title:p5(we),children:[g.jsx("span",{className:"count",children:n.current.totalEvents}),g.jsx("span",{className:"lbl",children:"events"})]}),Ut.sum>0&&g.jsxs("span",{className:"stat",title:`in:${Ut.inT.toLocaleString()} out:${Ut.outT.toLocaleString()} cache-r:${Ut.cacheR.toLocaleString()} cache-c:${Ut.cacheC.toLocaleString()}`,children:[g.jsx("span",{className:"count",children:qt(Ut.sum)}),g.jsx("span",{className:"lbl",children:"tokens"})]}),Nr.length>0&&g.jsxs("span",{className:"stat mcp-legend",title:`MCP servers seen this session:
67
73
  ${Nr.map(W=>` ${W.server}: ${W.count} call${W.count===1?"":"s"}`).join(`
68
74
  `)}`,children:[Nr.slice(0,6).map(W=>g.jsx("span",{className:"mcp-dot",style:{"--mcp-hue":W.hue}},W.server)),Nr.length>6&&g.jsxs("span",{className:"mcp-more",children:["+",Nr.length-6]}),g.jsx("span",{className:"lbl",children:"mcp"})]}),Ut.cost.total>0&&(()=>{let W=0,K=0;for(const xe of n.current.agents.values()){if(xe.state!=="active")continue;const Ee=dn(xe.usage,xe.model);W+=Ee.total,K=Math.max(K,((xe.endedAt??ct)-xe.startedAt)/1e3)}const le=K>0?ku(W,K):null,de=`input ${De(Ut.cost.input)} + output ${De(Ut.cost.output)} + cache r ${De(Ut.cost.cacheRead)} + cache w ${De(Ut.cost.cacheWrite)}${le?`
69
75
  active burn: ${le}`:""}`;return g.jsxs("span",{className:"stat",title:de,children:[g.jsx("span",{className:"count",children:De(Ut.cost.total)}),g.jsxs("span",{className:"lbl",children:["cost",le?` · ${le}`:""]})]})})()]}),g.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:rc}),Qt.length>0&&g.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>Ua(Qt[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
70
76
  ${Qt.map(W=>` ${W.label}: ${Pu(W.waiting)} (${Ov(ct-W.waiting.since)})`).join(`
71
- `)}`,"aria-label":`${Qt.length} session${Qt.length===1?"":"s"} waiting for you`,children:[g.jsx("span",{className:"ap-pulse","aria-hidden":!0}),g.jsx("b",{children:Qt.length})," waiting"]}),(()=>{const W=m5({paused:Wr,held:vr.current.size});return g.jsx("button",{className:`btn ${Wr?"warn":""}`,onClick:Vr,title:W.title,children:W.label})})(),g.jsx("button",{className:"btn icon-btn",onClick:()=>z(W=>!W),title:`${U?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":U,"aria-controls":U?"usage-panel":void 0,children:"$"}),V!==null&&g.jsx("button",{className:"btn icon-btn",onClick:W=>{if(W.shiftKey&&Z>0){q(!0),fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restore"})}).then(()=>fetch("/api/sound-hook")).then(K=>K.ok?K.json():null).then(K=>{K!=null&&K.ok&&(B(K.enabled===!0),H(K.parked??0))}).catch(()=>{}).finally(()=>q(!1));return}J()},disabled:C,title:(V?"Sound on turn finish: on — click to remove the hook":"Sound on turn finish: off — click to add a Stop hook")+(L>0?`
72
-
73
- ${L} sound hook${L>1?"s":""} of your own in settings.json also run${L>1?"":"s"} here.`:"")+(Z>0?`
74
-
75
- ${Z} of your own sound hook${Z>1?"s were":" was"} set aside so this switch actually controls the sound. Nothing was deleted — shift-click to put ${Z>1?"them":"it"} back.`:""),"aria-label":"Toggle finish sound","aria-pressed":V,children:g.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:[g.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),V?g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),g.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M10 5.6l2.6 2.8"}),g.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),we.claude&&g.jsx("button",{className:"btn icon-btn",onClick:mt,title:`${P?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":P,"aria-controls":P?"accounts-panel":void 0,children:g.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:[g.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),g.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),g.jsx("button",{className:"btn icon-btn",onClick:St,title:`${T?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":T,"aria-controls":T?"session-list":void 0,children:"☰"}),g.jsx("button",{className:"btn icon-btn",onClick:()=>hn(W=>!W),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[g.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),g.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),g.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),g.jsx("button",{className:"btn",onClick:Ei,title:"Auto-arrange — clear pins (R)",children:"Re-layout"}),g.jsx("button",{className:"btn",onClick:()=>Cr("button"),title:"Clear the canvas and the server's event log — asks first (C)",children:"Clear"}),g.jsx("button",{className:"btn icon-btn",onClick:()=>Qr(W=>W==="dark"?"light":"dark"),title:`Switch to ${br==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:br==="dark"?"☀":"☾"})]})]}),Kr?g.jsxs("div",{className:"ver-banner done",role:"status",children:[g.jsx("span",{className:"ver-dot"}),g.jsxs("strong",{children:["Restarted — now running v",Kr,"."]}),g.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Is&&!M?g.jsxs("div",{className:"conn-banner",role:"alert",children:[g.jsx("span",{className:"conn-dot"}),zn?Gr==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${en}…`:`Lost connection to the ${en} server. Reconnecting…`]}):pt&&ye?g.jsxs("div",{className:`ver-banner ${ye.kind}`,role:"status",children:[g.jsx("span",{className:"ver-dot"}),ye.kind==="restart"?g.jsxs(g.Fragment,{children:[g.jsxs("strong",{children:["v",ye.to," is installed — this deck still runs v",ye.from,"."]}),Y!=null&&Y.canRestart?g.jsxs(g.Fragment,{children:[g.jsx("button",{type:"button",className:"ver-act",onClick:()=>wr(),disabled:zn,title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:zn?"restarting…":"Restart now"}),g.jsxs("button",{type:"button",className:`ver-auto${mn?" on":""}`,role:"switch","aria-checked":mn,onClick:yr,title:mn?"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:[g.jsx("i",{"aria-hidden":!0}),"auto when idle"]})]}):g.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."})]}):g.jsxs(g.Fragment,{children:[g.jsxs("strong",{children:[en," v",ye.to," is out — you are on v",ye.from,"."]}),(Y==null?void 0:Y.upgradeMode)==="install"&&Qe!=="failed"&&g.jsx("button",{type:"button",className:"ver-act",onClick:Ft,disabled:Qe==="running"||Qe==="done",title:`Runs ${((Va=Y==null?void 0:Y.upgrade)==null?void 0:Va.command)??(Y==null?void 0:Y.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Qe==="running"?"installing…":Qe==="done"?"installed":"Update now"}),(Y==null?void 0:Y.upgradeMode)==="npx"&&(Y==null?void 0:Y.canRestart)&&g.jsx("button",{type:"button",className:"ver-act",onClick:()=>wr({upgrade:!0}),disabled:zn,title:`Runs ${Y==null?void 0:Y.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:zn?"fetching…":Qe==="failed"?"Retry update":"Update & restart"}),Qe==="failed"?g.jsxs("span",{className:"ver-sub fail",title:((Ga=Y==null?void 0:Y.upgrade)==null?void 0:Ga.error)??"",children:[(Y==null?void 0:Y.upgradeMode)==="npx"?"update failed":"install failed",": ",((Ya=Y==null?void 0:Y.upgrade)==null?void 0:Ya.error)??"unknown error"," — run it yourself:"]}):(Y==null?void 0:Y.upgradeMode)==="npx"?g.jsx("span",{className:"ver-sub",children:Y!=null&&Y.canRestart?"npx cannot upgrade in place, so the deck re-runs:":LE.npx}):Y!=null&&Y.upgradeBlocked?g.jsx("span",{className:"ver-sub",children:LE[Y.upgradeBlocked]??"cannot install from here"}):null,g.jsxs("button",{type:"button",className:"ver-cmd",onClick:et,title:"Copy to clipboard",children:[g.jsx("code",{children:Y==null?void 0:Y.command}),g.jsx("span",{className:"ver-cmd-hint",children:oe?"copied":"copy"})]})]}),g.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Ze,children:"×"})]}):Mt&&Xe?g.jsxs("div",{className:"ver-banner",role:"status",children:[g.jsx("span",{className:"ver-dot"}),g.jsxs("strong",{children:[Xe," still works — the deck is called ",en," now."]}),Y!=null&&Y.renameFix?g.jsx("span",{className:"ver-sub",children:Y.renameFix}):null,g.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:ut,children:"×"})]}):null,U&&g.jsx(c3,{state:n.current,now:ct,providers:we,onClose:()=>z(!1)}),P&&we.claude&&g.jsx(z3,{onClose:()=>D(!1)}),T&&g.jsx(e3,{state:n.current,now:ct,selectedIds:o,onSelect:Ua,onClose:()=>I(!1)}),g.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${tc?" bubbling":""}${Eo?" dragging-any":""}`,ref:Bn,children:[Rr===0&&g.jsx(H5,{live:M,everConnected:Is,providers:we}),Hn.empty&&Rr>0&&g.jsxs("div",{className:"search-empty",role:"status",children:[g.jsx("span",{className:"search-empty-text",children:Hn.message}),g.jsx("button",{type:"button",className:"btn",onClick:()=>{var W;Xr(""),(W=Jr.current)==null||W.focus()},children:"Clear search"})]}),Er.length>1&&g.jsx("div",{ref:Sn,className:`cat-filter-bar${gr?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Er.map(W=>{const K=wi.has(W);return g.jsxs("button",{type:"button",className:`cat-filter${K?" off":""}`,onClick:()=>Ba(W),"aria-pressed":!K,title:`${K?"Show":"Hide"} ${Lv[W]} tools`,children:[g.jsx("span",{className:"cat-emoji",children:Pv[W]}),g.jsx("span",{className:"cat-name",children:Lv[W]})]},W)})}),g.jsxs(iC,{nodes:nc,edges:is,nodeTypes:x5,fitView:!_r,fitViewOptions:{padding:.25,duration:400},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(W,K)=>{if(K.type==="sessionGroup"){m();return}d(K.id,W.shiftKey)},onPaneClick:()=>m(),onMoveStart:()=>{Date.now()-kt.current<1200||qa()},onMove:(W,K)=>{Sr(),bo.current&&window.clearTimeout(bo.current),bo.current=window.setTimeout(()=>q5(K),250)},onNodeDragStart:(W,K)=>{var le;if(ki(),xi.current=!0,zt.current=new Map,No(!0),Sr(),qa(),K.type==="sessionGroup"){const de=(le=K.data)==null?void 0:le.sessionId,xe=new Map;if(de)for(const Ee of nn){const Oe=Ee.data;(Oe==null?void 0:Oe.sessionId)===de&&xe.set(Ee.id,{x:Ee.position.x,y:Ee.position.y})}xr.current={start:{x:K.position.x,y:K.position.y},members:xe};return}Rt.current.set(K.id,{x:K.position.x,y:K.position.y})},onNodeDrag:(W,K)=>{var le;if(Sr(),K.type==="sessionGroup"){const de=xr.current;if(!de)return;const xe=K.position.x-de.start.x,Ee=K.position.y-de.start.y;for(const[ze,Ge]of de.members){const Ve={x:Ge.x+xe,y:Ge.y+Ee};Rt.current.set(ze,Ve),Xt.current.set(ze,Ve)}const Oe=zt.current;if(Oe){for(const[ze,Ge]of de.members)Oe.set(ze,{x:Ge.x+xe,y:Ge.y+Ee});Oe.set(K.id,{x:K.position.x,y:K.position.y})}pn(ze=>ze+1);return}Rt.current.set(K.id,{x:K.position.x,y:K.position.y}),Xt.current.set(K.id,{x:K.position.x,y:K.position.y}),(le=zt.current)==null||le.set(K.id,{x:K.position.x,y:K.position.y}),pn(de=>de+1)},onNodeDragStop:(W,K)=>{if(Sr(),xi.current=!1,zt.current=null,No(!1),Pt(le=>le+1),K.type==="sessionGroup"){const le=xr.current;if(le){const de=K.position.x-le.start.x,xe=K.position.y-le.start.y;for(const[Ee,Oe]of le.members){const ze={x:Oe.x+de,y:Oe.y+xe};Rt.current.set(Ee,ze),Xt.current.set(Ee,ze)}}xr.current=null,cv(Xt.current,Rt.current),Pt(de=>de+1);return}Rt.current.set(K.id,{x:K.position.x,y:K.position.y}),Xt.current.set(K.id,{x:K.position.x,y:K.position.y}),cv(Xt.current,Rt.current)},children:[g.jsx(tP,{gap:28,size:1,color:aa("--grid-line")}),g.jsx(aL,{}),g.jsx(VL,{agents:n.current.agents,visibleAgentIds:Cn,positions:Xt.current,pinned:Rt.current,measured:ar.current,dimUnmatched:Hn.dim?Ds:null,spotlight:Ls,hiddenCategories:wi,now:ct,onOpenTool:p}),g.jsx(KO,{showInteractive:!1,children:g.jsx(to,{onClick:So,title:Ps?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Ps?{color:"var(--accent)"}:void 0,children:g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[g.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),g.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})})}),g.jsx(BO,{zoomable:!0,pannable:!0,nodeColor:W=>n5(W,aa),nodeStrokeWidth:2,maskColor:aa("--minimap-mask"),style:{background:aa("--panel"),border:`1px solid ${aa("--line")}`,borderRadius:8}})]})]}),O?g.jsxs("aside",{className:"detail","aria-label":"Detail",children:[g.jsx("button",{type:"button",className:"detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>A(!1),children:"×"}),dt?g.jsx(G5,{agent:dt,now:ct,onOpenTool:p,onShowSummary:W=>{E.current.has(W)&&(E.current.delete(W),DE(E.current)),w(W)},onExportSession:W=>D5(n.current,W)}):g.jsx(V5,{count:Rr,workspace:ke})]}):g.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>A(!0),children:"‹"}),Fs&&g.jsx(nL,{tool:Fs,onClose:()=>p(null)}),wt&&g.jsx(E$,{onClose:()=>hn(!1)}),N&&(()=>{const W=n.current.agents.get(N);return W?g.jsx(GP,{agent:W,onClose:()=>_(null)}):null})(),y&&g.jsx(YL,{state:n.current,sessionId:y,onClose:()=>{E.current.add(y),DE(E.current),w(null)}}),S&&g.jsx(Y3,{agentCount:Rr,onConfirm:()=>Cr("confirmation"),onCancel:()=>k(!1)})]})}function H5({live:e,everConnected:n,providers:r}){const i=!e;return g.jsxs("div",{className:"empty-hero",children:[g.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[g.jsx("div",{className:"core"}),g.jsxs("div",{className:"orbit r1",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]}),g.jsxs("div",{className:"orbit r2",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]}),g.jsxs("div",{className:"orbit r3",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]})]}),i?g.jsxs(g.Fragment,{children:[g.jsx("h2",{children:n?"Disconnected from server":"Server unreachable"}),g.jsxs("p",{children:["The browser cannot reach ",g.jsx("code",{children:"/events"}),". Check that",g.jsx("code",{children:en})," is still running in your terminal, then this page will resume automatically."]})]}):W5(r)]})}function W5(e){return g.jsxs(g.Fragment,{children:[g.jsx("h2",{children:"Waiting for Claude Code or Codex"}),g.jsxs("p",{children:["Run ",g.jsx("code",{children:"claude"})," or ",g.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."]}),g.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",g.jsx("code",{children:en})," is running."]}),h5(e).map(n=>g.jsx("p",{className:"hint-row",children:n.spans.map((r,i)=>r.code?g.jsx("code",{children:r.text},i):g.jsx("span",{children:r.text},i))},n.provider))]})}function V5({count:e,workspace:n}){const r=a5(n);return g.jsxs(g.Fragment,{children:[g.jsx("h2",{children:"Detail"}),e===0?g.jsxs("div",{className:"hint",children:[r.lead,r.workspace!==null&&g.jsxs(g.Fragment,{children:[" ",g.jsx("code",{children:r.workspace}),r.tail]})]}):g.jsx("div",{className:"empty",children:"Click an agent to see its tools."}),g.jsx("h3",{style:{marginTop:4},children:"Shortcuts"}),g.jsxs("div",{className:"shortcuts",children:[g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"drag"}),g.jsx("span",{children:"move a node"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"tab"}),g.jsx("span",{children:"reach the cards"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"enter"}),g.jsx("span",{children:"select the focused card"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"/"}),g.jsx("span",{children:"focus search"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"space"}),g.jsx("span",{children:"pause / resume"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"J"}),g.jsx("span",{children:"next agent"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"K"}),g.jsx("span",{children:"previous agent"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"R"}),g.jsx("span",{children:"re-arrange"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"F"}),g.jsx("span",{children:"fit view"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"L"}),g.jsx("span",{children:"session list"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"H"}),g.jsx("span",{children:"usage history"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"U"}),g.jsx("span",{children:"usage panel"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"C"}),g.jsx("span",{children:"clear canvas"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"T"}),g.jsx("span",{children:"toggle theme"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"Esc"}),g.jsx("span",{children:"deselect, release focus"})]})]})]})}function G5({agent:e,now:n,onOpenTool:r,onShowSummary:i,onExportSession:o}){const l=(e.endedAt??n)-e.startedAt,u=Math.max(0,Math.floor(l/1e3)),c=u<60?`${u}s`:`${Math.floor(u/60)}m ${String(u%60).padStart(2,"0")}s`,h=dn(e.usage,e.model),p=h.total>0,d=e.usage.inputTokens+e.usage.outputTokens,m=new Map;for(const _ of e.tools){const b=BT(_.name);m.set(b,(m.get(b)??0)+1)}const y=e.tools.filter(_=>_.ok===!1).length,w=e.tools.filter(_=>!_.endedAt).length,N=Array.from(m.entries()).sort((_,b)=>b[1]-_[1]);return g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:"detail-hero",children:[g.jsxs("div",{className:"hero-line",children:[g.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),g.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),g.jsxs("div",{className:"hero-meta",children:[g.jsx("span",{className:"hero-meta-item",children:e.kind}),g.jsx("span",{className:"hero-sep",children:"·"}),g.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:c}),e.model&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"hero-sep",children:"·"}),g.jsx("span",{className:"model-chip",title:e.model,children:Ns(e.model)})]})]}),p&&g.jsxs("div",{className:"hero-cost",children:[g.jsxs("div",{className:"hero-cost-headline",children:[g.jsx("span",{className:"hero-cost-value",children:De(h.total)}),g.jsx("span",{className:"hero-cost-label",children:"spend"})]}),g.jsx(Y5,{cost:h})]}),g.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&i&&g.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>i(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),o&&g.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>o(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Activity"}),g.jsxs("div",{className:"activity-row",children:[g.jsxs("div",{className:"activity-counters",children:[g.jsxs("span",{className:"ac-item",children:[g.jsx("b",{children:e.toolCount})," calls"]}),w>0&&g.jsxs("span",{className:"ac-item ac-live",children:[g.jsx("b",{children:w})," live"]}),y>0&&g.jsxs("span",{className:"ac-item ac-err",children:[g.jsx("b",{children:y})," err"]})]}),g.jsx("div",{className:"cat-strip",children:N.map(([_,b])=>g.jsxs("span",{className:`cat-chip cat-${_}`,title:`${b} ${Lv[_]} call${b===1?"":"s"}`,children:[g.jsx("span",{className:"cat-emoji",children:Pv[_]}),g.jsx("span",{className:"cat-count",children:b})]},_))})]})]}),d>0&&g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Tokens"}),g.jsxs("div",{className:"tokens-grid",children:[g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"in"}),g.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"out"}),g.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"cache r"}),g.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"cache c"}),g.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Identity"}),g.jsxs("div",{children:[e.cwd&&g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"cwd"}),g.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"session"}),g.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"parent"}),g.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&g.jsxs("section",{className:"detail-section",children:[g.jsxs("h3",{children:["Prompts ",g.jsx("span",{className:"section-count",children:e.prompts.length})]}),g.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((_,b)=>{const S=w5(_.at,n);return g.jsxs("div",{className:"prompt-entry",children:[g.jsx("div",{className:"prompt-time",title:S.title,children:S.label}),g.jsx("div",{className:"prompt-text",children:_.text})]},b)})})]}),g.jsxs("section",{className:"detail-section",children:[g.jsxs("h3",{children:["Tool calls ",g.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&g.jsx("div",{className:"empty",children:"No tool calls yet."}),g.jsx("div",{children:e.tools.slice().reverse().map(_=>g.jsx(X5,{t:_,now:n,onClick:()=>r(_.id)},_.id))})]})]})}function Y5({cost:e}){const n=e.total;if(n<=0)return null;const r=(i,o,l)=>{if(i<=0)return null;const u=i/n*100;return g.jsx("span",{className:`cb-seg ${o}`,style:{width:`${u}%`},title:`${l}: ${De(i)} (${u.toFixed(0)}%)`},o)};return g.jsxs("div",{className:"cost-bar",role:"img","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}const K5={inflight:"in-flight",done:"done",err:"error"};function X5({t:e,now:n,onClick:r}){const i=e.endedAt==null?"inflight":e.ok===!1?"err":"done",o=(e.endedAt??n)-e.startedAt,l=e.endedAt==null?"…":o<1e3?`${o}ms`:`${(o/1e3).toFixed(1)}s`;return g.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:r,children:[g.jsxs("span",{className:"name",children:[g.jsx("span",{className:`status-dot ${i}`,"aria-hidden":!0}),g.jsx("span",{className:"vis-hidden",children:K5[i]}),e.name]}),g.jsx("span",{style:{color:"var(--muted)"},children:l})]})}try{f$(window.localStorage)}catch{}const Q5=JR.createRoot(document.getElementById("root"));Q5.render(g.jsx(B5,{}));
77
+ `)}`,"aria-label":`${Qt.length} session${Qt.length===1?"":"s"} waiting for you`,children:[g.jsx("span",{className:"ap-pulse","aria-hidden":!0}),g.jsx("b",{children:Qt.length})," waiting"]}),(()=>{const W=y5({paused:Wr,held:vr.current.size});return g.jsx("button",{className:`btn ${Wr?"warn":""}`,onClick:Vr,title:W.title,children:W.label})})(),g.jsx("button",{className:"btn icon-btn",onClick:()=>z(W=>!W),title:`${U?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":U,"aria-controls":U?"usage-panel":void 0,children:"$"}),we.claude&&V!==null&&g.jsx("button",{className:"btn icon-btn",onClick:W=>{if(W.shiftKey&&J>0){q(!0),fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restore"})}).then(()=>fetch("/api/sound-hook")).then(K=>K.ok?K.json():null).then(K=>{K!=null&&K.ok&&(B(K.enabled===!0),H(K.parked??0))}).catch(()=>{}).finally(()=>q(!1));return}Z()},disabled:C,title:g5(we,{on:V,clash:L,parked:J}),"aria-label":"Toggle Claude Code finish sound","aria-pressed":V,children:g.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:[g.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),V?g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),g.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M10 5.6l2.6 2.8"}),g.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),we.claude&&g.jsx("button",{className:"btn icon-btn",onClick:mt,title:`${P?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":P,"aria-controls":P?"accounts-panel":void 0,children:g.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:[g.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),g.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),g.jsx("button",{className:"btn icon-btn",onClick:St,title:`${T?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":T,"aria-controls":T?"session-list":void 0,children:"☰"}),g.jsx("button",{className:"btn icon-btn",onClick:()=>hn(W=>!W),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[g.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),g.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),g.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),g.jsx("button",{className:"btn",onClick:Ei,title:"Auto-arrange — clear pins (R)",children:"Re-layout"}),g.jsx("button",{className:"btn",onClick:()=>Cr("button"),title:"Clear the canvas and the server's event log — asks first (C)",children:"Clear"}),g.jsx("button",{className:"btn icon-btn",onClick:()=>Qr(W=>W==="dark"?"light":"dark"),title:`Switch to ${br==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:br==="dark"?"☀":"☾"})]})]}),Kr?g.jsxs("div",{className:"ver-banner done",role:"status",children:[g.jsx("span",{className:"ver-dot"}),g.jsxs("strong",{children:["Restarted — now running v",Kr,"."]}),g.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Is&&!M?g.jsxs("div",{className:"conn-banner",role:"alert",children:[g.jsx("span",{className:"conn-dot"}),zn?Gr==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${en}…`:`Lost connection to the ${en} server. Reconnecting…`]}):pt&&ye?g.jsxs("div",{className:`ver-banner ${ye.kind}`,role:"status",children:[g.jsx("span",{className:"ver-dot"}),ye.kind==="restart"?g.jsxs(g.Fragment,{children:[g.jsxs("strong",{children:["v",ye.to," is installed — this deck still runs v",ye.from,"."]}),Y!=null&&Y.canRestart?g.jsxs(g.Fragment,{children:[g.jsx("button",{type:"button",className:"ver-act",onClick:()=>wr(),disabled:zn,title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:zn?"restarting…":"Restart now"}),g.jsxs("button",{type:"button",className:`ver-auto${mn?" on":""}`,role:"switch","aria-checked":mn,onClick:yr,title:mn?"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:[g.jsx("i",{"aria-hidden":!0}),"auto when idle"]})]}):g.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."})]}):g.jsxs(g.Fragment,{children:[g.jsxs("strong",{children:[en," v",ye.to," is out — you are on v",ye.from,"."]}),(Y==null?void 0:Y.upgradeMode)==="install"&&Qe!=="failed"&&g.jsx("button",{type:"button",className:"ver-act",onClick:Ft,disabled:Qe==="running"||Qe==="done",title:`Runs ${((Va=Y==null?void 0:Y.upgrade)==null?void 0:Va.command)??(Y==null?void 0:Y.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Qe==="running"?"installing…":Qe==="done"?"installed":"Update now"}),(Y==null?void 0:Y.upgradeMode)==="npx"&&(Y==null?void 0:Y.canRestart)&&g.jsx("button",{type:"button",className:"ver-act",onClick:()=>wr({upgrade:!0}),disabled:zn,title:`Runs ${Y==null?void 0:Y.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:zn?"fetching…":Qe==="failed"?"Retry update":"Update & restart"}),Qe==="failed"?g.jsxs("span",{className:"ver-sub fail",title:((Ga=Y==null?void 0:Y.upgrade)==null?void 0:Ga.error)??"",children:[(Y==null?void 0:Y.upgradeMode)==="npx"?"update failed":"install failed",": ",((Ya=Y==null?void 0:Y.upgrade)==null?void 0:Ya.error)??"unknown error"," — run it yourself:"]}):(Y==null?void 0:Y.upgradeMode)==="npx"?g.jsx("span",{className:"ver-sub",children:Y!=null&&Y.canRestart?"npx cannot upgrade in place, so the deck re-runs:":$E.npx}):Y!=null&&Y.upgradeBlocked?g.jsx("span",{className:"ver-sub",children:$E[Y.upgradeBlocked]??"cannot install from here"}):null,g.jsxs("button",{type:"button",className:"ver-cmd",onClick:et,title:"Copy to clipboard",children:[g.jsx("code",{children:Y==null?void 0:Y.command}),g.jsx("span",{className:"ver-cmd-hint",children:oe?"copied":"copy"})]})]}),g.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Ze,children:"×"})]}):Mt&&Xe?g.jsxs("div",{className:"ver-banner",role:"status",children:[g.jsx("span",{className:"ver-dot"}),g.jsxs("strong",{children:[Xe," still works — the deck is called ",en," now."]}),Y!=null&&Y.renameFix?g.jsx("span",{className:"ver-sub",children:Y.renameFix}):null,g.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:ut,children:"×"})]}):null,U&&g.jsx(f3,{state:n.current,now:ct,providers:we,onClose:()=>z(!1)}),P&&we.claude&&g.jsx(U3,{onClose:()=>D(!1)}),T&&g.jsx(n3,{state:n.current,now:ct,selectedIds:o,onSelect:Ua,onClose:()=>I(!1)}),g.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${tc?" bubbling":""}${Eo?" dragging-any":""}`,ref:Bn,children:[Rr===0&&g.jsx(G5,{live:M,everConnected:Is,providers:we}),Hn.empty&&Rr>0&&g.jsxs("div",{className:"search-empty",role:"status",children:[g.jsx("span",{className:"search-empty-text",children:Hn.message}),g.jsx("button",{type:"button",className:"btn",onClick:()=>{var W;Xr(""),(W=Jr.current)==null||W.focus()},children:"Clear search"})]}),Er.length>1&&g.jsx("div",{ref:Sn,className:`cat-filter-bar${gr?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Er.map(W=>{const K=wi.has(W);return g.jsxs("button",{type:"button",className:`cat-filter${K?" off":""}`,onClick:()=>Ba(W),"aria-pressed":!K,title:`${K?"Show":"Hide"} ${Lv[W]} tools`,children:[g.jsx("span",{className:"cat-emoji",children:Pv[W]}),g.jsx("span",{className:"cat-name",children:Lv[W]})]},W)})}),g.jsxs(oC,{nodes:nc,edges:is,nodeTypes:S5,fitView:!_r,fitViewOptions:{padding:.25,duration:400},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(W,K)=>{if(K.type==="sessionGroup"){m();return}d(K.id,W.shiftKey)},onPaneClick:()=>m(),onMoveStart:()=>{Date.now()-kt.current<1200||qa()},onMove:(W,K)=>{Sr(),bo.current&&window.clearTimeout(bo.current),bo.current=window.setTimeout(()=>z5(K),250)},onNodeDragStart:(W,K)=>{var le;if(ki(),xi.current=!0,zt.current=new Map,No(!0),Sr(),qa(),K.type==="sessionGroup"){const de=(le=K.data)==null?void 0:le.sessionId,xe=new Map;if(de)for(const Ee of nn){const Oe=Ee.data;(Oe==null?void 0:Oe.sessionId)===de&&xe.set(Ee.id,{x:Ee.position.x,y:Ee.position.y})}xr.current={start:{x:K.position.x,y:K.position.y},members:xe};return}Rt.current.set(K.id,{x:K.position.x,y:K.position.y})},onNodeDrag:(W,K)=>{var le;if(Sr(),K.type==="sessionGroup"){const de=xr.current;if(!de)return;const xe=K.position.x-de.start.x,Ee=K.position.y-de.start.y;for(const[ze,Ge]of de.members){const Ve={x:Ge.x+xe,y:Ge.y+Ee};Rt.current.set(ze,Ve),Xt.current.set(ze,Ve)}const Oe=zt.current;if(Oe){for(const[ze,Ge]of de.members)Oe.set(ze,{x:Ge.x+xe,y:Ge.y+Ee});Oe.set(K.id,{x:K.position.x,y:K.position.y})}pn(ze=>ze+1);return}Rt.current.set(K.id,{x:K.position.x,y:K.position.y}),Xt.current.set(K.id,{x:K.position.x,y:K.position.y}),(le=zt.current)==null||le.set(K.id,{x:K.position.x,y:K.position.y}),pn(de=>de+1)},onNodeDragStop:(W,K)=>{if(Sr(),xi.current=!1,zt.current=null,No(!1),Pt(le=>le+1),K.type==="sessionGroup"){const le=xr.current;if(le){const de=K.position.x-le.start.x,xe=K.position.y-le.start.y;for(const[Ee,Oe]of le.members){const ze={x:Oe.x+de,y:Oe.y+xe};Rt.current.set(Ee,ze),Xt.current.set(Ee,ze)}}xr.current=null,cv(Xt.current,Rt.current),Pt(de=>de+1);return}Rt.current.set(K.id,{x:K.position.x,y:K.position.y}),Xt.current.set(K.id,{x:K.position.x,y:K.position.y}),cv(Xt.current,Rt.current)},children:[g.jsx(nP,{gap:28,size:1,color:aa("--grid-line")}),g.jsx(uL,{}),g.jsx(YL,{agents:n.current.agents,visibleAgentIds:Cn,positions:Xt.current,pinned:Rt.current,measured:ar.current,dimUnmatched:Hn.dim?Ds:null,spotlight:Ls,hiddenCategories:wi,now:ct,onOpenTool:p}),g.jsx(XO,{showInteractive:!1,children:g.jsx(to,{onClick:So,title:Ps?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Ps?{color:"var(--accent)"}:void 0,children:g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[g.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),g.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})})}),g.jsx(UO,{zoomable:!0,pannable:!0,nodeColor:W=>s5(W,aa),nodeStrokeWidth:2,maskColor:aa("--minimap-mask"),style:{background:aa("--panel"),border:`1px solid ${aa("--line")}`,borderRadius:8}})]})]}),O?g.jsxs("aside",{className:"detail","aria-label":"Detail",children:[g.jsx("button",{type:"button",className:"detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>A(!1),children:"×"}),dt?g.jsx(X5,{agent:dt,now:ct,onOpenTool:p,onShowSummary:W=>{E.current.has(W)&&(E.current.delete(W),FE(E.current)),w(W)},onExportSession:W=>B5(n.current,W)}):g.jsx(K5,{count:Rr,workspace:ke})]}):g.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>A(!0),children:"‹"}),Fs&&g.jsx(sL,{tool:Fs,onClose:()=>p(null)}),wt&&g.jsx(C$,{onClose:()=>hn(!1)}),N&&(()=>{const W=n.current.agents.get(N);return W?g.jsx(KP,{agent:W,onClose:()=>_(null)}):null})(),y&&g.jsx(XL,{state:n.current,sessionId:y,onClose:()=>{E.current.add(y),FE(E.current),w(null)}}),S&&g.jsx(X3,{agentCount:Rr,onConfirm:()=>Cr("confirmation"),onCancel:()=>k(!1)})]})}function G5({live:e,everConnected:n,providers:r}){const i=!e;return g.jsxs("div",{className:"empty-hero",children:[g.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[g.jsx("div",{className:"core"}),g.jsxs("div",{className:"orbit r1",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]}),g.jsxs("div",{className:"orbit r2",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]}),g.jsxs("div",{className:"orbit r3",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]})]}),i?g.jsxs(g.Fragment,{children:[g.jsx("h2",{children:n?"Disconnected from server":"Server unreachable"}),g.jsxs("p",{children:["The browser cannot reach ",g.jsx("code",{children:"/events"}),". Check that",g.jsx("code",{children:en})," is still running in your terminal, then this page will resume automatically."]})]}):Y5(r)]})}function Y5(e){return g.jsxs(g.Fragment,{children:[g.jsx("h2",{children:"Waiting for Claude Code or Codex"}),g.jsxs("p",{children:["Run ",g.jsx("code",{children:"claude"})," or ",g.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."]}),g.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",g.jsx("code",{children:en})," is running."]}),m5(e).map(n=>g.jsx("p",{className:"hint-row",children:n.spans.map((r,i)=>r.code?g.jsx("code",{children:r.text},i):g.jsx("span",{children:r.text},i))},n.provider))]})}function K5({count:e,workspace:n}){const r=u5(n);return g.jsxs(g.Fragment,{children:[g.jsx("h2",{children:"Detail"}),e===0?g.jsxs("div",{className:"hint",children:[r.lead,r.workspace!==null&&g.jsxs(g.Fragment,{children:[" ",g.jsx("code",{children:r.workspace}),r.tail]})]}):g.jsx("div",{className:"empty",children:"Click an agent to see its tools."}),g.jsx("h3",{style:{marginTop:4},children:"Shortcuts"}),g.jsxs("div",{className:"shortcuts",children:[g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"drag"}),g.jsx("span",{children:"move a node"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"tab"}),g.jsx("span",{children:"reach the cards"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"enter"}),g.jsx("span",{children:"select the focused card"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"/"}),g.jsx("span",{children:"focus search"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"space"}),g.jsx("span",{children:"pause / resume"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"J"}),g.jsx("span",{children:"next agent"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"K"}),g.jsx("span",{children:"previous agent"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"R"}),g.jsx("span",{children:"re-arrange"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"F"}),g.jsx("span",{children:"fit view"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"L"}),g.jsx("span",{children:"session list"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"H"}),g.jsx("span",{children:"usage history"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"U"}),g.jsx("span",{children:"usage panel"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"C"}),g.jsx("span",{children:"clear canvas"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"T"}),g.jsx("span",{children:"toggle theme"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"Esc"}),g.jsx("span",{children:"deselect, release focus"})]})]})]})}function X5({agent:e,now:n,onOpenTool:r,onShowSummary:i,onExportSession:o}){const l=(e.endedAt??n)-e.startedAt,u=Math.max(0,Math.floor(l/1e3)),c=u<60?`${u}s`:`${Math.floor(u/60)}m ${String(u%60).padStart(2,"0")}s`,h=dn(e.usage,e.model),p=h.total>0,d=e.usage.inputTokens+e.usage.outputTokens,m=new Map;for(const _ of e.tools){const b=UT(_.name);m.set(b,(m.get(b)??0)+1)}const y=e.tools.filter(_=>_.ok===!1).length,w=e.tools.filter(_=>!_.endedAt).length,N=Array.from(m.entries()).sort((_,b)=>b[1]-_[1]);return g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:"detail-hero",children:[g.jsxs("div",{className:"hero-line",children:[g.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),g.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),g.jsxs("div",{className:"hero-meta",children:[g.jsx("span",{className:"hero-meta-item",children:e.kind}),g.jsx("span",{className:"hero-sep",children:"·"}),g.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:c}),e.model&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"hero-sep",children:"·"}),g.jsx("span",{className:"model-chip",title:e.model,children:Ns(e.model)})]})]}),p&&g.jsxs("div",{className:"hero-cost",children:[g.jsxs("div",{className:"hero-cost-headline",children:[g.jsx("span",{className:"hero-cost-value",children:De(h.total)}),g.jsx("span",{className:"hero-cost-label",children:"spend"})]}),g.jsx(Q5,{cost:h})]}),g.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&i&&g.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>i(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),o&&g.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>o(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Activity"}),g.jsxs("div",{className:"activity-row",children:[g.jsxs("div",{className:"activity-counters",children:[g.jsxs("span",{className:"ac-item",children:[g.jsx("b",{children:e.toolCount})," calls"]}),w>0&&g.jsxs("span",{className:"ac-item ac-live",children:[g.jsx("b",{children:w})," live"]}),y>0&&g.jsxs("span",{className:"ac-item ac-err",children:[g.jsx("b",{children:y})," err"]})]}),g.jsx("div",{className:"cat-strip",children:N.map(([_,b])=>g.jsxs("span",{className:`cat-chip cat-${_}`,title:`${b} ${Lv[_]} call${b===1?"":"s"}`,children:[g.jsx("span",{className:"cat-emoji",children:Pv[_]}),g.jsx("span",{className:"cat-count",children:b})]},_))})]})]}),d>0&&g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Tokens"}),g.jsxs("div",{className:"tokens-grid",children:[g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"in"}),g.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"out"}),g.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"cache r"}),g.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"cache c"}),g.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Identity"}),g.jsxs("div",{children:[e.cwd&&g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"cwd"}),g.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"session"}),g.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"parent"}),g.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&g.jsxs("section",{className:"detail-section",children:[g.jsxs("h3",{children:["Prompts ",g.jsx("span",{className:"section-count",children:e.prompts.length})]}),g.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((_,b)=>{const S=b5(_.at,n);return g.jsxs("div",{className:"prompt-entry",children:[g.jsx("div",{className:"prompt-time",title:S.title,children:S.label}),g.jsx("div",{className:"prompt-text",children:_.text})]},b)})})]}),g.jsxs("section",{className:"detail-section",children:[g.jsxs("h3",{children:["Tool calls ",g.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&g.jsx("div",{className:"empty",children:"No tool calls yet."}),g.jsx("div",{children:e.tools.slice().reverse().map(_=>g.jsx(J5,{t:_,now:n,onClick:()=>r(_.id)},_.id))})]})]})}function Q5({cost:e}){const n=e.total;if(n<=0)return null;const r=(i,o,l)=>{if(i<=0)return null;const u=i/n*100;return g.jsx("span",{className:`cb-seg ${o}`,style:{width:`${u}%`},title:`${l}: ${De(i)} (${u.toFixed(0)}%)`},o)};return g.jsxs("div",{className:"cost-bar",role:"img","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}const Z5={inflight:"in-flight",done:"done",err:"error"};function J5({t:e,now:n,onClick:r}){const i=e.endedAt==null?"inflight":e.ok===!1?"err":"done",o=(e.endedAt??n)-e.startedAt,l=e.endedAt==null?"…":o<1e3?`${o}ms`:`${(o/1e3).toFixed(1)}s`;return g.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:r,children:[g.jsxs("span",{className:"name",children:[g.jsx("span",{className:`status-dot ${i}`,"aria-hidden":!0}),g.jsx("span",{className:"vis-hidden",children:Z5[i]}),e.name]}),g.jsx("span",{style:{color:"var(--muted)"},children:l})]})}try{p$(window.localStorage)}catch{}const eF=ej.createRoot(document.getElementById("root"));eF.render(g.jsx(W5,{}));