@curie-agent/daemon 0.4.0 → 0.4.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.
@@ -1,165 +0,0 @@
1
- var z2=Object.defineProperty;var D2=(e,t,n)=>t in e?z2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var fe=(e,t,n)=>D2(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 jx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kx={exports:{}},hc={};/**
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 R2=Symbol.for("react.transitional.element"),O2=Symbol.for("react.fragment");function Ex(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:R2,type:e,key:l,ref:t!==void 0?t:null,props:n}}hc.Fragment=O2;hc.jsx=Ex;hc.jsxs=Ex;kx.exports=hc;var o=kx.exports,Cx={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 jf=Symbol.for("react.transitional.element"),H2=Symbol.for("react.portal"),L2=Symbol.for("react.fragment"),$2=Symbol.for("react.strict_mode"),B2=Symbol.for("react.profiler"),U2=Symbol.for("react.consumer"),q2=Symbol.for("react.context"),Y2=Symbol.for("react.forward_ref"),V2=Symbol.for("react.suspense"),X2=Symbol.for("react.memo"),Mx=Symbol.for("react.lazy"),G2=Symbol.for("react.activity"),xp=Symbol.iterator;function Q2(e){return e===null||typeof e!="object"?null:(e=xp&&e[xp]||e["@@iterator"],typeof e=="function"?e:null)}var _x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ax=Object.assign,Tx={};function vs(e,t,n){this.props=e,this.context=t,this.refs=Tx,this.updater=n||_x}vs.prototype.isReactComponent={};vs.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")};vs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function zx(){}zx.prototype=vs.prototype;function kf(e,t,n){this.props=e,this.context=t,this.refs=Tx,this.updater=n||_x}var Ef=kf.prototype=new zx;Ef.constructor=kf;Ax(Ef,vs.prototype);Ef.isPureReactComponent=!0;var yp=Array.isArray;function sd(){}var _e={H:null,A:null,T:null,S:null},Dx=Object.prototype.hasOwnProperty;function Cf(e,t,n){var l=n.ref;return{$$typeof:jf,type:e,key:t,ref:l!==void 0?l:null,props:n}}function Z2(e,t){return Cf(e.type,t,e.props)}function Mf(e){return typeof e=="object"&&e!==null&&e.$$typeof===jf}function I2(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var vp=/\/+/g;function su(e,t){return typeof e=="object"&&e!==null&&e.key!=null?I2(""+e.key):t.toString(36)}function K2(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(sd,sd):(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 Ea(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 jf:case H2:i=!0;break;case Mx:return i=e._init,Ea(i(e._payload),t,n,l,a)}}if(i)return a=a(e),i=l===""?"."+su(e,0):l,yp(a)?(n="",i!=null&&(n=i.replace(vp,"$&/")+"/"),Ea(a,t,n,"",function(u){return u})):a!=null&&(Mf(a)&&(a=Z2(a,n+(a.key==null||e&&e.key===a.key?"":(""+a.key).replace(vp,"$&/")+"/")+i)),t.push(a)),1;i=0;var r=l===""?".":l+":";if(yp(e))for(var c=0;c<e.length;c++)l=e[c],s=r+su(l,c),i+=Ea(l,t,n,s,a);else if(c=Q2(e),typeof c=="function")for(e=c.call(e),c=0;!(l=e.next()).done;)l=l.value,s=r+su(l,c++),i+=Ea(l,t,n,s,a);else if(s==="object"){if(typeof e.then=="function")return Ea(K2(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 pr(e,t,n){if(e==null)return e;var l=[],a=0;return Ea(e,l,"","",function(s){return t.call(n,s,a++)}),l}function W2(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 bp=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)},J2={map:pr,forEach:function(e,t,n){pr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return pr(e,function(){t++}),t},toArray:function(e){return pr(e,function(t){return t})||[]},only:function(e){if(!Mf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ie.Activity=G2;ie.Children=J2;ie.Component=vs;ie.Fragment=L2;ie.Profiler=B2;ie.PureComponent=kf;ie.StrictMode=$2;ie.Suspense=V2;ie.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=_e;ie.__COMPILER_RUNTIME={__proto__:null,c:function(e){return _e.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=Ax({},e.props),a=e.key;if(t!=null)for(s in t.key!==void 0&&(a=""+t.key),t)!Dx.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 Cf(e.type,a,l)};ie.createContext=function(e){return e={$$typeof:q2,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:U2,_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)Dx.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 Cf(e,s,a)};ie.createRef=function(){return{current:null}};ie.forwardRef=function(e){return{$$typeof:Y2,render:e}};ie.isValidElement=Mf;ie.lazy=function(e){return{$$typeof:Mx,_payload:{_status:-1,_result:e},_init:W2}};ie.memo=function(e,t){return{$$typeof:X2,type:e,compare:t===void 0?null:t}};ie.startTransition=function(e){var t=_e.T,n={};_e.T=n;try{var l=e(),a=_e.S;a!==null&&a(n,l),typeof l=="object"&&l!==null&&typeof l.then=="function"&&l.then(sd,bp)}catch(s){bp(s)}finally{t!==null&&n.types!==null&&(t.types=n.types),_e.T=t}};ie.unstable_useCacheRefresh=function(){return _e.H.useCacheRefresh()};ie.use=function(e){return _e.H.use(e)};ie.useActionState=function(e,t,n){return _e.H.useActionState(e,t,n)};ie.useCallback=function(e,t){return _e.H.useCallback(e,t)};ie.useContext=function(e){return _e.H.useContext(e)};ie.useDebugValue=function(){};ie.useDeferredValue=function(e,t){return _e.H.useDeferredValue(e,t)};ie.useEffect=function(e,t){return _e.H.useEffect(e,t)};ie.useEffectEvent=function(e){return _e.H.useEffectEvent(e)};ie.useId=function(){return _e.H.useId()};ie.useImperativeHandle=function(e,t,n){return _e.H.useImperativeHandle(e,t,n)};ie.useInsertionEffect=function(e,t){return _e.H.useInsertionEffect(e,t)};ie.useLayoutEffect=function(e,t){return _e.H.useLayoutEffect(e,t)};ie.useMemo=function(e,t){return _e.H.useMemo(e,t)};ie.useOptimistic=function(e,t){return _e.H.useOptimistic(e,t)};ie.useReducer=function(e,t,n){return _e.H.useReducer(e,t,n)};ie.useRef=function(e){return _e.H.useRef(e)};ie.useState=function(e){return _e.H.useState(e)};ie.useSyncExternalStore=function(e,t,n){return _e.H.useSyncExternalStore(e,t,n)};ie.useTransition=function(){return _e.H.useTransition()};ie.version="19.2.6";Cx.exports=ie;var b=Cx.exports;const Me=jx(b);var Rx={exports:{}},pc={},Ox={exports:{}},Hx={};/**
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(k,R){var z=k.length;k.push(R);e:for(;0<z;){var O=z-1>>>1,Y=k[O];if(0<a(Y,R))k[O]=R,k[z]=Y,z=O;else break e}}function n(k){return k.length===0?null:k[0]}function l(k){if(k.length===0)return null;var R=k[0],z=k.pop();if(z!==R){k[0]=z;e:for(var O=0,Y=k.length,X=Y>>>1;O<X;){var L=2*(O+1)-1,U=k[L],_=L+1,B=k[_];if(0>a(U,z))_<Y&&0>a(B,U)?(k[O]=B,k[_]=z,O=_):(k[O]=U,k[L]=z,O=L);else if(_<Y&&0>a(B,z))k[O]=B,k[_]=z,O=_;else break e}}return R}function a(k,R){var z=k.sortIndex-R.sortIndex;return z!==0?z:k.id-R.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(k){for(var R=n(u);R!==null;){if(R.callback===null)l(u);else if(R.startTime<=k)l(u),R.sortIndex=R.expirationTime,t(c,R);else break;R=n(u)}}function j(k){if(S=!1,v(k),!x)if(n(c)!==null)x=!0,E||(E=!0,$());else{var R=n(u);R!==null&&D(j,R.startTime-k)}}var E=!1,M=-1,A=5,C=-1;function H(){return w?!0:!(e.unstable_now()-C<A)}function T(){if(w=!1,E){var k=e.unstable_now();C=k;var R=!0;try{e:{x=!1,S&&(S=!1,y(M),M=-1),p=!0;var z=h;try{t:{for(v(k),f=n(c);f!==null&&!(f.expirationTime>k&&H());){var O=f.callback;if(typeof O=="function"){f.callback=null,h=f.priorityLevel;var Y=O(f.expirationTime<=k);if(k=e.unstable_now(),typeof Y=="function"){f.callback=Y,v(k),R=!0;break t}f===n(c)&&l(c),v(k)}else l(c);f=n(c)}if(f!==null)R=!0;else{var X=n(u);X!==null&&D(j,X.startTime-k),R=!1}}break e}finally{f=null,h=z,p=!1}R=void 0}}finally{R?$():E=!1}}}var $;if(typeof m=="function")$=function(){m(T)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,N=V.port2;V.port1.onmessage=T,$=function(){N.postMessage(null)}}else $=function(){g(T,0)};function D(k,R){M=g(function(){k(e.unstable_now())},R)}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(k){k.callback=null},e.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<k?Math.floor(1e3/k):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(k){switch(h){case 1:case 2:case 3:var R=3;break;default:R=h}var z=h;h=R;try{return k()}finally{h=z}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(k,R){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var z=h;h=k;try{return R()}finally{h=z}},e.unstable_scheduleCallback=function(k,R,z){var O=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?O+z:O):z=O,k){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=z+Y,k={id:d++,callback:R,priorityLevel:k,startTime:z,expirationTime:Y,sortIndex:-1},z>O?(k.sortIndex=z,t(u,k),n(c)===null&&k===n(u)&&(S?(y(M),M=-1):S=!0,D(j,z-O))):(k.sortIndex=Y,t(c,k),x||p||(x=!0,E||(E=!0,$()))),k},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(k){var R=h;return function(){var z=h;h=R;try{return k.apply(this,arguments)}finally{h=z}}}})(Hx);Ox.exports=Hx;var F2=Ox.exports,Lx={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 P2=b;function $x(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 sl(){}var ut={d:{f:sl,r:function(){throw Error($x(522))},D:sl,C:sl,L:sl,m:sl,X:sl,S:sl,M:sl},p:0,findDOMNode:null},ew=Symbol.for("react.portal");function tw(e,t,n){var l=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ew,key:l==null?null:""+l,children:e,containerInfo:t,implementation:n}}var Js=P2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function gc(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($x(299));return tw(e,t,null,n)};dt.flushSync=function(e){var t=Js.T,n=ut.p;try{if(Js.T=null,ut.p=2,e)return e()}finally{Js.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=gc(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=gc(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=gc(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=gc(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 Js.H.useFormState(e,t,n)};dt.useFormStatus=function(){return Js.H.useHostTransitionStatus()};dt.version="19.2.6";function Bx(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Bx)}catch(e){console.error(e)}}Bx(),Lx.exports=dt;var Wl=Lx.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=F2,Ux=b,nw=Wl;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 qx(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function qi(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 Yx(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 Vx(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 wp(e){if(qi(e)!==e)throw Error(Z(188))}function lw(e){var t=e.alternate;if(!t){if(t=qi(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 wp(a),e;if(s===l)return wp(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 Xx(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=Xx(e),t!==null)return t;e=e.sibling}return null}var Ae=Object.assign,aw=Symbol.for("react.element"),gr=Symbol.for("react.transitional.element"),Vs=Symbol.for("react.portal"),_a=Symbol.for("react.fragment"),Gx=Symbol.for("react.strict_mode"),id=Symbol.for("react.profiler"),Qx=Symbol.for("react.consumer"),Un=Symbol.for("react.context"),_f=Symbol.for("react.forward_ref"),rd=Symbol.for("react.suspense"),od=Symbol.for("react.suspense_list"),Af=Symbol.for("react.memo"),ul=Symbol.for("react.lazy"),cd=Symbol.for("react.activity"),sw=Symbol.for("react.memo_cache_sentinel"),Sp=Symbol.iterator;function Ds(e){return e===null||typeof e!="object"?null:(e=Sp&&e[Sp]||e["@@iterator"],typeof e=="function"?e:null)}var iw=Symbol.for("react.client.reference");function ud(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===iw?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case _a:return"Fragment";case id:return"Profiler";case Gx:return"StrictMode";case rd:return"Suspense";case od:return"SuspenseList";case cd:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Vs:return"Portal";case Un:return e.displayName||"Context";case Qx:return(e._context.displayName||"Context")+".Consumer";case _f:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Af:return t=e.displayName||null,t!==null?t:ud(e.type)||"Memo";case ul:t=e._payload,e=e._init;try{return ud(e(t))}catch{}}return null}var Xs=Array.isArray,ne=Ux.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ye=nw.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Fl={pending:!1,data:null,method:null,action:null},dd=[],Aa=-1;function kn(e){return{current:e}}function Fe(e){0>Aa||(e.current=dd[Aa],dd[Aa]=null,Aa--)}function ke(e,t){Aa++,dd[Aa]=e.current,e.current=t}var Sn=kn(null),mi=kn(null),Nl=kn(null),mo=kn(null);function xo(e,t){switch(ke(Nl,t),ke(mi,e),ke(Sn,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Mg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Mg(t),e=fv(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Fe(Sn),ke(Sn,e)}function Pa(){Fe(Sn),Fe(mi),Fe(Nl)}function fd(e){e.memoizedState!==null&&ke(mo,e);var t=Sn.current,n=fv(t,e.type);t!==n&&(ke(mi,e),ke(Sn,n))}function yo(e){mi.current===e&&(Fe(Sn),Fe(mi)),mo.current===e&&(Fe(mo),Ci._currentValue=Fl)}var iu,Np;function Xl(e){if(iu===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);iu=t&&t[1]||"",Np=-1<n.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+iu+e+Np}var ru=!1;function ou(e,t){if(!e||ru)return"";ru=!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{ru=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Xl(n):""}function rw(e,t){switch(e.tag){case 26:case 27:case 5:return Xl(e.type);case 16:return Xl("Lazy");case 13:return e.child!==t&&t!==null?Xl("Suspense Fallback"):Xl("Suspense");case 19:return Xl("SuspenseList");case 0:case 15:return ou(e.type,!1);case 11:return ou(e.type.render,!1);case 1:return ou(e.type,!0);case 31:return Xl("Activity");default:return""}}function jp(e){try{var t="",n=null;do t+=rw(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
47
- Error generating stack: `+l.message+`
48
- `+l.stack}}var hd=Object.prototype.hasOwnProperty,Tf=Ze.unstable_scheduleCallback,cu=Ze.unstable_cancelCallback,ow=Ze.unstable_shouldYield,cw=Ze.unstable_requestPaint,_t=Ze.unstable_now,uw=Ze.unstable_getCurrentPriorityLevel,Zx=Ze.unstable_ImmediatePriority,Ix=Ze.unstable_UserBlockingPriority,vo=Ze.unstable_NormalPriority,dw=Ze.unstable_LowPriority,Kx=Ze.unstable_IdlePriority,fw=Ze.log,hw=Ze.unstable_setDisableYieldValue,Yi=null,At=null;function yl(e){if(typeof fw=="function"&&hw(e),At&&typeof At.setStrictMode=="function")try{At.setStrictMode(Yi,e)}catch{}}var Tt=Math.clz32?Math.clz32:mw,pw=Math.log,gw=Math.LN2;function mw(e){return e>>>=0,e===0?32:31-(pw(e)/gw|0)|0}var mr=256,xr=262144,yr=4194304;function Gl(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 mc(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=Gl(l):(i&=r,i!==0?a=Gl(i):n||(n=r&~e,n!==0&&(a=Gl(n))))):(r=l&~s,r!==0?a=Gl(r):i!==0?a=Gl(i):n||(n=l&~e,n!==0&&(a=Gl(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 Vi(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function xw(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 Wx(){var e=yr;return yr<<=1,!(yr&62914560)&&(yr=4194304),e}function uu(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xi(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function yw(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-Tt(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&&Jx(e,l,0),s!==0&&a===0&&e.tag!==0&&(e.suspendedLanes|=s&~(i&~t))}function Jx(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Tt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function Fx(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-Tt(n),a=1<<l;a&t|e[l]&t&&(e[l]|=t),n&=~a}}function Px(e,t){var n=t&-t;return n=n&42?1:zf(n),n&(e.suspendedLanes|t)?0:n}function zf(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 Df(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function e0(){var e=ye.p;return e!==0?e:(e=window.event,e===void 0?32:Nv(e.type))}function kp(e,t){var n=ye.p;try{return ye.p=e,t()}finally{ye.p=n}}var Ll=Math.random().toString(36).slice(2),et="__reactFiber$"+Ll,wt="__reactProps$"+Ll,bs="__reactContainer$"+Ll,pd="__reactEvents$"+Ll,vw="__reactListeners$"+Ll,bw="__reactHandles$"+Ll,Ep="__reactResources$"+Ll,Gi="__reactMarker$"+Ll;function Rf(e){delete e[et],delete e[wt],delete e[pd],delete e[vw],delete e[bw]}function Ta(e){var t=e[et];if(t)return t;for(var n=e.parentNode;n;){if(t=n[bs]||n[et]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Dg(e);e!==null;){if(n=e[et])return n;e=Dg(e)}return t}e=n,n=e.parentNode}return null}function ws(e){if(e=e[et]||e[bs]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Gs(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(Z(33))}function Va(e){var t=e[Ep];return t||(t=e[Ep]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Je(e){e[Gi]=!0}var t0=new Set,n0={};function ga(e,t){es(e,t),es(e+"Capture",t)}function es(e,t){for(n0[e]=t,e=0;e<t.length;e++)t0.add(t[e])}var ww=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]*$"),Cp={},Mp={};function Sw(e){return hd.call(Mp,e)?!0:hd.call(Cp,e)?!1:ww.test(e)?Mp[e]=!0:(Cp[e]=!0,!1)}function Zr(e,t,n){if(Sw(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 vr(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 Tn(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 Yt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function l0(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Nw(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 gd(e){if(!e._valueTracker){var t=l0(e)?"checked":"value";e._valueTracker=Nw(e,t,""+e[t])}}function a0(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=l0(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function bo(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 jw=/[\n"\\]/g;function Gt(e){return e.replace(jw,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function md(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=""+Yt(t)):e.value!==""+Yt(t)&&(e.value=""+Yt(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?xd(e,i,Yt(t)):n!=null?xd(e,i,Yt(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=""+Yt(r):e.removeAttribute("name")}function s0(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)){gd(e);return}n=n!=null?""+Yt(n):"",t=t!=null?""+Yt(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),gd(e)}function xd(e,t,n){t==="number"&&bo(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Xa(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=""+Yt(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 i0(e,t,n){if(t!=null&&(t=""+Yt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Yt(n):""}function r0(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(Z(92));if(Xs(l)){if(1<l.length)throw Error(Z(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=Yt(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),gd(e)}function ts(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var kw=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 _p(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||kw.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function o0(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&&_p(e,a,l)}else for(var s in t)t.hasOwnProperty(s)&&_p(e,s,t[s])}function Of(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 Ew=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"]]),Cw=/^[\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 Ir(e){return Cw.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function qn(){}var yd=null;function Hf(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var za=null,Ga=null;function Ap(e){var t=ws(e);if(t&&(e=t.stateNode)){var n=e[wt]||null;e:switch(e=t.stateNode,t.type){case"input":if(md(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="'+Gt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var a=l[wt]||null;if(!a)throw Error(Z(90));md(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&&a0(l)}break e;case"textarea":i0(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Xa(e,!!n.multiple,t,!1)}}}var du=!1;function c0(e,t,n){if(du)return e(t,n);du=!0;try{var l=e(t);return l}finally{if(du=!1,(za!==null||Ga!==null)&&(Mc(),za&&(t=za,e=Ga,Ga=za=null,Ap(t),e)))for(t=0;t<e.length;t++)Ap(e[t])}}function xi(e,t){var n=e.stateNode;if(n===null)return null;var l=n[wt]||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 Kn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vd=!1;if(Kn)try{var Rs={};Object.defineProperty(Rs,"passive",{get:function(){vd=!0}}),window.addEventListener("test",Rs,Rs),window.removeEventListener("test",Rs,Rs)}catch{vd=!1}var vl=null,Lf=null,Kr=null;function u0(){if(Kr)return Kr;var e,t=Lf,n=t.length,l,a="value"in vl?vl.value:vl.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 Kr=a.slice(e,1<l?1-l:void 0)}function Wr(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 br(){return!0}function Tp(){return!1}function St(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)?br:Tp,this.isPropagationStopped=Tp,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=br)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=br)},persist:function(){},isPersistent:br}),t}var ma={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xc=St(ma),Qi=Ae({},ma,{view:0,detail:0}),Mw=St(Qi),fu,hu,Os,yc=Ae({},Qi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$f,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!==Os&&(Os&&e.type==="mousemove"?(fu=e.screenX-Os.screenX,hu=e.screenY-Os.screenY):hu=fu=0,Os=e),fu)},movementY:function(e){return"movementY"in e?e.movementY:hu}}),zp=St(yc),_w=Ae({},yc,{dataTransfer:0}),Aw=St(_w),Tw=Ae({},Qi,{relatedTarget:0}),pu=St(Tw),zw=Ae({},ma,{animationName:0,elapsedTime:0,pseudoElement:0}),Dw=St(zw),Rw=Ae({},ma,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ow=St(Rw),Hw=Ae({},ma,{data:0}),Dp=St(Hw),Lw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$w={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"},Bw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Uw(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Bw[e])?!!t[e]:!1}function $f(){return Uw}var qw=Ae({},Qi,{key:function(e){if(e.key){var t=Lw[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Wr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?$w[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$f,charCode:function(e){return e.type==="keypress"?Wr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Wr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Yw=St(qw),Vw=Ae({},yc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Rp=St(Vw),Xw=Ae({},Qi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$f}),Gw=St(Xw),Qw=Ae({},ma,{propertyName:0,elapsedTime:0,pseudoElement:0}),Zw=St(Qw),Iw=Ae({},yc,{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}),Kw=St(Iw),Ww=Ae({},ma,{newState:0,oldState:0}),Jw=St(Ww),Fw=[9,13,27,32],Bf=Kn&&"CompositionEvent"in window,Fs=null;Kn&&"documentMode"in document&&(Fs=document.documentMode);var Pw=Kn&&"TextEvent"in window&&!Fs,d0=Kn&&(!Bf||Fs&&8<Fs&&11>=Fs),Op=" ",Hp=!1;function f0(e,t){switch(e){case"keyup":return Fw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function h0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Da=!1;function eS(e,t){switch(e){case"compositionend":return h0(t);case"keypress":return t.which!==32?null:(Hp=!0,Op);case"textInput":return e=t.data,e===Op&&Hp?null:e;default:return null}}function tS(e,t){if(Da)return e==="compositionend"||!Bf&&f0(e,t)?(e=u0(),Kr=Lf=vl=null,Da=!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 d0&&t.locale!=="ko"?null:t.data;default:return null}}var nS={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 Lp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!nS[e.type]:t==="textarea"}function p0(e,t,n,l){za?Ga?Ga.push(l):Ga=[l]:za=l,t=$o(t,"onChange"),0<t.length&&(n=new xc("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var Ps=null,yi=null;function lS(e){cv(e,0)}function vc(e){var t=Gs(e);if(a0(t))return e}function $p(e,t){if(e==="change")return t}var g0=!1;if(Kn){var gu;if(Kn){var mu="oninput"in document;if(!mu){var Bp=document.createElement("div");Bp.setAttribute("oninput","return;"),mu=typeof Bp.oninput=="function"}gu=mu}else gu=!1;g0=gu&&(!document.documentMode||9<document.documentMode)}function Up(){Ps&&(Ps.detachEvent("onpropertychange",m0),yi=Ps=null)}function m0(e){if(e.propertyName==="value"&&vc(yi)){var t=[];p0(t,yi,e,Hf(e)),c0(lS,t)}}function aS(e,t,n){e==="focusin"?(Up(),Ps=t,yi=n,Ps.attachEvent("onpropertychange",m0)):e==="focusout"&&Up()}function sS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return vc(yi)}function iS(e,t){if(e==="click")return vc(t)}function rS(e,t){if(e==="input"||e==="change")return vc(t)}function oS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Dt=typeof Object.is=="function"?Object.is:oS;function vi(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(!hd.call(t,a)||!Dt(e[a],t[a]))return!1}return!0}function qp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Yp(e,t){var n=qp(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=qp(n)}}function x0(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?x0(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function y0(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=bo(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=bo(e.document)}return t}function Uf(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 cS=Kn&&"documentMode"in document&&11>=document.documentMode,Ra=null,bd=null,ei=null,wd=!1;function Vp(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;wd||Ra==null||Ra!==bo(l)||(l=Ra,"selectionStart"in l&&Uf(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}),ei&&vi(ei,l)||(ei=l,l=$o(bd,"onSelect"),0<l.length&&(t=new xc("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=Ra)))}function Vl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Oa={animationend:Vl("Animation","AnimationEnd"),animationiteration:Vl("Animation","AnimationIteration"),animationstart:Vl("Animation","AnimationStart"),transitionrun:Vl("Transition","TransitionRun"),transitionstart:Vl("Transition","TransitionStart"),transitioncancel:Vl("Transition","TransitionCancel"),transitionend:Vl("Transition","TransitionEnd")},xu={},v0={};Kn&&(v0=document.createElement("div").style,"AnimationEvent"in window||(delete Oa.animationend.animation,delete Oa.animationiteration.animation,delete Oa.animationstart.animation),"TransitionEvent"in window||delete Oa.transitionend.transition);function xa(e){if(xu[e])return xu[e];if(!Oa[e])return e;var t=Oa[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in v0)return xu[e]=t[n];return e}var b0=xa("animationend"),w0=xa("animationiteration"),S0=xa("animationstart"),uS=xa("transitionrun"),dS=xa("transitionstart"),fS=xa("transitioncancel"),N0=xa("transitionend"),j0=new Map,Sd="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(" ");Sd.push("scrollEnd");function un(e,t){j0.set(e,t),ga(t,[e])}var wo=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)},Ut=[],Ha=0,qf=0;function bc(){for(var e=Ha,t=qf=Ha=0;t<e;){var n=Ut[t];Ut[t++]=null;var l=Ut[t];Ut[t++]=null;var a=Ut[t];Ut[t++]=null;var s=Ut[t];if(Ut[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&&k0(n,a,s)}}function wc(e,t,n,l){Ut[Ha++]=e,Ut[Ha++]=t,Ut[Ha++]=n,Ut[Ha++]=l,qf|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Yf(e,t,n,l){return wc(e,t,n,l),So(e)}function ya(e,t){return wc(e,null,null,t),So(e)}function k0(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-Tt(n),e=s.hiddenUpdates,l=e[a],l===null?e[a]=[t]:l.push(t),t.lane=n|536870912),s):null}function So(e){if(50<ci)throw ci=0,Vd=null,Error(Z(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var La={};function hS(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 Et(e,t,n,l){return new hS(e,t,n,l)}function Vf(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xn(e,t){var n=e.alternate;return n===null?(n=Et(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 E0(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 Jr(e,t,n,l,a,s){var i=0;if(l=e,typeof e=="function")Vf(e)&&(i=1);else if(typeof e=="string")i=yN(e,n,Sn.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case cd:return e=Et(31,n,t,a),e.elementType=cd,e.lanes=s,e;case _a:return Pl(n.children,a,s,t);case Gx:i=8,a|=24;break;case id:return e=Et(12,n,t,a|2),e.elementType=id,e.lanes=s,e;case rd:return e=Et(13,n,t,a),e.elementType=rd,e.lanes=s,e;case od:return e=Et(19,n,t,a),e.elementType=od,e.lanes=s,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Un:i=10;break e;case Qx:i=9;break e;case _f:i=11;break e;case Af:i=14;break e;case ul:i=16,l=null;break e}i=29,n=Error(Z(130,e===null?"null":typeof e,"")),l=null}return t=Et(i,n,t,a),t.elementType=e,t.type=l,t.lanes=s,t}function Pl(e,t,n,l){return e=Et(7,e,l,t),e.lanes=n,e}function yu(e,t,n){return e=Et(6,e,null,t),e.lanes=n,e}function C0(e){var t=Et(18,null,null,0);return t.stateNode=e,t}function vu(e,t,n){return t=Et(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Xp=new WeakMap;function Qt(e,t){if(typeof e=="object"&&e!==null){var n=Xp.get(e);return n!==void 0?n:(t={value:e,source:t,stack:jp(t)},Xp.set(e,t),t)}return{value:e,source:t,stack:jp(t)}}var $a=[],Ba=0,No=null,bi=0,Vt=[],Xt=0,zl=null,vn=1,bn="";function $n(e,t){$a[Ba++]=bi,$a[Ba++]=No,No=e,bi=t}function M0(e,t,n){Vt[Xt++]=vn,Vt[Xt++]=bn,Vt[Xt++]=zl,zl=e;var l=vn;e=bn;var a=32-Tt(l)-1;l&=~(1<<a),n+=1;var s=32-Tt(t)+a;if(30<s){var i=a-a%5;s=(l&(1<<i)-1).toString(32),l>>=i,a-=i,vn=1<<32-Tt(t)+a|n<<a|l,bn=s+e}else vn=1<<s|n<<a|l,bn=e}function Xf(e){e.return!==null&&($n(e,1),M0(e,1,0))}function Gf(e){for(;e===No;)No=$a[--Ba],$a[Ba]=null,bi=$a[--Ba],$a[Ba]=null;for(;e===zl;)zl=Vt[--Xt],Vt[Xt]=null,bn=Vt[--Xt],Vt[Xt]=null,vn=Vt[--Xt],Vt[Xt]=null}function _0(e,t){Vt[Xt++]=vn,Vt[Xt++]=bn,Vt[Xt++]=zl,vn=t.id,bn=t.overflow,zl=e}var tt=null,Ce=null,de=!1,jl=null,Zt=!1,Nd=Error(Z(519));function Dl(e){var t=Error(Z(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wi(Qt(t,e)),Nd}function Gp(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[et]=e,t[wt]=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<ki.length;n++)oe(ki[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),s0(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),r0(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||dv(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=qn),t=!0):t=!1,t||Dl(e,!0)}function Qp(e){for(tt=e.return;tt;)switch(tt.tag){case 5:case 31:case 13:Zt=!1;return;case 27:case 3:Zt=!0;return;default:tt=tt.return}}function Sa(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")||Id(e.type,e.memoizedProps)),n=!n),n&&Ce&&Dl(e),Qp(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Z(317));Ce=zg(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Z(317));Ce=zg(e)}else t===27?(t=Ce,$l(e.type)?(e=Fd,Fd=null,Ce=e):Ce=t):Ce=tt?Kt(e.stateNode.nextSibling):null;return!0}function sa(){Ce=tt=null,de=!1}function bu(){var e=jl;return e!==null&&(xt===null?xt=e:xt.push.apply(xt,e),jl=null),e}function wi(e){jl===null?jl=[e]:jl.push(e)}var jd=kn(null),va=null,Yn=null;function hl(e,t,n){ke(jd,t._currentValue),t._currentValue=n}function Gn(e){e._currentValue=jd.current,Fe(jd)}function kd(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 Ed(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),kd(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),kd(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 Ss(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===mo.current){if(i=a.alternate,i===null)throw Error(Z(387));i.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e!==null?e.push(Ci):e=[Ci])}a=a.return}e!==null&&Ed(t,e,n,l),t.flags|=262144}function jo(e){for(e=e.firstContext;e!==null;){if(!Dt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ia(e){va=e,Yn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function nt(e){return A0(va,e)}function wr(e,t){return va===null&&ia(e),A0(e,t)}function A0(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Yn===null){if(e===null)throw Error(Z(308));Yn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Yn=Yn.next=t;return n}var pS=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()})}},gS=Ze.unstable_scheduleCallback,mS=Ze.unstable_NormalPriority,qe={$$typeof:Un,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qf(){return{controller:new pS,data:new Map,refCount:0}}function Zi(e){e.refCount--,e.refCount===0&&gS(mS,function(){e.controller.abort()})}var ti=null,Cd=0,ns=0,Qa=null;function xS(e,t){if(ti===null){var n=ti=[];Cd=0,ns=xh(),Qa={status:"pending",value:void 0,then:function(l){n.push(l)}}}return Cd++,t.then(Zp,Zp),t}function Zp(){if(--Cd===0&&ti!==null){Qa!==null&&(Qa.status="fulfilled");var e=ti;ti=null,ns=0,Qa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function yS(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 Ip=ne.S;ne.S=function(e,t){Xy=_t(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&xS(e,t),Ip!==null&&Ip(e,t)};var ea=kn(null);function Zf(){var e=ea.current;return e!==null?e:je.pooledCache}function Fr(e,t){t===null?ke(ea,ea.current):ke(ea,t.pool)}function T0(){var e=Zf();return e===null?null:{parent:qe._currentValue,pool:e}}var Ns=Error(Z(460)),If=Error(Z(474)),Sc=Error(Z(542)),ko={then:function(){}};function Kp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function z0(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(qn,qn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Jp(e),e;default:if(typeof t.status=="string")t.then(qn,qn);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,Jp(e),e}throw ta=t,Ns}}function Ql(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(ta=n,Ns):n}}var ta=null;function Wp(){if(ta===null)throw Error(Z(459));var e=ta;return ta=null,e}function Jp(e){if(e===Ns||e===Sc)throw Error(Z(483))}var Za=null,Si=0;function Sr(e){var t=Si;return Si+=1,Za===null&&(Za=[]),z0(Za,e,t)}function Hs(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Nr(e,t){throw t.$$typeof===aw?Error(Z(525)):(e=Object.prototype.toString.call(t),Error(Z(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function D0(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=Xn(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=yu(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===_a?d(g,y,m.props.children,v,m.key):y!==null&&(y.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===ul&&Ql(j)===y.type)?(y=a(y,m.props),Hs(y,m),y.return=g,y):(y=Jr(m.type,m.key,m.props,null,g.mode,v),Hs(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=vu(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=Pl(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=yu(""+y,g.mode,m),y.return=g,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case gr:return m=Jr(y.type,y.key,y.props,null,g.mode,m),Hs(m,y),m.return=g,m;case Vs:return y=vu(y,g.mode,m),y.return=g,y;case ul:return y=Ql(y),f(g,y,m)}if(Xs(y)||Ds(y))return y=Pl(y,g.mode,m,null),y.return=g,y;if(typeof y.then=="function")return f(g,Sr(y),m);if(y.$$typeof===Un)return f(g,wr(g,y),m);Nr(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 gr:return m.key===j?c(g,y,m,v):null;case Vs:return m.key===j?u(g,y,m,v):null;case ul:return m=Ql(m),h(g,y,m,v)}if(Xs(m)||Ds(m))return j!==null?null:d(g,y,m,v,null);if(typeof m.then=="function")return h(g,y,Sr(m),v);if(m.$$typeof===Un)return h(g,y,wr(g,m),v);Nr(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 gr:return g=g.get(v.key===null?m:v.key)||null,c(y,g,v,j);case Vs:return g=g.get(v.key===null?m:v.key)||null,u(y,g,v,j);case ul:return v=Ql(v),p(g,y,m,v,j)}if(Xs(v)||Ds(v))return g=g.get(m)||null,d(y,g,v,j,null);if(typeof v.then=="function")return p(g,y,m,Sr(v),j);if(v.$$typeof===Un)return p(g,y,m,wr(y,v),j);Nr(y,v)}return null}function x(g,y,m,v){for(var j=null,E=null,M=y,A=y=0,C=null;M!==null&&A<m.length;A++){M.index>A?(C=M,M=null):C=M.sibling;var H=h(g,M,m[A],v);if(H===null){M===null&&(M=C);break}e&&M&&H.alternate===null&&t(g,M),y=s(H,y,A),E===null?j=H:E.sibling=H,E=H,M=C}if(A===m.length)return n(g,M),de&&$n(g,A),j;if(M===null){for(;A<m.length;A++)M=f(g,m[A],v),M!==null&&(y=s(M,y,A),E===null?j=M:E.sibling=M,E=M);return de&&$n(g,A),j}for(M=l(M);A<m.length;A++)C=p(M,g,A,m[A],v),C!==null&&(e&&C.alternate!==null&&M.delete(C.key===null?A:C.key),y=s(C,y,A),E===null?j=C:E.sibling=C,E=C);return e&&M.forEach(function(T){return t(g,T)}),de&&$n(g,A),j}function S(g,y,m,v){if(m==null)throw Error(Z(151));for(var j=null,E=null,M=y,A=y=0,C=null,H=m.next();M!==null&&!H.done;A++,H=m.next()){M.index>A?(C=M,M=null):C=M.sibling;var T=h(g,M,H.value,v);if(T===null){M===null&&(M=C);break}e&&M&&T.alternate===null&&t(g,M),y=s(T,y,A),E===null?j=T:E.sibling=T,E=T,M=C}if(H.done)return n(g,M),de&&$n(g,A),j;if(M===null){for(;!H.done;A++,H=m.next())H=f(g,H.value,v),H!==null&&(y=s(H,y,A),E===null?j=H:E.sibling=H,E=H);return de&&$n(g,A),j}for(M=l(M);!H.done;A++,H=m.next())H=p(M,g,A,H.value,v),H!==null&&(e&&H.alternate!==null&&M.delete(H.key===null?A:H.key),y=s(H,y,A),E===null?j=H:E.sibling=H,E=H);return e&&M.forEach(function($){return t(g,$)}),de&&$n(g,A),j}function w(g,y,m,v){if(typeof m=="object"&&m!==null&&m.type===_a&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case gr:e:{for(var j=m.key;y!==null;){if(y.key===j){if(j=m.type,j===_a){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===ul&&Ql(j)===y.type){n(g,y.sibling),v=a(y,m.props),Hs(v,m),v.return=g,g=v;break e}n(g,y);break}else t(g,y);y=y.sibling}m.type===_a?(v=Pl(m.props.children,g.mode,v,m.key),v.return=g,g=v):(v=Jr(m.type,m.key,m.props,null,g.mode,v),Hs(v,m),v.return=g,g=v)}return i(g);case Vs: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=vu(m,g.mode,v),v.return=g,g=v}return i(g);case ul:return m=Ql(m),w(g,y,m,v)}if(Xs(m))return x(g,y,m,v);if(Ds(m)){if(j=Ds(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,Sr(m),v);if(m.$$typeof===Un)return w(g,y,wr(g,m),v);Nr(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=yu(m,g.mode,v),v.return=g,g=v),i(g)):n(g,y)}return function(g,y,m,v){try{Si=0;var j=w(g,y,m,v);return Za=null,j}catch(M){if(M===Ns||M===Sc)throw M;var E=Et(29,M,null,g.mode);return E.lanes=v,E.return=g,E}finally{}}}var ra=D0(!0),R0=D0(!1),dl=!1;function Kf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Md(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 kl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function El(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=So(e),k0(e,null,n),t}return wc(e,l,t,n),So(e)}function ni(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,Fx(e,n)}}function wu(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 _d=!1;function li(){if(_d){var e=Qa;if(e!==null)throw e}}function ai(e,t,n,l){_d=!1;var a=e.updateQueue;dl=!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===ns&&(_d=!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:dl=!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),Ol|=i,e.lanes=i,e.memoizedState=f}}function O0(e,t){if(typeof e!="function")throw Error(Z(191,e));e.call(t)}function H0(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)O0(n[e],t)}var ls=kn(null),Eo=kn(0);function Fp(e,t){e=Pn,ke(Eo,e),ke(ls,t),Pn=e|t.baseLanes}function Ad(){ke(Eo,Pn),ke(ls,ls.current)}function Wf(){Pn=Eo.current,Fe(ls),Fe(Eo)}var Rt=kn(null),It=null;function pl(e){var t=e.alternate;ke(Le,Le.current&1),ke(Rt,e),It===null&&(t===null||ls.current!==null||t.memoizedState!==null)&&(It=e)}function Td(e){ke(Le,Le.current),ke(Rt,e),It===null&&(It=e)}function L0(e){e.tag===22?(ke(Le,Le.current),ke(Rt,e),It===null&&(It=e)):gl()}function gl(){ke(Le,Le.current),ke(Rt,Rt.current)}function kt(e){Fe(Rt),It===e&&(It=null),Fe(Le)}var Le=kn(0);function Co(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Wd(n)||Jd(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 Wn=0,re=null,Ne=null,Be=null,Mo=!1,Ia=!1,oa=!1,_o=0,Ni=0,Ka=null,vS=0;function Oe(){throw Error(Z(321))}function Jf(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 Ff(e,t,n,l,a,s){return Wn=s,re=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ne.H=e===null||e.memoizedState===null?py:ch,oa=!1,s=n(l,a),oa=!1,Ia&&(s=B0(t,n,l,a)),$0(e),s}function $0(e){ne.H=ji;var t=Ne!==null&&Ne.next!==null;if(Wn=0,Be=Ne=re=null,Mo=!1,Ni=0,Ka=null,t)throw Error(Z(300));e===null||Ye||(e=e.dependencies,e!==null&&jo(e)&&(Ye=!0))}function B0(e,t,n,l){re=e;var a=0;do{if(Ia&&(Ka=null),Ni=0,Ia=!1,25<=a)throw Error(Z(301));if(a+=1,Be=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=gy,s=t(n,l)}while(Ia);return s}function bS(){var e=ne.H,t=e.useState()[0];return t=typeof t.then=="function"?Ii(t):t,e=e.useState()[0],(Ne!==null?Ne.memoizedState:null)!==e&&(re.flags|=1024),t}function Pf(){var e=_o!==0;return _o=0,e}function eh(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function th(e){if(Mo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Mo=!1}Wn=0,Be=Ne=re=null,Ia=!1,Ni=_o=0,Ka=null}function ct(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Be===null?re.memoizedState=Be=e:Be=Be.next=e,Be}function $e(){if(Ne===null){var e=re.alternate;e=e!==null?e.memoizedState:null}else e=Ne.next;var t=Be===null?re.memoizedState:Be.next;if(t!==null)Be=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},Be===null?re.memoizedState=Be=e:Be=Be.next=e}return Be}function Nc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ii(e){var t=Ni;return Ni+=1,Ka===null&&(Ka=[]),e=z0(Ka,e,t),t=re,(Be===null?t.memoizedState:Be.next)===null&&(t=t.alternate,ne.H=t===null||t.memoizedState===null?py:ch),e}function jc(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ii(e);if(e.$$typeof===Un)return nt(e)}throw Error(Z(438,String(e)))}function nh(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=Nc(),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]=sw;return t.index++,n}function Jn(e,t){return typeof t=="function"?t(e):t}function Pr(e){var t=$e();return lh(t,Ne,e)}function lh(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:(Wn&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===ns&&(d=!0);else if((Wn&h)===h){u=u.next,h===ns&&(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,Ol|=h;f=u.action,oa&&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,Ol|=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=Qa,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 Su(e){var t=$e(),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 U0(e,t,n){var l=re,a=$e(),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,ah(V0.bind(null,l,a,e),[e]),a.getSnapshot!==t||i||Be!==null&&Be.memoizedState.tag&1){if(l.flags|=2048,as(9,{destroy:void 0},Y0.bind(null,l,a,n,t),null),je===null)throw Error(Z(349));s||Wn&127||q0(l,t,n)}return n}function q0(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=re.updateQueue,t===null?(t=Nc(),re.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Y0(e,t,n,l){t.value=n,t.getSnapshot=l,X0(t)&&G0(e)}function V0(e,t,n){return n(function(){X0(t)&&G0(e)})}function X0(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Dt(e,n)}catch{return!0}}function G0(e){var t=ya(e,2);t!==null&&bt(t,e,2)}function zd(e){var t=ct();if(typeof e=="function"){var n=e;if(e=n(),oa){yl(!0);try{n()}finally{yl(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jn,lastRenderedState:e},t}function Q0(e,t,n,l){return e.baseState=n,lh(e,Ne,typeof l=="function"?l:Jn)}function wS(e,t,n,l,a){if(Ec(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,Z0(t,s)):(s.next=n.next,t.pending=n.next=s)}}function Z0(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),Pp(e,t,r)}catch(u){Dd(e,t,u)}finally{s!==null&&i.types!==null&&(s.types=i.types),ne.T=s}}else try{s=n(a,l),Pp(e,t,s)}catch(u){Dd(e,t,u)}}function Pp(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){eg(e,t,l)},function(l){return Dd(e,t,l)}):eg(e,t,n)}function eg(e,t,n){t.status="fulfilled",t.value=n,I0(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Z0(e,n)))}function Dd(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,I0(t),t=t.next;while(t!==l)}e.action=null}function I0(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function K0(e,t){return t}function tg(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=Zt;a.nodeType!==8;){if(!s){a=null;break t}if(a=Kt(a.nextSibling),a===null){a=null;break t}}s=a.data,a=s==="F!"||s==="F"?a:null}if(a){Ce=Kt(a.nextSibling),l=a.data==="F!";break e}}Dl(l)}l=!1}l&&(t=n[0])}}return n=ct(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:K0,lastRenderedState:t},n.queue=l,n=dy.bind(null,re,l),l.dispatch=n,l=zd(!1),s=oh.bind(null,re,!1,l.queue),l=ct(),a={state:t,dispatch:null,action:e,pending:null},l.queue=a,n=wS.bind(null,re,a,s,n),a.dispatch=n,l.memoizedState=e,[t,n,!1]}function ng(e){var t=$e();return W0(t,Ne,e)}function W0(e,t,n){if(t=lh(e,t,K0)[0],e=Pr(Jn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Ii(t)}catch(i){throw i===Ns?Sc:i}else l=t;t=$e();var a=t.queue,s=a.dispatch;return n!==t.memoizedState&&(re.flags|=2048,as(9,{destroy:void 0},SS.bind(null,a,n),null)),[l,s,e]}function SS(e,t){e.action=t}function lg(e){var t=$e(),n=Ne;if(n!==null)return W0(t,n,e);$e(),t=t.memoizedState,n=$e();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function as(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=re.updateQueue,t===null&&(t=Nc(),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 J0(){return $e().memoizedState}function eo(e,t,n,l){var a=ct();re.flags|=e,a.memoizedState=as(1|t,{destroy:void 0},n,l===void 0?null:l)}function kc(e,t,n,l){var a=$e();l=l===void 0?null:l;var s=a.memoizedState.inst;Ne!==null&&l!==null&&Jf(l,Ne.memoizedState.deps)?a.memoizedState=as(t,s,n,l):(re.flags|=e,a.memoizedState=as(1|t,s,n,l))}function ag(e,t){eo(8390656,8,e,t)}function ah(e,t){kc(2048,8,e,t)}function NS(e){re.flags|=4;var t=re.updateQueue;if(t===null)t=Nc(),re.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function F0(e){var t=$e().memoizedState;return NS({ref:t,nextImpl:e}),function(){if(xe&2)throw Error(Z(440));return t.impl.apply(void 0,arguments)}}function P0(e,t){return kc(4,2,e,t)}function ey(e,t){return kc(4,4,e,t)}function ty(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 ny(e,t,n){n=n!=null?n.concat([e]):null,kc(4,4,ty.bind(null,t,e),n)}function sh(){}function ly(e,t){var n=$e();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&Jf(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function ay(e,t){var n=$e();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&Jf(t,l[1]))return l[0];if(l=e(),oa){yl(!0);try{e()}finally{yl(!1)}}return n.memoizedState=[l,t],l}function ih(e,t,n){return n===void 0||Wn&1073741824&&!(ue&261930)?e.memoizedState=t:(e.memoizedState=n,e=Qy(),re.lanes|=e,Ol|=e,n)}function sy(e,t,n,l){return Dt(n,t)?n:ls.current!==null?(e=ih(e,n,l),Dt(e,t)||(Ye=!0),e):!(Wn&42)||Wn&1073741824&&!(ue&261930)?(Ye=!0,e.memoizedState=n):(e=Qy(),re.lanes|=e,Ol|=e,t)}function iy(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,oh(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=yS(c,l);si(e,t,d,zt(e))}else si(e,t,l,zt(e))}catch(f){si(e,t,{then:function(){},status:"rejected",reason:f},zt())}finally{ye.p=s,i!==null&&r.types!==null&&(i.types=r.types),ne.T=i}}function jS(){}function Rd(e,t,n,l){if(e.tag!==5)throw Error(Z(476));var a=ry(e).queue;iy(e,a,t,Fl,n===null?jS:function(){return oy(e),n(l)})}function ry(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Fl,baseState:Fl,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jn,lastRenderedState:Fl},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function oy(e){var t=ry(e);t.next===null&&(t=e.alternate.memoizedState),si(e,t.next.queue,{},zt())}function rh(){return nt(Ci)}function cy(){return $e().memoizedState}function uy(){return $e().memoizedState}function kS(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=zt();e=kl(n);var l=El(t,e,n);l!==null&&(bt(l,t,n),ni(l,t,n)),t={cache:Qf()},e.payload=t;return}t=t.return}}function ES(e,t,n){var l=zt();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ec(e)?fy(t,n):(n=Yf(e,t,n,l),n!==null&&(bt(n,e,l),hy(n,t,l)))}function dy(e,t,n){var l=zt();si(e,t,n,l)}function si(e,t,n,l){var a={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ec(e))fy(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 wc(e,t,a,0),je===null&&bc(),!1}catch{}finally{}if(n=Yf(e,t,a,l),n!==null)return bt(n,e,l),hy(n,t,l),!0}return!1}function oh(e,t,n,l){if(l={lane:2,revertLane:xh(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ec(e)){if(t)throw Error(Z(479))}else t=Yf(e,n,l,2),t!==null&&bt(t,e,2)}function Ec(e){var t=e.alternate;return e===re||t!==null&&t===re}function fy(e,t){Ia=Mo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function hy(e,t,n){if(n&4194048){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Fx(e,n)}}var ji={readContext:nt,use:jc,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};ji.useEffectEvent=Oe;var py={readContext:nt,use:jc,useCallback:function(e,t){return ct().memoizedState=[e,t===void 0?null:t],e},useContext:nt,useEffect:ag,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,eo(4194308,4,ty.bind(null,t,e),n)},useLayoutEffect:function(e,t){return eo(4194308,4,e,t)},useInsertionEffect:function(e,t){eo(4,2,e,t)},useMemo:function(e,t){var n=ct();t=t===void 0?null:t;var l=e();if(oa){yl(!0);try{e()}finally{yl(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=ct();if(n!==void 0){var a=n(t);if(oa){yl(!0);try{n(t)}finally{yl(!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=ES.bind(null,re,e),[l.memoizedState,e]},useRef:function(e){var t=ct();return e={current:e},t.memoizedState=e},useState:function(e){e=zd(e);var t=e.queue,n=dy.bind(null,re,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:sh,useDeferredValue:function(e,t){var n=ct();return ih(n,e,t)},useTransition:function(){var e=zd(!1);return e=iy.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||q0(l,t,n)}a.memoizedState=n;var s={value:n,getSnapshot:t};return a.queue=s,ag(V0.bind(null,l,s,e),[e]),l.flags|=2048,as(9,{destroy:void 0},Y0.bind(null,l,s,n,t),null),n},useId:function(){var e=ct(),t=je.identifierPrefix;if(de){var n=bn,l=vn;n=(l&~(1<<32-Tt(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=_o++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=vS++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:rh,useFormState:tg,useActionState:tg,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=oh.bind(null,re,!0,n),n.dispatch=t,[e,t]},useMemoCache:nh,useCacheRefresh:function(){return ct().memoizedState=kS.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)}}},ch={readContext:nt,use:jc,useCallback:ly,useContext:nt,useEffect:ah,useImperativeHandle:ny,useInsertionEffect:P0,useLayoutEffect:ey,useMemo:ay,useReducer:Pr,useRef:J0,useState:function(){return Pr(Jn)},useDebugValue:sh,useDeferredValue:function(e,t){var n=$e();return sy(n,Ne.memoizedState,e,t)},useTransition:function(){var e=Pr(Jn)[0],t=$e().memoizedState;return[typeof e=="boolean"?e:Ii(e),t]},useSyncExternalStore:U0,useId:cy,useHostTransitionStatus:rh,useFormState:ng,useActionState:ng,useOptimistic:function(e,t){var n=$e();return Q0(n,Ne,e,t)},useMemoCache:nh,useCacheRefresh:uy};ch.useEffectEvent=F0;var gy={readContext:nt,use:jc,useCallback:ly,useContext:nt,useEffect:ah,useImperativeHandle:ny,useInsertionEffect:P0,useLayoutEffect:ey,useMemo:ay,useReducer:Su,useRef:J0,useState:function(){return Su(Jn)},useDebugValue:sh,useDeferredValue:function(e,t){var n=$e();return Ne===null?ih(n,e,t):sy(n,Ne.memoizedState,e,t)},useTransition:function(){var e=Su(Jn)[0],t=$e().memoizedState;return[typeof e=="boolean"?e:Ii(e),t]},useSyncExternalStore:U0,useId:cy,useHostTransitionStatus:rh,useFormState:lg,useActionState:lg,useOptimistic:function(e,t){var n=$e();return Ne!==null?Q0(n,Ne,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:nh,useCacheRefresh:uy};gy.useEffectEvent=F0;function Nu(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 Od={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=zt(),a=kl(l);a.payload=t,n!=null&&(a.callback=n),t=El(e,a,l),t!==null&&(bt(t,e,l),ni(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=zt(),a=kl(l);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=El(e,a,l),t!==null&&(bt(t,e,l),ni(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=zt(),l=kl(n);l.tag=2,t!=null&&(l.callback=t),t=El(e,l,n),t!==null&&(bt(t,e,n),ni(t,e,n))}};function sg(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?!vi(n,l)||!vi(a,s):!0}function ig(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&&Od.enqueueReplaceState(t,t.state,null)}function ca(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 my(e){wo(e)}function xy(e){console.error(e)}function yy(e){wo(e)}function Ao(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function rg(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 Hd(e,t,n){return n=kl(n),n.tag=3,n.payload={element:null},n.callback=function(){Ao(e,t)},n}function vy(e){return e=kl(e),e.tag=3,e}function by(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(){rg(t,n,l)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){rg(t,n,l),typeof a!="function"&&(Cl===null?Cl=new Set([this]):Cl.add(this));var r=l.stack;this.componentDidCatch(l.value,{componentStack:r!==null?r:""})})}function CS(e,t,n,l,a){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&Ss(t,n,a,!0),n=Rt.current,n!==null){switch(n.tag){case 31:case 13:return It===null?Oo():n.alternate===null&&He===0&&(He=3),n.flags&=-257,n.flags|=65536,n.lanes=a,l===ko?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),Ru(e,l,a)),!1;case 22:return n.flags|=65536,l===ko?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)),Ru(e,l,a)),!1}throw Error(Z(435,n.tag))}return Ru(e,l,a),Oo(),!1}if(de)return t=Rt.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,l!==Nd&&(e=Error(Z(422),{cause:l}),wi(Qt(e,n)))):(l!==Nd&&(t=Error(Z(423),{cause:l}),wi(Qt(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,l=Qt(l,n),a=Hd(e.stateNode,l,a),wu(e,a),He!==4&&(He=2)),!1;var s=Error(Z(520),{cause:l});if(s=Qt(s,n),oi===null?oi=[s]:oi.push(s),He!==4&&(He=2),t===null)return!0;l=Qt(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Hd(n.stateNode,l,e),wu(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"&&(Cl===null||!Cl.has(s))))return n.flags|=65536,a&=-a,n.lanes|=a,a=vy(a),by(a,e,n,l),wu(n,a),!1}n=n.return}while(n!==null);return!1}var uh=Error(Z(461)),Ye=!1;function Pe(e,t,n,l){t.child=e===null?R0(t,null,n,l):ra(t,e.child,n,l)}function og(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 ia(t),l=Ff(e,t,n,i,s,a),r=Pf(),e!==null&&!Ye?(eh(e,t,a),Fn(e,t,a)):(de&&r&&Xf(t),t.flags|=1,Pe(e,t,l,a),t.child)}function cg(e,t,n,l,a){if(e===null){var s=n.type;return typeof s=="function"&&!Vf(s)&&s.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=s,wy(e,t,s,l,a)):(e=Jr(n.type,null,l,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!dh(e,a)){var i=s.memoizedProps;if(n=n.compare,n=n!==null?n:vi,n(i,l)&&e.ref===t.ref)return Fn(e,t,a)}return t.flags|=1,e=Xn(s,l),e.ref=t.ref,e.return=t,t.child=e}function wy(e,t,n,l,a){if(e!==null){var s=e.memoizedProps;if(vi(s,l)&&e.ref===t.ref)if(Ye=!1,t.pendingProps=l=s,dh(e,a))e.flags&131072&&(Ye=!0);else return t.lanes=e.lanes,Fn(e,t,a)}return Ld(e,t,n,l,a)}function Sy(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 ug(e,t,s,n,l)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Fr(t,s!==null?s.cachePool:null),s!==null?Fp(t,s):Ad(),L0(t);else return l=t.lanes=536870912,ug(e,t,s!==null?s.baseLanes|n:n,n,l)}else s!==null?(Fr(t,s.cachePool),Fp(t,s),gl(),t.memoizedState=null):(e!==null&&Fr(t,null),Ad(),gl());return Pe(e,t,a,n),t.child}function Qs(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ug(e,t,n,l,a){var s=Zf();return s=s===null?null:{parent:qe._currentValue,pool:s},t.memoizedState={baseLanes:n,cachePool:s},e!==null&&Fr(t,null),Ad(),L0(t),e!==null&&Ss(e,t,l,!0),t.childLanes=a,null}function to(e,t){return t=To({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function dg(e,t,n){return ra(t,e.child,null,n),e=to(t,t.pendingProps),e.flags|=2,kt(t),t.memoizedState=null,e}function MS(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=to(t,l),t.lanes=536870912,Qs(null,e);if(Td(t),(e=Ce)?(e=pv(e,Zt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:zl!==null?{id:vn,overflow:bn}:null,retryLane:536870912,hydrationErrors:null},n=C0(e),n.return=t,t.child=n,tt=t,Ce=null)):e=null,e===null)throw Dl(t);return t.lanes=536870912,null}return to(t,l)}var s=e.memoizedState;if(s!==null){var i=s.dehydrated;if(Td(t),a)if(t.flags&256)t.flags&=-257,t=dg(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||Ss(e,t,n,!1),a=(n&e.childLanes)!==0,Ye||a){if(l=je,l!==null&&(i=Px(l,n),i!==0&&i!==s.retryLane))throw s.retryLane=i,ya(e,i),bt(l,e,i),uh;Oo(),t=dg(e,t,n)}else e=s.treeContext,Ce=Kt(i.nextSibling),tt=t,de=!0,jl=null,Zt=!1,e!==null&&_0(t,e),t=to(t,l),t.flags|=4096;return t}return e=Xn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function no(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 Ld(e,t,n,l,a){return ia(t),n=Ff(e,t,n,l,void 0,a),l=Pf(),e!==null&&!Ye?(eh(e,t,a),Fn(e,t,a)):(de&&l&&Xf(t),t.flags|=1,Pe(e,t,n,a),t.child)}function fg(e,t,n,l,a,s){return ia(t),t.updateQueue=null,n=B0(t,l,n,a),$0(e),l=Pf(),e!==null&&!Ye?(eh(e,t,s),Fn(e,t,s)):(de&&l&&Xf(t),t.flags|=1,Pe(e,t,n,s),t.child)}function hg(e,t,n,l,a){if(ia(t),t.stateNode===null){var s=La,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=Od,t.stateNode=s,s._reactInternals=t,s=t.stateNode,s.props=l,s.state=t.memoizedState,s.refs={},Kf(t),i=n.contextType,s.context=typeof i=="object"&&i!==null?nt(i):La,s.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i=="function"&&(Nu(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&&Od.enqueueReplaceState(s,s.state,null),ai(t,l,s,a),li(),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=ca(n,r);s.props=c;var u=s.context,d=n.contextType;i=La,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)&&ig(t,s,l,i),dl=!1;var h=t.memoizedState;s.state=h,ai(t,l,s,a),li(),u=t.memoizedState,r||h!==u||dl?(typeof f=="function"&&(Nu(t,n,f,l),u=t.memoizedState),(c=dl||sg(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,Md(e,t),i=t.memoizedProps,d=ca(n,i),s.props=d,f=t.pendingProps,h=s.context,u=n.contextType,c=La,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)&&ig(t,s,l,c),dl=!1,h=t.memoizedState,s.state=h,ai(t,l,s,a),li();var p=t.memoizedState;i!==f||h!==p||dl||e!==null&&e.dependencies!==null&&jo(e.dependencies)?(typeof r=="function"&&(Nu(t,n,r,l),p=t.memoizedState),(d=dl||sg(t,n,d,l,h,p,c)||e!==null&&e.dependencies!==null&&jo(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,no(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=ra(t,e.child,null,a),t.child=ra(t,null,n,a)):Pe(e,t,n,a),t.memoizedState=s.state,e=t.child):e=Fn(e,t,a),e}function pg(e,t,n,l){return sa(),t.flags|=256,Pe(e,t,n,l),t.child}var ju={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ku(e){return{baseLanes:e,cachePool:T0()}}function Eu(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Mt),e}function Ny(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?pl(t):gl(),(e=Ce)?(e=pv(e,Zt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:zl!==null?{id:vn,overflow:bn}:null,retryLane:536870912,hydrationErrors:null},n=C0(e),n.return=t,t.child=n,tt=t,Ce=null)):e=null,e===null)throw Dl(t);return Jd(e)?t.lanes=32:t.lanes=536870912,null}var r=l.children;return l=l.fallback,a?(gl(),a=t.mode,r=To({mode:"hidden",children:r},a),l=Pl(l,a,n,null),r.return=t,l.return=t,r.sibling=l,t.child=r,l=t.child,l.memoizedState=ku(n),l.childLanes=Eu(e,i,n),t.memoizedState=ju,Qs(null,l)):(pl(t),$d(t,r))}var c=e.memoizedState;if(c!==null&&(r=c.dehydrated,r!==null)){if(s)t.flags&256?(pl(t),t.flags&=-257,t=Cu(e,t,n)):t.memoizedState!==null?(gl(),t.child=e.child,t.flags|=128,t=null):(gl(),r=l.fallback,a=t.mode,l=To({mode:"visible",children:l.children},a),r=Pl(r,a,n,null),r.flags|=2,l.return=t,r.return=t,l.sibling=r,t.child=l,ra(t,e.child,null,n),l=t.child,l.memoizedState=ku(n),l.childLanes=Eu(e,i,n),t.memoizedState=ju,t=Qs(null,l));else if(pl(t),Jd(r)){if(i=r.nextSibling&&r.nextSibling.dataset,i)var u=i.dgst;i=u,l=Error(Z(419)),l.stack="",l.digest=i,wi({value:l,source:null,stack:null}),t=Cu(e,t,n)}else if(Ye||Ss(e,t,n,!1),i=(n&e.childLanes)!==0,Ye||i){if(i=je,i!==null&&(l=Px(i,n),l!==0&&l!==c.retryLane))throw c.retryLane=l,ya(e,l),bt(i,e,l),uh;Wd(r)||Oo(),t=Cu(e,t,n)}else Wd(r)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,Ce=Kt(r.nextSibling),tt=t,de=!0,jl=null,Zt=!1,e!==null&&_0(t,e),t=$d(t,l.children),t.flags|=4096);return t}return a?(gl(),r=l.fallback,a=t.mode,c=e.child,u=c.sibling,l=Xn(c,{mode:"hidden",children:l.children}),l.subtreeFlags=c.subtreeFlags&65011712,u!==null?r=Xn(u,r):(r=Pl(r,a,n,null),r.flags|=2),r.return=t,l.return=t,l.sibling=r,t.child=l,Qs(null,l),l=t.child,r=e.child.memoizedState,r===null?r=ku(n):(a=r.cachePool,a!==null?(c=qe._currentValue,a=a.parent!==c?{parent:c,pool:c}:a):a=T0(),r={baseLanes:r.baseLanes|n,cachePool:a}),l.memoizedState=r,l.childLanes=Eu(e,i,n),t.memoizedState=ju,Qs(e.child,l)):(pl(t),n=e.child,e=n.sibling,n=Xn(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 $d(e,t){return t=To({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function To(e,t){return e=Et(22,e,null,t),e.lanes=0,e}function Cu(e,t,n){return ra(t,e.child,null,n),e=$d(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function gg(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),kd(e.return,t,n)}function Mu(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 jy(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?bi:0,!r&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gg(e,n,t);else if(e.tag===19)gg(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&&Co(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Mu(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&&Co(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Mu(t,!0,n,null,s,l);break;case"together":Mu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Fn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ol|=t.lanes,!(n&t.childLanes))if(e!==null){if(Ss(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=Xn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Xn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function dh(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&jo(e)))}function _S(e,t,n){switch(t.tag){case 3:xo(t,t.stateNode.containerInfo),hl(t,qe,e.memoizedState.cache),sa();break;case 27:case 5:fd(t);break;case 4:xo(t,t.stateNode.containerInfo);break;case 10:hl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Td(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(pl(t),t.flags|=128,null):n&t.child.childLanes?Ny(e,t,n):(pl(t),e=Fn(e,t,n),e!==null?e.sibling:null);pl(t);break;case 19:var a=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(Ss(e,t,n,!1),l=(n&t.childLanes)!==0),a){if(l)return jy(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,Sy(e,t,n,t.pendingProps);case 24:hl(t,qe,e.memoizedState.cache)}return Fn(e,t,n)}function ky(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ye=!0;else{if(!dh(e,n)&&!(t.flags&128))return Ye=!1,_S(e,t,n);Ye=!!(e.flags&131072)}else Ye=!1,de&&t.flags&1048576&&M0(t,bi,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Ql(t.elementType),t.type=e,typeof e=="function")Vf(e)?(l=ca(e,l),t.tag=1,t=hg(null,t,e,l,n)):(t.tag=0,t=Ld(null,t,e,l,n));else{if(e!=null){var a=e.$$typeof;if(a===_f){t.tag=11,t=og(null,t,e,l,n);break e}else if(a===Af){t.tag=14,t=cg(null,t,e,l,n);break e}}throw t=ud(e)||e,Error(Z(306,t,""))}}return t;case 0:return Ld(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,a=ca(l,t.pendingProps),hg(e,t,l,a,n);case 3:e:{if(xo(t,t.stateNode.containerInfo),e===null)throw Error(Z(387));l=t.pendingProps;var s=t.memoizedState;a=s.element,Md(e,t),ai(t,l,null,n);var i=t.memoizedState;if(l=i.cache,hl(t,qe,l),l!==s.cache&&Ed(t,[qe],n,!0),li(),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=pg(e,t,l,n);break e}else if(l!==a){a=Qt(Error(Z(424)),t),wi(a),t=pg(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=Kt(e.firstChild),tt=t,de=!0,jl=null,Zt=!0,n=R0(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(sa(),l===a){t=Fn(e,t,n);break e}Pe(e,t,l,n)}t=t.child}return t;case 26:return no(e,t),e===null?(n=Og(t.type,null,t.pendingProps,null))?t.memoizedState=n:de||(n=t.type,e=t.pendingProps,l=Bo(Nl.current).createElement(n),l[et]=t,l[wt]=e,lt(l,n,e),Je(l),t.stateNode=l):t.memoizedState=Og(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return fd(t),e===null&&de&&(l=t.stateNode=gv(t.type,t.pendingProps,Nl.current),tt=t,Zt=!0,a=Ce,$l(t.type)?(Fd=a,Ce=Kt(l.firstChild)):Ce=a),Pe(e,t,t.pendingProps.children,n),no(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&de&&((a=l=Ce)&&(l=sN(l,t.type,t.pendingProps,Zt),l!==null?(t.stateNode=l,tt=t,Ce=Kt(l.firstChild),Zt=!1,a=!0):a=!1),a||Dl(t)),fd(t),a=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,l=s.children,Id(a,s)?l=null:i!==null&&Id(a,i)&&(t.flags|=32),t.memoizedState!==null&&(a=Ff(e,t,bS,null,null,n),Ci._currentValue=a),no(e,t),Pe(e,t,l,n),t.child;case 6:return e===null&&de&&((e=n=Ce)&&(n=iN(n,t.pendingProps,Zt),n!==null?(t.stateNode=n,tt=t,Ce=null,e=!0):e=!1),e||Dl(t)),null;case 13:return Ny(e,t,n);case 4:return xo(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=ra(t,null,l,n):Pe(e,t,l,n),t.child;case 11:return og(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,hl(t,t.type,l.value),Pe(e,t,l.children,n),t.child;case 9:return a=t.type._context,l=t.pendingProps.children,ia(t),a=nt(a),l=l(a),t.flags|=1,Pe(e,t,l,n),t.child;case 14:return cg(e,t,t.type,t.pendingProps,n);case 15:return wy(e,t,t.type,t.pendingProps,n);case 19:return jy(e,t,n);case 31:return MS(e,t,n);case 22:return Sy(e,t,n,t.pendingProps);case 24:return ia(t),l=nt(qe),e===null?(a=Zf(),a===null&&(a=je,s=Qf(),a.pooledCache=s,s.refCount++,s!==null&&(a.pooledCacheLanes|=n),a=s),t.memoizedState={parent:l,cache:a},Kf(t),hl(t,qe,a)):(e.lanes&n&&(Md(e,t),ai(t,null,null,n),li()),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),hl(t,qe,l)):(l=s.cache,hl(t,qe,l),l!==a.cache&&Ed(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 zn(e){e.flags|=4}function _u(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(Ky())e.flags|=8192;else throw ta=ko,If}else e.flags&=-16777217}function mg(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!yv(t))if(Ky())e.flags|=8192;else throw ta=ko,If}function jr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Wx():536870912,e.lanes|=t,ss|=t)}function Ls(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 AS(e,t,n){var l=t.pendingProps;switch(Gf(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),Gn(qe),Pa(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Sa(t)?zn(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,bu())),Ee(t),null;case 26:var a=t.type,s=t.memoizedState;return e===null?(zn(t),s!==null?(Ee(t),mg(t,s)):(Ee(t),_u(t,a,null,l,n))):s?s!==e.memoizedState?(zn(t),Ee(t),mg(t,s)):(Ee(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&zn(t),Ee(t),_u(t,a,e,l,n)),null;case 27:if(yo(t),n=Nl.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&zn(t);else{if(!l){if(t.stateNode===null)throw Error(Z(166));return Ee(t),null}e=Sn.current,Sa(t)?Gp(t):(e=gv(a,l,n),t.stateNode=e,zn(t))}return Ee(t),null;case 5:if(yo(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&zn(t);else{if(!l){if(t.stateNode===null)throw Error(Z(166));return Ee(t),null}if(s=Sn.current,Sa(t))Gp(t);else{var i=Bo(Nl.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[wt]=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&&zn(t)}}return Ee(t),_u(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&zn(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(Z(166));if(e=Nl.current,Sa(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||dv(e.nodeValue,n)),e||Dl(t,!0)}else e=Bo(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=Sa(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 sa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ee(t),e=!1}else n=bu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(kt(t),t):(kt(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=Sa(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 sa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ee(t),a=!1}else a=bu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(kt(t),t):(kt(t),null)}return kt(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),jr(t,t.updateQueue),Ee(t),null);case 4:return Pa(),e===null&&yh(t.stateNode.containerInfo),Ee(t),null;case 10:return Gn(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)Ls(l,!1);else{if(He!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Co(e),s!==null){for(t.flags|=128,Ls(l,!1),e=s.updateQueue,t.updateQueue=e,jr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)E0(n,e),n=n.sibling;return ke(Le,Le.current&1|2),de&&$n(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&_t()>Do&&(t.flags|=128,a=!0,Ls(l,!1),t.lanes=4194304)}else{if(!a)if(e=Co(s),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,jr(t,e),Ls(l,!0),l.tail===null&&l.tailMode==="hidden"&&!s.alternate&&!de)return Ee(t),null}else 2*_t()-l.renderingStartTime>Do&&n!==536870912&&(t.flags|=128,a=!0,Ls(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&&$n(t,l.treeForkCount),e):(Ee(t),null);case 22:case 23:return kt(t),Wf(),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&&jr(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(ea),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Gn(qe),Ee(t),null;case 25:return null;case 30:return null}throw Error(Z(156,t.tag))}function TS(e,t){switch(Gf(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gn(qe),Pa(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return yo(t),null;case 31:if(t.memoizedState!==null){if(kt(t),t.alternate===null)throw Error(Z(340));sa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(kt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Z(340));sa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Fe(Le),null;case 4:return Pa(),null;case 10:return Gn(t.type),null;case 22:case 23:return kt(t),Wf(),e!==null&&Fe(ea),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Gn(qe),null;case 25:return null;default:return null}}function Ey(e,t){switch(Gf(t),t.tag){case 3:Gn(qe),Pa();break;case 26:case 27:case 5:yo(t);break;case 4:Pa();break;case 31:t.memoizedState!==null&&kt(t);break;case 13:kt(t);break;case 19:Fe(Le);break;case 10:Gn(t.type);break;case 22:case 23:kt(t),Wf(),e!==null&&Fe(ea);break;case 24:Gn(qe)}}function Ki(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 Rl(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 Cy(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{H0(t,n)}catch(l){we(e,e.return,l)}}}function My(e,t,n){n.props=ca(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){we(e,t,l)}}function ii(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 wn(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 _y(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 Au(e,t,n){try{var l=e.stateNode;PS(l,e.type,n,t),l[wt]=t}catch(a){we(e,e.return,a)}}function Ay(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&$l(e.type)||e.tag===4}function Tu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ay(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&&$l(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 Bd(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=qn));else if(l!==4&&(l===27&&$l(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Bd(e,t,n),e=e.sibling;e!==null;)Bd(e,t,n),e=e.sibling}function zo(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&&$l(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(zo(e,t,n),e=e.sibling;e!==null;)zo(e,t,n),e=e.sibling}function Ty(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[wt]=n}catch(s){we(e,e.return,s)}}var Bn=!1,Ue=!1,zu=!1,xg=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function zS(e,t){if(e=e.containerInfo,Qd=Vo,e=y0(e),Uf(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(Zd={focusedElem:e,selectionRange:n},Vo=!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=ca(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)Kd(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Kd(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 zy(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:Rn(e,n),l&4&&Ki(5,n);break;case 1:if(Rn(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){we(n,n.return,i)}else{var a=ca(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){we(n,n.return,i)}}l&64&&Cy(n),l&512&&ii(n,n.return);break;case 3:if(Rn(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{H0(e,t)}catch(i){we(n,n.return,i)}}break;case 27:t===null&&l&4&&Ty(n);case 26:case 5:Rn(e,n),t===null&&l&4&&_y(n),l&512&&ii(n,n.return);break;case 12:Rn(e,n);break;case 31:Rn(e,n),l&4&&Oy(e,n);break;case 13:Rn(e,n),l&4&&Hy(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=qS.bind(null,n),rN(e,n))));break;case 22:if(l=n.memoizedState!==null||Bn,!l){t=t!==null&&t.memoizedState!==null||Ue,a=Bn;var s=Ue;Bn=l,(Ue=t)&&!s?Ln(e,n,(n.subtreeFlags&8772)!==0):Rn(e,n),Bn=a,Ue=s}break;case 30:break;default:Rn(e,n)}}function Dy(e){var t=e.alternate;t!==null&&(e.alternate=null,Dy(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Rf(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;)Ry(e,t,n),n=n.sibling}function Ry(e,t,n){if(At&&typeof At.onCommitFiberUnmount=="function")try{At.onCommitFiberUnmount(Yi,n)}catch{}switch(n.tag){case 26:Ue||wn(n,t),Dn(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Ue||wn(n,t);var l=Te,a=mt;$l(n.type)&&(Te=n.stateNode,mt=!1),Dn(e,t,n),ui(n.stateNode),Te=l,mt=a;break;case 5:Ue||wn(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,Ag(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),cs(e)):Ag(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:Rl(2,n,t),Ue||Rl(4,n,t),Dn(e,t,n);break;case 1:Ue||(wn(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&My(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 Oy(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{cs(e)}catch(n){we(t,t.return,n)}}}function Hy(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{cs(e)}catch(n){we(t,t.return,n)}}function DS(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new xg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new xg),t;default:throw Error(Z(435,e.tag))}}function kr(e,t){var n=DS(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var a=YS.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($l(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));Ry(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;)Ly(t,e),t=t.sibling}var en=null;function Ly(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&&(Rl(3,e,e.return),Ki(3,e),Rl(5,e,e.return));break;case 1:pt(t,e),gt(e),l&512&&(Ue||n===null||wn(n,n.return)),l&64&&Bn&&(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=en;if(pt(t,e),gt(e),l&512&&(Ue||n===null||wn(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[Gi]||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,Je(s),l=s;break e;case"link":var i=Lg("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=Lg("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,Je(s),l=s}e.stateNode=l}else $g(a,e.type,e.stateNode);else e.stateNode=Hg(a,l,e.memoizedProps);else s!==l?(s===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):s.count--,l===null?$g(a,e.type,e.stateNode):Hg(a,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Au(e,e.memoizedProps,n.memoizedProps)}break;case 27:pt(t,e),gt(e),l&512&&(Ue||n===null||wn(n,n.return)),n!==null&&l&4&&Au(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pt(t,e),gt(e),l&512&&(Ue||n===null||wn(n,n.return)),e.flags&32){a=e.stateNode;try{ts(a,"")}catch(x){we(e,e.return,x)}}l&4&&e.stateNode!=null&&(a=e.memoizedProps,Au(e,a,n!==null?n.memoizedProps:a)),l&1024&&(zu=!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(so=null,a=en,en=Uo(t.containerInfo),pt(t,e),en=a,gt(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{cs(t.containerInfo)}catch(x){we(e,e.return,x)}zu&&(zu=!1,$y(e));break;case 4:l=en,en=Uo(e.stateNode.containerInfo),pt(t,e),gt(e),en=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,kr(e,l)));break;case 13:pt(t,e),gt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Cc=_t()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,kr(e,l)));break;case 22:a=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,u=Bn,d=Ue;if(Bn=u||a,Ue=d||c,pt(t,e),Ue=d,Bn=u,gt(e),l&8192)e:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||c||Bn||Ue||Zl(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?Tg(p,!0):Tg(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,kr(e,n))));break;case 19:pt(t,e),gt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,kr(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(Ay(l)){n=l;break}l=l.return}if(n==null)throw Error(Z(160));switch(n.tag){case 27:var a=n.stateNode,s=Tu(e);zo(e,s,a);break;case 5:var i=n.stateNode;n.flags&32&&(ts(i,""),n.flags&=-33);var r=Tu(e);zo(e,r,i);break;case 3:case 4:var c=n.stateNode.containerInfo,u=Tu(e);Bd(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 $y(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;$y(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Rn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)zy(e,t.alternate,t),t=t.sibling}function Zl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Rl(4,t,t.return),Zl(t);break;case 1:wn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&My(t,t.return,n),Zl(t);break;case 27:ui(t.stateNode);case 26:case 5:wn(t,t.return),Zl(t);break;case 22:t.memoizedState===null&&Zl(t);break;case 30:Zl(t);break;default:Zl(t)}e=e.sibling}}function Ln(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:Ln(a,s,n),Ki(4,s);break;case 1:if(Ln(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++)O0(c[a],r)}catch(u){we(l,l.return,u)}}n&&i&64&&Cy(s),ii(s,s.return);break;case 27:Ty(s);case 26:case 5:Ln(a,s,n),n&&l===null&&i&4&&_y(s),ii(s,s.return);break;case 12:Ln(a,s,n);break;case 31:Ln(a,s,n),n&&i&4&&Oy(a,s);break;case 13:Ln(a,s,n),n&&i&4&&Hy(a,s);break;case 22:s.memoizedState===null&&Ln(a,s,n),ii(s,s.return);break;case 30:break;default:Ln(a,s,n)}t=t.sibling}}function fh(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&&Zi(n))}function hh(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Zi(e))}function Pt(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)By(e,t,n,l),t=t.sibling}function By(e,t,n,l){var a=t.flags;switch(t.tag){case 0:case 11:case 15:Pt(e,t,n,l),a&2048&&Ki(9,t);break;case 1:Pt(e,t,n,l);break;case 3:Pt(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&&Zi(e)));break;case 12:if(a&2048){Pt(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 Pt(e,t,n,l);break;case 31:Pt(e,t,n,l);break;case 13:Pt(e,t,n,l);break;case 23:break;case 22:s=t.stateNode,i=t.alternate,t.memoizedState!==null?s._visibility&2?Pt(e,t,n,l):ri(e,t):s._visibility&2?Pt(e,t,n,l):(s._visibility|=2,Ca(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),a&2048&&fh(i,t);break;case 24:Pt(e,t,n,l),a&2048&&hh(t.alternate,t);break;default:Pt(e,t,n,l)}}function Ca(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:Ca(s,i,r,c,a),Ki(8,i);break;case 23:break;case 22:var d=i.stateNode;i.memoizedState!==null?d._visibility&2?Ca(s,i,r,c,a):ri(s,i):(d._visibility|=2,Ca(s,i,r,c,a)),a&&u&2048&&fh(i.alternate,i);break;case 24:Ca(s,i,r,c,a),a&&u&2048&&hh(i.alternate,i);break;default:Ca(s,i,r,c,a)}t=t.sibling}}function ri(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:ri(n,l),a&2048&&fh(l.alternate,l);break;case 24:ri(n,l),a&2048&&hh(l.alternate,l);break;default:ri(n,l)}t=t.sibling}}var Zs=8192;function Na(e,t,n){if(e.subtreeFlags&Zs)for(e=e.child;e!==null;)Uy(e,t,n),e=e.sibling}function Uy(e,t,n){switch(e.tag){case 26:Na(e,t,n),e.flags&Zs&&e.memoizedState!==null&&vN(n,en,e.memoizedState,e.memoizedProps);break;case 5:Na(e,t,n);break;case 3:case 4:var l=en;en=Uo(e.stateNode.containerInfo),Na(e,t,n),en=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Zs,Zs=16777216,Na(e,t,n),Zs=l):Na(e,t,n));break;default:Na(e,t,n)}}function qy(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 $s(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,Vy(l,e)}qy(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Yy(e),e=e.sibling}function Yy(e){switch(e.tag){case 0:case 11:case 15:$s(e),e.flags&2048&&Rl(9,e,e.return);break;case 3:$s(e);break;case 12:$s(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,lo(e)):$s(e);break;default:$s(e)}}function lo(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,Vy(l,e)}qy(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Rl(8,t,t.return),lo(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,lo(t));break;default:lo(t)}e=e.sibling}}function Vy(e,t){for(;Ke!==null;){var n=Ke;switch(n.tag){case 0:case 11:case 15:Rl(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:Zi(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(Dy(l),l===n){Ke=null;break e}if(a!==null){a.return=s,Ke=a;break e}Ke=s}}}var RS={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}},OS=typeof WeakMap=="function"?WeakMap:Map,xe=0,je=null,ce=null,ue=0,be=0,jt=null,bl=!1,js=!1,ph=!1,Pn=0,He=0,Ol=0,na=0,gh=0,Mt=0,ss=0,oi=null,xt=null,Ud=!1,Cc=0,Xy=0,Do=1/0,Ro=null,Cl=null,Qe=0,Ml=null,is=null,Qn=0,qd=0,Yd=null,Gy=null,ci=0,Vd=null;function zt(){return xe&2&&ue!==0?ue&-ue:ne.T!==null?xh():e0()}function Qy(){if(Mt===0)if(!(ue&536870912)||de){var e=xr;xr<<=1,!(xr&3932160)&&(xr=262144),Mt=e}else Mt=536870912;return e=Rt.current,e!==null&&(e.flags|=32),Mt}function bt(e,t,n){(e===je&&(be===2||be===9)||e.cancelPendingCommit!==null)&&(rs(e,0),wl(e,ue,Mt,!1)),Xi(e,n),(!(xe&2)||e!==je)&&(e===je&&(!(xe&2)&&(na|=n),He===4&&wl(e,ue,Mt,!1)),En(e))}function Zy(e,t,n){if(xe&6)throw Error(Z(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Vi(e,t),a=l?$S(e,t):Du(e,t,!0),s=l;do{if(a===0){js&&!l&&wl(e,t,0,!1);break}else{if(n=e.current.alternate,s&&!HS(n)){a=Du(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=oi;var c=r.current.memoizedState.isDehydrated;if(c&&(rs(r,i).flags|=256),i=Du(r,i,!1),i!==2){if(ph&&!c){r.errorRecoveryDisabledLanes|=s,na|=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){rs(e,0),wl(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:wl(l,t,Mt,!bl);break e;case 2:xt=null;break;case 3:case 5:break;default:throw Error(Z(329))}if((t&62914560)===t&&(a=Cc+300-_t(),10<a)){if(wl(l,t,Mt,!bl),mc(l,0,!0)!==0)break e;Qn=t,l.timeoutHandle=hv(yg.bind(null,l,n,xt,Ro,Ud,t,Mt,na,ss,bl,s,"Throttled",-0,0),a);break e}yg(l,n,xt,Ro,Ud,t,Mt,na,ss,bl,s,null,-0,0)}}break}while(!0);En(e)}function yg(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:qn},Uy(t,s,f);var x=(s&62914560)===s?Cc-_t():(s&4194048)===s?Xy-_t():0;if(x=bN(f,x),x!==null){Qn=s,e.cancelPendingCommit=x(bg.bind(null,e,t,s,n,l,a,i,r,c,d,f,null,h,p)),wl(e,s,i,!u);return}}bg(e,t,s,n,l,a,i,r,c)}function HS(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 wl(e,t,n,l){t&=~gh,t&=~na,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var a=t;0<a;){var s=31-Tt(a),i=1<<s;l[s]=-1,a&=~i}n!==0&&Jx(e,n,t)}function Mc(){return xe&6?!0:(Wi(0),!1)}function mh(){if(ce!==null){if(be===0)var e=ce.return;else e=ce,Yn=va=null,th(e),Za=null,Si=0,e=ce;for(;e!==null;)Ey(e.alternate,e),e=e.return;ce=null}}function rs(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,nN(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Qn=0,mh(),je=e,ce=n=Xn(e.current,null),ue=t,be=0,jt=null,bl=!1,js=Vi(e,t),ph=!1,ss=Mt=gh=na=Ol=He=0,xt=oi=null,Ud=!1,t&8&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var a=31-Tt(l),s=1<<a;t|=e[a],l&=~s}return Pn=t,bc(),n}function Iy(e,t){re=null,ne.H=ji,t===Ns||t===Sc?(t=Wp(),be=3):t===If?(t=Wp(),be=4):be=t===uh?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,jt=t,ce===null&&(He=1,Ao(e,Qt(t,e.current)))}function Ky(){var e=Rt.current;return e===null?!0:(ue&4194048)===ue?It===null:(ue&62914560)===ue||ue&536870912?e===It:!1}function Wy(){var e=ne.H;return ne.H=ji,e===null?ji:e}function Jy(){var e=ne.A;return ne.A=RS,e}function Oo(){He=4,bl||(ue&4194048)!==ue&&Rt.current!==null||(js=!0),!(Ol&134217727)&&!(na&134217727)||je===null||wl(je,ue,Mt,!1)}function Du(e,t,n){var l=xe;xe|=2;var a=Wy(),s=Jy();(je!==e||ue!==t)&&(Ro=null,rs(e,t)),t=!1;var i=He;e:do try{if(be!==0&&ce!==null){var r=ce,c=jt;switch(be){case 8:mh(),i=6;break e;case 3:case 2:case 9:case 6:Rt.current===null&&(t=!0);var u=be;if(be=0,jt=null,Ua(e,r,c,u),n&&js){i=0;break e}break;default:u=be,be=0,jt=null,Ua(e,r,c,u)}}LS(),i=He;break}catch(d){Iy(e,d)}while(!0);return t&&e.shellSuspendCounter++,Yn=va=null,xe=l,ne.H=a,ne.A=s,ce===null&&(je=null,ue=0,bc()),i}function LS(){for(;ce!==null;)Fy(ce)}function $S(e,t){var n=xe;xe|=2;var l=Wy(),a=Jy();je!==e||ue!==t?(Ro=null,Do=_t()+500,rs(e,t)):js=Vi(e,t);e:do try{if(be!==0&&ce!==null){t=ce;var s=jt;t:switch(be){case 1:be=0,jt=null,Ua(e,t,s,1);break;case 2:case 9:if(Kp(s)){be=0,jt=null,vg(t);break}t=function(){be!==2&&be!==9||je!==e||(be=7),En(e)},s.then(t,t);break e;case 3:be=7;break e;case 4:be=5;break e;case 7:Kp(s)?(be=0,jt=null,vg(t)):(be=0,jt=null,Ua(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?yv(i):r.stateNode.complete){be=0,jt=null;var c=r.sibling;if(c!==null)ce=c;else{var u=r.return;u!==null?(ce=u,_c(u)):ce=null}break t}}be=0,jt=null,Ua(e,t,s,5);break;case 6:be=0,jt=null,Ua(e,t,s,6);break;case 8:mh(),He=6;break e;default:throw Error(Z(462))}}BS();break}catch(d){Iy(e,d)}while(!0);return Yn=va=null,ne.H=l,ne.A=a,xe=n,ce!==null?0:(je=null,ue=0,bc(),He)}function BS(){for(;ce!==null&&!ow();)Fy(ce)}function Fy(e){var t=ky(e.alternate,e,Pn);e.memoizedProps=e.pendingProps,t===null?_c(e):ce=t}function vg(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=fg(n,t,t.pendingProps,t.type,void 0,ue);break;case 11:t=fg(n,t,t.pendingProps,t.type.render,t.ref,ue);break;case 5:th(t);default:Ey(n,t),t=ce=E0(t,Pn),t=ky(n,t,Pn)}e.memoizedProps=e.pendingProps,t===null?_c(e):ce=t}function Ua(e,t,n,l){Yn=va=null,th(t),Za=null,Si=0;var a=t.return;try{if(CS(e,a,t,n,ue)){He=1,Ao(e,Qt(n,e.current)),ce=null;return}}catch(s){if(a!==null)throw ce=a,s;He=1,Ao(e,Qt(n,e.current)),ce=null;return}t.flags&32768?(de||l===1?e=!0:js||ue&536870912?e=!1:(bl=e=!0,(l===2||l===9||l===3||l===6)&&(l=Rt.current,l!==null&&l.tag===13&&(l.flags|=16384))),Py(t,e)):_c(t)}function _c(e){var t=e;do{if(t.flags&32768){Py(t,bl);return}e=t.return;var n=AS(t.alternate,t,Pn);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 Py(e,t){do{var n=TS(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 bg(e,t,n,l,a,s,i,r,c){e.cancelPendingCommit=null;do Ac();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|=qf,yw(e,n,s,i,r,c),e===je&&(ce=je=null,ue=0),is=t,Ml=e,Qn=n,qd=s,Yd=a,Gy=l,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,VS(vo,function(){return av(),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{zS(e,t,n)}finally{xe=i,ye.p=a,ne.T=l}}Qe=1,ev(),tv(),nv()}}function ev(){if(Qe===1){Qe=0;var e=Ml,t=is,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{Ly(t,e);var s=Zd,i=y0(e.containerInfo),r=s.focusedElem,c=s.selectionRange;if(i!==r&&r&&r.ownerDocument&&x0(r.ownerDocument.documentElement,r)){if(c!==null&&Uf(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=Yp(r,S),y=Yp(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}}Vo=!!Qd,Zd=Qd=null}finally{xe=a,ye.p=l,ne.T=n}}e.current=t,Qe=2}}function tv(){if(Qe===2){Qe=0;var e=Ml,t=is,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{zy(e,t.alternate,t)}finally{xe=a,ye.p=l,ne.T=n}}Qe=3}}function nv(){if(Qe===4||Qe===3){Qe=0,cw();var e=Ml,t=is,n=Qn,l=Gy;t.subtreeFlags&10256||t.flags&10256?Qe=5:(Qe=0,is=Ml=null,lv(e,e.pendingLanes));var a=e.pendingLanes;if(a===0&&(Cl=null),Df(n),t=t.stateNode,At&&typeof At.onCommitFiberRoot=="function")try{At.onCommitFiberRoot(Yi,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}}Qn&3&&Ac(),En(e),a=e.pendingLanes,n&261930&&a&42?e===Vd?ci++:(ci=0,Vd=e):ci=0,Wi(0)}}function lv(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Zi(t)))}function Ac(){return ev(),tv(),nv(),av()}function av(){if(Qe!==5)return!1;var e=Ml,t=qd;qd=0;var n=Df(Qn),l=ne.T,a=ye.p;try{ye.p=32>n?32:n,ne.T=null,n=Yd,Yd=null;var s=Ml,i=Qn;if(Qe=0,is=Ml=null,Qn=0,xe&6)throw Error(Z(331));var r=xe;if(xe|=4,Yy(s.current),By(s,s.current,i,n),xe=r,Wi(0,!1),At&&typeof At.onPostCommitFiberRoot=="function")try{At.onPostCommitFiberRoot(Yi,s)}catch{}return!0}finally{ye.p=a,ne.T=l,lv(e,t)}}function wg(e,t,n){t=Qt(n,t),t=Hd(e.stateNode,t,2),e=El(e,t,2),e!==null&&(Xi(e,2),En(e))}function we(e,t,n){if(e.tag===3)wg(e,e,n);else for(;t!==null;){if(t.tag===3){wg(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Cl===null||!Cl.has(l))){e=Qt(n,e),n=vy(2),l=El(t,n,2),l!==null&&(by(n,l,t,e),Xi(l,2),En(l));break}}t=t.return}}function Ru(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new OS;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)||(ph=!0,a.add(n),e=US.bind(null,e,t,n),t.then(e,e))}function US(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()-Cc?!(xe&2)&&rs(e,0):gh|=n,ss===ue&&(ss=0)),En(e)}function sv(e,t){t===0&&(t=Wx()),e=ya(e,t),e!==null&&(Xi(e,t),En(e))}function qS(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),sv(e,n)}function YS(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),sv(e,n)}function VS(e,t){return Tf(e,t)}var Ho=null,Ma=null,Xd=!1,Lo=!1,Ou=!1,Sl=0;function En(e){e!==Ma&&e.next===null&&(Ma===null?Ho=Ma=e:Ma=Ma.next=e),Lo=!0,Xd||(Xd=!0,GS())}function Wi(e,t){if(!Ou&&Lo){Ou=!0;do for(var n=!1,l=Ho;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-Tt(42|e)+1)-1,s&=a&~(i&~r),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,Sg(l,s))}else s=ue,s=mc(l,l===je?s:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),!(s&3)||Vi(l,s)||(n=!0,Sg(l,s));l=l.next}while(n);Ou=!1}}function XS(){iv()}function iv(){Lo=Xd=!1;var e=0;Sl!==0&&tN()&&(e=Sl);for(var t=_t(),n=null,l=Ho;l!==null;){var a=l.next,s=rv(l,t);s===0?(l.next=null,n===null?Ho=a:n.next=a,a===null&&(Ma=n)):(n=l,(e!==0||s&3)&&(Lo=!0)),l=a}Qe!==0&&Qe!==5||Wi(e),Sl!==0&&(Sl=0)}function rv(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,a=e.expirationTimes,s=e.pendingLanes&-62914561;0<s;){var i=31-Tt(s),r=1<<i,c=a[i];c===-1?(!(r&n)||r&l)&&(a[i]=xw(r,t)):c<=t&&(e.expiredLanes|=r),s&=~r}if(t=je,n=ue,n=mc(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&&cu(l),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Vi(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&cu(l),Df(n)){case 2:case 8:n=Ix;break;case 32:n=vo;break;case 268435456:n=Kx;break;default:n=vo}return l=ov.bind(null,e),n=Tf(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&cu(l),e.callbackPriority=2,e.callbackNode=null,2}function ov(e,t){if(Qe!==0&&Qe!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Ac()&&e.callbackNode!==n)return null;var l=ue;return l=mc(e,e===je?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Zy(e,l,t),rv(e,_t()),e.callbackNode!=null&&e.callbackNode===n?ov.bind(null,e):null)}function Sg(e,t){if(Ac())return null;Zy(e,t,!0)}function GS(){lN(function(){xe&6?Tf(Zx,XS):iv()})}function xh(){if(Sl===0){var e=ns;e===0&&(e=mr,mr<<=1,!(mr&261888)&&(mr=256)),Sl=e}return Sl}function Ng(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ir(""+e)}function jg(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 QS(e,t,n,l,a){if(t==="submit"&&n&&n.stateNode===a){var s=Ng((a[wt]||null).action),i=l.submitter;i&&(t=(t=i[wt]||null)?Ng(t.formAction):i.getAttribute("formAction"),t!==null&&(s=t,i=null));var r=new xc("action","action",null,l,a);e.push({event:r,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Sl!==0){var c=i?jg(a,i):new FormData(a);Rd(n,{pending:!0,data:c,method:a.method,action:s},null,c)}}else typeof s=="function"&&(r.preventDefault(),c=i?jg(a,i):new FormData(a),Rd(n,{pending:!0,data:c,method:a.method,action:s},s,c))},currentTarget:a}]})}}for(var Hu=0;Hu<Sd.length;Hu++){var Lu=Sd[Hu],ZS=Lu.toLowerCase(),IS=Lu[0].toUpperCase()+Lu.slice(1);un(ZS,"on"+IS)}un(b0,"onAnimationEnd");un(w0,"onAnimationIteration");un(S0,"onAnimationStart");un("dblclick","onDoubleClick");un("focusin","onFocus");un("focusout","onBlur");un(uS,"onTransitionRun");un(dS,"onTransitionStart");un(fS,"onTransitionCancel");un(N0,"onTransitionEnd");es("onMouseEnter",["mouseout","mouseover"]);es("onMouseLeave",["mouseout","mouseover"]);es("onPointerEnter",["pointerout","pointerover"]);es("onPointerLeave",["pointerout","pointerover"]);ga("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ga("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ga("onBeforeInput",["compositionend","keypress","textInput","paste"]);ga("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ga("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ga("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ki="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(" "),KS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ki));function cv(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){wo(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){wo(d)}a.currentTarget=null,s=c}}}}function oe(e,t){var n=t[pd];n===void 0&&(n=t[pd]=new Set);var l=e+"__bubble";n.has(l)||(uv(t,e,2,!1),n.add(l))}function $u(e,t,n){var l=0;t&&(l|=4),uv(n,e,l,t)}var Er="_reactListening"+Math.random().toString(36).slice(2);function yh(e){if(!e[Er]){e[Er]=!0,t0.forEach(function(n){n!=="selectionchange"&&(KS.has(n)||$u(n,!1,e),$u(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Er]||(t[Er]=!0,$u("selectionchange",!1,t))}}function uv(e,t,n,l){switch(Nv(t)){case 2:var a=NN;break;case 8:a=jN;break;default:a=Sh}n=a.bind(null,t,n,e),a=void 0,!vd||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 Bu(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=Ta(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}c0(function(){var u=s,d=Hf(n),f=[];e:{var h=j0.get(e);if(h!==void 0){var p=xc,x=e;switch(e){case"keypress":if(Wr(n)===0)break e;case"keydown":case"keyup":p=Yw;break;case"focusin":x="focus",p=pu;break;case"focusout":x="blur",p=pu;break;case"beforeblur":case"afterblur":p=pu;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=zp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Aw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Gw;break;case b0:case w0:case S0:p=Dw;break;case N0:p=Zw;break;case"scroll":case"scrollend":p=Mw;break;case"wheel":p=Kw;break;case"copy":case"cut":case"paste":p=Ow;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Rp;break;case"toggle":case"beforetoggle":p=Jw}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=xi(y,g),v!=null&&S.push(Ei(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!==yd&&(x=n.relatedTarget||n.fromElement)&&(Ta(x)||x[bs]))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?Ta(x):null,x!==null&&(w=qi(x),S=x.tag,x!==w||S!==5&&S!==27&&S!==6)&&(x=null)):(p=null,x=u),p!==x)){if(S=zp,v="onMouseLeave",g="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(S=Rp,v="onPointerLeave",g="onPointerEnter",y="pointer"),w=p==null?h:Gs(p),m=x==null?h:Gs(x),h=new S(v,y+"leave",p,n,d),h.target=w,h.relatedTarget=m,v=null,Ta(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=WS,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&&kg(f,h,p,S,!1),x!==null&&w!==null&&kg(f,w,x,S,!0)}}e:{if(h=u?Gs(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var E=$p;else if(Lp(h))if(g0)E=rS;else{E=sS;var M=aS}else p=h.nodeName,!p||p.toLowerCase()!=="input"||h.type!=="checkbox"&&h.type!=="radio"?u&&Of(u.elementType)&&(E=$p):E=iS;if(E&&(E=E(e,u))){p0(f,E,n,d);break e}M&&M(e,h,u),e==="focusout"&&u&&h.type==="number"&&u.memoizedProps.value!=null&&xd(h,"number",h.value)}switch(M=u?Gs(u):window,e){case"focusin":(Lp(M)||M.contentEditable==="true")&&(Ra=M,bd=u,ei=null);break;case"focusout":ei=bd=Ra=null;break;case"mousedown":wd=!0;break;case"contextmenu":case"mouseup":case"dragend":wd=!1,Vp(f,n,d);break;case"selectionchange":if(cS)break;case"keydown":case"keyup":Vp(f,n,d)}var A;if(Bf)e:{switch(e){case"compositionstart":var C="onCompositionStart";break e;case"compositionend":C="onCompositionEnd";break e;case"compositionupdate":C="onCompositionUpdate";break e}C=void 0}else Da?f0(e,n)&&(C="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(C="onCompositionStart");C&&(d0&&n.locale!=="ko"&&(Da||C!=="onCompositionStart"?C==="onCompositionEnd"&&Da&&(A=u0()):(vl=d,Lf="value"in vl?vl.value:vl.textContent,Da=!0)),M=$o(u,C),0<M.length&&(C=new Dp(C,e,null,n,d),f.push({event:C,listeners:M}),A?C.data=A:(A=h0(n),A!==null&&(C.data=A)))),(A=Pw?eS(e,n):tS(e,n))&&(C=$o(u,"onBeforeInput"),0<C.length&&(M=new Dp("onBeforeInput","beforeinput",null,n,d),f.push({event:M,listeners:C}),M.data=A)),QS(f,e,u,n,d)}cv(f,t)})}function Ei(e,t,n){return{instance:e,listener:t,currentTarget:n}}function $o(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=xi(e,n),a!=null&&l.unshift(Ei(e,a,s)),a=xi(e,t),a!=null&&l.push(Ei(e,a,s))),e.tag===3)return l;e=e.return}return[]}function WS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function kg(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=xi(n,s),u!=null&&i.unshift(Ei(n,u,c))):a||(u=xi(n,s),u!=null&&i.push(Ei(n,u,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var JS=/\r\n?/g,FS=/\u0000|\uFFFD/g;function Eg(e){return(typeof e=="string"?e:""+e).replace(JS,`
49
- `).replace(FS,"")}function dv(e,t){return t=Eg(t),Eg(e)===t}function Se(e,t,n,l,a,s){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||ts(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&ts(e,""+l);break;case"className":vr(e,"class",l);break;case"tabIndex":vr(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":vr(e,n,l);break;case"style":o0(e,l,s);break;case"data":if(t!=="object"){vr(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=Ir(""+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=Ir(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=qn);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=Ir(""+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),Zr(e,"popover",l);break;case"xlinkActuate":Tn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Tn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Tn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Tn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Tn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Tn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Tn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Tn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Tn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Zr(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=Ew.get(n)||n,Zr(e,n,l))}}function Gd(e,t,n,l,a,s){switch(n){case"style":o0(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"?ts(e,l):(typeof l=="number"||typeof l=="bigint")&&ts(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=qn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!n0.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[wt]||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,""):Zr(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)}}s0(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?Xa(e,!!l,t,!1):n!=null&&Xa(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)}r0(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<ki.length;l++)oe(ki[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(Of(t)){for(d in n)n.hasOwnProperty(d)&&(l=n[d],l!==void 0&&Gd(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 PS(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)}}md(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?Xa(e,!!n,h,!1):!!l!=!!n&&(t!=null?Xa(e,!!n,t,!0):Xa(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)}i0(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(Of(t)){for(var w in n)h=n[w],n.hasOwnProperty(w)&&h!==void 0&&!l.hasOwnProperty(w)&&Gd(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||Gd(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 Cg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function eN(){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&&Cg(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&&Cg(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 Qd=null,Zd=null;function Bo(e){return e.nodeType===9?e:e.ownerDocument}function Mg(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 fv(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 Id(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 Uu=null;function tN(){var e=window.event;return e&&e.type==="popstate"?e===Uu?!1:(Uu=e,!0):(Uu=null,!1)}var hv=typeof setTimeout=="function"?setTimeout:void 0,nN=typeof clearTimeout=="function"?clearTimeout:void 0,_g=typeof Promise=="function"?Promise:void 0,lN=typeof queueMicrotask=="function"?queueMicrotask:typeof _g<"u"?function(e){return _g.resolve(null).then(e).catch(aN)}:hv;function aN(e){setTimeout(function(){throw e})}function $l(e){return e==="head"}function Ag(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),cs(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")ui(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,ui(n);for(var s=n.firstChild;s;){var i=s.nextSibling,r=s.nodeName;s[Gi]||r==="SCRIPT"||r==="STYLE"||r==="LINK"&&s.rel.toLowerCase()==="stylesheet"||n.removeChild(s),s=i}}else n==="body"&&ui(e.ownerDocument.body);n=a}while(n);cs(t)}function Tg(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 Kd(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":Kd(n),Rf(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function sN(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[Gi])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=Kt(e.nextSibling),e===null)break}return null}function iN(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Kt(e.nextSibling),e===null))return null;return e}function pv(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Kt(e.nextSibling),e===null))return null;return e}function Wd(e){return e.data==="$?"||e.data==="$~"}function Jd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function rN(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 Kt(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 Fd=null;function zg(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Kt(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Dg(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 gv(e,t,n){switch(t=Bo(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 ui(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Rf(e)}var Wt=new Map,Rg=new Set;function Uo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var tl=ye.d;ye.d={f:oN,r:cN,D:uN,C:dN,L:fN,m:hN,X:gN,S:pN,M:mN};function oN(){var e=tl.f(),t=Mc();return e||t}function cN(e){var t=ws(e);t!==null&&t.tag===5&&t.type==="form"?oy(t):tl.r(e)}var ks=typeof document>"u"?null:document;function mv(e,t,n){var l=ks;if(l&&typeof t=="string"&&t){var a=Gt(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),Rg.has(a)||(Rg.add(a),e={rel:e,crossOrigin:n,href:t},l.querySelector(a)===null&&(t=l.createElement("link"),lt(t,"link",e),Je(t),l.head.appendChild(t)))}}function uN(e){tl.D(e),mv("dns-prefetch",e,null)}function dN(e,t){tl.C(e,t),mv("preconnect",e,t)}function fN(e,t,n){tl.L(e,t,n);var l=ks;if(l&&e&&t){var a='link[rel="preload"][as="'+Gt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+Gt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+Gt(n.imageSizes)+'"]')):a+='[href="'+Gt(e)+'"]';var s=a;switch(t){case"style":s=os(e);break;case"script":s=Es(e)}Wt.has(s)||(e=Ae({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Wt.set(s,e),l.querySelector(a)!==null||t==="style"&&l.querySelector(Ji(s))||t==="script"&&l.querySelector(Fi(s))||(t=l.createElement("link"),lt(t,"link",e),Je(t),l.head.appendChild(t)))}}function hN(e,t){tl.m(e,t);var n=ks;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+Gt(l)+'"][href="'+Gt(e)+'"]',s=a;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Es(e)}if(!Wt.has(s)&&(e=Ae({rel:"modulepreload",href:e},t),Wt.set(s,e),n.querySelector(a)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Fi(s)))return}l=n.createElement("link"),lt(l,"link",e),Je(l),n.head.appendChild(l)}}}function pN(e,t,n){tl.S(e,t,n);var l=ks;if(l&&e){var a=Va(l).hoistableStyles,s=os(e);t=t||"default";var i=a.get(s);if(!i){var r={loading:0,preload:null};if(i=l.querySelector(Ji(s)))r.loading=5;else{e=Ae({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Wt.get(s))&&vh(e,n);var c=i=l.createElement("link");Je(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,ao(i,t,l)}i={type:"stylesheet",instance:i,count:1,state:r},a.set(s,i)}}}function gN(e,t){tl.X(e,t);var n=ks;if(n&&e){var l=Va(n).hoistableScripts,a=Es(e),s=l.get(a);s||(s=n.querySelector(Fi(a)),s||(e=Ae({src:e,async:!0},t),(t=Wt.get(a))&&bh(e,t),s=n.createElement("script"),Je(s),lt(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(a,s))}}function mN(e,t){tl.M(e,t);var n=ks;if(n&&e){var l=Va(n).hoistableScripts,a=Es(e),s=l.get(a);s||(s=n.querySelector(Fi(a)),s||(e=Ae({src:e,async:!0,type:"module"},t),(t=Wt.get(a))&&bh(e,t),s=n.createElement("script"),Je(s),lt(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(a,s))}}function Og(e,t,n,l){var a=(a=Nl.current)?Uo(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=os(n.href),n=Va(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=os(n.href);var s=Va(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(Ji(e)))&&!s._p&&(i.instance=s,i.state.loading=5),Wt.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},Wt.set(e,n),s||xN(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=Es(n),n=Va(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 os(e){return'href="'+Gt(e)+'"'}function Ji(e){return'link[rel="stylesheet"]['+e+"]"}function xv(e){return Ae({},e,{"data-precedence":e.precedence,precedence:null})}function xN(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),Je(t),e.head.appendChild(t))}function Es(e){return'[src="'+Gt(e)+'"]'}function Fi(e){return"script[async]"+e}function Hg(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+Gt(n.href)+'"]');if(l)return t.instance=l,Je(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"),Je(l),lt(l,"style",a),ao(l,n.precedence,e),t.instance=l;case"stylesheet":a=os(n.href);var s=e.querySelector(Ji(a));if(s)return t.state.loading|=4,t.instance=s,Je(s),s;l=xv(n),(a=Wt.get(a))&&vh(l,a),s=(e.ownerDocument||e).createElement("link"),Je(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,ao(s,n.precedence,e),t.instance=s;case"script":return s=Es(n.src),(a=e.querySelector(Fi(s)))?(t.instance=a,Je(a),a):(l=n,(a=Wt.get(s))&&(l=Ae({},n),bh(l,a)),e=e.ownerDocument||e,a=e.createElement("script"),Je(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,ao(l,n.precedence,e));return t.instance}function ao(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 vh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function bh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var so=null;function Lg(e,t,n){if(so===null){var l=new Map,a=so=new Map;a.set(n,l)}else a=so,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[Gi]||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 $g(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function yN(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 yv(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function vN(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=os(l.href),s=t.querySelector(Ji(a));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=qo.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,Je(s);return}s=t.ownerDocument||t,l=xv(l),(a=Wt.get(a))&&vh(l,a),s=s.createElement("link"),Je(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=qo.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var qu=0;function bN(e,t){return e.stylesheets&&e.count===0&&io(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&io(e,e.stylesheets),e.unsuspend){var s=e.unsuspend;e.unsuspend=null,s()}},6e4+t);0<e.imgBytes&&qu===0&&(qu=62500*eN());var a=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&io(e,e.stylesheets),e.unsuspend)){var s=e.unsuspend;e.unsuspend=null,s()}},(e.imgBytes>qu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(a)}}:null}function qo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)io(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yo=null;function io(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yo=new Map,t.forEach(wN,e),Yo=null,qo.call(e))}function wN(e,t){if(!(t.state.loading&4)){var n=Yo.get(e);if(n)var l=n.get(null);else{n=new Map,Yo.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=qo.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 Ci={$$typeof:Un,Provider:null,Consumer:null,_currentValue:Fl,_currentValue2:Fl,_threadCount:0};function SN(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=uu(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=uu(0),this.hiddenUpdates=uu(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 vv(e,t,n,l,a,s,i,r,c,u,d,f){return e=new SN(e,t,n,i,c,u,d,f,r),t=1,s===!0&&(t|=24),s=Et(3,null,null,t),e.current=s,s.stateNode=e,t=Qf(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:l,isDehydrated:n,cache:t},Kf(s),e}function bv(e){return e?(e=La,e):La}function wv(e,t,n,l,a,s){a=bv(a),l.context===null?l.context=a:l.pendingContext=a,l=kl(t),l.payload={element:n},s=s===void 0?null:s,s!==null&&(l.callback=s),n=El(e,l,t),n!==null&&(bt(n,e,t),ni(n,e,t))}function Bg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function wh(e,t){Bg(e,t),(e=e.alternate)&&Bg(e,t)}function Sv(e){if(e.tag===13||e.tag===31){var t=ya(e,67108864);t!==null&&bt(t,e,67108864),wh(e,67108864)}}function Ug(e){if(e.tag===13||e.tag===31){var t=zt();t=zf(t);var n=ya(e,t);n!==null&&bt(n,e,t),wh(e,t)}}var Vo=!0;function NN(e,t,n,l){var a=ne.T;ne.T=null;var s=ye.p;try{ye.p=2,Sh(e,t,n,l)}finally{ye.p=s,ne.T=a}}function jN(e,t,n,l){var a=ne.T;ne.T=null;var s=ye.p;try{ye.p=8,Sh(e,t,n,l)}finally{ye.p=s,ne.T=a}}function Sh(e,t,n,l){if(Vo){var a=Pd(l);if(a===null)Bu(e,t,l,Xo,n),qg(e,l);else if(EN(a,e,t,n,l))l.stopPropagation();else if(qg(e,l),t&4&&-1<kN.indexOf(e)){for(;a!==null;){var s=ws(a);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var i=Gl(s.pendingLanes);if(i!==0){var r=s;for(r.pendingLanes|=2,r.entangledLanes|=2;i;){var c=1<<31-Tt(i);r.entanglements[1]|=c,i&=~c}En(s),!(xe&6)&&(Do=_t()+500,Wi(0))}}break;case 31:case 13:r=ya(s,2),r!==null&&bt(r,s,2),Mc(),wh(s,2)}if(s=Pd(l),s===null&&Bu(e,t,l,Xo,n),s===a)break;a=s}a!==null&&l.stopPropagation()}else Bu(e,t,l,null,n)}}function Pd(e){return e=Hf(e),Nh(e)}var Xo=null;function Nh(e){if(Xo=null,e=Ta(e),e!==null){var t=qi(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=Yx(t),e!==null)return e;e=null}else if(n===31){if(e=Vx(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 Xo=e,null}function Nv(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(uw()){case Zx:return 2;case Ix:return 8;case vo:case dw:return 32;case Kx:return 268435456;default:return 32}default:return 32}}var ef=!1,_l=null,Al=null,Tl=null,Mi=new Map,_i=new Map,ml=[],kN="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 qg(e,t){switch(e){case"focusin":case"focusout":_l=null;break;case"dragenter":case"dragleave":Al=null;break;case"mouseover":case"mouseout":Tl=null;break;case"pointerover":case"pointerout":Mi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":_i.delete(t.pointerId)}}function Bs(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=ws(t),t!==null&&Sv(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function EN(e,t,n,l,a){switch(t){case"focusin":return _l=Bs(_l,e,t,n,l,a),!0;case"dragenter":return Al=Bs(Al,e,t,n,l,a),!0;case"mouseover":return Tl=Bs(Tl,e,t,n,l,a),!0;case"pointerover":var s=a.pointerId;return Mi.set(s,Bs(Mi.get(s)||null,e,t,n,l,a)),!0;case"gotpointercapture":return s=a.pointerId,_i.set(s,Bs(_i.get(s)||null,e,t,n,l,a)),!0}return!1}function jv(e){var t=Ta(e.target);if(t!==null){var n=qi(t);if(n!==null){if(t=n.tag,t===13){if(t=Yx(n),t!==null){e.blockedOn=t,kp(e.priority,function(){Ug(n)});return}}else if(t===31){if(t=Vx(n),t!==null){e.blockedOn=t,kp(e.priority,function(){Ug(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 ro(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Pd(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);yd=l,n.target.dispatchEvent(l),yd=null}else return t=ws(n),t!==null&&Sv(t),e.blockedOn=n,!1;t.shift()}return!0}function Yg(e,t,n){ro(e)&&n.delete(t)}function CN(){ef=!1,_l!==null&&ro(_l)&&(_l=null),Al!==null&&ro(Al)&&(Al=null),Tl!==null&&ro(Tl)&&(Tl=null),Mi.forEach(Yg),_i.forEach(Yg)}function Cr(e,t){e.blockedOn===t&&(e.blockedOn=null,ef||(ef=!0,Ze.unstable_scheduleCallback(Ze.unstable_NormalPriority,CN)))}var Mr=null;function Vg(e){Mr!==e&&(Mr=e,Ze.unstable_scheduleCallback(Ze.unstable_NormalPriority,function(){Mr===e&&(Mr=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(Nh(l||n)===null)continue;break}var s=ws(n);s!==null&&(e.splice(t,3),t-=3,Rd(s,{pending:!0,data:a,method:n.method,action:l},l,a))}}))}function cs(e){function t(c){return Cr(c,e)}_l!==null&&Cr(_l,e),Al!==null&&Cr(Al,e),Tl!==null&&Cr(Tl,e),Mi.forEach(t),_i.forEach(t);for(var n=0;n<ml.length;n++){var l=ml[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<ml.length&&(n=ml[0],n.blockedOn===null);)jv(n),n.blockedOn===null&&ml.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[wt]||null;if(typeof s=="function")i||Vg(n);else if(i){var r=null;if(s&&s.hasAttribute("formAction")){if(a=s,i=s[wt]||null)r=i.formAction;else if(Nh(a)!==null)continue}else r=i.action;typeof r=="function"?n[l+1]=r:(n.splice(l,3),l-=3),Vg(n)}}}function kv(){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 jh(e){this._internalRoot=e}Tc.prototype.render=jh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Z(409));var n=t.current,l=zt();wv(n,l,e,t,null,null)};Tc.prototype.unmount=jh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wv(e.current,2,null,e,null,null),Mc(),t[bs]=null}};function Tc(e){this._internalRoot=e}Tc.prototype.unstable_scheduleHydration=function(e){if(e){var t=e0();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ml.length&&t!==0&&t<ml[n].priority;n++);ml.splice(n,0,e),n===0&&jv(e)}};var Xg=Ux.version;if(Xg!=="19.2.6")throw Error(Z(527,Xg,"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=lw(t),e=e!==null?Xx(e):null,e=e===null?null:e.stateNode,e};var MN={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:ne,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _r=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_r.isDisabled&&_r.supportsFiber)try{Yi=_r.inject(MN),At=_r}catch{}}pc.createRoot=function(e,t){if(!qx(e))throw Error(Z(299));var n=!1,l="",a=my,s=xy,i=yy;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=vv(e,1,!1,null,null,n,l,null,a,s,i,kv),e[bs]=t.current,yh(e),new jh(t)};pc.hydrateRoot=function(e,t,n){if(!qx(e))throw Error(Z(299));var l=!1,a="",s=my,i=xy,r=yy,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=vv(e,1,!0,t,n??null,l,a,c,s,i,r,kv),t.context=bv(null),n=t.current,l=zt(),l=zf(l),a=kl(l),a.callback=null,El(n,a,l),n=l,t.current.lanes=n,Xi(t,n),En(t),e[bs]=t.current,yh(e),new Tc(t)};pc.version="19.2.6";function Ev(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ev)}catch(e){console.error(e)}}Ev(),Rx.exports=pc;var _N=Rx.exports;function AN(){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 TN{constructor(t,n){this.baseUrl=t,this.token=n}async request(t,n){const l=AN(),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 zN{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 Cv=b.createContext({rpc:null,ws:null,connected:!1,connectionStatus:"disconnected",token:null,setToken:()=>{}});function Cn(){return b.useContext(Cv)}function DN({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 TN(r,t),u=new zN(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(Cv.Provider,{value:i,children:e})}function kh(){const{rpc:e,ws:t}=Cn(),[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 Eh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ba=Eh();function Mv(e){ba=e}var Kl={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 RN=((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)}}>`)},ON=/^(?:[ \t]*(?:\n|$))+/,HN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,LN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Pi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,$N=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ch=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,_v=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Av=pe(_v).replace(/bull/g,Ch).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(),BN=pe(_v).replace(/bull/g,Ch).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(),Mh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,UN=/^[^\n]+/,_h=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,qN=pe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_h).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),YN=pe(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ch).getRegex(),zc="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",Ah=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,VN=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",Ah).replace("tag",zc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Tv=pe(Mh).replace("hr",Pi).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",zc).getRegex(),XN=pe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Tv).getRegex(),Th={blockquote:XN,code:HN,def:qN,fences:LN,heading:$N,hr:Pi,html:VN,lheading:Av,list:YN,newline:ON,paragraph:Tv,table:Kl,text:UN},Gg=pe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Pi).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",zc).getRegex(),GN={...Th,lheading:BN,table:Gg,paragraph:pe(Mh).replace("hr",Pi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Gg).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",zc).getRegex()},QN={...Th,html:pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ah).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:Kl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:pe(Mh).replace("hr",Pi).replace("heading",` *#{1,6} *[^
50
- ]`).replace("lheading",Av).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ZN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,IN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zv=/^( {2,}|\\)\n(?!\s*$)/,KN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Cs=/[\p{P}\p{S}]/u,Dc=/[\s\p{P}\p{S}]/u,zh=/[^\s\p{P}\p{S}]/u,WN=pe(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Dc).getRegex(),Dv=/(?!~)[\p{P}\p{S}]/u,JN=/(?!~)[\s\p{P}\p{S}]/u,FN=/(?:[^\s\p{P}\p{S}]|~)/u,PN=pe(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",RN?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Rv=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ej=pe(Rv,"u").replace(/punct/g,Cs).getRegex(),tj=pe(Rv,"u").replace(/punct/g,Dv).getRegex(),Ov="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",nj=pe(Ov,"gu").replace(/notPunctSpace/g,zh).replace(/punctSpace/g,Dc).replace(/punct/g,Cs).getRegex(),lj=pe(Ov,"gu").replace(/notPunctSpace/g,FN).replace(/punctSpace/g,JN).replace(/punct/g,Dv).getRegex(),aj=pe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,zh).replace(/punctSpace/g,Dc).replace(/punct/g,Cs).getRegex(),sj=pe(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Cs).getRegex(),ij="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",rj=pe(ij,"gu").replace(/notPunctSpace/g,zh).replace(/punctSpace/g,Dc).replace(/punct/g,Cs).getRegex(),oj=pe(/\\(punct)/,"gu").replace(/punct/g,Cs).getRegex(),cj=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(),uj=pe(Ah).replace("(?:-->|$)","-->").getRegex(),dj=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",uj).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Go=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,fj=pe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Go).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Hv=pe(/^!?\[(label)\]\[(ref)\]/).replace("label",Go).replace("ref",_h).getRegex(),Lv=pe(/^!?\[(ref)\](?:\[\])?/).replace("ref",_h).getRegex(),hj=pe("reflink|nolink(?!\\()","g").replace("reflink",Hv).replace("nolink",Lv).getRegex(),Qg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Dh={_backpedal:Kl,anyPunctuation:oj,autolink:cj,blockSkip:PN,br:zv,code:IN,del:Kl,delLDelim:Kl,delRDelim:Kl,emStrongLDelim:ej,emStrongRDelimAst:nj,emStrongRDelimUnd:aj,escape:ZN,link:fj,nolink:Lv,punctuation:WN,reflink:Hv,reflinkSearch:hj,tag:dj,text:KN,url:Kl},pj={...Dh,link:pe(/^!?\[(label)\]\((.*?)\)/).replace("label",Go).getRegex(),reflink:pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Go).getRegex()},tf={...Dh,emStrongRDelimAst:lj,emStrongLDelim:tj,delLDelim:sj,delRDelim:rj,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()},gj={...tf,br:pe(zv).replace("{2,}","*").getRegex(),text:pe(tf.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ar={normal:Th,gfm:GN,pedantic:QN},Us={normal:Dh,gfm:tf,breaks:gj,pedantic:pj},mj={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Zg=e=>mj[e];function mn(e,t){if(t){if(at.escapeTest.test(e))return e.replace(at.escapeReplace,Zg)}else if(at.escapeTestNoEncode.test(e))return e.replace(at.escapeReplaceNoEncode,Zg);return e}function Ig(e){try{e=encodeURI(e).replace(at.percentDecode,"%")}catch{return null}return e}function Kg(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 il(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 Wg(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 xj(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 yj(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 Jg(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 vj(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 Qo=class{constructor(e){fe(this,"options");fe(this,"rules");fe(this,"lexer");this.options=e||ba}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]:Wg(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=vj(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=il(n,"#");(this.options.pedantic||!l||this.rules.other.endingSpaceChar.test(l))&&(n=l.trim())}return{type:"heading",raw:il(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:il(t[0],`
56
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=il(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=yj(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],E;if(h=j,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),E=h):E=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(E.search(this.rules.other.nonSpaceChar)>=x||!h.trim())d+=`
72
- `+E.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=E.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=Wg(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:il(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=Kg(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:il(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(Kg(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:il(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=il(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=xj(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)),Jg(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 Jg(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}}}},nn=class nf{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||ba,this.options.tokenizer=this.options.tokenizer||new Qo,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:Ar.normal,inline:Us.normal};this.options.pedantic?(n.block=Ar.pedantic,n.inline=Us.pedantic):this.options.gfm&&(n.block=Ar.gfm,this.options.breaks?n.inline=Us.breaks:n.inline=Us.gfm),this.tokenizer.rules=n}static get rules(){return{block:Ar,inline:Us}}static lex(t,n){return new nf(n).lex(t)}static lexInline(t,n){return new nf(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)}},Zo=class{constructor(e){fe(this,"options");fe(this,"parser");this.options=e||ba}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-'+mn(l)+'">'+(n?a:mn(a,!0))+`</code></pre>
95
- `:"<pre><code>"+(n?a:mn(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>${mn(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=Ig(e);if(a===null)return l;e=a;let s='<a href="'+e+'"';return t&&(s+=' title="'+mn(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=Ig(e);if(a===null)return mn(n);e=a;let s=`<img src="${e}" alt="${mn(n)}"`;return t&&(s+=` title="${mn(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:mn(e.text)}},Rh=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}},ln=class lf{constructor(t){fe(this,"options");fe(this,"renderer");fe(this,"textRenderer");this.options=t||ba,this.options.renderer=this.options.renderer||new Zo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Rh}static parse(t,n){return new lf(n).parse(t)}static parseInline(t,n){return new lf(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}},Qr,Is=(Qr=class{constructor(e){fe(this,"options");fe(this,"block");this.options=e||ba}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?nn.lex:nn.lexInline}provideParser(e=this.block){return e?ln.parse:ln.parseInline}},fe(Qr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),fe(Qr,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Qr),bj=class{constructor(...e){fe(this,"defaults",Eh());fe(this,"options",this.setOptions);fe(this,"parse",this.parseMarkdown(!0));fe(this,"parseInline",this.parseMarkdown(!1));fe(this,"Parser",ln);fe(this,"Renderer",Zo);fe(this,"TextRenderer",Rh);fe(this,"Lexer",nn);fe(this,"Tokenizer",Qo);fe(this,"Hooks",Is);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 Zo(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 Qo(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 Is;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];Is.passThroughHooks.has(s)?a[i]=u=>{if(this.defaults.async&&Is.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 nn.lex(e,t??this.defaults)}parser(e,t){return ln.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?nn.lex:nn.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?ln.parse:ln.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?nn.lex:nn.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?ln.parse:ln.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>"+mn(n.message+"",!0)+"</pre>";return t?Promise.resolve(l):l}if(t)return Promise.reject(n);throw n}}},ua=new bj;function ve(e,t){return ua.parse(e,t)}ve.options=ve.setOptions=function(e){return ua.setOptions(e),ve.defaults=ua.defaults,Mv(ve.defaults),ve};ve.getDefaults=Eh;ve.defaults=ba;ve.use=function(...e){return ua.use(...e),ve.defaults=ua.defaults,Mv(ve.defaults),ve};ve.walkTokens=function(e,t){return ua.walkTokens(e,t)};ve.parseInline=ua.parseInline;ve.Parser=ln;ve.parser=ln.parse;ve.Renderer=Zo;ve.TextRenderer=Rh;ve.Lexer=nn;ve.lexer=nn.lex;ve.Tokenizer=Qo;ve.Hooks=Is;ve.parse=ve;ve.options;ve.setOptions;ve.use;ve.walkTokens;ve.parseInline;ln.parse;nn.lex;function Fg(e){return e<1e3?String(e):`${(e/1e3).toFixed(1)}k`}function wj({onSend:e,onCancel:t,cmdInput:n,onClearCmdInput:l,totalTokens:a,contextTokens:s,costUsd:i}){const{providers:r,get:c}=kh(),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:[Fg(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 ",Fg(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 Sj=["line","area","bar","stacked-bar","scatter"];function Nj(e){if(!e||typeof e!="object")return!1;const t=e;if(typeof t.type!="string"||!Sj.includes(t.type)||typeof t.title!="string"||t.title.length===0||t.normalize!==void 0&&typeof t.normalize!="boolean"||!Array.isArray(t.series)||t.series.length===0)return!1;for(const n of t.series){if(!n||typeof n!="object")return!1;const l=n;if(typeof l.name!="string"||!Array.isArray(l.points)||l.points.length===0)return!1;for(const a of l.points){if(!a||typeof a!="object")return!1;const s=a;if(typeof s.x!="string"&&typeof s.x!="number"||typeof s.y!="number"||!Number.isFinite(s.y))return!1}}return!0}const Pg=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)","var(--chart-6)","var(--chart-7)","var(--chart-8)"];function yt(e){return Pg[e%Pg.length]}function jj({spec:e,renderChart:t,renderTable:n,height:l=220}){const a=b.useRef(null),[s,i]=b.useState(0),[r,c]=b.useState(!1);b.useEffect(()=>{const d=a.current;if(!d)return;const f=new ResizeObserver(h=>{var x;const p=(x=h[0])==null?void 0:x.contentRect.width;p&&i(Math.max(240,Math.floor(p)))});return f.observe(d),()=>f.disconnect()},[]);const u=e.series.length>1;return o.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:o.jsxs("div",{className:"rounded-xl p-4 select-none",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-start justify-between gap-3 mb-1.5",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-[13px] font-display font-semibold truncate",style:{color:"var(--chart-ink)"},children:e.title}),e.subtitle&&o.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--chart-ink-muted)"},children:e.subtitle})]}),o.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.normalize&&o.jsx("span",{className:"text-[10px] font-mono px-2 py-1 rounded-[4px]",style:{background:"var(--s3)",border:"1px solid var(--b1)",color:"var(--chart-ink-muted)"},title:"Each series is rebased to 100 at its first point, so differently-scaled series can be compared on one shared axis.",children:"Indexed"}),o.jsx("button",{onClick:()=>c(d=>!d),className:"text-[10px] font-mono px-2 py-1 rounded-[4px] cursor-pointer transition-colors",style:{background:"var(--s3)",border:"1px solid var(--b1)",color:"var(--chart-ink-muted)"},children:r?"Chart":"Table"})]})]}),u&&o.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1 mb-2",children:e.series.map((d,f)=>o.jsxs("div",{className:"flex items-center gap-1.5 text-[10.5px]",style:{color:"var(--chart-ink-muted)"},children:[o.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full shrink-0",style:{background:yt(f)}}),d.name]},d.name))}),o.jsx("div",{ref:a,className:"w-full",style:{minHeight:l},children:r?n():s>0?t(s,l):null}),e.note&&o.jsx("div",{className:"mt-2 text-[10.5px] italic",style:{color:"var(--chart-ink-muted)"},children:e.note})]})})}function kj(e,t,n=.3){const[l,a]=t,s=a-l,i=e>0?s/e:s,r=Math.max(1,i*(1-n));return{step:i,bandWidth:r,center:c=>l+i*c+i/2,start:c=>l+i*c+(i-r)/2}}function em(e,t){const n=e||1,l=Math.floor(Math.log10(n)),a=n/Math.pow(10,l);let s;return t?a<1.5?s=1:a<3?s=2:a<7?s=5:s=10:a<=1?s=1:a<=2?s=2:a<=5?s=5:s=10,s*Math.pow(10,l)}function Io(e,t,n=5){let l=e,a=t;if(l===a){const d=Math.abs(l)*.1||1;l-=d,a+=d}const s=em(a-l,!1),i=em(s/Math.max(1,n-1),!0),r=Math.floor(l/i)*i,c=Math.ceil(a/i)*i,u=[];for(let d=r;d<=c+i*.5;d+=i)u.push(Math.round(d*1e10)/1e10);return u}function Ej(e){var l;if(e.length===0)return 1;const t=Math.max(...e.map(a=>a.points.length));let n=0;for(let a=0;a<t;a++){let s=0;for(const i of e)s+=((l=i.points[a])==null?void 0:l.y)??0;s>n&&(n=s)}return n||1}function Cj(e){return e.map(t=>{var l;const n=(l=t.points[0])==null?void 0:l.y;return n?{...t,points:t.points.map(a=>({x:a.x,y:a.y/n*100}))}:t})}function $v(e){const t=Math.abs(e);return t<1e3?Number.isInteger(e)?String(e):e.toFixed(2):t<1e6?`${(e/1e3).toFixed(1)}k`:t<1e9?`${(e/1e6).toFixed(2)}M`:`${(e/1e9).toFixed(2)}B`}function Mj(e){return Math.abs(e)>=1e3?`$${$v(e)}`:`$${e.toLocaleString(void 0,{maximumFractionDigits:2})}`}function _j(e){const t=["B","KB","MB","GB","TB"];let n=Math.abs(e),l=0;for(;n>=1024&&l<t.length-1;)n/=1024,l++;return`${e<0?"-":""}${n.toFixed(n<10&&l>0?1:0)} ${t[l]}`}function Zn(e,t){switch(t){case"compact":return $v(e);case"currency":return Mj(e);case"percent":return`${(e*100).toFixed(1)}%`;case"bytes":return _j(e);case"number":default:return e.toLocaleString()}}function Oh({data:e,chartWidth:t}){if(!e)return null;const n=e.x>t*.6;return o.jsxs("div",{className:"absolute pointer-events-none z-10 rounded-lg px-2.5 py-1.5 text-[10.5px] font-mono shadow-lg",style:{left:n?void 0:Math.max(0,e.x+10),right:n?Math.max(0,t-e.x+10):void 0,top:Math.max(0,e.y-10),background:"var(--s3)",border:"1px solid var(--b1)",color:"var(--chart-ink)",minWidth:96,whiteSpace:"nowrap"},children:[o.jsx("div",{className:"font-semibold mb-1",style:{color:"var(--chart-ink-muted)"},children:e.label}),e.rows.map((l,a)=>o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block w-2 h-2 rounded-full shrink-0",style:{background:l.color}}),o.jsxs("span",{children:[l.name,":"]}),o.jsx("span",{className:"font-semibold ml-auto pl-2",style:{color:"var(--chart-ink)"},children:l.value})]},a))]})}function Aj({spec:e,width:t,height:n}){var V;const[l,a]=b.useState(null),s=e.type==="area",i=44,r=12,c=12,u=24,d=Math.max(10,t-i-r),f=Math.max(10,n-c-u),h=e.normalize?Cj(e.series):e.series,p=((V=h[0])==null?void 0:V.points)??[],x=p.length,S=h.flatMap(N=>N.points.map(D=>D.y)),w=Io(Math.min(0,...S),Math.max(...S,1),5),g=w[0],m=w[w.length-1]-g||1,v=N=>x>1?i+N/(x-1)*d:i+d/2,j=N=>c+f-(N-g)/m*f,E=h.map(N=>N.points.map((D,k)=>`${k===0?"M":"L"} ${v(k)} ${j(D.y)}`).join(" ")),M=s?h.map((N,D)=>{const k=E[D],R=v(N.points.length-1),z=v(0);return`${k} L ${R} ${c+f} L ${z} ${c+f} Z`}):[],A=e.series.length>1&&e.series.length<=4,C=N=>{const D=N.currentTarget.getBoundingClientRect(),k=N.clientX-D.left,R=x>1?Math.round((k-i)/d*(x-1)):0;a(Math.min(x-1,Math.max(0,R)))},H=l!==null&&p[l]?{x:v(l),y:j(Math.max(...h.map(N=>{var D;return((D=N.points[l])==null?void 0:D.y)??g}))),label:String(p[l].x),rows:e.series.map((N,D)=>{var z,O,Y;const k=(z=N.points[l])==null?void 0:z.y;if(k===void 0)return{name:N.name,value:"—",color:yt(D)};if(!e.normalize)return{name:N.name,value:Zn(k,e.y_format),color:yt(D)};const R=((Y=(O=h[D])==null?void 0:O.points[l])==null?void 0:Y.y)??0;return{name:N.name,value:`${Zn(k,e.y_format)} (${R.toFixed(1)})`,color:yt(D)}})}:null,T=Math.floor((x-1)/2),$=x>0?Array.from(new Set([0,T,x-1])):[];return o.jsxs("div",{className:"relative",style:{width:"100%",height:n},children:[o.jsxs("svg",{width:t,height:n,className:"overflow-visible",children:[o.jsx("defs",{children:e.series.map((N,D)=>o.jsxs("linearGradient",{id:`chart-grad-${D}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[o.jsx("stop",{offset:"0%",stopColor:yt(D),stopOpacity:"0.22"}),o.jsx("stop",{offset:"100%",stopColor:yt(D),stopOpacity:"0"})]},D))}),w.map((N,D)=>{const k=j(N);return o.jsxs("g",{children:[o.jsx("line",{x1:i,y1:k,x2:t-r,y2:k,stroke:"var(--chart-grid)",strokeWidth:"1"}),o.jsx("text",{x:i-8,y:k+3.5,textAnchor:"end",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace"},children:e.normalize?N.toFixed(0):Zn(N,e.y_format)})]},D)}),o.jsx("line",{x1:i,y1:c+f,x2:t-r,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1"}),$.map(N=>{var D;return o.jsx("text",{x:v(N),y:n-6,textAnchor:N===0?"start":N===x-1?"end":"middle",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace",opacity:.7},children:String(((D=p[N])==null?void 0:D.x)??"")},N)}),s&&M.map((N,D)=>o.jsx("path",{d:N,fill:`url(#chart-grad-${D})`},`area-${D}`)),E.map((N,D)=>o.jsx("path",{d:N,fill:"none",stroke:yt(D),strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},`line-${D}`)),h.map((N,D)=>{const k=N.points[N.points.length-1];if(!k)return null;const R=v(N.points.length-1),z=j(k.y),O=Math.min(R+6,t-r-4),Y=O>t-r-34;return o.jsxs("g",{children:[o.jsx("circle",{cx:R,cy:z,r:"3",fill:yt(D),stroke:"var(--s1)",strokeWidth:"1.5"}),A&&o.jsx("text",{x:Y?t-r:O,y:z+3,textAnchor:Y?"end":"start",style:{fill:"var(--chart-ink)",fontSize:9.5,fontWeight:600,fontFamily:"inherit"},children:N.name})]},`endpoint-${D}`)}),H&&o.jsx("line",{x1:H.x,y1:c,x2:H.x,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1",strokeOpacity:"0.6"}),o.jsx("rect",{x:i,y:c,width:d,height:f,fill:"transparent",onMouseMove:C,onMouseLeave:()=>a(null),style:{cursor:"crosshair"}})]}),o.jsx(Oh,{data:H,chartWidth:t})]})}function Tj({spec:e,width:t,height:n}){var A;const[l,a]=b.useState(null),s=e.type==="stacked-bar",i=44,r=12,c=12,u=24,d=Math.max(10,t-i-r),f=Math.max(10,n-c-u),h=((A=e.series[0])==null?void 0:A.points)??[],p=h.length,x=s?Ej(e.series):Math.max(...e.series.flatMap(C=>C.points.map(H=>H.y)),1),S=Io(0,x,5),w=S[S.length-1],g=C=>c+f-C/(w||1)*f,y=kj(p,[i,i+d],.3),m=2,v=e.series.length,j=s?y.bandWidth:Math.max(2,(y.bandWidth-m*(v-1))/v),E=l!==null&&h[l]?{x:y.center(l),y:c,label:String(h[l].x),rows:e.series.map((C,H)=>{var T;return{name:C.name,value:Zn(((T=C.points[l])==null?void 0:T.y)??0,e.y_format),color:yt(H)}})}:null,M=Math.floor((p-1)/2);return o.jsxs("div",{className:"relative",style:{width:"100%",height:n},children:[o.jsxs("svg",{width:t,height:n,className:"overflow-visible",children:[S.map((C,H)=>{const T=g(C);return o.jsxs("g",{children:[o.jsx("line",{x1:i,y1:T,x2:t-r,y2:T,stroke:"var(--chart-grid)",strokeWidth:"1"}),o.jsx("text",{x:i-8,y:T+3.5,textAnchor:"end",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace"},children:Zn(C,e.y_format)})]},H)}),o.jsx("line",{x1:i,y1:c+f,x2:t-r,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1"}),h.map((C,H)=>p<=1||H===0||H===p-1||H===M?o.jsx("text",{x:y.center(H),y:n-6,textAnchor:"middle",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace",opacity:.7},children:String(C.x)},`label-${H}`):null),h.map((C,H)=>{const T=y.start(H);let $=c+f;return o.jsxs("g",{onMouseEnter:()=>a(H),onMouseLeave:()=>a(null),children:[o.jsx("rect",{x:y.center(H)-y.step/2,y:c,width:y.step,height:f,fill:"transparent"}),e.series.map((V,N)=>{var O;const D=((O=V.points[H])==null?void 0:O.y)??0;if(D<=0)return null;const k=D/(w||1)*f;let R,z;return s?(R=T,z=$-k-(N>0?m:0),$=z):(R=T+N*(j+m),z=c+f-k),o.jsx("rect",{x:R,y:z,width:j,height:k,rx:"2",fill:yt(N)},N)})]},`group-${H}`)}),E&&o.jsx("line",{x1:E.x,y1:c,x2:E.x,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1",strokeOpacity:"0.4"})]}),o.jsx(Oh,{data:E,chartWidth:t})]})}function Yu(e,t){if(typeof e=="number")return e;const n=Number(e);return Number.isFinite(n)?n:t}function zj({spec:e,width:t,height:n}){var M,A;const[l,a]=b.useState(null),s=48,i=16,r=14,c=26,u=Math.max(10,t-s-i),d=Math.max(10,n-r-c),f=e.series.flatMap(C=>C.points.map((H,T)=>Yu(H.x,T))),h=e.series.flatMap(C=>C.points.map(H=>H.y)),p=Io(Math.min(...f),Math.max(...f),4),x=Io(Math.min(0,...h),Math.max(...h,1),5),S=p[0],w=p[p.length-1],g=x[0],y=x[x.length-1],m=C=>s+(C-S)/(w-S||1)*u,v=C=>r+d-(C-g)/(y-g||1)*d,j=l?(M=e.series[l.si])==null?void 0:M.points[l.pi]:void 0,E=l&&j?{x:m(Yu(j.x,l.pi)),y:v(j.y),label:((A=e.series[l.si])==null?void 0:A.name)??"",rows:[{name:e.x_label||"x",value:String(j.x),color:yt(l.si)},{name:e.y_label||"y",value:Zn(j.y,e.y_format),color:yt(l.si)}]}:null;return o.jsxs("div",{className:"relative",style:{width:"100%",height:n},children:[o.jsxs("svg",{width:t,height:n,className:"overflow-visible",children:[x.map((C,H)=>{const T=v(C);return o.jsxs("g",{children:[o.jsx("line",{x1:s,y1:T,x2:t-i,y2:T,stroke:"var(--chart-grid)",strokeWidth:"1"}),o.jsx("text",{x:s-8,y:T+3.5,textAnchor:"end",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace"},children:Zn(C,e.y_format)})]},`y-${H}`)}),p.map((C,H)=>o.jsx("text",{x:m(C),y:n-6,textAnchor:"middle",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace",opacity:.7},children:Zn(C)},`x-${H}`)),o.jsx("line",{x1:s,y1:r+d,x2:t-i,y2:r+d,stroke:"var(--chart-axis)",strokeWidth:"1"}),o.jsx("line",{x1:s,y1:r,x2:s,y2:r+d,stroke:"var(--chart-axis)",strokeWidth:"1"}),e.series.map((C,H)=>C.points.map((T,$)=>{const V=m(Yu(T.x,$)),N=v(T.y);return o.jsxs("g",{children:[o.jsx("circle",{cx:V,cy:N,r:"12",fill:"transparent",onMouseEnter:()=>a({si:H,pi:$}),onMouseLeave:()=>a(null),style:{cursor:"pointer"}}),o.jsx("circle",{cx:V,cy:N,r:"4",fill:yt(H),stroke:"var(--s1)",strokeWidth:"1.5"})]},`${H}-${$}`)})),E&&l&&o.jsx("circle",{cx:E.x,cy:E.y,r:"7",fill:"none",stroke:yt(l.si),strokeWidth:"1.5"})]}),o.jsx(Oh,{data:E,chartWidth:t})]})}function Dj({spec:e}){var n;const t=((n=e.series[0])==null?void 0:n.points.map(l=>l.x))??[];return o.jsxs("div",{children:[o.jsx("div",{className:"overflow-x-auto overflow-y-auto max-h-[260px] scrollbar-thin",children:o.jsxs("table",{className:"w-full text-[11.5px] font-mono",children:[o.jsx("thead",{children:o.jsxs("tr",{style:{borderBottom:"1px solid var(--b1)"},children:[o.jsx("th",{className:"text-left py-1.5 pr-3 font-medium",style:{color:"var(--chart-ink-muted)"},children:e.x_label||"x"}),e.series.map(l=>o.jsx("th",{className:"text-right py-1.5 pl-3 font-medium",style:{color:"var(--chart-ink-muted)"},children:l.name},l.name))]})}),o.jsx("tbody",{children:t.map((l,a)=>o.jsxs("tr",{style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 40%, transparent)"},children:[o.jsx("td",{className:"py-1 pr-3",style:{color:"var(--chart-ink)",fontVariantNumeric:"tabular-nums"},children:String(l)}),e.series.map(s=>{var i;return o.jsx("td",{className:"text-right py-1 pl-3",style:{color:"var(--chart-ink)",fontVariantNumeric:"tabular-nums"},children:Zn(((i=s.points[a])==null?void 0:i.y)??0,e.y_format)},s.name)})]},a))})]})}),e.normalize&&o.jsx("div",{className:"mt-2 text-[10.5px] italic",style:{color:"var(--chart-ink-muted)"},children:"Chart is indexed to 100 at the first point; this table shows raw values."})]})}function Rj(){return o.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:o.jsxs("div",{className:"rounded-xl p-4 flex items-center gap-2",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:[o.jsx("div",{className:"w-[6px] h-[6px] rounded-full shrink-0 animate-pulse",style:{background:"var(--muted)"}}),o.jsx("div",{className:"text-[11.5px]",style:{color:"var(--muted)"},children:"Rendering chart…"})]})})}function tm({message:e,raw:t}){return o.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:o.jsxs("div",{className:"rounded-xl p-4",style:{background:"color-mix(in srgb, var(--red) 6%, var(--s2))",border:"1px solid color-mix(in srgb, var(--red) 25%, var(--b1))"},children:[o.jsx("div",{className:"text-[12px] font-semibold mb-1.5",style:{color:"var(--red)"},children:"Chart could not be rendered"}),o.jsx("div",{className:"text-[11.5px] mb-2",style:{color:"var(--text)"},children:e}),o.jsx("pre",{className:"text-[10.5px] font-mono overflow-x-auto whitespace-pre-wrap",style:{color:"var(--muted)"},children:typeof t=="string"?t:JSON.stringify(t,null,2)})]})})}function Oj({spec:e}){const t=(n,l)=>{switch(e.type){case"line":case"area":return o.jsx(Aj,{spec:e,width:n,height:l});case"bar":case"stacked-bar":return o.jsx(Tj,{spec:e,width:n,height:l});case"scatter":return o.jsx(zj,{spec:e,width:n,height:l});default:return null}};return o.jsx(jj,{spec:e,renderChart:t,renderTable:()=>o.jsx(Dj,{spec:e})})}function Hj({spec:e,error:t,pending:n,rawInput:l}){return t?o.jsx(tm,{message:t,raw:l??e}):n?o.jsx(Rj,{}):Nj(e)?o.jsx(Oj,{spec:e}):o.jsx(tm,{message:"The chart data did not match the expected format.",raw:l??e})}const nm=["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 lm(){return nm[Math.floor(Math.random()*nm.length)]}function Bv({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 Uv({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?qv(l.input):""})]},a))]})})}function Lj({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:Ko(e.formattedText||"")}})})]})})}function $j({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 On(e){return new Date(e).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function qv(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 Bj(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 Uj(e,t){const n=e.find(l=>l.type==="tool-result"&&l.toolCallId===t);if(n)return{output:n.output,error:n.error}}function qj(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>")}ve.setOptions({gfm:!0,breaks:!0});function Ko(e){try{return ve.parse(e)}catch{return qj(e)}}function Yv({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:qv(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 Yj({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(Bv,{content:u.content},d);if(u.type==="tool-group"){const f=u;return f.toolCalls.length>0?o.jsx(Uv,{toolCalls:f.toolCalls},d):null}return u.type==="approval-request"?o.jsx(Yv,{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:Ko(n)}})]})]})]})}):null}function Vj(e){switch(e.type){case"user-prompt":return{type:"user",content:e.text||"",time:On(e.timestamp)};case"assistant-delta":return{type:"assistant",content:e.text||"",time:On(e.timestamp)};case"thinking-delta":return{type:"thinking",content:e.text||"",time:On(e.timestamp)};case"heartbeat-brief":return{type:"heartbeat-brief",content:e.formattedText||"",time:On(e.timestamp),event:e};case"tool-call":{const t=e.name||"tool",n=e.input||{};if(t==="Chart")return{type:"chart",toolCallId:e.toolCallId||"",rawInput:n,time:On(e.timestamp)};const l=Bj(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";if(n==="Chart")return null;const l=e.input||{},a=e.decision,s=e.mode;return{type:"approval-request",toolCallId:t,name:n,input:l,decision:a,mode:s,time:On(e.timestamp)}}case"cron-task-fired":{const t=e.message||"",n=e.taskId||"";return{type:"reminder-fired",message:t,taskId:n,time:On(e.timestamp)}}case"context-warning":return{type:"assistant",content:e.message||"",time:On(e.timestamp)};case"error":return{type:"error",content:e.message||`An error occurred (code: ${e.code||"unknown"})`,time:On(e.timestamp)};default:return null}}function Xj(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,r=0};for(const f of e){const h=Vj(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 Gj({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}=Cn(),[S,w]=b.useState(!1),[g,y]=b.useState(null),[m,v]=b.useState(""),j=b.useRef(null),E=b.useRef(null),[M,A]=b.useState(lm);b.useEffect(()=>{E.current&&!l&&A(lm()),E.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 C=b.useMemo(()=>Xj(i),[i]),H=b.useRef(!0),T=b.useCallback(()=>{j.current&&(j.current.scrollTop=j.current.scrollHeight,H.current=!0)},[]);b.useEffect(()=>{const N=j.current;if(!N)return;const D=()=>{const k=N.scrollHeight-N.scrollTop-N.clientHeight<80;H.current=k};return N.addEventListener("scroll",D,{passive:!0}),()=>N.removeEventListener("scroll",D)},[]),b.useEffect(()=>{H.current&&T()},[C,S,T]),b.useEffect(()=>{T()},[T]),b.useEffect(()=>{e&&(console.log("Command palette result:",e),v(e),s==null||s())},[e,s]);const $=b.useCallback(async N=>{var k,R;if(!t){y("Not connected to daemon. Make sure the daemon is running.");return}if(w(!0),y(null),T(),N.startsWith("/")){const z=N.match(/^\/([^\s]+)(?:\s+(.*))?$/);if(z){const O=z[1].toLowerCase(),Y=(z[2]||"").trim();if(O==="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(L){const U=L instanceof Error?L.message:String(L);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Heartbeat failed: ${U}`}),w(!1)}}else if(X==="status"||X==="")try{const L=await t.heartbeatStatus(),U=(L==null?void 0:L.schedule)==="on",_=(L==null?void 0:L.intraday)||"(not set)",B=`### Heartbeat Cycle Status:
114
- * **Enabled**: \`${U?"yes":"no"}\`
115
- * **Intraday**: \`${_}\`
116
- * **Daily**: \`${(L==null?void 0:L.daily)||"6:00"}\`
117
- * **Weekly**: \`${(L==null?void 0:L.weekly)||"monday@6:00"}\`
118
- * **Monthly**: \`${(L==null?void 0:L.monthly)||"1@6:00"}\`
119
- * **Dreaming**: \`${(L==null?void 0:L.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:B}),w(!1)}catch(L){const U=L instanceof Error?L.message:String(L);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(L){const U=L instanceof Error?L.message:String(L);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(L){const U=L instanceof Error?L.message:String(L);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to disable heartbeat: ${U}`}),w(!1)}else{const L=Y.split(/\s+/),U=(k=L[0])==null?void 0:k.toLowerCase(),_=L.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(O==="cron"){r({type:"user-prompt",id:`local-prompt-${Date.now()}`,timestamp:Date.now(),text:N});const L=Y.toLowerCase().split(/\s+/),U=L[0]||"list",_=L.slice(1).join(" ").trim();if(U==="list"||!U)try{const B=await t.cronList();if(!B||B.length===0)r({type:"assistant-delta",id:`local-cron-list-${Date.now()}`,timestamp:Date.now(),text:"No reminders scheduled."});else{const G=B.map((q,Q)=>{const K=new Date(q.scheduledAt).toLocaleString(),W=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}. ${W} ${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(B){const G=B instanceof Error?B.message:String(B);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 B=await t.cronCancel(_);B!=null&&B.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(B){const G=B instanceof Error?B.message:String(B);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 B=await t.cronClear();r({type:"assistant-delta",id:`local-cron-clear-${Date.now()}`,timestamp:Date.now(),text:`Successfully cleared ${(B==null?void 0:B.removed)||0} completed reminder(s).`}),w(!1)}catch(B){const G=B instanceof Error?B.message:String(B);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(O==="wiki"){r({type:"user-prompt",id:`local-prompt-${Date.now()}`,timestamp:Date.now(),text:N});const X=((R=Y.split(/\s+/)[0])==null?void 0:R.toLowerCase())??"",L=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 B={};for(const q of _){const Q=q.category||"other";(B[Q]??(B[Q]=[])).push(`${q.slug} — ${q.title}`)}const G=Object.entries(B).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(!L)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(L)??[];if(_.length===0)r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`No wiki results for "${L}"`});else{const B=_.slice(0,20).map(G=>` **${G.slug}**: ${G.line}`);r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`### Wiki Search: "${L}" (${_.length} hits)
134
-
135
- ${B.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 B=_.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
- ${B.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 D=l||"";try{const z=await t.sessionSend(D,N,"webui");z!=null&&z.sessionId&&!l&&(h==null||h.subscribe(z.sessionId),a==null||a(z.sessionId))}catch(z){const O=z instanceof Error?z.message:String(z);y(`Failed to send: ${O}`),w(!1)}},[t,h,l,T,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),T();try{await t.sessionCancel(l)}catch(N){const D=N instanceof Error?N.message:String(N);y(`Failed to cancel: ${D}`)}}},[t,l,T]);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:[C.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:M})]}),o.jsxs("div",{className:"py-4 pb-6",children:[C.map((N,D)=>{if(N.type==="thinking")return o.jsx(Bv,{content:N.content},`thinking-${D}`);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:Ko(N.content)}})]})},D);if(N.type==="tool-group"){const k=N;if(k.toolCalls.length>0)return o.jsx(Uv,{toolCalls:k.toolCalls},D)}if(N.type==="agent-actions"){const k=N;return o.jsx(Yj,{blocks:k.blocks,blockCount:k.blockCount,time:k.time,events:i,rpc:t},`agent-${k.time||D}`)}if(N.type==="approval-request")return o.jsx(Yv,{toolCallId:N.toolCallId,name:N.name,input:N.input,decision:N.decision,events:i,rpc:t,mode:N.mode},D);if(N.type==="heartbeat-brief"){const k=N;return o.jsx(Lj,{event:k.event},D)}if(N.type==="reminder-fired")return o.jsx($j,{message:N.message,time:N.time},D);if(N.type==="chart"){const k=Uj(i,N.toolCallId);return o.jsx(Hj,{spec:k==null?void 0:k.output,error:k==null?void 0:k.error,pending:!k,rawInput:N.rawInput},D)}return 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})]},D):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:Ko(N.content)}})]},D)}),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(wj,{onSend:$,onCancel:S?V:void 0,cmdInput:m,onClearCmdInput:()=>v(""),totalTokens:c,contextTokens:u,costUsd:d})]})]})}function Qj(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 Zj({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}=kh(),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+Qj(f||"sonnet",j.inputTokens||0,j.outputTokens||0,p),0)}return o.jsx("div",{className:`flex flex-col h-full ${l||""}`,children:o.jsx(Gj,{cmdResult:e,onClearCmdResult:t,rpc:n,activeSessionId:a,onCreateSession:s,events:i,addLiveEvent:r,totalTokens:x,contextTokens:S,costUsd:w,onSwitchView:c})})}function Ij({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(Vu,{label:"Bot Token",value:(n==null?void 0:n.slice(0,12))+"..."||""}),o.jsx(Vu,{label:"User ID",value:a||""}),o.jsx(Vu,{label:"Chat ID",value:i||"not set"})]})]})]})}function Vu({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 Kj({rpc:e,className:t}){const{ws:n}=Cn(),[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[_,B]=await Promise.all([e.sessionStats(),e.sessionList()]);_&&a(_),Array.isArray(B)&&i(B)}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)},B=n.on("session-stop",_),G=n.on("session-start",_);return()=>{B(),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,E=45,M=15,A=15,C=25,H=Math.max(...w.map(_=>_.inputTokens+_.outputTokens),1),T=v-E-M,$=j-A-C,V=w.map((_,B)=>{const G=_.inputTokens+_.outputTokens,q=E+B/23*T,Q=A+$-G/H*$;return{x:q,y:Q,..._}}),N=V.length>0?`${V.map((_,B)=>`${B===0?"M":"L"} ${_.x} ${_.y}`).join(" ")} L ${V[V.length-1].x} ${A+$} L ${V[0].x} ${A+$} Z`:"",D=V.length>0?V.map((_,B)=>`${B===0?"M":"L"} ${_.x} ${_.y}`).join(" "):"",k=600,R=140,z=Math.max(...w.map(_=>Math.max(_.toolCalls,_.messages)),1),O=k-E-M,Y=R-A-C,X=O/24*.75,L=O/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(Tr,{label:"Today's Sessions",value:String(S.totalSessionsToday),subtitle:"conversations today"}),o.jsx(Tr,{label:"Operational Cost",value:`$${S.totalCost.toFixed(4)}`,subtitle:"estimated total",isGreen:!0}),o.jsx(Tr,{label:"Volume Consumed",value:m(S.totalTokens),subtitle:"total system tokens"}),o.jsx(Tr,{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((_,B)=>{const G=A+B/4*$,q=Math.round(H-B/4*H);return o.jsxs("g",{className:"opacity-25",children:[o.jsx("line",{x1:E,y1:G,x2:v-M,y2:G,stroke:"var(--b2)",strokeWidth:"0.75",strokeDasharray:"3 3"}),o.jsx("text",{x:E-8,y:G+3.5,textAnchor:"end",className:"fill-muted font-mono text-[9.5px]",children:m(q)})]},B)}),Array.from({length:7}).map((_,B)=>{const G=Math.round(B/6*23),q=E+G/23*T;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"]},B)}),N&&o.jsx("path",{d:N,fill:"url(#tokenGrad)"}),D&&o.jsx("path",{d:D,fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",strokeLinecap:"round"}),V.map((_,B)=>o.jsxs("g",{onMouseEnter:()=>d(B),onMouseLeave:()=>d(null),children:[o.jsx("rect",{x:_.x-T/48,y:A,width:T/24,height:$,fill:"transparent",className:"cursor-pointer"}),u===B&&o.jsxs(o.Fragment,{children:[o.jsx("line",{x1:_.x,y1:A,x2:_.x,y2:A+$,stroke:"var(--b2)",strokeWidth:"0.75"}),o.jsx("circle",{cx:_.x,cy:_.y,r:"4",fill:"var(--gold)",stroke:"var(--s1)",strokeWidth:"1.5"})]})]},B))]})})]}),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 ${k} ${R}`,preserveAspectRatio:"none",className:"overflow-visible",children:[Array.from({length:5}).map((_,B)=>{const G=A+B/4*Y,q=Math.round(z-B/4*z);return o.jsxs("g",{className:"opacity-25",children:[o.jsx("line",{x1:E,y1:G,x2:k-M,y2:G,stroke:"var(--b2)",strokeWidth:"0.75",strokeDasharray:"3 3"}),o.jsx("text",{x:E-8,y:G+3.5,textAnchor:"end",className:"fill-muted font-mono text-[9.5px]",children:q})]},B)}),Array.from({length:7}).map((_,B)=>{const G=Math.round(B/6*23),q=E+G/23*O;return o.jsxs("text",{x:q,y:R-6,textAnchor:"middle",className:"fill-muted font-mono text-[9.5px] opacity-60",children:[String(G).padStart(2,"0"),":00"]},B)}),w.map((_,B)=>{const G=E+B*(X+L),q=_.messages/z*Y,Q=_.toolCalls/z*Y,K=A+Y-q,W=K-Q;return o.jsxs("g",{onMouseEnter:()=>h(B),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:W,width:X,height:Q,fill:"var(--cream)",rx:"1",className:"transition-all duration-100 hover:opacity-80"}),o.jsx("rect",{x:G-L/2,y:A,width:X+L,height:Y,fill:"transparent"})]},B)})]})})]})]}),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(zr,{label:"Web UI Console",count:g.webui,percent:Math.round(g.webui/U*100),color:"var(--gold)"}),o.jsx(zr,{label:"CLI TUI Terminal",count:g.tui,percent:Math.round(g.tui/U*100),color:"var(--yellow)"}),o.jsx(zr,{label:"Telegram Bot",count:g.telegram,percent:Math.round(g.telegram/U*100),color:"var(--cream)"}),o.jsx(zr,{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((_,B)=>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"]})]},B))})]})})]})]}),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 Tr({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 zr({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 Wj({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(Jj,{project:r},r.cwd))]})}function Jj({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 Fj(){const{rpc:e,ws:t}=Cn(),[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 Pj({rpc:e,sessionId:t,className:n}){const{ws:l}=Cn(),{agents:a,running:s,completed:i,failed:r,spawn:c,cancel:u,send:d}=Fj(),[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,E]=b.useState(""),[M,A]=b.useState(""),[C,H]=b.useState(""),[T,$]=b.useState(""),[V,N]=b.useState(""),[D,k]=b.useState(""),[R,z]=b.useState(""),[O,Y]=b.useState("auto"),[X,L]=b.useState(""),[U,_]=b.useState(""),[B,G]=b.useState(""),[q,Q]=b.useState(null),[K,W]=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:M||void 0}),w(""),h(!1),E("")},[S,g,m,j,M,t,e,c]),J=b.useCallback(async()=>{if(!e||!C.trim()||!T||!V){L("Please fill in prompt and date/time");return}L("");const I=`${T}T${V}:00`;try{await e.taskSchedule({instruction:C.trim(),scheduled_at:I,provider:D||void 0,model:R||void 0,effort:O!=="auto"?O:void 0}),H(""),$(""),N(""),x(!1)}catch(se){L(se instanceof Error?se.message:"Failed to schedule task")}},[C,T,V,D,R,O,e]),F=b.useCallback(async()=>{!U||!B.trim()||(await d(U,B.trim()),G(""))},[U,B,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=>E(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:M,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:C,onChange:I=>H(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:T,onChange:I=>$(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:O,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:D,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 col-span-2 md:col-span-4",placeholder:"Model override (optional)",value:R,onChange:I=>z(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:J,disabled:!C.trim()||!T||!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(Dr,{label:"Running",value:String(s.length),color:"text-yellow"}),o.jsx(Dr,{label:"Completed",value:String(i.length),color:"text-green"}),o.jsx(Dr,{label:"Failed",value:String(r.length),color:"text-red"}),o.jsx(Dr,{label:"Total Tokens",value:af(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(e5,{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?af(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:()=>W(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:()=>W(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:B,onChange:I=>G(I.target.value),onKeyDown:I=>{I.key==="Enter"&&F()}}),o.jsx("button",{onClick:F,disabled:!U||!B.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(n5,{ws:l})]})}function Dr({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 e5({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:[t5(l)," · ",e.toolCalls," tools · ",af(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 t5(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m${t%60}s`}function af(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function n5({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 l5(){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 Rc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ms(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Hh(e){return"nodeType"in e}function ft(e){var t,n;return e?Ms(e)?e:Hh(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Lh(e){const{Document:t}=ft(e);return e instanceof t}function er(e){return Ms(e)?!1:e instanceof ft(e).HTMLElement}function Vv(e){return e instanceof ft(e).SVGElement}function _s(e){return e?Ms(e)?e.document:Hh(e)?Lh(e)?e:er(e)||Vv(e)?e.ownerDocument:document:document:document}const on=Rc?b.useLayoutEffect:b.useEffect;function Oc(e){const t=b.useRef(e);return on(()=>{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 a5(){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 Ai(e,t){t===void 0&&(t=[e]);const n=b.useRef(e);return on(()=>{n.current!==e&&(n.current=e)},t),n}function tr(e,t){const n=b.useRef();return b.useMemo(()=>{const l=e(n.current);return n.current=l,l},[...t])}function Wo(e){const t=Oc(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 Jo(e){const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}let Xu={};function nr(e,t){return b.useMemo(()=>{if(t)return t;const n=Xu[e]==null?0:Xu[e]+1;return Xu[e]=n,e+"-"+n},[e,t])}function Xv(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 Wa=Xv(1),Fo=Xv(-1);function s5(e){return"clientX"in e&&"clientY"in e}function Hc(e){if(!e)return!1;const{KeyboardEvent:t}=ft(e.target);return t&&e instanceof t}function i5(e){if(!e)return!1;const{TouchEvent:t}=ft(e.target);return t&&e instanceof t}function Po(e){if(i5(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 s5(e)?{x:e.clientX,y:e.clientY}:null}const Hl=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[Hl.Translate.toString(e),Hl.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:l}=e;return t+" "+n+"ms "+l}}}),am="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function r5(e){return e.matches(am)?e:e.querySelector(am)}const o5={display:"none"};function c5(e){let{id:t,value:n}=e;return Me.createElement("div",{id:t,style:o5},n)}function u5(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 Me.createElement("div",{id:t,style:a,role:"status","aria-live":l,"aria-atomic":!0},n)}function d5(){const[e,t]=b.useState("");return{announce:b.useCallback(l=>{l!=null&&t(l)},[]),announcement:e}}const Gv=b.createContext(null);function f5(e){const t=b.useContext(Gv);b.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function h5(){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 p5={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
- `},g5={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 m5(e){let{announcements:t=g5,container:n,hiddenTextDescribedById:l,screenReaderInstructions:a=p5}=e;const{announce:s,announcement:i}=d5(),r=nr("DndLiveRegion"),[c,u]=b.useState(!1);if(b.useEffect(()=>{u(!0)},[]),f5(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=Me.createElement(Me.Fragment,null,Me.createElement(c5,{id:l,value:a.draggable}),Me.createElement(u5,{id:r,announcement:i}));return n?Wl.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 ec(){}function sm(e,t){return b.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function x5(){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 cn=Object.freeze({x:0,y:0});function y5(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function v5(e,t){const n=Po(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 b5(e,t){let{data:{value:n}}=e,{data:{value:l}}=t;return n-l}function w5(e,t){let{data:{value:n}}=e,{data:{value:l}}=t;return l-n}function im(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 S5(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const N5=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:l}=e;const a=im(t),s=[];for(const i of l){const{id:r}=i,c=n.get(r);if(c){const u=im(c),d=a.reduce((h,p,x)=>h+y5(u[x],p),0),f=Number((d/4).toFixed(4));s.push({id:r,data:{droppableContainer:i,value:f}})}}return s.sort(b5)};function j5(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 k5=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=j5(r,t);c>0&&a.push({id:i,data:{droppableContainer:s,value:c}})}}return a.sort(w5)};function E5(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Qv(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:cn}function C5(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 M5=C5(1);function Zv(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 _5(e,t,n){const l=Zv(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 A5={ignoreTransform:!1};function As(e,t){t===void 0&&(t=A5);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=ft(e).getComputedStyle(e);u&&(n=_5(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 rm(e){return As(e,{ignoreTransform:!0})}function T5(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function z5(e,t){return t===void 0&&(t=ft(e).getComputedStyle(e)),t.position==="fixed"}function D5(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 $h(e,t){const n=[];function l(a){if(t!=null&&n.length>=t||!a)return n;if(Lh(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!er(a)||Vv(a)||n.includes(a))return n;const s=ft(e).getComputedStyle(a);return a!==e&&D5(a,s)&&n.push(a),z5(a,s)?n:l(a.parentNode)}return e?l(e):n}function Iv(e){const[t]=$h(e,1);return t??null}function Gu(e){return!Rc||!e?null:Ms(e)?e:Hh(e)?Lh(e)||e===_s(e).scrollingElement?window:er(e)?e:null:null}function Kv(e){return Ms(e)?e.scrollX:e.scrollLeft}function Wv(e){return Ms(e)?e.scrollY:e.scrollTop}function sf(e){return{x:Kv(e),y:Wv(e)}}var We;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(We||(We={}));function Jv(e){return!Rc||!e?!1:e===document.scrollingElement}function Fv(e){const t={x:0,y:0},n=Jv(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 R5={x:.2,y:.2};function O5(e,t,n,l,a){let{top:s,left:i,right:r,bottom:c}=n;l===void 0&&(l=10),a===void 0&&(a=R5);const{isTop:u,isBottom:d,isLeft:f,isRight:h}=Fv(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=We.Backward,x.y=l*Math.abs((t.top+S.height-s)/S.height)):!d&&c>=t.bottom-S.height&&(p.y=We.Forward,x.y=l*Math.abs((t.bottom-S.height-c)/S.height)),!h&&r>=t.right-S.width?(p.x=We.Forward,x.x=l*Math.abs((t.right-S.width-r)/S.width)):!f&&i<=t.left+S.width&&(p.x=We.Backward,x.x=l*Math.abs((t.left+S.width-i)/S.width)),{direction:p,speed:x}}function H5(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 Pv(e){return e.reduce((t,n)=>Wa(t,sf(n)),cn)}function L5(e){return e.reduce((t,n)=>t+Kv(n),0)}function $5(e){return e.reduce((t,n)=>t+Wv(n),0)}function e1(e,t){if(t===void 0&&(t=As),!e)return;const{top:n,left:l,bottom:a,right:s}=t(e);Iv(e)&&(a<=0||s<=0||n>=window.innerHeight||l>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const B5=[["x",["left","right"],L5],["y",["top","bottom"],$5]];class Bh{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=$h(n),a=Pv(l);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,r]of B5)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 di{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 U5(e){const{EventTarget:t}=ft(e);return e instanceof t?e:_s(e)}function Qu(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 qt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(qt||(qt={}));function om(e){e.preventDefault()}function q5(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 t1={start:[me.Space,me.Enter],cancel:[me.Esc],end:[me.Space,me.Enter,me.Tab]},Y5=(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 Uh{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 di(_s(n)),this.windowListeners=new di(ft(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(qt.Resize,this.handleCancel),this.windowListeners.add(qt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(qt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,l=t.node.current;l&&e1(l),n(cn)}handleKeyDown(t){if(Hc(t)){const{active:n,context:l,options:a}=this.props,{keyboardCodes:s=t1,coordinateGetter:i=Y5,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}:cn;this.referenceCoordinates||(this.referenceCoordinates=d);const f=i(t,{active:n,context:l.current,currentCoordinates:d});if(f){const h=Fo(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:E}=Fv(S),M=H5(S),A={x:Math.min(w===me.Right?M.right-M.width/2:M.right,Math.max(w===me.Right?M.left:M.left+M.width/2,f.x)),y:Math.min(w===me.Down?M.bottom-M.height/2:M.bottom,Math.max(w===me.Down?M.top:M.top+M.height/2,f.y))},C=w===me.Right&&!y||w===me.Left&&!m,H=w===me.Down&&!v||w===me.Up&&!g;if(C&&A.x!==f.x){const T=S.scrollLeft+h.x,$=w===me.Right&&T<=j.x||w===me.Left&&T>=E.x;if($&&!h.y){S.scrollTo({left:T,behavior:r});return}$?p.x=S.scrollLeft-T:p.x=w===me.Right?S.scrollLeft-j.x:S.scrollLeft-E.x,p.x&&S.scrollBy({left:-p.x,behavior:r});break}else if(H&&A.y!==f.y){const T=S.scrollTop+h.y,$=w===me.Down&&T<=j.y||w===me.Up&&T>=E.y;if($&&!h.x){S.scrollTo({top:T,behavior:r});return}$?p.y=S.scrollTop-T:p.y=w===me.Down?S.scrollTop-j.y:S.scrollTop-E.y,p.y&&S.scrollBy({top:-p.y,behavior:r});break}}this.handleMove(t,Wa(Fo(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()}}Uh.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:l=t1,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 cm(e){return!!(e&&"distance"in e)}function um(e){return!!(e&&"delay"in e)}class qh{constructor(t,n,l){var a;l===void 0&&(l=U5(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=_s(i),this.documentListeners=new di(this.document),this.listeners=new di(l),this.windowListeners=new di(ft(i)),this.initialCoordinates=(a=Po(s))!=null?a:cn,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(qt.Resize,this.handleCancel),this.windowListeners.add(qt.DragStart,om),this.windowListeners.add(qt.VisibilityChange,this.handleCancel),this.windowListeners.add(qt.ContextMenu,om),this.documentListeners.add(qt.Keydown,this.handleKeydown),n){if(l!=null&&l({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(um(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(cm(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(qt.Click,q5,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(qt.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=Po(t))!=null?n:cn,u=Fo(a,c);if(!l&&r){if(cm(r)){if(r.tolerance!=null&&Qu(u,r.tolerance))return this.handleCancel();if(Qu(u,r.distance))return this.handleStart()}if(um(r)&&Qu(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 V5={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Yh extends qh{constructor(t){const{event:n}=t,l=_s(n.target);super(t,V5,l)}}Yh.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 X5={move:{name:"mousemove"},end:{name:"mouseup"}};var rf;(function(e){e[e.RightClick=2]="RightClick"})(rf||(rf={}));class G5 extends qh{constructor(t){super(t,X5,_s(t.event.target))}}G5.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:l}=t;return n.button===rf.RightClick?!1:(l==null||l({event:n}),!0)}}];const Zu={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Q5 extends qh{constructor(t){super(t,Zu)}static setup(){return window.addEventListener(Zu.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Zu.move.name,t)};function t(){}}}Q5.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 fi;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(fi||(fi={}));var tc;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(tc||(tc={}));function Z5(e){let{acceleration:t,activator:n=fi.Pointer,canScroll:l,draggingRect:a,enabled:s,interval:i=5,order:r=tc.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:h}=e;const p=K5({delta:f,disabled:!s}),[x,S]=a5(),w=b.useRef({x:0,y:0}),g=b.useRef({x:0,y:0}),y=b.useMemo(()=>{switch(n){case fi.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case fi.DraggableRect:return a}},[n,a,c]),m=b.useRef(null),v=b.useCallback(()=>{const E=m.current;if(!E)return;const M=w.current.x*g.current.x,A=w.current.y*g.current.y;E.scrollBy(M,A)},[]),j=b.useMemo(()=>r===tc.TreeOrder?[...u].reverse():u,[r,u]);b.useEffect(()=>{if(!s||!u.length||!y){S();return}for(const E of j){if((l==null?void 0:l(E))===!1)continue;const M=u.indexOf(E),A=d[M];if(!A)continue;const{direction:C,speed:H}=O5(E,A,y,t,h);for(const T of["x","y"])p[T][C[T]]||(H[T]=0,C[T]=0);if(H.x>0||H.y>0){S(),m.current=E,x(v,i),w.current=H,g.current=C;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 I5={x:{[We.Backward]:!1,[We.Forward]:!1},y:{[We.Backward]:!1,[We.Forward]:!1}};function K5(e){let{delta:t,disabled:n}=e;const l=Jo(t);return tr(a=>{if(n||!l||!a)return I5;const s={x:Math.sign(t.x-l.x),y:Math.sign(t.y-l.y)};return{x:{[We.Backward]:a.x[We.Backward]||s.x===-1,[We.Forward]:a.x[We.Forward]||s.x===1},y:{[We.Backward]:a.y[We.Backward]||s.y===-1,[We.Forward]:a.y[We.Forward]||s.y===1}}},[n,t,l])}function W5(e,t){const n=t!=null?e.get(t):void 0,l=n?n.node.current:null;return tr(a=>{var s;return t==null?null:(s=l??a)!=null?s:null},[l,t])}function J5(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 Ti;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ti||(Ti={}));var of;(function(e){e.Optimized="optimized"})(of||(of={}));const dm=new Map;function F5(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=Ai(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=tr(g=>{if(f&&!n)return dm;if(!g||g===dm||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 Bh(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 Ti.Always:return!1;case Ti.BeforeDragging:return n;default:return!n}}}function Vh(e,t){return tr(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function P5(e,t){return Vh(e,t)}function ek(e){let{callback:t,disabled:n}=e;const l=Oc(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 Lc(e){let{callback:t,disabled:n}=e;const l=Oc(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 tk(e){return new Bh(As(e),e)}function fm(e,t,n){t===void 0&&(t=tk);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=ek({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=Lc({callback:s});return on(()=>{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 nk(e){const t=Vh(e);return Qv(e,t)}const hm=[];function lk(e){const t=b.useRef(e),n=tr(l=>e?l&&l!==hm&&e&&t.current&&e.parentNode===t.current.parentNode?l:$h(e):hm,[e]);return b.useEffect(()=>{t.current=e},[e]),n}function ak(e){const[t,n]=b.useState(null),l=b.useRef(e),a=b.useCallback(s=>{const i=Gu(s.target);i&&n(r=>r?(r.set(i,sf(i)),new Map(r)):null)},[]);return b.useEffect(()=>{const s=l.current;if(e!==s){i(s);const r=e.map(c=>{const u=Gu(c);return u?(u.addEventListener("scroll",a,{passive:!0}),[u,sf(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=Gu(c);u==null||u.removeEventListener("scroll",a)})}},[a,e]),b.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>Wa(s,i),cn):Pv(e):cn,[e,t])}function pm(e,t){t===void 0&&(t=[]);const n=b.useRef(null);return b.useEffect(()=>{n.current=null},t),b.useEffect(()=>{const l=e!==cn;l&&!n.current&&(n.current=e),!l&&n.current&&(n.current=null)},[e]),n.current?Fo(e,n.current):cn}function sk(e){b.useEffect(()=>{if(!Rc)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 ik(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 n1(e){return b.useMemo(()=>e?T5(e):null,[e])}const gm=[];function rk(e,t){t===void 0&&(t=As);const[n]=e,l=n1(n?ft(n):null),[a,s]=b.useState(gm);function i(){s(()=>e.length?e.map(c=>Jv(c)?l:new Bh(t(c),c)):gm)}const r=Lc({callback:i});return on(()=>{r==null||r.disconnect(),i(),e.forEach(c=>r==null?void 0:r.observe(c))},[e]),a}function l1(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return er(t)?t:e}function ok(e){let{measure:t}=e;const[n,l]=b.useState(null),a=b.useCallback(u=>{for(const{target:d}of u)if(er(d)){l(f=>{const h=t(d);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),s=Lc({callback:a}),i=b.useCallback(u=>{const d=l1(u);s==null||s.disconnect(),d&&(s==null||s.observe(d)),l(d?t(d):null)},[t,s]),[r,c]=Wo(i);return b.useMemo(()=>({nodeRef:r,rect:n,setRef:c}),[n,r,c])}const ck=[{sensor:Yh,options:{}},{sensor:Uh,options:{}}],uk={current:{}},oo={draggable:{measure:rm},droppable:{measure:rm,strategy:Ti.WhileDragging,frequency:of.Optimized},dragOverlay:{measure:As}};class hi 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 dk={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new hi,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ec},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:oo,measureDroppableContainers:ec,windowRect:null,measuringScheduled:!1},a1={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ec,draggableNodes:new Map,over:null,measureDroppableContainers:ec},lr=b.createContext(a1),s1=b.createContext(dk);function fk(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new hi}}}function hk(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 hi(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 hi(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 hi(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function pk(e){let{disabled:t}=e;const{active:n,activatorEvent:l,draggableNodes:a}=b.useContext(lr),s=Jo(l),i=Jo(n==null?void 0:n.id);return b.useEffect(()=>{if(!t&&!l&&s&&i!=null){if(!Hc(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=r5(d);if(f){f.focus();break}}})}},[l,t,a,i,s]),null}function i1(e,t){let{transform:n,...l}=t;return e!=null&&e.length?e.reduce((a,s)=>s({transform:a,...l}),n):n}function gk(e){return b.useMemo(()=>({draggable:{...oo.draggable,...e==null?void 0:e.draggable},droppable:{...oo.droppable,...e==null?void 0:e.droppable},dragOverlay:{...oo.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 mk(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;on(()=>{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=Qv(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=Iv(u);h&&h.scrollBy({top:f.y,left:f.x})}},[t,i,r,l,n])}const $c=b.createContext({...cn,scaleX:1,scaleY:1});var fl;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(fl||(fl={}));const xk=b.memo(function(t){var n,l,a,s;let{id:i,accessibility:r,autoScroll:c=!0,children:u,sensors:d=ck,collisionDetection:f=k5,measuring:h,modifiers:p,...x}=t;const S=b.useReducer(hk,void 0,fk),[w,g]=S,[y,m]=h5(),[v,j]=b.useState(fl.Uninitialized),E=v===fl.Initialized,{draggable:{active:M,nodes:A,translate:C},droppable:{containers:H}}=w,T=M!=null?A.get(M):null,$=b.useRef({initial:null,translated:null}),V=b.useMemo(()=>{var Ie;return M!=null?{id:M,data:(Ie=T==null?void 0:T.data)!=null?Ie:uk,rect:$}:null},[M,T]),N=b.useRef(null),[D,k]=b.useState(null),[R,z]=b.useState(null),O=Ai(x,Object.values(x)),Y=nr("DndDescribedBy",i),X=b.useMemo(()=>H.getEnabled(),[H]),L=gk(h),{droppableRects:U,measureDroppableContainers:_,measuringScheduled:B}=F5(X,{dragging:E,dependencies:[C.x,C.y],config:L.droppable}),G=W5(A,M),q=b.useMemo(()=>R?Po(R):null,[R]),Q=lu(),K=P5(G,L.draggable.measure);mk({activeNode:M!=null?A.get(M):null,config:Q.layoutShiftCompensation,initialRect:K,measure:L.draggable.measure});const W=fm(G,L.draggable.measure,K),P=fm(G?G.parentElement:null),J=b.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:H,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),F=H.getNodeFor((n=J.current.over)==null?void 0:n.id),le=ok({measure:L.dragOverlay.measure}),ae=(l=le.nodeRef.current)!=null?l:G,te=E?(a=le.rect)!=null?a:W:null,ge=!!(le.nodeRef.current&&le.rect),I=nk(ge?null:W),se=n1(ae?ft(ae):null),Re=lk(E?F??G:null),st=rk(Re),Nt=i1(p,{transform:{x:C.x-I.x,y:C.y-I.y,scaleX:1,scaleY:1},activatorEvent:R,active:V,activeNodeRect:W,containerNodeRect:P,draggingNodeRect:te,over:J.current.over,overlayNodeRect:le.rect,scrollableAncestors:Re,scrollableAncestorRects:st,windowRect:se}),Ht=q?Wa(q,C):null,ll=ak(Re),_n=pm(ll),Jt=pm(ll,[W]),Lt=Wa(Nt,_n),An=te?M5(te,Nt):null,Bl=V&&An?f({active:V,collisionRect:An,droppableRects:U,droppableContainers:X,pointerCoordinates:Ht}):null,wa=S5(Bl,"id"),[fn,ur]=b.useState(null),Fc=ge?Nt:Wa(Nt,Jt),Pc=E5(Fc,(s=fn==null?void 0:fn.rect)!=null?s:null,W),Ts=b.useRef(null),dr=b.useCallback((Ie,it)=>{let{sensor:rt,options:hn}=it;if(N.current==null)return;const ht=A.get(N.current);if(!ht)return;const ot=Ie.nativeEvent,$t=new rt({active:N.current,activeNode:ht,event:ot,options:hn,context:J,onAbort(Xe){if(!A.get(Xe))return;const{onDragAbort:Bt}=O.current,Ft={id:Xe};Bt==null||Bt(Ft),y({type:"onDragAbort",event:Ft})},onPending(Xe,pn,Bt,Ft){if(!A.get(Xe))return;const{onDragPending:ql}=O.current,gn={id:Xe,constraint:pn,initialCoordinates:Bt,offset:Ft};ql==null||ql(gn),y({type:"onDragPending",event:gn})},onStart(Xe){const pn=N.current;if(pn==null)return;const Bt=A.get(pn);if(!Bt)return;const{onDragStart:Ft}=O.current,Ul={activatorEvent:ot,active:{id:pn,data:Bt.data,rect:$}};Wl.unstable_batchedUpdates(()=>{Ft==null||Ft(Ul),j(fl.Initializing),g({type:Ge.DragStart,initialCoordinates:Xe,active:pn}),y({type:"onDragStart",event:Ul}),k(Ts.current),z(ot)})},onMove(Xe){g({type:Ge.DragMove,coordinates:Xe})},onEnd:al(Ge.DragEnd),onCancel:al(Ge.DragCancel)});Ts.current=$t;function al(Xe){return async function(){const{active:Bt,collisions:Ft,over:Ul,scrollAdjustedTranslate:ql}=J.current;let gn=null;if(Bt&&ql){const{cancelDrop:Yl}=O.current;gn={activatorEvent:ot,active:Bt,collisions:Ft,delta:ql,over:Ul},Xe===Ge.DragEnd&&typeof Yl=="function"&&await Promise.resolve(Yl(gn))&&(Xe=Ge.DragCancel)}N.current=null,Wl.unstable_batchedUpdates(()=>{g({type:Xe}),j(fl.Uninitialized),ur(null),k(null),z(null),Ts.current=null;const Yl=Xe===Ge.DragEnd?"onDragEnd":"onDragCancel";if(gn){const zs=O.current[Yl];zs==null||zs(gn),y({type:Yl,event:gn})}})}}},[A]),eu=b.useCallback((Ie,it)=>(rt,hn)=>{const ht=rt.nativeEvent,ot=A.get(hn);if(N.current!==null||!ot||ht.dndKit||ht.defaultPrevented)return;const $t={active:ot};Ie(rt,it.options,$t)===!0&&(ht.dndKit={capturedBy:it.sensor},N.current=hn,dr(rt,it))},[A,dr]),fr=J5(d,eu);sk(d),on(()=>{W&&v===fl.Initializing&&j(fl.Initialized)},[W,v]),b.useEffect(()=>{const{onDragMove:Ie}=O.current,{active:it,activatorEvent:rt,collisions:hn,over:ht}=J.current;if(!it||!rt)return;const ot={active:it,activatorEvent:rt,collisions:hn,delta:{x:Lt.x,y:Lt.y},over:ht};Wl.unstable_batchedUpdates(()=>{Ie==null||Ie(ot),y({type:"onDragMove",event:ot})})},[Lt.x,Lt.y]),b.useEffect(()=>{const{active:Ie,activatorEvent:it,collisions:rt,droppableContainers:hn,scrollAdjustedTranslate:ht}=J.current;if(!Ie||N.current==null||!it||!ht)return;const{onDragOver:ot}=O.current,$t=hn.get(wa),al=$t&&$t.rect.current?{id:$t.id,rect:$t.rect.current,data:$t.data,disabled:$t.disabled}:null,Xe={active:Ie,activatorEvent:it,collisions:rt,delta:{x:ht.x,y:ht.y},over:al};Wl.unstable_batchedUpdates(()=>{ur(al),ot==null||ot(Xe),y({type:"onDragOver",event:Xe})})},[wa]),on(()=>{J.current={activatorEvent:R,active:V,activeNode:G,collisionRect:An,collisions:Bl,droppableRects:U,draggableNodes:A,draggingNode:ae,draggingNodeRect:te,droppableContainers:H,over:fn,scrollableAncestors:Re,scrollAdjustedTranslate:Lt},$.current={initial:te,translated:An}},[V,G,Bl,An,A,ae,te,U,H,fn,Re,Lt]),Z5({...Q,delta:C,draggingRect:An,pointerCoordinates:Ht,scrollableAncestors:Re,scrollableAncestorRects:st});const tu=b.useMemo(()=>({active:V,activeNode:G,activeNodeRect:W,activatorEvent:R,collisions:Bl,containerNodeRect:P,dragOverlay:le,draggableNodes:A,droppableContainers:H,droppableRects:U,over:fn,measureDroppableContainers:_,scrollableAncestors:Re,scrollableAncestorRects:st,measuringConfiguration:L,measuringScheduled:B,windowRect:se}),[V,G,W,R,Bl,P,le,A,H,U,fn,_,Re,st,L,B,se]),nu=b.useMemo(()=>({activatorEvent:R,activators:fr,active:V,activeNodeRect:W,ariaDescribedById:{draggable:Y},dispatch:g,draggableNodes:A,over:fn,measureDroppableContainers:_}),[R,fr,V,W,g,Y,A,fn,_]);return Me.createElement(Gv.Provider,{value:m},Me.createElement(lr.Provider,{value:nu},Me.createElement(s1.Provider,{value:tu},Me.createElement($c.Provider,{value:Pc},u)),Me.createElement(pk,{disabled:(r==null?void 0:r.restoreFocus)===!1})),Me.createElement(m5,{...r,hiddenTextDescribedById:Y}));function lu(){const Ie=(D==null?void 0:D.autoScrollEnabled)===!1,it=typeof c=="object"?c.enabled===!1:c===!1,rt=E&&!Ie&&!it;return typeof c=="object"?{...c,enabled:rt}:{enabled:rt}}}),yk=b.createContext(null),mm="button",vk="Draggable";function bk(e){let{id:t,data:n,disabled:l=!1,attributes:a}=e;const s=nr(vk),{activators:i,activatorEvent:r,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:h}=b.useContext(lr),{role:p=mm,roleDescription:x="draggable",tabIndex:S=0}=a??{},w=(c==null?void 0:c.id)===t,g=b.useContext(w?$c:yk),[y,m]=Wo(),[v,j]=Wo(),E=ik(i,t),M=Ai(n);on(()=>(f.set(t,{id:t,key:s,node:y,activatorNode:v,data:M}),()=>{const C=f.get(t);C&&C.key===s&&f.delete(t)}),[f,t]);const A=b.useMemo(()=>({role:p,tabIndex:S,"aria-disabled":l,"aria-pressed":w&&p===mm?!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:E,node:y,over:h,setNodeRef:m,setActivatorNodeRef:j,transform:g}}function r1(){return b.useContext(s1)}const wk="Droppable",Sk={timeout:25};function o1(e){let{data:t,disabled:n=!1,id:l,resizeObserverConfig:a}=e;const s=nr(wk),{active:i,dispatch:r,over:c,measureDroppableContainers:u}=b.useContext(lr),d=b.useRef({disabled:n}),f=b.useRef(!1),h=b.useRef(null),p=b.useRef(null),{disabled:x,updateMeasurementsFor:S,timeout:w}={...Sk,...a},g=Ai(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=Lc({callback:y,disabled:x||!i}),v=b.useCallback((A,C)=>{m&&(C&&(m.unobserve(C),f.current=!1),A&&m.observe(A))},[m]),[j,E]=Wo(v),M=Ai(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:M}}),()=>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:E}}function Nk(e){let{animation:t,children:n}=e;const[l,a]=b.useState(null),[s,i]=b.useState(null),r=Jo(n);return!n&&!l&&r&&a(r),on(()=>{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]),Me.createElement(Me.Fragment,null,n,l?b.cloneElement(l,{ref:i}):null)}const jk={x:0,y:0,scaleX:1,scaleY:1};function kk(e){let{children:t}=e;return Me.createElement(lr.Provider,{value:a1},Me.createElement($c.Provider,{value:jk},t))}const Ek={position:"fixed",touchAction:"none"},Ck=e=>Hc(e)?"transform 250ms ease":void 0,Mk=b.forwardRef((e,t)=>{let{as:n,activatorEvent:l,adjustScale:a,children:s,className:i,rect:r,style:c,transform:u,transition:d=Ck}=e;if(!r)return null;const f=a?u:{...u,scaleX:1,scaleY:1},h={...Ek,width:r.width,height:r.height,top:r.top,left:r.left,transform:Hl.Transform.toString(f),transformOrigin:a&&l?v5(l,r):void 0,transition:typeof d=="function"?d(l):d,...c};return Me.createElement(n,{className:i,style:h,ref:t},s)}),_k=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)}},Ak=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Hl.Transform.toString(t)},{transform:Hl.Transform.toString(n)}]},Tk={duration:250,easing:"ease",keyframes:Ak,sideEffects:_k({styles:{active:{opacity:"0"}}})};function zk(e){let{config:t,draggableNodes:n,droppableContainers:l,measuringConfiguration:a}=e;return Oc((s,i)=>{if(t===null)return;const r=n.get(s);if(!r)return;const c=r.node.current;if(!c)return;const u=l1(i);if(!u)return;const{transform:d}=ft(i).getComputedStyle(i),f=Zv(d);if(!f)return;const h=typeof t=="function"?t:Dk(t);return e1(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 Dk(e){const{duration:t,easing:n,sideEffects:l,keyframes:a}={...Tk,...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 xm=0;function Rk(e){return b.useMemo(()=>{if(e!=null)return xm++,xm},[e])}const Ok=Me.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}=r1(),E=b.useContext($c),M=Rk(f==null?void 0:f.id),A=i1(i,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:w.rect,over:g,overlayNodeRect:w.rect,scrollableAncestors:m,scrollableAncestorRects:v,transform:E,windowRect:j}),C=Vh(h),H=zk({config:l,draggableNodes:x,droppableContainers:S,measuringConfiguration:y}),T=C?w.setRef:void 0;return Me.createElement(kk,null,Me.createElement(Nk,{animation:H},f&&M?Me.createElement(Mk,{key:M,id:f.id,ref:T,as:r,activatorEvent:d,adjustScale:t,className:c,transition:s,rect:C,style:{zIndex:u,...a},transform:A},n):null))});function c1(e,t,n){const l=e.slice();return l.splice(n<0?l.length+n:n,0,l.splice(t,1)[0]),l}function Hk(e,t){return e.reduce((n,l,a)=>{const s=t.get(l);return s&&(n[a]=s),n},Array(e.length))}function Rr(e){return e!==null&&e>=0}function Lk(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 $k(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const u1=e=>{let{rects:t,activeIndex:n,overIndex:l,index:a}=e;const s=c1(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}},Or={scaleX:1,scaleY:1},Bk=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,...Or}:null}const c=Uk(s,a,n);return a>n&&a<=i?{x:0,y:-r.height-c,...Or}:a<n&&a>=i?{x:0,y:r.height+c,...Or}:{x:0,y:0,...Or}};function Uk(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 d1="Sortable",f1=Me.createContext({activeIndex:-1,containerId:d1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:u1,disabled:{draggable:!1,droppable:!1}});function qk(e){let{children:t,id:n,items:l,strategy:a=u1,disabled:s=!1}=e;const{active:i,dragOverlay:r,droppableRects:c,over:u,measureDroppableContainers:d}=r1(),f=nr(d1,n),h=r.rect!==null,p=b.useMemo(()=>l.map(E=>typeof E=="object"&&"id"in E?E.id:E),[l]),x=i!=null,S=i?p.indexOf(i.id):-1,w=u?p.indexOf(u.id):-1,g=b.useRef(p),y=!Lk(p,g.current),m=w!==-1&&S===-1||y,v=$k(s);on(()=>{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:Hk(p,c),strategy:a}),[S,f,v.draggable,v.droppable,m,p,w,c,h,a]);return Me.createElement(f1.Provider,{value:j},t)}const Yk=e=>{let{id:t,items:n,activeIndex:l,overIndex:a}=e;return c1(n,l,a).indexOf(t)},Vk=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},Xk={duration:200,easing:"ease"},h1="transform",Gk=Hl.Transition.toString({property:h1,duration:0,easing:"linear"}),Qk={roleDescription:"sortable"};function Zk(e){let{disabled:t,index:n,node:l,rect:a}=e;const[s,i]=b.useState(null),r=b.useRef(n);return on(()=>{if(!t&&n!==r.current&&l.current){const c=a.current;if(c){const u=As(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 Ik(e){let{animateLayoutChanges:t=Vk,attributes:n,disabled:l,data:a,getNewIndex:s=Yk,id:i,strategy:r,resizeObserverConfig:c,transition:u=Xk}=e;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:x,sortedRects:S,overIndex:w,useDragOverlay:g,strategy:y}=b.useContext(f1),m=Kk(l,p),v=d.indexOf(i),j=b.useMemo(()=>({sortable:{containerId:f,index:v,items:d},...a}),[f,a,v,d]),E=b.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:M,node:A,isOver:C,setNodeRef:H}=o1({id:i,data:j,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...c}}),{active:T,activatorEvent:$,activeNodeRect:V,attributes:N,setNodeRef:D,listeners:k,isDragging:R,over:z,setActivatorNodeRef:O,transform:Y}=bk({id:i,data:j,attributes:{...Qk,...n},disabled:m.draggable}),X=l5(H,D),L=!!T,U=L&&!x&&Rr(h)&&Rr(w),_=!g&&R,B=_&&U?Y:null,q=U?B??(r??y)({rects:S,activeNodeRect:V,activeIndex:h,overIndex:w,index:v}):null,Q=Rr(h)&&Rr(w)?s({id:i,items:d,activeIndex:h,overIndex:w}):v,K=T==null?void 0:T.id,W=b.useRef({activeId:K,items:d,newIndex:Q,containerId:f}),P=d!==W.current.items,J=t({active:T,containerId:f,isDragging:R,isSorting:L,id:i,index:v,items:d,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:u,wasDragging:W.current.activeId!=null}),F=Zk({disabled:!J,index:v,node:A,rect:M});return b.useEffect(()=>{L&&W.current.newIndex!==Q&&(W.current.newIndex=Q),f!==W.current.containerId&&(W.current.containerId=f),d!==W.current.items&&(W.current.items=d)},[L,Q,f,d]),b.useEffect(()=>{if(K===W.current.activeId)return;if(K!=null&&W.current.activeId==null){W.current.activeId=K;return}const ae=setTimeout(()=>{W.current.activeId=K},50);return()=>clearTimeout(ae)},[K]),{active:T,activeIndex:h,attributes:N,data:j,rect:M,index:v,newIndex:Q,items:d,isOver:C,isSorting:L,isDragging:R,listeners:k,node:A,overIndex:w,over:z,setNodeRef:X,setActivatorNodeRef:O,setDroppableNodeRef:H,setDraggableNodeRef:D,transform:F??q,transition:le()};function le(){if(F||P&&W.current.newIndex===v)return Gk;if(!(_&&!Hc($)||!u)&&(L||J))return Hl.Transition.toString({...u,property:h1})}}function Kk(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 Xh=[{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"}],ym=new Map(Xh.map(e=>[e.id,e]));function co(e){for(const t of Xh)if(t.statuses.includes(e))return t.id;return null}function Wk(e){const t=new Map;for(const n of e){const l=co(n.status);l&&t.set(n.id,l)}return t}const vm=["canceled","failed"],Jk={critical:"var(--red)",high:"var(--yellow)",medium:"var(--muted)",low:"var(--green)"},Gh={human:"H",agent:"A",notify:"N"};function Fk({task:e}){const t=Jk[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:["[",Gh[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 Pk({task:e,onEdit:t,onRemove:n}){const{attributes:l,listeners:a,setNodeRef:s,transform:i,isDragging:r}=Ik({id:e.id,animateLayoutChanges:()=>!1}),c={transform:Hl.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:["[",Gh[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 e3({column:e,tasks:t,isDragging:n,onEdit:l,onRemove:a,className:s=""}){const{setNodeRef:i,isOver:r}=o1({id:e.id}),c=function(u){return o.jsx(Pk,{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 bm({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 t3({rpc:e,className:t}){const{ws:n}=Cn(),[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),[E,M]=b.useState({top:0,left:0}),[A,C]=b.useState(null),H=b.useCallback(async()=>{if(e)try{const _={};p!=="all"&&(_.mode=p),S!=="all"&&(_.priority=S),g!=="all"&&(_.scope=g);const B=await e.todoList(Object.keys(_).length?_:void 0);a(Array.isArray(B)?B:[])}catch(_){console.error("[Kanban] Failed to fetch tasks:",_)}finally{i(!1)}},[e,p,S,g]);b.useEffect(()=>{H()},[H]),b.useEffect(()=>{if(!n)return;const _=()=>H(),B=n.on("todo-changed",_),G=n.on("cron-task-fired",_);return()=>{B(),G()}},[n,H]),b.useEffect(()=>{if(!m)return;const _=B=>{B.target.closest("[data-filter-dropdown]")||v(!1)};return document.addEventListener("click",_),()=>document.removeEventListener("click",_)},[m]);const T=b.useMemo(()=>{const _={backlog:[],todo:[],in_progress:[],done:[]};for(const B of l){if(B.mode==="notify")continue;const G=co(B.status);G&&_[G]&&_[G].push(B)}return Object.values(_).forEach(B=>B.sort((G,q)=>G.order-q.order)),_},[l]),$=b.useMemo(()=>l.filter(_=>vm.includes(_.status)),[l]),V=b.useMemo(()=>Wk(l),[l]),N=b.useMemo(()=>{const _={backlog:[],todo:[],in_progress:[],done:[]};for(const B of l){if(B.mode==="notify")continue;const G=co(B.status);G&&!vm.includes(B.status)&&_[G].push(B.id)}return _},[l]),D=x5(sm(Yh,{activationConstraint:{delay:250,tolerance:5}}),sm(Uh)),[k,R]=b.useState(!1),z=b.useCallback(_=>{R(!0),C(String(_.active.id))},[]),O=b.useCallback(()=>{R(!1),C(null)},[]),Y=b.useCallback(async _=>{const{active:B,over:G}=_;if(!G||!e){R(!1),C(null);return}const q=String(B.id),Q=String(G.id),K=l.find(ae=>ae.id===q);if(!K){R(!1),C(null);return}if(!V.get(q)){R(!1),C(null);return}let P=K.status;const J=ym.get(Q);if(J)P=J.defaultStatus;else{const ae=l.find(te=>te.id===Q);if(ae){const te=co(ae.status);te&&(P=ym.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{}C(null),R(!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]),L=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(),B=200;let G=_.left;G+B>window.innerWidth-8&&(G=window.innerWidth-B-8),M({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&&Wl.createPortal(o.jsxs("div",{"data-filter-dropdown":!0,className:"fixed rounded-xl shadow-2xl p-3 space-y-2.5 w-[200px]",style:{top:E.top,left:E.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 ",$.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(xk,{sensors:D,collisionDetection:N5,onDragStart:z,onDragCancel:O,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:Xh.map(_=>o.jsx(qk,{items:N[_.id],strategy:Bk,children:o.jsx(e3,{column:_,tasks:T[_.id],isDragging:k,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(Ok,{children:A&&o.jsx(Fk,{task:l.find(_=>_.id===A)})})]}),u&&$.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:$.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:["[",Gh[_.mode],"]"]})]},_.id))})]}),f&&o.jsx(bm,{task:null,onSave:X,onClose:()=>h(!1)}),r&&o.jsx(bm,{task:r,onSave:L,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 n3={value:()=>{}};function Bc(){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 uo(n)}function uo(e){this._=e}function l3(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}})}uo.prototype=Bc.prototype={constructor:uo,on:function(e,t){var n=this._,l=l3(e+"",n),a,s=-1,i=l.length;if(arguments.length<2){for(;++s<i;)if((a=(e=l[s]).type)&&(a=a3(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]=wm(n[a],e.name,t);else if(t==null)for(a in n)n[a]=wm(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 uo(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 a3(e,t){for(var n=0,l=e.length,a;n<l;++n)if((a=e[n]).name===t)return a.value}function wm(e,t,n){for(var l=0,a=e.length;l<a;++l)if(e[l].name===t){e[l]=n3,e=e.slice(0,l).concat(e.slice(l+1));break}return n!=null&&e.push({name:t,value:n}),e}var cf="http://www.w3.org/1999/xhtml";const Sm={svg:"http://www.w3.org/2000/svg",xhtml:cf,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Uc(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Sm.hasOwnProperty(t)?{space:Sm[t],local:e}:e}function s3(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===cf&&t.documentElement.namespaceURI===cf?t.createElement(e):t.createElementNS(n,e)}}function i3(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function p1(e){var t=Uc(e);return(t.local?i3:s3)(t)}function r3(){}function Qh(e){return e==null?r3:function(){return this.querySelector(e)}}function o3(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 Ot(l,this._parents)}function c3(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function u3(){return[]}function g1(e){return e==null?u3:function(){return this.querySelectorAll(e)}}function d3(e){return function(){return c3(e.apply(this,arguments))}}function f3(e){typeof e=="function"?e=d3(e):e=g1(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 Ot(l,a)}function m1(e){return function(){return this.matches(e)}}function x1(e){return function(t){return t.matches(e)}}var h3=Array.prototype.find;function p3(e){return function(){return h3.call(this.children,e)}}function g3(){return this.firstElementChild}function m3(e){return this.select(e==null?g3:p3(typeof e=="function"?e:x1(e)))}var x3=Array.prototype.filter;function y3(){return Array.from(this.children)}function v3(e){return function(){return x3.call(this.children,e)}}function b3(e){return this.selectAll(e==null?y3:v3(typeof e=="function"?e:x1(e)))}function w3(e){typeof e!="function"&&(e=m1(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 Ot(l,this._parents)}function y1(e){return new Array(e.length)}function S3(){return new Ot(this._enter||this._groups.map(y1),this._parents)}function nc(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}nc.prototype={constructor:nc,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 N3(e){return function(){return e}}function j3(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 nc(e,s[i]);for(;i<c;++i)(r=t[i])&&(a[i]=r)}function k3(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 nc(e,s[r]);for(r=0;r<d;++r)(c=t[r])&&u.get(h[r])===c&&(a[r]=c)}function E3(e){return e.__data__}function C3(e,t){if(!arguments.length)return Array.from(this,E3);var n=t?k3:j3,l=this._parents,a=this._groups;typeof e!="function"&&(e=N3(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=M3(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 Ot(i,l),i._enter=r,i._exit=c,i}function M3(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function _3(){return new Ot(this._exit||this._groups.map(y1),this._parents)}function A3(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 T3(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 Ot(r,this._parents)}function z3(){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 D3(e){e||(e=R3);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 Ot(a,this._parents).order()}function R3(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function O3(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function H3(){return Array.from(this)}function L3(){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 $3(){let e=0;for(const t of this)++e;return e}function B3(){return!this.node()}function U3(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 q3(e){return function(){this.removeAttribute(e)}}function Y3(e){return function(){this.removeAttributeNS(e.space,e.local)}}function V3(e,t){return function(){this.setAttribute(e,t)}}function X3(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function G3(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Q3(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 Z3(e,t){var n=Uc(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?Y3:q3:typeof t=="function"?n.local?Q3:G3:n.local?X3:V3)(n,t))}function v1(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function I3(e){return function(){this.style.removeProperty(e)}}function K3(e,t,n){return function(){this.style.setProperty(e,t,n)}}function W3(e,t,n){return function(){var l=t.apply(this,arguments);l==null?this.style.removeProperty(e):this.style.setProperty(e,l,n)}}function J3(e,t,n){return arguments.length>1?this.each((t==null?I3:typeof t=="function"?W3:K3)(e,t,n??"")):us(this.node(),e)}function us(e,t){return e.style.getPropertyValue(t)||v1(e).getComputedStyle(e,null).getPropertyValue(t)}function F3(e){return function(){delete this[e]}}function P3(e,t){return function(){this[e]=t}}function eE(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function tE(e,t){return arguments.length>1?this.each((t==null?F3:typeof t=="function"?eE:P3)(e,t)):this.node()[e]}function b1(e){return e.trim().split(/^|\s+/)}function Zh(e){return e.classList||new w1(e)}function w1(e){this._node=e,this._names=b1(e.getAttribute("class")||"")}w1.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 S1(e,t){for(var n=Zh(e),l=-1,a=t.length;++l<a;)n.add(t[l])}function N1(e,t){for(var n=Zh(e),l=-1,a=t.length;++l<a;)n.remove(t[l])}function nE(e){return function(){S1(this,e)}}function lE(e){return function(){N1(this,e)}}function aE(e,t){return function(){(t.apply(this,arguments)?S1:N1)(this,e)}}function sE(e,t){var n=b1(e+"");if(arguments.length<2){for(var l=Zh(this.node()),a=-1,s=n.length;++a<s;)if(!l.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?aE:t?nE:lE)(n,t))}function iE(){this.textContent=""}function rE(e){return function(){this.textContent=e}}function oE(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function cE(e){return arguments.length?this.each(e==null?iE:(typeof e=="function"?oE:rE)(e)):this.node().textContent}function uE(){this.innerHTML=""}function dE(e){return function(){this.innerHTML=e}}function fE(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function hE(e){return arguments.length?this.each(e==null?uE:(typeof e=="function"?fE:dE)(e)):this.node().innerHTML}function pE(){this.nextSibling&&this.parentNode.appendChild(this)}function gE(){return this.each(pE)}function mE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xE(){return this.each(mE)}function yE(e){var t=typeof e=="function"?e:p1(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function vE(){return null}function bE(e,t){var n=typeof e=="function"?e:p1(e),l=t==null?vE:typeof t=="function"?t:Qh(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),l.apply(this,arguments)||null)})}function wE(){var e=this.parentNode;e&&e.removeChild(this)}function SE(){return this.each(wE)}function NE(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function jE(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function kE(e){return this.select(e?jE:NE)}function EE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function CE(e){return function(t){e.call(this,t,this.__data__)}}function ME(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 _E(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 AE(e,t,n){return function(){var l=this.__on,a,s=CE(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 TE(e,t,n){var l=ME(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?AE:_E,a=0;a<s;++a)this.each(r(l[a],t,n));return this}function j1(e,t,n){var l=v1(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 zE(e,t){return function(){return j1(this,e,t)}}function DE(e,t){return function(){return j1(this,e,t.apply(this,arguments))}}function RE(e,t){return this.each((typeof t=="function"?DE:zE)(e,t))}function*OE(){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 k1=[null];function Ot(e,t){this._groups=e,this._parents=t}function ar(){return new Ot([[document.documentElement]],k1)}function HE(){return this}Ot.prototype=ar.prototype={constructor:Ot,select:o3,selectAll:f3,selectChild:m3,selectChildren:b3,filter:w3,data:C3,enter:S3,exit:_3,join:A3,merge:T3,selection:HE,order:z3,sort:D3,call:O3,nodes:H3,node:L3,size:$3,empty:B3,each:U3,attr:Z3,style:J3,property:tE,classed:sE,text:cE,html:hE,raise:gE,lower:xE,append:yE,insert:bE,remove:SE,clone:kE,datum:EE,on:TE,dispatch:RE,[Symbol.iterator]:OE};function Ct(e){return typeof e=="string"?new Ot([[document.querySelector(e)]],[document.documentElement]):new Ot([[e]],k1)}function LE(e){let t;for(;t=e.sourceEvent;)e=t;return e}function tn(e,t){if(e=LE(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 $E={passive:!1},zi={capture:!0,passive:!1};function Iu(e){e.stopImmediatePropagation()}function Ja(e){e.preventDefault(),e.stopImmediatePropagation()}function E1(e){var t=e.document.documentElement,n=Ct(e).on("dragstart.drag",Ja,zi);"onselectstart"in t?n.on("selectstart.drag",Ja,zi):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function C1(e,t){var n=e.document.documentElement,l=Ct(e).on("dragstart.drag",null);t&&(l.on("click.drag",Ja,zi),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 Hr=e=>()=>e;function uf(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}})}uf.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function BE(e){return!e.ctrlKey&&!e.button}function UE(){return this.parentNode}function qE(e,t){return t??{x:e.x,y:e.y}}function YE(){return navigator.maxTouchPoints||"ontouchstart"in this}function M1(){var e=BE,t=UE,n=qE,l=YE,a={},s=Bc("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,$E).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 E=m(this,t.call(this,v,j),v,j,"mouse");E&&(Ct(v.view).on("mousemove.drag",x,zi).on("mouseup.drag",S,zi),E1(v.view),Iu(v),u=!1,r=v.clientX,c=v.clientY,E("start",v))}}function x(v){if(Ja(v),!u){var j=v.clientX-r,E=v.clientY-c;u=j*j+E*E>f}a.mouse("drag",v)}function S(v){Ct(v.view).on("mousemove.drag mouseup.drag",null),C1(v.view,u),Ja(v),a.mouse("end",v)}function w(v,j){if(e.call(this,v,j)){var E=v.changedTouches,M=t.call(this,v,j),A=E.length,C,H;for(C=0;C<A;++C)(H=m(this,M,v,j,E[C].identifier,E[C]))&&(Iu(v),H("start",v,E[C]))}}function g(v){var j=v.changedTouches,E=j.length,M,A;for(M=0;M<E;++M)(A=a[j[M].identifier])&&(Ja(v),A("drag",v,j[M]))}function y(v){var j=v.changedTouches,E=j.length,M,A;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),M=0;M<E;++M)(A=a[j[M].identifier])&&(Iu(v),A("end",v,j[M]))}function m(v,j,E,M,A,C){var H=s.copy(),T=tn(C||E,j),$,V,N;if((N=n.call(v,new uf("beforestart",{sourceEvent:E,target:h,identifier:A,active:i,x:T[0],y:T[1],dx:0,dy:0,dispatch:H}),M))!=null)return $=N.x-T[0]||0,V=N.y-T[1]||0,function D(k,R,z){var O=T,Y;switch(k){case"start":a[A]=D,Y=i++;break;case"end":delete a[A],--i;case"drag":T=tn(z||R,j),Y=i;break}H.call(k,v,new uf(k,{sourceEvent:R,subject:N,target:h,identifier:A,active:Y,x:T[0]+$,y:T[1]+V,dx:T[0]-O[0],dy:T[1]-O[1],dispatch:H}),M)}}return h.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Hr(!!v),h):e},h.container=function(v){return arguments.length?(t=typeof v=="function"?v:Hr(v),h):t},h.subject=function(v){return arguments.length?(n=typeof v=="function"?v:Hr(v),h):n},h.touchable=function(v){return arguments.length?(l=typeof v=="function"?v:Hr(!!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 Ih(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function _1(e,t){var n=Object.create(e.prototype);for(var l in t)n[l]=t[l];return n}function sr(){}var Di=.7,lc=1/Di,Fa="\\s*([+-]?\\d+)\\s*",Ri="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Nn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",VE=/^#([0-9a-f]{3,8})$/,XE=new RegExp(`^rgb\\(${Fa},${Fa},${Fa}\\)$`),GE=new RegExp(`^rgb\\(${Nn},${Nn},${Nn}\\)$`),QE=new RegExp(`^rgba\\(${Fa},${Fa},${Fa},${Ri}\\)$`),ZE=new RegExp(`^rgba\\(${Nn},${Nn},${Nn},${Ri}\\)$`),IE=new RegExp(`^hsl\\(${Ri},${Nn},${Nn}\\)$`),KE=new RegExp(`^hsla\\(${Ri},${Nn},${Nn},${Ri}\\)$`),Nm={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};Ih(sr,da,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:jm,formatHex:jm,formatHex8:WE,formatHsl:JE,formatRgb:km,toString:km});function jm(){return this.rgb().formatHex()}function WE(){return this.rgb().formatHex8()}function JE(){return A1(this).formatHsl()}function km(){return this.rgb().formatRgb()}function da(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=VE.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Em(t):n===3?new vt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Lr(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Lr(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=XE.exec(e))?new vt(t[1],t[2],t[3],1):(t=GE.exec(e))?new vt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=QE.exec(e))?Lr(t[1],t[2],t[3],t[4]):(t=ZE.exec(e))?Lr(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=IE.exec(e))?_m(t[1],t[2]/100,t[3]/100,1):(t=KE.exec(e))?_m(t[1],t[2]/100,t[3]/100,t[4]):Nm.hasOwnProperty(e)?Em(Nm[e]):e==="transparent"?new vt(NaN,NaN,NaN,0):null}function Em(e){return new vt(e>>16&255,e>>8&255,e&255,1)}function Lr(e,t,n,l){return l<=0&&(e=t=n=NaN),new vt(e,t,n,l)}function FE(e){return e instanceof sr||(e=da(e)),e?(e=e.rgb(),new vt(e.r,e.g,e.b,e.opacity)):new vt}function df(e,t,n,l){return arguments.length===1?FE(e):new vt(e,t,n,l??1)}function vt(e,t,n,l){this.r=+e,this.g=+t,this.b=+n,this.opacity=+l}Ih(vt,df,_1(sr,{brighter(e){return e=e==null?lc:Math.pow(lc,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Di:Math.pow(Di,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vt(la(this.r),la(this.g),la(this.b),ac(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:Cm,formatHex:Cm,formatHex8:PE,formatRgb:Mm,toString:Mm}));function Cm(){return`#${Jl(this.r)}${Jl(this.g)}${Jl(this.b)}`}function PE(){return`#${Jl(this.r)}${Jl(this.g)}${Jl(this.b)}${Jl((isNaN(this.opacity)?1:this.opacity)*255)}`}function Mm(){const e=ac(this.opacity);return`${e===1?"rgb(":"rgba("}${la(this.r)}, ${la(this.g)}, ${la(this.b)}${e===1?")":`, ${e})`}`}function ac(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function la(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Jl(e){return e=la(e),(e<16?"0":"")+e.toString(16)}function _m(e,t,n,l){return l<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new an(e,t,n,l)}function A1(e){if(e instanceof an)return new an(e.h,e.s,e.l,e.opacity);if(e instanceof sr||(e=da(e)),!e)return new an;if(e instanceof an)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 an(i,r,c,e.opacity)}function eC(e,t,n,l){return arguments.length===1?A1(e):new an(e,t,n,l??1)}function an(e,t,n,l){this.h=+e,this.s=+t,this.l=+n,this.opacity=+l}Ih(an,eC,_1(sr,{brighter(e){return e=e==null?lc:Math.pow(lc,e),new an(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Di:Math.pow(Di,e),new an(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 vt(Ku(e>=240?e-240:e+120,a,l),Ku(e,a,l),Ku(e<120?e+240:e-120,a,l),this.opacity)},clamp(){return new an(Am(this.h),$r(this.s),$r(this.l),ac(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=ac(this.opacity);return`${e===1?"hsl(":"hsla("}${Am(this.h)}, ${$r(this.s)*100}%, ${$r(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Am(e){return e=(e||0)%360,e<0?e+360:e}function $r(e){return Math.max(0,Math.min(1,e||0))}function Ku(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 Kh=e=>()=>e;function tC(e,t){return function(n){return e+n*t}}function nC(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 lC(e){return(e=+e)==1?T1:function(t,n){return n-t?nC(t,n,e):Kh(isNaN(t)?n:t)}}function T1(e,t){var n=t-e;return n?tC(e,n):Kh(isNaN(e)?t:e)}const sc=function e(t){var n=lC(t);function l(a,s){var i=n((a=df(a)).r,(s=df(s)).r),r=n(a.g,s.g),c=n(a.b,s.b),u=T1(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 aC(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 sC(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function iC(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]=pi(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 rC(e,t){var n=new Date;return e=+e,t=+t,function(l){return n.setTime(e*(1-l)+t*l),n}}function yn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function oC(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]=pi(e[a],t[a]):l[a]=t[a];return function(s){for(a in n)l[a]=n[a](s);return l}}var ff=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wu=new RegExp(ff.source,"g");function cC(e){return function(){return e}}function uC(e){return function(t){return e(t)+""}}function z1(e,t){var n=ff.lastIndex=Wu.lastIndex=0,l,a,s,i=-1,r=[],c=[];for(e=e+"",t=t+"";(l=ff.exec(e))&&(a=Wu.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:yn(l,a)})),n=Wu.lastIndex;return n<t.length&&(s=t.slice(n),r[i]?r[i]+=s:r[++i]=s),r.length<2?c[0]?uC(c[0].x):cC(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 pi(e,t){var n=typeof t,l;return t==null||n==="boolean"?Kh(t):(n==="number"?yn:n==="string"?(l=da(t))?(t=l,sc):z1:t instanceof da?sc:t instanceof Date?rC:sC(t)?aC:Array.isArray(t)?iC:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?oC:yn)(e,t)}var Tm=180/Math.PI,hf={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function D1(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)*Tm,skewX:Math.atan(c)*Tm,scaleX:i,scaleY:r}}var Br;function dC(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?hf:D1(t.a,t.b,t.c,t.d,t.e,t.f)}function fC(e){return e==null||(Br||(Br=document.createElementNS("http://www.w3.org/2000/svg","g")),Br.setAttribute("transform",e),!(e=Br.transform.baseVal.consolidate()))?hf:(e=e.matrix,D1(e.a,e.b,e.c,e.d,e.e,e.f))}function R1(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:yn(u,f)},{i:S-2,x:yn(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:yn(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:yn(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:yn(u,f)},{i:S-2,x:yn(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 hC=R1(dC,"px, ","px)","deg)"),pC=R1(fC,", ",")",")"),gC=1e-12;function zm(e){return((e=Math.exp(e))+1/e)/2}function mC(e){return((e=Math.exp(e))-1/e)/2}function xC(e){return((e=Math.exp(2*e))-1)/(e+1)}const fo=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<gC)g=Math.log(h/u)/t,w=function(M){return[r+M*p,c+M*x,u*Math.exp(t*M*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),E=Math.log(Math.sqrt(v*v+1)-v);g=(E-j)/t,w=function(M){var A=M*g,C=zm(j),H=u/(n*y)*(C*xC(t*A+j)-mC(j));return[r+H*p,c+H*x,u*C/zm(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 ds=0,Ks=0,qs=0,O1=1e3,ic,Ws,rc=0,fa=0,qc=0,Oi=typeof performance=="object"&&performance.now?performance:Date,H1=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Wh(){return fa||(H1(yC),fa=Oi.now()+qc)}function yC(){fa=0}function oc(){this._call=this._time=this._next=null}oc.prototype=L1.prototype={constructor:oc,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Wh():+n)+(t==null?0:+t),!this._next&&Ws!==this&&(Ws?Ws._next=this:ic=this,Ws=this),this._call=e,this._time=n,pf()},stop:function(){this._call&&(this._call=null,this._time=1/0,pf())}};function L1(e,t,n){var l=new oc;return l.restart(e,t,n),l}function vC(){Wh(),++ds;for(var e=ic,t;e;)(t=fa-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ds}function Dm(){fa=(rc=Oi.now())+qc,ds=Ks=0;try{vC()}finally{ds=0,wC(),fa=0}}function bC(){var e=Oi.now(),t=e-rc;t>O1&&(qc-=t,rc=e)}function wC(){for(var e,t=ic,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:ic=n);Ws=e,pf(l)}function pf(e){if(!ds){Ks&&(Ks=clearTimeout(Ks));var t=e-fa;t>24?(e<1/0&&(Ks=setTimeout(Dm,e-Oi.now()-qc)),qs&&(qs=clearInterval(qs))):(qs||(rc=Oi.now(),qs=setInterval(bC,O1)),ds=1,H1(Dm))}}function Rm(e,t,n){var l=new oc;return t=t==null?0:+t,l.restart(a=>{l.stop(),e(a+t)},t,n),l}var SC=Bc("start","end","cancel","interrupt"),NC=[],$1=0,Om=1,gf=2,ho=3,Hm=4,mf=5,po=6;function Yc(e,t,n,l,a,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;jC(e,n,{name:t,index:l,group:a,on:SC,tween:NC,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:$1})}function Jh(e,t){var n=dn(e,t);if(n.state>$1)throw new Error("too late; already scheduled");return n}function Mn(e,t){var n=dn(e,t);if(n.state>ho)throw new Error("too late; already running");return n}function dn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function jC(e,t,n){var l=e.__transition,a;l[t]=n,n.timer=L1(s,0,n.time);function s(u){n.state=Om,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!==Om)return c();for(d in l)if(p=l[d],p.name===n.name){if(p.state===ho)return Rm(i);p.state===Hm?(p.state=po,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete l[d]):+d<t&&(p.state=po,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete l[d])}if(Rm(function(){n.state===ho&&(n.state=Hm,n.timer.restart(r,n.delay,n.time),r(u))}),n.state=gf,n.on.call("start",e,e.__data__,n.index,n.group),n.state===gf){for(n.state=ho,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=mf,1),f=-1,h=a.length;++f<h;)a[f].call(e,d);n.state===mf&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=po,n.timer.stop(),delete l[t];for(var u in l)return;delete e.__transition}}function go(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>gf&&l.state<mf,l.state=po,l.timer.stop(),l.on.call(a?"interrupt":"cancel",e,e.__data__,l.index,l.group),delete n[i]}s&&delete e.__transition}}function kC(e){return this.each(function(){go(this,e)})}function EC(e,t){var n,l;return function(){var a=Mn(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 CC(e,t,n){var l,a;if(typeof n!="function")throw new Error;return function(){var s=Mn(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 MC(e,t){var n=this._id;if(e+="",arguments.length<2){for(var l=dn(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?EC:CC)(n,e,t))}function Fh(e,t,n){var l=e._id;return e.each(function(){var a=Mn(this,l);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return dn(a,l).value[t]}}function B1(e,t){var n;return(typeof t=="number"?yn:t instanceof da?sc:(n=da(t))?(t=n,sc):z1)(e,t)}function _C(e){return function(){this.removeAttribute(e)}}function AC(e){return function(){this.removeAttributeNS(e.space,e.local)}}function TC(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 zC(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 DC(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 RC(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 OC(e,t){var n=Uc(e),l=n==="transform"?pC:B1;return this.attrTween(e,typeof t=="function"?(n.local?RC:DC)(n,l,Fh(this,"attr."+e,t)):t==null?(n.local?AC:_C)(n):(n.local?zC:TC)(n,l,t))}function HC(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function LC(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function $C(e,t){var n,l;function a(){var s=t.apply(this,arguments);return s!==l&&(n=(l=s)&&LC(e,s)),n}return a._value=t,a}function BC(e,t){var n,l;function a(){var s=t.apply(this,arguments);return s!==l&&(n=(l=s)&&HC(e,s)),n}return a._value=t,a}function UC(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=Uc(e);return this.tween(n,(l.local?$C:BC)(l,t))}function qC(e,t){return function(){Jh(this,e).delay=+t.apply(this,arguments)}}function YC(e,t){return t=+t,function(){Jh(this,e).delay=t}}function VC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?qC:YC)(t,e)):dn(this.node(),t).delay}function XC(e,t){return function(){Mn(this,e).duration=+t.apply(this,arguments)}}function GC(e,t){return t=+t,function(){Mn(this,e).duration=t}}function QC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?XC:GC)(t,e)):dn(this.node(),t).duration}function ZC(e,t){if(typeof t!="function")throw new Error;return function(){Mn(this,e).ease=t}}function IC(e){var t=this._id;return arguments.length?this.each(ZC(t,e)):dn(this.node(),t).ease}function KC(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Mn(this,e).ease=n}}function WC(e){if(typeof e!="function")throw new Error;return this.each(KC(this._id,e))}function JC(e){typeof e!="function"&&(e=m1(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 el(l,this._parents,this._name,this._id)}function FC(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 el(i,this._parents,this._name,this._id)}function PC(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 e4(e,t,n){var l,a,s=PC(t)?Jh:Mn;return function(){var i=s(this,e),r=i.on;r!==l&&(a=(l=r).copy()).on(t,n),i.on=a}}function t4(e,t){var n=this._id;return arguments.length<2?dn(this.node(),n).on.on(e):this.each(e4(n,e,t))}function n4(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function l4(){return this.on("end.remove",n4(this._id))}function a4(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,Yc(u[h],t,n,h,u,dn(d,n)));return new el(s,this._parents,t,n)}function s4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=g1(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=dn(d,n),S=0,w=h.length;S<w;++S)(p=h[S])&&Yc(p,t,n,S,h,x);s.push(h),i.push(d)}return new el(s,i,t,n)}var i4=ar.prototype.constructor;function r4(){return new i4(this._groups,this._parents)}function o4(e,t){var n,l,a;return function(){var s=us(this,e),i=(this.style.removeProperty(e),us(this,e));return s===i?null:s===n&&i===l?a:a=t(n=s,l=i)}}function U1(e){return function(){this.style.removeProperty(e)}}function c4(e,t,n){var l,a=n+"",s;return function(){var i=us(this,e);return i===a?null:i===l?s:s=t(l=i,n)}}function u4(e,t,n){var l,a,s;return function(){var i=us(this,e),r=n(this),c=r+"";return r==null&&(c=r=(this.style.removeProperty(e),us(this,e))),i===c?null:i===l&&c===a?s:(a=c,s=t(l=i,r))}}function d4(e,t){var n,l,a,s="style."+t,i="end."+s,r;return function(){var c=Mn(this,e),u=c.on,d=c.value[s]==null?r||(r=U1(t)):void 0;(u!==n||a!==d)&&(l=(n=u).copy()).on(i,a=d),c.on=l}}function f4(e,t,n){var l=(e+="")=="transform"?hC:B1;return t==null?this.styleTween(e,o4(e,l)).on("end.style."+e,U1(e)):typeof t=="function"?this.styleTween(e,u4(e,l,Fh(this,"style."+e,t))).each(d4(this._id,e)):this.styleTween(e,c4(e,l,t),n).on("end.style."+e,null)}function h4(e,t,n){return function(l){this.style.setProperty(e,t.call(this,l),n)}}function p4(e,t,n){var l,a;function s(){var i=t.apply(this,arguments);return i!==a&&(l=(a=i)&&h4(e,i,n)),l}return s._value=t,s}function g4(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,p4(e,t,n??""))}function m4(e){return function(){this.textContent=e}}function x4(e){return function(){var t=e(this);this.textContent=t??""}}function y4(e){return this.tween("text",typeof e=="function"?x4(Fh(this,"text",e)):m4(e==null?"":e+""))}function v4(e){return function(t){this.textContent=e.call(this,t)}}function b4(e){var t,n;function l(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&v4(a)),t}return l._value=e,l}function w4(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,b4(e))}function S4(){for(var e=this._name,t=this._id,n=q1(),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=dn(c,t);Yc(c,e,n,u,i,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new el(l,this._parents,e,n)}function N4(){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=Mn(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 j4=0;function el(e,t,n,l){this._groups=e,this._parents=t,this._name=n,this._id=l}function q1(){return++j4}var Hn=ar.prototype;el.prototype={constructor:el,select:a4,selectAll:s4,selectChild:Hn.selectChild,selectChildren:Hn.selectChildren,filter:JC,merge:FC,selection:r4,transition:S4,call:Hn.call,nodes:Hn.nodes,node:Hn.node,size:Hn.size,empty:Hn.empty,each:Hn.each,on:t4,attr:OC,attrTween:UC,style:f4,styleTween:g4,text:y4,textTween:w4,remove:l4,tween:MC,delay:VC,duration:QC,ease:IC,easeVarying:WC,end:N4,[Symbol.iterator]:Hn[Symbol.iterator]};function k4(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var E4={time:null,delay:0,duration:250,ease:k4};function C4(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 M4(e){var t,n;e instanceof el?(t=e._id,e=e._name):(t=q1(),(n=E4).time=Wh(),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])&&Yc(c,e,t,u,i,n||C4(c,t));return new el(l,this._parents,e,t)}ar.prototype.interrupt=kC;ar.prototype.transition=M4;const Ur=e=>()=>e;function _4(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 Vn(e,t,n){this.k=e,this.x=t,this.y=n}Vn.prototype={constructor:Vn,scale:function(e){return e===1?this:new Vn(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Vn(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 Vc=new Vn(1,0,0);Y1.prototype=Vn.prototype;function Y1(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Vc;return e.__zoom}function Ju(e){e.stopImmediatePropagation()}function Ys(e){e.preventDefault(),e.stopImmediatePropagation()}function A4(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function T4(){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 Lm(){return this.__zoom||Vc}function z4(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function D4(){return navigator.maxTouchPoints||"ontouchstart"in this}function R4(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 V1(){var e=A4,t=T4,n=R4,l=z4,a=D4,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],r=250,c=fo,u=Bc("start","zoom","end"),d,f,h,p=500,x=150,S=0,w=10;function g(N){N.property("__zoom",Lm).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",H).filter(a).on("touchstart.zoom",T).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(N,D,k,R){var z=N.selection?N.selection():N;z.property("__zoom",Lm),N!==z?j(N,D,k,R):z.interrupt().each(function(){E(this,arguments).event(R).start().zoom(null,typeof D=="function"?D.apply(this,arguments):D).end()})},g.scaleBy=function(N,D,k,R){g.scaleTo(N,function(){var z=this.__zoom.k,O=typeof D=="function"?D.apply(this,arguments):D;return z*O},k,R)},g.scaleTo=function(N,D,k,R){g.transform(N,function(){var z=t.apply(this,arguments),O=this.__zoom,Y=k==null?v(z):typeof k=="function"?k.apply(this,arguments):k,X=O.invert(Y),L=typeof D=="function"?D.apply(this,arguments):D;return n(m(y(O,L),Y,X),z,i)},k,R)},g.translateBy=function(N,D,k,R){g.transform(N,function(){return n(this.__zoom.translate(typeof D=="function"?D.apply(this,arguments):D,typeof k=="function"?k.apply(this,arguments):k),t.apply(this,arguments),i)},null,R)},g.translateTo=function(N,D,k,R,z){g.transform(N,function(){var O=t.apply(this,arguments),Y=this.__zoom,X=R==null?v(O):typeof R=="function"?R.apply(this,arguments):R;return n(Vc.translate(X[0],X[1]).scale(Y.k).translate(typeof D=="function"?-D.apply(this,arguments):-D,typeof k=="function"?-k.apply(this,arguments):-k),O,i)},R,z)};function y(N,D){return D=Math.max(s[0],Math.min(s[1],D)),D===N.k?N:new Vn(D,N.x,N.y)}function m(N,D,k){var R=D[0]-k[0]*N.k,z=D[1]-k[1]*N.k;return R===N.x&&z===N.y?N:new Vn(N.k,R,z)}function v(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function j(N,D,k,R){N.on("start.zoom",function(){E(this,arguments).event(R).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(R).end()}).tween("zoom",function(){var z=this,O=arguments,Y=E(z,O).event(R),X=t.apply(z,O),L=k==null?v(X):typeof k=="function"?k.apply(z,O):k,U=Math.max(X[1][0]-X[0][0],X[1][1]-X[0][1]),_=z.__zoom,B=typeof D=="function"?D.apply(z,O):D,G=c(_.invert(L).concat(U/_.k),B.invert(L).concat(U/B.k));return function(q){if(q===1)q=B;else{var Q=G(q),K=U/Q[2];q=new Vn(K,L[0]-Q[0]*K,L[1]-Q[1]*K)}Y.zoom(null,q)}})}function E(N,D,k){return!k&&N.__zooming||new M(N,D)}function M(N,D){this.that=N,this.args=D,this.active=0,this.sourceEvent=null,this.extent=t.apply(N,D),this.taps=0}M.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,D){return this.mouse&&N!=="mouse"&&(this.mouse[1]=D.invert(this.mouse[0])),this.touch0&&N!=="touch"&&(this.touch0[1]=D.invert(this.touch0[0])),this.touch1&&N!=="touch"&&(this.touch1[1]=D.invert(this.touch1[0])),this.that.__zoom=D,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(N){var D=Ct(this.that).datum();u.call(N,this.that,new _4(N,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),D)}};function A(N,...D){if(!e.apply(this,arguments))return;var k=E(this,D).event(N),R=this.__zoom,z=Math.max(s[0],Math.min(s[1],R.k*Math.pow(2,l.apply(this,arguments)))),O=tn(N);if(k.wheel)(k.mouse[0][0]!==O[0]||k.mouse[0][1]!==O[1])&&(k.mouse[1]=R.invert(k.mouse[0]=O)),clearTimeout(k.wheel);else{if(R.k===z)return;k.mouse=[O,R.invert(O)],go(this),k.start()}Ys(N),k.wheel=setTimeout(Y,x),k.zoom("mouse",n(m(y(R,z),k.mouse[0],k.mouse[1]),k.extent,i));function Y(){k.wheel=null,k.end()}}function C(N,...D){if(h||!e.apply(this,arguments))return;var k=N.currentTarget,R=E(this,D,!0).event(N),z=Ct(N.view).on("mousemove.zoom",L,!0).on("mouseup.zoom",U,!0),O=tn(N,k),Y=N.clientX,X=N.clientY;E1(N.view),Ju(N),R.mouse=[O,this.__zoom.invert(O)],go(this),R.start();function L(_){if(Ys(_),!R.moved){var B=_.clientX-Y,G=_.clientY-X;R.moved=B*B+G*G>S}R.event(_).zoom("mouse",n(m(R.that.__zoom,R.mouse[0]=tn(_,k),R.mouse[1]),R.extent,i))}function U(_){z.on("mousemove.zoom mouseup.zoom",null),C1(_.view,R.moved),Ys(_),R.event(_).end()}}function H(N,...D){if(e.apply(this,arguments)){var k=this.__zoom,R=tn(N.changedTouches?N.changedTouches[0]:N,this),z=k.invert(R),O=k.k*(N.shiftKey?.5:2),Y=n(m(y(k,O),R,z),t.apply(this,D),i);Ys(N),r>0?Ct(this).transition().duration(r).call(j,Y,R,N):Ct(this).call(g.transform,Y,R,N)}}function T(N,...D){if(e.apply(this,arguments)){var k=N.touches,R=k.length,z=E(this,D,N.changedTouches.length===R).event(N),O,Y,X,L;for(Ju(N),Y=0;Y<R;++Y)X=k[Y],L=tn(X,this),L=[L,this.__zoom.invert(L),X.identifier],z.touch0?!z.touch1&&z.touch0[2]!==L[2]&&(z.touch1=L,z.taps=0):(z.touch0=L,O=!0,z.taps=1+!!d);d&&(d=clearTimeout(d)),O&&(z.taps<2&&(f=L[0],d=setTimeout(function(){d=null},p)),go(this),z.start())}}function $(N,...D){if(this.__zooming){var k=E(this,D).event(N),R=N.changedTouches,z=R.length,O,Y,X,L;for(Ys(N),O=0;O<z;++O)Y=R[O],X=tn(Y,this),k.touch0&&k.touch0[2]===Y.identifier?k.touch0[0]=X:k.touch1&&k.touch1[2]===Y.identifier&&(k.touch1[0]=X);if(Y=k.that.__zoom,k.touch1){var U=k.touch0[0],_=k.touch0[1],B=k.touch1[0],G=k.touch1[1],q=(q=B[0]-U[0])*q+(q=B[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]+B[0])/2,(U[1]+B[1])/2],L=[(_[0]+G[0])/2,(_[1]+G[1])/2]}else if(k.touch0)X=k.touch0[0],L=k.touch0[1];else return;k.zoom("touch",n(m(Y,X,L),k.extent,i))}}function V(N,...D){if(this.__zooming){var k=E(this,D).event(N),R=N.changedTouches,z=R.length,O,Y;for(Ju(N),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),O=0;O<z;++O)Y=R[O],k.touch0&&k.touch0[2]===Y.identifier?delete k.touch0:k.touch1&&k.touch1[2]===Y.identifier&&delete k.touch1;if(k.touch1&&!k.touch0&&(k.touch0=k.touch1,delete k.touch1),k.touch0)k.touch0[1]=this.__zoom.invert(k.touch0[0]);else if(k.end(),k.taps===2&&(Y=tn(Y,this),Math.hypot(f[0]-Y[0],f[1]-Y[1])<w)){var X=Ct(this).on("dblclick.zoom");X&&X.apply(this,arguments)}}}return g.wheelDelta=function(N){return arguments.length?(l=typeof N=="function"?N:Ur(+N),g):l},g.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Ur(!!N),g):e},g.touchable=function(N){return arguments.length?(a=typeof N=="function"?N:Ur(!!N),g):a},g.extent=function(N){return arguments.length?(t=typeof N=="function"?N:Ur([[+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 jn={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."},Hi=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],X1=["Enter"," ","Escape"],G1={"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 fs;(function(e){e.Strict="strict",e.Loose="loose"})(fs||(fs={}));var aa;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(aa||(aa={}));var Li;(function(e){e.Partial="partial",e.Full="full"})(Li||(Li={}));const Q1={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var xl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(xl||(xl={}));var cc;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(cc||(cc={}));var ee;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ee||(ee={}));const $m={[ee.Left]:ee.Right,[ee.Right]:ee.Left,[ee.Top]:ee.Bottom,[ee.Bottom]:ee.Top};function Z1(e){return e===null?null:e?"valid":"invalid"}const I1=e=>"id"in e&&"source"in e&&"target"in e,O4=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Ph=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ir=(e,t=[0,0])=>{const{width:n,height:l}=nl(e),a=e.origin??t,s=n*a[0],i=l*a[1];return{x:e.position.x-s,y:e.position.y-i}},H4=(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):Ph(a)?a:t.nodeLookup.get(a.id));const r=i?uc(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Xc(l,r)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Gc(n)},rr=(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=Xc(n,uc(a)),l=!0)}),l?Gc(n):{x:0,y:0,width:0,height:0}},ep=(e,t,[n,l,a]=[0,0,1],s=!1,i=!1)=>{const r={...cr(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=$i(r,ps(u)),w=(p??0)*(x??0),g=s&&S>0;(!u.internals.handleBounds||g||S>=w||u.dragging)&&c.push(u)}return c},L4=(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 $4(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 B4({nodes:e,width:t,height:n,panZoom:l,minZoom:a,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const r=$4(e,i),c=rr(r),u=tp(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 K1({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",jn.error005());else{const p=r.measured.width,x=r.measured.height;p&&x&&(f=[[c,u],[c+p,u+x]])}else r&&gs(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=gs(f)?ha(t,f,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&(s==null||s("015",jn.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 U4({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=L4(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 hs=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ha=(e={x:0,y:0},t,n)=>({x:hs(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:hs(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function W1(e,t,n){const{width:l,height:a}=nl(n),{x:s,y:i}=n.internals.positionAbsolute;return ha(e,[[s,i],[s+l,i+a]],t)}const Bm=(e,t,n)=>e<t?hs(Math.abs(e-t),1,t)/t:e>n?-hs(Math.abs(e-n),1,t)/t:0,J1=(e,t,n=15,l=40)=>{const a=Bm(e.x,l,t.width-l)*n,s=Bm(e.y,l,t.height-l)*n;return[a,s]},Xc=(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)}),xf=({x:e,y:t,width:n,height:l})=>({x:e,y:t,x2:e+n,y2:t+l}),Gc=({x:e,y:t,x2:n,y2:l})=>({x:e,y:t,width:n-e,height:l-t}),ps=(e,t=[0,0])=>{var a,s;const{x:n,y:l}=Ph(e)?e.internals.positionAbsolute:ir(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}},uc=(e,t=[0,0])=>{var a,s;const{x:n,y:l}=Ph(e)?e.internals.positionAbsolute:ir(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)}},F1=(e,t)=>Gc(Xc(xf(e),xf(t))),$i=(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)},Um=e=>sn(e.width)&&sn(e.height)&&sn(e.x)&&sn(e.y),sn=e=>!isNaN(e)&&isFinite(e),q4=(e,t)=>{},or=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),cr=({x:e,y:t},[n,l,a],s=!1,i=[1,1])=>{const r={x:(e-n)/a,y:(t-l)/a};return s?or(r,i):r},dc=({x:e,y:t},[n,l,a])=>({x:e*a+n,y:t*a+l});function ja(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 Y4(e,t,n){if(typeof e=="string"||typeof e=="number"){const l=ja(e,n),a=ja(e,t);return{top:l,right:a,bottom:l,left:a,x:a*2,y:l*2}}if(typeof e=="object"){const l=ja(e.top??e.y??0,n),a=ja(e.bottom??e.y??0,n),s=ja(e.left??e.x??0,t),i=ja(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 V4(e,t,n,l,a,s){const{x:i,y:r}=dc(e,[t,n,l]),{x:c,y:u}=dc({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 tp=(e,t,n,l,a,s)=>{const i=Y4(s,t,n),r=(t-i.x)/e.width,c=(n-i.y)/e.height,u=Math.min(r,c),d=hs(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=V4(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}},Bi=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function gs(e){return e!=null&&e!=="parent"}function nl(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 P1(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 eb(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 qm(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function X4(){let e,t;return{promise:new Promise((l,a)=>{e=l,t=a}),resolve:e,reject:t}}function G4(e){return{...G1,...e||{}}}function gi(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:l,containerBounds:a}){const{x:s,y:i}=rn(e),r=cr({x:s-((a==null?void 0:a.left)??0),y:i-((a==null?void 0:a.top)??0)},l),{x:c,y:u}=n?or(r,t):r;return{xSnapped:c,ySnapped:u,...r}}const np=e=>({width:e.offsetWidth,height:e.offsetHeight}),tb=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Q4=["INPUT","SELECT","TEXTAREA"];function nb(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:Q4.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const lb=e=>"clientX"in e,rn=(e,t)=>{var s,i;const n=lb(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)}},Ym=(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,...np(i)}})};function ab({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 qr(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Vm({pos:e,x1:t,y1:n,x2:l,y2:a,c:s}){switch(e){case ee.Left:return[t-qr(t-l,s),n];case ee.Right:return[t+qr(l-t,s),n];case ee.Top:return[t,n-qr(n-a,s)];case ee.Bottom:return[t,n+qr(a-n,s)]}}function sb({sourceX:e,sourceY:t,sourcePosition:n=ee.Bottom,targetX:l,targetY:a,targetPosition:s=ee.Top,curvature:i=.25}){const[r,c]=Vm({pos:n,x1:e,y1:t,x2:l,y2:a,c:i}),[u,d]=Vm({pos:s,x1:l,y1:a,x2:e,y2:t,c:i}),[f,h,p,x]=ab({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 ib({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 Z4({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 I4({sourceNode:e,targetNode:t,width:n,height:l,transform:a}){const s=Xc(uc(e),uc(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 $i(i,Gc(s))>0}const K4=({source:e,sourceHandle:t,target:n,targetHandle:l})=>`xy-edge__${e}${t||""}-${n}${l||""}`,W4=(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)),J4=(e,t,n={})=>{if(!e.source||!e.target)return t;const l=n.getEdgeId||K4;let a;return I1(e)?a={...e}:a={...e,id:l(e)},W4(a,t)?t:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,t.concat(a))};function rb({sourceX:e,sourceY:t,targetX:n,targetY:l}){const[a,s,i,r]=ib({sourceX:e,sourceY:t,targetX:n,targetY:l});return[`M ${e},${t}L ${n},${l}`,a,s,i,r]}const Xm={[ee.Left]:{x:-1,y:0},[ee.Right]:{x:1,y:0},[ee.Top]:{x:0,y:-1},[ee.Bottom]:{x:0,y:1}},F4=({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},Gm=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function P4({source:e,sourcePosition:t=ee.Bottom,target:n,targetPosition:l=ee.Top,center:a,offset:s,stepPosition:i}){const r=Xm[t],c=Xm[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=F4({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]=ib({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}],C=[{x:u.x,y:w},{x:d.x,y:w}];r[h]===p?x=h==="x"?A:C:x=h==="x"?C:A}else{const A=[{x:u.x,y:d.y}],C=[{x:d.x,y:u.y}];if(h==="x"?x=r.x===p?C:A:x=r.y===p?A:C,t===l){const N=Math.abs(e[h]-n[h]);if(N<=s){const D=Math.min(s-1,s-N);r[h]===p?g[h]=(u[h]>e[h]?-1:1)*D:y[h]=(d[h]>n[h]?-1:1)*D}}if(t!==l){const N=h==="x"?"y":"x",D=r[h]===c[N],k=u[N]>d[N],R=u[N]<d[N];(r[h]===1&&(!D&&k||D&&R)||r[h]!==1&&(!D&&R||D&&k))&&(x=h==="x"?A:C)}const H={x:u.x+g.x,y:u.y+g.y},T={x:d.x+y.x,y:d.y+y.y},$=Math.max(Math.abs(H.x-x[0].x),Math.abs(T.x-x[0].x)),V=Math.max(Math.abs(H.y-x[0].y),Math.abs(T.y-x[0].y));$>=V?(S=(H.x+T.x)/2,w=x[0].y):(S=x[0].x,w=(H.y+T.y)/2)}const j={x:u.x+g.x,y:u.y+g.y},E={x:d.x+y.x,y:d.y+y.y};return[[e,...j.x!==x[0].x||j.y!==x[0].y?[j]:[],...x,...E.x!==x[x.length-1].x||E.y!==x[x.length-1].y?[E]:[],n],S,w,m,v]}function eM(e,t,n,l){const a=Math.min(Gm(e,t)/2,Gm(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 yf({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]=P4({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+=eM(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 Qm(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function tM(e){var f;const{sourceNode:t,targetNode:n}=e;if(!Qm(t)||!Qm(n))return null;const l=t.internals.handleBounds||Zm(t.handles),a=n.internals.handleBounds||Zm(n.handles),s=Im((l==null?void 0:l.source)??[],e.sourceHandle),i=Im(e.connectionMode===fs.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",jn.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=pa(t,s,r),d=pa(n,i,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:r,targetPosition:c}}function Zm(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 pa(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??nl(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 Im(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function vf(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(l=>`${l}=${e[l]}`).join("&")}`:""}function nM(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=vf(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 ob=1e3,lM=10,lp={nodeOrigin:[0,0],nodeExtent:Hi,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},aM={...lp,checkEquality:!0};function ap(e,t){const n={...e};for(const l in t)t[l]!==void 0&&(n[l]=t[l]);return n}function sM(e,t,n){const l=ap(lp,n);for(const a of e.values())if(a.parentId)ip(a,e,t,l);else{const s=ir(a,l.nodeOrigin),i=gs(a.extent)?a.extent:l.nodeExtent,r=ha(s,i,nl(a));a.internals.positionAbsolute=r}}function iM(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 sp(e){return e==="manual"}function bf(e,t,n,l={}){var d,f;const a=ap(aM,l),s={i:0},i=new Map(t),r=a!=null&&a.elevateNodesOnSelect&&!sp(a.zIndexMode)?ob: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=ir(h,a.nodeOrigin),S=gs(h.extent)?h.extent:a.nodeExtent,w=ha(x,S,nl(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:iM(h,p),z:cb(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&&ip(p,t,n,l,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function rM(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 ip(e,t,n,l,a){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:r,zIndexMode:c}=ap(lp,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}rM(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*lM),a&&d.internals.rootParentIndex!==void 0&&(a.i=d.internals.rootParentIndex);const f=s&&!sp(c)?ob:0,{x:h,y:p,z:x}=oM(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 cb(e,t,n){const l=sn(e.zIndex)?e.zIndex:0;return sp(n)?l:l+(e.selected?t:0)}function oM(e,t,n,l,a,s){const{x:i,y:r}=t.internals.positionAbsolute,c=nl(e),u=ir(e,n),d=gs(e.extent)?ha(u,e.extent,c):u;let f=ha({x:i+d.x,y:r+d.y},l,c);e.extent==="parent"&&(f=W1(f,c,t));const h=cb(e,a,s),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function rp(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)??ps(c),d=F1(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=nl(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 cM(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=np(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=gs(x.extent)?x.extent:s;let{positionAbsolute:v}=x.internals;x.parentId&&x.extent==="parent"?v=W1(v,S,t.get(x.parentId)):m&&(v=ha(v,m,S));const j={...x,measured:S,internals:{...x.internals,positionAbsolute:v,handleBounds:{source:Ym("source",p.nodeElement,y,f,x.id),target:Ym("target",p.nodeElement,y,f,x.id)}}};t.set(x.id,j),x.parentId&&ip(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:ps(j,a)}))}}if(h.length>0){const p=rp(h,t,n,a);u.push(...p)}return{changes:u,updatedInternals:c}}async function uM({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 Km(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 ub(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}`;Km("source",c,d,e,a,i),Km("target",c,u,e,s,r),t.set(l.id,l)}}function db(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:db(n,t):!1}function Wm(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 dM(e,t,n,l){const a=new Map;for(const[s,i]of e)if((i.selected||i.id===l)&&(!i.parentId||!db(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 Fu({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 fM({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=or(s,t);return{x:i.x-s.x,y:i.y-s.y}}function hM({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:E,nodeClickDistance:M=0}){h=Ct(v);function A({x:$,y:V}){const{nodeLookup:N,nodeExtent:D,snapGrid:k,snapToGrid:R,nodeOrigin:z,onNodeDrag:O,onSelectionDrag:Y,onError:X,updateNodePositions:L}=t();s={x:$,y:V};let U=!1;const _=r.size>1,B=_&&D?xf(rr(r)):null,G=_&&R?fM({dragItems:r,snapGrid:k,x:$,y:V}):null;for(const[q,Q]of r){if(!N.has(q))continue;let K={x:$-Q.distance.x,y:V-Q.distance.y};R&&(K=G?{x:Math.round(K.x+G.x),y:Math.round(K.y+G.y)}:or(K,k));let W=null;if(_&&D&&!Q.extent&&B){const{positionAbsolute:F}=Q.internals,le=F.x-B.x+D[0][0],ae=F.x+Q.measured.width-B.x2+D[1][0],te=F.y-B.y+D[0][1],ge=F.y+Q.measured.height-B.y2+D[1][1];W=[[le,te],[ae,ge]]}const{position:P,positionAbsolute:J}=K1({nodeId:q,nextPosition:K,nodeLookup:N,nodeExtent:W||D,nodeOrigin:z,onError:X});U=U||Q.position.x!==P.x||Q.position.y!==P.y,Q.position=P,Q.internals.positionAbsolute=J}if(x=x||U,!!U&&(L(r,!0),S&&(l||O||!E&&Y))){const[q,Q]=Fu({nodeId:E,dragItems:r,nodeLookup:N});l==null||l(S,r,q,Q),O==null||O(S,q,Q),E||Y==null||Y(S,Q)}}async function C(){if(!d)return;const{transform:$,panBy:V,autoPanSpeed:N,autoPanOnNodeDrag:D}=t();if(!D){c=!1,cancelAnimationFrame(i);return}const[k,R]=J1(u,d,N);(k!==0||R!==0)&&(s.x=(s.x??0)-k/$[2],s.y=(s.y??0)-R/$[2],await V({x:k,y:R})&&A(s)),i=requestAnimationFrame(C)}function H($){var _;const{nodeLookup:V,multiSelectionActive:N,nodesDraggable:D,transform:k,snapGrid:R,snapToGrid:z,selectNodesOnDrag:O,onNodeDragStart:Y,onSelectionDragStart:X,unselectNodesAndEdges:L}=t();f=!0,(!O||!j)&&!N&&E&&((_=V.get(E))!=null&&_.selected||L()),j&&O&&E&&(e==null||e(E));const U=gi($.sourceEvent,{transform:k,snapGrid:R,snapToGrid:z,containerBounds:d});if(s=U,r=dM(V,D,U,E),r.size>0&&(n||Y||!E&&X)){const[B,G]=Fu({nodeId:E,dragItems:r,nodeLookup:V});n==null||n($.sourceEvent,r,B,G),Y==null||Y($.sourceEvent,B,G),E||X==null||X($.sourceEvent,G)}}const T=M1().clickDistance(M).on("start",$=>{const{domNode:V,nodeDragThreshold:N,transform:D,snapGrid:k,snapToGrid:R}=t();d=(V==null?void 0:V.getBoundingClientRect())||null,p=!1,x=!1,S=$.sourceEvent,N===0&&H($),s=gi($.sourceEvent,{transform:D,snapGrid:k,snapToGrid:R,containerBounds:d}),u=rn($.sourceEvent,d)}).on("drag",$=>{const{autoPanOnNodeDrag:V,transform:N,snapGrid:D,snapToGrid:k,nodeDragThreshold:R,nodeLookup:z}=t(),O=gi($.sourceEvent,{transform:N,snapGrid:D,snapToGrid:k,containerBounds:d});if(S=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||E&&!z.has(E))&&(p=!0),!p){if(!c&&V&&f&&(c=!0,C()),!f){const Y=rn($.sourceEvent,d),X=Y.x-u.x,L=Y.y-u.y;Math.sqrt(X*X+L*L)>R&&H($)}(s.x!==O.xSnapped||s.y!==O.ySnapped)&&r&&f&&(u=rn($.sourceEvent,d),A(O))}}).on("end",$=>{if(!(!f||p)&&(c=!1,f=!1,cancelAnimationFrame(i),r.size>0)){const{nodeLookup:V,updateNodePositions:N,onNodeDragStop:D,onSelectionDragStop:k}=t();if(x&&(N(r,!1),x=!1),a||D||!E&&k){const[R,z]=Fu({nodeId:E,dragItems:r,nodeLookup:V,dragging:!1});a==null||a($.sourceEvent,r,R,z),D==null||D($.sourceEvent,R,z),E||k==null||k($.sourceEvent,z)}}}).filter($=>{const V=$.target;return!$.button&&(!y||!Wm(V,`.${y}`,v))&&(!m||Wm(V,m,v))});h.call(T)}function g(){h==null||h.on(".drag",null)}return{update:w,destroy:g}}function pM(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())$i(a,ps(s))>0&&l.push(s);return l}const gM=250;function mM(e,t,n,l){var r,c;let a=[],s=1/0;const i=pM(e,n,t+gM);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}=pa(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 fb(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,...pa(i,c,c.position,!0)}:c}function hb(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function xM(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const pb=()=>!0;function yM(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=pb,onReconnectEnd:y,updateConnection:m,getTransform:v,getFromHandle:j,autoPanSpeed:E,dragThreshold:M=1,handleDomNode:A}){const C=tb(e.target);let H=0,T;const{x:$,y:V}=rn(e),N=hb(s,A),D=r==null?void 0:r.getBoundingClientRect();let k=!1;if(!D||!N)return;const R=fb(a,N,l,c,t);if(!R)return;let z=rn(e,D),O=!1,Y=null,X=!1,L=null;function U(){if(!d||!D)return;const[P,J]=J1(z,D,E);h({x:P,y:J}),H=requestAnimationFrame(U)}const _={...R,nodeId:a,type:N,position:R.position},B=c.get(a);let q={inProgress:!0,isValid:null,from:pa(B,_,ee.Left,!0),fromHandle:_,fromPosition:_.position,fromNode:B,to:z,toHandle:null,toPosition:$m[_.position],toNode:null,pointer:z};function Q(){k=!0,m(q),x==null||x(e,{nodeId:a,handleId:l,handleType:N})}M===0&&Q();function K(P){if(!k){const{x:ge,y:I}=rn(P),se=ge-$,Re=I-V;if(!(se*se+Re*Re>M*M))return;Q()}if(!j()||!_){W(P);return}const J=v();z=rn(P,D),T=mM(cr(z,J,!1,[1,1]),n,c,_),O||(U(),O=!0);const F=gb(P,{handle:T,connectionMode:t,fromNodeId:a,fromHandleId:l,fromType:i?"target":"source",isValidConnection:g,doc:C,lib:u,flowId:f,nodeLookup:c});L=F.handleDomNode,Y=F.connection,X=xM(!!T,F.isValid);const le=c.get(a),ae=le?pa(le,_,ee.Left,!0):q.from,te={...q,from:ae,isValid:X,to:F.toHandle&&X?dc({x:F.toHandle.x,y:F.toHandle.y},J):z,toHandle:F.toHandle,toPosition:X&&F.toHandle?F.toHandle.position:$m[_.position],toNode:F.toHandle?c.get(F.toHandle.nodeId):null,pointer:z};m(te),q=te}function W(P){if(!("touches"in P&&P.touches.length>0)){if(k){(T||L)&&Y&&X&&(S==null||S(Y));const{inProgress:J,...F}=q,le={...F,toPosition:q.toHandle?q.toPosition:null};w==null||w(P,le),s&&(y==null||y(P,le))}p(),cancelAnimationFrame(H),O=!1,X=!1,Y=null,L=null,C.removeEventListener("mousemove",K),C.removeEventListener("mouseup",W),C.removeEventListener("touchmove",K),C.removeEventListener("touchend",W)}}C.addEventListener("mousemove",K),C.addEventListener("mouseup",W),C.addEventListener("touchmove",K),C.addEventListener("touchend",W)}function gb(e,{handle:t,connectionMode:n,fromNodeId:l,fromHandleId:a,fromType:s,doc:i,lib:r,flowId:c,isValidConnection:u=pb,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}=rn(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=hb(void 0,w),m=w.getAttribute("data-nodeid"),v=w.getAttribute("data-handleid"),j=w.classList.contains("connectable"),E=w.classList.contains("connectableend");if(!m||!y)return g;const M={source:f?m:l,sourceHandle:f?v:a,target:f?l:m,targetHandle:f?a:v};g.connection=M;const C=j&&E&&(n===fs.Strict?f&&y==="source"||!f&&y==="target":m!==l||v!==a);g.isValid=C&&u(M),g.toHandle=fb(m,y,v,d,n,!0)}return g}const wf={onPointerDown:yM,isValid:gb};function vM({domNode:e,panZoom:t,getTransform:n,getViewScale:l}){const a=Ct(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&&Bi()?10:1,E=-m.sourceEvent.deltaY*(m.sourceEvent.deltaMode===1?.05:m.sourceEvent.deltaMode?1:.002)*d,M=v[2]*Math.pow(2,E*j);t.scaleTo(M)};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],E=[j[0]-S[0],j[1]-S[1]];S=j;const M=l()*Math.max(v[2],Math.log(v[2]))*(p?-1:1),A={x:v[0]-E[0]*M,y:v[1]-E[1]*M},C=[[0,0],[c,u]];t.setViewportConstrained({x:A.x,y:A.y,zoom:v[2]},C,r)},y=V1().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:tn}}const Qc=e=>({x:e.x,y:e.y,zoom:e.k}),Pu=({x:e,y:t,zoom:n})=>Vc.translate(e,t).scale(n),qa=(e,t)=>e.target.closest(`.${t}`),mb=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),bM=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,ed=(e,t=0,n=bM,l=()=>{})=>{const a=typeof t=="number"&&t>0;return a||l(),a?e.transition().duration(t).ease(n).on("end",l):e},xb=e=>{const t=e.ctrlKey&&Bi()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function wM({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:l,panOnScrollMode:a,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:r,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(qa(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=tn(d),g=xb(d),y=f*Math.pow(2,g);l.scaleTo(n,y,w,d);return}const h=d.deltaMode===1?20:1;let p=a===aa.Vertical?0:d.deltaX*h,x=a===aa.Horizontal?0:d.deltaY*h;!Bi()&&d.shiftKey&&a!==aa.Vertical&&(p=d.deltaY*h,x=0),l.translateBy(n,-(p/f)*s,-(x/f)*s,{internal:!0});const S=Qc(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 SM({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(l,a){const s=l.type==="wheel",i=!t&&s&&!l.ctrlKey,r=qa(l,e);if(l.ctrlKey&&s&&r&&l.preventDefault(),i||r)return null;l.preventDefault(),n.call(this,l,a)}}function NM({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return l=>{var s,i,r;if((s=l.sourceEvent)!=null&&s.internal)return;const a=Qc(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 jM({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:l,onPanZoom:a}){return s=>{var i,r;e.usedRightMouseButton=!!(n&&mb(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,Qc(s.transform)))}}function kM({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&&mb(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,l(!1),a)){const c=Qc(i.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a==null||a(i.sourceEvent,c)},n?150:0)}}}function EM({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"&&(qa(f,`${u}-flow__node`)||qa(f,`${u}-flow__edge`)))return!0;if(!l&&!h&&!a&&!s&&!n||i||d&&!x||qa(f,r)&&x||qa(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 CM({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=V1().scaleExtent([t,n]).translateExtent(l),h=Ct(e).call(f);y({x:a.x,y:a.y,zoom:hs(a.zoom,t,n)},[[0,0],[d.width,d.height]],l);const p=h.on("wheel.zoom"),x=h.on("dblclick.zoom");f.wheelDelta(xb);function S(T,$){return h?new Promise(V=>{f==null||f.interpolate(($==null?void 0:$.interpolate)==="linear"?pi:fo).transform(ed(h,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>V(!0)),T)}):Promise.resolve(!1)}function w({noWheelClassName:T,noPanClassName:$,onPaneContextMenu:V,userSelectionActive:N,panOnScroll:D,panOnDrag:k,panOnScrollMode:R,panOnScrollSpeed:z,preventScrolling:O,zoomOnPinch:Y,zoomOnScroll:X,zoomOnDoubleClick:L,zoomActivationKeyPressed:U,lib:_,onTransformChange:B,connectionInProgress:G,paneClickDistance:q,selectionOnDrag:Q}){N&&!u.isZoomingOrPanning&&g();const K=D&&!U&&!N;f.clickDistance(Q?1/0:!sn(q)||q<0?0:q);const W=K?wM({zoomPanValues:u,noWheelClassName:T,d3Selection:h,d3Zoom:f,panOnScrollMode:R,panOnScrollSpeed:z,zoomOnPinch:Y,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:r}):SM({noWheelClassName:T,preventScrolling:O,d3ZoomHandler:p});if(h.on("wheel.zoom",W,{passive:!1}),!N){const J=NM({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:i});f.on("start",J);const F=jM({zoomPanValues:u,panOnDrag:k,onPaneContextMenu:!!V,onPanZoom:s,onTransformChange:B});f.on("zoom",F);const le=kM({zoomPanValues:u,panOnDrag:k,panOnScroll:D,onPaneContextMenu:V,onPanZoomEnd:r,onDraggingChange:c});f.on("end",le)}const P=EM({zoomActivationKeyPressed:U,panOnDrag:k,zoomOnScroll:X,panOnScroll:D,zoomOnDoubleClick:L,zoomOnPinch:Y,userSelectionActive:N,noPanClassName:$,noWheelClassName:T,lib:_,connectionInProgress:G});f.filter(P),L?h.on("dblclick.zoom",x):h.on("dblclick.zoom",null)}function g(){f.on("zoom",null)}async function y(T,$,V){const N=Pu(T),D=f==null?void 0:f.constrain()(N,$,V);return D&&await S(D),new Promise(k=>k(D))}async function m(T,$){const V=Pu(T);return await S(V,$),new Promise(N=>N(V))}function v(T){if(h){const $=Pu(T),V=h.property("__zoom");(V.k!==T.zoom||V.x!==T.x||V.y!==T.y)&&(f==null||f.transform(h,$,null,{sync:!0}))}}function j(){const T=h?Y1(h.node()):{x:0,y:0,k:1};return{x:T.x,y:T.y,zoom:T.k}}function E(T,$){return h?new Promise(V=>{f==null||f.interpolate(($==null?void 0:$.interpolate)==="linear"?pi:fo).scaleTo(ed(h,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>V(!0)),T)}):Promise.resolve(!1)}function M(T,$){return h?new Promise(V=>{f==null||f.interpolate(($==null?void 0:$.interpolate)==="linear"?pi:fo).scaleBy(ed(h,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>V(!0)),T)}):Promise.resolve(!1)}function A(T){f==null||f.scaleExtent(T)}function C(T){f==null||f.translateExtent(T)}function H(T){const $=!sn(T)||T<0?0:T;f==null||f.clickDistance($)}return{update:w,destroy:g,setViewport:m,setViewportConstrained:y,getViewport:j,scaleTo:E,scaleBy:M,setScaleExtent:A,setTranslateExtent:C,syncViewport:v,setClickDistance:H}}var ms;(function(e){e.Line="line",e.Handle="handle"})(ms||(ms={}));function MM({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 Jm(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 rl(e,t){return Math.max(0,t-e)}function ol(e,t){return Math.max(0,e-t)}function Yr(e,t,n){return Math.max(0,t-e,e-n)}function Fm(e,t){return e?!t:t}function _M(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:E,aspectRatio:M}=e;let A=Math.floor(d?p-e.pointerX:0),C=Math.floor(f?x-e.pointerY:0);const H=j+(c?-A:A),T=E+(u?-C:C),$=-s[0]*j,V=-s[1]*E;let N=Yr(H,S,w),D=Yr(T,g,y);if(i){let z=0,O=0;c&&A<0?z=rl(m+A+$,i[0][0]):!c&&A>0&&(z=ol(m+H+$,i[1][0])),u&&C<0?O=rl(v+C+V,i[0][1]):!u&&C>0&&(O=ol(v+T+V,i[1][1])),N=Math.max(N,z),D=Math.max(D,O)}if(r){let z=0,O=0;c&&A>0?z=ol(m+A,r[0][0]):!c&&A<0&&(z=rl(m+H,r[1][0])),u&&C>0?O=ol(v+C,r[0][1]):!u&&C<0&&(O=rl(v+T,r[1][1])),N=Math.max(N,z),D=Math.max(D,O)}if(a){if(d){const z=Yr(H/M,g,y)*M;if(N=Math.max(N,z),i){let O=0;!c&&!u||c&&!u&&h?O=ol(v+V+H/M,i[1][1])*M:O=rl(v+V+(c?A:-A)/M,i[0][1])*M,N=Math.max(N,O)}if(r){let O=0;!c&&!u||c&&!u&&h?O=rl(v+H/M,r[1][1])*M:O=ol(v+(c?A:-A)/M,r[0][1])*M,N=Math.max(N,O)}}if(f){const z=Yr(T*M,S,w)/M;if(D=Math.max(D,z),i){let O=0;!c&&!u||u&&!c&&h?O=ol(m+T*M+$,i[1][0])/M:O=rl(m+(u?C:-C)*M+$,i[0][0])/M,D=Math.max(D,O)}if(r){let O=0;!c&&!u||u&&!c&&h?O=rl(m+T*M,r[1][0])/M:O=ol(m+(u?C:-C)*M,r[0][0])/M,D=Math.max(D,O)}}}C=C+(C<0?D:-D),A=A+(A<0?N:-N),a&&(h?H>T*M?C=(Fm(c,u)?-A:A)/M:A=(Fm(c,u)?-C:C)*M:d?(C=A/M,u=c):(A=C*M,c=u));const k=c?m+A:m,R=u?v+C:v;return{width:j+(c?-A:A),height:E+(u?-C:C),x:s[0]*A*(c?-1:1)+k,y:s[1]*C*(u?-1:1)+R}}const yb={width:0,height:0,x:0,y:0},AM={...yb,pointerX:0,pointerY:0,aspectRatio:1};function TM(e){return[[0,0],[e.measured.width,e.measured.height]]}function zM(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 DM({domNode:e,nodeId:t,getStoreItems:n,onChange:l,onEnd:a}){const s=Ct(e);let i={controlDirection:Jm("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={...yb},y={...AM};i={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:Jm(u)};let m,v=null,j=[],E,M,A,C=!1;const H=M1().on("start",T=>{const{nodeLookup:$,transform:V,snapGrid:N,snapToGrid:D,nodeOrigin:k,paneDomNode:R}=n();if(m=$.get(t),!m)return;v=(R==null?void 0:R.getBoundingClientRect())??null;const{xSnapped:z,ySnapped:O}=gi(T.sourceEvent,{transform:V,snapGrid:N,snapToGrid:D,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:z,pointerY:O,aspectRatio:g.width/g.height},E=void 0,m.parentId&&(m.extent==="parent"||m.expandParent)&&(E=$.get(m.parentId),M=E&&m.extent==="parent"?TM(E):void 0),j=[],A=void 0;for(const[Y,X]of $)if(X.parentId===t&&(j.push({id:Y,position:{...X.position},extent:X.extent}),X.extent==="parent"||X.expandParent)){const L=zM(X,m,X.origin??k);A?A=[[Math.min(L[0][0],A[0][0]),Math.min(L[0][1],A[0][1])],[Math.max(L[1][0],A[1][0]),Math.max(L[1][1],A[1][1])]]:A=L}p==null||p(T,{...g})}).on("drag",T=>{const{transform:$,snapGrid:V,snapToGrid:N,nodeOrigin:D}=n(),k=gi(T.sourceEvent,{transform:$,snapGrid:V,snapToGrid:N,containerBounds:v}),R=[];if(!m)return;const{x:z,y:O,width:Y,height:X}=g,L={},U=m.origin??D,{width:_,height:B,x:G,y:q}=_M(y,i.controlDirection,k,i.boundaries,i.keepAspectRatio,U,M,A),Q=_!==Y,K=B!==X,W=G!==z&&Q,P=q!==O&&K;if(!W&&!P&&!Q&&!K)return;if((W||P||U[0]===1||U[1]===1)&&(L.x=W?G:g.x,L.y=P?q:g.y,g.x=L.x,g.y=L.y,j.length>0)){const ae=G-z,te=q-O;for(const ge of j)ge.position={x:ge.position.x-ae+U[0]*(_-Y),y:ge.position.y-te+U[1]*(B-X)},R.push(ge)}if((Q||K)&&(L.width=Q&&(!i.resizeDirection||i.resizeDirection==="horizontal")?_:g.width,L.height=K&&(!i.resizeDirection||i.resizeDirection==="vertical")?B:g.height,g.width=L.width,g.height=L.height),E&&m.expandParent){const ae=U[0]*(L.width??0);L.x&&L.x<ae&&(g.x=ae,y.x=y.x-(L.x-ae));const te=U[1]*(L.height??0);L.y&&L.y<te&&(g.y=te,y.y=y.y-(L.y-te))}const J=MM({width:g.width,prevWidth:Y,height:g.height,prevHeight:X,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),F={...g,direction:J};(w==null?void 0:w(T,F))!==!1&&(C=!0,x==null||x(T,F),l(L,R))}).on("end",T=>{C&&(S==null||S(T,{...g}),a==null||a({...g}),C=!1)});s.call(H)}function c(){s.on(".drag",null)}return{update:r,destroy:c}}var vb={exports:{}},bb={},wb={exports:{}},Sb={};/**
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 xs=b;function RM(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var OM=typeof Object.is=="function"?Object.is:RM,HM=xs.useState,LM=xs.useEffect,$M=xs.useLayoutEffect,BM=xs.useDebugValue;function UM(e,t){var n=t(),l=HM({inst:{value:n,getSnapshot:t}}),a=l[0].inst,s=l[1];return $M(function(){a.value=n,a.getSnapshot=t,td(a)&&s({inst:a})},[e,n,t]),LM(function(){return td(a)&&s({inst:a}),e(function(){td(a)&&s({inst:a})})},[e]),BM(n),n}function td(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!OM(e,n)}catch{return!0}}function qM(e,t){return t()}var YM=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?qM:UM;Sb.useSyncExternalStore=xs.useSyncExternalStore!==void 0?xs.useSyncExternalStore:YM;wb.exports=Sb;var VM=wb.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 Zc=b,XM=VM;function GM(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var QM=typeof Object.is=="function"?Object.is:GM,ZM=XM.useSyncExternalStore,IM=Zc.useRef,KM=Zc.useEffect,WM=Zc.useMemo,JM=Zc.useDebugValue;bb.useSyncExternalStoreWithSelector=function(e,t,n,l,a){var s=IM(null);if(s.current===null){var i={hasValue:!1,value:null};s.current=i}else i=s.current;s=WM(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,QM(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=ZM(e,s[0],s[1]);return KM(function(){i.hasValue=!0,i.value=r},[r]),JM(r),r};vb.exports=bb;var FM=vb.exports;const PM=jx(FM),e_={},Pm=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:()=>{(e_?"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},t_=e=>e?Pm(e):Pm,{useDebugValue:n_}=Me,{useSyncExternalStoreWithSelector:l_}=PM,a_=e=>e;function Nb(e,t=a_,n){const l=l_(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return n_(l),l}const ex=(e,t)=>{const n=t_(e),l=(a,s=t)=>Nb(n,a,s);return Object.assign(l,n),l},s_=(e,t)=>e?ex(e,t):ex;function ze(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 Ic=b.createContext(null),i_=Ic.Provider,jb=jn.error001();function he(e,t){const n=b.useContext(Ic);if(n===null)throw new Error(jb);return Nb(n,e,t)}function De(){const e=b.useContext(Ic);if(e===null)throw new Error(jb);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const tx={display:"none"},r_={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},kb="react-flow__node-desc",Eb="react-flow__edge-desc",o_="react-flow__aria-live",c_=e=>e.ariaLiveMessage,u_=e=>e.ariaLabelConfig;function d_({rfId:e}){const t=he(c_);return o.jsx("div",{id:`${o_}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:r_,children:t})}function f_({rfId:e,disableKeyboardA11y:t}){const n=he(u_);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${kb}-${e}`,style:tx,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${Eb}-${e}`,style:tx,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(d_,{rfId:e})]})}const Kc=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})});Kc.displayName="Panel";function h_({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(Kc,{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 p_=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}},Vr=e=>e.id;function g_(e,t){return ze(e.selectedNodes.map(Vr),t.selectedNodes.map(Vr))&&ze(e.selectedEdges.map(Vr),t.selectedEdges.map(Vr))}function m_({onSelectionChange:e}){const t=De(),{selectedNodes:n,selectedEdges:l}=he(p_,g_);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 x_=e=>!!e.onSelectionChangeHandlers;function y_({onSelectionChange:e}){const t=he(x_);return e||t?o.jsx(m_,{onSelectionChange:e}):null}const Sf=typeof window<"u"?b.useLayoutEffect:b.useEffect,Cb=[0,0],v_={x:0,y:0,zoom:1},b_=["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"],nx=[...b_,"rfId"],w_=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}),lx={translateExtent:Hi,nodeOrigin:Cb,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function S_(e){const{setNodes:t,setEdges:n,setMinZoom:l,setMaxZoom:a,setTranslateExtent:s,setNodeExtent:i,reset:r,setDefaultNodesAndEdges:c}=he(w_,ze),u=De();Sf(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=lx,r()}),[]);const d=b.useRef(lx);return Sf(()=>{for(const f of nx){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:G4(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},nx.map(f=>e[f])),null}function ax(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function N_(e){var l;const[t,n]=b.useState(e==="system"?null:e);return b.useEffect(()=>{if(e!=="system"){n(e);return}const a=ax(),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=ax())!=null&&l.matches?"dark":"light"}const sx=typeof document<"u"?document:null;function Ui(e=null,t={target:sx,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)??sx,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)&&nb(p))return!1;const S=rx(p.code,r);if(s.current.add(p[S]),ix(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=rx(p.code,r);ix(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 ix(e,t,n){return e.filter(l=>n||l.length===t.size).some(l=>l.every(a=>t.has(a)))}function rx(e,t){return t.includes(e)?"code":"key"}const j_=()=>{const e=De();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=tp(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 cr(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=dc(t,n);return{x:i.x+a,y:i.y+s}}}),[])};function Mb(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)k_(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 k_(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 _b(e,t){return Mb(e,t)}function Ab(e,t){return Mb(e,t)}function Il(e,t){return{id:e,type:"select",selected:t}}function Ya(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(Il(s.id,i)))}return l}function ox({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 cx(e){return{id:e.id,type:"remove"}}const ux=e=>O4(e),E_=e=>I1(e);function Tb(e){return b.forwardRef(e)}function dx(e){const[t,n]=b.useState(BigInt(0)),[l]=b.useState(()=>C_(()=>n(a=>a+BigInt(1))));return Sf(()=>{const a=l.get();a.length&&(e(a),l.reset())},[t]),l}function C_(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const zb=b.createContext(null);function M_({children:e}){const t=De(),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=ox({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=dx(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(ox({items:p,lookup:h}))},[]),s=dx(a),i=b.useMemo(()=>({nodeQueue:l,edgeQueue:s}),[]);return o.jsx(zb.Provider,{value:i,children:e})}function __(){const e=b.useContext(zb);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const A_=e=>!!e.panZoom;function op(){const e=j_(),t=De(),n=__(),l=he(A_),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=ux(f)?f:h.get(f.id),S=x.parentId?eb(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 ps(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&&ux(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&&E_(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:E}=await U4({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:x,onBeforeDelete:v}),M=E.length>0,A=j.length>0;if(M){const C=E.map(cx);w==null||w(E),y(C)}if(A){const C=j.map(cx);S==null||S(j),g(C)}return(A||M)&&(m==null||m({nodes:j,edges:E})),{deletedNodes:j,deletedEdges:E}},getIntersectingNodes:(f,h=!0,p)=>{const x=Um(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=ps(w?g:y),v=$i(m,S);return h&&v>0||v>=m.width*m.height||v>=S.width*S.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const S=Um(f)?f:c(f);if(!S)return!1;const w=$i(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 H4(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??X4();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 fx=e=>e.selected,T_=typeof window<"u"?window:void 0;function z_({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=De(),{deleteElements:l}=op(),a=Ui(e,{actInsideInputWithModifier:!1}),s=Ui(t,{target:T_});b.useEffect(()=>{if(a){const{edges:i,nodes:r}=n.getState();l({nodes:r.filter(fx),edges:i.filter(fx)}),n.setState({nodesSelectionActive:!1})}},[a]),b.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function D_(e){const t=De();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=np(e.current);(l.height===0||l.width===0)&&((r=(i=t.getState()).onError)==null||r.call(i,"004",jn.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 Wc={position:"absolute",width:"100%",height:"100%",top:0,left:0},R_=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function O_({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:l=!1,panOnScrollSpeed:a=.5,panOnScrollMode:s=aa.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=De(),E=b.useRef(null),{userSelectionActive:M,lib:A,connectionInProgress:C}=he(R_,ze),H=Ui(h),T=b.useRef();D_(E);const $=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(E.current){T.current=CM({domNode:E.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:k=>j.setState(R=>R.paneDragging===k?R:{paneDragging:k}),onPanZoomStart:(k,R)=>{const{onViewportChangeStart:z,onMoveStart:O}=j.getState();O==null||O(k,R),z==null||z(R)},onPanZoom:(k,R)=>{const{onViewportChange:z,onMove:O}=j.getState();O==null||O(k,R),z==null||z(R)},onPanZoomEnd:(k,R)=>{const{onViewportChangeEnd:z,onMoveEnd:O}=j.getState();O==null||O(k,R),z==null||z(R)}});const{x:V,y:N,zoom:D}=T.current.getViewport();return j.setState({panZoom:T.current,transform:[V,N,D],domNode:E.current.closest(".react-flow")}),()=>{var k;(k=T.current)==null||k.destroy()}}},[]),b.useEffect(()=>{var V;(V=T.current)==null||V.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:l,panOnScrollSpeed:a,panOnScrollMode:s,zoomOnDoubleClick:i,panOnDrag:r,zoomActivationKeyPressed:H,preventScrolling:p,noPanClassName:w,userSelectionActive:M,noWheelClassName:S,lib:A,onTransformChange:$,connectionInProgress:C,selectionOnDrag:v,paneClickDistance:m})},[e,t,n,l,a,s,i,r,H,p,w,M,S,A,$,C,v,m]),o.jsx("div",{className:"react-flow__renderer",ref:E,style:Wc,children:x})}const H_=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function L_(){const{userSelectionActive:e,userSelectionRect:t}=he(H_,ze);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 nd=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},$_=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function B_({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Li.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=De(),{userSelectionActive:w,elementsSelectable:g,dragging:y,connectionInProgress:m}=he($_,ze),v=g&&(e||w),j=b.useRef(null),E=b.useRef(),M=b.useRef(new Set),A=b.useRef(new Set),C=b.useRef(!1),H=z=>{if(C.current||m){C.current=!1;return}c==null||c(z),S.getState().resetSelectedElements(),S.setState({nodesSelectionActive:!1})},T=z=>{if(Array.isArray(l)&&(l!=null&&l.includes(2))){z.preventDefault();return}u==null||u(z)},$=d?z=>d(z):void 0,V=z=>{C.current&&(z.stopPropagation(),C.current=!1)},N=z=>{var B,G;const{domNode:O}=S.getState();if(E.current=O==null?void 0:O.getBoundingClientRect(),!E.current)return;const Y=z.target===j.current;if(!Y&&!!z.target.closest(".nokey")||!e||!(s&&Y||t)||z.button!==0||!z.isPrimary)return;(G=(B=z.target)==null?void 0:B.setPointerCapture)==null||G.call(B,z.pointerId),C.current=!1;const{x:U,y:_}=rn(z.nativeEvent,E.current);S.setState({userSelectionRect:{width:0,height:0,startX:U,startY:_,x:U,y:_}}),Y||(z.stopPropagation(),z.preventDefault())},D=z=>{const{userSelectionRect:O,transform:Y,nodeLookup:X,edgeLookup:L,connectionLookup:U,triggerNodeChanges:_,triggerEdgeChanges:B,defaultEdgeOptions:G,resetSelectedElements:q}=S.getState();if(!E.current||!O)return;const{x:Q,y:K}=rn(z.nativeEvent,E.current),{startX:W,startY:P}=O;if(!C.current){const te=t?0:a;if(Math.hypot(Q-W,K-P)<=te)return;q(),i==null||i(z)}C.current=!0;const J={startX:W,startY:P,x:Q<W?Q:W,y:K<P?K:P,width:Math.abs(Q-W),height:Math.abs(K-P)},F=M.current,le=A.current;M.current=new Set(ep(X,J,Y,n===Li.Partial,!0).map(te=>te.id)),A.current=new Set;const ae=(G==null?void 0:G.selectable)??!0;for(const te of M.current){const ge=U.get(te);if(ge)for(const{edgeId:I}of ge.values()){const se=L.get(I);se&&(se.selectable??ae)&&A.current.add(I)}}if(!qm(F,M.current)){const te=Ya(X,M.current,!0);_(te)}if(!qm(le,A.current)){const te=Ya(L,A.current);B(te)}S.setState({userSelectionRect:J,userSelectionActive:!0,nodesSelectionActive:!1})},k=z=>{var O,Y;z.button===0&&((Y=(O=z.target)==null?void 0:O.releasePointerCapture)==null||Y.call(O,z.pointerId),!w&&z.target===j.current&&S.getState().userSelectionRect&&(H==null||H(z)),S.setState({userSelectionActive:!1,userSelectionRect:null}),C.current&&(r==null||r(z),S.setState({nodesSelectionActive:M.current.size>0})))},R=l===!0||Array.isArray(l)&&l.includes(0);return o.jsxs("div",{className:Ve(["react-flow__pane",{draggable:R,dragging:y,selection:e}]),onClick:v?void 0:nd(H,j),onContextMenu:nd(T,j),onWheel:nd($,j),onPointerEnter:v?void 0:f,onPointerMove:v?D:h,onPointerUp:v?k:void 0,onPointerDownCapture:v?N:void 0,onClickCapture:v?V:void 0,onPointerLeave:p,ref:j,style:Wc,children:[x,o.jsx(L_,{})]})}function Nf({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",jn.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 Db({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:l,nodeId:a,isSelectable:s,nodeClickDistance:i}){const r=De(),[c,u]=b.useState(!1),d=b.useRef();return b.useEffect(()=>{d.current=hM({getStoreItems:()=>r.getState(),onNodeMouseDown:f=>{Nf({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 U_=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Rb(){const e=De();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=U_(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=or(y,s));const{position:m,positionAbsolute:v}=K1({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 cp=b.createContext(null),q_=cp.Provider;cp.Consumer;const Ob=()=>b.useContext(cp),Y_=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),V_=(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===fs.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 X_({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 D,k;const x=i||null,S=e==="target",w=De(),g=Ob(),{connectOnClick:y,noPanClassName:m,rfId:v}=he(Y_,ze),{connectingFrom:j,connectingTo:E,clickConnecting:M,isPossibleEndHandle:A,connectionInProcess:C,clickConnectionInProcess:H,valid:T}=he(V_(g,x,e),ze);g||(k=(D=w.getState()).onError)==null||k.call(D,"010",jn.error010());const $=R=>{const{defaultEdgeOptions:z,onConnect:O,hasDefaultEdges:Y}=w.getState(),X={...z,...R};if(Y){const{edges:L,setEdges:U}=w.getState();U(J4(X,L))}O==null||O(X),r==null||r(X)},V=R=>{if(!g)return;const z=lb(R.nativeEvent);if(a&&(z&&R.button===0||!z)){const O=w.getState();wf.onPointerDown(R.nativeEvent,{handleDomNode:R.currentTarget,autoPanOnConnect:O.autoPanOnConnect,connectionMode:O.connectionMode,connectionRadius:O.connectionRadius,domNode:O.domNode,nodeLookup:O.nodeLookup,lib:O.lib,isTarget:S,handleId:x,nodeId:g,flowId:O.rfId,panBy:O.panBy,cancelConnection:O.cancelConnection,onConnectStart:O.onConnectStart,onConnectEnd:(...Y)=>{var X,L;return(L=(X=w.getState()).onConnectEnd)==null?void 0:L.call(X,...Y)},updateConnection:O.updateConnection,onConnect:$,isValidConnection:n||((...Y)=>{var X,L;return((L=(X=w.getState()).isValidConnection)==null?void 0:L.call(X,...Y))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:O.autoPanSpeed,dragThreshold:O.connectionDragThreshold})}z?d==null||d(R):f==null||f(R)},N=R=>{const{onClickConnectStart:z,onClickConnectEnd:O,connectionClickStartHandle:Y,connectionMode:X,isValidConnection:L,lib:U,rfId:_,nodeLookup:B,connection:G}=w.getState();if(!g||!Y&&!a)return;if(!Y){z==null||z(R.nativeEvent,{nodeId:g,handleId:x,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:g,type:e,id:x}});return}const q=tb(R.target),Q=n||L,{connection:K,isValid:W}=wf.isValid(R.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:B});W&&K&&$(K);const P=structuredClone(G);delete P.inProgress,P.toPosition=P.toHandle?P.toHandle.position:null,O==null||O(R,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:M,connectingfrom:j,connectingto:E,valid:T,connectionindicator:l&&(!C||A)&&(C||H?s:a)}]),onMouseDown:V,onTouchStart:V,onClick:y?N:void 0,ref:p,...h,children:c})}const ys=b.memo(Tb(X_));function G_({data:e,isConnectable:t,sourcePosition:n=ee.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(ys,{type:"source",position:n,isConnectable:t})]})}function Q_({data:e,isConnectable:t,targetPosition:n=ee.Top,sourcePosition:l=ee.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(ys,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(ys,{type:"source",position:l,isConnectable:t})]})}function Z_(){return null}function I_({data:e,isConnectable:t,targetPosition:n=ee.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(ys,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const fc={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},hx={input:G_,default:Q_,output:I_,group:Z_};function K_(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 W_=e=>{const{width:t,height:n,x:l,y:a}=rr(e.nodeLookup,{filter:s=>!!s.selected});return{width:sn(t)?t:null,height:sn(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 J_({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const l=De(),{width:a,height:s,transformString:i,userSelectionActive:r}=he(W_,ze),c=Rb(),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(Db({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(fc,p.key)&&(p.preventDefault(),c({direction:fc[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 px=typeof window<"u"?window:void 0,F_=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Hb({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:E,zoomOnDoubleClick:M,panOnDrag:A,defaultViewport:C,translateExtent:H,minZoom:T,maxZoom:$,preventScrolling:V,onSelectionContextMenu:N,noWheelClassName:D,noPanClassName:k,disableKeyboardA11y:R,onViewportChange:z,isControlledViewport:O}){const{nodesSelectionActive:Y,userSelectionActive:X}=he(F_,ze),L=Ui(u,{target:px}),U=Ui(S,{target:px}),_=U||A,B=U||v,G=d&&_!==!0,q=L||X||G;return z_({deleteKeyCode:c,multiSelectionKeyCode:x}),o.jsx(O_,{onPaneContextMenu:s,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:m,panOnScroll:B,panOnScrollSpeed:j,panOnScrollMode:E,zoomOnDoubleClick:M,panOnDrag:!L&&_,defaultViewport:C,translateExtent:H,minZoom:T,maxZoom:$,zoomActivationKeyCode:w,preventScrolling:V,noWheelClassName:D,noPanClassName:k,onViewportChange:z,isControlledViewport:O,paneClickDistance:r,selectionOnDrag:G,children:o.jsxs(B_,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:l,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:_,isSelecting:!!q,selectionMode:f,selectionKeyPressed:L,paneClickDistance:r,selectionOnDrag:G,children:[e,Y&&o.jsx(J_,{onSelectionContextMenu:N,noPanClassName:k,disableKeyboardA11y:R})]})})}Hb.displayName="FlowRenderer";const P_=b.memo(Hb),eA=e=>t=>e?ep(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 tA(e){return he(b.useCallback(eA(e),[e]),ze)}const nA=e=>e.updateNodeInternals;function lA(){const e=he(nA),[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 aA({node:e,nodeType:t,hasDimensions:n,resizeObserver:l}){const a=De(),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 sA({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),W=Q.parentLookup.has(e);return{node:K,internals:K.internals,isParent:W}},ze);let E=m.type||"default",M=(w==null?void 0:w[E])||hx[E];M===void 0&&(y==null||y("003",jn.error003(E)),E="default",M=(w==null?void 0:w.default)||hx.default);const A=!!(m.draggable||r&&typeof m.draggable>"u"),C=!!(m.selectable||c&&typeof m.selectable>"u"),H=!!(m.connectable||u&&typeof m.connectable>"u"),T=!!(m.focusable||d&&typeof m.focusable>"u"),$=De(),V=P1(m),N=aA({node:m,nodeType:E,hasDimensions:V,resizeObserver:f}),D=Db({nodeRef:N,disabled:m.hidden||!A,noDragClassName:h,handleSelector:m.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:g}),k=Rb();if(m.hidden)return null;const R=nl(m),z=K_(m),O=C||A||t||n||l||a,Y=n?Q=>n(Q,{...v.userNode}):void 0,X=l?Q=>l(Q,{...v.userNode}):void 0,L=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,B=Q=>{const{selectNodesOnDrag:K,nodeDragThreshold:W}=$.getState();C&&(!K||!A||W>0)&&Nf({id:e,store:$,nodeRef:N}),t&&t(Q,{...v.userNode})},G=Q=>{if(!(nb(Q.nativeEvent)||x)){if(X1.includes(Q.key)&&C){const K=Q.key==="Escape";Nf({id:e,store:$,unselect:K,nodeRef:N})}else if(A&&m.selected&&Object.prototype.hasOwnProperty.call(fc,Q.key)){Q.preventDefault();const{ariaLabelConfig:K}=$.getState();$.setState({ariaLiveMessage:K["node.a11yDescription.ariaLiveMessage"]({direction:Q.key.replace("Arrow","").toLowerCase(),x:~~v.positionAbsolute.x,y:~~v.positionAbsolute.y})}),k({direction:fc[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:W,autoPanOnNodeFocus:P,setCenter:J}=$.getState();if(!P)return;ep(new Map([[e,m]]),{x:0,y:0,width:K,height:W},Q,!0).length>0||J(m.position.x+R.width/2,m.position.y+R.height/2,{zoom:Q[2]})};return o.jsx("div",{className:Ve(["react-flow__node",`react-flow__node-${E}`,{[p]:A},m.className,{selected:m.selected,selectable:C,parent:j,draggable:A,dragging:D}]),ref:N,style:{zIndex:v.z,transform:`translate(${v.positionAbsolute.x}px,${v.positionAbsolute.y}px)`,pointerEvents:O?"all":"none",visibility:V?"visible":"hidden",...m.style,...z},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:Y,onMouseMove:X,onMouseLeave:L,onContextMenu:U,onClick:B,onDoubleClick:_,onKeyDown:T?G:void 0,tabIndex:T?0:void 0,onFocus:T?q:void 0,role:m.ariaRole??(T?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${kb}-${S}`,"aria-label":m.ariaLabel,...m.domAttributes,children:o.jsx(q_,{value:e,children:o.jsx(M,{id:e,data:m.data,type:E,positionAbsoluteX:v.positionAbsolute.x,positionAbsoluteY:v.positionAbsolute.y,selected:m.selected??!1,selectable:C,draggable:A,deletable:m.deletable??!0,isConnectable:H,sourcePosition:m.sourcePosition,targetPosition:m.targetPosition,dragging:D,dragHandle:m.dragHandle,zIndex:v.z,parentId:m.parentId,...R})})})}var iA=b.memo(sA);const rA=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Lb(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:l,elementsSelectable:a,onError:s}=he(rA,ze),i=tA(e.onlyRenderVisibleElements),r=lA();return o.jsx("div",{className:"react-flow__nodes",style:Wc,children:i.map(c=>o.jsx(iA,{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))})}Lb.displayName="NodeRenderer";const oA=b.memo(Lb);function cA(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&&I4({sourceNode:s,targetNode:i,width:n.width,height:n.height,transform:n.transform})&&l.push(a.id)}return l},[e]),ze)}const uA=({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"})},dA=({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"})},gx={[cc.Arrow]:uA,[cc.ArrowClosed]:dA};function fA(e){const t=De();return b.useMemo(()=>{var a,s;return Object.prototype.hasOwnProperty.call(gx,e)?gx[e]:((s=(a=t.getState()).onError)==null||s.call(a,"009",jn.error009(e)),null)},[e])}const hA=({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=fA(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},$b=({defaultColor:e,rfId:t})=>{const n=he(s=>s.edges),l=he(s=>s.defaultEdgeOptions),a=b.useMemo(()=>nM(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(hA,{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};$b.displayName="MarkerDefinitions";var pA=b.memo($b);function Bb({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}Bb.displayName="EdgeText";const gA=b.memo(Bb);function Jc({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&&sn(t)&&sn(n)?o.jsx(gA,{x:t,y:n,label:l,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:r,labelBgBorderRadius:c}):null]})}function mx({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 Ub({sourceX:e,sourceY:t,sourcePosition:n=ee.Bottom,targetX:l,targetY:a,targetPosition:s=ee.Top}){const[i,r]=mx({pos:n,x1:e,y1:t,x2:l,y2:a}),[c,u]=mx({pos:s,x1:l,y1:a,x2:e,y2:t}),[d,f,h,p]=ab({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 qb(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]=Ub({sourceX:n,sourceY:l,sourcePosition:i,targetX:a,targetY:s,targetPosition:r}),j=e.isInternal?void 0:t;return o.jsx(Jc,{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 mA=qb({isInternal:!1}),Yb=qb({isInternal:!0});mA.displayName="SimpleBezierEdge";Yb.displayName="SimpleBezierEdgeInternal";function Vb(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]=yf({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}),E=e.isInternal?void 0:t;return o.jsx(Jc,{id:E,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 Xb=Vb({isInternal:!1}),Gb=Vb({isInternal:!0});Xb.displayName="SmoothStepEdge";Gb.displayName="SmoothStepEdgeInternal";function Qb(e){return b.memo(({id:t,...n})=>{var a;const l=e.isInternal?void 0:t;return o.jsx(Xb,{...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 xA=Qb({isInternal:!1}),Zb=Qb({isInternal:!0});xA.displayName="StepEdge";Zb.displayName="StepEdgeInternal";function Ib(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]=rb({sourceX:n,sourceY:l,targetX:a,targetY:s}),m=e.isInternal?void 0:t;return o.jsx(Jc,{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 yA=Ib({isInternal:!1}),Kb=Ib({isInternal:!0});yA.displayName="StraightEdge";Kb.displayName="StraightEdgeInternal";function Wb(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]=sb({sourceX:n,sourceY:l,sourcePosition:i,targetX:a,targetY:s,targetPosition:r,curvature:g==null?void 0:g.curvature}),E=e.isInternal?void 0:t;return o.jsx(Jc,{id:E,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 vA=Wb({isInternal:!1}),Jb=Wb({isInternal:!0});vA.displayName="BezierEdge";Jb.displayName="BezierEdgeInternal";const xx={default:Jb,straight:Kb,step:Zb,smoothstep:Gb,simplebezier:Yb},yx={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},bA=(e,t,n)=>n===ee.Left?e-t:n===ee.Right?e+t:e,wA=(e,t,n)=>n===ee.Top?e-t:n===ee.Bottom?e+t:e,vx="react-flow__edgeupdater";function bx({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([vx,`${vx}-${r}`]),cx:bA(t,l,e),cy:wA(n,l,e),r:l,stroke:"transparent",fill:"transparent"})}function SA({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=De(),S=(v,j)=>{if(v.button!==0)return;const{autoPanOnConnect:E,domNode:M,connectionMode:A,connectionRadius:C,lib:H,onConnectStart:T,cancelConnection:$,nodeLookup:V,rfId:N,panBy:D,updateConnection:k}=x.getState(),R=j.type==="target",z=(X,L)=>{h(!1),f==null||f(X,n,j.type,L)},O=X=>u==null?void 0:u(n,X),Y=(X,L)=>{h(!0),d==null||d(v,n,j.type),T==null||T(X,L)};wf.onPointerDown(v.nativeEvent,{autoPanOnConnect:E,connectionMode:A,connectionRadius:C,domNode:M,handleId:j.id,nodeId:j.nodeId,nodeLookup:V,isTarget:R,edgeUpdaterType:j.type,lib:H,flowId:N,cancelConnection:$,panBy:D,isValidConnection:(...X)=>{var L,U;return((U=(L=x.getState()).isValidConnection)==null?void 0:U.call(L,...X))??!0},onConnect:O,onConnectStart:Y,onConnectEnd:(...X)=>{var L,U;return(U=(L=x.getState()).onConnectEnd)==null?void 0:U.call(L,...X)},onReconnectEnd:z,updateConnection:k,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(bx,{position:r,centerX:l,centerY:a,radius:t,onMouseDown:w,onMouseEnter:y,onMouseOut:m,type:"source"}),(e===!0||e==="target")&&o.jsx(bx,{position:c,centerX:s,centerY:i,radius:t,onMouseDown:g,onMouseEnter:y,onMouseOut:m,type:"target"})]})}function NA({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(J=>J.edgeLookup.get(e));const v=he(J=>J.defaultEdgeOptions);m=v?{...v,...m}:m;let j=m.type||"default",E=(S==null?void 0:S[j])||xx[j];E===void 0&&(g==null||g("011",jn.error011(j)),j="default",E=(S==null?void 0:S.default)||xx.default);const M=!!(m.focusable||t&&typeof m.focusable>"u"),A=typeof f<"u"&&(m.reconnectable||n&&typeof m.reconnectable>"u"),C=!!(m.selectable||l&&typeof m.selectable>"u"),H=b.useRef(null),[T,$]=b.useState(!1),[V,N]=b.useState(!1),D=De(),{zIndex:k,sourceX:R,sourceY:z,targetX:O,targetY:Y,sourcePosition:X,targetPosition:L}=he(b.useCallback(J=>{const F=J.nodeLookup.get(m.source),le=J.nodeLookup.get(m.target);if(!F||!le)return{zIndex:m.zIndex,...yx};const ae=tM({id:e,sourceNode:F,targetNode:le,sourceHandle:m.sourceHandle||null,targetHandle:m.targetHandle||null,connectionMode:J.connectionMode,onError:g});return{zIndex:Z4({selected:m.selected,zIndex:m.zIndex,sourceNode:F,targetNode:le,elevateOnSelect:J.elevateEdgesOnSelect,zIndexMode:J.zIndexMode}),...ae||yx}},[m.source,m.target,m.sourceHandle,m.targetHandle,m.selected,m.zIndex]),ze),U=b.useMemo(()=>m.markerStart?`url('#${vf(m.markerStart,x)}')`:void 0,[m.markerStart,x]),_=b.useMemo(()=>m.markerEnd?`url('#${vf(m.markerEnd,x)}')`:void 0,[m.markerEnd,x]);if(m.hidden||R===null||z===null||O===null||Y===null)return null;const B=J=>{var te;const{addSelectedEdges:F,unselectNodesAndEdges:le,multiSelectionActive:ae}=D.getState();C&&(D.setState({nodesSelectionActive:!1}),m.selected&&ae?(le({nodes:[],edges:[m]}),(te=H.current)==null||te.blur()):F([e])),a&&a(J,m)},G=s?J=>{s(J,{...m})}:void 0,q=i?J=>{i(J,{...m})}:void 0,Q=r?J=>{r(J,{...m})}:void 0,K=c?J=>{c(J,{...m})}:void 0,W=u?J=>{u(J,{...m})}:void 0,P=J=>{var F;if(!y&&X1.includes(J.key)&&C){const{unselectNodesAndEdges:le,addSelectedEdges:ae}=D.getState();J.key==="Escape"?((F=H.current)==null||F.blur(),le({edges:[m]})):ae([e])}};return o.jsx("svg",{style:{zIndex:k},children:o.jsxs("g",{className:Ve(["react-flow__edge",`react-flow__edge-${j}`,m.className,w,{selected:m.selected,animated:m.animated,inactive:!C&&!a,updating:T,selectable:C}]),onClick:B,onDoubleClick:G,onContextMenu:q,onMouseEnter:Q,onMouseMove:K,onMouseLeave:W,onKeyDown:M?P:void 0,tabIndex:M?0:void 0,role:m.ariaRole??(M?"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":M?`${Eb}-${x}`:void 0,ref:H,...m.domAttributes,children:[!V&&o.jsx(E,{id:e,source:m.source,target:m.target,type:m.type,selected:m.selected,animated:m.animated,selectable:C,deletable:m.deletable??!0,label:m.label,labelStyle:m.labelStyle,labelShowBg:m.labelShowBg,labelBgStyle:m.labelBgStyle,labelBgPadding:m.labelBgPadding,labelBgBorderRadius:m.labelBgBorderRadius,sourceX:R,sourceY:z,targetX:O,targetY:Y,sourcePosition:X,targetPosition:L,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(SA,{edge:m,isReconnectable:A,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:R,sourceY:z,targetX:O,targetY:Y,sourcePosition:X,targetPosition:L,setUpdateHover:$,setReconnecting:N})]})})}var jA=b.memo(NA);const kA=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Fb({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(kA,ze),v=cA(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(pA,{defaultColor:e,rfId:n}),v.map(j=>o.jsx(jA,{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))]})}Fb.displayName="EdgeRenderer";const EA=b.memo(Fb),CA=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function MA({children:e}){const t=he(CA);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function _A(e){const t=op(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const AA=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function TA(e){const t=he(AA),n=De();return b.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function zA(e){return e.connection.inProgress?{...e.connection,to:cr(e.connection.to,e.transform)}:{...e.connection}}function DA(e){return zA}function RA(e){const t=DA();return he(t,ze)}const OA=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function HA({containerStyle:e,style:t,type:n,component:l}){const{nodesConnectable:a,width:s,height:i,isValid:r,inProgress:c}=he(OA,ze);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",Z1(r)]),children:o.jsx(Pb,{style:t,type:n,CustomComponent:l,isValid:r})})})}const Pb=({style:e,type:t=xl.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}=RA();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:Z1(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 xl.Bezier:[x]=sb(S);break;case xl.SimpleBezier:[x]=Ub(S);break;case xl.Step:[x]=yf({...S,borderRadius:0});break;case xl.SmoothStep:[x]=yf(S);break;default:[x]=rb(S)}return o.jsx("path",{d:x,fill:"none",className:"react-flow__connection-path",style:e})};Pb.displayName="ConnectionLine";const LA={};function wx(e=LA){b.useRef(e),De(),b.useEffect(()=>{},[e])}function $A(){De(),b.useRef(!1),b.useEffect(()=>{},[])}function e2({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:E,zoomActivationKeyCode:M,deleteKeyCode:A,onlyRenderVisibleElements:C,elementsSelectable:H,defaultViewport:T,translateExtent:$,minZoom:V,maxZoom:N,preventScrolling:D,defaultMarkerColor:k,zoomOnScroll:R,zoomOnPinch:z,panOnScroll:O,panOnScrollSpeed:Y,panOnScrollMode:X,zoomOnDoubleClick:L,panOnDrag:U,onPaneClick:_,onPaneMouseEnter:B,onPaneMouseMove:G,onPaneMouseLeave:q,onPaneScroll:Q,onPaneContextMenu:K,paneClickDistance:W,nodeClickDistance:P,onEdgeContextMenu:J,onEdgeMouseEnter:F,onEdgeMouseMove:le,onEdgeMouseLeave:ae,reconnectRadius:te,onReconnect:ge,onReconnectStart:I,onReconnectEnd:se,noDragClassName:Re,noWheelClassName:st,noPanClassName:Nt,disableKeyboardA11y:Ht,nodeExtent:ll,rfId:_n,viewport:Jt,onViewportChange:Lt}){return wx(e),wx(t),$A(),_A(n),TA(Jt),o.jsx(P_,{onPaneClick:_,onPaneMouseEnter:B,onPaneMouseMove:G,onPaneMouseLeave:q,onPaneContextMenu:K,onPaneScroll:Q,paneClickDistance:W,deleteKeyCode:A,selectionKeyCode:y,selectionOnDrag:m,selectionMode:v,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:j,panActivationKeyCode:E,zoomActivationKeyCode:M,elementsSelectable:H,zoomOnScroll:R,zoomOnPinch:z,zoomOnDoubleClick:L,panOnScroll:O,panOnScrollSpeed:Y,panOnScrollMode:X,panOnDrag:U,defaultViewport:T,translateExtent:$,minZoom:V,maxZoom:N,onSelectionContextMenu:f,preventScrolling:D,noDragClassName:Re,noWheelClassName:st,noPanClassName:Nt,disableKeyboardA11y:Ht,onViewportChange:Lt,isControlledViewport:!!Jt,children:o.jsxs(MA,{children:[o.jsx(EA,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:i,onReconnect:ge,onReconnectStart:I,onReconnectEnd:se,onlyRenderVisibleElements:C,onEdgeContextMenu:J,onEdgeMouseEnter:F,onEdgeMouseMove:le,onEdgeMouseLeave:ae,reconnectRadius:te,defaultMarkerColor:k,noPanClassName:Nt,disableKeyboardA11y:Ht,rfId:_n}),o.jsx(HA,{style:S,type:x,component:w,containerStyle:g}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(oA,{nodeTypes:e,onNodeClick:l,onNodeDoubleClick:s,onNodeMouseEnter:r,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:P,onlyRenderVisibleElements:C,noPanClassName:Nt,noDragClassName:Re,disableKeyboardA11y:Ht,nodeExtent:ll,rfId:_n}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}e2.displayName="GraphView";const BA=b.memo(e2),Sx=({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??Hi;ub(S,w,g);const{nodesInitialized:j}=bf(y,p,x,{nodeOrigin:m,nodeExtent:v,zIndexMode:h});let E=[0,0,1];if(i&&a&&s){const M=rr(p,{filter:T=>!!((T.width||T.initialWidth)&&(T.height||T.initialHeight))}),{x:A,y:C,zoom:H}=tp(M,a,s,c,u,(r==null?void 0:r.padding)??.1);E=[A,C,H]}return{rfId:"1",width:a??0,height:s??0,transform:E,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:Hi,nodeExtent:v,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:fs.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:{...Q1},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:q4,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:G1,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},UA=({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})=>s_((p,x)=>{async function S(){const{nodeLookup:w,panZoom:g,fitViewOptions:y,fitViewResolver:m,width:v,height:j,minZoom:E,maxZoom:M}=x();g&&(await B4({nodes:w,width:v,height:j,panZoom:g,minZoom:E,maxZoom:M},y),m==null||m.resolve(!0),p({fitViewResolver:null}))}return{...Sx({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:E,nodesSelectionActive:M}=x(),{nodesInitialized:A,hasSelectedNodes:C}=bf(w,g,y,{nodeOrigin:m,nodeExtent:f,elevateNodesOnSelect:v,checkEquality:!0,zIndexMode:E}),H=M&&C;j&&A?(S(),p({nodes:w,nodesInitialized:A,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:H})):p({nodes:w,nodesInitialized:A,nodesSelectionActive:H})},setEdges:w=>{const{connectionLookup:g,edgeLookup:y}=x();ub(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:E,debug:M,fitViewQueued:A,zIndexMode:C}=x(),{changes:H,updatedInternals:T}=cM(w,y,m,v,j,E,C);T&&(sM(y,m,{nodeOrigin:j,nodeExtent:E,zIndexMode:C}),A?(S(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(H==null?void 0:H.length)>0&&(M&&console.log("React Flow: trigger node changes",H),g==null||g(H)))},updateNodePositions:(w,g=!1)=>{const y=[];let m=[];const{nodeLookup:v,triggerNodeChanges:j,connection:E,updateConnection:M,onNodesChangeMiddlewareMap:A}=x();for(const[C,H]of w){const T=v.get(C),$=!!(T!=null&&T.expandParent&&(T!=null&&T.parentId)&&(H!=null&&H.position)),V={id:C,type:"position",position:$?{x:Math.max(0,H.position.x),y:Math.max(0,H.position.y)}:H.position,dragging:g};if(T&&E.inProgress&&E.fromNode.id===T.id){const N=pa(T,E.fromHandle,ee.Left,!0);M({...E,from:N})}$&&T.parentId&&y.push({id:C,parentId:T.parentId,rect:{...H.internals.positionAbsolute,width:H.measured.width??0,height:H.measured.height??0}}),m.push(V)}if(y.length>0){const{parentLookup:C,nodeOrigin:H}=x(),T=rp(y,v,C,H);m.push(...T)}for(const C of A.values())m=C(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 E=_b(w,m);y(E)}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 E=Ab(w,m);y(E)}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 E=w.map(M=>Il(M,!0));v(E);return}v(Ya(m,new Set([...w]),!0)),j(Ya(y))},addSelectedEdges:w=>{const{multiSelectionActive:g,edgeLookup:y,nodeLookup:m,triggerNodeChanges:v,triggerEdgeChanges:j}=x();if(g){const E=w.map(M=>Il(M,!0));j(E);return}j(Ya(y,new Set([...w]))),v(Ya(m,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:g}={})=>{const{edges:y,nodes:m,nodeLookup:v,triggerNodeChanges:j,triggerEdgeChanges:E}=x(),M=w||m,A=g||y,C=[];for(const T of M){if(!T.selected)continue;const $=v.get(T.id);$&&($.selected=!1),C.push(Il(T.id,!1))}const H=[];for(const T of A)T.selected&&H.push(Il(T.id,!1));j(C),E(H)},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((M,A)=>A.selected?[...M,Il(A.id,!1)]:M,[]),E=w.reduce((M,A)=>A.selected?[...M,Il(A.id,!1)]:M,[]);y(j),m(E)},setNodeExtent:w=>{const{nodes:g,nodeLookup:y,parentLookup:m,nodeOrigin:v,elevateNodesOnSelect:j,nodeExtent:E,zIndexMode:M}=x();w[0][0]===E[0][0]&&w[0][1]===E[0][1]&&w[1][0]===E[1][0]&&w[1][1]===E[1][1]||(bf(g,y,m,{nodeOrigin:v,nodeExtent:w,elevateNodesOnSelect:j,checkEquality:!1,zIndexMode:M}),p({nodeExtent:w}))},panBy:w=>{const{transform:g,width:y,height:m,panZoom:v,translateExtent:j}=x();return uM({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:E}=x();if(!E)return Promise.resolve(!1);const M=typeof(y==null?void 0:y.zoom)<"u"?y.zoom:j;return await E.setViewport({x:m/2-w*M,y:v/2-g*M,zoom:M},{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:{...Q1}})},updateConnection:w=>{p({connection:w})},reset:()=>p({...Sx()})}},Object.is);function qA({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(()=>UA({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(i_,{value:x,children:o.jsx(M_,{children:p})})}function YA({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(Ic)?o.jsx(o.Fragment,{children:e}):o.jsx(qA,{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 VA={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function XA({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:E,onNodeDragStart:M,onNodeDrag:A,onNodeDragStop:C,onNodesDelete:H,onEdgesDelete:T,onDelete:$,onSelectionChange:V,onSelectionDragStart:N,onSelectionDrag:D,onSelectionDragStop:k,onSelectionContextMenu:R,onSelectionStart:z,onSelectionEnd:O,onBeforeDelete:Y,connectionMode:X,connectionLineType:L=xl.Bezier,connectionLineStyle:U,connectionLineComponent:_,connectionLineContainerStyle:B,deleteKeyCode:G="Backspace",selectionKeyCode:q="Shift",selectionOnDrag:Q=!1,selectionMode:K=Li.Full,panActivationKeyCode:W="Space",multiSelectionKeyCode:P=Bi()?"Meta":"Control",zoomActivationKeyCode:J=Bi()?"Meta":"Control",snapToGrid:F,snapGrid:le,onlyRenderVisibleElements:ae=!1,selectNodesOnDrag:te,nodesDraggable:ge,autoPanOnNodeFocus:I,nodesConnectable:se,nodesFocusable:Re,nodeOrigin:st=Cb,edgesFocusable:Nt,edgesReconnectable:Ht,elementsSelectable:ll=!0,defaultViewport:_n=v_,minZoom:Jt=.5,maxZoom:Lt=2,translateExtent:An=Hi,preventScrolling:Bl=!0,nodeExtent:wa,defaultMarkerColor:fn="#b1b1b7",zoomOnScroll:ur=!0,zoomOnPinch:Fc=!0,panOnScroll:Pc=!1,panOnScrollSpeed:Ts=.5,panOnScrollMode:dr=aa.Free,zoomOnDoubleClick:eu=!0,panOnDrag:fr=!0,onPaneClick:tu,onPaneMouseEnter:nu,onPaneMouseMove:lu,onPaneMouseLeave:Ie,onPaneScroll:it,onPaneContextMenu:rt,paneClickDistance:hn=1,nodeClickDistance:ht=0,children:ot,onReconnect:$t,onReconnectStart:al,onReconnectEnd:Xe,onEdgeContextMenu:pn,onEdgeDoubleClick:Bt,onEdgeMouseEnter:Ft,onEdgeMouseMove:Ul,onEdgeMouseLeave:ql,reconnectRadius:gn=10,onNodesChange:Yl,onEdgesChange:zs,noDragClassName:a2="nodrag",noWheelClassName:s2="nowheel",noPanClassName:up="nopan",fitView:dp,fitViewOptions:fp,connectOnClick:i2,attributionPosition:r2,proOptions:o2,defaultEdgeOptions:c2,elevateNodesOnSelect:u2=!0,elevateEdgesOnSelect:d2=!1,disableKeyboardA11y:hp=!1,autoPanOnConnect:f2,autoPanOnNodeDrag:h2,autoPanSpeed:p2,connectionRadius:g2,isValidConnection:m2,onError:x2,style:y2,id:pp,nodeDragThreshold:v2,connectionDragThreshold:b2,viewport:w2,onViewportChange:S2,width:N2,height:j2,colorMode:k2="light",debug:E2,onScroll:hr,ariaLabelConfig:C2,zIndexMode:gp="basic",...M2},_2){const au=pp||"1",A2=N_(k2),T2=b.useCallback(mp=>{mp.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),hr==null||hr(mp)},[hr]);return o.jsx("div",{"data-testid":"rf__wrapper",...M2,onScroll:T2,style:{...y2,...VA},ref:_2,className:Ve(["react-flow",a,A2]),id:pp,role:"application",children:o.jsxs(YA,{nodes:e,edges:t,width:N2,height:j2,fitView:dp,fitViewOptions:fp,minZoom:Jt,maxZoom:Lt,nodeOrigin:st,nodeExtent:wa,zIndexMode:gp,children:[o.jsx(S_,{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:Nt,edgesReconnectable:Ht,elementsSelectable:ll,elevateNodesOnSelect:u2,elevateEdgesOnSelect:d2,minZoom:Jt,maxZoom:Lt,nodeExtent:wa,onNodesChange:Yl,onEdgesChange:zs,snapToGrid:F,snapGrid:le,connectionMode:X,translateExtent:An,connectOnClick:i2,defaultEdgeOptions:c2,fitView:dp,fitViewOptions:fp,onNodesDelete:H,onEdgesDelete:T,onDelete:$,onNodeDragStart:M,onNodeDrag:A,onNodeDragStop:C,onSelectionDrag:D,onSelectionDragStart:N,onSelectionDragStop:k,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:up,nodeOrigin:st,rfId:au,autoPanOnConnect:f2,autoPanOnNodeDrag:h2,autoPanSpeed:p2,onError:x2,connectionRadius:g2,isValidConnection:m2,selectNodesOnDrag:te,nodeDragThreshold:v2,connectionDragThreshold:b2,onBeforeDelete:Y,debug:E2,ariaLabelConfig:C2,zIndexMode:gp}),o.jsx(BA,{onInit:u,onNodeClick:r,onEdgeClick:c,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:j,onNodeDoubleClick:E,nodeTypes:s,edgeTypes:i,connectionLineType:L,connectionLineStyle:U,connectionLineComponent:_,connectionLineContainerStyle:B,selectionKeyCode:q,selectionOnDrag:Q,selectionMode:K,deleteKeyCode:G,multiSelectionKeyCode:P,panActivationKeyCode:W,zoomActivationKeyCode:J,onlyRenderVisibleElements:ae,defaultViewport:_n,translateExtent:An,minZoom:Jt,maxZoom:Lt,preventScrolling:Bl,zoomOnScroll:ur,zoomOnPinch:Fc,zoomOnDoubleClick:eu,panOnScroll:Pc,panOnScrollSpeed:Ts,panOnScrollMode:dr,panOnDrag:fr,onPaneClick:tu,onPaneMouseEnter:nu,onPaneMouseMove:lu,onPaneMouseLeave:Ie,onPaneScroll:it,onPaneContextMenu:rt,paneClickDistance:hn,nodeClickDistance:ht,onSelectionContextMenu:R,onSelectionStart:z,onSelectionEnd:O,onReconnect:$t,onReconnectStart:al,onReconnectEnd:Xe,onEdgeContextMenu:pn,onEdgeDoubleClick:Bt,onEdgeMouseEnter:Ft,onEdgeMouseMove:Ul,onEdgeMouseLeave:ql,reconnectRadius:gn,defaultMarkerColor:fn,noDragClassName:a2,noWheelClassName:s2,noPanClassName:up,rfId:au,disableKeyboardA11y:hp,nodeExtent:wa,viewport:w2,onViewportChange:S2}),o.jsx(y_,{onSelectionChange:V}),ot,o.jsx(h_,{proOptions:o2,position:r2}),o.jsx(f_,{rfId:au,disableKeyboardA11y:hp})]})})}var GA=Tb(XA);function QA(e){const[t,n]=b.useState(e),l=b.useCallback(a=>n(s=>_b(a,s)),[]);return[t,n,l]}function ZA(e){const[t,n]=b.useState(e),l=b.useCallback(a=>n(s=>Ab(a,s)),[]);return[t,n,l]}function IA({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 KA({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Ve(["react-flow__background-pattern","dots",t])})}var In;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(In||(In={}));const WA={[In.Dots]:1,[In.Lines]:1,[In.Cross]:6},JA=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function t2({id:e,variant:t=In.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(JA,ze),x=l||WA[t],S=t===In.Dots,w=t===In.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,E=[v[0]*h[2]||1+j[0]/2,v[1]*h[2]||1+j[1]/2],M=`${p}${e||""}`;return o.jsxs("svg",{className:Ve(["react-flow__background",u]),style:{...c,...Wc,"--xy-background-color-props":r,"--xy-background-pattern-color-props":i},ref:f,"data-testid":"rf__background",children:[o.jsx("pattern",{id:M,x:h[0]%y[0],y:h[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:S?o.jsx(KA,{radius:m/2,className:d}):o.jsx(IA,{dimensions:j,lineWidth:a,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}t2.displayName="Background";const FA=b.memo(t2);function PA(){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 eT(){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 tT(){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 nT(){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 lT(){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 Xr({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Ve(["react-flow__controls-button",t]),...n,children:e})}const aT=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function n2({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=De(),{isInteractive:S,minZoomReached:w,maxZoomReached:g,ariaLabelConfig:y}=he(aT,ze),{zoomIn:m,zoomOut:v,fitView:j}=op(),E=()=>{m(),s==null||s()},M=()=>{v(),i==null||i()},A=()=>{j(a),r==null||r()},C=()=>{x.setState({nodesDraggable:!S,nodesConnectable:!S,elementsSelectable:!S}),c==null||c(!S)},H=h==="horizontal"?"horizontal":"vertical";return o.jsxs(Kc,{className:Ve(["react-flow__controls",H,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??y["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(Xr,{onClick:E,className:"react-flow__controls-zoomin",title:y["controls.zoomIn.ariaLabel"],"aria-label":y["controls.zoomIn.ariaLabel"],disabled:g,children:o.jsx(PA,{})}),o.jsx(Xr,{onClick:M,className:"react-flow__controls-zoomout",title:y["controls.zoomOut.ariaLabel"],"aria-label":y["controls.zoomOut.ariaLabel"],disabled:w,children:o.jsx(eT,{})})]}),n&&o.jsx(Xr,{className:"react-flow__controls-fitview",onClick:A,title:y["controls.fitView.ariaLabel"],"aria-label":y["controls.fitView.ariaLabel"],children:o.jsx(tT,{})}),l&&o.jsx(Xr,{className:"react-flow__controls-interactive",onClick:C,title:y["controls.interactive.ariaLabel"],"aria-label":y["controls.interactive.ariaLabel"],children:S?o.jsx(lT,{}):o.jsx(nT,{})}),d]})}n2.displayName="Controls";const sT=b.memo(n2);function iT({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 rT=b.memo(iT),oT=e=>e.nodes.map(t=>t.id),ld=e=>e instanceof Function?e:()=>e;function cT({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:l=5,nodeStrokeWidth:a,nodeComponent:s=rT,onClick:i}){const r=he(oT,ze),c=ld(t),u=ld(e),d=ld(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:r.map(h=>o.jsx(dT,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:l,nodeStrokeWidth:a,NodeComponent:s,onClick:i,shapeRendering:f},h))})}function uT({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}=nl(w);return{node:w,x:g,y,width:m,height:v}},ze);return!u||u.hidden||!P1(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 dT=b.memo(uT);var fT=b.memo(cT);const hT=200,pT=150,gT=e=>!e.hidden,mT=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?F1(rr(e.nodeLookup,{filter:gT}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},xT="react-flow__minimap-desc";function l2({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=De(),E=b.useRef(null),{boundingRect:M,viewBB:A,rfId:C,panZoom:H,translateExtent:T,flowWidth:$,flowHeight:V,ariaLabelConfig:N}=he(mT,ze),D=(e==null?void 0:e.width)??hT,k=(e==null?void 0:e.height)??pT,R=M.width/D,z=M.height/k,O=Math.max(R,z),Y=O*D,X=O*k,L=v*O,U=M.x-(Y-M.width)/2-L,_=M.y-(X-M.height)/2-L,B=Y+L*2,G=X+L*2,q=`${xT}-${C}`,Q=b.useRef(0),K=b.useRef();Q.current=O,b.useEffect(()=>{if(E.current&&H)return K.current=vM({domNode:E.current,panZoom:H,getTransform:()=>j.getState().transform,getViewScale:()=>Q.current}),()=>{var F;(F=K.current)==null||F.destroy()}},[H]),b.useEffect(()=>{var F;(F=K.current)==null||F.update({translateExtent:T,width:$,height:V,inversePan:y,pannable:S,zoomStep:m,zoomable:w})},[S,w,y,m,T,$,V]);const W=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,J=g??N["minimap.ariaLabel"];return o.jsx(Kc,{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*O: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:D,height:k,viewBox:`${U} ${_} ${B} ${G}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":q,ref:E,onClick:W,children:[J&&o.jsx("title",{id:q,children:J}),o.jsx(fT,{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-L},${_-L}h${B+L*2}v${G+L*2}h${-B-L*2}z
165
- M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}l2.displayName="MiniMap";const yT=b.memo(l2),vT=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,bT={[ms.Line]:"right",[ms.Handle]:"bottom-right"};function wT({nodeId:e,position:t,variant:n=ms.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=Ob(),m=typeof e=="string"?e:y,v=De(),j=b.useRef(null),E=n===ms.Handle,M=he(b.useCallback(vT(E&&p),[E,p]),ze),A=b.useRef(null),C=t??bT[n];b.useEffect(()=>{if(!(!j.current||!m))return A.current||(A.current=DM({domNode:j.current,nodeId:m,getStoreItems:()=>{const{nodeLookup:T,transform:$,snapGrid:V,snapToGrid:N,nodeOrigin:D,domNode:k}=v.getState();return{nodeLookup:T,transform:$,snapGrid:V,snapToGrid:N,nodeOrigin:D,paneDomNode:k}},onChange:(T,$)=>{const{triggerNodeChanges:V,nodeLookup:N,parentLookup:D,nodeOrigin:k}=v.getState(),R=[],z={x:T.x,y:T.y},O=N.get(m);if(O&&O.expandParent&&O.parentId){const Y=O.origin??k,X=T.width??O.measured.width??0,L=T.height??O.measured.height??0,U={id:O.id,parentId:O.parentId,rect:{width:X,height:L,...eb({x:T.x??O.position.x,y:T.y??O.position.y},{width:X,height:L},O.parentId,N,Y)}},_=rp([U],N,D,k);R.push(..._),z.x=T.x?Math.max(Y[0]*X,T.x):void 0,z.y=T.y?Math.max(Y[1]*L,T.y):void 0}if(z.x!==void 0&&z.y!==void 0){const Y={id:m,type:"position",position:{...z}};R.push(Y)}if(T.width!==void 0&&T.height!==void 0){const X={id:m,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:T.width,height:T.height}};R.push(X)}for(const Y of $){const X={...Y,type:"position"};R.push(X)}V(R)},onEnd:({width:T,height:$})=>{const V={id:m,type:"dimensions",resizing:!1,dimensions:{width:T,height:$}};v.getState().triggerNodeChanges([V])}})),A.current.update({controlPosition:C,boundaries:{minWidth:r,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:S,onResize:w,onResizeEnd:g,shouldResize:x}),()=>{var T;(T=A.current)==null||T.destroy()}},[C,r,c,u,d,f,S,w,g,x]);const H=C.split("-");return o.jsx("div",{className:Ve(["react-flow__resize-control","nodrag",...H,n,l]),ref:j,style:{...a,scale:M,...i&&{[E?"backgroundColor":"borderColor"]:i}},children:s})}b.memo(wT);const xn={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 ad(e){return xn[e.toLowerCase()]??xn.other}function ST(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,E=s.get(f),M=s.get(h);E.vx-=v,E.vy-=j,M.vx+=v,M.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 NT=5,jT=9;function kT(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>=NT,u=l>=jT,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(ys,{type:"target",position:ee.Left,style:{opacity:0,pointerEvents:"none"}}),o.jsx(ys,{type:"source",position:ee.Right,style:{opacity:0,pointerEvents:"none"}})]})}const ET={wikiNode:kT},CT=[{label:"Concepts",color:xn.concepts.fill,rgb:xn.concepts.glowRgb},{label:"Entities",color:xn.entities.fill,rgb:xn.entities.glowRgb},{label:"Summaries",color:xn.summaries.fill,rgb:xn.summaries.glowRgb},{label:"Other",color:xn.other.fill,rgb:xn.other.glowRgb}];function MT({graphData:e,loading:t,onNodeClick:n}){const{initNodes:l,initEdges:a,adjacency:s}=b.useMemo(()=>{var M,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 C of S)g.set(C.slug,0),y.set(C.slug,C.category);for(const C of w)g.set(C.source,(g.get(C.source)??0)+1),g.set(C.target,(g.get(C.target)??0)+1);const m=new Map;for(const C of S)m.set(C.slug,new Set);for(const C of w)(M=m.get(C.source))==null||M.add(C.target),(A=m.get(C.target))==null||A.add(C.source);const v=ST(S,w,150),j=S.map(C=>{const H=g.get(C.slug)??0,T=Math.min(11,Math.max(4,4+H*.8)),$=v.get(C.slug)??{x:400,y:400},V=ad(C.category);return{id:C.slug,type:"wikiNode",position:$,data:{slug:C.slug,title:C.title||(C.slug.split("/").pop()??C.slug),category:C.category,fill:V.fill,light:V.light,dark:V.dark,glowRgb:V.glowRgb,radius:T,degree:H,dimmed:!1,hovered:!1}}}),E=w.map((C,H)=>{const T=ad(y.get(C.source)??"other");return{id:`e${H}-${C.source}-${C.target}`,source:C.source,target:C.target,type:"straight",animated:!0,style:{stroke:T.edgeColor,strokeWidth:1.3,opacity:.85}}});return{initNodes:j,initEdges:E,adjacency:m}},[e]),[i,r,c]=QA(l),[u,d,f]=ZA(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(GA,{nodes:i,edges:u,onNodesChange:c,onEdgesChange:f,nodeTypes:ET,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(FA,{variant:In.Dots,gap:26,size:1.2,color:"var(--b1)"}),o.jsx(sT,{}),o.jsx(yT,{nodeColor:S=>ad(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:CT.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 _T({rpc:e,className:t}){const{ws:n}=Cn(),[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),[E,M]=b.useState(null),[A,C]=b.useState(!1),[H,T]=b.useState(null),[$,V]=b.useState(null),[N,D]=b.useState(!1),k=b.useCallback(async(U=!1)=>{if(e){U||D(!0);try{const _=await e.wikiGraph();V(_??{nodes:[],edges:[]})}catch{V({nodes:[],edges:[]})}finally{U||D(!1)}}},[e]),R=b.useCallback(async(U=!1)=>{if(e){U||i(!0),T(null);try{const _=await e.wikiListPages();a((_==null?void 0:_.pages)??[])}catch(_){T(_ instanceof Error?_.message:"Failed to load wiki")}finally{U||i(!1)}}},[e]);b.useEffect(()=>{R()},[R]),b.useEffect(()=>{if(n)return n.on("wiki-op",()=>{R(!0),u.current==="graph"&&k(!0)})},[n,R,k]);const z=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]),O=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"),C(!0),M(null);try{const U=await e.wikiLint();M(U??{orphanPages:[],brokenLinks:[],missingFromIndex:[],staleFrontmatter:[]})}finally{C(!1)}}},[e]),X=l.reduce((U,_)=>{const B=_.category||"Other";return(U[B]??(U[B]=[])).push(_),U},{}),L=E?E.orphanPages.length+E.brokenLinks.length+E.missingFromIndex.length+E.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",L!==null&&L>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:L})]}),o.jsx("button",{onClick:()=>{c("graph"),!$&&!N&&k()},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:()=>R(),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(MT,{graphData:$,loading:N,onNodeClick:z})}),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…"}),H&&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:H}),!s&&!H&&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(B=>o.jsxs("button",{onClick:()=>z(B.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:B.title||B.slug.split("/").pop()}),o.jsx("div",{className:"text-[10px] font-mono mt-0.5 truncate",style:{color:"var(--muted)"},children:B.slug})]},B.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"&&O(),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:O,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:()=>z(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&&E&&o.jsxs("div",{className:"space-y-4",children:[L===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(Gr,{title:"Orphan pages",items:E.orphanPages,color:"var(--yellow)",note:"Written but not linked from any other page"}),o.jsx(Gr,{title:"Broken links",items:E.brokenLinks.map(U=>`${U.from} → [[${U.to}]]`),color:"var(--red)",note:"[[wikilinks]] that reference missing pages"}),o.jsx(Gr,{title:"Missing from index",items:E.missingFromIndex,color:"var(--yellow)",note:"Pages not listed in index.md"}),o.jsx(Gr,{title:"Stale frontmatter",items:E.staleFrontmatter,color:"var(--muted)",note:"updated: field older than 30 days"})]})]})]})]})}function Gr({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 Nx=[["/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 AT({open:e,onClose:t,onPick:n}){const[l,a]=b.useState(""),[s,i]=b.useState(0),r=b.useRef(null),c=l?Nx.filter(([f,h])=>f.includes(l.toLowerCase())||h.toLowerCase().includes(l.toLowerCase())):Nx,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 ka={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 TT({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,E]=b.useState(!1),[M,A]=b.useState(null),C=b.useCallback(()=>{switch(A(null),l){case"provider":{if(!s)return;const N=ka[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]),H=b.useCallback(async()=>{if(!(!e||!s)){E(!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{E(!1)}}},[e,s,r,u,f,p,S,g,m,t]),T=()=>{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"}},$=()=>(["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(ka).map(([N,D])=>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:D.label}),o.jsxs("div",{className:"text-[10.5px] text-muted",children:["Model: ",D.defaultModel]})]})]},N))})]});case"api_key":{const N=ka[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:D=>c(D.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=ka[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:D=>d(D.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(cl,{label:"Provider",value:ka[s].label}),o.jsx(cl,{label:"Model",value:u}),o.jsx(cl,{label:"API Key",value:r?"[set]":"(not set)"}),o.jsx(cl,{label:"Assistant Name",value:f.trim()||"Curie"}),o.jsx(cl,{label:"Vibe",value:p.trim()||"AI coding assistant"}),o.jsx(cl,{label:"Your Name",value:S.trim()||"User"}),o.jsx(cl,{label:"Timezone",value:g.trim()||"UTC"}),o.jsx(cl,{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:`${$()*100}%`}})})}),o.jsx("h3",{className:"text-sm font-medium text-text mb-4",children:T()}),o.jsx("div",{className:"mb-6",children:V()}),M&&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:M})]}),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(ka[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:H,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:C,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 cl({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 zT({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 DT="0.2.4";function RT({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!==DT&&!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 OT(){const{rpc:e,ws:t}=Cn(),[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 HT(e){const{rpc:t,ws:n}=Cn(),[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 LT({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 $T=["plan","edit","auto","yolo"],BT=[{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 UT(){const{rpc:e,connected:t,token:n,setToken:l}=Cn(),{get:a,set:s,providers:i}=kh(),[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),[E,M]=b.useState(!1),[A,C]=b.useState(!1),[H,T]=b.useState(!1),[$,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;M(!!q)},[]),b.useEffect(()=>{const q=W=>{W.preventDefault(),m(W)},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 D=async()=>{if(y){y.prompt();const{outcome:q}=await y.userChoice;console.log(`PWA install prompt choice: ${q}`),m(null)}else C(!0)},{sessions:k,refetch:R}=OT(),{events:z,addLiveEvent:O}=HT(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||T(!0)}).catch(()=>{})},[t,e]);const X=b.useCallback(()=>{S(null)},[]),L=b.useCallback(q=>{S(q)},[]),U=b.useCallback(q=>{S(q),R()},[R]);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=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(zT,{}),o.jsx(RT,{}),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:$?"var(--fg)":"var(--muted)",background:$?"var(--s3)":"transparent",border:$?"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"})}),k.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:k.length>99?"99+":k.length})]}),o.jsx("div",{className:"w-px h-5 bg-b1 mx-0.5"}),BT.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:$T.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&&!E)&&o.jsxs("button",{onClick:D,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:[H&&e?o.jsx(TT,{rpc:e,onComplete:()=>T(!1),className:"absolute inset-0"}):r==="assistant"&&o.jsx(Zj,{cmdResult:h,onClearCmdResult:B,rpc:e,className:"absolute inset-0",activeSessionId:x,onCreateSession:U,events:z,addLiveEvent:O,onSwitchView:q=>c(q)}),r==="channels"&&o.jsx(Ij,{rpc:e,className:"absolute inset-0"}),r==="stats"&&o.jsx(Kj,{rpc:e,className:"absolute inset-0"}),r==="projects"&&o.jsx(Wj,{rpc:e,className:"absolute inset-0"}),r==="agents"&&o.jsx(Pj,{rpc:e,className:"absolute inset-0"}),r==="kanban"&&o.jsx(t3,{rpc:e,className:"absolute inset-0"}),r==="wiki"&&o.jsx(_T,{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(AT,{open:d,onClose:()=>f(!1),onPick:_}),$&&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:[k.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:()=>{L(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)),k.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=z.filter(I=>I.type==="usage"),Q=q.reduce((I,se)=>I+(se.inputTokens||0)+(se.outputTokens||0),0),K=q[q.length-1],W=K&&K.inputTokens||0;function P(I){return I<1e3?String(I):`${(I/1e3).toFixed(1)}k`}const J=a("current_provider")||"anthropic",F=(ge=i.find(I=>I.name===J))==null?void 0:ge.model_cost,le=a("model")||"sonnet";function ae(I,se){if(F){const[Ht,ll]=F.split(";"),_n=parseFloat(Ht||"0"),Jt=parseFloat(ll||"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(Ht=>le.toLowerCase().includes(Ht))||"sonnet",Nt=Re[st];return(I*Nt.in+se*Nt.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(W)})]}),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:()=>C(!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:()=>C(!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(LT,{onAuthorize:l})}function qT(){return o.jsx(DN,{children:o.jsx(UT,{})})}const YT=_N.createRoot(document.getElementById("root"));YT.render(o.jsx(Me.StrictMode,{children:o.jsx(qT,{})}));"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))});