@exellix/jobs-ui 2.0.3 → 2.0.5

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,61 @@
1
+ var Yb=Object.defineProperty;var Vy=a=>{throw TypeError(a)};var Pb=(a,s,r)=>s in a?Yb(a,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[s]=r;var Jy=(a,s,r)=>Pb(a,typeof s!="symbol"?s+"":s,r),zd=(a,s,r)=>s.has(a)||Vy("Cannot "+r);var R=(a,s,r)=>(zd(a,s,"read from private field"),r?r.call(a):s.get(a)),ge=(a,s,r)=>s.has(a)?Vy("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(a):s.set(a,r),ie=(a,s,r,c)=>(zd(a,s,"write to private field"),c?c.call(a,r):s.set(a,r),r),Ae=(a,s,r)=>(zd(a,s,"access private method"),r);var Kc=(a,s,r,c)=>({set _(u){ie(a,s,u,r)},get _(){return R(a,s,c)}});(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))c(u);new MutationObserver(u=>{for(const f of u)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function r(u){const f={};return u.integrity&&(f.integrity=u.integrity),u.referrerPolicy&&(f.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?f.credentials="include":u.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function c(u){if(u.ep)return;u.ep=!0;const f=r(u);fetch(u.href,f)}})();var Dd={exports:{}},Zi={};/**
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 Zy;function Fb(){if(Zy)return Zi;Zy=1;var a=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function r(c,u,f){var h=null;if(f!==void 0&&(h=""+f),u.key!==void 0&&(h=""+u.key),"key"in u){f={};for(var m in u)m!=="key"&&(f[m]=u[m])}else f=u;return u=f.ref,{$$typeof:a,type:c,key:h,ref:u!==void 0?u:null,props:f}}return Zi.Fragment=s,Zi.jsx=r,Zi.jsxs=r,Zi}var Wy;function Xb(){return Wy||(Wy=1,Dd.exports=Fb()),Dd.exports}var n=Xb(),qd={exports:{}},Te={};/**
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 eg;function Vb(){if(eg)return Te;eg=1;var a=Symbol.for("react.transitional.element"),s=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),h=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),N=Symbol.iterator;function j(T){return T===null||typeof T!="object"?null:(T=N&&T[N]||T["@@iterator"],typeof T=="function"?T:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,A={};function O(T,B,W){this.props=T,this.context=B,this.refs=A,this.updater=W||E}O.prototype.isReactComponent={},O.prototype.setState=function(T,B){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,B,"setState")},O.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function U(){}U.prototype=O.prototype;function q(T,B,W){this.props=T,this.context=B,this.refs=A,this.updater=W||E}var z=q.prototype=new U;z.constructor=q,C(z,O.prototype),z.isPureReactComponent=!0;var K=Array.isArray;function J(){}var G={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function ee(T,B,W){var le=W.ref;return{$$typeof:a,type:T,key:B,ref:le!==void 0?le:null,props:W}}function pe(T,B){return ee(T.type,B,T.props)}function he(T){return typeof T=="object"&&T!==null&&T.$$typeof===a}function ye(T){var B={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(W){return B[W]})}var Ee=/\/+/g;function me(T,B){return typeof T=="object"&&T!==null&&T.key!=null?ye(""+T.key):B.toString(36)}function xe(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(J,J):(T.status="pending",T.then(function(B){T.status==="pending"&&(T.status="fulfilled",T.value=B)},function(B){T.status==="pending"&&(T.status="rejected",T.reason=B)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function k(T,B,W,le,X){var oe=typeof T;(oe==="undefined"||oe==="boolean")&&(T=null);var Se=!1;if(T===null)Se=!0;else switch(oe){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(T.$$typeof){case a:case s:Se=!0;break;case v:return Se=T._init,k(Se(T._payload),B,W,le,X)}}if(Se)return X=X(T),Se=le===""?"."+me(T,0):le,K(X)?(W="",Se!=null&&(W=Se.replace(Ee,"$&/")+"/"),k(X,B,W,"",function(et){return et})):X!=null&&(he(X)&&(X=pe(X,W+(X.key==null||T&&T.key===X.key?"":(""+X.key).replace(Ee,"$&/")+"/")+Se)),B.push(X)),1;Se=0;var se=le===""?".":le+":";if(K(T))for(var re=0;re<T.length;re++)le=T[re],oe=se+me(le,re),Se+=k(le,B,W,oe,X);else if(re=j(T),typeof re=="function")for(T=re.call(T),re=0;!(le=T.next()).done;)le=le.value,oe=se+me(le,re++),Se+=k(le,B,W,oe,X);else if(oe==="object"){if(typeof T.then=="function")return k(xe(T),B,W,le,X);throw B=String(T),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return Se}function Z(T,B,W){if(T==null)return T;var le=[],X=0;return k(T,le,"","",function(oe){return B.call(W,oe,X++)}),le}function ne(T){if(T._status===-1){var B=T._result;B=B(),B.then(function(W){(T._status===0||T._status===-1)&&(T._status=1,T._result=W)},function(W){(T._status===0||T._status===-1)&&(T._status=2,T._result=W)}),T._status===-1&&(T._status=0,T._result=B)}if(T._status===1)return T._result.default;throw T._result}var je=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},Y={map:Z,forEach:function(T,B,W){Z(T,function(){B.apply(this,arguments)},W)},count:function(T){var B=0;return Z(T,function(){B++}),B},toArray:function(T){return Z(T,function(B){return B})||[]},only:function(T){if(!he(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return Te.Activity=x,Te.Children=Y,Te.Component=O,Te.Fragment=r,Te.Profiler=u,Te.PureComponent=q,Te.StrictMode=c,Te.Suspense=p,Te.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=G,Te.__COMPILER_RUNTIME={__proto__:null,c:function(T){return G.H.useMemoCache(T)}},Te.cache=function(T){return function(){return T.apply(null,arguments)}},Te.cacheSignal=function(){return null},Te.cloneElement=function(T,B,W){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var le=C({},T.props),X=T.key;if(B!=null)for(oe in B.key!==void 0&&(X=""+B.key),B)!$.call(B,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&B.ref===void 0||(le[oe]=B[oe]);var oe=arguments.length-2;if(oe===1)le.children=W;else if(1<oe){for(var Se=Array(oe),se=0;se<oe;se++)Se[se]=arguments[se+2];le.children=Se}return ee(T.type,X,le)},Te.createContext=function(T){return T={$$typeof:h,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:f,_context:T},T},Te.createElement=function(T,B,W){var le,X={},oe=null;if(B!=null)for(le in B.key!==void 0&&(oe=""+B.key),B)$.call(B,le)&&le!=="key"&&le!=="__self"&&le!=="__source"&&(X[le]=B[le]);var Se=arguments.length-2;if(Se===1)X.children=W;else if(1<Se){for(var se=Array(Se),re=0;re<Se;re++)se[re]=arguments[re+2];X.children=se}if(T&&T.defaultProps)for(le in Se=T.defaultProps,Se)X[le]===void 0&&(X[le]=Se[le]);return ee(T,oe,X)},Te.createRef=function(){return{current:null}},Te.forwardRef=function(T){return{$$typeof:m,render:T}},Te.isValidElement=he,Te.lazy=function(T){return{$$typeof:v,_payload:{_status:-1,_result:T},_init:ne}},Te.memo=function(T,B){return{$$typeof:g,type:T,compare:B===void 0?null:B}},Te.startTransition=function(T){var B=G.T,W={};G.T=W;try{var le=T(),X=G.S;X!==null&&X(W,le),typeof le=="object"&&le!==null&&typeof le.then=="function"&&le.then(J,je)}catch(oe){je(oe)}finally{B!==null&&W.types!==null&&(B.types=W.types),G.T=B}},Te.unstable_useCacheRefresh=function(){return G.H.useCacheRefresh()},Te.use=function(T){return G.H.use(T)},Te.useActionState=function(T,B,W){return G.H.useActionState(T,B,W)},Te.useCallback=function(T,B){return G.H.useCallback(T,B)},Te.useContext=function(T){return G.H.useContext(T)},Te.useDebugValue=function(){},Te.useDeferredValue=function(T,B){return G.H.useDeferredValue(T,B)},Te.useEffect=function(T,B){return G.H.useEffect(T,B)},Te.useEffectEvent=function(T){return G.H.useEffectEvent(T)},Te.useId=function(){return G.H.useId()},Te.useImperativeHandle=function(T,B,W){return G.H.useImperativeHandle(T,B,W)},Te.useInsertionEffect=function(T,B){return G.H.useInsertionEffect(T,B)},Te.useLayoutEffect=function(T,B){return G.H.useLayoutEffect(T,B)},Te.useMemo=function(T,B){return G.H.useMemo(T,B)},Te.useOptimistic=function(T,B){return G.H.useOptimistic(T,B)},Te.useReducer=function(T,B,W){return G.H.useReducer(T,B,W)},Te.useRef=function(T){return G.H.useRef(T)},Te.useState=function(T){return G.H.useState(T)},Te.useSyncExternalStore=function(T,B,W){return G.H.useSyncExternalStore(T,B,W)},Te.useTransition=function(){return G.H.useTransition()},Te.version="19.2.7",Te}var tg;function Of(){return tg||(tg=1,qd.exports=Vb()),qd.exports}var S=Of(),Bd={exports:{}},Wi={},Ld={exports:{}},_d={};/**
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
+ */var ng;function Jb(){return ng||(ng=1,(function(a){function s(k,Z){var ne=k.length;k.push(Z);e:for(;0<ne;){var je=ne-1>>>1,Y=k[je];if(0<u(Y,Z))k[je]=Z,k[ne]=Y,ne=je;else break e}}function r(k){return k.length===0?null:k[0]}function c(k){if(k.length===0)return null;var Z=k[0],ne=k.pop();if(ne!==Z){k[0]=ne;e:for(var je=0,Y=k.length,T=Y>>>1;je<T;){var B=2*(je+1)-1,W=k[B],le=B+1,X=k[le];if(0>u(W,ne))le<Y&&0>u(X,W)?(k[je]=X,k[le]=ne,je=le):(k[je]=W,k[B]=ne,je=B);else if(le<Y&&0>u(X,ne))k[je]=X,k[le]=ne,je=le;else break e}}return Z}function u(k,Z){var ne=k.sortIndex-Z.sortIndex;return ne!==0?ne:k.id-Z.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var h=Date,m=h.now();a.unstable_now=function(){return h.now()-m}}var p=[],g=[],v=1,x=null,N=3,j=!1,E=!1,C=!1,A=!1,O=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function z(k){for(var Z=r(g);Z!==null;){if(Z.callback===null)c(g);else if(Z.startTime<=k)c(g),Z.sortIndex=Z.expirationTime,s(p,Z);else break;Z=r(g)}}function K(k){if(C=!1,z(k),!E)if(r(p)!==null)E=!0,J||(J=!0,ye());else{var Z=r(g);Z!==null&&xe(K,Z.startTime-k)}}var J=!1,G=-1,$=5,ee=-1;function pe(){return A?!0:!(a.unstable_now()-ee<$)}function he(){if(A=!1,J){var k=a.unstable_now();ee=k;var Z=!0;try{e:{E=!1,C&&(C=!1,U(G),G=-1),j=!0;var ne=N;try{t:{for(z(k),x=r(p);x!==null&&!(x.expirationTime>k&&pe());){var je=x.callback;if(typeof je=="function"){x.callback=null,N=x.priorityLevel;var Y=je(x.expirationTime<=k);if(k=a.unstable_now(),typeof Y=="function"){x.callback=Y,z(k),Z=!0;break t}x===r(p)&&c(p),z(k)}else c(p);x=r(p)}if(x!==null)Z=!0;else{var T=r(g);T!==null&&xe(K,T.startTime-k),Z=!1}}break e}finally{x=null,N=ne,j=!1}Z=void 0}}finally{Z?ye():J=!1}}}var ye;if(typeof q=="function")ye=function(){q(he)};else if(typeof MessageChannel<"u"){var Ee=new MessageChannel,me=Ee.port2;Ee.port1.onmessage=he,ye=function(){me.postMessage(null)}}else ye=function(){O(he,0)};function xe(k,Z){G=O(function(){k(a.unstable_now())},Z)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(k){k.callback=null},a.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<k?Math.floor(1e3/k):5},a.unstable_getCurrentPriorityLevel=function(){return N},a.unstable_next=function(k){switch(N){case 1:case 2:case 3:var Z=3;break;default:Z=N}var ne=N;N=Z;try{return k()}finally{N=ne}},a.unstable_requestPaint=function(){A=!0},a.unstable_runWithPriority=function(k,Z){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var ne=N;N=k;try{return Z()}finally{N=ne}},a.unstable_scheduleCallback=function(k,Z,ne){var je=a.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?je+ne:je):ne=je,k){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=ne+Y,k={id:v++,callback:Z,priorityLevel:k,startTime:ne,expirationTime:Y,sortIndex:-1},ne>je?(k.sortIndex=ne,s(g,k),r(p)===null&&k===r(g)&&(C?(U(G),G=-1):C=!0,xe(K,ne-je))):(k.sortIndex=Y,s(p,k),E||j||(E=!0,J||(J=!0,ye()))),k},a.unstable_shouldYield=pe,a.unstable_wrapCallback=function(k){var Z=N;return function(){var ne=N;N=Z;try{return k.apply(this,arguments)}finally{N=ne}}}})(_d)),_d}var ag;function Zb(){return ag||(ag=1,Ld.exports=Jb()),Ld.exports}var Ud={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 lg;function Wb(){if(lg)return Qt;lg=1;var a=Of();function s(p){var g="https://react.dev/errors/"+p;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)g+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+p+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var c={d:{f:r,r:function(){throw Error(s(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},u=Symbol.for("react.portal");function f(p,g,v){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:x==null?null:""+x,children:p,containerInfo:g,implementation:v}}var h=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,g){if(p==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Qt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c,Qt.createPortal=function(p,g){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(s(299));return f(p,g,null,v)},Qt.flushSync=function(p){var g=h.T,v=c.p;try{if(h.T=null,c.p=2,p)return p()}finally{h.T=g,c.p=v,c.d.f()}},Qt.preconnect=function(p,g){typeof p=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,c.d.C(p,g))},Qt.prefetchDNS=function(p){typeof p=="string"&&c.d.D(p)},Qt.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var v=g.as,x=m(v,g.crossOrigin),N=typeof g.integrity=="string"?g.integrity:void 0,j=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;v==="style"?c.d.S(p,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:x,integrity:N,fetchPriority:j}):v==="script"&&c.d.X(p,{crossOrigin:x,integrity:N,fetchPriority:j,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Qt.preinitModule=function(p,g){if(typeof p=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var v=m(g.as,g.crossOrigin);c.d.M(p,{crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&c.d.M(p)},Qt.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var v=g.as,x=m(v,g.crossOrigin);c.d.L(p,v,{crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Qt.preloadModule=function(p,g){if(typeof p=="string")if(g){var v=m(g.as,g.crossOrigin);c.d.m(p,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else c.d.m(p)},Qt.requestFormReset=function(p){c.d.r(p)},Qt.unstable_batchedUpdates=function(p,g){return p(g)},Qt.useFormState=function(p,g,v){return h.H.useFormState(p,g,v)},Qt.useFormStatus=function(){return h.H.useHostTransitionStatus()},Qt.version="19.2.7",Qt}var sg;function e0(){if(sg)return Ud.exports;sg=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(s){console.error(s)}}return a(),Ud.exports=Wb(),Ud.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 ig;function t0(){if(ig)return Wi;ig=1;var a=Zb(),s=Of(),r=e0();function c(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}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 u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function h(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 m(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 p(e){if(f(e)!==e)throw Error(c(188))}function g(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(c(188));return t!==e?null:e}for(var l=e,i=t;;){var o=l.return;if(o===null)break;var d=o.alternate;if(d===null){if(i=o.return,i!==null){l=i;continue}break}if(o.child===d.child){for(d=o.child;d;){if(d===l)return p(o),e;if(d===i)return p(o),t;d=d.sibling}throw Error(c(188))}if(l.return!==i.return)l=o,i=d;else{for(var y=!1,b=o.child;b;){if(b===l){y=!0,l=o,i=d;break}if(b===i){y=!0,i=o,l=d;break}b=b.sibling}if(!y){for(b=d.child;b;){if(b===l){y=!0,l=d,i=o;break}if(b===i){y=!0,i=d,l=o;break}b=b.sibling}if(!y)throw Error(c(189))}}if(l.alternate!==i)throw Error(c(190))}if(l.tag!==3)throw Error(c(188));return l.stateNode.current===l?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}var x=Object.assign,N=Symbol.for("react.element"),j=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),q=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),pe=Symbol.for("react.memo_cache_sentinel"),he=Symbol.iterator;function ye(e){return e===null||typeof e!="object"?null:(e=he&&e[he]||e["@@iterator"],typeof e=="function"?e:null)}var Ee=Symbol.for("react.client.reference");function me(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ee?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case O:return"Profiler";case A:return"StrictMode";case K:return"Suspense";case J:return"SuspenseList";case ee:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case q:return e.displayName||"Context";case U:return(e._context.displayName||"Context")+".Consumer";case z:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case G:return t=e.displayName||null,t!==null?t:me(e.type)||"Memo";case $:t=e._payload,e=e._init;try{return me(e(t))}catch{}}return null}var xe=Array.isArray,k=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},je=[],Y=-1;function T(e){return{current:e}}function B(e){0>Y||(e.current=je[Y],je[Y]=null,Y--)}function W(e,t){Y++,je[Y]=e.current,e.current=t}var le=T(null),X=T(null),oe=T(null),Se=T(null);function se(e,t){switch(W(oe,t),W(X,e),W(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?xy(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=xy(t),e=jy(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}B(le),W(le,e)}function re(){B(le),B(X),B(oe)}function et(e){e.memoizedState!==null&&W(Se,e);var t=le.current,l=jy(t,e.type);t!==l&&(W(X,e),W(le,l))}function dt(e){X.current===e&&(B(le),B(X)),Se.current===e&&(B(Se),Fi._currentValue=ne)}var Ut,Fe;function ct(e){if(Ut===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);Ut=t&&t[1]||"",Fe=-1<l.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Ut+e+Fe}var ft=!1;function Dn(e,t){if(!e||ft)return"";ft=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var V=function(){throw Error()};if(Object.defineProperty(V.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(V,[])}catch(H){var Q=H}Reflect.construct(e,[],V)}else{try{V.call()}catch(H){Q=H}e.call(V.prototype)}}else{try{throw Error()}catch(H){Q=H}(V=e())&&typeof V.catch=="function"&&V.catch(function(){})}}catch(H){if(H&&Q&&typeof H.stack=="string")return[H.stack,Q.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=i.DetermineComponentFrameRoot(),y=d[0],b=d[1];if(y&&b){var w=y.split(`
44
+ `),_=b.split(`
45
+ `);for(o=i=0;i<w.length&&!w[i].includes("DetermineComponentFrameRoot");)i++;for(;o<_.length&&!_[o].includes("DetermineComponentFrameRoot");)o++;if(i===w.length||o===_.length)for(i=w.length-1,o=_.length-1;1<=i&&0<=o&&w[i]!==_[o];)o--;for(;1<=i&&0<=o;i--,o--)if(w[i]!==_[o]){if(i!==1||o!==1)do if(i--,o--,0>o||w[i]!==_[o]){var I=`
46
+ `+w[i].replace(" at new "," at ");return e.displayName&&I.includes("<anonymous>")&&(I=I.replace("<anonymous>",e.displayName)),I}while(1<=i&&0<=o);break}}}finally{ft=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?ct(l):""}function Vn(e,t){switch(e.tag){case 26:case 27:case 5:return ct(e.type);case 16:return ct("Lazy");case 13:return e.child!==t&&t!==null?ct("Suspense Fallback"):ct("Suspense");case 19:return ct("SuspenseList");case 0:case 15:return Dn(e.type,!1);case 11:return Dn(e.type.render,!1);case 1:return Dn(e.type,!0);case 31:return ct("Activity");default:return""}}function Jn(e){try{var t="",l=null;do t+=Vn(e,l),l=e,e=e.return;while(e);return t}catch(i){return`
47
+ Error generating stack: `+i.message+`
48
+ `+i.stack}}var tt=Object.prototype.hasOwnProperty,ae=a.unstable_scheduleCallback,Me=a.unstable_cancelCallback,P=a.unstable_shouldYield,Xe=a.unstable_requestPaint,Ke=a.unstable_now,$n=a.unstable_getCurrentPriorityLevel,Zn=a.unstable_ImmediatePriority,vl=a.unstable_UserBlockingPriority,xl=a.unstable_NormalPriority,Nr=a.unstable_LowPriority,ii=a.unstable_IdlePriority,Cr=a.log,Er=a.unstable_setDisableYieldValue,ka=null,ce=null;function ke(e){if(typeof Cr=="function"&&Er(e),ce&&typeof ce.setStrictMode=="function")try{ce.setStrictMode(ka,e)}catch{}}var xt=Math.clz32?Math.clz32:kx,Tr=Math.log,Wn=Math.LN2;function kx(e){return e>>>=0,e===0?32:31-(Tr(e)/Wn|0)|0}var wr=256,Rr=262144,Ar=4194304;function jl(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 Or(e,t,l){var i=e.pendingLanes;if(i===0)return 0;var o=0,d=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var b=i&134217727;return b!==0?(i=b&~d,i!==0?o=jl(i):(y&=b,y!==0?o=jl(y):l||(l=b&~e,l!==0&&(o=jl(l))))):(b=i&~d,b!==0?o=jl(b):y!==0?o=jl(y):l||(l=i&~e,l!==0&&(o=jl(l)))),o===0?0:t!==0&&t!==o&&(t&d)===0&&(d=o&-o,l=t&-t,d>=l||d===32&&(l&4194048)!==0)?t:o}function ri(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function zx(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 eh(){var e=Ar;return Ar<<=1,(Ar&62914560)===0&&(Ar=4194304),e}function bo(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function ci(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Dx(e,t,l,i,o,d){var y=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var b=e.entanglements,w=e.expirationTimes,_=e.hiddenUpdates;for(l=y&~l;0<l;){var I=31-xt(l),V=1<<I;b[I]=0,w[I]=-1;var Q=_[I];if(Q!==null)for(_[I]=null,I=0;I<Q.length;I++){var H=Q[I];H!==null&&(H.lane&=-536870913)}l&=~V}i!==0&&th(e,i,0),d!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=d&~(y&~t))}function th(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-xt(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|l&261930}function nh(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var i=31-xt(l),o=1<<i;o&t|e[i]&t&&(e[i]|=t),l&=~o}}function ah(e,t){var l=t&-t;return l=(l&42)!==0?1:So(l),(l&(e.suspendedLanes|t))!==0?0:l}function So(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 No(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function lh(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:Ky(e.type))}function sh(e,t){var l=Z.p;try{return Z.p=e,t()}finally{Z.p=l}}var za=Math.random().toString(36).slice(2),kt="__reactFiber$"+za,Yt="__reactProps$"+za,Jl="__reactContainer$"+za,Co="__reactEvents$"+za,qx="__reactListeners$"+za,Bx="__reactHandles$"+za,ih="__reactResources$"+za,oi="__reactMarker$"+za;function Eo(e){delete e[kt],delete e[Yt],delete e[Co],delete e[qx],delete e[Bx]}function Zl(e){var t=e[kt];if(t)return t;for(var l=e.parentNode;l;){if(t=l[Jl]||l[kt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=wy(e);e!==null;){if(l=e[kt])return l;e=wy(e)}return t}e=l,l=e.parentNode}return null}function Wl(e){if(e=e[kt]||e[Jl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ui(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(c(33))}function es(e){var t=e[ih];return t||(t=e[ih]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Rt(e){e[oi]=!0}var rh=new Set,ch={};function bl(e,t){ts(e,t),ts(e+"Capture",t)}function ts(e,t){for(ch[e]=t,e=0;e<t.length;e++)rh.add(t[e])}var Lx=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]*$"),oh={},uh={};function _x(e){return tt.call(uh,e)?!0:tt.call(oh,e)?!1:Lx.test(e)?uh[e]=!0:(oh[e]=!0,!1)}function Mr(e,t,l){if(_x(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function kr(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function ea(e,t,l,i){if(i===null)e.removeAttribute(l);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+i)}}function pn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function dh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ux(e,t,l){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var o=i.get,d=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(y){l=""+y,d.call(this,y)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return l},setValue:function(y){l=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function To(e){if(!e._valueTracker){var t=dh(e)?"checked":"value";e._valueTracker=Ux(e,t,""+e[t])}}function fh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),i="";return e&&(i=dh(e)?e.checked?"true":"false":e.value),e=i,e!==l?(t.setValue(e),!0):!1}function zr(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 Qx=/[\n"\\]/g;function yn(e){return e.replace(Qx,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function wo(e,t,l,i,o,d,y,b){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+pn(t)):e.value!==""+pn(t)&&(e.value=""+pn(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?Ro(e,y,pn(t)):l!=null?Ro(e,y,pn(l)):i!=null&&e.removeAttribute("value"),o==null&&d!=null&&(e.defaultChecked=!!d),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+pn(b):e.removeAttribute("name")}function hh(e,t,l,i,o,d,y,b){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||l!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){To(e);return}l=l!=null?""+pn(l):"",t=t!=null?""+pn(t):l,b||t===e.value||(e.value=t),e.defaultValue=t}i=i??o,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=b?e.checked:!!i,e.defaultChecked=!!i,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),To(e)}function Ro(e,t,l){t==="number"&&zr(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function ns(e,t,l,i){if(e=e.options,t){t={};for(var o=0;o<l.length;o++)t["$"+l[o]]=!0;for(l=0;l<e.length;l++)o=t.hasOwnProperty("$"+e[l].value),e[l].selected!==o&&(e[l].selected=o),o&&i&&(e[l].defaultSelected=!0)}else{for(l=""+pn(l),t=null,o=0;o<e.length;o++){if(e[o].value===l){e[o].selected=!0,i&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function mh(e,t,l){if(t!=null&&(t=""+pn(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+pn(l):""}function ph(e,t,l,i){if(t==null){if(i!=null){if(l!=null)throw Error(c(92));if(xe(i)){if(1<i.length)throw Error(c(93));i=i[0]}l=i}l==null&&(l=""),t=l}l=pn(t),e.defaultValue=l,i=e.textContent,i===l&&i!==""&&i!==null&&(e.value=i),To(e)}function as(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var $x=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 yh(e,t,l){var i=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,l):typeof l!="number"||l===0||$x.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function gh(e,t,l){if(t!=null&&typeof t!="object")throw Error(c(62));if(e=e.style,l!=null){for(var i in l)!l.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var o in t)i=t[o],t.hasOwnProperty(o)&&l[o]!==i&&yh(e,o,i)}else for(var d in t)t.hasOwnProperty(d)&&yh(e,d,t[d])}function Ao(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 Hx=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"]]),Kx=/^[\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 Dr(e){return Kx.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ta(){}var Oo=null;function Mo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ls=null,ss=null;function vh(e){var t=Wl(e);if(t&&(e=t.stateNode)){var l=e[Yt]||null;e:switch(e=t.stateNode,t.type){case"input":if(wo(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+yn(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var i=l[t];if(i!==e&&i.form===e.form){var o=i[Yt]||null;if(!o)throw Error(c(90));wo(i,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<l.length;t++)i=l[t],i.form===e.form&&fh(i)}break e;case"textarea":mh(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&ns(e,!!l.multiple,t,!1)}}}var ko=!1;function xh(e,t,l){if(ko)return e(t,l);ko=!0;try{var i=e(t);return i}finally{if(ko=!1,(ls!==null||ss!==null)&&(bc(),ls&&(t=ls,e=ss,ss=ls=null,vh(t),e)))for(t=0;t<e.length;t++)vh(e[t])}}function di(e,t){var l=e.stateNode;if(l===null)return null;var i=l[Yt]||null;if(i===null)return null;l=i[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":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(c(231,t,typeof l));return l}var na=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zo=!1;if(na)try{var fi={};Object.defineProperty(fi,"passive",{get:function(){zo=!0}}),window.addEventListener("test",fi,fi),window.removeEventListener("test",fi,fi)}catch{zo=!1}var Da=null,Do=null,qr=null;function jh(){if(qr)return qr;var e,t=Do,l=t.length,i,o="value"in Da?Da.value:Da.textContent,d=o.length;for(e=0;e<l&&t[e]===o[e];e++);var y=l-e;for(i=1;i<=y&&t[l-i]===o[d-i];i++);return qr=o.slice(e,1<i?1-i:void 0)}function Br(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 Lr(){return!0}function bh(){return!1}function Pt(e){function t(l,i,o,d,y){this._reactName=l,this._targetInst=o,this.type=i,this.nativeEvent=d,this.target=y,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(l=e[b],this[b]=l?l(d):d[b]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Lr:bh,this.isPropagationStopped=bh,this}return x(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Lr)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Lr)},persist:function(){},isPersistent:Lr}),t}var Sl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_r=Pt(Sl),hi=x({},Sl,{view:0,detail:0}),Gx=Pt(hi),qo,Bo,mi,Ur=x({},hi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_o,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!==mi&&(mi&&e.type==="mousemove"?(qo=e.screenX-mi.screenX,Bo=e.screenY-mi.screenY):Bo=qo=0,mi=e),qo)},movementY:function(e){return"movementY"in e?e.movementY:Bo}}),Sh=Pt(Ur),Ix=x({},Ur,{dataTransfer:0}),Yx=Pt(Ix),Px=x({},hi,{relatedTarget:0}),Lo=Pt(Px),Fx=x({},Sl,{animationName:0,elapsedTime:0,pseudoElement:0}),Xx=Pt(Fx),Vx=x({},Sl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Jx=Pt(Vx),Zx=x({},Sl,{data:0}),Nh=Pt(Zx),Wx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ej={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"},tj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function nj(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=tj[e])?!!t[e]:!1}function _o(){return nj}var aj=x({},hi,{key:function(e){if(e.key){var t=Wx[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Br(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ej[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_o,charCode:function(e){return e.type==="keypress"?Br(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Br(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),lj=Pt(aj),sj=x({},Ur,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ch=Pt(sj),ij=x({},hi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_o}),rj=Pt(ij),cj=x({},Sl,{propertyName:0,elapsedTime:0,pseudoElement:0}),oj=Pt(cj),uj=x({},Ur,{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}),dj=Pt(uj),fj=x({},Sl,{newState:0,oldState:0}),hj=Pt(fj),mj=[9,13,27,32],Uo=na&&"CompositionEvent"in window,pi=null;na&&"documentMode"in document&&(pi=document.documentMode);var pj=na&&"TextEvent"in window&&!pi,Eh=na&&(!Uo||pi&&8<pi&&11>=pi),Th=" ",wh=!1;function Rh(e,t){switch(e){case"keyup":return mj.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ah(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var is=!1;function yj(e,t){switch(e){case"compositionend":return Ah(t);case"keypress":return t.which!==32?null:(wh=!0,Th);case"textInput":return e=t.data,e===Th&&wh?null:e;default:return null}}function gj(e,t){if(is)return e==="compositionend"||!Uo&&Rh(e,t)?(e=jh(),qr=Do=Da=null,is=!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 Eh&&t.locale!=="ko"?null:t.data;default:return null}}var vj={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 Oh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!vj[e.type]:t==="textarea"}function Mh(e,t,l,i){ls?ss?ss.push(i):ss=[i]:ls=i,t=Rc(t,"onChange"),0<t.length&&(l=new _r("onChange","change",null,l,i),e.push({event:l,listeners:t}))}var yi=null,gi=null;function xj(e){hy(e,0)}function Qr(e){var t=ui(e);if(fh(t))return e}function kh(e,t){if(e==="change")return t}var zh=!1;if(na){var Qo;if(na){var $o="oninput"in document;if(!$o){var Dh=document.createElement("div");Dh.setAttribute("oninput","return;"),$o=typeof Dh.oninput=="function"}Qo=$o}else Qo=!1;zh=Qo&&(!document.documentMode||9<document.documentMode)}function qh(){yi&&(yi.detachEvent("onpropertychange",Bh),gi=yi=null)}function Bh(e){if(e.propertyName==="value"&&Qr(gi)){var t=[];Mh(t,gi,e,Mo(e)),xh(xj,t)}}function jj(e,t,l){e==="focusin"?(qh(),yi=t,gi=l,yi.attachEvent("onpropertychange",Bh)):e==="focusout"&&qh()}function bj(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Qr(gi)}function Sj(e,t){if(e==="click")return Qr(t)}function Nj(e,t){if(e==="input"||e==="change")return Qr(t)}function Cj(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var nn=typeof Object.is=="function"?Object.is:Cj;function vi(e,t){if(nn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),i=Object.keys(t);if(l.length!==i.length)return!1;for(i=0;i<l.length;i++){var o=l[i];if(!tt.call(t,o)||!nn(e[o],t[o]))return!1}return!0}function Lh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function _h(e,t){var l=Lh(e);e=0;for(var i;l;){if(l.nodeType===3){if(i=e+l.textContent.length,e<=t&&i>=t)return{node:l,offset:t-e};e=i}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Lh(l)}}function Uh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Uh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=zr(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=zr(e.document)}return t}function Ho(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 Ej=na&&"documentMode"in document&&11>=document.documentMode,rs=null,Ko=null,xi=null,Go=!1;function $h(e,t,l){var i=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Go||rs==null||rs!==zr(i)||(i=rs,"selectionStart"in i&&Ho(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),xi&&vi(xi,i)||(xi=i,i=Rc(Ko,"onSelect"),0<i.length&&(t=new _r("onSelect","select",null,t,l),e.push({event:t,listeners:i}),t.target=rs)))}function Nl(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var cs={animationend:Nl("Animation","AnimationEnd"),animationiteration:Nl("Animation","AnimationIteration"),animationstart:Nl("Animation","AnimationStart"),transitionrun:Nl("Transition","TransitionRun"),transitionstart:Nl("Transition","TransitionStart"),transitioncancel:Nl("Transition","TransitionCancel"),transitionend:Nl("Transition","TransitionEnd")},Io={},Hh={};na&&(Hh=document.createElement("div").style,"AnimationEvent"in window||(delete cs.animationend.animation,delete cs.animationiteration.animation,delete cs.animationstart.animation),"TransitionEvent"in window||delete cs.transitionend.transition);function Cl(e){if(Io[e])return Io[e];if(!cs[e])return e;var t=cs[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Hh)return Io[e]=t[l];return e}var Kh=Cl("animationend"),Gh=Cl("animationiteration"),Ih=Cl("animationstart"),Tj=Cl("transitionrun"),wj=Cl("transitionstart"),Rj=Cl("transitioncancel"),Yh=Cl("transitionend"),Ph=new Map,Yo="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(" ");Yo.push("scrollEnd");function qn(e,t){Ph.set(e,t),bl(t,[e])}var $r=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)},gn=[],os=0,Po=0;function Hr(){for(var e=os,t=Po=os=0;t<e;){var l=gn[t];gn[t++]=null;var i=gn[t];gn[t++]=null;var o=gn[t];gn[t++]=null;var d=gn[t];if(gn[t++]=null,i!==null&&o!==null){var y=i.pending;y===null?o.next=o:(o.next=y.next,y.next=o),i.pending=o}d!==0&&Fh(l,o,d)}}function Kr(e,t,l,i){gn[os++]=e,gn[os++]=t,gn[os++]=l,gn[os++]=i,Po|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Fo(e,t,l,i){return Kr(e,t,l,i),Gr(e)}function El(e,t){return Kr(e,null,null,t),Gr(e)}function Fh(e,t,l){e.lanes|=l;var i=e.alternate;i!==null&&(i.lanes|=l);for(var o=!1,d=e.return;d!==null;)d.childLanes|=l,i=d.alternate,i!==null&&(i.childLanes|=l),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(o=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,o&&t!==null&&(o=31-xt(l),e=d.hiddenUpdates,i=e[o],i===null?e[o]=[t]:i.push(t),t.lane=l|536870912),d):null}function Gr(e){if(50<$i)throw $i=0,ad=null,Error(c(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var us={};function Aj(e,t,l,i){this.tag=e,this.key=l,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=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function an(e,t,l,i){return new Aj(e,t,l,i)}function Xo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function aa(e,t){var l=e.alternate;return l===null?(l=an(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Xh(e,t){e.flags&=65011714;var l=e.alternate;return l===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=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ir(e,t,l,i,o,d){var y=0;if(i=e,typeof e=="function")Xo(e)&&(y=1);else if(typeof e=="string")y=Db(e,l,le.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ee:return e=an(31,l,t,o),e.elementType=ee,e.lanes=d,e;case C:return Tl(l.children,o,d,t);case A:y=8,o|=24;break;case O:return e=an(12,l,t,o|2),e.elementType=O,e.lanes=d,e;case K:return e=an(13,l,t,o),e.elementType=K,e.lanes=d,e;case J:return e=an(19,l,t,o),e.elementType=J,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case q:y=10;break e;case U:y=9;break e;case z:y=11;break e;case G:y=14;break e;case $:y=16,i=null;break e}y=29,l=Error(c(130,e===null?"null":typeof e,"")),i=null}return t=an(y,l,t,o),t.elementType=e,t.type=i,t.lanes=d,t}function Tl(e,t,l,i){return e=an(7,e,i,t),e.lanes=l,e}function Vo(e,t,l){return e=an(6,e,null,t),e.lanes=l,e}function Vh(e){var t=an(18,null,null,0);return t.stateNode=e,t}function Jo(e,t,l){return t=an(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Jh=new WeakMap;function vn(e,t){if(typeof e=="object"&&e!==null){var l=Jh.get(e);return l!==void 0?l:(t={value:e,source:t,stack:Jn(t)},Jh.set(e,t),t)}return{value:e,source:t,stack:Jn(t)}}var ds=[],fs=0,Yr=null,ji=0,xn=[],jn=0,qa=null,Hn=1,Kn="";function la(e,t){ds[fs++]=ji,ds[fs++]=Yr,Yr=e,ji=t}function Zh(e,t,l){xn[jn++]=Hn,xn[jn++]=Kn,xn[jn++]=qa,qa=e;var i=Hn;e=Kn;var o=32-xt(i)-1;i&=~(1<<o),l+=1;var d=32-xt(t)+o;if(30<d){var y=o-o%5;d=(i&(1<<y)-1).toString(32),i>>=y,o-=y,Hn=1<<32-xt(t)+o|l<<o|i,Kn=d+e}else Hn=1<<d|l<<o|i,Kn=e}function Zo(e){e.return!==null&&(la(e,1),Zh(e,1,0))}function Wo(e){for(;e===Yr;)Yr=ds[--fs],ds[fs]=null,ji=ds[--fs],ds[fs]=null;for(;e===qa;)qa=xn[--jn],xn[jn]=null,Kn=xn[--jn],xn[jn]=null,Hn=xn[--jn],xn[jn]=null}function Wh(e,t){xn[jn++]=Hn,xn[jn++]=Kn,xn[jn++]=qa,Hn=t.id,Kn=t.overflow,qa=e}var zt=null,at=null,Le=!1,Ba=null,bn=!1,eu=Error(c(519));function La(e){var t=Error(c(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw bi(vn(t,e)),eu}function em(e){var t=e.stateNode,l=e.type,i=e.memoizedProps;switch(t[kt]=e,t[Yt]=i,l){case"dialog":De("cancel",t),De("close",t);break;case"iframe":case"object":case"embed":De("load",t);break;case"video":case"audio":for(l=0;l<Ki.length;l++)De(Ki[l],t);break;case"source":De("error",t);break;case"img":case"image":case"link":De("error",t),De("load",t);break;case"details":De("toggle",t);break;case"input":De("invalid",t),hh(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":De("invalid",t);break;case"textarea":De("invalid",t),ph(t,i.value,i.defaultValue,i.children)}l=i.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||i.suppressHydrationWarning===!0||gy(t.textContent,l)?(i.popover!=null&&(De("beforetoggle",t),De("toggle",t)),i.onScroll!=null&&De("scroll",t),i.onScrollEnd!=null&&De("scrollend",t),i.onClick!=null&&(t.onclick=ta),t=!0):t=!1,t||La(e,!0)}function tm(e){for(zt=e.return;zt;)switch(zt.tag){case 5:case 31:case 13:bn=!1;return;case 27:case 3:bn=!0;return;default:zt=zt.return}}function hs(e){if(e!==zt)return!1;if(!Le)return tm(e),Le=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||vd(e.type,e.memoizedProps)),l=!l),l&&at&&La(e),tm(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));at=Ty(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));at=Ty(e)}else t===27?(t=at,Ja(e.type)?(e=Nd,Nd=null,at=e):at=t):at=zt?Nn(e.stateNode.nextSibling):null;return!0}function wl(){at=zt=null,Le=!1}function tu(){var e=Ba;return e!==null&&(Jt===null?Jt=e:Jt.push.apply(Jt,e),Ba=null),e}function bi(e){Ba===null?Ba=[e]:Ba.push(e)}var nu=T(null),Rl=null,sa=null;function _a(e,t,l){W(nu,t._currentValue),t._currentValue=l}function ia(e){e._currentValue=nu.current,B(nu)}function au(e,t,l){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===l)break;e=e.return}}function lu(e,t,l,i){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var d=o.dependencies;if(d!==null){var y=o.child;d=d.firstContext;e:for(;d!==null;){var b=d;d=o;for(var w=0;w<t.length;w++)if(b.context===t[w]){d.lanes|=l,b=d.alternate,b!==null&&(b.lanes|=l),au(d.return,l,e),i||(y=null);break e}d=b.next}}else if(o.tag===18){if(y=o.return,y===null)throw Error(c(341));y.lanes|=l,d=y.alternate,d!==null&&(d.lanes|=l),au(y,l,e),y=null}else y=o.child;if(y!==null)y.return=o;else for(y=o;y!==null;){if(y===e){y=null;break}if(o=y.sibling,o!==null){o.return=y.return,y=o;break}y=y.return}o=y}}function ms(e,t,l,i){e=null;for(var o=t,d=!1;o!==null;){if(!d){if((o.flags&524288)!==0)d=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var y=o.alternate;if(y===null)throw Error(c(387));if(y=y.memoizedProps,y!==null){var b=o.type;nn(o.pendingProps.value,y.value)||(e!==null?e.push(b):e=[b])}}else if(o===Se.current){if(y=o.alternate,y===null)throw Error(c(387));y.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(Fi):e=[Fi])}o=o.return}e!==null&&lu(t,e,l,i),t.flags|=262144}function Pr(e){for(e=e.firstContext;e!==null;){if(!nn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Al(e){Rl=e,sa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Dt(e){return nm(Rl,e)}function Fr(e,t){return Rl===null&&Al(e),nm(e,t)}function nm(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},sa===null){if(e===null)throw Error(c(308));sa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else sa=sa.next=t;return l}var Oj=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},Mj=a.unstable_scheduleCallback,kj=a.unstable_NormalPriority,jt={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function su(){return{controller:new Oj,data:new Map,refCount:0}}function Si(e){e.refCount--,e.refCount===0&&Mj(kj,function(){e.controller.abort()})}var Ni=null,iu=0,ps=0,ys=null;function zj(e,t){if(Ni===null){var l=Ni=[];iu=0,ps=od(),ys={status:"pending",value:void 0,then:function(i){l.push(i)}}}return iu++,t.then(am,am),t}function am(){if(--iu===0&&Ni!==null){ys!==null&&(ys.status="fulfilled");var e=Ni;Ni=null,ps=0,ys=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Dj(e,t){var l=[],i={status:"pending",value:null,reason:null,then:function(o){l.push(o)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var o=0;o<l.length;o++)(0,l[o])(t)},function(o){for(i.status="rejected",i.reason=o,o=0;o<l.length;o++)(0,l[o])(void 0)}),i}var lm=k.S;k.S=function(e,t){$p=Ke(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&zj(e,t),lm!==null&&lm(e,t)};var Ol=T(null);function ru(){var e=Ol.current;return e!==null?e:We.pooledCache}function Xr(e,t){t===null?W(Ol,Ol.current):W(Ol,t.pool)}function sm(){var e=ru();return e===null?null:{parent:jt._currentValue,pool:e}}var gs=Error(c(460)),cu=Error(c(474)),Vr=Error(c(542)),Jr={then:function(){}};function im(e){return e=e.status,e==="fulfilled"||e==="rejected"}function rm(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(ta,ta),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,om(e),e;default:if(typeof t.status=="string")t.then(ta,ta);else{if(e=We,e!==null&&100<e.shellSuspendCounter)throw Error(c(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=i}},function(i){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,om(e),e}throw kl=t,gs}}function Ml(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(kl=l,gs):l}}var kl=null;function cm(){if(kl===null)throw Error(c(459));var e=kl;return kl=null,e}function om(e){if(e===gs||e===Vr)throw Error(c(483))}var vs=null,Ci=0;function Zr(e){var t=Ci;return Ci+=1,vs===null&&(vs=[]),rm(vs,e,t)}function Ei(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Wr(e,t){throw t.$$typeof===N?Error(c(525)):(e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function um(e){function t(D,M){if(e){var L=D.deletions;L===null?(D.deletions=[M],D.flags|=16):L.push(M)}}function l(D,M){if(!e)return null;for(;M!==null;)t(D,M),M=M.sibling;return null}function i(D){for(var M=new Map;D!==null;)D.key!==null?M.set(D.key,D):M.set(D.index,D),D=D.sibling;return M}function o(D,M){return D=aa(D,M),D.index=0,D.sibling=null,D}function d(D,M,L){return D.index=L,e?(L=D.alternate,L!==null?(L=L.index,L<M?(D.flags|=67108866,M):L):(D.flags|=67108866,M)):(D.flags|=1048576,M)}function y(D){return e&&D.alternate===null&&(D.flags|=67108866),D}function b(D,M,L,F){return M===null||M.tag!==6?(M=Vo(L,D.mode,F),M.return=D,M):(M=o(M,L),M.return=D,M)}function w(D,M,L,F){var be=L.type;return be===C?I(D,M,L.props.children,F,L.key):M!==null&&(M.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===$&&Ml(be)===M.type)?(M=o(M,L.props),Ei(M,L),M.return=D,M):(M=Ir(L.type,L.key,L.props,null,D.mode,F),Ei(M,L),M.return=D,M)}function _(D,M,L,F){return M===null||M.tag!==4||M.stateNode.containerInfo!==L.containerInfo||M.stateNode.implementation!==L.implementation?(M=Jo(L,D.mode,F),M.return=D,M):(M=o(M,L.children||[]),M.return=D,M)}function I(D,M,L,F,be){return M===null||M.tag!==7?(M=Tl(L,D.mode,F,be),M.return=D,M):(M=o(M,L),M.return=D,M)}function V(D,M,L){if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return M=Vo(""+M,D.mode,L),M.return=D,M;if(typeof M=="object"&&M!==null){switch(M.$$typeof){case j:return L=Ir(M.type,M.key,M.props,null,D.mode,L),Ei(L,M),L.return=D,L;case E:return M=Jo(M,D.mode,L),M.return=D,M;case $:return M=Ml(M),V(D,M,L)}if(xe(M)||ye(M))return M=Tl(M,D.mode,L,null),M.return=D,M;if(typeof M.then=="function")return V(D,Zr(M),L);if(M.$$typeof===q)return V(D,Fr(D,M),L);Wr(D,M)}return null}function Q(D,M,L,F){var be=M!==null?M.key:null;if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return be!==null?null:b(D,M,""+L,F);if(typeof L=="object"&&L!==null){switch(L.$$typeof){case j:return L.key===be?w(D,M,L,F):null;case E:return L.key===be?_(D,M,L,F):null;case $:return L=Ml(L),Q(D,M,L,F)}if(xe(L)||ye(L))return be!==null?null:I(D,M,L,F,null);if(typeof L.then=="function")return Q(D,M,Zr(L),F);if(L.$$typeof===q)return Q(D,M,Fr(D,L),F);Wr(D,L)}return null}function H(D,M,L,F,be){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return D=D.get(L)||null,b(M,D,""+F,be);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case j:return D=D.get(F.key===null?L:F.key)||null,w(M,D,F,be);case E:return D=D.get(F.key===null?L:F.key)||null,_(M,D,F,be);case $:return F=Ml(F),H(D,M,L,F,be)}if(xe(F)||ye(F))return D=D.get(L)||null,I(M,D,F,be,null);if(typeof F.then=="function")return H(D,M,L,Zr(F),be);if(F.$$typeof===q)return H(D,M,L,Fr(M,F),be);Wr(M,F)}return null}function ue(D,M,L,F){for(var be=null,Ue=null,de=M,Re=M=0,Be=null;de!==null&&Re<L.length;Re++){de.index>Re?(Be=de,de=null):Be=de.sibling;var Qe=Q(D,de,L[Re],F);if(Qe===null){de===null&&(de=Be);break}e&&de&&Qe.alternate===null&&t(D,de),M=d(Qe,M,Re),Ue===null?be=Qe:Ue.sibling=Qe,Ue=Qe,de=Be}if(Re===L.length)return l(D,de),Le&&la(D,Re),be;if(de===null){for(;Re<L.length;Re++)de=V(D,L[Re],F),de!==null&&(M=d(de,M,Re),Ue===null?be=de:Ue.sibling=de,Ue=de);return Le&&la(D,Re),be}for(de=i(de);Re<L.length;Re++)Be=H(de,D,Re,L[Re],F),Be!==null&&(e&&Be.alternate!==null&&de.delete(Be.key===null?Re:Be.key),M=d(Be,M,Re),Ue===null?be=Be:Ue.sibling=Be,Ue=Be);return e&&de.forEach(function(nl){return t(D,nl)}),Le&&la(D,Re),be}function Ne(D,M,L,F){if(L==null)throw Error(c(151));for(var be=null,Ue=null,de=M,Re=M=0,Be=null,Qe=L.next();de!==null&&!Qe.done;Re++,Qe=L.next()){de.index>Re?(Be=de,de=null):Be=de.sibling;var nl=Q(D,de,Qe.value,F);if(nl===null){de===null&&(de=Be);break}e&&de&&nl.alternate===null&&t(D,de),M=d(nl,M,Re),Ue===null?be=nl:Ue.sibling=nl,Ue=nl,de=Be}if(Qe.done)return l(D,de),Le&&la(D,Re),be;if(de===null){for(;!Qe.done;Re++,Qe=L.next())Qe=V(D,Qe.value,F),Qe!==null&&(M=d(Qe,M,Re),Ue===null?be=Qe:Ue.sibling=Qe,Ue=Qe);return Le&&la(D,Re),be}for(de=i(de);!Qe.done;Re++,Qe=L.next())Qe=H(de,D,Re,Qe.value,F),Qe!==null&&(e&&Qe.alternate!==null&&de.delete(Qe.key===null?Re:Qe.key),M=d(Qe,M,Re),Ue===null?be=Qe:Ue.sibling=Qe,Ue=Qe);return e&&de.forEach(function(Ib){return t(D,Ib)}),Le&&la(D,Re),be}function Ze(D,M,L,F){if(typeof L=="object"&&L!==null&&L.type===C&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case j:e:{for(var be=L.key;M!==null;){if(M.key===be){if(be=L.type,be===C){if(M.tag===7){l(D,M.sibling),F=o(M,L.props.children),F.return=D,D=F;break e}}else if(M.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===$&&Ml(be)===M.type){l(D,M.sibling),F=o(M,L.props),Ei(F,L),F.return=D,D=F;break e}l(D,M);break}else t(D,M);M=M.sibling}L.type===C?(F=Tl(L.props.children,D.mode,F,L.key),F.return=D,D=F):(F=Ir(L.type,L.key,L.props,null,D.mode,F),Ei(F,L),F.return=D,D=F)}return y(D);case E:e:{for(be=L.key;M!==null;){if(M.key===be)if(M.tag===4&&M.stateNode.containerInfo===L.containerInfo&&M.stateNode.implementation===L.implementation){l(D,M.sibling),F=o(M,L.children||[]),F.return=D,D=F;break e}else{l(D,M);break}else t(D,M);M=M.sibling}F=Jo(L,D.mode,F),F.return=D,D=F}return y(D);case $:return L=Ml(L),Ze(D,M,L,F)}if(xe(L))return ue(D,M,L,F);if(ye(L)){if(be=ye(L),typeof be!="function")throw Error(c(150));return L=be.call(L),Ne(D,M,L,F)}if(typeof L.then=="function")return Ze(D,M,Zr(L),F);if(L.$$typeof===q)return Ze(D,M,Fr(D,L),F);Wr(D,L)}return typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint"?(L=""+L,M!==null&&M.tag===6?(l(D,M.sibling),F=o(M,L),F.return=D,D=F):(l(D,M),F=Vo(L,D.mode,F),F.return=D,D=F),y(D)):l(D,M)}return function(D,M,L,F){try{Ci=0;var be=Ze(D,M,L,F);return vs=null,be}catch(de){if(de===gs||de===Vr)throw de;var Ue=an(29,de,null,D.mode);return Ue.lanes=F,Ue.return=D,Ue}finally{}}}var zl=um(!0),dm=um(!1),Ua=!1;function ou(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function uu(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 Qa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function $a(e,t,l){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,($e&2)!==0){var o=i.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),i.pending=t,t=Gr(e),Fh(e,null,l),t}return Kr(e,i,t,l),Gr(e)}function Ti(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,nh(e,l)}}function du(e,t){var l=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,l===i)){var o=null,d=null;if(l=l.firstBaseUpdate,l!==null){do{var y={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};d===null?o=d=y:d=d.next=y,l=l.next}while(l!==null);d===null?o=d=t:d=d.next=t}else o=d=t;l={baseState:i.baseState,firstBaseUpdate:o,lastBaseUpdate:d,shared:i.shared,callbacks:i.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var fu=!1;function wi(){if(fu){var e=ys;if(e!==null)throw e}}function Ri(e,t,l,i){fu=!1;var o=e.updateQueue;Ua=!1;var d=o.firstBaseUpdate,y=o.lastBaseUpdate,b=o.shared.pending;if(b!==null){o.shared.pending=null;var w=b,_=w.next;w.next=null,y===null?d=_:y.next=_,y=w;var I=e.alternate;I!==null&&(I=I.updateQueue,b=I.lastBaseUpdate,b!==y&&(b===null?I.firstBaseUpdate=_:b.next=_,I.lastBaseUpdate=w))}if(d!==null){var V=o.baseState;y=0,I=_=w=null,b=d;do{var Q=b.lane&-536870913,H=Q!==b.lane;if(H?(qe&Q)===Q:(i&Q)===Q){Q!==0&&Q===ps&&(fu=!0),I!==null&&(I=I.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var ue=e,Ne=b;Q=t;var Ze=l;switch(Ne.tag){case 1:if(ue=Ne.payload,typeof ue=="function"){V=ue.call(Ze,V,Q);break e}V=ue;break e;case 3:ue.flags=ue.flags&-65537|128;case 0:if(ue=Ne.payload,Q=typeof ue=="function"?ue.call(Ze,V,Q):ue,Q==null)break e;V=x({},V,Q);break e;case 2:Ua=!0}}Q=b.callback,Q!==null&&(e.flags|=64,H&&(e.flags|=8192),H=o.callbacks,H===null?o.callbacks=[Q]:H.push(Q))}else H={lane:Q,tag:b.tag,payload:b.payload,callback:b.callback,next:null},I===null?(_=I=H,w=V):I=I.next=H,y|=Q;if(b=b.next,b===null){if(b=o.shared.pending,b===null)break;H=b,b=H.next,H.next=null,o.lastBaseUpdate=H,o.shared.pending=null}}while(!0);I===null&&(w=V),o.baseState=w,o.firstBaseUpdate=_,o.lastBaseUpdate=I,d===null&&(o.shared.lanes=0),Ya|=y,e.lanes=y,e.memoizedState=V}}function fm(e,t){if(typeof e!="function")throw Error(c(191,e));e.call(t)}function hm(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)fm(l[e],t)}var xs=T(null),ec=T(0);function mm(e,t){e=pa,W(ec,e),W(xs,t),pa=e|t.baseLanes}function hu(){W(ec,pa),W(xs,xs.current)}function mu(){pa=ec.current,B(xs),B(ec)}var ln=T(null),Sn=null;function Ha(e){var t=e.alternate;W(yt,yt.current&1),W(ln,e),Sn===null&&(t===null||xs.current!==null||t.memoizedState!==null)&&(Sn=e)}function pu(e){W(yt,yt.current),W(ln,e),Sn===null&&(Sn=e)}function pm(e){e.tag===22?(W(yt,yt.current),W(ln,e),Sn===null&&(Sn=e)):Ka()}function Ka(){W(yt,yt.current),W(ln,ln.current)}function sn(e){B(ln),Sn===e&&(Sn=null),B(yt)}var yt=T(0);function tc(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||bd(l)||Sd(l)))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)!==0)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 ra=0,we=null,Ve=null,bt=null,nc=!1,js=!1,Dl=!1,ac=0,Ai=0,bs=null,qj=0;function ht(){throw Error(c(321))}function yu(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!nn(e[l],t[l]))return!1;return!0}function gu(e,t,l,i,o,d){return ra=d,we=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=e===null||e.memoizedState===null?Zm:ku,Dl=!1,d=l(i,o),Dl=!1,js&&(d=gm(t,l,i,o)),ym(e),d}function ym(e){k.H=ki;var t=Ve!==null&&Ve.next!==null;if(ra=0,bt=Ve=we=null,nc=!1,Ai=0,bs=null,t)throw Error(c(300));e===null||St||(e=e.dependencies,e!==null&&Pr(e)&&(St=!0))}function gm(e,t,l,i){we=e;var o=0;do{if(js&&(bs=null),Ai=0,js=!1,25<=o)throw Error(c(301));if(o+=1,bt=Ve=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}k.H=Wm,d=t(l,i)}while(js);return d}function Bj(){var e=k.H,t=e.useState()[0];return t=typeof t.then=="function"?Oi(t):t,e=e.useState()[0],(Ve!==null?Ve.memoizedState:null)!==e&&(we.flags|=1024),t}function vu(){var e=ac!==0;return ac=0,e}function xu(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function ju(e){if(nc){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}nc=!1}ra=0,bt=Ve=we=null,js=!1,Ai=ac=0,bs=null}function Ht(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?we.memoizedState=bt=e:bt=bt.next=e,bt}function gt(){if(Ve===null){var e=we.alternate;e=e!==null?e.memoizedState:null}else e=Ve.next;var t=bt===null?we.memoizedState:bt.next;if(t!==null)bt=t,Ve=e;else{if(e===null)throw we.alternate===null?Error(c(467)):Error(c(310));Ve=e,e={memoizedState:Ve.memoizedState,baseState:Ve.baseState,baseQueue:Ve.baseQueue,queue:Ve.queue,next:null},bt===null?we.memoizedState=bt=e:bt=bt.next=e}return bt}function lc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Oi(e){var t=Ai;return Ai+=1,bs===null&&(bs=[]),e=rm(bs,e,t),t=we,(bt===null?t.memoizedState:bt.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?Zm:ku),e}function sc(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Oi(e);if(e.$$typeof===q)return Dt(e)}throw Error(c(438,String(e)))}function bu(e){var t=null,l=we.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var i=we.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=lc(),we.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),i=0;i<e;i++)l[i]=pe;return t.index++,l}function ca(e,t){return typeof t=="function"?t(e):t}function ic(e){var t=gt();return Su(t,Ve,e)}function Su(e,t,l){var i=e.queue;if(i===null)throw Error(c(311));i.lastRenderedReducer=l;var o=e.baseQueue,d=i.pending;if(d!==null){if(o!==null){var y=o.next;o.next=d.next,d.next=y}t.baseQueue=o=d,i.pending=null}if(d=e.baseState,o===null)e.memoizedState=d;else{t=o.next;var b=y=null,w=null,_=t,I=!1;do{var V=_.lane&-536870913;if(V!==_.lane?(qe&V)===V:(ra&V)===V){var Q=_.revertLane;if(Q===0)w!==null&&(w=w.next={lane:0,revertLane:0,gesture:null,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null}),V===ps&&(I=!0);else if((ra&Q)===Q){_=_.next,Q===ps&&(I=!0);continue}else V={lane:0,revertLane:_.revertLane,gesture:null,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},w===null?(b=w=V,y=d):w=w.next=V,we.lanes|=Q,Ya|=Q;V=_.action,Dl&&l(d,V),d=_.hasEagerState?_.eagerState:l(d,V)}else Q={lane:V,revertLane:_.revertLane,gesture:_.gesture,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},w===null?(b=w=Q,y=d):w=w.next=Q,we.lanes|=V,Ya|=V;_=_.next}while(_!==null&&_!==t);if(w===null?y=d:w.next=b,!nn(d,e.memoizedState)&&(St=!0,I&&(l=ys,l!==null)))throw l;e.memoizedState=d,e.baseState=y,e.baseQueue=w,i.lastRenderedState=d}return o===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Nu(e){var t=gt(),l=t.queue;if(l===null)throw Error(c(311));l.lastRenderedReducer=e;var i=l.dispatch,o=l.pending,d=t.memoizedState;if(o!==null){l.pending=null;var y=o=o.next;do d=e(d,y.action),y=y.next;while(y!==o);nn(d,t.memoizedState)||(St=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),l.lastRenderedState=d}return[d,i]}function vm(e,t,l){var i=we,o=gt(),d=Le;if(d){if(l===void 0)throw Error(c(407));l=l()}else l=t();var y=!nn((Ve||o).memoizedState,l);if(y&&(o.memoizedState=l,St=!0),o=o.queue,Tu(bm.bind(null,i,o,e),[e]),o.getSnapshot!==t||y||bt!==null&&bt.memoizedState.tag&1){if(i.flags|=2048,Ss(9,{destroy:void 0},jm.bind(null,i,o,l,t),null),We===null)throw Error(c(349));d||(ra&127)!==0||xm(i,t,l)}return l}function xm(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=we.updateQueue,t===null?(t=lc(),we.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function jm(e,t,l,i){t.value=l,t.getSnapshot=i,Sm(t)&&Nm(e)}function bm(e,t,l){return l(function(){Sm(t)&&Nm(e)})}function Sm(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!nn(e,l)}catch{return!0}}function Nm(e){var t=El(e,2);t!==null&&Zt(t,e,2)}function Cu(e){var t=Ht();if(typeof e=="function"){var l=e;if(e=l(),Dl){ke(!0);try{l()}finally{ke(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ca,lastRenderedState:e},t}function Cm(e,t,l,i){return e.baseState=l,Su(e,Ve,typeof i=="function"?i:ca)}function Lj(e,t,l,i,o){if(oc(e))throw Error(c(485));if(e=t.action,e!==null){var d={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){d.listeners.push(y)}};k.T!==null?l(!0):d.isTransition=!1,i(d),l=t.pending,l===null?(d.next=t.pending=d,Em(t,d)):(d.next=l.next,t.pending=l.next=d)}}function Em(e,t){var l=t.action,i=t.payload,o=e.state;if(t.isTransition){var d=k.T,y={};k.T=y;try{var b=l(o,i),w=k.S;w!==null&&w(y,b),Tm(e,t,b)}catch(_){Eu(e,t,_)}finally{d!==null&&y.types!==null&&(d.types=y.types),k.T=d}}else try{d=l(o,i),Tm(e,t,d)}catch(_){Eu(e,t,_)}}function Tm(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(i){wm(e,t,i)},function(i){return Eu(e,t,i)}):wm(e,t,l)}function wm(e,t,l){t.status="fulfilled",t.value=l,Rm(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,Em(e,l)))}function Eu(e,t,l){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=l,Rm(t),t=t.next;while(t!==i)}e.action=null}function Rm(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Am(e,t){return t}function Om(e,t){if(Le){var l=We.formState;if(l!==null){e:{var i=we;if(Le){if(at){t:{for(var o=at,d=bn;o.nodeType!==8;){if(!d){o=null;break t}if(o=Nn(o.nextSibling),o===null){o=null;break t}}d=o.data,o=d==="F!"||d==="F"?o:null}if(o){at=Nn(o.nextSibling),i=o.data==="F!";break e}}La(i)}i=!1}i&&(t=l[0])}}return l=Ht(),l.memoizedState=l.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Am,lastRenderedState:t},l.queue=i,l=Xm.bind(null,we,i),i.dispatch=l,i=Cu(!1),d=Mu.bind(null,we,!1,i.queue),i=Ht(),o={state:t,dispatch:null,action:e,pending:null},i.queue=o,l=Lj.bind(null,we,o,d,l),o.dispatch=l,i.memoizedState=e,[t,l,!1]}function Mm(e){var t=gt();return km(t,Ve,e)}function km(e,t,l){if(t=Su(e,t,Am)[0],e=ic(ca)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=Oi(t)}catch(y){throw y===gs?Vr:y}else i=t;t=gt();var o=t.queue,d=o.dispatch;return l!==t.memoizedState&&(we.flags|=2048,Ss(9,{destroy:void 0},_j.bind(null,o,l),null)),[i,d,e]}function _j(e,t){e.action=t}function zm(e){var t=gt(),l=Ve;if(l!==null)return km(t,l,e);gt(),t=t.memoizedState,l=gt();var i=l.queue.dispatch;return l.memoizedState=e,[t,i,!1]}function Ss(e,t,l,i){return e={tag:e,create:l,deps:i,inst:t,next:null},t=we.updateQueue,t===null&&(t=lc(),we.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(i=l.next,l.next=e,e.next=i,t.lastEffect=e),e}function Dm(){return gt().memoizedState}function rc(e,t,l,i){var o=Ht();we.flags|=e,o.memoizedState=Ss(1|t,{destroy:void 0},l,i===void 0?null:i)}function cc(e,t,l,i){var o=gt();i=i===void 0?null:i;var d=o.memoizedState.inst;Ve!==null&&i!==null&&yu(i,Ve.memoizedState.deps)?o.memoizedState=Ss(t,d,l,i):(we.flags|=e,o.memoizedState=Ss(1|t,d,l,i))}function qm(e,t){rc(8390656,8,e,t)}function Tu(e,t){cc(2048,8,e,t)}function Uj(e){we.flags|=4;var t=we.updateQueue;if(t===null)t=lc(),we.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function Bm(e){var t=gt().memoizedState;return Uj({ref:t,nextImpl:e}),function(){if(($e&2)!==0)throw Error(c(440));return t.impl.apply(void 0,arguments)}}function Lm(e,t){return cc(4,2,e,t)}function _m(e,t){return cc(4,4,e,t)}function Um(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Qm(e,t,l){l=l!=null?l.concat([e]):null,cc(4,4,Um.bind(null,t,e),l)}function wu(){}function $m(e,t){var l=gt();t=t===void 0?null:t;var i=l.memoizedState;return t!==null&&yu(t,i[1])?i[0]:(l.memoizedState=[e,t],e)}function Hm(e,t){var l=gt();t=t===void 0?null:t;var i=l.memoizedState;if(t!==null&&yu(t,i[1]))return i[0];if(i=e(),Dl){ke(!0);try{e()}finally{ke(!1)}}return l.memoizedState=[i,t],i}function Ru(e,t,l){return l===void 0||(ra&1073741824)!==0&&(qe&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=Kp(),we.lanes|=e,Ya|=e,l)}function Km(e,t,l,i){return nn(l,t)?l:xs.current!==null?(e=Ru(e,l,i),nn(e,t)||(St=!0),e):(ra&42)===0||(ra&1073741824)!==0&&(qe&261930)===0?(St=!0,e.memoizedState=l):(e=Kp(),we.lanes|=e,Ya|=e,t)}function Gm(e,t,l,i,o){var d=Z.p;Z.p=d!==0&&8>d?d:8;var y=k.T,b={};k.T=b,Mu(e,!1,t,l);try{var w=o(),_=k.S;if(_!==null&&_(b,w),w!==null&&typeof w=="object"&&typeof w.then=="function"){var I=Dj(w,i);Mi(e,t,I,on(e))}else Mi(e,t,i,on(e))}catch(V){Mi(e,t,{then:function(){},status:"rejected",reason:V},on())}finally{Z.p=d,y!==null&&b.types!==null&&(y.types=b.types),k.T=y}}function Qj(){}function Au(e,t,l,i){if(e.tag!==5)throw Error(c(476));var o=Im(e).queue;Gm(e,o,t,ne,l===null?Qj:function(){return Ym(e),l(i)})}function Im(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ca,lastRenderedState:ne},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ca,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ym(e){var t=Im(e);t.next===null&&(t=e.alternate.memoizedState),Mi(e,t.next.queue,{},on())}function Ou(){return Dt(Fi)}function Pm(){return gt().memoizedState}function Fm(){return gt().memoizedState}function $j(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=on();e=Qa(l);var i=$a(t,e,l);i!==null&&(Zt(i,t,l),Ti(i,t,l)),t={cache:su()},e.payload=t;return}t=t.return}}function Hj(e,t,l){var i=on();l={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},oc(e)?Vm(t,l):(l=Fo(e,t,l,i),l!==null&&(Zt(l,e,i),Jm(l,t,i)))}function Xm(e,t,l){var i=on();Mi(e,t,l,i)}function Mi(e,t,l,i){var o={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(oc(e))Vm(t,o);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var y=t.lastRenderedState,b=d(y,l);if(o.hasEagerState=!0,o.eagerState=b,nn(b,y))return Kr(e,t,o,0),We===null&&Hr(),!1}catch{}finally{}if(l=Fo(e,t,o,i),l!==null)return Zt(l,e,i),Jm(l,t,i),!0}return!1}function Mu(e,t,l,i){if(i={lane:2,revertLane:od(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},oc(e)){if(t)throw Error(c(479))}else t=Fo(e,l,i,2),t!==null&&Zt(t,e,2)}function oc(e){var t=e.alternate;return e===we||t!==null&&t===we}function Vm(e,t){js=nc=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Jm(e,t,l){if((l&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,nh(e,l)}}var ki={readContext:Dt,use:sc,useCallback:ht,useContext:ht,useEffect:ht,useImperativeHandle:ht,useLayoutEffect:ht,useInsertionEffect:ht,useMemo:ht,useReducer:ht,useRef:ht,useState:ht,useDebugValue:ht,useDeferredValue:ht,useTransition:ht,useSyncExternalStore:ht,useId:ht,useHostTransitionStatus:ht,useFormState:ht,useActionState:ht,useOptimistic:ht,useMemoCache:ht,useCacheRefresh:ht};ki.useEffectEvent=ht;var Zm={readContext:Dt,use:sc,useCallback:function(e,t){return Ht().memoizedState=[e,t===void 0?null:t],e},useContext:Dt,useEffect:qm,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,rc(4194308,4,Um.bind(null,t,e),l)},useLayoutEffect:function(e,t){return rc(4194308,4,e,t)},useInsertionEffect:function(e,t){rc(4,2,e,t)},useMemo:function(e,t){var l=Ht();t=t===void 0?null:t;var i=e();if(Dl){ke(!0);try{e()}finally{ke(!1)}}return l.memoizedState=[i,t],i},useReducer:function(e,t,l){var i=Ht();if(l!==void 0){var o=l(t);if(Dl){ke(!0);try{l(t)}finally{ke(!1)}}}else o=t;return i.memoizedState=i.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},i.queue=e,e=e.dispatch=Hj.bind(null,we,e),[i.memoizedState,e]},useRef:function(e){var t=Ht();return e={current:e},t.memoizedState=e},useState:function(e){e=Cu(e);var t=e.queue,l=Xm.bind(null,we,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:wu,useDeferredValue:function(e,t){var l=Ht();return Ru(l,e,t)},useTransition:function(){var e=Cu(!1);return e=Gm.bind(null,we,e.queue,!0,!1),Ht().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var i=we,o=Ht();if(Le){if(l===void 0)throw Error(c(407));l=l()}else{if(l=t(),We===null)throw Error(c(349));(qe&127)!==0||xm(i,t,l)}o.memoizedState=l;var d={value:l,getSnapshot:t};return o.queue=d,qm(bm.bind(null,i,d,e),[e]),i.flags|=2048,Ss(9,{destroy:void 0},jm.bind(null,i,d,l,t),null),l},useId:function(){var e=Ht(),t=We.identifierPrefix;if(Le){var l=Kn,i=Hn;l=(i&~(1<<32-xt(i)-1)).toString(32)+l,t="_"+t+"R_"+l,l=ac++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=qj++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Ou,useFormState:Om,useActionState:Om,useOptimistic:function(e){var t=Ht();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Mu.bind(null,we,!0,l),l.dispatch=t,[e,t]},useMemoCache:bu,useCacheRefresh:function(){return Ht().memoizedState=$j.bind(null,we)},useEffectEvent:function(e){var t=Ht(),l={impl:e};return t.memoizedState=l,function(){if(($e&2)!==0)throw Error(c(440));return l.impl.apply(void 0,arguments)}}},ku={readContext:Dt,use:sc,useCallback:$m,useContext:Dt,useEffect:Tu,useImperativeHandle:Qm,useInsertionEffect:Lm,useLayoutEffect:_m,useMemo:Hm,useReducer:ic,useRef:Dm,useState:function(){return ic(ca)},useDebugValue:wu,useDeferredValue:function(e,t){var l=gt();return Km(l,Ve.memoizedState,e,t)},useTransition:function(){var e=ic(ca)[0],t=gt().memoizedState;return[typeof e=="boolean"?e:Oi(e),t]},useSyncExternalStore:vm,useId:Pm,useHostTransitionStatus:Ou,useFormState:Mm,useActionState:Mm,useOptimistic:function(e,t){var l=gt();return Cm(l,Ve,e,t)},useMemoCache:bu,useCacheRefresh:Fm};ku.useEffectEvent=Bm;var Wm={readContext:Dt,use:sc,useCallback:$m,useContext:Dt,useEffect:Tu,useImperativeHandle:Qm,useInsertionEffect:Lm,useLayoutEffect:_m,useMemo:Hm,useReducer:Nu,useRef:Dm,useState:function(){return Nu(ca)},useDebugValue:wu,useDeferredValue:function(e,t){var l=gt();return Ve===null?Ru(l,e,t):Km(l,Ve.memoizedState,e,t)},useTransition:function(){var e=Nu(ca)[0],t=gt().memoizedState;return[typeof e=="boolean"?e:Oi(e),t]},useSyncExternalStore:vm,useId:Pm,useHostTransitionStatus:Ou,useFormState:zm,useActionState:zm,useOptimistic:function(e,t){var l=gt();return Ve!==null?Cm(l,Ve,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:bu,useCacheRefresh:Fm};Wm.useEffectEvent=Bm;function zu(e,t,l,i){t=e.memoizedState,l=l(i,t),l=l==null?t:x({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Du={enqueueSetState:function(e,t,l){e=e._reactInternals;var i=on(),o=Qa(i);o.payload=t,l!=null&&(o.callback=l),t=$a(e,o,i),t!==null&&(Zt(t,e,i),Ti(t,e,i))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var i=on(),o=Qa(i);o.tag=1,o.payload=t,l!=null&&(o.callback=l),t=$a(e,o,i),t!==null&&(Zt(t,e,i),Ti(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=on(),i=Qa(l);i.tag=2,t!=null&&(i.callback=t),t=$a(e,i,l),t!==null&&(Zt(t,e,l),Ti(t,e,l))}};function ep(e,t,l,i,o,d,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,d,y):t.prototype&&t.prototype.isPureReactComponent?!vi(l,i)||!vi(o,d):!0}function tp(e,t,l,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,i),t.state!==e&&Du.enqueueReplaceState(t,t.state,null)}function ql(e,t){var l=t;if("ref"in t){l={};for(var i in t)i!=="ref"&&(l[i]=t[i])}if(e=e.defaultProps){l===t&&(l=x({},l));for(var o in e)l[o]===void 0&&(l[o]=e[o])}return l}function np(e){$r(e)}function ap(e){console.error(e)}function lp(e){$r(e)}function uc(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function sp(e,t,l){try{var i=e.onCaughtError;i(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function qu(e,t,l){return l=Qa(l),l.tag=3,l.payload={element:null},l.callback=function(){uc(e,t)},l}function ip(e){return e=Qa(e),e.tag=3,e}function rp(e,t,l,i){var o=l.type.getDerivedStateFromError;if(typeof o=="function"){var d=i.value;e.payload=function(){return o(d)},e.callback=function(){sp(t,l,i)}}var y=l.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){sp(t,l,i),typeof o!="function"&&(Pa===null?Pa=new Set([this]):Pa.add(this));var b=i.stack;this.componentDidCatch(i.value,{componentStack:b!==null?b:""})})}function Kj(e,t,l,i,o){if(l.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=l.alternate,t!==null&&ms(t,l,o,!0),l=ln.current,l!==null){switch(l.tag){case 31:case 13:return Sn===null?Sc():l.alternate===null&&mt===0&&(mt=3),l.flags&=-257,l.flags|=65536,l.lanes=o,i===Jr?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([i]):t.add(i),id(e,i,o)),!1;case 22:return l.flags|=65536,i===Jr?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([i]):l.add(i)),id(e,i,o)),!1}throw Error(c(435,l.tag))}return id(e,i,o),Sc(),!1}if(Le)return t=ln.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,i!==eu&&(e=Error(c(422),{cause:i}),bi(vn(e,l)))):(i!==eu&&(t=Error(c(423),{cause:i}),bi(vn(t,l))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,i=vn(i,l),o=qu(e.stateNode,i,o),du(e,o),mt!==4&&(mt=2)),!1;var d=Error(c(520),{cause:i});if(d=vn(d,l),Qi===null?Qi=[d]:Qi.push(d),mt!==4&&(mt=2),t===null)return!0;i=vn(i,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=o&-o,l.lanes|=e,e=qu(l.stateNode,i,e),du(l,e),!1;case 1:if(t=l.type,d=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(Pa===null||!Pa.has(d))))return l.flags|=65536,o&=-o,l.lanes|=o,o=ip(o),rp(o,e,l,i),du(l,o),!1}l=l.return}while(l!==null);return!1}var Bu=Error(c(461)),St=!1;function qt(e,t,l,i){t.child=e===null?dm(t,null,l,i):zl(t,e.child,l,i)}function cp(e,t,l,i,o){l=l.render;var d=t.ref;if("ref"in i){var y={};for(var b in i)b!=="ref"&&(y[b]=i[b])}else y=i;return Al(t),i=gu(e,t,l,y,d,o),b=vu(),e!==null&&!St?(xu(e,t,o),oa(e,t,o)):(Le&&b&&Zo(t),t.flags|=1,qt(e,t,i,o),t.child)}function op(e,t,l,i,o){if(e===null){var d=l.type;return typeof d=="function"&&!Xo(d)&&d.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=d,up(e,t,d,i,o)):(e=Ir(l.type,null,i,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Gu(e,o)){var y=d.memoizedProps;if(l=l.compare,l=l!==null?l:vi,l(y,i)&&e.ref===t.ref)return oa(e,t,o)}return t.flags|=1,e=aa(d,i),e.ref=t.ref,e.return=t,t.child=e}function up(e,t,l,i,o){if(e!==null){var d=e.memoizedProps;if(vi(d,i)&&e.ref===t.ref)if(St=!1,t.pendingProps=i=d,Gu(e,o))(e.flags&131072)!==0&&(St=!0);else return t.lanes=e.lanes,oa(e,t,o)}return Lu(e,t,l,i,o)}function dp(e,t,l,i){var o=i.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|l:l,e!==null){for(i=t.child=e.child,o=0;i!==null;)o=o|i.lanes|i.childLanes,i=i.sibling;i=o&~d}else i=0,t.child=null;return fp(e,t,d,l,i)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Xr(t,d!==null?d.cachePool:null),d!==null?mm(t,d):hu(),pm(t);else return i=t.lanes=536870912,fp(e,t,d!==null?d.baseLanes|l:l,l,i)}else d!==null?(Xr(t,d.cachePool),mm(t,d),Ka(),t.memoizedState=null):(e!==null&&Xr(t,null),hu(),Ka());return qt(e,t,o,l),t.child}function zi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function fp(e,t,l,i,o){var d=ru();return d=d===null?null:{parent:jt._currentValue,pool:d},t.memoizedState={baseLanes:l,cachePool:d},e!==null&&Xr(t,null),hu(),pm(t),e!==null&&ms(e,t,i,!0),t.childLanes=o,null}function dc(e,t){return t=hc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function hp(e,t,l){return zl(t,e.child,null,l),e=dc(t,t.pendingProps),e.flags|=2,sn(t),t.memoizedState=null,e}function Gj(e,t,l){var i=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Le){if(i.mode==="hidden")return e=dc(t,i),t.lanes=536870912,zi(null,e);if(pu(t),(e=at)?(e=Ey(e,bn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:qa!==null?{id:Hn,overflow:Kn}:null,retryLane:536870912,hydrationErrors:null},l=Vh(e),l.return=t,t.child=l,zt=t,at=null)):e=null,e===null)throw La(t);return t.lanes=536870912,null}return dc(t,i)}var d=e.memoizedState;if(d!==null){var y=d.dehydrated;if(pu(t),o)if(t.flags&256)t.flags&=-257,t=hp(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(c(558));else if(St||ms(e,t,l,!1),o=(l&e.childLanes)!==0,St||o){if(i=We,i!==null&&(y=ah(i,l),y!==0&&y!==d.retryLane))throw d.retryLane=y,El(e,y),Zt(i,e,y),Bu;Sc(),t=hp(e,t,l)}else e=d.treeContext,at=Nn(y.nextSibling),zt=t,Le=!0,Ba=null,bn=!1,e!==null&&Wh(t,e),t=dc(t,i),t.flags|=4096;return t}return e=aa(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function fc(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(c(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Lu(e,t,l,i,o){return Al(t),l=gu(e,t,l,i,void 0,o),i=vu(),e!==null&&!St?(xu(e,t,o),oa(e,t,o)):(Le&&i&&Zo(t),t.flags|=1,qt(e,t,l,o),t.child)}function mp(e,t,l,i,o,d){return Al(t),t.updateQueue=null,l=gm(t,i,l,o),ym(e),i=vu(),e!==null&&!St?(xu(e,t,d),oa(e,t,d)):(Le&&i&&Zo(t),t.flags|=1,qt(e,t,l,d),t.child)}function pp(e,t,l,i,o){if(Al(t),t.stateNode===null){var d=us,y=l.contextType;typeof y=="object"&&y!==null&&(d=Dt(y)),d=new l(i,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Du,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=i,d.state=t.memoizedState,d.refs={},ou(t),y=l.contextType,d.context=typeof y=="object"&&y!==null?Dt(y):us,d.state=t.memoizedState,y=l.getDerivedStateFromProps,typeof y=="function"&&(zu(t,l,y,i),d.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(y=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),y!==d.state&&Du.enqueueReplaceState(d,d.state,null),Ri(t,i,d,o),wi(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){d=t.stateNode;var b=t.memoizedProps,w=ql(l,b);d.props=w;var _=d.context,I=l.contextType;y=us,typeof I=="object"&&I!==null&&(y=Dt(I));var V=l.getDerivedStateFromProps;I=typeof V=="function"||typeof d.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,I||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b||_!==y)&&tp(t,d,i,y),Ua=!1;var Q=t.memoizedState;d.state=Q,Ri(t,i,d,o),wi(),_=t.memoizedState,b||Q!==_||Ua?(typeof V=="function"&&(zu(t,l,V,i),_=t.memoizedState),(w=Ua||ep(t,l,w,i,Q,_,y))?(I||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=_),d.props=i,d.state=_,d.context=y,i=w):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{d=t.stateNode,uu(e,t),y=t.memoizedProps,I=ql(l,y),d.props=I,V=t.pendingProps,Q=d.context,_=l.contextType,w=us,typeof _=="object"&&_!==null&&(w=Dt(_)),b=l.getDerivedStateFromProps,(_=typeof b=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(y!==V||Q!==w)&&tp(t,d,i,w),Ua=!1,Q=t.memoizedState,d.state=Q,Ri(t,i,d,o),wi();var H=t.memoizedState;y!==V||Q!==H||Ua||e!==null&&e.dependencies!==null&&Pr(e.dependencies)?(typeof b=="function"&&(zu(t,l,b,i),H=t.memoizedState),(I=Ua||ep(t,l,I,i,Q,H,w)||e!==null&&e.dependencies!==null&&Pr(e.dependencies))?(_||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(i,H,w),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(i,H,w)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&Q===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&Q===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=H),d.props=i,d.state=H,d.context=w,i=I):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&Q===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&Q===e.memoizedState||(t.flags|=1024),i=!1)}return d=i,fc(e,t),i=(t.flags&128)!==0,d||i?(d=t.stateNode,l=i&&typeof l.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&i?(t.child=zl(t,e.child,null,o),t.child=zl(t,null,l,o)):qt(e,t,l,o),t.memoizedState=d.state,e=t.child):e=oa(e,t,o),e}function yp(e,t,l,i){return wl(),t.flags|=256,qt(e,t,l,i),t.child}var _u={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Uu(e){return{baseLanes:e,cachePool:sm()}}function Qu(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=cn),e}function gp(e,t,l){var i=t.pendingProps,o=!1,d=(t.flags&128)!==0,y;if((y=d)||(y=e!==null&&e.memoizedState===null?!1:(yt.current&2)!==0),y&&(o=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(Le){if(o?Ha(t):Ka(),(e=at)?(e=Ey(e,bn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:qa!==null?{id:Hn,overflow:Kn}:null,retryLane:536870912,hydrationErrors:null},l=Vh(e),l.return=t,t.child=l,zt=t,at=null)):e=null,e===null)throw La(t);return Sd(e)?t.lanes=32:t.lanes=536870912,null}var b=i.children;return i=i.fallback,o?(Ka(),o=t.mode,b=hc({mode:"hidden",children:b},o),i=Tl(i,o,l,null),b.return=t,i.return=t,b.sibling=i,t.child=b,i=t.child,i.memoizedState=Uu(l),i.childLanes=Qu(e,y,l),t.memoizedState=_u,zi(null,i)):(Ha(t),$u(t,b))}var w=e.memoizedState;if(w!==null&&(b=w.dehydrated,b!==null)){if(d)t.flags&256?(Ha(t),t.flags&=-257,t=Hu(e,t,l)):t.memoizedState!==null?(Ka(),t.child=e.child,t.flags|=128,t=null):(Ka(),b=i.fallback,o=t.mode,i=hc({mode:"visible",children:i.children},o),b=Tl(b,o,l,null),b.flags|=2,i.return=t,b.return=t,i.sibling=b,t.child=i,zl(t,e.child,null,l),i=t.child,i.memoizedState=Uu(l),i.childLanes=Qu(e,y,l),t.memoizedState=_u,t=zi(null,i));else if(Ha(t),Sd(b)){if(y=b.nextSibling&&b.nextSibling.dataset,y)var _=y.dgst;y=_,i=Error(c(419)),i.stack="",i.digest=y,bi({value:i,source:null,stack:null}),t=Hu(e,t,l)}else if(St||ms(e,t,l,!1),y=(l&e.childLanes)!==0,St||y){if(y=We,y!==null&&(i=ah(y,l),i!==0&&i!==w.retryLane))throw w.retryLane=i,El(e,i),Zt(y,e,i),Bu;bd(b)||Sc(),t=Hu(e,t,l)}else bd(b)?(t.flags|=192,t.child=e.child,t=null):(e=w.treeContext,at=Nn(b.nextSibling),zt=t,Le=!0,Ba=null,bn=!1,e!==null&&Wh(t,e),t=$u(t,i.children),t.flags|=4096);return t}return o?(Ka(),b=i.fallback,o=t.mode,w=e.child,_=w.sibling,i=aa(w,{mode:"hidden",children:i.children}),i.subtreeFlags=w.subtreeFlags&65011712,_!==null?b=aa(_,b):(b=Tl(b,o,l,null),b.flags|=2),b.return=t,i.return=t,i.sibling=b,t.child=i,zi(null,i),i=t.child,b=e.child.memoizedState,b===null?b=Uu(l):(o=b.cachePool,o!==null?(w=jt._currentValue,o=o.parent!==w?{parent:w,pool:w}:o):o=sm(),b={baseLanes:b.baseLanes|l,cachePool:o}),i.memoizedState=b,i.childLanes=Qu(e,y,l),t.memoizedState=_u,zi(e.child,i)):(Ha(t),l=e.child,e=l.sibling,l=aa(l,{mode:"visible",children:i.children}),l.return=t,l.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=l,t.memoizedState=null,l)}function $u(e,t){return t=hc({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function hc(e,t){return e=an(22,e,null,t),e.lanes=0,e}function Hu(e,t,l){return zl(t,e.child,null,l),e=$u(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function vp(e,t,l){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),au(e.return,t,l)}function Ku(e,t,l,i,o,d){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:l,tailMode:o,treeForkCount:d}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=i,y.tail=l,y.tailMode=o,y.treeForkCount=d)}function xp(e,t,l){var i=t.pendingProps,o=i.revealOrder,d=i.tail;i=i.children;var y=yt.current,b=(y&2)!==0;if(b?(y=y&1|2,t.flags|=128):y&=1,W(yt,y),qt(e,t,i,l),i=Le?ji:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&vp(e,l,t);else if(e.tag===19)vp(e,l,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(o){case"forwards":for(l=t.child,o=null;l!==null;)e=l.alternate,e!==null&&tc(e)===null&&(o=l),l=l.sibling;l=o,l===null?(o=t.child,t.child=null):(o=l.sibling,l.sibling=null),Ku(t,!1,o,l,d,i);break;case"backwards":case"unstable_legacy-backwards":for(l=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&tc(e)===null){t.child=o;break}e=o.sibling,o.sibling=l,l=o,o=e}Ku(t,!0,l,null,d,i);break;case"together":Ku(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function oa(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),Ya|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(ms(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(c(153));if(t.child!==null){for(e=t.child,l=aa(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=aa(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Gu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Pr(e)))}function Ij(e,t,l){switch(t.tag){case 3:se(t,t.stateNode.containerInfo),_a(t,jt,e.memoizedState.cache),wl();break;case 27:case 5:et(t);break;case 4:se(t,t.stateNode.containerInfo);break;case 10:_a(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,pu(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(Ha(t),t.flags|=128,null):(l&t.child.childLanes)!==0?gp(e,t,l):(Ha(t),e=oa(e,t,l),e!==null?e.sibling:null);Ha(t);break;case 19:var o=(e.flags&128)!==0;if(i=(l&t.childLanes)!==0,i||(ms(e,t,l,!1),i=(l&t.childLanes)!==0),o){if(i)return xp(e,t,l);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),W(yt,yt.current),i)break;return null;case 22:return t.lanes=0,dp(e,t,l,t.pendingProps);case 24:_a(t,jt,e.memoizedState.cache)}return oa(e,t,l)}function jp(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)St=!0;else{if(!Gu(e,l)&&(t.flags&128)===0)return St=!1,Ij(e,t,l);St=(e.flags&131072)!==0}else St=!1,Le&&(t.flags&1048576)!==0&&Zh(t,ji,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Ml(t.elementType),t.type=e,typeof e=="function")Xo(e)?(i=ql(e,i),t.tag=1,t=pp(null,t,e,i,l)):(t.tag=0,t=Lu(null,t,e,i,l));else{if(e!=null){var o=e.$$typeof;if(o===z){t.tag=11,t=cp(null,t,e,i,l);break e}else if(o===G){t.tag=14,t=op(null,t,e,i,l);break e}}throw t=me(e)||e,Error(c(306,t,""))}}return t;case 0:return Lu(e,t,t.type,t.pendingProps,l);case 1:return i=t.type,o=ql(i,t.pendingProps),pp(e,t,i,o,l);case 3:e:{if(se(t,t.stateNode.containerInfo),e===null)throw Error(c(387));i=t.pendingProps;var d=t.memoizedState;o=d.element,uu(e,t),Ri(t,i,null,l);var y=t.memoizedState;if(i=y.cache,_a(t,jt,i),i!==d.cache&&lu(t,[jt],l,!0),wi(),i=y.element,d.isDehydrated)if(d={element:i,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=yp(e,t,i,l);break e}else if(i!==o){o=vn(Error(c(424)),t),bi(o),t=yp(e,t,i,l);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(at=Nn(e.firstChild),zt=t,Le=!0,Ba=null,bn=!0,l=dm(t,null,i,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(wl(),i===o){t=oa(e,t,l);break e}qt(e,t,i,l)}t=t.child}return t;case 26:return fc(e,t),e===null?(l=My(t.type,null,t.pendingProps,null))?t.memoizedState=l:Le||(l=t.type,e=t.pendingProps,i=Ac(oe.current).createElement(l),i[kt]=t,i[Yt]=e,Bt(i,l,e),Rt(i),t.stateNode=i):t.memoizedState=My(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return et(t),e===null&&Le&&(i=t.stateNode=Ry(t.type,t.pendingProps,oe.current),zt=t,bn=!0,o=at,Ja(t.type)?(Nd=o,at=Nn(i.firstChild)):at=o),qt(e,t,t.pendingProps.children,l),fc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Le&&((o=i=at)&&(i=bb(i,t.type,t.pendingProps,bn),i!==null?(t.stateNode=i,zt=t,at=Nn(i.firstChild),bn=!1,o=!0):o=!1),o||La(t)),et(t),o=t.type,d=t.pendingProps,y=e!==null?e.memoizedProps:null,i=d.children,vd(o,d)?i=null:y!==null&&vd(o,y)&&(t.flags|=32),t.memoizedState!==null&&(o=gu(e,t,Bj,null,null,l),Fi._currentValue=o),fc(e,t),qt(e,t,i,l),t.child;case 6:return e===null&&Le&&((e=l=at)&&(l=Sb(l,t.pendingProps,bn),l!==null?(t.stateNode=l,zt=t,at=null,e=!0):e=!1),e||La(t)),null;case 13:return gp(e,t,l);case 4:return se(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=zl(t,null,i,l):qt(e,t,i,l),t.child;case 11:return cp(e,t,t.type,t.pendingProps,l);case 7:return qt(e,t,t.pendingProps,l),t.child;case 8:return qt(e,t,t.pendingProps.children,l),t.child;case 12:return qt(e,t,t.pendingProps.children,l),t.child;case 10:return i=t.pendingProps,_a(t,t.type,i.value),qt(e,t,i.children,l),t.child;case 9:return o=t.type._context,i=t.pendingProps.children,Al(t),o=Dt(o),i=i(o),t.flags|=1,qt(e,t,i,l),t.child;case 14:return op(e,t,t.type,t.pendingProps,l);case 15:return up(e,t,t.type,t.pendingProps,l);case 19:return xp(e,t,l);case 31:return Gj(e,t,l);case 22:return dp(e,t,l,t.pendingProps);case 24:return Al(t),i=Dt(jt),e===null?(o=ru(),o===null&&(o=We,d=su(),o.pooledCache=d,d.refCount++,d!==null&&(o.pooledCacheLanes|=l),o=d),t.memoizedState={parent:i,cache:o},ou(t),_a(t,jt,o)):((e.lanes&l)!==0&&(uu(e,t),Ri(t,null,null,l),wi()),o=e.memoizedState,d=t.memoizedState,o.parent!==i?(o={parent:i,cache:i},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),_a(t,jt,i)):(i=d.cache,_a(t,jt,i),i!==o.cache&&lu(t,[jt],l,!0))),qt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(c(156,t.tag))}function ua(e){e.flags|=4}function Iu(e,t,l,i,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(Pp())e.flags|=8192;else throw kl=Jr,cu}else e.flags&=-16777217}function bp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!By(t))if(Pp())e.flags|=8192;else throw kl=Jr,cu}function mc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?eh():536870912,e.lanes|=t,Ts|=t)}function Di(e,t){if(!Le)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var i=null;l!==null;)l.alternate!==null&&(i=l),l=l.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function lt(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,i=0;if(t)for(var o=e.child;o!==null;)l|=o.lanes|o.childLanes,i|=o.subtreeFlags&65011712,i|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)l|=o.lanes|o.childLanes,i|=o.subtreeFlags,i|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=i,e.childLanes=l,t}function Yj(e,t,l){var i=t.pendingProps;switch(Wo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return lt(t),null;case 1:return lt(t),null;case 3:return l=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),ia(jt),re(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(hs(t)?ua(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,tu())),lt(t),null;case 26:var o=t.type,d=t.memoizedState;return e===null?(ua(t),d!==null?(lt(t),bp(t,d)):(lt(t),Iu(t,o,null,i,l))):d?d!==e.memoizedState?(ua(t),lt(t),bp(t,d)):(lt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&ua(t),lt(t),Iu(t,o,e,i,l)),null;case 27:if(dt(t),l=oe.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ua(t);else{if(!i){if(t.stateNode===null)throw Error(c(166));return lt(t),null}e=le.current,hs(t)?em(t):(e=Ry(o,i,l),t.stateNode=e,ua(t))}return lt(t),null;case 5:if(dt(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ua(t);else{if(!i){if(t.stateNode===null)throw Error(c(166));return lt(t),null}if(d=le.current,hs(t))em(t);else{var y=Ac(oe.current);switch(d){case 1:d=y.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:d=y.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":d=y.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":d=y.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":d=y.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof i.is=="string"?y.createElement("select",{is:i.is}):y.createElement("select"),i.multiple?d.multiple=!0:i.size&&(d.size=i.size);break;default:d=typeof i.is=="string"?y.createElement(o,{is:i.is}):y.createElement(o)}}d[kt]=t,d[Yt]=i;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)d.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=d;e:switch(Bt(d,o,i),o){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&ua(t)}}return lt(t),Iu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&ua(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(c(166));if(e=oe.current,hs(t)){if(e=t.stateNode,l=t.memoizedProps,i=null,o=zt,o!==null)switch(o.tag){case 27:case 5:i=o.memoizedProps}e[kt]=t,e=!!(e.nodeValue===l||i!==null&&i.suppressHydrationWarning===!0||gy(e.nodeValue,l)),e||La(t,!0)}else e=Ac(e).createTextNode(i),e[kt]=t,t.stateNode=e}return lt(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(i=hs(t),l!==null){if(e===null){if(!i)throw Error(c(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(557));e[kt]=t}else wl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;lt(t),e=!1}else l=tu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(sn(t),t):(sn(t),null);if((t.flags&128)!==0)throw Error(c(558))}return lt(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=hs(t),i!==null&&i.dehydrated!==null){if(e===null){if(!o)throw Error(c(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(c(317));o[kt]=t}else wl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;lt(t),o=!1}else o=tu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(sn(t),t):(sn(t),null)}return sn(t),(t.flags&128)!==0?(t.lanes=l,t):(l=i!==null,e=e!==null&&e.memoizedState!==null,l&&(i=t.child,o=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(o=i.alternate.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==o&&(i.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),mc(t,t.updateQueue),lt(t),null);case 4:return re(),e===null&&hd(t.stateNode.containerInfo),lt(t),null;case 10:return ia(t.type),lt(t),null;case 19:if(B(yt),i=t.memoizedState,i===null)return lt(t),null;if(o=(t.flags&128)!==0,d=i.rendering,d===null)if(o)Di(i,!1);else{if(mt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=tc(e),d!==null){for(t.flags|=128,Di(i,!1),e=d.updateQueue,t.updateQueue=e,mc(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Xh(l,e),l=l.sibling;return W(yt,yt.current&1|2),Le&&la(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&Ke()>xc&&(t.flags|=128,o=!0,Di(i,!1),t.lanes=4194304)}else{if(!o)if(e=tc(d),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,mc(t,e),Di(i,!0),i.tail===null&&i.tailMode==="hidden"&&!d.alternate&&!Le)return lt(t),null}else 2*Ke()-i.renderingStartTime>xc&&l!==536870912&&(t.flags|=128,o=!0,Di(i,!1),t.lanes=4194304);i.isBackwards?(d.sibling=t.child,t.child=d):(e=i.last,e!==null?e.sibling=d:t.child=d,i.last=d)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Ke(),e.sibling=null,l=yt.current,W(yt,o?l&1|2:l&1),Le&&la(t,i.treeForkCount),e):(lt(t),null);case 22:case 23:return sn(t),mu(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(l&536870912)!==0&&(t.flags&128)===0&&(lt(t),t.subtreeFlags&6&&(t.flags|=8192)):lt(t),l=t.updateQueue,l!==null&&mc(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==l&&(t.flags|=2048),e!==null&&B(Ol),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),ia(jt),lt(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function Pj(e,t){switch(Wo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ia(jt),re(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return dt(t),null;case 31:if(t.memoizedState!==null){if(sn(t),t.alternate===null)throw Error(c(340));wl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(sn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));wl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return B(yt),null;case 4:return re(),null;case 10:return ia(t.type),null;case 22:case 23:return sn(t),mu(),e!==null&&B(Ol),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ia(jt),null;case 25:return null;default:return null}}function Sp(e,t){switch(Wo(t),t.tag){case 3:ia(jt),re();break;case 26:case 27:case 5:dt(t);break;case 4:re();break;case 31:t.memoizedState!==null&&sn(t);break;case 13:sn(t);break;case 19:B(yt);break;case 10:ia(t.type);break;case 22:case 23:sn(t),mu(),e!==null&&B(Ol);break;case 24:ia(jt)}}function qi(e,t){try{var l=t.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var o=i.next;l=o;do{if((l.tag&e)===e){i=void 0;var d=l.create,y=l.inst;i=d(),y.destroy=i}l=l.next}while(l!==o)}}catch(b){Ie(t,t.return,b)}}function Ga(e,t,l){try{var i=t.updateQueue,o=i!==null?i.lastEffect:null;if(o!==null){var d=o.next;i=d;do{if((i.tag&e)===e){var y=i.inst,b=y.destroy;if(b!==void 0){y.destroy=void 0,o=t;var w=l,_=b;try{_()}catch(I){Ie(o,w,I)}}}i=i.next}while(i!==d)}}catch(I){Ie(t,t.return,I)}}function Np(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{hm(t,l)}catch(i){Ie(e,e.return,i)}}}function Cp(e,t,l){l.props=ql(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(i){Ie(e,t,i)}}function Bi(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof l=="function"?e.refCleanup=l(i):l.current=i}}catch(o){Ie(e,t,o)}}function Gn(e,t){var l=e.ref,i=e.refCleanup;if(l!==null)if(typeof i=="function")try{i()}catch(o){Ie(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(o){Ie(e,t,o)}else l.current=null}function Ep(e){var t=e.type,l=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break e;case"img":l.src?i.src=l.src:l.srcSet&&(i.srcset=l.srcSet)}}catch(o){Ie(e,e.return,o)}}function Yu(e,t,l){try{var i=e.stateNode;pb(i,e.type,l,t),i[Yt]=t}catch(o){Ie(e,e.return,o)}}function Tp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ja(e.type)||e.tag===4}function Pu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Tp(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&&Ja(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 Fu(e,t,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=ta));else if(i!==4&&(i===27&&Ja(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Fu(e,t,l),e=e.sibling;e!==null;)Fu(e,t,l),e=e.sibling}function pc(e,t,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(i!==4&&(i===27&&Ja(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(pc(e,t,l),e=e.sibling;e!==null;)pc(e,t,l),e=e.sibling}function wp(e){var t=e.stateNode,l=e.memoizedProps;try{for(var i=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);Bt(t,i,l),t[kt]=e,t[Yt]=l}catch(d){Ie(e,e.return,d)}}var da=!1,Nt=!1,Xu=!1,Rp=typeof WeakSet=="function"?WeakSet:Set,At=null;function Fj(e,t){if(e=e.containerInfo,yd=Bc,e=Qh(e),Ho(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var i=l.getSelection&&l.getSelection();if(i&&i.rangeCount!==0){l=i.anchorNode;var o=i.anchorOffset,d=i.focusNode;i=i.focusOffset;try{l.nodeType,d.nodeType}catch{l=null;break e}var y=0,b=-1,w=-1,_=0,I=0,V=e,Q=null;t:for(;;){for(var H;V!==l||o!==0&&V.nodeType!==3||(b=y+o),V!==d||i!==0&&V.nodeType!==3||(w=y+i),V.nodeType===3&&(y+=V.nodeValue.length),(H=V.firstChild)!==null;)Q=V,V=H;for(;;){if(V===e)break t;if(Q===l&&++_===o&&(b=y),Q===d&&++I===i&&(w=y),(H=V.nextSibling)!==null)break;V=Q,Q=V.parentNode}V=H}l=b===-1||w===-1?null:{start:b,end:w}}else l=null}l=l||{start:0,end:0}}else l=null;for(gd={focusedElem:e,selectionRange:l},Bc=!1,At=t;At!==null;)if(t=At,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,At=e;else for(;At!==null;){switch(t=At,d=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l<e.length;l++)o=e[l],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,l=t,o=d.memoizedProps,d=d.memoizedState,i=l.stateNode;try{var ue=ql(l.type,o);e=i.getSnapshotBeforeUpdate(ue,d),i.__reactInternalSnapshotBeforeUpdate=e}catch(Ne){Ie(l,l.return,Ne)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)jd(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":jd(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(c(163))}if(e=t.sibling,e!==null){e.return=t.return,At=e;break}At=t.return}}function Ap(e,t,l){var i=l.flags;switch(l.tag){case 0:case 11:case 15:ha(e,l),i&4&&qi(5,l);break;case 1:if(ha(e,l),i&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(y){Ie(l,l.return,y)}else{var o=ql(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Ie(l,l.return,y)}}i&64&&Np(l),i&512&&Bi(l,l.return);break;case 3:if(ha(e,l),i&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{hm(e,t)}catch(y){Ie(l,l.return,y)}}break;case 27:t===null&&i&4&&wp(l);case 26:case 5:ha(e,l),t===null&&i&4&&Ep(l),i&512&&Bi(l,l.return);break;case 12:ha(e,l);break;case 31:ha(e,l),i&4&&kp(e,l);break;case 13:ha(e,l),i&4&&zp(e,l),i&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=ab.bind(null,l),Nb(e,l))));break;case 22:if(i=l.memoizedState!==null||da,!i){t=t!==null&&t.memoizedState!==null||Nt,o=da;var d=Nt;da=i,(Nt=t)&&!d?ma(e,l,(l.subtreeFlags&8772)!==0):ha(e,l),da=o,Nt=d}break;case 30:break;default:ha(e,l)}}function Op(e){var t=e.alternate;t!==null&&(e.alternate=null,Op(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Eo(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 it=null,Ft=!1;function fa(e,t,l){for(l=l.child;l!==null;)Mp(e,t,l),l=l.sibling}function Mp(e,t,l){if(ce&&typeof ce.onCommitFiberUnmount=="function")try{ce.onCommitFiberUnmount(ka,l)}catch{}switch(l.tag){case 26:Nt||Gn(l,t),fa(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Nt||Gn(l,t);var i=it,o=Ft;Ja(l.type)&&(it=l.stateNode,Ft=!1),fa(e,t,l),Ii(l.stateNode),it=i,Ft=o;break;case 5:Nt||Gn(l,t);case 6:if(i=it,o=Ft,it=null,fa(e,t,l),it=i,Ft=o,it!==null)if(Ft)try{(it.nodeType===9?it.body:it.nodeName==="HTML"?it.ownerDocument.body:it).removeChild(l.stateNode)}catch(d){Ie(l,t,d)}else try{it.removeChild(l.stateNode)}catch(d){Ie(l,t,d)}break;case 18:it!==null&&(Ft?(e=it,Ny(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),Ds(e)):Ny(it,l.stateNode));break;case 4:i=it,o=Ft,it=l.stateNode.containerInfo,Ft=!0,fa(e,t,l),it=i,Ft=o;break;case 0:case 11:case 14:case 15:Ga(2,l,t),Nt||Ga(4,l,t),fa(e,t,l);break;case 1:Nt||(Gn(l,t),i=l.stateNode,typeof i.componentWillUnmount=="function"&&Cp(l,t,i)),fa(e,t,l);break;case 21:fa(e,t,l);break;case 22:Nt=(i=Nt)||l.memoizedState!==null,fa(e,t,l),Nt=i;break;default:fa(e,t,l)}}function kp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ds(e)}catch(l){Ie(t,t.return,l)}}}function zp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ds(e)}catch(l){Ie(t,t.return,l)}}function Xj(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Rp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Rp),t;default:throw Error(c(435,e.tag))}}function yc(e,t){var l=Xj(e);t.forEach(function(i){if(!l.has(i)){l.add(i);var o=lb.bind(null,e,i);i.then(o,o)}})}function Xt(e,t){var l=t.deletions;if(l!==null)for(var i=0;i<l.length;i++){var o=l[i],d=e,y=t,b=y;e:for(;b!==null;){switch(b.tag){case 27:if(Ja(b.type)){it=b.stateNode,Ft=!1;break e}break;case 5:it=b.stateNode,Ft=!1;break e;case 3:case 4:it=b.stateNode.containerInfo,Ft=!0;break e}b=b.return}if(it===null)throw Error(c(160));Mp(d,y,o),it=null,Ft=!1,d=o.alternate,d!==null&&(d.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Dp(t,e),t=t.sibling}var Bn=null;function Dp(e,t){var l=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Xt(t,e),Vt(e),i&4&&(Ga(3,e,e.return),qi(3,e),Ga(5,e,e.return));break;case 1:Xt(t,e),Vt(e),i&512&&(Nt||l===null||Gn(l,l.return)),i&64&&da&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?i:l.concat(i))));break;case 26:var o=Bn;if(Xt(t,e),Vt(e),i&512&&(Nt||l===null||Gn(l,l.return)),i&4){var d=l!==null?l.memoizedState:null;if(i=e.memoizedState,l===null)if(i===null)if(e.stateNode===null){e:{i=e.type,l=e.memoizedProps,o=o.ownerDocument||o;t:switch(i){case"title":d=o.getElementsByTagName("title")[0],(!d||d[oi]||d[kt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=o.createElement(i),o.head.insertBefore(d,o.querySelector("head > title"))),Bt(d,i,l),d[kt]=e,Rt(d),i=d;break e;case"link":var y=Dy("link","href",o).get(i+(l.href||""));if(y){for(var b=0;b<y.length;b++)if(d=y[b],d.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&d.getAttribute("rel")===(l.rel==null?null:l.rel)&&d.getAttribute("title")===(l.title==null?null:l.title)&&d.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){y.splice(b,1);break t}}d=o.createElement(i),Bt(d,i,l),o.head.appendChild(d);break;case"meta":if(y=Dy("meta","content",o).get(i+(l.content||""))){for(b=0;b<y.length;b++)if(d=y[b],d.getAttribute("content")===(l.content==null?null:""+l.content)&&d.getAttribute("name")===(l.name==null?null:l.name)&&d.getAttribute("property")===(l.property==null?null:l.property)&&d.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&d.getAttribute("charset")===(l.charSet==null?null:l.charSet)){y.splice(b,1);break t}}d=o.createElement(i),Bt(d,i,l),o.head.appendChild(d);break;default:throw Error(c(468,i))}d[kt]=e,Rt(d),i=d}e.stateNode=i}else qy(o,e.type,e.stateNode);else e.stateNode=zy(o,i,e.memoizedProps);else d!==i?(d===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):d.count--,i===null?qy(o,e.type,e.stateNode):zy(o,i,e.memoizedProps)):i===null&&e.stateNode!==null&&Yu(e,e.memoizedProps,l.memoizedProps)}break;case 27:Xt(t,e),Vt(e),i&512&&(Nt||l===null||Gn(l,l.return)),l!==null&&i&4&&Yu(e,e.memoizedProps,l.memoizedProps);break;case 5:if(Xt(t,e),Vt(e),i&512&&(Nt||l===null||Gn(l,l.return)),e.flags&32){o=e.stateNode;try{as(o,"")}catch(ue){Ie(e,e.return,ue)}}i&4&&e.stateNode!=null&&(o=e.memoizedProps,Yu(e,o,l!==null?l.memoizedProps:o)),i&1024&&(Xu=!0);break;case 6:if(Xt(t,e),Vt(e),i&4){if(e.stateNode===null)throw Error(c(162));i=e.memoizedProps,l=e.stateNode;try{l.nodeValue=i}catch(ue){Ie(e,e.return,ue)}}break;case 3:if(kc=null,o=Bn,Bn=Oc(t.containerInfo),Xt(t,e),Bn=o,Vt(e),i&4&&l!==null&&l.memoizedState.isDehydrated)try{Ds(t.containerInfo)}catch(ue){Ie(e,e.return,ue)}Xu&&(Xu=!1,qp(e));break;case 4:i=Bn,Bn=Oc(e.stateNode.containerInfo),Xt(t,e),Vt(e),Bn=i;break;case 12:Xt(t,e),Vt(e);break;case 31:Xt(t,e),Vt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,yc(e,i)));break;case 13:Xt(t,e),Vt(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(vc=Ke()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,yc(e,i)));break;case 22:o=e.memoizedState!==null;var w=l!==null&&l.memoizedState!==null,_=da,I=Nt;if(da=_||o,Nt=I||w,Xt(t,e),Nt=I,da=_,Vt(e),i&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(l===null||w||da||Nt||Bl(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){w=l=t;try{if(d=w.stateNode,o)y=d.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{b=w.stateNode;var V=w.memoizedProps.style,Q=V!=null&&V.hasOwnProperty("display")?V.display:null;b.style.display=Q==null||typeof Q=="boolean"?"":(""+Q).trim()}}catch(ue){Ie(w,w.return,ue)}}}else if(t.tag===6){if(l===null){w=t;try{w.stateNode.nodeValue=o?"":w.memoizedProps}catch(ue){Ie(w,w.return,ue)}}}else if(t.tag===18){if(l===null){w=t;try{var H=w.stateNode;o?Cy(H,!0):Cy(w.stateNode,!1)}catch(ue){Ie(w,w.return,ue)}}}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;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(l=i.retryQueue,l!==null&&(i.retryQueue=null,yc(e,l))));break;case 19:Xt(t,e),Vt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,yc(e,i)));break;case 30:break;case 21:break;default:Xt(t,e),Vt(e)}}function Vt(e){var t=e.flags;if(t&2){try{for(var l,i=e.return;i!==null;){if(Tp(i)){l=i;break}i=i.return}if(l==null)throw Error(c(160));switch(l.tag){case 27:var o=l.stateNode,d=Pu(e);pc(e,d,o);break;case 5:var y=l.stateNode;l.flags&32&&(as(y,""),l.flags&=-33);var b=Pu(e);pc(e,b,y);break;case 3:case 4:var w=l.stateNode.containerInfo,_=Pu(e);Fu(e,_,w);break;default:throw Error(c(161))}}catch(I){Ie(e,e.return,I)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function qp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;qp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ha(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Ap(e,t.alternate,t),t=t.sibling}function Bl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ga(4,t,t.return),Bl(t);break;case 1:Gn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&Cp(t,t.return,l),Bl(t);break;case 27:Ii(t.stateNode);case 26:case 5:Gn(t,t.return),Bl(t);break;case 22:t.memoizedState===null&&Bl(t);break;case 30:Bl(t);break;default:Bl(t)}e=e.sibling}}function ma(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,o=e,d=t,y=d.flags;switch(d.tag){case 0:case 11:case 15:ma(o,d,l),qi(4,d);break;case 1:if(ma(o,d,l),i=d,o=i.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(_){Ie(i,i.return,_)}if(i=d,o=i.updateQueue,o!==null){var b=i.stateNode;try{var w=o.shared.hiddenCallbacks;if(w!==null)for(o.shared.hiddenCallbacks=null,o=0;o<w.length;o++)fm(w[o],b)}catch(_){Ie(i,i.return,_)}}l&&y&64&&Np(d),Bi(d,d.return);break;case 27:wp(d);case 26:case 5:ma(o,d,l),l&&i===null&&y&4&&Ep(d),Bi(d,d.return);break;case 12:ma(o,d,l);break;case 31:ma(o,d,l),l&&y&4&&kp(o,d);break;case 13:ma(o,d,l),l&&y&4&&zp(o,d);break;case 22:d.memoizedState===null&&ma(o,d,l),Bi(d,d.return);break;case 30:break;default:ma(o,d,l)}t=t.sibling}}function Vu(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&Si(l))}function Ju(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Si(e))}function Ln(e,t,l,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Bp(e,t,l,i),t=t.sibling}function Bp(e,t,l,i){var o=t.flags;switch(t.tag){case 0:case 11:case 15:Ln(e,t,l,i),o&2048&&qi(9,t);break;case 1:Ln(e,t,l,i);break;case 3:Ln(e,t,l,i),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Si(e)));break;case 12:if(o&2048){Ln(e,t,l,i),e=t.stateNode;try{var d=t.memoizedProps,y=d.id,b=d.onPostCommit;typeof b=="function"&&b(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(w){Ie(t,t.return,w)}}else Ln(e,t,l,i);break;case 31:Ln(e,t,l,i);break;case 13:Ln(e,t,l,i);break;case 23:break;case 22:d=t.stateNode,y=t.alternate,t.memoizedState!==null?d._visibility&2?Ln(e,t,l,i):Li(e,t):d._visibility&2?Ln(e,t,l,i):(d._visibility|=2,Ns(e,t,l,i,(t.subtreeFlags&10256)!==0||!1)),o&2048&&Vu(y,t);break;case 24:Ln(e,t,l,i),o&2048&&Ju(t.alternate,t);break;default:Ln(e,t,l,i)}}function Ns(e,t,l,i,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,y=t,b=l,w=i,_=y.flags;switch(y.tag){case 0:case 11:case 15:Ns(d,y,b,w,o),qi(8,y);break;case 23:break;case 22:var I=y.stateNode;y.memoizedState!==null?I._visibility&2?Ns(d,y,b,w,o):Li(d,y):(I._visibility|=2,Ns(d,y,b,w,o)),o&&_&2048&&Vu(y.alternate,y);break;case 24:Ns(d,y,b,w,o),o&&_&2048&&Ju(y.alternate,y);break;default:Ns(d,y,b,w,o)}t=t.sibling}}function Li(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,i=t,o=i.flags;switch(i.tag){case 22:Li(l,i),o&2048&&Vu(i.alternate,i);break;case 24:Li(l,i),o&2048&&Ju(i.alternate,i);break;default:Li(l,i)}t=t.sibling}}var _i=8192;function Cs(e,t,l){if(e.subtreeFlags&_i)for(e=e.child;e!==null;)Lp(e,t,l),e=e.sibling}function Lp(e,t,l){switch(e.tag){case 26:Cs(e,t,l),e.flags&_i&&e.memoizedState!==null&&qb(l,Bn,e.memoizedState,e.memoizedProps);break;case 5:Cs(e,t,l);break;case 3:case 4:var i=Bn;Bn=Oc(e.stateNode.containerInfo),Cs(e,t,l),Bn=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=_i,_i=16777216,Cs(e,t,l),_i=i):Cs(e,t,l));break;default:Cs(e,t,l)}}function _p(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 Ui(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var i=t[l];At=i,Qp(i,e)}_p(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Up(e),e=e.sibling}function Up(e){switch(e.tag){case 0:case 11:case 15:Ui(e),e.flags&2048&&Ga(9,e,e.return);break;case 3:Ui(e);break;case 12:Ui(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,gc(e)):Ui(e);break;default:Ui(e)}}function gc(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var i=t[l];At=i,Qp(i,e)}_p(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ga(8,t,t.return),gc(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,gc(t));break;default:gc(t)}e=e.sibling}}function Qp(e,t){for(;At!==null;){var l=At;switch(l.tag){case 0:case 11:case 15:Ga(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var i=l.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Si(l.memoizedState.cache)}if(i=l.child,i!==null)i.return=l,At=i;else e:for(l=e;At!==null;){i=At;var o=i.sibling,d=i.return;if(Op(i),i===l){At=null;break e}if(o!==null){o.return=d,At=o;break e}At=d}}}var Vj={getCacheForType:function(e){var t=Dt(jt),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return Dt(jt).controller.signal}},Jj=typeof WeakMap=="function"?WeakMap:Map,$e=0,We=null,ze=null,qe=0,Ge=0,rn=null,Ia=!1,Es=!1,Zu=!1,pa=0,mt=0,Ya=0,Ll=0,Wu=0,cn=0,Ts=0,Qi=null,Jt=null,ed=!1,vc=0,$p=0,xc=1/0,jc=null,Pa=null,Et=0,Fa=null,ws=null,ya=0,td=0,nd=null,Hp=null,$i=0,ad=null;function on(){return($e&2)!==0&&qe!==0?qe&-qe:k.T!==null?od():lh()}function Kp(){if(cn===0)if((qe&536870912)===0||Le){var e=Rr;Rr<<=1,(Rr&3932160)===0&&(Rr=262144),cn=e}else cn=536870912;return e=ln.current,e!==null&&(e.flags|=32),cn}function Zt(e,t,l){(e===We&&(Ge===2||Ge===9)||e.cancelPendingCommit!==null)&&(Rs(e,0),Xa(e,qe,cn,!1)),ci(e,l),(($e&2)===0||e!==We)&&(e===We&&(($e&2)===0&&(Ll|=l),mt===4&&Xa(e,qe,cn,!1)),In(e))}function Gp(e,t,l){if(($e&6)!==0)throw Error(c(327));var i=!l&&(t&127)===0&&(t&e.expiredLanes)===0||ri(e,t),o=i?eb(e,t):sd(e,t,!0),d=i;do{if(o===0){Es&&!i&&Xa(e,t,0,!1);break}else{if(l=e.current.alternate,d&&!Zj(l)){o=sd(e,t,!1),d=!1;continue}if(o===2){if(d=t,e.errorRecoveryDisabledLanes&d)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var b=e;o=Qi;var w=b.current.memoizedState.isDehydrated;if(w&&(Rs(b,y).flags|=256),y=sd(b,y,!1),y!==2){if(Zu&&!w){b.errorRecoveryDisabledLanes|=d,Ll|=d,o=4;break e}d=Jt,Jt=o,d!==null&&(Jt===null?Jt=d:Jt.push.apply(Jt,d))}o=y}if(d=!1,o!==2)continue}}if(o===1){Rs(e,0),Xa(e,t,0,!0);break}e:{switch(i=e,d=o,d){case 0:case 1:throw Error(c(345));case 4:if((t&4194048)!==t)break;case 6:Xa(i,t,cn,!Ia);break e;case 2:Jt=null;break;case 3:case 5:break;default:throw Error(c(329))}if((t&62914560)===t&&(o=vc+300-Ke(),10<o)){if(Xa(i,t,cn,!Ia),Or(i,0,!0)!==0)break e;ya=t,i.timeoutHandle=by(Ip.bind(null,i,l,Jt,jc,ed,t,cn,Ll,Ts,Ia,d,"Throttled",-0,0),o);break e}Ip(i,l,Jt,jc,ed,t,cn,Ll,Ts,Ia,d,null,-0,0)}}break}while(!0);In(e)}function Ip(e,t,l,i,o,d,y,b,w,_,I,V,Q,H){if(e.timeoutHandle=-1,V=t.subtreeFlags,V&8192||(V&16785408)===16785408){V={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ta},Lp(t,d,V);var ue=(d&62914560)===d?vc-Ke():(d&4194048)===d?$p-Ke():0;if(ue=Bb(V,ue),ue!==null){ya=d,e.cancelPendingCommit=ue(Wp.bind(null,e,t,d,l,i,o,y,b,w,I,V,null,Q,H)),Xa(e,d,y,!_);return}}Wp(e,t,d,l,i,o,y,b,w)}function Zj(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var i=0;i<l.length;i++){var o=l[i],d=o.getSnapshot;o=o.value;try{if(!nn(d(),o))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;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 Xa(e,t,l,i){t&=~Wu,t&=~Ll,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var o=t;0<o;){var d=31-xt(o),y=1<<d;i[d]=-1,o&=~y}l!==0&&th(e,l,t)}function bc(){return($e&6)===0?(Hi(0),!1):!0}function ld(){if(ze!==null){if(Ge===0)var e=ze.return;else e=ze,sa=Rl=null,ju(e),vs=null,Ci=0,e=ze;for(;e!==null;)Sp(e.alternate,e),e=e.return;ze=null}}function Rs(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,vb(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),ya=0,ld(),We=e,ze=l=aa(e.current,null),qe=t,Ge=0,rn=null,Ia=!1,Es=ri(e,t),Zu=!1,Ts=cn=Wu=Ll=Ya=mt=0,Jt=Qi=null,ed=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var o=31-xt(i),d=1<<o;t|=e[o],i&=~d}return pa=t,Hr(),l}function Yp(e,t){we=null,k.H=ki,t===gs||t===Vr?(t=cm(),Ge=3):t===cu?(t=cm(),Ge=4):Ge=t===Bu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,rn=t,ze===null&&(mt=1,uc(e,vn(t,e.current)))}function Pp(){var e=ln.current;return e===null?!0:(qe&4194048)===qe?Sn===null:(qe&62914560)===qe||(qe&536870912)!==0?e===Sn:!1}function Fp(){var e=k.H;return k.H=ki,e===null?ki:e}function Xp(){var e=k.A;return k.A=Vj,e}function Sc(){mt=4,Ia||(qe&4194048)!==qe&&ln.current!==null||(Es=!0),(Ya&134217727)===0&&(Ll&134217727)===0||We===null||Xa(We,qe,cn,!1)}function sd(e,t,l){var i=$e;$e|=2;var o=Fp(),d=Xp();(We!==e||qe!==t)&&(jc=null,Rs(e,t)),t=!1;var y=mt;e:do try{if(Ge!==0&&ze!==null){var b=ze,w=rn;switch(Ge){case 8:ld(),y=6;break e;case 3:case 2:case 9:case 6:ln.current===null&&(t=!0);var _=Ge;if(Ge=0,rn=null,As(e,b,w,_),l&&Es){y=0;break e}break;default:_=Ge,Ge=0,rn=null,As(e,b,w,_)}}Wj(),y=mt;break}catch(I){Yp(e,I)}while(!0);return t&&e.shellSuspendCounter++,sa=Rl=null,$e=i,k.H=o,k.A=d,ze===null&&(We=null,qe=0,Hr()),y}function Wj(){for(;ze!==null;)Vp(ze)}function eb(e,t){var l=$e;$e|=2;var i=Fp(),o=Xp();We!==e||qe!==t?(jc=null,xc=Ke()+500,Rs(e,t)):Es=ri(e,t);e:do try{if(Ge!==0&&ze!==null){t=ze;var d=rn;t:switch(Ge){case 1:Ge=0,rn=null,As(e,t,d,1);break;case 2:case 9:if(im(d)){Ge=0,rn=null,Jp(t);break}t=function(){Ge!==2&&Ge!==9||We!==e||(Ge=7),In(e)},d.then(t,t);break e;case 3:Ge=7;break e;case 4:Ge=5;break e;case 7:im(d)?(Ge=0,rn=null,Jp(t)):(Ge=0,rn=null,As(e,t,d,7));break;case 5:var y=null;switch(ze.tag){case 26:y=ze.memoizedState;case 5:case 27:var b=ze;if(y?By(y):b.stateNode.complete){Ge=0,rn=null;var w=b.sibling;if(w!==null)ze=w;else{var _=b.return;_!==null?(ze=_,Nc(_)):ze=null}break t}}Ge=0,rn=null,As(e,t,d,5);break;case 6:Ge=0,rn=null,As(e,t,d,6);break;case 8:ld(),mt=6;break e;default:throw Error(c(462))}}tb();break}catch(I){Yp(e,I)}while(!0);return sa=Rl=null,k.H=i,k.A=o,$e=l,ze!==null?0:(We=null,qe=0,Hr(),mt)}function tb(){for(;ze!==null&&!P();)Vp(ze)}function Vp(e){var t=jp(e.alternate,e,pa);e.memoizedProps=e.pendingProps,t===null?Nc(e):ze=t}function Jp(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=mp(l,t,t.pendingProps,t.type,void 0,qe);break;case 11:t=mp(l,t,t.pendingProps,t.type.render,t.ref,qe);break;case 5:ju(t);default:Sp(l,t),t=ze=Xh(t,pa),t=jp(l,t,pa)}e.memoizedProps=e.pendingProps,t===null?Nc(e):ze=t}function As(e,t,l,i){sa=Rl=null,ju(t),vs=null,Ci=0;var o=t.return;try{if(Kj(e,o,t,l,qe)){mt=1,uc(e,vn(l,e.current)),ze=null;return}}catch(d){if(o!==null)throw ze=o,d;mt=1,uc(e,vn(l,e.current)),ze=null;return}t.flags&32768?(Le||i===1?e=!0:Es||(qe&536870912)!==0?e=!1:(Ia=e=!0,(i===2||i===9||i===3||i===6)&&(i=ln.current,i!==null&&i.tag===13&&(i.flags|=16384))),Zp(t,e)):Nc(t)}function Nc(e){var t=e;do{if((t.flags&32768)!==0){Zp(t,Ia);return}e=t.return;var l=Yj(t.alternate,t,pa);if(l!==null){ze=l;return}if(t=t.sibling,t!==null){ze=t;return}ze=t=e}while(t!==null);mt===0&&(mt=5)}function Zp(e,t){do{var l=Pj(e.alternate,e);if(l!==null){l.flags&=32767,ze=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){ze=e;return}ze=e=l}while(e!==null);mt=6,ze=null}function Wp(e,t,l,i,o,d,y,b,w){e.cancelPendingCommit=null;do Cc();while(Et!==0);if(($e&6)!==0)throw Error(c(327));if(t!==null){if(t===e.current)throw Error(c(177));if(d=t.lanes|t.childLanes,d|=Po,Dx(e,l,d,y,b,w),e===We&&(ze=We=null,qe=0),ws=t,Fa=e,ya=l,td=d,nd=o,Hp=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,sb(xl,function(){return ly(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=k.T,k.T=null,o=Z.p,Z.p=2,y=$e,$e|=4;try{Fj(e,t,l)}finally{$e=y,Z.p=o,k.T=i}}Et=1,ey(),ty(),ny()}}function ey(){if(Et===1){Et=0;var e=Fa,t=ws,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=k.T,k.T=null;var i=Z.p;Z.p=2;var o=$e;$e|=4;try{Dp(t,e);var d=gd,y=Qh(e.containerInfo),b=d.focusedElem,w=d.selectionRange;if(y!==b&&b&&b.ownerDocument&&Uh(b.ownerDocument.documentElement,b)){if(w!==null&&Ho(b)){var _=w.start,I=w.end;if(I===void 0&&(I=_),"selectionStart"in b)b.selectionStart=_,b.selectionEnd=Math.min(I,b.value.length);else{var V=b.ownerDocument||document,Q=V&&V.defaultView||window;if(Q.getSelection){var H=Q.getSelection(),ue=b.textContent.length,Ne=Math.min(w.start,ue),Ze=w.end===void 0?Ne:Math.min(w.end,ue);!H.extend&&Ne>Ze&&(y=Ze,Ze=Ne,Ne=y);var D=_h(b,Ne),M=_h(b,Ze);if(D&&M&&(H.rangeCount!==1||H.anchorNode!==D.node||H.anchorOffset!==D.offset||H.focusNode!==M.node||H.focusOffset!==M.offset)){var L=V.createRange();L.setStart(D.node,D.offset),H.removeAllRanges(),Ne>Ze?(H.addRange(L),H.extend(M.node,M.offset)):(L.setEnd(M.node,M.offset),H.addRange(L))}}}}for(V=[],H=b;H=H.parentNode;)H.nodeType===1&&V.push({element:H,left:H.scrollLeft,top:H.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<V.length;b++){var F=V[b];F.element.scrollLeft=F.left,F.element.scrollTop=F.top}}Bc=!!yd,gd=yd=null}finally{$e=o,Z.p=i,k.T=l}}e.current=t,Et=2}}function ty(){if(Et===2){Et=0;var e=Fa,t=ws,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=k.T,k.T=null;var i=Z.p;Z.p=2;var o=$e;$e|=4;try{Ap(e,t.alternate,t)}finally{$e=o,Z.p=i,k.T=l}}Et=3}}function ny(){if(Et===4||Et===3){Et=0,Xe();var e=Fa,t=ws,l=ya,i=Hp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Et=5:(Et=0,ws=Fa=null,ay(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(Pa=null),No(l),t=t.stateNode,ce&&typeof ce.onCommitFiberRoot=="function")try{ce.onCommitFiberRoot(ka,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=k.T,o=Z.p,Z.p=2,k.T=null;try{for(var d=e.onRecoverableError,y=0;y<i.length;y++){var b=i[y];d(b.value,{componentStack:b.stack})}}finally{k.T=t,Z.p=o}}(ya&3)!==0&&Cc(),In(e),o=e.pendingLanes,(l&261930)!==0&&(o&42)!==0?e===ad?$i++:($i=0,ad=e):$i=0,Hi(0)}}function ay(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Si(t)))}function Cc(){return ey(),ty(),ny(),ly()}function ly(){if(Et!==5)return!1;var e=Fa,t=td;td=0;var l=No(ya),i=k.T,o=Z.p;try{Z.p=32>l?32:l,k.T=null,l=nd,nd=null;var d=Fa,y=ya;if(Et=0,ws=Fa=null,ya=0,($e&6)!==0)throw Error(c(331));var b=$e;if($e|=4,Up(d.current),Bp(d,d.current,y,l),$e=b,Hi(0,!1),ce&&typeof ce.onPostCommitFiberRoot=="function")try{ce.onPostCommitFiberRoot(ka,d)}catch{}return!0}finally{Z.p=o,k.T=i,ay(e,t)}}function sy(e,t,l){t=vn(l,t),t=qu(e.stateNode,t,2),e=$a(e,t,2),e!==null&&(ci(e,2),In(e))}function Ie(e,t,l){if(e.tag===3)sy(e,e,l);else for(;t!==null;){if(t.tag===3){sy(t,e,l);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Pa===null||!Pa.has(i))){e=vn(l,e),l=ip(2),i=$a(t,l,2),i!==null&&(rp(l,i,t,e),ci(i,2),In(i));break}}t=t.return}}function id(e,t,l){var i=e.pingCache;if(i===null){i=e.pingCache=new Jj;var o=new Set;i.set(t,o)}else o=i.get(t),o===void 0&&(o=new Set,i.set(t,o));o.has(l)||(Zu=!0,o.add(l),e=nb.bind(null,e,t,l),t.then(e,e))}function nb(e,t,l){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,We===e&&(qe&l)===l&&(mt===4||mt===3&&(qe&62914560)===qe&&300>Ke()-vc?($e&2)===0&&Rs(e,0):Wu|=l,Ts===qe&&(Ts=0)),In(e)}function iy(e,t){t===0&&(t=eh()),e=El(e,t),e!==null&&(ci(e,t),In(e))}function ab(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),iy(e,l)}function lb(e,t){var l=0;switch(e.tag){case 31:case 13:var i=e.stateNode,o=e.memoizedState;o!==null&&(l=o.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(c(314))}i!==null&&i.delete(t),iy(e,l)}function sb(e,t){return ae(e,t)}var Ec=null,Os=null,rd=!1,Tc=!1,cd=!1,Va=0;function In(e){e!==Os&&e.next===null&&(Os===null?Ec=Os=e:Os=Os.next=e),Tc=!0,rd||(rd=!0,rb())}function Hi(e,t){if(!cd&&Tc){cd=!0;do for(var l=!1,i=Ec;i!==null;){if(e!==0){var o=i.pendingLanes;if(o===0)var d=0;else{var y=i.suspendedLanes,b=i.pingedLanes;d=(1<<31-xt(42|e)+1)-1,d&=o&~(y&~b),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(l=!0,uy(i,d))}else d=qe,d=Or(i,i===We?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(d&3)===0||ri(i,d)||(l=!0,uy(i,d));i=i.next}while(l);cd=!1}}function ib(){ry()}function ry(){Tc=rd=!1;var e=0;Va!==0&&gb()&&(e=Va);for(var t=Ke(),l=null,i=Ec;i!==null;){var o=i.next,d=cy(i,t);d===0?(i.next=null,l===null?Ec=o:l.next=o,o===null&&(Os=l)):(l=i,(e!==0||(d&3)!==0)&&(Tc=!0)),i=o}Et!==0&&Et!==5||Hi(e),Va!==0&&(Va=0)}function cy(e,t){for(var l=e.suspendedLanes,i=e.pingedLanes,o=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var y=31-xt(d),b=1<<y,w=o[y];w===-1?((b&l)===0||(b&i)!==0)&&(o[y]=zx(b,t)):w<=t&&(e.expiredLanes|=b),d&=~b}if(t=We,l=qe,l=Or(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,l===0||e===t&&(Ge===2||Ge===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&Me(i),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||ri(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(i!==null&&Me(i),No(l)){case 2:case 8:l=vl;break;case 32:l=xl;break;case 268435456:l=ii;break;default:l=xl}return i=oy.bind(null,e),l=ae(l,i),e.callbackPriority=t,e.callbackNode=l,t}return i!==null&&i!==null&&Me(i),e.callbackPriority=2,e.callbackNode=null,2}function oy(e,t){if(Et!==0&&Et!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Cc()&&e.callbackNode!==l)return null;var i=qe;return i=Or(e,e===We?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(Gp(e,i,t),cy(e,Ke()),e.callbackNode!=null&&e.callbackNode===l?oy.bind(null,e):null)}function uy(e,t){if(Cc())return null;Gp(e,t,!0)}function rb(){xb(function(){($e&6)!==0?ae(Zn,ib):ry()})}function od(){if(Va===0){var e=ps;e===0&&(e=wr,wr<<=1,(wr&261888)===0&&(wr=256)),Va=e}return Va}function dy(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Dr(""+e)}function fy(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function cb(e,t,l,i,o){if(t==="submit"&&l&&l.stateNode===o){var d=dy((o[Yt]||null).action),y=i.submitter;y&&(t=(t=y[Yt]||null)?dy(t.formAction):y.getAttribute("formAction"),t!==null&&(d=t,y=null));var b=new _r("action","action",null,i,o);e.push({event:b,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Va!==0){var w=y?fy(o,y):new FormData(o);Au(l,{pending:!0,data:w,method:o.method,action:d},null,w)}}else typeof d=="function"&&(b.preventDefault(),w=y?fy(o,y):new FormData(o),Au(l,{pending:!0,data:w,method:o.method,action:d},d,w))},currentTarget:o}]})}}for(var ud=0;ud<Yo.length;ud++){var dd=Yo[ud],ob=dd.toLowerCase(),ub=dd[0].toUpperCase()+dd.slice(1);qn(ob,"on"+ub)}qn(Kh,"onAnimationEnd"),qn(Gh,"onAnimationIteration"),qn(Ih,"onAnimationStart"),qn("dblclick","onDoubleClick"),qn("focusin","onFocus"),qn("focusout","onBlur"),qn(Tj,"onTransitionRun"),qn(wj,"onTransitionStart"),qn(Rj,"onTransitionCancel"),qn(Yh,"onTransitionEnd"),ts("onMouseEnter",["mouseout","mouseover"]),ts("onMouseLeave",["mouseout","mouseover"]),ts("onPointerEnter",["pointerout","pointerover"]),ts("onPointerLeave",["pointerout","pointerover"]),bl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),bl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),bl("onBeforeInput",["compositionend","keypress","textInput","paste"]),bl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),bl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),bl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ki="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),db=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ki));function hy(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var i=e[l],o=i.event;i=i.listeners;e:{var d=void 0;if(t)for(var y=i.length-1;0<=y;y--){var b=i[y],w=b.instance,_=b.currentTarget;if(b=b.listener,w!==d&&o.isPropagationStopped())break e;d=b,o.currentTarget=_;try{d(o)}catch(I){$r(I)}o.currentTarget=null,d=w}else for(y=0;y<i.length;y++){if(b=i[y],w=b.instance,_=b.currentTarget,b=b.listener,w!==d&&o.isPropagationStopped())break e;d=b,o.currentTarget=_;try{d(o)}catch(I){$r(I)}o.currentTarget=null,d=w}}}}function De(e,t){var l=t[Co];l===void 0&&(l=t[Co]=new Set);var i=e+"__bubble";l.has(i)||(my(t,e,2,!1),l.add(i))}function fd(e,t,l){var i=0;t&&(i|=4),my(l,e,i,t)}var wc="_reactListening"+Math.random().toString(36).slice(2);function hd(e){if(!e[wc]){e[wc]=!0,rh.forEach(function(l){l!=="selectionchange"&&(db.has(l)||fd(l,!1,e),fd(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wc]||(t[wc]=!0,fd("selectionchange",!1,t))}}function my(e,t,l,i){switch(Ky(t)){case 2:var o=Ub;break;case 8:o=Qb;break;default:o=Rd}l=o.bind(null,t,l,e),o=void 0,!zo||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),i?o!==void 0?e.addEventListener(t,l,{capture:!0,passive:o}):e.addEventListener(t,l,!0):o!==void 0?e.addEventListener(t,l,{passive:o}):e.addEventListener(t,l,!1)}function md(e,t,l,i,o){var d=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var y=i.tag;if(y===3||y===4){var b=i.stateNode.containerInfo;if(b===o)break;if(y===4)for(y=i.return;y!==null;){var w=y.tag;if((w===3||w===4)&&y.stateNode.containerInfo===o)return;y=y.return}for(;b!==null;){if(y=Zl(b),y===null)return;if(w=y.tag,w===5||w===6||w===26||w===27){i=d=y;continue e}b=b.parentNode}}i=i.return}xh(function(){var _=d,I=Mo(l),V=[];e:{var Q=Ph.get(e);if(Q!==void 0){var H=_r,ue=e;switch(e){case"keypress":if(Br(l)===0)break e;case"keydown":case"keyup":H=lj;break;case"focusin":ue="focus",H=Lo;break;case"focusout":ue="blur",H=Lo;break;case"beforeblur":case"afterblur":H=Lo;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":H=Sh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":H=Yx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":H=rj;break;case Kh:case Gh:case Ih:H=Xx;break;case Yh:H=oj;break;case"scroll":case"scrollend":H=Gx;break;case"wheel":H=dj;break;case"copy":case"cut":case"paste":H=Jx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":H=Ch;break;case"toggle":case"beforetoggle":H=hj}var Ne=(t&4)!==0,Ze=!Ne&&(e==="scroll"||e==="scrollend"),D=Ne?Q!==null?Q+"Capture":null:Q;Ne=[];for(var M=_,L;M!==null;){var F=M;if(L=F.stateNode,F=F.tag,F!==5&&F!==26&&F!==27||L===null||D===null||(F=di(M,D),F!=null&&Ne.push(Gi(M,F,L))),Ze)break;M=M.return}0<Ne.length&&(Q=new H(Q,ue,null,l,I),V.push({event:Q,listeners:Ne}))}}if((t&7)===0){e:{if(Q=e==="mouseover"||e==="pointerover",H=e==="mouseout"||e==="pointerout",Q&&l!==Oo&&(ue=l.relatedTarget||l.fromElement)&&(Zl(ue)||ue[Jl]))break e;if((H||Q)&&(Q=I.window===I?I:(Q=I.ownerDocument)?Q.defaultView||Q.parentWindow:window,H?(ue=l.relatedTarget||l.toElement,H=_,ue=ue?Zl(ue):null,ue!==null&&(Ze=f(ue),Ne=ue.tag,ue!==Ze||Ne!==5&&Ne!==27&&Ne!==6)&&(ue=null)):(H=null,ue=_),H!==ue)){if(Ne=Sh,F="onMouseLeave",D="onMouseEnter",M="mouse",(e==="pointerout"||e==="pointerover")&&(Ne=Ch,F="onPointerLeave",D="onPointerEnter",M="pointer"),Ze=H==null?Q:ui(H),L=ue==null?Q:ui(ue),Q=new Ne(F,M+"leave",H,l,I),Q.target=Ze,Q.relatedTarget=L,F=null,Zl(I)===_&&(Ne=new Ne(D,M+"enter",ue,l,I),Ne.target=L,Ne.relatedTarget=Ze,F=Ne),Ze=F,H&&ue)t:{for(Ne=fb,D=H,M=ue,L=0,F=D;F;F=Ne(F))L++;F=0;for(var be=M;be;be=Ne(be))F++;for(;0<L-F;)D=Ne(D),L--;for(;0<F-L;)M=Ne(M),F--;for(;L--;){if(D===M||M!==null&&D===M.alternate){Ne=D;break t}D=Ne(D),M=Ne(M)}Ne=null}else Ne=null;H!==null&&py(V,Q,H,Ne,!1),ue!==null&&Ze!==null&&py(V,Ze,ue,Ne,!0)}}e:{if(Q=_?ui(_):window,H=Q.nodeName&&Q.nodeName.toLowerCase(),H==="select"||H==="input"&&Q.type==="file")var Ue=kh;else if(Oh(Q))if(zh)Ue=Nj;else{Ue=bj;var de=jj}else H=Q.nodeName,!H||H.toLowerCase()!=="input"||Q.type!=="checkbox"&&Q.type!=="radio"?_&&Ao(_.elementType)&&(Ue=kh):Ue=Sj;if(Ue&&(Ue=Ue(e,_))){Mh(V,Ue,l,I);break e}de&&de(e,Q,_),e==="focusout"&&_&&Q.type==="number"&&_.memoizedProps.value!=null&&Ro(Q,"number",Q.value)}switch(de=_?ui(_):window,e){case"focusin":(Oh(de)||de.contentEditable==="true")&&(rs=de,Ko=_,xi=null);break;case"focusout":xi=Ko=rs=null;break;case"mousedown":Go=!0;break;case"contextmenu":case"mouseup":case"dragend":Go=!1,$h(V,l,I);break;case"selectionchange":if(Ej)break;case"keydown":case"keyup":$h(V,l,I)}var Re;if(Uo)e:{switch(e){case"compositionstart":var Be="onCompositionStart";break e;case"compositionend":Be="onCompositionEnd";break e;case"compositionupdate":Be="onCompositionUpdate";break e}Be=void 0}else is?Rh(e,l)&&(Be="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Be="onCompositionStart");Be&&(Eh&&l.locale!=="ko"&&(is||Be!=="onCompositionStart"?Be==="onCompositionEnd"&&is&&(Re=jh()):(Da=I,Do="value"in Da?Da.value:Da.textContent,is=!0)),de=Rc(_,Be),0<de.length&&(Be=new Nh(Be,e,null,l,I),V.push({event:Be,listeners:de}),Re?Be.data=Re:(Re=Ah(l),Re!==null&&(Be.data=Re)))),(Re=pj?yj(e,l):gj(e,l))&&(Be=Rc(_,"onBeforeInput"),0<Be.length&&(de=new Nh("onBeforeInput","beforeinput",null,l,I),V.push({event:de,listeners:Be}),de.data=Re)),cb(V,e,_,l,I)}hy(V,t)})}function Gi(e,t,l){return{instance:e,listener:t,currentTarget:l}}function Rc(e,t){for(var l=t+"Capture",i=[];e!==null;){var o=e,d=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||d===null||(o=di(e,l),o!=null&&i.unshift(Gi(e,o,d)),o=di(e,t),o!=null&&i.push(Gi(e,o,d))),e.tag===3)return i;e=e.return}return[]}function fb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function py(e,t,l,i,o){for(var d=t._reactName,y=[];l!==null&&l!==i;){var b=l,w=b.alternate,_=b.stateNode;if(b=b.tag,w!==null&&w===i)break;b!==5&&b!==26&&b!==27||_===null||(w=_,o?(_=di(l,d),_!=null&&y.unshift(Gi(l,_,w))):o||(_=di(l,d),_!=null&&y.push(Gi(l,_,w)))),l=l.return}y.length!==0&&e.push({event:t,listeners:y})}var hb=/\r\n?/g,mb=/\u0000|\uFFFD/g;function yy(e){return(typeof e=="string"?e:""+e).replace(hb,`
49
+ `).replace(mb,"")}function gy(e,t){return t=yy(t),yy(e)===t}function Je(e,t,l,i,o,d){switch(l){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||as(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&as(e,""+i);break;case"className":kr(e,"class",i);break;case"tabIndex":kr(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":kr(e,l,i);break;case"style":gh(e,i,d);break;case"data":if(t!=="object"){kr(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=Dr(""+i),e.setAttribute(l,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(l,"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 d=="function"&&(l==="formAction"?(t!=="input"&&Je(e,t,"name",o.name,o,null),Je(e,t,"formEncType",o.formEncType,o,null),Je(e,t,"formMethod",o.formMethod,o,null),Je(e,t,"formTarget",o.formTarget,o,null)):(Je(e,t,"encType",o.encType,o,null),Je(e,t,"method",o.method,o,null),Je(e,t,"target",o.target,o,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=Dr(""+i),e.setAttribute(l,i);break;case"onClick":i!=null&&(e.onclick=ta);break;case"onScroll":i!=null&&De("scroll",e);break;case"onScrollEnd":i!=null&&De("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(c(61));if(l=i.__html,l!=null){if(o.children!=null)throw Error(c(60));e.innerHTML=l}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}l=Dr(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""+i):e.removeAttribute(l);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":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":i===!0?e.setAttribute(l,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,i):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(l,i):e.removeAttribute(l);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(l):e.setAttribute(l,i);break;case"popover":De("beforetoggle",e),De("toggle",e),Mr(e,"popover",i);break;case"xlinkActuate":ea(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":ea(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":ea(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":ea(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":ea(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":ea(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":ea(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":ea(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":ea(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Mr(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Hx.get(l)||l,Mr(e,l,i))}}function pd(e,t,l,i,o,d){switch(l){case"style":gh(e,i,d);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(c(61));if(l=i.__html,l!=null){if(o.children!=null)throw Error(c(60));e.innerHTML=l}}break;case"children":typeof i=="string"?as(e,i):(typeof i=="number"||typeof i=="bigint")&&as(e,""+i);break;case"onScroll":i!=null&&De("scroll",e);break;case"onScrollEnd":i!=null&&De("scrollend",e);break;case"onClick":i!=null&&(e.onclick=ta);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ch.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(o=l.endsWith("Capture"),t=l.slice(2,o?l.length-7:void 0),d=e[Yt]||null,d=d!=null?d[l]:null,typeof d=="function"&&e.removeEventListener(t,d,o),typeof i=="function")){typeof d!="function"&&d!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,i,o);break e}l in e?e[l]=i:i===!0?e.setAttribute(l,""):Mr(e,l,i)}}}function Bt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":De("error",e),De("load",e);var i=!1,o=!1,d;for(d in l)if(l.hasOwnProperty(d)){var y=l[d];if(y!=null)switch(d){case"src":i=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:Je(e,t,d,y,l,null)}}o&&Je(e,t,"srcSet",l.srcSet,l,null),i&&Je(e,t,"src",l.src,l,null);return;case"input":De("invalid",e);var b=d=y=o=null,w=null,_=null;for(i in l)if(l.hasOwnProperty(i)){var I=l[i];if(I!=null)switch(i){case"name":o=I;break;case"type":y=I;break;case"checked":w=I;break;case"defaultChecked":_=I;break;case"value":d=I;break;case"defaultValue":b=I;break;case"children":case"dangerouslySetInnerHTML":if(I!=null)throw Error(c(137,t));break;default:Je(e,t,i,I,l,null)}}hh(e,d,b,w,_,y,o,!1);return;case"select":De("invalid",e),i=y=d=null;for(o in l)if(l.hasOwnProperty(o)&&(b=l[o],b!=null))switch(o){case"value":d=b;break;case"defaultValue":y=b;break;case"multiple":i=b;default:Je(e,t,o,b,l,null)}t=d,l=y,e.multiple=!!i,t!=null?ns(e,!!i,t,!1):l!=null&&ns(e,!!i,l,!0);return;case"textarea":De("invalid",e),d=o=i=null;for(y in l)if(l.hasOwnProperty(y)&&(b=l[y],b!=null))switch(y){case"value":i=b;break;case"defaultValue":o=b;break;case"children":d=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(c(91));break;default:Je(e,t,y,b,l,null)}ph(e,i,o,d);return;case"option":for(w in l)if(l.hasOwnProperty(w)&&(i=l[w],i!=null))switch(w){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:Je(e,t,w,i,l,null)}return;case"dialog":De("beforetoggle",e),De("toggle",e),De("cancel",e),De("close",e);break;case"iframe":case"object":De("load",e);break;case"video":case"audio":for(i=0;i<Ki.length;i++)De(Ki[i],e);break;case"image":De("error",e),De("load",e);break;case"details":De("toggle",e);break;case"embed":case"source":case"link":De("error",e),De("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(_ in l)if(l.hasOwnProperty(_)&&(i=l[_],i!=null))switch(_){case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:Je(e,t,_,i,l,null)}return;default:if(Ao(t)){for(I in l)l.hasOwnProperty(I)&&(i=l[I],i!==void 0&&pd(e,t,I,i,l,void 0));return}}for(b in l)l.hasOwnProperty(b)&&(i=l[b],i!=null&&Je(e,t,b,i,l,null))}function pb(e,t,l,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,d=null,y=null,b=null,w=null,_=null,I=null;for(H in l){var V=l[H];if(l.hasOwnProperty(H)&&V!=null)switch(H){case"checked":break;case"value":break;case"defaultValue":w=V;default:i.hasOwnProperty(H)||Je(e,t,H,null,i,V)}}for(var Q in i){var H=i[Q];if(V=l[Q],i.hasOwnProperty(Q)&&(H!=null||V!=null))switch(Q){case"type":d=H;break;case"name":o=H;break;case"checked":_=H;break;case"defaultChecked":I=H;break;case"value":y=H;break;case"defaultValue":b=H;break;case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(c(137,t));break;default:H!==V&&Je(e,t,Q,H,i,V)}}wo(e,y,b,w,_,I,d,o);return;case"select":H=y=b=Q=null;for(d in l)if(w=l[d],l.hasOwnProperty(d)&&w!=null)switch(d){case"value":break;case"multiple":H=w;default:i.hasOwnProperty(d)||Je(e,t,d,null,i,w)}for(o in i)if(d=i[o],w=l[o],i.hasOwnProperty(o)&&(d!=null||w!=null))switch(o){case"value":Q=d;break;case"defaultValue":b=d;break;case"multiple":y=d;default:d!==w&&Je(e,t,o,d,i,w)}t=b,l=y,i=H,Q!=null?ns(e,!!l,Q,!1):!!i!=!!l&&(t!=null?ns(e,!!l,t,!0):ns(e,!!l,l?[]:"",!1));return;case"textarea":H=Q=null;for(b in l)if(o=l[b],l.hasOwnProperty(b)&&o!=null&&!i.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Je(e,t,b,null,i,o)}for(y in i)if(o=i[y],d=l[y],i.hasOwnProperty(y)&&(o!=null||d!=null))switch(y){case"value":Q=o;break;case"defaultValue":H=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(c(91));break;default:o!==d&&Je(e,t,y,o,i,d)}mh(e,Q,H);return;case"option":for(var ue in l)if(Q=l[ue],l.hasOwnProperty(ue)&&Q!=null&&!i.hasOwnProperty(ue))switch(ue){case"selected":e.selected=!1;break;default:Je(e,t,ue,null,i,Q)}for(w in i)if(Q=i[w],H=l[w],i.hasOwnProperty(w)&&Q!==H&&(Q!=null||H!=null))switch(w){case"selected":e.selected=Q&&typeof Q!="function"&&typeof Q!="symbol";break;default:Je(e,t,w,Q,i,H)}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 Ne in l)Q=l[Ne],l.hasOwnProperty(Ne)&&Q!=null&&!i.hasOwnProperty(Ne)&&Je(e,t,Ne,null,i,Q);for(_ in i)if(Q=i[_],H=l[_],i.hasOwnProperty(_)&&Q!==H&&(Q!=null||H!=null))switch(_){case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(c(137,t));break;default:Je(e,t,_,Q,i,H)}return;default:if(Ao(t)){for(var Ze in l)Q=l[Ze],l.hasOwnProperty(Ze)&&Q!==void 0&&!i.hasOwnProperty(Ze)&&pd(e,t,Ze,void 0,i,Q);for(I in i)Q=i[I],H=l[I],!i.hasOwnProperty(I)||Q===H||Q===void 0&&H===void 0||pd(e,t,I,Q,i,H);return}}for(var D in l)Q=l[D],l.hasOwnProperty(D)&&Q!=null&&!i.hasOwnProperty(D)&&Je(e,t,D,null,i,Q);for(V in i)Q=i[V],H=l[V],!i.hasOwnProperty(V)||Q===H||Q==null&&H==null||Je(e,t,V,Q,i,H)}function vy(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function yb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),i=0;i<l.length;i++){var o=l[i],d=o.transferSize,y=o.initiatorType,b=o.duration;if(d&&b&&vy(y)){for(y=0,b=o.responseEnd,i+=1;i<l.length;i++){var w=l[i],_=w.startTime;if(_>b)break;var I=w.transferSize,V=w.initiatorType;I&&vy(V)&&(w=w.responseEnd,y+=I*(w<b?1:(b-_)/(w-_)))}if(--i,t+=8*(d+y)/(o.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var yd=null,gd=null;function Ac(e){return e.nodeType===9?e:e.ownerDocument}function xy(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 jy(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 vd(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 xd=null;function gb(){var e=window.event;return e&&e.type==="popstate"?e===xd?!1:(xd=e,!0):(xd=null,!1)}var by=typeof setTimeout=="function"?setTimeout:void 0,vb=typeof clearTimeout=="function"?clearTimeout:void 0,Sy=typeof Promise=="function"?Promise:void 0,xb=typeof queueMicrotask=="function"?queueMicrotask:typeof Sy<"u"?function(e){return Sy.resolve(null).then(e).catch(jb)}:by;function jb(e){setTimeout(function(){throw e})}function Ja(e){return e==="head"}function Ny(e,t){var l=t,i=0;do{var o=l.nextSibling;if(e.removeChild(l),o&&o.nodeType===8)if(l=o.data,l==="/$"||l==="/&"){if(i===0){e.removeChild(o),Ds(t);return}i--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")i++;else if(l==="html")Ii(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,Ii(l);for(var d=l.firstChild;d;){var y=d.nextSibling,b=d.nodeName;d[oi]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&d.rel.toLowerCase()==="stylesheet"||l.removeChild(d),d=y}}else l==="body"&&Ii(e.ownerDocument.body);l=o}while(l);Ds(t)}function Cy(e,t){var l=e;e=0;do{var i=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),i&&i.nodeType===8)if(l=i.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=i}while(l)}function jd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":jd(l),Eo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function bb(e,t,l,i){for(;e.nodeType===1;){var o=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[oi])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=Nn(e.nextSibling),e===null)break}return null}function Sb(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Nn(e.nextSibling),e===null))return null;return e}function Ey(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Nn(e.nextSibling),e===null))return null;return e}function bd(e){return e.data==="$?"||e.data==="$~"}function Sd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Nb(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var i=function(){t(),l.removeEventListener("DOMContentLoaded",i)};l.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function Nn(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 Nd=null;function Ty(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return Nn(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function wy(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function Ry(e,t,l){switch(t=Ac(l),e){case"html":if(e=t.documentElement,!e)throw Error(c(452));return e;case"head":if(e=t.head,!e)throw Error(c(453));return e;case"body":if(e=t.body,!e)throw Error(c(454));return e;default:throw Error(c(451))}}function Ii(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Eo(e)}var Cn=new Map,Ay=new Set;function Oc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ga=Z.d;Z.d={f:Cb,r:Eb,D:Tb,C:wb,L:Rb,m:Ab,X:Mb,S:Ob,M:kb};function Cb(){var e=ga.f(),t=bc();return e||t}function Eb(e){var t=Wl(e);t!==null&&t.tag===5&&t.type==="form"?Ym(t):ga.r(e)}var Ms=typeof document>"u"?null:document;function Oy(e,t,l){var i=Ms;if(i&&typeof t=="string"&&t){var o=yn(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof l=="string"&&(o+='[crossorigin="'+l+'"]'),Ay.has(o)||(Ay.add(o),e={rel:e,crossOrigin:l,href:t},i.querySelector(o)===null&&(t=i.createElement("link"),Bt(t,"link",e),Rt(t),i.head.appendChild(t)))}}function Tb(e){ga.D(e),Oy("dns-prefetch",e,null)}function wb(e,t){ga.C(e,t),Oy("preconnect",e,t)}function Rb(e,t,l){ga.L(e,t,l);var i=Ms;if(i&&e&&t){var o='link[rel="preload"][as="'+yn(t)+'"]';t==="image"&&l&&l.imageSrcSet?(o+='[imagesrcset="'+yn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(o+='[imagesizes="'+yn(l.imageSizes)+'"]')):o+='[href="'+yn(e)+'"]';var d=o;switch(t){case"style":d=ks(e);break;case"script":d=zs(e)}Cn.has(d)||(e=x({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),Cn.set(d,e),i.querySelector(o)!==null||t==="style"&&i.querySelector(Yi(d))||t==="script"&&i.querySelector(Pi(d))||(t=i.createElement("link"),Bt(t,"link",e),Rt(t),i.head.appendChild(t)))}}function Ab(e,t){ga.m(e,t);var l=Ms;if(l&&e){var i=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+yn(i)+'"][href="'+yn(e)+'"]',d=o;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=zs(e)}if(!Cn.has(d)&&(e=x({rel:"modulepreload",href:e},t),Cn.set(d,e),l.querySelector(o)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Pi(d)))return}i=l.createElement("link"),Bt(i,"link",e),Rt(i),l.head.appendChild(i)}}}function Ob(e,t,l){ga.S(e,t,l);var i=Ms;if(i&&e){var o=es(i).hoistableStyles,d=ks(e);t=t||"default";var y=o.get(d);if(!y){var b={loading:0,preload:null};if(y=i.querySelector(Yi(d)))b.loading=5;else{e=x({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Cn.get(d))&&Cd(e,l);var w=y=i.createElement("link");Rt(w),Bt(w,"link",e),w._p=new Promise(function(_,I){w.onload=_,w.onerror=I}),w.addEventListener("load",function(){b.loading|=1}),w.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Mc(y,t,i)}y={type:"stylesheet",instance:y,count:1,state:b},o.set(d,y)}}}function Mb(e,t){ga.X(e,t);var l=Ms;if(l&&e){var i=es(l).hoistableScripts,o=zs(e),d=i.get(o);d||(d=l.querySelector(Pi(o)),d||(e=x({src:e,async:!0},t),(t=Cn.get(o))&&Ed(e,t),d=l.createElement("script"),Rt(d),Bt(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},i.set(o,d))}}function kb(e,t){ga.M(e,t);var l=Ms;if(l&&e){var i=es(l).hoistableScripts,o=zs(e),d=i.get(o);d||(d=l.querySelector(Pi(o)),d||(e=x({src:e,async:!0,type:"module"},t),(t=Cn.get(o))&&Ed(e,t),d=l.createElement("script"),Rt(d),Bt(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},i.set(o,d))}}function My(e,t,l,i){var o=(o=oe.current)?Oc(o):null;if(!o)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=ks(l.href),l=es(o).hoistableStyles,i=l.get(t),i||(i={type:"style",instance:null,count:0,state:null},l.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=ks(l.href);var d=es(o).hoistableStyles,y=d.get(e);if(y||(o=o.ownerDocument||o,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,y),(d=o.querySelector(Yi(e)))&&!d._p&&(y.instance=d,y.state.loading=5),Cn.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Cn.set(e,l),d||zb(o,e,l,y.state))),t&&i===null)throw Error(c(528,""));return y}if(t&&i!==null)throw Error(c(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=zs(l),l=es(o).hoistableScripts,i=l.get(t),i||(i={type:"script",instance:null,count:0,state:null},l.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,e))}}function ks(e){return'href="'+yn(e)+'"'}function Yi(e){return'link[rel="stylesheet"]['+e+"]"}function ky(e){return x({},e,{"data-precedence":e.precedence,precedence:null})}function zb(e,t,l,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),Bt(t,"link",l),Rt(t),e.head.appendChild(t))}function zs(e){return'[src="'+yn(e)+'"]'}function Pi(e){return"script[async]"+e}function zy(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+yn(l.href)+'"]');if(i)return t.instance=i,Rt(i),i;var o=x({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),Rt(i),Bt(i,"style",o),Mc(i,l.precedence,e),t.instance=i;case"stylesheet":o=ks(l.href);var d=e.querySelector(Yi(o));if(d)return t.state.loading|=4,t.instance=d,Rt(d),d;i=ky(l),(o=Cn.get(o))&&Cd(i,o),d=(e.ownerDocument||e).createElement("link"),Rt(d);var y=d;return y._p=new Promise(function(b,w){y.onload=b,y.onerror=w}),Bt(d,"link",i),t.state.loading|=4,Mc(d,l.precedence,e),t.instance=d;case"script":return d=zs(l.src),(o=e.querySelector(Pi(d)))?(t.instance=o,Rt(o),o):(i=l,(o=Cn.get(d))&&(i=x({},l),Ed(i,o)),e=e.ownerDocument||e,o=e.createElement("script"),Rt(o),Bt(o,"link",i),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,Mc(i,l.precedence,e));return t.instance}function Mc(e,t,l){for(var i=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=i.length?i[i.length-1]:null,d=o,y=0;y<i.length;y++){var b=i[y];if(b.dataset.precedence===t)d=b;else if(d!==o)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Cd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ed(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var kc=null;function Dy(e,t,l){if(kc===null){var i=new Map,o=kc=new Map;o.set(l,i)}else o=kc,i=o.get(l),i||(i=new Map,o.set(l,i));if(i.has(e))return i;for(i.set(e,null),l=l.getElementsByTagName(e),o=0;o<l.length;o++){var d=l[o];if(!(d[oi]||d[kt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var y=d.getAttribute(t)||"";y=e+y;var b=i.get(y);b?b.push(d):i.set(y,[d])}}return i}function qy(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function Db(e,t,l){if(l===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 By(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function qb(e,t,l,i){if(l.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var o=ks(i.href),d=t.querySelector(Yi(o));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=zc.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=d,Rt(d);return}d=t.ownerDocument||t,i=ky(i),(o=Cn.get(o))&&Cd(i,o),d=d.createElement("link"),Rt(d);var y=d;y._p=new Promise(function(b,w){y.onload=b,y.onerror=w}),Bt(d,"link",i),l.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=zc.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Td=0;function Bb(e,t){return e.stylesheets&&e.count===0&&qc(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var i=setTimeout(function(){if(e.stylesheets&&qc(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&Td===0&&(Td=62500*yb());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&qc(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>Td?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(o)}}:null}function zc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Dc=null;function qc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Dc=new Map,t.forEach(Lb,e),Dc=null,zc.call(e))}function Lb(e,t){if(!(t.state.loading&4)){var l=Dc.get(e);if(l)var i=l.get(null);else{l=new Map,Dc.set(e,l);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<o.length;d++){var y=o[d];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(l.set(y.dataset.precedence,y),i=y)}i&&l.set(null,i)}o=t.instance,y=o.getAttribute("data-precedence"),d=l.get(y)||i,d===i&&l.set(null,o),l.set(y,o),this.count++,i=zc.bind(this),o.addEventListener("load",i),o.addEventListener("error",i),d?d.parentNode.insertBefore(o,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var Fi={$$typeof:q,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function _b(e,t,l,i,o,d,y,b,w){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=bo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bo(0),this.hiddenUpdates=bo(null),this.identifierPrefix=i,this.onUncaughtError=o,this.onCaughtError=d,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=w,this.incompleteTransitions=new Map}function Ly(e,t,l,i,o,d,y,b,w,_,I,V){return e=new _b(e,t,l,y,w,_,I,V,b),t=1,d===!0&&(t|=24),d=an(3,null,null,t),e.current=d,d.stateNode=e,t=su(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:i,isDehydrated:l,cache:t},ou(d),e}function _y(e){return e?(e=us,e):us}function Uy(e,t,l,i,o,d){o=_y(o),i.context===null?i.context=o:i.pendingContext=o,i=Qa(t),i.payload={element:l},d=d===void 0?null:d,d!==null&&(i.callback=d),l=$a(e,i,t),l!==null&&(Zt(l,e,t),Ti(l,e,t))}function Qy(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function wd(e,t){Qy(e,t),(e=e.alternate)&&Qy(e,t)}function $y(e){if(e.tag===13||e.tag===31){var t=El(e,67108864);t!==null&&Zt(t,e,67108864),wd(e,67108864)}}function Hy(e){if(e.tag===13||e.tag===31){var t=on();t=So(t);var l=El(e,t);l!==null&&Zt(l,e,t),wd(e,t)}}var Bc=!0;function Ub(e,t,l,i){var o=k.T;k.T=null;var d=Z.p;try{Z.p=2,Rd(e,t,l,i)}finally{Z.p=d,k.T=o}}function Qb(e,t,l,i){var o=k.T;k.T=null;var d=Z.p;try{Z.p=8,Rd(e,t,l,i)}finally{Z.p=d,k.T=o}}function Rd(e,t,l,i){if(Bc){var o=Ad(i);if(o===null)md(e,t,i,Lc,l),Gy(e,i);else if(Hb(o,e,t,l,i))i.stopPropagation();else if(Gy(e,i),t&4&&-1<$b.indexOf(e)){for(;o!==null;){var d=Wl(o);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var y=jl(d.pendingLanes);if(y!==0){var b=d;for(b.pendingLanes|=2,b.entangledLanes|=2;y;){var w=1<<31-xt(y);b.entanglements[1]|=w,y&=~w}In(d),($e&6)===0&&(xc=Ke()+500,Hi(0))}}break;case 31:case 13:b=El(d,2),b!==null&&Zt(b,d,2),bc(),wd(d,2)}if(d=Ad(i),d===null&&md(e,t,i,Lc,l),d===o)break;o=d}o!==null&&i.stopPropagation()}else md(e,t,i,null,l)}}function Ad(e){return e=Mo(e),Od(e)}var Lc=null;function Od(e){if(Lc=null,e=Zl(e),e!==null){var t=f(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=h(t),e!==null)return e;e=null}else if(l===31){if(e=m(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Lc=e,null}function Ky(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($n()){case Zn:return 2;case vl:return 8;case xl:case Nr:return 32;case ii:return 268435456;default:return 32}default:return 32}}var Md=!1,Za=null,Wa=null,el=null,Xi=new Map,Vi=new Map,tl=[],$b="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 Gy(e,t){switch(e){case"focusin":case"focusout":Za=null;break;case"dragenter":case"dragleave":Wa=null;break;case"mouseover":case"mouseout":el=null;break;case"pointerover":case"pointerout":Xi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Vi.delete(t.pointerId)}}function Ji(e,t,l,i,o,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:l,eventSystemFlags:i,nativeEvent:d,targetContainers:[o]},t!==null&&(t=Wl(t),t!==null&&$y(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function Hb(e,t,l,i,o){switch(t){case"focusin":return Za=Ji(Za,e,t,l,i,o),!0;case"dragenter":return Wa=Ji(Wa,e,t,l,i,o),!0;case"mouseover":return el=Ji(el,e,t,l,i,o),!0;case"pointerover":var d=o.pointerId;return Xi.set(d,Ji(Xi.get(d)||null,e,t,l,i,o)),!0;case"gotpointercapture":return d=o.pointerId,Vi.set(d,Ji(Vi.get(d)||null,e,t,l,i,o)),!0}return!1}function Iy(e){var t=Zl(e.target);if(t!==null){var l=f(t);if(l!==null){if(t=l.tag,t===13){if(t=h(l),t!==null){e.blockedOn=t,sh(e.priority,function(){Hy(l)});return}}else if(t===31){if(t=m(l),t!==null){e.blockedOn=t,sh(e.priority,function(){Hy(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function _c(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Ad(e.nativeEvent);if(l===null){l=e.nativeEvent;var i=new l.constructor(l.type,l);Oo=i,l.target.dispatchEvent(i),Oo=null}else return t=Wl(l),t!==null&&$y(t),e.blockedOn=l,!1;t.shift()}return!0}function Yy(e,t,l){_c(e)&&l.delete(t)}function Kb(){Md=!1,Za!==null&&_c(Za)&&(Za=null),Wa!==null&&_c(Wa)&&(Wa=null),el!==null&&_c(el)&&(el=null),Xi.forEach(Yy),Vi.forEach(Yy)}function Uc(e,t){e.blockedOn===t&&(e.blockedOn=null,Md||(Md=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Kb)))}var Qc=null;function Py(e){Qc!==e&&(Qc=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Qc===e&&(Qc=null);for(var t=0;t<e.length;t+=3){var l=e[t],i=e[t+1],o=e[t+2];if(typeof i!="function"){if(Od(i||l)===null)continue;break}var d=Wl(l);d!==null&&(e.splice(t,3),t-=3,Au(d,{pending:!0,data:o,method:l.method,action:i},i,o))}}))}function Ds(e){function t(w){return Uc(w,e)}Za!==null&&Uc(Za,e),Wa!==null&&Uc(Wa,e),el!==null&&Uc(el,e),Xi.forEach(t),Vi.forEach(t);for(var l=0;l<tl.length;l++){var i=tl[l];i.blockedOn===e&&(i.blockedOn=null)}for(;0<tl.length&&(l=tl[0],l.blockedOn===null);)Iy(l),l.blockedOn===null&&tl.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(i=0;i<l.length;i+=3){var o=l[i],d=l[i+1],y=o[Yt]||null;if(typeof d=="function")y||Py(l);else if(y){var b=null;if(d&&d.hasAttribute("formAction")){if(o=d,y=d[Yt]||null)b=y.formAction;else if(Od(o)!==null)continue}else b=y.action;typeof b=="function"?l[i+1]=b:(l.splice(i,3),i-=3),Py(l)}}}function Fy(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(y){return o=y})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),i||setTimeout(l,20)}function l(){if(!i&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function kd(e){this._internalRoot=e}$c.prototype.render=kd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));var l=t.current,i=on();Uy(l,i,e,t,null,null)},$c.prototype.unmount=kd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Uy(e.current,2,null,e,null,null),bc(),t[Jl]=null}};function $c(e){this._internalRoot=e}$c.prototype.unstable_scheduleHydration=function(e){if(e){var t=lh();e={blockedOn:null,target:e,priority:t};for(var l=0;l<tl.length&&t!==0&&t<tl[l].priority;l++);tl.splice(l,0,e),l===0&&Iy(e)}};var Xy=s.version;if(Xy!=="19.2.7")throw Error(c(527,Xy,"19.2.7"));Z.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(c(188)):(e=Object.keys(e).join(","),Error(c(268,e)));return e=g(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var Gb={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:k,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hc.isDisabled&&Hc.supportsFiber)try{ka=Hc.inject(Gb),ce=Hc}catch{}}return Wi.createRoot=function(e,t){if(!u(e))throw Error(c(299));var l=!1,i="",o=np,d=ap,y=lp;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=Ly(e,1,!1,null,null,l,i,null,o,d,y,Fy),e[Jl]=t.current,hd(e),new kd(t)},Wi.hydrateRoot=function(e,t,l){if(!u(e))throw Error(c(299));var i=!1,o="",d=np,y=ap,b=lp,w=null;return l!=null&&(l.unstable_strictMode===!0&&(i=!0),l.identifierPrefix!==void 0&&(o=l.identifierPrefix),l.onUncaughtError!==void 0&&(d=l.onUncaughtError),l.onCaughtError!==void 0&&(y=l.onCaughtError),l.onRecoverableError!==void 0&&(b=l.onRecoverableError),l.formState!==void 0&&(w=l.formState)),t=Ly(e,1,!0,t,l??null,i,o,w,d,y,b,Fy),t.context=_y(null),l=t.current,i=on(),i=So(i),o=Qa(i),o.callback=null,$a(l,o,i),l=i,t.current.lanes=l,ci(t,l),In(t),e[Jl]=t.current,hd(e),new $c(t)},Wi.version="19.2.7",Wi}var rg;function n0(){if(rg)return Bd.exports;rg=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(s){console.error(s)}}return a(),Bd.exports=t0(),Bd.exports}var a0=n0(),ei=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(a){return this.listeners.add(a),this.onSubscribe(),()=>{this.listeners.delete(a),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ql,il,$s,Yg,l0=(Yg=class extends ei{constructor(){super();ge(this,Ql);ge(this,il);ge(this,$s);ie(this,$s,s=>{if(typeof window<"u"&&window.addEventListener){const r=()=>s();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){R(this,il)||this.setEventListener(R(this,$s))}onUnsubscribe(){var s;this.hasListeners()||((s=R(this,il))==null||s.call(this),ie(this,il,void 0))}setEventListener(s){var r;ie(this,$s,s),(r=R(this,il))==null||r.call(this),ie(this,il,s(c=>{typeof c=="boolean"?this.setFocused(c):this.onFocus()}))}setFocused(s){R(this,Ql)!==s&&(ie(this,Ql,s),this.onFocus())}onFocus(){const s=this.isFocused();this.listeners.forEach(r=>{r(s)})}isFocused(){var s;return typeof R(this,Ql)=="boolean"?R(this,Ql):((s=globalThis.document)==null?void 0:s.visibilityState)!=="hidden"}},Ql=new WeakMap,il=new WeakMap,$s=new WeakMap,Yg),Mf=new l0,s0={setTimeout:(a,s)=>setTimeout(a,s),clearTimeout:a=>clearTimeout(a),setInterval:(a,s)=>setInterval(a,s),clearInterval:a=>clearInterval(a)},rl,Af,Pg,i0=(Pg=class{constructor(){ge(this,rl,s0);ge(this,Af,!1)}setTimeoutProvider(a){ie(this,rl,a)}setTimeout(a,s){return R(this,rl).setTimeout(a,s)}clearTimeout(a){R(this,rl).clearTimeout(a)}setInterval(a,s){return R(this,rl).setInterval(a,s)}clearInterval(a){R(this,rl).clearInterval(a)}},rl=new WeakMap,Af=new WeakMap,Pg),Ul=new i0;function r0(a){setTimeout(a,0)}var c0=typeof window>"u"||"Deno"in globalThis;function Gt(){}function o0(a,s){return typeof a=="function"?a(s):a}function af(a){return typeof a=="number"&&a>=0&&a!==1/0}function av(a,s){return Math.max(a+(s||0)-Date.now(),0)}function yl(a,s){return typeof a=="function"?a(s):a}function fn(a,s){return typeof a=="function"?a(s):a}function cg(a,s){const{type:r="all",exact:c,fetchStatus:u,predicate:f,queryKey:h,stale:m}=a;if(h){if(c){if(s.queryHash!==kf(h,s.options))return!1}else if(!cr(s.queryKey,h))return!1}if(r!=="all"){const p=s.isActive();if(r==="active"&&!p||r==="inactive"&&p)return!1}return!(typeof m=="boolean"&&s.isStale()!==m||u&&u!==s.state.fetchStatus||f&&!f(s))}function og(a,s){const{exact:r,status:c,predicate:u,mutationKey:f}=a;if(f){if(!s.options.mutationKey)return!1;if(r){if(Vl(s.options.mutationKey)!==Vl(f))return!1}else if(!cr(s.options.mutationKey,f))return!1}return!(c&&s.state.status!==c||u&&!u(s))}function kf(a,s){return((s==null?void 0:s.queryKeyHashFn)||Vl)(a)}function Vl(a){return JSON.stringify(a,(s,r)=>lf(r)?Object.keys(r).sort().reduce((c,u)=>(c[u]=r[u],c),{}):r)}function cr(a,s){return a===s?!0:typeof a!=typeof s?!1:a&&s&&typeof a=="object"&&typeof s=="object"?Object.keys(s).every(r=>cr(a[r],s[r])):!1}var u0=Object.prototype.hasOwnProperty;function lv(a,s,r=0){if(a===s)return a;if(r>500)return s;const c=ug(a)&&ug(s);if(!c&&!(lf(a)&&lf(s)))return s;const f=(c?a:Object.keys(a)).length,h=c?s:Object.keys(s),m=h.length,p=c?new Array(m):{};let g=0;for(let v=0;v<m;v++){const x=c?v:h[v],N=a[x],j=s[x];if(N===j){p[x]=N,(c?v<f:u0.call(a,x))&&g++;continue}if(N===null||j===null||typeof N!="object"||typeof j!="object"){p[x]=j;continue}const E=lv(N,j,r+1);p[x]=E,E===N&&g++}return f===m&&g===f?a:p}function eo(a,s){if(!s||Object.keys(a).length!==Object.keys(s).length)return!1;for(const r in a)if(a[r]!==s[r])return!1;return!0}function ug(a){return Array.isArray(a)&&a.length===Object.keys(a).length}function lf(a){if(!dg(a))return!1;const s=a.constructor;if(s===void 0)return!0;const r=s.prototype;return!(!dg(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(a)!==Object.prototype)}function dg(a){return Object.prototype.toString.call(a)==="[object Object]"}function d0(a){return new Promise(s=>{Ul.setTimeout(s,a)})}function sf(a,s,r){return typeof r.structuralSharing=="function"?r.structuralSharing(a,s):r.structuralSharing!==!1?lv(a,s):s}function f0(a,s,r=0){const c=[...a,s];return r&&c.length>r?c.slice(1):c}function h0(a,s,r=0){const c=[s,...a];return r&&c.length>r?c.slice(0,-1):c}var zf=Symbol();function sv(a,s){return!a.queryFn&&(s!=null&&s.initialPromise)?()=>s.initialPromise:!a.queryFn||a.queryFn===zf?()=>Promise.reject(new Error(`Missing queryFn: '${a.queryHash}'`)):a.queryFn}function Df(a,s){return typeof a=="function"?a(...s):!!a}function m0(a,s,r){let c=!1,u;return Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(u??(u=s()),c||(c=!0,u.aborted?r():u.addEventListener("abort",r,{once:!0})),u)}),a}var or=(()=>{let a=()=>c0;return{isServer(){return a()},setIsServer(s){a=s}}})();function rf(){let a,s;const r=new Promise((u,f)=>{a=u,s=f});r.status="pending",r.catch(()=>{});function c(u){Object.assign(r,u),delete r.resolve,delete r.reject}return r.resolve=u=>{c({status:"fulfilled",value:u}),a(u)},r.reject=u=>{c({status:"rejected",reason:u}),s(u)},r}var p0=r0;function y0(){let a=[],s=0,r=m=>{m()},c=m=>{m()},u=p0;const f=m=>{s?a.push(m):u(()=>{r(m)})},h=()=>{const m=a;a=[],m.length&&u(()=>{c(()=>{m.forEach(p=>{r(p)})})})};return{batch:m=>{let p;s++;try{p=m()}finally{s--,s||h()}return p},batchCalls:m=>(...p)=>{f(()=>{m(...p)})},schedule:f,setNotifyFunction:m=>{r=m},setBatchNotifyFunction:m=>{c=m},setScheduler:m=>{u=m}}}var wt=y0(),Hs,cl,Ks,Fg,g0=(Fg=class extends ei{constructor(){super();ge(this,Hs,!0);ge(this,cl);ge(this,Ks);ie(this,Ks,s=>{if(typeof window<"u"&&window.addEventListener){const r=()=>s(!0),c=()=>s(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",c,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",c)}}})}onSubscribe(){R(this,cl)||this.setEventListener(R(this,Ks))}onUnsubscribe(){var s;this.hasListeners()||((s=R(this,cl))==null||s.call(this),ie(this,cl,void 0))}setEventListener(s){var r;ie(this,Ks,s),(r=R(this,cl))==null||r.call(this),ie(this,cl,s(this.setOnline.bind(this)))}setOnline(s){R(this,Hs)!==s&&(ie(this,Hs,s),this.listeners.forEach(c=>{c(s)}))}isOnline(){return R(this,Hs)}},Hs=new WeakMap,cl=new WeakMap,Ks=new WeakMap,Fg),to=new g0;function v0(a){return Math.min(1e3*2**a,3e4)}function iv(a){return(a??"online")==="online"?to.isOnline():!0}var cf=class extends Error{constructor(a){super("CancelledError"),this.revert=a==null?void 0:a.revert,this.silent=a==null?void 0:a.silent}};function rv(a){let s=!1,r=0,c;const u=rf(),f=()=>u.status!=="pending",h=C=>{var A;if(!f()){const O=new cf(C);N(O),(A=a.onCancel)==null||A.call(a,O)}},m=()=>{s=!0},p=()=>{s=!1},g=()=>Mf.isFocused()&&(a.networkMode==="always"||to.isOnline())&&a.canRun(),v=()=>iv(a.networkMode)&&a.canRun(),x=C=>{f()||(c==null||c(),u.resolve(C))},N=C=>{f()||(c==null||c(),u.reject(C))},j=()=>new Promise(C=>{var A;c=O=>{(f()||g())&&C(O)},(A=a.onPause)==null||A.call(a)}).then(()=>{var C;c=void 0,f()||(C=a.onContinue)==null||C.call(a)}),E=()=>{if(f())return;let C;const A=r===0?a.initialPromise:void 0;try{C=A??a.fn()}catch(O){C=Promise.reject(O)}Promise.resolve(C).then(x).catch(O=>{var J;if(f())return;const U=a.retry??(or.isServer()?0:3),q=a.retryDelay??v0,z=typeof q=="function"?q(r,O):q,K=U===!0||typeof U=="number"&&r<U||typeof U=="function"&&U(r,O);if(s||!K){N(O);return}r++,(J=a.onFail)==null||J.call(a,r,O),d0(z).then(()=>g()?void 0:j()).then(()=>{s?N(O):E()})})};return{promise:u,status:()=>u.status,cancel:h,continue:()=>(c==null||c(),u),cancelRetry:m,continueRetry:p,canStart:v,start:()=>(v()?E():j().then(E),u)}}var $l,Xg,cv=(Xg=class{constructor(){ge(this,$l)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),af(this.gcTime)&&ie(this,$l,Ul.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(a){this.gcTime=Math.max(this.gcTime||0,a??(or.isServer()?1/0:300*1e3))}clearGcTimeout(){R(this,$l)!==void 0&&(Ul.clearTimeout(R(this,$l)),ie(this,$l,void 0))}},$l=new WeakMap,Xg);function x0(a){return{onFetch:(s,r)=>{var v,x,N,j,E;const c=s.options,u=(N=(x=(v=s.fetchOptions)==null?void 0:v.meta)==null?void 0:x.fetchMore)==null?void 0:N.direction,f=((j=s.state.data)==null?void 0:j.pages)||[],h=((E=s.state.data)==null?void 0:E.pageParams)||[];let m={pages:[],pageParams:[]},p=0;const g=async()=>{let C=!1;const A=q=>{m0(q,()=>s.signal,()=>C=!0)},O=sv(s.options,s.fetchOptions),U=async(q,z,K)=>{if(C)return Promise.reject(s.signal.reason);if(z==null&&q.pages.length)return Promise.resolve(q);const G=(()=>{const he={client:s.client,queryKey:s.queryKey,pageParam:z,direction:K?"backward":"forward",meta:s.options.meta};return A(he),he})(),$=await O(G),{maxPages:ee}=s.options,pe=K?h0:f0;return{pages:pe(q.pages,$,ee),pageParams:pe(q.pageParams,z,ee)}};if(u&&f.length){const q=u==="backward",z=q?ov:of,K={pages:f,pageParams:h},J=z(c,K);m=await U(K,J,q)}else{const q=a??f.length;do{const z=p===0?h[0]??c.initialPageParam:of(c,m);if(p>0&&z==null)break;m=await U(m,z),p++}while(p<q)}return m};s.options.persister?s.fetchFn=()=>{var C,A;return(A=(C=s.options).persister)==null?void 0:A.call(C,g,{client:s.client,queryKey:s.queryKey,meta:s.options.meta,signal:s.signal},r)}:s.fetchFn=g}}}function of(a,{pages:s,pageParams:r}){const c=s.length-1;return s.length>0?a.getNextPageParam(s[c],s,r[c],r):void 0}function ov(a,{pages:s,pageParams:r}){var c;return s.length>0?(c=a.getPreviousPageParam)==null?void 0:c.call(a,s[0],s,r[0],r):void 0}function j0(a,s){return s?of(a,s)!=null:!1}function b0(a,s){return!s||!a.getPreviousPageParam?!1:ov(a,s)!=null}var Gs,Hl,Is,Tn,Kl,Ot,mr,Gl,dn,uv,Sa,Vg,S0=(Vg=class extends cv{constructor(s){super();ge(this,dn);ge(this,Gs);ge(this,Hl);ge(this,Is);ge(this,Tn);ge(this,Kl);ge(this,Ot);ge(this,mr);ge(this,Gl);ie(this,Gl,!1),ie(this,mr,s.defaultOptions),this.setOptions(s.options),this.observers=[],ie(this,Kl,s.client),ie(this,Tn,R(this,Kl).getQueryCache()),this.queryKey=s.queryKey,this.queryHash=s.queryHash,ie(this,Hl,hg(this.options)),this.state=s.state??R(this,Hl),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return R(this,Gs)}get promise(){var s;return(s=R(this,Ot))==null?void 0:s.promise}setOptions(s){if(this.options={...R(this,mr),...s},s!=null&&s._type&&ie(this,Gs,s._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=hg(this.options);r.data!==void 0&&(this.setState(fg(r.data,r.dataUpdatedAt)),ie(this,Hl,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&R(this,Tn).remove(this)}setData(s,r){const c=sf(this.state.data,s,this.options);return Ae(this,dn,Sa).call(this,{data:c,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),c}setState(s){Ae(this,dn,Sa).call(this,{type:"setState",state:s})}cancel(s){var c,u;const r=(c=R(this,Ot))==null?void 0:c.promise;return(u=R(this,Ot))==null||u.cancel(s),r?r.then(Gt).catch(Gt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return R(this,Hl)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(s=>fn(s.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===zf||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(s=>yl(s.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(s=>s.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(s=0){return this.state.data===void 0?!0:s==="static"?!1:this.state.isInvalidated?!0:!av(this.state.dataUpdatedAt,s)}onFocus(){var r;const s=this.observers.find(c=>c.shouldFetchOnWindowFocus());s==null||s.refetch({cancelRefetch:!1}),(r=R(this,Ot))==null||r.continue()}onOnline(){var r;const s=this.observers.find(c=>c.shouldFetchOnReconnect());s==null||s.refetch({cancelRefetch:!1}),(r=R(this,Ot))==null||r.continue()}addObserver(s){this.observers.includes(s)||(this.observers.push(s),this.clearGcTimeout(),R(this,Tn).notify({type:"observerAdded",query:this,observer:s}))}removeObserver(s){this.observers.includes(s)&&(this.observers=this.observers.filter(r=>r!==s),this.observers.length||(R(this,Ot)&&(R(this,Gl)||Ae(this,dn,uv).call(this)?R(this,Ot).cancel({revert:!0}):R(this,Ot).cancelRetry()),this.scheduleGc()),R(this,Tn).notify({type:"observerRemoved",query:this,observer:s}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ae(this,dn,Sa).call(this,{type:"invalidate"})}async fetch(s,r){var g,v,x,N,j,E,C,A,O,U,q;if(this.state.fetchStatus!=="idle"&&((g=R(this,Ot))==null?void 0:g.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(R(this,Ot))return R(this,Ot).continueRetry(),R(this,Ot).promise}if(s&&this.setOptions(s),!this.options.queryFn){const z=this.observers.find(K=>K.options.queryFn);z&&this.setOptions(z.options)}const c=new AbortController,u=z=>{Object.defineProperty(z,"signal",{enumerable:!0,get:()=>(ie(this,Gl,!0),c.signal)})},f=()=>{const z=sv(this.options,r),J=(()=>{const G={client:R(this,Kl),queryKey:this.queryKey,meta:this.meta};return u(G),G})();return ie(this,Gl,!1),this.options.persister?this.options.persister(z,J,this):z(J)},m=(()=>{const z={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:R(this,Kl),state:this.state,fetchFn:f};return u(z),z})(),p=R(this,Gs)==="infinite"?x0(this.options.pages):this.options.behavior;p==null||p.onFetch(m,this),ie(this,Is,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((v=m.fetchOptions)==null?void 0:v.meta))&&Ae(this,dn,Sa).call(this,{type:"fetch",meta:(x=m.fetchOptions)==null?void 0:x.meta}),ie(this,Ot,rv({initialPromise:r==null?void 0:r.initialPromise,fn:m.fetchFn,onCancel:z=>{z instanceof cf&&z.revert&&this.setState({...R(this,Is),fetchStatus:"idle"}),c.abort()},onFail:(z,K)=>{Ae(this,dn,Sa).call(this,{type:"failed",failureCount:z,error:K})},onPause:()=>{Ae(this,dn,Sa).call(this,{type:"pause"})},onContinue:()=>{Ae(this,dn,Sa).call(this,{type:"continue"})},retry:m.options.retry,retryDelay:m.options.retryDelay,networkMode:m.options.networkMode,canRun:()=>!0}));try{const z=await R(this,Ot).start();if(z===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(z),(j=(N=R(this,Tn).config).onSuccess)==null||j.call(N,z,this),(C=(E=R(this,Tn).config).onSettled)==null||C.call(E,z,this.state.error,this),z}catch(z){if(z instanceof cf){if(z.silent)return R(this,Ot).promise;if(z.revert){if(this.state.data===void 0)throw z;return this.state.data}}throw Ae(this,dn,Sa).call(this,{type:"error",error:z}),(O=(A=R(this,Tn).config).onError)==null||O.call(A,z,this),(q=(U=R(this,Tn).config).onSettled)==null||q.call(U,this.state.data,z,this),z}finally{this.scheduleGc()}}},Gs=new WeakMap,Hl=new WeakMap,Is=new WeakMap,Tn=new WeakMap,Kl=new WeakMap,Ot=new WeakMap,mr=new WeakMap,Gl=new WeakMap,dn=new WeakSet,uv=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Sa=function(s){const r=c=>{switch(s.type){case"failed":return{...c,fetchFailureCount:s.failureCount,fetchFailureReason:s.error};case"pause":return{...c,fetchStatus:"paused"};case"continue":return{...c,fetchStatus:"fetching"};case"fetch":return{...c,...dv(c.data,this.options),fetchMeta:s.meta??null};case"success":const u={...c,...fg(s.data,s.dataUpdatedAt),dataUpdateCount:c.dataUpdateCount+1,...!s.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ie(this,Is,s.manual?u:void 0),u;case"error":const f=s.error;return{...c,error:f,errorUpdateCount:c.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:c.fetchFailureCount+1,fetchFailureReason:f,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...c,isInvalidated:!0};case"setState":return{...c,...s.state}}};this.state=r(this.state),wt.batch(()=>{this.observers.forEach(c=>{c.onQueryUpdate()}),R(this,Tn).notify({query:this,type:"updated",action:s})})},Vg);function dv(a,s){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:iv(s.networkMode)?"fetching":"paused",...a===void 0&&{error:null,status:"pending"}}}function fg(a,s){return{data:a,dataUpdatedAt:s??Date.now(),error:null,isInvalidated:!1,status:"success"}}function hg(a){const s=typeof a.initialData=="function"?a.initialData():a.initialData,r=s!==void 0,c=r?typeof a.initialDataUpdatedAt=="function"?a.initialDataUpdatedAt():a.initialDataUpdatedAt:0;return{data:s,dataUpdateCount:0,dataUpdatedAt:r?c??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Wt,_e,pr,Kt,Il,Ys,Ca,ol,yr,Ps,Fs,Yl,Pl,ul,Xs,He,lr,uf,df,ff,hf,mf,pf,yf,hv,Jg,fv=(Jg=class extends ei{constructor(s,r){super();ge(this,He);ge(this,Wt);ge(this,_e);ge(this,pr);ge(this,Kt);ge(this,Il);ge(this,Ys);ge(this,Ca);ge(this,ol);ge(this,yr);ge(this,Ps);ge(this,Fs);ge(this,Yl);ge(this,Pl);ge(this,ul);ge(this,Xs,new Set);this.options=r,ie(this,Wt,s),ie(this,ol,null),ie(this,Ca,rf()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(R(this,_e).addObserver(this),mg(R(this,_e),this.options)?Ae(this,He,lr).call(this):this.updateResult(),Ae(this,He,hf).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return gf(R(this,_e),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return gf(R(this,_e),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ae(this,He,mf).call(this),Ae(this,He,pf).call(this),R(this,_e).removeObserver(this)}setOptions(s){const r=this.options,c=R(this,_e);if(this.options=R(this,Wt).defaultQueryOptions(s),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof fn(this.options.enabled,R(this,_e))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ae(this,He,yf).call(this),R(this,_e).setOptions(this.options),r._defaulted&&!eo(this.options,r)&&R(this,Wt).getQueryCache().notify({type:"observerOptionsUpdated",query:R(this,_e),observer:this});const u=this.hasListeners();u&&pg(R(this,_e),c,this.options,r)&&Ae(this,He,lr).call(this),this.updateResult(),u&&(R(this,_e)!==c||fn(this.options.enabled,R(this,_e))!==fn(r.enabled,R(this,_e))||yl(this.options.staleTime,R(this,_e))!==yl(r.staleTime,R(this,_e)))&&Ae(this,He,uf).call(this);const f=Ae(this,He,df).call(this);u&&(R(this,_e)!==c||fn(this.options.enabled,R(this,_e))!==fn(r.enabled,R(this,_e))||f!==R(this,ul))&&Ae(this,He,ff).call(this,f)}getOptimisticResult(s){const r=R(this,Wt).getQueryCache().build(R(this,Wt),s),c=this.createResult(r,s);return C0(this,c)&&(ie(this,Kt,c),ie(this,Ys,this.options),ie(this,Il,R(this,_e).state)),c}getCurrentResult(){return R(this,Kt)}trackResult(s,r){return new Proxy(s,{get:(c,u)=>(this.trackProp(u),r==null||r(u),u==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&R(this,Ca).status==="pending"&&R(this,Ca).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(c,u))})}trackProp(s){R(this,Xs).add(s)}getCurrentQuery(){return R(this,_e)}refetch({...s}={}){return this.fetch({...s})}fetchOptimistic(s){const r=R(this,Wt).defaultQueryOptions(s),c=R(this,Wt).getQueryCache().build(R(this,Wt),r);return c.fetch().then(()=>this.createResult(c,r))}fetch(s){return Ae(this,He,lr).call(this,{...s,cancelRefetch:s.cancelRefetch??!0}).then(()=>(this.updateResult(),R(this,Kt)))}createResult(s,r){var ee;const c=R(this,_e),u=this.options,f=R(this,Kt),h=R(this,Il),m=R(this,Ys),g=s!==c?s.state:R(this,pr),{state:v}=s;let x={...v},N=!1,j;if(r._optimisticResults){const pe=this.hasListeners(),he=!pe&&mg(s,r),ye=pe&&pg(s,c,r,u);(he||ye)&&(x={...x,...dv(v.data,s.options)}),r._optimisticResults==="isRestoring"&&(x.fetchStatus="idle")}let{error:E,errorUpdatedAt:C,status:A}=x;j=x.data;let O=!1;if(r.placeholderData!==void 0&&j===void 0&&A==="pending"){let pe;f!=null&&f.isPlaceholderData&&r.placeholderData===(m==null?void 0:m.placeholderData)?(pe=f.data,O=!0):pe=typeof r.placeholderData=="function"?r.placeholderData((ee=R(this,Fs))==null?void 0:ee.state.data,R(this,Fs)):r.placeholderData,pe!==void 0&&(A="success",j=sf(f==null?void 0:f.data,pe,r),N=!0)}if(r.select&&j!==void 0&&!O)if(f&&j===(h==null?void 0:h.data)&&r.select===R(this,yr))j=R(this,Ps);else try{ie(this,yr,r.select),j=r.select(j),j=sf(f==null?void 0:f.data,j,r),ie(this,Ps,j),ie(this,ol,null)}catch(pe){ie(this,ol,pe)}R(this,ol)&&(E=R(this,ol),j=R(this,Ps),C=Date.now(),A="error");const U=x.fetchStatus==="fetching",q=A==="pending",z=A==="error",K=q&&U,J=j!==void 0,$={status:A,fetchStatus:x.fetchStatus,isPending:q,isSuccess:A==="success",isError:z,isInitialLoading:K,isLoading:K,data:j,dataUpdatedAt:x.dataUpdatedAt,error:E,errorUpdatedAt:C,failureCount:x.fetchFailureCount,failureReason:x.fetchFailureReason,errorUpdateCount:x.errorUpdateCount,isFetched:s.isFetched(),isFetchedAfterMount:x.dataUpdateCount>g.dataUpdateCount||x.errorUpdateCount>g.errorUpdateCount,isFetching:U,isRefetching:U&&!q,isLoadingError:z&&!J,isPaused:x.fetchStatus==="paused",isPlaceholderData:N,isRefetchError:z&&J,isStale:qf(s,r),refetch:this.refetch,promise:R(this,Ca),isEnabled:fn(r.enabled,s)!==!1};if(this.options.experimental_prefetchInRender){const pe=$.data!==void 0,he=$.status==="error"&&!pe,ye=xe=>{he?xe.reject($.error):pe&&xe.resolve($.data)},Ee=()=>{const xe=ie(this,Ca,$.promise=rf());ye(xe)},me=R(this,Ca);switch(me.status){case"pending":s.queryHash===c.queryHash&&ye(me);break;case"fulfilled":(he||$.data!==me.value)&&Ee();break;case"rejected":(!he||$.error!==me.reason)&&Ee();break}}return $}updateResult(){const s=R(this,Kt),r=this.createResult(R(this,_e),this.options);if(ie(this,Il,R(this,_e).state),ie(this,Ys,this.options),R(this,Il).data!==void 0&&ie(this,Fs,R(this,_e)),eo(r,s))return;ie(this,Kt,r);const c=()=>{if(!s)return!0;const{notifyOnChangeProps:u}=this.options,f=typeof u=="function"?u():u;if(f==="all"||!f&&!R(this,Xs).size)return!0;const h=new Set(f??R(this,Xs));return this.options.throwOnError&&h.add("error"),Object.keys(R(this,Kt)).some(m=>{const p=m;return R(this,Kt)[p]!==s[p]&&h.has(p)})};Ae(this,He,hv).call(this,{listeners:c()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ae(this,He,hf).call(this)}},Wt=new WeakMap,_e=new WeakMap,pr=new WeakMap,Kt=new WeakMap,Il=new WeakMap,Ys=new WeakMap,Ca=new WeakMap,ol=new WeakMap,yr=new WeakMap,Ps=new WeakMap,Fs=new WeakMap,Yl=new WeakMap,Pl=new WeakMap,ul=new WeakMap,Xs=new WeakMap,He=new WeakSet,lr=function(s){Ae(this,He,yf).call(this);let r=R(this,_e).fetch(this.options,s);return s!=null&&s.throwOnError||(r=r.catch(Gt)),r},uf=function(){Ae(this,He,mf).call(this);const s=yl(this.options.staleTime,R(this,_e));if(or.isServer()||R(this,Kt).isStale||!af(s))return;const c=av(R(this,Kt).dataUpdatedAt,s)+1;ie(this,Yl,Ul.setTimeout(()=>{R(this,Kt).isStale||this.updateResult()},c))},df=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(R(this,_e)):this.options.refetchInterval)??!1},ff=function(s){Ae(this,He,pf).call(this),ie(this,ul,s),!(or.isServer()||fn(this.options.enabled,R(this,_e))===!1||!af(R(this,ul))||R(this,ul)===0)&&ie(this,Pl,Ul.setInterval(()=>{(this.options.refetchIntervalInBackground||Mf.isFocused())&&Ae(this,He,lr).call(this)},R(this,ul)))},hf=function(){Ae(this,He,uf).call(this),Ae(this,He,ff).call(this,Ae(this,He,df).call(this))},mf=function(){R(this,Yl)!==void 0&&(Ul.clearTimeout(R(this,Yl)),ie(this,Yl,void 0))},pf=function(){R(this,Pl)!==void 0&&(Ul.clearInterval(R(this,Pl)),ie(this,Pl,void 0))},yf=function(){const s=R(this,Wt).getQueryCache().build(R(this,Wt),this.options);if(s===R(this,_e))return;const r=R(this,_e);ie(this,_e,s),ie(this,pr,s.state),this.hasListeners()&&(r==null||r.removeObserver(this),s.addObserver(this))},hv=function(s){wt.batch(()=>{s.listeners&&this.listeners.forEach(r=>{r(R(this,Kt))}),R(this,Wt).getQueryCache().notify({query:R(this,_e),type:"observerResultsUpdated"})})},Jg);function N0(a,s){return fn(s.enabled,a)!==!1&&a.state.data===void 0&&!(a.state.status==="error"&&fn(s.retryOnMount,a)===!1)}function mg(a,s){return N0(a,s)||a.state.data!==void 0&&gf(a,s,s.refetchOnMount)}function gf(a,s,r){if(fn(s.enabled,a)!==!1&&yl(s.staleTime,a)!=="static"){const c=typeof r=="function"?r(a):r;return c==="always"||c!==!1&&qf(a,s)}return!1}function pg(a,s,r,c){return(a!==s||fn(c.enabled,a)===!1)&&(!r.suspense||a.state.status!=="error")&&qf(a,r)}function qf(a,s){return fn(s.enabled,a)!==!1&&a.isStaleByTime(yl(s.staleTime,a))}function C0(a,s){return!eo(a.getCurrentResult(),s)}var E0=class extends fv{constructor(a,s){super(a,s)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(a){a._type="infinite",super.setOptions(a)}getOptimisticResult(a){return a._type="infinite",super.getOptimisticResult(a)}fetchNextPage(a){return this.fetch({...a,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(a){return this.fetch({...a,meta:{fetchMore:{direction:"backward"}}})}createResult(a,s){var E,C;const{state:r}=a,c=super.createResult(a,s),{isFetching:u,isRefetching:f,isError:h,isRefetchError:m}=c,p=(C=(E=r.fetchMeta)==null?void 0:E.fetchMore)==null?void 0:C.direction,g=h&&p==="forward",v=u&&p==="forward",x=h&&p==="backward",N=u&&p==="backward";return{...c,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:j0(s,r.data),hasPreviousPage:b0(s,r.data),isFetchNextPageError:g,isFetchingNextPage:v,isFetchPreviousPageError:x,isFetchingPreviousPage:N,isRefetchError:m&&!g&&!x,isRefetching:f&&!v&&!N}}},gr,Yn,$t,Fl,Pn,sl,Zg,T0=(Zg=class extends cv{constructor(s){super();ge(this,Pn);ge(this,gr);ge(this,Yn);ge(this,$t);ge(this,Fl);ie(this,gr,s.client),this.mutationId=s.mutationId,ie(this,$t,s.mutationCache),ie(this,Yn,[]),this.state=s.state||mv(),this.setOptions(s.options),this.scheduleGc()}setOptions(s){this.options=s,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(s){R(this,Yn).includes(s)||(R(this,Yn).push(s),this.clearGcTimeout(),R(this,$t).notify({type:"observerAdded",mutation:this,observer:s}))}removeObserver(s){ie(this,Yn,R(this,Yn).filter(r=>r!==s)),this.scheduleGc(),R(this,$t).notify({type:"observerRemoved",mutation:this,observer:s})}optionalRemove(){R(this,Yn).length||(this.state.status==="pending"?this.scheduleGc():R(this,$t).remove(this))}continue(){var s;return((s=R(this,Fl))==null?void 0:s.continue())??this.execute(this.state.variables)}async execute(s){var h,m,p,g,v,x,N,j,E,C,A,O,U,q,z,K,J,G;const r=()=>{Ae(this,Pn,sl).call(this,{type:"continue"})},c={client:R(this,gr),meta:this.options.meta,mutationKey:this.options.mutationKey};ie(this,Fl,rv({fn:()=>this.options.mutationFn?this.options.mutationFn(s,c):Promise.reject(new Error("No mutationFn found")),onFail:($,ee)=>{Ae(this,Pn,sl).call(this,{type:"failed",failureCount:$,error:ee})},onPause:()=>{Ae(this,Pn,sl).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>R(this,$t).canRun(this)}));const u=this.state.status==="pending",f=!R(this,Fl).canStart();try{if(u)r();else{Ae(this,Pn,sl).call(this,{type:"pending",variables:s,isPaused:f}),R(this,$t).config.onMutate&&await R(this,$t).config.onMutate(s,this,c);const ee=await((m=(h=this.options).onMutate)==null?void 0:m.call(h,s,c));ee!==this.state.context&&Ae(this,Pn,sl).call(this,{type:"pending",context:ee,variables:s,isPaused:f})}const $=await R(this,Fl).start();return await((g=(p=R(this,$t).config).onSuccess)==null?void 0:g.call(p,$,s,this.state.context,this,c)),await((x=(v=this.options).onSuccess)==null?void 0:x.call(v,$,s,this.state.context,c)),await((j=(N=R(this,$t).config).onSettled)==null?void 0:j.call(N,$,null,this.state.variables,this.state.context,this,c)),await((C=(E=this.options).onSettled)==null?void 0:C.call(E,$,null,s,this.state.context,c)),Ae(this,Pn,sl).call(this,{type:"success",data:$}),$}catch($){try{await((O=(A=R(this,$t).config).onError)==null?void 0:O.call(A,$,s,this.state.context,this,c))}catch(ee){Promise.reject(ee)}try{await((q=(U=this.options).onError)==null?void 0:q.call(U,$,s,this.state.context,c))}catch(ee){Promise.reject(ee)}try{await((K=(z=R(this,$t).config).onSettled)==null?void 0:K.call(z,void 0,$,this.state.variables,this.state.context,this,c))}catch(ee){Promise.reject(ee)}try{await((G=(J=this.options).onSettled)==null?void 0:G.call(J,void 0,$,s,this.state.context,c))}catch(ee){Promise.reject(ee)}throw Ae(this,Pn,sl).call(this,{type:"error",error:$}),$}finally{R(this,$t).runNext(this)}}},gr=new WeakMap,Yn=new WeakMap,$t=new WeakMap,Fl=new WeakMap,Pn=new WeakSet,sl=function(s){const r=c=>{switch(s.type){case"failed":return{...c,failureCount:s.failureCount,failureReason:s.error};case"pause":return{...c,isPaused:!0};case"continue":return{...c,isPaused:!1};case"pending":return{...c,context:s.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:s.isPaused,status:"pending",variables:s.variables,submittedAt:Date.now()};case"success":return{...c,data:s.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...c,data:void 0,error:s.error,failureCount:c.failureCount+1,failureReason:s.error,isPaused:!1,status:"error"}}};this.state=r(this.state),wt.batch(()=>{R(this,Yn).forEach(c=>{c.onMutationUpdate(s)}),R(this,$t).notify({mutation:this,type:"updated",action:s})})},Zg);function mv(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ea,_n,vr,Wg,w0=(Wg=class extends ei{constructor(s={}){super();ge(this,Ea);ge(this,_n);ge(this,vr);this.config=s,ie(this,Ea,new Set),ie(this,_n,new Map),ie(this,vr,0)}build(s,r,c){const u=new T0({client:s,mutationCache:this,mutationId:++Kc(this,vr)._,options:s.defaultMutationOptions(r),state:c});return this.add(u),u}add(s){R(this,Ea).add(s);const r=Gc(s);if(typeof r=="string"){const c=R(this,_n).get(r);c?c.push(s):R(this,_n).set(r,[s])}this.notify({type:"added",mutation:s})}remove(s){if(R(this,Ea).delete(s)){const r=Gc(s);if(typeof r=="string"){const c=R(this,_n).get(r);if(c)if(c.length>1){const u=c.indexOf(s);u!==-1&&c.splice(u,1)}else c[0]===s&&R(this,_n).delete(r)}}this.notify({type:"removed",mutation:s})}canRun(s){const r=Gc(s);if(typeof r=="string"){const c=R(this,_n).get(r),u=c==null?void 0:c.find(f=>f.state.status==="pending");return!u||u===s}else return!0}runNext(s){var c;const r=Gc(s);if(typeof r=="string"){const u=(c=R(this,_n).get(r))==null?void 0:c.find(f=>f!==s&&f.state.isPaused);return(u==null?void 0:u.continue())??Promise.resolve()}else return Promise.resolve()}clear(){wt.batch(()=>{R(this,Ea).forEach(s=>{this.notify({type:"removed",mutation:s})}),R(this,Ea).clear(),R(this,_n).clear()})}getAll(){return Array.from(R(this,Ea))}find(s){const r={exact:!0,...s};return this.getAll().find(c=>og(r,c))}findAll(s={}){return this.getAll().filter(r=>og(s,r))}notify(s){wt.batch(()=>{this.listeners.forEach(r=>{r(s)})})}resumePausedMutations(){const s=this.getAll().filter(r=>r.state.isPaused);return wt.batch(()=>Promise.all(s.map(r=>r.continue().catch(Gt))))}},Ea=new WeakMap,_n=new WeakMap,vr=new WeakMap,Wg);function Gc(a){var s;return(s=a.options.scope)==null?void 0:s.id}var Ta,dl,en,wa,Oa,Vc,vf,ev,R0=(ev=class extends ei{constructor(r,c){super();ge(this,Oa);ge(this,Ta);ge(this,dl);ge(this,en);ge(this,wa);ie(this,Ta,r),this.setOptions(c),this.bindMethods(),Ae(this,Oa,Vc).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var u;const c=this.options;this.options=R(this,Ta).defaultMutationOptions(r),eo(this.options,c)||R(this,Ta).getMutationCache().notify({type:"observerOptionsUpdated",mutation:R(this,en),observer:this}),c!=null&&c.mutationKey&&this.options.mutationKey&&Vl(c.mutationKey)!==Vl(this.options.mutationKey)?this.reset():((u=R(this,en))==null?void 0:u.state.status)==="pending"&&R(this,en).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=R(this,en))==null||r.removeObserver(this)}onMutationUpdate(r){Ae(this,Oa,Vc).call(this),Ae(this,Oa,vf).call(this,r)}getCurrentResult(){return R(this,dl)}reset(){var r;(r=R(this,en))==null||r.removeObserver(this),ie(this,en,void 0),Ae(this,Oa,Vc).call(this),Ae(this,Oa,vf).call(this)}mutate(r,c){var u;return ie(this,wa,c),(u=R(this,en))==null||u.removeObserver(this),ie(this,en,R(this,Ta).getMutationCache().build(R(this,Ta),this.options)),R(this,en).addObserver(this),R(this,en).execute(r)}},Ta=new WeakMap,dl=new WeakMap,en=new WeakMap,wa=new WeakMap,Oa=new WeakSet,Vc=function(){var c;const r=((c=R(this,en))==null?void 0:c.state)??mv();ie(this,dl,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},vf=function(r){wt.batch(()=>{var c,u,f,h,m,p,g,v;if(R(this,wa)&&this.hasListeners()){const x=R(this,dl).variables,N=R(this,dl).context,j={client:R(this,Ta),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(u=(c=R(this,wa)).onSuccess)==null||u.call(c,r.data,x,N,j)}catch(E){Promise.reject(E)}try{(h=(f=R(this,wa)).onSettled)==null||h.call(f,r.data,null,x,N,j)}catch(E){Promise.reject(E)}}else if((r==null?void 0:r.type)==="error"){try{(p=(m=R(this,wa)).onError)==null||p.call(m,r.error,x,N,j)}catch(E){Promise.reject(E)}try{(v=(g=R(this,wa)).onSettled)==null||v.call(g,void 0,r.error,x,N,j)}catch(E){Promise.reject(E)}}}this.listeners.forEach(x=>{x(R(this,dl))})})},ev),Fn,tv,A0=(tv=class extends ei{constructor(s={}){super();ge(this,Fn);this.config=s,ie(this,Fn,new Map)}build(s,r,c){const u=r.queryKey,f=r.queryHash??kf(u,r);let h=this.get(f);return h||(h=new S0({client:s,queryKey:u,queryHash:f,options:s.defaultQueryOptions(r),state:c,defaultOptions:s.getQueryDefaults(u)}),this.add(h)),h}add(s){R(this,Fn).has(s.queryHash)||(R(this,Fn).set(s.queryHash,s),this.notify({type:"added",query:s}))}remove(s){const r=R(this,Fn).get(s.queryHash);r&&(s.destroy(),r===s&&R(this,Fn).delete(s.queryHash),this.notify({type:"removed",query:s}))}clear(){wt.batch(()=>{this.getAll().forEach(s=>{this.remove(s)})})}get(s){return R(this,Fn).get(s)}getAll(){return[...R(this,Fn).values()]}find(s){const r={exact:!0,...s};return this.getAll().find(c=>cg(r,c))}findAll(s={}){const r=this.getAll();return Object.keys(s).length>0?r.filter(c=>cg(s,c)):r}notify(s){wt.batch(()=>{this.listeners.forEach(r=>{r(s)})})}onFocus(){wt.batch(()=>{this.getAll().forEach(s=>{s.onFocus()})})}onOnline(){wt.batch(()=>{this.getAll().forEach(s=>{s.onOnline()})})}},Fn=new WeakMap,tv),pt,fl,hl,Vs,Js,ml,Zs,Ws,nv,O0=(nv=class{constructor(a={}){ge(this,pt);ge(this,fl);ge(this,hl);ge(this,Vs);ge(this,Js);ge(this,ml);ge(this,Zs);ge(this,Ws);ie(this,pt,a.queryCache||new A0),ie(this,fl,a.mutationCache||new w0),ie(this,hl,a.defaultOptions||{}),ie(this,Vs,new Map),ie(this,Js,new Map),ie(this,ml,0)}mount(){Kc(this,ml)._++,R(this,ml)===1&&(ie(this,Zs,Mf.subscribe(async a=>{a&&(await this.resumePausedMutations(),R(this,pt).onFocus())})),ie(this,Ws,to.subscribe(async a=>{a&&(await this.resumePausedMutations(),R(this,pt).onOnline())})))}unmount(){var a,s;Kc(this,ml)._--,R(this,ml)===0&&((a=R(this,Zs))==null||a.call(this),ie(this,Zs,void 0),(s=R(this,Ws))==null||s.call(this),ie(this,Ws,void 0))}isFetching(a){return R(this,pt).findAll({...a,fetchStatus:"fetching"}).length}isMutating(a){return R(this,fl).findAll({...a,status:"pending"}).length}getQueryData(a){var r;const s=this.defaultQueryOptions({queryKey:a});return(r=R(this,pt).get(s.queryHash))==null?void 0:r.state.data}ensureQueryData(a){const s=this.defaultQueryOptions(a),r=R(this,pt).build(this,s),c=r.state.data;return c===void 0?this.fetchQuery(a):(a.revalidateIfStale&&r.isStaleByTime(yl(s.staleTime,r))&&this.prefetchQuery(s),Promise.resolve(c))}getQueriesData(a){return R(this,pt).findAll(a).map(({queryKey:s,state:r})=>{const c=r.data;return[s,c]})}setQueryData(a,s,r){const c=this.defaultQueryOptions({queryKey:a}),u=R(this,pt).get(c.queryHash),f=u==null?void 0:u.state.data,h=o0(s,f);if(h!==void 0)return R(this,pt).build(this,c).setData(h,{...r,manual:!0})}setQueriesData(a,s,r){return wt.batch(()=>R(this,pt).findAll(a).map(({queryKey:c})=>[c,this.setQueryData(c,s,r)]))}getQueryState(a){var r;const s=this.defaultQueryOptions({queryKey:a});return(r=R(this,pt).get(s.queryHash))==null?void 0:r.state}removeQueries(a){const s=R(this,pt);wt.batch(()=>{s.findAll(a).forEach(r=>{s.remove(r)})})}resetQueries(a,s){const r=R(this,pt);return wt.batch(()=>(r.findAll(a).forEach(c=>{c.reset()}),this.refetchQueries({type:"active",...a},s)))}cancelQueries(a,s={}){const r={revert:!0,...s},c=wt.batch(()=>R(this,pt).findAll(a).map(u=>u.cancel(r)));return Promise.all(c).then(Gt).catch(Gt)}invalidateQueries(a,s={}){return wt.batch(()=>(R(this,pt).findAll(a).forEach(r=>{r.invalidate()}),(a==null?void 0:a.refetchType)==="none"?Promise.resolve():this.refetchQueries({...a,type:(a==null?void 0:a.refetchType)??(a==null?void 0:a.type)??"active"},s)))}refetchQueries(a,s={}){const r={...s,cancelRefetch:s.cancelRefetch??!0},c=wt.batch(()=>R(this,pt).findAll(a).filter(u=>!u.isDisabled()&&!u.isStatic()).map(u=>{let f=u.fetch(void 0,r);return r.throwOnError||(f=f.catch(Gt)),u.state.fetchStatus==="paused"?Promise.resolve():f}));return Promise.all(c).then(Gt)}fetchQuery(a){const s=this.defaultQueryOptions(a);s.retry===void 0&&(s.retry=!1);const r=R(this,pt).build(this,s);return r.isStaleByTime(yl(s.staleTime,r))?r.fetch(s):Promise.resolve(r.state.data)}prefetchQuery(a){return this.fetchQuery(a).then(Gt).catch(Gt)}fetchInfiniteQuery(a){return a._type="infinite",this.fetchQuery(a)}prefetchInfiniteQuery(a){return this.fetchInfiniteQuery(a).then(Gt).catch(Gt)}ensureInfiniteQueryData(a){return a._type="infinite",this.ensureQueryData(a)}resumePausedMutations(){return to.isOnline()?R(this,fl).resumePausedMutations():Promise.resolve()}getQueryCache(){return R(this,pt)}getMutationCache(){return R(this,fl)}getDefaultOptions(){return R(this,hl)}setDefaultOptions(a){ie(this,hl,a)}setQueryDefaults(a,s){R(this,Vs).set(Vl(a),{queryKey:a,defaultOptions:s})}getQueryDefaults(a){const s=[...R(this,Vs).values()],r={};return s.forEach(c=>{cr(a,c.queryKey)&&Object.assign(r,c.defaultOptions)}),r}setMutationDefaults(a,s){R(this,Js).set(Vl(a),{mutationKey:a,defaultOptions:s})}getMutationDefaults(a){const s=[...R(this,Js).values()],r={};return s.forEach(c=>{cr(a,c.mutationKey)&&Object.assign(r,c.defaultOptions)}),r}defaultQueryOptions(a){if(a._defaulted)return a;const s={...R(this,hl).queries,...this.getQueryDefaults(a.queryKey),...a,_defaulted:!0};return s.queryHash||(s.queryHash=kf(s.queryKey,s)),s.refetchOnReconnect===void 0&&(s.refetchOnReconnect=s.networkMode!=="always"),s.throwOnError===void 0&&(s.throwOnError=!!s.suspense),!s.networkMode&&s.persister&&(s.networkMode="offlineFirst"),s.queryFn===zf&&(s.enabled=!1),s}defaultMutationOptions(a){return a!=null&&a._defaulted?a:{...R(this,hl).mutations,...(a==null?void 0:a.mutationKey)&&this.getMutationDefaults(a.mutationKey),...a,_defaulted:!0}}clear(){R(this,pt).clear(),R(this,fl).clear()}},pt=new WeakMap,fl=new WeakMap,hl=new WeakMap,Vs=new WeakMap,Js=new WeakMap,ml=new WeakMap,Zs=new WeakMap,Ws=new WeakMap,nv),pv=S.createContext(void 0),kn=a=>{const s=S.useContext(pv);if(!s)throw new Error("No QueryClient set, use QueryClientProvider to set one");return s},M0=({client:a,children:s})=>(S.useEffect(()=>(a.mount(),()=>{a.unmount()}),[a]),n.jsx(pv.Provider,{value:a,children:s})),yv=S.createContext(!1),k0=()=>S.useContext(yv);yv.Provider;function z0(){let a=!1;return{clearReset:()=>{a=!1},reset:()=>{a=!0},isReset:()=>a}}var D0=S.createContext(z0()),q0=()=>S.useContext(D0),B0=(a,s,r)=>{const c=r!=null&&r.state.error&&typeof a.throwOnError=="function"?Df(a.throwOnError,[r.state.error,r]):a.throwOnError;(a.suspense||a.experimental_prefetchInRender||c)&&(s.isReset()||(a.retryOnMount=!1))},L0=a=>{S.useEffect(()=>{a.clearReset()},[a])},_0=({result:a,errorResetBoundary:s,throwOnError:r,query:c,suspense:u})=>a.isError&&!s.isReset()&&!a.isFetching&&c&&(u&&a.data===void 0||Df(r,[a.error,c])),U0=a=>{if(a.suspense){const r=u=>u==="static"?u:Math.max(u??1e3,1e3),c=a.staleTime;a.staleTime=typeof c=="function"?(...u)=>r(c(...u)):r(c),typeof a.gcTime=="number"&&(a.gcTime=Math.max(a.gcTime,1e3))}},Q0=(a,s)=>a.isLoading&&a.isFetching&&!s,$0=(a,s)=>(a==null?void 0:a.suspense)&&s.isPending,yg=(a,s,r)=>s.fetchOptimistic(a).catch(()=>{r.clearReset()});function gv(a,s,r){var j,E,C,A;const c=k0(),u=q0(),f=kn(),h=f.defaultQueryOptions(a);(E=(j=f.getDefaultOptions().queries)==null?void 0:j._experimental_beforeQuery)==null||E.call(j,h);const m=f.getQueryCache().get(h.queryHash),p=a.subscribed!==!1;h._optimisticResults=c?"isRestoring":p?"optimistic":void 0,U0(h),B0(h,u,m),L0(u);const g=!f.getQueryCache().get(h.queryHash),[v]=S.useState(()=>new s(f,h)),x=v.getOptimisticResult(h),N=!c&&p;if(S.useSyncExternalStore(S.useCallback(O=>{const U=N?v.subscribe(wt.batchCalls(O)):Gt;return v.updateResult(),U},[v,N]),()=>v.getCurrentResult(),()=>v.getCurrentResult()),S.useEffect(()=>{v.setOptions(h)},[h,v]),$0(h,x))throw yg(h,v,u);if(_0({result:x,errorResetBoundary:u,throwOnError:h.throwOnError,query:m,suspense:h.suspense}))throw x.error;if((A=(C=f.getDefaultOptions().queries)==null?void 0:C._experimental_afterQuery)==null||A.call(C,h,x),h.experimental_prefetchInRender&&!or.isServer()&&Q0(x,c)){const O=g?yg(h,v,u):m==null?void 0:m.promise;O==null||O.catch(Gt).finally(()=>{v.updateResult()})}return h.notifyOnChangeProps?x:v.trackResult(x)}function fe(a,s){return gv(a,fv)}function Pe(a,s){const r=kn(),[c]=S.useState(()=>new R0(r,a));S.useEffect(()=>{c.setOptions(a)},[c,a]);const u=S.useSyncExternalStore(S.useCallback(h=>c.subscribe(wt.batchCalls(h)),[c]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),f=S.useCallback((h,m)=>{c.mutate(h,m).catch(Gt)},[c]);if(u.error&&Df(c.options.throwOnError,[u.error]))throw u.error;return{...u,mutate:f,mutateAsync:u.mutate}}function vv(a,s){return gv(a,E0)}const H0="exellix-memorix-agents.selected-agent",xv=S.createContext({agentId:"",setAgentId:()=>{},agentQueryParam:void 0});function K0({children:a,storageKey:s=H0}){const[r,c]=S.useState(()=>localStorage.getItem(s)??""),u=h=>{c(h),h?localStorage.setItem(s,h):localStorage.removeItem(s)},f=S.useMemo(()=>({agentId:r,setAgentId:u,agentQueryParam:r||void 0}),[r]);return n.jsx(xv.Provider,{value:f,children:a})}function zn(){return S.useContext(xv)}const G0="/api/memorix-agents";async function va(a,s,r){const c=`${a.replace(/\/$/,"")}${s}`,u=await fetch(c,r);if(!u.ok){const f=await u.json().catch(()=>({}));throw new Error(String(f.error??`${u.status} ${u.statusText}`))}return u.json()}function I0(a){return{listAgents:()=>va(a,""),getAgent:s=>va(a,`/${encodeURIComponent(s)}`),createAgent:s=>va(a,"",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),updateAgent:(s,r)=>va(a,`/${encodeURIComponent(s)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),deleteAgent:s=>va(a,`/${encodeURIComponent(s)}`,{method:"DELETE"}),listObjectTypeScopes:()=>va(a,"/object-types"),bindObjectTypeToAgent:(s,r)=>va(a,`/${encodeURIComponent(s)}/bind/${encodeURIComponent(r)}`,{method:"POST"}),unbindObjectTypeFromAgent:(s,r)=>va(a,`/${encodeURIComponent(s)}/bind/${encodeURIComponent(r)}`,{method:"DELETE"}),setObjectTypeScopeAgents:(s,r)=>va(a,`/object-types/${encodeURIComponent(s)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:r})})}}const gg=new Map;function jv(a=G0){const s=a.replace(/\/$/,""),r=gg.get(s);if(r)return r;const c=I0(s);return gg.set(s,c),c}jv();function Y0({client:a,apiBase:s,className:r}){const c=S.useMemo(()=>a??jv(s),[a,s]),{agentId:u,setAgentId:f}=zn(),[h,m]=S.useState([]),[p,g]=S.useState(!0),v=S.useCallback(async()=>{g(!0);try{m(await c.listAgents())}catch{m([])}finally{g(!1)}},[c]);S.useEffect(()=>{v()},[v]);const x=h.find(j=>j.id===u),N=u&&(h.length===0||x)?u:"";return n.jsxs("div",{className:`memorix-agents-scope${u?" scoped":""}${r?` ${r}`:""}`,title:"Filter views to one agent, or leave unscoped for all agents",children:[n.jsx("span",{className:"memorix-agents-scope-label",children:"Agent"}),n.jsxs("div",{className:"memorix-agents-scope-control",children:[n.jsxs("select",{className:`memorix-agents-scope-select${u?" scoped":""}`,value:N,onChange:j=>f(j.target.value),"aria-label":"Agent context filter",children:[n.jsx("option",{value:"",children:p?"Loading…":"Any agent"}),h.map(j=>n.jsx("option",{value:j.id,children:j.name===j.id?j.id:`${j.name} (${j.id})`},j.id)),u&&!x&&!p&&n.jsx("option",{value:u,children:u})]}),n.jsx("span",{className:"memorix-agents-scope-chevron","aria-hidden":"true",children:"▾"})]}),u&&n.jsx("button",{type:"button",className:"memorix-agents-scope-clear",onClick:()=>f(""),"aria-label":"Show all agents (clear scope)",title:"Any agent",children:"×"})]})}/**
50
+ * react-router v7.18.0
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */var Bf=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,bv=/^[\\/]{2}/;function P0(a,s){return s+a.replace(/\\/g,"/")}var vg="popstate";function xg(a){return typeof a=="object"&&a!=null&&"pathname"in a&&"search"in a&&"hash"in a&&"state"in a&&"key"in a}function F0(a={}){function s(c,u){var g;let f=(g=u.state)==null?void 0:g.masked,{pathname:h,search:m,hash:p}=f||c.location;return xf("",{pathname:h,search:m,hash:p},u.state&&u.state.usr||null,u.state&&u.state.key||"default",f?{pathname:c.location.pathname,search:c.location.search,hash:c.location.hash}:void 0)}function r(c,u){return typeof u=="string"?u:ur(u)}return V0(s,r,null,a)}function rt(a,s){if(a===!1||a===null||typeof a>"u")throw new Error(s)}function Mn(a,s){if(!a){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function X0(){return Math.random().toString(36).substring(2,10)}function jg(a,s){return{usr:a.state,key:a.key,idx:s,masked:a.mask?{pathname:a.pathname,search:a.search,hash:a.hash}:void 0}}function xf(a,s,r=null,c,u){return{pathname:typeof a=="string"?a:a.pathname,search:"",hash:"",...typeof s=="string"?ti(s):s,state:r,key:s&&s.key||c||X0(),mask:u}}function ur({pathname:a="/",search:s="",hash:r=""}){return s&&s!=="?"&&(a+=s.charAt(0)==="?"?s:"?"+s),r&&r!=="#"&&(a+=r.charAt(0)==="#"?r:"#"+r),a}function ti(a){let s={};if(a){let r=a.indexOf("#");r>=0&&(s.hash=a.substring(r),a=a.substring(0,r));let c=a.indexOf("?");c>=0&&(s.search=a.substring(c),a=a.substring(0,c)),a&&(s.pathname=a)}return s}function V0(a,s,r,c={}){let{window:u=document.defaultView,v5Compat:f=!1}=c,h=u.history,m="POP",p=null,g=v();g==null&&(g=0,h.replaceState({...h.state,idx:g},""));function v(){return(h.state||{idx:null}).idx}function x(){m="POP";let A=v(),O=A==null?null:A-g;g=A,p&&p({action:m,location:C.location,delta:O})}function N(A,O){m="PUSH";let U=xg(A)?A:xf(C.location,A,O);g=v()+1;let q=jg(U,g),z=C.createHref(U.mask||U);try{h.pushState(q,"",z)}catch(K){if(K instanceof DOMException&&K.name==="DataCloneError")throw K;u.location.assign(z)}f&&p&&p({action:m,location:C.location,delta:1})}function j(A,O){m="REPLACE";let U=xg(A)?A:xf(C.location,A,O);g=v();let q=jg(U,g),z=C.createHref(U.mask||U);h.replaceState(q,"",z),f&&p&&p({action:m,location:C.location,delta:0})}function E(A){return J0(u,A)}let C={get action(){return m},get location(){return a(u,h)},listen(A){if(p)throw new Error("A history only accepts one active listener");return u.addEventListener(vg,x),p=A,()=>{u.removeEventListener(vg,x),p=null}},createHref(A){return s(u,A)},createURL:E,encodeLocation(A){let O=E(A);return{pathname:O.pathname,search:O.search,hash:O.hash}},push:N,replace:j,go(A){return h.go(A)}};return C}function J0(a,s,r=!1){let c="http://localhost";a&&(c=a.location.origin!=="null"?a.location.origin:a.location.href),rt(c,"No window.location.(origin|href) available to create URL");let u=typeof s=="string"?s:ur(s);return u=u.replace(/ $/,"%20"),!r&&bv.test(u)&&(u=c+u),new URL(u,c)}function Sv(a,s,r="/"){return Z0(a,s,r,!1)}function Z0(a,s,r,c,u){let f=typeof s=="string"?ti(s):s,h=Ma(f.pathname||"/",r);if(h==null)return null;let m=W0(a),p=null,g=uS(h);for(let v=0;p==null&&v<m.length;++v)p=oS(m[v],g,c);return p}function W0(a){let s=Nv(a);return eS(s),s}function Nv(a,s=[],r=[],c="",u=!1){let f=(h,m,p=u,g)=>{let v={relativePath:g===void 0?h.path||"":g,caseSensitive:h.caseSensitive===!0,childrenIndex:m,route:h};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(c)&&p)return;rt(v.relativePath.startsWith(c),`Absolute route path "${v.relativePath}" nested under path "${c}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(c.length)}let x=Un([c,v.relativePath]),N=r.concat(v);h.children&&h.children.length>0&&(rt(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${x}".`),Nv(h.children,s,N,x,p)),!(h.path==null&&!h.index)&&s.push({path:x,score:rS(x,h.index),routesMeta:N.map((j,E)=>{let[C,A]=Tv(j.relativePath,j.caseSensitive,E===N.length-1);return{...j,matcher:C,compiledParams:A}})})};return a.forEach((h,m)=>{var p;if(h.path===""||!((p=h.path)!=null&&p.includes("?")))f(h,m);else for(let g of Cv(h.path))f(h,m,!0,g)}),s}function Cv(a){let s=a.split("/");if(s.length===0)return[];let[r,...c]=s,u=r.endsWith("?"),f=r.replace(/\?$/,"");if(c.length===0)return u?[f,""]:[f];let h=Cv(c.join("/")),m=[];return m.push(...h.map(p=>p===""?f:[f,p].join("/"))),u&&m.push(...h),m.map(p=>a.startsWith("/")&&p===""?"/":p)}function eS(a){a.sort((s,r)=>s.score!==r.score?r.score-s.score:cS(s.routesMeta.map(c=>c.childrenIndex),r.routesMeta.map(c=>c.childrenIndex)))}var tS=/^:[\w-]+$/,nS=3,aS=2,lS=1,sS=10,iS=-2,bg=a=>a==="*";function rS(a,s){let r=a.split("/"),c=r.length;return r.some(bg)&&(c+=iS),s&&(c+=aS),r.filter(u=>!bg(u)).reduce((u,f)=>u+(tS.test(f)?nS:f===""?lS:sS),c)}function cS(a,s){return a.length===s.length&&a.slice(0,-1).every((c,u)=>c===s[u])?a[a.length-1]-s[s.length-1]:0}function oS(a,s,r=!1){let{routesMeta:c}=a,u={},f="/",h=[];for(let m=0;m<c.length;++m){let p=c[m],g=m===c.length-1,v=f==="/"?s:s.slice(f.length)||"/",x={path:p.relativePath,caseSensitive:p.caseSensitive,end:g},N=p.matcher&&p.compiledParams?Ev(x,v,p.matcher,p.compiledParams):no(x,v),j=p.route;if(!N&&g&&r&&!c[c.length-1].route.index&&(N=no({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},v)),!N)return null;Object.assign(u,N.params),h.push({params:u,pathname:Un([f,N.pathname]),pathnameBase:hS(Un([f,N.pathnameBase])),route:j}),N.pathnameBase!=="/"&&(f=Un([f,N.pathnameBase]))}return h}function no(a,s){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[r,c]=Tv(a.path,a.caseSensitive,a.end);return Ev(a,s,r,c)}function Ev(a,s,r,c){let u=s.match(r);if(!u)return null;let f=u[0],h=f.replace(/(.)\/+$/,"$1"),m=u.slice(1);return{params:c.reduce((g,{paramName:v,isOptional:x},N)=>{if(v==="*"){let E=m[N]||"";h=f.slice(0,f.length-E.length).replace(/(.)\/+$/,"$1")}const j=m[N];return x&&!j?g[v]=void 0:g[v]=(j||"").replace(/%2F/g,"/"),g},{}),pathname:f,pathnameBase:h,pattern:a}}function Tv(a,s=!1,r=!0){Mn(a==="*"||!a.endsWith("*")||a.endsWith("/*"),`Route path "${a}" will be treated as if it were "${a.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${a.replace(/\*$/,"/*")}".`);let c=[],u="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,m,p,g,v)=>{if(c.push({paramName:m,isOptional:p!=null}),p){let x=v.charAt(g+h.length);return x&&x!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return a.endsWith("*")?(c.push({paramName:"*"}),u+=a==="*"||a==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?u+="\\/*$":a!==""&&a!=="/"&&(u+="(?:(?=\\/|$))"),[new RegExp(u,s?void 0:"i"),c]}function uS(a){try{return a.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Mn(!1,`The URL path "${a}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),a}}function Ma(a,s){if(s==="/")return a;if(!a.toLowerCase().startsWith(s.toLowerCase()))return null;let r=s.endsWith("/")?s.length-1:s.length,c=a.charAt(r);return c&&c!=="/"?null:a.slice(r)||"/"}function dS(a,s="/"){let{pathname:r,search:c="",hash:u=""}=typeof a=="string"?ti(a):a,f;return r?(r=wv(r),r.startsWith("/")?f=Sg(r.substring(1),"/"):f=Sg(r,s)):f=s,{pathname:f,search:mS(c),hash:pS(u)}}function Sg(a,s){let r=ao(s).split("/");return a.split("/").forEach(u=>{u===".."?r.length>1&&r.pop():u!=="."&&r.push(u)}),r.length>1?r.join("/"):"/"}function Qd(a,s,r,c){return`Cannot include a '${a}' character in a manually specified \`to.${s}\` field [${JSON.stringify(c)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function fS(a){return a.filter((s,r)=>r===0||s.route.path&&s.route.path.length>0)}function Lf(a){let s=fS(a);return s.map((r,c)=>c===s.length-1?r.pathname:r.pathnameBase)}function co(a,s,r,c=!1){let u;typeof a=="string"?u=ti(a):(u={...a},rt(!u.pathname||!u.pathname.includes("?"),Qd("?","pathname","search",u)),rt(!u.pathname||!u.pathname.includes("#"),Qd("#","pathname","hash",u)),rt(!u.search||!u.search.includes("#"),Qd("#","search","hash",u)));let f=a===""||u.pathname==="",h=f?"/":u.pathname,m;if(h==null)m=r;else{let x=s.length-1;if(!c&&h.startsWith("..")){let N=h.split("/");for(;N[0]==="..";)N.shift(),x-=1;u.pathname=N.join("/")}m=x>=0?s[x]:"/"}let p=dS(u,m),g=h&&h!=="/"&&h.endsWith("/"),v=(f||h===".")&&r.endsWith("/");return!p.pathname.endsWith("/")&&(g||v)&&(p.pathname+="/"),p}var wv=a=>a.replace(/[\\/]{2,}/g,"/"),Un=a=>wv(a.join("/")),ao=a=>a.replace(/\/+$/,""),hS=a=>ao(a).replace(/^\/*/,"/"),mS=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,pS=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a,yS=class{constructor(a,s,r,c=!1){this.status=a,this.statusText=s||"",this.internal=c,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function gS(a){return a!=null&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.internal=="boolean"&&"data"in a}function vS(a){let s=a.map(r=>r.route.path).filter(Boolean);return Un(s)||"/"}var Rv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Av(a,s){let r=a;if(typeof r!="string"||!Bf.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let c=r,u=!1;if(Rv)try{let f=new URL(window.location.href),h=bv.test(r)?new URL(P0(r,f.protocol)):new URL(r),m=Ma(h.pathname,s);h.origin===f.origin&&m!=null?r=m+h.search+h.hash:u=!0}catch{Mn(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:c,isExternal:u,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ov=["POST","PUT","PATCH","DELETE"];new Set(Ov);var xS=["GET",...Ov];new Set(xS);var jS=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function bS(a){try{return jS.includes(new URL(a).protocol)}catch{return!1}}var ni=S.createContext(null);ni.displayName="DataRouter";var oo=S.createContext(null);oo.displayName="DataRouterState";var Mv=S.createContext(!1);function SS(){return S.useContext(Mv)}var kv=S.createContext({isTransitioning:!1});kv.displayName="ViewTransition";var NS=S.createContext(new Map);NS.displayName="Fetchers";var CS=S.createContext(null);CS.displayName="Await";var hn=S.createContext(null);hn.displayName="Navigation";var xr=S.createContext(null);xr.displayName="Location";var Qn=S.createContext({outlet:null,matches:[],isDataRoute:!1});Qn.displayName="Route";var _f=S.createContext(null);_f.displayName="RouteError";var zv="REACT_ROUTER_ERROR",ES="REDIRECT",TS="ROUTE_ERROR_RESPONSE";function wS(a){if(a.startsWith(`${zv}:${ES}:{`))try{let s=JSON.parse(a.slice(28));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.location=="string"&&typeof s.reloadDocument=="boolean"&&typeof s.replace=="boolean")return s}catch{}}function RS(a){if(a.startsWith(`${zv}:${TS}:{`))try{let s=JSON.parse(a.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new yS(s.status,s.statusText,s.data)}catch{}}function AS(a,{relative:s}={}){rt(ai(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:c}=S.useContext(hn),{hash:u,pathname:f,search:h}=jr(a,{relative:s}),m=f;return r!=="/"&&(m=f==="/"?r:Un([r,f])),c.createHref({pathname:m,search:h,hash:u})}function ai(){return S.useContext(xr)!=null}function mn(){return rt(ai(),"useLocation() may be used only in the context of a <Router> component."),S.useContext(xr).location}var Dv="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function qv(a){S.useContext(hn).static||S.useLayoutEffect(a)}function tn(){let{isDataRoute:a}=S.useContext(Qn);return a?HS():OS()}function OS(){rt(ai(),"useNavigate() may be used only in the context of a <Router> component.");let a=S.useContext(ni),{basename:s,navigator:r}=S.useContext(hn),{matches:c}=S.useContext(Qn),{pathname:u}=mn(),f=JSON.stringify(Lf(c)),h=S.useRef(!1);return qv(()=>{h.current=!0}),S.useCallback((p,g={})=>{if(Mn(h.current,Dv),!h.current)return;if(typeof p=="number"){r.go(p);return}let v=co(p,JSON.parse(f),u,g.relative==="path");a==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:Un([s,v.pathname])),(g.replace?r.replace:r.push)(v,g.state,g)},[s,r,f,u,a])}S.createContext(null);function li(){let{matches:a}=S.useContext(Qn),s=a[a.length-1];return(s==null?void 0:s.params)??{}}function jr(a,{relative:s}={}){let{matches:r}=S.useContext(Qn),{pathname:c}=mn(),u=JSON.stringify(Lf(r));return S.useMemo(()=>co(a,JSON.parse(u),c,s==="path"),[a,u,c,s])}function MS(a,s){return Bv(a,s)}function Bv(a,s,r){var A;rt(ai(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:c}=S.useContext(hn),{matches:u}=S.useContext(Qn),f=u[u.length-1],h=f?f.params:{},m=f?f.pathname:"/",p=f?f.pathnameBase:"/",g=f&&f.route;{let O=g&&g.path||"";_v(m,!g||O.endsWith("*")||O.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${m}" (under <Route path="${O}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
+
60
+ Please change the parent <Route path="${O}"> to <Route path="${O==="/"?"*":`${O}/*`}">.`)}let v=mn(),x;if(s){let O=typeof s=="string"?ti(s):s;rt(p==="/"||((A=O.pathname)==null?void 0:A.startsWith(p)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${O.pathname}" was given in the \`location\` prop.`),x=O}else x=v;let N=x.pathname||"/",j=N;if(p!=="/"){let O=p.replace(/^\//,"").split("/");j="/"+N.replace(/^\//,"").split("/").slice(O.length).join("/")}let E=r&&r.state.matches.length?r.state.matches.map(O=>Object.assign(O,{route:r.manifest[O.route.id]||O.route})):Sv(a,{pathname:j});Mn(g||E!=null,`No routes matched location "${x.pathname}${x.search}${x.hash}" `),Mn(E==null||E[E.length-1].route.element!==void 0||E[E.length-1].route.Component!==void 0||E[E.length-1].route.lazy!==void 0,`Matched leaf route at location "${x.pathname}${x.search}${x.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let C=BS(E&&E.map(O=>Object.assign({},O,{params:Object.assign({},h,O.params),pathname:Un([p,c.encodeLocation?c.encodeLocation(O.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:O.pathname]),pathnameBase:O.pathnameBase==="/"?p:Un([p,c.encodeLocation?c.encodeLocation(O.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:O.pathnameBase])})),u,r);return s&&C?S.createElement(xr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...x},navigationType:"POP"}},C):C}function kS(){let a=$S(),s=gS(a)?`${a.status} ${a.statusText}`:a instanceof Error?a.message:JSON.stringify(a),r=a instanceof Error?a.stack:null,c="rgba(200,200,200, 0.5)",u={padding:"0.5rem",backgroundColor:c},f={padding:"2px 4px",backgroundColor:c},h=null;return console.error("Error handled by React Router default ErrorBoundary:",a),h=S.createElement(S.Fragment,null,S.createElement("p",null,"💿 Hey developer 👋"),S.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",S.createElement("code",{style:f},"ErrorBoundary")," or"," ",S.createElement("code",{style:f},"errorElement")," prop on your route.")),S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},s),r?S.createElement("pre",{style:u},r):null,h)}var zS=S.createElement(kS,null),Lv=class extends S.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,s){return s.location!==a.location||s.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:s.error,location:s.location,revalidation:a.revalidation||s.revalidation}}componentDidCatch(a,s){this.props.onError?this.props.onError(a,s):console.error("React Router caught the following error during render",a)}render(){let a=this.state.error;if(this.context&&typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){const r=RS(a.digest);r&&(a=r)}let s=a!==void 0?S.createElement(Qn.Provider,{value:this.props.routeContext},S.createElement(_f.Provider,{value:a,children:this.props.component})):this.props.children;return this.context?S.createElement(DS,{error:a},s):s}};Lv.contextType=Mv;var $d=new WeakMap;function DS({children:a,error:s}){let{basename:r}=S.useContext(hn);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let c=wS(s.digest);if(c){let u=$d.get(s);if(u)throw u;let f=Av(c.location,r),h=f.absoluteURL||f.to;if(bS(h))throw new Error("Invalid redirect location");if(Rv&&!$d.get(s))if(f.isExternal||c.reloadDocument)window.location.href=h;else{const m=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(f.to,{replace:c.replace}));throw $d.set(s,m),m}return S.createElement("meta",{httpEquiv:"refresh",content:`0;url=${h}`})}}return a}function qS({routeContext:a,match:s,children:r}){let c=S.useContext(ni);return c&&c.static&&c.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=s.route.id),S.createElement(Qn.Provider,{value:a},r)}function BS(a,s=[],r){let c=r==null?void 0:r.state;if(a==null){if(!c)return null;if(c.errors)a=c.matches;else if(s.length===0&&!c.initialized&&c.matches.length>0)a=c.matches;else return null}let u=a,f=c==null?void 0:c.errors;if(f!=null){let v=u.findIndex(x=>x.route.id&&(f==null?void 0:f[x.route.id])!==void 0);rt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),u=u.slice(0,Math.min(u.length,v+1))}let h=!1,m=-1;if(r&&c){h=c.renderFallback;for(let v=0;v<u.length;v++){let x=u[v];if((x.route.HydrateFallback||x.route.hydrateFallbackElement)&&(m=v),x.route.id){let{loaderData:N,errors:j}=c,E=x.route.loader&&!N.hasOwnProperty(x.route.id)&&(!j||j[x.route.id]===void 0);if(x.route.lazy||E){r.isStatic&&(h=!0),m>=0?u=u.slice(0,m+1):u=[u[0]];break}}}}let p=r==null?void 0:r.onError,g=c&&p?(v,x)=>{var N,j;p(v,{location:c.location,params:((j=(N=c.matches)==null?void 0:N[0])==null?void 0:j.params)??{},pattern:vS(c.matches),errorInfo:x})}:void 0;return u.reduceRight((v,x,N)=>{let j,E=!1,C=null,A=null;c&&(j=f&&x.route.id?f[x.route.id]:void 0,C=x.route.errorElement||zS,h&&(m<0&&N===0?(_v("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,A=null):m===N&&(E=!0,A=x.route.hydrateFallbackElement||null)));let O=s.concat(u.slice(0,N+1)),U=()=>{let q;return j?q=C:E?q=A:x.route.Component?q=S.createElement(x.route.Component,null):x.route.element?q=x.route.element:q=v,S.createElement(qS,{match:x,routeContext:{outlet:v,matches:O,isDataRoute:c!=null},children:q})};return c&&(x.route.ErrorBoundary||x.route.errorElement||N===0)?S.createElement(Lv,{location:c.location,revalidation:c.revalidation,component:C,error:j,children:U(),routeContext:{outlet:null,matches:O,isDataRoute:!0},onError:g}):U()},null)}function Uf(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function LS(a){let s=S.useContext(ni);return rt(s,Uf(a)),s}function _S(a){let s=S.useContext(oo);return rt(s,Uf(a)),s}function US(a){let s=S.useContext(Qn);return rt(s,Uf(a)),s}function Qf(a){let s=US(a),r=s.matches[s.matches.length-1];return rt(r.route.id,`${a} can only be used on routes that contain a unique "id"`),r.route.id}function QS(){return Qf("useRouteId")}function $S(){var c;let a=S.useContext(_f),s=_S("useRouteError"),r=Qf("useRouteError");return a!==void 0?a:(c=s.errors)==null?void 0:c[r]}function HS(){let{router:a}=LS("useNavigate"),s=Qf("useNavigate"),r=S.useRef(!1);return qv(()=>{r.current=!0}),S.useCallback(async(u,f={})=>{Mn(r.current,Dv),r.current&&(typeof u=="number"?await a.navigate(u):await a.navigate(u,{fromRouteId:s,...f}))},[a,s])}var Ng={};function _v(a,s,r){!s&&!Ng[a]&&(Ng[a]=!0,Mn(!1,r))}S.memo(KS);function KS({routes:a,manifest:s,future:r,state:c,isStatic:u,onError:f}){return Bv(a,void 0,{manifest:s,state:c,isStatic:u,onError:f})}function xa({to:a,replace:s,state:r,relative:c}){rt(ai(),"<Navigate> may be used only in the context of a <Router> component.");let{static:u}=S.useContext(hn);Mn(!u,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:f}=S.useContext(Qn),{pathname:h}=mn(),m=tn(),p=co(a,Lf(f),h,c==="path"),g=JSON.stringify(p);return S.useEffect(()=>{m(JSON.parse(g),{replace:s,state:r,relative:c})},[m,g,c,s,r]),null}function Ye(a){rt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function GS({basename:a="/",children:s=null,location:r,navigationType:c="POP",navigator:u,static:f=!1,useTransitions:h}){rt(!ai(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let m=a.replace(/^\/*/,"/"),p=S.useMemo(()=>({basename:m,navigator:u,static:f,useTransitions:h,future:{}}),[m,u,f,h]);typeof r=="string"&&(r=ti(r));let{pathname:g="/",search:v="",hash:x="",state:N=null,key:j="default",mask:E}=r,C=S.useMemo(()=>{let A=Ma(g,m);return A==null?null:{location:{pathname:A,search:v,hash:x,state:N,key:j,mask:E},navigationType:c}},[m,g,v,x,N,j,c,E]);return Mn(C!=null,`<Router basename="${m}"> is not able to match the URL "${g}${v}${x}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:S.createElement(hn.Provider,{value:p},S.createElement(xr.Provider,{children:s,value:C}))}function IS({children:a,location:s}){return MS(jf(a),s)}function jf(a,s=[]){let r=[];return S.Children.forEach(a,(c,u)=>{if(!S.isValidElement(c))return;let f=[...s,u];if(c.type===S.Fragment){r.push.apply(r,jf(c.props.children,f));return}rt(c.type===Ye,`[${typeof c.type=="string"?c.type:c.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),rt(!c.props.index||!c.props.children,"An index route cannot have child routes.");let h={id:c.props.id||f.join("-"),caseSensitive:c.props.caseSensitive,element:c.props.element,Component:c.props.Component,index:c.props.index,path:c.props.path,middleware:c.props.middleware,loader:c.props.loader,action:c.props.action,hydrateFallbackElement:c.props.hydrateFallbackElement,HydrateFallback:c.props.HydrateFallback,errorElement:c.props.errorElement,ErrorBoundary:c.props.ErrorBoundary,hasErrorBoundary:c.props.hasErrorBoundary===!0||c.props.ErrorBoundary!=null||c.props.errorElement!=null,shouldRevalidate:c.props.shouldRevalidate,handle:c.props.handle,lazy:c.props.lazy};c.props.children&&(h.children=jf(c.props.children,f)),r.push(h)}),r}var Jc="get",Zc="application/x-www-form-urlencoded";function uo(a){return typeof HTMLElement<"u"&&a instanceof HTMLElement}function YS(a){return uo(a)&&a.tagName.toLowerCase()==="button"}function PS(a){return uo(a)&&a.tagName.toLowerCase()==="form"}function FS(a){return uo(a)&&a.tagName.toLowerCase()==="input"}function XS(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function VS(a,s){return a.button===0&&(!s||s==="_self")&&!XS(a)}function bf(a=""){return new URLSearchParams(typeof a=="string"||Array.isArray(a)||a instanceof URLSearchParams?a:Object.keys(a).reduce((s,r)=>{let c=a[r];return s.concat(Array.isArray(c)?c.map(u=>[r,u]):[[r,c]])},[]))}function JS(a,s){let r=bf(a);return s&&s.forEach((c,u)=>{r.has(u)||s.getAll(u).forEach(f=>{r.append(u,f)})}),r}var Ic=null;function ZS(){if(Ic===null)try{new FormData(document.createElement("form"),0),Ic=!1}catch{Ic=!0}return Ic}var WS=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Hd(a){return a!=null&&!WS.has(a)?(Mn(!1,`"${a}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Zc}"`),null):a}function eN(a,s){let r,c,u,f,h;if(PS(a)){let m=a.getAttribute("action");c=m?Ma(m,s):null,r=a.getAttribute("method")||Jc,u=Hd(a.getAttribute("enctype"))||Zc,f=new FormData(a)}else if(YS(a)||FS(a)&&(a.type==="submit"||a.type==="image")){let m=a.form;if(m==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=a.getAttribute("formaction")||m.getAttribute("action");if(c=p?Ma(p,s):null,r=a.getAttribute("formmethod")||m.getAttribute("method")||Jc,u=Hd(a.getAttribute("formenctype"))||Hd(m.getAttribute("enctype"))||Zc,f=new FormData(m,a),!ZS()){let{name:g,type:v,value:x}=a;if(v==="image"){let N=g?`${g}.`:"";f.append(`${N}x`,"0"),f.append(`${N}y`,"0")}else g&&f.append(g,x)}}else{if(uo(a))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Jc,c=null,u=Zc,h=a}return f&&u==="text/plain"&&(h=f,f=void 0),{action:c,method:r.toLowerCase(),encType:u,formData:f,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function $f(a,s){if(a===!1||a===null||typeof a>"u")throw new Error(s)}function Uv(a,s,r,c){let u=typeof a=="string"?new URL(a,typeof window>"u"?"server://singlefetch/":window.location.origin):a;return r?u.pathname.endsWith("/")?u.pathname=`${u.pathname}_.${c}`:u.pathname=`${u.pathname}.${c}`:u.pathname==="/"?u.pathname=`_root.${c}`:s&&Ma(u.pathname,s)==="/"?u.pathname=`${ao(s)}/_root.${c}`:u.pathname=`${ao(u.pathname)}.${c}`,u}async function tN(a,s){if(a.id in s)return s[a.id];try{let r=await import(a.module);return s[a.id]=r,r}catch(r){return console.error(`Error loading route module \`${a.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function nN(a){return a==null?!1:a.href==null?a.rel==="preload"&&typeof a.imageSrcSet=="string"&&typeof a.imageSizes=="string":typeof a.rel=="string"&&typeof a.href=="string"}async function aN(a,s,r){let c=await Promise.all(a.map(async u=>{let f=s.routes[u.route.id];if(f){let h=await tN(f,r);return h.links?h.links():[]}return[]}));return rN(c.flat(1).filter(nN).filter(u=>u.rel==="stylesheet"||u.rel==="preload").map(u=>u.rel==="stylesheet"?{...u,rel:"prefetch",as:"style"}:{...u,rel:"prefetch"}))}function Cg(a,s,r,c,u,f){let h=(p,g)=>r[g]?p.route.id!==r[g].route.id:!0,m=(p,g)=>{var v;return r[g].pathname!==p.pathname||((v=r[g].route.path)==null?void 0:v.endsWith("*"))&&r[g].params["*"]!==p.params["*"]};return f==="assets"?s.filter((p,g)=>h(p,g)||m(p,g)):f==="data"?s.filter((p,g)=>{var x;let v=c.routes[p.route.id];if(!v||!v.hasLoader)return!1;if(h(p,g)||m(p,g))return!0;if(p.route.shouldRevalidate){let N=p.route.shouldRevalidate({currentUrl:new URL(u.pathname+u.search+u.hash,window.origin),currentParams:((x=r[0])==null?void 0:x.params)||{},nextUrl:new URL(a,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof N=="boolean")return N}return!0}):[]}function lN(a,s,{includeHydrateFallback:r}={}){return sN(a.map(c=>{let u=s.routes[c.route.id];if(!u)return[];let f=[u.module];return u.clientActionModule&&(f=f.concat(u.clientActionModule)),u.clientLoaderModule&&(f=f.concat(u.clientLoaderModule)),r&&u.hydrateFallbackModule&&(f=f.concat(u.hydrateFallbackModule)),u.imports&&(f=f.concat(u.imports)),f}).flat(1))}function sN(a){return[...new Set(a)]}function iN(a){let s={},r=Object.keys(a).sort();for(let c of r)s[c]=a[c];return s}function rN(a,s){let r=new Set;return new Set(s),a.reduce((c,u)=>{let f=JSON.stringify(iN(u));return r.has(f)||(r.add(f),c.push({key:f,link:u})),c},[])}function Hf(){let a=S.useContext(ni);return $f(a,"You must render this element inside a <DataRouterContext.Provider> element"),a}function cN(){let a=S.useContext(oo);return $f(a,"You must render this element inside a <DataRouterStateContext.Provider> element"),a}var Kf=S.createContext(void 0);Kf.displayName="FrameworkContext";function fo(){let a=S.useContext(Kf);return $f(a,"You must render this element inside a <HydratedRouter> element"),a}function oN(a,s){let r=S.useContext(Kf),[c,u]=S.useState(!1),[f,h]=S.useState(!1),{onFocus:m,onBlur:p,onMouseEnter:g,onMouseLeave:v,onTouchStart:x}=s,N=S.useRef(null);S.useEffect(()=>{if(a==="render"&&h(!0),a==="viewport"){let C=O=>{O.forEach(U=>{h(U.isIntersecting)})},A=new IntersectionObserver(C,{threshold:.5});return N.current&&A.observe(N.current),()=>{A.disconnect()}}},[a]),S.useEffect(()=>{if(c){let C=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(C)}}},[c]);let j=()=>{u(!0)},E=()=>{u(!1),h(!1)};return r?a!=="intent"?[f,N,{}]:[f,N,{onFocus:er(m,j),onBlur:er(p,E),onMouseEnter:er(g,j),onMouseLeave:er(v,E),onTouchStart:er(x,j)}]:[!1,N,{}]}function er(a,s){return r=>{a&&a(r),r.defaultPrevented||s(r)}}function uN({page:a,...s}){let r=SS(),{nonce:c}=fo(),{router:u}=Hf(),f=S.useMemo(()=>Sv(u.routes,a,u.basename),[u.routes,a,u.basename]);return f?(s.nonce==null&&c&&(s={...s,nonce:c}),r?S.createElement(fN,{page:a,matches:f,...s}):S.createElement(hN,{page:a,matches:f,...s})):null}function dN(a){let{manifest:s,routeModules:r}=fo(),[c,u]=S.useState([]);return S.useEffect(()=>{let f=!1;return aN(a,s,r).then(h=>{f||u(h)}),()=>{f=!0}},[a,s,r]),c}function fN({page:a,matches:s,...r}){let c=mn(),{future:u}=fo(),{basename:f}=Hf(),h=S.useMemo(()=>{if(a===c.pathname+c.search+c.hash)return[];let m=Uv(a,f,u.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,g=[];for(let v of s)typeof v.route.shouldRevalidate=="function"?p=!0:g.push(v.route.id);return p&&g.length>0&&m.searchParams.set("_routes",g.join(",")),[m.pathname+m.search]},[f,u.v8_trailingSlashAwareDataRequests,a,c,s]);return S.createElement(S.Fragment,null,h.map(m=>S.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...r})))}function hN({page:a,matches:s,...r}){let c=mn(),{future:u,manifest:f,routeModules:h}=fo(),{basename:m}=Hf(),{loaderData:p,matches:g}=cN(),v=S.useMemo(()=>Cg(a,s,g,f,c,"data"),[a,s,g,f,c]),x=S.useMemo(()=>Cg(a,s,g,f,c,"assets"),[a,s,g,f,c]),N=S.useMemo(()=>{if(a===c.pathname+c.search+c.hash)return[];let C=new Set,A=!1;if(s.forEach(U=>{var z;let q=f.routes[U.route.id];!q||!q.hasLoader||(!v.some(K=>K.route.id===U.route.id)&&U.route.id in p&&((z=h[U.route.id])!=null&&z.shouldRevalidate)||q.hasClientLoader?A=!0:C.add(U.route.id))}),C.size===0)return[];let O=Uv(a,m,u.v8_trailingSlashAwareDataRequests,"data");return A&&C.size>0&&O.searchParams.set("_routes",s.filter(U=>C.has(U.route.id)).map(U=>U.route.id).join(",")),[O.pathname+O.search]},[m,u.v8_trailingSlashAwareDataRequests,p,c,f,v,s,a,h]),j=S.useMemo(()=>lN(x,f),[x,f]),E=dN(x);return S.createElement(S.Fragment,null,N.map(C=>S.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...r})),j.map(C=>S.createElement("link",{key:C,rel:"modulepreload",href:C,...r})),E.map(({key:C,link:A})=>S.createElement("link",{key:C,nonce:r.nonce,...A,crossOrigin:A.crossOrigin??r.crossOrigin})))}function mN(...a){return s=>{a.forEach(r=>{typeof r=="function"?r(s):r!=null&&(r.current=s)})}}var pN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{pN&&(window.__reactRouterVersion="7.18.0")}catch{}function yN({basename:a,children:s,useTransitions:r,window:c}){let u=S.useRef();u.current==null&&(u.current=F0({window:c,v5Compat:!0}));let f=u.current,[h,m]=S.useState({action:f.action,location:f.location}),p=S.useCallback(g=>{r===!1?m(g):S.startTransition(()=>m(g))},[r]);return S.useLayoutEffect(()=>f.listen(p),[f,p]),S.createElement(GS,{basename:a,children:s,location:h.location,navigationType:h.action,navigator:f,useTransitions:r})}var ve=S.forwardRef(function({onClick:s,discover:r="render",prefetch:c="none",relative:u,reloadDocument:f,replace:h,mask:m,state:p,target:g,to:v,preventScrollReset:x,viewTransition:N,defaultShouldRevalidate:j,...E},C){let{basename:A,navigator:O,useTransitions:U}=S.useContext(hn),q=typeof v=="string"&&Bf.test(v),z=Av(v,A);v=z.to;let K=AS(v,{relative:u}),J=mn(),G=null;if(m){let xe=co(m,[],J.mask?J.mask.pathname:"/",!0);A!=="/"&&(xe.pathname=xe.pathname==="/"?A:Un([A,xe.pathname])),G=O.createHref(xe)}let[$,ee,pe]=oN(c,E),he=xN(v,{replace:h,mask:m,state:p,target:g,preventScrollReset:x,relative:u,viewTransition:N,defaultShouldRevalidate:j,useTransitions:U});function ye(xe){s&&s(xe),xe.defaultPrevented||he(xe)}let Ee=!(z.isExternal||f),me=S.createElement("a",{...E,...pe,href:(Ee?G:void 0)||z.absoluteURL||K,onClick:Ee?ye:s,ref:mN(C,ee),target:g,"data-discover":!q&&r==="render"?"true":void 0});return $&&!q?S.createElement(S.Fragment,null,me,S.createElement(uN,{page:K})):me});ve.displayName="Link";var Na=S.forwardRef(function({"aria-current":s="page",caseSensitive:r=!1,className:c="",end:u=!1,style:f,to:h,viewTransition:m,children:p,...g},v){let x=jr(h,{relative:g.relative}),N=mn(),j=S.useContext(oo),{navigator:E,basename:C}=S.useContext(hn),A=j!=null&&CN(x)&&m===!0,O=E.encodeLocation?E.encodeLocation(x).pathname:x.pathname,U=N.pathname,q=j&&j.navigation&&j.navigation.location?j.navigation.location.pathname:null;r||(U=U.toLowerCase(),q=q?q.toLowerCase():null,O=O.toLowerCase()),q&&C&&(q=Ma(q,C)||q);const z=O!=="/"&&O.endsWith("/")?O.length-1:O.length;let K=U===O||!u&&U.startsWith(O)&&U.charAt(z)==="/",J=q!=null&&(q===O||!u&&q.startsWith(O)&&q.charAt(O.length)==="/"),G={isActive:K,isPending:J,isTransitioning:A},$=K?s:void 0,ee;typeof c=="function"?ee=c(G):ee=[c,K?"active":null,J?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let pe=typeof f=="function"?f(G):f;return S.createElement(ve,{...g,"aria-current":$,className:ee,ref:v,style:pe,to:h,viewTransition:m},typeof p=="function"?p(G):p)});Na.displayName="NavLink";var gN=S.forwardRef(({discover:a="render",fetcherKey:s,navigate:r,reloadDocument:c,replace:u,state:f,method:h=Jc,action:m,onSubmit:p,relative:g,preventScrollReset:v,viewTransition:x,defaultShouldRevalidate:N,...j},E)=>{let{useTransitions:C}=S.useContext(hn),A=SN(),O=NN(m,{relative:g}),U=h.toLowerCase()==="get"?"get":"post",q=typeof m=="string"&&Bf.test(m),z=K=>{if(p&&p(K),K.defaultPrevented)return;K.preventDefault();let J=K.nativeEvent.submitter,G=(J==null?void 0:J.getAttribute("formmethod"))||h,$=()=>A(J||K.currentTarget,{fetcherKey:s,method:G,navigate:r,replace:u,state:f,relative:g,preventScrollReset:v,viewTransition:x,defaultShouldRevalidate:N});C&&r!==!1?S.startTransition(()=>$()):$()};return S.createElement("form",{ref:E,method:U,action:O,onSubmit:c?p:z,...j,"data-discover":!q&&a==="render"?"true":void 0})});gN.displayName="Form";function vN(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Qv(a){let s=S.useContext(ni);return rt(s,vN(a)),s}function xN(a,{target:s,replace:r,mask:c,state:u,preventScrollReset:f,relative:h,viewTransition:m,defaultShouldRevalidate:p,useTransitions:g}={}){let v=tn(),x=mn(),N=jr(a,{relative:h});return S.useCallback(j=>{if(VS(j,s)){j.preventDefault();let E=r!==void 0?r:ur(x)===ur(N),C=()=>v(a,{replace:E,mask:c,state:u,preventScrollReset:f,relative:h,viewTransition:m,defaultShouldRevalidate:p});g?S.startTransition(()=>C()):C()}},[x,v,N,r,c,u,s,a,f,h,m,p,g])}function si(a){Mn(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let s=S.useRef(bf(a)),r=S.useRef(!1),c=mn(),u=S.useMemo(()=>JS(c.search,r.current?null:s.current),[c.search]),f=tn(),h=S.useCallback((m,p)=>{const g=bf(typeof m=="function"?m(new URLSearchParams(u)):m);r.current=!0,f("?"+g,p)},[f,u]);return[u,h]}var jN=0,bN=()=>`__${String(++jN)}__`;function SN(){let{router:a}=Qv("useSubmit"),{basename:s}=S.useContext(hn),r=QS(),c=a.fetch,u=a.navigate;return S.useCallback(async(f,h={})=>{let{action:m,method:p,encType:g,formData:v,body:x}=eN(f,s);if(h.navigate===!1){let N=h.fetcherKey||bN();await c(N,r,h.action||m,{defaultShouldRevalidate:h.defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:v,body:x,formMethod:h.method||p,formEncType:h.encType||g,flushSync:h.flushSync})}else await u(h.action||m,{defaultShouldRevalidate:h.defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:v,body:x,formMethod:h.method||p,formEncType:h.encType||g,replace:h.replace,state:h.state,fromRouteId:r,flushSync:h.flushSync,viewTransition:h.viewTransition})},[c,u,s,r])}function NN(a,{relative:s}={}){let{basename:r}=S.useContext(hn),c=S.useContext(Qn);rt(c,"useFormAction must be used inside a RouteContext");let[u]=c.matches.slice(-1),f={...jr(a||".",{relative:s})},h=mn();if(a==null){f.search=h.search;let m=new URLSearchParams(f.search),p=m.getAll("index");if(p.some(v=>v==="")){m.delete("index"),p.filter(x=>x).forEach(x=>m.append("index",x));let v=m.toString();f.search=v?`?${v}`:""}}return(!a||a===".")&&u.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(f.pathname=f.pathname==="/"?r:Un([r,f.pathname])),ur(f)}function CN(a,{relative:s}={}){let r=S.useContext(kv);rt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:c}=Qv("useViewTransitionState"),u=jr(a,{relative:s});if(!r.isTransitioning)return!1;let f=Ma(r.currentLocation.pathname,c)||r.currentLocation.pathname,h=Ma(r.nextLocation.pathname,c)||r.nextLocation.pathname;return no(u.pathname,h)!=null||no(u.pathname,f)!=null}const EN="/api";async function pl(a,s,r){var h;const c=typeof window<"u"&&((h=window.location)!=null&&h.origin)&&window.location.origin!=="null"?window.location.origin:"http://localhost",u=new URL(EN+a,c);if(r)for(const[m,p]of Object.entries(r))p!==void 0&&p!==""&&u.searchParams.set(m,String(p));const f=await fetch(u.toString(),s);if(!f.ok){const m=await f.json().catch(()=>({}));throw new Error(String(m.error??`${f.status} ${f.statusText}`))}return f.json()}const Oe=(a,s)=>pl(a,void 0,s),ot=(a,s)=>pl(a,{method:"POST",headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0}),Eg=(a,s)=>pl(a,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),TN=a=>pl(a,{method:"DELETE"}),wN={health:()=>Oe("/health"),ready:()=>Oe("/ready"),config:()=>Oe("/config"),queueSettings:()=>Oe("/settings"),saveQueueSettings:a=>Eg("/settings",a),pushQueue:a=>ot("/queue/push",a),executeRun:(a,s)=>ot(`/factory-runs/${encodeURIComponent(a)}/execute`,s===void 0?{}:{force:s}),queueRunNext:a=>ot(`/factory-runs/${encodeURIComponent(a)}/queue-next`),statsByStatus:a=>Oe("/stats/by-status",{jobDefId:a}),throughput:a=>Oe("/stats/throughput",a),stuck:a=>Oe("/stats/stuck",a),runs:a=>Oe("/runs",a),recentFailures:a=>Oe("/runs/recent-failures",a),run:a=>Oe(`/runs/${a}`),runEvents:a=>Oe(`/runs/${a}/events`),runActivities:(a,s)=>Oe(`/factory-runs/${encodeURIComponent(a)}/activities`,s?{limit:s}:void 0),retryRun:a=>ot(`/factory-runs/${a}/retry`),cancelRun:a=>ot(`/factory-runs/${a}/cancel`),cancelRuns:a=>ot("/factory-runs/cancel",{runIds:a}),cancelAllRuns:a=>ot("/factory-runs/cancel-all",a),itemRuns:a=>Oe(`/items/${a}/runs`),itemGraph:a=>Oe(`/items/${a}/graph`),filters:()=>Oe("/meta/filters"),compatibleGraphs:a=>Oe("/meta/graphs",a),descriptors:()=>Oe("/descriptors"),entitySources:a=>Oe(`/entities/${encodeURIComponent(a)}/sources`),entityRelations:a=>Oe(`/entities/${encodeURIComponent(a)}/relations`),entityRecordSamples:(a,s)=>Oe(`/entities/${encodeURIComponent(a)}/record-samples`,{...s,random:s.random?"1":void 0}),jobDefs:()=>Oe("/job-defs"),jobDef:a=>Oe(`/job-defs/${a}`),saveJobDef:a=>ot("/job-defs",a),updateJobDef:(a,s)=>Eg(`/job-defs/${a}`,s),deleteJobDef:a=>TN(`/job-defs/${a}`),enqueue:a=>ot("/jobs/enqueue",a),previewContext:a=>ot("/context/preview",a),executeGraph:a=>ot("/graphs/execute",a),records:a=>Oe("/records",a),recordStats:a=>Oe("/records/stats",a),recordGraphRuns:(a,s)=>Oe(`/records/${encodeURIComponent(a)}/graph-runs`,s),listEntities:a=>Oe("/entities/summary",a?{agent:a}:void 0),entitySummary:a=>Oe(`/entities/${encodeURIComponent(a)}/summary`),listNarratives:a=>Oe("/narratives",a?{entity:a}:void 0),graphsForEntity:a=>Oe("/graphs",{entity:a}),coreRecords:a=>{var s;return Oe("/core-records",{entity:a.entity,collection:a.collection,narratives:(s=a.narratives)==null?void 0:s.join(","),processingGraphId:a.processingGraphId,processingCondition:a.processingCondition,search:a.search,page:a.page,pageSize:a.pageSize})},coreRecord:(a,s,r,c)=>Oe(`/core-records/${encodeURIComponent(a)}/${encodeURIComponent(s)}`,{collection:r,includeDoc:c?"1":void 0}),deleteCoreRecord:(a,s,r)=>pl(`/core-records/${encodeURIComponent(a)}/${encodeURIComponent(s)}`,{method:"DELETE"},{collection:r}),clearCoreRecords:a=>ot("/core-records/clear",a),resetGraphRun:(a,s)=>ot(`/records/${encodeURIComponent(a)}/reset-graph-run`,s),previewMatching:a=>ot("/selection/preview",a),listWork:a=>Oe("/work",a?{agent:a}:void 0),work:a=>Oe(`/work/${a}`),createWork:a=>ot("/work",a),setWorkStatus:(a,s)=>pl(`/work/${a}/status`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:s})}),updateWork:(a,s)=>pl(`/work/${a}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),runEvaluation:a=>ot(`/work/${a}/evaluate`),deleteWork:a=>pl(`/work/${a}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),workEvaluations:a=>Oe(`/work/${a}/evaluations`),listBatches:()=>Oe("/batches"),batch:a=>Oe(`/batches/${a}`),batchFailureBreakdown:a=>Oe(`/batches/${encodeURIComponent(a)}/failure-breakdown`),factoryPreflight:a=>ot("/factory/preflight",a),retryAllFactoryRuns:a=>ot("/factory-runs/retry-all",a),recoverBatch:(a,s)=>ot(`/batches/${encodeURIComponent(a)}/recover`,s),queueBatch:a=>ot("/batches",a),queueSingle:a=>ot("/on-demand/single",a),assemblerProperties:a=>Oe("/assembler/properties",a),assemblerPreview:a=>ot("/assembler/preview",a),factoryRuns:a=>Oe("/factory-runs",a),factoryRun:a=>Oe(`/factory-runs/${a}`),runStatusCounts:(a,s)=>Oe("/factory-runs/status-counts",{scope:a,agent:s}),clearJobs:()=>ot("/jobs/clear",{confirm:!0})},te=wN,$v={configured:{label:"Configured",tone:"pending"},evaluating:{label:"Evaluating",tone:"running"},matched:{label:"Matched",tone:"pending"},queued:{label:"Queued",tone:"pending"},pending:{label:"Pending",tone:"pending"},running:{label:"Running",tone:"running"},succeeded:{label:"Succeeded",tone:"done"},done:{label:"Done",tone:"done"},failed:{label:"Failed",tone:"failed"},cancelled:{label:"Cancelled",tone:"cancelled"},skipped:{label:"Skipped",tone:"cancelled"},excluded:{label:"Excluded",tone:"blocked"},blocked:{label:"Blocked",tone:"blocked"},active:{label:"Active",tone:"running"},inactive:{label:"Inactive",tone:"cancelled"},completed:{label:"Completed",tone:"done"},partial:{label:"Partial",tone:"blocked"},"not-processed":{label:"Not processed",tone:"pending"},in_progress:{label:"In progress",tone:"running"},never:{label:"Never",tone:"pending"},unknown:{label:"Unknown",tone:"cancelled"}};function RN(a){var s;return((s=$v[a])==null?void 0:s.label)??a.replace(/[-_]/g," ")}function AN(a){var s;return((s=$v[a])==null?void 0:s.tone)??"pending"}function _t({status:a}){return n.jsx("span",{className:`badge badge-${AN(a)}`,children:RN(a)})}const ON=[{label:"5s",ms:5e3},{label:"15s",ms:15e3},{label:"30s",ms:3e4},{label:"Off",ms:0}];function Hv({onRefresh:a,intervalMs:s=5e3,lastRefreshed:r}){const[c,u]=S.useState(s),[f,h]=S.useState(!1),m=S.useRef(null);return S.useEffect(()=>{if(!(f||c===0))return m.current=setTimeout(()=>a(),c),()=>{m.current&&clearTimeout(m.current)}},[a,c,f,r]),n.jsxs("div",{className:"refresh-control",children:[n.jsx("span",{className:`refresh-dot${f||c===0?" paused":""}`}),r&&n.jsx("span",{children:r.toLocaleTimeString()}),n.jsx("select",{value:c,onChange:p=>{const g=Number(p.target.value);u(g),h(g===0)},style:{minWidth:"unset",width:60},children:ON.map(({label:p,ms:g})=>n.jsx("option",{value:g,children:p},g))}),n.jsx("button",{onClick:()=>{h(p=>!p)},title:f?"Resume auto-refresh":"Pause auto-refresh",style:{padding:"3px 8px"},children:f?"▶":"⏸"}),n.jsx("button",{onClick:a,title:"Refresh now",style:{padding:"3px 8px"},children:"↻"})]})}function MN({buckets:a}){if(!a.length)return n.jsx("div",{className:"text-dim",style:{fontSize:12,padding:"8px 0"},children:"No throughput data"});const s=new Map;for(const u of a)s.set(u.bucket,(s.get(u.bucket)??0)+u.count);const r=[...s.entries()].sort((u,f)=>u[0].localeCompare(f[0])),c=Math.max(...r.map(([,u])=>u),1);return n.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:3,height:48,marginTop:8},children:r.map(([u,f])=>n.jsx("div",{title:`${new Date(u).toLocaleString()}: ${f}`,style:{flex:1,minWidth:4,height:`${Math.max(8,f/c*100)}%`,background:"var(--color-accent)",borderRadius:2,opacity:.85}},u))})}function Xn(a){if(!a)return"—";const s=Date.now()-new Date(a).getTime(),r=Math.abs(s),c=s<0,u=Math.round(r/6e4);if(u<1)return c?"in <1m":"just now";if(u<60)return c?`in ${u}m`:`${u}m ago`;const f=Math.round(u/60);if(f<24)return c?`in ${f}h`:`${f}h ago`;const h=Math.round(f/24);return c?`in ${h}d`:`${h}d ago`}function Mt(a){return a?new Date(a).toLocaleString():"—"}function dr(a){return a%1440===0?`every ${a/1440} day${a===1440?"":"s"}`:a%60===0?`every ${a/60} hour${a===60?"":"s"}`:`every ${a} min`}const kN={ttl:"TTL reprocessing",skip:"Skip processed","failed-only":"Failed only",all:"Reprocess all","before-date":"Before date","after-date":"After date",condition:"Conditional"};function zN(a){const s=(a==null?void 0:a.reprocessingMode)??"ttl";if(s==="ttl"){const r=(a==null?void 0:a.reprocessingTtl)??{value:7,unit:"days"};return`Re-run after ${r.value} ${r.unit}`}return kN[s]}function DN(a){if(!a)return{};const s=a.match(/^(\d+)\s+enqueued\s+of\s+(\d+)\s+matched$/i);return s?{enqueued:Number(s[1]),matched:Number(s[2])}:{raw:a}}const gl="inferences",Ra={continuous:"Ongoing Work","on-demand-single":"On-Demand Single","on-demand-batch":"On-Demand Batch"},qN={entity:"Entities",event:"Events",knowledge:"Knowledge"},Kv={"already-processed":"Already completed successfully","already-queued":"Already queued (pending/blocked)","already-running":"Currently running for this graph","missing-narrative":"Missing a required narrative","incompatible-graph":"Graph not compatible with this item","missing-data":"Item is missing required data","metadata-unavailable":"Metadata unavailable","changed-since-eligible":"Changed or became ineligible since preview","prerequisite-graph-not-met":"Required prior processing not completed","cross-entity-prerequisite-not-met":"Linked entity information not yet processed"},Gv={ttl:"Re-run if older than… (default)",skip:"Skip — never re-run already-processed information","failed-only":"Failed only — re-run information where last attempt failed",all:"All — force re-run of every already-processed item","before-date":"Before date — re-run information processed before…","after-date":"After date — re-run information processed after…",condition:"Condition — re-run only if item matches a filter"},BN=["blocked","pending","running","done","failed","cancelled"],Tg={blocked:"var(--status-blocked)",pending:"var(--status-pending)",running:"var(--status-running)",done:"var(--status-done)",failed:"var(--status-failed)",cancelled:"var(--status-cancelled)"},LN=["continuous","on-demand-single","on-demand-batch"];function _N(){const a=tn(),{agentQueryParam:s,agentId:r}=zn(),[c,u]=S.useState(""),[f,h]=S.useState(""),[m,p]=S.useState(""),[g,v]=S.useState(new Date),x=fe({queryKey:["queue-settings"],queryFn:()=>te.queueSettings()}),N=fe({queryKey:["overview-runs",s??"all",c,f,m],queryFn:()=>te.factoryRuns({agent:s,sourceType:c||void 0,workId:f||void 0,entity:m||void 0,pageSize:1e3})}),j=fe({queryKey:["throughput"],queryFn:()=>te.throughput({hours:24,bucket:"hour"})}),E=fe({queryKey:["entities",s??"all"],queryFn:()=>te.listEntities(s)}),C=fe({queryKey:["work",s??"all"],queryFn:()=>te.listWork(s)}),A=S.useMemo(()=>{var $;return(($=N.data)==null?void 0:$.runs)??[]},[N.data]),O=S.useMemo(()=>{const $={blocked:0,pending:0,running:0,done:0,failed:0,cancelled:0};for(const ee of A)$[ee.status]+=1;return $},[A]),U=A.filter($=>$.status==="running").slice(0,8),q=[...A.filter($=>$.status==="pending")].sort(($,ee)=>+new Date($.availableAt)-+new Date(ee.availableAt)).slice(0,8),z=A.filter($=>$.status==="failed").slice(0,8),K=S.useCallback(()=>{N.refetch(),v(new Date)},[N]),J=kn(),G=Pe({mutationFn:$=>te.cancelRun($),onSuccess:()=>{J.invalidateQueries({queryKey:["overview-runs"]}),J.invalidateQueries({queryKey:["factory-runs"]}),J.invalidateQueries({queryKey:["run-status-counts"]})}});return n.jsxs("div",{children:[n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"Overview"}),n.jsxs("span",{className:"page-subtitle",children:["Factory health and queue monitoring.",r?n.jsxs(n.Fragment,{children:[" Agent scope: ",n.jsx("span",{className:"mono",children:r})," ·"]}):null,x.data&&n.jsxs(n.Fragment,{children:[" ","Manager: ",n.jsx("strong",{children:x.data.queueMode==="running"?"Running":"Paused"})," · ",x.data.runningCount??0," running / ",x.data.maxConcurrentJobs," capacity"]})]})]}),n.jsx(Hv,{onRefresh:K,lastRefreshed:g??void 0})]}),n.jsxs("div",{className:"filters",children:[n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Source type"}),n.jsxs("select",{value:c,onChange:$=>u($.target.value),children:[n.jsx("option",{value:"",children:"All"}),LN.map($=>n.jsx("option",{value:$,children:Ra[$]},$))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Ongoing work"}),n.jsxs("select",{value:f,onChange:$=>h($.target.value),children:[n.jsx("option",{value:"",children:"All"}),(C.data??[]).map($=>n.jsx("option",{value:$.id,children:$.name},$.id))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Entity"}),n.jsxs("select",{value:m,onChange:$=>p($.target.value),children:[n.jsx("option",{value:"",children:"All"}),(E.data??[]).map($=>n.jsx("option",{value:$.name,children:$.label},$.name))]})]})]}),n.jsx("div",{className:"status-cards",style:{gridTemplateColumns:"repeat(6, 1fr)"},children:BN.map($=>n.jsxs("div",{className:"status-card",onClick:()=>a(`/journal?status=${$}`),children:[n.jsx("div",{className:"status-card-label",style:{color:Tg[$]},children:$}),n.jsx("div",{className:"status-card-count",style:{color:Tg[$]},children:O[$].toLocaleString()})]},$))}),n.jsxs("div",{className:"card",style:{marginBottom:20},children:[n.jsx("div",{className:"card-title",children:"Throughput (24h)"}),j.isLoading&&n.jsx("span",{className:"spinner"}),j.data&&n.jsx(MN,{buckets:j.data})]}),n.jsxs("div",{className:"overview-cols",children:[n.jsx(Kd,{title:"Recent failed",runs:z,emptyMsg:"No failed runs"}),n.jsx(Kd,{title:"Currently running",runs:U,emptyMsg:"No running runs"}),n.jsx(Kd,{title:"Oldest pending",runs:q,emptyMsg:"No pending runs",onCancel:$=>G.mutate($)})]})]})}function Kd({title:a,runs:s,emptyMsg:r,onCancel:c}){return n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:a}),s.length===0&&n.jsx("div",{className:"empty-state",style:{padding:"24px 0"},children:r}),n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:s.map(u=>{var f;return n.jsxs("div",{style:{position:"relative"},children:[n.jsx(ve,{to:`/journal/${u.id}`,style:{display:"block",textDecoration:"none"},children:n.jsxs("div",{style:{padding:"8px 10px",background:"var(--color-surface-raised)",borderRadius:"var(--radius)",border:"1px solid var(--color-border)"},children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:4},children:[n.jsxs("span",{children:[n.jsx(_t,{status:u.status}),u.status==="pending"&&((f=u.queueOptions)==null?void 0:f.admissionHeld)&&n.jsx("span",{className:"chip",style:{marginLeft:6,fontSize:10},children:"held"})]}),n.jsx("span",{className:"text-dim mono",style:{fontSize:11},children:Xn(u.updatedAt)})]}),n.jsxs("div",{className:"mono",style:{color:"var(--color-text-muted)",fontSize:11},children:[Ra[u.sourceType]," · ",u.entity,"/",u.recordLabel??u.recordId]}),u.error&&n.jsx("div",{style:{color:"var(--status-failed)",fontSize:11},children:u.error.message})]})}),c&&(u.status==="pending"||u.status==="blocked")&&n.jsx("button",{className:"btn btn-sm",style:{position:"absolute",top:8,right:8,fontSize:10,color:"var(--status-cancelled)"},onClick:h=>{h.preventDefault(),window.confirm("Cancel this pending run?")&&c(u.id)},children:"Cancel"})]},u.id)})})]})}function vt({title:a,message:s,detail:r,onRetry:c,safeActionLabel:u,onSafeAction:f}){const[h,m]=S.useState(!1),p=r===void 0?"":typeof r=="string"?r:String((r==null?void 0:r.message)??JSON.stringify(r,null,2));return n.jsxs("div",{className:"error-state",style:{color:"var(--color-text)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("span",{style:{color:"var(--status-failed)",fontSize:16},children:"⚠"}),n.jsx("strong",{style:{color:"var(--status-failed)"},children:a})]}),s&&n.jsx("div",{style:{marginTop:6,lineHeight:1.5},children:s}),n.jsxs("div",{style:{display:"flex",gap:8,marginTop:12,flexWrap:"wrap"},children:[c&&n.jsx("button",{type:"button",onClick:c,children:"Retry"}),u&&n.jsx("button",{type:"button",onClick:f,children:u}),p&&n.jsx("button",{type:"button",onClick:()=>m(g=>!g),children:h?"Hide technical details":"Show technical details"})]}),h&&p&&n.jsx("pre",{style:{marginTop:10,fontSize:11,whiteSpace:"pre-wrap",opacity:.8,fontFamily:"var(--font-mono)"},children:p})]})}function sr({open:a,title:s,onClose:r,children:c,actions:u}){return S.useEffect(()=>{if(!a)return;const f=document.body.style.overflow;document.body.style.overflow="hidden";function h(m){m.key==="Escape"&&r()}return document.addEventListener("keydown",h),()=>{document.body.style.overflow=f,document.removeEventListener("keydown",h)}},[a,r]),a?n.jsx("div",{className:"confirm-dialog-backdrop",onClick:r,role:"presentation",children:n.jsxs("div",{className:"confirm-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",onClick:f=>f.stopPropagation(),children:[n.jsx("h2",{id:"confirm-dialog-title",className:"confirm-dialog-title",children:s}),n.jsx("div",{className:"confirm-dialog-body",children:c}),n.jsx("div",{className:"confirm-dialog-actions",children:u.map(f=>n.jsx("button",{type:"button",className:`confirm-dialog-btn confirm-dialog-btn--${f.variant??"default"}`,disabled:f.disabled||f.loading,onClick:f.onClick,children:f.loading?`${f.label}…`:f.label},f.label))})]})}):null}function Iv({open:a,totalRunCount:s,busy:r,onClose:c,onConfirm:u}){return n.jsxs(sr,{open:a,title:"Clear all jobs?",onClose:c,actions:[{label:"Keep jobs",onClick:c,variant:"ghost",disabled:r},{label:"Clear all jobs",onClick:u,variant:"danger",disabled:r||s===0,loading:r}],children:[n.jsxs("p",{children:["Permanently delete ",n.jsxs("strong",{children:[s.toLocaleString()," job run",s===1?"":"s"]}),", batch records, and work evaluation history from the runtime store."]}),n.jsx("p",{className:"confirm-dialog-note confirm-dialog-note--warn",children:"Continuous work definitions and queue settings are kept. This cannot be undone."}),n.jsxs("p",{className:"confirm-dialog-note",children:["To stop runs without deleting history, use ",n.jsx("strong",{children:"Cancel all"})," instead."]})]})}function Yv({variant:a="compact"}){const s=kn(),r=fe({queryKey:["queue-settings"],queryFn:()=>te.queueSettings(),refetchInterval:1e4}),c=Pe({mutationFn:g=>te.saveQueueSettings({queueMode:g}),onSuccess:()=>{s.invalidateQueries({queryKey:["queue-settings"]}),s.invalidateQueries({queryKey:["overview-runs"]}),s.invalidateQueries({queryKey:["factory-runs"]})}}),u=r.data,h=((u==null?void 0:u.queueMode)??"running")==="running",m=r.isLoading||c.isPending;function p(){c.mutate(h?"paused":"running")}return a==="card"?n.jsxs("div",{className:`queue-manager-card${h?" is-running":" is-paused"}`,children:[n.jsxs("div",{className:"queue-manager-card-head",children:[n.jsxs("div",{children:[n.jsx("div",{className:"queue-manager-title",children:"Job manager"}),n.jsx("div",{className:"queue-manager-subtitle",children:h?"Pending jobs are picked up and executed automatically.":"Queue is paused — jobs stay pending until you resume."})]}),n.jsx("span",{className:`queue-manager-badge${h?" running":" paused"}`,children:h?"Running":"Paused"})]}),u&&n.jsxs("div",{className:"queue-manager-stats",children:[n.jsxs("span",{children:[u.runningCount??0," running"]}),n.jsx("span",{children:"·"}),n.jsxs("span",{children:[u.pendingCount??0," pending"]}),(u.heldCount??0)>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"·"}),n.jsxs("span",{children:[u.heldCount," held at capacity"]})]})]}),n.jsx("div",{style:{marginTop:16},children:n.jsx("button",{type:"button",className:h?"":"primary",disabled:m,onClick:p,children:m?"Updating…":h?"Pause job manager":"Resume job manager"})})]}):n.jsxs("button",{type:"button",className:`queue-manager-toggle${h?" running":" paused"}`,disabled:m,onClick:p,title:h?`Job manager running — ${(u==null?void 0:u.runningCount)??0} active, ${(u==null?void 0:u.pendingCount)??0} pending. Click to pause.`:`Job manager paused — ${(u==null?void 0:u.pendingCount)??0} pending. Click to resume.`,children:[n.jsx("span",{className:`queue-manager-dot${h?" running":" paused"}`}),n.jsx("span",{className:"queue-manager-label",children:h?"Running":"Paused"}),u&&n.jsxs("span",{className:"queue-manager-counts",children:[u.runningCount??0,"/",u.pendingCount??0]})]})}const UN=[{ms:15e3,label:"15 seconds"},{ms:3e4,label:"30 seconds"},{ms:6e4,label:"1 minute"},{ms:12e4,label:"2 minutes"}];function QN(){const a=kn(),[s,r]=S.useState(""),[c,u]=S.useState(""),[f,h]=S.useState(""),[m,p]=S.useState(""),[g,v]=S.useState(!1),[x,N]=S.useState(!1),j=fe({queryKey:["queue-settings"],queryFn:()=>te.queueSettings()});S.useEffect(()=>{j.data&&(r(j.data.maxConcurrentJobs),u(j.data.queueAdmissionIntervalMs),h(j.data.batchJobMaxAttempts),p(j.data.continuousJobMaxAttempts),v(!1))},[j.data]);const E=Pe({mutationFn:()=>te.saveQueueSettings({maxConcurrentJobs:Number(s),queueAdmissionIntervalMs:Number(c),batchJobMaxAttempts:Number(f),continuousJobMaxAttempts:Number(m)}),onSuccess:()=>{v(!0),a.invalidateQueries({queryKey:["queue-settings"]})}}),C=fe({queryKey:["run-status-counts","total"],queryFn:()=>te.runStatusCounts("total")}),A=C.data?Object.values(C.data).reduce((U,q)=>U+q,0):void 0,O=Pe({mutationFn:()=>te.clearJobs(),onSuccess:()=>{N(!1),a.invalidateQueries({queryKey:["overview-runs"]}),a.invalidateQueries({queryKey:["factory-runs"]}),a.invalidateQueries({queryKey:["run-status-counts"]}),a.invalidateQueries({queryKey:["batch"]}),a.invalidateQueries({queryKey:["work"]}),C.refetch()}});return n.jsxs("div",{children:[n.jsx("div",{className:"page-header",children:n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"Settings"}),n.jsx("span",{className:"page-subtitle",children:"App-wide jobs factory configuration."})]})}),n.jsx("div",{className:"card",style:{maxWidth:640,marginBottom:20},children:n.jsx(Yv,{variant:"card"})}),n.jsxs("div",{className:"card",style:{maxWidth:640},children:[n.jsx("div",{className:"card-title",children:"Queue execution"}),n.jsx("p",{className:"text-muted",style:{fontSize:13,marginBottom:16},children:"Capacity limits apply while the job manager is running. When capacity frees up, waiting jobs are promoted on the check interval below."}),j.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}),j.isError&&n.jsx(vt,{title:"Failed to load settings",detail:j.error}),j.data&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"form-grid",children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Max concurrent jobs"}),n.jsx("input",{type:"number",min:1,value:s,onChange:U=>{r(Number(U.target.value)),v(!1)}})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Admission check interval"}),n.jsx("select",{value:c,onChange:U=>{u(Number(U.target.value)),v(!1)},children:UN.map(U=>n.jsx("option",{value:U.ms,children:U.label},U.ms))}),n.jsx("span",{className:"hint",children:"How often the factory checks for free capacity and promotes waiting jobs."})]})]}),n.jsx("div",{className:"section-title",style:{marginTop:24},children:"Transient failure retries"}),n.jsx("p",{className:"text-muted",style:{fontSize:13,marginBottom:12},children:"Default max execution attempts for batch and ongoing work. Only transient infrastructure errors (Mongo connection blips, network timeouts) consume this budget — graph and data errors fail immediately."}),n.jsxs("div",{className:"form-grid",children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Batch jobs default"}),n.jsx("input",{type:"number",min:1,max:20,value:f,onChange:U=>{h(Number(U.target.value)),v(!1)}}),n.jsx("span",{className:"hint",children:"Used when queueing on-demand batches unless overridden per batch."})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Ongoing work default"}),n.jsx("input",{type:"number",min:1,max:20,value:m,onChange:U=>{p(Number(U.target.value)),v(!1)}}),n.jsx("span",{className:"hint",children:"Used when continuous work enqueues jobs unless overridden per work definition."})]})]}),n.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",marginTop:16},children:[n.jsx("button",{type:"button",className:"primary",disabled:E.isPending,onClick:()=>E.mutate(),children:E.isPending?"Saving…":"Save settings"}),g&&!E.isPending&&n.jsx("span",{className:"text-muted",style:{fontSize:13},children:"Saved"})]}),E.isError&&n.jsx("div",{style:{marginTop:12},children:n.jsx(vt,{title:"Failed to save settings",detail:E.error})})]})]}),n.jsxs("div",{className:"card",style:{maxWidth:640,marginTop:20},children:[n.jsx("div",{className:"card-title",children:"Clear jobs"}),n.jsx("p",{className:"text-muted",style:{fontSize:13,marginBottom:12},children:"Remove all job runs from the journal, batch records, and work evaluation history. Ongoing work definitions and queue settings are not deleted."}),C.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}),C.data&&n.jsxs("p",{className:"text-dim",style:{fontSize:12,marginBottom:12},children:["Currently ",(A==null?void 0:A.toLocaleString())??"0"," run",(A??0)===1?"":"s"," in the runtime store",["running","pending","blocked"].some(U=>{var q;return(((q=C.data)==null?void 0:q[U])??0)>0})&&n.jsxs(n.Fragment,{children:[" (",C.data.running," running, ",C.data.pending+C.data.blocked," queued)"]}),"."]}),n.jsx("button",{type:"button",disabled:O.isPending||A===0,style:{color:"var(--status-failed)"},onClick:()=>N(!0),children:O.isPending?"Clearing…":"Clear all jobs"}),O.isSuccess&&n.jsxs("p",{className:"text-muted",style:{fontSize:13,marginTop:12},children:["Cleared ",O.data.jobRuns.toLocaleString()," job run",O.data.jobRuns===1?"":"s",O.data.batches>0&&`, ${O.data.batches} batch${O.data.batches===1?"":"es"}`,O.data.workEvaluations>0&&`, ${O.data.workEvaluations} evaluation${O.data.workEvaluations===1?"":"s"}`,"."]}),O.isError&&n.jsx("div",{style:{marginTop:12},children:n.jsx(vt,{title:"Failed to clear jobs",detail:O.error})})]}),n.jsx(Iv,{open:x,totalRunCount:A??0,busy:O.isPending,onClose:()=>N(!1),onConfirm:()=>O.mutate()})]})}function br({loaded:a,total:s,hasMore:r,isFetchingNextPage:c,onLoadMore:u}){const f=S.useRef(null);return S.useEffect(()=>{if(!r||c)return;const h=f.current;if(!h)return;const m=new IntersectionObserver(p=>{var g;(g=p[0])!=null&&g.isIntersecting&&u()},{rootMargin:"400px"});return m.observe(h),()=>m.disconnect()},[r,c,u]),n.jsxs("div",{className:"infinite-scroll-footer",children:[n.jsxs("span",{children:[a.toLocaleString()," of ",s.toLocaleString()]}),c&&n.jsxs("span",{className:"infinite-scroll-loading",children:[n.jsx("span",{className:"spinner"})," Loading more…"]}),!r&&a>0&&n.jsx("span",{className:"text-dim",children:"End of list"}),r&&n.jsx("div",{ref:f,className:"infinite-scroll-sentinel","aria-hidden":!0})]})}function It({title:a,message:s,actionLabel:r,actionTo:c,onAction:u,icon:f="○"}){return n.jsxs("div",{className:"empty-state",style:{padding:"40px 24px"},children:[n.jsx("div",{style:{fontSize:28,opacity:.5,marginBottom:10},children:f}),n.jsx("div",{style:{fontSize:15,fontWeight:600,color:"var(--color-text)",marginBottom:6},children:a}),s&&n.jsx("div",{style:{maxWidth:480,margin:"0 auto",lineHeight:1.55},children:s}),r&&n.jsx("div",{style:{marginTop:16},children:c?n.jsx(ve,{to:c,children:n.jsx("button",{type:"button",className:"primary",children:r})}):n.jsx("button",{type:"button",className:"primary",onClick:u,children:r})})]})}function $N(a,s){return s?"all matching blocked, pending, or running runs":`${a.toLocaleString()} run${a===1?"":"s"}`}function HN({request:a,onClose:s,onCancelRuns:r,onCancelAll:c,busy:u,cancellableCount:f,hasExtraFilters:h,activeFilters:m}){if(!a)return null;const p=h||f>0,g=h?"Cancel all matching":`Cancel all (${f.toLocaleString()})`,v=m.length>0&&n.jsx("ul",{className:"confirm-dialog-list",children:m.map(x=>n.jsx("li",{children:x},x))});if(a.kind==="one"){const x=a.run;return n.jsxs(sr,{open:!0,title:"Cancel job run?",onClose:s,actions:[{label:"Keep running",onClick:s,variant:"ghost",disabled:u},...p?[{label:g,onClick:c,variant:"danger",disabled:u,loading:u}]:[],{label:"Cancel this run",onClick:()=>r([x.id]),variant:"primary",disabled:u,loading:u}],children:[n.jsxs("p",{children:[n.jsx("strong",{children:x.recordLabel??x.recordId})," on ",n.jsx("span",{className:"mono",children:x.entity})," ","will be marked ",n.jsx("strong",{children:"cancelled"})," and will not execute."]}),n.jsx("p",{className:"confirm-dialog-note",children:"Cancelled runs stay in the journal — they are not deleted."}),p&&n.jsxs("p",{className:"confirm-dialog-note",children:["You can cancel just this run, or stop every blocked, pending, or running run",h?" matching your filters":" in the queue","."]}),v]})}if(a.kind==="selected"){const x=a.runIds.length;return n.jsxs(sr,{open:!0,title:`Cancel ${x} selected run${x===1?"":"s"}?`,onClose:s,actions:[{label:"Keep running",onClick:s,variant:"ghost",disabled:u},...p?[{label:g,onClick:c,variant:"danger",disabled:u,loading:u}]:[],{label:`Cancel selected (${x})`,onClick:()=>r(a.runIds),variant:"primary",disabled:u,loading:u}],children:[n.jsxs("p",{children:["The selected run",x===1?"":"s"," will be marked ",n.jsx("strong",{children:"cancelled"})," and will not execute."]}),n.jsxs("p",{className:"confirm-dialog-note",children:["Only the runs you selected on this page are included — not every loaded page. Use ",n.jsx("strong",{children:g})," to stop the full queue",h?" matching your filters":"","."]}),v]})}return n.jsxs(sr,{open:!0,title:"Cancel all job runs?",onClose:s,actions:[{label:"Keep running",onClick:s,variant:"ghost",disabled:u},{label:g,onClick:c,variant:"primary",disabled:u||!p,loading:u}],children:[n.jsxs("p",{children:["This will mark ",n.jsx("strong",{children:$N(f,h)})," as"," ",n.jsx("strong",{children:"cancelled"}),". They will stop executing but remain visible in the journal."]}),n.jsxs("p",{className:"confirm-dialog-note",children:["To permanently remove runs from the database, use ",n.jsx("strong",{children:"Clear all jobs"})," instead."]}),n.jsx("p",{className:"confirm-dialog-note",children:"Active continuous work will be paused so cancelled items are not immediately re-queued. Re-enable work from the Work page when you want processing to resume."}),v]})}const Pv=100;function Fv(a){if(!(a.page*a.pageSize>=a.total))return a.page+1}function Sr(a){var s;return((s=a==null?void 0:a[0])==null?void 0:s.total)??0}function ho(a,s,r){return vv({queryKey:[...a,s],queryFn:({pageParam:c})=>te.factoryRuns({...s,page:c,pageSize:Pv}),initialPageParam:1,getNextPageParam:Fv,enabled:!0})}function KN(a,s,r){return vv({queryKey:[...a,s],queryFn:({pageParam:c})=>te.coreRecords({...s,page:c,pageSize:Pv}),initialPageParam:1,getNextPageParam:Fv,enabled:(r==null?void 0:r.enabled)??!0})}const Gd=["blocked","pending","running","done","failed","cancelled"],GN=["continuous","on-demand-single","on-demand-batch"],Sf=["blocked","pending","running"],Id={blocked:"var(--status-blocked)",pending:"var(--status-pending)",running:"var(--status-running)",done:"var(--status-done)",failed:"var(--status-failed)",cancelled:"var(--status-cancelled)"},Yd=[{key:"total",label:"Total"},{key:"today",label:"Today"},{key:"this-week",label:"This week"},{key:"this-month",label:"This month"}];function Pd(a){return Sf.includes(a.status)}function IN({run:a}){var s;return a.status!=="pending"||!((s=a.queueOptions)!=null&&s.admissionHeld)?null:n.jsx("span",{className:"chip",style:{marginLeft:6,fontSize:10},title:"Waiting for admission capacity",children:"held"})}function YN(){var tt,ae,Me;const[a,s]=si(),r=tn(),c=kn(),{agentQueryParam:u,agentId:f}=zn(),[h,m]=S.useState(new Date),p=a.get("scope"),g=Yd.some(P=>P.key===p)?p:"total",[v,x]=S.useState(new Set),[N,j]=S.useState(null),[E,C]=S.useState(!1),A=a.get("status")??"",O=a.get("sourceType")??"",U=a.get("workId")??"",q=a.get("batchId")??"",z=a.get("graphId")??"",K=a.get("entity")??"",J=a.get("recordId")??"",G=!A||Sf.includes(A),$=S.useMemo(()=>({agent:u,scope:g==="total"?void 0:g,status:A||void 0,sourceType:O||void 0,workId:U||void 0,batchId:q||void 0,graphId:z||void 0,entity:K||void 0,recordId:J||void 0}),[u,g,A,O,U,q,z,K,J]),ee=(P,Xe)=>{s(Ke=>{const $n=new URLSearchParams(Ke);return Xe?$n.set(P,Xe):$n.delete(P),$n}),x(new Set)},pe=P=>{s(Xe=>{const Ke=new URLSearchParams(Xe);return P==="total"?Ke.delete("scope"):Ke.set("scope",P),Ke}),x(new Set)},he=ho(["factory-runs",u??"all",g,A,O,U,q,z,K,J],$),ye=fe({queryKey:["run-status-counts",g,u??"all"],queryFn:()=>te.runStatusCounts(g,u)}),Ee=fe({queryKey:["meta-filters"],queryFn:()=>te.filters()}),me=fe({queryKey:["entities",u??"all"],queryFn:()=>te.listEntities(u)}),xe=fe({queryKey:["work",u??"all"],queryFn:()=>te.listWork(u)}),k=fe({queryKey:["batch",q],queryFn:()=>te.batch(q),enabled:!!q}),Z=Pe({mutationFn:P=>te.cancelRuns(P),onSuccess:()=>{j(null),x(new Set),c.invalidateQueries({queryKey:["factory-runs"]}),c.invalidateQueries({queryKey:["run-status-counts"]}),c.invalidateQueries({queryKey:["overview-runs"]})}}),ne=Pe({mutationFn:()=>te.cancelAllRuns({confirm:!0,agent:u,scope:g==="total"?void 0:g,status:A||void 0,sourceType:O||void 0,workId:U||void 0,batchId:q||void 0,graphId:z||void 0,entity:K||void 0,recordId:J||void 0}),onSuccess:()=>{j(null),x(new Set),c.invalidateQueries({queryKey:["factory-runs"]}),c.invalidateQueries({queryKey:["run-status-counts"]}),c.invalidateQueries({queryKey:["overview-runs"]}),c.invalidateQueries({queryKey:["work"]})}}),je=Pe({mutationFn:()=>te.clearJobs(),onSuccess:()=>{C(!1),x(new Set),c.invalidateQueries({queryKey:["factory-runs"]}),c.invalidateQueries({queryKey:["run-status-counts"]}),c.invalidateQueries({queryKey:["overview-runs"]}),c.invalidateQueries({queryKey:["batch"]}),c.invalidateQueries({queryKey:["work"]})}}),Y=S.useCallback(()=>{he.refetch(),m(new Date)},[he]),T=ye.data,B=S.useMemo(()=>{var P;return((P=he.data)==null?void 0:P.pages.flatMap(Xe=>Xe.runs))??[]},[he.data]),W=Sr((tt=he.data)==null?void 0:tt.pages),le=B.length<W,X=S.useMemo(()=>B.filter(Pd),[B]),oe=X.length>0&&X.every(P=>v.has(P.id));function Se(P){x(Xe=>{const Ke=new Set(Xe);return Ke.has(P)?Ke.delete(P):Ke.add(P),Ke})}function se(){x(oe?new Set:new Set(X.map(P=>P.id)))}const re=S.useMemo(()=>T?A&&Sf.includes(A)?T[A]??0:A?0:(T.blocked??0)+(T.pending??0)+(T.running??0):0,[T,A]),et=S.useMemo(()=>T?Gd.reduce((P,Xe)=>P+(T[Xe]??0),0):0,[T]),dt=!!(O||U||q||z||K||J),Ut=S.useMemo(()=>{var Xe,Ke,$n;const P=[];if(g!=="total"&&P.push(`Scope: ${((Xe=Yd.find(Zn=>Zn.key===g))==null?void 0:Xe.label)??g}`),A&&P.push(`Status: ${A}`),O&&P.push(`Source type: ${Ra[O]}`),U){const Zn=(($n=(Ke=xe.data)==null?void 0:Ke.find(vl=>vl.id===U))==null?void 0:$n.name)??U;P.push(`Ongoing work: ${Zn}`)}return q&&P.push(`Batch: ${q}`),z&&P.push(`Pipeline: ${z}`),K&&P.push(`Entity: ${K}`),J&&P.push(`Item id: ${J}`),P},[g,A,O,U,q,z,K,J,xe.data]),Fe=Z.isPending||ne.isPending,ct=Fe||je.isPending,ft=Fe?"Cancelling…":v.size>0?`Cancel (${v.size} selected)`:dt?"Cancel all matching":re>0?`Cancel all (${re.toLocaleString()})`:"Cancel runs";function Dn(){if(v.size>0){j({kind:"selected",runIds:[...v]});return}j({kind:"all"})}const Vn=S.useCallback(()=>{le&&!he.isFetchingNextPage&&he.fetchNextPage()},[le,he]),Jn=v.size>0||dt||re>0;return n.jsxs("div",{children:[n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"Journal"}),!he.isLoading&&n.jsxs("span",{className:"page-subtitle",children:[f?n.jsxs(n.Fragment,{children:["Agent scope: ",n.jsx("span",{className:"mono",children:f})," · "]}):null,W.toLocaleString()," total job executions"]})]}),n.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[Jn&&n.jsx("button",{disabled:ct,onClick:Dn,style:{color:"var(--status-cancelled)"},children:ft}),et>0&&n.jsx("button",{disabled:ct,onClick:()=>C(!0),style:{color:"var(--status-failed)"},children:je.isPending?"Clearing…":"Clear all jobs"}),n.jsx(Hv,{onRefresh:Y,lastRefreshed:h??void 0})]})]}),ne.isError&&n.jsx("div",{style:{marginBottom:12},children:n.jsx(vt,{title:"Failed to cancel runs",detail:ne.error})}),ne.isSuccess&&n.jsxs("p",{className:"text-muted",style:{fontSize:13,marginBottom:12},children:["Cancelled ",ne.data.matched.toLocaleString()," run",ne.data.matched===1?"":"s",".",(((ae=ne.data.pausedWorkDefs)==null?void 0:ae.length)??0)>0&&n.jsxs(n.Fragment,{children:[" ","Paused ",ne.data.pausedWorkDefs.length," continuous work definition",ne.data.pausedWorkDefs.length===1?"":"s","."]})]}),je.isError&&n.jsx("div",{style:{marginBottom:12},children:n.jsx(vt,{title:"Failed to clear jobs",detail:je.error})}),je.isSuccess&&n.jsxs("p",{className:"text-muted",style:{fontSize:13,marginBottom:12},children:["Cleared ",je.data.jobRuns.toLocaleString()," job run",je.data.jobRuns===1?"":"s"," from the runtime store."]}),q&&k.data&&k.data.counts.failed>0&&n.jsxs("div",{className:"memorix-panel",style:{marginBottom:16,fontSize:13},children:["Batch ",n.jsx(ve,{to:`/on-demand/batch/${q}`,children:k.data.name})," ","has ",k.data.counts.failed," failed run",k.data.counts.failed===1?"":"s","."," ","Open batch detail and use ",n.jsx("strong",{children:"Recover batch"})," to resume the queue and retry failures."]}),n.jsx(HN,{request:N,onClose:()=>j(null),onCancelRuns:P=>Z.mutate(P),onCancelAll:()=>ne.mutate(),busy:Fe,cancellableCount:re,hasExtraFilters:dt,activeFilters:Ut}),n.jsx(Iv,{open:E,totalRunCount:et,busy:je.isPending,onClose:()=>C(!1),onConfirm:()=>je.mutate()}),n.jsxs("div",{style:{marginBottom:20},children:[n.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:10},children:Yd.map(({key:P,label:Xe})=>n.jsx("button",{className:`btn btn-sm${g===P?" active":""}`,onClick:()=>pe(P),children:Xe},P))}),n.jsx("div",{className:"status-cards",style:{gridTemplateColumns:"repeat(6, 1fr)"},children:Gd.map(P=>n.jsxs("div",{className:`status-card${A===P?" selected":""}`,style:A===P?{outline:`2px solid ${Id[P]}`}:void 0,onClick:()=>ee("status",A===P?"":P),title:`Filter by ${P}`,children:[n.jsx("div",{className:"status-card-label",style:{color:Id[P]},children:P}),n.jsx("div",{className:"status-card-count",style:{color:Id[P]},children:T?T[P].toLocaleString():"—"})]},P))})]}),n.jsxs("div",{className:"filters",children:[n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Status"}),n.jsxs("select",{value:A,onChange:P=>ee("status",P.target.value),children:[n.jsx("option",{value:"",children:"All"}),Gd.map(P=>n.jsx("option",{value:P,children:P},P))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Source type"}),n.jsxs("select",{value:O,onChange:P=>ee("sourceType",P.target.value),children:[n.jsx("option",{value:"",children:"All"}),GN.map(P=>n.jsx("option",{value:P,children:Ra[P]},P))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Ongoing work"}),n.jsxs("select",{value:U,onChange:P=>ee("workId",P.target.value),children:[n.jsx("option",{value:"",children:"All"}),(xe.data??[]).map(P=>n.jsx("option",{value:P.id,children:P.name},P.id))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Pipeline"}),n.jsxs("select",{value:z,onChange:P=>ee("graphId",P.target.value),children:[n.jsx("option",{value:"",children:"All"}),(((Me=Ee.data)==null?void 0:Me.graphIds)??[]).map(P=>n.jsx("option",{value:P,children:P},P))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Entity"}),n.jsxs("select",{value:K,onChange:P=>ee("entity",P.target.value),children:[n.jsx("option",{value:"",children:"All"}),(me.data??[]).map(P=>n.jsx("option",{value:P.name,children:P.label},P.name))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Item id"}),n.jsx("input",{type:"text",value:J,placeholder:"item id",onChange:P=>ee("recordId",P.target.value),style:{width:160}})]})]}),he.isError&&n.jsx(vt,{title:"Failed to load journal",detail:he.error,onRetry:Y}),he.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading journal…"]}),!he.isLoading&&B.length===0&&n.jsx(It,{title:"No journal entries",message:"No executions match the current filters."}),B.length>0&&n.jsxs("div",{className:"table-wrap",children:[n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[G&&n.jsx("th",{style:{width:36},children:n.jsx("input",{type:"checkbox",checked:oe,onChange:se,title:"Select all cancellable (loaded)"})}),n.jsx("th",{children:"Status"}),n.jsx("th",{children:"Source type"}),n.jsx("th",{children:"Source"}),n.jsx("th",{children:"Entity"}),n.jsx("th",{children:"Item"}),n.jsx("th",{children:"Graph"}),n.jsx("th",{children:"Attempts"}),n.jsx("th",{children:"Priority"}),n.jsx("th",{children:"Created"}),n.jsx("th",{children:"Updated"}),n.jsx("th",{})]})}),n.jsx("tbody",{children:B.map(P=>n.jsxs("tr",{onClick:()=>r(`/journal/${P.id}`),children:[G&&n.jsx("td",{onClick:Xe=>Xe.stopPropagation(),children:Pd(P)&&n.jsx("input",{type:"checkbox",checked:v.has(P.id),onChange:()=>Se(P.id)})}),n.jsxs("td",{children:[n.jsx(_t,{status:P.status}),n.jsx(IN,{run:P})]}),n.jsx("td",{children:n.jsx("span",{className:"chip",children:Ra[P.sourceType]})}),n.jsx("td",{className:"text-muted",style:{fontSize:12},children:P.sourceName??"—"}),n.jsx("td",{className:"td-mono",children:P.entity}),n.jsx("td",{className:"td-mono",children:P.recordLabel??P.recordId}),n.jsx("td",{className:"td-mono",onClick:Xe=>Xe.stopPropagation(),children:n.jsx(ve,{to:`/pipelines/${encodeURIComponent(P.graphId)}`,children:P.graphName??P.graphId})}),n.jsxs("td",{className:"td-mono",children:[P.attempts,"/",P.maxAttempts]}),n.jsx("td",{className:"td-mono",children:P.priority}),n.jsx("td",{className:"td-mono",children:Mt(P.createdAt)}),n.jsx("td",{className:"td-mono",children:Mt(P.updatedAt)}),n.jsx("td",{onClick:Xe=>Xe.stopPropagation(),children:Pd(P)&&n.jsx("button",{className:"btn btn-sm",style:{color:"var(--status-cancelled)",fontSize:11},disabled:Fe,onClick:()=>j({kind:"one",run:P}),children:"Cancel"})})]},P.id))})]}),n.jsx(br,{loaded:B.length,total:W,hasMore:le,isFetchingNextPage:he.isFetchingNextPage,onLoadMore:Vn})]})]})}function Lt({label:a,value:s,defaultOpen:r=!1}){const[c,u]=S.useState(r);if(s==null)return null;const f=JSON.stringify(s,null,2);return n.jsxs("div",{className:"json-section",children:[n.jsxs("div",{className:`json-section-header${c?" open":""}`,onClick:()=>u(h=>!h),role:"button",tabIndex:0,onKeyDown:h=>h.key==="Enter"&&u(m=>!m),children:[n.jsx("span",{className:`json-chevron${c?" open":""}`,children:"▶"}),a,n.jsx("span",{className:"text-dim",style:{marginLeft:"auto",fontWeight:400,textTransform:"none",fontSize:"11px"},children:c?"collapse":`${f.split(`
61
+ `).length} lines`})]}),c&&n.jsx("div",{className:"json-body",children:n.jsx("pre",{children:f})})]})}const PN={enqueued:"muted",claimed:"start",done:"done",failed:"fail",retry:"info",lease_expired:"fail",cancelled:"muted"},FN={info:"var(--color-text)",start:"var(--status-running)",done:"var(--status-done)",fail:"var(--status-failed)",muted:"var(--color-text-muted)"};function Aa(a){if(typeof a=="number")return a>1e12?a:a*1e3;if(typeof a=="string"){const s=new Date(a).getTime();return Number.isNaN(s)?void 0:s}}function Xv(a){return new Date(a).toLocaleTimeString(void 0,{hour12:!1})}function Nf(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:void 0}function wg(a){const s=(a??"").toLowerCase();return s.includes("fail")||s.includes("error")?"fail":s.includes("complete")||s.includes("done")||s.includes("success")||s.includes("ended")?"done":s.includes("start")||s.includes("running")||s.includes("progress")?"start":"info"}function XN(a){return a==="fail"?"✕":a==="done"?"✓":a==="start"?"▶":"·"}function VN(a){if(a)return typeof a=="string"?a:typeof a=="object"&&a&&"message"in a?String(a.message):JSON.stringify(a)}function Vv(a,s=120){return a.length<=s?a:`${a.slice(0,s-1)}…`}function JN(a){const s=Nf(a.runContext);return{...a,nodeId:a.nodeId??(s==null?void 0:s.nodeId),graphId:a.graphId??(s==null?void 0:s.graphId),skillKey:a.skillKey??(s==null?void 0:s.skillKey)}}function ZN(a){const s=a.nodeId??a.skillKey??"node",r=a.skillKey&&a.skillKey!==a.nodeId?` · ${a.skillKey}`:"";return`${s}${r}`}function Jv(a,s,r){if(typeof a.durationMs=="number")return a.durationMs;if(typeof a.duration=="number")return a.duration;if(s!=null&&r!=null)return Math.max(0,Math.round(r-s))}function WN(a){const s=[],r=Nf(a.runContext),c=Nf(a.outer),u=Aa(a.startTime)??Aa(a.createdAt),f=Aa(a.endTime)??Aa(a.updatedAt),h=Jv(a,u,f);s.push({label:"Summary",value:{activityId:a.activityId,status:a.status,phase:a.phase,nodeId:a.nodeId??(r==null?void 0:r.nodeId),graphId:a.graphId??(r==null?void 0:r.graphId),skillKey:a.skillKey??(r==null?void 0:r.skillKey),kind:a.kind,startTime:u!=null?new Date(u).toISOString():a.startTime,endTime:f!=null?new Date(f).toISOString():a.endTime,durationMs:h}}),a.inputVariableKeys&&s.push({label:"Input variable keys",value:a.inputVariableKeys}),a.executionKeys&&s.push({label:"Execution keys",value:a.executionKeys}),(c==null?void 0:c.input)!=null&&s.push({label:"Input",value:c.input}),(c==null?void 0:c.output)!=null&&s.push({label:"Output",value:c.output}),(c==null?void 0:c.metadata)!=null&&s.push({label:"Metadata",value:c.metadata}),(c==null?void 0:c.memory)!=null&&s.push({label:"Memory",value:c.memory}),a.outputSummary!=null&&s.push({label:"Output summary",value:a.outputSummary}),a.narrixSummary!=null&&s.push({label:"Narrix",value:a.narrixSummary}),a.error!=null&&s.push({label:"Error",value:a.error}),Array.isArray(a.inner)&&a.inner.length>0&&s.push({label:"Inner steps",value:a.inner});const m={},p=new Set(["activityId","status","phase","nodeId","graphId","skillKey","kind","startTime","endTime","createdAt","updatedAt","durationMs","duration","runContext","outer","inner","error","inputVariableKeys","executionKeys","outputSummary","narrixSummary"]);for(const[g,v]of Object.entries(a))p.has(g)||v==null||(m[g]=v);return Object.keys(m).length>0&&s.push({label:"Record fields",value:m}),s}function e1(a){return a.map((s,r)=>{const c=Aa(s.at)??0,u=s.meta&&Object.keys(s.meta).length?s.meta:void 0;return{id:`event-${r}-${s.kind}-${c}`,ts:c,time:Xv(c),level:PN[s.kind]??"info",label:s.kind.replace(/_/g," "),summary:u?Vv(JSON.stringify(u)):void 0,sections:u?[{label:"Event meta",value:u}]:void 0}})}function t1(a){return a.map((s,r)=>{const c=JN(s),u=Aa(c.startTime)??Aa(c.createdAt)??0,f=Aa(c.endTime)??(wg(c.status)!=="start"?Aa(c.updatedAt):void 0),h=wg(c.status),m=Jv(c,u,f),p=VN(c.error),g=WN(c);return{id:`activity-${c.activityId??c.nodeId??r}-${u}`,ts:u,time:Xv(u),level:h,label:`${XN(h)} ${ZN(c)}`,summary:p?Vv(p):m!=null?`${m}ms`:void 0,sections:g.length>0?g:void 0}})}function n1({entry:a}){var u;const[s,r]=S.useState(!1),c=(((u=a.sections)==null?void 0:u.length)??0)>0;return n.jsxs("div",{className:`live-console-entry${s?" open":""}`,children:[n.jsxs("div",{className:`live-console-line${c?" expandable":""}`,onClick:c?()=>r(f=>!f):void 0,role:c?"button":void 0,tabIndex:c?0:void 0,onKeyDown:c?f=>f.key==="Enter"&&r(h=>!h):void 0,children:[c&&n.jsx("span",{className:`live-console-chevron${s?" open":""}`,children:"▶"}),n.jsx("span",{className:"live-console-time",children:a.time}),n.jsx("span",{style:{color:FN[a.level]},children:a.label}),a.summary&&n.jsx("span",{className:"live-console-detail",children:a.summary})]}),s&&a.sections&&n.jsx("div",{className:"live-console-expand",children:a.sections.map(f=>n.jsx(Lt,{label:f.label,value:f.value},f.label))})]})}function a1({runId:a,live:s}){var N;const r=s?1200:!1,c=fe({queryKey:["run-events",a],queryFn:()=>te.runEvents(a),refetchInterval:r}),u=fe({queryKey:["run-activities",a],queryFn:()=>te.runActivities(a),refetchInterval:r}),f=S.useMemo(()=>{var E,C;const j=[...e1(((E=c.data)==null?void 0:E.events)??[]),...t1(((C=u.data)==null?void 0:C.activities)??[])];return j.sort((A,O)=>A.ts-O.ts),j},[c.data,u.data]),h=S.useRef(null),m=S.useRef(!0),p=()=>{const j=h.current;j&&(m.current=j.scrollHeight-j.scrollTop-j.clientHeight<40)};S.useEffect(()=>{m.current&&h.current&&(h.current.scrollTop=h.current.scrollHeight)},[f.length]);const g=((N=u.data)==null?void 0:N.available)??!0,v=f.length===0,x=f.filter(j=>{var E;return(((E=j.sections)==null?void 0:E.length)??0)>0}).length;return n.jsxs("div",{className:"live-console",children:[n.jsxs("div",{className:"live-console-head",children:[n.jsxs("span",{className:"live-console-title",children:[n.jsx("span",{className:`live-dot${s?" live":""}`}),"Live Console"]}),n.jsxs("span",{className:"live-console-meta mono",children:[s?"streaming…":"idle"," · ",f.length," entr",f.length===1?"y":"ies",x>0?` · ${x} expandable`:""]})]}),n.jsxs("div",{className:"live-console-body",ref:h,onScroll:p,children:[v&&n.jsx("div",{className:"live-console-line muted",children:s?"Waiting for execution events…":"No execution activity recorded yet."}),f.map(j=>n.jsx(n1,{entry:j},j.id))]}),!g&&n.jsx("div",{className:"live-console-foot",children:"Per-node activity tracking is unavailable — showing run lifecycle events only."})]})}function An({title:a,children:s,summary:r,defaultOpen:c=!0,className:u,style:f,id:h}){const[m,p]=S.useState(c);return n.jsxs("div",{id:h,className:`card collapsible-card${m?" open":""}${u?` ${u}`:""}`,style:f,children:[n.jsxs("button",{type:"button",className:"collapsible-card-head",onClick:()=>p(g=>!g),"aria-expanded":m,children:[n.jsx("span",{className:`collapsible-chevron${m?" open":""}`,"aria-hidden":!0,children:"▶"}),n.jsx("span",{className:"collapsible-card-title",children:a}),!m&&r!=null&&r!==""&&n.jsx("span",{className:"collapsible-card-summary",children:r})]}),m&&n.jsx("div",{className:"collapsible-card-body",children:s})]})}function Ce(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:void 0}function nt(a){return typeof a=="number"&&Number.isFinite(a)?a:void 0}function lo(a){if(a!=null)try{return new TextEncoder().encode(JSON.stringify(a)).length}catch{return}}function On(a){return a==null||!Number.isFinite(a)?"—":a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(2)} MB`}function so(a){return a==null||!Number.isFinite(a)?"—":a===0?"$0.00":a<.01?`$${a.toFixed(4)}`:a<1?`$${a.toFixed(3)}`:`$${a.toFixed(2)}`}function st(a){if(a==null||!Number.isFinite(a))return"—";if(a<1e3)return`${Math.round(a)} ms`;if(a<6e4)return`${(a/1e3).toFixed(2)} s`;const s=Math.floor(a/6e4),r=(a%6e4/1e3).toFixed(1);return`${s}m ${r}s`}function Rg(a){return a.skillKey==="finalizer"||a.nodeId.includes(":finalizer")}function Gf(a,s){const r=Rg(a),c=Rg(s);if(r!==c)return r?1:-1;const u=a.startedAt??0,f=s.startedAt??0;return u!==f?u-f:a.nodeId.localeCompare(s.nodeId)}function ir(a){if(!a)return"—";const s=a.total??(a.prompt!=null||a.completion!=null?(a.prompt??0)+(a.completion??0):void 0);if(s==null&&a.prompt==null&&a.completion==null)return"—";const r=[];return a.prompt!=null&&r.push(`${a.prompt} in`),a.completion!=null&&r.push(`${a.completion} out`),s!=null&&r.push(`${s} total`),r.join(" · ")}function If(...a){for(const s of a){if(!s)continue;const r=nt(s.costUsd)??nt(s.cost);if(r!=null)return r;const c=Ce(s.cost),u=nt(c==null?void 0:c.costUsd);if(u!=null)return u;const f=Ce(s.usage),h=nt(f==null?void 0:f.costUsd);if(h!=null)return h;const m=Ce(s.timing),p=nt(m==null?void 0:m.costUsd);if(p!=null)return p}}function Zv(a){return If(a,Ce(a.cost),Ce(a.usage))}function Ag(a,s){let r=0,c=!1;for(const u of a){if(String(u.nodeId??"")!==s||u.status!=null&&u.status!=="completed")continue;const f=Zv(u);f!=null&&(r+=f,c=!0)}return c?r:void 0}function l1(a,s){var h;const r=Ce((h=Ce(a))==null?void 0:h.trace);if(!r)return;const c=Object.values(Ce(r.unitExecutions)??{}).filter(m=>!!m&&typeof m=="object"),u=Ag(c,s);if(u!=null)return u;const f=Object.values(Ce(r.modelInvocations)??{}).filter(m=>!!m&&typeof m=="object");return Ag(f,s)}function s1(a,s){var f;const r=(f=Ce(a))==null?void 0:f.runLog;if(!Array.isArray(r))return;let c=0,u=!1;for(const h of r){const m=Ce(h);if(!m||m.nodeId!==s)continue;const p=Ce(m.data),g=If(m,p,Ce(p==null?void 0:p.usage),Ce(p==null?void 0:p.timing));g!=null&&(c+=g,u=!0)}return u?c:void 0}function i1(a,s){var r,c;return a.costUsd??((r=a.metrics)==null?void 0:r.costUsd)??l1(s,a.nodeId)??If(a.summary,a.metrics,(c=Ce(a.summary))==null?void 0:c.usage)??(s!=null?s1(s,a.nodeId):void 0)}function r1(...a){for(const s of a){if(!s)continue;const r=Ce(s.usage)??Ce(s.tokenUsage)??Ce(s.tokens),c=nt(s.promptTokens)??nt(s.prompt_tokens)??nt(r==null?void 0:r.prompt_tokens)??nt(r==null?void 0:r.promptTokens)??nt(r==null?void 0:r.input_tokens)??nt(r==null?void 0:r.inputTokens),u=nt(s.completionTokens)??nt(s.completion_tokens)??nt(r==null?void 0:r.completion_tokens)??nt(r==null?void 0:r.completionTokens)??nt(r==null?void 0:r.output_tokens)??nt(r==null?void 0:r.outputTokens),f=nt(s.totalTokens)??nt(s.total_tokens)??nt(r==null?void 0:r.total_tokens)??nt(r==null?void 0:r.totalTokens);if(c!=null||u!=null||f!=null)return{...c!=null?{prompt:c}:{},...u!=null?{completion:u}:{},...f!=null?{total:f}:{}}}}function Wv(a,s){const r=a.summary,c=a.metrics,u=a.inputBytes??(c==null?void 0:c.inputBytes),f=a.outputBytes??(c==null?void 0:c.outputBytes),h=(c==null?void 0:c.tokens)??r1(r),m=i1(a,s);return{...u!=null?{inputBytes:u}:{},...f!=null?{outputBytes:f}:{},...h?{tokens:h}:{},...m!=null?{costUsd:m}:{}}}const ex={webScope:"Web search",synthesis:"Pre-synthesis",inputSynthesis:"Input synthesis",audit:"Post audit",polish:"Post polish",planner:"Planner",optimizer:"Optimizer"},Fd={"synthesized-context":"Pre-synthesis",webScope:"Web search",audit:"Post audit",polish:"Post polish"};function Og(a,s){if(s){const r=ex[s];if(r)return r}switch(a){case"externalPreUtility":return s?`Pre (${s})`:"Pre-action";case"pipelinePhase":return s?`Pipeline (${s})`:"Pipeline phase";case"mainSkill":return"Main skill";case"externalPostUtility":return s?`Post (${s})`:"Post-action";case"narrativePreprocessor":return"Narrix preprocess";case"narrativeHandler":return"Narrix handler";case"mapping":return"Write-back mapping";case"localSkill":return"Local skill";case"finalizer":return"Finalizer";case"validation":return"Validation";default:return a??"Step"}}function Mg(a){if(typeof a=="string")return Fd[a]??a;const s=Ce(a);if(!s)return"Step";const r=typeof s.type=="string"?s.type:void 0,c=typeof s.phase=="string"?s.phase:void 0;return r&&Fd[r]?Fd[r]:c&&r?`${c}: ${r}`:r||"Step"}function c1(a){const s=Ce(a.usage);if(!s)return;const r=nt(s.inputTokens),c=nt(s.outputTokens),u=nt(s.totalTokens);if(!(r==null&&c==null&&u==null))return{...r!=null?{prompt:r}:{},...c!=null?{completion:c}:{},...u!=null?{total:u}:{}}}function o1(a){var c,u,f,h,m,p;const s=((c=Ce(a.input))==null?void 0:c.preview)??((f=Ce((u=Ce(a.input))==null?void 0:u.valueRef))==null?void 0:f.preview),r=((h=Ce(a.output))==null?void 0:h.preview)??((p=Ce((m=Ce(a.output))==null?void 0:m.valueRef))==null?void 0:p.preview);return{inputBytes:lo(s),outputBytes:lo(r)}}function u1(a,s){var m;const r=Ce(a),c=Ce(r==null?void 0:r.trace);if(!c)return[];const u=Ce(c.unitExecutions);if(u)return Object.values(u).filter(p=>!p||typeof p!="object"?!1:String(p.nodeId??"")===s);const f=Ce((m=Ce(c.nodeExecutions))==null?void 0:m[s]),h=Ce(f==null?void 0:f.units);return h?Object.values(h).filter(p=>!!p&&typeof p=="object"):[]}function d1(a){const s=[];for(const r of a){const c=typeof r.unitKind=="string"?r.unitKind:void 0;if(c==="mapping")continue;const u=typeof r.strategyKey=="string"?r.strategyKey:typeof r.actionKey=="string"?r.actionKey:void 0,f=nt(r.durationMs),h=typeof r.status=="string"?r.status:void 0,m=h==="pending"||h==="queued"||h==="created",p=o1(r),g=c1(r),v=Zv(r),x=f!=null||p.inputBytes!=null||p.outputBytes!=null||g!=null||v!=null;if(m&&!x){s.push({stepKey:String(r.unitId??`${c??"unit"}:${s.length}`),label:Og(c,u),planned:!0});continue}s.push({stepKey:String(r.unitId??`${c??"unit"}:${s.length}`),label:Og(c,u),...f!=null?{durationMs:f}:{},...p.inputBytes!=null?{inputBytes:p.inputBytes}:{},...p.outputBytes!=null?{outputBytes:p.outputBytes}:{},...g?{tokens:g}:{},...v!=null?{costUsd:v}:{},...h!=null?{ok:h==="completed"}:{}})}return s.sort((r,c)=>{const u=f=>f.includes("pre")||f.includes("web")||f.includes("narrix")?0:f.includes("main")||f.includes("skill")?1:f.includes("post")||f.includes("audit")||f.includes("polish")?2:3;return u(r.stepKey)-u(c.stepKey)||r.label.localeCompare(c.label)})}function f1(a){var u,f;const s=(u=a.metrics)==null?void 0:u.effectiveExecutionPipeline,r=(f=a.summary)==null?void 0:f.effectiveExecutionPipeline,c=Array.isArray(s)?s:Array.isArray(r)?r:[];return c.length===0?[]:c.map((h,m)=>({stepKey:`pipeline:${m}:${Mg(h)}`,label:Mg(h),planned:!0}))}function h1(a){if(!a)return[];const s=[],r=Ce(a.postSteps);if(r)for(const[c,u]of Object.entries(r)){const f=Ce(u);if(!f)continue;const h=nt(f.durationMs);s.push({stepKey:`post:${c}`,label:ex[c]??`Post ${c}`,...h!=null?{durationMs:h}:{},ok:f.error==null})}return s}function m1(a,s){const r=new Map,c=f=>{const h=r.get(f.stepKey);if(!h){r.set(f.stepKey,f);return}h.planned&&!f.planned&&r.set(f.stepKey,{...f,label:h.label})};for(const f of d1(u1(s,a.nodeId)))c(f);for(const f of h1(a.summary))c(f);if(![...r.values()].some(f=>f.durationMs!=null&&!f.planned))for(const f of f1(a))c(f);return[...r.values()].sort((f,h)=>{const m=p=>p.label.includes("Web")||p.label.includes("Pre")||p.label.includes("Narrix")?0:p.label.includes("Main")?1:p.label.includes("Post")||p.label.includes("Audit")||p.label.includes("Polish")?2:3;return m(f)-m(h)||f.label.localeCompare(h.label)})}function tx(a,s){const r=Wv(a,s),c=m1(a,s);return{...a,...r.inputBytes!=null?{inputBytes:r.inputBytes}:{},...r.outputBytes!=null?{outputBytes:r.outputBytes}:{},...r.tokens?{metrics:{...a.metrics,tokens:r.tokens}}:{},...r.costUsd!=null?{costUsd:r.costUsd}:{},...c.length>0?{subSteps:c}:{}}}function nx(a){const s=Ce(a),r=Ce(s==null?void 0:s.analysis);return!r||typeof r.jobId!="string"||typeof r.graphId!="string"||typeof r.startedAt!="number"||typeof r.endedAt!="number"||!Array.isArray(r.nodes)?null:r}function p1(a,s){return!Array.isArray(a.nodes)||a.nodes.length===0?[]:[...a.nodes].sort(Gf).map(r=>tx(r,s))}function ax(a){const s=Ce(a);if(!s)return{};const r=Ce(s.execution)??s,c=Ce(r._trace),u=Ce(c==null?void 0:c.nodes);if(!u)return{};const f={};for(const[h,m]of Object.entries(u)){const p=Ce(m);if(!p)continue;const g=p.startedAt,v=p.endedAt;if(typeof g!="number"||typeof v!="number")continue;const x=Array.isArray(p.attempts)?p.attempts.filter(N=>!!N&&typeof N=="object").map(N=>({index:typeof N.index=="number"?N.index:0,ok:N.ok!==!1,durationMs:typeof N.durationMs=="number"?N.durationMs:0})):void 0;f[h]={startedAt:g,endedAt:v,skillKey:typeof p.skillKey=="string"?p.skillKey:"",ok:p.ok!==!1,durationMs:typeof p.durationMs=="number"&&Number.isFinite(p.durationMs)?p.durationMs:Math.max(0,v-g),...typeof p.activityId=="string"?{activityId:p.activityId}:{},...Ce(p.metrics)?{metrics:p.metrics}:{},...Ce(p.summary)?{summary:p.summary}:{},...Ce(p.error)?{error:{message:String(p.error.message??"failed"),...typeof p.error.code=="string"?{code:p.error.code}:{}}}:{},...x!=null&&x.length?{attempts:x}:{}}}return f}function y1(a){const s=Ce(a),r=s==null?void 0:s.runLog;if(!Array.isArray(r))return[];const c=[];for(const u of r){const f=Ce(u);if(!f)continue;const h=typeof f.scope=="string"?f.scope:void 0;if(h!=="pipeline"&&h!=="task"&&h!=="narrix"&&h!=="logxer")continue;const m=typeof f.ts=="number"?f.ts:Date.now();c.push({ts:m,scope:h,nodeId:typeof f.nodeId=="string"?f.nodeId:void 0,skillKey:typeof f.skillKey=="string"?f.skillKey:void 0,message:typeof f.message=="string"?f.message:String(f.message??""),..."data"in f?{data:f.data}:{}})}return c.sort((u,f)=>u.ts-f.ts)}function lx(a){const s=Ce(a.runContext),r=a.nodeId??(s==null?void 0:s.nodeId);return typeof r=="string"&&r.length>0?r:void 0}function g1(a){const s=Ce(a.outer);return{inputBytes:lo(s==null?void 0:s.input),outputBytes:lo(s==null?void 0:s.output)}}function v1(a,s){return a.startedAt<s.endedAt&&s.startedAt<a.endedAt}function x1(a,s,r){return r.filter(c=>c.nodeId!==a&&v1(s,c)).map(c=>c.nodeId).sort()}function Yc(a){if(typeof a=="number"&&Number.isFinite(a))return a>1e12?a:a*1e3;if(typeof a=="string"&&a.length>0){const s=Date.parse(a);return Number.isNaN(s)?void 0:s}}function j1(a){const s=String(a.status??"").toLowerCase();return s.includes("fail")||s.includes("error")}function b1(a){var r;const s={};for(const c of a){const u=lx(c);if(!u)continue;const f=((r=Ce(c.outer))==null?void 0:r.metadata)??Ce(c.metadata);if(((f==null?void 0:f.kind)??c.kind)==="exellix-graph-run")continue;const m=Yc(c.startTime)??Yc(c.createdAt);if(m==null)continue;const p=String(c.status??"").toLowerCase(),g=!p.includes("complete")&&!p.includes("done")&&!p.includes("success")&&!p.includes("fail"),v=Yc(c.endTime)??Yc(c.updatedAt)??(g?Date.now():m),x=typeof c.durationMs=="number"?c.durationMs:Math.max(0,v-m),N=Ce(c.runContext),j=typeof c.skillKey=="string"&&c.skillKey||(typeof(N==null?void 0:N.skillKey)=="string"?N.skillKey:"");s[u]={startedAt:m,endedAt:Math.max(m,v),skillKey:j,ok:!j1(c),durationMs:x}}return s}function sx(a,s,r){var f;const c=r!=null?nx(r):null;if((f=c==null?void 0:c.nodes)!=null&&f.length)return p1(c,r);const u=Object.keys(a).length>0?a:b1(s);return S1(u,s).map(h=>tx(h,r))}function S1(a,s){const r=new Map;for(const f of s){const h=lx(f);h&&r.set(h,f)}const c=Object.entries(a).map(([f,h])=>{var v;const m=r.get(f),p=m?g1(m):{},g=h.metrics;return{nodeId:f,skillKey:h.skillKey,startedAt:h.startedAt,endedAt:h.endedAt,durationMs:h.durationMs,ok:h.ok,inputBytes:p.inputBytes??(g==null?void 0:g.inputBytes),outputBytes:p.outputBytes??(g==null?void 0:g.outputBytes),concurrentWith:[],...h.metrics?{metrics:h.metrics}:{},...h.summary?{summary:h.summary}:{},...(v=h.attempts)!=null&&v.length?{attempts:h.attempts,retryAttempts:h.attempts.length}:{},...h.error?{error:h.error}:{}}}),u=c.map(f=>({nodeId:f.nodeId,startedAt:f.startedAt,endedAt:f.endedAt}));return c.map(f=>({...f,concurrentWith:x1(f.nodeId,f,u)})).sort(Gf)}function mo(a){if(a.length===0)return null;const s=Math.min(...a.map(h=>h.startedAt)),r=Math.max(...a.map(h=>h.endedAt));let c=0;for(const h of a)c+=h.concurrentWith.length;const u=a.map(h=>h.inputBytes).filter(h=>h!=null),f=a.map(h=>h.outputBytes).filter(h=>h!=null);return{nodeCount:a.length,totalDurationMs:Math.max(0,r-s),runStartedAt:s,runEndedAt:r,parallelPairCount:c/2,failedCount:a.filter(h=>!h.ok).length,...u.length?{totalInputBytes:u.reduce((h,m)=>h+m,0)}:{},...f.length?{totalOutputBytes:f.reduce((h,m)=>h+m,0)}:{}}}function ix(a,s){const r=Math.max(1,s.runEndedAt-s.runStartedAt);return a.map(c=>{const u=(c.startedAt-s.runStartedAt)/r*100,f=Math.max(.4,(c.endedAt-c.startedAt)/r*100);return{nodeId:c.nodeId,leftPct:u,widthPct:Math.min(100-u,f),ok:c.ok,concurrent:c.concurrentWith.length>0}})}function N1(a){if(a.length===0)return[];const s=[...a].sort((u,f)=>u.startedAt-f.startedAt||u.nodeId.localeCompare(f.nodeId)),r=new Set,c=[];for(;r.size<s.length;){const u=s.find(g=>!r.has(g.nodeId));if(!u)break;let f=u.endedAt;const h=[u];r.add(u.nodeId);let m=!0;for(;m;){m=!1;for(const g of s)r.has(g.nodeId)||g.startedAt<f&&(h.push(g),r.add(g.nodeId),f=Math.max(f,g.endedAt),m=!0)}const p=Math.min(...h.map(g=>g.startedAt));c.push({waveIndex:c.length,startedAt:p,endedAt:f,durationMs:Math.max(0,f-p),mode:h.length>1?"parallel":"sequential",nodes:h.sort((g,v)=>g.startedAt-v.startedAt||g.nodeId.localeCompare(v.nodeId))})}return c}function C1(a){const s=[...a].sort((u,f)=>u.startedAt-f.startedAt||u.nodeId.localeCompare(f.nodeId)),r=[],c=[];for(const u of s){let f=!1;for(let h=0;h<r.length;h++)if(r[h]<=u.startedAt){c[h].push(u),r[h]=u.endedAt,f=!0;break}f||(r.push(u.endedAt),c.push([u]))}return c.map((u,f)=>({laneIndex:f,nodes:u}))}function E1(a,s){return a.filter(r=>r.nodeId===s)}function T1(a){if(a.concurrentWith.length===0)return"Sequential window (no overlap with other nodes)";const s=a.concurrentWith.length;return`Parallel with ${s} other node${s===1?"":"s"}: ${a.concurrentWith.join(", ")}`}function Cf(a){return a.replace(/^node:/,"")}function w1({rows:a,summary:s}){const r=S.useMemo(()=>C1(a),[a]),c=S.useMemo(()=>ix(a,s),[a,s]),u=new Map(c.map(f=>[f.nodeId,f]));return n.jsxs("div",{className:"pipeline-swimlanes",children:[n.jsxs("div",{className:"pipeline-gantt-axis",children:[n.jsx("span",{children:new Date(s.runStartedAt).toLocaleTimeString(void 0,{hour12:!1})}),n.jsxs("span",{children:[r.length," lane",r.length===1?"":"s"," · max ",r.length," concurrent"]}),n.jsx("span",{children:new Date(s.runEndedAt).toLocaleTimeString(void 0,{hour12:!1})})]}),r.map(f=>n.jsxs("div",{className:"pipeline-swimlane-row",children:[n.jsxs("div",{className:"pipeline-swimlane-label",children:["Lane ",f.laneIndex+1]}),n.jsx("div",{className:"pipeline-gantt-track pipeline-swimlane-track",children:f.nodes.map(h=>{const m=u.get(h.nodeId);return m?n.jsxs("div",{className:`pipeline-swimlane-node${m.ok?"":" failed"}${m.concurrent?" concurrent":""}`,style:{left:`${m.leftPct}%`,width:`${m.widthPct}%`},title:`${h.nodeId} · ${h.skillKey} · ${st(h.durationMs)}`,children:[n.jsx("span",{className:"pipeline-swimlane-node-id",children:Cf(h.nodeId)}),n.jsx("span",{className:"pipeline-swimlane-node-dur",children:st(h.durationMs)})]},h.nodeId):null})})]},f.laneIndex)),n.jsx("p",{className:"pipeline-gantt-legend text-dim",children:"Each lane is one concurrent execution track. Nodes on different lanes at the same horizontal position ran in parallel."})]})}function R1({rows:a}){const s=S.useMemo(()=>N1(a),[a]);return n.jsx("div",{className:"pipeline-flow",children:s.map((r,c)=>n.jsxs("div",{className:"pipeline-flow-wave",children:[c>0&&n.jsxs("div",{className:"pipeline-flow-connector","aria-hidden":!0,children:[n.jsx("span",{className:"pipeline-flow-arrow",children:"↓"}),n.jsx("span",{className:"pipeline-flow-connector-label text-dim",children:"then"})]}),n.jsxs("div",{className:`pipeline-flow-wave-head${r.mode==="parallel"?" parallel":" sequential"}`,children:[n.jsx("span",{className:"pipeline-flow-wave-badge",children:r.mode==="parallel"?"Parallel batch":"Sequential step"}),n.jsxs("span",{className:"text-dim",style:{fontSize:12},children:[r.nodes.length," node",r.nodes.length===1?"":"s"," ·"," ",st(r.durationMs)," wall"]})]}),n.jsx("div",{className:`pipeline-flow-nodes${r.nodes.length>1?" is-parallel":""}`,children:r.nodes.map(u=>n.jsxs("div",{className:`pipeline-flow-node${u.ok?"":" failed"}${u.concurrentWith.length>0?" concurrent":""}`,children:[n.jsx("div",{className:"pipeline-flow-node-id mono",children:Cf(u.nodeId)}),n.jsx("div",{className:"pipeline-flow-node-skill text-dim",children:u.skillKey||"—"}),n.jsx("div",{className:"pipeline-flow-node-dur",children:st(u.durationMs)}),u.concurrentWith.length>0&&n.jsxs("div",{className:"pipeline-flow-node-peers text-dim",children:["overlaps ",u.concurrentWith.map(Cf).join(", ")]}),!u.ok&&u.error&&n.jsx("div",{className:"pipeline-flow-node-error",children:u.error.message})]},u.nodeId))})]},r.waveIndex))})}function rx({rows:a,title:s="Execution diagram"}){const[r,c]=S.useState("flow"),u=S.useMemo(()=>mo(a),[a]);return!u||a.length===0?null:n.jsxs("div",{className:"pipeline-diagram",children:[n.jsxs("div",{className:"pipeline-diagram-head",children:[n.jsx("div",{className:"section-title",style:{fontSize:13,margin:0},children:s}),n.jsxs("div",{className:"pipeline-diagram-tabs",children:[n.jsx("button",{type:"button",className:r==="flow"?"active":"",onClick:()=>c("flow"),children:"Flow (waves)"}),n.jsx("button",{type:"button",className:r==="swimlanes"?"active":"",onClick:()=>c("swimlanes"),children:"Swimlanes"})]})]}),r==="flow"?n.jsx(R1,{rows:a}):n.jsx(w1,{rows:a,summary:u})]})}function A1(a){return a.replace(/^node:/,"")}function O1(a,s){for(const r of a){const c=r.runContext;if((r.nodeId??(c==null?void 0:c.nodeId))===s)return r}}function M1({row:a,runLogRows:s,activities:r}){var h,m,p,g;const c=E1(s,a.nodeId),u=O1(r,a.nodeId),f=u==null?void 0:u.outer;return n.jsxs("div",{className:"pipeline-node-detail",children:[n.jsxs("div",{className:"pipeline-node-detail-grid",children:[n.jsxs("div",{children:[n.jsx("span",{className:"detail-key",children:"Execution"}),n.jsx("span",{className:"detail-val",style:{fontSize:12},children:T1(a)})]}),n.jsxs("div",{children:[n.jsx("span",{className:"detail-key",children:"Started"}),n.jsx("span",{className:"detail-val mono",style:{fontSize:11},children:new Date(a.startedAt).toLocaleTimeString(void 0,{hour12:!1,fractionalSecondDigits:3})})]}),n.jsxs("div",{children:[n.jsx("span",{className:"detail-key",children:"Ended"}),n.jsx("span",{className:"detail-val mono",style:{fontSize:11},children:new Date(a.endedAt).toLocaleTimeString(void 0,{hour12:!1,fractionalSecondDigits:3})})]}),n.jsxs("div",{children:[n.jsx("span",{className:"detail-key",children:"Payload"}),n.jsxs("span",{className:"detail-val text-dim",style:{fontSize:12},children:[On(a.inputBytes)," in · ",On(a.outputBytes)," out",((m=(h=a.metrics)==null?void 0:h.tokens)==null?void 0:m.total)!=null&&` · ${a.metrics.tokens.total} tokens`]})]}),((p=a.metrics)==null?void 0:p.model)&&n.jsxs("div",{children:[n.jsx("span",{className:"detail-key",children:"Model"}),n.jsx("span",{className:"detail-val mono",style:{fontSize:11},children:a.metrics.model})]})]}),a.attempts&&a.attempts.length>0&&n.jsxs("div",{style:{marginTop:10},children:[n.jsx("div",{className:"pipeline-node-detail-subtitle",children:"Engine retries"}),n.jsx("div",{className:"pipeline-attempts",children:a.attempts.map(v=>n.jsxs("span",{className:`pipeline-attempt-chip${v.ok?"":" failed"}`,children:["#",v.index+1," ",v.ok?"ok":"fail"," · ",st(v.durationMs)]},v.index))})]}),c.length>0&&n.jsxs("div",{style:{marginTop:10},children:[n.jsxs("div",{className:"pipeline-node-detail-subtitle",children:["Inside this node (",c.length,")"]}),n.jsx("div",{className:"pipeline-runlog pipeline-node-runlog",children:c.map((v,x)=>n.jsxs("div",{className:"pipeline-runlog-line",children:[n.jsx("span",{className:"mono text-dim",style:{fontSize:11},children:new Date(v.ts).toLocaleTimeString(void 0,{hour12:!1})}),v.scope&&n.jsx("span",{className:"chip",style:{fontSize:10},children:v.scope}),n.jsx("span",{children:v.message})]},`${v.ts}-${x}`))})]}),a.summary&&Object.keys(a.summary).length>0&&n.jsx("div",{style:{marginTop:10},children:n.jsx(Lt,{label:"Trace summary",value:a.summary})}),(f==null?void 0:f.output)!=null&&n.jsx("div",{style:{marginTop:10},children:n.jsx(Lt,{label:"Activix output",value:f.output})}),(u==null?void 0:u.narrixSummary)!=null&&n.jsx("div",{style:{marginTop:10},children:n.jsx(Lt,{label:"Narrix",value:u.narrixSummary})}),a.error&&n.jsx("div",{className:"run-io-warning",style:{marginTop:10,fontSize:12},children:a.error.message}),c.length===0&&!a.summary&&!u&&!((g=a.attempts)!=null&&g.length)&&n.jsxs("p",{className:"text-dim",style:{fontSize:12,margin:"10px 0 0"},children:["No inner pipeline log for this node — only wall timing from ",n.jsx("span",{className:"mono",children:"execution._trace"}),". Per-stage detail (pre-action, synthesis, main skill) needs backend instrumentation."]})]})}function k1({rows:a,runLogRows:s,activities:r}){var f;const[c,u]=S.useState(((f=a[0])==null?void 0:f.nodeId)??null);return n.jsxs("div",{className:"pipeline-node-inspector",children:[n.jsx("div",{className:"section-title",style:{fontSize:13,marginBottom:8},children:"Per-node detail"}),a.map(h=>{const m=c===h.nodeId;return n.jsxs("div",{className:`pipeline-node-inspector-item${m?" open":""}`,children:[n.jsxs("button",{type:"button",className:"pipeline-node-inspector-head",onClick:()=>u(m?null:h.nodeId),"aria-expanded":m,children:[n.jsx("span",{className:"pipeline-node-inspector-chevron",children:m?"▾":"▸"}),n.jsx("span",{className:"mono pipeline-node-inspector-id",children:A1(h.nodeId)}),n.jsx("span",{className:"text-dim",style:{fontSize:12},children:h.skillKey}),n.jsx("span",{className:"pipeline-node-inspector-dur",children:st(h.durationMs)}),h.concurrentWith.length>0&&n.jsx("span",{className:"chip parallel",style:{fontSize:10},children:"parallel"}),n.jsx("span",{className:"pipeline-node-inspector-status",style:{color:h.ok?"var(--status-done)":"var(--status-failed)"},children:h.ok?"ok":"failed"})]}),m&&n.jsx(M1,{row:h,runLogRows:s,activities:r})]},h.nodeId)})]})}function po({graphId:a,entity:s,variant:r="compact"}){const c=a!=null&&a.length>0?`/pipelines/${encodeURIComponent(a)}`:"/pipelines",u=s!=null&&s.length>0?`/pipelines/entity/${encodeURIComponent(s)}`:"/pipelines?view=entity";return r==="compact"?n.jsxs("div",{className:"pipeline-guide pipeline-guide-compact",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Per-run view"})," — Gantt timeline of each graph node: duration, parallel overlap, and Activix payload sizes. ",n.jsx("strong",{children:"Pipeline analytics"})," — averages by pipeline (graph) or by entity type across completed runs."]}),a&&n.jsx("p",{style:{marginTop:8},children:n.jsx(ve,{to:c,children:"Open pipeline analytics for this graph →"})})]}):n.jsxs("div",{className:"pipeline-guide",children:[n.jsx("h3",{className:"pipeline-guide-title",children:"How to read pipeline performance"}),n.jsxs("div",{className:"pipeline-guide-grid",children:[n.jsxs("div",{children:[n.jsx("strong",{children:"Wall time"}),n.jsx("p",{className:"text-dim",children:"First node start → last node end for this run. Slower than the sum of node durations when nodes run in parallel waves or the graph waits between waves."})]}),n.jsxs("div",{children:[n.jsx("strong",{children:"Node duration"}),n.jsxs("p",{className:"text-dim",children:["One graph node boundary (local skill or single ai-tasks ",n.jsx("span",{className:"mono",children:"runTask"}),"). Inner steps (web search, pre-synthesis, main skill, post audit) appear as indented sub-rows when execution trace or analysis metadata is on the run."]})]}),n.jsxs("div",{children:[n.jsx("strong",{children:"Parallel overlap"}),n.jsx("p",{className:"text-dim",children:"Highlighted bars overlapped in time with another node — evidence the engine ran them concurrently (same wave). No overlap means sequential execution or incomplete trace."})]}),n.jsxs("div",{children:[n.jsx("strong",{children:"Input / output size"}),n.jsxs("p",{className:"text-dim",children:["Approximate JSON byte size of Activix activity payloads (",n.jsx("span",{className:"mono",children:"outer.input"})," /",n.jsx("span",{className:"mono",children:"outer.output"}),"). Requires Activix; timing works from"," ",n.jsx("span",{className:"mono",children:"execution._trace"})," alone."]})]})]}),n.jsxs("p",{className:"text-dim",style:{fontSize:12,marginTop:12},children:["Navigate: top bar ",n.jsx(ve,{to:"/pipelines",children:"Pipeline analytics"})," ","· ",n.jsx(ve,{to:"/pipelines?view=entity",children:"by entity"}),a?n.jsxs(n.Fragment,{children:[" ","· ",n.jsx(ve,{to:c,children:"this pipeline"})]}):null,s?n.jsxs(n.Fragment,{children:[" ","· ",n.jsx(ve,{to:u,children:"this entity"})]}):null," ","· Journal → open a completed run → ",n.jsx("em",{children:"Pipeline performance"})," card below Live Console."]})]})}function z1({status:a,graphId:s,entity:r}){const c=s!=null&&s.length>0?`/pipelines/${encodeURIComponent(s)}`:"/pipelines",u=r!=null&&r.length>0?`/pipelines/entity/${encodeURIComponent(r)}`:"/pipelines?view=entity";return a==="pending"?n.jsx("div",{className:"pipeline-empty",children:n.jsxs("p",{children:["This run is still ",n.jsx("strong",{children:"queued"}),". Performance data appears after you ",n.jsx("strong",{children:"Execute now"})," and nodes finish."]})}):a==="running"?n.jsx("div",{className:"pipeline-empty",children:n.jsxs("p",{children:["Graph is ",n.jsx("strong",{children:"running"}),". Node bars appear here as Activix activities and"," ",n.jsx("span",{className:"mono",children:"execution._trace"})," are written — this page refreshes automatically."]})}):a==="failed"||a==="cancelled"?n.jsx("div",{className:"pipeline-empty",children:n.jsxs("p",{children:["No performance trace on this run. Failed or cancelled runs may not persist"," ",n.jsx("span",{className:"mono",children:"execution._trace"}),". Try a successful run, or open"," ",n.jsx(ve,{to:c,children:"pipeline analytics"}),r?n.jsxs(n.Fragment,{children:[" ","or ",n.jsx(ve,{to:u,children:"entity analytics"})]}):null,"."]})}):n.jsx("div",{className:"pipeline-empty",children:n.jsxs("p",{children:["No ",n.jsx("span",{className:"mono",children:"execution._trace"})," on this result. Run the graph again via On-Demand or Journal, or view aggregates at ",n.jsx(ve,{to:c,children:"pipeline analytics"}),"."]})})}function ja({label:a,value:s}){return n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:a}),n.jsx("span",{className:"detail-val",children:s})]})}function D1({rows:a,runStartedAt:s,runEndedAt:r}){const c=mo(a);if(!c)return null;const u=ix(a,c),f=new Map(u.map(h=>[h.nodeId,h]));return n.jsxs("div",{className:"pipeline-gantt",children:[n.jsxs("div",{className:"pipeline-gantt-axis",children:[n.jsx("span",{children:new Date(s).toLocaleTimeString(void 0,{hour12:!1})}),n.jsxs("span",{children:[st(c.totalDurationMs)," wall"]}),n.jsx("span",{children:new Date(r).toLocaleTimeString(void 0,{hour12:!1})})]}),a.map(h=>{const m=f.get(h.nodeId);return m?n.jsxs("div",{className:"pipeline-gantt-row",children:[n.jsx("div",{className:"pipeline-gantt-label",title:h.skillKey,children:n.jsx("span",{className:"mono",children:h.nodeId})}),n.jsx("div",{className:"pipeline-gantt-track",children:n.jsx("div",{className:`pipeline-gantt-bar${m.ok?"":" failed"}${m.concurrent?" concurrent":""}`,style:{left:`${m.leftPct}%`,width:`${m.widthPct}%`},title:`${h.skillKey} · ${st(h.durationMs)}${h.concurrentWith.length?` · parallel with ${h.concurrentWith.join(", ")}`:""}`})}),n.jsx("div",{className:"pipeline-gantt-dur text-dim",children:st(h.durationMs)})]},h.nodeId):null}),n.jsxs("p",{className:"pipeline-gantt-legend text-dim",children:[n.jsx("span",{className:"pipeline-gantt-swatch"})," node duration",n.jsx("span",{className:"pipeline-gantt-swatch concurrent"})," overlapped with another node (true parallel window)"]})]})}function q1({rows:a}){const s=a.some(r=>{var c;return(((c=r.subSteps)==null?void 0:c.length)??0)>0});return n.jsx("div",{className:"table-wrap",style:{marginTop:12},children:n.jsxs("table",{className:"data-table pipeline-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:s?"Node / step":"Node"}),n.jsx("th",{children:"Skill"}),n.jsx("th",{children:"Duration"}),n.jsx("th",{children:"Input"}),n.jsx("th",{children:"Output"}),n.jsx("th",{children:"Tokens"}),n.jsx("th",{children:"Cost"}),n.jsx("th",{children:"Parallel"}),n.jsx("th",{children:"Status"})]})}),n.jsx("tbody",{children:a.flatMap(r=>{var u;const c=[n.jsxs("tr",{children:[n.jsx("td",{className:"mono",children:r.nodeId}),n.jsx("td",{className:"mono text-dim",style:{fontSize:12},children:r.skillKey||"—"}),n.jsx("td",{children:st(r.durationMs)}),n.jsx("td",{className:"text-dim",children:On(r.inputBytes)}),n.jsx("td",{className:"text-dim",children:On(r.outputBytes)}),n.jsx("td",{className:"text-dim",style:{fontSize:11},children:ir((u=r.metrics)==null?void 0:u.tokens)}),n.jsx("td",{className:"text-dim",children:so(r.costUsd)}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:r.concurrentWith.length>0?r.concurrentWith.join(", "):"—"}),n.jsxs("td",{children:[n.jsx("span",{style:{color:r.ok?"var(--status-done)":"var(--status-failed)"},children:r.ok?"ok":"failed"}),r.retryAttempts!=null&&r.retryAttempts>1&&n.jsxs("span",{className:"text-dim",style:{marginLeft:6,fontSize:11},children:["(",r.retryAttempts," attempts)"]})]})]},r.nodeId)];for(const f of r.subSteps??[])c.push(n.jsxs("tr",{className:"pipeline-substep-row",children:[n.jsxs("td",{className:"mono pipeline-substep-label",children:[n.jsx("span",{className:"pipeline-substep-marker",children:"↳"}),f.label,f.planned&&n.jsx("span",{className:"chip text-dim",style:{marginLeft:6,fontSize:10},children:"planned"})]}),n.jsx("td",{className:"text-dim",children:"—"}),n.jsx("td",{children:f.durationMs!=null?st(f.durationMs):"—"}),n.jsx("td",{className:"text-dim",children:On(f.inputBytes)}),n.jsx("td",{className:"text-dim",children:On(f.outputBytes)}),n.jsx("td",{className:"text-dim",style:{fontSize:11},children:ir(f.tokens)}),n.jsx("td",{className:"text-dim",children:so(f.costUsd)}),n.jsx("td",{className:"text-dim",children:"—"}),n.jsx("td",{className:"text-dim",children:"—"})]},`${r.nodeId}:${f.stepKey}`));return c})})]})})}function B1(a,s,r){if(!a)return"No trace yet";const c=[`${a.nodeCount} node${a.nodeCount===1?"":"s"}`,st(a.totalDurationMs)];return a.parallelPairCount>0&&c.push(`${a.parallelPairCount} parallel pair${a.parallelPairCount===1?"":"s"}`),a.failedCount>0&&c.push(`${a.failedCount} failed`),r||c.push("sizes from trace only"),s&&c.push("pipeline log"),c.join(" · ")}function cx({runId:a,status:s,result:r,live:c,graphId:u,entity:f}){var O,U,q;const h=fe({queryKey:["run-activities",a],queryFn:()=>te.runActivities(a),refetchInterval:c?1200:!1}),m=S.useMemo(()=>ax(r),[r]),p=S.useMemo(()=>y1(r),[r]),g=((O=h.data)==null?void 0:O.activities)??[],v=S.useMemo(()=>sx(m,g,r),[m,g,r]),x=S.useMemo(()=>nx(r),[r]),N=S.useMemo(()=>mo(v),[v]),j=v.length>0||p.length>0,E=s==="running"||s==="pending",C=((U=h.data)==null?void 0:U.available)!==!1,A=B1(N,p.length>0,C);return n.jsxs(An,{id:"pipeline-performance",title:"Pipeline performance",summary:j?A:E?"Waiting for trace…":"No trace on this run",defaultOpen:j||E,style:{marginBottom:16},children:[n.jsx(po,{graphId:u,entity:f,variant:"compact"}),!j&&!h.isLoading&&n.jsx(z1,{status:s,graphId:u,entity:f}),(h.isLoading||E&&v.length===0)&&j===!1&&n.jsxs("div",{className:"loading-row",style:{padding:"8px 0"},children:[n.jsx("span",{className:"spinner"}),E?"Waiting for node trace…":"Loading activity payloads…"]}),!C&&v.length>0&&n.jsx("div",{className:"run-io-warning",style:{marginBottom:12},children:"Activix is unavailable — timing comes from the run result; input/output sizes need activity records."}),N&&n.jsxs("div",{className:"pipeline-stats",children:[x&&n.jsxs(n.Fragment,{children:[n.jsx(ja,{label:"Job run",value:n.jsx("span",{className:"mono",style:{fontSize:11},children:x.jobId})}),n.jsx(ja,{label:"Graph",value:n.jsx("span",{className:"mono",style:{fontSize:11},children:x.graphId})}),n.jsx(ja,{label:"Run window",value:n.jsxs("span",{className:"mono",style:{fontSize:11},children:[new Date(x.startedAt).toLocaleString()," → ",new Date(x.endedAt).toLocaleString()]})}),x.planHash&&n.jsx(ja,{label:"Plan hash",value:n.jsx("span",{className:"mono",style:{fontSize:11},children:x.planHash})}),((q=x.totals)==null?void 0:q.totalTokens)!=null&&n.jsx(ja,{label:"Tokens (sum)",value:`${x.totals.promptTokens??"—"} prompt · ${x.totals.completionTokens??"—"} completion · ${x.totals.totalTokens} total`})]}),n.jsx(ja,{label:"Wall time",value:st(N.totalDurationMs)}),n.jsx(ja,{label:"Nodes",value:N.nodeCount}),n.jsx(ja,{label:"Parallel overlap",value:N.parallelPairCount>0?`${N.parallelPairCount} pair${N.parallelPairCount===1?"":"s"} (intervals overlapped)`:"None detected — nodes ran sequentially or traces are incomplete"}),(N.totalInputBytes!=null||N.totalOutputBytes!=null)&&n.jsx(ja,{label:"Activix payloads (sum)",value:`${On(N.totalInputBytes)} in · ${On(N.totalOutputBytes)} out`})]}),N&&v.length>0&&n.jsx(rx,{rows:v,title:"Execution diagram"}),N&&v.length>0&&n.jsx(D1,{rows:v,runStartedAt:N.runStartedAt,runEndedAt:N.runEndedAt}),v.length>0&&n.jsx(q1,{rows:v}),v.length>0&&n.jsx(k1,{rows:v,runLogRows:p,activities:g}),v.some(z=>z.summary&&Object.keys(z.summary).length>0)&&n.jsxs("div",{style:{marginTop:16},children:[n.jsx("div",{className:"section-title",style:{fontSize:13,marginBottom:8},children:"Per-node metadata"}),v.filter(z=>z.summary&&Object.keys(z.summary).length>0).map(z=>n.jsx(Lt,{label:`${z.nodeId} summary`,value:z.summary},z.nodeId))]}),p.length>0&&n.jsxs("div",{style:{marginTop:16},children:[n.jsxs("div",{className:"section-title",style:{fontSize:13,marginBottom:8},children:["Pipeline / task log (",p.length,")"]}),n.jsx("div",{className:"pipeline-runlog",children:p.map((z,K)=>n.jsxs("div",{className:"pipeline-runlog-line",children:[n.jsx("span",{className:"mono text-dim",style:{fontSize:11},children:new Date(z.ts).toLocaleTimeString(void 0,{hour12:!1})}),z.scope&&n.jsx("span",{className:"chip",style:{fontSize:10},children:z.scope}),z.nodeId&&n.jsx("span",{className:"mono",style:{fontSize:11},children:z.nodeId}),n.jsx("span",{children:z.message})]},`${z.ts}-${K}`))})]}),!j&&E&&!h.isLoading&&n.jsx("p",{className:"text-muted",style:{fontSize:13,marginTop:8},children:"Trace appears after nodes complete. Refresh is automatic while the run is live."})]})}function Qs(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:void 0}function kg(a){if(!a)return{payload:void 0,memorixRef:void 0};const{_memorixRef:s,...r}=a;return{payload:Object.keys(r).length>0?r:void 0,memorixRef:s}}function L1(a){try{return JSON.stringify(a)}catch{return""}}function Pc(a){if(!a)return!1;const s=Object.keys(a);return s.length===1&&s[0]==="recordId"}function zg(a){const s=Qs(a);return!!(s&&typeof s.objectType=="string"&&Array.isArray(s.contentTypes))}function _1(a){const s=Qs(a);if(!s)return{};const r=Qs(s.outer),c=Qs(r==null?void 0:r.output);return{runtimeInput:r==null?void 0:r.input,runtimeOutput:(c==null?void 0:c.response)??(c&&!c.data?c:void 0),runtimeData:c==null?void 0:c.data,status:s.status,nodesExecuted:s.nodesExecuted,completedAt:s.completedAt,error:s.error??(c==null?void 0:c.error)}}function U1({runId:a,status:s,input:r,recordId:c,result:u,assemblySelection:f,savedResult:h,processingUpdate:m,live:p}){var Z,ne,je;const g=fe({queryKey:["run-activities",a],queryFn:()=>te.runActivities(a),refetchInterval:p?1200:!1}),v=c??String((r==null?void 0:r.recordId)??""),x=fe({queryKey:["assembler-preview",v,L1(f)],queryFn:()=>te.assemblerPreview({selection:f,recordId:v}),enabled:!!(v&&zg(f)),staleTime:6e4}),N=S.useMemo(()=>{var Y;return _1((Y=g.data)==null?void 0:Y.graphRun)},[(Z=g.data)==null?void 0:Z.graphRun]),j=kg(r),E=kg(Qs(N.runtimeInput)),C=u??N.runtimeOutput,A=E.payload??(N.runtimeInput!=null&&s!=="pending"?N.runtimeInput:void 0),O=A!=null&&!Pc(Qs(A)),U=O?A:((ne=x.data)==null?void 0:ne.assembled)??(Pc(j.payload)?void 0:j.payload),q=O?"runtime":(je=x.data)!=null&&je.assembled?"preview":U?"queued":void 0,z=zg(f),K=C!=null,J=N.runtimeData!=null,G=j.memorixRef!=null||E.memorixRef!=null,$=N.status!=null||N.nodesExecuted!=null||N.error!=null,ee=j.payload!=null&&!Pc(j.payload),pe=Pc(j.payload)&&!z&&!O,he=(m==null?void 0:m.status)==="skipped",ye=(m==null?void 0:m.status)==="pending"&&!h&&s!=="failed"&&s!=="running"&&!p,Ee=((m==null?void 0:m.status)==="in_progress"||(m==null?void 0:m.status)==="pending"&&(p||s==="running"))&&!h&&s!=="failed",me=(m==null?void 0:m.status)==="failed";if(!r&&!z&&U==null&&!K&&!J&&!G&&!$&&!h&&!m&&!g.isLoading&&!x.isLoading)return n.jsxs("div",{className:"card",style:{marginBottom:16},children:[n.jsx("div",{className:"card-title",children:"Request & response"}),n.jsx("span",{className:"text-muted",style:{fontSize:13},children:"No input or output recorded for this run yet."})]});const k=q==="runtime"?"Graph input (recorded at execution)":q==="preview"?"Graph input (resolved from Memorix)":"Graph input";return n.jsxs("div",{className:"card run-io-panel",style:{marginBottom:16},children:[n.jsx("div",{className:"card-title",children:"Request & response"}),n.jsxs("p",{className:"run-io-hint",children:["The graph receives assembled Memorix record data as ",n.jsx("span",{className:"mono",children:"runtime.input"})," ","— not the internal job reference. After execution, the recorded runtime snapshot is shown when available."]}),pe&&n.jsx("div",{className:"run-io-warning",children:"This run has no assembly selection — the graph will receive only the record id unless input is expanded elsewhere."}),x.isError&&!U&&n.jsxs("div",{className:"run-io-warning",children:["Could not resolve Memorix record data for preview: ",String(x.error)]}),x.isLoading&&!U&&z&&n.jsx("div",{className:"run-io-pending",children:"Resolving graph input from Memorix…"}),U!=null&&n.jsx(Lt,{label:k,value:U,defaultOpen:!0}),z&&n.jsx(Lt,{label:"Assembly selection",value:f}),ee&&n.jsx(Lt,{label:"Additional queued fields",value:j.payload}),G&&n.jsx(Lt,{label:"Memorix reference",value:E.memorixRef??j.memorixRef}),K?n.jsx(Lt,{label:"Response",value:C,defaultOpen:!0}):n.jsx("div",{className:"run-io-pending",children:p||s==="running"?"Response will appear when the graph finishes.":s==="failed"?"No response — run failed before producing output.":"No response recorded yet."}),h&&n.jsxs("div",{className:"run-io-writeback",children:[n.jsx("div",{className:"run-io-writeback-title",children:"Saved to Memorix"}),n.jsxs("div",{className:"detail-row",style:{margin:0},children:[n.jsx("span",{className:"detail-key",children:"Collection"}),n.jsx("span",{className:"detail-val mono",style:{fontSize:12},children:h.collection})]}),n.jsxs("div",{className:"detail-row",style:{margin:0},children:[n.jsx("span",{className:"detail-key",children:"Record"}),n.jsx("span",{className:"detail-val",children:n.jsx(ve,{to:`/information/${encodeURIComponent(h.recordId)}?entity=${encodeURIComponent(h.entityName)}&collection=${encodeURIComponent(h.contentType)}`,className:"mono",style:{fontSize:12},children:h.recordId})})]}),n.jsx(Lt,{label:"Writeback reference",value:h})]}),he&&!h&&n.jsx("div",{className:"run-io-pending",children:(m==null?void 0:m.detail)??"Results were not written to Memorix."}),Ee&&n.jsx("div",{className:"run-io-pending",children:"Graph is running — result writeback will appear here when persistency is enabled."}),ye&&n.jsx("div",{className:"run-io-pending",children:"Result writeback will appear here when the run finishes and persistency is enabled."}),me&&n.jsx("div",{className:"run-io-warning",children:(m==null?void 0:m.detail)??"Result writeback failed."}),J&&n.jsx(Lt,{label:"Execution diagnostics",value:N.runtimeData}),N.error!=null&&n.jsx(Lt,{label:"Graph error",value:N.error,defaultOpen:!0}),$&&n.jsx(Lt,{label:"Run telemetry",value:{status:N.status,nodesExecuted:N.nodesExecuted,completedAt:N.completedAt}})]})}const Q1=["Overview","Console","Pipeline","Input & Output","Details"];function ut({label:a,value:s}){return n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:a}),n.jsx("span",{className:"detail-val",children:s})]})}function $1(a){if(a.sourceType==="continuous"&&a.sourceRef)return`/work/${a.sourceRef}`;if(a.sourceType==="on-demand-batch"&&a.sourceRef)return`/on-demand/batch/${a.sourceRef}`}function H1(a){var c;if(a.status==="pending"&&a.error&&new Date(a.availableAt).getTime()>Date.now()&&!((c=a.queueOptions)!=null&&c.admissionHeld))return`Retry scheduled for ${Mt(a.availableAt)}`;const r=a.queueOptions;return a.status!=="pending"?Mt(a.availableAt):r!=null&&r.admissionHeld?r.slotsAvailable>0?"Waiting for capacity — a slot is available; you can execute now":`Waiting for capacity (${r.admittedCount}/${r.maxConcurrentJobs} slots in use)`:r&&r.slotsAvailable<=0?`Queued (${r.admittedCount}/${r.maxConcurrentJobs} slots in use) — waiting for worker or execute now`:"Queued — ready to execute"}const ox=12e4;function K1(a){return a.status!=="running"?!1:Date.now()-new Date(a.updatedAt).getTime()>ox}function G1(a){const s=a&&typeof a=="object"&&!Array.isArray(a)?a:void 0;return!!(s&&typeof s.objectType=="string"&&Array.isArray(s.contentTypes))}function Dg(a,s){return a.status==="updated"?"succeeded":a.status==="failed"?"failed":a.status==="in_progress"||a.status==="pending"&&s==="running"?"running":a.status==="skipped"?"skipped":"pending"}function I1(a,s,r){if(a.status==="updated"&&!r)return`This item was marked as processed by "${a.graphId}".`;if(a.status==="updated"&&r)return`Graph output was written to ${r.collection}.`;if(a.status==="failed")return a.detail??"Processing metadata update failed.";if(a.status==="in_progress"||a.status==="pending"&&s==="running")return"Graph is running — Memorix writeback will update when the run completes.";if(a.status==="pending")return"The item will be marked as processed when the run succeeds and results are written.";if(a.status==="skipped")return a.detail??"Processing metadata update was skipped (simulation or graph without persistence)."}function Y1(a){return a.status==="running"||a.status==="pending"&&a.attempts>0?"Console":(a.status==="failed","Overview")}function P1(a){var s;return{entity:a.entity,collection:a.collection,recordId:a.recordId,graphId:a.graphId,priority:a.priority,...(s=a.relatedRecords)!=null&&s.length?{relatedRecords:a.relatedRecords}:{},...G1(a.assemblySelection)?{assemblySelection:a.assemblySelection}:{}}}function qg({run:a,pu:s}){return n.jsxs(An,{title:"Processing result",summary:s?Dg(s,a.status):"none",defaultOpen:!!s,style:{marginBottom:0,borderColor:(s==null?void 0:s.status)==="updated"?"var(--status-done)":(s==null?void 0:s.status)==="failed"?"var(--status-failed)":void 0},children:[!s&&n.jsx("span",{className:"text-muted",style:{fontSize:13},children:"No processing result recorded."}),s&&n.jsxs(n.Fragment,{children:[n.jsx(ut,{label:"Status",value:n.jsx(_t,{status:Dg(s,a.status)})}),n.jsx(ut,{label:"Graph",value:s.graphId}),a.savedResult&&n.jsx(ut,{label:"Saved to",value:n.jsxs(ve,{to:`/information/${encodeURIComponent(a.savedResult.recordId)}?entity=${encodeURIComponent(a.savedResult.entityName)}&collection=${encodeURIComponent(a.savedResult.contentType)}`,className:"mono",style:{fontSize:12},children:[a.savedResult.collection," / ",a.savedResult.recordId]})}),n.jsx("div",{style:{fontSize:13,marginTop:8,color:s.status==="failed"?"var(--status-failed)":"var(--color-text-muted)"},children:I1(s,a.status,a.savedResult)})]})]})}function F1(){var Ee;const{id:a}=li(),s=tn(),r=kn(),[c,u]=S.useState("Overview"),[f,h]=S.useState(!1),m=fe({queryKey:["factory-run",a],queryFn:()=>te.factoryRun(a),enabled:!!a,refetchInterval:me=>{var xe;return((xe=me.state.data)==null?void 0:xe.status)==="running"?1500:!1}}),p=Pe({mutationFn:()=>te.retryRun(a),onSuccess:()=>{r.invalidateQueries({queryKey:["factory-run",a]}),r.invalidateQueries({queryKey:["factory-runs"]})}}),g=Pe({mutationFn:()=>te.cancelRun(a),onSuccess:()=>{r.invalidateQueries({queryKey:["factory-run",a]}),r.invalidateQueries({queryKey:["factory-runs"]})}}),v=Pe({mutationFn:()=>te.executeRun(a),onSuccess:()=>{r.invalidateQueries({queryKey:["factory-run",a]}),u("Console")}}),x=Pe({mutationFn:()=>te.queueRunNext(a),onSuccess:()=>r.invalidateQueries({queryKey:["factory-run",a]})}),N=Pe({mutationFn:me=>te.queueSingle(P1(me)),onSuccess:({run:me})=>{r.invalidateQueries({queryKey:["factory-runs"]}),r.invalidateQueries({queryKey:["run-status-counts"]}),s(`/journal/${me.id}`)}}),j=m.data;if(S.useEffect(()=>{!j||f||(u(Y1(j)),h(!0))},[j,f]),S.useEffect(()=>{h(!1)},[a]),m.isLoading)return n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]});if(m.isError||!j)return n.jsx(vt,{title:"Journal entry not found",detail:m.error});const E=j.queueOptions,C=j.status==="failed"||j.status==="cancelled",A=j.status==="done"||j.status==="failed"||j.status==="cancelled",O=j.status==="blocked"||j.status==="pending"||j.status==="running",U=j.status==="pending"&&((E==null?void 0:E.canExecuteNow)??!0),q=j.status==="pending"&&((E==null?void 0:E.admissionHeld)||((E==null?void 0:E.slotsAvailable)??1)<=0),z=$1(j),K=j.processingUpdate,J=v.isPending||j.status==="running",G=K1(j),$=j.status!=="pending"||j.attempts>0,ee=j.status==="failed"&&j.attempts>=j.maxAttempts,pe=j.sourceType==="on-demand-batch"&&j.sourceRef?`/on-demand/batch/${j.sourceRef}`:void 0,he=Q1.filter(me=>me!=="Console"||J||$);function ye(){const me=`Queue a new run for ${j.recordLabel??j.recordId} through ${j.graphName??j.graphId}? This creates a new journal entry.`;window.confirm(me)&&N.mutate(j)}return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(ve,{to:"/journal",children:"Journal"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),n.jsx("span",{className:"mono",children:j.id})]}),n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",marginBottom:4},children:[n.jsx("h1",{className:"page-title",style:{margin:0},children:j.recordLabel??j.recordId}),n.jsx(_t,{status:j.status}),j.status==="pending"&&(E==null?void 0:E.admissionHeld)&&n.jsx("span",{className:"chip",title:"Waiting for admission capacity",children:"capacity held"})]}),n.jsxs("span",{className:"page-subtitle mono",children:[j.entity," ·"," ",n.jsx(ve,{to:`/information/${encodeURIComponent(j.recordId)}?entity=${j.entity}`,children:j.recordId})," · ",n.jsx(ve,{to:`/pipelines/${encodeURIComponent(j.graphId)}`,children:j.graphName??j.graphId})]})]}),n.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",justifyContent:"flex-end"},children:[A&&n.jsx("button",{className:"primary",disabled:N.isPending,onClick:ye,children:N.isPending?"Queuing…":"Re-run"}),U&&n.jsx("button",{className:A?"":"primary",disabled:v.isPending,onClick:()=>v.mutate(),children:v.isPending?"Executing…":"Execute now"}),q&&n.jsx("button",{disabled:x.isPending,onClick:()=>x.mutate(),children:x.isPending?"Updating…":"Run next when slot available"}),C&&n.jsx("button",{disabled:p.isPending,onClick:()=>p.mutate(),children:p.isPending?"Retrying…":"Retry same entry"}),O&&n.jsx("button",{disabled:g.isPending,onClick:()=>g.mutate(),style:{color:"var(--status-cancelled)"},children:g.isPending?"Cancelling…":"Cancel"})]})]}),n.jsx("div",{className:"tabs",children:he.map(me=>n.jsxs("button",{type:"button",className:`tab${c===me?" active":""}`,onClick:()=>u(me),children:[me,me==="Console"&&J&&n.jsx("span",{className:"live-dot live",style:{marginLeft:8}})]},me))}),c==="Overview"&&n.jsxs(n.Fragment,{children:[G&&n.jsxs("div",{className:"run-io-warning",style:{marginBottom:16},children:["This run has been ",n.jsx("strong",{children:"running"})," for over ",Math.round(ox/6e4)," minutes with no update — the API likely stopped mid-execute. Use ",n.jsx("strong",{children:"Cancel"}),", then ",n.jsx("strong",{children:"Re-run"})," or ",n.jsx("strong",{children:"Retry same entry"})," and ",n.jsx("strong",{children:"Execute now"})," again."]}),ee&&n.jsxs("div",{className:"run-io-warning",style:{marginBottom:16},children:["All ",j.maxAttempts," attempt",j.maxAttempts===1?"":"s"," used. Use ",n.jsx("strong",{children:"Retry same entry"})," to schedule another attempt.",pe&&n.jsxs(n.Fragment,{children:[" ","For the whole batch, open"," ",n.jsx(ve,{to:pe,children:"batch detail"})," ","and use ",n.jsx("strong",{children:"Recover batch"}),"."]})]}),j.status==="pending"&&j.error&&new Date(j.availableAt).getTime()>Date.now()&&!(E!=null&&E.admissionHeld)&&n.jsxs("div",{className:"memorix-panel",style:{marginBottom:16,fontSize:13,color:"var(--status-pending)"},children:["Transient failure — automatic retry scheduled for ",Mt(j.availableAt)," (",j.attempts,"/",j.maxAttempts," attempts used)."]}),j.status==="pending"&&E&&n.jsxs("div",{className:"memorix-panel",style:{marginBottom:16,fontSize:13},children:[E.admissionHeld&&n.jsx("div",{style:{marginBottom:6,color:"var(--status-pending)"},children:"Waiting for capacity — this run is held until a slot opens or you execute it manually."}),E.slotsAvailable>0?`${E.slotsAvailable} execution slot${E.slotsAvailable===1?"":"s"} available (${E.admittedCount}/${E.maxConcurrentJobs} in use).`:`All ${E.maxConcurrentJobs} execution slots are in use.`,q&&" Use “Run next when slot available” to move this job to the front of the waiting queue."]}),n.jsxs("div",{className:"detail-grid",style:{marginBottom:16},children:[n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Summary"}),n.jsx(ut,{label:"Status",value:n.jsx(_t,{status:j.status})}),n.jsx(ut,{label:"Source",value:z?n.jsx(ve,{to:z,children:j.sourceName??Ra[j.sourceType]}):j.sourceName??Ra[j.sourceType]}),n.jsx(ut,{label:"Item",value:n.jsx(ve,{to:`/information/${encodeURIComponent(j.recordId)}?entity=${j.entity}`,children:j.recordLabel??j.recordId})}),n.jsx(ut,{label:"Pipeline",value:j.graphName??j.graphId}),n.jsx(ut,{label:"Attempts",value:`${j.attempts} / ${j.maxAttempts}`}),n.jsx(ut,{label:"Updated",value:Mt(j.updatedAt)})]}),n.jsx(qg,{run:j,pu:K})]}),v.isError&&n.jsxs("div",{className:"error-state",style:{marginBottom:16},children:["Execute failed: ",String(v.error)]}),N.isError&&n.jsxs("div",{className:"error-state",style:{marginBottom:16},children:["Re-run failed: ",String(N.error)]}),j.error&&n.jsxs("div",{className:"error-state",style:{marginBottom:16},children:[n.jsxs("div",{style:{color:"var(--status-failed)",fontWeight:600},children:["Error: ",j.error.message]}),j.error.code&&n.jsxs("div",{className:"mono text-muted",style:{fontSize:12,marginTop:4},children:["code: ",j.error.code,j.error.code==="TRANSIENT"?" — transient failure; may retry automatically":"",j.error.code==="NON_RETRYABLE"?" — will not auto-retry":""]})]})]}),c==="Console"&&(J||$?n.jsx(a1,{runId:j.id,live:J}):n.jsx("div",{className:"card",children:n.jsx("span",{className:"text-muted",style:{fontSize:13},children:"No console output yet."})})),c==="Pipeline"&&n.jsx(cx,{runId:j.id,status:j.status,result:j.result,live:J,graphId:j.graphId,entity:j.entity}),c==="Input & Output"&&n.jsx(U1,{runId:j.id,status:j.status,input:j.input,recordId:j.recordId,result:j.result,assemblySelection:j.assemblySelection,savedResult:j.savedResult,processingUpdate:j.processingUpdate,live:J}),c==="Details"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"detail-grid",style:{marginBottom:16},children:[n.jsxs(An,{title:"Source",summary:Ra[j.sourceType],defaultOpen:!0,children:[n.jsx(ut,{label:"Source type",value:Ra[j.sourceType]}),n.jsx(ut,{label:"Source name",value:z?n.jsx(ve,{to:z,children:j.sourceName}):j.sourceName??"—"}),n.jsx(ut,{label:"Source ref",value:j.sourceRef??"—"})]}),n.jsxs(An,{title:"Target",summary:`${j.entity} · ${j.recordLabel??j.recordId}`,defaultOpen:!0,children:[n.jsx(ut,{label:"Entity",value:`${j.entity} · ${j.collection}`}),n.jsx(ut,{label:"Item",value:n.jsx(ve,{to:`/information/${encodeURIComponent(j.recordId)}?entity=${j.entity}`,children:j.recordLabel??j.recordId})}),n.jsx(ut,{label:"Graph",value:j.graphName??j.graphId}),n.jsx(ut,{label:"Context",value:(Ee=j.relatedRecords)!=null&&Ee.length?j.relatedRecords.join(", "):"—"}),n.jsx(ut,{label:"Output collection",value:j.outputCollection??"—"})]}),n.jsxs(An,{title:"Execution",summary:`${j.attempts} / ${j.maxAttempts} attempts`,defaultOpen:!0,children:[n.jsx(ut,{label:"Attempts",value:`${j.attempts} / ${j.maxAttempts}`}),n.jsx(ut,{label:"Priority",value:j.priority}),n.jsx(ut,{label:"Claimed by",value:j.claimedBy??n.jsx("span",{className:"text-dim",children:"unclaimed"})}),n.jsx(ut,{label:"Queue state",value:H1(j)})]}),n.jsxs(An,{title:"Timestamps",summary:Mt(j.updatedAt),defaultOpen:!0,children:[n.jsx(ut,{label:"Created",value:Mt(j.createdAt)}),n.jsx(ut,{label:"Updated",value:Mt(j.updatedAt)})]})]}),n.jsx(qg,{run:j,pu:K})]})]})}function X1(a){const s=new Map,r=new Map(a.nodes.map(u=>[u.id,u]));function c(u,f=new Set){if(s.has(u))return s.get(u);if(f.has(u))return 0;f.add(u);const h=r.get(u);if(!h||!h.dependsOn.length)return s.set(u,0),0;const m=Math.max(...h.dependsOn.map(p=>c(p,f)))+1;return s.set(u,m),m}for(const u of a.nodes)c(u.id);return s}function V1({graph:a}){if(!a.nodes.length)return n.jsx("div",{className:"empty-state",children:"No graph data"});const s=X1(a),r=Math.max(...s.values(),0),c=Array.from({length:r+1},()=>[]);for(const u of a.nodes)c[s.get(u.id)??0].push(u);return n.jsxs("div",{className:"card",style:{marginBottom:20,overflow:"auto"},children:[n.jsx("div",{className:"card-title",children:"Dependency Graph"}),n.jsx("div",{style:{display:"flex",gap:24,padding:"12px 0",minWidth:"max-content"},children:c.map((u,f)=>n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,minWidth:160},children:[n.jsxs("div",{className:"text-dim",style:{fontSize:11,textAlign:"center"},children:["Layer ",f]}),u.map(h=>n.jsxs(ve,{to:`/journal/${h.id}`,style:{display:"block",padding:"10px 12px",background:"var(--color-surface-raised)",border:"1px solid var(--color-border)",borderLeft:`3px solid var(--status-${h.status})`,borderRadius:"var(--radius)",textDecoration:"none"},children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8,marginBottom:4},children:[n.jsx("span",{className:"mono",style:{fontSize:12},children:h.graphId}),n.jsx(_t,{status:h.status})]}),n.jsx("div",{className:"mono text-dim",style:{fontSize:10},children:h.id})]},h.id))]},f))}),a.edges.length>0&&n.jsxs("div",{className:"text-dim",style:{fontSize:11,marginTop:8},children:[a.edges.length," dependency edge",a.edges.length===1?"":"s"]})]})}function J1({run:a,allRuns:s}){var u;const r=(u=a.input)==null?void 0:u.upstream;if(!r||typeof r!="object"||Array.isArray(r))return null;const c=Object.entries(r);return c.length?n.jsxs("div",{className:"card",style:{marginBottom:16},children:[n.jsx("div",{className:"card-title",children:"Received from Upstream"}),c.map(([f,h])=>{const m=s==null?void 0:s.find(p=>p.graphId===f&&p.status==="done");return n.jsxs("div",{style:{marginBottom:10},children:[n.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:4},children:[n.jsx("span",{className:"mono",style:{fontSize:12},children:f}),m&&n.jsx(ve,{to:`/journal/${m.id}`,style:{fontSize:11},children:"view in journal"})]}),n.jsx("pre",{style:{fontSize:11,overflow:"auto",maxHeight:120,padding:8,background:"var(--color-bg)",borderRadius:"var(--radius)"},children:JSON.stringify(h,null,2)})]},f)})]}):null}function Z1({run:a,allRuns:s}){var c;if(((c=a.error)==null?void 0:c.code)!=="DEP_FAILED"||!a.dependsOn.length)return null;const r=(s==null?void 0:s.find(u=>a.dependsOn.includes(u.id)&&u.status==="failed"))??(s==null?void 0:s.find(u=>a.dependsOn.includes(u.id)));return n.jsxs("div",{style:{fontSize:12,marginTop:6},children:["Root cause:"," ",r?n.jsxs(ve,{to:`/journal/${r.id}`,style:{color:"var(--status-failed)"},children:[r.graphId," (",r.id,")"]}):n.jsx("span",{className:"mono",children:a.dependsOn[0]})]})}function W1(a){return new Date(a).toLocaleString()}function eC({run:a,allRuns:s}){if(a.status!=="blocked"||a.dependsOn.length===0)return null;const r=a.dependsOn.map(f=>s.find(h=>h.id===f)).filter(f=>f!=null),c=r.filter(f=>f.status==="failed"||f.status==="cancelled"),u=r.filter(f=>f.status==="pending"||f.status==="running");return c.length===0&&u.length===0?null:n.jsxs("div",{style:{padding:"10px 14px",background:"var(--status-blocked-bg)",border:"1px solid var(--status-blocked)",borderRadius:"var(--radius)",marginBottom:8,fontSize:13},children:[n.jsx("strong",{style:{color:"var(--status-blocked)"},children:"Blocked"}),c.length>0&&n.jsxs("div",{style:{marginTop:6},children:["Upstream failures:"," ",c.map(f=>n.jsx(ve,{to:`/journal/${f.id}`,style:{marginRight:8,color:"var(--status-failed)"},children:f.graphId},f.id))]}),u.length>0&&n.jsxs("div",{style:{marginTop:6},children:["Waiting on:"," ",u.map(f=>n.jsx(ve,{to:`/journal/${f.id}`,style:{marginRight:8,color:"var(--status-pending)"},children:f.graphId},f.id))]})]})}function tC(){const{itemId:a}=li(),s=fe({queryKey:["item-runs",a],queryFn:()=>te.itemRuns(a),enabled:!!a}),r=fe({queryKey:["item-graph",a],queryFn:()=>te.itemGraph(a),enabled:!!a}),c=s.data??[];if(s.isLoading)return n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading timeline…"]});if(s.isError)return n.jsxs("div",{className:"error-state",children:["Error: ",String(s.error)]});const u=[...new Set(c.map(f=>f.graphId))];return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(ve,{to:"/journal",children:"Journal"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),n.jsx(ve,{to:`/journal?itemId=${a}`,children:"Item journal"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),n.jsx("span",{className:"mono",children:a})]}),n.jsxs("div",{className:"page-header",children:[n.jsx("h1",{className:"page-title",children:"Run timeline"}),n.jsx("span",{className:"page-subtitle mono",children:a})]}),c.length===0&&n.jsx("div",{className:"empty-state",children:"No job runs found for this item."}),c.length>0&&n.jsxs(n.Fragment,{children:[r.data&&n.jsx(V1,{graph:r.data}),n.jsxs("div",{className:"card",style:{marginBottom:20},children:[n.jsx("div",{className:"card-title",children:"Pipeline status"}),n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:10,marginTop:8},children:u.map(f=>{const h=c.filter(p=>p.graphId===f),m=h[h.length-1];return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--color-surface-raised)",borderRadius:"var(--radius)",border:"1px solid var(--color-border)"},children:[n.jsx("span",{className:"mono",style:{fontSize:12},children:f}),m&&n.jsx(_t,{status:m.status}),n.jsxs("span",{className:"text-dim",style:{fontSize:11},children:[h.length,"×"]})]},f)})})]}),n.jsx("div",{className:"timeline",children:c.map(f=>n.jsxs("div",{className:"timeline-item",children:[n.jsx("div",{className:`timeline-dot timeline-dot-${f.status}`}),n.jsxs("div",{className:"card",style:{borderLeft:`3px solid var(--status-${f.status})`},children:[n.jsx(eC,{run:f,allRuns:c}),n.jsx(J1,{run:f,allRuns:c}),n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[n.jsx(_t,{status:f.status}),n.jsx("span",{className:"mono",style:{fontSize:13},children:f.graphId})]}),n.jsx(ve,{to:`/journal/${f.id}`,className:"mono text-muted",style:{fontSize:11},children:f.id})]}),n.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px 24px",fontSize:12,color:"var(--color-text-muted)"},children:[n.jsxs("span",{children:["Job: ",n.jsx("span",{className:"mono",children:f.jobDefId})]}),n.jsxs("span",{children:["Attempts: ",n.jsxs("span",{className:"mono",children:[f.attempts,"/",f.maxAttempts]})]}),n.jsxs("span",{children:["Created: ",n.jsx("span",{className:"mono",children:W1(f.createdAt)})]})]}),f.error&&n.jsxs("div",{style:{marginTop:10,padding:"8px 10px",background:"var(--status-failed-bg)",borderRadius:"var(--radius)",fontSize:12,color:"var(--status-failed)"},children:[f.error.message,n.jsx(Z1,{run:f,allRuns:c})]}),f.dependsOn.length>0&&n.jsx("div",{style:{marginTop:10},children:n.jsx(Lt,{label:`Depends On (${f.dependsOn.length})`,value:f.dependsOn})})]})]},f.id))})]})]})}function ux({work:a,busy:s,onClose:r,onConfirm:c}){return a?n.jsxs(sr,{open:!0,title:`Delete "${a.name}"?`,onClose:r,actions:[{label:"Keep work",onClick:r,variant:"ghost",disabled:s},{label:"Delete ongoing work",onClick:c,variant:"danger",disabled:s,loading:s}],children:[n.jsxs("p",{children:["This permanently removes ",n.jsx("strong",{children:a.name})," and its evaluation history. Scheduled scans will stop and this definition cannot be recovered."]}),n.jsxs("p",{className:"confirm-dialog-note confirm-dialog-note--warn",children:["Any blocked, pending, or running jobs created by this work (",a.jobsCreated.toLocaleString()," total"," ","created) will be cancelled. Completed runs stay in the journal."]}),n.jsxs("p",{className:"confirm-dialog-note",children:["To pause scans without deleting, use ",n.jsx("strong",{children:"Pause"})," instead."]})]}):null}function nC(){const a=tn(),s=kn(),{agentQueryParam:r,agentId:c}=zn(),u=fe({queryKey:["work",r??"all"],queryFn:()=>te.listWork(r)}),f=Pe({mutationFn:C=>te.runEvaluation(C),onSuccess:()=>s.invalidateQueries({queryKey:["work"]})}),h=Pe({mutationFn:({id:C,status:A})=>te.setWorkStatus(C,A),onSuccess:()=>s.invalidateQueries({queryKey:["work"]})}),[m,p]=S.useState(null),g=Pe({mutationFn:C=>te.deleteWork(C),onSuccess:()=>{p(null),s.invalidateQueries({queryKey:["work"]}),s.invalidateQueries({queryKey:["factory-runs"]}),s.invalidateQueries({queryKey:["run-status-counts"]})}}),v=u.data??[],x=g.isPending,N=f.isPending||h.isPending||x,j=v.filter(C=>C.status==="active").length,E=v.reduce((C,A)=>C+A.jobsCreated,0);return n.jsxs("div",{children:[n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"Ongoing Work"}),n.jsx("span",{className:"page-subtitle",children:c?n.jsxs(n.Fragment,{children:["Ongoing work for object types in agent scope ",n.jsx("span",{className:"mono",children:c}),"."]}):"Scheduled evaluations that match information and queue jobs automatically."})]}),n.jsx(ve,{to:"/work/new",children:n.jsx("button",{className:"primary",children:"+ New ongoing work"})})]}),u.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}),u.isError&&n.jsx(vt,{title:"Failed to load ongoing work",detail:u.error,onRetry:()=>u.refetch()}),g.isError&&n.jsx("div",{style:{marginBottom:12},children:n.jsx(vt,{title:"Failed to delete ongoing work",detail:g.error})}),n.jsx(ux,{work:m,busy:x,onClose:()=>p(null),onConfirm:()=>m&&g.mutate(m.id)}),v.length===0&&!u.isLoading&&!u.isError&&n.jsx(It,{title:"No ongoing work yet",message:"Ongoing work evaluates information on a schedule and queues jobs for items that match your narratives and processing rules.",actionLabel:"New ongoing work",actionTo:"/work/new"}),v.length>0&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"metric-grid",style:{gridTemplateColumns:"repeat(3, 1fr)",maxWidth:720},children:[n.jsxs("div",{className:"metric-card",children:[n.jsx("div",{className:"metric-value",children:v.length}),n.jsx("div",{className:"metric-label",children:"Definitions"}),n.jsxs("div",{className:"metric-sub",children:[j," active · ",v.length-j," paused"]})]}),n.jsxs("div",{className:"metric-card",children:[n.jsx("div",{className:"metric-value",children:j}),n.jsx("div",{className:"metric-label",children:"Scanning now"}),n.jsx("div",{className:"metric-sub",children:"On their re-scan schedule"})]}),n.jsxs("div",{className:"metric-card",children:[n.jsx("div",{className:"metric-value",children:E.toLocaleString()}),n.jsx("div",{className:"metric-label",children:"Jobs created"}),n.jsx("div",{className:"metric-sub",children:"Across all definitions"})]})]}),n.jsx("div",{className:"work-list",children:v.map(C=>n.jsx(aC,{work:C,busy:N,onOpen:()=>a(`/work/${C.id}`),onEvaluate:()=>f.mutate(C.id),onToggleStatus:()=>h.mutate({id:C.id,status:C.status==="active"?"inactive":"active"}),onDelete:()=>p(C)},C.id))})]})]})}function aC({work:a,busy:s,onOpen:r,onEvaluate:c,onToggleStatus:u,onDelete:f}){const h=DN(a.lastResult),m=a.status==="active";return n.jsxs("article",{className:`work-card${m?"":" work-card-paused"}`,children:[n.jsxs("div",{className:"work-card-head",children:[n.jsx("button",{type:"button",className:"work-card-title",onClick:r,children:a.name}),n.jsx(_t,{status:a.status}),n.jsxs("div",{className:"work-card-actions",onClick:p=>p.stopPropagation(),children:[n.jsx("button",{type:"button",className:"primary",disabled:s,onClick:c,title:"Run evaluation now",children:"Evaluate now"}),n.jsx("button",{type:"button",disabled:s,onClick:u,children:m?"Pause":"Activate"}),n.jsx("button",{type:"button",disabled:s,onClick:f,style:{color:"var(--status-cancelled)"},title:"Delete this ongoing work definition",children:"Delete"})]})]}),!m&&n.jsx("div",{className:"work-card-notice",children:"Paused — scheduled scans are off. Activate or run an evaluation manually."}),n.jsxs("div",{className:"work-card-stats",children:[n.jsxs("div",{className:"work-stat",children:[n.jsx("span",{className:"work-stat-value",children:a.jobsCreated.toLocaleString()}),n.jsx("span",{className:"work-stat-label",children:"Jobs created"})]}),n.jsxs("div",{className:"work-stat",children:[n.jsx("span",{className:"work-stat-value",children:Xn(a.lastEvaluatedAt)}),n.jsx("span",{className:"work-stat-label",children:"Last scanned"})]}),n.jsxs("div",{className:"work-stat work-stat-wide",children:[n.jsx("span",{className:"work-stat-value",children:h.enqueued!=null&&h.matched!=null?n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:h.enqueued.toLocaleString()}),n.jsx("span",{className:"work-stat-sep",children:" enqueued of "}),n.jsx("strong",{children:h.matched.toLocaleString()}),n.jsx("span",{className:"work-stat-sep",children:" matched"})]}):h.raw??"No scans yet"}),n.jsx("span",{className:"work-stat-label",children:"Last result"})]}),n.jsxs("div",{className:"work-stat",children:[n.jsx("span",{className:"work-stat-value",children:m?Xn(a.nextEvaluationAt):"—"}),n.jsx("span",{className:"work-stat-label",children:"Next scan"})]})]}),n.jsxs("div",{className:"work-card-meta",children:[n.jsxs("span",{className:"work-meta-item",children:[n.jsx("span",{className:"work-meta-k",children:"Entity"}),n.jsx("span",{className:"mono",children:a.entity})]}),n.jsx("span",{className:"work-meta-sep","aria-hidden":!0,children:"·"}),n.jsxs("span",{className:"work-meta-item",children:[n.jsx("span",{className:"work-meta-k",children:"Graph"}),n.jsx("span",{className:"mono",children:a.graphName??a.graphId})]}),n.jsx("span",{className:"work-meta-sep","aria-hidden":!0,children:"·"}),n.jsxs("span",{className:"work-meta-item",children:[n.jsx("span",{className:"work-meta-k",children:"Schedule"}),n.jsx("span",{children:dr(a.policy.rescanIntervalMinutes)})]}),n.jsx("span",{className:"work-meta-sep","aria-hidden":!0,children:"·"}),n.jsxs("span",{className:"work-meta-item",children:[n.jsx("span",{className:"work-meta-k",children:"Reprocessing"}),n.jsx("span",{children:zN(a.processing)})]})]}),a.narratives.length>0&&n.jsxs("div",{className:"work-card-narratives",children:[n.jsx("span",{className:"work-meta-k",children:"Narratives"}),n.jsx("span",{className:"chip-row",children:a.narratives.map(p=>n.jsx("span",{className:"chip narrative",children:p},p))})]})]})}function Yf({steps:a,current:s,isComplete:r,canGoTo:c,onGoTo:u,maxWidth:f,scrollable:h}){const m=S.useRef(null),p=h??a.length>5;return S.useEffect(()=>{const g=m.current;if(!g)return;const v=g.querySelector(".wizard-step.is-active");v==null||v.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[s,p]),n.jsx("div",{ref:m,className:`wizard-steps${p?" wizard-steps--scrollable":""}`,style:f?{maxWidth:f}:void 0,children:a.map((g,v)=>{const x=s===v,N=(r==null?void 0:r(v))??v<s,j=(c==null?void 0:c(v))??v<=s,E=g.summary?`${g.title} — ${g.summary}`:g.title;return n.jsxs("button",{type:"button",className:`wizard-step${x?" is-active":""}${N?" is-done":""}${j?" is-clickable":""}`,onClick:()=>j&&u(v),disabled:!j&&!x,title:E,"aria-current":x?"step":void 0,children:[n.jsx("span",{className:"wizard-step-num",children:N&&!x?"✓":v+1}),n.jsxs("span",{className:"wizard-step-label",children:[n.jsx("span",{className:"wizard-step-title",children:g.title}),g.summary&&n.jsx("span",{className:"wizard-step-summary",children:g.summary})]})]},g.id)})})}function Ct({onBack:a,backLabel:s="Back",onNext:r,nextLabel:c="Next",nextDisabled:u,children:f}){return n.jsxs("div",{className:"wizard-nav",children:[a?n.jsx("button",{type:"button",onClick:a,children:s}):n.jsx("span",{}),n.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[f,r&&n.jsx("button",{type:"button",className:"primary",disabled:u,onClick:r,children:c})]})]})}function yo({entity:a,selected:s,onChange:r,requireSelection:c=!0}){const u=fe({queryKey:["narratives",a],queryFn:()=>te.listNarratives(a),enabled:!!a}),f=u.data??[];function h(x){r(s.includes(x)?s.filter(N=>N!==x):[...s,x])}if(u.isLoading)return n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading narratives…"]});if(f.length===0)return n.jsx(It,{title:"No narratives available",message:c?"No narrative filters defined for this object type. You can continue — all information will be included.":"No narrative filters are available for this object type."});const m=s.length===f.length,p=f.map(x=>x.key);function g(){r(p)}function v(){r([])}return n.jsxs("div",{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10,gap:12,flexWrap:"wrap"},children:[n.jsxs("span",{style:{fontWeight:600,color:"var(--color-text)",fontSize:13},children:[s.length," of ",f.length," selected"]}),n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx("button",{type:"button",className:"btn-ghost btn-xs",disabled:m,onClick:g,children:"Select all"}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",disabled:s.length===0,onClick:v,children:"Clear"})]})]}),s.length>0&&n.jsxs("div",{className:"selector-summary",children:[s.map(x=>{const N=f.find(j=>j.key===x);return n.jsx("span",{className:"chip narrative",children:(N==null?void 0:N.label)??x},x)}),n.jsx("span",{style:{color:"var(--color-text-dim)"},children:"·"}),n.jsx("span",{style:{color:"var(--color-text-dim)",fontSize:11},children:"information must match ALL (AND)"})]}),n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:f.map(x=>{const N=s.includes(x.key);return n.jsxs("div",{role:"checkbox","aria-checked":N,tabIndex:0,className:`selector-card${N?" selected":""}`,onClick:()=>h(x.key),onKeyDown:j=>(j.key===" "||j.key==="Enter")&&h(x.key),children:[n.jsx("div",{className:"selector-card-check-indicator"}),n.jsxs("div",{className:"selector-card-body",children:[n.jsxs("div",{className:"selector-card-meta",children:[n.jsx("span",{className:"selector-card-title",children:x.label}),n.jsx("span",{className:"selector-card-id",children:x.key})]}),x.description&&n.jsx("div",{className:"selector-card-desc",children:x.description})]}),x.activeRecords!==void 0&&n.jsxs("div",{className:"selector-card-count",children:[n.jsx("div",{className:"selector-card-count-num",children:x.activeRecords.toLocaleString()}),n.jsx("div",{className:"selector-card-count-label",children:"items"})]})]},x.key)})}),c&&s.length===0&&n.jsx("p",{className:"text-dim",style:{fontSize:12,marginTop:12},children:"Select at least one narrative to continue."}),!c&&s.length===0&&n.jsxs("p",{className:"text-dim",style:{fontSize:12,marginTop:12},children:["Information must match ",n.jsx("strong",{style:{color:"var(--color-text-muted)"},children:"all"})," selected narratives (AND). For OR logic, create another ongoing work or batch."]})]})}const lC={core:"Core",snapshot:"Snapshot",scoped:"Scoped",lens:"Lens",enrichment:"Enrichment","processing-output":"Inferences",unknown:""};function fr(a){const s=lC[a.role];return s||a.key.charAt(0).toUpperCase()+a.key.slice(1)}function Pf({options:a,selected:s,onChange:r}){function c(u){if(s.includes(u)){if(s.length===1)return;r(s.filter(f=>f!==u))}else r([...s,u])}return a.length===0?null:a.length===1?n.jsx("span",{className:"mono",style:{fontSize:13},children:fr(a[0])}):n.jsx("div",{className:"chip-row",children:a.map(u=>n.jsxs("button",{type:"button",className:`chip selectable${s.includes(u.key)?" selected":""}`,onClick:()=>c(u.key),children:[fr(u),u.count>0&&n.jsx("span",{style:{opacity:.65,marginLeft:5,fontSize:11},children:u.count.toLocaleString()})]},u.key))})}const dx="jobs-ui-recent-graphs",sC=20;function fx(){try{const a=localStorage.getItem(dx);if(!a)return[];const s=JSON.parse(a);return Array.isArray(s)?s:[]}catch{return[]}}function iC(a){localStorage.setItem(dx,JSON.stringify(a.slice(0,sC)))}function rC(a){if(!a)return;const s=Date.now(),r=[{graphId:a,usedAt:s},...fx().filter(c=>c.graphId!==a)];iC(r)}function cC(){return fx().sort((a,s)=>s.usedAt-a.usedAt).map(a=>a.graphId)}function io(a){var s;return(s=a.name)!=null&&s.trim()?a.name.trim():a.graphId.replace(/[-_]+/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function oC(a,s){const r=s.trim().toLowerCase();return r?[a.graphId,a.name,a.description,a.version,...a.entityCompatible].filter(Boolean).join(" ").toLowerCase().includes(r):!0}function Bg(a,s){var u,f;if(!s)return 0;const r=s.toLowerCase();let c=0;a.graphId.toLowerCase()===r&&(c+=100),a.graphId.toLowerCase().includes(r)&&(c+=40);for(const h of a.entityCompatible){const m=h.toLowerCase();m===r?c+=80:(m.includes(r)||r.includes(m))&&(c+=30)}return(u=a.name)!=null&&u.toLowerCase().includes(r)&&(c+=20),(f=a.description)!=null&&f.toLowerCase().includes(r)&&(c+=10),c}function uC(a,s,r,c){const u=a.filter(f=>oC(f,c));if(s==="recent"){const f=new Map(u.map(m=>[m.graphId,m])),h=[];for(const m of cC()){const p=f.get(m);p&&h.push(p)}for(const m of u)h.some(p=>p.graphId===m.graphId)||h.push(m);return h}return[...u].sort((f,h)=>{const m=Bg(h,r)-Bg(f,r);return m!==0?m:io(f).localeCompare(io(h))})}const dC=52,fC=5;function go({entity:a,value:s,onChange:r}){const[c,u]=S.useState("recent"),[f,h]=S.useState(""),m=fe({queryKey:["graphs",a],queryFn:()=>te.graphsForEntity(a),enabled:!!a}),p=m.data??[],g=S.useMemo(()=>uC(p,c,a,f),[p,c,a,f]);function v(x){rC(x.graphId),r(x.graphId,x)}return m.isLoading?n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading graphs…"]}):m.isError?n.jsx(It,{title:"Could not load graphs",message:m.error instanceof Error?m.error.message:"The graph list failed to load."}):p.length===0?n.jsx(It,{title:"No graphs found",message:`No pipelines are available for "${a}". Choose a different object type or add a graph for this type in Graphs Studio.`}):n.jsxs("div",{className:"graph-picker",children:[n.jsxs("div",{className:"graph-picker-toolbar",children:[n.jsxs("div",{className:"chip-row",children:[n.jsx("button",{type:"button",className:`chip selectable${c==="recent"?" selected":""}`,onClick:()=>u("recent"),children:"Recent"}),n.jsx("button",{type:"button",className:`chip selectable${c==="relevant"?" selected":""}`,onClick:()=>u("relevant"),children:"Relevant"})]}),n.jsx("input",{type:"search",className:"graph-picker-search",placeholder:"Search graphs…",value:f,onChange:x=>h(x.target.value)})]}),n.jsx("div",{className:"graph-picker-list",style:{maxHeight:dC*fC},role:"listbox","aria-label":"Graphs",children:g.length===0?n.jsx("div",{className:"graph-picker-empty",children:"No graphs match your search."}):g.map(x=>{const N=s===x.graphId,j=io(x);return n.jsxs("button",{type:"button",role:"option","aria-selected":N,className:`graph-picker-row${N?" selected":""}`,onClick:()=>v(x),children:[n.jsxs("div",{className:"graph-picker-row-main",children:[n.jsx("span",{className:"graph-picker-row-title",children:j}),x.version&&n.jsx("span",{className:"chip",style:{fontSize:10},children:x.version})]}),n.jsx("span",{className:"graph-picker-row-id mono",children:x.graphId}),x.description&&n.jsx("span",{className:"graph-picker-row-desc",children:x.description})]},x.graphId)})})]})}function Ff({value:a,entities:s,loading:r,error:c,onChange:u,style:f}){if(c){const h=c instanceof Error?c.message:String(c);return n.jsxs("div",{className:"memorix-panel",style:{borderColor:"var(--status-failed)",background:"var(--status-failed-bg)"},children:[n.jsx("div",{className:"memorix-panel-title",style:{color:"var(--status-failed)"},children:"Could not load object types"}),n.jsx("p",{style:{fontSize:13,margin:"4px 0 0"},children:h||"The API is unavailable. Use http://localhost:3099 or start the API before the Vite dev server (5190)."})]})}return n.jsxs("select",{value:a,disabled:r,onChange:h=>u(h.target.value),style:f??{maxWidth:320},children:[n.jsx("option",{value:"",children:r?"Loading object types…":"— select object type —"}),!r&&["entity","event","knowledge"].map(h=>{const m=s.filter(p=>p.target===h);return m.length?n.jsx("optgroup",{label:qN[h],children:m.map(p=>n.jsx("option",{value:p.name,children:p.label},p.name))},h):null})]})}function vo({included:a,excluded:s,includedLabel:r="Matching information"}){const c=s.reduce((u,f)=>u+f.count,0);return n.jsxs("div",{className:"card",style:{padding:14},children:[n.jsxs("div",{style:{display:"flex",gap:24,marginBottom:s.length?12:0},children:[n.jsxs("div",{children:[n.jsx("div",{className:"status-card-count",style:{fontSize:24,color:"var(--status-done)"},children:a.toLocaleString()}),n.jsx("div",{className:"text-muted",style:{fontSize:12},children:r})]}),n.jsxs("div",{children:[n.jsx("div",{className:"status-card-count",style:{fontSize:24,color:c?"var(--status-blocked)":"var(--color-text-dim)"},children:c.toLocaleString()}),n.jsx("div",{className:"text-muted",style:{fontSize:12},children:"Excluded"})]})]}),s.length>0&&n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:s.map(u=>n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,padding:"4px 0",borderTop:"1px solid var(--color-border)"},children:[n.jsx("span",{className:"text-muted",children:Kv[u.reason]}),n.jsx("span",{className:"mono",style:{color:"var(--status-blocked)"},children:u.count})]},u.reason))})]})}function hC(a,s,r,c,u,f){const h=(a==null?void 0:a.reprocessingMode)??"skip",m=s!==void 0,p=(r==null?void 0:r.replaceQueuedRuns)!==!1,g=[];if(f&&g.push(`${f.toLocaleString()} older queued run(s) would be replaced for this job type`),u===c)return g.length?g.join(". ")+".":h==="all"?"All matching items will be queued.":m&&s===null?"Simulation — reprocessing skip only checks items already running (if enabled), not prior simulation runs.":"Every matching item will receive a job under the current rules.";const v=c-u;return h==="all"?g.push(`${v.toLocaleString()} excluded by prerequisite rules`):m&&s?g.push(`${v.toLocaleString()} excluded — result already in writeback target, currently running, or already queued (when replace is off)`):g.push(`${v.toLocaleString()} excluded — see breakdown below`),p||g.push("queued runs are left in place when replace is off"),g.join("; ")+"."}function Xl({entity:a,collection:s,narratives:r,processing:c,graphId:u,persistency:f,queuePolicy:h,headline:m=!1,requireGraph:p=!1}){const g=fe({queryKey:["matching",a,s,r,c,u,f,h],queryFn:()=>te.previewMatching({entity:a,collection:s,narratives:r,processing:c,graphId:u,persistency:f,blockWhenRunning:h==null?void 0:h.blockWhenRunning,replaceQueuedRuns:h==null?void 0:h.replaceQueuedRuns}),enabled:!!(a&&(!p||u))});if(p&&!u)return n.jsx("p",{className:"text-dim",style:{fontSize:12,margin:0},children:"Choose a graph first — job counts depend on which pipeline (and its in-flight queue entries) apply."});if(g.isLoading)return n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Evaluating matching information…"]});if(g.isError)return n.jsx("p",{className:"text-dim",style:{fontSize:12,color:"var(--color-danger, #e55)"},children:"Could not load preview. Try again in a moment."});if(!g.data)return null;const{matched:v,total:x,eligible:N,excluded:j,sample:E,wouldReplaceQueued:C}=g.data;return n.jsxs("div",{children:[m&&n.jsxs("div",{className:"memorix-panel",style:{marginBottom:12},children:[n.jsxs("div",{style:{fontSize:15,fontWeight:600},children:[n.jsx("span",{style:{color:"var(--status-done)"},children:N.toLocaleString()})," ","job",N===1?"":"s"," will be queued"]}),n.jsxs("div",{className:"text-dim",style:{fontSize:12,marginTop:4},children:[v.toLocaleString()," match your filters out of ",x.toLocaleString()," in the collection.",N!==v&&n.jsxs(n.Fragment,{children:[" ",(v-N).toLocaleString()," excluded by eligibility rules."]}),C?n.jsxs(n.Fragment,{children:[" "," ",C.toLocaleString()," queued run(s) would be replaced."]}):null]})]}),n.jsxs("div",{className:"review-grid",style:{marginBottom:12},children:[n.jsx(Xd,{label:"Total in collection",value:x}),n.jsx(Xd,{label:"Matched filters",value:v}),n.jsx(Xd,{label:"Eligible to queue",value:N,highlight:!0})]}),n.jsx(vo,{included:N,excluded:j,includedLabel:"Eligible to queue"}),n.jsxs("p",{className:"text-dim",style:{fontSize:12,margin:"10px 0"},children:[v.toLocaleString()," of ",x.toLocaleString()," ",a," items match your filters."," ",hC(c,f,h,v,N,C)]}),E.length>0&&n.jsx("div",{className:"table-wrap",children:n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Item"}),n.jsx("th",{children:"Label"}),n.jsx("th",{children:"Narratives"}),n.jsx("th",{children:"Updated"})]})}),n.jsx("tbody",{children:E.map(A=>n.jsxs("tr",{style:{cursor:"default"},children:[n.jsx("td",{className:"mono",style:{fontSize:12},children:A.id}),n.jsx("td",{children:A.label}),n.jsx("td",{children:n.jsx("span",{className:"chip-row",children:Object.keys(A.narratives).map(O=>n.jsx("span",{className:"chip narrative",children:O},O))})}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:new Date(A.updatedAt).toLocaleString()})]},A.id))})]})})]})}function Xd({label:a,value:s,highlight:r}){return n.jsxs("div",{className:"review-row",children:[n.jsx("span",{className:"review-label",children:a}),n.jsx("span",{className:"mono",style:{fontSize:14,fontWeight:r?600:400,color:r?"var(--status-done)":void 0},children:s.toLocaleString()})]})}const mC=["ttl","failed-only","condition","all","skip"],pC=["skip","failed-only","before-date","after-date","condition","all"],Lg={value:7,unit:"days"};function Xf({context:a="recurring",entity:s,targetGraphId:r,targetJobTypeId:c,hasContextLinks:u=!1,value:f,onChange:h}){const{agentQueryParam:m}=zn(),p=fe({queryKey:["graphs",s],queryFn:()=>te.graphsForEntity(s),enabled:!!s}),g=fe({queryKey:["entities",m??"all"],queryFn:()=>te.listEntities(m)}),v=fe({queryKey:["entity-relations",s],queryFn:()=>te.entityRelations(s),enabled:!!s}),x=p.data??[],N=x.filter(Y=>Y.graphId!==r),j=(g.data??[]).filter(Y=>Y.name!==s),E=v.data??[],C=a==="recurring"?mC:pC,A=a==="recurring"?"ttl":"skip",O=f.reprocessingMode??A,U=f.reprocessingTtl??Lg,q=f.requiredGraphs??[],z=f.crossEntityPrerequisites??[];function K(Y){const T=Y.reprocessingMode??f.reprocessingMode??A;h({...f,excludeInFlight:T!=="all",...Y})}function J(Y){K({reprocessingMode:Y,excludeInFlight:Y!=="all",reprocessingTtl:Y==="ttl"?Lg:void 0,reprocessingDate:void 0,reprocessingCondition:void 0})}function G(Y){const T=x.find(B=>B.graphId===Y);!T||q.some(B=>B.graphId===Y)||K({requiredGraphs:[...q,{graphId:Y,graphName:T.name}]})}function $(Y){K({requiredGraphs:q.filter(T=>T.graphId!==Y)})}const[ee,pe]=S.useState(""),[he,ye]=S.useState(""),[Ee,me]=S.useState(""),k=fe({queryKey:["graphs",ee],queryFn:()=>te.graphsForEntity(ee),enabled:!!ee}).data??[],Z=E.filter(Y=>Y.sourceEntity===s&&Y.targetEntity===ee);function ne(){if(!ee||!Ee||!he)return;const Y=Z.find(B=>B.relationKey===he),T=k.find(B=>B.graphId===Ee);z.some(B=>B.entity===ee&&B.relationshipKey===he&&B.graphId===Ee)||(K({crossEntityPrerequisites:[...z,{entity:ee,relationshipKey:he,relationshipLabel:Y==null?void 0:Y.relationKey,graphId:Ee,graphName:T==null?void 0:T.name}]}),pe(""),ye(""),me(""))}function je(Y){K({crossEntityPrerequisites:z.filter((T,B)=>B!==Y)})}return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[n.jsxs("div",{className:"prereq-section",children:[n.jsxs("div",{className:"prereq-section-header",children:[n.jsx("span",{style:{fontSize:13,fontWeight:600},children:"Reprocessing"}),O!==A&&n.jsx("span",{className:"chip",style:{background:"var(--color-warning-subtle, #2a2000)",borderColor:"var(--color-warning-border, #5a4000)",color:"var(--color-warning, #e6c200)"},children:"custom"})]}),n.jsxs("div",{className:"prereq-section-body",style:{display:"flex",flexDirection:"column",gap:10},children:[n.jsx("select",{value:O,onChange:Y=>J(Y.target.value),style:{width:"100%"},children:C.map(Y=>n.jsx("option",{value:Y,children:Y==="skip"&&c?`Skip already processed for job type "${c}"`:Gv[Y]},Y))}),O==="skip"&&c&&n.jsxs("p",{style:{fontSize:12,color:"var(--color-text-muted)",margin:0},children:["Eligibility keys off logical job type ",n.jsx("code",{children:c}),", not the graph implementation id."]}),O==="ttl"&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("span",{style:{fontSize:12,color:"var(--color-text-muted)",whiteSpace:"nowrap"},children:"Only if older than"}),n.jsx("input",{type:"number",min:1,value:U.value,onChange:Y=>K({reprocessingTtl:{...U,value:Math.max(1,Number(Y.target.value))}}),style:{width:70}}),n.jsxs("select",{value:U.unit,onChange:Y=>K({reprocessingTtl:{...U,unit:Y.target.value}}),style:{width:90},children:[n.jsx("option",{value:"hours",children:"hours"}),n.jsx("option",{value:"days",children:"days"}),n.jsx("option",{value:"weeks",children:"weeks"})]})]}),(O==="before-date"||O==="after-date")&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("span",{style:{fontSize:12,color:"var(--color-text-muted)",whiteSpace:"nowrap"},children:O==="before-date"?"Before":"After"}),n.jsx("input",{type:"date",value:f.reprocessingDate??"",onChange:Y=>K({reprocessingDate:Y.target.value||void 0}),style:{flex:1}})]}),O==="condition"&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[n.jsx("textarea",{rows:3,value:f.reprocessingCondition??"",onChange:Y=>K({reprocessingCondition:Y.target.value||void 0}),placeholder:'{ "fields.criticality": "high" }',style:{fontFamily:"var(--font-mono)",fontSize:12}}),n.jsx("span",{style:{fontSize:11,color:"var(--color-text-dim)"},children:"Information matching this JSON condition will be re-run even if already processed."})]}),O==="all"&&n.jsx("p",{style:{fontSize:11,color:"var(--color-text-dim)",lineHeight:1.5},children:"Every matching item is queued, including items already pending or running for this graph. New jobs are created even when older queue entries still exist."}),O!=="skip"&&O!=="all"&&n.jsx("p",{style:{fontSize:11,color:"var(--color-text-dim)",lineHeight:1.5},children:"Information currently queued or running is always excluded to prevent overlapping work."})]})]}),n.jsxs("div",{className:"prereq-section",children:[n.jsxs("div",{className:"prereq-section-header",children:[n.jsx("span",{style:{fontSize:13,fontWeight:600},children:"Required prior processing"}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("span",{className:"text-dim",style:{fontSize:12},children:"same entity"}),q.length>0&&n.jsx("span",{className:"chip",style:{background:"var(--color-accent-subtle)",borderColor:"var(--color-accent-border)",color:"var(--color-accent)"},children:q.length})]})]}),n.jsxs("div",{className:"prereq-section-body",children:[n.jsx("p",{style:{fontSize:12,color:"var(--color-text-muted)",marginBottom:12,lineHeight:1.5},children:"This item must have been successfully processed by these graphs before it becomes eligible."}),N.length>0?n.jsxs("select",{value:"",onChange:Y=>{Y.target.value&&G(Y.target.value)},style:{width:"100%",marginBottom:q.length?10:0},children:[n.jsx("option",{value:"",children:"+ Add required graph…"}),N.filter(Y=>!q.some(T=>T.graphId===Y.graphId)).map(Y=>n.jsxs("option",{value:Y.graphId,children:[Y.name,Y.version?` (${Y.version})`:""]},Y.graphId))]}):n.jsxs("p",{className:"text-dim",style:{fontSize:12,marginBottom:8},children:['No other graphs compatible with "',s,'".']}),q.length>0&&n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:q.map(Y=>n.jsxs("span",{className:"prereq-tag",children:[n.jsx("span",{className:"mono",style:{fontSize:12},children:Y.graphName??Y.graphId}),n.jsx("button",{className:"prereq-tag-remove",onClick:()=>$(Y.graphId),title:"Remove",children:"×"})]},Y.graphId))})]})]}),u?n.jsxs("div",{className:"prereq-section",children:[n.jsxs("div",{className:"prereq-section-header",children:[n.jsx("span",{style:{fontSize:13,fontWeight:600},children:"Cross-entity prerequisites"}),z.length>0&&n.jsx("span",{className:"chip",style:{background:"var(--color-accent-subtle)",borderColor:"var(--color-accent-border)",color:"var(--color-accent)"},children:z.length})]}),n.jsxs("div",{className:"prereq-section-body",children:[n.jsx("p",{style:{fontSize:12,color:"var(--color-text-muted)",marginBottom:12,lineHeight:1.5},children:"Information from a linked entity must have been processed first — e.g. process child records only after their linked parent records have been enriched."}),n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr auto",gap:8,alignItems:"center",marginBottom:10},children:[n.jsxs("select",{value:ee,onChange:Y=>{pe(Y.target.value),ye(""),me("")},children:[n.jsx("option",{value:"",children:"Linked entity…"}),j.map(Y=>n.jsx("option",{value:Y.name,children:Y.label},Y.name))]}),n.jsxs("select",{value:he,onChange:Y=>ye(Y.target.value),disabled:!ee,children:[n.jsx("option",{value:"",children:"Relationship…"}),Z.map(Y=>n.jsx("option",{value:Y.relationKey,children:Y.relationKey},Y.relationKey))]}),n.jsxs("select",{value:Ee,onChange:Y=>me(Y.target.value),disabled:!ee,children:[n.jsx("option",{value:"",children:"Processed by…"}),k.map(Y=>n.jsx("option",{value:Y.graphId,children:Y.name},Y.graphId))]}),n.jsx("button",{type:"button",className:"btn btn-sm",disabled:!ee||!he||!Ee,onClick:ne,children:"Add"})]}),z.length>0&&n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:z.map((Y,T)=>n.jsxs("span",{className:"prereq-tag",style:{justifyContent:"space-between"},children:[n.jsxs("span",{style:{fontSize:12},children:[n.jsx("span",{className:"mono",children:Y.entity}),Y.relationshipKey&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-dim",children:" via "}),n.jsx("span",{className:"mono",children:Y.relationshipKey})]}),n.jsx("span",{className:"text-dim",children:" → processed by "}),n.jsx("span",{className:"mono",children:Y.graphName??Y.graphId})]}),n.jsx("button",{className:"prereq-tag-remove",onClick:()=>je(T),title:"Remove",children:"×"})]},T))})]})]}):n.jsxs("div",{className:"prereq-section",children:[n.jsx("div",{className:"prereq-section-header",children:n.jsx("span",{style:{fontSize:13,fontWeight:600},children:"Cross-entity prerequisites"})}),n.jsx("div",{className:"prereq-section-body",children:n.jsx("p",{style:{fontSize:12,color:"var(--color-text-muted)",margin:0,lineHeight:1.5},children:"Configure context links on the selected graph (or on this work definition) before adding cross-entity prerequisites."})})]})]})}const yC={success:{icon:"✓",color:"var(--status-done)",bg:"var(--status-done-bg)",label:"Success"},partial:{icon:"◐",color:"var(--status-blocked)",bg:"var(--status-blocked-bg)",label:"Partially completed"},failed:{icon:"✕",color:"var(--status-failed)",bg:"var(--status-failed-bg)",label:"Failed"},"created-inactive":{icon:"◌",color:"var(--status-pending)",bg:"var(--status-pending-bg)",label:"Created (inactive)"}},gC={good:"var(--status-done)",warn:"var(--status-blocked)",bad:"var(--status-failed)",default:"var(--color-text)"};function xo({result:a}){const s=yC[a.status];return n.jsxs("div",{className:"card",style:{maxWidth:640,margin:"0 auto",borderColor:s.color},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:4},children:[n.jsx("span",{style:{width:40,height:40,borderRadius:"50%",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:s.bg,color:s.color,fontSize:20,fontWeight:700},children:s.icon}),n.jsxs("div",{children:[n.jsx("div",{style:{fontSize:17,fontWeight:600},children:a.title}),a.summary&&n.jsx("div",{className:"text-muted",style:{fontSize:13},children:a.summary})]})]}),a.stats&&a.stats.length>0&&n.jsx("div",{className:"review-grid",style:{marginTop:16},children:a.stats.map(r=>n.jsxs("div",{className:"review-row",children:[n.jsx("span",{className:"review-label",children:r.label}),n.jsx("span",{style:{color:gC[r.tone??"default"],fontWeight:r.tone&&r.tone!=="default"?600:400},children:String(r.value)})]},r.label))}),a.errors&&a.errors.length>0&&n.jsxs("div",{className:"error-state",style:{marginTop:16,fontSize:12},children:[n.jsxs("strong",{children:[a.errors.length," issue",a.errors.length===1?"":"s",":"]}),n.jsx("ul",{style:{margin:"6px 0 0 18px"},children:a.errors.map((r,c)=>n.jsx("li",{children:r},c))})]}),a.actions&&a.actions.length>0&&n.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap",marginTop:20,paddingTop:16,borderTop:"1px solid var(--color-border)"},children:a.actions.map(r=>r.to?n.jsx(ve,{to:r.to,children:n.jsx("button",{type:"button",className:r.primary?"primary":"",children:r.label})},r.label):n.jsx("button",{type:"button",className:r.primary?"primary":"",children:r.label},r.label))})]})}function Ef({name:a,newRecord:s,onChange:r}){return n.jsxs("div",{className:"writeback-existing",children:[n.jsx("div",{className:"writeback-existing-title",children:"Output row per item"}),n.jsx("p",{className:"hint",style:{marginBottom:10},children:"How results are stored in the output collection for each processed item."}),n.jsxs("div",{className:"writeback-modes",children:[n.jsxs("label",{className:`writeback-mode${s?" selected":""}`,children:[n.jsx("input",{type:"radio",name:a,checked:s,onChange:()=>r(!0)}),n.jsxs("span",{children:[n.jsx("strong",{children:"Add new record"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:"Each successful run appends another row (linked to this item)."})]})]}),n.jsxs("label",{className:`writeback-mode${s?"":" selected"}`,children:[n.jsx("input",{type:"radio",name:a,checked:!s,onChange:()=>r(!1)}),n.jsxs("span",{children:[n.jsx("strong",{children:"Replace existing"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:"One row per item: update it when output already exists, or create it on the first successful run."})]})]})]})]})}const _g={entityId:"same-as-input",contentType:gl,newRecord:!0};function vC(a){if(!a)return"not declared on graph";const s=a.entityId==="same-as-input"?"same as input":a.entityId,r=a.newRecord===!1?"update or create one row per item":"always new record";return`${s} · ${a.contentType} · ${r}`}function hx({enabled:a,value:s,sourceEntity:r,graphPersistency:c,onEnabledChange:u,onChange:f}){const h=s??_g,m=h.entityId==="same-as-input"?"same-as-input":"custom";function p(g){f({...h,...g})}return n.jsxs("div",{className:"persistency-override",children:[n.jsxs("label",{className:"checkbox-row",style:{display:"flex",gap:8,alignItems:"flex-start",marginBottom:12},children:[n.jsx("input",{type:"checkbox",checked:a,onChange:g=>{const v=g.target.checked;u(v),v&&!s&&f({..._g}),v||f(void 0)}}),n.jsxs("span",{children:[n.jsx("strong",{children:"Override result persistence"}),n.jsxs("span",{className:"hint",style:{display:"block",marginTop:4},children:["Graph default: ",vC(c),a?" — work-level settings below merge over the graph at job completion.":" — enable to specify or override where graph results are written."]})]})]}),a&&n.jsxs("div",{className:"form-grid",children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Target object type"}),n.jsxs("select",{value:m,onChange:g=>{g.target.value==="same-as-input"?p({entityId:"same-as-input"}):p({entityId:r??""})},children:[n.jsxs("option",{value:"same-as-input",children:["Same as input",r?` (${r})`:""]}),n.jsx("option",{value:"custom",children:"Other object type…"})]})]}),m==="custom"&&n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Object type name"}),n.jsx("input",{value:h.entityId==="same-as-input"?"":h.entityId,onChange:g=>p({entityId:g.target.value||"same-as-input"}),placeholder:"e.g. vulnerabilities"})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Content type"}),n.jsx("input",{value:h.contentType,onChange:g=>p({contentType:g.target.value||gl}),placeholder:gl})]}),n.jsx("div",{className:"writeback-existing-grid-span",children:n.jsx(Ef,{name:"persistency-existing-record-mode",newRecord:h.newRecord!==!1,onChange:g=>p({newRecord:g})})})]})]})}const al={overview:"Overview",work:"Work",onDemand:"On-Demand",information:"Information",outputs:"Outputs",journal:"Journal",pipelines:"Pipeline analytics",settings:"Settings"},Tf={step2Anchor:"Starting item",maxAttempts:"Max retries",maxAttemptsHint:"How many times to retry the pipeline if it fails."},ll={loadingRelations:"Loading links…",loadFailed:"Failed to load links",noRelations:a=>`No links defined for “${a}” yet. Add relationships in Schema UI, then return here.`,lead:"Toggle which related objects to include. Pick collections on each target, or leave empty for defaults.",preview:"Preview row counts",previewing:"Previewing…",previewTitle:"Preview — context that would load",rows:a=>`${a} row${a===1?"":"s"}`,contentTypes:"Collections to pull",contentTypesHint:"(none selected = default collections)"};function Vf({value:a,appDefault:s,onChange:r,id:c}){const u=a??s;return n.jsxs("div",{className:"field",children:[n.jsx("label",{htmlFor:c,children:Tf.maxAttempts}),n.jsx("input",{id:c,type:"number",min:1,max:20,value:u,onChange:f=>{const h=Number(f.target.value);Number.isFinite(h)&&r(h===s?void 0:Math.min(20,Math.max(1,Math.floor(h))))}}),n.jsxs("span",{className:"hint",children:[Tf.maxAttemptsHint," Only transient infrastructure errors (Mongo connection blips, timeouts) are retried automatically."," ","App default: ",s,". Set 1 to disable automatic retries."]})]})}const xC=[{id:"basic",title:"Basic info",summary:"Name & entity"},{id:"narratives",title:"Narratives",summary:"Select information"},{id:"prereqs",title:"Prerequisites",summary:"Processing rules"},{id:"graph",title:"Graph",summary:"Pipeline to run"},{id:"policy",title:"Execution policy",summary:"Interval & concurrency"},{id:"review",title:"Review",summary:"Create"},{id:"result",title:"Created",summary:"Result"}],jC=[5,15,30,60,240,1440];function bC(){var oe,Se;const{agentQueryParam:a}=zn(),[s,r]=S.useState(0),[c,u]=S.useState(""),[f,h]=S.useState(""),[m,p]=S.useState(""),[g,v]=S.useState(["core"]),[x,N]=S.useState([]),[j,E]=S.useState(""),[C,A]=S.useState(),[O,U]=S.useState([]),[q,z]=S.useState(!1),[K,J]=S.useState(),[G,$]=S.useState({reprocessingMode:"ttl",reprocessingTtl:{value:7,unit:"days"},excludeInFlight:!0,requiredGraphs:[],crossEntityPrerequisites:[]}),[ee,pe]=S.useState({rescanIntervalMinutes:15,priority:100}),[he,ye]=S.useState(null),me=((oe=fe({queryKey:["queue-settings"],queryFn:()=>te.queueSettings()}).data)==null?void 0:oe.continuousJobMaxAttempts)??4,xe=fe({queryKey:["entities",a??"all"],queryFn:()=>te.listEntities(a),retry:2}),k=xe.data??[];S.useEffect(()=>{if(!m||!xe.isSuccess)return;k.map(re=>re.name).includes(m)||p("")},[xe.isSuccess,k,m]);const Z=k.find(se=>se.name===m),ne=Pe({mutationFn:se=>te.createWork({name:c,description:f,entity:m,collection:g[0]??"core",narratives:x,processing:G,graphId:j,contextLinks:O.length?O:void 0,policy:ee,activate:se,...q?{persistency:K}:{}}),onSuccess:({result:se})=>{ye(se),r(6)}}),je=!!(c.trim()&&m),Y=!!j,B=!(((Z==null?void 0:Z.narratives.length)??0)>0)||x.length>0;function W(se){if(se<=s)return r(se);se>=1&&!je||se>=2&&!B||se>=4&&!Y||r(se)}const le=(()=>{var dt,Ut;const se=G.reprocessingMode??"ttl";let re;if(se==="ttl"){const Fe=G.reprocessingTtl??{value:7,unit:"days"};re=`re-run if older than ${Fe.value} ${Fe.unit}`}else re=Gv[se].split(" — ")[0];const et=[re];return(((dt=G.requiredGraphs)==null?void 0:dt.length)??0)>0&&et.push(`${G.requiredGraphs.length} prior graph(s) required`),(((Ut=G.crossEntityPrerequisites)==null?void 0:Ut.length)??0)>0&&et.push(`${G.crossEntityPrerequisites.length} cross-entity prerequisite(s)`),et.join(" · ")})(),X=g.map(se=>{const re=Z==null?void 0:Z.collections.find(et=>et.key===se);return re?fr(re):se}).join(", ");return n.jsxs("div",{children:[n.jsx("div",{className:"page-header",children:n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"New ongoing work"}),n.jsx("span",{className:"page-subtitle",children:"Ongoing work evaluates matching information on a schedule and queues jobs automatically."})]})}),n.jsx(Yf,{steps:xC,current:s,canGoTo:se=>se<=s||se<=5&&je,onGoTo:W,maxWidth:980}),n.jsxs("div",{style:{maxWidth:720},children:[s===0&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"1. Basic info"}),n.jsxs("div",{className:"form-grid",children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Name *"}),n.jsx("input",{value:c,onChange:se=>u(se.target.value),placeholder:"e.g. Process selected records"})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Object type *"}),n.jsx(Ff,{value:m,entities:k,loading:xe.isLoading,error:xe.error,onChange:se=>{var re,et;p(se),N([]),E(""),A(void 0),v([((et=(re=k.find(dt=>dt.name===se))==null?void 0:re.collections[0])==null?void 0:et.key)??"core"])}})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Data sources"}),n.jsx(Pf,{options:(Z==null?void 0:Z.collections)??[],selected:g,onChange:v}),n.jsx("span",{className:"hint",children:"Select which data sources are passed to the graph as input."})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Description"}),n.jsx("textarea",{value:f,onChange:se=>h(se.target.value),placeholder:"Optional — describe what this ongoing work does",rows:3})]})]}),n.jsx(Ct,{onNext:()=>W(1),nextLabel:"Next: narratives",nextDisabled:!je})]}),s===1&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"2. Select information by narratives"}),n.jsx(yo,{entity:m,selected:x,onChange:N}),m&&n.jsx("div",{style:{marginTop:16},children:n.jsx(Xl,{entity:m,collection:g[0]??"core",narratives:x})}),n.jsx(Ct,{onBack:()=>W(0),onNext:()=>W(2),nextLabel:"Next: prerequisites",nextDisabled:!B})]}),s===2&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"3. Processing prerequisites"}),n.jsx("p",{className:"wizard-lead",children:"Control which information is eligible. By default, items processed within the last 7 days are skipped — keeping results fresh without re-running everything on every scan."}),n.jsx(Xf,{context:"recurring",entity:m,targetGraphId:j||void 0,targetJobTypeId:C==null?void 0:C.jobTypeId,hasContextLinks:O.length>0||(((Se=C==null?void 0:C.contextLinks)==null?void 0:Se.length)??0)>0,value:G,onChange:$}),n.jsx(Ct,{onBack:()=>W(1),onNext:()=>W(3),nextLabel:"Next: graph"})]}),s===3&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"4. Choose graph / pipeline"}),n.jsxs("p",{className:"wizard-lead",children:['Only graphs compatible with "',m,'" are shown. This graph is also used for reprocessing checks.']}),n.jsx(go,{entity:m,value:j,onChange:(se,re)=>{var et,dt,Ut,Fe;if(E(se),A(re),(et=re==null?void 0:re.contextLinks)!=null&&et.length&&U(re.contextLinks),(Ut=(dt=re==null?void 0:re.jobPipeline)==null?void 0:dt.reprocessing)!=null&&Ut.mode&&$(ct=>({...ct,reprocessingMode:re.jobPipeline.reprocessing.mode,...re.jobPipeline.reprocessing.ttl?{reprocessingTtl:re.jobPipeline.reprocessing.ttl}:{}})),(Fe=re==null?void 0:re.upstream)!=null&&Fe.length){const ct=re.upstream.filter(ft=>ft.entity&&ft.relationshipKey).map(ft=>({entity:ft.entity,relationshipKey:ft.relationshipKey,graphId:se,graphName:re.name}));ct.length&&$(ft=>({...ft,crossEntityPrerequisites:ct}))}}}),n.jsx("div",{className:"section-title",style:{marginTop:20},children:"Result persistence"}),n.jsx(hx,{enabled:q,value:K,sourceEntity:m,graphPersistency:C==null?void 0:C.persistency,onEnabledChange:z,onChange:J}),n.jsx(Ct,{onBack:()=>W(2),onNext:()=>W(4),nextLabel:"Next: execution policy",nextDisabled:!Y})]}),s===4&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"5. Execution policy"}),n.jsx("p",{className:"wizard-lead",children:"Running jobs are never interrupted — this policy controls how often new eligible information is discovered. How many jobs run in parallel is configured app-wide in Settings."}),n.jsxs("div",{className:"form-grid",children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Re-scan for new eligible information"}),n.jsx("select",{value:ee.rescanIntervalMinutes,onChange:se=>pe({...ee,rescanIntervalMinutes:Number(se.target.value)}),children:jC.map(se=>n.jsx("option",{value:se,children:dr(se)},se))}),n.jsx("span",{className:"hint",children:"Every X minutes, information that has become newly eligible (new or changed data matching your narratives) is discovered and queued. Running jobs are not affected."})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Priority"}),n.jsx("input",{type:"number",value:ee.priority,onChange:se=>pe({...ee,priority:Number(se.target.value)})}),n.jsx("span",{className:"hint",children:"Higher priority jobs are picked up before lower priority ones when the queue is contested."})]}),n.jsx(Vf,{id:"create-work-max-attempts",value:ee.maxAttempts,appDefault:me,onChange:se=>pe({...ee,maxAttempts:se})})]}),n.jsx(Ct,{onBack:()=>W(3),onNext:()=>W(5),nextLabel:"Next: review"})]}),s===5&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"6. Review & create"}),n.jsxs("div",{className:"review-grid",style:{marginBottom:20},children:[n.jsx(ba,{label:"Object type",value:m}),n.jsx(ba,{label:"Data sources",value:X||"—"}),n.jsx(ba,{label:"Narratives (AND)",value:x.join(", ")||"none"}),n.jsx(ba,{label:"Prerequisites",value:le}),n.jsx(ba,{label:"Graph / pipeline",value:(C==null?void 0:C.name)??j}),q&&n.jsx(ba,{label:"Result persistence",value:`${(K==null?void 0:K.entityId)??"same-as-input"} · ${(K==null?void 0:K.contentType)??"inferences"}`}),n.jsx(ba,{label:"Re-scan interval",value:dr(ee.rescanIntervalMinutes)}),n.jsx(ba,{label:"Priority",value:String(ee.priority)}),n.jsx(ba,{label:"Max retries",value:String(ee.maxAttempts??me)})]}),n.jsx("div",{className:"section-title",children:"Estimated matching information"}),n.jsx(Xl,{entity:m,collection:g[0]??"core",narratives:x,processing:G,graphId:j}),ne.isError&&n.jsx(vt,{title:"Failed to create ongoing work",detail:ne.error}),n.jsxs(Ct,{onBack:()=>W(4),children:[n.jsx("button",{type:"button",disabled:ne.isPending,onClick:()=>ne.mutate(!1),children:"Create inactive"}),n.jsx("button",{type:"button",className:"primary",disabled:ne.isPending,onClick:()=>ne.mutate(!0),children:ne.isPending?"Creating…":"Create and activate"})]})]}),s===6&&he&&n.jsx(xo,{result:he})]})]})}function ba({label:a,value:s}){return n.jsxs("div",{className:"review-row",children:[n.jsx("span",{className:"review-label",children:a}),n.jsx("span",{children:s})]})}const SC=[5,15,30,60,240,1440];function NC({work:a,onSaved:s}){var ye,Ee,me,xe;const[r,c]=S.useState(a.name),[u,f]=S.useState(a.description??""),[h,m]=S.useState(a.narratives),[p,g]=S.useState(a.graphId),[v,x]=S.useState(a.processing??{reprocessingMode:"ttl",reprocessingTtl:{value:7,unit:"days"},excludeInFlight:!0,requiredGraphs:[],crossEntityPrerequisites:[]}),[N,j]=S.useState(a.policy),[E,C]=S.useState(a.persistency!==void 0),[A,O]=S.useState(a.persistency),[U,q]=S.useState(!1);S.useEffect(()=>{c(a.name),f(a.description??""),m(a.narratives),g(a.graphId),x(a.processing??{reprocessingMode:"ttl",reprocessingTtl:{value:7,unit:"days"},excludeInFlight:!0,requiredGraphs:[],crossEntityPrerequisites:[]}),j(a.policy),C(a.persistency!==void 0),O(a.persistency),q(!1)},[a]);const K=(((ye=fe({queryKey:["narratives",a.entity],queryFn:()=>te.listNarratives(a.entity)}).data)==null?void 0:ye.length)??0)>0,J=fe({queryKey:["graphs",a.entity],queryFn:()=>te.graphsForEntity(a.entity)}),$=((Ee=fe({queryKey:["queue-settings"],queryFn:()=>te.queueSettings()}).data)==null?void 0:Ee.continuousJobMaxAttempts)??4,ee=(xe=(me=J.data)==null?void 0:me.find(k=>k.graphId===p))==null?void 0:xe.persistency,pe=Pe({mutationFn:()=>te.updateWork(a.id,{name:r.trim(),description:u.trim()||void 0,narratives:h,processing:v,graphId:p,policy:N,persistency:E?A:null}),onSuccess:()=>{q(!0),s()}}),he=!!(r.trim()&&p&&(!K||h.length>0));return n.jsxs("div",{className:"card",style:{maxWidth:720},children:[n.jsx("div",{className:"card-title",children:"Configuration"}),n.jsx("p",{className:"text-muted",style:{fontSize:13,marginBottom:16},children:"Edit selection, prerequisites, graph, and schedule for this ongoing work. Parallel execution is configured app-wide in Settings."}),n.jsxs("div",{className:"form-grid",children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Name"}),n.jsx("input",{value:r,onChange:k=>{c(k.target.value),q(!1)}})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Description"}),n.jsx("textarea",{value:u,onChange:k=>{f(k.target.value),q(!1)},rows:2,placeholder:"Optional"})]})]}),n.jsx("div",{className:"section-title",style:{marginTop:20},children:"Information selection"}),n.jsxs("p",{className:"text-dim",style:{fontSize:12,marginBottom:10},children:["Object type: ",n.jsx("strong",{style:{color:"var(--color-text-muted)"},children:a.entity})," · ","Data source: ",n.jsx("strong",{style:{color:"var(--color-text-muted)"},children:a.collection})]}),n.jsx(yo,{entity:a.entity,selected:h,onChange:k=>{m(k),q(!1)}}),n.jsx("div",{className:"section-title",style:{marginTop:24},children:"Processing prerequisites"}),n.jsx(Xf,{context:"recurring",entity:a.entity,targetGraphId:p||void 0,value:v,onChange:k=>{x(k),q(!1)}}),n.jsx("div",{className:"section-title",style:{marginTop:24},children:"Graph / pipeline"}),n.jsx(go,{entity:a.entity,value:p,onChange:k=>{g(k),q(!1)}}),n.jsx("div",{className:"section-title",style:{marginTop:24},children:"Result persistence"}),n.jsx(hx,{enabled:E,value:A,sourceEntity:a.entity,graphPersistency:ee,onEnabledChange:k=>{C(k),q(!1)},onChange:k=>{O(k),q(!1)}}),n.jsx("div",{className:"section-title",style:{marginTop:24},children:"Execution policy"}),n.jsxs("div",{className:"form-grid",children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Re-scan for new eligible information"}),n.jsx("select",{value:N.rescanIntervalMinutes,onChange:k=>{j({...N,rescanIntervalMinutes:Number(k.target.value)}),q(!1)},children:SC.map(k=>n.jsx("option",{value:k,children:dr(k)},k))})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Priority"}),n.jsx("input",{type:"number",value:N.priority,onChange:k=>{j({...N,priority:Number(k.target.value)}),q(!1)}})]}),n.jsx(Vf,{id:"work-settings-max-attempts",value:N.maxAttempts,appDefault:$,onChange:k=>{j({...N,maxAttempts:k}),q(!1)}})]}),n.jsx("div",{className:"section-title",style:{marginTop:24},children:"Matching preview"}),n.jsx(Xl,{entity:a.entity,collection:a.collection,narratives:h,processing:v,graphId:p}),pe.isError&&n.jsx("div",{style:{marginTop:16},children:n.jsx(vt,{title:"Failed to save",detail:pe.error})}),n.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",marginTop:20},children:[n.jsx("button",{type:"button",className:"primary",disabled:!he||pe.isPending,onClick:()=>pe.mutate(),children:pe.isPending?"Saving…":"Save configuration"}),U&&!pe.isPending&&n.jsx("span",{className:"text-muted",style:{fontSize:13},children:"Saved"})]})]})}const CC=["Overview","Evaluations","Matching Information","Runs","Settings"];function EC(){var A;const{id:a=""}=li(),s=tn(),r=kn(),[c,u]=S.useState("Overview"),[f,h]=S.useState(null),[m,p]=S.useState(!1),g=fe({queryKey:["work",a],queryFn:()=>te.work(a)}),v=g.data,x=fe({queryKey:["work-evals",a],queryFn:()=>te.workEvaluations(a),enabled:!!v}),N=Pe({mutationFn:()=>te.runEvaluation(a),onSuccess:({result:O})=>{h(O),r.invalidateQueries({queryKey:["work",a]}),r.invalidateQueries({queryKey:["work-evals",a]})}}),j=Pe({mutationFn:()=>te.setWorkStatus(a,v.status==="active"?"inactive":"active"),onSuccess:()=>r.invalidateQueries({queryKey:["work",a]})}),E=Pe({mutationFn:()=>te.deleteWork(a),onSuccess:()=>{p(!1),r.invalidateQueries({queryKey:["work"]}),r.invalidateQueries({queryKey:["factory-runs"]}),r.invalidateQueries({queryKey:["run-status-counts"]}),s("/work")}});if(g.isLoading)return n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]});if(g.isError||!v)return n.jsx(vt,{title:"Ongoing work not found",detail:g.error});const C=N.isPending||j.isPending||E.isPending;return n.jsxs("div",{children:[n.jsx(ux,{work:m?v:null,busy:E.isPending,onClose:()=>p(!1),onConfirm:()=>E.mutate()}),n.jsxs("div",{className:"breadcrumb",children:[n.jsx(ve,{to:"/work",children:"Work"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),v.name]}),n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[n.jsx("h1",{className:"page-title",children:v.name}),n.jsx(_t,{status:v.status})]}),n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx("button",{disabled:C,onClick:()=>N.mutate(),children:"Run evaluation now"}),n.jsx("button",{disabled:C,onClick:()=>j.mutate(),children:v.status==="active"?"Deactivate":"Activate"}),n.jsx("button",{disabled:C,onClick:()=>p(!0),style:{color:"var(--status-cancelled)"},children:"Delete"})]})]}),f&&n.jsx("div",{style:{marginBottom:16},children:n.jsx(xo,{result:f})}),n.jsx("div",{className:"tabs",children:CC.map(O=>n.jsx("button",{className:`tab${c===O?" active":""}`,onClick:()=>u(O),children:O},O))}),c==="Overview"&&n.jsxs("div",{className:"detail-grid",children:[n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Configuration"}),n.jsx(En,{k:"Entity",v:`${v.entity} · ${v.collection}`}),n.jsx(En,{k:"Narratives",v:v.narratives.join(", ")||"none"}),n.jsx(En,{k:"Processing rule",v:(A=v.processing)!=null&&A.overrideDuplicatePrevention?"reprocess (override)":"skip already processed / queued / running"}),n.jsx(En,{k:"Graph",v:v.graphName??v.graphId}),n.jsx(En,{k:"Description",v:v.description??"—"})]}),n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Schedule & results"}),n.jsx(En,{k:"Re-scan interval",v:dr(v.policy.rescanIntervalMinutes)}),n.jsx(En,{k:"Last scanned",v:`${Xn(v.lastEvaluatedAt)} (${Mt(v.lastEvaluatedAt)})`}),n.jsx(En,{k:"Next scan",v:v.status==="active"?Xn(v.nextEvaluationAt):"paused (inactive)"}),n.jsx(En,{k:"Jobs created",v:String(v.jobsCreated)}),n.jsx(En,{k:"Estimated matching",v:String(v.estimatedMatching??"—")}),n.jsx(En,{k:"Priority",v:String(v.policy.priority)}),n.jsx(En,{k:"Max retries",v:String(v.policy.maxAttempts??"app default")})]})]}),c==="Evaluations"&&n.jsx(TC,{id:a,evalsQuery:x}),c==="Matching Information"&&n.jsx(Xl,{entity:v.entity,collection:v.collection,narratives:v.narratives,processing:v.processing,graphId:v.graphId}),c==="Runs"&&n.jsx(wC,{workId:a}),c==="Settings"&&n.jsx(NC,{work:v,onSaved:()=>r.invalidateQueries({queryKey:["work",a]})})]})}function TC({evalsQuery:a}){const s=a.data??[];return a.isLoading?n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}):s.length===0?n.jsx(It,{title:"No evaluations yet",message:"When this work is active (or you run an evaluation now), each cycle is recorded here with what it matched, created, and excluded."}):n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:s.map(r=>n.jsxs("div",{className:"card",children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[n.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[n.jsx(_t,{status:r.status}),n.jsx("span",{className:"text-muted",style:{fontSize:12},children:Mt(r.at)})]}),n.jsxs("span",{className:"text-dim",style:{fontSize:12},children:[r.durationMs," ms"]})]}),r.error&&n.jsx("div",{className:"error-state",style:{fontSize:12,marginBottom:8},children:r.error}),r.zeroReason&&n.jsxs("div",{className:"text-muted",style:{fontSize:12,marginBottom:8},children:["Zero jobs: ",r.zeroReason]}),n.jsxs("div",{style:{display:"flex",gap:24,fontSize:13},children:[n.jsxs("span",{children:[n.jsx("strong",{children:r.matched})," ",n.jsx("span",{className:"text-muted",children:"matched"})]}),n.jsxs("span",{children:[n.jsx("strong",{style:{color:"var(--status-done)"},children:r.created})," ",n.jsx("span",{className:"text-muted",children:"created"})]}),n.jsxs("span",{children:[n.jsx("strong",{style:{color:"var(--status-blocked)"},children:r.excluded})," ",n.jsx("span",{className:"text-muted",children:"excluded"})]})]}),r.exclusionReasons.length>0&&n.jsx("div",{style:{marginTop:10},children:n.jsx(vo,{included:r.created,excluded:r.exclusionReasons,includedLabel:"Jobs created"})})]},r.id))})}function wC({workId:a}){var h;const s=ho(["work-runs",a],{workId:a}),r=S.useMemo(()=>{var m;return((m=s.data)==null?void 0:m.pages.flatMap(p=>p.runs))??[]},[s.data]),c=Sr((h=s.data)==null?void 0:h.pages),u=r.length<c,f=S.useCallback(()=>{u&&!s.isFetchingNextPage&&s.fetchNextPage()},[u,s]);return s.isLoading?n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}):r.length===0?n.jsx(It,{title:"No runs yet",message:"Jobs created by this ongoing work will appear here."}):n.jsxs("div",{className:"table-wrap",children:[n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Status"}),n.jsx("th",{children:"Item"}),n.jsx("th",{children:"Graph"}),n.jsx("th",{children:"Updated"})]})}),n.jsx("tbody",{children:r.map(m=>n.jsxs("tr",{onClick:()=>{window.location.href=`/journal/${m.id}`},children:[n.jsx("td",{children:n.jsx(_t,{status:m.status})}),n.jsx("td",{className:"mono",style:{fontSize:12},children:m.recordLabel??m.recordId}),n.jsx("td",{className:"text-muted",style:{fontSize:12},children:m.graphName??m.graphId}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:Xn(m.updatedAt)})]},m.id))})]}),n.jsx(br,{loaded:r.length,total:c,hasMore:u,isFetchingNextPage:s.isFetchingNextPage,onLoadMore:f})]})}function En({k:a,v:s}){return n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:a}),n.jsx("span",{className:"detail-val",style:{fontFamily:"inherit"},children:s})]})}function RC(){const a=tn(),s=fe({queryKey:["batches"],queryFn:()=>te.listBatches()}),r=(s.data??[]).slice().sort((c,u)=>new Date(u.createdAt).getTime()-new Date(c.createdAt).getTime()).slice(0,12);return n.jsxs("div",{children:[n.jsx("div",{className:"page-header",children:n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"On-Demand"}),n.jsx("span",{className:"page-subtitle",children:"Run processing now — pick a single item or a batch selected by narratives."})]})}),n.jsxs("div",{className:"mode-cards",children:[n.jsxs("button",{type:"button",className:"mode-card",onClick:()=>a("/on-demand/single"),children:[n.jsx("div",{className:"mode-card-icon",children:"▶"}),n.jsxs("div",{children:[n.jsx("div",{className:"mode-card-title",children:"Single item"}),n.jsx("div",{className:"mode-card-desc",children:"Run a graph on one item you select manually or at random. Optionally include context."})]}),n.jsx("div",{className:"mode-card-arrow",children:"→"})]}),n.jsxs("button",{type:"button",className:"mode-card",onClick:()=>a("/on-demand/batch"),children:[n.jsx("div",{className:"mode-card-icon",children:"⊞"}),n.jsxs("div",{children:[n.jsx("div",{className:"mode-card-title",children:"Batch"}),n.jsx("div",{className:"mode-card-desc",children:"Run a graph on multiple items that match selected narratives. One job per matching item."})]}),n.jsx("div",{className:"mode-card-arrow",children:"→"})]})]}),s.isLoading&&n.jsxs("div",{className:"loading-row",style:{marginTop:24},children:[n.jsx("span",{className:"spinner"})," Loading recent batches…"]}),r.length>0&&n.jsxs("div",{className:"section",style:{marginTop:32},children:[n.jsx("div",{className:"section-title",children:"Recent batches"}),n.jsx("div",{className:"table-wrap",children:n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Name"}),n.jsx("th",{children:"Status"}),n.jsx("th",{children:"Progress"}),n.jsx("th",{children:"Failed"}),n.jsx("th",{children:"Created"})]})}),n.jsx("tbody",{children:r.map(c=>n.jsxs("tr",{children:[n.jsx("td",{children:n.jsx(ve,{to:`/on-demand/batch/${c.id}`,children:c.name})}),n.jsx("td",{children:n.jsx(_t,{status:c.status})}),n.jsxs("td",{className:"text-muted",style:{fontSize:12},children:[c.counts.done,"/",c.counts.total," done",c.counts.running>0?` · ${c.counts.running} running`:"",c.counts.pending>0?` · ${c.counts.pending} pending`:""]}),n.jsx("td",{style:{color:c.counts.failed>0?"var(--status-failed)":void 0},children:c.counts.failed>0?n.jsx(ve,{to:`/on-demand/batch/${c.id}`,children:c.counts.failed}):"0"}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:Xn(c.createdAt)})]},c.id))})]})})]})]})}const AC=new Set(["core","snapshots"]);function wf(a){return AC.has(a)}function mx({node:a,prefix:s,selected:r,onToggle:c}){var v,x,N;const u=s?`${s}.${a.path}`:a.path,f=((v=a.children)==null?void 0:v.map(j=>`${u}.${j.path}`))??[],h=f.length===0||f.every(j=>r.has(j)),m=!((x=a.children)!=null&&x.length),p=m?r.has(u):h;function g(j){if(m)c(u,j.target.checked);else{const E=px(a,s);for(const C of E)c(C,j.target.checked)}}return n.jsxs("div",{style:{paddingLeft:s?16:0},children:[n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13,paddingBottom:2},children:[n.jsx("input",{type:"checkbox",checked:p,onChange:g}),n.jsx("span",{className:"mono",style:{color:"var(--color-text)"},children:a.path}),a.inferredType&&n.jsx("span",{style:{color:"var(--color-text-dim)",fontSize:11},children:a.inferredType})]}),(N=a.children)==null?void 0:N.map(j=>n.jsx(mx,{node:j,prefix:u,selected:r,onToggle:c},j.path))]})}function px(a,s){var c;const r=s?`${s}.${a.path}`:a.path;return(c=a.children)!=null&&c.length?a.children.flatMap(u=>px(u,r)):[r]}function OC({order:a,onChange:s}){function r(c,u){const f=[...a],h=c+u;h<0||h>=f.length||([f[c],f[h]]=[f[h],f[c]],s(f))}return n.jsxs("div",{style:{marginBottom:12},children:[n.jsx("label",{style:{display:"block",marginBottom:4,fontSize:12,color:"var(--color-text-dim)"},children:"Merge priority (top wins on key collision)"}),a.map((c,u)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[n.jsxs("span",{style:{fontSize:11,color:"var(--color-text-dim)",width:16,textAlign:"right"},children:[u+1,"."]}),n.jsx("span",{className:"mono",style:{fontSize:13,flex:1},children:c}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",disabled:u===0,onClick:()=>r(u,-1),children:"↑"}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",disabled:u===a.length-1,onClick:()=>r(u,1),children:"↓"})]},c))]})}function MC({objectType:a,contentTypeKey:s,target:r,selectedPaths:c,onPathsChange:u}){var C,A;const f=fe({queryKey:["assembler-props",a,s,r],queryFn:()=>te.assemblerProperties({objectType:a,contentType:s,target:r}),staleTime:6e4}),h=((C=f.data)==null?void 0:C.flatPaths)??[],m=((A=f.data)==null?void 0:A.properties)??[],p=new Set(c??h);function g(O,U){const q=new Set(p);U?q.add(O):q.delete(O);const z=h.filter(K=>q.has(K));u(z.length===h.length?void 0:z)}function v(){u(void 0)}function x(){u([])}const N=c===void 0?h.length:c.length,j=wf(s)?"1:1":"1:n",E={fontSize:10,padding:"1px 5px",borderRadius:3,background:wf(s)?"var(--color-accent-dim, #1a3a5c)":"var(--color-bg-3, #2a2a2a)",color:"var(--color-text-dim)",marginLeft:6};return n.jsxs("div",{style:{border:"1px solid var(--color-border)",borderRadius:6,marginBottom:12,overflow:"hidden"},children:[n.jsxs("div",{style:{padding:"8px 12px",background:"var(--color-bg-2)",display:"flex",alignItems:"center",gap:8},children:[n.jsx("span",{className:"mono",style:{fontWeight:600,fontSize:13},children:s}),n.jsx("span",{style:E,children:j}),n.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--color-text-dim)"},children:f.isLoading?"Loading…":`${N} / ${h.length} properties`}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",onClick:v,children:"All"}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",onClick:x,children:"None"})]}),!f.isLoading&&m.length===0&&n.jsx("div",{style:{padding:"10px 12px",fontSize:12,color:"var(--color-text-dim)"},children:"No properties sampled (collection may be empty)."}),m.length>0&&n.jsx("div",{style:{padding:"10px 12px",maxHeight:240,overflowY:"auto"},children:m.map(O=>n.jsx(mx,{node:O,prefix:"",selected:p,onToggle:g},O.path))})]})}function yx({objectType:a,target:s,collections:r,value:c,onChange:u}){const f=r.filter(wf),h=r.map(v=>{const x=c==null?void 0:c.contentTypes.find(N=>N.key===v);return{key:v,selectedProperties:x==null?void 0:x.selectedProperties}}),m=(()=>{const v=(c==null?void 0:c.priority)??[],x=f,N=x.filter(j=>!v.includes(j));return[...v.filter(j=>x.includes(j)),...N]})();function p(v,x){const N=h.map(j=>j.key===v?{key:v,selectedProperties:x}:j);u({objectType:a,target:s,contentTypes:N,priority:m})}function g(v){u({objectType:a,target:s,contentTypes:h,priority:v})}return n.jsxs("div",{children:[f.length>1&&n.jsx(OC,{order:m,onChange:g}),r.map(v=>{var x;return n.jsx(MC,{objectType:a,contentTypeKey:v,target:s,selectedPaths:(x=h.find(N=>N.key===v))==null?void 0:x.selectedProperties,onPathsChange:N=>p(v,N)},v)})]})}const hr={entityId:"same-as-input",contentType:gl,newRecord:!0};function kC(a=!0){return{...hr,newRecord:a}}function ro(a){if(!a)return"not declared on graph";const s=a.entityId==="same-as-input"?"same as input":a.entityId,r=a.newRecord===!1?"update or create one row per item":"add new record each run";return`${s} · ${a.contentType} · ${r}`}function gx(a,s=!0){return`Same object type · ${a?`${a}-${gl}`:`${gl} collection`} · ${s?"new record per run":"one row per item (update or create)"}`}function vx(a,s,r,c,u=!0){if(a==="simulation")return{label:"Simulation",detail:"Graph runs normally; results are not written to Memorix.",simulation:!0};if(a==="same-entity-inferences")return{label:"Write results",detail:gx(c,u),simulation:!1};if(a==="custom")return{label:"Write results",detail:ro(r??hr),simulation:!1};if(!s)return{label:"Simulation",detail:"Graph has no result persistence — choose Inferences or Custom to write results.",simulation:!0};const f=u!==(s.newRecord!==!1)?{...s,newRecord:u}:s;return{label:"Write results",detail:`Graph default: ${ro(f)}`,simulation:!1}}function xx(a,s){return s?"Simulation — the source item is not marked as processed when the run completes.":`On success, marks "${a}" as processed on this item (visible on the item's Processing tab).`}function jx(a,s,r){const c=u=>(r==null?void 0:r.newRecord)===void 0?u:{...u,newRecord:r.newRecord};if(a==="simulation")return null;if(a==="same-entity-inferences")return c(kC((r==null?void 0:r.newRecord)!==!1));if(a==="custom")return s??hr;if(r!=null&&r.graphPersistency)return c(r.graphPersistency)}function bx({mode:a,customValue:s,newRecord:r,sourceEntity:c,graphPersistency:u,onModeChange:f,onCustomChange:h,onNewRecordChange:m}){const p=s??hr,g=p.entityId==="same-as-input"?"same-as-input":"custom";function v(x){h({...p,...x})}return n.jsxs("div",{className:"result-writeback",children:[n.jsx("div",{className:"section-title",children:"Result writeback"}),n.jsx("p",{className:"hint",style:{marginBottom:12},children:"Choose whether this run persists graph output to Memorix or runs as a simulation only."}),n.jsxs("div",{className:"writeback-modes",children:[n.jsxs("label",{className:`writeback-mode${a==="simulation"?" selected":""}`,children:[n.jsx("input",{type:"radio",name:"writeback-mode",checked:a==="simulation",onChange:()=>f("simulation")}),n.jsxs("span",{children:[n.jsx("strong",{children:"Simulation"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:"Run the graph without writing results."})]})]}),n.jsxs("label",{className:`writeback-mode${a==="same-entity-inferences"?" selected":""}`,children:[n.jsx("input",{type:"radio",name:"writeback-mode",checked:a==="same-entity-inferences",onChange:()=>f("same-entity-inferences")}),n.jsxs("span",{children:[n.jsx("strong",{children:"Save to Inferences"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:gx(c,r)})]})]}),u&&n.jsxs("label",{className:`writeback-mode${a==="graph-default"?" selected":""}`,children:[n.jsx("input",{type:"radio",name:"writeback-mode",checked:a==="graph-default",onChange:()=>f("graph-default")}),n.jsxs("span",{children:[n.jsx("strong",{children:"Use graph default"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:ro(u)})]})]}),n.jsxs("label",{className:`writeback-mode${a==="custom"?" selected":""}`,children:[n.jsx("input",{type:"radio",name:"writeback-mode",checked:a==="custom",onChange:()=>{f("custom"),s||h({...hr})}}),n.jsxs("span",{children:[n.jsx("strong",{children:"Custom destination"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:"Override object type or content type."})]})]})]}),a!=="simulation"&&a!=="custom"&&n.jsx(Ef,{name:"existing-record-mode",newRecord:r,onChange:m}),a==="custom"&&n.jsxs("div",{className:"form-grid",style:{marginTop:12},children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Target object type"}),n.jsxs("select",{value:g,onChange:x=>{x.target.value==="same-as-input"?v({entityId:"same-as-input"}):v({entityId:c??""})},children:[n.jsxs("option",{value:"same-as-input",children:["Same as input",c?` (${c})`:""]}),n.jsx("option",{value:"custom",children:"Other object type…"})]})]}),g==="custom"&&n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Object type name"}),n.jsx("input",{value:p.entityId==="same-as-input"?"":p.entityId,onChange:x=>v({entityId:x.target.value||"same-as-input"}),placeholder:"e.g. vulnerabilities"})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Content type"}),n.jsx("input",{value:p.contentType,onChange:x=>v({contentType:x.target.value||gl}),placeholder:gl})]}),n.jsx("div",{className:"writeback-existing-grid-span",children:n.jsx(Ef,{name:"custom-existing-record-mode",newRecord:p.newRecord!==!1,onChange:x=>v({newRecord:x})})})]})]})}function zC(a){const s=a.find(r=>r.key==="snapshots"||r.role==="snapshot");return s==null?void 0:s.key}function Wc(a){const s=zC(a);return s?[s]:[]}function DC(a){return a[0]}const Sx=[{id:"record",title:"Choose item",summary:"What to process"},{id:"related",title:"Context",summary:"Optional linked data"},{id:"graph",title:"Choose graph",summary:"Pipeline to run"},{id:"writeback",title:"Result writeback",summary:"Where to save"},{id:"properties",title:"Properties",summary:"Data to include"},{id:"review",title:"Review & run",summary:"Confirm"},{id:"result",title:"Done",summary:"Result"}],Vd=Sx.length-1,tr=3,Jd=4,Ug=5;function qC(){var tt;const{agentQueryParam:a}=zn(),[s]=si(),[r,c]=S.useState(0),[u,f]=S.useState(""),[h,m]=S.useState([]),[p,g]=S.useState([]),[v,x]=S.useState(!1),[N,j]=S.useState(""),[E,C]=S.useState(""),[A,O]=S.useState(),[U,q]=S.useState(100),[z,K]=S.useState(),[J,G]=S.useState("simulation"),[$,ee]=S.useState(),[pe,he]=S.useState(!0),[ye,Ee]=S.useState(null);S.useEffect(()=>{var Me;const ae=(Me=s.get("entity"))==null?void 0:Me.trim();ae&&f(P=>P||ae)},[s]),S.useEffect(()=>{A&&!A.persistency&&J==="graph-default"&&G("same-entity-inferences")},[A,J]);const me=fe({queryKey:["entities",a??"all"],queryFn:()=>te.listEntities(a),retry:2}),xe=me.data??[];S.useEffect(()=>{if(!u||!me.isSuccess)return;xe.map(Me=>Me.name).includes(u)||f("")},[me.isSuccess,xe,u]);const k=xe.find(ae=>ae.name===u),Z=(k==null?void 0:k.target)==="event"?"event":"entity",ne=S.useCallback(()=>{c(0),Ee(null),j(""),C(""),O(void 0),K(void 0),G("simulation"),ee(void 0),m(k?Wc(k.collections):[])},[k]);S.useEffect(()=>{k&&m(ae=>ae.length>0?ae:Wc(k.collections))},[k]);const je=DC(h),Y=fe({queryKey:["core-records",u,h,p],queryFn:()=>te.coreRecords({entity:u,collection:je,narratives:p,pageSize:100}),enabled:!!(u&&je)}),T=((tt=Y.data)==null?void 0:tt.records)??[],B=T.find(ae=>ae.id===N);function W(ae){m(ae),j(""),K(void 0)}function le(ae){g(ae),j("")}function X(){T.length&&j(T[Math.floor(Math.random()*T.length)].id)}function oe(){if(z)return z;const ae=h.filter(Me=>Me==="core"||Me==="snapshots");return{objectType:u,target:Z,contentTypes:h.map(Me=>({key:Me})),priority:ae}}function Se(){const ae=jx(J,$,{newRecord:pe,graphPersistency:A==null?void 0:A.persistency});return{entity:u,collection:je,recordId:N,graphId:E,priority:U,assemblySelection:oe(),...ae!==void 0?{persistency:ae}:{}}}const se=Pe({mutationFn:()=>te.queueSingle(Se()),onSuccess:({result:ae,run:Me})=>{Ee({...ae,actions:[{label:"View in journal",to:`/journal/${Me.id}`,primary:!0}]}),c(Vd)}}),re=Pe({mutationFn:async()=>{const{run:ae}=await te.queueSingle(Se()),{run:Me}=await te.executeRun(ae.id,!0);return Me},onSuccess:ae=>{var P;const Me=ae.status==="failed"?"failed":ae.status==="done"?"success":"partial";Ee({status:Me,title:ae.status==="failed"?"Job failed":ae.status==="done"?"Job completed":"Job started",summary:((P=ae.error)==null?void 0:P.message)??`Status: ${ae.status}`,stats:[{label:"Run ID",value:ae.id},{label:"Graph",value:ae.graphName??ae.graphId},{label:"Status",value:ae.status,tone:ae.status==="failed"?"bad":ae.status==="done"?"good":"default"}],errors:ae.error?[ae.error.message]:void 0,actions:[{label:"View in journal",to:`/journal/${ae.id}`,primary:!0}]}),c(Vd)}}),et=se.error??re.error,dt=!!(u&&N&&h.length>0),Ut=!!E;function Fe(ae){if(ae<=r)return c(ae);ae>=1&&!dt||ae>=tr&&!Ut||c(ae)}const ct=(k==null?void 0:k.collections)??[],ft=h.map(ae=>{const Me=ct.find(P=>P.key===ae);return Me?fr(Me):ae}).join(", "),Dn=z?(z.contentTypes.reduce((ae,Me)=>{var P;return ae+(((P=Me.selectedProperties)==null?void 0:P.length)??999)},0),`${z.contentTypes.length} content type${z.contentTypes.length!==1?"s":""} selected`):"All properties (default)",Vn=vx(J,A==null?void 0:A.persistency,$,u,pe),Jn=xx((A==null?void 0:A.name)??E,Vn.simulation);return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx("a",{href:"/on-demand",children:"On-Demand"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),"Single item"]}),n.jsx("div",{className:"page-header",children:n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"On-Demand: single item"}),n.jsx("span",{className:"page-subtitle",children:"Process one item through a graph."})]})}),n.jsx(Yf,{steps:Sx,current:r,canGoTo:ae=>ae<=r,onGoTo:Fe,maxWidth:980}),n.jsxs("div",{style:{maxWidth:720},children:[r===0&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"1. Choose item"}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Object type"}),n.jsx(Ff,{value:u,entities:xe,loading:me.isLoading,error:me.error,onChange:ae=>{const Me=xe.find(P=>P.name===ae);f(ae),m(Wc((Me==null?void 0:Me.collections)??[])),g([]),x(!1),j(""),C(""),O(void 0),K(void 0),G("simulation"),ee(void 0)}})]}),u&&n.jsxs("div",{className:"field",style:{marginBottom:12},children:[n.jsx("label",{children:"Data sources"}),n.jsx(Pf,{options:ct,selected:h,onChange:W}),h.length===0&&n.jsx("span",{className:"hint",style:{color:"var(--status-blocked)",display:"block",marginTop:6},children:"Select at least one data source. Snapshots is selected automatically when available."}),n.jsx("span",{className:"hint",children:"Select which content types are merged and sent to the graph."})]}),u&&n.jsxs("div",{className:"field",style:{marginBottom:12},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:4},children:[n.jsxs("label",{style:{marginBottom:0},children:["Narratives",n.jsx("span",{style:{fontWeight:400,color:"var(--color-text-dim)",marginLeft:6},children:"— optional filter"})]}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",onClick:()=>x(ae=>!ae),children:v?"Hide":p.length>0?`${p.length} active ▾`:"Filter ▾"})]}),p.length>0&&!v&&n.jsx("div",{className:"chip-row",style:{marginBottom:6},children:p.map(ae=>{const Me=k==null?void 0:k.narratives.find(P=>P.key===ae);return n.jsx("span",{className:"chip narrative",children:(Me==null?void 0:Me.label)??ae},ae)})}),v&&n.jsx("div",{style:{marginTop:8},children:n.jsx(yo,{entity:u,selected:p,onChange:le,requireSelection:!1})})]}),u&&n.jsxs("div",{className:"field",style:{marginBottom:12},children:[n.jsx("label",{children:"Item *"}),n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsxs("select",{value:N,onChange:ae=>j(ae.target.value),style:{flex:1},children:[n.jsx("option",{value:"",children:Y.isLoading?"Loading…":T.length?"Select an item…":"No information"}),T.map(ae=>n.jsxs("option",{value:ae.id,children:[ae.label," (",ae.id,")"]},ae.id))]}),n.jsx("button",{type:"button",onClick:X,disabled:!T.length,children:"Random"})]}),n.jsxs("span",{className:"hint",children:[T.length," items loaded",p.length>0?` (filtered by ${p.length} narrative${p.length>1?"s":""})`:""," · ",n.jsx("a",{href:`/information?entity=${u}`,children:"Browse all information"})]})]}),n.jsx(Ct,{onNext:()=>Fe(1),nextLabel:"Next: context",nextDisabled:!dt})]}),r===1&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"2. Context (optional)"}),B&&n.jsxs("div",{className:"memorix-panel",children:[n.jsx("div",{className:"memorix-panel-title",children:"Starting item"}),n.jsxs("span",{className:"mono",children:[u," / ",ft," / ",B.label]})]}),n.jsx("div",{className:"empty-state",style:{padding:24},children:"Context is not applicable — there are no relations linked to related entities. You can skip this step and continue."}),n.jsx(Ct,{onBack:()=>Fe(0),onNext:()=>Fe(2),nextLabel:"Skip — no context"})]}),r===2&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"3. Choose graph"}),n.jsx(go,{entity:u,value:E,onChange:(ae,Me)=>{C(ae),O(Me)}}),n.jsx(Ct,{onBack:()=>Fe(1),onNext:()=>Fe(tr),nextLabel:"Next: result writeback",nextDisabled:!Ut})]}),r===tr&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"4. Result writeback"}),A&&n.jsxs("div",{className:"memorix-panel",style:{marginBottom:12},children:[n.jsx("div",{className:"memorix-panel-title",children:"Selected graph"}),n.jsx("span",{className:"mono",children:A.name??E})]}),n.jsx(bx,{mode:J,customValue:$,newRecord:pe,sourceEntity:u,graphPersistency:A==null?void 0:A.persistency,onModeChange:G,onCustomChange:ee,onNewRecordChange:he}),n.jsx(Ct,{onBack:()=>Fe(2),onNext:()=>Fe(Jd),nextLabel:"Next: properties"})]}),r===Jd&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"5. Properties to include"}),n.jsxs("div",{style:{marginBottom:12,color:"var(--color-text-dim)",fontSize:13},children:["Choose which properties are sent to the graph as input. Only domain data is sent — system fields are always excluded.",n.jsxs("ul",{style:{margin:"8px 0 0 16px",lineHeight:1.8,fontSize:12},children:[n.jsxs("li",{children:[n.jsx("strong",{children:"1:1 types"})," (core, snapshots): one record per item, merged at the root. Higher priority wins on duplicate keys."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"1:n types"}),": all matching records, placed as an array under the content-type name."]})]})]}),u&&h.length>0&&n.jsx(yx,{objectType:u,target:Z,collections:h,value:z,onChange:K}),n.jsx(Ct,{onBack:()=>Fe(tr),onNext:()=>Fe(Ug),nextLabel:"Next: review"})]}),r===Ug&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"6. Review & run"}),n.jsxs("div",{className:"review-grid",style:{marginBottom:16},children:[n.jsx(qs,{label:"Object type",value:u}),n.jsx(qs,{label:"Data sources",value:ft}),n.jsx(qs,{label:"Properties",value:Dn}),n.jsx(qs,{label:"Item",value:(B==null?void 0:B.label)??N}),n.jsx(qs,{label:"Graph",value:(A==null?void 0:A.name)??E}),n.jsxs("div",{className:"review-row",children:[n.jsx("span",{className:"review-label",children:"Result writeback"}),n.jsxs("div",{className:"writeback-summary",children:[n.jsx("span",{className:`writeback-badge ${Vn.simulation?"simulation":"write"}`,children:Vn.label}),n.jsx("span",{className:"mono",style:{fontSize:12},children:Vn.detail}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",style:{marginLeft:8},onClick:()=>Fe(tr),children:"Change"})]})]}),n.jsx(qs,{label:"Source item tracking",value:Jn})]}),n.jsx("div",{className:"form-grid",children:n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Queue priority"}),n.jsx("input",{type:"number",value:U,onChange:ae=>q(Number(ae.target.value))}),n.jsx("span",{className:"hint",children:"Used when sending to the queue. Higher priority is picked up first when the queue is contested."})]})}),n.jsx("p",{className:"text-muted",style:{fontSize:13,marginBottom:12},children:"Send to queue to run in the background at the priority above, or execute now to run immediately in this session."}),et&&n.jsx(vt,{title:"Failed to start job",detail:et}),n.jsxs(Ct,{onBack:()=>Fe(Jd),children:[n.jsx("button",{type:"button",className:"primary",disabled:se.isPending||re.isPending,onClick:()=>se.mutate(),children:se.isPending?"Sending to queue…":"Send to queue"}),n.jsx("button",{type:"button",disabled:se.isPending||re.isPending,onClick:()=>re.mutate(),children:re.isPending?"Executing…":"Execute now"})]})]}),r===Vd&&ye&&n.jsxs(n.Fragment,{children:[n.jsx(xo,{result:ye}),n.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:16},children:n.jsx("button",{type:"button",className:"primary",onClick:ne,children:"Run another item"})})]})]})]})}function qs({label:a,value:s}){return n.jsxs("div",{className:"review-row",children:[n.jsx("span",{className:"review-label",children:a}),n.jsx("span",{className:"mono",style:{fontSize:12},children:s})]})}function _l(a){return`${a.relationKey}::${a.targetEntity}`}function BC(a,s){return s!=null&&s.length?s.filter(r=>a.some(c=>c.relationKey===r.relationKey&&c.targetEntity===r.targetEntity)):[]}function LC({entity:a,graphContextLinks:s,value:r,onChange:c,previewRecordId:u,anchorLabel:f}){var j,E;const h=fe({queryKey:["entity-relations",a],queryFn:()=>te.entityRelations(a),enabled:!!a}),m=S.useMemo(()=>(h.data??[]).filter(C=>C.sourceEntity===a),[h.data,a]),p=S.useMemo(()=>BC(m,s),[m,s]);S.useEffect(()=>{r!==void 0||p.length===0||c(p)},[r,p,c]);const g=r??p,v=new Set(g.map(_l)),x=Pe({mutationFn:()=>te.previewContext({sourceEntity:a,input:{recordId:u},contextLinks:g})});function N(C,A){const O=r??p;if(A){const q=p.find(K=>K.relationKey===C.relationKey&&K.targetEntity===C.targetEntity),z=[...O.filter(K=>_l(K)!==_l(C)),q??{relationKey:C.relationKey,targetEntity:C.targetEntity}];c(z);return}const U=O.filter(q=>_l(q)!==_l(C));c(U.length?U:[])}return h.isLoading?n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," ",ll.loadingRelations]}):h.isError?n.jsx("div",{className:"empty-state",style:{padding:24},children:ll.loadFailed}):m.length===0?n.jsxs("div",{className:"empty-state",style:{padding:24},children:[ll.noRelations(a),n.jsx("div",{style:{marginTop:8,fontSize:13,color:"var(--color-text-dim)"},children:"You can skip this step and continue."})]}):n.jsxs("div",{children:[f&&n.jsxs("div",{className:"memorix-panel",style:{marginBottom:12},children:[n.jsx("div",{className:"memorix-panel-title",children:Tf.step2Anchor}),n.jsx("span",{className:"mono",children:f})]}),n.jsx("p",{className:"wizard-lead",style:{marginBottom:12},children:ll.lead}),n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:m.map(C=>{var U;const A=v.has(_l(C)),O=p.find(q=>q.relationKey===C.relationKey&&q.targetEntity===C.targetEntity);return n.jsxs("label",{className:"memorix-panel",style:{display:"flex",gap:10,alignItems:"flex-start",cursor:"pointer",margin:0},children:[n.jsx("input",{type:"checkbox",checked:A,onChange:q=>N(C,q.target.checked),style:{marginTop:3}}),n.jsxs("div",{children:[n.jsx("div",{style:{fontSize:13,fontWeight:500},children:C.relationKey}),n.jsxs("div",{className:"text-dim",style:{fontSize:12},children:["→ ",C.targetEntity,(U=O==null?void 0:O.contentTypes)!=null&&U.length?` · ${O.contentTypes.join(", ")}`:""]})]})]},_l(C))})}),u&&g.length>0&&n.jsxs("div",{style:{marginTop:16},children:[n.jsx("button",{type:"button",disabled:x.isPending,onClick:()=>x.mutate(),children:x.isPending?ll.previewing:ll.preview}),((E=(j=x.data)==null?void 0:j.jobMemory)==null?void 0:E.context)&&n.jsxs("div",{style:{marginTop:12},children:[n.jsx("div",{className:"memorix-panel-title",style:{marginBottom:8},children:ll.previewTitle}),x.data.jobMemory.context.map(C=>n.jsx("div",{className:"memorix-panel",style:{marginBottom:8},children:n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,fontSize:13},children:[n.jsx("span",{className:"mono",children:C.alias}),n.jsx("span",{className:"text-dim",children:ll.rows(C.rows.length)})]})},C.alias)),n.jsx(Lt,{label:"Context payload",value:x.data.jobMemory})]}),x.isError&&n.jsx("p",{className:"text-dim",style:{fontSize:12,marginTop:8},children:"Preview failed for the sample item — context will still resolve per item at run time."})]})]})}function _C({value:a,jobTypeId:s,onChange:r}){const c=a.blockWhenRunning!==!1,u=a.replaceQueuedRuns!==!1;function f(h){r({...a,...h})}return n.jsxs("div",{className:"prereq-section",style:{marginTop:16},children:[n.jsxs("div",{className:"prereq-section-header",children:[n.jsx("span",{style:{fontSize:13,fontWeight:600},children:"Queue overlap"}),s&&n.jsx("span",{className:"mono text-dim",style:{fontSize:11},children:s})]}),n.jsxs("div",{className:"prereq-section-body",style:{display:"flex",flexDirection:"column",gap:10},children:[n.jsxs("p",{style:{fontSize:12,color:"var(--color-text-muted)",margin:0,lineHeight:1.5},children:["Scoped per ",n.jsx("strong",{children:"job type"})," and ",n.jsx("strong",{children:"source item"}),". Cancelled and failed runs never block a new batch."]}),n.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:8,fontSize:13,cursor:"pointer"},children:[n.jsx("input",{type:"checkbox",checked:c,onChange:h=>f({blockWhenRunning:h.target.checked}),style:{marginTop:3}}),n.jsxs("span",{children:[n.jsx("strong",{children:"Skip items currently running"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:"Default on — do not start a second concurrent run for the same item and job type."})]})]}),n.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:8,fontSize:13,cursor:"pointer"},children:[n.jsx("input",{type:"checkbox",checked:u,onChange:h=>f({replaceQueuedRuns:h.target.checked}),style:{marginTop:3}}),n.jsxs("span",{children:[n.jsx("strong",{children:"Replace queued runs from older batches"}),n.jsx("span",{className:"hint",style:{display:"block",marginTop:4},children:"Default on — cancel pending/blocked runs for this job type and enqueue fresh jobs with this batch's definition. When off, items that already have a queued run are excluded instead."})]})]})]})]})}const UC={priority:100,blockWhenRunning:!0,replaceQueuedRuns:!0};function Nx({batch:a}){const s=a.selectionSummary;if(!s)return null;const r=a.excluded.reduce((u,f)=>u+f.count,0),c=[`${s.matched} matched → ${s.queued} queued`];if(r>0){const u=a.excluded.filter(f=>f.count>0).map(f=>`${f.count} ${Kv[f.reason]??f.reason}`).join(", ");c.push(`${r} skipped (${u})`)}return a.counts.failed>0&&c.push(`${a.counts.failed} failed`),n.jsx("p",{className:"text-muted",style:{fontSize:13,margin:"0 0 16px"},children:c.join(" · ")})}const Cx=[{id:"entity",title:"Entity",summary:"Object type & sources"},{id:"narratives",title:"Narratives",summary:"Filter items"},{id:"graph",title:"Choose graph",summary:"Pipeline to run"},{id:"writeback",title:"Result writeback",summary:"Where to save"},{id:"processing",title:"Processing",summary:"Eligibility rules"},{id:"context",title:"Context",summary:"Optional linked data"},{id:"properties",title:"Properties",summary:"Data to include"},{id:"review",title:"Review & queue",summary:"Confirm batch"},{id:"result",title:"Queued",summary:"Result"}],Qg=Cx.length-1,Zd=2,nr=3,Fc=4,Wd=5,ef=6,ar=7;function QC(){var Zn,vl,xl,Nr,ii,Cr,Er,ka;const{agentQueryParam:a}=zn(),[s]=si(),[r,c]=S.useState(0),[u,f]=S.useState(s.get("entity")??""),[h,m]=S.useState(["core"]),[p,g]=S.useState([]),[v,x]=S.useState(""),[N,j]=S.useState(),[E,C]=S.useState(),[A,O]=S.useState(),[U,q]=S.useState({reprocessingMode:"skip",excludeInFlight:!0}),[z,K]=S.useState(""),[J,G]=S.useState({...UC}),[$,ee]=S.useState("simulation"),[pe,he]=S.useState(),[ye,Ee]=S.useState(!0),[me,xe]=S.useState(null),[k,Z]=S.useState(null),ne=fe({queryKey:["entities",a??"all"],queryFn:()=>te.listEntities(a),retry:2}),Y=((Zn=fe({queryKey:["queue-settings"],queryFn:()=>te.queueSettings()}).data)==null?void 0:Zn.batchJobMaxAttempts)??4,T=ne.data??[];S.useEffect(()=>{if(!u||!ne.isSuccess)return;T.map(ke=>ke.name).includes(u)||f("")},[ne.isSuccess,T,u]);const B=T.find(ce=>ce.name===u),W=(B==null?void 0:B.target)==="event"?"event":"entity";function le(){return jx($,pe,{newRecord:ye,graphPersistency:N==null?void 0:N.persistency})}const X=le(),oe=fe({queryKey:["matching",u,h,p,U,v,X,J,"count"],queryFn:()=>te.previewMatching({entity:u,collection:h[0]??"core",narratives:p,processing:U,graphId:v,persistency:X,blockWhenRunning:J.blockWhenRunning,replaceQueuedRuns:J.replaceQueuedRuns}),enabled:!!(u&&v)}),Se=((vl=oe.data)==null?void 0:vl.eligible)??0,se=r===ar&&!!u&&Se>=50,re=fe({queryKey:["factory-preflight",u,h[0],Se],queryFn:()=>te.factoryPreflight({entity:u,collection:h[0]??"core",eligibleCount:Se}),enabled:se}),et=se&&re.data!=null&&!re.data.ok,dt=se&&re.isLoading,Ut=(Nr=(xl=oe.data)==null?void 0:xl.sample[0])==null?void 0:Nr.id;S.useEffect(()=>{N&&!N.persistency&&$==="graph-default"&&ee("same-entity-inferences")},[N,$]);function Fe(){if(A)return A;const ce=h.filter(ke=>ke==="core"||ke==="snapshots");return{objectType:u,target:W,contentTypes:h.map(ke=>({key:ke})),priority:ce}}function ct(){var ce;return E!==void 0?E.length?E:void 0:(ce=N==null?void 0:N.contextLinks)!=null&&ce.length?N.contextLinks:void 0}const ft=Pe({mutationFn:()=>{var ke;const ce=le();return te.queueBatch({name:z||`${u} batch`,entity:u,collections:h,narratives:p,processing:U,graphId:v,policy:J,assemblySelection:Fe(),...(ke=ct())!=null&&ke.length?{contextLinks:ct()}:{},...ce!==void 0?{persistency:ce}:{}})},onSuccess:({result:ce,batch:ke})=>{xe(ce),Z(ke),c(Qg)}}),Dn=!!v,Jn=!(((B==null?void 0:B.narratives.length)??0)>0)||p.length>0;function tt(ce){if(ce<=r)return c(ce);ce>=1&&!u||ce>=2&&!Jn||ce>=nr&&!Dn||ce>=Fc&&!Dn||c(ce)}const ae=(B==null?void 0:B.collections)??[],Me=h.map(ce=>{const ke=ae.find(xt=>xt.key===ce);return ke?fr(ke):ce}).join(", "),P=A?`${A.contentTypes.length} content type${A.contentTypes.length!==1?"s":""} selected`:"All properties (default)",Xe=vx($,N==null?void 0:N.persistency,pe,u,ye),Ke=xx((N==null?void 0:N.name)??v,Xe.simulation),$n=(()=>{const ce=ct();return ce!=null&&ce.length?ce.map(ke=>`${ke.relationKey} → ${ke.targetEntity}`).join(", "):"None"})();return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx("a",{href:"/on-demand",children:"On-Demand"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),"Batch"]}),n.jsx("div",{className:"page-header",children:n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"On-Demand: batch"}),n.jsx("span",{className:"page-subtitle",children:"Run one graph on many items that match your selected narratives."})]})}),n.jsx(Yf,{steps:Cx,current:r,canGoTo:ce=>ce<=r,onGoTo:tt,maxWidth:980,scrollable:!0}),n.jsxs("div",{style:{maxWidth:720},children:[r===0&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"1. Choose entity"}),n.jsx("div",{className:"form-grid",children:n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Object type"}),n.jsx(Ff,{value:u,entities:T,loading:ne.isLoading,error:ne.error,onChange:ce=>{const ke=T.find(xt=>xt.name===ce);f(ce),m(Wc((ke==null?void 0:ke.collections)??[])),g([]),x(""),j(void 0),C(void 0),O(void 0),ee("simulation"),he(void 0)}})]})}),B&&n.jsxs("div",{className:"field",style:{marginTop:12},children:[n.jsx("label",{children:"Data sources"}),n.jsx(Pf,{options:B.collections,selected:h,onChange:ce=>{m(ce),O(void 0)}}),n.jsx("span",{className:"hint",children:"Select which content types are merged and sent to the graph for every item in the batch."})]}),B&&n.jsxs("p",{className:"text-dim",style:{fontSize:12},children:[B.coreCount," core information · ",B.narratives.length," narratives · ",B.graphs.length," compatible graphs"]}),n.jsx(Ct,{onNext:()=>tt(1),nextLabel:"Next: narratives",nextDisabled:!u})]}),r===1&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"2. Select narratives"}),n.jsx(yo,{entity:u,selected:p,onChange:g}),n.jsx("div",{style:{marginTop:16},children:n.jsx(Xl,{entity:u,collection:h[0]??"core",narratives:p})}),n.jsx(Ct,{onBack:()=>tt(0),onNext:()=>tt(Zd),nextLabel:"Next: choose graph",nextDisabled:!Jn})]}),r===Zd&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"3. Choose graph"}),n.jsx("p",{className:"wizard-lead",children:"The graph determines which processing stamps and queue entries apply when predicting job counts."}),n.jsx(go,{entity:u,value:v,onChange:(ce,ke)=>{var xt;if(x(ce),j(ke),C(void 0),ee("simulation"),he(void 0),(xt=ke==null?void 0:ke.upstream)!=null&&xt.length){const Tr=ke.upstream.filter(Wn=>Wn.entity&&Wn.relationshipKey).map(Wn=>({entity:Wn.entity,relationshipKey:Wn.relationshipKey,graphId:ce,graphName:ke.name}));Tr.length&&q(Wn=>({...Wn,crossEntityPrerequisites:Tr}))}}}),n.jsx(Ct,{onBack:()=>tt(1),onNext:()=>tt(nr),nextLabel:"Next: result writeback",nextDisabled:!Dn})]}),r===nr&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"4. Result writeback"}),n.jsx("p",{className:"wizard-lead",children:'Where graph output is saved. "Skip already processed" on the next step only applies to this target — not prior simulation runs or a different collection.'}),N&&n.jsxs("div",{className:"memorix-panel",style:{marginBottom:12},children:[n.jsx("div",{className:"memorix-panel-title",children:"Selected graph"}),n.jsx("span",{className:"mono",children:N.name??v})]}),n.jsx(bx,{mode:$,customValue:pe,newRecord:ye,sourceEntity:u,graphPersistency:N==null?void 0:N.persistency,onModeChange:ee,onCustomChange:he,onNewRecordChange:Ee}),n.jsx(Ct,{onBack:()=>tt(Zd),onNext:()=>tt(Fc),nextLabel:"Next: processing"})]}),r===Fc&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"5. Processing prerequisites"}),n.jsx("p",{className:"wizard-lead",children:'Control which information is eligible. "Skip already processed" checks whether a result already exists in your chosen writeback target above — not whether the graph ran in simulation or wrote elsewhere.'}),n.jsx(Xf,{context:"batch",entity:u,targetGraphId:v||void 0,targetJobTypeId:N==null?void 0:N.jobTypeId,hasContextLinks:((E==null?void 0:E.length)??0)>0||(((ii=N==null?void 0:N.contextLinks)==null?void 0:ii.length)??0)>0,value:U,onChange:q}),n.jsx(_C,{value:J,jobTypeId:N==null?void 0:N.jobTypeId,onChange:G}),n.jsxs("div",{style:{marginTop:20},children:[n.jsx("div",{className:"memorix-panel-title",style:{marginBottom:8},children:"Estimated jobs"}),n.jsx(Xl,{entity:u,collection:h[0]??"core",narratives:p,processing:U,graphId:v,persistency:X,queuePolicy:J,headline:!0,requireGraph:!0})]}),n.jsx(Ct,{onBack:()=>tt(nr),onNext:()=>tt(Wd),nextLabel:"Next: context"})]}),r===Wd&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"6. Context (optional)"}),n.jsx("p",{className:"wizard-lead",style:{marginBottom:12},children:"Linked information is resolved separately for each item in the batch, using the same context configuration."}),n.jsxs("div",{className:"memorix-panel",style:{marginBottom:12},children:[n.jsx("div",{className:"memorix-panel-title",children:"Batch scope"}),n.jsxs("span",{className:"mono",children:[u," · ",Me]})]}),n.jsx(LC,{entity:u,graphContextLinks:N==null?void 0:N.contextLinks,value:E,onChange:C,previewRecordId:Ut}),n.jsx(Ct,{onBack:()=>tt(Fc),onNext:()=>tt(ef),nextLabel:(Cr=ct())!=null&&Cr.length?"Next: properties":"Skip — no context"})]}),r===ef&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"7. Properties to include"}),n.jsxs("div",{style:{marginBottom:12,color:"var(--color-text-dim)",fontSize:13},children:["Choose which properties are sent to the graph as input for every item in the batch. Only domain data is sent — system fields are always excluded.",n.jsxs("ul",{style:{margin:"8px 0 0 16px",lineHeight:1.8,fontSize:12},children:[n.jsxs("li",{children:[n.jsx("strong",{children:"1:1 types"})," (core, snapshots): one record per item, merged at the root. Higher priority wins on duplicate keys."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"1:n types"}),": all matching records, placed as an array under the content-type name."]})]})]}),u&&h.length>0&&n.jsx(yx,{objectType:u,target:W,collections:h,value:A,onChange:O}),n.jsx(Ct,{onBack:()=>tt(Wd),onNext:()=>tt(ar),nextLabel:"Next: review & queue"})]}),r===ar&&n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"8. Review & queue"}),n.jsxs("div",{className:"review-grid",style:{marginBottom:16},children:[n.jsx(Bs,{label:"Object type",value:u}),n.jsx(Bs,{label:"Data sources",value:Me}),n.jsx(Bs,{label:"Context",value:$n}),n.jsx(Bs,{label:"Properties",value:P}),n.jsx(Bs,{label:"Graph",value:(N==null?void 0:N.name)??v}),n.jsxs("div",{className:"review-row",children:[n.jsx("span",{className:"review-label",children:"Result writeback"}),n.jsxs("div",{className:"writeback-summary",children:[n.jsx("span",{className:`writeback-badge ${Xe.simulation?"simulation":"write"}`,children:Xe.label}),n.jsx("span",{className:"mono",style:{fontSize:12},children:Xe.detail}),n.jsx("button",{type:"button",className:"btn-ghost btn-xs",style:{marginLeft:8},onClick:()=>tt(nr),children:"Change"})]})]}),n.jsx(Bs,{label:"Source item tracking",value:Ke})]}),n.jsx(Xl,{entity:u,collection:h[0]??"core",narratives:p,processing:U,graphId:v,persistency:X,queuePolicy:J,headline:!0}),n.jsxs("div",{className:"form-grid",style:{marginTop:16},children:[n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Batch name"}),n.jsx("input",{value:z,onChange:ce=>K(ce.target.value),placeholder:`${u} batch`})]}),n.jsxs("div",{className:"field",children:[n.jsx("label",{children:"Queue priority"}),n.jsx("input",{type:"number",value:J.priority,onChange:ce=>G({...J,priority:Number(ce.target.value)})}),n.jsx("span",{className:"hint",children:"Higher priority is picked up first when the queue is contested. Parallel execution is configured app-wide in Settings."})]}),n.jsx(Vf,{id:"batch-max-attempts",value:J.maxAttempts,appDefault:Y,onChange:ce=>G({...J,maxAttempts:ce})})]}),r===ar&&re.data&&!re.data.ok&&n.jsxs("div",{className:"run-io-warning",style:{marginTop:16},children:["Preflight found blocking issues — resolve before queueing a large batch.",n.jsx("ul",{style:{margin:"8px 0 0 16px",fontSize:13},children:re.data.checks.filter(ce=>ce.status==="fail").map(ce=>n.jsx("li",{children:ce.message},ce.name))})]}),r===ar&&((Er=re.data)==null?void 0:Er.checks.some(ce=>ce.status==="warn"))&&n.jsxs("div",{className:"memorix-panel",style:{marginTop:16,fontSize:13},children:["Preflight warnings:",n.jsx("ul",{style:{margin:"8px 0 0 16px"},children:re.data.checks.filter(ce=>ce.status==="warn").map(ce=>n.jsx("li",{children:ce.message},ce.name))})]}),dt&&n.jsxs("div",{className:"loading-row",style:{marginTop:16},children:[n.jsx("span",{className:"spinner"})," Running preflight checks…"]}),ft.isError&&n.jsx(vt,{title:"Failed to queue batch",detail:ft.error}),n.jsx(Ct,{onBack:()=>tt(ef),children:n.jsx("button",{type:"button",className:"primary",disabled:ft.isPending||et||dt,title:et?"Resolve preflight failures before queueing":void 0,onClick:()=>ft.mutate(),children:ft.isPending?"Queueing…":"Queue batch"})})]}),r===Qg&&me&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[n.jsx(xo,{result:me}),k&&n.jsx(Nx,{batch:k}),k&&(k.excluded.length>0||k.selectionSummary&&k.selectionSummary.queued!==k.selectionSummary.matched)&&n.jsx("div",{style:{maxWidth:640,margin:"0 auto",width:"100%"},children:n.jsx(vo,{included:((ka=k.selectionSummary)==null?void 0:ka.queued)??k.counts.total,excluded:k.excluded,includedLabel:"Jobs queued"})})]})]})]})}function Bs({label:a,value:s}){return n.jsxs("div",{className:"review-row",children:[n.jsx("span",{className:"review-label",children:a}),n.jsx("span",{className:"mono",style:{fontSize:12},children:s})]})}function $C(){var O,U,q,z,K,J;const{id:a=""}=li(),s=tn(),r=kn(),c=fe({queryKey:["batch",a],queryFn:()=>te.batch(a)}),u=ho(["batch-runs",a],{batchId:a}),f=fe({queryKey:["queue-settings"],queryFn:()=>te.queueSettings()}),h=fe({queryKey:["batch-failure-breakdown",a],queryFn:()=>te.batchFailureBreakdown(a),enabled:(((O=c.data)==null?void 0:O.counts.failed)??0)>0}),m=c.data,p=S.useMemo(()=>{var G;return((G=u.data)==null?void 0:G.pages.flatMap($=>$.runs))??[]},[u.data]),g=Sr((U=u.data)==null?void 0:U.pages),v=p.length<g,x=S.useCallback(()=>{v&&!u.isFetchingNextPage&&u.fetchNextPage()},[v,u]),N=Pe({mutationFn:()=>te.retryAllFactoryRuns({batchId:a,confirm:!0}),onSuccess:G=>{r.invalidateQueries({queryKey:["batch",a]}),r.invalidateQueries({queryKey:["batch-runs",a]}),r.invalidateQueries({queryKey:["batch-failure-breakdown",a]}),r.invalidateQueries({queryKey:["factory-runs"]});const $=G.failed.length>0?` ${G.failed.length} could not be retried.`:"";window.alert(`Retried ${G.retried.length} of ${G.matched} failed run(s).${$}`)}}),j=Pe({mutationFn:()=>te.recoverBatch(a,{confirm:!0,resumeQueue:!0}),onSuccess:G=>{r.invalidateQueries({queryKey:["batch",a]}),r.invalidateQueries({queryKey:["batch-runs",a]}),r.invalidateQueries({queryKey:["batch-failure-breakdown",a]}),r.invalidateQueries({queryKey:["factory-runs"]}),r.invalidateQueries({queryKey:["queue-settings"]});const $=G.queueResumed?" Queue resumed.":"";window.alert(`Recovered batch: retried ${G.retry.retried.length} of ${G.retry.matched} failed run(s).${$} Ensure the queue worker is running.`)}}),E=S.useCallback(()=>{var ee;if(!m)return;const $=((ee=f.data)==null?void 0:ee.queueMode)==="paused"?`Resume the queue and retry ${m.counts.failed} failed run(s) in "${m.name}"?`:`Retry ${m.counts.failed} failed run(s) and refresh batch recovery state for "${m.name}"?`;window.confirm($)&&j.mutate()},[m,j,(q=f.data)==null?void 0:q.queueMode]);if(c.isLoading)return n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]});if(c.isError||!m)return n.jsx(vt,{title:"Batch not found",detail:c.error});const C=m.counts,A=m.persistency===null?"Simulation (no writeback)":m.persistency?ro(m.persistency):"Graph default";return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(ve,{to:"/on-demand",children:"On-Demand"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),m.name]}),n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[n.jsx("h1",{className:"page-title",children:m.name}),n.jsx(_t,{status:m.status})]}),n.jsxs("span",{className:"text-dim",style:{fontSize:12},children:["created ",Xn(m.createdAt)]})]}),n.jsx(Nx,{batch:m}),C.failed>0&&((z=f.data)==null?void 0:z.queueMode)==="paused"&&n.jsxs("div",{className:"run-io-warning",style:{marginBottom:16},children:["Queue is ",n.jsx("strong",{children:"paused"}),". Failed runs will not execute until you resume. Use ",n.jsx("strong",{children:"Recover batch"})," to resume the queue and retry all failed runs."]}),n.jsx("div",{className:"status-cards",style:{gridTemplateColumns:"repeat(6, 1fr)"},children:[["Total",C.total],["Pending",C.pending],["Running",C.running],["Done",C.done],["Failed",C.failed],["Cancelled",C.cancelled]].map(([G,$])=>n.jsxs("div",{className:"status-card",style:{cursor:"default"},children:[n.jsx("div",{className:"status-card-label",children:G}),n.jsx("div",{className:"status-card-count",children:$})]},G))}),C.failed>0&&h.isLoading&&n.jsxs("div",{className:"loading-row",style:{marginBottom:16},children:[n.jsx("span",{className:"spinner"})," Loading failure breakdown…"]}),C.failed>0&&((K=h.data)!=null&&K.breakdown.length)?n.jsxs("div",{className:"card",style:{marginBottom:16},children:[n.jsx("div",{className:"card-title",children:"Failure breakdown"}),n.jsx("ul",{style:{margin:0,paddingLeft:18,fontSize:13},children:h.data.breakdown.map(G=>n.jsxs("li",{style:{marginBottom:6},children:[G.count," × ",G.label,G.sampleRunIds.length>0&&n.jsxs("span",{className:"text-muted",children:[" ","— sample:"," ",G.sampleRunIds.map(($,ee)=>n.jsxs("span",{children:[ee>0?", ":"",n.jsxs(ve,{to:`/journal/${$}`,className:"mono",style:{fontSize:12},children:[$.slice(0,8),"…"]})]},$))]})]},G.category))})]}):null,n.jsxs("div",{className:"detail-grid",children:[n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Selection summary"}),m.selectionSummary&&n.jsxs(n.Fragment,{children:[n.jsx(un,{k:"Total in collection",v:String(m.selectionSummary.totalInCollection)}),n.jsx(un,{k:"Matched filters",v:String(m.selectionSummary.matched)}),n.jsx(un,{k:"Eligible to queue",v:String(m.selectionSummary.eligible)}),n.jsx(un,{k:"Records evaluated",v:String(m.selectionSummary.scanned)}),n.jsx(un,{k:"Jobs queued",v:String(m.selectionSummary.queued)})]}),n.jsx(un,{k:"Entity",v:`${m.entity} · ${m.collection}`}),n.jsx(un,{k:"Narratives",v:m.narratives.join(", ")||"none"}),n.jsx(un,{k:"Reprocessing",v:(J=m.processing)!=null&&J.reprocessingMode&&m.processing.reprocessingMode!=="skip"?m.processing.reprocessingMode:"skip (default)"}),n.jsx(un,{k:"Graph",v:m.graphName??m.graphId}),n.jsx(un,{k:"Result writeback",v:A}),n.jsx(un,{k:"Priority",v:String(m.policy.priority)}),n.jsx(un,{k:"Max retries",v:String(m.policy.maxAttempts??"app default")}),n.jsx(un,{k:"Created",v:Mt(m.createdAt)})]}),n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Excluded information"}),m.excluded.length?n.jsx(vo,{included:C.total,excluded:m.excluded,includedLabel:"Queued"}):n.jsx("p",{className:"text-muted",style:{fontSize:13},children:"No information was excluded."})]})]}),n.jsxs("div",{className:"section",children:[n.jsxs("div",{className:"section-title",style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},children:[n.jsx("span",{children:"Runs"}),C.failed>0&&n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx("button",{type:"button",className:"primary",disabled:j.isPending||N.isPending,onClick:E,children:j.isPending?"Recovering…":`Recover batch (${C.failed} failed)`}),n.jsx("button",{type:"button",disabled:N.isPending||j.isPending,onClick:()=>{window.confirm(`Retry ${C.failed} failed run(s) without changing queue settings?`)&&N.mutate()},children:N.isPending?"Retrying…":"Retry failed only"})]})]}),N.isError&&n.jsxs("div",{className:"error-state",style:{marginBottom:12},children:["Bulk retry failed: ",String(N.error)]}),j.isError&&n.jsxs("div",{className:"error-state",style:{marginBottom:12},children:["Batch recover failed: ",String(j.error)]}),u.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}),!u.isLoading&&p.length===0&&n.jsx(It,{title:"No runs for this batch yet"}),p.length>0&&n.jsxs("div",{className:"table-wrap",children:[n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Status"}),n.jsx("th",{children:"Item"}),n.jsx("th",{children:"Graph"}),n.jsx("th",{children:"Attempts"}),n.jsx("th",{children:"Updated"})]})}),n.jsx("tbody",{children:p.map(G=>n.jsxs("tr",{onClick:()=>s(`/journal/${G.id}`),style:{cursor:"pointer"},children:[n.jsx("td",{children:n.jsx(_t,{status:G.status})}),n.jsx("td",{className:"mono",style:{fontSize:12},children:G.recordLabel??G.recordId}),n.jsx("td",{className:"text-muted",style:{fontSize:12},children:G.graphName??G.graphId}),n.jsxs("td",{className:"mono",children:[G.attempts,"/",G.maxAttempts]}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:Xn(G.updatedAt)})]},G.id))})]}),n.jsx(br,{loaded:p.length,total:g,hasMore:v,isFetchingNextPage:u.isFetchingNextPage,onLoadMore:x})]})]})]})}function un({k:a,v:s}){return n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:a}),n.jsx("span",{className:"detail-val",style:{fontFamily:"inherit"},children:s})]})}function HC(a){const s=Object.values(a.processing.graphs);if(s.length===0)return"not processed";const r=s.filter(u=>u.lastStatus==="succeeded").length,c=s.filter(u=>u.lastStatus==="failed").length;return`${r} done${c?`, ${c} failed`:""}`}function KC(a){const s=a.role==="processing-output"?` (output · ${a.count})`:a.key==="core"?` (${a.count})`:` · ${a.count}`;return a.role==="processing-output"?`${a.key}${s}`:`${a.key}${a.key!=="core"?s:` (${a.count})`}`}function $g(){var T,B,W,le;const a=tn(),s=mn(),r=kn(),{agentQueryParam:c,agentId:u}=zn(),[f,h]=si(),m=f.get("view")==="outputs"||s.pathname==="/outputs",p=f.get("entity")??"",g=f.get("collection")??"",v=f.get("graphId")??"",x=f.get("processing")??"",N=(f.get("narratives")??"").split(",").filter(Boolean),[j,E]=S.useState("");function C(X){const oe=new URLSearchParams(f);for(const[Se,se]of Object.entries(X))se?oe.set(Se,se):oe.delete(Se);h(oe)}const A=fe({queryKey:["entities",c??"all"],queryFn:()=>te.listEntities(c)}),O=A.data??[],U=O.find(X=>X.name===p),q=S.useMemo(()=>((U==null?void 0:U.collections)??[]).filter(X=>X.role==="processing-output"),[U]),z=m?((T=q.find(X=>X.key===g))==null?void 0:T.key)??((B=q[0])==null?void 0:B.key)??"":g||"core",K=U==null?void 0:U.collections.find(X=>X.key===z),J=(K==null?void 0:K.role)==="processing-output",G=q.length>0,$=!!(p&&z&&(!m||J));S.useEffect(()=>{if(!(!m||!U)){if(!G){g&&C({collection:void 0});return}q.some(X=>X.key===g)||C({collection:q[0].key})}},[m,U,G,q,g,p]);const ee=fe({queryKey:["narratives",p],queryFn:()=>te.listNarratives(p),enabled:!!p&&!m}),pe=fe({queryKey:["graphs",p],queryFn:()=>te.graphsForEntity(p),enabled:!!p&&!m}),he=S.useMemo(()=>({entity:p,collection:z,narratives:N.length?N:void 0,processingGraphId:v||void 0,processingCondition:x||void 0}),[p,z,N,v,x]),ye=KN(["core-records",p,z,N,v,x],he,{enabled:$}),Ee=S.useMemo(()=>{var X;return((X=ye.data)==null?void 0:X.pages.flatMap(oe=>oe.records))??[]},[ye.data]),me=Sr((W=ye.data)==null?void 0:W.pages),xe=Ee.length<me,k=S.useCallback(()=>{xe&&!ye.isFetchingNextPage&&ye.fetchNextPage()},[xe,ye]),Z=Pe({mutationFn:()=>te.clearCoreRecords({entity:p,collection:z,confirm:!0}),onSuccess:()=>{E(""),r.invalidateQueries({queryKey:["core-records"]}),A.refetch()}});function ne(X){const oe=N.includes(X)?N.filter(Se=>Se!==X):[...N,X];C({narratives:oe.join(",")||void 0})}const je=S.useMemo(()=>{const X=Ee[0];if(!X)return[];const oe=new Set(["recordId","entityId","eventId","knowledgeId","displayName","data","_memorix"]);return Object.keys(X.fields).filter(Se=>!oe.has(Se)&&!Se.startsWith("_")).filter(Se=>{const se=X.fields[Se];return se===null||["string","number","boolean"].includes(typeof se)}).slice(0,3)},[Ee]),Y=m?q:(U==null?void 0:U.collections)??[{key:"core",role:"core",count:0}];return n.jsxs("div",{children:[n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:m?"Outputs":"Information"}),n.jsxs("span",{className:"page-subtitle",children:[u?n.jsxs(n.Fragment,{children:["Object types in agent scope ",n.jsx("span",{className:"mono",children:u}),". · "]}):null,m?"Browse graph output containers and inspect saved results.":"Browse processed items, their narratives, and processing state."]})]}),p&&!m&&n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx(ve,{to:`/on-demand/single?entity=${p}`,children:n.jsx("button",{children:"Run on-demand"})}),n.jsx(ve,{to:`/on-demand/batch?entity=${p}`,children:n.jsx("button",{className:"primary",children:"Create batch from filter"})})]}),p&&J&&n.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[n.jsx("input",{type:"text",placeholder:`type ${p}-${z} to confirm`,value:j,onChange:X=>E(X.target.value),style:{width:220,fontSize:12}}),n.jsx("button",{disabled:Z.isPending||j!==`${p}-${z}`,style:{color:"var(--status-failed)"},onClick:()=>{window.confirm(`Delete all records in ${p}-${z}? This cannot be undone.`)&&Z.mutate()},children:Z.isPending?"Clearing…":"Clear collection"})]})]}),n.jsxs("div",{className:"filters",children:[n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Entity"}),n.jsxs("select",{value:p,onChange:X=>C({entity:X.target.value||void 0,collection:void 0,narratives:void 0,graphId:void 0,processing:void 0}),children:[n.jsx("option",{value:"",children:"— select —"}),O.map(X=>n.jsx("option",{value:X.name,children:X.label},X.name))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:m?"Output collection":"Collection type"}),n.jsx("select",{value:z,onChange:X=>C({collection:X.target.value}),disabled:!U||m&&!G,children:Y.length===0?n.jsx("option",{value:"",children:"— none —"}):Y.map(X=>n.jsx("option",{value:X.key,children:KC(X)},X.key))})]}),!m&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"filter-divider"}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"Processed by"}),n.jsxs("select",{value:v,onChange:X=>C({graphId:X.target.value||void 0,processing:void 0}),disabled:!p,children:[n.jsx("option",{value:"",children:"any graph"}),(pe.data??[]).map(X=>n.jsx("option",{value:X.graphId,children:X.name},X.graphId))]})]}),n.jsxs("div",{className:"filter-group",children:[n.jsx("label",{children:"with status"}),n.jsxs("select",{value:x,onChange:X=>C({processing:X.target.value||void 0}),disabled:!v,title:v?void 0:"Select a graph first",children:[n.jsx("option",{value:"",children:"any status"}),n.jsx("option",{value:"succeeded",children:"succeeded"}),n.jsx("option",{value:"failed",children:"failed"}),n.jsx("option",{value:"running",children:"running"}),n.jsx("option",{value:"queued",children:"queued"}),n.jsx("option",{value:"not-processed",children:"not processed"}),n.jsx("option",{value:"unknown",children:"unknown"})]})]})]})]}),p&&!m&&(((le=ee.data)==null?void 0:le.length)??0)>0&&n.jsx("div",{className:"chip-row",style:{marginBottom:16},children:(ee.data??[]).map(X=>n.jsx("span",{className:`chip selectable${N.includes(X.key)?" selected":""}`,onClick:()=>ne(X.key),title:X.description,children:X.label},X.key))}),!p&&n.jsx(It,{title:"Select an entity",message:m?"Choose an entity to browse its output collections.":"Choose an entity to browse its items, narratives, and processing state.",icon:"◇"}),p&&m&&U&&!G&&n.jsx(It,{title:"No output collections",message:"This entity has no graph output containers yet. Run a graph with result writeback to populate an output collection."}),p&&$&&ye.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}),p&&$&&ye.isError&&n.jsx(vt,{title:"Failed to load records",detail:ye.error,onRetry:()=>ye.refetch()}),p&&$&&!ye.isLoading&&!ye.isError&&Ee.length===0&&n.jsx(It,{title:"No matching items",message:m?"This output collection is empty.":"No items match the current filters. Try removing a narrative or changing the processing filter."}),Ee.length>0&&n.jsxs("div",{className:"table-wrap",children:[n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"ID"}),n.jsx("th",{children:"Label"}),je.map(X=>n.jsx("th",{children:X},X)),!m&&n.jsx("th",{children:"Narratives"}),!m&&n.jsx("th",{children:"Processing"}),n.jsx("th",{children:"Updated"}),n.jsx("th",{})]})}),n.jsx("tbody",{children:Ee.map(X=>n.jsxs("tr",{onClick:()=>a(`${m?"/outputs":"/information"}/${encodeURIComponent(X.id)}?entity=${p}&collection=${z}`),children:[n.jsx("td",{className:"mono",style:{fontSize:12},children:X.id}),n.jsx("td",{children:X.label}),je.map(oe=>n.jsx("td",{className:"text-muted",style:{fontSize:12},children:String(X.fields[oe]??"—")},oe)),!m&&n.jsx("td",{children:n.jsx("span",{className:"chip-row",children:Object.keys(X.narratives).map(oe=>n.jsx("span",{className:"chip narrative",children:oe},oe))})}),!m&&n.jsx("td",{className:"text-muted",style:{fontSize:12},children:HC(X)}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:new Date(X.updatedAt).toLocaleString()}),n.jsx("td",{onClick:oe=>oe.stopPropagation(),children:!m&&n.jsx(ve,{to:`/on-demand/single?entity=${p}`,style:{fontSize:12},children:"Run"})})]},X.id))})]}),n.jsx(br,{loaded:Ee.length,total:me,hasMore:xe,isFetchingNextPage:ye.isFetchingNextPage,onLoadMore:k})]})]})}const GC=["Core","Narratives","Processing","Snapshots","Journal"],IC=["Output","Journal"];function Hg(){const{recordId:a}=li(),s=decodeURIComponent(a??""),[r]=si(),c=r.get("entity")??"",u=r.get("collection")??"core",f=u!=="core",[h,m]=S.useState(f?"Output":"Core"),p=kn();S.useEffect(()=>{m(f?"Output":"Core")},[u,f]);const g=fe({queryKey:["core-record",c,u,s],queryFn:()=>te.coreRecord(c,s,u,f),enabled:!!(c&&s)}),v=g.data,x=f?`/outputs?entity=${encodeURIComponent(c)}&collection=${encodeURIComponent(u)}`:`/information?entity=${encodeURIComponent(c)}`,N=Pe({mutationFn:()=>te.deleteCoreRecord(c,s,u),onSuccess:()=>{p.invalidateQueries({queryKey:["core-records"]}),window.location.href=x}});if(g.isLoading)return n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]});if(g.isError||!v)return n.jsx(vt,{title:"Failed to load",detail:g.error});const j=f?IC:GC;return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(ve,{to:x,children:f?"Outputs":"Information"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),v.label]}),n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between"},children:[n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:v.label}),n.jsxs("span",{className:"page-subtitle mono",children:[c," · ",u," · ",v.id]})]}),!f&&n.jsx(ve,{to:`/on-demand/single?entity=${c}`,children:n.jsx("button",{className:"primary",children:"Run on-demand"})}),f&&n.jsx("button",{style:{color:"var(--status-failed)"},disabled:N.isPending,onClick:()=>{window.confirm("Delete this output record? Linked processing stamps will be marked failed.")&&N.mutate()},children:N.isPending?"Deleting…":"Delete output"})]}),n.jsx("div",{className:"tabs",children:j.map(E=>n.jsx("button",{className:`tab${h===E?" active":""}`,onClick:()=>m(E),children:E},E))}),h==="Core"&&n.jsxs("div",{className:"card",style:{maxWidth:560},children:[n.jsx("div",{className:"card-title",children:"Core fields"}),n.jsx(Ls,{k:"Item id",v:v.id}),n.jsx(Ls,{k:"Entity",v:v.entity}),n.jsx(Ls,{k:"Label",v:v.label}),Object.entries(v.fields).map(([E,C])=>n.jsx(Ls,{k:E,v:String(C)},E)),n.jsx(Ls,{k:"Created",v:Mt(v.createdAt)}),n.jsx(Ls,{k:"Updated",v:Mt(v.updatedAt)})]}),h==="Output"&&n.jsxs("div",{className:"card run-io-panel",children:[n.jsx("div",{className:"card-title",children:"Output document"}),n.jsxs("p",{className:"run-io-hint",children:["Full contents of this record in the ",n.jsx("span",{className:"mono",children:u})," collection."]}),n.jsx(Lt,{label:"Document JSON",value:v.doc??v.fields,defaultOpen:!0})]}),h==="Narratives"&&(Object.keys(v.narratives).length===0?n.jsx(It,{title:"No narratives on this item",message:"This item has no narratives assigned."}):n.jsx("div",{className:"table-wrap",children:n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Narrative"}),n.jsx("th",{children:"Added"}),n.jsx("th",{children:"Detected by"})]})}),n.jsx("tbody",{children:Object.entries(v.narratives).map(([E,C])=>n.jsxs("tr",{style:{cursor:"default"},children:[n.jsx("td",{children:n.jsx("span",{className:"chip narrative",children:E})}),n.jsx("td",{className:"text-muted",style:{fontSize:12},children:Mt(C.addedAt)}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:C.detectedBy??"—"})]},E))})]})})),h==="Processing"&&n.jsx(PC,{entity:c,recordId:s,contentType:"core",graphs:v.processing.graphs}),h==="Snapshots"&&n.jsx(It,{title:"Snapshots view",message:"Snapshot perspectives for this item live in the Memorix UI. Core is the operational perspective shown here.",icon:"▤"}),h==="Journal"&&n.jsx(YC,{entity:c,recordId:s})]})}function YC({entity:a,recordId:s}){var m;const r=ho(["record-runs",a,s],{entity:a,recordId:s}),c=S.useMemo(()=>{var p;return((p=r.data)==null?void 0:p.pages.flatMap(g=>g.runs))??[]},[r.data]),u=Sr((m=r.data)==null?void 0:m.pages),f=c.length<u,h=S.useCallback(()=>{f&&!r.isFetchingNextPage&&r.fetchNextPage()},[f,r]);return r.isLoading?n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading…"]}):c.length===0?n.jsx(It,{title:"No journal entries for this item"}):n.jsxs("div",{className:"table-wrap",children:[n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Status"}),n.jsx("th",{children:"Source"}),n.jsx("th",{children:"Graph"}),n.jsx("th",{children:"Updated"})]})}),n.jsx("tbody",{children:c.map(p=>n.jsxs("tr",{onClick:()=>{window.location.href=`/journal/${p.id}`},children:[n.jsx("td",{children:n.jsx(_t,{status:p.status})}),n.jsx("td",{className:"text-muted",style:{fontSize:12},children:p.sourceName}),n.jsx("td",{className:"text-muted",style:{fontSize:12},children:p.graphName??p.graphId}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:Xn(p.updatedAt)})]},p.id))})]}),n.jsx(br,{loaded:c.length,total:u,hasMore:f,isFetchingNextPage:r.isFetchingNextPage,onLoadMore:h})]})}function PC({entity:a,recordId:s,contentType:r,graphs:c}){const u=Object.values(c);return u.length===0?n.jsx(It,{title:"No processing yet",message:"This item has not been processed by any graph."}):n.jsx("div",{className:"table-wrap",children:n.jsxs("table",{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Graph"}),n.jsx("th",{children:"Status"}),n.jsx("th",{children:"Version"}),n.jsx("th",{children:"Run"}),n.jsx("th",{children:"Processed at"}),n.jsx("th",{})]})}),n.jsx("tbody",{children:u.map(f=>n.jsx(FC,{entity:a,recordId:s,contentType:r,graph:f},f.graphId))})]})})}function FC({entity:a,recordId:s,contentType:r,graph:c}){const u=fe({queryKey:["journal-run-status",c.lastRunId],queryFn:()=>te.factoryRun(c.lastRunId),enabled:!!c.lastRunId&&c.lastStatus==="running"}),f=u.data&&["pending","running","blocked"].includes(u.data.status),h=c.lastStatus==="running"&&c.lastRunId&&!f&&!u.isLoading,m=Pe({mutationFn:()=>te.resetGraphRun(a,s,c.graphId,r),onSuccess:()=>{window.location.reload()}});return n.jsxs("tr",{style:{cursor:"default"},children:[n.jsx("td",{className:"mono",style:{fontSize:12},children:c.graphName??c.graphId}),n.jsx("td",{children:n.jsx(_t,{status:c.lastStatus})}),n.jsx("td",{className:"text-muted",children:c.graphVersion??"—"}),n.jsx("td",{children:c.lastRunId?n.jsx(ve,{to:`/journal/${c.lastRunId}`,className:"mono",style:{fontSize:12},children:c.lastRunId}):"—"}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:Mt(c.processedAt)}),n.jsx("td",{children:h&&n.jsx("button",{className:"btn btn-sm",disabled:m.isPending,onClick:()=>{window.confirm("Reset stuck processing stamp on this item?")&&m.mutate()},children:m.isPending?"Resetting…":"Reset stuck"})})]})}function Ls({k:a,v:s}){return n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:a}),n.jsx("span",{className:"detail-val",children:s})]})}function XC(a){return{stepKey:a.stepKey,label:a.label,durations:[],inputBytes:[],outputBytes:[],promptTokens:[],completionTokens:[],totalTokens:[],costUsd:[],plannedSamples:0,measuredSamples:0}}function VC(a,s){var r,c,u;if(s.planned&&s.durationMs==null){a.plannedSamples+=1;return}a.measuredSamples+=1,s.durationMs!=null&&a.durations.push(s.durationMs),s.inputBytes!=null&&a.inputBytes.push(s.inputBytes),s.outputBytes!=null&&a.outputBytes.push(s.outputBytes),((r=s.tokens)==null?void 0:r.prompt)!=null&&a.promptTokens.push(s.tokens.prompt),((c=s.tokens)==null?void 0:c.completion)!=null&&a.completionTokens.push(s.tokens.completion),((u=s.tokens)==null?void 0:u.total)!=null&&a.totalTokens.push(s.tokens.total),s.costUsd!=null&&a.costUsd.push(s.costUsd)}function Jf(a){if(a.length!==0)return a.reduce((s,r)=>s+r,0)/a.length}function wn(a){return a.length===0?{}:{avg:Jf(a),min:Math.min(...a),max:Math.max(...a)}}function Rn(a,s){const r={};return s.avg!=null&&(r[`avg${a}`]=s.avg),s.min!=null&&(r[`min${a}`]=s.min),s.max!=null&&(r[`max${a}`]=s.max),r}function JC(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:void 0}function ZC(a){if(a.status!=="done")return!1;const s=JC(a.result);return(s==null?void 0:s.status)!=="failed"}function Kg(a){return a.includes("Web")||a.includes("Pre")||a.includes("Narrix")?0:a.includes("Main")?1:a.includes("Post")||a.includes("Audit")||a.includes("Polish")?2:3}function WC(a){return[...a.values()].map(s=>{const r=s.durations.length,c=s.measuredSamples===0&&s.plannedSamples>0,u=wn(s.inputBytes),f=wn(s.outputBytes),h=wn(s.promptTokens),m=wn(s.completionTokens),p=wn(s.totalTokens),g=wn(s.costUsd);return{stepKey:s.stepKey,label:s.label,sampleCount:Math.max(s.measuredSamples,s.plannedSamples),...r>0?{avgDurationMs:Jf(s.durations),minDurationMs:Math.min(...s.durations),maxDurationMs:Math.max(...s.durations)}:{},...Rn("InputBytes",u),...Rn("OutputBytes",f),...Rn("PromptTokens",h),...Rn("CompletionTokens",m),...Rn("TotalTokens",p),...Rn("CostUsd",g),plannedOnly:c}}).sort((s,r)=>Kg(s.label)-Kg(r.label)||s.label.localeCompare(r.label))}function eE(a){const s=ax(a.result);if(Object.keys(s).length===0)return null;const r=sx(s,[],a.result),c=mo(r);return c?{runId:a.id,graphId:a.graphId,completedAt:a.updatedAt,entity:a.entity,recordLabel:a.recordLabel,wallDurationMs:c.totalDurationMs,nodeCount:c.nodeCount,parallelPairCount:c.parallelPairCount,rows:r}:null}function Ex(a,s){var p,g,v;const r=new Map,c=[];let u=0,f=0,h=0;for(const x of s){if(!ZC(x))continue;const N=eE(x);if(N){u+=1,f+=N.wallDurationMs,h+=N.parallelPairCount,c.length<8&&c.push(N);for(const j of N.rows){let E=r.get(j.nodeId);if(E||(E={nodeId:j.nodeId,skillKey:j.skillKey,durations:[],startedAtSamples:[],failCount:0,parallelSampleCount:0,inputBytes:[],outputBytes:[],promptTokens:[],completionTokens:[],totalTokens:[],costUsd:[],subSteps:new Map},r.set(j.nodeId,E)),j.skillKey&&!E.skillKey&&(E.skillKey=j.skillKey),!j.ok){E.failCount+=1;continue}E.durations.push(j.durationMs),E.startedAtSamples.push(j.startedAt),j.concurrentWith.length>0&&(E.parallelSampleCount+=1);const C=Wv(j,x.result);C.inputBytes!=null&&E.inputBytes.push(C.inputBytes),C.outputBytes!=null&&E.outputBytes.push(C.outputBytes),((p=C.tokens)==null?void 0:p.prompt)!=null&&E.promptTokens.push(C.tokens.prompt),((g=C.tokens)==null?void 0:g.completion)!=null&&E.completionTokens.push(C.tokens.completion),((v=C.tokens)==null?void 0:v.total)!=null&&E.totalTokens.push(C.tokens.total),C.costUsd!=null&&E.costUsd.push(C.costUsd);for(const A of j.subSteps??[]){let O=E.subSteps.get(A.stepKey);O||(O=XC(A),E.subSteps.set(A.stepKey,O)),VC(O,A)}}}}const m=[...r.values()].map(x=>{const N=x.durations.reduce((J,G)=>J+G,0),j=x.durations.length,E=wn(x.inputBytes),C=wn(x.outputBytes),A=wn(x.promptTokens),O=wn(x.completionTokens),U=wn(x.totalTokens),q=wn(x.costUsd),z=WC(x.subSteps),K=Jf(x.startedAtSamples)??0;return{nodeId:x.nodeId,skillKey:x.skillKey,sampleCount:j,avgDurationMs:j>0?N/j:0,minDurationMs:j>0?Math.min(...x.durations):0,maxDurationMs:j>0?Math.max(...x.durations):0,failCount:x.failCount,parallelSampleCount:x.parallelSampleCount,avgStartedAt:j>0?K:Number.POSITIVE_INFINITY,...Rn("InputBytes",E),...Rn("OutputBytes",C),...Rn("PromptTokens",A),...Rn("CompletionTokens",O),...Rn("TotalTokens",U),...Rn("CostUsd",q),...z.length>0?{subSteps:z}:{}}}).sort((x,N)=>Gf({nodeId:x.nodeId,skillKey:x.skillKey,startedAt:x.avgStartedAt},{nodeId:N.nodeId,skillKey:N.skillKey,startedAt:N.avgStartedAt})).map(({avgStartedAt:x,...N})=>N);return{graphId:a,runsSampled:s.length,runsWithTrace:u,nodes:m,recentSamples:c,totals:{...u>0?{avgWallDurationMs:f/u}:{},...u>0?{avgParallelPairsPerRun:h/u}:{}}}}function tE(a,s,r){const c=new Map;for(const g of s){const v=c.get(g.graphId)??[];v.push(g),c.set(g.graphId,v)}const u=[],f=[];let h=0,m=0,p=0;for(const[g,v]of c){const x=Ex(g,v);h+=x.runsWithTrace,x.totals.avgWallDurationMs!=null&&(m+=x.totals.avgWallDurationMs*x.runsWithTrace),x.totals.avgParallelPairsPerRun!=null&&(p+=x.totals.avgParallelPairsPerRun*x.runsWithTrace),f.push(...x.recentSamples),u.push({graphId:g,graphName:r==null?void 0:r[g],runsSampled:x.runsSampled,runsWithTrace:x.runsWithTrace,totals:x.totals,nodes:x.nodes,recentSamples:x.recentSamples})}return u.sort((g,v)=>{const x=(g.graphName??g.graphId).toLowerCase(),N=(v.graphName??v.graphId).toLowerCase();return x.localeCompare(N)}),f.sort((g,v)=>v.completedAt.localeCompare(g.completedAt)),{entity:a,runsSampled:s.length,runsWithTrace:h,graphCount:u.length,graphs:u,recentSamples:f.slice(0,12),totals:{...h>0?{avgWallDurationMs:m/h}:{},...h>0?{avgParallelPairsPerRun:p/h}:{}}}}function rr(a,s){return s!=null&&s.trim()?s.trim():io({graphId:a,name:s})}function Rf(a){return`/pipelines/${encodeURIComponent(a)}`}function Tx(a){return`/pipelines/entity/${encodeURIComponent(a)}`}function Zf({mode:a}){return n.jsxs("div",{className:"pipeline-diagram-tabs",style:{marginBottom:16},children:[n.jsx(ve,{to:"/pipelines",className:a==="graph"?"active":"",style:{textDecoration:"none"},children:"By pipeline"}),n.jsx(ve,{to:"/pipelines?view=entity",className:a==="entity"?"active":"",style:{textDecoration:"none"},children:"By entity"})]})}function _s(a,s,r){return{...a!=null?{avg:a}:{},...s!=null?{min:s}:{},...r!=null?{max:r}:{}}}function Us({stats:a,format:s}){return a.avg==null&&a.min==null&&a.max==null?n.jsx("span",{className:"text-dim",children:"—"}):n.jsxs("div",{className:"pipeline-stat-cell",children:[a.avg!=null&&n.jsx("div",{children:s(a.avg)}),a.min!=null&&a.max!=null&&n.jsxs("div",{className:"pipeline-stat-range text-dim",children:[s(a.min)," – ",s(a.max)]})]})}function tf(a,s){const r=s==="avg"?"avg":s==="min"?"min":"max",c=a[`${r}PromptTokens`],u=a[`${r}CompletionTokens`],f=a[`${r}TotalTokens`];if(!(typeof c!="number"&&typeof u!="number"&&typeof f!="number"))return{...typeof c=="number"?{prompt:Math.round(c)}:{},...typeof u=="number"?{completion:Math.round(u)}:{},...typeof f=="number"?{total:Math.round(f)}:{}}}function Gg({row:a}){const s=tf(a,"avg"),r=tf(a,"min"),c=tf(a,"max");return!s&&!r&&!c?n.jsx("span",{className:"text-dim",children:"—"}):n.jsxs("div",{className:"pipeline-stat-cell",children:[s&&n.jsx("div",{style:{fontSize:11},children:ir(s)}),r&&c&&n.jsxs("div",{className:"pipeline-stat-range text-dim",style:{fontSize:10},children:[ir(r)," – ",ir(c)]})]})}function wx({nodes:a,runsWithTrace:s}){if(a.length===0)return null;const r=a.some(c=>{var u;return(((u=c.subSteps)==null?void 0:u.length)??0)>0});return n.jsxs("div",{className:"table-wrap",style:{marginTop:12},children:[n.jsxs("table",{className:"data-table pipeline-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:r?"Node / step":"Node"}),n.jsx("th",{children:"Skill"}),n.jsx("th",{children:"Samples"}),n.jsx("th",{children:"Avg duration"}),n.jsx("th",{children:"Min duration"}),n.jsx("th",{children:"Max duration"}),n.jsx("th",{children:"Input"}),n.jsx("th",{children:"Output"}),n.jsx("th",{children:"Tokens"}),n.jsx("th",{children:"Cost"}),n.jsx("th",{children:"Parallel runs"}),n.jsx("th",{children:"Failures"})]})}),n.jsx("tbody",{children:a.flatMap(c=>{const u=[n.jsxs("tr",{children:[n.jsx("td",{className:"mono",children:c.nodeId}),n.jsx("td",{className:"mono text-dim",style:{fontSize:12},children:c.skillKey||"—"}),n.jsx("td",{children:c.sampleCount>0?c.sampleCount:"—"}),n.jsx("td",{children:c.sampleCount>0?st(c.avgDurationMs):"—"}),n.jsx("td",{className:"text-dim",children:c.sampleCount>0?st(c.minDurationMs):"—"}),n.jsx("td",{className:"text-dim",children:c.sampleCount>0?st(c.maxDurationMs):"—"}),n.jsx("td",{className:"text-dim",children:n.jsx(Us,{stats:_s(c.avgInputBytes,c.minInputBytes,c.maxInputBytes),format:On})}),n.jsx("td",{className:"text-dim",children:n.jsx(Us,{stats:_s(c.avgOutputBytes,c.minOutputBytes,c.maxOutputBytes),format:On})}),n.jsx("td",{className:"text-dim",children:n.jsx(Gg,{row:c})}),n.jsx("td",{className:"text-dim",children:n.jsx(Us,{stats:_s(c.avgCostUsd,c.minCostUsd,c.maxCostUsd),format:so})}),n.jsx("td",{className:"text-dim",children:c.parallelSampleCount>0?c.parallelSampleCount:"—"}),n.jsx("td",{style:{color:c.failCount>0?"var(--status-failed)":void 0},children:c.failCount>0?c.failCount:"—"})]},c.nodeId)];for(const f of c.subSteps??[])u.push(n.jsxs("tr",{className:"pipeline-substep-row",children:[n.jsxs("td",{className:"mono pipeline-substep-label",children:[n.jsx("span",{className:"pipeline-substep-marker",children:"↳"}),f.label,f.plannedOnly&&n.jsx("span",{className:"chip text-dim",style:{marginLeft:6,fontSize:10},children:"planned"})]}),n.jsx("td",{className:"text-dim",children:"—"}),n.jsx("td",{children:f.sampleCount}),n.jsx("td",{children:f.avgDurationMs!=null?st(f.avgDurationMs):"—"}),n.jsx("td",{className:"text-dim",children:f.minDurationMs!=null?st(f.minDurationMs):"—"}),n.jsx("td",{className:"text-dim",children:f.maxDurationMs!=null?st(f.maxDurationMs):"—"}),n.jsx("td",{className:"text-dim",children:n.jsx(Us,{stats:_s(f.avgInputBytes,f.minInputBytes,f.maxInputBytes),format:On})}),n.jsx("td",{className:"text-dim",children:n.jsx(Us,{stats:_s(f.avgOutputBytes,f.minOutputBytes,f.maxOutputBytes),format:On})}),n.jsx("td",{className:"text-dim",children:n.jsx(Gg,{row:f})}),n.jsx("td",{className:"text-dim",children:n.jsx(Us,{stats:_s(f.avgCostUsd,f.minCostUsd,f.maxCostUsd),format:so})}),n.jsx("td",{className:"text-dim",children:"—"}),n.jsx("td",{className:"text-dim",children:"—"})]},`${c.nodeId}:${f.stepKey}`));return u})})]}),n.jsxs("p",{className:"text-dim",style:{fontSize:11,marginTop:8},children:["Based on ",s," successful traced run",s===1?"":"s"," for this pipeline. Averages and min–max ranges use successful node executions only; failed runs and failed nodes are excluded.",r&&n.jsxs(n.Fragment,{children:[" ","Sub-steps come from execution trace units and ai-tasks pipeline metadata when persisted on runs."]})]})]})}function nE(){var p,g;const a=tn(),[s]=si(),r=s.get("view")==="entity"?"entity":"graph",{agentQueryParam:c}=zn(),u=fe({queryKey:["entities",c??"all"],queryFn:()=>te.listEntities(c)}),f=fe({queryKey:["meta-graphs"],queryFn:()=>te.compatibleGraphs()}),h=((p=f.data)==null?void 0:p.graphs)??[],m=((g=f.data)==null?void 0:g.cataloxAuthoritative)===!1?"Catalox unavailable — showing legacy registry graphs only.":"Pipelines listed from Graphs Studio (Catalox).";return n.jsxs("div",{children:[n.jsx("div",{className:"page-header",children:n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:"Pipeline analytics"}),n.jsx("span",{className:"page-subtitle",children:"Aggregated timing and parallelism — browse by pipeline (graph) or by entity type."})]})}),n.jsx(Zf,{mode:r}),r==="graph"?n.jsxs(n.Fragment,{children:[f.isError&&n.jsx(vt,{title:"Failed to load pipelines",detail:f.error}),f.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading pipelines from Catalox…"]}),!f.isLoading&&h.length===0&&n.jsx("p",{className:"text-muted",style:{fontSize:13},children:"No pipelines in Catalox yet. Author graphs in Graphs Studio, then return here."}),n.jsxs("div",{className:"card",style:{marginTop:16},children:[n.jsx("div",{className:"card-title",children:"Choose a pipeline"}),n.jsx("p",{className:"text-dim",style:{fontSize:12,marginBottom:12},children:m}),n.jsx("div",{className:"pipeline-graph-picker",children:h.map(v=>n.jsxs("button",{type:"button",className:"pipeline-graph-pick",onClick:()=>a(Rf(v.graphId)),children:[n.jsx("span",{style:{fontSize:13},children:rr(v.graphId,v.name)}),n.jsx("span",{className:"text-dim mono",style:{fontSize:11},children:v.graphId})]},v.graphId))})]})]}):n.jsxs(n.Fragment,{children:[u.isError&&n.jsx(vt,{title:"Failed to load entities",detail:u.error}),u.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading entity types…"]}),!u.isLoading&&(u.data??[]).length===0&&n.jsx("p",{className:"text-muted",style:{fontSize:13},children:"No entity types configured."}),n.jsxs("div",{className:"card",style:{marginTop:16},children:[n.jsx("div",{className:"card-title",children:"Choose an entity type"}),n.jsx("p",{className:"text-dim",style:{fontSize:12,marginBottom:12},children:"Aggregates completed runs across all pipelines for that object type."}),n.jsx("div",{className:"pipeline-graph-picker",children:(u.data??[]).map(v=>n.jsxs("button",{type:"button",className:"pipeline-graph-pick",onClick:()=>a(Tx(v.name)),children:[n.jsx("span",{style:{fontSize:13},children:v.label}),n.jsx("span",{className:"text-dim mono",style:{fontSize:11},children:v.name})]},v.name))})]})]}),n.jsx(po,{variant:"full"})]})}function aE({graphId:a}){var N,j,E;const s=tn(),{agentQueryParam:r}=zn(),u=(N=fe({queryKey:["meta-graphs"],queryFn:()=>te.compatibleGraphs()}).data)==null?void 0:N.graphs.find(C=>C.graphId===a),f=rr(a,u==null?void 0:u.name),h=fe({queryKey:["pipeline-insights-runs",a,r??"all"],queryFn:()=>te.factoryRuns({agent:r,graphId:a,status:"done",pageSize:100}),enabled:!!a}),m=S.useMemo(()=>{var C;return(C=h.data)!=null&&C.runs?Ex(a,h.data.runs):null},[a,(j=h.data)==null?void 0:j.runs]),p=(E=h.data)==null?void 0:E.runs.find(C=>C.result!=null),[g,v]=S.useState(null),x=S.useMemo(()=>m!=null&&m.recentSamples.length?g?m.recentSamples.find(C=>C.runId===g)??m.recentSamples[0]:m.recentSamples[0]:null,[m==null?void 0:m.recentSamples,g]);return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(ve,{to:"/pipelines",children:"Pipeline analytics"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),n.jsx("span",{children:f})]}),n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:f}),n.jsx("span",{className:"page-subtitle mono",children:a})]}),n.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[n.jsx(ve,{className:"btn",to:`/journal?graphId=${encodeURIComponent(a)}`,children:"Journal entries"}),n.jsx("button",{type:"button",className:"btn",onClick:()=>s("/pipelines"),children:"Change pipeline"})]})]}),n.jsx(Zf,{mode:"graph"}),n.jsx(po,{graphId:a,variant:"full"}),h.isError&&n.jsx(vt,{title:"Failed to load runs",detail:h.error}),h.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading completed runs…"]}),m&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"detail-grid",style:{marginBottom:16},children:[n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Sample"}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"Completed runs"}),n.jsx("span",{className:"detail-val",children:m.runsSampled})]}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"With trace data"}),n.jsx("span",{className:"detail-val",children:m.runsWithTrace})]})]}),n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Averages"}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"Wall time / run"}),n.jsx("span",{className:"detail-val",children:st(m.totals.avgWallDurationMs)})]}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"Parallel pairs / run"}),n.jsx("span",{className:"detail-val",children:m.totals.avgParallelPairsPerRun!=null?m.totals.avgParallelPairsPerRun.toFixed(1):"—"})]})]})]}),m.runsWithTrace===0&&n.jsxs("div",{className:"run-io-warning",style:{marginBottom:16},children:["No completed runs in this sample include ",n.jsx("span",{className:"mono",children:"execution._trace"}),"."]}),x&&x.rows.length>0&&n.jsxs(An,{title:"Typical execution pattern",summary:`From run ${x.runId.slice(0,8)}… · ${x.parallelPairCount>0?"parallel batches":"sequential"}`,defaultOpen:!0,style:{marginBottom:16},children:[n.jsxs("div",{className:"filter-group",style:{marginBottom:12,maxWidth:360},children:[n.jsx("label",{children:"Example run for diagram"}),n.jsx("select",{value:x.runId,onChange:C=>v(C.target.value),children:m.recentSamples.map(C=>n.jsxs("option",{value:C.runId,children:[C.runId.slice(0,8),"… · ",C.recordLabel??C.entity," · ",st(C.wallDurationMs)]},C.runId))})]}),n.jsx(rx,{rows:x.rows,title:"How nodes ran"}),n.jsxs("p",{className:"text-dim",style:{fontSize:12,marginTop:12},children:[n.jsx(ve,{to:`/journal/${x.runId}`,children:"Open full run detail"})," for per-node logs and payloads."]})]}),m.nodes.length>0&&n.jsx(An,{title:"Per-node aggregates",summary:`${m.nodes.length} nodes · last ${m.runsWithTrace} traced runs`,defaultOpen:!0,style:{marginBottom:16},children:n.jsx(wx,{nodes:m.nodes,runsWithTrace:m.runsWithTrace})}),m.recentSamples.length>0&&n.jsx(An,{title:"Recent runs",summary:`${m.recentSamples.length} with trace`,defaultOpen:!1,style:{marginBottom:16},children:n.jsx("div",{className:"table-wrap",children:n.jsxs("table",{className:"data-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Run"}),n.jsx("th",{children:"Entity"}),n.jsx("th",{children:"Item"}),n.jsx("th",{children:"Wall"}),n.jsx("th",{children:"Nodes"}),n.jsx("th",{children:"Parallel pairs"}),n.jsx("th",{children:"Completed"})]})}),n.jsx("tbody",{children:m.recentSamples.map(C=>n.jsxs("tr",{children:[n.jsx("td",{children:n.jsxs(ve,{to:`/journal/${C.runId}`,className:"mono",style:{fontSize:12},children:[C.runId.slice(0,8),"…"]})}),n.jsx("td",{className:"mono",children:n.jsx(ve,{to:Tx(C.entity),children:C.entity})}),n.jsx("td",{className:"mono text-dim",children:C.recordLabel??"—"}),n.jsx("td",{children:st(C.wallDurationMs)}),n.jsx("td",{children:C.nodeCount}),n.jsx("td",{children:C.parallelPairCount>0?C.parallelPairCount:"—"}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:Mt(C.completedAt)})]},C.runId))})]})})})]}),p&&n.jsx(An,{title:"Latest run detail",summary:p.recordLabel??p.recordId,defaultOpen:(m==null?void 0:m.runsWithTrace)===0,style:{marginBottom:16},children:n.jsx(cx,{runId:p.id,status:p.status,result:p.result})})]})}function lE({entityName:a}){var N,j;const s=tn(),{agentQueryParam:r}=zn(),u=(fe({queryKey:["entities",r??"all"],queryFn:()=>te.listEntities(r)}).data??[]).find(E=>E.name===a),f=(u==null?void 0:u.label)??a,h=fe({queryKey:["meta-graphs"],queryFn:()=>te.compatibleGraphs()}),m=S.useMemo(()=>{var C;const E={};for(const A of((C=h.data)==null?void 0:C.graphs)??[])E[A.graphId]=rr(A.graphId,A.name);return E},[(N=h.data)==null?void 0:N.graphs]),p=fe({queryKey:["pipeline-insights-entity-runs",a,r??"all"],queryFn:()=>te.factoryRuns({agent:r,entity:a,status:"done",pageSize:100}),enabled:!!a}),g=S.useMemo(()=>{var E;return(E=p.data)!=null&&E.runs?tE(a,p.data.runs,m):null},[a,(j=p.data)==null?void 0:j.runs,m]),[v,x]=S.useState(null);return n.jsxs("div",{children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(ve,{to:"/pipelines?view=entity",children:"Pipeline analytics"}),n.jsx("span",{className:"breadcrumb-sep",children:"/"}),n.jsx("span",{children:f})]}),n.jsxs("div",{className:"page-header",style:{justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[n.jsxs("div",{children:[n.jsx("h1",{className:"page-title",children:f}),n.jsx("span",{className:"page-subtitle mono",children:a})]}),n.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[n.jsx(ve,{className:"btn",to:`/journal?entity=${encodeURIComponent(a)}`,children:"Journal entries"}),n.jsx("button",{type:"button",className:"btn",onClick:()=>s("/pipelines?view=entity"),children:"Change entity"})]})]}),n.jsx(Zf,{mode:"entity"}),n.jsx(po,{variant:"full"}),p.isError&&n.jsx(vt,{title:"Failed to load runs",detail:p.error}),p.isLoading&&n.jsxs("div",{className:"loading-row",children:[n.jsx("span",{className:"spinner"})," Loading completed runs…"]}),g&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"detail-grid",style:{marginBottom:16},children:[n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Sample"}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"Completed runs"}),n.jsx("span",{className:"detail-val",children:g.runsSampled})]}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"With trace data"}),n.jsx("span",{className:"detail-val",children:g.runsWithTrace})]}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"Pipelines used"}),n.jsx("span",{className:"detail-val",children:g.graphCount})]})]}),n.jsxs("div",{className:"card",children:[n.jsx("div",{className:"card-title",children:"Averages (all pipelines)"}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"Wall time / run"}),n.jsx("span",{className:"detail-val",children:st(g.totals.avgWallDurationMs)})]}),n.jsxs("div",{className:"detail-row",children:[n.jsx("span",{className:"detail-key",children:"Parallel pairs / run"}),n.jsx("span",{className:"detail-val",children:g.totals.avgParallelPairsPerRun!=null?g.totals.avgParallelPairsPerRun.toFixed(1):"—"})]})]})]}),g.graphCount>0&&n.jsxs(An,{title:"By pipeline",summary:`${g.graphCount} pipeline${g.graphCount===1?"":"s"} · ${g.runsWithTrace} traced runs`,defaultOpen:!0,style:{marginBottom:16},children:[n.jsx("div",{className:"table-wrap",children:n.jsxs("table",{className:"data-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Pipeline"}),n.jsx("th",{children:"Runs"}),n.jsx("th",{children:"Traced"}),n.jsx("th",{children:"Avg wall"}),n.jsx("th",{children:"Parallel pairs"}),n.jsx("th",{})]})}),n.jsx("tbody",{children:g.graphs.map(E=>n.jsxs("tr",{children:[n.jsxs("td",{children:[n.jsx("div",{children:E.graphName??rr(E.graphId)}),n.jsx("div",{className:"mono text-dim",style:{fontSize:11},children:E.graphId})]}),n.jsx("td",{children:E.runsSampled}),n.jsx("td",{children:E.runsWithTrace}),n.jsx("td",{children:st(E.totals.avgWallDurationMs)}),n.jsx("td",{children:E.totals.avgParallelPairsPerRun!=null?E.totals.avgParallelPairsPerRun.toFixed(1):"—"}),n.jsx("td",{children:n.jsx(ve,{to:Rf(E.graphId),style:{fontSize:12},children:"Pipeline detail →"})})]},E.graphId))})]})}),g.graphs.some(E=>E.nodes.length>0)&&n.jsxs("div",{style:{marginTop:16},children:[n.jsx("div",{className:"section-title",style:{fontSize:13,marginBottom:8},children:"Per-pipeline node breakdown"}),g.graphs.filter(E=>E.nodes.length>0).map(E=>{const C=v===E.graphId;return n.jsxs("div",{className:`pipeline-node-inspector-item${C?" open":""}`,style:{marginBottom:6},children:[n.jsxs("button",{type:"button",className:"pipeline-node-inspector-head",onClick:()=>x(C?null:E.graphId),"aria-expanded":C,children:[n.jsx("span",{className:"pipeline-node-inspector-chevron",children:C?"▾":"▸"}),n.jsx("span",{children:E.graphName??rr(E.graphId)}),n.jsx("span",{className:"text-dim mono",style:{fontSize:11},children:E.graphId}),n.jsxs("span",{className:"text-dim",style:{fontSize:12},children:[E.nodes.length," nodes · ",E.runsWithTrace," traced"]})]}),C&&n.jsx(wx,{nodes:E.nodes,runsWithTrace:E.runsWithTrace})]},E.graphId)})]})]}),g.recentSamples.length>0&&n.jsx(An,{title:"Recent runs",summary:`${g.recentSamples.length} with trace`,defaultOpen:!1,style:{marginBottom:16},children:n.jsx("div",{className:"table-wrap",children:n.jsxs("table",{className:"data-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:"Run"}),n.jsx("th",{children:"Pipeline"}),n.jsx("th",{children:"Item"}),n.jsx("th",{children:"Wall"}),n.jsx("th",{children:"Nodes"}),n.jsx("th",{children:"Completed"})]})}),n.jsx("tbody",{children:g.recentSamples.map(E=>n.jsxs("tr",{children:[n.jsx("td",{children:n.jsxs(ve,{to:`/journal/${E.runId}`,className:"mono",style:{fontSize:12},children:[E.runId.slice(0,8),"…"]})}),n.jsx("td",{children:n.jsx(ve,{to:Rf(E.graphId),style:{fontSize:12},children:m[E.graphId]??E.graphId})}),n.jsx("td",{className:"mono text-dim",children:E.recordLabel??"—"}),n.jsx("td",{children:st(E.wallDurationMs)}),n.jsx("td",{children:E.nodeCount}),n.jsx("td",{className:"text-dim",style:{fontSize:12},children:Mt(E.completedAt)})]},E.runId))})]})})})]})]})}function nf(){const{graphId:a,entityName:s}=li();return s?n.jsx(lE,{entityName:s}):a?n.jsx(aE,{graphId:a}):n.jsx(nE,{})}const Rx=S.createContext("Exellix"),Ax=S.createContext(null);function sE(){return S.useContext(Rx)}function iE(){return S.useContext(Ax)}function rE({children:a}){const{data:s}=fe({queryKey:["config"],queryFn:te.config,staleTime:1/0}),r=(s==null?void 0:s.name)||"Exellix";return S.useEffect(()=>{document.title=`${r} Jobs`},[r]),n.jsx(Ax.Provider,{value:s??null,children:n.jsx(Rx.Provider,{value:r,children:a})})}const cE="2.0.5",oE="/api/agents";class uE extends S.Component{constructor(){super(...arguments);Jy(this,"state",{error:null,componentStack:null})}static getDerivedStateFromError(r){return{error:r,componentStack:null}}componentDidCatch(r,c){console.error("UI error:",r,c),this.setState({componentStack:c.componentStack??null})}render(){return this.state.error?n.jsxs("div",{style:{padding:32},children:[n.jsxs("div",{className:"error-state",children:[n.jsx("strong",{children:"Something went wrong on this page."}),n.jsx("pre",{style:{marginTop:8,fontSize:11,whiteSpace:"pre-wrap"},children:this.state.error.message}),this.state.componentStack&&n.jsx("pre",{style:{marginTop:8,fontSize:10,whiteSpace:"pre-wrap",opacity:.75},children:this.state.componentStack})]}),n.jsx("button",{style:{marginTop:12},onClick:()=>this.setState({error:null,componentStack:null}),children:"Try again"})]}):this.props.children}}function dE(){const a=mn(),s=sE(),r=iE(),c=u=>u==="/"?a.pathname==="/":u==="/information"?a.pathname.startsWith("/information"):u==="/outputs"?a.pathname.startsWith("/outputs")||a.search.includes("view=outputs"):u==="/journal"?a.pathname.startsWith("/journal"):u==="/pipelines"?a.pathname.startsWith("/pipelines"):a.pathname.startsWith(u);return n.jsxs("header",{className:"topbar",children:[n.jsxs("div",{className:"topbar-brand",children:[n.jsx("span",{className:"topbar-brand-icon",children:"⚙"}),n.jsxs("span",{children:[n.jsx("span",{style:{color:"var(--color-text)"},children:s})," ",n.jsx("span",{children:"Jobs"})]}),n.jsxs("span",{className:"app-pkg-version",children:["v",cE]})]}),n.jsxs("nav",{className:"topbar-nav",children:[n.jsx(Na,{to:"/",className:c("/")?"active":"",children:al.overview}),n.jsx(Na,{to:"/work",className:c("/work")?"active":"",children:al.work}),n.jsx(Na,{to:"/on-demand",className:c("/on-demand")?"active":"",children:al.onDemand}),n.jsx(Na,{to:"/information",className:c("/information")?"active":"",children:al.information}),n.jsx(Na,{to:"/outputs",className:c("/outputs")?"active":"",children:al.outputs}),n.jsx(Na,{to:"/journal",className:c("/journal")?"active":"",children:al.journal}),n.jsx(Na,{to:"/pipelines",className:c("/pipelines")?"active":"",children:al.pipelines}),n.jsx(Na,{to:"/settings",className:c("/settings")?"active":"",children:al.settings})]}),n.jsxs("div",{className:"topbar-meta",children:[n.jsxs("div",{className:"topbar-meta-controls",children:[n.jsx(Yv,{}),n.jsx(Y0,{apiBase:oE,className:"topbar-agent-scope"})]}),r&&n.jsxs("span",{className:"topbar-meta-host mono",title:`${r.runtimeDb} @ ${r.mongoHost}`,children:[r.runtimeDb," @ ",r.mongoHost]})]})]})}const Tt=a=>n.jsx(uE,{children:a});function fE(){return n.jsx(yN,{children:n.jsxs("div",{className:"layout",children:[n.jsx(dE,{}),n.jsx("main",{className:"page",children:n.jsxs(IS,{children:[n.jsx(Ye,{path:"/",element:Tt(n.jsx(_N,{}))}),n.jsx(Ye,{path:"/settings",element:Tt(n.jsx(QN,{}))}),n.jsx(Ye,{path:"/work",element:Tt(n.jsx(nC,{}))}),n.jsx(Ye,{path:"/work/new",element:Tt(n.jsx(bC,{}))}),n.jsx(Ye,{path:"/work/:id",element:Tt(n.jsx(EC,{}))}),n.jsx(Ye,{path:"/on-demand",element:Tt(n.jsx(RC,{}))}),n.jsx(Ye,{path:"/on-demand/single",element:Tt(n.jsx(qC,{}))}),n.jsx(Ye,{path:"/on-demand/batch",element:Tt(n.jsx(QC,{}))}),n.jsx(Ye,{path:"/on-demand/batch/:id",element:Tt(n.jsx($C,{}))}),n.jsx(Ye,{path:"/information",element:Tt(n.jsx($g,{}))}),n.jsx(Ye,{path:"/information/:recordId",element:Tt(n.jsx(Hg,{}))}),n.jsx(Ye,{path:"/outputs",element:Tt(n.jsx($g,{}))}),n.jsx(Ye,{path:"/outputs/:recordId",element:Tt(n.jsx(Hg,{}))}),n.jsx(Ye,{path:"/journal",element:Tt(n.jsx(YN,{}))}),n.jsx(Ye,{path:"/journal/:id",element:Tt(n.jsx(F1,{}))}),n.jsx(Ye,{path:"/pipelines",element:Tt(n.jsx(nf,{}))}),n.jsx(Ye,{path:"/pipelines/entity/:entityName",element:Tt(n.jsx(nf,{}))}),n.jsx(Ye,{path:"/pipelines/:graphId",element:Tt(n.jsx(nf,{}))}),n.jsx(Ye,{path:"/items/:itemId",element:Tt(n.jsx(tC,{}))}),n.jsx(Ye,{path:"/records",element:n.jsx(xa,{to:"/information",replace:!0})}),n.jsx(Ye,{path:"/records/:recordId",element:n.jsx(xa,{to:"/information",replace:!0})}),n.jsx(Ye,{path:"/runs",element:n.jsx(xa,{to:"/journal",replace:!0})}),n.jsx(Ye,{path:"/runs/:id",element:n.jsx(xa,{to:"/journal",replace:!0})}),n.jsx(Ye,{path:"/sources",element:n.jsx(xa,{to:"/information",replace:!0})}),n.jsx(Ye,{path:"/job-defs",element:n.jsx(xa,{to:"/work",replace:!0})}),n.jsx(Ye,{path:"/job-defs/:id",element:n.jsx(xa,{to:"/work",replace:!0})}),n.jsx(Ye,{path:"/jobs/new",element:n.jsx(xa,{to:"/on-demand",replace:!0})}),n.jsx(Ye,{path:"*",element:n.jsx(xa,{to:"/",replace:!0})})]})})]})})}const Ox=S.createContext(null);async function Xc(a,s){return fetch(`/api/auth/${a}`,{credentials:"include",headers:{"Content-Type":"application/json"},...s})}async function Ig(){try{const a=await fetch("/api/config",{credentials:"include"});return a.ok?(await a.json()).authRequired!==!0:!1}catch{return!1}}function hE({children:a}){const[s,r]=S.useState("loading"),[c,u]=S.useState(null),[f,h]=S.useState(!1),[m,p]=S.useState("Exellix"),[g,v]=S.useState(null),[x,N]=S.useState(null),[j,E]=S.useState(!1),C=S.useRef(s);C.current=s;const A=S.useCallback(async()=>{try{const z=await Xc("me");if(!z.ok){if(z.status===404&&await Ig()){u(null),h(!0),v("disabled"),r("authenticated");return}u(null),r("anonymous");return}const K=await z.json();u(K.user),h(!!K.authDisabled),E(!1),r("authenticated")}catch{u(null),r("anonymous")}},[]),O=S.useCallback(async(z,K)=>{const J=await Xc("login",{method:"POST",body:JSON.stringify({username:z,password:K})});if(!J.ok){const $=await J.json().catch(()=>({}));throw new Error($.error??"Login failed")}const G=await J.json();u(G.user),h(!!G.authDisabled),r("authenticated")},[]),U=S.useCallback(async()=>{if(g==="sso"){window.location.assign("/api/auth/sso/logout");return}await Xc("logout",{method:"POST"}).catch(()=>{}),u(null),E(!0),r("anonymous")},[g]);S.useEffect(()=>{let z=!1;return(async()=>{try{const K=await Xc("mode");if(!K.ok){if(K.status===404&&await Ig()){if(z)return;v("disabled"),h(!0),r("authenticated")}return}const J=await K.json();if(z)return;v(J.mode),N(J.loginUrl??null)}catch{}})(),()=>{z=!0}},[]),S.useEffect(()=>{let z=!1;return fetch("/api/config",{credentials:"include"}).then(K=>K.ok?K.json():null).then(K=>{z||!(K!=null&&K.name)||p(K.name)}).catch(()=>{}),()=>{z=!0}},[]),S.useEffect(()=>{const z=window.fetch;return window.fetch=async(...K)=>{const J=await z(...K);try{const G=typeof K[0]=="string"?K[0]:K[0].toString(),$=G.startsWith("http")?new URL(G).pathname:G;J.status===401&&$.startsWith("/api/")&&!$.startsWith("/api/auth/")&&C.current==="authenticated"&&(u(null),r("anonymous"))}catch{}return J},()=>{window.fetch=z}},[]),S.useEffect(()=>{if(!(typeof window>"u")&&/[?&]signed_out=1\b/.test(window.location.search)){E(!0);const z=new URL(window.location.href);z.searchParams.delete("signed_out"),window.history.replaceState({},"",z.pathname+z.search+z.hash)}},[]),S.useEffect(()=>{A()},[A]);const q=S.useMemo(()=>({status:s,user:c,authDisabled:f,brandName:m,mode:g,loginUrl:x,loggedOut:j,login:O,logout:U}),[s,c,f,m,g,x,j,O,U]);return n.jsx(Ox.Provider,{value:q,children:a})}function Wf(){const a=S.useContext(Ox);if(!a)throw new Error("useAuth must be used within an AuthProvider");return a}function jo({name:a}){return n.jsxs("div",{className:"jx-login-brand",children:[n.jsx("span",{className:"jx-login-brand-icon",children:"◆"}),n.jsxs("span",{children:[n.jsx("strong",{children:a})," Jobs"]})]})}function mE({loginUrl:a,brandName:s}){return S.useEffect(()=>{window.location.assign(a)},[a]),n.jsx("div",{className:"jx-login-shell",children:n.jsxs("div",{className:"jx-login-card",children:[n.jsx(jo,{name:s}),n.jsx("div",{className:"jx-login-spinner","aria-hidden":"true"}),n.jsx("p",{className:"jx-login-sub",role:"status","aria-live":"polite",children:"Redirecting to single sign-on…"}),n.jsxs("div",{className:"jx-login-foot",children:["Authix · ",s]})]})})}function pE({loginUrl:a,brandName:s}){return n.jsx("div",{className:"jx-login-shell",children:n.jsxs("div",{className:"jx-login-card",children:[n.jsx(jo,{name:s}),n.jsx("p",{className:"jx-login-sub",children:"You've been signed out."}),n.jsx("a",{className:"jx-login-btn",href:`${a}?prompt=login`,children:"Sign in with SSO"}),n.jsxs("div",{className:"jx-login-foot",children:["Authix · ",s]})]})})}function yE({brandName:a}){const{login:s}=Wf(),[r,c]=S.useState(""),[u,f]=S.useState(""),[h,m]=S.useState(null),[p,g]=S.useState(!1);async function v(x){x.preventDefault(),m(null),g(!0);try{await s(r.trim(),u)}catch(N){m(N instanceof Error?N.message:"Login failed")}finally{g(!1)}}return n.jsx("div",{className:"jx-login-shell",children:n.jsxs("form",{className:"jx-login-card",onSubmit:v,children:[n.jsx(jo,{name:a}),n.jsx("p",{className:"jx-login-sub",children:"Sign in with your operator credentials to continue."}),n.jsxs("label",{className:"jx-login-field",children:["Username",n.jsx("input",{type:"text",autoComplete:"username",value:r,onChange:x=>c(x.target.value),autoFocus:!0,required:!0})]}),n.jsxs("label",{className:"jx-login-field",children:["Password",n.jsx("input",{type:"password",autoComplete:"current-password",value:u,onChange:x=>f(x.target.value),required:!0})]}),h?n.jsx("div",{className:"jx-login-error",children:h}):null,n.jsx("button",{type:"submit",className:"jx-login-btn",disabled:p||!r||!u,children:p?"Signing in…":"Sign in"}),n.jsxs("div",{className:"jx-login-foot",children:["Authix · ",a]})]})})}function gE(){const{mode:a,loginUrl:s,loggedOut:r,brandName:c}=Wf();return a==="sso"&&s?r?n.jsx(pE,{loginUrl:s,brandName:c}):n.jsx(mE,{loginUrl:s,brandName:c}):a===null?n.jsx("div",{className:"jx-login-shell",children:n.jsxs("div",{className:"jx-login-card",children:[n.jsx(jo,{name:c}),n.jsx("div",{className:"jx-login-spinner","aria-hidden":"true"}),n.jsx("p",{className:"jx-login-sub",role:"status","aria-live":"polite",children:"Connecting to sign-in service…"}),n.jsxs("div",{className:"jx-login-foot",children:["Authix · ",c]})]})}):a==="disabled"?null:n.jsx(yE,{brandName:c})}const vE=new O0({defaultOptions:{queries:{retry:1,staleTime:2e3}}});function xE(){const{status:a,authDisabled:s,user:r,logout:c}=Wf();return a==="loading"?n.jsx("div",{className:"jx-auth-splash",children:"Loading…"}):a==="anonymous"?n.jsx(gE,{}):n.jsxs(n.Fragment,{children:[n.jsx(rE,{children:n.jsx(K0,{storageKey:"exellix-memorix-ui.selected-agent",children:n.jsx(fE,{})})}),!s&&n.jsxs("button",{type:"button",className:"jx-logout-btn",onClick:()=>void c(),title:r!=null&&r.displayName?`Signed in as ${r.displayName}`:"Sign out",children:["Sign out",r!=null&&r.displayName?` · ${r.displayName}`:""]})]})}const Mx=document.getElementById("root");if(!Mx)throw new Error("No #root element");a0.createRoot(Mx).render(n.jsx(S.StrictMode,{children:n.jsx(M0,{client:vE,children:n.jsx(hE,{children:n.jsx(xE,{})})})}));