@curie-agent/daemon 0.3.1 → 0.3.2

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.
@@ -0,0 +1,165 @@
1
+ var N2=Object.defineProperty;var j2=(e,t,n)=>t in e?N2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var fe=(e,t,n)=>j2(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))l(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&l(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function l(a){if(a.ep)return;a.ep=!0;const s=n(a);fetch(a.href,s)}})();function mx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xx={exports:{}},uc={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var k2=Symbol.for("react.transitional.element"),E2=Symbol.for("react.fragment");function yx(e,t,n){var l=null;if(n!==void 0&&(l=""+n),t.key!==void 0&&(l=""+t.key),"key"in t){n={};for(var a in t)a!=="key"&&(n[a]=t[a])}else n=t;return t=n.ref,{$$typeof:k2,type:e,key:l,ref:t!==void 0?t:null,props:n}}uc.Fragment=E2;uc.jsx=yx;uc.jsxs=yx;xx.exports=uc;var o=xx.exports,vx={exports:{}},ie={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var bf=Symbol.for("react.transitional.element"),C2=Symbol.for("react.portal"),_2=Symbol.for("react.fragment"),M2=Symbol.for("react.strict_mode"),A2=Symbol.for("react.profiler"),T2=Symbol.for("react.consumer"),D2=Symbol.for("react.context"),z2=Symbol.for("react.forward_ref"),R2=Symbol.for("react.suspense"),O2=Symbol.for("react.memo"),bx=Symbol.for("react.lazy"),H2=Symbol.for("react.activity"),fp=Symbol.iterator;function L2(e){return e===null||typeof e!="object"?null:(e=fp&&e[fp]||e["@@iterator"],typeof e=="function"?e:null)}var wx={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Sx=Object.assign,Nx={};function xs(e,t,n){this.props=e,this.context=t,this.refs=Nx,this.updater=n||wx}xs.prototype.isReactComponent={};xs.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};xs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function jx(){}jx.prototype=xs.prototype;function wf(e,t,n){this.props=e,this.context=t,this.refs=Nx,this.updater=n||wx}var Sf=wf.prototype=new jx;Sf.constructor=wf;Sx(Sf,xs.prototype);Sf.isPureReactComponent=!0;var hp=Array.isArray;function td(){}var Me={H:null,A:null,T:null,S:null},kx=Object.prototype.hasOwnProperty;function Nf(e,t,n){var l=n.ref;return{$$typeof:bf,type:e,key:t,ref:l!==void 0?l:null,props:n}}function B2(e,t){return Nf(e.type,t,e.props)}function jf(e){return typeof e=="object"&&e!==null&&e.$$typeof===bf}function $2(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var pp=/\/+/g;function nu(e,t){return typeof e=="object"&&e!==null&&e.key!=null?$2(""+e.key):t.toString(36)}function U2(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(td,td):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function ja(e,t,n,l,a){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(s){case"bigint":case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case bf:case C2:i=!0;break;case bx:return i=e._init,ja(i(e._payload),t,n,l,a)}}if(i)return a=a(e),i=l===""?"."+nu(e,0):l,hp(a)?(n="",i!=null&&(n=i.replace(pp,"$&/")+"/"),ja(a,t,n,"",function(u){return u})):a!=null&&(jf(a)&&(a=B2(a,n+(a.key==null||e&&e.key===a.key?"":(""+a.key).replace(pp,"$&/")+"/")+i)),t.push(a)),1;i=0;var r=l===""?".":l+":";if(hp(e))for(var c=0;c<e.length;c++)l=e[c],s=r+nu(l,c),i+=ja(l,t,n,s,a);else if(c=L2(e),typeof c=="function")for(e=c.call(e),c=0;!(l=e.next()).done;)l=l.value,s=r+nu(l,c++),i+=ja(l,t,n,s,a);else if(s==="object"){if(typeof e.then=="function")return ja(U2(e),t,n,l,a);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return i}function fr(e,t,n){if(e==null)return e;var l=[],a=0;return ja(e,l,"","",function(s){return t.call(n,s,a++)}),l}function q2(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var gp=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Y2={map:fr,forEach:function(e,t,n){fr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return fr(e,function(){t++}),t},toArray:function(e){return fr(e,function(t){return t})||[]},only:function(e){if(!jf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ie.Activity=H2;ie.Children=Y2;ie.Component=xs;ie.Fragment=_2;ie.Profiler=A2;ie.PureComponent=wf;ie.StrictMode=M2;ie.Suspense=R2;ie.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Me;ie.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Me.H.useMemoCache(e)}};ie.cache=function(e){return function(){return e.apply(null,arguments)}};ie.cacheSignal=function(){return null};ie.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var l=Sx({},e.props),a=e.key;if(t!=null)for(s in t.key!==void 0&&(a=""+t.key),t)!kx.call(t,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&t.ref===void 0||(l[s]=t[s]);var s=arguments.length-2;if(s===1)l.children=n;else if(1<s){for(var i=Array(s),r=0;r<s;r++)i[r]=arguments[r+2];l.children=i}return Nf(e.type,a,l)};ie.createContext=function(e){return e={$$typeof:D2,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:T2,_context:e},e};ie.createElement=function(e,t,n){var l,a={},s=null;if(t!=null)for(l in t.key!==void 0&&(s=""+t.key),t)kx.call(t,l)&&l!=="key"&&l!=="__self"&&l!=="__source"&&(a[l]=t[l]);var i=arguments.length-2;if(i===1)a.children=n;else if(1<i){for(var r=Array(i),c=0;c<i;c++)r[c]=arguments[c+2];a.children=r}if(e&&e.defaultProps)for(l in i=e.defaultProps,i)a[l]===void 0&&(a[l]=i[l]);return Nf(e,s,a)};ie.createRef=function(){return{current:null}};ie.forwardRef=function(e){return{$$typeof:z2,render:e}};ie.isValidElement=jf;ie.lazy=function(e){return{$$typeof:bx,_payload:{_status:-1,_result:e},_init:q2}};ie.memo=function(e,t){return{$$typeof:O2,type:e,compare:t===void 0?null:t}};ie.startTransition=function(e){var t=Me.T,n={};Me.T=n;try{var l=e(),a=Me.S;a!==null&&a(n,l),typeof l=="object"&&l!==null&&typeof l.then=="function"&&l.then(td,gp)}catch(s){gp(s)}finally{t!==null&&n.types!==null&&(t.types=n.types),Me.T=t}};ie.unstable_useCacheRefresh=function(){return Me.H.useCacheRefresh()};ie.use=function(e){return Me.H.use(e)};ie.useActionState=function(e,t,n){return Me.H.useActionState(e,t,n)};ie.useCallback=function(e,t){return Me.H.useCallback(e,t)};ie.useContext=function(e){return Me.H.useContext(e)};ie.useDebugValue=function(){};ie.useDeferredValue=function(e,t){return Me.H.useDeferredValue(e,t)};ie.useEffect=function(e,t){return Me.H.useEffect(e,t)};ie.useEffectEvent=function(e){return Me.H.useEffectEvent(e)};ie.useId=function(){return Me.H.useId()};ie.useImperativeHandle=function(e,t,n){return Me.H.useImperativeHandle(e,t,n)};ie.useInsertionEffect=function(e,t){return Me.H.useInsertionEffect(e,t)};ie.useLayoutEffect=function(e,t){return Me.H.useLayoutEffect(e,t)};ie.useMemo=function(e,t){return Me.H.useMemo(e,t)};ie.useOptimistic=function(e,t){return Me.H.useOptimistic(e,t)};ie.useReducer=function(e,t,n){return Me.H.useReducer(e,t,n)};ie.useRef=function(e){return Me.H.useRef(e)};ie.useState=function(e){return Me.H.useState(e)};ie.useSyncExternalStore=function(e,t,n){return Me.H.useSyncExternalStore(e,t,n)};ie.useTransition=function(){return Me.H.useTransition()};ie.version="19.2.6";vx.exports=ie;var b=vx.exports;const _e=mx(b);var Ex={exports:{}},dc={},Cx={exports:{}},_x={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */(function(e){function t(C,z){var T=C.length;C.push(z);e:for(;0<T;){var R=T-1>>>1,Y=C[R];if(0<a(Y,z))C[R]=z,C[T]=Y,T=R;else break e}}function n(C){return C.length===0?null:C[0]}function l(C){if(C.length===0)return null;var z=C[0],T=C.pop();if(T!==z){C[0]=T;e:for(var R=0,Y=C.length,X=Y>>>1;R<X;){var H=2*(R+1)-1,U=C[H],_=H+1,$=C[_];if(0>a(U,T))_<Y&&0>a($,U)?(C[R]=$,C[_]=T,R=_):(C[R]=U,C[H]=T,R=H);else if(_<Y&&0>a($,T))C[R]=$,C[_]=T,R=_;else break e}}return z}function a(C,z){var T=C.sortIndex-z.sortIndex;return T!==0?T:C.id-z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var i=Date,r=i.now();e.unstable_now=function(){return i.now()-r}}var c=[],u=[],d=1,f=null,h=3,p=!1,x=!1,S=!1,w=!1,g=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;function v(C){for(var z=n(u);z!==null;){if(z.callback===null)l(u);else if(z.startTime<=C)l(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(u)}}function j(C){if(S=!1,v(C),!x)if(n(c)!==null)x=!0,k||(k=!0,L());else{var z=n(u);z!==null&&O(j,z.startTime-C)}}var k=!1,E=-1,A=5,M=-1;function B(){return w?!0:!(e.unstable_now()-M<A)}function D(){if(w=!1,k){var C=e.unstable_now();M=C;var z=!0;try{e:{x=!1,S&&(S=!1,y(E),E=-1),p=!0;var T=h;try{t:{for(v(C),f=n(c);f!==null&&!(f.expirationTime>C&&B());){var R=f.callback;if(typeof R=="function"){f.callback=null,h=f.priorityLevel;var Y=R(f.expirationTime<=C);if(C=e.unstable_now(),typeof Y=="function"){f.callback=Y,v(C),z=!0;break t}f===n(c)&&l(c),v(C)}else l(c);f=n(c)}if(f!==null)z=!0;else{var X=n(u);X!==null&&O(j,X.startTime-C),z=!1}}break e}finally{f=null,h=T,p=!1}z=void 0}}finally{z?L():k=!1}}}var L;if(typeof m=="function")L=function(){m(D)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,N=V.port2;V.port1.onmessage=D,L=function(){N.postMessage(null)}}else L=function(){g(D,0)};function O(C,z){E=g(function(){C(e.unstable_now())},z)}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(C){C.callback=null},e.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<C?Math.floor(1e3/C):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(C){switch(h){case 1:case 2:case 3:var z=3;break;default:z=h}var T=h;h=z;try{return C()}finally{h=T}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(C,z){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var T=h;h=C;try{return z()}finally{h=T}},e.unstable_scheduleCallback=function(C,z,T){var R=e.unstable_now();switch(typeof T=="object"&&T!==null?(T=T.delay,T=typeof T=="number"&&0<T?R+T:R):T=R,C){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=T+Y,C={id:d++,callback:z,priorityLevel:C,startTime:T,expirationTime:Y,sortIndex:-1},T>R?(C.sortIndex=T,t(u,C),n(c)===null&&C===n(u)&&(S?(y(E),E=-1):S=!0,O(j,T-R))):(C.sortIndex=Y,t(c,C),x||p||(x=!0,k||(k=!0,L()))),C},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(C){var z=h;return function(){var T=h;h=z;try{return C.apply(this,arguments)}finally{h=T}}}})(_x);Cx.exports=_x;var V2=Cx.exports,Mx={exports:{}},dt={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var X2=b;function Ax(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function nl(){}var ut={d:{f:nl,r:function(){throw Error(Ax(522))},D:nl,C:nl,L:nl,m:nl,X:nl,S:nl,M:nl},p:0,findDOMNode:null},G2=Symbol.for("react.portal");function Q2(e,t,n){var l=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:G2,key:l==null?null:""+l,children:e,containerInfo:t,implementation:n}}var Ks=X2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function fc(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}dt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ut;dt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(Ax(299));return Q2(e,t,null,n)};dt.flushSync=function(e){var t=Ks.T,n=ut.p;try{if(Ks.T=null,ut.p=2,e)return e()}finally{Ks.T=t,ut.p=n,ut.d.f()}};dt.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,ut.d.C(e,t))};dt.prefetchDNS=function(e){typeof e=="string"&&ut.d.D(e)};dt.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,l=fc(n,t.crossOrigin),a=typeof t.integrity=="string"?t.integrity:void 0,s=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?ut.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:l,integrity:a,fetchPriority:s}):n==="script"&&ut.d.X(e,{crossOrigin:l,integrity:a,fetchPriority:s,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};dt.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=fc(t.as,t.crossOrigin);ut.d.M(e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&ut.d.M(e)};dt.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,l=fc(n,t.crossOrigin);ut.d.L(e,n,{crossOrigin:l,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};dt.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=fc(t.as,t.crossOrigin);ut.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else ut.d.m(e)};dt.requestFormReset=function(e){ut.d.r(e)};dt.unstable_batchedUpdates=function(e,t){return e(t)};dt.useFormState=function(e,t,n){return Ks.H.useFormState(e,t,n)};dt.useFormStatus=function(){return Ks.H.useHostTransitionStatus()};dt.version="19.2.6";function Tx(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Tx)}catch(e){console.error(e)}}Tx(),Mx.exports=dt;var Il=Mx.exports;/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var Ze=V2,Dx=b,Z2=Il;function Z(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function zx(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function $i(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Rx(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Ox(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function mp(e){if($i(e)!==e)throw Error(Z(188))}function I2(e){var t=e.alternate;if(!t){if(t=$i(e),t===null)throw Error(Z(188));return t!==e?null:e}for(var n=e,l=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(l=a.return,l!==null){n=l;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return mp(a),e;if(s===l)return mp(a),t;s=s.sibling}throw Error(Z(188))}if(n.return!==l.return)n=a,l=s;else{for(var i=!1,r=a.child;r;){if(r===n){i=!0,n=a,l=s;break}if(r===l){i=!0,l=a,n=s;break}r=r.sibling}if(!i){for(r=s.child;r;){if(r===n){i=!0,n=s,l=a;break}if(r===l){i=!0,l=s,n=a;break}r=r.sibling}if(!i)throw Error(Z(189))}}if(n.alternate!==l)throw Error(Z(190))}if(n.tag!==3)throw Error(Z(188));return n.stateNode.current===n?e:t}function Hx(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=Hx(e),t!==null)return t;e=e.sibling}return null}var Ae=Object.assign,K2=Symbol.for("react.element"),hr=Symbol.for("react.transitional.element"),qs=Symbol.for("react.portal"),Ca=Symbol.for("react.fragment"),Lx=Symbol.for("react.strict_mode"),nd=Symbol.for("react.profiler"),Bx=Symbol.for("react.consumer"),Bn=Symbol.for("react.context"),kf=Symbol.for("react.forward_ref"),ld=Symbol.for("react.suspense"),ad=Symbol.for("react.suspense_list"),Ef=Symbol.for("react.memo"),ol=Symbol.for("react.lazy"),sd=Symbol.for("react.activity"),J2=Symbol.for("react.memo_cache_sentinel"),xp=Symbol.iterator;function Ts(e){return e===null||typeof e!="object"?null:(e=xp&&e[xp]||e["@@iterator"],typeof e=="function"?e:null)}var W2=Symbol.for("react.client.reference");function id(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===W2?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ca:return"Fragment";case nd:return"Profiler";case Lx:return"StrictMode";case ld:return"Suspense";case ad:return"SuspenseList";case sd:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case qs:return"Portal";case Bn:return e.displayName||"Context";case Bx:return(e._context.displayName||"Context")+".Consumer";case kf:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ef:return t=e.displayName||null,t!==null?t:id(e.type)||"Memo";case ol:t=e._payload,e=e._init;try{return id(e(t))}catch{}}return null}var Ys=Array.isArray,ne=Dx.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ye=Z2.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Jl={pending:!1,data:null,method:null,action:null},rd=[],_a=-1;function jn(e){return{current:e}}function Fe(e){0>_a||(e.current=rd[_a],rd[_a]=null,_a--)}function ke(e,t){_a++,rd[_a]=e.current,e.current=t}var wn=jn(null),pi=jn(null),wl=jn(null),po=jn(null);function go(e,t){switch(ke(wl,t),ke(pi,e),ke(wn,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ng(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ng(t),e=av(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Fe(wn),ke(wn,e)}function Wa(){Fe(wn),Fe(pi),Fe(wl)}function od(e){e.memoizedState!==null&&ke(po,e);var t=wn.current,n=av(t,e.type);t!==n&&(ke(pi,e),ke(wn,n))}function mo(e){pi.current===e&&(Fe(wn),Fe(pi)),po.current===e&&(Fe(po),ki._currentValue=Jl)}var lu,yp;function Yl(e){if(lu===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);lu=t&&t[1]||"",yp=-1<n.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+lu+e+yp}var au=!1;function su(e,t){if(!e||au)return"";au=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(p){var h=p}Reflect.construct(e,[],f)}else{try{f.call()}catch(p){h=p}e.call(f.prototype)}}else{try{throw Error()}catch(p){h=p}(f=e())&&typeof f.catch=="function"&&f.catch(function(){})}}catch(p){if(p&&h&&typeof p.stack=="string")return[p.stack,h.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var s=l.DetermineComponentFrameRoot(),i=s[0],r=s[1];if(i&&r){var c=i.split(`
44
+ `),u=r.split(`
45
+ `);for(a=l=0;l<c.length&&!c[l].includes("DetermineComponentFrameRoot");)l++;for(;a<u.length&&!u[a].includes("DetermineComponentFrameRoot");)a++;if(l===c.length||a===u.length)for(l=c.length-1,a=u.length-1;1<=l&&0<=a&&c[l]!==u[a];)a--;for(;1<=l&&0<=a;l--,a--)if(c[l]!==u[a]){if(l!==1||a!==1)do if(l--,a--,0>a||c[l]!==u[a]){var d=`
46
+ `+c[l].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=l&&0<=a);break}}}finally{au=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Yl(n):""}function F2(e,t){switch(e.tag){case 26:case 27:case 5:return Yl(e.type);case 16:return Yl("Lazy");case 13:return e.child!==t&&t!==null?Yl("Suspense Fallback"):Yl("Suspense");case 19:return Yl("SuspenseList");case 0:case 15:return su(e.type,!1);case 11:return su(e.type.render,!1);case 1:return su(e.type,!0);case 31:return Yl("Activity");default:return""}}function vp(e){try{var t="",n=null;do t+=F2(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
47
+ Error generating stack: `+l.message+`
48
+ `+l.stack}}var cd=Object.prototype.hasOwnProperty,Cf=Ze.unstable_scheduleCallback,iu=Ze.unstable_cancelCallback,P2=Ze.unstable_shouldYield,ew=Ze.unstable_requestPaint,_t=Ze.unstable_now,tw=Ze.unstable_getCurrentPriorityLevel,$x=Ze.unstable_ImmediatePriority,Ux=Ze.unstable_UserBlockingPriority,xo=Ze.unstable_NormalPriority,nw=Ze.unstable_LowPriority,qx=Ze.unstable_IdlePriority,lw=Ze.log,aw=Ze.unstable_setDisableYieldValue,Ui=null,Mt=null;function ml(e){if(typeof lw=="function"&&aw(e),Mt&&typeof Mt.setStrictMode=="function")try{Mt.setStrictMode(Ui,e)}catch{}}var At=Math.clz32?Math.clz32:rw,sw=Math.log,iw=Math.LN2;function rw(e){return e>>>=0,e===0?32:31-(sw(e)/iw|0)|0}var pr=256,gr=262144,mr=4194304;function Vl(e){var t=e&42;if(t!==0)return t;switch(e&-e){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function hc(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var a=0,s=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var r=l&134217727;return r!==0?(l=r&~s,l!==0?a=Vl(l):(i&=r,i!==0?a=Vl(i):n||(n=r&~e,n!==0&&(a=Vl(n))))):(r=l&~s,r!==0?a=Vl(r):i!==0?a=Vl(i):n||(n=l&~e,n!==0&&(a=Vl(n)))),a===0?0:t!==0&&t!==a&&!(t&s)&&(s=a&-a,n=t&-t,s>=n||s===32&&(n&4194048)!==0)?t:a}function qi(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ow(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Yx(){var e=mr;return mr<<=1,!(mr&62914560)&&(mr=4194304),e}function ru(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Yi(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function cw(e,t,n,l,a,s){var i=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var r=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=i&~n;0<n;){var d=31-At(n),f=1<<d;r[d]=0,c[d]=-1;var h=u[d];if(h!==null)for(u[d]=null,d=0;d<h.length;d++){var p=h[d];p!==null&&(p.lane&=-536870913)}n&=~f}l!==0&&Vx(e,l,0),s!==0&&a===0&&e.tag!==0&&(e.suspendedLanes|=s&~(i&~t))}function Vx(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-At(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function Xx(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-At(n),a=1<<l;a&t|e[l]&t&&(e[l]|=t),n&=~a}}function Gx(e,t){var n=t&-t;return n=n&42?1:_f(n),n&(e.suspendedLanes|t)?0:n}function _f(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Mf(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Qx(){var e=ye.p;return e!==0?e:(e=window.event,e===void 0?32:gv(e.type))}function bp(e,t){var n=ye.p;try{return ye.p=e,t()}finally{ye.p=n}}var Ol=Math.random().toString(36).slice(2),et="__reactFiber$"+Ol,bt="__reactProps$"+Ol,ys="__reactContainer$"+Ol,ud="__reactEvents$"+Ol,uw="__reactListeners$"+Ol,dw="__reactHandles$"+Ol,wp="__reactResources$"+Ol,Vi="__reactMarker$"+Ol;function Af(e){delete e[et],delete e[bt],delete e[ud],delete e[uw],delete e[dw]}function Ma(e){var t=e[et];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ys]||n[et]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=_g(e);e!==null;){if(n=e[et])return n;e=_g(e)}return t}e=n,n=e.parentNode}return null}function vs(e){if(e=e[et]||e[ys]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Vs(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(Z(33))}function qa(e){var t=e[wp];return t||(t=e[wp]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function We(e){e[Vi]=!0}var Zx=new Set,Ix={};function ha(e,t){Fa(e,t),Fa(e+"Capture",t)}function Fa(e,t){for(Ix[e]=t,e=0;e<t.length;e++)Zx.add(t[e])}var fw=RegExp("^[: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]*$"),Sp={},Np={};function hw(e){return cd.call(Np,e)?!0:cd.call(Sp,e)?!1:fw.test(e)?Np[e]=!0:(Sp[e]=!0,!1)}function Gr(e,t,n){if(hw(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function xr(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function An(e,t,n,l){if(l===null)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+l)}}function qt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Kx(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function pw(e,t,n){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var a=l.get,s=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(i){n=""+i,s.call(this,i)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return n},setValue:function(i){n=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function dd(e){if(!e._valueTracker){var t=Kx(e)?"checked":"value";e._valueTracker=pw(e,t,""+e[t])}}function Jx(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=Kx(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function yo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var gw=/[\n"\\]/g;function Xt(e){return e.replace(gw,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function fd(e,t,n,l,a,s,i,r){e.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?e.type=i:e.removeAttribute("type"),t!=null?i==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+qt(t)):e.value!==""+qt(t)&&(e.value=""+qt(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?hd(e,i,qt(t)):n!=null?hd(e,i,qt(n)):l!=null&&e.removeAttribute("value"),a==null&&s!=null&&(e.defaultChecked=!!s),a!=null&&(e.checked=a&&typeof a!="function"&&typeof a!="symbol"),r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"?e.name=""+qt(r):e.removeAttribute("name")}function Wx(e,t,n,l,a,s,i,r){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||n!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){dd(e);return}n=n!=null?""+qt(n):"",t=t!=null?""+qt(t):n,r||t===e.value||(e.value=t),e.defaultValue=t}l=l??a,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=r?e.checked:!!l,e.defaultChecked=!!l,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.name=i),dd(e)}function hd(e,t,n){t==="number"&&yo(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Ya(e,t,n,l){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&l&&(e[n].defaultSelected=!0)}else{for(n=""+qt(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,l&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function Fx(e,t,n){if(t!=null&&(t=""+qt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+qt(n):""}function Px(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(Z(92));if(Ys(l)){if(1<l.length)throw Error(Z(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=qt(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),dd(e)}function Pa(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var mw=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function jp(e,t,n){var l=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,n):typeof n!="number"||n===0||mw.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function e0(e,t,n){if(t!=null&&typeof t!="object")throw Error(Z(62));if(e=e.style,n!=null){for(var l in n)!n.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var a in t)l=t[a],t.hasOwnProperty(a)&&n[a]!==l&&jp(e,a,l)}else for(var s in t)t.hasOwnProperty(s)&&jp(e,s,t[s])}function Tf(e){if(e.indexOf("-")===-1)return!1;switch(e){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 xw=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),yw=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Qr(e){return yw.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function $n(){}var pd=null;function Df(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Aa=null,Va=null;function kp(e){var t=vs(e);if(t&&(e=t.stateNode)){var n=e[bt]||null;e:switch(e=t.stateNode,t.type){case"input":if(fd(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Xt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var a=l[bt]||null;if(!a)throw Error(Z(90));fd(l,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)l=n[t],l.form===e.form&&Jx(l)}break e;case"textarea":Fx(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Ya(e,!!n.multiple,t,!1)}}}var ou=!1;function t0(e,t,n){if(ou)return e(t,n);ou=!0;try{var l=e(t);return l}finally{if(ou=!1,(Aa!==null||Va!==null)&&(kc(),Aa&&(t=Aa,e=Va,Va=Aa=null,kp(t),e)))for(t=0;t<e.length;t++)kp(e[t])}}function gi(e,t){var n=e.stateNode;if(n===null)return null;var l=n[bt]||null;if(l===null)return null;n=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Z(231,t,typeof n));return n}var Qn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gd=!1;if(Qn)try{var Ds={};Object.defineProperty(Ds,"passive",{get:function(){gd=!0}}),window.addEventListener("test",Ds,Ds),window.removeEventListener("test",Ds,Ds)}catch{gd=!1}var xl=null,zf=null,Zr=null;function n0(){if(Zr)return Zr;var e,t=zf,n=t.length,l,a="value"in xl?xl.value:xl.textContent,s=a.length;for(e=0;e<n&&t[e]===a[e];e++);var i=n-e;for(l=1;l<=i&&t[n-l]===a[s-l];l++);return Zr=a.slice(e,1<l?1-l:void 0)}function Ir(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function yr(){return!0}function Ep(){return!1}function wt(e){function t(n,l,a,s,i){this._reactName=n,this._targetInst=a,this.type=l,this.nativeEvent=s,this.target=i,this.currentTarget=null;for(var r in e)e.hasOwnProperty(r)&&(n=e[r],this[r]=n?n(s):s[r]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?yr:Ep,this.isPropagationStopped=Ep,this}return Ae(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=yr)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=yr)},persist:function(){},isPersistent:yr}),t}var pa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pc=wt(pa),Xi=Ae({},pa,{view:0,detail:0}),vw=wt(Xi),cu,uu,zs,gc=Ae({},Xi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rf,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==zs&&(zs&&e.type==="mousemove"?(cu=e.screenX-zs.screenX,uu=e.screenY-zs.screenY):uu=cu=0,zs=e),cu)},movementY:function(e){return"movementY"in e?e.movementY:uu}}),Cp=wt(gc),bw=Ae({},gc,{dataTransfer:0}),ww=wt(bw),Sw=Ae({},Xi,{relatedTarget:0}),du=wt(Sw),Nw=Ae({},pa,{animationName:0,elapsedTime:0,pseudoElement:0}),jw=wt(Nw),kw=Ae({},pa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ew=wt(kw),Cw=Ae({},pa,{data:0}),_p=wt(Cw),_w={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Mw={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"},Aw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Tw(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Aw[e])?!!t[e]:!1}function Rf(){return Tw}var Dw=Ae({},Xi,{key:function(e){if(e.key){var t=_w[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ir(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Mw[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rf,charCode:function(e){return e.type==="keypress"?Ir(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ir(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),zw=wt(Dw),Rw=Ae({},gc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mp=wt(Rw),Ow=Ae({},Xi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rf}),Hw=wt(Ow),Lw=Ae({},pa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Bw=wt(Lw),$w=Ae({},gc,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Uw=wt($w),qw=Ae({},pa,{newState:0,oldState:0}),Yw=wt(qw),Vw=[9,13,27,32],Of=Qn&&"CompositionEvent"in window,Js=null;Qn&&"documentMode"in document&&(Js=document.documentMode);var Xw=Qn&&"TextEvent"in window&&!Js,l0=Qn&&(!Of||Js&&8<Js&&11>=Js),Ap=" ",Tp=!1;function a0(e,t){switch(e){case"keyup":return Vw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function s0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ta=!1;function Gw(e,t){switch(e){case"compositionend":return s0(t);case"keypress":return t.which!==32?null:(Tp=!0,Ap);case"textInput":return e=t.data,e===Ap&&Tp?null:e;default:return null}}function Qw(e,t){if(Ta)return e==="compositionend"||!Of&&a0(e,t)?(e=n0(),Zr=zf=xl=null,Ta=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return l0&&t.locale!=="ko"?null:t.data;default:return null}}var Zw={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 Dp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Zw[e.type]:t==="textarea"}function i0(e,t,n,l){Aa?Va?Va.push(l):Va=[l]:Aa=l,t=Ho(t,"onChange"),0<t.length&&(n=new pc("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var Ws=null,mi=null;function Iw(e){tv(e,0)}function mc(e){var t=Vs(e);if(Jx(t))return e}function zp(e,t){if(e==="change")return t}var r0=!1;if(Qn){var fu;if(Qn){var hu="oninput"in document;if(!hu){var Rp=document.createElement("div");Rp.setAttribute("oninput","return;"),hu=typeof Rp.oninput=="function"}fu=hu}else fu=!1;r0=fu&&(!document.documentMode||9<document.documentMode)}function Op(){Ws&&(Ws.detachEvent("onpropertychange",o0),mi=Ws=null)}function o0(e){if(e.propertyName==="value"&&mc(mi)){var t=[];i0(t,mi,e,Df(e)),t0(Iw,t)}}function Kw(e,t,n){e==="focusin"?(Op(),Ws=t,mi=n,Ws.attachEvent("onpropertychange",o0)):e==="focusout"&&Op()}function Jw(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return mc(mi)}function Ww(e,t){if(e==="click")return mc(t)}function Fw(e,t){if(e==="input"||e==="change")return mc(t)}function Pw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Dt=typeof Object.is=="function"?Object.is:Pw;function xi(e,t){if(Dt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),l=Object.keys(t);if(n.length!==l.length)return!1;for(l=0;l<n.length;l++){var a=n[l];if(!cd.call(t,a)||!Dt(e[a],t[a]))return!1}return!0}function Hp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Lp(e,t){var n=Hp(e);e=0;for(var l;n;){if(n.nodeType===3){if(l=e+n.textContent.length,e<=t&&l>=t)return{node:n,offset:t-e};e=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Hp(n)}}function c0(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?c0(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function u0(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=yo(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=yo(e.document)}return t}function Hf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var eS=Qn&&"documentMode"in document&&11>=document.documentMode,Da=null,md=null,Fs=null,xd=!1;function Bp(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;xd||Da==null||Da!==yo(l)||(l=Da,"selectionStart"in l&&Hf(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Fs&&xi(Fs,l)||(Fs=l,l=Ho(md,"onSelect"),0<l.length&&(t=new pc("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=Da)))}function ql(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var za={animationend:ql("Animation","AnimationEnd"),animationiteration:ql("Animation","AnimationIteration"),animationstart:ql("Animation","AnimationStart"),transitionrun:ql("Transition","TransitionRun"),transitionstart:ql("Transition","TransitionStart"),transitioncancel:ql("Transition","TransitionCancel"),transitionend:ql("Transition","TransitionEnd")},pu={},d0={};Qn&&(d0=document.createElement("div").style,"AnimationEvent"in window||(delete za.animationend.animation,delete za.animationiteration.animation,delete za.animationstart.animation),"TransitionEvent"in window||delete za.transitionend.transition);function ga(e){if(pu[e])return pu[e];if(!za[e])return e;var t=za[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in d0)return pu[e]=t[n];return e}var f0=ga("animationend"),h0=ga("animationiteration"),p0=ga("animationstart"),tS=ga("transitionrun"),nS=ga("transitionstart"),lS=ga("transitioncancel"),g0=ga("transitionend"),m0=new Map,yd="abort auxClick beforeToggle 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(" ");yd.push("scrollEnd");function cn(e,t){m0.set(e,t),ha(t,[e])}var vo=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},$t=[],Ra=0,Lf=0;function xc(){for(var e=Ra,t=Lf=Ra=0;t<e;){var n=$t[t];$t[t++]=null;var l=$t[t];$t[t++]=null;var a=$t[t];$t[t++]=null;var s=$t[t];if($t[t++]=null,l!==null&&a!==null){var i=l.pending;i===null?a.next=a:(a.next=i.next,i.next=a),l.pending=a}s!==0&&x0(n,a,s)}}function yc(e,t,n,l){$t[Ra++]=e,$t[Ra++]=t,$t[Ra++]=n,$t[Ra++]=l,Lf|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Bf(e,t,n,l){return yc(e,t,n,l),bo(e)}function ma(e,t){return yc(e,null,null,t),bo(e)}function x0(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var a=!1,s=e.return;s!==null;)s.childLanes|=n,l=s.alternate,l!==null&&(l.childLanes|=n),s.tag===22&&(e=s.stateNode,e===null||e._visibility&1||(a=!0)),e=s,s=s.return;return e.tag===3?(s=e.stateNode,a&&t!==null&&(a=31-At(n),e=s.hiddenUpdates,l=e[a],l===null?e[a]=[t]:l.push(t),t.lane=n|536870912),s):null}function bo(e){if(50<ri)throw ri=0,$d=null,Error(Z(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Oa={};function aS(e,t,n,l){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function kt(e,t,n,l){return new aS(e,t,n,l)}function $f(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Yn(e,t){var n=e.alternate;return n===null?(n=kt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function y0(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Kr(e,t,n,l,a,s){var i=0;if(l=e,typeof e=="function")$f(e)&&(i=1);else if(typeof e=="string")i=cN(e,n,wn.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case sd:return e=kt(31,n,t,a),e.elementType=sd,e.lanes=s,e;case Ca:return Wl(n.children,a,s,t);case Lx:i=8,a|=24;break;case nd:return e=kt(12,n,t,a|2),e.elementType=nd,e.lanes=s,e;case ld:return e=kt(13,n,t,a),e.elementType=ld,e.lanes=s,e;case ad:return e=kt(19,n,t,a),e.elementType=ad,e.lanes=s,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Bn:i=10;break e;case Bx:i=9;break e;case kf:i=11;break e;case Ef:i=14;break e;case ol:i=16,l=null;break e}i=29,n=Error(Z(130,e===null?"null":typeof e,"")),l=null}return t=kt(i,n,t,a),t.elementType=e,t.type=l,t.lanes=s,t}function Wl(e,t,n,l){return e=kt(7,e,l,t),e.lanes=n,e}function gu(e,t,n){return e=kt(6,e,null,t),e.lanes=n,e}function v0(e){var t=kt(18,null,null,0);return t.stateNode=e,t}function mu(e,t,n){return t=kt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var $p=new WeakMap;function Gt(e,t){if(typeof e=="object"&&e!==null){var n=$p.get(e);return n!==void 0?n:(t={value:e,source:t,stack:vp(t)},$p.set(e,t),t)}return{value:e,source:t,stack:vp(t)}}var Ha=[],La=0,wo=null,yi=0,Yt=[],Vt=0,Al=null,yn=1,vn="";function Hn(e,t){Ha[La++]=yi,Ha[La++]=wo,wo=e,yi=t}function b0(e,t,n){Yt[Vt++]=yn,Yt[Vt++]=vn,Yt[Vt++]=Al,Al=e;var l=yn;e=vn;var a=32-At(l)-1;l&=~(1<<a),n+=1;var s=32-At(t)+a;if(30<s){var i=a-a%5;s=(l&(1<<i)-1).toString(32),l>>=i,a-=i,yn=1<<32-At(t)+a|n<<a|l,vn=s+e}else yn=1<<s|n<<a|l,vn=e}function Uf(e){e.return!==null&&(Hn(e,1),b0(e,1,0))}function qf(e){for(;e===wo;)wo=Ha[--La],Ha[La]=null,yi=Ha[--La],Ha[La]=null;for(;e===Al;)Al=Yt[--Vt],Yt[Vt]=null,vn=Yt[--Vt],Yt[Vt]=null,yn=Yt[--Vt],Yt[Vt]=null}function w0(e,t){Yt[Vt++]=yn,Yt[Vt++]=vn,Yt[Vt++]=Al,yn=t.id,vn=t.overflow,Al=e}var tt=null,Ce=null,de=!1,Sl=null,Qt=!1,vd=Error(Z(519));function Tl(e){var t=Error(Z(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw vi(Gt(t,e)),vd}function Up(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[et]=e,t[bt]=l,n){case"dialog":oe("cancel",t),oe("close",t);break;case"iframe":case"object":case"embed":oe("load",t);break;case"video":case"audio":for(n=0;n<Ni.length;n++)oe(Ni[n],t);break;case"source":oe("error",t);break;case"img":case"image":case"link":oe("error",t),oe("load",t);break;case"details":oe("toggle",t);break;case"input":oe("invalid",t),Wx(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":oe("invalid",t);break;case"textarea":oe("invalid",t),Px(t,l.value,l.defaultValue,l.children)}n=l.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||l.suppressHydrationWarning===!0||lv(t.textContent,n)?(l.popover!=null&&(oe("beforetoggle",t),oe("toggle",t)),l.onScroll!=null&&oe("scroll",t),l.onScrollEnd!=null&&oe("scrollend",t),l.onClick!=null&&(t.onclick=$n),t=!0):t=!1,t||Tl(e,!0)}function qp(e){for(tt=e.return;tt;)switch(tt.tag){case 5:case 31:case 13:Qt=!1;return;case 27:case 3:Qt=!0;return;default:tt=tt.return}}function ba(e){if(e!==tt)return!1;if(!de)return qp(e),de=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Xd(e.type,e.memoizedProps)),n=!n),n&&Ce&&Tl(e),qp(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Z(317));Ce=Cg(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Z(317));Ce=Cg(e)}else t===27?(t=Ce,Hl(e.type)?(e=Id,Id=null,Ce=e):Ce=t):Ce=tt?It(e.stateNode.nextSibling):null;return!0}function la(){Ce=tt=null,de=!1}function xu(){var e=Sl;return e!==null&&(xt===null?xt=e:xt.push.apply(xt,e),Sl=null),e}function vi(e){Sl===null?Sl=[e]:Sl.push(e)}var bd=jn(null),xa=null,Un=null;function dl(e,t,n){ke(bd,t._currentValue),t._currentValue=n}function Vn(e){e._currentValue=bd.current,Fe(bd)}function wd(e,t,n){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===n)break;e=e.return}}function Sd(e,t,n,l){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var s=a.dependencies;if(s!==null){var i=a.child;s=s.firstContext;e:for(;s!==null;){var r=s;s=a;for(var c=0;c<t.length;c++)if(r.context===t[c]){s.lanes|=n,r=s.alternate,r!==null&&(r.lanes|=n),wd(s.return,n,e),l||(i=null);break e}s=r.next}}else if(a.tag===18){if(i=a.return,i===null)throw Error(Z(341));i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),wd(i,n,e),i=null}else i=a.child;if(i!==null)i.return=a;else for(i=a;i!==null;){if(i===e){i=null;break}if(a=i.sibling,a!==null){a.return=i.return,i=a;break}i=i.return}a=i}}function bs(e,t,n,l){e=null;for(var a=t,s=!1;a!==null;){if(!s){if(a.flags&524288)s=!0;else if(a.flags&262144)break}if(a.tag===10){var i=a.alternate;if(i===null)throw Error(Z(387));if(i=i.memoizedProps,i!==null){var r=a.type;Dt(a.pendingProps.value,i.value)||(e!==null?e.push(r):e=[r])}}else if(a===po.current){if(i=a.alternate,i===null)throw Error(Z(387));i.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e!==null?e.push(ki):e=[ki])}a=a.return}e!==null&&Sd(t,e,n,l),t.flags|=262144}function So(e){for(e=e.firstContext;e!==null;){if(!Dt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function aa(e){xa=e,Un=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function nt(e){return S0(xa,e)}function vr(e,t){return xa===null&&aa(e),S0(e,t)}function S0(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Un===null){if(e===null)throw Error(Z(308));Un=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Un=Un.next=t;return n}var sS=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},iS=Ze.unstable_scheduleCallback,rS=Ze.unstable_NormalPriority,qe={$$typeof:Bn,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Yf(){return{controller:new sS,data:new Map,refCount:0}}function Gi(e){e.refCount--,e.refCount===0&&iS(rS,function(){e.controller.abort()})}var Ps=null,Nd=0,es=0,Xa=null;function oS(e,t){if(Ps===null){var n=Ps=[];Nd=0,es=hh(),Xa={status:"pending",value:void 0,then:function(l){n.push(l)}}}return Nd++,t.then(Yp,Yp),t}function Yp(){if(--Nd===0&&Ps!==null){Xa!==null&&(Xa.status="fulfilled");var e=Ps;Ps=null,es=0,Xa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function cS(e,t){var n=[],l={status:"pending",value:null,reason:null,then:function(a){n.push(a)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var a=0;a<n.length;a++)(0,n[a])(t)},function(a){for(l.status="rejected",l.reason=a,a=0;a<n.length;a++)(0,n[a])(void 0)}),l}var Vp=ne.S;ne.S=function(e,t){Hy=_t(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&oS(e,t),Vp!==null&&Vp(e,t)};var Fl=jn(null);function Vf(){var e=Fl.current;return e!==null?e:je.pooledCache}function Jr(e,t){t===null?ke(Fl,Fl.current):ke(Fl,t.pool)}function N0(){var e=Vf();return e===null?null:{parent:qe._currentValue,pool:e}}var ws=Error(Z(460)),Xf=Error(Z(474)),vc=Error(Z(542)),No={then:function(){}};function Xp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function j0(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then($n,$n),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Qp(e),e;default:if(typeof t.status=="string")t.then($n,$n);else{if(e=je,e!==null&&100<e.shellSuspendCounter)throw Error(Z(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var a=t;a.status="fulfilled",a.value=l}},function(l){if(t.status==="pending"){var a=t;a.status="rejected",a.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Qp(e),e}throw Pl=t,ws}}function Xl(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Pl=n,ws):n}}var Pl=null;function Gp(){if(Pl===null)throw Error(Z(459));var e=Pl;return Pl=null,e}function Qp(e){if(e===ws||e===vc)throw Error(Z(483))}var Ga=null,bi=0;function br(e){var t=bi;return bi+=1,Ga===null&&(Ga=[]),j0(Ga,e,t)}function Rs(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function wr(e,t){throw t.$$typeof===K2?Error(Z(525)):(e=Object.prototype.toString.call(t),Error(Z(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function k0(e){function t(g,y){if(e){var m=g.deletions;m===null?(g.deletions=[y],g.flags|=16):m.push(y)}}function n(g,y){if(!e)return null;for(;y!==null;)t(g,y),y=y.sibling;return null}function l(g){for(var y=new Map;g!==null;)g.key!==null?y.set(g.key,g):y.set(g.index,g),g=g.sibling;return y}function a(g,y){return g=Yn(g,y),g.index=0,g.sibling=null,g}function s(g,y,m){return g.index=m,e?(m=g.alternate,m!==null?(m=m.index,m<y?(g.flags|=67108866,y):m):(g.flags|=67108866,y)):(g.flags|=1048576,y)}function i(g){return e&&g.alternate===null&&(g.flags|=67108866),g}function r(g,y,m,v){return y===null||y.tag!==6?(y=gu(m,g.mode,v),y.return=g,y):(y=a(y,m),y.return=g,y)}function c(g,y,m,v){var j=m.type;return j===Ca?d(g,y,m.props.children,v,m.key):y!==null&&(y.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===ol&&Xl(j)===y.type)?(y=a(y,m.props),Rs(y,m),y.return=g,y):(y=Kr(m.type,m.key,m.props,null,g.mode,v),Rs(y,m),y.return=g,y)}function u(g,y,m,v){return y===null||y.tag!==4||y.stateNode.containerInfo!==m.containerInfo||y.stateNode.implementation!==m.implementation?(y=mu(m,g.mode,v),y.return=g,y):(y=a(y,m.children||[]),y.return=g,y)}function d(g,y,m,v,j){return y===null||y.tag!==7?(y=Wl(m,g.mode,v,j),y.return=g,y):(y=a(y,m),y.return=g,y)}function f(g,y,m){if(typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint")return y=gu(""+y,g.mode,m),y.return=g,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case hr:return m=Kr(y.type,y.key,y.props,null,g.mode,m),Rs(m,y),m.return=g,m;case qs:return y=mu(y,g.mode,m),y.return=g,y;case ol:return y=Xl(y),f(g,y,m)}if(Ys(y)||Ts(y))return y=Wl(y,g.mode,m,null),y.return=g,y;if(typeof y.then=="function")return f(g,br(y),m);if(y.$$typeof===Bn)return f(g,vr(g,y),m);wr(g,y)}return null}function h(g,y,m,v){var j=y!==null?y.key:null;if(typeof m=="string"&&m!==""||typeof m=="number"||typeof m=="bigint")return j!==null?null:r(g,y,""+m,v);if(typeof m=="object"&&m!==null){switch(m.$$typeof){case hr:return m.key===j?c(g,y,m,v):null;case qs:return m.key===j?u(g,y,m,v):null;case ol:return m=Xl(m),h(g,y,m,v)}if(Ys(m)||Ts(m))return j!==null?null:d(g,y,m,v,null);if(typeof m.then=="function")return h(g,y,br(m),v);if(m.$$typeof===Bn)return h(g,y,vr(g,m),v);wr(g,m)}return null}function p(g,y,m,v,j){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return g=g.get(m)||null,r(y,g,""+v,j);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case hr:return g=g.get(v.key===null?m:v.key)||null,c(y,g,v,j);case qs:return g=g.get(v.key===null?m:v.key)||null,u(y,g,v,j);case ol:return v=Xl(v),p(g,y,m,v,j)}if(Ys(v)||Ts(v))return g=g.get(m)||null,d(y,g,v,j,null);if(typeof v.then=="function")return p(g,y,m,br(v),j);if(v.$$typeof===Bn)return p(g,y,m,vr(y,v),j);wr(y,v)}return null}function x(g,y,m,v){for(var j=null,k=null,E=y,A=y=0,M=null;E!==null&&A<m.length;A++){E.index>A?(M=E,E=null):M=E.sibling;var B=h(g,E,m[A],v);if(B===null){E===null&&(E=M);break}e&&E&&B.alternate===null&&t(g,E),y=s(B,y,A),k===null?j=B:k.sibling=B,k=B,E=M}if(A===m.length)return n(g,E),de&&Hn(g,A),j;if(E===null){for(;A<m.length;A++)E=f(g,m[A],v),E!==null&&(y=s(E,y,A),k===null?j=E:k.sibling=E,k=E);return de&&Hn(g,A),j}for(E=l(E);A<m.length;A++)M=p(E,g,A,m[A],v),M!==null&&(e&&M.alternate!==null&&E.delete(M.key===null?A:M.key),y=s(M,y,A),k===null?j=M:k.sibling=M,k=M);return e&&E.forEach(function(D){return t(g,D)}),de&&Hn(g,A),j}function S(g,y,m,v){if(m==null)throw Error(Z(151));for(var j=null,k=null,E=y,A=y=0,M=null,B=m.next();E!==null&&!B.done;A++,B=m.next()){E.index>A?(M=E,E=null):M=E.sibling;var D=h(g,E,B.value,v);if(D===null){E===null&&(E=M);break}e&&E&&D.alternate===null&&t(g,E),y=s(D,y,A),k===null?j=D:k.sibling=D,k=D,E=M}if(B.done)return n(g,E),de&&Hn(g,A),j;if(E===null){for(;!B.done;A++,B=m.next())B=f(g,B.value,v),B!==null&&(y=s(B,y,A),k===null?j=B:k.sibling=B,k=B);return de&&Hn(g,A),j}for(E=l(E);!B.done;A++,B=m.next())B=p(E,g,A,B.value,v),B!==null&&(e&&B.alternate!==null&&E.delete(B.key===null?A:B.key),y=s(B,y,A),k===null?j=B:k.sibling=B,k=B);return e&&E.forEach(function(L){return t(g,L)}),de&&Hn(g,A),j}function w(g,y,m,v){if(typeof m=="object"&&m!==null&&m.type===Ca&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case hr:e:{for(var j=m.key;y!==null;){if(y.key===j){if(j=m.type,j===Ca){if(y.tag===7){n(g,y.sibling),v=a(y,m.props.children),v.return=g,g=v;break e}}else if(y.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===ol&&Xl(j)===y.type){n(g,y.sibling),v=a(y,m.props),Rs(v,m),v.return=g,g=v;break e}n(g,y);break}else t(g,y);y=y.sibling}m.type===Ca?(v=Wl(m.props.children,g.mode,v,m.key),v.return=g,g=v):(v=Kr(m.type,m.key,m.props,null,g.mode,v),Rs(v,m),v.return=g,g=v)}return i(g);case qs:e:{for(j=m.key;y!==null;){if(y.key===j)if(y.tag===4&&y.stateNode.containerInfo===m.containerInfo&&y.stateNode.implementation===m.implementation){n(g,y.sibling),v=a(y,m.children||[]),v.return=g,g=v;break e}else{n(g,y);break}else t(g,y);y=y.sibling}v=mu(m,g.mode,v),v.return=g,g=v}return i(g);case ol:return m=Xl(m),w(g,y,m,v)}if(Ys(m))return x(g,y,m,v);if(Ts(m)){if(j=Ts(m),typeof j!="function")throw Error(Z(150));return m=j.call(m),S(g,y,m,v)}if(typeof m.then=="function")return w(g,y,br(m),v);if(m.$$typeof===Bn)return w(g,y,vr(g,m),v);wr(g,m)}return typeof m=="string"&&m!==""||typeof m=="number"||typeof m=="bigint"?(m=""+m,y!==null&&y.tag===6?(n(g,y.sibling),v=a(y,m),v.return=g,g=v):(n(g,y),v=gu(m,g.mode,v),v.return=g,g=v),i(g)):n(g,y)}return function(g,y,m,v){try{bi=0;var j=w(g,y,m,v);return Ga=null,j}catch(E){if(E===ws||E===vc)throw E;var k=kt(29,E,null,g.mode);return k.lanes=v,k.return=g,k}finally{}}}var sa=k0(!0),E0=k0(!1),cl=!1;function Gf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function jd(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Nl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function jl(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,xe&2){var a=l.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),l.pending=t,t=bo(e),x0(e,null,n),t}return yc(e,l,t,n),bo(e)}function ei(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Xx(e,n)}}function yu(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var a=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var i={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?a=s=i:s=s.next=i,n=n.next}while(n!==null);s===null?a=s=t:s=s.next=t}else a=s=t;n={baseState:l.baseState,firstBaseUpdate:a,lastBaseUpdate:s,shared:l.shared,callbacks:l.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var kd=!1;function ti(){if(kd){var e=Xa;if(e!==null)throw e}}function ni(e,t,n,l){kd=!1;var a=e.updateQueue;cl=!1;var s=a.firstBaseUpdate,i=a.lastBaseUpdate,r=a.shared.pending;if(r!==null){a.shared.pending=null;var c=r,u=c.next;c.next=null,i===null?s=u:i.next=u,i=c;var d=e.alternate;d!==null&&(d=d.updateQueue,r=d.lastBaseUpdate,r!==i&&(r===null?d.firstBaseUpdate=u:r.next=u,d.lastBaseUpdate=c))}if(s!==null){var f=a.baseState;i=0,d=u=c=null,r=s;do{var h=r.lane&-536870913,p=h!==r.lane;if(p?(ue&h)===h:(l&h)===h){h!==0&&h===es&&(kd=!0),d!==null&&(d=d.next={lane:0,tag:r.tag,payload:r.payload,callback:null,next:null});e:{var x=e,S=r;h=t;var w=n;switch(S.tag){case 1:if(x=S.payload,typeof x=="function"){f=x.call(w,f,h);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=S.payload,h=typeof x=="function"?x.call(w,f,h):x,h==null)break e;f=Ae({},f,h);break e;case 2:cl=!0}}h=r.callback,h!==null&&(e.flags|=64,p&&(e.flags|=8192),p=a.callbacks,p===null?a.callbacks=[h]:p.push(h))}else p={lane:h,tag:r.tag,payload:r.payload,callback:r.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,i|=h;if(r=r.next,r===null){if(r=a.shared.pending,r===null)break;p=r,r=p.next,p.next=null,a.lastBaseUpdate=p,a.shared.pending=null}}while(!0);d===null&&(c=f),a.baseState=c,a.firstBaseUpdate=u,a.lastBaseUpdate=d,s===null&&(a.shared.lanes=0),zl|=i,e.lanes=i,e.memoizedState=f}}function C0(e,t){if(typeof e!="function")throw Error(Z(191,e));e.call(t)}function _0(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)C0(n[e],t)}var ts=jn(null),jo=jn(0);function Zp(e,t){e=Jn,ke(jo,e),ke(ts,t),Jn=e|t.baseLanes}function Ed(){ke(jo,Jn),ke(ts,ts.current)}function Qf(){Jn=jo.current,Fe(ts),Fe(jo)}var zt=jn(null),Zt=null;function fl(e){var t=e.alternate;ke(Le,Le.current&1),ke(zt,e),Zt===null&&(t===null||ts.current!==null||t.memoizedState!==null)&&(Zt=e)}function Cd(e){ke(Le,Le.current),ke(zt,e),Zt===null&&(Zt=e)}function M0(e){e.tag===22?(ke(Le,Le.current),ke(zt,e),Zt===null&&(Zt=e)):hl()}function hl(){ke(Le,Le.current),ke(zt,zt.current)}function jt(e){Fe(zt),Zt===e&&(Zt=null),Fe(Le)}var Le=jn(0);function ko(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Qd(n)||Zd(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Zn=0,re=null,Ne=null,$e=null,Eo=!1,Qa=!1,ia=!1,Co=0,wi=0,Za=null,uS=0;function Oe(){throw Error(Z(321))}function Zf(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Dt(e[n],t[n]))return!1;return!0}function If(e,t,n,l,a,s){return Zn=s,re=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ne.H=e===null||e.memoizedState===null?iy:sh,ia=!1,s=n(l,a),ia=!1,Qa&&(s=T0(t,n,l,a)),A0(e),s}function A0(e){ne.H=Si;var t=Ne!==null&&Ne.next!==null;if(Zn=0,$e=Ne=re=null,Eo=!1,wi=0,Za=null,t)throw Error(Z(300));e===null||Ye||(e=e.dependencies,e!==null&&So(e)&&(Ye=!0))}function T0(e,t,n,l){re=e;var a=0;do{if(Qa&&(Za=null),wi=0,Qa=!1,25<=a)throw Error(Z(301));if(a+=1,$e=Ne=null,e.updateQueue!=null){var s=e.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,s.memoCache!=null&&(s.memoCache.index=0)}ne.H=ry,s=t(n,l)}while(Qa);return s}function dS(){var e=ne.H,t=e.useState()[0];return t=typeof t.then=="function"?Qi(t):t,e=e.useState()[0],(Ne!==null?Ne.memoizedState:null)!==e&&(re.flags|=1024),t}function Kf(){var e=Co!==0;return Co=0,e}function Jf(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Wf(e){if(Eo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Eo=!1}Zn=0,$e=Ne=re=null,Qa=!1,wi=Co=0,Za=null}function ct(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $e===null?re.memoizedState=$e=e:$e=$e.next=e,$e}function Be(){if(Ne===null){var e=re.alternate;e=e!==null?e.memoizedState:null}else e=Ne.next;var t=$e===null?re.memoizedState:$e.next;if(t!==null)$e=t,Ne=e;else{if(e===null)throw re.alternate===null?Error(Z(467)):Error(Z(310));Ne=e,e={memoizedState:Ne.memoizedState,baseState:Ne.baseState,baseQueue:Ne.baseQueue,queue:Ne.queue,next:null},$e===null?re.memoizedState=$e=e:$e=$e.next=e}return $e}function bc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Qi(e){var t=wi;return wi+=1,Za===null&&(Za=[]),e=j0(Za,e,t),t=re,($e===null?t.memoizedState:$e.next)===null&&(t=t.alternate,ne.H=t===null||t.memoizedState===null?iy:sh),e}function wc(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Qi(e);if(e.$$typeof===Bn)return nt(e)}throw Error(Z(438,String(e)))}function Ff(e){var t=null,n=re.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=re.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(a){return a.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=bc(),re.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),l=0;l<e;l++)n[l]=J2;return t.index++,n}function In(e,t){return typeof t=="function"?t(e):t}function Wr(e){var t=Be();return Pf(t,Ne,e)}function Pf(e,t,n){var l=e.queue;if(l===null)throw Error(Z(311));l.lastRenderedReducer=n;var a=e.baseQueue,s=l.pending;if(s!==null){if(a!==null){var i=a.next;a.next=s.next,s.next=i}t.baseQueue=a=s,l.pending=null}if(s=e.baseState,a===null)e.memoizedState=s;else{t=a.next;var r=i=null,c=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f!==u.lane?(ue&f)===f:(Zn&f)===f){var h=u.revertLane;if(h===0)c!==null&&(c=c.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===es&&(d=!0);else if((Zn&h)===h){u=u.next,h===es&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(r=c=f,i=s):c=c.next=f,re.lanes|=h,zl|=h;f=u.action,ia&&n(s,f),s=u.hasEagerState?u.eagerState:n(s,f)}else h={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(r=c=h,i=s):c=c.next=h,re.lanes|=f,zl|=f;u=u.next}while(u!==null&&u!==t);if(c===null?i=s:c.next=r,!Dt(s,e.memoizedState)&&(Ye=!0,d&&(n=Xa,n!==null)))throw n;e.memoizedState=s,e.baseState=i,e.baseQueue=c,l.lastRenderedState=s}return a===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function vu(e){var t=Be(),n=t.queue;if(n===null)throw Error(Z(311));n.lastRenderedReducer=e;var l=n.dispatch,a=n.pending,s=t.memoizedState;if(a!==null){n.pending=null;var i=a=a.next;do s=e(s,i.action),i=i.next;while(i!==a);Dt(s,t.memoizedState)||(Ye=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,l]}function D0(e,t,n){var l=re,a=Be(),s=de;if(s){if(n===void 0)throw Error(Z(407));n=n()}else n=t();var i=!Dt((Ne||a).memoizedState,n);if(i&&(a.memoizedState=n,Ye=!0),a=a.queue,eh(O0.bind(null,l,a,e),[e]),a.getSnapshot!==t||i||$e!==null&&$e.memoizedState.tag&1){if(l.flags|=2048,ns(9,{destroy:void 0},R0.bind(null,l,a,n,t),null),je===null)throw Error(Z(349));s||Zn&127||z0(l,t,n)}return n}function z0(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=re.updateQueue,t===null?(t=bc(),re.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function R0(e,t,n,l){t.value=n,t.getSnapshot=l,H0(t)&&L0(e)}function O0(e,t,n){return n(function(){H0(t)&&L0(e)})}function H0(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Dt(e,n)}catch{return!0}}function L0(e){var t=ma(e,2);t!==null&&vt(t,e,2)}function _d(e){var t=ct();if(typeof e=="function"){var n=e;if(e=n(),ia){ml(!0);try{n()}finally{ml(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:In,lastRenderedState:e},t}function B0(e,t,n,l){return e.baseState=n,Pf(e,Ne,typeof l=="function"?l:In)}function fS(e,t,n,l,a){if(Nc(e))throw Error(Z(485));if(e=t.action,e!==null){var s={payload:a,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(i){s.listeners.push(i)}};ne.T!==null?n(!0):s.isTransition=!1,l(s),n=t.pending,n===null?(s.next=t.pending=s,$0(t,s)):(s.next=n.next,t.pending=n.next=s)}}function $0(e,t){var n=t.action,l=t.payload,a=e.state;if(t.isTransition){var s=ne.T,i={};ne.T=i;try{var r=n(a,l),c=ne.S;c!==null&&c(i,r),Ip(e,t,r)}catch(u){Md(e,t,u)}finally{s!==null&&i.types!==null&&(s.types=i.types),ne.T=s}}else try{s=n(a,l),Ip(e,t,s)}catch(u){Md(e,t,u)}}function Ip(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){Kp(e,t,l)},function(l){return Md(e,t,l)}):Kp(e,t,n)}function Kp(e,t,n){t.status="fulfilled",t.value=n,U0(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,$0(e,n)))}function Md(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,U0(t),t=t.next;while(t!==l)}e.action=null}function U0(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function q0(e,t){return t}function Jp(e,t){if(de){var n=je.formState;if(n!==null){e:{var l=re;if(de){if(Ce){t:{for(var a=Ce,s=Qt;a.nodeType!==8;){if(!s){a=null;break t}if(a=It(a.nextSibling),a===null){a=null;break t}}s=a.data,a=s==="F!"||s==="F"?a:null}if(a){Ce=It(a.nextSibling),l=a.data==="F!";break e}}Tl(l)}l=!1}l&&(t=n[0])}}return n=ct(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:q0,lastRenderedState:t},n.queue=l,n=ly.bind(null,re,l),l.dispatch=n,l=_d(!1),s=ah.bind(null,re,!1,l.queue),l=ct(),a={state:t,dispatch:null,action:e,pending:null},l.queue=a,n=fS.bind(null,re,a,s,n),a.dispatch=n,l.memoizedState=e,[t,n,!1]}function Wp(e){var t=Be();return Y0(t,Ne,e)}function Y0(e,t,n){if(t=Pf(e,t,q0)[0],e=Wr(In)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Qi(t)}catch(i){throw i===ws?vc:i}else l=t;t=Be();var a=t.queue,s=a.dispatch;return n!==t.memoizedState&&(re.flags|=2048,ns(9,{destroy:void 0},hS.bind(null,a,n),null)),[l,s,e]}function hS(e,t){e.action=t}function Fp(e){var t=Be(),n=Ne;if(n!==null)return Y0(t,n,e);Be(),t=t.memoizedState,n=Be();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function ns(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=re.updateQueue,t===null&&(t=bc(),re.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(l=n.next,n.next=e,e.next=l,t.lastEffect=e),e}function V0(){return Be().memoizedState}function Fr(e,t,n,l){var a=ct();re.flags|=e,a.memoizedState=ns(1|t,{destroy:void 0},n,l===void 0?null:l)}function Sc(e,t,n,l){var a=Be();l=l===void 0?null:l;var s=a.memoizedState.inst;Ne!==null&&l!==null&&Zf(l,Ne.memoizedState.deps)?a.memoizedState=ns(t,s,n,l):(re.flags|=e,a.memoizedState=ns(1|t,s,n,l))}function Pp(e,t){Fr(8390656,8,e,t)}function eh(e,t){Sc(2048,8,e,t)}function pS(e){re.flags|=4;var t=re.updateQueue;if(t===null)t=bc(),re.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function X0(e){var t=Be().memoizedState;return pS({ref:t,nextImpl:e}),function(){if(xe&2)throw Error(Z(440));return t.impl.apply(void 0,arguments)}}function G0(e,t){return Sc(4,2,e,t)}function Q0(e,t){return Sc(4,4,e,t)}function Z0(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function I0(e,t,n){n=n!=null?n.concat([e]):null,Sc(4,4,Z0.bind(null,t,e),n)}function th(){}function K0(e,t){var n=Be();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&Zf(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function J0(e,t){var n=Be();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&Zf(t,l[1]))return l[0];if(l=e(),ia){ml(!0);try{e()}finally{ml(!1)}}return n.memoizedState=[l,t],l}function nh(e,t,n){return n===void 0||Zn&1073741824&&!(ue&261930)?e.memoizedState=t:(e.memoizedState=n,e=By(),re.lanes|=e,zl|=e,n)}function W0(e,t,n,l){return Dt(n,t)?n:ts.current!==null?(e=nh(e,n,l),Dt(e,t)||(Ye=!0),e):!(Zn&42)||Zn&1073741824&&!(ue&261930)?(Ye=!0,e.memoizedState=n):(e=By(),re.lanes|=e,zl|=e,t)}function F0(e,t,n,l,a){var s=ye.p;ye.p=s!==0&&8>s?s:8;var i=ne.T,r={};ne.T=r,ah(e,!1,t,n);try{var c=a(),u=ne.S;if(u!==null&&u(r,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=cS(c,l);li(e,t,d,Tt(e))}else li(e,t,l,Tt(e))}catch(f){li(e,t,{then:function(){},status:"rejected",reason:f},Tt())}finally{ye.p=s,i!==null&&r.types!==null&&(i.types=r.types),ne.T=i}}function gS(){}function Ad(e,t,n,l){if(e.tag!==5)throw Error(Z(476));var a=P0(e).queue;F0(e,a,t,Jl,n===null?gS:function(){return ey(e),n(l)})}function P0(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Jl,baseState:Jl,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:In,lastRenderedState:Jl},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:In,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ey(e){var t=P0(e);t.next===null&&(t=e.alternate.memoizedState),li(e,t.next.queue,{},Tt())}function lh(){return nt(ki)}function ty(){return Be().memoizedState}function ny(){return Be().memoizedState}function mS(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Tt();e=Nl(n);var l=jl(t,e,n);l!==null&&(vt(l,t,n),ei(l,t,n)),t={cache:Yf()},e.payload=t;return}t=t.return}}function xS(e,t,n){var l=Tt();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Nc(e)?ay(t,n):(n=Bf(e,t,n,l),n!==null&&(vt(n,e,l),sy(n,t,l)))}function ly(e,t,n){var l=Tt();li(e,t,n,l)}function li(e,t,n,l){var a={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Nc(e))ay(t,a);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var i=t.lastRenderedState,r=s(i,n);if(a.hasEagerState=!0,a.eagerState=r,Dt(r,i))return yc(e,t,a,0),je===null&&xc(),!1}catch{}finally{}if(n=Bf(e,t,a,l),n!==null)return vt(n,e,l),sy(n,t,l),!0}return!1}function ah(e,t,n,l){if(l={lane:2,revertLane:hh(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Nc(e)){if(t)throw Error(Z(479))}else t=Bf(e,n,l,2),t!==null&&vt(t,e,2)}function Nc(e){var t=e.alternate;return e===re||t!==null&&t===re}function ay(e,t){Qa=Eo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function sy(e,t,n){if(n&4194048){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Xx(e,n)}}var Si={readContext:nt,use:wc,useCallback:Oe,useContext:Oe,useEffect:Oe,useImperativeHandle:Oe,useLayoutEffect:Oe,useInsertionEffect:Oe,useMemo:Oe,useReducer:Oe,useRef:Oe,useState:Oe,useDebugValue:Oe,useDeferredValue:Oe,useTransition:Oe,useSyncExternalStore:Oe,useId:Oe,useHostTransitionStatus:Oe,useFormState:Oe,useActionState:Oe,useOptimistic:Oe,useMemoCache:Oe,useCacheRefresh:Oe};Si.useEffectEvent=Oe;var iy={readContext:nt,use:wc,useCallback:function(e,t){return ct().memoizedState=[e,t===void 0?null:t],e},useContext:nt,useEffect:Pp,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Fr(4194308,4,Z0.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Fr(4194308,4,e,t)},useInsertionEffect:function(e,t){Fr(4,2,e,t)},useMemo:function(e,t){var n=ct();t=t===void 0?null:t;var l=e();if(ia){ml(!0);try{e()}finally{ml(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=ct();if(n!==void 0){var a=n(t);if(ia){ml(!0);try{n(t)}finally{ml(!1)}}}else a=t;return l.memoizedState=l.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},l.queue=e,e=e.dispatch=xS.bind(null,re,e),[l.memoizedState,e]},useRef:function(e){var t=ct();return e={current:e},t.memoizedState=e},useState:function(e){e=_d(e);var t=e.queue,n=ly.bind(null,re,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:th,useDeferredValue:function(e,t){var n=ct();return nh(n,e,t)},useTransition:function(){var e=_d(!1);return e=F0.bind(null,re,e.queue,!0,!1),ct().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=re,a=ct();if(de){if(n===void 0)throw Error(Z(407));n=n()}else{if(n=t(),je===null)throw Error(Z(349));ue&127||z0(l,t,n)}a.memoizedState=n;var s={value:n,getSnapshot:t};return a.queue=s,Pp(O0.bind(null,l,s,e),[e]),l.flags|=2048,ns(9,{destroy:void 0},R0.bind(null,l,s,n,t),null),n},useId:function(){var e=ct(),t=je.identifierPrefix;if(de){var n=vn,l=yn;n=(l&~(1<<32-At(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Co++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=uS++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:lh,useFormState:Jp,useActionState:Jp,useOptimistic:function(e){var t=ct();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ah.bind(null,re,!0,n),n.dispatch=t,[e,t]},useMemoCache:Ff,useCacheRefresh:function(){return ct().memoizedState=mS.bind(null,re)},useEffectEvent:function(e){var t=ct(),n={impl:e};return t.memoizedState=n,function(){if(xe&2)throw Error(Z(440));return n.impl.apply(void 0,arguments)}}},sh={readContext:nt,use:wc,useCallback:K0,useContext:nt,useEffect:eh,useImperativeHandle:I0,useInsertionEffect:G0,useLayoutEffect:Q0,useMemo:J0,useReducer:Wr,useRef:V0,useState:function(){return Wr(In)},useDebugValue:th,useDeferredValue:function(e,t){var n=Be();return W0(n,Ne.memoizedState,e,t)},useTransition:function(){var e=Wr(In)[0],t=Be().memoizedState;return[typeof e=="boolean"?e:Qi(e),t]},useSyncExternalStore:D0,useId:ty,useHostTransitionStatus:lh,useFormState:Wp,useActionState:Wp,useOptimistic:function(e,t){var n=Be();return B0(n,Ne,e,t)},useMemoCache:Ff,useCacheRefresh:ny};sh.useEffectEvent=X0;var ry={readContext:nt,use:wc,useCallback:K0,useContext:nt,useEffect:eh,useImperativeHandle:I0,useInsertionEffect:G0,useLayoutEffect:Q0,useMemo:J0,useReducer:vu,useRef:V0,useState:function(){return vu(In)},useDebugValue:th,useDeferredValue:function(e,t){var n=Be();return Ne===null?nh(n,e,t):W0(n,Ne.memoizedState,e,t)},useTransition:function(){var e=vu(In)[0],t=Be().memoizedState;return[typeof e=="boolean"?e:Qi(e),t]},useSyncExternalStore:D0,useId:ty,useHostTransitionStatus:lh,useFormState:Fp,useActionState:Fp,useOptimistic:function(e,t){var n=Be();return Ne!==null?B0(n,Ne,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Ff,useCacheRefresh:ny};ry.useEffectEvent=X0;function bu(e,t,n,l){t=e.memoizedState,n=n(l,t),n=n==null?t:Ae({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Td={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=Tt(),a=Nl(l);a.payload=t,n!=null&&(a.callback=n),t=jl(e,a,l),t!==null&&(vt(t,e,l),ei(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=Tt(),a=Nl(l);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=jl(e,a,l),t!==null&&(vt(t,e,l),ei(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Tt(),l=Nl(n);l.tag=2,t!=null&&(l.callback=t),t=jl(e,l,n),t!==null&&(vt(t,e,n),ei(t,e,n))}};function eg(e,t,n,l,a,s,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,s,i):t.prototype&&t.prototype.isPureReactComponent?!xi(n,l)||!xi(a,s):!0}function tg(e,t,n,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,l),t.state!==e&&Td.enqueueReplaceState(t,t.state,null)}function ra(e,t){var n=t;if("ref"in t){n={};for(var l in t)l!=="ref"&&(n[l]=t[l])}if(e=e.defaultProps){n===t&&(n=Ae({},n));for(var a in e)n[a]===void 0&&(n[a]=e[a])}return n}function oy(e){vo(e)}function cy(e){console.error(e)}function uy(e){vo(e)}function _o(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function ng(e,t,n){try{var l=e.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function Dd(e,t,n){return n=Nl(n),n.tag=3,n.payload={element:null},n.callback=function(){_o(e,t)},n}function dy(e){return e=Nl(e),e.tag=3,e}function fy(e,t,n,l){var a=n.type.getDerivedStateFromError;if(typeof a=="function"){var s=l.value;e.payload=function(){return a(s)},e.callback=function(){ng(t,n,l)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){ng(t,n,l),typeof a!="function"&&(kl===null?kl=new Set([this]):kl.add(this));var r=l.stack;this.componentDidCatch(l.value,{componentStack:r!==null?r:""})})}function yS(e,t,n,l,a){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&bs(t,n,a,!0),n=zt.current,n!==null){switch(n.tag){case 31:case 13:return Zt===null?zo():n.alternate===null&&He===0&&(He=3),n.flags&=-257,n.flags|=65536,n.lanes=a,l===No?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),Tu(e,l,a)),!1;case 22:return n.flags|=65536,l===No?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([l]):n.add(l)),Tu(e,l,a)),!1}throw Error(Z(435,n.tag))}return Tu(e,l,a),zo(),!1}if(de)return t=zt.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,l!==vd&&(e=Error(Z(422),{cause:l}),vi(Gt(e,n)))):(l!==vd&&(t=Error(Z(423),{cause:l}),vi(Gt(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,l=Gt(l,n),a=Dd(e.stateNode,l,a),yu(e,a),He!==4&&(He=2)),!1;var s=Error(Z(520),{cause:l});if(s=Gt(s,n),ii===null?ii=[s]:ii.push(s),He!==4&&(He=2),t===null)return!0;l=Gt(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Dd(n.stateNode,l,e),yu(n,e),!1;case 1:if(t=n.type,s=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||s!==null&&typeof s.componentDidCatch=="function"&&(kl===null||!kl.has(s))))return n.flags|=65536,a&=-a,n.lanes|=a,a=dy(a),fy(a,e,n,l),yu(n,a),!1}n=n.return}while(n!==null);return!1}var ih=Error(Z(461)),Ye=!1;function Pe(e,t,n,l){t.child=e===null?E0(t,null,n,l):sa(t,e.child,n,l)}function lg(e,t,n,l,a){n=n.render;var s=t.ref;if("ref"in l){var i={};for(var r in l)r!=="ref"&&(i[r]=l[r])}else i=l;return aa(t),l=If(e,t,n,i,s,a),r=Kf(),e!==null&&!Ye?(Jf(e,t,a),Kn(e,t,a)):(de&&r&&Uf(t),t.flags|=1,Pe(e,t,l,a),t.child)}function ag(e,t,n,l,a){if(e===null){var s=n.type;return typeof s=="function"&&!$f(s)&&s.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=s,hy(e,t,s,l,a)):(e=Kr(n.type,null,l,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!rh(e,a)){var i=s.memoizedProps;if(n=n.compare,n=n!==null?n:xi,n(i,l)&&e.ref===t.ref)return Kn(e,t,a)}return t.flags|=1,e=Yn(s,l),e.ref=t.ref,e.return=t,t.child=e}function hy(e,t,n,l,a){if(e!==null){var s=e.memoizedProps;if(xi(s,l)&&e.ref===t.ref)if(Ye=!1,t.pendingProps=l=s,rh(e,a))e.flags&131072&&(Ye=!0);else return t.lanes=e.lanes,Kn(e,t,a)}return zd(e,t,n,l,a)}function py(e,t,n,l){var a=l.children,s=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if(t.flags&128){if(s=s!==null?s.baseLanes|n:n,e!==null){for(l=t.child=e.child,a=0;l!==null;)a=a|l.lanes|l.childLanes,l=l.sibling;l=a&~s}else l=0,t.child=null;return sg(e,t,s,n,l)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Jr(t,s!==null?s.cachePool:null),s!==null?Zp(t,s):Ed(),M0(t);else return l=t.lanes=536870912,sg(e,t,s!==null?s.baseLanes|n:n,n,l)}else s!==null?(Jr(t,s.cachePool),Zp(t,s),hl(),t.memoizedState=null):(e!==null&&Jr(t,null),Ed(),hl());return Pe(e,t,a,n),t.child}function Xs(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function sg(e,t,n,l,a){var s=Vf();return s=s===null?null:{parent:qe._currentValue,pool:s},t.memoizedState={baseLanes:n,cachePool:s},e!==null&&Jr(t,null),Ed(),M0(t),e!==null&&bs(e,t,l,!0),t.childLanes=a,null}function Pr(e,t){return t=Mo({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ig(e,t,n){return sa(t,e.child,null,n),e=Pr(t,t.pendingProps),e.flags|=2,jt(t),t.memoizedState=null,e}function vS(e,t,n){var l=t.pendingProps,a=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(de){if(l.mode==="hidden")return e=Pr(t,l),t.lanes=536870912,Xs(null,e);if(Cd(t),(e=Ce)?(e=iv(e,Qt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Al!==null?{id:yn,overflow:vn}:null,retryLane:536870912,hydrationErrors:null},n=v0(e),n.return=t,t.child=n,tt=t,Ce=null)):e=null,e===null)throw Tl(t);return t.lanes=536870912,null}return Pr(t,l)}var s=e.memoizedState;if(s!==null){var i=s.dehydrated;if(Cd(t),a)if(t.flags&256)t.flags&=-257,t=ig(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(Z(558));else if(Ye||bs(e,t,n,!1),a=(n&e.childLanes)!==0,Ye||a){if(l=je,l!==null&&(i=Gx(l,n),i!==0&&i!==s.retryLane))throw s.retryLane=i,ma(e,i),vt(l,e,i),ih;zo(),t=ig(e,t,n)}else e=s.treeContext,Ce=It(i.nextSibling),tt=t,de=!0,Sl=null,Qt=!1,e!==null&&w0(t,e),t=Pr(t,l),t.flags|=4096;return t}return e=Yn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function eo(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(Z(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function zd(e,t,n,l,a){return aa(t),n=If(e,t,n,l,void 0,a),l=Kf(),e!==null&&!Ye?(Jf(e,t,a),Kn(e,t,a)):(de&&l&&Uf(t),t.flags|=1,Pe(e,t,n,a),t.child)}function rg(e,t,n,l,a,s){return aa(t),t.updateQueue=null,n=T0(t,l,n,a),A0(e),l=Kf(),e!==null&&!Ye?(Jf(e,t,s),Kn(e,t,s)):(de&&l&&Uf(t),t.flags|=1,Pe(e,t,n,s),t.child)}function og(e,t,n,l,a){if(aa(t),t.stateNode===null){var s=Oa,i=n.contextType;typeof i=="object"&&i!==null&&(s=nt(i)),s=new n(l,s),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Td,t.stateNode=s,s._reactInternals=t,s=t.stateNode,s.props=l,s.state=t.memoizedState,s.refs={},Gf(t),i=n.contextType,s.context=typeof i=="object"&&i!==null?nt(i):Oa,s.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i=="function"&&(bu(t,n,i,l),s.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(i=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),i!==s.state&&Td.enqueueReplaceState(s,s.state,null),ni(t,l,s,a),ti(),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){s=t.stateNode;var r=t.memoizedProps,c=ra(n,r);s.props=c;var u=s.context,d=n.contextType;i=Oa,typeof d=="object"&&d!==null&&(i=nt(d));var f=n.getDerivedStateFromProps;d=typeof f=="function"||typeof s.getSnapshotBeforeUpdate=="function",r=t.pendingProps!==r,d||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(r||u!==i)&&tg(t,s,l,i),cl=!1;var h=t.memoizedState;s.state=h,ni(t,l,s,a),ti(),u=t.memoizedState,r||h!==u||cl?(typeof f=="function"&&(bu(t,n,f,l),u=t.memoizedState),(c=cl||eg(t,n,c,l,h,u,i))?(d||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=u),s.props=l,s.state=u,s.context=i,l=c):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{s=t.stateNode,jd(e,t),i=t.memoizedProps,d=ra(n,i),s.props=d,f=t.pendingProps,h=s.context,u=n.contextType,c=Oa,typeof u=="object"&&u!==null&&(c=nt(u)),r=n.getDerivedStateFromProps,(u=typeof r=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(i!==f||h!==c)&&tg(t,s,l,c),cl=!1,h=t.memoizedState,s.state=h,ni(t,l,s,a),ti();var p=t.memoizedState;i!==f||h!==p||cl||e!==null&&e.dependencies!==null&&So(e.dependencies)?(typeof r=="function"&&(bu(t,n,r,l),p=t.memoizedState),(d=cl||eg(t,n,d,l,h,p,c)||e!==null&&e.dependencies!==null&&So(e.dependencies))?(u||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(l,p,c),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(l,p,c)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||i===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=p),s.props=l,s.state=p,s.context=c,l=d):(typeof s.componentDidUpdate!="function"||i===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),l=!1)}return s=l,eo(e,t),l=(t.flags&128)!==0,s||l?(s=t.stateNode,n=l&&typeof n.getDerivedStateFromError!="function"?null:s.render(),t.flags|=1,e!==null&&l?(t.child=sa(t,e.child,null,a),t.child=sa(t,null,n,a)):Pe(e,t,n,a),t.memoizedState=s.state,e=t.child):e=Kn(e,t,a),e}function cg(e,t,n,l){return la(),t.flags|=256,Pe(e,t,n,l),t.child}var wu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Su(e){return{baseLanes:e,cachePool:N0()}}function Nu(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Ct),e}function gy(e,t,n){var l=t.pendingProps,a=!1,s=(t.flags&128)!==0,i;if((i=s)||(i=e!==null&&e.memoizedState===null?!1:(Le.current&2)!==0),i&&(a=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(de){if(a?fl(t):hl(),(e=Ce)?(e=iv(e,Qt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Al!==null?{id:yn,overflow:vn}:null,retryLane:536870912,hydrationErrors:null},n=v0(e),n.return=t,t.child=n,tt=t,Ce=null)):e=null,e===null)throw Tl(t);return Zd(e)?t.lanes=32:t.lanes=536870912,null}var r=l.children;return l=l.fallback,a?(hl(),a=t.mode,r=Mo({mode:"hidden",children:r},a),l=Wl(l,a,n,null),r.return=t,l.return=t,r.sibling=l,t.child=r,l=t.child,l.memoizedState=Su(n),l.childLanes=Nu(e,i,n),t.memoizedState=wu,Xs(null,l)):(fl(t),Rd(t,r))}var c=e.memoizedState;if(c!==null&&(r=c.dehydrated,r!==null)){if(s)t.flags&256?(fl(t),t.flags&=-257,t=ju(e,t,n)):t.memoizedState!==null?(hl(),t.child=e.child,t.flags|=128,t=null):(hl(),r=l.fallback,a=t.mode,l=Mo({mode:"visible",children:l.children},a),r=Wl(r,a,n,null),r.flags|=2,l.return=t,r.return=t,l.sibling=r,t.child=l,sa(t,e.child,null,n),l=t.child,l.memoizedState=Su(n),l.childLanes=Nu(e,i,n),t.memoizedState=wu,t=Xs(null,l));else if(fl(t),Zd(r)){if(i=r.nextSibling&&r.nextSibling.dataset,i)var u=i.dgst;i=u,l=Error(Z(419)),l.stack="",l.digest=i,vi({value:l,source:null,stack:null}),t=ju(e,t,n)}else if(Ye||bs(e,t,n,!1),i=(n&e.childLanes)!==0,Ye||i){if(i=je,i!==null&&(l=Gx(i,n),l!==0&&l!==c.retryLane))throw c.retryLane=l,ma(e,l),vt(i,e,l),ih;Qd(r)||zo(),t=ju(e,t,n)}else Qd(r)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,Ce=It(r.nextSibling),tt=t,de=!0,Sl=null,Qt=!1,e!==null&&w0(t,e),t=Rd(t,l.children),t.flags|=4096);return t}return a?(hl(),r=l.fallback,a=t.mode,c=e.child,u=c.sibling,l=Yn(c,{mode:"hidden",children:l.children}),l.subtreeFlags=c.subtreeFlags&65011712,u!==null?r=Yn(u,r):(r=Wl(r,a,n,null),r.flags|=2),r.return=t,l.return=t,l.sibling=r,t.child=l,Xs(null,l),l=t.child,r=e.child.memoizedState,r===null?r=Su(n):(a=r.cachePool,a!==null?(c=qe._currentValue,a=a.parent!==c?{parent:c,pool:c}:a):a=N0(),r={baseLanes:r.baseLanes|n,cachePool:a}),l.memoizedState=r,l.childLanes=Nu(e,i,n),t.memoizedState=wu,Xs(e.child,l)):(fl(t),n=e.child,e=n.sibling,n=Yn(n,{mode:"visible",children:l.children}),n.return=t,n.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=n,t.memoizedState=null,n)}function Rd(e,t){return t=Mo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Mo(e,t){return e=kt(22,e,null,t),e.lanes=0,e}function ju(e,t,n){return sa(t,e.child,null,n),e=Rd(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ug(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),wd(e.return,t,n)}function ku(e,t,n,l,a,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:a,treeForkCount:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=l,i.tail=n,i.tailMode=a,i.treeForkCount=s)}function my(e,t,n){var l=t.pendingProps,a=l.revealOrder,s=l.tail;l=l.children;var i=Le.current,r=(i&2)!==0;if(r?(i=i&1|2,t.flags|=128):i&=1,ke(Le,i),Pe(e,t,l,n),l=de?yi:0,!r&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ug(e,n,t);else if(e.tag===19)ug(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&ko(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),ku(t,!1,a,n,s,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&ko(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}ku(t,!0,n,null,s,l);break;case"together":ku(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Kn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),zl|=t.lanes,!(n&t.childLanes))if(e!==null){if(bs(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(Z(153));if(t.child!==null){for(e=t.child,n=Yn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function rh(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&So(e)))}function bS(e,t,n){switch(t.tag){case 3:go(t,t.stateNode.containerInfo),dl(t,qe,e.memoizedState.cache),la();break;case 27:case 5:od(t);break;case 4:go(t,t.stateNode.containerInfo);break;case 10:dl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Cd(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(fl(t),t.flags|=128,null):n&t.child.childLanes?gy(e,t,n):(fl(t),e=Kn(e,t,n),e!==null?e.sibling:null);fl(t);break;case 19:var a=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(bs(e,t,n,!1),l=(n&t.childLanes)!==0),a){if(l)return my(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),ke(Le,Le.current),l)break;return null;case 22:return t.lanes=0,py(e,t,n,t.pendingProps);case 24:dl(t,qe,e.memoizedState.cache)}return Kn(e,t,n)}function xy(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ye=!0;else{if(!rh(e,n)&&!(t.flags&128))return Ye=!1,bS(e,t,n);Ye=!!(e.flags&131072)}else Ye=!1,de&&t.flags&1048576&&b0(t,yi,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Xl(t.elementType),t.type=e,typeof e=="function")$f(e)?(l=ra(e,l),t.tag=1,t=og(null,t,e,l,n)):(t.tag=0,t=zd(null,t,e,l,n));else{if(e!=null){var a=e.$$typeof;if(a===kf){t.tag=11,t=lg(null,t,e,l,n);break e}else if(a===Ef){t.tag=14,t=ag(null,t,e,l,n);break e}}throw t=id(e)||e,Error(Z(306,t,""))}}return t;case 0:return zd(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,a=ra(l,t.pendingProps),og(e,t,l,a,n);case 3:e:{if(go(t,t.stateNode.containerInfo),e===null)throw Error(Z(387));l=t.pendingProps;var s=t.memoizedState;a=s.element,jd(e,t),ni(t,l,null,n);var i=t.memoizedState;if(l=i.cache,dl(t,qe,l),l!==s.cache&&Sd(t,[qe],n,!0),ti(),l=i.element,s.isDehydrated)if(s={element:l,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){t=cg(e,t,l,n);break e}else if(l!==a){a=Gt(Error(Z(424)),t),vi(a),t=cg(e,t,l,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ce=It(e.firstChild),tt=t,de=!0,Sl=null,Qt=!0,n=E0(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(la(),l===a){t=Kn(e,t,n);break e}Pe(e,t,l,n)}t=t.child}return t;case 26:return eo(e,t),e===null?(n=Ag(t.type,null,t.pendingProps,null))?t.memoizedState=n:de||(n=t.type,e=t.pendingProps,l=Lo(wl.current).createElement(n),l[et]=t,l[bt]=e,lt(l,n,e),We(l),t.stateNode=l):t.memoizedState=Ag(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return od(t),e===null&&de&&(l=t.stateNode=rv(t.type,t.pendingProps,wl.current),tt=t,Qt=!0,a=Ce,Hl(t.type)?(Id=a,Ce=It(l.firstChild)):Ce=a),Pe(e,t,t.pendingProps.children,n),eo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&de&&((a=l=Ce)&&(l=JS(l,t.type,t.pendingProps,Qt),l!==null?(t.stateNode=l,tt=t,Ce=It(l.firstChild),Qt=!1,a=!0):a=!1),a||Tl(t)),od(t),a=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,l=s.children,Xd(a,s)?l=null:i!==null&&Xd(a,i)&&(t.flags|=32),t.memoizedState!==null&&(a=If(e,t,dS,null,null,n),ki._currentValue=a),eo(e,t),Pe(e,t,l,n),t.child;case 6:return e===null&&de&&((e=n=Ce)&&(n=WS(n,t.pendingProps,Qt),n!==null?(t.stateNode=n,tt=t,Ce=null,e=!0):e=!1),e||Tl(t)),null;case 13:return gy(e,t,n);case 4:return go(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=sa(t,null,l,n):Pe(e,t,l,n),t.child;case 11:return lg(e,t,t.type,t.pendingProps,n);case 7:return Pe(e,t,t.pendingProps,n),t.child;case 8:return Pe(e,t,t.pendingProps.children,n),t.child;case 12:return Pe(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,dl(t,t.type,l.value),Pe(e,t,l.children,n),t.child;case 9:return a=t.type._context,l=t.pendingProps.children,aa(t),a=nt(a),l=l(a),t.flags|=1,Pe(e,t,l,n),t.child;case 14:return ag(e,t,t.type,t.pendingProps,n);case 15:return hy(e,t,t.type,t.pendingProps,n);case 19:return my(e,t,n);case 31:return vS(e,t,n);case 22:return py(e,t,n,t.pendingProps);case 24:return aa(t),l=nt(qe),e===null?(a=Vf(),a===null&&(a=je,s=Yf(),a.pooledCache=s,s.refCount++,s!==null&&(a.pooledCacheLanes|=n),a=s),t.memoizedState={parent:l,cache:a},Gf(t),dl(t,qe,a)):(e.lanes&n&&(jd(e,t),ni(t,null,null,n),ti()),a=e.memoizedState,s=t.memoizedState,a.parent!==l?(a={parent:l,cache:l},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),dl(t,qe,l)):(l=s.cache,dl(t,qe,l),l!==a.cache&&Sd(t,[qe],n,!0))),Pe(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(Z(156,t.tag))}function Tn(e){e.flags|=4}function Eu(e,t,n,l,a){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(a&335544128)===a)if(e.stateNode.complete)e.flags|=8192;else if(qy())e.flags|=8192;else throw Pl=No,Xf}else e.flags&=-16777217}function dg(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!uv(t))if(qy())e.flags|=8192;else throw Pl=No,Xf}function Sr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Yx():536870912,e.lanes|=t,ls|=t)}function Os(e,t){if(!de)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function Ee(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,l|=a.subtreeFlags&65011712,l|=a.flags&65011712,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,l|=a.subtreeFlags,l|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function wS(e,t,n){var l=t.pendingProps;switch(qf(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ee(t),null;case 1:return Ee(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Vn(qe),Wa(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ba(t)?Tn(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,xu())),Ee(t),null;case 26:var a=t.type,s=t.memoizedState;return e===null?(Tn(t),s!==null?(Ee(t),dg(t,s)):(Ee(t),Eu(t,a,null,l,n))):s?s!==e.memoizedState?(Tn(t),Ee(t),dg(t,s)):(Ee(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&Tn(t),Ee(t),Eu(t,a,e,l,n)),null;case 27:if(mo(t),n=wl.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Tn(t);else{if(!l){if(t.stateNode===null)throw Error(Z(166));return Ee(t),null}e=wn.current,ba(t)?Up(t):(e=rv(a,l,n),t.stateNode=e,Tn(t))}return Ee(t),null;case 5:if(mo(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Tn(t);else{if(!l){if(t.stateNode===null)throw Error(Z(166));return Ee(t),null}if(s=wn.current,ba(t))Up(t);else{var i=Lo(wl.current);switch(s){case 1:s=i.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:s=i.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":s=i.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":s=i.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":s=i.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof l.is=="string"?i.createElement("select",{is:l.is}):i.createElement("select"),l.multiple?s.multiple=!0:l.size&&(s.size=l.size);break;default:s=typeof l.is=="string"?i.createElement(a,{is:l.is}):i.createElement(a)}}s[et]=t,s[bt]=l;e:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)s.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=s;e:switch(lt(s,a,l),a){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Tn(t)}}return Ee(t),Eu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Tn(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(Z(166));if(e=wl.current,ba(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,a=tt,a!==null)switch(a.tag){case 27:case 5:l=a.memoizedProps}e[et]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||lv(e.nodeValue,n)),e||Tl(t,!0)}else e=Lo(e).createTextNode(l),e[et]=t,t.stateNode=e}return Ee(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=ba(t),n!==null){if(e===null){if(!l)throw Error(Z(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Z(557));e[et]=t}else la(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ee(t),e=!1}else n=xu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(jt(t),t):(jt(t),null);if(t.flags&128)throw Error(Z(558))}return Ee(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ba(t),l!==null&&l.dehydrated!==null){if(e===null){if(!a)throw Error(Z(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(Z(317));a[et]=t}else la(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ee(t),a=!1}else a=xu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(jt(t),t):(jt(t),null)}return jt(t),t.flags&128?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,a=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(a=l.alternate.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==a&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Sr(t,t.updateQueue),Ee(t),null);case 4:return Wa(),e===null&&ph(t.stateNode.containerInfo),Ee(t),null;case 10:return Vn(t.type),Ee(t),null;case 19:if(Fe(Le),l=t.memoizedState,l===null)return Ee(t),null;if(a=(t.flags&128)!==0,s=l.rendering,s===null)if(a)Os(l,!1);else{if(He!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=ko(e),s!==null){for(t.flags|=128,Os(l,!1),e=s.updateQueue,t.updateQueue=e,Sr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)y0(n,e),n=n.sibling;return ke(Le,Le.current&1|2),de&&Hn(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&_t()>To&&(t.flags|=128,a=!0,Os(l,!1),t.lanes=4194304)}else{if(!a)if(e=ko(s),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Sr(t,e),Os(l,!0),l.tail===null&&l.tailMode==="hidden"&&!s.alternate&&!de)return Ee(t),null}else 2*_t()-l.renderingStartTime>To&&n!==536870912&&(t.flags|=128,a=!0,Os(l,!1),t.lanes=4194304);l.isBackwards?(s.sibling=t.child,t.child=s):(e=l.last,e!==null?e.sibling=s:t.child=s,l.last=s)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=_t(),e.sibling=null,n=Le.current,ke(Le,a?n&1|2:n&1),de&&Hn(t,l.treeForkCount),e):(Ee(t),null);case 22:case 23:return jt(t),Qf(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?n&536870912&&!(t.flags&128)&&(Ee(t),t.subtreeFlags&6&&(t.flags|=8192)):Ee(t),n=t.updateQueue,n!==null&&Sr(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==n&&(t.flags|=2048),e!==null&&Fe(Fl),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Vn(qe),Ee(t),null;case 25:return null;case 30:return null}throw Error(Z(156,t.tag))}function SS(e,t){switch(qf(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vn(qe),Wa(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return mo(t),null;case 31:if(t.memoizedState!==null){if(jt(t),t.alternate===null)throw Error(Z(340));la()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Z(340));la()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Fe(Le),null;case 4:return Wa(),null;case 10:return Vn(t.type),null;case 22:case 23:return jt(t),Qf(),e!==null&&Fe(Fl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Vn(qe),null;case 25:return null;default:return null}}function yy(e,t){switch(qf(t),t.tag){case 3:Vn(qe),Wa();break;case 26:case 27:case 5:mo(t);break;case 4:Wa();break;case 31:t.memoizedState!==null&&jt(t);break;case 13:jt(t);break;case 19:Fe(Le);break;case 10:Vn(t.type);break;case 22:case 23:jt(t),Qf(),e!==null&&Fe(Fl);break;case 24:Vn(qe)}}function Zi(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var a=l.next;n=a;do{if((n.tag&e)===e){l=void 0;var s=n.create,i=n.inst;l=s(),i.destroy=l}n=n.next}while(n!==a)}}catch(r){we(t,t.return,r)}}function Dl(e,t,n){try{var l=t.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var s=a.next;l=s;do{if((l.tag&e)===e){var i=l.inst,r=i.destroy;if(r!==void 0){i.destroy=void 0,a=t;var c=n,u=r;try{u()}catch(d){we(a,c,d)}}}l=l.next}while(l!==s)}}catch(d){we(t,t.return,d)}}function vy(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{_0(t,n)}catch(l){we(e,e.return,l)}}}function by(e,t,n){n.props=ra(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){we(e,t,l)}}function ai(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof n=="function"?e.refCleanup=n(l):n.current=l}}catch(a){we(e,t,a)}}function bn(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(a){we(e,t,a)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){we(e,t,a)}else n.current=null}function wy(e){var t=e.type,n=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&l.focus();break e;case"img":n.src?l.src=n.src:n.srcSet&&(l.srcset=n.srcSet)}}catch(a){we(e,e.return,a)}}function Cu(e,t,n){try{var l=e.stateNode;XS(l,e.type,n,t),l[bt]=t}catch(a){we(e,e.return,a)}}function Sy(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Hl(e.type)||e.tag===4}function _u(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Sy(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Hl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Od(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=$n));else if(l!==4&&(l===27&&Hl(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Od(e,t,n),e=e.sibling;e!==null;)Od(e,t,n),e=e.sibling}function Ao(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(l!==4&&(l===27&&Hl(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Ao(e,t,n),e=e.sibling;e!==null;)Ao(e,t,n),e=e.sibling}function Ny(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);lt(t,l,n),t[et]=e,t[bt]=n}catch(s){we(e,e.return,s)}}var Ln=!1,Ue=!1,Mu=!1,fg=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function NS(e,t){if(e=e.containerInfo,Yd=qo,e=u0(e),Hf(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var a=l.anchorOffset,s=l.focusNode;l=l.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var i=0,r=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||a!==0&&f.nodeType!==3||(r=i+a),f!==s||l!==0&&f.nodeType!==3||(c=i+l),f.nodeType===3&&(i+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===a&&(r=i),h===s&&++d===l&&(c=i),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=r===-1||c===-1?null:{start:r,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Vd={focusedElem:e,selectionRange:n},qo=!1,Ke=t;Ke!==null;)if(t=Ke,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ke=e;else for(;Ke!==null;){switch(t=Ke,s=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&s!==null){e=void 0,n=t,a=s.memoizedProps,s=s.memoizedState,l=n.stateNode;try{var x=ra(n.type,a);e=l.getSnapshotBeforeUpdate(x,s),l.__reactInternalSnapshotBeforeUpdate=e}catch(S){we(n,n.return,S)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Gd(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Gd(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(Z(163))}if(e=t.sibling,e!==null){e.return=t.return,Ke=e;break}Ke=t.return}}function jy(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:zn(e,n),l&4&&Zi(5,n);break;case 1:if(zn(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){we(n,n.return,i)}else{var a=ra(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){we(n,n.return,i)}}l&64&&vy(n),l&512&&ai(n,n.return);break;case 3:if(zn(e,n),l&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{_0(e,t)}catch(i){we(n,n.return,i)}}break;case 27:t===null&&l&4&&Ny(n);case 26:case 5:zn(e,n),t===null&&l&4&&wy(n),l&512&&ai(n,n.return);break;case 12:zn(e,n);break;case 31:zn(e,n),l&4&&Cy(e,n);break;case 13:zn(e,n),l&4&&_y(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=DS.bind(null,n),FS(e,n))));break;case 22:if(l=n.memoizedState!==null||Ln,!l){t=t!==null&&t.memoizedState!==null||Ue,a=Ln;var s=Ue;Ln=l,(Ue=t)&&!s?On(e,n,(n.subtreeFlags&8772)!==0):zn(e,n),Ln=a,Ue=s}break;case 30:break;default:zn(e,n)}}function ky(e){var t=e.alternate;t!==null&&(e.alternate=null,ky(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Af(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Te=null,mt=!1;function Dn(e,t,n){for(n=n.child;n!==null;)Ey(e,t,n),n=n.sibling}function Ey(e,t,n){if(Mt&&typeof Mt.onCommitFiberUnmount=="function")try{Mt.onCommitFiberUnmount(Ui,n)}catch{}switch(n.tag){case 26:Ue||bn(n,t),Dn(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Ue||bn(n,t);var l=Te,a=mt;Hl(n.type)&&(Te=n.stateNode,mt=!1),Dn(e,t,n),oi(n.stateNode),Te=l,mt=a;break;case 5:Ue||bn(n,t);case 6:if(l=Te,a=mt,Te=null,Dn(e,t,n),Te=l,mt=a,Te!==null)if(mt)try{(Te.nodeType===9?Te.body:Te.nodeName==="HTML"?Te.ownerDocument.body:Te).removeChild(n.stateNode)}catch(s){we(n,t,s)}else try{Te.removeChild(n.stateNode)}catch(s){we(n,t,s)}break;case 18:Te!==null&&(mt?(e=Te,kg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),rs(e)):kg(Te,n.stateNode));break;case 4:l=Te,a=mt,Te=n.stateNode.containerInfo,mt=!0,Dn(e,t,n),Te=l,mt=a;break;case 0:case 11:case 14:case 15:Dl(2,n,t),Ue||Dl(4,n,t),Dn(e,t,n);break;case 1:Ue||(bn(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&by(n,t,l)),Dn(e,t,n);break;case 21:Dn(e,t,n);break;case 22:Ue=(l=Ue)||n.memoizedState!==null,Dn(e,t,n),Ue=l;break;default:Dn(e,t,n)}}function Cy(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{rs(e)}catch(n){we(t,t.return,n)}}}function _y(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{rs(e)}catch(n){we(t,t.return,n)}}function jS(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new fg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new fg),t;default:throw Error(Z(435,e.tag))}}function Nr(e,t){var n=jS(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var a=zS.bind(null,e,l);l.then(a,a)}})}function pt(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var a=n[l],s=e,i=t,r=i;e:for(;r!==null;){switch(r.tag){case 27:if(Hl(r.type)){Te=r.stateNode,mt=!1;break e}break;case 5:Te=r.stateNode,mt=!1;break e;case 3:case 4:Te=r.stateNode.containerInfo,mt=!0;break e}r=r.return}if(Te===null)throw Error(Z(160));Ey(s,i,a),Te=null,mt=!1,s=a.alternate,s!==null&&(s.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)My(t,e),t=t.sibling}var Pt=null;function My(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:pt(t,e),gt(e),l&4&&(Dl(3,e,e.return),Zi(3,e),Dl(5,e,e.return));break;case 1:pt(t,e),gt(e),l&512&&(Ue||n===null||bn(n,n.return)),l&64&&Ln&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?l:n.concat(l))));break;case 26:var a=Pt;if(pt(t,e),gt(e),l&512&&(Ue||n===null||bn(n,n.return)),l&4){var s=n!==null?n.memoizedState:null;if(l=e.memoizedState,n===null)if(l===null)if(e.stateNode===null){e:{l=e.type,n=e.memoizedProps,a=a.ownerDocument||a;t:switch(l){case"title":s=a.getElementsByTagName("title")[0],(!s||s[Vi]||s[et]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=a.createElement(l),a.head.insertBefore(s,a.querySelector("head > title"))),lt(s,l,n),s[et]=e,We(s),l=s;break e;case"link":var i=Dg("link","href",a).get(l+(n.href||""));if(i){for(var r=0;r<i.length;r++)if(s=i[r],s.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&s.getAttribute("rel")===(n.rel==null?null:n.rel)&&s.getAttribute("title")===(n.title==null?null:n.title)&&s.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){i.splice(r,1);break t}}s=a.createElement(l),lt(s,l,n),a.head.appendChild(s);break;case"meta":if(i=Dg("meta","content",a).get(l+(n.content||""))){for(r=0;r<i.length;r++)if(s=i[r],s.getAttribute("content")===(n.content==null?null:""+n.content)&&s.getAttribute("name")===(n.name==null?null:n.name)&&s.getAttribute("property")===(n.property==null?null:n.property)&&s.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&s.getAttribute("charset")===(n.charSet==null?null:n.charSet)){i.splice(r,1);break t}}s=a.createElement(l),lt(s,l,n),a.head.appendChild(s);break;default:throw Error(Z(468,l))}s[et]=e,We(s),l=s}e.stateNode=l}else zg(a,e.type,e.stateNode);else e.stateNode=Tg(a,l,e.memoizedProps);else s!==l?(s===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):s.count--,l===null?zg(a,e.type,e.stateNode):Tg(a,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Cu(e,e.memoizedProps,n.memoizedProps)}break;case 27:pt(t,e),gt(e),l&512&&(Ue||n===null||bn(n,n.return)),n!==null&&l&4&&Cu(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pt(t,e),gt(e),l&512&&(Ue||n===null||bn(n,n.return)),e.flags&32){a=e.stateNode;try{Pa(a,"")}catch(x){we(e,e.return,x)}}l&4&&e.stateNode!=null&&(a=e.memoizedProps,Cu(e,a,n!==null?n.memoizedProps:a)),l&1024&&(Mu=!0);break;case 6:if(pt(t,e),gt(e),l&4){if(e.stateNode===null)throw Error(Z(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(x){we(e,e.return,x)}}break;case 3:if(lo=null,a=Pt,Pt=Bo(t.containerInfo),pt(t,e),Pt=a,gt(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{rs(t.containerInfo)}catch(x){we(e,e.return,x)}Mu&&(Mu=!1,Ay(e));break;case 4:l=Pt,Pt=Bo(e.stateNode.containerInfo),pt(t,e),gt(e),Pt=l;break;case 12:pt(t,e),gt(e);break;case 31:pt(t,e),gt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Nr(e,l)));break;case 13:pt(t,e),gt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(jc=_t()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Nr(e,l)));break;case 22:a=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,u=Ln,d=Ue;if(Ln=u||a,Ue=d||c,pt(t,e),Ue=d,Ln=u,gt(e),l&8192)e:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||c||Ln||Ue||Gl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(s=c.stateNode,a)i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none";else{r=c.stateNode;var f=c.memoizedProps.style,h=f!=null&&f.hasOwnProperty("display")?f.display:null;r.style.display=h==null||typeof h=="boolean"?"":(""+h).trim()}}catch(x){we(c,c.return,x)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=a?"":c.memoizedProps}catch(x){we(c,c.return,x)}}}else if(t.tag===18){if(n===null){c=t;try{var p=c.stateNode;a?Eg(p,!0):Eg(c.stateNode,!1)}catch(x){we(c,c.return,x)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(n=l.retryQueue,n!==null&&(l.retryQueue=null,Nr(e,n))));break;case 19:pt(t,e),gt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Nr(e,l)));break;case 30:break;case 21:break;default:pt(t,e),gt(e)}}function gt(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(Sy(l)){n=l;break}l=l.return}if(n==null)throw Error(Z(160));switch(n.tag){case 27:var a=n.stateNode,s=_u(e);Ao(e,s,a);break;case 5:var i=n.stateNode;n.flags&32&&(Pa(i,""),n.flags&=-33);var r=_u(e);Ao(e,r,i);break;case 3:case 4:var c=n.stateNode.containerInfo,u=_u(e);Od(e,u,c);break;default:throw Error(Z(161))}}catch(d){we(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ay(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Ay(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function zn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)jy(e,t.alternate,t),t=t.sibling}function Gl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Dl(4,t,t.return),Gl(t);break;case 1:bn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&by(t,t.return,n),Gl(t);break;case 27:oi(t.stateNode);case 26:case 5:bn(t,t.return),Gl(t);break;case 22:t.memoizedState===null&&Gl(t);break;case 30:Gl(t);break;default:Gl(t)}e=e.sibling}}function On(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,a=e,s=t,i=s.flags;switch(s.tag){case 0:case 11:case 15:On(a,s,n),Zi(4,s);break;case 1:if(On(a,s,n),l=s,a=l.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(u){we(l,l.return,u)}if(l=s,a=l.updateQueue,a!==null){var r=l.stateNode;try{var c=a.shared.hiddenCallbacks;if(c!==null)for(a.shared.hiddenCallbacks=null,a=0;a<c.length;a++)C0(c[a],r)}catch(u){we(l,l.return,u)}}n&&i&64&&vy(s),ai(s,s.return);break;case 27:Ny(s);case 26:case 5:On(a,s,n),n&&l===null&&i&4&&wy(s),ai(s,s.return);break;case 12:On(a,s,n);break;case 31:On(a,s,n),n&&i&4&&Cy(a,s);break;case 13:On(a,s,n),n&&i&4&&_y(a,s);break;case 22:s.memoizedState===null&&On(a,s,n),ai(s,s.return);break;case 30:break;default:On(a,s,n)}t=t.sibling}}function oh(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Gi(n))}function ch(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Gi(e))}function Ft(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ty(e,t,n,l),t=t.sibling}function Ty(e,t,n,l){var a=t.flags;switch(t.tag){case 0:case 11:case 15:Ft(e,t,n,l),a&2048&&Zi(9,t);break;case 1:Ft(e,t,n,l);break;case 3:Ft(e,t,n,l),a&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Gi(e)));break;case 12:if(a&2048){Ft(e,t,n,l),e=t.stateNode;try{var s=t.memoizedProps,i=s.id,r=s.onPostCommit;typeof r=="function"&&r(i,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){we(t,t.return,c)}}else Ft(e,t,n,l);break;case 31:Ft(e,t,n,l);break;case 13:Ft(e,t,n,l);break;case 23:break;case 22:s=t.stateNode,i=t.alternate,t.memoizedState!==null?s._visibility&2?Ft(e,t,n,l):si(e,t):s._visibility&2?Ft(e,t,n,l):(s._visibility|=2,ka(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),a&2048&&oh(i,t);break;case 24:Ft(e,t,n,l),a&2048&&ch(t.alternate,t);break;default:Ft(e,t,n,l)}}function ka(e,t,n,l,a){for(a=a&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var s=e,i=t,r=n,c=l,u=i.flags;switch(i.tag){case 0:case 11:case 15:ka(s,i,r,c,a),Zi(8,i);break;case 23:break;case 22:var d=i.stateNode;i.memoizedState!==null?d._visibility&2?ka(s,i,r,c,a):si(s,i):(d._visibility|=2,ka(s,i,r,c,a)),a&&u&2048&&oh(i.alternate,i);break;case 24:ka(s,i,r,c,a),a&&u&2048&&ch(i.alternate,i);break;default:ka(s,i,r,c,a)}t=t.sibling}}function si(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,l=t,a=l.flags;switch(l.tag){case 22:si(n,l),a&2048&&oh(l.alternate,l);break;case 24:si(n,l),a&2048&&ch(l.alternate,l);break;default:si(n,l)}t=t.sibling}}var Gs=8192;function wa(e,t,n){if(e.subtreeFlags&Gs)for(e=e.child;e!==null;)Dy(e,t,n),e=e.sibling}function Dy(e,t,n){switch(e.tag){case 26:wa(e,t,n),e.flags&Gs&&e.memoizedState!==null&&uN(n,Pt,e.memoizedState,e.memoizedProps);break;case 5:wa(e,t,n);break;case 3:case 4:var l=Pt;Pt=Bo(e.stateNode.containerInfo),wa(e,t,n),Pt=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Gs,Gs=16777216,wa(e,t,n),Gs=l):wa(e,t,n));break;default:wa(e,t,n)}}function zy(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Hs(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];Ke=l,Oy(l,e)}zy(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ry(e),e=e.sibling}function Ry(e){switch(e.tag){case 0:case 11:case 15:Hs(e),e.flags&2048&&Dl(9,e,e.return);break;case 3:Hs(e);break;case 12:Hs(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,to(e)):Hs(e);break;default:Hs(e)}}function to(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];Ke=l,Oy(l,e)}zy(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Dl(8,t,t.return),to(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,to(t));break;default:to(t)}e=e.sibling}}function Oy(e,t){for(;Ke!==null;){var n=Ke;switch(n.tag){case 0:case 11:case 15:Dl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var l=n.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Gi(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,Ke=l;else e:for(n=e;Ke!==null;){l=Ke;var a=l.sibling,s=l.return;if(ky(l),l===n){Ke=null;break e}if(a!==null){a.return=s,Ke=a;break e}Ke=s}}}var kS={getCacheForType:function(e){var t=nt(qe),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return nt(qe).controller.signal}},ES=typeof WeakMap=="function"?WeakMap:Map,xe=0,je=null,ce=null,ue=0,be=0,Nt=null,yl=!1,Ss=!1,uh=!1,Jn=0,He=0,zl=0,ea=0,dh=0,Ct=0,ls=0,ii=null,xt=null,Hd=!1,jc=0,Hy=0,To=1/0,Do=null,kl=null,Qe=0,El=null,as=null,Xn=0,Ld=0,Bd=null,Ly=null,ri=0,$d=null;function Tt(){return xe&2&&ue!==0?ue&-ue:ne.T!==null?hh():Qx()}function By(){if(Ct===0)if(!(ue&536870912)||de){var e=gr;gr<<=1,!(gr&3932160)&&(gr=262144),Ct=e}else Ct=536870912;return e=zt.current,e!==null&&(e.flags|=32),Ct}function vt(e,t,n){(e===je&&(be===2||be===9)||e.cancelPendingCommit!==null)&&(ss(e,0),vl(e,ue,Ct,!1)),Yi(e,n),(!(xe&2)||e!==je)&&(e===je&&(!(xe&2)&&(ea|=n),He===4&&vl(e,ue,Ct,!1)),kn(e))}function $y(e,t,n){if(xe&6)throw Error(Z(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||qi(e,t),a=l?MS(e,t):Au(e,t,!0),s=l;do{if(a===0){Ss&&!l&&vl(e,t,0,!1);break}else{if(n=e.current.alternate,s&&!CS(n)){a=Au(e,t,!1),s=!1;continue}if(a===2){if(s=t,e.errorRecoveryDisabledLanes&s)var i=0;else i=e.pendingLanes&-536870913,i=i!==0?i:i&536870912?536870912:0;if(i!==0){t=i;e:{var r=e;a=ii;var c=r.current.memoizedState.isDehydrated;if(c&&(ss(r,i).flags|=256),i=Au(r,i,!1),i!==2){if(uh&&!c){r.errorRecoveryDisabledLanes|=s,ea|=s,a=4;break e}s=xt,xt=a,s!==null&&(xt===null?xt=s:xt.push.apply(xt,s))}a=i}if(s=!1,a!==2)continue}}if(a===1){ss(e,0),vl(e,t,0,!0);break}e:{switch(l=e,s=a,s){case 0:case 1:throw Error(Z(345));case 4:if((t&4194048)!==t)break;case 6:vl(l,t,Ct,!yl);break e;case 2:xt=null;break;case 3:case 5:break;default:throw Error(Z(329))}if((t&62914560)===t&&(a=jc+300-_t(),10<a)){if(vl(l,t,Ct,!yl),hc(l,0,!0)!==0)break e;Xn=t,l.timeoutHandle=sv(hg.bind(null,l,n,xt,Do,Hd,t,Ct,ea,ls,yl,s,"Throttled",-0,0),a);break e}hg(l,n,xt,Do,Hd,t,Ct,ea,ls,yl,s,null,-0,0)}}break}while(!0);kn(e)}function hg(e,t,n,l,a,s,i,r,c,u,d,f,h,p){if(e.timeoutHandle=-1,f=t.subtreeFlags,f&8192||(f&16785408)===16785408){f={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:$n},Dy(t,s,f);var x=(s&62914560)===s?jc-_t():(s&4194048)===s?Hy-_t():0;if(x=dN(f,x),x!==null){Xn=s,e.cancelPendingCommit=x(gg.bind(null,e,t,s,n,l,a,i,r,c,d,f,null,h,p)),vl(e,s,i,!u);return}}gg(e,t,s,n,l,a,i,r,c)}function CS(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var l=0;l<n.length;l++){var a=n[l],s=a.getSnapshot;a=a.value;try{if(!Dt(s(),a))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function vl(e,t,n,l){t&=~dh,t&=~ea,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var a=t;0<a;){var s=31-At(a),i=1<<s;l[s]=-1,a&=~i}n!==0&&Vx(e,n,t)}function kc(){return xe&6?!0:(Ii(0),!1)}function fh(){if(ce!==null){if(be===0)var e=ce.return;else e=ce,Un=xa=null,Wf(e),Ga=null,bi=0,e=ce;for(;e!==null;)yy(e.alternate,e),e=e.return;ce=null}}function ss(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,ZS(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Xn=0,fh(),je=e,ce=n=Yn(e.current,null),ue=t,be=0,Nt=null,yl=!1,Ss=qi(e,t),uh=!1,ls=Ct=dh=ea=zl=He=0,xt=ii=null,Hd=!1,t&8&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var a=31-At(l),s=1<<a;t|=e[a],l&=~s}return Jn=t,xc(),n}function Uy(e,t){re=null,ne.H=Si,t===ws||t===vc?(t=Gp(),be=3):t===Xf?(t=Gp(),be=4):be=t===ih?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Nt=t,ce===null&&(He=1,_o(e,Gt(t,e.current)))}function qy(){var e=zt.current;return e===null?!0:(ue&4194048)===ue?Zt===null:(ue&62914560)===ue||ue&536870912?e===Zt:!1}function Yy(){var e=ne.H;return ne.H=Si,e===null?Si:e}function Vy(){var e=ne.A;return ne.A=kS,e}function zo(){He=4,yl||(ue&4194048)!==ue&&zt.current!==null||(Ss=!0),!(zl&134217727)&&!(ea&134217727)||je===null||vl(je,ue,Ct,!1)}function Au(e,t,n){var l=xe;xe|=2;var a=Yy(),s=Vy();(je!==e||ue!==t)&&(Do=null,ss(e,t)),t=!1;var i=He;e:do try{if(be!==0&&ce!==null){var r=ce,c=Nt;switch(be){case 8:fh(),i=6;break e;case 3:case 2:case 9:case 6:zt.current===null&&(t=!0);var u=be;if(be=0,Nt=null,Ba(e,r,c,u),n&&Ss){i=0;break e}break;default:u=be,be=0,Nt=null,Ba(e,r,c,u)}}_S(),i=He;break}catch(d){Uy(e,d)}while(!0);return t&&e.shellSuspendCounter++,Un=xa=null,xe=l,ne.H=a,ne.A=s,ce===null&&(je=null,ue=0,xc()),i}function _S(){for(;ce!==null;)Xy(ce)}function MS(e,t){var n=xe;xe|=2;var l=Yy(),a=Vy();je!==e||ue!==t?(Do=null,To=_t()+500,ss(e,t)):Ss=qi(e,t);e:do try{if(be!==0&&ce!==null){t=ce;var s=Nt;t:switch(be){case 1:be=0,Nt=null,Ba(e,t,s,1);break;case 2:case 9:if(Xp(s)){be=0,Nt=null,pg(t);break}t=function(){be!==2&&be!==9||je!==e||(be=7),kn(e)},s.then(t,t);break e;case 3:be=7;break e;case 4:be=5;break e;case 7:Xp(s)?(be=0,Nt=null,pg(t)):(be=0,Nt=null,Ba(e,t,s,7));break;case 5:var i=null;switch(ce.tag){case 26:i=ce.memoizedState;case 5:case 27:var r=ce;if(i?uv(i):r.stateNode.complete){be=0,Nt=null;var c=r.sibling;if(c!==null)ce=c;else{var u=r.return;u!==null?(ce=u,Ec(u)):ce=null}break t}}be=0,Nt=null,Ba(e,t,s,5);break;case 6:be=0,Nt=null,Ba(e,t,s,6);break;case 8:fh(),He=6;break e;default:throw Error(Z(462))}}AS();break}catch(d){Uy(e,d)}while(!0);return Un=xa=null,ne.H=l,ne.A=a,xe=n,ce!==null?0:(je=null,ue=0,xc(),He)}function AS(){for(;ce!==null&&!P2();)Xy(ce)}function Xy(e){var t=xy(e.alternate,e,Jn);e.memoizedProps=e.pendingProps,t===null?Ec(e):ce=t}function pg(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=rg(n,t,t.pendingProps,t.type,void 0,ue);break;case 11:t=rg(n,t,t.pendingProps,t.type.render,t.ref,ue);break;case 5:Wf(t);default:yy(n,t),t=ce=y0(t,Jn),t=xy(n,t,Jn)}e.memoizedProps=e.pendingProps,t===null?Ec(e):ce=t}function Ba(e,t,n,l){Un=xa=null,Wf(t),Ga=null,bi=0;var a=t.return;try{if(yS(e,a,t,n,ue)){He=1,_o(e,Gt(n,e.current)),ce=null;return}}catch(s){if(a!==null)throw ce=a,s;He=1,_o(e,Gt(n,e.current)),ce=null;return}t.flags&32768?(de||l===1?e=!0:Ss||ue&536870912?e=!1:(yl=e=!0,(l===2||l===9||l===3||l===6)&&(l=zt.current,l!==null&&l.tag===13&&(l.flags|=16384))),Gy(t,e)):Ec(t)}function Ec(e){var t=e;do{if(t.flags&32768){Gy(t,yl);return}e=t.return;var n=wS(t.alternate,t,Jn);if(n!==null){ce=n;return}if(t=t.sibling,t!==null){ce=t;return}ce=t=e}while(t!==null);He===0&&(He=5)}function Gy(e,t){do{var n=SS(e.alternate,e);if(n!==null){n.flags&=32767,ce=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ce=e;return}ce=e=n}while(e!==null);He=6,ce=null}function gg(e,t,n,l,a,s,i,r,c){e.cancelPendingCommit=null;do Cc();while(Qe!==0);if(xe&6)throw Error(Z(327));if(t!==null){if(t===e.current)throw Error(Z(177));if(s=t.lanes|t.childLanes,s|=Lf,cw(e,n,s,i,r,c),e===je&&(ce=je=null,ue=0),as=t,El=e,Xn=n,Ld=s,Bd=a,Ly=l,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,RS(xo,function(){return Jy(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,t.subtreeFlags&13878||l){l=ne.T,ne.T=null,a=ye.p,ye.p=2,i=xe,xe|=4;try{NS(e,t,n)}finally{xe=i,ye.p=a,ne.T=l}}Qe=1,Qy(),Zy(),Iy()}}function Qy(){if(Qe===1){Qe=0;var e=El,t=as,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=ne.T,ne.T=null;var l=ye.p;ye.p=2;var a=xe;xe|=4;try{My(t,e);var s=Vd,i=u0(e.containerInfo),r=s.focusedElem,c=s.selectionRange;if(i!==r&&r&&r.ownerDocument&&c0(r.ownerDocument.documentElement,r)){if(c!==null&&Hf(r)){var u=c.start,d=c.end;if(d===void 0&&(d=u),"selectionStart"in r)r.selectionStart=u,r.selectionEnd=Math.min(d,r.value.length);else{var f=r.ownerDocument||document,h=f&&f.defaultView||window;if(h.getSelection){var p=h.getSelection(),x=r.textContent.length,S=Math.min(c.start,x),w=c.end===void 0?S:Math.min(c.end,x);!p.extend&&S>w&&(i=w,w=S,S=i);var g=Lp(r,S),y=Lp(r,w);if(g&&y&&(p.rangeCount!==1||p.anchorNode!==g.node||p.anchorOffset!==g.offset||p.focusNode!==y.node||p.focusOffset!==y.offset)){var m=f.createRange();m.setStart(g.node,g.offset),p.removeAllRanges(),S>w?(p.addRange(m),p.extend(y.node,y.offset)):(m.setEnd(y.node,y.offset),p.addRange(m))}}}}for(f=[],p=r;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<f.length;r++){var v=f[r];v.element.scrollLeft=v.left,v.element.scrollTop=v.top}}qo=!!Yd,Vd=Yd=null}finally{xe=a,ye.p=l,ne.T=n}}e.current=t,Qe=2}}function Zy(){if(Qe===2){Qe=0;var e=El,t=as,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=ne.T,ne.T=null;var l=ye.p;ye.p=2;var a=xe;xe|=4;try{jy(e,t.alternate,t)}finally{xe=a,ye.p=l,ne.T=n}}Qe=3}}function Iy(){if(Qe===4||Qe===3){Qe=0,ew();var e=El,t=as,n=Xn,l=Ly;t.subtreeFlags&10256||t.flags&10256?Qe=5:(Qe=0,as=El=null,Ky(e,e.pendingLanes));var a=e.pendingLanes;if(a===0&&(kl=null),Mf(n),t=t.stateNode,Mt&&typeof Mt.onCommitFiberRoot=="function")try{Mt.onCommitFiberRoot(Ui,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=ne.T,a=ye.p,ye.p=2,ne.T=null;try{for(var s=e.onRecoverableError,i=0;i<l.length;i++){var r=l[i];s(r.value,{componentStack:r.stack})}}finally{ne.T=t,ye.p=a}}Xn&3&&Cc(),kn(e),a=e.pendingLanes,n&261930&&a&42?e===$d?ri++:(ri=0,$d=e):ri=0,Ii(0)}}function Ky(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Gi(t)))}function Cc(){return Qy(),Zy(),Iy(),Jy()}function Jy(){if(Qe!==5)return!1;var e=El,t=Ld;Ld=0;var n=Mf(Xn),l=ne.T,a=ye.p;try{ye.p=32>n?32:n,ne.T=null,n=Bd,Bd=null;var s=El,i=Xn;if(Qe=0,as=El=null,Xn=0,xe&6)throw Error(Z(331));var r=xe;if(xe|=4,Ry(s.current),Ty(s,s.current,i,n),xe=r,Ii(0,!1),Mt&&typeof Mt.onPostCommitFiberRoot=="function")try{Mt.onPostCommitFiberRoot(Ui,s)}catch{}return!0}finally{ye.p=a,ne.T=l,Ky(e,t)}}function mg(e,t,n){t=Gt(n,t),t=Dd(e.stateNode,t,2),e=jl(e,t,2),e!==null&&(Yi(e,2),kn(e))}function we(e,t,n){if(e.tag===3)mg(e,e,n);else for(;t!==null;){if(t.tag===3){mg(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(kl===null||!kl.has(l))){e=Gt(n,e),n=dy(2),l=jl(t,n,2),l!==null&&(fy(n,l,t,e),Yi(l,2),kn(l));break}}t=t.return}}function Tu(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new ES;var a=new Set;l.set(t,a)}else a=l.get(t),a===void 0&&(a=new Set,l.set(t,a));a.has(n)||(uh=!0,a.add(n),e=TS.bind(null,e,t,n),t.then(e,e))}function TS(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,je===e&&(ue&n)===n&&(He===4||He===3&&(ue&62914560)===ue&&300>_t()-jc?!(xe&2)&&ss(e,0):dh|=n,ls===ue&&(ls=0)),kn(e)}function Wy(e,t){t===0&&(t=Yx()),e=ma(e,t),e!==null&&(Yi(e,t),kn(e))}function DS(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Wy(e,n)}function zS(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(Z(314))}l!==null&&l.delete(t),Wy(e,n)}function RS(e,t){return Cf(e,t)}var Ro=null,Ea=null,Ud=!1,Oo=!1,Du=!1,bl=0;function kn(e){e!==Ea&&e.next===null&&(Ea===null?Ro=Ea=e:Ea=Ea.next=e),Oo=!0,Ud||(Ud=!0,HS())}function Ii(e,t){if(!Du&&Oo){Du=!0;do for(var n=!1,l=Ro;l!==null;){if(e!==0){var a=l.pendingLanes;if(a===0)var s=0;else{var i=l.suspendedLanes,r=l.pingedLanes;s=(1<<31-At(42|e)+1)-1,s&=a&~(i&~r),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,xg(l,s))}else s=ue,s=hc(l,l===je?s:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),!(s&3)||qi(l,s)||(n=!0,xg(l,s));l=l.next}while(n);Du=!1}}function OS(){Fy()}function Fy(){Oo=Ud=!1;var e=0;bl!==0&&QS()&&(e=bl);for(var t=_t(),n=null,l=Ro;l!==null;){var a=l.next,s=Py(l,t);s===0?(l.next=null,n===null?Ro=a:n.next=a,a===null&&(Ea=n)):(n=l,(e!==0||s&3)&&(Oo=!0)),l=a}Qe!==0&&Qe!==5||Ii(e),bl!==0&&(bl=0)}function Py(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,a=e.expirationTimes,s=e.pendingLanes&-62914561;0<s;){var i=31-At(s),r=1<<i,c=a[i];c===-1?(!(r&n)||r&l)&&(a[i]=ow(r,t)):c<=t&&(e.expiredLanes|=r),s&=~r}if(t=je,n=ue,n=hc(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,n===0||e===t&&(be===2||be===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&iu(l),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||qi(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&iu(l),Mf(n)){case 2:case 8:n=Ux;break;case 32:n=xo;break;case 268435456:n=qx;break;default:n=xo}return l=ev.bind(null,e),n=Cf(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&iu(l),e.callbackPriority=2,e.callbackNode=null,2}function ev(e,t){if(Qe!==0&&Qe!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Cc()&&e.callbackNode!==n)return null;var l=ue;return l=hc(e,e===je?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:($y(e,l,t),Py(e,_t()),e.callbackNode!=null&&e.callbackNode===n?ev.bind(null,e):null)}function xg(e,t){if(Cc())return null;$y(e,t,!0)}function HS(){IS(function(){xe&6?Cf($x,OS):Fy()})}function hh(){if(bl===0){var e=es;e===0&&(e=pr,pr<<=1,!(pr&261888)&&(pr=256)),bl=e}return bl}function yg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Qr(""+e)}function vg(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function LS(e,t,n,l,a){if(t==="submit"&&n&&n.stateNode===a){var s=yg((a[bt]||null).action),i=l.submitter;i&&(t=(t=i[bt]||null)?yg(t.formAction):i.getAttribute("formAction"),t!==null&&(s=t,i=null));var r=new pc("action","action",null,l,a);e.push({event:r,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(bl!==0){var c=i?vg(a,i):new FormData(a);Ad(n,{pending:!0,data:c,method:a.method,action:s},null,c)}}else typeof s=="function"&&(r.preventDefault(),c=i?vg(a,i):new FormData(a),Ad(n,{pending:!0,data:c,method:a.method,action:s},s,c))},currentTarget:a}]})}}for(var zu=0;zu<yd.length;zu++){var Ru=yd[zu],BS=Ru.toLowerCase(),$S=Ru[0].toUpperCase()+Ru.slice(1);cn(BS,"on"+$S)}cn(f0,"onAnimationEnd");cn(h0,"onAnimationIteration");cn(p0,"onAnimationStart");cn("dblclick","onDoubleClick");cn("focusin","onFocus");cn("focusout","onBlur");cn(tS,"onTransitionRun");cn(nS,"onTransitionStart");cn(lS,"onTransitionCancel");cn(g0,"onTransitionEnd");Fa("onMouseEnter",["mouseout","mouseover"]);Fa("onMouseLeave",["mouseout","mouseover"]);Fa("onPointerEnter",["pointerout","pointerover"]);Fa("onPointerLeave",["pointerout","pointerover"]);ha("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ha("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ha("onBeforeInput",["compositionend","keypress","textInput","paste"]);ha("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ha("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ha("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ni="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(" "),US=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ni));function tv(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],a=l.event;l=l.listeners;e:{var s=void 0;if(t)for(var i=l.length-1;0<=i;i--){var r=l[i],c=r.instance,u=r.currentTarget;if(r=r.listener,c!==s&&a.isPropagationStopped())break e;s=r,a.currentTarget=u;try{s(a)}catch(d){vo(d)}a.currentTarget=null,s=c}else for(i=0;i<l.length;i++){if(r=l[i],c=r.instance,u=r.currentTarget,r=r.listener,c!==s&&a.isPropagationStopped())break e;s=r,a.currentTarget=u;try{s(a)}catch(d){vo(d)}a.currentTarget=null,s=c}}}}function oe(e,t){var n=t[ud];n===void 0&&(n=t[ud]=new Set);var l=e+"__bubble";n.has(l)||(nv(t,e,2,!1),n.add(l))}function Ou(e,t,n){var l=0;t&&(l|=4),nv(n,e,l,t)}var jr="_reactListening"+Math.random().toString(36).slice(2);function ph(e){if(!e[jr]){e[jr]=!0,Zx.forEach(function(n){n!=="selectionchange"&&(US.has(n)||Ou(n,!1,e),Ou(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[jr]||(t[jr]=!0,Ou("selectionchange",!1,t))}}function nv(e,t,n,l){switch(gv(t)){case 2:var a=pN;break;case 8:a=gN;break;default:a=yh}n=a.bind(null,t,n,e),a=void 0,!gd||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),l?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Hu(e,t,n,l,a){var s=l;if(!(t&1)&&!(t&2)&&l!==null)e:for(;;){if(l===null)return;var i=l.tag;if(i===3||i===4){var r=l.stateNode.containerInfo;if(r===a)break;if(i===4)for(i=l.return;i!==null;){var c=i.tag;if((c===3||c===4)&&i.stateNode.containerInfo===a)return;i=i.return}for(;r!==null;){if(i=Ma(r),i===null)return;if(c=i.tag,c===5||c===6||c===26||c===27){l=s=i;continue e}r=r.parentNode}}l=l.return}t0(function(){var u=s,d=Df(n),f=[];e:{var h=m0.get(e);if(h!==void 0){var p=pc,x=e;switch(e){case"keypress":if(Ir(n)===0)break e;case"keydown":case"keyup":p=zw;break;case"focusin":x="focus",p=du;break;case"focusout":x="blur",p=du;break;case"beforeblur":case"afterblur":p=du;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Cp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=ww;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Hw;break;case f0:case h0:case p0:p=jw;break;case g0:p=Bw;break;case"scroll":case"scrollend":p=vw;break;case"wheel":p=Uw;break;case"copy":case"cut":case"paste":p=Ew;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Mp;break;case"toggle":case"beforetoggle":p=Yw}var S=(t&4)!==0,w=!S&&(e==="scroll"||e==="scrollend"),g=S?h!==null?h+"Capture":null:h;S=[];for(var y=u,m;y!==null;){var v=y;if(m=v.stateNode,v=v.tag,v!==5&&v!==26&&v!==27||m===null||g===null||(v=gi(y,g),v!=null&&S.push(ji(y,v,m))),w)break;y=y.return}0<S.length&&(h=new p(h,x,null,n,d),f.push({event:h,listeners:S}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==pd&&(x=n.relatedTarget||n.fromElement)&&(Ma(x)||x[ys]))break e;if((p||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,p?(x=n.relatedTarget||n.toElement,p=u,x=x?Ma(x):null,x!==null&&(w=$i(x),S=x.tag,x!==w||S!==5&&S!==27&&S!==6)&&(x=null)):(p=null,x=u),p!==x)){if(S=Cp,v="onMouseLeave",g="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(S=Mp,v="onPointerLeave",g="onPointerEnter",y="pointer"),w=p==null?h:Vs(p),m=x==null?h:Vs(x),h=new S(v,y+"leave",p,n,d),h.target=w,h.relatedTarget=m,v=null,Ma(d)===u&&(S=new S(g,y+"enter",x,n,d),S.target=m,S.relatedTarget=w,v=S),w=v,p&&x)t:{for(S=qS,g=p,y=x,m=0,v=g;v;v=S(v))m++;v=0;for(var j=y;j;j=S(j))v++;for(;0<m-v;)g=S(g),m--;for(;0<v-m;)y=S(y),v--;for(;m--;){if(g===y||y!==null&&g===y.alternate){S=g;break t}g=S(g),y=S(y)}S=null}else S=null;p!==null&&bg(f,h,p,S,!1),x!==null&&w!==null&&bg(f,w,x,S,!0)}}e:{if(h=u?Vs(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var k=zp;else if(Dp(h))if(r0)k=Fw;else{k=Jw;var E=Kw}else p=h.nodeName,!p||p.toLowerCase()!=="input"||h.type!=="checkbox"&&h.type!=="radio"?u&&Tf(u.elementType)&&(k=zp):k=Ww;if(k&&(k=k(e,u))){i0(f,k,n,d);break e}E&&E(e,h,u),e==="focusout"&&u&&h.type==="number"&&u.memoizedProps.value!=null&&hd(h,"number",h.value)}switch(E=u?Vs(u):window,e){case"focusin":(Dp(E)||E.contentEditable==="true")&&(Da=E,md=u,Fs=null);break;case"focusout":Fs=md=Da=null;break;case"mousedown":xd=!0;break;case"contextmenu":case"mouseup":case"dragend":xd=!1,Bp(f,n,d);break;case"selectionchange":if(eS)break;case"keydown":case"keyup":Bp(f,n,d)}var A;if(Of)e:{switch(e){case"compositionstart":var M="onCompositionStart";break e;case"compositionend":M="onCompositionEnd";break e;case"compositionupdate":M="onCompositionUpdate";break e}M=void 0}else Ta?a0(e,n)&&(M="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(M="onCompositionStart");M&&(l0&&n.locale!=="ko"&&(Ta||M!=="onCompositionStart"?M==="onCompositionEnd"&&Ta&&(A=n0()):(xl=d,zf="value"in xl?xl.value:xl.textContent,Ta=!0)),E=Ho(u,M),0<E.length&&(M=new _p(M,e,null,n,d),f.push({event:M,listeners:E}),A?M.data=A:(A=s0(n),A!==null&&(M.data=A)))),(A=Xw?Gw(e,n):Qw(e,n))&&(M=Ho(u,"onBeforeInput"),0<M.length&&(E=new _p("onBeforeInput","beforeinput",null,n,d),f.push({event:E,listeners:M}),E.data=A)),LS(f,e,u,n,d)}tv(f,t)})}function ji(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ho(e,t){for(var n=t+"Capture",l=[];e!==null;){var a=e,s=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||s===null||(a=gi(e,n),a!=null&&l.unshift(ji(e,a,s)),a=gi(e,t),a!=null&&l.push(ji(e,a,s))),e.tag===3)return l;e=e.return}return[]}function qS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function bg(e,t,n,l,a){for(var s=t._reactName,i=[];n!==null&&n!==l;){var r=n,c=r.alternate,u=r.stateNode;if(r=r.tag,c!==null&&c===l)break;r!==5&&r!==26&&r!==27||u===null||(c=u,a?(u=gi(n,s),u!=null&&i.unshift(ji(n,u,c))):a||(u=gi(n,s),u!=null&&i.push(ji(n,u,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var YS=/\r\n?/g,VS=/\u0000|\uFFFD/g;function wg(e){return(typeof e=="string"?e:""+e).replace(YS,`
49
+ `).replace(VS,"")}function lv(e,t){return t=wg(t),wg(e)===t}function Se(e,t,n,l,a,s){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||Pa(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&Pa(e,""+l);break;case"className":xr(e,"class",l);break;case"tabIndex":xr(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":xr(e,n,l);break;case"style":e0(e,l,s);break;case"data":if(t!=="object"){xr(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=Qr(""+l),e.setAttribute(n,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof s=="function"&&(n==="formAction"?(t!=="input"&&Se(e,t,"name",a.name,a,null),Se(e,t,"formEncType",a.formEncType,a,null),Se(e,t,"formMethod",a.formMethod,a,null),Se(e,t,"formTarget",a.formTarget,a,null)):(Se(e,t,"encType",a.encType,a,null),Se(e,t,"method",a.method,a,null),Se(e,t,"target",a.target,a,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=Qr(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=$n);break;case"onScroll":l!=null&&oe("scroll",e);break;case"onScrollEnd":l!=null&&oe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(Z(61));if(n=l.__html,n!=null){if(a.children!=null)throw Error(Z(60));e.innerHTML=n}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}n=Qr(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""+l):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":l===!0?e.setAttribute(n,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,l):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(n,l):e.removeAttribute(n);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(n):e.setAttribute(n,l);break;case"popover":oe("beforetoggle",e),oe("toggle",e),Gr(e,"popover",l);break;case"xlinkActuate":An(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":An(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":An(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":An(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":An(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":An(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":An(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":An(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":An(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Gr(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=xw.get(n)||n,Gr(e,n,l))}}function qd(e,t,n,l,a,s){switch(n){case"style":e0(e,l,s);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(Z(61));if(n=l.__html,n!=null){if(a.children!=null)throw Error(Z(60));e.innerHTML=n}}break;case"children":typeof l=="string"?Pa(e,l):(typeof l=="number"||typeof l=="bigint")&&Pa(e,""+l);break;case"onScroll":l!=null&&oe("scroll",e);break;case"onScrollEnd":l!=null&&oe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=$n);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ix.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),t=n.slice(2,a?n.length-7:void 0),s=e[bt]||null,s=s!=null?s[n]:null,typeof s=="function"&&e.removeEventListener(t,s,a),typeof l=="function")){typeof s!="function"&&s!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,a);break e}n in e?e[n]=l:l===!0?e.setAttribute(n,""):Gr(e,n,l)}}}function lt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":oe("error",e),oe("load",e);var l=!1,a=!1,s;for(s in n)if(n.hasOwnProperty(s)){var i=n[s];if(i!=null)switch(s){case"src":l=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(Z(137,t));default:Se(e,t,s,i,n,null)}}a&&Se(e,t,"srcSet",n.srcSet,n,null),l&&Se(e,t,"src",n.src,n,null);return;case"input":oe("invalid",e);var r=s=i=a=null,c=null,u=null;for(l in n)if(n.hasOwnProperty(l)){var d=n[l];if(d!=null)switch(l){case"name":a=d;break;case"type":i=d;break;case"checked":c=d;break;case"defaultChecked":u=d;break;case"value":s=d;break;case"defaultValue":r=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(Z(137,t));break;default:Se(e,t,l,d,n,null)}}Wx(e,s,r,c,u,i,a,!1);return;case"select":oe("invalid",e),l=i=s=null;for(a in n)if(n.hasOwnProperty(a)&&(r=n[a],r!=null))switch(a){case"value":s=r;break;case"defaultValue":i=r;break;case"multiple":l=r;default:Se(e,t,a,r,n,null)}t=s,n=i,e.multiple=!!l,t!=null?Ya(e,!!l,t,!1):n!=null&&Ya(e,!!l,n,!0);return;case"textarea":oe("invalid",e),s=a=l=null;for(i in n)if(n.hasOwnProperty(i)&&(r=n[i],r!=null))switch(i){case"value":l=r;break;case"defaultValue":a=r;break;case"children":s=r;break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(Z(91));break;default:Se(e,t,i,r,n,null)}Px(e,l,a,s);return;case"option":for(c in n)if(n.hasOwnProperty(c)&&(l=n[c],l!=null))switch(c){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Se(e,t,c,l,n,null)}return;case"dialog":oe("beforetoggle",e),oe("toggle",e),oe("cancel",e),oe("close",e);break;case"iframe":case"object":oe("load",e);break;case"video":case"audio":for(l=0;l<Ni.length;l++)oe(Ni[l],e);break;case"image":oe("error",e),oe("load",e);break;case"details":oe("toggle",e);break;case"embed":case"source":case"link":oe("error",e),oe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(u in n)if(n.hasOwnProperty(u)&&(l=n[u],l!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(Z(137,t));default:Se(e,t,u,l,n,null)}return;default:if(Tf(t)){for(d in n)n.hasOwnProperty(d)&&(l=n[d],l!==void 0&&qd(e,t,d,l,n,void 0));return}}for(r in n)n.hasOwnProperty(r)&&(l=n[r],l!=null&&Se(e,t,r,l,n,null))}function XS(e,t,n,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,s=null,i=null,r=null,c=null,u=null,d=null;for(p in n){var f=n[p];if(n.hasOwnProperty(p)&&f!=null)switch(p){case"checked":break;case"value":break;case"defaultValue":c=f;default:l.hasOwnProperty(p)||Se(e,t,p,null,l,f)}}for(var h in l){var p=l[h];if(f=n[h],l.hasOwnProperty(h)&&(p!=null||f!=null))switch(h){case"type":s=p;break;case"name":a=p;break;case"checked":u=p;break;case"defaultChecked":d=p;break;case"value":i=p;break;case"defaultValue":r=p;break;case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(Z(137,t));break;default:p!==f&&Se(e,t,h,p,l,f)}}fd(e,i,r,c,u,d,s,a);return;case"select":p=i=r=h=null;for(s in n)if(c=n[s],n.hasOwnProperty(s)&&c!=null)switch(s){case"value":break;case"multiple":p=c;default:l.hasOwnProperty(s)||Se(e,t,s,null,l,c)}for(a in l)if(s=l[a],c=n[a],l.hasOwnProperty(a)&&(s!=null||c!=null))switch(a){case"value":h=s;break;case"defaultValue":r=s;break;case"multiple":i=s;default:s!==c&&Se(e,t,a,s,l,c)}t=r,n=i,l=p,h!=null?Ya(e,!!n,h,!1):!!l!=!!n&&(t!=null?Ya(e,!!n,t,!0):Ya(e,!!n,n?[]:"",!1));return;case"textarea":p=h=null;for(r in n)if(a=n[r],n.hasOwnProperty(r)&&a!=null&&!l.hasOwnProperty(r))switch(r){case"value":break;case"children":break;default:Se(e,t,r,null,l,a)}for(i in l)if(a=l[i],s=n[i],l.hasOwnProperty(i)&&(a!=null||s!=null))switch(i){case"value":h=a;break;case"defaultValue":p=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(Z(91));break;default:a!==s&&Se(e,t,i,a,l,s)}Fx(e,h,p);return;case"option":for(var x in n)if(h=n[x],n.hasOwnProperty(x)&&h!=null&&!l.hasOwnProperty(x))switch(x){case"selected":e.selected=!1;break;default:Se(e,t,x,null,l,h)}for(c in l)if(h=l[c],p=n[c],l.hasOwnProperty(c)&&h!==p&&(h!=null||p!=null))switch(c){case"selected":e.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:Se(e,t,c,h,l,p)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var S in n)h=n[S],n.hasOwnProperty(S)&&h!=null&&!l.hasOwnProperty(S)&&Se(e,t,S,null,l,h);for(u in l)if(h=l[u],p=n[u],l.hasOwnProperty(u)&&h!==p&&(h!=null||p!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(Z(137,t));break;default:Se(e,t,u,h,l,p)}return;default:if(Tf(t)){for(var w in n)h=n[w],n.hasOwnProperty(w)&&h!==void 0&&!l.hasOwnProperty(w)&&qd(e,t,w,void 0,l,h);for(d in l)h=l[d],p=n[d],!l.hasOwnProperty(d)||h===p||h===void 0&&p===void 0||qd(e,t,d,h,l,p);return}}for(var g in n)h=n[g],n.hasOwnProperty(g)&&h!=null&&!l.hasOwnProperty(g)&&Se(e,t,g,null,l,h);for(f in l)h=l[f],p=n[f],!l.hasOwnProperty(f)||h===p||h==null&&p==null||Se(e,t,f,h,l,p)}function Sg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function GS(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var a=n[l],s=a.transferSize,i=a.initiatorType,r=a.duration;if(s&&r&&Sg(i)){for(i=0,r=a.responseEnd,l+=1;l<n.length;l++){var c=n[l],u=c.startTime;if(u>r)break;var d=c.transferSize,f=c.initiatorType;d&&Sg(f)&&(c=c.responseEnd,i+=d*(c<r?1:(r-u)/(c-u)))}if(--l,t+=8*(s+i)/(a.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Yd=null,Vd=null;function Lo(e){return e.nodeType===9?e:e.ownerDocument}function Ng(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function av(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Xd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Lu=null;function QS(){var e=window.event;return e&&e.type==="popstate"?e===Lu?!1:(Lu=e,!0):(Lu=null,!1)}var sv=typeof setTimeout=="function"?setTimeout:void 0,ZS=typeof clearTimeout=="function"?clearTimeout:void 0,jg=typeof Promise=="function"?Promise:void 0,IS=typeof queueMicrotask=="function"?queueMicrotask:typeof jg<"u"?function(e){return jg.resolve(null).then(e).catch(KS)}:sv;function KS(e){setTimeout(function(){throw e})}function Hl(e){return e==="head"}function kg(e,t){var n=t,l=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"||n==="/&"){if(l===0){e.removeChild(a),rs(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")oi(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,oi(n);for(var s=n.firstChild;s;){var i=s.nextSibling,r=s.nodeName;s[Vi]||r==="SCRIPT"||r==="STYLE"||r==="LINK"&&s.rel.toLowerCase()==="stylesheet"||n.removeChild(s),s=i}}else n==="body"&&oi(e.ownerDocument.body);n=a}while(n);rs(t)}function Eg(e,t){var n=e;e=0;do{var l=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=l}while(n)}function Gd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Gd(n),Af(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function JS(e,t,n,l){for(;e.nodeType===1;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Vi])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(s=e.getAttribute("rel"),s==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(s!==a.rel||e.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||e.getAttribute("title")!==(a.title==null?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(s=e.getAttribute("src"),(s!==(a.src==null?null:a.src)||e.getAttribute("type")!==(a.type==null?null:a.type)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&s&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var s=a.name==null?null:""+a.name;if(a.type==="hidden"&&e.getAttribute("name")===s)return e}else return e;if(e=It(e.nextSibling),e===null)break}return null}function WS(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=It(e.nextSibling),e===null))return null;return e}function iv(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=It(e.nextSibling),e===null))return null;return e}function Qd(e){return e.data==="$?"||e.data==="$~"}function Zd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function FS(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var l=function(){t(),n.removeEventListener("DOMContentLoaded",l)};n.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function It(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Id=null;function Cg(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return It(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function _g(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function rv(e,t,n){switch(t=Lo(n),e){case"html":if(e=t.documentElement,!e)throw Error(Z(452));return e;case"head":if(e=t.head,!e)throw Error(Z(453));return e;case"body":if(e=t.body,!e)throw Error(Z(454));return e;default:throw Error(Z(451))}}function oi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Af(e)}var Kt=new Map,Mg=new Set;function Bo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Fn=ye.d;ye.d={f:PS,r:eN,D:tN,C:nN,L:lN,m:aN,X:iN,S:sN,M:rN};function PS(){var e=Fn.f(),t=kc();return e||t}function eN(e){var t=vs(e);t!==null&&t.tag===5&&t.type==="form"?ey(t):Fn.r(e)}var Ns=typeof document>"u"?null:document;function ov(e,t,n){var l=Ns;if(l&&typeof t=="string"&&t){var a=Xt(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),Mg.has(a)||(Mg.add(a),e={rel:e,crossOrigin:n,href:t},l.querySelector(a)===null&&(t=l.createElement("link"),lt(t,"link",e),We(t),l.head.appendChild(t)))}}function tN(e){Fn.D(e),ov("dns-prefetch",e,null)}function nN(e,t){Fn.C(e,t),ov("preconnect",e,t)}function lN(e,t,n){Fn.L(e,t,n);var l=Ns;if(l&&e&&t){var a='link[rel="preload"][as="'+Xt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+Xt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+Xt(n.imageSizes)+'"]')):a+='[href="'+Xt(e)+'"]';var s=a;switch(t){case"style":s=is(e);break;case"script":s=js(e)}Kt.has(s)||(e=Ae({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Kt.set(s,e),l.querySelector(a)!==null||t==="style"&&l.querySelector(Ki(s))||t==="script"&&l.querySelector(Ji(s))||(t=l.createElement("link"),lt(t,"link",e),We(t),l.head.appendChild(t)))}}function aN(e,t){Fn.m(e,t);var n=Ns;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+Xt(l)+'"][href="'+Xt(e)+'"]',s=a;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=js(e)}if(!Kt.has(s)&&(e=Ae({rel:"modulepreload",href:e},t),Kt.set(s,e),n.querySelector(a)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ji(s)))return}l=n.createElement("link"),lt(l,"link",e),We(l),n.head.appendChild(l)}}}function sN(e,t,n){Fn.S(e,t,n);var l=Ns;if(l&&e){var a=qa(l).hoistableStyles,s=is(e);t=t||"default";var i=a.get(s);if(!i){var r={loading:0,preload:null};if(i=l.querySelector(Ki(s)))r.loading=5;else{e=Ae({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Kt.get(s))&&gh(e,n);var c=i=l.createElement("link");We(c),lt(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){r.loading|=1}),c.addEventListener("error",function(){r.loading|=2}),r.loading|=4,no(i,t,l)}i={type:"stylesheet",instance:i,count:1,state:r},a.set(s,i)}}}function iN(e,t){Fn.X(e,t);var n=Ns;if(n&&e){var l=qa(n).hoistableScripts,a=js(e),s=l.get(a);s||(s=n.querySelector(Ji(a)),s||(e=Ae({src:e,async:!0},t),(t=Kt.get(a))&&mh(e,t),s=n.createElement("script"),We(s),lt(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(a,s))}}function rN(e,t){Fn.M(e,t);var n=Ns;if(n&&e){var l=qa(n).hoistableScripts,a=js(e),s=l.get(a);s||(s=n.querySelector(Ji(a)),s||(e=Ae({src:e,async:!0,type:"module"},t),(t=Kt.get(a))&&mh(e,t),s=n.createElement("script"),We(s),lt(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(a,s))}}function Ag(e,t,n,l){var a=(a=wl.current)?Bo(a):null;if(!a)throw Error(Z(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=is(n.href),n=qa(a).hoistableStyles,l=n.get(t),l||(l={type:"style",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=is(n.href);var s=qa(a).hoistableStyles,i=s.get(e);if(i||(a=a.ownerDocument||a,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,i),(s=a.querySelector(Ki(e)))&&!s._p&&(i.instance=s,i.state.loading=5),Kt.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Kt.set(e,n),s||oN(a,e,n,i.state))),t&&l===null)throw Error(Z(528,""));return i}if(t&&l!==null)throw Error(Z(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=js(n),n=qa(a).hoistableScripts,l=n.get(t),l||(l={type:"script",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(Z(444,e))}}function is(e){return'href="'+Xt(e)+'"'}function Ki(e){return'link[rel="stylesheet"]['+e+"]"}function cv(e){return Ae({},e,{"data-precedence":e.precedence,precedence:null})}function oN(e,t,n,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),lt(t,"link",n),We(t),e.head.appendChild(t))}function js(e){return'[src="'+Xt(e)+'"]'}function Ji(e){return"script[async]"+e}function Tg(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+Xt(n.href)+'"]');if(l)return t.instance=l,We(l),l;var a=Ae({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),We(l),lt(l,"style",a),no(l,n.precedence,e),t.instance=l;case"stylesheet":a=is(n.href);var s=e.querySelector(Ki(a));if(s)return t.state.loading|=4,t.instance=s,We(s),s;l=cv(n),(a=Kt.get(a))&&gh(l,a),s=(e.ownerDocument||e).createElement("link"),We(s);var i=s;return i._p=new Promise(function(r,c){i.onload=r,i.onerror=c}),lt(s,"link",l),t.state.loading|=4,no(s,n.precedence,e),t.instance=s;case"script":return s=js(n.src),(a=e.querySelector(Ji(s)))?(t.instance=a,We(a),a):(l=n,(a=Kt.get(s))&&(l=Ae({},n),mh(l,a)),e=e.ownerDocument||e,a=e.createElement("script"),We(a),lt(a,"link",l),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(Z(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(l=t.instance,t.state.loading|=4,no(l,n.precedence,e));return t.instance}function no(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=l.length?l[l.length-1]:null,s=a,i=0;i<l.length;i++){var r=l[i];if(r.dataset.precedence===t)s=r;else if(s!==a)break}s?s.parentNode.insertBefore(e,s.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function gh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function mh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var lo=null;function Dg(e,t,n){if(lo===null){var l=new Map,a=lo=new Map;a.set(n,l)}else a=lo,l=a.get(n),l||(l=new Map,a.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),a=0;a<n.length;a++){var s=n[a];if(!(s[Vi]||s[et]||e==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var i=s.getAttribute(t)||"";i=e+i;var r=l.get(i);r?r.push(s):l.set(i,[s])}}return l}function zg(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function cN(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function uv(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function uN(e,t,n,l){if(n.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var a=is(l.href),s=t.querySelector(Ki(a));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=$o.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,We(s);return}s=t.ownerDocument||t,l=cv(l),(a=Kt.get(a))&&gh(l,a),s=s.createElement("link"),We(s);var i=s;i._p=new Promise(function(r,c){i.onload=r,i.onerror=c}),lt(s,"link",l),n.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=$o.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Bu=0;function dN(e,t){return e.stylesheets&&e.count===0&&ao(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&ao(e,e.stylesheets),e.unsuspend){var s=e.unsuspend;e.unsuspend=null,s()}},6e4+t);0<e.imgBytes&&Bu===0&&(Bu=62500*GS());var a=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ao(e,e.stylesheets),e.unsuspend)){var s=e.unsuspend;e.unsuspend=null,s()}},(e.imgBytes>Bu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(a)}}:null}function $o(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ao(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Uo=null;function ao(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Uo=new Map,t.forEach(fN,e),Uo=null,$o.call(e))}function fN(e,t){if(!(t.state.loading&4)){var n=Uo.get(e);if(n)var l=n.get(null);else{n=new Map,Uo.set(e,n);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<a.length;s++){var i=a[s];(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")&&(n.set(i.dataset.precedence,i),l=i)}l&&n.set(null,l)}a=t.instance,i=a.getAttribute("data-precedence"),s=n.get(i)||l,s===l&&n.set(null,a),n.set(i,a),this.count++,l=$o.bind(this),a.addEventListener("load",l),a.addEventListener("error",l),s?s.parentNode.insertBefore(a,s.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(a,e.firstChild)),t.state.loading|=4}}var ki={$$typeof:Bn,Provider:null,Consumer:null,_currentValue:Jl,_currentValue2:Jl,_threadCount:0};function hN(e,t,n,l,a,s,i,r,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ru(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ru(0),this.hiddenUpdates=ru(null),this.identifierPrefix=l,this.onUncaughtError=a,this.onCaughtError=s,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function dv(e,t,n,l,a,s,i,r,c,u,d,f){return e=new hN(e,t,n,i,c,u,d,f,r),t=1,s===!0&&(t|=24),s=kt(3,null,null,t),e.current=s,s.stateNode=e,t=Yf(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:l,isDehydrated:n,cache:t},Gf(s),e}function fv(e){return e?(e=Oa,e):Oa}function hv(e,t,n,l,a,s){a=fv(a),l.context===null?l.context=a:l.pendingContext=a,l=Nl(t),l.payload={element:n},s=s===void 0?null:s,s!==null&&(l.callback=s),n=jl(e,l,t),n!==null&&(vt(n,e,t),ei(n,e,t))}function Rg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function xh(e,t){Rg(e,t),(e=e.alternate)&&Rg(e,t)}function pv(e){if(e.tag===13||e.tag===31){var t=ma(e,67108864);t!==null&&vt(t,e,67108864),xh(e,67108864)}}function Og(e){if(e.tag===13||e.tag===31){var t=Tt();t=_f(t);var n=ma(e,t);n!==null&&vt(n,e,t),xh(e,t)}}var qo=!0;function pN(e,t,n,l){var a=ne.T;ne.T=null;var s=ye.p;try{ye.p=2,yh(e,t,n,l)}finally{ye.p=s,ne.T=a}}function gN(e,t,n,l){var a=ne.T;ne.T=null;var s=ye.p;try{ye.p=8,yh(e,t,n,l)}finally{ye.p=s,ne.T=a}}function yh(e,t,n,l){if(qo){var a=Kd(l);if(a===null)Hu(e,t,l,Yo,n),Hg(e,l);else if(xN(a,e,t,n,l))l.stopPropagation();else if(Hg(e,l),t&4&&-1<mN.indexOf(e)){for(;a!==null;){var s=vs(a);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var i=Vl(s.pendingLanes);if(i!==0){var r=s;for(r.pendingLanes|=2,r.entangledLanes|=2;i;){var c=1<<31-At(i);r.entanglements[1]|=c,i&=~c}kn(s),!(xe&6)&&(To=_t()+500,Ii(0))}}break;case 31:case 13:r=ma(s,2),r!==null&&vt(r,s,2),kc(),xh(s,2)}if(s=Kd(l),s===null&&Hu(e,t,l,Yo,n),s===a)break;a=s}a!==null&&l.stopPropagation()}else Hu(e,t,l,null,n)}}function Kd(e){return e=Df(e),vh(e)}var Yo=null;function vh(e){if(Yo=null,e=Ma(e),e!==null){var t=$i(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=Rx(t),e!==null)return e;e=null}else if(n===31){if(e=Ox(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Yo=e,null}function gv(e){switch(e){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(tw()){case $x:return 2;case Ux:return 8;case xo:case nw:return 32;case qx:return 268435456;default:return 32}default:return 32}}var Jd=!1,Cl=null,_l=null,Ml=null,Ei=new Map,Ci=new Map,pl=[],mN="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".split(" ");function Hg(e,t){switch(e){case"focusin":case"focusout":Cl=null;break;case"dragenter":case"dragleave":_l=null;break;case"mouseover":case"mouseout":Ml=null;break;case"pointerover":case"pointerout":Ei.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ci.delete(t.pointerId)}}function Ls(e,t,n,l,a,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:s,targetContainers:[a]},t!==null&&(t=vs(t),t!==null&&pv(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function xN(e,t,n,l,a){switch(t){case"focusin":return Cl=Ls(Cl,e,t,n,l,a),!0;case"dragenter":return _l=Ls(_l,e,t,n,l,a),!0;case"mouseover":return Ml=Ls(Ml,e,t,n,l,a),!0;case"pointerover":var s=a.pointerId;return Ei.set(s,Ls(Ei.get(s)||null,e,t,n,l,a)),!0;case"gotpointercapture":return s=a.pointerId,Ci.set(s,Ls(Ci.get(s)||null,e,t,n,l,a)),!0}return!1}function mv(e){var t=Ma(e.target);if(t!==null){var n=$i(t);if(n!==null){if(t=n.tag,t===13){if(t=Rx(n),t!==null){e.blockedOn=t,bp(e.priority,function(){Og(n)});return}}else if(t===31){if(t=Ox(n),t!==null){e.blockedOn=t,bp(e.priority,function(){Og(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function so(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Kd(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);pd=l,n.target.dispatchEvent(l),pd=null}else return t=vs(n),t!==null&&pv(t),e.blockedOn=n,!1;t.shift()}return!0}function Lg(e,t,n){so(e)&&n.delete(t)}function yN(){Jd=!1,Cl!==null&&so(Cl)&&(Cl=null),_l!==null&&so(_l)&&(_l=null),Ml!==null&&so(Ml)&&(Ml=null),Ei.forEach(Lg),Ci.forEach(Lg)}function kr(e,t){e.blockedOn===t&&(e.blockedOn=null,Jd||(Jd=!0,Ze.unstable_scheduleCallback(Ze.unstable_NormalPriority,yN)))}var Er=null;function Bg(e){Er!==e&&(Er=e,Ze.unstable_scheduleCallback(Ze.unstable_NormalPriority,function(){Er===e&&(Er=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],a=e[t+2];if(typeof l!="function"){if(vh(l||n)===null)continue;break}var s=vs(n);s!==null&&(e.splice(t,3),t-=3,Ad(s,{pending:!0,data:a,method:n.method,action:l},l,a))}}))}function rs(e){function t(c){return kr(c,e)}Cl!==null&&kr(Cl,e),_l!==null&&kr(_l,e),Ml!==null&&kr(Ml,e),Ei.forEach(t),Ci.forEach(t);for(var n=0;n<pl.length;n++){var l=pl[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<pl.length&&(n=pl[0],n.blockedOn===null);)mv(n),n.blockedOn===null&&pl.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var a=n[l],s=n[l+1],i=a[bt]||null;if(typeof s=="function")i||Bg(n);else if(i){var r=null;if(s&&s.hasAttribute("formAction")){if(a=s,i=s[bt]||null)r=i.formAction;else if(vh(a)!==null)continue}else r=i.action;typeof r=="function"?n[l+1]=r:(n.splice(l,3),l-=3),Bg(n)}}}function xv(){function e(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(i){return a=i})},focusReset:"manual",scroll:"manual"})}function t(){a!==null&&(a(),a=null),l||setTimeout(n,20)}function n(){if(!l&&!navigation.transition){var s=navigation.currentEntry;s&&s.url!=null&&navigation.navigate(s.url,{state:s.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,a=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),a!==null&&(a(),a=null)}}}function bh(e){this._internalRoot=e}_c.prototype.render=bh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Z(409));var n=t.current,l=Tt();hv(n,l,e,t,null,null)};_c.prototype.unmount=bh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;hv(e.current,2,null,e,null,null),kc(),t[ys]=null}};function _c(e){this._internalRoot=e}_c.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qx();e={blockedOn:null,target:e,priority:t};for(var n=0;n<pl.length&&t!==0&&t<pl[n].priority;n++);pl.splice(n,0,e),n===0&&mv(e)}};var $g=Dx.version;if($g!=="19.2.6")throw Error(Z(527,$g,"19.2.6"));ye.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Z(188)):(e=Object.keys(e).join(","),Error(Z(268,e)));return e=I2(t),e=e!==null?Hx(e):null,e=e===null?null:e.stateNode,e};var vN={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:ne,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Cr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Cr.isDisabled&&Cr.supportsFiber)try{Ui=Cr.inject(vN),Mt=Cr}catch{}}dc.createRoot=function(e,t){if(!zx(e))throw Error(Z(299));var n=!1,l="",a=oy,s=cy,i=uy;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(a=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=dv(e,1,!1,null,null,n,l,null,a,s,i,xv),e[ys]=t.current,ph(e),new bh(t)};dc.hydrateRoot=function(e,t,n){if(!zx(e))throw Error(Z(299));var l=!1,a="",s=oy,i=cy,r=uy,c=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onUncaughtError!==void 0&&(s=n.onUncaughtError),n.onCaughtError!==void 0&&(i=n.onCaughtError),n.onRecoverableError!==void 0&&(r=n.onRecoverableError),n.formState!==void 0&&(c=n.formState)),t=dv(e,1,!0,t,n??null,l,a,c,s,i,r,xv),t.context=fv(null),n=t.current,l=Tt(),l=_f(l),a=Nl(l),a.callback=null,jl(n,a,l),n=l,t.current.lanes=n,Yi(t,n),kn(t),e[ys]=t.current,ph(e),new _c(t)};dc.version="19.2.6";function yv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(yv)}catch(e){console.error(e)}}yv(),Ex.exports=dc;var bN=Ex.exports;function wN(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}class SN{constructor(t,n){this.baseUrl=t,this.token=n}async request(t,n){const l=wN(),s=await(await fetch(`${this.baseUrl}/api/json-rpc`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`},body:JSON.stringify({jsonrpc:"2.0",id:l,method:t,params:n})})).json();if("error"in s)throw new Error(s.error.message);return s.result}async sessionList(){return this.request("session.list")}async sessionGet(t){return this.request("session.get",{id:t})}async sessionStats(){return this.request("session.stats")}async sessionSend(t,n,l){return this.request("session.send",{id:t,text:n,type:l})}async sessionCancel(t){return this.request("session.cancel",{id:t})}async sessionResume(t){return this.request("session.resume",t?{id:t}:void 0)}async configGet(t){return this.request("config.get",{key:t})}async configSet(t,n){return this.request("config.set",{key:t,value:n})}async providerList(){return this.request("provider.list")}async daemonStatus(){return this.request("daemon.status")}async daemonShutdown(){return this.request("daemon.shutdown")}async cronList(t,n){return this.request("cron.list",{type:t,status:n})}async cronCreate(t,n,l){return this.request("cron.create",{type:t,message:n,scheduledAt:l})}async cronCancel(t){return this.request("cron.cancel",{id:t})}async cronClear(){return this.request("cron.clear")}async heartbeatRun(t){return this.request("heartbeat.run",t?{scheduleType:t}:void 0)}async heartbeatStatus(){return this.request("heartbeat.status")}async channelList(){return this.request("channel.list")}async channelGet(t){return this.request("channel.get",{channelId:t})}async approvalList(t){return this.request("approval.pending",t?{sessionId:t}:void 0)}async approvalDecide(t,n){return this.request("approval.decide",{toolCallId:t,decision:n})}async mcpList(){return this.request("mcp.list")}async identitySetup(t){return this.request("identity.setup",t)}async subagentSpawn(t){return this.request("subagent.spawn",t)}async subagentList(t){return this.request("subagent.list",t)}async subagentCancel(t){return this.request("subagent.cancel",{agentId:t})}async subagentStats(t){return this.request("subagent.stats",{agentId:t})}async subagentSend(t,n){return this.request("subagent.send",{agentId:t,message:n})}async taskSchedule(t){return this.request("task.schedule",t)}async todoList(t){return this.request("todo.list",t)}async todoCreate(t){return this.request("todo.create",t)}async todoUpdate(t){return this.request("todo.update",t)}async todoRemove(t){return this.request("todo.remove",{id:t})}async wikiListPages(){return this.request("wiki.ingest")}async wikiPageGet(t){return this.request("wiki.page.get",{slug:t})}async wikiSearch(t){return this.request("wiki.query",{query:t})}async wikiLint(){return this.request("wiki.lint")}async wikiGraph(){return this.request("wiki.graph")}}class NN{constructor(t,n){fe(this,"ws",null);fe(this,"reconnectTimer",null);fe(this,"reconnectDelay",1e3);fe(this,"_reconnecting",!1);fe(this,"handlers",new Map);fe(this,"connected",!1);this.url=t,this.token=n}connect(){if(this.ws)return;const t=`${this.url.replace("http","ws")}/ws?token=${this.token}`;this.ws=new WebSocket(t),this.ws.onopen=()=>{this.connected=!0,this._reconnecting=!1,this.reconnectDelay=1e3,this.dispatch({type:"connection-status",id:"status",timestamp:Date.now(),connected:!0})},this.ws.onmessage=n=>{try{const l=JSON.parse(n.data);this.dispatch(l)}catch{}},this.ws.onclose=n=>{if(this.connected=!1,this.ws=null,n.code===4001||n.code===4003){this._reconnecting=!1,this.dispatch({type:"auth-error",id:"auth",timestamp:Date.now(),code:n.code});return}this._reconnecting=!0,this.dispatch({type:"connection-status",id:"status",timestamp:Date.now(),connected:!1}),this.scheduleReconnect()},this.ws.onerror=()=>{this.connected=!1,this.dispatch({type:"connection-status",id:"status",timestamp:Date.now(),connected:!1})}}disconnect(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(),this.ws=null),this._reconnecting=!1,this.connected=!1}isConnected(){return this.connected}isReconnecting(){return this._reconnecting}on(t,n){return this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(n),()=>{var l;(l=this.handlers.get(t))==null||l.delete(n)}}subscribe(t){var n;((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"subscribe",session:t}))}dispatch(t){const n=this.handlers.get(t.type);if(n)for(const a of n)try{a(t)}catch{}const l=this.handlers.get("*");if(l)for(const a of l)try{a(t)}catch{}}scheduleReconnect(){this.reconnectTimer||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.reconnectDelay=Math.min(this.reconnectDelay*2,3e4),this.connect()},this.reconnectDelay))}}const vv=b.createContext({rpc:null,ws:null,connected:!1,connectionStatus:"disconnected",token:null,setToken:()=>{}});function En(){return b.useContext(vv)}function jN({children:e}){const[t,n]=b.useState(null),[l,a]=b.useState({rpc:null,ws:null,connected:!1,connectionStatus:"disconnected"});b.useEffect(()=>{const r=new URLSearchParams(window.location.search).get("token")||localStorage.getItem("daemon-token")||"";r&&(localStorage.setItem("daemon-token",r),n(r))},[]);const s=r=>{localStorage.setItem("daemon-token",r),n(r)};b.useEffect(()=>{if(!t){a({rpc:null,ws:null,connected:!1,connectionStatus:"disconnected"});return}const r=window.location.origin,c=new SN(r,t),u=new NN(r,t);a({rpc:c,ws:u,connected:!1,connectionStatus:"reconnecting"}),u.connect();const d=u.on("auth-error",()=>{localStorage.removeItem("daemon-token"),n(null)}),f=u.on("connection-status",p=>{const x=!!p.connected;let S;x?S="connected":u.isReconnecting()?S="reconnecting":S="disconnected",a(w=>({...w,connected:x,connectionStatus:S}))}),h=setInterval(()=>{const p=u.isConnected();a(x=>({...x,connected:p,connectionStatus:p?"connected":x.connectionStatus==="reconnecting"?"reconnecting":"disconnected"}))},2e3);return()=>{d(),f(),clearInterval(h),u.disconnect()}},[t]);const i={rpc:l.rpc,ws:l.ws,connected:l.connected,connectionStatus:l.connectionStatus,token:t,setToken:s};return o.jsx(vv.Provider,{value:i,children:e})}function wh(){const{rpc:e,ws:t}=En(),[n,l]=b.useState({}),[a,s]=b.useState([]),i=b.useCallback(()=>{e&&(e.providerList().then(u=>{Array.isArray(u)&&s(u)}).catch(()=>{}),Promise.all([e.configGet("model").catch(()=>null),e.configGet("current_provider").catch(()=>null),e.configGet("theme").catch(()=>null),e.configGet("mode").catch(()=>null)]).then(([u,d,f,h])=>{l(p=>({...p,model:u!==null?u:p.model,current_provider:d!==null?d:p.current_provider,theme:f!==null?f:p.theme,mode:h!==null?h:p.mode}))}).catch(()=>{}))},[e]);b.useEffect(()=>{i()},[i]),b.useEffect(()=>{if(t)return t.on("config-changed",()=>{i()})},[t,i]);const r=b.useCallback(u=>n[u],[n]),c=b.useCallback(async(u,d)=>{if(e)try{await e.configSet(u,d),l(f=>({...f,[u]:d}))}catch{}},[e]);return{settings:n,get:r,set:c,providers:a}}function Sh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ya=Sh();function bv(e){ya=e}var Zl={exec:()=>null};function pe(e,t=""){let n=typeof e=="string"?e:e.source,l={replace:(a,s)=>{let i=typeof s=="string"?s:s.source;return i=i.replace(at.caret,"$1"),n=n.replace(a,i),l},getRegex:()=>new RegExp(n,t)};return l}var kN=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),at={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},EN=/^(?:[ \t]*(?:\n|$))+/,CN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,_N=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Wi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,MN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Nh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,wv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Sv=pe(wv).replace(/bull/g,Nh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),AN=pe(wv).replace(/bull/g,Nh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),jh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,TN=/^[^\n]+/,kh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,DN=pe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",kh).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),zN=pe(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Nh).getRegex(),Mc="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Eh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,RN=pe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Eh).replace("tag",Mc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Nv=pe(jh).replace("hr",Wi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mc).getRegex(),ON=pe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Nv).getRegex(),Ch={blockquote:ON,code:CN,def:DN,fences:_N,heading:MN,hr:Wi,html:RN,lheading:Sv,list:zN,newline:EN,paragraph:Nv,table:Zl,text:TN},Ug=pe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Wi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mc).getRegex(),HN={...Ch,lheading:AN,table:Ug,paragraph:pe(jh).replace("hr",Wi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ug).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mc).getRegex()},LN={...Ch,html:pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Eh).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Zl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:pe(jh).replace("hr",Wi).replace("heading",` *#{1,6} *[^
50
+ ]`).replace("lheading",Sv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},BN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,$N=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,jv=/^( {2,}|\\)\n(?!\s*$)/,UN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ks=/[\p{P}\p{S}]/u,Ac=/[\s\p{P}\p{S}]/u,_h=/[^\s\p{P}\p{S}]/u,qN=pe(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ac).getRegex(),kv=/(?!~)[\p{P}\p{S}]/u,YN=/(?!~)[\s\p{P}\p{S}]/u,VN=/(?:[^\s\p{P}\p{S}]|~)/u,XN=pe(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",kN?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ev=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,GN=pe(Ev,"u").replace(/punct/g,ks).getRegex(),QN=pe(Ev,"u").replace(/punct/g,kv).getRegex(),Cv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ZN=pe(Cv,"gu").replace(/notPunctSpace/g,_h).replace(/punctSpace/g,Ac).replace(/punct/g,ks).getRegex(),IN=pe(Cv,"gu").replace(/notPunctSpace/g,VN).replace(/punctSpace/g,YN).replace(/punct/g,kv).getRegex(),KN=pe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,_h).replace(/punctSpace/g,Ac).replace(/punct/g,ks).getRegex(),JN=pe(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ks).getRegex(),WN="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",FN=pe(WN,"gu").replace(/notPunctSpace/g,_h).replace(/punctSpace/g,Ac).replace(/punct/g,ks).getRegex(),PN=pe(/\\(punct)/,"gu").replace(/punct/g,ks).getRegex(),ej=pe(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),tj=pe(Eh).replace("(?:-->|$)","-->").getRegex(),nj=pe("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",tj).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Vo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,lj=pe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Vo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_v=pe(/^!?\[(label)\]\[(ref)\]/).replace("label",Vo).replace("ref",kh).getRegex(),Mv=pe(/^!?\[(ref)\](?:\[\])?/).replace("ref",kh).getRegex(),aj=pe("reflink|nolink(?!\\()","g").replace("reflink",_v).replace("nolink",Mv).getRegex(),qg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Mh={_backpedal:Zl,anyPunctuation:PN,autolink:ej,blockSkip:XN,br:jv,code:$N,del:Zl,delLDelim:Zl,delRDelim:Zl,emStrongLDelim:GN,emStrongRDelimAst:ZN,emStrongRDelimUnd:KN,escape:BN,link:lj,nolink:Mv,punctuation:qN,reflink:_v,reflinkSearch:aj,tag:nj,text:UN,url:Zl},sj={...Mh,link:pe(/^!?\[(label)\]\((.*?)\)/).replace("label",Vo).getRegex(),reflink:pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Vo).getRegex()},Wd={...Mh,emStrongRDelimAst:IN,emStrongLDelim:QN,delLDelim:JN,delRDelim:FN,url:pe(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",qg).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:pe(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",qg).getRegex()},ij={...Wd,br:pe(jv).replace("{2,}","*").getRegex(),text:pe(Wd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},_r={normal:Ch,gfm:HN,pedantic:LN},Bs={normal:Mh,gfm:Wd,breaks:ij,pedantic:sj},rj={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Yg=e=>rj[e];function gn(e,t){if(t){if(at.escapeTest.test(e))return e.replace(at.escapeReplace,Yg)}else if(at.escapeTestNoEncode.test(e))return e.replace(at.escapeReplaceNoEncode,Yg);return e}function Vg(e){try{e=encodeURI(e).replace(at.percentDecode,"%")}catch{return null}return e}function Xg(e,t){var s;let n=e.replace(at.findPipe,(i,r,c)=>{let u=!1,d=r;for(;--d>=0&&c[d]==="\\";)u=!u;return u?"|":" |"}),l=n.split(at.splitPipe),a=0;if(l[0].trim()||l.shift(),l.length>0&&!((s=l.at(-1))!=null&&s.trim())&&l.pop(),t)if(l.length>t)l.splice(t);else for(;l.length<t;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(at.slashPipe,"|");return l}function ll(e,t,n){let l=e.length;if(l===0)return"";let a=0;for(;a<l&&e.charAt(l-a-1)===t;)a++;return e.slice(0,l-a)}function Gg(e){let t=e.split(`
51
+ `),n=t.length-1;for(;n>=0&&at.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
52
+ `)}function oj(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let l=0;l<e.length;l++)if(e[l]==="\\")l++;else if(e[l]===t[0])n++;else if(e[l]===t[1]&&(n--,n<0))return l;return n>0?-2:-1}function cj(e,t=0){let n=t,l="";for(let a of e)if(a===" "){let s=4-n%4;l+=" ".repeat(s),n+=s}else l+=a,n++;return l}function Qg(e,t,n,l,a){let s=t.href,i=t.title||null,r=e[1].replace(a.other.outputLinkReplace,"$1");l.state.inLink=!0;let c={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:i,text:r,tokens:l.inlineTokens(r)};return l.state.inLink=!1,c}function uj(e,t,n){let l=e.match(n.other.indentCodeCompensation);if(l===null)return t;let a=l[1];return t.split(`
53
+ `).map(s=>{let i=s.match(n.other.beginningSpace);if(i===null)return s;let[r]=i;return r.length>=a.length?s.slice(a.length):s}).join(`
54
+ `)}var Xo=class{constructor(e){fe(this,"options");fe(this,"rules");fe(this,"lexer");this.options=e||ya}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:Gg(t[0]),l=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:l}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],l=uj(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:l}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let l=ll(n,"#");(this.options.pedantic||!l||this.rules.other.endingSpaceChar.test(l))&&(n=l.trim())}return{type:"heading",raw:ll(t[0],`
55
+ `),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:ll(t[0],`
56
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=ll(t[0],`
57
+ `).split(`
58
+ `),l="",a="",s=[];for(;n.length>0;){let i=!1,r=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))r.push(n[c]),i=!0;else if(!i)r.push(n[c]);else break;n=n.slice(c);let u=r.join(`
59
+ `),d=u.replace(this.rules.other.blockquoteSetextReplace,`
60
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");l=l?`${l}
61
+ ${u}`:u,a=a?`${a}
62
+ ${d}`:d;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,s,!0),this.lexer.state.top=f,n.length===0)break;let h=s.at(-1);if((h==null?void 0:h.type)==="code")break;if((h==null?void 0:h.type)==="blockquote"){let p=h,x=p.raw+`
63
+ `+n.join(`
64
+ `),S=this.blockquote(x);s[s.length-1]=S,l=l.substring(0,l.length-p.raw.length)+S.raw,a=a.substring(0,a.length-p.text.length)+S.text;break}else if((h==null?void 0:h.type)==="list"){let p=h,x=p.raw+`
65
+ `+n.join(`
66
+ `),S=this.list(x);s[s.length-1]=S,l=l.substring(0,l.length-h.raw.length)+S.raw,a=a.substring(0,a.length-p.raw.length)+S.raw,n=x.substring(s.at(-1).raw.length).split(`
67
+ `);continue}}return{type:"blockquote",raw:l,tokens:s,text:a}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),l=n.length>1,a={type:"list",raw:"",ordered:l,start:l?+n.slice(0,-1):"",loose:!1,items:[]};n=l?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=l?n:"[*+-]");let s=this.rules.other.listItemRegex(n),i=!1;for(;e;){let c=!1,u="",d="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;u=t[0],e=e.substring(u.length);let f=cj(t[2].split(`
68
+ `,1)[0],t[1].length),h=e.split(`
69
+ `,1)[0],p=!f.trim(),x=0;if(this.options.pedantic?(x=2,d=f.trimStart()):p?x=t[1].length+1:(x=f.search(this.rules.other.nonSpaceChar),x=x>4?1:x,d=f.slice(x),x+=t[1].length),p&&this.rules.other.blankLine.test(h)&&(u+=h+`
70
+ `,e=e.substring(h.length+1),c=!0),!c){let S=this.rules.other.nextBulletRegex(x),w=this.rules.other.hrRegex(x),g=this.rules.other.fencesBeginRegex(x),y=this.rules.other.headingBeginRegex(x),m=this.rules.other.htmlBeginRegex(x),v=this.rules.other.blockquoteBeginRegex(x);for(;e;){let j=e.split(`
71
+ `,1)[0],k;if(h=j,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),k=h):k=h.replace(this.rules.other.tabCharGlobal," "),g.test(h)||y.test(h)||m.test(h)||v.test(h)||S.test(h)||w.test(h))break;if(k.search(this.rules.other.nonSpaceChar)>=x||!h.trim())d+=`
72
+ `+k.slice(x);else{if(p||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||g.test(f)||y.test(f)||w.test(f))break;d+=`
73
+ `+h}p=!h.trim(),u+=j+`
74
+ `,e=e.substring(j.length+1),f=k.slice(x)}}a.loose||(i?a.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(i=!0)),a.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]}),a.raw+=u}let r=a.items.at(-1);if(r)r.raw=r.raw.trimEnd(),r.text=r.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let c of a.items){this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]);let u=c.tokens[0];if(c.task&&((u==null?void 0:u.type)==="text"||(u==null?void 0:u.type)==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),u.raw=u.raw.replace(this.rules.other.listReplaceTask,""),u.text=u.text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}let d=this.rules.other.listTaskCheckbox.exec(c.raw);if(d){let f={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};c.checked=f.checked,a.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=f.raw+c.tokens[0].raw,c.tokens[0].text=f.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(f)):c.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):c.tokens.unshift(f)}}else c.task&&(c.task=!1);if(!a.loose){let d=c.tokens.filter(h=>h.type==="space"),f=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));a.loose=f}}if(a.loose)for(let c of a.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.type="paragraph")}return a}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=Gg(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),l=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",a=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:ll(t[0],`
75
+ `),href:l,title:a}}}table(e){var i;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Xg(t[1]),l=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),a=(i=t[3])!=null&&i.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
76
+ `):[],s={type:"table",raw:ll(t[0],`
77
+ `),header:[],align:[],rows:[]};if(n.length===l.length){for(let r of l)this.rules.other.tableAlignRight.test(r)?s.align.push("right"):this.rules.other.tableAlignCenter.test(r)?s.align.push("center"):this.rules.other.tableAlignLeft.test(r)?s.align.push("left"):s.align.push(null);for(let r=0;r<n.length;r++)s.header.push({text:n[r],tokens:this.lexer.inline(n[r]),header:!0,align:s.align[r]});for(let r of a)s.rows.push(Xg(r,s.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:s.align[u]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:ll(t[0],`
78
+ `),depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
79
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=ll(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=oj(t[2],"()");if(s===-2)return;if(s>-1){let i=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,i).trim(),t[3]=""}}let l=t[2],a="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(l);s&&(l=s[1],a=s[3])}else a=t[3]?t[3].slice(1,-1):"";return l=l.trim(),this.rules.other.startAngleBracket.test(l)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?l=l.slice(1):l=l.slice(1,-1)),Qg(t,{href:l&&l.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let l=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),a=t[l.toLowerCase()];if(!a){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return Qg(n,a,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let l=this.rules.inline.emStrongLDelim.exec(e);if(!(!l||!l[1]&&!l[2]&&!l[3]&&!l[4]||l[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(l[1]||l[3])||!n||this.rules.inline.punctuation.exec(n))){let a=[...l[0]].length-1,s,i,r=a,c=0,u=l[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+a);(l=u.exec(t))!==null;){if(s=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!s)continue;if(i=[...s].length,l[3]||l[4]){r+=i;continue}else if((l[5]||l[6])&&a%3&&!((a+i)%3)){c+=i;continue}if(r-=i,r>0)continue;i=Math.min(i,i+r+c);let d=[...l[0]][0].length,f=e.slice(0,a+l.index+d+i);if(Math.min(a,i)%2){let p=f.slice(1,-1);return{type:"em",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}let h=f.slice(2,-2);return{type:"strong",raw:f,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),l=this.rules.other.nonSpaceChar.test(n),a=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return l&&a&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let l=this.rules.inline.delLDelim.exec(e);if(l&&(!l[1]||!n||this.rules.inline.punctuation.exec(n))){let a=[...l[0]].length-1,s,i,r=a,c=this.rules.inline.delRDelim;for(c.lastIndex=0,t=t.slice(-1*e.length+a);(l=c.exec(t))!==null;){if(s=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!s||(i=[...s].length,i!==a))continue;if(l[3]||l[4]){r+=i;continue}if(r-=i,r>0)continue;i=Math.min(i,i+r);let u=[...l[0]][0].length,d=e.slice(0,a+l.index+u+i),f=d.slice(a,-a);return{type:"del",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,l;return t[2]==="@"?(n=t[1],l="mailto:"+n):(n=t[1],l=n),{type:"link",raw:t[0],text:n,href:l,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let l,a;if(t[2]==="@")l=t[0],a="mailto:"+l;else{let s;do s=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(s!==t[0]);l=t[0],t[1]==="www."?a="http://"+t[0]:a=t[0]}return{type:"link",raw:t[0],text:l,href:a,tokens:[{type:"text",raw:l,text:l}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},tn=class Fd{constructor(t){fe(this,"tokens");fe(this,"options");fe(this,"state");fe(this,"inlineQueue");fe(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ya,this.options.tokenizer=this.options.tokenizer||new Xo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:at,block:_r.normal,inline:Bs.normal};this.options.pedantic?(n.block=_r.pedantic,n.inline=Bs.pedantic):this.options.gfm&&(n.block=_r.gfm,this.options.breaks?n.inline=Bs.breaks:n.inline=Bs.gfm),this.tokenizer.rules=n}static get rules(){return{block:_r,inline:Bs}}static lex(t,n){return new Fd(n).lex(t)}static lexInline(t,n){return new Fd(n).inlineTokens(t)}lex(t){t=t.replace(at.carriageReturn,`
80
+ `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let l=this.inlineQueue[n];this.inlineTokens(l.src,l.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],l=!1){var s,i,r;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(at.tabCharGlobal," ").replace(at.spaceLine,""));let a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let c;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(d=>(c=d.call({lexer:this},t,n))?(t=t.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.space(t)){t=t.substring(c.raw.length);let d=n.at(-1);c.raw.length===1&&d!==void 0?d.raw+=`
81
+ `:n.push(c);continue}if(c=this.tokenizer.code(t)){t=t.substring(c.raw.length);let d=n.at(-1);(d==null?void 0:d.type)==="paragraph"||(d==null?void 0:d.type)==="text"?(d.raw+=(d.raw.endsWith(`
82
+ `)?"":`
83
+ `)+c.raw,d.text+=`
84
+ `+c.text,this.inlineQueue.at(-1).src=d.text):n.push(c);continue}if(c=this.tokenizer.fences(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.heading(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.hr(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.blockquote(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.list(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.html(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.def(t)){t=t.substring(c.raw.length);let d=n.at(-1);(d==null?void 0:d.type)==="paragraph"||(d==null?void 0:d.type)==="text"?(d.raw+=(d.raw.endsWith(`
85
+ `)?"":`
86
+ `)+c.raw,d.text+=`
87
+ `+c.raw,this.inlineQueue.at(-1).src=d.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title},n.push(c));continue}if(c=this.tokenizer.table(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.lheading(t)){t=t.substring(c.raw.length),n.push(c);continue}let u=t;if((r=this.options.extensions)!=null&&r.startBlock){let d=1/0,f=t.slice(1),h;this.options.extensions.startBlock.forEach(p=>{h=p.call({lexer:this},f),typeof h=="number"&&h>=0&&(d=Math.min(d,h))}),d<1/0&&d>=0&&(u=t.substring(0,d+1))}if(this.state.top&&(c=this.tokenizer.paragraph(u))){let d=n.at(-1);l&&(d==null?void 0:d.type)==="paragraph"?(d.raw+=(d.raw.endsWith(`
88
+ `)?"":`
89
+ `)+c.raw,d.text+=`
90
+ `+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=d.text):n.push(c),l=u.length!==t.length,t=t.substring(c.raw.length);continue}if(c=this.tokenizer.text(t)){t=t.substring(c.raw.length);let d=n.at(-1);(d==null?void 0:d.type)==="text"?(d.raw+=(d.raw.endsWith(`
91
+ `)?"":`
92
+ `)+c.raw,d.text+=`
93
+ `+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=d.text):n.push(c);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var u,d,f,h,p;this.tokenizer.lexer=this;let l=t,a=null;if(this.tokens.links){let x=Object.keys(this.tokens.links);if(x.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(l))!==null;)x.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(l))!==null;)l=l.slice(0,a.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(a=this.tokenizer.rules.inline.blockSkip.exec(l))!==null;)s=a[2]?a[2].length:0,l=l.slice(0,a.index+s)+"["+"a".repeat(a[0].length-s-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);l=((d=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:d.call({lexer:this},l))??l;let i=!1,r="",c=1/0;for(;t;){if(t.length<c)c=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}i||(r=""),i=!1;let x;if((h=(f=this.options.extensions)==null?void 0:f.inline)!=null&&h.some(w=>(x=w.call({lexer:this},t,n))?(t=t.substring(x.raw.length),n.push(x),!0):!1))continue;if(x=this.tokenizer.escape(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.tag(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.link(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(x.raw.length);let w=n.at(-1);x.type==="text"&&(w==null?void 0:w.type)==="text"?(w.raw+=x.raw,w.text+=x.text):n.push(x);continue}if(x=this.tokenizer.emStrong(t,l,r)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.codespan(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.br(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.del(t,l,r)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.autolink(t)){t=t.substring(x.raw.length),n.push(x);continue}if(!this.state.inLink&&(x=this.tokenizer.url(t))){t=t.substring(x.raw.length),n.push(x);continue}let S=t;if((p=this.options.extensions)!=null&&p.startInline){let w=1/0,g=t.slice(1),y;this.options.extensions.startInline.forEach(m=>{y=m.call({lexer:this},g),typeof y=="number"&&y>=0&&(w=Math.min(w,y))}),w<1/0&&w>=0&&(S=t.substring(0,w+1))}if(x=this.tokenizer.inlineText(S)){t=t.substring(x.raw.length),x.raw.slice(-1)!=="_"&&(r=x.raw.slice(-1)),i=!0;let w=n.at(-1);(w==null?void 0:w.type)==="text"?(w.raw+=x.raw,w.text+=x.text):n.push(x);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(this.options.silent)console.error(n);else throw new Error(n)}},Go=class{constructor(e){fe(this,"options");fe(this,"parser");this.options=e||ya}space(e){return""}code({text:e,lang:t,escaped:n}){var s;let l=(s=(t||"").match(at.notSpaceStart))==null?void 0:s[0],a=e.replace(at.endingNewline,"")+`
94
+ `;return l?'<pre><code class="language-'+gn(l)+'">'+(n?a:gn(a,!0))+`</code></pre>
95
+ `:"<pre><code>"+(n?a:gn(a,!0))+`</code></pre>
96
+ `}blockquote({tokens:e}){return`<blockquote>
97
+ ${this.parser.parse(e)}</blockquote>
98
+ `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
99
+ `}hr(e){return`<hr>
100
+ `}list(e){let t=e.ordered,n=e.start,l="";for(let i=0;i<e.items.length;i++){let r=e.items[i];l+=this.listitem(r)}let a=t?"ol":"ul",s=t&&n!==1?' start="'+n+'"':"";return"<"+a+s+`>
101
+ `+l+"</"+a+`>
102
+ `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
103
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
104
+ `}table(e){let t="",n="";for(let a=0;a<e.header.length;a++)n+=this.tablecell(e.header[a]);t+=this.tablerow({text:n});let l="";for(let a=0;a<e.rows.length;a++){let s=e.rows[a];n="";for(let i=0;i<s.length;i++)n+=this.tablecell(s[i]);l+=this.tablerow({text:n})}return l&&(l=`<tbody>${l}</tbody>`),`<table>
105
+ <thead>
106
+ `+t+`</thead>
107
+ `+l+`</table>
108
+ `}tablerow({text:e}){return`<tr>
109
+ ${e}</tr>
110
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
111
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${gn(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let l=this.parser.parseInline(n),a=Vg(e);if(a===null)return l;e=a;let s='<a href="'+e+'"';return t&&(s+=' title="'+gn(t)+'"'),s+=">"+l+"</a>",s}image({href:e,title:t,text:n,tokens:l}){l&&(n=this.parser.parseInline(l,this.parser.textRenderer));let a=Vg(e);if(a===null)return gn(n);e=a;let s=`<img src="${e}" alt="${gn(n)}"`;return t&&(s+=` title="${gn(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:gn(e.text)}},Ah=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},nn=class Pd{constructor(t){fe(this,"options");fe(this,"renderer");fe(this,"textRenderer");this.options=t||ya,this.options.renderer=this.options.renderer||new Go,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ah}static parse(t,n){return new Pd(n).parse(t)}static parseInline(t,n){return new Pd(n).parseInline(t)}parse(t){var l,a;this.renderer.parser=this;let n="";for(let s=0;s<t.length;s++){let i=t[s];if((a=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&a[i.type]){let c=i,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){n+=u||"";continue}}let r=i;switch(r.type){case"space":{n+=this.renderer.space(r);break}case"hr":{n+=this.renderer.hr(r);break}case"heading":{n+=this.renderer.heading(r);break}case"code":{n+=this.renderer.code(r);break}case"table":{n+=this.renderer.table(r);break}case"blockquote":{n+=this.renderer.blockquote(r);break}case"list":{n+=this.renderer.list(r);break}case"checkbox":{n+=this.renderer.checkbox(r);break}case"html":{n+=this.renderer.html(r);break}case"def":{n+=this.renderer.def(r);break}case"paragraph":{n+=this.renderer.paragraph(r);break}case"text":{n+=this.renderer.text(r);break}default:{let c='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}parseInline(t,n=this.renderer){var a,s;this.renderer.parser=this;let l="";for(let i=0;i<t.length;i++){let r=t[i];if((s=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&s[r.type]){let u=this.options.extensions.renderers[r.type].call({parser:this},r);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){l+=u||"";continue}}let c=r;switch(c.type){case"escape":{l+=n.text(c);break}case"html":{l+=n.html(c);break}case"link":{l+=n.link(c);break}case"image":{l+=n.image(c);break}case"checkbox":{l+=n.checkbox(c);break}case"strong":{l+=n.strong(c);break}case"em":{l+=n.em(c);break}case"codespan":{l+=n.codespan(c);break}case"br":{l+=n.br(c);break}case"del":{l+=n.del(c);break}case"text":{l+=n.text(c);break}default:{let u='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return l}},Xr,Qs=(Xr=class{constructor(e){fe(this,"options");fe(this,"block");this.options=e||ya}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?tn.lex:tn.lexInline}provideParser(e=this.block){return e?nn.parse:nn.parseInline}},fe(Xr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),fe(Xr,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Xr),dj=class{constructor(...e){fe(this,"defaults",Sh());fe(this,"options",this.setOptions);fe(this,"parse",this.parseMarkdown(!0));fe(this,"parseInline",this.parseMarkdown(!1));fe(this,"Parser",nn);fe(this,"Renderer",Go);fe(this,"TextRenderer",Ah);fe(this,"Lexer",tn);fe(this,"Tokenizer",Xo);fe(this,"Hooks",Qs);this.use(...e)}walkTokens(e,t){var l,a;let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let i=s;for(let r of i.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of i.rows)for(let c of r)n=n.concat(this.walkTokens(c.tokens,t));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=s;(a=(l=this.defaults.extensions)==null?void 0:l.childTokens)!=null&&a[i.type]?this.defaults.extensions.childTokens[i.type].forEach(r=>{let c=i[r].flat(1/0);n=n.concat(this.walkTokens(c,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let l={...n};if(l.async=this.defaults.async||l.async||!1,n.extensions&&(n.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){let s=t.renderers[a.name];s?t.renderers[a.name]=function(...i){let r=a.renderer.apply(this,i);return r===!1&&(r=s.apply(this,i)),r}:t.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[a.level];s?s.unshift(a.tokenizer):t[a.level]=[a.tokenizer],a.start&&(a.level==="block"?t.startBlock?t.startBlock.push(a.start):t.startBlock=[a.start]:a.level==="inline"&&(t.startInline?t.startInline.push(a.start):t.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(t.childTokens[a.name]=a.childTokens)}),l.extensions=t),n.renderer){let a=this.defaults.renderer||new Go(this.defaults);for(let s in n.renderer){if(!(s in a))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let i=s,r=n.renderer[i],c=a[i];a[i]=(...u)=>{let d=r.apply(a,u);return d===!1&&(d=c.apply(a,u)),d||""}}l.renderer=a}if(n.tokenizer){let a=this.defaults.tokenizer||new Xo(this.defaults);for(let s in n.tokenizer){if(!(s in a))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let i=s,r=n.tokenizer[i],c=a[i];a[i]=(...u)=>{let d=r.apply(a,u);return d===!1&&(d=c.apply(a,u)),d}}l.tokenizer=a}if(n.hooks){let a=this.defaults.hooks||new Qs;for(let s in n.hooks){if(!(s in a))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let i=s,r=n.hooks[i],c=a[i];Qs.passThroughHooks.has(s)?a[i]=u=>{if(this.defaults.async&&Qs.passThroughHooksRespectAsync.has(s))return(async()=>{let f=await r.call(a,u);return c.call(a,f)})();let d=r.call(a,u);return c.call(a,d)}:a[i]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await r.apply(a,u);return f===!1&&(f=await c.apply(a,u)),f})();let d=r.apply(a,u);return d===!1&&(d=c.apply(a,u)),d}}l.hooks=a}if(n.walkTokens){let a=this.defaults.walkTokens,s=n.walkTokens;l.walkTokens=function(i){let r=[];return r.push(s.call(this,i)),a&&(r=r.concat(a.call(this,i))),r}}this.defaults={...this.defaults,...l}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return tn.lex(e,t??this.defaults)}parser(e,t){return nn.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let l={...n},a={...this.defaults,...l},s=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&l.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(a.hooks&&(a.hooks.options=a,a.hooks.block=e),a.async)return(async()=>{let i=a.hooks?await a.hooks.preprocess(t):t,r=await(a.hooks?await a.hooks.provideLexer(e):e?tn.lex:tn.lexInline)(i,a),c=a.hooks?await a.hooks.processAllTokens(r):r;a.walkTokens&&await Promise.all(this.walkTokens(c,a.walkTokens));let u=await(a.hooks?await a.hooks.provideParser(e):e?nn.parse:nn.parseInline)(c,a);return a.hooks?await a.hooks.postprocess(u):u})().catch(s);try{a.hooks&&(t=a.hooks.preprocess(t));let i=(a.hooks?a.hooks.provideLexer(e):e?tn.lex:tn.lexInline)(t,a);a.hooks&&(i=a.hooks.processAllTokens(i)),a.walkTokens&&this.walkTokens(i,a.walkTokens);let r=(a.hooks?a.hooks.provideParser(e):e?nn.parse:nn.parseInline)(i,a);return a.hooks&&(r=a.hooks.postprocess(r)),r}catch(i){return s(i)}}}onError(e,t){return n=>{if(n.message+=`
112
+ Please report this to https://github.com/markedjs/marked.`,e){let l="<p>An error occurred:</p><pre>"+gn(n.message+"",!0)+"</pre>";return t?Promise.resolve(l):l}if(t)return Promise.reject(n);throw n}}},oa=new dj;function ve(e,t){return oa.parse(e,t)}ve.options=ve.setOptions=function(e){return oa.setOptions(e),ve.defaults=oa.defaults,bv(ve.defaults),ve};ve.getDefaults=Sh;ve.defaults=ya;ve.use=function(...e){return oa.use(...e),ve.defaults=oa.defaults,bv(ve.defaults),ve};ve.walkTokens=function(e,t){return oa.walkTokens(e,t)};ve.parseInline=oa.parseInline;ve.Parser=nn;ve.parser=nn.parse;ve.Renderer=Go;ve.TextRenderer=Ah;ve.Lexer=tn;ve.lexer=tn.lex;ve.Tokenizer=Xo;ve.Hooks=Qs;ve.parse=ve;ve.options;ve.setOptions;ve.use;ve.walkTokens;ve.parseInline;nn.parse;tn.lex;function Zg(e){return e<1e3?String(e):`${(e/1e3).toFixed(1)}k`}function fj({onSend:e,onCancel:t,cmdInput:n,onClearCmdInput:l,totalTokens:a,contextTokens:s,costUsd:i}){const{providers:r,get:c}=wh(),u=c("current_provider"),d=c("model"),f=r.find(g=>g.name===u&&g.configured)||r.find(g=>g.configured)||{name:"none"},[h,p]=b.useState(""),x=b.useRef(null);b.useEffect(()=>{n&&(p(n),setTimeout(()=>{x.current&&(x.current.focus(),x.current.selectionStart=x.current.selectionEnd=n.length)},50),l==null||l())},[n,l]);const S=b.useCallback(()=>{const g=x.current;g&&(g.style.height="",g.style.height=Math.min(g.scrollHeight,160)+"px")},[]),w=b.useCallback(g=>{if(g.key==="Enter"&&!g.shiftKey){g.preventDefault();const y=h.trim();if(!y)return;e(y),p(""),setTimeout(()=>{x.current&&(x.current.style.height="")},0)}},[h,e]);return o.jsx("div",{className:"px-5 pt-3 pb-7 md:pb-3 bg-transparent",children:o.jsxs("div",{className:"glass-card rounded-xl transition-all duration-200",style:{background:"linear-gradient(135deg, var(--s2) 0%, color-mix(in srgb, var(--s1) 90%, var(--wood)) 100%)",border:"1px solid var(--b2)"},children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-[10.5px]",children:[o.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0",style:{background:u?"var(--green)":"var(--muted2)",opacity:u?1:.3}}),o.jsx("span",{style:{color:"var(--gold)",opacity:.8},children:f.name}),o.jsx("span",{className:"text-muted",children:" · "}),o.jsx("span",{className:"text-muted",children:d||"no model set"})]}),o.jsx("textarea",{ref:x,className:"w-full bg-transparent border-0 outline-none text-fg font-sans text-[13.5px] px-3.5 py-2.5 resize-none leading-[1.5]",style:{color:"var(--cream)"},rows:1,placeholder:"Message curie-agent...",value:h,onChange:g=>{p(g.target.value),S()},onKeyDown:w}),o.jsxs("div",{className:"flex items-center px-3 pb-2.5 pt-1",children:[a!==void 0?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"text-[10px] text-muted font-mono",style:{opacity:.6},children:[Zg(a)," tokens"]}),o.jsx("span",{className:"opacity-30 mx-1",children:" · "}),o.jsxs("span",{className:"text-[10px] text-muted font-mono",style:{opacity:.6},children:["ctx ",Zg(s??0)]}),o.jsx("span",{className:"opacity-30 mx-1",children:" · "}),o.jsxs("span",{className:"text-[10px] text-muted font-mono",style:{color:"var(--green)",opacity:.6},children:["$",(i??0).toFixed(4)]}),o.jsx("div",{className:"flex-1"})]}):null,t?o.jsx("button",{className:"w-8 h-8 flex items-center justify-center cursor-pointer transition-all duration-200 hover:scale-105 active:scale-95 rounded-lg",style:{background:"var(--red)",color:"#fff"},onClick:t,title:"Stop agent",children:o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})})}):o.jsx("button",{className:"btn-gold rounded-lg w-8 h-8 flex items-center justify-center cursor-pointer transition-all duration-200 hover:scale-105 active:scale-95",onClick:()=>{const g=h.trim();g&&(e(g),p(""))},children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#1a1410",strokeWidth:"2.5",children:[o.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),o.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]})})}const Ig=["what are we discovering today?","greetings from the lab!","lab coat is on ... ","the system is radioactive","what is our next experiment?","atomic levels are stable!","what is our next reaction?","geiger counter is ticking...","mobile X-ray unit deployed","nobel-tier assist activated","emitting helpful isotopes","cathode rays engaged"];function Kg(){return Ig[Math.floor(Math.random()*Ig.length)]}function Av({content:e}){const[t,n]=b.useState(!0);return o.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:o.jsxs("div",{className:"rounded-lg overflow-hidden cursor-pointer select-none transition-all duration-150",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b1)",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},onClick:()=>n(!t),children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"color-mix(in srgb, var(--s2) 80%, transparent)"},children:[o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",className:"shrink-0",style:{opacity:.7},children:[o.jsx("path",{d:"M12 2a7 7 0 0 0-7 7c0 3 2 5 2 8h10c0-3 2-5 2-8a7 7 0 0 0-7-7z"}),o.jsx("circle",{cx:"9",cy:"9",r:"1",fill:"currentColor"}),o.jsx("circle",{cx:"15",cy:"9",r:"1",fill:"currentColor"})]}),o.jsx("span",{className:"text-[11.5px] font-medium text-text font-mono",children:t?"Hide thinking":"Show thinking"}),o.jsx("div",{className:"flex-1"}),o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`text-muted transition-transform duration-200 ${t?"rotate-180":""}`,children:o.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),t&&o.jsx("div",{className:"px-3 py-2.5",style:{borderTop:"1px solid var(--b1)",background:"color-mix(in srgb, var(--s1) 60%, transparent)"},children:o.jsx("pre",{className:"text-[11px] text-muted leading-relaxed whitespace-pre-wrap font-mono max-h-[300px] overflow-y-auto",children:e})})]})})}function Tv({toolCalls:e}){const[t,n]=b.useState(!1);return o.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:o.jsxs("div",{className:"rounded-lg overflow-hidden mb-1",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b1)",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer select-none transition-all duration-150",style:{background:"color-mix(in srgb, var(--s2) 80%, transparent)"},onClick:()=>n(!t),children:[o.jsx("div",{className:"w-[14px] h-[14px] rounded-[3px] flex items-center justify-center",style:{background:"color-mix(in srgb, var(--gold) 15%, var(--s3))"},children:o.jsxs("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",style:{opacity:.7},children:[o.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),o.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),o.jsxs("span",{className:"text-[11.5px] font-medium text-text font-mono",children:[e.length," tool call",e.length>1?"s":""]}),o.jsx("div",{className:"flex-1"}),o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`text-muted transition-transform duration-200 ${t?"rotate-180":""}`,children:o.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),t&&e.map((l,a)=>o.jsxs("div",{className:"px-3 py-2.5 first:border-t-0",style:{borderTop:"1px solid var(--b1)",background:"color-mix(in srgb, var(--s1) 60%, transparent)"},children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("span",{className:"text-[11.5px] font-semibold font-mono",style:{color:"var(--gold)"},children:l.name}),o.jsx("span",{className:"text-xs text-muted font-mono truncate max-w-[250px]",children:l.args})]}),o.jsx("pre",{className:"text-[11px] text-muted font-mono leading-[1.5] overflow-x-auto whitespace-pre-wrap",children:l.input?Dv(l.input):""})]},a))]})})}function hj({event:e}){const[t,n]=b.useState(!1);return o.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:o.jsxs("div",{className:"rounded-lg overflow-hidden mb-1",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b1)",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer select-none transition-all duration-150",style:{background:"color-mix(in srgb, var(--s2) 80%, transparent)"},onClick:()=>n(!t),children:[o.jsx("div",{className:"w-[14px] h-[14px] rounded-[3px] flex items-center justify-center",style:{background:"color-mix(in srgb, var(--red) 15%, var(--s3))"},children:o.jsx("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.5",children:o.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})}),o.jsxs("span",{className:"text-[11.5px] font-semibold text-fg font-mono",children:["Heartbeat Brief (",e.scheduleType,")"]}),o.jsx("div",{className:"flex-1"}),o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`text-muted transition-transform duration-200 ${t?"rotate-180":""}`,children:o.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),t&&o.jsx("div",{className:"px-3 py-3 markdown-body",style:{borderTop:"1px solid var(--b1)",background:"color-mix(in srgb, var(--s1) 60%, transparent)"},children:o.jsx("div",{dangerouslySetInnerHTML:{__html:Qo(e.formattedText||"")}})})]})})}function pj({message:e,time:t}){return o.jsx("div",{className:"px-3 py-1.5 animate-fadeIn",children:o.jsxs("div",{className:"p-3.5 rounded-xl backdrop-blur-md shadow-lg max-w-[480px] flex gap-3 transition-all duration-200 relative overflow-hidden group",style:{background:"linear-gradient(135deg, color-mix(in srgb, var(--gold) 8%, var(--s2)), color-mix(in srgb, var(--gold) 4%, var(--s1)))",border:"1px solid color-mix(in srgb, var(--gold) 20%, var(--b1))"},children:[o.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 rounded-full filter blur-xl opacity-30 group-hover:scale-125 transition-transform duration-500",style:{background:"var(--gold)"}}),o.jsxs("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg shrink-0 relative",style:{background:"color-mix(in srgb, var(--gold) 15%, transparent)",color:"var(--gold)"},children:[o.jsx("span",{className:"absolute inset-0 rounded-lg animate-ping opacity-50",style:{background:"color-mix(in srgb, var(--gold) 20%, transparent)",animationDuration:"2s"}}),o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"animate-wiggle",children:[o.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),o.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]})]}),o.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1 select-none",children:[o.jsx("span",{className:"font-bold text-xs tracking-wide uppercase",style:{color:"var(--gold)"},children:"Reminder Fired"}),o.jsx("span",{className:"text-[10px] text-muted font-mono",children:t})]}),o.jsx("div",{className:"text-[13px] text-text leading-relaxed font-semibold",children:e})]})]})})}function al(e){return new Date(e).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Dv(e){if(!e||Object.keys(e).length===0)return"";const t=Object.entries(e);if(t.length===1){const n=t[0];if(!n)return"";const l=n[0],a=n[1],s=typeof a=="object"?JSON.stringify(a,null,2):String(a);return`${l}: ${s}`}return t.map(([n,l])=>{const a=typeof l=="object"?JSON.stringify(l,null,2):String(l);return`${n}: ${a}`}).join(`
113
+ `)}function gj(e,t){if(e==="Bash")return String(t.command||"").slice(0,80);const n=t.file_path||t.path||"";return n?String(n):Object.entries(t).map(([l,a])=>`${l}: ${String(a).slice(0,60)}`).join(", ")}function mj(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>")}ve.setOptions({gfm:!0,breaks:!0});function Qo(e){try{return ve.parse(e)}catch{return mj(e)}}function zv({toolCallId:e,name:t,input:n,decision:l,events:a,rpc:s,mode:i}){const[r,c]=b.useState(!1),[u,d]=b.useState(null),f=a.find(S=>S.type==="approval-decision"&&S.toolCallId===e),h=f?f.decision:u,p=l==="ask"&&!h,x=async S=>{if(s){c(!0);try{await s.approvalDecide(e,S),d(S)}catch(w){console.error("Failed to submit tool approval decision:",w)}finally{c(!1)}}};if(!p){const S=h==="allow";return o.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2.5 animate-fadeIn select-none",children:[o.jsx("div",{className:`flex items-center justify-center w-5 h-5 rounded-full ${S?"bg-green-500/10 text-green-500":"bg-red-500/10 text-red-500"} shrink-0`,children:o.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:S?o.jsx("polyline",{points:"20 6 9 17 4 12"}):o.jsxs(o.Fragment,{children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),o.jsxs("div",{className:"flex items-baseline gap-1.5 text-xs text-muted",children:[o.jsx("span",{className:"font-semibold text-fg",children:S?"Authorized":"Blocked"}),o.jsx("span",{children:"action:"}),o.jsx("code",{className:"font-mono bg-s3 border border-b1 px-1.5 py-0.5 rounded text-[11px] text-fg",children:t})]})]})}return i==="auto"?null:o.jsx("div",{className:"fixed inset-0 z-[999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 animate-fadeIn",children:o.jsxs("div",{className:"w-full max-w-[480px] p-6 rounded-2xl border border-b2 bg-s2/95 backdrop-blur-md shadow-2xl transition-all duration-200 transform scale-100 animate-scaleIn",children:[o.jsxs("div",{className:"flex items-start gap-4 border-b border-b1 pb-4 mb-4",children:[o.jsx("div",{className:"flex items-center justify-center w-10 h-10 rounded-xl bg-yellow-500/10 text-yellow-500 shrink-0",children:o.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"font-bold text-fg text-base block mb-0.5",children:"Authorization Required"}),o.jsx("span",{className:"text-[12px] text-muted",children:"The agent requires permission to run this action."})]})]}),o.jsxs("div",{className:"mb-4",children:[o.jsx("div",{className:"text-[9px] text-muted2 font-mono uppercase tracking-wider mb-1.5 select-none",children:"Action / Tool"}),o.jsx("div",{className:"flex items-center",children:o.jsx("code",{className:"font-mono bg-s3 border border-b1 px-2.5 py-1 rounded-lg text-xs text-fg font-semibold",children:t})})]}),o.jsxs("div",{className:"bg-s1 rounded-xl border border-b1 p-4 mb-6 max-h-[220px] overflow-y-auto scrollbar-thin",children:[o.jsx("div",{className:"text-[9px] text-muted2 font-mono uppercase tracking-wider mb-1.5 select-none",children:"Arguments"}),o.jsx("pre",{className:"font-mono text-[11.5px] text-text overflow-x-auto m-0 leading-normal",children:Dv(n)})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("button",{onClick:()=>x("allow"),disabled:r,className:"flex-1 py-2 px-4 rounded-xl bg-green-600 hover:bg-green-500 text-white font-semibold text-[13px] shadow-lg shadow-green-600/10 hover:shadow-green-600/20 transition-all duration-150 active:scale-[0.98] disabled:opacity-50 disabled:pointer-events-none cursor-pointer flex items-center justify-center gap-1.5",children:[o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Approve Action"]}),o.jsxs("button",{onClick:()=>x("deny"),disabled:r,className:"py-2 px-3 rounded-xl bg-s3 border border-b2 hover:bg-s4 text-fg hover:text-text hover:border-b3 font-semibold text-[13px] transition-all duration-150 active:scale-[0.98] disabled:opacity-50 disabled:pointer-events-none cursor-pointer flex items-center justify-center gap-1.5",children:[o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),"Deny"]})]})]})})}function xj({blocks:e,blockCount:t,response:n,time:l,events:a,rpc:s}){const[i,r]=b.useState(!1);return e&&e.length>0||!!n?o.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:o.jsxs("div",{className:"rounded-lg overflow-hidden cursor-pointer select-none transition-all duration-150",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b1)",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},onClick:()=>r(!i),children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"var(--bg)"},children:[o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",className:"shrink-0",style:{opacity:.7},children:[o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4"}),o.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",transform:"rotate(60 12 12)"}),o.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",transform:"rotate(120 12 12)"})]}),o.jsxs("span",{className:"text-[11.5px] font-medium text-text font-mono",children:[t," agent action",t>1?"s":""]}),n&&o.jsxs("span",{className:"text-[10px] text-muted2 font-mono truncate max-w-[120px]",title:n,children:["“",n.slice(0,60),"...","”"]}),l&&o.jsx("span",{className:"text-[10px] text-muted2 font-mono",children:l}),o.jsx("div",{className:"flex-1"}),o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`text-muted transition-transform duration-200 ${i?"rotate-180":""}`,children:o.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),i&&o.jsxs("div",{className:"px-1 py-1",style:{borderTop:"1px solid var(--b1)",background:"var(--bg)"},onClick:u=>u.stopPropagation(),children:[e.map((u,d)=>{if(u.type==="thinking")return o.jsx(Av,{content:u.content},d);if(u.type==="tool-group"){const f=u;return f.toolCalls.length>0?o.jsx(Tv,{toolCalls:f.toolCalls},d):null}return u.type==="approval-request"?o.jsx(zv,{toolCallId:u.toolCallId,name:u.name,input:u.input,decision:u.decision,events:a||[],rpc:s||null,mode:u.mode},d):null}),n&&o.jsxs("div",{className:"mt-3",children:[o.jsx("div",{className:"flex items-baseline gap-2 mb-1",children:o.jsx("span",{className:"text-[10px] font-semibold text-fg",style:{color:"var(--gold)"},children:"curie-agent"})}),o.jsx("div",{className:"text-[13px] text-text leading-[1.65] markdown-body chat-msg-agent pl-3",dangerouslySetInnerHTML:{__html:Qo(n)}})]})]})]})}):null}function yj(e){switch(e.type){case"user-prompt":return{type:"user",content:e.text||"",time:al(e.timestamp)};case"assistant-delta":return{type:"assistant",content:e.text||"",time:al(e.timestamp)};case"thinking-delta":return{type:"thinking",content:e.text||"",time:al(e.timestamp)};case"heartbeat-brief":return{type:"heartbeat-brief",content:e.formattedText||"",time:al(e.timestamp),event:e};case"tool-call":{const t=e.name||"tool",n=e.input||{},l=gj(t,n);return{type:"tool-group",content:"",time:"",toolCalls:[{name:t,args:l,input:n}]}}case"approval-request":{const t=e.toolCallId,n=e.name||"tool",l=e.input||{},a=e.decision,s=e.mode;return{type:"approval-request",toolCallId:t,name:n,input:l,decision:a,mode:s,time:al(e.timestamp)}}case"cron-task-fired":{const t=e.message||"",n=e.taskId||"";return{type:"reminder-fired",message:t,taskId:n,time:al(e.timestamp)}}case"context-warning":return{type:"assistant",content:e.message||"",time:al(e.timestamp)};case"error":return{type:"error",content:e.message||`An error occurred (code: ${e.code||"unknown"})`,time:al(e.timestamp)};default:return null}}function vj(e){const t=[];let n=[],l="",a=!1,s="",i=null,r=0;const c=()=>{a&&s&&(n.push({type:"thinking",content:s,time:""}),a=!1,s="")},u=()=>{var h;if(n.length===0)return;let f=0;for(let p=r;p<n.length;p++){const x=n[p];x.type==="tool-group"?f+=((h=x.toolCalls)==null?void 0:h.length)||1:f+=1}i?(i.blocks=[...i.blocks,...n.slice(r)],i.blockCount+=f):(i={type:"agent-actions",blocks:[...n],blockCount:f,response:void 0,time:n[0].time||""},t.push(i)),r=n.length},d=()=>{c(),u(),l&&t.push({type:"assistant",content:l,time:""}),n=[],l="",i=null};for(const f of e){const h=yj(f);if(h)if(h.type==="user"||h.type==="error"||h.type==="heartbeat-brief"||h.type==="reminder-fired")d(),t.push(h);else if(h.type==="assistant")l+=h.content;else if(h.type==="thinking")a=!0,s+=h.content||"";else if(h.type==="tool-group"){c();const p=h;n.length>0&&n[n.length-1].type==="tool-group"?n[n.length-1].toolCalls.push(...p.toolCalls||[]):n.push({type:"tool-group",content:"",time:h.time||"",toolCalls:p.toolCalls||[]}),u()}else h.type==="approval-request"?(c(),n.push({type:"approval-request",content:"",time:h.time||"",toolCallId:h.toolCallId||"",name:h.name||"tool",input:h.input||{},decision:h.decision||"ask",mode:h.mode}),u()):(d(),t.push(h))}return d(),t}function bj({cmdResult:e,rpc:t,className:n,activeSessionId:l,onCreateSession:a,onClearCmdResult:s,events:i,addLiveEvent:r,totalTokens:c,contextTokens:u,costUsd:d,onSwitchView:f}){const{ws:h,connected:p,connectionStatus:x}=En(),[S,w]=b.useState(!1),[g,y]=b.useState(null),[m,v]=b.useState(""),j=b.useRef(null),k=b.useRef(null),[E,A]=b.useState(Kg);b.useEffect(()=>{k.current&&!l&&A(Kg()),k.current=l},[l]),b.useEffect(()=>{if(x==="connected")y(null);else if(x==="reconnecting")y(null);else{const N=setTimeout(()=>{y("Disconnected from daemon. Check that the daemon is running.")},2e3);return()=>clearTimeout(N)}},[p,x]);const M=vj(i),B=b.useRef(!0),D=b.useCallback(()=>{j.current&&(j.current.scrollTop=j.current.scrollHeight,B.current=!0)},[]);b.useEffect(()=>{const N=j.current;if(!N)return;const O=()=>{const C=N.scrollHeight-N.scrollTop-N.clientHeight<80;B.current=C};return N.addEventListener("scroll",O,{passive:!0}),()=>N.removeEventListener("scroll",O)},[]),b.useEffect(()=>{B.current&&D()},[M,S,D]),b.useEffect(()=>{D()},[D]),b.useEffect(()=>{e&&(console.log("Command palette result:",e),v(e),s==null||s())},[e,s]);const L=b.useCallback(async N=>{var C,z;if(!t){y("Not connected to daemon. Make sure the daemon is running.");return}if(w(!0),y(null),D(),N.startsWith("/")){const T=N.match(/^\/([^\s]+)(?:\s+(.*))?$/);if(T){const R=T[1].toLowerCase(),Y=(T[2]||"").trim();if(R==="heartbeat"){r({type:"user-prompt",id:`local-prompt-${Date.now()}`,timestamp:Date.now(),text:N});const X=Y.toLowerCase();if(X==="now"){r({type:"assistant-delta",id:`local-running-${Date.now()}`,timestamp:Date.now(),text:"Executing immediate heartbeat cycle in background..."});try{await t.heartbeatRun(),w(!1)}catch(H){const U=H instanceof Error?H.message:String(H);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Heartbeat failed: ${U}`}),w(!1)}}else if(X==="status"||X==="")try{const H=await t.heartbeatStatus(),U=(H==null?void 0:H.schedule)==="on",_=(H==null?void 0:H.intraday)||"(not set)",$=`### Heartbeat Cycle Status:
114
+ * **Enabled**: \`${U?"yes":"no"}\`
115
+ * **Intraday**: \`${_}\`
116
+ * **Daily**: \`${(H==null?void 0:H.daily)||"6:00"}\`
117
+ * **Weekly**: \`${(H==null?void 0:H.weekly)||"monday@6:00"}\`
118
+ * **Monthly**: \`${(H==null?void 0:H.monthly)||"1@6:00"}\`
119
+ * **Dreaming**: \`${(H==null?void 0:H.dreaming)||"2:00"}\`
120
+
121
+ **Usage**:
122
+ * \`/heartbeat enable\` / \`/heartbeat disable\`
123
+ * \`/heartbeat daily <H:MM>\`
124
+ * \`/heartbeat weekly <day@H:MM>\`
125
+ * \`/heartbeat monthly <D@H:MM>\`
126
+ * \`/heartbeat dreaming <H:MM>\`
127
+ * \`/heartbeat intraday <H:MM,...>\`
128
+ * \`/heartbeat now\` — run a heartbeat immediately.`;r({type:"assistant-delta",id:`local-status-${Date.now()}`,timestamp:Date.now(),text:$}),w(!1)}catch(H){const U=H instanceof Error?H.message:String(H);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to fetch heartbeat status: ${U}`}),w(!1)}else if(X==="enable")try{await t.configSet("heartbeat.schedule","on"),r({type:"assistant-delta",id:`local-enable-${Date.now()}`,timestamp:Date.now(),text:"Heartbeat cycle has been enabled successfully."}),w(!1)}catch(H){const U=H instanceof Error?H.message:String(H);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to enable heartbeat: ${U}`}),w(!1)}else if(X==="disable")try{await t.configSet("heartbeat.schedule","off"),r({type:"assistant-delta",id:`local-disable-${Date.now()}`,timestamp:Date.now(),text:"Heartbeat cycle has been disabled."}),w(!1)}catch(H){const U=H instanceof Error?H.message:String(H);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to disable heartbeat: ${U}`}),w(!1)}else{const H=Y.split(/\s+/),U=(C=H[0])==null?void 0:C.toLowerCase(),_=H.slice(1).join(" ").trim();if(["daily","weekly","monthly","dreaming","intraday"].includes(U))try{await t.configSet(`heartbeat.${U}`,_),r({type:"assistant-delta",id:`local-set-${Date.now()}`,timestamp:Date.now(),text:`Heartbeat schedule for \`${U}\` has been set to: \`${_}\``}),w(!1)}catch(G){const q=G instanceof Error?G.message:String(G);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to set heartbeat schedule: ${q}`}),w(!1)}else r({type:"assistant-delta",id:`local-unknown-${Date.now()}`,timestamp:Date.now(),text:"Unknown heartbeat command. Supported subcommands: `status`, `enable`, `disable`, `daily`, `weekly`, `monthly`, `dreaming`, `intraday`, `now`."}),w(!1)}return}else if(R==="cron"){r({type:"user-prompt",id:`local-prompt-${Date.now()}`,timestamp:Date.now(),text:N});const H=Y.toLowerCase().split(/\s+/),U=H[0]||"list",_=H.slice(1).join(" ").trim();if(U==="list"||!U)try{const $=await t.cronList();if(!$||$.length===0)r({type:"assistant-delta",id:`local-cron-list-${Date.now()}`,timestamp:Date.now(),text:"No reminders scheduled."});else{const G=$.map((q,Q)=>{const K=new Date(q.scheduledAt).toLocaleString(),J=q.status==="pending"?"⏳":q.status==="fired"?"🔔":q.status==="executing"?"⚙️":q.status==="completed"?"✅":(q.status==="failed","❌"),P=q.type==="heartbeat"?`Heartbeat: ${q.schedule?`[${q.schedule.type.toUpperCase()}] `:""}`:q.type==="task"?"Task: ":"Reminder: ";return`${Q+1}. ${J} ${P}${q.message} (Scheduled: ${K}, ID: \`${q.id}\`)`}).join(`
129
+ `);r({type:"assistant-delta",id:`local-cron-list-${Date.now()}`,timestamp:Date.now(),text:`### Active Reminders:
130
+ ${G}`})}w(!1)}catch($){const G=$ instanceof Error?$.message:String($);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to fetch reminders: ${G}`}),w(!1)}else if(U==="delete"||U==="cancel")if(!_)r({type:"assistant-delta",id:`local-cron-del-${Date.now()}`,timestamp:Date.now(),text:"Usage: `/cron delete <id>`"}),w(!1);else try{const $=await t.cronCancel(_);$!=null&&$.cancelled?r({type:"assistant-delta",id:`local-cron-del-${Date.now()}`,timestamp:Date.now(),text:`Reminder \`${_}\` cancelled.`}):r({type:"assistant-delta",id:`local-cron-del-${Date.now()}`,timestamp:Date.now(),text:`No reminder found with ID: \`${_}\``}),w(!1)}catch($){const G=$ instanceof Error?$.message:String($);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to delete reminder: ${G}`}),w(!1)}else if(U==="clear")try{const $=await t.cronClear();r({type:"assistant-delta",id:`local-cron-clear-${Date.now()}`,timestamp:Date.now(),text:`Successfully cleared ${($==null?void 0:$.removed)||0} completed reminder(s).`}),w(!1)}catch($){const G=$ instanceof Error?$.message:String($);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to clear reminders: ${G}`}),w(!1)}else r({type:"assistant-delta",id:`local-cron-err-${Date.now()}`,timestamp:Date.now(),text:"Unknown cron subcommand. Supported: `/cron list`, `/cron delete <id>`, `/cron clear`."}),w(!1);return}if(R==="wiki"){r({type:"user-prompt",id:`local-prompt-${Date.now()}`,timestamp:Date.now(),text:N});const X=((z=Y.split(/\s+/)[0])==null?void 0:z.toLowerCase())??"",H=Y.slice(X.length).trim();if(!X||X==="open")f==null||f("wiki"),w(!1);else if(X==="list")try{const U=await t.wikiListPages(),_=(U==null?void 0:U.pages)??[];if(_.length===0)r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:"Wiki is empty. Initialize with: `curie-agent wiki init`"});else{const $={};for(const q of _){const Q=q.category||"other";($[Q]??($[Q]=[])).push(`${q.slug} — ${q.title}`)}const G=Object.entries($).flatMap(([q,Q])=>[`**${q}** (${Q.length})`,...Q.map(K=>` ${K}`)]);r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`### Wiki Pages (${_.length} total)
131
+
132
+ ${G.join(`
133
+ `)}`})}w(!1)}catch(U){r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Wiki list failed: ${U instanceof Error?U.message:String(U)}`}),w(!1)}else if(X==="search")if(!H)r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:"Usage: `/wiki search <query>`"}),w(!1);else try{const _=await t.wikiSearch(H)??[];if(_.length===0)r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`No wiki results for "${H}"`});else{const $=_.slice(0,20).map(G=>` **${G.slug}**: ${G.line}`);r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`### Wiki Search: "${H}" (${_.length} hits)
134
+
135
+ ${$.join(`
136
+ `)}`})}w(!1)}catch(U){r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Wiki search failed: ${U instanceof Error?U.message:String(U)}`}),w(!1)}else if(X==="lint")try{const U=await t.wikiLint(),_=(U==null?void 0:U.issues)??[];if(_.length===0)r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:"Wiki is healthy — no issues found."});else{const $=_.map(G=>`- **[${G.type}]** ${G.slug?`\`${G.slug}\`: `:""}${G.message}`);r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`### Wiki Lint (${_.length} issues)
137
+
138
+ ${$.join(`
139
+ `)}`})}w(!1)}catch(U){r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Wiki lint failed: ${U instanceof Error?U.message:String(U)}`}),w(!1)}else r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:"Wiki commands:\n- `/wiki` — Open wiki view\n- `/wiki list` — List all pages\n- `/wiki search <q>` — Search pages\n- `/wiki lint` — Health check"}),w(!1);return}}}const O=l||"";try{const T=await t.sessionSend(O,N,"webui");T!=null&&T.sessionId&&!l&&(h==null||h.subscribe(T.sessionId),a==null||a(T.sessionId))}catch(T){const R=T instanceof Error?T.message:String(T);y(`Failed to send: ${R}`),w(!1)}},[t,h,l,D,a,r]);b.useEffect(()=>{h&&(h.on("assistant-stop",()=>w(!1)),h.on("error",()=>w(!1)))},[h]);const V=b.useCallback(async()=>{if(!(!t||!l)){w(!1),y(null),D();try{await t.sessionCancel(l)}catch(N){const O=N instanceof Error?N.message:String(N);y(`Failed to cancel: ${O}`)}}},[t,l,D]);return o.jsxs("div",{className:`flex flex-col h-full ${n||""}`,children:[o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-thin",ref:j,children:[M.length===0&&o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted",children:[o.jsx("div",{className:"text-lg mb-2 font-display",style:{color:"var(--cream)"},children:"curie"}),o.jsx("div",{className:"text-sm text-muted",children:E})]}),o.jsxs("div",{className:"py-4 pb-6",children:[M.map((N,O)=>{if(N.type==="thinking")return o.jsx(Av,{content:N.content},`thinking-${O}`);if(N.type==="user")return o.jsx("div",{className:"flex flex-row-reverse px-3 py-0.5 animate-fadeIn transition-colors duration-100",children:o.jsxs("div",{className:"flex flex-1 flex-col items-end min-w-0",children:[o.jsxs("div",{className:"flex flex-row-reverse items-baseline gap-2 mb-1",children:[o.jsx("span",{className:"text-xs font-semibold",style:{color:"var(--cream)"},children:"you"}),o.jsx("span",{className:"text-xs text-muted font-mono",children:N.time})]}),o.jsx("div",{className:"text-[13px] text-text leading-[1.65] chat-msg-user rounded-t-[10px] rounded-bl-[10px] px-3.5 py-2.5 max-w-[480px] markdown-body",dangerouslySetInnerHTML:{__html:Qo(N.content)}})]})},O);if(N.type==="tool-group"){const C=N;if(C.toolCalls.length>0)return o.jsx(Tv,{toolCalls:C.toolCalls},O)}if(N.type==="agent-actions"){const C=N;return o.jsx(xj,{blocks:C.blocks,blockCount:C.blockCount,time:C.time,events:i,rpc:t},`agent-${C.time||O}`)}if(N.type==="approval-request")return o.jsx(zv,{toolCallId:N.toolCallId,name:N.name,input:N.input,decision:N.decision,events:i,rpc:t,mode:N.mode},O);if(N.type==="heartbeat-brief"){const C=N;return o.jsx(hj,{event:C.event},O)}return N.type==="reminder-fired"?o.jsx(pj,{message:N.message,time:N.time},O):N.type==="error"?o.jsxs("div",{className:"px-3 py-0.5 animate-fadeIn transition-colors duration-100",children:[o.jsxs("div",{className:"flex items-baseline gap-2 mb-1",children:[o.jsx("span",{className:"text-xs font-semibold",style:{color:"var(--red)"},children:"error"}),o.jsx("span",{className:"text-xs text-muted font-mono",children:N.time})]}),o.jsx("div",{className:"text-[13px] text-red leading-[1.65] rounded-lg px-3 py-2 bg-red/5 border border-red/10",children:N.content})]},O):o.jsxs("div",{className:"px-3 py-0.5 animate-fadeIn transition-colors duration-100",children:[o.jsxs("div",{className:"flex items-baseline gap-2 mb-1",children:[o.jsx("span",{className:"text-xs font-semibold",style:{color:"var(--gold)"},children:"curie-agent"}),o.jsx("span",{className:"text-xs text-muted font-mono",children:N.time})]}),o.jsx("div",{className:"text-[13px] text-text leading-[1.65] markdown-body chat-msg-agent pl-3",dangerouslySetInnerHTML:{__html:Qo(N.content)}})]},O)}),S&&o.jsx("div",{className:"flex items-center px-3 py-2",children:o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx("span",{className:"w-[5px] h-[5px] bg-muted2 rounded-full animate-dot inline-block",style:{animation:"tdot 1.4s infinite"}}),o.jsx("span",{className:"w-[5px] h-[5px] bg-muted2 rounded-full animate-dot inline-block",style:{animation:"tdot 1.4s infinite 0.2s"}}),o.jsx("span",{className:"w-[5px] h-[5px] bg-muted2 rounded-full animate-dot inline-block",style:{animation:"tdot 1.4s infinite 0.4s"}})]})})]})]}),o.jsxs("div",{className:"flex-shrink-0",children:[g&&o.jsx("div",{className:"px-3 py-1.5 bg-red/10 border-t border-red/20",children:o.jsx("div",{className:"text-[11px] text-red font-mono",children:g})}),o.jsx(fj,{onSend:L,onCancel:S?V:void 0,cmdInput:m,onClearCmdInput:()=>v(""),totalTokens:c,contextTokens:u,costUsd:d})]})]})}function wj(e,t,n,l){if(l){const[r,c]=l.split(";"),u=parseFloat(r||"0"),d=parseFloat(c||"0");if(!isNaN(u)&&!isNaN(d))return(t*u+n*d)/1e6}const a={opus:{in:15,out:75},sonnet:{in:3,out:15},haiku:{in:.8,out:4},"gpt-4o":{in:2.5,out:10},"gpt-4":{in:5,out:15},qwen:{in:.112,out:.224}},s=Object.keys(a).find(r=>e.toLowerCase().includes(r))||"sonnet",i=a[s];return(t*i.in+n*i.out)/1e6}function Sj({cmdResult:e,onClearCmdResult:t,rpc:n,className:l,activeSessionId:a,onCreateSession:s,events:i,addLiveEvent:r,onSwitchView:c}){var y;const{get:u,providers:d}=wh(),f=u("model"),h=u("current_provider")||"anthropic",p=(y=d.find(m=>m.name===h))==null?void 0:y.model_cost;let x=0,S=0,w=0;const g=a?i.filter(m=>m.type==="usage"):[];if(g.length>0){x=g.reduce((v,j)=>v+(j.inputTokens||0)+(j.outputTokens||0),0);const m=g[g.length-1];S=m&&m.inputTokens||0,w=g.reduce((v,j)=>v+wj(f||"sonnet",j.inputTokens||0,j.outputTokens||0,p),0)}return o.jsx("div",{className:`flex flex-col h-full ${l||""}`,children:o.jsx(bj,{cmdResult:e,onClearCmdResult:t,rpc:n,activeSessionId:a,onCreateSession:s,events:i,addLiveEvent:r,totalTokens:x,contextTokens:S,costUsd:w,onSwitchView:c})})}function Nj({rpc:e,className:t}){const[n,l]=b.useState(null),[a,s]=b.useState(null),[i,r]=b.useState(null),[c,u]=b.useState(!0);b.useEffect(()=>{e&&Promise.all([e.configGet("channels.bot_token").catch(()=>null),e.configGet("channels.user_id").catch(()=>null),e.configGet("channels.chat_id").catch(()=>null)]).then(([f,h,p])=>{l(f),s(h),r(p)}).finally(()=>u(!1))},[e]);const d=!!n&&!!a;return o.jsxs("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin ${t||""}`,children:[o.jsxs("div",{className:"flex items-center justify-between mb-5",children:[o.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight",children:"Channels"}),o.jsxs("button",{className:"flex items-center gap-1 bg-transparent border border-b2 rounded px-3 py-1.5 text-muted text-xs hover:border-b3 hover:text-fg transition-colors duration-100",children:[o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[o.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),o.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Connect"]})]}),c?o.jsx("div",{className:"flex items-center justify-center py-10 text-muted",children:"Loading..."}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg mb-0.5 bg-s2",children:[o.jsx("div",{className:"w-8 h-8 rounded-lg bg-s3 flex items-center justify-center shrink-0 text-base",children:d?"📱":"🔌"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-[13px] font-medium text-fg",children:d?"Telegram Connected":"Not Connected"}),o.jsx("div",{className:"text-xs text-muted truncate",children:d?`Bot configured for user ${a}`:"Configure a Telegram bot to enable channel messaging"})]}),o.jsx("div",{className:`w-[6px] h-[6px] rounded-full shrink-0 ${d?"bg-green":"bg-muted2"}`})]}),d&&o.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] overflow-hidden mt-3",children:[o.jsx("div",{className:"text-[12px] font-medium text-text2 px-4 py-3 border-b border-b1",children:"Channel Configuration"}),o.jsx($u,{label:"Bot Token",value:(n==null?void 0:n.slice(0,12))+"..."||""}),o.jsx($u,{label:"User ID",value:a||""}),o.jsx($u,{label:"Chat ID",value:i||"not set"})]})]})]})}function $u({label:e,value:t}){return o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-b1/50",children:[o.jsx("span",{className:"text-xs text-muted",children:e}),o.jsx("span",{className:"text-xs text-text font-mono",children:t})]})}function jj({rpc:e,className:t}){const{ws:n}=En(),[l,a]=b.useState(null),[s,i]=b.useState([]),[r,c]=b.useState(!0),[u,d]=b.useState(null),[f,h]=b.useState(null),p=b.useRef(null),x=b.useCallback(async()=>{if(e)try{const[_,$]=await Promise.all([e.sessionStats(),e.sessionList()]);_&&a(_),Array.isArray($)&&i($)}catch(_){console.error("[StatsView] Failed to load statistics:",_)}},[e]);if(b.useEffect(()=>{c(!0),x().finally(()=>c(!1))},[x]),b.useEffect(()=>{if(!n)return;const _=()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(x,2e3)},$=n.on("session-stop",_),G=n.on("session-start",_);return()=>{$(),G(),p.current&&clearTimeout(p.current)}},[n,x]),r)return o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted py-20 select-none animate-pulse",children:[o.jsx("div",{className:"w-8 h-8 rounded-full mb-4 animate-spin",style:{background:"conic-gradient(from 0deg, transparent, var(--gold))",mask:"radial-gradient(farthest-side, transparent calc(100% - 2px), #000 0)",WebkitMask:"radial-gradient(farthest-side, transparent calc(100% - 2px), #000 0)"}}),o.jsx("span",{className:"text-[13px] font-mono",style:{color:"var(--gold)",opacity:.7},children:"Compiling operations telemetry..."})]});if(!l||l.summary.totalSessions===0)return o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted py-20 select-none",children:[o.jsx("div",{className:"w-14 h-14 rounded-xl flex items-center justify-center mb-4",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b1)",boxShadow:"0 4px 16px rgba(0,0,0,0.2)"},children:o.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",style:{opacity:.6},children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("path",{d:"M21 12H3M12 3v18"})]})}),o.jsx("div",{className:"text-[14px] font-display font-semibold",style:{color:"var(--cream)"},children:"No operational data found"}),o.jsx("div",{className:"text-[11.5px] text-muted mt-1",children:"Start a conversation to generate metrics."})]});const{summary:S,hourly:w,entrypoints:g,topTools:y}=l,m=_=>_<1e3?String(_):_<1e6?`${(_/1e3).toFixed(1)}k`:`${(_/1e6).toFixed(2)}M`,v=600,j=140,k=45,E=15,A=15,M=25,B=Math.max(...w.map(_=>_.inputTokens+_.outputTokens),1),D=v-k-E,L=j-A-M,V=w.map((_,$)=>{const G=_.inputTokens+_.outputTokens,q=k+$/23*D,Q=A+L-G/B*L;return{x:q,y:Q,..._}}),N=V.length>0?`${V.map((_,$)=>`${$===0?"M":"L"} ${_.x} ${_.y}`).join(" ")} L ${V[V.length-1].x} ${A+L} L ${V[0].x} ${A+L} Z`:"",O=V.length>0?V.map((_,$)=>`${$===0?"M":"L"} ${_.x} ${_.y}`).join(" "):"",C=600,z=140,T=Math.max(...w.map(_=>Math.max(_.toolCalls,_.messages)),1),R=C-k-E,Y=z-A-M,X=R/24*.75,H=R/24*.25,U=g.webui+g.tui+g.telegram+g.heartbeat||1;return o.jsxs("div",{className:`flex-1 overflow-y-auto p-4 md:p-7 scrollbar-thin ${t||""}`,children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-6",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-display font-semibold tracking-tight",style:{color:"var(--cream)"},children:"System Telemetry"}),o.jsx("p",{className:"text-[11.5px] text-muted mt-0.5",children:"Real-time daily operations telemetry and interface execution load."})]}),o.jsxs("span",{className:"self-start sm:self-auto text-[11px] font-mono rounded-full px-3 py-1 text-muted select-none",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b1)"},children:["Today: ",new Date().toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[o.jsx(Mr,{label:"Today's Sessions",value:String(S.totalSessionsToday),subtitle:"conversations today"}),o.jsx(Mr,{label:"Operational Cost",value:`$${S.totalCost.toFixed(4)}`,subtitle:"estimated total",isGreen:!0}),o.jsx(Mr,{label:"Volume Consumed",value:m(S.totalTokens),subtitle:"total system tokens"}),o.jsx(Mr,{label:"Agent Executions",value:String(S.totalToolCalls),subtitle:"integrated tool calls"})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5 mb-6",children:[o.jsxs("div",{className:"glass-card rounded-xl p-5 flex flex-col relative select-none",children:[o.jsxs("div",{className:"flex items-center justify-between h-6 mb-4",children:[o.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--gold)",opacity:.8},children:"Hourly Token Consumption"}),o.jsx("span",{className:`text-[11px] font-mono text-fg px-2 py-0.5 rounded-[4px] transition-opacity duration-150 ${u!==null?"opacity-100":"opacity-0 pointer-events-none"}`,style:{background:"var(--s3)",border:"1px solid var(--b1)"},children:u!==null?`${String(u).padStart(2,"0")}:00 · ${m(w[u].inputTokens+w[u].outputTokens)} tok`:"00:00 · 0 tok"})]}),o.jsx("div",{className:"relative flex-1 h-[140px]",children:o.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${v} ${j}`,preserveAspectRatio:"none",className:"overflow-visible",children:[o.jsx("defs",{children:o.jsxs("linearGradient",{id:"tokenGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[o.jsx("stop",{offset:"0%",stopColor:"var(--gold)",stopOpacity:"0.25"}),o.jsx("stop",{offset:"100%",stopColor:"var(--gold)",stopOpacity:"0"})]})}),Array.from({length:5}).map((_,$)=>{const G=A+$/4*L,q=Math.round(B-$/4*B);return o.jsxs("g",{className:"opacity-25",children:[o.jsx("line",{x1:k,y1:G,x2:v-E,y2:G,stroke:"var(--b2)",strokeWidth:"0.75",strokeDasharray:"3 3"}),o.jsx("text",{x:k-8,y:G+3.5,textAnchor:"end",className:"fill-muted font-mono text-[9.5px]",children:m(q)})]},$)}),Array.from({length:7}).map((_,$)=>{const G=Math.round($/6*23),q=k+G/23*D;return o.jsxs("text",{x:q,y:j-6,textAnchor:"middle",className:"fill-muted font-mono text-[9.5px] opacity-60",children:[String(G).padStart(2,"0"),":00"]},$)}),N&&o.jsx("path",{d:N,fill:"url(#tokenGrad)"}),O&&o.jsx("path",{d:O,fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",strokeLinecap:"round"}),V.map((_,$)=>o.jsxs("g",{onMouseEnter:()=>d($),onMouseLeave:()=>d(null),children:[o.jsx("rect",{x:_.x-D/48,y:A,width:D/24,height:L,fill:"transparent",className:"cursor-pointer"}),u===$&&o.jsxs(o.Fragment,{children:[o.jsx("line",{x1:_.x,y1:A,x2:_.x,y2:A+L,stroke:"var(--b2)",strokeWidth:"0.75"}),o.jsx("circle",{cx:_.x,cy:_.y,r:"4",fill:"var(--gold)",stroke:"var(--s1)",strokeWidth:"1.5"})]})]},$))]})})]}),o.jsxs("div",{className:"glass-card rounded-xl p-5 flex flex-col relative select-none",children:[o.jsxs("div",{className:"flex items-center justify-between h-6 mb-4",children:[o.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--gold)",opacity:.8},children:"Hourly Tool & Prompt Load"}),o.jsx("span",{className:`text-[11px] font-mono text-fg px-2 py-0.5 rounded-[4px] transition-opacity duration-150 ${f!==null?"opacity-100":"opacity-0 pointer-events-none"}`,style:{background:"var(--s3)",border:"1px solid var(--b1)"},children:f!==null?`${String(f).padStart(2,"0")}:00 · 🛠️ ${w[f].toolCalls} calls · 💬 ${w[f].messages} msg`:"00:00 · 0 calls · 0 msg"})]}),o.jsx("div",{className:"relative flex-1 h-[140px]",children:o.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${C} ${z}`,preserveAspectRatio:"none",className:"overflow-visible",children:[Array.from({length:5}).map((_,$)=>{const G=A+$/4*Y,q=Math.round(T-$/4*T);return o.jsxs("g",{className:"opacity-25",children:[o.jsx("line",{x1:k,y1:G,x2:C-E,y2:G,stroke:"var(--b2)",strokeWidth:"0.75",strokeDasharray:"3 3"}),o.jsx("text",{x:k-8,y:G+3.5,textAnchor:"end",className:"fill-muted font-mono text-[9.5px]",children:q})]},$)}),Array.from({length:7}).map((_,$)=>{const G=Math.round($/6*23),q=k+G/23*R;return o.jsxs("text",{x:q,y:z-6,textAnchor:"middle",className:"fill-muted font-mono text-[9.5px] opacity-60",children:[String(G).padStart(2,"0"),":00"]},$)}),w.map((_,$)=>{const G=k+$*(X+H),q=_.messages/T*Y,Q=_.toolCalls/T*Y,K=A+Y-q,J=K-Q;return o.jsxs("g",{onMouseEnter:()=>h($),onMouseLeave:()=>h(null),className:"cursor-pointer",children:[_.messages>0&&o.jsx("rect",{x:G,y:K,width:X,height:q,fill:"var(--yellow)",rx:"1",className:"transition-all duration-100 hover:opacity-80"}),_.toolCalls>0&&o.jsx("rect",{x:G,y:J,width:X,height:Q,fill:"var(--cream)",rx:"1",className:"transition-all duration-100 hover:opacity-80"}),o.jsx("rect",{x:G-H/2,y:A,width:X+H,height:Y,fill:"transparent"})]},$)})]})})]})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5 mb-6",children:[o.jsxs("div",{className:"glass-card rounded-xl p-5 flex flex-col select-none",children:[o.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider mb-4 block",style:{color:"var(--gold)",opacity:.8},children:"Telemetry Channels"}),o.jsxs("div",{className:"space-y-3.5 flex-1 flex flex-col justify-center",children:[o.jsx(Ar,{label:"Web UI Console",count:g.webui,percent:Math.round(g.webui/U*100),color:"var(--gold)"}),o.jsx(Ar,{label:"CLI TUI Terminal",count:g.tui,percent:Math.round(g.tui/U*100),color:"var(--yellow)"}),o.jsx(Ar,{label:"Telegram Bot",count:g.telegram,percent:Math.round(g.telegram/U*100),color:"var(--cream)"}),o.jsx(Ar,{label:"Heartbeat Scheduler",count:g.heartbeat,percent:Math.round(g.heartbeat/U*100),color:"var(--red)"})]})]}),o.jsxs("div",{className:"col-span-1 md:col-span-2 glass-card rounded-xl p-5",children:[o.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider mb-3 block",style:{color:"var(--gold)",opacity:.8},children:"Top Executed Tools Today"}),y.length===0?o.jsx("div",{className:"flex items-center justify-center h-28 text-xs text-muted",children:"No tool executions tracked today"}):o.jsx("div",{className:"overflow-hidden",children:o.jsxs("table",{className:"w-full text-left text-xs",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"font-mono text-[10px]",style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 40%, transparent)",color:"var(--muted)"},children:[o.jsx("th",{className:"pb-1.5 font-medium",children:"TOOL DEFINITION"}),o.jsx("th",{className:"pb-1.5 font-medium text-right",children:"CALLS"})]})}),o.jsx("tbody",{children:y.map((_,$)=>o.jsxs("tr",{className:"transition-colors duration-100",style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 20%, transparent)"},children:[o.jsx("td",{className:"py-2 font-mono text-fg font-medium",children:_.name}),o.jsxs("td",{className:"py-2 text-right font-mono font-semibold",style:{color:"var(--gold)"},children:[_.count," executions"]})]},$))})]})})]})]}),s.length>0&&o.jsxs("div",{className:"glass-card rounded-xl overflow-hidden",children:[o.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider px-4 py-3.5",style:{borderBottom:"1px solid var(--b1)",color:"var(--gold)",opacity:.8},children:"Telemetry Operations Stream"}),o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full text-[12.5px]",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"text-left text-xs text-muted font-mono text-[10px]",style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 40%, transparent)"},children:[o.jsx("th",{className:"px-4 py-2 font-medium",children:"SESSION ID"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"CHANNEL"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"MODEL MODEL"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"TELEMETRY TIMESTAMP"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"ACTIVE DIRECTORY"})]})}),o.jsx("tbody",{children:s.slice(0,15).map(_=>o.jsxs("tr",{className:"transition-colors duration-75",style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 20%, transparent)"},children:[o.jsx("td",{className:"px-4 py-2.5 font-mono text-[11.5px] text-fg",children:_.id}),o.jsx("td",{className:"px-4 py-2.5",children:o.jsx("span",{className:"px-2 py-0.5 rounded-[4px] text-[10px] font-mono select-none",style:{background:_.type==="telegram"?"color-mix(in srgb, var(--cream) 10%, transparent)":_.type==="tui"?"color-mix(in srgb, var(--yellow) 10%, transparent)":_.type==="heartbeat"?"color-mix(in srgb, var(--red) 10%, transparent)":"color-mix(in srgb, var(--gold) 10%, transparent)",color:_.type==="telegram"?"var(--cream)":_.type==="tui"?"var(--yellow)":_.type==="heartbeat"?"var(--red)":"var(--gold)",border:"1px solid color-mix(in srgb, var(--b1) 30%, transparent)"},children:_.type||"webui"})}),o.jsx("td",{className:"px-4 py-2.5 text-text font-mono text-[11.5px]",children:_.model}),o.jsx("td",{className:"px-4 py-2.5 text-muted text-xs",children:new Date(_.createdAt).toLocaleString()}),o.jsx("td",{className:"px-4 py-2.5 text-muted text-xs truncate max-w-[220px]",title:_.cwd,children:_.cwd})]},_.id))})]})})]})]})}function Mr({label:e,value:t,subtitle:n,isGreen:l}){return o.jsxs("div",{className:"metric-card rounded-xl px-6 py-5 flex flex-col justify-between select-none",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--gold)",opacity:.7},children:e}),o.jsx("div",{className:"text-2xl font-display font-bold tracking-tight leading-none",style:{color:l?"var(--green)":"var(--cream)"},children:t}),o.jsx("span",{className:"text-[10px] text-muted mt-2 font-mono",children:n})]})}function Ar({label:e,count:t,percent:n,color:l}){return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs font-medium text-text2",children:[o.jsx("span",{children:e}),o.jsxs("span",{className:"font-mono text-muted",children:[t," sessions (",n||0,"%)"]})]}),o.jsx("div",{className:"w-full h-1.5 rounded-full overflow-hidden",style:{background:"var(--s2)"},children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${n||0}%`,background:l}})})]})}function kj({rpc:e,className:t}){const[n,l]=b.useState([]),[a,s]=b.useState(!0);b.useEffect(()=>{e&&(s(!0),e.sessionList().then(r=>{Array.isArray(r)&&l(r)}).catch(()=>{}).finally(()=>s(!1)))},[e]);const i=b.useMemo(()=>{const r=new Map;for(const c of n){const u=r.get(c.cwd)||[];u.push(c),r.set(c.cwd,u)}return Array.from(r.entries()).map(([c,u])=>({cwd:c,sessions:u.length,providers:[...new Set(u.map(d=>d.provider))],models:[...new Set(u.map(d=>d.model))],lastActive:Math.max(...u.map(d=>d.updatedAt))})).sort((c,u)=>u.lastActive-c.lastActive)},[n]);return o.jsxs("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin ${t||""}`,children:[o.jsxs("div",{className:"flex items-center justify-between mb-5",children:[o.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight",children:"Projects"}),o.jsxs("span",{className:"text-xs text-muted font-mono",children:[i.length," projects"]})]}),a?o.jsx("div",{className:"flex items-center justify-center py-10 text-muted",children:"Loading..."}):i.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-muted",children:[o.jsx("div",{className:"text-sm",children:"No projects yet"}),o.jsx("div",{className:"text-xs text-muted2 mt-1",children:"Sessions will appear here once you run them"})]}):i.map(r=>o.jsx(Ej,{project:r},r.cwd))]})}function Ej({project:e}){const t=e.cwd.split("/").pop()||e.cwd;return o.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg mb-0.5 hover:bg-s2 cursor-pointer transition-colors duration-100",children:[o.jsx("div",{className:"w-[6px] h-[6px] rounded-full bg-green shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-[13px] font-medium text-fg",children:t}),o.jsx("div",{className:"text-xs text-muted font-mono",children:e.cwd})]}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs("span",{className:"text-xs text-muted",children:[e.sessions," session",e.sessions!==1?"s":""]}),o.jsx("span",{className:"text-xs text-muted",children:e.providers.join(", ")})]}),o.jsx("span",{className:"text-[10px] font-medium rounded-full px-2 py-0.5 font-mono bg-green/10 text-green",children:"active"})]})}function Cj(){const{rpc:e,ws:t}=En(),[n,l]=b.useState(new Map);b.useEffect(()=>{e&&e.subagentList().then(d=>{if(Array.isArray(d)){const f=new Map;for(const h of d)f.set(h.agentId,h);l(f)}}).catch(()=>{})},[e]),b.useEffect(()=>{if(!t)return;const d=g=>{l(y=>{const m=new Map(y);return m.set(g.agentId,{agentId:g.agentId,sessionId:g.sessionId||"",prompt:g.prompt||"",provider:g.provider||"unknown",status:"starting",text:"",toolCalls:0,errors:[],inputTokens:0,outputTokens:0,startedAt:g.timestamp}),m})},f=g=>{l(y=>{const m=new Map(y),v=m.get(g.agentId);return v&&m.set(g.agentId,{...v,text:v.text+g.text}),m})},h=g=>{l(y=>{const m=new Map(y),v=m.get(g.agentId);return v&&m.set(g.agentId,{...v,toolCalls:v.toolCalls+1}),m})},p=g=>{l(y=>{const m=new Map(y),v=m.get(g.agentId);return v&&m.set(g.agentId,{...v,inputTokens:v.inputTokens+(g.inputTokens||0),outputTokens:v.outputTokens+(g.outputTokens||0)}),m})},x=g=>{l(y=>{const m=new Map(y),v=m.get(g.agentId);return v&&m.set(g.agentId,{...v,status:"done",text:g.text||v.text,toolCalls:g.toolCalls??v.toolCalls,errors:g.errors||[],doneAt:g.timestamp}),m})},S=g=>{l(y=>{const m=new Map(y),v=m.get(g.agentId);return v&&m.set(g.agentId,{...v,status:"error",errors:[...v.errors||[],g.message],doneAt:g.timestamp}),m})},w=[t.on("agent-start",d),t.on("agent-text-delta",f),t.on("agent-tool-call",h),t.on("agent-usage",p),t.on("agent-done",x),t.on("agent-error",S)];return()=>{for(const g of w)g()}},[t]);const a=b.useCallback(async d=>{if(!e)return null;try{return await e.subagentSpawn(d)}catch(f){return console.error("[useSubagents] Spawn failed:",f),null}},[e]),s=b.useCallback(async d=>{if(!e)return!1;try{return await e.subagentCancel(d),l(f=>{const h=new Map(f),p=h.get(d);return p&&h.set(d,{...p,status:"cancelled",doneAt:Date.now()}),h}),!0}catch{return!1}},[e]),i=b.useCallback(async(d,f)=>{if(!e)return!1;try{return await e.subagentSend(d,f),!0}catch{return!1}},[e]),r=Array.from(n.values()).filter(d=>d.status==="running"||d.status==="starting"),c=Array.from(n.values()).filter(d=>d.status==="done"),u=Array.from(n.values()).filter(d=>d.status==="error");return{agents:n,running:r,completed:c,failed:u,spawn:a,cancel:s,send:i}}function _j({rpc:e,sessionId:t,className:n}){const{ws:l}=En(),{agents:a,running:s,completed:i,failed:r,spawn:c,cancel:u,send:d}=Cj(),[f,h]=b.useState(!1),[p,x]=b.useState(!1),[S,w]=b.useState(""),[g,y]=b.useState("auto"),[m,v]=b.useState("auto"),[j,k]=b.useState(""),[E,A]=b.useState(""),[M,B]=b.useState(""),[D,L]=b.useState(""),[V,N]=b.useState(""),[O,C]=b.useState(""),[z,T]=b.useState(""),[R,Y]=b.useState("auto"),[X,H]=b.useState(""),[U,_]=b.useState(""),[$,G]=b.useState(""),[q,Q]=b.useState(null),[K,J]=b.useState(0),P=b.useCallback(async()=>{if(!S.trim()||!e)return;let I=t;if(!I)try{const se=await e.sessionList();Array.isArray(se)&&se.length>0&&(I=se[0].id)}catch{}await c({sessionId:I||"",prompt:S.trim(),provider:j||void 0,mode:g!=="auto"?g:void 0,effort:m!=="auto"?m:void 0,model:E||void 0}),w(""),h(!1),k("")},[S,g,m,j,E,t,e,c]),W=b.useCallback(async()=>{if(!e||!M.trim()||!D||!V){H("Please fill in prompt and date/time");return}H("");const I=`${D}T${V}:00`;try{await e.taskSchedule({instruction:M.trim(),scheduled_at:I,provider:O||void 0,model:z||void 0,effort:R!=="auto"?R:void 0}),B(""),L(""),N(""),x(!1)}catch(se){H(se instanceof Error?se.message:"Failed to schedule task")}},[M,D,V,O,z,R,e]),F=b.useCallback(async()=>{!U||!$.trim()||(await d(U,$.trim()),G(""))},[U,$,d]),le=Array.from(a.values()).sort((I,se)=>(se.startedAt||0)-(I.startedAt||0)),ae=le.filter(I=>I.status==="done"||I.status==="error"||I.status==="cancelled"),te=ae.slice(K*10,(K+1)*10),ge=I=>{const se=Math.floor(I/1e3);return se<60?`${se}s`:`${Math.floor(se/60)}m${se%60}s`};return o.jsxs("div",{className:`flex-1 overflow-y-auto p-4 md:p-7 scrollbar-thin ${n||""}`,children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-6",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight",children:"Agents"}),o.jsx("p",{className:"text-[11.5px] text-muted mt-0.5",children:"Parallel subagent orchestration and monitoring."})]}),o.jsxs("div",{className:"flex gap-2 self-start sm:self-auto",children:[o.jsx("button",{onClick:()=>x(!p),className:`text-xs font-medium border rounded-[8px] px-4 py-2 transition-colors select-none ${p?"bg-blue/15 text-blue border-blue/30":"bg-s2 text-muted border-b1 hover:text-fg"}`,children:"Schedule"}),o.jsx("button",{onClick:()=>h(!f),className:"text-xs font-medium bg-green/10 text-green border border-green/20 rounded-[8px] px-4 py-2 hover:bg-green/20 transition-colors duration-150 select-none",children:f?"Cancel":"+ Spawn Agent"})]})]}),f&&o.jsx("div",{className:"bg-s1 border border-b1 rounded-[10px] p-5 mb-6 animate-in",children:o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("textarea",{className:"bg-s2 border border-b1 rounded-[8px] p-3 text-[13px] text-fg font-mino resize-y min-h-[60px] focus:border-fg/30 outline-none transition-colors duration-150",placeholder:"What should the subagent do?",value:S,onChange:I=>w(I.target.value),onKeyDown:I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),P())}}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[o.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:g,onChange:I=>y(I.target.value),children:[o.jsx("option",{value:"auto",children:"Mode: inherit"}),o.jsx("option",{value:"plan",children:"Mode: plan"}),o.jsx("option",{value:"edit",children:"Mode: edit"}),o.jsx("option",{value:"auto",children:"Mode: auto"}),o.jsx("option",{value:"yolo",children:"Mode: yolo"})]}),o.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:m,onChange:I=>v(I.target.value),children:[o.jsx("option",{value:"auto",children:"Effort: inherit"}),o.jsx("option",{value:"low",children:"Effort: low"}),o.jsx("option",{value:"medium",children:"Effort: medium"}),o.jsx("option",{value:"high",children:"Effort: high"}),o.jsx("option",{value:"max",children:"Effort: max"})]}),o.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:j,onChange:I=>k(I.target.value),children:[o.jsx("option",{value:"",children:"Provider: inherit"}),o.jsx("option",{value:"anthropic",children:"Anthropic"}),o.jsx("option",{value:"openai",children:"OpenAI"}),o.jsx("option",{value:"google",children:"Google"}),o.jsx("option",{value:"ollama",children:"Ollama"}),o.jsx("option",{value:"openrouter",children:"OpenRouter"})]}),o.jsx("input",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none font-mono",placeholder:"Model override (optional)",value:E,onChange:I=>A(I.target.value)}),o.jsx("button",{onClick:P,disabled:!S.trim(),className:"bg-green/20 text-green border border-green/30 rounded-[8px] px-4 py-2 text-xs font-medium hover:bg-green/30 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:"Spawn"})]})]})}),p&&o.jsx("div",{className:"bg-s1 border border-b1 rounded-[10px] p-5 mb-6 animate-in",children:o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("textarea",{className:"bg-s2 border border-b1 rounded-[8px] p-3 text-[13px] text-fg font-mino resize-y min-h-[60px] focus:border-fg/30 outline-none transition-colors duration-150",placeholder:"What should the scheduled agent do?",value:M,onChange:I=>B(I.target.value)}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[o.jsx("input",{type:"date",className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:D,onChange:I=>L(I.target.value)}),o.jsx("input",{type:"time",className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:V,onChange:I=>N(I.target.value)}),o.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:R,onChange:I=>Y(I.target.value),children:[o.jsx("option",{value:"auto",children:"Effort: auto"}),o.jsx("option",{value:"low",children:"Effort: low"}),o.jsx("option",{value:"medium",children:"Effort: medium"}),o.jsx("option",{value:"high",children:"Effort: high"}),o.jsx("option",{value:"max",children:"Effort: max"})]}),o.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:O,onChange:I=>C(I.target.value),children:[o.jsx("option",{value:"",children:"Provider: inherit"}),o.jsx("option",{value:"anthropic",children:"Anthropic"}),o.jsx("option",{value:"openai",children:"OpenAI"}),o.jsx("option",{value:"google",children:"Google"}),o.jsx("option",{value:"ollama",children:"Ollama"}),o.jsx("option",{value:"openrouter",children:"OpenRouter"})]}),o.jsx("input",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none font-mono col-span-2 md:col-span-4",placeholder:"Model override (optional)",value:z,onChange:I=>T(I.target.value)})]}),X&&o.jsx("div",{className:"text-[11px] text-red bg-red/5 rounded-[6px] p-2",children:X}),o.jsx("button",{onClick:W,disabled:!M.trim()||!D||!V,className:"bg-blue/20 text-blue border border-blue/30 rounded-[8px] px-4 py-2 text-xs font-medium hover:bg-blue/30 transition-colors disabled:opacity-40 disabled:cursor-not-allowed self-start",children:"Schedule Agent"})]})}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[o.jsx(Tr,{label:"Running",value:String(s.length),color:"text-yellow"}),o.jsx(Tr,{label:"Completed",value:String(i.length),color:"text-green"}),o.jsx(Tr,{label:"Failed",value:String(r.length),color:"text-red"}),o.jsx(Tr,{label:"Total Tokens",value:ef(le.reduce((I,se)=>I+se.inputTokens+se.outputTokens,0)),color:"text-fg"})]}),s.length>0&&o.jsxs("div",{className:"mb-6",children:[o.jsx("h3",{className:"text-[11px] font-semibold text-text2 uppercase tracking-wider mb-3",children:"Live Agents"}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:s.map(I=>o.jsx(Mj,{agent:I,onCancel:()=>u(I.agentId),onExpand:()=>Q(q===I.agentId?null:I.agentId)},I.agentId))})]}),ae.length>0&&o.jsxs("div",{className:"mb-6",children:[o.jsx("h3",{className:"text-[11px] font-semibold text-text2 uppercase tracking-wider mb-3",children:"History"}),o.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] overflow-hidden",children:[o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full text-[12px]",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"text-left text-xs text-muted border-b border-b1 font-mono text-[10px]",children:[o.jsx("th",{className:"px-4 py-2 font-medium",children:"STATUS"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"PROVIDER"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"PROMPT"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"DURATION"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"TOOLS"}),o.jsx("th",{className:"px-4 py-2 font-medium text-right",children:"TOKENS"})]})}),o.jsx("tbody",{children:te.map(I=>{const se=I.status==="done"?"text-green":I.status==="cancelled"?"text-muted2":"text-red",Re=I.doneAt?ge(I.doneAt-I.startedAt):"-",st=I.inputTokens+I.outputTokens;return o.jsxs("tr",{className:"hover:bg-s2/30 transition-colors cursor-pointer border-b border-b1/40",onClick:()=>Q(q===I.agentId?null:I.agentId),children:[o.jsx("td",{className:"px-4 py-2.5",children:o.jsx("span",{className:`text-[10px] font-mono px-2 py-0.5 rounded-[4px] ${se==="text-green"?"bg-green/10":se==="text-red"?"bg-red/10":"bg-muted/10"}`,children:I.status})}),o.jsx("td",{className:"px-4 py-2.5 text-muted font-mono text-[11.5px]",children:I.provider||"-"}),o.jsx("td",{className:"px-4 py-2.5 text-fg truncate max-w-[200px]",title:I.prompt,children:I.prompt}),o.jsx("td",{className:"px-4 py-2.5 text-muted font-mono",children:Re}),o.jsx("td",{className:"px-4 py-2.5 text-muted font-mono",children:I.toolCalls}),o.jsx("td",{className:"px-4 py-2.5 text-right font-mono text-muted",children:st>0?ef(st):"-"})]},I.agentId)})})]})}),ae.length>10&&o.jsxs("div",{className:"flex items-center justify-center gap-4 py-2 border-t border-b1",children:[o.jsx("button",{className:"text-xs text-muted hover:text-fg transition-colors disabled:opacity-30",disabled:K===0,onClick:()=>J(I=>I-1),children:"Prev"}),o.jsxs("span",{className:"text-[10px] text-muted font-mono",children:[K+1," / ",Math.ceil(ae.length/10)]}),o.jsx("button",{className:"text-xs text-muted hover:text-fg transition-colors disabled:opacity-30",disabled:(K+1)*10>=ae.length,onClick:()=>J(I=>I+1),children:"Next"})]})]}),q&&(()=>{const I=a.get(q);return I?o.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] p-4 mt-2",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("span",{className:"text-[11px] font-mono text-muted",children:["Agent: ",I.agentId.slice(0,12),"..."]}),o.jsx("span",{className:"text-[10px] text-muted",children:new Date(I.startedAt).toLocaleString()})]}),o.jsx("pre",{className:"text-[12px] text-fg bg-s2 rounded-[8px] p-3 overflow-x-auto max-h-[200px] overflow-y-auto whitespace-pre-wrap font-mono",children:I.text||"(no output)"}),I.errors.length>0&&o.jsx("div",{className:"mt-2 text-[11px] text-red bg-red/5 rounded-[6px] p-2",children:I.errors.map((se,Re)=>o.jsxs("div",{children:["Error: ",se]},Re))})]}):null})()]}),s.length>0&&o.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] p-4 mb-6",children:[o.jsx("h3",{className:"text-[11px] font-semibold text-text2 uppercase tracking-wider mb-3",children:"Send Message to Agent"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[o.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none flex-[0.5]",value:U,onChange:I=>_(I.target.value),children:[o.jsx("option",{value:"",children:"Select agent..."}),s.map(I=>o.jsxs("option",{value:I.agentId,children:[I.prompt.slice(0,40),I.prompt.length>40?"...":""]},I.agentId))]}),o.jsx("input",{className:"flex-1 bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",placeholder:"Type a message to inject into the agent...",value:$,onChange:I=>G(I.target.value),onKeyDown:I=>{I.key==="Enter"&&F()}}),o.jsx("button",{onClick:F,disabled:!U||!$.trim(),className:"bg-fg/10 text-fg border border-fg/20 rounded-[8px] px-4 py-2 text-xs font-medium hover:bg-fg/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:"Send"})]})]}),o.jsx(Tj,{ws:l})]})}function Tr({label:e,value:t,color:n}){return o.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] px-5 py-4 flex flex-col justify-between select-none",children:[o.jsx("span",{className:"text-[10px] font-semibold text-muted uppercase tracking-wider",children:e}),o.jsx("div",{className:`text-2xl font-bold tracking-tight leading-none mt-1 ${n}`,children:t})]})}function Mj({agent:e,onCancel:t,onExpand:n}){const l=Date.now()-e.startedAt,a=e.inputTokens+e.outputTokens,s=e.status==="running"?"text-yellow":"text-green";return o.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] p-4 hover:border-b2 transition-colors cursor-pointer select-none",onClick:n,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("div",{className:`w-[6px] h-[6px] rounded-full shrink-0 ${e.status==="running"?"bg-yellow animate-pulse":"bg-green"}`}),o.jsx("span",{className:"text-[12.5px] font-medium text-fg truncate flex-1",children:e.prompt}),o.jsx("span",{className:"text-[9px] font-mono bg-s3 px-1.5 py-0.5 rounded-[3px] text-muted shrink-0",children:e.provider}),o.jsx("span",{className:`text-[10px] font-mono ${s}`,children:e.status}),e.status==="running"&&o.jsx("button",{className:"text-[10px] text-red/70 hover:text-red font-mono shrink-0",onClick:i=>{i.stopPropagation(),t()},children:"Cancel"})]}),o.jsxs("div",{className:"text-[10.5px] text-muted font-mono mb-2",children:[Aj(l)," · ",e.toolCalls," tools · ",ef(a)," tok"]}),e.text&&o.jsx("div",{className:"text-[11px] text-text2 line-clamp-2 font-mono leading-relaxed",children:e.text.slice(-200)})]})}function Aj(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m${t%60}s`}function ef(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function Tj({ws:e}){const[t,n]=b.useState([]);return!e||(["agent-start","agent-text-delta","agent-done","agent-error","agent-tool-call"].forEach(a=>{e.on(a,s=>{n(i=>[{...s,_type:a},...i].slice(0,30))})}),t.length===0)?null:o.jsxs("div",{children:[o.jsx("div",{className:"h-px bg-b1 my-5"}),o.jsx("div",{className:"text-[11.5px] font-medium text-muted mb-2.5",children:"Live Agent Events"}),t.slice(0,15).map((a,s)=>o.jsxs("div",{className:"flex items-center gap-3 px-3 py-1.5 rounded-lg mb-0.5 hover:bg-s2",children:[o.jsx("div",{className:`w-[6px] h-[6px] rounded-full shrink-0 ${a._type==="agent-start"?"bg-yellow":a._type==="agent-done"?"bg-green":a._type==="agent-error"?"bg-red":a._type==="agent-tool-call"?"bg-fg":"bg-muted2"}`}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-[12px] text-text font-mono",children:a._type}),o.jsx("div",{className:"text-xs text-muted truncate",children:a.prompt||a.message||""})]}),o.jsx("span",{className:"text-[10px] text-muted font-mono",children:new Date(a.timestamp).toLocaleTimeString()})]},s))]})}function Dj(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return b.useMemo(()=>l=>{t.forEach(a=>a(l))},t)}const Tc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Es(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Th(e){return"nodeType"in e}function ft(e){var t,n;return e?Es(e)?e:Th(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Dh(e){const{Document:t}=ft(e);return e instanceof t}function Fi(e){return Es(e)?!1:e instanceof ft(e).HTMLElement}function Rv(e){return e instanceof ft(e).SVGElement}function Cs(e){return e?Es(e)?e.document:Th(e)?Dh(e)?e:Fi(e)||Rv(e)?e.ownerDocument:document:document:document}const rn=Tc?b.useLayoutEffect:b.useEffect;function Dc(e){const t=b.useRef(e);return rn(()=>{t.current=e}),b.useCallback(function(){for(var n=arguments.length,l=new Array(n),a=0;a<n;a++)l[a]=arguments[a];return t.current==null?void 0:t.current(...l)},[])}function zj(){const e=b.useRef(null),t=b.useCallback((l,a)=>{e.current=setInterval(l,a)},[]),n=b.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function _i(e,t){t===void 0&&(t=[e]);const n=b.useRef(e);return rn(()=>{n.current!==e&&(n.current=e)},t),n}function Pi(e,t){const n=b.useRef();return b.useMemo(()=>{const l=e(n.current);return n.current=l,l},[...t])}function Zo(e){const t=Dc(e),n=b.useRef(null),l=b.useCallback(a=>{a!==n.current&&(t==null||t(a,n.current)),n.current=a},[]);return[n,l]}function Io(e){const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}let Uu={};function er(e,t){return b.useMemo(()=>{if(t)return t;const n=Uu[e]==null?0:Uu[e]+1;return Uu[e]=n,e+"-"+n},[e,t])}function Ov(e){return function(t){for(var n=arguments.length,l=new Array(n>1?n-1:0),a=1;a<n;a++)l[a-1]=arguments[a];return l.reduce((s,i)=>{const r=Object.entries(i);for(const[c,u]of r){const d=s[c];d!=null&&(s[c]=d+e*u)}return s},{...t})}}const Ia=Ov(1),Ko=Ov(-1);function Rj(e){return"clientX"in e&&"clientY"in e}function zc(e){if(!e)return!1;const{KeyboardEvent:t}=ft(e.target);return t&&e instanceof t}function Oj(e){if(!e)return!1;const{TouchEvent:t}=ft(e.target);return t&&e instanceof t}function Jo(e){if(Oj(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Rj(e)?{x:e.clientX,y:e.clientY}:null}const Rl=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Rl.Translate.toString(e),Rl.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:l}=e;return t+" "+n+"ms "+l}}}),Jg="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Hj(e){return e.matches(Jg)?e:e.querySelector(Jg)}const Lj={display:"none"};function Bj(e){let{id:t,value:n}=e;return _e.createElement("div",{id:t,style:Lj},n)}function $j(e){let{id:t,announcement:n,ariaLiveType:l="assertive"}=e;const a={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return _e.createElement("div",{id:t,style:a,role:"status","aria-live":l,"aria-atomic":!0},n)}function Uj(){const[e,t]=b.useState("");return{announce:b.useCallback(l=>{l!=null&&t(l)},[]),announcement:e}}const Hv=b.createContext(null);function qj(e){const t=b.useContext(Hv);b.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Yj(){const[e]=b.useState(()=>new Set),t=b.useCallback(l=>(e.add(l),()=>e.delete(l)),[e]);return[b.useCallback(l=>{let{type:a,event:s}=l;e.forEach(i=>{var r;return(r=i[a])==null?void 0:r.call(i,s)})},[e]),t]}const Vj={draggable:`
140
+ To pick up a draggable item, press the space bar.
141
+ While dragging, use the arrow keys to move the item.
142
+ Press space again to drop the item in its new position, or press escape to cancel.
143
+ `},Xj={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Gj(e){let{announcements:t=Xj,container:n,hiddenTextDescribedById:l,screenReaderInstructions:a=Vj}=e;const{announce:s,announcement:i}=Uj(),r=er("DndLiveRegion"),[c,u]=b.useState(!1);if(b.useEffect(()=>{u(!0)},[]),qj(b.useMemo(()=>({onDragStart(f){let{active:h}=f;s(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;t.onDragMove&&s(t.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;s(t.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;s(t.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;s(t.onDragCancel({active:h,over:p}))}}),[s,t])),!c)return null;const d=_e.createElement(_e.Fragment,null,_e.createElement(Bj,{id:l,value:a.draggable}),_e.createElement($j,{id:r,announcement:i}));return n?Il.createPortal(d,n):d}var Ge;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ge||(Ge={}));function Wo(){}function Wg(e,t){return b.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Qj(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return b.useMemo(()=>[...t].filter(l=>l!=null),[...t])}const on=Object.freeze({x:0,y:0});function Zj(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ij(e,t){const n=Jo(e);if(!n)return"0 0";const l={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return l.x+"% "+l.y+"%"}function Kj(e,t){let{data:{value:n}}=e,{data:{value:l}}=t;return n-l}function Jj(e,t){let{data:{value:n}}=e,{data:{value:l}}=t;return l-n}function Fg(e){let{left:t,top:n,height:l,width:a}=e;return[{x:t,y:n},{x:t+a,y:n},{x:t,y:n+l},{x:t+a,y:n+l}]}function Wj(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const Fj=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:l}=e;const a=Fg(t),s=[];for(const i of l){const{id:r}=i,c=n.get(r);if(c){const u=Fg(c),d=a.reduce((h,p,x)=>h+Zj(u[x],p),0),f=Number((d/4).toFixed(4));s.push({id:r,data:{droppableContainer:i,value:f}})}}return s.sort(Kj)};function Pj(e,t){const n=Math.max(t.top,e.top),l=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),i=a-l,r=s-n;if(l<a&&n<s){const c=t.width*t.height,u=e.width*e.height,d=i*r,f=d/(c+u-d);return Number(f.toFixed(4))}return 0}const e5=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:l}=e;const a=[];for(const s of l){const{id:i}=s,r=n.get(i);if(r){const c=Pj(r,t);c>0&&a.push({id:i,data:{droppableContainer:s,value:c}})}}return a.sort(Jj)};function t5(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Lv(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:on}function n5(e){return function(n){for(var l=arguments.length,a=new Array(l>1?l-1:0),s=1;s<l;s++)a[s-1]=arguments[s];return a.reduce((i,r)=>({...i,top:i.top+e*r.y,bottom:i.bottom+e*r.y,left:i.left+e*r.x,right:i.right+e*r.x}),{...n})}}const l5=n5(1);function Bv(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function a5(e,t,n){const l=Bv(t);if(!l)return e;const{scaleX:a,scaleY:s,x:i,y:r}=l,c=e.left-i-(1-a)*parseFloat(n),u=e.top-r-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),d=a?e.width/a:e.width,f=s?e.height/s:e.height;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c}}const s5={ignoreTransform:!1};function _s(e,t){t===void 0&&(t=s5);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=ft(e).getComputedStyle(e);u&&(n=a5(n,u,d))}const{top:l,left:a,width:s,height:i,bottom:r,right:c}=n;return{top:l,left:a,width:s,height:i,bottom:r,right:c}}function Pg(e){return _s(e,{ignoreTransform:!0})}function i5(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function r5(e,t){return t===void 0&&(t=ft(e).getComputedStyle(e)),t.position==="fixed"}function o5(e,t){t===void 0&&(t=ft(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const s=t[a];return typeof s=="string"?n.test(s):!1})}function zh(e,t){const n=[];function l(a){if(t!=null&&n.length>=t||!a)return n;if(Dh(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Fi(a)||Rv(a)||n.includes(a))return n;const s=ft(e).getComputedStyle(a);return a!==e&&o5(a,s)&&n.push(a),r5(a,s)?n:l(a.parentNode)}return e?l(e):n}function $v(e){const[t]=zh(e,1);return t??null}function qu(e){return!Tc||!e?null:Es(e)?e:Th(e)?Dh(e)||e===Cs(e).scrollingElement?window:Fi(e)?e:null:null}function Uv(e){return Es(e)?e.scrollX:e.scrollLeft}function qv(e){return Es(e)?e.scrollY:e.scrollTop}function tf(e){return{x:Uv(e),y:qv(e)}}var Je;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Je||(Je={}));function Yv(e){return!Tc||!e?!1:e===document.scrollingElement}function Vv(e){const t={x:0,y:0},n=Yv(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},l={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,i=e.scrollTop>=l.y,r=e.scrollLeft>=l.x;return{isTop:a,isLeft:s,isBottom:i,isRight:r,maxScroll:l,minScroll:t}}const c5={x:.2,y:.2};function u5(e,t,n,l,a){let{top:s,left:i,right:r,bottom:c}=n;l===void 0&&(l=10),a===void 0&&(a=c5);const{isTop:u,isBottom:d,isLeft:f,isRight:h}=Vv(e),p={x:0,y:0},x={x:0,y:0},S={height:t.height*a.y,width:t.width*a.x};return!u&&s<=t.top+S.height?(p.y=Je.Backward,x.y=l*Math.abs((t.top+S.height-s)/S.height)):!d&&c>=t.bottom-S.height&&(p.y=Je.Forward,x.y=l*Math.abs((t.bottom-S.height-c)/S.height)),!h&&r>=t.right-S.width?(p.x=Je.Forward,x.x=l*Math.abs((t.right-S.width-r)/S.width)):!f&&i<=t.left+S.width&&(p.x=Je.Backward,x.x=l*Math.abs((t.left+S.width-i)/S.width)),{direction:p,speed:x}}function d5(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}const{top:t,left:n,right:l,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:l,bottom:a,width:e.clientWidth,height:e.clientHeight}}function Xv(e){return e.reduce((t,n)=>Ia(t,tf(n)),on)}function f5(e){return e.reduce((t,n)=>t+Uv(n),0)}function h5(e){return e.reduce((t,n)=>t+qv(n),0)}function Gv(e,t){if(t===void 0&&(t=_s),!e)return;const{top:n,left:l,bottom:a,right:s}=t(e);$v(e)&&(a<=0||s<=0||n>=window.innerHeight||l>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const p5=[["x",["left","right"],f5],["y",["top","bottom"],h5]];class Rh{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const l=zh(n),a=Xv(l);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,r]of p5)for(const c of i)Object.defineProperty(this,c,{get:()=>{const u=r(l),d=a[s]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ci{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var l;return(l=this.target)==null?void 0:l.removeEventListener(...n)})},this.target=t}add(t,n,l){var a;(a=this.target)==null||a.addEventListener(t,n,l),this.listeners.push([t,n,l])}}function g5(e){const{EventTarget:t}=ft(e);return e instanceof t?e:Cs(e)}function Yu(e,t){const n=Math.abs(e.x),l=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+l**2)>t:"x"in t&&"y"in t?n>t.x&&l>t.y:"x"in t?n>t.x:"y"in t?l>t.y:!1}var Ut;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ut||(Ut={}));function em(e){e.preventDefault()}function m5(e){e.stopPropagation()}var me;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(me||(me={}));const Qv={start:[me.Space,me.Enter],cancel:[me.Esc],end:[me.Space,me.Enter,me.Tab]},x5=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case me.Right:return{...n,x:n.x+25};case me.Left:return{...n,x:n.x-25};case me.Down:return{...n,y:n.y+25};case me.Up:return{...n,y:n.y-25}}};class Oh{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new ci(Cs(n)),this.windowListeners=new ci(ft(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ut.Resize,this.handleCancel),this.windowListeners.add(Ut.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ut.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,l=t.node.current;l&&Gv(l),n(on)}handleKeyDown(t){if(zc(t)){const{active:n,context:l,options:a}=this.props,{keyboardCodes:s=Qv,coordinateGetter:i=x5,scrollBehavior:r="smooth"}=a,{code:c}=t;if(s.end.includes(c)){this.handleEnd(t);return}if(s.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=l.current,d=u?{x:u.left,y:u.top}:on;this.referenceCoordinates||(this.referenceCoordinates=d);const f=i(t,{active:n,context:l.current,currentCoordinates:d});if(f){const h=Ko(f,d),p={x:0,y:0},{scrollableAncestors:x}=l.current;for(const S of x){const w=t.code,{isTop:g,isRight:y,isLeft:m,isBottom:v,maxScroll:j,minScroll:k}=Vv(S),E=d5(S),A={x:Math.min(w===me.Right?E.right-E.width/2:E.right,Math.max(w===me.Right?E.left:E.left+E.width/2,f.x)),y:Math.min(w===me.Down?E.bottom-E.height/2:E.bottom,Math.max(w===me.Down?E.top:E.top+E.height/2,f.y))},M=w===me.Right&&!y||w===me.Left&&!m,B=w===me.Down&&!v||w===me.Up&&!g;if(M&&A.x!==f.x){const D=S.scrollLeft+h.x,L=w===me.Right&&D<=j.x||w===me.Left&&D>=k.x;if(L&&!h.y){S.scrollTo({left:D,behavior:r});return}L?p.x=S.scrollLeft-D:p.x=w===me.Right?S.scrollLeft-j.x:S.scrollLeft-k.x,p.x&&S.scrollBy({left:-p.x,behavior:r});break}else if(B&&A.y!==f.y){const D=S.scrollTop+h.y,L=w===me.Down&&D<=j.y||w===me.Up&&D>=k.y;if(L&&!h.x){S.scrollTo({top:D,behavior:r});return}L?p.y=S.scrollTop-D:p.y=w===me.Down?S.scrollTop-j.y:S.scrollTop-k.y,p.y&&S.scrollBy({top:-p.y,behavior:r});break}}this.handleMove(t,Ia(Ko(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:l}=this.props;t.preventDefault(),l(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Oh.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:l=Qv,onActivation:a}=t,{active:s}=n;const{code:i}=e.nativeEvent;if(l.start.includes(i)){const r=s.activatorNode.current;return r&&e.target!==r?!1:(e.preventDefault(),a==null||a({event:e.nativeEvent}),!0)}return!1}}];function tm(e){return!!(e&&"distance"in e)}function nm(e){return!!(e&&"delay"in e)}class Hh{constructor(t,n,l){var a;l===void 0&&(l=g5(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:i}=s;this.props=t,this.events=n,this.document=Cs(i),this.documentListeners=new ci(this.document),this.listeners=new ci(l),this.windowListeners=new ci(ft(i)),this.initialCoordinates=(a=Jo(s))!=null?a:on,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:l}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Ut.Resize,this.handleCancel),this.windowListeners.add(Ut.DragStart,em),this.windowListeners.add(Ut.VisibilityChange,this.handleCancel),this.windowListeners.add(Ut.ContextMenu,em),this.documentListeners.add(Ut.Keydown,this.handleKeydown),n){if(l!=null&&l({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(nm(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(tm(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:l,onPending:a}=this.props;a(l,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ut.Click,m5,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ut.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:l,initialCoordinates:a,props:s}=this,{onMove:i,options:{activationConstraint:r}}=s;if(!a)return;const c=(n=Jo(t))!=null?n:on,u=Ko(a,c);if(!l&&r){if(tm(r)){if(r.tolerance!=null&&Yu(u,r.tolerance))return this.handleCancel();if(Yu(u,r.distance))return this.handleStart()}if(nm(r)&&Yu(u,r.tolerance))return this.handleCancel();this.handlePending(r,u);return}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===me.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const y5={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Lh extends Hh{constructor(t){const{event:n}=t,l=Cs(n.target);super(t,y5,l)}}Lh.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:l}=t;return!n.isPrimary||n.button!==0?!1:(l==null||l({event:n}),!0)}}];const v5={move:{name:"mousemove"},end:{name:"mouseup"}};var nf;(function(e){e[e.RightClick=2]="RightClick"})(nf||(nf={}));class b5 extends Hh{constructor(t){super(t,v5,Cs(t.event.target))}}b5.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:l}=t;return n.button===nf.RightClick?!1:(l==null||l({event:n}),!0)}}];const Vu={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class w5 extends Hh{constructor(t){super(t,Vu)}static setup(){return window.addEventListener(Vu.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Vu.move.name,t)};function t(){}}}w5.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:l}=t;const{touches:a}=n;return a.length>1?!1:(l==null||l({event:n}),!0)}}];var ui;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ui||(ui={}));var Fo;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Fo||(Fo={}));function S5(e){let{acceleration:t,activator:n=ui.Pointer,canScroll:l,draggingRect:a,enabled:s,interval:i=5,order:r=Fo.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:h}=e;const p=j5({delta:f,disabled:!s}),[x,S]=zj(),w=b.useRef({x:0,y:0}),g=b.useRef({x:0,y:0}),y=b.useMemo(()=>{switch(n){case ui.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case ui.DraggableRect:return a}},[n,a,c]),m=b.useRef(null),v=b.useCallback(()=>{const k=m.current;if(!k)return;const E=w.current.x*g.current.x,A=w.current.y*g.current.y;k.scrollBy(E,A)},[]),j=b.useMemo(()=>r===Fo.TreeOrder?[...u].reverse():u,[r,u]);b.useEffect(()=>{if(!s||!u.length||!y){S();return}for(const k of j){if((l==null?void 0:l(k))===!1)continue;const E=u.indexOf(k),A=d[E];if(!A)continue;const{direction:M,speed:B}=u5(k,A,y,t,h);for(const D of["x","y"])p[D][M[D]]||(B[D]=0,M[D]=0);if(B.x>0||B.y>0){S(),m.current=k,x(v,i),w.current=B,g.current=M;return}}w.current={x:0,y:0},g.current={x:0,y:0},S()},[t,v,l,S,s,i,JSON.stringify(y),JSON.stringify(p),x,u,j,d,JSON.stringify(h)])}const N5={x:{[Je.Backward]:!1,[Je.Forward]:!1},y:{[Je.Backward]:!1,[Je.Forward]:!1}};function j5(e){let{delta:t,disabled:n}=e;const l=Io(t);return Pi(a=>{if(n||!l||!a)return N5;const s={x:Math.sign(t.x-l.x),y:Math.sign(t.y-l.y)};return{x:{[Je.Backward]:a.x[Je.Backward]||s.x===-1,[Je.Forward]:a.x[Je.Forward]||s.x===1},y:{[Je.Backward]:a.y[Je.Backward]||s.y===-1,[Je.Forward]:a.y[Je.Forward]||s.y===1}}},[n,t,l])}function k5(e,t){const n=t!=null?e.get(t):void 0,l=n?n.node.current:null;return Pi(a=>{var s;return t==null?null:(s=l??a)!=null?s:null},[l,t])}function E5(e,t){return b.useMemo(()=>e.reduce((n,l)=>{const{sensor:a}=l,s=a.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,l)}));return[...n,...s]},[]),[e,t])}var Mi;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Mi||(Mi={}));var lf;(function(e){e.Optimized="optimized"})(lf||(lf={}));const lm=new Map;function C5(e,t){let{dragging:n,dependencies:l,config:a}=t;const[s,i]=b.useState(null),{frequency:r,measure:c,strategy:u}=a,d=b.useRef(e),f=w(),h=_i(f),p=b.useCallback(function(g){g===void 0&&(g=[]),!h.current&&i(y=>y===null?g:y.concat(g.filter(m=>!y.includes(m))))},[h]),x=b.useRef(null),S=Pi(g=>{if(f&&!n)return lm;if(!g||g===lm||d.current!==e||s!=null){const y=new Map;for(let m of e){if(!m)continue;if(s&&s.length>0&&!s.includes(m.id)&&m.rect.current){y.set(m.id,m.rect.current);continue}const v=m.node.current,j=v?new Rh(c(v),v):null;m.rect.current=j,j&&y.set(m.id,j)}return y}return g},[e,s,n,f,c]);return b.useEffect(()=>{d.current=e},[e]),b.useEffect(()=>{f||p()},[n,f]),b.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),b.useEffect(()=>{f||typeof r!="number"||x.current!==null||(x.current=setTimeout(()=>{p(),x.current=null},r))},[r,f,p,...l]),{droppableRects:S,measureDroppableContainers:p,measuringScheduled:s!=null};function w(){switch(u){case Mi.Always:return!1;case Mi.BeforeDragging:return n;default:return!n}}}function Bh(e,t){return Pi(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function _5(e,t){return Bh(e,t)}function M5(e){let{callback:t,disabled:n}=e;const l=Dc(t),a=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(l)},[l,n]);return b.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function Rc(e){let{callback:t,disabled:n}=e;const l=Dc(t),a=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(l)},[n]);return b.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function A5(e){return new Rh(_s(e),e)}function am(e,t,n){t===void 0&&(t=A5);const[l,a]=b.useState(null);function s(){a(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d})}const i=M5({callback(c){if(e)for(const u of c){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){s();break}}}}),r=Rc({callback:s});return rn(()=>{s(),e?(r==null||r.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(r==null||r.disconnect(),i==null||i.disconnect())},[e]),l}function T5(e){const t=Bh(e);return Lv(e,t)}const sm=[];function D5(e){const t=b.useRef(e),n=Pi(l=>e?l&&l!==sm&&e&&t.current&&e.parentNode===t.current.parentNode?l:zh(e):sm,[e]);return b.useEffect(()=>{t.current=e},[e]),n}function z5(e){const[t,n]=b.useState(null),l=b.useRef(e),a=b.useCallback(s=>{const i=qu(s.target);i&&n(r=>r?(r.set(i,tf(i)),new Map(r)):null)},[]);return b.useEffect(()=>{const s=l.current;if(e!==s){i(s);const r=e.map(c=>{const u=qu(c);return u?(u.addEventListener("scroll",a,{passive:!0}),[u,tf(u)]):null}).filter(c=>c!=null);n(r.length?new Map(r):null),l.current=e}return()=>{i(e),i(s)};function i(r){r.forEach(c=>{const u=qu(c);u==null||u.removeEventListener("scroll",a)})}},[a,e]),b.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>Ia(s,i),on):Xv(e):on,[e,t])}function im(e,t){t===void 0&&(t=[]);const n=b.useRef(null);return b.useEffect(()=>{n.current=null},t),b.useEffect(()=>{const l=e!==on;l&&!n.current&&(n.current=e),!l&&n.current&&(n.current=null)},[e]),n.current?Ko(e,n.current):on}function R5(e){b.useEffect(()=>{if(!Tc)return;const t=e.map(n=>{let{sensor:l}=n;return l.setup==null?void 0:l.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function O5(e,t){return b.useMemo(()=>e.reduce((n,l)=>{let{eventName:a,handler:s}=l;return n[a]=i=>{s(i,t)},n},{}),[e,t])}function Zv(e){return b.useMemo(()=>e?i5(e):null,[e])}const rm=[];function H5(e,t){t===void 0&&(t=_s);const[n]=e,l=Zv(n?ft(n):null),[a,s]=b.useState(rm);function i(){s(()=>e.length?e.map(c=>Yv(c)?l:new Rh(t(c),c)):rm)}const r=Rc({callback:i});return rn(()=>{r==null||r.disconnect(),i(),e.forEach(c=>r==null?void 0:r.observe(c))},[e]),a}function Iv(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Fi(t)?t:e}function L5(e){let{measure:t}=e;const[n,l]=b.useState(null),a=b.useCallback(u=>{for(const{target:d}of u)if(Fi(d)){l(f=>{const h=t(d);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),s=Rc({callback:a}),i=b.useCallback(u=>{const d=Iv(u);s==null||s.disconnect(),d&&(s==null||s.observe(d)),l(d?t(d):null)},[t,s]),[r,c]=Zo(i);return b.useMemo(()=>({nodeRef:r,rect:n,setRef:c}),[n,r,c])}const B5=[{sensor:Lh,options:{}},{sensor:Oh,options:{}}],$5={current:{}},io={draggable:{measure:Pg},droppable:{measure:Pg,strategy:Mi.WhileDragging,frequency:lf.Optimized},dragOverlay:{measure:_s}};class di extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,l;return(n=(l=this.get(t))==null?void 0:l.node.current)!=null?n:void 0}}const U5={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new di,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Wo},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:io,measureDroppableContainers:Wo,windowRect:null,measuringScheduled:!1},Kv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Wo,draggableNodes:new Map,over:null,measureDroppableContainers:Wo},tr=b.createContext(Kv),Jv=b.createContext(U5);function q5(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new di}}}function Y5(e,t){switch(t.type){case Ge.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ge.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ge.DragEnd:case Ge.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ge.RegisterDroppable:{const{element:n}=t,{id:l}=n,a=new di(e.droppable.containers);return a.set(l,n),{...e,droppable:{...e.droppable,containers:a}}}case Ge.SetDroppableDisabled:{const{id:n,key:l,disabled:a}=t,s=e.droppable.containers.get(n);if(!s||l!==s.key)return e;const i=new di(e.droppable.containers);return i.set(n,{...s,disabled:a}),{...e,droppable:{...e.droppable,containers:i}}}case Ge.UnregisterDroppable:{const{id:n,key:l}=t,a=e.droppable.containers.get(n);if(!a||l!==a.key)return e;const s=new di(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function V5(e){let{disabled:t}=e;const{active:n,activatorEvent:l,draggableNodes:a}=b.useContext(tr),s=Io(l),i=Io(n==null?void 0:n.id);return b.useEffect(()=>{if(!t&&!l&&s&&i!=null){if(!zc(s)||document.activeElement===s.target)return;const r=a.get(i);if(!r)return;const{activatorNode:c,node:u}=r;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=Hj(d);if(f){f.focus();break}}})}},[l,t,a,i,s]),null}function Wv(e,t){let{transform:n,...l}=t;return e!=null&&e.length?e.reduce((a,s)=>s({transform:a,...l}),n):n}function X5(e){return b.useMemo(()=>({draggable:{...io.draggable,...e==null?void 0:e.draggable},droppable:{...io.droppable,...e==null?void 0:e.droppable},dragOverlay:{...io.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function G5(e){let{activeNode:t,measure:n,initialRect:l,config:a=!0}=e;const s=b.useRef(!1),{x:i,y:r}=typeof a=="boolean"?{x:a,y:a}:a;rn(()=>{if(!i&&!r||!t){s.current=!1;return}if(s.current||!l)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=n(u),f=Lv(d,l);if(i||(f.x=0),r||(f.y=0),s.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=$v(u);h&&h.scrollBy({top:f.y,left:f.x})}},[t,i,r,l,n])}const Oc=b.createContext({...on,scaleX:1,scaleY:1});var ul;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ul||(ul={}));const Q5=b.memo(function(t){var n,l,a,s;let{id:i,accessibility:r,autoScroll:c=!0,children:u,sensors:d=B5,collisionDetection:f=e5,measuring:h,modifiers:p,...x}=t;const S=b.useReducer(Y5,void 0,q5),[w,g]=S,[y,m]=Yj(),[v,j]=b.useState(ul.Uninitialized),k=v===ul.Initialized,{draggable:{active:E,nodes:A,translate:M},droppable:{containers:B}}=w,D=E!=null?A.get(E):null,L=b.useRef({initial:null,translated:null}),V=b.useMemo(()=>{var Ie;return E!=null?{id:E,data:(Ie=D==null?void 0:D.data)!=null?Ie:$5,rect:L}:null},[E,D]),N=b.useRef(null),[O,C]=b.useState(null),[z,T]=b.useState(null),R=_i(x,Object.values(x)),Y=er("DndDescribedBy",i),X=b.useMemo(()=>B.getEnabled(),[B]),H=X5(h),{droppableRects:U,measureDroppableContainers:_,measuringScheduled:$}=C5(X,{dragging:k,dependencies:[M.x,M.y],config:H.droppable}),G=k5(A,E),q=b.useMemo(()=>z?Jo(z):null,[z]),Q=eu(),K=_5(G,H.draggable.measure);G5({activeNode:E!=null?A.get(E):null,config:Q.layoutShiftCompensation,initialRect:K,measure:H.draggable.measure});const J=am(G,H.draggable.measure,K),P=am(G?G.parentElement:null),W=b.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),F=B.getNodeFor((n=W.current.over)==null?void 0:n.id),le=L5({measure:H.dragOverlay.measure}),ae=(l=le.nodeRef.current)!=null?l:G,te=k?(a=le.rect)!=null?a:J:null,ge=!!(le.nodeRef.current&&le.rect),I=T5(ge?null:J),se=Zv(ae?ft(ae):null),Re=D5(k?F??G:null),st=H5(Re),St=Wv(p,{transform:{x:M.x-I.x,y:M.y-I.y,scaleX:1,scaleY:1},activatorEvent:z,active:V,activeNodeRect:J,containerNodeRect:P,draggingNodeRect:te,over:W.current.over,overlayNodeRect:le.rect,scrollableAncestors:Re,scrollableAncestorRects:st,windowRect:se}),Ot=q?Ia(q,M):null,el=z5(Re),_n=im(el),Jt=im(el,[J]),Ht=Ia(St,_n),Mn=te?l5(te,St):null,Ll=V&&Mn?f({active:V,collisionRect:Mn,droppableRects:U,droppableContainers:X,pointerCoordinates:Ot}):null,va=Wj(Ll,"id"),[dn,or]=b.useState(null),Kc=ge?St:Ia(St,Jt),Jc=t5(Kc,(s=dn==null?void 0:dn.rect)!=null?s:null,J),Ms=b.useRef(null),cr=b.useCallback((Ie,it)=>{let{sensor:rt,options:fn}=it;if(N.current==null)return;const ht=A.get(N.current);if(!ht)return;const ot=Ie.nativeEvent,Lt=new rt({active:N.current,activeNode:ht,event:ot,options:fn,context:W,onAbort(Xe){if(!A.get(Xe))return;const{onDragAbort:Bt}=R.current,Wt={id:Xe};Bt==null||Bt(Wt),y({type:"onDragAbort",event:Wt})},onPending(Xe,hn,Bt,Wt){if(!A.get(Xe))return;const{onDragPending:$l}=R.current,pn={id:Xe,constraint:hn,initialCoordinates:Bt,offset:Wt};$l==null||$l(pn),y({type:"onDragPending",event:pn})},onStart(Xe){const hn=N.current;if(hn==null)return;const Bt=A.get(hn);if(!Bt)return;const{onDragStart:Wt}=R.current,Bl={activatorEvent:ot,active:{id:hn,data:Bt.data,rect:L}};Il.unstable_batchedUpdates(()=>{Wt==null||Wt(Bl),j(ul.Initializing),g({type:Ge.DragStart,initialCoordinates:Xe,active:hn}),y({type:"onDragStart",event:Bl}),C(Ms.current),T(ot)})},onMove(Xe){g({type:Ge.DragMove,coordinates:Xe})},onEnd:tl(Ge.DragEnd),onCancel:tl(Ge.DragCancel)});Ms.current=Lt;function tl(Xe){return async function(){const{active:Bt,collisions:Wt,over:Bl,scrollAdjustedTranslate:$l}=W.current;let pn=null;if(Bt&&$l){const{cancelDrop:Ul}=R.current;pn={activatorEvent:ot,active:Bt,collisions:Wt,delta:$l,over:Bl},Xe===Ge.DragEnd&&typeof Ul=="function"&&await Promise.resolve(Ul(pn))&&(Xe=Ge.DragCancel)}N.current=null,Il.unstable_batchedUpdates(()=>{g({type:Xe}),j(ul.Uninitialized),or(null),C(null),T(null),Ms.current=null;const Ul=Xe===Ge.DragEnd?"onDragEnd":"onDragCancel";if(pn){const As=R.current[Ul];As==null||As(pn),y({type:Ul,event:pn})}})}}},[A]),Wc=b.useCallback((Ie,it)=>(rt,fn)=>{const ht=rt.nativeEvent,ot=A.get(fn);if(N.current!==null||!ot||ht.dndKit||ht.defaultPrevented)return;const Lt={active:ot};Ie(rt,it.options,Lt)===!0&&(ht.dndKit={capturedBy:it.sensor},N.current=fn,cr(rt,it))},[A,cr]),ur=E5(d,Wc);R5(d),rn(()=>{J&&v===ul.Initializing&&j(ul.Initialized)},[J,v]),b.useEffect(()=>{const{onDragMove:Ie}=R.current,{active:it,activatorEvent:rt,collisions:fn,over:ht}=W.current;if(!it||!rt)return;const ot={active:it,activatorEvent:rt,collisions:fn,delta:{x:Ht.x,y:Ht.y},over:ht};Il.unstable_batchedUpdates(()=>{Ie==null||Ie(ot),y({type:"onDragMove",event:ot})})},[Ht.x,Ht.y]),b.useEffect(()=>{const{active:Ie,activatorEvent:it,collisions:rt,droppableContainers:fn,scrollAdjustedTranslate:ht}=W.current;if(!Ie||N.current==null||!it||!ht)return;const{onDragOver:ot}=R.current,Lt=fn.get(va),tl=Lt&&Lt.rect.current?{id:Lt.id,rect:Lt.rect.current,data:Lt.data,disabled:Lt.disabled}:null,Xe={active:Ie,activatorEvent:it,collisions:rt,delta:{x:ht.x,y:ht.y},over:tl};Il.unstable_batchedUpdates(()=>{or(tl),ot==null||ot(Xe),y({type:"onDragOver",event:Xe})})},[va]),rn(()=>{W.current={activatorEvent:z,active:V,activeNode:G,collisionRect:Mn,collisions:Ll,droppableRects:U,draggableNodes:A,draggingNode:ae,draggingNodeRect:te,droppableContainers:B,over:dn,scrollableAncestors:Re,scrollAdjustedTranslate:Ht},L.current={initial:te,translated:Mn}},[V,G,Ll,Mn,A,ae,te,U,B,dn,Re,Ht]),S5({...Q,delta:M,draggingRect:Mn,pointerCoordinates:Ot,scrollableAncestors:Re,scrollableAncestorRects:st});const Fc=b.useMemo(()=>({active:V,activeNode:G,activeNodeRect:J,activatorEvent:z,collisions:Ll,containerNodeRect:P,dragOverlay:le,draggableNodes:A,droppableContainers:B,droppableRects:U,over:dn,measureDroppableContainers:_,scrollableAncestors:Re,scrollableAncestorRects:st,measuringConfiguration:H,measuringScheduled:$,windowRect:se}),[V,G,J,z,Ll,P,le,A,B,U,dn,_,Re,st,H,$,se]),Pc=b.useMemo(()=>({activatorEvent:z,activators:ur,active:V,activeNodeRect:J,ariaDescribedById:{draggable:Y},dispatch:g,draggableNodes:A,over:dn,measureDroppableContainers:_}),[z,ur,V,J,g,Y,A,dn,_]);return _e.createElement(Hv.Provider,{value:m},_e.createElement(tr.Provider,{value:Pc},_e.createElement(Jv.Provider,{value:Fc},_e.createElement(Oc.Provider,{value:Jc},u)),_e.createElement(V5,{disabled:(r==null?void 0:r.restoreFocus)===!1})),_e.createElement(Gj,{...r,hiddenTextDescribedById:Y}));function eu(){const Ie=(O==null?void 0:O.autoScrollEnabled)===!1,it=typeof c=="object"?c.enabled===!1:c===!1,rt=k&&!Ie&&!it;return typeof c=="object"?{...c,enabled:rt}:{enabled:rt}}}),Z5=b.createContext(null),om="button",I5="Draggable";function K5(e){let{id:t,data:n,disabled:l=!1,attributes:a}=e;const s=er(I5),{activators:i,activatorEvent:r,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:h}=b.useContext(tr),{role:p=om,roleDescription:x="draggable",tabIndex:S=0}=a??{},w=(c==null?void 0:c.id)===t,g=b.useContext(w?Oc:Z5),[y,m]=Zo(),[v,j]=Zo(),k=O5(i,t),E=_i(n);rn(()=>(f.set(t,{id:t,key:s,node:y,activatorNode:v,data:E}),()=>{const M=f.get(t);M&&M.key===s&&f.delete(t)}),[f,t]);const A=b.useMemo(()=>({role:p,tabIndex:S,"aria-disabled":l,"aria-pressed":w&&p===om?!0:void 0,"aria-roledescription":x,"aria-describedby":d.draggable}),[l,p,S,w,x,d.draggable]);return{active:c,activatorEvent:r,activeNodeRect:u,attributes:A,isDragging:w,listeners:l?void 0:k,node:y,over:h,setNodeRef:m,setActivatorNodeRef:j,transform:g}}function Fv(){return b.useContext(Jv)}const J5="Droppable",W5={timeout:25};function Pv(e){let{data:t,disabled:n=!1,id:l,resizeObserverConfig:a}=e;const s=er(J5),{active:i,dispatch:r,over:c,measureDroppableContainers:u}=b.useContext(tr),d=b.useRef({disabled:n}),f=b.useRef(!1),h=b.useRef(null),p=b.useRef(null),{disabled:x,updateMeasurementsFor:S,timeout:w}={...W5,...a},g=_i(S??l),y=b.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(g.current)?g.current:[g.current]),p.current=null},w)},[w]),m=Rc({callback:y,disabled:x||!i}),v=b.useCallback((A,M)=>{m&&(M&&(m.unobserve(M),f.current=!1),A&&m.observe(A))},[m]),[j,k]=Zo(v),E=_i(t);return b.useEffect(()=>{!m||!j.current||(m.disconnect(),f.current=!1,m.observe(j.current))},[j,m]),b.useEffect(()=>(r({type:Ge.RegisterDroppable,element:{id:l,key:s,disabled:n,node:j,rect:h,data:E}}),()=>r({type:Ge.UnregisterDroppable,key:s,id:l})),[l]),b.useEffect(()=>{n!==d.current.disabled&&(r({type:Ge.SetDroppableDisabled,id:l,key:s,disabled:n}),d.current.disabled=n)},[l,s,n,r]),{active:i,rect:h,isOver:(c==null?void 0:c.id)===l,node:j,over:c,setNodeRef:k}}function F5(e){let{animation:t,children:n}=e;const[l,a]=b.useState(null),[s,i]=b.useState(null),r=Io(n);return!n&&!l&&r&&a(r),rn(()=>{if(!s)return;const c=l==null?void 0:l.key,u=l==null?void 0:l.props.id;if(c==null||u==null){a(null);return}Promise.resolve(t(u,s)).then(()=>{a(null)})},[t,l,s]),_e.createElement(_e.Fragment,null,n,l?b.cloneElement(l,{ref:i}):null)}const P5={x:0,y:0,scaleX:1,scaleY:1};function e3(e){let{children:t}=e;return _e.createElement(tr.Provider,{value:Kv},_e.createElement(Oc.Provider,{value:P5},t))}const t3={position:"fixed",touchAction:"none"},n3=e=>zc(e)?"transform 250ms ease":void 0,l3=b.forwardRef((e,t)=>{let{as:n,activatorEvent:l,adjustScale:a,children:s,className:i,rect:r,style:c,transform:u,transition:d=n3}=e;if(!r)return null;const f=a?u:{...u,scaleX:1,scaleY:1},h={...t3,width:r.width,height:r.height,top:r.top,left:r.left,transform:Rl.Transform.toString(f),transformOrigin:a&&l?Ij(l,r):void 0,transition:typeof d=="function"?d(l):d,...c};return _e.createElement(n,{className:i,style:h,ref:t},s)}),a3=e=>t=>{let{active:n,dragOverlay:l}=t;const a={},{styles:s,className:i}=e;if(s!=null&&s.active)for(const[r,c]of Object.entries(s.active))c!==void 0&&(a[r]=n.node.style.getPropertyValue(r),n.node.style.setProperty(r,c));if(s!=null&&s.dragOverlay)for(const[r,c]of Object.entries(s.dragOverlay))c!==void 0&&l.node.style.setProperty(r,c);return i!=null&&i.active&&n.node.classList.add(i.active),i!=null&&i.dragOverlay&&l.node.classList.add(i.dragOverlay),function(){for(const[c,u]of Object.entries(a))n.node.style.setProperty(c,u);i!=null&&i.active&&n.node.classList.remove(i.active)}},s3=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Rl.Transform.toString(t)},{transform:Rl.Transform.toString(n)}]},i3={duration:250,easing:"ease",keyframes:s3,sideEffects:a3({styles:{active:{opacity:"0"}}})};function r3(e){let{config:t,draggableNodes:n,droppableContainers:l,measuringConfiguration:a}=e;return Dc((s,i)=>{if(t===null)return;const r=n.get(s);if(!r)return;const c=r.node.current;if(!c)return;const u=Iv(i);if(!u)return;const{transform:d}=ft(i).getComputedStyle(i),f=Bv(d);if(!f)return;const h=typeof t=="function"?t:o3(t);return Gv(c,a.draggable.measure),h({active:{id:s,data:r.data,node:c,rect:a.draggable.measure(c)},draggableNodes:n,dragOverlay:{node:i,rect:a.dragOverlay.measure(u)},droppableContainers:l,measuringConfiguration:a,transform:f})})}function o3(e){const{duration:t,easing:n,sideEffects:l,keyframes:a}={...i3,...e};return s=>{let{active:i,dragOverlay:r,transform:c,...u}=s;if(!t)return;const d={x:r.rect.left-i.rect.left,y:r.rect.top-i.rect.top},f={scaleX:c.scaleX!==1?i.rect.width*c.scaleX/r.rect.width:1,scaleY:c.scaleY!==1?i.rect.height*c.scaleY/r.rect.height:1},h={x:c.x-d.x,y:c.y-d.y,...f},p=a({...u,active:i,dragOverlay:r,transform:{initial:c,final:h}}),[x]=p,S=p[p.length-1];if(JSON.stringify(x)===JSON.stringify(S))return;const w=l==null?void 0:l({active:i,dragOverlay:r,...u}),g=r.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{g.onfinish=()=>{w==null||w(),y()}})}}let cm=0;function c3(e){return b.useMemo(()=>{if(e!=null)return cm++,cm},[e])}const u3=_e.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:l,style:a,transition:s,modifiers:i,wrapperElement:r="div",className:c,zIndex:u=999}=e;const{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:x,droppableContainers:S,dragOverlay:w,over:g,measuringConfiguration:y,scrollableAncestors:m,scrollableAncestorRects:v,windowRect:j}=Fv(),k=b.useContext(Oc),E=c3(f==null?void 0:f.id),A=Wv(i,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:w.rect,over:g,overlayNodeRect:w.rect,scrollableAncestors:m,scrollableAncestorRects:v,transform:k,windowRect:j}),M=Bh(h),B=r3({config:l,draggableNodes:x,droppableContainers:S,measuringConfiguration:y}),D=M?w.setRef:void 0;return _e.createElement(e3,null,_e.createElement(F5,{animation:B},f&&E?_e.createElement(l3,{key:E,id:f.id,ref:D,as:r,activatorEvent:d,adjustScale:t,className:c,transition:s,rect:M,style:{zIndex:u,...a},transform:A},n):null))});function eb(e,t,n){const l=e.slice();return l.splice(n<0?l.length+n:n,0,l.splice(t,1)[0]),l}function d3(e,t){return e.reduce((n,l,a)=>{const s=t.get(l);return s&&(n[a]=s),n},Array(e.length))}function Dr(e){return e!==null&&e>=0}function f3(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function h3(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const tb=e=>{let{rects:t,activeIndex:n,overIndex:l,index:a}=e;const s=eb(t,l,n),i=t[a],r=s[a];return!r||!i?null:{x:r.left-i.left,y:r.top-i.top,scaleX:r.width/i.width,scaleY:r.height/i.height}},zr={scaleX:1,scaleY:1},p3=e=>{var t;let{activeIndex:n,activeNodeRect:l,index:a,rects:s,overIndex:i}=e;const r=(t=s[n])!=null?t:l;if(!r)return null;if(a===n){const u=s[i];return u?{x:0,y:n<i?u.top+u.height-(r.top+r.height):u.top-r.top,...zr}:null}const c=g3(s,a,n);return a>n&&a<=i?{x:0,y:-r.height-c,...zr}:a<n&&a>=i?{x:0,y:r.height+c,...zr}:{x:0,y:0,...zr}};function g3(e,t,n){const l=e[t],a=e[t-1],s=e[t+1];return l?n<t?a?l.top-(a.top+a.height):s?s.top-(l.top+l.height):0:s?s.top-(l.top+l.height):a?l.top-(a.top+a.height):0:0}const nb="Sortable",lb=_e.createContext({activeIndex:-1,containerId:nb,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:tb,disabled:{draggable:!1,droppable:!1}});function m3(e){let{children:t,id:n,items:l,strategy:a=tb,disabled:s=!1}=e;const{active:i,dragOverlay:r,droppableRects:c,over:u,measureDroppableContainers:d}=Fv(),f=er(nb,n),h=r.rect!==null,p=b.useMemo(()=>l.map(k=>typeof k=="object"&&"id"in k?k.id:k),[l]),x=i!=null,S=i?p.indexOf(i.id):-1,w=u?p.indexOf(u.id):-1,g=b.useRef(p),y=!f3(p,g.current),m=w!==-1&&S===-1||y,v=h3(s);rn(()=>{y&&x&&d(p)},[y,p,x,d]),b.useEffect(()=>{g.current=p},[p]);const j=b.useMemo(()=>({activeIndex:S,containerId:f,disabled:v,disableTransforms:m,items:p,overIndex:w,useDragOverlay:h,sortedRects:d3(p,c),strategy:a}),[S,f,v.draggable,v.droppable,m,p,w,c,h,a]);return _e.createElement(lb.Provider,{value:j},t)}const x3=e=>{let{id:t,items:n,activeIndex:l,overIndex:a}=e;return eb(n,l,a).indexOf(t)},y3=e=>{let{containerId:t,isSorting:n,wasDragging:l,index:a,items:s,newIndex:i,previousItems:r,previousContainerId:c,transition:u}=e;return!u||!l||r!==s&&a===i?!1:n?!0:i!==a&&t===c},v3={duration:200,easing:"ease"},ab="transform",b3=Rl.Transition.toString({property:ab,duration:0,easing:"linear"}),w3={roleDescription:"sortable"};function S3(e){let{disabled:t,index:n,node:l,rect:a}=e;const[s,i]=b.useState(null),r=b.useRef(n);return rn(()=>{if(!t&&n!==r.current&&l.current){const c=a.current;if(c){const u=_s(l.current,{ignoreTransform:!0}),d={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(d.x||d.y)&&i(d)}}n!==r.current&&(r.current=n)},[t,n,l,a]),b.useEffect(()=>{s&&i(null)},[s]),s}function N3(e){let{animateLayoutChanges:t=y3,attributes:n,disabled:l,data:a,getNewIndex:s=x3,id:i,strategy:r,resizeObserverConfig:c,transition:u=v3}=e;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:x,sortedRects:S,overIndex:w,useDragOverlay:g,strategy:y}=b.useContext(lb),m=j3(l,p),v=d.indexOf(i),j=b.useMemo(()=>({sortable:{containerId:f,index:v,items:d},...a}),[f,a,v,d]),k=b.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:E,node:A,isOver:M,setNodeRef:B}=Pv({id:i,data:j,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...c}}),{active:D,activatorEvent:L,activeNodeRect:V,attributes:N,setNodeRef:O,listeners:C,isDragging:z,over:T,setActivatorNodeRef:R,transform:Y}=K5({id:i,data:j,attributes:{...w3,...n},disabled:m.draggable}),X=Dj(B,O),H=!!D,U=H&&!x&&Dr(h)&&Dr(w),_=!g&&z,$=_&&U?Y:null,q=U?$??(r??y)({rects:S,activeNodeRect:V,activeIndex:h,overIndex:w,index:v}):null,Q=Dr(h)&&Dr(w)?s({id:i,items:d,activeIndex:h,overIndex:w}):v,K=D==null?void 0:D.id,J=b.useRef({activeId:K,items:d,newIndex:Q,containerId:f}),P=d!==J.current.items,W=t({active:D,containerId:f,isDragging:z,isSorting:H,id:i,index:v,items:d,newIndex:J.current.newIndex,previousItems:J.current.items,previousContainerId:J.current.containerId,transition:u,wasDragging:J.current.activeId!=null}),F=S3({disabled:!W,index:v,node:A,rect:E});return b.useEffect(()=>{H&&J.current.newIndex!==Q&&(J.current.newIndex=Q),f!==J.current.containerId&&(J.current.containerId=f),d!==J.current.items&&(J.current.items=d)},[H,Q,f,d]),b.useEffect(()=>{if(K===J.current.activeId)return;if(K!=null&&J.current.activeId==null){J.current.activeId=K;return}const ae=setTimeout(()=>{J.current.activeId=K},50);return()=>clearTimeout(ae)},[K]),{active:D,activeIndex:h,attributes:N,data:j,rect:E,index:v,newIndex:Q,items:d,isOver:M,isSorting:H,isDragging:z,listeners:C,node:A,overIndex:w,over:T,setNodeRef:X,setActivatorNodeRef:R,setDroppableNodeRef:B,setDraggableNodeRef:O,transform:F??q,transition:le()};function le(){if(F||P&&J.current.newIndex===v)return b3;if(!(_&&!zc(L)||!u)&&(H||W))return Rl.Transition.toString({...u,property:ab})}}function j3(e,t){var n,l;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(l=e==null?void 0:e.droppable)!=null?l:t.droppable}}me.Down,me.Right,me.Up,me.Left;const $h=[{id:"backlog",label:"Backlog",statuses:["backlog"],defaultStatus:"backlog"},{id:"todo",label:"To Do",statuses:["todo","pending"],defaultStatus:"todo"},{id:"in_progress",label:"In Progress",statuses:["in_progress","executing"],defaultStatus:"in_progress"},{id:"done",label:"Done",statuses:["done","completed"],defaultStatus:"done"}],um=new Map($h.map(e=>[e.id,e]));function ro(e){for(const t of $h)if(t.statuses.includes(e))return t.id;return null}function k3(e){const t=new Map;for(const n of e){const l=ro(n.status);l&&t.set(n.id,l)}return t}const dm=["canceled","failed"],E3={critical:"var(--red)",high:"var(--yellow)",medium:"var(--muted)",low:"var(--green)"},Uh={human:"H",agent:"A",notify:"N"};function C3({task:e}){const t=E3[e.priority]||"var(--muted)",n=e.scheduled_at?new Date(e.scheduled_at).toLocaleDateString(void 0,{month:"short",day:"numeric"}):null;return o.jsxs("div",{className:"glass-card rounded-xl p-3 mb-2 w-[256px] select-none",children:[o.jsx("div",{className:"flex items-center justify-between mb-1.5",children:o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"currentColor",className:"text-muted2",children:[o.jsx("circle",{cx:"3",cy:"2",r:"1"}),o.jsx("circle",{cx:"9",cy:"2",r:"1"}),o.jsx("circle",{cx:"3",cy:"6",r:"1"}),o.jsx("circle",{cx:"9",cy:"6",r:"1"}),o.jsx("circle",{cx:"3",cy:"10",r:"1"}),o.jsx("circle",{cx:"9",cy:"10",r:"1"})]}),o.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:t}})]})}),o.jsx("div",{className:"text-[12.5px] font-medium text-fg mb-1.5 leading-snug line-clamp-3",children:e.title}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[o.jsxs("span",{className:"text-[9px] font-mono font-bold px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:["[",Uh[e.mode]||"?","]"]}),e.scope==="project"&&o.jsx("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:"proj"}),n&&o.jsx("span",{className:"text-[9px] text-muted2",children:n}),e.tags.slice(0,3).map(l=>o.jsx("span",{className:"leather-tag text-[9px] px-1.5 py-0.5 rounded-full text-muted",children:l},l)),e.tags.length>3&&o.jsxs("span",{className:"text-[9px] text-muted2",children:["+",e.tags.length-3]})]})]})}function _3({task:e,onEdit:t,onRemove:n}){const{attributes:l,listeners:a,setNodeRef:s,transform:i,isDragging:r}=N3({id:e.id,animateLayoutChanges:()=>!1}),c={transform:Rl.Transform.toString(i),opacity:r?0:1};return o.jsxs("div",{ref:s,style:c,className:"cursor-grab active:cursor-grabbing",...l,...a,onClick:()=>t(e),children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("div",{}),o.jsx("button",{onClick:u=>{u.stopPropagation(),n(e.id)},className:"text-muted2 hover:text-red transition-colors p-0.5 rounded cursor-pointer",title:"Delete task",children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx("div",{className:"text-[12.5px] font-medium text-fg mb-1.5 leading-snug line-clamp-3 glass-card rounded-xl p-3 mb-2",children:e.title}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap px-3 pb-2",children:[o.jsxs("span",{className:"text-[9px] font-mono font-bold px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:["[",Uh[e.mode]||"?","]"]}),e.scope==="project"&&o.jsx("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:"proj"}),e.scheduled_at&&o.jsx("span",{className:"text-[9px] text-muted2",children:new Date(e.scheduled_at).toLocaleDateString(void 0,{month:"short",day:"numeric"})}),e.tags.slice(0,3).map(u=>o.jsx("span",{className:"leather-tag text-[9px] px-1.5 py-0.5 rounded-full text-muted",children:u},u)),e.tags.length>3&&o.jsxs("span",{className:"text-[9px] text-muted2",children:["+",e.tags.length-3]})]})]})}function M3({column:e,tasks:t,isDragging:n,onEdit:l,onRemove:a,className:s=""}){const{setNodeRef:i,isOver:r}=Pv({id:e.id}),c=function(u){return o.jsx(_3,{task:u,onEdit:l,onRemove:a},u.id)};return o.jsxs("div",{className:`flex flex-col h-full min-w-[260px] sm:flex-1 ${s}`,children:[o.jsx("div",{className:"flex items-center justify-between px-3 py-2.5 shrink-0",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-[12px] font-semibold font-display",style:{color:"var(--gold)"},children:e.label}),o.jsx("span",{className:"text-[10px] font-mono text-muted bg-s3 px-1.5 py-0.5 rounded",children:t.length})]})}),o.jsxs("div",{ref:i,className:"flex-1 px-2 pb-2 min-h-0 relative transition-colors duration-150 rounded-xl kanban-column-scroll",style:{overflowY:n?"visible":"auto",background:r?"color-mix(in srgb, var(--gold) 8%, transparent)":"transparent"},children:[t.map(c),t.length===0&&o.jsx("div",{className:"text-center py-8 text-[11px] text-muted2 min-h-[120px] flex items-center justify-center",children:"No tasks"})]})]})}function fm({task:e,onSave:t,onClose:n}){const[l,a]=b.useState((e==null?void 0:e.title)??""),[s,i]=b.useState((e==null?void 0:e.description)??""),[r,c]=b.useState((e==null?void 0:e.priority)??"medium"),[u,d]=b.useState((e==null?void 0:e.mode)??"human"),[f,h]=b.useState((e==null?void 0:e.scope)??"personal"),[p,x]=b.useState((e==null?void 0:e.status)??"backlog"),[S,w]=b.useState(()=>{if(e!=null&&e.scheduled_at){const v=new Date(e.scheduled_at),j=v.getTimezoneOffset()*6e4;return new Date(v.getTime()-j).toISOString().slice(0,16)}return""}),[g,y]=b.useState((e==null?void 0:e.tags.join(", "))??""),m=()=>{l.trim()&&t({title:l.trim(),description:s.trim(),priority:r,mode:u,scope:f,status:p,tags:g.split(",").map(v=>v.trim()).filter(Boolean),scheduled_at:S?new Date(S).getTime():void 0})};return o.jsx("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center p-4 animate-fadeIn",style:{background:"rgba(10, 8, 5, 0.7)",backdropFilter:"blur(8px)"},onClick:n,children:o.jsxs("div",{className:"w-full max-w-[420px] rounded-2xl shadow-2xl animate-scaleIn select-none glass-card p-5",onClick:v=>v.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between pb-3 mb-4",style:{borderBottom:"1px solid var(--b1)"},children:[o.jsx("span",{className:"font-bold text-[13.5px] font-display",style:{color:"var(--cream)"},children:e?"Edit Task":"New Task"}),o.jsx("button",{onClick:n,className:"text-muted hover:text-fg transition-colors cursor-pointer",children:o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Title"}),o.jsx("input",{type:"text",value:l,onChange:v=>a(v.target.value),className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none transition-colors focus:ring-1 focus:ring-gold/30",style:{background:"var(--s2)",border:"1px solid var(--b1)"},autoFocus:!0})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Description"}),o.jsx("textarea",{value:s,onChange:v=>i(v.target.value),rows:2,className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none resize-none transition-colors focus:ring-1 focus:ring-gold/30 scrollbar-thin",style:{background:"var(--s2)",border:"1px solid var(--b1)"}})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Priority"}),o.jsxs("select",{value:r,onChange:v=>c(v.target.value),className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none cursor-pointer",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:[o.jsx("option",{value:"low",children:"Low"}),o.jsx("option",{value:"medium",children:"Medium"}),o.jsx("option",{value:"high",children:"High"}),o.jsx("option",{value:"critical",children:"Critical"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Mode"}),o.jsxs("select",{value:u,onChange:v=>d(v.target.value),className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none cursor-pointer",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:[o.jsx("option",{value:"human",children:"Human"}),o.jsx("option",{value:"agent",children:"Agent"}),o.jsx("option",{value:"notify",children:"Notify"})]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Scope"}),o.jsxs("select",{value:f,onChange:v=>h(v.target.value),className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none cursor-pointer",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:[o.jsx("option",{value:"personal",children:"Personal"}),o.jsx("option",{value:"project",children:"Project"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Status"}),o.jsxs("select",{value:p,onChange:v=>x(v.target.value),className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none cursor-pointer",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:[o.jsx("option",{value:"backlog",children:"Backlog"}),o.jsx("option",{value:"todo",children:"To Do"}),o.jsx("option",{value:"in_progress",children:"In Progress"}),o.jsx("option",{value:"done",children:"Done"})]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Scheduled (optional)"}),o.jsx("input",{type:"datetime-local",value:S,onChange:v=>w(v.target.value),className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none cursor-pointer",style:{background:"var(--s2)",border:"1px solid var(--b1)"}})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Tags (comma-separated)"}),o.jsx("input",{type:"text",value:g,onChange:v=>y(v.target.value),placeholder:"bug, feature, urgent",className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none transition-colors focus:ring-1 focus:ring-gold/30",style:{background:"var(--s2)",border:"1px solid var(--b1)"}})]})]}),o.jsxs("div",{className:"flex gap-2 mt-5",children:[o.jsx("button",{onClick:n,className:"flex-1 py-2.5 px-4 rounded-xl text-[12px] font-semibold cursor-pointer transition-all duration-150 active:scale-[0.98]",style:{background:"var(--s3)",border:"1px solid var(--b1)",color:"var(--muted)"},children:"Cancel"}),o.jsx("button",{onClick:m,disabled:!l.trim(),className:"flex-1 btn-gold py-2.5 px-4 rounded-xl text-[12px] font-semibold cursor-pointer active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed",children:e?"Save":"Create"})]})]})})}function A3({rpc:e,className:t}){const{ws:n}=En(),[l,a]=b.useState([]),[s,i]=b.useState(!0),[r,c]=b.useState(null),[u,d]=b.useState(!1),[f,h]=b.useState(!1),[p,x]=b.useState("all"),[S,w]=b.useState("all"),[g,y]=b.useState("all"),[m,v]=b.useState(!1),j=b.useRef(null),[k,E]=b.useState({top:0,left:0}),[A,M]=b.useState(null),B=b.useCallback(async()=>{if(e)try{const _={};p!=="all"&&(_.mode=p),S!=="all"&&(_.priority=S),g!=="all"&&(_.scope=g);const $=await e.todoList(Object.keys(_).length?_:void 0);a(Array.isArray($)?$:[])}catch(_){console.error("[Kanban] Failed to fetch tasks:",_)}finally{i(!1)}},[e,p,S,g]);b.useEffect(()=>{B()},[B]),b.useEffect(()=>{if(!n)return;const _=()=>B(),$=n.on("todo-changed",_),G=n.on("cron-task-fired",_);return()=>{$(),G()}},[n,B]),b.useEffect(()=>{if(!m)return;const _=$=>{$.target.closest("[data-filter-dropdown]")||v(!1)};return document.addEventListener("click",_),()=>document.removeEventListener("click",_)},[m]);const D=b.useMemo(()=>{const _={backlog:[],todo:[],in_progress:[],done:[]};for(const $ of l){if($.mode==="notify")continue;const G=ro($.status);G&&_[G]&&_[G].push($)}return Object.values(_).forEach($=>$.sort((G,q)=>G.order-q.order)),_},[l]),L=b.useMemo(()=>l.filter(_=>dm.includes(_.status)),[l]),V=b.useMemo(()=>k3(l),[l]),N=b.useMemo(()=>{const _={backlog:[],todo:[],in_progress:[],done:[]};for(const $ of l){if($.mode==="notify")continue;const G=ro($.status);G&&!dm.includes($.status)&&_[G].push($.id)}return _},[l]),O=Qj(Wg(Lh,{activationConstraint:{delay:250,tolerance:5}}),Wg(Oh)),[C,z]=b.useState(!1),T=b.useCallback(_=>{z(!0),M(String(_.active.id))},[]),R=b.useCallback(()=>{z(!1),M(null)},[]),Y=b.useCallback(async _=>{const{active:$,over:G}=_;if(!G||!e){z(!1),M(null);return}const q=String($.id),Q=String(G.id),K=l.find(ae=>ae.id===q);if(!K){z(!1),M(null);return}if(!V.get(q)){z(!1),M(null);return}let P=K.status;const W=um.get(Q);if(W)P=W.defaultStatus;else{const ae=l.find(te=>te.id===Q);if(ae){const te=ro(ae.status);te&&(P=um.get(te).defaultStatus)}}if(K.status!==P){const ae=K.status;a(te=>te.map(ge=>ge.id===q?{...ge,status:P}:ge));try{await e.todoUpdate({id:q,status:P})}catch{a(te=>te.map(ge=>ge.id===q?{...ge,status:ae}:ge))}}else try{await e.todoUpdate({id:q})}catch{}M(null),z(!1)},[e,l,V]),X=b.useCallback(async _=>{e&&(await e.todoCreate({title:(_.title??"").trim(),description:_.description,priority:_.priority??"medium",mode:_.mode??"human",scope:_.scope??"personal",status:_.status??"backlog",tags:_.tags,scheduled_at:_.scheduled_at}),h(!1))},[e]),H=b.useCallback(async _=>{!e||!r||(await e.todoUpdate({id:r.id,..._}),c(null))},[e,r]),U=b.useCallback(async _=>{e&&await e.todoRemove(_)},[e]);return s?o.jsx("div",{className:t||"",children:o.jsx("div",{className:"flex items-center justify-center h-full text-muted text-xs",children:"Loading tasks..."})}):o.jsxs("div",{className:`flex flex-col h-full ${t||""}`,children:[o.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:[o.jsx("h2",{className:"text-[13px] font-semibold font-display",style:{color:"var(--cream)"},children:"Tasks"}),o.jsxs("div",{className:"relative","data-filter-dropdown":!0,children:[o.jsx("button",{ref:j,onClick:()=>{if(!m&&j.current){const _=j.current.getBoundingClientRect(),$=200;let G=_.left;G+$>window.innerWidth-8&&(G=window.innerWidth-$-8),E({top:_.bottom+4,left:Math.max(G,8)})}v(!m)},className:"p-1.5 rounded-lg cursor-pointer transition-colors",style:{background:p!=="all"||S!=="all"||g!=="all"?"var(--s3)":"transparent",border:"1px solid var(--b2)",color:"var(--muted)"},children:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})})}),m&&Il.createPortal(o.jsxs("div",{"data-filter-dropdown":!0,className:"fixed rounded-xl shadow-2xl p-3 space-y-2.5 w-[200px]",style:{top:k.top,left:k.left,background:"var(--s1)",border:"1px solid var(--b1)",zIndex:9999},children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-[9px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Mode"}),o.jsx("div",{className:"flex rounded-lg overflow-hidden",style:{border:"1px solid var(--b2)"},children:["all","human","agent","notify"].map(_=>o.jsx("button",{onClick:()=>{x(_),v(!1)},className:"flex-1 px-1.5 py-1 text-[10px] font-mono cursor-pointer transition-all",style:{color:p===_?"var(--gold)":"var(--muted)",background:p===_?"var(--s3)":"transparent"},children:_==="all"?"All":_.charAt(0).toUpperCase()+_.slice(1)},_))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[9px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Priority"}),o.jsxs("select",{value:S,onChange:_=>{w(_.target.value),v(!1)},className:"w-full px-2 py-1 rounded-lg text-[11px] font-mono outline-none cursor-pointer",style:{background:"var(--s2)",border:"1px solid var(--b2)",color:"var(--muted)"},children:[o.jsx("option",{value:"all",children:"All"}),o.jsx("option",{value:"low",children:"Low"}),o.jsx("option",{value:"medium",children:"Medium"}),o.jsx("option",{value:"high",children:"High"}),o.jsx("option",{value:"critical",children:"Critical"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[9px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Scope"}),o.jsx("div",{className:"flex rounded-lg overflow-hidden",style:{border:"1px solid var(--b2)"},children:["all","personal","project"].map(_=>o.jsx("button",{onClick:()=>{y(_),v(!1)},className:"flex-1 px-1.5 py-1 text-[10px] font-mono cursor-pointer transition-all",style:{color:g===_?"var(--gold)":"var(--muted)",background:g===_?"var(--s3)":"transparent"},children:_==="all"?"All":_.charAt(0).toUpperCase()+_.slice(1)},_))})]})]}),document.body)]}),o.jsx("div",{className:"flex-1"}),o.jsxs("button",{onClick:()=>d(!u),className:"text-[10px] font-mono px-2 py-0.5 rounded cursor-pointer transition-all duration-150",style:{color:u?"var(--gold)":"var(--muted)",background:u?"var(--s3)":"transparent",border:"1px solid var(--b2)"},children:["Archive ",L.length]}),o.jsx("button",{onClick:()=>h(!0),className:"btn-gold px-3 py-1.5 rounded-lg text-[11px] font-semibold cursor-pointer active:scale-[0.98]",children:"Add"})]}),o.jsxs(Q5,{sensors:O,collisionDetection:Fj,onDragStart:T,onDragCancel:R,onDragEnd:Y,children:[o.jsx("div",{className:"flex-1 overflow-x-auto overflow-y-hidden min-h-0 snap-x snap-mandatory sm:overflow-x-visible sm:snap-none",children:o.jsx("div",{className:"flex h-full sm:gap-4 sm:flex-row flex-nowrap sm:min-w-0",children:$h.map(_=>o.jsx(m3,{items:N[_.id],strategy:p3,children:o.jsx(M3,{column:_,tasks:D[_.id],isDragging:C,onEdit:c,onRemove:U,className:"snap-center flex-shrink-0 w-screen sm:w-auto sm:flex-1 px-4 sm:px-0"})},_.id))})}),o.jsx(u3,{children:A&&o.jsx(C3,{task:l.find(_=>_.id===A)})})]}),u&&L.length>0&&o.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderTop:"1px solid var(--b1)"},children:[o.jsx("h3",{className:"text-[11px] font-semibold text-muted mb-2",children:"Archived Tasks"}),o.jsx("div",{className:"flex gap-2 flex-wrap",children:L.map(_=>o.jsxs("div",{className:"glass-card rounded-lg px-3 py-2 flex items-center gap-2",style:{opacity:.6},children:[o.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:_.status==="failed"?"var(--red)":"var(--muted2)"}}),o.jsx("span",{className:"text-[11px] text-muted line-through",children:_.title}),o.jsxs("span",{className:"text-[9px] font-mono text-muted2",children:["[",Uh[_.mode],"]"]})]},_.id))})]}),f&&o.jsx(fm,{task:null,onSave:X,onClose:()=>h(!1)}),r&&o.jsx(fm,{task:r,onSave:H,onClose:()=>c(null)})]})}function Ve(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,l;n<e.length;n++)(l=Ve(e[n]))!==""&&(t+=(t&&" ")+l);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var T3={value:()=>{}};function Hc(){for(var e=0,t=arguments.length,n={},l;e<t;++e){if(!(l=arguments[e]+"")||l in n||/[\s.]/.test(l))throw new Error("illegal type: "+l);n[l]=[]}return new oo(n)}function oo(e){this._=e}function D3(e,t){return e.trim().split(/^|\s+/).map(function(n){var l="",a=n.indexOf(".");if(a>=0&&(l=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:l}})}oo.prototype=Hc.prototype={constructor:oo,on:function(e,t){var n=this._,l=D3(e+"",n),a,s=-1,i=l.length;if(arguments.length<2){for(;++s<i;)if((a=(e=l[s]).type)&&(a=z3(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(a=(e=l[s]).type)n[a]=hm(n[a],e.name,t);else if(t==null)for(a in n)n[a]=hm(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new oo(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),l=0,a,s;l<a;++l)n[l]=arguments[l+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],l=0,a=s.length;l<a;++l)s[l].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var l=this._[e],a=0,s=l.length;a<s;++a)l[a].value.apply(t,n)}};function z3(e,t){for(var n=0,l=e.length,a;n<l;++n)if((a=e[n]).name===t)return a.value}function hm(e,t,n){for(var l=0,a=e.length;l<a;++l)if(e[l].name===t){e[l]=T3,e=e.slice(0,l).concat(e.slice(l+1));break}return n!=null&&e.push({name:t,value:n}),e}var af="http://www.w3.org/1999/xhtml";const pm={svg:"http://www.w3.org/2000/svg",xhtml:af,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Lc(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),pm.hasOwnProperty(t)?{space:pm[t],local:e}:e}function R3(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===af&&t.documentElement.namespaceURI===af?t.createElement(e):t.createElementNS(n,e)}}function O3(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function sb(e){var t=Lc(e);return(t.local?O3:R3)(t)}function H3(){}function qh(e){return e==null?H3:function(){return this.querySelector(e)}}function L3(e){typeof e!="function"&&(e=qh(e));for(var t=this._groups,n=t.length,l=new Array(n),a=0;a<n;++a)for(var s=t[a],i=s.length,r=l[a]=new Array(i),c,u,d=0;d<i;++d)(c=s[d])&&(u=e.call(c,c.__data__,d,s))&&("__data__"in c&&(u.__data__=c.__data__),r[d]=u);return new Rt(l,this._parents)}function B3(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function $3(){return[]}function ib(e){return e==null?$3:function(){return this.querySelectorAll(e)}}function U3(e){return function(){return B3(e.apply(this,arguments))}}function q3(e){typeof e=="function"?e=U3(e):e=ib(e);for(var t=this._groups,n=t.length,l=[],a=[],s=0;s<n;++s)for(var i=t[s],r=i.length,c,u=0;u<r;++u)(c=i[u])&&(l.push(e.call(c,c.__data__,u,i)),a.push(c));return new Rt(l,a)}function rb(e){return function(){return this.matches(e)}}function ob(e){return function(t){return t.matches(e)}}var Y3=Array.prototype.find;function V3(e){return function(){return Y3.call(this.children,e)}}function X3(){return this.firstElementChild}function G3(e){return this.select(e==null?X3:V3(typeof e=="function"?e:ob(e)))}var Q3=Array.prototype.filter;function Z3(){return Array.from(this.children)}function I3(e){return function(){return Q3.call(this.children,e)}}function K3(e){return this.selectAll(e==null?Z3:I3(typeof e=="function"?e:ob(e)))}function J3(e){typeof e!="function"&&(e=rb(e));for(var t=this._groups,n=t.length,l=new Array(n),a=0;a<n;++a)for(var s=t[a],i=s.length,r=l[a]=[],c,u=0;u<i;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&r.push(c);return new Rt(l,this._parents)}function cb(e){return new Array(e.length)}function W3(){return new Rt(this._enter||this._groups.map(cb),this._parents)}function Po(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Po.prototype={constructor:Po,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function F3(e){return function(){return e}}function P3(e,t,n,l,a,s){for(var i=0,r,c=t.length,u=s.length;i<u;++i)(r=t[i])?(r.__data__=s[i],l[i]=r):n[i]=new Po(e,s[i]);for(;i<c;++i)(r=t[i])&&(a[i]=r)}function ek(e,t,n,l,a,s,i){var r,c,u=new Map,d=t.length,f=s.length,h=new Array(d),p;for(r=0;r<d;++r)(c=t[r])&&(h[r]=p=i.call(c,c.__data__,r,t)+"",u.has(p)?a[r]=c:u.set(p,c));for(r=0;r<f;++r)p=i.call(e,s[r],r,s)+"",(c=u.get(p))?(l[r]=c,c.__data__=s[r],u.delete(p)):n[r]=new Po(e,s[r]);for(r=0;r<d;++r)(c=t[r])&&u.get(h[r])===c&&(a[r]=c)}function tk(e){return e.__data__}function nk(e,t){if(!arguments.length)return Array.from(this,tk);var n=t?ek:P3,l=this._parents,a=this._groups;typeof e!="function"&&(e=F3(e));for(var s=a.length,i=new Array(s),r=new Array(s),c=new Array(s),u=0;u<s;++u){var d=l[u],f=a[u],h=f.length,p=lk(e.call(d,d&&d.__data__,u,l)),x=p.length,S=r[u]=new Array(x),w=i[u]=new Array(x),g=c[u]=new Array(h);n(d,f,S,w,g,p,t);for(var y=0,m=0,v,j;y<x;++y)if(v=S[y]){for(y>=m&&(m=y+1);!(j=w[m])&&++m<x;);v._next=j||null}}return i=new Rt(i,l),i._enter=r,i._exit=c,i}function lk(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ak(){return new Rt(this._exit||this._groups.map(cb),this._parents)}function sk(e,t,n){var l=this.enter(),a=this,s=this.exit();return typeof e=="function"?(l=e(l),l&&(l=l.selection())):l=l.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?s.remove():n(s),l&&a?l.merge(a).order():a}function ik(e){for(var t=e.selection?e.selection():e,n=this._groups,l=t._groups,a=n.length,s=l.length,i=Math.min(a,s),r=new Array(a),c=0;c<i;++c)for(var u=n[c],d=l[c],f=u.length,h=r[c]=new Array(f),p,x=0;x<f;++x)(p=u[x]||d[x])&&(h[x]=p);for(;c<a;++c)r[c]=n[c];return new Rt(r,this._parents)}function rk(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var l=e[t],a=l.length-1,s=l[a],i;--a>=0;)(i=l[a])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function ok(e){e||(e=ck);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,l=n.length,a=new Array(l),s=0;s<l;++s){for(var i=n[s],r=i.length,c=a[s]=new Array(r),u,d=0;d<r;++d)(u=i[d])&&(c[d]=u);c.sort(t)}return new Rt(a,this._parents).order()}function ck(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function uk(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function dk(){return Array.from(this)}function fk(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var l=e[t],a=0,s=l.length;a<s;++a){var i=l[a];if(i)return i}return null}function hk(){let e=0;for(const t of this)++e;return e}function pk(){return!this.node()}function gk(e){for(var t=this._groups,n=0,l=t.length;n<l;++n)for(var a=t[n],s=0,i=a.length,r;s<i;++s)(r=a[s])&&e.call(r,r.__data__,s,a);return this}function mk(e){return function(){this.removeAttribute(e)}}function xk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function yk(e,t){return function(){this.setAttribute(e,t)}}function vk(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function bk(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function wk(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Sk(e,t){var n=Lc(e);if(arguments.length<2){var l=this.node();return n.local?l.getAttributeNS(n.space,n.local):l.getAttribute(n)}return this.each((t==null?n.local?xk:mk:typeof t=="function"?n.local?wk:bk:n.local?vk:yk)(n,t))}function ub(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Nk(e){return function(){this.style.removeProperty(e)}}function jk(e,t,n){return function(){this.style.setProperty(e,t,n)}}function kk(e,t,n){return function(){var l=t.apply(this,arguments);l==null?this.style.removeProperty(e):this.style.setProperty(e,l,n)}}function Ek(e,t,n){return arguments.length>1?this.each((t==null?Nk:typeof t=="function"?kk:jk)(e,t,n??"")):os(this.node(),e)}function os(e,t){return e.style.getPropertyValue(t)||ub(e).getComputedStyle(e,null).getPropertyValue(t)}function Ck(e){return function(){delete this[e]}}function _k(e,t){return function(){this[e]=t}}function Mk(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ak(e,t){return arguments.length>1?this.each((t==null?Ck:typeof t=="function"?Mk:_k)(e,t)):this.node()[e]}function db(e){return e.trim().split(/^|\s+/)}function Yh(e){return e.classList||new fb(e)}function fb(e){this._node=e,this._names=db(e.getAttribute("class")||"")}fb.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function hb(e,t){for(var n=Yh(e),l=-1,a=t.length;++l<a;)n.add(t[l])}function pb(e,t){for(var n=Yh(e),l=-1,a=t.length;++l<a;)n.remove(t[l])}function Tk(e){return function(){hb(this,e)}}function Dk(e){return function(){pb(this,e)}}function zk(e,t){return function(){(t.apply(this,arguments)?hb:pb)(this,e)}}function Rk(e,t){var n=db(e+"");if(arguments.length<2){for(var l=Yh(this.node()),a=-1,s=n.length;++a<s;)if(!l.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?zk:t?Tk:Dk)(n,t))}function Ok(){this.textContent=""}function Hk(e){return function(){this.textContent=e}}function Lk(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Bk(e){return arguments.length?this.each(e==null?Ok:(typeof e=="function"?Lk:Hk)(e)):this.node().textContent}function $k(){this.innerHTML=""}function Uk(e){return function(){this.innerHTML=e}}function qk(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Yk(e){return arguments.length?this.each(e==null?$k:(typeof e=="function"?qk:Uk)(e)):this.node().innerHTML}function Vk(){this.nextSibling&&this.parentNode.appendChild(this)}function Xk(){return this.each(Vk)}function Gk(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Qk(){return this.each(Gk)}function Zk(e){var t=typeof e=="function"?e:sb(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ik(){return null}function Kk(e,t){var n=typeof e=="function"?e:sb(e),l=t==null?Ik:typeof t=="function"?t:qh(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),l.apply(this,arguments)||null)})}function Jk(){var e=this.parentNode;e&&e.removeChild(this)}function Wk(){return this.each(Jk)}function Fk(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Pk(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function eE(e){return this.select(e?Pk:Fk)}function tE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function nE(e){return function(t){e.call(this,t,this.__data__)}}function lE(e){return e.trim().split(/^|\s+/).map(function(t){var n="",l=t.indexOf(".");return l>=0&&(n=t.slice(l+1),t=t.slice(0,l)),{type:t,name:n}})}function aE(e){return function(){var t=this.__on;if(t){for(var n=0,l=-1,a=t.length,s;n<a;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++l]=s;++l?t.length=l:delete this.__on}}}function sE(e,t,n){return function(){var l=this.__on,a,s=nE(t);if(l){for(var i=0,r=l.length;i<r;++i)if((a=l[i]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=s,a.options=n),a.value=t;return}}this.addEventListener(e.type,s,n),a={type:e.type,name:e.name,value:t,listener:s,options:n},l?l.push(a):this.__on=[a]}}function iE(e,t,n){var l=lE(e+""),a,s=l.length,i;if(arguments.length<2){var r=this.node().__on;if(r){for(var c=0,u=r.length,d;c<u;++c)for(a=0,d=r[c];a<s;++a)if((i=l[a]).type===d.type&&i.name===d.name)return d.value}return}for(r=t?sE:aE,a=0;a<s;++a)this.each(r(l[a],t,n));return this}function gb(e,t,n){var l=ub(e),a=l.CustomEvent;typeof a=="function"?a=new a(t,n):(a=l.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function rE(e,t){return function(){return gb(this,e,t)}}function oE(e,t){return function(){return gb(this,e,t.apply(this,arguments))}}function cE(e,t){return this.each((typeof t=="function"?oE:rE)(e,t))}function*uE(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var l=e[t],a=0,s=l.length,i;a<s;++a)(i=l[a])&&(yield i)}var mb=[null];function Rt(e,t){this._groups=e,this._parents=t}function nr(){return new Rt([[document.documentElement]],mb)}function dE(){return this}Rt.prototype=nr.prototype={constructor:Rt,select:L3,selectAll:q3,selectChild:G3,selectChildren:K3,filter:J3,data:nk,enter:W3,exit:ak,join:sk,merge:ik,selection:dE,order:rk,sort:ok,call:uk,nodes:dk,node:fk,size:hk,empty:pk,each:gk,attr:Sk,style:Ek,property:Ak,classed:Rk,text:Bk,html:Yk,raise:Xk,lower:Qk,append:Zk,insert:Kk,remove:Wk,clone:eE,datum:tE,on:iE,dispatch:cE,[Symbol.iterator]:uE};function Et(e){return typeof e=="string"?new Rt([[document.querySelector(e)]],[document.documentElement]):new Rt([[e]],mb)}function fE(e){let t;for(;t=e.sourceEvent;)e=t;return e}function en(e,t){if(e=fE(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var l=n.createSVGPoint();return l.x=e.clientX,l.y=e.clientY,l=l.matrixTransform(t.getScreenCTM().inverse()),[l.x,l.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const hE={passive:!1},Ai={capture:!0,passive:!1};function Xu(e){e.stopImmediatePropagation()}function Ka(e){e.preventDefault(),e.stopImmediatePropagation()}function xb(e){var t=e.document.documentElement,n=Et(e).on("dragstart.drag",Ka,Ai);"onselectstart"in t?n.on("selectstart.drag",Ka,Ai):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function yb(e,t){var n=e.document.documentElement,l=Et(e).on("dragstart.drag",null);t&&(l.on("click.drag",Ka,Ai),setTimeout(function(){l.on("click.drag",null)},0)),"onselectstart"in n?l.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Rr=e=>()=>e;function sf(e,{sourceEvent:t,subject:n,target:l,identifier:a,active:s,x:i,y:r,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:l,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:r,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}sf.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function pE(e){return!e.ctrlKey&&!e.button}function gE(){return this.parentNode}function mE(e,t){return t??{x:e.x,y:e.y}}function xE(){return navigator.maxTouchPoints||"ontouchstart"in this}function vb(){var e=pE,t=gE,n=mE,l=xE,a={},s=Hc("start","drag","end"),i=0,r,c,u,d,f=0;function h(v){v.on("mousedown.drag",p).filter(l).on("touchstart.drag",w).on("touchmove.drag",g,hE).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(v,j){if(!(d||!e.call(this,v,j))){var k=m(this,t.call(this,v,j),v,j,"mouse");k&&(Et(v.view).on("mousemove.drag",x,Ai).on("mouseup.drag",S,Ai),xb(v.view),Xu(v),u=!1,r=v.clientX,c=v.clientY,k("start",v))}}function x(v){if(Ka(v),!u){var j=v.clientX-r,k=v.clientY-c;u=j*j+k*k>f}a.mouse("drag",v)}function S(v){Et(v.view).on("mousemove.drag mouseup.drag",null),yb(v.view,u),Ka(v),a.mouse("end",v)}function w(v,j){if(e.call(this,v,j)){var k=v.changedTouches,E=t.call(this,v,j),A=k.length,M,B;for(M=0;M<A;++M)(B=m(this,E,v,j,k[M].identifier,k[M]))&&(Xu(v),B("start",v,k[M]))}}function g(v){var j=v.changedTouches,k=j.length,E,A;for(E=0;E<k;++E)(A=a[j[E].identifier])&&(Ka(v),A("drag",v,j[E]))}function y(v){var j=v.changedTouches,k=j.length,E,A;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),E=0;E<k;++E)(A=a[j[E].identifier])&&(Xu(v),A("end",v,j[E]))}function m(v,j,k,E,A,M){var B=s.copy(),D=en(M||k,j),L,V,N;if((N=n.call(v,new sf("beforestart",{sourceEvent:k,target:h,identifier:A,active:i,x:D[0],y:D[1],dx:0,dy:0,dispatch:B}),E))!=null)return L=N.x-D[0]||0,V=N.y-D[1]||0,function O(C,z,T){var R=D,Y;switch(C){case"start":a[A]=O,Y=i++;break;case"end":delete a[A],--i;case"drag":D=en(T||z,j),Y=i;break}B.call(C,v,new sf(C,{sourceEvent:z,subject:N,target:h,identifier:A,active:Y,x:D[0]+L,y:D[1]+V,dx:D[0]-R[0],dy:D[1]-R[1],dispatch:B}),E)}}return h.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Rr(!!v),h):e},h.container=function(v){return arguments.length?(t=typeof v=="function"?v:Rr(v),h):t},h.subject=function(v){return arguments.length?(n=typeof v=="function"?v:Rr(v),h):n},h.touchable=function(v){return arguments.length?(l=typeof v=="function"?v:Rr(!!v),h):l},h.on=function(){var v=s.on.apply(s,arguments);return v===s?h:v},h.clickDistance=function(v){return arguments.length?(f=(v=+v)*v,h):Math.sqrt(f)},h}function Vh(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function bb(e,t){var n=Object.create(e.prototype);for(var l in t)n[l]=t[l];return n}function lr(){}var Ti=.7,ec=1/Ti,Ja="\\s*([+-]?\\d+)\\s*",Di="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Sn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yE=/^#([0-9a-f]{3,8})$/,vE=new RegExp(`^rgb\\(${Ja},${Ja},${Ja}\\)$`),bE=new RegExp(`^rgb\\(${Sn},${Sn},${Sn}\\)$`),wE=new RegExp(`^rgba\\(${Ja},${Ja},${Ja},${Di}\\)$`),SE=new RegExp(`^rgba\\(${Sn},${Sn},${Sn},${Di}\\)$`),NE=new RegExp(`^hsl\\(${Di},${Sn},${Sn}\\)$`),jE=new RegExp(`^hsla\\(${Di},${Sn},${Sn},${Di}\\)$`),gm={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};Vh(lr,ca,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:mm,formatHex:mm,formatHex8:kE,formatHsl:EE,formatRgb:xm,toString:xm});function mm(){return this.rgb().formatHex()}function kE(){return this.rgb().formatHex8()}function EE(){return wb(this).formatHsl()}function xm(){return this.rgb().formatRgb()}function ca(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=yE.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ym(t):n===3?new yt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Or(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Or(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=vE.exec(e))?new yt(t[1],t[2],t[3],1):(t=bE.exec(e))?new yt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=wE.exec(e))?Or(t[1],t[2],t[3],t[4]):(t=SE.exec(e))?Or(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=NE.exec(e))?wm(t[1],t[2]/100,t[3]/100,1):(t=jE.exec(e))?wm(t[1],t[2]/100,t[3]/100,t[4]):gm.hasOwnProperty(e)?ym(gm[e]):e==="transparent"?new yt(NaN,NaN,NaN,0):null}function ym(e){return new yt(e>>16&255,e>>8&255,e&255,1)}function Or(e,t,n,l){return l<=0&&(e=t=n=NaN),new yt(e,t,n,l)}function CE(e){return e instanceof lr||(e=ca(e)),e?(e=e.rgb(),new yt(e.r,e.g,e.b,e.opacity)):new yt}function rf(e,t,n,l){return arguments.length===1?CE(e):new yt(e,t,n,l??1)}function yt(e,t,n,l){this.r=+e,this.g=+t,this.b=+n,this.opacity=+l}Vh(yt,rf,bb(lr,{brighter(e){return e=e==null?ec:Math.pow(ec,e),new yt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ti:Math.pow(Ti,e),new yt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yt(ta(this.r),ta(this.g),ta(this.b),tc(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:vm,formatHex:vm,formatHex8:_E,formatRgb:bm,toString:bm}));function vm(){return`#${Kl(this.r)}${Kl(this.g)}${Kl(this.b)}`}function _E(){return`#${Kl(this.r)}${Kl(this.g)}${Kl(this.b)}${Kl((isNaN(this.opacity)?1:this.opacity)*255)}`}function bm(){const e=tc(this.opacity);return`${e===1?"rgb(":"rgba("}${ta(this.r)}, ${ta(this.g)}, ${ta(this.b)}${e===1?")":`, ${e})`}`}function tc(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ta(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Kl(e){return e=ta(e),(e<16?"0":"")+e.toString(16)}function wm(e,t,n,l){return l<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ln(e,t,n,l)}function wb(e){if(e instanceof ln)return new ln(e.h,e.s,e.l,e.opacity);if(e instanceof lr||(e=ca(e)),!e)return new ln;if(e instanceof ln)return e;e=e.rgb();var t=e.r/255,n=e.g/255,l=e.b/255,a=Math.min(t,n,l),s=Math.max(t,n,l),i=NaN,r=s-a,c=(s+a)/2;return r?(t===s?i=(n-l)/r+(n<l)*6:n===s?i=(l-t)/r+2:i=(t-n)/r+4,r/=c<.5?s+a:2-s-a,i*=60):r=c>0&&c<1?0:i,new ln(i,r,c,e.opacity)}function ME(e,t,n,l){return arguments.length===1?wb(e):new ln(e,t,n,l??1)}function ln(e,t,n,l){this.h=+e,this.s=+t,this.l=+n,this.opacity=+l}Vh(ln,ME,bb(lr,{brighter(e){return e=e==null?ec:Math.pow(ec,e),new ln(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ti:Math.pow(Ti,e),new ln(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,l=n+(n<.5?n:1-n)*t,a=2*n-l;return new yt(Gu(e>=240?e-240:e+120,a,l),Gu(e,a,l),Gu(e<120?e+240:e-120,a,l),this.opacity)},clamp(){return new ln(Sm(this.h),Hr(this.s),Hr(this.l),tc(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=tc(this.opacity);return`${e===1?"hsl(":"hsla("}${Sm(this.h)}, ${Hr(this.s)*100}%, ${Hr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Sm(e){return e=(e||0)%360,e<0?e+360:e}function Hr(e){return Math.max(0,Math.min(1,e||0))}function Gu(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Xh=e=>()=>e;function AE(e,t){return function(n){return e+n*t}}function TE(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(l){return Math.pow(e+l*t,n)}}function DE(e){return(e=+e)==1?Sb:function(t,n){return n-t?TE(t,n,e):Xh(isNaN(t)?n:t)}}function Sb(e,t){var n=t-e;return n?AE(e,n):Xh(isNaN(e)?t:e)}const nc=function e(t){var n=DE(t);function l(a,s){var i=n((a=rf(a)).r,(s=rf(s)).r),r=n(a.g,s.g),c=n(a.b,s.b),u=Sb(a.opacity,s.opacity);return function(d){return a.r=i(d),a.g=r(d),a.b=c(d),a.opacity=u(d),a+""}}return l.gamma=e,l}(1);function zE(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,l=t.slice(),a;return function(s){for(a=0;a<n;++a)l[a]=e[a]*(1-s)+t[a]*s;return l}}function RE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function OE(e,t){var n=t?t.length:0,l=e?Math.min(n,e.length):0,a=new Array(l),s=new Array(n),i;for(i=0;i<l;++i)a[i]=fi(e[i],t[i]);for(;i<n;++i)s[i]=t[i];return function(r){for(i=0;i<l;++i)s[i]=a[i](r);return s}}function HE(e,t){var n=new Date;return e=+e,t=+t,function(l){return n.setTime(e*(1-l)+t*l),n}}function xn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function LE(e,t){var n={},l={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?n[a]=fi(e[a],t[a]):l[a]=t[a];return function(s){for(a in n)l[a]=n[a](s);return l}}var of=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qu=new RegExp(of.source,"g");function BE(e){return function(){return e}}function $E(e){return function(t){return e(t)+""}}function Nb(e,t){var n=of.lastIndex=Qu.lastIndex=0,l,a,s,i=-1,r=[],c=[];for(e=e+"",t=t+"";(l=of.exec(e))&&(a=Qu.exec(t));)(s=a.index)>n&&(s=t.slice(n,s),r[i]?r[i]+=s:r[++i]=s),(l=l[0])===(a=a[0])?r[i]?r[i]+=a:r[++i]=a:(r[++i]=null,c.push({i,x:xn(l,a)})),n=Qu.lastIndex;return n<t.length&&(s=t.slice(n),r[i]?r[i]+=s:r[++i]=s),r.length<2?c[0]?$E(c[0].x):BE(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)r[(f=c[d]).i]=f.x(u);return r.join("")})}function fi(e,t){var n=typeof t,l;return t==null||n==="boolean"?Xh(t):(n==="number"?xn:n==="string"?(l=ca(t))?(t=l,nc):Nb:t instanceof ca?nc:t instanceof Date?HE:RE(t)?zE:Array.isArray(t)?OE:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?LE:xn)(e,t)}var Nm=180/Math.PI,cf={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function jb(e,t,n,l,a,s){var i,r,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*n+t*l)&&(n-=e*c,l-=t*c),(r=Math.sqrt(n*n+l*l))&&(n/=r,l/=r,c/=r),e*l<t*n&&(e=-e,t=-t,c=-c,i=-i),{translateX:a,translateY:s,rotate:Math.atan2(t,e)*Nm,skewX:Math.atan(c)*Nm,scaleX:i,scaleY:r}}var Lr;function UE(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?cf:jb(t.a,t.b,t.c,t.d,t.e,t.f)}function qE(e){return e==null||(Lr||(Lr=document.createElementNS("http://www.w3.org/2000/svg","g")),Lr.setAttribute("transform",e),!(e=Lr.transform.baseVal.consolidate()))?cf:(e=e.matrix,jb(e.a,e.b,e.c,e.d,e.e,e.f))}function kb(e,t,n,l){function a(u){return u.length?u.pop()+" ":""}function s(u,d,f,h,p,x){if(u!==f||d!==h){var S=p.push("translate(",null,t,null,n);x.push({i:S-4,x:xn(u,f)},{i:S-2,x:xn(d,h)})}else(f||h)&&p.push("translate("+f+t+h+n)}function i(u,d,f,h){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(a(f)+"rotate(",null,l)-2,x:xn(u,d)})):d&&f.push(a(f)+"rotate("+d+l)}function r(u,d,f,h){u!==d?h.push({i:f.push(a(f)+"skewX(",null,l)-2,x:xn(u,d)}):d&&f.push(a(f)+"skewX("+d+l)}function c(u,d,f,h,p,x){if(u!==f||d!==h){var S=p.push(a(p)+"scale(",null,",",null,")");x.push({i:S-4,x:xn(u,f)},{i:S-2,x:xn(d,h)})}else(f!==1||h!==1)&&p.push(a(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),s(u.translateX,u.translateY,d.translateX,d.translateY,f,h),i(u.rotate,d.rotate,f,h),r(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var x=-1,S=h.length,w;++x<S;)f[(w=h[x]).i]=w.x(p);return f.join("")}}}var YE=kb(UE,"px, ","px)","deg)"),VE=kb(qE,", ",")",")"),XE=1e-12;function jm(e){return((e=Math.exp(e))+1/e)/2}function GE(e){return((e=Math.exp(e))-1/e)/2}function QE(e){return((e=Math.exp(2*e))-1)/(e+1)}const co=function e(t,n,l){function a(s,i){var r=s[0],c=s[1],u=s[2],d=i[0],f=i[1],h=i[2],p=d-r,x=f-c,S=p*p+x*x,w,g;if(S<XE)g=Math.log(h/u)/t,w=function(E){return[r+E*p,c+E*x,u*Math.exp(t*E*g)]};else{var y=Math.sqrt(S),m=(h*h-u*u+l*S)/(2*u*n*y),v=(h*h-u*u-l*S)/(2*h*n*y),j=Math.log(Math.sqrt(m*m+1)-m),k=Math.log(Math.sqrt(v*v+1)-v);g=(k-j)/t,w=function(E){var A=E*g,M=jm(j),B=u/(n*y)*(M*QE(t*A+j)-GE(j));return[r+B*p,c+B*x,u*M/jm(t*A+j)]}}return w.duration=g*1e3*t/Math.SQRT2,w}return a.rho=function(s){var i=Math.max(.001,+s),r=i*i,c=r*r;return e(i,r,c)},a}(Math.SQRT2,2,4);var cs=0,Zs=0,$s=0,Eb=1e3,lc,Is,ac=0,ua=0,Bc=0,zi=typeof performance=="object"&&performance.now?performance:Date,Cb=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Gh(){return ua||(Cb(ZE),ua=zi.now()+Bc)}function ZE(){ua=0}function sc(){this._call=this._time=this._next=null}sc.prototype=_b.prototype={constructor:sc,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Gh():+n)+(t==null?0:+t),!this._next&&Is!==this&&(Is?Is._next=this:lc=this,Is=this),this._call=e,this._time=n,uf()},stop:function(){this._call&&(this._call=null,this._time=1/0,uf())}};function _b(e,t,n){var l=new sc;return l.restart(e,t,n),l}function IE(){Gh(),++cs;for(var e=lc,t;e;)(t=ua-e._time)>=0&&e._call.call(void 0,t),e=e._next;--cs}function km(){ua=(ac=zi.now())+Bc,cs=Zs=0;try{IE()}finally{cs=0,JE(),ua=0}}function KE(){var e=zi.now(),t=e-ac;t>Eb&&(Bc-=t,ac=e)}function JE(){for(var e,t=lc,n,l=1/0;t;)t._call?(l>t._time&&(l=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:lc=n);Is=e,uf(l)}function uf(e){if(!cs){Zs&&(Zs=clearTimeout(Zs));var t=e-ua;t>24?(e<1/0&&(Zs=setTimeout(km,e-zi.now()-Bc)),$s&&($s=clearInterval($s))):($s||(ac=zi.now(),$s=setInterval(KE,Eb)),cs=1,Cb(km))}}function Em(e,t,n){var l=new sc;return t=t==null?0:+t,l.restart(a=>{l.stop(),e(a+t)},t,n),l}var WE=Hc("start","end","cancel","interrupt"),FE=[],Mb=0,Cm=1,df=2,uo=3,_m=4,ff=5,fo=6;function $c(e,t,n,l,a,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;PE(e,n,{name:t,index:l,group:a,on:WE,tween:FE,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Mb})}function Qh(e,t){var n=un(e,t);if(n.state>Mb)throw new Error("too late; already scheduled");return n}function Cn(e,t){var n=un(e,t);if(n.state>uo)throw new Error("too late; already running");return n}function un(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function PE(e,t,n){var l=e.__transition,a;l[t]=n,n.timer=_b(s,0,n.time);function s(u){n.state=Cm,n.timer.restart(i,n.delay,n.time),n.delay<=u&&i(u-n.delay)}function i(u){var d,f,h,p;if(n.state!==Cm)return c();for(d in l)if(p=l[d],p.name===n.name){if(p.state===uo)return Em(i);p.state===_m?(p.state=fo,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete l[d]):+d<t&&(p.state=fo,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete l[d])}if(Em(function(){n.state===uo&&(n.state=_m,n.timer.restart(r,n.delay,n.time),r(u))}),n.state=df,n.on.call("start",e,e.__data__,n.index,n.group),n.state===df){for(n.state=uo,a=new Array(h=n.tween.length),d=0,f=-1;d<h;++d)(p=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(a[++f]=p);a.length=f+1}}function r(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=ff,1),f=-1,h=a.length;++f<h;)a[f].call(e,d);n.state===ff&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=fo,n.timer.stop(),delete l[t];for(var u in l)return;delete e.__transition}}function ho(e,t){var n=e.__transition,l,a,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((l=n[i]).name!==t){s=!1;continue}a=l.state>df&&l.state<ff,l.state=fo,l.timer.stop(),l.on.call(a?"interrupt":"cancel",e,e.__data__,l.index,l.group),delete n[i]}s&&delete e.__transition}}function eC(e){return this.each(function(){ho(this,e)})}function tC(e,t){var n,l;return function(){var a=Cn(this,e),s=a.tween;if(s!==n){l=n=s;for(var i=0,r=l.length;i<r;++i)if(l[i].name===t){l=l.slice(),l.splice(i,1);break}}a.tween=l}}function nC(e,t,n){var l,a;if(typeof n!="function")throw new Error;return function(){var s=Cn(this,e),i=s.tween;if(i!==l){a=(l=i).slice();for(var r={name:t,value:n},c=0,u=a.length;c<u;++c)if(a[c].name===t){a[c]=r;break}c===u&&a.push(r)}s.tween=a}}function lC(e,t){var n=this._id;if(e+="",arguments.length<2){for(var l=un(this.node(),n).tween,a=0,s=l.length,i;a<s;++a)if((i=l[a]).name===e)return i.value;return null}return this.each((t==null?tC:nC)(n,e,t))}function Zh(e,t,n){var l=e._id;return e.each(function(){var a=Cn(this,l);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return un(a,l).value[t]}}function Ab(e,t){var n;return(typeof t=="number"?xn:t instanceof ca?nc:(n=ca(t))?(t=n,nc):Nb)(e,t)}function aC(e){return function(){this.removeAttribute(e)}}function sC(e){return function(){this.removeAttributeNS(e.space,e.local)}}function iC(e,t,n){var l,a=n+"",s;return function(){var i=this.getAttribute(e);return i===a?null:i===l?s:s=t(l=i,n)}}function rC(e,t,n){var l,a=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===a?null:i===l?s:s=t(l=i,n)}}function oC(e,t,n){var l,a,s;return function(){var i,r=n(this),c;return r==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=r+"",i===c?null:i===l&&c===a?s:(a=c,s=t(l=i,r)))}}function cC(e,t,n){var l,a,s;return function(){var i,r=n(this),c;return r==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=r+"",i===c?null:i===l&&c===a?s:(a=c,s=t(l=i,r)))}}function uC(e,t){var n=Lc(e),l=n==="transform"?VE:Ab;return this.attrTween(e,typeof t=="function"?(n.local?cC:oC)(n,l,Zh(this,"attr."+e,t)):t==null?(n.local?sC:aC)(n):(n.local?rC:iC)(n,l,t))}function dC(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function fC(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function hC(e,t){var n,l;function a(){var s=t.apply(this,arguments);return s!==l&&(n=(l=s)&&fC(e,s)),n}return a._value=t,a}function pC(e,t){var n,l;function a(){var s=t.apply(this,arguments);return s!==l&&(n=(l=s)&&dC(e,s)),n}return a._value=t,a}function gC(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var l=Lc(e);return this.tween(n,(l.local?hC:pC)(l,t))}function mC(e,t){return function(){Qh(this,e).delay=+t.apply(this,arguments)}}function xC(e,t){return t=+t,function(){Qh(this,e).delay=t}}function yC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?mC:xC)(t,e)):un(this.node(),t).delay}function vC(e,t){return function(){Cn(this,e).duration=+t.apply(this,arguments)}}function bC(e,t){return t=+t,function(){Cn(this,e).duration=t}}function wC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vC:bC)(t,e)):un(this.node(),t).duration}function SC(e,t){if(typeof t!="function")throw new Error;return function(){Cn(this,e).ease=t}}function NC(e){var t=this._id;return arguments.length?this.each(SC(t,e)):un(this.node(),t).ease}function jC(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Cn(this,e).ease=n}}function kC(e){if(typeof e!="function")throw new Error;return this.each(jC(this._id,e))}function EC(e){typeof e!="function"&&(e=rb(e));for(var t=this._groups,n=t.length,l=new Array(n),a=0;a<n;++a)for(var s=t[a],i=s.length,r=l[a]=[],c,u=0;u<i;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&r.push(c);return new Wn(l,this._parents,this._name,this._id)}function CC(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,l=t.length,a=n.length,s=Math.min(l,a),i=new Array(l),r=0;r<s;++r)for(var c=t[r],u=n[r],d=c.length,f=i[r]=new Array(d),h,p=0;p<d;++p)(h=c[p]||u[p])&&(f[p]=h);for(;r<l;++r)i[r]=t[r];return new Wn(i,this._parents,this._name,this._id)}function _C(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function MC(e,t,n){var l,a,s=_C(t)?Qh:Cn;return function(){var i=s(this,e),r=i.on;r!==l&&(a=(l=r).copy()).on(t,n),i.on=a}}function AC(e,t){var n=this._id;return arguments.length<2?un(this.node(),n).on.on(e):this.each(MC(n,e,t))}function TC(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function DC(){return this.on("end.remove",TC(this._id))}function zC(e){var t=this._name,n=this._id;typeof e!="function"&&(e=qh(e));for(var l=this._groups,a=l.length,s=new Array(a),i=0;i<a;++i)for(var r=l[i],c=r.length,u=s[i]=new Array(c),d,f,h=0;h<c;++h)(d=r[h])&&(f=e.call(d,d.__data__,h,r))&&("__data__"in d&&(f.__data__=d.__data__),u[h]=f,$c(u[h],t,n,h,u,un(d,n)));return new Wn(s,this._parents,t,n)}function RC(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ib(e));for(var l=this._groups,a=l.length,s=[],i=[],r=0;r<a;++r)for(var c=l[r],u=c.length,d,f=0;f<u;++f)if(d=c[f]){for(var h=e.call(d,d.__data__,f,c),p,x=un(d,n),S=0,w=h.length;S<w;++S)(p=h[S])&&$c(p,t,n,S,h,x);s.push(h),i.push(d)}return new Wn(s,i,t,n)}var OC=nr.prototype.constructor;function HC(){return new OC(this._groups,this._parents)}function LC(e,t){var n,l,a;return function(){var s=os(this,e),i=(this.style.removeProperty(e),os(this,e));return s===i?null:s===n&&i===l?a:a=t(n=s,l=i)}}function Tb(e){return function(){this.style.removeProperty(e)}}function BC(e,t,n){var l,a=n+"",s;return function(){var i=os(this,e);return i===a?null:i===l?s:s=t(l=i,n)}}function $C(e,t,n){var l,a,s;return function(){var i=os(this,e),r=n(this),c=r+"";return r==null&&(c=r=(this.style.removeProperty(e),os(this,e))),i===c?null:i===l&&c===a?s:(a=c,s=t(l=i,r))}}function UC(e,t){var n,l,a,s="style."+t,i="end."+s,r;return function(){var c=Cn(this,e),u=c.on,d=c.value[s]==null?r||(r=Tb(t)):void 0;(u!==n||a!==d)&&(l=(n=u).copy()).on(i,a=d),c.on=l}}function qC(e,t,n){var l=(e+="")=="transform"?YE:Ab;return t==null?this.styleTween(e,LC(e,l)).on("end.style."+e,Tb(e)):typeof t=="function"?this.styleTween(e,$C(e,l,Zh(this,"style."+e,t))).each(UC(this._id,e)):this.styleTween(e,BC(e,l,t),n).on("end.style."+e,null)}function YC(e,t,n){return function(l){this.style.setProperty(e,t.call(this,l),n)}}function VC(e,t,n){var l,a;function s(){var i=t.apply(this,arguments);return i!==a&&(l=(a=i)&&YC(e,i,n)),l}return s._value=t,s}function XC(e,t,n){var l="style."+(e+="");if(arguments.length<2)return(l=this.tween(l))&&l._value;if(t==null)return this.tween(l,null);if(typeof t!="function")throw new Error;return this.tween(l,VC(e,t,n??""))}function GC(e){return function(){this.textContent=e}}function QC(e){return function(){var t=e(this);this.textContent=t??""}}function ZC(e){return this.tween("text",typeof e=="function"?QC(Zh(this,"text",e)):GC(e==null?"":e+""))}function IC(e){return function(t){this.textContent=e.call(this,t)}}function KC(e){var t,n;function l(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&IC(a)),t}return l._value=e,l}function JC(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,KC(e))}function WC(){for(var e=this._name,t=this._id,n=Db(),l=this._groups,a=l.length,s=0;s<a;++s)for(var i=l[s],r=i.length,c,u=0;u<r;++u)if(c=i[u]){var d=un(c,t);$c(c,e,n,u,i,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Wn(l,this._parents,e,n)}function FC(){var e,t,n=this,l=n._id,a=n.size();return new Promise(function(s,i){var r={value:i},c={value:function(){--a===0&&s()}};n.each(function(){var u=Cn(this,l),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(r),t._.interrupt.push(r),t._.end.push(c)),u.on=t}),a===0&&s()})}var PC=0;function Wn(e,t,n,l){this._groups=e,this._parents=t,this._name=n,this._id=l}function Db(){return++PC}var Rn=nr.prototype;Wn.prototype={constructor:Wn,select:zC,selectAll:RC,selectChild:Rn.selectChild,selectChildren:Rn.selectChildren,filter:EC,merge:CC,selection:HC,transition:WC,call:Rn.call,nodes:Rn.nodes,node:Rn.node,size:Rn.size,empty:Rn.empty,each:Rn.each,on:AC,attr:uC,attrTween:gC,style:qC,styleTween:XC,text:ZC,textTween:JC,remove:DC,tween:lC,delay:yC,duration:wC,ease:NC,easeVarying:kC,end:FC,[Symbol.iterator]:Rn[Symbol.iterator]};function e4(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var t4={time:null,delay:0,duration:250,ease:e4};function n4(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function l4(e){var t,n;e instanceof Wn?(t=e._id,e=e._name):(t=Db(),(n=t4).time=Gh(),e=e==null?null:e+"");for(var l=this._groups,a=l.length,s=0;s<a;++s)for(var i=l[s],r=i.length,c,u=0;u<r;++u)(c=i[u])&&$c(c,e,t,u,i,n||n4(c,t));return new Wn(l,this._parents,e,t)}nr.prototype.interrupt=eC;nr.prototype.transition=l4;const Br=e=>()=>e;function a4(e,{sourceEvent:t,target:n,transform:l,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:l,enumerable:!0,configurable:!0},_:{value:a}})}function qn(e,t,n){this.k=e,this.x=t,this.y=n}qn.prototype={constructor:qn,scale:function(e){return e===1?this:new qn(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new qn(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Uc=new qn(1,0,0);zb.prototype=qn.prototype;function zb(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Uc;return e.__zoom}function Zu(e){e.stopImmediatePropagation()}function Us(e){e.preventDefault(),e.stopImmediatePropagation()}function s4(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function i4(){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 Mm(){return this.__zoom||Uc}function r4(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function o4(){return navigator.maxTouchPoints||"ontouchstart"in this}function c4(e,t,n){var l=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(a>l?(l+a)/2:Math.min(0,l)||Math.max(0,a),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function Rb(){var e=s4,t=i4,n=c4,l=r4,a=o4,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],r=250,c=co,u=Hc("start","zoom","end"),d,f,h,p=500,x=150,S=0,w=10;function g(N){N.property("__zoom",Mm).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",B).filter(a).on("touchstart.zoom",D).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(N,O,C,z){var T=N.selection?N.selection():N;T.property("__zoom",Mm),N!==T?j(N,O,C,z):T.interrupt().each(function(){k(this,arguments).event(z).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},g.scaleBy=function(N,O,C,z){g.scaleTo(N,function(){var T=this.__zoom.k,R=typeof O=="function"?O.apply(this,arguments):O;return T*R},C,z)},g.scaleTo=function(N,O,C,z){g.transform(N,function(){var T=t.apply(this,arguments),R=this.__zoom,Y=C==null?v(T):typeof C=="function"?C.apply(this,arguments):C,X=R.invert(Y),H=typeof O=="function"?O.apply(this,arguments):O;return n(m(y(R,H),Y,X),T,i)},C,z)},g.translateBy=function(N,O,C,z){g.transform(N,function(){return n(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),i)},null,z)},g.translateTo=function(N,O,C,z,T){g.transform(N,function(){var R=t.apply(this,arguments),Y=this.__zoom,X=z==null?v(R):typeof z=="function"?z.apply(this,arguments):z;return n(Uc.translate(X[0],X[1]).scale(Y.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof C=="function"?-C.apply(this,arguments):-C),R,i)},z,T)};function y(N,O){return O=Math.max(s[0],Math.min(s[1],O)),O===N.k?N:new qn(O,N.x,N.y)}function m(N,O,C){var z=O[0]-C[0]*N.k,T=O[1]-C[1]*N.k;return z===N.x&&T===N.y?N:new qn(N.k,z,T)}function v(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function j(N,O,C,z){N.on("start.zoom",function(){k(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(z).end()}).tween("zoom",function(){var T=this,R=arguments,Y=k(T,R).event(z),X=t.apply(T,R),H=C==null?v(X):typeof C=="function"?C.apply(T,R):C,U=Math.max(X[1][0]-X[0][0],X[1][1]-X[0][1]),_=T.__zoom,$=typeof O=="function"?O.apply(T,R):O,G=c(_.invert(H).concat(U/_.k),$.invert(H).concat(U/$.k));return function(q){if(q===1)q=$;else{var Q=G(q),K=U/Q[2];q=new qn(K,H[0]-Q[0]*K,H[1]-Q[1]*K)}Y.zoom(null,q)}})}function k(N,O,C){return!C&&N.__zooming||new E(N,O)}function E(N,O){this.that=N,this.args=O,this.active=0,this.sourceEvent=null,this.extent=t.apply(N,O),this.taps=0}E.prototype={event:function(N){return N&&(this.sourceEvent=N),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(N,O){return this.mouse&&N!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&N!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&N!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(N){var O=Et(this.that).datum();u.call(N,this.that,new a4(N,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),O)}};function A(N,...O){if(!e.apply(this,arguments))return;var C=k(this,O).event(N),z=this.__zoom,T=Math.max(s[0],Math.min(s[1],z.k*Math.pow(2,l.apply(this,arguments)))),R=en(N);if(C.wheel)(C.mouse[0][0]!==R[0]||C.mouse[0][1]!==R[1])&&(C.mouse[1]=z.invert(C.mouse[0]=R)),clearTimeout(C.wheel);else{if(z.k===T)return;C.mouse=[R,z.invert(R)],ho(this),C.start()}Us(N),C.wheel=setTimeout(Y,x),C.zoom("mouse",n(m(y(z,T),C.mouse[0],C.mouse[1]),C.extent,i));function Y(){C.wheel=null,C.end()}}function M(N,...O){if(h||!e.apply(this,arguments))return;var C=N.currentTarget,z=k(this,O,!0).event(N),T=Et(N.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",U,!0),R=en(N,C),Y=N.clientX,X=N.clientY;xb(N.view),Zu(N),z.mouse=[R,this.__zoom.invert(R)],ho(this),z.start();function H(_){if(Us(_),!z.moved){var $=_.clientX-Y,G=_.clientY-X;z.moved=$*$+G*G>S}z.event(_).zoom("mouse",n(m(z.that.__zoom,z.mouse[0]=en(_,C),z.mouse[1]),z.extent,i))}function U(_){T.on("mousemove.zoom mouseup.zoom",null),yb(_.view,z.moved),Us(_),z.event(_).end()}}function B(N,...O){if(e.apply(this,arguments)){var C=this.__zoom,z=en(N.changedTouches?N.changedTouches[0]:N,this),T=C.invert(z),R=C.k*(N.shiftKey?.5:2),Y=n(m(y(C,R),z,T),t.apply(this,O),i);Us(N),r>0?Et(this).transition().duration(r).call(j,Y,z,N):Et(this).call(g.transform,Y,z,N)}}function D(N,...O){if(e.apply(this,arguments)){var C=N.touches,z=C.length,T=k(this,O,N.changedTouches.length===z).event(N),R,Y,X,H;for(Zu(N),Y=0;Y<z;++Y)X=C[Y],H=en(X,this),H=[H,this.__zoom.invert(H),X.identifier],T.touch0?!T.touch1&&T.touch0[2]!==H[2]&&(T.touch1=H,T.taps=0):(T.touch0=H,R=!0,T.taps=1+!!d);d&&(d=clearTimeout(d)),R&&(T.taps<2&&(f=H[0],d=setTimeout(function(){d=null},p)),ho(this),T.start())}}function L(N,...O){if(this.__zooming){var C=k(this,O).event(N),z=N.changedTouches,T=z.length,R,Y,X,H;for(Us(N),R=0;R<T;++R)Y=z[R],X=en(Y,this),C.touch0&&C.touch0[2]===Y.identifier?C.touch0[0]=X:C.touch1&&C.touch1[2]===Y.identifier&&(C.touch1[0]=X);if(Y=C.that.__zoom,C.touch1){var U=C.touch0[0],_=C.touch0[1],$=C.touch1[0],G=C.touch1[1],q=(q=$[0]-U[0])*q+(q=$[1]-U[1])*q,Q=(Q=G[0]-_[0])*Q+(Q=G[1]-_[1])*Q;Y=y(Y,Math.sqrt(q/Q)),X=[(U[0]+$[0])/2,(U[1]+$[1])/2],H=[(_[0]+G[0])/2,(_[1]+G[1])/2]}else if(C.touch0)X=C.touch0[0],H=C.touch0[1];else return;C.zoom("touch",n(m(Y,X,H),C.extent,i))}}function V(N,...O){if(this.__zooming){var C=k(this,O).event(N),z=N.changedTouches,T=z.length,R,Y;for(Zu(N),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),R=0;R<T;++R)Y=z[R],C.touch0&&C.touch0[2]===Y.identifier?delete C.touch0:C.touch1&&C.touch1[2]===Y.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(Y=en(Y,this),Math.hypot(f[0]-Y[0],f[1]-Y[1])<w)){var X=Et(this).on("dblclick.zoom");X&&X.apply(this,arguments)}}}return g.wheelDelta=function(N){return arguments.length?(l=typeof N=="function"?N:Br(+N),g):l},g.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Br(!!N),g):e},g.touchable=function(N){return arguments.length?(a=typeof N=="function"?N:Br(!!N),g):a},g.extent=function(N){return arguments.length?(t=typeof N=="function"?N:Br([[+N[0][0],+N[0][1]],[+N[1][0],+N[1][1]]]),g):t},g.scaleExtent=function(N){return arguments.length?(s[0]=+N[0],s[1]=+N[1],g):[s[0],s[1]]},g.translateExtent=function(N){return arguments.length?(i[0][0]=+N[0][0],i[1][0]=+N[1][0],i[0][1]=+N[0][1],i[1][1]=+N[1][1],g):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},g.constrain=function(N){return arguments.length?(n=N,g):n},g.duration=function(N){return arguments.length?(r=+N,g):r},g.interpolate=function(N){return arguments.length?(c=N,g):c},g.on=function(){var N=u.on.apply(u,arguments);return N===u?g:N},g.clickDistance=function(N){return arguments.length?(S=(N=+N)*N,g):Math.sqrt(S)},g.tapDistance=function(N){return arguments.length?(w=+N,g):w},g}const Nn={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,{id:t,sourceHandle:n,targetHandle:l})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:l}", edge id: ${t}.`,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.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Ri=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ob=["Enter"," ","Escape"],Hb={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var us;(function(e){e.Strict="strict",e.Loose="loose"})(us||(us={}));var na;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(na||(na={}));var Oi;(function(e){e.Partial="partial",e.Full="full"})(Oi||(Oi={}));const Lb={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var gl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(gl||(gl={}));var ic;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ic||(ic={}));var ee;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ee||(ee={}));const Am={[ee.Left]:ee.Right,[ee.Right]:ee.Left,[ee.Top]:ee.Bottom,[ee.Bottom]:ee.Top};function Bb(e){return e===null?null:e?"valid":"invalid"}const $b=e=>"id"in e&&"source"in e&&"target"in e,u4=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Ih=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ar=(e,t=[0,0])=>{const{width:n,height:l}=Pn(e),a=e.origin??t,s=n*a[0],i=l*a[1];return{x:e.position.x-s,y:e.position.y-i}},d4=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((l,a)=>{const s=typeof a=="string";let i=!t.nodeLookup&&!s?a:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(a):Ih(a)?a:t.nodeLookup.get(a.id));const r=i?rc(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return qc(l,r)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Yc(n)},sr=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},l=!1;return e.forEach(a=>{(t.filter===void 0||t.filter(a))&&(n=qc(n,rc(a)),l=!0)}),l?Yc(n):{x:0,y:0,width:0,height:0}},Kh=(e,t,[n,l,a]=[0,0,1],s=!1,i=!1)=>{const r={...rr(t,[n,l,a]),width:t.width/a,height:t.height/a},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(i&&!f||h)continue;const p=d.width??u.width??u.initialWidth??null,x=d.height??u.height??u.initialHeight??null,S=Hi(r,fs(u)),w=(p??0)*(x??0),g=s&&S>0;(!u.internals.handleBounds||g||S>=w||u.dragging)&&c.push(u)}return c},f4=(e,t)=>{const n=new Set;return e.forEach(l=>{n.add(l.id)}),t.filter(l=>n.has(l.source)||n.has(l.target))};function h4(e,t){const n=new Map,l=t!=null&&t.nodes?new Set(t.nodes.map(a=>a.id)):null;return e.forEach(a=>{a.measured.width&&a.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!a.hidden)&&(!l||l.has(a.id))&&n.set(a.id,a)}),n}async function p4({nodes:e,width:t,height:n,panZoom:l,minZoom:a,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const r=h4(e,i),c=sr(r),u=Jh(c,t,n,(i==null?void 0:i.minZoom)??a,(i==null?void 0:i.maxZoom)??s,(i==null?void 0:i.padding)??.1);return await l.setViewport(u,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)}function Ub({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:l=[0,0],nodeExtent:a,onError:s}){const i=n.get(e),r=i.parentId?n.get(i.parentId):void 0,{x:c,y:u}=r?r.internals.positionAbsolute:{x:0,y:0},d=i.origin??l;let f=i.extent||a;if(i.extent==="parent"&&!i.expandParent)if(!r)s==null||s("005",Nn.error005());else{const p=r.measured.width,x=r.measured.height;p&&x&&(f=[[c,u],[c+p,u+x]])}else r&&hs(i.extent)&&(f=[[i.extent[0][0]+c,i.extent[0][1]+u],[i.extent[1][0]+c,i.extent[1][1]+u]]);const h=hs(f)?da(t,f,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&(s==null||s("015",Nn.error015())),{position:{x:h.x-c+(i.measured.width??0)*d[0],y:h.y-u+(i.measured.height??0)*d[1]},positionAbsolute:h}}async function g4({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:l,onBeforeDelete:a}){const s=new Set(e.map(h=>h.id)),i=[];for(const h of n){if(h.deletable===!1)continue;const p=s.has(h.id),x=!p&&h.parentId&&i.find(S=>S.id===h.parentId);(p||x)&&i.push(h)}const r=new Set(t.map(h=>h.id)),c=l.filter(h=>h.deletable!==!1),d=f4(i,c);for(const h of c)r.has(h.id)&&!d.find(x=>x.id===h.id)&&d.push(h);if(!a)return{edges:d,nodes:i};const f=await a({nodes:i,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:i}:{edges:[],nodes:[]}:f}const ds=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),da=(e={x:0,y:0},t,n)=>({x:ds(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:ds(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function qb(e,t,n){const{width:l,height:a}=Pn(n),{x:s,y:i}=n.internals.positionAbsolute;return da(e,[[s,i],[s+l,i+a]],t)}const Tm=(e,t,n)=>e<t?ds(Math.abs(e-t),1,t)/t:e>n?-ds(Math.abs(e-n),1,t)/t:0,Yb=(e,t,n=15,l=40)=>{const a=Tm(e.x,l,t.width-l)*n,s=Tm(e.y,l,t.height-l)*n;return[a,s]},qc=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),hf=({x:e,y:t,width:n,height:l})=>({x:e,y:t,x2:e+n,y2:t+l}),Yc=({x:e,y:t,x2:n,y2:l})=>({x:e,y:t,width:n-e,height:l-t}),fs=(e,t=[0,0])=>{var a,s;const{x:n,y:l}=Ih(e)?e.internals.positionAbsolute:ar(e,t);return{x:n,y:l,width:((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},rc=(e,t=[0,0])=>{var a,s;const{x:n,y:l}=Ih(e)?e.internals.positionAbsolute:ar(e,t);return{x:n,y:l,x2:n+(((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0),y2:l+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},Vb=(e,t)=>Yc(qc(hf(e),hf(t))),Hi=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),l=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*l)},Dm=e=>an(e.width)&&an(e.height)&&an(e.x)&&an(e.y),an=e=>!isNaN(e)&&isFinite(e),m4=(e,t)=>{},ir=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),rr=({x:e,y:t},[n,l,a],s=!1,i=[1,1])=>{const r={x:(e-n)/a,y:(t-l)/a};return s?ir(r,i):r},oc=({x:e,y:t},[n,l,a])=>({x:e*a+n,y:t*a+l});function Sa(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function x4(e,t,n){if(typeof e=="string"||typeof e=="number"){const l=Sa(e,n),a=Sa(e,t);return{top:l,right:a,bottom:l,left:a,x:a*2,y:l*2}}if(typeof e=="object"){const l=Sa(e.top??e.y??0,n),a=Sa(e.bottom??e.y??0,n),s=Sa(e.left??e.x??0,t),i=Sa(e.right??e.x??0,t);return{top:l,right:i,bottom:a,left:s,x:s+i,y:l+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function y4(e,t,n,l,a,s){const{x:i,y:r}=oc(e,[t,n,l]),{x:c,y:u}=oc({x:e.x+e.width,y:e.y+e.height},[t,n,l]),d=a-c,f=s-u;return{left:Math.floor(i),top:Math.floor(r),right:Math.floor(d),bottom:Math.floor(f)}}const Jh=(e,t,n,l,a,s)=>{const i=x4(s,t,n),r=(t-i.x)/e.width,c=(n-i.y)/e.height,u=Math.min(r,c),d=ds(u,l,a),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,x=n/2-h*d,S=y4(e,p,x,d,t,n),w={left:Math.min(S.left-i.left,0),top:Math.min(S.top-i.top,0),right:Math.min(S.right-i.right,0),bottom:Math.min(S.bottom-i.bottom,0)};return{x:p-w.left+w.right,y:x-w.top+w.bottom,zoom:d}},Li=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function hs(e){return e!=null&&e!=="parent"}function Pn(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Xb(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function Gb(e,t={width:0,height:0},n,l,a){const s={...e},i=l.get(n);if(i){const r=i.origin||a;s.x+=i.internals.positionAbsolute.x-(t.width??0)*r[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*r[1]}return s}function zm(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function v4(){let e,t;return{promise:new Promise((l,a)=>{e=l,t=a}),resolve:e,reject:t}}function b4(e){return{...Hb,...e||{}}}function hi(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:l,containerBounds:a}){const{x:s,y:i}=sn(e),r=rr({x:s-((a==null?void 0:a.left)??0),y:i-((a==null?void 0:a.top)??0)},l),{x:c,y:u}=n?ir(r,t):r;return{xSnapped:c,ySnapped:u,...r}}const Wh=e=>({width:e.offsetWidth,height:e.offsetHeight}),Qb=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},w4=["INPUT","SELECT","TEXTAREA"];function Zb(e){var l,a;const t=((a=(l=e.composedPath)==null?void 0:l.call(e))==null?void 0:a[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:w4.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Ib=e=>"clientX"in e,sn=(e,t)=>{var s,i;const n=Ib(e),l=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,a=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:l-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},Rm=(e,t,n,l,a)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const r=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:a,position:i.getAttribute("data-handlepos"),x:(r.left-n.left)/l,y:(r.top-n.top)/l,...Wh(i)}})};function Kb({sourceX:e,sourceY:t,targetX:n,targetY:l,sourceControlX:a,sourceControlY:s,targetControlX:i,targetControlY:r}){const c=e*.125+a*.375+i*.375+n*.125,u=t*.125+s*.375+r*.375+l*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function $r(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Om({pos:e,x1:t,y1:n,x2:l,y2:a,c:s}){switch(e){case ee.Left:return[t-$r(t-l,s),n];case ee.Right:return[t+$r(l-t,s),n];case ee.Top:return[t,n-$r(n-a,s)];case ee.Bottom:return[t,n+$r(a-n,s)]}}function Jb({sourceX:e,sourceY:t,sourcePosition:n=ee.Bottom,targetX:l,targetY:a,targetPosition:s=ee.Top,curvature:i=.25}){const[r,c]=Om({pos:n,x1:e,y1:t,x2:l,y2:a,c:i}),[u,d]=Om({pos:s,x1:l,y1:a,x2:e,y2:t,c:i}),[f,h,p,x]=Kb({sourceX:e,sourceY:t,targetX:l,targetY:a,sourceControlX:r,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${r},${c} ${u},${d} ${l},${a}`,f,h,p,x]}function Wb({sourceX:e,sourceY:t,targetX:n,targetY:l}){const a=Math.abs(n-e)/2,s=n<e?n+a:n-a,i=Math.abs(l-t)/2,r=l<t?l+i:l-i;return[s,r,a,i]}function S4({sourceNode:e,targetNode:t,selected:n=!1,zIndex:l=0,elevateOnSelect:a=!1,zIndexMode:s="basic"}){if(s==="manual")return l;const i=a&&n?l+1e3:l,r=Math.max(e.parentId||a&&e.selected?e.internals.z:0,t.parentId||a&&t.selected?t.internals.z:0);return i+r}function N4({sourceNode:e,targetNode:t,width:n,height:l,transform:a}){const s=qc(rc(e),rc(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-a[0]/a[2],y:-a[1]/a[2],width:n/a[2],height:l/a[2]};return Hi(i,Yc(s))>0}const j4=({source:e,sourceHandle:t,target:n,targetHandle:l})=>`xy-edge__${e}${t||""}-${n}${l||""}`,k4=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),E4=(e,t,n={})=>{if(!e.source||!e.target)return t;const l=n.getEdgeId||j4;let a;return $b(e)?a={...e}:a={...e,id:l(e)},k4(a,t)?t:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,t.concat(a))};function Fb({sourceX:e,sourceY:t,targetX:n,targetY:l}){const[a,s,i,r]=Wb({sourceX:e,sourceY:t,targetX:n,targetY:l});return[`M ${e},${t}L ${n},${l}`,a,s,i,r]}const Hm={[ee.Left]:{x:-1,y:0},[ee.Right]:{x:1,y:0},[ee.Top]:{x:0,y:-1},[ee.Bottom]:{x:0,y:1}},C4=({source:e,sourcePosition:t=ee.Bottom,target:n})=>t===ee.Left||t===ee.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Lm=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function _4({source:e,sourcePosition:t=ee.Bottom,target:n,targetPosition:l=ee.Top,center:a,offset:s,stepPosition:i}){const r=Hm[t],c=Hm[l],u={x:e.x+r.x*s,y:e.y+r.y*s},d={x:n.x+c.x*s,y:n.y+c.y*s},f=C4({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let x=[],S,w;const g={x:0,y:0},y={x:0,y:0},[,,m,v]=Wb({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(r[h]*c[h]===-1){h==="x"?(S=a.x??u.x+(d.x-u.x)*i,w=a.y??(u.y+d.y)/2):(S=a.x??(u.x+d.x)/2,w=a.y??u.y+(d.y-u.y)*i);const A=[{x:S,y:u.y},{x:S,y:d.y}],M=[{x:u.x,y:w},{x:d.x,y:w}];r[h]===p?x=h==="x"?A:M:x=h==="x"?M:A}else{const A=[{x:u.x,y:d.y}],M=[{x:d.x,y:u.y}];if(h==="x"?x=r.x===p?M:A:x=r.y===p?A:M,t===l){const N=Math.abs(e[h]-n[h]);if(N<=s){const O=Math.min(s-1,s-N);r[h]===p?g[h]=(u[h]>e[h]?-1:1)*O:y[h]=(d[h]>n[h]?-1:1)*O}}if(t!==l){const N=h==="x"?"y":"x",O=r[h]===c[N],C=u[N]>d[N],z=u[N]<d[N];(r[h]===1&&(!O&&C||O&&z)||r[h]!==1&&(!O&&z||O&&C))&&(x=h==="x"?A:M)}const B={x:u.x+g.x,y:u.y+g.y},D={x:d.x+y.x,y:d.y+y.y},L=Math.max(Math.abs(B.x-x[0].x),Math.abs(D.x-x[0].x)),V=Math.max(Math.abs(B.y-x[0].y),Math.abs(D.y-x[0].y));L>=V?(S=(B.x+D.x)/2,w=x[0].y):(S=x[0].x,w=(B.y+D.y)/2)}const j={x:u.x+g.x,y:u.y+g.y},k={x:d.x+y.x,y:d.y+y.y};return[[e,...j.x!==x[0].x||j.y!==x[0].y?[j]:[],...x,...k.x!==x[x.length-1].x||k.y!==x[x.length-1].y?[k]:[],n],S,w,m,v]}function M4(e,t,n,l){const a=Math.min(Lm(e,t)/2,Lm(t,n)/2,l),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${s+a*u},${i}Q ${s},${i} ${s},${i+a*d}`}const r=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${i+a*c}Q ${s},${i} ${s+a*r},${i}`}function pf({sourceX:e,sourceY:t,sourcePosition:n=ee.Bottom,targetX:l,targetY:a,targetPosition:s=ee.Top,borderRadius:i=5,centerX:r,centerY:c,offset:u=20,stepPosition:d=.5}){const[f,h,p,x,S]=_4({source:{x:e,y:t},sourcePosition:n,target:{x:l,y:a},targetPosition:s,center:{x:r,y:c},offset:u,stepPosition:d});let w=`M${f[0].x} ${f[0].y}`;for(let g=1;g<f.length-1;g++)w+=M4(f[g-1],f[g],f[g+1],i);return w+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[w,h,p,x,S]}function Bm(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function A4(e){var f;const{sourceNode:t,targetNode:n}=e;if(!Bm(t)||!Bm(n))return null;const l=t.internals.handleBounds||$m(t.handles),a=n.internals.handleBounds||$m(n.handles),s=Um((l==null?void 0:l.source)??[],e.sourceHandle),i=Um(e.connectionMode===us.Strict?(a==null?void 0:a.target)??[]:((a==null?void 0:a.target)??[]).concat((a==null?void 0:a.source)??[]),e.targetHandle);if(!s||!i)return(f=e.onError)==null||f.call(e,"008",Nn.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const r=(s==null?void 0:s.position)||ee.Bottom,c=(i==null?void 0:i.position)||ee.Top,u=fa(t,s,r),d=fa(n,i,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:r,targetPosition:c}}function $m(e){if(!e)return null;const t=[],n=[];for(const l of e)l.width=l.width??1,l.height=l.height??1,l.type==="source"?t.push(l):l.type==="target"&&n.push(l);return{source:t,target:n}}function fa(e,t,n=ee.Left,l=!1){const a=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,s=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:i,height:r}=t??Pn(e);if(l)return{x:a+i/2,y:s+r/2};switch((t==null?void 0:t.position)??n){case ee.Top:return{x:a+i/2,y:s};case ee.Right:return{x:a+i,y:s+r/2};case ee.Bottom:return{x:a+i/2,y:s+r};case ee.Left:return{x:a,y:s+r/2}}}function Um(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function gf(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(l=>`${l}=${e[l]}`).join("&")}`:""}function T4(e,{id:t,defaultColor:n,defaultMarkerStart:l,defaultMarkerEnd:a}){const s=new Set;return e.reduce((i,r)=>([r.markerStart||l,r.markerEnd||a].forEach(c=>{if(c&&typeof c=="object"){const u=gf(c,t);s.has(u)||(i.push({id:u,color:c.color||n,...c}),s.add(u))}}),i),[]).sort((i,r)=>i.id.localeCompare(r.id))}const Pb=1e3,D4=10,Fh={nodeOrigin:[0,0],nodeExtent:Ri,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},z4={...Fh,checkEquality:!0};function Ph(e,t){const n={...e};for(const l in t)t[l]!==void 0&&(n[l]=t[l]);return n}function R4(e,t,n){const l=Ph(Fh,n);for(const a of e.values())if(a.parentId)tp(a,e,t,l);else{const s=ar(a,l.nodeOrigin),i=hs(a.extent)?a.extent:l.nodeExtent,r=da(s,i,Pn(a));a.internals.positionAbsolute=r}}function O4(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],l=[];for(const a of e.handles){const s={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?n.push(s):a.type==="target"&&l.push(s)}return{source:n,target:l}}function ep(e){return e==="manual"}function mf(e,t,n,l={}){var d,f;const a=Ph(z4,l),s={i:0},i=new Map(t),r=a!=null&&a.elevateNodesOnSelect&&!ep(a.zIndexMode)?Pb:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=i.get(h.id);if(a.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const x=ar(h,a.nodeOrigin),S=hs(h.extent)?h.extent:a.nodeExtent,w=da(x,S,Pn(h));p={...a.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:w,handleBounds:O4(h,p),z:e1(h,r,a.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&tp(p,t,n,l,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function H4(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function tp(e,t,n,l,a){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:r,zIndexMode:c}=Ph(Fh,l),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}H4(e,n),a&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++a.i,d.internals.z=d.internals.z+a.i*D4),a&&d.internals.rootParentIndex!==void 0&&(a.i=d.internals.rootParentIndex);const f=s&&!ep(c)?Pb:0,{x:h,y:p,z:x}=L4(e,d,i,r,f,c),{positionAbsolute:S}=e.internals,w=h!==S.x||p!==S.y;(w||x!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:h,y:p}:S,z:x}})}function e1(e,t,n){const l=an(e.zIndex)?e.zIndex:0;return ep(n)?l:l+(e.selected?t:0)}function L4(e,t,n,l,a,s){const{x:i,y:r}=t.internals.positionAbsolute,c=Pn(e),u=ar(e,n),d=hs(e.extent)?da(u,e.extent,c):u;let f=da({x:i+d.x,y:r+d.y},l,c);e.extent==="parent"&&(f=qb(f,c,t));const h=e1(e,a,s),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function np(e,t,n,l=[0,0]){var i;const a=[],s=new Map;for(const r of e){const c=t.get(r.parentId);if(!c)continue;const u=((i=s.get(r.parentId))==null?void 0:i.expandedRect)??fs(c),d=Vb(u,r.rect);s.set(r.parentId,{expandedRect:d,parent:c})}return s.size>0&&s.forEach(({expandedRect:r,parent:c},u)=>{var m;const d=c.internals.positionAbsolute,f=Pn(c),h=c.origin??l,p=r.x<d.x?Math.round(Math.abs(d.x-r.x)):0,x=r.y<d.y?Math.round(Math.abs(d.y-r.y)):0,S=Math.max(f.width,Math.round(r.width)),w=Math.max(f.height,Math.round(r.height)),g=(S-f.width)*h[0],y=(w-f.height)*h[1];(p>0||x>0||g||y)&&(a.push({id:u,type:"position",position:{x:c.position.x-p+g,y:c.position.y-x+y}}),(m=n.get(u))==null||m.forEach(v=>{e.some(j=>j.id===v.id)||a.push({id:v.id,type:"position",position:{x:v.position.x+p,y:v.position.y+x}})})),(f.width<r.width||f.height<r.height||p||x)&&a.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:S+(p?h[0]*p-g:0),height:w+(x?h[1]*x-y:0)}})}),a}function B4(e,t,n,l,a,s,i){const r=l==null?void 0:l.querySelector(".xyflow__viewport");let c=!1;if(!r)return{changes:[],updatedInternals:c};const u=[],d=window.getComputedStyle(r),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=[];for(const p of e.values()){const x=t.get(p.id);if(!x)continue;if(x.hidden){t.set(x.id,{...x,internals:{...x.internals,handleBounds:void 0}}),c=!0;continue}const S=Wh(p.nodeElement),w=x.measured.width!==S.width||x.measured.height!==S.height;if(!!(S.width&&S.height&&(w||!x.internals.handleBounds||p.force))){const y=p.nodeElement.getBoundingClientRect(),m=hs(x.extent)?x.extent:s;let{positionAbsolute:v}=x.internals;x.parentId&&x.extent==="parent"?v=qb(v,S,t.get(x.parentId)):m&&(v=da(v,m,S));const j={...x,measured:S,internals:{...x.internals,positionAbsolute:v,handleBounds:{source:Rm("source",p.nodeElement,y,f,x.id),target:Rm("target",p.nodeElement,y,f,x.id)}}};t.set(x.id,j),x.parentId&&tp(j,t,n,{nodeOrigin:a,zIndexMode:i}),c=!0,w&&(u.push({id:x.id,type:"dimensions",dimensions:S}),x.expandParent&&x.parentId&&h.push({id:x.id,parentId:x.parentId,rect:fs(j,a)}))}}if(h.length>0){const p=np(h,t,n,a);u.push(...p)}return{changes:u,updatedInternals:c}}async function $4({delta:e,panZoom:t,transform:n,translateExtent:l,width:a,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[a,s]],l),r=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(r)}function qm(e,t,n,l,a,s){let i=a;const r=l.get(i)||new Map;l.set(i,r.set(n,t)),i=`${a}-${e}`;const c=l.get(i)||new Map;if(l.set(i,c.set(n,t)),s){i=`${a}-${e}-${s}`;const u=l.get(i)||new Map;l.set(i,u.set(n,t))}}function t1(e,t,n){e.clear(),t.clear();for(const l of n){const{source:a,target:s,sourceHandle:i=null,targetHandle:r=null}=l,c={edgeId:l.id,source:a,target:s,sourceHandle:i,targetHandle:r},u=`${a}-${i}--${s}-${r}`,d=`${s}-${r}--${a}-${i}`;qm("source",c,d,e,a,i),qm("target",c,u,e,s,r),t.set(l.id,l)}}function n1(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:n1(n,t):!1}function Ym(e,t,n){var a;let l=e;do{if((a=l==null?void 0:l.matches)!=null&&a.call(l,t))return!0;if(l===n)return!1;l=l==null?void 0:l.parentElement}while(l);return!1}function U4(e,t,n,l){const a=new Map;for(const[s,i]of e)if((i.selected||i.id===l)&&(!i.parentId||!n1(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const r=e.get(s);r&&a.set(s,{id:s,position:r.position||{x:0,y:0},distance:{x:n.x-r.internals.positionAbsolute.x,y:n.y-r.internals.positionAbsolute.y},extent:r.extent,parentId:r.parentId,origin:r.origin,expandParent:r.expandParent,internals:{positionAbsolute:r.internals.positionAbsolute||{x:0,y:0}},measured:{width:r.measured.width??0,height:r.measured.height??0}})}return a}function Iu({nodeId:e,dragItems:t,nodeLookup:n,dragging:l=!0}){var i,r,c;const a=[];for(const[u,d]of t){const f=(i=n.get(u))==null?void 0:i.internals.userNode;f&&a.push({...f,position:d.position,dragging:l})}if(!e)return[a[0],a];const s=(r=n.get(e))==null?void 0:r.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:l}:a[0],a]}function q4({dragItems:e,snapGrid:t,x:n,y:l}){const a=e.values().next().value;if(!a)return null;const s={x:n-a.distance.x,y:l-a.distance.y},i=ir(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Y4({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:l,onDragStop:a}){let s={x:null,y:null},i=0,r=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,x=!1,S=null;function w({noDragClassName:y,handleSelector:m,domNode:v,isSelectable:j,nodeId:k,nodeClickDistance:E=0}){h=Et(v);function A({x:L,y:V}){const{nodeLookup:N,nodeExtent:O,snapGrid:C,snapToGrid:z,nodeOrigin:T,onNodeDrag:R,onSelectionDrag:Y,onError:X,updateNodePositions:H}=t();s={x:L,y:V};let U=!1;const _=r.size>1,$=_&&O?hf(sr(r)):null,G=_&&z?q4({dragItems:r,snapGrid:C,x:L,y:V}):null;for(const[q,Q]of r){if(!N.has(q))continue;let K={x:L-Q.distance.x,y:V-Q.distance.y};z&&(K=G?{x:Math.round(K.x+G.x),y:Math.round(K.y+G.y)}:ir(K,C));let J=null;if(_&&O&&!Q.extent&&$){const{positionAbsolute:F}=Q.internals,le=F.x-$.x+O[0][0],ae=F.x+Q.measured.width-$.x2+O[1][0],te=F.y-$.y+O[0][1],ge=F.y+Q.measured.height-$.y2+O[1][1];J=[[le,te],[ae,ge]]}const{position:P,positionAbsolute:W}=Ub({nodeId:q,nextPosition:K,nodeLookup:N,nodeExtent:J||O,nodeOrigin:T,onError:X});U=U||Q.position.x!==P.x||Q.position.y!==P.y,Q.position=P,Q.internals.positionAbsolute=W}if(x=x||U,!!U&&(H(r,!0),S&&(l||R||!k&&Y))){const[q,Q]=Iu({nodeId:k,dragItems:r,nodeLookup:N});l==null||l(S,r,q,Q),R==null||R(S,q,Q),k||Y==null||Y(S,Q)}}async function M(){if(!d)return;const{transform:L,panBy:V,autoPanSpeed:N,autoPanOnNodeDrag:O}=t();if(!O){c=!1,cancelAnimationFrame(i);return}const[C,z]=Yb(u,d,N);(C!==0||z!==0)&&(s.x=(s.x??0)-C/L[2],s.y=(s.y??0)-z/L[2],await V({x:C,y:z})&&A(s)),i=requestAnimationFrame(M)}function B(L){var _;const{nodeLookup:V,multiSelectionActive:N,nodesDraggable:O,transform:C,snapGrid:z,snapToGrid:T,selectNodesOnDrag:R,onNodeDragStart:Y,onSelectionDragStart:X,unselectNodesAndEdges:H}=t();f=!0,(!R||!j)&&!N&&k&&((_=V.get(k))!=null&&_.selected||H()),j&&R&&k&&(e==null||e(k));const U=hi(L.sourceEvent,{transform:C,snapGrid:z,snapToGrid:T,containerBounds:d});if(s=U,r=U4(V,O,U,k),r.size>0&&(n||Y||!k&&X)){const[$,G]=Iu({nodeId:k,dragItems:r,nodeLookup:V});n==null||n(L.sourceEvent,r,$,G),Y==null||Y(L.sourceEvent,$,G),k||X==null||X(L.sourceEvent,G)}}const D=vb().clickDistance(E).on("start",L=>{const{domNode:V,nodeDragThreshold:N,transform:O,snapGrid:C,snapToGrid:z}=t();d=(V==null?void 0:V.getBoundingClientRect())||null,p=!1,x=!1,S=L.sourceEvent,N===0&&B(L),s=hi(L.sourceEvent,{transform:O,snapGrid:C,snapToGrid:z,containerBounds:d}),u=sn(L.sourceEvent,d)}).on("drag",L=>{const{autoPanOnNodeDrag:V,transform:N,snapGrid:O,snapToGrid:C,nodeDragThreshold:z,nodeLookup:T}=t(),R=hi(L.sourceEvent,{transform:N,snapGrid:O,snapToGrid:C,containerBounds:d});if(S=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||k&&!T.has(k))&&(p=!0),!p){if(!c&&V&&f&&(c=!0,M()),!f){const Y=sn(L.sourceEvent,d),X=Y.x-u.x,H=Y.y-u.y;Math.sqrt(X*X+H*H)>z&&B(L)}(s.x!==R.xSnapped||s.y!==R.ySnapped)&&r&&f&&(u=sn(L.sourceEvent,d),A(R))}}).on("end",L=>{if(!(!f||p)&&(c=!1,f=!1,cancelAnimationFrame(i),r.size>0)){const{nodeLookup:V,updateNodePositions:N,onNodeDragStop:O,onSelectionDragStop:C}=t();if(x&&(N(r,!1),x=!1),a||O||!k&&C){const[z,T]=Iu({nodeId:k,dragItems:r,nodeLookup:V,dragging:!1});a==null||a(L.sourceEvent,r,z,T),O==null||O(L.sourceEvent,z,T),k||C==null||C(L.sourceEvent,T)}}}).filter(L=>{const V=L.target;return!L.button&&(!y||!Ym(V,`.${y}`,v))&&(!m||Ym(V,m,v))});h.call(D)}function g(){h==null||h.on(".drag",null)}return{update:w,destroy:g}}function V4(e,t,n){const l=[],a={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())Hi(a,fs(s))>0&&l.push(s);return l}const X4=250;function G4(e,t,n,l){var r,c;let a=[],s=1/0;const i=V4(e,n,t+X4);for(const u of i){const d=[...((r=u.internals.handleBounds)==null?void 0:r.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(l.nodeId===f.nodeId&&l.type===f.type&&l.id===f.id)continue;const{x:h,y:p}=fa(u,f,f.position,!0),x=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));x>t||(x<s?(a=[{...f,x:h,y:p}],s=x):x===s&&a.push({...f,x:h,y:p}))}}if(!a.length)return null;if(a.length>1){const u=l.type==="source"?"target":"source";return a.find(d=>d.type===u)??a[0]}return a[0]}function l1(e,t,n,l,a,s=!1){var u,d,f;const i=l.get(e);if(!i)return null;const r=a==="strict"?(u=i.internals.handleBounds)==null?void 0:u[t]:[...((d=i.internals.handleBounds)==null?void 0:d.source)??[],...((f=i.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?r==null?void 0:r.find(h=>h.id===n):r==null?void 0:r[0])??null;return c&&s?{...c,...fa(i,c,c.position,!0)}:c}function a1(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Q4(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const s1=()=>!0;function Z4(e,{connectionMode:t,connectionRadius:n,handleId:l,nodeId:a,edgeUpdaterType:s,isTarget:i,domNode:r,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:x,onConnect:S,onConnectEnd:w,isValidConnection:g=s1,onReconnectEnd:y,updateConnection:m,getTransform:v,getFromHandle:j,autoPanSpeed:k,dragThreshold:E=1,handleDomNode:A}){const M=Qb(e.target);let B=0,D;const{x:L,y:V}=sn(e),N=a1(s,A),O=r==null?void 0:r.getBoundingClientRect();let C=!1;if(!O||!N)return;const z=l1(a,N,l,c,t);if(!z)return;let T=sn(e,O),R=!1,Y=null,X=!1,H=null;function U(){if(!d||!O)return;const[P,W]=Yb(T,O,k);h({x:P,y:W}),B=requestAnimationFrame(U)}const _={...z,nodeId:a,type:N,position:z.position},$=c.get(a);let q={inProgress:!0,isValid:null,from:fa($,_,ee.Left,!0),fromHandle:_,fromPosition:_.position,fromNode:$,to:T,toHandle:null,toPosition:Am[_.position],toNode:null,pointer:T};function Q(){C=!0,m(q),x==null||x(e,{nodeId:a,handleId:l,handleType:N})}E===0&&Q();function K(P){if(!C){const{x:ge,y:I}=sn(P),se=ge-L,Re=I-V;if(!(se*se+Re*Re>E*E))return;Q()}if(!j()||!_){J(P);return}const W=v();T=sn(P,O),D=G4(rr(T,W,!1,[1,1]),n,c,_),R||(U(),R=!0);const F=i1(P,{handle:D,connectionMode:t,fromNodeId:a,fromHandleId:l,fromType:i?"target":"source",isValidConnection:g,doc:M,lib:u,flowId:f,nodeLookup:c});H=F.handleDomNode,Y=F.connection,X=Q4(!!D,F.isValid);const le=c.get(a),ae=le?fa(le,_,ee.Left,!0):q.from,te={...q,from:ae,isValid:X,to:F.toHandle&&X?oc({x:F.toHandle.x,y:F.toHandle.y},W):T,toHandle:F.toHandle,toPosition:X&&F.toHandle?F.toHandle.position:Am[_.position],toNode:F.toHandle?c.get(F.toHandle.nodeId):null,pointer:T};m(te),q=te}function J(P){if(!("touches"in P&&P.touches.length>0)){if(C){(D||H)&&Y&&X&&(S==null||S(Y));const{inProgress:W,...F}=q,le={...F,toPosition:q.toHandle?q.toPosition:null};w==null||w(P,le),s&&(y==null||y(P,le))}p(),cancelAnimationFrame(B),R=!1,X=!1,Y=null,H=null,M.removeEventListener("mousemove",K),M.removeEventListener("mouseup",J),M.removeEventListener("touchmove",K),M.removeEventListener("touchend",J)}}M.addEventListener("mousemove",K),M.addEventListener("mouseup",J),M.addEventListener("touchmove",K),M.addEventListener("touchend",J)}function i1(e,{handle:t,connectionMode:n,fromNodeId:l,fromHandleId:a,fromType:s,doc:i,lib:r,flowId:c,isValidConnection:u=s1,nodeLookup:d}){const f=s==="target",h=t?i.querySelector(`.${r}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:x}=sn(e),S=i.elementFromPoint(p,x),w=S!=null&&S.classList.contains(`${r}-flow__handle`)?S:h,g={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const y=a1(void 0,w),m=w.getAttribute("data-nodeid"),v=w.getAttribute("data-handleid"),j=w.classList.contains("connectable"),k=w.classList.contains("connectableend");if(!m||!y)return g;const E={source:f?m:l,sourceHandle:f?v:a,target:f?l:m,targetHandle:f?a:v};g.connection=E;const M=j&&k&&(n===us.Strict?f&&y==="source"||!f&&y==="target":m!==l||v!==a);g.isValid=M&&u(E),g.toHandle=l1(m,y,v,d,n,!0)}return g}const xf={onPointerDown:Z4,isValid:i1};function I4({domNode:e,panZoom:t,getTransform:n,getViewScale:l}){const a=Et(e);function s({translateExtent:r,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const x=m=>{if(m.sourceEvent.type!=="wheel"||!t)return;const v=n(),j=m.sourceEvent.ctrlKey&&Li()?10:1,k=-m.sourceEvent.deltaY*(m.sourceEvent.deltaMode===1?.05:m.sourceEvent.deltaMode?1:.002)*d,E=v[2]*Math.pow(2,k*j);t.scaleTo(E)};let S=[0,0];const w=m=>{(m.sourceEvent.type==="mousedown"||m.sourceEvent.type==="touchstart")&&(S=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY])},g=m=>{const v=n();if(m.sourceEvent.type!=="mousemove"&&m.sourceEvent.type!=="touchmove"||!t)return;const j=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY],k=[j[0]-S[0],j[1]-S[1]];S=j;const E=l()*Math.max(v[2],Math.log(v[2]))*(p?-1:1),A={x:v[0]-k[0]*E,y:v[1]-k[1]*E},M=[[0,0],[c,u]];t.setViewportConstrained({x:A.x,y:A.y,zoom:v[2]},M,r)},y=Rb().on("start",w).on("zoom",f?g:null).on("zoom.wheel",h?x:null);a.call(y,{})}function i(){a.on("zoom",null)}return{update:s,destroy:i,pointer:en}}const Vc=e=>({x:e.x,y:e.y,zoom:e.k}),Ku=({x:e,y:t,zoom:n})=>Uc.translate(e,t).scale(n),$a=(e,t)=>e.target.closest(`.${t}`),r1=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),K4=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ju=(e,t=0,n=K4,l=()=>{})=>{const a=typeof t=="number"&&t>0;return a||l(),a?e.transition().duration(t).ease(n).on("end",l):e},o1=e=>{const t=e.ctrlKey&&Li()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function J4({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:l,panOnScrollMode:a,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:r,onPanZoom:c,onPanZoomEnd:u}){return d=>{if($a(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&i){const w=en(d),g=o1(d),y=f*Math.pow(2,g);l.scaleTo(n,y,w,d);return}const h=d.deltaMode===1?20:1;let p=a===na.Vertical?0:d.deltaX*h,x=a===na.Horizontal?0:d.deltaY*h;!Li()&&d.shiftKey&&a!==na.Vertical&&(p=d.deltaY*h,x=0),l.translateBy(n,-(p/f)*s,-(x/f)*s,{internal:!0});const S=Vc(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,S),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,S),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,r==null||r(d,S))}}function W4({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(l,a){const s=l.type==="wheel",i=!t&&s&&!l.ctrlKey,r=$a(l,e);if(l.ctrlKey&&s&&r&&l.preventDefault(),i||r)return null;l.preventDefault(),n.call(this,l,a)}}function F4({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return l=>{var s,i,r;if((s=l.sourceEvent)!=null&&s.internal)return;const a=Vc(l.transform);e.mouseButton=((i=l.sourceEvent)==null?void 0:i.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=a,((r=l.sourceEvent)==null?void 0:r.type)==="mousedown"&&t(!0),n&&(n==null||n(l.sourceEvent,a))}}function P4({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:l,onPanZoom:a}){return s=>{var i,r;e.usedRightMouseButton=!!(n&&r1(t,e.mouseButton??0)),(i=s.sourceEvent)!=null&&i.sync||l([s.transform.x,s.transform.y,s.transform.k]),a&&!((r=s.sourceEvent)!=null&&r.internal)&&(a==null||a(s.sourceEvent,Vc(s.transform)))}}function e_({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:l,onPanZoomEnd:a,onPaneContextMenu:s}){return i=>{var r;if(!((r=i.sourceEvent)!=null&&r.internal)&&(e.isZoomingOrPanning=!1,s&&r1(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,l(!1),a)){const c=Vc(i.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a==null||a(i.sourceEvent,c)},n?150:0)}}}function t_({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:l,panOnScroll:a,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:r,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var w;const h=e||t,p=n&&f.ctrlKey,x=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&($a(f,`${u}-flow__node`)||$a(f,`${u}-flow__edge`)))return!0;if(!l&&!h&&!a&&!s&&!n||i||d&&!x||$a(f,r)&&x||$a(f,c)&&(!x||a&&x&&!e)||!n&&f.ctrlKey&&x)return!1;if(!n&&f.type==="touchstart"&&((w=f.touches)==null?void 0:w.length)>1)return f.preventDefault(),!1;if(!h&&!a&&!p&&x||!l&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(l)&&!l.includes(f.button)&&f.type==="mousedown")return!1;const S=Array.isArray(l)&&l.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||x)&&S}}function n_({domNode:e,minZoom:t,maxZoom:n,translateExtent:l,viewport:a,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:r,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=Rb().scaleExtent([t,n]).translateExtent(l),h=Et(e).call(f);y({x:a.x,y:a.y,zoom:ds(a.zoom,t,n)},[[0,0],[d.width,d.height]],l);const p=h.on("wheel.zoom"),x=h.on("dblclick.zoom");f.wheelDelta(o1);function S(D,L){return h?new Promise(V=>{f==null||f.interpolate((L==null?void 0:L.interpolate)==="linear"?fi:co).transform(Ju(h,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>V(!0)),D)}):Promise.resolve(!1)}function w({noWheelClassName:D,noPanClassName:L,onPaneContextMenu:V,userSelectionActive:N,panOnScroll:O,panOnDrag:C,panOnScrollMode:z,panOnScrollSpeed:T,preventScrolling:R,zoomOnPinch:Y,zoomOnScroll:X,zoomOnDoubleClick:H,zoomActivationKeyPressed:U,lib:_,onTransformChange:$,connectionInProgress:G,paneClickDistance:q,selectionOnDrag:Q}){N&&!u.isZoomingOrPanning&&g();const K=O&&!U&&!N;f.clickDistance(Q?1/0:!an(q)||q<0?0:q);const J=K?J4({zoomPanValues:u,noWheelClassName:D,d3Selection:h,d3Zoom:f,panOnScrollMode:z,panOnScrollSpeed:T,zoomOnPinch:Y,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:r}):W4({noWheelClassName:D,preventScrolling:R,d3ZoomHandler:p});if(h.on("wheel.zoom",J,{passive:!1}),!N){const W=F4({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:i});f.on("start",W);const F=P4({zoomPanValues:u,panOnDrag:C,onPaneContextMenu:!!V,onPanZoom:s,onTransformChange:$});f.on("zoom",F);const le=e_({zoomPanValues:u,panOnDrag:C,panOnScroll:O,onPaneContextMenu:V,onPanZoomEnd:r,onDraggingChange:c});f.on("end",le)}const P=t_({zoomActivationKeyPressed:U,panOnDrag:C,zoomOnScroll:X,panOnScroll:O,zoomOnDoubleClick:H,zoomOnPinch:Y,userSelectionActive:N,noPanClassName:L,noWheelClassName:D,lib:_,connectionInProgress:G});f.filter(P),H?h.on("dblclick.zoom",x):h.on("dblclick.zoom",null)}function g(){f.on("zoom",null)}async function y(D,L,V){const N=Ku(D),O=f==null?void 0:f.constrain()(N,L,V);return O&&await S(O),new Promise(C=>C(O))}async function m(D,L){const V=Ku(D);return await S(V,L),new Promise(N=>N(V))}function v(D){if(h){const L=Ku(D),V=h.property("__zoom");(V.k!==D.zoom||V.x!==D.x||V.y!==D.y)&&(f==null||f.transform(h,L,null,{sync:!0}))}}function j(){const D=h?zb(h.node()):{x:0,y:0,k:1};return{x:D.x,y:D.y,zoom:D.k}}function k(D,L){return h?new Promise(V=>{f==null||f.interpolate((L==null?void 0:L.interpolate)==="linear"?fi:co).scaleTo(Ju(h,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>V(!0)),D)}):Promise.resolve(!1)}function E(D,L){return h?new Promise(V=>{f==null||f.interpolate((L==null?void 0:L.interpolate)==="linear"?fi:co).scaleBy(Ju(h,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>V(!0)),D)}):Promise.resolve(!1)}function A(D){f==null||f.scaleExtent(D)}function M(D){f==null||f.translateExtent(D)}function B(D){const L=!an(D)||D<0?0:D;f==null||f.clickDistance(L)}return{update:w,destroy:g,setViewport:m,setViewportConstrained:y,getViewport:j,scaleTo:k,scaleBy:E,setScaleExtent:A,setTranslateExtent:M,syncViewport:v,setClickDistance:B}}var ps;(function(e){e.Line="line",e.Handle="handle"})(ps||(ps={}));function l_({width:e,prevWidth:t,height:n,prevHeight:l,affectsX:a,affectsY:s}){const i=e-t,r=n-l,c=[i>0?1:i<0?-1:0,r>0?1:r<0?-1:0];return i&&a&&(c[0]=c[0]*-1),r&&s&&(c[1]=c[1]*-1),c}function Vm(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),l=e.includes("left"),a=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:l,affectsY:a}}function sl(e,t){return Math.max(0,t-e)}function il(e,t){return Math.max(0,e-t)}function Ur(e,t,n){return Math.max(0,t-e,e-n)}function Xm(e,t){return e?!t:t}function a_(e,t,n,l,a,s,i,r){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:x}=n,{minWidth:S,maxWidth:w,minHeight:g,maxHeight:y}=l,{x:m,y:v,width:j,height:k,aspectRatio:E}=e;let A=Math.floor(d?p-e.pointerX:0),M=Math.floor(f?x-e.pointerY:0);const B=j+(c?-A:A),D=k+(u?-M:M),L=-s[0]*j,V=-s[1]*k;let N=Ur(B,S,w),O=Ur(D,g,y);if(i){let T=0,R=0;c&&A<0?T=sl(m+A+L,i[0][0]):!c&&A>0&&(T=il(m+B+L,i[1][0])),u&&M<0?R=sl(v+M+V,i[0][1]):!u&&M>0&&(R=il(v+D+V,i[1][1])),N=Math.max(N,T),O=Math.max(O,R)}if(r){let T=0,R=0;c&&A>0?T=il(m+A,r[0][0]):!c&&A<0&&(T=sl(m+B,r[1][0])),u&&M>0?R=il(v+M,r[0][1]):!u&&M<0&&(R=sl(v+D,r[1][1])),N=Math.max(N,T),O=Math.max(O,R)}if(a){if(d){const T=Ur(B/E,g,y)*E;if(N=Math.max(N,T),i){let R=0;!c&&!u||c&&!u&&h?R=il(v+V+B/E,i[1][1])*E:R=sl(v+V+(c?A:-A)/E,i[0][1])*E,N=Math.max(N,R)}if(r){let R=0;!c&&!u||c&&!u&&h?R=sl(v+B/E,r[1][1])*E:R=il(v+(c?A:-A)/E,r[0][1])*E,N=Math.max(N,R)}}if(f){const T=Ur(D*E,S,w)/E;if(O=Math.max(O,T),i){let R=0;!c&&!u||u&&!c&&h?R=il(m+D*E+L,i[1][0])/E:R=sl(m+(u?M:-M)*E+L,i[0][0])/E,O=Math.max(O,R)}if(r){let R=0;!c&&!u||u&&!c&&h?R=sl(m+D*E,r[1][0])/E:R=il(m+(u?M:-M)*E,r[0][0])/E,O=Math.max(O,R)}}}M=M+(M<0?O:-O),A=A+(A<0?N:-N),a&&(h?B>D*E?M=(Xm(c,u)?-A:A)/E:A=(Xm(c,u)?-M:M)*E:d?(M=A/E,u=c):(A=M*E,c=u));const C=c?m+A:m,z=u?v+M:v;return{width:j+(c?-A:A),height:k+(u?-M:M),x:s[0]*A*(c?-1:1)+C,y:s[1]*M*(u?-1:1)+z}}const c1={width:0,height:0,x:0,y:0},s_={...c1,pointerX:0,pointerY:0,aspectRatio:1};function i_(e){return[[0,0],[e.measured.width,e.measured.height]]}function r_(e,t,n){const l=t.position.x+e.position.x,a=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,r=n[0]*s,c=n[1]*i;return[[l-r,a-c],[l+s-r,a+i-c]]}function o_({domNode:e,nodeId:t,getStoreItems:n,onChange:l,onEnd:a}){const s=Et(e);let i={controlDirection:Vm("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function r({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:x,onResizeEnd:S,shouldResize:w}){let g={...c1},y={...s_};i={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:Vm(u)};let m,v=null,j=[],k,E,A,M=!1;const B=vb().on("start",D=>{const{nodeLookup:L,transform:V,snapGrid:N,snapToGrid:O,nodeOrigin:C,paneDomNode:z}=n();if(m=L.get(t),!m)return;v=(z==null?void 0:z.getBoundingClientRect())??null;const{xSnapped:T,ySnapped:R}=hi(D.sourceEvent,{transform:V,snapGrid:N,snapToGrid:O,containerBounds:v});g={width:m.measured.width??0,height:m.measured.height??0,x:m.position.x??0,y:m.position.y??0},y={...g,pointerX:T,pointerY:R,aspectRatio:g.width/g.height},k=void 0,m.parentId&&(m.extent==="parent"||m.expandParent)&&(k=L.get(m.parentId),E=k&&m.extent==="parent"?i_(k):void 0),j=[],A=void 0;for(const[Y,X]of L)if(X.parentId===t&&(j.push({id:Y,position:{...X.position},extent:X.extent}),X.extent==="parent"||X.expandParent)){const H=r_(X,m,X.origin??C);A?A=[[Math.min(H[0][0],A[0][0]),Math.min(H[0][1],A[0][1])],[Math.max(H[1][0],A[1][0]),Math.max(H[1][1],A[1][1])]]:A=H}p==null||p(D,{...g})}).on("drag",D=>{const{transform:L,snapGrid:V,snapToGrid:N,nodeOrigin:O}=n(),C=hi(D.sourceEvent,{transform:L,snapGrid:V,snapToGrid:N,containerBounds:v}),z=[];if(!m)return;const{x:T,y:R,width:Y,height:X}=g,H={},U=m.origin??O,{width:_,height:$,x:G,y:q}=a_(y,i.controlDirection,C,i.boundaries,i.keepAspectRatio,U,E,A),Q=_!==Y,K=$!==X,J=G!==T&&Q,P=q!==R&&K;if(!J&&!P&&!Q&&!K)return;if((J||P||U[0]===1||U[1]===1)&&(H.x=J?G:g.x,H.y=P?q:g.y,g.x=H.x,g.y=H.y,j.length>0)){const ae=G-T,te=q-R;for(const ge of j)ge.position={x:ge.position.x-ae+U[0]*(_-Y),y:ge.position.y-te+U[1]*($-X)},z.push(ge)}if((Q||K)&&(H.width=Q&&(!i.resizeDirection||i.resizeDirection==="horizontal")?_:g.width,H.height=K&&(!i.resizeDirection||i.resizeDirection==="vertical")?$:g.height,g.width=H.width,g.height=H.height),k&&m.expandParent){const ae=U[0]*(H.width??0);H.x&&H.x<ae&&(g.x=ae,y.x=y.x-(H.x-ae));const te=U[1]*(H.height??0);H.y&&H.y<te&&(g.y=te,y.y=y.y-(H.y-te))}const W=l_({width:g.width,prevWidth:Y,height:g.height,prevHeight:X,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),F={...g,direction:W};(w==null?void 0:w(D,F))!==!1&&(M=!0,x==null||x(D,F),l(H,z))}).on("end",D=>{M&&(S==null||S(D,{...g}),a==null||a({...g}),M=!1)});s.call(B)}function c(){s.on(".drag",null)}return{update:r,destroy:c}}var u1={exports:{}},d1={},f1={exports:{}},h1={};/**
144
+ * @license React
145
+ * use-sync-external-store-shim.production.js
146
+ *
147
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
148
+ *
149
+ * This source code is licensed under the MIT license found in the
150
+ * LICENSE file in the root directory of this source tree.
151
+ */var gs=b;function c_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var u_=typeof Object.is=="function"?Object.is:c_,d_=gs.useState,f_=gs.useEffect,h_=gs.useLayoutEffect,p_=gs.useDebugValue;function g_(e,t){var n=t(),l=d_({inst:{value:n,getSnapshot:t}}),a=l[0].inst,s=l[1];return h_(function(){a.value=n,a.getSnapshot=t,Wu(a)&&s({inst:a})},[e,n,t]),f_(function(){return Wu(a)&&s({inst:a}),e(function(){Wu(a)&&s({inst:a})})},[e]),p_(n),n}function Wu(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!u_(e,n)}catch{return!0}}function m_(e,t){return t()}var x_=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m_:g_;h1.useSyncExternalStore=gs.useSyncExternalStore!==void 0?gs.useSyncExternalStore:x_;f1.exports=h1;var y_=f1.exports;/**
152
+ * @license React
153
+ * use-sync-external-store-shim/with-selector.production.js
154
+ *
155
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
156
+ *
157
+ * This source code is licensed under the MIT license found in the
158
+ * LICENSE file in the root directory of this source tree.
159
+ */var Xc=b,v_=y_;function b_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var w_=typeof Object.is=="function"?Object.is:b_,S_=v_.useSyncExternalStore,N_=Xc.useRef,j_=Xc.useEffect,k_=Xc.useMemo,E_=Xc.useDebugValue;d1.useSyncExternalStoreWithSelector=function(e,t,n,l,a){var s=N_(null);if(s.current===null){var i={hasValue:!1,value:null};s.current=i}else i=s.current;s=k_(function(){function c(p){if(!u){if(u=!0,d=p,p=l(p),a!==void 0&&i.hasValue){var x=i.value;if(a(x,p))return f=x}return f=p}if(x=f,w_(d,p))return x;var S=l(p);return a!==void 0&&a(x,S)?(d=p,x):(d=p,f=S)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,l,a]);var r=S_(e,s[0],s[1]);return j_(function(){i.hasValue=!0,i.value=r},[r]),E_(r),r};u1.exports=d1;var C_=u1.exports;const __=mx(C_),M_={},Gm=e=>{let t;const n=new Set,l=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(x=>x(t,p))}},a=()=>t,c={setState:l,getState:a,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(M_?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(l,a,c);return c},A_=e=>e?Gm(e):Gm,{useDebugValue:T_}=_e,{useSyncExternalStoreWithSelector:D_}=__,z_=e=>e;function p1(e,t=z_,n){const l=D_(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return T_(l),l}const Qm=(e,t)=>{const n=A_(e),l=(a,s=t)=>p1(n,a,s);return Object.assign(l,n),l},R_=(e,t)=>e?Qm(e,t):Qm;function De(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[l,a]of e)if(!Object.is(a,t.get(l)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const l of e)if(!t.has(l))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const l of n)if(!Object.prototype.hasOwnProperty.call(t,l)||!Object.is(e[l],t[l]))return!1;return!0}const Gc=b.createContext(null),O_=Gc.Provider,g1=Nn.error001();function he(e,t){const n=b.useContext(Gc);if(n===null)throw new Error(g1);return p1(n,e,t)}function ze(){const e=b.useContext(Gc);if(e===null)throw new Error(g1);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Zm={display:"none"},H_={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},m1="react-flow__node-desc",x1="react-flow__edge-desc",L_="react-flow__aria-live",B_=e=>e.ariaLiveMessage,$_=e=>e.ariaLabelConfig;function U_({rfId:e}){const t=he(B_);return o.jsx("div",{id:`${L_}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:H_,children:t})}function q_({rfId:e,disableKeyboardA11y:t}){const n=he($_);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${m1}-${e}`,style:Zm,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${x1}-${e}`,style:Zm,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(U_,{rfId:e})]})}const Qc=b.forwardRef(({position:e="top-left",children:t,className:n,style:l,...a},s)=>{const i=`${e}`.split("-");return o.jsx("div",{className:Ve(["react-flow__panel",n,...i]),style:l,ref:s,...a,children:t})});Qc.displayName="Panel";function Y_({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(Qc,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const V_=e=>{const t=[],n=[];for(const[,l]of e.nodeLookup)l.selected&&t.push(l.internals.userNode);for(const[,l]of e.edgeLookup)l.selected&&n.push(l);return{selectedNodes:t,selectedEdges:n}},qr=e=>e.id;function X_(e,t){return De(e.selectedNodes.map(qr),t.selectedNodes.map(qr))&&De(e.selectedEdges.map(qr),t.selectedEdges.map(qr))}function G_({onSelectionChange:e}){const t=ze(),{selectedNodes:n,selectedEdges:l}=he(V_,X_);return b.useEffect(()=>{const a={nodes:n,edges:l};e==null||e(a),t.getState().onSelectionChangeHandlers.forEach(s=>s(a))},[n,l,e]),null}const Q_=e=>!!e.onSelectionChangeHandlers;function Z_({onSelectionChange:e}){const t=he(Q_);return e||t?o.jsx(G_,{onSelectionChange:e}):null}const yf=typeof window<"u"?b.useLayoutEffect:b.useEffect,y1=[0,0],I_={x:0,y:0,zoom:1},K_=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Im=[...K_,"rfId"],J_=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Km={translateExtent:Ri,nodeOrigin:y1,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function W_(e){const{setNodes:t,setEdges:n,setMinZoom:l,setMaxZoom:a,setTranslateExtent:s,setNodeExtent:i,reset:r,setDefaultNodesAndEdges:c}=he(J_,De),u=ze();yf(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=Km,r()}),[]);const d=b.useRef(Km);return yf(()=>{for(const f of Im){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?l(h):f==="maxZoom"?a(h):f==="translateExtent"?s(h):f==="nodeExtent"?i(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:b4(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},Im.map(f=>e[f])),null}function Jm(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function F_(e){var l;const[t,n]=b.useState(e==="system"?null:e);return b.useEffect(()=>{if(e!=="system"){n(e);return}const a=Jm(),s=()=>n(a!=null&&a.matches?"dark":"light");return s(),a==null||a.addEventListener("change",s),()=>{a==null||a.removeEventListener("change",s)}},[e]),t!==null?t:(l=Jm())!=null&&l.matches?"dark":"light"}const Wm=typeof document<"u"?document:null;function Bi(e=null,t={target:Wm,actInsideInputWithModifier:!0}){const[n,l]=b.useState(!1),a=b.useRef(!1),s=b.useRef(new Set([])),[i,r]=b.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
160
+ `).replace(`
161
+
162
+ `,`
163
+ +`).split(`
164
+ `)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return b.useEffect(()=>{const c=(t==null?void 0:t.target)??Wm,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var w,g;if(a.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!a.current||a.current&&!u)&&Zb(p))return!1;const S=Pm(p.code,r);if(s.current.add(p[S]),Fm(i,s.current,!1)){const y=((g=(w=p.composedPath)==null?void 0:w.call(p))==null?void 0:g[0])||p.target,m=(y==null?void 0:y.nodeName)==="BUTTON"||(y==null?void 0:y.nodeName)==="A";t.preventDefault!==!1&&(a.current||!m)&&p.preventDefault(),l(!0)}},f=p=>{const x=Pm(p.code,r);Fm(i,s.current,!0)?(l(!1),s.current.clear()):s.current.delete(p[x]),p.key==="Meta"&&s.current.clear(),a.current=!1},h=()=>{s.current.clear(),l(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,l]),n}function Fm(e,t,n){return e.filter(l=>n||l.length===t.size).some(l=>l.every(a=>t.has(a)))}function Pm(e,t){return t.includes(e)?"code":"key"}const P_=()=>{const e=ze();return b.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:l}=e.getState();return l?l.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[l,a,s],panZoom:i}=e.getState();return i?(await i.setViewport({x:t.x??l,y:t.y??a,zoom:t.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,l]=e.getState().transform;return{x:t,y:n,zoom:l}},setCenter:async(t,n,l)=>e.getState().setCenter(t,n,l),fitBounds:async(t,n)=>{const{width:l,height:a,minZoom:s,maxZoom:i,panZoom:r}=e.getState(),c=Jh(t,l,a,s,i,(n==null?void 0:n.padding)??.1);return r?(await r.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:l,snapGrid:a,snapToGrid:s,domNode:i}=e.getState();if(!i)return t;const{x:r,y:c}=i.getBoundingClientRect(),u={x:t.x-r,y:t.y-c},d=n.snapGrid??a,f=n.snapToGrid??s;return rr(u,l,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:l}=e.getState();if(!l)return t;const{x:a,y:s}=l.getBoundingClientRect(),i=oc(t,n);return{x:i.x+a,y:i.y+s}}}),[])};function v1(e,t){const n=[],l=new Map,a=[];for(const s of e)if(s.type==="add"){a.push(s);continue}else if(s.type==="remove"||s.type==="replace")l.set(s.id,[s]);else{const i=l.get(s.id);i?i.push(s):l.set(s.id,[s])}for(const s of t){const i=l.get(s.id);if(!i){n.push(s);continue}if(i[0].type==="remove")continue;if(i[0].type==="replace"){n.push({...i[0].item});continue}const r={...s};for(const c of i)eM(c,r);n.push(r)}return a.length&&a.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function eM(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function b1(e,t){return v1(e,t)}function w1(e,t){return v1(e,t)}function Ql(e,t){return{id:e,type:"select",selected:t}}function Ua(e,t=new Set,n=!1){const l=[];for(const[a,s]of e){const i=t.has(a);!(s.selected===void 0&&!i)&&s.selected!==i&&(n&&(s.selected=i),l.push(Ql(s.id,i)))}return l}function ex({items:e=[],lookup:t}){var a;const n=[],l=new Map(e.map(s=>[s.id,s]));for(const[s,i]of e.entries()){const r=t.get(i.id),c=((a=r==null?void 0:r.internals)==null?void 0:a.userNode)??r;c!==void 0&&c!==i&&n.push({id:i.id,item:i,type:"replace"}),c===void 0&&n.push({item:i,type:"add",index:s})}for(const[s]of t)l.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function tx(e){return{id:e.id,type:"remove"}}const nx=e=>u4(e),tM=e=>$b(e);function S1(e){return b.forwardRef(e)}function lx(e){const[t,n]=b.useState(BigInt(0)),[l]=b.useState(()=>nM(()=>n(a=>a+BigInt(1))));return yf(()=>{const a=l.get();a.length&&(e(a),l.reset())},[t]),l}function nM(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const N1=b.createContext(null);function lM({children:e}){const t=ze(),n=b.useCallback(r=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:x}=t.getState();let S=c;for(const g of r)S=typeof g=="function"?g(S):g;let w=ex({items:S,lookup:h});for(const g of x.values())w=g(w);d&&u(S),w.length>0?f==null||f(w):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:y,setNodes:m}=t.getState();g&&m(y)})},[]),l=lx(n),a=b.useCallback(r=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const x of r)p=typeof x=="function"?x(p):x;d?u(p):f&&f(ex({items:p,lookup:h}))},[]),s=lx(a),i=b.useMemo(()=>({nodeQueue:l,edgeQueue:s}),[]);return o.jsx(N1.Provider,{value:i,children:e})}function aM(){const e=b.useContext(N1);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const sM=e=>!!e.panZoom;function lp(){const e=P_(),t=ze(),n=aM(),l=he(sM),a=b.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),i=f=>{n.nodeQueue.push(f)},r=f=>{n.edgeQueue.push(f)},c=f=>{var g,y;const{nodeLookup:h,nodeOrigin:p}=t.getState(),x=nx(f)?f:h.get(f.id),S=x.parentId?Gb(x.position,x.measured,x.parentId,h,p):x.position,w={...x,position:S,width:((g=x.measured)==null?void 0:g.width)??x.width,height:((y=x.measured)==null?void 0:y.height)??x.height};return fs(w)},u=(f,h,p={replace:!1})=>{i(x=>x.map(S=>{if(S.id===f){const w=typeof h=="function"?h(S):h;return p.replace&&nx(w)?w:{...S,...w}}return S}))},d=(f,h,p={replace:!1})=>{r(x=>x.map(S=>{if(S.id===f){const w=typeof h=="function"?h(S):h;return p.replace&&tM(w)?w:{...S,...w}}return S}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=s(f))==null?void 0:h.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:i,setEdges:r,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[x,S,w]=p;return{nodes:f.map(g=>({...g})),edges:h.map(g=>({...g})),viewport:{x,y:S,zoom:w}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:x,onNodesDelete:S,onEdgesDelete:w,triggerNodeChanges:g,triggerEdgeChanges:y,onDelete:m,onBeforeDelete:v}=t.getState(),{nodes:j,edges:k}=await g4({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:x,onBeforeDelete:v}),E=k.length>0,A=j.length>0;if(E){const M=k.map(tx);w==null||w(k),y(M)}if(A){const M=j.map(tx);S==null||S(j),g(M)}return(A||E)&&(m==null||m({nodes:j,edges:k})),{deletedNodes:j,deletedEdges:k}},getIntersectingNodes:(f,h=!0,p)=>{const x=Dm(f),S=x?f:c(f),w=p!==void 0;return S?(p||t.getState().nodes).filter(g=>{const y=t.getState().nodeLookup.get(g.id);if(y&&!x&&(g.id===f.id||!y.internals.positionAbsolute))return!1;const m=fs(w?g:y),v=Hi(m,S);return h&&v>0||v>=m.width*m.height||v>=S.width*S.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const S=Dm(f)?f:c(f);if(!S)return!1;const w=Hi(S,h);return p&&w>0||w>=h.width*h.height||w>=S.width*S.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,x=>{const S=typeof h=="function"?h(x):h;return p.replace?{...x,data:S}:{...x,data:{...x.data,...S}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,x=>{const S=typeof h=="function"?h(x):h;return p.replace?{...x,data:S}:{...x,data:{...x.data,...S}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return d4(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var x;return Array.from(((x=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:x.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var x;return Array.from(((x=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:x.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??v4();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return b.useMemo(()=>({...a,...e,viewportInitialized:l}),[l])}const ax=e=>e.selected,iM=typeof window<"u"?window:void 0;function rM({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ze(),{deleteElements:l}=lp(),a=Bi(e,{actInsideInputWithModifier:!1}),s=Bi(t,{target:iM});b.useEffect(()=>{if(a){const{edges:i,nodes:r}=n.getState();l({nodes:r.filter(ax),edges:i.filter(ax)}),n.setState({nodesSelectionActive:!1})}},[a]),b.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function oM(e){const t=ze();b.useEffect(()=>{const n=()=>{var a,s,i,r;if(!e.current||!(((s=(a=e.current).checkVisibility)==null?void 0:s.call(a))??!0))return!1;const l=Wh(e.current);(l.height===0||l.width===0)&&((r=(i=t.getState()).onError)==null||r.call(i,"004",Nn.error004())),t.setState({width:l.width||500,height:l.height||500})};if(e.current){n(),window.addEventListener("resize",n);const l=new ResizeObserver(()=>n());return l.observe(e.current),()=>{window.removeEventListener("resize",n),l&&e.current&&l.unobserve(e.current)}}},[])}const Zc={position:"absolute",width:"100%",height:"100%",top:0,left:0},cM=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function uM({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:l=!1,panOnScrollSpeed:a=.5,panOnScrollMode:s=na.Free,zoomOnDoubleClick:i=!0,panOnDrag:r=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:x,noWheelClassName:S,noPanClassName:w,onViewportChange:g,isControlledViewport:y,paneClickDistance:m,selectionOnDrag:v}){const j=ze(),k=b.useRef(null),{userSelectionActive:E,lib:A,connectionInProgress:M}=he(cM,De),B=Bi(h),D=b.useRef();oM(k);const L=b.useCallback(V=>{g==null||g({x:V[0],y:V[1],zoom:V[2]}),y||j.setState({transform:V})},[g,y]);return b.useEffect(()=>{if(k.current){D.current=n_({domNode:k.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:C=>j.setState(z=>z.paneDragging===C?z:{paneDragging:C}),onPanZoomStart:(C,z)=>{const{onViewportChangeStart:T,onMoveStart:R}=j.getState();R==null||R(C,z),T==null||T(z)},onPanZoom:(C,z)=>{const{onViewportChange:T,onMove:R}=j.getState();R==null||R(C,z),T==null||T(z)},onPanZoomEnd:(C,z)=>{const{onViewportChangeEnd:T,onMoveEnd:R}=j.getState();R==null||R(C,z),T==null||T(z)}});const{x:V,y:N,zoom:O}=D.current.getViewport();return j.setState({panZoom:D.current,transform:[V,N,O],domNode:k.current.closest(".react-flow")}),()=>{var C;(C=D.current)==null||C.destroy()}}},[]),b.useEffect(()=>{var V;(V=D.current)==null||V.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:l,panOnScrollSpeed:a,panOnScrollMode:s,zoomOnDoubleClick:i,panOnDrag:r,zoomActivationKeyPressed:B,preventScrolling:p,noPanClassName:w,userSelectionActive:E,noWheelClassName:S,lib:A,onTransformChange:L,connectionInProgress:M,selectionOnDrag:v,paneClickDistance:m})},[e,t,n,l,a,s,i,r,B,p,w,E,S,A,L,M,v,m]),o.jsx("div",{className:"react-flow__renderer",ref:k,style:Zc,children:x})}const dM=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function fM(){const{userSelectionActive:e,userSelectionRect:t}=he(dM,De);return e&&t?o.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Fu=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},hM=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function pM({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Oi.Full,panOnDrag:l,paneClickDistance:a,selectionOnDrag:s,onSelectionStart:i,onSelectionEnd:r,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:h,onPaneMouseLeave:p,children:x}){const S=ze(),{userSelectionActive:w,elementsSelectable:g,dragging:y,connectionInProgress:m}=he(hM,De),v=g&&(e||w),j=b.useRef(null),k=b.useRef(),E=b.useRef(new Set),A=b.useRef(new Set),M=b.useRef(!1),B=T=>{if(M.current||m){M.current=!1;return}c==null||c(T),S.getState().resetSelectedElements(),S.setState({nodesSelectionActive:!1})},D=T=>{if(Array.isArray(l)&&(l!=null&&l.includes(2))){T.preventDefault();return}u==null||u(T)},L=d?T=>d(T):void 0,V=T=>{M.current&&(T.stopPropagation(),M.current=!1)},N=T=>{var $,G;const{domNode:R}=S.getState();if(k.current=R==null?void 0:R.getBoundingClientRect(),!k.current)return;const Y=T.target===j.current;if(!Y&&!!T.target.closest(".nokey")||!e||!(s&&Y||t)||T.button!==0||!T.isPrimary)return;(G=($=T.target)==null?void 0:$.setPointerCapture)==null||G.call($,T.pointerId),M.current=!1;const{x:U,y:_}=sn(T.nativeEvent,k.current);S.setState({userSelectionRect:{width:0,height:0,startX:U,startY:_,x:U,y:_}}),Y||(T.stopPropagation(),T.preventDefault())},O=T=>{const{userSelectionRect:R,transform:Y,nodeLookup:X,edgeLookup:H,connectionLookup:U,triggerNodeChanges:_,triggerEdgeChanges:$,defaultEdgeOptions:G,resetSelectedElements:q}=S.getState();if(!k.current||!R)return;const{x:Q,y:K}=sn(T.nativeEvent,k.current),{startX:J,startY:P}=R;if(!M.current){const te=t?0:a;if(Math.hypot(Q-J,K-P)<=te)return;q(),i==null||i(T)}M.current=!0;const W={startX:J,startY:P,x:Q<J?Q:J,y:K<P?K:P,width:Math.abs(Q-J),height:Math.abs(K-P)},F=E.current,le=A.current;E.current=new Set(Kh(X,W,Y,n===Oi.Partial,!0).map(te=>te.id)),A.current=new Set;const ae=(G==null?void 0:G.selectable)??!0;for(const te of E.current){const ge=U.get(te);if(ge)for(const{edgeId:I}of ge.values()){const se=H.get(I);se&&(se.selectable??ae)&&A.current.add(I)}}if(!zm(F,E.current)){const te=Ua(X,E.current,!0);_(te)}if(!zm(le,A.current)){const te=Ua(H,A.current);$(te)}S.setState({userSelectionRect:W,userSelectionActive:!0,nodesSelectionActive:!1})},C=T=>{var R,Y;T.button===0&&((Y=(R=T.target)==null?void 0:R.releasePointerCapture)==null||Y.call(R,T.pointerId),!w&&T.target===j.current&&S.getState().userSelectionRect&&(B==null||B(T)),S.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(r==null||r(T),S.setState({nodesSelectionActive:E.current.size>0})))},z=l===!0||Array.isArray(l)&&l.includes(0);return o.jsxs("div",{className:Ve(["react-flow__pane",{draggable:z,dragging:y,selection:e}]),onClick:v?void 0:Fu(B,j),onContextMenu:Fu(D,j),onWheel:Fu(L,j),onPointerEnter:v?void 0:f,onPointerMove:v?O:h,onPointerUp:v?C:void 0,onPointerDownCapture:v?N:void 0,onClickCapture:v?V:void 0,onPointerLeave:p,ref:j,style:Zc,children:[x,o.jsx(fM,{})]})}function vf({id:e,store:t,unselect:n=!1,nodeRef:l}){const{addSelectedNodes:a,unselectNodesAndEdges:s,multiSelectionActive:i,nodeLookup:r,onError:c}=t.getState(),u=r.get(e);if(!u){c==null||c("012",Nn.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&i)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=l==null?void 0:l.current)==null?void 0:d.blur()})):a([e])}function j1({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:l,nodeId:a,isSelectable:s,nodeClickDistance:i}){const r=ze(),[c,u]=b.useState(!1),d=b.useRef();return b.useEffect(()=>{d.current=Y4({getStoreItems:()=>r.getState(),onNodeMouseDown:f=>{vf({id:f,store:r,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),b.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:l,domNode:e.current,isSelectable:s,nodeId:a,nodeClickDistance:i}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,l,t,s,e,a,i]),c}const gM=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function k1(){const e=ze();return b.useCallback(n=>{const{nodeExtent:l,snapToGrid:a,snapGrid:s,nodesDraggable:i,onError:r,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=gM(i),p=a?s[0]:5,x=a?s[1]:5,S=n.direction.x*p*n.factor,w=n.direction.y*x*n.factor;for(const[,g]of u){if(!h(g))continue;let y={x:g.internals.positionAbsolute.x+S,y:g.internals.positionAbsolute.y+w};a&&(y=ir(y,s));const{position:m,positionAbsolute:v}=Ub({nodeId:g.id,nextPosition:y,nodeLookup:u,nodeExtent:l,nodeOrigin:d,onError:r});g.position=m,g.internals.positionAbsolute=v,f.set(g.id,g)}c(f)},[])}const ap=b.createContext(null),mM=ap.Provider;ap.Consumer;const E1=()=>b.useContext(ap),xM=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),yM=(e,t,n)=>l=>{const{connectionClickStartHandle:a,connectionMode:s,connection:i}=l,{fromHandle:r,toHandle:c,isValid:u}=i,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(r==null?void 0:r.nodeId)===e&&(r==null?void 0:r.id)===t&&(r==null?void 0:r.type)===n,connectingTo:d,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,isPossibleEndHandle:s===us.Strict?(r==null?void 0:r.type)!==n:e!==(r==null?void 0:r.nodeId)||t!==(r==null?void 0:r.id),connectionInProcess:!!r,clickConnectionInProcess:!!a,valid:d&&u}};function vM({type:e="source",position:t=ee.Top,isValidConnection:n,isConnectable:l=!0,isConnectableStart:a=!0,isConnectableEnd:s=!0,id:i,onConnect:r,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var O,C;const x=i||null,S=e==="target",w=ze(),g=E1(),{connectOnClick:y,noPanClassName:m,rfId:v}=he(xM,De),{connectingFrom:j,connectingTo:k,clickConnecting:E,isPossibleEndHandle:A,connectionInProcess:M,clickConnectionInProcess:B,valid:D}=he(yM(g,x,e),De);g||(C=(O=w.getState()).onError)==null||C.call(O,"010",Nn.error010());const L=z=>{const{defaultEdgeOptions:T,onConnect:R,hasDefaultEdges:Y}=w.getState(),X={...T,...z};if(Y){const{edges:H,setEdges:U}=w.getState();U(E4(X,H))}R==null||R(X),r==null||r(X)},V=z=>{if(!g)return;const T=Ib(z.nativeEvent);if(a&&(T&&z.button===0||!T)){const R=w.getState();xf.onPointerDown(z.nativeEvent,{handleDomNode:z.currentTarget,autoPanOnConnect:R.autoPanOnConnect,connectionMode:R.connectionMode,connectionRadius:R.connectionRadius,domNode:R.domNode,nodeLookup:R.nodeLookup,lib:R.lib,isTarget:S,handleId:x,nodeId:g,flowId:R.rfId,panBy:R.panBy,cancelConnection:R.cancelConnection,onConnectStart:R.onConnectStart,onConnectEnd:(...Y)=>{var X,H;return(H=(X=w.getState()).onConnectEnd)==null?void 0:H.call(X,...Y)},updateConnection:R.updateConnection,onConnect:L,isValidConnection:n||((...Y)=>{var X,H;return((H=(X=w.getState()).isValidConnection)==null?void 0:H.call(X,...Y))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:R.autoPanSpeed,dragThreshold:R.connectionDragThreshold})}T?d==null||d(z):f==null||f(z)},N=z=>{const{onClickConnectStart:T,onClickConnectEnd:R,connectionClickStartHandle:Y,connectionMode:X,isValidConnection:H,lib:U,rfId:_,nodeLookup:$,connection:G}=w.getState();if(!g||!Y&&!a)return;if(!Y){T==null||T(z.nativeEvent,{nodeId:g,handleId:x,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:g,type:e,id:x}});return}const q=Qb(z.target),Q=n||H,{connection:K,isValid:J}=xf.isValid(z.nativeEvent,{handle:{nodeId:g,id:x,type:e},connectionMode:X,fromNodeId:Y.nodeId,fromHandleId:Y.id||null,fromType:Y.type,isValidConnection:Q,flowId:_,doc:q,lib:U,nodeLookup:$});J&&K&&L(K);const P=structuredClone(G);delete P.inProgress,P.toPosition=P.toHandle?P.toHandle.position:null,R==null||R(z,P),w.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":x,"data-nodeid":g,"data-handlepos":t,"data-id":`${v}-${g}-${x}-${e}`,className:Ve(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",m,u,{source:!S,target:S,connectable:l,connectablestart:a,connectableend:s,clickconnecting:E,connectingfrom:j,connectingto:k,valid:D,connectionindicator:l&&(!M||A)&&(M||B?s:a)}]),onMouseDown:V,onTouchStart:V,onClick:y?N:void 0,ref:p,...h,children:c})}const ms=b.memo(S1(vM));function bM({data:e,isConnectable:t,sourcePosition:n=ee.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(ms,{type:"source",position:n,isConnectable:t})]})}function wM({data:e,isConnectable:t,targetPosition:n=ee.Top,sourcePosition:l=ee.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(ms,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(ms,{type:"source",position:l,isConnectable:t})]})}function SM(){return null}function NM({data:e,isConnectable:t,targetPosition:n=ee.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(ms,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const cc={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},sx={input:bM,default:wM,output:NM,group:SM};function jM(e){var t,n,l,a;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((l=e.style)==null?void 0:l.width),height:e.height??((a=e.style)==null?void 0:a.height)}}const kM=e=>{const{width:t,height:n,x:l,y:a}=sr(e.nodeLookup,{filter:s=>!!s.selected});return{width:an(t)?t:null,height:an(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${l}px,${a}px)`}};function EM({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const l=ze(),{width:a,height:s,transformString:i,userSelectionActive:r}=he(kM,De),c=k1(),u=b.useRef(null);b.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!r&&a!==null&&s!==null;if(j1({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const x=l.getState().nodes.filter(S=>S.selected);e(p,x)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(cc,p.key)&&(p.preventDefault(),c({direction:cc[p.key],factor:p.shiftKey?4:1}))};return o.jsx("div",{className:Ve(["react-flow__nodesselection","react-flow__container",t]),style:{transform:i},children:o.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:a,height:s}})})}const ix=typeof window<"u"?window:void 0,CM=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function C1({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:l,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:i,paneClickDistance:r,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:w,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:m,panOnScroll:v,panOnScrollSpeed:j,panOnScrollMode:k,zoomOnDoubleClick:E,panOnDrag:A,defaultViewport:M,translateExtent:B,minZoom:D,maxZoom:L,preventScrolling:V,onSelectionContextMenu:N,noWheelClassName:O,noPanClassName:C,disableKeyboardA11y:z,onViewportChange:T,isControlledViewport:R}){const{nodesSelectionActive:Y,userSelectionActive:X}=he(CM,De),H=Bi(u,{target:ix}),U=Bi(S,{target:ix}),_=U||A,$=U||v,G=d&&_!==!0,q=H||X||G;return rM({deleteKeyCode:c,multiSelectionKeyCode:x}),o.jsx(uM,{onPaneContextMenu:s,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:m,panOnScroll:$,panOnScrollSpeed:j,panOnScrollMode:k,zoomOnDoubleClick:E,panOnDrag:!H&&_,defaultViewport:M,translateExtent:B,minZoom:D,maxZoom:L,zoomActivationKeyCode:w,preventScrolling:V,noWheelClassName:O,noPanClassName:C,onViewportChange:T,isControlledViewport:R,paneClickDistance:r,selectionOnDrag:G,children:o.jsxs(pM,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:l,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:_,isSelecting:!!q,selectionMode:f,selectionKeyPressed:H,paneClickDistance:r,selectionOnDrag:G,children:[e,Y&&o.jsx(EM,{onSelectionContextMenu:N,noPanClassName:C,disableKeyboardA11y:z})]})})}C1.displayName="FlowRenderer";const _M=b.memo(C1),MM=e=>t=>e?Kh(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function AM(e){return he(b.useCallback(MM(e),[e]),De)}const TM=e=>e.updateNodeInternals;function DM(){const e=he(TM),[t]=b.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const l=new Map;n.forEach(a=>{const s=a.target.getAttribute("data-id");l.set(s,{id:s,nodeElement:a.target,force:!0})}),e(l)}));return b.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function zM({node:e,nodeType:t,hasDimensions:n,resizeObserver:l}){const a=ze(),s=b.useRef(null),i=b.useRef(null),r=b.useRef(e.sourcePosition),c=b.useRef(e.targetPosition),u=b.useRef(t),d=n&&!!e.internals.handleBounds;return b.useEffect(()=>{s.current&&!e.hidden&&(!d||i.current!==s.current)&&(i.current&&(l==null||l.unobserve(i.current)),l==null||l.observe(s.current),i.current=s.current)},[d,e.hidden]),b.useEffect(()=>()=>{i.current&&(l==null||l.unobserve(i.current),i.current=null)},[]),b.useEffect(()=>{if(s.current){const f=u.current!==t,h=r.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,r.current=e.sourcePosition,c.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function RM({id:e,onClick:t,onMouseEnter:n,onMouseMove:l,onMouseLeave:a,onContextMenu:s,onDoubleClick:i,nodesDraggable:r,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:x,rfId:S,nodeTypes:w,nodeClickDistance:g,onError:y}){const{node:m,internals:v,isParent:j}=he(Q=>{const K=Q.nodeLookup.get(e),J=Q.parentLookup.has(e);return{node:K,internals:K.internals,isParent:J}},De);let k=m.type||"default",E=(w==null?void 0:w[k])||sx[k];E===void 0&&(y==null||y("003",Nn.error003(k)),k="default",E=(w==null?void 0:w.default)||sx.default);const A=!!(m.draggable||r&&typeof m.draggable>"u"),M=!!(m.selectable||c&&typeof m.selectable>"u"),B=!!(m.connectable||u&&typeof m.connectable>"u"),D=!!(m.focusable||d&&typeof m.focusable>"u"),L=ze(),V=Xb(m),N=zM({node:m,nodeType:k,hasDimensions:V,resizeObserver:f}),O=j1({nodeRef:N,disabled:m.hidden||!A,noDragClassName:h,handleSelector:m.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:g}),C=k1();if(m.hidden)return null;const z=Pn(m),T=jM(m),R=M||A||t||n||l||a,Y=n?Q=>n(Q,{...v.userNode}):void 0,X=l?Q=>l(Q,{...v.userNode}):void 0,H=a?Q=>a(Q,{...v.userNode}):void 0,U=s?Q=>s(Q,{...v.userNode}):void 0,_=i?Q=>i(Q,{...v.userNode}):void 0,$=Q=>{const{selectNodesOnDrag:K,nodeDragThreshold:J}=L.getState();M&&(!K||!A||J>0)&&vf({id:e,store:L,nodeRef:N}),t&&t(Q,{...v.userNode})},G=Q=>{if(!(Zb(Q.nativeEvent)||x)){if(Ob.includes(Q.key)&&M){const K=Q.key==="Escape";vf({id:e,store:L,unselect:K,nodeRef:N})}else if(A&&m.selected&&Object.prototype.hasOwnProperty.call(cc,Q.key)){Q.preventDefault();const{ariaLabelConfig:K}=L.getState();L.setState({ariaLiveMessage:K["node.a11yDescription.ariaLiveMessage"]({direction:Q.key.replace("Arrow","").toLowerCase(),x:~~v.positionAbsolute.x,y:~~v.positionAbsolute.y})}),C({direction:cc[Q.key],factor:Q.shiftKey?4:1})}}},q=()=>{var le;if(x||!((le=N.current)!=null&&le.matches(":focus-visible")))return;const{transform:Q,width:K,height:J,autoPanOnNodeFocus:P,setCenter:W}=L.getState();if(!P)return;Kh(new Map([[e,m]]),{x:0,y:0,width:K,height:J},Q,!0).length>0||W(m.position.x+z.width/2,m.position.y+z.height/2,{zoom:Q[2]})};return o.jsx("div",{className:Ve(["react-flow__node",`react-flow__node-${k}`,{[p]:A},m.className,{selected:m.selected,selectable:M,parent:j,draggable:A,dragging:O}]),ref:N,style:{zIndex:v.z,transform:`translate(${v.positionAbsolute.x}px,${v.positionAbsolute.y}px)`,pointerEvents:R?"all":"none",visibility:V?"visible":"hidden",...m.style,...T},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:Y,onMouseMove:X,onMouseLeave:H,onContextMenu:U,onClick:$,onDoubleClick:_,onKeyDown:D?G:void 0,tabIndex:D?0:void 0,onFocus:D?q:void 0,role:m.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${m1}-${S}`,"aria-label":m.ariaLabel,...m.domAttributes,children:o.jsx(mM,{value:e,children:o.jsx(E,{id:e,data:m.data,type:k,positionAbsoluteX:v.positionAbsolute.x,positionAbsoluteY:v.positionAbsolute.y,selected:m.selected??!1,selectable:M,draggable:A,deletable:m.deletable??!0,isConnectable:B,sourcePosition:m.sourcePosition,targetPosition:m.targetPosition,dragging:O,dragHandle:m.dragHandle,zIndex:v.z,parentId:m.parentId,...z})})})}var OM=b.memo(RM);const HM=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function _1(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:l,elementsSelectable:a,onError:s}=he(HM,De),i=AM(e.onlyRenderVisibleElements),r=DM();return o.jsx("div",{className:"react-flow__nodes",style:Zc,children:i.map(c=>o.jsx(OM,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:r,nodesDraggable:t,nodesConnectable:n,nodesFocusable:l,elementsSelectable:a,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}_1.displayName="NodeRenderer";const LM=b.memo(_1);function BM(e){return he(b.useCallback(n=>{if(!e)return n.edges.map(a=>a.id);const l=[];if(n.width&&n.height)for(const a of n.edges){const s=n.nodeLookup.get(a.source),i=n.nodeLookup.get(a.target);s&&i&&N4({sourceNode:s,targetNode:i,width:n.width,height:n.height,transform:n.transform})&&l.push(a.id)}return l},[e]),De)}const $M=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return o.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},UM=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return o.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},rx={[ic.Arrow]:$M,[ic.ArrowClosed]:UM};function qM(e){const t=ze();return b.useMemo(()=>{var a,s;return Object.prototype.hasOwnProperty.call(rx,e)?rx[e]:((s=(a=t.getState()).onError)==null||s.call(a,"009",Nn.error009(e)),null)},[e])}const YM=({id:e,type:t,color:n,width:l=12.5,height:a=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:r="auto-start-reverse"})=>{const c=qM(t);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${l}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:r,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:i})}):null},M1=({defaultColor:e,rfId:t})=>{const n=he(s=>s.edges),l=he(s=>s.defaultEdgeOptions),a=b.useMemo(()=>T4(n,{id:t,defaultColor:e,defaultMarkerStart:l==null?void 0:l.markerStart,defaultMarkerEnd:l==null?void 0:l.markerEnd}),[n,l,t,e]);return a.length?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:a.map(s=>o.jsx(YM,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};M1.displayName="MarkerDefinitions";var VM=b.memo(M1);function A1({x:e,y:t,label:n,labelStyle:l,labelShowBg:a=!0,labelBgStyle:s,labelBgPadding:i=[2,4],labelBgBorderRadius:r=2,children:c,className:u,...d}){const[f,h]=b.useState({x:1,y:0,width:0,height:0}),p=Ve(["react-flow__edge-textwrapper",u]),x=b.useRef(null);return b.useEffect(()=>{if(x.current){const S=x.current.getBBox();h({x:S.x,y:S.y,width:S.width,height:S.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[a&&o.jsx("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:r,ry:r}),o.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:x,style:l,children:n}),c]}):null}A1.displayName="EdgeText";const XM=b.memo(A1);function Ic({path:e,labelX:t,labelY:n,label:l,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:r,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...d,d:e,fill:"none",className:Ve(["react-flow__edge-path",d.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,l&&an(t)&&an(n)?o.jsx(XM,{x:t,y:n,label:l,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:r,labelBgBorderRadius:c}):null]})}function ox({pos:e,x1:t,y1:n,x2:l,y2:a}){return e===ee.Left||e===ee.Right?[.5*(t+l),n]:[t,.5*(n+a)]}function T1({sourceX:e,sourceY:t,sourcePosition:n=ee.Bottom,targetX:l,targetY:a,targetPosition:s=ee.Top}){const[i,r]=ox({pos:n,x1:e,y1:t,x2:l,y2:a}),[c,u]=ox({pos:s,x1:l,y1:a,x2:e,y2:t}),[d,f,h,p]=Kb({sourceX:e,sourceY:t,targetX:l,targetY:a,sourceControlX:i,sourceControlY:r,targetControlX:c,targetControlY:u});return[`M${e},${t} C${i},${r} ${c},${u} ${l},${a}`,d,f,h,p]}function D1(e){return b.memo(({id:t,sourceX:n,sourceY:l,targetX:a,targetY:s,sourcePosition:i,targetPosition:r,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:x,markerEnd:S,markerStart:w,interactionWidth:g})=>{const[y,m,v]=T1({sourceX:n,sourceY:l,sourcePosition:i,targetX:a,targetY:s,targetPosition:r}),j=e.isInternal?void 0:t;return o.jsx(Ic,{id:j,path:y,labelX:m,labelY:v,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:x,markerEnd:S,markerStart:w,interactionWidth:g})})}const GM=D1({isInternal:!1}),z1=D1({isInternal:!0});GM.displayName="SimpleBezierEdge";z1.displayName="SimpleBezierEdgeInternal";function R1(e){return b.memo(({id:t,sourceX:n,sourceY:l,targetX:a,targetY:s,label:i,labelStyle:r,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=ee.Bottom,targetPosition:x=ee.Top,markerEnd:S,markerStart:w,pathOptions:g,interactionWidth:y})=>{const[m,v,j]=pf({sourceX:n,sourceY:l,sourcePosition:p,targetX:a,targetY:s,targetPosition:x,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),k=e.isInternal?void 0:t;return o.jsx(Ic,{id:k,path:m,labelX:v,labelY:j,label:i,labelStyle:r,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:S,markerStart:w,interactionWidth:y})})}const O1=R1({isInternal:!1}),H1=R1({isInternal:!0});O1.displayName="SmoothStepEdge";H1.displayName="SmoothStepEdgeInternal";function L1(e){return b.memo(({id:t,...n})=>{var a;const l=e.isInternal?void 0:t;return o.jsx(O1,{...n,id:l,pathOptions:b.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(a=n.pathOptions)==null?void 0:a.offset])})})}const QM=L1({isInternal:!1}),B1=L1({isInternal:!0});QM.displayName="StepEdge";B1.displayName="StepEdgeInternal";function $1(e){return b.memo(({id:t,sourceX:n,sourceY:l,targetX:a,targetY:s,label:i,labelStyle:r,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:x,interactionWidth:S})=>{const[w,g,y]=Fb({sourceX:n,sourceY:l,targetX:a,targetY:s}),m=e.isInternal?void 0:t;return o.jsx(Ic,{id:m,path:w,labelX:g,labelY:y,label:i,labelStyle:r,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:x,interactionWidth:S})})}const ZM=$1({isInternal:!1}),U1=$1({isInternal:!0});ZM.displayName="StraightEdge";U1.displayName="StraightEdgeInternal";function q1(e){return b.memo(({id:t,sourceX:n,sourceY:l,targetX:a,targetY:s,sourcePosition:i=ee.Bottom,targetPosition:r=ee.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:x,markerEnd:S,markerStart:w,pathOptions:g,interactionWidth:y})=>{const[m,v,j]=Jb({sourceX:n,sourceY:l,sourcePosition:i,targetX:a,targetY:s,targetPosition:r,curvature:g==null?void 0:g.curvature}),k=e.isInternal?void 0:t;return o.jsx(Ic,{id:k,path:m,labelX:v,labelY:j,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:x,markerEnd:S,markerStart:w,interactionWidth:y})})}const IM=q1({isInternal:!1}),Y1=q1({isInternal:!0});IM.displayName="BezierEdge";Y1.displayName="BezierEdgeInternal";const cx={default:Y1,straight:U1,step:B1,smoothstep:H1,simplebezier:z1},ux={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},KM=(e,t,n)=>n===ee.Left?e-t:n===ee.Right?e+t:e,JM=(e,t,n)=>n===ee.Top?e-t:n===ee.Bottom?e+t:e,dx="react-flow__edgeupdater";function fx({position:e,centerX:t,centerY:n,radius:l=10,onMouseDown:a,onMouseEnter:s,onMouseOut:i,type:r}){return o.jsx("circle",{onMouseDown:a,onMouseEnter:s,onMouseOut:i,className:Ve([dx,`${dx}-${r}`]),cx:KM(t,l,e),cy:JM(n,l,e),r:l,stroke:"transparent",fill:"transparent"})}function WM({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:l,sourceY:a,targetX:s,targetY:i,sourcePosition:r,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const x=ze(),S=(v,j)=>{if(v.button!==0)return;const{autoPanOnConnect:k,domNode:E,connectionMode:A,connectionRadius:M,lib:B,onConnectStart:D,cancelConnection:L,nodeLookup:V,rfId:N,panBy:O,updateConnection:C}=x.getState(),z=j.type==="target",T=(X,H)=>{h(!1),f==null||f(X,n,j.type,H)},R=X=>u==null?void 0:u(n,X),Y=(X,H)=>{h(!0),d==null||d(v,n,j.type),D==null||D(X,H)};xf.onPointerDown(v.nativeEvent,{autoPanOnConnect:k,connectionMode:A,connectionRadius:M,domNode:E,handleId:j.id,nodeId:j.nodeId,nodeLookup:V,isTarget:z,edgeUpdaterType:j.type,lib:B,flowId:N,cancelConnection:L,panBy:O,isValidConnection:(...X)=>{var H,U;return((U=(H=x.getState()).isValidConnection)==null?void 0:U.call(H,...X))??!0},onConnect:R,onConnectStart:Y,onConnectEnd:(...X)=>{var H,U;return(U=(H=x.getState()).onConnectEnd)==null?void 0:U.call(H,...X)},onReconnectEnd:T,updateConnection:C,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,dragThreshold:x.getState().connectionDragThreshold,handleDomNode:v.currentTarget})},w=v=>S(v,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=v=>S(v,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),y=()=>p(!0),m=()=>p(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(fx,{position:r,centerX:l,centerY:a,radius:t,onMouseDown:w,onMouseEnter:y,onMouseOut:m,type:"source"}),(e===!0||e==="target")&&o.jsx(fx,{position:c,centerX:s,centerY:i,radius:t,onMouseDown:g,onMouseEnter:y,onMouseOut:m,type:"target"})]})}function FM({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:l,onClick:a,onDoubleClick:s,onContextMenu:i,onMouseEnter:r,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:x,edgeTypes:S,noPanClassName:w,onError:g,disableKeyboardA11y:y}){let m=he(W=>W.edgeLookup.get(e));const v=he(W=>W.defaultEdgeOptions);m=v?{...v,...m}:m;let j=m.type||"default",k=(S==null?void 0:S[j])||cx[j];k===void 0&&(g==null||g("011",Nn.error011(j)),j="default",k=(S==null?void 0:S.default)||cx.default);const E=!!(m.focusable||t&&typeof m.focusable>"u"),A=typeof f<"u"&&(m.reconnectable||n&&typeof m.reconnectable>"u"),M=!!(m.selectable||l&&typeof m.selectable>"u"),B=b.useRef(null),[D,L]=b.useState(!1),[V,N]=b.useState(!1),O=ze(),{zIndex:C,sourceX:z,sourceY:T,targetX:R,targetY:Y,sourcePosition:X,targetPosition:H}=he(b.useCallback(W=>{const F=W.nodeLookup.get(m.source),le=W.nodeLookup.get(m.target);if(!F||!le)return{zIndex:m.zIndex,...ux};const ae=A4({id:e,sourceNode:F,targetNode:le,sourceHandle:m.sourceHandle||null,targetHandle:m.targetHandle||null,connectionMode:W.connectionMode,onError:g});return{zIndex:S4({selected:m.selected,zIndex:m.zIndex,sourceNode:F,targetNode:le,elevateOnSelect:W.elevateEdgesOnSelect,zIndexMode:W.zIndexMode}),...ae||ux}},[m.source,m.target,m.sourceHandle,m.targetHandle,m.selected,m.zIndex]),De),U=b.useMemo(()=>m.markerStart?`url('#${gf(m.markerStart,x)}')`:void 0,[m.markerStart,x]),_=b.useMemo(()=>m.markerEnd?`url('#${gf(m.markerEnd,x)}')`:void 0,[m.markerEnd,x]);if(m.hidden||z===null||T===null||R===null||Y===null)return null;const $=W=>{var te;const{addSelectedEdges:F,unselectNodesAndEdges:le,multiSelectionActive:ae}=O.getState();M&&(O.setState({nodesSelectionActive:!1}),m.selected&&ae?(le({nodes:[],edges:[m]}),(te=B.current)==null||te.blur()):F([e])),a&&a(W,m)},G=s?W=>{s(W,{...m})}:void 0,q=i?W=>{i(W,{...m})}:void 0,Q=r?W=>{r(W,{...m})}:void 0,K=c?W=>{c(W,{...m})}:void 0,J=u?W=>{u(W,{...m})}:void 0,P=W=>{var F;if(!y&&Ob.includes(W.key)&&M){const{unselectNodesAndEdges:le,addSelectedEdges:ae}=O.getState();W.key==="Escape"?((F=B.current)==null||F.blur(),le({edges:[m]})):ae([e])}};return o.jsx("svg",{style:{zIndex:C},children:o.jsxs("g",{className:Ve(["react-flow__edge",`react-flow__edge-${j}`,m.className,w,{selected:m.selected,animated:m.animated,inactive:!M&&!a,updating:D,selectable:M}]),onClick:$,onDoubleClick:G,onContextMenu:q,onMouseEnter:Q,onMouseMove:K,onMouseLeave:J,onKeyDown:E?P:void 0,tabIndex:E?0:void 0,role:m.ariaRole??(E?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":m.ariaLabel===null?void 0:m.ariaLabel||`Edge from ${m.source} to ${m.target}`,"aria-describedby":E?`${x1}-${x}`:void 0,ref:B,...m.domAttributes,children:[!V&&o.jsx(k,{id:e,source:m.source,target:m.target,type:m.type,selected:m.selected,animated:m.animated,selectable:M,deletable:m.deletable??!0,label:m.label,labelStyle:m.labelStyle,labelShowBg:m.labelShowBg,labelBgStyle:m.labelBgStyle,labelBgPadding:m.labelBgPadding,labelBgBorderRadius:m.labelBgBorderRadius,sourceX:z,sourceY:T,targetX:R,targetY:Y,sourcePosition:X,targetPosition:H,data:m.data,style:m.style,sourceHandleId:m.sourceHandle,targetHandleId:m.targetHandle,markerStart:U,markerEnd:_,pathOptions:"pathOptions"in m?m.pathOptions:void 0,interactionWidth:m.interactionWidth}),A&&o.jsx(WM,{edge:m,isReconnectable:A,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:z,sourceY:T,targetX:R,targetY:Y,sourcePosition:X,targetPosition:H,setUpdateHover:L,setReconnecting:N})]})})}var PM=b.memo(FM);const eA=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function V1({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:l,noPanClassName:a,onReconnect:s,onEdgeContextMenu:i,onEdgeMouseEnter:r,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:x,disableKeyboardA11y:S}){const{edgesFocusable:w,edgesReconnectable:g,elementsSelectable:y,onError:m}=he(eA,De),v=BM(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(VM,{defaultColor:e,rfId:n}),v.map(j=>o.jsx(PM,{id:j,edgesFocusable:w,edgesReconnectable:g,elementsSelectable:y,noPanClassName:a,onReconnect:s,onContextMenu:i,onMouseEnter:r,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:x,rfId:n,onError:m,edgeTypes:l,disableKeyboardA11y:S},j))]})}V1.displayName="EdgeRenderer";const tA=b.memo(V1),nA=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function lA({children:e}){const t=he(nA);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function aA(e){const t=lp(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const sA=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function iA(e){const t=he(sA),n=ze();return b.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function rA(e){return e.connection.inProgress?{...e.connection,to:rr(e.connection.to,e.transform)}:{...e.connection}}function oA(e){return rA}function cA(e){const t=oA();return he(t,De)}const uA=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function dA({containerStyle:e,style:t,type:n,component:l}){const{nodesConnectable:a,width:s,height:i,isValid:r,inProgress:c}=he(uA,De);return!(s&&a&&c)?null:o.jsx("svg",{style:e,width:s,height:i,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:Ve(["react-flow__connection",Bb(r)]),children:o.jsx(X1,{style:t,type:n,CustomComponent:l,isValid:r})})})}const X1=({style:e,type:t=gl.Bezier,CustomComponent:n,isValid:l})=>{const{inProgress:a,from:s,fromNode:i,fromHandle:r,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=cA();if(!a)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:i,fromHandle:r,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:Bb(l),toNode:d,toHandle:f,pointer:p});let x="";const S={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case gl.Bezier:[x]=Jb(S);break;case gl.SimpleBezier:[x]=T1(S);break;case gl.Step:[x]=pf({...S,borderRadius:0});break;case gl.SmoothStep:[x]=pf(S);break;default:[x]=Fb(S)}return o.jsx("path",{d:x,fill:"none",className:"react-flow__connection-path",style:e})};X1.displayName="ConnectionLine";const fA={};function hx(e=fA){b.useRef(e),ze(),b.useEffect(()=>{},[e])}function hA(){ze(),b.useRef(!1),b.useEffect(()=>{},[])}function G1({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:l,onEdgeClick:a,onNodeDoubleClick:s,onEdgeDoubleClick:i,onNodeMouseEnter:r,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:x,connectionLineStyle:S,connectionLineComponent:w,connectionLineContainerStyle:g,selectionKeyCode:y,selectionOnDrag:m,selectionMode:v,multiSelectionKeyCode:j,panActivationKeyCode:k,zoomActivationKeyCode:E,deleteKeyCode:A,onlyRenderVisibleElements:M,elementsSelectable:B,defaultViewport:D,translateExtent:L,minZoom:V,maxZoom:N,preventScrolling:O,defaultMarkerColor:C,zoomOnScroll:z,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:Y,panOnScrollMode:X,zoomOnDoubleClick:H,panOnDrag:U,onPaneClick:_,onPaneMouseEnter:$,onPaneMouseMove:G,onPaneMouseLeave:q,onPaneScroll:Q,onPaneContextMenu:K,paneClickDistance:J,nodeClickDistance:P,onEdgeContextMenu:W,onEdgeMouseEnter:F,onEdgeMouseMove:le,onEdgeMouseLeave:ae,reconnectRadius:te,onReconnect:ge,onReconnectStart:I,onReconnectEnd:se,noDragClassName:Re,noWheelClassName:st,noPanClassName:St,disableKeyboardA11y:Ot,nodeExtent:el,rfId:_n,viewport:Jt,onViewportChange:Ht}){return hx(e),hx(t),hA(),aA(n),iA(Jt),o.jsx(_M,{onPaneClick:_,onPaneMouseEnter:$,onPaneMouseMove:G,onPaneMouseLeave:q,onPaneContextMenu:K,onPaneScroll:Q,paneClickDistance:J,deleteKeyCode:A,selectionKeyCode:y,selectionOnDrag:m,selectionMode:v,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:j,panActivationKeyCode:k,zoomActivationKeyCode:E,elementsSelectable:B,zoomOnScroll:z,zoomOnPinch:T,zoomOnDoubleClick:H,panOnScroll:R,panOnScrollSpeed:Y,panOnScrollMode:X,panOnDrag:U,defaultViewport:D,translateExtent:L,minZoom:V,maxZoom:N,onSelectionContextMenu:f,preventScrolling:O,noDragClassName:Re,noWheelClassName:st,noPanClassName:St,disableKeyboardA11y:Ot,onViewportChange:Ht,isControlledViewport:!!Jt,children:o.jsxs(lA,{children:[o.jsx(tA,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:i,onReconnect:ge,onReconnectStart:I,onReconnectEnd:se,onlyRenderVisibleElements:M,onEdgeContextMenu:W,onEdgeMouseEnter:F,onEdgeMouseMove:le,onEdgeMouseLeave:ae,reconnectRadius:te,defaultMarkerColor:C,noPanClassName:St,disableKeyboardA11y:Ot,rfId:_n}),o.jsx(dA,{style:S,type:x,component:w,containerStyle:g}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(LM,{nodeTypes:e,onNodeClick:l,onNodeDoubleClick:s,onNodeMouseEnter:r,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:P,onlyRenderVisibleElements:M,noPanClassName:St,noDragClassName:Re,disableKeyboardA11y:Ot,nodeExtent:el,rfId:_n}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}G1.displayName="GraphView";const pA=b.memo(G1),px=({nodes:e,edges:t,defaultNodes:n,defaultEdges:l,width:a,height:s,fitView:i,fitViewOptions:r,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,x=new Map,S=new Map,w=new Map,g=l??t??[],y=n??e??[],m=d??[0,0],v=f??Ri;t1(S,w,g);const{nodesInitialized:j}=mf(y,p,x,{nodeOrigin:m,nodeExtent:v,zIndexMode:h});let k=[0,0,1];if(i&&a&&s){const E=sr(p,{filter:D=>!!((D.width||D.initialWidth)&&(D.height||D.initialHeight))}),{x:A,y:M,zoom:B}=Jh(E,a,s,c,u,(r==null?void 0:r.padding)??.1);k=[A,M,B]}return{rfId:"1",width:a??0,height:s??0,transform:k,nodes:y,nodesInitialized:j,nodeLookup:p,parentLookup:x,edges:g,edgeLookup:w,connectionLookup:S,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:l!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Ri,nodeExtent:v,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:us.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:m,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:i??!1,fitViewOptions:r,fitViewResolver:null,connection:{...Lb},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:m4,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Hb,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},gA=({nodes:e,edges:t,defaultNodes:n,defaultEdges:l,width:a,height:s,fitView:i,fitViewOptions:r,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>R_((p,x)=>{async function S(){const{nodeLookup:w,panZoom:g,fitViewOptions:y,fitViewResolver:m,width:v,height:j,minZoom:k,maxZoom:E}=x();g&&(await p4({nodes:w,width:v,height:j,panZoom:g,minZoom:k,maxZoom:E},y),m==null||m.resolve(!0),p({fitViewResolver:null}))}return{...px({nodes:e,edges:t,width:a,height:s,fitView:i,fitViewOptions:r,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:l,zIndexMode:h}),setNodes:w=>{const{nodeLookup:g,parentLookup:y,nodeOrigin:m,elevateNodesOnSelect:v,fitViewQueued:j,zIndexMode:k,nodesSelectionActive:E}=x(),{nodesInitialized:A,hasSelectedNodes:M}=mf(w,g,y,{nodeOrigin:m,nodeExtent:f,elevateNodesOnSelect:v,checkEquality:!0,zIndexMode:k}),B=E&&M;j&&A?(S(),p({nodes:w,nodesInitialized:A,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:B})):p({nodes:w,nodesInitialized:A,nodesSelectionActive:B})},setEdges:w=>{const{connectionLookup:g,edgeLookup:y}=x();t1(g,y,w),p({edges:w})},setDefaultNodesAndEdges:(w,g)=>{if(w){const{setNodes:y}=x();y(w),p({hasDefaultNodes:!0})}if(g){const{setEdges:y}=x();y(g),p({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:g,nodeLookup:y,parentLookup:m,domNode:v,nodeOrigin:j,nodeExtent:k,debug:E,fitViewQueued:A,zIndexMode:M}=x(),{changes:B,updatedInternals:D}=B4(w,y,m,v,j,k,M);D&&(R4(y,m,{nodeOrigin:j,nodeExtent:k,zIndexMode:M}),A?(S(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(B==null?void 0:B.length)>0&&(E&&console.log("React Flow: trigger node changes",B),g==null||g(B)))},updateNodePositions:(w,g=!1)=>{const y=[];let m=[];const{nodeLookup:v,triggerNodeChanges:j,connection:k,updateConnection:E,onNodesChangeMiddlewareMap:A}=x();for(const[M,B]of w){const D=v.get(M),L=!!(D!=null&&D.expandParent&&(D!=null&&D.parentId)&&(B!=null&&B.position)),V={id:M,type:"position",position:L?{x:Math.max(0,B.position.x),y:Math.max(0,B.position.y)}:B.position,dragging:g};if(D&&k.inProgress&&k.fromNode.id===D.id){const N=fa(D,k.fromHandle,ee.Left,!0);E({...k,from:N})}L&&D.parentId&&y.push({id:M,parentId:D.parentId,rect:{...B.internals.positionAbsolute,width:B.measured.width??0,height:B.measured.height??0}}),m.push(V)}if(y.length>0){const{parentLookup:M,nodeOrigin:B}=x(),D=np(y,v,M,B);m.push(...D)}for(const M of A.values())m=M(m);j(m)},triggerNodeChanges:w=>{const{onNodesChange:g,setNodes:y,nodes:m,hasDefaultNodes:v,debug:j}=x();if(w!=null&&w.length){if(v){const k=b1(w,m);y(k)}j&&console.log("React Flow: trigger node changes",w),g==null||g(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:g,setEdges:y,edges:m,hasDefaultEdges:v,debug:j}=x();if(w!=null&&w.length){if(v){const k=w1(w,m);y(k)}j&&console.log("React Flow: trigger edge changes",w),g==null||g(w)}},addSelectedNodes:w=>{const{multiSelectionActive:g,edgeLookup:y,nodeLookup:m,triggerNodeChanges:v,triggerEdgeChanges:j}=x();if(g){const k=w.map(E=>Ql(E,!0));v(k);return}v(Ua(m,new Set([...w]),!0)),j(Ua(y))},addSelectedEdges:w=>{const{multiSelectionActive:g,edgeLookup:y,nodeLookup:m,triggerNodeChanges:v,triggerEdgeChanges:j}=x();if(g){const k=w.map(E=>Ql(E,!0));j(k);return}j(Ua(y,new Set([...w]))),v(Ua(m,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:g}={})=>{const{edges:y,nodes:m,nodeLookup:v,triggerNodeChanges:j,triggerEdgeChanges:k}=x(),E=w||m,A=g||y,M=[];for(const D of E){if(!D.selected)continue;const L=v.get(D.id);L&&(L.selected=!1),M.push(Ql(D.id,!1))}const B=[];for(const D of A)D.selected&&B.push(Ql(D.id,!1));j(M),k(B)},setMinZoom:w=>{const{panZoom:g,maxZoom:y}=x();g==null||g.setScaleExtent([w,y]),p({minZoom:w})},setMaxZoom:w=>{const{panZoom:g,minZoom:y}=x();g==null||g.setScaleExtent([y,w]),p({maxZoom:w})},setTranslateExtent:w=>{var g;(g=x().panZoom)==null||g.setTranslateExtent(w),p({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:g,triggerNodeChanges:y,triggerEdgeChanges:m,elementsSelectable:v}=x();if(!v)return;const j=g.reduce((E,A)=>A.selected?[...E,Ql(A.id,!1)]:E,[]),k=w.reduce((E,A)=>A.selected?[...E,Ql(A.id,!1)]:E,[]);y(j),m(k)},setNodeExtent:w=>{const{nodes:g,nodeLookup:y,parentLookup:m,nodeOrigin:v,elevateNodesOnSelect:j,nodeExtent:k,zIndexMode:E}=x();w[0][0]===k[0][0]&&w[0][1]===k[0][1]&&w[1][0]===k[1][0]&&w[1][1]===k[1][1]||(mf(g,y,m,{nodeOrigin:v,nodeExtent:w,elevateNodesOnSelect:j,checkEquality:!1,zIndexMode:E}),p({nodeExtent:w}))},panBy:w=>{const{transform:g,width:y,height:m,panZoom:v,translateExtent:j}=x();return $4({delta:w,panZoom:v,transform:g,translateExtent:j,width:y,height:m})},setCenter:async(w,g,y)=>{const{width:m,height:v,maxZoom:j,panZoom:k}=x();if(!k)return Promise.resolve(!1);const E=typeof(y==null?void 0:y.zoom)<"u"?y.zoom:j;return await k.setViewport({x:m/2-w*E,y:v/2-g*E,zoom:E},{duration:y==null?void 0:y.duration,ease:y==null?void 0:y.ease,interpolate:y==null?void 0:y.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{p({connection:{...Lb}})},updateConnection:w=>{p({connection:w})},reset:()=>p({...px()})}},Object.is);function mA({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:l,initialWidth:a,initialHeight:s,initialMinZoom:i,initialMaxZoom:r,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[x]=b.useState(()=>gA({nodes:e,edges:t,defaultNodes:n,defaultEdges:l,width:a,height:s,fitView:u,minZoom:i,maxZoom:r,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return o.jsx(O_,{value:x,children:o.jsx(lM,{children:p})})}function xA({children:e,nodes:t,edges:n,defaultNodes:l,defaultEdges:a,width:s,height:i,fitView:r,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return b.useContext(Gc)?o.jsx(o.Fragment,{children:e}):o.jsx(mA,{initialNodes:t,initialEdges:n,defaultNodes:l,defaultEdges:a,initialWidth:s,initialHeight:i,fitView:r,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const yA={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function vA({nodes:e,edges:t,defaultNodes:n,defaultEdges:l,className:a,nodeTypes:s,edgeTypes:i,onNodeClick:r,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:x,onConnectEnd:S,onClickConnectStart:w,onClickConnectEnd:g,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:j,onNodeDoubleClick:k,onNodeDragStart:E,onNodeDrag:A,onNodeDragStop:M,onNodesDelete:B,onEdgesDelete:D,onDelete:L,onSelectionChange:V,onSelectionDragStart:N,onSelectionDrag:O,onSelectionDragStop:C,onSelectionContextMenu:z,onSelectionStart:T,onSelectionEnd:R,onBeforeDelete:Y,connectionMode:X,connectionLineType:H=gl.Bezier,connectionLineStyle:U,connectionLineComponent:_,connectionLineContainerStyle:$,deleteKeyCode:G="Backspace",selectionKeyCode:q="Shift",selectionOnDrag:Q=!1,selectionMode:K=Oi.Full,panActivationKeyCode:J="Space",multiSelectionKeyCode:P=Li()?"Meta":"Control",zoomActivationKeyCode:W=Li()?"Meta":"Control",snapToGrid:F,snapGrid:le,onlyRenderVisibleElements:ae=!1,selectNodesOnDrag:te,nodesDraggable:ge,autoPanOnNodeFocus:I,nodesConnectable:se,nodesFocusable:Re,nodeOrigin:st=y1,edgesFocusable:St,edgesReconnectable:Ot,elementsSelectable:el=!0,defaultViewport:_n=I_,minZoom:Jt=.5,maxZoom:Ht=2,translateExtent:Mn=Ri,preventScrolling:Ll=!0,nodeExtent:va,defaultMarkerColor:dn="#b1b1b7",zoomOnScroll:or=!0,zoomOnPinch:Kc=!0,panOnScroll:Jc=!1,panOnScrollSpeed:Ms=.5,panOnScrollMode:cr=na.Free,zoomOnDoubleClick:Wc=!0,panOnDrag:ur=!0,onPaneClick:Fc,onPaneMouseEnter:Pc,onPaneMouseMove:eu,onPaneMouseLeave:Ie,onPaneScroll:it,onPaneContextMenu:rt,paneClickDistance:fn=1,nodeClickDistance:ht=0,children:ot,onReconnect:Lt,onReconnectStart:tl,onReconnectEnd:Xe,onEdgeContextMenu:hn,onEdgeDoubleClick:Bt,onEdgeMouseEnter:Wt,onEdgeMouseMove:Bl,onEdgeMouseLeave:$l,reconnectRadius:pn=10,onNodesChange:Ul,onEdgesChange:As,noDragClassName:K1="nodrag",noWheelClassName:J1="nowheel",noPanClassName:sp="nopan",fitView:ip,fitViewOptions:rp,connectOnClick:W1,attributionPosition:F1,proOptions:P1,defaultEdgeOptions:e2,elevateNodesOnSelect:t2=!0,elevateEdgesOnSelect:n2=!1,disableKeyboardA11y:op=!1,autoPanOnConnect:l2,autoPanOnNodeDrag:a2,autoPanSpeed:s2,connectionRadius:i2,isValidConnection:r2,onError:o2,style:c2,id:cp,nodeDragThreshold:u2,connectionDragThreshold:d2,viewport:f2,onViewportChange:h2,width:p2,height:g2,colorMode:m2="light",debug:x2,onScroll:dr,ariaLabelConfig:y2,zIndexMode:up="basic",...v2},b2){const tu=cp||"1",w2=F_(m2),S2=b.useCallback(dp=>{dp.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),dr==null||dr(dp)},[dr]);return o.jsx("div",{"data-testid":"rf__wrapper",...v2,onScroll:S2,style:{...c2,...yA},ref:b2,className:Ve(["react-flow",a,w2]),id:cp,role:"application",children:o.jsxs(xA,{nodes:e,edges:t,width:p2,height:g2,fitView:ip,fitViewOptions:rp,minZoom:Jt,maxZoom:Ht,nodeOrigin:st,nodeExtent:va,zIndexMode:up,children:[o.jsx(W_,{nodes:e,edges:t,defaultNodes:n,defaultEdges:l,onConnect:p,onConnectStart:x,onConnectEnd:S,onClickConnectStart:w,onClickConnectEnd:g,nodesDraggable:ge,autoPanOnNodeFocus:I,nodesConnectable:se,nodesFocusable:Re,edgesFocusable:St,edgesReconnectable:Ot,elementsSelectable:el,elevateNodesOnSelect:t2,elevateEdgesOnSelect:n2,minZoom:Jt,maxZoom:Ht,nodeExtent:va,onNodesChange:Ul,onEdgesChange:As,snapToGrid:F,snapGrid:le,connectionMode:X,translateExtent:Mn,connectOnClick:W1,defaultEdgeOptions:e2,fitView:ip,fitViewOptions:rp,onNodesDelete:B,onEdgesDelete:D,onDelete:L,onNodeDragStart:E,onNodeDrag:A,onNodeDragStop:M,onSelectionDrag:O,onSelectionDragStart:N,onSelectionDragStop:C,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:sp,nodeOrigin:st,rfId:tu,autoPanOnConnect:l2,autoPanOnNodeDrag:a2,autoPanSpeed:s2,onError:o2,connectionRadius:i2,isValidConnection:r2,selectNodesOnDrag:te,nodeDragThreshold:u2,connectionDragThreshold:d2,onBeforeDelete:Y,debug:x2,ariaLabelConfig:y2,zIndexMode:up}),o.jsx(pA,{onInit:u,onNodeClick:r,onEdgeClick:c,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:j,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:i,connectionLineType:H,connectionLineStyle:U,connectionLineComponent:_,connectionLineContainerStyle:$,selectionKeyCode:q,selectionOnDrag:Q,selectionMode:K,deleteKeyCode:G,multiSelectionKeyCode:P,panActivationKeyCode:J,zoomActivationKeyCode:W,onlyRenderVisibleElements:ae,defaultViewport:_n,translateExtent:Mn,minZoom:Jt,maxZoom:Ht,preventScrolling:Ll,zoomOnScroll:or,zoomOnPinch:Kc,zoomOnDoubleClick:Wc,panOnScroll:Jc,panOnScrollSpeed:Ms,panOnScrollMode:cr,panOnDrag:ur,onPaneClick:Fc,onPaneMouseEnter:Pc,onPaneMouseMove:eu,onPaneMouseLeave:Ie,onPaneScroll:it,onPaneContextMenu:rt,paneClickDistance:fn,nodeClickDistance:ht,onSelectionContextMenu:z,onSelectionStart:T,onSelectionEnd:R,onReconnect:Lt,onReconnectStart:tl,onReconnectEnd:Xe,onEdgeContextMenu:hn,onEdgeDoubleClick:Bt,onEdgeMouseEnter:Wt,onEdgeMouseMove:Bl,onEdgeMouseLeave:$l,reconnectRadius:pn,defaultMarkerColor:dn,noDragClassName:K1,noWheelClassName:J1,noPanClassName:sp,rfId:tu,disableKeyboardA11y:op,nodeExtent:va,viewport:f2,onViewportChange:h2}),o.jsx(Z_,{onSelectionChange:V}),ot,o.jsx(Y_,{proOptions:P1,position:F1}),o.jsx(q_,{rfId:tu,disableKeyboardA11y:op})]})})}var bA=S1(vA);function wA(e){const[t,n]=b.useState(e),l=b.useCallback(a=>n(s=>b1(a,s)),[]);return[t,n,l]}function SA(e){const[t,n]=b.useState(e),l=b.useCallback(a=>n(s=>w1(a,s)),[]);return[t,n,l]}function NA({dimensions:e,lineWidth:t,variant:n,className:l}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Ve(["react-flow__background-pattern",n,l])})}function jA({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Ve(["react-flow__background-pattern","dots",t])})}var Gn;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Gn||(Gn={}));const kA={[Gn.Dots]:1,[Gn.Lines]:1,[Gn.Cross]:6},EA=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Q1({id:e,variant:t=Gn.Dots,gap:n=20,size:l,lineWidth:a=1,offset:s=0,color:i,bgColor:r,style:c,className:u,patternClassName:d}){const f=b.useRef(null),{transform:h,patternId:p}=he(EA,De),x=l||kA[t],S=t===Gn.Dots,w=t===Gn.Cross,g=Array.isArray(n)?n:[n,n],y=[g[0]*h[2]||1,g[1]*h[2]||1],m=x*h[2],v=Array.isArray(s)?s:[s,s],j=w?[m,m]:y,k=[v[0]*h[2]||1+j[0]/2,v[1]*h[2]||1+j[1]/2],E=`${p}${e||""}`;return o.jsxs("svg",{className:Ve(["react-flow__background",u]),style:{...c,...Zc,"--xy-background-color-props":r,"--xy-background-pattern-color-props":i},ref:f,"data-testid":"rf__background",children:[o.jsx("pattern",{id:E,x:h[0]%y[0],y:h[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:S?o.jsx(jA,{radius:m/2,className:d}):o.jsx(NA,{dimensions:j,lineWidth:a,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${E})`})]})}Q1.displayName="Background";const CA=b.memo(Q1);function _A(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function MA(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function AA(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.jsx("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 TA(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.jsx("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 DA(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.jsx("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"})})}function Yr({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Ve(["react-flow__controls-button",t]),...n,children:e})}const zA=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Z1({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:l=!0,fitViewOptions:a,onZoomIn:s,onZoomOut:i,onFitView:r,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const x=ze(),{isInteractive:S,minZoomReached:w,maxZoomReached:g,ariaLabelConfig:y}=he(zA,De),{zoomIn:m,zoomOut:v,fitView:j}=lp(),k=()=>{m(),s==null||s()},E=()=>{v(),i==null||i()},A=()=>{j(a),r==null||r()},M=()=>{x.setState({nodesDraggable:!S,nodesConnectable:!S,elementsSelectable:!S}),c==null||c(!S)},B=h==="horizontal"?"horizontal":"vertical";return o.jsxs(Qc,{className:Ve(["react-flow__controls",B,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??y["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(Yr,{onClick:k,className:"react-flow__controls-zoomin",title:y["controls.zoomIn.ariaLabel"],"aria-label":y["controls.zoomIn.ariaLabel"],disabled:g,children:o.jsx(_A,{})}),o.jsx(Yr,{onClick:E,className:"react-flow__controls-zoomout",title:y["controls.zoomOut.ariaLabel"],"aria-label":y["controls.zoomOut.ariaLabel"],disabled:w,children:o.jsx(MA,{})})]}),n&&o.jsx(Yr,{className:"react-flow__controls-fitview",onClick:A,title:y["controls.fitView.ariaLabel"],"aria-label":y["controls.fitView.ariaLabel"],children:o.jsx(AA,{})}),l&&o.jsx(Yr,{className:"react-flow__controls-interactive",onClick:M,title:y["controls.interactive.ariaLabel"],"aria-label":y["controls.interactive.ariaLabel"],children:S?o.jsx(DA,{}):o.jsx(TA,{})}),d]})}Z1.displayName="Controls";const RA=b.memo(Z1);function OA({id:e,x:t,y:n,width:l,height:a,style:s,color:i,strokeColor:r,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:x,backgroundColor:S}=s||{},w=i||x||S;return o.jsx("rect",{className:Ve(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:l,height:a,style:{fill:w,stroke:r,strokeWidth:c},shapeRendering:f,onClick:p?g=>p(g,e):void 0})}const HA=b.memo(OA),LA=e=>e.nodes.map(t=>t.id),Pu=e=>e instanceof Function?e:()=>e;function BA({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:l=5,nodeStrokeWidth:a,nodeComponent:s=HA,onClick:i}){const r=he(LA,De),c=Pu(t),u=Pu(e),d=Pu(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:r.map(h=>o.jsx(UA,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:l,nodeStrokeWidth:a,NodeComponent:s,onClick:i,shapeRendering:f},h))})}function $A({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:l,nodeBorderRadius:a,nodeStrokeWidth:s,shapeRendering:i,NodeComponent:r,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=he(x=>{const S=x.nodeLookup.get(e);if(!S)return{node:void 0,x:0,y:0,width:0,height:0};const w=S.internals.userNode,{x:g,y}=S.internals.positionAbsolute,{width:m,height:v}=Pn(w);return{node:w,x:g,y,width:m,height:v}},De);return!u||u.hidden||!Xb(u)?null:o.jsx(r,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:l(u),color:t(u),borderRadius:a,strokeColor:n(u),strokeWidth:s,shapeRendering:i,onClick:c,id:u.id})}const UA=b.memo($A);var qA=b.memo(BA);const YA=200,VA=150,XA=e=>!e.hidden,GA=e=>{const t={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:t,boundingRect:e.nodeLookup.size>0?Vb(sr(e.nodeLookup,{filter:XA}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},QA="react-flow__minimap-desc";function I1({style:e,className:t,nodeStrokeColor:n,nodeColor:l,nodeClassName:a="",nodeBorderRadius:s=5,nodeStrokeWidth:i,nodeComponent:r,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:x,pannable:S=!1,zoomable:w=!1,ariaLabel:g,inversePan:y,zoomStep:m=1,offsetScale:v=5}){const j=ze(),k=b.useRef(null),{boundingRect:E,viewBB:A,rfId:M,panZoom:B,translateExtent:D,flowWidth:L,flowHeight:V,ariaLabelConfig:N}=he(GA,De),O=(e==null?void 0:e.width)??YA,C=(e==null?void 0:e.height)??VA,z=E.width/O,T=E.height/C,R=Math.max(z,T),Y=R*O,X=R*C,H=v*R,U=E.x-(Y-E.width)/2-H,_=E.y-(X-E.height)/2-H,$=Y+H*2,G=X+H*2,q=`${QA}-${M}`,Q=b.useRef(0),K=b.useRef();Q.current=R,b.useEffect(()=>{if(k.current&&B)return K.current=I4({domNode:k.current,panZoom:B,getTransform:()=>j.getState().transform,getViewScale:()=>Q.current}),()=>{var F;(F=K.current)==null||F.destroy()}},[B]),b.useEffect(()=>{var F;(F=K.current)==null||F.update({translateExtent:D,width:L,height:V,inversePan:y,pannable:S,zoomStep:m,zoomable:w})},[S,w,y,m,D,L,V]);const J=p?F=>{var te;const[le,ae]=((te=K.current)==null?void 0:te.pointer(F))||[0,0];p(F,{x:le,y:ae})}:void 0,P=x?b.useCallback((F,le)=>{const ae=j.getState().nodeLookup.get(le).internals.userNode;x(F,ae)},[]):void 0,W=g??N["minimap.ariaLabel"];return o.jsx(Qc,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*R:void 0,"--xy-minimap-node-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof i=="number"?i:void 0},className:Ve(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:O,height:C,viewBox:`${U} ${_} ${$} ${G}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":q,ref:k,onClick:J,children:[W&&o.jsx("title",{id:q,children:W}),o.jsx(qA,{onClick:P,nodeColor:l,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:a,nodeStrokeWidth:i,nodeComponent:r}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${U-H},${_-H}h${$+H*2}v${G+H*2}h${-$-H*2}z
165
+ M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}I1.displayName="MiniMap";const ZA=b.memo(I1),IA=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,KA={[ps.Line]:"right",[ps.Handle]:"bottom-right"};function JA({nodeId:e,position:t,variant:n=ps.Handle,className:l,style:a=void 0,children:s,color:i,minWidth:r=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:x,onResizeStart:S,onResize:w,onResizeEnd:g}){const y=E1(),m=typeof e=="string"?e:y,v=ze(),j=b.useRef(null),k=n===ps.Handle,E=he(b.useCallback(IA(k&&p),[k,p]),De),A=b.useRef(null),M=t??KA[n];b.useEffect(()=>{if(!(!j.current||!m))return A.current||(A.current=o_({domNode:j.current,nodeId:m,getStoreItems:()=>{const{nodeLookup:D,transform:L,snapGrid:V,snapToGrid:N,nodeOrigin:O,domNode:C}=v.getState();return{nodeLookup:D,transform:L,snapGrid:V,snapToGrid:N,nodeOrigin:O,paneDomNode:C}},onChange:(D,L)=>{const{triggerNodeChanges:V,nodeLookup:N,parentLookup:O,nodeOrigin:C}=v.getState(),z=[],T={x:D.x,y:D.y},R=N.get(m);if(R&&R.expandParent&&R.parentId){const Y=R.origin??C,X=D.width??R.measured.width??0,H=D.height??R.measured.height??0,U={id:R.id,parentId:R.parentId,rect:{width:X,height:H,...Gb({x:D.x??R.position.x,y:D.y??R.position.y},{width:X,height:H},R.parentId,N,Y)}},_=np([U],N,O,C);z.push(..._),T.x=D.x?Math.max(Y[0]*X,D.x):void 0,T.y=D.y?Math.max(Y[1]*H,D.y):void 0}if(T.x!==void 0&&T.y!==void 0){const Y={id:m,type:"position",position:{...T}};z.push(Y)}if(D.width!==void 0&&D.height!==void 0){const X={id:m,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};z.push(X)}for(const Y of L){const X={...Y,type:"position"};z.push(X)}V(z)},onEnd:({width:D,height:L})=>{const V={id:m,type:"dimensions",resizing:!1,dimensions:{width:D,height:L}};v.getState().triggerNodeChanges([V])}})),A.current.update({controlPosition:M,boundaries:{minWidth:r,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:S,onResize:w,onResizeEnd:g,shouldResize:x}),()=>{var D;(D=A.current)==null||D.destroy()}},[M,r,c,u,d,f,S,w,g,x]);const B=M.split("-");return o.jsx("div",{className:Ve(["react-flow__resize-control","nodrag",...B,n,l]),ref:j,style:{...a,scale:E,...i&&{[k?"backgroundColor":"borderColor"]:i}},children:s})}b.memo(JA);const mn={concepts:{fill:"#f75858",light:"#ff9090",dark:"#be3232",glowRgb:"254,0,0",edgeColor:"rgba(254,0,0,0.55)",hex:"#f75858"},entities:{fill:"#5e89e0",light:"#8cb4ff",dark:"#3658b4",glowRgb:"16,96,255",edgeColor:"rgba(16,96,255,0.55)",hex:"#5e89e0"},summaries:{fill:"#bd68bd",light:"#dc8cdc",dark:"#460f46",glowRgb:"171,49,170",edgeColor:"rgba(171,49,170,0.55)",hex:"#bd68bd"},other:{fill:"#24b550",light:"#82e6a0",dark:"#0c5023",glowRgb:"36,181,80",edgeColor:"rgba(36,181,80,0.55)",hex:"#24b550"}};function ed(e){return mn[e.toLowerCase()]??mn.other}function WA(e,t,n=150){const l=e.length,a=new Map,s=new Map,i=Math.min(600,Math.max(150,l*40));e.forEach((c,u)=>{const d=u/l*2*Math.PI;a.set(c.slug,{x:400+i*Math.cos(d),y:400+i*Math.sin(d)}),s.set(c.slug,{vx:0,vy:0})});const r=e.map(c=>c.slug);for(let c=0;c<n;c++){for(let u=0;u<r.length;u++)for(let d=u+1;d<r.length;d++){const f=r[u],h=r[d],p=a.get(f),x=a.get(h),S=x.x-p.x,w=x.y-p.y,g=Math.max(1,S*S+w*w),y=Math.sqrt(g),m=18e3/g,v=S/y*m,j=w/y*m,k=s.get(f),E=s.get(h);k.vx-=v,k.vy-=j,E.vx+=v,E.vy+=j}for(const u of t){const d=a.get(u.source),f=a.get(u.target);if(!d||!f)continue;const h=f.x-d.x,p=f.y-d.y,x=Math.max(1,Math.sqrt(h*h+p*p)),S=x*.02,w=h/x*S,g=p/x*S,y=s.get(u.source),m=s.get(u.target);y&&(y.vx+=w,y.vy+=g),m&&(m.vx-=w,m.vy-=g)}for(const u of r){const d=a.get(u),f=s.get(u);f.vx=Math.max(-20,Math.min(20,f.vx)),f.vy=Math.max(-20,Math.min(20,f.vy)),d.x+=f.vx,d.y+=f.vy,f.vx*=.85,f.vy*=.85}}return a}const FA=5,PA=9;function eT(e){const t=e.data,n=t.radius,l=t.degree,a=t.dimmed,s=t.hovered,i=t.glowRgb,r=t.fill,c=l>=FA,u=l>=PA,d=a?"none":s?`0 0 0 1.5px rgba(${i},0.8), 0 0 10px rgba(${i},1), 0 0 24px rgba(${i},0.7), 0 0 44px rgba(${i},0.3), 0 0 70px rgba(${i},0.12)`:`0 0 0 1px rgba(${i},0.35), 0 0 7px rgba(${i},0.65), 0 0 18px rgba(${i},0.25)`,f=s?"scale(1.28)":"scale(1)";return o.jsxs("div",{style:{position:"relative",width:n*2,height:n*2},children:[c&&!a&&o.jsx("div",{style:{position:"absolute",inset:-(n*.55),borderRadius:"50%",background:`radial-gradient(circle, rgba(${i},0.08) 0%, transparent 70%)`,pointerEvents:"none"}}),c&&!a&&o.jsx("div",{style:{position:"absolute",inset:-(n*.45),borderRadius:"50%",border:`1.5px solid rgba(${i},0.5)`,animation:"wikiNodePulse 2.6s cubic-bezier(0.4,0,0.6,1) infinite",pointerEvents:"none"}}),u&&!a&&o.jsx("div",{style:{position:"absolute",inset:-(n*.8),borderRadius:"50%",border:`1px solid rgba(${i},0.28)`,animation:"wikiNodePulse 3.8s cubic-bezier(0.4,0,0.6,1) infinite 1.1s",pointerEvents:"none"}}),o.jsxs("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:`radial-gradient(circle at 33% 28%, ${t.light} 0%, ${r} 52%, ${t.dark} 100%)`,boxShadow:d,opacity:a?.06:1,transform:f,transition:"transform 0.22s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s ease, opacity 0.18s ease",overflow:"hidden"},children:[o.jsx("div",{style:{position:"absolute",top:"9%",left:"14%",width:"38%",height:"38%",borderRadius:"50%",background:"radial-gradient(circle, rgba(255,255,255,0.62) 0%, rgba(255,255,255,0.1) 55%, transparent 100%)",pointerEvents:"none"}}),o.jsx("div",{style:{position:"absolute",bottom:"10%",right:"12%",width:"22%",height:"22%",borderRadius:"50%",background:"radial-gradient(circle, rgba(255,255,255,0.18) 0%, transparent 100%)",pointerEvents:"none"}})]}),!a&&o.jsx("div",{style:{position:"absolute",top:n*2+5,left:"50%",transform:"translateX(-50%)",whiteSpace:"nowrap",maxWidth:128,overflow:"hidden",textOverflow:"ellipsis",fontSize:s?10:9,fontWeight:s?600:400,color:s?r:"var(--text2)",background:"color-mix(in srgb, var(--bg) 78%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",padding:"1px 6px 2px",borderRadius:5,border:s?`1px solid rgba(${i},0.4)`:"1px solid transparent",boxShadow:s?`0 0 8px rgba(${i},0.3)`:"none",transition:"all 0.2s ease",fontFamily:"inherit",letterSpacing:s?"0.025em":"normal",pointerEvents:"none"},children:t.title}),o.jsx(ms,{type:"target",position:ee.Left,style:{opacity:0,pointerEvents:"none"}}),o.jsx(ms,{type:"source",position:ee.Right,style:{opacity:0,pointerEvents:"none"}})]})}const tT={wikiNode:eT},nT=[{label:"Concepts",color:mn.concepts.fill,rgb:mn.concepts.glowRgb},{label:"Entities",color:mn.entities.fill,rgb:mn.entities.glowRgb},{label:"Summaries",color:mn.summaries.fill,rgb:mn.summaries.glowRgb},{label:"Other",color:mn.other.fill,rgb:mn.other.glowRgb}];function lT({graphData:e,loading:t,onNodeClick:n}){const{initNodes:l,initEdges:a,adjacency:s}=b.useMemo(()=>{var E,A;const S=(e==null?void 0:e.nodes)??[],w=(e==null?void 0:e.edges)??[];if(S.length===0)return{initNodes:[],initEdges:[],adjacency:new Map};const g=new Map,y=new Map;for(const M of S)g.set(M.slug,0),y.set(M.slug,M.category);for(const M of w)g.set(M.source,(g.get(M.source)??0)+1),g.set(M.target,(g.get(M.target)??0)+1);const m=new Map;for(const M of S)m.set(M.slug,new Set);for(const M of w)(E=m.get(M.source))==null||E.add(M.target),(A=m.get(M.target))==null||A.add(M.source);const v=WA(S,w,150),j=S.map(M=>{const B=g.get(M.slug)??0,D=Math.min(11,Math.max(4,4+B*.8)),L=v.get(M.slug)??{x:400,y:400},V=ed(M.category);return{id:M.slug,type:"wikiNode",position:L,data:{slug:M.slug,title:M.title||(M.slug.split("/").pop()??M.slug),category:M.category,fill:V.fill,light:V.light,dark:V.dark,glowRgb:V.glowRgb,radius:D,degree:B,dimmed:!1,hovered:!1}}}),k=w.map((M,B)=>{const D=ed(y.get(M.source)??"other");return{id:`e${B}-${M.source}-${M.target}`,source:M.source,target:M.target,type:"straight",animated:!0,style:{stroke:D.edgeColor,strokeWidth:1.3,opacity:.85}}});return{initNodes:j,initEdges:k,adjacency:m}},[e]),[i,r,c]=wA(l),[u,d,f]=SA(a);b.useEffect(()=>{r(l),d(a)},[l,a,r,d]);const h=b.useCallback((S,w)=>{n(w.id)},[n]),p=b.useCallback((S,w)=>{const g=w.id,y=new Set([g,...s.get(g)??[]]);r(m=>m.map(v=>({...v,data:{...v.data,dimmed:!y.has(v.id),hovered:v.id===g}}))),d(m=>m.map(v=>({...v,style:{...v.style??{},opacity:y.has(v.source)&&y.has(v.target)?1:.05}})))},[s,r,d]),x=b.useCallback(()=>{r(S=>S.map(w=>({...w,data:{...w.data,dimmed:!1,hovered:!1}}))),d(S=>S.map(w=>({...w,style:{...w.style??{},opacity:.85}})))},[r,d]);return t?o.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",style:{color:"var(--muted)"},children:[o.jsx("div",{style:{width:36,height:36,border:"2.5px solid var(--b2)",borderTopColor:"var(--gold)",borderRadius:"50%",animation:"wikiSpin 0.75s linear infinite",boxShadow:"0 0 12px rgba(224,175,104,0.35)"}}),o.jsx("span",{className:"text-[11px]",children:"Building knowledge graph…"})]}):!e||e.nodes.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center",children:[o.jsx("div",{style:{width:56,height:56,borderRadius:"50%",background:"radial-gradient(circle at 35% 30%, var(--s3), var(--s1))",border:"1px solid var(--b1)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 0 24px rgba(224,175,104,0.08)"},children:o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",style:{color:"var(--gold)",opacity:.5},children:[o.jsx("circle",{cx:"12",cy:"12",r:"2.5"}),o.jsx("circle",{cx:"4.5",cy:"4.5",r:"1.5"}),o.jsx("circle",{cx:"19.5",cy:"4.5",r:"1.5"}),o.jsx("circle",{cx:"4.5",cy:"19.5",r:"1.5"}),o.jsx("circle",{cx:"19.5",cy:"19.5",r:"1.5"}),o.jsx("line",{x1:"12",y1:"9.5",x2:"5.5",y2:"5.5"}),o.jsx("line",{x1:"12",y1:"9.5",x2:"18.5",y2:"5.5"}),o.jsx("line",{x1:"12",y1:"14.5",x2:"5.5",y2:"18.5"}),o.jsx("line",{x1:"12",y1:"14.5",x2:"18.5",y2:"18.5"})]})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--fg)"},children:"Graph is empty"}),o.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--muted)"},children:"Ingest documents to build the knowledge graph"})]}),o.jsx("div",{className:"text-[10px] font-mono px-3 py-1.5 rounded-lg",style:{background:"var(--s2)",color:"var(--muted)",border:"1px solid var(--b1)",letterSpacing:"0.02em"},children:"ingest plans/spec.md into the wiki"})]}):o.jsxs("div",{style:{width:"100%",height:"100%",position:"relative",background:"var(--bg)"},children:[o.jsxs(bA,{nodes:i,edges:u,onNodesChange:c,onEdgesChange:f,nodeTypes:tT,onNodeClick:h,onNodeMouseEnter:p,onNodeMouseLeave:x,fitView:!0,fitViewOptions:{padding:.2},colorMode:"dark",proOptions:{hideAttribution:!0},style:{background:"var(--bg)"},nodesDraggable:!0,nodesConnectable:!1,elementsSelectable:!1,children:[o.jsx(CA,{variant:Gn.Dots,gap:26,size:1.2,color:"var(--b1)"}),o.jsx(RA,{}),o.jsx(ZA,{nodeColor:S=>ed(S.data.category).hex,maskColor:"color-mix(in srgb, var(--s1) 75%, transparent)",style:{background:"color-mix(in srgb, var(--s2) 90%, transparent)",backdropFilter:"blur(8px)",border:"1px solid color-mix(in srgb, var(--b2) 50%, transparent)",borderRadius:10,boxShadow:"0 4px 20px rgba(0,0,0,0.35)"}})]}),o.jsx("div",{style:{position:"absolute",inset:0,background:["radial-gradient(ellipse 75% 75% at 50% 50%, transparent 25%, color-mix(in srgb, var(--s1) 65%, transparent) 100%)","radial-gradient(circle at 25% 80%, rgba(224,175,104,0.03) 0%, transparent 50%)"].join(", "),pointerEvents:"none",zIndex:3}}),o.jsx("div",{style:{position:"absolute",bottom:14,left:14,zIndex:10,display:"flex",flexDirection:"column",gap:6,background:"color-mix(in srgb, var(--s2) 88%, transparent)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",border:"1px solid color-mix(in srgb, var(--b2) 45%, transparent)",borderRadius:11,padding:"9px 13px",pointerEvents:"none",boxShadow:"0 4px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04)"},children:nT.map(({label:S,color:w,rgb:g})=>o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:w,boxShadow:`0 0 6px rgba(${g},0.7)`,flexShrink:0}}),o.jsx("span",{style:{fontSize:10,color:"var(--text2)",fontFamily:"inherit",letterSpacing:"0.02em"},children:S})]},S))}),o.jsxs("div",{style:{position:"absolute",top:12,left:"50%",transform:"translateX(-50%)",zIndex:10,display:"flex",alignItems:"center",gap:8,background:"color-mix(in srgb, var(--s2) 88%, transparent)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",border:"1px solid color-mix(in srgb, var(--b2) 40%, transparent)",borderRadius:20,padding:"3px 12px",pointerEvents:"none",boxShadow:"0 2px 12px rgba(0,0,0,0.25)"},children:[o.jsxs("span",{style:{fontSize:10,color:"var(--text2)",fontFamily:"inherit",letterSpacing:"0.04em"},children:[o.jsx("span",{style:{color:"var(--gold)",fontWeight:600},children:e.nodes.length})," ","nodes"]}),o.jsx("div",{style:{width:1,height:10,background:"var(--b2)"}}),o.jsxs("span",{style:{fontSize:10,color:"var(--text2)",fontFamily:"inherit",letterSpacing:"0.04em"},children:[o.jsx("span",{style:{color:"var(--gold)",fontWeight:600},children:e.edges.length})," ","connections"]})]})]})}function aT({rpc:e,className:t}){const{ws:n}=En(),[l,a]=b.useState([]),[s,i]=b.useState(!0),[r,c]=b.useState("browse"),u=b.useRef("browse");u.current=r;const[d,f]=b.useState(null),[h,p]=b.useState(null),[x,S]=b.useState(!1),[w,g]=b.useState(""),[y,m]=b.useState([]),[v,j]=b.useState(!1),[k,E]=b.useState(null),[A,M]=b.useState(!1),[B,D]=b.useState(null),[L,V]=b.useState(null),[N,O]=b.useState(!1),C=b.useCallback(async(U=!1)=>{if(e){U||O(!0);try{const _=await e.wikiGraph();V(_??{nodes:[],edges:[]})}catch{V({nodes:[],edges:[]})}finally{U||O(!1)}}},[e]),z=b.useCallback(async(U=!1)=>{if(e){U||i(!0),D(null);try{const _=await e.wikiListPages();a((_==null?void 0:_.pages)??[])}catch(_){D(_ instanceof Error?_.message:"Failed to load wiki")}finally{U||i(!1)}}},[e]);b.useEffect(()=>{z()},[z]),b.useEffect(()=>{if(n)return n.on("wiki-op",()=>{z(!0),u.current==="graph"&&C(!0)})},[n,z,C]);const T=b.useCallback(async U=>{if(e){f(U),c("page"),S(!0),p(null);try{const _=await e.wikiPageGet(U);p((_==null?void 0:_.content)??(_==null?void 0:_.error)??"Empty page")}catch(_){p(_ instanceof Error?_.message:"Error loading page")}finally{S(!1)}}},[e]),R=b.useCallback(async()=>{if(!(!e||!w.trim())){j(!0),m([]);try{const U=await e.wikiSearch(w);m(U??[])}finally{j(!1)}}},[e,w]),Y=b.useCallback(async()=>{if(e){c("lint"),M(!0),E(null);try{const U=await e.wikiLint();E(U??{orphanPages:[],brokenLinks:[],missingFromIndex:[],staleFrontmatter:[]})}finally{M(!1)}}},[e]),X=l.reduce((U,_)=>{const $=_.category||"Other";return(U[$]??(U[$]=[])).push(_),U},{}),H=k?k.orphanPages.length+k.brokenLinks.length+k.missingFromIndex.length+k.staleFrontmatter.length:null;return o.jsxs("div",{className:`flex flex-col h-full ${t??""}`,children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:[o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",style:{color:"var(--gold)",flexShrink:0},children:[o.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),o.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]}),o.jsx("span",{className:"text-[13px] font-semibold font-display",style:{color:"var(--cream)"},children:"Wiki"}),o.jsxs("span",{className:"text-[11px] font-mono",style:{color:"var(--muted)"},children:[l.length," pages"]}),o.jsx("div",{className:"flex-1"}),o.jsx("button",{onClick:()=>c("browse"),className:"px-2.5 py-1 rounded-lg text-[11px] font-semibold transition-all duration-150 cursor-pointer",style:{background:r==="browse"?"var(--s3)":"transparent",color:r==="browse"?"var(--gold)":"var(--muted)",border:r==="browse"?"1px solid var(--b2)":"1px solid transparent"},children:"Browse"}),o.jsx("button",{onClick:()=>c("search"),className:"px-2.5 py-1 rounded-lg text-[11px] font-semibold transition-all duration-150 cursor-pointer",style:{background:r==="search"?"var(--s3)":"transparent",color:r==="search"?"var(--gold)":"var(--muted)",border:r==="search"?"1px solid var(--b2)":"1px solid transparent"},children:"Search"}),o.jsxs("button",{onClick:Y,className:"px-2.5 py-1 rounded-lg text-[11px] font-semibold transition-all duration-150 cursor-pointer flex items-center gap-1",style:{background:r==="lint"?"var(--s3)":"transparent",color:r==="lint"?"var(--gold)":"var(--muted)",border:r==="lint"?"1px solid var(--b2)":"1px solid transparent"},children:["Lint",H!==null&&H>0&&o.jsx("span",{className:"rounded-full w-4 h-4 flex items-center justify-center text-[9px] font-bold",style:{background:"var(--red)",color:"#fff"},children:H})]}),o.jsx("button",{onClick:()=>{c("graph"),!L&&!N&&C()},className:"px-2.5 py-1 rounded-lg text-[11px] font-semibold transition-all duration-150 cursor-pointer",style:{background:r==="graph"?"var(--s3)":"transparent",color:r==="graph"?"var(--gold)":"var(--muted)",border:r==="graph"?"1px solid var(--b2)":"1px solid transparent"},children:"Graph"}),o.jsx("button",{onClick:()=>z(),className:"flex items-center justify-center w-7 h-7 rounded-lg transition-all duration-150 cursor-pointer",style:{color:"var(--muted)",border:"1px solid transparent"},title:"Refresh",children:o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("polyline",{points:"23 4 23 10 17 10"}),o.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})})]}),r==="graph"&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(lT,{graphData:L,loading:N,onNodeClick:T})}),o.jsxs("div",{className:`flex-1 min-h-0 overflow-y-auto px-4 py-3 scrollbar-thin${r==="graph"?" hidden":""}`,children:[r==="browse"&&o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center justify-center h-32 text-xs",style:{color:"var(--muted)"},children:"Loading…"}),B&&o.jsx("div",{className:"text-xs px-3 py-2 rounded-lg",style:{background:"color-mix(in srgb, var(--red) 10%, transparent)",color:"var(--red)",border:"1px solid color-mix(in srgb, var(--red) 20%, transparent)"},children:B}),!s&&!B&&l.length===0&&o.jsxs("div",{className:"flex flex-col items-center justify-center h-48 gap-3 text-center",children:[o.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",style:{color:"var(--muted)",opacity:.4},children:[o.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),o.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[12px] font-semibold",style:{color:"var(--fg)"},children:"Wiki is empty"}),o.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--muted)"},children:"Ask the agent to ingest a document to get started"})]}),o.jsx("div",{className:"text-[10px] font-mono px-3 py-1.5 rounded-lg",style:{background:"var(--s2)",color:"var(--muted)",border:"1px solid var(--b1)"},children:"ingest plans/spec.md into the wiki"})]}),!s&&Object.entries(X).map(([U,_])=>o.jsxs("div",{className:"mb-4",children:[o.jsx("div",{className:"text-[10px] font-mono uppercase tracking-widest mb-1.5 px-1",style:{color:"var(--muted)"},children:U}),o.jsx("div",{className:"space-y-1",children:_.map($=>o.jsxs("button",{onClick:()=>T($.slug),className:"w-full text-left px-3 py-2 rounded-lg transition-all duration-150 cursor-pointer active:scale-[0.99]",style:{background:"var(--s2)",border:"1px solid var(--b1)",color:"var(--fg)"},children:[o.jsx("div",{className:"text-[12px] font-medium truncate",children:$.title||$.slug.split("/").pop()}),o.jsx("div",{className:"text-[10px] font-mono mt-0.5 truncate",style:{color:"var(--muted)"},children:$.slug})]},$.slug))})]},U))]}),r==="page"&&o.jsxs("div",{children:[o.jsxs("button",{onClick:()=>c("browse"),className:"flex items-center gap-1.5 text-[11px] mb-3 cursor-pointer transition-colors duration-100",style:{color:"var(--muted)"},children:[o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:o.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to index"]}),x&&o.jsx("div",{className:"flex items-center justify-center h-32 text-xs",style:{color:"var(--muted)"},children:"Loading…"}),!x&&h!==null&&o.jsx("pre",{className:"text-[11px] leading-relaxed whitespace-pre-wrap font-mono p-3 rounded-lg overflow-auto",style:{background:"var(--s2)",color:"var(--fg)",border:"1px solid var(--b1)"},children:h})]}),r==="search"&&o.jsxs("div",{children:[o.jsxs("div",{className:"flex gap-2 mb-3",children:[o.jsx("input",{type:"text",value:w,onChange:U=>g(U.target.value),onKeyDown:U=>U.key==="Enter"&&R(),placeholder:"Search wiki pages…",className:"flex-1 px-3 py-2 rounded-lg text-[12px] outline-none",style:{background:"var(--s2)",border:"1px solid var(--b2)",color:"var(--fg)"},autoFocus:!0}),o.jsx("button",{onClick:R,disabled:v||!w.trim(),className:"px-3 py-2 rounded-lg text-[11px] font-semibold cursor-pointer transition-all duration-150 active:scale-[0.97]",style:{background:"color-mix(in srgb, var(--gold) 15%, transparent)",color:"var(--gold)",border:"1px solid color-mix(in srgb, var(--gold) 25%, transparent)",opacity:v||!w.trim()?.5:1},children:v?"…":"Search"})]}),y.length===0&&!v&&w&&o.jsxs("div",{className:"text-center py-8 text-xs",style:{color:"var(--muted)"},children:['No results for "',w,'"']}),y.length>0&&o.jsx("div",{className:"space-y-1",children:y.map((U,_)=>o.jsxs("button",{onClick:()=>T(U.slug),className:"w-full text-left px-3 py-2 rounded-lg transition-all duration-150 cursor-pointer active:scale-[0.99]",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:[o.jsxs("div",{className:"text-[11px] font-mono",style:{color:"var(--gold)"},children:[U.slug,":",U.lineNumber]}),o.jsx("div",{className:"text-[11px] mt-0.5 truncate font-mono",style:{color:"var(--fg)"},children:U.line.trim()})]},_))})]}),r==="lint"&&o.jsxs("div",{children:[A&&o.jsx("div",{className:"flex items-center justify-center h-32 text-xs",style:{color:"var(--muted)"},children:"Running lint…"}),!A&&k&&o.jsxs("div",{className:"space-y-4",children:[H===0&&o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"color-mix(in srgb, var(--green) 10%, transparent)",color:"var(--green)",border:"1px solid color-mix(in srgb, var(--green) 20%, transparent)"},children:[o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Wiki looks clean — no issues found"]}),o.jsx(Vr,{title:"Orphan pages",items:k.orphanPages,color:"var(--yellow)",note:"Written but not linked from any other page"}),o.jsx(Vr,{title:"Broken links",items:k.brokenLinks.map(U=>`${U.from} → [[${U.to}]]`),color:"var(--red)",note:"[[wikilinks]] that reference missing pages"}),o.jsx(Vr,{title:"Missing from index",items:k.missingFromIndex,color:"var(--yellow)",note:"Pages not listed in index.md"}),o.jsx(Vr,{title:"Stale frontmatter",items:k.staleFrontmatter,color:"var(--muted)",note:"updated: field older than 30 days"})]})]})]})]})}function Vr({title:e,items:t,color:n,note:l}){return t.length===0?null:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[o.jsx("span",{className:"text-[11px] font-semibold",style:{color:n},children:e}),o.jsx("span",{className:"rounded-full px-1.5 py-0.5 text-[9px] font-bold font-mono",style:{background:`color-mix(in srgb, ${n} 15%, transparent)`,color:n},children:t.length})]}),o.jsx("div",{className:"text-[10px] mb-2",style:{color:"var(--muted)"},children:l}),o.jsx("div",{className:"space-y-1",children:t.map((a,s)=>o.jsx("div",{className:"px-3 py-1.5 rounded-lg text-[11px] font-mono truncate",style:{background:"var(--s2)",color:"var(--fg)",border:"1px solid var(--b1)"},children:a},s))})]})}const gx=[["/status","Show version, model, provider, tokens, CWD"],["/help","List all available commands"],["/model [name]","Switch model · opus / sonnet / haiku / gpt4o"],["/mode <mode>","Set approval mode · plan|edit|auto|yolo"],["/theme [name]","Change color theme"],["/debug [on|off]","Toggle debug logging"],["/effort [level]","Set reasoning effort · low|medium|high|max"],["/context","Show context window usage grid"],["/context compact","Compact the context window"],["/context auto","Configure auto-compaction"],["/memory status","View memory file sizes"],["/memory add","Capture a memory"],["/wiki","Open the wiki knowledge base"],["/wiki list","List all wiki pages by category"],["/wiki search <query>","Search wiki pages"],["/wiki lint","Run wiki health check"],["/heartbeat now","Trigger heartbeat immediately"],["/heartbeat enable","Enable heartbeat schedule"],["/remind <msg at time>","Create a reminder"],["/cron list","List all reminders"],["/channels list","Show Telegram channels"],["/mcp list","Show MCP servers"],["/mcp add","Add an MCP server"],["/tools [n]","View/set tool call limit per turn"],["/websearch [n]","Set web search limit per turn"],["/snapshots","List git snapshots"],["/revert","Revert to a snapshot"],["/stats","View usage stats"],["/agent <prompt>","Spawn a subagent"],["/task create","Create a scheduled task"],["/provider <name>","Switch AI provider"],["/init","Run interactive setup wizard"],["/exit","Exit curie-agent"]];function sT({open:e,onClose:t,onPick:n}){const[l,a]=b.useState(""),[s,i]=b.useState(0),r=b.useRef(null),c=l?gx.filter(([f,h])=>f.includes(l.toLowerCase())||h.toLowerCase().includes(l.toLowerCase())):gx,u=b.useCallback(f=>{t(),n(f)},[t,n]);b.useEffect(()=>{e&&(a(""),i(0),setTimeout(()=>{var f;return(f=r.current)==null?void 0:f.focus()},50))},[e]);const d=b.useCallback(f=>{if(f.key==="Escape"){t();return}f.key==="ArrowDown"&&(i(h=>Math.min(h+1,c.length-1)),f.preventDefault()),f.key==="ArrowUp"&&(i(h=>Math.max(h-1,0)),f.preventDefault()),f.key==="Enter"&&c[s]&&u(c[s][0])},[c,s,t,u]);return e?o.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[120px]",style:{background:"rgba(10, 8, 5, 0.85)",backdropFilter:"blur(8px)"},onClick:t,children:o.jsxs("div",{className:"w-[560px] rounded-xl overflow-hidden animate-scaleIn",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b2)",boxShadow:"0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.03)"},onClick:f=>f.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-3",style:{borderBottom:"1px solid var(--b1)"},children:[o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",className:"shrink-0",style:{opacity:.7},children:[o.jsx("circle",{cx:"11",cy:"11",r:"8"}),o.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),o.jsx("input",{ref:r,className:"flex-1 bg-transparent border-0 outline-none font-sans text-sm",style:{color:"var(--cream)"},placeholder:"Search commands...",value:l,onChange:f=>{a(f.target.value),i(0)},onKeyDown:d})]}),o.jsx("div",{className:"gold-divider"}),o.jsxs("div",{className:"max-h-[340px] overflow-y-auto py-1 scrollbar-thin",children:[c.map(([f,h],p)=>o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer transition-all duration-150 mx-1",style:{background:p===s?"var(--s3)":"transparent",borderLeft:p===s?"2px solid var(--gold)":"2px solid transparent"},onClick:()=>u(f),children:[o.jsx("span",{className:"font-mono text-[12.5px] min-w-[190px]",style:{color:p===s?"var(--gold)":"var(--text)"},children:f}),o.jsx("span",{className:"text-xs text-muted truncate",children:h})]},f)),c.length===0&&o.jsx("div",{className:"px-3 py-6 text-center text-muted text-sm",children:"No commands found"})]})]})}):null}const Na={anthropic:{label:"Anthropic",defaultModel:"claude-sonnet-4-6",requiresKey:!0},openai:{label:"OpenAI",defaultModel:"gpt-4o",requiresKey:!0},local:{label:"Local (OpenAI-compatible)",defaultModel:"custom",requiresKey:!1},openrouter:{label:"OpenRouter",defaultModel:"anthropic/claude-sonnet-4-6",requiresKey:!0},ollama:{label:"Ollama (Local)",defaultModel:"custom",requiresKey:!1}};function iT({rpc:e,onComplete:t,className:n}){const[l,a]=b.useState("provider"),[s,i]=b.useState(null),[r,c]=b.useState(""),[u,d]=b.useState(""),[f,h]=b.useState(""),[p,x]=b.useState(""),[S,w]=b.useState(""),[g,y]=b.useState(""),[m,v]=b.useState(""),[j,k]=b.useState(!1),[E,A]=b.useState(null),M=b.useCallback(()=>{switch(A(null),l){case"provider":{if(!s)return;const N=Na[s];d(N.defaultModel),a(N.requiresKey?"api_key":"model");break}case"api_key":a("model");break;case"model":a("soul_name");break;case"soul_name":if(!f.trim())return;a("soul_vibe");break;case"soul_vibe":a("user_name");break;case"user_name":if(!S.trim())return;a("user_tz");break;case"user_tz":a("user_lang");break;case"user_lang":a("agents");break;case"agents":a("memory");break;case"memory":a("tools");break;case"tools":a("confirm");break}},[l,s,f,S]),B=b.useCallback(async()=>{if(!(!e||!s)){k(!0),A(null);try{await e.identitySetup({provider:s,apiKey:r,model:u,soulName:f.trim()||"Curie",soulVibe:p.trim()||"AI coding assistant — sharp, resourceful, gets things done",userName:S.trim()||"User",userTimezone:g.trim()||"UTC",userLanguages:m.trim()||"TypeScript, Python"}),t()}catch(N){A(N instanceof Error?N.message:"Setup failed")}finally{k(!1)}}},[e,s,r,u,f,p,S,g,m,t]),D=()=>{switch(l){case"provider":return"Choose your provider";case"api_key":return"API key";case"model":return"Select a model";case"soul_name":return"Name your assistant";case"soul_vibe":return"Define the vibe";case"user_name":return"Your name";case"user_tz":return"Timezone";case"user_lang":return"Programming languages";case"agents":return"Workspace configuration";case"memory":return"Memory";case"tools":return"Tools";case"confirm":return"Review & create"}},L=()=>(["provider","api_key","model","soul_name","soul_vibe","user_name","user_tz","user_lang","agents","memory","tools","confirm"].indexOf(l)+1)/12,V=()=>{switch(l){case"provider":return o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted mb-4",children:"Which LLM provider do you want to use for your AI assistant?"}),o.jsx("div",{className:"grid grid-cols-1 gap-2",children:Object.entries(Na).map(([N,O])=>o.jsxs("button",{type:"button",onClick:()=>i(N),className:`flex items-center gap-3 px-4 py-3 rounded-xl border text-left transition-all duration-100 ${s===N?"border-blue-500 bg-blue-500/10 text-text":"border-b2 bg-s2 text-text hover:border-b3 hover:bg-s2/80"}`,children:[o.jsx("div",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${s===N?"border-blue-500":"border-b3"}`,children:s===N&&o.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs font-medium text-text",children:O.label}),o.jsxs("div",{className:"text-[10.5px] text-muted",children:["Model: ",O.defaultModel]})]})]},N))})]});case"api_key":{const N=Na[s];return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("p",{className:"text-xs text-muted",children:["Enter your ",N.label," API key:"]}),o.jsx("input",{type:"password",value:r,onChange:O=>c(O.target.value),placeholder:"sk-...",className:"w-full px-3 py-2.5 bg-[#0d1117] border border-b2 rounded-xl text-xs text-text font-mono placeholder-slate-600 focus:outline-none focus:border-blue-500/70 transition-colors",autoFocus:!0}),o.jsx("p",{className:"text-[10px] text-muted",children:"Saved to ~/.curie-settings.json"})]})}case"model":{const N=Na[s];return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("p",{className:"text-xs text-muted",children:["Suggested model: ",o.jsx("code",{className:"text-text font-mono",children:N.defaultModel})]}),o.jsx("input",{type:"text",value:u,onChange:O=>d(O.target.value),placeholder:"Enter model name or accept the default",className:"w-full px-3 py-2.5 bg-[#0d1117] border border-b2 rounded-xl text-xs text-text font-mono placeholder-slate-600 focus:outline-none focus:border-blue-500/70 transition-colors",autoFocus:!0})]})}case"soul_name":return o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted",children:"What should your AI assistant's name be?"}),o.jsx("input",{type:"text",value:f,onChange:N=>h(N.target.value),placeholder:"Curie",className:"w-full px-3 py-2.5 bg-[#0d1117] border border-b2 rounded-xl text-xs text-text placeholder-slate-600 focus:outline-none focus:border-blue-500/70 transition-colors",autoFocus:!0})]});case"soul_vibe":return o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted",children:"Describe your assistant's vibe/personality (1 sentence)."}),o.jsx("input",{type:"text",value:p,onChange:N=>x(N.target.value),placeholder:"AI coding assistant — sharp, resourceful, gets things done",className:"w-full px-3 py-2.5 bg-[#0d1117] border border-b2 rounded-xl text-xs text-text placeholder-slate-600 focus:outline-none focus:border-blue-500/70 transition-colors",autoFocus:!0})]});case"user_name":return o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted",children:"What is your name?"}),o.jsx("input",{type:"text",value:S,onChange:N=>w(N.target.value),placeholder:"Paweł",className:"w-full px-3 py-2.5 bg-[#0d1117] border border-b2 rounded-xl text-xs text-text placeholder-slate-600 focus:outline-none focus:border-blue-500/70 transition-colors",autoFocus:!0})]});case"user_tz":return o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted",children:"Your timezone?"}),o.jsx("input",{type:"text",value:g,onChange:N=>y(N.target.value),placeholder:"Europe/Warsaw",className:"w-full px-3 py-2.5 bg-[#0d1117] border border-b2 rounded-xl text-xs text-text font-mono placeholder-slate-600 focus:outline-none focus:border-blue-500/70 transition-colors",autoFocus:!0})]});case"user_lang":return o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted",children:"Your primary programming languages?"}),o.jsx("input",{type:"text",value:m,onChange:N=>v(N.target.value),placeholder:"TypeScript, Python",className:"w-full px-3 py-2.5 bg-[#0d1117] border border-b2 rounded-xl text-xs text-text placeholder-slate-600 focus:outline-none focus:border-blue-500/70 transition-colors",autoFocus:!0})]});case"agents":return o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted",children:"Next: I'll create your workspace configuration files."}),o.jsxs("div",{className:"p-3 bg-s2 border border-b1 rounded-xl text-[10.5px] text-text leading-relaxed",children:[o.jsx("p",{className:"font-medium mb-1",children:"AGENTS.md will include:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-muted",children:[o.jsx("li",{children:"Session startup instructions"}),o.jsx("li",{children:"Memory system (daily notes + long-term)"}),o.jsx("li",{children:"Coding agent capabilities"}),o.jsx("li",{children:"Red lines and safety boundaries"}),o.jsx("li",{children:"Heartbeat configuration"})]})]})]});case"memory":return o.jsx("div",{className:"space-y-3",children:o.jsx("div",{className:"p-3 bg-s2 border border-b1 rounded-xl text-xs text-text leading-relaxed",children:o.jsx("p",{children:"Auto-creating MEMORY.md with initialization entry..."})})});case"tools":return o.jsx("div",{className:"space-y-3",children:o.jsx("div",{className:"p-3 bg-s2 border border-b1 rounded-xl text-xs text-text leading-relaxed",children:o.jsx("p",{children:"Auto-creating TOOLS.md and HEARTBEAT.md..."})})});case"confirm":return o.jsxs("div",{className:"space-y-4",children:[o.jsx("p",{className:"text-xs text-muted",children:"Review your configuration before creating files:"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(rl,{label:"Provider",value:Na[s].label}),o.jsx(rl,{label:"Model",value:u}),o.jsx(rl,{label:"API Key",value:r?"[set]":"(not set)"}),o.jsx(rl,{label:"Assistant Name",value:f.trim()||"Curie"}),o.jsx(rl,{label:"Vibe",value:p.trim()||"AI coding assistant"}),o.jsx(rl,{label:"Your Name",value:S.trim()||"User"}),o.jsx(rl,{label:"Timezone",value:g.trim()||"UTC"}),o.jsx(rl,{label:"Languages",value:m.trim()||"TypeScript, Python"})]}),o.jsxs("div",{className:"p-3 bg-s2 border border-b1 rounded-xl text-[10.5px] text-muted leading-relaxed",children:["Identity files to be created:",o.jsxs("ul",{className:"list-disc list-inside mt-1",children:[o.jsx("li",{children:"~/.curie-agent/SOUL.md"}),o.jsx("li",{children:"~/.curie-agent/USER.md"}),o.jsx("li",{children:"~/.curie-agent/AGENTS.md"}),o.jsx("li",{children:"~/.curie-agent/MEMORY.md"}),o.jsx("li",{children:"~/.curie-agent/TOOLS.md"}),o.jsx("li",{children:"~/.curie-agent/HEARTBEAT.md"})]})]})]})}};return o.jsx("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin flex flex-col ${n||""}`,children:o.jsxs("div",{className:"max-w-lg mx-auto w-full",children:[o.jsxs("div",{className:"mb-6",children:[o.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight mb-1",children:"Setup Wizard"}),o.jsx("p",{className:"text-[11px] text-muted",children:"Configure your AI assistant — takes about 2 minutes"})]}),o.jsx("div",{className:"mb-5",children:o.jsx("div",{className:"h-1 bg-b2 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-blue-500 rounded-full transition-all duration-300",style:{width:`${L()*100}%`}})})}),o.jsx("h3",{className:"text-sm font-medium text-text mb-4",children:D()}),o.jsx("div",{className:"mb-6",children:V()}),E&&o.jsxs("div",{className:"p-3 bg-red-500/10 border border-red-500/20 rounded-xl text-red-400 text-xs flex items-start gap-2.5 mb-4",children:[o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"shrink-0 mt-0.5",children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),o.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),o.jsx("span",{children:E})]}),o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l!=="provider"&&l!=="confirm"?o.jsxs("button",{type:"button",onClick:()=>{switch(A(null),l){case"api_key":a("provider");break;case"model":a(Na[s].requiresKey?"api_key":"provider");break;case"soul_name":a("provider");break;case"soul_vibe":a("soul_name");break;case"user_name":a("soul_vibe");break;case"user_tz":a("user_name");break;case"user_lang":a("user_tz");break;case"agents":a("user_lang");break;case"memory":a("agents");break;case"tools":a("memory");break}},className:"flex items-center gap-1 bg-transparent border border-b2 rounded px-3 py-2 text-muted text-xs hover:border-b3 hover:text-fg transition-colors duration-100",children:[o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back"]}):o.jsx("div",{}),l==="confirm"?o.jsx("button",{type:"button",onClick:B,disabled:j,className:"flex items-center gap-2 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-500 hover:to-indigo-500 text-white font-semibold text-xs px-5 py-2 rounded-xl shadow-lg shadow-blue-500/10 disabled:opacity-50 disabled:pointer-events-none active:scale-[0.98] transition-all duration-150",children:j?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin h-3.5 w-3.5 text-white",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Creating..."]}):"Create Setup"}):o.jsxs("button",{type:"button",onClick:M,disabled:l==="provider"&&!s||l==="soul_name"&&!f.trim()||l==="user_name"&&!S.trim(),className:"flex items-center gap-2 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-500 hover:to-indigo-500 text-white font-semibold text-xs px-5 py-2 rounded-xl shadow-lg shadow-blue-500/10 disabled:opacity-50 disabled:pointer-events-none active:scale-[0.98] transition-all duration-150",children:["Next",o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[o.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),o.jsx("polyline",{points:"12 5 19 12 12 19"})]})]})]})]})})}function rl({label:e,value:t}){return o.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-b1/50",children:[o.jsx("span",{className:"text-[10.5px] text-muted",children:e}),o.jsx("span",{className:"text-[10.5px] text-text font-mono",children:t})]})}function rT({onReload:e}){const[t,n]=b.useState(!1);b.useEffect(()=>{const a=()=>n(!0),s=()=>{n(!1),e==null||e()};return window.addEventListener("pwa-update-available",a),window.addEventListener("pwa-controller-updated",s),()=>{window.removeEventListener("pwa-update-available",a),window.removeEventListener("pwa-controller-updated",s)}},[e]);const l=()=>{n(!1),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(a=>{a.waiting&&a.waiting.postMessage("SKIP_WAITING")}),window._pendingUpdateWorker&&window._pendingUpdateWorker.postMessage("SKIP_WAITING")};return t?o.jsxs("div",{className:"bg-blue-500/10 border-b border-blue-500/20 text-blue-400 px-4 py-2 text-center text-xs font-semibold flex items-center justify-center gap-2 select-none shrink-0 z-50 animate-fadeIn",children:[o.jsxs("svg",{className:"animate-bounce shrink-0",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),o.jsx("polyline",{points:"17 8 12 3 7 8"}),o.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),"Update available",o.jsx("button",{onClick:l,className:"bg-blue-500/20 border border-blue-500/40 text-blue-400 px-2 py-0.5 rounded-[4px] text-[11px] font-bold cursor-pointer hover:bg-blue-500/30 transition-all duration-100",children:"Update"})]}):null}const oT="0.2.4";function cT({intervalMs:e=3*60*1e3,onNewVersion:t}){const[n,l]=b.useState(!1);return b.useEffect(()=>{async function a(){var i;try{const c=await(await fetch("/health?token="+encodeURIComponent(((i=document.cookie.match(/curie_token=([^;]*)/))==null?void 0:i[1])??""),{cache:"no-store"})).json();c.version&&c.version!==oT&&!n&&(l(!0),t==null||t(c.version),window.dispatchEvent(new CustomEvent("pwa-version-update")))}catch{}}a();const s=setInterval(a,e);return()=>clearInterval(s)},[e,n,t]),null}function uT(){const{rpc:e,ws:t}=En(),[n,l]=b.useState([]),a=b.useCallback(()=>{e&&e.sessionList().then(s=>{Array.isArray(s)&&l(s)}).catch(()=>{})},[e]);return b.useEffect(()=>{a()},[a]),b.useEffect(()=>{if(!t)return;const s=["user-prompt","assistant-stop","error","session-start","session-resumed"],i=[];for(const r of s)i.push(t.on(r,a));return()=>{for(const r of i)r()}},[t,a]),{sessions:n,refetch:a}}function dT(e){const{rpc:t,ws:n}=En(),[l,a]=b.useState(null),[s,i]=b.useState([]),[r,c]=b.useState(!1);b.useEffect(()=>{if(!t||!e){a(null),i([]),c(!1);return}c(!0),t.sessionGet(e).then(d=>{d!=null&&d.info&&a(d.info),d!=null&&d.events&&i(d.events)}).catch(()=>{}).finally(()=>c(!1))},[t,e]),b.useEffect(()=>{if(!n||!e)return;const d=p=>{if(p.type!=="heartbeat-brief"&&p.type!=="cron-task-fired"){const x=p.sessionId||p.id;if(x&&x!==e)return}i(x=>x.slice(-10).some(w=>w.timestamp===p.timestamp&&w.type===p.type&&JSON.stringify(w)===JSON.stringify(p))?x:[...x,p])},f=[],h=["user-prompt","assistant-delta","assistant-stop","tool-call","tool-result","error","status","usage","thinking-delta","heartbeat-brief","approval-request","approval-decision","context-warning","cron-task-fired"];for(const p of h)f.push(n.on(p,d));return()=>{for(const p of f)p()}},[n,e]);const u=b.useCallback(d=>{i(f=>[...f,d])},[]);return{info:l,events:s,loading:r,addLiveEvent:u}}function fT({onAuthorize:e}){const[t,n]=b.useState(""),[l,a]=b.useState(!1),[s,i]=b.useState(null),r=async c=>{if(c.preventDefault(),!!t.trim()){a(!0),i(null);try{(await fetch("/health",{headers:{Authorization:`Bearer ${t.trim()}`}})).ok?e(t.trim()):i("Invalid Access Token. Please verify and try again.")}catch{i("Cannot connect to Curie Daemon. Make sure the daemon is running.")}finally{a(!1)}}};return o.jsxs("div",{className:"flex min-h-screen w-screen items-center justify-center p-4 font-sans select-none relative overflow-hidden",style:{background:"#0e0b08",color:"var(--cream, #f5e6d0)"},children:[o.jsx("div",{className:"absolute top-[-20%] left-[-20%] w-[60%] h-[60%] rounded-full opacity-30 blur-[120px] pointer-events-none",style:{background:"#2d1f0e"}}),o.jsx("div",{className:"absolute bottom-[-20%] right-[-20%] w-[60%] h-[60%] rounded-full opacity-25 blur-[120px] pointer-events-none",style:{background:"#1e1408"}}),o.jsx("div",{className:"absolute top-[40%] left-[50%] w-[40%] h-[40%] rounded-full opacity-15 blur-[100px] pointer-events-none",style:{background:"#d4a54a",transform:"translate(-50%, -50%)"}}),o.jsxs("div",{className:"w-full max-w-[440px] rounded-2xl shadow-2xl p-7 flex flex-col items-center animate-scaleIn relative z-10",style:{background:"linear-gradient(135deg, rgba(34, 28, 22, 0.95), rgba(20, 16, 12, 0.98))",backdropFilter:"blur(24px)",border:"1px solid rgba(86, 72, 58, 0.5)",boxShadow:"0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(245,230,208,0.04)"},children:[o.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px] rounded-t-2xl",style:{background:"linear-gradient(90deg, transparent, #d4a54a, transparent)"}}),o.jsxs("div",{className:"flex flex-col items-center gap-3 mb-6 mt-2",children:[o.jsxs("div",{className:"relative group",children:[o.jsx("div",{className:"absolute inset-0 rounded-xl blur-md group-hover:blur-lg transition-all duration-300 animate-gold-pulse",style:{background:"rgba(212, 165, 74, 0.2)"}}),o.jsx("img",{src:"/icons/logo-512.png",alt:"Curie Logo",className:"w-14 h-14 object-contain rounded-xl relative z-10 transform group-hover:scale-105 transition-transform duration-300",style:{border:"1px solid rgba(86, 72, 58, 0.6)",boxShadow:"0 4px 16px rgba(0,0,0,0.4)"}})]}),o.jsxs("div",{className:"text-center mt-1",children:[o.jsx("span",{className:"text-xl font-display font-bold gold-shimmer block",children:"curie-agent"}),o.jsx("span",{className:"text-[10px] font-mono block mt-0.5",style:{color:"#d4a54a",opacity:.6},children:"v0.2.4"})]})]}),o.jsxs("div",{className:"text-center mb-6",children:[o.jsx("h2",{className:"text-sm font-semibold mb-2",style:{color:"#f5e6d0"},children:"Authorize this device"}),o.jsx("p",{className:"text-[12.5px] leading-relaxed px-2",style:{color:"#8b7355"},children:"Curie requires a secure daemon connection. Enter your access token below to authorize this device and start planning."})]}),o.jsxs("form",{onSubmit:r,className:"w-full space-y-4",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-wider block ml-1",style:{color:"#d4a54a",opacity:.7},children:"Daemon Access Token"}),o.jsxs("div",{className:"relative group",children:[o.jsx("div",{className:"absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none transition-colors duration-200",style:{color:"#8b7355"},children:o.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:o.jsx("path",{d:"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"})})}),o.jsx("input",{type:"password",required:!0,placeholder:"Paste your daemon.token...",value:t,onChange:c=>n(c.target.value),disabled:l,className:"w-full pl-10 pr-4 py-2.5 rounded-xl text-[13px] font-mono focus:outline-none transition-all duration-200",style:{background:"rgba(14, 11, 8, 0.8)",border:"1px solid rgba(86, 72, 58, 0.4)",color:"#f5e6d0"}})]})]}),s&&o.jsxs("div",{className:"p-3 rounded-xl text-xs flex items-start gap-2.5 animate-fadeIn",style:{background:"color-mix(in srgb, var(--red) 10%, transparent)",border:"1px solid color-mix(in srgb, var(--red) 20%, transparent)",color:"var(--red)"},children:[o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"shrink-0 mt-0.5",children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),o.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),o.jsx("span",{children:s})]}),o.jsx("button",{type:"submit",disabled:l||!t.trim(),className:"btn-gold w-full py-2.5 px-4 rounded-xl font-semibold text-xs active:scale-[0.98] transition-all duration-150 disabled:opacity-50 disabled:pointer-events-none cursor-pointer flex items-center justify-center gap-2",children:l?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"w-3.5 h-3.5 rounded-full animate-spin",style:{background:"conic-gradient(from 0deg, transparent, #1a1410)",mask:"radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 0)",WebkitMask:"radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 0)"}}),"Verifying Credentials..."]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"Authorize & Connect"}),o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[o.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),o.jsx("polyline",{points:"12 5 19 12 12 19"})]})]})})]}),o.jsxs("div",{className:"w-full mt-6 pt-5 space-y-2 leading-relaxed",style:{borderTop:"1px solid rgba(86, 72, 58, 0.3)",fontSize:"11.5px",color:"#8b7355"},children:[o.jsx("div",{className:"font-semibold",style:{color:"#bfae94"},children:"Where is my token?"}),o.jsx("p",{children:"When starting the daemon, look for the console output in your terminal. It displays the dashboard link containing the secure token."}),o.jsxs("p",{children:["You can also find the raw token inside the file ",o.jsx("code",{className:"font-mono px-1 py-0.5 rounded text-[10.5px]",style:{background:"rgba(14, 11, 8, 0.6)",border:"1px solid rgba(86, 72, 58, 0.3)",color:"#d4c4a8"},children:"~/.curie-agent/daemon.token"})," on your host machine."]})]})]})]})}const hT=["plan","edit","auto","yolo"],pT=[{view:"assistant",label:"Assistant",icon:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},{view:"channels",label:"Channels",icon:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07A19.5 19.5 0 0 1 4.86 13a19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 3.77 2h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L7.91 9.91a16 16 0 0 0 6.16 6.16l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 16.92z"},{view:"stats",label:"Stats",icon:"M18 20V10M12 20V4M6 20v-6"},{view:"projects",label:"Projects",icon:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"},{view:"agents",label:"Agents",icon:"M12 8c0 2.21-1.79 4-4 4s-4-1.79-4-4 1.79-4 4-4 4 1.79 4 4zm-6 12v-2a6 6 0 0 1 12 0v2"},{view:"kanban",label:"Tasks",icon:"M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"},{view:"wiki",label:"Wiki",icon:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"},{view:"settings",label:"Settings",icon:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}];function gT(){const{rpc:e,connected:t,token:n,setToken:l}=En(),{get:a,set:s,providers:i}=wh(),[r,c]=b.useState("assistant"),u=a("mode")||"auto",[d,f]=b.useState(!1),[h,p]=b.useState(""),[x,S]=b.useState(null),[w,g]=b.useState(!1),[y,m]=b.useState(null),[v,j]=b.useState(navigator.onLine),[k,E]=b.useState(!1),[A,M]=b.useState(!1),[B,D]=b.useState(!1),[L,V]=b.useState(!1),N=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;b.useEffect(()=>{const q=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone===!0;E(!!q)},[]),b.useEffect(()=>{const q=J=>{J.preventDefault(),m(J)},Q=()=>j(!0),K=()=>j(!1);return window.addEventListener("beforeinstallprompt",q),window.addEventListener("online",Q),window.addEventListener("offline",K),()=>{window.removeEventListener("beforeinstallprompt",q),window.removeEventListener("online",Q),window.removeEventListener("offline",K)}},[]);const O=async()=>{if(y){y.prompt();const{outcome:q}=await y.userChoice;console.log(`PWA install prompt choice: ${q}`),m(null)}else M(!0)},{sessions:C,refetch:z}=uT(),{events:T,addLiveEvent:R}=dT(x),Y=a("theme")||"curie";b.useEffect(()=>{document.documentElement.setAttribute("data-theme",Y)},[Y]),b.useEffect(()=>{const q=()=>g(window.innerWidth<768);return q(),window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[]),b.useEffect(()=>{!t||!e||e.configGet("current_provider").then(q=>{q||D(!0)}).catch(()=>{})},[t,e]);const X=b.useCallback(()=>{S(null)},[]),H=b.useCallback(q=>{S(q)},[]),U=b.useCallback(q=>{S(q),z()},[z]);b.useEffect(()=>{const q=Q=>{(Q.metaKey||Q.ctrlKey)&&Q.key==="k"&&(Q.preventDefault(),f(!0))};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[]);const _=b.useCallback(q=>{p(q),f(!1)},[]),$=b.useCallback(()=>{p("")},[]),G=(q,Q=18)=>o.jsx("svg",{width:Q,height:Q,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:o.jsx("path",{d:q.icon})});return n?o.jsxs("div",{className:"flex h-dvh w-screen flex-col overflow-hidden bg-bg coffee-pattern",children:[!v&&o.jsxs("div",{className:"px-4 py-2 text-center text-xs font-semibold flex items-center justify-center gap-2 select-none shrink-0 z-50 animate-fadeIn",style:{background:"color-mix(in srgb, var(--yellow) 10%, transparent)",borderBottom:"1px solid color-mix(in srgb, var(--yellow) 20%, transparent)",color:"var(--yellow)"},children:[o.jsxs("svg",{className:"animate-pulse shrink-0",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),o.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),o.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),"Offline Mode — Curie is running on cached local client"]}),o.jsx(rT,{}),o.jsx(cT,{}),o.jsxs("main",{className:"flex flex-1 flex-col overflow-hidden bg-bg",children:[o.jsxs("div",{className:"topbar-wood flex h-12 items-center gap-3 px-4 shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsxs("button",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg transition-all duration-150",style:{color:L?"var(--fg)":"var(--muted)",background:L?"var(--s3)":"transparent",border:L?"1px solid var(--b1)":"1px solid transparent"},onClick:()=>V(!0),title:"Sessions",children:[o.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:o.jsx("path",{d:"M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"})}),C.length>0&&o.jsx("span",{className:"absolute -top-0.5 -right-0.5 text-[9px] font-bold rounded-full w-4 h-4 flex items-center justify-center",style:{background:"var(--gold)",color:"#1a1410"},children:C.length>99?"99+":C.length})]}),o.jsx("div",{className:"w-px h-5 bg-b1 mx-0.5"}),pT.map(q=>o.jsx("button",{className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all duration-150 cursor-pointer",style:{color:r===q.view?"var(--gold)":"var(--muted)",background:r===q.view?"var(--s3)":"transparent",border:r===q.view?"1px solid var(--b1)":"1px solid transparent"},onClick:()=>c(q.view),title:q.label,children:G(q,18)},q.view))]}),o.jsx("div",{className:"flex-1"}),window.innerWidth>=640&&o.jsx("div",{className:"flex rounded-lg overflow-hidden",style:{border:"1px solid var(--b2)",background:"var(--bg)"},children:hT.map(q=>o.jsx("button",{className:"px-2.5 py-1 text-xs cursor-pointer transition-all duration-150 font-mono select-none",style:{color:u===q?"var(--gold)":"var(--muted)",background:u===q?"var(--s3)":"transparent",borderRight:"1px solid var(--b1)"},onClick:()=>s("mode",q),children:q},q))}),(y||w&&!k)&&o.jsxs("button",{onClick:O,className:"flex items-center justify-center rounded-lg transition-all duration-150 px-2.5 py-1 gap-1.5 text-xs font-semibold cursor-pointer shrink-0",style:{background:"var(--bg)",border:"1px solid color-mix(in srgb, var(--green) 30%, transparent)",color:"var(--green)"},children:[o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),o.jsx("polyline",{points:"7 10 12 15 17 10"}),o.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),!w&&o.jsx(o.Fragment,{children:"Install"})]}),o.jsxs("button",{className:"flex items-center justify-center rounded-lg transition-all duration-150 px-2.5 py-1 gap-1.5 text-xs font-semibold cursor-pointer shrink-0",style:{background:"transparent",border:"1px solid var(--b2)",color:"var(--muted)"},onClick:()=>f(!0),title:"Open Commands",children:[o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[o.jsx("circle",{cx:"11",cy:"11",r:"8"}),o.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),!w&&o.jsx(o.Fragment,{children:"Ctrl+k"})]})]}),o.jsxs("div",{className:"relative flex-1 min-h-0",children:[B&&e?o.jsx(iT,{rpc:e,onComplete:()=>D(!1),className:"absolute inset-0"}):r==="assistant"&&o.jsx(Sj,{cmdResult:h,onClearCmdResult:$,rpc:e,className:"absolute inset-0",activeSessionId:x,onCreateSession:U,events:T,addLiveEvent:R,onSwitchView:q=>c(q)}),r==="channels"&&o.jsx(Nj,{rpc:e,className:"absolute inset-0"}),r==="stats"&&o.jsx(jj,{rpc:e,className:"absolute inset-0"}),r==="projects"&&o.jsx(kj,{rpc:e,className:"absolute inset-0"}),r==="agents"&&o.jsx(_j,{rpc:e,className:"absolute inset-0"}),r==="kanban"&&o.jsx(A3,{rpc:e,className:"absolute inset-0"}),r==="wiki"&&o.jsx(aT,{rpc:e,className:"absolute inset-0"}),r==="settings"&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-muted text-xs",children:"Settings view — coming soon"})]})]}),o.jsx(sT,{open:d,onClose:()=>f(!1),onPick:_}),L&&o.jsx("div",{className:"fixed inset-0 z-[998] flex items-end animate-fadeIn",style:{background:"rgba(10, 8, 5, 0.6)",backdropFilter:"blur(4px)"},onClick:()=>V(!1),children:o.jsxs("div",{className:"w-full max-h-[70vh] rounded-t-2xl overflow-hidden animate-slideUp select-none flex flex-col wood-grain",style:{background:"var(--s1)",borderTop:"1px solid var(--b1)"},onClick:q=>q.stopPropagation(),children:[o.jsx("div",{className:"flex justify-center pt-3 pb-1 shrink-0",children:o.jsx("div",{className:"w-8 h-1 rounded-full",style:{background:"var(--gold)",opacity:.3}})}),o.jsxs("div",{className:"flex items-center justify-between px-4 pb-3 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:[o.jsx("span",{className:"text-[13px] font-display font-semibold",style:{color:"var(--cream)"},children:"Sessions"}),o.jsx("button",{onClick:()=>V(!1),className:"text-muted hover:text-fg transition-colors duration-100 p-1",children:o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:o.jsxs("button",{onClick:()=>{X(),V(!1)},className:"w-full flex items-center gap-2.5 py-2 px-3 rounded-xl transition-all duration-150 active:scale-[0.98] cursor-pointer",style:{background:"color-mix(in srgb, var(--gold) 10%, transparent)",border:"1px solid color-mix(in srgb, var(--gold) 20%, transparent)",color:"var(--gold)"},children:[o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),o.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),o.jsx("span",{className:"text-[12.5px] font-semibold",children:"New Chat"})]})}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4 scrollbar-thin",children:[C.sort((q,Q)=>Q.updatedAt-q.updatedAt).map(q=>o.jsx("button",{className:"w-full text-left py-3 px-3 rounded-xl mb-1 transition-all duration-150 active:scale-[0.98] min-h-[52px] cursor-pointer",style:{background:q.id===x?"linear-gradient(135deg, var(--s3) 0%, var(--s2) 100%)":"transparent",border:q.id===x?"1px solid var(--b2)":"1px solid transparent"},onClick:()=>{H(q.id),V(!1)},children:o.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[o.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:q.id===x?"var(--gold)":"transparent",boxShadow:q.id===x?"0 0 4px var(--gold)":"none"}}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-[12.5px] font-medium text-fg truncate",children:q.name||q.provider}),o.jsxs("div",{className:"text-[11px] text-muted",children:[q.provider," · ",(()=>{const Q=Date.now()-q.updatedAt;return Q<6e4?"just now":Q<36e5?`${Math.floor(Q/6e4)}m ago`:Q<864e5?`${Math.floor(Q/36e5)}h ago`:`${Math.floor(Q/864e5)}d ago`})()]})]}),q.type&&q.type!=="webui"&&o.jsx("span",{className:"text-[9px] font-mono text-muted bg-s2 px-1.5 py-0.5 rounded shrink-0",children:q.type})]})},q.id)),C.length===0&&o.jsx("div",{className:"text-center py-8 text-xs text-muted",children:"No sessions yet"})]}),x&&o.jsx("div",{className:"border-t border-b1 px-4 py-3 shrink-0",children:(()=>{var ge;const q=T.filter(I=>I.type==="usage"),Q=q.reduce((I,se)=>I+(se.inputTokens||0)+(se.outputTokens||0),0),K=q[q.length-1],J=K&&K.inputTokens||0;function P(I){return I<1e3?String(I):`${(I/1e3).toFixed(1)}k`}const W=a("current_provider")||"anthropic",F=(ge=i.find(I=>I.name===W))==null?void 0:ge.model_cost,le=a("model")||"sonnet";function ae(I,se){if(F){const[Ot,el]=F.split(";"),_n=parseFloat(Ot||"0"),Jt=parseFloat(el||"0");if(!isNaN(_n)&&!isNaN(Jt))return(I*_n+se*Jt)/1e6}const Re={opus:{in:15,out:75},sonnet:{in:3,out:15},haiku:{in:.8,out:4},"gpt-4o":{in:2.5,out:10},"gpt-4":{in:5,out:15},qwen:{in:.112,out:.224}},st=Object.keys(Re).find(Ot=>le.toLowerCase().includes(Ot))||"sonnet",St=Re[st];return(I*St.in+se*St.out)/1e6}const te=q.reduce((I,se)=>I+ae(se.inputTokens||0,se.outputTokens||0),0);return o.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-[9px] text-muted2 uppercase tracking-wider font-mono",children:"Tokens"}),o.jsx("div",{className:"text-[12px] text-fg font-mono font-semibold",children:P(Q)})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[9px] text-muted2 uppercase tracking-wider font-mono",children:"Context"}),o.jsx("div",{className:"text-[12px] text-fg font-mono font-semibold",children:P(J)})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[9px] text-muted2 uppercase tracking-wider font-mono",children:"Cost"}),o.jsxs("div",{className:"text-[12px] text-green font-mono font-semibold",children:["$",te.toFixed(4)]})]})]})})()})]})}),A&&o.jsx("div",{className:"fixed inset-0 z-[999] flex items-center justify-center p-4 animate-fadeIn",style:{background:"rgba(10, 8, 5, 0.7)",backdropFilter:"blur(8px)"},children:o.jsxs("div",{className:"w-full max-w-[340px] p-5 rounded-2xl shadow-2xl animate-scaleIn select-none",style:{background:"linear-gradient(135deg, var(--s2), var(--s1))",border:"1px solid var(--b2)",boxShadow:"0 20px 60px rgba(0,0,0,0.5)"},children:[o.jsxs("div",{className:"flex items-center justify-between pb-3 mb-4",style:{borderBottom:"1px solid var(--b1)"},children:[o.jsx("span",{className:"font-bold text-[13.5px] font-display",style:{color:"var(--cream)"},children:"Install Curie Agent"}),o.jsx("button",{onClick:()=>M(!1),className:"text-muted hover:text-fg transition-colors duration-100 cursor-pointer",children:o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx("div",{className:"space-y-3.5 text-xs text-text leading-relaxed",children:N?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-[12px] text-muted mb-1 px-0.5",children:"Follow these simple steps to add Curie to your home screen:"}),o.jsxs("div",{className:"flex gap-3 items-start p-3 rounded-xl",style:{background:"color-mix(in srgb, var(--s1) 50%, transparent)",border:"1px solid var(--b1)"},children:[o.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-lg shrink-0",style:{background:"color-mix(in srgb, var(--gold) 10%, transparent)",color:"var(--gold)"},children:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:o.jsx("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8M16 6l-4-4-4 4M12 2v13"})})}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"1. Tap the Share Button"}),o.jsx("span",{className:"text-[11px] text-muted",children:"Tap the Share icon in Safari's bottom toolbar."})]})]}),o.jsxs("div",{className:"flex gap-3 items-start p-3 rounded-xl",style:{background:"color-mix(in srgb, var(--s1) 50%, transparent)",border:"1px solid var(--b1)"},children:[o.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-lg shrink-0 font-bold font-mono text-[16px] select-none",style:{background:"color-mix(in srgb, var(--gold) 10%, transparent)",color:"var(--gold)"},children:"+"}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"2. Add to Home Screen"}),o.jsxs("span",{className:"text-[11px] text-muted",children:["Scroll down and select ",o.jsx("strong",{children:"Add to Home Screen"}),"."]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-[12px] text-muted mb-1 px-0.5",children:"Follow these simple steps to add Curie to your home screen:"}),o.jsxs("div",{className:"flex gap-3 items-start bg-s1/50 border border-b1 p-3 rounded-xl",children:[o.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-lg bg-blue-500/10 text-blue-400 shrink-0",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("circle",{cx:"12",cy:"12",r:"1"}),o.jsx("circle",{cx:"12",cy:"5",r:"1"}),o.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"1. Open Browser Menu"}),o.jsx("span",{className:"text-[11px] text-muted",children:"Tap the menu icon (three dots) in the top-right corner."})]})]}),o.jsxs("div",{className:"flex gap-3 items-start bg-s1/50 border border-b1 p-3 rounded-xl",children:[o.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-lg bg-blue-500/10 text-blue-400 shrink-0",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),o.jsx("polyline",{points:"7 10 12 15 17 10"}),o.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"2. Select Add / Install"}),o.jsxs("span",{className:"text-[11px] text-muted",children:["Tap ",o.jsx("strong",{children:"Add to Home screen"})," or ",o.jsx("strong",{children:"Install app"}),"."]})]})]})]})}),o.jsx("button",{onClick:()=>M(!1),className:"btn-gold w-full mt-5 py-2.5 px-4 rounded-xl font-semibold text-xs active:scale-[0.98] transition-all duration-150 cursor-pointer flex items-center justify-center",children:"Got it"})]})})]}):o.jsx(fT,{onAuthorize:l})}function mT(){return o.jsx(jN,{children:o.jsx(gT,{})})}const xT=bN.createRoot(document.getElementById("root"));xT.render(o.jsx(_e.StrictMode,{children:o.jsx(mT,{})}));"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").then(e=>{console.log("ServiceWorker registration successful with scope: ",e.scope),e.addEventListener("updatefound",()=>{const t=e.installing;t&&(window._pendingUpdateWorker=t,t.addEventListener("statechange",()=>{t.state==="installed"&&(window._hasPendingUpdate=!0,window.dispatchEvent(new CustomEvent("pwa-update-available")))}))}),navigator.serviceWorker.addEventListener("controllerchange",()=>{window.dispatchEvent(new CustomEvent("pwa-controller-updated"))})}).catch(e=>console.error("ServiceWorker registration failed: ",e))});