bullpane 0.6.2 → 0.7.0

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,553 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowsPage-Cp6TR7Wa.js","assets/style-J6Fkg5PC.js","assets/style-BnuhLJ6X.css","assets/FlowsPage-C1DrWzZu.css","assets/JobTreePage-CbwbeeRl.js"])))=>i.map(i=>d[i]);
2
+ var ob=Object.defineProperty;var pg=e=>{throw TypeError(e)};var cb=(e,n,r)=>n in e?ob(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var Uh=(e,n,r)=>cb(e,typeof n!="symbol"?n+"":n,r),Qh=(e,n,r)=>n.has(e)||pg("Cannot "+r);var _=(e,n,r)=>(Qh(e,n,"read from private field"),r?r.call(e):n.get(e)),ge=(e,n,r)=>n.has(e)?pg("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,r),ne=(e,n,r,i)=>(Qh(e,n,"write to private field"),i?i.call(e,r):n.set(e,r),r),Me=(e,n,r)=>(Qh(e,n,"access private method"),r);var ou=(e,n,r,i)=>({set _(o){ne(e,n,o,r)},get _(){return _(e,n,i)}});function ub(e,n){for(var r=0;r<n.length;r++){const i=n[r];if(typeof i!="string"&&!Array.isArray(i)){for(const o in i)if(o!=="default"&&!(o in e)){const c=Object.getOwnPropertyDescriptor(i,o);c&&Object.defineProperty(e,o,c.get?c:{enumerable:!0,get:()=>i[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function r(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(o){if(o.ep)return;o.ep=!0;const c=r(o);fetch(o.href,c)}})();function db(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bh={exports:{}},ro={},Vh={exports:{}},We={};/**
3
+ * @license React
4
+ * react.production.min.js
5
+ *
6
+ * Copyright (c) Facebook, Inc. and its affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var xg;function hb(){if(xg)return We;xg=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),v=Symbol.iterator;function j(A){return A===null||typeof A!="object"?null:(A=v&&A[v]||A["@@iterator"],typeof A=="function"?A:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,b={};function k(A,Z,Fe){this.props=A,this.context=Z,this.refs=b,this.updater=Fe||S}k.prototype.isReactComponent={},k.prototype.setState=function(A,Z){if(typeof A!="object"&&typeof A!="function"&&A!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,A,Z,"setState")},k.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function C(){}C.prototype=k.prototype;function z(A,Z,Fe){this.props=A,this.context=Z,this.refs=b,this.updater=Fe||S}var O=z.prototype=new C;O.constructor=z,y(O,k.prototype),O.isPureReactComponent=!0;var T=Array.isArray,M=Object.prototype.hasOwnProperty,E={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function Q(A,Z,Fe){var Ue,Se={},Qe=null,rt=null;if(Z!=null)for(Ue in Z.ref!==void 0&&(rt=Z.ref),Z.key!==void 0&&(Qe=""+Z.key),Z)M.call(Z,Ue)&&!I.hasOwnProperty(Ue)&&(Se[Ue]=Z[Ue]);var He=arguments.length-2;if(He===1)Se.children=Fe;else if(1<He){for(var at=Array(He),Zt=0;Zt<He;Zt++)at[Zt]=arguments[Zt+2];Se.children=at}if(A&&A.defaultProps)for(Ue in He=A.defaultProps,He)Se[Ue]===void 0&&(Se[Ue]=He[Ue]);return{$$typeof:e,type:A,key:Qe,ref:rt,props:Se,_owner:E.current}}function H(A,Z){return{$$typeof:e,type:A.type,key:Z,ref:A.ref,props:A.props,_owner:A._owner}}function q(A){return typeof A=="object"&&A!==null&&A.$$typeof===e}function B(A){var Z={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(Fe){return Z[Fe]})}var de=/\/+/g;function ce(A,Z){return typeof A=="object"&&A!==null&&A.key!=null?B(""+A.key):Z.toString(36)}function Ne(A,Z,Fe,Ue,Se){var Qe=typeof A;(Qe==="undefined"||Qe==="boolean")&&(A=null);var rt=!1;if(A===null)rt=!0;else switch(Qe){case"string":case"number":rt=!0;break;case"object":switch(A.$$typeof){case e:case n:rt=!0}}if(rt)return rt=A,Se=Se(rt),A=Ue===""?"."+ce(rt,0):Ue,T(Se)?(Fe="",A!=null&&(Fe=A.replace(de,"$&/")+"/"),Ne(Se,Z,Fe,"",function(Zt){return Zt})):Se!=null&&(q(Se)&&(Se=H(Se,Fe+(!Se.key||rt&&rt.key===Se.key?"":(""+Se.key).replace(de,"$&/")+"/")+A)),Z.push(Se)),1;if(rt=0,Ue=Ue===""?".":Ue+":",T(A))for(var He=0;He<A.length;He++){Qe=A[He];var at=Ue+ce(Qe,He);rt+=Ne(Qe,Z,Fe,at,Se)}else if(at=j(A),typeof at=="function")for(A=at.call(A),He=0;!(Qe=A.next()).done;)Qe=Qe.value,at=Ue+ce(Qe,He++),rt+=Ne(Qe,Z,Fe,at,Se);else if(Qe==="object")throw Z=String(A),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.");return rt}function Ie(A,Z,Fe){if(A==null)return A;var Ue=[],Se=0;return Ne(A,Ue,"","",function(Qe){return Z.call(Fe,Qe,Se++)}),Ue}function ot(A){if(A._status===-1){var Z=A._result;Z=Z(),Z.then(function(Fe){(A._status===0||A._status===-1)&&(A._status=1,A._result=Fe)},function(Fe){(A._status===0||A._status===-1)&&(A._status=2,A._result=Fe)}),A._status===-1&&(A._status=0,A._result=Z)}if(A._status===1)return A._result.default;throw A._result}var De={current:null},W={transition:null},me={ReactCurrentDispatcher:De,ReactCurrentBatchConfig:W,ReactCurrentOwner:E};function re(){throw Error("act(...) is not supported in production builds of React.")}return We.Children={map:Ie,forEach:function(A,Z,Fe){Ie(A,function(){Z.apply(this,arguments)},Fe)},count:function(A){var Z=0;return Ie(A,function(){Z++}),Z},toArray:function(A){return Ie(A,function(Z){return Z})||[]},only:function(A){if(!q(A))throw Error("React.Children.only expected to receive a single React element child.");return A}},We.Component=k,We.Fragment=r,We.Profiler=o,We.PureComponent=z,We.StrictMode=i,We.Suspense=f,We.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=me,We.act=re,We.cloneElement=function(A,Z,Fe){if(A==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+A+".");var Ue=y({},A.props),Se=A.key,Qe=A.ref,rt=A._owner;if(Z!=null){if(Z.ref!==void 0&&(Qe=Z.ref,rt=E.current),Z.key!==void 0&&(Se=""+Z.key),A.type&&A.type.defaultProps)var He=A.type.defaultProps;for(at in Z)M.call(Z,at)&&!I.hasOwnProperty(at)&&(Ue[at]=Z[at]===void 0&&He!==void 0?He[at]:Z[at])}var at=arguments.length-2;if(at===1)Ue.children=Fe;else if(1<at){He=Array(at);for(var Zt=0;Zt<at;Zt++)He[Zt]=arguments[Zt+2];Ue.children=He}return{$$typeof:e,type:A.type,key:Se,ref:Qe,props:Ue,_owner:rt}},We.createContext=function(A){return A={$$typeof:d,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},A.Provider={$$typeof:c,_context:A},A.Consumer=A},We.createElement=Q,We.createFactory=function(A){var Z=Q.bind(null,A);return Z.type=A,Z},We.createRef=function(){return{current:null}},We.forwardRef=function(A){return{$$typeof:h,render:A}},We.isValidElement=q,We.lazy=function(A){return{$$typeof:p,_payload:{_status:-1,_result:A},_init:ot}},We.memo=function(A,Z){return{$$typeof:g,type:A,compare:Z===void 0?null:Z}},We.startTransition=function(A){var Z=W.transition;W.transition={};try{A()}finally{W.transition=Z}},We.unstable_act=re,We.useCallback=function(A,Z){return De.current.useCallback(A,Z)},We.useContext=function(A){return De.current.useContext(A)},We.useDebugValue=function(){},We.useDeferredValue=function(A){return De.current.useDeferredValue(A)},We.useEffect=function(A,Z){return De.current.useEffect(A,Z)},We.useId=function(){return De.current.useId()},We.useImperativeHandle=function(A,Z,Fe){return De.current.useImperativeHandle(A,Z,Fe)},We.useInsertionEffect=function(A,Z){return De.current.useInsertionEffect(A,Z)},We.useLayoutEffect=function(A,Z){return De.current.useLayoutEffect(A,Z)},We.useMemo=function(A,Z){return De.current.useMemo(A,Z)},We.useReducer=function(A,Z,Fe){return De.current.useReducer(A,Z,Fe)},We.useRef=function(A){return De.current.useRef(A)},We.useState=function(A){return De.current.useState(A)},We.useSyncExternalStore=function(A,Z,Fe){return De.current.useSyncExternalStore(A,Z,Fe)},We.useTransition=function(){return De.current.useTransition()},We.version="18.3.1",We}var gg;function Gf(){return gg||(gg=1,Vh.exports=hb()),Vh.exports}/**
11
+ * @license React
12
+ * react-jsx-runtime.production.min.js
13
+ *
14
+ * Copyright (c) Facebook, Inc. and its affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var vg;function fb(){if(vg)return ro;vg=1;var e=Gf(),n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(h,f,g){var p,v={},j=null,S=null;g!==void 0&&(j=""+g),f.key!==void 0&&(j=""+f.key),f.ref!==void 0&&(S=f.ref);for(p in f)i.call(f,p)&&!c.hasOwnProperty(p)&&(v[p]=f[p]);if(h&&h.defaultProps)for(p in f=h.defaultProps,f)v[p]===void 0&&(v[p]=f[p]);return{$$typeof:n,type:h,key:j,ref:S,props:v,_owner:o.current}}return ro.Fragment=r,ro.jsx=d,ro.jsxs=d,ro}var yg;function mb(){return yg||(yg=1,Bh.exports=fb()),Bh.exports}var t=mb(),w=Gf();const pb=db(w),xb=ub({__proto__:null,default:pb},[w]);var cu={},Hh={exports:{}},_n={},Kh={exports:{}},Wh={};/**
19
+ * @license React
20
+ * scheduler.production.min.js
21
+ *
22
+ * Copyright (c) Facebook, Inc. and its affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var jg;function gb(){return jg||(jg=1,(function(e){function n(W,me){var re=W.length;W.push(me);e:for(;0<re;){var A=re-1>>>1,Z=W[A];if(0<o(Z,me))W[A]=me,W[re]=Z,re=A;else break e}}function r(W){return W.length===0?null:W[0]}function i(W){if(W.length===0)return null;var me=W[0],re=W.pop();if(re!==me){W[0]=re;e:for(var A=0,Z=W.length,Fe=Z>>>1;A<Fe;){var Ue=2*(A+1)-1,Se=W[Ue],Qe=Ue+1,rt=W[Qe];if(0>o(Se,re))Qe<Z&&0>o(rt,Se)?(W[A]=rt,W[Qe]=re,A=Qe):(W[A]=Se,W[Ue]=re,A=Ue);else if(Qe<Z&&0>o(rt,re))W[A]=rt,W[Qe]=re,A=Qe;else break e}}return me}function o(W,me){var re=W.sortIndex-me.sortIndex;return re!==0?re:W.id-me.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,h=d.now();e.unstable_now=function(){return d.now()-h}}var f=[],g=[],p=1,v=null,j=3,S=!1,y=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function O(W){for(var me=r(g);me!==null;){if(me.callback===null)i(g);else if(me.startTime<=W)i(g),me.sortIndex=me.expirationTime,n(f,me);else break;me=r(g)}}function T(W){if(b=!1,O(W),!y)if(r(f)!==null)y=!0,ot(M);else{var me=r(g);me!==null&&De(T,me.startTime-W)}}function M(W,me){y=!1,b&&(b=!1,C(Q),Q=-1),S=!0;var re=j;try{for(O(me),v=r(f);v!==null&&(!(v.expirationTime>me)||W&&!B());){var A=v.callback;if(typeof A=="function"){v.callback=null,j=v.priorityLevel;var Z=A(v.expirationTime<=me);me=e.unstable_now(),typeof Z=="function"?v.callback=Z:v===r(f)&&i(f),O(me)}else i(f);v=r(f)}if(v!==null)var Fe=!0;else{var Ue=r(g);Ue!==null&&De(T,Ue.startTime-me),Fe=!1}return Fe}finally{v=null,j=re,S=!1}}var E=!1,I=null,Q=-1,H=5,q=-1;function B(){return!(e.unstable_now()-q<H)}function de(){if(I!==null){var W=e.unstable_now();q=W;var me=!0;try{me=I(!0,W)}finally{me?ce():(E=!1,I=null)}}else E=!1}var ce;if(typeof z=="function")ce=function(){z(de)};else if(typeof MessageChannel<"u"){var Ne=new MessageChannel,Ie=Ne.port2;Ne.port1.onmessage=de,ce=function(){Ie.postMessage(null)}}else ce=function(){k(de,0)};function ot(W){I=W,E||(E=!0,ce())}function De(W,me){Q=k(function(){W(e.unstable_now())},me)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(W){W.callback=null},e.unstable_continueExecution=function(){y||S||(y=!0,ot(M))},e.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<W?Math.floor(1e3/W):5},e.unstable_getCurrentPriorityLevel=function(){return j},e.unstable_getFirstCallbackNode=function(){return r(f)},e.unstable_next=function(W){switch(j){case 1:case 2:case 3:var me=3;break;default:me=j}var re=j;j=me;try{return W()}finally{j=re}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(W,me){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var re=j;j=W;try{return me()}finally{j=re}},e.unstable_scheduleCallback=function(W,me,re){var A=e.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?A+re:A):re=A,W){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=re+Z,W={id:p++,callback:me,priorityLevel:W,startTime:re,expirationTime:Z,sortIndex:-1},re>A?(W.sortIndex=re,n(g,W),r(f)===null&&W===r(g)&&(b?(C(Q),Q=-1):b=!0,De(T,re-A))):(W.sortIndex=Z,n(f,W),y||S||(y=!0,ot(M))),W},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(W){var me=j;return function(){var re=j;j=me;try{return W.apply(this,arguments)}finally{j=re}}}})(Wh)),Wh}var bg;function vb(){return bg||(bg=1,Kh.exports=gb()),Kh.exports}/**
27
+ * @license React
28
+ * react-dom.production.min.js
29
+ *
30
+ * Copyright (c) Facebook, Inc. and its affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var wg;function yb(){if(wg)return _n;wg=1;var e=Gf(),n=vb();function r(s){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+s,l=1;l<arguments.length;l++)a+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,o={};function c(s,a){d(s,a),d(s+"Capture",a)}function d(s,a){for(o[s]=a,s=0;s<a.length;s++)i.add(a[s])}var h=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,g=/^[: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]*$/,p={},v={};function j(s){return f.call(v,s)?!0:f.call(p,s)?!1:g.test(s)?v[s]=!0:(p[s]=!0,!1)}function S(s,a,l,u){if(l!==null&&l.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return u?!1:l!==null?!l.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function y(s,a,l,u){if(a===null||typeof a>"u"||S(s,a,l,u))return!0;if(u)return!1;if(l!==null)switch(l.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function b(s,a,l,u,m,x,N){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=u,this.attributeNamespace=m,this.mustUseProperty=l,this.propertyName=s,this.type=a,this.sanitizeURL=x,this.removeEmptyString=N}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){k[s]=new b(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var a=s[0];k[a]=new b(a,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){k[s]=new b(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){k[s]=new b(s,2,!1,s,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(s){k[s]=new b(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){k[s]=new b(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){k[s]=new b(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){k[s]=new b(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){k[s]=new b(s,5,!1,s.toLowerCase(),null,!1,!1)});var C=/[\-:]([a-z])/g;function z(s){return s[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(s){var a=s.replace(C,z);k[a]=new b(a,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var a=s.replace(C,z);k[a]=new b(a,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var a=s.replace(C,z);k[a]=new b(a,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){k[s]=new b(s,1,!1,s.toLowerCase(),null,!1,!1)}),k.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){k[s]=new b(s,1,!1,s.toLowerCase(),null,!0,!0)});function O(s,a,l,u){var m=k.hasOwnProperty(a)?k[a]:null;(m!==null?m.type!==0:u||!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(y(a,l,m,u)&&(l=null),u||m===null?j(a)&&(l===null?s.removeAttribute(a):s.setAttribute(a,""+l)):m.mustUseProperty?s[m.propertyName]=l===null?m.type===3?!1:"":l:(a=m.attributeName,u=m.attributeNamespace,l===null?s.removeAttribute(a):(m=m.type,l=m===3||m===4&&l===!0?"":""+l,u?s.setAttributeNS(u,a,l):s.setAttribute(a,l))))}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,M=Symbol.for("react.element"),E=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),q=Symbol.for("react.provider"),B=Symbol.for("react.context"),de=Symbol.for("react.forward_ref"),ce=Symbol.for("react.suspense"),Ne=Symbol.for("react.suspense_list"),Ie=Symbol.for("react.memo"),ot=Symbol.for("react.lazy"),De=Symbol.for("react.offscreen"),W=Symbol.iterator;function me(s){return s===null||typeof s!="object"?null:(s=W&&s[W]||s["@@iterator"],typeof s=="function"?s:null)}var re=Object.assign,A;function Z(s){if(A===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);A=a&&a[1]||""}return`
35
+ `+A+s}var Fe=!1;function Ue(s,a){if(!s||Fe)return"";Fe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(U){var u=U}Reflect.construct(s,[],a)}else{try{a.call()}catch(U){u=U}s.call(a.prototype)}else{try{throw Error()}catch(U){u=U}s()}}catch(U){if(U&&u&&typeof U.stack=="string"){for(var m=U.stack.split(`
36
+ `),x=u.stack.split(`
37
+ `),N=m.length-1,P=x.length-1;1<=N&&0<=P&&m[N]!==x[P];)P--;for(;1<=N&&0<=P;N--,P--)if(m[N]!==x[P]){if(N!==1||P!==1)do if(N--,P--,0>P||m[N]!==x[P]){var R=`
38
+ `+m[N].replace(" at new "," at ");return s.displayName&&R.includes("<anonymous>")&&(R=R.replace("<anonymous>",s.displayName)),R}while(1<=N&&0<=P);break}}}finally{Fe=!1,Error.prepareStackTrace=l}return(s=s?s.displayName||s.name:"")?Z(s):""}function Se(s){switch(s.tag){case 5:return Z(s.type);case 16:return Z("Lazy");case 13:return Z("Suspense");case 19:return Z("SuspenseList");case 0:case 2:case 15:return s=Ue(s.type,!1),s;case 11:return s=Ue(s.type.render,!1),s;case 1:return s=Ue(s.type,!0),s;default:return""}}function Qe(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case I:return"Fragment";case E:return"Portal";case H:return"Profiler";case Q:return"StrictMode";case ce:return"Suspense";case Ne:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case B:return(s.displayName||"Context")+".Consumer";case q:return(s._context.displayName||"Context")+".Provider";case de:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case Ie:return a=s.displayName||null,a!==null?a:Qe(s.type)||"Memo";case ot:a=s._payload,s=s._init;try{return Qe(s(a))}catch{}}return null}function rt(s){var a=s.type;switch(s.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=a.render,s=s.displayName||s.name||"",a.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qe(a);case 8:return a===Q?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function He(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function at(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Zt(s){var a=at(s)?"checked":"value",l=Object.getOwnPropertyDescriptor(s.constructor.prototype,a),u=""+s[a];if(!s.hasOwnProperty(a)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var m=l.get,x=l.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return m.call(this)},set:function(N){u=""+N,x.call(this,N)}}),Object.defineProperty(s,a,{enumerable:l.enumerable}),{getValue:function(){return u},setValue:function(N){u=""+N},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function lr(s){s._valueTracker||(s._valueTracker=Zt(s))}function ul(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var l=a.getValue(),u="";return s&&(u=at(s)?s.checked?"true":"false":s.value),s=u,s!==l?(a.setValue(s),!0):!1}function Za(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function Yr(s,a){var l=a.checked;return re({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??s._wrapperState.initialChecked})}function ea(s,a){var l=a.defaultValue==null?"":a.defaultValue,u=a.checked!=null?a.checked:a.defaultChecked;l=He(a.value!=null?a.value:l),s._wrapperState={initialChecked:u,initialValue:l,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function Ga(s,a){a=a.checked,a!=null&&O(s,"checked",a,!1)}function ta(s,a){Ga(s,a);var l=He(a.value),u=a.type;if(l!=null)u==="number"?(l===0&&s.value===""||s.value!=l)&&(s.value=""+l):s.value!==""+l&&(s.value=""+l);else if(u==="submit"||u==="reset"){s.removeAttribute("value");return}a.hasOwnProperty("value")?dl(s,a.type,l):a.hasOwnProperty("defaultValue")&&dl(s,a.type,He(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(s.defaultChecked=!!a.defaultChecked)}function Ja(s,a,l){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var u=a.type;if(!(u!=="submit"&&u!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+s._wrapperState.initialValue,l||a===s.value||(s.value=a),s.defaultValue=a}l=s.name,l!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,l!==""&&(s.name=l)}function dl(s,a,l){(a!=="number"||Za(s.ownerDocument)!==s)&&(l==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+l&&(s.defaultValue=""+l))}var or=Array.isArray;function Rn(s,a,l,u){if(s=s.options,a){a={};for(var m=0;m<l.length;m++)a["$"+l[m]]=!0;for(l=0;l<s.length;l++)m=a.hasOwnProperty("$"+s[l].value),s[l].selected!==m&&(s[l].selected=m),m&&u&&(s[l].defaultSelected=!0)}else{for(l=""+He(l),a=null,m=0;m<s.length;m++){if(s[m].value===l){s[m].selected=!0,u&&(s[m].defaultSelected=!0);return}a!==null||s[m].disabled||(a=s[m])}a!==null&&(a.selected=!0)}}function Ut(s,a){if(a.dangerouslySetInnerHTML!=null)throw Error(r(91));return re({},a,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function Ko(s,a){var l=a.value;if(l==null){if(l=a.children,a=a.defaultValue,l!=null){if(a!=null)throw Error(r(92));if(or(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),l=a}s._wrapperState={initialValue:He(l)}}function Xa(s,a){var l=He(a.value),u=He(a.defaultValue);l!=null&&(l=""+l,l!==s.value&&(s.value=l),a.defaultValue==null&&s.defaultValue!==l&&(s.defaultValue=l)),u!=null&&(s.defaultValue=""+u)}function Qn(s){var a=s.textContent;a===s._wrapperState.initialValue&&a!==""&&a!==null&&(s.value=a)}function Wo(s){switch(s){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ya(s,a){return s==null||s==="http://www.w3.org/1999/xhtml"?Wo(a):s==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var na,vs=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,l,u,m){MSApp.execUnsafeLocalFunction(function(){return s(a,l,u,m)})}:s})(function(s,a){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=a;else{for(na=na||document.createElement("div"),na.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=na.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;a.firstChild;)s.appendChild(a.firstChild)}});function zs(s,a){if(a){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=a;return}}s.textContent=a}var Os={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Nt=["Webkit","ms","Moz","O"];Object.keys(Os).forEach(function(s){Nt.forEach(function(a){a=a+s.charAt(0).toUpperCase()+s.substring(1),Os[a]=Os[s]})});function hl(s,a,l){return a==null||typeof a=="boolean"||a===""?"":l||typeof a!="number"||a===0||Os.hasOwnProperty(s)&&Os[s]?(""+a).trim():a+"px"}function Ot(s,a){s=s.style;for(var l in a)if(a.hasOwnProperty(l)){var u=l.indexOf("--")===0,m=hl(l,a[l],u);l==="float"&&(l="cssFloat"),u?s.setProperty(l,m):s[l]=m}}var Zo=re({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function fl(s,a){if(a){if(Zo[s]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(r(137,s));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(r(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(r(61))}if(a.style!=null&&typeof a.style!="object")throw Error(r(62))}}function sa(s,a){if(s.indexOf("-")===-1)return typeof a.is=="string";switch(s){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 ei=null;function ti(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ni=null,As=null,Bn=null;function Go(s){if(s=Ql(s)){if(typeof ni!="function")throw Error(r(280));var a=s.stateNode;a&&(a=Nc(a),ni(s.stateNode,s.type,a))}}function ra(s){As?Bn?Bn.push(s):Bn=[s]:As=s}function ml(){if(As){var s=As,a=Bn;if(Bn=As=null,Go(s),a)for(s=0;s<a.length;s++)Go(a[s])}}function pl(s,a){return s(a)}function xl(){}var si=!1;function gl(s,a,l){if(si)return s(a,l);si=!0;try{return pl(s,a,l)}finally{si=!1,(As!==null||Bn!==null)&&(xl(),ml())}}function cr(s,a){var l=s.stateNode;if(l===null)return null;var u=Nc(l);if(u===null)return null;l=u[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(s=s.type,u=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!u;break e;default:s=!1}if(s)return null;if(l&&typeof l!="function")throw Error(r(231,a,typeof l));return l}var ri=!1;if(h)try{var ur={};Object.defineProperty(ur,"passive",{get:function(){ri=!0}}),window.addEventListener("test",ur,ur),window.removeEventListener("test",ur,ur)}catch{ri=!1}function Jo(s,a,l,u,m,x,N,P,R){var U=Array.prototype.slice.call(arguments,3);try{a.apply(l,U)}catch(J){this.onError(J)}}var dr=!1,aa=null,ia=!1,ai=null,Xo={onError:function(s){dr=!0,aa=s}};function Yo(s,a,l,u,m,x,N,P,R){dr=!1,aa=null,Jo.apply(Xo,arguments)}function ec(s,a,l,u,m,x,N,P,R){if(Yo.apply(this,arguments),dr){if(dr){var U=aa;dr=!1,aa=null}else throw Error(r(198));ia||(ia=!0,ai=U)}}function ys(s){var a=s,l=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(l=a.return),s=a.return;while(s)}return a.tag===3?l:null}function vl(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function yl(s){if(ys(s)!==s)throw Error(r(188))}function tc(s){var a=s.alternate;if(!a){if(a=ys(s),a===null)throw Error(r(188));return a!==s?null:s}for(var l=s,u=a;;){var m=l.return;if(m===null)break;var x=m.alternate;if(x===null){if(u=m.return,u!==null){l=u;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===l)return yl(m),s;if(x===u)return yl(m),a;x=x.sibling}throw Error(r(188))}if(l.return!==u.return)l=m,u=x;else{for(var N=!1,P=m.child;P;){if(P===l){N=!0,l=m,u=x;break}if(P===u){N=!0,u=m,l=x;break}P=P.sibling}if(!N){for(P=x.child;P;){if(P===l){N=!0,l=x,u=m;break}if(P===u){N=!0,u=x,l=m;break}P=P.sibling}if(!N)throw Error(r(189))}}if(l.alternate!==u)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?s:a}function jl(s){return s=tc(s),s!==null?bl(s):null}function bl(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var a=bl(s);if(a!==null)return a;s=s.sibling}return null}var wl=n.unstable_scheduleCallback,Nl=n.unstable_cancelCallback,nc=n.unstable_shouldYield,sc=n.unstable_requestPaint,gt=n.unstable_now,le=n.unstable_getCurrentPriorityLevel,nt=n.unstable_ImmediatePriority,et=n.unstable_UserBlockingPriority,Tt=n.unstable_NormalPriority,kl=n.unstable_LowPriority,Vm=n.unstable_IdlePriority,rc=null,js=null;function Nj(s){if(js&&typeof js.onCommitFiberRoot=="function")try{js.onCommitFiberRoot(rc,s,void 0,(s.current.flags&128)===128)}catch{}}var rs=Math.clz32?Math.clz32:Cj,kj=Math.log,Sj=Math.LN2;function Cj(s){return s>>>=0,s===0?32:31-(kj(s)/Sj|0)|0}var ac=64,ic=4194304;function Sl(s){switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function lc(s,a){var l=s.pendingLanes;if(l===0)return 0;var u=0,m=s.suspendedLanes,x=s.pingedLanes,N=l&268435455;if(N!==0){var P=N&~m;P!==0?u=Sl(P):(x&=N,x!==0&&(u=Sl(x)))}else N=l&~m,N!==0?u=Sl(N):x!==0&&(u=Sl(x));if(u===0)return 0;if(a!==0&&a!==u&&(a&m)===0&&(m=u&-u,x=a&-a,m>=x||m===16&&(x&4194240)!==0))return a;if((u&4)!==0&&(u|=l&16),a=s.entangledLanes,a!==0)for(s=s.entanglements,a&=u;0<a;)l=31-rs(a),m=1<<l,u|=s[l],a&=~m;return u}function _j(s,a){switch(s){case 1:case 2:case 4:return a+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Pj(s,a){for(var l=s.suspendedLanes,u=s.pingedLanes,m=s.expirationTimes,x=s.pendingLanes;0<x;){var N=31-rs(x),P=1<<N,R=m[N];R===-1?((P&l)===0||(P&u)!==0)&&(m[N]=_j(P,a)):R<=a&&(s.expiredLanes|=P),x&=~P}}function cd(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function Hm(){var s=ac;return ac<<=1,(ac&4194240)===0&&(ac=64),s}function ud(s){for(var a=[],l=0;31>l;l++)a.push(s);return a}function Cl(s,a,l){s.pendingLanes|=a,a!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,a=31-rs(a),s[a]=l}function Ej(s,a){var l=s.pendingLanes&~a;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=a,s.mutableReadLanes&=a,s.entangledLanes&=a,a=s.entanglements;var u=s.eventTimes;for(s=s.expirationTimes;0<l;){var m=31-rs(l),x=1<<m;a[m]=0,u[m]=-1,s[m]=-1,l&=~x}}function dd(s,a){var l=s.entangledLanes|=a;for(s=s.entanglements;l;){var u=31-rs(l),m=1<<u;m&a|s[u]&a&&(s[u]|=a),l&=~m}}var it=0;function Km(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Wm,hd,Zm,Gm,Jm,fd=!1,oc=[],hr=null,fr=null,mr=null,_l=new Map,Pl=new Map,pr=[],Rj="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Xm(s,a){switch(s){case"focusin":case"focusout":hr=null;break;case"dragenter":case"dragleave":fr=null;break;case"mouseover":case"mouseout":mr=null;break;case"pointerover":case"pointerout":_l.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pl.delete(a.pointerId)}}function El(s,a,l,u,m,x){return s===null||s.nativeEvent!==x?(s={blockedOn:a,domEventName:l,eventSystemFlags:u,nativeEvent:x,targetContainers:[m]},a!==null&&(a=Ql(a),a!==null&&hd(a)),s):(s.eventSystemFlags|=u,a=s.targetContainers,m!==null&&a.indexOf(m)===-1&&a.push(m),s)}function Mj(s,a,l,u,m){switch(a){case"focusin":return hr=El(hr,s,a,l,u,m),!0;case"dragenter":return fr=El(fr,s,a,l,u,m),!0;case"mouseover":return mr=El(mr,s,a,l,u,m),!0;case"pointerover":var x=m.pointerId;return _l.set(x,El(_l.get(x)||null,s,a,l,u,m)),!0;case"gotpointercapture":return x=m.pointerId,Pl.set(x,El(Pl.get(x)||null,s,a,l,u,m)),!0}return!1}function Ym(s){var a=la(s.target);if(a!==null){var l=ys(a);if(l!==null){if(a=l.tag,a===13){if(a=vl(l),a!==null){s.blockedOn=a,Jm(s.priority,function(){Zm(l)});return}}else if(a===3&&l.stateNode.current.memoizedState.isDehydrated){s.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}s.blockedOn=null}function cc(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var l=pd(s.domEventName,s.eventSystemFlags,a[0],s.nativeEvent);if(l===null){l=s.nativeEvent;var u=new l.constructor(l.type,l);ei=u,l.target.dispatchEvent(u),ei=null}else return a=Ql(l),a!==null&&hd(a),s.blockedOn=l,!1;a.shift()}return!0}function ep(s,a,l){cc(s)&&l.delete(a)}function Tj(){fd=!1,hr!==null&&cc(hr)&&(hr=null),fr!==null&&cc(fr)&&(fr=null),mr!==null&&cc(mr)&&(mr=null),_l.forEach(ep),Pl.forEach(ep)}function Rl(s,a){s.blockedOn===a&&(s.blockedOn=null,fd||(fd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Tj)))}function Ml(s){function a(m){return Rl(m,s)}if(0<oc.length){Rl(oc[0],s);for(var l=1;l<oc.length;l++){var u=oc[l];u.blockedOn===s&&(u.blockedOn=null)}}for(hr!==null&&Rl(hr,s),fr!==null&&Rl(fr,s),mr!==null&&Rl(mr,s),_l.forEach(a),Pl.forEach(a),l=0;l<pr.length;l++)u=pr[l],u.blockedOn===s&&(u.blockedOn=null);for(;0<pr.length&&(l=pr[0],l.blockedOn===null);)Ym(l),l.blockedOn===null&&pr.shift()}var ii=T.ReactCurrentBatchConfig,uc=!0;function qj(s,a,l,u){var m=it,x=ii.transition;ii.transition=null;try{it=1,md(s,a,l,u)}finally{it=m,ii.transition=x}}function $j(s,a,l,u){var m=it,x=ii.transition;ii.transition=null;try{it=4,md(s,a,l,u)}finally{it=m,ii.transition=x}}function md(s,a,l,u){if(uc){var m=pd(s,a,l,u);if(m===null)Td(s,a,u,dc,l),Xm(s,u);else if(Mj(m,s,a,l,u))u.stopPropagation();else if(Xm(s,u),a&4&&-1<Rj.indexOf(s)){for(;m!==null;){var x=Ql(m);if(x!==null&&Wm(x),x=pd(s,a,l,u),x===null&&Td(s,a,u,dc,l),x===m)break;m=x}m!==null&&u.stopPropagation()}else Td(s,a,u,null,l)}}var dc=null;function pd(s,a,l,u){if(dc=null,s=ti(u),s=la(s),s!==null)if(a=ys(s),a===null)s=null;else if(l=a.tag,l===13){if(s=vl(a),s!==null)return s;s=null}else if(l===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null);return dc=s,null}function tp(s){switch(s){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(le()){case nt:return 1;case et:return 4;case Tt:case kl:return 16;case Vm:return 536870912;default:return 16}default:return 16}}var xr=null,xd=null,hc=null;function np(){if(hc)return hc;var s,a=xd,l=a.length,u,m="value"in xr?xr.value:xr.textContent,x=m.length;for(s=0;s<l&&a[s]===m[s];s++);var N=l-s;for(u=1;u<=N&&a[l-u]===m[x-u];u++);return hc=m.slice(s,1<u?1-u:void 0)}function fc(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function mc(){return!0}function sp(){return!1}function Mn(s){function a(l,u,m,x,N){this._reactName=l,this._targetInst=m,this.type=u,this.nativeEvent=x,this.target=N,this.currentTarget=null;for(var P in s)s.hasOwnProperty(P)&&(l=s[P],this[P]=l?l(x):x[P]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?mc:sp,this.isPropagationStopped=sp,this}return re(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=mc)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=mc)},persist:function(){},isPersistent:mc}),a}var li={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gd=Mn(li),Tl=re({},li,{view:0,detail:0}),Ij=Mn(Tl),vd,yd,ql,pc=re({},Tl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:bd,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==ql&&(ql&&s.type==="mousemove"?(vd=s.screenX-ql.screenX,yd=s.screenY-ql.screenY):yd=vd=0,ql=s),vd)},movementY:function(s){return"movementY"in s?s.movementY:yd}}),rp=Mn(pc),zj=re({},pc,{dataTransfer:0}),Oj=Mn(zj),Aj=re({},Tl,{relatedTarget:0}),jd=Mn(Aj),Lj=re({},li,{animationName:0,elapsedTime:0,pseudoElement:0}),Fj=Mn(Lj),Dj=re({},li,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Uj=Mn(Dj),Qj=re({},li,{data:0}),ap=Mn(Qj),Bj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vj={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"},Hj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Kj(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=Hj[s])?!!a[s]:!1}function bd(){return Kj}var Wj=re({},Tl,{key:function(s){if(s.key){var a=Bj[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=fc(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Vj[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bd,charCode:function(s){return s.type==="keypress"?fc(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?fc(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Zj=Mn(Wj),Gj=re({},pc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ip=Mn(Gj),Jj=re({},Tl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bd}),Xj=Mn(Jj),Yj=re({},li,{propertyName:0,elapsedTime:0,pseudoElement:0}),e1=Mn(Yj),t1=re({},pc,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),n1=Mn(t1),s1=[9,13,27,32],wd=h&&"CompositionEvent"in window,$l=null;h&&"documentMode"in document&&($l=document.documentMode);var r1=h&&"TextEvent"in window&&!$l,lp=h&&(!wd||$l&&8<$l&&11>=$l),op=" ",cp=!1;function up(s,a){switch(s){case"keyup":return s1.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dp(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var oi=!1;function a1(s,a){switch(s){case"compositionend":return dp(a);case"keypress":return a.which!==32?null:(cp=!0,op);case"textInput":return s=a.data,s===op&&cp?null:s;default:return null}}function i1(s,a){if(oi)return s==="compositionend"||!wd&&up(s,a)?(s=np(),hc=xd=xr=null,oi=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return lp&&a.locale!=="ko"?null:a.data;default:return null}}var l1={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 hp(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!l1[s.type]:a==="textarea"}function fp(s,a,l,u){ra(u),a=jc(a,"onChange"),0<a.length&&(l=new gd("onChange","change",null,l,u),s.push({event:l,listeners:a}))}var Il=null,zl=null;function o1(s){Mp(s,0)}function xc(s){var a=fi(s);if(ul(a))return s}function c1(s,a){if(s==="change")return a}var mp=!1;if(h){var Nd;if(h){var kd="oninput"in document;if(!kd){var pp=document.createElement("div");pp.setAttribute("oninput","return;"),kd=typeof pp.oninput=="function"}Nd=kd}else Nd=!1;mp=Nd&&(!document.documentMode||9<document.documentMode)}function xp(){Il&&(Il.detachEvent("onpropertychange",gp),zl=Il=null)}function gp(s){if(s.propertyName==="value"&&xc(zl)){var a=[];fp(a,zl,s,ti(s)),gl(o1,a)}}function u1(s,a,l){s==="focusin"?(xp(),Il=a,zl=l,Il.attachEvent("onpropertychange",gp)):s==="focusout"&&xp()}function d1(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return xc(zl)}function h1(s,a){if(s==="click")return xc(a)}function f1(s,a){if(s==="input"||s==="change")return xc(a)}function m1(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var as=typeof Object.is=="function"?Object.is:m1;function Ol(s,a){if(as(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var l=Object.keys(s),u=Object.keys(a);if(l.length!==u.length)return!1;for(u=0;u<l.length;u++){var m=l[u];if(!f.call(a,m)||!as(s[m],a[m]))return!1}return!0}function vp(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function yp(s,a){var l=vp(s);s=0;for(var u;l;){if(l.nodeType===3){if(u=s+l.textContent.length,s<=a&&u>=a)return{node:l,offset:a-s};s=u}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=vp(l)}}function jp(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?jp(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function bp(){for(var s=window,a=Za();a instanceof s.HTMLIFrameElement;){try{var l=typeof a.contentWindow.location.href=="string"}catch{l=!1}if(l)s=a.contentWindow;else break;a=Za(s.document)}return a}function Sd(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}function p1(s){var a=bp(),l=s.focusedElem,u=s.selectionRange;if(a!==l&&l&&l.ownerDocument&&jp(l.ownerDocument.documentElement,l)){if(u!==null&&Sd(l)){if(a=u.start,s=u.end,s===void 0&&(s=a),"selectionStart"in l)l.selectionStart=a,l.selectionEnd=Math.min(s,l.value.length);else if(s=(a=l.ownerDocument||document)&&a.defaultView||window,s.getSelection){s=s.getSelection();var m=l.textContent.length,x=Math.min(u.start,m);u=u.end===void 0?x:Math.min(u.end,m),!s.extend&&x>u&&(m=u,u=x,x=m),m=yp(l,x);var N=yp(l,u);m&&N&&(s.rangeCount!==1||s.anchorNode!==m.node||s.anchorOffset!==m.offset||s.focusNode!==N.node||s.focusOffset!==N.offset)&&(a=a.createRange(),a.setStart(m.node,m.offset),s.removeAllRanges(),x>u?(s.addRange(a),s.extend(N.node,N.offset)):(a.setEnd(N.node,N.offset),s.addRange(a)))}}for(a=[],s=l;s=s.parentNode;)s.nodeType===1&&a.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<a.length;l++)s=a[l],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var x1=h&&"documentMode"in document&&11>=document.documentMode,ci=null,Cd=null,Al=null,_d=!1;function wp(s,a,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;_d||ci==null||ci!==Za(u)||(u=ci,"selectionStart"in u&&Sd(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Al&&Ol(Al,u)||(Al=u,u=jc(Cd,"onSelect"),0<u.length&&(a=new gd("onSelect","select",null,a,l),s.push({event:a,listeners:u}),a.target=ci)))}function gc(s,a){var l={};return l[s.toLowerCase()]=a.toLowerCase(),l["Webkit"+s]="webkit"+a,l["Moz"+s]="moz"+a,l}var ui={animationend:gc("Animation","AnimationEnd"),animationiteration:gc("Animation","AnimationIteration"),animationstart:gc("Animation","AnimationStart"),transitionend:gc("Transition","TransitionEnd")},Pd={},Np={};h&&(Np=document.createElement("div").style,"AnimationEvent"in window||(delete ui.animationend.animation,delete ui.animationiteration.animation,delete ui.animationstart.animation),"TransitionEvent"in window||delete ui.transitionend.transition);function vc(s){if(Pd[s])return Pd[s];if(!ui[s])return s;var a=ui[s],l;for(l in a)if(a.hasOwnProperty(l)&&l in Np)return Pd[s]=a[l];return s}var kp=vc("animationend"),Sp=vc("animationiteration"),Cp=vc("animationstart"),_p=vc("transitionend"),Pp=new Map,Ep="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function gr(s,a){Pp.set(s,a),c(a,[s])}for(var Ed=0;Ed<Ep.length;Ed++){var Rd=Ep[Ed],g1=Rd.toLowerCase(),v1=Rd[0].toUpperCase()+Rd.slice(1);gr(g1,"on"+v1)}gr(kp,"onAnimationEnd"),gr(Sp,"onAnimationIteration"),gr(Cp,"onAnimationStart"),gr("dblclick","onDoubleClick"),gr("focusin","onFocus"),gr("focusout","onBlur"),gr(_p,"onTransitionEnd"),d("onMouseEnter",["mouseout","mouseover"]),d("onMouseLeave",["mouseout","mouseover"]),d("onPointerEnter",["pointerout","pointerover"]),d("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ll="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(" "),y1=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ll));function Rp(s,a,l){var u=s.type||"unknown-event";s.currentTarget=l,ec(u,a,void 0,s),s.currentTarget=null}function Mp(s,a){a=(a&4)!==0;for(var l=0;l<s.length;l++){var u=s[l],m=u.event;u=u.listeners;e:{var x=void 0;if(a)for(var N=u.length-1;0<=N;N--){var P=u[N],R=P.instance,U=P.currentTarget;if(P=P.listener,R!==x&&m.isPropagationStopped())break e;Rp(m,P,U),x=R}else for(N=0;N<u.length;N++){if(P=u[N],R=P.instance,U=P.currentTarget,P=P.listener,R!==x&&m.isPropagationStopped())break e;Rp(m,P,U),x=R}}}if(ia)throw s=ai,ia=!1,ai=null,s}function pt(s,a){var l=a[Ad];l===void 0&&(l=a[Ad]=new Set);var u=s+"__bubble";l.has(u)||(Tp(a,s,2,!1),l.add(u))}function Md(s,a,l){var u=0;a&&(u|=4),Tp(l,s,u,a)}var yc="_reactListening"+Math.random().toString(36).slice(2);function Fl(s){if(!s[yc]){s[yc]=!0,i.forEach(function(l){l!=="selectionchange"&&(y1.has(l)||Md(l,!1,s),Md(l,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[yc]||(a[yc]=!0,Md("selectionchange",!1,a))}}function Tp(s,a,l,u){switch(tp(a)){case 1:var m=qj;break;case 4:m=$j;break;default:m=md}l=m.bind(null,a,l,s),m=void 0,!ri||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(m=!0),u?m!==void 0?s.addEventListener(a,l,{capture:!0,passive:m}):s.addEventListener(a,l,!0):m!==void 0?s.addEventListener(a,l,{passive:m}):s.addEventListener(a,l,!1)}function Td(s,a,l,u,m){var x=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var N=u.tag;if(N===3||N===4){var P=u.stateNode.containerInfo;if(P===m||P.nodeType===8&&P.parentNode===m)break;if(N===4)for(N=u.return;N!==null;){var R=N.tag;if((R===3||R===4)&&(R=N.stateNode.containerInfo,R===m||R.nodeType===8&&R.parentNode===m))return;N=N.return}for(;P!==null;){if(N=la(P),N===null)return;if(R=N.tag,R===5||R===6){u=x=N;continue e}P=P.parentNode}}u=u.return}gl(function(){var U=x,J=ti(l),Y=[];e:{var G=Pp.get(s);if(G!==void 0){var fe=gd,we=s;switch(s){case"keypress":if(fc(l)===0)break e;case"keydown":case"keyup":fe=Zj;break;case"focusin":we="focus",fe=jd;break;case"focusout":we="blur",fe=jd;break;case"beforeblur":case"afterblur":fe=jd;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":fe=rp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=Oj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=Xj;break;case kp:case Sp:case Cp:fe=Fj;break;case _p:fe=e1;break;case"scroll":fe=Ij;break;case"wheel":fe=n1;break;case"copy":case"cut":case"paste":fe=Uj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=ip}var ke=(a&4)!==0,Mt=!ke&&s==="scroll",L=ke?G!==null?G+"Capture":null:G;ke=[];for(var $=U,D;$!==null;){D=$;var ae=D.stateNode;if(D.tag===5&&ae!==null&&(D=ae,L!==null&&(ae=cr($,L),ae!=null&&ke.push(Dl($,ae,D)))),Mt)break;$=$.return}0<ke.length&&(G=new fe(G,we,null,l,J),Y.push({event:G,listeners:ke}))}}if((a&7)===0){e:{if(G=s==="mouseover"||s==="pointerover",fe=s==="mouseout"||s==="pointerout",G&&l!==ei&&(we=l.relatedTarget||l.fromElement)&&(la(we)||we[Ls]))break e;if((fe||G)&&(G=J.window===J?J:(G=J.ownerDocument)?G.defaultView||G.parentWindow:window,fe?(we=l.relatedTarget||l.toElement,fe=U,we=we?la(we):null,we!==null&&(Mt=ys(we),we!==Mt||we.tag!==5&&we.tag!==6)&&(we=null)):(fe=null,we=U),fe!==we)){if(ke=rp,ae="onMouseLeave",L="onMouseEnter",$="mouse",(s==="pointerout"||s==="pointerover")&&(ke=ip,ae="onPointerLeave",L="onPointerEnter",$="pointer"),Mt=fe==null?G:fi(fe),D=we==null?G:fi(we),G=new ke(ae,$+"leave",fe,l,J),G.target=Mt,G.relatedTarget=D,ae=null,la(J)===U&&(ke=new ke(L,$+"enter",we,l,J),ke.target=D,ke.relatedTarget=Mt,ae=ke),Mt=ae,fe&&we)t:{for(ke=fe,L=we,$=0,D=ke;D;D=di(D))$++;for(D=0,ae=L;ae;ae=di(ae))D++;for(;0<$-D;)ke=di(ke),$--;for(;0<D-$;)L=di(L),D--;for(;$--;){if(ke===L||L!==null&&ke===L.alternate)break t;ke=di(ke),L=di(L)}ke=null}else ke=null;fe!==null&&qp(Y,G,fe,ke,!1),we!==null&&Mt!==null&&qp(Y,Mt,we,ke,!0)}}e:{if(G=U?fi(U):window,fe=G.nodeName&&G.nodeName.toLowerCase(),fe==="select"||fe==="input"&&G.type==="file")var Ce=c1;else if(hp(G))if(mp)Ce=f1;else{Ce=d1;var qe=u1}else(fe=G.nodeName)&&fe.toLowerCase()==="input"&&(G.type==="checkbox"||G.type==="radio")&&(Ce=h1);if(Ce&&(Ce=Ce(s,U))){fp(Y,Ce,l,J);break e}qe&&qe(s,G,U),s==="focusout"&&(qe=G._wrapperState)&&qe.controlled&&G.type==="number"&&dl(G,"number",G.value)}switch(qe=U?fi(U):window,s){case"focusin":(hp(qe)||qe.contentEditable==="true")&&(ci=qe,Cd=U,Al=null);break;case"focusout":Al=Cd=ci=null;break;case"mousedown":_d=!0;break;case"contextmenu":case"mouseup":case"dragend":_d=!1,wp(Y,l,J);break;case"selectionchange":if(x1)break;case"keydown":case"keyup":wp(Y,l,J)}var $e;if(wd)e:{switch(s){case"compositionstart":var Oe="onCompositionStart";break e;case"compositionend":Oe="onCompositionEnd";break e;case"compositionupdate":Oe="onCompositionUpdate";break e}Oe=void 0}else oi?up(s,l)&&(Oe="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(Oe="onCompositionStart");Oe&&(lp&&l.locale!=="ko"&&(oi||Oe!=="onCompositionStart"?Oe==="onCompositionEnd"&&oi&&($e=np()):(xr=J,xd="value"in xr?xr.value:xr.textContent,oi=!0)),qe=jc(U,Oe),0<qe.length&&(Oe=new ap(Oe,s,null,l,J),Y.push({event:Oe,listeners:qe}),$e?Oe.data=$e:($e=dp(l),$e!==null&&(Oe.data=$e)))),($e=r1?a1(s,l):i1(s,l))&&(U=jc(U,"onBeforeInput"),0<U.length&&(J=new ap("onBeforeInput","beforeinput",null,l,J),Y.push({event:J,listeners:U}),J.data=$e))}Mp(Y,a)})}function Dl(s,a,l){return{instance:s,listener:a,currentTarget:l}}function jc(s,a){for(var l=a+"Capture",u=[];s!==null;){var m=s,x=m.stateNode;m.tag===5&&x!==null&&(m=x,x=cr(s,l),x!=null&&u.unshift(Dl(s,x,m)),x=cr(s,a),x!=null&&u.push(Dl(s,x,m))),s=s.return}return u}function di(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function qp(s,a,l,u,m){for(var x=a._reactName,N=[];l!==null&&l!==u;){var P=l,R=P.alternate,U=P.stateNode;if(R!==null&&R===u)break;P.tag===5&&U!==null&&(P=U,m?(R=cr(l,x),R!=null&&N.unshift(Dl(l,R,P))):m||(R=cr(l,x),R!=null&&N.push(Dl(l,R,P)))),l=l.return}N.length!==0&&s.push({event:a,listeners:N})}var j1=/\r\n?/g,b1=/\u0000|\uFFFD/g;function $p(s){return(typeof s=="string"?s:""+s).replace(j1,`
39
+ `).replace(b1,"")}function bc(s,a,l){if(a=$p(a),$p(s)!==a&&l)throw Error(r(425))}function wc(){}var qd=null,$d=null;function Id(s,a){return s==="textarea"||s==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var zd=typeof setTimeout=="function"?setTimeout:void 0,w1=typeof clearTimeout=="function"?clearTimeout:void 0,Ip=typeof Promise=="function"?Promise:void 0,N1=typeof queueMicrotask=="function"?queueMicrotask:typeof Ip<"u"?function(s){return Ip.resolve(null).then(s).catch(k1)}:zd;function k1(s){setTimeout(function(){throw s})}function Od(s,a){var l=a,u=0;do{var m=l.nextSibling;if(s.removeChild(l),m&&m.nodeType===8)if(l=m.data,l==="/$"){if(u===0){s.removeChild(m),Ml(a);return}u--}else l!=="$"&&l!=="$?"&&l!=="$!"||u++;l=m}while(l);Ml(a)}function vr(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return s}function zp(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="$"||l==="$!"||l==="$?"){if(a===0)return s;a--}else l==="/$"&&a++}s=s.previousSibling}return null}var hi=Math.random().toString(36).slice(2),bs="__reactFiber$"+hi,Ul="__reactProps$"+hi,Ls="__reactContainer$"+hi,Ad="__reactEvents$"+hi,S1="__reactListeners$"+hi,C1="__reactHandles$"+hi;function la(s){var a=s[bs];if(a)return a;for(var l=s.parentNode;l;){if(a=l[Ls]||l[bs]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(s=zp(s);s!==null;){if(l=s[bs])return l;s=zp(s)}return a}s=l,l=s.parentNode}return null}function Ql(s){return s=s[bs]||s[Ls],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function fi(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(r(33))}function Nc(s){return s[Ul]||null}var Ld=[],mi=-1;function yr(s){return{current:s}}function xt(s){0>mi||(s.current=Ld[mi],Ld[mi]=null,mi--)}function ht(s,a){mi++,Ld[mi]=s.current,s.current=a}var jr={},en=yr(jr),wn=yr(!1),oa=jr;function pi(s,a){var l=s.type.contextTypes;if(!l)return jr;var u=s.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===a)return u.__reactInternalMemoizedMaskedChildContext;var m={},x;for(x in l)m[x]=a[x];return u&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=a,s.__reactInternalMemoizedMaskedChildContext=m),m}function Nn(s){return s=s.childContextTypes,s!=null}function kc(){xt(wn),xt(en)}function Op(s,a,l){if(en.current!==jr)throw Error(r(168));ht(en,a),ht(wn,l)}function Ap(s,a,l){var u=s.stateNode;if(a=a.childContextTypes,typeof u.getChildContext!="function")return l;u=u.getChildContext();for(var m in u)if(!(m in a))throw Error(r(108,rt(s)||"Unknown",m));return re({},l,u)}function Sc(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||jr,oa=en.current,ht(en,s),ht(wn,wn.current),!0}function Lp(s,a,l){var u=s.stateNode;if(!u)throw Error(r(169));l?(s=Ap(s,a,oa),u.__reactInternalMemoizedMergedChildContext=s,xt(wn),xt(en),ht(en,s)):xt(wn),ht(wn,l)}var Fs=null,Cc=!1,Fd=!1;function Fp(s){Fs===null?Fs=[s]:Fs.push(s)}function _1(s){Cc=!0,Fp(s)}function br(){if(!Fd&&Fs!==null){Fd=!0;var s=0,a=it;try{var l=Fs;for(it=1;s<l.length;s++){var u=l[s];do u=u(!0);while(u!==null)}Fs=null,Cc=!1}catch(m){throw Fs!==null&&(Fs=Fs.slice(s+1)),wl(nt,br),m}finally{it=a,Fd=!1}}return null}var xi=[],gi=0,_c=null,Pc=0,Vn=[],Hn=0,ca=null,Ds=1,Us="";function ua(s,a){xi[gi++]=Pc,xi[gi++]=_c,_c=s,Pc=a}function Dp(s,a,l){Vn[Hn++]=Ds,Vn[Hn++]=Us,Vn[Hn++]=ca,ca=s;var u=Ds;s=Us;var m=32-rs(u)-1;u&=~(1<<m),l+=1;var x=32-rs(a)+m;if(30<x){var N=m-m%5;x=(u&(1<<N)-1).toString(32),u>>=N,m-=N,Ds=1<<32-rs(a)+m|l<<m|u,Us=x+s}else Ds=1<<x|l<<m|u,Us=s}function Dd(s){s.return!==null&&(ua(s,1),Dp(s,1,0))}function Ud(s){for(;s===_c;)_c=xi[--gi],xi[gi]=null,Pc=xi[--gi],xi[gi]=null;for(;s===ca;)ca=Vn[--Hn],Vn[Hn]=null,Us=Vn[--Hn],Vn[Hn]=null,Ds=Vn[--Hn],Vn[Hn]=null}var Tn=null,qn=null,vt=!1,is=null;function Up(s,a){var l=Gn(5,null,null,0);l.elementType="DELETED",l.stateNode=a,l.return=s,a=s.deletions,a===null?(s.deletions=[l],s.flags|=16):a.push(l)}function Qp(s,a){switch(s.tag){case 5:var l=s.type;return a=a.nodeType!==1||l.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(s.stateNode=a,Tn=s,qn=vr(a.firstChild),!0):!1;case 6:return a=s.pendingProps===""||a.nodeType!==3?null:a,a!==null?(s.stateNode=a,Tn=s,qn=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(l=ca!==null?{id:Ds,overflow:Us}:null,s.memoizedState={dehydrated:a,treeContext:l,retryLane:1073741824},l=Gn(18,null,null,0),l.stateNode=a,l.return=s,s.child=l,Tn=s,qn=null,!0):!1;default:return!1}}function Qd(s){return(s.mode&1)!==0&&(s.flags&128)===0}function Bd(s){if(vt){var a=qn;if(a){var l=a;if(!Qp(s,a)){if(Qd(s))throw Error(r(418));a=vr(l.nextSibling);var u=Tn;a&&Qp(s,a)?Up(u,l):(s.flags=s.flags&-4097|2,vt=!1,Tn=s)}}else{if(Qd(s))throw Error(r(418));s.flags=s.flags&-4097|2,vt=!1,Tn=s}}}function Bp(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Tn=s}function Ec(s){if(s!==Tn)return!1;if(!vt)return Bp(s),vt=!0,!1;var a;if((a=s.tag!==3)&&!(a=s.tag!==5)&&(a=s.type,a=a!=="head"&&a!=="body"&&!Id(s.type,s.memoizedProps)),a&&(a=qn)){if(Qd(s))throw Vp(),Error(r(418));for(;a;)Up(s,a),a=vr(a.nextSibling)}if(Bp(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));e:{for(s=s.nextSibling,a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"){if(a===0){qn=vr(s.nextSibling);break e}a--}else l!=="$"&&l!=="$!"&&l!=="$?"||a++}s=s.nextSibling}qn=null}}else qn=Tn?vr(s.stateNode.nextSibling):null;return!0}function Vp(){for(var s=qn;s;)s=vr(s.nextSibling)}function vi(){qn=Tn=null,vt=!1}function Vd(s){is===null?is=[s]:is.push(s)}var P1=T.ReactCurrentBatchConfig;function Bl(s,a,l){if(s=l.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(l._owner){if(l=l._owner,l){if(l.tag!==1)throw Error(r(309));var u=l.stateNode}if(!u)throw Error(r(147,s));var m=u,x=""+s;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===x?a.ref:(a=function(N){var P=m.refs;N===null?delete P[x]:P[x]=N},a._stringRef=x,a)}if(typeof s!="string")throw Error(r(284));if(!l._owner)throw Error(r(290,s))}return s}function Rc(s,a){throw s=Object.prototype.toString.call(a),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s))}function Hp(s){var a=s._init;return a(s._payload)}function Kp(s){function a(L,$){if(s){var D=L.deletions;D===null?(L.deletions=[$],L.flags|=16):D.push($)}}function l(L,$){if(!s)return null;for(;$!==null;)a(L,$),$=$.sibling;return null}function u(L,$){for(L=new Map;$!==null;)$.key!==null?L.set($.key,$):L.set($.index,$),$=$.sibling;return L}function m(L,$){return L=Er(L,$),L.index=0,L.sibling=null,L}function x(L,$,D){return L.index=D,s?(D=L.alternate,D!==null?(D=D.index,D<$?(L.flags|=2,$):D):(L.flags|=2,$)):(L.flags|=1048576,$)}function N(L){return s&&L.alternate===null&&(L.flags|=2),L}function P(L,$,D,ae){return $===null||$.tag!==6?($=zh(D,L.mode,ae),$.return=L,$):($=m($,D),$.return=L,$)}function R(L,$,D,ae){var Ce=D.type;return Ce===I?J(L,$,D.props.children,ae,D.key):$!==null&&($.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===ot&&Hp(Ce)===$.type)?(ae=m($,D.props),ae.ref=Bl(L,$,D),ae.return=L,ae):(ae=eu(D.type,D.key,D.props,null,L.mode,ae),ae.ref=Bl(L,$,D),ae.return=L,ae)}function U(L,$,D,ae){return $===null||$.tag!==4||$.stateNode.containerInfo!==D.containerInfo||$.stateNode.implementation!==D.implementation?($=Oh(D,L.mode,ae),$.return=L,$):($=m($,D.children||[]),$.return=L,$)}function J(L,$,D,ae,Ce){return $===null||$.tag!==7?($=va(D,L.mode,ae,Ce),$.return=L,$):($=m($,D),$.return=L,$)}function Y(L,$,D){if(typeof $=="string"&&$!==""||typeof $=="number")return $=zh(""+$,L.mode,D),$.return=L,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case M:return D=eu($.type,$.key,$.props,null,L.mode,D),D.ref=Bl(L,null,$),D.return=L,D;case E:return $=Oh($,L.mode,D),$.return=L,$;case ot:var ae=$._init;return Y(L,ae($._payload),D)}if(or($)||me($))return $=va($,L.mode,D,null),$.return=L,$;Rc(L,$)}return null}function G(L,$,D,ae){var Ce=$!==null?$.key:null;if(typeof D=="string"&&D!==""||typeof D=="number")return Ce!==null?null:P(L,$,""+D,ae);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case M:return D.key===Ce?R(L,$,D,ae):null;case E:return D.key===Ce?U(L,$,D,ae):null;case ot:return Ce=D._init,G(L,$,Ce(D._payload),ae)}if(or(D)||me(D))return Ce!==null?null:J(L,$,D,ae,null);Rc(L,D)}return null}function fe(L,$,D,ae,Ce){if(typeof ae=="string"&&ae!==""||typeof ae=="number")return L=L.get(D)||null,P($,L,""+ae,Ce);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case M:return L=L.get(ae.key===null?D:ae.key)||null,R($,L,ae,Ce);case E:return L=L.get(ae.key===null?D:ae.key)||null,U($,L,ae,Ce);case ot:var qe=ae._init;return fe(L,$,D,qe(ae._payload),Ce)}if(or(ae)||me(ae))return L=L.get(D)||null,J($,L,ae,Ce,null);Rc($,ae)}return null}function we(L,$,D,ae){for(var Ce=null,qe=null,$e=$,Oe=$=0,Vt=null;$e!==null&&Oe<D.length;Oe++){$e.index>Oe?(Vt=$e,$e=null):Vt=$e.sibling;var tt=G(L,$e,D[Oe],ae);if(tt===null){$e===null&&($e=Vt);break}s&&$e&&tt.alternate===null&&a(L,$e),$=x(tt,$,Oe),qe===null?Ce=tt:qe.sibling=tt,qe=tt,$e=Vt}if(Oe===D.length)return l(L,$e),vt&&ua(L,Oe),Ce;if($e===null){for(;Oe<D.length;Oe++)$e=Y(L,D[Oe],ae),$e!==null&&($=x($e,$,Oe),qe===null?Ce=$e:qe.sibling=$e,qe=$e);return vt&&ua(L,Oe),Ce}for($e=u(L,$e);Oe<D.length;Oe++)Vt=fe($e,L,Oe,D[Oe],ae),Vt!==null&&(s&&Vt.alternate!==null&&$e.delete(Vt.key===null?Oe:Vt.key),$=x(Vt,$,Oe),qe===null?Ce=Vt:qe.sibling=Vt,qe=Vt);return s&&$e.forEach(function(Rr){return a(L,Rr)}),vt&&ua(L,Oe),Ce}function ke(L,$,D,ae){var Ce=me(D);if(typeof Ce!="function")throw Error(r(150));if(D=Ce.call(D),D==null)throw Error(r(151));for(var qe=Ce=null,$e=$,Oe=$=0,Vt=null,tt=D.next();$e!==null&&!tt.done;Oe++,tt=D.next()){$e.index>Oe?(Vt=$e,$e=null):Vt=$e.sibling;var Rr=G(L,$e,tt.value,ae);if(Rr===null){$e===null&&($e=Vt);break}s&&$e&&Rr.alternate===null&&a(L,$e),$=x(Rr,$,Oe),qe===null?Ce=Rr:qe.sibling=Rr,qe=Rr,$e=Vt}if(tt.done)return l(L,$e),vt&&ua(L,Oe),Ce;if($e===null){for(;!tt.done;Oe++,tt=D.next())tt=Y(L,tt.value,ae),tt!==null&&($=x(tt,$,Oe),qe===null?Ce=tt:qe.sibling=tt,qe=tt);return vt&&ua(L,Oe),Ce}for($e=u(L,$e);!tt.done;Oe++,tt=D.next())tt=fe($e,L,Oe,tt.value,ae),tt!==null&&(s&&tt.alternate!==null&&$e.delete(tt.key===null?Oe:tt.key),$=x(tt,$,Oe),qe===null?Ce=tt:qe.sibling=tt,qe=tt);return s&&$e.forEach(function(lb){return a(L,lb)}),vt&&ua(L,Oe),Ce}function Mt(L,$,D,ae){if(typeof D=="object"&&D!==null&&D.type===I&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case M:e:{for(var Ce=D.key,qe=$;qe!==null;){if(qe.key===Ce){if(Ce=D.type,Ce===I){if(qe.tag===7){l(L,qe.sibling),$=m(qe,D.props.children),$.return=L,L=$;break e}}else if(qe.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===ot&&Hp(Ce)===qe.type){l(L,qe.sibling),$=m(qe,D.props),$.ref=Bl(L,qe,D),$.return=L,L=$;break e}l(L,qe);break}else a(L,qe);qe=qe.sibling}D.type===I?($=va(D.props.children,L.mode,ae,D.key),$.return=L,L=$):(ae=eu(D.type,D.key,D.props,null,L.mode,ae),ae.ref=Bl(L,$,D),ae.return=L,L=ae)}return N(L);case E:e:{for(qe=D.key;$!==null;){if($.key===qe)if($.tag===4&&$.stateNode.containerInfo===D.containerInfo&&$.stateNode.implementation===D.implementation){l(L,$.sibling),$=m($,D.children||[]),$.return=L,L=$;break e}else{l(L,$);break}else a(L,$);$=$.sibling}$=Oh(D,L.mode,ae),$.return=L,L=$}return N(L);case ot:return qe=D._init,Mt(L,$,qe(D._payload),ae)}if(or(D))return we(L,$,D,ae);if(me(D))return ke(L,$,D,ae);Rc(L,D)}return typeof D=="string"&&D!==""||typeof D=="number"?(D=""+D,$!==null&&$.tag===6?(l(L,$.sibling),$=m($,D),$.return=L,L=$):(l(L,$),$=zh(D,L.mode,ae),$.return=L,L=$),N(L)):l(L,$)}return Mt}var yi=Kp(!0),Wp=Kp(!1),Mc=yr(null),Tc=null,ji=null,Hd=null;function Kd(){Hd=ji=Tc=null}function Wd(s){var a=Mc.current;xt(Mc),s._currentValue=a}function Zd(s,a,l){for(;s!==null;){var u=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,u!==null&&(u.childLanes|=a)):u!==null&&(u.childLanes&a)!==a&&(u.childLanes|=a),s===l)break;s=s.return}}function bi(s,a){Tc=s,Hd=ji=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&a)!==0&&(kn=!0),s.firstContext=null)}function Kn(s){var a=s._currentValue;if(Hd!==s)if(s={context:s,memoizedValue:a,next:null},ji===null){if(Tc===null)throw Error(r(308));ji=s,Tc.dependencies={lanes:0,firstContext:s}}else ji=ji.next=s;return a}var da=null;function Gd(s){da===null?da=[s]:da.push(s)}function Zp(s,a,l,u){var m=a.interleaved;return m===null?(l.next=l,Gd(a)):(l.next=m.next,m.next=l),a.interleaved=l,Qs(s,u)}function Qs(s,a){s.lanes|=a;var l=s.alternate;for(l!==null&&(l.lanes|=a),l=s,s=s.return;s!==null;)s.childLanes|=a,l=s.alternate,l!==null&&(l.childLanes|=a),l=s,s=s.return;return l.tag===3?l.stateNode:null}var wr=!1;function Jd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Gp(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function Bs(s,a){return{eventTime:s,lane:a,tag:0,payload:null,callback:null,next:null}}function Nr(s,a,l){var u=s.updateQueue;if(u===null)return null;if(u=u.shared,(Je&2)!==0){var m=u.pending;return m===null?a.next=a:(a.next=m.next,m.next=a),u.pending=a,Qs(s,l)}return m=u.interleaved,m===null?(a.next=a,Gd(u)):(a.next=m.next,m.next=a),u.interleaved=a,Qs(s,l)}function qc(s,a,l){if(a=a.updateQueue,a!==null&&(a=a.shared,(l&4194240)!==0)){var u=a.lanes;u&=s.pendingLanes,l|=u,a.lanes=l,dd(s,l)}}function Jp(s,a){var l=s.updateQueue,u=s.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var m=null,x=null;if(l=l.firstBaseUpdate,l!==null){do{var N={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};x===null?m=x=N:x=x.next=N,l=l.next}while(l!==null);x===null?m=x=a:x=x.next=a}else m=x=a;l={baseState:u.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:u.shared,effects:u.effects},s.updateQueue=l;return}s=l.lastBaseUpdate,s===null?l.firstBaseUpdate=a:s.next=a,l.lastBaseUpdate=a}function $c(s,a,l,u){var m=s.updateQueue;wr=!1;var x=m.firstBaseUpdate,N=m.lastBaseUpdate,P=m.shared.pending;if(P!==null){m.shared.pending=null;var R=P,U=R.next;R.next=null,N===null?x=U:N.next=U,N=R;var J=s.alternate;J!==null&&(J=J.updateQueue,P=J.lastBaseUpdate,P!==N&&(P===null?J.firstBaseUpdate=U:P.next=U,J.lastBaseUpdate=R))}if(x!==null){var Y=m.baseState;N=0,J=U=R=null,P=x;do{var G=P.lane,fe=P.eventTime;if((u&G)===G){J!==null&&(J=J.next={eventTime:fe,lane:0,tag:P.tag,payload:P.payload,callback:P.callback,next:null});e:{var we=s,ke=P;switch(G=a,fe=l,ke.tag){case 1:if(we=ke.payload,typeof we=="function"){Y=we.call(fe,Y,G);break e}Y=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=ke.payload,G=typeof we=="function"?we.call(fe,Y,G):we,G==null)break e;Y=re({},Y,G);break e;case 2:wr=!0}}P.callback!==null&&P.lane!==0&&(s.flags|=64,G=m.effects,G===null?m.effects=[P]:G.push(P))}else fe={eventTime:fe,lane:G,tag:P.tag,payload:P.payload,callback:P.callback,next:null},J===null?(U=J=fe,R=Y):J=J.next=fe,N|=G;if(P=P.next,P===null){if(P=m.shared.pending,P===null)break;G=P,P=G.next,G.next=null,m.lastBaseUpdate=G,m.shared.pending=null}}while(!0);if(J===null&&(R=Y),m.baseState=R,m.firstBaseUpdate=U,m.lastBaseUpdate=J,a=m.shared.interleaved,a!==null){m=a;do N|=m.lane,m=m.next;while(m!==a)}else x===null&&(m.shared.lanes=0);ma|=N,s.lanes=N,s.memoizedState=Y}}function Xp(s,a,l){if(s=a.effects,a.effects=null,s!==null)for(a=0;a<s.length;a++){var u=s[a],m=u.callback;if(m!==null){if(u.callback=null,u=l,typeof m!="function")throw Error(r(191,m));m.call(u)}}}var Vl={},ws=yr(Vl),Hl=yr(Vl),Kl=yr(Vl);function ha(s){if(s===Vl)throw Error(r(174));return s}function Xd(s,a){switch(ht(Kl,a),ht(Hl,s),ht(ws,Vl),s=a.nodeType,s){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:Ya(null,"");break;default:s=s===8?a.parentNode:a,a=s.namespaceURI||null,s=s.tagName,a=Ya(a,s)}xt(ws),ht(ws,a)}function wi(){xt(ws),xt(Hl),xt(Kl)}function Yp(s){ha(Kl.current);var a=ha(ws.current),l=Ya(a,s.type);a!==l&&(ht(Hl,s),ht(ws,l))}function Yd(s){Hl.current===s&&(xt(ws),xt(Hl))}var kt=yr(0);function Ic(s){for(var a=s;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||l.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var eh=[];function th(){for(var s=0;s<eh.length;s++)eh[s]._workInProgressVersionPrimary=null;eh.length=0}var zc=T.ReactCurrentDispatcher,nh=T.ReactCurrentBatchConfig,fa=0,St=null,At=null,Qt=null,Oc=!1,Wl=!1,Zl=0,E1=0;function tn(){throw Error(r(321))}function sh(s,a){if(a===null)return!1;for(var l=0;l<a.length&&l<s.length;l++)if(!as(s[l],a[l]))return!1;return!0}function rh(s,a,l,u,m,x){if(fa=x,St=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,zc.current=s===null||s.memoizedState===null?q1:$1,s=l(u,m),Wl){x=0;do{if(Wl=!1,Zl=0,25<=x)throw Error(r(301));x+=1,Qt=At=null,a.updateQueue=null,zc.current=I1,s=l(u,m)}while(Wl)}if(zc.current=Fc,a=At!==null&&At.next!==null,fa=0,Qt=At=St=null,Oc=!1,a)throw Error(r(300));return s}function ah(){var s=Zl!==0;return Zl=0,s}function Ns(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qt===null?St.memoizedState=Qt=s:Qt=Qt.next=s,Qt}function Wn(){if(At===null){var s=St.alternate;s=s!==null?s.memoizedState:null}else s=At.next;var a=Qt===null?St.memoizedState:Qt.next;if(a!==null)Qt=a,At=s;else{if(s===null)throw Error(r(310));At=s,s={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},Qt===null?St.memoizedState=Qt=s:Qt=Qt.next=s}return Qt}function Gl(s,a){return typeof a=="function"?a(s):a}function ih(s){var a=Wn(),l=a.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=s;var u=At,m=u.baseQueue,x=l.pending;if(x!==null){if(m!==null){var N=m.next;m.next=x.next,x.next=N}u.baseQueue=m=x,l.pending=null}if(m!==null){x=m.next,u=u.baseState;var P=N=null,R=null,U=x;do{var J=U.lane;if((fa&J)===J)R!==null&&(R=R.next={lane:0,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),u=U.hasEagerState?U.eagerState:s(u,U.action);else{var Y={lane:J,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null};R===null?(P=R=Y,N=u):R=R.next=Y,St.lanes|=J,ma|=J}U=U.next}while(U!==null&&U!==x);R===null?N=u:R.next=P,as(u,a.memoizedState)||(kn=!0),a.memoizedState=u,a.baseState=N,a.baseQueue=R,l.lastRenderedState=u}if(s=l.interleaved,s!==null){m=s;do x=m.lane,St.lanes|=x,ma|=x,m=m.next;while(m!==s)}else m===null&&(l.lanes=0);return[a.memoizedState,l.dispatch]}function lh(s){var a=Wn(),l=a.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=s;var u=l.dispatch,m=l.pending,x=a.memoizedState;if(m!==null){l.pending=null;var N=m=m.next;do x=s(x,N.action),N=N.next;while(N!==m);as(x,a.memoizedState)||(kn=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),l.lastRenderedState=x}return[x,u]}function ex(){}function tx(s,a){var l=St,u=Wn(),m=a(),x=!as(u.memoizedState,m);if(x&&(u.memoizedState=m,kn=!0),u=u.queue,oh(rx.bind(null,l,u,s),[s]),u.getSnapshot!==a||x||Qt!==null&&Qt.memoizedState.tag&1){if(l.flags|=2048,Jl(9,sx.bind(null,l,u,m,a),void 0,null),Bt===null)throw Error(r(349));(fa&30)!==0||nx(l,a,m)}return m}function nx(s,a,l){s.flags|=16384,s={getSnapshot:a,value:l},a=St.updateQueue,a===null?(a={lastEffect:null,stores:null},St.updateQueue=a,a.stores=[s]):(l=a.stores,l===null?a.stores=[s]:l.push(s))}function sx(s,a,l,u){a.value=l,a.getSnapshot=u,ax(a)&&ix(s)}function rx(s,a,l){return l(function(){ax(a)&&ix(s)})}function ax(s){var a=s.getSnapshot;s=s.value;try{var l=a();return!as(s,l)}catch{return!0}}function ix(s){var a=Qs(s,1);a!==null&&us(a,s,1,-1)}function lx(s){var a=Ns();return typeof s=="function"&&(s=s()),a.memoizedState=a.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Gl,lastRenderedState:s},a.queue=s,s=s.dispatch=T1.bind(null,St,s),[a.memoizedState,s]}function Jl(s,a,l,u){return s={tag:s,create:a,destroy:l,deps:u,next:null},a=St.updateQueue,a===null?(a={lastEffect:null,stores:null},St.updateQueue=a,a.lastEffect=s.next=s):(l=a.lastEffect,l===null?a.lastEffect=s.next=s:(u=l.next,l.next=s,s.next=u,a.lastEffect=s)),s}function ox(){return Wn().memoizedState}function Ac(s,a,l,u){var m=Ns();St.flags|=s,m.memoizedState=Jl(1|a,l,void 0,u===void 0?null:u)}function Lc(s,a,l,u){var m=Wn();u=u===void 0?null:u;var x=void 0;if(At!==null){var N=At.memoizedState;if(x=N.destroy,u!==null&&sh(u,N.deps)){m.memoizedState=Jl(a,l,x,u);return}}St.flags|=s,m.memoizedState=Jl(1|a,l,x,u)}function cx(s,a){return Ac(8390656,8,s,a)}function oh(s,a){return Lc(2048,8,s,a)}function ux(s,a){return Lc(4,2,s,a)}function dx(s,a){return Lc(4,4,s,a)}function hx(s,a){if(typeof a=="function")return s=s(),a(s),function(){a(null)};if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function fx(s,a,l){return l=l!=null?l.concat([s]):null,Lc(4,4,hx.bind(null,a,s),l)}function ch(){}function mx(s,a){var l=Wn();a=a===void 0?null:a;var u=l.memoizedState;return u!==null&&a!==null&&sh(a,u[1])?u[0]:(l.memoizedState=[s,a],s)}function px(s,a){var l=Wn();a=a===void 0?null:a;var u=l.memoizedState;return u!==null&&a!==null&&sh(a,u[1])?u[0]:(s=s(),l.memoizedState=[s,a],s)}function xx(s,a,l){return(fa&21)===0?(s.baseState&&(s.baseState=!1,kn=!0),s.memoizedState=l):(as(l,a)||(l=Hm(),St.lanes|=l,ma|=l,s.baseState=!0),a)}function R1(s,a){var l=it;it=l!==0&&4>l?l:4,s(!0);var u=nh.transition;nh.transition={};try{s(!1),a()}finally{it=l,nh.transition=u}}function gx(){return Wn().memoizedState}function M1(s,a,l){var u=_r(s);if(l={lane:u,action:l,hasEagerState:!1,eagerState:null,next:null},vx(s))yx(a,l);else if(l=Zp(s,a,l,u),l!==null){var m=hn();us(l,s,u,m),jx(l,a,u)}}function T1(s,a,l){var u=_r(s),m={lane:u,action:l,hasEagerState:!1,eagerState:null,next:null};if(vx(s))yx(a,m);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var N=a.lastRenderedState,P=x(N,l);if(m.hasEagerState=!0,m.eagerState=P,as(P,N)){var R=a.interleaved;R===null?(m.next=m,Gd(a)):(m.next=R.next,R.next=m),a.interleaved=m;return}}catch{}finally{}l=Zp(s,a,m,u),l!==null&&(m=hn(),us(l,s,u,m),jx(l,a,u))}}function vx(s){var a=s.alternate;return s===St||a!==null&&a===St}function yx(s,a){Wl=Oc=!0;var l=s.pending;l===null?a.next=a:(a.next=l.next,l.next=a),s.pending=a}function jx(s,a,l){if((l&4194240)!==0){var u=a.lanes;u&=s.pendingLanes,l|=u,a.lanes=l,dd(s,l)}}var Fc={readContext:Kn,useCallback:tn,useContext:tn,useEffect:tn,useImperativeHandle:tn,useInsertionEffect:tn,useLayoutEffect:tn,useMemo:tn,useReducer:tn,useRef:tn,useState:tn,useDebugValue:tn,useDeferredValue:tn,useTransition:tn,useMutableSource:tn,useSyncExternalStore:tn,useId:tn,unstable_isNewReconciler:!1},q1={readContext:Kn,useCallback:function(s,a){return Ns().memoizedState=[s,a===void 0?null:a],s},useContext:Kn,useEffect:cx,useImperativeHandle:function(s,a,l){return l=l!=null?l.concat([s]):null,Ac(4194308,4,hx.bind(null,a,s),l)},useLayoutEffect:function(s,a){return Ac(4194308,4,s,a)},useInsertionEffect:function(s,a){return Ac(4,2,s,a)},useMemo:function(s,a){var l=Ns();return a=a===void 0?null:a,s=s(),l.memoizedState=[s,a],s},useReducer:function(s,a,l){var u=Ns();return a=l!==void 0?l(a):a,u.memoizedState=u.baseState=a,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:a},u.queue=s,s=s.dispatch=M1.bind(null,St,s),[u.memoizedState,s]},useRef:function(s){var a=Ns();return s={current:s},a.memoizedState=s},useState:lx,useDebugValue:ch,useDeferredValue:function(s){return Ns().memoizedState=s},useTransition:function(){var s=lx(!1),a=s[0];return s=R1.bind(null,s[1]),Ns().memoizedState=s,[a,s]},useMutableSource:function(){},useSyncExternalStore:function(s,a,l){var u=St,m=Ns();if(vt){if(l===void 0)throw Error(r(407));l=l()}else{if(l=a(),Bt===null)throw Error(r(349));(fa&30)!==0||nx(u,a,l)}m.memoizedState=l;var x={value:l,getSnapshot:a};return m.queue=x,cx(rx.bind(null,u,x,s),[s]),u.flags|=2048,Jl(9,sx.bind(null,u,x,l,a),void 0,null),l},useId:function(){var s=Ns(),a=Bt.identifierPrefix;if(vt){var l=Us,u=Ds;l=(u&~(1<<32-rs(u)-1)).toString(32)+l,a=":"+a+"R"+l,l=Zl++,0<l&&(a+="H"+l.toString(32)),a+=":"}else l=E1++,a=":"+a+"r"+l.toString(32)+":";return s.memoizedState=a},unstable_isNewReconciler:!1},$1={readContext:Kn,useCallback:mx,useContext:Kn,useEffect:oh,useImperativeHandle:fx,useInsertionEffect:ux,useLayoutEffect:dx,useMemo:px,useReducer:ih,useRef:ox,useState:function(){return ih(Gl)},useDebugValue:ch,useDeferredValue:function(s){var a=Wn();return xx(a,At.memoizedState,s)},useTransition:function(){var s=ih(Gl)[0],a=Wn().memoizedState;return[s,a]},useMutableSource:ex,useSyncExternalStore:tx,useId:gx,unstable_isNewReconciler:!1},I1={readContext:Kn,useCallback:mx,useContext:Kn,useEffect:oh,useImperativeHandle:fx,useInsertionEffect:ux,useLayoutEffect:dx,useMemo:px,useReducer:lh,useRef:ox,useState:function(){return lh(Gl)},useDebugValue:ch,useDeferredValue:function(s){var a=Wn();return At===null?a.memoizedState=s:xx(a,At.memoizedState,s)},useTransition:function(){var s=lh(Gl)[0],a=Wn().memoizedState;return[s,a]},useMutableSource:ex,useSyncExternalStore:tx,useId:gx,unstable_isNewReconciler:!1};function ls(s,a){if(s&&s.defaultProps){a=re({},a),s=s.defaultProps;for(var l in s)a[l]===void 0&&(a[l]=s[l]);return a}return a}function uh(s,a,l,u){a=s.memoizedState,l=l(u,a),l=l==null?a:re({},a,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var Dc={isMounted:function(s){return(s=s._reactInternals)?ys(s)===s:!1},enqueueSetState:function(s,a,l){s=s._reactInternals;var u=hn(),m=_r(s),x=Bs(u,m);x.payload=a,l!=null&&(x.callback=l),a=Nr(s,x,m),a!==null&&(us(a,s,m,u),qc(a,s,m))},enqueueReplaceState:function(s,a,l){s=s._reactInternals;var u=hn(),m=_r(s),x=Bs(u,m);x.tag=1,x.payload=a,l!=null&&(x.callback=l),a=Nr(s,x,m),a!==null&&(us(a,s,m,u),qc(a,s,m))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var l=hn(),u=_r(s),m=Bs(l,u);m.tag=2,a!=null&&(m.callback=a),a=Nr(s,m,u),a!==null&&(us(a,s,u,l),qc(a,s,u))}};function bx(s,a,l,u,m,x,N){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(u,x,N):a.prototype&&a.prototype.isPureReactComponent?!Ol(l,u)||!Ol(m,x):!0}function wx(s,a,l){var u=!1,m=jr,x=a.contextType;return typeof x=="object"&&x!==null?x=Kn(x):(m=Nn(a)?oa:en.current,u=a.contextTypes,x=(u=u!=null)?pi(s,m):jr),a=new a(l,x),s.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Dc,s.stateNode=a,a._reactInternals=s,u&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=m,s.__reactInternalMemoizedMaskedChildContext=x),a}function Nx(s,a,l,u){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(l,u),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(l,u),a.state!==s&&Dc.enqueueReplaceState(a,a.state,null)}function dh(s,a,l,u){var m=s.stateNode;m.props=l,m.state=s.memoizedState,m.refs={},Jd(s);var x=a.contextType;typeof x=="object"&&x!==null?m.context=Kn(x):(x=Nn(a)?oa:en.current,m.context=pi(s,x)),m.state=s.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(uh(s,a,x,l),m.state=s.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(a=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),a!==m.state&&Dc.enqueueReplaceState(m,m.state,null),$c(s,l,m,u),m.state=s.memoizedState),typeof m.componentDidMount=="function"&&(s.flags|=4194308)}function Ni(s,a){try{var l="",u=a;do l+=Se(u),u=u.return;while(u);var m=l}catch(x){m=`
40
+ Error generating stack: `+x.message+`
41
+ `+x.stack}return{value:s,source:a,stack:m,digest:null}}function hh(s,a,l){return{value:s,source:null,stack:l??null,digest:a??null}}function fh(s,a){try{console.error(a.value)}catch(l){setTimeout(function(){throw l})}}var z1=typeof WeakMap=="function"?WeakMap:Map;function kx(s,a,l){l=Bs(-1,l),l.tag=3,l.payload={element:null};var u=a.value;return l.callback=function(){Wc||(Wc=!0,Ph=u),fh(s,a)},l}function Sx(s,a,l){l=Bs(-1,l),l.tag=3;var u=s.type.getDerivedStateFromError;if(typeof u=="function"){var m=a.value;l.payload=function(){return u(m)},l.callback=function(){fh(s,a)}}var x=s.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(l.callback=function(){fh(s,a),typeof u!="function"&&(Sr===null?Sr=new Set([this]):Sr.add(this));var N=a.stack;this.componentDidCatch(a.value,{componentStack:N!==null?N:""})}),l}function Cx(s,a,l){var u=s.pingCache;if(u===null){u=s.pingCache=new z1;var m=new Set;u.set(a,m)}else m=u.get(a),m===void 0&&(m=new Set,u.set(a,m));m.has(l)||(m.add(l),s=G1.bind(null,s,a,l),a.then(s,s))}function _x(s){do{var a;if((a=s.tag===13)&&(a=s.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return s;s=s.return}while(s!==null);return null}function Px(s,a,l,u,m){return(s.mode&1)===0?(s===a?s.flags|=65536:(s.flags|=128,l.flags|=131072,l.flags&=-52805,l.tag===1&&(l.alternate===null?l.tag=17:(a=Bs(-1,1),a.tag=2,Nr(l,a,1))),l.lanes|=1),s):(s.flags|=65536,s.lanes=m,s)}var O1=T.ReactCurrentOwner,kn=!1;function dn(s,a,l,u){a.child=s===null?Wp(a,null,l,u):yi(a,s.child,l,u)}function Ex(s,a,l,u,m){l=l.render;var x=a.ref;return bi(a,m),u=rh(s,a,l,u,x,m),l=ah(),s!==null&&!kn?(a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~m,Vs(s,a,m)):(vt&&l&&Dd(a),a.flags|=1,dn(s,a,u,m),a.child)}function Rx(s,a,l,u,m){if(s===null){var x=l.type;return typeof x=="function"&&!Ih(x)&&x.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(a.tag=15,a.type=x,Mx(s,a,x,u,m)):(s=eu(l.type,null,u,a,a.mode,m),s.ref=a.ref,s.return=a,a.child=s)}if(x=s.child,(s.lanes&m)===0){var N=x.memoizedProps;if(l=l.compare,l=l!==null?l:Ol,l(N,u)&&s.ref===a.ref)return Vs(s,a,m)}return a.flags|=1,s=Er(x,u),s.ref=a.ref,s.return=a,a.child=s}function Mx(s,a,l,u,m){if(s!==null){var x=s.memoizedProps;if(Ol(x,u)&&s.ref===a.ref)if(kn=!1,a.pendingProps=u=x,(s.lanes&m)!==0)(s.flags&131072)!==0&&(kn=!0);else return a.lanes=s.lanes,Vs(s,a,m)}return mh(s,a,l,u,m)}function Tx(s,a,l){var u=a.pendingProps,m=u.children,x=s!==null?s.memoizedState:null;if(u.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},ht(Si,$n),$n|=l;else{if((l&1073741824)===0)return s=x!==null?x.baseLanes|l:l,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:s,cachePool:null,transitions:null},a.updateQueue=null,ht(Si,$n),$n|=s,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=x!==null?x.baseLanes:l,ht(Si,$n),$n|=u}else x!==null?(u=x.baseLanes|l,a.memoizedState=null):u=l,ht(Si,$n),$n|=u;return dn(s,a,m,l),a.child}function qx(s,a){var l=a.ref;(s===null&&l!==null||s!==null&&s.ref!==l)&&(a.flags|=512,a.flags|=2097152)}function mh(s,a,l,u,m){var x=Nn(l)?oa:en.current;return x=pi(a,x),bi(a,m),l=rh(s,a,l,u,x,m),u=ah(),s!==null&&!kn?(a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~m,Vs(s,a,m)):(vt&&u&&Dd(a),a.flags|=1,dn(s,a,l,m),a.child)}function $x(s,a,l,u,m){if(Nn(l)){var x=!0;Sc(a)}else x=!1;if(bi(a,m),a.stateNode===null)Qc(s,a),wx(a,l,u),dh(a,l,u,m),u=!0;else if(s===null){var N=a.stateNode,P=a.memoizedProps;N.props=P;var R=N.context,U=l.contextType;typeof U=="object"&&U!==null?U=Kn(U):(U=Nn(l)?oa:en.current,U=pi(a,U));var J=l.getDerivedStateFromProps,Y=typeof J=="function"||typeof N.getSnapshotBeforeUpdate=="function";Y||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(P!==u||R!==U)&&Nx(a,N,u,U),wr=!1;var G=a.memoizedState;N.state=G,$c(a,u,N,m),R=a.memoizedState,P!==u||G!==R||wn.current||wr?(typeof J=="function"&&(uh(a,l,J,u),R=a.memoizedState),(P=wr||bx(a,l,P,u,G,R,U))?(Y||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount()),typeof N.componentDidMount=="function"&&(a.flags|=4194308)):(typeof N.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=u,a.memoizedState=R),N.props=u,N.state=R,N.context=U,u=P):(typeof N.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{N=a.stateNode,Gp(s,a),P=a.memoizedProps,U=a.type===a.elementType?P:ls(a.type,P),N.props=U,Y=a.pendingProps,G=N.context,R=l.contextType,typeof R=="object"&&R!==null?R=Kn(R):(R=Nn(l)?oa:en.current,R=pi(a,R));var fe=l.getDerivedStateFromProps;(J=typeof fe=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(P!==Y||G!==R)&&Nx(a,N,u,R),wr=!1,G=a.memoizedState,N.state=G,$c(a,u,N,m);var we=a.memoizedState;P!==Y||G!==we||wn.current||wr?(typeof fe=="function"&&(uh(a,l,fe,u),we=a.memoizedState),(U=wr||bx(a,l,U,u,G,we,R)||!1)?(J||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(u,we,R),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(u,we,R)),typeof N.componentDidUpdate=="function"&&(a.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof N.componentDidUpdate!="function"||P===s.memoizedProps&&G===s.memoizedState||(a.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||P===s.memoizedProps&&G===s.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=we),N.props=u,N.state=we,N.context=R,u=U):(typeof N.componentDidUpdate!="function"||P===s.memoizedProps&&G===s.memoizedState||(a.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||P===s.memoizedProps&&G===s.memoizedState||(a.flags|=1024),u=!1)}return ph(s,a,l,u,x,m)}function ph(s,a,l,u,m,x){qx(s,a);var N=(a.flags&128)!==0;if(!u&&!N)return m&&Lp(a,l,!1),Vs(s,a,x);u=a.stateNode,O1.current=a;var P=N&&typeof l.getDerivedStateFromError!="function"?null:u.render();return a.flags|=1,s!==null&&N?(a.child=yi(a,s.child,null,x),a.child=yi(a,null,P,x)):dn(s,a,P,x),a.memoizedState=u.state,m&&Lp(a,l,!0),a.child}function Ix(s){var a=s.stateNode;a.pendingContext?Op(s,a.pendingContext,a.pendingContext!==a.context):a.context&&Op(s,a.context,!1),Xd(s,a.containerInfo)}function zx(s,a,l,u,m){return vi(),Vd(m),a.flags|=256,dn(s,a,l,u),a.child}var xh={dehydrated:null,treeContext:null,retryLane:0};function gh(s){return{baseLanes:s,cachePool:null,transitions:null}}function Ox(s,a,l){var u=a.pendingProps,m=kt.current,x=!1,N=(a.flags&128)!==0,P;if((P=N)||(P=s!==null&&s.memoizedState===null?!1:(m&2)!==0),P?(x=!0,a.flags&=-129):(s===null||s.memoizedState!==null)&&(m|=1),ht(kt,m&1),s===null)return Bd(a),s=a.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((a.mode&1)===0?a.lanes=1:s.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(N=u.children,s=u.fallback,x?(u=a.mode,x=a.child,N={mode:"hidden",children:N},(u&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=N):x=tu(N,u,0,null),s=va(s,u,l,null),x.return=a,s.return=a,x.sibling=s,a.child=x,a.child.memoizedState=gh(l),a.memoizedState=xh,s):vh(a,N));if(m=s.memoizedState,m!==null&&(P=m.dehydrated,P!==null))return A1(s,a,N,u,P,m,l);if(x){x=u.fallback,N=a.mode,m=s.child,P=m.sibling;var R={mode:"hidden",children:u.children};return(N&1)===0&&a.child!==m?(u=a.child,u.childLanes=0,u.pendingProps=R,a.deletions=null):(u=Er(m,R),u.subtreeFlags=m.subtreeFlags&14680064),P!==null?x=Er(P,x):(x=va(x,N,l,null),x.flags|=2),x.return=a,u.return=a,u.sibling=x,a.child=u,u=x,x=a.child,N=s.child.memoizedState,N=N===null?gh(l):{baseLanes:N.baseLanes|l,cachePool:null,transitions:N.transitions},x.memoizedState=N,x.childLanes=s.childLanes&~l,a.memoizedState=xh,u}return x=s.child,s=x.sibling,u=Er(x,{mode:"visible",children:u.children}),(a.mode&1)===0&&(u.lanes=l),u.return=a,u.sibling=null,s!==null&&(l=a.deletions,l===null?(a.deletions=[s],a.flags|=16):l.push(s)),a.child=u,a.memoizedState=null,u}function vh(s,a){return a=tu({mode:"visible",children:a},s.mode,0,null),a.return=s,s.child=a}function Uc(s,a,l,u){return u!==null&&Vd(u),yi(a,s.child,null,l),s=vh(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function A1(s,a,l,u,m,x,N){if(l)return a.flags&256?(a.flags&=-257,u=hh(Error(r(422))),Uc(s,a,N,u)):a.memoizedState!==null?(a.child=s.child,a.flags|=128,null):(x=u.fallback,m=a.mode,u=tu({mode:"visible",children:u.children},m,0,null),x=va(x,m,N,null),x.flags|=2,u.return=a,x.return=a,u.sibling=x,a.child=u,(a.mode&1)!==0&&yi(a,s.child,null,N),a.child.memoizedState=gh(N),a.memoizedState=xh,x);if((a.mode&1)===0)return Uc(s,a,N,null);if(m.data==="$!"){if(u=m.nextSibling&&m.nextSibling.dataset,u)var P=u.dgst;return u=P,x=Error(r(419)),u=hh(x,u,void 0),Uc(s,a,N,u)}if(P=(N&s.childLanes)!==0,kn||P){if(u=Bt,u!==null){switch(N&-N){case 4:m=2;break;case 16:m=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:m=32;break;case 536870912:m=268435456;break;default:m=0}m=(m&(u.suspendedLanes|N))!==0?0:m,m!==0&&m!==x.retryLane&&(x.retryLane=m,Qs(s,m),us(u,s,m,-1))}return $h(),u=hh(Error(r(421))),Uc(s,a,N,u)}return m.data==="$?"?(a.flags|=128,a.child=s.child,a=J1.bind(null,s),m._reactRetry=a,null):(s=x.treeContext,qn=vr(m.nextSibling),Tn=a,vt=!0,is=null,s!==null&&(Vn[Hn++]=Ds,Vn[Hn++]=Us,Vn[Hn++]=ca,Ds=s.id,Us=s.overflow,ca=a),a=vh(a,u.children),a.flags|=4096,a)}function Ax(s,a,l){s.lanes|=a;var u=s.alternate;u!==null&&(u.lanes|=a),Zd(s.return,a,l)}function yh(s,a,l,u,m){var x=s.memoizedState;x===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:m}:(x.isBackwards=a,x.rendering=null,x.renderingStartTime=0,x.last=u,x.tail=l,x.tailMode=m)}function Lx(s,a,l){var u=a.pendingProps,m=u.revealOrder,x=u.tail;if(dn(s,a,u.children,l),u=kt.current,(u&2)!==0)u=u&1|2,a.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Ax(s,l,a);else if(s.tag===19)Ax(s,l,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}u&=1}if(ht(kt,u),(a.mode&1)===0)a.memoizedState=null;else switch(m){case"forwards":for(l=a.child,m=null;l!==null;)s=l.alternate,s!==null&&Ic(s)===null&&(m=l),l=l.sibling;l=m,l===null?(m=a.child,a.child=null):(m=l.sibling,l.sibling=null),yh(a,!1,m,l,x);break;case"backwards":for(l=null,m=a.child,a.child=null;m!==null;){if(s=m.alternate,s!==null&&Ic(s)===null){a.child=m;break}s=m.sibling,m.sibling=l,l=m,m=s}yh(a,!0,l,null,x);break;case"together":yh(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Qc(s,a){(a.mode&1)===0&&s!==null&&(s.alternate=null,a.alternate=null,a.flags|=2)}function Vs(s,a,l){if(s!==null&&(a.dependencies=s.dependencies),ma|=a.lanes,(l&a.childLanes)===0)return null;if(s!==null&&a.child!==s.child)throw Error(r(153));if(a.child!==null){for(s=a.child,l=Er(s,s.pendingProps),a.child=l,l.return=a;s.sibling!==null;)s=s.sibling,l=l.sibling=Er(s,s.pendingProps),l.return=a;l.sibling=null}return a.child}function L1(s,a,l){switch(a.tag){case 3:Ix(a),vi();break;case 5:Yp(a);break;case 1:Nn(a.type)&&Sc(a);break;case 4:Xd(a,a.stateNode.containerInfo);break;case 10:var u=a.type._context,m=a.memoizedProps.value;ht(Mc,u._currentValue),u._currentValue=m;break;case 13:if(u=a.memoizedState,u!==null)return u.dehydrated!==null?(ht(kt,kt.current&1),a.flags|=128,null):(l&a.child.childLanes)!==0?Ox(s,a,l):(ht(kt,kt.current&1),s=Vs(s,a,l),s!==null?s.sibling:null);ht(kt,kt.current&1);break;case 19:if(u=(l&a.childLanes)!==0,(s.flags&128)!==0){if(u)return Lx(s,a,l);a.flags|=128}if(m=a.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),ht(kt,kt.current),u)break;return null;case 22:case 23:return a.lanes=0,Tx(s,a,l)}return Vs(s,a,l)}var Fx,jh,Dx,Ux;Fx=function(s,a){for(var l=a.child;l!==null;){if(l.tag===5||l.tag===6)s.appendChild(l.stateNode);else if(l.tag!==4&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return;l=l.return}l.sibling.return=l.return,l=l.sibling}},jh=function(){},Dx=function(s,a,l,u){var m=s.memoizedProps;if(m!==u){s=a.stateNode,ha(ws.current);var x=null;switch(l){case"input":m=Yr(s,m),u=Yr(s,u),x=[];break;case"select":m=re({},m,{value:void 0}),u=re({},u,{value:void 0}),x=[];break;case"textarea":m=Ut(s,m),u=Ut(s,u),x=[];break;default:typeof m.onClick!="function"&&typeof u.onClick=="function"&&(s.onclick=wc)}fl(l,u);var N;l=null;for(U in m)if(!u.hasOwnProperty(U)&&m.hasOwnProperty(U)&&m[U]!=null)if(U==="style"){var P=m[U];for(N in P)P.hasOwnProperty(N)&&(l||(l={}),l[N]="")}else U!=="dangerouslySetInnerHTML"&&U!=="children"&&U!=="suppressContentEditableWarning"&&U!=="suppressHydrationWarning"&&U!=="autoFocus"&&(o.hasOwnProperty(U)?x||(x=[]):(x=x||[]).push(U,null));for(U in u){var R=u[U];if(P=m!=null?m[U]:void 0,u.hasOwnProperty(U)&&R!==P&&(R!=null||P!=null))if(U==="style")if(P){for(N in P)!P.hasOwnProperty(N)||R&&R.hasOwnProperty(N)||(l||(l={}),l[N]="");for(N in R)R.hasOwnProperty(N)&&P[N]!==R[N]&&(l||(l={}),l[N]=R[N])}else l||(x||(x=[]),x.push(U,l)),l=R;else U==="dangerouslySetInnerHTML"?(R=R?R.__html:void 0,P=P?P.__html:void 0,R!=null&&P!==R&&(x=x||[]).push(U,R)):U==="children"?typeof R!="string"&&typeof R!="number"||(x=x||[]).push(U,""+R):U!=="suppressContentEditableWarning"&&U!=="suppressHydrationWarning"&&(o.hasOwnProperty(U)?(R!=null&&U==="onScroll"&&pt("scroll",s),x||P===R||(x=[])):(x=x||[]).push(U,R))}l&&(x=x||[]).push("style",l);var U=x;(a.updateQueue=U)&&(a.flags|=4)}},Ux=function(s,a,l,u){l!==u&&(a.flags|=4)};function Xl(s,a){if(!vt)switch(s.tailMode){case"hidden":a=s.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?s.tail=null:l.sibling=null;break;case"collapsed":l=s.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:u.sibling=null}}function nn(s){var a=s.alternate!==null&&s.alternate.child===s.child,l=0,u=0;if(a)for(var m=s.child;m!==null;)l|=m.lanes|m.childLanes,u|=m.subtreeFlags&14680064,u|=m.flags&14680064,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)l|=m.lanes|m.childLanes,u|=m.subtreeFlags,u|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=u,s.childLanes=l,a}function F1(s,a,l){var u=a.pendingProps;switch(Ud(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nn(a),null;case 1:return Nn(a.type)&&kc(),nn(a),null;case 3:return u=a.stateNode,wi(),xt(wn),xt(en),th(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(Ec(a)?a.flags|=4:s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,is!==null&&(Mh(is),is=null))),jh(s,a),nn(a),null;case 5:Yd(a);var m=ha(Kl.current);if(l=a.type,s!==null&&a.stateNode!=null)Dx(s,a,l,u,m),s.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!u){if(a.stateNode===null)throw Error(r(166));return nn(a),null}if(s=ha(ws.current),Ec(a)){u=a.stateNode,l=a.type;var x=a.memoizedProps;switch(u[bs]=a,u[Ul]=x,s=(a.mode&1)!==0,l){case"dialog":pt("cancel",u),pt("close",u);break;case"iframe":case"object":case"embed":pt("load",u);break;case"video":case"audio":for(m=0;m<Ll.length;m++)pt(Ll[m],u);break;case"source":pt("error",u);break;case"img":case"image":case"link":pt("error",u),pt("load",u);break;case"details":pt("toggle",u);break;case"input":ea(u,x),pt("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!x.multiple},pt("invalid",u);break;case"textarea":Ko(u,x),pt("invalid",u)}fl(l,x),m=null;for(var N in x)if(x.hasOwnProperty(N)){var P=x[N];N==="children"?typeof P=="string"?u.textContent!==P&&(x.suppressHydrationWarning!==!0&&bc(u.textContent,P,s),m=["children",P]):typeof P=="number"&&u.textContent!==""+P&&(x.suppressHydrationWarning!==!0&&bc(u.textContent,P,s),m=["children",""+P]):o.hasOwnProperty(N)&&P!=null&&N==="onScroll"&&pt("scroll",u)}switch(l){case"input":lr(u),Ja(u,x,!0);break;case"textarea":lr(u),Qn(u);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(u.onclick=wc)}u=m,a.updateQueue=u,u!==null&&(a.flags|=4)}else{N=m.nodeType===9?m:m.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=Wo(l)),s==="http://www.w3.org/1999/xhtml"?l==="script"?(s=N.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof u.is=="string"?s=N.createElement(l,{is:u.is}):(s=N.createElement(l),l==="select"&&(N=s,u.multiple?N.multiple=!0:u.size&&(N.size=u.size))):s=N.createElementNS(s,l),s[bs]=a,s[Ul]=u,Fx(s,a,!1,!1),a.stateNode=s;e:{switch(N=sa(l,u),l){case"dialog":pt("cancel",s),pt("close",s),m=u;break;case"iframe":case"object":case"embed":pt("load",s),m=u;break;case"video":case"audio":for(m=0;m<Ll.length;m++)pt(Ll[m],s);m=u;break;case"source":pt("error",s),m=u;break;case"img":case"image":case"link":pt("error",s),pt("load",s),m=u;break;case"details":pt("toggle",s),m=u;break;case"input":ea(s,u),m=Yr(s,u),pt("invalid",s);break;case"option":m=u;break;case"select":s._wrapperState={wasMultiple:!!u.multiple},m=re({},u,{value:void 0}),pt("invalid",s);break;case"textarea":Ko(s,u),m=Ut(s,u),pt("invalid",s);break;default:m=u}fl(l,m),P=m;for(x in P)if(P.hasOwnProperty(x)){var R=P[x];x==="style"?Ot(s,R):x==="dangerouslySetInnerHTML"?(R=R?R.__html:void 0,R!=null&&vs(s,R)):x==="children"?typeof R=="string"?(l!=="textarea"||R!=="")&&zs(s,R):typeof R=="number"&&zs(s,""+R):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(o.hasOwnProperty(x)?R!=null&&x==="onScroll"&&pt("scroll",s):R!=null&&O(s,x,R,N))}switch(l){case"input":lr(s),Ja(s,u,!1);break;case"textarea":lr(s),Qn(s);break;case"option":u.value!=null&&s.setAttribute("value",""+He(u.value));break;case"select":s.multiple=!!u.multiple,x=u.value,x!=null?Rn(s,!!u.multiple,x,!1):u.defaultValue!=null&&Rn(s,!!u.multiple,u.defaultValue,!0);break;default:typeof m.onClick=="function"&&(s.onclick=wc)}switch(l){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}}u&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return nn(a),null;case 6:if(s&&a.stateNode!=null)Ux(s,a,s.memoizedProps,u);else{if(typeof u!="string"&&a.stateNode===null)throw Error(r(166));if(l=ha(Kl.current),ha(ws.current),Ec(a)){if(u=a.stateNode,l=a.memoizedProps,u[bs]=a,(x=u.nodeValue!==l)&&(s=Tn,s!==null))switch(s.tag){case 3:bc(u.nodeValue,l,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&bc(u.nodeValue,l,(s.mode&1)!==0)}x&&(a.flags|=4)}else u=(l.nodeType===9?l:l.ownerDocument).createTextNode(u),u[bs]=a,a.stateNode=u}return nn(a),null;case 13:if(xt(kt),u=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(vt&&qn!==null&&(a.mode&1)!==0&&(a.flags&128)===0)Vp(),vi(),a.flags|=98560,x=!1;else if(x=Ec(a),u!==null&&u.dehydrated!==null){if(s===null){if(!x)throw Error(r(318));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[bs]=a}else vi(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;nn(a),x=!1}else is!==null&&(Mh(is),is=null),x=!0;if(!x)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=l,a):(u=u!==null,u!==(s!==null&&s.memoizedState!==null)&&u&&(a.child.flags|=8192,(a.mode&1)!==0&&(s===null||(kt.current&1)!==0?Lt===0&&(Lt=3):$h())),a.updateQueue!==null&&(a.flags|=4),nn(a),null);case 4:return wi(),jh(s,a),s===null&&Fl(a.stateNode.containerInfo),nn(a),null;case 10:return Wd(a.type._context),nn(a),null;case 17:return Nn(a.type)&&kc(),nn(a),null;case 19:if(xt(kt),x=a.memoizedState,x===null)return nn(a),null;if(u=(a.flags&128)!==0,N=x.rendering,N===null)if(u)Xl(x,!1);else{if(Lt!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(N=Ic(s),N!==null){for(a.flags|=128,Xl(x,!1),u=N.updateQueue,u!==null&&(a.updateQueue=u,a.flags|=4),a.subtreeFlags=0,u=l,l=a.child;l!==null;)x=l,s=u,x.flags&=14680066,N=x.alternate,N===null?(x.childLanes=0,x.lanes=s,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=N.childLanes,x.lanes=N.lanes,x.child=N.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=N.memoizedProps,x.memoizedState=N.memoizedState,x.updateQueue=N.updateQueue,x.type=N.type,s=N.dependencies,x.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),l=l.sibling;return ht(kt,kt.current&1|2),a.child}s=s.sibling}x.tail!==null&&gt()>Ci&&(a.flags|=128,u=!0,Xl(x,!1),a.lanes=4194304)}else{if(!u)if(s=Ic(N),s!==null){if(a.flags|=128,u=!0,l=s.updateQueue,l!==null&&(a.updateQueue=l,a.flags|=4),Xl(x,!0),x.tail===null&&x.tailMode==="hidden"&&!N.alternate&&!vt)return nn(a),null}else 2*gt()-x.renderingStartTime>Ci&&l!==1073741824&&(a.flags|=128,u=!0,Xl(x,!1),a.lanes=4194304);x.isBackwards?(N.sibling=a.child,a.child=N):(l=x.last,l!==null?l.sibling=N:a.child=N,x.last=N)}return x.tail!==null?(a=x.tail,x.rendering=a,x.tail=a.sibling,x.renderingStartTime=gt(),a.sibling=null,l=kt.current,ht(kt,u?l&1|2:l&1),a):(nn(a),null);case 22:case 23:return qh(),u=a.memoizedState!==null,s!==null&&s.memoizedState!==null!==u&&(a.flags|=8192),u&&(a.mode&1)!==0?($n&1073741824)!==0&&(nn(a),a.subtreeFlags&6&&(a.flags|=8192)):nn(a),null;case 24:return null;case 25:return null}throw Error(r(156,a.tag))}function D1(s,a){switch(Ud(a),a.tag){case 1:return Nn(a.type)&&kc(),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return wi(),xt(wn),xt(en),th(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 5:return Yd(a),null;case 13:if(xt(kt),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(r(340));vi()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return xt(kt),null;case 4:return wi(),null;case 10:return Wd(a.type._context),null;case 22:case 23:return qh(),null;case 24:return null;default:return null}}var Bc=!1,sn=!1,U1=typeof WeakSet=="function"?WeakSet:Set,ye=null;function ki(s,a){var l=s.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(u){_t(s,a,u)}else l.current=null}function bh(s,a,l){try{l()}catch(u){_t(s,a,u)}}var Qx=!1;function Q1(s,a){if(qd=uc,s=bp(),Sd(s)){if("selectionStart"in s)var l={start:s.selectionStart,end:s.selectionEnd};else e:{l=(l=s.ownerDocument)&&l.defaultView||window;var u=l.getSelection&&l.getSelection();if(u&&u.rangeCount!==0){l=u.anchorNode;var m=u.anchorOffset,x=u.focusNode;u=u.focusOffset;try{l.nodeType,x.nodeType}catch{l=null;break e}var N=0,P=-1,R=-1,U=0,J=0,Y=s,G=null;t:for(;;){for(var fe;Y!==l||m!==0&&Y.nodeType!==3||(P=N+m),Y!==x||u!==0&&Y.nodeType!==3||(R=N+u),Y.nodeType===3&&(N+=Y.nodeValue.length),(fe=Y.firstChild)!==null;)G=Y,Y=fe;for(;;){if(Y===s)break t;if(G===l&&++U===m&&(P=N),G===x&&++J===u&&(R=N),(fe=Y.nextSibling)!==null)break;Y=G,G=Y.parentNode}Y=fe}l=P===-1||R===-1?null:{start:P,end:R}}else l=null}l=l||{start:0,end:0}}else l=null;for($d={focusedElem:s,selectionRange:l},uc=!1,ye=a;ye!==null;)if(a=ye,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,ye=s;else for(;ye!==null;){a=ye;try{var we=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(we!==null){var ke=we.memoizedProps,Mt=we.memoizedState,L=a.stateNode,$=L.getSnapshotBeforeUpdate(a.elementType===a.type?ke:ls(a.type,ke),Mt);L.__reactInternalSnapshotBeforeUpdate=$}break;case 3:var D=a.stateNode.containerInfo;D.nodeType===1?D.textContent="":D.nodeType===9&&D.documentElement&&D.removeChild(D.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ae){_t(a,a.return,ae)}if(s=a.sibling,s!==null){s.return=a.return,ye=s;break}ye=a.return}return we=Qx,Qx=!1,we}function Yl(s,a,l){var u=a.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var m=u=u.next;do{if((m.tag&s)===s){var x=m.destroy;m.destroy=void 0,x!==void 0&&bh(a,l,x)}m=m.next}while(m!==u)}}function Vc(s,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var l=a=a.next;do{if((l.tag&s)===s){var u=l.create;l.destroy=u()}l=l.next}while(l!==a)}}function wh(s){var a=s.ref;if(a!==null){var l=s.stateNode;switch(s.tag){case 5:s=l;break;default:s=l}typeof a=="function"?a(s):a.current=s}}function Bx(s){var a=s.alternate;a!==null&&(s.alternate=null,Bx(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&(delete a[bs],delete a[Ul],delete a[Ad],delete a[S1],delete a[C1])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function Vx(s){return s.tag===5||s.tag===3||s.tag===4}function Hx(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Vx(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Nh(s,a,l){var u=s.tag;if(u===5||u===6)s=s.stateNode,a?l.nodeType===8?l.parentNode.insertBefore(s,a):l.insertBefore(s,a):(l.nodeType===8?(a=l.parentNode,a.insertBefore(s,l)):(a=l,a.appendChild(s)),l=l._reactRootContainer,l!=null||a.onclick!==null||(a.onclick=wc));else if(u!==4&&(s=s.child,s!==null))for(Nh(s,a,l),s=s.sibling;s!==null;)Nh(s,a,l),s=s.sibling}function kh(s,a,l){var u=s.tag;if(u===5||u===6)s=s.stateNode,a?l.insertBefore(s,a):l.appendChild(s);else if(u!==4&&(s=s.child,s!==null))for(kh(s,a,l),s=s.sibling;s!==null;)kh(s,a,l),s=s.sibling}var Gt=null,os=!1;function kr(s,a,l){for(l=l.child;l!==null;)Kx(s,a,l),l=l.sibling}function Kx(s,a,l){if(js&&typeof js.onCommitFiberUnmount=="function")try{js.onCommitFiberUnmount(rc,l)}catch{}switch(l.tag){case 5:sn||ki(l,a);case 6:var u=Gt,m=os;Gt=null,kr(s,a,l),Gt=u,os=m,Gt!==null&&(os?(s=Gt,l=l.stateNode,s.nodeType===8?s.parentNode.removeChild(l):s.removeChild(l)):Gt.removeChild(l.stateNode));break;case 18:Gt!==null&&(os?(s=Gt,l=l.stateNode,s.nodeType===8?Od(s.parentNode,l):s.nodeType===1&&Od(s,l),Ml(s)):Od(Gt,l.stateNode));break;case 4:u=Gt,m=os,Gt=l.stateNode.containerInfo,os=!0,kr(s,a,l),Gt=u,os=m;break;case 0:case 11:case 14:case 15:if(!sn&&(u=l.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){m=u=u.next;do{var x=m,N=x.destroy;x=x.tag,N!==void 0&&((x&2)!==0||(x&4)!==0)&&bh(l,a,N),m=m.next}while(m!==u)}kr(s,a,l);break;case 1:if(!sn&&(ki(l,a),u=l.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=l.memoizedProps,u.state=l.memoizedState,u.componentWillUnmount()}catch(P){_t(l,a,P)}kr(s,a,l);break;case 21:kr(s,a,l);break;case 22:l.mode&1?(sn=(u=sn)||l.memoizedState!==null,kr(s,a,l),sn=u):kr(s,a,l);break;default:kr(s,a,l)}}function Wx(s){var a=s.updateQueue;if(a!==null){s.updateQueue=null;var l=s.stateNode;l===null&&(l=s.stateNode=new U1),a.forEach(function(u){var m=X1.bind(null,s,u);l.has(u)||(l.add(u),u.then(m,m))})}}function cs(s,a){var l=a.deletions;if(l!==null)for(var u=0;u<l.length;u++){var m=l[u];try{var x=s,N=a,P=N;e:for(;P!==null;){switch(P.tag){case 5:Gt=P.stateNode,os=!1;break e;case 3:Gt=P.stateNode.containerInfo,os=!0;break e;case 4:Gt=P.stateNode.containerInfo,os=!0;break e}P=P.return}if(Gt===null)throw Error(r(160));Kx(x,N,m),Gt=null,os=!1;var R=m.alternate;R!==null&&(R.return=null),m.return=null}catch(U){_t(m,a,U)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)Zx(a,s),a=a.sibling}function Zx(s,a){var l=s.alternate,u=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(cs(a,s),ks(s),u&4){try{Yl(3,s,s.return),Vc(3,s)}catch(ke){_t(s,s.return,ke)}try{Yl(5,s,s.return)}catch(ke){_t(s,s.return,ke)}}break;case 1:cs(a,s),ks(s),u&512&&l!==null&&ki(l,l.return);break;case 5:if(cs(a,s),ks(s),u&512&&l!==null&&ki(l,l.return),s.flags&32){var m=s.stateNode;try{zs(m,"")}catch(ke){_t(s,s.return,ke)}}if(u&4&&(m=s.stateNode,m!=null)){var x=s.memoizedProps,N=l!==null?l.memoizedProps:x,P=s.type,R=s.updateQueue;if(s.updateQueue=null,R!==null)try{P==="input"&&x.type==="radio"&&x.name!=null&&Ga(m,x),sa(P,N);var U=sa(P,x);for(N=0;N<R.length;N+=2){var J=R[N],Y=R[N+1];J==="style"?Ot(m,Y):J==="dangerouslySetInnerHTML"?vs(m,Y):J==="children"?zs(m,Y):O(m,J,Y,U)}switch(P){case"input":ta(m,x);break;case"textarea":Xa(m,x);break;case"select":var G=m._wrapperState.wasMultiple;m._wrapperState.wasMultiple=!!x.multiple;var fe=x.value;fe!=null?Rn(m,!!x.multiple,fe,!1):G!==!!x.multiple&&(x.defaultValue!=null?Rn(m,!!x.multiple,x.defaultValue,!0):Rn(m,!!x.multiple,x.multiple?[]:"",!1))}m[Ul]=x}catch(ke){_t(s,s.return,ke)}}break;case 6:if(cs(a,s),ks(s),u&4){if(s.stateNode===null)throw Error(r(162));m=s.stateNode,x=s.memoizedProps;try{m.nodeValue=x}catch(ke){_t(s,s.return,ke)}}break;case 3:if(cs(a,s),ks(s),u&4&&l!==null&&l.memoizedState.isDehydrated)try{Ml(a.containerInfo)}catch(ke){_t(s,s.return,ke)}break;case 4:cs(a,s),ks(s);break;case 13:cs(a,s),ks(s),m=s.child,m.flags&8192&&(x=m.memoizedState!==null,m.stateNode.isHidden=x,!x||m.alternate!==null&&m.alternate.memoizedState!==null||(_h=gt())),u&4&&Wx(s);break;case 22:if(J=l!==null&&l.memoizedState!==null,s.mode&1?(sn=(U=sn)||J,cs(a,s),sn=U):cs(a,s),ks(s),u&8192){if(U=s.memoizedState!==null,(s.stateNode.isHidden=U)&&!J&&(s.mode&1)!==0)for(ye=s,J=s.child;J!==null;){for(Y=ye=J;ye!==null;){switch(G=ye,fe=G.child,G.tag){case 0:case 11:case 14:case 15:Yl(4,G,G.return);break;case 1:ki(G,G.return);var we=G.stateNode;if(typeof we.componentWillUnmount=="function"){u=G,l=G.return;try{a=u,we.props=a.memoizedProps,we.state=a.memoizedState,we.componentWillUnmount()}catch(ke){_t(u,l,ke)}}break;case 5:ki(G,G.return);break;case 22:if(G.memoizedState!==null){Xx(Y);continue}}fe!==null?(fe.return=G,ye=fe):Xx(Y)}J=J.sibling}e:for(J=null,Y=s;;){if(Y.tag===5){if(J===null){J=Y;try{m=Y.stateNode,U?(x=m.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(P=Y.stateNode,R=Y.memoizedProps.style,N=R!=null&&R.hasOwnProperty("display")?R.display:null,P.style.display=hl("display",N))}catch(ke){_t(s,s.return,ke)}}}else if(Y.tag===6){if(J===null)try{Y.stateNode.nodeValue=U?"":Y.memoizedProps}catch(ke){_t(s,s.return,ke)}}else if((Y.tag!==22&&Y.tag!==23||Y.memoizedState===null||Y===s)&&Y.child!==null){Y.child.return=Y,Y=Y.child;continue}if(Y===s)break e;for(;Y.sibling===null;){if(Y.return===null||Y.return===s)break e;J===Y&&(J=null),Y=Y.return}J===Y&&(J=null),Y.sibling.return=Y.return,Y=Y.sibling}}break;case 19:cs(a,s),ks(s),u&4&&Wx(s);break;case 21:break;default:cs(a,s),ks(s)}}function ks(s){var a=s.flags;if(a&2){try{e:{for(var l=s.return;l!==null;){if(Vx(l)){var u=l;break e}l=l.return}throw Error(r(160))}switch(u.tag){case 5:var m=u.stateNode;u.flags&32&&(zs(m,""),u.flags&=-33);var x=Hx(s);kh(s,x,m);break;case 3:case 4:var N=u.stateNode.containerInfo,P=Hx(s);Nh(s,P,N);break;default:throw Error(r(161))}}catch(R){_t(s,s.return,R)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function B1(s,a,l){ye=s,Gx(s)}function Gx(s,a,l){for(var u=(s.mode&1)!==0;ye!==null;){var m=ye,x=m.child;if(m.tag===22&&u){var N=m.memoizedState!==null||Bc;if(!N){var P=m.alternate,R=P!==null&&P.memoizedState!==null||sn;P=Bc;var U=sn;if(Bc=N,(sn=R)&&!U)for(ye=m;ye!==null;)N=ye,R=N.child,N.tag===22&&N.memoizedState!==null?Yx(m):R!==null?(R.return=N,ye=R):Yx(m);for(;x!==null;)ye=x,Gx(x),x=x.sibling;ye=m,Bc=P,sn=U}Jx(s)}else(m.subtreeFlags&8772)!==0&&x!==null?(x.return=m,ye=x):Jx(s)}}function Jx(s){for(;ye!==null;){var a=ye;if((a.flags&8772)!==0){var l=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:sn||Vc(5,a);break;case 1:var u=a.stateNode;if(a.flags&4&&!sn)if(l===null)u.componentDidMount();else{var m=a.elementType===a.type?l.memoizedProps:ls(a.type,l.memoizedProps);u.componentDidUpdate(m,l.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var x=a.updateQueue;x!==null&&Xp(a,x,u);break;case 3:var N=a.updateQueue;if(N!==null){if(l=null,a.child!==null)switch(a.child.tag){case 5:l=a.child.stateNode;break;case 1:l=a.child.stateNode}Xp(a,N,l)}break;case 5:var P=a.stateNode;if(l===null&&a.flags&4){l=P;var R=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":R.autoFocus&&l.focus();break;case"img":R.src&&(l.src=R.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var U=a.alternate;if(U!==null){var J=U.memoizedState;if(J!==null){var Y=J.dehydrated;Y!==null&&Ml(Y)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}sn||a.flags&512&&wh(a)}catch(G){_t(a,a.return,G)}}if(a===s){ye=null;break}if(l=a.sibling,l!==null){l.return=a.return,ye=l;break}ye=a.return}}function Xx(s){for(;ye!==null;){var a=ye;if(a===s){ye=null;break}var l=a.sibling;if(l!==null){l.return=a.return,ye=l;break}ye=a.return}}function Yx(s){for(;ye!==null;){var a=ye;try{switch(a.tag){case 0:case 11:case 15:var l=a.return;try{Vc(4,a)}catch(R){_t(a,l,R)}break;case 1:var u=a.stateNode;if(typeof u.componentDidMount=="function"){var m=a.return;try{u.componentDidMount()}catch(R){_t(a,m,R)}}var x=a.return;try{wh(a)}catch(R){_t(a,x,R)}break;case 5:var N=a.return;try{wh(a)}catch(R){_t(a,N,R)}}}catch(R){_t(a,a.return,R)}if(a===s){ye=null;break}var P=a.sibling;if(P!==null){P.return=a.return,ye=P;break}ye=a.return}}var V1=Math.ceil,Hc=T.ReactCurrentDispatcher,Sh=T.ReactCurrentOwner,Zn=T.ReactCurrentBatchConfig,Je=0,Bt=null,qt=null,Jt=0,$n=0,Si=yr(0),Lt=0,eo=null,ma=0,Kc=0,Ch=0,to=null,Sn=null,_h=0,Ci=1/0,Hs=null,Wc=!1,Ph=null,Sr=null,Zc=!1,Cr=null,Gc=0,no=0,Eh=null,Jc=-1,Xc=0;function hn(){return(Je&6)!==0?gt():Jc!==-1?Jc:Jc=gt()}function _r(s){return(s.mode&1)===0?1:(Je&2)!==0&&Jt!==0?Jt&-Jt:P1.transition!==null?(Xc===0&&(Xc=Hm()),Xc):(s=it,s!==0||(s=window.event,s=s===void 0?16:tp(s.type)),s)}function us(s,a,l,u){if(50<no)throw no=0,Eh=null,Error(r(185));Cl(s,l,u),((Je&2)===0||s!==Bt)&&(s===Bt&&((Je&2)===0&&(Kc|=l),Lt===4&&Pr(s,Jt)),Cn(s,u),l===1&&Je===0&&(a.mode&1)===0&&(Ci=gt()+500,Cc&&br()))}function Cn(s,a){var l=s.callbackNode;Pj(s,a);var u=lc(s,s===Bt?Jt:0);if(u===0)l!==null&&Nl(l),s.callbackNode=null,s.callbackPriority=0;else if(a=u&-u,s.callbackPriority!==a){if(l!=null&&Nl(l),a===1)s.tag===0?_1(tg.bind(null,s)):Fp(tg.bind(null,s)),N1(function(){(Je&6)===0&&br()}),l=null;else{switch(Km(u)){case 1:l=nt;break;case 4:l=et;break;case 16:l=Tt;break;case 536870912:l=Vm;break;default:l=Tt}l=cg(l,eg.bind(null,s))}s.callbackPriority=a,s.callbackNode=l}}function eg(s,a){if(Jc=-1,Xc=0,(Je&6)!==0)throw Error(r(327));var l=s.callbackNode;if(_i()&&s.callbackNode!==l)return null;var u=lc(s,s===Bt?Jt:0);if(u===0)return null;if((u&30)!==0||(u&s.expiredLanes)!==0||a)a=Yc(s,u);else{a=u;var m=Je;Je|=2;var x=sg();(Bt!==s||Jt!==a)&&(Hs=null,Ci=gt()+500,xa(s,a));do try{W1();break}catch(P){ng(s,P)}while(!0);Kd(),Hc.current=x,Je=m,qt!==null?a=0:(Bt=null,Jt=0,a=Lt)}if(a!==0){if(a===2&&(m=cd(s),m!==0&&(u=m,a=Rh(s,m))),a===1)throw l=eo,xa(s,0),Pr(s,u),Cn(s,gt()),l;if(a===6)Pr(s,u);else{if(m=s.current.alternate,(u&30)===0&&!H1(m)&&(a=Yc(s,u),a===2&&(x=cd(s),x!==0&&(u=x,a=Rh(s,x))),a===1))throw l=eo,xa(s,0),Pr(s,u),Cn(s,gt()),l;switch(s.finishedWork=m,s.finishedLanes=u,a){case 0:case 1:throw Error(r(345));case 2:ga(s,Sn,Hs);break;case 3:if(Pr(s,u),(u&130023424)===u&&(a=_h+500-gt(),10<a)){if(lc(s,0)!==0)break;if(m=s.suspendedLanes,(m&u)!==u){hn(),s.pingedLanes|=s.suspendedLanes&m;break}s.timeoutHandle=zd(ga.bind(null,s,Sn,Hs),a);break}ga(s,Sn,Hs);break;case 4:if(Pr(s,u),(u&4194240)===u)break;for(a=s.eventTimes,m=-1;0<u;){var N=31-rs(u);x=1<<N,N=a[N],N>m&&(m=N),u&=~x}if(u=m,u=gt()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*V1(u/1960))-u,10<u){s.timeoutHandle=zd(ga.bind(null,s,Sn,Hs),u);break}ga(s,Sn,Hs);break;case 5:ga(s,Sn,Hs);break;default:throw Error(r(329))}}}return Cn(s,gt()),s.callbackNode===l?eg.bind(null,s):null}function Rh(s,a){var l=to;return s.current.memoizedState.isDehydrated&&(xa(s,a).flags|=256),s=Yc(s,a),s!==2&&(a=Sn,Sn=l,a!==null&&Mh(a)),s}function Mh(s){Sn===null?Sn=s:Sn.push.apply(Sn,s)}function H1(s){for(var a=s;;){if(a.flags&16384){var l=a.updateQueue;if(l!==null&&(l=l.stores,l!==null))for(var u=0;u<l.length;u++){var m=l[u],x=m.getSnapshot;m=m.value;try{if(!as(x(),m))return!1}catch{return!1}}}if(l=a.child,a.subtreeFlags&16384&&l!==null)l.return=a,a=l;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Pr(s,a){for(a&=~Ch,a&=~Kc,s.suspendedLanes|=a,s.pingedLanes&=~a,s=s.expirationTimes;0<a;){var l=31-rs(a),u=1<<l;s[l]=-1,a&=~u}}function tg(s){if((Je&6)!==0)throw Error(r(327));_i();var a=lc(s,0);if((a&1)===0)return Cn(s,gt()),null;var l=Yc(s,a);if(s.tag!==0&&l===2){var u=cd(s);u!==0&&(a=u,l=Rh(s,u))}if(l===1)throw l=eo,xa(s,0),Pr(s,a),Cn(s,gt()),l;if(l===6)throw Error(r(345));return s.finishedWork=s.current.alternate,s.finishedLanes=a,ga(s,Sn,Hs),Cn(s,gt()),null}function Th(s,a){var l=Je;Je|=1;try{return s(a)}finally{Je=l,Je===0&&(Ci=gt()+500,Cc&&br())}}function pa(s){Cr!==null&&Cr.tag===0&&(Je&6)===0&&_i();var a=Je;Je|=1;var l=Zn.transition,u=it;try{if(Zn.transition=null,it=1,s)return s()}finally{it=u,Zn.transition=l,Je=a,(Je&6)===0&&br()}}function qh(){$n=Si.current,xt(Si)}function xa(s,a){s.finishedWork=null,s.finishedLanes=0;var l=s.timeoutHandle;if(l!==-1&&(s.timeoutHandle=-1,w1(l)),qt!==null)for(l=qt.return;l!==null;){var u=l;switch(Ud(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&kc();break;case 3:wi(),xt(wn),xt(en),th();break;case 5:Yd(u);break;case 4:wi();break;case 13:xt(kt);break;case 19:xt(kt);break;case 10:Wd(u.type._context);break;case 22:case 23:qh()}l=l.return}if(Bt=s,qt=s=Er(s.current,null),Jt=$n=a,Lt=0,eo=null,Ch=Kc=ma=0,Sn=to=null,da!==null){for(a=0;a<da.length;a++)if(l=da[a],u=l.interleaved,u!==null){l.interleaved=null;var m=u.next,x=l.pending;if(x!==null){var N=x.next;x.next=m,u.next=N}l.pending=u}da=null}return s}function ng(s,a){do{var l=qt;try{if(Kd(),zc.current=Fc,Oc){for(var u=St.memoizedState;u!==null;){var m=u.queue;m!==null&&(m.pending=null),u=u.next}Oc=!1}if(fa=0,Qt=At=St=null,Wl=!1,Zl=0,Sh.current=null,l===null||l.return===null){Lt=1,eo=a,qt=null;break}e:{var x=s,N=l.return,P=l,R=a;if(a=Jt,P.flags|=32768,R!==null&&typeof R=="object"&&typeof R.then=="function"){var U=R,J=P,Y=J.tag;if((J.mode&1)===0&&(Y===0||Y===11||Y===15)){var G=J.alternate;G?(J.updateQueue=G.updateQueue,J.memoizedState=G.memoizedState,J.lanes=G.lanes):(J.updateQueue=null,J.memoizedState=null)}var fe=_x(N);if(fe!==null){fe.flags&=-257,Px(fe,N,P,x,a),fe.mode&1&&Cx(x,U,a),a=fe,R=U;var we=a.updateQueue;if(we===null){var ke=new Set;ke.add(R),a.updateQueue=ke}else we.add(R);break e}else{if((a&1)===0){Cx(x,U,a),$h();break e}R=Error(r(426))}}else if(vt&&P.mode&1){var Mt=_x(N);if(Mt!==null){(Mt.flags&65536)===0&&(Mt.flags|=256),Px(Mt,N,P,x,a),Vd(Ni(R,P));break e}}x=R=Ni(R,P),Lt!==4&&(Lt=2),to===null?to=[x]:to.push(x),x=N;do{switch(x.tag){case 3:x.flags|=65536,a&=-a,x.lanes|=a;var L=kx(x,R,a);Jp(x,L);break e;case 1:P=R;var $=x.type,D=x.stateNode;if((x.flags&128)===0&&(typeof $.getDerivedStateFromError=="function"||D!==null&&typeof D.componentDidCatch=="function"&&(Sr===null||!Sr.has(D)))){x.flags|=65536,a&=-a,x.lanes|=a;var ae=Sx(x,P,a);Jp(x,ae);break e}}x=x.return}while(x!==null)}ag(l)}catch(Ce){a=Ce,qt===l&&l!==null&&(qt=l=l.return);continue}break}while(!0)}function sg(){var s=Hc.current;return Hc.current=Fc,s===null?Fc:s}function $h(){(Lt===0||Lt===3||Lt===2)&&(Lt=4),Bt===null||(ma&268435455)===0&&(Kc&268435455)===0||Pr(Bt,Jt)}function Yc(s,a){var l=Je;Je|=2;var u=sg();(Bt!==s||Jt!==a)&&(Hs=null,xa(s,a));do try{K1();break}catch(m){ng(s,m)}while(!0);if(Kd(),Je=l,Hc.current=u,qt!==null)throw Error(r(261));return Bt=null,Jt=0,Lt}function K1(){for(;qt!==null;)rg(qt)}function W1(){for(;qt!==null&&!nc();)rg(qt)}function rg(s){var a=og(s.alternate,s,$n);s.memoizedProps=s.pendingProps,a===null?ag(s):qt=a,Sh.current=null}function ag(s){var a=s;do{var l=a.alternate;if(s=a.return,(a.flags&32768)===0){if(l=F1(l,a,$n),l!==null){qt=l;return}}else{if(l=D1(l,a),l!==null){l.flags&=32767,qt=l;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{Lt=6,qt=null;return}}if(a=a.sibling,a!==null){qt=a;return}qt=a=s}while(a!==null);Lt===0&&(Lt=5)}function ga(s,a,l){var u=it,m=Zn.transition;try{Zn.transition=null,it=1,Z1(s,a,l,u)}finally{Zn.transition=m,it=u}return null}function Z1(s,a,l,u){do _i();while(Cr!==null);if((Je&6)!==0)throw Error(r(327));l=s.finishedWork;var m=s.finishedLanes;if(l===null)return null;if(s.finishedWork=null,s.finishedLanes=0,l===s.current)throw Error(r(177));s.callbackNode=null,s.callbackPriority=0;var x=l.lanes|l.childLanes;if(Ej(s,x),s===Bt&&(qt=Bt=null,Jt=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||Zc||(Zc=!0,cg(Tt,function(){return _i(),null})),x=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||x){x=Zn.transition,Zn.transition=null;var N=it;it=1;var P=Je;Je|=4,Sh.current=null,Q1(s,l),Zx(l,s),p1($d),uc=!!qd,$d=qd=null,s.current=l,B1(l),sc(),Je=P,it=N,Zn.transition=x}else s.current=l;if(Zc&&(Zc=!1,Cr=s,Gc=m),x=s.pendingLanes,x===0&&(Sr=null),Nj(l.stateNode),Cn(s,gt()),a!==null)for(u=s.onRecoverableError,l=0;l<a.length;l++)m=a[l],u(m.value,{componentStack:m.stack,digest:m.digest});if(Wc)throw Wc=!1,s=Ph,Ph=null,s;return(Gc&1)!==0&&s.tag!==0&&_i(),x=s.pendingLanes,(x&1)!==0?s===Eh?no++:(no=0,Eh=s):no=0,br(),null}function _i(){if(Cr!==null){var s=Km(Gc),a=Zn.transition,l=it;try{if(Zn.transition=null,it=16>s?16:s,Cr===null)var u=!1;else{if(s=Cr,Cr=null,Gc=0,(Je&6)!==0)throw Error(r(331));var m=Je;for(Je|=4,ye=s.current;ye!==null;){var x=ye,N=x.child;if((ye.flags&16)!==0){var P=x.deletions;if(P!==null){for(var R=0;R<P.length;R++){var U=P[R];for(ye=U;ye!==null;){var J=ye;switch(J.tag){case 0:case 11:case 15:Yl(8,J,x)}var Y=J.child;if(Y!==null)Y.return=J,ye=Y;else for(;ye!==null;){J=ye;var G=J.sibling,fe=J.return;if(Bx(J),J===U){ye=null;break}if(G!==null){G.return=fe,ye=G;break}ye=fe}}}var we=x.alternate;if(we!==null){var ke=we.child;if(ke!==null){we.child=null;do{var Mt=ke.sibling;ke.sibling=null,ke=Mt}while(ke!==null)}}ye=x}}if((x.subtreeFlags&2064)!==0&&N!==null)N.return=x,ye=N;else e:for(;ye!==null;){if(x=ye,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Yl(9,x,x.return)}var L=x.sibling;if(L!==null){L.return=x.return,ye=L;break e}ye=x.return}}var $=s.current;for(ye=$;ye!==null;){N=ye;var D=N.child;if((N.subtreeFlags&2064)!==0&&D!==null)D.return=N,ye=D;else e:for(N=$;ye!==null;){if(P=ye,(P.flags&2048)!==0)try{switch(P.tag){case 0:case 11:case 15:Vc(9,P)}}catch(Ce){_t(P,P.return,Ce)}if(P===N){ye=null;break e}var ae=P.sibling;if(ae!==null){ae.return=P.return,ye=ae;break e}ye=P.return}}if(Je=m,br(),js&&typeof js.onPostCommitFiberRoot=="function")try{js.onPostCommitFiberRoot(rc,s)}catch{}u=!0}return u}finally{it=l,Zn.transition=a}}return!1}function ig(s,a,l){a=Ni(l,a),a=kx(s,a,1),s=Nr(s,a,1),a=hn(),s!==null&&(Cl(s,1,a),Cn(s,a))}function _t(s,a,l){if(s.tag===3)ig(s,s,l);else for(;a!==null;){if(a.tag===3){ig(a,s,l);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Sr===null||!Sr.has(u))){s=Ni(l,s),s=Sx(a,s,1),a=Nr(a,s,1),s=hn(),a!==null&&(Cl(a,1,s),Cn(a,s));break}}a=a.return}}function G1(s,a,l){var u=s.pingCache;u!==null&&u.delete(a),a=hn(),s.pingedLanes|=s.suspendedLanes&l,Bt===s&&(Jt&l)===l&&(Lt===4||Lt===3&&(Jt&130023424)===Jt&&500>gt()-_h?xa(s,0):Ch|=l),Cn(s,a)}function lg(s,a){a===0&&((s.mode&1)===0?a=1:(a=ic,ic<<=1,(ic&130023424)===0&&(ic=4194304)));var l=hn();s=Qs(s,a),s!==null&&(Cl(s,a,l),Cn(s,l))}function J1(s){var a=s.memoizedState,l=0;a!==null&&(l=a.retryLane),lg(s,l)}function X1(s,a){var l=0;switch(s.tag){case 13:var u=s.stateNode,m=s.memoizedState;m!==null&&(l=m.retryLane);break;case 19:u=s.stateNode;break;default:throw Error(r(314))}u!==null&&u.delete(a),lg(s,l)}var og;og=function(s,a,l){if(s!==null)if(s.memoizedProps!==a.pendingProps||wn.current)kn=!0;else{if((s.lanes&l)===0&&(a.flags&128)===0)return kn=!1,L1(s,a,l);kn=(s.flags&131072)!==0}else kn=!1,vt&&(a.flags&1048576)!==0&&Dp(a,Pc,a.index);switch(a.lanes=0,a.tag){case 2:var u=a.type;Qc(s,a),s=a.pendingProps;var m=pi(a,en.current);bi(a,l),m=rh(null,a,u,s,m,l);var x=ah();return a.flags|=1,typeof m=="object"&&m!==null&&typeof m.render=="function"&&m.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,Nn(u)?(x=!0,Sc(a)):x=!1,a.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,Jd(a),m.updater=Dc,a.stateNode=m,m._reactInternals=a,dh(a,u,s,l),a=ph(null,a,u,!0,x,l)):(a.tag=0,vt&&x&&Dd(a),dn(null,a,m,l),a=a.child),a;case 16:u=a.elementType;e:{switch(Qc(s,a),s=a.pendingProps,m=u._init,u=m(u._payload),a.type=u,m=a.tag=eb(u),s=ls(u,s),m){case 0:a=mh(null,a,u,s,l);break e;case 1:a=$x(null,a,u,s,l);break e;case 11:a=Ex(null,a,u,s,l);break e;case 14:a=Rx(null,a,u,ls(u.type,s),l);break e}throw Error(r(306,u,""))}return a;case 0:return u=a.type,m=a.pendingProps,m=a.elementType===u?m:ls(u,m),mh(s,a,u,m,l);case 1:return u=a.type,m=a.pendingProps,m=a.elementType===u?m:ls(u,m),$x(s,a,u,m,l);case 3:e:{if(Ix(a),s===null)throw Error(r(387));u=a.pendingProps,x=a.memoizedState,m=x.element,Gp(s,a),$c(a,u,null,l);var N=a.memoizedState;if(u=N.element,x.isDehydrated)if(x={element:u,isDehydrated:!1,cache:N.cache,pendingSuspenseBoundaries:N.pendingSuspenseBoundaries,transitions:N.transitions},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){m=Ni(Error(r(423)),a),a=zx(s,a,u,l,m);break e}else if(u!==m){m=Ni(Error(r(424)),a),a=zx(s,a,u,l,m);break e}else for(qn=vr(a.stateNode.containerInfo.firstChild),Tn=a,vt=!0,is=null,l=Wp(a,null,u,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(vi(),u===m){a=Vs(s,a,l);break e}dn(s,a,u,l)}a=a.child}return a;case 5:return Yp(a),s===null&&Bd(a),u=a.type,m=a.pendingProps,x=s!==null?s.memoizedProps:null,N=m.children,Id(u,m)?N=null:x!==null&&Id(u,x)&&(a.flags|=32),qx(s,a),dn(s,a,N,l),a.child;case 6:return s===null&&Bd(a),null;case 13:return Ox(s,a,l);case 4:return Xd(a,a.stateNode.containerInfo),u=a.pendingProps,s===null?a.child=yi(a,null,u,l):dn(s,a,u,l),a.child;case 11:return u=a.type,m=a.pendingProps,m=a.elementType===u?m:ls(u,m),Ex(s,a,u,m,l);case 7:return dn(s,a,a.pendingProps,l),a.child;case 8:return dn(s,a,a.pendingProps.children,l),a.child;case 12:return dn(s,a,a.pendingProps.children,l),a.child;case 10:e:{if(u=a.type._context,m=a.pendingProps,x=a.memoizedProps,N=m.value,ht(Mc,u._currentValue),u._currentValue=N,x!==null)if(as(x.value,N)){if(x.children===m.children&&!wn.current){a=Vs(s,a,l);break e}}else for(x=a.child,x!==null&&(x.return=a);x!==null;){var P=x.dependencies;if(P!==null){N=x.child;for(var R=P.firstContext;R!==null;){if(R.context===u){if(x.tag===1){R=Bs(-1,l&-l),R.tag=2;var U=x.updateQueue;if(U!==null){U=U.shared;var J=U.pending;J===null?R.next=R:(R.next=J.next,J.next=R),U.pending=R}}x.lanes|=l,R=x.alternate,R!==null&&(R.lanes|=l),Zd(x.return,l,a),P.lanes|=l;break}R=R.next}}else if(x.tag===10)N=x.type===a.type?null:x.child;else if(x.tag===18){if(N=x.return,N===null)throw Error(r(341));N.lanes|=l,P=N.alternate,P!==null&&(P.lanes|=l),Zd(N,l,a),N=x.sibling}else N=x.child;if(N!==null)N.return=x;else for(N=x;N!==null;){if(N===a){N=null;break}if(x=N.sibling,x!==null){x.return=N.return,N=x;break}N=N.return}x=N}dn(s,a,m.children,l),a=a.child}return a;case 9:return m=a.type,u=a.pendingProps.children,bi(a,l),m=Kn(m),u=u(m),a.flags|=1,dn(s,a,u,l),a.child;case 14:return u=a.type,m=ls(u,a.pendingProps),m=ls(u.type,m),Rx(s,a,u,m,l);case 15:return Mx(s,a,a.type,a.pendingProps,l);case 17:return u=a.type,m=a.pendingProps,m=a.elementType===u?m:ls(u,m),Qc(s,a),a.tag=1,Nn(u)?(s=!0,Sc(a)):s=!1,bi(a,l),wx(a,u,m),dh(a,u,m,l),ph(null,a,u,!0,s,l);case 19:return Lx(s,a,l);case 22:return Tx(s,a,l)}throw Error(r(156,a.tag))};function cg(s,a){return wl(s,a)}function Y1(s,a,l,u){this.tag=s,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gn(s,a,l,u){return new Y1(s,a,l,u)}function Ih(s){return s=s.prototype,!(!s||!s.isReactComponent)}function eb(s){if(typeof s=="function")return Ih(s)?1:0;if(s!=null){if(s=s.$$typeof,s===de)return 11;if(s===Ie)return 14}return 2}function Er(s,a){var l=s.alternate;return l===null?(l=Gn(s.tag,a,s.key,s.mode),l.elementType=s.elementType,l.type=s.type,l.stateNode=s.stateNode,l.alternate=s,s.alternate=l):(l.pendingProps=a,l.type=s.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=s.flags&14680064,l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,a=s.dependencies,l.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},l.sibling=s.sibling,l.index=s.index,l.ref=s.ref,l}function eu(s,a,l,u,m,x){var N=2;if(u=s,typeof s=="function")Ih(s)&&(N=1);else if(typeof s=="string")N=5;else e:switch(s){case I:return va(l.children,m,x,a);case Q:N=8,m|=8;break;case H:return s=Gn(12,l,a,m|2),s.elementType=H,s.lanes=x,s;case ce:return s=Gn(13,l,a,m),s.elementType=ce,s.lanes=x,s;case Ne:return s=Gn(19,l,a,m),s.elementType=Ne,s.lanes=x,s;case De:return tu(l,m,x,a);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case q:N=10;break e;case B:N=9;break e;case de:N=11;break e;case Ie:N=14;break e;case ot:N=16,u=null;break e}throw Error(r(130,s==null?s:typeof s,""))}return a=Gn(N,l,a,m),a.elementType=s,a.type=u,a.lanes=x,a}function va(s,a,l,u){return s=Gn(7,s,u,a),s.lanes=l,s}function tu(s,a,l,u){return s=Gn(22,s,u,a),s.elementType=De,s.lanes=l,s.stateNode={isHidden:!1},s}function zh(s,a,l){return s=Gn(6,s,null,a),s.lanes=l,s}function Oh(s,a,l){return a=Gn(4,s.children!==null?s.children:[],s.key,a),a.lanes=l,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function tb(s,a,l,u,m){this.tag=a,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ud(0),this.expirationTimes=ud(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ud(0),this.identifierPrefix=u,this.onRecoverableError=m,this.mutableSourceEagerHydrationData=null}function Ah(s,a,l,u,m,x,N,P,R){return s=new tb(s,a,l,P,R),a===1?(a=1,x===!0&&(a|=8)):a=0,x=Gn(3,null,null,a),s.current=x,x.stateNode=s,x.memoizedState={element:u,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},Jd(x),s}function nb(s,a,l){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:E,key:u==null?null:""+u,children:s,containerInfo:a,implementation:l}}function ug(s){if(!s)return jr;s=s._reactInternals;e:{if(ys(s)!==s||s.tag!==1)throw Error(r(170));var a=s;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(Nn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(r(171))}if(s.tag===1){var l=s.type;if(Nn(l))return Ap(s,l,a)}return a}function dg(s,a,l,u,m,x,N,P,R){return s=Ah(l,u,!0,s,m,x,N,P,R),s.context=ug(null),l=s.current,u=hn(),m=_r(l),x=Bs(u,m),x.callback=a??null,Nr(l,x,m),s.current.lanes=m,Cl(s,m,u),Cn(s,u),s}function nu(s,a,l,u){var m=a.current,x=hn(),N=_r(m);return l=ug(l),a.context===null?a.context=l:a.pendingContext=l,a=Bs(x,N),a.payload={element:s},u=u===void 0?null:u,u!==null&&(a.callback=u),s=Nr(m,a,N),s!==null&&(us(s,m,N,x),qc(s,m,N)),N}function su(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 5:return s.child.stateNode;default:return s.child.stateNode}}function hg(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<a?l:a}}function Lh(s,a){hg(s,a),(s=s.alternate)&&hg(s,a)}function sb(){return null}var fg=typeof reportError=="function"?reportError:function(s){console.error(s)};function Fh(s){this._internalRoot=s}ru.prototype.render=Fh.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(r(409));nu(s,a,null,null)},ru.prototype.unmount=Fh.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;pa(function(){nu(null,s,null,null)}),a[Ls]=null}};function ru(s){this._internalRoot=s}ru.prototype.unstable_scheduleHydration=function(s){if(s){var a=Gm();s={blockedOn:null,target:s,priority:a};for(var l=0;l<pr.length&&a!==0&&a<pr[l].priority;l++);pr.splice(l,0,s),l===0&&Ym(s)}};function Dh(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function au(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function mg(){}function rb(s,a,l,u,m){if(m){if(typeof u=="function"){var x=u;u=function(){var U=su(N);x.call(U)}}var N=dg(a,u,s,0,null,!1,!1,"",mg);return s._reactRootContainer=N,s[Ls]=N.current,Fl(s.nodeType===8?s.parentNode:s),pa(),N}for(;m=s.lastChild;)s.removeChild(m);if(typeof u=="function"){var P=u;u=function(){var U=su(R);P.call(U)}}var R=Ah(s,0,!1,null,null,!1,!1,"",mg);return s._reactRootContainer=R,s[Ls]=R.current,Fl(s.nodeType===8?s.parentNode:s),pa(function(){nu(a,R,l,u)}),R}function iu(s,a,l,u,m){var x=l._reactRootContainer;if(x){var N=x;if(typeof m=="function"){var P=m;m=function(){var R=su(N);P.call(R)}}nu(a,N,s,m)}else N=rb(l,a,s,m,u);return su(N)}Wm=function(s){switch(s.tag){case 3:var a=s.stateNode;if(a.current.memoizedState.isDehydrated){var l=Sl(a.pendingLanes);l!==0&&(dd(a,l|1),Cn(a,gt()),(Je&6)===0&&(Ci=gt()+500,br()))}break;case 13:pa(function(){var u=Qs(s,1);if(u!==null){var m=hn();us(u,s,1,m)}}),Lh(s,1)}},hd=function(s){if(s.tag===13){var a=Qs(s,134217728);if(a!==null){var l=hn();us(a,s,134217728,l)}Lh(s,134217728)}},Zm=function(s){if(s.tag===13){var a=_r(s),l=Qs(s,a);if(l!==null){var u=hn();us(l,s,a,u)}Lh(s,a)}},Gm=function(){return it},Jm=function(s,a){var l=it;try{return it=s,a()}finally{it=l}},ni=function(s,a,l){switch(a){case"input":if(ta(s,l),a=l.name,l.type==="radio"&&a!=null){for(l=s;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<l.length;a++){var u=l[a];if(u!==s&&u.form===s.form){var m=Nc(u);if(!m)throw Error(r(90));ul(u),ta(u,m)}}}break;case"textarea":Xa(s,l);break;case"select":a=l.value,a!=null&&Rn(s,!!l.multiple,a,!1)}},pl=Th,xl=pa;var ab={usingClientEntryPoint:!1,Events:[Ql,fi,Nc,ra,ml,Th]},so={findFiberByHostInstance:la,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ib={bundleType:so.bundleType,version:so.version,rendererPackageName:so.rendererPackageName,rendererConfig:so.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=jl(s),s===null?null:s.stateNode},findFiberByHostInstance:so.findFiberByHostInstance||sb,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lu.isDisabled&&lu.supportsFiber)try{rc=lu.inject(ib),js=lu}catch{}}return _n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ab,_n.createPortal=function(s,a){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Dh(a))throw Error(r(200));return nb(s,a,null,l)},_n.createRoot=function(s,a){if(!Dh(s))throw Error(r(299));var l=!1,u="",m=fg;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onRecoverableError!==void 0&&(m=a.onRecoverableError)),a=Ah(s,1,!1,null,null,l,!1,u,m),s[Ls]=a.current,Fl(s.nodeType===8?s.parentNode:s),new Fh(a)},_n.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=jl(a),s=s===null?null:s.stateNode,s},_n.flushSync=function(s){return pa(s)},_n.hydrate=function(s,a,l){if(!au(a))throw Error(r(200));return iu(null,s,a,!0,l)},_n.hydrateRoot=function(s,a,l){if(!Dh(s))throw Error(r(405));var u=l!=null&&l.hydratedSources||null,m=!1,x="",N=fg;if(l!=null&&(l.unstable_strictMode===!0&&(m=!0),l.identifierPrefix!==void 0&&(x=l.identifierPrefix),l.onRecoverableError!==void 0&&(N=l.onRecoverableError)),a=dg(a,null,s,1,l??null,m,!1,x,N),s[Ls]=a.current,Fl(s),u)for(s=0;s<u.length;s++)l=u[s],m=l._getVersion,m=m(l._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[l,m]:a.mutableSourceEagerHydrationData.push(l,m);return new ru(a)},_n.render=function(s,a,l){if(!au(a))throw Error(r(200));return iu(null,s,a,!1,l)},_n.unmountComponentAtNode=function(s){if(!au(s))throw Error(r(40));return s._reactRootContainer?(pa(function(){iu(null,null,s,!1,function(){s._reactRootContainer=null,s[Ls]=null})}),!0):!1},_n.unstable_batchedUpdates=Th,_n.unstable_renderSubtreeIntoContainer=function(s,a,l,u){if(!au(l))throw Error(r(200));if(s==null||s._reactInternals===void 0)throw Error(r(38));return iu(s,a,l,!1,u)},_n.version="18.3.1-next-f1338f8080-20240426",_n}var Ng;function ey(){if(Ng)return Hh.exports;Ng=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Hh.exports=yb(),Hh.exports}var kg;function jb(){if(kg)return cu;kg=1;var e=ey();return cu.createRoot=e.createRoot,cu.hydrateRoot=e.hydrateRoot,cu}var bb=jb();const wb="modulepreload",Nb=function(e){return"/"+e},Sg={},Bu=function(n,r,i){let o=Promise.resolve();if(r&&r.length>0){let d=function(g){return Promise.all(g.map(p=>Promise.resolve(p).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),f=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));o=d(r.map(g=>{if(g=Nb(g),g in Sg)return;Sg[g]=!0;const p=g.endsWith(".css"),v=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${v}`))return;const j=document.createElement("link");if(j.rel=p?"stylesheet":wb,p||(j.as="script"),j.crossOrigin="",j.href=g,f&&j.setAttribute("nonce",f),document.head.appendChild(j),p)return new Promise((S,y)=>{j.addEventListener("load",S),j.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${g}`)))})}))}function c(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return o.then(d=>{for(const h of d||[])h.status==="rejected"&&c(h.reason);return n().catch(c)})};var X3=ey();/**
42
+ * @remix-run/router v1.23.4
43
+ *
44
+ * Copyright (c) Remix Software Inc.
45
+ *
46
+ * This source code is licensed under the MIT license found in the
47
+ * LICENSE.md file in the root directory of this source tree.
48
+ *
49
+ * @license MIT
50
+ */function mo(){return mo=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},mo.apply(null,arguments)}var Ur;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Ur||(Ur={}));const Cg="popstate";function kb(e){e===void 0&&(e={});function n(i,o){let{pathname:c,search:d,hash:h}=i.location;return af("",{pathname:c,search:d,hash:h},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function r(i,o){return typeof o=="string"?o:bu(o)}return Cb(n,r,null,e)}function jt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function ty(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function Sb(){return Math.random().toString(36).substr(2,8)}function _g(e,n){return{usr:e.state,key:e.key,idx:n}}function af(e,n,r,i){return r===void 0&&(r=null),mo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof n=="string"?nl(n):n,{state:r,key:n&&n.key||i||Sb()})}function bu(e){let{pathname:n="/",search:r="",hash:i=""}=e;return r&&r!=="?"&&(n+=r.charAt(0)==="?"?r:"?"+r),i&&i!=="#"&&(n+=i.charAt(0)==="#"?i:"#"+i),n}function nl(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substr(r),e=e.substr(0,r));let i=e.indexOf("?");i>=0&&(n.search=e.substr(i),e=e.substr(0,i)),e&&(n.pathname=e)}return n}function Cb(e,n,r,i){i===void 0&&(i={});let{window:o=document.defaultView,v5Compat:c=!1}=i,d=o.history,h=Ur.Pop,f=null,g=p();g==null&&(g=0,d.replaceState(mo({},d.state,{idx:g}),""));function p(){return(d.state||{idx:null}).idx}function v(){h=Ur.Pop;let k=p(),C=k==null?null:k-g;g=k,f&&f({action:h,location:b.location,delta:C})}function j(k,C){h=Ur.Push;let z=af(b.location,k,C);g=p()+1;let O=_g(z,g),T=b.createHref(z);try{d.pushState(O,"",T)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;o.location.assign(T)}c&&f&&f({action:h,location:b.location,delta:1})}function S(k,C){h=Ur.Replace;let z=af(b.location,k,C);g=p();let O=_g(z,g),T=b.createHref(z);d.replaceState(O,"",T),c&&f&&f({action:h,location:b.location,delta:0})}function y(k){let C=o.location.origin!=="null"?o.location.origin:o.location.href,z=typeof k=="string"?k:bu(k);return z=z.replace(/ $/,"%20"),jt(C,"No window.location.(origin|href) available to create URL for href: "+z),new URL(z,C)}let b={get action(){return h},get location(){return e(o,d)},listen(k){if(f)throw new Error("A history only accepts one active listener");return o.addEventListener(Cg,v),f=k,()=>{o.removeEventListener(Cg,v),f=null}},createHref(k){return n(o,k)},createURL:y,encodeLocation(k){let C=y(k);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:j,replace:S,go(k){return d.go(k)}};return b}var Pg;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Pg||(Pg={}));function _b(e,n,r){return r===void 0&&(r="/"),Pb(e,n,r)}function Pb(e,n,r,i){let o=typeof n=="string"?nl(n):n,c=Hi(o.pathname||"/",r);if(c==null)return null;let d=ny(e);Eb(d);let h=null,f=ry(c);for(let g=0;h==null&&g<d.length;++g)h=Ab(d[g],f);return h}function ny(e,n,r,i){n===void 0&&(n=[]),r===void 0&&(r=[]),i===void 0&&(i="");let o=(c,d,h)=>{let f={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};f.relativePath.startsWith("/")&&(jt(f.relativePath.startsWith(i),'Absolute route path "'+f.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),f.relativePath=f.relativePath.slice(i.length));let g=Qr([i,f.relativePath]),p=r.concat(f);c.children&&c.children.length>0&&(jt(c.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+g+'".')),ny(c.children,n,p,g)),!(c.path==null&&!c.index)&&n.push({path:g,score:zb(g,c.index),routesMeta:p})};return e.forEach((c,d)=>{var h;if(c.path===""||!((h=c.path)!=null&&h.includes("?")))o(c,d);else for(let f of sy(c.path))o(c,d,f)}),n}function sy(e){let n=e.split("/");if(n.length===0)return[];let[r,...i]=n,o=r.endsWith("?"),c=r.replace(/\?$/,"");if(i.length===0)return o?[c,""]:[c];let d=sy(i.join("/")),h=[];return h.push(...d.map(f=>f===""?c:[c,f].join("/"))),o&&h.push(...d),h.map(f=>e.startsWith("/")&&f===""?"/":f)}function Eb(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:Ob(n.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}const Rb=/^:[\w-]+$/,Mb=3,Tb=2,qb=1,$b=10,Ib=-2,Eg=e=>e==="*";function zb(e,n){let r=e.split("/"),i=r.length;return r.some(Eg)&&(i+=Ib),n&&(i+=Tb),r.filter(o=>!Eg(o)).reduce((o,c)=>o+(Rb.test(c)?Mb:c===""?qb:$b),i)}function Ob(e,n){return e.length===n.length&&e.slice(0,-1).every((i,o)=>i===n[o])?e[e.length-1]-n[n.length-1]:0}function Ab(e,n,r){let{routesMeta:i}=e,o={},c="/",d=[];for(let h=0;h<i.length;++h){let f=i[h],g=h===i.length-1,p=c==="/"?n:n.slice(c.length)||"/",v=wu({path:f.relativePath,caseSensitive:f.caseSensitive,end:g},p),j=f.route;if(!v)return null;Object.assign(o,v.params),d.push({params:o,pathname:Qr([c,v.pathname]),pathnameBase:Ub(Qr([c,v.pathnameBase])),route:j}),v.pathnameBase!=="/"&&(c=Qr([c,v.pathnameBase]))}return d}function wu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=Lb(e.path,e.caseSensitive,e.end),o=n.match(r);if(!o)return null;let c=o[0],d=c.replace(/(.)\/+$/,"$1"),h=o.slice(1);return{params:i.reduce((g,p,v)=>{let{paramName:j,isOptional:S}=p;if(j==="*"){let b=h[v]||"";d=c.slice(0,c.length-b.length).replace(/(.)\/+$/,"$1")}const y=h[v];return S&&!y?g[j]=void 0:g[j]=(y||"").replace(/%2F/g,"/"),g},{}),pathname:c,pathnameBase:d,pattern:e}}function Lb(e,n,r){n===void 0&&(n=!1),r===void 0&&(r=!0),ty(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let i=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,h,f)=>(i.push({paramName:h,isOptional:f!=null}),f?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(i.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,n?void 0:"i"),i]}function ry(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return ty(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+n+").")),e}}function Hi(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}function Fb(e,n){n===void 0&&(n="/");let{pathname:r,search:i="",hash:o=""}=typeof e=="string"?nl(e):e,c;return r?(r=ay(r),r.startsWith("/")?c=Rg(r.substring(1),"/"):c=Rg(r,n)):c=n,{pathname:c,search:Qb(i),hash:Bb(o)}}function Rg(e,n){let r=n.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function Zh(e,n,r,i){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+n+"` field ["+JSON.stringify(i)+"]. 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 Db(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Jf(e,n){let r=Db(e);return n?r.map((i,o)=>o===r.length-1?i.pathname:i.pathnameBase):r.map(i=>i.pathnameBase)}function Xf(e,n,r,i){i===void 0&&(i=!1);let o;typeof e=="string"?o=nl(e):(o=mo({},e),jt(!o.pathname||!o.pathname.includes("?"),Zh("?","pathname","search",o)),jt(!o.pathname||!o.pathname.includes("#"),Zh("#","pathname","hash",o)),jt(!o.search||!o.search.includes("#"),Zh("#","search","hash",o)));let c=e===""||o.pathname==="",d=c?"/":o.pathname,h;if(d==null)h=r;else{let v=n.length-1;if(!i&&d.startsWith("..")){let j=d.split("/");for(;j[0]==="..";)j.shift(),v-=1;o.pathname=j.join("/")}h=v>=0?n[v]:"/"}let f=Fb(o,h),g=d&&d!=="/"&&d.endsWith("/"),p=(c||d===".")&&r.endsWith("/");return!f.pathname.endsWith("/")&&(g||p)&&(f.pathname+="/"),f}const ay=e=>e.replace(/\/\/+/g,"/"),Qr=e=>ay(e.join("/")),Ub=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Qb=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Bb=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Vb(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const iy=["post","put","patch","delete"];new Set(iy);const Hb=["get",...iy];new Set(Hb);/**
51
+ * React Router v6.30.6
52
+ *
53
+ * Copyright (c) Remix Software Inc.
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE.md file in the root directory of this source tree.
57
+ *
58
+ * @license MIT
59
+ */function po(){return po=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},po.apply(null,arguments)}const Vu=w.createContext(null),ly=w.createContext(null),ir=w.createContext(null),Hu=w.createContext(null),Is=w.createContext({outlet:null,matches:[],isDataRoute:!1}),oy=w.createContext(null);function Kb(e,n){let{relative:r}=n===void 0?{}:n;Qa()||jt(!1);let{basename:i,navigator:o}=w.useContext(ir),{hash:c,pathname:d,search:h}=Ku(e,{relative:r}),f=d;return i!=="/"&&(f=d==="/"?i:Qr([i,d])),o.createHref({pathname:f,search:h,hash:c})}function Qa(){return w.useContext(Hu)!=null}function Ln(){return Qa()||jt(!1),w.useContext(Hu).location}function Mg(e){Qa()||jt(!1);let{pathname:n}=Ln();return w.useMemo(()=>wu(e,ry(n)),[n,e])}function cy(e){w.useContext(ir).static||w.useLayoutEffect(e)}function un(){let{isDataRoute:e}=w.useContext(Is);return e?ow():Wb()}function Wb(){Qa()||jt(!1);let e=w.useContext(Vu),{basename:n,future:r,navigator:i}=w.useContext(ir),{matches:o}=w.useContext(Is),{pathname:c}=Ln(),d=JSON.stringify(Jf(o,r.v7_relativeSplatPath)),h=w.useRef(!1);return cy(()=>{h.current=!0}),w.useCallback(function(g,p){if(p===void 0&&(p={}),!h.current)return;if(typeof g=="number"){i.go(g);return}let v=Xf(g,JSON.parse(d),c,p.relative==="path");e==null&&n!=="/"&&(v.pathname=v.pathname==="/"?n:Qr([n,v.pathname])),(p.replace?i.replace:i.push)(v,p.state,p)},[n,i,d,c,e])}const Zb=w.createContext(null);function Gb(e){let n=w.useContext(Is).outlet;return n&&w.createElement(Zb.Provider,{value:e},n)}function Fn(){let{matches:e}=w.useContext(Is),n=e[e.length-1];return n?n.params:{}}function Ku(e,n){let{relative:r}=n===void 0?{}:n,{future:i}=w.useContext(ir),{matches:o}=w.useContext(Is),{pathname:c}=Ln(),d=JSON.stringify(Jf(o,i.v7_relativeSplatPath));return w.useMemo(()=>Xf(e,JSON.parse(d),c,r==="path"),[e,d,c,r])}function Jb(e,n){return Xb(e,n)}function Xb(e,n,r,i){Qa()||jt(!1);let{navigator:o}=w.useContext(ir),{matches:c}=w.useContext(Is),d=c[c.length-1],h=d?d.params:{};d&&d.pathname;let f=d?d.pathnameBase:"/";d&&d.route;let g=Ln(),p;if(n){var v;let k=typeof n=="string"?nl(n):n;f==="/"||(v=k.pathname)!=null&&v.startsWith(f)||jt(!1),p=k}else p=g;let j=p.pathname||"/",S=j;if(f!=="/"){let k=f.replace(/^\//,"").split("/");S="/"+j.replace(/^\//,"").split("/").slice(k.length).join("/")}let y=_b(e,{pathname:S}),b=sw(y&&y.map(k=>Object.assign({},k,{params:Object.assign({},h,k.params),pathname:Qr([f,o.encodeLocation?o.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?f:Qr([f,o.encodeLocation?o.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),c,r,i);return n&&b?w.createElement(Hu.Provider,{value:{location:po({pathname:"/",search:"",hash:"",state:null,key:"default"},p),navigationType:Ur.Pop}},b):b}function Yb(){let e=lw(),n=Vb(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},n),r?w.createElement("pre",{style:o},r):null,null)}const ew=w.createElement(Yb,null);class tw extends w.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,r){return r.location!==n.location||r.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:r.error,location:r.location,revalidation:n.revalidation||r.revalidation}}componentDidCatch(n,r){console.error("React Router caught the following error during render",n,r)}render(){return this.state.error!==void 0?w.createElement(Is.Provider,{value:this.props.routeContext},w.createElement(oy.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function nw(e){let{routeContext:n,match:r,children:i}=e,o=w.useContext(Vu);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),w.createElement(Is.Provider,{value:n},i)}function sw(e,n,r,i){var o;if(n===void 0&&(n=[]),r===void 0&&(r=null),i===void 0&&(i=null),e==null){var c;if(!r)return null;if(r.errors)e=r.matches;else if((c=i)!=null&&c.v7_partialHydration&&n.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let d=e,h=(o=r)==null?void 0:o.errors;if(h!=null){let p=d.findIndex(v=>v.route.id&&(h==null?void 0:h[v.route.id])!==void 0);p>=0||jt(!1),d=d.slice(0,Math.min(d.length,p+1))}let f=!1,g=-1;if(r&&i&&i.v7_partialHydration)for(let p=0;p<d.length;p++){let v=d[p];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(g=p),v.route.id){let{loaderData:j,errors:S}=r,y=v.route.loader&&j[v.route.id]===void 0&&(!S||S[v.route.id]===void 0);if(v.route.lazy||y){f=!0,g>=0?d=d.slice(0,g+1):d=[d[0]];break}}}return d.reduceRight((p,v,j)=>{let S,y=!1,b=null,k=null;r&&(S=h&&v.route.id?h[v.route.id]:void 0,b=v.route.errorElement||ew,f&&(g<0&&j===0?(cw("route-fallback"),y=!0,k=null):g===j&&(y=!0,k=v.route.hydrateFallbackElement||null)));let C=n.concat(d.slice(0,j+1)),z=()=>{let O;return S?O=b:y?O=k:v.route.Component?O=w.createElement(v.route.Component,null):v.route.element?O=v.route.element:O=p,w.createElement(nw,{match:v,routeContext:{outlet:p,matches:C,isDataRoute:r!=null},children:O})};return r&&(v.route.ErrorBoundary||v.route.errorElement||j===0)?w.createElement(tw,{location:r.location,revalidation:r.revalidation,component:b,error:S,children:z(),routeContext:{outlet:null,matches:C,isDataRoute:!0}}):z()},null)}var uy=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(uy||{}),dy=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(dy||{});function rw(e){let n=w.useContext(Vu);return n||jt(!1),n}function aw(e){let n=w.useContext(ly);return n||jt(!1),n}function iw(e){let n=w.useContext(Is);return n||jt(!1),n}function hy(e){let n=iw(),r=n.matches[n.matches.length-1];return r.route.id||jt(!1),r.route.id}function lw(){var e;let n=w.useContext(oy),r=aw(),i=hy();return n!==void 0?n:(e=r.errors)==null?void 0:e[i]}function ow(){let{router:e}=rw(uy.UseNavigateStable),n=hy(dy.UseNavigateStable),r=w.useRef(!1);return cy(()=>{r.current=!0}),w.useCallback(function(o,c){c===void 0&&(c={}),r.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,po({fromRouteId:n},c)))},[e,n])}const Tg={};function cw(e,n,r){Tg[e]||(Tg[e]=!0)}function uw(e,n){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Vr(e){let{to:n,replace:r,state:i,relative:o}=e;Qa()||jt(!1);let{future:c,static:d}=w.useContext(ir),{matches:h}=w.useContext(Is),{pathname:f}=Ln(),g=un(),p=Xf(n,Jf(h,c.v7_relativeSplatPath),f,o==="path"),v=JSON.stringify(p);return w.useEffect(()=>g(JSON.parse(v),{replace:r,state:i,relative:o}),[g,v,o,r,i]),null}function fy(e){return Gb(e.context)}function ct(e){jt(!1)}function dw(e){let{basename:n="/",children:r=null,location:i,navigationType:o=Ur.Pop,navigator:c,static:d=!1,future:h}=e;Qa()&&jt(!1);let f=n.replace(/^\/*/,"/"),g=w.useMemo(()=>({basename:f,navigator:c,static:d,future:po({v7_relativeSplatPath:!1},h)}),[f,h,c,d]);typeof i=="string"&&(i=nl(i));let{pathname:p="/",search:v="",hash:j="",state:S=null,key:y="default"}=i,b=w.useMemo(()=>{let k=Hi(p,f);return k==null?null:{location:{pathname:k,search:v,hash:j,state:S,key:y},navigationType:o}},[f,p,v,j,S,y,o]);return b==null?null:w.createElement(ir.Provider,{value:g},w.createElement(Hu.Provider,{children:r,value:b}))}function hw(e){let{children:n,location:r}=e;return Jb(lf(n),r)}new Promise(()=>{});function lf(e,n){n===void 0&&(n=[]);let r=[];return w.Children.forEach(e,(i,o)=>{if(!w.isValidElement(i))return;let c=[...n,o];if(i.type===w.Fragment){r.push.apply(r,lf(i.props.children,c));return}i.type!==ct&&jt(!1),!i.props.index||!i.props.children||jt(!1);let d={id:i.props.id||c.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(d.children=lf(i.props.children,c)),r.push(d)}),r}/**
60
+ * React Router DOM v6.30.6
61
+ *
62
+ * Copyright (c) Remix Software Inc.
63
+ *
64
+ * This source code is licensed under the MIT license found in the
65
+ * LICENSE.md file in the root directory of this source tree.
66
+ *
67
+ * @license MIT
68
+ */function Nu(){return Nu=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Nu.apply(null,arguments)}function my(e,n){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(n.indexOf(i)!==-1)continue;r[i]=e[i]}return r}function fw(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function mw(e,n){return e.button===0&&(!n||n==="_self")&&!fw(e)}function of(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,r)=>{let i=e[r];return n.concat(Array.isArray(i)?i.map(o=>[r,o]):[[r,i]])},[]))}function pw(e,n){let r=of(e);return n&&n.forEach((i,o)=>{r.has(o)||n.getAll(o).forEach(c=>{r.append(o,c)})}),r}const xw=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],gw=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],vw="6";try{window.__reactRouterVersion=vw}catch{}const yw=w.createContext({isTransitioning:!1}),jw="startTransition",qg=xb[jw];function bw(e){let{basename:n,children:r,future:i,window:o}=e,c=w.useRef();c.current==null&&(c.current=kb({window:o,v5Compat:!0}));let d=c.current,[h,f]=w.useState({action:d.action,location:d.location}),{v7_startTransition:g}=i||{},p=w.useCallback(v=>{g&&qg?qg(()=>f(v)):f(v)},[f,g]);return w.useLayoutEffect(()=>d.listen(p),[d,p]),w.useEffect(()=>uw(i),[i]),w.createElement(dw,{basename:n,children:r,location:h.location,navigationType:h.action,navigator:d,future:i})}const ww=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Nw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ee=w.forwardRef(function(n,r){let{onClick:i,relative:o,reloadDocument:c,replace:d,state:h,target:f,to:g,preventScrollReset:p,viewTransition:v}=n,j=my(n,xw),{basename:S}=w.useContext(ir),y,b=!1;if(typeof g=="string"&&Nw.test(g)&&(y=g,ww))try{let O=new URL(window.location.href),T=g.startsWith("//")?new URL(O.protocol+g):new URL(g),M=Hi(T.pathname,S);T.origin===O.origin&&M!=null?g=M+T.search+T.hash:b=!0}catch{}let k=Kb(g,{relative:o}),C=Sw(g,{replace:d,state:h,target:f,preventScrollReset:p,relative:o,viewTransition:v});function z(O){i&&i(O),O.defaultPrevented||C(O)}return w.createElement("a",Nu({},j,{href:y||k,onClick:b||c?i:z,ref:r,target:f}))}),Oo=w.forwardRef(function(n,r){let{"aria-current":i="page",caseSensitive:o=!1,className:c="",end:d=!1,style:h,to:f,viewTransition:g,children:p}=n,v=my(n,gw),j=Ku(f,{relative:v.relative}),S=Ln(),y=w.useContext(ly),{navigator:b,basename:k}=w.useContext(ir),C=y!=null&&Cw(j)&&g===!0,z=b.encodeLocation?b.encodeLocation(j).pathname:j.pathname,O=S.pathname,T=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;o||(O=O.toLowerCase(),T=T?T.toLowerCase():null,z=z.toLowerCase()),T&&k&&(T=Hi(T,k)||T);const M=z!=="/"&&z.endsWith("/")?z.length-1:z.length;let E=O===z||!d&&O.startsWith(z)&&O.charAt(M)==="/",I=T!=null&&(T===z||!d&&T.startsWith(z)&&T.charAt(z.length)==="/"),Q={isActive:E,isPending:I,isTransitioning:C},H=E?i:void 0,q;typeof c=="function"?q=c(Q):q=[c,E?"active":null,I?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let B=typeof h=="function"?h(Q):h;return w.createElement(Ee,Nu({},v,{"aria-current":H,className:q,ref:r,style:B,to:f,viewTransition:g}),typeof p=="function"?p(Q):p)});var cf;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(cf||(cf={}));var $g;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})($g||($g={}));function kw(e){let n=w.useContext(Vu);return n||jt(!1),n}function Sw(e,n){let{target:r,replace:i,state:o,preventScrollReset:c,relative:d,viewTransition:h}=n===void 0?{}:n,f=un(),g=Ln(),p=Ku(e,{relative:d});return w.useCallback(v=>{if(mw(v,r)){v.preventDefault();let j=i!==void 0?i:bu(g)===bu(p);f(e,{replace:j,state:o,preventScrollReset:c,relative:d,viewTransition:h})}},[g,f,p,i,o,r,e,c,d,h])}function sl(e){let n=w.useRef(of(e)),r=w.useRef(!1),i=Ln(),o=w.useMemo(()=>pw(i.search,r.current?null:n.current),[i.search]),c=un(),d=w.useCallback((h,f)=>{const g=of(typeof h=="function"?h(o):h);r.current=!0,c("?"+g,f)},[c,o]);return[o,d]}function Cw(e,n){n===void 0&&(n={});let r=w.useContext(yw);r==null&&jt(!1);let{basename:i}=kw(cf.useViewTransitionState),o=Ku(e,{relative:n.relative});if(!r.isTransitioning)return!1;let c=Hi(r.currentLocation.pathname,i)||r.currentLocation.pathname,d=Hi(r.nextLocation.pathname,i)||r.nextLocation.pathname;return wu(o.pathname,d)!=null||wu(o.pathname,c)!=null}const py=w.createContext(void 0),Ke=e=>{const n=w.useContext(py);if(!n)throw new Error("No QueryClient set, use QueryClientProvider to set one");return n},_w=({client:e,children:n})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),t.jsx(py.Provider,{value:e,children:n})),Pw={setTimeout:(e,n)=>setTimeout(e,n),clearTimeout:e=>clearTimeout(e),setInterval:(e,n)=>setInterval(e,n),clearInterval:e=>clearInterval(e)};var $r,Zf,Uv,Ew=(Uv=class{constructor(){ge(this,$r,Pw);ge(this,Zf,!1)}setTimeoutProvider(e){ne(this,$r,e)}setTimeout(e,n){return _(this,$r).setTimeout(e,n)}clearTimeout(e){_(this,$r).clearTimeout(e)}setInterval(e,n){return _(this,$r).setInterval(e,n)}clearInterval(e){_(this,$r).clearInterval(e)}},$r=new WeakMap,Zf=new WeakMap,Uv);const wa=new Ew;function Rw(e){setTimeout(e,0)}const Mw=typeof window>"u"||"Deno"in globalThis;function on(){}function Tw(e,n){return typeof e=="function"?e(n):e}function xy(e){return typeof e=="number"&&e>=0&&e!==1/0}function gy(e,n){return Math.max(e+(n||0)-Date.now(),0)}function Pt(e,n){return typeof e=="function"?e(n):e}function Ig(e,n){const{type:r="all",exact:i,fetchStatus:o,predicate:c,queryKey:d,stale:h}=e;if(d){if(i){if(n.queryHash!==Yf(d,n.options))return!1}else if(!Ki(n.queryKey,d))return!1}if(r!=="all"){const f=n.isActive();if(r==="active"&&!f||r==="inactive"&&f)return!1}return!(typeof h=="boolean"&&n.isStale()!==h||o&&o!==n.state.fetchStatus||c&&!c(n))}function zg(e,n){const{exact:r,status:i,predicate:o,mutationKey:c}=e;if(c){if(!n.options.mutationKey)return!1;if(r){if(za(n.options.mutationKey)!==za(c))return!1}else if(!Ki(n.options.mutationKey,c))return!1}return!(i&&n.state.status!==i||o&&!o(n))}function Yf(e,n){return((n==null?void 0:n.queryKeyHashFn)||za)(e)}function za(e){return JSON.stringify(e,(n,r)=>uf(r)?Object.keys(r).sort().reduce((i,o)=>(i[o]=r[o],i),{}):r)}function Ki(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(Array.isArray(e)&&Array.isArray(n)){for(let i=0;i<n.length;i++)if(!Ki(e[i],n[i]))return!1;return!0}const r=Object.keys(n);for(const i of r)if(!Ki(e[i],n[i]))return!1;return!0}return!1}const qw=Object.prototype.hasOwnProperty;function em(e,n,r=0){if(e===n)return e;if(r>500)return n;const i=Og(e)&&Og(n);if(!i&&!(uf(e)&&uf(n)))return n;const o=(i?e:Object.keys(e)).length,c=i?n:Object.keys(n),d=c.length,h=i?new Array(d):{};let f=0;for(let g=0;g<d;g++){const p=i?g:c[g],v=e[p],j=n[p];if(v===j){h[p]=v,(i?g<o:qw.call(e,p))&&f++;continue}if(v===null||j===null||typeof v!="object"||typeof j!="object"){h[p]=j;continue}const S=em(v,j,r+1);h[p]=S,S===v&&f++}return o===d&&f===o?e:h}function ho(e,n){if(!n||Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(e[r]!==n[r])return!1;return!0}function Og(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function uf(e){if(!Ag(e))return!1;const n=e.constructor;if(n===void 0)return!0;const r=n.prototype;return!(!Ag(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ag(e){return Object.prototype.toString.call(e)==="[object Object]"}function $w(e){return new Promise(n=>{wa.setTimeout(n,e)})}function df(e,n,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,n):r.structuralSharing!==!1?em(e,n):n}function jn(e){return e}function Iw(e,n,r=0){const i=[...e,n];return r&&i.length>r?i.slice(1):i}function zw(e,n,r=0){const i=[n,...e];return r&&i.length>r?i.slice(0,-1):i}const tm=Symbol();function vy(e,n){return!e.queryFn&&(n!=null&&n.initialPromise)?()=>n.initialPromise:!e.queryFn||e.queryFn===tm?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function nm(e,n){return typeof e=="function"?e(...n):!!e}function Ow(e,n,r){let i=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=n()),i||(i=!0,o.aborted?r():o.addEventListener("abort",r,{once:!0})),o)}),e}let Aw=()=>Mw;const sm=()=>Aw();var Ba=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Na,Ir,Mi,Qv,Lw=(Qv=class extends Ba{constructor(){super();ge(this,Na);ge(this,Ir);ge(this,Mi);ne(this,Mi,n=>{if(typeof window<"u"&&window.addEventListener){const r=()=>n();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){_(this,Ir)||this.setEventListener(_(this,Mi))}onUnsubscribe(){var n;this.hasListeners()||((n=_(this,Ir))==null||n.call(this),ne(this,Ir,void 0))}setEventListener(n){var r;ne(this,Mi,n),(r=_(this,Ir))==null||r.call(this),ne(this,Ir,n(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(n){_(this,Na)!==n&&(ne(this,Na,n),this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(r=>{r(n)})}isFocused(){var n;return typeof _(this,Na)=="boolean"?_(this,Na):((n=globalThis.document)==null?void 0:n.visibilityState)!=="hidden"}},Na=new WeakMap,Ir=new WeakMap,Mi=new WeakMap,Qv);const rm=new Lw,Fw=Rw;function Dw(){let e=[],n=0,r=h=>{h()},i=h=>{h()},o=Fw;const c=h=>{n?e.push(h):o(()=>{r(h)})},d=()=>{const h=e;e=[],h.length&&o(()=>{i(()=>{h.forEach(f=>{r(f)})})})};return{batch:h=>{let f;n++;try{f=h()}finally{n--,n||d()}return f},batchCalls:h=>(...f)=>{c(()=>{h(...f)})},schedule:c,setNotifyFunction:h=>{r=h},setBatchNotifyFunction:h=>{i=h},setScheduler:h=>{o=h}}}const Et=Dw();var Ti,zr,qi,Bv,Uw=(Bv=class extends Ba{constructor(){super();ge(this,Ti,!0);ge(this,zr);ge(this,qi);ne(this,qi,n=>{if(typeof window<"u"&&window.addEventListener){const r=()=>n(!0),i=()=>n(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",i)}}})}onSubscribe(){_(this,zr)||this.setEventListener(_(this,qi))}onUnsubscribe(){var n;this.hasListeners()||((n=_(this,zr))==null||n.call(this),ne(this,zr,void 0))}setEventListener(n){var r;ne(this,qi,n),(r=_(this,zr))==null||r.call(this),ne(this,zr,n(this.setOnline.bind(this)))}setOnline(n){_(this,Ti)!==n&&(ne(this,Ti,n),this.listeners.forEach(r=>{r(n)}))}isOnline(){return _(this,Ti)}},Ti=new WeakMap,zr=new WeakMap,qi=new WeakMap,Bv);const ku=new Uw;function Qw(e){return Math.min(1e3*2**e,3e4)}function yy(e){return(e??"online")==="online"?ku.isOnline():!0}var hf=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function jy(e){let n=!1,r=0,i,o="pending",c,d;const h=new Promise((z,O)=>{c=z,d=O});h.catch(on);const f=()=>o!=="pending",g=z=>{var O;if(!f()){const T=new hf(z);b(T),(O=e.onCancel)==null||O.call(e,T)}},p=()=>{n=!0},v=()=>{n=!1},j=()=>rm.isFocused()&&(e.networkMode==="always"||ku.isOnline())&&e.canRun(),S=()=>yy(e.networkMode)&&e.canRun(),y=z=>{f()||(i==null||i(),o="resolved",c(z))},b=z=>{f()||(i==null||i(),o="rejected",d(z))},k=()=>new Promise(z=>{var O;i=T=>{(f()||j())&&z(T)},(O=e.onPause)==null||O.call(e)}).then(()=>{var z;i=void 0,f()||(z=e.onContinue)==null||z.call(e)}),C=()=>{if(f())return;let z;const O=r===0?e.initialPromise:void 0;try{z=O??e.fn()}catch(T){z=Promise.reject(T)}Promise.resolve(z).then(y).catch(T=>{var H;if(f())return;const M=e.retry??(sm()?0:3),E=e.retryDelay??Qw,I=typeof E=="function"?E(r,T):E,Q=M===!0||typeof M=="number"&&r<M||typeof M=="function"&&M(r,T);if(n||!Q){b(T);return}r++,(H=e.onFail)==null||H.call(e,r,T),$w(I).then(()=>j()?void 0:k()).then(()=>{n?b(T):C()})})};return{promise:h,status:()=>o,cancel:g,continue:()=>(i==null||i(),h),cancelRetry:p,continueRetry:v,canStart:S,start:()=>(S()?C():k().then(C),h)}}var ka,Vv,by=(Vv=class{constructor(){ge(this,ka)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),xy(this.gcTime)&&ne(this,ka,wa.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(sm()?1/0:3e5))}clearGcTimeout(){_(this,ka)!==void 0&&(wa.clearTimeout(_(this,ka)),ne(this,ka,void 0))}},ka=new WeakMap,Vv);function Bw(e){return{onFetch:(n,r)=>{var p,v,j,S,y;const i=n.options,o=(j=(v=(p=n.fetchOptions)==null?void 0:p.meta)==null?void 0:v.fetchMore)==null?void 0:j.direction,c=((S=n.state.data)==null?void 0:S.pages)||[],d=((y=n.state.data)==null?void 0:y.pageParams)||[];let h={pages:[],pageParams:[]},f=0;const g=async()=>{let b=!1;const k=O=>{Ow(O,()=>n.signal,()=>b=!0)},C=vy(n.options,n.fetchOptions),z=async(O,T,M)=>{if(b)return Promise.reject(n.signal.reason);if(T==null&&O.pages.length)return Promise.resolve(O);const I=(()=>{const B={client:n.client,queryKey:n.queryKey,pageParam:T,direction:M?"backward":"forward",meta:n.options.meta};return k(B),B})(),Q=await C(I),{maxPages:H}=n.options,q=M?zw:Iw;return{pages:q(O.pages,Q,H),pageParams:q(O.pageParams,T,H)}};if(o&&c.length){const O=o==="backward",T=O?wy:ff,M={pages:c,pageParams:d};h=await z(M,T(i,M),O)}else{const O=e??c.length;do{const T=f===0?d[0]??i.initialPageParam:ff(i,h);if(f>0&&T==null)break;h=await z(h,T),f++}while(f<O)}return h};n.options.persister?n.fetchFn=()=>{var b,k;return(k=(b=n.options).persister)==null?void 0:k.call(b,g,{client:n.client,queryKey:n.queryKey,meta:n.options.meta,signal:n.signal},r)}:n.fetchFn=g}}}function ff(e,{pages:n,pageParams:r}){const i=n.length-1;return n.length>0?e.getNextPageParam(n[i],n,r[i],r):void 0}function wy(e,{pages:n,pageParams:r}){var i;return n.length>0?(i=e.getPreviousPageParam)==null?void 0:i.call(e,n[0],n,r[0],r):void 0}function Vw(e,n){return n?ff(e,n)!=null:!1}function Hw(e,n){return!n||!e.getPreviousPageParam?!1:wy(e,n)!=null}var $i,Sa,Ii,Jn,Ca,Ft,Po,_a,hs,Zs,Hv,Kw=(Hv=class extends by{constructor(n){super();ge(this,hs);ge(this,$i);ge(this,Sa);ge(this,Ii);ge(this,Jn);ge(this,Ca);ge(this,Ft);ge(this,Po);ge(this,_a);ne(this,_a,!1),ne(this,Po,n.defaultOptions),this.setOptions(n.options),this.observers=[],ne(this,Ca,n.client),ne(this,Jn,_(this,Ca).getQueryCache()),this.queryKey=n.queryKey,this.queryHash=n.queryHash,ne(this,Sa,Fg(this.options)),this.state=n.state??_(this,Sa),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return _(this,$i)}get promise(){var n;return(n=_(this,Ft))==null?void 0:n.promise}setOptions(n){if(this.options={..._(this,Po),...n},n!=null&&n._type&&ne(this,$i,n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Fg(this.options);r.data!==void 0&&(this.setState(Lg(r.data,r.dataUpdatedAt)),ne(this,Sa,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,Jn).remove(this)}setData(n,r){const i=df(this.state.data,n,this.options);return Me(this,hs,Zs).call(this,{data:i,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),i}setState(n){Me(this,hs,Zs).call(this,{type:"setState",state:n})}cancel(n){var i,o;const r=(i=_(this,Ft))==null?void 0:i.promise;return(o=_(this,Ft))==null||o.cancel(n),r?r.then(on).catch(on):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return _(this,Sa)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(n=>Pt(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===tm||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(n=>Pt(n.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(n=0){return this.state.data===void 0?!0:n==="static"?!1:this.state.isInvalidated?!0:!gy(this.state.dataUpdatedAt,n)}onFocus(){var n,r;(n=this.observers.find(i=>i.shouldFetchOnWindowFocus()))==null||n.refetch({cancelRefetch:!1}),(r=_(this,Ft))==null||r.continue()}onOnline(){var n,r;(n=this.observers.find(i=>i.shouldFetchOnReconnect()))==null||n.refetch({cancelRefetch:!1}),(r=_(this,Ft))==null||r.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),_(this,Jn).notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){const r=this.observers.indexOf(n);r!==-1&&(this.observers.splice(r,1),this.observers.length||(_(this,Ft)&&(_(this,_a)||this.state.fetchStatus==="paused"&&this.state.status==="pending"?_(this,Ft).cancel({revert:!0}):_(this,Ft).cancelRetry()),this.scheduleGc()),_(this,Jn).notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Me(this,hs,Zs).call(this,{type:"invalidate"})}async fetch(n,r){var g,p,v,j,S,y,b,k,C,z,O,T;if(this.state.fetchStatus!=="idle"&&((g=_(this,Ft))==null?void 0:g.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(_(this,Ft))return _(this,Ft).continueRetry(),_(this,Ft).promise}if(n&&this.setOptions(n),!this.options.queryFn){const M=this.observers.find(E=>E.options.queryFn);M&&this.setOptions(M.options)}const i=new AbortController,o=M=>{Object.defineProperty(M,"signal",{enumerable:!0,get:()=>(ne(this,_a,!0),i.signal)})},c=()=>{const M=vy(this.options,r),I=(()=>{const Q={client:_(this,Ca),queryKey:this.queryKey,meta:this.meta};return o(Q),Q})();return ne(this,_a,!1),this.options.persister?this.options.persister(M,I,this):M(I)},h=(()=>{const M={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:_(this,Ca),state:this.state,fetchFn:c};return o(M),M})();(p=_(this,$i)==="infinite"?Bw(this.options.pages):this.options.behavior)==null||p.onFetch(h,this),ne(this,Ii,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((v=h.fetchOptions)==null?void 0:v.meta))&&Me(this,hs,Zs).call(this,{type:"fetch",meta:(j=h.fetchOptions)==null?void 0:j.meta});const f=ne(this,Ft,jy({initialPromise:r==null?void 0:r.initialPromise,fn:h.fetchFn,onCancel:M=>{M instanceof hf&&M.revert&&this.setState({..._(this,Ii),fetchStatus:"idle"}),i.abort()},onFail:(M,E)=>{Me(this,hs,Zs).call(this,{type:"failed",failureCount:M,error:E})},onPause:()=>{Me(this,hs,Zs).call(this,{type:"pause"})},onContinue:()=>{Me(this,hs,Zs).call(this,{type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0}));try{const M=await f.start();if(M===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(M),(y=(S=_(this,Jn).config).onSuccess)==null||y.call(S,M,this),(k=(b=_(this,Jn).config).onSettled)==null||k.call(b,M,this.state.error,this),M}catch(M){if(M instanceof hf){if(M.silent)return _(this,Ft).promise;if(M.revert){if(this.state.data===void 0)throw M;return this.state.data}}throw Me(this,hs,Zs).call(this,{type:"error",error:M}),(z=(C=_(this,Jn).config).onError)==null||z.call(C,M,this),(T=(O=_(this,Jn).config).onSettled)==null||T.call(O,this.state.data,M,this),M}finally{_(this,Ft)===f&&ne(this,Ft,void 0),this.scheduleGc()}}},$i=new WeakMap,Sa=new WeakMap,Ii=new WeakMap,Jn=new WeakMap,Ca=new WeakMap,Ft=new WeakMap,Po=new WeakMap,_a=new WeakMap,hs=new WeakSet,Zs=function(n){const r=i=>{switch(n.type){case"failed":return{...i,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...Ny(i.data,this.options),fetchMeta:n.meta??null};case"success":const o={...i,...Lg(n.data,n.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ne(this,Ii,n.manual?o:void 0),o;case"error":const c=n.error;return{...i,error:c,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:c,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...n.state}}};this.state=r(this.state),Et.batch(()=>{this.observers.slice().forEach(i=>{i.onQueryUpdate()}),_(this,Jn).notify({query:this,type:"updated",action:n})})},Hv);function Ny(e,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:yy(n.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Lg(e,n){return{data:e,dataUpdatedAt:n??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Fg(e){const n=typeof e.initialData=="function"?e.initialData():e.initialData,r=n!==void 0,i=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:n,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var mn,Ge,Eo,pn,Pa,zi,Js,Ro,Oi,Ai,Ea,Ra,Or,Li,st,oo,mf,pf,xf,gf,vf,yf,jf,bf,Kv,Wu=(Kv=class extends Ba{constructor(n,r){super();ge(this,st);ge(this,mn);ge(this,Ge);ge(this,Eo);ge(this,pn);ge(this,Pa);ge(this,zi);ge(this,Js);ge(this,Ro);ge(this,Oi);ge(this,Ai);ge(this,Ea);ge(this,Ra);ge(this,Or);ge(this,Li,new Set);this.options=r,ne(this,mn,n),ne(this,Js,null),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,Ge).addObserver(this),Dg(_(this,Ge),this.options)?Me(this,st,oo).call(this):this.updateResult(),Me(this,st,vf).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return wf(_(this,Ge),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return wf(_(this,Ge),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Me(this,st,yf).call(this),Me(this,st,jf).call(this),_(this,Ge).removeObserver(this)}setOptions(n){const r=this.options,i=_(this,Ge);if(this.options=_(this,mn).defaultQueryOptions(n),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Pt(this.options.enabled,_(this,Ge))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Me(this,st,bf).call(this),_(this,Ge).setOptions(this.options),r._defaulted&&!ho(this.options,r)&&_(this,mn).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,Ge),observer:this});const o=this.hasListeners();o&&Ug(_(this,Ge),i,this.options,r)&&Me(this,st,oo).call(this),this.updateResult(),o&&(_(this,Ge)!==i||Pt(this.options.enabled,_(this,Ge))!==Pt(r.enabled,_(this,Ge))||Pt(this.options.staleTime,_(this,Ge))!==Pt(r.staleTime,_(this,Ge)))&&Me(this,st,pf).call(this);const c=Me(this,st,xf).call(this);o&&(_(this,Ge)!==i||Pt(this.options.enabled,_(this,Ge))!==Pt(r.enabled,_(this,Ge))||c!==_(this,Or))&&Me(this,st,gf).call(this,c)}getOptimisticResult(n){const r=_(this,mn).getQueryCache().build(_(this,mn),n),i=this.createResult(r,n);return ho(this.getCurrentResult(),i)||(ne(this,pn,i),ne(this,zi,this.options),ne(this,Pa,_(this,Ge).state)),i}getCurrentResult(){return _(this,pn)}trackResult(n,r){return new Proxy(n,{get:(i,o)=>(this.trackProp(o),r==null||r(o),Reflect.get(i,o))})}trackProp(n){_(this,Li).add(n)}getCurrentQuery(){return _(this,Ge)}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const r=_(this,mn).defaultQueryOptions(n),i=_(this,mn).getQueryCache().build(_(this,mn),r);let o=()=>{},c;const d=new Promise(h=>{c=h,o=_(this,mn).getQueryCache().subscribe(f=>{f.type==="updated"&&f.query.queryHash===i.queryHash&&i.state.data!==void 0&&(o(),h(this.createResult(i,r)))})});return Promise.race([i.fetch().then(()=>{const h=this.createResult(i,r);return c==null||c(h),h}).finally(()=>{o()}),d])}fetch(n){return Me(this,st,oo).call(this,{...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,pn)))}createResult(n,r){var E;const i=_(this,Ge),o=this.options,c=_(this,pn),d=_(this,Pa),h=_(this,zi),f=n!==i?n.state:_(this,Eo),{state:g}=n;let p={...g},v=!1,j;if(r._optimisticResults){const I=this.hasListeners(),Q=!I&&Dg(n,r),H=I&&Ug(n,i,r,o);(Q||H)&&(p={...p,...Ny(g.data,n.options)}),r._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:S,errorUpdatedAt:y,status:b}=p;j=p.data;let k=!1;if(r.placeholderData!==void 0&&j===void 0&&b==="pending"){let I;c!=null&&c.isPlaceholderData&&r.placeholderData===(h==null?void 0:h.placeholderData)?(I=c.data,k=!0):I=typeof r.placeholderData=="function"?r.placeholderData((E=_(this,Ai))==null?void 0:E.state.data,_(this,Ai)):r.placeholderData,I!==void 0&&(b="success",j=df(c==null?void 0:c.data,I,r),v=!0)}if(r.select&&j!==void 0&&!k)if(c&&j===(d==null?void 0:d.data)&&r.select===_(this,Ro))j=_(this,Oi);else try{ne(this,Ro,r.select),j=r.select(j),j=df(c==null?void 0:c.data,j,r),ne(this,Oi,j),ne(this,Js,null)}catch(I){ne(this,Js,I)}else j===void 0&&ne(this,Js,null);_(this,Js)&&(S=_(this,Js),j=_(this,Oi),y=Date.now(),b="error",v=!1);const C=p.fetchStatus==="fetching",z=b==="pending",O=b==="error",T=z&&C,M=j!==void 0;return{status:b,fetchStatus:p.fetchStatus,isPending:z,isSuccess:b==="success",isError:O,isInitialLoading:T,isLoading:T,data:j,dataUpdatedAt:p.dataUpdatedAt,error:S,errorUpdatedAt:y,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:p.dataUpdateCount>f.dataUpdateCount||p.errorUpdateCount>f.errorUpdateCount,isFetching:C,isRefetching:C&&!z,isLoadingError:O&&!M,isPaused:p.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:O&&M,isStale:am(n,r),refetch:this.refetch,isEnabled:Pt(r.enabled,n)!==!1}}updateResult(){const n=_(this,pn),r=this.createResult(_(this,Ge),this.options);if(ne(this,Pa,_(this,Ge).state),ne(this,zi,this.options),_(this,Pa).data!==void 0&&ne(this,Ai,_(this,Ge)),ho(r,n))return;ne(this,pn,r);const o=(()=>{if(!n)return!0;const{notifyOnChangeProps:c}=this.options,d=typeof c=="function"?c():c;if(d==="all"||!d&&!_(this,Li).size)return!0;const h=new Set(d??_(this,Li));return this.options.throwOnError&&h.add("error"),Object.keys(_(this,pn)).some(f=>{const g=f;return _(this,pn)[g]!==n[g]&&h.has(g)})})();Et.batch(()=>{o&&this.listeners.forEach(c=>{c(_(this,pn))}),_(this,mn).getQueryCache().notify({query:_(this,Ge),type:"observerResultsUpdated"})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Me(this,st,vf).call(this)}},mn=new WeakMap,Ge=new WeakMap,Eo=new WeakMap,pn=new WeakMap,Pa=new WeakMap,zi=new WeakMap,Js=new WeakMap,Ro=new WeakMap,Oi=new WeakMap,Ai=new WeakMap,Ea=new WeakMap,Ra=new WeakMap,Or=new WeakMap,Li=new WeakMap,st=new WeakSet,oo=function(n){Me(this,st,bf).call(this);let r=_(this,Ge).fetch(this.options,n);return n!=null&&n.throwOnError||(r=r.catch(on)),r},mf=function(n){return!sm()&&Pt(this.options.enabled,_(this,Ge))!==!1&&xy(n)},pf=function(){Me(this,st,yf).call(this);const n=Pt(this.options.staleTime,_(this,Ge));if(_(this,pn).isStale||!Me(this,st,mf).call(this,n))return;const r=gy(_(this,pn).dataUpdatedAt,n)+1;ne(this,Ea,wa.setTimeout(()=>{_(this,pn).isStale||this.updateResult()},r))},xf=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,Ge)):this.options.refetchInterval)??!1},gf=function(n){Me(this,st,jf).call(this),ne(this,Or,n),!(_(this,Or)===0||!Me(this,st,mf).call(this,_(this,Or)))&&ne(this,Ra,wa.setInterval(()=>{(this.options.refetchIntervalInBackground||rm.isFocused())&&Me(this,st,oo).call(this)},_(this,Or)))},vf=function(){Me(this,st,pf).call(this),Me(this,st,gf).call(this,Me(this,st,xf).call(this))},yf=function(){_(this,Ea)!==void 0&&(wa.clearTimeout(_(this,Ea)),ne(this,Ea,void 0))},jf=function(){_(this,Ra)!==void 0&&(wa.clearInterval(_(this,Ra)),ne(this,Ra,void 0))},bf=function(){const n=_(this,mn).getQueryCache().build(_(this,mn),this.options);if(n===_(this,Ge))return;const r=_(this,Ge);ne(this,Ge,n),ne(this,Eo,n.state),this.hasListeners()&&(r==null||r.removeObserver(this),n.addObserver(this))},Kv);function Ww(e,n){return Pt(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Pt(n.retryOnMount,e)===!1)}function Dg(e,n){return Ww(e,n)||e.state.data!==void 0&&wf(e,n,n.refetchOnMount)}function wf(e,n,r){if(Pt(n.enabled,e)!==!1&&Pt(n.staleTime,e)!=="static"){const i=typeof r=="function"?r(e):r;return i==="always"||i!==!1&&am(e,n)}return!1}function Ug(e,n,r,i){return(e!==n||Pt(i.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&am(e,r)}function am(e,n){return Pt(n.enabled,e)!==!1&&e.isStaleByTime(Pt(n.staleTime,e))}var Zw=class extends Wu{constructor(e,n){super(e,n)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,n){var S,y;const{state:r}=e,i=super.createResult(e,n),{isFetching:o,isRefetching:c,isError:d,isRefetchError:h}=i,f=(y=(S=r.fetchMeta)==null?void 0:S.fetchMore)==null?void 0:y.direction,g=d&&f==="forward",p=o&&f==="forward",v=d&&f==="backward",j=o&&f==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Vw(n,r.data),hasPreviousPage:Hw(n,r.data),isFetchNextPageError:g,isFetchingNextPage:p,isFetchPreviousPageError:v,isFetchingPreviousPage:j,isRefetchError:h&&!g&&!v,isRefetching:c&&!p&&!j}}},Mo,Cs,rn,Ma,_s,Tr,Wv,Gw=(Wv=class extends by{constructor(n){super();ge(this,_s);ge(this,Mo);ge(this,Cs);ge(this,rn);ge(this,Ma);ne(this,Mo,n.client),this.mutationId=n.mutationId,ne(this,rn,n.mutationCache),ne(this,Cs,[]),this.state=n.state||ky(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){_(this,Cs).includes(n)||(_(this,Cs).push(n),this.clearGcTimeout(),_(this,rn).notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){ne(this,Cs,_(this,Cs).filter(r=>r!==n)),this.scheduleGc(),_(this,rn).notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){_(this,Cs).length||(this.state.status==="pending"?this.scheduleGc():_(this,rn).remove(this))}continue(){var n;return((n=_(this,Ma))==null?void 0:n.continue())??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(n){var h,f,g,p,v,j,S,y,b,k,C,z,O,T,M,E,I,Q;const r=()=>{Me(this,_s,Tr).call(this,{type:"continue"})},i={client:_(this,Mo),meta:this.options.meta,mutationKey:this.options.mutationKey},o=ne(this,Ma,jy({fn:()=>this.options.mutationFn?this.options.mutationFn(n,i):Promise.reject(new Error("No mutationFn found")),onFail:(H,q)=>{Me(this,_s,Tr).call(this,{type:"failed",failureCount:H,error:q})},onPause:()=>{Me(this,_s,Tr).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,rn).canRun(this)})),c=this.state.status==="pending",d=!o.canStart();try{if(c)r();else{Me(this,_s,Tr).call(this,{type:"pending",variables:n,isPaused:d}),_(this,rn).config.onMutate&&await _(this,rn).config.onMutate(n,this,i);const q=await((f=(h=this.options).onMutate)==null?void 0:f.call(h,n,i));q!==this.state.context&&Me(this,_s,Tr).call(this,{type:"pending",context:q,variables:n,isPaused:d})}const H=await o.start();return await((p=(g=_(this,rn).config).onSuccess)==null?void 0:p.call(g,H,n,this.state.context,this,i)),await((j=(v=this.options).onSuccess)==null?void 0:j.call(v,H,n,this.state.context,i)),await((y=(S=_(this,rn).config).onSettled)==null?void 0:y.call(S,H,null,this.state.variables,this.state.context,this,i)),await((k=(b=this.options).onSettled)==null?void 0:k.call(b,H,null,n,this.state.context,i)),Me(this,_s,Tr).call(this,{type:"success",data:H}),H}catch(H){try{await((z=(C=_(this,rn).config).onError)==null?void 0:z.call(C,H,n,this.state.context,this,i))}catch(q){Promise.reject(q)}try{await((T=(O=this.options).onError)==null?void 0:T.call(O,H,n,this.state.context,i))}catch(q){Promise.reject(q)}try{await((E=(M=_(this,rn).config).onSettled)==null?void 0:E.call(M,void 0,H,this.state.variables,this.state.context,this,i))}catch(q){Promise.reject(q)}try{await((Q=(I=this.options).onSettled)==null?void 0:Q.call(I,void 0,H,n,this.state.context,i))}catch(q){Promise.reject(q)}throw Me(this,_s,Tr).call(this,{type:"error",error:H}),H}finally{_(this,Ma)===o&&ne(this,Ma,void 0),_(this,rn).runNext(this)}}},Mo=new WeakMap,Cs=new WeakMap,rn=new WeakMap,Ma=new WeakMap,_s=new WeakSet,Tr=function(n){const r=i=>{switch(n.type){case"failed":return{...i,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...i,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:n.error,failureCount:i.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Et.batch(()=>{_(this,Cs).forEach(i=>{i.onMutationUpdate(n)}),_(this,rn).notify({mutation:this,type:"updated",action:n})})},Wv);function ky(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Xs,fs,To,Zv,Jw=(Zv=class extends Ba{constructor(n={}){super();ge(this,Xs);ge(this,fs);ge(this,To);this.config=n,ne(this,Xs,new Set),ne(this,fs,new Map),ne(this,To,0)}build(n,r,i){const o=new Gw({client:n,mutationCache:this,mutationId:++ou(this,To)._,options:n.defaultMutationOptions(r),state:i});return this.add(o),o}add(n){_(this,Xs).add(n);const r=uu(n);if(typeof r=="string"){const i=_(this,fs).get(r);i?i.push(n):_(this,fs).set(r,[n])}this.notify({type:"added",mutation:n})}remove(n){if(_(this,Xs).delete(n)){const r=uu(n);if(typeof r=="string"){const i=_(this,fs).get(r);if(i)if(i.length>1){const o=i.indexOf(n);o!==-1&&i.splice(o,1)}else i[0]===n&&_(this,fs).delete(r)}}this.notify({type:"removed",mutation:n})}canRun(n){var i;const r=uu(n);if(typeof r=="string"){const o=(i=_(this,fs).get(r))==null?void 0:i.find(c=>c.state.status==="pending");return!o||o===n}else return!0}runNext(n){var i,o;const r=uu(n);return typeof r=="string"?((o=(i=_(this,fs).get(r))==null?void 0:i.find(c=>c!==n&&c.state.isPaused))==null?void 0:o.continue())??Promise.resolve():Promise.resolve()}clear(){Et.batch(()=>{_(this,Xs).forEach(n=>{this.notify({type:"removed",mutation:n})}),_(this,Xs).clear(),_(this,fs).clear()})}getAll(){return Array.from(_(this,Xs))}find(n){const r={exact:!0,...n};return this.getAll().find(i=>zg(r,i))}findAll(n={}){return this.getAll().filter(r=>zg(n,r))}notify(n){Et.batch(()=>{this.listeners.forEach(r=>{r(n)})})}resumePausedMutations(){const n=this.getAll().filter(r=>r.state.isPaused);return Et.batch(()=>Promise.all(n.map(r=>r.continue().catch(on))))}},Xs=new WeakMap,fs=new WeakMap,To=new WeakMap,Zv);function uu(e){var n;return(n=e.options.scope)==null?void 0:n.id}var Ys,Ar,an,er,Rs,co,Nf,Gv,Xw=(Gv=class extends Ba{constructor(r,i){super();ge(this,Rs);ge(this,Ys);ge(this,Ar);ge(this,an);ge(this,er);ne(this,Ys,r),this.setOptions(i),this.bindMethods(),Me(this,Rs,co).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var o;const i=this.options;this.options=_(this,Ys).defaultMutationOptions(r),ho(this.options,i)||_(this,Ys).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,an),observer:this}),i!=null&&i.mutationKey&&this.options.mutationKey&&za(i.mutationKey)!==za(this.options.mutationKey)?this.reset():((o=_(this,an))==null?void 0:o.state.status)==="pending"&&_(this,an).setOptions(this.options)}onSubscribe(){this.listeners.size===1&&_(this,an)&&(_(this,an).addObserver(this),Me(this,Rs,co).call(this))}onUnsubscribe(){var r;this.hasListeners()||(r=_(this,an))==null||r.removeObserver(this)}onMutationUpdate(r){Me(this,Rs,co).call(this),Me(this,Rs,Nf).call(this,r)}getCurrentResult(){return _(this,Ar)}reset(){var r;(r=_(this,an))==null||r.removeObserver(this),ne(this,an,void 0),Me(this,Rs,co).call(this),Me(this,Rs,Nf).call(this)}mutate(r,i){var o;return ne(this,er,i),(o=_(this,an))==null||o.removeObserver(this),ne(this,an,_(this,Ys).getMutationCache().build(_(this,Ys),this.options)),_(this,an).addObserver(this),_(this,an).execute(r)}},Ys=new WeakMap,Ar=new WeakMap,an=new WeakMap,er=new WeakMap,Rs=new WeakSet,co=function(){var i;const r=((i=_(this,an))==null?void 0:i.state)??ky();ne(this,Ar,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Nf=function(r){Et.batch(()=>{var i,o,c,d,h,f,g,p;if(_(this,er)&&this.hasListeners()){const v=_(this,Ar).variables,j=_(this,Ar).context,S={client:_(this,Ys),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(o=(i=_(this,er)).onSuccess)==null||o.call(i,r.data,v,j,S)}catch(y){Promise.reject(y)}try{(d=(c=_(this,er)).onSettled)==null||d.call(c,r.data,null,v,j,S)}catch(y){Promise.reject(y)}}else if((r==null?void 0:r.type)==="error"){try{(f=(h=_(this,er)).onError)==null||f.call(h,r.error,v,j,S)}catch(y){Promise.reject(y)}try{(p=(g=_(this,er)).onSettled)==null||p.call(g,void 0,r.error,v,j,S)}catch(y){Promise.reject(y)}}}this.listeners.forEach(v=>{v(_(this,Ar))})})},Gv);function Qg(e,n){const r=new Set(n);return e.filter(i=>!r.has(i))}var Fi,xn,Di,Ta,zn,qa,qo,$o,Io,zo,Dt,kf,Sf,Sy,Cf,_f,Pf,Jv,Yw=(Jv=class extends Ba{constructor(n,r,i){super();ge(this,Dt);ge(this,Fi);ge(this,xn);ge(this,Di);ge(this,Ta);ge(this,zn);ge(this,qa);ge(this,qo);ge(this,$o);ge(this,Io);ge(this,zo,[]);ne(this,Fi,n),ne(this,Ta,i),ne(this,Di,[]),ne(this,zn,[]),ne(this,xn,[]),this.setQueries(r)}onSubscribe(){this.listeners.size===1&&_(this,zn).forEach(n=>{n.subscribe(r=>{Me(this,Dt,_f).call(this,n,r)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,_(this,zn).forEach(n=>{n.destroy()})}setQueries(n,r){ne(this,Di,n),ne(this,Ta,r),Et.batch(()=>{const i=_(this,zn),o=Me(this,Dt,Cf).call(this,_(this,Di));o.forEach(v=>v.observer.setOptions(v.defaultedQueryOptions));const c=o.map(v=>v.observer),d=c.map(v=>v.getCurrentResult()),h=i.length!==c.length,f=c.some((v,j)=>v!==i[j]),g=h||f,p=g?!0:d.some((v,j)=>{const S=_(this,xn)[j];return!S||!ho(v,S)});!g&&!p||(g&&(ne(this,zo,o),ne(this,zn,c)),ne(this,xn,d),this.hasListeners()&&(g&&(Qg(i,c).forEach(v=>{v.destroy()}),Qg(c,i).forEach(v=>{v.subscribe(j=>{Me(this,Dt,_f).call(this,v,j)})})),Me(this,Dt,Pf).call(this)))})}getCurrentResult(){return _(this,xn)}getQueries(){return _(this,zn).map(n=>n.getCurrentQuery())}getObservers(){return _(this,zn)}getOptimisticResult(n,r){const i=Me(this,Dt,Cf).call(this,n),o=i.map(d=>d.observer.getOptimisticResult(d.defaultedQueryOptions)),c=i.map(d=>d.defaultedQueryOptions.queryHash);return[o,d=>Me(this,Dt,Sf).call(this,d??o,r,c),()=>Me(this,Dt,kf).call(this,o,i)]}},Fi=new WeakMap,xn=new WeakMap,Di=new WeakMap,Ta=new WeakMap,zn=new WeakMap,qa=new WeakMap,qo=new WeakMap,$o=new WeakMap,Io=new WeakMap,zo=new WeakMap,Dt=new WeakSet,kf=function(n,r){const i=new Set;return r.map((o,c)=>{const d=n[c];return o.defaultedQueryOptions.notifyOnChangeProps?d:o.observer.trackResult(d,h=>{i.has(h)||(i.add(h),r.forEach(f=>{f.observer.trackProp(h)}))})})},Sf=function(n,r,i){if(r){const o=_(this,Io),c=i!==void 0&&o!==void 0&&(o.length!==i.length||i.some((d,h)=>d!==o[h]));return(_(this,xn)!==_(this,$o)||c||r!==_(this,qo))&&(ne(this,qo,r),ne(this,$o,_(this,xn)),i!==void 0&&ne(this,Io,i),ne(this,qa,em(_(this,qa),r(n)))),_(this,qa)}return n},Sy=function(){var n;return!((n=_(this,Ta))!=null&&n.combine)||_(this,zn).some((r,i)=>{var o;return r.options.suspense&&((o=_(this,xn)[i])==null?void 0:o.data)===void 0})},Cf=function(n){const r=new Map;_(this,zn).forEach(o=>{const c=o.options.queryHash;if(!c)return;const d=r.get(c);d?d.push(o):r.set(c,[o])});const i=[];return n.forEach(o=>{var h;const c=_(this,Fi).defaultQueryOptions(o),d=((h=r.get(c.queryHash))==null?void 0:h.shift())??new Wu(_(this,Fi),c);i.push({defaultedQueryOptions:c,observer:d})}),i},_f=function(n,r){const i=_(this,zn).indexOf(n);i!==-1&&(ne(this,xn,_(this,xn).slice()),_(this,xn)[i]=r,Me(this,Dt,Pf).call(this))},Pf=function(){var n;if(this.hasListeners()){const r=Me(this,Dt,Sy).call(this),i=_(this,qa),o=r?i:Me(this,Dt,Sf).call(this,Me(this,Dt,kf).call(this,_(this,xn),_(this,zo)),(n=_(this,Ta))==null?void 0:n.combine);(r||i!==o)&&Et.batch(()=>{this.listeners.forEach(c=>{c(_(this,xn))})})}},Jv),Ps,Xv,eN=(Xv=class extends Ba{constructor(n={}){super();ge(this,Ps);this.config=n,ne(this,Ps,new Map)}build(n,r,i){const o=r.queryKey,c=r.queryHash??Yf(o,r);let d=this.get(c);return d||(d=new Kw({client:n,queryKey:o,queryHash:c,options:n.defaultQueryOptions(r),state:i,defaultOptions:n.getQueryDefaults(o)}),this.add(d)),d}add(n){_(this,Ps).has(n.queryHash)||(_(this,Ps).set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){const r=_(this,Ps).get(n.queryHash);r&&(n.destroy(),r===n&&_(this,Ps).delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){Et.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}get(n){return _(this,Ps).get(n)}getAll(){return[..._(this,Ps).values()]}find(n){const r={exact:!0,...n};return this.getAll().find(i=>Ig(r,i))}findAll(n={}){const r=this.getAll();return Object.keys(n).length>0?r.filter(i=>Ig(n,i)):r}notify(n){Et.batch(()=>{this.listeners.forEach(r=>{r(n)})})}onFocus(){Et.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){Et.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},Ps=new WeakMap,Xv),Ct,Lr,Fr,Ui,Qi,Dr,Bi,Vi,Yv,tN=(Yv=class{constructor(e={}){ge(this,Ct);ge(this,Lr);ge(this,Fr);ge(this,Ui);ge(this,Qi);ge(this,Dr);ge(this,Bi);ge(this,Vi);ne(this,Ct,e.queryCache||new eN),ne(this,Lr,e.mutationCache||new Jw),ne(this,Fr,e.defaultOptions||{}),ne(this,Ui,new Map),ne(this,Qi,new Map),ne(this,Dr,0)}mount(){ou(this,Dr)._++,_(this,Dr)===1&&(ne(this,Bi,rm.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,Ct).onFocus())})),ne(this,Vi,ku.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,Ct).onOnline())})))}unmount(){var e,n;ou(this,Dr)._--,_(this,Dr)===0&&((e=_(this,Bi))==null||e.call(this),ne(this,Bi,void 0),(n=_(this,Vi))==null||n.call(this),ne(this,Vi,void 0))}isFetching(e){return _(this,Ct).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,Lr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const n=this.defaultQueryOptions({queryKey:e});return(r=_(this,Ct).get(n.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const n=this.defaultQueryOptions(e),r=_(this,Ct).build(this,n),i=r.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Pt(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(i))}getQueriesData(e){return _(this,Ct).findAll(e).map(({queryKey:n,state:r})=>[n,r.data])}setQueryData(e,n,r){var d;const i=this.defaultQueryOptions({queryKey:e}),o=(d=_(this,Ct).get(i.queryHash))==null?void 0:d.state.data,c=Tw(n,o);if(c!==void 0)return _(this,Ct).build(this,i).setData(c,{...r,manual:!0})}setQueriesData(e,n,r){return Et.batch(()=>_(this,Ct).findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,n,r)]))}getQueryState(e){var r;const n=this.defaultQueryOptions({queryKey:e});return(r=_(this,Ct).get(n.queryHash))==null?void 0:r.state}removeQueries(e){const n=_(this,Ct);Et.batch(()=>{n.findAll(e).forEach(r=>{n.remove(r)})})}resetQueries(e,n){const r=_(this,Ct);return Et.batch(()=>{const i=r.findAll(e),o=new Set(i);return i.forEach(c=>{c.reset()}),this.refetchQueries({type:"active",predicate:c=>o.has(c)},n)})}cancelQueries(e,n={}){const r={revert:!0,...n},i=Et.batch(()=>_(this,Ct).findAll(e).map(o=>o.cancel(r)));return Promise.all(i).then(on).catch(on)}invalidateQueries(e,n={}){return Et.batch(()=>(_(this,Ct).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},n)))}refetchQueries(e,n={}){const r={...n,cancelRefetch:n.cancelRefetch??!0},i=Et.batch(()=>_(this,Ct).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let c=o.fetch(void 0,r);return r.throwOnError||(c=c.catch(on)),o.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(i).then(on)}async query(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const r=_(this,Ct).build(this,n),i=r.isStaleByTime(Pt(n.staleTime,r))?await r.fetch(n):r.state.data,o=n.select;return o?o(i):i}fetchQuery(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const r=_(this,Ct).build(this,n);return r.isStaleByTime(Pt(n.staleTime,r))?r.fetch(n):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(on).catch(on)}infiniteQuery(e){return e._type="infinite",this.query(e)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(on).catch(on)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return ku.isOnline()?_(this,Lr).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,Ct)}getMutationCache(){return _(this,Lr)}getDefaultOptions(){return _(this,Fr)}setDefaultOptions(e){ne(this,Fr,e)}setQueryDefaults(e,n){_(this,Ui).set(za(e),{queryKey:e,defaultOptions:n})}getQueryDefaults(e){const n=[..._(this,Ui).values()],r={};return n.forEach(i=>{Ki(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,n){_(this,Qi).set(za(e),{mutationKey:e,defaultOptions:n})}getMutationDefaults(e){const n=[..._(this,Qi).values()],r={};return n.forEach(i=>{Ki(e,i.mutationKey)&&Object.assign(r,i.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const n={..._(this,Fr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return n.queryHash||(n.queryHash=Yf(n.queryKey,n)),n.refetchOnReconnect===void 0&&(n.refetchOnReconnect=n.networkMode!=="always"),n.throwOnError===void 0&&(n.throwOnError=!!n.suspense),!n.networkMode&&n.persister&&(n.networkMode="offlineFirst"),n.queryFn===tm&&(n.enabled=!1),n}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,Fr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,Ct).clear(),_(this,Lr).clear()}},Ct=new WeakMap,Lr=new WeakMap,Fr=new WeakMap,Ui=new WeakMap,Qi=new WeakMap,Dr=new WeakMap,Bi=new WeakMap,Vi=new WeakMap,Yv);const Cy=w.createContext(!1),_y=()=>w.useContext(Cy);Cy.Provider;function nN(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const sN=w.createContext(nN()),Py=()=>w.useContext(sN),Ey=(e,n,r)=>{const i=r!=null&&r.state.error&&typeof e.throwOnError=="function"?nm(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||i)&&(n.isReset()||(e.retryOnMount=!1))},Ry=e=>{w.useEffect(()=>{e.clearReset()},[e])},My=({result:e,errorResetBoundary:n,throwOnError:r,query:i,suspense:o})=>e.isError&&!n.isReset()&&!e.isFetching&&i&&(o&&e.data===void 0||nm(r,[e.error,i])),Ty=e=>{if(e.suspense){const r=o=>o==="static"?o:Math.max(o??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...o)=>r(i(...o)):r(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Ef=(e,n)=>(e==null?void 0:e.suspense)&&n.isPending,qy=(e,n,r)=>n.fetchOptimistic(e).catch(()=>{r.clearReset()});function $y({queries:e,...n},r){const i=Ke(),o=_y(),c=Py(),d=n.subscribed!==!1,h=w.useMemo(()=>e.map(b=>{const k=i.defaultQueryOptions(b);return k._optimisticResults=o?"isRestoring":d?"optimistic":void 0,k}),[e,i,o,d]);h.forEach(b=>{Ty(b);const k=i.getQueryCache().get(b.queryHash);Ey(b,c,k)}),Ry(c);const[f]=w.useState(()=>new Yw(i,h,n)),[g,p,v]=f.getOptimisticResult(h,n.combine),j=!o&&d;w.useSyncExternalStore(w.useCallback(b=>j?f.subscribe(Et.batchCalls(b)):on,[f,j]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),w.useEffect(()=>{f.setQueries(h,n)},[h,n,f]);const S=g.some((b,k)=>Ef(h[k],b))?g.flatMap((b,k)=>{const C=h[k];if(C&&Ef(C,b)){const z=new Wu(i,C);return qy(C,z,c)}return[]}):[];if(S.length>0)throw Promise.all(S);const y=g.find((b,k)=>{const C=h[k];return C&&My({result:b,errorResetBoundary:c,throwOnError:C.throwOnError,query:i.getQueryCache().get(C.queryHash),suspense:C.suspense})});if(y)throw y.error;return p(v())}function Iy(e,n,r){const i=_y(),o=Py(),c=Ke(),d=c.defaultQueryOptions(e),h=c.getQueryCache().get(d.queryHash),f=e.subscribed!==!1;d._optimisticResults=i?"isRestoring":f?"optimistic":void 0,Ty(d),Ey(d,o,h),Ry(o);const[g]=w.useState(()=>new n(c,d)),p=g.getOptimisticResult(d),v=!i&&f;if(w.useSyncExternalStore(w.useCallback(j=>{const S=v?g.subscribe(Et.batchCalls(j)):on;return g.updateResult(),S},[g,v]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),w.useEffect(()=>{g.setOptions(d)},[d,g]),Ef(d,p))throw qy(d,g,o);if(My({result:p,errorResetBoundary:o,throwOnError:d.throwOnError,query:h,suspense:d.suspense}))throw p.error;return d.notifyOnChangeProps?p:g.trackResult(p)}function Ye(e,n){return Iy(e,Wu)}function Ve(e,n){const r=Ke(),[i]=w.useState(()=>new Xw(r,e));w.useEffect(()=>{i.setOptions(e)},[i,e]);const o=w.useSyncExternalStore(w.useCallback(d=>i.subscribe(Et.batchCalls(d)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),c=w.useCallback((...d)=>{i.mutate(d[0],d[1]).catch(on)},[i]);if(o.error&&nm(i.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:c,mutateAsync:o.mutate}}function zy(e,n){return Iy(e,Zw)}/**
69
+ * @license lucide-react v0.469.0 - ISC
70
+ *
71
+ * This source code is licensed under the ISC license.
72
+ * See the LICENSE file in the root directory of this source tree.
73
+ */const rN=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Oy=(...e)=>e.filter((n,r,i)=>!!n&&n.trim()!==""&&i.indexOf(n)===r).join(" ").trim();/**
74
+ * @license lucide-react v0.469.0 - ISC
75
+ *
76
+ * This source code is licensed under the ISC license.
77
+ * See the LICENSE file in the root directory of this source tree.
78
+ */var aN={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
79
+ * @license lucide-react v0.469.0 - ISC
80
+ *
81
+ * This source code is licensed under the ISC license.
82
+ * See the LICENSE file in the root directory of this source tree.
83
+ */const iN=w.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:o="",children:c,iconNode:d,...h},f)=>w.createElement("svg",{ref:f,...aN,width:n,height:n,stroke:e,strokeWidth:i?Number(r)*24/Number(n):r,className:Oy("lucide",o),...h},[...d.map(([g,p])=>w.createElement(g,p)),...Array.isArray(c)?c:[c]]));/**
84
+ * @license lucide-react v0.469.0 - ISC
85
+ *
86
+ * This source code is licensed under the ISC license.
87
+ * See the LICENSE file in the root directory of this source tree.
88
+ */const ie=(e,n)=>{const r=w.forwardRef(({className:i,...o},c)=>w.createElement(iN,{ref:c,iconNode:n,className:Oy(`lucide-${rN(e)}`,i),...o}));return r.displayName=`${e}`,r};/**
89
+ * @license lucide-react v0.469.0 - ISC
90
+ *
91
+ * This source code is licensed under the ISC license.
92
+ * See the LICENSE file in the root directory of this source tree.
93
+ */const Ao=ie("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
94
+ * @license lucide-react v0.469.0 - ISC
95
+ *
96
+ * This source code is licensed under the ISC license.
97
+ * See the LICENSE file in the root directory of this source tree.
98
+ */const lN=ie("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);/**
99
+ * @license lucide-react v0.469.0 - ISC
100
+ *
101
+ * This source code is licensed under the ISC license.
102
+ * See the LICENSE file in the root directory of this source tree.
103
+ */const oN=ie("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
104
+ * @license lucide-react v0.469.0 - ISC
105
+ *
106
+ * This source code is licensed under the ISC license.
107
+ * See the LICENSE file in the root directory of this source tree.
108
+ */const cN=ie("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/**
109
+ * @license lucide-react v0.469.0 - ISC
110
+ *
111
+ * This source code is licensed under the ISC license.
112
+ * See the LICENSE file in the root directory of this source tree.
113
+ */const uN=ie("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
114
+ * @license lucide-react v0.469.0 - ISC
115
+ *
116
+ * This source code is licensed under the ISC license.
117
+ * See the LICENSE file in the root directory of this source tree.
118
+ */const im=ie("ArrowUpToLine",[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]]);/**
119
+ * @license lucide-react v0.469.0 - ISC
120
+ *
121
+ * This source code is licensed under the ISC license.
122
+ * See the LICENSE file in the root directory of this source tree.
123
+ */const dN=ie("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
124
+ * @license lucide-react v0.469.0 - ISC
125
+ *
126
+ * This source code is licensed under the ISC license.
127
+ * See the LICENSE file in the root directory of this source tree.
128
+ */const hN=ie("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
129
+ * @license lucide-react v0.469.0 - ISC
130
+ *
131
+ * This source code is licensed under the ISC license.
132
+ * See the LICENSE file in the root directory of this source tree.
133
+ */const fN=ie("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);/**
134
+ * @license lucide-react v0.469.0 - ISC
135
+ *
136
+ * This source code is licensed under the ISC license.
137
+ * See the LICENSE file in the root directory of this source tree.
138
+ */const lm=ie("BellRing",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]]);/**
139
+ * @license lucide-react v0.469.0 - ISC
140
+ *
141
+ * This source code is licensed under the ISC license.
142
+ * See the LICENSE file in the root directory of this source tree.
143
+ */const rl=ie("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/**
144
+ * @license lucide-react v0.469.0 - ISC
145
+ *
146
+ * This source code is licensed under the ISC license.
147
+ * See the LICENSE file in the root directory of this source tree.
148
+ */const Ay=ie("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
149
+ * @license lucide-react v0.469.0 - ISC
150
+ *
151
+ * This source code is licensed under the ISC license.
152
+ * See the LICENSE file in the root directory of this source tree.
153
+ */const mN=ie("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
154
+ * @license lucide-react v0.469.0 - ISC
155
+ *
156
+ * This source code is licensed under the ISC license.
157
+ * See the LICENSE file in the root directory of this source tree.
158
+ */const Ly=ie("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/**
159
+ * @license lucide-react v0.469.0 - ISC
160
+ *
161
+ * This source code is licensed under the ISC license.
162
+ * See the LICENSE file in the root directory of this source tree.
163
+ */const Lo=ie("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
164
+ * @license lucide-react v0.469.0 - ISC
165
+ *
166
+ * This source code is licensed under the ISC license.
167
+ * See the LICENSE file in the root directory of this source tree.
168
+ */const om=ie("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
169
+ * @license lucide-react v0.469.0 - ISC
170
+ *
171
+ * This source code is licensed under the ISC license.
172
+ * See the LICENSE file in the root directory of this source tree.
173
+ */const Zr=ie("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
174
+ * @license lucide-react v0.469.0 - ISC
175
+ *
176
+ * This source code is licensed under the ISC license.
177
+ * See the LICENSE file in the root directory of this source tree.
178
+ */const ps=ie("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
179
+ * @license lucide-react v0.469.0 - ISC
180
+ *
181
+ * This source code is licensed under the ISC license.
182
+ * See the LICENSE file in the root directory of this source tree.
183
+ */const Su=ie("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
184
+ * @license lucide-react v0.469.0 - ISC
185
+ *
186
+ * This source code is licensed under the ISC license.
187
+ * See the LICENSE file in the root directory of this source tree.
188
+ */const Dn=ie("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
189
+ * @license lucide-react v0.469.0 - ISC
190
+ *
191
+ * This source code is licensed under the ISC license.
192
+ * See the LICENSE file in the root directory of this source tree.
193
+ */const pN=ie("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/**
194
+ * @license lucide-react v0.469.0 - ISC
195
+ *
196
+ * This source code is licensed under the ISC license.
197
+ * See the LICENSE file in the root directory of this source tree.
198
+ */const xN=ie("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/**
199
+ * @license lucide-react v0.469.0 - ISC
200
+ *
201
+ * This source code is licensed under the ISC license.
202
+ * See the LICENSE file in the root directory of this source tree.
203
+ */const cm=ie("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
204
+ * @license lucide-react v0.469.0 - ISC
205
+ *
206
+ * This source code is licensed under the ISC license.
207
+ * See the LICENSE file in the root directory of this source tree.
208
+ */const Fy=ie("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
209
+ * @license lucide-react v0.469.0 - ISC
210
+ *
211
+ * This source code is licensed under the ISC license.
212
+ * See the LICENSE file in the root directory of this source tree.
213
+ */const Dy=ie("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
214
+ * @license lucide-react v0.469.0 - ISC
215
+ *
216
+ * This source code is licensed under the ISC license.
217
+ * See the LICENSE file in the root directory of this source tree.
218
+ */const gN=ie("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
219
+ * @license lucide-react v0.469.0 - ISC
220
+ *
221
+ * This source code is licensed under the ISC license.
222
+ * See the LICENSE file in the root directory of this source tree.
223
+ */const Uy=ie("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
224
+ * @license lucide-react v0.469.0 - ISC
225
+ *
226
+ * This source code is licensed under the ISC license.
227
+ * See the LICENSE file in the root directory of this source tree.
228
+ */const vN=ie("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
229
+ * @license lucide-react v0.469.0 - ISC
230
+ *
231
+ * This source code is licensed under the ISC license.
232
+ * See the LICENSE file in the root directory of this source tree.
233
+ */const yN=ie("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
234
+ * @license lucide-react v0.469.0 - ISC
235
+ *
236
+ * This source code is licensed under the ISC license.
237
+ * See the LICENSE file in the root directory of this source tree.
238
+ */const Va=ie("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
239
+ * @license lucide-react v0.469.0 - ISC
240
+ *
241
+ * This source code is licensed under the ISC license.
242
+ * See the LICENSE file in the root directory of this source tree.
243
+ */const jN=ie("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
244
+ * @license lucide-react v0.469.0 - ISC
245
+ *
246
+ * This source code is licensed under the ISC license.
247
+ * See the LICENSE file in the root directory of this source tree.
248
+ */const bN=ie("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
249
+ * @license lucide-react v0.469.0 - ISC
250
+ *
251
+ * This source code is licensed under the ISC license.
252
+ * See the LICENSE file in the root directory of this source tree.
253
+ */const Br=ie("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
254
+ * @license lucide-react v0.469.0 - ISC
255
+ *
256
+ * This source code is licensed under the ISC license.
257
+ * See the LICENSE file in the root directory of this source tree.
258
+ */const Fo=ie("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
259
+ * @license lucide-react v0.469.0 - ISC
260
+ *
261
+ * This source code is licensed under the ISC license.
262
+ * See the LICENSE file in the root directory of this source tree.
263
+ */const Qy=ie("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
264
+ * @license lucide-react v0.469.0 - ISC
265
+ *
266
+ * This source code is licensed under the ISC license.
267
+ * See the LICENSE file in the root directory of this source tree.
268
+ */const um=ie("FastForward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]);/**
269
+ * @license lucide-react v0.469.0 - ISC
270
+ *
271
+ * This source code is licensed under the ISC license.
272
+ * See the LICENSE file in the root directory of this source tree.
273
+ */const wN=ie("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
274
+ * @license lucide-react v0.469.0 - ISC
275
+ *
276
+ * This source code is licensed under the ISC license.
277
+ * See the LICENSE file in the root directory of this source tree.
278
+ */const NN=ie("FolderLock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]);/**
279
+ * @license lucide-react v0.469.0 - ISC
280
+ *
281
+ * This source code is licensed under the ISC license.
282
+ * See the LICENSE file in the root directory of this source tree.
283
+ */const By=ie("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
284
+ * @license lucide-react v0.469.0 - ISC
285
+ *
286
+ * This source code is licensed under the ISC license.
287
+ * See the LICENSE file in the root directory of this source tree.
288
+ */const Bg=ie("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
289
+ * @license lucide-react v0.469.0 - ISC
290
+ *
291
+ * This source code is licensed under the ISC license.
292
+ * See the LICENSE file in the root directory of this source tree.
293
+ */const sr=ie("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
294
+ * @license lucide-react v0.469.0 - ISC
295
+ *
296
+ * This source code is licensed under the ISC license.
297
+ * See the LICENSE file in the root directory of this source tree.
298
+ */const xo=ie("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
299
+ * @license lucide-react v0.469.0 - ISC
300
+ *
301
+ * This source code is licensed under the ISC license.
302
+ * See the LICENSE file in the root directory of this source tree.
303
+ */const kN=ie("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
304
+ * @license lucide-react v0.469.0 - ISC
305
+ *
306
+ * This source code is licensed under the ISC license.
307
+ * See the LICENSE file in the root directory of this source tree.
308
+ */const SN=ie("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/**
309
+ * @license lucide-react v0.469.0 - ISC
310
+ *
311
+ * This source code is licensed under the ISC license.
312
+ * See the LICENSE file in the root directory of this source tree.
313
+ */const CN=ie("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
314
+ * @license lucide-react v0.469.0 - ISC
315
+ *
316
+ * This source code is licensed under the ISC license.
317
+ * See the LICENSE file in the root directory of this source tree.
318
+ */const _N=ie("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/**
319
+ * @license lucide-react v0.469.0 - ISC
320
+ *
321
+ * This source code is licensed under the ISC license.
322
+ * See the LICENSE file in the root directory of this source tree.
323
+ */const Ha=ie("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
324
+ * @license lucide-react v0.469.0 - ISC
325
+ *
326
+ * This source code is licensed under the ISC license.
327
+ * See the LICENSE file in the root directory of this source tree.
328
+ */const al=ie("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
329
+ * @license lucide-react v0.469.0 - ISC
330
+ *
331
+ * This source code is licensed under the ISC license.
332
+ * See the LICENSE file in the root directory of this source tree.
333
+ */const PN=ie("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
334
+ * @license lucide-react v0.469.0 - ISC
335
+ *
336
+ * This source code is licensed under the ISC license.
337
+ * See the LICENSE file in the root directory of this source tree.
338
+ */const Do=ie("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
339
+ * @license lucide-react v0.469.0 - ISC
340
+ *
341
+ * This source code is licensed under the ISC license.
342
+ * See the LICENSE file in the root directory of this source tree.
343
+ */const EN=ie("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
344
+ * @license lucide-react v0.469.0 - ISC
345
+ *
346
+ * This source code is licensed under the ISC license.
347
+ * See the LICENSE file in the root directory of this source tree.
348
+ */const Vy=ie("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
349
+ * @license lucide-react v0.469.0 - ISC
350
+ *
351
+ * This source code is licensed under the ISC license.
352
+ * See the LICENSE file in the root directory of this source tree.
353
+ */const go=ie("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
354
+ * @license lucide-react v0.469.0 - ISC
355
+ *
356
+ * This source code is licensed under the ISC license.
357
+ * See the LICENSE file in the root directory of this source tree.
358
+ */const RN=ie("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
359
+ * @license lucide-react v0.469.0 - ISC
360
+ *
361
+ * This source code is licensed under the ISC license.
362
+ * See the LICENSE file in the root directory of this source tree.
363
+ */const MN=ie("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
364
+ * @license lucide-react v0.469.0 - ISC
365
+ *
366
+ * This source code is licensed under the ISC license.
367
+ * See the LICENSE file in the root directory of this source tree.
368
+ */const TN=ie("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
369
+ * @license lucide-react v0.469.0 - ISC
370
+ *
371
+ * This source code is licensed under the ISC license.
372
+ * See the LICENSE file in the root directory of this source tree.
373
+ */const Hy=ie("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);/**
374
+ * @license lucide-react v0.469.0 - ISC
375
+ *
376
+ * This source code is licensed under the ISC license.
377
+ * See the LICENSE file in the root directory of this source tree.
378
+ */const qN=ie("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
379
+ * @license lucide-react v0.469.0 - ISC
380
+ *
381
+ * This source code is licensed under the ISC license.
382
+ * See the LICENSE file in the root directory of this source tree.
383
+ */const Gr=ie("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
384
+ * @license lucide-react v0.469.0 - ISC
385
+ *
386
+ * This source code is licensed under the ISC license.
387
+ * See the LICENSE file in the root directory of this source tree.
388
+ */const Uo=ie("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
389
+ * @license lucide-react v0.469.0 - ISC
390
+ *
391
+ * This source code is licensed under the ISC license.
392
+ * See the LICENSE file in the root directory of this source tree.
393
+ */const Qo=ie("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
394
+ * @license lucide-react v0.469.0 - ISC
395
+ *
396
+ * This source code is licensed under the ISC license.
397
+ * See the LICENSE file in the root directory of this source tree.
398
+ */const Ky=ie("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
399
+ * @license lucide-react v0.469.0 - ISC
400
+ *
401
+ * This source code is licensed under the ISC license.
402
+ * See the LICENSE file in the root directory of this source tree.
403
+ */const es=ie("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
404
+ * @license lucide-react v0.469.0 - ISC
405
+ *
406
+ * This source code is licensed under the ISC license.
407
+ * See the LICENSE file in the root directory of this source tree.
408
+ */const dm=ie("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
409
+ * @license lucide-react v0.469.0 - ISC
410
+ *
411
+ * This source code is licensed under the ISC license.
412
+ * See the LICENSE file in the root directory of this source tree.
413
+ */const Wy=ie("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
414
+ * @license lucide-react v0.469.0 - ISC
415
+ *
416
+ * This source code is licensed under the ISC license.
417
+ * See the LICENSE file in the root directory of this source tree.
418
+ */const Zu=ie("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
419
+ * @license lucide-react v0.469.0 - ISC
420
+ *
421
+ * This source code is licensed under the ISC license.
422
+ * See the LICENSE file in the root directory of this source tree.
423
+ */const Bo=ie("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/**
424
+ * @license lucide-react v0.469.0 - ISC
425
+ *
426
+ * This source code is licensed under the ISC license.
427
+ * See the LICENSE file in the root directory of this source tree.
428
+ */const Yn=ie("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
429
+ * @license lucide-react v0.469.0 - ISC
430
+ *
431
+ * This source code is licensed under the ISC license.
432
+ * See the LICENSE file in the root directory of this source tree.
433
+ */const $N=ie("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
434
+ * @license lucide-react v0.469.0 - ISC
435
+ *
436
+ * This source code is licensed under the ISC license.
437
+ * See the LICENSE file in the root directory of this source tree.
438
+ */const IN=ie("ServerCrash",[["path",{d:"M6 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2",key:"4b9dqc"}],["path",{d:"M6 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-2",key:"22nnkd"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m13 6-4 6h6l-4 6",key:"14hqih"}]]);/**
439
+ * @license lucide-react v0.469.0 - ISC
440
+ *
441
+ * This source code is licensed under the ISC license.
442
+ * See the LICENSE file in the root directory of this source tree.
443
+ */const Zy=ie("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
444
+ * @license lucide-react v0.469.0 - ISC
445
+ *
446
+ * This source code is licensed under the ISC license.
447
+ * See the LICENSE file in the root directory of this source tree.
448
+ */const Gy=ie("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
449
+ * @license lucide-react v0.469.0 - ISC
450
+ *
451
+ * This source code is licensed under the ISC license.
452
+ * See the LICENSE file in the root directory of this source tree.
453
+ */const hm=ie("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
454
+ * @license lucide-react v0.469.0 - ISC
455
+ *
456
+ * This source code is licensed under the ISC license.
457
+ * See the LICENSE file in the root directory of this source tree.
458
+ */const Gu=ie("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
459
+ * @license lucide-react v0.469.0 - ISC
460
+ *
461
+ * This source code is licensed under the ISC license.
462
+ * See the LICENSE file in the root directory of this source tree.
463
+ */const zN=ie("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
464
+ * @license lucide-react v0.469.0 - ISC
465
+ *
466
+ * This source code is licensed under the ISC license.
467
+ * See the LICENSE file in the root directory of this source tree.
468
+ */const ON=ie("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
469
+ * @license lucide-react v0.469.0 - ISC
470
+ *
471
+ * This source code is licensed under the ISC license.
472
+ * See the LICENSE file in the root directory of this source tree.
473
+ */const Vg=ie("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);/**
474
+ * @license lucide-react v0.469.0 - ISC
475
+ *
476
+ * This source code is licensed under the ISC license.
477
+ * See the LICENSE file in the root directory of this source tree.
478
+ */const Jy=ie("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
479
+ * @license lucide-react v0.469.0 - ISC
480
+ *
481
+ * This source code is licensed under the ISC license.
482
+ * See the LICENSE file in the root directory of this source tree.
483
+ */const Un=ie("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
484
+ * @license lucide-react v0.469.0 - ISC
485
+ *
486
+ * This source code is licensed under the ISC license.
487
+ * See the LICENSE file in the root directory of this source tree.
488
+ */const ts=ie("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
489
+ * @license lucide-react v0.469.0 - ISC
490
+ *
491
+ * This source code is licensed under the ISC license.
492
+ * See the LICENSE file in the root directory of this source tree.
493
+ */const fm=ie("Unplug",[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]);/**
494
+ * @license lucide-react v0.469.0 - ISC
495
+ *
496
+ * This source code is licensed under the ISC license.
497
+ * See the LICENSE file in the root directory of this source tree.
498
+ */const AN=ie("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/**
499
+ * @license lucide-react v0.469.0 - ISC
500
+ *
501
+ * This source code is licensed under the ISC license.
502
+ * See the LICENSE file in the root directory of this source tree.
503
+ */const LN=ie("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
504
+ * @license lucide-react v0.469.0 - ISC
505
+ *
506
+ * This source code is licensed under the ISC license.
507
+ * See the LICENSE file in the root directory of this source tree.
508
+ */const FN=ie("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/**
509
+ * @license lucide-react v0.469.0 - ISC
510
+ *
511
+ * This source code is licensed under the ISC license.
512
+ * See the LICENSE file in the root directory of this source tree.
513
+ */const Ju=ie("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
514
+ * @license lucide-react v0.469.0 - ISC
515
+ *
516
+ * This source code is licensed under the ISC license.
517
+ * See the LICENSE file in the root directory of this source tree.
518
+ */const Rf=ie("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
519
+ * @license lucide-react v0.469.0 - ISC
520
+ *
521
+ * This source code is licensed under the ISC license.
522
+ * See the LICENSE file in the root directory of this source tree.
523
+ */const DN=ie("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
524
+ * @license lucide-react v0.469.0 - ISC
525
+ *
526
+ * This source code is licensed under the ISC license.
527
+ * See the LICENSE file in the root directory of this source tree.
528
+ */const vn=ie("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
529
+ * @license lucide-react v0.469.0 - ISC
530
+ *
531
+ * This source code is licensed under the ISC license.
532
+ * See the LICENSE file in the root directory of this source tree.
533
+ */const Xy=ie("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Yy(e){var n,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(n=0;n<o;n++)e[n]&&(r=Yy(e[n]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function UN(){for(var e,n,r=0,i="",o=arguments.length;r<o;r++)(e=arguments[r])&&(n=Yy(e))&&(i&&(i+=" "),i+=n);return i}function F(...e){return UN(e)}function Kt({className:e,size:n=16,label:r}){return t.jsxs("span",{role:"status","aria-label":r??"Loading",className:F("inline-flex items-center gap-2 text-fg-subtle",e),children:[t.jsx(Vy,{className:"animate-spin",style:{width:n,height:n},"aria-hidden":!0}),r&&t.jsx("span",{className:"text-xs",children:r})]})}function il({label:e="Loading…"}){return t.jsx("div",{className:"flex h-48 w-full items-center justify-center",children:t.jsx(Kt,{size:18,label:e})})}function Cu({className:e}){return t.jsx("span",{className:F("skeleton inline-block h-3 w-16 align-middle",e),"aria-hidden":!0})}class Mf extends Error{constructor(r,i){super(i.message||i.error||`Request failed (${r})`);Uh(this,"status");Uh(this,"body");this.name="ApiRequestError",this.status=r,this.body=i}get code(){return this.body.error}}function Ts(e){return e instanceof Mf}function ve(e,n="Something went wrong"){return Ts(e)?e.status===0?"Could not reach the server":e.body.message||e.body.error||n:e instanceof Error&&e.message||n}const Ss={};function QN(e){Object.assign(Ss,e)}const Hg="/api";function e0(e,n){const r=e.startsWith("/")?`${Hg}${e}`:`${Hg}/${e}`;if(!n)return r;const i=new URLSearchParams;for(const[c,d]of Object.entries(n))d==null||d===""||i.set(c,String(d));const o=i.toString();return o?`${r}?${o}`:r}function BN(e){return typeof e=="object"&&e!==null&&typeof e.error=="string"}async function ao(e,n,r,i={}){const o={accept:"application/json"};r!==void 0&&(o["content-type"]="application/json");let c;try{c=await fetch(e0(n,i.query),{method:e,credentials:"same-origin",headers:o,body:r!==void 0?JSON.stringify(r):void 0,signal:i.signal})}catch(v){throw v instanceof DOMException&&v.name==="AbortError"?v:new Mf(0,{error:"network",message:"Could not reach the server"})}const d=await c.text();let h=null;if(d)try{h=JSON.parse(d)}catch{h=d}if(c.ok)return h;const f=BN(h)?h:{error:`http_${c.status}`,message:typeof h=="string"&&h.slice(0,200)||c.statusText||`Request failed (${c.status})`},g=new Mf(c.status,f);throw i.silent===!0||Array.isArray(i.silent)&&i.silent.includes(c.status)||VN(g),g}function VN(e){var n,r,i;switch(e.status){case 401:(n=Ss.onUnauthenticated)==null||n.call(Ss);break;case 402:(r=Ss.onProRequired)==null||r.call(Ss,e.body.feature);break;case 423:(i=Ss.onDemoLocked)==null||i.call(Ss,e.body.message);break}}const ee={get:(e,n)=>ao("GET",e,void 0,n),post:(e,n,r)=>ao("POST",e,n??{},r),patch:(e,n,r)=>ao("PATCH",e,n??{},r),put:(e,n,r)=>ao("PUT",e,n??{},r),del:(e,n)=>ao("DELETE",e,void 0,n)},ze=e=>encodeURIComponent(e);var Xe;(function(e){e.assertEqual=o=>{};function n(o){}e.assertIs=n;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{const c={};for(const d of o)c[d]=d;return c},e.getValidEnumValues=o=>{const c=e.objectKeys(o).filter(h=>typeof o[o[h]]!="number"),d={};for(const h of c)d[h]=o[h];return e.objectValues(d)},e.objectValues=o=>e.objectKeys(o).map(function(c){return o[c]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const c=[];for(const d in o)Object.prototype.hasOwnProperty.call(o,d)&&c.push(d);return c},e.find=(o,c)=>{for(const d of o)if(c(d))return d},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function i(o,c=" | "){return o.map(d=>typeof d=="string"?`'${d}'`:d).join(c)}e.joinValues=i,e.jsonStringifyReplacer=(o,c)=>typeof c=="bigint"?c.toString():c})(Xe||(Xe={}));var Kg;(function(e){e.mergeShapes=(n,r)=>({...n,...r})})(Kg||(Kg={}));const je=Xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),qr=e=>{switch(typeof e){case"undefined":return je.undefined;case"string":return je.string;case"number":return Number.isNaN(e)?je.nan:je.number;case"boolean":return je.boolean;case"function":return je.function;case"bigint":return je.bigint;case"symbol":return je.symbol;case"object":return Array.isArray(e)?je.array:e===null?je.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?je.promise:typeof Map<"u"&&e instanceof Map?je.map:typeof Set<"u"&&e instanceof Set?je.set:typeof Date<"u"&&e instanceof Date?je.date:je.object;default:return je.unknown}},te=Xe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class rr extends Error{get errors(){return this.issues}constructor(n){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=n}format(n){const r=n||function(c){return c.message},i={_errors:[]},o=c=>{for(const d of c.issues)if(d.code==="invalid_union")d.unionErrors.map(o);else if(d.code==="invalid_return_type")o(d.returnTypeError);else if(d.code==="invalid_arguments")o(d.argumentsError);else if(d.path.length===0)i._errors.push(r(d));else{let h=i,f=0;for(;f<d.path.length;){const g=d.path[f];f===d.path.length-1?(h[g]=h[g]||{_errors:[]},h[g]._errors.push(r(d))):h[g]=h[g]||{_errors:[]},h=h[g],f++}}};return o(this),i}static assert(n){if(!(n instanceof rr))throw new Error(`Not a ZodError: ${n}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Xe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(n=r=>r.message){const r={},i=[];for(const o of this.issues)if(o.path.length>0){const c=o.path[0];r[c]=r[c]||[],r[c].push(n(o))}else i.push(n(o));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}}rr.create=e=>new rr(e);const Tf=(e,n)=>{let r;switch(e.code){case te.invalid_type:e.received===je.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case te.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Xe.jsonStringifyReplacer)}`;break;case te.unrecognized_keys:r=`Unrecognized key(s) in object: ${Xe.joinValues(e.keys,", ")}`;break;case te.invalid_union:r="Invalid input";break;case te.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Xe.joinValues(e.options)}`;break;case te.invalid_enum_value:r=`Invalid enum value. Expected ${Xe.joinValues(e.options)}, received '${e.received}'`;break;case te.invalid_arguments:r="Invalid function arguments";break;case te.invalid_return_type:r="Invalid function return type";break;case te.invalid_date:r="Invalid date";break;case te.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Xe.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case te.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case te.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case te.custom:r="Invalid input";break;case te.invalid_intersection_types:r="Intersection results could not be merged";break;case te.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case te.not_finite:r="Number must be finite";break;default:r=n.defaultError,Xe.assertNever(e)}return{message:r}};let HN=Tf;function KN(){return HN}const WN=e=>{const{data:n,path:r,errorMaps:i,issueData:o}=e,c=[...r,...o.path||[]],d={...o,path:c};if(o.message!==void 0)return{...o,path:c,message:o.message};let h="";const f=i.filter(g=>!!g).slice().reverse();for(const g of f)h=g(d,{data:n,defaultError:h}).message;return{...o,path:c,message:h}};function he(e,n){const r=KN(),i=WN({issueData:n,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Tf?void 0:Tf].filter(o=>!!o)});e.common.issues.push(i)}class yn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(n,r){const i=[];for(const o of r){if(o.status==="aborted")return Ae;o.status==="dirty"&&n.dirty(),i.push(o.value)}return{status:n.value,value:i}}static async mergeObjectAsync(n,r){const i=[];for(const o of r){const c=await o.key,d=await o.value;i.push({key:c,value:d})}return yn.mergeObjectSync(n,i)}static mergeObjectSync(n,r){const i={};for(const o of r){const{key:c,value:d}=o;if(c.status==="aborted"||d.status==="aborted")return Ae;c.status==="dirty"&&n.dirty(),d.status==="dirty"&&n.dirty(),c.value!=="__proto__"&&(typeof d.value<"u"||o.alwaysSet)&&(i[c.value]=d.value)}return{status:n.value,value:i}}}const Ae=Object.freeze({status:"aborted"}),uo=e=>({status:"dirty",value:e}),ns=e=>({status:"valid",value:e}),Wg=e=>e.status==="aborted",Zg=e=>e.status==="dirty",Wi=e=>e.status==="valid",_u=e=>typeof Promise<"u"&&e instanceof Promise;var _e;(function(e){e.errToObj=n=>typeof n=="string"?{message:n}:n||{},e.toString=n=>typeof n=="string"?n:n==null?void 0:n.message})(_e||(_e={}));class qs{constructor(n,r,i,o){this._cachedPath=[],this.parent=n,this.data=r,this._path=i,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Gg=(e,n)=>{if(Wi(n))return{success:!0,data:n.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new rr(e.common.issues);return this._error=r,this._error}}};function Be(e){if(!e)return{};const{errorMap:n,invalid_type_error:r,required_error:i,description:o}=e;if(n&&(r||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return n?{errorMap:n,description:o}:{errorMap:(d,h)=>{const{message:f}=e;return d.code==="invalid_enum_value"?{message:f??h.defaultError}:typeof h.data>"u"?{message:f??i??h.defaultError}:d.code!=="invalid_type"?{message:h.defaultError}:{message:f??r??h.defaultError}},description:o}}class Ze{get description(){return this._def.description}_getType(n){return qr(n.data)}_getOrReturnCtx(n,r){return r||{common:n.parent.common,data:n.data,parsedType:qr(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}_processInputParams(n){return{status:new yn,ctx:{common:n.parent.common,data:n.data,parsedType:qr(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}}_parseSync(n){const r=this._parse(n);if(_u(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(n){const r=this._parse(n);return Promise.resolve(r)}parse(n,r){const i=this.safeParse(n,r);if(i.success)return i.data;throw i.error}safeParse(n,r){const i={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:qr(n)},o=this._parseSync({data:n,path:i.path,parent:i});return Gg(i,o)}"~validate"(n){var i,o;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:qr(n)};if(!this["~standard"].async)try{const c=this._parseSync({data:n,path:[],parent:r});return Wi(c)?{value:c.value}:{issues:r.common.issues}}catch(c){(o=(i=c==null?void 0:c.message)==null?void 0:i.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:n,path:[],parent:r}).then(c=>Wi(c)?{value:c.value}:{issues:r.common.issues})}async parseAsync(n,r){const i=await this.safeParseAsync(n,r);if(i.success)return i.data;throw i.error}async safeParseAsync(n,r){const i={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:qr(n)},o=this._parse({data:n,path:i.path,parent:i}),c=await(_u(o)?o:Promise.resolve(o));return Gg(i,c)}refine(n,r){const i=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,c)=>{const d=n(o),h=()=>c.addIssue({code:te.custom,...i(o)});return typeof Promise<"u"&&d instanceof Promise?d.then(f=>f?!0:(h(),!1)):d?!0:(h(),!1)})}refinement(n,r){return this._refinement((i,o)=>n(i)?!0:(o.addIssue(typeof r=="function"?r(i,o):r),!1))}_refinement(n){return new Da({schema:this,typeName:Le.ZodEffects,effect:{type:"refinement",refinement:n}})}superRefine(n){return this._refinement(n)}constructor(n){this.spa=this.safeParseAsync,this._def=n,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return nr.create(this,this._def)}nullable(){return Ua.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ms.create(this)}promise(){return qu.create(this,this._def)}or(n){return Eu.create([this,n],this._def)}and(n){return Ru.create(this,n,this._def)}transform(n){return new Da({...Be(this._def),schema:this,typeName:Le.ZodEffects,effect:{type:"transform",transform:n}})}default(n){const r=typeof n=="function"?n:()=>n;return new $u({...Be(this._def),innerType:this,defaultValue:r,typeName:Le.ZodDefault})}brand(){return new r0({typeName:Le.ZodBranded,type:this,...Be(this._def)})}catch(n){const r=typeof n=="function"?n:()=>n;return new Iu({...Be(this._def),innerType:this,catchValue:r,typeName:Le.ZodCatch})}describe(n){const r=this.constructor;return new r({...this._def,description:n})}pipe(n){return pm.create(this,n)}readonly(){return zu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ZN=/^c[^\s-]{8,}$/i,GN=/^[0-9a-z]+$/,JN=/^[0-9A-HJKMNP-TV-Z]{26}$/i,XN=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,YN=/^[a-z0-9_-]{21}$/i,ek=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tk=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,nk=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sk="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Gh;const rk=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ak=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ik=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,lk=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ok=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ck=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,t0="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",uk=new RegExp(`^${t0}$`);function n0(e){let n="[0-5]\\d";e.precision?n=`${n}\\.\\d{${e.precision}}`:e.precision==null&&(n=`${n}(\\.\\d+)?`);const r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${n})${r}`}function dk(e){return new RegExp(`^${n0(e)}$`)}function hk(e){let n=`${t0}T${n0(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),n=`${n}(${r.join("|")})`,new RegExp(`^${n}$`)}function fk(e,n){return!!((n==="v4"||!n)&&rk.test(e)||(n==="v6"||!n)&&ik.test(e))}function mk(e,n){if(!ek.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(i));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||n&&o.alg!==n)}catch{return!1}}function pk(e,n){return!!((n==="v4"||!n)&&ak.test(e)||(n==="v6"||!n)&&lk.test(e))}class Es extends Ze{_parse(n){if(this._def.coerce&&(n.data=String(n.data)),this._getType(n)!==je.string){const c=this._getOrReturnCtx(n);return he(c,{code:te.invalid_type,expected:je.string,received:c.parsedType}),Ae}const i=new yn;let o;for(const c of this._def.checks)if(c.kind==="min")n.data.length<c.value&&(o=this._getOrReturnCtx(n,o),he(o,{code:te.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),i.dirty());else if(c.kind==="max")n.data.length>c.value&&(o=this._getOrReturnCtx(n,o),he(o,{code:te.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),i.dirty());else if(c.kind==="length"){const d=n.data.length>c.value,h=n.data.length<c.value;(d||h)&&(o=this._getOrReturnCtx(n,o),d?he(o,{code:te.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):h&&he(o,{code:te.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),i.dirty())}else if(c.kind==="email")nk.test(n.data)||(o=this._getOrReturnCtx(n,o),he(o,{validation:"email",code:te.invalid_string,message:c.message}),i.dirty());else if(c.kind==="emoji")Gh||(Gh=new RegExp(sk,"u")),Gh.test(n.data)||(o=this._getOrReturnCtx(n,o),he(o,{validation:"emoji",code:te.invalid_string,message:c.message}),i.dirty());else if(c.kind==="uuid")XN.test(n.data)||(o=this._getOrReturnCtx(n,o),he(o,{validation:"uuid",code:te.invalid_string,message:c.message}),i.dirty());else if(c.kind==="nanoid")YN.test(n.data)||(o=this._getOrReturnCtx(n,o),he(o,{validation:"nanoid",code:te.invalid_string,message:c.message}),i.dirty());else if(c.kind==="cuid")ZN.test(n.data)||(o=this._getOrReturnCtx(n,o),he(o,{validation:"cuid",code:te.invalid_string,message:c.message}),i.dirty());else if(c.kind==="cuid2")GN.test(n.data)||(o=this._getOrReturnCtx(n,o),he(o,{validation:"cuid2",code:te.invalid_string,message:c.message}),i.dirty());else if(c.kind==="ulid")JN.test(n.data)||(o=this._getOrReturnCtx(n,o),he(o,{validation:"ulid",code:te.invalid_string,message:c.message}),i.dirty());else if(c.kind==="url")try{new URL(n.data)}catch{o=this._getOrReturnCtx(n,o),he(o,{validation:"url",code:te.invalid_string,message:c.message}),i.dirty()}else c.kind==="regex"?(c.regex.lastIndex=0,c.regex.test(n.data)||(o=this._getOrReturnCtx(n,o),he(o,{validation:"regex",code:te.invalid_string,message:c.message}),i.dirty())):c.kind==="trim"?n.data=n.data.trim():c.kind==="includes"?n.data.includes(c.value,c.position)||(o=this._getOrReturnCtx(n,o),he(o,{code:te.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),i.dirty()):c.kind==="toLowerCase"?n.data=n.data.toLowerCase():c.kind==="toUpperCase"?n.data=n.data.toUpperCase():c.kind==="startsWith"?n.data.startsWith(c.value)||(o=this._getOrReturnCtx(n,o),he(o,{code:te.invalid_string,validation:{startsWith:c.value},message:c.message}),i.dirty()):c.kind==="endsWith"?n.data.endsWith(c.value)||(o=this._getOrReturnCtx(n,o),he(o,{code:te.invalid_string,validation:{endsWith:c.value},message:c.message}),i.dirty()):c.kind==="datetime"?hk(c).test(n.data)||(o=this._getOrReturnCtx(n,o),he(o,{code:te.invalid_string,validation:"datetime",message:c.message}),i.dirty()):c.kind==="date"?uk.test(n.data)||(o=this._getOrReturnCtx(n,o),he(o,{code:te.invalid_string,validation:"date",message:c.message}),i.dirty()):c.kind==="time"?dk(c).test(n.data)||(o=this._getOrReturnCtx(n,o),he(o,{code:te.invalid_string,validation:"time",message:c.message}),i.dirty()):c.kind==="duration"?tk.test(n.data)||(o=this._getOrReturnCtx(n,o),he(o,{validation:"duration",code:te.invalid_string,message:c.message}),i.dirty()):c.kind==="ip"?fk(n.data,c.version)||(o=this._getOrReturnCtx(n,o),he(o,{validation:"ip",code:te.invalid_string,message:c.message}),i.dirty()):c.kind==="jwt"?mk(n.data,c.alg)||(o=this._getOrReturnCtx(n,o),he(o,{validation:"jwt",code:te.invalid_string,message:c.message}),i.dirty()):c.kind==="cidr"?pk(n.data,c.version)||(o=this._getOrReturnCtx(n,o),he(o,{validation:"cidr",code:te.invalid_string,message:c.message}),i.dirty()):c.kind==="base64"?ok.test(n.data)||(o=this._getOrReturnCtx(n,o),he(o,{validation:"base64",code:te.invalid_string,message:c.message}),i.dirty()):c.kind==="base64url"?ck.test(n.data)||(o=this._getOrReturnCtx(n,o),he(o,{validation:"base64url",code:te.invalid_string,message:c.message}),i.dirty()):Xe.assertNever(c);return{status:i.value,value:n.data}}_regex(n,r,i){return this.refinement(o=>n.test(o),{validation:r,code:te.invalid_string,..._e.errToObj(i)})}_addCheck(n){return new Es({...this._def,checks:[...this._def.checks,n]})}email(n){return this._addCheck({kind:"email",..._e.errToObj(n)})}url(n){return this._addCheck({kind:"url",..._e.errToObj(n)})}emoji(n){return this._addCheck({kind:"emoji",..._e.errToObj(n)})}uuid(n){return this._addCheck({kind:"uuid",..._e.errToObj(n)})}nanoid(n){return this._addCheck({kind:"nanoid",..._e.errToObj(n)})}cuid(n){return this._addCheck({kind:"cuid",..._e.errToObj(n)})}cuid2(n){return this._addCheck({kind:"cuid2",..._e.errToObj(n)})}ulid(n){return this._addCheck({kind:"ulid",..._e.errToObj(n)})}base64(n){return this._addCheck({kind:"base64",..._e.errToObj(n)})}base64url(n){return this._addCheck({kind:"base64url",..._e.errToObj(n)})}jwt(n){return this._addCheck({kind:"jwt",..._e.errToObj(n)})}ip(n){return this._addCheck({kind:"ip",..._e.errToObj(n)})}cidr(n){return this._addCheck({kind:"cidr",..._e.errToObj(n)})}datetime(n){return typeof n=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:n}):this._addCheck({kind:"datetime",precision:typeof(n==null?void 0:n.precision)>"u"?null:n==null?void 0:n.precision,offset:(n==null?void 0:n.offset)??!1,local:(n==null?void 0:n.local)??!1,..._e.errToObj(n==null?void 0:n.message)})}date(n){return this._addCheck({kind:"date",message:n})}time(n){return typeof n=="string"?this._addCheck({kind:"time",precision:null,message:n}):this._addCheck({kind:"time",precision:typeof(n==null?void 0:n.precision)>"u"?null:n==null?void 0:n.precision,..._e.errToObj(n==null?void 0:n.message)})}duration(n){return this._addCheck({kind:"duration",..._e.errToObj(n)})}regex(n,r){return this._addCheck({kind:"regex",regex:n,..._e.errToObj(r)})}includes(n,r){return this._addCheck({kind:"includes",value:n,position:r==null?void 0:r.position,..._e.errToObj(r==null?void 0:r.message)})}startsWith(n,r){return this._addCheck({kind:"startsWith",value:n,..._e.errToObj(r)})}endsWith(n,r){return this._addCheck({kind:"endsWith",value:n,..._e.errToObj(r)})}min(n,r){return this._addCheck({kind:"min",value:n,..._e.errToObj(r)})}max(n,r){return this._addCheck({kind:"max",value:n,..._e.errToObj(r)})}length(n,r){return this._addCheck({kind:"length",value:n,..._e.errToObj(r)})}nonempty(n){return this.min(1,_e.errToObj(n))}trim(){return new Es({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Es({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Es({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(n=>n.kind==="datetime")}get isDate(){return!!this._def.checks.find(n=>n.kind==="date")}get isTime(){return!!this._def.checks.find(n=>n.kind==="time")}get isDuration(){return!!this._def.checks.find(n=>n.kind==="duration")}get isEmail(){return!!this._def.checks.find(n=>n.kind==="email")}get isURL(){return!!this._def.checks.find(n=>n.kind==="url")}get isEmoji(){return!!this._def.checks.find(n=>n.kind==="emoji")}get isUUID(){return!!this._def.checks.find(n=>n.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(n=>n.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(n=>n.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(n=>n.kind==="cuid2")}get isULID(){return!!this._def.checks.find(n=>n.kind==="ulid")}get isIP(){return!!this._def.checks.find(n=>n.kind==="ip")}get isCIDR(){return!!this._def.checks.find(n=>n.kind==="cidr")}get isBase64(){return!!this._def.checks.find(n=>n.kind==="base64")}get isBase64url(){return!!this._def.checks.find(n=>n.kind==="base64url")}get minLength(){let n=null;for(const r of this._def.checks)r.kind==="min"&&(n===null||r.value>n)&&(n=r.value);return n}get maxLength(){let n=null;for(const r of this._def.checks)r.kind==="max"&&(n===null||r.value<n)&&(n=r.value);return n}}Es.create=e=>new Es({checks:[],typeName:Le.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Be(e)});function xk(e,n){const r=(e.toString().split(".")[1]||"").length,i=(n.toString().split(".")[1]||"").length,o=r>i?r:i,c=Number.parseInt(e.toFixed(o).replace(".","")),d=Number.parseInt(n.toFixed(o).replace(".",""));return c%d/10**o}class Oa extends Ze{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(n){if(this._def.coerce&&(n.data=Number(n.data)),this._getType(n)!==je.number){const c=this._getOrReturnCtx(n);return he(c,{code:te.invalid_type,expected:je.number,received:c.parsedType}),Ae}let i;const o=new yn;for(const c of this._def.checks)c.kind==="int"?Xe.isInteger(n.data)||(i=this._getOrReturnCtx(n,i),he(i,{code:te.invalid_type,expected:"integer",received:"float",message:c.message}),o.dirty()):c.kind==="min"?(c.inclusive?n.data<c.value:n.data<=c.value)&&(i=this._getOrReturnCtx(n,i),he(i,{code:te.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),o.dirty()):c.kind==="max"?(c.inclusive?n.data>c.value:n.data>=c.value)&&(i=this._getOrReturnCtx(n,i),he(i,{code:te.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),o.dirty()):c.kind==="multipleOf"?xk(n.data,c.value)!==0&&(i=this._getOrReturnCtx(n,i),he(i,{code:te.not_multiple_of,multipleOf:c.value,message:c.message}),o.dirty()):c.kind==="finite"?Number.isFinite(n.data)||(i=this._getOrReturnCtx(n,i),he(i,{code:te.not_finite,message:c.message}),o.dirty()):Xe.assertNever(c);return{status:o.value,value:n.data}}gte(n,r){return this.setLimit("min",n,!0,_e.toString(r))}gt(n,r){return this.setLimit("min",n,!1,_e.toString(r))}lte(n,r){return this.setLimit("max",n,!0,_e.toString(r))}lt(n,r){return this.setLimit("max",n,!1,_e.toString(r))}setLimit(n,r,i,o){return new Oa({...this._def,checks:[...this._def.checks,{kind:n,value:r,inclusive:i,message:_e.toString(o)}]})}_addCheck(n){return new Oa({...this._def,checks:[...this._def.checks,n]})}int(n){return this._addCheck({kind:"int",message:_e.toString(n)})}positive(n){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_e.toString(n)})}negative(n){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_e.toString(n)})}nonpositive(n){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_e.toString(n)})}nonnegative(n){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_e.toString(n)})}multipleOf(n,r){return this._addCheck({kind:"multipleOf",value:n,message:_e.toString(r)})}finite(n){return this._addCheck({kind:"finite",message:_e.toString(n)})}safe(n){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_e.toString(n)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_e.toString(n)})}get minValue(){let n=null;for(const r of this._def.checks)r.kind==="min"&&(n===null||r.value>n)&&(n=r.value);return n}get maxValue(){let n=null;for(const r of this._def.checks)r.kind==="max"&&(n===null||r.value<n)&&(n=r.value);return n}get isInt(){return!!this._def.checks.find(n=>n.kind==="int"||n.kind==="multipleOf"&&Xe.isInteger(n.value))}get isFinite(){let n=null,r=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(n===null||i.value<n)&&(n=i.value)}return Number.isFinite(r)&&Number.isFinite(n)}}Oa.create=e=>new Oa({checks:[],typeName:Le.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Be(e)});class Aa extends Ze{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(n){if(this._def.coerce)try{n.data=BigInt(n.data)}catch{return this._getInvalidInput(n)}if(this._getType(n)!==je.bigint)return this._getInvalidInput(n);let i;const o=new yn;for(const c of this._def.checks)c.kind==="min"?(c.inclusive?n.data<c.value:n.data<=c.value)&&(i=this._getOrReturnCtx(n,i),he(i,{code:te.too_small,type:"bigint",minimum:c.value,inclusive:c.inclusive,message:c.message}),o.dirty()):c.kind==="max"?(c.inclusive?n.data>c.value:n.data>=c.value)&&(i=this._getOrReturnCtx(n,i),he(i,{code:te.too_big,type:"bigint",maximum:c.value,inclusive:c.inclusive,message:c.message}),o.dirty()):c.kind==="multipleOf"?n.data%c.value!==BigInt(0)&&(i=this._getOrReturnCtx(n,i),he(i,{code:te.not_multiple_of,multipleOf:c.value,message:c.message}),o.dirty()):Xe.assertNever(c);return{status:o.value,value:n.data}}_getInvalidInput(n){const r=this._getOrReturnCtx(n);return he(r,{code:te.invalid_type,expected:je.bigint,received:r.parsedType}),Ae}gte(n,r){return this.setLimit("min",n,!0,_e.toString(r))}gt(n,r){return this.setLimit("min",n,!1,_e.toString(r))}lte(n,r){return this.setLimit("max",n,!0,_e.toString(r))}lt(n,r){return this.setLimit("max",n,!1,_e.toString(r))}setLimit(n,r,i,o){return new Aa({...this._def,checks:[...this._def.checks,{kind:n,value:r,inclusive:i,message:_e.toString(o)}]})}_addCheck(n){return new Aa({...this._def,checks:[...this._def.checks,n]})}positive(n){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_e.toString(n)})}negative(n){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_e.toString(n)})}nonpositive(n){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_e.toString(n)})}nonnegative(n){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_e.toString(n)})}multipleOf(n,r){return this._addCheck({kind:"multipleOf",value:n,message:_e.toString(r)})}get minValue(){let n=null;for(const r of this._def.checks)r.kind==="min"&&(n===null||r.value>n)&&(n=r.value);return n}get maxValue(){let n=null;for(const r of this._def.checks)r.kind==="max"&&(n===null||r.value<n)&&(n=r.value);return n}}Aa.create=e=>new Aa({checks:[],typeName:Le.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Be(e)});class Pu extends Ze{_parse(n){if(this._def.coerce&&(n.data=!!n.data),this._getType(n)!==je.boolean){const i=this._getOrReturnCtx(n);return he(i,{code:te.invalid_type,expected:je.boolean,received:i.parsedType}),Ae}return ns(n.data)}}Pu.create=e=>new Pu({typeName:Le.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Be(e)});class Zi extends Ze{_parse(n){if(this._def.coerce&&(n.data=new Date(n.data)),this._getType(n)!==je.date){const c=this._getOrReturnCtx(n);return he(c,{code:te.invalid_type,expected:je.date,received:c.parsedType}),Ae}if(Number.isNaN(n.data.getTime())){const c=this._getOrReturnCtx(n);return he(c,{code:te.invalid_date}),Ae}const i=new yn;let o;for(const c of this._def.checks)c.kind==="min"?n.data.getTime()<c.value&&(o=this._getOrReturnCtx(n,o),he(o,{code:te.too_small,message:c.message,inclusive:!0,exact:!1,minimum:c.value,type:"date"}),i.dirty()):c.kind==="max"?n.data.getTime()>c.value&&(o=this._getOrReturnCtx(n,o),he(o,{code:te.too_big,message:c.message,inclusive:!0,exact:!1,maximum:c.value,type:"date"}),i.dirty()):Xe.assertNever(c);return{status:i.value,value:new Date(n.data.getTime())}}_addCheck(n){return new Zi({...this._def,checks:[...this._def.checks,n]})}min(n,r){return this._addCheck({kind:"min",value:n.getTime(),message:_e.toString(r)})}max(n,r){return this._addCheck({kind:"max",value:n.getTime(),message:_e.toString(r)})}get minDate(){let n=null;for(const r of this._def.checks)r.kind==="min"&&(n===null||r.value>n)&&(n=r.value);return n!=null?new Date(n):null}get maxDate(){let n=null;for(const r of this._def.checks)r.kind==="max"&&(n===null||r.value<n)&&(n=r.value);return n!=null?new Date(n):null}}Zi.create=e=>new Zi({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Le.ZodDate,...Be(e)});class Jg extends Ze{_parse(n){if(this._getType(n)!==je.symbol){const i=this._getOrReturnCtx(n);return he(i,{code:te.invalid_type,expected:je.symbol,received:i.parsedType}),Ae}return ns(n.data)}}Jg.create=e=>new Jg({typeName:Le.ZodSymbol,...Be(e)});class qf extends Ze{_parse(n){if(this._getType(n)!==je.undefined){const i=this._getOrReturnCtx(n);return he(i,{code:te.invalid_type,expected:je.undefined,received:i.parsedType}),Ae}return ns(n.data)}}qf.create=e=>new qf({typeName:Le.ZodUndefined,...Be(e)});class $f extends Ze{_parse(n){if(this._getType(n)!==je.null){const i=this._getOrReturnCtx(n);return he(i,{code:te.invalid_type,expected:je.null,received:i.parsedType}),Ae}return ns(n.data)}}$f.create=e=>new $f({typeName:Le.ZodNull,...Be(e)});class Xg extends Ze{constructor(){super(...arguments),this._any=!0}_parse(n){return ns(n.data)}}Xg.create=e=>new Xg({typeName:Le.ZodAny,...Be(e)});class If extends Ze{constructor(){super(...arguments),this._unknown=!0}_parse(n){return ns(n.data)}}If.create=e=>new If({typeName:Le.ZodUnknown,...Be(e)});class Hr extends Ze{_parse(n){const r=this._getOrReturnCtx(n);return he(r,{code:te.invalid_type,expected:je.never,received:r.parsedType}),Ae}}Hr.create=e=>new Hr({typeName:Le.ZodNever,...Be(e)});class Yg extends Ze{_parse(n){if(this._getType(n)!==je.undefined){const i=this._getOrReturnCtx(n);return he(i,{code:te.invalid_type,expected:je.void,received:i.parsedType}),Ae}return ns(n.data)}}Yg.create=e=>new Yg({typeName:Le.ZodVoid,...Be(e)});class Ms extends Ze{_parse(n){const{ctx:r,status:i}=this._processInputParams(n),o=this._def;if(r.parsedType!==je.array)return he(r,{code:te.invalid_type,expected:je.array,received:r.parsedType}),Ae;if(o.exactLength!==null){const d=r.data.length>o.exactLength.value,h=r.data.length<o.exactLength.value;(d||h)&&(he(r,{code:d?te.too_big:te.too_small,minimum:h?o.exactLength.value:void 0,maximum:d?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),i.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(he(r,{code:te.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),i.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(he(r,{code:te.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((d,h)=>o.type._parseAsync(new qs(r,d,r.path,h)))).then(d=>yn.mergeArray(i,d));const c=[...r.data].map((d,h)=>o.type._parseSync(new qs(r,d,r.path,h)));return yn.mergeArray(i,c)}get element(){return this._def.type}min(n,r){return new Ms({...this._def,minLength:{value:n,message:_e.toString(r)}})}max(n,r){return new Ms({...this._def,maxLength:{value:n,message:_e.toString(r)}})}length(n,r){return new Ms({...this._def,exactLength:{value:n,message:_e.toString(r)}})}nonempty(n){return this.min(1,n)}}Ms.create=(e,n)=>new Ms({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Le.ZodArray,...Be(n)});function Ri(e){if(e instanceof $t){const n={};for(const r in e.shape){const i=e.shape[r];n[r]=nr.create(Ri(i))}return new $t({...e._def,shape:()=>n})}else return e instanceof Ms?new Ms({...e._def,type:Ri(e.element)}):e instanceof nr?nr.create(Ri(e.unwrap())):e instanceof Ua?Ua.create(Ri(e.unwrap())):e instanceof La?La.create(e.items.map(n=>Ri(n))):e}class $t extends Ze{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const n=this._def.shape(),r=Xe.objectKeys(n);return this._cached={shape:n,keys:r},this._cached}_parse(n){if(this._getType(n)!==je.object){const g=this._getOrReturnCtx(n);return he(g,{code:te.invalid_type,expected:je.object,received:g.parsedType}),Ae}const{status:i,ctx:o}=this._processInputParams(n),{shape:c,keys:d}=this._getCached(),h=[];if(!(this._def.catchall instanceof Hr&&this._def.unknownKeys==="strip"))for(const g in o.data)d.includes(g)||h.push(g);const f=[];for(const g of d){const p=c[g],v=o.data[g];f.push({key:{status:"valid",value:g},value:p._parse(new qs(o,v,o.path,g)),alwaysSet:g in o.data})}if(this._def.catchall instanceof Hr){const g=this._def.unknownKeys;if(g==="passthrough")for(const p of h)f.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(g==="strict")h.length>0&&(he(o,{code:te.unrecognized_keys,keys:h}),i.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const p of h){const v=o.data[p];f.push({key:{status:"valid",value:p},value:g._parse(new qs(o,v,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const g=[];for(const p of f){const v=await p.key,j=await p.value;g.push({key:v,value:j,alwaysSet:p.alwaysSet})}return g}).then(g=>yn.mergeObjectSync(i,g)):yn.mergeObjectSync(i,f)}get shape(){return this._def.shape()}strict(n){return _e.errToObj,new $t({...this._def,unknownKeys:"strict",...n!==void 0?{errorMap:(r,i)=>{var c,d;const o=((d=(c=this._def).errorMap)==null?void 0:d.call(c,r,i).message)??i.defaultError;return r.code==="unrecognized_keys"?{message:_e.errToObj(n).message??o}:{message:o}}}:{}})}strip(){return new $t({...this._def,unknownKeys:"strip"})}passthrough(){return new $t({...this._def,unknownKeys:"passthrough"})}extend(n){return new $t({...this._def,shape:()=>({...this._def.shape(),...n})})}merge(n){return new $t({unknownKeys:n._def.unknownKeys,catchall:n._def.catchall,shape:()=>({...this._def.shape(),...n._def.shape()}),typeName:Le.ZodObject})}setKey(n,r){return this.augment({[n]:r})}catchall(n){return new $t({...this._def,catchall:n})}pick(n){const r={};for(const i of Xe.objectKeys(n))n[i]&&this.shape[i]&&(r[i]=this.shape[i]);return new $t({...this._def,shape:()=>r})}omit(n){const r={};for(const i of Xe.objectKeys(this.shape))n[i]||(r[i]=this.shape[i]);return new $t({...this._def,shape:()=>r})}deepPartial(){return Ri(this)}partial(n){const r={};for(const i of Xe.objectKeys(this.shape)){const o=this.shape[i];n&&!n[i]?r[i]=o:r[i]=o.optional()}return new $t({...this._def,shape:()=>r})}required(n){const r={};for(const i of Xe.objectKeys(this.shape))if(n&&!n[i])r[i]=this.shape[i];else{let c=this.shape[i];for(;c instanceof nr;)c=c._def.innerType;r[i]=c}return new $t({...this._def,shape:()=>r})}keyof(){return s0(Xe.objectKeys(this.shape))}}$t.create=(e,n)=>new $t({shape:()=>e,unknownKeys:"strip",catchall:Hr.create(),typeName:Le.ZodObject,...Be(n)});$t.strictCreate=(e,n)=>new $t({shape:()=>e,unknownKeys:"strict",catchall:Hr.create(),typeName:Le.ZodObject,...Be(n)});$t.lazycreate=(e,n)=>new $t({shape:e,unknownKeys:"strip",catchall:Hr.create(),typeName:Le.ZodObject,...Be(n)});class Eu extends Ze{_parse(n){const{ctx:r}=this._processInputParams(n),i=this._def.options;function o(c){for(const h of c)if(h.result.status==="valid")return h.result;for(const h of c)if(h.result.status==="dirty")return r.common.issues.push(...h.ctx.common.issues),h.result;const d=c.map(h=>new rr(h.ctx.common.issues));return he(r,{code:te.invalid_union,unionErrors:d}),Ae}if(r.common.async)return Promise.all(i.map(async c=>{const d={...r,common:{...r.common,issues:[]},parent:null};return{result:await c._parseAsync({data:r.data,path:r.path,parent:d}),ctx:d}})).then(o);{let c;const d=[];for(const f of i){const g={...r,common:{...r.common,issues:[]},parent:null},p=f._parseSync({data:r.data,path:r.path,parent:g});if(p.status==="valid")return p;p.status==="dirty"&&!c&&(c={result:p,ctx:g}),g.common.issues.length&&d.push(g.common.issues)}if(c)return r.common.issues.push(...c.ctx.common.issues),c.result;const h=d.map(f=>new rr(f));return he(r,{code:te.invalid_union,unionErrors:h}),Ae}}get options(){return this._def.options}}Eu.create=(e,n)=>new Eu({options:e,typeName:Le.ZodUnion,...Be(n)});const Gs=e=>e instanceof Of?Gs(e.schema):e instanceof Da?Gs(e.innerType()):e instanceof Tu?[e.value]:e instanceof Fa?e.options:e instanceof Af?Xe.objectValues(e.enum):e instanceof $u?Gs(e._def.innerType):e instanceof qf?[void 0]:e instanceof $f?[null]:e instanceof nr?[void 0,...Gs(e.unwrap())]:e instanceof Ua?[null,...Gs(e.unwrap())]:e instanceof r0||e instanceof zu?Gs(e.unwrap()):e instanceof Iu?Gs(e._def.innerType):[];class mm extends Ze{_parse(n){const{ctx:r}=this._processInputParams(n);if(r.parsedType!==je.object)return he(r,{code:te.invalid_type,expected:je.object,received:r.parsedType}),Ae;const i=this.discriminator,o=r.data[i],c=this.optionsMap.get(o);return c?r.common.async?c._parseAsync({data:r.data,path:r.path,parent:r}):c._parseSync({data:r.data,path:r.path,parent:r}):(he(r,{code:te.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(n,r,i){const o=new Map;for(const c of r){const d=Gs(c.shape[n]);if(!d.length)throw new Error(`A discriminator value for key \`${n}\` could not be extracted from all schema options`);for(const h of d){if(o.has(h))throw new Error(`Discriminator property ${String(n)} has duplicate value ${String(h)}`);o.set(h,c)}}return new mm({typeName:Le.ZodDiscriminatedUnion,discriminator:n,options:r,optionsMap:o,...Be(i)})}}function zf(e,n){const r=qr(e),i=qr(n);if(e===n)return{valid:!0,data:e};if(r===je.object&&i===je.object){const o=Xe.objectKeys(n),c=Xe.objectKeys(e).filter(h=>o.indexOf(h)!==-1),d={...e,...n};for(const h of c){const f=zf(e[h],n[h]);if(!f.valid)return{valid:!1};d[h]=f.data}return{valid:!0,data:d}}else if(r===je.array&&i===je.array){if(e.length!==n.length)return{valid:!1};const o=[];for(let c=0;c<e.length;c++){const d=e[c],h=n[c],f=zf(d,h);if(!f.valid)return{valid:!1};o.push(f.data)}return{valid:!0,data:o}}else return r===je.date&&i===je.date&&+e==+n?{valid:!0,data:e}:{valid:!1}}class Ru extends Ze{_parse(n){const{status:r,ctx:i}=this._processInputParams(n),o=(c,d)=>{if(Wg(c)||Wg(d))return Ae;const h=zf(c.value,d.value);return h.valid?((Zg(c)||Zg(d))&&r.dirty(),{status:r.value,value:h.data}):(he(i,{code:te.invalid_intersection_types}),Ae)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([c,d])=>o(c,d)):o(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}Ru.create=(e,n,r)=>new Ru({left:e,right:n,typeName:Le.ZodIntersection,...Be(r)});class La extends Ze{_parse(n){const{status:r,ctx:i}=this._processInputParams(n);if(i.parsedType!==je.array)return he(i,{code:te.invalid_type,expected:je.array,received:i.parsedType}),Ae;if(i.data.length<this._def.items.length)return he(i,{code:te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ae;!this._def.rest&&i.data.length>this._def.items.length&&(he(i,{code:te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const c=[...i.data].map((d,h)=>{const f=this._def.items[h]||this._def.rest;return f?f._parse(new qs(i,d,i.path,h)):null}).filter(d=>!!d);return i.common.async?Promise.all(c).then(d=>yn.mergeArray(r,d)):yn.mergeArray(r,c)}get items(){return this._def.items}rest(n){return new La({...this._def,rest:n})}}La.create=(e,n)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new La({items:e,typeName:Le.ZodTuple,rest:null,...Be(n)})};class Mu extends Ze{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){const{status:r,ctx:i}=this._processInputParams(n);if(i.parsedType!==je.object)return he(i,{code:te.invalid_type,expected:je.object,received:i.parsedType}),Ae;const o=[],c=this._def.keyType,d=this._def.valueType;for(const h in i.data)o.push({key:c._parse(new qs(i,h,i.path,h)),value:d._parse(new qs(i,i.data[h],i.path,h)),alwaysSet:h in i.data});return i.common.async?yn.mergeObjectAsync(r,o):yn.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(n,r,i){return r instanceof Ze?new Mu({keyType:n,valueType:r,typeName:Le.ZodRecord,...Be(i)}):new Mu({keyType:Es.create(),valueType:n,typeName:Le.ZodRecord,...Be(r)})}}class ev extends Ze{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){const{status:r,ctx:i}=this._processInputParams(n);if(i.parsedType!==je.map)return he(i,{code:te.invalid_type,expected:je.map,received:i.parsedType}),Ae;const o=this._def.keyType,c=this._def.valueType,d=[...i.data.entries()].map(([h,f],g)=>({key:o._parse(new qs(i,h,i.path,[g,"key"])),value:c._parse(new qs(i,f,i.path,[g,"value"]))}));if(i.common.async){const h=new Map;return Promise.resolve().then(async()=>{for(const f of d){const g=await f.key,p=await f.value;if(g.status==="aborted"||p.status==="aborted")return Ae;(g.status==="dirty"||p.status==="dirty")&&r.dirty(),h.set(g.value,p.value)}return{status:r.value,value:h}})}else{const h=new Map;for(const f of d){const g=f.key,p=f.value;if(g.status==="aborted"||p.status==="aborted")return Ae;(g.status==="dirty"||p.status==="dirty")&&r.dirty(),h.set(g.value,p.value)}return{status:r.value,value:h}}}}ev.create=(e,n,r)=>new ev({valueType:n,keyType:e,typeName:Le.ZodMap,...Be(r)});class vo extends Ze{_parse(n){const{status:r,ctx:i}=this._processInputParams(n);if(i.parsedType!==je.set)return he(i,{code:te.invalid_type,expected:je.set,received:i.parsedType}),Ae;const o=this._def;o.minSize!==null&&i.data.size<o.minSize.value&&(he(i,{code:te.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&i.data.size>o.maxSize.value&&(he(i,{code:te.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());const c=this._def.valueType;function d(f){const g=new Set;for(const p of f){if(p.status==="aborted")return Ae;p.status==="dirty"&&r.dirty(),g.add(p.value)}return{status:r.value,value:g}}const h=[...i.data.values()].map((f,g)=>c._parse(new qs(i,f,i.path,g)));return i.common.async?Promise.all(h).then(f=>d(f)):d(h)}min(n,r){return new vo({...this._def,minSize:{value:n,message:_e.toString(r)}})}max(n,r){return new vo({...this._def,maxSize:{value:n,message:_e.toString(r)}})}size(n,r){return this.min(n,r).max(n,r)}nonempty(n){return this.min(1,n)}}vo.create=(e,n)=>new vo({valueType:e,minSize:null,maxSize:null,typeName:Le.ZodSet,...Be(n)});class Of extends Ze{get schema(){return this._def.getter()}_parse(n){const{ctx:r}=this._processInputParams(n);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Of.create=(e,n)=>new Of({getter:e,typeName:Le.ZodLazy,...Be(n)});class Tu extends Ze{_parse(n){if(n.data!==this._def.value){const r=this._getOrReturnCtx(n);return he(r,{received:r.data,code:te.invalid_literal,expected:this._def.value}),Ae}return{status:"valid",value:n.data}}get value(){return this._def.value}}Tu.create=(e,n)=>new Tu({value:e,typeName:Le.ZodLiteral,...Be(n)});function s0(e,n){return new Fa({values:e,typeName:Le.ZodEnum,...Be(n)})}class Fa extends Ze{_parse(n){if(typeof n.data!="string"){const r=this._getOrReturnCtx(n),i=this._def.values;return he(r,{expected:Xe.joinValues(i),received:r.parsedType,code:te.invalid_type}),Ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(n.data)){const r=this._getOrReturnCtx(n),i=this._def.values;return he(r,{received:r.data,code:te.invalid_enum_value,options:i}),Ae}return ns(n.data)}get options(){return this._def.values}get enum(){const n={};for(const r of this._def.values)n[r]=r;return n}get Values(){const n={};for(const r of this._def.values)n[r]=r;return n}get Enum(){const n={};for(const r of this._def.values)n[r]=r;return n}extract(n,r=this._def){return Fa.create(n,{...this._def,...r})}exclude(n,r=this._def){return Fa.create(this.options.filter(i=>!n.includes(i)),{...this._def,...r})}}Fa.create=s0;class Af extends Ze{_parse(n){const r=Xe.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(n);if(i.parsedType!==je.string&&i.parsedType!==je.number){const o=Xe.objectValues(r);return he(i,{expected:Xe.joinValues(o),received:i.parsedType,code:te.invalid_type}),Ae}if(this._cache||(this._cache=new Set(Xe.getValidEnumValues(this._def.values))),!this._cache.has(n.data)){const o=Xe.objectValues(r);return he(i,{received:i.data,code:te.invalid_enum_value,options:o}),Ae}return ns(n.data)}get enum(){return this._def.values}}Af.create=(e,n)=>new Af({values:e,typeName:Le.ZodNativeEnum,...Be(n)});class qu extends Ze{unwrap(){return this._def.type}_parse(n){const{ctx:r}=this._processInputParams(n);if(r.parsedType!==je.promise&&r.common.async===!1)return he(r,{code:te.invalid_type,expected:je.promise,received:r.parsedType}),Ae;const i=r.parsedType===je.promise?r.data:Promise.resolve(r.data);return ns(i.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}}qu.create=(e,n)=>new qu({type:e,typeName:Le.ZodPromise,...Be(n)});class Da extends Ze{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Le.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(n){const{status:r,ctx:i}=this._processInputParams(n),o=this._def.effect||null,c={addIssue:d=>{he(i,d),d.fatal?r.abort():r.dirty()},get path(){return i.path}};if(c.addIssue=c.addIssue.bind(c),o.type==="preprocess"){const d=o.transform(i.data,c);if(i.common.async)return Promise.resolve(d).then(async h=>{if(r.value==="aborted")return Ae;const f=await this._def.schema._parseAsync({data:h,path:i.path,parent:i});return f.status==="aborted"?Ae:f.status==="dirty"||r.value==="dirty"?uo(f.value):f});{if(r.value==="aborted")return Ae;const h=this._def.schema._parseSync({data:d,path:i.path,parent:i});return h.status==="aborted"?Ae:h.status==="dirty"||r.value==="dirty"?uo(h.value):h}}if(o.type==="refinement"){const d=h=>{const f=o.refinement(h,c);if(i.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(i.common.async===!1){const h=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return h.status==="aborted"?Ae:(h.status==="dirty"&&r.dirty(),d(h.value),{status:r.value,value:h.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(h=>h.status==="aborted"?Ae:(h.status==="dirty"&&r.dirty(),d(h.value).then(()=>({status:r.value,value:h.value}))))}if(o.type==="transform")if(i.common.async===!1){const d=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Wi(d))return Ae;const h=o.transform(d.value,c);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:h}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(d=>Wi(d)?Promise.resolve(o.transform(d.value,c)).then(h=>({status:r.value,value:h})):Ae);Xe.assertNever(o)}}Da.create=(e,n,r)=>new Da({schema:e,typeName:Le.ZodEffects,effect:n,...Be(r)});Da.createWithPreprocess=(e,n,r)=>new Da({schema:n,effect:{type:"preprocess",transform:e},typeName:Le.ZodEffects,...Be(r)});class nr extends Ze{_parse(n){return this._getType(n)===je.undefined?ns(void 0):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}nr.create=(e,n)=>new nr({innerType:e,typeName:Le.ZodOptional,...Be(n)});class Ua extends Ze{_parse(n){return this._getType(n)===je.null?ns(null):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}Ua.create=(e,n)=>new Ua({innerType:e,typeName:Le.ZodNullable,...Be(n)});class $u extends Ze{_parse(n){const{ctx:r}=this._processInputParams(n);let i=r.data;return r.parsedType===je.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}$u.create=(e,n)=>new $u({innerType:e,typeName:Le.ZodDefault,defaultValue:typeof n.default=="function"?n.default:()=>n.default,...Be(n)});class Iu extends Ze{_parse(n){const{ctx:r}=this._processInputParams(n),i={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return _u(o)?o.then(c=>({status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new rr(i.common.issues)},input:i.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new rr(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}Iu.create=(e,n)=>new Iu({innerType:e,typeName:Le.ZodCatch,catchValue:typeof n.catch=="function"?n.catch:()=>n.catch,...Be(n)});class tv extends Ze{_parse(n){if(this._getType(n)!==je.nan){const i=this._getOrReturnCtx(n);return he(i,{code:te.invalid_type,expected:je.nan,received:i.parsedType}),Ae}return{status:"valid",value:n.data}}}tv.create=e=>new tv({typeName:Le.ZodNaN,...Be(e)});class r0 extends Ze{_parse(n){const{ctx:r}=this._processInputParams(n),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}}class pm extends Ze{_parse(n){const{status:r,ctx:i}=this._processInputParams(n);if(i.common.async)return(async()=>{const c=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return c.status==="aborted"?Ae:c.status==="dirty"?(r.dirty(),uo(c.value)):this._def.out._parseAsync({data:c.value,path:i.path,parent:i})})();{const o=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?Ae:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:i.path,parent:i})}}static create(n,r){return new pm({in:n,out:r,typeName:Le.ZodPipeline})}}class zu extends Ze{_parse(n){const r=this._def.innerType._parse(n),i=o=>(Wi(o)&&(o.value=Object.freeze(o.value)),o);return _u(r)?r.then(o=>i(o)):i(r)}unwrap(){return this._def.innerType}}zu.create=(e,n)=>new zu({innerType:e,typeName:Le.ZodReadonly,...Be(n)});var Le;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Le||(Le={}));const oe=Es.create,It=Oa.create;Aa.create;const $s=Pu.create;Zi.create;const nv=If.create;Hr.create;const Ka=Ms.create,Re=$t.create,a0=Eu.create,Xu=mm.create;Ru.create;La.create;const i0=Mu.create,Pn=Tu.create,ss=Fa.create;qu.create;nr.create;Ua.create;const ar={string:(e=>Es.create({...e,coerce:!0})),number:(e=>Oa.create({...e,coerce:!0})),boolean:(e=>Pu.create({...e,coerce:!0})),bigint:(e=>Aa.create({...e,coerce:!0})),date:(e=>Zi.create({...e,coerce:!0}))},xm=["alerts","users","folders","flows","audit","sso","mcp"],l0={monthlyUsd:39,yearlyUsd:390},o0=oe().trim().min(8).max(512);Re({key:o0,instance:Re({label:oe().trim().min(1).max(120),version:oe().max(40).optional()})});Re({key:o0,activationId:oe().trim().min(1).max(120)});const Ou=["admin","operator","viewer"],gk="anonymous";function vk(e){return(e==null?void 0:e.id)===gk}const c0=ss(Ou),yk=Re({email:oe().email(),name:oe().min(1).max(80),password:oe().min(8).max(200)}),jk=Re({email:oe().email(),password:oe().min(1)}),bk=Re({email:oe().email(),name:oe().min(1).max(80),role:c0,password:oe().min(8).max(200).optional()});Re({name:oe().min(1).max(80).optional(),role:c0.optional(),password:oe().min(8).max(200).optional(),disabled:$s().optional()});const u0=Re({issuer:oe().url(),clientId:oe().min(1).max(255),clientSecret:oe().min(1).max(500).optional(),scopes:Ka(oe().min(1).max(60)).max(20).optional(),emailClaim:oe().min(1).max(60).optional()}),d0=Re({entryPoint:oe().url(),issuer:oe().min(1).max(255),idpCert:oe().min(1).max(1e4),emailAttribute:oe().min(1).max(200).optional()}),wk=Xu("kind",[Re({kind:Pn("oidc"),name:oe().min(1).max(60),enabled:$s().optional(),config:u0.extend({clientSecret:oe().min(1).max(500)})}),Re({kind:Pn("saml"),name:oe().min(1).max(60),enabled:$s().optional(),config:d0})]);Re({name:oe().min(1).max(60).optional(),enabled:$s().optional(),config:a0([u0.partial(),d0.partial()]).optional()});const h0=oe().trim().toLowerCase().transform(e=>e.replace(/^@/,"")).pipe(oe().regex(/^(?=.{3,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/,"Enter a domain like example.com"));Re({requireSso:$s().optional(),autoProvision:$s().optional(),autoProvisionDomains:Ka(h0).max(50).optional()});const f0=["redis","postgres"],xu={redis:"bull",postgres:"bullmq"},sv={redis:{test:/^rediss?:\/\//,message:"Must start with redis:// or rediss://"},postgres:{test:/^postgres(ql)?:\/\//,message:"Must start with postgres:// or postgresql://"}},Nk=/^[A-Za-z_][A-Za-z0-9_]{0,62}$/;function m0(e){const n=[],r=e.kind??"redis";return e.url!==void 0&&!sv[r].test.test(e.url)&&n.push({path:"url",message:sv[r].message}),r==="postgres"&&(e.prefix!==void 0&&!Nk.test(e.prefix)&&n.push({path:"prefix",message:"A Postgres schema: letters, digits and _, not starting with a digit"}),e.cluster===!0&&n.push({path:"cluster",message:"Cluster mode is Redis only"})),n}const p0=Re({name:oe().min(1).max(80),kind:ss(f0).default("redis"),url:oe().min(1),prefix:oe().min(1).max(64).optional(),cluster:$s().default(!1),queueFilter:oe().max(200).nullable().optional()}),kk=p0.superRefine((e,n)=>{for(const r of m0(e))n.addIssue({code:te.custom,path:[r.path],message:r.message})}).transform(e=>({...e,prefix:e.prefix??xu[e.kind]}));p0.omit({kind:!0}).partial();Re({ids:Ka(oe().min(1)).min(1)});Re({kind:ss(f0).default("redis"),url:oe().min(1),prefix:oe().optional(),cluster:$s().optional()}).superRefine((e,n)=>{for(const r of m0(e))n.addIssue({code:te.custom,path:[r.path],message:r.message})});const yo=["waiting","active","completed","failed","delayed","prioritized","paused","waiting-children"],x0=ss(yo),Sk=1e3,Ck=["waiting","limited","maxed","paused"];Re({page:ar.number().int().min(1).default(1),pageSize:ar.number().int().min(1).max(200).default(25)});Re({q:oe().max(200).optional(),withinMs:ar.number().int().min(0).optional(),limit:ar.number().int().min(1).max(1e3).default(500)});const _k=Re({name:oe().min(1).max(200).default("__default__"),data:nv().default({}),opts:i0(nv()).default({})}),g0=Re({state:ss(["completed","failed","delayed","wait","active","paused","prioritized"]),grace:It().int().min(0).default(0),limit:It().int().min(1).max(1e5).default(1e3)});Re({reason:oe().trim().max(500).optional()});const Au=500,Pk=["run_copy","skip_next"];Re({scheduler:ss(Pk).default("run_copy")});Re({jobIds:Ka(oe().min(1).max(200)).min(1,"jobIds must not be empty").max(Au,`at most ${Au} job ids per call`)});Re({query:oe().max(500).optional(),groupId:oe().min(1).max(200).optional(),cursor:oe().max(20).optional()}).refine(e=>{var n;return!!((n=e.query)!=null&&n.trim())||e.groupId!==void 0},{message:"query or groupId is required",path:["query"]});Re({state:x0.default("waiting"),groupId:oe().min(1).max(200).optional(),page:ar.number().int().min(1).default(1),pageSize:ar.number().int().min(1).max(200).default(25),order:ss(["asc","desc"]).default("desc")});Re({state:x0.default("failed"),q:oe().max(500).default(""),groupId:oe().min(1).max(200).optional(),cursor:oe().optional(),limit:ar.number().int().min(1).max(200).default(50)}).refine(e=>e.q.length>0||e.groupId!==void 0,{message:"q or groupId is required",path:["q"]});Re({queueName:oe().min(1).max(255)});const v0=Re({name:oe().min(1).max(80),color:oe().max(20).nullable().optional(),parentId:oe().nullable().optional()}),Ek=v0.partial().extend({position:It().int().min(0).optional()});Re({queues:Ka(Re({connectionId:oe(),queueName:oe()}))});const Rk=Re({waitingAbove:It().int().min(0).max(1e7).default(0),failedAbove:It().int().min(0).max(1e7).default(0)}),Lu={waitingAbove:0,failedAbove:0},Mk=100,Tk=["waiting_above","failed_above","failed_rate_above","duration_above"],qk=["failed_above","failed_rate_above"];function $k(e){return qk.includes(e)}const Ik=Xu("kind",[Re({kind:Pn("waiting_above"),threshold:It().int().min(1)}),Re({kind:Pn("failed_above"),threshold:It().int().min(1),windowMinutes:It().int().min(1).max(1440).default(5)}),Re({kind:Pn("failed_rate_above"),percent:It().min(.1).max(100),windowMinutes:It().int().min(1).max(1440).default(5),minSample:It().int().min(1).default(20)}),Re({kind:Pn("duration_above"),seconds:It().min(.001).max(86400),percentile:a0([Pn(50),Pn(95)]).default(95),windowMinutes:It().int().min(1).max(1440).default(15),minSample:It().int().min(1).max(Mk).default(5)})]),zk=Xu("type",[Re({type:Pn("queue"),connectionId:oe().min(1),queueName:oe().min(1)}),Re({type:Pn("folder"),folderId:oe().min(1)}),Re({type:Pn("connection"),connectionId:oe().min(1)}),Re({type:Pn("global")})]),Ok=Xu("type",[Re({type:Pn("slack"),webhookUrl:oe().url()}),Re({type:Pn("webhook"),url:oe().url(),headers:i0(oe()).optional()})]),y0=Re({name:oe().min(1).max(120),enabled:$s().default(!0),scope:zk,condition:Ik,channels:Ka(Ok).default([]),cooldownMinutes:It().int().min(1).max(1440).default(30)});y0.partial();const gm=["job.add","job.retry","job.remove","job.promote","job.discard","job.bulk_retry","job.bulk_remove","job.bulk_promote","queue.pause","queue.resume","queue.clean","queue.retry_all","queue.drain","queue.obliterate","scheduler.remove","job.promote_matching","group.pause","group.resume","group.drain","queue.hide","queue.unhide","connection.create","connection.update","connection.delete","user.create","user.update","user.delete","user.disable","user.enable","alert.create","alert.update","alert.delete","license.set","license.remove","sso.provider_create","sso.provider_update","sso.provider_delete","attention.thresholds_update","auth.login","auth.login_failed","auth.logout","auth.sso_login","auth.sso_denied","auth.sso_provisioned","mcp.settings_update","mcp.authorize","mcp.revoke"],vm={"job.add":"added a job","job.retry":"retried a job","job.remove":"removed a job","job.promote":"promoted a job","job.discard":"discarded a job","job.bulk_retry":"retried jobs in bulk","job.bulk_remove":"removed jobs in bulk","job.bulk_promote":"promoted jobs in bulk","queue.pause":"paused the queue","queue.resume":"resumed the queue","queue.clean":"cleaned the queue","queue.retry_all":"retried every job in a state","queue.drain":"drained the queue","queue.obliterate":"obliterated the queue","scheduler.remove":"removed a job scheduler","job.promote_matching":"promoted every matching delayed job","group.pause":"paused a group","group.resume":"resumed a group","group.drain":"drained a group","queue.hide":"hid the queue","queue.unhide":"unhid the queue","connection.create":"added a connection","connection.update":"edited a connection","connection.delete":"deleted a connection","user.create":"invited a user","user.update":"edited a user","user.delete":"deleted a user","user.disable":"disabled a user","user.enable":"re-enabled a user","alert.create":"created an alert","alert.update":"edited an alert","alert.delete":"deleted an alert","license.set":"applied a license key","license.remove":"removed the license key","sso.provider_create":"added an SSO provider","sso.provider_update":"edited an SSO provider","sso.provider_delete":"deleted an SSO provider","attention.thresholds_update":"changed the attention thresholds","auth.login":"signed in","auth.login_failed":"failed to sign in","auth.logout":"signed out","auth.sso_login":"signed in with SSO","auth.sso_denied":"was refused by SSO (no account)","auth.sso_provisioned":"joined through SSO (auto-provisioned)","mcp.settings_update":"changed the MCP access level","mcp.authorize":"connected an MCP client","mcp.revoke":"disconnected an MCP client"},Ak=["queue.obliterate","queue.drain","queue.clean","job.remove","job.bulk_remove","connection.delete","user.create","user.update","user.delete","license.set","license.remove","auth.login_failed","sso.provider_create","sso.provider_update","sso.provider_delete","auth.sso_provisioned","mcp.settings_update","mcp.authorize"],Lk=ss(gm);Re({limit:ar.number().int().min(1).max(200).default(50),cursor:oe().max(200).optional(),actorId:oe().max(36).optional(),action:Lk.optional(),connectionId:oe().max(36).optional(),queueName:oe().max(255).optional(),jobId:oe().max(255).optional(),result:ss(["ok","error"]).optional(),from:oe().datetime({offset:!0}).optional(),to:oe().datetime({offset:!0}).optional()});Re({connectionId:oe(),from:oe().min(1),to:oe().min(1),label:oe().max(120).nullable().optional()});function e5(e){return`${e.connectionId}:${e.queueName}`}const Lf=Re({connectionId:oe().min(1).max(64),queueName:oe().min(1).max(255)}),t5=Re({name:oe().trim().min(1).max(80),description:oe().max(500).nullable().optional(),parentId:oe().nullable().optional()});Re({name:oe().trim().min(1).max(80).optional(),description:oe().max(500).nullable().optional(),parentId:oe().nullable().optional(),position:It().int().min(0).optional()});Lf.extend({x:It().finite().nullable().optional(),y:It().finite().nullable().optional()});Re({positions:Ka(Re({nodeId:oe().min(1).max(320),x:It().finite(),y:It().finite()})).max(2e3)});Re({from:Lf,to:Lf,label:oe().max(120).nullable().optional()});Re({label:oe().max(120).nullable()});Re({maxNodes:ar.number().int().min(1).max(500).default(200),fromRoot:ss(["true","false"]).default("true").transform(e=>e==="true")});const rv={admin:3,operator:2,viewer:1};function av(e,n){return rv[e]>=rv[n]}const Fk=["off","read","write"];Re({maxAccess:ss(Fk)});Re({request:oe().min(1).max(4096),approve:$s(),access:ss(["read","write"]).default("read")});let Gi={open:!1,feature:"alerts"};const Ff=new Set;function j0(e){Gi=e,Ff.forEach(n=>n())}function jo(e){j0({open:!0,feature:e??Gi.feature})}function Jh(){Gi.open&&j0({...Gi,open:!1})}function Dk(){return w.useSyncExternalStore(e=>(Ff.add(e),()=>Ff.delete(e)),()=>Gi,()=>Gi)}let $a=[],Uk=0;const Df=new Set;function b0(){Df.forEach(e=>e())}function Qk(e){return Df.add(e),()=>Df.delete(e)}function Pi(e,n,r={}){const i=$a.find(c=>c.message===n&&c.kind===e);if(i)return i.id;const o=++Uk;return $a=[...$a,{id:o,kind:e,message:n,description:r.description,durationMs:r.durationMs??(r.action?8e3:e==="error"?6e3:3500),action:r.action}],b0(),o}function Xh(e){$a=$a.filter(n=>n.id!==e),b0()}const X=Object.assign((e,n)=>Pi((n==null?void 0:n.kind)??"info",e,n),{info:(e,n)=>Pi("info",e,{description:n}),success:(e,n)=>Pi("success",e,{description:n}),error:(e,n)=>Pi("error",e,{description:n}),warning:(e,n)=>Pi("warning",e,{description:n}),undoable:(e,n,r)=>Pi("success",e,{description:r,action:n})}),Bk={info:Ha,success:cm,error:Fy,warning:ts},Vk={info:"text-info",success:"text-success",error:"text-danger",warning:"text-warning"};function Hk({item:e}){w.useEffect(()=>{const r=setTimeout(()=>Xh(e.id),e.durationMs);return()=>clearTimeout(r)},[e.id,e.durationMs]);const n=Bk[e.kind];return t.jsxs("div",{role:e.kind==="error"?"alert":"status",className:"toast-in pointer-events-auto flex w-80 items-start gap-2.5 rounded-lg border border-border bg-surface px-3 py-2.5 text-[13px] shadow-[var(--shadow)]",children:[t.jsx(n,{className:F("mt-px size-4 shrink-0",Vk[e.kind]),"aria-hidden":!0}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-fg",children:e.message}),e.description&&t.jsx("p",{className:"mt-0.5 text-xs break-words text-fg-muted",children:e.description}),e.action&&t.jsx("button",{type:"button",className:"mt-1.5 rounded text-xs font-medium text-accent hover:underline",onClick:()=>{var r;(r=e.action)==null||r.onClick(),Xh(e.id)},children:e.action.label})]}),t.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>Xh(e.id),className:"-mr-1 rounded p-0.5 text-fg-subtle hover:text-fg",children:t.jsx(vn,{className:"size-3.5"})})]})}function Kk(){const e=w.useSyncExternalStore(Qk,()=>$a,()=>$a);return e.length===0?null:t.jsx("div",{className:"pointer-events-none fixed right-4 bottom-4 z-[100] flex flex-col items-end gap-2","aria-live":"polite",children:e.map(n=>t.jsx(Hk,{item:n},n.id))})}const w0=w.createContext(null);function Wk({children:e}){const[n,r]=w.useState(null),[i,o]=w.useState(null),[c,d]=w.useState(!1),[h,f]=w.useState(!0),[g,p]=w.useState(!0),v=un(),j=Ln(),S=Ke(),y=w.useRef(j);y.current=j;const b=w.useRef(h);b.current=h;const k=w.useCallback(async()=>{const[I,Q]=await Promise.allSettled([ee.get("/setup/status",{silent:!0}),ee.get("/edition",{silent:!0})]);I.status==="fulfilled"&&(d(!!I.value.needsSetup),f(I.value.authRequired!==!1)),Q.status==="fulfilled"&&o(Q.value)},[]),C=w.useCallback(async()=>{try{const I=await ee.get("/auth/me",{silent:!0});r(I.user),o(I.edition),d(!1),f(I.edition.features.users)}catch(I){r(null),Ts(I)&&I.status===401?await k():Ts(I)&&I.status===0&&X.error("Could not reach the server")}finally{p(!1)}},[k]),z=w.useRef(C);z.current=C,w.useEffect(()=>{C()},[C]),w.useEffect(()=>{QN({onUnauthenticated:()=>{if(!b.current){z.current();return}r(null),S.clear();const I=y.current.pathname;!I.startsWith("/login")&&!I.startsWith("/setup")&&v("/login",{replace:!0,state:{from:y.current}})},onProRequired:I=>jo(I),onDemoLocked:()=>X.warning("This action is locked in the demo")})},[v,S]);const O=w.useCallback(async I=>{const Q=await ee.post("/auth/login",I,{silent:[401]});return r(Q.user),o(Q.edition),d(!1),S.clear(),Q},[S]),T=w.useCallback(async I=>{const Q=await ee.post("/setup",I);return r(Q.user),o(Q.edition),d(!1),Q},[]),M=w.useCallback(async()=>{try{await ee.post("/auth/logout",{},{silent:!0})}finally{r(null),S.clear(),v("/login",{replace:!0})}},[v,S]),E=w.useMemo(()=>({user:n,edition:i,loading:g,needsSetup:c,authRequired:h,isAnonymous:vk(n),refresh:C,login:O,setup:T,logout:M,setEdition:o,can:I=>n?av(n.role,I):!1,isAdmin:(n==null?void 0:n.role)==="admin",isOperator:n?av(n.role,"operator"):!1}),[n,i,g,c,h,C,O,T,M]);return t.jsx(w0.Provider,{value:E,children:e})}function mt(){const e=w.useContext(w0);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}function cn({icon:e,title:n,description:r,action:i,className:o,compact:c}){return t.jsxs("div",{className:F("flex flex-col items-center justify-center text-center",c?"gap-2 px-4 py-8":"gap-3 px-6 py-16",o),children:[e&&t.jsx("div",{className:"flex size-10 items-center justify-center rounded-lg border border-border bg-surface-2 text-fg-subtle [&_svg]:size-5",children:e}),t.jsxs("div",{className:"max-w-sm",children:[t.jsx("h3",{className:"text-sm font-semibold text-fg",children:n}),r&&t.jsx("p",{className:"mt-1 text-xs leading-relaxed text-fg-muted",children:r})]}),i&&t.jsx("div",{className:"mt-1 flex items-center gap-2",children:i})]})}function Zk(){const{user:e,loading:n,needsSetup:r}=mt(),i=Ln();return n?t.jsx(k0,{}):e?t.jsx(fy,{}):r?t.jsx(Vr,{to:"/setup",replace:!0}):t.jsx(Vr,{to:"/login",replace:!0,state:{from:i}})}function iv({children:e}){const{user:n,loading:r,authRequired:i}=mt();return r?t.jsx(k0,{}):n||!i?t.jsx(Vr,{to:"/",replace:!0}):t.jsx(t.Fragment,{children:e})}function N0({role:e,children:n}){const{can:r}=mt();return r(e)?t.jsx(t.Fragment,{children:n}):t.jsx(cn,{icon:t.jsx(hm,{}),title:`${e==="admin"?"Admins":"Operators"} only`,description:"Your role does not allow this page. Ask an admin to change your role if you need access."})}function k0(){return t.jsx("div",{className:"flex h-full min-h-screen w-full items-center justify-center bg-bg",children:t.jsx(il,{})})}const Gk={primary:"bg-accent text-accent-fg hover:bg-accent-hover border border-transparent",secondary:"bg-surface-2 text-fg border border-border hover:bg-surface-3 hover:border-border-strong",outline:"bg-transparent text-fg border border-border-strong hover:bg-surface-2",ghost:"bg-transparent text-fg-muted border border-transparent hover:text-fg hover:bg-surface-2",danger:"bg-danger/90 text-white border border-transparent hover:bg-danger",link:"bg-transparent text-accent border border-transparent hover:underline px-0 h-auto"},Jk={xs:"h-6 px-2 text-[11px] gap-1 [&_svg]:size-3",sm:"h-7 px-2.5 text-xs gap-1.5 [&_svg]:size-3.5",md:"h-8 px-3 text-[13px] gap-1.5 [&_svg]:size-4",icon:"h-8 w-8 [&_svg]:size-4","icon-sm":"h-7 w-7 [&_svg]:size-3.5","icon-xs":"h-6 w-6 [&_svg]:size-3"},V=w.forwardRef(function({variant:n="secondary",size:r="md",loading:i,leftIcon:o,rightIcon:c,className:d,children:h,disabled:f,type:g="button",...p},v){return t.jsxs("button",{ref:v,type:g,disabled:f||i,className:F("inline-flex shrink-0 select-none items-center justify-center rounded-md font-medium whitespace-nowrap transition-colors outline-none","focus-visible:ring-2 focus-visible:ring-accent/60 disabled:pointer-events-none disabled:opacity-50",Gk[n],Jk[r],d),...p,children:[i?t.jsx(Vy,{className:"animate-spin","aria-hidden":!0}):o,h,!i&&c]})}),Xk={sm:"26rem",md:"32rem",lg:"44rem",xl:"60rem"};function bn({open:e,onClose:n,title:r,description:i,children:o,footer:c,size:d="md",hideClose:h,className:f,bodyClassName:g}){const p=w.useRef(null),v=w.useId(),j=w.useId();w.useEffect(()=>{const y=p.current;y&&(e&&!y.open?y.showModal():!e&&y.open&&y.close())},[e]);const S=y=>{y.target===p.current&&n()};return t.jsx("dialog",{ref:p,className:F("dialog",f),style:{"--dialog-w":Xk[d]},"aria-labelledby":r?v:void 0,"aria-describedby":i?j:void 0,onClose:()=>{e&&n()},onCancel:y=>{y.preventDefault(),n()},onClick:S,children:e&&t.jsxs("div",{className:"flex max-h-[90vh] flex-col",onClick:y=>y.stopPropagation(),children:[(r||!h)&&t.jsxs("header",{className:"flex items-start gap-3 border-b border-border px-5 py-3.5",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[r&&t.jsx("h2",{id:v,className:"text-sm font-semibold text-fg",children:r}),i&&t.jsx("p",{id:j,className:"mt-0.5 text-xs text-fg-muted",children:i})]}),!h&&t.jsx(V,{variant:"ghost",size:"icon-sm","aria-label":"Close",onClick:n,className:"-mr-1.5 -mt-0.5",children:t.jsx(vn,{})})]}),t.jsx("div",{className:F("min-h-0 flex-1 overflow-y-auto px-5 py-4",g),children:o}),c&&t.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-border bg-surface-2/50 px-5 py-3",children:c})]})})}const bo={alerts:{title:"Alerts",tagline:"Know before your users do. Slack or webhook, evaluated server-side every few seconds.",bullets:["Waiting above N, failures in a window, failure-rate %, connection down","Scope to one queue, a whole connection, or everything","Cooldown per alert and an events feed with delivery status"]},users:{title:"Users & roles",tagline:"Give the whole team a login without giving everyone the obliterate button.",bullets:["Admin, operator and viewer roles enforced on every endpoint","Invite by email with a temporary password","Last-login audit and safe deletion guards"]},folders:{title:"Folders",tagline:"Organise hundreds of queues across connections the way your teams think about them.",bullets:["Nested folders with colours, shown in the sidebar","Assign queues from any connection with a picker","The default stays one folder per connection, so nothing breaks"]},audit:{title:"Audit log",tagline:"Who paused the payments queue, when, from which IP — persisted, filterable, exportable.",bullets:["Every mutating action recorded: jobs, queues, connections, users, license, logins","Failed attempts included, so a refused obliterate is a finding and not silence","CSV export for compliance, one-year retention, and never the job payload"]},flows:{title:"Flows",tagline:"Named maps of the queues each process goes through, with live counts, drawn by you or by your AI client.",bullets:["Flow maps across connections: one Redis to another, Redis to Postgres","Maps detected from BullMQ FlowProducer parents, with evidence counts","Draw arrows by hand or over MCP; the map updates live while it is drawn"]},sso:{title:"SSO",tagline:"Your identity provider decides who is who. Configured in this UI, not in a YAML file.",bullets:["OIDC (Google Workspace, Entra ID, Okta, Keycloak, Authentik) and SAML 2.0","Accounts stay pre-provisioned: the IdP proves identity, you still assign the role","Require SSO for the team while admins keep a password way in"]},mcp:{title:"MCP",tagline:"Ask your AI why the payments queue is failing, and let it retry the jobs — as you, with your role.",bullets:["Claude or any MCP client with OAuth; sign in with your Bullpane login or SSO","Read or read & write: the admin sets the ceiling, a viewer can never write","Every action lands in the audit log; drain and obliterate stay in the dashboard"]}},Yk={tier:"free",demo:!1,features:Object.fromEntries(xm.map(e=>[e,!1])),license:null,pricing:l0,checkoutUrl:""};function wt(){const{edition:e}=mt(),n=e??Yk,r=w.useCallback(o=>{var c;return!!((c=n.features)!=null&&c[o])},[n]),i=w.useCallback((o,c)=>r(o)?(c==null||c(),!0):(jo(o),!1),[r]);return w.useMemo(()=>({edition:n,tier:n.tier,isPro:n.tier==="pro",demo:!!n.demo,pricing:n.pricing??l0,checkoutUrl:n.checkoutUrl??"",has:r,gate:i}),[n,r,i])}function e2(){const{open:e,feature:n}=Dk(),{pricing:r,checkoutUrl:i,demo:o}=wt(),c=bo[n];return t.jsxs(bn,{open:e,onClose:Jh,size:"md",title:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ON,{className:"size-4 text-pro","aria-hidden":!0}),c.title," is a Pro feature"]}),description:c.tagline,footer:t.jsxs(t.Fragment,{children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:Jh,children:"Not now"}),t.jsxs(Ee,{to:"/settings/license",onClick:Jh,className:"inline-flex h-7 items-center gap-1.5 rounded-md border border-border-strong px-2.5 text-xs font-medium text-fg hover:bg-surface-2",children:[t.jsx(al,{className:"size-3.5","aria-hidden":!0}),"I have a key"]}),t.jsxs("a",{href:i||"#",target:"_blank",rel:"noreferrer noopener","aria-disabled":!i,className:"inline-flex h-7 items-center gap-1.5 rounded-md bg-accent px-3 text-xs font-medium text-accent-fg hover:bg-accent-hover aria-disabled:pointer-events-none aria-disabled:opacity-50",children:["Unlock Pro · $",r.monthlyUsd,"/mo or $",r.yearlyUsd,"/yr",t.jsx(Br,{className:"size-3.5","aria-hidden":!0})]})]}),children:[t.jsx("ul",{className:"space-y-2",children:c.bullets.map(d=>t.jsxs("li",{className:"flex items-start gap-2 text-[13px] text-fg",children:[t.jsx(Zr,{className:"mt-0.5 size-4 shrink-0 text-success","aria-hidden":!0}),t.jsx("span",{children:d})]},d))}),t.jsxs("div",{className:"mt-4 rounded-md border border-border bg-surface-2/60 p-3 text-xs text-fg-muted",children:[t.jsxs("p",{children:["One subscription unlocks every Pro feature — ",xm.map(d=>bo[d].title).join(", ")," — for this installation. $",r.monthlyUsd,"/month or $",r.yearlyUsd,"/year, unlimited users. Your data stays on your servers; only the key is verified with bullpane.com."]}),o&&t.jsx("p",{className:"mt-2 text-warning",children:"You are in demo mode: Pro is already unlocked here."})]})]})}function t2(e){if(!e)return!1;const n=e.tagName;return n==="INPUT"||n==="TEXTAREA"||n==="SELECT"?!0:e.isContentEditable}function S0(e,n,r={}){const{mod:i=!1,allowInInputs:o=!1,enabled:c=!0}=r;w.useEffect(()=>{if(!c)return;const d=h=>{if(h.key.toLowerCase()!==e.toLowerCase())return;const f=h.metaKey||h.ctrlKey;i===f&&(!i&&h.altKey||!o&&t2(document.activeElement)||!i&&document.querySelector("dialog[open]")||n(h))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,n,i,o,c])}const n2=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),C0=n2?"⌘":"Ctrl",ut=encodeURIComponent,ue={home:"/",login:"/login",setup:"/setup",connection:e=>`/c/${ut(e)}`,queue:(e,n,r)=>`/c/${ut(e)}/q/${ut(n)}${r?`?state=${r}`:""}`,queueSearch:(e,n,r)=>`/c/${ut(e)}/q/${ut(n)}?search=1${r?`&state=${r}`:""}`,queueGroup:(e,n,r,i)=>`/c/${ut(e)}/q/${ut(n)}?state=${i}&group=${ut(r)}`,job:(e,n,r)=>`/c/${ut(e)}/q/${ut(n)}/j/${ut(r)}`,jobTree:(e,n,r)=>`/c/${ut(e)}/q/${ut(n)}/j/${ut(r)}/tree`,groups:(e,n)=>`/c/${ut(e)}/q/${ut(n)}/groups`,group:(e,n,r)=>`/c/${ut(e)}/q/${ut(n)}/groups/${ut(r)}`,queueMetrics:(e,n)=>`/c/${ut(e)}/q/${ut(n)}/metrics`,queueSchedulers:(e,n)=>`/c/${ut(e)}/q/${ut(n)}/schedulers`,schedulers:e=>e?`/schedulers/${ut(e)}`:"/schedulers",health:"/health",folders:"/folders",folder:e=>`/folders/${ut(e)}`,alerts:"/alerts",users:"/users",audit:e=>{if(!e)return"/audit";const n=new URLSearchParams;for(const[i,o]of Object.entries(e))o&&n.set(i,o);const r=n.toString();return r?`/audit?${r}`:"/audit"},flows:e=>e?`/flows/${ut(e)}`:"/flows",flowMap:e=>`/flows?map=${ut(e)}`,settings:(e="connections")=>`/settings/${e}`};function lv(e,n){const r=e.indexOf(":");return r>=0?e.slice(r+1):e}function wo(e){return((e==null?void 0:e.failed)??0)>0?"failed":((e==null?void 0:e.waiting)??0)>0?"waiting":((e==null?void 0:e.prioritized)??0)>0?"prioritized":"completed"}const _0=new Intl.NumberFormat("en-US"),P0=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1});function K(e){return e==null||Number.isNaN(e)?"–":_0.format(e)}function ft(e){return e==null||Number.isNaN(e)?"–":Math.abs(e)<1e4?_0.format(e):P0.format(e)}function En(e,n=1){return e==null||Number.isNaN(e)?"–":`${e.toFixed(n)}%`}function Xt(e){if(e==null||Number.isNaN(e))return"–";if(e<1024)return`${e} B`;const n=["KB","MB","GB","TB","PB"];let r=e/1024,i=0;for(;r>=1024&&i<n.length-1;)r/=1024,i++;return`${r.toFixed(r>=100?0:r>=10?1:2)} ${n[i]}`}function An(e){if(e==null||!Number.isFinite(e))return"–";if(e<0&&(e=0),e<1e3)return`${Math.round(e)}ms`;const n=e/1e3;if(n<60)return`${n.toFixed(n<10?2:1)}s`;const r=Math.floor(n/60),i=Math.round(n%60);if(r<60)return`${r}m ${i}s`;const o=Math.floor(r/60),c=r%60;return o<24?`${o}h ${c}m`:`${Math.floor(o/24)}d ${o%24}h`}function No(e){return e==null?"–":An(e*1e3)}function Vo(e){if(e==null||e==="")return null;if(e instanceof Date)return e.getTime();if(typeof e=="number")return Number.isFinite(e)&&e>0?e:null;const n=Number(e);if(!Number.isNaN(n)&&n>0)return n;const r=Date.parse(e);return Number.isNaN(r)?null:r}function Kr(e,n=Date.now()){const r=Vo(e);if(r==null)return"–";const i=n-r,o=i<0,c=Math.abs(i),d=Math.round(c/1e3);let h;if(d<5)return"just now";if(d<60)h=`${d}s`;else if(d<3600)h=`${Math.floor(d/60)}m`;else if(d<86400)h=`${Math.floor(d/3600)}h`;else if(d<86400*30)h=`${Math.floor(d/86400)}d`;else return Fu(r);return o?`in ${h}`:`${h} ago`}function fo(e){return e<10?`0${e}`:String(e)}function Fu(e){const n=Vo(e);if(n==null)return"–";const r=new Date(n);return`${r.getFullYear()}-${fo(r.getMonth()+1)}-${fo(r.getDate())}`}function gn(e){const n=Vo(e);if(n==null)return"–";const r=new Date(n);return`${Fu(r)} ${fo(r.getHours())}:${fo(r.getMinutes())}:${fo(r.getSeconds())}`}function Uf(e){const n=Vo(e);if(n==null)return"–";const r=new Date(n);return`${gn(r)}.${String(r.getMilliseconds()).padStart(3,"0")}`}function Du(e,n=2){try{return typeof e=="string"?e:JSON.stringify(e,null,n)??String(e)}catch{return String(e)}}function s2(e){try{const n=JSON.parse(e);return JSON.stringify(n,null,2)}catch{return null}}function E0(e){return e==null||!Number.isFinite(e)?"–":e>=10?`${e.toFixed(1)} cores`:`${e.toFixed(2)} ${e===1?"core":"cores"}`}function Ji(e){if(e==null||!Number.isFinite(e))return"–";const n=e*100;return n>=10?`${Math.round(n)}%`:n>=1?`${n.toFixed(0)}%`:`${n.toFixed(n>=.1?1:2)}%`}function Wr(e,n="/s"){return e==null||!Number.isFinite(e)?"–":e>=1e4?`${P0.format(e)}${n}`:e>=100?`${Math.round(e)}${n}`:`${e.toFixed(e<10?2:1)}${n}`}function ko(e){return e==null||!Number.isFinite(e)?"–":e>=1e3?`${(e/1e3).toFixed(2)} s`:e>=10?`${Math.round(e)} ms`:`${e.toFixed(1)} ms`}function r2(e){return e==null||!Number.isFinite(e)?"–":`${e.toFixed(2)}×`}const Qf="bullpane.";function Yu(e,n,r=a2){try{const i=localStorage.getItem(Qf+e);if(i==null)return n;const o=r(i);return o===void 0?n:o}catch{return n}}function So(e,n){try{n==null?localStorage.removeItem(Qf+e):localStorage.setItem(Qf+e,typeof n=="string"?n:JSON.stringify(n))}catch{}}function a2(e){try{return JSON.parse(e)}catch{return e}}function ed(e,n){const[r,i]=w.useState(()=>Yu(e,n,i2)),o=w.useCallback(d=>{i(d),So(e,d?"1":"0")},[e]),c=w.useCallback(()=>{i(d=>(So(e,d?"0":"1"),!d))},[e]);return[r,c,o]}function i2(e){if(e==="1"||e==="true"||e==='"true"')return!0;if(e==="0"||e==="false"||e==='"false"')return!1}const zt=e=>()=>typeof document<"u"&&document.hidden?!1:e,Rt={queues:5e3,queue:3e3,job:5e3,connections:1e4,health:3e3,setup:1e4,flowMap:2e3,flowMaps:5e3},se={health:["health"],edition:["edition"],setupStatus:["setup-status"],me:["me"],connections:["connections"],connectionsHealth:["health","connections"],connectionHealth:e=>["health","connections",e],connection:e=>["connections",e],overview:e=>["connections",e,"overview"],queues:e=>["connections",e,"queues"],queue:(e,n)=>["connections",e,"queue",n],queueSetup:(e,n)=>["connections",e,"queue",n,"setup"],jobs:(e,n,r)=>["connections",e,"queue",n,"jobs",r],jobSearch:(e,n,r)=>["connections",e,"queue",n,"search",r],job:(e,n,r)=>["connections",e,"queue",n,"job",r],jobLogs:(e,n,r,i)=>["connections",e,"queue",n,"job",r,"logs",i],groups:(e,n,r)=>["connections",e,"queue",n,"groups",r],schedulers:(e,n,r)=>["connections",e,"queue",n,"schedulers",r],allSchedulers:(e,n)=>["connections",e,"schedulers",n],jobTree:(e,n,r,i)=>["connections",e,"queue",n,"job",r,"tree",i],groupJobs:(e,n,r,i)=>["connections",e,"queue",n,"groups",r,"jobs",i],flows:(e,n)=>["flows",e,n],flowMaps:["flow-maps"],flowMap:e=>["flow-maps",e],hiddenQueues:e=>["connections",e,"hidden-queues"],folders:["folders"],alerts:["alerts"],attention:["attention"],alertEvents:e=>["alerts","events",e],users:["users"],ssoProviders:["sso","providers"],ssoSettings:["sso","settings"],mcpSettings:["mcp","settings"],mcpGrants:e=>["mcp","grants",e],mcpConsent:e=>["mcp","consent",e],attentionThresholds:["settings","attention"],ssoLoginOptions:["sso","login-options"],audit:e=>["audit",e],auditActors:["audit","actors"]},Wt=(e,n)=>`/connections/${ze(e)}/queues/${ze(n)}`;function l2(){return Ye({queryKey:se.health,queryFn:()=>ee.get("/health"),staleTime:6e4})}function xs(){return Ye({queryKey:se.connections,queryFn:()=>ee.get("/connections"),refetchInterval:zt(Rt.connections)})}function o2(e){return Ye({queryKey:se.overview(e??""),queryFn:()=>ee.get(`/connections/${ze(e)}/overview`),enabled:!!e,refetchInterval:zt(Rt.queues),placeholderData:jn})}function c2(){const e=xs(),n=e.data??[],r=$y({queries:n.map(o=>({queryKey:se.overview(o.id),queryFn:()=>ee.get(`/connections/${ze(o.id)}/overview`),refetchInterval:zt(Rt.queues),placeholderData:jn}))}),i=n.map((o,c)=>({connection:o,result:r[c]}));return{connections:e,entries:i,isLoading:e.isLoading}}function u2(e,n={}){return Ye({queryKey:se.queues(e??""),queryFn:()=>ee.get(`/connections/${ze(e)}/queues`),enabled:!!e&&(n.enabled??!0),refetchInterval:zt(Rt.queues),placeholderData:jn})}function ll(){const e=xs(),n=e.data??[],r=$y({queries:n.map(o=>({queryKey:se.queues(o.id),queryFn:()=>ee.get(`/connections/${ze(o.id)}/queues`),refetchInterval:zt(Rt.queues),placeholderData:jn}))}),i=n.map((o,c)=>{var d,h,f;return{connection:o,queues:((d=r[c])==null?void 0:d.data)??[],isLoading:!!((h=r[c])!=null&&h.isLoading),error:(f=r[c])==null?void 0:f.error}});return{connections:n,byConnection:i,isLoading:e.isLoading,error:e.error}}function d2(e){const n=Ke();return Ve({mutationFn:()=>ee.get(`/connections/${ze(e)}/queues`,{query:{refresh:1}}),onSuccess:r=>{e&&n.setQueryData(se.queues(e),r),n.invalidateQueries({queryKey:se.connection(e)})}})}function R0(e,n){return Ye({queryKey:se.queue(e??"",n??""),queryFn:()=>ee.get(Wt(e,n)),enabled:!!e&&!!n,refetchInterval:zt(Rt.queue),placeholderData:jn})}function ym(e,n,r={}){return Ye({queryKey:se.queueSetup(e??"",n??""),queryFn:()=>ee.get(`${Wt(e,n)}/setup`),enabled:!!e&&!!n&&(r.enabled??!0),refetchInterval:zt(Rt.setup),placeholderData:jn})}function M0(e,n,r,i={}){return Ye({queryKey:se.jobs(e??"",n??"",r),queryFn:()=>ee.get(`${Wt(e,n)}/jobs`,{query:{...r}}),enabled:!!e&&!!n&&(i.enabled??!0),refetchInterval:zt(Rt.queue),placeholderData:jn})}function h2(e,n,r,i={}){return zy({queryKey:se.jobSearch(e??"",n??"",r),queryFn:({pageParam:o})=>ee.get(`${Wt(e,n)}/jobs/search`,{query:{state:r.state,q:r.q,groupId:r.groupId,limit:r.limit,cursor:o}}),initialPageParam:void 0,getNextPageParam:o=>o.nextCursor??void 0,enabled:!!e&&!!n&&(r.q.trim().length>0||!!r.groupId)&&(i.enabled??!0),staleTime:3e4})}function f2(e,n,r){return Ye({queryKey:se.job(e??"",n??"",r??""),queryFn:()=>ee.get(`${Wt(e,n)}/jobs/${ze(r)}`),enabled:!!e&&!!n&&!!r,refetchInterval:i=>{if(typeof document<"u"&&document.hidden)return!1;const o=i.state.data;return o&&o.finishedOn?!1:Rt.job}})}function m2(e,n,r,i={},o=!0){return Ye({queryKey:se.jobLogs(e??"",n??"",r??"",i),queryFn:()=>ee.get(`${Wt(e,n)}/jobs/${ze(r)}/logs`,{query:{start:i.start,end:i.end}}),enabled:o&&!!e&&!!n&&!!r,refetchInterval:zt(Rt.job)})}function jm(e,n){const r=Ke();return Ve({mutationFn:({jobId:i,action:o,scheduler:c})=>{const d=`${Wt(e,n)}/jobs/${ze(i)}`;return o==="remove"?ee.del(d):ee.post(`${d}/${o}`,o==="promote"&&c?{scheduler:c}:void 0)},onSuccess:()=>{r.invalidateQueries({queryKey:se.queue(e,n)}),r.invalidateQueries({queryKey:se.queues(e)}),r.invalidateQueries({queryKey:se.overview(e)})}})}function p2(e,n){const r=Ke();return Ve({mutationFn:({action:i,jobIds:o})=>ee.post(`${Wt(e,n)}/jobs/bulk/${i}`,{jobIds:o}),onSuccess:()=>{r.invalidateQueries({queryKey:se.queue(e,n)}),r.invalidateQueries({queryKey:se.queues(e)}),r.invalidateQueries({queryKey:se.overview(e)})}})}function x2(e,n){const r=Ke();return Ve({mutationFn:i=>ee.post(`${Wt(e,n)}/jobs`,i),onSuccess:()=>{r.invalidateQueries({queryKey:se.queue(e,n)}),r.invalidateQueries({queryKey:se.queues(e)})}})}function T0(e,n){const r=Ke();return Ve({mutationFn:i=>{const o=`${Wt(e,n)}/${i.action}`;return"body"in i?ee.post(o,i.body):ee.post(o)},onSuccess:()=>{r.invalidateQueries({queryKey:se.queue(e,n)}),r.invalidateQueries({queryKey:se.queues(e)}),r.invalidateQueries({queryKey:se.overview(e)})}})}function g2(e){const n=Ke();return Ve({mutationFn:({queue:r,action:i,reason:o})=>ee.post(`${Wt(e,r)}/${i}`,i==="pause"?{...o?{reason:o}:{}}:void 0),onSuccess:()=>{n.invalidateQueries({queryKey:se.connection(e)})}})}function td(e,n,r){return Ye({queryKey:se.groups(e??"",n??"",r),queryFn:()=>ee.get(`${Wt(e,n)}/groups`,{query:{...r}}),enabled:!!e&&!!n,refetchInterval:zt(Rt.queues),placeholderData:jn})}function v2(e,n){const r=Ke();return Ve({mutationFn:i=>ee.post(`${Wt(e,n)}/jobs/promote-matching`,i),onSettled:()=>r.invalidateQueries({queryKey:se.queue(e,n)})})}function q0(e,n){const r=Ke();return Ve({mutationFn:({groupId:i,action:o})=>ee.post(`${Wt(e,n)}/groups/${ze(i)}/${o}`),onSuccess:()=>r.invalidateQueries({queryKey:se.queue(e,n)})})}function $0(e,n,r,i){return Ye({queryKey:se.groupJobs(e??"",n??"",r??"",i),queryFn:()=>ee.get(`${Wt(e,n)}/groups/${ze(r)}/jobs`,{query:{...i}}),enabled:!!e&&!!n&&!!r,refetchInterval:zt(Rt.queue),placeholderData:jn})}function y2(e,n,r,i={}){return Ye({queryKey:se.schedulers(e??"",n??"",r),queryFn:()=>ee.get(`${Wt(e,n)}/schedulers`,{query:{...r}}),enabled:!!e&&!!n&&i.enabled!==!1,refetchInterval:zt(Rt.queues),placeholderData:jn})}function j2(e,n={}){return Ye({queryKey:se.allSchedulers(e??"",n),queryFn:()=>ee.get(`/connections/${ze(e)}/schedulers`,{query:{...n}}),enabled:!!e,refetchInterval:zt(Rt.queues),placeholderData:jn})}function b2(e,n){const r=Ke();return Ve({mutationFn:i=>ee.del(`${Wt(e,n)}/schedulers/${ze(i)}`),onSuccess:()=>{r.invalidateQueries({queryKey:["connections",e,"queue",n,"schedulers"]}),r.invalidateQueries({queryKey:se.queue(e,n)}),r.invalidateQueries({queryKey:se.queues(e)})}})}function n5(e,n,r,i=200){return Ye({queryKey:se.jobTree(e??"",n??"",r??"",i),queryFn:()=>ee.get(`${Wt(e,n)}/jobs/${ze(r)}/tree`,{query:{maxNodes:i}}),enabled:!!e&&!!n&&!!r,refetchInterval:o=>{if(typeof document<"u"&&document.hidden)return!1;const c=o.state.data;return c&&c.nodes.every(d=>d.finishedOn!==null||d.missing)?!1:Rt.job},placeholderData:jn})}function w2(){const e=Ke();return Ve({mutationFn:n=>ee.post("/connections",n),onSuccess:()=>e.invalidateQueries({queryKey:se.connections})})}function N2(){const e=Ke();return Ve({mutationFn:({id:n,input:r})=>ee.patch(`/connections/${ze(n)}`,r),onSuccess:()=>e.invalidateQueries({queryKey:se.connections})})}function k2(){const e=Ke();return Ve({mutationFn:n=>ee.del(`/connections/${ze(n)}`),onSuccess:()=>e.invalidateQueries({queryKey:se.connections})})}function S2(){return Ve({mutationFn:e=>ee.post("/connections/test",e)})}function C2(e={}){const n=e.enabled??!0;return Ye({queryKey:se.connectionsHealth,queryFn:()=>ee.get("/health/connections"),enabled:n,refetchInterval:n?zt(Rt.health):!1,placeholderData:jn})}function I0(e,n={}){return Ye({queryKey:se.hiddenQueues(e??""),queryFn:()=>ee.get(`/connections/${ze(e)}/hidden-queues`),enabled:!!e&&(n.enabled??!0),staleTime:3e4})}function _2(e){const n=Ke();return Ve({mutationFn:({queue:r,hidden:i})=>i?ee.post(`/connections/${ze(e)}/hidden-queues`,{queueName:r}):ee.del(`/connections/${ze(e)}/hidden-queues/${ze(r)}`),onSuccess:r=>{n.setQueryData(se.hiddenQueues(e),r),n.invalidateQueries({queryKey:se.queues(e)}),n.invalidateQueries({queryKey:se.overview(e)}),n.invalidateQueries({queryKey:se.connections})}})}function z0(){return Ye({queryKey:se.attentionThresholds,queryFn:()=>ee.get("/settings/attention"),staleTime:5*6e4})}function P2(){const e=Ke();return Ve({mutationFn:n=>ee.put("/settings/attention",n),onSuccess:n=>e.setQueryData(se.attentionThresholds,n)})}function Jr(e=!0){return Ye({queryKey:se.folders,queryFn:()=>ee.get("/folders",{silent:[402]}),enabled:e,staleTime:3e4})}function E2(){const e=Ke();return Ve({mutationFn:n=>ee.post("/folders",n),onSuccess:()=>e.invalidateQueries({queryKey:se.folders})})}function O0(){const e=Ke();return Ve({mutationFn:({id:n,input:r})=>ee.patch(`/folders/${ze(n)}`,r),onSuccess:()=>e.invalidateQueries({queryKey:se.folders})})}function R2(){const e=Ke();return Ve({mutationFn:n=>ee.del(`/folders/${ze(n)}`),onSuccess:()=>e.invalidateQueries({queryKey:se.folders})})}function A0(){const e=Ke();return Ve({mutationFn:({id:n,input:r})=>ee.put(`/folders/${ze(n)}/queues`,r),onSuccess:()=>e.invalidateQueries({queryKey:se.folders})})}function bm(e=!0){return Ye({queryKey:se.alerts,queryFn:()=>ee.get("/alerts",{silent:[402]}),enabled:e,refetchInterval:zt(Rt.connections)})}function M2(e=!0){return Ye({queryKey:se.attention,queryFn:()=>ee.get("/attention",{silent:[402]}),enabled:e,refetchInterval:zt(Rt.queues)})}function wm(e){setTimeout(()=>void e.invalidateQueries({queryKey:se.attention}),1500)}function T2(e={},n=!0){return Ye({queryKey:se.alertEvents(e),queryFn:()=>ee.get("/alerts/events",{query:{...e},silent:[402]}),enabled:n,refetchInterval:zt(Rt.connections)})}function q2(){const e=Ke();return Ve({mutationFn:n=>ee.post("/alerts",n),onSuccess:()=>{e.invalidateQueries({queryKey:se.alerts}),wm(e)}})}function L0(){const e=Ke();return Ve({mutationFn:({id:n,input:r})=>ee.patch(`/alerts/${ze(n)}`,r),onSuccess:()=>{e.invalidateQueries({queryKey:se.alerts}),wm(e)}})}function $2(){const e=Ke();return Ve({mutationFn:n=>ee.del(`/alerts/${ze(n)}`),onSuccess:()=>{e.invalidateQueries({queryKey:se.alerts}),wm(e)}})}function I2(){const e=Ke();return Ve({mutationFn:n=>ee.post(`/alerts/${ze(n)}/test`),onSuccess:()=>e.invalidateQueries({queryKey:["alerts","events"]})})}function z2(e=!0){return Ye({queryKey:se.users,queryFn:()=>ee.get("/users",{silent:[402]}),enabled:e})}function O2(){const e=Ke();return Ve({mutationFn:n=>ee.post("/users",n),onSuccess:()=>e.invalidateQueries({queryKey:se.users})})}function A2(){const e=Ke();return Ve({mutationFn:({id:n,input:r})=>ee.patch(`/users/${ze(n)}`,r),onSuccess:()=>e.invalidateQueries({queryKey:se.users})})}function L2(e={},n=50,r=!0){return zy({queryKey:se.audit({...e,limit:n}),queryFn:({pageParam:i})=>ee.get("/audit",{query:{...e,limit:n,cursor:i??void 0},silent:[402,403]}),initialPageParam:void 0,getNextPageParam:i=>i.nextCursor??void 0,enabled:r})}function F2(e=!0){return Ye({queryKey:se.auditActors,queryFn:()=>ee.get("/audit/actors",{silent:[402,403]}),enabled:e,staleTime:6e4})}function D2(e={}){return e0("/audit/export",{...e})}function U2(e,n,r,i=!0){const o={connectionId:e,queueName:n,jobId:r};return Ye({queryKey:se.audit({...o,limit:20}),queryFn:()=>ee.get("/audit",{query:{...o,limit:20},silent:[402,403]}),enabled:i&&!!e&&!!n&&!!r,staleTime:15e3})}function s5(e,n=200,r=!0){return Ye({queryKey:se.flows(e??"",n),queryFn:()=>ee.get(`/connections/${ze(e)}/flows`,{query:{sample:n},silent:[402]}),enabled:r&&!!e,refetchInterval:zt(Rt.connections),placeholderData:jn})}function r5(){const e=Ke();return Ve({mutationFn:n=>ee.post("/flow-edges",n),onSuccess:()=>e.invalidateQueries({queryKey:["flows"]})})}function a5(){const e=Ke();return Ve({mutationFn:n=>ee.del(`/flow-edges/${ze(n)}`),onSuccess:()=>e.invalidateQueries({queryKey:["flows"]})})}function i5(e=!0){return Ye({queryKey:se.flowMaps,queryFn:()=>ee.get("/flow-maps",{silent:[402]}),enabled:e,refetchInterval:zt(Rt.flowMaps),placeholderData:jn})}function l5(e,n=!0){return Ye({queryKey:se.flowMap(e??""),queryFn:()=>ee.get(`/flow-maps/${ze(e)}`,{silent:[402,404]}),enabled:n&&!!e,refetchInterval:zt(Rt.flowMap),retry:(r,i)=>!(Ts(i)&&i.status===404)&&r<2})}function Xr(e){const n=Ke();return Ve({mutationFn:e,onSuccess:r=>{n.setQueryData(se.flowMap(r.id),r),n.invalidateQueries({queryKey:se.flowMaps,exact:!0})}})}function o5(){return Xr(e=>ee.post("/flow-maps",e))}function c5(){return Xr(({id:e,input:n})=>ee.patch(`/flow-maps/${ze(e)}`,n))}function u5(){const e=Ke();return Ve({mutationFn:n=>ee.del(`/flow-maps/${ze(n)}`),onSuccess:(n,r)=>{e.removeQueries({queryKey:se.flowMap(r),exact:!0}),e.invalidateQueries({queryKey:se.flowMaps})}})}function d5(){return Xr(({id:e,name:n,parentId:r})=>ee.post(`/flow-maps/${ze(e)}/copy`,{name:n,parentId:r}))}function h5(){return Xr(({mapId:e,input:n})=>ee.post(`/flow-maps/${ze(e)}/nodes`,n))}function f5(){return Xr(({mapId:e,nodeId:n})=>ee.del(`/flow-maps/${ze(e)}/nodes/${ze(n)}`))}function m5(){return Ve({mutationFn:({mapId:e,input:n})=>ee.put(`/flow-maps/${ze(e)}/layout`,n)})}function p5(){return Xr(({mapId:e,input:n})=>ee.post(`/flow-maps/${ze(e)}/edges`,n))}function x5(){return Xr(({mapId:e,edgeId:n,input:r})=>ee.patch(`/flow-maps/${ze(e)}/edges/${ze(n)}`,r))}function g5(){return Xr(({mapId:e,edgeId:n})=>ee.del(`/flow-maps/${ze(e)}/edges/${ze(n)}`))}function Q2(){return Ve({mutationFn:e=>ee.put("/license",{key:e})})}function B2(){return Ve({mutationFn:()=>ee.post("/license/refresh")})}function V2(){return Ve({mutationFn:()=>ee.del("/license")})}function H2(){return Ye({queryKey:se.ssoLoginOptions,queryFn:()=>ee.get("/auth/sso/options",{silent:!0}),staleTime:6e4,retry:!1})}function K2(e=!0){return Ye({queryKey:se.ssoProviders,queryFn:()=>ee.get("/sso/providers",{silent:[402]}),enabled:e})}function F0(e=!0){return Ye({queryKey:se.ssoSettings,queryFn:()=>ee.get("/sso/settings",{silent:[402]}),enabled:e})}function W2(){const e=Ke();return Ve({mutationFn:n=>ee.post("/sso/providers",n),onSuccess:()=>{e.invalidateQueries({queryKey:se.ssoProviders}),e.invalidateQueries({queryKey:se.ssoLoginOptions})}})}function Z2(){const e=Ke();return Ve({mutationFn:({id:n,input:r})=>ee.patch(`/sso/providers/${ze(n)}`,r),onSuccess:()=>{e.invalidateQueries({queryKey:se.ssoProviders}),e.invalidateQueries({queryKey:se.ssoLoginOptions})}})}function G2(){const e=Ke();return Ve({mutationFn:n=>ee.del(`/sso/providers/${ze(n)}`),onSuccess:()=>{e.invalidateQueries({queryKey:se.ssoProviders}),e.invalidateQueries({queryKey:se.ssoLoginOptions}),e.invalidateQueries({queryKey:se.ssoSettings})}})}function J2(){return Ve({mutationFn:e=>ee.post(`/sso/providers/${ze(e)}/test`)})}function D0(){const e=Ke();return Ve({mutationFn:n=>ee.put("/sso/settings",n),onSuccess:()=>{e.invalidateQueries({queryKey:se.ssoSettings}),e.invalidateQueries({queryKey:se.ssoLoginOptions})}})}function X2(e=!0){return Ye({queryKey:se.mcpSettings,queryFn:()=>ee.get("/mcp/settings",{silent:[402]}),enabled:e})}function Y2(){const e=Ke();return Ve({mutationFn:n=>ee.put("/mcp/settings",n),onSuccess:()=>void e.invalidateQueries({queryKey:se.mcpSettings})})}function eS(e,n=!0){return Ye({queryKey:se.mcpGrants(e),queryFn:()=>ee.get(`/mcp/grants${e?"?all=1":""}`,{silent:[402]}),enabled:n})}function tS(){const e=Ke();return Ve({mutationFn:n=>ee.del(`/mcp/grants/${ze(n)}`),onSuccess:()=>void e.invalidateQueries({queryKey:["mcp","grants"]})})}function v5(e){return Ye({queryKey:se.mcpConsent(e??""),queryFn:()=>ee.get(`/mcp/consent?request=${encodeURIComponent(e??"")}`),enabled:!!e,refetchOnWindowFocus:!1,staleTime:1/0})}function y5(){return Ve({mutationFn:e=>ee.post("/mcp/consent",e)})}const nS={neutral:"bg-surface-3 text-fg-muted",outline:"border border-border-strong text-fg-muted",success:"bg-success/15 text-success",warning:"bg-warning/15 text-warning",danger:"bg-danger/15 text-danger",info:"bg-info/15 text-info",accent:"bg-accent/15 text-accent",violet:"bg-violet/15 text-violet",teal:"bg-teal/15 text-teal",pro:"bg-pro/15 text-pro",custom:""};function be({variant:e="neutral",dot:n,size:r="sm",mono:i,className:o,children:c,...d}){return t.jsxs("span",{className:F("inline-flex shrink-0 items-center gap-1 rounded font-medium whitespace-nowrap",r==="xs"?"h-4 px-1 text-[10px] leading-none":"h-5 px-1.5 text-[11px] leading-none",i&&"font-mono",nS[e],o),...d,children:[n&&t.jsx("span",{className:"status-dot size-1.5 bg-current","aria-hidden":!0}),c]})}function Nm({className:e}){const{isPro:n,demo:r}=wt();return r?t.jsx(be,{variant:"warning",size:"xs",className:F("tracking-wider",e),title:"Demo mode: Pro unlocked, settings locked",children:"DEMO"}):n?t.jsx(be,{variant:"pro",size:"xs",className:F("tracking-wider",e),children:"PRO"}):t.jsx(be,{variant:"outline",size:"xs",className:F("tracking-wider",e),children:"FREE"})}function ov({className:e}){return t.jsx(go,{className:F("size-3 shrink-0 text-pro",e),"aria-label":"Pro feature"})}function Xi({children:e,className:n}){return t.jsx("kbd",{className:F("inline-flex h-5 min-w-5 items-center justify-center rounded border border-border-strong bg-surface-2 px-1 font-mono text-[10px] leading-none text-fg-muted shadow-[inset_0_-1px_0_var(--border-strong)]",n),children:e})}function Pe({content:e,children:n,side:r="top",className:i,block:o}){if(e==null||e==="")return t.jsx(t.Fragment,{children:n});const c={top:"bottom-full left-1/2 mb-1.5 -translate-x-1/2",bottom:"top-full left-1/2 mt-1.5 -translate-x-1/2",left:"right-full top-1/2 mr-1.5 -translate-y-1/2",right:"left-full top-1/2 ml-1.5 -translate-y-1/2"}[r];return t.jsxs("span",{className:F("has-tooltip relative",o?"block":"inline-flex",i),children:[n,t.jsx("span",{role:"tooltip",className:F("tooltip",c),children:e})]})}function sS(e){return e?e.ok?"ok":"down":"unknown"}function nd({status:e,className:n,pulse:r,withLabel:i}){const o=sS(e),c=o==="ok"?"bg-success text-success":o==="down"?"bg-danger text-danger":"bg-fg-subtle text-fg-subtle",d=o==="ok"?`Connected · ${(e==null?void 0:e.latencyMs)??"?"} ms · Redis ${(e==null?void 0:e.redisVersion)??"?"}`:o==="down"?`Down: ${(e==null?void 0:e.error)??"unreachable"}`:"Status unknown",h=e!=null&&e.checkedAt?` · checked ${Kr(e.checkedAt)}`:"";return t.jsx(Pe,{content:d+h,children:t.jsxs("span",{className:F("inline-flex items-center gap-1.5",n),children:[t.jsx("span",{className:F("status-dot",c,r&&o==="down"&&"pulse"),"aria-label":d,role:"img"}),i&&t.jsx("span",{className:F("text-xs",o==="down"?"text-danger":"text-fg-muted"),children:o==="ok"?"Connected":o==="down"?"Down":"Unknown"})]})})}function km({className:e}){return t.jsx("span",{className:F("inline-flex size-6 items-center justify-center rounded-md bg-[#0b0d10] ring-1 ring-border-strong",e),"aria-hidden":!0,children:t.jsxs("svg",{viewBox:"0 0 32 32",className:"size-5",children:[t.jsx("rect",{x:"7",y:"8",width:"18",height:"4",rx:"2",fill:"#5b8def"}),t.jsx("rect",{x:"7",y:"14",width:"13",height:"4",rx:"2",fill:"#5b8def",opacity:".75"}),t.jsx("rect",{x:"7",y:"20",width:"8",height:"4",rx:"2",fill:"#5b8def",opacity:".5"}),t.jsx("circle",{cx:"24",cy:"22",r:"3",fill:"#f85149"})]})})}function cv({onOpenSwitcher:e,onNavigate:n,className:r}){const{isAdmin:i}=mt(),{has:o}=wt(),{byConnection:c,isLoading:d}=ll(),h=o("folders"),f=Jr(h),g=[{to:ue.alerts,label:"Alerts",icon:rl,feature:"alerts"},{to:ue.flows(),label:"Flows",icon:DN,feature:"flows"},{to:ue.users,label:"Users",icon:Ju,feature:"users",adminOnly:!0},{to:ue.audit(),label:"Audit log",icon:Bo,feature:"audit",adminOnly:!0}];return t.jsxs("aside",{className:F("flex h-full w-64 shrink-0 flex-col border-r border-border bg-surface",r),"aria-label":"Sidebar",children:[t.jsxs("div",{className:"flex h-12 items-center gap-2 border-b border-border px-3",children:[t.jsx(km,{}),t.jsx("span",{className:"truncate text-[13px] font-semibold tracking-tight",children:"Bullpane"}),t.jsx(Nm,{className:"ml-auto"})]}),t.jsx("div",{className:"px-2 pt-2",children:t.jsxs("button",{type:"button",onClick:e,className:"flex h-8 w-full items-center gap-2 rounded-md border border-border bg-bg px-2.5 text-xs text-fg-subtle hover:border-border-strong hover:text-fg-muted",children:[t.jsx(Yn,{className:"size-3.5","aria-hidden":!0}),t.jsx("span",{className:"flex-1 text-left",children:"Jump to queue…"}),t.jsx(Xi,{children:C0}),t.jsx(Xi,{children:"K"})]})}),t.jsxs("nav",{className:"px-2 pt-2","aria-label":"Primary",children:[t.jsx(io,{to:ue.home,end:!0,icon:EN,label:"Overview",onNavigate:n}),t.jsx(io,{to:ue.schedulers(),icon:Lo,label:"Schedulers",onNavigate:n})]}),t.jsxs("div",{className:"mt-2 min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-2 pb-2",children:[t.jsx(rS,{children:"Queues"}),h&&f.data&&f.data.length>0&&t.jsx(lS,{folders:f.data,byConnection:c,onNavigate:n}),c.map(({connection:p,queues:v,error:j})=>t.jsx(iS,{connection:p,queues:v,error:j,onNavigate:n,defaultOpen:c.length<=aS},p.id)),!d&&c.length===0&&t.jsxs("p",{className:"px-2 py-3 text-xs text-fg-subtle",children:["No connections yet."," ",i?t.jsx(Oo,{to:ue.settings("connections"),className:"text-accent hover:underline",onClick:n,children:"Add one"}):"Ask an admin to add one."]}),d&&t.jsxs("div",{className:"space-y-2 px-2 py-2",children:[t.jsx("span",{className:"skeleton block h-3 w-3/4"}),t.jsx("span",{className:"skeleton block h-3 w-1/2"}),t.jsx("span",{className:"skeleton block h-3 w-2/3"})]}),h?t.jsx(io,{to:ue.folders,icon:sr,label:"Manage folders",className:"mt-1 text-xs",onNavigate:n}):t.jsxs("button",{type:"button",onClick:()=>jo("folders"),className:"nav-item mt-1 w-full text-left",title:"Custom folders are a Pro feature",children:[t.jsx(NN,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),t.jsx("span",{className:"flex-1 truncate text-xs",children:"Custom folders"}),t.jsx(ov,{})]})]}),t.jsxs("nav",{className:"border-t border-border px-2 py-2","aria-label":"Secondary",children:[g.filter(p=>!p.adminOnly||i).map(p=>o(p.feature)?t.jsx(io,{to:p.to,icon:p.icon,label:p.label,onNavigate:n},p.to):t.jsxs("button",{type:"button",onClick:()=>jo(p.feature),className:"nav-item w-full text-left",children:[t.jsx(p.icon,{className:"size-3.5 shrink-0","aria-hidden":!0}),t.jsx("span",{className:"flex-1 truncate",children:p.label}),t.jsx(ov,{})]},p.to)),t.jsx(io,{to:ue.settings(),icon:Gy,label:"Settings",onNavigate:n})]})]})}function rS({children:e}){return t.jsx("div",{className:"px-2 pt-2 pb-1 text-[10px] font-semibold tracking-wider text-fg-subtle uppercase",children:e})}function io({to:e,icon:n,label:r,end:i,className:o,onNavigate:c}){return t.jsxs(Oo,{to:e,end:i,className:({isActive:d})=>F("nav-item",d&&"active",o),onClick:c,children:[t.jsx(n,{className:"size-3.5 shrink-0","aria-hidden":!0}),t.jsx("span",{className:"flex-1 truncate",children:r})]})}function U0(e,n=!0){const[r,i,o]=ed(`sidebar.${e}`,n);return[r,i,o]}const aS=3;function iS({connection:e,queues:n,error:r,onNavigate:i,defaultOpen:o}){const c=Fn(),d=c.connectionId===e.id,[h,f,g]=U0(`conn.${e.id}`,o),p=w.useMemo(()=>[...n].sort((S,y)=>S.name.localeCompare(y.name)),[n]),v=n.reduce((S,y)=>S+y.counts.failed,0),j=n.reduce((S,y)=>S+y.counts.waiting+y.counts.prioritized,0);return w.useEffect(()=>{d&&!h&&g(!0)},[d,e.id]),t.jsxs("div",{className:"mt-0.5",children:[t.jsxs("div",{className:F("group flex h-7 items-center gap-1 rounded-md pr-1 pl-1 hover:bg-surface-2",d&&!c.queue&&"bg-surface-3"),children:[t.jsx("button",{type:"button",onClick:f,"aria-expanded":h,"aria-label":h?"Collapse":"Expand",className:"rounded p-0.5 text-fg-subtle hover:text-fg",children:h?t.jsx(ps,{className:"size-3.5"}):t.jsx(Dn,{className:"size-3.5"})}),t.jsxs(Oo,{to:ue.connection(e.id),onClick:i,className:"flex min-w-0 flex-1 items-center gap-1.5 text-[13px] font-medium text-fg",children:[t.jsx(Va,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),t.jsx("span",{className:"truncate",children:e.name})]}),!h&&t.jsx(Pe,{content:`${n.length} ${n.length===1?"queue":"queues"} · ${ft(j)} waiting · ${ft(v)} failed`,children:t.jsxs("span",{className:"flex shrink-0 cursor-help items-center gap-1",children:[t.jsx("span",{className:"num text-[10px] text-fg-subtle",children:n.length}),v>0&&t.jsx("span",{className:"num text-[10px] text-danger",children:ft(v)})]})}),t.jsx(nd,{status:e.status,pulse:!0})]}),h&&t.jsxs("ul",{className:"ml-3 border-l border-border pl-1",children:[!!r&&t.jsx("li",{className:"px-2 py-1 text-xs text-danger",children:"Could not load queues"}),!r&&p.length===0&&t.jsx("li",{className:"px-2 py-1 text-xs text-fg-subtle",children:"No queues discovered"}),p.map(S=>t.jsx(Q0,{connectionId:e.id,queue:S,onNavigate:i},S.name))]})]})}function Q0({connectionId:e,queue:n,onNavigate:r,hint:i}){const o=Fn(),c=o.connectionId===e&&o.queue===n.name;return t.jsx("li",{children:t.jsxs(Oo,{to:ue.queue(e,n.name,wo(n.counts)),onClick:r,className:F("nav-item h-6.5 pr-1.5 pl-2 text-xs",c&&"active"),title:i?`${i} / ${n.name}`:n.name,children:[t.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[n.name,i&&t.jsxs("span",{className:"ml-1 text-fg-subtle",children:["· ",i]})]}),n.isPaused&&t.jsx("span",{className:"rounded bg-surface-3 px-1 text-[9px] text-fg-subtle uppercase",children:"paused"}),t.jsx("span",{className:"num text-[10px] text-fg-subtle",title:"waiting",children:ft(n.counts.waiting+n.counts.prioritized)}),n.counts.failed>0&&t.jsx(Pe,{content:`${ft(n.counts.failed)} failed · click to open them`,children:t.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-danger",children:[t.jsx("span",{className:"status-dot size-1.5 bg-danger"}),t.jsx("span",{className:"num",children:ft(n.counts.failed)})]})})]})})}function lS({folders:e,byConnection:n,onNavigate:r}){const i=e.filter(d=>!d.parentId).sort((d,h)=>d.position-h.position||d.name.localeCompare(h.name)),o=d=>e.filter(h=>h.parentId===d).sort((h,f)=>h.position-f.position||h.name.localeCompare(f.name)),c=(d,h)=>{const f=n.find(p=>p.connection.id===d),g=f==null?void 0:f.queues.find(p=>p.name===h);return f&&g?{connection:f.connection,queue:g}:null};return t.jsx("div",{className:"mb-2",children:i.map(d=>t.jsx(B0,{folder:d,children:o(d.id),lookup:c,onNavigate:r,depth:0},d.id))})}function B0({folder:e,children:n,lookup:r,onNavigate:i,depth:o}){const[c,d]=U0(`folder.${e.id}`),f=Fn().folderId===e.id,g=e.queues.map(p=>({ref:p,hit:r(p.connectionId,p.queueName)}));return t.jsxs("div",{className:"mt-0.5",style:{marginLeft:o*12},children:[t.jsxs("div",{className:F("group flex h-7 items-center gap-1 rounded-md pr-1 pl-1 hover:bg-surface-2",f&&"bg-surface-3"),children:[t.jsx("button",{type:"button",onClick:d,"aria-expanded":c,"aria-label":c?"Collapse":"Expand",className:"rounded p-0.5 text-fg-subtle hover:text-fg",children:c?t.jsx(ps,{className:"size-3.5"}):t.jsx(Dn,{className:"size-3.5"})}),t.jsxs(Oo,{to:ue.folder(e.id),onClick:i,className:({isActive:p})=>F("flex min-w-0 flex-1 items-center gap-1.5 text-[13px] font-medium",p?"text-fg":"text-fg hover:underline"),title:`Open ${e.name}`,children:[t.jsx(sr,{className:"size-3.5 shrink-0",style:{color:e.color??"var(--fg-subtle)"},"aria-hidden":!0}),t.jsx("span",{className:"truncate",children:e.name})]}),t.jsx("span",{className:"num text-[10px] text-fg-subtle",children:e.queues.length})]}),c&&t.jsxs(t.Fragment,{children:[n.map(p=>t.jsx(B0,{folder:p,children:[],lookup:r,onNavigate:i,depth:o+1},p.id)),t.jsxs("ul",{className:"ml-3 border-l border-border pl-1",children:[g.length===0&&n.length===0&&t.jsx("li",{className:"px-2 py-1 text-xs text-fg-subtle",children:"Empty folder"}),g.map(({ref:p,hit:v})=>v?t.jsx(Q0,{connectionId:v.connection.id,queue:v.queue,hint:v.connection.name,onNavigate:i},`${p.connectionId}/${p.queueName}`):t.jsx("li",{className:"nav-item h-6.5 pl-2 text-xs text-fg-subtle line-through",title:"Queue not found on its connection",children:p.queueName},`${p.connectionId}/${p.queueName}`))]})]})]})}const oS=.9,cS=.7;function Sm(e){if(!(e==null||!Number.isFinite(e))){if(e>=oS)return"danger";if(e>=cS)return"warn"}}function uS(e){return Sm(e)??"ok"}function Ho(e){if(e==null||!Number.isFinite(e))return"No CPU rate yet — needs two INFO samples. Also resets when Redis restarts. This is not zero.";const n=`${E0(e)} — used_cpu_sys + used_cpu_user per second, as a share of one core.`;return e>1?`${n} Above 100%: Redis is using more than one core, which its background threads (persistence, lazy free) can legitimately do — the command loop itself is still single threaded.`:`${n} Redis runs its command loop on a single thread, so 100% is the practical ceiling.`}const V0="health.paused";let Bf=Yu(V0,!1,e=>e==="true"||e==='"true"'||e==="1");const Vf=new Set;function dS(e){return Vf.add(e),()=>Vf.delete(e)}function uv(){return Bf}function hS(e){Bf!==e&&(Bf=e,So(V0,e),Vf.forEach(n=>n()))}function fS(){const e=w.useSyncExternalStore(dS,uv,uv),n=w.useCallback(r=>hS(r),[]);return[e,n]}function sd(){const[e,n]=fS(),r=C2({enabled:!e}),i=r.data??[];let o=null;for(const c of i){const d=c.info?Date.parse(c.info.sampledAt):NaN;Number.isFinite(d)&&(o===null||d>o)&&(o=d)}return{health:i,paused:e,setPaused:n,isLoading:r.isLoading&&!e,error:r.error,lastSampleAt:o,refetch:()=>void r.refetch()}}function Cm(e){let n=null,r=null,i=null,o=0,c=0,d=0;for(const h of e){h.ok||o++,h.commandsPerSec!=null&&h.kind!=="postgres"&&(n=(n??0)+h.commandsPerSec),h.memoryUsedPct!=null&&(r=Math.max(r??0,h.memoryUsedPct)),h.cpuCores!=null&&(i=Math.max(i??0,h.cpuCores));for(const f of h.warnings)f.level==="critical"?c++:d++}return{total:e.length,down:o,commandsPerSec:n,memoryPct:r,cpuCores:i,critical:c,warn:d}}function mS({className:e}){const{health:n,paused:r}=sd();if(n.length===0)return null;const i=Cm(n),o=i.down>0||i.critical>0,c=!o&&i.warn>0,d=r?"Health monitoring is paused. Open the monitor to resume.":[`${i.total} connection${i.total===1?"":"s"}`,i.down>0?`${i.down} unreachable`:null,i.commandsPerSec==null?"commands/sec: measuring…":`${Wr(i.commandsPerSec)} across all connections`,i.memoryPct==null?"no maxmemory set":`peak memory use ${En(i.memoryPct)} of maxmemory`,i.cpuCores==null?null:`busiest CPU ${Ji(i.cpuCores)} of one core — ${Ho(i.cpuCores)}`,i.critical>0?`${i.critical} critical warning${i.critical===1?"":"s"}`:null,i.warn>0?`${i.warn} warning${i.warn===1?"":"s"}`:null].filter(Boolean).join(" · ");return t.jsx(Pe,{content:d,side:"bottom",children:t.jsxs(Ee,{to:ue.health,"aria-label":"Health monitor",className:F("hidden items-center gap-1.5 rounded-md border border-border bg-bg px-2 py-1 text-xs text-fg-muted transition-colors hover:border-border-strong hover:text-fg md:flex",o&&"border-danger/50 text-danger",c&&"border-warning/50 text-warning",r&&"opacity-60",e),children:[t.jsx(Ao,{className:F("size-3.5 shrink-0",r&&"opacity-50"),"aria-hidden":!0}),t.jsxs("span",{className:"num whitespace-nowrap",children:[i.total," conn",t.jsx("span",{className:"mx-1 text-fg-subtle",children:"·"}),r?"paused":i.commandsPerSec==null?"—":`${Wr(i.commandsPerSec,"")} cmd/s`,i.cpuCores!=null&&!r&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-1 text-fg-subtle",children:"·"}),Ji(i.cpuCores)," cpu"]}),i.memoryPct!=null&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-1 text-fg-subtle",children:"·"}),En(i.memoryPct,0)," mem"]})]})]})})}const pS={sso:"SSO",mcp:"MCP"};function xS(){var c;const e=Fn(),{pathname:n}=Ln(),i=(c=xs().data)==null?void 0:c.find(d=>d.id===e.connectionId),o=[{label:"Overview",to:ue.home}];return n.startsWith("/settings")?(o.push({label:"Settings",to:ue.settings()}),e.tab&&o.push({label:pS[e.tab]??e.tab[0].toUpperCase()+e.tab.slice(1)}),o):n.startsWith("/health")?[...o,{label:"Health"}]:n.startsWith("/alerts")?[...o,{label:"Alerts"}]:n.startsWith("/users")?[...o,{label:"Users"}]:n.startsWith("/audit")?[...o,{label:"Audit log"}]:n.startsWith("/folders")?[...o,{label:"Folders"}]:n.startsWith("/flows")?(o.push({label:"Flows",to:ue.flows()}),i&&o.push({label:i.name}),o):(e.connectionId&&(o.push({label:(i==null?void 0:i.name)??e.connectionId,to:ue.connection(e.connectionId)}),e.queue&&(o.push({label:e.queue,to:ue.queue(e.connectionId,e.queue)}),n.includes("/groups")&&(o.push({label:"Groups",to:e.groupId?ue.groups(e.connectionId,e.queue):void 0}),e.groupId&&o.push({label:e.groupId,mono:!0})),e.jobId&&o.push({label:e.jobId,mono:!0}))),o)}function gS({onOpenSwitcher:e,onToggleSidebar:n}){var d,h;const r=xS(),i=Fn(),c=(d=xs().data)==null?void 0:d.find(f=>f.id===i.connectionId);return t.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-2 border-b border-border bg-surface px-3",children:[t.jsx(V,{variant:"ghost",size:"icon-sm",className:"lg:hidden","aria-label":"Toggle sidebar",onClick:n,children:t.jsx(MN,{})}),t.jsx("nav",{"aria-label":"Breadcrumb",className:"min-w-0 flex-1",children:t.jsx("ol",{className:"flex min-w-0 items-center gap-1 text-[13px]",children:r.map((f,g)=>{const p=g===r.length-1;return t.jsxs("li",{className:F("flex min-w-0 items-center gap-1",p&&"min-w-0 flex-1"),children:[g>0&&t.jsx(Dn,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),f.to&&!p?t.jsx(Ee,{to:f.to,className:"truncate text-fg-muted hover:text-fg",children:f.label}):t.jsx("span",{"aria-current":p?"page":void 0,className:F("truncate",p?"font-medium text-fg":"text-fg-muted",f.mono&&"font-mono text-xs"),children:f.label})]},g)})})}),c&&t.jsxs("div",{className:"hidden items-center gap-1.5 rounded-md border border-border bg-bg px-2 py-1 text-xs text-fg-muted sm:flex",children:[t.jsx(nd,{status:c.status,pulse:!0}),t.jsx("span",{className:"truncate",children:c.name}),((h=c.status)==null?void 0:h.latencyMs)!=null&&t.jsxs("span",{className:"num text-fg-subtle",children:[c.status.latencyMs," ms"]})]}),t.jsx(mS,{}),t.jsx(V,{variant:"ghost",size:"icon-sm","aria-label":"Search queues",onClick:e,className:"sm:hidden",children:t.jsx(Yn,{})}),t.jsxs("button",{type:"button",onClick:e,className:"hidden h-7 items-center gap-1.5 rounded-md border border-border px-2 text-xs text-fg-subtle hover:border-border-strong hover:text-fg-muted sm:inline-flex",children:[t.jsx(Yn,{className:"size-3.5","aria-hidden":!0}),t.jsx(Xi,{children:C0}),t.jsx(Xi,{children:"K"})]}),t.jsx(yS,{})]})}function vS(){return t.jsxs("button",{type:"button",onClick:()=>jo("users"),className:"flex h-7 items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-2 text-xs text-warning hover:bg-warning/20",title:"Anyone who can reach this URL can retry, promote and delete jobs. Pro adds login, roles and the audit log.",children:[t.jsx(hm,{className:"size-3.5","aria-hidden":!0}),t.jsx("span",{className:"hidden md:inline",children:"No login"})]})}function yS(){const{user:e,logout:n,isAdmin:r,authRequired:i}=mt(),{demo:o,has:c}=wt(),[d,h]=w.useState(!1),f=w.useRef(null);if(w.useEffect(()=>{if(!d)return;const p=j=>{var S;(S=f.current)!=null&&S.contains(j.target)||h(!1)},v=j=>j.key==="Escape"&&h(!1);return document.addEventListener("mousedown",p),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",v)}},[d]),!i)return t.jsx(vS,{});if(!e)return null;const g=e.name.split(/\s+/).map(p=>p[0]).slice(0,2).join("").toUpperCase();return t.jsxs("div",{ref:f,className:"relative",children:[t.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":d,onClick:()=>h(p=>!p),className:"flex h-7 items-center gap-2 rounded-md px-1.5 hover:bg-surface-2",children:[t.jsx("span",{className:"flex size-6 items-center justify-center rounded-full bg-accent/20 text-[10px] font-semibold text-accent",children:g||"?"}),t.jsx("span",{className:"hidden max-w-32 truncate text-xs text-fg md:inline",children:e.name}),t.jsx(be,{variant:e.role==="admin"?"pro":e.role==="operator"?"info":"neutral",size:"xs",className:"hidden md:inline-flex",children:e.role})]}),d&&t.jsxs("div",{role:"menu",className:"absolute right-0 z-40 mt-1 w-60 rounded-lg border border-border bg-surface p-1 shadow-[var(--shadow)]",children:[t.jsxs("div",{className:"px-2.5 py-2",children:[t.jsx("p",{className:"truncate text-[13px] font-medium text-fg",children:e.name}),t.jsx("p",{className:"truncate text-xs text-fg-muted",children:e.email}),t.jsxs("p",{className:"mt-1 flex items-center gap-1 text-[11px] text-fg-subtle",children:[t.jsx(zN,{className:"size-3","aria-hidden":!0})," ",e.role,o&&t.jsx("span",{className:"ml-1 text-warning",children:"· demo"})]})]}),t.jsx("div",{className:"my-1 border-t border-border"}),r&&c("audit")&&t.jsxs(Ee,{role:"menuitem",to:ue.audit(),onClick:()=>h(!1),className:"nav-item",children:[t.jsx(Bo,{className:"size-3.5","aria-hidden":!0})," Audit log"]}),t.jsxs(Ee,{role:"menuitem",to:ue.settings("license"),onClick:()=>h(!1),className:"nav-item",children:[t.jsx(al,{className:"size-3.5","aria-hidden":!0})," License"]}),t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>void n(),className:"nav-item w-full text-left",children:[t.jsx(RN,{className:"size-3.5","aria-hidden":!0})," Log out"]})]})]})}function jS({open:e,onClose:n}){const{byConnection:r}=ll(),i=un(),[o,c]=w.useState(""),[d,h]=w.useState(0),f=w.useRef(null),g=w.useRef(null),p=w.useRef(null),v=w.useMemo(()=>r.flatMap(({connection:y,queues:b})=>b.map(k=>({key:`${y.id}/${k.name}`,connectionId:y.id,connectionName:y.name,queue:k.name,waiting:k.counts.waiting+k.counts.prioritized,failed:k.counts.failed,paused:k.isPaused,landing:wo(k.counts)}))),[r]),j=w.useMemo(()=>{const y=o.trim().toLowerCase();return v.map(k=>({it:k,score:bS(y,k)})).filter(k=>k.score>0).sort((k,C)=>C.score-k.score||k.it.queue.localeCompare(C.it.queue)).slice(0,50).map(k=>k.it)},[v,o]);w.useEffect(()=>{const y=g.current;y&&(e&&!y.open?(y.showModal(),c(""),h(0),setTimeout(()=>{var b;return(b=f.current)==null?void 0:b.focus()},0)):!e&&y.open&&y.close())},[e]),w.useEffect(()=>{h(0)},[o]),w.useEffect(()=>{var b;const y=(b=p.current)==null?void 0:b.children[d];y==null||y.scrollIntoView({block:"nearest"})},[d]);const S=y=>{y&&(n(),i(ue.queue(y.connectionId,y.queue,y.landing)))};return t.jsx("dialog",{ref:g,className:"dialog !mt-[12vh]",style:{"--dialog-w":"36rem"},"aria-label":"Jump to queue",onClose:n,onCancel:y=>{y.preventDefault(),n()},onClick:y=>y.target===g.current&&n(),children:e&&t.jsxs("div",{onClick:y=>y.stopPropagation(),children:[t.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[t.jsx(Yn,{className:"size-4 text-fg-subtle","aria-hidden":!0}),t.jsx("input",{ref:f,value:o,onChange:y=>c(y.target.value),placeholder:"Type a queue name…","aria-label":"Queue name","aria-activedescendant":j[d]?`qs-${j[d].key}`:void 0,role:"combobox","aria-expanded":!0,"aria-controls":"qs-list",className:"h-11 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-subtle",onKeyDown:y=>{y.key==="ArrowDown"?(y.preventDefault(),h(b=>Math.min(j.length-1,b+1))):y.key==="ArrowUp"?(y.preventDefault(),h(b=>Math.max(0,b-1))):y.key==="Enter"&&(y.preventDefault(),S(j[d]))}}),t.jsx(Xi,{children:"esc"})]}),t.jsxs("ul",{id:"qs-list",ref:p,role:"listbox",className:"max-h-[50vh] overflow-y-auto p-1",children:[j.length===0&&t.jsx("li",{className:"px-3 py-8 text-center text-xs text-fg-subtle",children:v.length===0?"No queues loaded yet":"No queue matches"}),j.map((y,b)=>t.jsxs("li",{id:`qs-${y.key}`,role:"option","aria-selected":b===d,onMouseEnter:()=>h(b),onClick:()=>S(y),className:F("flex cursor-pointer items-center gap-2 rounded-md px-2.5 py-1.5 text-[13px]",b===d?"bg-surface-3 text-fg":"text-fg-muted"),children:[t.jsx(Va,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),t.jsx("span",{className:"truncate font-medium text-fg",children:t.jsx(wS,{text:y.queue,needle:o})}),t.jsx("span",{className:"truncate text-xs text-fg-subtle",children:y.connectionName}),y.paused&&t.jsx("span",{className:"rounded bg-surface-3 px-1 text-[9px] uppercase",children:"paused"}),t.jsxs("span",{className:"num ml-auto text-xs text-fg-subtle",children:[ft(y.waiting)," waiting"]}),y.failed>0&&t.jsxs("span",{className:"num text-xs text-danger",children:[ft(y.failed)," failed"]}),b===d&&t.jsx(vN,{className:"size-3.5 text-fg-subtle","aria-hidden":!0})]},y.key))]})]})})}function bS(e,n){if(!e)return 1;const r=n.queue.toLowerCase();if(r===e)return 100;if(r.startsWith(e))return 80;if(r.includes(e))return 60;if(n.connectionName.toLowerCase().includes(e))return 20;let i=0;for(let o=0;o<r.length&&i<e.length;o++)r[o]===e[i]&&i++;return i===e.length?10:0}function wS({text:e,needle:n}){const r=n.trim().toLowerCase();if(!r)return t.jsx(t.Fragment,{children:e});const i=e.toLowerCase().indexOf(r);return i<0?t.jsx(t.Fragment,{children:e}):t.jsxs(t.Fragment,{children:[e.slice(0,i),t.jsx("mark",{className:"rounded-sm bg-accent/25 text-fg",children:e.slice(i,i+r.length)}),e.slice(i+r.length)]})}const Co=new Map;let du=null,dv=Number.POSITIVE_INFINITY,H0=Date.now();function NS(){document.hidden||(H0=Date.now(),Co.forEach((e,n)=>n()))}function hv(){const e=Co.size?Math.min(...Co.values()):Number.POSITIVE_INFINITY;e!==dv&&(du&&clearInterval(du),du=null,dv=e,Number.isFinite(e)&&(du=setInterval(NS,e)))}function ol(e=15e3){const[,n]=w.useState(0);return w.useEffect(()=>{const r=()=>n(i=>i+1);return Co.set(r,e),hv(),()=>{Co.delete(r),hv()}},[e]),H0}function Yt({value:e,className:n,withAbsolute:r,emptyText:i="–"}){const o=ol(),c=Vo(e);if(c==null)return t.jsx("span",{className:F("text-fg-subtle",n),children:i});const d=gn(c);return t.jsxs("time",{dateTime:new Date(c).toISOString(),title:d,className:F("num whitespace-nowrap",n),children:[Kr(c,o),r&&t.jsx("span",{className:"ml-1.5 text-fg-subtle",children:d})]})}const kS="only leaves the list · jobs untouched · reversible",K0="Hide this queue from the lists. Nothing is deleted: the jobs, the workers and the alerts stay exactly as they are, and you can bring it back at any time. (Not to be confused with Obliterate, which deletes the queue and all its jobs for good.)",W0="Removed from the lists only. No job was deleted.";function _m(e){var o;const n=_2(e),r=(c,d={})=>n.mutate({queue:c,hidden:!1},{onSuccess:()=>{d.silent||X.success(`${c} is visible again`)},onError:h=>X.error(ve(h))});return{hide:c=>n.mutate({queue:c,hidden:!0},{onSuccess:()=>X.undoable(`${c} hidden`,{label:"Undo",onClick:()=>r(c,{silent:!0})},W0),onError:d=>X.error(ve(d))}),unhide:r,isPending:n.isPending,pendingQueue:n.isPending?((o=n.variables)==null?void 0:o.queue)??null:null}}function SS(){const e=Ke(),n=async(o,c,d)=>{const h=d?await ee.post(`/connections/${ze(o)}/hidden-queues`,{queueName:c}):await ee.del(`/connections/${ze(o)}/hidden-queues/${ze(c)}`);e.setQueryData(se.hiddenQueues(o),h),e.invalidateQueries({queryKey:se.queues(o)}),e.invalidateQueries({queryKey:se.overview(o)})},r=(o,c,d={})=>n(o,c,!1).then(()=>{d.silent||X.success(`${c} is visible again`)},h=>X.error(ve(h)));return{hide:(o,c)=>n(o,c,!0).then(()=>X.undoable(`${c} hidden`,{label:"Undo",onClick:()=>void r(o,c,{silent:!0})},W0),d=>X.error(ve(d))),unhide:r}}function CS({connectionId:e,queueName:n}){var d;const{isOperator:r}=mt(),i=I0(e),o=_m(e),c=(d=i.data)==null?void 0:d.find(h=>h.queueName===n);return c?t.jsxs("div",{role:"status",className:"mx-auto flex w-full max-w-none flex-wrap items-center gap-x-3 gap-y-1.5 border-b border-warning/40 bg-warning/10 px-5 py-2 text-xs text-fg",children:[t.jsx(Fo,{className:"size-3.5 shrink-0 text-warning","aria-hidden":!0}),t.jsxs("span",{children:[t.jsx("span",{className:"font-medium",children:"This queue is hidden."})," It does not appear in the sidebar, the cards or the tables. Nothing was deleted — the jobs, the workers and the alerts are untouched."]}),t.jsxs("span",{className:"text-fg-subtle",children:["hidden ",t.jsx(Yt,{value:c.hiddenAt,className:"text-xs"}),c.hiddenByName&&` by ${c.hiddenByName}`]}),r&&t.jsx(V,{size:"xs",variant:"secondary",className:"ml-auto",leftIcon:t.jsx(Qy,{}),loading:o.pendingQueue===n,onClick:()=>o.unhide(n),children:"Show again"})]}):null}function _S(){const[e,n]=w.useState(!1),[r,i]=w.useState(!1),o=Ln(),c=Mg("/c/:connectionId/q/:queue/*"),d=Mg("/c/:connectionId/q/:queue"),h=c??d,f=w.useCallback(()=>n(!0),[]);return S0("k",g=>{g.preventDefault(),n(p=>!p)},{mod:!0,allowInInputs:!0}),w.useEffect(()=>{i(!1)},[o.pathname]),t.jsxs("div",{className:"flex h-screen w-full overflow-hidden bg-bg",children:[t.jsx(cv,{onOpenSwitcher:f,className:"hidden lg:flex"}),r&&t.jsxs("div",{className:"fixed inset-0 z-40 flex lg:hidden",children:[t.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>i(!1),"aria-hidden":!0}),t.jsx(cv,{onOpenSwitcher:f,onNavigate:()=>i(!1),className:"relative z-10 shadow-[var(--shadow)]"})]}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx(gS,{onOpenSwitcher:f,onToggleSidebar:()=>i(g=>!g)}),t.jsxs("main",{className:F("min-h-0 flex-1 overflow-y-auto"),children:[(h==null?void 0:h.params.connectionId)&&h.params.queue&&t.jsx(CS,{connectionId:h.params.connectionId,queueName:h.params.queue}),t.jsx(fy,{})]})]}),t.jsx(jS,{open:e,onClose:()=>n(!1)})]})}function bt({children:e,className:n,wide:r}){return t.jsx("div",{className:F("mx-auto w-full px-5 py-5",r?"max-w-none":"max-w-[1400px]",n),children:e})}function gs({title:e,description:n,actions:r,className:i}){return t.jsxs("div",{className:F("mb-4 flex flex-wrap items-start justify-between gap-3",i),children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"truncate text-lg font-semibold tracking-tight text-fg",children:e}),n&&t.jsx("p",{className:"mt-0.5 text-xs text-fg-muted",children:n})]}),r&&t.jsx("div",{className:"flex flex-wrap items-center gap-2",children:r})]})}function rd({label:e,hint:n,error:r,htmlFor:i,className:o,children:c,inline:d}){return t.jsxs("div",{className:F(d?"flex items-center gap-3":"flex flex-col gap-1",o),children:[e&&t.jsx("label",{htmlFor:i,className:"text-xs font-medium text-fg-muted",children:e}),c,r?t.jsx("p",{className:"text-xs text-danger",role:"alert",children:r}):n?t.jsx("p",{className:"text-xs text-fg-subtle",children:n}):null]})}const Te=w.forwardRef(function({label:n,hint:r,error:i,mono:o,className:c,wrapperClassName:d,id:h,leftIcon:f,...g},p){const v=w.useId(),j=h??v,S=t.jsxs("div",{className:F("relative",f&&"[&_svg]:pointer-events-none"),children:[f&&t.jsx("span",{className:"pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-fg-subtle [&_svg]:size-3.5",children:f}),t.jsx("input",{ref:p,id:j,"aria-invalid":i?!0:void 0,className:F("control",o&&"font-mono",f&&"pl-8",c),...g})]});return!n&&!r&&!i?S:t.jsx(rd,{label:n,hint:r,error:i,htmlFor:j,className:d,children:S})}),Yi=w.forwardRef(function({label:n,hint:r,error:i,mono:o,className:c,wrapperClassName:d,id:h,...f},g){const p=w.useId(),v=h??p,j=t.jsx("textarea",{ref:g,id:v,"aria-invalid":i?!0:void 0,className:F("control",o&&"font-mono text-xs",c),...f});return!n&&!r&&!i?j:t.jsx(rd,{label:n,hint:r,error:i,htmlFor:v,className:d,children:j})}),dt=w.forwardRef(function({label:n,hint:r,error:i,className:o,wrapperClassName:c,id:d,options:h,children:f,...g},p){const v=w.useId(),j=d??v,S=t.jsx("select",{ref:p,id:j,"aria-invalid":i?!0:void 0,className:F("control",o),...g,children:h?h.map(y=>t.jsx("option",{value:y.value,disabled:y.disabled,children:y.label},y.value)):f});return!n&&!r&&!i?S:t.jsx(rd,{label:n,hint:r,error:i,htmlFor:j,className:c,children:S})}),Pm=w.forwardRef(function({label:n,description:r,className:i,id:o,...c},d){const h=w.useId(),f=o??h;return t.jsxs("label",{htmlFor:f,className:F("flex cursor-pointer items-start gap-2 text-[13px] select-none",i),children:[t.jsx("input",{ref:d,id:f,type:"checkbox",className:"mt-0.5 size-3.5 shrink-0 cursor-pointer accent-[var(--accent)]",...c}),(n||r)&&t.jsxs("span",{className:"flex flex-col",children:[n&&t.jsx("span",{className:"text-fg",children:n}),r&&t.jsx("span",{className:"text-xs text-fg-subtle",children:r})]})]})});function el({checked:e,onChange:n,disabled:r,label:i,className:o,size:c="md"}){const d=c==="sm"?"h-4 w-7":"h-5 w-9",h=c==="sm"?"size-3":"size-4",f=c==="sm"?"translate-x-3":"translate-x-4";return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,disabled:r,onClick:()=>n(!e),className:F("relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-colors outline-none focus-visible:ring-2 focus-visible:ring-accent/60 disabled:opacity-50",d,e?"bg-accent":"bg-surface-3",o),children:t.jsx("span",{className:F("inline-block rounded-full bg-white shadow transition-transform",h,e?f:"translate-x-0.5")})})}function Z0({title:e,description:n,children:r,footer:i}){return t.jsx("div",{className:"flex min-h-screen items-center justify-center bg-bg px-4 py-10",children:t.jsxs("div",{className:"w-full max-w-sm",children:[t.jsxs("div",{className:"mb-6 flex items-center justify-center gap-2",children:[t.jsx(km,{className:"size-8"}),t.jsx("span",{className:"text-base font-semibold tracking-tight",children:"Bullpane"}),t.jsx(Nm,{})]}),t.jsxs("div",{className:"card p-6 shadow-[var(--shadow)]",children:[t.jsx("h1",{className:"text-base font-semibold text-fg",children:e}),n&&t.jsx("p",{className:"mt-1 text-xs text-fg-muted",children:n}),t.jsx("div",{className:"mt-5",children:r})]}),i&&t.jsx("div",{className:"mt-4 text-center text-xs text-fg-subtle",children:i})]})})}function PS(){var de;const{login:e,needsSetup:n}=mt(),{demo:r}=wt(),i=un(),o=Ln(),[c,d]=sl(),[h,f]=w.useState(""),[g,p]=w.useState(""),[v,j]=w.useState(null),[S,y]=w.useState({}),[b,k]=w.useState(!1),C=c.get("sso_error");w.useEffect(()=>{if(!C)return;j(C);const ce=new URLSearchParams(c);ce.delete("sso_error"),d(ce,{replace:!0})},[C,c,d]);const{data:z}=H2(),O=(z==null?void 0:z.providers)??[],T=O.length>0,M=(z==null?void 0:z.requireSso)??!1,[E,I]=w.useState(!1),Q=!M||E;if(n)return t.jsx(Vr,{to:"/setup",replace:!0});const H=(de=o.state)==null?void 0:de.from,q=H!=null&&H.pathname?`${H.pathname}${H.search??""}`:void 0,B=async ce=>{ce.preventDefault(),j(null);const Ne=jk.safeParse({email:h.trim(),password:g});if(!Ne.success){const Ie={};for(const ot of Ne.error.issues)Ie[ot.path[0]]=ot.message;y(Ie);return}y({}),k(!0);try{await e(Ne.data),i(q??"/",{replace:!0})}catch(Ie){Ts(Ie)&&Ie.status===401?j(ve(Ie,"Invalid email or password")):j(ve(Ie))}finally{k(!1)}};return t.jsxs(Z0,{title:"Sign in",description:r?"Demo playground: Pro features are unlocked, settings are read-only.":M?"This installation signs in through your identity provider.":"Use the account created during setup.",footer:t.jsxs(t.Fragment,{children:["Self-hosted dashboard for BullMQ ·"," ",t.jsx(Ee,{to:"/setup",className:"hover:text-fg",children:"first run?"})]}),children:[v&&t.jsx("p",{role:"alert",className:"mb-3 rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger",children:v}),T&&t.jsx("div",{className:"space-y-2",children:O.map(ce=>t.jsxs(V,{variant:"secondary",className:"w-full",leftIcon:t.jsx(Gu,{className:"size-4"}),onClick:()=>{const Ne=`/api/auth/sso/${encodeURIComponent(ce.id)}/start`;window.location.href=q?`${Ne}?next=${encodeURIComponent(q)}`:Ne},children:["Sign in with ",ce.name]},ce.id))}),T&&Q&&t.jsxs("div",{className:"my-4 flex items-center gap-3",children:[t.jsx("span",{className:"h-px flex-1 bg-border"}),t.jsx("span",{className:"text-[11px] uppercase tracking-wide text-fg-subtle",children:"or"}),t.jsx("span",{className:"h-px flex-1 bg-border"})]}),Q?t.jsxs("form",{onSubmit:B,className:"space-y-3",noValidate:!0,children:[t.jsx(Te,{label:"Email",type:"email",autoComplete:"username",autoFocus:!T,value:h,onChange:ce=>f(ce.target.value),error:S.email,required:!0}),t.jsx(Te,{label:"Password",type:"password",autoComplete:"current-password",value:g,onChange:ce=>p(ce.target.value),error:S.password,required:!0}),M&&t.jsx("p",{className:"text-[11px] text-fg-subtle",children:(z==null?void 0:z.passwordEscapeHatch)==="all"?"Password sign-in is allowed for everyone on this installation (BULLPANE_ALLOW_PASSWORD_LOGIN).":"Password sign-in works for admin accounts only, so a misconfigured provider cannot lock you out."}),t.jsx(V,{type:"submit",variant:"primary",className:"w-full",loading:b,children:"Sign in"})]}):t.jsx("div",{className:"mt-4 text-center",children:t.jsx(V,{variant:"link",size:"sm",leftIcon:t.jsx(al,{className:"size-3.5"}),onClick:()=>I(!0),children:"Sign in with a password instead"})})]})}function ES(){const{setup:e,needsSetup:n,loading:r}=mt(),i=un(),[o,c]=w.useState({name:"",email:"",password:"",confirm:""}),[d,h]=w.useState({}),[f,g]=w.useState(null),[p,v]=w.useState(!1);if(!r&&!n)return t.jsx(Vr,{to:"/login",replace:!0});const j=y=>b=>c(k=>({...k,[y]:b.target.value})),S=async y=>{y.preventDefault(),g(null);const b=yk.safeParse({name:o.name.trim(),email:o.email.trim(),password:o.password}),k={};if(!b.success)for(const C of b.error.issues)k[String(C.path[0])]=C.message;if(o.password!==o.confirm&&(k.confirm="Passwords do not match"),h(k),!(Object.keys(k).length>0||!b.success)){v(!0);try{await e(b.data),i("/",{replace:!0})}catch(C){Ts(C)&&C.status===409?g("Setup was already completed. Sign in instead."):g(ve(C))}finally{v(!1)}}};return t.jsx(Z0,{title:"Create the admin account",description:"This is the first run. The account you create here is the administrator of this installation.",children:t.jsxs("form",{onSubmit:S,className:"space-y-3",noValidate:!0,children:[t.jsx(Te,{label:"Name",autoFocus:!0,autoComplete:"name",value:o.name,onChange:j("name"),error:d.name,required:!0}),t.jsx(Te,{label:"Email",type:"email",autoComplete:"username",value:o.email,onChange:j("email"),error:d.email,required:!0}),t.jsx(Te,{label:"Password",type:"password",autoComplete:"new-password",value:o.password,onChange:j("password"),error:d.password,hint:"At least 8 characters",required:!0}),t.jsx(Te,{label:"Confirm password",type:"password",autoComplete:"new-password",value:o.confirm,onChange:j("confirm"),error:d.confirm,required:!0}),f&&t.jsx("p",{role:"alert",className:"rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger",children:f}),t.jsx(V,{type:"submit",variant:"primary",className:"w-full",loading:p,children:"Create account"})]})})}const Ia=e=>`${e.connection.id}/${e.queue.name}`;function Hf(e,n){const r=[];if(n&&n.length>0){const o=new Map(e.map(p=>[Ia(p),p])),c=new Set,d=n.filter(p=>!p.parentId).sort(fv),h=p=>n.filter(v=>v.parentId===p).sort(fv),f=(p,v)=>{const j=[];for(const S of p.queues){const y=`${S.connectionId}/${S.queueName}`,b=o.get(y);b&&(j.push(b),c.add(y))}j.length>0&&r.push({id:`folder:${p.id}`,title:v,color:p.color,kind:"folder",items:Yh(j)})};for(const p of d){f(p,p.name);for(const v of h(p.id))f(v,`${p.name} / ${v.name}`)}const g=e.filter(p=>!c.has(Ia(p)));return g.length>0&&r.push({id:"leftover",title:"Queues without folder",kind:"leftover",items:Yh(g)}),r}const i=new Map;for(const o of e){let c=i.get(o.connection.id);c||(c={id:`conn:${o.connection.id}`,title:o.connection.name,kind:"connection",items:[]},i.set(o.connection.id,c)),c.items.push(o)}for(const o of i.values())o.items=Yh(o.items);return[...i.values()]}function fv(e,n){return e.position-n.position||e.name.localeCompare(n.name)}function Yh(e){return[...e].sort((n,r)=>r.queue.counts.failed-n.queue.counts.failed||r.queue.counts.waiting-n.queue.counts.waiting||n.queue.name.localeCompare(r.queue.name))}function Em(e){return e.reduce((n,{queue:r})=>(n.queues+=1,r.isPaused&&(n.paused+=1),n.waiting+=r.counts.waiting+r.counts.prioritized,n.active+=r.counts.active,n.failed+=r.counts.failed,n.delayed+=r.counts.delayed,n.completed+=r.counts.completed,n),{queues:0,paused:0,waiting:0,active:0,failed:0,delayed:0,completed:0})}function Rm(e,n){const r=n.trim().toLowerCase();return r?e.queue.name.toLowerCase().includes(r)||e.connection.name.toLowerCase().includes(r):!0}const RS={failing:"failing now",paused:"paused",backlog:"backlog, no worker",waiting:"backlog over threshold",failed:"failed jobs"},MS=1;function TS(e,n=Lu){var g,p;const r=e.queue,i=r.counts,o=[],c=((g=r.rates)==null?void 0:g.failed)??0,d=(((p=r.rates)==null?void 0:p.completed)??0)+c;c>0&&o.push("failing"),r.isPaused&&o.push("paused");const h=i.waiting+i.prioritized,f=h>=MS&&i.active===0&&d===0&&!r.isPaused;return f&&o.push("backlog"),!f&&n.waitingAbove>0&&h>n.waitingAbove&&o.push("waiting"),n.failedAbove>0?i.failed>n.failedAbove&&o.push("failed"):o.length===0&&i.failed>0&&o.push("failed"),o}function Ei(e){return e>0?Math.min(Math.log10(e+1)*1e3,9999):0}const qS={failed_rate_above:1e6,failed_above:1e6,duration_above:7e5,waiting_above:7e5};function $S(e,n,r=[]){var h;const i=e.queue,o=i.counts;let c=0,d=0;for(const f of r){const g=f.threshold>0?f.value/f.threshold:f.value;d=Math.max(d,qS[f.kind]+Ei(g*100))}return c+=d,n.includes("failing")&&(c+=1e6+Ei(((h=i.rates)==null?void 0:h.failed)??0)),n.includes("paused")&&(c+=5e5+Ei(o.waiting+o.active)),n.includes("backlog")&&(c+=1e5+Ei(o.waiting+o.prioritized)),n.includes("waiting")&&(c+=5e4+Ei(o.waiting+o.prioritized)),n.includes("failed")&&(c+=Ei(o.failed)),c}const IS=["paused","backlog"];function mv(e,n){return`${e}\0${n}`}function zS(e,n=Lu,r=8,i){const o=[],c=[],d=new Map;for(const h of i??[]){const f=mv(h.connectionId,h.queueName),g=d.get(f);g?g.push(h):d.set(f,[h])}for(const h of e){const f=TS(h,n),g=i?f.filter(v=>IS.includes(v)):f,p=d.get(mv(h.connection.id,h.queue.name))??[];g.length>0||p.length>0?o.push({entry:h,reasons:g,findings:p,score:$S(h,g,p)}):c.push(h)}return o.sort((h,f)=>f.score-h.score||h.entry.queue.name.localeCompare(f.entry.queue.name)),{attention:OS(o,r),hidden:Math.max(0,o.length-r),rest:c}}function OS(e,n){if(e.length<=n)return e;const r=new Map;for(const c of e){const d=c.entry.connection.id,h=r.get(d);h?h.push(c):r.set(d,[c])}const i=[...r.values()],o=[];for(let c=0;o.length<n;c++){let d=!1;for(const h of i)if(!(c>=h.length)&&(o.push(h[c]),d=!0,o.length===n))break;if(!d)break}return o}function Mm(e,n,r){const[i,o]=sl(),c=w.useMemo(()=>{const g=pv(i.get("sort"),i.get("dir"),r);if(g)return g;const p=Yu(`table.${e}.sort`,null);return p&&typeof p=="object"&&pv(p.key,p.dir,r)?p:n},[i,e,n,r]),d=i.get("filter")??"",h=w.useCallback(g=>{So(`table.${e}.sort`,g),o(p=>{const v=new URLSearchParams(p);return v.set("sort",g.key),v.set("dir",g.dir),v},{replace:!0})},[o,e]),f=w.useCallback(g=>{o(p=>{const v=new URLSearchParams(p);return g.trim()?v.set("filter",g):v.delete("filter"),v},{replace:!0})},[o]);return{sort:c,setSort:h,filter:d,setFilter:f}}function pv(e,n,r){return!e||r&&!r.includes(e)?null:{key:e,dir:n==="asc"?"asc":"desc"}}function Ks(e,n,r=!1){const i=`var(--state-${e})`;return{label:n,fg:i,bg:`color-mix(in srgb, ${i} 14%, transparent)`,border:`color-mix(in srgb, ${i} 38%, transparent)`,dotClass:AS[e],textClass:LS[e],muted:r}}const AS={completed:"bg-state-completed",active:"bg-state-active",waiting:"bg-state-waiting",delayed:"bg-state-delayed",failed:"bg-state-failed",prioritized:"bg-state-prioritized",paused:"bg-state-paused","waiting-children":"bg-state-waiting-children",unknown:"bg-state-unknown"},LS={completed:"text-state-completed",active:"text-state-active",waiting:"text-state-waiting",delayed:"text-state-delayed",failed:"text-state-failed",prioritized:"text-state-prioritized",paused:"text-state-paused","waiting-children":"text-state-waiting-children",unknown:"text-state-unknown"},lt={completed:Ks("completed","completed"),active:Ks("active","active"),waiting:Ks("waiting","waiting"),delayed:Ks("delayed","delayed"),failed:Ks("failed","failed"),prioritized:Ks("prioritized","prioritized",!0),paused:Ks("paused","paused",!0),"waiting-children":Ks("waiting-children","waiting-children",!0),unknown:Ks("unknown","unknown",!0)};function ad(e){return e&&lt[e]||lt.unknown}function FS(e){const n=ad(e);return{"--chip-fg":n.fg,"--chip-bg":n.bg,"--chip-border":n.border}}const DS=["completed","active","waiting","delayed","failed"],US=["prioritized","paused","waiting-children"];function tl({values:e,width:n=96,height:r=22,className:i,stroke:o="currentColor",fill:c=!0,title:d,zeroBased:h=!0,dimmed:f}){const g=w.useId(),p=(e??[]).map(Q=>typeof Q=="number"&&Number.isFinite(Q)?Q:null),v=p.filter(Q=>Q!==null);if(v.length<2)return t.jsx("span",{className:F("inline-block text-fg-subtle/40",i),style:{width:n,height:r},"aria-hidden":!0,children:t.jsx("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,children:t.jsx("line",{x1:0,y1:r-1,x2:n,y2:r-1,stroke:"currentColor",strokeDasharray:"2 3"})})});const j=Math.max(...v),S=h?Math.min(0,...v):Math.min(...v),y=j===S?j+1:j,b=j===S?S-(h?0:1):S,k=1.5,C=p.length>1?(n-k*2)/(p.length-1):0,z=Q=>r-k-(Q-b)/(y-b||1)*(r-k*2),O=[];let T=null;p.forEach((Q,H)=>{if(Q===null){T=null;return}const q=[k+H*C,z(Q)];T?T.pts.push(q):(T={pts:[q]},O.push(T))});const M=Q=>Q.map(([H,q],B)=>`${B===0?"M":"L"}${H.toFixed(1)},${q.toFixed(1)}`).join(" "),E=O[O.length-1],I=E==null?void 0:E.pts[E.pts.length-1];return t.jsxs("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,className:F("inline-block overflow-visible align-middle",f&&"opacity-40",i),role:"img","aria-label":d??`Sparkline, ${v.length} points`,children:[d&&t.jsx("title",{children:d}),c&&t.jsx("defs",{children:t.jsxs("linearGradient",{id:`g-${g}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:o,stopOpacity:.35}),t.jsx("stop",{offset:"100%",stopColor:o,stopOpacity:0})]})}),O.map((Q,H)=>{if(Q.pts.length<2){const[ce,Ne]=Q.pts[0];return t.jsx("circle",{cx:ce,cy:Ne,r:1.4,fill:o},H)}const q=M(Q.pts),B=Q.pts[0][0],de=Q.pts[Q.pts.length-1][0];return t.jsxs("g",{children:[c&&t.jsx("path",{d:`${q} L${de.toFixed(1)},${r} L${B.toFixed(1)},${r} Z`,fill:`url(#g-${g})`}),t.jsx("path",{d:q,fill:"none",stroke:o,strokeWidth:1.4,strokeLinejoin:"round",strokeLinecap:"round"})]},H)}),I&&t.jsx("circle",{cx:I[0],cy:I[1],r:1.8,fill:o})]})}const QS=Object.fromEntries(["waiting","active","completed","failed","delayed","prioritized","paused","waiting-children","unknown"].map(e=>{const n=ad(e);return[e,{label:n.label,dot:n.dotClass,color:n.fg,text:n.textClass}]}));function G0({state:e,size:n,className:r}){const i=ad(e);return t.jsx(be,{variant:"custom",size:n,dot:!0,className:F("border",r),style:{color:i.fg,background:i.bg,borderColor:i.border},children:i.label})}function xv({state:e,count:n,hideZero:r,short:i,className:o,title:c,to:d}){if(r&&!n)return null;const h=ad(e),f=i&&e==="waiting-children"?"children":h.label,g=t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"opacity-80",children:f}),t.jsx("span",{className:"num font-semibold",children:ft(n)})]}),p=h.muted?void 0:FS(e),v=c??`${ft(n)} ${h.label}`;return d?t.jsx(Ee,{to:d,className:F("state-chip relative z-10 hover:brightness-125 hover:underline",h.muted&&"muted",o),style:p,title:`${v} — open the ${h.label} tab`,children:g}):t.jsx("span",{className:F("state-chip",h.muted&&"muted",o),style:p,title:v,children:g})}const Tm="This queue deletes completed jobs (removeOnComplete), so the sorted sets keep far fewer successes than failures and this ratio is probably too low. To measure it for real, create the Worker with metrics: { maxDataPoints: MetricsTime.ONE_WEEK }.",BS="From BullMQ's own metrics counters, which are recorded when each job finishes — unaffected by removeOnComplete.",VS="Counted from the completed/failed sorted sets over the trailing window.";function qm(e){return(e==null?void 0:e.retentionSkewed)===!0}function $m(e){return e?e.retentionSkewed?Tm:e.source==="metrics"?BS:VS:""}function J0({rates:e,className:n}){return qm(e)?t.jsx(Pe,{content:Tm,className:n,children:t.jsx(ts,{className:"size-3 shrink-0 text-warning","aria-label":"Success rate is unreliable: this queue prunes completed jobs"})}):null}function id({entry:e,showConnection:n,onHide:r,hidePending:i}){const{connection:o,queue:c}=e,d=c.counts,h=ue.queue(o.id,c.name,wo(d));return t.jsxs("article",{className:F("queue-card",c.isPaused&&"opacity-90",d.failed>0&&"border-state-failed/40"),"data-testid":"queue-card",children:[t.jsxs("header",{className:"flex min-w-0 items-start gap-1.5",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx(Ee,{to:h,className:"block truncate font-mono text-[13px] font-semibold text-fg after:absolute after:inset-0 after:content-[''] hover:underline",title:c.name,children:c.name}),n&&t.jsx("div",{className:"truncate text-[11px] text-fg-subtle",title:o.name,children:o.name})]}),t.jsxs("div",{className:"relative z-10 flex shrink-0 items-center gap-1",children:[c.isPro&&t.jsx(be,{variant:"pro",size:"xs",className:"tracking-wider",title:`BullMQ Pro · ${K(c.groupsCount)} groups`,children:"PRO"}),c.isPaused&&t.jsx(be,{variant:"warning",size:"xs",className:"tracking-wider",children:"PAUSED"}),t.jsx(Ee,{to:ue.queueSearch(o.id,c.name),className:"rounded p-0.5 text-fg-subtle hover:bg-surface-2 hover:text-fg",title:"Search jobs in this queue","aria-label":`Search jobs in ${c.name}`,children:t.jsx(Yn,{className:"size-3.5"})}),r&&t.jsx("button",{type:"button",disabled:i,onClick:()=>r(e),className:"rounded p-0.5 text-fg-subtle hover:bg-surface-2 hover:text-fg disabled:opacity-50",title:K0,"aria-label":`Hide ${c.name} from the lists`,children:t.jsx(Fo,{className:"size-3.5"})})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[DS.map(f=>t.jsx(xv,{state:f,count:d[f],to:ue.queue(o.id,c.name,f)},f)),US.map(f=>t.jsx(xv,{state:f,count:d[f],hideZero:!0,short:!0,to:ue.queue(o.id,c.name,f)},f))]}),t.jsxs("footer",{className:"mt-auto flex items-center gap-2 border-t border-border pt-2",children:[t.jsx(Im,{rates:c.rates,className:"min-w-0 flex-1"}),c.metrics&&c.metrics.completed.length>1&&t.jsx("span",{className:"shrink-0",style:{color:lt.completed.fg},children:t.jsx(tl,{values:c.metrics.completed,width:56,height:14,title:"Completed per minute"})})]})]})}function X0(e){return e?e%1440===0?`${e/1440}d`:e%60===0?`${e/60}h`:`${e}m`:"1h"}function Im({rates:e,className:n,compact:r}){const i=(e==null?void 0:e.successPct)??null,o=((e==null?void 0:e.completed)??0)+((e==null?void 0:e.failed)??0),c=X0(e==null?void 0:e.windowMinutes),d=qm(e),h=e?`${K(e.completed)} completed · ${K(e.failed)} failed in the last ${c}`:"no rate data",f=e?`${h}
534
+
535
+ ${$m(e)}`:h;return t.jsxs("div",{className:F("flex flex-col gap-1",n),title:f,children:[t.jsx("div",{className:F("flex h-1.5 w-full overflow-hidden rounded-full bg-surface-3",d&&"opacity-50"),role:"img","aria-label":i==null?`No finished jobs in the last ${c}`:`${En(i)} success in the last ${c}${d?", unreliable: this queue prunes completed jobs":""}`,children:i!=null&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"h-full",style:{width:`${i}%`,background:lt.completed.fg}}),t.jsx("span",{className:"h-full flex-1",style:{background:lt.failed.fg,opacity:i>=100?0:1}})]})}),!r&&t.jsx("span",{className:"num flex min-w-0 items-center gap-1 text-[11px] text-fg-muted",children:i==null?t.jsxs("span",{className:"truncate text-fg-subtle",children:["no finished jobs · ",c]}):t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:F("truncate",d&&"opacity-60"),children:[t.jsxs("span",{className:F("font-medium",i<90?"text-state-failed":"text-fg"),children:[En(i)," ok"]}),t.jsxs("span",{className:"text-fg-subtle",children:[" · ",c]}),o>0&&t.jsxs("span",{className:"text-fg-subtle",children:[" · ",K(o)," finished"]})]}),t.jsx(J0,{rates:e})]})})]})}function Y0({sections:e,showConnection:n,hideSingleHeader:r,className:i,onHide:o,hidePendingKey:c}){const d=e.length===1&&r;return t.jsx("div",{className:F("space-y-4",i),children:e.map(h=>t.jsxs("section",{"aria-label":h.title,children:[!d&&t.jsxs("h3",{className:"mb-1.5 flex items-center gap-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:[h.kind==="folder"?t.jsx(sr,{className:"size-3.5",style:{color:h.color??"var(--fg-subtle)"},"aria-hidden":!0}):h.kind==="connection"?t.jsx(Zy,{className:"size-3.5","aria-hidden":!0}):t.jsx(By,{className:"size-3.5","aria-hidden":!0}),t.jsx("span",{className:"truncate normal-case tracking-normal text-fg-muted",children:h.title}),t.jsx("span",{className:"num font-normal",children:h.items.length})]}),t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(auto-fill, minmax(230px, 1fr))"},children:h.items.map(f=>t.jsx(id,{entry:f,showConnection:n,onHide:o,hidePending:c===Ia(f)},`${f.connection.id}/${f.queue.name}`))})]},h.id))})}function zm({count:e=6}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(auto-fill, minmax(230px, 1fr))"},children:Array.from({length:e},(n,r)=>t.jsx("div",{className:"card h-[118px] animate-pulse"},r))})}function HS({sections:e,showConnection:n,defaultOpen:r,storagePrefix:i="overview.group",className:o}){return e.length===0?null:t.jsx("div",{className:F("space-y-1.5",o),children:e.map(c=>t.jsx(KS,{section:c,showConnection:n,defaultOpen:r,storagePrefix:i},c.id))})}function KS({section:e,showConnection:n,defaultOpen:r,storagePrefix:i}){const[o,c]=ed(`${i}.${e.id}`,r),d=Em(e.items),h=e.kind==="folder"?sr:e.kind==="connection"?Zy:By;return t.jsxs("section",{className:"card overflow-hidden","aria-label":e.title,children:[t.jsxs("button",{type:"button",onClick:c,"aria-expanded":o,className:F("flex w-full flex-wrap items-center gap-x-4 gap-y-1 px-3 py-2 text-left transition-colors hover:bg-surface-2",o&&"border-b border-border"),children:[o?t.jsx(ps,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}):t.jsx(Dn,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),t.jsx(h,{className:"size-3.5 shrink-0",style:{color:e.color??"var(--fg-subtle)"},"aria-hidden":!0}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium text-fg",title:e.title,children:e.title}),t.jsxs("span",{className:"num shrink-0 text-xs text-fg-subtle",children:[d.queues," ",d.queues===1?"queue":"queues",d.paused>0&&t.jsxs("span",{className:"text-state-paused",children:[" · ",d.paused," paused"]})]}),t.jsxs("span",{className:"flex shrink-0 flex-wrap items-center gap-x-3 gap-y-0.5",children:[t.jsx(ef,{state:"waiting",value:d.waiting}),t.jsx(ef,{state:"active",value:d.active}),t.jsx(ef,{state:"failed",value:d.failed,dimZero:!0})]})]}),o&&t.jsx("div",{className:"grid gap-2 p-2",style:{gridTemplateColumns:"repeat(auto-fill, minmax(230px, 1fr))"},children:e.items.map(f=>t.jsx(id,{entry:f,showConnection:n},`${f.connection.id}/${f.queue.name}`))})]})}function ef({state:e,value:n,dimZero:r}){const i=lt[e],o=r&&n===0;return t.jsxs("span",{className:"flex items-baseline gap-1",title:`${n} ${i.label}`,children:[t.jsx("span",{className:F("status-dot size-1.5 self-center",i.dotClass,o&&"opacity-40"),"aria-hidden":!0}),t.jsx("span",{className:F("num text-xs font-medium",o?"text-fg-subtle":i.textClass),children:ft(n)}),t.jsx("span",{className:"text-[10px] text-fg-subtle",children:i.label})]})}function WS({items:e,hidden:n,showConnection:r,filtered:i,rules:o,className:c}){const d=o&&o.unmeasured>0&&t.jsx(Pe,{content:"Their Workers keep no BullMQ metrics, so failure rules cannot judge them. Turn on metrics: { maxDataPoints } in the Worker options.",children:t.jsxs(Ee,{to:ue.alerts,className:"inline-flex items-center gap-1 text-[11px] text-fg-subtle hover:text-fg",children:[t.jsx(Ha,{className:"size-3","aria-hidden":!0}),K(o.unmeasured)," ",o.unmeasured===1?"queue":"queues"," not measurable"]})});return e.length===0?t.jsxs("section",{"aria-label":"Needs attention",className:F("card flex flex-wrap items-center gap-2 px-4 py-2.5",c),children:[t.jsx(cm,{className:"size-4 shrink-0 text-state-completed","aria-hidden":!0}),t.jsxs("p",{className:"text-xs text-fg-muted",children:[i?"Nothing matching the filter needs attention":"No queue needs attention",t.jsx("span",{className:"text-fg-subtle",children:o?o.rules>0?" — no rule broken, nothing paused or stuck. ":" — nothing paused or stuck, and no rule is set. ":" — nothing failing, paused or over the thresholds."}),o&&t.jsx(Ee,{to:ue.alerts,className:"text-accent hover:underline",children:o.rules>0?`${o.rules} ${o.rules===1?"rule":"rules"} watching`:"Add a rule"})]}),d&&t.jsx("span",{className:"ml-auto",children:d})]}):t.jsxs("section",{"aria-label":"Needs attention",className:c,children:[t.jsxs("h2",{className:"mb-1.5 flex items-center gap-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:[t.jsx(ts,{className:"size-3.5 text-warning","aria-hidden":!0}),t.jsx("span",{className:"normal-case tracking-normal text-fg-muted",children:"Needs attention"}),t.jsx("span",{className:"num font-normal",children:K(e.length+n)}),n>0&&t.jsxs("span",{className:"font-normal normal-case tracking-normal text-fg-subtle",children:["· showing the ",e.length," worst, the rest are in the table below"]}),d&&t.jsx("span",{className:"ml-auto font-normal normal-case tracking-normal",children:d})]}),t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(auto-fill, minmax(230px, 1fr))"},children:e.map(({entry:h,reasons:f,findings:g})=>t.jsxs("div",{className:"relative flex flex-col gap-1",children:[t.jsx(id,{entry:h,showConnection:r}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[g.map(p=>t.jsx(JS,{finding:p},p.alertId)),f.map(p=>t.jsx(XS,{reason:p},p))]})]},`${h.connection.id}/${h.queue.name}`))})]})}const gu={failing:"border-state-failed/40 bg-state-failed/10 text-state-failed",paused:"border-state-paused/40 bg-state-paused/10 text-state-paused",backlog:"border-warning/40 bg-warning/10 text-warning",waiting:"border-warning/40 bg-warning/10 text-warning",failed:"border-state-failed/30 bg-state-failed/5 text-state-failed"},ZS={failed_rate_above:gu.failing,failed_above:gu.failing,duration_above:"border-state-delayed/40 bg-state-delayed/10 text-state-delayed",waiting_above:gu.waiting};function tf(e,n){return e.unit==="%"?`${n}%`:e.unit==="s"?n>=10?`${Math.round(n)}s`:n>=1?`${n.toFixed(1)}s`:`${Math.round(n*1e3)}ms`:K(n)}function GS(e){const n=e.windowMinutes?` · ${e.windowMinutes>=60&&e.windowMinutes%60===0?`${e.windowMinutes/60}h`:`${e.windowMinutes}m`}`:"",r=` > ${tf(e,e.threshold)}`;switch(e.kind){case"failed_rate_above":return`${tf(e,e.value)} failed${n}${r}`;case"failed_above":return`${K(e.value)} failed${n}${r}`;case"duration_above":return`p${e.percentile??95} ${tf(e,e.value)}${n}${r}`;case"waiting_above":return`${K(e.value)} waiting${r}`}}function JS({finding:e}){return t.jsx(Pe,{content:`Rule "${e.alertName}"${e.notifies?"":" · dashboard only, notifies nobody"}`,children:t.jsxs(Ee,{to:ue.alerts,className:F("inline-flex items-center gap-1 rounded border px-1.5 py-px text-[10px] font-medium hover:brightness-110",ZS[e.kind]),children:[!e.notifies&&t.jsx(fN,{className:"size-2.5 opacity-70","aria-hidden":!0}),t.jsx("span",{className:"num",children:GS(e)})]})})}function XS({reason:e}){return t.jsx("span",{className:F("rounded border px-1.5 py-px text-[10px] font-medium",gu[e]),children:RS[e]})}function ej({totals:e,title:n="All queues",className:r,children:i,hiddenCount:o=0,onRevealHidden:c}){return t.jsxs("div",{className:F("card flex flex-wrap items-center gap-x-5 gap-y-2 px-4 py-2.5",r),children:[t.jsxs("div",{className:"flex items-baseline gap-2",children:[t.jsx("h2",{className:"text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:n}),t.jsxs("span",{className:"num text-xs text-fg-muted",children:[K(e.queues)," ",e.queues===1?"queue":"queues",e.paused>0&&t.jsxs("span",{className:"text-state-paused",children:[" · ",K(e.paused)," paused"]})]}),o>0&&(c?t.jsxs("button",{type:"button",onClick:c,className:"num text-xs text-fg-subtle underline decoration-dotted underline-offset-2 hover:text-fg-muted",title:"These queues are hidden and are NOT included in the totals. Click to see them.",children:[K(o)," hidden"]}):t.jsxs("span",{className:"num text-xs text-fg-subtle",title:"These queues are hidden and are NOT included in the totals.",children:[K(o)," hidden"]}))]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[t.jsx(lo,{state:"waiting",value:e.waiting}),t.jsx(lo,{state:"active",value:e.active}),t.jsx(lo,{state:"delayed",value:e.delayed}),t.jsx(lo,{state:"failed",value:e.failed,dimZero:!0}),t.jsx(lo,{state:"completed",value:e.completed})]}),i&&t.jsx("div",{className:"ml-auto flex items-center gap-2",children:i})]})}function lo({state:e,value:n,dimZero:r}){const i=lt[e],o=r&&n===0;return t.jsxs("span",{className:"flex items-baseline gap-1.5",title:`${K(n)} ${i.label}`,children:[t.jsx("span",{className:F("status-dot size-2 self-center",i.dotClass,o&&"opacity-40"),"aria-hidden":!0}),t.jsx("span",{className:F("num text-sm font-semibold",o?"text-fg-muted":i.textClass),children:ft(n)}),t.jsx("span",{className:"text-xs text-fg-subtle",children:i.label})]})}function Om({value:e,onChange:n,className:r,placeholder:i="Filter queues…","aria-label":o="Filter queues by name or connection"}){return t.jsxs("div",{className:F("relative w-64",r),children:[t.jsx(Te,{leftIcon:t.jsx(Yn,{}),placeholder:i,value:e,onChange:c=>n(c.target.value),onKeyDown:c=>c.key==="Escape"&&n(""),className:"!h-7 pr-7 text-xs","aria-label":o}),e&&t.jsx("button",{type:"button",className:"absolute top-1/2 right-1.5 -translate-y-1/2 rounded p-0.5 text-fg-subtle hover:text-fg","aria-label":"Clear filter",onClick:()=>n(""),children:t.jsx(vn,{className:"size-3.5"})})]})}function ms({dense:e,className:n,wrapperClassName:r,maxHeight:i,children:o,...c}){return t.jsx("div",{className:F("table-wrap",i!=null&&"overflow-y-auto",r),style:i!=null?{maxHeight:i}:void 0,children:t.jsx("table",{className:F("data-table",e&&"dense",n),...c,children:o})})}function pe({align:e="left",className:n,...r}){return t.jsx("th",{scope:"col",className:F(e==="right"&&"!text-right",e==="center"&&"!text-center",n),...r})}function xe({align:e="left",num:n,mono:r,muted:i,className:o,...c}){return t.jsx("td",{className:F(e==="right"&&"text-right",e==="center"&&"text-center",n&&"num",r&&"font-mono text-xs",i&&"text-fg-muted",o),...c})}function cl({onActivate:e,selected:n,className:r,onClick:i,onKeyDown:o,...c}){const d=!!e;return t.jsx("tr",{tabIndex:d?0:void 0,"aria-selected":n||void 0,className:F(d&&"row-click",n&&"bg-accent/10",r),onClick:h=>{i==null||i(h),!(!d||h.defaultPrevented||h.target.closest("button, a, input, select, textarea, [data-no-row-click]"))&&(e==null||e())},onKeyDown:h=>{o==null||o(h),!(!d||h.defaultPrevented)&&h.target===h.currentTarget&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),e==null||e())},...c})}function yt({colSpan:e,children:n,className:r}){return t.jsx("tr",{children:t.jsx("td",{colSpan:e,className:F("!py-10 text-center text-fg-subtle",r),children:n})})}function YS(e,n){const r=e==null||e==="",i=n==null||n==="";if(r&&i)return 0;if(r)return 1;if(i)return-1;if(typeof e=="number"&&typeof n=="number")return e-n;if(typeof e=="boolean"&&typeof n=="boolean")return Number(e)-Number(n);const o=String(e),c=String(n),d=Number(o),h=Number(c);return o.trim()!==""&&c.trim()!==""&&!Number.isNaN(d)&&!Number.isNaN(h)?d-h:o.localeCompare(c,void 0,{numeric:!0,sensitivity:"base"})}function eC(e,n,r){const i=n.find(d=>d.key===r.key&&d.sortValue);if(!i)return e;const o=i.sortValue,c=r.dir==="asc"?1:-1;return e.map((d,h)=>({row:d,i:h,v:o(d)})).sort((d,h)=>{const f=YS(d.v,h.v);return f!==0&&(d.v==null||h.v==null||d.v===""||h.v==="")?f:f!==0?f*c:d.i-h.i}).map(d=>d.row)}function tC({columns:e,rows:n,rowKey:r,sort:i,onSort:o,onRowActivate:c,rowClassName:d,message:h,messageClassName:f,presorted:g,className:p,...v}){const j=w.useMemo(()=>g?n:eC(n,e,i),[n,e,i,g]),S=y=>{y.sortValue&&(i.key===y.key?o({key:y.key,dir:i.dir==="asc"?"desc":"asc"}):o({key:y.key,dir:y.defaultDir??(y.num||y.align==="right"?"desc":"asc")}))};return t.jsxs(ms,{className:p,...v,children:[t.jsx("thead",{children:t.jsx("tr",{children:e.map(y=>{const b=i.key===y.key&&!!y.sortValue,k=b?i.dir==="asc"?"ascending":"descending":y.sortValue?"none":void 0;return t.jsx(pe,{align:y.align,className:F(y.thClassName,b&&"!text-fg"),"aria-sort":k,children:y.sortValue?t.jsxs("button",{type:"button",className:F("sort-header",y.align==="right"&&"flex-row-reverse"),onClick:()=>S(y),title:`Sort by ${typeof y.header=="string"?y.header:y.key}`,children:[t.jsx("span",{children:y.header}),b?i.dir==="asc"?t.jsx(dN,{className:"size-3","aria-hidden":!0}):t.jsx(oN,{className:"size-3","aria-hidden":!0}):t.jsx(cN,{className:"size-3 opacity-40","aria-hidden":!0})]}):y.header},y.key)})})}),t.jsxs("tbody",{children:[h!=null&&j.length===0&&t.jsx(yt,{colSpan:e.length,className:f,children:h}),j.map(y=>t.jsx(cl,{onActivate:c?()=>c(y):void 0,className:d==null?void 0:d(y),children:e.map(b=>t.jsx(xe,{align:b.align,num:b.num,mono:b.mono,muted:typeof b.muted=="function"?b.muted(y):b.muted,className:b.className,"data-no-row-click":b.noRowClick?!0:void 0,children:b.render(y)},b.key))},r(y)))]})]})}const Am=["queue","connection","waiting","active","completed","failed","delayed","prioritized","waiting-children","success","paused","groups","trend","actions"],Lm={key:"failed",dir:"desc"};function Fm({rows:e,showConnection:n,sort:r,onSort:i,message:o,messageClassName:c,onToggle:d,pendingKey:h,onHide:f,hidePendingKey:g}){const p=un(),v=w.useMemo(()=>{var S,y;const j=[{key:"queue",header:"Queue",sortValue:b=>b.queue.name,render:b=>t.jsx(Ee,{to:ue.queue(b.connection.id,b.queue.name,wo(b.queue.counts)),className:"font-mono text-xs font-medium hover:underline",title:`${b.queue.prefix}:${b.queue.name}`,children:b.queue.name}),className:"max-w-72 truncate"}];return n&&j.push({key:"connection",header:"Connection",sortValue:b=>b.connection.name,render:b=>b.connection.name,muted:!0,className:"max-w-48 truncate"}),j.push(ya("waiting","Waiting",b=>b.queue.counts.waiting),ya("active","Active",b=>b.queue.counts.active),ya("completed","Completed",b=>b.queue.counts.completed,!0),ya("failed","Failed",b=>b.queue.counts.failed),ya("delayed","Delayed",b=>b.queue.counts.delayed,!0),ya("prioritized","Prioritized",b=>b.queue.counts.prioritized,!0),ya("waiting-children","Waiting-children",b=>b.queue.counts["waiting-children"],!0),{key:"success",header:`Success % (${X0((y=(S=e[0])==null?void 0:S.queue.rates)==null?void 0:y.windowMinutes)})`,align:"right",num:!0,sortValue:b=>{var k;return((k=b.queue.rates)==null?void 0:k.successPct)??null},render:b=>{const k=b.queue.rates,C=(k==null?void 0:k.successPct)??null,z=qm(k);return t.jsxs("span",{className:"inline-flex items-center justify-end gap-1.5",title:$m(k),children:[t.jsx(Im,{rates:k,compact:!0,className:"w-14"}),t.jsx("span",{className:F("num w-14 text-right",z&&"opacity-50",C==null?"text-fg-subtle":C<90?"font-semibold text-state-failed":"text-fg"),children:C==null?"–":En(C)}),t.jsx(J0,{rates:k,className:"w-3"})]})}},{key:"paused",header:"Paused",sortValue:b=>b.queue.isPaused,render:b=>b.queue.isPaused?t.jsx(be,{variant:"warning",size:"xs",className:"tracking-wider",children:"PAUSED"}):t.jsx("span",{className:"text-fg-subtle",children:"–"})},{key:"groups",header:"Groups",align:"right",num:!0,sortValue:b=>b.queue.isPro?b.queue.groupsCount:null,render:b=>b.queue.isPro?t.jsxs(Ee,{to:ue.groups(b.connection.id,b.queue.name),className:"inline-flex items-center gap-1.5 hover:underline",title:"BullMQ Pro groups",children:[t.jsx(be,{variant:"pro",size:"xs",className:"tracking-wider",children:"PRO"}),K(b.queue.groupsCount)]}):t.jsx("span",{className:"text-fg-subtle",children:"–"})},{key:"trend",header:"Trend",sortValue:b=>{var C;const k=(C=b.queue.metrics)==null?void 0:C.completed;return k&&k.length?k.reduce((z,O)=>z+O,0):null},render:b=>{var k;return t.jsx("span",{style:{color:lt.completed.fg},children:t.jsx(tl,{values:(k=b.queue.metrics)==null?void 0:k.completed,width:80,height:18,title:"Completed per minute"})})}},{key:"actions",header:t.jsx("span",{className:"sr-only",children:"Actions"}),align:"right",noRowClick:!0,render:b=>t.jsxs("span",{className:"inline-flex items-center justify-end gap-0.5",children:[t.jsx(V,{size:"icon-xs",variant:"ghost",title:"Search jobs","aria-label":`Search jobs in ${b.queue.name}`,onClick:()=>p(ue.queueSearch(b.connection.id,b.queue.name)),children:t.jsx(Yn,{})}),d&&t.jsx(V,{size:"icon-xs",variant:"ghost",loading:h===Ia(b),title:b.queue.isPaused?"Resume queue":"Pause queue","aria-label":b.queue.isPaused?"Resume queue":"Pause queue",onClick:()=>d(b),children:b.queue.isPaused?t.jsx(Qo,{}):t.jsx(Gr,{})}),f&&t.jsx(V,{size:"icon-xs",variant:"ghost",loading:g===Ia(b),title:K0,"aria-label":`Hide ${b.queue.name} from the lists`,onClick:()=>f(b),children:t.jsx(Fo,{})})]})}),j},[n,d,h,f,g,p,e]);return t.jsx(tC,{columns:v,rows:e,rowKey:Ia,sort:r,onSort:i,onRowActivate:j=>p(ue.queue(j.connection.id,j.queue.name,wo(j.queue.counts))),message:o,messageClassName:c,className:"min-w-[1100px]"})}function ya(e,n,r,i=!1){var d;const o=(d=lt[e])==null?void 0:d.textClass,c=e;return{key:e,header:n,align:"right",num:!0,sortValue:r,noRowClick:!0,render:h=>{const f=r(h),g=F(f>0?o:"text-fg-subtle",e==="failed"&&f>0&&"font-semibold");return f===0?t.jsx("span",{className:g,children:K(f)}):t.jsx(Ee,{to:ue.queue(h.connection.id,h.queue.name,c),className:F(g,"hover:underline"),title:`Open the ${n.toLowerCase()} jobs of ${h.queue.name}`,children:K(f)})},muted:i?h=>r(h)===0:void 0}}const nC=4;function sC({className:e}){const{health:n,paused:r,isLoading:i,error:o}=sd(),[c,d]=ed("overview.health.expanded",!1),h=n.flatMap(p=>p.warnings.filter(v=>v.level==="critical").map(v=>({health:p,warning:v}))),f=n.filter(p=>!p.ok);if(!i&&n.length===0&&o==null)return null;const g=n.length>nC;return t.jsxs("section",{"aria-label":"Server health",className:F("space-y-2",e),children:[h.length>0&&t.jsx(aC,{items:h}),t.jsxs("div",{className:"card px-2 py-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ao,{className:F("size-3.5 shrink-0 text-fg-subtle",r&&"opacity-50"),"aria-hidden":!0}),i&&n.length===0?t.jsx("span",{className:"min-w-0 flex-1 text-[11px] text-fg-subtle",children:"Reading server health…"}):o!=null&&n.length===0?t.jsxs("span",{className:"min-w-0 flex-1 truncate text-[11px] text-danger",children:["Could not load health: ",ve(o)]}):g?t.jsx(rC,{health:n,paused:r,expanded:c,onToggle:d}):t.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:n.map(p=>t.jsx(gv,{health:p,paused:r},p.connectionId))}),r&&t.jsx(Pe,{content:"Monitoring is paused — the dashboard is sending no health reads. These are the last numbers received.",children:t.jsxs("span",{className:"flex shrink-0 cursor-help items-center gap-1 text-[11px] text-warning",children:[t.jsx(Gr,{className:"size-3","aria-hidden":!0}),"paused"]})}),f.length>0&&!r&&!g&&t.jsxs("span",{className:"shrink-0 text-[11px] font-medium text-danger",children:[f.length," unreachable"]}),t.jsx(Ee,{to:ue.health,className:"shrink-0 rounded-md border border-border px-1.5 py-0.5 text-[11px] text-fg-muted transition-colors hover:border-border-strong hover:text-fg",children:"Monitor"})]}),g&&c&&t.jsx("div",{className:"mt-2 flex flex-col gap-1 border-t border-border pt-2",children:n.map(p=>t.jsx(gv,{health:p,paused:r,className:"min-w-0"},p.connectionId))})]})]})}function rC({health:e,paused:n,expanded:r,onToggle:i}){const o=Cm(e),c=e.filter(h=>!h.ok||h.warnings.some(f=>f.level==="critical")),d=o.total-c.length;return t.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsxs("button",{type:"button",onClick:i,"aria-expanded":r,className:"flex shrink-0 items-center gap-1 rounded text-xs font-medium text-fg hover:text-accent",children:[r?t.jsx(ps,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}):t.jsx(Dn,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}),t.jsxs("span",{className:"num",children:[o.total," connections"]})]}),t.jsxs("span",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-fg-muted",children:[d>0&&t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"status-dot bg-success text-success","aria-hidden":!0}),t.jsxs("span",{className:"num",children:[d," ok"]})]}),c.length>0?t.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5",children:[t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 font-medium text-danger",children:[t.jsx("span",{className:"status-dot pulse bg-danger text-danger","aria-hidden":!0}),t.jsxs("span",{className:"num",children:[c.length," with problems"]})]}),c.slice(0,3).map(h=>t.jsx(Pe,{content:h.ok?h.warnings.map(f=>f.message).join(" · "):`Unreachable: ${h.error??"unknown error"}`,children:t.jsx(Ee,{to:ue.health,className:"max-w-52 shrink-0 cursor-help truncate rounded border border-danger/40 bg-danger/10 px-1.5 py-px text-[11px] font-medium text-danger",children:h.connectionName})},h.connectionId)),c.length>3&&t.jsxs(Ee,{to:ue.health,className:"shrink-0 text-[11px] text-danger underline underline-offset-2",children:["+",c.length-3," more"]})]}):o.warn>0&&t.jsxs("span",{className:"flex items-center gap-1.5 text-warning",children:[t.jsx("span",{className:"status-dot bg-warning text-warning","aria-hidden":!0}),t.jsxs("span",{className:"num",children:[o.warn," warning",o.warn===1?"":"s"]})]}),!n&&t.jsxs(t.Fragment,{children:[t.jsx(ds,{label:"cmd/s",value:o.commandsPerSec==null?"–":Wr(o.commandsPerSec,""),tip:o.commandsPerSec==null?"No rate yet — needs two INFO samples. This is not zero.":"Redis commands, summed across every Redis connection"}),t.jsx(ds,{label:"cpu",value:Ji(o.cpuCores),tip:`Busiest single Redis — ${Ho(o.cpuCores)}`,tone:Sm(o.cpuCores)}),o.memoryPct!=null&&t.jsx(ds,{label:"mem",value:En(o.memoryPct,0),tip:"Highest memory use against maxmemory across connections",tone:o.memoryPct>=90?"danger":o.memoryPct>=75?"warn":void 0})]})]}),t.jsx("button",{type:"button",onClick:i,className:"shrink-0 text-[11px] text-fg-subtle underline underline-offset-2 hover:text-fg",children:r?"hide all":"show all"})]})}function gv({health:e,paused:n,className:r}){var f;const i=e.info&&e.info.backend!=="postgres"?e.info:null,o=((f=e.info)==null?void 0:f.backend)==="postgres"?e.info:null,c=!e.ok,d=iC(e.warnings),h=c?`Unreachable: ${e.error??"unknown error"}`:e.warnings.length>0?e.warnings.map(g=>g.message).join(" · "):"Responding to INFO";return t.jsxs("div",{className:F("flex min-w-0 items-center gap-2",n&&"opacity-70",r),children:[t.jsx(Pe,{content:h,children:t.jsx("span",{className:F("status-dot shrink-0 cursor-help",c?"bg-danger pulse text-danger":d==="critical"?"bg-danger text-danger":d==="warn"?"bg-warning text-warning":"bg-success text-success"),role:"img","aria-label":c?"unreachable":d?`${d} warning`:"ok"})}),t.jsx(Ee,{to:ue.health,className:"min-w-0 flex-1 truncate text-xs font-medium text-fg hover:underline",title:e.connectionName,children:e.connectionName}),c?t.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] text-danger",children:e.error??(e.kind==="postgres"?"Postgres is unreachable":"Redis is unreachable")}):e.kind==="postgres"?t.jsxs("span",{className:"flex shrink-0 items-center gap-x-3 text-[11px] text-fg-muted",children:[t.jsx(ds,{label:"db",value:o?Xt(o.databaseSizeBytes):"–",tip:"pg_database_size of the database BullMQ lives in"}),t.jsx(ds,{label:"tx/s",value:e.commandsPerSec==null?"–":Wr(e.commandsPerSec,""),tip:e.commandsPerSec==null?"No rate yet — needs two samples. This is not zero.":"Transactions per second, from pg_stat_database"}),t.jsx(ds,{label:"conn",value:o?`${o.connectedClients}/${o.maxConnections}`:"–",tip:"Sessions on this database / max_connections",tone:o&&o.maxConnections>0&&o.connectedClients/o.maxConnections>=.9?"danger":void 0}),t.jsx(ds,{label:"lat",value:o?ko(o.latencyMs):"–",tip:"Round trip of the health query itself"})]}):t.jsxs("span",{className:"flex shrink-0 items-center gap-x-3 text-[11px] text-fg-muted",children:[t.jsx(ds,{label:"mem",value:i?`${i.usedMemoryHuman||Xt(i.usedMemoryBytes)}${e.memoryUsedPct!=null?` · ${En(e.memoryUsedPct)}`:""}`:"–",tip:e.memoryUsedPct!=null&&(i!=null&&i.maxMemoryBytes)?`${En(e.memoryUsedPct)} of ${Xt(i.maxMemoryBytes)} maxmemory`:"used_memory — no maxmemory set on this Redis",tone:e.memoryUsedPct==null?void 0:e.memoryUsedPct>=90?"danger":e.memoryUsedPct>=75?"warn":void 0}),t.jsx(ds,{label:"cpu",value:Ji(e.cpuCores),tip:Ho(e.cpuCores),tone:Sm(e.cpuCores)}),t.jsx(ds,{label:"cmd/s",value:e.commandsPerSec==null?"–":Wr(e.commandsPerSec,""),tip:e.commandsPerSec==null?"No rate yet — needs two INFO samples. This is not zero.":"Derived from total_commands_processed between samples"}),t.jsx(ds,{label:"lat",value:i?ko(i.latencyMs):"–",tip:"Round trip of the INFO command itself"})]})]})}function ds({label:e,value:n,tip:r,tone:i}){return t.jsx(Pe,{content:r,children:t.jsxs("span",{className:"cursor-help items-baseline gap-1 whitespace-nowrap",children:[t.jsx("span",{className:F("num font-medium",i==="danger"?"text-danger":i==="warn"?"text-warning":"text-fg"),children:n}),t.jsx("span",{className:"ml-1 text-fg-subtle",children:e})]})})}function aC({items:e}){return t.jsxs("div",{role:"status",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger/10 px-2.5 py-1.5 text-xs text-danger",children:[t.jsx(Hy,{className:"mt-px size-3.5 shrink-0","aria-hidden":!0}),t.jsx("div",{className:"min-w-0 flex-1 space-y-0.5 leading-snug",children:e.map(({health:n,warning:r},i)=>t.jsxs("p",{className:"truncate",children:[t.jsx("span",{className:"font-semibold",children:n.connectionName}),t.jsx("span",{className:"mx-1.5 opacity-50",children:"·"}),r.message]},`${n.connectionId}-${r.code}-${i}`))}),t.jsx(Ee,{to:ue.health,className:"shrink-0 underline underline-offset-2 hover:no-underline",children:"Monitor"})]})}function iC(e){let n=null;for(const r of e){if(r.level==="critical")return"critical";n="warn"}return n}const lC=2;function oC(){var ot,De;const{isAdmin:e,isOperator:n}=mt(),{has:r}=wt(),{connections:i,entries:o,isLoading:c}=c2(),d=z0(),h=r("alerts"),f=M2(h),g=r("folders"),p=Jr(g),v=un(),{sort:j,setSort:S,filter:y,setFilter:b}=Mm("overview",Lm,Am),k=w.useMemo(()=>o.flatMap(W=>{var me;return(((me=W.result.data)==null?void 0:me.queues)??[]).map(re=>({connection:W.connection,queue:re}))}),[o]),C=w.useMemo(()=>k.filter(W=>Rm(W,y)),[k,y]),z=w.useMemo(()=>Em(k),[k]),O=c||o.some(W=>W.result.isLoading),T=w.useMemo(()=>o.reduce((W,me)=>{var re;return W+(((re=me.result.data)==null?void 0:re.hiddenCount)??0)},0),[o]),M=w.useMemo(()=>o.filter(W=>{var me;return((me=W.result.data)==null?void 0:me.discovery)&&!W.result.data.discovery.complete}).map(W=>{var me,re;return{name:W.connection.name,keys:((re=(me=W.result.data)==null?void 0:me.discovery)==null?void 0:re.totalKeys)??null}}),[o]),E=w.useMemo(()=>{const W=o.filter(me=>{var re;return(((re=me.result.data)==null?void 0:re.hiddenCount)??0)>0});return W.length===1?W[0].connection.id:null},[o]),I=SS(),Q=n?W=>void I.hide(W.connection.id,W.queue.name):void 0,H=((ot=i.data)==null?void 0:ot.length)??0,q=H>lC,B=h?((De=f.data)==null?void 0:De.findings)??[]:void 0,de=w.useMemo(()=>zS(C,d.data,8,B),[C,d.data,B]),ce=w.useMemo(()=>{if(!h||!f.data)return;const W=new Set(C.map(re=>`${re.connection.id}\0${re.queue.name}`)),me=f.data.unmeasured.filter(re=>W.has(`${re.connectionId}\0${re.queueName}`)).length;return{rules:f.data.rules,unmeasured:me}},[h,f.data,C]),Ne=w.useMemo(()=>Hf(de.rest,g?p.data:void 0),[de.rest,g,p.data]),Ie=w.useMemo(()=>Hf(C,g?p.data:void 0),[C,g,p.data]);return!c&&H===0?t.jsx(bt,{children:t.jsx(cn,{icon:t.jsx(Va,{}),title:"No Redis connections yet",description:e?"Point the dashboard at a Redis that runs BullMQ. Queues are discovered automatically from the key prefix.":"An administrator needs to add a Redis connection before queues show up here.",action:e&&t.jsx(V,{variant:"primary",leftIcon:t.jsx(es,{}),onClick:()=>v(`${ue.settings("connections")}?new=1`),children:"Add connection"})})}):t.jsxs(bt,{wide:!0,children:[t.jsx(gs,{title:"Overview",description:"Every connection and queue at a glance. Refreshes every 5 seconds."}),t.jsx(sC,{className:"mb-3"}),M.length>0&&t.jsxs("p",{className:"mb-3 rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-fg-muted",role:"status",children:["Still discovering queues on ",M.map(W=>`${W.name}${W.keys?` (${K(W.keys)} keys)`:""}`).join(", "),": the keyspace is large and the SCAN runs in bounded passes. Queues with a connected worker are listed already; the others appear as the scan completes."]}),t.jsxs("section",{className:"space-y-3","aria-label":"All queues",children:[t.jsxs(ej,{totals:z,hiddenCount:T,onRevealHidden:E?()=>v(`${ue.connection(E)}#hidden-queues`):void 0,children:[t.jsx(Om,{value:y,onChange:b,"aria-label":"Filter queues by name or connection"}),t.jsxs("span",{className:"num whitespace-nowrap text-xs text-fg-subtle",children:[C.length," of ",k.length]})]}),O&&k.length===0?t.jsx(zm,{}):C.length===0?t.jsx("p",{className:"py-6 text-center text-xs text-fg-subtle",children:y?"No queue matches the filter":"No queues discovered yet"}):t.jsxs(t.Fragment,{children:[t.jsx(WS,{items:de.attention,hidden:de.hidden,showConnection:q,filtered:!!y,rules:ce}),q?t.jsx(HS,{sections:Ne,showConnection:!0,defaultOpen:!1}):t.jsx(Y0,{sections:Ie,showConnection:!0,onHide:Q})]}),t.jsx("div",{className:"card overflow-hidden",children:t.jsx(Fm,{rows:C,showConnection:!0,sort:j,onSort:S,onHide:Q,message:O&&k.length===0?"Loading queues…":y?"No queue matches the filter":"No queues discovered yet"})})]})]})}function cC({connectionId:e,hidden:n,canUnhide:r,onUnhide:i,pendingQueue:o,className:c,forceOpen:d}){const[h,f]=ed(`hiddenQueues.${e}`,!1),g=h||!!d;return n.length===0?null:t.jsxs("section",{className:F("card overflow-hidden",c),"aria-label":"Hidden queues",id:"hidden-queues",children:[t.jsxs("button",{type:"button",onClick:f,"aria-expanded":g,className:"flex w-full items-center gap-2 px-4 py-2.5 text-left hover:bg-surface-2",children:[g?t.jsx(ps,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}):t.jsx(Dn,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}),t.jsx(Fo,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}),t.jsxs("h2",{className:"text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:["Hidden queues ",t.jsxs("span",{className:"num",children:["(",n.length,")"]})]}),t.jsx("span",{className:"ml-auto text-[11px] text-fg-subtle",children:"Not counted in the totals above · jobs untouched"})]}),g&&t.jsx("ul",{className:"divide-y divide-border border-t border-border",children:n.map(p=>t.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 px-4 py-2",children:[t.jsx(Ee,{to:ue.queue(e,p.queueName),className:"font-mono text-xs font-medium hover:underline",children:p.queueName}),t.jsxs("span",{className:"text-[11px] text-fg-subtle",children:["hidden ",t.jsx(Yt,{value:p.hiddenAt,className:"text-[11px]"}),p.hiddenByName&&` by ${p.hiddenByName}`]}),r&&t.jsx(V,{size:"xs",variant:"ghost",className:"ml-auto",leftIcon:t.jsx(Qy,{}),loading:o===p.queueName,onClick:()=>i(p.queueName),title:"Put this queue back in the lists",children:"Show again"})]},p.queueName))})]})}function tj({queue:e,onClose:n,onConfirm:r,loading:i}){const[o,c]=w.useState(""),d=()=>{const h=o.trim();r(h||void 0)};return t.jsx(bn,{open:e!==null,onClose:n,size:"sm",title:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Gr,{className:"size-4 text-warning","aria-hidden":!0}),"Pause ",e]}),description:"Workers stop taking new jobs from this queue; jobs already running finish. Jobs keep arriving and wait until you resume.",footer:t.jsxs(t.Fragment,{children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:n,disabled:i,children:"Cancel"}),t.jsx(V,{variant:"primary",size:"sm",loading:i,onClick:d,children:"Pause queue"})]}),children:t.jsx(Yi,{autoFocus:!0,label:"Reason (optional)",hint:"Recorded in the audit log next to who paused it and when.",placeholder:"e.g. payment provider degraded, holding refunds until they recover",rows:3,maxLength:500,value:o,onChange:h=>c(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.metaKey||h.ctrlKey)&&!i&&d()}})})}function uC(){var me,re,A,Z,Fe,Ue;const{connectionId:e=""}=Fn(),{isOperator:n,isAdmin:r}=mt(),{has:i}=wt(),o=xs(),c=(me=o.data)==null?void 0:me.find(Se=>Se.id===e),d=o2(e),h=d2(e),f=g2(e),g=I0(e),p=_m(e),v=w.useRef(null),[j,S]=w.useState(!1),[y,b]=w.useState(null),k=i("folders"),C=Jr(k),z=un(),{sort:O,setSort:T,filter:M,setFilter:E}=Mm(`connection.${e}`,Lm,Am),I=w.useMemo(()=>{var Se;return c?(((Se=d.data)==null?void 0:Se.queues)??[]).map(Qe=>({connection:c,queue:Qe})):[]},[c,d.data]),Q=w.useMemo(()=>I.filter(Se=>Rm(Se,M)),[I,M]),H=w.useMemo(()=>Hf(Q,k?C.data:void 0),[Q,k,C.data]),q=w.useMemo(()=>Em(I),[I]);if(o.isSuccess&&!c)return t.jsx(bt,{children:t.jsx(cn,{icon:t.jsx(Va,{}),title:"Connection not found",description:"It may have been removed.",action:t.jsx(Ee,{to:"/",className:"text-accent hover:underline",children:"Back to overview"})})});const B=(re=d.data)==null?void 0:re.info,de=((A=d.data)==null?void 0:A.status)??(c==null?void 0:c.status),ce=n?Se=>{if(!Se.queue.isPaused){b(Se);return}f.mutate({queue:Se.queue.name,action:"resume"},{onSuccess:()=>X.success(`${Se.queue.name} resumed`),onError:Qe=>X.error(ve(Qe))})}:void 0,Ne=Se=>{if(!y)return;const Qe=y.queue.name;f.mutate({queue:Qe,action:"pause",...Se?{reason:Se}:{}},{onSuccess:()=>{b(null),X.success(`${Qe} paused`)},onError:rt=>X.error(ve(rt))})},Ie=f.isPending&&f.variables?`${e}/${f.variables.queue}`:null,ot=n?Se=>p.hide(Se.queue.name):void 0,De=p.pendingQueue?`${e}/${p.pendingQueue}`:null,W=()=>{S(!0),requestAnimationFrame(()=>{var Se;return(Se=v.current)==null?void 0:Se.scrollIntoView({behavior:"smooth",block:"center"})})};return t.jsxs(bt,{wide:!0,children:[t.jsx(gs,{title:t.jsxs("span",{className:"flex items-center gap-2",children:[(c==null?void 0:c.name)??e,t.jsx(nd,{status:de,pulse:!0,withLabel:!0})]}),description:c&&t.jsxs("span",{className:"font-mono",children:[c.url," · ",c.kind==="postgres"?"schema":"prefix"," ",t.jsx("span",{className:"text-fg",children:c.prefix}),c.cluster&&" · cluster",c.queueFilter&&` · filter ${c.queueFilter}`]}),actions:t.jsxs(t.Fragment,{children:[t.jsx(V,{size:"sm",variant:"secondary",leftIcon:t.jsx(dm,{}),loading:h.isPending,onClick:()=>h.mutate(void 0,{onSuccess:()=>X.success("Queue list refreshed"),onError:Se=>X.error(ve(Se))}),title:"Force queue rediscovery (bypasses the 30 s cache)",children:"Rediscover"}),r&&t.jsx(V,{size:"sm",variant:"ghost",leftIcon:t.jsx(Gy,{}),onClick:()=>z(`${ue.settings("connections")}?edit=${encodeURIComponent(e)}`),children:"Edit"})]})}),de&&!de.ok&&t.jsxs("div",{className:"mb-4 rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger",role:"alert",children:[(c==null?void 0:c.kind)==="postgres"?"Postgres":"Redis"," unreachable: ",de.error??"unknown error"]}),t.jsxs("div",{className:"card mb-4 grid grid-cols-2 gap-px overflow-hidden bg-border sm:grid-cols-4 lg:grid-cols-8",children:[(B==null?void 0:B.backend)==="postgres"?t.jsxs(t.Fragment,{children:[t.jsx(fn,{label:"Postgres",value:B.serverVersion}),t.jsx(fn,{label:"Schema",value:B.schema}),t.jsx(fn,{label:"Uptime",value:No(B.uptimeSeconds)}),t.jsx(fn,{label:"Connections",value:`${K(B.connectedClients)} / ${K(B.maxConnections)}`}),t.jsx(fn,{label:"Database",value:Xt(B.databaseSizeBytes)}),t.jsx(fn,{label:"Jobs table",value:Xt(B.jobTableBytes)}),t.jsx(fn,{label:"Events table",value:Xt(B.eventTableBytes)})]}):t.jsxs(t.Fragment,{children:[t.jsx(fn,{label:"Redis",value:B==null?void 0:B.redisVersion}),t.jsx(fn,{label:"Mode",value:B==null?void 0:B.mode}),t.jsx(fn,{label:"Uptime",value:B?No(B.uptimeSeconds):void 0}),t.jsx(fn,{label:"Clients",value:B?K(B.connectedClients):void 0}),t.jsx(fn,{label:"Memory",value:B?`${Xt(B.usedMemoryBytes)}${B.maxMemoryBytes?` / ${Xt(B.maxMemoryBytes)}`:""}`:void 0}),t.jsx(fn,{label:"Keys",value:B?B.totalKeys!=null?K(B.totalKeys):"–":void 0}),t.jsx(fn,{label:"Ops / s",value:B?B.opsPerSec!=null?K(B.opsPerSec):"–":void 0})]}),t.jsx(fn,{label:"Latency",value:de?de.latencyMs!=null?`${de.latencyMs} ms`:"–":void 0})]}),t.jsxs("section",{className:"space-y-3","aria-label":"Queues",children:[t.jsxs(ej,{totals:q,title:"Queues",hiddenCount:((Z=d.data)==null?void 0:Z.hiddenCount)??((Fe=g.data)==null?void 0:Fe.length)??0,onRevealHidden:W,children:[t.jsx(Om,{value:M,onChange:E,"aria-label":"Filter queues"}),t.jsxs("span",{className:"num whitespace-nowrap text-xs text-fg-subtle",children:[Q.length," of ",I.length]})]}),d.isLoading?t.jsx(zm,{}):Q.length>0?t.jsx(Y0,{sections:H,hideSingleHeader:!0,onHide:ot,hidePendingKey:De}):null,t.jsx("div",{className:"card overflow-hidden",children:t.jsx(Fm,{rows:Q,sort:O,onSort:T,onToggle:ce,pendingKey:Ie,onHide:ot,hidePendingKey:De,message:d.isLoading?t.jsx(Kt,{label:"Loading queues…"}):d.isError&&!d.data?ve(d.error):M?"No queue matches the filter":"No queues discovered. Check the prefix and queue filter, then rediscover.",messageClassName:d.isError&&!d.data?"text-danger":void 0})}),t.jsx("div",{ref:v,children:t.jsx(cC,{connectionId:e,hidden:g.data??[],canUnhide:n,onUnhide:Se=>p.unhide(Se),pendingQueue:p.pendingQueue,forceOpen:j})})]}),t.jsx(tj,{queue:(y==null?void 0:y.queue.name)??null,onClose:()=>b(null),onConfirm:Ne,loading:f.isPending&&((Ue=f.variables)==null?void 0:Ue.action)==="pause"})]})}function fn({label:e,value:n}){return t.jsxs("div",{className:"bg-surface px-3 py-2",children:[t.jsx("div",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:e}),t.jsx("div",{className:"num truncate text-[13px] font-medium text-fg",children:n===void 0?t.jsx("span",{className:"skeleton inline-block h-3 w-12"}):n})]})}function Dm({reason:e="Not available yet"}){return t.jsx(Pe,{content:e,children:t.jsx("span",{className:"cursor-help text-fg-subtle","aria-label":e,children:"—"})})}function Xn({label:e,value:n,unknownReason:r,isUnknown:i,hint:o,secondary:c,spark:d,sparkColor:h="var(--accent)",sparkTitle:f,meterPct:g,meterLabel:p,meterTone:v="ok",dimmed:j,big:S,className:y}){const b=t.jsx("span",{className:"text-[10px] font-medium tracking-wide text-fg-subtle uppercase",children:e});return t.jsxs("div",{className:F("min-w-0 rounded-md border border-border bg-bg/60 px-2.5 py-2",j&&"opacity-50",y),children:[t.jsx("div",{className:"flex items-center gap-1",children:o?t.jsx(Pe,{content:o,children:t.jsx("span",{className:"cursor-help border-b border-dotted border-border-strong",children:b})}):b}),t.jsx("div",{className:F("num mt-0.5 truncate font-semibold text-fg",S?"text-xl":"text-[15px]"),children:i?t.jsx(Dm,{reason:r??"Not available yet"}):n}),c&&t.jsx("div",{className:"mt-0.5 truncate text-[11px] text-fg-muted",children:c}),g!==void 0&&t.jsx(dC,{pct:g,label:p,tone:v}),d&&t.jsx(tl,{values:d,width:S?260:112,height:S?44:22,className:"mt-1.5 w-full",stroke:h,title:f??e,dimmed:j})]})}function dC({pct:e,label:n,tone:r="ok"}){const i=r==="danger"?"bg-danger":r==="warn"?"bg-warning":"bg-accent";return t.jsxs("div",{className:"mt-1",children:[t.jsx("div",{className:"h-1 w-full overflow-hidden rounded-full bg-surface-3",children:e!=null&&t.jsx("div",{className:F("h-full rounded-full transition-[width] duration-500",i),style:{width:`${Math.max(0,Math.min(100,e))}%`}})}),n&&t.jsx("div",{className:"mt-0.5 truncate text-[10px] text-fg-subtle",children:n})]})}function nj({warning:e}){const n=e.level==="critical",r=n?Hy:ts;return t.jsxs("div",{role:"status",className:F("flex items-start gap-2 rounded-md border px-2.5 py-1.5 text-xs",n?"border-danger/40 bg-danger/10 text-danger":"border-warning/40 bg-warning/10 text-warning"),children:[t.jsx(r,{className:"mt-px size-3.5 shrink-0","aria-hidden":!0}),t.jsx("span",{className:"min-w-0 flex-1 leading-snug",children:e.message}),t.jsx("span",{className:"shrink-0 font-mono text-[10px] opacity-60",children:e.code})]})}function ln({label:e,value:n,tone:r,hint:i}){const o=t.jsxs("div",{className:"flex items-baseline justify-between gap-3 border-b border-border/60 py-1 last:border-b-0",children:[t.jsx("dt",{className:"shrink-0 text-[11px] text-fg-subtle",children:e}),t.jsx("dd",{className:F("num min-w-0 truncate text-right text-[12px]",r==="danger"?"text-danger":r==="warn"?"text-warning":r==="muted"?"text-fg-muted":"text-fg"),children:n})]});return i?t.jsx(Pe,{content:i,block:!0,children:o}):o}const hC="No rate yet — needs two samples. Also resets when Postgres restarts. This is not zero.";function fC({health:e,big:n,paused:r}){var v;const[i,o]=w.useState(!1),c=ol(1e3),d=((v=e.info)==null?void 0:v.backend)==="postgres"?e.info:null,h=!e.ok,f=sj(e,c),g=e.history??[],p=d&&d.maxConnections>0?d.connectedClients/d.maxConnections*100:null;return t.jsxs("section",{"aria-label":`Postgres health for ${e.connectionName}`,className:F("card flex min-w-0 flex-col gap-3 p-3",h&&"border-danger/50 bg-danger/[0.04]",r&&"opacity-70"),children:[t.jsxs("header",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[t.jsx(Pe,{content:h?`Unreachable: ${e.error??"unknown error"}`:"Responding",children:t.jsx("span",{className:F("status-dot",h?"bg-danger pulse text-danger":"bg-success text-success"),role:"img","aria-label":h?"unreachable":"ok"})}),t.jsx("h3",{className:"min-w-0 truncate text-sm font-semibold text-fg",children:e.connectionName}),d&&t.jsxs(t.Fragment,{children:[t.jsxs(be,{variant:"outline",size:"xs",mono:!0,children:["Postgres ",d.serverVersion]}),t.jsx(be,{variant:"neutral",size:"xs",mono:!0,children:d.schema}),t.jsx(Pe,{content:"Postgres server uptime",children:t.jsxs("span",{className:"num cursor-help text-[11px] text-fg-subtle",children:["up ",No(d.uptimeSeconds)]})})]}),t.jsx("span",{className:"ml-auto shrink-0 text-[11px] text-fg-subtle",children:r?t.jsx("span",{className:"text-warning",children:"paused"}):f==null?t.jsx(Dm,{reason:"No successful sample yet"}):t.jsxs("span",{className:"num",children:["sampled ",f,"s ago"]})})]}),h&&t.jsx("p",{className:"rounded-md border border-danger/40 bg-danger/10 px-2.5 py-1.5 font-mono text-[11px] break-words text-danger",children:e.error??"Postgres is unreachable"}),e.warnings.length>0&&t.jsx("div",{className:"flex flex-col gap-1.5",children:e.warnings.filter(j=>!(h&&j.code==="unreachable")).map((j,S)=>t.jsx(nj,{warning:j},`${j.code}-${S}`))}),t.jsxs("div",{className:F("grid gap-2",n?"sm:grid-cols-2 lg:grid-cols-3":"grid-cols-2 sm:grid-cols-3"),children:[t.jsx(Xn,{label:"Connections",big:n,dimmed:h,isUnknown:!d,unknownReason:"No sample",value:d?K(d.connectedClients):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Ju,{className:"size-3","aria-hidden":!0})," sessions on this database (pg_stat_activity)"]}),meterPct:p,meterLabel:d?`of ${K(d.maxConnections)} max_connections`:"",meterTone:p==null?"ok":p>=90?"danger":p>=75?"warn":"ok",spark:tr(g,"connectedClients"),sparkColor:"var(--info)",sparkTitle:"Connections"}),t.jsx(Xn,{label:"Transactions/sec",big:n,dimmed:h,isUnknown:e.commandsPerSec==null,unknownReason:hC,value:Wr(e.commandsPerSec),secondary:e.commandsPerSec==null?"measuring…":void 0,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Xy,{className:"size-3","aria-hidden":!0})," xact_commit + xact_rollback between samples"]}),spark:tr(g,"commandsPerSec"),sparkColor:"var(--accent)",sparkTitle:"Transactions per second"}),t.jsx(Xn,{label:"Latency",big:n,dimmed:h,isUnknown:!d,unknownReason:"No sample",value:d?ko(d.latencyMs):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(xo,{className:"size-3","aria-hidden":!0})," round trip of the health query itself"]}),spark:tr(g,"latencyMs"),sparkColor:"var(--warning)",sparkTitle:"Latency"}),t.jsx(Xn,{label:"Database",big:n,dimmed:h,isUnknown:!d,unknownReason:"No sample",value:d?Xt(d.databaseSizeBytes):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Va,{className:"size-3","aria-hidden":!0})," pg_database_size, the whole database"]}),spark:tr(g,"memoryBytes"),sparkColor:"var(--violet)",sparkTitle:"Database size"}),t.jsx(Xn,{label:"Jobs table",big:n,dimmed:h,isUnknown:!d,unknownReason:"No sample",value:d?Xt(d.jobTableBytes):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Vg,{className:"size-3","aria-hidden":!0})," BullMQ's job table, with its indexes"]})}),t.jsx(Xn,{label:"Events table",big:n,dimmed:h,isUnknown:!d,unknownReason:"No sample",value:d?Xt(d.eventTableBytes):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Vg,{className:"size-3","aria-hidden":!0})," never trimmed by BullMQ 6: clean it on a schedule"]})})]}),t.jsxs("details",{open:i,onToggle:j=>o(j.currentTarget.open),className:"rounded-md border border-border bg-bg/40",children:[t.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 px-2.5 py-1.5 text-[11px] text-fg-muted select-none hover:text-fg",children:[t.jsx(Dn,{className:F("size-3.5 transition-transform",i&&"rotate-90"),"aria-hidden":!0}),"Details"]}),t.jsxs("dl",{className:"grid gap-x-6 px-2.5 pb-2 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsx(ln,{label:"Cache hit rate",value:(d==null?void 0:d.cacheHitRatePct)!=null?En(d.cacheHitRatePct):"—",hint:"blks_hit / (blks_hit + blks_read), cumulative"}),t.jsx(ln,{label:"Deadlocks",value:d?K(d.deadlocks):"—",tone:(d==null?void 0:d.deadlocks)!=null&&d.deadlocks>0?"warn":"muted",hint:"pg_stat_database.deadlocks, cumulative since the stats reset"}),t.jsx(ln,{label:"Transactions",value:d?ft(d.totalTransactions):"—",hint:"xact_commit + xact_rollback, cumulative"}),t.jsx(ln,{label:"History points",value:K(g.length),tone:"muted",hint:"Kept in the server's memory, not persisted"})]})]})]})}const vv="No rate yet — needs two INFO samples. Also resets when Redis restarts. This is not zero.";function sj(e,n){if(!e.info)return null;const r=Date.parse(e.info.sampledAt);return Number.isFinite(r)?Math.max(0,Math.round((n-r)/1e3)):null}function tr(e,n){return e.map(r=>{const i=r[n];return typeof i=="number"&&Number.isFinite(i)?i:null})}function mC(e){return e.health.kind==="postgres"?t.jsx(fC,{...e}):t.jsx(pC,{...e})}function pC({health:e,big:n,paused:r}){const[i,o]=w.useState(!1),c=ol(1e3),d=e.info&&e.info.backend!=="postgres"?e.info:null,h=!e.ok,f=sj(e,c),g=e.history??[],p=h;return t.jsxs("section",{"aria-label":`Redis health for ${e.connectionName}`,className:F("card flex min-w-0 flex-col gap-3 p-3",h&&"border-danger/50 bg-danger/[0.04]",r&&"opacity-70"),children:[t.jsxs("header",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[t.jsx(Pe,{content:h?`Unreachable: ${e.error??"unknown error"}`:"Responding to INFO",children:t.jsx("span",{className:F("status-dot",h?"bg-danger pulse text-danger":"bg-success text-success"),role:"img","aria-label":h?"unreachable":"ok"})}),t.jsx("h3",{className:"min-w-0 truncate text-sm font-semibold text-fg",children:e.connectionName}),d&&t.jsxs(t.Fragment,{children:[t.jsx(be,{variant:"outline",size:"xs",mono:!0,children:d.redisVersion}),t.jsx(be,{variant:"neutral",size:"xs",children:d.mode}),t.jsx(Pe,{content:"Redis process uptime",children:t.jsxs("span",{className:"num cursor-help text-[11px] text-fg-subtle",children:["up ",No(d.uptimeSeconds)]})})]}),t.jsx("span",{className:"ml-auto shrink-0 text-[11px] text-fg-subtle",children:r?t.jsx("span",{className:"text-warning",children:"paused"}):f==null?t.jsx(Dm,{reason:"No successful sample yet"}):t.jsx(Pe,{content:d?`Sampled at ${new Date(d.sampledAt).toLocaleTimeString()}`:"",children:t.jsxs("span",{className:"num cursor-help",children:["sampled ",f,"s ago"]})})})]}),h&&t.jsx("p",{className:"rounded-md border border-danger/40 bg-danger/10 px-2.5 py-1.5 font-mono text-[11px] break-words text-danger",children:e.error??"Redis is unreachable"}),e.warnings.length>0&&t.jsx("div",{className:"flex flex-col gap-1.5",children:e.warnings.filter(v=>!(h&&v.code==="unreachable")).map((v,j)=>t.jsx(nj,{warning:v},`${v.code}-${j}`))}),t.jsxs("div",{className:F("grid gap-2",n?"sm:grid-cols-2 lg:grid-cols-3":"grid-cols-2 sm:grid-cols-3"),children:[t.jsx(Xn,{label:"Memory",big:n,dimmed:p,isUnknown:!d,unknownReason:"No sample",value:d?d.usedMemoryHuman||Xt(d.usedMemoryBytes):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(SN,{className:"size-3","aria-hidden":!0})," used_memory"]}),meterPct:e.memoryUsedPct,meterLabel:e.memoryUsedPct!=null&&(d!=null&&d.maxMemoryBytes)?`${En(e.memoryUsedPct)} of ${Xt(d.maxMemoryBytes)}`:"no maxmemory set",meterTone:e.memoryUsedPct==null?"ok":e.memoryUsedPct>=90?"danger":e.memoryUsedPct>=75?"warn":"ok",spark:tr(g,"memoryBytes"),sparkColor:"var(--violet)",sparkTitle:"Used memory"}),t.jsx(Xn,{label:"CPU",big:n,dimmed:p,isUnknown:e.cpuCores==null,unknownReason:vv,value:Ji(e.cpuCores),secondary:e.cpuCores==null?"measuring…":t.jsx(Pe,{content:Ho(e.cpuCores),children:t.jsx("span",{className:"num cursor-help border-b border-dotted border-border-strong",children:E0(e.cpuCores)})}),hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(yN,{className:"size-3","aria-hidden":!0})," used_cpu_sys + used_cpu_user, per second, as a share of one core. 100% = one saturated core."]}),meterPct:e.cpuCores==null?null:e.cpuCores*100,meterLabel:e.cpuCores==null?"measuring…":e.cpuCores>1?"over 1 core":"of 1 core",meterTone:e.cpuCores==null?"ok":uS(e.cpuCores),spark:tr(g,"cpuCores"),sparkColor:"var(--teal)",sparkTitle:"CPU (share of one core)"}),t.jsx(Xn,{label:"Commands/sec",big:n,dimmed:p,isUnknown:e.commandsPerSec==null,unknownReason:vv,value:Wr(e.commandsPerSec),secondary:e.commandsPerSec==null?"measuring…":void 0,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Xy,{className:"size-3","aria-hidden":!0})," derived from total_commands_processed between samples"]}),spark:tr(g,"commandsPerSec"),sparkColor:"var(--accent)",sparkTitle:"Commands per second"}),t.jsx(Xn,{label:"Latency",big:n,dimmed:p,isUnknown:!d,unknownReason:"No sample",value:d?ko(d.latencyMs):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(xo,{className:"size-3","aria-hidden":!0})," round trip of the INFO command itself"]}),spark:tr(g,"latencyMs"),sparkColor:"var(--warning)",sparkTitle:"INFO latency"}),t.jsx(Xn,{label:"Clients",big:n,dimmed:p,isUnknown:!d,unknownReason:"No sample",value:d?K(d.connectedClients):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Ju,{className:"size-3","aria-hidden":!0})," connected_clients"]}),secondary:(d==null?void 0:d.blockedClients)!=null?t.jsx(Pe,{content:"Blocked clients are normal for BullMQ: workers sit in BRPOPLPUSH waiting for the next job. A number close to your worker count is healthy, not a stall.",children:t.jsxs("span",{className:"cursor-help border-b border-dotted border-border-strong",children:[K(d.blockedClients)," blocked"]})}):void 0,spark:tr(g,"connectedClients"),sparkColor:"var(--info)",sparkTitle:"Connected clients"}),t.jsx(Xn,{label:"Keys",big:n,dimmed:p,isUnknown:!d||d.totalKeys==null,unknownReason:"Redis did not report a keyspace (empty db, or cluster)",value:d?ft(d.totalKeys):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(PN,{className:"size-3","aria-hidden":!0})," total keys across the keyspace"]})})]}),t.jsxs("details",{open:i,onToggle:v=>o(v.currentTarget.open),className:"rounded-md border border-border bg-bg/40",children:[t.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 px-2.5 py-1.5 text-[11px] text-fg-muted select-none hover:text-fg",children:[t.jsx(Dn,{className:F("size-3.5 transition-transform",i&&"rotate-90"),"aria-hidden":!0}),"Details"]}),t.jsxs("dl",{className:"grid gap-x-6 px-2.5 pb-2 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsx(ln,{label:"RSS",value:d?Xt(d.usedMemoryRssBytes):"—",hint:"used_memory_rss — what the OS actually holds for the Redis process"}),t.jsx(ln,{label:"Peak memory",value:d?Xt(d.usedMemoryPeakBytes):"—",hint:"used_memory_peak"}),t.jsx(ln,{label:"Fragmentation",value:d?r2(d.memFragmentationRatio):"—",tone:(d==null?void 0:d.memFragmentationRatio)!=null&&d.memFragmentationRatio>1.5?"warn":void 0,hint:"mem_fragmentation_ratio — above 1.5 the allocator is wasting memory"}),t.jsx(ln,{label:"Maxmemory policy",value:(d==null?void 0:d.maxMemoryPolicy)??"—",tone:d!=null&&d.maxMemoryPolicy&&d.maxMemoryPolicy!=="noeviction"?"warn":void 0,hint:"Anything other than noeviction can silently delete queue keys under memory pressure"}),t.jsx(ln,{label:"Hit rate",value:(d==null?void 0:d.keyspaceHitRatePct)!=null?En(d.keyspaceHitRatePct):"—",hint:"keyspace_hits / (hits + misses), cumulative since start"}),t.jsx(ln,{label:"Evicted keys",value:d?K(d.evictedKeys):"—",tone:(d==null?void 0:d.evictedKeys)!=null&&d.evictedKeys>0?"danger":"muted",hint:"Non-zero on a queue Redis means jobs were deleted to free memory"}),t.jsx(ln,{label:"Expired keys",value:d?K(d.expiredKeys):"—",tone:"muted",hint:"expired_keys, cumulative"}),t.jsx(ln,{label:"Rejected connections",value:d?K(d.rejectedConnections):"—",tone:(d==null?void 0:d.rejectedConnections)!=null&&d.rejectedConnections>0?"warn":"muted",hint:"Non-zero means maxclients was hit at some point since start"}),t.jsx(ln,{label:"Replicas",value:(d==null?void 0:d.connectedReplicas)!=null?K(d.connectedReplicas):"—",hint:"connected_slaves"}),t.jsx(ln,{label:"Persistence",value:(d==null?void 0:d.persistenceOk)==null?"—":d.persistenceOk?"ok":"failing",tone:(d==null?void 0:d.persistenceOk)===!1?"danger":void 0,hint:"rdb_last_bgsave_status / aof_last_write_status"}),t.jsx(ln,{label:"Commands processed",value:d?ft(d.totalCommandsProcessed):"—",hint:"total_commands_processed, cumulative since start"}),t.jsx(ln,{label:"History points",value:K(g.length),tone:"muted",hint:"Kept in the server's memory, not persisted"})]})]})]})}const xC="redis-health";function gC({big:e,className:n,headless:r}){const{health:i,paused:o,setPaused:c,isLoading:d,error:h}=sd(),f=Cm(i);return t.jsxs("section",{id:xC,"aria-label":"Server health",className:F("scroll-mt-16",n),children:[!r&&t.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[t.jsxs("h2",{className:"flex items-center gap-1.5 text-sm font-semibold text-fg",children:[t.jsx(Ao,{className:"size-4 text-fg-subtle","aria-hidden":!0}),"Server health"]}),f.critical>0&&t.jsxs(be,{variant:"danger",size:"xs",children:[f.critical," critical"]}),f.warn>0&&t.jsxs(be,{variant:"warning",size:"xs",children:[f.warn," warning",f.warn===1?"":"s"]}),f.critical===0&&f.warn===0&&i.length>0&&!o&&t.jsx(be,{variant:"success",size:"xs",dot:!0,children:"all clear"}),t.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[!e&&t.jsxs(Ee,{to:ue.health,className:"inline-flex items-center gap-1 text-[11px] text-accent hover:underline",children:["Open monitor",t.jsx(Br,{className:"size-3","aria-hidden":!0})]}),t.jsx(yv,{paused:o,onChange:c})]})]}),r&&t.jsx("div",{className:"mb-2 flex items-center justify-end",children:t.jsx(yv,{paused:o,onChange:c})}),o&&t.jsxs("p",{className:"mb-2 flex items-center gap-2 rounded-md border border-warning/40 bg-warning/10 px-2.5 py-1.5 text-xs text-warning",children:[t.jsx(Gr,{className:"size-3.5 shrink-0","aria-hidden":!0}),"Monitoring paused. The dashboard is sending no health reads to your servers. Numbers below are the last frame received."]}),h!=null&&!o&&t.jsxs("p",{className:"mb-2 rounded-md border border-danger/40 bg-danger/10 px-2.5 py-1.5 text-xs text-danger",children:["Could not load health: ",ve(h)]}),d&&i.length===0?t.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fit, minmax(360px, 1fr))"},children:[0,1].map(g=>t.jsx("div",{className:"card h-64 animate-pulse"},g))}):i.length===0?t.jsx("div",{className:"card",children:t.jsx(cn,{compact:!0,icon:t.jsx(IN,{}),title:"Nothing to monitor",description:"Health shows up once a connection is configured."})}):t.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:`repeat(auto-fit, minmax(${e?480:360}px, 1fr))`},children:i.map(g=>t.jsx(mC,{health:g,big:e,paused:o},g.connectionId))}),t.jsx(vC,{})]})}function yv({paused:e,onChange:n}){return t.jsx(Pe,{content:e?"Resume polling. One health read per connection every 3s.":"Stop the dashboard's own health traffic immediately.",children:t.jsx(V,{size:"xs",variant:e?"primary":"ghost",leftIcon:e?t.jsx(Qo,{}):t.jsx(Gr,{}),"aria-pressed":e,onClick:()=>n(!e),children:e?"Resume monitoring":"Pause monitoring"})})}function vC(){return t.jsxs("p",{className:"mt-2 text-[11px] leading-relaxed text-fg-subtle",children:["One read per connection every 3s: INFO on Redis (O(1)), one pg_stat_* query on Postgres. The server shares and rate-limits the sample, so extra browser tabs add no extra load. See"," ",t.jsx("code",{className:"font-mono text-fg-muted",children:"docs/PRODUCTION-TRIAL.md"})," before pointing this at a production server."]})}function yC(){const{health:e,paused:n,lastSampleAt:r}=sd();return t.jsxs(bt,{wide:!0,children:[t.jsx(gs,{title:"Health monitor",description:n?"Paused — the dashboard is sending nothing to your servers.":"One health read per connection every 3 seconds (INFO on Redis, pg_stat_* on Postgres), sampled on the server and shared across tabs.",actions:r!=null&&!n?t.jsxs("span",{className:"num text-[11px] text-fg-subtle",children:["last sample ",gn(r)]}):void 0}),t.jsx(gC,{big:!0,headless:!0}),t.jsxs("section",{className:"mt-6 space-y-3","aria-label":"Sample history",children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:"History"}),e.length===0?t.jsx("p",{className:"text-xs text-fg-subtle",children:"No connections to show."}):e.map(i=>t.jsx(jC,{health:i},i.connectionId))]})]})}const nf=40;function jC({health:e}){const[n,r]=w.useState(!1),i=w.useMemo(()=>[...e.history??[]].reverse(),[e.history]),o=n?i:i.slice(0,nf);return t.jsxs("div",{className:"card overflow-hidden",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2",children:[t.jsx("span",{className:F("status-dot",e.ok?"bg-success text-success":"bg-danger text-danger"),role:"img","aria-label":e.ok?"ok":"unreachable"}),t.jsx("h3",{className:"truncate text-[13px] font-medium text-fg",children:e.connectionName}),t.jsxs(be,{variant:"neutral",size:"xs",children:[K(i.length)," samples"]}),i.length>nf&&t.jsx("button",{type:"button",className:"ml-auto text-[11px] text-accent hover:underline",onClick:()=>r(c=>!c),children:n?`Show latest ${nf}`:`Show all ${i.length}`})]}),t.jsxs(ms,{dense:!0,maxHeight:n?420:void 0,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{children:"Time"}),t.jsx(pe,{align:"right",children:"Latency"}),t.jsx(pe,{align:"right",children:"Memory / DB size"}),t.jsx(pe,{align:"right",children:"Cmd or tx /s"}),t.jsx(pe,{align:"right",children:"CPU"}),t.jsx(pe,{align:"right",children:"Clients"})]})}),t.jsx("tbody",{children:o.length===0?t.jsxs(yt,{colSpan:6,children:["No samples yet",e.ok?"":" — the server is unreachable"]}):o.map(c=>t.jsxs("tr",{children:[t.jsx(xe,{num:!0,mono:!0,children:gn(c.t)}),t.jsx(xe,{align:"right",num:!0,children:ko(c.latencyMs)}),t.jsx(xe,{align:"right",num:!0,children:Xt(c.memoryBytes)}),t.jsx(xe,{align:"right",num:!0,muted:c.commandsPerSec==null,children:c.commandsPerSec==null?t.jsx(jv,{}):Wr(c.commandsPerSec,"")}),t.jsx(xe,{align:"right",num:!0,muted:c.cpuCores==null,children:c.cpuCores==null?t.jsx(jv,{}):t.jsx(Pe,{content:Ho(c.cpuCores),children:t.jsx("span",{className:"cursor-help",children:Ji(c.cpuCores)})})}),t.jsx(xe,{align:"right",num:!0,children:K(c.connectedClients)})]},c.t))})]})]})}function jv(){return t.jsx(Pe,{content:"No rate for this sample — it was the first one, or the server had just restarted. Not zero.",children:t.jsx("span",{className:"cursor-help text-fg-subtle",children:"—"})})}function rj(e,n){const r=new Set(e);return r.has(n)?r.delete(n):r.add(n),r}function bC(e,n,r,i){const o=r?n.indexOf(r):-1,c=n.indexOf(i);if(o<0||c<0)return rj(e,i);const[d,h]=o<=c?[o,c]:[c,o],f=!e.has(i),g=new Set(e);for(const p of n.slice(d,h+1))f?g.add(p):g.delete(p);return g}function wC(e,n){const r=n.length>0&&n.every(o=>e.has(o)),i=new Set(e);for(const o of n)r?i.delete(o):i.add(o);return i}function NC(e,n){return n.reduce((r,i)=>e.has(i)?r+1:r,0)}function kC(e){const[n,r]=w.useState(()=>new Set),i=w.useRef(null),o=w.useCallback(S=>n.has(S),[n]),c=w.useCallback(S=>{i.current=S,r(y=>rj(y,S))},[]),d=w.useCallback(S=>{const y=i.current;i.current=S,r(b=>bC(b,e,y,S))},[e]),h=w.useMemo(()=>NC(n,e),[e,n]),f=e.length>0&&h===e.length,g=w.useCallback(()=>{r(S=>wC(S,e)),i.current=null},[e]),p=w.useCallback(()=>{r(new Set),i.current=null},[]),v=w.useCallback(S=>{r(y=>{const b=new Set(y);for(const k of S)b.delete(k);return b})},[]),j=w.useMemo(()=>[...n],[n]);return{selectedIds:j,visibleSelectedCount:h,offPageCount:j.length-h,allVisibleSelected:f,has:o,toggle:c,toggleRange:d,toggleAllVisible:g,clear:p,deselect:v}}function aj(e){if(e==="mixed")return["retry","promote","remove"];const n=[];return(e==="failed"||e==="completed")&&n.push("retry"),e==="delayed"&&n.push("promote"),n.push("remove"),n}const SC={retry:"Retry",promote:"Promote",remove:"Remove"};function bv({selection:e,state:n,queue:r,actions:i,onRun:o,pending:c,searching:d,className:h}){const f=e.selectedIds.length;if(f===0)return null;const g=i??aj(n);return t.jsxs("div",{role:"toolbar","aria-label":"Bulk actions",className:F("flex flex-wrap items-center gap-2 border-b border-border bg-accent/10 px-3 py-2 text-xs",h),children:[t.jsxs("span",{className:"font-medium text-fg",children:[t.jsx("span",{className:"num",children:K(f)})," selected"]}),e.offPageCount>0&&t.jsxs("span",{className:"text-fg-muted",title:"Selection is kept by job id, so it survives the 3 s refresh and paging. These jobs are still selected and the action will include them.",children:["(",t.jsx("span",{className:"num",children:K(e.offPageCount)})," not on this page)"]}),d&&t.jsx("span",{className:"text-fg-subtle",children:"· from the loaded search results, not the whole state"}),t.jsx("span",{className:"flex-1"}),g.map(p=>t.jsx(V,{size:"sm",variant:p==="remove"?"danger":p==="retry"?"primary":"secondary",leftIcon:p==="retry"?t.jsx(Zu,{}):p==="promote"?t.jsx(im,{}):t.jsx(Un,{}),loading:c===p,disabled:!!c,onClick:()=>o(p),children:SC[p]},p)),t.jsx(V,{size:"sm",variant:"ghost",leftIcon:t.jsx(vn,{}),onClick:e.clear,disabled:!!c,children:"Clear"})]})}function wv({result:e,onDismiss:n}){const[r,i]=w.useState(!1),o=e.action==="retry"?"retried":e.action==="promote"?"promoted":"removed",c=e.failed.length;return t.jsxs("div",{className:F("border-b border-border px-3 py-2 text-xs",c>0?"bg-warning/10":"bg-state-completed/10"),role:"status",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("span",{className:"text-fg",children:[t.jsx("span",{className:"num font-semibold",children:K(e.ok.length)})," ",o,c>0&&t.jsxs(t.Fragment,{children:[" · ",t.jsx("span",{className:"num font-semibold text-warning",children:K(c)})," failed"]})]}),c>0&&t.jsxs("button",{type:"button",className:"inline-flex items-center gap-0.5 text-fg-muted hover:text-fg",onClick:()=>i(d=>!d),"aria-expanded":r,children:[r?t.jsx(ps,{className:"size-3"}):t.jsx(Dn,{className:"size-3"}),r?"hide reasons":"why?"]}),t.jsx("span",{className:"flex-1"}),t.jsx("button",{type:"button",className:"rounded p-0.5 text-fg-subtle hover:text-fg","aria-label":"Dismiss",onClick:n,children:t.jsx(vn,{className:"size-3.5"})})]}),r&&c>0&&t.jsx("ul",{className:"mt-1.5 max-h-40 space-y-0.5 overflow-auto font-mono text-[11px] text-fg-muted",children:e.failed.map(d=>t.jsxs("li",{children:[t.jsx("span",{className:"text-fg",children:d.jobId})," — ",d.reason]},d.jobId))})]})}function Um({items:e,value:n,onChange:r,className:i,size:o="md",variant:c="underline",...d}){const h=w.useRef(null),f=g=>{var y;if(!["ArrowLeft","ArrowRight","Home","End"].includes(g.key))return;g.preventDefault();const p=e.filter(b=>!b.disabled),v=p.findIndex(b=>b.value===n);let j=v;g.key==="ArrowRight"&&(j=(v+1)%p.length),g.key==="ArrowLeft"&&(j=(v-1+p.length)%p.length),g.key==="Home"&&(j=0),g.key==="End"&&(j=p.length-1);const S=p[j];if(S){r(S.value,S);const b=(y=h.current)==null?void 0:y.querySelector(`[data-value="${S.value}"]`);b==null||b.focus()}};return t.jsx("div",{ref:h,role:"tablist","aria-label":d["aria-label"],onKeyDown:f,className:F("flex min-w-0 items-end gap-0.5 overflow-x-auto",c==="underline"&&"border-b border-border",c==="pills"&&"rounded-md bg-surface-2 p-0.5",i),children:e.map(g=>{const p=g.value===n;return t.jsxs("button",{role:"tab",type:"button","data-value":g.value,"aria-selected":p,tabIndex:p?0:-1,disabled:g.disabled,title:g.title,onClick:()=>r(g.value,g),className:F("relative inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-accent/60 disabled:opacity-40",o==="sm"?"h-7 px-2 text-xs":"h-8 px-2.5 text-[13px]",c==="underline"&&F("-mb-px rounded-t border-b-2",p?"border-accent text-fg":"border-transparent text-fg-muted hover:border-border-strong hover:text-fg"),c==="pills"&&F("rounded",p?"bg-surface text-fg shadow-sm":"text-fg-muted hover:text-fg")),children:[g.tone&&t.jsx("span",{className:F("status-dot",g.tone),"aria-hidden":!0}),g.icon,g.label,g.count!=null&&t.jsxs("span",{className:F("num rounded px-1 py-px text-[11px] leading-none",p?"bg-surface-3 text-fg":"bg-surface-2 text-fg-subtle"),children:[ft(g.count),g.countSuffix]}),g.locked&&t.jsx(go,{className:"size-3 text-pro","aria-label":"Pro feature"})]},g.value)})})}function Kf({connectionId:e,queue:n,jobs:r,loading:i,error:o,emptyText:c="No jobs in this state",canOperate:d,onAction:h,pendingId:f,showState:g=!0,showGroup:p,onGroupClick:v,highlight:j,compact:S,selection:y}){const b=un(),k=8+(g?1:0)+(p?1:0)+(y?1:0),C=(r==null?void 0:r.length)??0,z=C>0&&r.every(O=>O.state==="delayed");return t.jsxs(ms,{dense:S,className:"min-w-[960px]",children:[t.jsx("thead",{children:t.jsxs("tr",{children:[y&&t.jsx(pe,{className:"w-8",children:t.jsx("input",{type:"checkbox",className:"size-3.5 cursor-pointer align-middle accent-[var(--accent)]","aria-label":y.allVisibleSelected?"Clear selection on this page":"Select every job on this page",title:y.allVisibleSelected?"Clear this page":"Select this page",checked:y.allVisibleSelected,ref:O=>{O&&(O.indeterminate=!y.allVisibleSelected&&y.visibleSelectedCount>0)},disabled:C===0,onChange:y.toggleAllVisible})}),t.jsx(pe,{className:"w-28",children:"ID"}),t.jsx(pe,{children:t.jsx("span",{className:"cursor-help border-b border-dotted border-border-strong",title:'The job name — the first argument of queue.add("name", data). It is the job type / handler, not the queue name.',children:"Name"})}),g&&t.jsx(pe,{children:"State"}),p&&t.jsx(pe,{children:"Group"}),t.jsx(pe,{className:"w-24",children:"Attempts"}),t.jsx(pe,{className:"w-28",children:"Created"}),t.jsx(pe,{className:"w-28",children:z?"Runs at":"Finished"}),t.jsx(pe,{className:"w-24",align:"right",children:"Duration"}),t.jsx(pe,{children:"Data"}),t.jsx(pe,{className:"w-28",align:"right",children:t.jsx("span",{className:"sr-only",children:"Actions"})})]})}),t.jsxs("tbody",{children:[!!o&&!r&&t.jsx(yt,{colSpan:k,className:"text-danger",children:"Could not load jobs"}),i&&!r&&t.jsx(yt,{colSpan:k,children:t.jsx(Kt,{label:"Loading jobs…"})}),r&&r.length===0&&t.jsx(yt,{colSpan:k,children:c}),r==null?void 0:r.map(O=>t.jsx(CC,{job:O,connectionId:e,queue:n,canOperate:d,onAction:h,pending:f===O.id,showState:g,showGroup:!!p,onGroupClick:v,highlight:j,selection:y,onOpen:()=>b(ue.job(e,n,O.id))},O.id))]})]})}function CC({job:e,connectionId:n,queue:r,canOperate:i,onAction:o,pending:c,showState:d,showGroup:h,onGroupClick:f,highlight:g,selection:p,onOpen:v}){const j=e.processedOn&&e.finishedOn?e.finishedOn-e.processedOn:null,S=e.processedOn?e.processedOn-e.timestamp:null,y=e.state==="failed"||e.state==="completed",b=e.state==="delayed",k=(p==null?void 0:p.has(e.id))??!1;return t.jsxs(cl,{onActivate:v,selected:k,className:F(c&&"opacity-50"),children:[p&&t.jsx(xe,{"data-no-row-click":!0,children:t.jsx("input",{type:"checkbox",className:"size-3.5 cursor-pointer align-middle accent-[var(--accent)]","aria-label":`Select job ${e.id}`,checked:k,onChange:()=>{},onClick:C=>{C.stopPropagation(),C.shiftKey?p.toggleRange(e.id):p.toggle(e.id)}})}),t.jsx(xe,{mono:!0,children:t.jsx(Ee,{to:ue.job(n,r,e.id),className:"text-accent hover:underline",title:e.id,children:e.id.length>14?`${e.id.slice(0,12)}…`:e.id})}),t.jsx(xe,{children:t.jsx("span",{className:"block max-w-56 truncate font-medium",title:e.name,children:t.jsx(ba,{text:e.name,needle:g})})}),d&&t.jsx(xe,{children:t.jsx(G0,{state:e.state,size:"xs"})}),h&&t.jsx(xe,{mono:!0,muted:!0,"data-no-row-click":!0,children:e.groupId?f?t.jsx("button",{type:"button",className:"max-w-40 truncate rounded px-1 text-left text-pro hover:bg-pro/10 hover:underline",title:`Show only group ${e.groupId}`,onClick:()=>f(e.groupId),children:e.groupId}):t.jsx(Ee,{to:ue.group(n,r,e.groupId),className:"text-pro hover:underline",title:"Open group",children:e.groupId}):"–"}),t.jsxs(xe,{num:!0,children:[t.jsxs("span",{className:F(e.attemptsMade>1&&"text-warning"),children:[e.attemptsMade,e.attempts!=null&&t.jsxs("span",{className:"text-fg-subtle",children:[" / ",e.attempts]})]}),e.stalledCounter>0&&t.jsxs(be,{variant:"warning",size:"xs",className:"ml-1.5 gap-0.5",title:`Stalled ${e.stalledCounter} time${e.stalledCounter===1?"":"s"}: the worker lost the lock (it died or blocked) and BullMQ recovered the job. Not a state — the job went back to waiting.`,children:[t.jsx(fm,{className:"size-2.5","aria-hidden":!0}),e.stalledCounter]}),e.priority>0&&t.jsxs(be,{variant:"violet",size:"xs",className:"ml-1.5",title:"priority",children:["p",e.priority]})]}),t.jsx(xe,{muted:!0,children:t.jsx(Yt,{value:e.timestamp})}),t.jsx(xe,{muted:!0,children:e.state==="delayed"&&e.delayedUntil?t.jsx(Pe,{content:t.jsxs(t.Fragment,{children:["runs at ",gn(e.delayedUntil)]}),side:"left",children:t.jsx("span",{className:"text-state-delayed",children:t.jsx(Yt,{value:e.delayedUntil})})}):t.jsx(Yt,{value:e.finishedOn,emptyText:e.processedOn?"running…":"–"})}),t.jsx(xe,{num:!0,align:"right",muted:!0,children:t.jsx(Pe,{content:t.jsxs(t.Fragment,{children:[S!=null&&t.jsxs(t.Fragment,{children:["wait ",An(S)," · "]}),e.processedOn&&t.jsxs(t.Fragment,{children:["started ",gn(e.processedOn)]})]}),side:"left",children:t.jsx("span",{children:j!=null?An(j):e.processedOn?An(Date.now()-e.processedOn):"–"})})}),t.jsx(xe,{className:"max-w-md",children:t.jsx(_C,{job:e,highlight:g})}),t.jsx(xe,{align:"right","data-no-row-click":!0,children:t.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[i&&o&&y&&t.jsx(V,{size:"icon-xs",variant:"ghost",title:"Retry","aria-label":"Retry job",onClick:()=>o(e.id,"retry",e),children:t.jsx(Zu,{})}),i&&o&&b&&t.jsx(V,{size:"icon-xs",variant:"ghost",title:"Promote","aria-label":"Promote job",onClick:()=>o(e.id,"promote",e),children:t.jsx(im,{})}),i&&o&&t.jsx(V,{size:"icon-xs",variant:"ghost",title:"Remove","aria-label":"Remove job",className:"hover:text-danger",onClick:()=>o(e.id,"remove",e),children:t.jsx(Un,{})}),t.jsx(V,{size:"icon-xs",variant:"ghost",title:"Open","aria-label":"Open job",onClick:v,children:t.jsx(Br,{})})]})})]})}function ba({text:e,needle:n}){const r=n==null?void 0:n.trim();if(!r||!e)return e;const i=e.toLowerCase(),o=r.toLowerCase(),c=[];let d=0,h=i.indexOf(o,d),f=0;for(;h>=0&&f++<200;)h>d&&c.push(e.slice(d,h)),c.push(t.jsx("mark",{children:e.slice(h,h+r.length)},h)),d=h+r.length,h=i.indexOf(o,d);return d<e.length&&c.push(e.slice(d)),t.jsx(t.Fragment,{children:c})}function _C({job:e,highlight:n}){const[r,i]=w.useState(!1),o=e.dataPreview??"";if(!o&&e.dataTruncated&&e.dataBytes)return t.jsxs("span",{className:"font-mono text-xs text-fg-subtle",title:"Payloads this large are not previewed in lists so a page never moves megabytes through Redis. Open the job to see it.",children:["payload ",Xt(e.dataBytes)," · open the job",e.failedReason&&t.jsx("span",{className:"block truncate font-sans text-danger",title:e.failedReason,children:t.jsx(ba,{text:e.failedReason,needle:n})})]});if(e.failedReason&&!r)return t.jsxs("div",{className:"flex flex-col gap-0.5","data-no-row-click":!0,children:[t.jsx("button",{type:"button",className:"truncate text-left font-mono text-xs text-fg-muted hover:text-fg",onClick:()=>i(!0),title:"Expand",children:o?t.jsx(ba,{text:o,needle:n}):t.jsx("span",{className:"text-fg-subtle",children:"{}"})}),t.jsx("span",{className:"truncate text-xs text-danger",title:e.failedReason,children:t.jsx(ba,{text:e.failedReason,needle:n})})]});if(!r)return t.jsx("button",{type:"button","data-no-row-click":!0,className:"block w-full truncate text-left font-mono text-xs text-fg-muted hover:text-fg",onClick:()=>i(!0),title:"Expand",children:o?t.jsx(ba,{text:o,needle:n}):t.jsx("span",{className:"text-fg-subtle",children:"{}"})});const c=e.dataTruncated?null:s2(o);return t.jsxs("div",{"data-no-row-click":!0,className:"py-1",children:[t.jsxs("pre",{className:"max-h-64 overflow-auto rounded border border-border bg-bg p-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-all text-fg",children:[t.jsx(ba,{text:c??o,needle:n}),e.dataTruncated&&t.jsx("span",{className:"text-fg-subtle",children:" … (truncated, open the job for the full payload)"})]}),e.failedReason&&t.jsx("p",{className:"mt-1 text-xs break-words text-danger",children:t.jsx(ba,{text:e.failedReason,needle:n})}),t.jsx("button",{type:"button",className:"mt-1 text-[11px] text-fg-subtle hover:text-fg",onClick:()=>i(!1),children:"collapse"})]})}const PC=[25,50,100,200];function ld({page:e,pageSize:n,total:r,onPage:i,onPageSize:o,count:c,className:d}){const h=Math.max(1,Math.ceil(r/n)),f=r===0?0:(e-1)*n+1,g=c!=null?f+Math.max(0,c-1):Math.min(r,e*n);return t.jsxs("div",{className:`flex flex-wrap items-center justify-between gap-3 text-xs text-fg-muted ${d??""}`,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"num",children:r===0?"0 items":`${K(f)}–${K(g)} of ${K(r)}`}),o&&t.jsxs("label",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"sr-only",children:"Page size"}),t.jsx(dt,{"aria-label":"Page size",className:"!h-7 !w-auto !py-0 text-xs",value:String(n),onChange:p=>o(Number(p.target.value)),options:PC.map(p=>({value:String(p),label:`${p} / page`}))})]})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(V,{size:"icon-sm",variant:"ghost","aria-label":"First page",disabled:e<=1,onClick:()=>i(1),children:t.jsx(pN,{})}),t.jsx(V,{size:"icon-sm",variant:"ghost","aria-label":"Previous page",disabled:e<=1,onClick:()=>i(e-1),children:t.jsx(Su,{})}),t.jsxs("span",{className:"num min-w-16 text-center",children:[e," / ",h]}),t.jsx(V,{size:"icon-sm",variant:"ghost","aria-label":"Next page",disabled:e>=h,onClick:()=>i(e+1),children:t.jsx(Dn,{})}),t.jsx(V,{size:"icon-sm",variant:"ghost","aria-label":"Last page",disabled:e>=h,onClick:()=>i(h),children:t.jsx(xN,{})})]})]})}function Ht({open:e,onClose:n,onConfirm:r,title:i,description:o,confirmText:c="Confirm",danger:d,typeToConfirm:h,loading:f,children:g}){const[p,v]=w.useState(""),j=!h||p===h;return t.jsxs(bn,{open:e,onClose:n,size:"sm",title:t.jsxs("span",{className:"flex items-center gap-2",children:[d&&t.jsx(ts,{className:"size-4 text-danger","aria-hidden":!0}),i]}),description:o,footer:t.jsxs(t.Fragment,{children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:n,disabled:f,children:"Cancel"}),t.jsx(V,{variant:d?"danger":"primary",size:"sm",disabled:!j,loading:f,onClick:async()=>{await r(),v("")},children:c})]}),children:[g,h&&t.jsx(Te,{autoFocus:!0,mono:!0,label:t.jsxs(t.Fragment,{children:["Type ",t.jsx("span",{className:"font-mono text-fg",children:h})," to confirm"]}),value:p,onChange:S=>v(S.target.value),onKeyDown:S=>{S.key==="Enter"&&j&&!f&&r()},autoComplete:"off",spellCheck:!1})]})}async function EC(e){try{return await navigator.clipboard.writeText(e),!0}catch{try{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}}}function _o({value:e,label:n="Copy",copiedLabel:r="Copied",showLabel:i,icon:o,variant:c="ghost",size:d,...h}){const[f,g]=w.useState(!1);return w.useEffect(()=>{if(!f)return;const p=setTimeout(()=>g(!1),1500);return()=>clearTimeout(p)},[f]),t.jsxs(V,{variant:c,size:d??(i?"sm":"icon-sm"),"aria-label":f?r:n,title:f?r:n,onClick:async()=>{await EC(typeof e=="function"?e():e)&&g(!0)},...h,children:[f?t.jsx(Zr,{className:"text-success"}):o??t.jsx(Uy,{}),i&&(f?r:n)]})}function Qm({code:e,language:n,className:r,maxHeight:i=480,copy:o=!0,wrap:c,header:d,tone:h="default"}){return t.jsxs("div",{className:F("card relative overflow-hidden",h==="danger"&&"border-danger/40",r),children:[(d||n||o)&&t.jsxs("div",{className:"flex h-8 items-center justify-between border-b border-border bg-surface-2/60 pr-1 pl-3",children:[t.jsx("span",{className:"text-[11px] tracking-wide text-fg-subtle uppercase",children:d??n}),o&&t.jsx(_o,{value:e,size:"icon-xs"})]}),t.jsx("pre",{className:F("overflow-auto p-3 font-mono text-xs leading-relaxed text-fg",c?"break-words whitespace-pre-wrap":"whitespace-pre",h==="danger"&&"text-danger"),style:{maxHeight:i},children:t.jsx("code",{children:e})})]})}const ij="new Worker(name, fn, { metrics: { maxDataPoints: MetricsTime.ONE_WEEK } })";function lj(e){return e.isLoading?"loading":e.isError||!e.data?"unknown":e.data.metricsEnabled?"on":"off"}function RC({connectionId:e,queueName:n}){const r=ym(e||void 0,n||void 0,{enabled:!!e&&!!n}),i=lj(r);return i==="loading"||i==="on"?null:t.jsx(oj,{title:i==="off"?`Queue "${n}" does not collect BullMQ metrics — this alert will stay inert`:`Could not read the setup of "${n}", so it is unknown whether it collects metrics`})}function MC({folder:e}){const[n,r]=w.useState({}),i=(e==null?void 0:e.queues)??[],o=p=>`${p.connectionId}/${p.queueName}`;w.useEffect(()=>r({}),[e==null?void 0:e.id]);const c=w.useCallback((p,v)=>{r(j=>j[p]===v?j:{...j,[p]:v})},[]);if(!e||i.length===0)return null;const d=i.filter(p=>n[o(p)]==="off").map(p=>p.queueName),h=i.filter(p=>n[o(p)]==="unknown").map(p=>p.queueName),f=i.map(p=>t.jsx(TC,{id:o(p),queue:p,onState:c},o(p)));if(d.length===0&&h.length===0)return t.jsx(t.Fragment,{children:f});const g=[d.length>0?`${d.length} of ${i.length} queue(s) collect no metrics: ${d.join(", ")}`:null,h.length>0?`could not read: ${h.join(", ")}`:null].filter(Boolean);return t.jsxs(t.Fragment,{children:[f,t.jsx(oj,{title:`Folder "${e.name}" — ${g.join(" · ")}`})]})}function TC({id:e,queue:n,onState:r}){const i=ym(n.connectionId,n.queueName),o=lj(i);return w.useEffect(()=>r(e,o),[e,o,r]),null}function oj({title:e}){return t.jsxs("div",{className:"space-y-2 rounded-md border border-warning/40 bg-warning/10 p-3",role:"status",children:[t.jsxs("p",{className:"flex items-start gap-2 text-xs text-fg",children:[t.jsx(ts,{className:"mt-px size-4 shrink-0 text-warning"}),t.jsx("span",{children:e})]}),t.jsxs("p",{className:"text-xs text-fg-muted",children:["Failure alerts are measured only from BullMQ's own metrics counters — the completed/failed sorted sets lie as soon as"," ",t.jsx("code",{className:"font-mono",children:"removeOnComplete"})," prunes them. Turn metrics on in the worker and the alert starts measuring by itself:"]}),t.jsx(Qm,{code:ij,language:"ts",wrap:!0,maxHeight:80})]})}function qC({measurement:e}){var r;if(!e)return t.jsx(Pe,{content:"Not evaluated yet — the server evaluates alerts every few seconds.",children:t.jsx(be,{variant:"neutral",children:"pending"})});if(e.state==="no_metrics")return t.jsx(Pe,{content:`This queue collects no BullMQ metrics, so the alert cannot measure and will not fire. Enable it with ${ij}`,children:t.jsxs(be,{variant:"warning",dot:!0,children:[t.jsx(ts,{className:"size-3"})," can't measure"]})});if(e.state==="warming_up")return t.jsx(Pe,{content:"Redis could not be read on the last evaluation, so the rule kept its previous state. It measures again on the next tick.",children:t.jsxs(be,{variant:"info",dot:!0,children:[t.jsx(Dy,{className:"size-3"})," waiting for data"]})});const n=((r=e.queuesWithoutMetrics)==null?void 0:r.length)??0;return n>0?t.jsx(Pe,{content:`Measuring, but ${n} queue(s) it covers collect no metrics and are invisible to this rule: ${(e.queuesWithoutMetrics??[]).slice(0,10).join(", ")}${n>10?` and ${n-10} more`:""}`,children:t.jsx(be,{variant:"warning",dot:!0,children:"partial"})}):t.jsx(Pe,{content:e.source==="metrics"?"Measured from BullMQ metrics counters.":"Measured from live queue counts.",children:t.jsx(be,{variant:"success",dot:!0,children:"ok"})})}const $C={waiting_above:"Waiting jobs above threshold (incl. prioritized, excl. paused)",failed_above:"Failures above threshold in a window (needs worker metrics)",failed_rate_above:"Failure rate above percent (needs worker metrics)",duration_above:"Processing time above (p50 / p95 of completed jobs)"};function IC(e,n){return{name:"",enabled:!0,scopeType:(n==null?void 0:n.type)??"queue",connectionId:(n==null?void 0:n.type)==="queue"||(n==null?void 0:n.type)==="connection"?n.connectionId:e,queueName:(n==null?void 0:n.type)==="queue"?n.queueName:"",folderId:(n==null?void 0:n.type)==="folder"?n.folderId:"",kind:"failed_above",threshold:"10",windowMinutes:"5",percent:"5",minSample:"20",seconds:"30",percentile:"95",cooldownMinutes:"30",channels:[]}}function zC(e){const n=e.condition;return{name:e.name,enabled:e.enabled,scopeType:e.scope.type,connectionId:e.scope.type==="queue"||e.scope.type==="connection"?e.scope.connectionId:"",queueName:e.scope.type==="queue"?e.scope.queueName:"",folderId:e.scope.type==="folder"?e.scope.folderId:"",kind:n.kind,threshold:"threshold"in n?String(n.threshold):"10",windowMinutes:"windowMinutes"in n?String(n.windowMinutes):"5",percent:"percent"in n?String(n.percent):"5",minSample:"minSample"in n?String(n.minSample):"20",seconds:n.kind==="duration_above"?String(n.seconds):"30",percentile:n.kind==="duration_above"?String(n.percentile):"95",cooldownMinutes:String(e.cooldownMinutes),channels:e.channels.map(r=>r.type==="slack"?{type:"slack",url:r.webhookUrl,headersText:""}:{type:"webhook",url:r.url,headersText:Object.entries(r.headers??{}).map(([i,o])=>`${i}: ${o}`).join(`
536
+ `)})}}function OC(e){const n={};for(const r of e.split(`
537
+ `)){const i=r.trim();if(!i)continue;const o=i.indexOf(":");if(o<=0)throw new Error(`Header line "${i}" must look like "Name: value"`);n[i.slice(0,o).trim()]=i.slice(o+1).trim()}return Object.keys(n).length?n:void 0}function AC(e){const n=c=>c.trim()===""?NaN:Number(c);let r;switch(e.kind){case"waiting_above":r={kind:"waiting_above",threshold:n(e.threshold)};break;case"failed_above":r={kind:"failed_above",threshold:n(e.threshold),windowMinutes:n(e.windowMinutes)};break;case"duration_above":r={kind:"duration_above",seconds:n(e.seconds),percentile:e.percentile==="50"?50:95,windowMinutes:n(e.windowMinutes),minSample:n(e.minSample)};break;default:r={kind:"failed_rate_above",percent:n(e.percent),windowMinutes:n(e.windowMinutes),minSample:n(e.minSample)};break}const i=e.scopeType==="folder"?{type:"folder",folderId:e.folderId}:e.scopeType==="global"?{type:"global"}:e.scopeType==="connection"?{type:"connection",connectionId:e.connectionId}:{type:"queue",connectionId:e.connectionId,queueName:e.queueName},o=e.channels.map(c=>c.type==="slack"?{type:"slack",webhookUrl:c.url.trim()}:{type:"webhook",url:c.url.trim(),headers:OC(c.headersText)});return{name:e.name.trim(),enabled:e.enabled,scope:i,condition:r,channels:o,cooldownMinutes:n(e.cooldownMinutes)}}function od({open:e,onClose:n,alert:r,initialScope:i}){var z,O,T,M;const o=xs(),c=q2(),d=L0(),h=((O=(z=o.data)==null?void 0:z[0])==null?void 0:O.id)??"",[f,g]=w.useState(()=>r?zC(r):IC(h,i)),[p,v]=w.useState({}),j=u2(f.connectionId||void 0,{enabled:f.scopeType==="queue"}),S=Jr(),y=(E,I)=>g(Q=>({...Q,[E]:I})),b=(E,I)=>g(Q=>({...Q,channels:Q.channels.map((H,q)=>q===E?{...H,...I}:H)})),k=c.isPending||d.isPending,C=()=>{let E;try{E=AC(f)}catch(H){v({channels:H.message});return}const I=y0.safeParse(E);if(!I.success){const H={};for(const q of I.error.issues){const B=q.path[0]==="condition"||q.path[0]==="scope"?String(q.path[1]??q.path[0]):q.path[0]==="channels"?"channels":String(q.path[0]);H[B]=q.path[0]==="channels"?`Channel ${Number(q.path[1])+1}: ${q.message}`:q.message}v(H);return}v({});const Q=()=>{X.success(r?"Alert updated":"Alert created"),n()};r?d.mutate({id:r.id,input:I.data},{onSuccess:Q,onError:H=>X.error(ve(H))}):c.mutate(I.data,{onSuccess:Q,onError:H=>X.error(ve(H))})};return t.jsx(bn,{open:e,onClose:n,size:"lg",title:r?"Edit rule":"New rule",description:"Evaluated on the server every few seconds. Every queue that breaks it shows up in Needs attention; add channels to be notified too.",footer:t.jsxs(t.Fragment,{children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsx(V,{variant:"primary",size:"sm",onClick:C,loading:k,children:r?"Save changes":"Create rule"})]}),children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"grid gap-3 sm:grid-cols-[1fr_auto]",children:[t.jsx(Te,{label:"Name",value:f.name,onChange:E=>y("name",E.target.value),error:p.name,autoFocus:!0,placeholder:"payments: failures spiking"}),t.jsx(rd,{label:"Enabled",className:"justify-end",children:t.jsx(Pm,{checked:f.enabled,onChange:E=>y("enabled",E.target.checked),label:f.enabled?"On":"Off",className:"h-8 items-center"})})]}),t.jsxs("fieldset",{className:"grid gap-3 rounded-md border border-border p-3 sm:grid-cols-3",children:[t.jsx("legend",{className:"px-1 text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:"Scope"}),t.jsx(dt,{label:"Watch",value:f.scopeType,onChange:E=>y("scopeType",E.target.value),options:[{value:"global",label:"Every queue"},{value:"connection",label:"Every queue on a connection"},{value:"folder",label:"Every queue in a folder"},{value:"queue",label:"One queue"}]}),f.scopeType==="global"?t.jsx("p",{className:"self-end pb-2 text-xs text-fg-muted sm:col-span-2",children:"Every discovered queue on every connection, except hidden ones."}):f.scopeType==="connection"?t.jsx(dt,{label:"Connection",value:f.connectionId,onChange:E=>y("connectionId",E.target.value),error:p.connectionId,wrapperClassName:"sm:col-span-2",options:(o.data??[]).map(E=>({value:E.id,label:E.name}))}):f.scopeType==="queue"?t.jsxs(t.Fragment,{children:[t.jsx(dt,{label:"Connection",value:f.connectionId,onChange:E=>g(I=>({...I,connectionId:E.target.value,queueName:""})),error:p.connectionId,options:(o.data??[]).map(E=>({value:E.id,label:E.name}))}),t.jsx(dt,{label:"Queue",value:f.queueName,onChange:E=>y("queueName",E.target.value),error:p.queueName,options:[{value:"",label:j.isLoading?"Loading…":"Pick a queue",disabled:!0},...(j.data??[]).map(E=>({value:E.name,label:E.name}))]})]}):t.jsx(dt,{label:"Folder",value:f.folderId,onChange:E=>y("folderId",E.target.value),error:p.folderId,wrapperClassName:"sm:col-span-2",options:[{value:"",label:S.isLoading?"Loading…":(T=S.data)!=null&&T.length?"Pick a folder":"No folders yet",disabled:!0},...(S.data??[]).map(E=>{var I,Q;return{value:E.id,label:E.parentId?`${((Q=(I=S.data)==null?void 0:I.find(H=>H.id===E.parentId))==null?void 0:Q.name)??"?"} / ${E.name}`:E.name}})]}),t.jsx("p",{className:"text-[11px] text-fg-subtle sm:col-span-3",children:f.scopeType==="queue"?"A rule on one queue replaces wider rules of the same kind for that queue.":"Wide rules flag each queue that breaks them and notify once, naming the worst. The most specific rule of each kind wins: a queue or folder rule overrides this one for its queues."})]}),t.jsxs("fieldset",{className:"grid gap-3 rounded-md border border-border p-3",children:[t.jsx("legend",{className:"px-1 text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:"Condition"}),t.jsx(dt,{label:"Kind",value:f.kind,onChange:E=>y("kind",E.target.value),options:Tk.map(E=>({value:E,label:$C[E]}))}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[(f.kind==="waiting_above"||f.kind==="failed_above")&&t.jsx(Te,{label:f.kind==="waiting_above"?"Waiting jobs above":"Failures above",type:"number",min:1,value:f.threshold,onChange:E=>y("threshold",E.target.value),error:p.threshold}),f.kind==="failed_rate_above"&&t.jsx(Te,{label:"Failure rate above (%)",type:"number",min:.1,max:100,step:.1,value:f.percent,onChange:E=>y("percent",E.target.value),error:p.percent}),f.kind==="duration_above"&&t.jsxs(t.Fragment,{children:[t.jsx(Te,{label:"Slower than (seconds)",type:"number",min:.001,step:.1,value:f.seconds,onChange:E=>y("seconds",E.target.value),error:p.seconds}),t.jsx(dt,{label:"Percentile",value:f.percentile,onChange:E=>y("percentile",E.target.value),options:[{value:"95",label:"p95 (the slow tail)"},{value:"50",label:"p50 (the typical job)"}]})]}),f.kind!=="waiting_above"&&t.jsx(Te,{label:"Window (minutes)",type:"number",min:1,max:1440,value:f.windowMinutes,onChange:E=>y("windowMinutes",E.target.value),error:p.windowMinutes}),(f.kind==="failed_rate_above"||f.kind==="duration_above")&&t.jsx(Te,{label:f.kind==="duration_above"?"Min sample (completed jobs)":"Min sample (finished jobs)",type:"number",min:1,max:f.kind==="duration_above"?100:void 0,value:f.minSample,onChange:E=>y("minSample",E.target.value),error:p.minSample,hint:"Ignore windows with fewer jobs."})]}),f.kind==="duration_above"&&t.jsxs("p",{className:"text-xs text-fg-muted",children:["Time from a job starting its final attempt to completing, over the newest 100 completed jobs in the window. BullMQ metrics count jobs but do not time them, so this reads completed jobs still in Redis: with"," ",t.jsx("code",{className:"font-mono",children:"removeOnComplete: true"})," there is nothing to read and the rule never fires;"," ",t.jsx("code",{className:"font-mono",children:"{ count: N }"})," keeps exactly the recent jobs it needs."]}),$k(f.kind)&&t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"text-xs text-fg-muted",children:["Measured from BullMQ's own per-minute metrics, so the number is right even when"," ",t.jsx("code",{className:"font-mono",children:"removeOnComplete"})," prunes the queue, and exact from the first evaluation — a restart does not reset the window."]}),f.scopeType==="queue"?f.connectionId&&f.queueName&&t.jsx(RC,{connectionId:f.connectionId,queueName:f.queueName}):f.scopeType==="folder"?f.folderId&&t.jsx(MC,{folder:(M=S.data)==null?void 0:M.find(E=>E.id===f.folderId)}):null]})]}),t.jsxs("fieldset",{className:"space-y-3 rounded-md border border-border p-3",children:[t.jsx("legend",{className:"px-1 text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:"Notify"}),f.channels.length===0&&t.jsxs("p",{className:"text-xs text-fg-muted",children:["Dashboard only: breaking queues show up in ",t.jsx("span",{className:"text-fg",children:"Needs attention"})," and the rule keeps its fired/resolved history, but nobody is notified. Add a channel to be told."]}),f.channels.map((E,I)=>t.jsxs("div",{className:"grid gap-2 rounded-md bg-surface-2/50 p-2 sm:grid-cols-[130px_1fr_auto]",children:[t.jsx(dt,{"aria-label":"Channel type",value:E.type,onChange:Q=>b(I,{type:Q.target.value}),options:[{value:"slack",label:"Slack webhook"},{value:"webhook",label:"Webhook (POST)"}]}),t.jsx(Te,{"aria-label":"URL",mono:!0,placeholder:E.type==="slack"?"https://hooks.slack.com/services/…":"https://example.com/hooks/bullmq",value:E.url,onChange:Q=>b(I,{url:Q.target.value})}),t.jsx(V,{size:"icon",variant:"ghost","aria-label":"Remove channel",className:"hover:text-danger",onClick:()=>g(Q=>({...Q,channels:Q.channels.filter((H,q)=>q!==I)})),children:t.jsx(Un,{})}),E.type==="webhook"&&t.jsx(Yi,{"aria-label":"Headers",mono:!0,rows:2,placeholder:`Authorization: Bearer …
538
+ X-Source: bullpane`,value:E.headersText,onChange:Q=>b(I,{headersText:Q.target.value}),wrapperClassName:"sm:col-span-3",hint:"One header per line, Name: value"})]},I)),p.channels&&t.jsx("p",{className:"text-xs text-danger",role:"alert",children:p.channels}),t.jsx(V,{size:"sm",variant:"ghost",leftIcon:t.jsx(es,{}),onClick:()=>g(E=>({...E,channels:[...E.channels,{type:"webhook",url:"",headersText:""}]})),children:"Add channel"})]}),f.channels.length>0&&t.jsx(Te,{label:"Cooldown (minutes)",type:"number",min:1,max:1440,value:f.cooldownMinutes,onChange:E=>y("cooldownMinutes",E.target.value),error:p.cooldownMinutes,hint:"Minimum time between notifications while the rule keeps firing.",wrapperClassName:"max-w-xs"})]})})}const LC=[15,30,60,0],FC={15:"15 min",30:"30 min",60:"1 hour",0:"All"};function DC(e){if(!e)return!1;const n=Uu(e.completed)+Uu(e.failed);return(e.completed.length>0||e.failed.length>0)&&n>0}function UC(e,n){const r=(e==null?void 0:e.completed)??[],i=(e==null?void 0:e.failed)??[],o=Math.max(r.length,i.length),d=Math.min(n===0?o:n,o),h=f=>QC(f,o).slice(o-d);return{completed:h(r),failed:h(i),minutes:d,available:o,truncated:n!==0&&n>o}}function QC(e,n){return e.length>=n?e:[...Array.from({length:n-e.length},()=>0),...e]}function BC(e){if(e.minutes===0)return{perMinute:null,perHour:null,completed:0,failed:0,successPct:null};const n=Uu(e.completed),r=Uu(e.failed),i=n+r,o=n/e.minutes;return{perMinute:o,perHour:o*60,completed:n,failed:r,successPct:i>0?n/i*100:null}}function VC(e){return e.completed.map((n,r)=>{const i=e.failed[r]??0,o=n+i;return o>0?n/o*100:null})}function Nv(e){const n=e.filter(o=>!!o&&o.length>0);if(n.length===0)return[];const r=Math.max(...n.map(o=>o.length)),i=new Array(r).fill(0);for(const o of n){const c=r-o.length;for(let d=0;d<o.length;d++)i[c+d]+=o[d]}return i}function Uu(e){return(e??[]).reduce((n,r)=>n+r,0)}function HC(e){const n=e??[],r=[],i=[];for(const o of n){if(o.processedOn!=null&&o.timestamp!=null){const c=o.processedOn-o.timestamp;Number.isFinite(c)&&c>=0&&r.push(c)}if(o.finishedOn!=null&&o.processedOn!=null){const c=o.finishedOn-o.processedOn;Number.isFinite(c)&&c>=0&&i.push(c)}}return{wait:kv(r),process:kv(i),sampled:n.length}}function kv(e){if(e.length===0)return null;const n=[...e].sort((r,i)=>r-i);return{min:n[0],median:Sv(n,50),p95:Sv(n,95),max:n[n.length-1],count:n.length}}function Sv(e,n){if(e.length===0)return 0;const r=Math.ceil(n/100*e.length);return e[Math.min(e.length-1,Math.max(0,r-1))]}const In={top:10,right:8,bottom:20,left:40},Cv=4;function _v({series:e,height:n=180,className:r,formatValue:i=ft,formatX:o=GC,maxY:c,ariaLabel:d,emptyText:h="No data"}){const f=w.useId(),g=w.useRef(null),[p,v]=w.useState(null),[j,S]=w.useState(720),y=Math.max(...e.map(q=>q.values.length),0),{max:b,plotW:k,plotH:C,scaleX:z,scaleY:O}=w.useMemo(()=>{const q=e.flatMap(De=>De.values.filter(W=>W!=null&&Number.isFinite(W))),B=q.length?Math.max(...q):0,de=c??JC(B),ce=Math.max(1,j-In.left-In.right),Ne=Math.max(1,n-In.top-In.bottom);return{max:de,plotW:ce,plotH:Ne,scaleX:De=>In.left+(y>1?De/(y-1)*ce:ce/2),scaleY:De=>In.top+Ne-(de>0?De/de*Ne:0)}},[e,j,n,c,y]),T=y>0&&e.some(q=>q.values.some(B=>B!=null)),M=q=>{var Ie;const B=(Ie=g.current)==null?void 0:Ie.getBoundingClientRect();if(!B||y===0)return;const ce=((q.clientX-B.left)/B.width*j-In.left)/k,Ne=Math.round(ce*(y-1));v(Ne>=0&&Ne<y?Ne:null)},[E,I]=w.useState(null),Q=w.useCallback(q=>{g.current=q,I(q)},[]);w.useEffect(()=>{if(!E||typeof ResizeObserver>"u")return;const q=new ResizeObserver(([B])=>{const de=Math.round(B.contentRect.width);de>0&&S(de)});return q.observe(E),()=>q.disconnect()},[E]);const H=Array.from({length:Cv+1},(q,B)=>b/Cv*B);return t.jsxs("div",{ref:Q,className:F("relative w-full select-none",r),onPointerMove:M,onPointerLeave:()=>v(null),children:[t.jsxs("svg",{width:"100%",height:n,viewBox:`0 0 ${j} ${n}`,preserveAspectRatio:"none",role:"img","aria-label":d??e.map(q=>q.label).join(" and "),className:"overflow-visible",children:[t.jsx("defs",{children:e.map(q=>t.jsxs("linearGradient",{id:`area-${f}-${q.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:q.color,stopOpacity:.28}),t.jsx("stop",{offset:"100%",stopColor:q.color,stopOpacity:.02})]},q.key))}),H.map((q,B)=>{const de=O(q);return t.jsxs("g",{children:[t.jsx("line",{x1:In.left,x2:j-In.right,y1:de,y2:de,stroke:"var(--border)",strokeWidth:1,shapeRendering:"crispEdges"}),t.jsx("text",{x:In.left-6,y:de+3,textAnchor:"end",className:"fill-[var(--fg-subtle)] text-[9px]",style:{fontVariantNumeric:"tabular-nums"},children:i(q)})]},B)}),T?t.jsxs(t.Fragment,{children:[e.map(q=>t.jsx(KC,{series:q,gradientId:`area-${f}-${q.key}`,scaleX:z,scaleY:O,baseline:In.top+C},q.key)),p!=null&&t.jsxs("g",{pointerEvents:"none",children:[t.jsx("line",{x1:z(p),x2:z(p),y1:In.top,y2:In.top+C,stroke:"var(--fg-subtle)",strokeWidth:1,strokeDasharray:"3 3"}),e.map(q=>{const B=q.values[p];return B==null||!Number.isFinite(B)?null:t.jsx("circle",{cx:z(p),cy:O(B),r:3,fill:q.color,stroke:"var(--surface)",strokeWidth:1.5},q.key)})]})]}):t.jsx("text",{x:j/2,y:n/2,textAnchor:"middle",className:"fill-[var(--fg-subtle)] text-[11px]",children:h}),T&&y>1&&t.jsx("g",{children:[0,Math.floor((y-1)/2),y-1].map((q,B)=>t.jsx("text",{x:z(q),y:n-6,textAnchor:B===0?"start":B===2?"end":"middle",className:"fill-[var(--fg-subtle)] text-[9px]",children:o(q,y)},q))})]}),p!=null&&T&&t.jsx(WC,{xPct:z(p)/j*100,title:o(p,y),rows:e.map(q=>({label:q.label,color:q.color,value:q.values[p]})).filter(q=>q.value!=null&&Number.isFinite(q.value)),formatValue:i})]})}function KC({series:e,gradientId:n,scaleX:r,scaleY:i,baseline:o}){const c=[];let d=null;return e.values.forEach((h,f)=>{if(h==null||!Number.isFinite(h)){d=null;return}const g=[r(f),i(h)];d?d.push(g):(d=[g],c.push(d))}),t.jsx("g",{children:c.map((h,f)=>{const g=h.map(([p,v],j)=>`${j===0?"M":"L"}${p.toFixed(1)},${v.toFixed(1)}`).join(" ");return t.jsxs("g",{children:[e.area&&h.length>1&&t.jsx("path",{d:`${g} L${h[h.length-1][0].toFixed(1)},${o} L${h[0][0].toFixed(1)},${o} Z`,fill:`url(#${n})`}),h.length>1?t.jsx("path",{d:g,fill:"none",stroke:e.color,strokeWidth:1.6,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:e.dashed?"4 3":void 0,vectorEffect:"non-scaling-stroke"}):t.jsx("circle",{cx:h[0][0],cy:h[0][1],r:1.8,fill:e.color})]},f)})})}function WC({xPct:e,title:n,rows:r,formatValue:i}){if(r.length===0)return null;const o=e>55;return t.jsxs("div",{className:"pointer-events-none absolute top-1 z-10 min-w-32 rounded-md border border-border bg-surface px-2 py-1.5 text-[11px] shadow-[var(--shadow)]",style:{left:`${e}%`,transform:o?"translateX(calc(-100% - 8px))":"translateX(8px)"},role:"status",children:[t.jsx("div",{className:"mb-1 text-fg-subtle",children:n}),r.map(c=>t.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[t.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{background:c.color},"aria-hidden":!0}),t.jsx("span",{className:"text-fg-muted",children:c.label}),t.jsx("span",{className:"num ml-auto font-medium text-fg",children:i(c.value)})]},c.label))]})}function ZC({series:e,className:n}){return t.jsx("div",{className:F("flex flex-wrap items-center gap-3 text-[11px] text-fg-muted",n),children:e.map(r=>t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"h-0.5 w-3 rounded-full",style:{background:r.color},"aria-hidden":!0}),r.label]},r.key))})}function GC(e,n){const r=n-1-e;return r===0?"now":`${K(r)} min ago`}function JC(e){if(!Number.isFinite(e)||e<=0)return 4;const n=10**Math.floor(Math.log10(e));for(const r of[1,2,2.5,5,10]){const i=r*n;if(i>=e)return i}return 10*n}const XC=50;function YC({connectionId:e,queue:n,summary:r,onOpenState:i}){const[o,c]=w.useState(60),d=r==null?void 0:r.metrics,h=DC(d),f=w.useMemo(()=>UC(d,o),[d,o]),g=w.useMemo(()=>BC(f),[f]),p=w.useMemo(()=>VC(f),[f]);return t.jsxs("div",{className:"space-y-3",children:[t.jsx(t_,{counts:r==null?void 0:r.counts,onOpenState:i}),h?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("h2",{className:"text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"Throughput & history"}),t.jsx(n_,{value:o,onChange:c,available:f.available})]}),f.truncated&&t.jsxs("p",{className:"text-[11px] text-fg-subtle",role:"status",children:["This queue only stores ",K(f.available)," minute",f.available===1?"":"s"," of metrics — showing everything it has. BullMQ keeps one point per minute up to the worker's ",t.jsx("code",{className:"font-mono text-fg-muted",children:"maxDataPoints"}),"."]}),t.jsx(s_,{rates:r==null?void 0:r.rates,tp:g,minutes:f.minutes}),t.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[t.jsx(Ev,{icon:t.jsx(om,{}),title:"Processed",hint:`Completed and failed per minute over the last ${K(f.minutes)} min, straight from BullMQ's own metrics collection.`,legend:e_,children:t.jsx(_v,{height:190,ariaLabel:"Completed and failed jobs per minute",series:[{key:"completed",label:"Completed",color:lt.completed.fg,values:f.completed,area:!0},{key:"failed",label:"Failed",color:lt.failed.fg,values:f.failed,area:!0}],formatValue:v=>ft(Math.round(v))})}),t.jsx(Ev,{icon:t.jsx(Ao,{}),title:"Success rate",hint:"completed / (completed + failed) per minute. A minute where nothing finished is a gap, not 0 %.",children:t.jsx(_v,{height:190,maxY:100,ariaLabel:"Success rate per minute",series:[{key:"success",label:"Success",color:lt.completed.fg,values:p,area:!0}],formatValue:v=>`${Math.round(v)}%`})})]})]}):t.jsx(r_,{}),t.jsx(a_,{connectionId:e,queue:n,completedCount:(r==null?void 0:r.counts.completed)??0})]})}const e_=[{key:"completed",label:"Completed",color:lt.completed.fg},{key:"failed",label:"Failed",color:lt.failed.fg}];function t_({counts:e,onOpenState:n}){return t.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4 xl:grid-cols-8",children:yo.map(r=>{const i=lt[r],o=e==null?void 0:e[r];return t.jsxs("button",{type:"button",onClick:()=>n(r),className:"card group flex flex-col items-start gap-0.5 px-3 py-2.5 text-left transition-colors hover:border-border-strong hover:bg-surface-2",title:`Show ${i.label} jobs`,children:[t.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] font-medium tracking-wider text-fg-subtle uppercase",children:[t.jsx("span",{className:F("status-dot size-1.5",i.dotClass),"aria-hidden":!0}),i.label]}),t.jsx("span",{className:F("num text-2xl leading-tight font-semibold",o==null?"text-fg-subtle":o>0?i.textClass:"text-fg-muted"),children:o==null?"—":ft(o)})]},r)})})}function n_({value:e,onChange:n,available:r}){return t.jsx("div",{className:"flex items-center gap-0.5 rounded-md bg-surface-2 p-0.5",role:"group","aria-label":"Metrics range",children:LC.map(i=>{const o=i!==0&&i>r;return t.jsx("button",{type:"button","aria-pressed":e===i,onClick:()=>n(i),title:o?`Only ${K(r)} min of data available`:void 0,className:F("h-6 rounded px-2 text-[11px] font-medium transition-colors",e===i?"bg-surface text-fg shadow-sm":"text-fg-muted hover:text-fg",o&&e!==i&&"opacity-50"),children:FC[i]},i)})})}function s_({rates:e,tp:n,minutes:r}){return t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[t.jsx(Pv,{icon:t.jsx(xo,{}),label:"Throughput",value:n.perHour==null?"—":`${ft(Math.round(n.perHour))}`,unit:"jobs / hour",hint:`Mean over the last ${K(r)} min, projected to an hour. Not a count of the past hour.`}),t.jsx(Pv,{icon:t.jsx(xo,{}),label:"Rate",value:n.perMinute==null?"—":n.perMinute.toFixed(n.perMinute<10?1:0),unit:"jobs / min",hint:`Mean completed per minute over the last ${K(r)} min.`}),t.jsxs("div",{className:"card px-3 py-2.5",children:[t.jsx("div",{className:"mb-1.5 text-[10px] font-medium tracking-wider text-fg-subtle uppercase",children:"Finished · window"}),t.jsxs("div",{className:"num flex items-baseline gap-3 text-sm",children:[t.jsxs("span",{style:{color:lt.completed.fg},children:[ft(n.completed)," ok"]}),t.jsxs("span",{style:{color:lt.failed.fg},children:[ft(n.failed)," failed"]}),t.jsx("span",{className:"ml-auto text-fg-muted",children:n.successPct==null?"—":En(n.successPct)})]})]}),t.jsxs("div",{className:"card px-3 py-2.5",children:[t.jsxs("div",{className:"mb-1.5 flex items-center gap-1 text-[10px] font-medium tracking-wider text-fg-subtle uppercase",children:["Success · trailing window",t.jsx(Pe,{content:$m(e),className:"ml-auto normal-case",children:t.jsx("span",{className:"text-[10px] text-fg-subtle",children:(e==null?void 0:e.source)==="metrics"?"metrics":"zsets"})})]}),t.jsx(Im,{rates:e})]})]})}function Pv({icon:e,label:n,value:r,unit:i,hint:o}){return t.jsxs("div",{className:"card px-3 py-2.5",children:[t.jsxs("div",{className:"mb-0.5 flex items-center gap-1.5 text-[10px] font-medium tracking-wider text-fg-subtle uppercase",children:[t.jsx("span",{className:"[&_svg]:size-3","aria-hidden":!0,children:e}),n,t.jsx(Pe,{content:o,className:"ml-auto",children:t.jsx(Ha,{className:"size-3 text-fg-subtle","aria-label":o})})]}),t.jsxs("div",{className:"flex items-baseline gap-1.5",children:[t.jsx("span",{className:"num text-2xl leading-tight font-semibold text-fg",children:r}),t.jsx("span",{className:"text-[11px] text-fg-subtle",children:i})]})]})}function Ev({icon:e,title:n,hint:r,legend:i,children:o}){return t.jsxs("section",{className:"card p-3",children:[t.jsxs("header",{className:"mb-2 flex flex-wrap items-center gap-2",children:[t.jsxs("h3",{className:"flex items-center gap-1.5 text-xs font-semibold text-fg [&_svg]:size-3.5 [&_svg]:text-fg-subtle",children:[e,n]}),i&&t.jsx(ZC,{series:i,className:"ml-auto"})]}),o,t.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-fg-subtle",children:r})]})}function r_(){return t.jsxs("div",{className:"card",children:[t.jsx(cn,{icon:t.jsx(om,{}),title:"This queue is not collecting metrics",description:t.jsxs(t.Fragment,{children:["BullMQ only records per-minute completed/failed counts when the ",t.jsx("strong",{className:"text-fg",children:"Worker"})," is created with the"," ",t.jsx("code",{className:"font-mono text-fg",children:"metrics"})," option. Nothing in Redis can be back-filled, so there is no history to show — turn it on and points start accumulating one per minute."]})}),t.jsx("div",{className:"px-6 pb-6",children:t.jsx(Qm,{className:"mx-auto max-w-2xl",language:"ts",code:"new Worker(name, fn, { metrics: { maxDataPoints: MetricsTime.ONE_WEEK } })"})})]})}function a_({connectionId:e,queue:n,completedCount:r}){var h;const i=M0(e,n,{state:"completed",page:1,pageSize:XC,order:"desc"},{enabled:r>0}),o=w.useMemo(()=>{var f;return HC((f=i.data)==null?void 0:f.jobs)},[(h=i.data)==null?void 0:h.jobs]),c=o.sampled,d=`Measured from the ${K(c)} most recent completed job${c===1?"":"s"} on this queue. A sample, not a server-wide statistic — BullMQ stores no aggregate timings in Redis.`;return t.jsxs("section",{className:"space-y-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("h2",{className:"flex items-center gap-1.5 text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:[t.jsx(Jy,{className:"size-3.5","aria-hidden":!0}),"Timings"]}),t.jsx(Pe,{content:d,children:t.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-border bg-surface-2 px-1.5 py-0.5 text-[10px] text-fg-muted",children:[t.jsx(Ha,{className:"size-3","aria-hidden":!0}),"sample of ",K(c)]})})]}),r===0?t.jsx("div",{className:"card",children:t.jsx(cn,{compact:!0,title:"No completed jobs yet",description:"Wait times and process times are derived from finished jobs."})}):t.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[t.jsx(Rv,{title:"Response time",subtitle:"time in queue · processedOn − timestamp",stats:o.wait,loading:i.isLoading,color:lt.waiting.fg,note:d}),t.jsx(Rv,{title:"Process time",subtitle:"time in workers · finishedOn − processedOn",stats:o.process,loading:i.isLoading,color:lt.active.fg,note:d})]})]})}function Rv({title:e,subtitle:n,stats:r,loading:i,color:o,note:c}){const d=[{label:"min",value:(r==null?void 0:r.min)??null},{label:"median",value:(r==null?void 0:r.median)??null},{label:"p95",value:(r==null?void 0:r.p95)??null},{label:"max",value:(r==null?void 0:r.max)??null}];return t.jsxs("div",{className:"card p-3",title:c,children:[t.jsxs("header",{className:"mb-2 flex items-baseline gap-2",children:[t.jsxs("h3",{className:"flex items-center gap-1.5 text-xs font-semibold text-fg",children:[t.jsx("span",{className:"size-2 rounded-full",style:{background:o},"aria-hidden":!0}),e]}),t.jsx("span",{className:"truncate font-mono text-[10px] text-fg-subtle",children:n})]}),t.jsx("div",{className:"grid grid-cols-4 gap-px overflow-hidden rounded-md bg-border",children:d.map(h=>t.jsxs("div",{className:"bg-surface px-2 py-2",children:[t.jsx("div",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:h.label}),t.jsx("div",{className:"num truncate text-[15px] font-semibold text-fg",children:i?t.jsx("span",{className:"skeleton inline-block h-3.5 w-12"}):h.value==null?"—":An(h.value)})]},h.label))})]})}function Mv(e,n){const r=e.trim();if(!r)return{value:{}};try{return{value:JSON.parse(r)}}catch(i){return{error:`${n}: ${i.message}`}}}function i_({open:e,onClose:n,connectionId:r,queue:i}){const o=x2(r,i),[c,d]=w.useState(""),[h,f]=w.useState(`{
539
+
540
+ }`),[g,p]=w.useState("{}"),[v,j]=w.useState({}),S=()=>{var z;const y=Mv(h,"Data"),b=Mv(g,"Options"),k={};if(y.error&&(k.data=y.error),b.error&&(k.opts=b.error),!b.error&&(typeof b.value!="object"||b.value===null||Array.isArray(b.value))&&(k.opts="Options must be a JSON object"),j(k),Object.keys(k).length)return;const C=_k.safeParse({name:c.trim()||void 0,data:y.value,opts:b.value});if(!C.success){j({name:(z=C.error.issues[0])==null?void 0:z.message});return}o.mutate(C.data,{onSuccess:O=>{X.success(`Job ${O.id} added to ${i}`),n()},onError:O=>X.error(ve(O))})};return t.jsx(bn,{open:e,onClose:n,title:`Add job to ${i}`,description:"The job is added with the official BullMQ client; opts follow JobsOptions (delay, priority, attempts, backoff, …).",size:"lg",footer:t.jsxs(t.Fragment,{children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsx(V,{variant:"primary",size:"sm",onClick:S,loading:o.isPending,children:"Add job"})]}),children:t.jsxs("div",{className:"space-y-3",children:[t.jsx(Te,{label:"Name",placeholder:"__default__",value:c,onChange:y=>d(y.target.value),error:v.name,mono:!0,autoFocus:!0}),t.jsx(Yi,{label:"Data (JSON)",mono:!0,rows:8,value:h,onChange:y=>f(y.target.value),error:v.data,spellCheck:!1}),t.jsx(Yi,{label:"Options (JSON)",mono:!0,rows:4,value:g,onChange:y=>p(y.target.value),error:v.opts,hint:'e.g. {"delay": 5000, "attempts": 3, "backoff": {"type": "exponential", "delay": 1000}}',spellCheck:!1})]})})}const l_=g0.shape.state.options,o_=[{label:"Any age",value:0},{label:"Older than 1 hour",value:36e5},{label:"Older than 1 day",value:864e5},{label:"Older than 7 days",value:7*864e5}];function c_({open:e,onClose:n,connectionId:r,queue:i,defaultState:o}){const c=T0(r,i),[d,h]=w.useState(o??"completed"),[f,g]=w.useState(0),[p,v]=w.useState("1000"),[j,S]=w.useState(null),y=()=>{var k;const b=g0.safeParse({state:d,grace:f,limit:Number(p)});if(!b.success){S(((k=b.error.issues[0])==null?void 0:k.message)??"Invalid input");return}S(null),c.mutate({action:"clean",body:b.data},{onSuccess:C=>{X.success(`Cleaned ${K(C.removed??0)} ${d} jobs from ${i}`),n()},onError:C=>X.error(ve(C))})};return t.jsx(bn,{open:e,onClose:n,title:`Clean ${i}`,description:"Removes jobs in a state, oldest first, up to the limit. Uses BullMQ's queue.clean().",size:"sm",footer:t.jsxs(t.Fragment,{children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsx(V,{variant:"danger",size:"sm",onClick:y,loading:c.isPending,children:"Clean jobs"})]}),children:t.jsxs("div",{className:"space-y-3",children:[t.jsx(dt,{label:"State",value:d,onChange:b=>h(b.target.value),options:l_.map(b=>({value:b,label:b}))}),t.jsx(dt,{label:"Grace period",value:String(f),onChange:b=>g(Number(b.target.value)),options:o_.map(b=>({value:String(b.value),label:b.label})),hint:"Only jobs older than this are removed."}),t.jsx(Te,{label:"Limit",type:"number",min:1,max:1e5,value:p,onChange:b=>v(b.target.value),error:j??void 0,hint:"Maximum number of jobs to remove in this run (1–100,000)."})]})})}const Tv="queueSetup.open";function u_({connectionId:e,queue:n,className:r}){const[i,o]=w.useState(()=>Yu(Tv,!0)),c=ym(e,n),d=c.data,h=()=>{o(f=>(So(Tv,!f),!f))};return t.jsxs("section",{className:F("card overflow-hidden",r),"aria-label":"Queue setup",children:[t.jsxs("button",{type:"button",onClick:h,"aria-expanded":i,className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-surface-2/60",children:[i?t.jsx(ps,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}):t.jsx(Dn,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}),t.jsx("span",{className:"text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"Setup"}),!i&&d&&t.jsx(d_,{data:d}),(d==null?void 0:d.rateLimitedNow)&&t.jsx(cj,{ttlMs:d.rateLimitedNow.ttlMs,since:c.dataUpdatedAt}),t.jsx("span",{className:"ml-auto text-[11px] text-fg-subtle",children:"from the server · refreshes every 10 s"})]}),i&&t.jsxs("div",{className:"border-t border-border px-3 py-2.5",children:[c.isLoading&&!d&&t.jsx("div",{className:"grid gap-x-6 gap-y-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",children:Array.from({length:10},(f,g)=>t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx(Cu,{className:"h-2.5 w-20"}),t.jsx(Cu,{className:"h-3 w-28"})]},g))}),c.isError&&!d&&t.jsx("p",{className:"text-xs text-fg-muted",children:Ts(c.error)&&c.error.status===404?"Setup details are not available on this server version.":`Setup unavailable: ${ve(c.error)}`}),d&&t.jsx(h_,{data:d,since:c.dataUpdatedAt})]})]})}function d_({data:e}){const n=uj(e.library);return t.jsxs("span",{className:"flex min-w-0 items-center gap-2 truncate text-xs text-fg-muted",children:[t.jsx("span",{className:"font-mono",children:n?`${n.name} ${n.version}`:"library unknown"}),t.jsx("span",{className:"text-fg-subtle",children:"·"}),t.jsx("span",{children:e.workers?`${K(e.workers.count)} ${e.workers.count===1?"worker":"workers"}`:"workers unknown"}),t.jsx("span",{className:"text-fg-subtle",children:"·"}),t.jsxs("span",{children:["concurrency ",e.globalConcurrency??"not set"]})]})}function h_({data:e,since:n}){const r=uj(e.library),i=e.groups;return t.jsxs(t.Fragment,{children:[t.jsxs("dl",{className:"grid gap-x-6 gap-y-2.5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",children:[t.jsx(Ws,{icon:t.jsx(qN,{}),label:"Library",children:r?t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsxs("span",{className:"font-mono",children:[r.name," ",r.version]}),e.isPro&&t.jsx(be,{variant:"pro",size:"xs",className:"tracking-wider",children:"PRO"})]}):t.jsx(Mr,{children:"unknown"})}),t.jsx(Ws,{icon:t.jsx(Ju,{}),label:"Workers connected",children:e.workers?t.jsx(Pe,{content:e.workers.names.length?f_(e.workers.names):"no worker names reported",side:"bottom",children:t.jsx("span",{className:"num cursor-help underline decoration-dotted underline-offset-2",children:K(e.workers.count)})}):t.jsx(Mr,{title:"CLIENT LIST is unavailable on this Redis (ACL or managed service)",children:"unknown"})}),t.jsx(Ws,{icon:t.jsx(xo,{}),label:"Global concurrency",children:e.globalConcurrency!=null?t.jsx("span",{className:"num",children:K(e.globalConcurrency)}):t.jsx(Mr,{children:"not set"})}),t.jsx(Ws,{icon:t.jsx(Jy,{}),label:"Global rate limit",children:e.globalRateLimit?t.jsxs("span",{className:"num",children:[K(e.globalRateLimit.max)," / ",dj(e.globalRateLimit.durationMs)]}):t.jsx(Mr,{children:"not set"})}),t.jsx(Ws,{icon:t.jsx(_N,{}),label:"Rate limited now",children:e.rateLimitedNow?t.jsx(cj,{ttlMs:e.rateLimitedNow.ttlMs,since:n}):t.jsx("span",{className:"text-fg-muted",children:"no"})}),t.jsx(Ws,{icon:t.jsx(Do,{}),label:"Groups",className:"xl:col-span-2",children:i?t.jsxs("span",{className:"flex flex-wrap items-center gap-x-3 gap-y-0.5",children:[t.jsxs("span",{className:"num",children:[K(i.count)," ",i.count===1?"group":"groups"]}),t.jsxs("span",{className:"num text-fg-muted",children:[K(i.byStatus.waiting)," waiting · ",K(i.byStatus.limited)," limited · ",K(i.byStatus.maxed)," maxed · ",K(i.byStatus.paused)," paused"]}),t.jsx(Pe,{content:"Groups with their own concurrency or rate limit (queue.setGroupConcurrency / setGroupRateLimit). The others use the worker's group option.",side:"bottom",children:t.jsxs("span",{className:"num cursor-help text-fg-muted underline decoration-dotted underline-offset-2",children:[K(i.configured)," with per-group overrides"]})}),t.jsxs("span",{className:"num text-fg-muted",children:[K(i.active)," with active jobs"]})]}):t.jsx(Mr,{title:"No BullMQ Pro group keys found for this queue",children:"none observed"})}),t.jsx(Ws,{icon:t.jsx(mN,{}),label:"Batch",children:t.jsx(Pe,{content:"Batching is a Worker option (worker.opts.batch); BullMQ does not persist it in Redis or Postgres, so it cannot be read from here.",side:"bottom",children:t.jsx(Mr,{className:"cursor-help underline decoration-dotted underline-offset-2",children:"not stored by BullMQ"})})}),t.jsx(Ws,{icon:t.jsx(Ao,{}),label:"Metrics",children:e.metricsEnabled?t.jsx("span",{className:"text-state-completed",children:"enabled"}):t.jsx(Mr,{children:"disabled"})}),t.jsx(Ws,{icon:t.jsx(CN,{}),label:"Max events",children:e.maxLenEvents!=null?t.jsx("span",{className:"num",children:K(e.maxLenEvents)}):t.jsx(Mr,{children:"not set"})})]}),t.jsxs("details",{className:"mt-2.5 border-t border-border pt-2 text-xs",children:[t.jsxs("summary",{className:"inline-flex cursor-pointer items-center gap-1.5 text-fg-muted select-none hover:text-fg",children:[t.jsx(Ly,{className:"size-3.5","aria-hidden":!0})," Raw meta",t.jsxs("span",{className:"num text-fg-subtle",children:["(",Object.keys(e.rawMeta??{}).length," fields)"]})]}),Object.keys(e.rawMeta??{}).length===0?t.jsx("p",{className:"mt-1.5 text-fg-subtle",children:"The meta hash has no extra fields."}):t.jsx("table",{className:"mt-1.5 w-auto text-[11px]",children:t.jsx("tbody",{children:Object.entries(e.rawMeta).sort(([o],[c])=>o.localeCompare(c)).map(([o,c])=>t.jsxs("tr",{className:"border-t border-border/60",children:[t.jsx("th",{scope:"row",className:"py-0.5 pr-4 text-left font-mono font-normal text-fg-muted",children:o}),t.jsx("td",{className:"py-0.5 font-mono break-all text-fg",children:c===""?t.jsx("span",{className:"text-fg-subtle",children:"(empty)"}):c})]},o))})})]})]})}function Ws({icon:e,label:n,children:r,className:i}){return t.jsxs("div",{className:F("flex min-w-0 items-start gap-2",i),children:[t.jsx("span",{className:"mt-0.5 shrink-0 text-fg-subtle [&_svg]:size-3.5","aria-hidden":!0,children:e}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:n}),t.jsx("dd",{className:"text-[13px] text-fg",children:r})]})]})}function Mr({children:e,title:n,className:r}){return t.jsx("span",{className:F("text-fg-subtle",r),title:n,children:e})}function cj({ttlMs:e,since:n}){const r=ol(1e3),i=Math.max(0,e-Math.max(0,r-n));return t.jsxs(be,{variant:"custom",size:"xs",dot:!0,className:"border tracking-wide",style:{color:"var(--state-waiting)",background:"color-mix(in srgb, var(--state-waiting) 14%, transparent)",borderColor:"color-mix(in srgb, var(--state-waiting) 38%, transparent)"},children:["throttled · lifts in ",dj(i)]})}function uj(e){if(!e)return null;const n=e.indexOf(":");return n<0?{name:e,version:""}:{name:e.slice(0,n),version:e.slice(n+1)}}function dj(e){return!Number.isFinite(e)||e<0?"–":e>=36e5&&e%36e5===0?`${e/36e5}h`:e>=6e4&&e%6e4===0?`${e/6e4}m`:e>=1e3?`${Math.round(e/100)/10}s`.replace(/\.0s$/,"s"):`${Math.round(e)}ms`}function f_(e){const n=e.slice(0,12);return n.join(", ")+(e.length>n.length?` +${e.length-n.length} more`:"")}function m_({connectionId:e,queue:n}){var b,k;const{isOperator:r}=mt(),[i,o]=w.useState(1),[c,d]=w.useState(25),[h,f]=w.useState(null),g=y2(e,n,{page:i,pageSize:c}),p=b2(e,n),v=((b=g.data)==null?void 0:b.schedulers)??[],j=((k=g.data)==null?void 0:k.total)??0,S=r?6:5,y=C=>p.mutate(C.key,{onSuccess:()=>{X.success(`Scheduler ${C.key} removed`),f(null)},onError:z=>X.error(ve(z))});return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"card overflow-hidden",children:[t.jsxs(ms,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{children:"Key"}),t.jsx(pe,{children:"Job name"}),t.jsx(pe,{children:"Repeats"}),t.jsx(pe,{children:"Timezone"}),t.jsx(pe,{align:"right",children:"Next run"}),r&&t.jsx(pe,{align:"right",children:"Actions"})]})}),t.jsxs("tbody",{children:[g.isLoading&&t.jsx(yt,{colSpan:S,children:t.jsx(Kt,{label:"Loading schedulers…"})}),g.isError&&!g.data&&t.jsx(yt,{colSpan:S,className:"text-danger",children:ve(g.error)}),g.data&&v.length===0&&t.jsx(yt,{colSpan:S,children:t.jsx(g_,{queue:n})}),v.map(C=>t.jsxs(cl,{children:[t.jsxs(xe,{mono:!0,children:[t.jsx("span",{className:"text-fg",title:C.key,children:C.key}),C.template&&t.jsx("span",{className:"ml-1.5 text-[11px] text-fg-subtle",title:x_(C),children:"template"})]}),t.jsx(xe,{mono:!0,muted:!0,children:C.name}),t.jsx(xe,{children:t.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[t.jsx(be,{variant:"outline",size:"xs",className:"font-mono",children:hj(C)}),C.limit!=null&&t.jsxs("span",{className:"text-[11px] text-fg-subtle",title:"Maximum number of jobs this scheduler will ever produce",children:[K(C.iterationCount??0),"/",K(C.limit)," runs"]}),C.limit==null&&C.iterationCount!=null&&t.jsxs("span",{className:"text-[11px] text-fg-subtle",title:"Jobs produced so far",children:[K(C.iterationCount)," runs"]}),C.endDate!=null&&t.jsxs("span",{className:"text-[11px] text-fg-subtle",title:`Stops after ${gn(C.endDate)}`,children:["until ",Kr(C.endDate)]})]})}),t.jsx(xe,{muted:!0,children:C.tz??t.jsx("span",{className:"text-fg-subtle",children:"–"})}),t.jsx(xe,{align:"right",num:!0,children:C.next==null?t.jsx("span",{className:"text-fg-subtle",children:"–"}):t.jsx("span",{className:F(C.next<=Date.now()&&"text-warning"),title:gn(C.next),children:Kr(C.next)})}),r&&t.jsx(xe,{align:"right",children:t.jsx(V,{size:"sm",variant:"ghost",className:"text-fg-subtle hover:text-danger",leftIcon:t.jsx(Un,{}),"aria-label":`Remove scheduler ${C.key}`,title:"Remove this scheduler",loading:p.isPending&&p.variables===C.key,onClick:()=>f(C),children:"Remove"})})]},C.key))]})]}),j>0&&t.jsx("div",{className:F("border-t border-border px-3 py-2",g.isFetching&&"opacity-80"),children:t.jsx(ld,{page:i,pageSize:c,total:j,count:v.length,onPage:o,onPageSize:C=>(d(C),o(1))})})]}),t.jsx(Ht,{open:!!h,onClose:()=>f(null),title:"Remove job scheduler",description:h?`Stops "${h.key}" from producing new jobs and removes the job it already had scheduled. Jobs it produced in the past are not touched. Recreate it with queue.upsertJobScheduler().`:"",confirmText:"Remove",danger:!0,loading:p.isPending,onConfirm:()=>h&&y(h)})]})}function hj(e){return e.every!=null?`every ${p_(e.every)}`:e.pattern?e.pattern:"unknown"}function p_(e){if(e<1e3)return`${e}ms`;const n=[[864e5,"d"],[36e5,"h"],[6e4,"m"],[1e3,"s"]];for(const[r,i]of n)if(e>=r){const o=e/r;return`${Number.isInteger(o)?o:o.toFixed(1)}${i}`}return`${e}ms`}function x_(e){var r,i,o;const n=[`name: ${((r=e.template)==null?void 0:r.name)??e.name}`];return(i=e.template)!=null&&i.data&&n.push(`data: ${e.template.data}`),(o=e.template)!=null&&o.opts&&n.push(`opts: ${e.template.opts}`),n.join(`
541
+ `)}function g_({queue:e}){return t.jsxs("div",{className:"mx-auto flex max-w-xl flex-col items-center gap-2 py-6 text-center",children:[t.jsx(Lo,{className:"size-6 text-fg-subtle","aria-hidden":!0}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"No job schedulers on this queue"}),t.jsx("p",{className:"text-xs text-fg-muted",children:"A job scheduler (BullMQ calls it a repeatable job) stamps out the same job on a cron pattern or a fixed interval. It lives outside the job states, so it never shows up under Waiting or Delayed — only the single job it has queued next does."}),t.jsx("pre",{className:"mt-1 w-full overflow-x-auto rounded-md border border-border bg-surface-2 p-2.5 text-left font-mono text-[11px] leading-relaxed text-fg-muted",children:`const queue = new Queue("${e}");
542
+
543
+ await queue.upsertJobScheduler(
544
+ "nightly-report", // scheduler id
545
+ { pattern: "0 3 * * *", tz: "America/Sao_Paulo" },
546
+ { name: "report", data: { kind: "daily" } },
547
+ );
548
+
549
+ // or a fixed interval
550
+ await queue.upsertJobScheduler("heartbeat", { every: 30_000 });`}),t.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] text-fg-subtle",children:[t.jsx(Wy,{className:"size-3","aria-hidden":!0}),"upsertJobScheduler is idempotent: calling it again updates the schedule instead of adding a second one."]})]})}function Wa({feature:e}){const n=bo[e],{pricing:r,checkoutUrl:i}=wt();return t.jsxs("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-8 px-6 py-10 lg:flex-row lg:items-center lg:gap-12",children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"mb-3 inline-flex items-center gap-1.5 rounded-full border border-pro/40 bg-pro/10 px-2.5 py-1 text-[11px] font-medium tracking-wider text-pro uppercase",children:[t.jsx(go,{className:"size-3","aria-hidden":!0}),"Pro feature"]}),t.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-fg",children:n.title}),t.jsx("p",{className:"mt-2 max-w-md text-sm leading-relaxed text-fg-muted",children:n.tagline}),t.jsx("ul",{className:"mt-5 space-y-2.5",children:n.bullets.map(o=>t.jsxs("li",{className:"flex items-start gap-2.5 text-[13px] text-fg",children:[t.jsx(Zr,{className:"mt-0.5 size-4 shrink-0 text-success","aria-hidden":!0}),t.jsx("span",{children:o})]},o))}),t.jsxs("div",{className:"mt-7 flex flex-wrap items-center gap-3",children:[t.jsxs("a",{href:i||"#",target:"_blank",rel:"noreferrer noopener","aria-disabled":!i,className:"inline-flex h-9 items-center gap-2 rounded-md bg-accent px-4 text-[13px] font-medium text-accent-fg hover:bg-accent-hover aria-disabled:pointer-events-none aria-disabled:opacity-50",children:["Unlock Pro · $",r.monthlyUsd,"/mo or $",r.yearlyUsd,"/yr",t.jsx(Br,{className:"size-4","aria-hidden":!0})]}),t.jsxs(Ee,{to:"/settings/license",className:"inline-flex h-9 items-center gap-2 rounded-md border border-border-strong px-3 text-[13px] font-medium text-fg hover:bg-surface-2",children:[t.jsx(al,{className:"size-4","aria-hidden":!0}),"I have a key"]})]}),t.jsxs("p",{className:"mt-3 text-xs text-fg-subtle",children:["One key unlocks login with Users & roles, Alerts, Folders, Flows, the Audit log, SSO and MCP for one installation. $",r.monthlyUsd,"/month or $",r.yearlyUsd,"/year, unlimited users, cancel any time."]})]}),t.jsx("div",{className:"flex-1",children:t.jsx(v_,{feature:e})})]})}function v_({feature:e}){return t.jsxs("div",{"aria-hidden":!0,className:"relative overflow-hidden rounded-xl border border-border bg-surface p-3 shadow-[var(--shadow)]",children:[t.jsxs("div",{className:"mb-3 flex items-center gap-1.5",children:[t.jsx("span",{className:"size-2 rounded-full bg-fg-subtle/40"}),t.jsx("span",{className:"size-2 rounded-full bg-fg-subtle/40"}),t.jsx("span",{className:"size-2 rounded-full bg-fg-subtle/40"}),t.jsx("span",{className:"ml-3 h-2 w-24 rounded bg-surface-3"})]}),e==="alerts"&&t.jsx(y_,{}),e==="users"&&t.jsx(j_,{}),e==="folders"&&t.jsx(b_,{}),e==="flows"&&t.jsx(w_,{}),t.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-surface to-transparent"})]})}function vu({className:e,children:n}){return t.jsx("div",{className:F("flex items-center gap-2 rounded-md border border-border bg-bg/60 px-2.5 py-2",e),children:n})}function On({w:e,className:n}){return t.jsx("span",{className:F("h-2 rounded bg-surface-3",n),style:{width:e}})}function y_(){return t.jsxs("div",{className:"space-y-2",children:[t.jsxs(vu,{children:[t.jsx("span",{className:"status-dot pulse bg-danger"}),t.jsx(On,{w:"38%",className:"bg-fg-muted/50"}),t.jsx("span",{className:"ml-auto rounded bg-danger/15 px-1.5 py-0.5 text-[9px] font-medium text-danger",children:"FIRING"})]}),t.jsxs(vu,{children:[t.jsx("span",{className:"status-dot bg-success"}),t.jsx(On,{w:"52%"}),t.jsx("span",{className:"ml-auto rounded bg-success/15 px-1.5 py-0.5 text-[9px] font-medium text-success",children:"OK"})]}),t.jsxs(vu,{children:[t.jsx("span",{className:"status-dot bg-success"}),t.jsx(On,{w:"30%"}),t.jsx("span",{className:"ml-auto rounded bg-success/15 px-1.5 py-0.5 text-[9px] font-medium text-success",children:"OK"})]}),t.jsxs("div",{className:"mt-3 rounded-md border border-border bg-surface-2 p-2.5",children:[t.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[t.jsx("span",{className:"size-4 rounded bg-[#4A154B]"}),t.jsx(On,{w:"30%",className:"bg-fg-muted/50"}),t.jsx(On,{w:"12%",className:"ml-auto"})]}),t.jsx(On,{w:"80%",className:"mb-1.5"}),t.jsx(On,{w:"60%"})]})]})}function j_(){const e=[["admin","bg-pro/15 text-pro"],["operator","bg-info/15 text-info"],["operator","bg-info/15 text-info"],["viewer","bg-surface-3 text-fg-muted"]];return t.jsx("div",{className:"space-y-2",children:e.map(([n,r],i)=>t.jsxs(vu,{children:[t.jsx("span",{className:"size-5 rounded-full bg-surface-3"}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx(On,{w:`${70+i*12}px`,className:"bg-fg-muted/50"}),t.jsx(On,{w:`${100+i*8}px`,className:"h-1.5"})]}),t.jsx("span",{className:F("ml-auto rounded px-1.5 py-0.5 text-[9px] font-medium",r),children:n})]},i))})}function b_(){return t.jsxs("div",{className:"space-y-1.5 text-[11px]",children:[[["Payments","bg-success",0,3],["Checkout","bg-success",1,2],["Refunds","bg-success",1,1],["Notifications","bg-info",0,4],["Data pipeline","bg-violet",0,2]].map(([e,n,r,i],o)=>t.jsxs("div",{className:"flex items-center gap-2 rounded px-2 py-1",style:{paddingLeft:8+r*16},children:[t.jsx("span",{className:F("size-3 rounded-sm",n)}),t.jsx("span",{className:"text-fg-muted",children:e}),t.jsx("span",{className:"ml-auto rounded bg-surface-3 px-1 text-[9px] text-fg-subtle",children:i})]},o)),t.jsxs("div",{className:"ml-6 space-y-1 border-l border-border pl-3",children:[t.jsx(On,{w:"60%"}),t.jsx(On,{w:"45%"}),t.jsx(On,{w:"70%"})]})]})}function w_(){const e=(n,r,i,o="bg-surface-2")=>t.jsxs("div",{className:F("absolute flex h-9 w-28 flex-col justify-center rounded-md border border-border px-2",o),style:{left:n,top:r},children:[t.jsx("span",{className:"text-[10px] font-medium text-fg",children:i}),t.jsx(On,{w:"50%",className:"mt-1 h-1.5"})]});return t.jsxs("div",{className:"relative h-52",children:[t.jsxs("svg",{className:"absolute inset-0 h-full w-full",fill:"none",stroke:"var(--fg-subtle)",strokeWidth:1.5,children:[t.jsx("path",{d:"M120 38 C 160 38, 160 98, 200 98"}),t.jsx("path",{d:"M120 158 C 160 158, 160 98, 200 98",strokeDasharray:"4 3",stroke:"var(--accent)"}),t.jsx("path",{d:"M312 98 C 350 98, 350 60, 380 60"}),t.jsx("path",{d:"M312 98 C 350 98, 350 136, 380 136"})]}),e(8,20,"ingest"),e(8,140,"backfill"),e(200,80,"process","bg-accent/10"),e(380,42,"notify"),e(380,118,"archive"),t.jsx("span",{className:"absolute top-[60px] left-[150px] rounded bg-surface px-1 text-[9px] text-fg-subtle",children:"×214"})]})}function N_(){const{has:e}=wt();return e("alerts")?t.jsx(S_,{}):t.jsx(Wa,{feature:"alerts"})}function fj(e){switch(e.kind){case"waiting_above":return`wait+prioritized > ${K(e.threshold)}`;case"failed_above":return`failed > ${K(e.threshold)} in ${e.windowMinutes}m`;case"failed_rate_above":return`failure rate > ${e.percent}% in ${e.windowMinutes}m (min ${e.minSample})`;case"duration_above":return`p${e.percentile} processing > ${e.seconds}s in ${e.windowMinutes}m (min ${e.minSample})`}}const k_={fired:"danger",resolved:"success",delivery_failed:"warning",no_metrics:"info"};function S_(){var z,O;const{isOperator:e}=mt(),n=bm(),r=xs(),i=Jr(),o=L0(),c=$2(),d=I2(),[h,f]=w.useState(null),[g,p]=w.useState(null),[v,j]=w.useState(""),S=T2({limit:100,alertId:v||void 0}),y=T=>{var M,E;return T?((E=(M=r.data)==null?void 0:M.find(I=>I.id===T))==null?void 0:E.name)??T:"–"},b=T=>{var M,E;return((E=(M=i.data)==null?void 0:M.find(I=>I.id===T))==null?void 0:E.name)??T},k=[...n.data??[]].sort((T,M)=>Number(M.firing)-Number(T.firing)||T.name.localeCompare(M.name)),C=k.filter(T=>T.firing).length;return t.jsxs(bt,{children:[t.jsx(gs,{title:t.jsxs("span",{className:"flex items-center gap-2",children:["Alerts",C>0&&t.jsxs(be,{variant:"danger",dot:!0,children:[C," firing"]})]}),description:"Server-side rules: backlog from live counts, failures from BullMQ metrics counters. Delivered to Slack or any webhook.",actions:e&&t.jsx(V,{variant:"primary",size:"sm",leftIcon:t.jsx(es,{}),onClick:()=>f({alert:null}),children:"New alert"})}),t.jsx("div",{className:"card overflow-hidden",children:t.jsxs(ms,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{className:"w-16",children:"State"}),t.jsx(pe,{children:"Name"}),t.jsx(pe,{children:"Scope"}),t.jsx(pe,{children:"Condition"}),t.jsx(pe,{children:"Channels"}),t.jsx(pe,{children:"Last fired"}),t.jsx(pe,{align:"right",children:t.jsx("span",{className:"sr-only",children:"Actions"})})]})}),t.jsxs("tbody",{children:[n.isLoading&&t.jsx(yt,{colSpan:7,children:t.jsx(Kt,{label:"Loading alerts…"})}),n.isError&&t.jsx(yt,{colSpan:7,className:"text-danger",children:ve(n.error)}),n.data&&k.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:7,children:t.jsx(cn,{compact:!0,icon:t.jsx(rl,{}),title:"No alerts yet",description:"Start with 'failures above threshold' on your most important queue and a Slack webhook.",action:e&&t.jsx(V,{size:"sm",variant:"primary",leftIcon:t.jsx(es,{}),onClick:()=>f({alert:null}),children:"New alert"})})})}),k.map(T=>{var M;return t.jsxs(cl,{className:F(!T.enabled&&"opacity-60"),children:[t.jsx(xe,{children:T.firing?t.jsxs(be,{variant:"danger",dot:!0,children:[t.jsx(lm,{className:"size-3"})," firing"]}):T.enabled?t.jsx(qC,{measurement:T.measurement}):t.jsx(be,{variant:"neutral",children:"off"})}),t.jsx(xe,{className:"font-medium",children:T.name}),t.jsx(xe,{muted:!0,children:T.scope.type==="queue"?t.jsxs(t.Fragment,{children:[y(T.scope.connectionId),t.jsx("span",{className:"text-fg-subtle",children:" / "}),t.jsx("span",{className:"font-mono text-xs",children:T.scope.queueName})]}):T.scope.type==="folder"?t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx(be,{variant:"outline",size:"xs",children:"folder"}),b(T.scope.folderId)]}):T.scope.type==="connection"?t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx(be,{variant:"outline",size:"xs",children:"connection"}),y(T.scope.connectionId)]}):t.jsx(be,{variant:"outline",size:"xs",children:"every queue"})}),t.jsx(xe,{mono:!0,children:fj(T.condition)}),t.jsx(xe,{muted:!0,children:T.channels.length===0?t.jsx("span",{className:"text-[11px] text-fg-subtle",children:"dashboard only"}):t.jsxs(t.Fragment,{children:[T.channels.map((E,I)=>t.jsx(be,{variant:"outline",size:"xs",className:"mr-1",children:E.type},I)),t.jsxs("span",{className:"text-[11px] text-fg-subtle",children:["· cooldown ",T.cooldownMinutes,"m"]})]})}),t.jsx(xe,{muted:!0,children:t.jsx(Yt,{value:T.lastFiredAt,emptyText:"never"})}),t.jsx(xe,{align:"right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e&&t.jsx(el,{size:"sm",checked:T.enabled,label:T.enabled?"Disable alert":"Enable alert",disabled:o.isPending&&((M=o.variables)==null?void 0:M.id)===T.id,onChange:E=>o.mutate({id:T.id,input:{enabled:E}},{onError:I=>X.error(ve(I))})}),e&&t.jsx(V,{size:"icon-xs",variant:"ghost",title:"Send test notification","aria-label":"Send test notification",loading:d.isPending&&d.variables===T.id,onClick:()=>d.mutate(T.id,{onSuccess:E=>{var Q,H;const I=((Q=E.results)==null?void 0:Q.filter(q=>!q.ok))??[];E.ok&&I.length===0?X.success("Test notification sent",`${((H=E.results)==null?void 0:H.length)??0} channel(s) delivered`):X.error("Some channels failed",I.map(q=>`${q.channel}: ${q.error??"error"}`).join("; "))},onError:E=>X.error(ve(E))}),children:t.jsx($N,{})}),e&&t.jsx(V,{size:"icon-xs",variant:"ghost",title:"Edit","aria-label":"Edit alert",onClick:()=>f({alert:T}),children:t.jsx(Uo,{})}),e&&t.jsx(V,{size:"icon-xs",variant:"ghost",title:"Delete","aria-label":"Delete alert",className:"hover:text-danger",onClick:()=>p(T),children:t.jsx(Un,{})})]})})]},T.id)})]})]})}),t.jsxs("section",{className:"mt-6",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[t.jsx("h2",{className:"text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"Events"}),t.jsx(dt,{"aria-label":"Filter events by alert",className:"!h-7 !w-auto text-xs",value:v,onChange:T=>j(T.target.value),options:[{value:"",label:"All alerts"},...k.map(T=>({value:T.id,label:T.name}))]})]}),t.jsx("div",{className:"card overflow-hidden",children:t.jsxs(ms,{dense:!0,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{className:"w-28",children:"When"}),t.jsx(pe,{className:"w-28",children:"Status"}),t.jsx(pe,{children:"Alert"}),t.jsx(pe,{children:"Queue"}),t.jsx(pe,{children:"Message"}),t.jsx(pe,{align:"right",children:"Value"})]})}),t.jsxs("tbody",{children:[S.isLoading&&t.jsx(yt,{colSpan:6,children:t.jsx(Kt,{})}),S.data&&S.data.length===0&&t.jsx(yt,{colSpan:6,children:"No events yet"}),(z=S.data)==null?void 0:z.map(T=>t.jsxs("tr",{children:[t.jsx(xe,{muted:!0,children:t.jsx(Yt,{value:T.createdAt})}),t.jsx(xe,{children:t.jsx(be,{variant:k_[T.status],size:"xs",dot:!0,children:T.status.replace("_"," ")})}),t.jsx(xe,{className:"font-medium",children:T.alertName}),t.jsxs(xe,{muted:!0,children:[y(T.connectionId),T.queueName&&t.jsxs("span",{className:"text-fg-subtle",children:[" / ",T.queueName]})]}),t.jsx(xe,{className:"max-w-lg truncate",title:T.message,children:T.message}),t.jsx(xe,{num:!0,align:"right",muted:!0,children:T.value!=null?K(T.value):"–"})]},T.id))]})]})})]}),h&&t.jsx(od,{open:!0,onClose:()=>f(null),alert:h.alert},((O=h.alert)==null?void 0:O.id)??"new"),t.jsx(Ht,{open:!!g,onClose:()=>p(null),title:`Delete "${g==null?void 0:g.name}"`,description:"The alert and its history of events are removed.",confirmText:"Delete",danger:!0,loading:c.isPending,onConfirm:()=>g&&c.mutate(g.id,{onSuccess:()=>(p(null),X.success("Alert deleted")),onError:T=>X.error(ve(T))})})]})}function C_(e,n){const{has:r}=wt(),i=r("alerts"),o=bm(i),c=Jr(i&&r("folders")),d=w.useMemo(()=>{const h=o.data??[];if(h.length===0)return[];const f=c.data??[],g=new Map;for(const y of f)y.queues.some(b=>b.connectionId===e&&b.queueName===n)&&g.set(y.id,y.name);const p=[];for(const y of h)if(y.scope.type==="queue")y.scope.connectionId===e&&y.scope.queueName===n&&p.push({alert:y,via:{kind:"queue"}});else if(y.scope.type==="folder"){const b=g.get(y.scope.folderId);b!==void 0&&p.push({alert:y,via:{kind:"folder",folderId:y.scope.folderId,folderName:b}})}else y.scope.type==="connection"?y.scope.connectionId===e&&p.push({alert:y,via:{kind:"connection"}}):p.push({alert:y,via:{kind:"global"}});const v=y=>({global:0,connection:1,folder:2,queue:3})[y.via.kind],j=new Map;for(const y of p)y.alert.enabled&&j.set(y.alert.condition.kind,Math.max(j.get(y.alert.condition.kind)??-1,v(y)));const S=p.filter(y=>!y.alert.enabled||v(y)===j.get(y.alert.condition.kind));return p.length=0,p.push(...S),p.sort((y,b)=>Number(b.alert.firing)-Number(y.alert.firing)||Number(b.alert.enabled)-Number(y.alert.enabled)||y.alert.name.localeCompare(b.alert.name))},[o.data,c.data,e,n]);return{matches:d,firing:d.filter(h=>h.alert.firing).length,enabled:i}}function __({matches:e,firing:n}){if(e.length===0)return null;const r=`${e.length} alert${e.length===1?"":"s"}`;return t.jsx(Pe,{content:n>0?`${n} of ${e.length} firing right now`:"Watching this queue",children:t.jsxs(Ee,{to:ue.alerts,className:F("inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[11px] font-medium transition-colors",n>0?"border-danger/40 bg-danger/10 text-danger hover:bg-danger/20":"border-border text-fg-muted hover:bg-surface-hover hover:text-fg"),children:[n>0?t.jsx(lm,{className:"size-3"}):t.jsx(rl,{className:"size-3"}),n>0?`${n} firing`:r]})})}function P_({connectionId:e,queueName:n,matches:r,onCreate:i}){const{isOperator:o}=mt(),[c,d]=w.useState(null);return r.length===0?null:t.jsxs("section",{className:"rounded-md border border-border bg-surface","aria-label":"Alerts watching this queue",children:[t.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[t.jsx(rl,{className:"size-3.5 text-fg-muted"}),t.jsx("h2",{className:"text-[11px] font-semibold uppercase tracking-wider text-fg-muted",children:"Alerts on this queue"}),t.jsx("span",{className:"text-[11px] text-fg-subtle",children:r.length}),t.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[t.jsx(Ee,{to:ue.alerts,className:"text-[11px] text-accent hover:underline",children:"Manage all"}),o&&t.jsx(V,{size:"xs",variant:"ghost",leftIcon:t.jsx(es,{}),onClick:i,children:"Add"})]})]}),t.jsx("ul",{className:"divide-y divide-border",children:r.map(({alert:h,via:f})=>t.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 text-[12px]",children:[t.jsx("span",{className:"shrink-0",children:h.firing?t.jsxs(be,{variant:"danger",className:"gap-1",children:[t.jsx(lm,{className:"size-3"})," firing"]}):h.enabled?t.jsx(be,{variant:"success",children:"ok"}):t.jsx(be,{variant:"neutral",children:"off"})}),t.jsx("span",{className:F("font-medium",!h.enabled&&"text-fg-muted"),children:h.name}),t.jsx("span",{className:"font-mono text-[11px] text-fg-muted",children:fj(h.condition)}),(f.kind==="connection"||f.kind==="global")&&t.jsx("span",{className:"rounded border border-border px-1 text-[10px] text-fg-muted",children:f.kind==="global"?"every queue":"whole connection"}),f.kind==="folder"&&t.jsx(Pe,{content:"This alert watches every queue in the folder",children:t.jsxs(Ee,{to:ue.folder(f.folderId),className:"rounded border border-border px-1 text-[10px] text-fg-muted hover:text-fg",children:["via folder ",f.folderName]})}),t.jsxs("span",{className:"ml-auto flex items-center gap-3 text-[11px] text-fg-subtle",children:[t.jsx("span",{children:h.lastFiredAt?t.jsxs(t.Fragment,{children:["last fired ",t.jsx(Yt,{value:h.lastFiredAt})]}):"never fired"}),o&&t.jsx("button",{type:"button",className:"text-fg-muted hover:text-fg",onClick:()=>d(h),title:"Edit alert","aria-label":`Edit ${h.name}`,children:t.jsx(Uo,{className:"size-3.5"})})]})]},h.id))}),c&&t.jsx(od,{open:!0,onClose:()=>d(null),alert:c}),t.jsx("span",{className:"sr-only",children:`Alerts watching ${n} on connection ${e}`})]})}function Bm({open:e,onClose:n,connectionId:r,queue:i,match:o}){const c=v2(r,i),[d,h]=w.useState(null),[f,g]=w.useState(!1),p=w.useRef(!1),v=[o.groupId?`of group ${o.groupId}`:null,o.query?`containing "${o.query}"`:null].filter(Boolean).join(" and "),j=async()=>{p.current=!1,g(!0);let y={promoted:0,failedCount:0,failed:[],scanned:0,total:0,done:!1};h(y);let b;try{do{const k=await c.mutateAsync({...o,cursor:b});y={promoted:y.promoted+k.promoted,failedCount:y.failedCount+k.failedCount,failed:[...y.failed,...k.failed].slice(0,20),scanned:y.scanned+k.scanned,total:k.total,done:k.nextCursor===null},h(y),b=k.nextCursor??void 0}while(b!==void 0&&!p.current);y.failedCount===0?X.success(`${K(y.promoted)} delayed jobs promoted`):X.error(`${K(y.promoted)} promoted · ${K(y.failedCount)} failed`)}catch(k){X.error(ve(k))}finally{g(!1)}},S=()=>{p.current=!0,f||h(null),n()};return t.jsx(bn,{open:e,onClose:S,size:"sm",title:"Promote every matching delayed job",description:`Every delayed job ${v} in ${i}, not only the ones on screen, runs now. On a BullMQ Pro queue grouped jobs go back into their group and keep its rate limit.`,footer:f?t.jsx(V,{variant:"ghost",size:"sm",onClick:()=>p.current=!0,children:"Stop after this batch"}):d!=null&&d.done||d&&p.current?t.jsx(V,{size:"sm",onClick:S,children:"Close"}):t.jsxs(t.Fragment,{children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:S,children:"Cancel"}),t.jsx(V,{size:"sm",onClick:j,children:"Promote all"})]}),children:d&&t.jsxs("div",{className:"space-y-2 text-xs",role:"status",children:[t.jsxs("p",{children:[t.jsx("span",{className:"num font-semibold text-fg",children:K(d.promoted)})," promoted",d.failedCount>0&&t.jsxs(t.Fragment,{children:[" ","· ",t.jsx("span",{className:"num font-semibold text-danger",children:K(d.failedCount)})," failed"]})," ","· scanned ",t.jsx("span",{className:"num",children:K(Math.min(d.scanned,Math.max(d.total,d.scanned)))})," delayed jobs",d.done?" · done":f?"…":" · stopped"]}),d.failed.length>0&&t.jsx("ul",{className:"max-h-32 overflow-auto rounded border border-border p-2 font-mono text-[11px] text-fg-muted",children:d.failed.map(y=>t.jsxs("li",{className:"truncate",children:[y.jobId,": ",y.reason]},y.jobId))})]})})}function E_({connectionId:e,queue:n,groupId:r}){var S;const{isOperator:i,isAdmin:o}=mt(),c=((S=td(e,n,{page:1,pageSize:1}).data)==null?void 0:S.bullmqProApi)??!1,d=q0(e,n),[h,f]=w.useState(!1),[g,p]=w.useState(!1),v=c?void 0:"Needs BullMQ Pro's package installed next to Bullpane",j=y=>d.mutate({groupId:r,action:y},{onSuccess:()=>X.success(`Group ${r} ${y==="pause"?"paused":y==="resume"?"resumed":"drained"}`),onError:b=>X.error(ve(b)),onSettled:()=>f(!1)});return t.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2 rounded-md border border-border bg-surface-2/40 px-3 py-2 text-xs",children:[t.jsx(Do,{className:"size-3.5 text-pro","aria-hidden":!0}),t.jsxs("span",{className:"text-fg-muted",children:["Group ",t.jsx("span",{className:"font-mono text-fg",children:r})]}),t.jsx(Ee,{to:ue.group(e,n,r),className:"text-accent hover:underline",children:"open group page"}),i&&t.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[t.jsx(V,{size:"xs",variant:"secondary",leftIcon:t.jsx(Gr,{}),disabled:!c||d.isPending,title:v,onClick:()=>j("pause"),children:"Pause group"}),t.jsx(V,{size:"xs",variant:"secondary",leftIcon:t.jsx(Qo,{}),disabled:!c||d.isPending,title:v,onClick:()=>j("resume"),children:"Resume group"}),t.jsx(V,{size:"xs",variant:"secondary",leftIcon:t.jsx(um,{}),disabled:!c,title:v,onClick:()=>p(!0),children:"Promote all delayed"}),o&&t.jsx(V,{size:"xs",variant:"danger",leftIcon:t.jsx(Un,{}),disabled:!c||d.isPending,title:v,onClick:()=>f(!0),children:"Drain group"})]}),t.jsx(Ht,{open:h,onClose:()=>f(!1),title:"Drain group",description:`Remove every waiting job of group ${r} in ${n} (BullMQ Pro's deleteGroup)? Its delayed jobs stay in the queue's delayed state. This cannot be undone.`,confirmText:"Drain group",danger:!0,loading:d.isPending,onConfirm:()=>j("drain")}),t.jsx(Bm,{open:g,onClose:()=>p(!1),connectionId:e,queue:n,match:{groupId:r}})]})}function R_({connectionId:e,queue:n,value:r,onChange:i,disabled:o,className:c,showWaiting:d=!0,pageGroups:h=[]}){var M;const f=td(e,n,{page:1,pageSize:200}),[g,p]=w.useState(!1),[v,j]=w.useState(""),[S,y]=w.useState(0),b=w.useRef(null),k=w.useRef(null),C=w.useId(),z=((M=f.data)==null?void 0:M.groups)??[],O=w.useMemo(()=>{const E=v.trim().toLowerCase(),I=z.filter(ce=>!E||ce.id.toLowerCase().includes(E)).slice(0,100),Q=E&&z.some(ce=>ce.id.toLowerCase()===E),H=h.filter(ce=>!E||ce.toLowerCase().includes(E)).slice(0,50),q=new Set(H),B=[];E||B.push({id:"",label:"All groups"}),B.push(...H.map(ce=>({id:ce,label:ce,onPage:!0}))),B.push(...I.filter(ce=>!q.has(ce.id)).map(ce=>({id:ce.id,label:ce.id,waiting:d?ce.waiting:void 0})));const de=Q||H.some(ce=>ce.toLowerCase()===E);return E&&!de&&B.push({id:v.trim(),label:`Use "${v.trim()}"`,custom:!0}),B},[z,v,h,d]);w.useEffect(()=>y(0),[v,g]),w.useEffect(()=>{if(!g)return;const E=I=>{var Q;(Q=k.current)!=null&&Q.contains(I.target)||p(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[g]);const T=E=>{i(E),p(!1),j("")};return t.jsxs("div",{ref:k,className:F("relative",c),children:[t.jsxs("div",{className:F("control flex !h-7 !w-auto min-w-44 items-center gap-1.5 !px-2 text-xs",o&&"cursor-not-allowed opacity-50",r&&"border-pro/60"),children:[t.jsx(Do,{className:"size-3.5 shrink-0 text-pro","aria-hidden":!0}),g?t.jsx("input",{ref:b,autoFocus:!0,role:"combobox","aria-expanded":g,"aria-controls":C,"aria-autocomplete":"list","aria-label":"Filter by group",className:"min-w-0 flex-1 bg-transparent font-mono outline-none placeholder:font-sans placeholder:text-fg-subtle",placeholder:"Type a group id…",value:v,onChange:E=>j(E.target.value),onKeyDown:E=>{E.key==="ArrowDown"?(E.preventDefault(),y(I=>Math.min(O.length-1,I+1))):E.key==="ArrowUp"?(E.preventDefault(),y(I=>Math.max(0,I-1))):E.key==="Enter"?(E.preventDefault(),O[S]&&T(O[S].id)):E.key==="Escape"&&(E.preventDefault(),p(!1),j(""))}}):t.jsx("button",{type:"button",disabled:o,className:"flex min-w-0 flex-1 items-center gap-1 text-left",onClick:()=>p(!0),"aria-haspopup":"listbox","aria-expanded":g,title:r?`Showing group ${r}`:"Filter jobs by group",children:r?t.jsx("span",{className:"truncate font-mono text-fg",children:r}):t.jsxs("span",{className:"truncate text-fg-muted",children:["All groups",f.data?t.jsxs("span",{className:"num text-fg-subtle",children:[" · ",ft(f.data.total)]}):null]})}),r&&!o?t.jsx("button",{type:"button",className:"rounded p-0.5 text-fg-subtle hover:text-fg","aria-label":"Clear group filter",onClick:()=>T(""),children:t.jsx(vn,{className:"size-3"})}):t.jsx(ps,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0})]}),g&&t.jsxs("ul",{id:C,role:"listbox",className:"absolute left-0 z-40 mt-1 max-h-64 w-72 overflow-auto rounded-md border border-border bg-surface p-1 text-xs shadow-[var(--shadow)]",children:[f.isLoading&&t.jsx("li",{className:"px-2 py-1.5 text-fg-subtle",children:"Loading groups…"}),!f.isLoading&&O.length===0&&t.jsx("li",{className:"px-2 py-1.5 text-fg-subtle",children:"No groups"}),O.map((E,I)=>{const Q=E.id===r;return t.jsxs("li",{role:"option","aria-selected":Q,className:F("flex cursor-pointer items-center gap-2 rounded px-2 py-1",I===S?"bg-surface-3 text-fg":"text-fg-muted hover:bg-surface-2 hover:text-fg"),onMouseEnter:()=>y(I),onMouseDown:H=>H.preventDefault(),onClick:()=>T(E.id),children:[t.jsx("span",{className:F("min-w-0 flex-1 truncate",E.id&&!E.custom&&"font-mono"),children:E.label}),E.waiting!=null&&t.jsxs("span",{className:"num text-[10px] text-fg-subtle",children:[ft(E.waiting)," waiting"]}),E.onPage&&t.jsx("span",{className:"text-[10px] text-fg-subtle",children:"on this page"}),Q&&t.jsx(Zr,{className:"size-3.5 text-accent","aria-hidden":!0})]},E.custom?`custom:${E.id}`:E.id||"__all__")}),f.data&&f.data.total>z.length&&t.jsxs("li",{className:"border-t border-border px-2 py-1 text-[10px] text-fg-subtle",children:["Showing the first ",z.length," of ",ft(f.data.total)," groups — type an id to filter or use it directly."]})]})]})}const M_={retry:"retried",promote:"promoted",remove:"removed",discard:"discarded"};function mj(e,n,r){return n==="promote"&&(r==null?void 0:r.mode)==="ran_copy"?`Job ${e} belongs to scheduler "${r.schedulerId}": ran a copy (${r.jobId}) now, the next scheduled run is unchanged`:n==="promote"&&(r==null?void 0:r.mode)==="skipped_next"?`Job ${e} promoted: scheduler "${r.schedulerId}" skips the run it was scheduled for`:`Job ${e} ${M_[n]}`}const T_=[{mode:"run_copy",title:"Run a copy now",detail:e=>`A one-off copy runs now. The scheduled run at ${e} still happens.`},{mode:"skip_next",title:"Promote and skip the next run",detail:e=>`The run scheduled for ${e} runs now instead. Nothing runs at ${e}; the scheduler continues with the run after it.`}];function pj({job:e,onClose:n,onPick:r,pending:i}){const o=e!=null&&e.delayedUntil?gn(e.delayedUntil):"its scheduled time";return t.jsx(bn,{open:e!==null,onClose:n,size:"md",title:"Promote a scheduled job",description:e?t.jsxs(t.Fragment,{children:["Job ",t.jsx("span",{className:"font-mono",children:e.id})," is the next run of scheduler"," ",t.jsx("span",{className:"font-mono",children:e.repeatJobKey}),"."]}):void 0,footer:t.jsx(V,{variant:"ghost",size:"sm",onClick:n,disabled:!!i,children:"Cancel"}),children:t.jsx("div",{className:"flex flex-col gap-2",children:T_.map(c=>t.jsxs("button",{type:"button",disabled:!!i,onClick:()=>r(c.mode),className:"rounded-md border border-border bg-surface-2 px-3 py-2.5 text-left transition-colors hover:border-border-strong hover:bg-surface-3 disabled:opacity-60",children:[t.jsxs("span",{className:"block text-sm font-medium text-fg",children:[c.title,i===c.mode&&"…"]}),t.jsx("span",{className:"mt-0.5 block text-xs text-fg-muted",children:c.detail(o)})]},c.mode))})})}const q_=10;function $_(e){return!!e&&yo.includes(e)}function sf({view:e="jobs"}={}){var ml,pl,xl,si,gl,cr,ri,ur,Jo,dr,aa,ia,ai,Xo,Yo,ec,ys,vl,yl,tc,jl,bl,wl,Nl,nc,sc,gt;const{connectionId:n="",queue:r=""}=Fn(),[i,o]=sl(),c=un(),{isOperator:d,isAdmin:h}=mt(),f=$_(i.get("state"))?i.get("state"):"waiting",g=Math.max(1,Number(i.get("page")??1)||1),p=[25,50,100,200].includes(Number(i.get("pageSize")))?Number(i.get("pageSize")):25,v=i.get("order")==="asc"?"asc":"desc",j=i.get("q")??"",S=i.get("group")??"",[y,b]=w.useState(j),k=w.useCallback(le=>{o(nt=>{const et=new URLSearchParams(nt);for(const[Tt,kl]of Object.entries(le))kl==null||kl===""?et.delete(Tt):et.set(Tt,kl);return et},{replace:!0})},[o]),C=R0(n,r),z=C_(n,r),O=_m(n),T=!!C.data&&(C.data.isPro||C.data.groupsCount>0),M=j.trim().length>0,E=!M&&!!S&&f!=="waiting"&&f!=="prioritized",I=!M&&!!S&&!E,Q=M||E,H=e==="metrics",q=e==="schedulers",B=H||q,de=M0(n,r,{state:f,page:g,pageSize:p,order:v,groupId:I?S:void 0},{enabled:!Q&&!B}),ce=h2(n,r,{state:f,q:j.trim(),groupId:E?S:void 0,limit:50},{enabled:Q&&!B}),Ne=jm(n,r),Ie=T0(n,r),ot=p2(n,r),De=((ml=ce.data)==null?void 0:ml.pages)??[],W=De.flatMap(le=>le.jobs),me=De.reduce((le,nt)=>le+(nt.scanned??0),0),re=De.reduce((le,nt)=>le+(nt.skippedLargePayloads??0),0),A=De.length?De[De.length-1].total:((xl=(pl=C.data)==null?void 0:pl.counts)==null?void 0:xl[f])??0,[Z,Fe]=w.useState(0);w.useEffect(()=>Fe(0),[S,f]),w.useEffect(()=>{!E||!ce.hasNextPage||ce.isFetching||W.length>=50||De.length-Z>=q_||ce.fetchNextPage()},[E,ce,W.length,De.length,Z]);const Ue=()=>{Fe(De.length),ce.fetchNextPage()},Se=Q?W:((si=de.data)==null?void 0:si.jobs)??[],Qe=w.useMemo(()=>Se.map(le=>le.id),[Se]),rt=w.useMemo(()=>[...new Set(Se.map(le=>le.groupId).filter(le=>!!le))],[Se]),He=kC(Qe),[at,Zt]=w.useState(null),[lr,ul]=w.useState(null),[Za,Yr]=w.useState(null),[ea,Ga]=w.useState(null),[ta,Ja]=w.useState(null),[dl,or]=w.useState(!1),[Rn,Ut]=w.useState(null),[Ko,Xa]=w.useState(!1),Qn=i.get("confirm");w.useEffect(()=>{if(Qn!=="drain"&&Qn!=="clean"&&Qn!=="obliterate")return;(Qn==="clean"?d:h)?Ut(Qn):X.error(`${Qn==="clean"?"Cleaning":Qn==="drain"?"Draining":"Obliterating"} a queue needs the ${Qn==="clean"?"operator":"admin"} role`),o(nt=>{const et=new URLSearchParams(nt);return et.delete("confirm"),et},{replace:!0})},[Qn,h,d,o]);const{has:Wo,gate:Ya}=wt(),[na,vs]=w.useState(!1),zs=w.useRef(null),Os=w.useCallback(()=>{var le,nt;(le=zs.current)==null||le.focus(),(nt=zs.current)==null||nt.select()},[]);S0("/",le=>{le.preventDefault(),Os()}),w.useEffect(()=>{if(i.get("search")!=="1")return;const le=window.setTimeout(Os,0);return k({search:null}),()=>window.clearTimeout(le)},[i,k,Os]),w.useEffect(()=>b(j),[j]);const Nt=(gl=C.data)==null?void 0:gl.counts,hl=(cr=$0(n,r,S||void 0,{page:1,pageSize:1}).data)==null?void 0:cr.total,Ot=(ri=C.data)==null?void 0:ri.groupWaiting,Zo=w.useMemo(()=>{if(S)return{count:hl??null,title:`Jobs waiting in group ${S} (its list and its prioritized jobs)`};if(!Ot||Ot.jobs===0)return{count:(Nt==null?void 0:Nt.waiting)??null};const le=(Nt==null?void 0:Nt.waiting)??0;return{count:le+Ot.jobs,countSuffix:Ot.complete?void 0:"+",title:`${K(le)} in the queue's wait list + ${K(Ot.jobs)} waiting inside BullMQ Pro groups`+(Ot.complete?"":` (the first ${K(Sk)} groups)`)+". Pick a group to list its jobs."}},[S,hl,Ot,Nt==null?void 0:Nt.waiting]),fl=w.useMemo(()=>{var nt,et;const le=[{value:"metrics",label:"Metrics",icon:t.jsx(om,{className:"size-3.5"})},{value:"schedulers",label:"Schedulers",count:((nt=C.data)==null?void 0:nt.schedulersCount)??null,icon:t.jsx(Lo,{className:"size-3.5"})},...yo.map(Tt=>({value:Tt,label:lt[Tt].label,count:(Nt==null?void 0:Nt[Tt])??null,tone:lt[Tt].dotClass,...Tt==="waiting"?Zo:{}}))];return(et=C.data)!=null&&et.isPro&&le.push({value:"groups",label:"Groups",count:C.data.groupsCount,icon:t.jsx(Do,{className:"size-3.5 text-pro"})}),le},[Nt,Zo,(ur=C.data)==null?void 0:ur.isPro,(Jo=C.data)==null?void 0:Jo.groupsCount,(dr=C.data)==null?void 0:dr.schedulersCount]),sa=(le,nt,et)=>{Ne.mutate({jobId:le,action:nt,scheduler:et},{onSuccess:Tt=>{X.success(mj(le,nt,Tt)),Ja(null)},onError:Tt=>X.error(ve(Tt))})},ei=(le,nt,et)=>{if(nt==="remove"){Ga(le);return}if(nt==="promote"&&(et!=null&&et.repeatJobKey)){Ja({id:et.id,repeatJobKey:et.repeatJobKey,delayedUntil:et.delayedUntil});return}sa(le,nt)},ti=w.useMemo(()=>aj(M?"mixed":f),[M,f]),ni=le=>{const nt=He.selectedIds;if(nt.length!==0){if(nt.length>Au){X.error(`Select at most ${K(Au)} jobs per action (${K(nt.length)} selected).`);return}ul(le),ot.mutate({action:le,jobIds:nt},{onSuccess:et=>{Zt(et),He.deselect(et.ok);const Tt=le==="retry"?"retried":le==="promote"?"promoted":"removed";et.failed.length===0?X.success(`${K(et.ok.length)} ${Tt}`):X.error(`${K(et.ok.length)} ${Tt} · ${K(et.failed.length)} failed`)},onError:et=>X.error(ve(et)),onSettled:()=>{ul(null),Yr(null)}})}},As=le=>{le==="remove"?Yr("remove"):ni(le)},Bn=(le,nt)=>Ie.mutate(le,{onSuccess:()=>{X.success(nt),Ut(null),le.action==="obliterate"&&c(ue.connection(n))},onError:et=>X.error(ve(et))}),Go=()=>k({q:y.trim()||null,page:null}),ra=()=>{b(""),k({q:null,page:null})};return t.jsxs(bt,{wide:!0,children:[t.jsxs("div",{className:"mb-3 flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h1",{className:"truncate font-mono text-lg font-semibold tracking-tight",children:r}),((aa=C.data)==null?void 0:aa.isPaused)&&t.jsx(be,{variant:"warning",dot:!0,className:"tracking-wider",children:"PAUSED"}),((ia=C.data)==null?void 0:ia.isPro)&&t.jsx(be,{variant:"pro",title:"BullMQ Pro groups detected",className:"tracking-wider",children:"PRO"}),C.isError&&t.jsx(be,{variant:"danger",children:"unreachable"})]}),t.jsxs("p",{className:"mt-0.5 flex items-center gap-3 text-xs text-fg-muted",children:[t.jsxs("span",{className:"font-mono",children:[((ai=C.data)==null?void 0:ai.prefix)??"bull",":",r]}),((Xo=C.data)==null?void 0:Xo.metrics)&&C.data.metrics.completed.length>1&&t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{style:{color:lt.completed.fg},children:t.jsx(tl,{values:C.data.metrics.completed,width:72,height:16,title:"Completed per minute"})}),t.jsx("span",{style:{color:lt.failed.fg},children:t.jsx(tl,{values:C.data.metrics.failed,width:72,height:16,title:"Failed per minute"})})]}),t.jsx(__,{matches:z.matches,firing:z.firing})]})]}),d&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(V,{size:"sm",variant:"primary",leftIcon:t.jsx(es,{}),onClick:()=>Ut("add"),children:"Add job"}),t.jsx(V,{size:"sm",leftIcon:t.jsx(rl,{}),onClick:()=>Ya("alerts",()=>Xa(!0)),title:"Alert on this queue",children:"Create alert"}),t.jsx(V,{size:"sm",leftIcon:(Yo=C.data)!=null&&Yo.isPaused?t.jsx(Qo,{}):t.jsx(Gr,{}),loading:Ie.isPending&&(((ec=Ie.variables)==null?void 0:ec.action)==="pause"||((ys=Ie.variables)==null?void 0:ys.action)==="resume"),onClick:()=>{var le;return(le=C.data)!=null&&le.isPaused?Bn({action:"resume"},"Queue resumed"):Ut("pause")},children:(vl=C.data)!=null&&vl.isPaused?"Resume":"Pause"}),t.jsx(V,{size:"sm",leftIcon:t.jsx(Zu,{}),onClick:()=>Ut("retryAll"),disabled:!Nt||Nt.failed===0,children:"Retry all failed"}),t.jsxs("div",{className:"relative",children:[t.jsx(V,{size:"sm",variant:"secondary",rightIcon:t.jsx(ps,{}),"aria-haspopup":"menu","aria-expanded":na,onClick:()=>vs(le=>!le),children:"More"}),na&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>vs(!1),"aria-hidden":!0}),t.jsxs("div",{role:"menu",className:"absolute right-0 z-40 mt-1 w-56 rounded-lg border border-border bg-surface p-1 shadow-[var(--shadow)]",children:[t.jsx(hu,{icon:t.jsx(bN,{}),label:"Clean…",hint:"remove by state and age",onClick:()=>(vs(!1),Ut("clean"))}),h&&t.jsxs(Ee,{role:"menuitem",to:ue.audit({connectionId:n,queueName:r}),onClick:()=>vs(!1),className:"nav-item w-full text-left",children:[t.jsx(Bo,{className:"size-3.5 shrink-0","aria-hidden":!0}),t.jsxs("span",{className:"flex-1",children:["Audit this queue",t.jsx("span",{className:"block text-[10px] text-fg-subtle",children:"who paused, cleaned or drained it"})]})]}),d&&t.jsx(hu,{icon:t.jsx(Fo,{}),label:"Hide from the lists",hint:kS,onClick:()=>(vs(!1),O.hide(r))}),h&&t.jsx(hu,{icon:t.jsx(Un,{}),label:"Drain",hint:"remove all waiting jobs",onClick:()=>(vs(!1),Ut("drain"))}),h&&t.jsx(hu,{icon:t.jsx(wN,{}),label:"Obliterate…",hint:"deletes the queue and every job · permanent",danger:!0,onClick:()=>(vs(!1),Ut("obliterate"))})]})]})]})]})]}),t.jsx(u_,{connectionId:n,queue:r,className:"mb-3"}),t.jsx("div",{className:"mb-3",children:t.jsx(P_,{connectionId:n,queueName:r,matches:z.matches,onCreate:()=>Ya("alerts",()=>Xa(!0))})}),!B&&t.jsxs("form",{className:"mb-3 flex flex-wrap items-center gap-2",role:"search",onSubmit:le=>{le.preventDefault(),Go()},children:[t.jsxs("div",{className:"relative min-w-72 flex-1",children:[t.jsx(Te,{ref:zs,leftIcon:t.jsx(Yn,{}),placeholder:`Search job data, name, id or error in ${f}…`,"aria-label":"Search jobs",value:y,onChange:le=>b(le.target.value),onKeyDown:le=>{le.key==="Escape"&&(le.preventDefault(),ra(),le.target.blur())},className:"!h-9 pr-16 text-[13px]"}),t.jsx("span",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 items-center gap-1",children:y||M?t.jsx("button",{type:"button",className:"rounded p-0.5 text-fg-subtle hover:text-fg","aria-label":"Clear search",onClick:ra,children:t.jsx(vn,{className:"size-3.5"})}):t.jsx("span",{className:"hidden items-center gap-1 sm:flex",children:t.jsx(Xi,{children:"/"})})})]}),t.jsx(dt,{"aria-label":"State to search",className:"!h-9 !w-auto",value:f,onChange:le=>k({state:le.target.value,page:null,group:null}),options:yo.map(le=>({value:le,label:`in ${lt[le].label}`}))}),t.jsx(V,{type:"submit",size:"md",variant:M?"secondary":"primary",leftIcon:t.jsx(Yn,{}),disabled:!y.trim()&&!M,children:"Search"}),t.jsx("span",{className:"hidden text-[11px] text-fg-subtle lg:inline",children:"Enter to search · Esc to clear · substring match, server-side"})]}),t.jsxs("div",{className:"mb-3 flex flex-wrap items-end gap-3 border-b border-border",children:[t.jsx("div",{className:F("min-w-0 flex-1 transition-opacity",!B&&M&&"opacity-50"),children:t.jsx(Um,{"aria-label":"Job state",items:fl,value:H?"metrics":q?"schedulers":f,onChange:le=>{le==="groups"?c(ue.groups(n,r)):le==="metrics"?c(ue.queueMetrics(n,r)):le==="schedulers"?c(`/c/${encodeURIComponent(n)}/q/${encodeURIComponent(r)}/schedulers`):B?c(ue.queue(n,r,le)):k({state:le,page:null})},className:"!border-b-0",size:"sm"})}),T&&!M&&!B&&t.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[(I||E)&&t.jsxs("span",{className:"text-[11px] text-fg-muted",children:["showing group ",t.jsx("span",{className:"font-mono text-fg",children:S}),"'s ",E?f:"waiting"," jobs"]}),t.jsx(R_,{connectionId:n,queue:r,value:S,onChange:le=>k({group:le||null,page:null}),showWaiting:f==="waiting"||f==="prioritized",pageGroups:rt})]}),!Q&&!B&&t.jsx(V,{size:"sm",variant:"ghost",className:"mb-1",leftIcon:t.jsx(lN,{}),onClick:()=>k({order:v==="desc"?"asc":"desc"}),title:"Toggle order",children:v==="desc"?"Newest first":"Oldest first"})]}),T&&S&&!M&&!B&&t.jsx(E_,{connectionId:n,queue:r,groupId:S}),q?t.jsx(m_,{connectionId:n,queue:r}):H?t.jsx(YC,{connectionId:n,queue:r,summary:C.data,onOpenState:le=>c(ue.queue(n,r,le))}):t.jsx("div",{className:"card overflow-hidden",children:Q?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border bg-surface-2/50 px-3 py-2 text-xs",role:"status",children:[t.jsxs("span",{className:"flex items-center gap-2 text-fg-muted",children:[t.jsx(Yn,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}),ce.isFetching&&!ce.isFetchingNextPage?t.jsx(Kt,{label:M?`Scanning ${f} jobs for "${j}"…`:`Scanning ${f} jobs for group ${S}…`}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"num font-semibold text-fg",children:K(W.length)})," ",M?W.length===1?"match":"matches":`${W.length===1?"job":"jobs"} of group ${S}`," · scanned ",t.jsx("span",{className:"num text-fg",children:K(Math.min(me,A))})," of"," ",t.jsx("span",{className:"num text-fg",children:K(A)})," jobs in ",t.jsx("span",{className:lt[f].textClass,children:f}),!ce.hasNextPage&&ce.data&&t.jsx("span",{className:"text-fg-subtle",children:" · whole state scanned"}),re>0&&t.jsxs("span",{className:"text-fg-subtle",title:"Payloads above the search size cap are not read into Lua; those jobs still match on id, name and error.",children:[" ","· ",K(re)," ",re===1?"payload":"payloads"," too large to search inside"]})]})]}),t.jsxs("span",{className:"flex items-center gap-2",children:[M&&f==="delayed"&&d&&t.jsx(V,{size:"sm",variant:"secondary",leftIcon:t.jsx(um,{}),onClick:()=>or(!0),title:"Promote every delayed job that contains the search, not only the loaded ones",children:"Promote all matches"}),ce.hasNextPage&&t.jsx(V,{size:"sm",onClick:Ue,loading:ce.isFetchingNextPage,children:"Scan more"}),t.jsx(V,{size:"sm",variant:"ghost",leftIcon:t.jsx(vn,{}),onClick:M?ra:()=>k({group:null,page:null}),children:"Clear"})]})]}),at&&t.jsx(wv,{result:at,onDismiss:()=>Zt(null)}),d&&t.jsx(bv,{selection:He,state:M?"mixed":f,queue:r,actions:ti,onRun:As,pending:lr,searching:!0}),t.jsx(Kf,{connectionId:n,queue:r,jobs:ce.data?W:void 0,loading:ce.isLoading,error:ce.error,emptyText:ce.hasNextPage?"No matches yet — scan more to keep looking":M?`No ${f} job contains "${j}"`:`No ${f} jobs in group ${S}`,canOperate:d,onAction:ei,pendingId:Ne.isPending?(yl=Ne.variables)==null?void 0:yl.jobId:null,showState:!1,showGroup:T,onGroupClick:le=>{ra(),k({group:le,page:null})},highlight:M?j:void 0,selection:d?He:void 0}),t.jsxs("div",{className:"flex items-center justify-between border-t border-border px-3 py-2 text-xs text-fg-subtle",children:[t.jsx("span",{children:"Each scan reads a bounded slice of the state to keep the database happy."}),ce.hasNextPage&&t.jsx(V,{size:"sm",onClick:Ue,loading:ce.isFetchingNextPage,children:"Scan more"})]})]}):t.jsxs(t.Fragment,{children:[f==="active"&&(((tc=C.data)==null?void 0:tc.stalledCount)??0)>0&&t.jsxs("div",{className:"flex items-start gap-2 border-b border-border bg-warning/10 px-3 py-2 text-xs",role:"status",children:[t.jsx(fm,{className:"mt-0.5 size-3.5 shrink-0 text-warning","aria-hidden":!0}),t.jsxs("span",{children:[t.jsx("span",{className:"num font-semibold text-fg",children:K(((jl=C.data)==null?void 0:jl.stalledCount)??0)})," of these are stalled (worker lost the lock).",t.jsx("span",{className:"text-fg-muted",children:" BullMQ still reports them as active; the next stalled check moves them back to waiting and bumps their stall counter."})]})]}),at&&t.jsx(wv,{result:at,onDismiss:()=>Zt(null)}),d&&t.jsx(bv,{selection:He,state:f,queue:r,actions:ti,onRun:As,pending:lr}),t.jsx(Kf,{connectionId:n,queue:r,jobs:(bl=de.data)==null?void 0:bl.jobs,loading:de.isLoading,error:de.error,emptyText:I?`No waiting jobs in group ${S}`:f==="waiting"&&((Ot==null?void 0:Ot.jobs)??0)>0?`The queue's wait list is empty: BullMQ Pro keeps ${K((Ot==null?void 0:Ot.jobs)??0)}${Ot!=null&&Ot.complete?"":"+"} waiting jobs inside groups. Pick a group above to list them.`:"No jobs in this state",canOperate:d,onAction:ei,pendingId:Ne.isPending?(wl=Ne.variables)==null?void 0:wl.jobId:null,showState:!1,showGroup:T,onGroupClick:le=>k({group:le,page:null}),selection:d?He:void 0}),t.jsx("div",{className:F("border-t border-border px-3 py-2",de.isFetching&&"opacity-80"),children:t.jsx(ld,{page:g,pageSize:p,total:((Nl=de.data)==null?void 0:Nl.total)??(I?0:(Nt==null?void 0:Nt[f])??0),count:(nc=de.data)==null?void 0:nc.jobs.length,onPage:le=>k({page:String(le)}),onPageSize:le=>k({pageSize:String(le),page:null})})})]})}),d&&t.jsx(i_,{open:Rn==="add",onClose:()=>Ut(null),connectionId:n,queue:r}),d&&Wo("alerts")&&Ko&&t.jsx(od,{open:!0,onClose:()=>Xa(!1),alert:null,initialScope:{type:"queue",connectionId:n,queueName:r}}),d&&t.jsx(c_,{open:Rn==="clean",onClose:()=>Ut(null),connectionId:n,queue:r,defaultState:f==="waiting"?"wait":f==="waiting-children"?"completed":f}),t.jsx(Ht,{open:Za==="remove",onClose:()=>Yr(null),title:"Remove selected jobs",description:`Remove ${K(He.selectedIds.length)} ${He.selectedIds.length===1?"job":"jobs"} from ${r}? This cannot be undone.`,confirmText:`Remove ${K(He.selectedIds.length)}`,danger:!0,loading:lr==="remove",onConfirm:()=>ni("remove")}),t.jsx(Ht,{open:ea!==null,onClose:()=>Ga(null),title:"Remove job",description:`Remove job ${ea??""} from ${r}? This cannot be undone.`,confirmText:"Remove",danger:!0,loading:Ne.isPending,onConfirm:()=>{ea&&sa(ea,"remove"),Ga(null)}}),t.jsx(pj,{job:ta,onClose:()=>Ja(null),onPick:le=>ta&&sa(ta.id,"promote",le),pending:Ne.isPending&&((sc=Ne.variables)==null?void 0:sc.action)==="promote"?Ne.variables.scheduler??null:null}),t.jsx(tj,{queue:Rn==="pause"?r:null,onClose:()=>Ut(null),loading:Ie.isPending&&((gt=Ie.variables)==null?void 0:gt.action)==="pause",onConfirm:le=>Bn({action:"pause",body:le?{reason:le}:{}},"Queue paused")}),t.jsx(Ht,{open:Rn==="retryAll",onClose:()=>Ut(null),title:"Retry all failed jobs",description:`Moves ${K((Nt==null?void 0:Nt.failed)??0)} failed jobs in ${r} back to waiting.`,confirmText:"Retry all",loading:Ie.isPending,onConfirm:()=>Bn({action:"retry-all",body:{state:"failed"}},"Retrying all failed jobs")}),t.jsx(Ht,{open:Rn==="drain",onClose:()=>Ut(null),title:"Drain queue",description:`Removes every waiting and prioritized job in ${r}. Active, completed and failed jobs are kept.`,confirmText:"Drain",danger:!0,loading:Ie.isPending,onConfirm:()=>Bn({action:"drain",body:{includeDelayed:!1}},"Queue drained")}),t.jsx(Ht,{open:Rn==="obliterate",onClose:()=>Ut(null),title:"Obliterate queue",description:"Deletes every key of this queue from Redis, including completed and failed history. This cannot be undone.",confirmText:"Obliterate",danger:!0,typeToConfirm:r,loading:Ie.isPending,onConfirm:()=>Bn({action:"obliterate"},`${r} obliterated`)}),M&&t.jsx(Bm,{open:dl,onClose:()=>or(!1),connectionId:n,queue:r,match:{query:j.trim()}})]})}function hu({icon:e,label:n,hint:r,danger:i,onClick:o}){return t.jsxs("button",{role:"menuitem",type:"button",onClick:o,className:F("nav-item h-auto w-full py-1.5 text-left [&_svg]:size-3.5",i&&"text-danger hover:text-danger"),children:[e,t.jsxs("span",{className:"flex flex-col",children:[t.jsx("span",{className:F(!i&&"text-fg"),children:n}),r&&t.jsx("span",{className:"text-[11px] text-fg-subtle",children:r})]})]})}function xj({value:e,defaultExpandDepth:n=2,className:r,name:i}){return t.jsx("div",{className:F("font-mono text-xs leading-[1.6] text-fg",r),children:t.jsx(vj,{name:i,value:e,depth:0,expandDepth:n,last:!0})})}function gj(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";const n=typeof e;return n==="object"?"object":n==="string"?"string":n==="number"||n==="bigint"?"number":n==="boolean"?"boolean":"other"}const fu=200;function I_({value:e}){const[n,r]=w.useState(!1);switch(gj(e)){case"string":{const o=e,d=!n&&o.length>fu?`${o.slice(0,fu)}…`:o;return t.jsxs("span",{className:"text-success break-all",children:['"',d,'"',o.length>fu&&t.jsx("button",{type:"button",className:"ml-1 rounded bg-surface-3 px-1 text-[10px] text-fg-muted hover:text-fg",onClick:()=>r(h=>!h),children:n?"less":`+${o.length-fu} chars`})]})}case"number":return t.jsx("span",{className:"text-info",children:String(e)});case"boolean":return t.jsx("span",{className:"text-violet",children:String(e)});case"null":return t.jsx("span",{className:"text-fg-subtle",children:"null"});case"undefined":return t.jsx("span",{className:"text-fg-subtle",children:"undefined"});default:return t.jsx("span",{className:"text-fg-muted",children:String(e)})}}function vj({name:e,value:n,depth:r,expandDepth:i,last:o}){const c=gj(n),d=c==="object"||c==="array",[h,f]=w.useState(r<i),g=e!==void 0?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-fg",children:z_(e)?e:JSON.stringify(e)}),t.jsx("span",{className:"text-fg-subtle",children:": "})]}):null;if(!d)return t.jsxs("div",{className:"flex",style:{paddingLeft:r?16:0},children:[t.jsx("span",{className:"w-4 shrink-0"}),t.jsxs("span",{className:"min-w-0",children:[g,t.jsx(I_,{value:n}),!o&&t.jsx("span",{className:"text-fg-subtle",children:","})]})]});const p=c==="array"?n.map((y,b)=>[String(b),y]):Object.entries(n),[v,j]=c==="array"?["[","]"]:["{","}"],S=c==="array"?`${p.length} item${p.length===1?"":"s"}`:`${p.length} key${p.length===1?"":"s"}`;return p.length===0?t.jsxs("div",{className:"flex",style:{paddingLeft:r?16:0},children:[t.jsx("span",{className:"w-4 shrink-0"}),t.jsxs("span",{children:[g,t.jsxs("span",{className:"text-fg-muted",children:[v,j]}),!o&&t.jsx("span",{className:"text-fg-subtle",children:","})]})]}):t.jsxs("div",{style:{paddingLeft:r?16:0},children:[t.jsxs("div",{className:"flex",children:[t.jsx("button",{type:"button","aria-expanded":h,"aria-label":h?"Collapse":"Expand",onClick:()=>f(y=>!y),className:"flex w-4 shrink-0 items-start justify-center pt-[3px] text-fg-subtle hover:text-fg",children:h?t.jsx(ps,{className:"size-3"}):t.jsx(Dn,{className:"size-3"})}),t.jsxs("span",{className:"min-w-0 cursor-default",onClick:()=>!h&&f(!0),children:[g,t.jsx("span",{className:"text-fg-muted",children:v}),!h&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-1 rounded bg-surface-3 px-1 text-[10px] text-fg-subtle",children:S}),t.jsx("span",{className:"text-fg-muted",children:j}),!o&&t.jsx("span",{className:"text-fg-subtle",children:","})]})]})]}),h&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"border-l border-border/70",style:{marginLeft:7},children:p.map(([y,b],k)=>t.jsx(vj,{name:c==="array"?void 0:y,value:b,depth:r+1,expandDepth:i,last:k===p.length-1},y))}),t.jsxs("div",{className:"flex",children:[t.jsx("span",{className:"w-4 shrink-0"}),t.jsxs("span",{className:"text-fg-muted",children:[j,!o&&t.jsx("span",{className:"text-fg-subtle",children:","})]})]})]})]})}function z_(e){return/^[A-Za-z_$][\w$]*$/.test(e)}function O_(){var T,M,E,I,Q;const{connectionId:e="",queue:n="",jobId:r=""}=Fn(),i=un(),{has:o}=wt(),{isOperator:c,isAdmin:d}=mt(),h=f2(e,n,r),f=jm(e,n),[g,p]=w.useState("data"),[v,j]=w.useState(null),[S,y]=w.useState(!1),b=(H,q)=>f.mutate({jobId:r,action:H,scheduler:q},{onSuccess:B=>{X.success(mj(r,H,B)),j(null),y(!1),H==="remove"&&i(ue.queue(e,n))},onError:B=>X.error(ve(B))});if(h.isLoading)return t.jsx(bt,{children:t.jsx(il,{label:"Loading job…"})});if(h.isError||!h.data){const H=Ts(h.error)&&h.error.status===404;return t.jsx(bt,{children:t.jsx(cn,{title:H?"Job not found":"Could not load job",description:H?"It may have been removed or cleaned since you opened it.":ve(h.error),action:t.jsxs(V,{variant:"secondary",leftIcon:t.jsx(Su,{}),onClick:()=>i(ue.queue(e,n)),children:["Back to ",n]})})})}const k=h.data,C=k.state==="failed"||k.state==="completed",z=k.state==="delayed",O=!!k.failedReason||(((T=k.stacktrace)==null?void 0:T.length)??0)>0;return t.jsxs(bt,{children:[t.jsxs("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs(Ee,{to:ue.queue(e,n,k.state!=="unknown"?k.state:void 0),className:"mb-1 inline-flex items-center gap-1 text-xs text-fg-muted hover:text-fg",children:[t.jsx(Su,{className:"size-3.5"})," ",n]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("h1",{className:"truncate text-lg font-semibold tracking-tight",children:k.name}),t.jsx(G0,{state:k.state}),k.groupId&&t.jsx(Ee,{to:ue.group(e,n,k.groupId),children:t.jsxs(be,{variant:"pro",mono:!0,title:"BullMQ Pro group",children:["group ",k.groupId]})}),k.priority>0&&t.jsxs(be,{variant:"violet",children:["priority ",k.priority]})]}),t.jsxs("p",{className:"mt-1 flex items-center gap-1 font-mono text-xs text-fg-muted",children:[t.jsx("span",{className:"select-all",children:k.id}),t.jsx(_o,{value:k.id,label:"Copy id",size:"icon-xs"}),t.jsx(_o,{value:()=>Du(k),label:"Copy JSON",copiedLabel:"Copied JSON",showLabel:!0,size:"xs",icon:t.jsx(Ly,{}),className:"ml-1 font-sans"})]})]}),c&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[C&&t.jsx(V,{size:"sm",leftIcon:t.jsx(Zu,{}),onClick:()=>b("retry"),loading:f.isPending&&((M=f.variables)==null?void 0:M.action)==="retry",children:"Retry"}),z&&t.jsx(V,{size:"sm",leftIcon:t.jsx(im,{}),onClick:()=>k.repeatJobKey?y(!0):b("promote"),loading:f.isPending&&((E=f.variables)==null?void 0:E.action)==="promote",children:"Promote"}),t.jsx(V,{size:"sm",variant:"ghost",leftIcon:t.jsx(hN,{}),onClick:()=>j("discard"),title:"Mark as not retryable",children:"Discard"}),t.jsx(V,{size:"sm",variant:"ghost",className:"hover:text-danger",leftIcon:t.jsx(Un,{}),onClick:()=>j("remove"),children:"Remove"})]})]}),t.jsxs("div",{className:"mb-4 grid gap-3 lg:grid-cols-3",children:[t.jsx("div",{className:"card p-4 lg:col-span-2",children:t.jsx(F_,{job:k})}),t.jsxs("dl",{className:"card grid grid-cols-2 gap-x-4 gap-y-3 p-4 text-xs",children:[t.jsx(ja,{label:"Attempts",children:t.jsxs("span",{className:F(k.attemptsMade>1&&"text-warning"),children:[k.attemptsMade,k.attempts!=null&&t.jsxs("span",{className:"text-fg-subtle",children:[" / ",k.attempts]})]})}),k.state==="delayed"?t.jsx(ja,{label:"Runs at",children:t.jsx(A_,{at:k.delayedUntil})}):t.jsx(ja,{label:"Delay",children:k.delay?An(k.delay):"–"}),t.jsx(ja,{label:"Priority",children:k.priority||"–"}),t.jsx(ja,{label:"Progress",children:t.jsx(L_,{value:k.progress})}),t.jsx(ja,{label:"Parent",children:k.parent?t.jsxs(Ee,{to:ue.job(e,lv(k.parent.queueKey),k.parent.id),className:"inline-flex items-center gap-1 font-mono text-accent hover:underline",children:[t.jsx(kN,{className:"size-3"}),k.parent.queue||lv(k.parent.queueKey),"/",k.parent.id]}):"–"}),t.jsx(ja,{label:"Children",children:k.dependencies?t.jsxs("span",{children:[t.jsx("span",{className:"text-success",children:K(k.dependencies.processed)})," done ·"," ",t.jsx("span",{className:F(k.dependencies.unprocessed>0&&"text-teal"),children:K(k.dependencies.unprocessed)})," pending"]}):"–"})]}),(k.parent||k.dependencies)&&t.jsx("div",{className:"mt-3 border-t border-border pt-3",children:t.jsxs(Ee,{to:ue.jobTree(e,n,k.id),className:"inline-flex items-center gap-1.5 text-[13px] text-accent hover:underline",children:[t.jsx(TN,{className:"size-3.5","aria-hidden":!0}),"View flow tree"]})})]}),t.jsx(Um,{"aria-label":"Job details",size:"sm",className:"mb-3",value:g,onChange:p,items:[{value:"data",label:"Data"},{value:"opts",label:"Options",count:Object.keys(k.opts??{}).length},{value:"returnvalue",label:"Return value"},{value:"error",label:"Error",tone:O?"bg-danger":void 0},{value:"logs",label:"Logs",count:k.logsCount??((I=k.logs)==null?void 0:I.length)??0},...d&&o("audit")?[{value:"audit",label:"Audit"}]:[]]}),g==="data"&&t.jsx(rf,{value:k.data,empty:"No data"}),g==="opts"&&t.jsx(rf,{value:k.opts,empty:"No options"}),g==="returnvalue"&&t.jsx(rf,{value:k.returnvalue,empty:"No return value (job has not completed)"}),g==="error"&&t.jsx(D_,{job:k}),g==="logs"&&t.jsx(U_,{connectionId:e,queue:n,jobId:r,initial:k.logs,total:k.logsCount}),g==="audit"&&t.jsx(Q_,{connectionId:e,queue:n,jobId:r}),t.jsx(pj,{job:S&&k.repeatJobKey?{id:k.id,repeatJobKey:k.repeatJobKey,delayedUntil:k.delayedUntil}:null,onClose:()=>y(!1),onPick:H=>b("promote",H),pending:f.isPending&&((Q=f.variables)==null?void 0:Q.action)==="promote"?f.variables.scheduler??null:null}),t.jsx(Ht,{open:v==="remove",onClose:()=>j(null),title:"Remove job",description:`Job ${r} will be deleted from ${n}. Active jobs cannot be removed while locked.`,confirmText:"Remove",danger:!0,loading:f.isPending,onConfirm:()=>b("remove")}),t.jsx(Ht,{open:v==="discard",onClose:()=>j(null),title:"Discard job",description:"Marks the job as not retryable: attemptsMade is set to the max so backoff retries stop. The job itself is kept.",confirmText:"Discard",loading:f.isPending,onConfirm:()=>b("discard")})]})}function ja({label:e,children:n}){return t.jsxs("div",{className:"min-w-0",children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:e}),t.jsx("dd",{className:"num truncate text-[13px] text-fg",children:n})]})}function A_({at:e}){return e?t.jsxs("span",{className:"flex flex-col leading-tight",children:[t.jsx(Yt,{value:e}),t.jsx("span",{className:"font-mono text-[10px] text-fg-subtle",children:Uf(e)})]}):t.jsx(t.Fragment,{children:"–"})}function L_({value:e}){if(e==null)return t.jsx(t.Fragment,{children:"–"});if(typeof e=="number"){const n=Math.max(0,Math.min(100,e));return t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"h-1.5 w-16 overflow-hidden rounded bg-surface-3",children:t.jsx("span",{className:"block h-full bg-accent",style:{width:`${n}%`}})}),t.jsxs("span",{children:[n,"%"]})]})}return t.jsx("span",{className:"font-mono text-[11px]",title:Du(e),children:Du(e,0).slice(0,40)})}function F_({job:e}){var g;const n=ol(1e3),r=e.timestamp,i=e.processedOn,o=e.finishedOn,c=i?i-r:e.state==="waiting"||e.state==="delayed"||e.state==="prioritized"?n-r:null,d=i?o??(e.state==="active"?n:null):null,h=i&&d?d-i:null,f=[{label:"Created",ts:r,tone:"bg-info"},{label:"Processed",ts:i,tone:"bg-accent"},{label:o&&e.state==="failed"?"Failed":"Finished",ts:o,tone:e.state==="failed"?"bg-danger":"bg-success"}];return t.jsxs("div",{children:[t.jsx("h2",{className:"mb-3 text-[10px] font-semibold tracking-wider text-fg-subtle uppercase",children:"Timeline"}),t.jsxs("ol",{className:"relative flex items-start justify-between gap-2",children:[t.jsx("span",{className:"absolute top-[7px] right-4 left-4 -z-0 h-px bg-border","aria-hidden":!0}),f.map((p,v)=>t.jsxs("li",{className:F("relative z-[1] flex flex-1 flex-col",v===1?"items-center text-center":v===2?"items-end text-right":"items-start"),children:[t.jsx("span",{className:F("status-dot size-3.5 ring-4 ring-surface",p.ts?p.tone:"bg-surface-3",!p.ts&&e.state==="active"&&v===2&&"pulse bg-accent/50")}),t.jsx("span",{className:"mt-1.5 text-xs font-medium text-fg",children:p.label}),t.jsx("span",{className:"text-[11px] text-fg-muted",children:p.ts?t.jsx(Yt,{value:p.ts}):e.state==="active"&&v===2?"running…":e.state==="delayed"&&v===1&&e.delayedUntil?t.jsxs(t.Fragment,{children:["runs ",t.jsx(Yt,{value:e.delayedUntil})]}):"–"}),p.ts&&t.jsx("span",{className:"font-mono text-[10px] text-fg-subtle",children:Uf(p.ts)}),!p.ts&&e.state==="delayed"&&v===1&&e.delayedUntil&&t.jsx("span",{className:"font-mono text-[10px] text-fg-subtle",children:Uf(e.delayedUntil)})]},p.label))]}),t.jsxs("div",{className:"mt-4 flex flex-wrap gap-4 border-t border-border pt-3 text-xs",children:[t.jsxs("span",{children:[t.jsx("span",{className:"text-fg-subtle",children:"Wait "}),t.jsx("span",{className:"num text-fg",children:c!=null?An(c):"–"})]}),t.jsxs("span",{children:[t.jsx("span",{className:"text-fg-subtle",children:"Run "}),t.jsx("span",{className:F("num text-fg",e.state==="active"&&"text-accent"),children:h!=null?An(h):"–"})]}),t.jsxs("span",{children:[t.jsx("span",{className:"text-fg-subtle",children:"Total "}),t.jsx("span",{className:"num text-fg",children:o?An(o-r):"–"})]}),t.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-fg-subtle",children:[t.jsx("span",{className:F("status-dot",((g=QS[e.state])==null?void 0:g.dot)??"bg-fg-subtle")})," ",e.state]})]})]})}function rf({value:e,empty:n}){const[r,i]=w.useState(!1),o=w.useMemo(()=>Du(e),[e]),c=e==null||typeof e=="object"&&Object.keys(e).length===0;return t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex h-8 items-center justify-between border-b border-border bg-surface-2/60 pr-1 pl-3",children:[t.jsxs("div",{className:"flex items-center gap-1 text-[11px]",children:[t.jsx("button",{type:"button",className:F("rounded px-1.5 py-0.5",r?"text-fg-subtle hover:text-fg":"bg-surface-3 text-fg"),onClick:()=>i(!1),children:"Tree"}),t.jsx("button",{type:"button",className:F("rounded px-1.5 py-0.5",r?"bg-surface-3 text-fg":"text-fg-subtle hover:text-fg"),onClick:()=>i(!0),children:"Raw"})]}),t.jsx(_o,{value:o,size:"icon-xs"})]}),t.jsx("div",{className:"max-h-[60vh] overflow-auto p-3",children:c?t.jsx("p",{className:"text-xs text-fg-subtle",children:n}):r?t.jsx("pre",{className:"font-mono text-xs leading-relaxed whitespace-pre-wrap break-all",children:o}):t.jsx(xj,{value:e,defaultExpandDepth:3})})]})}function D_({job:e}){var n;return!e.failedReason&&(!e.stacktrace||e.stacktrace.length===0)?t.jsx("div",{className:"card p-6 text-center text-xs text-fg-subtle",children:"No error recorded for this job"}):t.jsxs("div",{className:"space-y-3",children:[e.failedReason&&t.jsx("div",{className:"rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-[13px] break-words text-danger",children:e.failedReason}),(n=e.stacktrace)==null?void 0:n.map((r,i)=>t.jsx(Qm,{code:r,header:`Stacktrace · attempt ${i+1} of ${e.stacktrace.length}`,wrap:!0,maxHeight:360},i))]})}function U_({connectionId:e,queue:n,jobId:r,initial:i,total:o}){var p,v;const[c,d]=w.useState(!1),h=m2(e,n,r,c?{}:{start:0,end:199},!0),f=((p=h.data)==null?void 0:p.logs)??i??[],g=((v=h.data)==null?void 0:v.count)??o??f.length;return f.length===0?t.jsx("div",{className:"card p-6 text-center text-xs text-fg-subtle",children:"No logs. Use job.log() in your processor to emit lines here."}):t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex h-8 items-center justify-between border-b border-border bg-surface-2/60 pr-1 pl-3 text-[11px] text-fg-subtle",children:[t.jsxs("span",{children:[K(f.length)," of ",K(g)," lines"]}),t.jsxs("div",{className:"flex items-center gap-1",children:[!c&&f.length<g&&t.jsx(V,{size:"xs",variant:"ghost",onClick:()=>d(!0),children:"Load all"}),t.jsx(_o,{value:f.join(`
551
+ `),size:"icon-xs"})]})]}),t.jsx("ol",{className:"max-h-[60vh] overflow-auto p-2 font-mono text-xs leading-relaxed",children:f.map((j,S)=>t.jsxs("li",{className:"flex gap-3 hover:bg-surface-2/50",children:[t.jsx("span",{className:"num w-10 shrink-0 select-none text-right text-fg-subtle",children:S+1}),t.jsx("span",{className:"whitespace-pre-wrap break-all",children:j})]},S))})]})}function Q_({connectionId:e,queue:n,jobId:r}){var c;const i=U2(e,n,r),o=((c=i.data)==null?void 0:c.entries)??[];return i.isLoading?t.jsx("div",{className:"card p-6 text-center text-xs text-fg-subtle",children:"Loading history…"}):i.isError?t.jsx("div",{className:"card p-6 text-center text-xs text-fg-subtle",children:"Could not read the audit log."}):o.length===0?t.jsx("div",{className:"card p-6 text-center text-xs text-fg-subtle",children:"Nobody has acted on this job through the dashboard. Worker activity is not audited — only what people do here."}):t.jsxs("div",{className:"card divide-y divide-border",children:[o.map(d=>t.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-2.5 text-xs",children:[t.jsx(Yt,{value:d.createdAt,className:"w-24 shrink-0 text-fg-muted"}),t.jsx("span",{className:"font-medium text-fg",children:d.actorName??d.actorEmail??"anonymous"}),t.jsx("span",{className:"text-fg-muted",children:vm[d.action]}),d.result==="error"&&t.jsx(be,{variant:"danger",size:"xs",title:d.errorMessage??void 0,children:"refused"}),d.ip&&t.jsx("span",{className:"num ml-auto text-[11px] text-fg-subtle",children:d.ip})]},d.id)),t.jsx("div",{className:"px-4 py-2",children:t.jsxs(Ee,{to:ue.audit({connectionId:e,queueName:n}),className:"inline-flex items-center gap-1.5 text-xs text-accent hover:underline",children:[t.jsx(Bo,{className:"size-3.5","aria-hidden":!0})," Full audit log for this queue"]})})]})}const yj={waiting:"info",limited:"violet",maxed:"danger",paused:"warning"},jj={waiting:"In rotation: the next worker fetch may take a job from this group.",limited:"Hit its rate limit. Pro parks the group until the window resets.",maxed:"Every concurrency slot of the group is busy. Frees up when one of its jobs finishes.",paused:"Paused with queue.pauseGroup(). Jobs keep arriving, none are processed."},qv="No per-group override in Redis. The worker's own group option applies (a worker option, not stored in Redis).";function B_(){var v,j,S;const{connectionId:e="",queue:n=""}=Fn(),r=un(),[i,o]=w.useState(1),[c,d]=w.useState(50),h=R0(e,n),f=td(e,n,{page:i,pageSize:c}),g=ol(1e3),p=6;return t.jsxs(bt,{wide:!0,children:[t.jsx(gs,{title:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ee,{to:ue.queue(e,n),className:"text-fg-muted hover:text-fg",children:n}),t.jsx("span",{className:"text-fg-subtle",children:"/"}),"Groups",t.jsx(be,{variant:"pro",children:"BullMQ Pro"})]}),description:`Groups partition a queue for fairness, with their own concurrency and rate limit. ${h.data?`${K(h.data.groupsCount)} groups with jobs waiting or running.`:""} A group whose jobs are all delayed is not listed until one becomes due: Pro keeps delayed jobs in the queue's delayed state, not under the group. Filter the queue's Delayed tab by group to see them.`}),f.data&&t.jsx(H_,{byStatus:f.data.byStatus,total:f.data.total}),f.data&&!f.data.bullmqProApi&&t.jsx(bj,{}),t.jsxs("div",{className:"card overflow-hidden",children:[t.jsxs(ms,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{children:"Group"}),t.jsx(pe,{children:"Status"}),t.jsx(pe,{align:"right",children:"Waiting"}),t.jsx(pe,{align:"right",children:"Active / concurrency"}),t.jsx(pe,{align:"right",children:"Rate limit"}),t.jsx(pe,{align:"right",children:"Next"})]})}),t.jsxs("tbody",{children:[f.isLoading&&t.jsx(yt,{colSpan:p,children:t.jsx(Kt,{label:"Loading groups…"})}),f.isError&&!f.data&&t.jsx(yt,{colSpan:p,className:"text-danger",children:ve(f.error)}),f.data&&f.data.groups.length===0&&t.jsx(yt,{colSpan:p,children:"No groups with jobs right now. Add jobs with opts.group.id to see them here."}),(v=f.data)==null?void 0:v.groups.map(y=>t.jsx(K_,{g:y,now:g,onOpen:()=>r(ue.group(e,n,y.id)),href:ue.group(e,n,y.id)},y.id))]})]}),t.jsx("div",{className:"border-t border-border px-3 py-2",children:t.jsx(ld,{page:i,pageSize:c,total:((j=f.data)==null?void 0:j.total)??0,count:(S=f.data)==null?void 0:S.groups.length,onPage:o,onPageSize:y=>(d(y),o(1))})})]})]})}const V_="https://github.com/madmorett/bullpane/blob/main/docs/BULLMQ-PRO.md";function bj(){return t.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border bg-surface-2/50 px-3 py-2 text-xs text-fg-muted",role:"note",children:[t.jsx(Ha,{className:"mt-0.5 size-3.5 shrink-0 text-pro","aria-hidden":!0}),t.jsxs("span",{children:["Pausing, resuming and draining a group, and promoting, retrying or removing a grouped job, need BullMQ Pro's own package installed next to Bullpane: core bullmq would run those jobs outside their group."," ",t.jsx("a",{href:V_,target:"_blank",rel:"noreferrer",className:"text-accent hover:underline",children:"How to install it"})]})]})}function H_({byStatus:e,total:n}){return t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[Ck.map(r=>t.jsx(Pe,{content:jj[r],side:"bottom",children:t.jsxs("span",{className:F("inline-flex cursor-help items-center gap-1.5 rounded-md border border-border px-2 py-1",e[r]===0&&"opacity-60"),children:[t.jsx(be,{variant:yj[r],dot:!0,size:"xs",children:r}),t.jsx("span",{className:"num font-medium",children:K(e[r])})]})},r)),t.jsxs("span",{className:"text-fg-subtle",children:[K(n)," ",n===1?"group":"groups"," with jobs"]})]})}function K_({g:e,now:n,onOpen:r,href:i}){const o=e.concurrency!==null,c=o?Math.min(100,Math.round(e.active/Math.max(1,e.concurrency??1)*100)):0;return t.jsxs(cl,{onActivate:r,children:[t.jsx(xe,{mono:!0,children:t.jsx(Ee,{to:i,className:"text-accent hover:underline",children:e.id})}),t.jsx(xe,{className:"whitespace-nowrap",children:t.jsx(be,{variant:yj[e.status],dot:!0,size:"xs",title:jj[e.status],children:e.status})}),t.jsxs(xe,{num:!0,align:"right",children:[K(e.waiting),e.prioritized>0&&t.jsx(Pe,{content:"Jobs added with opts.priority. Pro serves the group's plain list first, then these.",side:"bottom",children:t.jsxs("span",{className:"ml-1.5 cursor-help text-[10px] text-fg-subtle",children:["+",K(e.prioritized)," prioritized"]})})]}),t.jsx(xe,{num:!0,align:"right",children:t.jsxs("span",{className:"inline-flex items-center justify-end gap-2",children:[o&&t.jsx("span",{className:"h-1.5 w-14 overflow-hidden rounded-full bg-surface-2","aria-hidden":!0,children:t.jsx("span",{className:F("block h-full rounded-full",c>=100?"bg-danger":"bg-accent"),style:{width:`${c}%`}})}),t.jsxs("span",{children:[K(e.active),t.jsx("span",{className:"text-fg-subtle",children:" / "}),o?t.jsx(Pe,{content:"Per-group override set with queue.setGroupConcurrency().",side:"bottom",children:t.jsx("span",{className:"cursor-help",children:K(e.concurrency)})}):t.jsx(Pe,{content:qv,side:"bottom",children:t.jsx("span",{className:"cursor-help text-fg-subtle",children:"worker default"})})]})]})}),t.jsx(xe,{num:!0,align:"right",children:e.rateLimit?t.jsx(Pe,{content:"Per-group override set with queue.setGroupRateLimit(): max jobs per window.",side:"bottom",children:t.jsxs("span",{className:"cursor-help",children:[K(e.rateLimit.max),t.jsx("span",{className:"text-fg-subtle",children:" / "}),An(e.rateLimit.durationMs)]})}):t.jsx(Pe,{content:qv,side:"bottom",children:t.jsx("span",{className:"cursor-help text-fg-subtle",children:"worker default"})})}),t.jsx(xe,{num:!0,align:"right",muted:!0,children:t.jsx(W_,{g:e,now:n})})]})}function W_({g:e,now:n}){if(e.status==="limited"&&e.limitedUntil!==null){const r=e.limitedUntil-n;return t.jsx("span",{title:new Date(e.limitedUntil).toLocaleTimeString(),children:r>0?`resumes in ${An(r)}`:"resuming…"})}return e.status==="maxed"&&e.since!==null?t.jsxs("span",{title:new Date(e.since).toLocaleTimeString(),children:["at cap for ",An(n-e.since)]}):e.status==="paused"&&e.since!==null?t.jsxs("span",{title:new Date(e.since).toLocaleTimeString(),children:["paused for ",An(n-e.since)]}):e.status==="waiting"?t.jsx("span",{children:"in rotation"}):t.jsx("span",{children:"–"})}function Z_(){var H,q,B,de,ce;const{connectionId:e="",queue:n="",groupId:r=""}=Fn(),{isOperator:i}=mt(),[o,c]=w.useState(1),[d,h]=w.useState(25),f=$0(e,n,r,{page:o,pageSize:d}),g=jm(e,n),{isAdmin:p}=mt(),v=((H=td(e,n,{page:1,pageSize:1}).data)==null?void 0:H.bullmqProApi)??!1,j=q0(e,n),[S,y]=sl(),[b,k]=w.useState(S.get("confirm")==="drain"),C=Ne=>j.mutate({groupId:r,action:Ne},{onSuccess:()=>X.success(`Group ${r} ${Ne==="pause"?"paused":Ne==="resume"?"resumed":"drained"}`),onError:Ie=>X.error(ve(Ie)),onSettled:()=>{Ne==="drain"&&(k(!1),S.has("confirm")&&y(Ie=>(Ie.delete("confirm"),Ie),{replace:!0}))}}),z=v?void 0:"Needs BullMQ Pro's package installed next to Bullpane",[O,T]=w.useState(!1),[M,E]=w.useState(null),I=(Ne,Ie)=>g.mutate({jobId:Ne,action:Ie},{onSuccess:()=>X.success(`Job ${Ne} ${Ie==="remove"?"removed":Ie}`),onError:ot=>X.error(ve(ot))}),Q=(Ne,Ie)=>Ie==="remove"?E(Ne):I(Ne,Ie);return t.jsxs(bt,{wide:!0,children:[t.jsx(gs,{title:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsxs(Ee,{to:ue.groups(e,n),className:"inline-flex items-center gap-1 text-fg-muted hover:text-fg",children:[t.jsx(Su,{className:"size-4"})," Groups"]}),t.jsx("span",{className:"text-fg-subtle",children:"/"}),t.jsx(Do,{className:"size-4 text-pro","aria-hidden":!0}),t.jsx("span",{className:"font-mono",children:r})]}),description:`Jobs waiting in group ${r} of ${n}, in the order Pro will serve them: the group's list first, then its prioritized jobs.`,actions:i&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(V,{size:"sm",variant:"secondary",leftIcon:t.jsx(Gr,{}),disabled:!v||j.isPending,title:z,onClick:()=>C("pause"),children:"Pause group"}),t.jsx(V,{size:"sm",variant:"secondary",leftIcon:t.jsx(Qo,{}),disabled:!v||j.isPending,title:z,onClick:()=>C("resume"),children:"Resume group"}),t.jsx(V,{size:"sm",variant:"secondary",leftIcon:t.jsx(um,{}),disabled:!v,title:z,onClick:()=>T(!0),children:"Promote all delayed"}),p&&t.jsx(V,{size:"sm",variant:"danger",leftIcon:t.jsx(Un,{}),disabled:!v||j.isPending,title:z,onClick:()=>k(!0),children:"Drain group"})]})}),t.jsxs("p",{className:"mb-3 text-xs text-fg-muted",children:["Pro keeps the group's delayed, failed and completed jobs in the queue's own states, not here:"," ",["delayed","failed","completed"].map((Ne,Ie)=>t.jsxs("span",{children:[Ie>0&&" · ",t.jsx(Ee,{to:ue.queueGroup(e,n,r,Ne),className:"text-accent hover:underline",children:Ne})]},Ne))]}),f.data&&!v&&t.jsx(bj,{}),t.jsxs("div",{className:"card overflow-hidden",children:[t.jsx(Kf,{connectionId:e,queue:n,jobs:(q=f.data)==null?void 0:q.jobs,loading:f.isLoading,error:f.error,canOperate:i,onAction:Q,pendingId:g.isPending?(B=g.variables)==null?void 0:B.jobId:null,emptyText:"No jobs waiting in this group"}),t.jsx("div",{className:"border-t border-border px-3 py-2",children:t.jsx(ld,{page:o,pageSize:d,total:((de=f.data)==null?void 0:de.total)??0,count:(ce=f.data)==null?void 0:ce.jobs.length,onPage:c,onPageSize:Ne=>(h(Ne),c(1))})})]}),t.jsx(Bm,{open:O,onClose:()=>T(!1),connectionId:e,queue:n,match:{groupId:r}}),t.jsx(Ht,{open:b&&v&&p,onClose:()=>k(!1),title:"Drain group",description:`Remove every waiting job of group ${r} in ${n} (BullMQ Pro's deleteGroup)? Its delayed jobs stay in the queue's delayed state. This cannot be undone.`,confirmText:"Drain group",danger:!0,loading:j.isPending,onConfirm:()=>C("drain")}),t.jsx(Ht,{open:M!==null,onClose:()=>E(null),title:"Remove job",description:`Remove job ${M??""} from ${n}? This cannot be undone.`,confirmText:"Remove",danger:!0,loading:g.isPending,onConfirm:()=>{M&&I(M,"remove"),E(null)}})]})}function wj({open:e,onClose:n,initial:r,onSave:i,saving:o,title:c="Assign queues",description:d="Pick queues from any connection. A queue can live in several folders."}){const{byConnection:h,isLoading:f}=ll(),[g,p]=w.useState(""),[v,j]=w.useState(new Set),S=k=>`${k.connectionId} ${k.queueName}`;w.useEffect(()=>{e&&j(new Set(r.map(S)))},[e,r]);const y=k=>j(C=>{const z=new Set(C),O=S(k);return z.has(O)?z.delete(O):z.add(O),z}),b=g.trim().toLowerCase();return t.jsxs(bn,{open:e,onClose:n,size:"md",title:c,description:d,footer:t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"mr-auto text-xs text-fg-muted",children:[v.size," selected"]}),t.jsx(V,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsx(V,{variant:"primary",size:"sm",loading:o,onClick:()=>i([...v].map(k=>{const[C,z]=k.split(" ");return{connectionId:C,queueName:z}})),children:"Save"})]}),children:[t.jsx(Te,{leftIcon:t.jsx(Yn,{}),placeholder:"Filter queues…",value:g,onChange:k=>p(k.target.value),autoFocus:!0,"aria-label":"Filter queues"}),t.jsxs("div",{className:"mt-3 max-h-[50vh] space-y-3 overflow-y-auto",children:[f&&t.jsx(il,{}),h.map(({connection:k,queues:C})=>{const z=C.filter(O=>!b||O.name.toLowerCase().includes(b)).sort((O,T)=>O.name.localeCompare(T.name));return z.length===0?null:t.jsxs("div",{children:[t.jsxs("div",{className:"mb-1 flex items-center justify-between text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:[k.name,t.jsx("button",{type:"button",className:"font-normal tracking-normal normal-case hover:text-fg",onClick:()=>j(O=>{const T=new Set(O),M=z.every(E=>T.has(S({connectionId:k.id,queueName:E.name})));return z.forEach(E=>M?T.delete(S({connectionId:k.id,queueName:E.name})):T.add(S({connectionId:k.id,queueName:E.name}))),T}),children:"toggle all"})]}),t.jsx("div",{className:"grid gap-1 sm:grid-cols-2",children:z.map(O=>{const T={connectionId:k.id,queueName:O.name};return t.jsx(Pm,{label:O.name,checked:v.has(S(T)),onChange:()=>y(T),className:"rounded px-1.5 py-1 hover:bg-surface-2"},O.name)})})]},k.id)})]})]})}const Qu=["#5b8def","#3fb950","#d29922","#f85149","#a371f7","#39c5bb","#f778ba","#9aa3ad"];function G_(){const{has:e}=wt();return e("folders")?t.jsx(J_,{}):t.jsx(Wa,{feature:"folders"})}function J_(){const{isOperator:e}=mt(),n=Jr(),[r,i]=w.useState(null),[o,c]=w.useState(null),d=n.data??[],h=w.useMemo(()=>d.filter(p=>!p.parentId).sort((p,v)=>p.position-v.position||p.name.localeCompare(v.name)),[d]),f=p=>d.filter(v=>v.parentId===p).sort((v,j)=>v.position-j.position||v.name.localeCompare(j.name)),g=d.find(p=>p.id===r)??null;return w.useEffect(()=>{!r&&h[0]&&i(h[0].id)},[h,r]),n.isLoading?t.jsx(bt,{children:t.jsx(il,{})}):t.jsxs(bt,{children:[t.jsx(gs,{title:"Folders",description:"Group queues from any connection into folders. Nested one level. The sidebar mirrors this tree.",actions:e&&t.jsx(V,{variant:"primary",size:"sm",leftIcon:t.jsx(Bg,{}),onClick:()=>c({parentId:null}),children:"New folder"})}),d.length===0?t.jsx(cn,{icon:t.jsx(sr,{}),title:"No folders yet",description:"Without folders the sidebar shows one implicit folder per connection. Create a folder to organise queues by team, product or environment.",action:e&&t.jsx(V,{variant:"primary",leftIcon:t.jsx(Bg,{}),onClick:()=>c({parentId:null}),children:"Create the first folder"})}):t.jsxs("div",{className:"grid gap-4 lg:grid-cols-[280px_1fr]",children:[t.jsx("div",{className:"card p-1.5",children:h.map(p=>t.jsxs("div",{children:[t.jsx($v,{folder:p,selected:r===p.id,onSelect:()=>i(p.id),onAddChild:e?()=>c({parentId:p.id}):void 0}),f(p.id).map(v=>t.jsx($v,{folder:v,depth:1,selected:r===v.id,onSelect:()=>i(v.id)},v.id))]},p.id))}),t.jsx("div",{children:g?t.jsx(X_,{folder:g,allFolders:d,canEdit:e,onDeleted:()=>i(null)},g.id):t.jsx(cn,{compact:!0,title:"Select a folder"})})]}),t.jsx(Y_,{open:!!o,parentId:(o==null?void 0:o.parentId)??null,roots:h,onClose:()=>c(null),onCreated:p=>i(p.id)})]})}function $v({folder:e,depth:n=0,selected:r,onSelect:i,onAddChild:o}){return t.jsxs("div",{className:F("group flex h-8 items-center gap-2 rounded-md pr-1 text-[13px]",r?"bg-surface-3 text-fg":"text-fg-muted hover:bg-surface-2 hover:text-fg"),style:{paddingLeft:8+n*16},children:[t.jsxs("button",{type:"button",onClick:i,className:"flex min-w-0 flex-1 items-center gap-2 text-left","aria-current":r||void 0,children:[t.jsx(sr,{className:"size-4 shrink-0",style:{color:e.color??"var(--fg-subtle)"},"aria-hidden":!0}),t.jsx("span",{className:"truncate",children:e.name}),t.jsx("span",{className:"num ml-auto text-[10px] text-fg-subtle",children:e.queues.length})]}),o&&t.jsx(V,{size:"icon-xs",variant:"ghost",className:"opacity-0 group-hover:opacity-100 focus-visible:opacity-100",title:"Add subfolder","aria-label":"Add subfolder",onClick:o,children:t.jsx(es,{})})]})}function X_({folder:e,allFolders:n,canEdit:r,onDeleted:i}){var T;const o=O0(),c=R2(),d=A0(),{byConnection:h}=ll(),[f,g]=w.useState(!1),[p,v]=w.useState(e.name),[j,S]=w.useState(!1),[y,b]=w.useState(!1),k=n.filter(M=>M.parentId===e.id),C=()=>{const M=p.trim();if(!M||M===e.name){g(!1),v(e.name);return}o.mutate({id:e.id,input:{name:M}},{onSuccess:()=>g(!1),onError:E=>X.error(ve(E))})},z=M=>d.mutate({id:e.id,input:{queues:e.queues.filter(E=>!(E.connectionId===M.connectionId&&E.queueName===M.queueName))}},{onError:E=>X.error(ve(E))}),O=M=>{var E;return((E=h.find(I=>I.connection.id===M))==null?void 0:E.connection.name)??M};return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"card p-4",children:[t.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[t.jsx(sr,{className:"mt-1 size-6",style:{color:e.color??"var(--fg-subtle)"},"aria-hidden":!0}),t.jsxs("div",{className:"min-w-0 flex-1",children:[f?t.jsxs("form",{className:"flex items-center gap-2",onSubmit:M=>{M.preventDefault(),C()},children:[t.jsx(Te,{autoFocus:!0,value:p,onChange:M=>v(M.target.value),className:"!h-8 max-w-xs","aria-label":"Folder name",onKeyDown:M=>M.key==="Escape"&&(g(!1),v(e.name))}),t.jsx(V,{size:"icon-sm",type:"submit",variant:"primary","aria-label":"Save",loading:o.isPending,children:t.jsx(Zr,{})}),t.jsx(V,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:()=>(g(!1),v(e.name)),children:t.jsx(vn,{})})]}):t.jsxs("h2",{className:"flex items-center gap-2 text-base font-semibold",children:[e.name,r&&t.jsx(V,{size:"icon-xs",variant:"ghost","aria-label":"Rename",onClick:()=>g(!0),children:t.jsx(Uo,{})})]}),t.jsxs("p",{className:"text-xs text-fg-muted",children:[e.parentId?`Subfolder of ${((T=n.find(M=>M.id===e.parentId))==null?void 0:T.name)??"?"}`:"Top-level folder"," · ",e.queues.length," queues",k.length>0&&` · ${k.length} subfolders`]})]}),t.jsxs(Ee,{to:ue.folder(e.id),className:"inline-flex h-7 items-center gap-1.5 rounded-md border border-border px-2.5 text-xs font-medium text-fg hover:bg-surface-2",title:"Open this folder's dashboard",children:["Open folder",t.jsx(uN,{className:"size-3.5","aria-hidden":!0})]}),r&&t.jsx(V,{size:"sm",variant:"ghost",className:"hover:text-danger",leftIcon:t.jsx(Un,{}),onClick:()=>b(!0),children:"Delete"})]}),r&&t.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-4",children:[t.jsxs("div",{children:[t.jsx("span",{className:"mb-1 block text-[10px] tracking-wide text-fg-subtle uppercase",children:"Colour"}),t.jsxs("div",{className:"flex gap-1.5",role:"radiogroup","aria-label":"Folder colour",children:[Qu.map(M=>t.jsx("button",{type:"button",role:"radio","aria-checked":e.color===M,"aria-label":M,className:F("size-5 rounded-full ring-offset-2 ring-offset-surface transition-shadow",e.color===M&&"ring-2 ring-fg"),style:{background:M},onClick:()=>o.mutate({id:e.id,input:{color:M}},{onError:E=>X.error(ve(E))})},M)),t.jsx("button",{type:"button",role:"radio","aria-checked":!e.color,"aria-label":"No colour",className:F("size-5 rounded-full border border-dashed border-border-strong ring-offset-2 ring-offset-surface",!e.color&&"ring-2 ring-fg"),onClick:()=>o.mutate({id:e.id,input:{color:null}},{onError:M=>X.error(ve(M))})})]})]}),!k.length&&t.jsx(dt,{label:"Parent",className:"!h-8 w-56",value:e.parentId??"",onChange:M=>o.mutate({id:e.id,input:{parentId:M.target.value||null}},{onError:E=>X.error(ve(E))}),options:[{value:"",label:"None (top level)"},...n.filter(M=>!M.parentId&&M.id!==e.id).map(M=>({value:M.id,label:M.name}))]})]})]}),t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-2.5",children:[t.jsx("h3",{className:"text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"Queues"}),r&&t.jsx(V,{size:"sm",leftIcon:t.jsx(es,{}),onClick:()=>S(!0),children:"Assign queues"})]}),e.queues.length===0?t.jsx("p",{className:"px-4 py-8 text-center text-xs text-fg-subtle",children:"No queues assigned yet."}):t.jsx("ul",{className:"divide-y divide-border",children:e.queues.map(M=>t.jsxs("li",{className:"flex items-center gap-3 px-4 py-2 text-[13px]",children:[t.jsx(Ee,{to:ue.queue(M.connectionId,M.queueName),className:"font-medium hover:underline",children:M.queueName}),t.jsx(be,{variant:"outline",size:"xs",children:O(M.connectionId)}),r&&t.jsx(V,{size:"icon-xs",variant:"ghost",className:"ml-auto hover:text-danger","aria-label":"Remove from folder",onClick:()=>z(M),children:t.jsx(vn,{})})]},`${M.connectionId}/${M.queueName}`))})]}),t.jsx(wj,{open:j,onClose:()=>S(!1),initial:e.queues,onSave:M=>d.mutate({id:e.id,input:{queues:M}},{onSuccess:()=>(S(!1),X.success("Folder updated")),onError:E=>X.error(ve(E))}),saving:d.isPending}),t.jsx(Ht,{open:y,onClose:()=>b(!1),title:`Delete "${e.name}"`,description:k.length>0?"Subfolders move up to the top level. Queues themselves are untouched.":"Queues themselves are untouched.",confirmText:"Delete folder",danger:!0,loading:c.isPending,onConfirm:()=>c.mutate(e.id,{onSuccess:()=>(b(!1),i(),X.success("Folder deleted")),onError:M=>X.error(ve(M))})})]})}function Y_({open:e,parentId:n,roots:r,onClose:i,onCreated:o}){const c=E2(),[d,h]=w.useState(""),[f,g]=w.useState(Qu[0]),[p,v]=w.useState(n??""),[j,S]=w.useState(null);w.useEffect(()=>v(n??""),[n,e]);const y=()=>{var k;const b=v0.safeParse({name:d.trim(),color:f,parentId:p||null});if(!b.success){S(((k=b.error.issues[0])==null?void 0:k.message)??"Invalid");return}c.mutate(b.data,{onSuccess:C=>{X.success(`Folder "${C.name}" created`),o(C),i()},onError:C=>X.error(ve(C))})};return t.jsx(bn,{open:e,onClose:i,size:"sm",title:"New folder",footer:t.jsxs(t.Fragment,{children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:i,children:"Cancel"}),t.jsx(V,{variant:"primary",size:"sm",onClick:y,loading:c.isPending,children:"Create"})]}),children:t.jsxs("form",{className:"space-y-3",onSubmit:b=>{b.preventDefault(),y()},children:[t.jsx(Te,{label:"Name",autoFocus:!0,value:d,onChange:b=>h(b.target.value),error:j}),t.jsxs("div",{children:[t.jsx("span",{className:"mb-1 block text-xs font-medium text-fg-muted",children:"Colour"}),t.jsx("div",{className:"flex gap-1.5",role:"radiogroup","aria-label":"Folder colour",children:Qu.map(b=>t.jsx("button",{type:"button",role:"radio","aria-checked":f===b,"aria-label":b,className:F("size-5 rounded-full ring-offset-2 ring-offset-surface",f===b&&"ring-2 ring-fg"),style:{background:b},onClick:()=>g(b)},b))})]}),t.jsx(dt,{label:"Parent folder",value:p,onChange:b=>v(b.target.value),options:[{value:"",label:"None (top level)"},...r.map(b=>({value:b.id,label:b.name}))],hint:"Folders nest one level deep."})]})})}const e3=["waiting","active","completed","failed","delayed"];function t3(e){var f,g,p,v;const n={waiting:0,active:0,completed:0,failed:0,delayed:0,prioritized:0,paused:0,"waiting-children":0};let r=0,i=0,o=0,c=null;const d=[];for(const{queue:j}of e){for(const S of Object.keys(n))n[S]+=j.counts[S]??0;r+=((f=j.rates)==null?void 0:f.completed)??0,i+=((g=j.rates)==null?void 0:g.failed)??0,(p=j.rates)!=null&&p.windowMinutes&&(c=j.rates.windowMinutes),j.metrics&&j.metrics.completed.length>0&&(o+=1),(v=j.rates)!=null&&v.retentionSkewed&&d.push(j.name)}const h=r+i;return{counts:n,completed:r,failed:i,successPct:h>0?r/h*100:null,completedSeries:Nv(e.map(j=>{var S;return(S=j.queue.metrics)==null?void 0:S.completed})),failedSeries:Nv(e.map(j=>{var S;return(S=j.queue.metrics)==null?void 0:S.failed})),withMetrics:o,windowMinutes:c,skewedQueues:d}}function n3({entries:e,className:n}){const r=w.useMemo(()=>t3(e),[e]),i=r.windowMinutes?r.windowMinutes%60===0?`${r.windowMinutes/60}h`:`${r.windowMinutes}m`:"1h",o=r.completedSeries.length>1,c=r.skewedQueues.length>0,d=c?`${r.skewedQueues.length===1?`Queue "${r.skewedQueues[0]}"`:`${r.skewedQueues.length} queues (${r.skewedQueues.slice(0,3).join(", ")}${r.skewedQueues.length>3?", …":""})`} feed this total. ${Tm}`:"";return t.jsxs("div",{className:F("grid gap-2 sm:grid-cols-3 xl:grid-cols-7",n),children:[e3.map(h=>{const f=lt[h],g=r.counts[h];return t.jsxs("div",{className:"card px-3 py-2.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-medium tracking-wider text-fg-subtle uppercase",children:[t.jsx("span",{className:F("status-dot size-1.5",f.dotClass),"aria-hidden":!0}),f.label]}),t.jsx("div",{className:F("num text-2xl leading-tight font-semibold",g>0?f.textClass:"text-fg-muted"),children:ft(g)})]},h)}),t.jsxs("div",{className:"card px-3 py-2.5",children:[t.jsxs("div",{className:"flex items-center gap-1 text-[10px] font-medium tracking-wider text-fg-subtle uppercase",children:["Success · ",i,c&&t.jsx(Pe,{content:d,className:"ml-auto",children:t.jsx(ts,{className:"size-3 text-warning","aria-label":"This total is unreliable: some queues prune completed jobs"})})]}),t.jsx(Pe,{content:`${K(r.completed)} completed · ${K(r.failed)} failed across ${e.length} ${e.length===1?"queue":"queues"}${c?`
552
+
553
+ ${d}`:""}`,children:t.jsx("div",{className:F("num text-2xl leading-tight font-semibold",c&&"opacity-50",r.successPct==null?"text-fg-subtle":r.successPct<90?"text-state-failed":"text-state-completed"),children:r.successPct==null?"—":En(r.successPct)})}),t.jsx("div",{className:F("mt-1 flex h-1.5 w-full overflow-hidden rounded-full bg-surface-3",c&&"opacity-50"),role:"img","aria-label":r.successPct==null?"No finished jobs":`${En(r.successPct)} success${c?", unreliable: some queues prune completed jobs":""}`,children:r.successPct!=null&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"h-full",style:{width:`${r.successPct}%`,background:lt.completed.fg}}),t.jsx("span",{className:"h-full flex-1",style:{background:lt.failed.fg,opacity:r.successPct>=100?0:1}})]})})]}),t.jsxs("div",{className:"card flex flex-col px-3 py-2.5",children:[t.jsx("div",{className:"text-[10px] font-medium tracking-wider text-fg-subtle uppercase",children:"Completed / min"}),o?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mt-1 block",style:{color:lt.completed.fg},children:t.jsx(tl,{values:r.completedSeries,width:140,height:30,title:"Combined completed per minute",className:"w-full"})}),t.jsxs("span",{className:"mt-auto text-[10px] text-fg-subtle",children:[K(r.withMetrics)," of ",K(e.length)," queues report metrics"]})]}):t.jsx("span",{className:"mt-2 text-[11px] leading-relaxed text-fg-subtle",children:"No queue in this folder collects metrics."})]})]})}function s3(e){let n="";for(const r of e)r==="*"?n+=".*":r==="?"?n+=".":n+=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^${n}$`,"i")}function r3(e,n){const r=e.trim();if(!r)return!1;try{return s3(r).test(n)}catch{return!1}}const mu="__any__";function a3({open:e,onClose:n,existing:r,onImport:i,saving:o}){const{byConnection:c}=ll(),[d,h]=w.useState(""),[f,g]=w.useState(mu),p=w.useMemo(()=>new Set(r.map(y=>`${y.connectionId} ${y.queueName}`)),[r]),v=w.useMemo(()=>{const y=d.trim();if(!y)return[];const b=[];for(const{connection:k,queues:C}of c)if(!(f!==mu&&k.id!==f))for(const z of C){if(!r3(y,z.name))continue;const O={connectionId:k.id,queueName:z.name};b.push({ref:O,connectionName:k.name,already:p.has(`${k.id} ${z.name}`)})}return b.sort((k,C)=>k.ref.queueName.localeCompare(C.ref.queueName))},[d,f,c,p]),j=v.filter(y=>!y.already),S=()=>{i([...r,...j.map(y=>y.ref)])};return t.jsx(bn,{open:e,onClose:n,size:"md",title:"Import matching queues",description:"Add every queue whose name matches a pattern, in one go.",footer:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mr-auto text-xs text-fg-muted",children:d.trim()===""?"Type a pattern to preview":`${K(j.length)} to add · ${K(v.length-j.length)} already in folder`}),t.jsx(V,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsxs(V,{variant:"primary",size:"sm",leftIcon:t.jsx(Rf,{}),loading:o,disabled:j.length===0,onClick:S,children:["Import ",j.length>0?K(j.length):""]})]}),children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"grid gap-3 sm:grid-cols-[1fr_200px]",children:[t.jsx(Te,{label:"Pattern",mono:!0,autoFocus:!0,placeholder:"channels*",value:d,onChange:y=>h(y.target.value),hint:"* matches any run of characters, ? matches exactly one. Case-insensitive."}),t.jsx(dt,{label:"Connection",value:f,onChange:y=>g(y.target.value),options:[{value:mu,label:"Any connection"},...c.map(y=>({value:y.connection.id,label:y.connection.name}))]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1.5 text-[11px] text-fg-subtle",children:[t.jsx("span",{children:"Examples:"}),["channels*","*-retry","email-?"].map(y=>t.jsx("button",{type:"button",onClick:()=>h(y),className:"rounded border border-border bg-surface-2 px-1.5 py-0.5 font-mono text-fg-muted hover:text-fg",children:y},y))]}),t.jsxs("div",{className:"rounded-md border border-border",children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-border bg-surface-2/50 px-3 py-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:["Preview",t.jsxs("span",{className:"num font-normal tracking-normal normal-case",children:[K(v.length)," matching"]})]}),t.jsx("div",{className:"max-h-64 overflow-y-auto",children:d.trim()===""?t.jsx("p",{className:"px-3 py-6 text-center text-xs text-fg-subtle",children:"Nothing to preview yet."}):v.length===0?t.jsxs("p",{className:"px-3 py-6 text-center text-xs text-fg-subtle",children:["No queue matches ",t.jsx("span",{className:"font-mono text-fg-muted",children:d.trim()}),f!==mu&&" on this connection","."]}):t.jsx("ul",{className:"divide-y divide-border",children:v.map(y=>t.jsxs("li",{className:"flex items-center gap-2 px-3 py-1.5 text-xs",children:[t.jsx("span",{className:"truncate font-mono text-fg",children:y.ref.queueName}),t.jsx(be,{variant:"outline",size:"xs",children:y.connectionName}),y.already&&t.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-fg-subtle",children:"already in folder"})]},`${y.ref.connectionId}/${y.ref.queueName}`))})})]}),t.jsxs("p",{className:"flex items-start gap-2 rounded-md border border-border bg-surface-2/50 px-3 py-2 text-[11px] leading-relaxed text-fg-muted",children:[t.jsx(Ha,{className:"mt-0.5 size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),t.jsxs("span",{children:["Imports the queues matching this pattern ",t.jsx("strong",{className:"text-fg",children:"now"}),". New queues that appear later are"," ",t.jsx("strong",{className:"text-fg",children:"not"})," added automatically — run the import again when they show up."]})]})]})})}function i3({open:e,onClose:n,folder:r,allFolders:i}){const o=O0(),[c,d]=w.useState(r.name),[h,f]=w.useState(r.color),[g,p]=w.useState(r.parentId??""),[v,j]=w.useState(null),S=i.some(k=>k.parentId===r.id),y=i.filter(k=>!k.parentId&&k.id!==r.id),b=()=>{var C;const k=Ek.safeParse({name:c.trim(),color:h,parentId:g||null});if(!k.success){j(((C=k.error.issues[0])==null?void 0:C.message)??"Invalid");return}o.mutate({id:r.id,input:k.data},{onSuccess:()=>{X.success("Folder updated"),n()},onError:z=>X.error(ve(z))})};return t.jsx(bn,{open:e,onClose:n,size:"sm",title:"Edit folder",footer:t.jsxs(t.Fragment,{children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsx(V,{variant:"primary",size:"sm",onClick:b,loading:o.isPending,children:"Save changes"})]}),children:t.jsxs("form",{className:"space-y-3",onSubmit:k=>{k.preventDefault(),b()},children:[t.jsx(Te,{label:"Name",autoFocus:!0,value:c,onChange:k=>d(k.target.value),error:v}),t.jsxs("div",{children:[t.jsx("span",{className:"mb-1 block text-xs font-medium text-fg-muted",children:"Colour"}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",role:"radiogroup","aria-label":"Folder colour",children:[Qu.map(k=>t.jsx("button",{type:"button",role:"radio","aria-checked":h===k,"aria-label":k,className:F("size-5 rounded-full ring-offset-2 ring-offset-surface transition-shadow",h===k&&"ring-2 ring-fg"),style:{background:k},onClick:()=>f(k)},k)),t.jsx("button",{type:"button",role:"radio","aria-checked":!h,"aria-label":"No colour",className:F("size-5 rounded-full border border-dashed border-border-strong ring-offset-2 ring-offset-surface",!h&&"ring-2 ring-fg"),onClick:()=>f(null)})]})]}),t.jsx(dt,{label:"Parent folder",value:g,disabled:S,onChange:k=>p(k.target.value),options:[{value:"",label:"None (top level)"},...y.map(k=>({value:k.id,label:k.name}))],hint:S?"This folder has subfolders, so it must stay top-level.":"Folders nest one level deep."})]})})}function l3(){const{has:e}=wt();return e("folders")?t.jsx(o3,{}):t.jsx(Wa,{feature:"folders"})}function o3(){const{folderId:e=""}=Fn(),{isOperator:n}=mt(),{has:r,gate:i}=wt(),o=Jr(),{byConnection:c,isLoading:d}=ll(),h=A0(),[f,g]=w.useState(null),{sort:p,setSort:v,filter:j,setFilter:S}=Mm(`folder.${e}`,Lm,Am),y=o.data??[],b=y.find(I=>I.id===e)??null,{entries:k,missing:C}=w.useMemo(()=>{const I=[],Q=[];for(const H of(b==null?void 0:b.queues)??[]){const q=c.find(de=>de.connection.id===H.connectionId),B=q==null?void 0:q.queues.find(de=>de.name===H.queueName);q&&B?I.push({connection:q.connection,queue:B}):Q.push(H)}return{entries:I,missing:Q}},[b,c]),z=w.useMemo(()=>k.filter(I=>Rm(I,j)),[k,j]),O=(I,Q,H=!0)=>{b&&h.mutate({id:b.id,input:{queues:I}},{onSuccess:()=>{X.success(Q),H&&g(null)},onError:q=>X.error(ve(q))})},T=I=>O(((b==null?void 0:b.queues)??[]).filter(Q=>!(Q.connectionId===I.connectionId&&Q.queueName===I.queueName)),`${I.queueName} removed from ${(b==null?void 0:b.name)??"folder"}`,!1);if(o.isLoading)return t.jsx(bt,{wide:!0,children:t.jsx(il,{})});if(!b)return t.jsx(bt,{wide:!0,children:t.jsx(cn,{icon:t.jsx(sr,{}),title:"Folder not found",description:"It may have been deleted.",action:t.jsx(Ee,{to:ue.folders,className:"text-accent hover:underline",children:"Back to folders"})})});const M=b.parentId?y.find(I=>I.id===b.parentId):null,E=b.queues.length===0;return t.jsxs(bt,{wide:!0,children:[t.jsxs("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"size-3 shrink-0 rounded-full ring-2 ring-inset ring-white/10",style:{background:b.color??"var(--fg-subtle)"},"aria-hidden":!0}),t.jsx("h1",{className:"truncate text-lg font-semibold tracking-tight",children:b.name})]}),t.jsxs("p",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 text-xs text-fg-muted",children:[M&&t.jsxs(t.Fragment,{children:[t.jsx(Ee,{to:`/folders/${encodeURIComponent(M.id)}`,className:"hover:underline",children:M.name}),t.jsx("span",{className:"text-fg-subtle",children:"/"})]}),t.jsxs("span",{className:"num",children:[K(b.queues.length)," ",b.queues.length===1?"queue":"queues"]}),C.length>0&&t.jsxs("span",{className:"text-state-waiting",title:C.map(I=>I.queueName).join(", "),children:["· ",K(C.length)," not found"]}),t.jsx("span",{className:"text-fg-subtle",children:"·"}),t.jsx(Ee,{to:ue.folders,className:"hover:underline",children:"Manage folders"})]})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n&&t.jsx(V,{size:"sm",variant:"secondary",leftIcon:t.jsx(Uo,{}),onClick:()=>g("edit"),children:"Edit"}),n&&t.jsx(V,{size:"sm",variant:"secondary",leftIcon:t.jsx(Rf,{}),onClick:()=>g("import"),title:"Import queues matching a pattern",children:"Import matching"}),n&&t.jsx(V,{size:"sm",variant:"primary",leftIcon:t.jsx(es,{}),onClick:()=>g("add"),children:"Add queue"}),t.jsx(V,{size:"sm",leftIcon:t.jsx(rl,{}),onClick:()=>i("alerts",()=>g("alert")),title:"Alert on every queue in this folder",children:"Create alert"})]})]}),t.jsx(n3,{entries:k,className:"mb-4"}),E?t.jsx("div",{className:"card",children:t.jsx(cn,{icon:t.jsx(sr,{}),title:"This folder is empty",description:"Add queues by hand, or import every queue whose name matches a pattern like channels* or *-retry.",action:n&&t.jsxs(t.Fragment,{children:[t.jsx(V,{variant:"primary",leftIcon:t.jsx(es,{}),onClick:()=>g("add"),children:"Add queue"}),t.jsx(V,{leftIcon:t.jsx(Rf,{}),onClick:()=>g("import"),children:"Import matching queues"})]})})}):t.jsxs("section",{className:"space-y-3","aria-label":"Queues in this folder",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("h2",{className:"text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"Queues"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Om,{value:j,onChange:S,"aria-label":"Filter queues in this folder"}),t.jsxs("span",{className:"num whitespace-nowrap text-xs text-fg-subtle",children:[z.length," of ",k.length]})]})]}),d&&k.length===0?t.jsx(zm,{}):z.length>0?t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(auto-fill, minmax(230px, 1fr))"},children:z.map(I=>t.jsx(c3,{entry:I,onRemove:n?()=>T({connectionId:I.connection.id,queueName:I.queue.name}):void 0,removing:h.isPending},Ia(I)))}):null,t.jsx("div",{className:"card overflow-hidden",children:t.jsx(Fm,{rows:z,showConnection:!0,sort:p,onSort:v,message:d&&k.length===0?"Loading queues…":j?"No queue matches the filter":"None of this folder's queues could be resolved on their connections."})}),C.length>0&&t.jsxs("div",{className:"card px-4 py-3",children:[t.jsx("h3",{className:"mb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:"Not found on their connection"}),t.jsx("ul",{className:"flex flex-wrap gap-2",children:C.map(I=>{var Q;return t.jsxs("li",{className:"flex items-center gap-1.5 rounded border border-border bg-surface-2 px-2 py-1 text-xs",children:[t.jsx("span",{className:"font-mono text-fg-muted line-through",children:I.queueName}),t.jsx(be,{variant:"outline",size:"xs",children:((Q=c.find(H=>H.connection.id===I.connectionId))==null?void 0:Q.connection.name)??I.connectionId}),n&&t.jsx(V,{size:"icon-xs",variant:"ghost",className:"hover:text-danger","aria-label":`Remove ${I.queueName}`,onClick:()=>T(I),children:t.jsx(vn,{})})]},`${I.connectionId}/${I.queueName}`)})}),t.jsx("p",{className:"mt-2 text-[11px] text-fg-subtle",children:"These queues are referenced by the folder but were not discovered on their connection — renamed, obliterated, or the connection is down."})]})]}),n&&f==="edit"&&t.jsx(i3,{open:!0,onClose:()=>g(null),folder:b,allFolders:y}),n&&t.jsx(wj,{open:f==="add",onClose:()=>g(null),initial:b.queues,saving:h.isPending,onSave:I=>O(I,"Folder updated"),title:`Add queues to ${b.name}`}),n&&t.jsx(a3,{open:f==="import",onClose:()=>g(null),existing:b.queues,saving:h.isPending,onImport:I=>O(I,`Imported into ${b.name}`)}),f==="alert"&&r("alerts")&&t.jsx(od,{open:!0,onClose:()=>g(null),alert:null,initialScope:{type:"folder",folderId:b.id}})]})}function c3({entry:e,onRemove:n,removing:r}){return t.jsxs("div",{className:"group/card relative",children:[t.jsx(id,{entry:e,showConnection:!0}),n&&t.jsx(V,{size:"icon-xs",variant:"ghost",disabled:r,onClick:n,"aria-label":`Remove ${e.queue.name} from this folder`,title:"Remove from folder",className:"absolute top-2 right-8 z-10 bg-surface/90 opacity-0 backdrop-blur-sm transition-opacity group-hover/card:opacity-100 focus-visible:opacity-100 hover:text-danger",children:t.jsx(vn,{})})]})}const Wf={admin:"Everything, including connections, users, license, drain and obliterate.",operator:"Manage jobs and queues, alerts, folders and flow edges. No settings.",viewer:"Read-only access to queues, jobs, alerts and flows."};function u3(){const{has:e}=wt();return e("users")?t.jsx(N0,{role:"admin",children:t.jsx(d3,{})}):t.jsx(Wa,{feature:"users"})}function d3(){const{user:e}=mt(),n=z2(),r=A2(),[i,o]=w.useState(!1),[c,d]=w.useState(null),h=[...n.data??[]].sort((p,v)=>+!!p.disabledAt-+!!v.disabledAt||p.name.localeCompare(v.name)),f=h.filter(p=>p.role==="admin"&&!p.disabledAt).length,g=(p,v)=>r.mutate({id:p.id,input:{disabled:v}},{onSuccess:()=>{d(null),X.success(v?`${p.name} disabled`:`${p.name} re-enabled`,v?"Their sessions are revoked; the account keeps its history.":"They can sign in again.")},onError:j=>X.error(ve(j))});return t.jsxs(bt,{children:[t.jsx(gs,{title:"Users",description:"Roles are enforced on every API call, not only in the UI.",actions:t.jsx(V,{variant:"primary",size:"sm",leftIcon:t.jsx(LN,{}),onClick:()=>o(!0),children:"Invite user"})}),t.jsx("div",{className:"card overflow-hidden",children:t.jsxs(ms,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{children:"Name"}),t.jsx(pe,{children:"Email"}),t.jsx(pe,{className:"w-40",children:"Role"}),t.jsx(pe,{children:"Created"}),t.jsx(pe,{children:"Last login"}),t.jsx(pe,{align:"right",children:t.jsx("span",{className:"sr-only",children:"Actions"})})]})}),t.jsxs("tbody",{children:[n.isLoading&&t.jsx(yt,{colSpan:6,children:t.jsx(Kt,{label:"Loading users…"})}),n.isError&&t.jsx(yt,{colSpan:6,className:"text-danger",children:ve(n.error)}),h.map(p=>{var k;const v=p.id===(e==null?void 0:e.id),j=!!p.disabledAt,S=p.role==="admin"&&!j&&f<=1,y=v?"You cannot disable your own account":S?"Cannot disable the last admin":null,b=r.isPending&&((k=r.variables)==null?void 0:k.id)===p.id;return t.jsxs("tr",{className:F(j&&"text-fg-muted"),children:[t.jsxs(xe,{className:"font-medium",children:[t.jsx("span",{className:F(j&&"line-through decoration-fg-subtle"),children:p.name}),v&&t.jsx(be,{variant:"outline",size:"xs",className:"ml-1.5",children:"you"}),j&&t.jsx(Pe,{content:t.jsxs(t.Fragment,{children:["Disabled ",t.jsx(Yt,{value:p.disabledAt,withAbsolute:!0}),". Cannot sign in; sessions revoked."]}),side:"bottom",children:t.jsx(be,{variant:"neutral",size:"xs",className:"ml-1.5",children:"disabled"})})]}),t.jsx(xe,{muted:!0,children:p.email}),t.jsx(xe,{children:t.jsx(Pe,{content:v?"Ask another admin to change your role":S?"Promote someone else to admin first":Wf[p.role],block:!0,children:t.jsx(dt,{"aria-label":`Role of ${p.name}`,className:"!h-7 text-xs",value:p.role,disabled:v||S||j||b,onChange:C=>r.mutate({id:p.id,input:{role:C.target.value}},{onSuccess:()=>X.success(`${p.name} is now ${C.target.value}`),onError:z=>X.error(ve(z))}),options:Ou.map(C=>({value:C,label:C}))})})}),t.jsx(xe,{muted:!0,children:t.jsx(Yt,{value:p.createdAt})}),t.jsx(xe,{muted:!0,children:t.jsx(Yt,{value:p.lastLoginAt,emptyText:"never"})}),t.jsx(xe,{align:"right",children:j?t.jsx(Pe,{content:"Re-enable: they can sign in again with the same account",side:"left",children:t.jsx(V,{size:"xs",variant:"ghost",leftIcon:t.jsx(AN,{}),"aria-label":`Re-enable ${p.name}`,loading:b,onClick:()=>g(p,!1),children:"Enable"})}):t.jsx(Pe,{content:y??"Disable: revokes access, keeps the account and its history",side:"left",children:t.jsx(V,{size:"icon-xs",variant:"ghost",className:"hover:text-danger","aria-label":`Disable ${p.name}`,disabled:!!y||b,onClick:()=>d(p),children:t.jsx(FN,{})})})})]},p.id)})]})]})}),t.jsx("div",{className:"mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3",children:Ou.map(p=>t.jsxs("div",{className:"card p-3",children:[t.jsx(be,{variant:p==="admin"?"pro":p==="operator"?"info":"neutral",className:"mb-1.5",children:p}),t.jsx("p",{children:Wf[p]})]},p))}),t.jsx(h3,{open:i,onClose:()=>o(!1)}),t.jsx(Ht,{open:!!c,onClose:()=>d(null),title:`Disable ${c==null?void 0:c.name}`,description:`${c==null?void 0:c.email} loses access immediately: active sessions are revoked and password or SSO sign-in is refused. The account and its audit history stay, and you can re-enable it any time.`,confirmText:"Disable user",danger:!0,loading:r.isPending,onConfirm:()=>c&&g(c,!0)})]})}function Iv(){const e="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789",n=new Uint8Array(16);return crypto.getRandomValues(n),Array.from(n,r=>e[r%e.length]).join("")}function h3({open:e,onClose:n}){const r=O2(),{has:i}=wt(),o=i("sso"),[c,d]=w.useState({name:"",email:"",role:"viewer",password:Iv()}),[h,f]=w.useState(!1),[g,p]=w.useState({}),v=S=>y=>d(b=>({...b,[S]:y.target.value})),j=()=>{const S={name:c.name.trim(),email:c.email.trim(),role:c.role,...h?{}:{password:c.password}},y=bk.safeParse(S);if(!y.success){const b={};for(const k of y.error.issues)b[String(k.path[0])]=k.message;p(b);return}r.mutate(y.data,{onSuccess:b=>{X.success(`${b.name} invited`,h?"They can now sign in with SSO using that email.":"Share the temporary password with them over a secure channel."),n()},onError:b=>X.error(ve(b))})};return t.jsx(bn,{open:e,onClose:n,size:"sm",title:"Invite user",description:h?"The account is created without a password; they sign in through your identity provider.":"There is no email delivery: copy the temporary password and share it yourself.",footer:t.jsxs(t.Fragment,{children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsx(V,{variant:"primary",size:"sm",onClick:j,loading:r.isPending,children:"Create user"})]}),children:t.jsxs("form",{className:"space-y-3",onSubmit:S=>{S.preventDefault(),j()},children:[t.jsx(Te,{label:"Name",autoFocus:!0,value:c.name,onChange:v("name"),error:g.name}),t.jsx(Te,{label:"Email",type:"email",value:c.email,onChange:v("email"),error:g.email}),t.jsx(dt,{label:"Role",value:c.role,onChange:v("role"),options:Ou.map(S=>({value:S,label:S})),hint:Wf[c.role]}),o&&t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx(el,{checked:h,onChange:f,label:"SSO only (no password)"}),t.jsx("button",{type:"button",className:"text-xs font-medium text-fg",onClick:()=>f(!h),children:"SSO only (no password)"})]}),h?t.jsx("p",{className:"rounded-md border border-border bg-surface-2 px-3 py-2 text-xs text-fg-muted",children:"This account will have no password and can only sign in through an identity provider. Make sure the email matches the one your IdP sends."}):t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(Te,{label:"Temporary password",mono:!0,value:c.password,onChange:v("password"),error:g.password,wrapperClassName:"flex-1",autoComplete:"off",spellCheck:!1}),t.jsx(V,{size:"icon",variant:"ghost","aria-label":"Generate password",title:"Generate",onClick:()=>d(S=>({...S,password:Iv()})),children:t.jsx(dm,{})})]})]})})}const f3=50,m3=new Set(Ak);function p3(){const{has:e}=wt();return e("audit")?t.jsx(N0,{role:"admin",children:t.jsx(g3,{})}):t.jsx(Wa,{feature:"audit"})}function x3(){const[e,n]=sl();return[w.useMemo(()=>{const c=e.get("action"),d=e.get("result");return{actorId:e.get("actorId")||void 0,action:c&&gm.includes(c)?c:void 0,connectionId:e.get("connectionId")||void 0,queueName:e.get("queueName")||void 0,jobId:e.get("jobId")||void 0,result:d==="ok"||d==="error"?d:void 0,from:e.get("from")||void 0,to:e.get("to")||void 0}},[e]),c=>{n(d=>{const h=new URLSearchParams(d);for(const[f,g]of Object.entries(c))g?h.set(f,g):h.delete(f);return h},{replace:!0})},()=>n(new URLSearchParams,{replace:!0})]}const zv=(e,n)=>e?new Date(`${e}T${n?"23:59:59.999":"00:00:00.000"}Z`).toISOString():void 0,Ov=e=>e?e.slice(0,10):"";function g3(){var v;const[e,n,r]=x3(),i=xs(),o=F2(),c=L2(e,f3),[d,h]=w.useState(null),f=((v=c.data)==null?void 0:v.pages.flatMap(j=>j.entries))??[],g=Object.values(e).filter(Boolean).length,p=j=>{var S,y;return((y=(S=i.data)==null?void 0:S.find(b=>b.id===j))==null?void 0:y.name)??null};return t.jsxs(bt,{wide:!0,children:[t.jsx(gs,{title:"Audit log",description:"Every mutating action, who did it and whether it worked. Append-only: nothing here can be edited or deleted from the UI.",actions:t.jsxs(t.Fragment,{children:[g>0&&t.jsx(V,{size:"sm",variant:"ghost",leftIcon:t.jsx(vn,{}),onClick:r,children:"Clear filters"}),t.jsxs("a",{href:D2(e),className:"inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-border bg-surface-2 px-2.5 text-xs font-medium text-fg hover:border-border-strong hover:bg-surface-3 [&_svg]:size-3.5",children:[t.jsx(jN,{"aria-hidden":!0}),"Export CSV"]})]})}),t.jsxs("div",{className:"card mb-3 flex flex-wrap items-end gap-2 p-3",children:[t.jsx(dt,{label:"Who",className:"!h-7 w-44 text-xs",value:e.actorId??"",onChange:j=>n({actorId:j.target.value}),options:[{value:"",label:"Anyone"},...(o.data??[]).filter(j=>j.id).map(j=>({value:j.id,label:j.name??j.email??j.id}))]}),t.jsx(dt,{label:"Action",className:"!h-7 w-52 text-xs",value:e.action??"",onChange:j=>n({action:j.target.value}),options:[{value:"",label:"Any action"},...gm.map(j=>({value:j,label:`${vm[j]} (${j})`}))]}),t.jsx(dt,{label:"Connection",className:"!h-7 w-40 text-xs",value:e.connectionId??"",onChange:j=>n({connectionId:j.target.value}),options:[{value:"",label:"Any connection"},...(i.data??[]).map(j=>({value:j.id,label:j.name}))]}),t.jsx(Te,{label:"Queue",className:"!h-7 w-40 text-xs",placeholder:"exact name",value:e.queueName??"",onChange:j=>n({queueName:j.target.value})}),t.jsx(dt,{label:"Result",className:"!h-7 w-32 text-xs",value:e.result??"",onChange:j=>n({result:j.target.value}),options:[{value:"",label:"Any result"},{value:"ok",label:"ok"},{value:"error",label:"refused / failed"}]}),t.jsx(Te,{label:"From",type:"date",className:"!h-7 w-36 text-xs",value:Ov(e.from),onChange:j=>n({from:zv(j.target.value,!1)})}),t.jsx(Te,{label:"To",type:"date",className:"!h-7 w-36 text-xs",value:Ov(e.to),onChange:j=>n({to:zv(j.target.value,!0)})}),e.jobId&&t.jsxs(be,{variant:"outline",mono:!0,className:"mb-1",children:["job ",e.jobId,t.jsx("button",{type:"button","aria-label":"Clear job filter",onClick:()=>n({jobId:void 0}),children:t.jsx(vn,{className:"size-3"})})]})]}),t.jsx("div",{className:"card overflow-hidden",children:t.jsxs(ms,{dense:!0,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{className:"w-8"}),t.jsx(pe,{className:"w-32",children:"When"}),t.jsx(pe,{className:"w-56",children:"Who"}),t.jsx(pe,{className:"w-56",children:"Action"}),t.jsx(pe,{children:"Target"}),t.jsx(pe,{className:"w-28",children:"Result"}),t.jsx(pe,{className:"w-32",children:"IP"})]})}),t.jsxs("tbody",{children:[c.isLoading&&t.jsx(yt,{colSpan:7,children:t.jsx(Kt,{label:"Loading the audit log…"})}),c.isError&&t.jsx(yt,{colSpan:7,className:"text-danger",children:ve(c.error)}),!c.isLoading&&!c.isError&&f.length===0&&t.jsx(yt,{colSpan:7,children:t.jsx(cn,{compact:!0,icon:t.jsx(Bo,{}),title:g>0?"Nothing matches these filters":"Nothing recorded yet",description:g>0?"Widen the date range or clear a filter.":"The log fills as people act: pausing a queue, retrying a job, inviting a user. Reads are never recorded."})}),f.map(j=>t.jsx(v3,{entry:j,open:d===j.id,onToggle:()=>h(d===j.id?null:j.id),connectionStillExists:!!p(j.connectionId)},j.id))]})]})}),t.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3 text-xs text-fg-muted",children:[t.jsxs("span",{className:"num",children:[f.length," ",f.length===1?"entry":"entries"," loaded"]}),c.hasNextPage&&t.jsx(V,{size:"sm",variant:"secondary",loading:c.isFetchingNextPage,onClick:()=>void c.fetchNextPage(),children:"Load 50 more"})]}),t.jsxs("p",{className:"mt-4 text-xs text-fg-subtle",children:["Retention is ",t.jsx("code",{className:"font-mono",children:"BULLPANE_AUDIT_RETENTION_DAYS"})," (default 365). Rows leave only by age — there is no delete endpoint, on purpose. The job payload is never recorded: ",t.jsx("code",{className:"font-mono",children:"detail"})," ","holds the parameters of an action and, where it helps, the payload size in bytes."]})]})}function v3({entry:e,open:n,onToggle:r,connectionStillExists:i}){var h;const o=m3.has(e.action),c=e.result==="error",d=!!e.detail||!!e.userAgent||!!e.errorMessage;return t.jsxs(t.Fragment,{children:[t.jsxs("tr",{className:F(c&&"bg-danger/5"),children:[t.jsx(xe,{children:d?t.jsx("button",{type:"button","aria-label":n?"Hide detail":"Show detail","aria-expanded":n,onClick:r,className:"rounded p-0.5 text-fg-subtle hover:text-fg",children:n?t.jsx(ps,{className:"size-3.5"}):t.jsx(Dn,{className:"size-3.5"})}):null}),t.jsx(xe,{muted:!0,children:t.jsx(Yt,{value:e.createdAt})}),t.jsx(xe,{children:e.actorName||e.actorEmail?t.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[t.jsx("span",{className:"truncate font-medium",children:e.actorName??"—"}),e.actorRole&&t.jsx(be,{size:"xs",variant:e.actorRole==="admin"?"pro":e.actorRole==="operator"?"info":"neutral",children:e.actorRole}),e.actorEmail&&t.jsx("span",{className:"truncate text-[11px] text-fg-subtle",children:e.actorEmail})]}):t.jsx(Pe,{content:"No session — an anonymous request, e.g. a failed login on an unknown email",children:t.jsx("span",{className:"cursor-help text-fg-subtle",children:"anonymous"})})}),t.jsxs(xe,{children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[o&&t.jsx(hm,{className:"size-3.5 shrink-0 text-warning","aria-label":"High-risk action"}),t.jsx("span",{className:F(o&&"font-medium"),children:vm[e.action]}),t.jsx(Pe,{content:e.action,children:t.jsx("code",{className:"cursor-help font-mono text-[10px] text-fg-subtle",children:e.action})})]}),typeof((h=e.detail)==null?void 0:h.reason)=="string"&&e.detail.reason&&t.jsxs("p",{className:"mt-0.5 max-w-md truncate text-[11px] text-fg-muted italic",title:e.detail.reason,children:["“",e.detail.reason,"”"]})]}),t.jsx(xe,{children:t.jsx(y3,{entry:e,connectionStillExists:i})}),t.jsx(xe,{children:c?t.jsx(Pe,{content:e.errorMessage??"The action was refused or failed",children:t.jsx(be,{variant:"danger",size:"xs",className:"cursor-help",children:"refused"})}):t.jsx(be,{variant:"success",size:"xs",children:"ok"})}),t.jsx(xe,{muted:!0,mono:!0,children:e.ip??"–"})]}),n&&t.jsx("tr",{children:t.jsx("td",{colSpan:7,className:"bg-surface-2 !px-4 !py-3",children:t.jsxs("dl",{className:"grid gap-3 text-xs sm:grid-cols-[10rem_1fr]",children:[t.jsx("dt",{className:"text-fg-subtle",children:"Exact time"}),t.jsx("dd",{className:"num",children:gn(e.createdAt)}),e.errorMessage&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{className:"text-fg-subtle",children:"Why it failed"}),t.jsx("dd",{className:"text-danger",children:e.errorMessage})]}),e.userAgent&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{className:"text-fg-subtle",children:"User agent"}),t.jsx("dd",{className:"font-mono text-[11px] break-all text-fg-muted",children:e.userAgent})]}),t.jsxs("dt",{className:"text-fg-subtle",children:["Detail",t.jsx("span",{className:"mt-0.5 block text-[10px] text-fg-subtle",children:"parameters only — never the job payload"})]}),t.jsx("dd",{children:e.detail?t.jsx(xj,{value:e.detail,defaultExpandDepth:3}):t.jsx("span",{className:"text-fg-subtle",children:"no parameters recorded"})})]})})})]})}function y3({entry:e,connectionStillExists:n}){if(!e.connectionId&&!e.queueName)return t.jsx("span",{className:"text-fg-subtle",children:"–"});const r=e.connectionName??e.connectionId;return t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-xs",children:[r&&t.jsx(t.Fragment,{children:n&&e.connectionId?t.jsx(Ee,{to:ue.connection(e.connectionId),className:"text-accent hover:underline",children:r}):t.jsx(Pe,{content:"This connection no longer exists — the name is the one it had at the time",children:t.jsx("span",{className:"cursor-help text-fg-muted line-through",children:r})})}),e.queueName&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-fg-subtle",children:"/"}),n&&e.connectionId?t.jsx(Ee,{to:ue.queue(e.connectionId,e.queueName),className:"font-mono text-accent hover:underline",children:e.queueName}):t.jsx("span",{className:"font-mono text-fg-muted line-through",children:e.queueName})]}),e.jobId&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-fg-subtle",children:"/"}),n&&e.connectionId&&e.queueName?t.jsxs(Ee,{to:ue.job(e.connectionId,e.queueName,e.jobId),className:"font-mono text-accent hover:underline",title:"The job may have been removed since",children:["#",e.jobId]}):t.jsxs("span",{className:"font-mono text-fg-muted",children:["#",e.jobId]})]})]})}function j3(){const{has:e}=wt();return e("alerts")?t.jsx(b3,{}):t.jsx(w3,{})}function b3(){const r=(bm().data??[]).filter(o=>o.enabled),i=o=>r.filter(c=>c.scope.type===o).length;return t.jsxs("div",{className:"max-w-xl space-y-4",children:[t.jsxs("p",{className:"text-xs text-fg-muted",children:[t.jsx("strong",{className:"font-medium text-fg",children:"Needs attention"})," is driven by your alert rules. Every queue that breaks an enabled rule gets a card at the top of the Overview, with the value, the window and the threshold. Paused queues and queues with a backlog but no worker are always flagged."]}),t.jsxs("ul",{className:"space-y-1 text-xs text-fg-muted",children:[t.jsxs("li",{children:["Scope each rule to ",t.jsx("span",{className:"text-fg",children:"every queue"}),", a ",t.jsx("span",{className:"text-fg",children:"connection"}),", a"," ",t.jsx("span",{className:"text-fg",children:"folder"})," or ",t.jsx("span",{className:"text-fg",children:"one queue"}),". The most specific rule of each kind wins, so a queue rule overrides the global one for that queue."]}),t.jsx("li",{children:"Failure count and failure rate come from BullMQ metrics over the window, so removeOnComplete cannot skew them."}),t.jsx("li",{children:"Processing time is the p50 or p95 of the jobs completed in the window."}),t.jsx("li",{children:"A rule without channels is dashboard only; add Slack or a webhook to be notified as well."})]}),t.jsx("p",{className:"text-xs text-fg-subtle",children:r.length===0?"No enabled rule yet.":`${r.length} enabled: ${i("global")} on every queue, ${i("connection")} per connection, ${i("folder")} per folder, ${i("queue")} per queue.`}),t.jsx(Ee,{to:ue.alerts,className:"inline-flex text-xs text-accent hover:underline",children:"Manage rules →"})]})}function w3(){const{isAdmin:e}=mt(),n=z0(),r=P2(),[i,o]=w.useState(""),[c,d]=w.useState(""),h=n.data;if(w.useEffect(()=>{h&&(o(String(h.waitingAbove)),d(String(h.failedAbove)))},[h]),n.isLoading)return t.jsx(Kt,{});const f=Rk.safeParse({waitingAbove:Number(i===""?0:i),failedAbove:Number(c===""?0:c)}),g=!!h&&f.success&&(f.data.waitingAbove!==h.waitingAbove||f.data.failedAbove!==h.failedAbove),p=()=>{f.success&&r.mutate(f.data,{onSuccess:()=>X.success("Attention thresholds saved"),onError:v=>X.error(ve(v))})};return t.jsxs("div",{className:"max-w-xl space-y-5",children:[t.jsxs("p",{className:"text-xs text-fg-muted",children:["When a queue shows up in ",t.jsx("strong",{className:"font-medium text-fg",children:"Needs attention"})," at the top of the Overview. Failing, paused and stuck-with-no-worker queues are always flagged — these two add the cases only you can define.",t.jsx("span",{className:"text-fg-subtle",children:" Set 0 to turn a rule off."})]}),t.jsxs("p",{className:"rounded-md border border-border bg-surface-2/50 px-3 py-2 text-xs text-fg-muted",children:[t.jsx("span",{className:"font-medium text-fg",children:"Pro:"})," rules per queue, folder, connection or everywhere, on failure rate and processing time over a window, measured from BullMQ metrics — the same rules can notify Slack or a webhook."," ",t.jsx(Ee,{to:ue.alerts,className:"text-accent hover:underline",children:"See Alerts"})]}),t.jsx(Te,{label:"Waiting above",hint:"Flag a queue whose waiting backlog passes this, even when a worker is draining it. Leave at 0 if your queues run deep on purpose.",inputMode:"numeric",value:i,disabled:!e,onChange:v=>o(v.target.value.replace(/[^0-9]/g,""))}),t.jsx(Te,{label:"Failed above",hint:"Flag a queue whose failed list passes this. At 0 any failed job at all is flagged, which is the previous behaviour.",inputMode:"numeric",value:c,disabled:!e,onChange:v=>d(v.target.value.replace(/[^0-9]/g,""))}),e?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(V,{variant:"primary",disabled:!g||r.isPending,onClick:p,children:r.isPending?"Saving…":"Save"}),g&&t.jsx(V,{variant:"ghost",onClick:()=>{o(String((h==null?void 0:h.waitingAbove)??Lu.waitingAbove)),d(String((h==null?void 0:h.failedAbove)??Lu.failedAbove))},children:"Cancel"})]}):t.jsx("p",{className:"text-xs text-fg-subtle",children:"Only an administrator can change these."})]})}const yu={host:"localhost",port:"6379",username:"",password:"",db:"0",tls:!1};function N3(e){try{const n=new URL(e);if(n.protocol!=="redis:"&&n.protocol!=="rediss:")return{...yu};const r=Lv(n.password);return{host:n.hostname||yu.host,port:n.port||(n.protocol==="rediss:"?"6380":"6379"),username:Lv(n.username),password:r==="****"?"":r,db:n.pathname.replace(/^\//,"")||"0",tls:n.protocol==="rediss:"}}catch{return{...yu}}}function Av(e){const n=e.username||e.password?`${encodeURIComponent(e.username)}:${encodeURIComponent(e.password)}@`:"",r=e.host.includes(":")&&!e.host.startsWith("[")?`[${e.host}]`:e.host,i=e.db.trim()&&e.db.trim()!=="0"?`/${e.db.trim()}`:"";return`${e.tls?"rediss":"redis"}://${n}${r.trim()}:${e.port.trim()||"6379"}${i}`}function k3(e,n){return e.host!==n.host||e.port!==n.port||e.username!==n.username||e.db!==n.db||e.tls!==n.tls}function Lv(e){try{return decodeURIComponent(e)}catch{return e}}function S3(){var v;const{isAdmin:e}=mt(),{demo:n}=wt(),r=xs(),i=k2(),[o,c]=sl(),[d,h]=w.useState(null),[f,g]=w.useState(null);w.useEffect(()=>{if(e){if(o.get("new"))h({connection:null}),c({},{replace:!0});else if(o.get("edit")&&r.data){const j=r.data.find(S=>S.id===o.get("edit"));j&&h({connection:j}),c({},{replace:!0})}}},[o,c,r.data,e]);const p=r.data??[];return t.jsxs("div",{children:[t.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[t.jsxs("p",{className:"text-xs text-fg-muted",children:["Each connection points at one Redis (or cluster) with a BullMQ key prefix, or at the Postgres schema of BullMQ 6's Postgres backend. On Redis, queues are discovered with ",t.jsx("span",{className:"font-mono",children:"SCAN"}),", never ",t.jsx("span",{className:"font-mono",children:"KEYS"}),"."]}),e&&t.jsx(V,{variant:"primary",size:"sm",leftIcon:t.jsx(es,{}),onClick:()=>h({connection:null}),disabled:n,title:n?"Locked in the demo":void 0,children:"Add connection"})]}),n&&t.jsx("p",{className:"mb-3 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-warning",children:"Demo mode: connections are read-only."}),t.jsx("div",{className:"card overflow-hidden",children:t.jsxs(ms,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{children:"Name"}),t.jsx(pe,{children:"URL"}),t.jsx(pe,{children:"Prefix / schema"}),t.jsx(pe,{children:"Filter"}),t.jsx(pe,{children:"Status"}),t.jsx(pe,{children:"Added"}),t.jsx(pe,{align:"right",children:t.jsx("span",{className:"sr-only",children:"Actions"})})]})}),t.jsxs("tbody",{children:[r.isLoading&&t.jsx(yt,{colSpan:7,children:t.jsx(Kt,{})}),r.data&&p.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:7,children:t.jsx(cn,{compact:!0,icon:t.jsx(Va,{}),title:"No connections",description:e?"Add your first Redis or Postgres connection.":"Ask an admin to add one."})})}),p.map(j=>{var S;return t.jsxs("tr",{children:[t.jsxs(xe,{className:"font-medium",children:[t.jsx(Ee,{to:ue.connection(j.id),className:"hover:underline",children:j.name}),j.kind==="postgres"&&t.jsx(be,{variant:"outline",size:"xs",className:"ml-1.5",children:"postgres"}),j.cluster&&t.jsx(be,{variant:"outline",size:"xs",className:"ml-1.5",children:"cluster"})]}),t.jsx(xe,{mono:!0,muted:!0,className:"max-w-xs truncate",title:j.url,children:j.url}),t.jsx(xe,{mono:!0,children:j.prefix}),t.jsx(xe,{mono:!0,muted:!0,children:j.queueFilter??"–"}),t.jsxs(xe,{children:[t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(nd,{status:j.status,withLabel:!0,pulse:!0}),((S=j.status)==null?void 0:S.ok)&&j.status.redisVersion&&t.jsxs("span",{className:"text-[11px] text-fg-subtle",children:["v",j.status.redisVersion]})]}),j.status&&!j.status.ok&&j.status.error&&t.jsx("p",{className:"mt-0.5 max-w-xs truncate text-[11px] text-danger",title:j.status.error,children:j.status.error})]}),t.jsx(xe,{muted:!0,children:t.jsx(Yt,{value:j.createdAt})}),t.jsx(xe,{align:"right",children:e&&t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(V,{size:"icon-xs",variant:"ghost","aria-label":"Edit connection",title:"Edit",onClick:()=>h({connection:j}),disabled:n,children:t.jsx(Uo,{})}),t.jsx(V,{size:"icon-xs",variant:"ghost","aria-label":"Delete connection",title:"Delete",className:"hover:text-danger",onClick:()=>g(j),disabled:n,children:t.jsx(Un,{})})]})})]},j.id)})]})]})}),d&&t.jsx(C3,{open:!0,onClose:()=>h(null),connection:d.connection},((v=d.connection)==null?void 0:v.id)??"new"),t.jsx(Ht,{open:!!f,onClose:()=>g(null),title:`Remove "${f==null?void 0:f.name}"`,description:"Only the dashboard entry is removed. Nothing in Redis or Postgres is touched. Folders and alerts pointing at this connection stop working.",confirmText:"Remove connection",danger:!0,typeToConfirm:f==null?void 0:f.name,loading:i.isPending,onConfirm:()=>f&&i.mutate(f.id,{onSuccess:()=>(g(null),X.success("Connection removed")),onError:j=>X.error(ve(j))})})]})}function C3({open:e,onClose:n,connection:r}){const i=w2(),o=N2(),c=S2(),[d,h]=w.useState({name:(r==null?void 0:r.name)??"",kind:(r==null?void 0:r.kind)??"redis",url:r?"":"redis://localhost:6379",prefix:(r==null?void 0:r.prefix)??"bull",cluster:(r==null?void 0:r.cluster)??!1,queueFilter:(r==null?void 0:r.queueFilter)??""}),[f,g]=w.useState({}),[p,v]=w.useState(null),[j,S]=w.useState("fields"),y=r?N3(r.url):yu,[b,k]=w.useState(y),C=(q,B)=>{h(de=>({...de,[q]:B})),v(null)},z=d.kind==="postgres",O=q=>{h(B=>({...B,kind:q,url:q==="postgres"?B.url.startsWith("redis")?"":B.url:B.url||"redis://localhost:6379",prefix:B.prefix===xu[B.kind]||!B.prefix?xu[q]:B.prefix,cluster:q==="postgres"?!1:B.cluster})),g({}),v(null)},T=(q,B)=>{k(de=>({...de,[q]:B})),v(null)},M=()=>j==="url"||z?d.url.trim():r&&!b.password&&!k3(b,y)?"":Av(b),E=()=>{const q=M(),B={name:d.name.trim(),kind:d.kind,url:q,prefix:d.prefix.trim()||xu[d.kind],cluster:d.cluster,queueFilter:d.queueFilter.trim()||null};r&&!B.url&&(B.url=r.url);const de=kk.safeParse(B);if(!de.success){const ce={};for(const Ne of de.error.issues)ce[String(Ne.path[0])]=Ne.message;return g(ce),null}return g({}),de.data},I=()=>{const q=E();if(!q)return;const B=de=>{X.success(`Connection "${de.name}" saved`),n()};if(r){const de={name:q.name,prefix:q.prefix,cluster:q.cluster,queueFilter:q.queueFilter};M()&&(de.url=q.url),o.mutate({id:r.id,input:de},{onSuccess:B,onError:ce=>X.error(ve(ce))})}else i.mutate(q,{onSuccess:B,onError:de=>X.error(ve(de))})},Q=()=>{const q=M();if(!q){g({url:r?j==="url"||z?"Enter the URL (with password) to test it":"Enter the password to test the stored connection":"URL is required"});return}c.mutate({kind:d.kind,url:q,prefix:d.prefix.trim()||void 0,cluster:d.cluster},{onSuccess:v,onError:B=>v({ok:!1,error:ve(B)})})},H=i.isPending||o.isPending;return t.jsx(bn,{open:e,onClose:n,size:"md",title:r?`Edit ${r.name}`:"Add connection",description:"Credentials are stored server-side and never sent back to the browser.",footer:t.jsxs(t.Fragment,{children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsx(V,{variant:"secondary",size:"sm",leftIcon:t.jsx(Ky,{}),onClick:Q,loading:c.isPending,children:"Test connection"}),t.jsx(V,{variant:"primary",size:"sm",onClick:I,loading:H,children:r?"Save":"Add connection"})]}),children:t.jsxs("form",{className:"space-y-3",onSubmit:q=>{q.preventDefault(),I()},children:[t.jsx(Te,{label:"Name",autoFocus:!0,value:d.name,onChange:q=>C("name",q.target.value),error:f.name,placeholder:"production"}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs font-medium text-fg-muted",children:"Backend"}),r?t.jsx("span",{className:"text-xs text-fg",children:z?"Postgres (BullMQ 6)":"Redis"}):t.jsx("div",{className:"inline-flex rounded-md border border-border p-0.5 text-xs",role:"tablist","aria-label":"Where the queues live",children:["redis","postgres"].map(q=>t.jsx("button",{type:"button",role:"tab","aria-selected":d.kind===q,className:`rounded px-2 py-0.5 ${d.kind===q?"bg-surface-3 text-fg":"text-fg-muted hover:text-fg"}`,onClick:()=>O(q),children:q==="redis"?"Redis":"Postgres (BullMQ 6)"},q))})]}),z?t.jsx(Te,{label:"Postgres URL",mono:!0,value:d.url,onChange:q=>C("url",q.target.value),error:f.url,placeholder:r?`${r.url} (leave empty to keep)`:"postgres://user:password@host:5432/app",hint:"The database your BullMQ workers use. Add ?sslmode=require for TLS. A read-only role is enough to browse; actions need write access.",autoComplete:"off",spellCheck:!1}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs font-medium text-fg-muted",children:"Redis"}),t.jsx("div",{className:"inline-flex rounded-md border border-border p-0.5 text-xs",role:"tablist","aria-label":"How to enter the Redis address",children:["fields","url"].map(q=>t.jsx("button",{type:"button",role:"tab","aria-selected":j===q,className:`rounded px-2 py-0.5 ${j===q?"bg-surface-3 text-fg":"text-fg-muted hover:text-fg"}`,onClick:()=>(S(q),v(null)),children:q==="fields"?"Host & password":"Connection URL"},q))})]}),j==="url"?t.jsx(Te,{label:"Redis URL",mono:!0,value:d.url,onChange:q=>C("url",q.target.value),error:f.url,placeholder:r?`${r.url} (leave empty to keep)`:"redis://:password@host:6379/0",hint:"redis:// or rediss:// (TLS). Include the password; it is redacted everywhere in the UI.",autoComplete:"off",spellCheck:!1}):t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"grid gap-3 sm:grid-cols-[1fr_120px]",children:[t.jsx(Te,{label:"Host",mono:!0,value:b.host,onChange:q=>T("host",q.target.value),placeholder:"cache.internal",autoComplete:"off",spellCheck:!1}),t.jsx(Te,{label:"Port",mono:!0,inputMode:"numeric",value:b.port,onChange:q=>T("port",q.target.value)})]}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[t.jsx(Te,{label:"Username (optional)",mono:!0,value:b.username,onChange:q=>T("username",q.target.value),placeholder:"default",autoComplete:"off",spellCheck:!1}),t.jsx(Te,{label:"Password",type:"password",mono:!0,value:b.password,onChange:q=>T("password",q.target.value),placeholder:r?"leave empty to keep the stored one":"optional",hint:r?"Stored server-side and never shown again. Changing the host or TLS needs it typed again.":"Stored server-side, redacted everywhere in the UI.",autoComplete:"new-password"})]}),t.jsxs("div",{className:"grid items-end gap-3 sm:grid-cols-[120px_1fr]",children:[t.jsx(Te,{label:"Database",mono:!0,inputMode:"numeric",value:b.db,onChange:q=>T("db",q.target.value)}),t.jsxs("div",{className:"flex items-start gap-2.5 pb-1",children:[t.jsx(el,{checked:b.tls,onChange:q=>T("tls",q),label:"TLS",className:"mt-0.5"}),t.jsxs("button",{type:"button",className:"text-left text-xs",onClick:()=>T("tls",!b.tls),children:[t.jsx("span",{className:"font-medium text-fg",children:"TLS"}),t.jsx("span",{className:"text-fg-muted",children:" (rediss://) — required by ElastiCache with in-transit encryption, Redis Cloud, Upstash and most managed Redis."})]})]})]}),f.url&&t.jsx("p",{className:"text-xs text-danger",children:f.url}),t.jsx("p",{className:"font-mono text-[11px] text-fg-subtle",children:M()?Av({...b,password:b.password?"****":""}):`${(r==null?void 0:r.url)??""} (unchanged)`})]})]}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[z?t.jsx(Te,{label:"Schema",mono:!0,value:d.prefix,onChange:q=>C("prefix",q.target.value),error:f.prefix,hint:"BullMQ default is bullmq"}):t.jsx(Te,{label:"Key prefix",mono:!0,value:d.prefix,onChange:q=>C("prefix",q.target.value),error:f.prefix,hint:"BullMQ default is bull"}),t.jsx(Te,{label:"Queue filter (optional)",mono:!0,value:d.queueFilter,onChange:q=>C("queueFilter",q.target.value),error:f.queueFilter,placeholder:"payments-*",hint:"Glob over queue names; limits discovery."})]}),!z&&t.jsx(Pm,{label:"Redis Cluster",description:"Use cluster-aware client. Each queue lives in one hash slot, so all reads stay single-node.",checked:d.cluster,onChange:q=>C("cluster",q.target.checked)}),p&&t.jsxs("div",{className:`flex items-start gap-2 rounded-md border px-3 py-2 text-xs ${p.ok?"border-success/40 bg-success/10 text-success":"border-danger/40 bg-danger/10 text-danger"}`,role:"status",children:[p.ok?t.jsx(cm,{className:"mt-px size-4 shrink-0"}):t.jsx(Fy,{className:"mt-px size-4 shrink-0"}),t.jsx("div",{children:p.ok?t.jsxs(t.Fragment,{children:["Connected",p.latencyMs!=null&&` in ${p.latencyMs} ms`,p.redisVersion&&` · ${z?"Postgres":"Redis"} ${p.redisVersion}`,p.queuesFound!=null&&` · ${p.queuesFound} queues found`]}):t.jsxs(t.Fragment,{children:["Failed: ",p.error??"unknown error"]})})]})]})})}const Fv={active:{label:"active",variant:"success"},grace:{label:"grace period",variant:"warning"},expired:{label:"expired",variant:"danger"},invalid:{label:"invalid",variant:"danger"}};function _3(e){if(e.source==="offline")return e.status==="expired"?"This offline key has expired. Ask for a renewed key or activate a subscription key.":e.status==="invalid"?"This key does not verify against this build. Paste it again or ask for a new one.":null;switch(e.status){case"grace":return`bullpane.com could not be reached (${e.lastCheckError??"unknown error"}). Pro keeps working until ${gn(e.leaseExpiresAt)}; the server retries once a day, or check now.`;case"expired":return e.lastCheckError?`${e.lastCheckError} Renew the subscription on bullpane.com, then check again.`:"The lease ran out without reaching bullpane.com. Restore the connection and check now.";case"invalid":return e.lastCheckError??"The store rejected this key.";default:return null}}function P3(){const{isAdmin:e,setEdition:n}=mt(),{edition:r,isPro:i,demo:o,pricing:c,checkoutUrl:d,has:h}=wt(),f=Q2(),g=V2(),p=B2(),[v,j]=w.useState(""),[S,y]=w.useState(null),[b,k]=w.useState(!1),C=()=>{const E=v.trim();if(!E){y("Paste the license key");return}y(null),f.mutate(E,{onSuccess:I=>{n(I),j(""),X.success("Pro unlocked",I.license?`Licensed to ${I.license.licensee}`:void 0)},onError:I=>{Ts(I)&&(I.body.error==="invalid_license"||I.body.error==="license_already_activated"||I.body.error==="license_server_unavailable")?y(I.body.message||"This key is not valid"):y(ve(I))}})},z=()=>p.mutate(void 0,{onSuccess:E=>{var Q,H,q,B;n(E);const I=(Q=E.license)==null?void 0:Q.status;I==="active"?X.success("License verified",`Lease renewed until ${gn((H=E.license)==null?void 0:H.leaseExpiresAt)}`):I==="grace"?X.error("Could not reach bullpane.com",((q=E.license)==null?void 0:q.lastCheckError)??void 0):X.error("License not valid",((B=E.license)==null?void 0:B.lastCheckError)??void 0)},onError:E=>X.error(ve(E))}),O=r.license,T=O?_3(O):null,M=(O==null?void 0:O.source)==="online";return t.jsxs("div",{className:"grid gap-4 lg:grid-cols-[1fr_360px]",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"card p-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex size-10 items-center justify-center rounded-lg bg-surface-2",children:i?t.jsx(Gu,{className:"size-5 text-pro"}):t.jsx(go,{className:"size-5 text-fg-subtle"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h2",{className:"text-sm font-semibold",children:o?"Demo mode":i?"Pro edition":"Free edition"}),t.jsx(Nm,{})]}),t.jsx("p",{className:"text-xs text-fg-muted",children:o?"Every Pro feature is unlocked for the playground. Settings that could break the demo are read-only.":i?"All features unlocked for this installation.":"Everything bull-board does, plus search. Team features need a Pro key."})]}),M&&e&&!o&&t.jsx(V,{variant:"outline",size:"sm",leftIcon:t.jsx(dm,{}),onClick:z,loading:p.isPending,children:"Check now"})]}),O&&t.jsxs("dl",{className:"mt-4 grid grid-cols-2 gap-3 border-t border-border pt-4 text-xs sm:grid-cols-4",children:[t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Licensee"}),t.jsx("dd",{className:"truncate text-fg",children:O.licensee})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Email"}),t.jsx("dd",{className:"truncate text-fg",children:O.email})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:M?"Plan":"Issued"}),t.jsx("dd",{className:"text-fg",children:M?"Subscription":Fu(O.issuedAt)})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:M?"Paid until":"Expires"}),t.jsxs("dd",{className:"text-fg",children:[O.expiresAt?Fu(O.expiresAt):M?"Renews automatically":"Never"," ",t.jsx(be,{variant:Fv[O.status].variant,size:"xs",className:"ml-1",children:Fv[O.status].label})]})]}),M&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Last verified"}),t.jsx("dd",{className:"text-fg",title:O.lastCheckedAt?gn(O.lastCheckedAt):void 0,children:O.lastCheckedAt?Kr(O.lastCheckedAt):"never"})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Works offline until"}),t.jsx("dd",{className:"text-fg",children:gn(O.leaseExpiresAt)})]}),t.jsxs("div",{className:"col-span-2",children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Activation"}),t.jsx("dd",{className:"truncate font-mono text-fg",children:O.activationId})]})]})]}),T&&t.jsx("p",{className:`mt-3 rounded-md border px-3 py-2 text-xs ${(O==null?void 0:O.status)==="grace"?"border-warning/40 bg-warning/10 text-warning":"border-danger/40 bg-danger/10 text-danger"}`,children:T}),o&&t.jsx("p",{className:"mt-3 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-warning",children:"Demo mode notice: license changes are blocked here. Run your own instance to activate a key."})]}),t.jsxs("div",{className:"card p-4",children:[t.jsx("h3",{className:"mb-3 text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"Features"}),t.jsx("ul",{className:"grid gap-2 sm:grid-cols-2",children:xm.map(E=>t.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border p-2.5 text-xs",children:[h(E)?t.jsx(Zr,{className:"mt-px size-4 shrink-0 text-success"}):t.jsx(go,{className:"mt-px size-4 shrink-0 text-fg-subtle"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-fg",children:bo[E].title}),t.jsx("p",{className:"text-fg-muted",children:bo[E].tagline})]})]},E))})]})]}),t.jsxs("div",{className:"space-y-4",children:[e?t.jsxs("div",{className:"card p-4",children:[t.jsxs("h3",{className:"mb-1 flex items-center gap-2 text-sm font-semibold",children:[t.jsx(al,{className:"size-4"})," ",i&&!o?"Replace license key":"Activate a license key"]}),t.jsx("p",{className:"mb-3 text-xs text-fg-muted",children:"Paste the key from your bullpane.com receipt. One key runs one installation: it is activated once against bullpane.com, re-checked daily, and keeps working for 7 days without internet. Nothing about your queues or jobs is sent."}),t.jsx(Yi,{mono:!0,rows:3,value:v,onChange:E=>j(E.target.value),placeholder:"BULLPANE-XXXX-XXXX-XXXX",error:S,spellCheck:!1,disabled:o,"aria-label":"License key"}),t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsx(V,{variant:"primary",size:"sm",onClick:C,loading:f.isPending,disabled:o,children:"Activate"}),O&&!o&&t.jsx(V,{variant:"ghost",size:"sm",className:"hover:text-danger",leftIcon:t.jsx(Un,{}),onClick:()=>k(!0),children:"Remove license"})]})]}):t.jsx("div",{className:"card p-4 text-xs text-fg-muted",children:"Only admins can change the license."}),!i&&t.jsxs("div",{className:"card border-pro/30 p-4",children:[t.jsxs("p",{className:"text-sm font-semibold",children:["Unlock Pro · $",c.monthlyUsd,"/month or $",c.yearlyUsd,"/year"]}),t.jsx("p",{className:"mt-1 text-xs text-fg-muted",children:"One installation, unlimited connections, queues and users. Cancel any time; your data stays."}),t.jsxs("a",{href:d||"#",target:"_blank",rel:"noreferrer noopener","aria-disabled":!d,className:"mt-3 inline-flex h-8 items-center gap-2 rounded-md bg-accent px-3 text-xs font-medium text-accent-fg hover:bg-accent-hover aria-disabled:pointer-events-none aria-disabled:opacity-50",children:["Get a key ",t.jsx(Br,{className:"size-3.5"})]})]})]}),t.jsx(Ht,{open:b,onClose:()=>k(!1),title:"Remove license",description:M?"The installation goes back to the free edition, which has NO LOGIN: anyone who can reach this URL will be able to retry, promote and delete jobs. The key is released so it can be activated on another server. Alerts, folders, flow edges and your user accounts are kept in the database but become inaccessible until a key is activated again.":"The installation goes back to the free edition, which has NO LOGIN: anyone who can reach this URL will be able to retry, promote and delete jobs. Alerts, folders, flow edges and your user accounts are kept in the database but become inaccessible until a key is activated again.",confirmText:"Remove license",danger:!0,loading:g.isPending,onConfirm:()=>g.mutate(void 0,{onSuccess:E=>{n(E),k(!1),X.success("License removed")},onError:E=>X.error(ve(E))})})]})}function E3(){const e=l2(),{edition:n,checkoutUrl:r}=wt();return t.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[t.jsxs("div",{className:"card p-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(km,{className:"size-9"}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-sm font-semibold",children:"Bullpane"}),t.jsx("p",{className:"text-xs text-fg-muted",children:"Self-hosted dashboard for BullMQ and BullMQ Pro."})]})]}),t.jsxs("dl",{className:"mt-4 grid grid-cols-2 gap-3 border-t border-border pt-4 text-xs",children:[t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Server version"}),t.jsx("dd",{className:"font-mono text-fg",children:e.data?e.data.version:e.isError?"unknown":t.jsx(Cu,{})})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Server uptime"}),t.jsx("dd",{className:"text-fg",children:e.data?No(e.data.uptime):e.isError?"unknown":t.jsx(Cu,{})})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Edition"}),t.jsxs("dd",{className:"text-fg",children:[n.tier,n.demo&&" (demo)"]})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"UI build"}),t.jsx("dd",{className:"font-mono text-fg",children:"production"})]})]})]}),t.jsxs("div",{className:"card p-4",children:[t.jsx("h3",{className:"mb-2 text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"Links"}),t.jsxs("ul",{className:"space-y-1.5 text-[13px]",children:[t.jsx("li",{children:t.jsxs("a",{href:"https://docs.bullmq.io",target:"_blank",rel:"noreferrer noopener",className:"inline-flex items-center gap-1.5 text-accent hover:underline",children:["BullMQ documentation ",t.jsx(Br,{className:"size-3.5"})]})}),r&&t.jsx("li",{children:t.jsxs("a",{href:r,target:"_blank",rel:"noreferrer noopener",className:"inline-flex items-center gap-1.5 text-accent hover:underline",children:["Buy a Pro license (from $",n.pricing.monthlyUsd,"/mo) ",t.jsx(Br,{className:"size-3.5"})]})}),t.jsx("li",{children:t.jsxs("a",{href:"/api/health",target:"_blank",rel:"noreferrer noopener",className:"inline-flex items-center gap-1.5 text-accent hover:underline",children:["API health ",t.jsx(Br,{className:"size-3.5"})]})})]}),t.jsx("h3",{className:"mt-5 mb-2 text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"How it reads Redis"}),t.jsxs("ul",{className:"list-disc space-y-1 pl-4 text-xs text-fg-muted",children:[t.jsxs("li",{children:["Discovery via ",t.jsx("span",{className:"font-mono",children:"SCAN"}),", never ",t.jsx("span",{className:"font-mono",children:"KEYS"}),"; cached 30 s."]}),t.jsx("li",{children:"Counts, pages and details are single Lua round trips per queue."}),t.jsx("li",{children:"Payloads are truncated inside Redis for list views."}),t.jsx("li",{children:"Writes go through the official bullmq library."})]})]})]})}const R3={oidc:"OIDC",saml:"SAML 2.0"};function M3(){const{has:e}=wt();return e("sso")?t.jsx(T3,{}):t.jsx(Wa,{feature:"sso"})}function ju({label:e,value:n}){const[r,i]=w.useState(!1);return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"w-24 shrink-0 text-[11px] uppercase tracking-wide text-fg-subtle",children:e}),t.jsx("code",{className:"min-w-0 flex-1 truncate rounded bg-surface-2 px-2 py-1 text-[11px] text-fg-muted",children:n}),t.jsx(V,{size:"icon-xs",variant:"ghost","aria-label":`Copy ${e}`,onClick:()=>{var o;(o=navigator.clipboard)==null||o.writeText(n).then(()=>{i(!0),setTimeout(()=>i(!1),1500)},()=>X.error("Could not copy to the clipboard"))},children:r?t.jsx(Zr,{className:"size-3 text-success"}):t.jsx(Uy,{className:"size-3"})})]})}function T3(){var k;const e=K2(),n=F0(),r=D0(),i=Z2(),o=G2(),c=J2(),[d,h]=w.useState(!1),[f,g]=w.useState(null),[p,v]=w.useState({}),j=e.data??[],S=j.filter(C=>C.enabled).length,y=((k=n.data)==null?void 0:k.requireSso)??!1,b=async C=>{try{const z=await c.mutateAsync(C.id);v(O=>({...O,[C.id]:z}))}catch(z){v(O=>({...O,[C.id]:{ok:!1,message:ve(z)}}))}};return t.jsxs("div",{className:"space-y-5",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Single sign-on"}),t.jsxs("p",{className:"mt-1 max-w-2xl text-xs text-fg-muted",children:["Let your team sign in with your identity provider. By default accounts are not created automatically: add the person under ",t.jsx("span",{className:"text-fg",children:"Users & roles"})," first, then they can sign in with SSO using that same email. Or turn on ",t.jsx("span",{className:"text-fg",children:"auto-provisioning"})," below for your company's email domains."]})]}),t.jsx(V,{variant:"primary",leftIcon:t.jsx(es,{className:"size-4"}),onClick:()=>h(!0),children:"Add provider"})]}),e.isLoading?t.jsx("div",{className:"flex justify-center py-8",children:t.jsx(Kt,{})}):j.length===0?t.jsxs("div",{className:"card p-6 text-center",children:[t.jsx(Gu,{className:"mx-auto size-6 text-fg-subtle"}),t.jsx("p",{className:"mt-2 text-sm text-fg",children:"No identity provider yet"}),t.jsx("p",{className:"mx-auto mt-1 max-w-md text-xs text-fg-muted",children:"Add an OIDC provider (Google Workspace, Microsoft Entra ID, Okta, Keycloak, Authentik) or a SAML 2.0 provider."})]}):t.jsx("div",{className:"space-y-3",children:j.map(C=>{const z=p[C.id];return t.jsxs("div",{className:"card p-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"truncate text-sm font-medium text-fg",children:C.name}),t.jsx(be,{variant:"neutral",children:R3[C.kind]}),!C.enabled&&t.jsx(be,{variant:"warning",children:"disabled"}),C.kind==="oidc"&&!C.hasSecret&&t.jsx(be,{variant:"danger",children:"no client secret"})]}),t.jsx("p",{className:"mt-1 truncate text-xs text-fg-muted",children:C.kind==="oidc"?String(C.config.issuer??""):String(C.config.entryPoint??"")})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(el,{checked:C.enabled,label:"Enabled",onChange:O=>{i.mutate({id:C.id,input:{enabled:O}},{onError:T=>X.error(ve(T))})}}),t.jsx(V,{size:"sm",variant:"secondary",leftIcon:t.jsx(Ky,{className:"size-3.5"}),loading:c.isPending&&c.variables===C.id,onClick:()=>void b(C),children:"Test"}),t.jsx(V,{size:"icon-sm",variant:"ghost","aria-label":"Delete provider",onClick:()=>g(C),children:t.jsx(Un,{className:"size-3.5"})})]})]}),t.jsx("div",{className:"mt-3 space-y-1.5 border-t border-border pt-3",children:C.kind==="oidc"?t.jsx(ju,{label:"Redirect URI",value:C.callbackUrl}):t.jsxs(t.Fragment,{children:[t.jsx(ju,{label:"ACS URL",value:C.callbackUrl}),C.entityId&&t.jsx(ju,{label:"Entity ID",value:C.entityId})]})}),z&&t.jsxs("div",{className:`mt-3 rounded-md border px-3 py-2 text-xs ${z.ok?"border-success/40 bg-success/10 text-success":"border-danger/40 bg-danger/10 text-danger"}`,children:[t.jsxs("p",{className:"flex items-center gap-1.5 font-medium",children:[z.ok?t.jsx(Zr,{className:"size-3.5"}):t.jsx(vn,{className:"size-3.5"}),z.message]}),z.details&&t.jsx("dl",{className:"mt-2 space-y-0.5 text-fg-muted",children:Object.entries(z.details).map(([O,T])=>t.jsxs("div",{className:"flex gap-2",children:[t.jsx("dt",{className:"w-44 shrink-0 font-mono text-[10px] uppercase",children:O}),t.jsx("dd",{className:"min-w-0 truncate font-mono text-[10px]",children:T})]},O))})]})]},C.id)})}),t.jsxs("div",{className:"card p-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-fg",children:"Require SSO"}),t.jsxs("p",{className:"mt-1 max-w-2xl text-xs text-fg-muted",children:["Hide the password form and send everyone through your identity provider."," ",t.jsx("span",{className:"text-fg",children:"Admin accounts keep password sign-in"})," so a misconfigured provider cannot lock you out of your own installation. Set ",t.jsx("code",{className:"text-[11px]",children:"BULLPANE_ALLOW_PASSWORD_LOGIN=true"})," to allow it for everyone."]})]}),t.jsx(el,{checked:y,disabled:n.isLoading||r.isPending,onChange:C=>{r.mutate({requireSso:C},{onSuccess:()=>X.success(C?"SSO is now required":"Password sign-in is available again"),onError:z=>X.error(ve(z))})}})]}),y&&S===0&&t.jsxs("p",{className:"mt-3 flex items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-warning",children:[t.jsx(ts,{className:"size-3.5 shrink-0"}),"SSO is required but no provider is enabled. Only admins can sign in right now."]})]}),t.jsx(q3,{}),d&&t.jsx($3,{onClose:()=>h(!1)}),t.jsx(Ht,{open:f!==null,title:"Delete this provider?",confirmText:"Delete",danger:!0,description:f?`Anyone who signs in through "${f.name}" will have to use another method. The Bullpane accounts themselves are not touched.`:"",loading:o.isPending,onClose:()=>g(null),onConfirm:()=>{f&&o.mutate(f.id,{onSuccess:()=>{X.success(`Deleted ${f.name}`),g(null)},onError:C=>{X.error(ve(C)),g(null)}})}})]})}function q3(){var p,v;const e=F0(),n=D0(),r=((p=e.data)==null?void 0:p.autoProvisionDomains)??[],i=((v=e.data)==null?void 0:v.autoProvision)??!1,[o,c]=w.useState(null),[d,h]=w.useState(null),f=o??r.join(", "),g=()=>{h(null);const j=f.split(/[\s,]+/).map(y=>y.trim()).filter(y=>y!==""),S=[];for(const y of j){const b=h0.safeParse(y);if(!b.success){h(`"${y}" is not a domain. Use something like example.com.`);return}S.push(b.data)}n.mutate({autoProvisionDomains:S},{onSuccess:()=>{c(null),X.success("Domains saved")},onError:y=>h(ve(y))})};return t.jsxs("div",{className:"card p-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-fg",children:"Let anyone from your domains sign in"}),t.jsxs("p",{className:"mt-1 max-w-2xl text-xs text-fg-muted",children:["When someone your identity provider authenticates has no Bullpane account yet and their email ends in one of the domains below, create one for them as a ",t.jsx("span",{className:"text-fg",children:"viewer"})," instead of refusing. They can look at every queue but change nothing; promote them under Users & roles if they need more. Disabled accounts stay disabled."]})]}),t.jsx(el,{checked:i,label:"Auto-provision SSO accounts",disabled:e.isLoading||n.isPending,onChange:j=>{if(j&&r.length===0){h("Save at least one domain first.");return}n.mutate({autoProvision:j},{onSuccess:()=>X.success(j?"New SSO users from your domains now get a viewer account":"SSO accounts must be invited again"),onError:S=>X.error(ve(S))})}})]}),t.jsxs("div",{className:"mt-3 flex items-start gap-2",children:[t.jsx(Te,{label:"Allowed email domains",hint:"Comma separated. Exact match: example.com does not include sub.example.com.",placeholder:"example.com",mono:!0,wrapperClassName:"flex-1",value:f,onChange:j=>c(j.target.value),error:d??void 0}),t.jsx(V,{className:"mt-5",variant:"secondary",disabled:o===null,loading:n.isPending,onClick:g,children:"Save"})]})]})}function $3({onClose:e}){const n=W2(),[r,i]=w.useState("oidc"),[o,c]=w.useState(""),[d,h]=w.useState(""),[f,g]=w.useState(""),[p,v]=w.useState(""),[j,S]=w.useState(""),[y,b]=w.useState(""),[k,C]=w.useState(""),[z,O]=w.useState(""),[T,M]=w.useState(""),[E,I]=w.useState(null),Q=()=>{var B;I(null);const H=r==="oidc"?{kind:"oidc",name:o.trim(),config:{issuer:d.trim(),clientId:f.trim(),clientSecret:p,...j.trim()?{emailClaim:j.trim()}:{}}}:{kind:"saml",name:o.trim(),config:{entryPoint:y.trim(),issuer:k.trim(),idpCert:z.trim(),...T.trim()?{emailAttribute:T.trim()}:{}}},q=wk.safeParse(H);if(!q.success){I(((B=q.error.issues[0])==null?void 0:B.message)??"Check the fields above");return}n.mutate(q.data,{onSuccess:de=>{X.success(`Added ${de.name}. Enter the redirect URI at your IdP, then use Test.`),e()},onError:de=>I(ve(de))})};return t.jsx(bn,{open:!0,onClose:e,title:"Add an identity provider",description:"Unless auto-provisioning is on, invite people under Users & roles first.",size:"md",footer:t.jsxs(t.Fragment,{children:[t.jsx(V,{variant:"ghost",onClick:e,children:"Cancel"}),t.jsx(V,{variant:"primary",loading:n.isPending,onClick:Q,children:"Add provider"})]}),children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs(dt,{label:"Protocol",value:r,onChange:H=>i(H.target.value),children:[t.jsx("option",{value:"oidc",children:"OIDC / OpenID Connect"}),t.jsx("option",{value:"saml",children:"SAML 2.0"})]}),t.jsx(Te,{label:"Display name",placeholder:r==="oidc"?"Google Workspace":"Corporate SSO",hint:"Shown on the sign-in button.",value:o,onChange:H=>c(H.target.value),required:!0}),r==="oidc"?t.jsxs(t.Fragment,{children:[t.jsx(Te,{label:"Issuer URL",placeholder:"https://accounts.google.com",hint:"Endpoints are discovered from /.well-known/openid-configuration, so this is the only URL you need.",value:d,onChange:H=>h(H.target.value),required:!0}),t.jsx(Te,{label:"Client ID",value:f,onChange:H=>g(H.target.value),required:!0}),t.jsx(Te,{label:"Client secret",type:"password",hint:"Stored encrypted and never shown again.",value:p,onChange:H=>v(H.target.value),required:!0}),t.jsx(Te,{label:"Email claim (optional)",placeholder:"email",hint:"Override only if your provider puts the email somewhere else, e.g. upn.",value:j,onChange:H=>S(H.target.value)})]}):t.jsxs(t.Fragment,{children:[t.jsx(Te,{label:"Sign-in URL (SSO endpoint)",placeholder:"https://idp.example.com/sso/saml",value:y,onChange:H=>b(H.target.value),required:!0}),t.jsx(Te,{label:"IdP entity ID",placeholder:"https://idp.example.com/metadata",value:k,onChange:H=>C(H.target.value),required:!0}),t.jsx(Yi,{label:"IdP signing certificate",rows:5,placeholder:"-----BEGIN CERTIFICATE-----",hint:"PEM or base64. Assertions must be signed; there is no way to disable that.",value:z,onChange:H=>O(H.target.value),required:!0}),t.jsx(Te,{label:"Email attribute (optional)",placeholder:"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress",value:T,onChange:H=>M(H.target.value)})]}),E&&t.jsx("p",{role:"alert",className:"rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger",children:E})]})})}const Dv=[{value:"off",label:"Off",hint:"No MCP client can connect or call anything."},{value:"read",label:"Read only",hint:"Clients can list queues, read jobs, logs and schedulers. Nothing changes."},{value:"write",label:"Read & write",hint:"Operators and admins may also let a client retry, promote, remove and add jobs and pause queues. Viewers still only read."}];function I3(){const{has:e}=wt();return e("mcp")?t.jsx(z3,{}):t.jsx(Wa,{feature:"mcp"})}function z3(){var S;const{isAdmin:e}=mt(),n=X2(),r=Y2(),[i,o]=w.useState(!1),c=eS(e&&i),d=tS(),[h,f]=w.useState(null);if(n.isLoading||!n.data)return t.jsx("div",{className:"flex justify-center py-8",children:t.jsx(Kt,{})});const{maxAccess:g,endpoint:p,reachableFromCloud:v}=n.data,j=c.data??[];return t.jsxs("div",{className:"space-y-5",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:"MCP"}),t.jsx("p",{className:"mt-1 max-w-2xl text-xs text-fg-muted",children:"Connect your AI to this Bullpane: Claude, or any MCP client that supports OAuth. Each person signs in with their own Bullpane login (or SSO) and picks read or read & write. A client acts as that person, with their role: what they cannot do in the dashboard, the client cannot do either. Every change is in the audit log, and draining, cleaning or obliterating a queue always comes back here for a human to confirm."})]}),t.jsxs("div",{className:"card space-y-3 p-4",children:[t.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-fg-subtle",children:"Access for MCP clients"}),t.jsx(dt,{label:"Most a client can do on this install",value:g,disabled:!e||r.isPending,onChange:y=>r.mutate({maxAccess:y.target.value},{onSuccess:()=>X.success("MCP access updated. It applies to connected clients on their next call."),onError:b=>X.error(ve(b))}),options:Dv.map(y=>({value:y.value,label:y.label})),hint:e?(S=Dv.find(y=>y.value===g))==null?void 0:S.hint:"Only an admin can change this.",wrapperClassName:"max-w-md"})]}),t.jsxs("div",{className:"card space-y-3 p-4",children:[t.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-fg-subtle",children:"Connect a client"}),t.jsx(ju,{label:"Server URL",value:p}),!v&&t.jsxs("div",{className:"flex gap-2 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-fg",children:[t.jsx(ts,{className:"mt-0.5 size-3.5 shrink-0 text-warning"}),t.jsxs("span",{children:["Cloud-hosted clients such as claude.ai and Claude Desktop connect from their provider's servers, so they need this URL to be public HTTPS. It looks private (check ",t.jsx("span",{className:"font-mono",children:"PUBLIC_URL"}),"). Clients that run on your machine, such as Claude Code, work on a private network."]})]}),t.jsxs("dl",{className:"space-y-2 text-xs text-fg-muted",children:[t.jsxs("div",{children:[t.jsx("dt",{className:"font-medium text-fg",children:"claude.ai and Claude Desktop"}),t.jsx("dd",{children:"Settings → Connectors → Add custom connector, paste the server URL, then Connect and sign in."})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"font-medium text-fg",children:"Claude Code"}),t.jsxs("dd",{children:[t.jsxs("code",{className:"rounded bg-surface-2 px-1.5 py-0.5 font-mono text-[11px]",children:["claude mcp add --transport http bullpane ",p]}),", then run ",t.jsx("code",{className:"font-mono",children:"/mcp"})," to sign in."]})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"font-medium text-fg",children:"Any other MCP client"}),t.jsx("dd",{children:"Add the server URL as a remote (HTTP) MCP server. The client registers itself and opens this Bullpane to sign in."})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-fg-subtle",children:i?"All connected clients":"Your connected clients"}),e&&t.jsx(V,{size:"sm",variant:"ghost",onClick:()=>o(y=>!y),children:i?"Show only mine":"Show everyone's"})]}),c.isLoading?t.jsx("div",{className:"flex justify-center py-6",children:t.jsx(Kt,{})}):j.length===0?t.jsxs("div",{className:"card p-6 text-center",children:[t.jsx(Ay,{className:"mx-auto size-6 text-fg-subtle"}),t.jsx("p",{className:"mt-2 text-sm text-fg",children:"No client connected"}),t.jsx("p",{className:"mx-auto mt-1 max-w-md text-xs text-fg-muted",children:"Add the server URL to Claude and sign in; the connection shows up here."})]}):t.jsx("div",{className:"card divide-y divide-border",children:j.map(y=>t.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"truncate text-sm font-medium text-fg",children:y.clientName}),t.jsx(be,{variant:y.access==="write"?"warning":"neutral",children:y.access==="write"?"read & write":"read"})]}),t.jsxs("p",{className:"mt-0.5 truncate text-xs text-fg-muted",children:[i&&t.jsxs(t.Fragment,{children:[y.userEmail," · "]}),y.redirectHost," · connected ",Kr(y.createdAt)," · ",y.lastUsedAt?`last used ${Kr(y.lastUsedAt)}`:"not used yet"]})]}),t.jsx(V,{size:"sm",variant:"ghost",leftIcon:t.jsx(fm,{className:"size-3.5"}),onClick:()=>f(y),children:"Disconnect"})]},y.id))})]}),t.jsx(Ht,{open:h!==null,onClose:()=>f(null),title:"Disconnect client",description:h?`${h.clientName} (${h.userEmail}) loses access on its next call. Connecting again needs a new sign-in.`:void 0,confirmText:"Disconnect",danger:!0,loading:d.isPending,onConfirm:()=>h&&d.mutate(h.id,{onSuccess:()=>{X.success(`${h.clientName} disconnected`),f(null)},onError:y=>X.error(ve(y))})})]})}const O3=["connections","attention","sso","mcp","license","about"];function A3(){const{tab:e}=Fn(),n=un();if(!e||!O3.includes(e))return t.jsx(Vr,{to:"/settings/connections",replace:!0});const r=e;return t.jsxs(bt,{children:[t.jsx(gs,{title:"Settings"}),t.jsx(Um,{"aria-label":"Settings sections",className:"mb-5",value:r,onChange:i=>n(`/settings/${i}`),items:[{value:"connections",label:"Connections",icon:t.jsx(Va,{className:"size-3.5"})},{value:"attention",label:"Attention",icon:t.jsx(ts,{className:"size-3.5"})},{value:"sso",label:"SSO",icon:t.jsx(Gu,{className:"size-3.5"})},{value:"mcp",label:"MCP",icon:t.jsx(Ay,{className:"size-3.5"})},{value:"license",label:"License",icon:t.jsx(al,{className:"size-3.5"})},{value:"about",label:"About",icon:t.jsx(Ha,{className:"size-3.5"})}]}),r==="connections"&&t.jsx(S3,{}),r==="attention"&&t.jsx(j3,{}),r==="sso"&&t.jsx(M3,{}),r==="mcp"&&t.jsx(I3,{}),r==="license"&&t.jsx(P3,{}),r==="about"&&t.jsx(E3,{})]})}const L3=[{label:"Any time",ms:0},{label:"Next hour",ms:36e5},{label:"Next 24 hours",ms:864e5},{label:"Next 7 days",ms:6048e5}];function F3(){var r;const e=xs();if(e.isLoading)return t.jsx(bt,{children:t.jsx(Kt,{label:"Loading…"})});const n=(r=e.data)==null?void 0:r[0];return n?t.jsx(Vr,{to:ue.schedulers(n.id),replace:!0}):t.jsx(bt,{children:t.jsx(cn,{icon:t.jsx(Lo,{}),title:"No connections",description:"Add a Redis connection first; schedulers are listed per connection."})})}function D3(){var p;const{connectionId:e}=Fn(),n=xs(),r=un(),[i,o]=w.useState(""),[c,d]=w.useState(0),h=j2(e,{...i.trim()?{q:i.trim()}:{},...c>0?{withinMs:c}:{}}),f=((p=h.data)==null?void 0:p.schedulers)??[],g=h.data;return t.jsxs(bt,{children:[t.jsx(gs,{title:"Schedulers",description:g?`${K(g.total)} across ${K(g.queuesWithSchedulers)} of ${K(g.queuesScanned)} queues`:void 0,actions:n.data&&n.data.length>1?t.jsx(dt,{"aria-label":"Connection",value:e??"",onChange:v=>r(ue.schedulers(v.target.value)),children:n.data.map(v=>t.jsx("option",{value:v.id,children:v.name},v.id))}):void 0}),t.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[t.jsx(Te,{value:i,onChange:v=>o(v.target.value),placeholder:"Filter by scheduler id, job name or queue…","aria-label":"Filter schedulers",leftIcon:t.jsx(Yn,{className:"size-3.5"}),className:"w-full sm:w-80"}),t.jsx(dt,{"aria-label":"Next run within",value:String(c),onChange:v=>d(Number(v.target.value)),children:L3.map(v=>t.jsx("option",{value:v.ms,children:v.label},v.ms))}),h.isFetching&&t.jsx(Kt,{className:"size-3.5"})]}),g&&g.failed.length>0&&t.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-fg-muted",children:[t.jsx(ts,{className:"mt-0.5 size-3.5 shrink-0 text-warning","aria-hidden":!0}),t.jsxs("span",{children:["Could not read schedulers from ",g.failed.length," queue",g.failed.length===1?"":"s",":"," ",t.jsx("span",{className:"font-mono",children:g.failed.map(v=>v.queueName).join(", ")}),". The rest of the list is complete."]})]}),t.jsx("div",{className:"card overflow-hidden",children:t.jsxs(ms,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{children:"Queue"}),t.jsx(pe,{children:"Scheduler"}),t.jsx(pe,{children:"Job name"}),t.jsx(pe,{children:"Repeats"}),t.jsx(pe,{align:"right",children:"Next run"})]})}),t.jsxs("tbody",{children:[h.isLoading&&t.jsx(yt,{colSpan:5,children:t.jsx(Kt,{label:"Reading schedulers…"})}),h.isError&&!g&&t.jsx(yt,{colSpan:5,className:"text-danger",children:ve(h.error)}),g&&f.length===0&&t.jsx(yt,{colSpan:5,children:t.jsx(Q3,{filtered:!!i.trim()||c>0,total:g.total})}),f.map(v=>t.jsx(U3,{s:v,connectionId:e},`${v.queueName}:${v.key}`))]})]})}),g&&f.length>0&&f.length<g.total&&t.jsxs("p",{className:"mt-2 text-[11px] text-fg-subtle",children:["Showing ",K(f.length)," of ",K(g.total),". Narrow the filter to see the rest."]})]})}function U3({s:e,connectionId:n}){const r=e.next!=null&&e.next<=Date.now();return t.jsxs(cl,{children:[t.jsx(xe,{children:t.jsx(Ee,{to:ue.queueSchedulers(n,e.queueName),className:"text-accent hover:underline",children:e.queueName})}),t.jsx(xe,{mono:!0,children:t.jsx("span",{className:"text-fg",title:e.key,children:e.key})}),t.jsx(xe,{mono:!0,muted:!0,children:e.name}),t.jsx(xe,{children:t.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[t.jsx(be,{variant:"outline",size:"xs",className:"font-mono",children:hj(e)}),e.tz&&t.jsx("span",{className:"text-[11px] text-fg-subtle",children:e.tz}),e.iterationCount===0&&t.jsx("span",{className:"text-[11px] text-warning",title:"This scheduler has never produced a job",children:"never ran"})]})}),t.jsx(xe,{align:"right",num:!0,children:e.next==null?t.jsx("span",{className:"text-fg-subtle",title:"No next run: the scheduler ended or hit its limit",children:"–"}):t.jsxs("span",{className:F("inline-flex items-center gap-1",r&&"text-warning"),title:gn(e.next),children:[r&&t.jsx(Dy,{className:"size-3","aria-hidden":!0}),Kr(e.next)]})})]})}function Q3({filtered:e,total:n}){return e&&n>0?t.jsxs("div",{className:"py-6 text-center text-sm text-fg-muted",children:["No scheduler matches this filter. This connection has ",K(n)," in total."]}):t.jsxs("div",{className:"mx-auto flex max-w-xl flex-col items-center gap-2 py-6 text-center",children:[t.jsx(Lo,{className:"size-6 text-fg-subtle","aria-hidden":!0}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"No job schedulers on this connection"}),t.jsx("p",{className:"text-xs text-fg-muted",children:"A job scheduler (BullMQ calls it a repeatable job) stamps out the same job on a cron pattern or a fixed interval. It lives outside the job states, so it never shows up under Waiting or Delayed — only the single job it has queued next does."}),t.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] text-fg-subtle",children:[t.jsx(Wy,{className:"size-3","aria-hidden":!0}),"Create one with ",t.jsx("span",{className:"font-mono",children:"queue.upsertJobScheduler()"}),"."]})]})}function B3(){return t.jsx(bt,{children:t.jsx(cn,{icon:t.jsx(gN,{}),title:"Page not found",description:"The link may be stale, or the queue or connection was removed.",action:t.jsx(Ee,{to:"/",className:"text-accent hover:underline",children:"Back to overview"})})})}const V3=w.lazy(()=>Bu(()=>import("./FlowsPage-Cp6TR7Wa.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.FlowsPage}))),H3=w.lazy(()=>Bu(()=>import("./FlowsPage-Cp6TR7Wa.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.FlowsIndexPage}))),K3=w.lazy(()=>Bu(()=>import("./McpConsentPage-CI53cgZX.js"),[]).then(e=>({default:e.McpConsentPage}))),W3=w.lazy(()=>Bu(()=>import("./JobTreePage-CbwbeeRl.js"),__vite__mapDeps([4,1,2])).then(e=>({default:e.JobTreePage})));function pu({children:e}){return t.jsx(w.Suspense,{fallback:t.jsx(il,{}),children:e})}const Z3=new tN({defaultOptions:{queries:{retry:(e,n)=>Ts(n)&&n.status>0&&n.status<500?!1:e<2,retryDelay:e=>Math.min(1e3*2**e,8e3),staleTime:1e3,refetchOnWindowFocus:!0,refetchIntervalInBackground:!1},mutations:{retry:!1}}});function G3(){return t.jsx(_w,{client:Z3,children:t.jsx(bw,{children:t.jsxs(Wk,{children:[t.jsxs(hw,{children:[t.jsx(ct,{path:"/login",element:t.jsx(iv,{children:t.jsx(PS,{})})}),t.jsx(ct,{path:"/setup",element:t.jsx(iv,{children:t.jsx(ES,{})})}),t.jsx(ct,{path:"/oauth/consent",element:t.jsx(pu,{children:t.jsx(K3,{})})}),t.jsx(ct,{element:t.jsx(Zk,{}),children:t.jsxs(ct,{element:t.jsx(_S,{}),children:[t.jsx(ct,{index:!0,element:t.jsx(oC,{})}),t.jsx(ct,{path:"c/:connectionId",element:t.jsx(uC,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue",element:t.jsx(sf,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/metrics",element:t.jsx(sf,{view:"metrics"})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/schedulers",element:t.jsx(sf,{view:"schedulers"})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/groups",element:t.jsx(B_,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/groups/:groupId",element:t.jsx(Z_,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/j/:jobId",element:t.jsx(O_,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/j/:jobId/tree",element:t.jsx(pu,{children:t.jsx(W3,{})})}),t.jsx(ct,{path:"health",element:t.jsx(yC,{})}),t.jsx(ct,{path:"schedulers",element:t.jsx(F3,{})}),t.jsx(ct,{path:"schedulers/:connectionId",element:t.jsx(D3,{})}),t.jsx(ct,{path:"folders",element:t.jsx(G_,{})}),t.jsx(ct,{path:"folders/:folderId",element:t.jsx(l3,{})}),t.jsx(ct,{path:"alerts",element:t.jsx(N_,{})}),t.jsx(ct,{path:"users",element:t.jsx(u3,{})}),t.jsx(ct,{path:"audit",element:t.jsx(p3,{})}),t.jsxs(t.Fragment,{children:[t.jsx(ct,{path:"flows",element:t.jsx(pu,{children:t.jsx(H3,{})})}),t.jsx(ct,{path:"flows/:connectionId",element:t.jsx(pu,{children:t.jsx(V3,{})})})]}),t.jsx(ct,{path:"settings",element:t.jsx(Vr,{to:"/settings/connections",replace:!0})}),t.jsx(ct,{path:"settings/:tab",element:t.jsx(A3,{})}),t.jsx(ct,{path:"*",element:t.jsx(B3,{})})]})})]}),t.jsx(e2,{}),t.jsx(Kk,{})]})})})}bb.createRoot(document.getElementById("root")).render(t.jsx(w.StrictMode,{children:t.jsx(G3,{})}));export{mt as $,h5 as A,V as B,Dn as C,Va as D,Br as E,f5 as F,p5 as G,x5 as H,Te as I,g5 as J,m5 as K,Ee as L,d5 as M,Ts as N,cn as O,es as P,Uy as Q,ON as R,Cu as S,Pe as T,u5 as U,Uo as V,DN as W,vn as X,Un as Y,Ht as Z,un as _,Yu as a,s5 as a0,r5 as a1,a5 as a2,dm as a3,Ha as a4,wt as a5,Wa as a6,Fn as a7,sl as a8,i5 as a9,Ay as aa,Ln as ab,Z0 as ac,ts as ad,Vr as ae,v5 as af,y5 as ag,n5 as ah,bt as ai,gs as aj,kN as ak,ad as al,Vy as am,FS as an,Kr as ao,Gf as ap,db as aq,pb as ar,X3 as as,F as b,ie as c,Kt as d,K as e,ft as f,lt as g,be as h,ue as i,t as j,Yn as k,Zr as l,e5 as m,o5 as n,bn as o,Yi as p,dt as q,w as r,t5 as s,X as t,ll as u,ve as v,So as w,c5 as x,l5 as y,xs as z};