@curie-agent/daemon 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,234 @@
1
+ var Tk=Object.defineProperty;var Ak=(e,t,n)=>t in e?Tk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ke=(e,t,n)=>Ak(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function sb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ib={exports:{}},Td={};/**
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 Ck=Symbol.for("react.transitional.element"),Mk=Symbol.for("react.fragment");function ob(e,t,n){var r=null;if(n!==void 0&&(r=""+n),t.key!==void 0&&(r=""+t.key),"key"in t){n={};for(var s in t)s!=="key"&&(n[s]=t[s])}else n=t;return t=n.ref,{$$typeof:Ck,type:e,key:r,ref:t!==void 0?t:null,props:n}}Td.Fragment=Mk;Td.jsx=ob;Td.jsxs=ob;ib.exports=Td;var l=ib.exports,ab={exports:{}},ye={};/**
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 im=Symbol.for("react.transitional.element"),zk=Symbol.for("react.portal"),Dk=Symbol.for("react.fragment"),Rk=Symbol.for("react.strict_mode"),Ok=Symbol.for("react.profiler"),$k=Symbol.for("react.consumer"),Lk=Symbol.for("react.context"),Hk=Symbol.for("react.forward_ref"),Bk=Symbol.for("react.suspense"),Uk=Symbol.for("react.memo"),lb=Symbol.for("react.lazy"),Ik=Symbol.for("react.activity"),rx=Symbol.iterator;function Zk(e){return e===null||typeof e!="object"?null:(e=rx&&e[rx]||e["@@iterator"],typeof e=="function"?e:null)}var cb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ub=Object.assign,db={};function na(e,t,n){this.props=e,this.context=t,this.refs=db,this.updater=n||cb}na.prototype.isReactComponent={};na.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")};na.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function fb(){}fb.prototype=na.prototype;function om(e,t,n){this.props=e,this.context=t,this.refs=db,this.updater=n||cb}var am=om.prototype=new fb;am.constructor=om;ub(am,na.prototype);am.isPureReactComponent=!0;var sx=Array.isArray;function Lh(){}var Pe={H:null,A:null,T:null,S:null},hb=Object.prototype.hasOwnProperty;function lm(e,t,n){var r=n.ref;return{$$typeof:im,type:e,key:t,ref:r!==void 0?r:null,props:n}}function Yk(e,t){return lm(e.type,t,e.props)}function cm(e){return typeof e=="object"&&e!==null&&e.$$typeof===im}function qk(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var ix=/\/+/g;function Ef(e,t){return typeof e=="object"&&e!==null&&e.key!=null?qk(""+e.key):t.toString(36)}function Vk(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Lh,Lh):(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 Ji(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case im:case zk:o=!0;break;case lb:return o=e._init,Ji(o(e._payload),t,n,r,s)}}if(o)return s=s(e),o=r===""?"."+Ef(e,0):r,sx(s)?(n="",o!=null&&(n=o.replace(ix,"$&/")+"/"),Ji(s,t,n,"",function(u){return u})):s!=null&&(cm(s)&&(s=Yk(s,n+(s.key==null||e&&e.key===s.key?"":(""+s.key).replace(ix,"$&/")+"/")+o)),t.push(s)),1;o=0;var a=r===""?".":r+":";if(sx(e))for(var c=0;c<e.length;c++)r=e[c],i=a+Ef(r,c),o+=Ji(r,t,n,i,s);else if(c=Zk(e),typeof c=="function")for(e=c.call(e),c=0;!(r=e.next()).done;)r=r.value,i=a+Ef(r,c++),o+=Ji(r,t,n,i,s);else if(i==="object"){if(typeof e.then=="function")return Ji(Vk(e),t,n,r,s);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 o}function _c(e,t,n){if(e==null)return e;var r=[],s=0;return Ji(e,r,"","",function(i){return t.call(n,i,s++)}),r}function Gk(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 ox=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)},Xk={map:_c,forEach:function(e,t,n){_c(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return _c(e,function(){t++}),t},toArray:function(e){return _c(e,function(t){return t})||[]},only:function(e){if(!cm(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ye.Activity=Ik;ye.Children=Xk;ye.Component=na;ye.Fragment=Dk;ye.Profiler=Ok;ye.PureComponent=om;ye.StrictMode=Rk;ye.Suspense=Bk;ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Pe;ye.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Pe.H.useMemoCache(e)}};ye.cache=function(e){return function(){return e.apply(null,arguments)}};ye.cacheSignal=function(){return null};ye.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=ub({},e.props),s=e.key;if(t!=null)for(i in t.key!==void 0&&(s=""+t.key),t)!hb.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(r[i]=t[i]);var i=arguments.length-2;if(i===1)r.children=n;else if(1<i){for(var o=Array(i),a=0;a<i;a++)o[a]=arguments[a+2];r.children=o}return lm(e.type,s,r)};ye.createContext=function(e){return e={$$typeof:Lk,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:$k,_context:e},e};ye.createElement=function(e,t,n){var r,s={},i=null;if(t!=null)for(r in t.key!==void 0&&(i=""+t.key),t)hb.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(s[r]=t[r]);var o=arguments.length-2;if(o===1)s.children=n;else if(1<o){for(var a=Array(o),c=0;c<o;c++)a[c]=arguments[c+2];s.children=a}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)s[r]===void 0&&(s[r]=o[r]);return lm(e,i,s)};ye.createRef=function(){return{current:null}};ye.forwardRef=function(e){return{$$typeof:Hk,render:e}};ye.isValidElement=cm;ye.lazy=function(e){return{$$typeof:lb,_payload:{_status:-1,_result:e},_init:Gk}};ye.memo=function(e,t){return{$$typeof:Uk,type:e,compare:t===void 0?null:t}};ye.startTransition=function(e){var t=Pe.T,n={};Pe.T=n;try{var r=e(),s=Pe.S;s!==null&&s(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(Lh,ox)}catch(i){ox(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),Pe.T=t}};ye.unstable_useCacheRefresh=function(){return Pe.H.useCacheRefresh()};ye.use=function(e){return Pe.H.use(e)};ye.useActionState=function(e,t,n){return Pe.H.useActionState(e,t,n)};ye.useCallback=function(e,t){return Pe.H.useCallback(e,t)};ye.useContext=function(e){return Pe.H.useContext(e)};ye.useDebugValue=function(){};ye.useDeferredValue=function(e,t){return Pe.H.useDeferredValue(e,t)};ye.useEffect=function(e,t){return Pe.H.useEffect(e,t)};ye.useEffectEvent=function(e){return Pe.H.useEffectEvent(e)};ye.useId=function(){return Pe.H.useId()};ye.useImperativeHandle=function(e,t,n){return Pe.H.useImperativeHandle(e,t,n)};ye.useInsertionEffect=function(e,t){return Pe.H.useInsertionEffect(e,t)};ye.useLayoutEffect=function(e,t){return Pe.H.useLayoutEffect(e,t)};ye.useMemo=function(e,t){return Pe.H.useMemo(e,t)};ye.useOptimistic=function(e,t){return Pe.H.useOptimistic(e,t)};ye.useReducer=function(e,t,n){return Pe.H.useReducer(e,t,n)};ye.useRef=function(e){return Pe.H.useRef(e)};ye.useState=function(e){return Pe.H.useState(e)};ye.useSyncExternalStore=function(e,t,n){return Pe.H.useSyncExternalStore(e,t,n)};ye.useTransition=function(){return Pe.H.useTransition()};ye.version="19.2.6";ab.exports=ye;var w=ab.exports;const Xe=sb(w);var pb={exports:{}},Ad={},mb={exports:{}},gb={};/**
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(j,D){var O=j.length;j.push(D);e:for(;0<O;){var $=O-1>>>1,U=j[$];if(0<s(U,D))j[$]=D,j[O]=U,O=$;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var D=j[0],O=j.pop();if(O!==D){j[0]=O;e:for(var $=0,U=j.length,X=U>>>1;$<X;){var Z=2*($+1)-1,B=j[Z],E=Z+1,q=j[E];if(0>s(B,O))E<U&&0>s(q,B)?(j[$]=q,j[E]=O,$=E):(j[$]=B,j[Z]=O,$=Z);else if(E<U&&0>s(q,O))j[$]=q,j[E]=O,$=E;else break e}}return D}function s(j,D){var O=j.sortIndex-D.sortIndex;return O!==0?O:j.id-D.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var c=[],u=[],d=1,f=null,h=3,p=!1,x=!1,b=!1,S=!1,m=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;function v(j){for(var D=n(u);D!==null;){if(D.callback===null)r(u);else if(D.startTime<=j)r(u),D.sortIndex=D.expirationTime,t(c,D);else break;D=n(u)}}function N(j){if(b=!1,v(j),!x)if(n(c)!==null)x=!0,k||(k=!0,H());else{var D=n(u);D!==null&&C(N,D.startTime-j)}}var k=!1,T=-1,z=5,A=-1;function L(){return S?!0:!(e.unstable_now()-A<z)}function R(){if(S=!1,k){var j=e.unstable_now();A=j;var D=!0;try{e:{x=!1,b&&(b=!1,y(T),T=-1),p=!0;var O=h;try{t:{for(v(j),f=n(c);f!==null&&!(f.expirationTime>j&&L());){var $=f.callback;if(typeof $=="function"){f.callback=null,h=f.priorityLevel;var U=$(f.expirationTime<=j);if(j=e.unstable_now(),typeof U=="function"){f.callback=U,v(j),D=!0;break t}f===n(c)&&r(c),v(j)}else r(c);f=n(c)}if(f!==null)D=!0;else{var X=n(u);X!==null&&C(N,X.startTime-j),D=!1}}break e}finally{f=null,h=O,p=!1}D=void 0}}finally{D?H():k=!1}}}var H;if(typeof g=="function")H=function(){g(R)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,_=Y.port2;Y.port1.onmessage=R,H=function(){_.postMessage(null)}}else H=function(){m(R,0)};function C(j,D){T=m(function(){j(e.unstable_now())},D)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(j){j.callback=null},e.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<j?Math.floor(1e3/j):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(j){switch(h){case 1:case 2:case 3:var D=3;break;default:D=h}var O=h;h=D;try{return j()}finally{h=O}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(j,D){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var O=h;h=j;try{return D()}finally{h=O}},e.unstable_scheduleCallback=function(j,D,O){var $=e.unstable_now();switch(typeof O=="object"&&O!==null?(O=O.delay,O=typeof O=="number"&&0<O?$+O:$):O=$,j){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=O+U,j={id:d++,callback:D,priorityLevel:j,startTime:O,expirationTime:U,sortIndex:-1},O>$?(j.sortIndex=O,t(u,j),n(c)===null&&j===n(u)&&(b?(y(T),T=-1):b=!0,C(N,O-$))):(j.sortIndex=U,t(c,j),x||p||(x=!0,k||(k=!0,H()))),j},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(j){var D=h;return function(){var O=h;h=D;try{return j.apply(this,arguments)}finally{h=O}}}})(gb);mb.exports=gb;var Pk=mb.exports,xb={exports:{}},Qt={};/**
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 Fk=w;function yb(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 ys(){}var Ft={d:{f:ys,r:function(){throw Error(yb(522))},D:ys,C:ys,L:ys,m:ys,X:ys,S:ys,M:ys},p:0,findDOMNode:null},Qk=Symbol.for("react.portal");function Kk(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Qk,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}var Va=Fk.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Cd(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Qt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ft;Qt.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(yb(299));return Kk(e,t,null,n)};Qt.flushSync=function(e){var t=Va.T,n=Ft.p;try{if(Va.T=null,Ft.p=2,e)return e()}finally{Va.T=t,Ft.p=n,Ft.d.f()}};Qt.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Ft.d.C(e,t))};Qt.prefetchDNS=function(e){typeof e=="string"&&Ft.d.D(e)};Qt.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,r=Cd(n,t.crossOrigin),s=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Ft.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:s,fetchPriority:i}):n==="script"&&Ft.d.X(e,{crossOrigin:r,integrity:s,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Qt.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Cd(t.as,t.crossOrigin);Ft.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&&Ft.d.M(e)};Qt.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,r=Cd(n,t.crossOrigin);Ft.d.L(e,n,{crossOrigin:r,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})}};Qt.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Cd(t.as,t.crossOrigin);Ft.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 Ft.d.m(e)};Qt.requestFormReset=function(e){Ft.d.r(e)};Qt.unstable_batchedUpdates=function(e,t){return e(t)};Qt.useFormState=function(e,t,n){return Va.H.useFormState(e,t,n)};Qt.useFormStatus=function(){return Va.H.useHostTransitionStatus()};Qt.version="19.2.6";function vb(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vb)}catch(e){console.error(e)}}vb(),xb.exports=Qt;var xi=xb.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 St=Pk,bb=w,Wk=xi;function K(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 wb(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ll(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 Sb(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 _b(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 ax(e){if(Ll(e)!==e)throw Error(K(188))}function Jk(e){var t=e.alternate;if(!t){if(t=Ll(e),t===null)throw Error(K(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return ax(s),e;if(i===r)return ax(s),t;i=i.sibling}throw Error(K(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o)throw Error(K(189))}}if(n.alternate!==r)throw Error(K(190))}if(n.tag!==3)throw Error(K(188));return n.stateNode.current===n?e:t}function kb(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=kb(e),t!==null)return t;e=e.sibling}return null}var Fe=Object.assign,eN=Symbol.for("react.element"),kc=Symbol.for("react.transitional.element"),Oa=Symbol.for("react.portal"),ro=Symbol.for("react.fragment"),Nb=Symbol.for("react.strict_mode"),Hh=Symbol.for("react.profiler"),jb=Symbol.for("react.consumer"),Fr=Symbol.for("react.context"),um=Symbol.for("react.forward_ref"),Bh=Symbol.for("react.suspense"),Uh=Symbol.for("react.suspense_list"),dm=Symbol.for("react.memo"),ks=Symbol.for("react.lazy"),Ih=Symbol.for("react.activity"),tN=Symbol.for("react.memo_cache_sentinel"),lx=Symbol.iterator;function wa(e){return e===null||typeof e!="object"?null:(e=lx&&e[lx]||e["@@iterator"],typeof e=="function"?e:null)}var nN=Symbol.for("react.client.reference");function Zh(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===nN?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ro:return"Fragment";case Hh:return"Profiler";case Nb:return"StrictMode";case Bh:return"Suspense";case Uh:return"SuspenseList";case Ih:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Oa:return"Portal";case Fr:return e.displayName||"Context";case jb:return(e._context.displayName||"Context")+".Consumer";case um:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case dm:return t=e.displayName||null,t!==null?t:Zh(e.type)||"Memo";case ks:t=e._payload,e=e._init;try{return Zh(e(t))}catch{}}return null}var $a=Array.isArray,pe=bb.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ce=Wk.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,vi={pending:!1,data:null,method:null,action:null},Yh=[],so=-1;function Cr(e){return{current:e}}function At(e){0>so||(e.current=Yh[so],Yh[so]=null,so--)}function Ye(e,t){so++,Yh[so]=e.current,e.current=t}var jr=Cr(null),ul=Cr(null),Ls=Cr(null),Au=Cr(null);function Cu(e,t){switch(Ye(Ls,t),Ye(ul,e),Ye(jr,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?p0(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=p0(t),e=Gw(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}At(jr),Ye(jr,e)}function Ro(){At(jr),At(ul),At(Ls)}function qh(e){e.memoizedState!==null&&Ye(Au,e);var t=jr.current,n=Gw(t,e.type);t!==n&&(Ye(ul,e),Ye(jr,n))}function Mu(e){ul.current===e&&(At(jr),At(ul)),Au.current===e&&(At(Au),wl._currentValue=vi)}var Tf,cx;function ui(e){if(Tf===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Tf=t&&t[1]||"",cx=-1<n.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Tf+e+cx}var Af=!1;function Cf(e,t){if(!e||Af)return"";Af=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={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]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=r.DetermineComponentFrameRoot(),o=i[0],a=i[1];if(o&&a){var c=o.split(`
44
+ `),u=a.split(`
45
+ `);for(s=r=0;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;for(;s<u.length&&!u[s].includes("DetermineComponentFrameRoot");)s++;if(r===c.length||s===u.length)for(r=c.length-1,s=u.length-1;1<=r&&0<=s&&c[r]!==u[s];)s--;for(;1<=r&&0<=s;r--,s--)if(c[r]!==u[s]){if(r!==1||s!==1)do if(r--,s--,0>s||c[r]!==u[s]){var d=`
46
+ `+c[r].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=r&&0<=s);break}}}finally{Af=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ui(n):""}function rN(e,t){switch(e.tag){case 26:case 27:case 5:return ui(e.type);case 16:return ui("Lazy");case 13:return e.child!==t&&t!==null?ui("Suspense Fallback"):ui("Suspense");case 19:return ui("SuspenseList");case 0:case 15:return Cf(e.type,!1);case 11:return Cf(e.type.render,!1);case 1:return Cf(e.type,!0);case 31:return ui("Activity");default:return""}}function ux(e){try{var t="",n=null;do t+=rN(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
47
+ Error generating stack: `+r.message+`
48
+ `+r.stack}}var Vh=Object.prototype.hasOwnProperty,fm=St.unstable_scheduleCallback,Mf=St.unstable_cancelCallback,sN=St.unstable_shouldYield,iN=St.unstable_requestPaint,Nn=St.unstable_now,oN=St.unstable_getCurrentPriorityLevel,Eb=St.unstable_ImmediatePriority,Tb=St.unstable_UserBlockingPriority,zu=St.unstable_NormalPriority,aN=St.unstable_LowPriority,Ab=St.unstable_IdlePriority,lN=St.log,cN=St.unstable_setDisableYieldValue,Hl=null,jn=null;function zs(e){if(typeof lN=="function"&&cN(e),jn&&typeof jn.setStrictMode=="function")try{jn.setStrictMode(Hl,e)}catch{}}var En=Math.clz32?Math.clz32:fN,uN=Math.log,dN=Math.LN2;function fN(e){return e>>>=0,e===0?32:31-(uN(e)/dN|0)|0}var Nc=256,jc=262144,Ec=4194304;function di(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 Md(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var s=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var a=r&134217727;return a!==0?(r=a&~i,r!==0?s=di(r):(o&=a,o!==0?s=di(o):n||(n=a&~e,n!==0&&(s=di(n))))):(a=r&~i,a!==0?s=di(a):o!==0?s=di(o):n||(n=r&~e,n!==0&&(s=di(n)))),s===0?0:t!==0&&t!==s&&!(t&i)&&(i=s&-s,n=t&-t,i>=n||i===32&&(n&4194048)!==0)?t:s}function Bl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function hN(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 Cb(){var e=Ec;return Ec<<=1,!(Ec&62914560)&&(Ec=4194304),e}function zf(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ul(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function pN(e,t,n,r,s,i){var o=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 a=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=o&~n;0<n;){var d=31-En(n),f=1<<d;a[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}r!==0&&Mb(e,r,0),i!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function Mb(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-En(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function zb(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-En(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}function Db(e,t){var n=t&-t;return n=n&42?1:hm(n),n&(e.suspendedLanes|t)?0:n}function hm(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 pm(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Rb(){var e=Ce.p;return e!==0?e:(e=window.event,e===void 0?32:r2(e.type))}function dx(e,t){var n=Ce.p;try{return Ce.p=e,t()}finally{Ce.p=n}}var Ks=Math.random().toString(36).slice(2),Lt="__reactFiber$"+Ks,un="__reactProps$"+Ks,ra="__reactContainer$"+Ks,Gh="__reactEvents$"+Ks,mN="__reactListeners$"+Ks,gN="__reactHandles$"+Ks,fx="__reactResources$"+Ks,Il="__reactMarker$"+Ks;function mm(e){delete e[Lt],delete e[un],delete e[Gh],delete e[mN],delete e[gN]}function io(e){var t=e[Lt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ra]||n[Lt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=v0(e);e!==null;){if(n=e[Lt])return n;e=v0(e)}return t}e=n,n=e.parentNode}return null}function sa(e){if(e=e[Lt]||e[ra]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function La(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(K(33))}function wo(e){var t=e[fx];return t||(t=e[fx]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Tt(e){e[Il]=!0}var Ob=new Set,$b={};function $i(e,t){Oo(e,t),Oo(e+"Capture",t)}function Oo(e,t){for($b[e]=t,e=0;e<t.length;e++)Ob.add(t[e])}var xN=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]*$"),hx={},px={};function yN(e){return Vh.call(px,e)?!0:Vh.call(hx,e)?!1:xN.test(e)?px[e]=!0:(hx[e]=!0,!1)}function au(e,t,n){if(yN(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Tc(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 Br(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+r)}}function Ln(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Lb(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function vN(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Xh(e){if(!e._valueTracker){var t=Lb(e)?"checked":"value";e._valueTracker=vN(e,t,""+e[t])}}function Hb(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Lb(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Du(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 bN=/[\n"\\]/g;function Un(e){return e.replace(bN,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ph(e,t,n,r,s,i,o,a){e.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.type=o:e.removeAttribute("type"),t!=null?o==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Ln(t)):e.value!==""+Ln(t)&&(e.value=""+Ln(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?Fh(e,o,Ln(t)):n!=null?Fh(e,o,Ln(n)):r!=null&&e.removeAttribute("value"),s==null&&i!=null&&(e.defaultChecked=!!i),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.name=""+Ln(a):e.removeAttribute("name")}function Bb(e,t,n,r,s,i,o,a){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||n!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){Xh(e);return}n=n!=null?""+Ln(n):"",t=t!=null?""+Ln(t):n,a||t===e.value||(e.value=t),e.defaultValue=t}r=r??s,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=a?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),Xh(e)}function Fh(e,t,n){t==="number"&&Du(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function So(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Ln(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Ub(e,t,n){if(t!=null&&(t=""+Ln(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Ln(n):""}function Ib(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(K(92));if($a(r)){if(1<r.length)throw Error(K(93));r=r[0]}n=r}n==null&&(n=""),t=n}n=Ln(t),e.defaultValue=n,r=e.textContent,r===n&&r!==""&&r!==null&&(e.value=r),Xh(e)}function $o(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var wN=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 mx(e,t,n){var r=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,n):typeof n!="number"||n===0||wN.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Zb(e,t,n){if(t!=null&&typeof t!="object")throw Error(K(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var s in t)r=t[s],t.hasOwnProperty(s)&&n[s]!==r&&mx(e,s,r)}else for(var i in t)t.hasOwnProperty(i)&&mx(e,i,t[i])}function gm(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 SN=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"]]),_N=/^[\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 lu(e){return _N.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Qr(){}var Qh=null;function xm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var oo=null,_o=null;function gx(e){var t=sa(e);if(t&&(e=t.stateNode)){var n=e[un]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ph(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="'+Un(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=r[un]||null;if(!s)throw Error(K(90));Ph(r,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Hb(r)}break e;case"textarea":Ub(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&So(e,!!n.multiple,t,!1)}}}var Df=!1;function Yb(e,t,n){if(Df)return e(t,n);Df=!0;try{var r=e(t);return r}finally{if(Df=!1,(oo!==null||_o!==null)&&(Yd(),oo&&(t=oo,e=_o,_o=oo=null,gx(t),e)))for(t=0;t<e.length;t++)gx(e[t])}}function dl(e,t){var n=e.stateNode;if(n===null)return null;var r=n[un]||null;if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(K(231,t,typeof n));return n}var ss=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Kh=!1;if(ss)try{var Sa={};Object.defineProperty(Sa,"passive",{get:function(){Kh=!0}}),window.addEventListener("test",Sa,Sa),window.removeEventListener("test",Sa,Sa)}catch{Kh=!1}var Ds=null,ym=null,cu=null;function qb(){if(cu)return cu;var e,t=ym,n=t.length,r,s="value"in Ds?Ds.value:Ds.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return cu=s.slice(e,1<r?1-r:void 0)}function uu(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 Ac(){return!0}function xx(){return!1}function dn(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Ac:xx,this.isPropagationStopped=xx,this}return Fe(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=Ac)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ac)},persist:function(){},isPersistent:Ac}),t}var Li={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zd=dn(Li),Zl=Fe({},Li,{view:0,detail:0}),kN=dn(Zl),Rf,Of,_a,Dd=Fe({},Zl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vm,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!==_a&&(_a&&e.type==="mousemove"?(Rf=e.screenX-_a.screenX,Of=e.screenY-_a.screenY):Of=Rf=0,_a=e),Rf)},movementY:function(e){return"movementY"in e?e.movementY:Of}}),yx=dn(Dd),NN=Fe({},Dd,{dataTransfer:0}),jN=dn(NN),EN=Fe({},Zl,{relatedTarget:0}),$f=dn(EN),TN=Fe({},Li,{animationName:0,elapsedTime:0,pseudoElement:0}),AN=dn(TN),CN=Fe({},Li,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),MN=dn(CN),zN=Fe({},Li,{data:0}),vx=dn(zN),DN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},RN={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"},ON={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $N(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ON[e])?!!t[e]:!1}function vm(){return $N}var LN=Fe({},Zl,{key:function(e){if(e.key){var t=DN[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=uu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?RN[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vm,charCode:function(e){return e.type==="keypress"?uu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?uu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),HN=dn(LN),BN=Fe({},Dd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),bx=dn(BN),UN=Fe({},Zl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vm}),IN=dn(UN),ZN=Fe({},Li,{propertyName:0,elapsedTime:0,pseudoElement:0}),YN=dn(ZN),qN=Fe({},Dd,{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}),VN=dn(qN),GN=Fe({},Li,{newState:0,oldState:0}),XN=dn(GN),PN=[9,13,27,32],bm=ss&&"CompositionEvent"in window,Ga=null;ss&&"documentMode"in document&&(Ga=document.documentMode);var FN=ss&&"TextEvent"in window&&!Ga,Vb=ss&&(!bm||Ga&&8<Ga&&11>=Ga),wx=" ",Sx=!1;function Gb(e,t){switch(e){case"keyup":return PN.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xb(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ao=!1;function QN(e,t){switch(e){case"compositionend":return Xb(t);case"keypress":return t.which!==32?null:(Sx=!0,wx);case"textInput":return e=t.data,e===wx&&Sx?null:e;default:return null}}function KN(e,t){if(ao)return e==="compositionend"||!bm&&Gb(e,t)?(e=qb(),cu=ym=Ds=null,ao=!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 Vb&&t.locale!=="ko"?null:t.data;default:return null}}var WN={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 _x(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!WN[e.type]:t==="textarea"}function Pb(e,t,n,r){oo?_o?_o.push(r):_o=[r]:oo=r,t=Ku(t,"onChange"),0<t.length&&(n=new zd("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Xa=null,fl=null;function JN(e){Yw(e,0)}function Rd(e){var t=La(e);if(Hb(t))return e}function kx(e,t){if(e==="change")return t}var Fb=!1;if(ss){var Lf;if(ss){var Hf="oninput"in document;if(!Hf){var Nx=document.createElement("div");Nx.setAttribute("oninput","return;"),Hf=typeof Nx.oninput=="function"}Lf=Hf}else Lf=!1;Fb=Lf&&(!document.documentMode||9<document.documentMode)}function jx(){Xa&&(Xa.detachEvent("onpropertychange",Qb),fl=Xa=null)}function Qb(e){if(e.propertyName==="value"&&Rd(fl)){var t=[];Pb(t,fl,e,xm(e)),Yb(JN,t)}}function ej(e,t,n){e==="focusin"?(jx(),Xa=t,fl=n,Xa.attachEvent("onpropertychange",Qb)):e==="focusout"&&jx()}function tj(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Rd(fl)}function nj(e,t){if(e==="click")return Rd(t)}function rj(e,t){if(e==="input"||e==="change")return Rd(t)}function sj(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var An=typeof Object.is=="function"?Object.is:sj;function hl(e,t){if(An(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!Vh.call(t,s)||!An(e[s],t[s]))return!1}return!0}function Ex(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Tx(e,t){var n=Ex(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ex(n)}}function Kb(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Kb(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Wb(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Du(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=Du(e.document)}return t}function wm(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 ij=ss&&"documentMode"in document&&11>=document.documentMode,lo=null,Wh=null,Pa=null,Jh=!1;function Ax(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Jh||lo==null||lo!==Du(r)||(r=lo,"selectionStart"in r&&wm(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Pa&&hl(Pa,r)||(Pa=r,r=Ku(Wh,"onSelect"),0<r.length&&(t=new zd("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=lo)))}function ai(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var co={animationend:ai("Animation","AnimationEnd"),animationiteration:ai("Animation","AnimationIteration"),animationstart:ai("Animation","AnimationStart"),transitionrun:ai("Transition","TransitionRun"),transitionstart:ai("Transition","TransitionStart"),transitioncancel:ai("Transition","TransitionCancel"),transitionend:ai("Transition","TransitionEnd")},Bf={},Jb={};ss&&(Jb=document.createElement("div").style,"AnimationEvent"in window||(delete co.animationend.animation,delete co.animationiteration.animation,delete co.animationstart.animation),"TransitionEvent"in window||delete co.transitionend.transition);function Hi(e){if(Bf[e])return Bf[e];if(!co[e])return e;var t=co[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Jb)return Bf[e]=t[n];return e}var e1=Hi("animationend"),t1=Hi("animationiteration"),n1=Hi("animationstart"),oj=Hi("transitionrun"),aj=Hi("transitionstart"),lj=Hi("transitioncancel"),r1=Hi("transitionend"),s1=new Map,ep="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(" ");ep.push("scrollEnd");function dr(e,t){s1.set(e,t),$i(t,[e])}var Ru=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)},On=[],uo=0,Sm=0;function Od(){for(var e=uo,t=Sm=uo=0;t<e;){var n=On[t];On[t++]=null;var r=On[t];On[t++]=null;var s=On[t];On[t++]=null;var i=On[t];if(On[t++]=null,r!==null&&s!==null){var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}i!==0&&i1(n,s,i)}}function $d(e,t,n,r){On[uo++]=e,On[uo++]=t,On[uo++]=n,On[uo++]=r,Sm|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function _m(e,t,n,r){return $d(e,t,n,r),Ou(e)}function Bi(e,t){return $d(e,null,null,t),Ou(e)}function i1(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var s=!1,i=e.return;i!==null;)i.childLanes|=n,r=i.alternate,r!==null&&(r.childLanes|=n),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(s=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,s&&t!==null&&(s=31-En(n),e=i.hiddenUpdates,r=e[s],r===null?e[s]=[t]:r.push(t),t.lane=n|536870912),i):null}function Ou(e){if(50<rl)throw rl=0,wp=null,Error(K(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var fo={};function cj(e,t,n,r){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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wn(e,t,n,r){return new cj(e,t,n,r)}function km(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jr(e,t){var n=e.alternate;return n===null?(n=wn(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 o1(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 du(e,t,n,r,s,i){var o=0;if(r=e,typeof e=="function")km(e)&&(o=1);else if(typeof e=="string")o=pE(e,n,jr.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Ih:return e=wn(31,n,t,s),e.elementType=Ih,e.lanes=i,e;case ro:return bi(n.children,s,i,t);case Nb:o=8,s|=24;break;case Hh:return e=wn(12,n,t,s|2),e.elementType=Hh,e.lanes=i,e;case Bh:return e=wn(13,n,t,s),e.elementType=Bh,e.lanes=i,e;case Uh:return e=wn(19,n,t,s),e.elementType=Uh,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Fr:o=10;break e;case jb:o=9;break e;case um:o=11;break e;case dm:o=14;break e;case ks:o=16,r=null;break e}o=29,n=Error(K(130,e===null?"null":typeof e,"")),r=null}return t=wn(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function bi(e,t,n,r){return e=wn(7,e,r,t),e.lanes=n,e}function Uf(e,t,n){return e=wn(6,e,null,t),e.lanes=n,e}function a1(e){var t=wn(18,null,null,0);return t.stateNode=e,t}function If(e,t,n){return t=wn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Cx=new WeakMap;function In(e,t){if(typeof e=="object"&&e!==null){var n=Cx.get(e);return n!==void 0?n:(t={value:e,source:t,stack:ux(t)},Cx.set(e,t),t)}return{value:e,source:t,stack:ux(t)}}var ho=[],po=0,$u=null,pl=0,Hn=[],Bn=0,Gs=null,_r=1,kr="";function Xr(e,t){ho[po++]=pl,ho[po++]=$u,$u=e,pl=t}function l1(e,t,n){Hn[Bn++]=_r,Hn[Bn++]=kr,Hn[Bn++]=Gs,Gs=e;var r=_r;e=kr;var s=32-En(r)-1;r&=~(1<<s),n+=1;var i=32-En(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,_r=1<<32-En(t)+s|n<<s|r,kr=i+e}else _r=1<<i|n<<s|r,kr=e}function Nm(e){e.return!==null&&(Xr(e,1),l1(e,1,0))}function jm(e){for(;e===$u;)$u=ho[--po],ho[po]=null,pl=ho[--po],ho[po]=null;for(;e===Gs;)Gs=Hn[--Bn],Hn[Bn]=null,kr=Hn[--Bn],Hn[Bn]=null,_r=Hn[--Bn],Hn[Bn]=null}function c1(e,t){Hn[Bn++]=_r,Hn[Bn++]=kr,Hn[Bn++]=Gs,_r=t.id,kr=t.overflow,Gs=e}var Ht=null,Ge=null,_e=!1,Hs=null,Zn=!1,tp=Error(K(519));function Xs(e){var t=Error(K(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ml(In(t,e)),tp}function Mx(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Lt]=e,t[un]=r,n){case"dialog":be("cancel",t),be("close",t);break;case"iframe":case"object":case"embed":be("load",t);break;case"video":case"audio":for(n=0;n<vl.length;n++)be(vl[n],t);break;case"source":be("error",t);break;case"img":case"image":case"link":be("error",t),be("load",t);break;case"details":be("toggle",t);break;case"input":be("invalid",t),Bb(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":be("invalid",t);break;case"textarea":be("invalid",t),Ib(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||r.suppressHydrationWarning===!0||Vw(t.textContent,n)?(r.popover!=null&&(be("beforetoggle",t),be("toggle",t)),r.onScroll!=null&&be("scroll",t),r.onScrollEnd!=null&&be("scrollend",t),r.onClick!=null&&(t.onclick=Qr),t=!0):t=!1,t||Xs(e,!0)}function zx(e){for(Ht=e.return;Ht;)switch(Ht.tag){case 5:case 31:case 13:Zn=!1;return;case 27:case 3:Zn=!0;return;default:Ht=Ht.return}}function Fi(e){if(e!==Ht)return!1;if(!_e)return zx(e),_e=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||jp(e.type,e.memoizedProps)),n=!n),n&&Ge&&Xs(e),zx(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(K(317));Ge=y0(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(K(317));Ge=y0(e)}else t===27?(t=Ge,Ws(e.type)?(e=Cp,Cp=null,Ge=e):Ge=t):Ge=Ht?qn(e.stateNode.nextSibling):null;return!0}function ji(){Ge=Ht=null,_e=!1}function Zf(){var e=Hs;return e!==null&&(on===null?on=e:on.push.apply(on,e),Hs=null),e}function ml(e){Hs===null?Hs=[e]:Hs.push(e)}var np=Cr(null),Ui=null,Kr=null;function Es(e,t,n){Ye(np,t._currentValue),t._currentValue=n}function es(e){e._currentValue=np.current,At(np)}function rp(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function sp(e,t,n,r){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var i=s.dependencies;if(i!==null){var o=s.child;i=i.firstContext;e:for(;i!==null;){var a=i;i=s;for(var c=0;c<t.length;c++)if(a.context===t[c]){i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),rp(i.return,n,e),r||(o=null);break e}i=a.next}}else if(s.tag===18){if(o=s.return,o===null)throw Error(K(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),rp(o,n,e),o=null}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}}function ia(e,t,n,r){e=null;for(var s=t,i=!1;s!==null;){if(!i){if(s.flags&524288)i=!0;else if(s.flags&262144)break}if(s.tag===10){var o=s.alternate;if(o===null)throw Error(K(387));if(o=o.memoizedProps,o!==null){var a=s.type;An(s.pendingProps.value,o.value)||(e!==null?e.push(a):e=[a])}}else if(s===Au.current){if(o=s.alternate,o===null)throw Error(K(387));o.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(wl):e=[wl])}s=s.return}e!==null&&sp(t,e,n,r),t.flags|=262144}function Lu(e){for(e=e.firstContext;e!==null;){if(!An(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ei(e){Ui=e,Kr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Bt(e){return u1(Ui,e)}function Cc(e,t){return Ui===null&&Ei(e),u1(e,t)}function u1(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Kr===null){if(e===null)throw Error(K(308));Kr=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Kr=Kr.next=t;return n}var uj=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},dj=St.unstable_scheduleCallback,fj=St.unstable_NormalPriority,ht={$$typeof:Fr,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Em(){return{controller:new uj,data:new Map,refCount:0}}function Yl(e){e.refCount--,e.refCount===0&&dj(fj,function(){e.controller.abort()})}var Fa=null,ip=0,Lo=0,ko=null;function hj(e,t){if(Fa===null){var n=Fa=[];ip=0,Lo=Wm(),ko={status:"pending",value:void 0,then:function(r){n.push(r)}}}return ip++,t.then(Dx,Dx),t}function Dx(){if(--ip===0&&Fa!==null){ko!==null&&(ko.status="fulfilled");var e=Fa;Fa=null,Lo=0,ko=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function pj(e,t){var n=[],r={status:"pending",value:null,reason:null,then:function(s){n.push(s)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var s=0;s<n.length;s++)(0,n[s])(t)},function(s){for(r.status="rejected",r.reason=s,s=0;s<n.length;s++)(0,n[s])(void 0)}),r}var Rx=pe.S;pe.S=function(e,t){kw=Nn(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&hj(e,t),Rx!==null&&Rx(e,t)};var wi=Cr(null);function Tm(){var e=wi.current;return e!==null?e:Ie.pooledCache}function fu(e,t){t===null?Ye(wi,wi.current):Ye(wi,t.pool)}function d1(){var e=Tm();return e===null?null:{parent:ht._currentValue,pool:e}}var oa=Error(K(460)),Am=Error(K(474)),Ld=Error(K(542)),Hu={then:function(){}};function Ox(e){return e=e.status,e==="fulfilled"||e==="rejected"}function f1(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Qr,Qr),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Lx(e),e;default:if(typeof t.status=="string")t.then(Qr,Qr);else{if(e=Ie,e!==null&&100<e.shellSuspendCounter)throw Error(K(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=r}},function(r){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Lx(e),e}throw Si=t,oa}}function fi(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Si=n,oa):n}}var Si=null;function $x(){if(Si===null)throw Error(K(459));var e=Si;return Si=null,e}function Lx(e){if(e===oa||e===Ld)throw Error(K(483))}var No=null,gl=0;function Mc(e){var t=gl;return gl+=1,No===null&&(No=[]),f1(No,e,t)}function ka(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function zc(e,t){throw t.$$typeof===eN?Error(K(525)):(e=Object.prototype.toString.call(t),Error(K(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function h1(e){function t(m,y){if(e){var g=m.deletions;g===null?(m.deletions=[y],m.flags|=16):g.push(y)}}function n(m,y){if(!e)return null;for(;y!==null;)t(m,y),y=y.sibling;return null}function r(m){for(var y=new Map;m!==null;)m.key!==null?y.set(m.key,m):y.set(m.index,m),m=m.sibling;return y}function s(m,y){return m=Jr(m,y),m.index=0,m.sibling=null,m}function i(m,y,g){return m.index=g,e?(g=m.alternate,g!==null?(g=g.index,g<y?(m.flags|=67108866,y):g):(m.flags|=67108866,y)):(m.flags|=1048576,y)}function o(m){return e&&m.alternate===null&&(m.flags|=67108866),m}function a(m,y,g,v){return y===null||y.tag!==6?(y=Uf(g,m.mode,v),y.return=m,y):(y=s(y,g),y.return=m,y)}function c(m,y,g,v){var N=g.type;return N===ro?d(m,y,g.props.children,v,g.key):y!==null&&(y.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ks&&fi(N)===y.type)?(y=s(y,g.props),ka(y,g),y.return=m,y):(y=du(g.type,g.key,g.props,null,m.mode,v),ka(y,g),y.return=m,y)}function u(m,y,g,v){return y===null||y.tag!==4||y.stateNode.containerInfo!==g.containerInfo||y.stateNode.implementation!==g.implementation?(y=If(g,m.mode,v),y.return=m,y):(y=s(y,g.children||[]),y.return=m,y)}function d(m,y,g,v,N){return y===null||y.tag!==7?(y=bi(g,m.mode,v,N),y.return=m,y):(y=s(y,g),y.return=m,y)}function f(m,y,g){if(typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint")return y=Uf(""+y,m.mode,g),y.return=m,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case kc:return g=du(y.type,y.key,y.props,null,m.mode,g),ka(g,y),g.return=m,g;case Oa:return y=If(y,m.mode,g),y.return=m,y;case ks:return y=fi(y),f(m,y,g)}if($a(y)||wa(y))return y=bi(y,m.mode,g,null),y.return=m,y;if(typeof y.then=="function")return f(m,Mc(y),g);if(y.$$typeof===Fr)return f(m,Cc(m,y),g);zc(m,y)}return null}function h(m,y,g,v){var N=y!==null?y.key:null;if(typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint")return N!==null?null:a(m,y,""+g,v);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case kc:return g.key===N?c(m,y,g,v):null;case Oa:return g.key===N?u(m,y,g,v):null;case ks:return g=fi(g),h(m,y,g,v)}if($a(g)||wa(g))return N!==null?null:d(m,y,g,v,null);if(typeof g.then=="function")return h(m,y,Mc(g),v);if(g.$$typeof===Fr)return h(m,y,Cc(m,g),v);zc(m,g)}return null}function p(m,y,g,v,N){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return m=m.get(g)||null,a(y,m,""+v,N);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case kc:return m=m.get(v.key===null?g:v.key)||null,c(y,m,v,N);case Oa:return m=m.get(v.key===null?g:v.key)||null,u(y,m,v,N);case ks:return v=fi(v),p(m,y,g,v,N)}if($a(v)||wa(v))return m=m.get(g)||null,d(y,m,v,N,null);if(typeof v.then=="function")return p(m,y,g,Mc(v),N);if(v.$$typeof===Fr)return p(m,y,g,Cc(y,v),N);zc(y,v)}return null}function x(m,y,g,v){for(var N=null,k=null,T=y,z=y=0,A=null;T!==null&&z<g.length;z++){T.index>z?(A=T,T=null):A=T.sibling;var L=h(m,T,g[z],v);if(L===null){T===null&&(T=A);break}e&&T&&L.alternate===null&&t(m,T),y=i(L,y,z),k===null?N=L:k.sibling=L,k=L,T=A}if(z===g.length)return n(m,T),_e&&Xr(m,z),N;if(T===null){for(;z<g.length;z++)T=f(m,g[z],v),T!==null&&(y=i(T,y,z),k===null?N=T:k.sibling=T,k=T);return _e&&Xr(m,z),N}for(T=r(T);z<g.length;z++)A=p(T,m,z,g[z],v),A!==null&&(e&&A.alternate!==null&&T.delete(A.key===null?z:A.key),y=i(A,y,z),k===null?N=A:k.sibling=A,k=A);return e&&T.forEach(function(R){return t(m,R)}),_e&&Xr(m,z),N}function b(m,y,g,v){if(g==null)throw Error(K(151));for(var N=null,k=null,T=y,z=y=0,A=null,L=g.next();T!==null&&!L.done;z++,L=g.next()){T.index>z?(A=T,T=null):A=T.sibling;var R=h(m,T,L.value,v);if(R===null){T===null&&(T=A);break}e&&T&&R.alternate===null&&t(m,T),y=i(R,y,z),k===null?N=R:k.sibling=R,k=R,T=A}if(L.done)return n(m,T),_e&&Xr(m,z),N;if(T===null){for(;!L.done;z++,L=g.next())L=f(m,L.value,v),L!==null&&(y=i(L,y,z),k===null?N=L:k.sibling=L,k=L);return _e&&Xr(m,z),N}for(T=r(T);!L.done;z++,L=g.next())L=p(T,m,z,L.value,v),L!==null&&(e&&L.alternate!==null&&T.delete(L.key===null?z:L.key),y=i(L,y,z),k===null?N=L:k.sibling=L,k=L);return e&&T.forEach(function(H){return t(m,H)}),_e&&Xr(m,z),N}function S(m,y,g,v){if(typeof g=="object"&&g!==null&&g.type===ro&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case kc:e:{for(var N=g.key;y!==null;){if(y.key===N){if(N=g.type,N===ro){if(y.tag===7){n(m,y.sibling),v=s(y,g.props.children),v.return=m,m=v;break e}}else if(y.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ks&&fi(N)===y.type){n(m,y.sibling),v=s(y,g.props),ka(v,g),v.return=m,m=v;break e}n(m,y);break}else t(m,y);y=y.sibling}g.type===ro?(v=bi(g.props.children,m.mode,v,g.key),v.return=m,m=v):(v=du(g.type,g.key,g.props,null,m.mode,v),ka(v,g),v.return=m,m=v)}return o(m);case Oa:e:{for(N=g.key;y!==null;){if(y.key===N)if(y.tag===4&&y.stateNode.containerInfo===g.containerInfo&&y.stateNode.implementation===g.implementation){n(m,y.sibling),v=s(y,g.children||[]),v.return=m,m=v;break e}else{n(m,y);break}else t(m,y);y=y.sibling}v=If(g,m.mode,v),v.return=m,m=v}return o(m);case ks:return g=fi(g),S(m,y,g,v)}if($a(g))return x(m,y,g,v);if(wa(g)){if(N=wa(g),typeof N!="function")throw Error(K(150));return g=N.call(g),b(m,y,g,v)}if(typeof g.then=="function")return S(m,y,Mc(g),v);if(g.$$typeof===Fr)return S(m,y,Cc(m,g),v);zc(m,g)}return typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint"?(g=""+g,y!==null&&y.tag===6?(n(m,y.sibling),v=s(y,g),v.return=m,m=v):(n(m,y),v=Uf(g,m.mode,v),v.return=m,m=v),o(m)):n(m,y)}return function(m,y,g,v){try{gl=0;var N=S(m,y,g,v);return No=null,N}catch(T){if(T===oa||T===Ld)throw T;var k=wn(29,T,null,m.mode);return k.lanes=v,k.return=m,k}finally{}}}var Ti=h1(!0),p1=h1(!1),Ns=!1;function Cm(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function op(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 Bs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Us(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ae&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,t=Ou(e),i1(e,null,n),t}return $d(e,r,t,n),Ou(e)}function Qa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,zb(e,n)}}function Yf(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var ap=!1;function Ka(){if(ap){var e=ko;if(e!==null)throw e}}function Wa(e,t,n,r){ap=!1;var s=e.updateQueue;Ns=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var c=a,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;o=0,d=u=c=null,a=i;do{var h=a.lane&-536870913,p=h!==a.lane;if(p?(Se&h)===h:(r&h)===h){h!==0&&h===Lo&&(ap=!0),d!==null&&(d=d.next={lane:0,tag:a.tag,payload:a.payload,callback:null,next:null});e:{var x=e,b=a;h=t;var S=n;switch(b.tag){case 1:if(x=b.payload,typeof x=="function"){f=x.call(S,f,h);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=b.payload,h=typeof x=="function"?x.call(S,f,h):x,h==null)break e;f=Fe({},f,h);break e;case 2:Ns=!0}}h=a.callback,h!==null&&(e.flags|=64,p&&(e.flags|=8192),p=s.callbacks,p===null?s.callbacks=[h]:p.push(h))}else p={lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,o|=h;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;p=a,a=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,i===null&&(s.shared.lanes=0),Fs|=o,e.lanes=o,e.memoizedState=f}}function m1(e,t){if(typeof e!="function")throw Error(K(191,e));e.call(t)}function g1(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)m1(n[e],t)}var Ho=Cr(null),Bu=Cr(0);function Hx(e,t){e=ls,Ye(Bu,e),Ye(Ho,t),ls=e|t.baseLanes}function lp(){Ye(Bu,ls),Ye(Ho,Ho.current)}function Mm(){ls=Bu.current,At(Ho),At(Bu)}var Cn=Cr(null),Yn=null;function Ts(e){var t=e.alternate;Ye(lt,lt.current&1),Ye(Cn,e),Yn===null&&(t===null||Ho.current!==null||t.memoizedState!==null)&&(Yn=e)}function cp(e){Ye(lt,lt.current),Ye(Cn,e),Yn===null&&(Yn=e)}function x1(e){e.tag===22?(Ye(lt,lt.current),Ye(Cn,e),Yn===null&&(Yn=e)):As()}function As(){Ye(lt,lt.current),Ye(Cn,Cn.current)}function bn(e){At(Cn),Yn===e&&(Yn=null),At(lt)}var lt=Cr(0);function Uu(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Tp(n)||Ap(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 is=0,ve=null,He=null,dt=null,Iu=!1,jo=!1,Ai=!1,Zu=0,xl=0,Eo=null,mj=0;function ot(){throw Error(K(321))}function zm(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!An(e[n],t[n]))return!1;return!0}function Dm(e,t,n,r,s,i){return is=i,ve=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,pe.H=e===null||e.memoizedState===null?P1:qm,Ai=!1,i=n(r,s),Ai=!1,jo&&(i=v1(t,n,r,s)),y1(e),i}function y1(e){pe.H=yl;var t=He!==null&&He.next!==null;if(is=0,dt=He=ve=null,Iu=!1,xl=0,Eo=null,t)throw Error(K(300));e===null||pt||(e=e.dependencies,e!==null&&Lu(e)&&(pt=!0))}function v1(e,t,n,r){ve=e;var s=0;do{if(jo&&(Eo=null),xl=0,jo=!1,25<=s)throw Error(K(301));if(s+=1,dt=He=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}pe.H=F1,i=t(n,r)}while(jo);return i}function gj(){var e=pe.H,t=e.useState()[0];return t=typeof t.then=="function"?ql(t):t,e=e.useState()[0],(He!==null?He.memoizedState:null)!==e&&(ve.flags|=1024),t}function Rm(){var e=Zu!==0;return Zu=0,e}function Om(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function $m(e){if(Iu){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Iu=!1}is=0,dt=He=ve=null,jo=!1,xl=Zu=0,Eo=null}function Pt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?ve.memoizedState=dt=e:dt=dt.next=e,dt}function ct(){if(He===null){var e=ve.alternate;e=e!==null?e.memoizedState:null}else e=He.next;var t=dt===null?ve.memoizedState:dt.next;if(t!==null)dt=t,He=e;else{if(e===null)throw ve.alternate===null?Error(K(467)):Error(K(310));He=e,e={memoizedState:He.memoizedState,baseState:He.baseState,baseQueue:He.baseQueue,queue:He.queue,next:null},dt===null?ve.memoizedState=dt=e:dt=dt.next=e}return dt}function Hd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ql(e){var t=xl;return xl+=1,Eo===null&&(Eo=[]),e=f1(Eo,e,t),t=ve,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,pe.H=t===null||t.memoizedState===null?P1:qm),e}function Bd(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ql(e);if(e.$$typeof===Fr)return Bt(e)}throw Error(K(438,String(e)))}function Lm(e){var t=null,n=ve.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=ve.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Hd(),ve.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=tN;return t.index++,n}function os(e,t){return typeof t=="function"?t(e):t}function hu(e){var t=ct();return Hm(t,He,e)}function Hm(e,t,n){var r=e.queue;if(r===null)throw Error(K(311));r.lastRenderedReducer=n;var s=e.baseQueue,i=r.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}t.baseQueue=s=i,r.pending=null}if(i=e.baseState,s===null)e.memoizedState=i;else{t=s.next;var a=o=null,c=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f!==u.lane?(Se&f)===f:(is&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===Lo&&(d=!0);else if((is&h)===h){u=u.next,h===Lo&&(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?(a=c=f,o=i):c=c.next=f,ve.lanes|=h,Fs|=h;f=u.action,Ai&&n(i,f),i=u.hasEagerState?u.eagerState:n(i,f)}else h={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(a=c=h,o=i):c=c.next=h,ve.lanes|=f,Fs|=f;u=u.next}while(u!==null&&u!==t);if(c===null?o=i:c.next=a,!An(i,e.memoizedState)&&(pt=!0,d&&(n=ko,n!==null)))throw n;e.memoizedState=i,e.baseState=o,e.baseQueue=c,r.lastRenderedState=i}return s===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function qf(e){var t=ct(),n=t.queue;if(n===null)throw Error(K(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);An(i,t.memoizedState)||(pt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function b1(e,t,n){var r=ve,s=ct(),i=_e;if(i){if(n===void 0)throw Error(K(407));n=n()}else n=t();var o=!An((He||s).memoizedState,n);if(o&&(s.memoizedState=n,pt=!0),s=s.queue,Bm(_1.bind(null,r,s,e),[e]),s.getSnapshot!==t||o||dt!==null&&dt.memoizedState.tag&1){if(r.flags|=2048,Bo(9,{destroy:void 0},S1.bind(null,r,s,n,t),null),Ie===null)throw Error(K(349));i||is&127||w1(r,t,n)}return n}function w1(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ve.updateQueue,t===null?(t=Hd(),ve.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function S1(e,t,n,r){t.value=n,t.getSnapshot=r,k1(t)&&N1(e)}function _1(e,t,n){return n(function(){k1(t)&&N1(e)})}function k1(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!An(e,n)}catch{return!0}}function N1(e){var t=Bi(e,2);t!==null&&cn(t,e,2)}function up(e){var t=Pt();if(typeof e=="function"){var n=e;if(e=n(),Ai){zs(!0);try{n()}finally{zs(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:e},t}function j1(e,t,n,r){return e.baseState=n,Hm(e,He,typeof r=="function"?r:os)}function xj(e,t,n,r,s){if(Id(e))throw Error(K(485));if(e=t.action,e!==null){var i={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){i.listeners.push(o)}};pe.T!==null?n(!0):i.isTransition=!1,r(i),n=t.pending,n===null?(i.next=t.pending=i,E1(t,i)):(i.next=n.next,t.pending=n.next=i)}}function E1(e,t){var n=t.action,r=t.payload,s=e.state;if(t.isTransition){var i=pe.T,o={};pe.T=o;try{var a=n(s,r),c=pe.S;c!==null&&c(o,a),Bx(e,t,a)}catch(u){dp(e,t,u)}finally{i!==null&&o.types!==null&&(i.types=o.types),pe.T=i}}else try{i=n(s,r),Bx(e,t,i)}catch(u){dp(e,t,u)}}function Bx(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){Ux(e,t,r)},function(r){return dp(e,t,r)}):Ux(e,t,n)}function Ux(e,t,n){t.status="fulfilled",t.value=n,T1(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,E1(e,n)))}function dp(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=n,T1(t),t=t.next;while(t!==r)}e.action=null}function T1(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function A1(e,t){return t}function Ix(e,t){if(_e){var n=Ie.formState;if(n!==null){e:{var r=ve;if(_e){if(Ge){t:{for(var s=Ge,i=Zn;s.nodeType!==8;){if(!i){s=null;break t}if(s=qn(s.nextSibling),s===null){s=null;break t}}i=s.data,s=i==="F!"||i==="F"?s:null}if(s){Ge=qn(s.nextSibling),r=s.data==="F!";break e}}Xs(r)}r=!1}r&&(t=n[0])}}return n=Pt(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:A1,lastRenderedState:t},n.queue=r,n=V1.bind(null,ve,r),r.dispatch=n,r=up(!1),i=Ym.bind(null,ve,!1,r.queue),r=Pt(),s={state:t,dispatch:null,action:e,pending:null},r.queue=s,n=xj.bind(null,ve,s,i,n),s.dispatch=n,r.memoizedState=e,[t,n,!1]}function Zx(e){var t=ct();return C1(t,He,e)}function C1(e,t,n){if(t=Hm(e,t,A1)[0],e=hu(os)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=ql(t)}catch(o){throw o===oa?Ld:o}else r=t;t=ct();var s=t.queue,i=s.dispatch;return n!==t.memoizedState&&(ve.flags|=2048,Bo(9,{destroy:void 0},yj.bind(null,s,n),null)),[r,i,e]}function yj(e,t){e.action=t}function Yx(e){var t=ct(),n=He;if(n!==null)return C1(t,n,e);ct(),t=t.memoizedState,n=ct();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Bo(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=ve.updateQueue,t===null&&(t=Hd(),ve.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function M1(){return ct().memoizedState}function pu(e,t,n,r){var s=Pt();ve.flags|=e,s.memoizedState=Bo(1|t,{destroy:void 0},n,r===void 0?null:r)}function Ud(e,t,n,r){var s=ct();r=r===void 0?null:r;var i=s.memoizedState.inst;He!==null&&r!==null&&zm(r,He.memoizedState.deps)?s.memoizedState=Bo(t,i,n,r):(ve.flags|=e,s.memoizedState=Bo(1|t,i,n,r))}function qx(e,t){pu(8390656,8,e,t)}function Bm(e,t){Ud(2048,8,e,t)}function vj(e){ve.flags|=4;var t=ve.updateQueue;if(t===null)t=Hd(),ve.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function z1(e){var t=ct().memoizedState;return vj({ref:t,nextImpl:e}),function(){if(Ae&2)throw Error(K(440));return t.impl.apply(void 0,arguments)}}function D1(e,t){return Ud(4,2,e,t)}function R1(e,t){return Ud(4,4,e,t)}function O1(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 $1(e,t,n){n=n!=null?n.concat([e]):null,Ud(4,4,O1.bind(null,t,e),n)}function Um(){}function L1(e,t){var n=ct();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&zm(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function H1(e,t){var n=ct();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&zm(t,r[1]))return r[0];if(r=e(),Ai){zs(!0);try{e()}finally{zs(!1)}}return n.memoizedState=[r,t],r}function Im(e,t,n){return n===void 0||is&1073741824&&!(Se&261930)?e.memoizedState=t:(e.memoizedState=n,e=jw(),ve.lanes|=e,Fs|=e,n)}function B1(e,t,n,r){return An(n,t)?n:Ho.current!==null?(e=Im(e,n,r),An(e,t)||(pt=!0),e):!(is&42)||is&1073741824&&!(Se&261930)?(pt=!0,e.memoizedState=n):(e=jw(),ve.lanes|=e,Fs|=e,t)}function U1(e,t,n,r,s){var i=Ce.p;Ce.p=i!==0&&8>i?i:8;var o=pe.T,a={};pe.T=a,Ym(e,!1,t,n);try{var c=s(),u=pe.S;if(u!==null&&u(a,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=pj(c,r);Ja(e,t,d,Tn(e))}else Ja(e,t,r,Tn(e))}catch(f){Ja(e,t,{then:function(){},status:"rejected",reason:f},Tn())}finally{Ce.p=i,o!==null&&a.types!==null&&(o.types=a.types),pe.T=o}}function bj(){}function fp(e,t,n,r){if(e.tag!==5)throw Error(K(476));var s=I1(e).queue;U1(e,s,t,vi,n===null?bj:function(){return Z1(e),n(r)})}function I1(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:vi,baseState:vi,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:vi},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Z1(e){var t=I1(e);t.next===null&&(t=e.alternate.memoizedState),Ja(e,t.next.queue,{},Tn())}function Zm(){return Bt(wl)}function Y1(){return ct().memoizedState}function q1(){return ct().memoizedState}function wj(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Tn();e=Bs(n);var r=Us(t,e,n);r!==null&&(cn(r,t,n),Qa(r,t,n)),t={cache:Em()},e.payload=t;return}t=t.return}}function Sj(e,t,n){var r=Tn();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Id(e)?G1(t,n):(n=_m(e,t,n,r),n!==null&&(cn(n,e,r),X1(n,t,r)))}function V1(e,t,n){var r=Tn();Ja(e,t,n,r)}function Ja(e,t,n,r){var s={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Id(e))G1(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,An(a,o))return $d(e,t,s,0),Ie===null&&Od(),!1}catch{}finally{}if(n=_m(e,t,s,r),n!==null)return cn(n,e,r),X1(n,t,r),!0}return!1}function Ym(e,t,n,r){if(r={lane:2,revertLane:Wm(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Id(e)){if(t)throw Error(K(479))}else t=_m(e,n,r,2),t!==null&&cn(t,e,2)}function Id(e){var t=e.alternate;return e===ve||t!==null&&t===ve}function G1(e,t){jo=Iu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function X1(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,zb(e,n)}}var yl={readContext:Bt,use:Bd,useCallback:ot,useContext:ot,useEffect:ot,useImperativeHandle:ot,useLayoutEffect:ot,useInsertionEffect:ot,useMemo:ot,useReducer:ot,useRef:ot,useState:ot,useDebugValue:ot,useDeferredValue:ot,useTransition:ot,useSyncExternalStore:ot,useId:ot,useHostTransitionStatus:ot,useFormState:ot,useActionState:ot,useOptimistic:ot,useMemoCache:ot,useCacheRefresh:ot};yl.useEffectEvent=ot;var P1={readContext:Bt,use:Bd,useCallback:function(e,t){return Pt().memoizedState=[e,t===void 0?null:t],e},useContext:Bt,useEffect:qx,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,pu(4194308,4,O1.bind(null,t,e),n)},useLayoutEffect:function(e,t){return pu(4194308,4,e,t)},useInsertionEffect:function(e,t){pu(4,2,e,t)},useMemo:function(e,t){var n=Pt();t=t===void 0?null:t;var r=e();if(Ai){zs(!0);try{e()}finally{zs(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Pt();if(n!==void 0){var s=n(t);if(Ai){zs(!0);try{n(t)}finally{zs(!1)}}}else s=t;return r.memoizedState=r.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},r.queue=e,e=e.dispatch=Sj.bind(null,ve,e),[r.memoizedState,e]},useRef:function(e){var t=Pt();return e={current:e},t.memoizedState=e},useState:function(e){e=up(e);var t=e.queue,n=V1.bind(null,ve,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Um,useDeferredValue:function(e,t){var n=Pt();return Im(n,e,t)},useTransition:function(){var e=up(!1);return e=U1.bind(null,ve,e.queue,!0,!1),Pt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=ve,s=Pt();if(_e){if(n===void 0)throw Error(K(407));n=n()}else{if(n=t(),Ie===null)throw Error(K(349));Se&127||w1(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,qx(_1.bind(null,r,i,e),[e]),r.flags|=2048,Bo(9,{destroy:void 0},S1.bind(null,r,i,n,t),null),n},useId:function(){var e=Pt(),t=Ie.identifierPrefix;if(_e){var n=kr,r=_r;n=(r&~(1<<32-En(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Zu++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=mj++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Zm,useFormState:Ix,useActionState:Ix,useOptimistic:function(e){var t=Pt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ym.bind(null,ve,!0,n),n.dispatch=t,[e,t]},useMemoCache:Lm,useCacheRefresh:function(){return Pt().memoizedState=wj.bind(null,ve)},useEffectEvent:function(e){var t=Pt(),n={impl:e};return t.memoizedState=n,function(){if(Ae&2)throw Error(K(440));return n.impl.apply(void 0,arguments)}}},qm={readContext:Bt,use:Bd,useCallback:L1,useContext:Bt,useEffect:Bm,useImperativeHandle:$1,useInsertionEffect:D1,useLayoutEffect:R1,useMemo:H1,useReducer:hu,useRef:M1,useState:function(){return hu(os)},useDebugValue:Um,useDeferredValue:function(e,t){var n=ct();return B1(n,He.memoizedState,e,t)},useTransition:function(){var e=hu(os)[0],t=ct().memoizedState;return[typeof e=="boolean"?e:ql(e),t]},useSyncExternalStore:b1,useId:Y1,useHostTransitionStatus:Zm,useFormState:Zx,useActionState:Zx,useOptimistic:function(e,t){var n=ct();return j1(n,He,e,t)},useMemoCache:Lm,useCacheRefresh:q1};qm.useEffectEvent=z1;var F1={readContext:Bt,use:Bd,useCallback:L1,useContext:Bt,useEffect:Bm,useImperativeHandle:$1,useInsertionEffect:D1,useLayoutEffect:R1,useMemo:H1,useReducer:qf,useRef:M1,useState:function(){return qf(os)},useDebugValue:Um,useDeferredValue:function(e,t){var n=ct();return He===null?Im(n,e,t):B1(n,He.memoizedState,e,t)},useTransition:function(){var e=qf(os)[0],t=ct().memoizedState;return[typeof e=="boolean"?e:ql(e),t]},useSyncExternalStore:b1,useId:Y1,useHostTransitionStatus:Zm,useFormState:Yx,useActionState:Yx,useOptimistic:function(e,t){var n=ct();return He!==null?j1(n,He,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Lm,useCacheRefresh:q1};F1.useEffectEvent=z1;function Vf(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Fe({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var hp={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Tn(),s=Bs(r);s.payload=t,n!=null&&(s.callback=n),t=Us(e,s,r),t!==null&&(cn(t,e,r),Qa(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Tn(),s=Bs(r);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Us(e,s,r),t!==null&&(cn(t,e,r),Qa(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Tn(),r=Bs(n);r.tag=2,t!=null&&(r.callback=t),t=Us(e,r,n),t!==null&&(cn(t,e,n),Qa(t,e,n))}};function Vx(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!hl(n,r)||!hl(s,i):!0}function Gx(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&hp.enqueueReplaceState(t,t.state,null)}function Ci(e,t){var n=t;if("ref"in t){n={};for(var r in t)r!=="ref"&&(n[r]=t[r])}if(e=e.defaultProps){n===t&&(n=Fe({},n));for(var s in e)n[s]===void 0&&(n[s]=e[s])}return n}function Q1(e){Ru(e)}function K1(e){console.error(e)}function W1(e){Ru(e)}function Yu(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function Xx(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function pp(e,t,n){return n=Bs(n),n.tag=3,n.payload={element:null},n.callback=function(){Yu(e,t)},n}function J1(e){return e=Bs(e),e.tag=3,e}function ew(e,t,n,r){var s=n.type.getDerivedStateFromError;if(typeof s=="function"){var i=r.value;e.payload=function(){return s(i)},e.callback=function(){Xx(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){Xx(t,n,r),typeof s!="function"&&(Is===null?Is=new Set([this]):Is.add(this));var a=r.stack;this.componentDidCatch(r.value,{componentStack:a!==null?a:""})})}function _j(e,t,n,r,s){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=n.alternate,t!==null&&ia(t,n,s,!0),n=Cn.current,n!==null){switch(n.tag){case 31:case 13:return Yn===null?Pu():n.alternate===null&&at===0&&(at=3),n.flags&=-257,n.flags|=65536,n.lanes=s,r===Hu?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),nh(e,r,s)),!1;case 22:return n.flags|=65536,r===Hu?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),nh(e,r,s)),!1}throw Error(K(435,n.tag))}return nh(e,r,s),Pu(),!1}if(_e)return t=Cn.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=s,r!==tp&&(e=Error(K(422),{cause:r}),ml(In(e,n)))):(r!==tp&&(t=Error(K(423),{cause:r}),ml(In(t,n))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,r=In(r,n),s=pp(e.stateNode,r,s),Yf(e,s),at!==4&&(at=2)),!1;var i=Error(K(520),{cause:r});if(i=In(i,n),nl===null?nl=[i]:nl.push(i),at!==4&&(at=2),t===null)return!0;r=In(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=s&-s,n.lanes|=e,e=pp(n.stateNode,r,e),Yf(n,e),!1;case 1:if(t=n.type,i=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(Is===null||!Is.has(i))))return n.flags|=65536,s&=-s,n.lanes|=s,s=J1(s),ew(s,e,n,r),Yf(n,s),!1}n=n.return}while(n!==null);return!1}var Vm=Error(K(461)),pt=!1;function $t(e,t,n,r){t.child=e===null?p1(t,null,n,r):Ti(t,e.child,n,r)}function Px(e,t,n,r,s){n=n.render;var i=t.ref;if("ref"in r){var o={};for(var a in r)a!=="ref"&&(o[a]=r[a])}else o=r;return Ei(t),r=Dm(e,t,n,o,i,s),a=Rm(),e!==null&&!pt?(Om(e,t,s),as(e,t,s)):(_e&&a&&Nm(t),t.flags|=1,$t(e,t,r,s),t.child)}function Fx(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!km(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,tw(e,t,i,r,s)):(e=du(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!Gm(e,s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:hl,n(o,r)&&e.ref===t.ref)return as(e,t,s)}return t.flags|=1,e=Jr(i,r),e.ref=t.ref,e.return=t,t.child=e}function tw(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(hl(i,r)&&e.ref===t.ref)if(pt=!1,t.pendingProps=r=i,Gm(e,s))e.flags&131072&&(pt=!0);else return t.lanes=e.lanes,as(e,t,s)}return mp(e,t,n,r,s)}function nw(e,t,n,r){var s=r.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if(t.flags&128){if(i=i!==null?i.baseLanes|n:n,e!==null){for(r=t.child=e.child,s=0;r!==null;)s=s|r.lanes|r.childLanes,r=r.sibling;r=s&~i}else r=0,t.child=null;return Qx(e,t,i,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&fu(t,i!==null?i.cachePool:null),i!==null?Hx(t,i):lp(),x1(t);else return r=t.lanes=536870912,Qx(e,t,i!==null?i.baseLanes|n:n,n,r)}else i!==null?(fu(t,i.cachePool),Hx(t,i),As(),t.memoizedState=null):(e!==null&&fu(t,null),lp(),As());return $t(e,t,s,n),t.child}function Ha(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Qx(e,t,n,r,s){var i=Tm();return i=i===null?null:{parent:ht._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&fu(t,null),lp(),x1(t),e!==null&&ia(e,t,r,!0),t.childLanes=s,null}function mu(e,t){return t=qu({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Kx(e,t,n){return Ti(t,e.child,null,n),e=mu(t,t.pendingProps),e.flags|=2,bn(t),t.memoizedState=null,e}function kj(e,t,n){var r=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(_e){if(r.mode==="hidden")return e=mu(t,r),t.lanes=536870912,Ha(null,e);if(cp(t),(e=Ge)?(e=Pw(e,Zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Gs!==null?{id:_r,overflow:kr}:null,retryLane:536870912,hydrationErrors:null},n=a1(e),n.return=t,t.child=n,Ht=t,Ge=null)):e=null,e===null)throw Xs(t);return t.lanes=536870912,null}return mu(t,r)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(cp(t),s)if(t.flags&256)t.flags&=-257,t=Kx(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(K(558));else if(pt||ia(e,t,n,!1),s=(n&e.childLanes)!==0,pt||s){if(r=Ie,r!==null&&(o=Db(r,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,Bi(e,o),cn(r,e,o),Vm;Pu(),t=Kx(e,t,n)}else e=i.treeContext,Ge=qn(o.nextSibling),Ht=t,_e=!0,Hs=null,Zn=!1,e!==null&&c1(t,e),t=mu(t,r),t.flags|=4096;return t}return e=Jr(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function gu(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(K(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function mp(e,t,n,r,s){return Ei(t),n=Dm(e,t,n,r,void 0,s),r=Rm(),e!==null&&!pt?(Om(e,t,s),as(e,t,s)):(_e&&r&&Nm(t),t.flags|=1,$t(e,t,n,s),t.child)}function Wx(e,t,n,r,s,i){return Ei(t),t.updateQueue=null,n=v1(t,r,n,s),y1(e),r=Rm(),e!==null&&!pt?(Om(e,t,i),as(e,t,i)):(_e&&r&&Nm(t),t.flags|=1,$t(e,t,n,i),t.child)}function Jx(e,t,n,r,s){if(Ei(t),t.stateNode===null){var i=fo,o=n.contextType;typeof o=="object"&&o!==null&&(i=Bt(o)),i=new n(r,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=hp,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=r,i.state=t.memoizedState,i.refs={},Cm(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?Bt(o):fo,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(Vf(t,n,o,r),i.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(o=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),o!==i.state&&hp.enqueueReplaceState(i,i.state,null),Wa(t,r,i,s),Ka(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){i=t.stateNode;var a=t.memoizedProps,c=Ci(n,a);i.props=c;var u=i.context,d=n.contextType;o=fo,typeof d=="object"&&d!==null&&(o=Bt(d));var f=n.getDerivedStateFromProps;d=typeof f=="function"||typeof i.getSnapshotBeforeUpdate=="function",a=t.pendingProps!==a,d||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a||u!==o)&&Gx(t,i,r,o),Ns=!1;var h=t.memoizedState;i.state=h,Wa(t,r,i,s),Ka(),u=t.memoizedState,a||h!==u||Ns?(typeof f=="function"&&(Vf(t,n,f,r),u=t.memoizedState),(c=Ns||Vx(t,n,c,r,h,u,o))?(d||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),i.props=r,i.state=u,i.context=o,r=c):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,op(e,t),o=t.memoizedProps,d=Ci(n,o),i.props=d,f=t.pendingProps,h=i.context,u=n.contextType,c=fo,typeof u=="object"&&u!==null&&(c=Bt(u)),a=n.getDerivedStateFromProps,(u=typeof a=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==f||h!==c)&&Gx(t,i,r,c),Ns=!1,h=t.memoizedState,i.state=h,Wa(t,r,i,s),Ka();var p=t.memoizedState;o!==f||h!==p||Ns||e!==null&&e.dependencies!==null&&Lu(e.dependencies)?(typeof a=="function"&&(Vf(t,n,a,r),p=t.memoizedState),(d=Ns||Vx(t,n,d,r,h,p,c)||e!==null&&e.dependencies!==null&&Lu(e.dependencies))?(u||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,p,c),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,p,c)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),i.props=r,i.state=p,i.context=c,r=d):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,gu(e,t),r=(t.flags&128)!==0,i||r?(i=t.stateNode,n=r&&typeof n.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&r?(t.child=Ti(t,e.child,null,s),t.child=Ti(t,null,n,s)):$t(e,t,n,s),t.memoizedState=i.state,e=t.child):e=as(e,t,s),e}function e0(e,t,n,r){return ji(),t.flags|=256,$t(e,t,n,r),t.child}var Gf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xf(e){return{baseLanes:e,cachePool:d1()}}function Pf(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=kn),e}function rw(e,t,n){var r=t.pendingProps,s=!1,i=(t.flags&128)!==0,o;if((o=i)||(o=e!==null&&e.memoizedState===null?!1:(lt.current&2)!==0),o&&(s=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(_e){if(s?Ts(t):As(),(e=Ge)?(e=Pw(e,Zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Gs!==null?{id:_r,overflow:kr}:null,retryLane:536870912,hydrationErrors:null},n=a1(e),n.return=t,t.child=n,Ht=t,Ge=null)):e=null,e===null)throw Xs(t);return Ap(e)?t.lanes=32:t.lanes=536870912,null}var a=r.children;return r=r.fallback,s?(As(),s=t.mode,a=qu({mode:"hidden",children:a},s),r=bi(r,s,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Xf(n),r.childLanes=Pf(e,o,n),t.memoizedState=Gf,Ha(null,r)):(Ts(t),gp(t,a))}var c=e.memoizedState;if(c!==null&&(a=c.dehydrated,a!==null)){if(i)t.flags&256?(Ts(t),t.flags&=-257,t=Ff(e,t,n)):t.memoizedState!==null?(As(),t.child=e.child,t.flags|=128,t=null):(As(),a=r.fallback,s=t.mode,r=qu({mode:"visible",children:r.children},s),a=bi(a,s,n,null),a.flags|=2,r.return=t,a.return=t,r.sibling=a,t.child=r,Ti(t,e.child,null,n),r=t.child,r.memoizedState=Xf(n),r.childLanes=Pf(e,o,n),t.memoizedState=Gf,t=Ha(null,r));else if(Ts(t),Ap(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var u=o.dgst;o=u,r=Error(K(419)),r.stack="",r.digest=o,ml({value:r,source:null,stack:null}),t=Ff(e,t,n)}else if(pt||ia(e,t,n,!1),o=(n&e.childLanes)!==0,pt||o){if(o=Ie,o!==null&&(r=Db(o,n),r!==0&&r!==c.retryLane))throw c.retryLane=r,Bi(e,r),cn(o,e,r),Vm;Tp(a)||Pu(),t=Ff(e,t,n)}else Tp(a)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,Ge=qn(a.nextSibling),Ht=t,_e=!0,Hs=null,Zn=!1,e!==null&&c1(t,e),t=gp(t,r.children),t.flags|=4096);return t}return s?(As(),a=r.fallback,s=t.mode,c=e.child,u=c.sibling,r=Jr(c,{mode:"hidden",children:r.children}),r.subtreeFlags=c.subtreeFlags&65011712,u!==null?a=Jr(u,a):(a=bi(a,s,n,null),a.flags|=2),a.return=t,r.return=t,r.sibling=a,t.child=r,Ha(null,r),r=t.child,a=e.child.memoizedState,a===null?a=Xf(n):(s=a.cachePool,s!==null?(c=ht._currentValue,s=s.parent!==c?{parent:c,pool:c}:s):s=d1(),a={baseLanes:a.baseLanes|n,cachePool:s}),r.memoizedState=a,r.childLanes=Pf(e,o,n),t.memoizedState=Gf,Ha(e.child,r)):(Ts(t),n=e.child,e=n.sibling,n=Jr(n,{mode:"visible",children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function gp(e,t){return t=qu({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function qu(e,t){return e=wn(22,e,null,t),e.lanes=0,e}function Ff(e,t,n){return Ti(t,e.child,null,n),e=gp(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function t0(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),rp(e.return,t,n)}function Qf(e,t,n,r,s,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s,treeForkCount:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=s,o.treeForkCount=i)}function sw(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;r=r.children;var o=lt.current,a=(o&2)!==0;if(a?(o=o&1|2,t.flags|=128):o&=1,Ye(lt,o),$t(e,t,r,n),r=_e?pl:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&t0(e,n,t);else if(e.tag===19)t0(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(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&Uu(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Qf(t,!1,s,n,i,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Uu(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Qf(t,!0,n,null,i,r);break;case"together":Qf(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function as(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Fs|=t.lanes,!(n&t.childLanes))if(e!==null){if(ia(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(K(153));if(t.child!==null){for(e=t.child,n=Jr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Jr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Gm(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Lu(e)))}function Nj(e,t,n){switch(t.tag){case 3:Cu(t,t.stateNode.containerInfo),Es(t,ht,e.memoizedState.cache),ji();break;case 27:case 5:qh(t);break;case 4:Cu(t,t.stateNode.containerInfo);break;case 10:Es(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,cp(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Ts(t),t.flags|=128,null):n&t.child.childLanes?rw(e,t,n):(Ts(t),e=as(e,t,n),e!==null?e.sibling:null);Ts(t);break;case 19:var s=(e.flags&128)!==0;if(r=(n&t.childLanes)!==0,r||(ia(e,t,n,!1),r=(n&t.childLanes)!==0),s){if(r)return sw(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Ye(lt,lt.current),r)break;return null;case 22:return t.lanes=0,nw(e,t,n,t.pendingProps);case 24:Es(t,ht,e.memoizedState.cache)}return as(e,t,n)}function iw(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)pt=!0;else{if(!Gm(e,n)&&!(t.flags&128))return pt=!1,Nj(e,t,n);pt=!!(e.flags&131072)}else pt=!1,_e&&t.flags&1048576&&l1(t,pl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=fi(t.elementType),t.type=e,typeof e=="function")km(e)?(r=Ci(e,r),t.tag=1,t=Jx(null,t,e,r,n)):(t.tag=0,t=mp(null,t,e,r,n));else{if(e!=null){var s=e.$$typeof;if(s===um){t.tag=11,t=Px(null,t,e,r,n);break e}else if(s===dm){t.tag=14,t=Fx(null,t,e,r,n);break e}}throw t=Zh(e)||e,Error(K(306,t,""))}}return t;case 0:return mp(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,s=Ci(r,t.pendingProps),Jx(e,t,r,s,n);case 3:e:{if(Cu(t,t.stateNode.containerInfo),e===null)throw Error(K(387));r=t.pendingProps;var i=t.memoizedState;s=i.element,op(e,t),Wa(t,r,null,n);var o=t.memoizedState;if(r=o.cache,Es(t,ht,r),r!==i.cache&&sp(t,[ht],n,!0),Ka(),r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=e0(e,t,r,n);break e}else if(r!==s){s=In(Error(K(424)),t),ml(s),t=e0(e,t,r,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(Ge=qn(e.firstChild),Ht=t,_e=!0,Hs=null,Zn=!0,n=p1(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ji(),r===s){t=as(e,t,n);break e}$t(e,t,r,n)}t=t.child}return t;case 26:return gu(e,t),e===null?(n=w0(t.type,null,t.pendingProps,null))?t.memoizedState=n:_e||(n=t.type,e=t.pendingProps,r=Wu(Ls.current).createElement(n),r[Lt]=t,r[un]=e,Ut(r,n,e),Tt(r),t.stateNode=r):t.memoizedState=w0(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return qh(t),e===null&&_e&&(r=t.stateNode=Fw(t.type,t.pendingProps,Ls.current),Ht=t,Zn=!0,s=Ge,Ws(t.type)?(Cp=s,Ge=qn(r.firstChild)):Ge=s),$t(e,t,t.pendingProps.children,n),gu(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&_e&&((s=r=Ge)&&(r=tE(r,t.type,t.pendingProps,Zn),r!==null?(t.stateNode=r,Ht=t,Ge=qn(r.firstChild),Zn=!1,s=!0):s=!1),s||Xs(t)),qh(t),s=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,r=i.children,jp(s,i)?r=null:o!==null&&jp(s,o)&&(t.flags|=32),t.memoizedState!==null&&(s=Dm(e,t,gj,null,null,n),wl._currentValue=s),gu(e,t),$t(e,t,r,n),t.child;case 6:return e===null&&_e&&((e=n=Ge)&&(n=nE(n,t.pendingProps,Zn),n!==null?(t.stateNode=n,Ht=t,Ge=null,e=!0):e=!1),e||Xs(t)),null;case 13:return rw(e,t,n);case 4:return Cu(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ti(t,null,r,n):$t(e,t,r,n),t.child;case 11:return Px(e,t,t.type,t.pendingProps,n);case 7:return $t(e,t,t.pendingProps,n),t.child;case 8:return $t(e,t,t.pendingProps.children,n),t.child;case 12:return $t(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Es(t,t.type,r.value),$t(e,t,r.children,n),t.child;case 9:return s=t.type._context,r=t.pendingProps.children,Ei(t),s=Bt(s),r=r(s),t.flags|=1,$t(e,t,r,n),t.child;case 14:return Fx(e,t,t.type,t.pendingProps,n);case 15:return tw(e,t,t.type,t.pendingProps,n);case 19:return sw(e,t,n);case 31:return kj(e,t,n);case 22:return nw(e,t,n,t.pendingProps);case 24:return Ei(t),r=Bt(ht),e===null?(s=Tm(),s===null&&(s=Ie,i=Em(),s.pooledCache=i,i.refCount++,i!==null&&(s.pooledCacheLanes|=n),s=i),t.memoizedState={parent:r,cache:s},Cm(t),Es(t,ht,s)):(e.lanes&n&&(op(e,t),Wa(t,null,null,n),Ka()),s=e.memoizedState,i=t.memoizedState,s.parent!==r?(s={parent:r,cache:r},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),Es(t,ht,r)):(r=i.cache,Es(t,ht,r),r!==s.cache&&sp(t,[ht],n,!0))),$t(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(K(156,t.tag))}function Ur(e){e.flags|=4}function Kf(e,t,n,r,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if(Aw())e.flags|=8192;else throw Si=Hu,Am}else e.flags&=-16777217}function n0(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Ww(t))if(Aw())e.flags|=8192;else throw Si=Hu,Am}function Dc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Cb():536870912,e.lanes|=t,Uo|=t)}function Na(e,t){if(!_e)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 r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ve(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&65011712,r|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function jj(e,t,n){var r=t.pendingProps;switch(jm(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ve(t),null;case 1:return Ve(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),es(ht),Ro(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Fi(t)?Ur(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Zf())),Ve(t),null;case 26:var s=t.type,i=t.memoizedState;return e===null?(Ur(t),i!==null?(Ve(t),n0(t,i)):(Ve(t),Kf(t,s,null,r,n))):i?i!==e.memoizedState?(Ur(t),Ve(t),n0(t,i)):(Ve(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Ur(t),Ve(t),Kf(t,s,e,r,n)),null;case 27:if(Mu(t),n=Ls.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ur(t);else{if(!r){if(t.stateNode===null)throw Error(K(166));return Ve(t),null}e=jr.current,Fi(t)?Mx(t):(e=Fw(s,r,n),t.stateNode=e,Ur(t))}return Ve(t),null;case 5:if(Mu(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ur(t);else{if(!r){if(t.stateNode===null)throw Error(K(166));return Ve(t),null}if(i=jr.current,Fi(t))Mx(t);else{var o=Wu(Ls.current);switch(i){case 1:i=o.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:i=o.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":i=o.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":i=o.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":i=o.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof r.is=="string"?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?i.multiple=!0:r.size&&(i.size=r.size);break;default:i=typeof r.is=="string"?o.createElement(s,{is:r.is}):o.createElement(s)}}i[Lt]=t,i[un]=r;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)i.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=i;e:switch(Ut(i,s,r),s){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Ur(t)}}return Ve(t),Kf(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ur(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(K(166));if(e=Ls.current,Fi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,s=Ht,s!==null)switch(s.tag){case 27:case 5:r=s.memoizedProps}e[Lt]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||Vw(e.nodeValue,n)),e||Xs(t,!0)}else e=Wu(e).createTextNode(r),e[Lt]=t,t.stateNode=e}return Ve(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Fi(t),n!==null){if(e===null){if(!r)throw Error(K(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(K(557));e[Lt]=t}else ji(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ve(t),e=!1}else n=Zf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(bn(t),t):(bn(t),null);if(t.flags&128)throw Error(K(558))}return Ve(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=Fi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(K(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(K(317));s[Lt]=t}else ji(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ve(t),s=!1}else s=Zf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(bn(t),t):(bn(t),null)}return bn(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,s=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(s=r.alternate.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==s&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Dc(t,t.updateQueue),Ve(t),null);case 4:return Ro(),e===null&&Jm(t.stateNode.containerInfo),Ve(t),null;case 10:return es(t.type),Ve(t),null;case 19:if(At(lt),r=t.memoizedState,r===null)return Ve(t),null;if(s=(t.flags&128)!==0,i=r.rendering,i===null)if(s)Na(r,!1);else{if(at!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=Uu(e),i!==null){for(t.flags|=128,Na(r,!1),e=i.updateQueue,t.updateQueue=e,Dc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)o1(n,e),n=n.sibling;return Ye(lt,lt.current&1|2),_e&&Xr(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Nn()>Gu&&(t.flags|=128,s=!0,Na(r,!1),t.lanes=4194304)}else{if(!s)if(e=Uu(i),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Dc(t,e),Na(r,!0),r.tail===null&&r.tailMode==="hidden"&&!i.alternate&&!_e)return Ve(t),null}else 2*Nn()-r.renderingStartTime>Gu&&n!==536870912&&(t.flags|=128,s=!0,Na(r,!1),t.lanes=4194304);r.isBackwards?(i.sibling=t.child,t.child=i):(e=r.last,e!==null?e.sibling=i:t.child=i,r.last=i)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Nn(),e.sibling=null,n=lt.current,Ye(lt,s?n&1|2:n&1),_e&&Xr(t,r.treeForkCount),e):(Ve(t),null);case 22:case 23:return bn(t),Mm(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Ve(t),t.subtreeFlags&6&&(t.flags|=8192)):Ve(t),n=t.updateQueue,n!==null&&Dc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&At(wi),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),es(ht),Ve(t),null;case 25:return null;case 30:return null}throw Error(K(156,t.tag))}function Ej(e,t){switch(jm(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return es(ht),Ro(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Mu(t),null;case 31:if(t.memoizedState!==null){if(bn(t),t.alternate===null)throw Error(K(340));ji()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(bn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(K(340));ji()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return At(lt),null;case 4:return Ro(),null;case 10:return es(t.type),null;case 22:case 23:return bn(t),Mm(),e!==null&&At(wi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return es(ht),null;case 25:return null;default:return null}}function ow(e,t){switch(jm(t),t.tag){case 3:es(ht),Ro();break;case 26:case 27:case 5:Mu(t);break;case 4:Ro();break;case 31:t.memoizedState!==null&&bn(t);break;case 13:bn(t);break;case 19:At(lt);break;case 10:es(t.type);break;case 22:case 23:bn(t),Mm(),e!==null&&At(wi);break;case 24:es(ht)}}function Vl(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var s=r.next;n=s;do{if((n.tag&e)===e){r=void 0;var i=n.create,o=n.inst;r=i(),o.destroy=r}n=n.next}while(n!==s)}}catch(a){Oe(t,t.return,a)}}function Ps(e,t,n){try{var r=t.updateQueue,s=r!==null?r.lastEffect:null;if(s!==null){var i=s.next;r=i;do{if((r.tag&e)===e){var o=r.inst,a=o.destroy;if(a!==void 0){o.destroy=void 0,s=t;var c=n,u=a;try{u()}catch(d){Oe(s,c,d)}}}r=r.next}while(r!==i)}}catch(d){Oe(t,t.return,d)}}function aw(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{g1(t,n)}catch(r){Oe(e,e.return,r)}}}function lw(e,t,n){n.props=Ci(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){Oe(e,t,r)}}function el(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n=="function"?e.refCleanup=n(r):n.current=r}}catch(s){Oe(e,t,s)}}function Nr(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(s){Oe(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(s){Oe(e,t,s)}else n.current=null}function cw(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(s){Oe(e,e.return,s)}}function Wf(e,t,n){try{var r=e.stateNode;Fj(r,e.type,n,t),r[un]=t}catch(s){Oe(e,e.return,s)}}function uw(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ws(e.type)||e.tag===4}function Jf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||uw(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&&Ws(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 xp(e,t,n){var r=e.tag;if(r===5||r===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=Qr));else if(r!==4&&(r===27&&Ws(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(xp(e,t,n),e=e.sibling;e!==null;)xp(e,t,n),e=e.sibling}function Vu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Ws(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Vu(e,t,n),e=e.sibling;e!==null;)Vu(e,t,n),e=e.sibling}function dw(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);Ut(t,r,n),t[Lt]=e,t[un]=n}catch(i){Oe(e,e.return,i)}}var Pr=!1,ft=!1,eh=!1,r0=typeof WeakSet=="function"?WeakSet:Set,jt=null;function Tj(e,t){if(e=e.containerInfo,kp=nd,e=Wb(e),wm(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(a=o+s),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(a=o),h===i&&++d===r&&(c=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=a===-1||c===-1?null:{start:a,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Np={focusedElem:e,selectionRange:n},nd=!1,jt=t;jt!==null;)if(t=jt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,jt=e;else for(;jt!==null;){switch(t=jt,i=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++)s=e[n],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&i!==null){e=void 0,n=t,s=i.memoizedProps,i=i.memoizedState,r=n.stateNode;try{var x=Ci(n.type,s);e=r.getSnapshotBeforeUpdate(x,i),r.__reactInternalSnapshotBeforeUpdate=e}catch(b){Oe(n,n.return,b)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Ep(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ep(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(K(163))}if(e=t.sibling,e!==null){e.return=t.return,jt=e;break}jt=t.return}}function fw(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Zr(e,n),r&4&&Vl(5,n);break;case 1:if(Zr(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){Oe(n,n.return,o)}else{var s=Ci(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Oe(n,n.return,o)}}r&64&&aw(n),r&512&&el(n,n.return);break;case 3:if(Zr(e,n),r&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{g1(e,t)}catch(o){Oe(n,n.return,o)}}break;case 27:t===null&&r&4&&dw(n);case 26:case 5:Zr(e,n),t===null&&r&4&&cw(n),r&512&&el(n,n.return);break;case 12:Zr(e,n);break;case 31:Zr(e,n),r&4&&mw(e,n);break;case 13:Zr(e,n),r&4&&gw(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Lj.bind(null,n),rE(e,n))));break;case 22:if(r=n.memoizedState!==null||Pr,!r){t=t!==null&&t.memoizedState!==null||ft,s=Pr;var i=ft;Pr=r,(ft=t)&&!i?Gr(e,n,(n.subtreeFlags&8772)!==0):Zr(e,n),Pr=s,ft=i}break;case 30:break;default:Zr(e,n)}}function hw(e){var t=e.alternate;t!==null&&(e.alternate=null,hw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&mm(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 Ke=null,rn=!1;function Ir(e,t,n){for(n=n.child;n!==null;)pw(e,t,n),n=n.sibling}function pw(e,t,n){if(jn&&typeof jn.onCommitFiberUnmount=="function")try{jn.onCommitFiberUnmount(Hl,n)}catch{}switch(n.tag){case 26:ft||Nr(n,t),Ir(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:ft||Nr(n,t);var r=Ke,s=rn;Ws(n.type)&&(Ke=n.stateNode,rn=!1),Ir(e,t,n),sl(n.stateNode),Ke=r,rn=s;break;case 5:ft||Nr(n,t);case 6:if(r=Ke,s=rn,Ke=null,Ir(e,t,n),Ke=r,rn=s,Ke!==null)if(rn)try{(Ke.nodeType===9?Ke.body:Ke.nodeName==="HTML"?Ke.ownerDocument.body:Ke).removeChild(n.stateNode)}catch(i){Oe(n,t,i)}else try{Ke.removeChild(n.stateNode)}catch(i){Oe(n,t,i)}break;case 18:Ke!==null&&(rn?(e=Ke,g0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),qo(e)):g0(Ke,n.stateNode));break;case 4:r=Ke,s=rn,Ke=n.stateNode.containerInfo,rn=!0,Ir(e,t,n),Ke=r,rn=s;break;case 0:case 11:case 14:case 15:Ps(2,n,t),ft||Ps(4,n,t),Ir(e,t,n);break;case 1:ft||(Nr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"&&lw(n,t,r)),Ir(e,t,n);break;case 21:Ir(e,t,n);break;case 22:ft=(r=ft)||n.memoizedState!==null,Ir(e,t,n),ft=r;break;default:Ir(e,t,n)}}function mw(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{qo(e)}catch(n){Oe(t,t.return,n)}}}function gw(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{qo(e)}catch(n){Oe(t,t.return,n)}}function Aj(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new r0),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new r0),t;default:throw Error(K(435,e.tag))}}function Rc(e,t){var n=Aj(e);t.forEach(function(r){if(!n.has(r)){n.add(r);var s=Hj.bind(null,e,r);r.then(s,s)}})}function tn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r],i=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 27:if(Ws(a.type)){Ke=a.stateNode,rn=!1;break e}break;case 5:Ke=a.stateNode,rn=!1;break e;case 3:case 4:Ke=a.stateNode.containerInfo,rn=!0;break e}a=a.return}if(Ke===null)throw Error(K(160));pw(i,o,s),Ke=null,rn=!1,i=s.alternate,i!==null&&(i.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)xw(t,e),t=t.sibling}var er=null;function xw(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:tn(t,e),nn(e),r&4&&(Ps(3,e,e.return),Vl(3,e),Ps(5,e,e.return));break;case 1:tn(t,e),nn(e),r&512&&(ft||n===null||Nr(n,n.return)),r&64&&Pr&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var s=er;if(tn(t,e),nn(e),r&512&&(ft||n===null||Nr(n,n.return)),r&4){var i=n!==null?n.memoizedState:null;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){e:{r=e.type,n=e.memoizedProps,s=s.ownerDocument||s;t:switch(r){case"title":i=s.getElementsByTagName("title")[0],(!i||i[Il]||i[Lt]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=s.createElement(r),s.head.insertBefore(i,s.querySelector("head > title"))),Ut(i,r,n),i[Lt]=e,Tt(i),r=i;break e;case"link":var o=_0("link","href",s).get(r+(n.href||""));if(o){for(var a=0;a<o.length;a++)if(i=o[a],i.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&i.getAttribute("rel")===(n.rel==null?null:n.rel)&&i.getAttribute("title")===(n.title==null?null:n.title)&&i.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(a,1);break t}}i=s.createElement(r),Ut(i,r,n),s.head.appendChild(i);break;case"meta":if(o=_0("meta","content",s).get(r+(n.content||""))){for(a=0;a<o.length;a++)if(i=o[a],i.getAttribute("content")===(n.content==null?null:""+n.content)&&i.getAttribute("name")===(n.name==null?null:n.name)&&i.getAttribute("property")===(n.property==null?null:n.property)&&i.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&i.getAttribute("charset")===(n.charSet==null?null:n.charSet)){o.splice(a,1);break t}}i=s.createElement(r),Ut(i,r,n),s.head.appendChild(i);break;default:throw Error(K(468,r))}i[Lt]=e,Tt(i),r=i}e.stateNode=r}else k0(s,e.type,e.stateNode);else e.stateNode=S0(s,r,e.memoizedProps);else i!==r?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,r===null?k0(s,e.type,e.stateNode):S0(s,r,e.memoizedProps)):r===null&&e.stateNode!==null&&Wf(e,e.memoizedProps,n.memoizedProps)}break;case 27:tn(t,e),nn(e),r&512&&(ft||n===null||Nr(n,n.return)),n!==null&&r&4&&Wf(e,e.memoizedProps,n.memoizedProps);break;case 5:if(tn(t,e),nn(e),r&512&&(ft||n===null||Nr(n,n.return)),e.flags&32){s=e.stateNode;try{$o(s,"")}catch(x){Oe(e,e.return,x)}}r&4&&e.stateNode!=null&&(s=e.memoizedProps,Wf(e,s,n!==null?n.memoizedProps:s)),r&1024&&(eh=!0);break;case 6:if(tn(t,e),nn(e),r&4){if(e.stateNode===null)throw Error(K(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(x){Oe(e,e.return,x)}}break;case 3:if(vu=null,s=er,er=Ju(t.containerInfo),tn(t,e),er=s,nn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{qo(t.containerInfo)}catch(x){Oe(e,e.return,x)}eh&&(eh=!1,yw(e));break;case 4:r=er,er=Ju(e.stateNode.containerInfo),tn(t,e),nn(e),er=r;break;case 12:tn(t,e),nn(e);break;case 31:tn(t,e),nn(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Rc(e,r)));break;case 13:tn(t,e),nn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Zd=Nn()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Rc(e,r)));break;case 22:s=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,u=Pr,d=ft;if(Pr=u||s,ft=d||c,tn(t,e),ft=d,Pr=u,nn(e),r&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(n===null||c||Pr||ft||hi(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(i=c.stateNode,s)o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{a=c.stateNode;var f=c.memoizedProps.style,h=f!=null&&f.hasOwnProperty("display")?f.display:null;a.style.display=h==null||typeof h=="boolean"?"":(""+h).trim()}}catch(x){Oe(c,c.return,x)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=s?"":c.memoizedProps}catch(x){Oe(c,c.return,x)}}}else if(t.tag===18){if(n===null){c=t;try{var p=c.stateNode;s?x0(p,!0):x0(c.stateNode,!1)}catch(x){Oe(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}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,Rc(e,n))));break;case 19:tn(t,e),nn(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Rc(e,r)));break;case 30:break;case 21:break;default:tn(t,e),nn(e)}}function nn(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(uw(r)){n=r;break}r=r.return}if(n==null)throw Error(K(160));switch(n.tag){case 27:var s=n.stateNode,i=Jf(e);Vu(e,i,s);break;case 5:var o=n.stateNode;n.flags&32&&($o(o,""),n.flags&=-33);var a=Jf(e);Vu(e,a,o);break;case 3:case 4:var c=n.stateNode.containerInfo,u=Jf(e);xp(e,u,c);break;default:throw Error(K(161))}}catch(d){Oe(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function yw(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;yw(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Zr(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)fw(e,t.alternate,t),t=t.sibling}function hi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ps(4,t,t.return),hi(t);break;case 1:Nr(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&lw(t,t.return,n),hi(t);break;case 27:sl(t.stateNode);case 26:case 5:Nr(t,t.return),hi(t);break;case 22:t.memoizedState===null&&hi(t);break;case 30:hi(t);break;default:hi(t)}e=e.sibling}}function Gr(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,s=e,i=t,o=i.flags;switch(i.tag){case 0:case 11:case 15:Gr(s,i,n),Vl(4,i);break;case 1:if(Gr(s,i,n),r=i,s=r.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(u){Oe(r,r.return,u)}if(r=i,s=r.updateQueue,s!==null){var a=r.stateNode;try{var c=s.shared.hiddenCallbacks;if(c!==null)for(s.shared.hiddenCallbacks=null,s=0;s<c.length;s++)m1(c[s],a)}catch(u){Oe(r,r.return,u)}}n&&o&64&&aw(i),el(i,i.return);break;case 27:dw(i);case 26:case 5:Gr(s,i,n),n&&r===null&&o&4&&cw(i),el(i,i.return);break;case 12:Gr(s,i,n);break;case 31:Gr(s,i,n),n&&o&4&&mw(s,i);break;case 13:Gr(s,i,n),n&&o&4&&gw(s,i);break;case 22:i.memoizedState===null&&Gr(s,i,n),el(i,i.return);break;case 30:break;default:Gr(s,i,n)}t=t.sibling}}function Xm(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&&Yl(n))}function Pm(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Yl(e))}function Qn(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)vw(e,t,n,r),t=t.sibling}function vw(e,t,n,r){var s=t.flags;switch(t.tag){case 0:case 11:case 15:Qn(e,t,n,r),s&2048&&Vl(9,t);break;case 1:Qn(e,t,n,r);break;case 3:Qn(e,t,n,r),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Yl(e)));break;case 12:if(s&2048){Qn(e,t,n,r),e=t.stateNode;try{var i=t.memoizedProps,o=i.id,a=i.onPostCommit;typeof a=="function"&&a(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){Oe(t,t.return,c)}}else Qn(e,t,n,r);break;case 31:Qn(e,t,n,r);break;case 13:Qn(e,t,n,r);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?Qn(e,t,n,r):tl(e,t):i._visibility&2?Qn(e,t,n,r):(i._visibility|=2,eo(e,t,n,r,(t.subtreeFlags&10256)!==0||!1)),s&2048&&Xm(o,t);break;case 24:Qn(e,t,n,r),s&2048&&Pm(t.alternate,t);break;default:Qn(e,t,n,r)}}function eo(e,t,n,r,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,o=t,a=n,c=r,u=o.flags;switch(o.tag){case 0:case 11:case 15:eo(i,o,a,c,s),Vl(8,o);break;case 23:break;case 22:var d=o.stateNode;o.memoizedState!==null?d._visibility&2?eo(i,o,a,c,s):tl(i,o):(d._visibility|=2,eo(i,o,a,c,s)),s&&u&2048&&Xm(o.alternate,o);break;case 24:eo(i,o,a,c,s),s&&u&2048&&Pm(o.alternate,o);break;default:eo(i,o,a,c,s)}t=t.sibling}}function tl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,s=r.flags;switch(r.tag){case 22:tl(n,r),s&2048&&Xm(r.alternate,r);break;case 24:tl(n,r),s&2048&&Pm(r.alternate,r);break;default:tl(n,r)}t=t.sibling}}var Ba=8192;function Qi(e,t,n){if(e.subtreeFlags&Ba)for(e=e.child;e!==null;)bw(e,t,n),e=e.sibling}function bw(e,t,n){switch(e.tag){case 26:Qi(e,t,n),e.flags&Ba&&e.memoizedState!==null&&mE(n,er,e.memoizedState,e.memoizedProps);break;case 5:Qi(e,t,n);break;case 3:case 4:var r=er;er=Ju(e.stateNode.containerInfo),Qi(e,t,n),er=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ba,Ba=16777216,Qi(e,t,n),Ba=r):Qi(e,t,n));break;default:Qi(e,t,n)}}function ww(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 ja(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];jt=r,_w(r,e)}ww(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Sw(e),e=e.sibling}function Sw(e){switch(e.tag){case 0:case 11:case 15:ja(e),e.flags&2048&&Ps(9,e,e.return);break;case 3:ja(e);break;case 12:ja(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,xu(e)):ja(e);break;default:ja(e)}}function xu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];jt=r,_w(r,e)}ww(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ps(8,t,t.return),xu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,xu(t));break;default:xu(t)}e=e.sibling}}function _w(e,t){for(;jt!==null;){var n=jt;switch(n.tag){case 0:case 11:case 15:Ps(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Yl(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,jt=r;else e:for(n=e;jt!==null;){r=jt;var s=r.sibling,i=r.return;if(hw(r),r===n){jt=null;break e}if(s!==null){s.return=i,jt=s;break e}jt=i}}}var Cj={getCacheForType:function(e){var t=Bt(ht),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Bt(ht).controller.signal}},Mj=typeof WeakMap=="function"?WeakMap:Map,Ae=0,Ie=null,we=null,Se=0,Re=0,vn=null,Rs=!1,aa=!1,Fm=!1,ls=0,at=0,Fs=0,_i=0,Qm=0,kn=0,Uo=0,nl=null,on=null,yp=!1,Zd=0,kw=0,Gu=1/0,Xu=null,Is=null,bt=0,Zs=null,Io=null,ts=0,vp=0,bp=null,Nw=null,rl=0,wp=null;function Tn(){return Ae&2&&Se!==0?Se&-Se:pe.T!==null?Wm():Rb()}function jw(){if(kn===0)if(!(Se&536870912)||_e){var e=jc;jc<<=1,!(jc&3932160)&&(jc=262144),kn=e}else kn=536870912;return e=Cn.current,e!==null&&(e.flags|=32),kn}function cn(e,t,n){(e===Ie&&(Re===2||Re===9)||e.cancelPendingCommit!==null)&&(Zo(e,0),Os(e,Se,kn,!1)),Ul(e,n),(!(Ae&2)||e!==Ie)&&(e===Ie&&(!(Ae&2)&&(_i|=n),at===4&&Os(e,Se,kn,!1)),Mr(e))}function Ew(e,t,n){if(Ae&6)throw Error(K(327));var r=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Bl(e,t),s=r?Rj(e,t):th(e,t,!0),i=r;do{if(s===0){aa&&!r&&Os(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!zj(n)){s=th(e,t,!1),i=!1;continue}if(s===2){if(i=t,e.errorRecoveryDisabledLanes&i)var o=0;else o=e.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){t=o;e:{var a=e;s=nl;var c=a.current.memoizedState.isDehydrated;if(c&&(Zo(a,o).flags|=256),o=th(a,o,!1),o!==2){if(Fm&&!c){a.errorRecoveryDisabledLanes|=i,_i|=i,s=4;break e}i=on,on=s,i!==null&&(on===null?on=i:on.push.apply(on,i))}s=o}if(i=!1,s!==2)continue}}if(s===1){Zo(e,0),Os(e,t,0,!0);break}e:{switch(r=e,i=s,i){case 0:case 1:throw Error(K(345));case 4:if((t&4194048)!==t)break;case 6:Os(r,t,kn,!Rs);break e;case 2:on=null;break;case 3:case 5:break;default:throw Error(K(329))}if((t&62914560)===t&&(s=Zd+300-Nn(),10<s)){if(Os(r,t,kn,!Rs),Md(r,0,!0)!==0)break e;ts=t,r.timeoutHandle=Xw(s0.bind(null,r,n,on,Xu,yp,t,kn,_i,Uo,Rs,i,"Throttled",-0,0),s);break e}s0(r,n,on,Xu,yp,t,kn,_i,Uo,Rs,i,null,-0,0)}}break}while(!0);Mr(e)}function s0(e,t,n,r,s,i,o,a,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:Qr},bw(t,i,f);var x=(i&62914560)===i?Zd-Nn():(i&4194048)===i?kw-Nn():0;if(x=gE(f,x),x!==null){ts=i,e.cancelPendingCommit=x(o0.bind(null,e,t,i,n,r,s,o,a,c,d,f,null,h,p)),Os(e,i,o,!u);return}}o0(e,t,i,n,r,s,o,a,c)}function zj(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 r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!An(i(),s))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 Os(e,t,n,r){t&=~Qm,t&=~_i,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var s=t;0<s;){var i=31-En(s),o=1<<i;r[i]=-1,s&=~o}n!==0&&Mb(e,n,t)}function Yd(){return Ae&6?!0:(Gl(0),!1)}function Km(){if(we!==null){if(Re===0)var e=we.return;else e=we,Kr=Ui=null,$m(e),No=null,gl=0,e=we;for(;e!==null;)ow(e.alternate,e),e=e.return;we=null}}function Zo(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Wj(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),ts=0,Km(),Ie=e,we=n=Jr(e.current,null),Se=t,Re=0,vn=null,Rs=!1,aa=Bl(e,t),Fm=!1,Uo=kn=Qm=_i=Fs=at=0,on=nl=null,yp=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var s=31-En(r),i=1<<s;t|=e[s],r&=~i}return ls=t,Od(),n}function Tw(e,t){ve=null,pe.H=yl,t===oa||t===Ld?(t=$x(),Re=3):t===Am?(t=$x(),Re=4):Re=t===Vm?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,vn=t,we===null&&(at=1,Yu(e,In(t,e.current)))}function Aw(){var e=Cn.current;return e===null?!0:(Se&4194048)===Se?Yn===null:(Se&62914560)===Se||Se&536870912?e===Yn:!1}function Cw(){var e=pe.H;return pe.H=yl,e===null?yl:e}function Mw(){var e=pe.A;return pe.A=Cj,e}function Pu(){at=4,Rs||(Se&4194048)!==Se&&Cn.current!==null||(aa=!0),!(Fs&134217727)&&!(_i&134217727)||Ie===null||Os(Ie,Se,kn,!1)}function th(e,t,n){var r=Ae;Ae|=2;var s=Cw(),i=Mw();(Ie!==e||Se!==t)&&(Xu=null,Zo(e,t)),t=!1;var o=at;e:do try{if(Re!==0&&we!==null){var a=we,c=vn;switch(Re){case 8:Km(),o=6;break e;case 3:case 2:case 9:case 6:Cn.current===null&&(t=!0);var u=Re;if(Re=0,vn=null,mo(e,a,c,u),n&&aa){o=0;break e}break;default:u=Re,Re=0,vn=null,mo(e,a,c,u)}}Dj(),o=at;break}catch(d){Tw(e,d)}while(!0);return t&&e.shellSuspendCounter++,Kr=Ui=null,Ae=r,pe.H=s,pe.A=i,we===null&&(Ie=null,Se=0,Od()),o}function Dj(){for(;we!==null;)zw(we)}function Rj(e,t){var n=Ae;Ae|=2;var r=Cw(),s=Mw();Ie!==e||Se!==t?(Xu=null,Gu=Nn()+500,Zo(e,t)):aa=Bl(e,t);e:do try{if(Re!==0&&we!==null){t=we;var i=vn;t:switch(Re){case 1:Re=0,vn=null,mo(e,t,i,1);break;case 2:case 9:if(Ox(i)){Re=0,vn=null,i0(t);break}t=function(){Re!==2&&Re!==9||Ie!==e||(Re=7),Mr(e)},i.then(t,t);break e;case 3:Re=7;break e;case 4:Re=5;break e;case 7:Ox(i)?(Re=0,vn=null,i0(t)):(Re=0,vn=null,mo(e,t,i,7));break;case 5:var o=null;switch(we.tag){case 26:o=we.memoizedState;case 5:case 27:var a=we;if(o?Ww(o):a.stateNode.complete){Re=0,vn=null;var c=a.sibling;if(c!==null)we=c;else{var u=a.return;u!==null?(we=u,qd(u)):we=null}break t}}Re=0,vn=null,mo(e,t,i,5);break;case 6:Re=0,vn=null,mo(e,t,i,6);break;case 8:Km(),at=6;break e;default:throw Error(K(462))}}Oj();break}catch(d){Tw(e,d)}while(!0);return Kr=Ui=null,pe.H=r,pe.A=s,Ae=n,we!==null?0:(Ie=null,Se=0,Od(),at)}function Oj(){for(;we!==null&&!sN();)zw(we)}function zw(e){var t=iw(e.alternate,e,ls);e.memoizedProps=e.pendingProps,t===null?qd(e):we=t}function i0(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Wx(n,t,t.pendingProps,t.type,void 0,Se);break;case 11:t=Wx(n,t,t.pendingProps,t.type.render,t.ref,Se);break;case 5:$m(t);default:ow(n,t),t=we=o1(t,ls),t=iw(n,t,ls)}e.memoizedProps=e.pendingProps,t===null?qd(e):we=t}function mo(e,t,n,r){Kr=Ui=null,$m(t),No=null,gl=0;var s=t.return;try{if(_j(e,s,t,n,Se)){at=1,Yu(e,In(n,e.current)),we=null;return}}catch(i){if(s!==null)throw we=s,i;at=1,Yu(e,In(n,e.current)),we=null;return}t.flags&32768?(_e||r===1?e=!0:aa||Se&536870912?e=!1:(Rs=e=!0,(r===2||r===9||r===3||r===6)&&(r=Cn.current,r!==null&&r.tag===13&&(r.flags|=16384))),Dw(t,e)):qd(t)}function qd(e){var t=e;do{if(t.flags&32768){Dw(t,Rs);return}e=t.return;var n=jj(t.alternate,t,ls);if(n!==null){we=n;return}if(t=t.sibling,t!==null){we=t;return}we=t=e}while(t!==null);at===0&&(at=5)}function Dw(e,t){do{var n=Ej(e.alternate,e);if(n!==null){n.flags&=32767,we=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){we=e;return}we=e=n}while(e!==null);at=6,we=null}function o0(e,t,n,r,s,i,o,a,c){e.cancelPendingCommit=null;do Vd();while(bt!==0);if(Ae&6)throw Error(K(327));if(t!==null){if(t===e.current)throw Error(K(177));if(i=t.lanes|t.childLanes,i|=Sm,pN(e,n,i,o,a,c),e===Ie&&(we=Ie=null,Se=0),Io=t,Zs=e,ts=n,vp=i,bp=s,Nw=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Bj(zu,function(){return Hw(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,t.subtreeFlags&13878||r){r=pe.T,pe.T=null,s=Ce.p,Ce.p=2,o=Ae,Ae|=4;try{Tj(e,t,n)}finally{Ae=o,Ce.p=s,pe.T=r}}bt=1,Rw(),Ow(),$w()}}function Rw(){if(bt===1){bt=0;var e=Zs,t=Io,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=pe.T,pe.T=null;var r=Ce.p;Ce.p=2;var s=Ae;Ae|=4;try{xw(t,e);var i=Np,o=Wb(e.containerInfo),a=i.focusedElem,c=i.selectionRange;if(o!==a&&a&&a.ownerDocument&&Kb(a.ownerDocument.documentElement,a)){if(c!==null&&wm(a)){var u=c.start,d=c.end;if(d===void 0&&(d=u),"selectionStart"in a)a.selectionStart=u,a.selectionEnd=Math.min(d,a.value.length);else{var f=a.ownerDocument||document,h=f&&f.defaultView||window;if(h.getSelection){var p=h.getSelection(),x=a.textContent.length,b=Math.min(c.start,x),S=c.end===void 0?b:Math.min(c.end,x);!p.extend&&b>S&&(o=S,S=b,b=o);var m=Tx(a,b),y=Tx(a,S);if(m&&y&&(p.rangeCount!==1||p.anchorNode!==m.node||p.anchorOffset!==m.offset||p.focusNode!==y.node||p.focusOffset!==y.offset)){var g=f.createRange();g.setStart(m.node,m.offset),p.removeAllRanges(),b>S?(p.addRange(g),p.extend(y.node,y.offset)):(g.setEnd(y.node,y.offset),p.addRange(g))}}}}for(f=[],p=a;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<f.length;a++){var v=f[a];v.element.scrollLeft=v.left,v.element.scrollTop=v.top}}nd=!!kp,Np=kp=null}finally{Ae=s,Ce.p=r,pe.T=n}}e.current=t,bt=2}}function Ow(){if(bt===2){bt=0;var e=Zs,t=Io,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=pe.T,pe.T=null;var r=Ce.p;Ce.p=2;var s=Ae;Ae|=4;try{fw(e,t.alternate,t)}finally{Ae=s,Ce.p=r,pe.T=n}}bt=3}}function $w(){if(bt===4||bt===3){bt=0,iN();var e=Zs,t=Io,n=ts,r=Nw;t.subtreeFlags&10256||t.flags&10256?bt=5:(bt=0,Io=Zs=null,Lw(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(Is=null),pm(n),t=t.stateNode,jn&&typeof jn.onCommitFiberRoot=="function")try{jn.onCommitFiberRoot(Hl,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=pe.T,s=Ce.p,Ce.p=2,pe.T=null;try{for(var i=e.onRecoverableError,o=0;o<r.length;o++){var a=r[o];i(a.value,{componentStack:a.stack})}}finally{pe.T=t,Ce.p=s}}ts&3&&Vd(),Mr(e),s=e.pendingLanes,n&261930&&s&42?e===wp?rl++:(rl=0,wp=e):rl=0,Gl(0)}}function Lw(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Yl(t)))}function Vd(){return Rw(),Ow(),$w(),Hw()}function Hw(){if(bt!==5)return!1;var e=Zs,t=vp;vp=0;var n=pm(ts),r=pe.T,s=Ce.p;try{Ce.p=32>n?32:n,pe.T=null,n=bp,bp=null;var i=Zs,o=ts;if(bt=0,Io=Zs=null,ts=0,Ae&6)throw Error(K(331));var a=Ae;if(Ae|=4,Sw(i.current),vw(i,i.current,o,n),Ae=a,Gl(0,!1),jn&&typeof jn.onPostCommitFiberRoot=="function")try{jn.onPostCommitFiberRoot(Hl,i)}catch{}return!0}finally{Ce.p=s,pe.T=r,Lw(e,t)}}function a0(e,t,n){t=In(n,t),t=pp(e.stateNode,t,2),e=Us(e,t,2),e!==null&&(Ul(e,2),Mr(e))}function Oe(e,t,n){if(e.tag===3)a0(e,e,n);else for(;t!==null;){if(t.tag===3){a0(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Is===null||!Is.has(r))){e=In(n,e),n=J1(2),r=Us(t,n,2),r!==null&&(ew(n,r,t,e),Ul(r,2),Mr(r));break}}t=t.return}}function nh(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Mj;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(Fm=!0,s.add(n),e=$j.bind(null,e,t,n),t.then(e,e))}function $j(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ie===e&&(Se&n)===n&&(at===4||at===3&&(Se&62914560)===Se&&300>Nn()-Zd?!(Ae&2)&&Zo(e,0):Qm|=n,Uo===Se&&(Uo=0)),Mr(e)}function Bw(e,t){t===0&&(t=Cb()),e=Bi(e,t),e!==null&&(Ul(e,t),Mr(e))}function Lj(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bw(e,n)}function Hj(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(K(314))}r!==null&&r.delete(t),Bw(e,n)}function Bj(e,t){return fm(e,t)}var Fu=null,to=null,Sp=!1,Qu=!1,rh=!1,$s=0;function Mr(e){e!==to&&e.next===null&&(to===null?Fu=to=e:to=to.next=e),Qu=!0,Sp||(Sp=!0,Ij())}function Gl(e,t){if(!rh&&Qu){rh=!0;do for(var n=!1,r=Fu;r!==null;){if(e!==0){var s=r.pendingLanes;if(s===0)var i=0;else{var o=r.suspendedLanes,a=r.pingedLanes;i=(1<<31-En(42|e)+1)-1,i&=s&~(o&~a),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,l0(r,i))}else i=Se,i=Md(r,r===Ie?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(i&3)||Bl(r,i)||(n=!0,l0(r,i));r=r.next}while(n);rh=!1}}function Uj(){Uw()}function Uw(){Qu=Sp=!1;var e=0;$s!==0&&Kj()&&(e=$s);for(var t=Nn(),n=null,r=Fu;r!==null;){var s=r.next,i=Iw(r,t);i===0?(r.next=null,n===null?Fu=s:n.next=s,s===null&&(to=n)):(n=r,(e!==0||i&3)&&(Qu=!0)),r=s}bt!==0&&bt!==5||Gl(e),$s!==0&&($s=0)}function Iw(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-En(i),a=1<<o,c=s[o];c===-1?(!(a&n)||a&r)&&(s[o]=hN(a,t)):c<=t&&(e.expiredLanes|=a),i&=~a}if(t=Ie,n=Se,n=Md(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Re===2||Re===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Mf(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Bl(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Mf(r),pm(n)){case 2:case 8:n=Tb;break;case 32:n=zu;break;case 268435456:n=Ab;break;default:n=zu}return r=Zw.bind(null,e),n=fm(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Mf(r),e.callbackPriority=2,e.callbackNode=null,2}function Zw(e,t){if(bt!==0&&bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Vd()&&e.callbackNode!==n)return null;var r=Se;return r=Md(e,e===Ie?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Ew(e,r,t),Iw(e,Nn()),e.callbackNode!=null&&e.callbackNode===n?Zw.bind(null,e):null)}function l0(e,t){if(Vd())return null;Ew(e,t,!0)}function Ij(){Jj(function(){Ae&6?fm(Eb,Uj):Uw()})}function Wm(){if($s===0){var e=Lo;e===0&&(e=Nc,Nc<<=1,!(Nc&261888)&&(Nc=256)),$s=e}return $s}function c0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:lu(""+e)}function u0(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 Zj(e,t,n,r,s){if(t==="submit"&&n&&n.stateNode===s){var i=c0((s[un]||null).action),o=r.submitter;o&&(t=(t=o[un]||null)?c0(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var a=new zd("action","action",null,r,s);e.push({event:a,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if($s!==0){var c=o?u0(s,o):new FormData(s);fp(n,{pending:!0,data:c,method:s.method,action:i},null,c)}}else typeof i=="function"&&(a.preventDefault(),c=o?u0(s,o):new FormData(s),fp(n,{pending:!0,data:c,method:s.method,action:i},i,c))},currentTarget:s}]})}}for(var sh=0;sh<ep.length;sh++){var ih=ep[sh],Yj=ih.toLowerCase(),qj=ih[0].toUpperCase()+ih.slice(1);dr(Yj,"on"+qj)}dr(e1,"onAnimationEnd");dr(t1,"onAnimationIteration");dr(n1,"onAnimationStart");dr("dblclick","onDoubleClick");dr("focusin","onFocus");dr("focusout","onBlur");dr(oj,"onTransitionRun");dr(aj,"onTransitionStart");dr(lj,"onTransitionCancel");dr(r1,"onTransitionEnd");Oo("onMouseEnter",["mouseout","mouseover"]);Oo("onMouseLeave",["mouseout","mouseover"]);Oo("onPointerEnter",["pointerout","pointerover"]);Oo("onPointerLeave",["pointerout","pointerover"]);$i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));$i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));$i("onBeforeInput",["compositionend","keypress","textInput","paste"]);$i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));$i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));$i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vl="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(" "),Vj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(vl));function Yw(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var a=r[o],c=a.instance,u=a.currentTarget;if(a=a.listener,c!==i&&s.isPropagationStopped())break e;i=a,s.currentTarget=u;try{i(s)}catch(d){Ru(d)}s.currentTarget=null,i=c}else for(o=0;o<r.length;o++){if(a=r[o],c=a.instance,u=a.currentTarget,a=a.listener,c!==i&&s.isPropagationStopped())break e;i=a,s.currentTarget=u;try{i(s)}catch(d){Ru(d)}s.currentTarget=null,i=c}}}}function be(e,t){var n=t[Gh];n===void 0&&(n=t[Gh]=new Set);var r=e+"__bubble";n.has(r)||(qw(t,e,2,!1),n.add(r))}function oh(e,t,n){var r=0;t&&(r|=4),qw(n,e,r,t)}var Oc="_reactListening"+Math.random().toString(36).slice(2);function Jm(e){if(!e[Oc]){e[Oc]=!0,Ob.forEach(function(n){n!=="selectionchange"&&(Vj.has(n)||oh(n,!1,e),oh(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Oc]||(t[Oc]=!0,oh("selectionchange",!1,t))}}function qw(e,t,n,r){switch(r2(t)){case 2:var s=vE;break;case 8:s=bE;break;default:s=rg}n=s.bind(null,t,n,e),s=void 0,!Kh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function ah(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===s)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===s)return;o=o.return}for(;a!==null;){if(o=io(a),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=i=o;continue e}a=a.parentNode}}r=r.return}Yb(function(){var u=i,d=xm(n),f=[];e:{var h=s1.get(e);if(h!==void 0){var p=zd,x=e;switch(e){case"keypress":if(uu(n)===0)break e;case"keydown":case"keyup":p=HN;break;case"focusin":x="focus",p=$f;break;case"focusout":x="blur",p=$f;break;case"beforeblur":case"afterblur":p=$f;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=yx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=jN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=IN;break;case e1:case t1:case n1:p=AN;break;case r1:p=YN;break;case"scroll":case"scrollend":p=kN;break;case"wheel":p=VN;break;case"copy":case"cut":case"paste":p=MN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=bx;break;case"toggle":case"beforetoggle":p=XN}var b=(t&4)!==0,S=!b&&(e==="scroll"||e==="scrollend"),m=b?h!==null?h+"Capture":null:h;b=[];for(var y=u,g;y!==null;){var v=y;if(g=v.stateNode,v=v.tag,v!==5&&v!==26&&v!==27||g===null||m===null||(v=dl(y,m),v!=null&&b.push(bl(y,v,g))),S)break;y=y.return}0<b.length&&(h=new p(h,x,null,n,d),f.push({event:h,listeners:b}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==Qh&&(x=n.relatedTarget||n.fromElement)&&(io(x)||x[ra]))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?io(x):null,x!==null&&(S=Ll(x),b=x.tag,x!==S||b!==5&&b!==27&&b!==6)&&(x=null)):(p=null,x=u),p!==x)){if(b=yx,v="onMouseLeave",m="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(b=bx,v="onPointerLeave",m="onPointerEnter",y="pointer"),S=p==null?h:La(p),g=x==null?h:La(x),h=new b(v,y+"leave",p,n,d),h.target=S,h.relatedTarget=g,v=null,io(d)===u&&(b=new b(m,y+"enter",x,n,d),b.target=g,b.relatedTarget=S,v=b),S=v,p&&x)t:{for(b=Gj,m=p,y=x,g=0,v=m;v;v=b(v))g++;v=0;for(var N=y;N;N=b(N))v++;for(;0<g-v;)m=b(m),g--;for(;0<v-g;)y=b(y),v--;for(;g--;){if(m===y||y!==null&&m===y.alternate){b=m;break t}m=b(m),y=b(y)}b=null}else b=null;p!==null&&d0(f,h,p,b,!1),x!==null&&S!==null&&d0(f,S,x,b,!0)}}e:{if(h=u?La(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var k=kx;else if(_x(h))if(Fb)k=rj;else{k=tj;var T=ej}else p=h.nodeName,!p||p.toLowerCase()!=="input"||h.type!=="checkbox"&&h.type!=="radio"?u&&gm(u.elementType)&&(k=kx):k=nj;if(k&&(k=k(e,u))){Pb(f,k,n,d);break e}T&&T(e,h,u),e==="focusout"&&u&&h.type==="number"&&u.memoizedProps.value!=null&&Fh(h,"number",h.value)}switch(T=u?La(u):window,e){case"focusin":(_x(T)||T.contentEditable==="true")&&(lo=T,Wh=u,Pa=null);break;case"focusout":Pa=Wh=lo=null;break;case"mousedown":Jh=!0;break;case"contextmenu":case"mouseup":case"dragend":Jh=!1,Ax(f,n,d);break;case"selectionchange":if(ij)break;case"keydown":case"keyup":Ax(f,n,d)}var z;if(bm)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else ao?Gb(e,n)&&(A="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(A="onCompositionStart");A&&(Vb&&n.locale!=="ko"&&(ao||A!=="onCompositionStart"?A==="onCompositionEnd"&&ao&&(z=qb()):(Ds=d,ym="value"in Ds?Ds.value:Ds.textContent,ao=!0)),T=Ku(u,A),0<T.length&&(A=new vx(A,e,null,n,d),f.push({event:A,listeners:T}),z?A.data=z:(z=Xb(n),z!==null&&(A.data=z)))),(z=FN?QN(e,n):KN(e,n))&&(A=Ku(u,"onBeforeInput"),0<A.length&&(T=new vx("onBeforeInput","beforeinput",null,n,d),f.push({event:T,listeners:A}),T.data=z)),Zj(f,e,u,n,d)}Yw(f,t)})}function bl(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ku(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||i===null||(s=dl(e,n),s!=null&&r.unshift(bl(e,s,i)),s=dl(e,t),s!=null&&r.push(bl(e,s,i))),e.tag===3)return r;e=e.return}return[]}function Gj(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function d0(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var a=n,c=a.alternate,u=a.stateNode;if(a=a.tag,c!==null&&c===r)break;a!==5&&a!==26&&a!==27||u===null||(c=u,s?(u=dl(n,i),u!=null&&o.unshift(bl(n,u,c))):s||(u=dl(n,i),u!=null&&o.push(bl(n,u,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Xj=/\r\n?/g,Pj=/\u0000|\uFFFD/g;function f0(e){return(typeof e=="string"?e:""+e).replace(Xj,`
49
+ `).replace(Pj,"")}function Vw(e,t){return t=f0(t),f0(e)===t}function Le(e,t,n,r,s,i){switch(n){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||$o(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&$o(e,""+r);break;case"className":Tc(e,"class",r);break;case"tabIndex":Tc(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Tc(e,n,r);break;case"style":Zb(e,r,i);break;case"data":if(t!=="object"){Tc(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=lu(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if(typeof r=="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 i=="function"&&(n==="formAction"?(t!=="input"&&Le(e,t,"name",s.name,s,null),Le(e,t,"formEncType",s.formEncType,s,null),Le(e,t,"formMethod",s.formMethod,s,null),Le(e,t,"formTarget",s.formTarget,s,null)):(Le(e,t,"encType",s.encType,s,null),Le(e,t,"method",s.method,s,null),Le(e,t,"target",s.target,s,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=lu(""+r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=Qr);break;case"onScroll":r!=null&&be("scroll",e);break;case"onScrollEnd":r!=null&&be("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(K(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(K(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}n=lu(""+r),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":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""+r):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":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":r===!0?e.setAttribute(n,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":be("beforetoggle",e),be("toggle",e),au(e,"popover",r);break;case"xlinkActuate":Br(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Br(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Br(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Br(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Br(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Br(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Br(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Br(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Br(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":au(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=SN.get(n)||n,au(e,n,r))}}function _p(e,t,n,r,s,i){switch(n){case"style":Zb(e,r,i);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(K(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(K(60));e.innerHTML=n}}break;case"children":typeof r=="string"?$o(e,r):(typeof r=="number"||typeof r=="bigint")&&$o(e,""+r);break;case"onScroll":r!=null&&be("scroll",e);break;case"onScrollEnd":r!=null&&be("scrollend",e);break;case"onClick":r!=null&&(e.onclick=Qr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!$b.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(s=n.endsWith("Capture"),t=n.slice(2,s?n.length-7:void 0),i=e[un]||null,i=i!=null?i[n]:null,typeof i=="function"&&e.removeEventListener(t,i,s),typeof r=="function")){typeof i!="function"&&i!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,s);break e}n in e?e[n]=r:r===!0?e.setAttribute(n,""):au(e,n,r)}}}function Ut(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":be("error",e),be("load",e);var r=!1,s=!1,i;for(i in n)if(n.hasOwnProperty(i)){var o=n[i];if(o!=null)switch(i){case"src":r=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(K(137,t));default:Le(e,t,i,o,n,null)}}s&&Le(e,t,"srcSet",n.srcSet,n,null),r&&Le(e,t,"src",n.src,n,null);return;case"input":be("invalid",e);var a=i=o=s=null,c=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case"name":s=d;break;case"type":o=d;break;case"checked":c=d;break;case"defaultChecked":u=d;break;case"value":i=d;break;case"defaultValue":a=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(K(137,t));break;default:Le(e,t,r,d,n,null)}}Bb(e,i,a,c,u,o,s,!1);return;case"select":be("invalid",e),r=o=i=null;for(s in n)if(n.hasOwnProperty(s)&&(a=n[s],a!=null))switch(s){case"value":i=a;break;case"defaultValue":o=a;break;case"multiple":r=a;default:Le(e,t,s,a,n,null)}t=i,n=o,e.multiple=!!r,t!=null?So(e,!!r,t,!1):n!=null&&So(e,!!r,n,!0);return;case"textarea":be("invalid",e),i=s=r=null;for(o in n)if(n.hasOwnProperty(o)&&(a=n[o],a!=null))switch(o){case"value":r=a;break;case"defaultValue":s=a;break;case"children":i=a;break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(K(91));break;default:Le(e,t,o,a,n,null)}Ib(e,r,s,i);return;case"option":for(c in n)if(n.hasOwnProperty(c)&&(r=n[c],r!=null))switch(c){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:Le(e,t,c,r,n,null)}return;case"dialog":be("beforetoggle",e),be("toggle",e),be("cancel",e),be("close",e);break;case"iframe":case"object":be("load",e);break;case"video":case"audio":for(r=0;r<vl.length;r++)be(vl[r],e);break;case"image":be("error",e),be("load",e);break;case"details":be("toggle",e);break;case"embed":case"source":case"link":be("error",e),be("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)&&(r=n[u],r!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(K(137,t));default:Le(e,t,u,r,n,null)}return;default:if(gm(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&_p(e,t,d,r,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(r=n[a],r!=null&&Le(e,t,a,r,n,null))}function Fj(e,t,n,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,i=null,o=null,a=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:r.hasOwnProperty(p)||Le(e,t,p,null,r,f)}}for(var h in r){var p=r[h];if(f=n[h],r.hasOwnProperty(h)&&(p!=null||f!=null))switch(h){case"type":i=p;break;case"name":s=p;break;case"checked":u=p;break;case"defaultChecked":d=p;break;case"value":o=p;break;case"defaultValue":a=p;break;case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(K(137,t));break;default:p!==f&&Le(e,t,h,p,r,f)}}Ph(e,o,a,c,u,d,i,s);return;case"select":p=o=a=h=null;for(i in n)if(c=n[i],n.hasOwnProperty(i)&&c!=null)switch(i){case"value":break;case"multiple":p=c;default:r.hasOwnProperty(i)||Le(e,t,i,null,r,c)}for(s in r)if(i=r[s],c=n[s],r.hasOwnProperty(s)&&(i!=null||c!=null))switch(s){case"value":h=i;break;case"defaultValue":a=i;break;case"multiple":o=i;default:i!==c&&Le(e,t,s,i,r,c)}t=a,n=o,r=p,h!=null?So(e,!!n,h,!1):!!r!=!!n&&(t!=null?So(e,!!n,t,!0):So(e,!!n,n?[]:"",!1));return;case"textarea":p=h=null;for(a in n)if(s=n[a],n.hasOwnProperty(a)&&s!=null&&!r.hasOwnProperty(a))switch(a){case"value":break;case"children":break;default:Le(e,t,a,null,r,s)}for(o in r)if(s=r[o],i=n[o],r.hasOwnProperty(o)&&(s!=null||i!=null))switch(o){case"value":h=s;break;case"defaultValue":p=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(K(91));break;default:s!==i&&Le(e,t,o,s,r,i)}Ub(e,h,p);return;case"option":for(var x in n)if(h=n[x],n.hasOwnProperty(x)&&h!=null&&!r.hasOwnProperty(x))switch(x){case"selected":e.selected=!1;break;default:Le(e,t,x,null,r,h)}for(c in r)if(h=r[c],p=n[c],r.hasOwnProperty(c)&&h!==p&&(h!=null||p!=null))switch(c){case"selected":e.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:Le(e,t,c,h,r,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 b in n)h=n[b],n.hasOwnProperty(b)&&h!=null&&!r.hasOwnProperty(b)&&Le(e,t,b,null,r,h);for(u in r)if(h=r[u],p=n[u],r.hasOwnProperty(u)&&h!==p&&(h!=null||p!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(K(137,t));break;default:Le(e,t,u,h,r,p)}return;default:if(gm(t)){for(var S in n)h=n[S],n.hasOwnProperty(S)&&h!==void 0&&!r.hasOwnProperty(S)&&_p(e,t,S,void 0,r,h);for(d in r)h=r[d],p=n[d],!r.hasOwnProperty(d)||h===p||h===void 0&&p===void 0||_p(e,t,d,h,r,p);return}}for(var m in n)h=n[m],n.hasOwnProperty(m)&&h!=null&&!r.hasOwnProperty(m)&&Le(e,t,m,null,r,h);for(f in r)h=r[f],p=n[f],!r.hasOwnProperty(f)||h===p||h==null&&p==null||Le(e,t,f,h,r,p)}function h0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Qj(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var s=n[r],i=s.transferSize,o=s.initiatorType,a=s.duration;if(i&&a&&h0(o)){for(o=0,a=s.responseEnd,r+=1;r<n.length;r++){var c=n[r],u=c.startTime;if(u>a)break;var d=c.transferSize,f=c.initiatorType;d&&h0(f)&&(c=c.responseEnd,o+=d*(c<a?1:(a-u)/(c-u)))}if(--r,t+=8*(i+o)/(s.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 kp=null,Np=null;function Wu(e){return e.nodeType===9?e:e.ownerDocument}function p0(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 Gw(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 jp(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 lh=null;function Kj(){var e=window.event;return e&&e.type==="popstate"?e===lh?!1:(lh=e,!0):(lh=null,!1)}var Xw=typeof setTimeout=="function"?setTimeout:void 0,Wj=typeof clearTimeout=="function"?clearTimeout:void 0,m0=typeof Promise=="function"?Promise:void 0,Jj=typeof queueMicrotask=="function"?queueMicrotask:typeof m0<"u"?function(e){return m0.resolve(null).then(e).catch(eE)}:Xw;function eE(e){setTimeout(function(){throw e})}function Ws(e){return e==="head"}function g0(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"||n==="/&"){if(r===0){e.removeChild(s),qo(t);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")sl(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,sl(n);for(var i=n.firstChild;i;){var o=i.nextSibling,a=i.nodeName;i[Il]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&sl(e.ownerDocument.body);n=s}while(n);qo(t)}function x0(e,t){var n=e;e=0;do{var r=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||""),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=r}while(n)}function Ep(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":Ep(n),mm(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function tE(e,t,n,r){for(;e.nodeType===1;){var s=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[Il])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=qn(e.nextSibling),e===null)break}return null}function nE(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=qn(e.nextSibling),e===null))return null;return e}function Pw(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=qn(e.nextSibling),e===null))return null;return e}function Tp(e){return e.data==="$?"||e.data==="$~"}function Ap(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function rE(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function qn(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 Cp=null;function y0(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return qn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function v0(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 Fw(e,t,n){switch(t=Wu(n),e){case"html":if(e=t.documentElement,!e)throw Error(K(452));return e;case"head":if(e=t.head,!e)throw Error(K(453));return e;case"body":if(e=t.body,!e)throw Error(K(454));return e;default:throw Error(K(451))}}function sl(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);mm(e)}var Vn=new Map,b0=new Set;function Ju(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var fs=Ce.d;Ce.d={f:sE,r:iE,D:oE,C:aE,L:lE,m:cE,X:dE,S:uE,M:fE};function sE(){var e=fs.f(),t=Yd();return e||t}function iE(e){var t=sa(e);t!==null&&t.tag===5&&t.type==="form"?Z1(t):fs.r(e)}var la=typeof document>"u"?null:document;function Qw(e,t,n){var r=la;if(r&&typeof t=="string"&&t){var s=Un(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),b0.has(s)||(b0.add(s),e={rel:e,crossOrigin:n,href:t},r.querySelector(s)===null&&(t=r.createElement("link"),Ut(t,"link",e),Tt(t),r.head.appendChild(t)))}}function oE(e){fs.D(e),Qw("dns-prefetch",e,null)}function aE(e,t){fs.C(e,t),Qw("preconnect",e,t)}function lE(e,t,n){fs.L(e,t,n);var r=la;if(r&&e&&t){var s='link[rel="preload"][as="'+Un(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+Un(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+Un(n.imageSizes)+'"]')):s+='[href="'+Un(e)+'"]';var i=s;switch(t){case"style":i=Yo(e);break;case"script":i=ca(e)}Vn.has(i)||(e=Fe({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Vn.set(i,e),r.querySelector(s)!==null||t==="style"&&r.querySelector(Xl(i))||t==="script"&&r.querySelector(Pl(i))||(t=r.createElement("link"),Ut(t,"link",e),Tt(t),r.head.appendChild(t)))}}function cE(e,t){fs.m(e,t);var n=la;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Un(r)+'"][href="'+Un(e)+'"]',i=s;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=ca(e)}if(!Vn.has(i)&&(e=Fe({rel:"modulepreload",href:e},t),Vn.set(i,e),n.querySelector(s)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Pl(i)))return}r=n.createElement("link"),Ut(r,"link",e),Tt(r),n.head.appendChild(r)}}}function uE(e,t,n){fs.S(e,t,n);var r=la;if(r&&e){var s=wo(r).hoistableStyles,i=Yo(e);t=t||"default";var o=s.get(i);if(!o){var a={loading:0,preload:null};if(o=r.querySelector(Xl(i)))a.loading=5;else{e=Fe({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Vn.get(i))&&eg(e,n);var c=o=r.createElement("link");Tt(c),Ut(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){a.loading|=1}),c.addEventListener("error",function(){a.loading|=2}),a.loading|=4,yu(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:a},s.set(i,o)}}}function dE(e,t){fs.X(e,t);var n=la;if(n&&e){var r=wo(n).hoistableScripts,s=ca(e),i=r.get(s);i||(i=n.querySelector(Pl(s)),i||(e=Fe({src:e,async:!0},t),(t=Vn.get(s))&&tg(e,t),i=n.createElement("script"),Tt(i),Ut(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function fE(e,t){fs.M(e,t);var n=la;if(n&&e){var r=wo(n).hoistableScripts,s=ca(e),i=r.get(s);i||(i=n.querySelector(Pl(s)),i||(e=Fe({src:e,async:!0,type:"module"},t),(t=Vn.get(s))&&tg(e,t),i=n.createElement("script"),Tt(i),Ut(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function w0(e,t,n,r){var s=(s=Ls.current)?Ju(s):null;if(!s)throw Error(K(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Yo(n.href),n=wo(s).hoistableStyles,r=n.get(t),r||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Yo(n.href);var i=wo(s).hoistableStyles,o=i.get(e);if(o||(s=s.ownerDocument||s,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,o),(i=s.querySelector(Xl(e)))&&!i._p&&(o.instance=i,o.state.loading=5),Vn.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},Vn.set(e,n),i||hE(s,e,n,o.state))),t&&r===null)throw Error(K(528,""));return o}if(t&&r!==null)throw Error(K(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ca(n),n=wo(s).hoistableScripts,r=n.get(t),r||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(K(444,e))}}function Yo(e){return'href="'+Un(e)+'"'}function Xl(e){return'link[rel="stylesheet"]['+e+"]"}function Kw(e){return Fe({},e,{"data-precedence":e.precedence,precedence:null})}function hE(e,t,n,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),Ut(t,"link",n),Tt(t),e.head.appendChild(t))}function ca(e){return'[src="'+Un(e)+'"]'}function Pl(e){return"script[async]"+e}function S0(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Un(n.href)+'"]');if(r)return t.instance=r,Tt(r),r;var s=Fe({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),Tt(r),Ut(r,"style",s),yu(r,n.precedence,e),t.instance=r;case"stylesheet":s=Yo(n.href);var i=e.querySelector(Xl(s));if(i)return t.state.loading|=4,t.instance=i,Tt(i),i;r=Kw(n),(s=Vn.get(s))&&eg(r,s),i=(e.ownerDocument||e).createElement("link"),Tt(i);var o=i;return o._p=new Promise(function(a,c){o.onload=a,o.onerror=c}),Ut(i,"link",r),t.state.loading|=4,yu(i,n.precedence,e),t.instance=i;case"script":return i=ca(n.src),(s=e.querySelector(Pl(i)))?(t.instance=s,Tt(s),s):(r=n,(s=Vn.get(i))&&(r=Fe({},n),tg(r,s)),e=e.ownerDocument||e,s=e.createElement("script"),Tt(s),Ut(s,"link",r),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(K(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,yu(r,n.precedence,e));return t.instance}function yu(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=r.length?r[r.length-1]:null,i=s,o=0;o<r.length;o++){var a=r[o];if(a.dataset.precedence===t)i=a;else if(i!==s)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function eg(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function tg(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var vu=null;function _0(e,t,n){if(vu===null){var r=new Map,s=vu=new Map;s.set(n,r)}else s=vu,r=s.get(n),r||(r=new Map,s.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),s=0;s<n.length;s++){var i=n[s];if(!(i[Il]||i[Lt]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var o=i.getAttribute(t)||"";o=e+o;var a=r.get(o);a?a.push(i):r.set(o,[i])}}return r}function k0(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function pE(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 Ww(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function mE(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var s=Yo(r.href),i=t.querySelector(Xl(s));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=ed.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,Tt(i);return}i=t.ownerDocument||t,r=Kw(r),(s=Vn.get(s))&&eg(r,s),i=i.createElement("link"),Tt(i);var o=i;o._p=new Promise(function(a,c){o.onload=a,o.onerror=c}),Ut(i,"link",r),n.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ed.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var ch=0;function gE(e,t){return e.stylesheets&&e.count===0&&bu(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&bu(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&ch===0&&(ch=62500*Qj());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&bu(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>ch?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(s)}}:null}function ed(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)bu(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var td=null;function bu(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,td=new Map,t.forEach(xE,e),td=null,ed.call(e))}function xE(e,t){if(!(t.state.loading&4)){var n=td.get(e);if(n)var r=n.get(null);else{n=new Map,td.set(e,n);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<s.length;i++){var o=s[i];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}s=t.instance,o=s.getAttribute("data-precedence"),i=n.get(o)||r,i===r&&n.set(null,s),n.set(o,s),this.count++,r=ed.bind(this),s.addEventListener("load",r),s.addEventListener("error",r),i?i.parentNode.insertBefore(s,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var wl={$$typeof:Fr,Provider:null,Consumer:null,_currentValue:vi,_currentValue2:vi,_threadCount:0};function yE(e,t,n,r,s,i,o,a,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=zf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zf(0),this.hiddenUpdates=zf(null),this.identifierPrefix=r,this.onUncaughtError=s,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function Jw(e,t,n,r,s,i,o,a,c,u,d,f){return e=new yE(e,t,n,o,c,u,d,f,a),t=1,i===!0&&(t|=24),i=wn(3,null,null,t),e.current=i,i.stateNode=e,t=Em(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:r,isDehydrated:n,cache:t},Cm(i),e}function e2(e){return e?(e=fo,e):fo}function t2(e,t,n,r,s,i){s=e2(s),r.context===null?r.context=s:r.pendingContext=s,r=Bs(t),r.payload={element:n},i=i===void 0?null:i,i!==null&&(r.callback=i),n=Us(e,r,t),n!==null&&(cn(n,e,t),Qa(n,e,t))}function N0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ng(e,t){N0(e,t),(e=e.alternate)&&N0(e,t)}function n2(e){if(e.tag===13||e.tag===31){var t=Bi(e,67108864);t!==null&&cn(t,e,67108864),ng(e,67108864)}}function j0(e){if(e.tag===13||e.tag===31){var t=Tn();t=hm(t);var n=Bi(e,t);n!==null&&cn(n,e,t),ng(e,t)}}var nd=!0;function vE(e,t,n,r){var s=pe.T;pe.T=null;var i=Ce.p;try{Ce.p=2,rg(e,t,n,r)}finally{Ce.p=i,pe.T=s}}function bE(e,t,n,r){var s=pe.T;pe.T=null;var i=Ce.p;try{Ce.p=8,rg(e,t,n,r)}finally{Ce.p=i,pe.T=s}}function rg(e,t,n,r){if(nd){var s=Mp(r);if(s===null)ah(e,t,r,rd,n),E0(e,r);else if(SE(s,e,t,n,r))r.stopPropagation();else if(E0(e,r),t&4&&-1<wE.indexOf(e)){for(;s!==null;){var i=sa(s);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=di(i.pendingLanes);if(o!==0){var a=i;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var c=1<<31-En(o);a.entanglements[1]|=c,o&=~c}Mr(i),!(Ae&6)&&(Gu=Nn()+500,Gl(0))}}break;case 31:case 13:a=Bi(i,2),a!==null&&cn(a,i,2),Yd(),ng(i,2)}if(i=Mp(r),i===null&&ah(e,t,r,rd,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else ah(e,t,r,null,n)}}function Mp(e){return e=xm(e),sg(e)}var rd=null;function sg(e){if(rd=null,e=io(e),e!==null){var t=Ll(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=Sb(t),e!==null)return e;e=null}else if(n===31){if(e=_b(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 rd=e,null}function r2(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(oN()){case Eb:return 2;case Tb:return 8;case zu:case aN:return 32;case Ab:return 268435456;default:return 32}default:return 32}}var zp=!1,Ys=null,qs=null,Vs=null,Sl=new Map,_l=new Map,Cs=[],wE="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 E0(e,t){switch(e){case"focusin":case"focusout":Ys=null;break;case"dragenter":case"dragleave":qs=null;break;case"mouseover":case"mouseout":Vs=null;break;case"pointerover":case"pointerout":Sl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":_l.delete(t.pointerId)}}function Ea(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=sa(t),t!==null&&n2(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function SE(e,t,n,r,s){switch(t){case"focusin":return Ys=Ea(Ys,e,t,n,r,s),!0;case"dragenter":return qs=Ea(qs,e,t,n,r,s),!0;case"mouseover":return Vs=Ea(Vs,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return Sl.set(i,Ea(Sl.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,_l.set(i,Ea(_l.get(i)||null,e,t,n,r,s)),!0}return!1}function s2(e){var t=io(e.target);if(t!==null){var n=Ll(t);if(n!==null){if(t=n.tag,t===13){if(t=Sb(n),t!==null){e.blockedOn=t,dx(e.priority,function(){j0(n)});return}}else if(t===31){if(t=_b(n),t!==null){e.blockedOn=t,dx(e.priority,function(){j0(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 wu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Mp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Qh=r,n.target.dispatchEvent(r),Qh=null}else return t=sa(n),t!==null&&n2(t),e.blockedOn=n,!1;t.shift()}return!0}function T0(e,t,n){wu(e)&&n.delete(t)}function _E(){zp=!1,Ys!==null&&wu(Ys)&&(Ys=null),qs!==null&&wu(qs)&&(qs=null),Vs!==null&&wu(Vs)&&(Vs=null),Sl.forEach(T0),_l.forEach(T0)}function $c(e,t){e.blockedOn===t&&(e.blockedOn=null,zp||(zp=!0,St.unstable_scheduleCallback(St.unstable_NormalPriority,_E)))}var Lc=null;function A0(e){Lc!==e&&(Lc=e,St.unstable_scheduleCallback(St.unstable_NormalPriority,function(){Lc===e&&(Lc=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],s=e[t+2];if(typeof r!="function"){if(sg(r||n)===null)continue;break}var i=sa(n);i!==null&&(e.splice(t,3),t-=3,fp(i,{pending:!0,data:s,method:n.method,action:r},r,s))}}))}function qo(e){function t(c){return $c(c,e)}Ys!==null&&$c(Ys,e),qs!==null&&$c(qs,e),Vs!==null&&$c(Vs,e),Sl.forEach(t),_l.forEach(t);for(var n=0;n<Cs.length;n++){var r=Cs[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Cs.length&&(n=Cs[0],n.blockedOn===null);)s2(n),n.blockedOn===null&&Cs.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var s=n[r],i=n[r+1],o=s[un]||null;if(typeof i=="function")o||A0(n);else if(o){var a=null;if(i&&i.hasAttribute("formAction")){if(s=i,o=i[un]||null)a=o.formAction;else if(sg(s)!==null)continue}else a=o.action;typeof a=="function"?n[r+1]=a:(n.splice(r,3),r-=3),A0(n)}}}function i2(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(o){return s=o})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function ig(e){this._internalRoot=e}Gd.prototype.render=ig.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(K(409));var n=t.current,r=Tn();t2(n,r,e,t,null,null)};Gd.prototype.unmount=ig.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;t2(e.current,2,null,e,null,null),Yd(),t[ra]=null}};function Gd(e){this._internalRoot=e}Gd.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rb();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Cs.length&&t!==0&&t<Cs[n].priority;n++);Cs.splice(n,0,e),n===0&&s2(e)}};var C0=bb.version;if(C0!=="19.2.6")throw Error(K(527,C0,"19.2.6"));Ce.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(K(188)):(e=Object.keys(e).join(","),Error(K(268,e)));return e=Jk(t),e=e!==null?kb(e):null,e=e===null?null:e.stateNode,e};var kE={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:pe,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hc.isDisabled&&Hc.supportsFiber)try{Hl=Hc.inject(kE),jn=Hc}catch{}}Ad.createRoot=function(e,t){if(!wb(e))throw Error(K(299));var n=!1,r="",s=Q1,i=K1,o=W1;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Jw(e,1,!1,null,null,n,r,null,s,i,o,i2),e[ra]=t.current,Jm(e),new ig(t)};Ad.hydrateRoot=function(e,t,n){if(!wb(e))throw Error(K(299));var r=!1,s="",i=Q1,o=K1,a=W1,c=null;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(i=n.onUncaughtError),n.onCaughtError!==void 0&&(o=n.onCaughtError),n.onRecoverableError!==void 0&&(a=n.onRecoverableError),n.formState!==void 0&&(c=n.formState)),t=Jw(e,1,!0,t,n??null,r,s,c,i,o,a,i2),t.context=e2(null),n=t.current,r=Tn(),r=hm(r),s=Bs(r),s.callback=null,Us(n,s,r),n=r,t.current.lanes=n,Ul(t,n),Mr(t),e[ra]=t.current,Jm(e),new Gd(t)};Ad.version="19.2.6";function o2(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o2)}catch(e){console.error(e)}}o2(),pb.exports=Ad;var NE=pb.exports;function jE(){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 EE{constructor(t,n){this.baseUrl=t,this.token=n}async request(t,n){const r=jE(),i=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:r,method:t,params:n})})).json();if("error"in i)throw new Error(i.error.message);return i.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,r){return this.request("session.send",{id:t,text:n,type:r})}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 configAll(){return this.request("config.get",{key:"*"})}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,r){return this.request("cron.create",{type:t,message:n,scheduledAt:r})}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 TE{constructor(t,n){ke(this,"ws",null);ke(this,"reconnectTimer",null);ke(this,"reconnectDelay",1e3);ke(this,"_reconnecting",!1);ke(this,"handlers",new Map);ke(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 r=JSON.parse(n.data);this.dispatch(r)}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 r;(r=this.handlers.get(t))==null||r.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 s of n)try{s(t)}catch{}const r=this.handlers.get("*");if(r)for(const s of r)try{s(t)}catch{}}scheduleReconnect(){this.reconnectTimer||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.reconnectDelay=Math.min(this.reconnectDelay*2,3e4),this.connect()},this.reconnectDelay))}}const a2=w.createContext({rpc:null,ws:null,connected:!1,connectionStatus:"disconnected",token:null,setToken:()=>{}});function fr(){return w.useContext(a2)}function AE({children:e}){const[t,n]=w.useState(null),[r,s]=w.useState({rpc:null,ws:null,connected:!1,connectionStatus:"disconnected"});w.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("token")||localStorage.getItem("daemon-token")||"";a&&(localStorage.setItem("daemon-token",a),n(a))},[]);const i=a=>{localStorage.setItem("daemon-token",a),n(a)};w.useEffect(()=>{if(!t){s({rpc:null,ws:null,connected:!1,connectionStatus:"disconnected"});return}const a=window.location.origin,c=new EE(a,t),u=new TE(a,t);s({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 b;x?b="connected":u.isReconnecting()?b="reconnecting":b="disconnected",s(S=>({...S,connected:x,connectionStatus:b}))}),h=setInterval(()=>{const p=u.isConnected();s(x=>({...x,connected:p,connectionStatus:p?"connected":x.connectionStatus==="reconnecting"?"reconnecting":"disconnected"}))},2e3);return()=>{d(),f(),clearInterval(h),u.disconnect()}},[t]);const o={rpc:r.rpc,ws:r.ws,connected:r.connected,connectionStatus:r.connectionStatus,token:t,setToken:i};return l.jsx(a2.Provider,{value:o,children:e})}function og(){const{rpc:e,ws:t}=fr(),[n,r]=w.useState({}),[s,i]=w.useState([]),o=w.useCallback(()=>{e&&(e.providerList().then(u=>{Array.isArray(u)&&i(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])=>{r(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]);w.useEffect(()=>{o()},[o]),w.useEffect(()=>{if(t)return t.on("config-changed",()=>{o()})},[t,o]);const a=w.useCallback(u=>n[u],[n]),c=w.useCallback(async(u,d)=>{if(e)try{await e.configSet(u,d),r(f=>({...f,[u]:d}))}catch{}},[e]);return{settings:n,get:a,set:c,providers:s}}function ag(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ii=ag();function l2(e){Ii=e}var gi={exec:()=>null};function je(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(Yt.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,t)};return r}var CE=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),Yt={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)}}>`)},ME=/^(?:[ \t]*(?:\n|$))+/,zE=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,DE=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Fl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,RE=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,lg=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,c2=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,u2=je(c2).replace(/bull/g,lg).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(),OE=je(c2).replace(/bull/g,lg).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(),cg=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$E=/^[^\n]+/,ug=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,LE=je(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ug).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),HE=je(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,lg).getRegex(),Xd="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",dg=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,BE=je("^ {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",dg).replace("tag",Xd).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),d2=je(cg).replace("hr",Fl).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",Xd).getRegex(),UE=je(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",d2).getRegex(),fg={blockquote:UE,code:zE,def:LE,fences:DE,heading:RE,hr:Fl,html:BE,lheading:u2,list:HE,newline:ME,paragraph:d2,table:gi,text:$E},M0=je("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Fl).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",Xd).getRegex(),IE={...fg,lheading:OE,table:M0,paragraph:je(cg).replace("hr",Fl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",M0).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",Xd).getRegex()},ZE={...fg,html:je(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",dg).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:gi,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:je(cg).replace("hr",Fl).replace("heading",` *#{1,6} *[^
50
+ ]`).replace("lheading",u2).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},YE=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,qE=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,f2=/^( {2,}|\\)\n(?!\s*$)/,VE=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ua=/[\p{P}\p{S}]/u,Pd=/[\s\p{P}\p{S}]/u,hg=/[^\s\p{P}\p{S}]/u,GE=je(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Pd).getRegex(),h2=/(?!~)[\p{P}\p{S}]/u,XE=/(?!~)[\s\p{P}\p{S}]/u,PE=/(?:[^\s\p{P}\p{S}]|~)/u,FE=je(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",CE?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),p2=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,QE=je(p2,"u").replace(/punct/g,ua).getRegex(),KE=je(p2,"u").replace(/punct/g,h2).getRegex(),m2="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",WE=je(m2,"gu").replace(/notPunctSpace/g,hg).replace(/punctSpace/g,Pd).replace(/punct/g,ua).getRegex(),JE=je(m2,"gu").replace(/notPunctSpace/g,PE).replace(/punctSpace/g,XE).replace(/punct/g,h2).getRegex(),eT=je("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,hg).replace(/punctSpace/g,Pd).replace(/punct/g,ua).getRegex(),tT=je(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ua).getRegex(),nT="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",rT=je(nT,"gu").replace(/notPunctSpace/g,hg).replace(/punctSpace/g,Pd).replace(/punct/g,ua).getRegex(),sT=je(/\\(punct)/,"gu").replace(/punct/g,ua).getRegex(),iT=je(/^<(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(),oT=je(dg).replace("(?:-->|$)","-->").getRegex(),aT=je("^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",oT).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),sd=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,lT=je(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",sd).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),g2=je(/^!?\[(label)\]\[(ref)\]/).replace("label",sd).replace("ref",ug).getRegex(),x2=je(/^!?\[(ref)\](?:\[\])?/).replace("ref",ug).getRegex(),cT=je("reflink|nolink(?!\\()","g").replace("reflink",g2).replace("nolink",x2).getRegex(),z0=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,pg={_backpedal:gi,anyPunctuation:sT,autolink:iT,blockSkip:FE,br:f2,code:qE,del:gi,delLDelim:gi,delRDelim:gi,emStrongLDelim:QE,emStrongRDelimAst:WE,emStrongRDelimUnd:eT,escape:YE,link:lT,nolink:x2,punctuation:GE,reflink:g2,reflinkSearch:cT,tag:aT,text:VE,url:gi},uT={...pg,link:je(/^!?\[(label)\]\((.*?)\)/).replace("label",sd).getRegex(),reflink:je(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",sd).getRegex()},Dp={...pg,emStrongRDelimAst:JE,emStrongLDelim:KE,delLDelim:tT,delRDelim:rT,url:je(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",z0).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:je(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",z0).getRegex()},dT={...Dp,br:je(f2).replace("{2,}","*").getRegex(),text:je(Dp.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Bc={normal:fg,gfm:IE,pedantic:ZE},Ta={normal:pg,gfm:Dp,breaks:dT,pedantic:uT},fT={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},D0=e=>fT[e];function br(e,t){if(t){if(Yt.escapeTest.test(e))return e.replace(Yt.escapeReplace,D0)}else if(Yt.escapeTestNoEncode.test(e))return e.replace(Yt.escapeReplaceNoEncode,D0);return e}function R0(e){try{e=encodeURI(e).replace(Yt.percentDecode,"%")}catch{return null}return e}function O0(e,t){var i;let n=e.replace(Yt.findPipe,(o,a,c)=>{let u=!1,d=a;for(;--d>=0&&c[d]==="\\";)u=!u;return u?"|":" |"}),r=n.split(Yt.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(Yt.slashPipe,"|");return r}function vs(e,t,n){let r=e.length;if(r===0)return"";let s=0;for(;s<r&&e.charAt(r-s-1)===t;)s++;return e.slice(0,r-s)}function $0(e){let t=e.split(`
51
+ `),n=t.length-1;for(;n>=0&&Yt.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
52
+ `)}function hT(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function pT(e,t=0){let n=t,r="";for(let s of e)if(s===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=s,n++;return r}function L0(e,t,n,r,s){let i=t.href,o=t.title||null,a=e[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,c}function mT(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let s=r[1];return t.split(`
53
+ `).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[a]=o;return a.length>=s.length?i.slice(s.length):i}).join(`
54
+ `)}var id=class{constructor(e){ke(this,"options");ke(this,"rules");ke(this,"lexer");this.options=e||Ii}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]:$0(t[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=mT(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:r}}}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 r=vs(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:vs(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:vs(t[0],`
56
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=vs(t[0],`
57
+ `).split(`
58
+ `),r="",s="",i=[];for(;n.length>0;){let o=!1,a=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))a.push(n[c]),o=!0;else if(!o)a.push(n[c]);else break;n=n.slice(c);let u=a.join(`
59
+ `),d=u.replace(this.rules.other.blockquoteSetextReplace,`
60
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
61
+ ${u}`:u,s=s?`${s}
62
+ ${d}`:d;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,i,!0),this.lexer.state.top=f,n.length===0)break;let h=i.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
+ `),b=this.blockquote(x);i[i.length-1]=b,r=r.substring(0,r.length-p.raw.length)+b.raw,s=s.substring(0,s.length-p.text.length)+b.text;break}else if((h==null?void 0:h.type)==="list"){let p=h,x=p.raw+`
65
+ `+n.join(`
66
+ `),b=this.list(x);i[i.length-1]=b,r=r.substring(0,r.length-h.raw.length)+b.raw,s=s.substring(0,s.length-p.raw.length)+b.raw,n=x.substring(i.at(-1).raw.length).split(`
67
+ `);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,s={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),o=!1;for(;e;){let c=!1,u="",d="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;u=t[0],e=e.substring(u.length);let f=pT(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 b=this.rules.other.nextBulletRegex(x),S=this.rules.other.hrRegex(x),m=this.rules.other.fencesBeginRegex(x),y=this.rules.other.headingBeginRegex(x),g=this.rules.other.htmlBeginRegex(x),v=this.rules.other.blockquoteBeginRegex(x);for(;e;){let N=e.split(`
71
+ `,1)[0],k;if(h=N,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),k=h):k=h.replace(this.rules.other.tabCharGlobal," "),m.test(h)||y.test(h)||g.test(h)||v.test(h)||b.test(h)||S.test(h))break;if(k.search(this.rules.other.nonSpaceChar)>=x||!h.trim())d+=`
72
+ `+k.slice(x);else{if(p||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||m.test(f)||y.test(f)||S.test(f))break;d+=`
73
+ `+h}p=!h.trim(),u+=N+`
74
+ `,e=e.substring(N.length+1),f=k.slice(x)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0)),s.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]}),s.raw+=u}let a=s.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let c of s.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,s.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(!s.loose){let d=c.tokens.filter(h=>h.type==="space"),f=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));s.loose=f}}if(s.loose)for(let c of s.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.type="paragraph")}return s}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=$0(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," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:vs(t[0],`
75
+ `),href:r,title:s}}}table(e){var o;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=O0(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=t[3])!=null&&o.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
76
+ `):[],i={type:"table",raw:vs(t[0],`
77
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<n.length;a++)i.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:i.align[a]});for(let a of s)i.rows.push(O0(a,i.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:i.align[u]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:vs(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 i=vs(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=hT(t[2],"()");if(i===-2)return;if(i>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let r=t[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),L0(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.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 r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=t[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return L0(n,s,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,a=s,c=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+s);(r=u.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){c+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);let d=[...r[0]][0].length,f=e.slice(0,s+r.index+d+o);if(Math.min(s,o)%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," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(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 r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,a=s,c=this.rules.inline.delRDelim;for(c.lastIndex=0,t=t.slice(-1*e.length+s);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(o=[...i].length,o!==s))continue;if(r[3]||r[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let u=[...r[0]][0].length,d=e.slice(0,s+r.index+u+o),f=d.slice(s,-s);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,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let r,s;if(t[2]==="@")r=t[0],s="mailto:"+r;else{let i;do i=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(i!==t[0]);r=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}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}}}},nr=class Rp{constructor(t){ke(this,"tokens");ke(this,"options");ke(this,"state");ke(this,"inlineQueue");ke(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Ii,this.options.tokenizer=this.options.tokenizer||new id,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:Yt,block:Bc.normal,inline:Ta.normal};this.options.pedantic?(n.block=Bc.pedantic,n.inline=Ta.pedantic):this.options.gfm&&(n.block=Bc.gfm,this.options.breaks?n.inline=Ta.breaks:n.inline=Ta.gfm),this.tokenizer.rules=n}static get rules(){return{block:Bc,inline:Ta}}static lex(t,n){return new Rp(n).lex(t)}static lexInline(t,n){return new Rp(n).inlineTokens(t)}lex(t){t=t.replace(Yt.carriageReturn,`
80
+ `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var i,o,a;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(Yt.tabCharGlobal," ").replace(Yt.spaceLine,""));let s=1/0;for(;t;){if(t.length<s)s=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let c;if((o=(i=this.options.extensions)==null?void 0:i.block)!=null&&o.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((a=this.options.extensions)!=null&&a.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);r&&(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),r=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 r=t,s=null;if(this.tokens.links){let x=Object.keys(this.tokens.links);if(x.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)x.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((d=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:d.call({lexer:this},r))??r;let o=!1,a="",c=1/0;for(;t;){if(t.length<c)c=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(a=""),o=!1;let x;if((h=(f=this.options.extensions)==null?void 0:f.inline)!=null&&h.some(S=>(x=S.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 S=n.at(-1);x.type==="text"&&(S==null?void 0:S.type)==="text"?(S.raw+=x.raw,S.text+=x.text):n.push(x);continue}if(x=this.tokenizer.emStrong(t,r,a)){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,r,a)){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 b=t;if((p=this.options.extensions)!=null&&p.startInline){let S=1/0,m=t.slice(1),y;this.options.extensions.startInline.forEach(g=>{y=g.call({lexer:this},m),typeof y=="number"&&y>=0&&(S=Math.min(S,y))}),S<1/0&&S>=0&&(b=t.substring(0,S+1))}if(x=this.tokenizer.inlineText(b)){t=t.substring(x.raw.length),x.raw.slice(-1)!=="_"&&(a=x.raw.slice(-1)),o=!0;let S=n.at(-1);(S==null?void 0:S.type)==="text"?(S.raw+=x.raw,S.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)}},od=class{constructor(e){ke(this,"options");ke(this,"parser");this.options=e||Ii}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(Yt.notSpaceStart))==null?void 0:i[0],s=e.replace(Yt.endingNewline,"")+`
94
+ `;return r?'<pre><code class="language-'+br(r)+'">'+(n?s:br(s,!0))+`</code></pre>
95
+ `:"<pre><code>"+(n?s:br(s,!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,r="";for(let o=0;o<e.items.length;o++){let a=e.items[o];r+=this.listitem(a)}let s=t?"ol":"ul",i=t&&n!==1?' start="'+n+'"':"";return"<"+s+i+`>
101
+ `+r+"</"+s+`>
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 s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);t+=this.tablerow({text:n});let r="";for(let s=0;s<e.rows.length;s++){let i=e.rows[s];n="";for(let o=0;o<i.length;o++)n+=this.tablecell(i[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
105
+ <thead>
106
+ `+t+`</thead>
107
+ `+r+`</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>${br(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 r=this.parser.parseInline(n),s=R0(e);if(s===null)return r;e=s;let i='<a href="'+e+'"';return t&&(i+=' title="'+br(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=R0(e);if(s===null)return br(n);e=s;let i=`<img src="${e}" alt="${br(n)}"`;return t&&(i+=` title="${br(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:br(e.text)}},mg=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}},rr=class Op{constructor(t){ke(this,"options");ke(this,"renderer");ke(this,"textRenderer");this.options=t||Ii,this.options.renderer=this.options.renderer||new od,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new mg}static parse(t,n){return new Op(n).parse(t)}static parseInline(t,n){return new Op(n).parseInline(t)}parse(t){var r,s;this.renderer.parser=this;let n="";for(let i=0;i<t.length;i++){let o=t[i];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[o.type]){let c=o,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 a=o;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let c='Token with "'+a.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 s,i;this.renderer.parser=this;let r="";for(let o=0;o<t.length;o++){let a=t[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){let u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=u||"";continue}}let c=a;switch(c.type){case"escape":{r+=n.text(c);break}case"html":{r+=n.html(c);break}case"link":{r+=n.link(c);break}case"image":{r+=n.image(c);break}case"checkbox":{r+=n.checkbox(c);break}case"strong":{r+=n.strong(c);break}case"em":{r+=n.em(c);break}case"codespan":{r+=n.codespan(c);break}case"br":{r+=n.br(c);break}case"del":{r+=n.del(c);break}case"text":{r+=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 r}},ou,Ua=(ou=class{constructor(e){ke(this,"options");ke(this,"block");this.options=e||Ii}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?nr.lex:nr.lexInline}provideParser(e=this.block){return e?rr.parse:rr.parseInline}},ke(ou,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ke(ou,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ou),gT=class{constructor(...e){ke(this,"defaults",ag());ke(this,"options",this.setOptions);ke(this,"parse",this.parseMarkdown(!0));ke(this,"parseInline",this.parseMarkdown(!1));ke(this,"Parser",rr);ke(this,"Renderer",od);ke(this,"TextRenderer",mg);ke(this,"Lexer",nr);ke(this,"Tokenizer",id);ke(this,"Hooks",Ua);this.use(...e)}walkTokens(e,t){var r,s;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let o=i;for(let a of o.header)n=n.concat(this.walkTokens(a.tokens,t));for(let a of o.rows)for(let c of a)n=n.concat(this.walkTokens(c.tokens,t));break}case"list":{let o=i;n=n.concat(this.walkTokens(o.items,t));break}default:{let o=i;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let c=o[a].flat(1/0);n=n.concat(this.walkTokens(c,t))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=t.renderers[s.name];i?t.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[s.level];i?i.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),r.extensions=t),n.renderer){let s=this.defaults.renderer||new od(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,a=n.renderer[o],c=s[o];s[o]=(...u)=>{let d=a.apply(s,u);return d===!1&&(d=c.apply(s,u)),d||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new id(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,a=n.tokenizer[o],c=s[o];s[o]=(...u)=>{let d=a.apply(s,u);return d===!1&&(d=c.apply(s,u)),d}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Ua;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,a=n.hooks[o],c=s[o];Ua.passThroughHooks.has(i)?s[o]=u=>{if(this.defaults.async&&Ua.passThroughHooksRespectAsync.has(i))return(async()=>{let f=await a.call(s,u);return c.call(s,f)})();let d=a.call(s,u);return c.call(s,d)}:s[o]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await a.apply(s,u);return f===!1&&(f=await c.apply(s,u)),f})();let d=a.apply(s,u);return d===!1&&(d=c.apply(s,u)),d}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(o){let a=[];return a.push(i.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return nr.lex(e,t??this.defaults)}parser(e,t){return rr.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(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 i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(t):t,a=await(s.hooks?await s.hooks.provideLexer(e):e?nr.lex:nr.lexInline)(o,s),c=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let u=await(s.hooks?await s.hooks.provideParser(e):e?rr.parse:rr.parseInline)(c,s);return s.hooks?await s.hooks.postprocess(u):u})().catch(i);try{s.hooks&&(t=s.hooks.preprocess(t));let o=(s.hooks?s.hooks.provideLexer(e):e?nr.lex:nr.lexInline)(t,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let a=(s.hooks?s.hooks.provideParser(e):e?rr.parse:rr.parseInline)(o,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(o){return i(o)}}}onError(e,t){return n=>{if(n.message+=`
112
+ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+br(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Mi=new gT;function ze(e,t){return Mi.parse(e,t)}ze.options=ze.setOptions=function(e){return Mi.setOptions(e),ze.defaults=Mi.defaults,l2(ze.defaults),ze};ze.getDefaults=ag;ze.defaults=Ii;ze.use=function(...e){return Mi.use(...e),ze.defaults=Mi.defaults,l2(ze.defaults),ze};ze.walkTokens=function(e,t){return Mi.walkTokens(e,t)};ze.parseInline=Mi.parseInline;ze.Parser=rr;ze.parser=rr.parse;ze.Renderer=od;ze.TextRenderer=mg;ze.Lexer=nr;ze.lexer=nr.lex;ze.Tokenizer=id;ze.Hooks=Ua;ze.parse=ze;ze.options;ze.setOptions;ze.use;ze.walkTokens;ze.parseInline;rr.parse;nr.lex;/*! @license DOMPurify 3.4.14 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.14/LICENSE */function H0(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function xT(e){if(Array.isArray(e))return e}function yT(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,i,o,a=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return a}}function vT(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
113
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bT(e,t){return xT(e)||yT(e,t)||wT(e,t)||vT()}function wT(e,t){if(e){if(typeof e=="string")return H0(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?H0(e,t):void 0}}const y2=Object.entries,B0=Object.setPrototypeOf,ST=Object.isFrozen,_T=Object.getPrototypeOf,kT=Object.getOwnPropertyDescriptor;let wt=Object.freeze,Ct=Object.seal,no=Object.create,v2=typeof Reflect<"u"&&Reflect,$p=v2.apply,Lp=v2.construct;wt||(wt=function(t){return t});Ct||(Ct=function(t){return t});$p||($p=function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i];return t.apply(n,s)});Lp||(Lp=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return new t(...r)});const pi=gt(Array.prototype.forEach),NT=gt(Array.prototype.lastIndexOf),U0=gt(Array.prototype.pop),Aa=gt(Array.prototype.push),jT=gt(Array.prototype.splice),To=Array.isArray,Ia=gt(String.prototype.toLowerCase),uh=gt(String.prototype.toString),I0=gt(String.prototype.match),Ca=gt(String.prototype.replace),Z0=gt(String.prototype.indexOf),ET=gt(String.prototype.trim),TT=gt(Number.prototype.toString),AT=gt(Boolean.prototype.toString),Y0=typeof BigInt>"u"?null:gt(BigInt.prototype.toString),q0=typeof Symbol>"u"?null:gt(Symbol.prototype.toString),sn=gt(Object.prototype.hasOwnProperty),Ma=gt(Object.prototype.toString),Zt=gt(RegExp.prototype.test),li=CT(TypeError);function gt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return $p(e,t,r)}}function CT(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Lp(e,n)}}function Ee(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ia;if(B0&&B0(e,null),!To(t))return e;let r=t.length;for(;r--;){let s=t[r];if(typeof s=="string"){const i=n(s);i!==s&&(ST(t)||(t[r]=i),s=i)}e[s]=!0}return e}function MT(e){for(let t=0;t<e.length;t++)sn(e,t)||(e[t]=null);return e}function yn(e){const t=no(null);for(const r of y2(e)){var n=bT(r,2);const s=n[0],i=n[1];sn(e,s)&&(To(i)?t[s]=MT(i):i&&typeof i=="object"&&i.constructor===Object?t[s]=yn(i):t[s]=i)}return t}function zT(e){switch(typeof e){case"string":return e;case"number":return TT(e);case"boolean":return AT(e);case"bigint":return Y0?Y0(e):"0";case"symbol":return q0?q0(e):"Symbol()";case"undefined":return Ma(e);case"function":case"object":{if(e===null)return Ma(e);const t=e,n=Wn(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:Ma(r)}return Ma(e)}default:return Ma(e)}}function Wn(e,t){for(;e!==null;){const r=kT(e,t);if(r){if(r.get)return gt(r.get);if(typeof r.value=="function")return gt(r.value)}e=_T(e)}function n(){return null}return n}function DT(e){try{return Zt(e,""),!0}catch{return!1}}const V0=wt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),dh=wt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),fh=wt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),RT=wt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),hh=wt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),OT=wt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),G0=wt(["#text"]),X0=wt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),ph=wt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),P0=wt(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Uc=wt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),$T=Ct(/{{[\w\W]*|^[\w\W]*}}/g),LT=Ct(/<%[\w\W]*|^[\w\W]*%>/g),HT=Ct(/\${[\w\W]*/g),BT=Ct(/^data-[\-\w.\u00B7-\uFFFF]+$/),UT=Ct(/^aria-[\-\w]+$/),F0=Ct(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IT=Ct(/^(?:\w+script|data):/i),ZT=Ct(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),YT=Ct(/^html$/i),qT=Ct(/^[a-z][.\w]*(-[.\w]+)+$/i),Q0=Ct(/<[/\w!]/g),K0=Ct(/<[/\w]/g),VT=Ct(/<\/no(script|embed|frames)/i),GT=Ct(/\/>/i),xn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},b2=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],XT=wt(Ee({},b2)),PT=function(){const e={};return pi(b2,t=>{e[t]=Ct(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),wt(e)}(),FT=function(){return typeof window>"u"?null:window},QT=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},W0=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},bs=function(t,n,r,s){return sn(t,n)&&To(t[n])?Ee(s.base?yn(s.base):{},t[n],s.transform):r},mh=function(t,n,r){const s=sn(t,n)?t[n]:void 0;return s&&typeof s=="object"?yn(s):r()};function w2(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:FT();const t=ne=>w2(ne);if(t.version="3.4.14",t.removed=[],!e||!e.document||e.document.nodeType!==xn.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,s=r.currentScript;e.DocumentFragment;const i=e.HTMLTemplateElement,o=e.Node,a=e.Element,c=e.NodeFilter,u=e.NamedNodeMap;u===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const d=e.DOMParser,f=e.trustedTypes,h=a.prototype,p=Wn(h,"cloneNode"),x=Wn(h,"remove"),b=Wn(h,"nextSibling"),S=Wn(h,"childNodes"),m=Wn(h,"parentNode"),y=Wn(h,"shadowRoot"),g=Wn(h,"attributes"),v=o&&o.prototype?Wn(o.prototype,"nodeType"):null,N=o&&o.prototype?Wn(o.prototype,"nodeName"):null,k=o&&o.prototype?Wn(o.prototype,"ownerDocument"):null,T=function(M){return v?v(M):M.nodeType},z=function(M){return N?N(M):M.nodeName};if(typeof i=="function"){const ne=n.createElement("template");ne.content&&ne.content.ownerDocument&&(n=ne.content.ownerDocument)}let A,L="",R,H=!1,Y=0;const _=function(){if(Y>0)throw li('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},C=function(M){_(),Y++;try{return A.createHTML(M)}finally{Y--}},j=function(M){_(),Y++;try{return A.createScriptURL(M)}finally{Y--}},D=function(){return H||(R=QT(f,s),H=!0),R},O=n,$=O.implementation,U=O.createNodeIterator,X=O.createDocumentFragment,Z=O.getElementsByTagName,B=r.importNode;let E=W0();t.isSupported=typeof y2=="function"&&typeof m=="function"&&$&&$.createHTMLDocument!==void 0;const q=$T,V=LT,J=HT,F=BT,G=UT,te=IT,le=ZT,ie=qT;let ce=F0,oe=null;const he=Ee({},[...V0,...dh,...fh,...hh,...G0]);let re=null;const W=Ee({},[...X0,...ph,...P0,...Uc]);let ge=Object.seal(no(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ue=null,it=null;const yt=Object.seal(no(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let hn=!0,Dn=!0,Rr=!1,Or=!0,Mt=!1,ut=!0,zt=!1,Xn=!1,Pn=null,qt=null,ms=!1,pr=!1,gs=!1,mr=!1,ti=!0,Yi=!1;const ni="user-content-";let ri=!0,si=!1,gr={},qe=null;const _t=Ee({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let kt=null;const pn=Ee({},["audio","video","img","source","image","track"]);let Dt=null;const Nt=Ee({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Rt="http://www.w3.org/1998/Math/MathML",mn="http://www.w3.org/2000/svg",Me="http://www.w3.org/1999/xhtml";let Ot=Me,It=!1,Vt=null;const $r=Ee({},[Rt,mn,Me],uh),xr=wt(["mi","mo","mn","ms","mtext"]);let Wt=Ee({},xr);const yr=wt(["annotation-xml"]);let Lr=Ee({},yr);const yf=Ee({},["title","style","font","a","script"]);let ii=null;const cc=["application/xhtml+xml","text/html"],uc="text/html";let Qe=null,xs=null;const vf=n.createElement("form"),dc=function(M){return M instanceof RegExp||M instanceof Function},xa=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(xs&&xs===M)return;(!M||typeof M!="object")&&(M={}),M=yn(M),ii=cc.indexOf(M.PARSER_MEDIA_TYPE)===-1?uc:M.PARSER_MEDIA_TYPE,Qe=ii==="application/xhtml+xml"?uh:Ia,oe=bs(M,"ALLOWED_TAGS",he,{transform:Qe}),re=bs(M,"ALLOWED_ATTR",W,{transform:Qe}),Vt=bs(M,"ALLOWED_NAMESPACES",$r,{transform:uh}),Dt=bs(M,"ADD_URI_SAFE_ATTR",Nt,{transform:Qe,base:Nt}),kt=bs(M,"ADD_DATA_URI_TAGS",pn,{transform:Qe,base:pn}),qe=bs(M,"FORBID_CONTENTS",_t,{transform:Qe}),Ue=bs(M,"FORBID_TAGS",yn({}),{transform:Qe}),it=bs(M,"FORBID_ATTR",yn({}),{transform:Qe}),gr=sn(M,"USE_PROFILES")?M.USE_PROFILES&&typeof M.USE_PROFILES=="object"?yn(M.USE_PROFILES):M.USE_PROFILES:!1,hn=M.ALLOW_ARIA_ATTR!==!1,Dn=M.ALLOW_DATA_ATTR!==!1,Rr=M.ALLOW_UNKNOWN_PROTOCOLS||!1,Or=M.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Mt=M.SAFE_FOR_TEMPLATES||!1,ut=M.SAFE_FOR_XML!==!1,zt=M.WHOLE_DOCUMENT||!1,pr=M.RETURN_DOM||!1,gs=M.RETURN_DOM_FRAGMENT||!1,mr=M.RETURN_TRUSTED_TYPE||!1,ms=M.FORCE_BODY||!1,ti=M.SANITIZE_DOM!==!1,Yi=M.SANITIZE_NAMED_PROPS||!1,ri=M.KEEP_CONTENT!==!1,si=M.IN_PLACE||!1,ce=DT(M.ALLOWED_URI_REGEXP)?M.ALLOWED_URI_REGEXP:F0,Ot=typeof M.NAMESPACE=="string"?M.NAMESPACE:Me,Wt=mh(M,"MATHML_TEXT_INTEGRATION_POINTS",()=>Ee({},xr)),Lr=mh(M,"HTML_INTEGRATION_POINTS",()=>Ee({},yr));const I=mh(M,"CUSTOM_ELEMENT_HANDLING",()=>no(null));if(ge=no(null),sn(I,"tagNameCheck")&&dc(I.tagNameCheck)&&(ge.tagNameCheck=I.tagNameCheck),sn(I,"attributeNameCheck")&&dc(I.attributeNameCheck)&&(ge.attributeNameCheck=I.attributeNameCheck),sn(I,"allowCustomizedBuiltInElements")&&typeof I.allowCustomizedBuiltInElements=="boolean"&&(ge.allowCustomizedBuiltInElements=I.allowCustomizedBuiltInElements),Ct(ge),Mt&&(Dn=!1),gs&&(pr=!0),gr&&(oe=Ee({},G0),re=no(null),gr.html===!0&&(Ee(oe,V0),Ee(re,X0)),gr.svg===!0&&(Ee(oe,dh),Ee(re,ph),Ee(re,Uc)),gr.svgFilters===!0&&(Ee(oe,fh),Ee(re,ph),Ee(re,Uc)),gr.mathMl===!0&&(Ee(oe,hh),Ee(re,P0),Ee(re,Uc))),yt.tagCheck=null,yt.attributeCheck=null,sn(M,"ADD_TAGS")&&(typeof M.ADD_TAGS=="function"?yt.tagCheck=M.ADD_TAGS:To(M.ADD_TAGS)&&(oe===he&&(oe=yn(oe)),Ee(oe,M.ADD_TAGS,Qe))),sn(M,"ADD_ATTR")&&(typeof M.ADD_ATTR=="function"?yt.attributeCheck=M.ADD_ATTR:To(M.ADD_ATTR)&&(re===W&&(re=yn(re)),Ee(re,M.ADD_ATTR,Qe))),sn(M,"ADD_FORBID_CONTENTS")&&To(M.ADD_FORBID_CONTENTS)&&(qe===_t&&(qe=yn(qe)),Ee(qe,M.ADD_FORBID_CONTENTS,Qe)),ri&&(oe["#text"]=!0),zt&&Ee(oe,["html","head","body"]),oe.table&&(Ee(oe,["tbody"]),delete Ue.tbody),M.TRUSTED_TYPES_POLICY){if(typeof M.TRUSTED_TYPES_POLICY.createHTML!="function")throw li('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof M.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw li('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ee=A;A=M.TRUSTED_TYPES_POLICY;try{L=C("")}catch(ae){throw A=ee,ae}}else M.TRUSTED_TYPES_POLICY===null?(A=void 0,L=""):(A===void 0&&(A=D()),A&&typeof L=="string"&&(L=C("")));wt&&wt(M),xs=M},fc=Ee({},[...dh,...fh,...RT]),hc=Ee({},[...hh,...OT]),pc=function(M,I,ee){return I.namespaceURI===Me?M==="svg":I.namespaceURI===Rt?M==="svg"&&(ee==="annotation-xml"||Wt[ee]):!!fc[M]},bf=function(M,I,ee){return I.namespaceURI===Me?M==="math":I.namespaceURI===mn?M==="math"&&Lr[ee]:!!hc[M]},wf=function(M,I,ee){return I.namespaceURI===mn&&!Lr[ee]||I.namespaceURI===Rt&&!Wt[ee]?!1:!hc[M]&&(yf[M]||!fc[M])},Sf=function(M){let I=m(M);(!I||!I.tagName)&&(I={namespaceURI:Ot,tagName:"template"});const ee=Ia(M.tagName),ae=Ia(I.tagName);return Vt[M.namespaceURI]?M.namespaceURI===mn?pc(ee,I,ae):M.namespaceURI===Rt?bf(ee,I,ae):M.namespaceURI===Me?wf(ee,I,ae):!!(ii==="application/xhtml+xml"&&Vt[M.namespaceURI]):!1},vr=function(M){Aa(t.removed,{element:M});try{m(M).removeChild(M)}catch{if(x(M),!m(M))throw li("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},mc=function(M,I,ee){try{M.removeAttributeNode(I)}catch{try{M.removeAttribute(ee)}catch{}}},qi=function(M){Vi(M);const I=S(M);if(I){const ae=[];pi(I,ue=>{Aa(ae,ue)}),pi(ae,ue=>{try{x(ue)}catch{}})}const ee=g(M);if(ee)for(let ae=ee.length-1;ae>=0;--ae){const ue=ee[ae],me=ue&&ue.name;typeof me=="string"&&mc(M,ue,me)}},Hr=function(M,I,ee){if(!ee)try{ee=I.getAttributeNode(M)}catch{ee=null}Aa(t.removed,{attribute:ee||null,from:I});try{ee?I.removeAttributeNode(ee):I.removeAttribute(M)}catch{try{I.removeAttribute(M)}catch{}}if(M==="is")if(pr||gs)try{vr(I)}catch{}else try{I.setAttribute(M,"")}catch{}},gc=function(M){const I=g(M);if(I)for(let ee=I.length-1;ee>=0;--ee){const ae=I[ee],ue=ae&&ae.name;typeof ue!="string"||re[Qe(ue)]||mc(M,ae,ue)}},Vi=function(M){const I=[M];for(;I.length>0;){const ee=I.pop();T(ee)===xn.element&&gc(ee);const ue=S(ee);if(ue)for(let me=ue.length-1;me>=0;--me)I.push(ue[me])}},xc=function(M,I){return ut?M==="patchsrc"?!0:M==="for"&&I!=="label"&&I!=="output":!1},_f=function(M){if(!ut)return;const I=[M];for(;I.length>0;){const ee=I.pop(),ae=T(ee);if(ae===xn.processingInstruction||ae===xn.comment&&Zt(K0,ee.data)){try{x(ee)}catch{}continue}if(ae===xn.element){const me=ee,Ze=Qe(z(ee));try{me.hasAttribute&&me.hasAttribute("patchsrc")&&me.removeAttribute("patchsrc"),me.hasAttribute&&me.hasAttribute("for")&&xc("for",Ze)&&me.removeAttribute("for")}catch{}}const ue=S(ee);if(ue)for(let me=ue.length-1;me>=0;--me)I.push(ue[me])}},yc=function(M){let I=null,ee=null;if(ms)M="<remove></remove>"+M;else{const me=I0(M,/^[\r\n\t ]+/);ee=me&&me[0]}ii==="application/xhtml+xml"&&Ot===Me&&(M='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+M+"</body></html>");const ae=A?C(M):M;if(Ot===Me)try{I=new d().parseFromString(ae,ii)}catch{}if(!I||!I.documentElement){I=$.createDocument(Ot,"template",null);try{I.documentElement.innerHTML=It?L:ae}catch{}}const ue=I.body||I.documentElement;return M&&ee&&ue.insertBefore(n.createTextNode(ee),ue.childNodes[0]||null),Ot===Me?Z.call(I,zt?"html":"body")[0]:zt?I.documentElement:ue},vc=function(M){const I=k?k(M):M.ownerDocument;return U.call(I||M,M,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Gi=function(M){return M=Ca(M,q," "),M=Ca(M,V," "),M=Ca(M,J," "),M},ya=function(M){var I;M.normalize();const ee=k?k(M):M.ownerDocument,ae=U.call(ee||M,M,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let ue=ae.nextNode();for(;ue;)ue.data=Gi(ue.data),ue=ae.nextNode();const me=(I=M.querySelectorAll)===null||I===void 0?void 0:I.call(M,"template");me&&pi(me,Ze=>{Fn(Ze.content)&&ya(Ze.content)})},Xi=function(M){const I=N?N(M):null;return typeof I!="string"||Qe(I)!=="form"?!1:typeof M.nodeName!="string"||typeof M.textContent!="string"||typeof M.removeChild!="function"||M.attributes!==g(M)||typeof M.removeAttribute!="function"||typeof M.setAttribute!="function"||typeof M.namespaceURI!="string"||typeof M.insertBefore!="function"||typeof M.hasChildNodes!="function"||M.nodeType!==v(M)||M.childNodes!==S(M)},Fn=function(M){if(!v||typeof M!="object"||M===null)return!1;try{return v(M)===xn.documentFragment}catch{return!1}},oi=function(M){if(!v||typeof M!="object"||M===null)return!1;try{return typeof v(M)=="number"}catch{return!1}};function gn(ne,M,I){ne.length!==0&&pi(ne,ee=>{ee.call(t,M,I,xs)})}const kf=function(M,I){return!!(ut&&M.hasChildNodes()&&!oi(M.firstElementChild)&&Zt(Q0,M.textContent)&&Zt(Q0,M.innerHTML)||ut&&M.namespaceURI===Me&&XT[I]&&(oi(M.firstElementChild)||typeof M.textContent=="string"&&Zt(PT[I],M.textContent))||M.nodeType===xn.processingInstruction||ut&&M.nodeType===xn.comment&&Zt(K0,M.data))},Pi=function(M,I){if(M instanceof RegExp)return Zt(M,I);if(M instanceof Function){for(var ee=arguments.length,ae=new Array(ee>2?ee-2:0),ue=2;ue<ee;ue++)ae[ue-2]=arguments[ue];return!!M(I,...ae)}return!1},va=function(M,I,ee){if(!Ue[I]&&tx(I)&&Pi(ge.tagNameCheck,I))return!1;if(ri&&!qe[I]){const ae=m(M),ue=S(M);if(ue&&ae){const me=ue.length;for(let Ze=me-1;Ze>=0;--Ze){const tt=M===ee?p(ue[Ze],!0):ue[Ze];ae.insertBefore(tt,b(M))}}}return vr(M),!0},bc=function(M,I,ee,ae){return M.length===0?I:I===ee||I===ae?yn(I):I},wc=function(M,I){return M===I||m(M)!==null?!1:(si&&Vi(M),!0)},ba=function(M,I){if(gn(E.beforeSanitizeElements,M,null),wc(M,I))return!0;if(Xi(M))return vr(M),!0;const ee=Qe(z(M));if(oe=bc(E.uponSanitizeElement,oe,he,Pn),gn(E.uponSanitizeElement,M,{tagName:ee,allowedTags:oe}),wc(M,I))return!0;if(kf(M,ee))return vr(M),!0;if(Ue[ee]||!(yt.tagCheck instanceof Function&&yt.tagCheck(ee))&&!oe[ee]){const ue=va(M,ee,I);return ue===!1&&gn(E.afterSanitizeElements,M,null),ue}if(T(M)===xn.element&&!Sf(M)||(ee==="noscript"||ee==="noembed"||ee==="noframes")&&Zt(VT,M.innerHTML))return vr(M),!0;if(Mt&&M.nodeType===xn.text){const ue=Gi(M.textContent);M.textContent!==ue&&(Aa(t.removed,{element:M.cloneNode()}),M.textContent=ue)}return gn(E.afterSanitizeElements,M,null),!1},ex=function(M,I,ee){if(it[I]||xc(I,M)||ti&&(I==="id"||I==="name")&&(ee in n||ee in vf))return!1;const ae=re[I]||yt.attributeCheck instanceof Function&&yt.attributeCheck(I,M);return Dn&&Zt(F,I)||hn&&Zt(G,I)?!0:ae?Dt[I]||Zt(ce,Ca(ee,le,""))||(I==="src"||I==="xlink:href"||I==="href")&&M!=="script"&&Z0(ee,"data:")===0&&kt[M]||Rr&&!Zt(te,Ca(ee,le,""))?!0:!ee:tx(M)&&Pi(ge.tagNameCheck,M)&&Pi(ge.attributeNameCheck,I,M)||I==="is"&&ge.allowCustomizedBuiltInElements&&Pi(ge.tagNameCheck,ee)},Nk=Ee({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),tx=function(M){return!Nk[Ia(M)]&&Zt(ie,M)},jk=function(M,I,ee,ae){if(A&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!ee)switch(f.getAttributeType(M,I)){case"TrustedHTML":return C(ae);case"TrustedScriptURL":return j(ae)}return ae},Ek=function(M,I,ee,ae){try{ee?M.setAttributeNS(ee,I,ae):M.setAttribute(I,ae),Xi(M)?vr(M):U0(t.removed)}catch{Hr(I,M)}},nx=function(M){gn(E.beforeSanitizeAttributes,M,null);const I=M.attributes;if(!I||Xi(M))return;re=bc(E.uponSanitizeAttribute,re,W,qt);const ee={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:re,forceKeepAttr:void 0};let ae=I.length;const ue=Qe(M.nodeName);for(;ae--;){const me=I[ae],Ze=me.name,tt=me.namespaceURI,Jt=me.value,en=Qe(Ze),jf=Jt;let Gt=Ze==="value"?jf:ET(jf);if(ee.attrName=en,ee.attrValue=Gt,ee.keepAttr=!0,ee.forceKeepAttr=void 0,gn(E.uponSanitizeAttribute,M,ee),Gt=ee.attrValue,Yi&&(en==="id"||en==="name")&&Z0(Gt,ni)!==0&&(Hr(Ze,M,me),Gt=ni+Gt),ut&&Zt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Gt)){Hr(Ze,M,me);continue}if(en==="attributename"&&I0(Gt,"href")){Hr(Ze,M,me);continue}if(!ee.forceKeepAttr){if(!ee.keepAttr){Hr(Ze,M,me);continue}if(!Or&&Zt(GT,Gt)){Hr(Ze,M,me);continue}if(Mt&&(Gt=Gi(Gt)),!ex(ue,en,Gt)){Hr(Ze,M,me);continue}Gt=jk(ue,en,tt,Gt),Gt!==jf&&Ek(M,Ze,tt,Gt)}}gn(E.afterSanitizeAttributes,M,null)},Sc=function(M){let I=null;const ee=vc(M);for(gn(E.beforeSanitizeShadowDOM,M,null);I=ee.nextNode();)if(gn(E.uponSanitizeShadowNode,I,null),ba(I,M),nx(I),Fn(I.content)&&Sc(I.content),T(I)===xn.element){const ae=y(I);Fn(ae)&&(Nf(ae),Sc(ae))}gn(E.afterSanitizeShadowDOM,M,null)},Nf=function(M){const I=[{node:M,shadow:null}];for(;I.length>0;){const ee=I.pop();if(ee.shadow){Sc(ee.shadow);continue}const ae=ee.node,me=T(ae)===xn.element,Ze=S(ae);if(Ze)for(let tt=Ze.length-1;tt>=0;--tt)I.push({node:Ze[tt],shadow:null});if(me){const tt=N?N(ae):null;if(typeof tt=="string"&&Qe(tt)==="template"){const Jt=ae.content;Fn(Jt)&&I.push({node:Jt,shadow:null})}}if(me){const tt=y(ae);Fn(tt)&&I.push({node:null,shadow:tt},{node:tt,shadow:null})}}};return t.sanitize=function(ne){let M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=null,ee=null,ae=null,ue=null;if(It=!ne,It&&(ne="<!-->"),typeof ne!="string"&&!oi(ne)&&(ne=zT(ne),typeof ne!="string"))throw li("dirty is not a string, aborting");if(!t.isSupported)return ne;Xn?(oe=Pn,re=qt):xa(M),(E.uponSanitizeElement.length>0||E.uponSanitizeAttribute.length>0)&&(oe=yn(oe)),E.uponSanitizeAttribute.length>0&&(re=yn(re)),t.removed=[];const me=si&&typeof ne!="string"&&oi(ne);if(me){_f(ne);const Jt=z(ne);if(typeof Jt=="string"){const en=Qe(Jt);if(!oe[en]||Ue[en])throw qi(ne),li("root node is forbidden and cannot be sanitized in-place")}if(Xi(ne))throw qi(ne),li("root node is clobbered and cannot be sanitized in-place");try{Nf(ne)}catch(en){throw qi(ne),en}}else if(oi(ne))I=yc("<!---->"),ee=I.ownerDocument.importNode(ne,!0),ee.nodeType===xn.element&&ee.nodeName==="BODY"||ee.nodeName==="HTML"?I=ee:I.appendChild(ee),Nf(ee);else{if(!pr&&!Mt&&!zt&&ne.indexOf("<")===-1)return A&&mr?C(ne):ne;if(I=yc(ne),!I)return pr?null:mr?L:""}I&&ms&&vr(I.firstChild);const Ze=me?ne:I;try{const Jt=vc(Ze);for(;ae=Jt.nextNode();)ba(ae,Ze),nx(ae),Fn(ae.content)&&Sc(ae.content)}catch(Jt){throw me&&(qi(ne),pi(t.removed,en=>{en.element&&Vi(en.element)})),Jt}if(me)return pi(t.removed,Jt=>{Jt.element&&Vi(Jt.element)}),Mt&&ya(ne),ne;if(pr){if(Mt&&ya(I),gs)for(ue=X.call(I.ownerDocument);I.firstChild;)ue.appendChild(I.firstChild);else ue=I;return(re.shadowroot||re.shadowrootmode)&&(ue=B.call(r,ue,!0)),ue}let tt=zt?I.outerHTML:I.innerHTML;return zt&&oe["!doctype"]&&I.ownerDocument&&I.ownerDocument.doctype&&I.ownerDocument.doctype.name&&Zt(YT,I.ownerDocument.doctype.name)&&(tt="<!DOCTYPE "+I.ownerDocument.doctype.name+`>
114
+ `+tt),Mt&&(tt=Gi(tt)),A&&mr?C(tt):tt},t.setConfig=function(){let ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xa(ne),Xn=!0,Pn=oe,qt=re},t.clearConfig=function(){xs=null,Xn=!1,Pn=null,qt=null,A=R,L=""},t.isValidAttribute=function(ne,M,I){xs||xa({});const ee=Qe(ne),ae=Qe(M);return ex(ee,ae,I)},t.addHook=function(ne,M){typeof M=="function"&&sn(E,ne)&&Aa(E[ne],M)},t.removeHook=function(ne,M){if(sn(E,ne)){if(M!==void 0){const I=NT(E[ne],M);return I===-1?void 0:jT(E[ne],I,1)[0]}return U0(E[ne])}},t.removeHooks=function(ne){sn(E,ne)&&(E[ne]=[])},t.removeAllHooks=function(){E=W0()},t}var KT=w2();function gg(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m${t%60}s`}function Sn(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function Jn(e){return new Date(e).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function WT(e,t){const n=Math.max(0,Math.floor((t-e)/1e3));if(n<3)return"now";if(n<60)return`${n}s ago`;const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function S2(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 r=n[0],s=n[1],i=typeof s=="object"?JSON.stringify(s,null,2):String(s);return`${r}: ${i}`}return t.map(([n,r])=>{const s=typeof r=="object"?JSON.stringify(r,null,2):String(r);return`${n}: ${s}`}).join(`
115
+ `)}function _2(e,t){if(!t)return"";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(([r,s])=>`${r}: ${String(s).slice(0,60)}`).join(", ")}function JT({report:e,fallbackTokens:t,windowTokens:n}){const r=(e==null?void 0:e.usedTokens)??t,s=(e==null?void 0:e.windowTokens)||n,i=Math.max(1,s-((e==null?void 0:e.reservedOutput)??0)),o=Math.min(100,Math.round(r/i*100)),a=o>=85?"var(--red)":o>=50?"var(--yellow)":"var(--green)";return l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[10px] text-muted font-mono",title:`Context: ${Sn(r)} of ${Sn(i)} usable (${Sn(s)} window)`,children:[l.jsx("span",{style:{opacity:.6},children:"ctx"}),l.jsx("span",{className:"inline-block rounded-full overflow-hidden",style:{width:36,height:4,background:"var(--s3)"},children:l.jsx("span",{className:"block h-full rounded-full",style:{width:`${String(o)}%`,background:a}})}),l.jsx("span",{style:{color:a,opacity:.85},children:`${String(o)}%`}),l.jsx("span",{style:{opacity:.5},children:`${Sn(r)}/${Sn(s)}`})]})}function eA({onSend:e,onCancel:t,cmdInput:n,onClearCmdInput:r,totalTokens:s,contextTokens:i,costUsd:o,contextReport:a}){var g;const{providers:c,get:u}=og(),d=u("current_provider"),f=u("model"),h=Number(((g=c.find(v=>v.name===d))==null?void 0:g.model_context_window)??2e5),p=c.find(v=>v.name===d&&v.configured)||c.find(v=>v.configured)||{name:"none"},[x,b]=w.useState(""),S=w.useRef(null);w.useEffect(()=>{n&&(b(n),setTimeout(()=>{S.current&&(S.current.focus(),S.current.selectionStart=S.current.selectionEnd=n.length)},50),r==null||r())},[n,r]);const m=w.useCallback(()=>{const v=S.current;v&&(v.style.height="",v.style.height=Math.min(v.scrollHeight,160)+"px")},[]),y=w.useCallback(v=>{if(v.key==="Enter"&&!v.shiftKey){v.preventDefault();const N=x.trim();if(!N)return;e(N),b(""),setTimeout(()=>{S.current&&(S.current.style.height="")},0)}},[x,e]);return l.jsx("div",{className:"px-5 pt-3 pb-7 md:pb-3 bg-transparent",children:l.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:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-[10.5px]",children:[l.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0",style:{background:d?"var(--green)":"var(--muted2)",opacity:d?1:.3}}),l.jsx("span",{style:{color:"var(--gold)",opacity:.8},children:p.name}),l.jsx("span",{className:"text-muted",children:" · "}),l.jsx("span",{className:"text-muted",children:f||"no model set"})]}),l.jsx("textarea",{ref:S,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:x,onChange:v=>{b(v.target.value),m()},onKeyDown:y}),l.jsxs("div",{className:"flex items-center px-3 pb-2.5 pt-1",children:[s!==void 0?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"text-[10px] text-muted font-mono",style:{opacity:.6},children:[Sn(s)," tokens"]}),l.jsx("span",{className:"opacity-30 mx-1",children:" · "}),l.jsx(JT,{report:a,fallbackTokens:i??0,windowTokens:h}),l.jsx("span",{className:"opacity-30 mx-1",children:" · "}),l.jsxs("span",{className:"text-[10px] text-muted font-mono",style:{color:"var(--green)",opacity:.6},children:["$",(o??0).toFixed(4)]}),l.jsx("div",{className:"flex-1"})]}):null,t?l.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:l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:l.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})})}):l.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 v=x.trim();v&&(e(v),b(""))},children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#1a1410",strokeWidth:"2.5",children:[l.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),l.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]})})}const tA=["line","area","bar","stacked-bar","scatter"];function nA(e){if(!e||typeof e!="object")return!1;const t=e;if(typeof t.type!="string"||!tA.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 r=n;if(typeof r.name!="string"||!Array.isArray(r.points)||r.points.length===0)return!1;for(const s of r.points){if(!s||typeof s!="object")return!1;const i=s;if(typeof i.x!="string"&&typeof i.x!="number"||typeof i.y!="number"||!Number.isFinite(i.y))return!1}}return!0}const J0=["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 an(e){return J0[e%J0.length]}function rA({spec:e,renderChart:t,renderTable:n,height:r=220}){const s=w.useRef(null),[i,o]=w.useState(0),[a,c]=w.useState(!1);w.useEffect(()=>{const d=s.current;if(!d)return;const f=new ResizeObserver(h=>{var x;const p=(x=h[0])==null?void 0:x.contentRect.width;p&&o(Math.max(240,Math.floor(p)))});return f.observe(d),()=>f.disconnect()},[]);const u=e.series.length>1;return l.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:l.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:[l.jsxs("div",{className:"flex items-start justify-between gap-3 mb-1.5",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[13px] font-display font-semibold truncate",style:{color:"var(--chart-ink)"},children:e.title}),e.subtitle&&l.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--chart-ink-muted)"},children:e.subtitle})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.normalize&&l.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"}),l.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:a?"Chart":"Table"})]})]}),u&&l.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1 mb-2",children:e.series.map((d,f)=>l.jsxs("div",{className:"flex items-center gap-1.5 text-[10.5px]",style:{color:"var(--chart-ink-muted)"},children:[l.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full shrink-0",style:{background:an(f)}}),d.name]},d.name))}),l.jsx("div",{ref:s,className:"w-full",style:{minHeight:r},children:a?n():i>0?t(i,r):null}),e.note&&l.jsx("div",{className:"mt-2 text-[10.5px] italic",style:{color:"var(--chart-ink-muted)"},children:e.note})]})})}function sA(e,t,n=.3){const[r,s]=t,i=s-r,o=e>0?i/e:i,a=Math.max(1,o*(1-n));return{step:o,bandWidth:a,center:c=>r+o*c+o/2,start:c=>r+o*c+(o-a)/2}}function ey(e,t){const n=e||1,r=Math.floor(Math.log10(n)),s=n/Math.pow(10,r);let i;return t?s<1.5?i=1:s<3?i=2:s<7?i=5:i=10:s<=1?i=1:s<=2?i=2:s<=5?i=5:i=10,i*Math.pow(10,r)}function ad(e,t,n=5){let r=e,s=t;if(r===s){const d=Math.abs(r)*.1||1;r-=d,s+=d}const i=ey(s-r,!1),o=ey(i/Math.max(1,n-1),!0),a=Math.floor(r/o)*o,c=Math.ceil(s/o)*o,u=[];for(let d=a;d<=c+o*.5;d+=o)u.push(Math.round(d*1e10)/1e10);return u}function iA(e){var r;if(e.length===0)return 1;const t=Math.max(...e.map(s=>s.points.length));let n=0;for(let s=0;s<t;s++){let i=0;for(const o of e)i+=((r=o.points[s])==null?void 0:r.y)??0;i>n&&(n=i)}return n||1}function oA(e){return e.map(t=>{var r;const n=(r=t.points[0])==null?void 0:r.y;return n?{...t,points:t.points.map(s=>({x:s.x,y:s.y/n*100}))}:t})}function k2(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 aA(e){return Math.abs(e)>=1e3?`$${k2(e)}`:`$${e.toLocaleString(void 0,{maximumFractionDigits:2})}`}function lA(e){const t=["B","KB","MB","GB","TB"];let n=Math.abs(e),r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${e<0?"-":""}${n.toFixed(n<10&&r>0?1:0)} ${t[r]}`}function ns(e,t){switch(t){case"compact":return k2(e);case"currency":return aA(e);case"percent":return`${(e*100).toFixed(1)}%`;case"bytes":return lA(e);case"number":default:return e.toLocaleString()}}function xg({data:e,chartWidth:t}){if(!e)return null;const n=e.x>t*.6;return l.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:[l.jsx("div",{className:"font-semibold mb-1",style:{color:"var(--chart-ink-muted)"},children:e.label}),e.rows.map((r,s)=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"inline-block w-2 h-2 rounded-full shrink-0",style:{background:r.color}}),l.jsxs("span",{children:[r.name,":"]}),l.jsx("span",{className:"font-semibold ml-auto pl-2",style:{color:"var(--chart-ink)"},children:r.value})]},s))]})}function cA({spec:e,width:t,height:n}){var Y;const[r,s]=w.useState(null),i=e.type==="area",o=44,a=12,c=12,u=24,d=Math.max(10,t-o-a),f=Math.max(10,n-c-u),h=e.normalize?oA(e.series):e.series,p=((Y=h[0])==null?void 0:Y.points)??[],x=p.length,b=h.flatMap(_=>_.points.map(C=>C.y)),S=ad(Math.min(0,...b),Math.max(...b,1),5),m=S[0],g=S[S.length-1]-m||1,v=_=>x>1?o+_/(x-1)*d:o+d/2,N=_=>c+f-(_-m)/g*f,k=h.map(_=>_.points.map((C,j)=>`${j===0?"M":"L"} ${v(j)} ${N(C.y)}`).join(" ")),T=i?h.map((_,C)=>{const j=k[C],D=v(_.points.length-1),O=v(0);return`${j} L ${D} ${c+f} L ${O} ${c+f} Z`}):[],z=e.series.length>1&&e.series.length<=4,A=_=>{const C=_.currentTarget.getBoundingClientRect(),j=_.clientX-C.left,D=x>1?Math.round((j-o)/d*(x-1)):0;s(Math.min(x-1,Math.max(0,D)))},L=r!==null&&p[r]?{x:v(r),y:N(Math.max(...h.map(_=>{var C;return((C=_.points[r])==null?void 0:C.y)??m}))),label:String(p[r].x),rows:e.series.map((_,C)=>{var O,$,U;const j=(O=_.points[r])==null?void 0:O.y;if(j===void 0)return{name:_.name,value:"—",color:an(C)};if(!e.normalize)return{name:_.name,value:ns(j,e.y_format),color:an(C)};const D=((U=($=h[C])==null?void 0:$.points[r])==null?void 0:U.y)??0;return{name:_.name,value:`${ns(j,e.y_format)} (${D.toFixed(1)})`,color:an(C)}})}:null,R=Math.floor((x-1)/2),H=x>0?Array.from(new Set([0,R,x-1])):[];return l.jsxs("div",{className:"relative",style:{width:"100%",height:n},children:[l.jsxs("svg",{width:t,height:n,className:"overflow-visible",children:[l.jsx("defs",{children:e.series.map((_,C)=>l.jsxs("linearGradient",{id:`chart-grad-${C}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[l.jsx("stop",{offset:"0%",stopColor:an(C),stopOpacity:"0.22"}),l.jsx("stop",{offset:"100%",stopColor:an(C),stopOpacity:"0"})]},C))}),S.map((_,C)=>{const j=N(_);return l.jsxs("g",{children:[l.jsx("line",{x1:o,y1:j,x2:t-a,y2:j,stroke:"var(--chart-grid)",strokeWidth:"1"}),l.jsx("text",{x:o-8,y:j+3.5,textAnchor:"end",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace"},children:e.normalize?_.toFixed(0):ns(_,e.y_format)})]},C)}),l.jsx("line",{x1:o,y1:c+f,x2:t-a,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1"}),H.map(_=>{var C;return l.jsx("text",{x:v(_),y:n-6,textAnchor:_===0?"start":_===x-1?"end":"middle",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace",opacity:.7},children:String(((C=p[_])==null?void 0:C.x)??"")},_)}),i&&T.map((_,C)=>l.jsx("path",{d:_,fill:`url(#chart-grad-${C})`},`area-${C}`)),k.map((_,C)=>l.jsx("path",{d:_,fill:"none",stroke:an(C),strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},`line-${C}`)),h.map((_,C)=>{const j=_.points[_.points.length-1];if(!j)return null;const D=v(_.points.length-1),O=N(j.y),$=Math.min(D+6,t-a-4),U=$>t-a-34;return l.jsxs("g",{children:[l.jsx("circle",{cx:D,cy:O,r:"3",fill:an(C),stroke:"var(--s1)",strokeWidth:"1.5"}),z&&l.jsx("text",{x:U?t-a:$,y:O+3,textAnchor:U?"end":"start",style:{fill:"var(--chart-ink)",fontSize:9.5,fontWeight:600,fontFamily:"inherit"},children:_.name})]},`endpoint-${C}`)}),L&&l.jsx("line",{x1:L.x,y1:c,x2:L.x,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1",strokeOpacity:"0.6"}),l.jsx("rect",{x:o,y:c,width:d,height:f,fill:"transparent",onMouseMove:A,onMouseLeave:()=>s(null),style:{cursor:"crosshair"}})]}),l.jsx(xg,{data:L,chartWidth:t})]})}function uA({spec:e,width:t,height:n}){var z;const[r,s]=w.useState(null),i=e.type==="stacked-bar",o=44,a=12,c=12,u=24,d=Math.max(10,t-o-a),f=Math.max(10,n-c-u),h=((z=e.series[0])==null?void 0:z.points)??[],p=h.length,x=i?iA(e.series):Math.max(...e.series.flatMap(A=>A.points.map(L=>L.y)),1),b=ad(0,x,5),S=b[b.length-1],m=A=>c+f-A/(S||1)*f,y=sA(p,[o,o+d],.3),g=2,v=e.series.length,N=i?y.bandWidth:Math.max(2,(y.bandWidth-g*(v-1))/v),k=r!==null&&h[r]?{x:y.center(r),y:c,label:String(h[r].x),rows:e.series.map((A,L)=>{var R;return{name:A.name,value:ns(((R=A.points[r])==null?void 0:R.y)??0,e.y_format),color:an(L)}})}:null,T=Math.floor((p-1)/2);return l.jsxs("div",{className:"relative",style:{width:"100%",height:n},children:[l.jsxs("svg",{width:t,height:n,className:"overflow-visible",children:[b.map((A,L)=>{const R=m(A);return l.jsxs("g",{children:[l.jsx("line",{x1:o,y1:R,x2:t-a,y2:R,stroke:"var(--chart-grid)",strokeWidth:"1"}),l.jsx("text",{x:o-8,y:R+3.5,textAnchor:"end",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace"},children:ns(A,e.y_format)})]},L)}),l.jsx("line",{x1:o,y1:c+f,x2:t-a,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1"}),h.map((A,L)=>p<=1||L===0||L===p-1||L===T?l.jsx("text",{x:y.center(L),y:n-6,textAnchor:"middle",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace",opacity:.7},children:String(A.x)},`label-${L}`):null),h.map((A,L)=>{const R=y.start(L);let H=c+f;return l.jsxs("g",{onMouseEnter:()=>s(L),onMouseLeave:()=>s(null),children:[l.jsx("rect",{x:y.center(L)-y.step/2,y:c,width:y.step,height:f,fill:"transparent"}),e.series.map((Y,_)=>{var $;const C=(($=Y.points[L])==null?void 0:$.y)??0;if(C<=0)return null;const j=C/(S||1)*f;let D,O;return i?(D=R,O=H-j-(_>0?g:0),H=O):(D=R+_*(N+g),O=c+f-j),l.jsx("rect",{x:D,y:O,width:N,height:j,rx:"2",fill:an(_)},_)})]},`group-${L}`)}),k&&l.jsx("line",{x1:k.x,y1:c,x2:k.x,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1",strokeOpacity:"0.4"})]}),l.jsx(xg,{data:k,chartWidth:t})]})}function gh(e,t){if(typeof e=="number")return e;const n=Number(e);return Number.isFinite(n)?n:t}function dA({spec:e,width:t,height:n}){var T,z;const[r,s]=w.useState(null),i=48,o=16,a=14,c=26,u=Math.max(10,t-i-o),d=Math.max(10,n-a-c),f=e.series.flatMap(A=>A.points.map((L,R)=>gh(L.x,R))),h=e.series.flatMap(A=>A.points.map(L=>L.y)),p=ad(Math.min(...f),Math.max(...f),4),x=ad(Math.min(0,...h),Math.max(...h,1),5),b=p[0],S=p[p.length-1],m=x[0],y=x[x.length-1],g=A=>i+(A-b)/(S-b||1)*u,v=A=>a+d-(A-m)/(y-m||1)*d,N=r?(T=e.series[r.si])==null?void 0:T.points[r.pi]:void 0,k=r&&N?{x:g(gh(N.x,r.pi)),y:v(N.y),label:((z=e.series[r.si])==null?void 0:z.name)??"",rows:[{name:e.x_label||"x",value:String(N.x),color:an(r.si)},{name:e.y_label||"y",value:ns(N.y,e.y_format),color:an(r.si)}]}:null;return l.jsxs("div",{className:"relative",style:{width:"100%",height:n},children:[l.jsxs("svg",{width:t,height:n,className:"overflow-visible",children:[x.map((A,L)=>{const R=v(A);return l.jsxs("g",{children:[l.jsx("line",{x1:i,y1:R,x2:t-o,y2:R,stroke:"var(--chart-grid)",strokeWidth:"1"}),l.jsx("text",{x:i-8,y:R+3.5,textAnchor:"end",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace"},children:ns(A,e.y_format)})]},`y-${L}`)}),p.map((A,L)=>l.jsx("text",{x:g(A),y:n-6,textAnchor:"middle",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace",opacity:.7},children:ns(A)},`x-${L}`)),l.jsx("line",{x1:i,y1:a+d,x2:t-o,y2:a+d,stroke:"var(--chart-axis)",strokeWidth:"1"}),l.jsx("line",{x1:i,y1:a,x2:i,y2:a+d,stroke:"var(--chart-axis)",strokeWidth:"1"}),e.series.map((A,L)=>A.points.map((R,H)=>{const Y=g(gh(R.x,H)),_=v(R.y);return l.jsxs("g",{children:[l.jsx("circle",{cx:Y,cy:_,r:"12",fill:"transparent",onMouseEnter:()=>s({si:L,pi:H}),onMouseLeave:()=>s(null),style:{cursor:"pointer"}}),l.jsx("circle",{cx:Y,cy:_,r:"4",fill:an(L),stroke:"var(--s1)",strokeWidth:"1.5"})]},`${L}-${H}`)})),k&&r&&l.jsx("circle",{cx:k.x,cy:k.y,r:"7",fill:"none",stroke:an(r.si),strokeWidth:"1.5"})]}),l.jsx(xg,{data:k,chartWidth:t})]})}function fA({spec:e}){var n;const t=((n=e.series[0])==null?void 0:n.points.map(r=>r.x))??[];return l.jsxs("div",{children:[l.jsx("div",{className:"overflow-x-auto overflow-y-auto max-h-[260px] scrollbar-thin",children:l.jsxs("table",{className:"w-full text-[11.5px] font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{style:{borderBottom:"1px solid var(--b1)"},children:[l.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(r=>l.jsx("th",{className:"text-right py-1.5 pl-3 font-medium",style:{color:"var(--chart-ink-muted)"},children:r.name},r.name))]})}),l.jsx("tbody",{children:t.map((r,s)=>l.jsxs("tr",{style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 40%, transparent)"},children:[l.jsx("td",{className:"py-1 pr-3",style:{color:"var(--chart-ink)",fontVariantNumeric:"tabular-nums"},children:String(r)}),e.series.map(i=>{var o;return l.jsx("td",{className:"text-right py-1 pl-3",style:{color:"var(--chart-ink)",fontVariantNumeric:"tabular-nums"},children:ns(((o=i.points[s])==null?void 0:o.y)??0,e.y_format)},i.name)})]},s))})]})}),e.normalize&&l.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 hA(){return l.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:l.jsxs("div",{className:"rounded-xl p-4 flex items-center gap-2",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:[l.jsx("div",{className:"w-[6px] h-[6px] rounded-full shrink-0 animate-pulse",style:{background:"var(--muted)"}}),l.jsx("div",{className:"text-[11.5px]",style:{color:"var(--muted)"},children:"Rendering chart…"})]})})}function ty({message:e,raw:t}){return l.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:l.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:[l.jsx("div",{className:"text-[12px] font-semibold mb-1.5",style:{color:"var(--red)"},children:"Chart could not be rendered"}),l.jsx("div",{className:"text-[11.5px] mb-2",style:{color:"var(--text)"},children:e}),l.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 pA({spec:e}){const t=(n,r)=>{switch(e.type){case"line":case"area":return l.jsx(cA,{spec:e,width:n,height:r});case"bar":case"stacked-bar":return l.jsx(uA,{spec:e,width:n,height:r});case"scatter":return l.jsx(dA,{spec:e,width:n,height:r});default:return null}};return l.jsx(rA,{spec:e,renderChart:t,renderTable:()=>l.jsx(fA,{spec:e})})}function mA({spec:e,error:t,pending:n,rawInput:r}){return t?l.jsx(ty,{message:t,raw:r??e}):n?l.jsx(hA,{}):nA(e)?l.jsx(pA,{spec:e}):l.jsx(ty,{message:"The chart data did not match the expected format.",raw:r??e})}const ny=["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 ry(){return ny[Math.floor(Math.random()*ny.length)]}function N2({content:e}){const[t,n]=w.useState(!0);return l.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:l.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:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"color-mix(in srgb, var(--s2) 80%, transparent)"},children:[l.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:[l.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"}),l.jsx("circle",{cx:"9",cy:"9",r:"1",fill:"currentColor"}),l.jsx("circle",{cx:"15",cy:"9",r:"1",fill:"currentColor"})]}),l.jsx("span",{className:"text-[11.5px] font-medium text-text font-mono",children:t?"Hide thinking":"Show thinking"}),l.jsx("div",{className:"flex-1"}),l.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:l.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),t&&l.jsx("div",{className:"px-3 py-2.5",style:{borderTop:"1px solid var(--b1)",background:"color-mix(in srgb, var(--s1) 60%, transparent)"},children:l.jsx("pre",{className:"text-[11px] text-muted leading-relaxed whitespace-pre-wrap font-mono max-h-[300px] overflow-y-auto",children:e})})]})})}function sy(e){return e>=1e6?`${(e/1e6).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function gA({entry:e}){const[t,n]=w.useState(!1);return l.jsxs("div",{className:"px-3 py-2 animate-fadeIn",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"flex-1 h-px",style:{background:"var(--b1)"}}),l.jsxs("button",{onClick:()=>n(!t),className:"text-[11px] font-mono px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--muted)",background:"var(--s2)",border:"1px solid var(--b1)"},title:"Everything above is preserved on disk; only the model's working history was summarized.",children:[`context compacted · ${String(e.summarizedMessageCount)} message${e.summarizedMessageCount===1?"":"s"} · ${sy(e.tokensBefore)} → ${sy(e.tokensAfter)} tokens`,l.jsx("span",{className:"ml-1.5",style:{opacity:.6},children:t?"▾":"▸"})]}),l.jsx("div",{className:"flex-1 h-px",style:{background:"var(--b1)"}})]}),t&&l.jsx("div",{className:"mt-2 text-[12px] leading-[1.6] rounded-lg px-3 py-2 markdown-body",style:{background:"var(--s1)",border:"1px solid var(--b1)"},dangerouslySetInnerHTML:{__html:Ao(e.summary)}})]})}function j2({toolCalls:e}){const[t,n]=w.useState(!1);return l.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:l.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:[l.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:[l.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:l.jsxs("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",style:{opacity:.7},children:[l.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),l.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),l.jsxs("span",{className:"text-[11.5px] font-medium text-text font-mono",children:[e.length," tool call",e.length>1?"s":""]}),l.jsx("div",{className:"flex-1"}),l.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:l.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),t&&e.map((r,s)=>l.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:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("span",{className:"text-[11.5px] font-semibold font-mono",style:{color:"var(--gold)"},children:r.name}),l.jsx("span",{className:"text-xs text-muted font-mono truncate max-w-[250px]",children:r.args})]}),l.jsx("pre",{className:"text-[11px] text-muted font-mono leading-[1.5] overflow-x-auto whitespace-pre-wrap",children:r.input?S2(r.input):""})]},s))]})})}function xA({event:e}){const[t,n]=w.useState(!1);return l.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:l.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:[l.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:[l.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:l.jsx("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.5",children:l.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"})})}),l.jsxs("span",{className:"text-[11.5px] font-semibold text-fg font-mono",children:["Heartbeat Brief (",e.scheduleType,")"]}),l.jsx("div",{className:"flex-1"}),l.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:l.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),t&&l.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:l.jsx("div",{dangerouslySetInnerHTML:{__html:Ao(e.formattedText||"")}})})]})})}function yA({message:e,time:t}){return l.jsx("div",{className:"px-3 py-1.5 animate-fadeIn",children:l.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:[l.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)"}}),l.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:[l.jsx("span",{className:"absolute inset-0 rounded-lg animate-ping opacity-50",style:{background:"color-mix(in srgb, var(--gold) 20%, transparent)",animationDuration:"2s"}}),l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"animate-wiggle",children:[l.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),l.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]})]}),l.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1 select-none",children:[l.jsx("span",{className:"font-bold text-xs tracking-wide uppercase",style:{color:"var(--gold)"},children:"Reminder Fired"}),l.jsx("span",{className:"text-[10px] text-muted font-mono",children:t})]}),l.jsx("div",{className:"text-[13px] text-text leading-relaxed font-semibold",children:e})]})]})})}function vA(e,t){const n=e.find(r=>r.type==="tool-result"&&r.toolCallId===t);if(n)return{output:n.output,error:n.error}}function bA(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>")}ze.setOptions({gfm:!0,breaks:!0});function wA(e){return KT.sanitize(e,{ALLOWED_TAGS:["p","br","hr","span","div","h1","h2","h3","h4","h5","h6","strong","em","b","i","u","s","del","ins","mark","sub","sup","ul","ol","li","dl","dt","dd","blockquote","code","pre","kbd","samp","var","a","img","table","thead","tbody","tfoot","tr","th","td","caption","input"],ALLOWED_ATTR:["href","title","alt","src","class","lang","colspan","rowspan","start","type","checked","disabled"],ALLOWED_URI_REGEXP:/^(?:https?|mailto):/i,FORBID_ATTR:["style","srcset","formaction","form"]})}function Ao(e){try{return wA(ze.parse(e))}catch{return bA(e)}}function E2({toolCallId:e,name:t,input:n,decision:r,events:s,rpc:i,mode:o}){const[a,c]=w.useState(!1),[u,d]=w.useState(null),f=s.find(b=>b.type==="approval-decision"&&b.toolCallId===e),h=f?f.decision:u,p=r==="ask"&&!h,x=async b=>{if(i){c(!0);try{await i.approvalDecide(e,b),d(b)}catch(S){console.error("Failed to submit tool approval decision:",S)}finally{c(!1)}}};if(!p){const b=h==="allow";return l.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2.5 animate-fadeIn select-none",children:[l.jsx("div",{className:`flex items-center justify-center w-5 h-5 rounded-full ${b?"bg-green-500/10 text-green-500":"bg-red-500/10 text-red-500"} shrink-0`,children:l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:b?l.jsx("polyline",{points:"20 6 9 17 4 12"}):l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),l.jsxs("div",{className:"flex items-baseline gap-1.5 text-xs text-muted",children:[l.jsx("span",{className:"font-semibold text-fg",children:b?"Authorized":"Blocked"}),l.jsx("span",{children:"action:"}),l.jsx("code",{className:"font-mono bg-s3 border border-b1 px-1.5 py-0.5 rounded text-[11px] text-fg",children:t})]})]})}return o==="auto"?null:l.jsx("div",{className:"fixed inset-0 z-[999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 animate-fadeIn",children:l.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:[l.jsxs("div",{className:"flex items-start gap-4 border-b border-b1 pb-4 mb-4",children:[l.jsx("div",{className:"flex items-center justify-center w-10 h-10 rounded-xl bg-yellow-500/10 text-yellow-500 shrink-0",children:l.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:l.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"font-bold text-fg text-base block mb-0.5",children:"Authorization Required"}),l.jsx("span",{className:"text-[12px] text-muted",children:"The agent requires permission to run this action."})]})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("div",{className:"text-[9px] text-muted2 font-mono uppercase tracking-wider mb-1.5 select-none",children:"Action / Tool"}),l.jsx("div",{className:"flex items-center",children:l.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})})]}),l.jsxs("div",{className:"bg-s1 rounded-xl border border-b1 p-4 mb-6 max-h-[220px] overflow-y-auto scrollbar-thin",children:[l.jsx("div",{className:"text-[9px] text-muted2 font-mono uppercase tracking-wider mb-1.5 select-none",children:"Arguments"}),l.jsx("pre",{className:"font-mono text-[11.5px] text-text overflow-x-auto m-0 leading-normal",children:S2(n)})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("button",{onClick:()=>x("allow"),disabled:a,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:[l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Approve Action"]}),l.jsxs("button",{onClick:()=>x("deny"),disabled:a,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:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),"Deny"]})]})]})})}function SA({blocks:e,blockCount:t,response:n,time:r,events:s,rpc:i}){const[o,a]=w.useState(!1);return e&&e.length>0||!!n?l.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:l.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:()=>a(!o),children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"var(--bg)"},children:[l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"2"}),l.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4"}),l.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",transform:"rotate(60 12 12)"}),l.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",transform:"rotate(120 12 12)"})]}),l.jsxs("span",{className:"text-[11.5px] font-medium text-text font-mono",children:[t," agent action",t>1?"s":""]}),n&&l.jsxs("span",{className:"text-[10px] text-muted2 font-mono truncate max-w-[120px]",title:n,children:["“",n.slice(0,60),"...","”"]}),r&&l.jsx("span",{className:"text-[10px] text-muted2 font-mono",children:r}),l.jsx("div",{className:"flex-1"}),l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`text-muted transition-transform duration-200 ${o?"rotate-180":""}`,children:l.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),o&&l.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 l.jsx(N2,{content:u.content},d);if(u.type==="tool-group"){const f=u;return f.toolCalls.length>0?l.jsx(j2,{toolCalls:f.toolCalls},d):null}return u.type==="approval-request"?l.jsx(E2,{toolCallId:u.toolCallId,name:u.name,input:u.input,decision:u.decision,events:s||[],rpc:i||null,mode:u.mode},d):null}),n&&l.jsxs("div",{className:"mt-3",children:[l.jsx("div",{className:"flex items-baseline gap-2 mb-1",children:l.jsx("span",{className:"text-[10px] font-semibold text-fg",style:{color:"var(--gold)"},children:"curie-agent"})}),l.jsx("div",{className:"text-[13px] text-text leading-[1.65] markdown-body chat-msg-agent pl-3",dangerouslySetInnerHTML:{__html:Ao(n)}})]})]})]})}):null}function _A(e){switch(e.type){case"user-prompt":return{type:"user",content:e.text||"",time:Jn(e.timestamp)};case"assistant-delta":return{type:"assistant",content:e.text||"",time:Jn(e.timestamp)};case"thinking-delta":return{type:"thinking",content:e.text||"",time:Jn(e.timestamp)};case"heartbeat-brief":return{type:"heartbeat-brief",content:e.formattedText||"",time:Jn(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:Jn(e.timestamp)};const r=_2(t,n);return{type:"tool-group",content:"",time:"",toolCalls:[{name:t,args:r,input:n}]}}case"approval-request":{const t=e.toolCallId,n=e.name||"tool";if(n==="Chart")return null;const r=e.input||{},s=e.decision,i=e.mode;return{type:"approval-request",toolCallId:t,name:n,input:r,decision:s,mode:i,time:Jn(e.timestamp)}}case"cron-task-fired":{const t=e.message||"",n=e.taskId||"";return{type:"reminder-fired",message:t,taskId:n,time:Jn(e.timestamp)}}case"context-warning":return{type:"context-warning",content:e.message||"",time:Jn(e.timestamp)};case"compaction":return{type:"compaction",summary:e.summary||"",summarizedMessageCount:Number(e.summarizedMessageCount??0),tokensBefore:Number(e.tokensBefore??0),tokensAfter:Number(e.tokensAfter??0),time:Jn(e.timestamp)};case"error":return{type:"error",content:e.message||`An error occurred (code: ${e.code||"unknown"})`,time:Jn(e.timestamp)};default:return null}}function kA(e){const t=[];let n=[],r="",s=!1,i="",o=null,a=0;const c=()=>{s&&i&&(n.push({type:"thinking",content:i,time:""}),s=!1,i="")},u=()=>{var h;if(n.length===0)return;let f=0;for(let p=a;p<n.length;p++){const x=n[p];x.type==="tool-group"?f+=((h=x.toolCalls)==null?void 0:h.length)||1:f+=1}o?(o.blocks=[...o.blocks,...n.slice(a)],o.blockCount+=f):(o={type:"agent-actions",blocks:[...n],blockCount:f,response:void 0,time:n[0].time||""},t.push(o)),a=n.length},d=()=>{c(),u(),r&&t.push({type:"assistant",content:r,time:""}),n=[],r="",o=null,a=0};for(const f of e){const h=_A(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")r+=h.content;else if(h.type==="thinking")s=!0,i+=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 NA({cmdResult:e,rpc:t,className:n,activeSessionId:r,onCreateSession:s,onClearCmdResult:i,events:o,addLiveEvent:a,totalTokens:c,contextTokens:u,costUsd:d,contextReport:f,onSwitchView:h}){const{ws:p,connected:x,connectionStatus:b}=fr(),[S,m]=w.useState(!1),[y,g]=w.useState(null),[v,N]=w.useState(""),k=w.useRef(null),T=w.useRef(null),[z,A]=w.useState(ry);w.useEffect(()=>{T.current&&!r&&A(ry()),T.current=r},[r]),w.useEffect(()=>{if(b==="connected")g(null);else if(b==="reconnecting")g(null);else{const C=setTimeout(()=>{g("Disconnected from daemon. Check that the daemon is running.")},2e3);return()=>clearTimeout(C)}},[x,b]);const L=w.useMemo(()=>kA(o),[o]),R=w.useRef(!0),H=w.useCallback(()=>{k.current&&(k.current.scrollTop=k.current.scrollHeight,R.current=!0)},[]);w.useEffect(()=>{const C=k.current;if(!C)return;const j=()=>{const D=C.scrollHeight-C.scrollTop-C.clientHeight<80;R.current=D};return C.addEventListener("scroll",j,{passive:!0}),()=>C.removeEventListener("scroll",j)},[]),w.useEffect(()=>{R.current&&H()},[L,S,H]),w.useEffect(()=>{H()},[H]),w.useEffect(()=>{e&&(console.log("Command palette result:",e),N(e),i==null||i())},[e,i]);const Y=w.useCallback(async C=>{var D,O;if(!t){g("Not connected to daemon. Make sure the daemon is running.");return}if(m(!0),g(null),H(),C.startsWith("/")){const $=C.match(/^\/([^\s]+)(?:\s+(.*))?$/);if($){const U=$[1].toLowerCase(),X=($[2]||"").trim();if(U==="heartbeat"){a({type:"user-prompt",id:`local-prompt-${Date.now()}`,timestamp:Date.now(),text:C});const Z=X.toLowerCase();if(Z==="now"){a({type:"assistant-delta",id:`local-running-${Date.now()}`,timestamp:Date.now(),text:"Executing immediate heartbeat cycle in background..."});try{await t.heartbeatRun(),m(!1)}catch(B){const E=B instanceof Error?B.message:String(B);a({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Heartbeat failed: ${E}`}),m(!1)}}else if(Z==="status"||Z==="")try{const B=await t.heartbeatStatus(),E=(B==null?void 0:B.schedule)==="on",q=(B==null?void 0:B.intraday)||"(not set)",V=`### Heartbeat Cycle Status:
116
+ * **Enabled**: \`${E?"yes":"no"}\`
117
+ * **Intraday**: \`${q}\`
118
+ * **Daily**: \`${(B==null?void 0:B.daily)||"6:00"}\`
119
+ * **Weekly**: \`${(B==null?void 0:B.weekly)||"monday@6:00"}\`
120
+ * **Monthly**: \`${(B==null?void 0:B.monthly)||"1@6:00"}\`
121
+ * **Dreaming**: \`${(B==null?void 0:B.dreaming)||"2:00"}\`
122
+
123
+ **Usage**:
124
+ * \`/heartbeat enable\` / \`/heartbeat disable\`
125
+ * \`/heartbeat daily <H:MM>\`
126
+ * \`/heartbeat weekly <day@H:MM>\`
127
+ * \`/heartbeat monthly <D@H:MM>\`
128
+ * \`/heartbeat dreaming <H:MM>\`
129
+ * \`/heartbeat intraday <H:MM,...>\`
130
+ * \`/heartbeat now\` — run a heartbeat immediately.`;a({type:"assistant-delta",id:`local-status-${Date.now()}`,timestamp:Date.now(),text:V}),m(!1)}catch(B){const E=B instanceof Error?B.message:String(B);a({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to fetch heartbeat status: ${E}`}),m(!1)}else if(Z==="enable")try{await t.configSet("heartbeat.schedule","on"),a({type:"assistant-delta",id:`local-enable-${Date.now()}`,timestamp:Date.now(),text:"Heartbeat cycle has been enabled successfully."}),m(!1)}catch(B){const E=B instanceof Error?B.message:String(B);a({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to enable heartbeat: ${E}`}),m(!1)}else if(Z==="disable")try{await t.configSet("heartbeat.schedule","off"),a({type:"assistant-delta",id:`local-disable-${Date.now()}`,timestamp:Date.now(),text:"Heartbeat cycle has been disabled."}),m(!1)}catch(B){const E=B instanceof Error?B.message:String(B);a({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to disable heartbeat: ${E}`}),m(!1)}else{const B=X.split(/\s+/),E=(D=B[0])==null?void 0:D.toLowerCase(),q=B.slice(1).join(" ").trim();if(["daily","weekly","monthly","dreaming","intraday"].includes(E))try{await t.configSet(`heartbeat.${E}`,q),a({type:"assistant-delta",id:`local-set-${Date.now()}`,timestamp:Date.now(),text:`Heartbeat schedule for \`${E}\` has been set to: \`${q}\``}),m(!1)}catch(J){const F=J instanceof Error?J.message:String(J);a({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to set heartbeat schedule: ${F}`}),m(!1)}else a({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`."}),m(!1)}return}else if(U==="cron"){a({type:"user-prompt",id:`local-prompt-${Date.now()}`,timestamp:Date.now(),text:C});const B=X.toLowerCase().split(/\s+/),E=B[0]||"list",q=B.slice(1).join(" ").trim();if(E==="list"||!E)try{const V=await t.cronList();if(!V||V.length===0)a({type:"assistant-delta",id:`local-cron-list-${Date.now()}`,timestamp:Date.now(),text:"No reminders scheduled."});else{const J=V.map((F,G)=>{const te=new Date(F.scheduledAt).toLocaleString(),le=F.status==="pending"?"⏳":F.status==="fired"?"🔔":F.status==="executing"?"⚙️":F.status==="completed"?"✅":(F.status==="failed","❌"),ie=F.type==="heartbeat"?`Heartbeat: ${F.schedule?`[${F.schedule.type.toUpperCase()}] `:""}`:F.type==="task"?"Task: ":"Reminder: ";return`${G+1}. ${le} ${ie}${F.message} (Scheduled: ${te}, ID: \`${F.id}\`)`}).join(`
131
+ `);a({type:"assistant-delta",id:`local-cron-list-${Date.now()}`,timestamp:Date.now(),text:`### Active Reminders:
132
+ ${J}`})}m(!1)}catch(V){const J=V instanceof Error?V.message:String(V);a({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to fetch reminders: ${J}`}),m(!1)}else if(E==="delete"||E==="cancel")if(!q)a({type:"assistant-delta",id:`local-cron-del-${Date.now()}`,timestamp:Date.now(),text:"Usage: `/cron delete <id>`"}),m(!1);else try{const V=await t.cronCancel(q);V!=null&&V.cancelled?a({type:"assistant-delta",id:`local-cron-del-${Date.now()}`,timestamp:Date.now(),text:`Reminder \`${q}\` cancelled.`}):a({type:"assistant-delta",id:`local-cron-del-${Date.now()}`,timestamp:Date.now(),text:`No reminder found with ID: \`${q}\``}),m(!1)}catch(V){const J=V instanceof Error?V.message:String(V);a({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to delete reminder: ${J}`}),m(!1)}else if(E==="clear")try{const V=await t.cronClear();a({type:"assistant-delta",id:`local-cron-clear-${Date.now()}`,timestamp:Date.now(),text:`Successfully cleared ${(V==null?void 0:V.removed)||0} completed reminder(s).`}),m(!1)}catch(V){const J=V instanceof Error?V.message:String(V);a({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to clear reminders: ${J}`}),m(!1)}else a({type:"assistant-delta",id:`local-cron-err-${Date.now()}`,timestamp:Date.now(),text:"Unknown cron subcommand. Supported: `/cron list`, `/cron delete <id>`, `/cron clear`."}),m(!1);return}if(U==="wiki"){a({type:"user-prompt",id:`local-prompt-${Date.now()}`,timestamp:Date.now(),text:C});const Z=((O=X.split(/\s+/)[0])==null?void 0:O.toLowerCase())??"",B=X.slice(Z.length).trim();if(!Z||Z==="open")h==null||h("wiki"),m(!1);else if(Z==="list")try{const E=await t.wikiListPages(),q=(E==null?void 0:E.pages)??[];if(q.length===0)a({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:"Wiki is empty. Initialize with: `curie-agent wiki init`"});else{const V={};for(const F of q){const G=F.category||"other";(V[G]??(V[G]=[])).push(`${F.slug} — ${F.title}`)}const J=Object.entries(V).flatMap(([F,G])=>[`**${F}** (${G.length})`,...G.map(te=>` ${te}`)]);a({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`### Wiki Pages (${q.length} total)
133
+
134
+ ${J.join(`
135
+ `)}`})}m(!1)}catch(E){a({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Wiki list failed: ${E instanceof Error?E.message:String(E)}`}),m(!1)}else if(Z==="search")if(!B)a({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:"Usage: `/wiki search <query>`"}),m(!1);else try{const q=await t.wikiSearch(B)??[];if(q.length===0)a({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`No wiki results for "${B}"`});else{const V=q.slice(0,20).map(J=>` **${J.slug}**: ${J.line}`);a({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`### Wiki Search: "${B}" (${q.length} hits)
136
+
137
+ ${V.join(`
138
+ `)}`})}m(!1)}catch(E){a({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Wiki search failed: ${E instanceof Error?E.message:String(E)}`}),m(!1)}else if(Z==="lint")try{const E=await t.wikiLint(),q=(E==null?void 0:E.issues)??[];if(q.length===0)a({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:"Wiki is healthy — no issues found."});else{const V=q.map(J=>`- **[${J.type}]** ${J.slug?`\`${J.slug}\`: `:""}${J.message}`);a({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`### Wiki Lint (${q.length} issues)
139
+
140
+ ${V.join(`
141
+ `)}`})}m(!1)}catch(E){a({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Wiki lint failed: ${E instanceof Error?E.message:String(E)}`}),m(!1)}else a({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"}),m(!1);return}}}const j=r||"";try{const $=await t.sessionSend(j,C,"webui");$!=null&&$.sessionId&&!r&&(p==null||p.subscribe($.sessionId),s==null||s($.sessionId))}catch($){const U=$ instanceof Error?$.message:String($);g(`Failed to send: ${U}`),m(!1)}},[t,p,r,H,s,a]);w.useEffect(()=>{p&&(p.on("assistant-stop",()=>m(!1)),p.on("error",()=>m(!1)))},[p]);const _=w.useCallback(async()=>{if(!(!t||!r)){m(!1),g(null),H();try{await t.sessionCancel(r)}catch(C){const j=C instanceof Error?C.message:String(C);g(`Failed to cancel: ${j}`)}}},[t,r,H]);return l.jsxs("div",{className:`flex flex-col h-full ${n||""}`,children:[l.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-thin",ref:k,children:[L.length===0&&l.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted",children:[l.jsx("div",{className:"text-lg mb-2 font-display",style:{color:"var(--cream)"},children:"curie"}),l.jsx("div",{className:"text-sm text-muted",children:z})]}),l.jsxs("div",{className:"py-4 pb-6",children:[L.map((C,j)=>{if(C.type==="thinking")return l.jsx(N2,{content:C.content},`thinking-${j}`);if(C.type==="user")return l.jsx("div",{className:"flex flex-row-reverse px-3 py-0.5 animate-fadeIn transition-colors duration-100",children:l.jsxs("div",{className:"flex flex-1 flex-col items-end min-w-0",children:[l.jsxs("div",{className:"flex flex-row-reverse items-baseline gap-2 mb-1",children:[l.jsx("span",{className:"text-xs font-semibold",style:{color:"var(--cream)"},children:"you"}),l.jsx("span",{className:"text-xs text-muted font-mono",children:C.time})]}),l.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:Ao(C.content)}})]})},j);if(C.type==="tool-group"){const D=C;if(D.toolCalls.length>0)return l.jsx(j2,{toolCalls:D.toolCalls},j)}if(C.type==="agent-actions"){const D=C;return l.jsx(SA,{blocks:D.blocks,blockCount:D.blockCount,time:D.time,events:o,rpc:t},`agent-${D.time||j}`)}if(C.type==="approval-request")return l.jsx(E2,{toolCallId:C.toolCallId,name:C.name,input:C.input,decision:C.decision,events:o,rpc:t,mode:C.mode},j);if(C.type==="heartbeat-brief"){const D=C;return l.jsx(xA,{event:D.event},j)}if(C.type==="reminder-fired")return l.jsx(yA,{message:C.message,time:C.time},j);if(C.type==="chart"){const D=vA(o,C.toolCallId);return l.jsx(mA,{spec:D==null?void 0:D.output,error:D==null?void 0:D.error,pending:!D,rawInput:C.rawInput},j)}return C.type==="error"?l.jsxs("div",{className:"px-3 py-0.5 animate-fadeIn transition-colors duration-100",children:[l.jsxs("div",{className:"flex items-baseline gap-2 mb-1",children:[l.jsx("span",{className:"text-xs font-semibold",style:{color:"var(--red)"},children:"error"}),l.jsx("span",{className:"text-xs text-muted font-mono",children:C.time})]}),l.jsx("div",{className:"text-[13px] text-red leading-[1.65] rounded-lg px-3 py-2 bg-red/5 border border-red/10",children:C.content})]},j):C.type==="context-warning"?l.jsx("div",{className:"px-3 py-0.5 animate-fadeIn",children:l.jsx("div",{className:"text-[12px] leading-[1.6] rounded-lg px-3 py-2 markdown-body",style:{background:"color-mix(in srgb, var(--yellow) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--yellow) 25%, transparent)"},dangerouslySetInnerHTML:{__html:Ao(C.content)}})},j):C.type==="compaction"?l.jsx(gA,{entry:C},j):l.jsxs("div",{className:"px-3 py-0.5 animate-fadeIn transition-colors duration-100",children:[l.jsxs("div",{className:"flex items-baseline gap-2 mb-1",children:[l.jsx("span",{className:"text-xs font-semibold",style:{color:"var(--gold)"},children:"curie-agent"}),l.jsx("span",{className:"text-xs text-muted font-mono",children:C.time})]}),l.jsx("div",{className:"text-[13px] text-text leading-[1.65] markdown-body chat-msg-agent pl-3",dangerouslySetInnerHTML:{__html:Ao(C.content)}})]},j)}),S&&l.jsx("div",{className:"flex items-center px-3 py-2",children:l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx("span",{className:"w-[5px] h-[5px] bg-muted2 rounded-full animate-dot inline-block",style:{animation:"tdot 1.4s infinite"}}),l.jsx("span",{className:"w-[5px] h-[5px] bg-muted2 rounded-full animate-dot inline-block",style:{animation:"tdot 1.4s infinite 0.2s"}}),l.jsx("span",{className:"w-[5px] h-[5px] bg-muted2 rounded-full animate-dot inline-block",style:{animation:"tdot 1.4s infinite 0.4s"}})]})})]})]}),l.jsxs("div",{className:"flex-shrink-0",children:[y&&l.jsx("div",{className:"px-3 py-1.5 bg-red/10 border-t border-red/20",children:l.jsx("div",{className:"text-[11px] text-red font-mono",children:y})}),l.jsx(eA,{onSend:Y,onCancel:S?_:void 0,cmdInput:v,onClearCmdInput:()=>N(""),totalTokens:c,contextTokens:u,costUsd:d,contextReport:f})]})]})}const iy={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}},jA="sonnet";function T2(e,t,n,r){if(r){const[a,c]=r.split(";"),u=parseFloat(a||"0"),d=parseFloat(c||"0");if(!isNaN(u)&&!isNaN(d))return(t*u+n*d)/1e6}const s=e.toLowerCase(),i=Object.keys(iy).find(a=>s.includes(a))??jA,o=iy[i];return(t*o.in+n*o.out)/1e6}function EA({cmdResult:e,onClearCmdResult:t,rpc:n,className:r,activeSessionId:s,onCreateSession:i,events:o,addLiveEvent:a,onSwitchView:c,contextReport:u}){var g;const{get:d,providers:f}=og(),h=d("model"),p=d("current_provider")||"anthropic",x=(g=f.find(v=>v.name===p))==null?void 0:g.model_cost;let b=0,S=0,m=0;const y=s?o.filter(v=>v.type==="usage"):[];if(y.length>0){b=y.reduce((N,k)=>N+(k.inputTokens||0)+(k.outputTokens||0),0);const v=y[y.length-1];S=v&&v.inputTokens||0,m=y.reduce((N,k)=>N+T2(h||"sonnet",k.inputTokens||0,k.outputTokens||0,x),0)}return l.jsx("div",{className:`flex flex-col h-full ${r||""}`,children:l.jsx(NA,{cmdResult:e,onClearCmdResult:t,rpc:n,activeSessionId:s,onCreateSession:i,events:o,addLiveEvent:a,totalTokens:b,contextTokens:S,costUsd:m,contextReport:u,onSwitchView:c})})}function TA({rpc:e,className:t}){const[n,r]=w.useState(null),[s,i]=w.useState(null),[o,a]=w.useState(null),[c,u]=w.useState(!0);w.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])=>{r(f),i(h),a(p)}).finally(()=>u(!1))},[e]);const d=!!n&&!!s;return l.jsxs("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin ${t||""}`,children:[l.jsxs("div",{className:"flex items-center justify-between mb-5",children:[l.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight",children:"Channels"}),l.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:[l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[l.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),l.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Connect"]})]}),c?l.jsx("div",{className:"flex items-center justify-center py-10 text-muted",children:"Loading..."}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg mb-0.5 bg-s2",children:[l.jsx("div",{className:"w-8 h-8 rounded-lg bg-s3 flex items-center justify-center shrink-0 text-base",children:d?"📱":"🔌"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-fg",children:d?"Telegram Connected":"Not Connected"}),l.jsx("div",{className:"text-xs text-muted truncate",children:d?`Bot configured for user ${s}`:"Configure a Telegram bot to enable channel messaging"})]}),l.jsx("div",{className:`w-[6px] h-[6px] rounded-full shrink-0 ${d?"bg-green":"bg-muted2"}`})]}),d&&l.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] overflow-hidden mt-3",children:[l.jsx("div",{className:"text-[12px] font-medium text-text2 px-4 py-3 border-b border-b1",children:"Channel Configuration"}),l.jsx(xh,{label:"Bot Token",value:(n==null?void 0:n.slice(0,12))+"..."||""}),l.jsx(xh,{label:"User ID",value:s||""}),l.jsx(xh,{label:"Chat ID",value:o||"not set"})]})]})]})}function xh({label:e,value:t}){return l.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-b1/50",children:[l.jsx("span",{className:"text-xs text-muted",children:e}),l.jsx("span",{className:"text-xs text-text font-mono",children:t})]})}function AA({rpc:e,className:t}){const{ws:n}=fr(),[r,s]=w.useState(null),[i,o]=w.useState([]),[a,c]=w.useState(!0),[u,d]=w.useState(null),[f,h]=w.useState(null),p=w.useRef(null),x=w.useCallback(async()=>{if(e)try{const[E,q]=await Promise.all([e.sessionStats(),e.sessionList()]);E&&s(E),Array.isArray(q)&&o(q)}catch(E){console.error("[StatsView] Failed to load statistics:",E)}},[e]);if(w.useEffect(()=>{c(!0),x().finally(()=>c(!1))},[x]),w.useEffect(()=>{if(!n)return;const E=()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(x,2e3)},q=n.on("session-stop",E),V=n.on("session-start",E);return()=>{q(),V(),p.current&&clearTimeout(p.current)}},[n,x]),a)return l.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted py-20 select-none animate-pulse",children:[l.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)"}}),l.jsx("span",{className:"text-[13px] font-mono",style:{color:"var(--gold)",opacity:.7},children:"Compiling operations telemetry..."})]});if(!r||r.summary.totalSessions===0)return l.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted py-20 select-none",children:[l.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:l.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",style:{opacity:.6},children:[l.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),l.jsx("path",{d:"M21 12H3M12 3v18"})]})}),l.jsx("div",{className:"text-[14px] font-display font-semibold",style:{color:"var(--cream)"},children:"No operational data found"}),l.jsx("div",{className:"text-[11.5px] text-muted mt-1",children:"Start a conversation to generate metrics."})]});const{summary:b,hourly:S,entrypoints:m,topTools:y}=r,g=E=>E<1e3?String(E):E<1e6?`${(E/1e3).toFixed(1)}k`:`${(E/1e6).toFixed(2)}M`,v=600,N=140,k=45,T=15,z=15,A=25,L=Math.max(...S.map(E=>E.inputTokens+E.outputTokens),1),R=v-k-T,H=N-z-A,Y=S.map((E,q)=>{const V=E.inputTokens+E.outputTokens,J=k+q/23*R,F=z+H-V/L*H;return{x:J,y:F,...E}}),_=Y.length>0?`${Y.map((E,q)=>`${q===0?"M":"L"} ${E.x} ${E.y}`).join(" ")} L ${Y[Y.length-1].x} ${z+H} L ${Y[0].x} ${z+H} Z`:"",C=Y.length>0?Y.map((E,q)=>`${q===0?"M":"L"} ${E.x} ${E.y}`).join(" "):"",j=600,D=140,O=Math.max(...S.map(E=>Math.max(E.toolCalls,E.messages)),1),$=j-k-T,U=D-z-A,X=$/24*.75,Z=$/24*.25,B=m.webui+m.tui+m.telegram+m.heartbeat||1;return l.jsxs("div",{className:`flex-1 overflow-y-auto p-4 md:p-7 scrollbar-thin ${t||""}`,children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-6",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-lg font-display font-semibold tracking-tight",style:{color:"var(--cream)"},children:"System Telemetry"}),l.jsx("p",{className:"text-[11.5px] text-muted mt-0.5",children:"Real-time daily operations telemetry and interface execution load."})]}),l.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"})]})]}),l.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[l.jsx(Ic,{label:"Today's Sessions",value:String(b.totalSessionsToday),subtitle:"conversations today"}),l.jsx(Ic,{label:"Operational Cost",value:`$${b.totalCost.toFixed(4)}`,subtitle:"estimated total",isGreen:!0}),l.jsx(Ic,{label:"Volume Consumed",value:g(b.totalTokens),subtitle:"total system tokens"}),l.jsx(Ic,{label:"Agent Executions",value:String(b.totalToolCalls),subtitle:"integrated tool calls"})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5 mb-6",children:[l.jsxs("div",{className:"glass-card rounded-xl p-5 flex flex-col relative select-none",children:[l.jsxs("div",{className:"flex items-center justify-between h-6 mb-4",children:[l.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--gold)",opacity:.8},children:"Hourly Token Consumption"}),l.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 · ${g(S[u].inputTokens+S[u].outputTokens)} tok`:"00:00 · 0 tok"})]}),l.jsx("div",{className:"relative flex-1 h-[140px]",children:l.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${v} ${N}`,preserveAspectRatio:"none",className:"overflow-visible",children:[l.jsx("defs",{children:l.jsxs("linearGradient",{id:"tokenGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[l.jsx("stop",{offset:"0%",stopColor:"var(--gold)",stopOpacity:"0.25"}),l.jsx("stop",{offset:"100%",stopColor:"var(--gold)",stopOpacity:"0"})]})}),Array.from({length:5}).map((E,q)=>{const V=z+q/4*H,J=Math.round(L-q/4*L);return l.jsxs("g",{className:"opacity-25",children:[l.jsx("line",{x1:k,y1:V,x2:v-T,y2:V,stroke:"var(--b2)",strokeWidth:"0.75",strokeDasharray:"3 3"}),l.jsx("text",{x:k-8,y:V+3.5,textAnchor:"end",className:"fill-muted font-mono text-[9.5px]",children:g(J)})]},q)}),Array.from({length:7}).map((E,q)=>{const V=Math.round(q/6*23),J=k+V/23*R;return l.jsxs("text",{x:J,y:N-6,textAnchor:"middle",className:"fill-muted font-mono text-[9.5px] opacity-60",children:[String(V).padStart(2,"0"),":00"]},q)}),_&&l.jsx("path",{d:_,fill:"url(#tokenGrad)"}),C&&l.jsx("path",{d:C,fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",strokeLinecap:"round"}),Y.map((E,q)=>l.jsxs("g",{onMouseEnter:()=>d(q),onMouseLeave:()=>d(null),children:[l.jsx("rect",{x:E.x-R/48,y:z,width:R/24,height:H,fill:"transparent",className:"cursor-pointer"}),u===q&&l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:E.x,y1:z,x2:E.x,y2:z+H,stroke:"var(--b2)",strokeWidth:"0.75"}),l.jsx("circle",{cx:E.x,cy:E.y,r:"4",fill:"var(--gold)",stroke:"var(--s1)",strokeWidth:"1.5"})]})]},q))]})})]}),l.jsxs("div",{className:"glass-card rounded-xl p-5 flex flex-col relative select-none",children:[l.jsxs("div",{className:"flex items-center justify-between h-6 mb-4",children:[l.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--gold)",opacity:.8},children:"Hourly Tool & Prompt Load"}),l.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 · 🛠️ ${S[f].toolCalls} calls · 💬 ${S[f].messages} msg`:"00:00 · 0 calls · 0 msg"})]}),l.jsx("div",{className:"relative flex-1 h-[140px]",children:l.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${j} ${D}`,preserveAspectRatio:"none",className:"overflow-visible",children:[Array.from({length:5}).map((E,q)=>{const V=z+q/4*U,J=Math.round(O-q/4*O);return l.jsxs("g",{className:"opacity-25",children:[l.jsx("line",{x1:k,y1:V,x2:j-T,y2:V,stroke:"var(--b2)",strokeWidth:"0.75",strokeDasharray:"3 3"}),l.jsx("text",{x:k-8,y:V+3.5,textAnchor:"end",className:"fill-muted font-mono text-[9.5px]",children:J})]},q)}),Array.from({length:7}).map((E,q)=>{const V=Math.round(q/6*23),J=k+V/23*$;return l.jsxs("text",{x:J,y:D-6,textAnchor:"middle",className:"fill-muted font-mono text-[9.5px] opacity-60",children:[String(V).padStart(2,"0"),":00"]},q)}),S.map((E,q)=>{const V=k+q*(X+Z),J=E.messages/O*U,F=E.toolCalls/O*U,G=z+U-J,te=G-F;return l.jsxs("g",{onMouseEnter:()=>h(q),onMouseLeave:()=>h(null),className:"cursor-pointer",children:[E.messages>0&&l.jsx("rect",{x:V,y:G,width:X,height:J,fill:"var(--yellow)",rx:"1",className:"transition-all duration-100 hover:opacity-80"}),E.toolCalls>0&&l.jsx("rect",{x:V,y:te,width:X,height:F,fill:"var(--cream)",rx:"1",className:"transition-all duration-100 hover:opacity-80"}),l.jsx("rect",{x:V-Z/2,y:z,width:X+Z,height:U,fill:"transparent"})]},q)})]})})]})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5 mb-6",children:[l.jsxs("div",{className:"glass-card rounded-xl p-5 flex flex-col select-none",children:[l.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider mb-4 block",style:{color:"var(--gold)",opacity:.8},children:"Telemetry Channels"}),l.jsxs("div",{className:"space-y-3.5 flex-1 flex flex-col justify-center",children:[l.jsx(Zc,{label:"Web UI Console",count:m.webui,percent:Math.round(m.webui/B*100),color:"var(--gold)"}),l.jsx(Zc,{label:"CLI TUI Terminal",count:m.tui,percent:Math.round(m.tui/B*100),color:"var(--yellow)"}),l.jsx(Zc,{label:"Telegram Bot",count:m.telegram,percent:Math.round(m.telegram/B*100),color:"var(--cream)"}),l.jsx(Zc,{label:"Heartbeat Scheduler",count:m.heartbeat,percent:Math.round(m.heartbeat/B*100),color:"var(--red)"})]})]}),l.jsxs("div",{className:"col-span-1 md:col-span-2 glass-card rounded-xl p-5",children:[l.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?l.jsx("div",{className:"flex items-center justify-center h-28 text-xs text-muted",children:"No tool executions tracked today"}):l.jsx("div",{className:"overflow-hidden",children:l.jsxs("table",{className:"w-full text-left text-xs",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"font-mono text-[10px]",style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 40%, transparent)",color:"var(--muted)"},children:[l.jsx("th",{className:"pb-1.5 font-medium",children:"TOOL DEFINITION"}),l.jsx("th",{className:"pb-1.5 font-medium text-right",children:"CALLS"})]})}),l.jsx("tbody",{children:y.map((E,q)=>l.jsxs("tr",{className:"transition-colors duration-100",style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 20%, transparent)"},children:[l.jsx("td",{className:"py-2 font-mono text-fg font-medium",children:E.name}),l.jsxs("td",{className:"py-2 text-right font-mono font-semibold",style:{color:"var(--gold)"},children:[E.count," executions"]})]},q))})]})})]})]}),i.length>0&&l.jsxs("div",{className:"glass-card rounded-xl overflow-hidden",children:[l.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"}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-[12.5px]",children:[l.jsx("thead",{children:l.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:[l.jsx("th",{className:"px-4 py-2 font-medium",children:"SESSION ID"}),l.jsx("th",{className:"px-4 py-2 font-medium",children:"CHANNEL"}),l.jsx("th",{className:"px-4 py-2 font-medium",children:"MODEL MODEL"}),l.jsx("th",{className:"px-4 py-2 font-medium",children:"TELEMETRY TIMESTAMP"}),l.jsx("th",{className:"px-4 py-2 font-medium",children:"ACTIVE DIRECTORY"})]})}),l.jsx("tbody",{children:i.slice(0,15).map(E=>l.jsxs("tr",{className:"transition-colors duration-75",style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 20%, transparent)"},children:[l.jsx("td",{className:"px-4 py-2.5 font-mono text-[11.5px] text-fg",children:E.id}),l.jsx("td",{className:"px-4 py-2.5",children:l.jsx("span",{className:"px-2 py-0.5 rounded-[4px] text-[10px] font-mono select-none",style:{background:E.type==="telegram"?"color-mix(in srgb, var(--cream) 10%, transparent)":E.type==="tui"?"color-mix(in srgb, var(--yellow) 10%, transparent)":E.type==="heartbeat"?"color-mix(in srgb, var(--red) 10%, transparent)":"color-mix(in srgb, var(--gold) 10%, transparent)",color:E.type==="telegram"?"var(--cream)":E.type==="tui"?"var(--yellow)":E.type==="heartbeat"?"var(--red)":"var(--gold)",border:"1px solid color-mix(in srgb, var(--b1) 30%, transparent)"},children:E.type||"webui"})}),l.jsx("td",{className:"px-4 py-2.5 text-text font-mono text-[11.5px]",children:E.model}),l.jsx("td",{className:"px-4 py-2.5 text-muted text-xs",children:new Date(E.createdAt).toLocaleString()}),l.jsx("td",{className:"px-4 py-2.5 text-muted text-xs truncate max-w-[220px]",title:E.cwd,children:E.cwd})]},E.id))})]})})]})]})}function Ic({label:e,value:t,subtitle:n,isGreen:r}){return l.jsxs("div",{className:"metric-card rounded-xl px-6 py-5 flex flex-col justify-between select-none",children:[l.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--gold)",opacity:.7},children:e}),l.jsx("div",{className:"text-2xl font-display font-bold tracking-tight leading-none",style:{color:r?"var(--green)":"var(--cream)"},children:t}),l.jsx("span",{className:"text-[10px] text-muted mt-2 font-mono",children:n})]})}function Zc({label:e,count:t,percent:n,color:r}){return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between text-xs font-medium text-text2",children:[l.jsx("span",{children:e}),l.jsxs("span",{className:"font-mono text-muted",children:[t," sessions (",n||0,"%)"]})]}),l.jsx("div",{className:"w-full h-1.5 rounded-full overflow-hidden",style:{background:"var(--s2)"},children:l.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${n||0}%`,background:r}})})]})}function CA({rpc:e,className:t}){const[n,r]=w.useState([]),[s,i]=w.useState(!0);w.useEffect(()=>{e&&(i(!0),e.sessionList().then(a=>{Array.isArray(a)&&r(a)}).catch(()=>{}).finally(()=>i(!1)))},[e]);const o=w.useMemo(()=>{const a=new Map;for(const c of n){const u=a.get(c.cwd)||[];u.push(c),a.set(c.cwd,u)}return Array.from(a.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 l.jsxs("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin ${t||""}`,children:[l.jsxs("div",{className:"flex items-center justify-between mb-5",children:[l.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight",children:"Projects"}),l.jsxs("span",{className:"text-xs text-muted font-mono",children:[o.length," projects"]})]}),s?l.jsx("div",{className:"flex items-center justify-center py-10 text-muted",children:"Loading..."}):o.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-muted",children:[l.jsx("div",{className:"text-sm",children:"No projects yet"}),l.jsx("div",{className:"text-xs text-muted2 mt-1",children:"Sessions will appear here once you run them"})]}):o.map(a=>l.jsx(MA,{project:a},a.cwd))]})}function MA({project:e}){const t=e.cwd.split("/").pop()||e.cwd;return l.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:[l.jsx("div",{className:"w-[6px] h-[6px] rounded-full bg-green shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-fg",children:t}),l.jsx("div",{className:"text-xs text-muted font-mono",children:e.cwd})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsxs("span",{className:"text-xs text-muted",children:[e.sessions," session",e.sessions!==1?"s":""]}),l.jsx("span",{className:"text-xs text-muted",children:e.providers.join(", ")})]}),l.jsx("span",{className:"text-[10px] font-medium rounded-full px-2 py-0.5 font-mono bg-green/10 text-green",children:"active"})]})}function zA(){const{rpc:e,ws:t}=fr(),[n,r]=w.useState(new Map);w.useEffect(()=>{e&&e.subagentList().then(d=>{if(!Array.isArray(d))return;const f=new Map;for(const h of d)h.agentId&&f.set(h.agentId,{...h,agentId:h.agentId,sessionId:h.sessionId??"",prompt:h.prompt??"",provider:h.provider??"unknown",status:h.status??"done",text:h.text??"",toolCalls:h.toolCalls??0,errors:h.errors??[],inputTokens:h.inputTokens??0,outputTokens:h.outputTokens??0,startedAt:h.startedAt??0});r(f)}).catch(()=>{})},[e]),w.useEffect(()=>{if(!t)return;const d=m=>{r(y=>{const g=new Map(y);return g.set(m.agentId,{agentId:m.agentId,sessionId:m.sessionId||"",prompt:m.prompt||"",provider:m.provider||"unknown",status:"starting",text:"",toolCalls:0,errors:[],inputTokens:0,outputTokens:0,startedAt:m.timestamp}),g})},f=m=>{r(y=>{const g=new Map(y),v=g.get(m.agentId);return v&&g.set(m.agentId,{...v,text:v.text+m.text}),g})},h=m=>{r(y=>{const g=new Map(y),v=g.get(m.agentId);return v&&g.set(m.agentId,{...v,toolCalls:v.toolCalls+1}),g})},p=m=>{r(y=>{const g=new Map(y),v=g.get(m.agentId);return v&&g.set(m.agentId,{...v,inputTokens:v.inputTokens+(m.inputTokens||0),outputTokens:v.outputTokens+(m.outputTokens||0)}),g})},x=m=>{r(y=>{const g=new Map(y),v=g.get(m.agentId);return v&&g.set(m.agentId,{...v,status:"done",text:m.text||v.text,toolCalls:m.toolCalls??v.toolCalls,errors:m.errors||[],doneAt:m.timestamp}),g})},b=m=>{r(y=>{const g=new Map(y),v=g.get(m.agentId);return v&&g.set(m.agentId,{...v,status:"error",errors:[...v.errors||[],m.message],doneAt:m.timestamp}),g})},S=[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",b)];return()=>{for(const m of S)m()}},[t]);const s=w.useCallback(async d=>{if(!e)return null;try{return await e.subagentSpawn(d)}catch(f){return console.error("[useSubagents] Spawn failed:",f),null}},[e]),i=w.useCallback(async d=>{if(!e)return!1;try{return await e.subagentCancel(d),r(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]),o=w.useCallback(async(d,f)=>{if(!e)return!1;try{return await e.subagentSend(d,f),!0}catch{return!1}},[e]),a=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:a,completed:c,failed:u,spawn:s,cancel:i,send:o}}const DA=["agent-start","agent-tool-call","agent-tool-result","agent-text-delta","agent-thinking-delta","agent-done","agent-error"],RA=new Set(["agent-text-delta","agent-thinking-delta"]),oy=50,OA=20,ay=["--chart-1","--chart-2","--chart-3","--chart-4","--chart-5","--chart-6","--chart-7","--chart-8"];function ly(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return ay[t%ay.length]}function go(e){return typeof e=="string"?e:e==null?"":typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function $A(e){const t=e.event;switch(e.type){case"agent-start":{const n=go(t.prompt);return{label:"Agent started",detail:n?`"${n}"`:"",tone:"yellow"}}case"agent-tool-call":{const n=go(t.name)||"tool",r=t.input??{};return{label:n,detail:_2(n,r),tone:"gold"}}case"agent-tool-result":{const n=go(t.error);return n?{label:"Tool failed",detail:n,tone:"red",wrapDetail:!0}:null}case"agent-thinking-delta":return{label:"Thinking…",detail:`${Sn(e.charCount)} chars`,tone:"muted"};case"agent-text-delta":return{label:"Streaming…",detail:`${Sn(e.charCount)} chars`,tone:"muted"};case"agent-done":{const n=[];return typeof t.toolCalls=="number"&&n.push(`${String(t.toolCalls)} tools`),typeof t.durationMs=="number"&&n.push(gg(t.durationMs)),{label:"Completed",detail:n.join(" · "),tone:"green"}}case"agent-error":return{label:"Failed",detail:go(t.message),tone:"red",wrapDetail:!0};default:return{label:e.type,detail:"",tone:"muted"}}}const LA={green:"bg-green",yellow:"bg-yellow",red:"bg-red",gold:"bg-gold",muted:"bg-muted2"},HA={green:"text-green",yellow:"text-yellow",red:"text-red",gold:"text-gold",muted:"text-muted"};function BA({ws:e}){const[t,n]=w.useState([]),[r,s]=w.useState(()=>Date.now()),i=w.useRef(0);if(w.useEffect(()=>{if(!e)return;const a=u=>d=>{n(f=>{const h=go(d.agentId),p=go(d.text);if(RA.has(u)){const x=f[0];return f.length>0&&x.type===u&&x.agentId===h?[{...x,charCount:x.charCount+p.length,timestamp:d.timestamp},...f.slice(1)]:[{seq:i.current++,type:u,agentId:h,timestamp:d.timestamp,charCount:p.length,event:d},...f].slice(0,oy)}return[{seq:i.current++,type:u,agentId:h,timestamp:d.timestamp,charCount:0,event:d},...f].slice(0,oy)})},c=DA.map(u=>e.on(u,a(u)));return()=>{for(const u of c)u()}},[e]),w.useEffect(()=>{const a=setInterval(()=>{s(Date.now())},1e3);return()=>{clearInterval(a)}},[]),!e)return null;const o=t.map(a=>({entry:a,desc:$A(a)})).filter(a=>a.desc!==null).slice(0,OA);return l.jsxs("div",{children:[l.jsx("div",{className:"h-px bg-b1 my-5"}),l.jsx("div",{className:"text-[11.5px] font-medium text-muted mb-2.5",children:"Live Agent Events"}),o.length===0?l.jsx("div",{className:"text-xs text-muted2 px-3 py-2",children:"Waiting for agent activity…"}):o.map(({entry:a,desc:c})=>l.jsxs("div",{className:"flex items-start gap-3 px-3 py-1.5 rounded-lg mb-0.5 hover:bg-s2 transition-colors",children:[l.jsx("div",{className:`w-[6px] h-[6px] rounded-full shrink-0 mt-[6px] ${LA[c.tone]}`}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:`text-[12px] font-mono font-medium ${HA[c.tone]}`,children:c.label})}),c.detail&&l.jsx("div",{className:`text-xs text-muted ${c.wrapDetail?"whitespace-pre-wrap break-words":"truncate"}`,title:c.detail,children:c.detail})]}),a.agentId&&l.jsx("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded-[3px] shrink-0 mt-[2px]",style:{color:`var(${ly(a.agentId)})`,background:`color-mix(in srgb, var(${ly(a.agentId)}) 12%, transparent)`},title:a.agentId,children:a.agentId.slice(0,4)}),l.jsx("span",{className:"text-[10px] text-muted font-mono shrink-0 mt-[3px] w-[52px] text-right",title:Jn(a.timestamp),children:WT(a.timestamp,r)})]},a.seq))]})}function UA({rpc:e,sessionId:t,className:n,onOpenSession:r}){const{ws:s}=fr(),{agents:i,running:o,completed:a,failed:c,spawn:u,cancel:d,send:f}=zA(),[h,p]=w.useState(!1),[x,b]=w.useState(!1),[S,m]=w.useState(""),[y,g]=w.useState("auto"),[v,N]=w.useState("auto"),[k,T]=w.useState(""),[z,A]=w.useState(""),[L,R]=w.useState(""),[H,Y]=w.useState(""),[_,C]=w.useState(""),[j,D]=w.useState(""),[O,$]=w.useState(""),[U,X]=w.useState("auto"),[Z,B]=w.useState(""),[E,q]=w.useState(""),[V,J]=w.useState(""),[F,G]=w.useState(0),te=w.useCallback(W=>{W&&(r==null||r(W))},[r]),le=w.useCallback(async()=>{if(!S.trim()||!e)return;let W=t;if(!W)try{const ge=await e.sessionList();Array.isArray(ge)&&ge.length>0&&(W=ge[0].id)}catch{}await u({sessionId:W||"",prompt:S.trim(),provider:k||void 0,mode:y!=="auto"?y:void 0,effort:v!=="auto"?v:void 0,model:z||void 0}),m(""),p(!1),T("")},[S,y,v,k,z,t,e,u]),ie=w.useCallback(async()=>{if(!e||!L.trim()||!H||!_){B("Please fill in prompt and date/time");return}B("");const W=`${H}T${_}:00`;try{await e.taskSchedule({instruction:L.trim(),scheduled_at:W,provider:j||void 0,model:O||void 0,effort:U!=="auto"?U:void 0}),R(""),Y(""),C(""),b(!1)}catch(ge){B(ge instanceof Error?ge.message:"Failed to schedule task")}},[L,H,_,j,O,U,e]),ce=w.useCallback(async()=>{!E||!V.trim()||(await f(E,V.trim()),J(""))},[E,V,f]),oe=Array.from(i.values()).sort((W,ge)=>(ge.startedAt||0)-(W.startedAt||0)),he=oe.filter(W=>W.status==="done"||W.status==="error"||W.status==="cancelled"),re=he.slice(F*10,(F+1)*10);return l.jsxs("div",{className:`flex-1 overflow-y-auto p-4 md:p-7 scrollbar-thin ${n||""}`,children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-6",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight",children:"Agents"}),l.jsx("p",{className:"text-[11.5px] text-muted mt-0.5",children:"Parallel subagent orchestration and monitoring."})]}),l.jsxs("div",{className:"flex gap-2 self-start sm:self-auto",children:[l.jsx("button",{onClick:()=>b(!x),className:`text-xs font-medium border rounded-[8px] px-4 py-2 transition-colors select-none ${x?"bg-blue/15 text-blue border-blue/30":"bg-s2 text-muted border-b1 hover:text-fg"}`,children:"Schedule"}),l.jsx("button",{onClick:()=>p(!h),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:h?"Cancel":"+ Spawn Agent"})]})]}),h&&l.jsx("div",{className:"bg-s1 border border-b1 rounded-[10px] p-5 mb-6 animate-in",children:l.jsxs("div",{className:"flex flex-col gap-3",children:[l.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:W=>m(W.target.value),onKeyDown:W=>{W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),le())}}),l.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[l.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:y,onChange:W=>g(W.target.value),children:[l.jsx("option",{value:"auto",children:"Mode: inherit"}),l.jsx("option",{value:"plan",children:"Mode: plan"}),l.jsx("option",{value:"edit",children:"Mode: edit"}),l.jsx("option",{value:"auto",children:"Mode: auto"}),l.jsx("option",{value:"yolo",children:"Mode: yolo"})]}),l.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:v,onChange:W=>N(W.target.value),children:[l.jsx("option",{value:"auto",children:"Effort: inherit"}),l.jsx("option",{value:"low",children:"Effort: low"}),l.jsx("option",{value:"medium",children:"Effort: medium"}),l.jsx("option",{value:"high",children:"Effort: high"}),l.jsx("option",{value:"max",children:"Effort: max"})]}),l.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:k,onChange:W=>T(W.target.value),children:[l.jsx("option",{value:"",children:"Provider: inherit"}),l.jsx("option",{value:"anthropic",children:"Anthropic"}),l.jsx("option",{value:"openai",children:"OpenAI"}),l.jsx("option",{value:"google",children:"Google"}),l.jsx("option",{value:"ollama",children:"Ollama"}),l.jsx("option",{value:"openrouter",children:"OpenRouter"})]}),l.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:z,onChange:W=>A(W.target.value)}),l.jsx("button",{onClick:le,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"})]})]})}),x&&l.jsx("div",{className:"bg-s1 border border-b1 rounded-[10px] p-5 mb-6 animate-in",children:l.jsxs("div",{className:"flex flex-col gap-3",children:[l.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:L,onChange:W=>R(W.target.value)}),l.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[l.jsx("input",{type:"date",className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:H,onChange:W=>Y(W.target.value)}),l.jsx("input",{type:"time",className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:_,onChange:W=>C(W.target.value)}),l.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:U,onChange:W=>X(W.target.value),children:[l.jsx("option",{value:"auto",children:"Effort: auto"}),l.jsx("option",{value:"low",children:"Effort: low"}),l.jsx("option",{value:"medium",children:"Effort: medium"}),l.jsx("option",{value:"high",children:"Effort: high"}),l.jsx("option",{value:"max",children:"Effort: max"})]}),l.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:j,onChange:W=>D(W.target.value),children:[l.jsx("option",{value:"",children:"Provider: inherit"}),l.jsx("option",{value:"anthropic",children:"Anthropic"}),l.jsx("option",{value:"openai",children:"OpenAI"}),l.jsx("option",{value:"google",children:"Google"}),l.jsx("option",{value:"ollama",children:"Ollama"}),l.jsx("option",{value:"openrouter",children:"OpenRouter"})]}),l.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:O,onChange:W=>$(W.target.value)})]}),Z&&l.jsx("div",{className:"text-[11px] text-red bg-red/5 rounded-[6px] p-2",children:Z}),l.jsx("button",{onClick:ie,disabled:!L.trim()||!H||!_,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"})]})}),l.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[l.jsx(Yc,{label:"Running",value:String(o.length),color:"text-yellow"}),l.jsx(Yc,{label:"Completed",value:String(a.length),color:"text-green"}),l.jsx(Yc,{label:"Failed",value:String(c.length),color:"text-red"}),l.jsx(Yc,{label:"Total Tokens",value:Sn(oe.reduce((W,ge)=>W+ge.inputTokens+ge.outputTokens,0)),color:"text-fg"})]}),o.length>0&&l.jsxs("div",{className:"mb-6",children:[l.jsx("h3",{className:"text-[11px] font-semibold text-text2 uppercase tracking-wider mb-3",children:"Live Agents"}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:o.map(W=>l.jsx(IA,{agent:W,onCancel:()=>d(W.agentId),onOpen:()=>{te(W.sessionId)}},W.agentId))})]}),he.length>0&&l.jsxs("div",{className:"mb-6",children:[l.jsx("h3",{className:"text-[11px] font-semibold text-text2 uppercase tracking-wider mb-3",children:"History"}),l.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] overflow-hidden",children:[l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-[12px]",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-left text-xs text-muted border-b border-b1 font-mono text-[10px]",children:[l.jsx("th",{className:"px-4 py-2 font-medium",children:"STATUS"}),l.jsx("th",{className:"px-4 py-2 font-medium",children:"PROVIDER"}),l.jsx("th",{className:"px-4 py-2 font-medium",children:"PROMPT"}),l.jsx("th",{className:"px-4 py-2 font-medium",children:"DURATION"}),l.jsx("th",{className:"px-4 py-2 font-medium",children:"TOOLS"}),l.jsx("th",{className:"px-4 py-2 font-medium text-right",children:"TOKENS"})]})}),l.jsx("tbody",{children:re.map(W=>{const ge=W.status==="done"?"text-green":W.status==="cancelled"?"text-muted2":"text-red",Ue=W.doneAt?gg(W.doneAt-W.startedAt):"-",it=W.inputTokens+W.outputTokens;return l.jsxs("tr",{className:"hover:bg-s2/30 transition-colors cursor-pointer border-b border-b1/40",title:"Open session in Assistant",onClick:()=>{te(W.sessionId)},children:[l.jsx("td",{className:"px-4 py-2.5",children:l.jsx("span",{className:`text-[10px] font-mono px-2 py-0.5 rounded-[4px] ${ge==="text-green"?"bg-green/10":ge==="text-red"?"bg-red/10":"bg-muted/10"}`,children:W.status})}),l.jsx("td",{className:"px-4 py-2.5 text-muted font-mono text-[11.5px]",children:W.provider||"-"}),l.jsx("td",{className:"px-4 py-2.5 text-fg truncate max-w-[200px]",title:W.prompt,children:W.prompt}),l.jsx("td",{className:"px-4 py-2.5 text-muted font-mono",children:Ue}),l.jsx("td",{className:"px-4 py-2.5 text-muted font-mono",children:W.toolCalls}),l.jsx("td",{className:"px-4 py-2.5 text-right font-mono text-muted",children:it>0?Sn(it):"-"})]},W.agentId)})})]})}),he.length>10&&l.jsxs("div",{className:"flex items-center justify-center gap-4 py-2 border-t border-b1",children:[l.jsx("button",{className:"text-xs text-muted hover:text-fg transition-colors disabled:opacity-30",disabled:F===0,onClick:()=>G(W=>W-1),children:"Prev"}),l.jsxs("span",{className:"text-[10px] text-muted font-mono",children:[F+1," / ",Math.ceil(he.length/10)]}),l.jsx("button",{className:"text-xs text-muted hover:text-fg transition-colors disabled:opacity-30",disabled:(F+1)*10>=he.length,onClick:()=>G(W=>W+1),children:"Next"})]})]})]}),o.length>0&&l.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] p-4 mb-6",children:[l.jsx("h3",{className:"text-[11px] font-semibold text-text2 uppercase tracking-wider mb-3",children:"Send Message to Agent"}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[l.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none flex-[0.5]",value:E,onChange:W=>q(W.target.value),children:[l.jsx("option",{value:"",children:"Select agent..."}),o.map(W=>l.jsxs("option",{value:W.agentId,children:[W.prompt.slice(0,40),W.prompt.length>40?"...":""]},W.agentId))]}),l.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:V,onChange:W=>J(W.target.value),onKeyDown:W=>{W.key==="Enter"&&ce()}}),l.jsx("button",{onClick:ce,disabled:!E||!V.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"})]})]}),l.jsx(BA,{ws:s})]})}function Yc({label:e,value:t,color:n}){return l.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] px-5 py-4 flex flex-col justify-between select-none",children:[l.jsx("span",{className:"text-[10px] font-semibold text-muted uppercase tracking-wider",children:e}),l.jsx("div",{className:`text-2xl font-bold tracking-tight leading-none mt-1 ${n}`,children:t})]})}function IA({agent:e,onCancel:t,onOpen:n}){const r=Date.now()-e.startedAt,s=e.inputTokens+e.outputTokens,i=e.status==="running"?"text-yellow":"text-green";return l.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] p-4 hover:border-b2 transition-colors cursor-pointer select-none",title:"Open session in Assistant",onClick:n,children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("div",{className:`w-[6px] h-[6px] rounded-full shrink-0 ${e.status==="running"?"bg-yellow animate-pulse":"bg-green"}`}),l.jsx("span",{className:"text-[12.5px] font-medium text-fg truncate flex-1",children:e.prompt}),l.jsx("span",{className:"text-[9px] font-mono bg-s3 px-1.5 py-0.5 rounded-[3px] text-muted shrink-0",children:e.provider}),l.jsx("span",{className:`text-[10px] font-mono ${i}`,children:e.status}),e.status==="running"&&l.jsx("button",{className:"text-[10px] text-red/70 hover:text-red font-mono shrink-0",onClick:o=>{o.stopPropagation(),t()},children:"Cancel"})]}),l.jsxs("div",{className:"text-[10.5px] text-muted font-mono mb-2",children:[gg(r)," · ",e.toolCalls," tools · ",Sn(s)," tok"]}),e.text&&l.jsx("div",{className:"text-[11px] text-text2 line-clamp-2 font-mono leading-relaxed",children:e.text.slice(-200)})]})}function ZA(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return w.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const Fd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function da(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function yg(e){return"nodeType"in e}function Kt(e){var t,n;return e?da(e)?e:yg(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function vg(e){const{Document:t}=Kt(e);return e instanceof t}function Ql(e){return da(e)?!1:e instanceof Kt(e).HTMLElement}function A2(e){return e instanceof Kt(e).SVGElement}function fa(e){return e?da(e)?e.document:yg(e)?vg(e)?e:Ql(e)||A2(e)?e.ownerDocument:document:document:document}const cr=Fd?w.useLayoutEffect:w.useEffect;function Qd(e){const t=w.useRef(e);return cr(()=>{t.current=e}),w.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function YA(){const e=w.useRef(null),t=w.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=w.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function kl(e,t){t===void 0&&(t=[e]);const n=w.useRef(e);return cr(()=>{n.current!==e&&(n.current=e)},t),n}function Kl(e,t){const n=w.useRef();return w.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function ld(e){const t=Qd(e),n=w.useRef(null),r=w.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function cd(e){const t=w.useRef();return w.useEffect(()=>{t.current=e},[e]),t.current}let yh={};function Wl(e,t){return w.useMemo(()=>{if(t)return t;const n=yh[e]==null?0:yh[e]+1;return yh[e]=n,e+"-"+n},[e,t])}function C2(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((i,o)=>{const a=Object.entries(o);for(const[c,u]of a){const d=i[c];d!=null&&(i[c]=d+e*u)}return i},{...t})}}const Co=C2(1),ud=C2(-1);function qA(e){return"clientX"in e&&"clientY"in e}function Kd(e){if(!e)return!1;const{KeyboardEvent:t}=Kt(e.target);return t&&e instanceof t}function VA(e){if(!e)return!1;const{TouchEvent:t}=Kt(e.target);return t&&e instanceof t}function dd(e){if(VA(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 qA(e)?{x:e.clientX,y:e.clientY}:null}const Qs=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[Qs.Translate.toString(e),Qs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),cy="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function GA(e){return e.matches(cy)?e:e.querySelector(cy)}const XA={display:"none"};function PA(e){let{id:t,value:n}=e;return Xe.createElement("div",{id:t,style:XA},n)}function FA(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={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 Xe.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function QA(){const[e,t]=w.useState("");return{announce:w.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const M2=w.createContext(null);function KA(e){const t=w.useContext(M2);w.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function WA(){const[e]=w.useState(()=>new Set),t=w.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[w.useCallback(r=>{let{type:s,event:i}=r;e.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[e]),t]}const JA={draggable:`
142
+ To pick up a draggable item, press the space bar.
143
+ While dragging, use the arrow keys to move the item.
144
+ Press space again to drop the item in its new position, or press escape to cancel.
145
+ `},e5={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 t5(e){let{announcements:t=e5,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=JA}=e;const{announce:i,announcement:o}=QA(),a=Wl("DndLiveRegion"),[c,u]=w.useState(!1);if(w.useEffect(()=>{u(!0)},[]),KA(w.useMemo(()=>({onDragStart(f){let{active:h}=f;i(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;t.onDragMove&&i(t.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;i(t.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;i(t.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;i(t.onDragCancel({active:h,over:p}))}}),[i,t])),!c)return null;const d=Xe.createElement(Xe.Fragment,null,Xe.createElement(PA,{id:r,value:s.draggable}),Xe.createElement(FA,{id:a,announcement:o}));return n?xi.createPortal(d,n):d}var vt;(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"})(vt||(vt={}));function fd(){}function uy(e,t){return w.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function n5(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return w.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ur=Object.freeze({x:0,y:0});function r5(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function s5(e,t){const n=dd(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function i5(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function o5(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function dy(e){let{left:t,top:n,height:r,width:s}=e;return[{x:t,y:n},{x:t+s,y:n},{x:t,y:n+r},{x:t+s,y:n+r}]}function a5(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const l5=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=dy(t),i=[];for(const o of r){const{id:a}=o,c=n.get(a);if(c){const u=dy(c),d=s.reduce((h,p,x)=>h+r5(u[x],p),0),f=Number((d/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(i5)};function c5(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-r,a=i-n;if(r<s&&n<i){const c=t.width*t.height,u=e.width*e.height,d=o*a,f=d/(c+u-d);return Number(f.toFixed(4))}return 0}const u5=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const i of r){const{id:o}=i,a=n.get(o);if(a){const c=c5(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(o5)};function d5(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function z2(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ur}function f5(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((o,a)=>({...o,top:o.top+e*a.y,bottom:o.bottom+e*a.y,left:o.left+e*a.x,right:o.right+e*a.x}),{...n})}}const h5=f5(1);function D2(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 p5(e,t,n){const r=D2(t);if(!r)return e;const{scaleX:s,scaleY:i,x:o,y:a}=r,c=e.left-o-(1-s)*parseFloat(n),u=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c}}const m5={ignoreTransform:!1};function ha(e,t){t===void 0&&(t=m5);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=Kt(e).getComputedStyle(e);u&&(n=p5(n,u,d))}const{top:r,left:s,width:i,height:o,bottom:a,right:c}=n;return{top:r,left:s,width:i,height:o,bottom:a,right:c}}function fy(e){return ha(e,{ignoreTransform:!0})}function g5(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function x5(e,t){return t===void 0&&(t=Kt(e).getComputedStyle(e)),t.position==="fixed"}function y5(e,t){t===void 0&&(t=Kt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?n.test(i):!1})}function bg(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(vg(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Ql(s)||A2(s)||n.includes(s))return n;const i=Kt(e).getComputedStyle(s);return s!==e&&y5(s,i)&&n.push(s),x5(s,i)?n:r(s.parentNode)}return e?r(e):n}function R2(e){const[t]=bg(e,1);return t??null}function vh(e){return!Fd||!e?null:da(e)?e:yg(e)?vg(e)||e===fa(e).scrollingElement?window:Ql(e)?e:null:null}function O2(e){return da(e)?e.scrollX:e.scrollLeft}function $2(e){return da(e)?e.scrollY:e.scrollTop}function Hp(e){return{x:O2(e),y:$2(e)}}var Et;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Et||(Et={}));function L2(e){return!Fd||!e?!1:e===document.scrollingElement}function H2(e){const t={x:0,y:0},n=L2(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:o,isRight:a,maxScroll:r,minScroll:t}}const v5={x:.2,y:.2};function b5(e,t,n,r,s){let{top:i,left:o,right:a,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=v5);const{isTop:u,isBottom:d,isLeft:f,isRight:h}=H2(e),p={x:0,y:0},x={x:0,y:0},b={height:t.height*s.y,width:t.width*s.x};return!u&&i<=t.top+b.height?(p.y=Et.Backward,x.y=r*Math.abs((t.top+b.height-i)/b.height)):!d&&c>=t.bottom-b.height&&(p.y=Et.Forward,x.y=r*Math.abs((t.bottom-b.height-c)/b.height)),!h&&a>=t.right-b.width?(p.x=Et.Forward,x.x=r*Math.abs((t.right-b.width-a)/b.width)):!f&&o<=t.left+b.width&&(p.x=Et.Backward,x.x=r*Math.abs((t.left+b.width-o)/b.width)),{direction:p,speed:x}}function w5(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function B2(e){return e.reduce((t,n)=>Co(t,Hp(n)),ur)}function S5(e){return e.reduce((t,n)=>t+O2(n),0)}function _5(e){return e.reduce((t,n)=>t+$2(n),0)}function U2(e,t){if(t===void 0&&(t=ha),!e)return;const{top:n,left:r,bottom:s,right:i}=t(e);R2(e)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const k5=[["x",["left","right"],S5],["y",["top","bottom"],_5]];class wg{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 r=bg(n),s=B2(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of k5)for(const c of o)Object.defineProperty(this,c,{get:()=>{const u=a(r),d=s[i]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class il{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function N5(e){const{EventTarget:t}=Kt(e);return e instanceof t?e:fa(e)}function bh(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var $n;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})($n||($n={}));function hy(e){e.preventDefault()}function j5(e){e.stopPropagation()}var Te;(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"})(Te||(Te={}));const I2={start:[Te.Space,Te.Enter],cancel:[Te.Esc],end:[Te.Space,Te.Enter,Te.Tab]},E5=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Te.Right:return{...n,x:n.x+25};case Te.Left:return{...n,x:n.x-25};case Te.Down:return{...n,y:n.y+25};case Te.Up:return{...n,y:n.y-25}}};class Sg{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 il(fa(n)),this.windowListeners=new il(Kt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add($n.Resize,this.handleCancel),this.windowListeners.add($n.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add($n.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&U2(r),n(ur)}handleKeyDown(t){if(Kd(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=I2,coordinateGetter:o=E5,scrollBehavior:a="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,d=u?{x:u.left,y:u.top}:ur;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(t,{active:n,context:r.current,currentCoordinates:d});if(f){const h=ud(f,d),p={x:0,y:0},{scrollableAncestors:x}=r.current;for(const b of x){const S=t.code,{isTop:m,isRight:y,isLeft:g,isBottom:v,maxScroll:N,minScroll:k}=H2(b),T=w5(b),z={x:Math.min(S===Te.Right?T.right-T.width/2:T.right,Math.max(S===Te.Right?T.left:T.left+T.width/2,f.x)),y:Math.min(S===Te.Down?T.bottom-T.height/2:T.bottom,Math.max(S===Te.Down?T.top:T.top+T.height/2,f.y))},A=S===Te.Right&&!y||S===Te.Left&&!g,L=S===Te.Down&&!v||S===Te.Up&&!m;if(A&&z.x!==f.x){const R=b.scrollLeft+h.x,H=S===Te.Right&&R<=N.x||S===Te.Left&&R>=k.x;if(H&&!h.y){b.scrollTo({left:R,behavior:a});return}H?p.x=b.scrollLeft-R:p.x=S===Te.Right?b.scrollLeft-N.x:b.scrollLeft-k.x,p.x&&b.scrollBy({left:-p.x,behavior:a});break}else if(L&&z.y!==f.y){const R=b.scrollTop+h.y,H=S===Te.Down&&R<=N.y||S===Te.Up&&R>=k.y;if(H&&!h.x){b.scrollTo({top:R,behavior:a});return}H?p.y=b.scrollTop-R:p.y=S===Te.Down?b.scrollTop-N.y:b.scrollTop-k.y,p.y&&b.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(t,Co(ud(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(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()}}Sg.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=I2,onActivation:s}=t,{active:i}=n;const{code:o}=e.nativeEvent;if(r.start.includes(o)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function py(e){return!!(e&&"distance"in e)}function my(e){return!!(e&&"delay"in e)}class _g{constructor(t,n,r){var s;r===void 0&&(r=N5(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:i}=t,{target:o}=i;this.props=t,this.events=n,this.document=fa(o),this.documentListeners=new il(this.document),this.listeners=new il(r),this.windowListeners=new il(Kt(o)),this.initialCoordinates=(s=dd(i))!=null?s:ur,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:r}}}=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($n.Resize,this.handleCancel),this.windowListeners.add($n.DragStart,hy),this.windowListeners.add($n.VisibilityChange,this.handleCancel),this.windowListeners.add($n.ContextMenu,hy),this.documentListeners.add($n.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(my(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(py(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:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add($n.Click,j5,{capture:!0}),this.removeTextSelection(),this.documentListeners.add($n.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const c=(n=dd(t))!=null?n:ur,u=ud(s,c);if(!r&&a){if(py(a)){if(a.tolerance!=null&&bh(u,a.tolerance))return this.handleCancel();if(bh(u,a.distance))return this.handleStart()}if(my(a)&&bh(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);return}t.cancelable&&t.preventDefault(),o(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===Te.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const T5={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class kg extends _g{constructor(t){const{event:n}=t,r=fa(n.target);super(t,T5,r)}}kg.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const A5={move:{name:"mousemove"},end:{name:"mouseup"}};var Bp;(function(e){e[e.RightClick=2]="RightClick"})(Bp||(Bp={}));class C5 extends _g{constructor(t){super(t,A5,fa(t.event.target))}}C5.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Bp.RightClick?!1:(r==null||r({event:n}),!0)}}];const wh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class M5 extends _g{constructor(t){super(t,wh)}static setup(){return window.addEventListener(wh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(wh.move.name,t)};function t(){}}}M5.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var ol;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ol||(ol={}));var hd;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(hd||(hd={}));function z5(e){let{acceleration:t,activator:n=ol.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:o=5,order:a=hd.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:h}=e;const p=R5({delta:f,disabled:!i}),[x,b]=YA(),S=w.useRef({x:0,y:0}),m=w.useRef({x:0,y:0}),y=w.useMemo(()=>{switch(n){case ol.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case ol.DraggableRect:return s}},[n,s,c]),g=w.useRef(null),v=w.useCallback(()=>{const k=g.current;if(!k)return;const T=S.current.x*m.current.x,z=S.current.y*m.current.y;k.scrollBy(T,z)},[]),N=w.useMemo(()=>a===hd.TreeOrder?[...u].reverse():u,[a,u]);w.useEffect(()=>{if(!i||!u.length||!y){b();return}for(const k of N){if((r==null?void 0:r(k))===!1)continue;const T=u.indexOf(k),z=d[T];if(!z)continue;const{direction:A,speed:L}=b5(k,z,y,t,h);for(const R of["x","y"])p[R][A[R]]||(L[R]=0,A[R]=0);if(L.x>0||L.y>0){b(),g.current=k,x(v,o),S.current=L,m.current=A;return}}S.current={x:0,y:0},m.current={x:0,y:0},b()},[t,v,r,b,i,o,JSON.stringify(y),JSON.stringify(p),x,u,N,d,JSON.stringify(h)])}const D5={x:{[Et.Backward]:!1,[Et.Forward]:!1},y:{[Et.Backward]:!1,[Et.Forward]:!1}};function R5(e){let{delta:t,disabled:n}=e;const r=cd(t);return Kl(s=>{if(n||!r||!s)return D5;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Et.Backward]:s.x[Et.Backward]||i.x===-1,[Et.Forward]:s.x[Et.Forward]||i.x===1},y:{[Et.Backward]:s.y[Et.Backward]||i.y===-1,[Et.Forward]:s.y[Et.Forward]||i.y===1}}},[n,t,r])}function O5(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Kl(s=>{var i;return t==null?null:(i=r??s)!=null?i:null},[r,t])}function $5(e,t){return w.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,r)}));return[...n,...i]},[]),[e,t])}var Nl;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Nl||(Nl={}));var Up;(function(e){e.Optimized="optimized"})(Up||(Up={}));const gy=new Map;function L5(e,t){let{dragging:n,dependencies:r,config:s}=t;const[i,o]=w.useState(null),{frequency:a,measure:c,strategy:u}=s,d=w.useRef(e),f=S(),h=kl(f),p=w.useCallback(function(m){m===void 0&&(m=[]),!h.current&&o(y=>y===null?m:y.concat(m.filter(g=>!y.includes(g))))},[h]),x=w.useRef(null),b=Kl(m=>{if(f&&!n)return gy;if(!m||m===gy||d.current!==e||i!=null){const y=new Map;for(let g of e){if(!g)continue;if(i&&i.length>0&&!i.includes(g.id)&&g.rect.current){y.set(g.id,g.rect.current);continue}const v=g.node.current,N=v?new wg(c(v),v):null;g.rect.current=N,N&&y.set(g.id,N)}return y}return m},[e,i,n,f,c]);return w.useEffect(()=>{d.current=e},[e]),w.useEffect(()=>{f||p()},[n,f]),w.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),w.useEffect(()=>{f||typeof a!="number"||x.current!==null||(x.current=setTimeout(()=>{p(),x.current=null},a))},[a,f,p,...r]),{droppableRects:b,measureDroppableContainers:p,measuringScheduled:i!=null};function S(){switch(u){case Nl.Always:return!1;case Nl.BeforeDragging:return n;default:return!n}}}function Ng(e,t){return Kl(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function H5(e,t){return Ng(e,t)}function B5(e){let{callback:t,disabled:n}=e;const r=Qd(t),s=w.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return w.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Wd(e){let{callback:t,disabled:n}=e;const r=Qd(t),s=w.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return w.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function U5(e){return new wg(ha(e),e)}function xy(e,t,n){t===void 0&&(t=U5);const[r,s]=w.useState(null);function i(){s(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 o=B5({callback(c){if(e)for(const u of c){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=Wd({callback:i});return cr(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),r}function I5(e){const t=Ng(e);return z2(e,t)}const yy=[];function Z5(e){const t=w.useRef(e),n=Kl(r=>e?r&&r!==yy&&e&&t.current&&e.parentNode===t.current.parentNode?r:bg(e):yy,[e]);return w.useEffect(()=>{t.current=e},[e]),n}function Y5(e){const[t,n]=w.useState(null),r=w.useRef(e),s=w.useCallback(i=>{const o=vh(i.target);o&&n(a=>a?(a.set(o,Hp(o)),new Map(a)):null)},[]);return w.useEffect(()=>{const i=r.current;if(e!==i){o(i);const a=e.map(c=>{const u=vh(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,Hp(u)]):null}).filter(c=>c!=null);n(a.length?new Map(a):null),r.current=e}return()=>{o(e),o(i)};function o(a){a.forEach(c=>{const u=vh(c);u==null||u.removeEventListener("scroll",s)})}},[s,e]),w.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>Co(i,o),ur):B2(e):ur,[e,t])}function vy(e,t){t===void 0&&(t=[]);const n=w.useRef(null);return w.useEffect(()=>{n.current=null},t),w.useEffect(()=>{const r=e!==ur;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ud(e,n.current):ur}function q5(e){w.useEffect(()=>{if(!Fd)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function V5(e,t){return w.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=o=>{i(o,t)},n},{}),[e,t])}function Z2(e){return w.useMemo(()=>e?g5(e):null,[e])}const by=[];function G5(e,t){t===void 0&&(t=ha);const[n]=e,r=Z2(n?Kt(n):null),[s,i]=w.useState(by);function o(){i(()=>e.length?e.map(c=>L2(c)?r:new wg(t(c),c)):by)}const a=Wd({callback:o});return cr(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function Y2(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ql(t)?t:e}function X5(e){let{measure:t}=e;const[n,r]=w.useState(null),s=w.useCallback(u=>{for(const{target:d}of u)if(Ql(d)){r(f=>{const h=t(d);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),i=Wd({callback:s}),o=w.useCallback(u=>{const d=Y2(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),r(d?t(d):null)},[t,i]),[a,c]=ld(o);return w.useMemo(()=>({nodeRef:a,rect:n,setRef:c}),[n,a,c])}const P5=[{sensor:kg,options:{}},{sensor:Sg,options:{}}],F5={current:{}},Su={draggable:{measure:fy},droppable:{measure:fy,strategy:Nl.WhileDragging,frequency:Up.Optimized},dragOverlay:{measure:ha}};class al 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,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Q5={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new al,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:fd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Su,measureDroppableContainers:fd,windowRect:null,measuringScheduled:!1},q2={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:fd,draggableNodes:new Map,over:null,measureDroppableContainers:fd},Jl=w.createContext(q2),V2=w.createContext(Q5);function K5(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new al}}}function W5(e,t){switch(t.type){case vt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case vt.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 vt.DragEnd:case vt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case vt.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new al(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case vt.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new al(e.droppable.containers);return o.set(n,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case vt.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new al(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function J5(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=w.useContext(Jl),i=cd(r),o=cd(n==null?void 0:n.id);return w.useEffect(()=>{if(!t&&!r&&i&&o!=null){if(!Kd(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:c,node:u}=a;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=GA(d);if(f){f.focus();break}}})}},[r,t,s,o,i]),null}function G2(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...r}),n):n}function eC(e){return w.useMemo(()=>({draggable:{...Su.draggable,...e==null?void 0:e.draggable},droppable:{...Su.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Su.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 tC(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const i=w.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;cr(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=n(u),f=z2(d,r);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=R2(u);h&&h.scrollBy({top:f.y,left:f.x})}},[t,o,a,r,n])}const Jd=w.createContext({...ur,scaleX:1,scaleY:1});var js;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(js||(js={}));const nC=w.memo(function(t){var n,r,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:u,sensors:d=P5,collisionDetection:f=u5,measuring:h,modifiers:p,...x}=t;const b=w.useReducer(W5,void 0,K5),[S,m]=b,[y,g]=WA(),[v,N]=w.useState(js.Uninitialized),k=v===js.Initialized,{draggable:{active:T,nodes:z,translate:A},droppable:{containers:L}}=S,R=T!=null?z.get(T):null,H=w.useRef({initial:null,translated:null}),Y=w.useMemo(()=>{var qe;return T!=null?{id:T,data:(qe=R==null?void 0:R.data)!=null?qe:F5,rect:H}:null},[T,R]),_=w.useRef(null),[C,j]=w.useState(null),[D,O]=w.useState(null),$=kl(x,Object.values(x)),U=Wl("DndDescribedBy",o),X=w.useMemo(()=>L.getEnabled(),[L]),Z=eC(h),{droppableRects:B,measureDroppableContainers:E,measuringScheduled:q}=L5(X,{dragging:k,dependencies:[A.x,A.y],config:Z.droppable}),V=O5(z,T),J=w.useMemo(()=>D?dd(D):null,[D]),F=gr(),G=H5(V,Z.draggable.measure);tC({activeNode:T!=null?z.get(T):null,config:F.layoutShiftCompensation,initialRect:G,measure:Z.draggable.measure});const te=xy(V,Z.draggable.measure,G),le=xy(V?V.parentElement:null),ie=w.useRef({activatorEvent:null,active:null,activeNode:V,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:z,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=L.getNodeFor((n=ie.current.over)==null?void 0:n.id),oe=X5({measure:Z.dragOverlay.measure}),he=(r=oe.nodeRef.current)!=null?r:V,re=k?(s=oe.rect)!=null?s:te:null,W=!!(oe.nodeRef.current&&oe.rect),ge=I5(W?null:te),Ue=Z2(he?Kt(he):null),it=Z5(k?ce??V:null),yt=G5(it),hn=G2(p,{transform:{x:A.x-ge.x,y:A.y-ge.y,scaleX:1,scaleY:1},activatorEvent:D,active:Y,activeNodeRect:te,containerNodeRect:le,draggingNodeRect:re,over:ie.current.over,overlayNodeRect:oe.rect,scrollableAncestors:it,scrollableAncestorRects:yt,windowRect:Ue}),Dn=J?Co(J,A):null,Rr=Y5(it),Or=vy(Rr),Mt=vy(Rr,[te]),ut=Co(hn,Or),zt=re?h5(re,hn):null,Xn=Y&&zt?f({active:Y,collisionRect:zt,droppableRects:B,droppableContainers:X,pointerCoordinates:Dn}):null,Pn=a5(Xn,"id"),[qt,ms]=w.useState(null),pr=W?hn:Co(hn,Mt),gs=d5(pr,(i=qt==null?void 0:qt.rect)!=null?i:null,te),mr=w.useRef(null),ti=w.useCallback((qe,_t)=>{let{sensor:kt,options:pn}=_t;if(_.current==null)return;const Dt=z.get(_.current);if(!Dt)return;const Nt=qe.nativeEvent,Rt=new kt({active:_.current,activeNode:Dt,event:Nt,options:pn,context:ie,onAbort(Me){if(!z.get(Me))return;const{onDragAbort:It}=$.current,Vt={id:Me};It==null||It(Vt),y({type:"onDragAbort",event:Vt})},onPending(Me,Ot,It,Vt){if(!z.get(Me))return;const{onDragPending:xr}=$.current,Wt={id:Me,constraint:Ot,initialCoordinates:It,offset:Vt};xr==null||xr(Wt),y({type:"onDragPending",event:Wt})},onStart(Me){const Ot=_.current;if(Ot==null)return;const It=z.get(Ot);if(!It)return;const{onDragStart:Vt}=$.current,$r={activatorEvent:Nt,active:{id:Ot,data:It.data,rect:H}};xi.unstable_batchedUpdates(()=>{Vt==null||Vt($r),N(js.Initializing),m({type:vt.DragStart,initialCoordinates:Me,active:Ot}),y({type:"onDragStart",event:$r}),j(mr.current),O(Nt)})},onMove(Me){m({type:vt.DragMove,coordinates:Me})},onEnd:mn(vt.DragEnd),onCancel:mn(vt.DragCancel)});mr.current=Rt;function mn(Me){return async function(){const{active:It,collisions:Vt,over:$r,scrollAdjustedTranslate:xr}=ie.current;let Wt=null;if(It&&xr){const{cancelDrop:yr}=$.current;Wt={activatorEvent:Nt,active:It,collisions:Vt,delta:xr,over:$r},Me===vt.DragEnd&&typeof yr=="function"&&await Promise.resolve(yr(Wt))&&(Me=vt.DragCancel)}_.current=null,xi.unstable_batchedUpdates(()=>{m({type:Me}),N(js.Uninitialized),ms(null),j(null),O(null),mr.current=null;const yr=Me===vt.DragEnd?"onDragEnd":"onDragCancel";if(Wt){const Lr=$.current[yr];Lr==null||Lr(Wt),y({type:yr,event:Wt})}})}}},[z]),Yi=w.useCallback((qe,_t)=>(kt,pn)=>{const Dt=kt.nativeEvent,Nt=z.get(pn);if(_.current!==null||!Nt||Dt.dndKit||Dt.defaultPrevented)return;const Rt={active:Nt};qe(kt,_t.options,Rt)===!0&&(Dt.dndKit={capturedBy:_t.sensor},_.current=pn,ti(kt,_t))},[z,ti]),ni=$5(d,Yi);q5(d),cr(()=>{te&&v===js.Initializing&&N(js.Initialized)},[te,v]),w.useEffect(()=>{const{onDragMove:qe}=$.current,{active:_t,activatorEvent:kt,collisions:pn,over:Dt}=ie.current;if(!_t||!kt)return;const Nt={active:_t,activatorEvent:kt,collisions:pn,delta:{x:ut.x,y:ut.y},over:Dt};xi.unstable_batchedUpdates(()=>{qe==null||qe(Nt),y({type:"onDragMove",event:Nt})})},[ut.x,ut.y]),w.useEffect(()=>{const{active:qe,activatorEvent:_t,collisions:kt,droppableContainers:pn,scrollAdjustedTranslate:Dt}=ie.current;if(!qe||_.current==null||!_t||!Dt)return;const{onDragOver:Nt}=$.current,Rt=pn.get(Pn),mn=Rt&&Rt.rect.current?{id:Rt.id,rect:Rt.rect.current,data:Rt.data,disabled:Rt.disabled}:null,Me={active:qe,activatorEvent:_t,collisions:kt,delta:{x:Dt.x,y:Dt.y},over:mn};xi.unstable_batchedUpdates(()=>{ms(mn),Nt==null||Nt(Me),y({type:"onDragOver",event:Me})})},[Pn]),cr(()=>{ie.current={activatorEvent:D,active:Y,activeNode:V,collisionRect:zt,collisions:Xn,droppableRects:B,draggableNodes:z,draggingNode:he,draggingNodeRect:re,droppableContainers:L,over:qt,scrollableAncestors:it,scrollAdjustedTranslate:ut},H.current={initial:re,translated:zt}},[Y,V,Xn,zt,z,he,re,B,L,qt,it,ut]),z5({...F,delta:A,draggingRect:zt,pointerCoordinates:Dn,scrollableAncestors:it,scrollableAncestorRects:yt});const ri=w.useMemo(()=>({active:Y,activeNode:V,activeNodeRect:te,activatorEvent:D,collisions:Xn,containerNodeRect:le,dragOverlay:oe,draggableNodes:z,droppableContainers:L,droppableRects:B,over:qt,measureDroppableContainers:E,scrollableAncestors:it,scrollableAncestorRects:yt,measuringConfiguration:Z,measuringScheduled:q,windowRect:Ue}),[Y,V,te,D,Xn,le,oe,z,L,B,qt,E,it,yt,Z,q,Ue]),si=w.useMemo(()=>({activatorEvent:D,activators:ni,active:Y,activeNodeRect:te,ariaDescribedById:{draggable:U},dispatch:m,draggableNodes:z,over:qt,measureDroppableContainers:E}),[D,ni,Y,te,m,U,z,qt,E]);return Xe.createElement(M2.Provider,{value:g},Xe.createElement(Jl.Provider,{value:si},Xe.createElement(V2.Provider,{value:ri},Xe.createElement(Jd.Provider,{value:gs},u)),Xe.createElement(J5,{disabled:(a==null?void 0:a.restoreFocus)===!1})),Xe.createElement(t5,{...a,hiddenTextDescribedById:U}));function gr(){const qe=(C==null?void 0:C.autoScrollEnabled)===!1,_t=typeof c=="object"?c.enabled===!1:c===!1,kt=k&&!qe&&!_t;return typeof c=="object"?{...c,enabled:kt}:{enabled:kt}}}),rC=w.createContext(null),wy="button",sC="Draggable";function iC(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const i=Wl(sC),{activators:o,activatorEvent:a,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:h}=w.useContext(Jl),{role:p=wy,roleDescription:x="draggable",tabIndex:b=0}=s??{},S=(c==null?void 0:c.id)===t,m=w.useContext(S?Jd:rC),[y,g]=ld(),[v,N]=ld(),k=V5(o,t),T=kl(n);cr(()=>(f.set(t,{id:t,key:i,node:y,activatorNode:v,data:T}),()=>{const A=f.get(t);A&&A.key===i&&f.delete(t)}),[f,t]);const z=w.useMemo(()=>({role:p,tabIndex:b,"aria-disabled":r,"aria-pressed":S&&p===wy?!0:void 0,"aria-roledescription":x,"aria-describedby":d.draggable}),[r,p,b,S,x,d.draggable]);return{active:c,activatorEvent:a,activeNodeRect:u,attributes:z,isDragging:S,listeners:r?void 0:k,node:y,over:h,setNodeRef:g,setActivatorNodeRef:N,transform:m}}function X2(){return w.useContext(V2)}const oC="Droppable",aC={timeout:25};function P2(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const i=Wl(oC),{active:o,dispatch:a,over:c,measureDroppableContainers:u}=w.useContext(Jl),d=w.useRef({disabled:n}),f=w.useRef(!1),h=w.useRef(null),p=w.useRef(null),{disabled:x,updateMeasurementsFor:b,timeout:S}={...aC,...s},m=kl(b??r),y=w.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(m.current)?m.current:[m.current]),p.current=null},S)},[S]),g=Wd({callback:y,disabled:x||!o}),v=w.useCallback((z,A)=>{g&&(A&&(g.unobserve(A),f.current=!1),z&&g.observe(z))},[g]),[N,k]=ld(v),T=kl(t);return w.useEffect(()=>{!g||!N.current||(g.disconnect(),f.current=!1,g.observe(N.current))},[N,g]),w.useEffect(()=>(a({type:vt.RegisterDroppable,element:{id:r,key:i,disabled:n,node:N,rect:h,data:T}}),()=>a({type:vt.UnregisterDroppable,key:i,id:r})),[r]),w.useEffect(()=>{n!==d.current.disabled&&(a({type:vt.SetDroppableDisabled,id:r,key:i,disabled:n}),d.current.disabled=n)},[r,i,n,a]),{active:o,rect:h,isOver:(c==null?void 0:c.id)===r,node:N,over:c,setNodeRef:k}}function lC(e){let{animation:t,children:n}=e;const[r,s]=w.useState(null),[i,o]=w.useState(null),a=cd(n);return!n&&!r&&a&&s(a),cr(()=>{if(!i)return;const c=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(c==null||u==null){s(null);return}Promise.resolve(t(u,i)).then(()=>{s(null)})},[t,r,i]),Xe.createElement(Xe.Fragment,null,n,r?w.cloneElement(r,{ref:o}):null)}const cC={x:0,y:0,scaleX:1,scaleY:1};function uC(e){let{children:t}=e;return Xe.createElement(Jl.Provider,{value:q2},Xe.createElement(Jd.Provider,{value:cC},t))}const dC={position:"fixed",touchAction:"none"},fC=e=>Kd(e)?"transform 250ms ease":void 0,hC=w.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:s,children:i,className:o,rect:a,style:c,transform:u,transition:d=fC}=e;if(!a)return null;const f=s?u:{...u,scaleX:1,scaleY:1},h={...dC,width:a.width,height:a.height,top:a.top,left:a.left,transform:Qs.Transform.toString(f),transformOrigin:s&&r?s5(r,a):void 0,transition:typeof d=="function"?d(r):d,...c};return Xe.createElement(n,{className:o,style:h,ref:t},i)}),pC=e=>t=>{let{active:n,dragOverlay:r}=t;const s={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[a,c]of Object.entries(i.active))c!==void 0&&(s[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,c));if(i!=null&&i.dragOverlay)for(const[a,c]of Object.entries(i.dragOverlay))c!==void 0&&r.node.style.setProperty(a,c);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(const[c,u]of Object.entries(s))n.node.style.setProperty(c,u);o!=null&&o.active&&n.node.classList.remove(o.active)}},mC=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Qs.Transform.toString(t)},{transform:Qs.Transform.toString(n)}]},gC={duration:250,easing:"ease",keyframes:mC,sideEffects:pC({styles:{active:{opacity:"0"}}})};function xC(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=e;return Qd((i,o)=>{if(t===null)return;const a=n.get(i);if(!a)return;const c=a.node.current;if(!c)return;const u=Y2(o);if(!u)return;const{transform:d}=Kt(o).getComputedStyle(o),f=D2(d);if(!f)return;const h=typeof t=="function"?t:yC(t);return U2(c,s.draggable.measure),h({active:{id:i,data:a.data,node:c,rect:s.draggable.measure(c)},draggableNodes:n,dragOverlay:{node:o,rect:s.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:s,transform:f})})}function yC(e){const{duration:t,easing:n,sideEffects:r,keyframes:s}={...gC,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...u}=i;if(!t)return;const d={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},f={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/a.rect.height:1},h={x:c.x-d.x,y:c.y-d.y,...f},p=s({...u,active:o,dragOverlay:a,transform:{initial:c,final:h}}),[x]=p,b=p[p.length-1];if(JSON.stringify(x)===JSON.stringify(b))return;const S=r==null?void 0:r({active:o,dragOverlay:a,...u}),m=a.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{m.onfinish=()=>{S==null||S(),y()}})}}let Sy=0;function vC(e){return w.useMemo(()=>{if(e!=null)return Sy++,Sy},[e])}const bC=Xe.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:u=999}=e;const{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:x,droppableContainers:b,dragOverlay:S,over:m,measuringConfiguration:y,scrollableAncestors:g,scrollableAncestorRects:v,windowRect:N}=X2(),k=w.useContext(Jd),T=vC(f==null?void 0:f.id),z=G2(o,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:S.rect,over:m,overlayNodeRect:S.rect,scrollableAncestors:g,scrollableAncestorRects:v,transform:k,windowRect:N}),A=Ng(h),L=xC({config:r,draggableNodes:x,droppableContainers:b,measuringConfiguration:y}),R=A?S.setRef:void 0;return Xe.createElement(uC,null,Xe.createElement(lC,{animation:L},f&&T?Xe.createElement(hC,{key:T,id:f.id,ref:R,as:a,activatorEvent:d,adjustScale:t,className:c,transition:i,rect:A,style:{zIndex:u,...s},transform:z},n):null))});function F2(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function wC(e,t){return e.reduce((n,r,s)=>{const i=t.get(r);return i&&(n[s]=i),n},Array(e.length))}function qc(e){return e!==null&&e>=0}function SC(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 _C(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Q2=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const i=F2(t,r,n),o=t[s],a=i[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},Vc={scaleX:1,scaleY:1},kC=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:i,overIndex:o}=e;const a=(t=i[n])!=null?t:r;if(!a)return null;if(s===n){const u=i[o];return u?{x:0,y:n<o?u.top+u.height-(a.top+a.height):u.top-a.top,...Vc}:null}const c=NC(i,s,n);return s>n&&s<=o?{x:0,y:-a.height-c,...Vc}:s<n&&s>=o?{x:0,y:a.height+c,...Vc}:{x:0,y:0,...Vc}};function NC(e,t,n){const r=e[t],s=e[t-1],i=e[t+1];return r?n<t?s?r.top-(s.top+s.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const K2="Sortable",W2=Xe.createContext({activeIndex:-1,containerId:K2,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Q2,disabled:{draggable:!1,droppable:!1}});function jC(e){let{children:t,id:n,items:r,strategy:s=Q2,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:u,measureDroppableContainers:d}=X2(),f=Wl(K2,n),h=a.rect!==null,p=w.useMemo(()=>r.map(k=>typeof k=="object"&&"id"in k?k.id:k),[r]),x=o!=null,b=o?p.indexOf(o.id):-1,S=u?p.indexOf(u.id):-1,m=w.useRef(p),y=!SC(p,m.current),g=S!==-1&&b===-1||y,v=_C(i);cr(()=>{y&&x&&d(p)},[y,p,x,d]),w.useEffect(()=>{m.current=p},[p]);const N=w.useMemo(()=>({activeIndex:b,containerId:f,disabled:v,disableTransforms:g,items:p,overIndex:S,useDragOverlay:h,sortedRects:wC(p,c),strategy:s}),[b,f,v.draggable,v.droppable,g,p,S,c,h,s]);return Xe.createElement(W2.Provider,{value:N},t)}const EC=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return F2(n,r,s).indexOf(t)},TC=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:i,newIndex:o,previousItems:a,previousContainerId:c,transition:u}=e;return!u||!r||a!==i&&s===o?!1:n?!0:o!==s&&t===c},AC={duration:200,easing:"ease"},J2="transform",CC=Qs.Transition.toString({property:J2,duration:0,easing:"linear"}),MC={roleDescription:"sortable"};function zC(e){let{disabled:t,index:n,node:r,rect:s}=e;const[i,o]=w.useState(null),a=w.useRef(n);return cr(()=>{if(!t&&n!==a.current&&r.current){const c=s.current;if(c){const u=ha(r.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)&&o(d)}}n!==a.current&&(a.current=n)},[t,n,r,s]),w.useEffect(()=>{i&&o(null)},[i]),i}function DC(e){let{animateLayoutChanges:t=TC,attributes:n,disabled:r,data:s,getNewIndex:i=EC,id:o,strategy:a,resizeObserverConfig:c,transition:u=AC}=e;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:x,sortedRects:b,overIndex:S,useDragOverlay:m,strategy:y}=w.useContext(W2),g=RC(r,p),v=d.indexOf(o),N=w.useMemo(()=>({sortable:{containerId:f,index:v,items:d},...s}),[f,s,v,d]),k=w.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:T,node:z,isOver:A,setNodeRef:L}=P2({id:o,data:N,disabled:g.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...c}}),{active:R,activatorEvent:H,activeNodeRect:Y,attributes:_,setNodeRef:C,listeners:j,isDragging:D,over:O,setActivatorNodeRef:$,transform:U}=iC({id:o,data:N,attributes:{...MC,...n},disabled:g.draggable}),X=ZA(L,C),Z=!!R,B=Z&&!x&&qc(h)&&qc(S),E=!m&&D,q=E&&B?U:null,J=B?q??(a??y)({rects:b,activeNodeRect:Y,activeIndex:h,overIndex:S,index:v}):null,F=qc(h)&&qc(S)?i({id:o,items:d,activeIndex:h,overIndex:S}):v,G=R==null?void 0:R.id,te=w.useRef({activeId:G,items:d,newIndex:F,containerId:f}),le=d!==te.current.items,ie=t({active:R,containerId:f,isDragging:D,isSorting:Z,id:o,index:v,items:d,newIndex:te.current.newIndex,previousItems:te.current.items,previousContainerId:te.current.containerId,transition:u,wasDragging:te.current.activeId!=null}),ce=zC({disabled:!ie,index:v,node:z,rect:T});return w.useEffect(()=>{Z&&te.current.newIndex!==F&&(te.current.newIndex=F),f!==te.current.containerId&&(te.current.containerId=f),d!==te.current.items&&(te.current.items=d)},[Z,F,f,d]),w.useEffect(()=>{if(G===te.current.activeId)return;if(G!=null&&te.current.activeId==null){te.current.activeId=G;return}const he=setTimeout(()=>{te.current.activeId=G},50);return()=>clearTimeout(he)},[G]),{active:R,activeIndex:h,attributes:_,data:N,rect:T,index:v,newIndex:F,items:d,isOver:A,isSorting:Z,isDragging:D,listeners:j,node:z,overIndex:S,over:O,setNodeRef:X,setActivatorNodeRef:$,setDroppableNodeRef:L,setDraggableNodeRef:C,transform:ce??J,transition:oe()};function oe(){if(ce||le&&te.current.newIndex===v)return CC;if(!(E&&!Kd(H)||!u)&&(Z||ie))return Qs.Transition.toString({...u,property:J2})}}function RC(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}Te.Down,Te.Right,Te.Up,Te.Left;const jg=[{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"}],_y=new Map(jg.map(e=>[e.id,e]));function _u(e){for(const t of jg)if(t.statuses.includes(e))return t.id;return null}function OC(e){const t=new Map;for(const n of e){const r=_u(n.status);r&&t.set(n.id,r)}return t}const ky=["canceled","failed"],$C={critical:"var(--red)",high:"var(--yellow)",medium:"var(--muted)",low:"var(--green)"},Eg={human:"H",agent:"A",notify:"N"};function LC({task:e}){const t=$C[e.priority]||"var(--muted)",n=e.scheduled_at?new Date(e.scheduled_at).toLocaleDateString(void 0,{month:"short",day:"numeric"}):null;return l.jsxs("div",{className:"glass-card rounded-xl p-3 mb-2 w-[256px] select-none",children:[l.jsx("div",{className:"flex items-center justify-between mb-1.5",children:l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"currentColor",className:"text-muted2",children:[l.jsx("circle",{cx:"3",cy:"2",r:"1"}),l.jsx("circle",{cx:"9",cy:"2",r:"1"}),l.jsx("circle",{cx:"3",cy:"6",r:"1"}),l.jsx("circle",{cx:"9",cy:"6",r:"1"}),l.jsx("circle",{cx:"3",cy:"10",r:"1"}),l.jsx("circle",{cx:"9",cy:"10",r:"1"})]}),l.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:t}})]})}),l.jsx("div",{className:"text-[12.5px] font-medium text-fg mb-1.5 leading-snug line-clamp-3",children:e.title}),l.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[l.jsxs("span",{className:"text-[9px] font-mono font-bold px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:["[",Eg[e.mode]||"?","]"]}),e.scope==="project"&&l.jsx("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:"proj"}),n&&l.jsx("span",{className:"text-[9px] text-muted2",children:n}),e.tags.slice(0,3).map(r=>l.jsx("span",{className:"leather-tag text-[9px] px-1.5 py-0.5 rounded-full text-muted",children:r},r)),e.tags.length>3&&l.jsxs("span",{className:"text-[9px] text-muted2",children:["+",e.tags.length-3]})]})]})}function HC({task:e,onEdit:t,onRemove:n}){const{attributes:r,listeners:s,setNodeRef:i,transform:o,isDragging:a}=DC({id:e.id,animateLayoutChanges:()=>!1}),c={transform:Qs.Transform.toString(o),opacity:a?0:1};return l.jsxs("div",{ref:i,style:c,className:"cursor-grab active:cursor-grabbing",...r,...s,onClick:()=>t(e),children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("div",{}),l.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:l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),l.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}),l.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap px-3 pb-2",children:[l.jsxs("span",{className:"text-[9px] font-mono font-bold px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:["[",Eg[e.mode]||"?","]"]}),e.scope==="project"&&l.jsx("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:"proj"}),e.scheduled_at&&l.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=>l.jsx("span",{className:"leather-tag text-[9px] px-1.5 py-0.5 rounded-full text-muted",children:u},u)),e.tags.length>3&&l.jsxs("span",{className:"text-[9px] text-muted2",children:["+",e.tags.length-3]})]})]})}function BC({column:e,tasks:t,isDragging:n,onEdit:r,onRemove:s,className:i=""}){const{setNodeRef:o,isOver:a}=P2({id:e.id}),c=function(u){return l.jsx(HC,{task:u,onEdit:r,onRemove:s},u.id)};return l.jsxs("div",{className:`flex flex-col h-full min-w-[260px] sm:flex-1 ${i}`,children:[l.jsx("div",{className:"flex items-center justify-between px-3 py-2.5 shrink-0",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[12px] font-semibold font-display",style:{color:"var(--gold)"},children:e.label}),l.jsx("span",{className:"text-[10px] font-mono text-muted bg-s3 px-1.5 py-0.5 rounded",children:t.length})]})}),l.jsxs("div",{ref:o,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:a?"color-mix(in srgb, var(--gold) 8%, transparent)":"transparent"},children:[t.map(c),t.length===0&&l.jsx("div",{className:"text-center py-8 text-[11px] text-muted2 min-h-[120px] flex items-center justify-center",children:"No tasks"})]})]})}function Ny({task:e,onSave:t,onClose:n}){const[r,s]=w.useState((e==null?void 0:e.title)??""),[i,o]=w.useState((e==null?void 0:e.description)??""),[a,c]=w.useState((e==null?void 0:e.priority)??"medium"),[u,d]=w.useState((e==null?void 0:e.mode)??"human"),[f,h]=w.useState((e==null?void 0:e.scope)??"personal"),[p,x]=w.useState((e==null?void 0:e.status)??"backlog"),[b,S]=w.useState(()=>{if(e!=null&&e.scheduled_at){const v=new Date(e.scheduled_at),N=v.getTimezoneOffset()*6e4;return new Date(v.getTime()-N).toISOString().slice(0,16)}return""}),[m,y]=w.useState((e==null?void 0:e.tags.join(", "))??""),g=()=>{r.trim()&&t({title:r.trim(),description:i.trim(),priority:a,mode:u,scope:f,status:p,tags:m.split(",").map(v=>v.trim()).filter(Boolean),scheduled_at:b?new Date(b).getTime():void 0})};return l.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:l.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:[l.jsxs("div",{className:"flex items-center justify-between pb-3 mb-4",style:{borderBottom:"1px solid var(--b1)"},children:[l.jsx("span",{className:"font-bold text-[13.5px] font-display",style:{color:"var(--cream)"},children:e?"Edit Task":"New Task"}),l.jsx("button",{onClick:n,className:"text-muted hover:text-fg transition-colors cursor-pointer",children:l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Title"}),l.jsx("input",{type:"text",value:r,onChange:v=>s(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})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Description"}),l.jsx("textarea",{value:i,onChange:v=>o(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)"}})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Priority"}),l.jsxs("select",{value:a,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:[l.jsx("option",{value:"low",children:"Low"}),l.jsx("option",{value:"medium",children:"Medium"}),l.jsx("option",{value:"high",children:"High"}),l.jsx("option",{value:"critical",children:"Critical"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Mode"}),l.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:[l.jsx("option",{value:"human",children:"Human"}),l.jsx("option",{value:"agent",children:"Agent"}),l.jsx("option",{value:"notify",children:"Notify"})]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Scope"}),l.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:[l.jsx("option",{value:"personal",children:"Personal"}),l.jsx("option",{value:"project",children:"Project"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Status"}),l.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:[l.jsx("option",{value:"backlog",children:"Backlog"}),l.jsx("option",{value:"todo",children:"To Do"}),l.jsx("option",{value:"in_progress",children:"In Progress"}),l.jsx("option",{value:"done",children:"Done"})]})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Scheduled (optional)"}),l.jsx("input",{type:"datetime-local",value:b,onChange:v=>S(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)"}})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Tags (comma-separated)"}),l.jsx("input",{type:"text",value:m,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)"}})]})]}),l.jsxs("div",{className:"flex gap-2 mt-5",children:[l.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"}),l.jsx("button",{onClick:g,disabled:!r.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 UC({rpc:e,className:t}){const{ws:n}=fr(),[r,s]=w.useState([]),[i,o]=w.useState(!0),[a,c]=w.useState(null),[u,d]=w.useState(!1),[f,h]=w.useState(!1),[p,x]=w.useState("all"),[b,S]=w.useState("all"),[m,y]=w.useState("all"),[g,v]=w.useState(!1),N=w.useRef(null),[k,T]=w.useState({top:0,left:0}),[z,A]=w.useState(null),L=w.useCallback(async()=>{if(e)try{const E={};p!=="all"&&(E.mode=p),b!=="all"&&(E.priority=b),m!=="all"&&(E.scope=m);const q=await e.todoList(Object.keys(E).length?E:void 0);s(Array.isArray(q)?q:[])}catch(E){console.error("[Kanban] Failed to fetch tasks:",E)}finally{o(!1)}},[e,p,b,m]);w.useEffect(()=>{L()},[L]),w.useEffect(()=>{if(!n)return;const E=()=>L(),q=n.on("todo-changed",E),V=n.on("cron-task-fired",E);return()=>{q(),V()}},[n,L]),w.useEffect(()=>{if(!g)return;const E=q=>{q.target.closest("[data-filter-dropdown]")||v(!1)};return document.addEventListener("click",E),()=>document.removeEventListener("click",E)},[g]);const R=w.useMemo(()=>{const E={backlog:[],todo:[],in_progress:[],done:[]};for(const q of r){if(q.mode==="notify")continue;const V=_u(q.status);V&&E[V]&&E[V].push(q)}return Object.values(E).forEach(q=>q.sort((V,J)=>V.order-J.order)),E},[r]),H=w.useMemo(()=>r.filter(E=>ky.includes(E.status)),[r]),Y=w.useMemo(()=>OC(r),[r]),_=w.useMemo(()=>{const E={backlog:[],todo:[],in_progress:[],done:[]};for(const q of r){if(q.mode==="notify")continue;const V=_u(q.status);V&&!ky.includes(q.status)&&E[V].push(q.id)}return E},[r]),C=n5(uy(kg,{activationConstraint:{delay:250,tolerance:5}}),uy(Sg)),[j,D]=w.useState(!1),O=w.useCallback(E=>{D(!0),A(String(E.active.id))},[]),$=w.useCallback(()=>{D(!1),A(null)},[]),U=w.useCallback(async E=>{const{active:q,over:V}=E;if(!V||!e){D(!1),A(null);return}const J=String(q.id),F=String(V.id),G=r.find(he=>he.id===J);if(!G){D(!1),A(null);return}if(!Y.get(J)){D(!1),A(null);return}let le=G.status;const ie=_y.get(F);if(ie)le=ie.defaultStatus;else{const he=r.find(re=>re.id===F);if(he){const re=_u(he.status);re&&(le=_y.get(re).defaultStatus)}}if(G.status!==le){const he=G.status;s(re=>re.map(W=>W.id===J?{...W,status:le}:W));try{await e.todoUpdate({id:J,status:le})}catch{s(re=>re.map(W=>W.id===J?{...W,status:he}:W))}}else try{await e.todoUpdate({id:J})}catch{}A(null),D(!1)},[e,r,Y]),X=w.useCallback(async E=>{e&&(await e.todoCreate({title:(E.title??"").trim(),description:E.description,priority:E.priority??"medium",mode:E.mode??"human",scope:E.scope??"personal",status:E.status??"backlog",tags:E.tags,scheduled_at:E.scheduled_at}),h(!1))},[e]),Z=w.useCallback(async E=>{!e||!a||(await e.todoUpdate({id:a.id,...E}),c(null))},[e,a]),B=w.useCallback(async E=>{e&&await e.todoRemove(E)},[e]);return i?l.jsx("div",{className:t||"",children:l.jsx("div",{className:"flex items-center justify-center h-full text-muted text-xs",children:"Loading tasks..."})}):l.jsxs("div",{className:`flex flex-col h-full ${t||""}`,children:[l.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:[l.jsx("h2",{className:"text-[13px] font-semibold font-display",style:{color:"var(--cream)"},children:"Tasks"}),l.jsxs("div",{className:"relative","data-filter-dropdown":!0,children:[l.jsx("button",{ref:N,onClick:()=>{if(!g&&N.current){const E=N.current.getBoundingClientRect(),q=200;let V=E.left;V+q>window.innerWidth-8&&(V=window.innerWidth-q-8),T({top:E.bottom+4,left:Math.max(V,8)})}v(!g)},className:"p-1.5 rounded-lg cursor-pointer transition-colors",style:{background:p!=="all"||b!=="all"||m!=="all"?"var(--s3)":"transparent",border:"1px solid var(--b2)",color:"var(--muted)"},children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:l.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})})}),g&&xi.createPortal(l.jsxs("div",{"data-filter-dropdown":!0,className:"fixed rounded-xl shadow-2xl p-3 space-y-2.5 w-[200px]",style:{top:k.top,left:k.left,background:"var(--s1)",border:"1px solid var(--b1)",zIndex:9999},children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[9px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Mode"}),l.jsx("div",{className:"flex rounded-lg overflow-hidden",style:{border:"1px solid var(--b2)"},children:["all","human","agent","notify"].map(E=>l.jsx("button",{onClick:()=>{x(E),v(!1)},className:"flex-1 px-1.5 py-1 text-[10px] font-mono cursor-pointer transition-all",style:{color:p===E?"var(--gold)":"var(--muted)",background:p===E?"var(--s3)":"transparent"},children:E==="all"?"All":E.charAt(0).toUpperCase()+E.slice(1)},E))})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[9px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Priority"}),l.jsxs("select",{value:b,onChange:E=>{S(E.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:[l.jsx("option",{value:"all",children:"All"}),l.jsx("option",{value:"low",children:"Low"}),l.jsx("option",{value:"medium",children:"Medium"}),l.jsx("option",{value:"high",children:"High"}),l.jsx("option",{value:"critical",children:"Critical"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[9px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Scope"}),l.jsx("div",{className:"flex rounded-lg overflow-hidden",style:{border:"1px solid var(--b2)"},children:["all","personal","project"].map(E=>l.jsx("button",{onClick:()=>{y(E),v(!1)},className:"flex-1 px-1.5 py-1 text-[10px] font-mono cursor-pointer transition-all",style:{color:m===E?"var(--gold)":"var(--muted)",background:m===E?"var(--s3)":"transparent"},children:E==="all"?"All":E.charAt(0).toUpperCase()+E.slice(1)},E))})]})]}),document.body)]}),l.jsx("div",{className:"flex-1"}),l.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 ",H.length]}),l.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"})]}),l.jsxs(nC,{sensors:C,collisionDetection:l5,onDragStart:O,onDragCancel:$,onDragEnd:U,children:[l.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:l.jsx("div",{className:"flex h-full sm:gap-4 sm:flex-row flex-nowrap sm:min-w-0",children:jg.map(E=>l.jsx(jC,{items:_[E.id],strategy:kC,children:l.jsx(BC,{column:E,tasks:R[E.id],isDragging:j,onEdit:c,onRemove:B,className:"snap-center flex-shrink-0 w-screen sm:w-auto sm:flex-1 px-4 sm:px-0"})},E.id))})}),l.jsx(bC,{children:z&&l.jsx(LC,{task:r.find(E=>E.id===z)})})]}),u&&H.length>0&&l.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderTop:"1px solid var(--b1)"},children:[l.jsx("h3",{className:"text-[11px] font-semibold text-muted mb-2",children:"Archived Tasks"}),l.jsx("div",{className:"flex gap-2 flex-wrap",children:H.map(E=>l.jsxs("div",{className:"glass-card rounded-lg px-3 py-2 flex items-center gap-2",style:{opacity:.6},children:[l.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:E.status==="failed"?"var(--red)":"var(--muted2)"}}),l.jsx("span",{className:"text-[11px] text-muted line-through",children:E.title}),l.jsxs("span",{className:"text-[9px] font-mono text-muted2",children:["[",Eg[E.mode],"]"]})]},E.id))})]}),f&&l.jsx(Ny,{task:null,onSave:X,onClose:()=>h(!1)}),a&&l.jsx(Ny,{task:a,onSave:Z,onClose:()=>c(null)})]})}function xt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=xt(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var IC={value:()=>{}};function ef(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new ku(n)}function ku(e){this._=e}function ZC(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}ku.prototype=ef.prototype={constructor:ku,on:function(e,t){var n=this._,r=ZC(e+"",n),s,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((s=(e=r[i]).type)&&(s=YC(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<o;)if(s=(e=r[i]).type)n[s]=jy(n[s],e.name,t);else if(t==null)for(s in n)n[s]=jy(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ku(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)}};function YC(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function jy(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=IC,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ip="http://www.w3.org/1999/xhtml";const Ey={svg:"http://www.w3.org/2000/svg",xhtml:Ip,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function tf(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Ey.hasOwnProperty(t)?{space:Ey[t],local:e}:e}function qC(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ip&&t.documentElement.namespaceURI===Ip?t.createElement(e):t.createElementNS(n,e)}}function VC(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function eS(e){var t=tf(e);return(t.local?VC:qC)(t)}function GC(){}function Tg(e){return e==null?GC:function(){return this.querySelector(e)}}function XC(e){typeof e!="function"&&(e=Tg(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,a=r[s]=new Array(o),c,u,d=0;d<o;++d)(c=i[d])&&(u=e.call(c,c.__data__,d,i))&&("__data__"in c&&(u.__data__=c.__data__),a[d]=u);return new Mn(r,this._parents)}function PC(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function FC(){return[]}function tS(e){return e==null?FC:function(){return this.querySelectorAll(e)}}function QC(e){return function(){return PC(e.apply(this,arguments))}}function KC(e){typeof e=="function"?e=QC(e):e=tS(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var o=t[i],a=o.length,c,u=0;u<a;++u)(c=o[u])&&(r.push(e.call(c,c.__data__,u,o)),s.push(c));return new Mn(r,s)}function nS(e){return function(){return this.matches(e)}}function rS(e){return function(t){return t.matches(e)}}var WC=Array.prototype.find;function JC(e){return function(){return WC.call(this.children,e)}}function e3(){return this.firstElementChild}function t3(e){return this.select(e==null?e3:JC(typeof e=="function"?e:rS(e)))}var n3=Array.prototype.filter;function r3(){return Array.from(this.children)}function s3(e){return function(){return n3.call(this.children,e)}}function i3(e){return this.selectAll(e==null?r3:s3(typeof e=="function"?e:rS(e)))}function o3(e){typeof e!="function"&&(e=nS(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,a=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&a.push(c);return new Mn(r,this._parents)}function sS(e){return new Array(e.length)}function a3(){return new Mn(this._enter||this._groups.map(sS),this._parents)}function pd(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}pd.prototype={constructor:pd,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 l3(e){return function(){return e}}function c3(e,t,n,r,s,i){for(var o=0,a,c=t.length,u=i.length;o<u;++o)(a=t[o])?(a.__data__=i[o],r[o]=a):n[o]=new pd(e,i[o]);for(;o<c;++o)(a=t[o])&&(s[o]=a)}function u3(e,t,n,r,s,i,o){var a,c,u=new Map,d=t.length,f=i.length,h=new Array(d),p;for(a=0;a<d;++a)(c=t[a])&&(h[a]=p=o.call(c,c.__data__,a,t)+"",u.has(p)?s[a]=c:u.set(p,c));for(a=0;a<f;++a)p=o.call(e,i[a],a,i)+"",(c=u.get(p))?(r[a]=c,c.__data__=i[a],u.delete(p)):n[a]=new pd(e,i[a]);for(a=0;a<d;++a)(c=t[a])&&u.get(h[a])===c&&(s[a]=c)}function d3(e){return e.__data__}function f3(e,t){if(!arguments.length)return Array.from(this,d3);var n=t?u3:c3,r=this._parents,s=this._groups;typeof e!="function"&&(e=l3(e));for(var i=s.length,o=new Array(i),a=new Array(i),c=new Array(i),u=0;u<i;++u){var d=r[u],f=s[u],h=f.length,p=h3(e.call(d,d&&d.__data__,u,r)),x=p.length,b=a[u]=new Array(x),S=o[u]=new Array(x),m=c[u]=new Array(h);n(d,f,b,S,m,p,t);for(var y=0,g=0,v,N;y<x;++y)if(v=b[y]){for(y>=g&&(g=y+1);!(N=S[g])&&++g<x;);v._next=N||null}}return o=new Mn(o,r),o._enter=a,o._exit=c,o}function h3(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function p3(){return new Mn(this._exit||this._groups.map(sS),this._parents)}function m3(e,t,n){var r=this.enter(),s=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function g3(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,o=Math.min(s,i),a=new Array(s),c=0;c<o;++c)for(var u=n[c],d=r[c],f=u.length,h=a[c]=new Array(f),p,x=0;x<f;++x)(p=u[x]||d[x])&&(h[x]=p);for(;c<s;++c)a[c]=n[c];return new Mn(a,this._parents)}function x3(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,i=r[s],o;--s>=0;)(o=r[s])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function y3(e){e||(e=v3);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var o=n[i],a=o.length,c=s[i]=new Array(a),u,d=0;d<a;++d)(u=o[d])&&(c[d]=u);c.sort(t)}return new Mn(s,this._parents).order()}function v3(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function b3(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function w3(){return Array.from(this)}function S3(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length;s<i;++s){var o=r[s];if(o)return o}return null}function _3(){let e=0;for(const t of this)++e;return e}function k3(){return!this.node()}function N3(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],i=0,o=s.length,a;i<o;++i)(a=s[i])&&e.call(a,a.__data__,i,s);return this}function j3(e){return function(){this.removeAttribute(e)}}function E3(e){return function(){this.removeAttributeNS(e.space,e.local)}}function T3(e,t){return function(){this.setAttribute(e,t)}}function A3(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function C3(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function M3(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=tf(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?E3:j3:typeof t=="function"?n.local?M3:C3:n.local?A3:T3)(n,t))}function iS(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function D3(e){return function(){this.style.removeProperty(e)}}function R3(e,t,n){return function(){this.style.setProperty(e,t,n)}}function O3(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function $3(e,t,n){return arguments.length>1?this.each((t==null?D3:typeof t=="function"?O3:R3)(e,t,n??"")):Vo(this.node(),e)}function Vo(e,t){return e.style.getPropertyValue(t)||iS(e).getComputedStyle(e,null).getPropertyValue(t)}function L3(e){return function(){delete this[e]}}function H3(e,t){return function(){this[e]=t}}function B3(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function U3(e,t){return arguments.length>1?this.each((t==null?L3:typeof t=="function"?B3:H3)(e,t)):this.node()[e]}function oS(e){return e.trim().split(/^|\s+/)}function Ag(e){return e.classList||new aS(e)}function aS(e){this._node=e,this._names=oS(e.getAttribute("class")||"")}aS.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 lS(e,t){for(var n=Ag(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function cS(e,t){for(var n=Ag(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function I3(e){return function(){lS(this,e)}}function Z3(e){return function(){cS(this,e)}}function Y3(e,t){return function(){(t.apply(this,arguments)?lS:cS)(this,e)}}function q3(e,t){var n=oS(e+"");if(arguments.length<2){for(var r=Ag(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?Y3:t?I3:Z3)(n,t))}function V3(){this.textContent=""}function G3(e){return function(){this.textContent=e}}function X3(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function P3(e){return arguments.length?this.each(e==null?V3:(typeof e=="function"?X3:G3)(e)):this.node().textContent}function F3(){this.innerHTML=""}function Q3(e){return function(){this.innerHTML=e}}function K3(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function W3(e){return arguments.length?this.each(e==null?F3:(typeof e=="function"?K3:Q3)(e)):this.node().innerHTML}function J3(){this.nextSibling&&this.parentNode.appendChild(this)}function eM(){return this.each(J3)}function tM(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function nM(){return this.each(tM)}function rM(e){var t=typeof e=="function"?e:eS(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function sM(){return null}function iM(e,t){var n=typeof e=="function"?e:eS(e),r=t==null?sM:typeof t=="function"?t:Tg(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function oM(){var e=this.parentNode;e&&e.removeChild(this)}function aM(){return this.each(oM)}function lM(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function cM(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function uM(e){return this.select(e?cM:lM)}function dM(e){return arguments.length?this.property("__data__",e):this.node().__data__}function fM(e){return function(t){e.call(this,t,this.__data__)}}function hM(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function pM(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n<s;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function mM(e,t,n){return function(){var r=this.__on,s,i=fM(t);if(r){for(var o=0,a=r.length;o<a;++o)if((s=r[o]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=t;return}}this.addEventListener(e.type,i,n),s={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(s):this.__on=[s]}}function gM(e,t,n){var r=hM(e+""),s,i=r.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,u=a.length,d;c<u;++c)for(s=0,d=a[c];s<i;++s)if((o=r[s]).type===d.type&&o.name===d.name)return d.value}return}for(a=t?mM:pM,s=0;s<i;++s)this.each(a(r[s],t,n));return this}function uS(e,t,n){var r=iS(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function xM(e,t){return function(){return uS(this,e,t)}}function yM(e,t){return function(){return uS(this,e,t.apply(this,arguments))}}function vM(e,t){return this.each((typeof t=="function"?yM:xM)(e,t))}function*bM(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length,o;s<i;++s)(o=r[s])&&(yield o)}var dS=[null];function Mn(e,t){this._groups=e,this._parents=t}function ec(){return new Mn([[document.documentElement]],dS)}function wM(){return this}Mn.prototype=ec.prototype={constructor:Mn,select:XC,selectAll:KC,selectChild:t3,selectChildren:i3,filter:o3,data:f3,enter:a3,exit:p3,join:m3,merge:g3,selection:wM,order:x3,sort:y3,call:b3,nodes:w3,node:S3,size:_3,empty:k3,each:N3,attr:z3,style:$3,property:U3,classed:q3,text:P3,html:W3,raise:eM,lower:nM,append:rM,insert:iM,remove:aM,clone:uM,datum:dM,on:gM,dispatch:vM,[Symbol.iterator]:bM};function _n(e){return typeof e=="string"?new Mn([[document.querySelector(e)]],[document.documentElement]):new Mn([[e]],dS)}function SM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function tr(e,t){if(e=SM(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const _M={passive:!1},jl={capture:!0,passive:!1};function Sh(e){e.stopImmediatePropagation()}function Mo(e){e.preventDefault(),e.stopImmediatePropagation()}function fS(e){var t=e.document.documentElement,n=_n(e).on("dragstart.drag",Mo,jl);"onselectstart"in t?n.on("selectstart.drag",Mo,jl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function hS(e,t){var n=e.document.documentElement,r=_n(e).on("dragstart.drag",null);t&&(r.on("click.drag",Mo,jl),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Gc=e=>()=>e;function Zp(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:o,y:a,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:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}Zp.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function kM(e){return!e.ctrlKey&&!e.button}function NM(){return this.parentNode}function jM(e,t){return t??{x:e.x,y:e.y}}function EM(){return navigator.maxTouchPoints||"ontouchstart"in this}function pS(){var e=kM,t=NM,n=jM,r=EM,s={},i=ef("start","drag","end"),o=0,a,c,u,d,f=0;function h(v){v.on("mousedown.drag",p).filter(r).on("touchstart.drag",S).on("touchmove.drag",m,_M).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(v,N){if(!(d||!e.call(this,v,N))){var k=g(this,t.call(this,v,N),v,N,"mouse");k&&(_n(v.view).on("mousemove.drag",x,jl).on("mouseup.drag",b,jl),fS(v.view),Sh(v),u=!1,a=v.clientX,c=v.clientY,k("start",v))}}function x(v){if(Mo(v),!u){var N=v.clientX-a,k=v.clientY-c;u=N*N+k*k>f}s.mouse("drag",v)}function b(v){_n(v.view).on("mousemove.drag mouseup.drag",null),hS(v.view,u),Mo(v),s.mouse("end",v)}function S(v,N){if(e.call(this,v,N)){var k=v.changedTouches,T=t.call(this,v,N),z=k.length,A,L;for(A=0;A<z;++A)(L=g(this,T,v,N,k[A].identifier,k[A]))&&(Sh(v),L("start",v,k[A]))}}function m(v){var N=v.changedTouches,k=N.length,T,z;for(T=0;T<k;++T)(z=s[N[T].identifier])&&(Mo(v),z("drag",v,N[T]))}function y(v){var N=v.changedTouches,k=N.length,T,z;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),T=0;T<k;++T)(z=s[N[T].identifier])&&(Sh(v),z("end",v,N[T]))}function g(v,N,k,T,z,A){var L=i.copy(),R=tr(A||k,N),H,Y,_;if((_=n.call(v,new Zp("beforestart",{sourceEvent:k,target:h,identifier:z,active:o,x:R[0],y:R[1],dx:0,dy:0,dispatch:L}),T))!=null)return H=_.x-R[0]||0,Y=_.y-R[1]||0,function C(j,D,O){var $=R,U;switch(j){case"start":s[z]=C,U=o++;break;case"end":delete s[z],--o;case"drag":R=tr(O||D,N),U=o;break}L.call(j,v,new Zp(j,{sourceEvent:D,subject:_,target:h,identifier:z,active:U,x:R[0]+H,y:R[1]+Y,dx:R[0]-$[0],dy:R[1]-$[1],dispatch:L}),T)}}return h.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Gc(!!v),h):e},h.container=function(v){return arguments.length?(t=typeof v=="function"?v:Gc(v),h):t},h.subject=function(v){return arguments.length?(n=typeof v=="function"?v:Gc(v),h):n},h.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:Gc(!!v),h):r},h.on=function(){var v=i.on.apply(i,arguments);return v===i?h:v},h.clickDistance=function(v){return arguments.length?(f=(v=+v)*v,h):Math.sqrt(f)},h}function Cg(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function mS(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function tc(){}var El=.7,md=1/El,zo="\\s*([+-]?\\d+)\\s*",Tl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Er="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",TM=/^#([0-9a-f]{3,8})$/,AM=new RegExp(`^rgb\\(${zo},${zo},${zo}\\)$`),CM=new RegExp(`^rgb\\(${Er},${Er},${Er}\\)$`),MM=new RegExp(`^rgba\\(${zo},${zo},${zo},${Tl}\\)$`),zM=new RegExp(`^rgba\\(${Er},${Er},${Er},${Tl}\\)$`),DM=new RegExp(`^hsl\\(${Tl},${Er},${Er}\\)$`),RM=new RegExp(`^hsla\\(${Tl},${Er},${Er},${Tl}\\)$`),Ty={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};Cg(tc,zi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ay,formatHex:Ay,formatHex8:OM,formatHsl:$M,formatRgb:Cy,toString:Cy});function Ay(){return this.rgb().formatHex()}function OM(){return this.rgb().formatHex8()}function $M(){return gS(this).formatHsl()}function Cy(){return this.rgb().formatRgb()}function zi(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=TM.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?My(t):n===3?new ln(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Xc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Xc(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=AM.exec(e))?new ln(t[1],t[2],t[3],1):(t=CM.exec(e))?new ln(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=MM.exec(e))?Xc(t[1],t[2],t[3],t[4]):(t=zM.exec(e))?Xc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=DM.exec(e))?Ry(t[1],t[2]/100,t[3]/100,1):(t=RM.exec(e))?Ry(t[1],t[2]/100,t[3]/100,t[4]):Ty.hasOwnProperty(e)?My(Ty[e]):e==="transparent"?new ln(NaN,NaN,NaN,0):null}function My(e){return new ln(e>>16&255,e>>8&255,e&255,1)}function Xc(e,t,n,r){return r<=0&&(e=t=n=NaN),new ln(e,t,n,r)}function LM(e){return e instanceof tc||(e=zi(e)),e?(e=e.rgb(),new ln(e.r,e.g,e.b,e.opacity)):new ln}function Yp(e,t,n,r){return arguments.length===1?LM(e):new ln(e,t,n,r??1)}function ln(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Cg(ln,Yp,mS(tc,{brighter(e){return e=e==null?md:Math.pow(md,e),new ln(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?El:Math.pow(El,e),new ln(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ln(ki(this.r),ki(this.g),ki(this.b),gd(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:zy,formatHex:zy,formatHex8:HM,formatRgb:Dy,toString:Dy}));function zy(){return`#${yi(this.r)}${yi(this.g)}${yi(this.b)}`}function HM(){return`#${yi(this.r)}${yi(this.g)}${yi(this.b)}${yi((isNaN(this.opacity)?1:this.opacity)*255)}`}function Dy(){const e=gd(this.opacity);return`${e===1?"rgb(":"rgba("}${ki(this.r)}, ${ki(this.g)}, ${ki(this.b)}${e===1?")":`, ${e})`}`}function gd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ki(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function yi(e){return e=ki(e),(e<16?"0":"")+e.toString(16)}function Ry(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new sr(e,t,n,r)}function gS(e){if(e instanceof sr)return new sr(e.h,e.s,e.l,e.opacity);if(e instanceof tc||(e=zi(e)),!e)return new sr;if(e instanceof sr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,a=i-s,c=(i+s)/2;return a?(t===i?o=(n-r)/a+(n<r)*6:n===i?o=(r-t)/a+2:o=(t-n)/a+4,a/=c<.5?i+s:2-i-s,o*=60):a=c>0&&c<1?0:o,new sr(o,a,c,e.opacity)}function BM(e,t,n,r){return arguments.length===1?gS(e):new sr(e,t,n,r??1)}function sr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Cg(sr,BM,mS(tc,{brighter(e){return e=e==null?md:Math.pow(md,e),new sr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?El:Math.pow(El,e),new sr(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,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new ln(_h(e>=240?e-240:e+120,s,r),_h(e,s,r),_h(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new sr(Oy(this.h),Pc(this.s),Pc(this.l),gd(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=gd(this.opacity);return`${e===1?"hsl(":"hsla("}${Oy(this.h)}, ${Pc(this.s)*100}%, ${Pc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Oy(e){return e=(e||0)%360,e<0?e+360:e}function Pc(e){return Math.max(0,Math.min(1,e||0))}function _h(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 Mg=e=>()=>e;function UM(e,t){return function(n){return e+n*t}}function IM(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function ZM(e){return(e=+e)==1?xS:function(t,n){return n-t?IM(t,n,e):Mg(isNaN(t)?n:t)}}function xS(e,t){var n=t-e;return n?UM(e,n):Mg(isNaN(e)?t:e)}const xd=function e(t){var n=ZM(t);function r(s,i){var o=n((s=Yp(s)).r,(i=Yp(i)).r),a=n(s.g,i.g),c=n(s.b,i.b),u=xS(s.opacity,i.opacity);return function(d){return s.r=o(d),s.g=a(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function YM(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;s<n;++s)r[s]=e[s]*(1-i)+t[s]*i;return r}}function qM(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function VM(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),i=new Array(n),o;for(o=0;o<r;++o)s[o]=ll(e[o],t[o]);for(;o<n;++o)i[o]=t[o];return function(a){for(o=0;o<r;++o)i[o]=s[o](a);return i}}function GM(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Sr(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function XM(e,t){var n={},r={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=ll(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var qp=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,kh=new RegExp(qp.source,"g");function PM(e){return function(){return e}}function FM(e){return function(t){return e(t)+""}}function yS(e,t){var n=qp.lastIndex=kh.lastIndex=0,r,s,i,o=-1,a=[],c=[];for(e=e+"",t=t+"";(r=qp.exec(e))&&(s=kh.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),a[o]?a[o]+=i:a[++o]=i),(r=r[0])===(s=s[0])?a[o]?a[o]+=s:a[++o]=s:(a[++o]=null,c.push({i:o,x:Sr(r,s)})),n=kh.lastIndex;return n<t.length&&(i=t.slice(n),a[o]?a[o]+=i:a[++o]=i),a.length<2?c[0]?FM(c[0].x):PM(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)a[(f=c[d]).i]=f.x(u);return a.join("")})}function ll(e,t){var n=typeof t,r;return t==null||n==="boolean"?Mg(t):(n==="number"?Sr:n==="string"?(r=zi(t))?(t=r,xd):yS:t instanceof zi?xd:t instanceof Date?GM:qM(t)?YM:Array.isArray(t)?VM:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?XM:Sr)(e,t)}var $y=180/Math.PI,Vp={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function vS(e,t,n,r,s,i){var o,a,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*$y,skewX:Math.atan(c)*$y,scaleX:o,scaleY:a}}var Fc;function QM(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Vp:vS(t.a,t.b,t.c,t.d,t.e,t.f)}function KM(e){return e==null||(Fc||(Fc=document.createElementNS("http://www.w3.org/2000/svg","g")),Fc.setAttribute("transform",e),!(e=Fc.transform.baseVal.consolidate()))?Vp:(e=e.matrix,vS(e.a,e.b,e.c,e.d,e.e,e.f))}function bS(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function i(u,d,f,h,p,x){if(u!==f||d!==h){var b=p.push("translate(",null,t,null,n);x.push({i:b-4,x:Sr(u,f)},{i:b-2,x:Sr(d,h)})}else(f||h)&&p.push("translate("+f+t+h+n)}function o(u,d,f,h){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(s(f)+"rotate(",null,r)-2,x:Sr(u,d)})):d&&f.push(s(f)+"rotate("+d+r)}function a(u,d,f,h){u!==d?h.push({i:f.push(s(f)+"skewX(",null,r)-2,x:Sr(u,d)}):d&&f.push(s(f)+"skewX("+d+r)}function c(u,d,f,h,p,x){if(u!==f||d!==h){var b=p.push(s(p)+"scale(",null,",",null,")");x.push({i:b-4,x:Sr(u,f)},{i:b-2,x:Sr(d,h)})}else(f!==1||h!==1)&&p.push(s(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),i(u.translateX,u.translateY,d.translateX,d.translateY,f,h),o(u.rotate,d.rotate,f,h),a(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,b=h.length,S;++x<b;)f[(S=h[x]).i]=S.x(p);return f.join("")}}}var WM=bS(QM,"px, ","px)","deg)"),JM=bS(KM,", ",")",")"),ez=1e-12;function Ly(e){return((e=Math.exp(e))+1/e)/2}function tz(e){return((e=Math.exp(e))-1/e)/2}function nz(e){return((e=Math.exp(2*e))-1)/(e+1)}const Nu=function e(t,n,r){function s(i,o){var a=i[0],c=i[1],u=i[2],d=o[0],f=o[1],h=o[2],p=d-a,x=f-c,b=p*p+x*x,S,m;if(b<ez)m=Math.log(h/u)/t,S=function(T){return[a+T*p,c+T*x,u*Math.exp(t*T*m)]};else{var y=Math.sqrt(b),g=(h*h-u*u+r*b)/(2*u*n*y),v=(h*h-u*u-r*b)/(2*h*n*y),N=Math.log(Math.sqrt(g*g+1)-g),k=Math.log(Math.sqrt(v*v+1)-v);m=(k-N)/t,S=function(T){var z=T*m,A=Ly(N),L=u/(n*y)*(A*nz(t*z+N)-tz(N));return[a+L*p,c+L*x,u*A/Ly(t*z+N)]}}return S.duration=m*1e3*t/Math.SQRT2,S}return s.rho=function(i){var o=Math.max(.001,+i),a=o*o,c=a*a;return e(o,a,c)},s}(Math.SQRT2,2,4);var Go=0,Za=0,za=0,wS=1e3,yd,Ya,vd=0,Di=0,nf=0,Al=typeof performance=="object"&&performance.now?performance:Date,SS=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function zg(){return Di||(SS(rz),Di=Al.now()+nf)}function rz(){Di=0}function bd(){this._call=this._time=this._next=null}bd.prototype=_S.prototype={constructor:bd,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?zg():+n)+(t==null?0:+t),!this._next&&Ya!==this&&(Ya?Ya._next=this:yd=this,Ya=this),this._call=e,this._time=n,Gp()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gp())}};function _S(e,t,n){var r=new bd;return r.restart(e,t,n),r}function sz(){zg(),++Go;for(var e=yd,t;e;)(t=Di-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Go}function Hy(){Di=(vd=Al.now())+nf,Go=Za=0;try{sz()}finally{Go=0,oz(),Di=0}}function iz(){var e=Al.now(),t=e-vd;t>wS&&(nf-=t,vd=e)}function oz(){for(var e,t=yd,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:yd=n);Ya=e,Gp(r)}function Gp(e){if(!Go){Za&&(Za=clearTimeout(Za));var t=e-Di;t>24?(e<1/0&&(Za=setTimeout(Hy,e-Al.now()-nf)),za&&(za=clearInterval(za))):(za||(vd=Al.now(),za=setInterval(iz,wS)),Go=1,SS(Hy))}}function By(e,t,n){var r=new bd;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var az=ef("start","end","cancel","interrupt"),lz=[],kS=0,Uy=1,Xp=2,ju=3,Iy=4,Pp=5,Eu=6;function rf(e,t,n,r,s,i){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;cz(e,n,{name:t,index:r,group:s,on:az,tween:lz,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:kS})}function Dg(e,t){var n=hr(e,t);if(n.state>kS)throw new Error("too late; already scheduled");return n}function zr(e,t){var n=hr(e,t);if(n.state>ju)throw new Error("too late; already running");return n}function hr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function cz(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=_S(i,0,n.time);function i(u){n.state=Uy,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var d,f,h,p;if(n.state!==Uy)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===ju)return By(o);p.state===Iy?(p.state=Eu,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+d<t&&(p.state=Eu,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete r[d])}if(By(function(){n.state===ju&&(n.state=Iy,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=Xp,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Xp){for(n.state=ju,s=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))&&(s[++f]=p);s.length=f+1}}function a(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Pp,1),f=-1,h=s.length;++f<h;)s[f].call(e,d);n.state===Pp&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Eu,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Tu(e,t){var n=e.__transition,r,s,i=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){i=!1;continue}s=r.state>Xp&&r.state<Pp,r.state=Eu,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}i&&delete e.__transition}}function uz(e){return this.each(function(){Tu(this,e)})}function dz(e,t){var n,r;return function(){var s=zr(this,e),i=s.tween;if(i!==n){r=n=i;for(var o=0,a=r.length;o<a;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}s.tween=r}}function fz(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=zr(this,e),o=i.tween;if(o!==r){s=(r=o).slice();for(var a={name:t,value:n},c=0,u=s.length;c<u;++c)if(s[c].name===t){s[c]=a;break}c===u&&s.push(a)}i.tween=s}}function hz(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=hr(this.node(),n).tween,s=0,i=r.length,o;s<i;++s)if((o=r[s]).name===e)return o.value;return null}return this.each((t==null?dz:fz)(n,e,t))}function Rg(e,t,n){var r=e._id;return e.each(function(){var s=zr(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return hr(s,r).value[t]}}function NS(e,t){var n;return(typeof t=="number"?Sr:t instanceof zi?xd:(n=zi(t))?(t=n,xd):yS)(e,t)}function pz(e){return function(){this.removeAttribute(e)}}function mz(e){return function(){this.removeAttributeNS(e.space,e.local)}}function gz(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttribute(e);return o===s?null:o===r?i:i=t(r=o,n)}}function xz(e,t,n){var r,s=n+"",i;return function(){var o=this.getAttributeNS(e.space,e.local);return o===s?null:o===r?i:i=t(r=o,n)}}function yz(e,t,n){var r,s,i;return function(){var o,a=n(this),c;return a==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=a+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,a)))}}function vz(e,t,n){var r,s,i;return function(){var o,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=a+"",o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,a)))}}function bz(e,t){var n=tf(e),r=n==="transform"?JM:NS;return this.attrTween(e,typeof t=="function"?(n.local?vz:yz)(n,r,Rg(this,"attr."+e,t)):t==null?(n.local?mz:pz)(n):(n.local?xz:gz)(n,r,t))}function wz(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Sz(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function _z(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Sz(e,i)),n}return s._value=t,s}function kz(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&wz(e,i)),n}return s._value=t,s}function Nz(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 r=tf(e);return this.tween(n,(r.local?_z:kz)(r,t))}function jz(e,t){return function(){Dg(this,e).delay=+t.apply(this,arguments)}}function Ez(e,t){return t=+t,function(){Dg(this,e).delay=t}}function Tz(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jz:Ez)(t,e)):hr(this.node(),t).delay}function Az(e,t){return function(){zr(this,e).duration=+t.apply(this,arguments)}}function Cz(e,t){return t=+t,function(){zr(this,e).duration=t}}function Mz(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Az:Cz)(t,e)):hr(this.node(),t).duration}function zz(e,t){if(typeof t!="function")throw new Error;return function(){zr(this,e).ease=t}}function Dz(e){var t=this._id;return arguments.length?this.each(zz(t,e)):hr(this.node(),t).ease}function Rz(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;zr(this,e).ease=n}}function Oz(e){if(typeof e!="function")throw new Error;return this.each(Rz(this._id,e))}function $z(e){typeof e!="function"&&(e=nS(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],o=i.length,a=r[s]=[],c,u=0;u<o;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&a.push(c);return new cs(r,this._parents,this._name,this._id)}function Lz(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),o=new Array(r),a=0;a<i;++a)for(var c=t[a],u=n[a],d=c.length,f=o[a]=new Array(d),h,p=0;p<d;++p)(h=c[p]||u[p])&&(f[p]=h);for(;a<r;++a)o[a]=t[a];return new cs(o,this._parents,this._name,this._id)}function Hz(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 Bz(e,t,n){var r,s,i=Hz(t)?Dg:zr;return function(){var o=i(this,e),a=o.on;a!==r&&(s=(r=a).copy()).on(t,n),o.on=s}}function Uz(e,t){var n=this._id;return arguments.length<2?hr(this.node(),n).on.on(e):this.each(Bz(n,e,t))}function Iz(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Zz(){return this.on("end.remove",Iz(this._id))}function Yz(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Tg(e));for(var r=this._groups,s=r.length,i=new Array(s),o=0;o<s;++o)for(var a=r[o],c=a.length,u=i[o]=new Array(c),d,f,h=0;h<c;++h)(d=a[h])&&(f=e.call(d,d.__data__,h,a))&&("__data__"in d&&(f.__data__=d.__data__),u[h]=f,rf(u[h],t,n,h,u,hr(d,n)));return new cs(i,this._parents,t,n)}function qz(e){var t=this._name,n=this._id;typeof e!="function"&&(e=tS(e));for(var r=this._groups,s=r.length,i=[],o=[],a=0;a<s;++a)for(var c=r[a],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=hr(d,n),b=0,S=h.length;b<S;++b)(p=h[b])&&rf(p,t,n,b,h,x);i.push(h),o.push(d)}return new cs(i,o,t,n)}var Vz=ec.prototype.constructor;function Gz(){return new Vz(this._groups,this._parents)}function Xz(e,t){var n,r,s;return function(){var i=Vo(this,e),o=(this.style.removeProperty(e),Vo(this,e));return i===o?null:i===n&&o===r?s:s=t(n=i,r=o)}}function jS(e){return function(){this.style.removeProperty(e)}}function Pz(e,t,n){var r,s=n+"",i;return function(){var o=Vo(this,e);return o===s?null:o===r?i:i=t(r=o,n)}}function Fz(e,t,n){var r,s,i;return function(){var o=Vo(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Vo(this,e))),o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,a))}}function Qz(e,t){var n,r,s,i="style."+t,o="end."+i,a;return function(){var c=zr(this,e),u=c.on,d=c.value[i]==null?a||(a=jS(t)):void 0;(u!==n||s!==d)&&(r=(n=u).copy()).on(o,s=d),c.on=r}}function Kz(e,t,n){var r=(e+="")=="transform"?WM:NS;return t==null?this.styleTween(e,Xz(e,r)).on("end.style."+e,jS(e)):typeof t=="function"?this.styleTween(e,Fz(e,r,Rg(this,"style."+e,t))).each(Qz(this._id,e)):this.styleTween(e,Pz(e,r,t),n).on("end.style."+e,null)}function Wz(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Jz(e,t,n){var r,s;function i(){var o=t.apply(this,arguments);return o!==s&&(r=(s=o)&&Wz(e,o,n)),r}return i._value=t,i}function e4(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Jz(e,t,n??""))}function t4(e){return function(){this.textContent=e}}function n4(e){return function(){var t=e(this);this.textContent=t??""}}function r4(e){return this.tween("text",typeof e=="function"?n4(Rg(this,"text",e)):t4(e==null?"":e+""))}function s4(e){return function(t){this.textContent=e.call(this,t)}}function i4(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&s4(s)),t}return r._value=e,r}function o4(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,i4(e))}function a4(){for(var e=this._name,t=this._id,n=ES(),r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],a=o.length,c,u=0;u<a;++u)if(c=o[u]){var d=hr(c,t);rf(c,e,n,u,o,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new cs(r,this._parents,e,n)}function l4(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,o){var a={value:o},c={value:function(){--s===0&&i()}};n.each(function(){var u=zr(this,r),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),u.on=t}),s===0&&i()})}var c4=0;function cs(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function ES(){return++c4}var Yr=ec.prototype;cs.prototype={constructor:cs,select:Yz,selectAll:qz,selectChild:Yr.selectChild,selectChildren:Yr.selectChildren,filter:$z,merge:Lz,selection:Gz,transition:a4,call:Yr.call,nodes:Yr.nodes,node:Yr.node,size:Yr.size,empty:Yr.empty,each:Yr.each,on:Uz,attr:bz,attrTween:Nz,style:Kz,styleTween:e4,text:r4,textTween:o4,remove:Zz,tween:hz,delay:Tz,duration:Mz,ease:Dz,easeVarying:Oz,end:l4,[Symbol.iterator]:Yr[Symbol.iterator]};function u4(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var d4={time:null,delay:0,duration:250,ease:u4};function f4(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 h4(e){var t,n;e instanceof cs?(t=e._id,e=e._name):(t=ES(),(n=d4).time=zg(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],a=o.length,c,u=0;u<a;++u)(c=o[u])&&rf(c,e,t,u,o,n||f4(c,t));return new cs(r,this._parents,e,t)}ec.prototype.interrupt=uz;ec.prototype.transition=h4;const Qc=e=>()=>e;function p4(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){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:r,enumerable:!0,configurable:!0},_:{value:s}})}function Wr(e,t,n){this.k=e,this.x=t,this.y=n}Wr.prototype={constructor:Wr,scale:function(e){return e===1?this:new Wr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Wr(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 sf=new Wr(1,0,0);TS.prototype=Wr.prototype;function TS(e){for(;!e.__zoom;)if(!(e=e.parentNode))return sf;return e.__zoom}function Nh(e){e.stopImmediatePropagation()}function Da(e){e.preventDefault(),e.stopImmediatePropagation()}function m4(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function g4(){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 Zy(){return this.__zoom||sf}function x4(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function y4(){return navigator.maxTouchPoints||"ontouchstart"in this}function v4(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function AS(){var e=m4,t=g4,n=v4,r=x4,s=y4,i=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Nu,u=ef("start","zoom","end"),d,f,h,p=500,x=150,b=0,S=10;function m(_){_.property("__zoom",Zy).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",L).filter(s).on("touchstart.zoom",R).on("touchmove.zoom",H).on("touchend.zoom touchcancel.zoom",Y).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(_,C,j,D){var O=_.selection?_.selection():_;O.property("__zoom",Zy),_!==O?N(_,C,j,D):O.interrupt().each(function(){k(this,arguments).event(D).start().zoom(null,typeof C=="function"?C.apply(this,arguments):C).end()})},m.scaleBy=function(_,C,j,D){m.scaleTo(_,function(){var O=this.__zoom.k,$=typeof C=="function"?C.apply(this,arguments):C;return O*$},j,D)},m.scaleTo=function(_,C,j,D){m.transform(_,function(){var O=t.apply(this,arguments),$=this.__zoom,U=j==null?v(O):typeof j=="function"?j.apply(this,arguments):j,X=$.invert(U),Z=typeof C=="function"?C.apply(this,arguments):C;return n(g(y($,Z),U,X),O,o)},j,D)},m.translateBy=function(_,C,j,D){m.transform(_,function(){return n(this.__zoom.translate(typeof C=="function"?C.apply(this,arguments):C,typeof j=="function"?j.apply(this,arguments):j),t.apply(this,arguments),o)},null,D)},m.translateTo=function(_,C,j,D,O){m.transform(_,function(){var $=t.apply(this,arguments),U=this.__zoom,X=D==null?v($):typeof D=="function"?D.apply(this,arguments):D;return n(sf.translate(X[0],X[1]).scale(U.k).translate(typeof C=="function"?-C.apply(this,arguments):-C,typeof j=="function"?-j.apply(this,arguments):-j),$,o)},D,O)};function y(_,C){return C=Math.max(i[0],Math.min(i[1],C)),C===_.k?_:new Wr(C,_.x,_.y)}function g(_,C,j){var D=C[0]-j[0]*_.k,O=C[1]-j[1]*_.k;return D===_.x&&O===_.y?_:new Wr(_.k,D,O)}function v(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function N(_,C,j,D){_.on("start.zoom",function(){k(this,arguments).event(D).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(D).end()}).tween("zoom",function(){var O=this,$=arguments,U=k(O,$).event(D),X=t.apply(O,$),Z=j==null?v(X):typeof j=="function"?j.apply(O,$):j,B=Math.max(X[1][0]-X[0][0],X[1][1]-X[0][1]),E=O.__zoom,q=typeof C=="function"?C.apply(O,$):C,V=c(E.invert(Z).concat(B/E.k),q.invert(Z).concat(B/q.k));return function(J){if(J===1)J=q;else{var F=V(J),G=B/F[2];J=new Wr(G,Z[0]-F[0]*G,Z[1]-F[1]*G)}U.zoom(null,J)}})}function k(_,C,j){return!j&&_.__zooming||new T(_,C)}function T(_,C){this.that=_,this.args=C,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,C),this.taps=0}T.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,C){return this.mouse&&_!=="mouse"&&(this.mouse[1]=C.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=C.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=C.invert(this.touch1[0])),this.that.__zoom=C,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var C=_n(this.that).datum();u.call(_,this.that,new p4(_,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:u}),C)}};function z(_,...C){if(!e.apply(this,arguments))return;var j=k(this,C).event(_),D=this.__zoom,O=Math.max(i[0],Math.min(i[1],D.k*Math.pow(2,r.apply(this,arguments)))),$=tr(_);if(j.wheel)(j.mouse[0][0]!==$[0]||j.mouse[0][1]!==$[1])&&(j.mouse[1]=D.invert(j.mouse[0]=$)),clearTimeout(j.wheel);else{if(D.k===O)return;j.mouse=[$,D.invert($)],Tu(this),j.start()}Da(_),j.wheel=setTimeout(U,x),j.zoom("mouse",n(g(y(D,O),j.mouse[0],j.mouse[1]),j.extent,o));function U(){j.wheel=null,j.end()}}function A(_,...C){if(h||!e.apply(this,arguments))return;var j=_.currentTarget,D=k(this,C,!0).event(_),O=_n(_.view).on("mousemove.zoom",Z,!0).on("mouseup.zoom",B,!0),$=tr(_,j),U=_.clientX,X=_.clientY;fS(_.view),Nh(_),D.mouse=[$,this.__zoom.invert($)],Tu(this),D.start();function Z(E){if(Da(E),!D.moved){var q=E.clientX-U,V=E.clientY-X;D.moved=q*q+V*V>b}D.event(E).zoom("mouse",n(g(D.that.__zoom,D.mouse[0]=tr(E,j),D.mouse[1]),D.extent,o))}function B(E){O.on("mousemove.zoom mouseup.zoom",null),hS(E.view,D.moved),Da(E),D.event(E).end()}}function L(_,...C){if(e.apply(this,arguments)){var j=this.__zoom,D=tr(_.changedTouches?_.changedTouches[0]:_,this),O=j.invert(D),$=j.k*(_.shiftKey?.5:2),U=n(g(y(j,$),D,O),t.apply(this,C),o);Da(_),a>0?_n(this).transition().duration(a).call(N,U,D,_):_n(this).call(m.transform,U,D,_)}}function R(_,...C){if(e.apply(this,arguments)){var j=_.touches,D=j.length,O=k(this,C,_.changedTouches.length===D).event(_),$,U,X,Z;for(Nh(_),U=0;U<D;++U)X=j[U],Z=tr(X,this),Z=[Z,this.__zoom.invert(Z),X.identifier],O.touch0?!O.touch1&&O.touch0[2]!==Z[2]&&(O.touch1=Z,O.taps=0):(O.touch0=Z,$=!0,O.taps=1+!!d);d&&(d=clearTimeout(d)),$&&(O.taps<2&&(f=Z[0],d=setTimeout(function(){d=null},p)),Tu(this),O.start())}}function H(_,...C){if(this.__zooming){var j=k(this,C).event(_),D=_.changedTouches,O=D.length,$,U,X,Z;for(Da(_),$=0;$<O;++$)U=D[$],X=tr(U,this),j.touch0&&j.touch0[2]===U.identifier?j.touch0[0]=X:j.touch1&&j.touch1[2]===U.identifier&&(j.touch1[0]=X);if(U=j.that.__zoom,j.touch1){var B=j.touch0[0],E=j.touch0[1],q=j.touch1[0],V=j.touch1[1],J=(J=q[0]-B[0])*J+(J=q[1]-B[1])*J,F=(F=V[0]-E[0])*F+(F=V[1]-E[1])*F;U=y(U,Math.sqrt(J/F)),X=[(B[0]+q[0])/2,(B[1]+q[1])/2],Z=[(E[0]+V[0])/2,(E[1]+V[1])/2]}else if(j.touch0)X=j.touch0[0],Z=j.touch0[1];else return;j.zoom("touch",n(g(U,X,Z),j.extent,o))}}function Y(_,...C){if(this.__zooming){var j=k(this,C).event(_),D=_.changedTouches,O=D.length,$,U;for(Nh(_),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),$=0;$<O;++$)U=D[$],j.touch0&&j.touch0[2]===U.identifier?delete j.touch0:j.touch1&&j.touch1[2]===U.identifier&&delete j.touch1;if(j.touch1&&!j.touch0&&(j.touch0=j.touch1,delete j.touch1),j.touch0)j.touch0[1]=this.__zoom.invert(j.touch0[0]);else if(j.end(),j.taps===2&&(U=tr(U,this),Math.hypot(f[0]-U[0],f[1]-U[1])<S)){var X=_n(this).on("dblclick.zoom");X&&X.apply(this,arguments)}}}return m.wheelDelta=function(_){return arguments.length?(r=typeof _=="function"?_:Qc(+_),m):r},m.filter=function(_){return arguments.length?(e=typeof _=="function"?_:Qc(!!_),m):e},m.touchable=function(_){return arguments.length?(s=typeof _=="function"?_:Qc(!!_),m):s},m.extent=function(_){return arguments.length?(t=typeof _=="function"?_:Qc([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),m):t},m.scaleExtent=function(_){return arguments.length?(i[0]=+_[0],i[1]=+_[1],m):[i[0],i[1]]},m.translateExtent=function(_){return arguments.length?(o[0][0]=+_[0][0],o[1][0]=+_[1][0],o[0][1]=+_[0][1],o[1][1]=+_[1][1],m):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},m.constrain=function(_){return arguments.length?(n=_,m):n},m.duration=function(_){return arguments.length?(a=+_,m):a},m.interpolate=function(_){return arguments.length?(c=_,m):c},m.on=function(){var _=u.on.apply(u,arguments);return _===u?m:_},m.clickDistance=function(_){return arguments.length?(b=(_=+_)*_,m):Math.sqrt(b)},m.tapDistance=function(_){return arguments.length?(S=+_,m):S},m}const Tr={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:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", 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."},Cl=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],CS=["Enter"," ","Escape"],MS={"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 Xo;(function(e){e.Strict="strict",e.Loose="loose"})(Xo||(Xo={}));var Ni;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ni||(Ni={}));var Ml;(function(e){e.Partial="partial",e.Full="full"})(Ml||(Ml={}));const zS={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ms;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ms||(Ms={}));var wd;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(wd||(wd={}));var fe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(fe||(fe={}));const Yy={[fe.Left]:fe.Right,[fe.Right]:fe.Left,[fe.Top]:fe.Bottom,[fe.Bottom]:fe.Top};function DS(e){return e===null?null:e?"valid":"invalid"}const RS=e=>"id"in e&&"source"in e&&"target"in e,b4=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Og=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),nc=(e,t=[0,0])=>{const{width:n,height:r}=hs(e),s=e.origin??t,i=n*s[0],o=r*s[1];return{x:e.position.x-i,y:e.position.y-o}},w4=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let o=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(o=i?t.nodeLookup.get(s):Og(s)?s:t.nodeLookup.get(s.id));const a=o?Sd(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return of(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return af(n)},rc=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=of(n,Sd(s)),r=!0)}),r?af(n):{x:0,y:0,width:0,height:0}},$g=(e,t,[n,r,s]=[0,0,1],i=!1,o=!1)=>{const a={...ic(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(o&&!f||h)continue;const p=d.width??u.width??u.initialWidth??null,x=d.height??u.height??u.initialHeight??null,b=zl(a,Fo(u)),S=(p??0)*(x??0),m=i&&b>0;(!u.internals.handleBounds||m||b>=S||u.dragging)&&c.push(u)}return c},S4=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function _4(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function k4({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},o){if(e.size===0)return Promise.resolve(!0);const a=_4(e,o),c=rc(a),u=Lg(c,t,n,(o==null?void 0:o.minZoom)??s,(o==null?void 0:o.maxZoom)??i,(o==null?void 0:o.padding)??.1);return await r.setViewport(u,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),Promise.resolve(!0)}function OS({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const o=n.get(e),a=o.parentId?n.get(o.parentId):void 0,{x:c,y:u}=a?a.internals.positionAbsolute:{x:0,y:0},d=o.origin??r;let f=o.extent||s;if(o.extent==="parent"&&!o.expandParent)if(!a)i==null||i("005",Tr.error005());else{const p=a.measured.width,x=a.measured.height;p&&x&&(f=[[c,u],[c+p,u+x]])}else a&&Qo(o.extent)&&(f=[[o.extent[0][0]+c,o.extent[0][1]+u],[o.extent[1][0]+c,o.extent[1][1]+u]]);const h=Qo(f)?Ri(t,f,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(i==null||i("015",Tr.error015())),{position:{x:h.x-c+(o.measured.width??0)*d[0],y:h.y-u+(o.measured.height??0)*d[1]},positionAbsolute:h}}async function N4({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(h=>h.id)),o=[];for(const h of n){if(h.deletable===!1)continue;const p=i.has(h.id),x=!p&&h.parentId&&o.find(b=>b.id===h.parentId);(p||x)&&o.push(h)}const a=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=S4(o,c);for(const h of c)a.has(h.id)&&!d.find(x=>x.id===h.id)&&d.push(h);if(!s)return{edges:d,nodes:o};const f=await s({nodes:o,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:o}:{edges:[],nodes:[]}:f}const Po=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ri=(e={x:0,y:0},t,n)=>({x:Po(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Po(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function $S(e,t,n){const{width:r,height:s}=hs(n),{x:i,y:o}=n.internals.positionAbsolute;return Ri(e,[[i,o],[i+r,o+s]],t)}const qy=(e,t,n)=>e<t?Po(Math.abs(e-t),1,t)/t:e>n?-Po(Math.abs(e-n),1,t)/t:0,LS=(e,t,n=15,r=40)=>{const s=qy(e.x,r,t.width-r)*n,i=qy(e.y,r,t.height-r)*n;return[s,i]},of=(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)}),Fp=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),af=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Fo=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Og(e)?e.internals.positionAbsolute:nc(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Sd=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Og(e)?e.internals.positionAbsolute:nc(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},HS=(e,t)=>af(of(Fp(e),Fp(t))),zl=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Vy=e=>or(e.width)&&or(e.height)&&or(e.x)&&or(e.y),or=e=>!isNaN(e)&&isFinite(e),j4=(e,t)=>{},sc=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),ic=({x:e,y:t},[n,r,s],i=!1,o=[1,1])=>{const a={x:(e-n)/s,y:(t-r)/s};return i?sc(a,o):a},_d=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Ki(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 E4(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Ki(e,n),s=Ki(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Ki(e.top??e.y??0,n),s=Ki(e.bottom??e.y??0,n),i=Ki(e.left??e.x??0,t),o=Ki(e.right??e.x??0,t);return{top:r,right:o,bottom:s,left:i,x:i+o,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function T4(e,t,n,r,s,i){const{x:o,y:a}=_d(e,[t,n,r]),{x:c,y:u}=_d({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=s-c,f=i-u;return{left:Math.floor(o),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(f)}}const Lg=(e,t,n,r,s,i)=>{const o=E4(i,t,n),a=(t-o.x)/e.width,c=(n-o.y)/e.height,u=Math.min(a,c),d=Po(u,r,s),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,x=n/2-h*d,b=T4(e,p,x,d,t,n),S={left:Math.min(b.left-o.left,0),top:Math.min(b.top-o.top,0),right:Math.min(b.right-o.right,0),bottom:Math.min(b.bottom-o.bottom,0)};return{x:p-S.left+S.right,y:x-S.top+S.bottom,zoom:d}},Dl=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Qo(e){return e!=null&&e!=="parent"}function hs(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 BS(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 US(e,t={width:0,height:0},n,r,s){const i={...e},o=r.get(n);if(o){const a=o.origin||s;i.x+=o.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=o.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function Gy(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function A4(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function C4(e){return{...MS,...e||{}}}function cl(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:o}=ar(e),a=ic({x:i-((s==null?void 0:s.left)??0),y:o-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?sc(a,t):a;return{xSnapped:c,ySnapped:u,...a}}const Hg=e=>({width:e.offsetWidth,height:e.offsetHeight}),IS=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},M4=["INPUT","SELECT","TEXTAREA"];function ZS(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:M4.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const YS=e=>"clientX"in e,ar=(e,t)=>{var i,o;const n=YS(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},Xy=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(o=>{const a=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:s,position:o.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Hg(o)}})};function qS({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:o,targetControlY:a}){const c=e*.125+s*.375+o*.375+n*.125,u=t*.125+i*.375+a*.375+r*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function Kc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Py({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case fe.Left:return[t-Kc(t-r,i),n];case fe.Right:return[t+Kc(r-t,i),n];case fe.Top:return[t,n-Kc(n-s,i)];case fe.Bottom:return[t,n+Kc(s-n,i)]}}function VS({sourceX:e,sourceY:t,sourcePosition:n=fe.Bottom,targetX:r,targetY:s,targetPosition:i=fe.Top,curvature:o=.25}){const[a,c]=Py({pos:n,x1:e,y1:t,x2:r,y2:s,c:o}),[u,d]=Py({pos:i,x1:r,y1:s,x2:e,y2:t,c:o}),[f,h,p,x]=qS({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${a},${c} ${u},${d} ${r},${s}`,f,h,p,x]}function GS({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,o=Math.abs(r-t)/2,a=r<t?r+o:r-o;return[i,a,s,o]}function z4({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const o=s&&n?r+1e3:r,a=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return o+a}function D4({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=of(Sd(e),Sd(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const o={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return zl(o,af(i))>0}const R4=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,O4=(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)),$4=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||R4;let s;return RS(e)?s={...e}:s={...e,id:r(e)},O4(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function XS({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,o,a]=GS({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,o,a]}const Fy={[fe.Left]:{x:-1,y:0},[fe.Right]:{x:1,y:0},[fe.Top]:{x:0,y:-1},[fe.Bottom]:{x:0,y:1}},L4=({source:e,sourcePosition:t=fe.Bottom,target:n})=>t===fe.Left||t===fe.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},Qy=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function H4({source:e,sourcePosition:t=fe.Bottom,target:n,targetPosition:r=fe.Top,center:s,offset:i,stepPosition:o}){const a=Fy[t],c=Fy[r],u={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},f=L4({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let x=[],b,S;const m={x:0,y:0},y={x:0,y:0},[,,g,v]=GS({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[h]*c[h]===-1){h==="x"?(b=s.x??u.x+(d.x-u.x)*o,S=s.y??(u.y+d.y)/2):(b=s.x??(u.x+d.x)/2,S=s.y??u.y+(d.y-u.y)*o);const z=[{x:b,y:u.y},{x:b,y:d.y}],A=[{x:u.x,y:S},{x:d.x,y:S}];a[h]===p?x=h==="x"?z:A:x=h==="x"?A:z}else{const z=[{x:u.x,y:d.y}],A=[{x:d.x,y:u.y}];if(h==="x"?x=a.x===p?A:z:x=a.y===p?z:A,t===r){const _=Math.abs(e[h]-n[h]);if(_<=i){const C=Math.min(i-1,i-_);a[h]===p?m[h]=(u[h]>e[h]?-1:1)*C:y[h]=(d[h]>n[h]?-1:1)*C}}if(t!==r){const _=h==="x"?"y":"x",C=a[h]===c[_],j=u[_]>d[_],D=u[_]<d[_];(a[h]===1&&(!C&&j||C&&D)||a[h]!==1&&(!C&&D||C&&j))&&(x=h==="x"?z:A)}const L={x:u.x+m.x,y:u.y+m.y},R={x:d.x+y.x,y:d.y+y.y},H=Math.max(Math.abs(L.x-x[0].x),Math.abs(R.x-x[0].x)),Y=Math.max(Math.abs(L.y-x[0].y),Math.abs(R.y-x[0].y));H>=Y?(b=(L.x+R.x)/2,S=x[0].y):(b=x[0].x,S=(L.y+R.y)/2)}const N={x:u.x+m.x,y:u.y+m.y},k={x:d.x+y.x,y:d.y+y.y};return[[e,...N.x!==x[0].x||N.y!==x[0].y?[N]:[],...x,...k.x!==x[x.length-1].x||k.y!==x[x.length-1].y?[k]:[],n],b,S,g,v]}function B4(e,t,n,r){const s=Math.min(Qy(e,t)/2,Qy(t,n)/2,r),{x:i,y:o}=t;if(e.x===i&&i===n.x||e.y===o&&o===n.y)return`L${i} ${o}`;if(e.y===o){const u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+s*u},${o}Q ${i},${o} ${i},${o+s*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${o+s*c}Q ${i},${o} ${i+s*a},${o}`}function Qp({sourceX:e,sourceY:t,sourcePosition:n=fe.Bottom,targetX:r,targetY:s,targetPosition:i=fe.Top,borderRadius:o=5,centerX:a,centerY:c,offset:u=20,stepPosition:d=.5}){const[f,h,p,x,b]=H4({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:a,y:c},offset:u,stepPosition:d});let S=`M${f[0].x} ${f[0].y}`;for(let m=1;m<f.length-1;m++)S+=B4(f[m-1],f[m],f[m+1],o);return S+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[S,h,p,x,b]}function Ky(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function U4(e){var f;const{sourceNode:t,targetNode:n}=e;if(!Ky(t)||!Ky(n))return null;const r=t.internals.handleBounds||Wy(t.handles),s=n.internals.handleBounds||Wy(n.handles),i=Jy((r==null?void 0:r.source)??[],e.sourceHandle),o=Jy(e.connectionMode===Xo.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!i||!o)return(f=e.onError)==null||f.call(e,"008",Tr.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||fe.Bottom,c=(o==null?void 0:o.position)||fe.Top,u=Oi(t,i,a),d=Oi(n,o,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function Wy(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Oi(e,t,n=fe.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:o,height:a}=t??hs(e);if(r)return{x:s+o/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case fe.Top:return{x:s+o/2,y:i};case fe.Right:return{x:s+o,y:i+a/2};case fe.Bottom:return{x:s+o/2,y:i+a};case fe.Left:return{x:s,y:i+a/2}}}function Jy(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Kp(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function I4(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((o,a)=>([a.markerStart||r,a.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=Kp(c,t);i.has(u)||(o.push({id:u,color:c.color||n,...c}),i.add(u))}}),o),[]).sort((o,a)=>o.id.localeCompare(a.id))}const PS=1e3,Z4=10,Bg={nodeOrigin:[0,0],nodeExtent:Cl,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Y4={...Bg,checkEquality:!0};function Ug(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function q4(e,t,n){const r=Ug(Bg,n);for(const s of e.values())if(s.parentId)Zg(s,e,t,r);else{const i=nc(s,r.nodeOrigin),o=Qo(s.extent)?s.extent:r.nodeExtent,a=Ri(i,o,hs(s));s.internals.positionAbsolute=a}}function V4(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function Ig(e){return e==="manual"}function Wp(e,t,n,r={}){var d,f;const s=Ug(Y4,r),i={i:0},o=new Map(t),a=s!=null&&s.elevateNodesOnSelect&&!Ig(s.zIndexMode)?PS:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=o.get(h.id);if(s.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const x=nc(h,s.nodeOrigin),b=Qo(h.extent)?h.extent:s.nodeExtent,S=Ri(x,b,hs(h));p={...s.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:S,handleBounds:V4(h,p),z:FS(h,a,s.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&&Zg(p,t,n,r,i),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function G4(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 Zg(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:o,nodeExtent:a,zIndexMode:c}=Ug(Bg,r),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}G4(e,n),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*Z4),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const f=i&&!Ig(c)?PS:0,{x:h,y:p,z:x}=X4(e,d,o,a,f,c),{positionAbsolute:b}=e.internals,S=h!==b.x||p!==b.y;(S||x!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:S?{x:h,y:p}:b,z:x}})}function FS(e,t,n){const r=or(e.zIndex)?e.zIndex:0;return Ig(n)?r:r+(e.selected?t:0)}function X4(e,t,n,r,s,i){const{x:o,y:a}=t.internals.positionAbsolute,c=hs(e),u=nc(e,n),d=Qo(e.extent)?Ri(u,e.extent,c):u;let f=Ri({x:o+d.x,y:a+d.y},r,c);e.extent==="parent"&&(f=$S(f,c,t));const h=FS(e,s,i),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function Yg(e,t,n,r=[0,0]){var o;const s=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const u=((o=i.get(a.parentId))==null?void 0:o.expandedRect)??Fo(c),d=HS(u,a.rect);i.set(a.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},u)=>{var g;const d=c.internals.positionAbsolute,f=hs(c),h=c.origin??r,p=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,x=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,b=Math.max(f.width,Math.round(a.width)),S=Math.max(f.height,Math.round(a.height)),m=(b-f.width)*h[0],y=(S-f.height)*h[1];(p>0||x>0||m||y)&&(s.push({id:u,type:"position",position:{x:c.position.x-p+m,y:c.position.y-x+y}}),(g=n.get(u))==null||g.forEach(v=>{e.some(N=>N.id===v.id)||s.push({id:v.id,type:"position",position:{x:v.position.x+p,y:v.position.y+x}})})),(f.width<a.width||f.height<a.height||p||x)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:b+(p?h[0]*p-m:0),height:S+(x?h[1]*x-y:0)}})}),s}function P4(e,t,n,r,s,i,o){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const u=[],d=window.getComputedStyle(a),{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 b=Hg(p.nodeElement),S=x.measured.width!==b.width||x.measured.height!==b.height;if(!!(b.width&&b.height&&(S||!x.internals.handleBounds||p.force))){const y=p.nodeElement.getBoundingClientRect(),g=Qo(x.extent)?x.extent:i;let{positionAbsolute:v}=x.internals;x.parentId&&x.extent==="parent"?v=$S(v,b,t.get(x.parentId)):g&&(v=Ri(v,g,b));const N={...x,measured:b,internals:{...x.internals,positionAbsolute:v,handleBounds:{source:Xy("source",p.nodeElement,y,f,x.id),target:Xy("target",p.nodeElement,y,f,x.id)}}};t.set(x.id,N),x.parentId&&Zg(N,t,n,{nodeOrigin:s,zIndexMode:o}),c=!0,S&&(u.push({id:x.id,type:"dimensions",dimensions:b}),x.expandParent&&x.parentId&&h.push({id:x.id,parentId:x.parentId,rect:Fo(N,s)}))}}if(h.length>0){const p=Yg(h,t,n,s);u.push(...p)}return{changes:u,updatedInternals:c}}async function F4({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r),a=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(a)}function ev(e,t,n,r,s,i){let o=s;const a=r.get(o)||new Map;r.set(o,a.set(n,t)),o=`${s}-${e}`;const c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),i){o=`${s}-${e}-${i}`;const u=r.get(o)||new Map;r.set(o,u.set(n,t))}}function QS(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:o=null,targetHandle:a=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:o,targetHandle:a},u=`${s}-${o}--${i}-${a}`,d=`${i}-${a}--${s}-${o}`;ev("source",c,d,e,s,o),ev("target",c,u,e,i,a),t.set(r.id,r)}}function KS(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:KS(n,t):!1}function tv(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Q4(e,t,n,r){const s=new Map;for(const[i,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!KS(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const a=e.get(i);a&&s.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return s}function jh({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var o,a,c;const s=[];for(const[u,d]of t){const f=(o=n.get(u))==null?void 0:o.internals.userNode;f&&s.push({...f,position:d.position,dragging:r})}if(!e)return[s[0],s];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function K4({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},o=sc(i,t);return{x:o.x-i.x,y:o.y-i.y}}function W4({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},o=0,a=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,x=!1,b=null;function S({noDragClassName:y,handleSelector:g,domNode:v,isSelectable:N,nodeId:k,nodeClickDistance:T=0}){h=_n(v);function z({x:H,y:Y}){const{nodeLookup:_,nodeExtent:C,snapGrid:j,snapToGrid:D,nodeOrigin:O,onNodeDrag:$,onSelectionDrag:U,onError:X,updateNodePositions:Z}=t();i={x:H,y:Y};let B=!1;const E=a.size>1,q=E&&C?Fp(rc(a)):null,V=E&&D?K4({dragItems:a,snapGrid:j,x:H,y:Y}):null;for(const[J,F]of a){if(!_.has(J))continue;let G={x:H-F.distance.x,y:Y-F.distance.y};D&&(G=V?{x:Math.round(G.x+V.x),y:Math.round(G.y+V.y)}:sc(G,j));let te=null;if(E&&C&&!F.extent&&q){const{positionAbsolute:ce}=F.internals,oe=ce.x-q.x+C[0][0],he=ce.x+F.measured.width-q.x2+C[1][0],re=ce.y-q.y+C[0][1],W=ce.y+F.measured.height-q.y2+C[1][1];te=[[oe,re],[he,W]]}const{position:le,positionAbsolute:ie}=OS({nodeId:J,nextPosition:G,nodeLookup:_,nodeExtent:te||C,nodeOrigin:O,onError:X});B=B||F.position.x!==le.x||F.position.y!==le.y,F.position=le,F.internals.positionAbsolute=ie}if(x=x||B,!!B&&(Z(a,!0),b&&(r||$||!k&&U))){const[J,F]=jh({nodeId:k,dragItems:a,nodeLookup:_});r==null||r(b,a,J,F),$==null||$(b,J,F),k||U==null||U(b,F)}}async function A(){if(!d)return;const{transform:H,panBy:Y,autoPanSpeed:_,autoPanOnNodeDrag:C}=t();if(!C){c=!1,cancelAnimationFrame(o);return}const[j,D]=LS(u,d,_);(j!==0||D!==0)&&(i.x=(i.x??0)-j/H[2],i.y=(i.y??0)-D/H[2],await Y({x:j,y:D})&&z(i)),o=requestAnimationFrame(A)}function L(H){var E;const{nodeLookup:Y,multiSelectionActive:_,nodesDraggable:C,transform:j,snapGrid:D,snapToGrid:O,selectNodesOnDrag:$,onNodeDragStart:U,onSelectionDragStart:X,unselectNodesAndEdges:Z}=t();f=!0,(!$||!N)&&!_&&k&&((E=Y.get(k))!=null&&E.selected||Z()),N&&$&&k&&(e==null||e(k));const B=cl(H.sourceEvent,{transform:j,snapGrid:D,snapToGrid:O,containerBounds:d});if(i=B,a=Q4(Y,C,B,k),a.size>0&&(n||U||!k&&X)){const[q,V]=jh({nodeId:k,dragItems:a,nodeLookup:Y});n==null||n(H.sourceEvent,a,q,V),U==null||U(H.sourceEvent,q,V),k||X==null||X(H.sourceEvent,V)}}const R=pS().clickDistance(T).on("start",H=>{const{domNode:Y,nodeDragThreshold:_,transform:C,snapGrid:j,snapToGrid:D}=t();d=(Y==null?void 0:Y.getBoundingClientRect())||null,p=!1,x=!1,b=H.sourceEvent,_===0&&L(H),i=cl(H.sourceEvent,{transform:C,snapGrid:j,snapToGrid:D,containerBounds:d}),u=ar(H.sourceEvent,d)}).on("drag",H=>{const{autoPanOnNodeDrag:Y,transform:_,snapGrid:C,snapToGrid:j,nodeDragThreshold:D,nodeLookup:O}=t(),$=cl(H.sourceEvent,{transform:_,snapGrid:C,snapToGrid:j,containerBounds:d});if(b=H.sourceEvent,(H.sourceEvent.type==="touchmove"&&H.sourceEvent.touches.length>1||k&&!O.has(k))&&(p=!0),!p){if(!c&&Y&&f&&(c=!0,A()),!f){const U=ar(H.sourceEvent,d),X=U.x-u.x,Z=U.y-u.y;Math.sqrt(X*X+Z*Z)>D&&L(H)}(i.x!==$.xSnapped||i.y!==$.ySnapped)&&a&&f&&(u=ar(H.sourceEvent,d),z($))}}).on("end",H=>{if(!(!f||p)&&(c=!1,f=!1,cancelAnimationFrame(o),a.size>0)){const{nodeLookup:Y,updateNodePositions:_,onNodeDragStop:C,onSelectionDragStop:j}=t();if(x&&(_(a,!1),x=!1),s||C||!k&&j){const[D,O]=jh({nodeId:k,dragItems:a,nodeLookup:Y,dragging:!1});s==null||s(H.sourceEvent,a,D,O),C==null||C(H.sourceEvent,D,O),k||j==null||j(H.sourceEvent,O)}}}).filter(H=>{const Y=H.target;return!H.button&&(!y||!tv(Y,`.${y}`,v))&&(!g||tv(Y,g,v))});h.call(R)}function m(){h==null||h.on(".drag",null)}return{update:S,destroy:m}}function J4(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())zl(s,Fo(i))>0&&r.push(i);return r}const eD=250;function tD(e,t,n,r){var a,c;let s=[],i=1/0;const o=J4(e,n,t+eD);for(const u of o){const d=[...((a=u.internals.handleBounds)==null?void 0:a.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:h,y:p}=Oi(u,f,f.position,!0),x=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));x>t||(x<i?(s=[{...f,x:h,y:p}],i=x):x===i&&s.push({...f,x:h,y:p}))}}if(!s.length)return null;if(s.length>1){const u=r.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function WS(e,t,n,r,s,i=!1){var u,d,f;const o=r.get(e);if(!o)return null;const a=s==="strict"?(u=o.internals.handleBounds)==null?void 0:u[t]:[...((d=o.internals.handleBounds)==null?void 0:d.source)??[],...((f=o.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?a==null?void 0:a.find(h=>h.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Oi(o,c,c.position,!0)}:c}function JS(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function nD(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const e_=()=>!0;function rD(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:o,domNode:a,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:x,onConnect:b,onConnectEnd:S,isValidConnection:m=e_,onReconnectEnd:y,updateConnection:g,getTransform:v,getFromHandle:N,autoPanSpeed:k,dragThreshold:T=1,handleDomNode:z}){const A=IS(e.target);let L=0,R;const{x:H,y:Y}=ar(e),_=JS(i,z),C=a==null?void 0:a.getBoundingClientRect();let j=!1;if(!C||!_)return;const D=WS(s,_,r,c,t);if(!D)return;let O=ar(e,C),$=!1,U=null,X=!1,Z=null;function B(){if(!d||!C)return;const[le,ie]=LS(O,C,k);h({x:le,y:ie}),L=requestAnimationFrame(B)}const E={...D,nodeId:s,type:_,position:D.position},q=c.get(s);let J={inProgress:!0,isValid:null,from:Oi(q,E,fe.Left,!0),fromHandle:E,fromPosition:E.position,fromNode:q,to:O,toHandle:null,toPosition:Yy[E.position],toNode:null,pointer:O};function F(){j=!0,g(J),x==null||x(e,{nodeId:s,handleId:r,handleType:_})}T===0&&F();function G(le){if(!j){const{x:W,y:ge}=ar(le),Ue=W-H,it=ge-Y;if(!(Ue*Ue+it*it>T*T))return;F()}if(!N()||!E){te(le);return}const ie=v();O=ar(le,C),R=tD(ic(O,ie,!1,[1,1]),n,c,E),$||(B(),$=!0);const ce=t_(le,{handle:R,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:o?"target":"source",isValidConnection:m,doc:A,lib:u,flowId:f,nodeLookup:c});Z=ce.handleDomNode,U=ce.connection,X=nD(!!R,ce.isValid);const oe=c.get(s),he=oe?Oi(oe,E,fe.Left,!0):J.from,re={...J,from:he,isValid:X,to:ce.toHandle&&X?_d({x:ce.toHandle.x,y:ce.toHandle.y},ie):O,toHandle:ce.toHandle,toPosition:X&&ce.toHandle?ce.toHandle.position:Yy[E.position],toNode:ce.toHandle?c.get(ce.toHandle.nodeId):null,pointer:O};g(re),J=re}function te(le){if(!("touches"in le&&le.touches.length>0)){if(j){(R||Z)&&U&&X&&(b==null||b(U));const{inProgress:ie,...ce}=J,oe={...ce,toPosition:J.toHandle?J.toPosition:null};S==null||S(le,oe),i&&(y==null||y(le,oe))}p(),cancelAnimationFrame(L),$=!1,X=!1,U=null,Z=null,A.removeEventListener("mousemove",G),A.removeEventListener("mouseup",te),A.removeEventListener("touchmove",G),A.removeEventListener("touchend",te)}}A.addEventListener("mousemove",G),A.addEventListener("mouseup",te),A.addEventListener("touchmove",G),A.addEventListener("touchend",te)}function t_(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:o,lib:a,flowId:c,isValidConnection:u=e_,nodeLookup:d}){const f=i==="target",h=t?o.querySelector(`.${a}-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}=ar(e),b=o.elementFromPoint(p,x),S=b!=null&&b.classList.contains(`${a}-flow__handle`)?b:h,m={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const y=JS(void 0,S),g=S.getAttribute("data-nodeid"),v=S.getAttribute("data-handleid"),N=S.classList.contains("connectable"),k=S.classList.contains("connectableend");if(!g||!y)return m;const T={source:f?g:r,sourceHandle:f?v:s,target:f?r:g,targetHandle:f?s:v};m.connection=T;const A=N&&k&&(n===Xo.Strict?f&&y==="source"||!f&&y==="target":g!==r||v!==s);m.isValid=A&&u(T),m.toHandle=WS(g,y,v,d,n,!0)}return m}const Jp={onPointerDown:rD,isValid:t_};function sD({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=_n(e);function i({translateExtent:a,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const x=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const v=n(),N=g.sourceEvent.ctrlKey&&Dl()?10:1,k=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*d,T=v[2]*Math.pow(2,k*N);t.scaleTo(T)};let b=[0,0];const S=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(b=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},m=g=>{const v=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const N=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],k=[N[0]-b[0],N[1]-b[1]];b=N;const T=r()*Math.max(v[2],Math.log(v[2]))*(p?-1:1),z={x:v[0]-k[0]*T,y:v[1]-k[1]*T},A=[[0,0],[c,u]];t.setViewportConstrained({x:z.x,y:z.y,zoom:v[2]},A,a)},y=AS().on("start",S).on("zoom",f?m:null).on("zoom.wheel",h?x:null);s.call(y,{})}function o(){s.on("zoom",null)}return{update:i,destroy:o,pointer:tr}}const lf=e=>({x:e.x,y:e.y,zoom:e.k}),Eh=({x:e,y:t,zoom:n})=>sf.translate(e,t).scale(n),xo=(e,t)=>e.target.closest(`.${t}`),n_=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),iD=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Th=(e,t=0,n=iD,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},r_=e=>{const t=e.ctrlKey&&Dl()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function oD({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:o,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(xo(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&o){const S=tr(d),m=r_(d),y=f*Math.pow(2,m);r.scaleTo(n,y,S,d);return}const h=d.deltaMode===1?20:1;let p=s===Ni.Vertical?0:d.deltaX*h,x=s===Ni.Horizontal?0:d.deltaY*h;!Dl()&&d.shiftKey&&s!==Ni.Vertical&&(p=d.deltaY*h,x=0),r.translateBy(n,-(p/f)*i,-(x/f)*i,{internal:!0});const b=lf(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(d,b))}}function aD({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",o=!t&&i&&!r.ctrlKey,a=xo(r,e);if(r.ctrlKey&&i&&a&&r.preventDefault(),o||a)return null;r.preventDefault(),n.call(this,r,s)}}function lD({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,o,a;if((i=r.sourceEvent)!=null&&i.internal)return;const s=lf(r.transform);e.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function cD({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var o,a;e.usedRightMouseButton=!!(n&&n_(t,e.mouseButton??0)),(o=i.sourceEvent)!=null&&o.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((a=i.sourceEvent)!=null&&a.internal)&&(s==null||s(i.sourceEvent,lf(i.transform)))}}function uD({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return o=>{var a;if(!((a=o.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&n_(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&i(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=lf(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(o.sourceEvent,c)},n?150:0)}}}function dD({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:o,noWheelClassName:a,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var S;const h=e||t,p=n&&f.ctrlKey,x=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(xo(f,`${u}-flow__node`)||xo(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!s&&!i&&!n||o||d&&!x||xo(f,a)&&x||xo(f,c)&&(!x||s&&x&&!e)||!n&&f.ctrlKey&&x)return!1;if(!n&&f.type==="touchstart"&&((S=f.touches)==null?void 0:S.length)>1)return f.preventDefault(),!1;if(!h&&!s&&!p&&x||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||x)&&b}}function fD({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:o,onPanZoomEnd:a,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=AS().scaleExtent([t,n]).translateExtent(r),h=_n(e).call(f);y({x:s.x,y:s.y,zoom:Po(s.zoom,t,n)},[[0,0],[d.width,d.height]],r);const p=h.on("wheel.zoom"),x=h.on("dblclick.zoom");f.wheelDelta(r_);function b(R,H){return h?new Promise(Y=>{f==null||f.interpolate((H==null?void 0:H.interpolate)==="linear"?ll:Nu).transform(Th(h,H==null?void 0:H.duration,H==null?void 0:H.ease,()=>Y(!0)),R)}):Promise.resolve(!1)}function S({noWheelClassName:R,noPanClassName:H,onPaneContextMenu:Y,userSelectionActive:_,panOnScroll:C,panOnDrag:j,panOnScrollMode:D,panOnScrollSpeed:O,preventScrolling:$,zoomOnPinch:U,zoomOnScroll:X,zoomOnDoubleClick:Z,zoomActivationKeyPressed:B,lib:E,onTransformChange:q,connectionInProgress:V,paneClickDistance:J,selectionOnDrag:F}){_&&!u.isZoomingOrPanning&&m();const G=C&&!B&&!_;f.clickDistance(F?1/0:!or(J)||J<0?0:J);const te=G?oD({zoomPanValues:u,noWheelClassName:R,d3Selection:h,d3Zoom:f,panOnScrollMode:D,panOnScrollSpeed:O,zoomOnPinch:U,onPanZoomStart:o,onPanZoom:i,onPanZoomEnd:a}):aD({noWheelClassName:R,preventScrolling:$,d3ZoomHandler:p});if(h.on("wheel.zoom",te,{passive:!1}),!_){const ie=lD({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:o});f.on("start",ie);const ce=cD({zoomPanValues:u,panOnDrag:j,onPaneContextMenu:!!Y,onPanZoom:i,onTransformChange:q});f.on("zoom",ce);const oe=uD({zoomPanValues:u,panOnDrag:j,panOnScroll:C,onPaneContextMenu:Y,onPanZoomEnd:a,onDraggingChange:c});f.on("end",oe)}const le=dD({zoomActivationKeyPressed:B,panOnDrag:j,zoomOnScroll:X,panOnScroll:C,zoomOnDoubleClick:Z,zoomOnPinch:U,userSelectionActive:_,noPanClassName:H,noWheelClassName:R,lib:E,connectionInProgress:V});f.filter(le),Z?h.on("dblclick.zoom",x):h.on("dblclick.zoom",null)}function m(){f.on("zoom",null)}async function y(R,H,Y){const _=Eh(R),C=f==null?void 0:f.constrain()(_,H,Y);return C&&await b(C),new Promise(j=>j(C))}async function g(R,H){const Y=Eh(R);return await b(Y,H),new Promise(_=>_(Y))}function v(R){if(h){const H=Eh(R),Y=h.property("__zoom");(Y.k!==R.zoom||Y.x!==R.x||Y.y!==R.y)&&(f==null||f.transform(h,H,null,{sync:!0}))}}function N(){const R=h?TS(h.node()):{x:0,y:0,k:1};return{x:R.x,y:R.y,zoom:R.k}}function k(R,H){return h?new Promise(Y=>{f==null||f.interpolate((H==null?void 0:H.interpolate)==="linear"?ll:Nu).scaleTo(Th(h,H==null?void 0:H.duration,H==null?void 0:H.ease,()=>Y(!0)),R)}):Promise.resolve(!1)}function T(R,H){return h?new Promise(Y=>{f==null||f.interpolate((H==null?void 0:H.interpolate)==="linear"?ll:Nu).scaleBy(Th(h,H==null?void 0:H.duration,H==null?void 0:H.ease,()=>Y(!0)),R)}):Promise.resolve(!1)}function z(R){f==null||f.scaleExtent(R)}function A(R){f==null||f.translateExtent(R)}function L(R){const H=!or(R)||R<0?0:R;f==null||f.clickDistance(H)}return{update:S,destroy:m,setViewport:g,setViewportConstrained:y,getViewport:N,scaleTo:k,scaleBy:T,setScaleExtent:z,setTranslateExtent:A,syncViewport:v,setClickDistance:L}}var Ko;(function(e){e.Line="line",e.Handle="handle"})(Ko||(Ko={}));function hD({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const o=e-t,a=n-r,c=[o>0?1:o<0?-1:0,a>0?1:a<0?-1:0];return o&&s&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function nv(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function ws(e,t){return Math.max(0,t-e)}function Ss(e,t){return Math.max(0,e-t)}function Wc(e,t,n){return Math.max(0,t-e,e-n)}function rv(e,t){return e?!t:t}function pD(e,t,n,r,s,i,o,a){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:x}=n,{minWidth:b,maxWidth:S,minHeight:m,maxHeight:y}=r,{x:g,y:v,width:N,height:k,aspectRatio:T}=e;let z=Math.floor(d?p-e.pointerX:0),A=Math.floor(f?x-e.pointerY:0);const L=N+(c?-z:z),R=k+(u?-A:A),H=-i[0]*N,Y=-i[1]*k;let _=Wc(L,b,S),C=Wc(R,m,y);if(o){let O=0,$=0;c&&z<0?O=ws(g+z+H,o[0][0]):!c&&z>0&&(O=Ss(g+L+H,o[1][0])),u&&A<0?$=ws(v+A+Y,o[0][1]):!u&&A>0&&($=Ss(v+R+Y,o[1][1])),_=Math.max(_,O),C=Math.max(C,$)}if(a){let O=0,$=0;c&&z>0?O=Ss(g+z,a[0][0]):!c&&z<0&&(O=ws(g+L,a[1][0])),u&&A>0?$=Ss(v+A,a[0][1]):!u&&A<0&&($=ws(v+R,a[1][1])),_=Math.max(_,O),C=Math.max(C,$)}if(s){if(d){const O=Wc(L/T,m,y)*T;if(_=Math.max(_,O),o){let $=0;!c&&!u||c&&!u&&h?$=Ss(v+Y+L/T,o[1][1])*T:$=ws(v+Y+(c?z:-z)/T,o[0][1])*T,_=Math.max(_,$)}if(a){let $=0;!c&&!u||c&&!u&&h?$=ws(v+L/T,a[1][1])*T:$=Ss(v+(c?z:-z)/T,a[0][1])*T,_=Math.max(_,$)}}if(f){const O=Wc(R*T,b,S)/T;if(C=Math.max(C,O),o){let $=0;!c&&!u||u&&!c&&h?$=Ss(g+R*T+H,o[1][0])/T:$=ws(g+(u?A:-A)*T+H,o[0][0])/T,C=Math.max(C,$)}if(a){let $=0;!c&&!u||u&&!c&&h?$=ws(g+R*T,a[1][0])/T:$=Ss(g+(u?A:-A)*T,a[0][0])/T,C=Math.max(C,$)}}}A=A+(A<0?C:-C),z=z+(z<0?_:-_),s&&(h?L>R*T?A=(rv(c,u)?-z:z)/T:z=(rv(c,u)?-A:A)*T:d?(A=z/T,u=c):(z=A*T,c=u));const j=c?g+z:g,D=u?v+A:v;return{width:N+(c?-z:z),height:k+(u?-A:A),x:i[0]*z*(c?-1:1)+j,y:i[1]*A*(u?-1:1)+D}}const s_={width:0,height:0,x:0,y:0},mD={...s_,pointerX:0,pointerY:0,aspectRatio:1};function gD(e){return[[0,0],[e.measured.width,e.measured.height]]}function xD(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,o=e.measured.height??0,a=n[0]*i,c=n[1]*o;return[[r-a,s-c],[r+i-a,s+o-c]]}function yD({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=_n(e);let o={controlDirection:nv("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:x,onResizeEnd:b,shouldResize:S}){let m={...s_},y={...mD};o={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:nv(u)};let g,v=null,N=[],k,T,z,A=!1;const L=pS().on("start",R=>{const{nodeLookup:H,transform:Y,snapGrid:_,snapToGrid:C,nodeOrigin:j,paneDomNode:D}=n();if(g=H.get(t),!g)return;v=(D==null?void 0:D.getBoundingClientRect())??null;const{xSnapped:O,ySnapped:$}=cl(R.sourceEvent,{transform:Y,snapGrid:_,snapToGrid:C,containerBounds:v});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},y={...m,pointerX:O,pointerY:$,aspectRatio:m.width/m.height},k=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(k=H.get(g.parentId),T=k&&g.extent==="parent"?gD(k):void 0),N=[],z=void 0;for(const[U,X]of H)if(X.parentId===t&&(N.push({id:U,position:{...X.position},extent:X.extent}),X.extent==="parent"||X.expandParent)){const Z=xD(X,g,X.origin??j);z?z=[[Math.min(Z[0][0],z[0][0]),Math.min(Z[0][1],z[0][1])],[Math.max(Z[1][0],z[1][0]),Math.max(Z[1][1],z[1][1])]]:z=Z}p==null||p(R,{...m})}).on("drag",R=>{const{transform:H,snapGrid:Y,snapToGrid:_,nodeOrigin:C}=n(),j=cl(R.sourceEvent,{transform:H,snapGrid:Y,snapToGrid:_,containerBounds:v}),D=[];if(!g)return;const{x:O,y:$,width:U,height:X}=m,Z={},B=g.origin??C,{width:E,height:q,x:V,y:J}=pD(y,o.controlDirection,j,o.boundaries,o.keepAspectRatio,B,T,z),F=E!==U,G=q!==X,te=V!==O&&F,le=J!==$&&G;if(!te&&!le&&!F&&!G)return;if((te||le||B[0]===1||B[1]===1)&&(Z.x=te?V:m.x,Z.y=le?J:m.y,m.x=Z.x,m.y=Z.y,N.length>0)){const he=V-O,re=J-$;for(const W of N)W.position={x:W.position.x-he+B[0]*(E-U),y:W.position.y-re+B[1]*(q-X)},D.push(W)}if((F||G)&&(Z.width=F&&(!o.resizeDirection||o.resizeDirection==="horizontal")?E:m.width,Z.height=G&&(!o.resizeDirection||o.resizeDirection==="vertical")?q:m.height,m.width=Z.width,m.height=Z.height),k&&g.expandParent){const he=B[0]*(Z.width??0);Z.x&&Z.x<he&&(m.x=he,y.x=y.x-(Z.x-he));const re=B[1]*(Z.height??0);Z.y&&Z.y<re&&(m.y=re,y.y=y.y-(Z.y-re))}const ie=hD({width:m.width,prevWidth:U,height:m.height,prevHeight:X,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),ce={...m,direction:ie};(S==null?void 0:S(R,ce))!==!1&&(A=!0,x==null||x(R,ce),r(Z,D))}).on("end",R=>{A&&(b==null||b(R,{...m}),s==null||s({...m}),A=!1)});i.call(L)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var i_={exports:{}},o_={},a_={exports:{}},l_={};/**
146
+ * @license React
147
+ * use-sync-external-store-shim.production.js
148
+ *
149
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
150
+ *
151
+ * This source code is licensed under the MIT license found in the
152
+ * LICENSE file in the root directory of this source tree.
153
+ */var Wo=w;function vD(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var bD=typeof Object.is=="function"?Object.is:vD,wD=Wo.useState,SD=Wo.useEffect,_D=Wo.useLayoutEffect,kD=Wo.useDebugValue;function ND(e,t){var n=t(),r=wD({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return _D(function(){s.value=n,s.getSnapshot=t,Ah(s)&&i({inst:s})},[e,n,t]),SD(function(){return Ah(s)&&i({inst:s}),e(function(){Ah(s)&&i({inst:s})})},[e]),kD(n),n}function Ah(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!bD(e,n)}catch{return!0}}function jD(e,t){return t()}var ED=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?jD:ND;l_.useSyncExternalStore=Wo.useSyncExternalStore!==void 0?Wo.useSyncExternalStore:ED;a_.exports=l_;var TD=a_.exports;/**
154
+ * @license React
155
+ * use-sync-external-store-shim/with-selector.production.js
156
+ *
157
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
158
+ *
159
+ * This source code is licensed under the MIT license found in the
160
+ * LICENSE file in the root directory of this source tree.
161
+ */var cf=w,AD=TD;function CD(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var MD=typeof Object.is=="function"?Object.is:CD,zD=AD.useSyncExternalStore,DD=cf.useRef,RD=cf.useEffect,OD=cf.useMemo,$D=cf.useDebugValue;o_.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=DD(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=OD(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&o.hasValue){var x=o.value;if(s(x,p))return f=x}return f=p}if(x=f,MD(d,p))return x;var b=r(p);return s!==void 0&&s(x,b)?(d=p,x):(d=p,f=b)}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,r,s]);var a=zD(e,i[0],i[1]);return RD(function(){o.hasValue=!0,o.value=a},[a]),$D(a),a};i_.exports=o_;var LD=i_.exports;const HD=sb(LD),BD={},sv=e=>{let t;const n=new Set,r=(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))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(BD?"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(r,s,c);return c},UD=e=>e?sv(e):sv,{useDebugValue:ID}=Xe,{useSyncExternalStoreWithSelector:ZD}=HD,YD=e=>e;function c_(e,t=YD,n){const r=ZD(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ID(r),r}const iv=(e,t)=>{const n=UD(e),r=(s,i=t)=>c_(n,s,i);return Object.assign(r,n),r},qD=(e,t)=>e?iv(e,t):iv;function We(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[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const uf=w.createContext(null),VD=uf.Provider,u_=Tr.error001();function Ne(e,t){const n=w.useContext(uf);if(n===null)throw new Error(u_);return c_(n,e,t)}function Je(){const e=w.useContext(uf);if(e===null)throw new Error(u_);return w.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ov={display:"none"},GD={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},d_="react-flow__node-desc",f_="react-flow__edge-desc",XD="react-flow__aria-live",PD=e=>e.ariaLiveMessage,FD=e=>e.ariaLabelConfig;function QD({rfId:e}){const t=Ne(PD);return l.jsx("div",{id:`${XD}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:GD,children:t})}function KD({rfId:e,disableKeyboardA11y:t}){const n=Ne(FD);return l.jsxs(l.Fragment,{children:[l.jsx("div",{id:`${d_}-${e}`,style:ov,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),l.jsx("div",{id:`${f_}-${e}`,style:ov,children:n["edge.a11yDescription.default"]}),!t&&l.jsx(QD,{rfId:e})]})}const df=w.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const o=`${e}`.split("-");return l.jsx("div",{className:xt(["react-flow__panel",n,...o]),style:r,ref:i,...s,children:t})});df.displayName="Panel";function WD({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:l.jsx(df,{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:l.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const JD=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Jc=e=>e.id;function eR(e,t){return We(e.selectedNodes.map(Jc),t.selectedNodes.map(Jc))&&We(e.selectedEdges.map(Jc),t.selectedEdges.map(Jc))}function tR({onSelectionChange:e}){const t=Je(),{selectedNodes:n,selectedEdges:r}=Ne(JD,eR);return w.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const nR=e=>!!e.onSelectionChangeHandlers;function rR({onSelectionChange:e}){const t=Ne(nR);return e||t?l.jsx(tR,{onSelectionChange:e}):null}const em=typeof window<"u"?w.useLayoutEffect:w.useEffect,h_=[0,0],sR={x:0,y:0,zoom:1},iR=["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"],av=[...iR,"rfId"],oR=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}),lv={translateExtent:Cl,nodeOrigin:h_,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function aR(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:o,reset:a,setDefaultNodesAndEdges:c}=Ne(oR,We),u=Je();em(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=lv,a()}),[]);const d=w.useRef(lv);return em(()=>{for(const f of av){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?s(h):f==="translateExtent"?i(h):f==="nodeExtent"?o(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:C4(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},av.map(f=>e[f])),null}function cv(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function lR(e){var r;const[t,n]=w.useState(e==="system"?null:e);return w.useEffect(()=>{if(e!=="system"){n(e);return}const s=cv(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),t!==null?t:(r=cv())!=null&&r.matches?"dark":"light"}const uv=typeof document<"u"?document:null;function Rl(e=null,t={target:uv,actInsideInputWithModifier:!0}){const[n,r]=w.useState(!1),s=w.useRef(!1),i=w.useRef(new Set([])),[o,a]=w.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
162
+ `).replace(`
163
+
164
+ `,`
165
+ +`).split(`
166
+ `)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return w.useEffect(()=>{const c=(t==null?void 0:t.target)??uv,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var S,m;if(s.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!s.current||s.current&&!u)&&ZS(p))return!1;const b=fv(p.code,a);if(i.current.add(p[b]),dv(o,i.current,!1)){const y=((m=(S=p.composedPath)==null?void 0:S.call(p))==null?void 0:m[0])||p.target,g=(y==null?void 0:y.nodeName)==="BUTTON"||(y==null?void 0:y.nodeName)==="A";t.preventDefault!==!1&&(s.current||!g)&&p.preventDefault(),r(!0)}},f=p=>{const x=fv(p.code,a);dv(o,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(p[x]),p.key==="Meta"&&i.current.clear(),s.current=!1},h=()=>{i.current.clear(),r(!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,r]),n}function dv(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function fv(e,t){return t.includes(e)?"code":"key"}const cR=()=>{const e=Je();return w.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:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:o,panZoom:a}=e.getState(),c=Lg(t,r,s,i,o,(n==null?void 0:n.padding)??.1);return a?(await a.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:r,snapGrid:s,snapToGrid:i,domNode:o}=e.getState();if(!o)return t;const{x:a,y:c}=o.getBoundingClientRect(),u={x:t.x-a,y:t.y-c},d=n.snapGrid??s,f=n.snapToGrid??i;return ic(u,r,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),o=_d(t,n);return{x:o.x+s,y:o.y+i}}}),[])};function p_(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const o=r.get(i.id);o?o.push(i):r.set(i.id,[i])}for(const i of t){const o=r.get(i.id);if(!o){n.push(i);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const a={...i};for(const c of o)uR(c,a);n.push(a)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function uR(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 m_(e,t){return p_(e,t)}function g_(e,t){return p_(e,t)}function mi(e,t){return{id:e,type:"select",selected:t}}function yo(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const o=t.has(s);!(i.selected===void 0&&!o)&&i.selected!==o&&(n&&(i.selected=o),r.push(mi(i.id,o)))}return r}function hv({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,o]of e.entries()){const a=t.get(o.id),c=((s=a==null?void 0:a.internals)==null?void 0:s.userNode)??a;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function pv(e){return{id:e.id,type:"remove"}}const mv=e=>b4(e),dR=e=>RS(e);function x_(e){return w.forwardRef(e)}function gv(e){const[t,n]=w.useState(BigInt(0)),[r]=w.useState(()=>fR(()=>n(s=>s+BigInt(1))));return em(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function fR(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const y_=w.createContext(null);function hR({children:e}){const t=Je(),n=w.useCallback(a=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:x}=t.getState();let b=c;for(const m of a)b=typeof m=="function"?m(b):m;let S=hv({items:b,lookup:h});for(const m of x.values())S=m(S);d&&u(b),S.length>0?f==null||f(S):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:y,setNodes:g}=t.getState();m&&g(y)})},[]),r=gv(n),s=w.useCallback(a=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const x of a)p=typeof x=="function"?x(p):x;d?u(p):f&&f(hv({items:p,lookup:h}))},[]),i=gv(s),o=w.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return l.jsx(y_.Provider,{value:o,children:e})}function pR(){const e=w.useContext(y_);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const mR=e=>!!e.panZoom;function qg(){const e=cR(),t=Je(),n=pR(),r=Ne(mR),s=w.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),o=f=>{n.nodeQueue.push(f)},a=f=>{n.edgeQueue.push(f)},c=f=>{var m,y;const{nodeLookup:h,nodeOrigin:p}=t.getState(),x=mv(f)?f:h.get(f.id),b=x.parentId?US(x.position,x.measured,x.parentId,h,p):x.position,S={...x,position:b,width:((m=x.measured)==null?void 0:m.width)??x.width,height:((y=x.measured)==null?void 0:y.height)??x.height};return Fo(S)},u=(f,h,p={replace:!1})=>{o(x=>x.map(b=>{if(b.id===f){const S=typeof h=="function"?h(b):h;return p.replace&&mv(S)?S:{...b,...S}}return b}))},d=(f,h,p={replace:!1})=>{a(x=>x.map(b=>{if(b.id===f){const S=typeof h=="function"?h(b):h;return p.replace&&dR(S)?S:{...b,...S}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=i(f))==null?void 0:h.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:o,setEdges:a,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,b,S]=p;return{nodes:f.map(m=>({...m})),edges:h.map(m=>({...m})),viewport:{x,y:b,zoom:S}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:x,onNodesDelete:b,onEdgesDelete:S,triggerNodeChanges:m,triggerEdgeChanges:y,onDelete:g,onBeforeDelete:v}=t.getState(),{nodes:N,edges:k}=await N4({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:x,onBeforeDelete:v}),T=k.length>0,z=N.length>0;if(T){const A=k.map(pv);S==null||S(k),y(A)}if(z){const A=N.map(pv);b==null||b(N),m(A)}return(z||T)&&(g==null||g({nodes:N,edges:k})),{deletedNodes:N,deletedEdges:k}},getIntersectingNodes:(f,h=!0,p)=>{const x=Vy(f),b=x?f:c(f),S=p!==void 0;return b?(p||t.getState().nodes).filter(m=>{const y=t.getState().nodeLookup.get(m.id);if(y&&!x&&(m.id===f.id||!y.internals.positionAbsolute))return!1;const g=Fo(S?m:y),v=zl(g,b);return h&&v>0||v>=g.width*g.height||v>=b.width*b.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const b=Vy(f)?f:c(f);if(!b)return!1;const S=zl(b,h);return p&&S>0||S>=h.width*h.height||S>=b.width*b.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,x=>{const b=typeof h=="function"?h(x):h;return p.replace?{...x,data:b}:{...x,data:{...x.data,...b}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,x=>{const b=typeof h=="function"?h(x):h;return p.replace?{...x,data:b}:{...x,data:{...x.data,...b}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return w4(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??A4();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return w.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const xv=e=>e.selected,gR=typeof window<"u"?window:void 0;function xR({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Je(),{deleteElements:r}=qg(),s=Rl(e,{actInsideInputWithModifier:!1}),i=Rl(t,{target:gR});w.useEffect(()=>{if(s){const{edges:o,nodes:a}=n.getState();r({nodes:a.filter(xv),edges:o.filter(xv)}),n.setState({nodesSelectionActive:!1})}},[s]),w.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function yR(e){const t=Je();w.useEffect(()=>{const n=()=>{var s,i,o,a;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=Hg(e.current);(r.height===0||r.width===0)&&((a=(o=t.getState()).onError)==null||a.call(o,"004",Tr.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const ff={position:"absolute",width:"100%",height:"100%",top:0,left:0},vR=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function bR({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=Ni.Free,zoomOnDoubleClick:o=!0,panOnDrag:a=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:x,noWheelClassName:b,noPanClassName:S,onViewportChange:m,isControlledViewport:y,paneClickDistance:g,selectionOnDrag:v}){const N=Je(),k=w.useRef(null),{userSelectionActive:T,lib:z,connectionInProgress:A}=Ne(vR,We),L=Rl(h),R=w.useRef();yR(k);const H=w.useCallback(Y=>{m==null||m({x:Y[0],y:Y[1],zoom:Y[2]}),y||N.setState({transform:Y})},[m,y]);return w.useEffect(()=>{if(k.current){R.current=fD({domNode:k.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:j=>N.setState(D=>D.paneDragging===j?D:{paneDragging:j}),onPanZoomStart:(j,D)=>{const{onViewportChangeStart:O,onMoveStart:$}=N.getState();$==null||$(j,D),O==null||O(D)},onPanZoom:(j,D)=>{const{onViewportChange:O,onMove:$}=N.getState();$==null||$(j,D),O==null||O(D)},onPanZoomEnd:(j,D)=>{const{onViewportChangeEnd:O,onMoveEnd:$}=N.getState();$==null||$(j,D),O==null||O(D)}});const{x:Y,y:_,zoom:C}=R.current.getViewport();return N.setState({panZoom:R.current,transform:[Y,_,C],domNode:k.current.closest(".react-flow")}),()=>{var j;(j=R.current)==null||j.destroy()}}},[]),w.useEffect(()=>{var Y;(Y=R.current)==null||Y.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:o,panOnDrag:a,zoomActivationKeyPressed:L,preventScrolling:p,noPanClassName:S,userSelectionActive:T,noWheelClassName:b,lib:z,onTransformChange:H,connectionInProgress:A,selectionOnDrag:v,paneClickDistance:g})},[e,t,n,r,s,i,o,a,L,p,S,T,b,z,H,A,v,g]),l.jsx("div",{className:"react-flow__renderer",ref:k,style:ff,children:x})}const wR=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function SR(){const{userSelectionActive:e,userSelectionRect:t}=Ne(wR,We);return e&&t?l.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 Ch=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},_R=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function kR({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Ml.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:o,onSelectionEnd:a,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:h,onPaneMouseLeave:p,children:x}){const b=Je(),{userSelectionActive:S,elementsSelectable:m,dragging:y,connectionInProgress:g}=Ne(_R,We),v=m&&(e||S),N=w.useRef(null),k=w.useRef(),T=w.useRef(new Set),z=w.useRef(new Set),A=w.useRef(!1),L=O=>{if(A.current||g){A.current=!1;return}c==null||c(O),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},R=O=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){O.preventDefault();return}u==null||u(O)},H=d?O=>d(O):void 0,Y=O=>{A.current&&(O.stopPropagation(),A.current=!1)},_=O=>{var q,V;const{domNode:$}=b.getState();if(k.current=$==null?void 0:$.getBoundingClientRect(),!k.current)return;const U=O.target===N.current;if(!U&&!!O.target.closest(".nokey")||!e||!(i&&U||t)||O.button!==0||!O.isPrimary)return;(V=(q=O.target)==null?void 0:q.setPointerCapture)==null||V.call(q,O.pointerId),A.current=!1;const{x:B,y:E}=ar(O.nativeEvent,k.current);b.setState({userSelectionRect:{width:0,height:0,startX:B,startY:E,x:B,y:E}}),U||(O.stopPropagation(),O.preventDefault())},C=O=>{const{userSelectionRect:$,transform:U,nodeLookup:X,edgeLookup:Z,connectionLookup:B,triggerNodeChanges:E,triggerEdgeChanges:q,defaultEdgeOptions:V,resetSelectedElements:J}=b.getState();if(!k.current||!$)return;const{x:F,y:G}=ar(O.nativeEvent,k.current),{startX:te,startY:le}=$;if(!A.current){const re=t?0:s;if(Math.hypot(F-te,G-le)<=re)return;J(),o==null||o(O)}A.current=!0;const ie={startX:te,startY:le,x:F<te?F:te,y:G<le?G:le,width:Math.abs(F-te),height:Math.abs(G-le)},ce=T.current,oe=z.current;T.current=new Set($g(X,ie,U,n===Ml.Partial,!0).map(re=>re.id)),z.current=new Set;const he=(V==null?void 0:V.selectable)??!0;for(const re of T.current){const W=B.get(re);if(W)for(const{edgeId:ge}of W.values()){const Ue=Z.get(ge);Ue&&(Ue.selectable??he)&&z.current.add(ge)}}if(!Gy(ce,T.current)){const re=yo(X,T.current,!0);E(re)}if(!Gy(oe,z.current)){const re=yo(Z,z.current);q(re)}b.setState({userSelectionRect:ie,userSelectionActive:!0,nodesSelectionActive:!1})},j=O=>{var $,U;O.button===0&&((U=($=O.target)==null?void 0:$.releasePointerCapture)==null||U.call($,O.pointerId),!S&&O.target===N.current&&b.getState().userSelectionRect&&(L==null||L(O)),b.setState({userSelectionActive:!1,userSelectionRect:null}),A.current&&(a==null||a(O),b.setState({nodesSelectionActive:T.current.size>0})))},D=r===!0||Array.isArray(r)&&r.includes(0);return l.jsxs("div",{className:xt(["react-flow__pane",{draggable:D,dragging:y,selection:e}]),onClick:v?void 0:Ch(L,N),onContextMenu:Ch(R,N),onWheel:Ch(H,N),onPointerEnter:v?void 0:f,onPointerMove:v?C:h,onPointerUp:v?j:void 0,onPointerDownCapture:v?_:void 0,onClickCapture:v?Y:void 0,onPointerLeave:p,ref:N,style:ff,children:[x,l.jsx(SR,{})]})}function tm({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:o,nodeLookup:a,onError:c}=t.getState(),u=a.get(e);if(!u){c==null||c("012",Tr.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):s([e])}function v_({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:o}){const a=Je(),[c,u]=w.useState(!1),d=w.useRef();return w.useEffect(()=>{d.current=W4({getStoreItems:()=>a.getState(),onNodeMouseDown:f=>{tm({id:f,store:a,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),w.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:o}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,r,t,i,e,s,o]),c}const NR=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function b_(){const e=Je();return w.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:o,onError:a,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=NR(o),p=s?i[0]:5,x=s?i[1]:5,b=n.direction.x*p*n.factor,S=n.direction.y*x*n.factor;for(const[,m]of u){if(!h(m))continue;let y={x:m.internals.positionAbsolute.x+b,y:m.internals.positionAbsolute.y+S};s&&(y=sc(y,i));const{position:g,positionAbsolute:v}=OS({nodeId:m.id,nextPosition:y,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:a});m.position=g,m.internals.positionAbsolute=v,f.set(m.id,m)}c(f)},[])}const Vg=w.createContext(null),jR=Vg.Provider;Vg.Consumer;const w_=()=>w.useContext(Vg),ER=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),TR=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:o}=r,{fromHandle:a,toHandle:c,isValid:u}=o,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,connectingTo:d,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Xo.Strict?(a==null?void 0:a.type)!==n:e!==(a==null?void 0:a.nodeId)||t!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!s,valid:d&&u}};function AR({type:e="source",position:t=fe.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:o,onConnect:a,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var C,j;const x=o||null,b=e==="target",S=Je(),m=w_(),{connectOnClick:y,noPanClassName:g,rfId:v}=Ne(ER,We),{connectingFrom:N,connectingTo:k,clickConnecting:T,isPossibleEndHandle:z,connectionInProcess:A,clickConnectionInProcess:L,valid:R}=Ne(TR(m,x,e),We);m||(j=(C=S.getState()).onError)==null||j.call(C,"010",Tr.error010());const H=D=>{const{defaultEdgeOptions:O,onConnect:$,hasDefaultEdges:U}=S.getState(),X={...O,...D};if(U){const{edges:Z,setEdges:B}=S.getState();B($4(X,Z))}$==null||$(X),a==null||a(X)},Y=D=>{if(!m)return;const O=YS(D.nativeEvent);if(s&&(O&&D.button===0||!O)){const $=S.getState();Jp.onPointerDown(D.nativeEvent,{handleDomNode:D.currentTarget,autoPanOnConnect:$.autoPanOnConnect,connectionMode:$.connectionMode,connectionRadius:$.connectionRadius,domNode:$.domNode,nodeLookup:$.nodeLookup,lib:$.lib,isTarget:b,handleId:x,nodeId:m,flowId:$.rfId,panBy:$.panBy,cancelConnection:$.cancelConnection,onConnectStart:$.onConnectStart,onConnectEnd:(...U)=>{var X,Z;return(Z=(X=S.getState()).onConnectEnd)==null?void 0:Z.call(X,...U)},updateConnection:$.updateConnection,onConnect:H,isValidConnection:n||((...U)=>{var X,Z;return((Z=(X=S.getState()).isValidConnection)==null?void 0:Z.call(X,...U))??!0}),getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:$.autoPanSpeed,dragThreshold:$.connectionDragThreshold})}O?d==null||d(D):f==null||f(D)},_=D=>{const{onClickConnectStart:O,onClickConnectEnd:$,connectionClickStartHandle:U,connectionMode:X,isValidConnection:Z,lib:B,rfId:E,nodeLookup:q,connection:V}=S.getState();if(!m||!U&&!s)return;if(!U){O==null||O(D.nativeEvent,{nodeId:m,handleId:x,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:m,type:e,id:x}});return}const J=IS(D.target),F=n||Z,{connection:G,isValid:te}=Jp.isValid(D.nativeEvent,{handle:{nodeId:m,id:x,type:e},connectionMode:X,fromNodeId:U.nodeId,fromHandleId:U.id||null,fromType:U.type,isValidConnection:F,flowId:E,doc:J,lib:B,nodeLookup:q});te&&G&&H(G);const le=structuredClone(V);delete le.inProgress,le.toPosition=le.toHandle?le.toHandle.position:null,$==null||$(D,le),S.setState({connectionClickStartHandle:null})};return l.jsx("div",{"data-handleid":x,"data-nodeid":m,"data-handlepos":t,"data-id":`${v}-${m}-${x}-${e}`,className:xt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,u,{source:!b,target:b,connectable:r,connectablestart:s,connectableend:i,clickconnecting:T,connectingfrom:N,connectingto:k,valid:R,connectionindicator:r&&(!A||z)&&(A||L?i:s)}]),onMouseDown:Y,onTouchStart:Y,onClick:y?_:void 0,ref:p,...h,children:c})}const Jo=w.memo(x_(AR));function CR({data:e,isConnectable:t,sourcePosition:n=fe.Bottom}){return l.jsxs(l.Fragment,{children:[e==null?void 0:e.label,l.jsx(Jo,{type:"source",position:n,isConnectable:t})]})}function MR({data:e,isConnectable:t,targetPosition:n=fe.Top,sourcePosition:r=fe.Bottom}){return l.jsxs(l.Fragment,{children:[l.jsx(Jo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,l.jsx(Jo,{type:"source",position:r,isConnectable:t})]})}function zR(){return null}function DR({data:e,isConnectable:t,targetPosition:n=fe.Top}){return l.jsxs(l.Fragment,{children:[l.jsx(Jo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const kd={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},yv={input:CR,default:MR,output:DR,group:zR};function RR(e){var t,n,r,s;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??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const OR=e=>{const{width:t,height:n,x:r,y:s}=rc(e.nodeLookup,{filter:i=>!!i.selected});return{width:or(t)?t:null,height:or(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function $R({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Je(),{width:s,height:i,transformString:o,userSelectionActive:a}=Ne(OR,We),c=b_(),u=w.useRef(null);w.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!a&&s!==null&&i!==null;if(v_({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const x=r.getState().nodes.filter(b=>b.selected);e(p,x)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(kd,p.key)&&(p.preventDefault(),c({direction:kd[p.key],factor:p.shiftKey?4:1}))};return l.jsx("div",{className:xt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:l.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:s,height:i}})})}const vv=typeof window<"u"?window:void 0,LR=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function S_({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,paneClickDistance:a,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:b,zoomActivationKeyCode:S,elementsSelectable:m,zoomOnScroll:y,zoomOnPinch:g,panOnScroll:v,panOnScrollSpeed:N,panOnScrollMode:k,zoomOnDoubleClick:T,panOnDrag:z,defaultViewport:A,translateExtent:L,minZoom:R,maxZoom:H,preventScrolling:Y,onSelectionContextMenu:_,noWheelClassName:C,noPanClassName:j,disableKeyboardA11y:D,onViewportChange:O,isControlledViewport:$}){const{nodesSelectionActive:U,userSelectionActive:X}=Ne(LR,We),Z=Rl(u,{target:vv}),B=Rl(b,{target:vv}),E=B||z,q=B||v,V=d&&E!==!0,J=Z||X||V;return xR({deleteKeyCode:c,multiSelectionKeyCode:x}),l.jsx(bR,{onPaneContextMenu:i,elementsSelectable:m,zoomOnScroll:y,zoomOnPinch:g,panOnScroll:q,panOnScrollSpeed:N,panOnScrollMode:k,zoomOnDoubleClick:T,panOnDrag:!Z&&E,defaultViewport:A,translateExtent:L,minZoom:R,maxZoom:H,zoomActivationKeyCode:S,preventScrolling:Y,noWheelClassName:C,noPanClassName:j,onViewportChange:O,isControlledViewport:$,paneClickDistance:a,selectionOnDrag:V,children:l.jsxs(kR,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,panOnDrag:E,isSelecting:!!J,selectionMode:f,selectionKeyPressed:Z,paneClickDistance:a,selectionOnDrag:V,children:[e,U&&l.jsx($R,{onSelectionContextMenu:_,noPanClassName:j,disableKeyboardA11y:D})]})})}S_.displayName="FlowRenderer";const HR=w.memo(S_),BR=e=>t=>e?$g(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 UR(e){return Ne(w.useCallback(BR(e),[e]),We)}const IR=e=>e.updateNodeInternals;function ZR(){const e=Ne(IR),[t]=w.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return w.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function YR({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=Je(),i=w.useRef(null),o=w.useRef(null),a=w.useRef(e.sourcePosition),c=w.useRef(e.targetPosition),u=w.useRef(t),d=n&&!!e.internals.handleBounds;return w.useEffect(()=>{i.current&&!e.hidden&&(!d||o.current!==i.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(i.current),o.current=i.current)},[d,e.hidden]),w.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),w.useEffect(()=>{if(i.current){const f=u.current!==t,h=a.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,a.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function qR({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:o,nodesDraggable:a,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:x,rfId:b,nodeTypes:S,nodeClickDistance:m,onError:y}){const{node:g,internals:v,isParent:N}=Ne(F=>{const G=F.nodeLookup.get(e),te=F.parentLookup.has(e);return{node:G,internals:G.internals,isParent:te}},We);let k=g.type||"default",T=(S==null?void 0:S[k])||yv[k];T===void 0&&(y==null||y("003",Tr.error003(k)),k="default",T=(S==null?void 0:S.default)||yv.default);const z=!!(g.draggable||a&&typeof g.draggable>"u"),A=!!(g.selectable||c&&typeof g.selectable>"u"),L=!!(g.connectable||u&&typeof g.connectable>"u"),R=!!(g.focusable||d&&typeof g.focusable>"u"),H=Je(),Y=BS(g),_=YR({node:g,nodeType:k,hasDimensions:Y,resizeObserver:f}),C=v_({nodeRef:_,disabled:g.hidden||!z,noDragClassName:h,handleSelector:g.dragHandle,nodeId:e,isSelectable:A,nodeClickDistance:m}),j=b_();if(g.hidden)return null;const D=hs(g),O=RR(g),$=A||z||t||n||r||s,U=n?F=>n(F,{...v.userNode}):void 0,X=r?F=>r(F,{...v.userNode}):void 0,Z=s?F=>s(F,{...v.userNode}):void 0,B=i?F=>i(F,{...v.userNode}):void 0,E=o?F=>o(F,{...v.userNode}):void 0,q=F=>{const{selectNodesOnDrag:G,nodeDragThreshold:te}=H.getState();A&&(!G||!z||te>0)&&tm({id:e,store:H,nodeRef:_}),t&&t(F,{...v.userNode})},V=F=>{if(!(ZS(F.nativeEvent)||x)){if(CS.includes(F.key)&&A){const G=F.key==="Escape";tm({id:e,store:H,unselect:G,nodeRef:_})}else if(z&&g.selected&&Object.prototype.hasOwnProperty.call(kd,F.key)){F.preventDefault();const{ariaLabelConfig:G}=H.getState();H.setState({ariaLiveMessage:G["node.a11yDescription.ariaLiveMessage"]({direction:F.key.replace("Arrow","").toLowerCase(),x:~~v.positionAbsolute.x,y:~~v.positionAbsolute.y})}),j({direction:kd[F.key],factor:F.shiftKey?4:1})}}},J=()=>{var oe;if(x||!((oe=_.current)!=null&&oe.matches(":focus-visible")))return;const{transform:F,width:G,height:te,autoPanOnNodeFocus:le,setCenter:ie}=H.getState();if(!le)return;$g(new Map([[e,g]]),{x:0,y:0,width:G,height:te},F,!0).length>0||ie(g.position.x+D.width/2,g.position.y+D.height/2,{zoom:F[2]})};return l.jsx("div",{className:xt(["react-flow__node",`react-flow__node-${k}`,{[p]:z},g.className,{selected:g.selected,selectable:A,parent:N,draggable:z,dragging:C}]),ref:_,style:{zIndex:v.z,transform:`translate(${v.positionAbsolute.x}px,${v.positionAbsolute.y}px)`,pointerEvents:$?"all":"none",visibility:Y?"visible":"hidden",...g.style,...O},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:U,onMouseMove:X,onMouseLeave:Z,onContextMenu:B,onClick:q,onDoubleClick:E,onKeyDown:R?V:void 0,tabIndex:R?0:void 0,onFocus:R?J:void 0,role:g.ariaRole??(R?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${d_}-${b}`,"aria-label":g.ariaLabel,...g.domAttributes,children:l.jsx(jR,{value:e,children:l.jsx(T,{id:e,data:g.data,type:k,positionAbsoluteX:v.positionAbsolute.x,positionAbsoluteY:v.positionAbsolute.y,selected:g.selected??!1,selectable:A,draggable:z,deletable:g.deletable??!0,isConnectable:L,sourcePosition:g.sourcePosition,targetPosition:g.targetPosition,dragging:C,dragHandle:g.dragHandle,zIndex:v.z,parentId:g.parentId,...D})})})}var VR=w.memo(qR);const GR=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function __(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=Ne(GR,We),o=UR(e.onlyRenderVisibleElements),a=ZR();return l.jsx("div",{className:"react-flow__nodes",style:ff,children:o.map(c=>l.jsx(VR,{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:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}__.displayName="NodeRenderer";const XR=w.memo(__);function PR(e){return Ne(w.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),o=n.nodeLookup.get(s.target);i&&o&&D4({sourceNode:i,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),We)}const FR=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return l.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},QR=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return l.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},bv={[wd.Arrow]:FR,[wd.ArrowClosed]:QR};function KR(e){const t=Je();return w.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(bv,e)?bv[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",Tr.error009(e)),null)},[e])}const WR=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:o,orient:a="auto-start-reverse"})=>{const c=KR(t);return c?l.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:l.jsx(c,{color:n,strokeWidth:o})}):null},k_=({defaultColor:e,rfId:t})=>{const n=Ne(i=>i.edges),r=Ne(i=>i.defaultEdgeOptions),s=w.useMemo(()=>I4(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?l.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:l.jsx("defs",{children:s.map(i=>l.jsx(WR,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};k_.displayName="MarkerDefinitions";var JR=w.memo(k_);function N_({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:o=[2,4],labelBgBorderRadius:a=2,children:c,className:u,...d}){const[f,h]=w.useState({x:1,y:0,width:0,height:0}),p=xt(["react-flow__edge-textwrapper",u]),x=w.useRef(null);return w.useEffect(()=>{if(x.current){const b=x.current.getBBox();h({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?l.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[s&&l.jsx("rect",{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),l.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:x,style:r,children:n}),c]}):null}N_.displayName="EdgeText";const eO=w.memo(N_);function hf({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:a,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return l.jsxs(l.Fragment,{children:[l.jsx("path",{...d,d:e,fill:"none",className:xt(["react-flow__edge-path",d.className])}),u?l.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&or(t)&&or(n)?l.jsx(eO,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:a,labelBgBorderRadius:c}):null]})}function wv({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===fe.Left||e===fe.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function j_({sourceX:e,sourceY:t,sourcePosition:n=fe.Bottom,targetX:r,targetY:s,targetPosition:i=fe.Top}){const[o,a]=wv({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=wv({pos:i,x1:r,y1:s,x2:e,y2:t}),[d,f,h,p]=qS({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:o,sourceControlY:a,targetControlX:c,targetControlY:u});return[`M${e},${t} C${o},${a} ${c},${u} ${r},${s}`,d,f,h,p]}function E_(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o,targetPosition:a,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:x,markerEnd:b,markerStart:S,interactionWidth:m})=>{const[y,g,v]=j_({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:a}),N=e.isInternal?void 0:t;return l.jsx(hf,{id:N,path:y,labelX:g,labelY:v,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:x,markerEnd:b,markerStart:S,interactionWidth:m})})}const tO=E_({isInternal:!1}),T_=E_({isInternal:!0});tO.displayName="SimpleBezierEdge";T_.displayName="SimpleBezierEdgeInternal";function A_(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=fe.Bottom,targetPosition:x=fe.Top,markerEnd:b,markerStart:S,pathOptions:m,interactionWidth:y})=>{const[g,v,N]=Qp({sourceX:n,sourceY:r,sourcePosition:p,targetX:s,targetY:i,targetPosition:x,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset,stepPosition:m==null?void 0:m.stepPosition}),k=e.isInternal?void 0:t;return l.jsx(hf,{id:k,path:g,labelX:v,labelY:N,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:S,interactionWidth:y})})}const C_=A_({isInternal:!1}),M_=A_({isInternal:!0});C_.displayName="SmoothStepEdge";M_.displayName="SmoothStepEdgeInternal";function z_(e){return w.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return l.jsx(C_,{...n,id:r,pathOptions:w.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const nO=z_({isInternal:!1}),D_=z_({isInternal:!0});nO.displayName="StepEdge";D_.displayName="StepEdgeInternal";function R_(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:x,interactionWidth:b})=>{const[S,m,y]=XS({sourceX:n,sourceY:r,targetX:s,targetY:i}),g=e.isInternal?void 0:t;return l.jsx(hf,{id:g,path:S,labelX:m,labelY:y,label:o,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:x,interactionWidth:b})})}const rO=R_({isInternal:!1}),O_=R_({isInternal:!0});rO.displayName="StraightEdge";O_.displayName="StraightEdgeInternal";function $_(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o=fe.Bottom,targetPosition:a=fe.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:x,markerEnd:b,markerStart:S,pathOptions:m,interactionWidth:y})=>{const[g,v,N]=VS({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:a,curvature:m==null?void 0:m.curvature}),k=e.isInternal?void 0:t;return l.jsx(hf,{id:k,path:g,labelX:v,labelY:N,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:x,markerEnd:b,markerStart:S,interactionWidth:y})})}const sO=$_({isInternal:!1}),L_=$_({isInternal:!0});sO.displayName="BezierEdge";L_.displayName="BezierEdgeInternal";const Sv={default:L_,straight:O_,step:D_,smoothstep:M_,simplebezier:T_},_v={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},iO=(e,t,n)=>n===fe.Left?e-t:n===fe.Right?e+t:e,oO=(e,t,n)=>n===fe.Top?e-t:n===fe.Bottom?e+t:e,kv="react-flow__edgeupdater";function Nv({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:o,type:a}){return l.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:o,className:xt([kv,`${kv}-${a}`]),cx:iO(t,r,e),cy:oO(n,r,e),r,stroke:"transparent",fill:"transparent"})}function aO({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:o,sourcePosition:a,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const x=Je(),b=(v,N)=>{if(v.button!==0)return;const{autoPanOnConnect:k,domNode:T,connectionMode:z,connectionRadius:A,lib:L,onConnectStart:R,cancelConnection:H,nodeLookup:Y,rfId:_,panBy:C,updateConnection:j}=x.getState(),D=N.type==="target",O=(X,Z)=>{h(!1),f==null||f(X,n,N.type,Z)},$=X=>u==null?void 0:u(n,X),U=(X,Z)=>{h(!0),d==null||d(v,n,N.type),R==null||R(X,Z)};Jp.onPointerDown(v.nativeEvent,{autoPanOnConnect:k,connectionMode:z,connectionRadius:A,domNode:T,handleId:N.id,nodeId:N.nodeId,nodeLookup:Y,isTarget:D,edgeUpdaterType:N.type,lib:L,flowId:_,cancelConnection:H,panBy:C,isValidConnection:(...X)=>{var Z,B;return((B=(Z=x.getState()).isValidConnection)==null?void 0:B.call(Z,...X))??!0},onConnect:$,onConnectStart:U,onConnectEnd:(...X)=>{var Z,B;return(B=(Z=x.getState()).onConnectEnd)==null?void 0:B.call(Z,...X)},onReconnectEnd:O,updateConnection:j,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,dragThreshold:x.getState().connectionDragThreshold,handleDomNode:v.currentTarget})},S=v=>b(v,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),m=v=>b(v,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),y=()=>p(!0),g=()=>p(!1);return l.jsxs(l.Fragment,{children:[(e===!0||e==="source")&&l.jsx(Nv,{position:a,centerX:r,centerY:s,radius:t,onMouseDown:S,onMouseEnter:y,onMouseOut:g,type:"source"}),(e===!0||e==="target")&&l.jsx(Nv,{position:c,centerX:i,centerY:o,radius:t,onMouseDown:m,onMouseEnter:y,onMouseOut:g,type:"target"})]})}function lO({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:o,onMouseEnter:a,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:x,edgeTypes:b,noPanClassName:S,onError:m,disableKeyboardA11y:y}){let g=Ne(ie=>ie.edgeLookup.get(e));const v=Ne(ie=>ie.defaultEdgeOptions);g=v?{...v,...g}:g;let N=g.type||"default",k=(b==null?void 0:b[N])||Sv[N];k===void 0&&(m==null||m("011",Tr.error011(N)),N="default",k=(b==null?void 0:b.default)||Sv.default);const T=!!(g.focusable||t&&typeof g.focusable>"u"),z=typeof f<"u"&&(g.reconnectable||n&&typeof g.reconnectable>"u"),A=!!(g.selectable||r&&typeof g.selectable>"u"),L=w.useRef(null),[R,H]=w.useState(!1),[Y,_]=w.useState(!1),C=Je(),{zIndex:j,sourceX:D,sourceY:O,targetX:$,targetY:U,sourcePosition:X,targetPosition:Z}=Ne(w.useCallback(ie=>{const ce=ie.nodeLookup.get(g.source),oe=ie.nodeLookup.get(g.target);if(!ce||!oe)return{zIndex:g.zIndex,..._v};const he=U4({id:e,sourceNode:ce,targetNode:oe,sourceHandle:g.sourceHandle||null,targetHandle:g.targetHandle||null,connectionMode:ie.connectionMode,onError:m});return{zIndex:z4({selected:g.selected,zIndex:g.zIndex,sourceNode:ce,targetNode:oe,elevateOnSelect:ie.elevateEdgesOnSelect,zIndexMode:ie.zIndexMode}),...he||_v}},[g.source,g.target,g.sourceHandle,g.targetHandle,g.selected,g.zIndex]),We),B=w.useMemo(()=>g.markerStart?`url('#${Kp(g.markerStart,x)}')`:void 0,[g.markerStart,x]),E=w.useMemo(()=>g.markerEnd?`url('#${Kp(g.markerEnd,x)}')`:void 0,[g.markerEnd,x]);if(g.hidden||D===null||O===null||$===null||U===null)return null;const q=ie=>{var re;const{addSelectedEdges:ce,unselectNodesAndEdges:oe,multiSelectionActive:he}=C.getState();A&&(C.setState({nodesSelectionActive:!1}),g.selected&&he?(oe({nodes:[],edges:[g]}),(re=L.current)==null||re.blur()):ce([e])),s&&s(ie,g)},V=i?ie=>{i(ie,{...g})}:void 0,J=o?ie=>{o(ie,{...g})}:void 0,F=a?ie=>{a(ie,{...g})}:void 0,G=c?ie=>{c(ie,{...g})}:void 0,te=u?ie=>{u(ie,{...g})}:void 0,le=ie=>{var ce;if(!y&&CS.includes(ie.key)&&A){const{unselectNodesAndEdges:oe,addSelectedEdges:he}=C.getState();ie.key==="Escape"?((ce=L.current)==null||ce.blur(),oe({edges:[g]})):he([e])}};return l.jsx("svg",{style:{zIndex:j},children:l.jsxs("g",{className:xt(["react-flow__edge",`react-flow__edge-${N}`,g.className,S,{selected:g.selected,animated:g.animated,inactive:!A&&!s,updating:R,selectable:A}]),onClick:q,onDoubleClick:V,onContextMenu:J,onMouseEnter:F,onMouseMove:G,onMouseLeave:te,onKeyDown:T?le:void 0,tabIndex:T?0:void 0,role:g.ariaRole??(T?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":g.ariaLabel===null?void 0:g.ariaLabel||`Edge from ${g.source} to ${g.target}`,"aria-describedby":T?`${f_}-${x}`:void 0,ref:L,...g.domAttributes,children:[!Y&&l.jsx(k,{id:e,source:g.source,target:g.target,type:g.type,selected:g.selected,animated:g.animated,selectable:A,deletable:g.deletable??!0,label:g.label,labelStyle:g.labelStyle,labelShowBg:g.labelShowBg,labelBgStyle:g.labelBgStyle,labelBgPadding:g.labelBgPadding,labelBgBorderRadius:g.labelBgBorderRadius,sourceX:D,sourceY:O,targetX:$,targetY:U,sourcePosition:X,targetPosition:Z,data:g.data,style:g.style,sourceHandleId:g.sourceHandle,targetHandleId:g.targetHandle,markerStart:B,markerEnd:E,pathOptions:"pathOptions"in g?g.pathOptions:void 0,interactionWidth:g.interactionWidth}),z&&l.jsx(aO,{edge:g,isReconnectable:z,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:D,sourceY:O,targetX:$,targetY:U,sourcePosition:X,targetPosition:Z,setUpdateHover:H,setReconnecting:_})]})})}var cO=w.memo(lO);const uO=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function H_({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:o,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:x,disableKeyboardA11y:b}){const{edgesFocusable:S,edgesReconnectable:m,elementsSelectable:y,onError:g}=Ne(uO,We),v=PR(t);return l.jsxs("div",{className:"react-flow__edges",children:[l.jsx(JR,{defaultColor:e,rfId:n}),v.map(N=>l.jsx(cO,{id:N,edgesFocusable:S,edgesReconnectable:m,elementsSelectable:y,noPanClassName:s,onReconnect:i,onContextMenu:o,onMouseEnter:a,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:x,rfId:n,onError:g,edgeTypes:r,disableKeyboardA11y:b},N))]})}H_.displayName="EdgeRenderer";const dO=w.memo(H_),fO=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function hO({children:e}){const t=Ne(fO);return l.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function pO(e){const t=qg(),n=w.useRef(!1);w.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const mO=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function gO(e){const t=Ne(mO),n=Je();return w.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function xO(e){return e.connection.inProgress?{...e.connection,to:ic(e.connection.to,e.transform)}:{...e.connection}}function yO(e){return xO}function vO(e){const t=yO();return Ne(t,We)}const bO=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function wO({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:o,isValid:a,inProgress:c}=Ne(bO,We);return!(i&&s&&c)?null:l.jsx("svg",{style:e,width:i,height:o,className:"react-flow__connectionline react-flow__container",children:l.jsx("g",{className:xt(["react-flow__connection",DS(a)]),children:l.jsx(B_,{style:t,type:n,CustomComponent:r,isValid:a})})})}const B_=({style:e,type:t=Ms.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:o,fromHandle:a,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=vO();if(!s)return;if(n)return l.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:a,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:DS(r),toNode:d,toHandle:f,pointer:p});let x="";const b={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Ms.Bezier:[x]=VS(b);break;case Ms.SimpleBezier:[x]=j_(b);break;case Ms.Step:[x]=Qp({...b,borderRadius:0});break;case Ms.SmoothStep:[x]=Qp(b);break;default:[x]=XS(b)}return l.jsx("path",{d:x,fill:"none",className:"react-flow__connection-path",style:e})};B_.displayName="ConnectionLine";const SO={};function jv(e=SO){w.useRef(e),Je(),w.useEffect(()=>{},[e])}function _O(){Je(),w.useRef(!1),w.useEffect(()=>{},[])}function U_({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:o,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:x,connectionLineStyle:b,connectionLineComponent:S,connectionLineContainerStyle:m,selectionKeyCode:y,selectionOnDrag:g,selectionMode:v,multiSelectionKeyCode:N,panActivationKeyCode:k,zoomActivationKeyCode:T,deleteKeyCode:z,onlyRenderVisibleElements:A,elementsSelectable:L,defaultViewport:R,translateExtent:H,minZoom:Y,maxZoom:_,preventScrolling:C,defaultMarkerColor:j,zoomOnScroll:D,zoomOnPinch:O,panOnScroll:$,panOnScrollSpeed:U,panOnScrollMode:X,zoomOnDoubleClick:Z,panOnDrag:B,onPaneClick:E,onPaneMouseEnter:q,onPaneMouseMove:V,onPaneMouseLeave:J,onPaneScroll:F,onPaneContextMenu:G,paneClickDistance:te,nodeClickDistance:le,onEdgeContextMenu:ie,onEdgeMouseEnter:ce,onEdgeMouseMove:oe,onEdgeMouseLeave:he,reconnectRadius:re,onReconnect:W,onReconnectStart:ge,onReconnectEnd:Ue,noDragClassName:it,noWheelClassName:yt,noPanClassName:hn,disableKeyboardA11y:Dn,nodeExtent:Rr,rfId:Or,viewport:Mt,onViewportChange:ut}){return jv(e),jv(t),_O(),pO(n),gO(Mt),l.jsx(HR,{onPaneClick:E,onPaneMouseEnter:q,onPaneMouseMove:V,onPaneMouseLeave:J,onPaneContextMenu:G,onPaneScroll:F,paneClickDistance:te,deleteKeyCode:z,selectionKeyCode:y,selectionOnDrag:g,selectionMode:v,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:N,panActivationKeyCode:k,zoomActivationKeyCode:T,elementsSelectable:L,zoomOnScroll:D,zoomOnPinch:O,zoomOnDoubleClick:Z,panOnScroll:$,panOnScrollSpeed:U,panOnScrollMode:X,panOnDrag:B,defaultViewport:R,translateExtent:H,minZoom:Y,maxZoom:_,onSelectionContextMenu:f,preventScrolling:C,noDragClassName:it,noWheelClassName:yt,noPanClassName:hn,disableKeyboardA11y:Dn,onViewportChange:ut,isControlledViewport:!!Mt,children:l.jsxs(hO,{children:[l.jsx(dO,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:o,onReconnect:W,onReconnectStart:ge,onReconnectEnd:Ue,onlyRenderVisibleElements:A,onEdgeContextMenu:ie,onEdgeMouseEnter:ce,onEdgeMouseMove:oe,onEdgeMouseLeave:he,reconnectRadius:re,defaultMarkerColor:j,noPanClassName:hn,disableKeyboardA11y:Dn,rfId:Or}),l.jsx(wO,{style:b,type:x,component:S,containerStyle:m}),l.jsx("div",{className:"react-flow__edgelabel-renderer"}),l.jsx(XR,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:le,onlyRenderVisibleElements:A,noPanClassName:hn,noDragClassName:it,disableKeyboardA11y:Dn,nodeExtent:Rr,rfId:Or}),l.jsx("div",{className:"react-flow__viewport-portal"})]})})}U_.displayName="GraphView";const kO=w.memo(U_),Ev=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:a,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,x=new Map,b=new Map,S=new Map,m=r??t??[],y=n??e??[],g=d??[0,0],v=f??Cl;QS(b,S,m);const{nodesInitialized:N}=Wp(y,p,x,{nodeOrigin:g,nodeExtent:v,zIndexMode:h});let k=[0,0,1];if(o&&s&&i){const T=rc(p,{filter:R=>!!((R.width||R.initialWidth)&&(R.height||R.initialHeight))}),{x:z,y:A,zoom:L}=Lg(T,s,i,c,u,(a==null?void 0:a.padding)??.1);k=[z,A,L]}return{rfId:"1",width:s??0,height:i??0,transform:k,nodes:y,nodesInitialized:N,nodeLookup:p,parentLookup:x,edges:m,edgeLookup:S,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Cl,nodeExtent:v,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Xo.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:g,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:o??!1,fitViewOptions:a,fitViewResolver:null,connection:{...zS},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:j4,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:MS,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},NO=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:a,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>qD((p,x)=>{async function b(){const{nodeLookup:S,panZoom:m,fitViewOptions:y,fitViewResolver:g,width:v,height:N,minZoom:k,maxZoom:T}=x();m&&(await k4({nodes:S,width:v,height:N,panZoom:m,minZoom:k,maxZoom:T},y),g==null||g.resolve(!0),p({fitViewResolver:null}))}return{...Ev({nodes:e,edges:t,width:s,height:i,fitView:o,fitViewOptions:a,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:S=>{const{nodeLookup:m,parentLookup:y,nodeOrigin:g,elevateNodesOnSelect:v,fitViewQueued:N,zIndexMode:k,nodesSelectionActive:T}=x(),{nodesInitialized:z,hasSelectedNodes:A}=Wp(S,m,y,{nodeOrigin:g,nodeExtent:f,elevateNodesOnSelect:v,checkEquality:!0,zIndexMode:k}),L=T&&A;N&&z?(b(),p({nodes:S,nodesInitialized:z,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:L})):p({nodes:S,nodesInitialized:z,nodesSelectionActive:L})},setEdges:S=>{const{connectionLookup:m,edgeLookup:y}=x();QS(m,y,S),p({edges:S})},setDefaultNodesAndEdges:(S,m)=>{if(S){const{setNodes:y}=x();y(S),p({hasDefaultNodes:!0})}if(m){const{setEdges:y}=x();y(m),p({hasDefaultEdges:!0})}},updateNodeInternals:S=>{const{triggerNodeChanges:m,nodeLookup:y,parentLookup:g,domNode:v,nodeOrigin:N,nodeExtent:k,debug:T,fitViewQueued:z,zIndexMode:A}=x(),{changes:L,updatedInternals:R}=P4(S,y,g,v,N,k,A);R&&(q4(y,g,{nodeOrigin:N,nodeExtent:k,zIndexMode:A}),z?(b(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(L==null?void 0:L.length)>0&&(T&&console.log("React Flow: trigger node changes",L),m==null||m(L)))},updateNodePositions:(S,m=!1)=>{const y=[];let g=[];const{nodeLookup:v,triggerNodeChanges:N,connection:k,updateConnection:T,onNodesChangeMiddlewareMap:z}=x();for(const[A,L]of S){const R=v.get(A),H=!!(R!=null&&R.expandParent&&(R!=null&&R.parentId)&&(L!=null&&L.position)),Y={id:A,type:"position",position:H?{x:Math.max(0,L.position.x),y:Math.max(0,L.position.y)}:L.position,dragging:m};if(R&&k.inProgress&&k.fromNode.id===R.id){const _=Oi(R,k.fromHandle,fe.Left,!0);T({...k,from:_})}H&&R.parentId&&y.push({id:A,parentId:R.parentId,rect:{...L.internals.positionAbsolute,width:L.measured.width??0,height:L.measured.height??0}}),g.push(Y)}if(y.length>0){const{parentLookup:A,nodeOrigin:L}=x(),R=Yg(y,v,A,L);g.push(...R)}for(const A of z.values())g=A(g);N(g)},triggerNodeChanges:S=>{const{onNodesChange:m,setNodes:y,nodes:g,hasDefaultNodes:v,debug:N}=x();if(S!=null&&S.length){if(v){const k=m_(S,g);y(k)}N&&console.log("React Flow: trigger node changes",S),m==null||m(S)}},triggerEdgeChanges:S=>{const{onEdgesChange:m,setEdges:y,edges:g,hasDefaultEdges:v,debug:N}=x();if(S!=null&&S.length){if(v){const k=g_(S,g);y(k)}N&&console.log("React Flow: trigger edge changes",S),m==null||m(S)}},addSelectedNodes:S=>{const{multiSelectionActive:m,edgeLookup:y,nodeLookup:g,triggerNodeChanges:v,triggerEdgeChanges:N}=x();if(m){const k=S.map(T=>mi(T,!0));v(k);return}v(yo(g,new Set([...S]),!0)),N(yo(y))},addSelectedEdges:S=>{const{multiSelectionActive:m,edgeLookup:y,nodeLookup:g,triggerNodeChanges:v,triggerEdgeChanges:N}=x();if(m){const k=S.map(T=>mi(T,!0));N(k);return}N(yo(y,new Set([...S]))),v(yo(g,new Set,!0))},unselectNodesAndEdges:({nodes:S,edges:m}={})=>{const{edges:y,nodes:g,nodeLookup:v,triggerNodeChanges:N,triggerEdgeChanges:k}=x(),T=S||g,z=m||y,A=[];for(const R of T){if(!R.selected)continue;const H=v.get(R.id);H&&(H.selected=!1),A.push(mi(R.id,!1))}const L=[];for(const R of z)R.selected&&L.push(mi(R.id,!1));N(A),k(L)},setMinZoom:S=>{const{panZoom:m,maxZoom:y}=x();m==null||m.setScaleExtent([S,y]),p({minZoom:S})},setMaxZoom:S=>{const{panZoom:m,minZoom:y}=x();m==null||m.setScaleExtent([y,S]),p({maxZoom:S})},setTranslateExtent:S=>{var m;(m=x().panZoom)==null||m.setTranslateExtent(S),p({translateExtent:S})},resetSelectedElements:()=>{const{edges:S,nodes:m,triggerNodeChanges:y,triggerEdgeChanges:g,elementsSelectable:v}=x();if(!v)return;const N=m.reduce((T,z)=>z.selected?[...T,mi(z.id,!1)]:T,[]),k=S.reduce((T,z)=>z.selected?[...T,mi(z.id,!1)]:T,[]);y(N),g(k)},setNodeExtent:S=>{const{nodes:m,nodeLookup:y,parentLookup:g,nodeOrigin:v,elevateNodesOnSelect:N,nodeExtent:k,zIndexMode:T}=x();S[0][0]===k[0][0]&&S[0][1]===k[0][1]&&S[1][0]===k[1][0]&&S[1][1]===k[1][1]||(Wp(m,y,g,{nodeOrigin:v,nodeExtent:S,elevateNodesOnSelect:N,checkEquality:!1,zIndexMode:T}),p({nodeExtent:S}))},panBy:S=>{const{transform:m,width:y,height:g,panZoom:v,translateExtent:N}=x();return F4({delta:S,panZoom:v,transform:m,translateExtent:N,width:y,height:g})},setCenter:async(S,m,y)=>{const{width:g,height:v,maxZoom:N,panZoom:k}=x();if(!k)return Promise.resolve(!1);const T=typeof(y==null?void 0:y.zoom)<"u"?y.zoom:N;return await k.setViewport({x:g/2-S*T,y:v/2-m*T,zoom:T},{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:{...zS}})},updateConnection:S=>{p({connection:S})},reset:()=>p({...Ev()})}},Object.is);function jO({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:o,initialMaxZoom:a,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[x]=w.useState(()=>NO({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:o,maxZoom:a,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return l.jsx(VD,{value:x,children:l.jsx(hR,{children:p})})}function EO({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:o,fitView:a,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return w.useContext(uf)?l.jsx(l.Fragment,{children:e}):l.jsx(jO,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:o,fitView:a,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const TO={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function AO({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:o,onNodeClick:a,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:x,onConnectEnd:b,onClickConnectStart:S,onClickConnectEnd:m,onNodeMouseEnter:y,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:N,onNodeDoubleClick:k,onNodeDragStart:T,onNodeDrag:z,onNodeDragStop:A,onNodesDelete:L,onEdgesDelete:R,onDelete:H,onSelectionChange:Y,onSelectionDragStart:_,onSelectionDrag:C,onSelectionDragStop:j,onSelectionContextMenu:D,onSelectionStart:O,onSelectionEnd:$,onBeforeDelete:U,connectionMode:X,connectionLineType:Z=Ms.Bezier,connectionLineStyle:B,connectionLineComponent:E,connectionLineContainerStyle:q,deleteKeyCode:V="Backspace",selectionKeyCode:J="Shift",selectionOnDrag:F=!1,selectionMode:G=Ml.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:le=Dl()?"Meta":"Control",zoomActivationKeyCode:ie=Dl()?"Meta":"Control",snapToGrid:ce,snapGrid:oe,onlyRenderVisibleElements:he=!1,selectNodesOnDrag:re,nodesDraggable:W,autoPanOnNodeFocus:ge,nodesConnectable:Ue,nodesFocusable:it,nodeOrigin:yt=h_,edgesFocusable:hn,edgesReconnectable:Dn,elementsSelectable:Rr=!0,defaultViewport:Or=sR,minZoom:Mt=.5,maxZoom:ut=2,translateExtent:zt=Cl,preventScrolling:Xn=!0,nodeExtent:Pn,defaultMarkerColor:qt="#b1b1b7",zoomOnScroll:ms=!0,zoomOnPinch:pr=!0,panOnScroll:gs=!1,panOnScrollSpeed:mr=.5,panOnScrollMode:ti=Ni.Free,zoomOnDoubleClick:Yi=!0,panOnDrag:ni=!0,onPaneClick:ri,onPaneMouseEnter:si,onPaneMouseMove:gr,onPaneMouseLeave:qe,onPaneScroll:_t,onPaneContextMenu:kt,paneClickDistance:pn=1,nodeClickDistance:Dt=0,children:Nt,onReconnect:Rt,onReconnectStart:mn,onReconnectEnd:Me,onEdgeContextMenu:Ot,onEdgeDoubleClick:It,onEdgeMouseEnter:Vt,onEdgeMouseMove:$r,onEdgeMouseLeave:xr,reconnectRadius:Wt=10,onNodesChange:yr,onEdgesChange:Lr,noDragClassName:yf="nodrag",noWheelClassName:ii="nowheel",noPanClassName:cc="nopan",fitView:uc,fitViewOptions:Qe,connectOnClick:xs,attributionPosition:vf,proOptions:dc,defaultEdgeOptions:xa,elevateNodesOnSelect:fc=!0,elevateEdgesOnSelect:hc=!1,disableKeyboardA11y:pc=!1,autoPanOnConnect:bf,autoPanOnNodeDrag:wf,autoPanSpeed:Sf,connectionRadius:vr,isValidConnection:mc,onError:qi,style:Hr,id:gc,nodeDragThreshold:Vi,connectionDragThreshold:xc,viewport:_f,onViewportChange:yc,width:vc,height:Gi,colorMode:ya="light",debug:Xi,onScroll:Fn,ariaLabelConfig:oi,zIndexMode:gn="basic",...kf},Pi){const va=gc||"1",bc=lR(ya),wc=w.useCallback(ba=>{ba.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Fn==null||Fn(ba)},[Fn]);return l.jsx("div",{"data-testid":"rf__wrapper",...kf,onScroll:wc,style:{...Hr,...TO},ref:Pi,className:xt(["react-flow",s,bc]),id:gc,role:"application",children:l.jsxs(EO,{nodes:e,edges:t,width:vc,height:Gi,fitView:uc,fitViewOptions:Qe,minZoom:Mt,maxZoom:ut,nodeOrigin:yt,nodeExtent:Pn,zIndexMode:gn,children:[l.jsx(aR,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:x,onConnectEnd:b,onClickConnectStart:S,onClickConnectEnd:m,nodesDraggable:W,autoPanOnNodeFocus:ge,nodesConnectable:Ue,nodesFocusable:it,edgesFocusable:hn,edgesReconnectable:Dn,elementsSelectable:Rr,elevateNodesOnSelect:fc,elevateEdgesOnSelect:hc,minZoom:Mt,maxZoom:ut,nodeExtent:Pn,onNodesChange:yr,onEdgesChange:Lr,snapToGrid:ce,snapGrid:oe,connectionMode:X,translateExtent:zt,connectOnClick:xs,defaultEdgeOptions:xa,fitView:uc,fitViewOptions:Qe,onNodesDelete:L,onEdgesDelete:R,onDelete:H,onNodeDragStart:T,onNodeDrag:z,onNodeDragStop:A,onSelectionDrag:C,onSelectionDragStart:_,onSelectionDragStop:j,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:cc,nodeOrigin:yt,rfId:va,autoPanOnConnect:bf,autoPanOnNodeDrag:wf,autoPanSpeed:Sf,onError:qi,connectionRadius:vr,isValidConnection:mc,selectNodesOnDrag:re,nodeDragThreshold:Vi,connectionDragThreshold:xc,onBeforeDelete:U,debug:Xi,ariaLabelConfig:oi,zIndexMode:gn}),l.jsx(kO,{onInit:u,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:y,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:N,onNodeDoubleClick:k,nodeTypes:i,edgeTypes:o,connectionLineType:Z,connectionLineStyle:B,connectionLineComponent:E,connectionLineContainerStyle:q,selectionKeyCode:J,selectionOnDrag:F,selectionMode:G,deleteKeyCode:V,multiSelectionKeyCode:le,panActivationKeyCode:te,zoomActivationKeyCode:ie,onlyRenderVisibleElements:he,defaultViewport:Or,translateExtent:zt,minZoom:Mt,maxZoom:ut,preventScrolling:Xn,zoomOnScroll:ms,zoomOnPinch:pr,zoomOnDoubleClick:Yi,panOnScroll:gs,panOnScrollSpeed:mr,panOnScrollMode:ti,panOnDrag:ni,onPaneClick:ri,onPaneMouseEnter:si,onPaneMouseMove:gr,onPaneMouseLeave:qe,onPaneScroll:_t,onPaneContextMenu:kt,paneClickDistance:pn,nodeClickDistance:Dt,onSelectionContextMenu:D,onSelectionStart:O,onSelectionEnd:$,onReconnect:Rt,onReconnectStart:mn,onReconnectEnd:Me,onEdgeContextMenu:Ot,onEdgeDoubleClick:It,onEdgeMouseEnter:Vt,onEdgeMouseMove:$r,onEdgeMouseLeave:xr,reconnectRadius:Wt,defaultMarkerColor:qt,noDragClassName:yf,noWheelClassName:ii,noPanClassName:cc,rfId:va,disableKeyboardA11y:pc,nodeExtent:Pn,viewport:_f,onViewportChange:yc}),l.jsx(rR,{onSelectionChange:Y}),Nt,l.jsx(WD,{proOptions:dc,position:vf}),l.jsx(KD,{rfId:va,disableKeyboardA11y:pc})]})})}var CO=x_(AO);function MO(e){const[t,n]=w.useState(e),r=w.useCallback(s=>n(i=>m_(s,i)),[]);return[t,n,r]}function zO(e){const[t,n]=w.useState(e),r=w.useCallback(s=>n(i=>g_(s,i)),[]);return[t,n,r]}function DO({dimensions:e,lineWidth:t,variant:n,className:r}){return l.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:xt(["react-flow__background-pattern",n,r])})}function RO({radius:e,className:t}){return l.jsx("circle",{cx:e,cy:e,r:e,className:xt(["react-flow__background-pattern","dots",t])})}var rs;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(rs||(rs={}));const OO={[rs.Dots]:1,[rs.Lines]:1,[rs.Cross]:6},$O=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function I_({id:e,variant:t=rs.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:o,bgColor:a,style:c,className:u,patternClassName:d}){const f=w.useRef(null),{transform:h,patternId:p}=Ne($O,We),x=r||OO[t],b=t===rs.Dots,S=t===rs.Cross,m=Array.isArray(n)?n:[n,n],y=[m[0]*h[2]||1,m[1]*h[2]||1],g=x*h[2],v=Array.isArray(i)?i:[i,i],N=S?[g,g]:y,k=[v[0]*h[2]||1+N[0]/2,v[1]*h[2]||1+N[1]/2],T=`${p}${e||""}`;return l.jsxs("svg",{className:xt(["react-flow__background",u]),style:{...c,...ff,"--xy-background-color-props":a,"--xy-background-pattern-color-props":o},ref:f,"data-testid":"rf__background",children:[l.jsx("pattern",{id:T,x:h[0]%y[0],y:h[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:b?l.jsx(RO,{radius:g/2,className:d}):l.jsx(DO,{dimensions:N,lineWidth:s,variant:t,className:d})}),l.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${T})`})]})}I_.displayName="Background";const LO=w.memo(I_);function HO(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:l.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function BO(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:l.jsx("path",{d:"M0 0h32v4.2H0z"})})}function UO(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:l.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 IO(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.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 ZO(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.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 eu({children:e,className:t,...n}){return l.jsx("button",{type:"button",className:xt(["react-flow__controls-button",t]),...n,children:e})}const YO=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Z_({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:o,onFitView:a,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const x=Je(),{isInteractive:b,minZoomReached:S,maxZoomReached:m,ariaLabelConfig:y}=Ne(YO,We),{zoomIn:g,zoomOut:v,fitView:N}=qg(),k=()=>{g(),i==null||i()},T=()=>{v(),o==null||o()},z=()=>{N(s),a==null||a()},A=()=>{x.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},L=h==="horizontal"?"horizontal":"vertical";return l.jsxs(df,{className:xt(["react-flow__controls",L,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??y["controls.ariaLabel"],children:[t&&l.jsxs(l.Fragment,{children:[l.jsx(eu,{onClick:k,className:"react-flow__controls-zoomin",title:y["controls.zoomIn.ariaLabel"],"aria-label":y["controls.zoomIn.ariaLabel"],disabled:m,children:l.jsx(HO,{})}),l.jsx(eu,{onClick:T,className:"react-flow__controls-zoomout",title:y["controls.zoomOut.ariaLabel"],"aria-label":y["controls.zoomOut.ariaLabel"],disabled:S,children:l.jsx(BO,{})})]}),n&&l.jsx(eu,{className:"react-flow__controls-fitview",onClick:z,title:y["controls.fitView.ariaLabel"],"aria-label":y["controls.fitView.ariaLabel"],children:l.jsx(UO,{})}),r&&l.jsx(eu,{className:"react-flow__controls-interactive",onClick:A,title:y["controls.interactive.ariaLabel"],"aria-label":y["controls.interactive.ariaLabel"],children:b?l.jsx(ZO,{}):l.jsx(IO,{})}),d]})}Z_.displayName="Controls";const qO=w.memo(Z_);function VO({id:e,x:t,y:n,width:r,height:s,style:i,color:o,strokeColor:a,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:x,backgroundColor:b}=i||{},S=o||x||b;return l.jsx("rect",{className:xt(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:s,style:{fill:S,stroke:a,strokeWidth:c},shapeRendering:f,onClick:p?m=>p(m,e):void 0})}const GO=w.memo(VO),XO=e=>e.nodes.map(t=>t.id),Mh=e=>e instanceof Function?e:()=>e;function PO({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=GO,onClick:o}){const a=Ne(XO,We),c=Mh(t),u=Mh(e),d=Mh(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return l.jsx(l.Fragment,{children:a.map(h=>l.jsx(QO,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:o,shapeRendering:f},h))})}function FO({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:o,NodeComponent:a,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=Ne(x=>{const b=x.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const S=b.internals.userNode,{x:m,y}=b.internals.positionAbsolute,{width:g,height:v}=hs(S);return{node:S,x:m,y,width:g,height:v}},We);return!u||u.hidden||!BS(u)?null:l.jsx(a,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:o,onClick:c,id:u.id})}const QO=w.memo(FO);var KO=w.memo(PO);const WO=200,JO=150,e6=e=>!e.hidden,t6=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?HS(rc(e.nodeLookup,{filter:e6}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},n6="react-flow__minimap-desc";function Y_({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:o,nodeComponent:a,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:x,pannable:b=!1,zoomable:S=!1,ariaLabel:m,inversePan:y,zoomStep:g=1,offsetScale:v=5}){const N=Je(),k=w.useRef(null),{boundingRect:T,viewBB:z,rfId:A,panZoom:L,translateExtent:R,flowWidth:H,flowHeight:Y,ariaLabelConfig:_}=Ne(t6,We),C=(e==null?void 0:e.width)??WO,j=(e==null?void 0:e.height)??JO,D=T.width/C,O=T.height/j,$=Math.max(D,O),U=$*C,X=$*j,Z=v*$,B=T.x-(U-T.width)/2-Z,E=T.y-(X-T.height)/2-Z,q=U+Z*2,V=X+Z*2,J=`${n6}-${A}`,F=w.useRef(0),G=w.useRef();F.current=$,w.useEffect(()=>{if(k.current&&L)return G.current=sD({domNode:k.current,panZoom:L,getTransform:()=>N.getState().transform,getViewScale:()=>F.current}),()=>{var ce;(ce=G.current)==null||ce.destroy()}},[L]),w.useEffect(()=>{var ce;(ce=G.current)==null||ce.update({translateExtent:R,width:H,height:Y,inversePan:y,pannable:b,zoomStep:g,zoomable:S})},[b,S,y,g,R,H,Y]);const te=p?ce=>{var re;const[oe,he]=((re=G.current)==null?void 0:re.pointer(ce))||[0,0];p(ce,{x:oe,y:he})}:void 0,le=x?w.useCallback((ce,oe)=>{const he=N.getState().nodeLookup.get(oe).internals.userNode;x(ce,he)},[]):void 0,ie=m??_["minimap.ariaLabel"];return l.jsx(df,{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*$:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:xt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:l.jsxs("svg",{width:C,height:j,viewBox:`${B} ${E} ${q} ${V}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":J,ref:k,onClick:te,children:[ie&&l.jsx("title",{id:J,children:ie}),l.jsx(KO,{onClick:le,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:o,nodeComponent:a}),l.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-Z},${E-Z}h${q+Z*2}v${V+Z*2}h${-q-Z*2}z
167
+ M${z.x},${z.y}h${z.width}v${z.height}h${-z.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Y_.displayName="MiniMap";const r6=w.memo(Y_),s6=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,i6={[Ko.Line]:"right",[Ko.Handle]:"bottom-right"};function o6({nodeId:e,position:t,variant:n=Ko.Handle,className:r,style:s=void 0,children:i,color:o,minWidth:a=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:b,onResize:S,onResizeEnd:m}){const y=w_(),g=typeof e=="string"?e:y,v=Je(),N=w.useRef(null),k=n===Ko.Handle,T=Ne(w.useCallback(s6(k&&p),[k,p]),We),z=w.useRef(null),A=t??i6[n];w.useEffect(()=>{if(!(!N.current||!g))return z.current||(z.current=yD({domNode:N.current,nodeId:g,getStoreItems:()=>{const{nodeLookup:R,transform:H,snapGrid:Y,snapToGrid:_,nodeOrigin:C,domNode:j}=v.getState();return{nodeLookup:R,transform:H,snapGrid:Y,snapToGrid:_,nodeOrigin:C,paneDomNode:j}},onChange:(R,H)=>{const{triggerNodeChanges:Y,nodeLookup:_,parentLookup:C,nodeOrigin:j}=v.getState(),D=[],O={x:R.x,y:R.y},$=_.get(g);if($&&$.expandParent&&$.parentId){const U=$.origin??j,X=R.width??$.measured.width??0,Z=R.height??$.measured.height??0,B={id:$.id,parentId:$.parentId,rect:{width:X,height:Z,...US({x:R.x??$.position.x,y:R.y??$.position.y},{width:X,height:Z},$.parentId,_,U)}},E=Yg([B],_,C,j);D.push(...E),O.x=R.x?Math.max(U[0]*X,R.x):void 0,O.y=R.y?Math.max(U[1]*Z,R.y):void 0}if(O.x!==void 0&&O.y!==void 0){const U={id:g,type:"position",position:{...O}};D.push(U)}if(R.width!==void 0&&R.height!==void 0){const X={id:g,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:R.width,height:R.height}};D.push(X)}for(const U of H){const X={...U,type:"position"};D.push(X)}Y(D)},onEnd:({width:R,height:H})=>{const Y={id:g,type:"dimensions",resizing:!1,dimensions:{width:R,height:H}};v.getState().triggerNodeChanges([Y])}})),z.current.update({controlPosition:A,boundaries:{minWidth:a,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:b,onResize:S,onResizeEnd:m,shouldResize:x}),()=>{var R;(R=z.current)==null||R.destroy()}},[A,a,c,u,d,f,b,S,m,x]);const L=A.split("-");return l.jsx("div",{className:xt(["react-flow__resize-control","nodrag",...L,n,r]),ref:N,style:{...s,scale:T,...o&&{[k?"backgroundColor":"borderColor"]:o}},children:i})}w.memo(o6);const wr={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 zh(e){return wr[e.toLowerCase()]??wr.other}function a6(e,t,n=150){const r=e.length,s=new Map,i=new Map,o=Math.min(600,Math.max(150,r*40));e.forEach((c,u)=>{const d=u/r*2*Math.PI;s.set(c.slug,{x:400+o*Math.cos(d),y:400+o*Math.sin(d)}),i.set(c.slug,{vx:0,vy:0})});const a=e.map(c=>c.slug);for(let c=0;c<n;c++){for(let u=0;u<a.length;u++)for(let d=u+1;d<a.length;d++){const f=a[u],h=a[d],p=s.get(f),x=s.get(h),b=x.x-p.x,S=x.y-p.y,m=Math.max(1,b*b+S*S),y=Math.sqrt(m),g=18e3/m,v=b/y*g,N=S/y*g,k=i.get(f),T=i.get(h);k.vx-=v,k.vy-=N,T.vx+=v,T.vy+=N}for(const u of t){const d=s.get(u.source),f=s.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)),b=x*.02,S=h/x*b,m=p/x*b,y=i.get(u.source),g=i.get(u.target);y&&(y.vx+=S,y.vy+=m),g&&(g.vx-=S,g.vy-=m)}for(const u of a){const d=s.get(u),f=i.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 s}const l6=5,c6=9;function u6(e){const t=e.data,n=t.radius,r=t.degree,s=t.dimmed,i=t.hovered,o=t.glowRgb,a=t.fill,c=r>=l6,u=r>=c6,d=s?"none":i?`0 0 0 1.5px rgba(${o},0.8), 0 0 10px rgba(${o},1), 0 0 24px rgba(${o},0.7), 0 0 44px rgba(${o},0.3), 0 0 70px rgba(${o},0.12)`:`0 0 0 1px rgba(${o},0.35), 0 0 7px rgba(${o},0.65), 0 0 18px rgba(${o},0.25)`,f=i?"scale(1.28)":"scale(1)";return l.jsxs("div",{style:{position:"relative",width:n*2,height:n*2},children:[c&&!s&&l.jsx("div",{style:{position:"absolute",inset:-(n*.55),borderRadius:"50%",background:`radial-gradient(circle, rgba(${o},0.08) 0%, transparent 70%)`,pointerEvents:"none"}}),c&&!s&&l.jsx("div",{style:{position:"absolute",inset:-(n*.45),borderRadius:"50%",border:`1.5px solid rgba(${o},0.5)`,animation:"wikiNodePulse 2.6s cubic-bezier(0.4,0,0.6,1) infinite",pointerEvents:"none"}}),u&&!s&&l.jsx("div",{style:{position:"absolute",inset:-(n*.8),borderRadius:"50%",border:`1px solid rgba(${o},0.28)`,animation:"wikiNodePulse 3.8s cubic-bezier(0.4,0,0.6,1) infinite 1.1s",pointerEvents:"none"}}),l.jsxs("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:`radial-gradient(circle at 33% 28%, ${t.light} 0%, ${a} 52%, ${t.dark} 100%)`,boxShadow:d,opacity:s?.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:[l.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"}}),l.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"}})]}),!s&&l.jsx("div",{style:{position:"absolute",top:n*2+5,left:"50%",transform:"translateX(-50%)",whiteSpace:"nowrap",maxWidth:128,overflow:"hidden",textOverflow:"ellipsis",fontSize:i?10:9,fontWeight:i?600:400,color:i?a:"var(--text2)",background:"color-mix(in srgb, var(--bg) 78%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",padding:"1px 6px 2px",borderRadius:5,border:i?`1px solid rgba(${o},0.4)`:"1px solid transparent",boxShadow:i?`0 0 8px rgba(${o},0.3)`:"none",transition:"all 0.2s ease",fontFamily:"inherit",letterSpacing:i?"0.025em":"normal",pointerEvents:"none"},children:t.title}),l.jsx(Jo,{type:"target",position:fe.Left,style:{opacity:0,pointerEvents:"none"}}),l.jsx(Jo,{type:"source",position:fe.Right,style:{opacity:0,pointerEvents:"none"}})]})}const d6={wikiNode:u6},f6=[{label:"Concepts",color:wr.concepts.fill,rgb:wr.concepts.glowRgb},{label:"Entities",color:wr.entities.fill,rgb:wr.entities.glowRgb},{label:"Summaries",color:wr.summaries.fill,rgb:wr.summaries.glowRgb},{label:"Other",color:wr.other.fill,rgb:wr.other.glowRgb}];function h6({graphData:e,loading:t,onNodeClick:n}){const{initNodes:r,initEdges:s,adjacency:i}=w.useMemo(()=>{var T,z;const b=(e==null?void 0:e.nodes)??[],S=(e==null?void 0:e.edges)??[];if(b.length===0)return{initNodes:[],initEdges:[],adjacency:new Map};const m=new Map,y=new Map;for(const A of b)m.set(A.slug,0),y.set(A.slug,A.category);for(const A of S)m.set(A.source,(m.get(A.source)??0)+1),m.set(A.target,(m.get(A.target)??0)+1);const g=new Map;for(const A of b)g.set(A.slug,new Set);for(const A of S)(T=g.get(A.source))==null||T.add(A.target),(z=g.get(A.target))==null||z.add(A.source);const v=a6(b,S,150),N=b.map(A=>{const L=m.get(A.slug)??0,R=Math.min(11,Math.max(4,4+L*.8)),H=v.get(A.slug)??{x:400,y:400},Y=zh(A.category);return{id:A.slug,type:"wikiNode",position:H,data:{slug:A.slug,title:A.title||(A.slug.split("/").pop()??A.slug),category:A.category,fill:Y.fill,light:Y.light,dark:Y.dark,glowRgb:Y.glowRgb,radius:R,degree:L,dimmed:!1,hovered:!1}}}),k=S.map((A,L)=>{const R=zh(y.get(A.source)??"other");return{id:`e${L}-${A.source}-${A.target}`,source:A.source,target:A.target,type:"straight",animated:!0,style:{stroke:R.edgeColor,strokeWidth:1.3,opacity:.85}}});return{initNodes:N,initEdges:k,adjacency:g}},[e]),[o,a,c]=MO(r),[u,d,f]=zO(s);w.useEffect(()=>{a(r),d(s)},[r,s,a,d]);const h=w.useCallback((b,S)=>{n(S.id)},[n]),p=w.useCallback((b,S)=>{const m=S.id,y=new Set([m,...i.get(m)??[]]);a(g=>g.map(v=>({...v,data:{...v.data,dimmed:!y.has(v.id),hovered:v.id===m}}))),d(g=>g.map(v=>({...v,style:{...v.style??{},opacity:y.has(v.source)&&y.has(v.target)?1:.05}})))},[i,a,d]),x=w.useCallback(()=>{a(b=>b.map(S=>({...S,data:{...S.data,dimmed:!1,hovered:!1}}))),d(b=>b.map(S=>({...S,style:{...S.style??{},opacity:.85}})))},[a,d]);return t?l.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",style:{color:"var(--muted)"},children:[l.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)"}}),l.jsx("span",{className:"text-[11px]",children:"Building knowledge graph…"})]}):!e||e.nodes.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center",children:[l.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:l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"2.5"}),l.jsx("circle",{cx:"4.5",cy:"4.5",r:"1.5"}),l.jsx("circle",{cx:"19.5",cy:"4.5",r:"1.5"}),l.jsx("circle",{cx:"4.5",cy:"19.5",r:"1.5"}),l.jsx("circle",{cx:"19.5",cy:"19.5",r:"1.5"}),l.jsx("line",{x1:"12",y1:"9.5",x2:"5.5",y2:"5.5"}),l.jsx("line",{x1:"12",y1:"9.5",x2:"18.5",y2:"5.5"}),l.jsx("line",{x1:"12",y1:"14.5",x2:"5.5",y2:"18.5"}),l.jsx("line",{x1:"12",y1:"14.5",x2:"18.5",y2:"18.5"})]})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--fg)"},children:"Graph is empty"}),l.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--muted)"},children:"Ingest documents to build the knowledge graph"})]}),l.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"})]}):l.jsxs("div",{style:{width:"100%",height:"100%",position:"relative",background:"var(--bg)"},children:[l.jsxs(CO,{nodes:o,edges:u,onNodesChange:c,onEdgesChange:f,nodeTypes:d6,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:[l.jsx(LO,{variant:rs.Dots,gap:26,size:1.2,color:"var(--b1)"}),l.jsx(qO,{}),l.jsx(r6,{nodeColor:b=>zh(b.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)"}})]}),l.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}}),l.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:f6.map(({label:b,color:S,rgb:m})=>l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[l.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:S,boxShadow:`0 0 6px rgba(${m},0.7)`,flexShrink:0}}),l.jsx("span",{style:{fontSize:10,color:"var(--text2)",fontFamily:"inherit",letterSpacing:"0.02em"},children:b})]},b))}),l.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:[l.jsxs("span",{style:{fontSize:10,color:"var(--text2)",fontFamily:"inherit",letterSpacing:"0.04em"},children:[l.jsx("span",{style:{color:"var(--gold)",fontWeight:600},children:e.nodes.length})," ","nodes"]}),l.jsx("div",{style:{width:1,height:10,background:"var(--b2)"}}),l.jsxs("span",{style:{fontSize:10,color:"var(--text2)",fontFamily:"inherit",letterSpacing:"0.04em"},children:[l.jsx("span",{style:{color:"var(--gold)",fontWeight:600},children:e.edges.length})," ","connections"]})]})]})}function p6({rpc:e,className:t}){const{ws:n}=fr(),[r,s]=w.useState([]),[i,o]=w.useState(!0),[a,c]=w.useState("browse"),u=w.useRef("browse");u.current=a;const[d,f]=w.useState(null),[h,p]=w.useState(null),[x,b]=w.useState(!1),[S,m]=w.useState(""),[y,g]=w.useState([]),[v,N]=w.useState(!1),[k,T]=w.useState(null),[z,A]=w.useState(!1),[L,R]=w.useState(null),[H,Y]=w.useState(null),[_,C]=w.useState(!1),j=w.useCallback(async(B=!1)=>{if(e){B||C(!0);try{const E=await e.wikiGraph();Y(E??{nodes:[],edges:[]})}catch{Y({nodes:[],edges:[]})}finally{B||C(!1)}}},[e]),D=w.useCallback(async(B=!1)=>{if(e){B||o(!0),R(null);try{const E=await e.wikiListPages();s((E==null?void 0:E.pages)??[])}catch(E){R(E instanceof Error?E.message:"Failed to load wiki")}finally{B||o(!1)}}},[e]);w.useEffect(()=>{D()},[D]),w.useEffect(()=>{if(n)return n.on("wiki-op",()=>{D(!0),u.current==="graph"&&j(!0)})},[n,D,j]);const O=w.useCallback(async B=>{if(e){f(B),c("page"),b(!0),p(null);try{const E=await e.wikiPageGet(B);p((E==null?void 0:E.content)??(E==null?void 0:E.error)??"Empty page")}catch(E){p(E instanceof Error?E.message:"Error loading page")}finally{b(!1)}}},[e]),$=w.useCallback(async()=>{if(!(!e||!S.trim())){N(!0),g([]);try{const B=await e.wikiSearch(S);g(B??[])}finally{N(!1)}}},[e,S]),U=w.useCallback(async()=>{if(e){c("lint"),A(!0),T(null);try{const B=await e.wikiLint();T(B??{orphanPages:[],brokenLinks:[],missingFromIndex:[],staleFrontmatter:[]})}finally{A(!1)}}},[e]),X=r.reduce((B,E)=>{const q=E.category||"Other";return(B[q]??(B[q]=[])).push(E),B},{}),Z=k?k.orphanPages.length+k.brokenLinks.length+k.missingFromIndex.length+k.staleFrontmatter.length:null;return l.jsxs("div",{className:`flex flex-col h-full ${t??""}`,children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:[l.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:[l.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),l.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"})]}),l.jsx("span",{className:"text-[13px] font-semibold font-display",style:{color:"var(--cream)"},children:"Wiki"}),l.jsxs("span",{className:"text-[11px] font-mono",style:{color:"var(--muted)"},children:[r.length," pages"]}),l.jsx("div",{className:"flex-1"}),l.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:a==="browse"?"var(--s3)":"transparent",color:a==="browse"?"var(--gold)":"var(--muted)",border:a==="browse"?"1px solid var(--b2)":"1px solid transparent"},children:"Browse"}),l.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:a==="search"?"var(--s3)":"transparent",color:a==="search"?"var(--gold)":"var(--muted)",border:a==="search"?"1px solid var(--b2)":"1px solid transparent"},children:"Search"}),l.jsxs("button",{onClick:U,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:a==="lint"?"var(--s3)":"transparent",color:a==="lint"?"var(--gold)":"var(--muted)",border:a==="lint"?"1px solid var(--b2)":"1px solid transparent"},children:["Lint",Z!==null&&Z>0&&l.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:Z})]}),l.jsx("button",{onClick:()=>{c("graph"),!H&&!_&&j()},className:"px-2.5 py-1 rounded-lg text-[11px] font-semibold transition-all duration-150 cursor-pointer",style:{background:a==="graph"?"var(--s3)":"transparent",color:a==="graph"?"var(--gold)":"var(--muted)",border:a==="graph"?"1px solid var(--b2)":"1px solid transparent"},children:"Graph"}),l.jsx("button",{onClick:()=>D(),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:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("polyline",{points:"23 4 23 10 17 10"}),l.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})})]}),a==="graph"&&l.jsx("div",{className:"flex-1 min-h-0",children:l.jsx(h6,{graphData:H,loading:_,onNodeClick:O})}),l.jsxs("div",{className:`flex-1 min-h-0 overflow-y-auto px-4 py-3 scrollbar-thin${a==="graph"?" hidden":""}`,children:[a==="browse"&&l.jsxs(l.Fragment,{children:[i&&l.jsx("div",{className:"flex items-center justify-center h-32 text-xs",style:{color:"var(--muted)"},children:"Loading…"}),L&&l.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:L}),!i&&!L&&r.length===0&&l.jsxs("div",{className:"flex flex-col items-center justify-center h-48 gap-3 text-center",children:[l.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",style:{color:"var(--muted)",opacity:.4},children:[l.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),l.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"})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-[12px] font-semibold",style:{color:"var(--fg)"},children:"Wiki is empty"}),l.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--muted)"},children:"Ask the agent to ingest a document to get started"})]}),l.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"})]}),!i&&Object.entries(X).map(([B,E])=>l.jsxs("div",{className:"mb-4",children:[l.jsx("div",{className:"text-[10px] font-mono uppercase tracking-widest mb-1.5 px-1",style:{color:"var(--muted)"},children:B}),l.jsx("div",{className:"space-y-1",children:E.map(q=>l.jsxs("button",{onClick:()=>O(q.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:[l.jsx("div",{className:"text-[12px] font-medium truncate",children:q.title||q.slug.split("/").pop()}),l.jsx("div",{className:"text-[10px] font-mono mt-0.5 truncate",style:{color:"var(--muted)"},children:q.slug})]},q.slug))})]},B))]}),a==="page"&&l.jsxs("div",{children:[l.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:[l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:l.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to index"]}),x&&l.jsx("div",{className:"flex items-center justify-center h-32 text-xs",style:{color:"var(--muted)"},children:"Loading…"}),!x&&h!==null&&l.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})]}),a==="search"&&l.jsxs("div",{children:[l.jsxs("div",{className:"flex gap-2 mb-3",children:[l.jsx("input",{type:"text",value:S,onChange:B=>m(B.target.value),onKeyDown:B=>B.key==="Enter"&&$(),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}),l.jsx("button",{onClick:$,disabled:v||!S.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||!S.trim()?.5:1},children:v?"…":"Search"})]}),y.length===0&&!v&&S&&l.jsxs("div",{className:"text-center py-8 text-xs",style:{color:"var(--muted)"},children:['No results for "',S,'"']}),y.length>0&&l.jsx("div",{className:"space-y-1",children:y.map((B,E)=>l.jsxs("button",{onClick:()=>O(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)"},children:[l.jsxs("div",{className:"text-[11px] font-mono",style:{color:"var(--gold)"},children:[B.slug,":",B.lineNumber]}),l.jsx("div",{className:"text-[11px] mt-0.5 truncate font-mono",style:{color:"var(--fg)"},children:B.line.trim()})]},E))})]}),a==="lint"&&l.jsxs("div",{children:[z&&l.jsx("div",{className:"flex items-center justify-center h-32 text-xs",style:{color:"var(--muted)"},children:"Running lint…"}),!z&&k&&l.jsxs("div",{className:"space-y-4",children:[Z===0&&l.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:[l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Wiki looks clean — no issues found"]}),l.jsx(tu,{title:"Orphan pages",items:k.orphanPages,color:"var(--yellow)",note:"Written but not linked from any other page"}),l.jsx(tu,{title:"Broken links",items:k.brokenLinks.map(B=>`${B.from} → [[${B.to}]]`),color:"var(--red)",note:"[[wikilinks]] that reference missing pages"}),l.jsx(tu,{title:"Missing from index",items:k.missingFromIndex,color:"var(--yellow)",note:"Pages not listed in index.md"}),l.jsx(tu,{title:"Stale frontmatter",items:k.staleFrontmatter,color:"var(--muted)",note:"updated: field older than 30 days"})]})]})]})]})}function tu({title:e,items:t,color:n,note:r}){return t.length===0?null:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[l.jsx("span",{className:"text-[11px] font-semibold",style:{color:n},children:e}),l.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})]}),l.jsx("div",{className:"text-[10px] mb-2",style:{color:"var(--muted)"},children:r}),l.jsx("div",{className:"space-y-1",children:t.map((s,i)=>l.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:s},i))})]})}function lr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ar(e,t){let n=e;for(const r of t.split(".")){if(!lr(n))return;n=n[r]}return n}function ir(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):""}function q_(e,t,n){const[r,...s]=t.split("."),i={...e};if(s.length===0)i[r]=n;else{const o=e[r];i[r]=q_(lr(o)?o:{},s.join("."),n)}return i}function V_(e,t,n=""){const r=[];for(const[s,i]of Object.entries(t)){const o=n?`${n}.${s}`:s,a=e[s];lr(i)&&lr(a)?r.push(...V_(a,i,o)):lr(i)&&a===void 0?r.push({path:o,value:i}):JSON.stringify(i)!==JSON.stringify(a)&&r.push({path:o,value:i})}return r}function m6(e){return[...e].sort((t,n)=>{const r=s=>s.path==="current_provider"?1:0;return r(t)-r(n)})}const g6=/^([01]?\d|2[0-3]):[0-5]\d$/,x6=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function nu(e){return g6.test(e.trim())}function y6(e){const t={},n=e.auto_compact;if(lr(n)){const i=Number(n.warn_threshold),o=Number(n.threshold),a=Number(n.forced_threshold),c=[["auto_compact.warn_threshold",i],["auto_compact.threshold",o],["auto_compact.forced_threshold",a]];for(const[u,d]of c)(!Number.isFinite(d)||d<5||d>99)&&(t[u]="Use a percentage between 5 and 99.");!t["auto_compact.warn_threshold"]&&!t["auto_compact.threshold"]&&i>=o&&(t["auto_compact.warn_threshold"]="Warn must be below the suggest threshold."),!t["auto_compact.threshold"]&&!t["auto_compact.forced_threshold"]&&o>=a&&(t["auto_compact.threshold"]="Suggest must be below the force threshold.")}const r=e.heartbeat;if(lr(r)){for(const c of["daily","dreaming"]){const u=ir(r[c]).trim();u?nu(u)||(t[`heartbeat.${c}`]="Use H:MM, 24-hour (e.g. 6:00)."):t[`heartbeat.${c}`]="Required — turn the heartbeat off with Schedule instead."}const i=ir(r.intraday).trim();i&&!i.split(",").every(c=>nu(c))&&(t["heartbeat.intraday"]="Comma-separated H:MM times (e.g. 7:55,11:55).");const o=ir(r.weekly).trim();if(!o)t["heartbeat.weekly"]="Required — turn the heartbeat off with Schedule instead.";else{const[c,u]=o.split("@");(!u||!nu(u)||!x6.includes(c.toLowerCase()))&&(t["heartbeat.weekly"]="Use day@H:MM (e.g. monday@6:00).")}const a=ir(r.monthly).trim();if(!a)t["heartbeat.monthly"]="Required — turn the heartbeat off with Schedule instead.";else{const[c,u]=a.split("@"),d=Number(c);(!u||!nu(u)||!Number.isInteger(d)||d<1||d>31)&&(t["heartbeat.monthly"]="Use D@H:MM with a day of 1-31 (e.g. 1@6:00).")}}const s=e.providers;if(lr(s))for(const[i,o]of Object.entries(s)){if(!lr(o))continue;ir(o.model).trim()||(t[`providers.${i}.model`]="Required — a blank model reverts to the default on restart.");const a=Number(o.model_context_window);(!Number.isFinite(a)||a<1e3)&&(t[`providers.${i}.model_context_window`]="Must be at least 1000 tokens.")}return t}function v6(e){const t=e.trim();if(!t)return{ok:!0,value:{}};let n;try{n=JSON.parse(t)}catch(r){return{ok:!1,error:r instanceof Error?r.message:"Invalid JSON."}}if(!lr(n))return{ok:!1,error:'Expected a JSON object, e.g. { "name": { … } }.'};for(const[r,s]of Object.entries(n))if(!lr(s))return{ok:!1,error:`"${r}" must be an object.`};return{ok:!0,value:n}}function G_(e){return e.split(`
168
+ `).map(t=>t.trim()).filter(Boolean)}function b6(e){return Array.isArray(e)?e.map(t=>String(t)).join(`
169
+ `):typeof e=="string"?G_(e.split(",").join(`
170
+ `)).join(`
171
+ `):""}const Tv=["anthropic","openai","openrouter","google","ollama","local"],w6=["curie","nord","tokyo-night","dracula","solarized","gruvbox","black","white","grey"],Av=["plan","edit","auto","yolo"],S6=["low","medium","high","max","auto"],Cv=["on","off"];function _6({rpc:e,className:t}){const{ws:n}=fr(),[r,s]=w.useState(null),[i,o]=w.useState(null),[a,c]=w.useState(null),[u,d]=w.useState({kind:"idle"}),[f,h]=w.useState("anthropic"),[p,x]=w.useState(new Set),[b,S]=w.useState(!1),[m,y]=w.useState({}),g=w.useRef(!1),v=w.useCallback((C,j)=>{y(D=>j===null?C in D?Object.fromEntries(Object.entries(D).filter(([O])=>O!==C)):D:D[C]===j?D:{...D,[C]:j})},[]),N=w.useCallback(()=>{e&&e.configAll().then(C=>{if(!C||typeof C!="object")throw new Error("Malformed settings payload");const j=C;s(j),o(structuredClone(j)),c(null),S(!1);const D=j.current_provider;typeof D=="string"&&D&&h(D)}).catch(C=>{c(C instanceof Error?C.message:"Failed to load settings")})},[e]);w.useEffect(()=>{N()},[N]);const k=w.useMemo(()=>r&&i?V_(r,i):[],[r,i]),T=w.useMemo(()=>({...m,...i?y6(i):{}}),[i,m]),z=k.length>0,A=z&&Object.keys(T).length===0&&!g.current;w.useEffect(()=>{if(n)return n.on("config-changed",()=>{g.current||(z?S(!0):N())})},[n,z,N]);const L=w.useCallback((C,j)=>{o(D=>D&&q_(D,C,j))},[]),R=w.useCallback(()=>{o(r?structuredClone(r):null),d({kind:"idle"})},[r]),H=w.useCallback(async()=>{if(!(!e||!A)){g.current=!0,d({kind:"saving"});try{for(const C of m6(k))await e.configSet(C.path,C.value);d({kind:"saved",at:Date.now()}),g.current=!1,N()}catch(C){g.current=!1,d({kind:"error",msg:C instanceof Error?C.message:"Save failed"})}}},[e,A,k,N]),Y=w.useCallback(C=>{x(j=>{const D=new Set(j);return D.has(C)?D.delete(C):D.add(C),D})},[]),_={draft:i,errors:T,upd:L,revealed:p,toggleReveal:Y,setBlocker:v};return a?l.jsx("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin ${t??""}`,children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-14 gap-3",children:[l.jsx("span",{className:"text-[13px] text-red",children:"Could not load settings"}),l.jsx("span",{className:"text-xs text-muted font-mono",children:a}),l.jsx("button",{onClick:()=>{N()},className:"mt-1 px-3 py-1.5 rounded text-xs text-muted hover:text-fg transition-colors",style:{background:"var(--s3)",border:"1px solid var(--b1)"},children:"Retry"})]})}):i?l.jsx("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin ${t??""}`,children:l.jsxs("div",{className:"max-w-3xl mx-auto pb-10",children:[l.jsxs("div",{className:"flex items-center justify-between mb-5 gap-3 flex-wrap",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight",children:"Settings"}),l.jsx("span",{className:"text-[10px] text-muted font-mono",children:"~/.curie-settings.json"})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.jsx(k6,{status:u,dirty:z,errorCount:Object.keys(T).length}),l.jsx("button",{onClick:R,disabled:!z,className:"py-2 px-3.5 rounded-xl text-[12px] font-semibold cursor-pointer transition-all duration-150 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"var(--s3)",border:"1px solid var(--b1)",color:"var(--muted)"},children:"Revert"}),l.jsx("button",{onClick:()=>void H(),disabled:!A,className:"btn-gold py-2 px-4 rounded-xl text-[12px] font-semibold cursor-pointer active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:u.kind==="saving"?"Saving…":z?`Save ${String(k.length)} change${k.length===1?"":"s"}`:"Save"})]})]}),b&&l.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-2.5 rounded-lg mb-4",style:{background:"color-mix(in srgb, var(--yellow) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--yellow) 35%, transparent)"},children:[l.jsx("span",{className:"text-[12px]",style:{color:"var(--yellow)"},children:"Settings changed elsewhere. Your edits are kept — reload to see the new values."}),l.jsx("button",{onClick:()=>{N()},className:"text-[11px] font-semibold shrink-0 cursor-pointer hover:underline",style:{color:"var(--yellow)"},children:"Reload"})]}),u.kind==="error"&&l.jsx("div",{className:"px-4 py-2.5 rounded-lg mb-4 text-[12px]",style:{background:"color-mix(in srgb, var(--red) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--red) 35%, transparent)",color:"var(--red)"},children:u.msg}),l.jsxs(qr,{title:"Agent",children:[l.jsxs(Kn,{children:[l.jsx(Ra,{ctx:_,path:"mode",label:"Approval mode",options:Av}),l.jsx(Ra,{ctx:_,path:"effort",label:"Reasoning effort",options:S6}),l.jsx(Ra,{ctx:_,path:"theme",label:"Theme",options:w6})]}),l.jsxs(Kn,{children:[l.jsx(Dh,{ctx:_,path:"statusline",label:"Status line"}),l.jsx(Dh,{ctx:_,path:"debug",label:"Debug logging"})]})]}),l.jsxs(qr,{title:"Provider & Model",hint:"The active provider supplies the model used for every turn.",children:[l.jsx(Ra,{ctx:_,path:"current_provider",label:"Active provider",options:Tv}),l.jsx("div",{className:"flex flex-wrap gap-1.5 mt-4 mb-3",children:Tv.map(C=>{const j=f===C,D=ir(Ar(i,`providers.${C}.api_key`))!=="";return l.jsxs("button",{onClick:()=>{h(C)},className:"px-2.5 py-1 rounded-lg text-[11px] font-mono cursor-pointer transition-all duration-100 flex items-center gap-1.5",style:{background:j?"color-mix(in srgb, var(--gold) 15%, transparent)":"var(--s2)",border:`1px solid ${j?"var(--gold)":"var(--b1)"}`,color:j?"var(--gold)":"var(--muted)"},children:[C,l.jsx("span",{className:"w-[5px] h-[5px] rounded-full shrink-0",style:{background:D?"var(--green)":"var(--muted2)"}})]},C)})}),l.jsx(Rh,{ctx:_,path:`providers.${f}.api_key`,label:"API key"}),l.jsxs(Kn,{children:[l.jsx(Rn,{ctx:_,path:`providers.${f}.model`,label:"Model"}),l.jsx(Rn,{ctx:_,path:`providers.${f}.url`,label:"Base URL"})]}),l.jsxs(Kn,{children:[l.jsx(Rn,{ctx:_,path:`providers.${f}.model_cost`,label:"Pricing",placeholder:"3;15",hint:"Input;output USD per million tokens. Tiers: 3;15|272000<6;22.5"}),l.jsx(Vr,{ctx:_,path:`providers.${f}.model_context_window`,label:"Context window",min:1e3})]}),l.jsx(Vr,{ctx:_,path:`providers.${f}.max_output_tokens`,label:"Max output tokens",min:256})]}),l.jsx(qr,{title:"Limits",hint:"Per turn caps the current message; per run caps the whole session.",children:l.jsxs(Kn,{children:[l.jsx(Vr,{ctx:_,path:"tools_per_call",label:"Tool calls per turn",min:1}),l.jsx(Vr,{ctx:_,path:"tools_per_run",label:"Tool calls per run",min:1}),l.jsx(Vr,{ctx:_,path:"websearch_per_call",label:"Web searches per turn",min:0}),l.jsx(Vr,{ctx:_,path:"websearch_per_run",label:"Web searches per run",min:0})]})}),l.jsxs(qr,{title:"Auto-compaction",hint:"Percentages of the context window. Warn < suggest < force.",children:[l.jsx(ci,{ctx:_,path:"auto_compact.enabled",label:"Enabled"}),l.jsxs(Kn,{children:[l.jsx(Vr,{ctx:_,path:"auto_compact.warn_threshold",label:"Warn at %",min:5,max:99}),l.jsx(Vr,{ctx:_,path:"auto_compact.threshold",label:"Suggest at %",min:5,max:99}),l.jsx(Vr,{ctx:_,path:"auto_compact.forced_threshold",label:"Force at %",min:5,max:99}),l.jsx(Rn,{ctx:_,path:"auto_compact.model",label:"Summariser model",placeholder:"blank = active model"})]})]}),l.jsxs(qr,{title:"Safety",children:[l.jsxs(Kn,{children:[l.jsx(ci,{ctx:_,path:"safety.path_guard",label:"Path guard"}),l.jsx(ci,{ctx:_,path:"safety.command_guard",label:"Command guard"}),l.jsx(ci,{ctx:_,path:"safety.snapshots",label:"Git snapshots"})]}),l.jsx(zv,{ctx:_,path:"safety.path_allowlist",label:"Path allowlist",hint:"One absolute path per line. Writes outside the project cwd and these paths are refused.",placeholder:"C:\\git\\my-project"})]}),l.jsxs(qr,{title:"Heartbeat",hint:"Autonomous wake-ups. Turn the whole cycle off with Schedule rather than blanking times.",children:[l.jsxs(Kn,{children:[l.jsx(ci,{ctx:_,path:"heartbeat.schedule",label:"Schedule"}),l.jsx(Ra,{ctx:_,path:"heartbeat.mode",label:"Approval mode",options:Av})]}),l.jsx(Rn,{ctx:_,path:"heartbeat.intraday",label:"Intraday",placeholder:"7:55,11:55,15:55",hint:"Comma-separated H:MM times. Blank for none."}),l.jsxs(Kn,{children:[l.jsx(Rn,{ctx:_,path:"heartbeat.daily",label:"Daily",placeholder:"6:00"}),l.jsx(Rn,{ctx:_,path:"heartbeat.dreaming",label:"Dreaming",placeholder:"2:00"}),l.jsx(Rn,{ctx:_,path:"heartbeat.weekly",label:"Weekly",placeholder:"monday@6:00"}),l.jsx(Rn,{ctx:_,path:"heartbeat.monthly",label:"Monthly",placeholder:"1@6:00"})]})]}),l.jsxs(qr,{title:"Channels (Telegram)",children:[l.jsx(Rh,{ctx:_,path:"channels.bot_token",label:"Bot token"}),l.jsxs(Kn,{children:[l.jsx(Rn,{ctx:_,path:"channels.user_id",label:"User ID"}),l.jsx(Rn,{ctx:_,path:"channels.chat_id",label:"Chat ID"})]}),l.jsx(Dh,{ctx:_,path:"channels.allow_groups",label:"Allow group chats"})]}),l.jsxs(qr,{title:"Integrations",children:[l.jsx(Rh,{ctx:_,path:"brave_search_api_key",label:"Brave Search API key"}),l.jsxs(Kn,{children:[l.jsx(Rn,{ctx:_,path:"wiki.path",label:"Wiki path",placeholder:"blank = default"}),l.jsx(ci,{ctx:_,path:"wiki.autoLint",label:"Wiki auto-lint"}),l.jsx(ci,{ctx:_,path:"pricing_tier_warn",label:"Pricing tier warnings"})]}),l.jsx(N6,{ctx:_,path:"mcp_servers",label:"MCP servers",badge:"RESTART",hint:"An object keyed by server name. Changes apply after the daemon restarts."})]}),l.jsxs(qr,{title:"Advanced",children:[l.jsx(zv,{ctx:_,path:"system_prompt_files",label:"System prompt files",badge:"RESTART",hint:"Identity files in ~/.curie-agent/ inlined into the system prompt, in order.",placeholder:"AGENTS.md"}),l.jsx(ps,{label:"Web bind IP",hint:"The address the daemon listens on. Edit ~/.curie-settings.json directly — a wrong value makes the daemon unreachable.",children:l.jsx("div",{className:"w-full px-3 py-2 rounded-lg text-[12.5px] font-mono text-muted",style:{background:"var(--s1)",border:"1px solid var(--b1)"},children:ir(Ar(i,"web_ip"))||"127.0.0.1"})})]})]})}):l.jsx("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin ${t??""}`,children:l.jsx("div",{className:"flex items-center justify-center py-10 text-muted text-[13px]",children:"Loading settings…"})})}function k6({status:e,dirty:t,errorCount:n}){return n>0?l.jsxs("span",{className:"text-[11px] font-mono",style:{color:"var(--red)"},children:[String(n)," error",n===1?"":"s"]}):e.kind==="saved"&&!t?l.jsxs("span",{className:"text-[11px] font-mono",style:{color:"var(--green)"},children:["saved ",new Date(e.at).toLocaleTimeString()]}):t?l.jsx("span",{className:"text-[11px] font-mono text-muted",children:"unsaved"}):null}function qr({title:e,hint:t,children:n}){return l.jsxs("div",{className:"rounded-xl mb-3 overflow-hidden",style:{background:"var(--s1)",border:"1px solid var(--b1)"},children:[l.jsxs("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--b1)"},children:[l.jsx("div",{className:"text-[12px] font-medium text-text2",children:e}),t&&l.jsx("div",{className:"text-[10.5px] text-muted mt-0.5",children:t})]}),l.jsx("div",{className:"p-4 space-y-3",children:n})]})}function Kn({children:e}){return l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:e})}function ps({label:e,hint:t,error:n,badge:r,children:s}){return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono block",children:e}),r&&l.jsx("span",{className:"text-[9px] font-mono px-1.5 py-px rounded uppercase tracking-wider",style:{background:"color-mix(in srgb, var(--yellow) 15%, transparent)",color:"var(--yellow)"},children:r})]}),s,n?l.jsx("div",{className:"text-[10.5px] mt-1",style:{color:"var(--red)"},children:n}):t?l.jsx("div",{className:"text-[10.5px] text-muted mt-1",children:t}):null]})}const oc="w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none transition-colors focus:ring-1 focus:ring-gold/30",Mv={background:"var(--s2)",border:"1px solid var(--b1)"};function pa(e){return e?{...Mv,border:"1px solid var(--red)"}:Mv}function Rn({ctx:e,path:t,label:n,hint:r,badge:s,placeholder:i}){const o=e.errors[t];return l.jsx(ps,{label:n,hint:r,error:o,badge:s,children:l.jsx("input",{type:"text",value:ir(Ar(e.draft,t)),onChange:a=>{e.upd(t,a.target.value)},placeholder:i,className:oc,style:pa(o)})})}function Vr({ctx:e,path:t,label:n,hint:r,min:s,max:i}){const o=e.errors[t],a=Ar(e.draft,t),{setBlocker:c}=e;return w.useEffect(()=>{a==null||a===""?c(t,"Required."):typeof a!="number"||!Number.isFinite(a)?c(t,"Must be a number."):s!==void 0&&a<s?c(t,`Must be at least ${String(s)}.`):i!==void 0&&a>i?c(t,`Must be at most ${String(i)}.`):c(t,null)},[a,t,s,i,c]),w.useEffect(()=>()=>{c(t,null)},[t,c]),l.jsx(ps,{label:n,hint:r,error:o,children:l.jsx("input",{type:"number",min:s,max:i,value:typeof a=="number"?String(a):"",onChange:u=>{const d=u.target.value;e.upd(t,d===""?"":Number(d))},className:oc,style:pa(o)})})}function Ra({ctx:e,path:t,label:n,hint:r,options:s}){const i=e.errors[t],o=ir(Ar(e.draft,t));return l.jsx(ps,{label:n,hint:r,error:i,children:l.jsxs("select",{value:o,onChange:a=>{e.upd(t,a.target.value)},className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none cursor-pointer",style:pa(i),children:[!s.includes(o)&&l.jsx("option",{value:o,children:o||"—"}),s.map(a=>l.jsx("option",{value:a,children:a},a))]})})}function Dh({ctx:e,path:t,label:n,hint:r}){const s=Ar(e.draft,t)===!0;return l.jsx(ps,{label:n,hint:r,children:l.jsx(X_,{on:s,onClick:()=>{e.upd(t,!s)},onLabel:"on",offLabel:"off"})})}function ci({ctx:e,path:t,label:n,hint:r}){const s=ir(Ar(e.draft,t))==="on";return l.jsx(ps,{label:n,hint:r,children:l.jsx(X_,{on:s,onClick:()=>{e.upd(t,s?Cv[1]:Cv[0])},onLabel:"on",offLabel:"off"})})}function X_({on:e,onClick:t,onLabel:n,offLabel:r}){return l.jsxs("button",{onClick:t,className:"flex items-center gap-2 px-3 py-2 rounded-lg text-[12.5px] cursor-pointer transition-colors w-full",style:{background:"var(--s2)",border:"1px solid var(--b1)",color:e?"var(--green)":"var(--muted)"},children:[l.jsx("span",{className:"w-8 h-4 rounded-full relative shrink-0 transition-colors",style:{background:e?"var(--green)":"var(--b3)"},children:l.jsx("span",{className:"absolute top-0.5 w-3 h-3 rounded-full transition-all",style:{background:"var(--s1)",left:e?"18px":"2px"}})}),l.jsx("span",{className:"font-mono text-[11px]",children:e?n:r})]})}function Rh({ctx:e,path:t,label:n,hint:r}){const s=e.errors[t],i=ir(Ar(e.draft,t)),o=e.revealed.has(t);return l.jsx(ps,{label:n,hint:r??(i?void 0:"Not set"),error:s,children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:o?"text":"password",value:i,onChange:a=>{e.upd(t,a.target.value)},autoComplete:"off",spellCheck:!1,placeholder:"not set",className:`${oc} font-mono`,style:pa(s)}),l.jsx("button",{onClick:()=>{e.toggleReveal(t)},title:o?"Hide":"Reveal",className:"px-3 rounded-lg text-muted hover:text-fg transition-colors cursor-pointer shrink-0",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:o?l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:[l.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),l.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:[l.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),l.jsx("circle",{cx:"12",cy:"12",r:"3"})]})})]})})}function zv({ctx:e,path:t,label:n,hint:r,badge:s,placeholder:i}){const o=e.errors[t];return l.jsx(ps,{label:n,hint:r,error:o,badge:s,children:l.jsx("textarea",{value:b6(Ar(e.draft,t)),onChange:a=>{e.upd(t,G_(a.target.value))},rows:3,placeholder:i,className:`${oc} font-mono resize-y scrollbar-thin`,style:pa(o),spellCheck:!1})})}function N6({ctx:e,path:t,label:n,hint:r,badge:s}){const i=Ar(e.draft,t),[o,a]=w.useState(()=>JSON.stringify(i??{},null,2)),c=w.useRef(i),{setBlocker:u}=e,d=e.errors[t];return w.useEffect(()=>{i!==c.current&&(c.current=i,a(JSON.stringify(i??{},null,2)),u(t,null))},[i,t,u]),w.useEffect(()=>()=>{u(t,null)},[t,u]),l.jsx(ps,{label:n,hint:r,error:d,badge:s,children:l.jsx("textarea",{value:o,onChange:f=>{const h=f.target.value;a(h);const p=v6(h);p.ok?(u(t,null),c.current=p.value,e.upd(t,p.value)):u(t,p.error)},rows:8,className:`${oc} font-mono text-[11.5px] resize-y scrollbar-thin`,style:pa(d),spellCheck:!1})})}var Dv;function Q(e,t,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const u=o.prototype,d=Object.keys(u);for(let f=0;f<d.length;f++){const h=d[f];h in a||(a[h]=u[h].bind(a))}}const s=(n==null?void 0:n.Parent)??Object;class i extends s{}Object.defineProperty(i,"name",{value:e});function o(a){var c;const u=n!=null&&n.Parent?new i:this;r(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var c,u;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(u=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:u.has(e)}}),Object.defineProperty(o,"name",{value:e}),o}class Do extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class P_ extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Dv=globalThis).__zod_globalConfig??(Dv.__zod_globalConfig={});const Gg=globalThis.__zod_globalConfig;function us(e){return Gg}function F_(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,s])=>t.indexOf(+r)===-1).map(([r,s])=>s)}function nm(e,t){return typeof t=="bigint"?t.toString():t}function pf(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Xg(e){return e==null}function Pg(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function j6(e,t){const n=e/t,r=Math.round(n),s=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<s?0:n-r}const Rv=Symbol("evaluating");function $e(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Rv)return r===void 0&&(r=Rv,r=n()),r},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function Zi(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Js(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ov(e){return JSON.stringify(e)}function E6(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Q_="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ol(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const T6=pf(()=>{var e;if(Gg.jitless||typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function ea(e){if(Ol(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Ol(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function K_(e){return ea(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const A6=new Set(["string","number","symbol"]);function ta(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ei(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function de(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function C6(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const M6={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function z6(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=Js(e._zod.def,{get shape(){const o={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(o[a]=n.shape[a])}return Zi(this,"shape",o),o},checks:[]});return ei(e,i)}function D6(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=Js(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete o[a]}return Zi(this,"shape",o),o},checks:[]});return ei(e,i)}function R6(e,t){if(!ea(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const o in t)if(Object.getOwnPropertyDescriptor(i,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=Js(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Zi(this,"shape",i),i}});return ei(e,s)}function O6(e,t){if(!ea(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Js(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Zi(this,"shape",r),r}});return ei(e,n)}function $6(e,t){var r;if((r=e._zod.def.checks)!=null&&r.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=Js(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t._zod.def.shape};return Zi(this,"shape",s),s},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ei(e,n)}function L6(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=Js(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return Zi(this,"shape",c),c},checks:[]});return ei(t,o)}function H6(e,t,n){const r=Js(t._zod.def,{get shape(){const s=t._zod.def.shape,i={...s};if(n)for(const o in n){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(i[o]=new e({type:"nonoptional",innerType:s[o]}))}else for(const o in s)i[o]=new e({type:"nonoptional",innerType:s[o]});return Zi(this,"shape",i),i}});return ei(t,r)}function vo(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function B6(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)===!1)return!0;return!1}function bo(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function ru(e){return typeof e=="string"?e:e==null?void 0:e.message}function ds(e,t,n){var c,u,d,f,h,p;const r=e.message?e.message:ru((d=(u=(c=e.inst)==null?void 0:c._zod.def)==null?void 0:u.error)==null?void 0:d.call(u,e))??ru((f=t==null?void 0:t.error)==null?void 0:f.call(t,e))??ru((h=n.customError)==null?void 0:h.call(n,e))??ru((p=n.localeError)==null?void 0:p.call(n,e))??"Invalid input",{inst:s,continue:i,input:o,...a}=e;return a.path??(a.path=[]),a.message=r,t!=null&&t.reportInput&&(a.input=o),a}function Fg(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function $l(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const W_=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,nm,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},J_=Q("$ZodError",W_),ek=Q("$ZodError",W_,{Parent:Error});function U6(e,t=n=>n.message){const n={},r=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}function I6(e,t=n=>n.message){const n={_errors:[]},r=(s,i=[])=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>r({issues:a},[...i,...o.path]));else if(o.code==="invalid_key")r({issues:o.issues},[...i,...o.path]);else if(o.code==="invalid_element")r({issues:o.issues},[...i,...o.path]);else{const a=[...i,...o.path];if(a.length===0)n._errors.push(t(o));else{let c=n,u=0;for(;u<a.length;){const d=a[u];u===a.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(t(o))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}}};return r(e),n}const Qg=e=>(t,n,r,s)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new Do;if(o.issues.length){const a=new((s==null?void 0:s.Err)??e)(o.issues.map(c=>ds(c,i,us())));throw Q_(a,s==null?void 0:s.callee),a}return o.value},Kg=e=>async(t,n,r,s)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((s==null?void 0:s.Err)??e)(o.issues.map(c=>ds(c,i,us())));throw Q_(a,s==null?void 0:s.callee),a}return o.value},mf=e=>(t,n,r)=>{const s=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Do;return i.issues.length?{success:!1,error:new(e??J_)(i.issues.map(o=>ds(o,s,us())))}:{success:!0,data:i.value}},Z6=mf(ek),gf=e=>async(t,n,r)=>{const s=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},s);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(o=>ds(o,s,us())))}:{success:!0,data:i.value}},Y6=gf(ek),q6=e=>(t,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return Qg(e)(t,n,s)},V6=e=>(t,n,r)=>Qg(e)(t,n,r),G6=e=>async(t,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return Kg(e)(t,n,s)},X6=e=>async(t,n,r)=>Kg(e)(t,n,r),P6=e=>(t,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return mf(e)(t,n,s)},F6=e=>(t,n,r)=>mf(e)(t,n,r),Q6=e=>async(t,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return gf(e)(t,n,s)},K6=e=>async(t,n,r)=>gf(e)(t,n,r),W6=/^[cC][0-9a-z]{6,}$/,J6=/^[0-9a-z]+$/,e$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,t$=/^[0-9a-vA-V]{20}$/,n$=/^[A-Za-z0-9]{27}$/,r$=/^[a-zA-Z0-9_-]{21}$/,s$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,i$=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$v=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,o$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,a$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function l$(){return new RegExp(a$,"u")}const c$=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,u$=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,d$=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,f$=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,h$=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tk=/^[A-Za-z0-9_-]*$/,p$=/^https?$/,m$=/^\+[1-9]\d{6,14}$/,nk="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",g$=new RegExp(`^${nk}$`);function rk(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function x$(e){return new RegExp(`^${rk(e)}$`)}function y$(e){const t=rk({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${nk}T(?:${r})$`)}const v$=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},b$=/^-?\d+$/,sk=/^-?\d+(?:\.\d+)?$/,w$=/^(?:true|false)$/i,S$=/^[^A-Z]*$/,_$=/^[^a-z]*$/,fn=Q("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ik={number:"number",bigint:"bigint",object:"date"},ok=Q("$ZodCheckLessThan",(e,t)=>{fn.init(e,t);const n=ik[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,i=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ak=Q("$ZodCheckGreaterThan",(e,t)=>{fn.init(e,t);const n=ik[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,i=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),k$=Q("$ZodCheckMultipleOf",(e,t)=>{fn.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):j6(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),N$=Q("$ZodCheckNumberFormat",(e,t)=>{var o;fn.init(e,t),t.format=t.format||"float64";const n=(o=t.format)==null?void 0:o.includes("int"),r=n?"int":"number",[s,i]=M6[t.format];e._zod.onattach.push(a=>{const c=a._zod.bag;c.format=t.format,c.minimum=s,c.maximum=i,n&&(c.pattern=b$)}),e._zod.check=a=>{const c=a.value;if(n){if(!Number.isInteger(c)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}c<s&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),c>i&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),j$=Q("$ZodCheckMaxLength",(e,t)=>{var n;fn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!Xg(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const s=r.value;if(s.length<=t.maximum)return;const o=Fg(s);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),E$=Q("$ZodCheckMinLength",(e,t)=>{var n;fn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!Xg(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const s=r.value;if(s.length>=t.minimum)return;const o=Fg(s);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),T$=Q("$ZodCheckLengthEquals",(e,t)=>{var n;fn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!Xg(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=r=>{const s=r.value,i=s.length;if(i===t.length)return;const o=Fg(s),a=i>t.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),xf=Q("$ZodCheckStringFormat",(e,t)=>{var n,r;fn.init(e,t),e._zod.onattach.push(s=>{const i=s._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),A$=Q("$ZodCheckRegex",(e,t)=>{xf.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),C$=Q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=S$),xf.init(e,t)}),M$=Q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=_$),xf.init(e,t)}),z$=Q("$ZodCheckIncludes",(e,t)=>{fn.init(e,t);const n=ta(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),D$=Q("$ZodCheckStartsWith",(e,t)=>{fn.init(e,t);const n=new RegExp(`^${ta(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),R$=Q("$ZodCheckEndsWith",(e,t)=>{fn.init(e,t);const n=new RegExp(`.*${ta(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),O$=Q("$ZodCheckOverwrite",(e,t)=>{fn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class $${constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
172
+ `).filter(o=>o),s=Math.min(...r.map(o=>o.length-o.trimStart().length)),i=r.map(o=>o.slice(s)).map(o=>" ".repeat(this.indent*2)+o);for(const o of i)this.content.push(o)}compile(){const t=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new t(...n,s.join(`
173
+ `))}}const L$={major:4,minor:4,patch:3},nt=Q("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=L$;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const o of i._zod.onattach)o(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const i=(a,c,u)=>{let d=vo(a),f;for(const h of c){if(h._zod.def.when){if(B6(a)||!h._zod.def.when(a))continue}else if(d)continue;const p=a.issues.length,x=h._zod.check(a);if(x instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Do;if(f||x instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await x,a.issues.length!==p&&(d||(d=vo(a,p)))});else{if(a.issues.length===p)continue;d||(d=vo(a,p))}}return f?f.then(()=>a):a},o=(a,c,u)=>{if(vo(a))return a.aborted=!0,a;const d=i(c,r,u);if(d instanceof Promise){if(u.async===!1)throw new Do;return d.then(f=>e._zod.parse(f,u))}return e._zod.parse(d,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){const d=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return d instanceof Promise?d.then(f=>o(f,a,c)):o(d,a,c)}const u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new Do;return u.then(d=>i(d,r,c))}return i(u,r,c)}}$e(e,"~standard",()=>({validate:i=>{var o;try{const a=Z6(e,i);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return Y6(e,i).then(c=>{var u;return c.success?{value:c.data}:{issues:(u=c.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}))}),Wg=Q("$ZodString",(e,t)=>{var n;nt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??v$(e._zod.bag),e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),et=Q("$ZodStringFormat",(e,t)=>{xf.init(e,t),Wg.init(e,t)}),H$=Q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=i$),et.init(e,t)}),B$=Q("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=$v(r))}else t.pattern??(t.pattern=$v());et.init(e,t)}),U$=Q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=o$),et.init(e,t)}),I$=Q("$ZodURL",(e,t)=>{et.init(e,t),e._zod.check=n=>{var r;try{const s=n.value.trim();if(!t.normalize&&((r=t.protocol)==null?void 0:r.source)===p$.source&&!/^https?:\/\//i.test(s)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const i=new URL(s);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=s;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Z$=Q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=l$()),et.init(e,t)}),Y$=Q("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=r$),et.init(e,t)}),q$=Q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=W6),et.init(e,t)}),V$=Q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=J6),et.init(e,t)}),G$=Q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=e$),et.init(e,t)}),X$=Q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=t$),et.init(e,t)}),P$=Q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=n$),et.init(e,t)}),F$=Q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=y$(t)),et.init(e,t)}),Q$=Q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=g$),et.init(e,t)}),K$=Q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=x$(t)),et.init(e,t)}),W$=Q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=s$),et.init(e,t)}),J$=Q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=c$),et.init(e,t),e._zod.bag.format="ipv4"}),e8=Q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=u$),et.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),t8=Q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=d$),et.init(e,t)}),n8=Q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=f$),et.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[s,i]=r;if(!i)throw new Error;const o=Number(i);if(`${o}`!==i)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function lk(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const r8=Q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=h$),et.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{lk(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function s8(e){if(!tk.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return lk(n)}const i8=Q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=tk),et.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{s8(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),o8=Q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=m$),et.init(e,t)});function a8(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const s=JSON.parse(atob(r));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const l8=Q("$ZodJWT",(e,t)=>{et.init(e,t),e._zod.check=n=>{a8(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ck=Q("$ZodNumber",(e,t)=>{nt.init(e,t),e._zod.pattern=e._zod.bag.pattern??sk,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const i=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...i?{received:i}:{}}),n}}),c8=Q("$ZodNumberFormat",(e,t)=>{N$.init(e,t),ck.init(e,t)}),u8=Q("$ZodBoolean",(e,t)=>{nt.init(e,t),e._zod.pattern=w$,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),n}}),d8=Q("$ZodUnknown",(e,t)=>{nt.init(e,t),e._zod.parse=n=>n}),f8=Q("$ZodNever",(e,t)=>{nt.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Lv(e,t,n){e.issues.length&&t.issues.push(...bo(n,e.issues)),t.value[n]=e.value}const h8=Q("$ZodArray",(e,t)=>{nt.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const i=[];for(let o=0;o<s.length;o++){const a=s[o],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?i.push(c.then(u=>Lv(u,n,o))):Lv(c,n,o)}return i.length?Promise.all(i).then(()=>n):n}});function Nd(e,t,n,r,s,i){const o=n in r;if(e.issues.length){if(s&&i&&!o)return;t.issues.push(...bo(n,e.issues))}if(!o&&!s){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function uk(e){var r,s,i,o;const t=Object.keys(e.shape);for(const a of t)if(!((o=(i=(s=(r=e.shape)==null?void 0:r[a])==null?void 0:s._zod)==null?void 0:i.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=C6(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function dk(e,t,n,r,s,i){const o=[],a=s.keySet,c=s.catchall._zod,u=c.def.type,d=c.optin==="optional",f=c.optout==="optional";for(const h in t){if(h==="__proto__"||a.has(h))continue;if(u==="never"){o.push(h);continue}const p=c.run({value:t[h],issues:[]},r);p instanceof Promise?e.push(p.then(x=>Nd(x,n,h,t,d,f))):Nd(p,n,h,t,d,f)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const p8=Q("$ZodObject",(e,t)=>{nt.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=pf(()=>uk(t));$e(e._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const d=a[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(const f of d.values)c[u].add(f)}}return c});const s=Ol,i=t.catchall;let o;e._zod.parse=(a,c)=>{o??(o=r.value);const u=a.value;if(!s(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const d=[],f=o.shape;for(const h of o.keys){const p=f[h],x=p._zod.optin==="optional",b=p._zod.optout==="optional",S=p._zod.run({value:u[h],issues:[]},c);S instanceof Promise?d.push(S.then(m=>Nd(m,a,h,u,x,b))):Nd(S,a,h,u,x,b)}return i?dk(d,u,a,c,r.value,e):d.length?Promise.all(d).then(()=>a):a}}),m8=Q("$ZodObjectJIT",(e,t)=>{p8.init(e,t);const n=e._zod.parse,r=pf(()=>uk(t)),s=h=>{var g,v;const p=new $$(["shape","payload","ctx"]),x=r.value,b=N=>{const k=Ov(N);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};p.write("const input = payload.value;");const S=Object.create(null);let m=0;for(const N of x.keys)S[N]=`key_${m++}`;p.write("const newResult = {};");for(const N of x.keys){const k=S[N],T=Ov(N),z=h[N],A=((g=z==null?void 0:z._zod)==null?void 0:g.optin)==="optional",L=((v=z==null?void 0:z._zod)==null?void 0:v.optout)==="optional";p.write(`const ${k} = ${b(N)};`),A&&L?p.write(`
174
+ if (${k}.issues.length) {
175
+ if (${T} in input) {
176
+ payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
177
+ ...iss,
178
+ path: iss.path ? [${T}, ...iss.path] : [${T}]
179
+ })));
180
+ }
181
+ }
182
+
183
+ if (${k}.value === undefined) {
184
+ if (${T} in input) {
185
+ newResult[${T}] = undefined;
186
+ }
187
+ } else {
188
+ newResult[${T}] = ${k}.value;
189
+ }
190
+
191
+ `):A?p.write(`
192
+ if (${k}.issues.length) {
193
+ payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
194
+ ...iss,
195
+ path: iss.path ? [${T}, ...iss.path] : [${T}]
196
+ })));
197
+ }
198
+
199
+ if (${k}.value === undefined) {
200
+ if (${T} in input) {
201
+ newResult[${T}] = undefined;
202
+ }
203
+ } else {
204
+ newResult[${T}] = ${k}.value;
205
+ }
206
+
207
+ `):p.write(`
208
+ const ${k}_present = ${T} in input;
209
+ if (${k}.issues.length) {
210
+ payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
211
+ ...iss,
212
+ path: iss.path ? [${T}, ...iss.path] : [${T}]
213
+ })));
214
+ }
215
+ if (!${k}_present && !${k}.issues.length) {
216
+ payload.issues.push({
217
+ code: "invalid_type",
218
+ expected: "nonoptional",
219
+ input: undefined,
220
+ path: [${T}]
221
+ });
222
+ }
223
+
224
+ if (${k}_present) {
225
+ if (${k}.value === undefined) {
226
+ newResult[${T}] = undefined;
227
+ } else {
228
+ newResult[${T}] = ${k}.value;
229
+ }
230
+ }
231
+
232
+ `)}p.write("payload.value = newResult;"),p.write("return payload;");const y=p.compile();return(N,k)=>y(h,N,k)};let i;const o=Ol,a=!Gg.jitless,u=a&&T6.value,d=t.catchall;let f;e._zod.parse=(h,p)=>{f??(f=r.value);const x=h.value;return o(x)?a&&u&&(p==null?void 0:p.async)===!1&&p.jitless!==!0?(i||(i=s(t.shape)),h=i(h,p),d?dk([],x,h,p,f,e):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),h)}});function Hv(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const s=e.filter(i=>!vo(i));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(o=>ds(o,r,us())))}),t)}const fk=Q("$ZodUnion",(e,t)=>{nt.init(e,t),$e(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),$e(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),$e(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),$e(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${r.map(s=>Pg(s.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,s)=>{if(n)return n(r,s);let i=!1;const o=[];for(const a of t.options){const c=a._zod.run({value:r.value,issues:[]},s);if(c instanceof Promise)o.push(c),i=!0;else{if(c.issues.length===0)return c;o.push(c)}}return i?Promise.all(o).then(a=>Hv(a,r,e,s)):Hv(o,r,e,s)}}),g8=Q("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,fk.init(e,t);const n=e._zod.parse;$e(e._zod,"propValues",()=>{const s={};for(const i of t.options){const o=i._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[a,c]of Object.entries(o)){s[a]||(s[a]=new Set);for(const u of c)s[a].add(u)}}return s});const r=pf(()=>{var o;const s=t.options,i=new Map;for(const a of s){const c=(o=a._zod.propValues)==null?void 0:o[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const u of c){if(i.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);i.set(u,a)}}return i});e._zod.parse=(s,i)=>{const o=s.value;if(!Ol(o))return s.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),s;const a=r.value.get(o==null?void 0:o[t.discriminator]);return a?a._zod.run(s,i):t.unionFallback||i.direction==="backward"?n(s,i):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),s)}}),x8=Q("$ZodIntersection",(e,t)=>{nt.init(e,t),e._zod.parse=(n,r)=>{const s=n.value,i=t.left._zod.run({value:s,issues:[]},r),o=t.right._zod.run({value:s,issues:[]},r);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([c,u])=>Bv(n,c,u)):Bv(n,i,o)}});function rm(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ea(e)&&ea(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),s={...e,...t};for(const i of r){const o=rm(e[i],t[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};s[i]=o.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const s=e[r],i=t[r],o=rm(s,i);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Bv(e,t,n){const r=new Map;let s;for(const a of t.issues)if(a.code==="unrecognized_keys"){s??(s=a);for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(a);const i=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&s&&e.issues.push({...s,keys:i}),vo(e))return e;const o=rm(t.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const y8=Q("$ZodRecord",(e,t)=>{nt.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!ea(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const i=[],o=t.keyType._zod.values;if(o){n.value={};const a=new Set;for(const u of o)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);const d=t.keyType._zod.run({value:u,issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(p=>ds(p,r,us())),input:u,path:[u],inst:e});continue}const f=d.value,h=t.valueType._zod.run({value:s[u],issues:[]},r);h instanceof Promise?i.push(h.then(p=>{p.issues.length&&n.issues.push(...bo(u,p.issues)),n.value[f]=p.value})):(h.issues.length&&n.issues.push(...bo(u,h.issues)),n.value[f]=h.value)}let c;for(const u in s)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c})}else{n.value={};for(const a of Reflect.ownKeys(s)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&sk.test(a)&&c.issues.length){const f=t.keyType._zod.run({value:Number(a),issues:[]},r);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(c=f)}if(c.issues.length){t.mode==="loose"?n.value[a]=s[a]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(f=>ds(f,r,us())),input:a,path:[a],inst:e});continue}const d=t.valueType._zod.run({value:s[a],issues:[]},r);d instanceof Promise?i.push(d.then(f=>{f.issues.length&&n.issues.push(...bo(a,f.issues)),n.value[c.value]=f.value})):(d.issues.length&&n.issues.push(...bo(a,d.issues)),n.value[c.value]=d.value)}}return i.length?Promise.all(i).then(()=>n):n}}),v8=Q("$ZodEnum",(e,t)=>{nt.init(e,t);const n=F_(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(s=>A6.has(typeof s)).map(s=>typeof s=="string"?ta(s):s.toString()).join("|")})$`),e._zod.parse=(s,i)=>{const o=s.value;return r.has(o)||s.issues.push({code:"invalid_value",values:n,input:o,inst:e}),s}}),b8=Q("$ZodLiteral",(e,t)=>{if(nt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?ta(r):r?ta(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,s)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),w8=Q("$ZodTransform",(e,t)=>{nt.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new P_(e.constructor.name);const s=t.transform(n.value,n);if(r.async)return(s instanceof Promise?s:Promise.resolve(s)).then(o=>(n.value=o,n.fallback=!0,n));if(s instanceof Promise)throw new Do;return n.value=s,n.fallback=!0,n}});function Uv(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const hk=Q("$ZodOptional",(e,t)=>{nt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",$e(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),$e(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Pg(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const s=n.value,i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>Uv(o,s)):Uv(i,s)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),S8=Q("$ZodExactOptional",(e,t)=>{hk.init(e,t),$e(e._zod,"values",()=>t.innerType._zod.values),$e(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),_8=Q("$ZodNullable",(e,t)=>{nt.init(e,t),$e(e._zod,"optin",()=>t.innerType._zod.optin),$e(e._zod,"optout",()=>t.innerType._zod.optout),$e(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Pg(n.source)}|null)$`):void 0}),$e(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),k8=Q("$ZodDefault",(e,t)=>{nt.init(e,t),e._zod.optin="optional",$e(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>Iv(i,t)):Iv(s,t)}});function Iv(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const N8=Q("$ZodPrefault",(e,t)=>{nt.init(e,t),e._zod.optin="optional",$e(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),j8=Q("$ZodNonOptional",(e,t)=>{nt.init(e,t),$e(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>Zv(i,e)):Zv(s,e)}});function Zv(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const E8=Q("$ZodCatch",(e,t)=>{nt.init(e,t),e._zod.optin="optional",$e(e._zod,"optout",()=>t.innerType._zod.optout),$e(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(o=>ds(o,r,us()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>ds(i,r,us()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),T8=Q("$ZodPipe",(e,t)=>{nt.init(e,t),$e(e._zod,"values",()=>t.in._zod.values),$e(e._zod,"optin",()=>t.in._zod.optin),$e(e._zod,"optout",()=>t.out._zod.optout),$e(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(o=>su(o,t.in,r)):su(i,t.in,r)}const s=t.in._zod.run(n,r);return s instanceof Promise?s.then(i=>su(i,t.out,r)):su(s,t.out,r)}});function su(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const A8=Q("$ZodReadonly",(e,t)=>{nt.init(e,t),$e(e._zod,"propValues",()=>t.innerType._zod.propValues),$e(e._zod,"values",()=>t.innerType._zod.values),$e(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),$e(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(Yv):Yv(s)}});function Yv(e){return e.value=Object.freeze(e.value),e}const C8=Q("$ZodCustom",(e,t)=>{fn.init(e,t),nt.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,s=t.fn(r);if(s instanceof Promise)return s.then(i=>qv(i,n,r,e));qv(s,n,r,e)}});function qv(e,t,n,r){if(!e){const s={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(s.params=r._zod.def.params),t.issues.push($l(s))}}var Vv;class M8{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const s={...r,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function z8(){return new M8}(Vv=globalThis).__zod_globalRegistry??(Vv.__zod_globalRegistry=z8());const qa=globalThis.__zod_globalRegistry;function D8(e,t){return new e({type:"string",...de(t)})}function R8(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...de(t)})}function Gv(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...de(t)})}function O8(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...de(t)})}function $8(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...de(t)})}function L8(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...de(t)})}function H8(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...de(t)})}function B8(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...de(t)})}function U8(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...de(t)})}function I8(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...de(t)})}function Z8(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...de(t)})}function Y8(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...de(t)})}function q8(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...de(t)})}function V8(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...de(t)})}function G8(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...de(t)})}function X8(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...de(t)})}function P8(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...de(t)})}function F8(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...de(t)})}function Q8(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...de(t)})}function K8(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...de(t)})}function W8(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...de(t)})}function J8(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...de(t)})}function eL(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...de(t)})}function tL(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...de(t)})}function nL(e,t){return new e({type:"string",format:"date",check:"string_format",...de(t)})}function rL(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...de(t)})}function sL(e,t){return new e({type:"string",format:"duration",check:"string_format",...de(t)})}function iL(e,t){return new e({type:"number",checks:[],...de(t)})}function oL(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...de(t)})}function aL(e,t){return new e({type:"boolean",...de(t)})}function lL(e){return new e({type:"unknown"})}function cL(e,t){return new e({type:"never",...de(t)})}function Xv(e,t){return new ok({check:"less_than",...de(t),value:e,inclusive:!1})}function Oh(e,t){return new ok({check:"less_than",...de(t),value:e,inclusive:!0})}function Pv(e,t){return new ak({check:"greater_than",...de(t),value:e,inclusive:!1})}function $h(e,t){return new ak({check:"greater_than",...de(t),value:e,inclusive:!0})}function Fv(e,t){return new k$({check:"multiple_of",...de(t),value:e})}function pk(e,t){return new j$({check:"max_length",...de(t),maximum:e})}function jd(e,t){return new E$({check:"min_length",...de(t),minimum:e})}function mk(e,t){return new T$({check:"length_equals",...de(t),length:e})}function uL(e,t){return new A$({check:"string_format",format:"regex",...de(t),pattern:e})}function dL(e){return new C$({check:"string_format",format:"lowercase",...de(e)})}function fL(e){return new M$({check:"string_format",format:"uppercase",...de(e)})}function hL(e,t){return new z$({check:"string_format",format:"includes",...de(t),includes:e})}function pL(e,t){return new D$({check:"string_format",format:"starts_with",...de(t),prefix:e})}function mL(e,t){return new R$({check:"string_format",format:"ends_with",...de(t),suffix:e})}function ma(e){return new O$({check:"overwrite",tx:e})}function gL(e){return ma(t=>t.normalize(e))}function xL(){return ma(e=>e.trim())}function yL(){return ma(e=>e.toLowerCase())}function vL(){return ma(e=>e.toUpperCase())}function bL(){return ma(e=>E6(e))}function wL(e,t,n){return new e({type:"array",element:t,...de(n)})}function SL(e,t,n){return new e({type:"custom",check:"custom",fn:t,...de(n)})}function _L(e,t){const n=kL(r=>(r.addIssue=s=>{if(typeof s=="string")r.issues.push($l(s,r.value,n._zod.def));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push($l(i))}},e(r.value,r)),t);return n}function kL(e,t){const n=new fn({check:"custom",...de(t)});return n._zod.check=e,n}function gk(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??qa,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function mt(e,t,n={path:[],schemaPath:[]}){var d,f;var r;const s=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);const a=(f=(d=e._zod).toJSONSchema)==null?void 0:f.call(d);if(a)o.schema=a;else{const h={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,h);else{const x=o.schema,b=t.processors[s.type];if(!b)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);b(e,t,x,h)}const p=e._zod.parent;p&&(o.ref||(o.ref=p),mt(p,t,h),t.seen.get(p).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io==="input"&&Xt(e)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function xk(e,t){var o,a,c,u;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const d of e.seen.entries()){const f=(o=e.metadataRegistry.get(d[0]))==null?void 0:o.id;if(f){const h=r.get(f);if(h&&h!==d[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(f,d[0])}}const s=d=>{var b;const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const S=(b=e.external.registry.get(d[0]))==null?void 0:b.id,m=e.external.uri??(g=>g);if(S)return{ref:m(S)};const y=d[1].defId??d[1].schema.id??`schema${e.counter++}`;return d[1].defId=y,{defId:y,ref:`${m("__shared")}#/${f}/${y}`}}if(d[1]===n)return{ref:"#"};const p=`#/${f}/`,x=d[1].schema.id??`__schema${e.counter++}`;return{defId:x,ref:p+x}},i=d=>{if(d[1].schema.$ref)return;const f=d[1],{ref:h,defId:p}=s(d);f.def={...f.schema},p&&(f.defId=p);const x=f.schema;for(const b in x)delete x[b];x.$ref=h};if(e.cycles==="throw")for(const d of e.seen.entries()){const f=d[1];if(f.cycle)throw new Error(`Cycle detected: #/${(a=f.cycle)==null?void 0:a.join("/")}/<root>
233
+
234
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const f=d[1];if(t===d[0]){i(d);continue}if(e.external){const p=(c=e.external.registry.get(d[0]))==null?void 0:c.id;if(t!==d[0]&&p){i(d);continue}}if((u=e.metadataRegistry.get(d[0]))==null?void 0:u.id){i(d);continue}if(f.cycle){i(d);continue}if(f.count>1&&e.reused==="ref"){i(d);continue}}}function yk(e,t){var a,c,u,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=f=>{const h=e.seen.get(f);if(h.ref===null)return;const p=h.def??h.schema,x={...p},b=h.ref;if(h.ref=null,b){r(b);const m=e.seen.get(b),y=m.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(y)):Object.assign(p,y),Object.assign(p,x),f._zod.parent===b)for(const v in p)v==="$ref"||v==="allOf"||v in x||delete p[v];if(y.$ref&&m.def)for(const v in p)v==="$ref"||v==="allOf"||v in m.def&&JSON.stringify(p[v])===JSON.stringify(m.def[v])&&delete p[v]}const S=f._zod.parent;if(S&&S!==b){r(S);const m=e.seen.get(S);if(m!=null&&m.schema.$ref&&(p.$ref=m.schema.$ref,m.def))for(const y in p)y==="$ref"||y==="allOf"||y in m.def&&JSON.stringify(p[y])===JSON.stringify(m.def[y])&&delete p[y]}e.override({zodSchema:f,jsonSchema:p,path:h.path??[]})};for(const f of[...e.seen.entries()].reverse())r(f[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const f=(c=e.external.registry.get(t))==null?void 0:c.id;if(!f)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(f)}Object.assign(s,n.def??n.schema);const i=(u=e.metadataRegistry.get(t))==null?void 0:u.id;i!==void 0&&s.id===i&&delete s.id;const o=((d=e.external)==null?void 0:d.defs)??{};for(const f of e.seen.entries()){const h=f[1];h.def&&h.defId&&(h.def.id===h.defId&&delete h.def.id,o[h.defId]=h.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const f=JSON.parse(JSON.stringify(s));return Object.defineProperty(f,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ed(t,"input",e.processors),output:Ed(t,"output",e.processors)}},enumerable:!1,writable:!1}),f}catch{throw new Error("Error converting schema to JSON.")}}function Xt(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Xt(r.element,n);if(r.type==="set")return Xt(r.valueType,n);if(r.type==="lazy")return Xt(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Xt(r.innerType,n);if(r.type==="intersection")return Xt(r.left,n)||Xt(r.right,n);if(r.type==="record"||r.type==="map")return Xt(r.keyType,n)||Xt(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Xt(r.in,n)||Xt(r.out,n);if(r.type==="object"){for(const s in r.shape)if(Xt(r.shape[s],n))return!0;return!1}if(r.type==="union"){for(const s of r.options)if(Xt(s,n))return!0;return!1}if(r.type==="tuple"){for(const s of r.items)if(Xt(s,n))return!0;return!!(r.rest&&Xt(r.rest,n))}return!1}const NL=(e,t={})=>n=>{const r=gk({...n,processors:t});return mt(e,r),xk(r,e),yk(r,e)},Ed=(e,t,n={})=>r=>{const{libraryOptions:s,target:i}=r??{},o=gk({...s??{},target:i,io:t,processors:n});return mt(e,o),xk(o,e),yk(o,e)},jL={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},EL=(e,t,n,r)=>{const s=n;s.type="string";const{minimum:i,maximum:o,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(s.minLength=i),typeof o=="number"&&(s.maxLength=o),a&&(s.format=jL[a]??a,s.format===""&&delete s.format,a==="time"&&delete s.format),u&&(s.contentEncoding=u),c&&c.size>0){const d=[...c];d.length===1?s.pattern=d[0].source:d.length>1&&(s.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},TL=(e,t,n,r)=>{const s=n,{minimum:i,maximum:o,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof a=="string"&&a.includes("int")?s.type="integer":s.type="number";const f=typeof d=="number"&&d>=(i??Number.NEGATIVE_INFINITY),h=typeof u=="number"&&u<=(o??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";f?p?(s.minimum=d,s.exclusiveMinimum=!0):s.exclusiveMinimum=d:typeof i=="number"&&(s.minimum=i),h?p?(s.maximum=u,s.exclusiveMaximum=!0):s.exclusiveMaximum=u:typeof o=="number"&&(s.maximum=o),typeof c=="number"&&(s.multipleOf=c)},AL=(e,t,n,r)=>{n.type="boolean"},CL=(e,t,n,r)=>{n.not={}},ML=(e,t,n,r)=>{},zL=(e,t,n,r)=>{const s=e._zod.def,i=F_(s.entries);i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),n.enum=i},DL=(e,t,n,r)=>{const s=e._zod.def,i=[];for(const o of s.values)if(o===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(o))}else i.push(o);if(i.length!==0)if(i.length===1){const o=i[0];n.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[o]:n.const=o}else i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),i.every(o=>typeof o=="boolean")&&(n.type="boolean"),i.every(o=>o===null)&&(n.type="null"),n.enum=i},RL=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},OL=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},$L=(e,t,n,r)=>{const s=n,i=e._zod.def,{minimum:o,maximum:a}=e._zod.bag;typeof o=="number"&&(s.minItems=o),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=mt(i.element,t,{...r,path:[...r.path,"items"]})},LL=(e,t,n,r)=>{var u;const s=n,i=e._zod.def;s.type="object",s.properties={};const o=i.shape;for(const d in o)s.properties[d]=mt(o[d],t,{...r,path:[...r.path,"properties",d]});const a=new Set(Object.keys(o)),c=new Set([...a].filter(d=>{const f=i.shape[d]._zod;return t.io==="input"?f.optin===void 0:f.optout===void 0}));c.size>0&&(s.required=Array.from(c)),((u=i.catchall)==null?void 0:u._zod.def.type)==="never"?s.additionalProperties=!1:i.catchall?i.catchall&&(s.additionalProperties=mt(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},HL=(e,t,n,r)=>{const s=e._zod.def,i=s.inclusive===!1,o=s.options.map((a,c)=>mt(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));i?n.oneOf=o:n.anyOf=o},BL=(e,t,n,r)=>{const s=e._zod.def,i=mt(s.left,t,{...r,path:[...r.path,"allOf",0]}),o=mt(s.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(o)?o.allOf:[o]];n.allOf=c},UL=(e,t,n,r)=>{const s=n,i=e._zod.def;s.type="object";const o=i.keyType,a=o._zod.bag,c=a==null?void 0:a.patterns;if(i.mode==="loose"&&c&&c.size>0){const d=mt(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});s.patternProperties={};for(const f of c)s.patternProperties[f.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=mt(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),s.additionalProperties=mt(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=o._zod.values;if(u){const d=[...u].filter(f=>typeof f=="string"||typeof f=="number");d.length>0&&(s.required=d)}},IL=(e,t,n,r)=>{const s=e._zod.def,i=mt(s.innerType,t,r),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=s.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},ZL=(e,t,n,r)=>{const s=e._zod.def;mt(s.innerType,t,r);const i=t.seen.get(e);i.ref=s.innerType},YL=(e,t,n,r)=>{const s=e._zod.def;mt(s.innerType,t,r);const i=t.seen.get(e);i.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},qL=(e,t,n,r)=>{const s=e._zod.def;mt(s.innerType,t,r);const i=t.seen.get(e);i.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},VL=(e,t,n,r)=>{const s=e._zod.def;mt(s.innerType,t,r);const i=t.seen.get(e);i.ref=s.innerType;let o;try{o=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},GL=(e,t,n,r)=>{const s=e._zod.def,i=s.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?i?s.out:s.in:s.out;mt(o,t,r);const a=t.seen.get(e);a.ref=o},XL=(e,t,n,r)=>{const s=e._zod.def;mt(s.innerType,t,r);const i=t.seen.get(e);i.ref=s.innerType,n.readOnly=!0},vk=(e,t,n,r)=>{const s=e._zod.def;mt(s.innerType,t,r);const i=t.seen.get(e);i.ref=s.innerType},PL=Q("ZodISODateTime",(e,t)=>{F$.init(e,t),st.init(e,t)});function FL(e){return tL(PL,e)}const QL=Q("ZodISODate",(e,t)=>{Q$.init(e,t),st.init(e,t)});function KL(e){return nL(QL,e)}const WL=Q("ZodISOTime",(e,t)=>{K$.init(e,t),st.init(e,t)});function JL(e){return rL(WL,e)}const e9=Q("ZodISODuration",(e,t)=>{W$.init(e,t),st.init(e,t)});function t9(e){return sL(e9,e)}const n9=(e,t)=>{J_.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>I6(e,n)},flatten:{value:n=>U6(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,nm,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,nm,2)}},isEmpty:{get(){return e.issues.length===0}}})},Gn=Q("ZodError",n9,{Parent:Error}),r9=Qg(Gn),s9=Kg(Gn),i9=mf(Gn),o9=gf(Gn),a9=q6(Gn),l9=V6(Gn),c9=G6(Gn),u9=X6(Gn),d9=P6(Gn),f9=F6(Gn),h9=Q6(Gn),p9=K6(Gn),Qv=new WeakMap;function ac(e,t,n){const r=Object.getPrototypeOf(e);let s=Qv.get(r);if(s||(s=new Set,Qv.set(r,s)),!s.has(t)){s.add(t);for(const i in n){const o=n[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){const a=o.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const rt=Q("ZodType",(e,t)=>(nt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ed(e,"input"),output:Ed(e,"output")}}),e.toJSONSchema=NL(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>r9(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>i9(e,n,r),e.parseAsync=async(n,r)=>s9(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>o9(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>a9(e,n,r),e.decode=(n,r)=>l9(e,n,r),e.encodeAsync=async(n,r)=>c9(e,n,r),e.decodeAsync=async(n,r)=>u9(e,n,r),e.safeEncode=(n,r)=>d9(e,n,r),e.safeDecode=(n,r)=>f9(e,n,r),e.safeEncodeAsync=async(n,r)=>h9(e,n,r),e.safeDecodeAsync=async(n,r)=>p9(e,n,r),ac(e,"ZodType",{check(...n){const r=this.def;return this.clone(Js(r,{checks:[...r.checks??[],...n.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return ei(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(a7(n,r))},superRefine(n,r){return this.check(l7(n,r))},overwrite(n){return this.check(ma(n))},optional(){return eb(this)},exactOptional(){return P9(this)},nullable(){return tb(this)},nullish(){return eb(tb(this))},nonoptional(n){return e7(this,n)},array(){return Dr(this)},or(n){return lc([this,n])},and(n){return Y9(this,n)},transform(n){return nb(this,G9(n))},default(n){return K9(this,n)},prefault(n){return J9(this,n)},catch(n){return n7(this,n)},pipe(n){return nb(this,n)},readonly(){return i7(this)},describe(n){const r=this.clone();return qa.add(r,{description:n}),r},meta(...n){if(n.length===0)return qa.get(this);const r=this.clone();return qa.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){var n;return(n=qa.get(e))==null?void 0:n.description},configurable:!0}),e)),bk=Q("_ZodString",(e,t)=>{Wg.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>EL(e,r,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ac(e,"_ZodString",{regex(...r){return this.check(uL(...r))},includes(...r){return this.check(hL(...r))},startsWith(...r){return this.check(pL(...r))},endsWith(...r){return this.check(mL(...r))},min(...r){return this.check(jd(...r))},max(...r){return this.check(pk(...r))},length(...r){return this.check(mk(...r))},nonempty(...r){return this.check(jd(1,...r))},lowercase(r){return this.check(dL(r))},uppercase(r){return this.check(fL(r))},trim(){return this.check(xL())},normalize(...r){return this.check(gL(...r))},toLowerCase(){return this.check(yL())},toUpperCase(){return this.check(vL())},slugify(){return this.check(bL())}})}),m9=Q("ZodString",(e,t)=>{Wg.init(e,t),bk.init(e,t),e.email=n=>e.check(R8(g9,n)),e.url=n=>e.check(B8(x9,n)),e.jwt=n=>e.check(eL(z9,n)),e.emoji=n=>e.check(U8(y9,n)),e.guid=n=>e.check(Gv(Kv,n)),e.uuid=n=>e.check(O8(iu,n)),e.uuidv4=n=>e.check($8(iu,n)),e.uuidv6=n=>e.check(L8(iu,n)),e.uuidv7=n=>e.check(H8(iu,n)),e.nanoid=n=>e.check(I8(v9,n)),e.guid=n=>e.check(Gv(Kv,n)),e.cuid=n=>e.check(Z8(b9,n)),e.cuid2=n=>e.check(Y8(w9,n)),e.ulid=n=>e.check(q8(S9,n)),e.base64=n=>e.check(K8(A9,n)),e.base64url=n=>e.check(W8(C9,n)),e.xid=n=>e.check(V8(_9,n)),e.ksuid=n=>e.check(G8(k9,n)),e.ipv4=n=>e.check(X8(N9,n)),e.ipv6=n=>e.check(P8(j9,n)),e.cidrv4=n=>e.check(F8(E9,n)),e.cidrv6=n=>e.check(Q8(T9,n)),e.e164=n=>e.check(J8(M9,n)),e.datetime=n=>e.check(FL(n)),e.date=n=>e.check(KL(n)),e.time=n=>e.check(JL(n)),e.duration=n=>e.check(t9(n))});function P(e){return D8(m9,e)}const st=Q("ZodStringFormat",(e,t)=>{et.init(e,t),bk.init(e,t)}),g9=Q("ZodEmail",(e,t)=>{U$.init(e,t),st.init(e,t)}),Kv=Q("ZodGUID",(e,t)=>{H$.init(e,t),st.init(e,t)}),iu=Q("ZodUUID",(e,t)=>{B$.init(e,t),st.init(e,t)}),x9=Q("ZodURL",(e,t)=>{I$.init(e,t),st.init(e,t)}),y9=Q("ZodEmoji",(e,t)=>{Z$.init(e,t),st.init(e,t)}),v9=Q("ZodNanoID",(e,t)=>{Y$.init(e,t),st.init(e,t)}),b9=Q("ZodCUID",(e,t)=>{q$.init(e,t),st.init(e,t)}),w9=Q("ZodCUID2",(e,t)=>{V$.init(e,t),st.init(e,t)}),S9=Q("ZodULID",(e,t)=>{G$.init(e,t),st.init(e,t)}),_9=Q("ZodXID",(e,t)=>{X$.init(e,t),st.init(e,t)}),k9=Q("ZodKSUID",(e,t)=>{P$.init(e,t),st.init(e,t)}),N9=Q("ZodIPv4",(e,t)=>{J$.init(e,t),st.init(e,t)}),j9=Q("ZodIPv6",(e,t)=>{e8.init(e,t),st.init(e,t)}),E9=Q("ZodCIDRv4",(e,t)=>{t8.init(e,t),st.init(e,t)}),T9=Q("ZodCIDRv6",(e,t)=>{n8.init(e,t),st.init(e,t)}),A9=Q("ZodBase64",(e,t)=>{r8.init(e,t),st.init(e,t)}),C9=Q("ZodBase64URL",(e,t)=>{i8.init(e,t),st.init(e,t)}),M9=Q("ZodE164",(e,t)=>{o8.init(e,t),st.init(e,t)}),z9=Q("ZodJWT",(e,t)=>{l8.init(e,t),st.init(e,t)}),wk=Q("ZodNumber",(e,t)=>{ck.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>TL(e,r,s),ac(e,"ZodNumber",{gt(r,s){return this.check(Pv(r,s))},gte(r,s){return this.check($h(r,s))},min(r,s){return this.check($h(r,s))},lt(r,s){return this.check(Xv(r,s))},lte(r,s){return this.check(Oh(r,s))},max(r,s){return this.check(Oh(r,s))},int(r){return this.check(Wv(r))},safe(r){return this.check(Wv(r))},positive(r){return this.check(Pv(0,r))},nonnegative(r){return this.check($h(0,r))},negative(r){return this.check(Xv(0,r))},nonpositive(r){return this.check(Oh(0,r))},multipleOf(r,s){return this.check(Fv(r,s))},step(r,s){return this.check(Fv(r,s))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function xe(e){return iL(wk,e)}const D9=Q("ZodNumberFormat",(e,t)=>{c8.init(e,t),wk.init(e,t)});function Wv(e){return oL(D9,e)}const R9=Q("ZodBoolean",(e,t)=>{u8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>AL(e,n,r)});function Jg(e){return aL(R9,e)}const O9=Q("ZodUnknown",(e,t)=>{d8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>ML()});function zn(){return lL(O9)}const $9=Q("ZodNever",(e,t)=>{f8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>CL(e,n,r)});function L9(e){return cL($9,e)}const H9=Q("ZodArray",(e,t)=>{h8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>$L(e,n,r,s),e.element=t.element,ac(e,"ZodArray",{min(n,r){return this.check(jd(n,r))},nonempty(n){return this.check(jd(1,n))},max(n,r){return this.check(pk(n,r))},length(n,r){return this.check(mk(n,r))},unwrap(){return this.element}})});function Dr(e,t){return wL(H9,e,t)}const B9=Q("ZodObject",(e,t)=>{m8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>LL(e,n,r,s),$e(e,"shape",()=>t.shape),ac(e,"ZodObject",{keyof(){return De(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:zn()})},loose(){return this.clone({...this._zod.def,catchall:zn()})},strict(){return this.clone({...this._zod.def,catchall:L9()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return R6(this,n)},safeExtend(n){return O6(this,n)},merge(n){return $6(this,n)},pick(n){return z6(this,n)},omit(n){return D6(this,n)},partial(...n){return L6(_k,this,n[0])},required(...n){return H6(kk,this,n[0])}})});function se(e,t){const n={type:"object",shape:e??{},...de(t)};return new B9(n)}const Sk=Q("ZodUnion",(e,t)=>{fk.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>HL(e,n,r,s),e.options=t.options});function lc(e,t){return new Sk({type:"union",options:e,...de(t)})}const U9=Q("ZodDiscriminatedUnion",(e,t)=>{Sk.init(e,t),g8.init(e,t)});function I9(e,t,n){return new U9({type:"union",options:t,discriminator:e,...de(n)})}const Z9=Q("ZodIntersection",(e,t)=>{x8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>BL(e,n,r,s)});function Y9(e,t){return new Z9({type:"intersection",left:e,right:t})}const Jv=Q("ZodRecord",(e,t)=>{y8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>UL(e,n,r,s),e.keyType=t.keyType,e.valueType=t.valueType});function ga(e,t,n){return!t||!t._zod?new Jv({type:"record",keyType:P(),valueType:e,...de(t)}):new Jv({type:"record",keyType:e,valueType:t,...de(n)})}const sm=Q("ZodEnum",(e,t)=>{v8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>zL(e,r,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,s)=>{const i={};for(const o of r)if(n.has(o))i[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new sm({...t,checks:[],...de(s),entries:i})},e.exclude=(r,s)=>{const i={...t.entries};for(const o of r)if(n.has(o))delete i[o];else throw new Error(`Key ${o} not found in enum`);return new sm({...t,checks:[],...de(s),entries:i})}});function De(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new sm({type:"enum",entries:n,...de(t)})}const q9=Q("ZodLiteral",(e,t)=>{b8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>DL(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Be(e,t){return new q9({type:"literal",values:Array.isArray(e)?e:[e],...de(t)})}const V9=Q("ZodTransform",(e,t)=>{w8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>OL(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new P_(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push($l(i,n.value,t));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=e),n.issues.push($l(o))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(i=>(n.value=i,n.fallback=!0,n)):(n.value=s,n.fallback=!0,n)}});function G9(e){return new V9({type:"transform",transform:e})}const _k=Q("ZodOptional",(e,t)=>{hk.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>vk(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function eb(e){return new _k({type:"optional",innerType:e})}const X9=Q("ZodExactOptional",(e,t)=>{S8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>vk(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function P9(e){return new X9({type:"optional",innerType:e})}const F9=Q("ZodNullable",(e,t)=>{_8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>IL(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function tb(e){return new F9({type:"nullable",innerType:e})}const Q9=Q("ZodDefault",(e,t)=>{k8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>YL(e,n,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function K9(e,t){return new Q9({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():K_(t)}})}const W9=Q("ZodPrefault",(e,t)=>{N8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>qL(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function J9(e,t){return new W9({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():K_(t)}})}const kk=Q("ZodNonOptional",(e,t)=>{j8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>ZL(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function e7(e,t){return new kk({type:"nonoptional",innerType:e,...de(t)})}const t7=Q("ZodCatch",(e,t)=>{E8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>VL(e,n,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function n7(e,t){return new t7({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const r7=Q("ZodPipe",(e,t)=>{T8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>GL(e,n,r,s),e.in=t.in,e.out=t.out});function nb(e,t){return new r7({type:"pipe",in:e,out:t})}const s7=Q("ZodReadonly",(e,t)=>{A8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>XL(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function i7(e){return new s7({type:"readonly",innerType:e})}const o7=Q("ZodCustom",(e,t)=>{C8.init(e,t),rt.init(e,t),e._zod.processJSONSchema=(n,r,s)=>RL(e,n)});function a7(e,t={}){return SL(o7,e,t)}function l7(e,t){return _L(e,t)}const c7=se({type:Be("user-prompt"),id:P(),text:P(),cwd:P(),timestamp:xe()}),u7=se({type:Be("assistant-delta"),id:P(),text:P(),timestamp:xe()}),d7=se({type:Be("assistant-stop"),id:P(),timestamp:xe()}),f7=se({type:Be("tool-call"),id:P(),toolCallId:P(),name:P(),input:ga(P(),zn()),timestamp:xe()}),h7=se({type:Be("tool-result"),id:P(),toolCallId:P(),output:zn(),error:P().optional(),timestamp:xe()}),p7=se({type:Be("approval-request"),id:P(),toolCallId:P(),name:P(),input:ga(P(),zn()),decision:De(["allow","deny","ask"]).optional(),timestamp:xe()}),m7=se({type:Be("approval-decision"),id:P(),toolCallId:P(),decision:De(["allow","deny"]),by:P().optional(),timestamp:xe()}),g7=se({type:Be("usage"),id:P(),inputTokens:xe(),outputTokens:xe(),cacheReadTokens:xe().optional(),cacheWriteTokens:xe().optional(),timestamp:xe()}),x7=se({type:Be("error"),id:P(),message:P(),code:P().optional(),timestamp:xe()}),y7=se({type:Be("session-start"),id:P(),model:P(),provider:P(),cwd:P(),timestamp:xe()}),v7=se({type:Be("session-stop"),id:P(),reason:P(),timestamp:xe()}),b7=se({type:Be("hook"),id:P(),phase:P(),name:P(),result:P().optional(),error:P().optional(),timestamp:xe()}),w7=se({type:Be("status"),id:P(),message:P(),spinner:Jg().optional(),timestamp:xe()}),S7=se({type:Be("session-resumed"),id:P(),turnsRecovered:xe(),timestamp:xe()}),_7=se({type:Be("context-warning"),id:P(),message:P(),timestamp:xe()}),k7=se({type:Be("compaction"),id:P(),summary:P(),summarizedMessageCount:xe(),tokensBefore:xe(),tokensAfter:xe(),timestamp:xe()}),N7=se({type:Be("context-report"),id:P(),model:P(),windowTokens:xe(),usedTokens:xe(),reservedOutput:xe(),breakdown:Dr(se({label:P(),tokens:xe()})),timestamp:xe()}),j7=se({type:Be("cron-task-fired"),id:P(),taskId:P(),taskType:De(["notify","auto"]),message:P(),timestamp:xe()}),E7=se({type:Be("heartbeat-brief"),id:P(),scheduleType:De(["intraday","daily","weekly","monthly","dreaming"]),formattedText:P(),toolCalls:xe(),errors:Dr(P()),timestamp:xe()}),T7=se({type:Be("channel-updated"),id:P(),channelId:P(),channelType:De(["cli","telegram"]),displayName:P(),sessionId:P(),timestamp:xe()}),A7=se({type:Be("mcp-status"),id:P(),serverId:P(),connected:Jg(),tools:Dr(P()),timestamp:xe()}),C7=se({type:Be("daemon-ready"),id:P(),version:P(),timestamp:xe()}),M7=se({type:Be("wiki-op"),id:P(),op:De(["ingest","query","lint","edit"]),pages:Dr(P()),timestamp:xe()});I9("type",[c7,u7,d7,f7,h7,p7,m7,g7,x7,y7,v7,b7,w7,S7,_7,k7,N7,j7,E7,T7,A7,C7,M7]);const z7=se({jsonrpc:Be("2.0"),id:lc([xe(),P()]),method:P(),params:ga(P(),zn()).optional()}),D7=se({jsonrpc:Be("2.0"),method:P(),params:ga(P(),zn()).optional()}),R7=se({jsonrpc:Be("2.0"),id:lc([xe(),P()]),result:zn()}),O7=se({jsonrpc:Be("2.0"),id:lc([xe(),P()]),error:se({code:xe(),message:P(),data:zn().optional()})});lc([z7,D7,R7,O7]);se({});se({id:P()});se({id:P(),text:P()});se({id:P()});se({id:P().optional()});se({});se({paneIds:Dr(P()),text:P()});se({query:P()});se({slug:P()});se({source:P()});se({});se({});se({sessionId:P().optional()});se({toolCallId:P(),decision:De(["allow","deny"])});se({});se({});se({key:P()});se({key:P(),value:zn()});se({});se({});se({type:De(["reminder","heartbeat","task"]).optional(),status:De(["pending","fired","executing","completed","failed","cancelled"]).optional()});se({type:De(["reminder","task"]),message:P(),scheduledAt:xe(),schedule:se({type:De(["intraday","daily","weekly","monthly","dreaming"]),value:P()}).optional()});se({id:P()});se({});se({scheduleType:De(["intraday","daily","weekly","monthly","dreaming"]).optional()});se({});se({});se({channelId:P()});se({});se({});se({provider:P(),apiKey:P(),model:P(),soulName:P(),soulVibe:P(),userName:P(),userTimezone:P(),userLanguages:P()});se({sessionId:P(),prompt:P(),provider:De(["anthropic","openai","google","ollama","openrouter"]).optional(),mode:De(["plan","edit","auto","yolo"]).optional(),effort:De(["low","medium","high","max","auto"]).optional(),model:P().optional(),tools:Dr(P()).optional()});se({sessionId:P().optional(),status:De(["running","completed","error","cancelled"]).optional()});se({agentId:P()});se({agentId:P()});se({agentId:P(),message:P()});se({instruction:P(),scheduled_at:P(),provider:P().optional(),model:P().optional(),effort:De(["low","medium","high","max","auto"]).optional()});se({status:De(["backlog","todo","in_progress","done","canceled","pending","executing","completed","failed"]).optional(),mode:De(["human","agent","notify"]).optional(),scope:De(["personal","project"]).optional(),priority:De(["low","medium","high","critical"]).optional()});se({title:P(),description:P().default(""),mode:De(["human","agent","notify"]).default("human"),scope:De(["personal","project"]).default("personal"),priority:De(["low","medium","high","critical"]).default("medium"),tags:Dr(P()).default([]),status:De(["backlog","todo","in_progress","done","canceled","pending","executing","completed","failed"]).optional(),scheduled_at:xe().optional()});se({id:P(),status:De(["backlog","todo","in_progress","done","canceled","pending","executing","completed","failed"]).optional(),priority:De(["low","medium","high","critical"]).optional(),title:P().optional(),description:P().optional(),tags:Dr(P()).optional(),mode:De(["human","agent","notify"]).optional(),scope:De(["personal","project"]).optional(),scheduled_at:xe().optional()});se({id:P()});const $7=[{name:"status",description:"Show version, model, and account info",usage:"/status",category:"General",handler:"daemon"},{name:"help",description:"Show all available commands",usage:"/help",category:"General",handler:"daemon"},{name:"system",description:"Show OS, platform, Node version, and PathGuard status",usage:"/system",category:"General",handler:"daemon"},{name:"init",description:"Run the setup wizard",usage:"/init",category:"General",handler:"client"},{name:"exit",description:"Exit curie-agent",usage:"/exit",category:"General",handler:"client",aliases:["quit"]},{name:"provider",description:"Switch AI provider",usage:"/provider <anthropic|openai|google|local|ollama|openrouter>",category:"Model & Provider",handler:"daemon"},{name:"model",description:"Switch AI model, set pricing or context window",usage:"/model <model|pricing in;out|window tokens>",category:"Model & Provider",handler:"daemon"},{name:"effort",description:"Set reasoning effort level",usage:"/effort <low|medium|high|max|auto>",category:"Model & Provider",handler:"daemon"},{name:"mode",description:"Set approval mode",usage:"/mode <plan|edit|auto|yolo>",category:"Model & Provider",handler:"daemon"},{name:"theme",description:"Change color theme",usage:"/theme <name>",category:"Display",handler:"client"},{name:"debug",description:"Toggle debug logging",usage:"/debug [on|off]",category:"Display",handler:"client"},{name:"statusline",description:"Toggle status line display",usage:"/statusline [on|off]",category:"Display",handler:"client"},{name:"memory",description:"View memory file sizes or capture a memory",usage:"/memory [status|add <text>]",category:"Knowledge",handler:"daemon"},{name:"todo",description:"Manage tasks in tasks.json",usage:"/todo <list|add|complete|remove>",category:"Knowledge",handler:"daemon"},{name:"stats",description:"Daily usage, sessions, streaks",usage:"/stats",category:"Knowledge",handler:"client"},{name:"context",description:"Context window usage breakdown, compaction, auto-compaction settings",usage:"/context [messages|compact|auto [on|off|threshold N|warn N|forced N|pricing on/off]]",category:"Knowledge",handler:"daemon"},{name:"wiki",description:"Open the wiki tab or run a wiki operation",usage:"/wiki [list|search <query>|lint|status]",category:"Knowledge",handler:"client"},{name:"remind",description:"Create a reminder",usage:"/remind <message at time>",category:"Automation",handler:"daemon"},{name:"cron",description:"Manage reminders",usage:"/cron <list|delete <id>|clear>",category:"Automation",handler:"daemon"},{name:"task",description:"Schedule an agent task",usage:"/task <create|list|delete>",category:"Automation",handler:"daemon"},{name:"heartbeat",description:"Manage heartbeat cycle",usage:"/heartbeat <status|enable|disable|intraday|daily|weekly|monthly|dreaming|now>",category:"Automation",handler:"daemon"},{name:"agent",description:"Launch external AI agent",usage:"/agent <prompt>",category:"Tools",handler:"daemon"},{name:"tools",description:"View/set tool call limits per turn",usage:"/tools [tools_per_call [websearch_per_call]]",category:"Tools",handler:"daemon"},{name:"websearch",description:"View/set web search+fetch limit per turn",usage:"/websearch [count]",category:"Tools",handler:"daemon"},{name:"mcp",description:"Manage MCP server connections",usage:"/mcp <list|reload>",category:"Tools",handler:"daemon"},{name:"skill",description:"List or show available skills",usage:"/skill [name]",category:"Tools",handler:"daemon"},{name:"channels",description:"Manage Telegram channel config",usage:"/channels <list|switch <id>|set-bot-token <t>|set-user-id <id>|set-chat-id <id>|disconnect>",category:"Communication",handler:"client"},{name:"cd",description:"Change working directory with safety checks",usage:"/cd <path>",category:"Safety",handler:"daemon"},{name:"snapshots",description:"List recent git snapshots for recovery",usage:"/snapshots",category:"Safety",handler:"daemon"},{name:"revert",description:"Revert to a git snapshot (index, default: most recent)",usage:"/revert [index]",category:"Safety",handler:"daemon"}],L7=se({type:Be("object"),properties:ga(P(),zn()),required:Dr(P()).optional(),additionalProperties:Jg().optional()});se({name:P(),description:P(),inputSchema:L7});se({id:P(),name:P(),input:ga(P(),zn())});se({id:P(),output:zn(),error:P().optional()});const H7=new Set(["wiki"]),rb=$7.filter(e=>e.handler==="daemon"||H7.has(e.name)).map(e=>[e.usage||`/${e.name}`,e.description]);function B7({open:e,onClose:t,onPick:n}){const[r,s]=w.useState(""),[i,o]=w.useState(0),a=w.useRef(null),c=r?rb.filter(([f,h])=>f.includes(r.toLowerCase())||h.toLowerCase().includes(r.toLowerCase())):rb,u=w.useCallback(f=>{t(),n(f)},[t,n]);w.useEffect(()=>{e&&(s(""),o(0),setTimeout(()=>{var f;return(f=a.current)==null?void 0:f.focus()},50))},[e]);const d=w.useCallback(f=>{if(f.key==="Escape"){t();return}f.key==="ArrowDown"&&(o(h=>Math.min(h+1,c.length-1)),f.preventDefault()),f.key==="ArrowUp"&&(o(h=>Math.max(h-1,0)),f.preventDefault()),f.key==="Enter"&&c[i]&&u(c[i][0])},[c,i,t,u]);return e?l.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:l.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:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-3",style:{borderBottom:"1px solid var(--b1)"},children:[l.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:[l.jsx("circle",{cx:"11",cy:"11",r:"8"}),l.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),l.jsx("input",{ref:a,className:"flex-1 bg-transparent border-0 outline-none font-sans text-sm",style:{color:"var(--cream)"},placeholder:"Search commands...",value:r,onChange:f=>{s(f.target.value),o(0)},onKeyDown:d})]}),l.jsx("div",{className:"gold-divider"}),l.jsxs("div",{className:"max-h-[340px] overflow-y-auto py-1 scrollbar-thin",children:[c.map(([f,h],p)=>l.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===i?"var(--s3)":"transparent",borderLeft:p===i?"2px solid var(--gold)":"2px solid transparent"},onClick:()=>u(f),children:[l.jsx("span",{className:"font-mono text-[12.5px] min-w-[190px]",style:{color:p===i?"var(--gold)":"var(--text)"},children:f}),l.jsx("span",{className:"text-xs text-muted truncate",children:h})]},f)),c.length===0&&l.jsx("div",{className:"px-3 py-6 text-center text-muted text-sm",children:"No commands found"})]})]})}):null}const Wi={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 U7({rpc:e,onComplete:t,className:n}){const[r,s]=w.useState("provider"),[i,o]=w.useState(null),[a,c]=w.useState(""),[u,d]=w.useState(""),[f,h]=w.useState(""),[p,x]=w.useState(""),[b,S]=w.useState(""),[m,y]=w.useState(""),[g,v]=w.useState(""),[N,k]=w.useState(!1),[T,z]=w.useState(null),A=w.useCallback(()=>{switch(z(null),r){case"provider":{if(!i)return;const _=Wi[i];d(_.defaultModel),s(_.requiresKey?"api_key":"model");break}case"api_key":s("model");break;case"model":s("soul_name");break;case"soul_name":if(!f.trim())return;s("soul_vibe");break;case"soul_vibe":s("user_name");break;case"user_name":if(!b.trim())return;s("user_tz");break;case"user_tz":s("user_lang");break;case"user_lang":s("agents");break;case"agents":s("memory");break;case"memory":s("tools");break;case"tools":s("confirm");break}},[r,i,f,b]),L=w.useCallback(async()=>{if(!(!e||!i)){k(!0),z(null);try{await e.identitySetup({provider:i,apiKey:a,model:u,soulName:f.trim()||"Curie",soulVibe:p.trim()||"AI coding assistant — sharp, resourceful, gets things done",userName:b.trim()||"User",userTimezone:m.trim()||"UTC",userLanguages:g.trim()||"TypeScript, Python"}),t()}catch(_){z(_ instanceof Error?_.message:"Setup failed")}finally{k(!1)}}},[e,i,a,u,f,p,b,m,g,t]),R=()=>{switch(r){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"}},H=()=>(["provider","api_key","model","soul_name","soul_vibe","user_name","user_tz","user_lang","agents","memory","tools","confirm"].indexOf(r)+1)/12,Y=()=>{switch(r){case"provider":return l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-xs text-muted mb-4",children:"Which LLM provider do you want to use for your AI assistant?"}),l.jsx("div",{className:"grid grid-cols-1 gap-2",children:Object.entries(Wi).map(([_,C])=>l.jsxs("button",{type:"button",onClick:()=>o(_),className:`flex items-center gap-3 px-4 py-3 rounded-xl border text-left transition-all duration-100 ${i===_?"border-blue-500 bg-blue-500/10 text-text":"border-b2 bg-s2 text-text hover:border-b3 hover:bg-s2/80"}`,children:[l.jsx("div",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${i===_?"border-blue-500":"border-b3"}`,children:i===_&&l.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs font-medium text-text",children:C.label}),l.jsxs("div",{className:"text-[10.5px] text-muted",children:["Model: ",C.defaultModel]})]})]},_))})]});case"api_key":{const _=Wi[i];return l.jsxs("div",{className:"space-y-3",children:[l.jsxs("p",{className:"text-xs text-muted",children:["Enter your ",_.label," API key:"]}),l.jsx("input",{type:"password",value:a,onChange:C=>c(C.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}),l.jsx("p",{className:"text-[10px] text-muted",children:"Saved to ~/.curie-settings.json"})]})}case"model":{const _=Wi[i];return l.jsxs("div",{className:"space-y-3",children:[l.jsxs("p",{className:"text-xs text-muted",children:["Suggested model: ",l.jsx("code",{className:"text-text font-mono",children:_.defaultModel})]}),l.jsx("input",{type:"text",value:u,onChange:C=>d(C.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 l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-xs text-muted",children:"What should your AI assistant's name be?"}),l.jsx("input",{type:"text",value:f,onChange:_=>h(_.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 l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-xs text-muted",children:"Describe your assistant's vibe/personality (1 sentence)."}),l.jsx("input",{type:"text",value:p,onChange:_=>x(_.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 l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-xs text-muted",children:"What is your name?"}),l.jsx("input",{type:"text",value:b,onChange:_=>S(_.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 l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-xs text-muted",children:"Your timezone?"}),l.jsx("input",{type:"text",value:m,onChange:_=>y(_.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 l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-xs text-muted",children:"Your primary programming languages?"}),l.jsx("input",{type:"text",value:g,onChange:_=>v(_.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 l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-xs text-muted",children:"Next: I'll create your workspace configuration files."}),l.jsxs("div",{className:"p-3 bg-s2 border border-b1 rounded-xl text-[10.5px] text-text leading-relaxed",children:[l.jsx("p",{className:"font-medium mb-1",children:"AGENTS.md will include:"}),l.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-muted",children:[l.jsx("li",{children:"Session startup instructions"}),l.jsx("li",{children:"Memory system (daily notes + long-term)"}),l.jsx("li",{children:"Coding agent capabilities"}),l.jsx("li",{children:"Red lines and safety boundaries"}),l.jsx("li",{children:"Heartbeat configuration"})]})]})]});case"memory":return l.jsx("div",{className:"space-y-3",children:l.jsx("div",{className:"p-3 bg-s2 border border-b1 rounded-xl text-xs text-text leading-relaxed",children:l.jsx("p",{children:"Auto-creating MEMORY.md with initialization entry..."})})});case"tools":return l.jsx("div",{className:"space-y-3",children:l.jsx("div",{className:"p-3 bg-s2 border border-b1 rounded-xl text-xs text-text leading-relaxed",children:l.jsx("p",{children:"Auto-creating TOOLS.md and HEARTBEAT.md..."})})});case"confirm":return l.jsxs("div",{className:"space-y-4",children:[l.jsx("p",{className:"text-xs text-muted",children:"Review your configuration before creating files:"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(_s,{label:"Provider",value:Wi[i].label}),l.jsx(_s,{label:"Model",value:u}),l.jsx(_s,{label:"API Key",value:a?"[set]":"(not set)"}),l.jsx(_s,{label:"Assistant Name",value:f.trim()||"Curie"}),l.jsx(_s,{label:"Vibe",value:p.trim()||"AI coding assistant"}),l.jsx(_s,{label:"Your Name",value:b.trim()||"User"}),l.jsx(_s,{label:"Timezone",value:m.trim()||"UTC"}),l.jsx(_s,{label:"Languages",value:g.trim()||"TypeScript, Python"})]}),l.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:",l.jsxs("ul",{className:"list-disc list-inside mt-1",children:[l.jsx("li",{children:"~/.curie-agent/SOUL.md"}),l.jsx("li",{children:"~/.curie-agent/USER.md"}),l.jsx("li",{children:"~/.curie-agent/AGENTS.md"}),l.jsx("li",{children:"~/.curie-agent/MEMORY.md"}),l.jsx("li",{children:"~/.curie-agent/TOOLS.md"}),l.jsx("li",{children:"~/.curie-agent/HEARTBEAT.md"})]})]})]})}};return l.jsx("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin flex flex-col ${n||""}`,children:l.jsxs("div",{className:"max-w-lg mx-auto w-full",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight mb-1",children:"Setup Wizard"}),l.jsx("p",{className:"text-[11px] text-muted",children:"Configure your AI assistant — takes about 2 minutes"})]}),l.jsx("div",{className:"mb-5",children:l.jsx("div",{className:"h-1 bg-b2 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full bg-blue-500 rounded-full transition-all duration-300",style:{width:`${H()*100}%`}})})}),l.jsx("h3",{className:"text-sm font-medium text-text mb-4",children:R()}),l.jsx("div",{className:"mb-6",children:Y()}),T&&l.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:[l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),l.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),l.jsx("span",{children:T})]}),l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r!=="provider"&&r!=="confirm"?l.jsxs("button",{type:"button",onClick:()=>{switch(z(null),r){case"api_key":s("provider");break;case"model":s(Wi[i].requiresKey?"api_key":"provider");break;case"soul_name":s("provider");break;case"soul_vibe":s("soul_name");break;case"user_name":s("soul_vibe");break;case"user_tz":s("user_name");break;case"user_lang":s("user_tz");break;case"agents":s("user_lang");break;case"memory":s("agents");break;case"tools":s("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:[l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:l.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back"]}):l.jsx("div",{}),r==="confirm"?l.jsx("button",{type:"button",onClick:L,disabled:N,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:N?l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:"animate-spin h-3.5 w-3.5 text-white",fill:"none",viewBox:"0 0 24 24",children:[l.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),l.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"}):l.jsxs("button",{type:"button",onClick:A,disabled:r==="provider"&&!i||r==="soul_name"&&!f.trim()||r==="user_name"&&!b.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",l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[l.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),l.jsx("polyline",{points:"12 5 19 12 12 19"})]})]})]})]})})}function _s({label:e,value:t}){return l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-b1/50",children:[l.jsx("span",{className:"text-[10.5px] text-muted",children:e}),l.jsx("span",{className:"text-[10.5px] text-text font-mono",children:t})]})}function I7({onReload:e}){const[t,n]=w.useState(!1);w.useEffect(()=>{const s=()=>n(!0),i=()=>{n(!1),e==null||e()};return window.addEventListener("pwa-update-available",s),window.addEventListener("pwa-controller-updated",i),()=>{window.removeEventListener("pwa-update-available",s),window.removeEventListener("pwa-controller-updated",i)}},[e]);const r=()=>{n(!1),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(s=>{s.waiting&&s.waiting.postMessage("SKIP_WAITING")}),window._pendingUpdateWorker&&window._pendingUpdateWorker.postMessage("SKIP_WAITING")};return t?l.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:[l.jsxs("svg",{className:"animate-bounce shrink-0",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[l.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),l.jsx("polyline",{points:"17 8 12 3 7 8"}),l.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),"Update available",l.jsx("button",{onClick:r,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 Z7="0.2.4";function Y7({intervalMs:e=3*60*1e3,onNewVersion:t}){const[n,r]=w.useState(!1);return w.useEffect(()=>{async function s(){var o;try{const c=await(await fetch("/health?token="+encodeURIComponent(((o=document.cookie.match(/curie_token=([^;]*)/))==null?void 0:o[1])??""),{cache:"no-store"})).json();c.version&&c.version!==Z7&&!n&&(r(!0),t==null||t(c.version),window.dispatchEvent(new CustomEvent("pwa-version-update")))}catch{}}s();const i=setInterval(s,e);return()=>clearInterval(i)},[e,n,t]),null}function q7(){const{rpc:e,ws:t}=fr(),[n,r]=w.useState([]),s=w.useCallback(()=>{e&&e.sessionList().then(i=>{Array.isArray(i)&&r(i)}).catch(()=>{})},[e]);return w.useEffect(()=>{s()},[s]),w.useEffect(()=>{if(!t)return;const i=["user-prompt","assistant-stop","error","session-start","session-resumed"],o=[];for(const a of i)o.push(t.on(a,s));return()=>{for(const a of o)a()}},[t,s]),{sessions:n,refetch:s}}function V7(e){const{rpc:t,ws:n}=fr(),[r,s]=w.useState(null),[i,o]=w.useState([]),[a,c]=w.useState(!1),[u,d]=w.useState(null);w.useEffect(()=>{if(!t||!e){s(null),o([]),c(!1);return}c(!0),t.sessionGet(e).then(h=>{h!=null&&h.info&&s(h.info),h!=null&&h.events&&o(h.events)}).catch(()=>{}).finally(()=>c(!1))},[t,e]),w.useEffect(()=>{if(!n||!e)return;const h=b=>{if(b.type!=="heartbeat-brief"&&b.type!=="cron-task-fired"){const S=b.sessionId||b.id;if(S&&S!==e)return}o(S=>S.slice(-10).some(y=>y.timestamp===b.timestamp&&y.type===b.type&&JSON.stringify(y)===JSON.stringify(b))?S:[...S,b])},p=[],x=["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","compaction"];for(const b of x)p.push(n.on(b,h));return p.push(n.on("context-report",b=>{const S=b.sessionId;S&&S!==e||d({model:String(b.model??""),windowTokens:Number(b.windowTokens??0),usedTokens:Number(b.usedTokens??0),reservedOutput:Number(b.reservedOutput??0),breakdown:b.breakdown??[]})})),()=>{for(const b of p)b()}},[n,e]);const f=w.useCallback(h=>{o(p=>[...p,h])},[]);return{info:r,events:i,loading:a,addLiveEvent:f,contextReport:u}}function G7({onAuthorize:e}){const[t,n]=w.useState(""),[r,s]=w.useState(!1),[i,o]=w.useState(null),a=async c=>{if(c.preventDefault(),!!t.trim()){s(!0),o(null);try{(await fetch("/health",{headers:{Authorization:`Bearer ${t.trim()}`}})).ok?e(t.trim()):o("Invalid Access Token. Please verify and try again.")}catch{o("Cannot connect to Curie Daemon. Make sure the daemon is running.")}finally{s(!1)}}};return l.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:[l.jsx("div",{className:"absolute top-[-20%] left-[-20%] w-[60%] h-[60%] rounded-full opacity-30 blur-[120px] pointer-events-none",style:{background:"#2d1f0e"}}),l.jsx("div",{className:"absolute bottom-[-20%] right-[-20%] w-[60%] h-[60%] rounded-full opacity-25 blur-[120px] pointer-events-none",style:{background:"#1e1408"}}),l.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%)"}}),l.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:[l.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px] rounded-t-2xl",style:{background:"linear-gradient(90deg, transparent, #d4a54a, transparent)"}}),l.jsxs("div",{className:"flex flex-col items-center gap-3 mb-6 mt-2",children:[l.jsxs("div",{className:"relative group",children:[l.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)"}}),l.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)"}})]}),l.jsxs("div",{className:"text-center mt-1",children:[l.jsx("span",{className:"text-xl font-display font-bold gold-shimmer block",children:"curie-agent"}),l.jsx("span",{className:"text-[10px] font-mono block mt-0.5",style:{color:"#d4a54a",opacity:.6},children:"v0.2.4"})]})]}),l.jsxs("div",{className:"text-center mb-6",children:[l.jsx("h2",{className:"text-sm font-semibold mb-2",style:{color:"#f5e6d0"},children:"Authorize this device"}),l.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."})]}),l.jsxs("form",{onSubmit:a,className:"w-full space-y-4",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-wider block ml-1",style:{color:"#d4a54a",opacity:.7},children:"Daemon Access Token"}),l.jsxs("div",{className:"relative group",children:[l.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:l.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:l.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"})})}),l.jsx("input",{type:"password",required:!0,placeholder:"Paste your daemon.token...",value:t,onChange:c=>n(c.target.value),disabled:r,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"}})]})]}),i&&l.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:[l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),l.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),l.jsx("span",{children:i})]}),l.jsx("button",{type:"submit",disabled:r||!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:r?l.jsxs(l.Fragment,{children:[l.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..."]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"Authorize & Connect"}),l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[l.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),l.jsx("polyline",{points:"12 5 19 12 12 19"})]})]})})]}),l.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:[l.jsx("div",{className:"font-semibold",style:{color:"#bfae94"},children:"Where is my token?"}),l.jsx("p",{children:"When starting the daemon, look for the console output in your terminal. It displays the dashboard link containing the secure token."}),l.jsxs("p",{children:["You can also find the raw token inside the file ",l.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 X7=["plan","edit","auto","yolo"],P7=[{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 F7(){const{rpc:e,connected:t,token:n,setToken:r}=fr(),{get:s,set:i,providers:o}=og(),[a,c]=w.useState("assistant"),u=s("mode")||"auto",[d,f]=w.useState(!1),[h,p]=w.useState(""),[x,b]=w.useState(null),[S,m]=w.useState(!1),[y,g]=w.useState(null),[v,N]=w.useState(navigator.onLine),[k,T]=w.useState(!1),[z,A]=w.useState(!1),[L,R]=w.useState(!1),[H,Y]=w.useState(!1),_=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;w.useEffect(()=>{const G=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone===!0;T(!!G)},[]),w.useEffect(()=>{const G=ie=>{ie.preventDefault(),g(ie)},te=()=>N(!0),le=()=>N(!1);return window.addEventListener("beforeinstallprompt",G),window.addEventListener("online",te),window.addEventListener("offline",le),()=>{window.removeEventListener("beforeinstallprompt",G),window.removeEventListener("online",te),window.removeEventListener("offline",le)}},[]);const C=async()=>{if(y){y.prompt();const{outcome:G}=await y.userChoice;console.log(`PWA install prompt choice: ${G}`),g(null)}else A(!0)},{sessions:j,refetch:D}=q7(),{events:O,addLiveEvent:$,contextReport:U}=V7(x),X=s("theme")||"curie";w.useEffect(()=>{document.documentElement.setAttribute("data-theme",X)},[X]),w.useEffect(()=>{const G=()=>m(window.innerWidth<768);return G(),window.addEventListener("resize",G),()=>window.removeEventListener("resize",G)},[]),w.useEffect(()=>{!t||!e||e.configGet("current_provider").then(G=>{G||R(!0)}).catch(()=>{})},[t,e]);const Z=w.useCallback(()=>{b(null)},[]),B=w.useCallback(G=>{b(G)},[]),E=w.useCallback(G=>{b(G),c("assistant")},[]),q=w.useCallback(G=>{b(G),D()},[D]);w.useEffect(()=>{const G=te=>{(te.metaKey||te.ctrlKey)&&te.key==="k"&&(te.preventDefault(),f(!0))};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[]);const V=w.useCallback(G=>{p(G),f(!1)},[]),J=w.useCallback(()=>{p("")},[]),F=(G,te=18)=>l.jsx("svg",{width:te,height:te,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:l.jsx("path",{d:G.icon})});return n?l.jsxs("div",{className:"flex h-dvh w-screen flex-col overflow-hidden bg-bg coffee-pattern",children:[!v&&l.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:[l.jsxs("svg",{className:"animate-pulse shrink-0",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[l.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"}),l.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),l.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),"Offline Mode — Curie is running on cached local client"]}),l.jsx(I7,{}),l.jsx(Y7,{}),l.jsxs("main",{className:"flex flex-1 flex-col overflow-hidden bg-bg",children:[l.jsxs("div",{className:"topbar-wood flex h-12 items-center gap-3 px-4 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsxs("button",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg transition-all duration-150",style:{color:H?"var(--fg)":"var(--muted)",background:H?"var(--s3)":"transparent",border:H?"1px solid var(--b1)":"1px solid transparent"},onClick:()=>Y(!0),title:"Sessions",children:[l.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:l.jsx("path",{d:"M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"})}),j.length>0&&l.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:j.length>99?"99+":j.length})]}),l.jsx("div",{className:"w-px h-5 bg-b1 mx-0.5"}),P7.map(G=>l.jsx("button",{className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all duration-150 cursor-pointer",style:{color:a===G.view?"var(--gold)":"var(--muted)",background:a===G.view?"var(--s3)":"transparent",border:a===G.view?"1px solid var(--b1)":"1px solid transparent"},onClick:()=>c(G.view),title:G.label,children:F(G,18)},G.view))]}),l.jsx("div",{className:"flex-1"}),window.innerWidth>=640&&l.jsx("div",{className:"flex rounded-lg overflow-hidden",style:{border:"1px solid var(--b2)",background:"var(--bg)"},children:X7.map(G=>l.jsx("button",{className:"px-2.5 py-1 text-xs cursor-pointer transition-all duration-150 font-mono select-none",style:{color:u===G?"var(--gold)":"var(--muted)",background:u===G?"var(--s3)":"transparent",borderRight:"1px solid var(--b1)"},onClick:()=>i("mode",G),children:G},G))}),(y||S&&!k)&&l.jsxs("button",{onClick:C,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:[l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[l.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),l.jsx("polyline",{points:"7 10 12 15 17 10"}),l.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),!S&&l.jsx(l.Fragment,{children:"Install"})]}),l.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:[l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[l.jsx("circle",{cx:"11",cy:"11",r:"8"}),l.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),!S&&l.jsx(l.Fragment,{children:"Ctrl+k"})]})]}),l.jsxs("div",{className:"relative flex-1 min-h-0",children:[L&&e?l.jsx(U7,{rpc:e,onComplete:()=>R(!1),className:"absolute inset-0"}):a==="assistant"&&l.jsx(EA,{contextReport:U,cmdResult:h,onClearCmdResult:J,rpc:e,className:"absolute inset-0",activeSessionId:x,onCreateSession:q,events:O,addLiveEvent:$,onSwitchView:G=>c(G)}),a==="channels"&&l.jsx(TA,{rpc:e,className:"absolute inset-0"}),a==="stats"&&l.jsx(AA,{rpc:e,className:"absolute inset-0"}),a==="projects"&&l.jsx(CA,{rpc:e,className:"absolute inset-0"}),a==="agents"&&l.jsx(UA,{rpc:e,onOpenSession:E,className:"absolute inset-0"}),a==="kanban"&&l.jsx(UC,{rpc:e,className:"absolute inset-0"}),a==="wiki"&&l.jsx(p6,{rpc:e,className:"absolute inset-0"}),a==="settings"&&l.jsx(_6,{rpc:e,className:"absolute inset-0"})]})]}),l.jsx(B7,{open:d,onClose:()=>f(!1),onPick:V}),H&&l.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:()=>Y(!1),children:l.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:G=>G.stopPropagation(),children:[l.jsx("div",{className:"flex justify-center pt-3 pb-1 shrink-0",children:l.jsx("div",{className:"w-8 h-1 rounded-full",style:{background:"var(--gold)",opacity:.3}})}),l.jsxs("div",{className:"flex items-center justify-between px-4 pb-3 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:[l.jsx("span",{className:"text-[13px] font-display font-semibold",style:{color:"var(--cream)"},children:"Sessions"}),l.jsx("button",{onClick:()=>Y(!1),className:"text-muted hover:text-fg transition-colors duration-100 p-1",children:l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),l.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:l.jsxs("button",{onClick:()=>{Z(),Y(!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:[l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),l.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),l.jsx("span",{className:"text-[12.5px] font-semibold",children:"New Chat"})]})}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4 scrollbar-thin",children:[j.sort((G,te)=>te.updatedAt-G.updatedAt).map(G=>l.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:G.id===x?"linear-gradient(135deg, var(--s3) 0%, var(--s2) 100%)":"transparent",border:G.id===x?"1px solid var(--b2)":"1px solid transparent"},onClick:()=>{B(G.id),Y(!1)},children:l.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[l.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:G.id===x?"var(--gold)":"transparent",boxShadow:G.id===x?"0 0 4px var(--gold)":"none"}}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[12.5px] font-medium text-fg truncate",children:G.name||G.provider}),l.jsxs("div",{className:"text-[11px] text-muted",children:[G.provider," · ",(()=>{const te=Date.now()-G.updatedAt;return te<6e4?"just now":te<36e5?`${Math.floor(te/6e4)}m ago`:te<864e5?`${Math.floor(te/36e5)}h ago`:`${Math.floor(te/864e5)}d ago`})()]})]}),G.type&&G.type!=="webui"&&l.jsx("span",{className:"text-[9px] font-mono text-muted bg-s2 px-1.5 py-0.5 rounded shrink-0",children:G.type})]})},G.id)),j.length===0&&l.jsx("div",{className:"text-center py-8 text-xs text-muted",children:"No sessions yet"})]}),x&&l.jsx("div",{className:"border-t border-b1 px-4 py-3 shrink-0",children:(()=>{var W;const G=O.filter(ge=>ge.type==="usage"),te=G.reduce((ge,Ue)=>ge+(Ue.inputTokens||0)+(Ue.outputTokens||0),0),le=G[G.length-1],ie=le&&le.inputTokens||0,ce=s("current_provider")||"anthropic",oe=(W=o.find(ge=>ge.name===ce))==null?void 0:W.model_cost,he=s("model")||"sonnet",re=G.reduce((ge,Ue)=>ge+T2(he,Ue.inputTokens||0,Ue.outputTokens||0,oe),0);return l.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-[9px] text-muted2 uppercase tracking-wider font-mono",children:"Tokens"}),l.jsx("div",{className:"text-[12px] text-fg font-mono font-semibold",children:Sn(te)})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-[9px] text-muted2 uppercase tracking-wider font-mono",children:"Context"}),l.jsx("div",{className:"text-[12px] text-fg font-mono font-semibold",children:Sn(ie)})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-[9px] text-muted2 uppercase tracking-wider font-mono",children:"Cost"}),l.jsxs("div",{className:"text-[12px] text-green font-mono font-semibold",children:["$",re.toFixed(4)]})]})]})})()})]})}),z&&l.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:l.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:[l.jsxs("div",{className:"flex items-center justify-between pb-3 mb-4",style:{borderBottom:"1px solid var(--b1)"},children:[l.jsx("span",{className:"font-bold text-[13.5px] font-display",style:{color:"var(--cream)"},children:"Install Curie Agent"}),l.jsx("button",{onClick:()=>A(!1),className:"text-muted hover:text-fg transition-colors duration-100 cursor-pointer",children:l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),l.jsx("div",{className:"space-y-3.5 text-xs text-text leading-relaxed",children:_?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-[12px] text-muted mb-1 px-0.5",children:"Follow these simple steps to add Curie to your home screen:"}),l.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:[l.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:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:l.jsx("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8M16 6l-4-4-4 4M12 2v13"})})}),l.jsxs("div",{children:[l.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"1. Tap the Share Button"}),l.jsx("span",{className:"text-[11px] text-muted",children:"Tap the Share icon in Safari's bottom toolbar."})]})]}),l.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:[l.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:"+"}),l.jsxs("div",{children:[l.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"2. Add to Home Screen"}),l.jsxs("span",{className:"text-[11px] text-muted",children:["Scroll down and select ",l.jsx("strong",{children:"Add to Home Screen"}),"."]})]})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-[12px] text-muted mb-1 px-0.5",children:"Follow these simple steps to add Curie to your home screen:"}),l.jsxs("div",{className:"flex gap-3 items-start bg-s1/50 border border-b1 p-3 rounded-xl",children:[l.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-lg bg-blue-500/10 text-blue-400 shrink-0",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[l.jsx("circle",{cx:"12",cy:"12",r:"1"}),l.jsx("circle",{cx:"12",cy:"5",r:"1"}),l.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),l.jsxs("div",{children:[l.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"1. Open Browser Menu"}),l.jsx("span",{className:"text-[11px] text-muted",children:"Tap the menu icon (three dots) in the top-right corner."})]})]}),l.jsxs("div",{className:"flex gap-3 items-start bg-s1/50 border border-b1 p-3 rounded-xl",children:[l.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-lg bg-blue-500/10 text-blue-400 shrink-0",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[l.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),l.jsx("polyline",{points:"7 10 12 15 17 10"}),l.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}),l.jsxs("div",{children:[l.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"2. Select Add / Install"}),l.jsxs("span",{className:"text-[11px] text-muted",children:["Tap ",l.jsx("strong",{children:"Add to Home screen"})," or ",l.jsx("strong",{children:"Install app"}),"."]})]})]})]})}),l.jsx("button",{onClick:()=>A(!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"})]})})]}):l.jsx(G7,{onAuthorize:r})}function Q7(){return l.jsx(AE,{children:l.jsx(F7,{})})}const K7=NE.createRoot(document.getElementById("root"));K7.render(l.jsx(Xe.StrictMode,{children:l.jsx(Q7,{})}));"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))});