bullpane 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,553 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowsPage-BVM22MG9.js","assets/flowLayout-Bwc9MVRI.js","assets/flowLayout-BnuhLJ6X.css","assets/JobTreePage-BZbwFo2w.js"])))=>i.map(i=>d[i]);
2
+ var ib=Object.defineProperty;var fg=e=>{throw TypeError(e)};var lb=(e,n,r)=>n in e?ib(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var Dh=(e,n,r)=>lb(e,typeof n!="symbol"?n+"":n,r),Uh=(e,n,r)=>n.has(e)||fg("Cannot "+r);var _=(e,n,r)=>(Uh(e,n,"read from private field"),r?r.call(e):n.get(e)),ge=(e,n,r)=>n.has(e)?fg("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,r),te=(e,n,r,i)=>(Uh(e,n,"write to private field"),i?i.call(e,r):n.set(e,r),r),Re=(e,n,r)=>(Uh(e,n,"access private method"),r);var lu=(e,n,r,i)=>({set _(o){te(e,n,o,r)},get _(){return _(e,n,i)}});function ob(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 cb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qh={exports:{}},so={},Bh={exports:{}},Ve={};/**
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 mg;function ub(){if(mg)return Ve;mg=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,Le){this.props=A,this.context=Z,this.refs=b,this.updater=Le||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,Le){this.props=A,this.context=Z,this.refs=b,this.updater=Le||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},$={key:!0,ref:!0,__self:!0,__source:!0};function Q(A,Z,Le){var De,Se={},Ue=null,rt=null;if(Z!=null)for(De in Z.ref!==void 0&&(rt=Z.ref),Z.key!==void 0&&(Ue=""+Z.key),Z)M.call(Z,De)&&!$.hasOwnProperty(De)&&(Se[De]=Z[De]);var Be=arguments.length-2;if(Be===1)Se.children=Le;else if(1<Be){for(var at=Array(Be),Wt=0;Wt<Be;Wt++)at[Wt]=arguments[Wt+2];Se.children=at}if(A&&A.defaultProps)for(De in Be=A.defaultProps,Be)Se[De]===void 0&&(Se[De]=Be[De]);return{$$typeof:e,type:A,key:Ue,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(Le){return Z[Le]})}var ue=/\/+/g;function oe(A,Z){return typeof A=="object"&&A!==null&&A.key!=null?B(""+A.key):Z.toString(36)}function Ne(A,Z,Le,De,Se){var Ue=typeof A;(Ue==="undefined"||Ue==="boolean")&&(A=null);var rt=!1;if(A===null)rt=!0;else switch(Ue){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=De===""?"."+oe(rt,0):De,T(Se)?(Le="",A!=null&&(Le=A.replace(ue,"$&/")+"/"),Ne(Se,Z,Le,"",function(Wt){return Wt})):Se!=null&&(q(Se)&&(Se=H(Se,Le+(!Se.key||rt&&rt.key===Se.key?"":(""+Se.key).replace(ue,"$&/")+"/")+A)),Z.push(Se)),1;if(rt=0,De=De===""?".":De+":",T(A))for(var Be=0;Be<A.length;Be++){Ue=A[Be];var at=De+oe(Ue,Be);rt+=Ne(Ue,Z,Le,at,Se)}else if(at=j(A),typeof at=="function")for(A=at.call(A),Be=0;!(Ue=A.next()).done;)Ue=Ue.value,at=De+oe(Ue,Be++),rt+=Ne(Ue,Z,Le,at,Se);else if(Ue==="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,Le){if(A==null)return A;var De=[],Se=0;return Ne(A,De,"","",function(Ue){return Z.call(Le,Ue,Se++)}),De}function ot(A){if(A._status===-1){var Z=A._result;Z=Z(),Z.then(function(Le){(A._status===0||A._status===-1)&&(A._status=1,A._result=Le)},function(Le){(A._status===0||A._status===-1)&&(A._status=2,A._result=Le)}),A._status===-1&&(A._status=0,A._result=Z)}if(A._status===1)return A._result.default;throw A._result}var Fe={current:null},W={transition:null},me={ReactCurrentDispatcher:Fe,ReactCurrentBatchConfig:W,ReactCurrentOwner:E};function ne(){throw Error("act(...) is not supported in production builds of React.")}return Ve.Children={map:Ie,forEach:function(A,Z,Le){Ie(A,function(){Z.apply(this,arguments)},Le)},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}},Ve.Component=k,Ve.Fragment=r,Ve.Profiler=o,Ve.PureComponent=z,Ve.StrictMode=i,Ve.Suspense=f,Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=me,Ve.act=ne,Ve.cloneElement=function(A,Z,Le){if(A==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+A+".");var De=y({},A.props),Se=A.key,Ue=A.ref,rt=A._owner;if(Z!=null){if(Z.ref!==void 0&&(Ue=Z.ref,rt=E.current),Z.key!==void 0&&(Se=""+Z.key),A.type&&A.type.defaultProps)var Be=A.type.defaultProps;for(at in Z)M.call(Z,at)&&!$.hasOwnProperty(at)&&(De[at]=Z[at]===void 0&&Be!==void 0?Be[at]:Z[at])}var at=arguments.length-2;if(at===1)De.children=Le;else if(1<at){Be=Array(at);for(var Wt=0;Wt<at;Wt++)Be[Wt]=arguments[Wt+2];De.children=Be}return{$$typeof:e,type:A.type,key:Se,ref:Ue,props:De,_owner:rt}},Ve.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},Ve.createElement=Q,Ve.createFactory=function(A){var Z=Q.bind(null,A);return Z.type=A,Z},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(A){return{$$typeof:h,render:A}},Ve.isValidElement=q,Ve.lazy=function(A){return{$$typeof:p,_payload:{_status:-1,_result:A},_init:ot}},Ve.memo=function(A,Z){return{$$typeof:g,type:A,compare:Z===void 0?null:Z}},Ve.startTransition=function(A){var Z=W.transition;W.transition={};try{A()}finally{W.transition=Z}},Ve.unstable_act=ne,Ve.useCallback=function(A,Z){return Fe.current.useCallback(A,Z)},Ve.useContext=function(A){return Fe.current.useContext(A)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(A){return Fe.current.useDeferredValue(A)},Ve.useEffect=function(A,Z){return Fe.current.useEffect(A,Z)},Ve.useId=function(){return Fe.current.useId()},Ve.useImperativeHandle=function(A,Z,Le){return Fe.current.useImperativeHandle(A,Z,Le)},Ve.useInsertionEffect=function(A,Z){return Fe.current.useInsertionEffect(A,Z)},Ve.useLayoutEffect=function(A,Z){return Fe.current.useLayoutEffect(A,Z)},Ve.useMemo=function(A,Z){return Fe.current.useMemo(A,Z)},Ve.useReducer=function(A,Z,Le){return Fe.current.useReducer(A,Z,Le)},Ve.useRef=function(A){return Fe.current.useRef(A)},Ve.useState=function(A){return Fe.current.useState(A)},Ve.useSyncExternalStore=function(A,Z,Le){return Fe.current.useSyncExternalStore(A,Z,Le)},Ve.useTransition=function(){return Fe.current.useTransition()},Ve.version="18.3.1",Ve}var pg;function Wf(){return pg||(pg=1,Bh.exports=ub()),Bh.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 xg;function db(){if(xg)return so;xg=1;var e=Wf(),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 so.Fragment=r,so.jsx=d,so.jsxs=d,so}var gg;function hb(){return gg||(gg=1,Qh.exports=db()),Qh.exports}var t=hb(),w=Wf();const fb=cb(w),mb=ob({__proto__:null,default:fb},[w]);var ou={},Vh={exports:{}},Cn={},Hh={exports:{}},Kh={};/**
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 vg;function pb(){return vg||(vg=1,(function(e){function n(W,me){var ne=W.length;W.push(me);e:for(;0<ne;){var A=ne-1>>>1,Z=W[A];if(0<o(Z,me))W[A]=me,W[ne]=Z,ne=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],ne=W.pop();if(ne!==me){W[0]=ne;e:for(var A=0,Z=W.length,Le=Z>>>1;A<Le;){var De=2*(A+1)-1,Se=W[De],Ue=De+1,rt=W[Ue];if(0>o(Se,ne))Ue<Z&&0>o(rt,Se)?(W[A]=rt,W[Ue]=ne,A=Ue):(W[A]=Se,W[De]=ne,A=De);else if(Ue<Z&&0>o(rt,ne))W[A]=rt,W[Ue]=ne,A=Ue;else break e}}return me}function o(W,me){var ne=W.sortIndex-me.sortIndex;return ne!==0?ne: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&&Fe(T,me.startTime-W)}}function M(W,me){y=!1,b&&(b=!1,C(Q),Q=-1),S=!0;var ne=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 Le=!0;else{var De=r(g);De!==null&&Fe(T,De.startTime-me),Le=!1}return Le}finally{v=null,j=ne,S=!1}}var E=!1,$=null,Q=-1,H=5,q=-1;function B(){return!(e.unstable_now()-q<H)}function ue(){if($!==null){var W=e.unstable_now();q=W;var me=!0;try{me=$(!0,W)}finally{me?oe():(E=!1,$=null)}}else E=!1}var oe;if(typeof z=="function")oe=function(){z(ue)};else if(typeof MessageChannel<"u"){var Ne=new MessageChannel,Ie=Ne.port2;Ne.port1.onmessage=ue,oe=function(){Ie.postMessage(null)}}else oe=function(){k(ue,0)};function ot(W){$=W,E||(E=!0,oe())}function Fe(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 ne=j;j=me;try{return W()}finally{j=ne}},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 ne=j;j=W;try{return me()}finally{j=ne}},e.unstable_scheduleCallback=function(W,me,ne){var A=e.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?A+ne:A):ne=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=ne+Z,W={id:p++,callback:me,priorityLevel:W,startTime:ne,expirationTime:Z,sortIndex:-1},ne>A?(W.sortIndex=ne,n(g,W),r(f)===null&&W===r(g)&&(b?(C(Q),Q=-1):b=!0,Fe(T,ne-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 ne=j;j=me;try{return W.apply(this,arguments)}finally{j=ne}}}})(Kh)),Kh}var yg;function xb(){return yg||(yg=1,Hh.exports=pb()),Hh.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 jg;function gb(){if(jg)return Cn;jg=1;var e=Wf(),n=xb();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"),$=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"),ue=Symbol.for("react.forward_ref"),oe=Symbol.for("react.suspense"),Ne=Symbol.for("react.suspense_list"),Ie=Symbol.for("react.memo"),ot=Symbol.for("react.lazy"),Fe=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 ne=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 Le=!1;function De(s,a){if(!s||Le)return"";Le=!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{Le=!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=De(s.type,!1),s;case 11:return s=De(s.type.render,!1),s;case 1:return s=De(s.type,!0),s;default:return""}}function Ue(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 $:return"Fragment";case E:return"Portal";case H:return"Profiler";case Q:return"StrictMode";case oe: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 ue: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:Ue(s.type)||"Memo";case ot:a=s._payload,s=s._init;try{return Ue(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 Ue(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 Be(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 Wt(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=Wt(s))}function cl(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 Ka(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 Xr(s,a){var l=a.checked;return ne({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??s._wrapperState.initialChecked})}function Yr(s,a){var l=a.defaultValue==null?"":a.defaultValue,u=a.checked!=null?a.checked:a.defaultChecked;l=Be(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 Wa(s,a){a=a.checked,a!=null&&O(s,"checked",a,!1)}function ea(s,a){Wa(s,a);var l=Be(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")?ul(s,a.type,l):a.hasOwnProperty("defaultValue")&&ul(s,a.type,Be(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(s.defaultChecked=!!a.defaultChecked)}function Za(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 ul(s,a,l){(a!=="number"||Ka(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=""+Be(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 Ft(s,a){if(a.dangerouslySetInnerHTML!=null)throw Error(r(91));return ne({},a,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function Ho(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:Be(l)}}function Ga(s,a){var l=Be(a.value),u=Be(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 Ko(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 Ja(s,a){return s==null||s==="http://www.w3.org/1999/xhtml"?Ko(a):s==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var ta,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(ta=ta||document.createElement("div"),ta.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=ta.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;a.firstChild;)s.appendChild(a.firstChild)}});function $s(s,a){if(a){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=a;return}}s.textContent=a}var zs={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(zs).forEach(function(s){Nt.forEach(function(a){a=a+s.charAt(0).toUpperCase()+s.substring(1),zs[a]=zs[s]})});function dl(s,a,l){return a==null||typeof a=="boolean"||a===""?"":l||typeof a!="number"||a===0||zs.hasOwnProperty(s)&&zs[s]?(""+a).trim():a+"px"}function $t(s,a){s=s.style;for(var l in a)if(a.hasOwnProperty(l)){var u=l.indexOf("--")===0,m=dl(l,a[l],u);l==="float"&&(l="cssFloat"),u?s.setProperty(l,m):s[l]=m}}var Wo=ne({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 hl(s,a){if(a){if(Wo[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 na(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 Xa=null;function Ya(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ei=null,Os=null,Bn=null;function Zo(s){if(s=Ul(s)){if(typeof ei!="function")throw Error(r(280));var a=s.stateNode;a&&(a=wc(a),ei(s.stateNode,s.type,a))}}function sa(s){Os?Bn?Bn.push(s):Bn=[s]:Os=s}function fl(){if(Os){var s=Os,a=Bn;if(Bn=Os=null,Zo(s),a)for(s=0;s<a.length;s++)Zo(a[s])}}function ml(s,a){return s(a)}function pl(){}var ti=!1;function xl(s,a,l){if(ti)return s(a,l);ti=!0;try{return ml(s,a,l)}finally{ti=!1,(Os!==null||Bn!==null)&&(pl(),fl())}}function cr(s,a){var l=s.stateNode;if(l===null)return null;var u=wc(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 ni=!1;if(h)try{var ur={};Object.defineProperty(ur,"passive",{get:function(){ni=!0}}),window.addEventListener("test",ur,ur),window.removeEventListener("test",ur,ur)}catch{ni=!1}function Go(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,ra=null,aa=!1,si=null,Jo={onError:function(s){dr=!0,ra=s}};function Xo(s,a,l,u,m,x,N,P,R){dr=!1,ra=null,Go.apply(Jo,arguments)}function Yo(s,a,l,u,m,x,N,P,R){if(Xo.apply(this,arguments),dr){if(dr){var U=ra;dr=!1,ra=null}else throw Error(r(198));aa||(aa=!0,si=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 gl(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 vl(s){if(ys(s)!==s)throw Error(r(188))}function ec(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 vl(m),s;if(x===u)return vl(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 yl(s){return s=ec(s),s!==null?jl(s):null}function jl(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var a=jl(s);if(a!==null)return a;s=s.sibling}return null}var bl=n.unstable_scheduleCallback,wl=n.unstable_cancelCallback,tc=n.unstable_shouldYield,nc=n.unstable_requestPaint,gt=n.unstable_now,ae=n.unstable_getCurrentPriorityLevel,tt=n.unstable_ImmediatePriority,Ye=n.unstable_UserBlockingPriority,Mt=n.unstable_NormalPriority,Nl=n.unstable_LowPriority,Qm=n.unstable_IdlePriority,sc=null,js=null;function bj(s){if(js&&typeof js.onCommitFiberRoot=="function")try{js.onCommitFiberRoot(sc,s,void 0,(s.current.flags&128)===128)}catch{}}var rs=Math.clz32?Math.clz32:kj,wj=Math.log,Nj=Math.LN2;function kj(s){return s>>>=0,s===0?32:31-(wj(s)/Nj|0)|0}var rc=64,ac=4194304;function kl(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 ic(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=kl(P):(x&=N,x!==0&&(u=kl(x)))}else N=l&~m,N!==0?u=kl(N):x!==0&&(u=kl(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 Sj(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 Cj(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]=Sj(P,a)):R<=a&&(s.expiredLanes|=P),x&=~P}}function od(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function Bm(){var s=rc;return rc<<=1,(rc&4194240)===0&&(rc=64),s}function cd(s){for(var a=[],l=0;31>l;l++)a.push(s);return a}function Sl(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 _j(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 ud(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 Vm(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Hm,dd,Km,Wm,Zm,hd=!1,lc=[],hr=null,fr=null,mr=null,Cl=new Map,_l=new Map,pr=[],Pj="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 Gm(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":Cl.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":_l.delete(a.pointerId)}}function Pl(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=Ul(a),a!==null&&dd(a)),s):(s.eventSystemFlags|=u,a=s.targetContainers,m!==null&&a.indexOf(m)===-1&&a.push(m),s)}function Ej(s,a,l,u,m){switch(a){case"focusin":return hr=Pl(hr,s,a,l,u,m),!0;case"dragenter":return fr=Pl(fr,s,a,l,u,m),!0;case"mouseover":return mr=Pl(mr,s,a,l,u,m),!0;case"pointerover":var x=m.pointerId;return Cl.set(x,Pl(Cl.get(x)||null,s,a,l,u,m)),!0;case"gotpointercapture":return x=m.pointerId,_l.set(x,Pl(_l.get(x)||null,s,a,l,u,m)),!0}return!1}function Jm(s){var a=ia(s.target);if(a!==null){var l=ys(a);if(l!==null){if(a=l.tag,a===13){if(a=gl(l),a!==null){s.blockedOn=a,Zm(s.priority,function(){Km(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 oc(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var l=md(s.domEventName,s.eventSystemFlags,a[0],s.nativeEvent);if(l===null){l=s.nativeEvent;var u=new l.constructor(l.type,l);Xa=u,l.target.dispatchEvent(u),Xa=null}else return a=Ul(l),a!==null&&dd(a),s.blockedOn=l,!1;a.shift()}return!0}function Xm(s,a,l){oc(s)&&l.delete(a)}function Rj(){hd=!1,hr!==null&&oc(hr)&&(hr=null),fr!==null&&oc(fr)&&(fr=null),mr!==null&&oc(mr)&&(mr=null),Cl.forEach(Xm),_l.forEach(Xm)}function El(s,a){s.blockedOn===a&&(s.blockedOn=null,hd||(hd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Rj)))}function Rl(s){function a(m){return El(m,s)}if(0<lc.length){El(lc[0],s);for(var l=1;l<lc.length;l++){var u=lc[l];u.blockedOn===s&&(u.blockedOn=null)}}for(hr!==null&&El(hr,s),fr!==null&&El(fr,s),mr!==null&&El(mr,s),Cl.forEach(a),_l.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);)Jm(l),l.blockedOn===null&&pr.shift()}var ri=T.ReactCurrentBatchConfig,cc=!0;function Mj(s,a,l,u){var m=it,x=ri.transition;ri.transition=null;try{it=1,fd(s,a,l,u)}finally{it=m,ri.transition=x}}function Tj(s,a,l,u){var m=it,x=ri.transition;ri.transition=null;try{it=4,fd(s,a,l,u)}finally{it=m,ri.transition=x}}function fd(s,a,l,u){if(cc){var m=md(s,a,l,u);if(m===null)Md(s,a,u,uc,l),Gm(s,u);else if(Ej(m,s,a,l,u))u.stopPropagation();else if(Gm(s,u),a&4&&-1<Pj.indexOf(s)){for(;m!==null;){var x=Ul(m);if(x!==null&&Hm(x),x=md(s,a,l,u),x===null&&Md(s,a,u,uc,l),x===m)break;m=x}m!==null&&u.stopPropagation()}else Md(s,a,u,null,l)}}var uc=null;function md(s,a,l,u){if(uc=null,s=Ya(u),s=ia(s),s!==null)if(a=ys(s),a===null)s=null;else if(l=a.tag,l===13){if(s=gl(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 uc=s,null}function Ym(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(ae()){case tt:return 1;case Ye:return 4;case Mt:case Nl:return 16;case Qm:return 536870912;default:return 16}default:return 16}}var xr=null,pd=null,dc=null;function ep(){if(dc)return dc;var s,a=pd,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 dc=m.slice(s,1<u?1-u:void 0)}function hc(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 fc(){return!0}function tp(){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)?fc:tp,this.isPropagationStopped=tp,this}return ne(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=fc)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=fc)},persist:function(){},isPersistent:fc}),a}var ai={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xd=Mn(ai),Ml=ne({},ai,{view:0,detail:0}),qj=Mn(Ml),gd,vd,Tl,mc=ne({},Ml,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jd,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!==Tl&&(Tl&&s.type==="mousemove"?(gd=s.screenX-Tl.screenX,vd=s.screenY-Tl.screenY):vd=gd=0,Tl=s),gd)},movementY:function(s){return"movementY"in s?s.movementY:vd}}),np=Mn(mc),Ij=ne({},mc,{dataTransfer:0}),$j=Mn(Ij),zj=ne({},Ml,{relatedTarget:0}),yd=Mn(zj),Oj=ne({},ai,{animationName:0,elapsedTime:0,pseudoElement:0}),Aj=Mn(Oj),Lj=ne({},ai,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Fj=Mn(Lj),Dj=ne({},ai,{data:0}),sp=Mn(Dj),Uj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Qj={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"},Bj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Vj(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=Bj[s])?!!a[s]:!1}function jd(){return Vj}var Hj=ne({},Ml,{key:function(s){if(s.key){var a=Uj[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=hc(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Qj[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jd,charCode:function(s){return s.type==="keypress"?hc(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?hc(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Kj=Mn(Hj),Wj=ne({},mc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),rp=Mn(Wj),Zj=ne({},Ml,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jd}),Gj=Mn(Zj),Jj=ne({},ai,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xj=Mn(Jj),Yj=ne({},mc,{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}),e1=Mn(Yj),t1=[9,13,27,32],bd=h&&"CompositionEvent"in window,ql=null;h&&"documentMode"in document&&(ql=document.documentMode);var n1=h&&"TextEvent"in window&&!ql,ap=h&&(!bd||ql&&8<ql&&11>=ql),ip=" ",lp=!1;function op(s,a){switch(s){case"keyup":return t1.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cp(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ii=!1;function s1(s,a){switch(s){case"compositionend":return cp(a);case"keypress":return a.which!==32?null:(lp=!0,ip);case"textInput":return s=a.data,s===ip&&lp?null:s;default:return null}}function r1(s,a){if(ii)return s==="compositionend"||!bd&&op(s,a)?(s=ep(),dc=pd=xr=null,ii=!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 ap&&a.locale!=="ko"?null:a.data;default:return null}}var a1={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 up(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!a1[s.type]:a==="textarea"}function dp(s,a,l,u){sa(u),a=yc(a,"onChange"),0<a.length&&(l=new xd("onChange","change",null,l,u),s.push({event:l,listeners:a}))}var Il=null,$l=null;function i1(s){Ep(s,0)}function pc(s){var a=di(s);if(cl(a))return s}function l1(s,a){if(s==="change")return a}var hp=!1;if(h){var wd;if(h){var Nd="oninput"in document;if(!Nd){var fp=document.createElement("div");fp.setAttribute("oninput","return;"),Nd=typeof fp.oninput=="function"}wd=Nd}else wd=!1;hp=wd&&(!document.documentMode||9<document.documentMode)}function mp(){Il&&(Il.detachEvent("onpropertychange",pp),$l=Il=null)}function pp(s){if(s.propertyName==="value"&&pc($l)){var a=[];dp(a,$l,s,Ya(s)),xl(i1,a)}}function o1(s,a,l){s==="focusin"?(mp(),Il=a,$l=l,Il.attachEvent("onpropertychange",pp)):s==="focusout"&&mp()}function c1(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return pc($l)}function u1(s,a){if(s==="click")return pc(a)}function d1(s,a){if(s==="input"||s==="change")return pc(a)}function h1(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var as=typeof Object.is=="function"?Object.is:h1;function zl(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 xp(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function gp(s,a){var l=xp(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=xp(l)}}function vp(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?vp(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function yp(){for(var s=window,a=Ka();a instanceof s.HTMLIFrameElement;){try{var l=typeof a.contentWindow.location.href=="string"}catch{l=!1}if(l)s=a.contentWindow;else break;a=Ka(s.document)}return a}function kd(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 f1(s){var a=yp(),l=s.focusedElem,u=s.selectionRange;if(a!==l&&l&&l.ownerDocument&&vp(l.ownerDocument.documentElement,l)){if(u!==null&&kd(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=gp(l,x);var N=gp(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 m1=h&&"documentMode"in document&&11>=document.documentMode,li=null,Sd=null,Ol=null,Cd=!1;function jp(s,a,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Cd||li==null||li!==Ka(u)||(u=li,"selectionStart"in u&&kd(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}),Ol&&zl(Ol,u)||(Ol=u,u=yc(Sd,"onSelect"),0<u.length&&(a=new xd("onSelect","select",null,a,l),s.push({event:a,listeners:u}),a.target=li)))}function xc(s,a){var l={};return l[s.toLowerCase()]=a.toLowerCase(),l["Webkit"+s]="webkit"+a,l["Moz"+s]="moz"+a,l}var oi={animationend:xc("Animation","AnimationEnd"),animationiteration:xc("Animation","AnimationIteration"),animationstart:xc("Animation","AnimationStart"),transitionend:xc("Transition","TransitionEnd")},_d={},bp={};h&&(bp=document.createElement("div").style,"AnimationEvent"in window||(delete oi.animationend.animation,delete oi.animationiteration.animation,delete oi.animationstart.animation),"TransitionEvent"in window||delete oi.transitionend.transition);function gc(s){if(_d[s])return _d[s];if(!oi[s])return s;var a=oi[s],l;for(l in a)if(a.hasOwnProperty(l)&&l in bp)return _d[s]=a[l];return s}var wp=gc("animationend"),Np=gc("animationiteration"),kp=gc("animationstart"),Sp=gc("transitionend"),Cp=new Map,_p="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){Cp.set(s,a),c(a,[s])}for(var Pd=0;Pd<_p.length;Pd++){var Ed=_p[Pd],p1=Ed.toLowerCase(),x1=Ed[0].toUpperCase()+Ed.slice(1);gr(p1,"on"+x1)}gr(wp,"onAnimationEnd"),gr(Np,"onAnimationIteration"),gr(kp,"onAnimationStart"),gr("dblclick","onDoubleClick"),gr("focusin","onFocus"),gr("focusout","onBlur"),gr(Sp,"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 Al="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(" "),g1=new Set("cancel close invalid load scroll toggle".split(" ").concat(Al));function Pp(s,a,l){var u=s.type||"unknown-event";s.currentTarget=l,Yo(u,a,void 0,s),s.currentTarget=null}function Ep(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;Pp(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;Pp(m,P,U),x=R}}}if(aa)throw s=si,aa=!1,si=null,s}function pt(s,a){var l=a[Od];l===void 0&&(l=a[Od]=new Set);var u=s+"__bubble";l.has(u)||(Rp(a,s,2,!1),l.add(u))}function Rd(s,a,l){var u=0;a&&(u|=4),Rp(l,s,u,a)}var vc="_reactListening"+Math.random().toString(36).slice(2);function Ll(s){if(!s[vc]){s[vc]=!0,i.forEach(function(l){l!=="selectionchange"&&(g1.has(l)||Rd(l,!1,s),Rd(l,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[vc]||(a[vc]=!0,Rd("selectionchange",!1,a))}}function Rp(s,a,l,u){switch(Ym(a)){case 1:var m=Mj;break;case 4:m=Tj;break;default:m=fd}l=m.bind(null,a,l,s),m=void 0,!ni||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 Md(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=ia(P),N===null)return;if(R=N.tag,R===5||R===6){u=x=N;continue e}P=P.parentNode}}u=u.return}xl(function(){var U=x,J=Ya(l),Y=[];e:{var G=Cp.get(s);if(G!==void 0){var fe=xd,we=s;switch(s){case"keypress":if(hc(l)===0)break e;case"keydown":case"keyup":fe=Kj;break;case"focusin":we="focus",fe=yd;break;case"focusout":we="blur",fe=yd;break;case"beforeblur":case"afterblur":fe=yd;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=np;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=$j;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=Gj;break;case wp:case Np:case kp:fe=Aj;break;case Sp:fe=Xj;break;case"scroll":fe=qj;break;case"wheel":fe=e1;break;case"copy":case"cut":case"paste":fe=Fj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=rp}var ke=(a&4)!==0,Rt=!ke&&s==="scroll",L=ke?G!==null?G+"Capture":null:G;ke=[];for(var I=U,D;I!==null;){D=I;var se=D.stateNode;if(D.tag===5&&se!==null&&(D=se,L!==null&&(se=cr(I,L),se!=null&&ke.push(Fl(I,se,D)))),Rt)break;I=I.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!==Xa&&(we=l.relatedTarget||l.fromElement)&&(ia(we)||we[As]))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?ia(we):null,we!==null&&(Rt=ys(we),we!==Rt||we.tag!==5&&we.tag!==6)&&(we=null)):(fe=null,we=U),fe!==we)){if(ke=np,se="onMouseLeave",L="onMouseEnter",I="mouse",(s==="pointerout"||s==="pointerover")&&(ke=rp,se="onPointerLeave",L="onPointerEnter",I="pointer"),Rt=fe==null?G:di(fe),D=we==null?G:di(we),G=new ke(se,I+"leave",fe,l,J),G.target=Rt,G.relatedTarget=D,se=null,ia(J)===U&&(ke=new ke(L,I+"enter",we,l,J),ke.target=D,ke.relatedTarget=Rt,se=ke),Rt=se,fe&&we)t:{for(ke=fe,L=we,I=0,D=ke;D;D=ci(D))I++;for(D=0,se=L;se;se=ci(se))D++;for(;0<I-D;)ke=ci(ke),I--;for(;0<D-I;)L=ci(L),D--;for(;I--;){if(ke===L||L!==null&&ke===L.alternate)break t;ke=ci(ke),L=ci(L)}ke=null}else ke=null;fe!==null&&Mp(Y,G,fe,ke,!1),we!==null&&Rt!==null&&Mp(Y,Rt,we,ke,!0)}}e:{if(G=U?di(U):window,fe=G.nodeName&&G.nodeName.toLowerCase(),fe==="select"||fe==="input"&&G.type==="file")var Ce=l1;else if(up(G))if(hp)Ce=d1;else{Ce=c1;var Te=o1}else(fe=G.nodeName)&&fe.toLowerCase()==="input"&&(G.type==="checkbox"||G.type==="radio")&&(Ce=u1);if(Ce&&(Ce=Ce(s,U))){dp(Y,Ce,l,J);break e}Te&&Te(s,G,U),s==="focusout"&&(Te=G._wrapperState)&&Te.controlled&&G.type==="number"&&ul(G,"number",G.value)}switch(Te=U?di(U):window,s){case"focusin":(up(Te)||Te.contentEditable==="true")&&(li=Te,Sd=U,Ol=null);break;case"focusout":Ol=Sd=li=null;break;case"mousedown":Cd=!0;break;case"contextmenu":case"mouseup":case"dragend":Cd=!1,jp(Y,l,J);break;case"selectionchange":if(m1)break;case"keydown":case"keyup":jp(Y,l,J)}var qe;if(bd)e:{switch(s){case"compositionstart":var $e="onCompositionStart";break e;case"compositionend":$e="onCompositionEnd";break e;case"compositionupdate":$e="onCompositionUpdate";break e}$e=void 0}else ii?op(s,l)&&($e="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&($e="onCompositionStart");$e&&(ap&&l.locale!=="ko"&&(ii||$e!=="onCompositionStart"?$e==="onCompositionEnd"&&ii&&(qe=ep()):(xr=J,pd="value"in xr?xr.value:xr.textContent,ii=!0)),Te=yc(U,$e),0<Te.length&&($e=new sp($e,s,null,l,J),Y.push({event:$e,listeners:Te}),qe?$e.data=qe:(qe=cp(l),qe!==null&&($e.data=qe)))),(qe=n1?s1(s,l):r1(s,l))&&(U=yc(U,"onBeforeInput"),0<U.length&&(J=new sp("onBeforeInput","beforeinput",null,l,J),Y.push({event:J,listeners:U}),J.data=qe))}Ep(Y,a)})}function Fl(s,a,l){return{instance:s,listener:a,currentTarget:l}}function yc(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(Fl(s,x,m)),x=cr(s,a),x!=null&&u.push(Fl(s,x,m))),s=s.return}return u}function ci(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function Mp(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(Fl(l,R,P))):m||(R=cr(l,x),R!=null&&N.push(Fl(l,R,P)))),l=l.return}N.length!==0&&s.push({event:a,listeners:N})}var v1=/\r\n?/g,y1=/\u0000|\uFFFD/g;function Tp(s){return(typeof s=="string"?s:""+s).replace(v1,`
39
+ `).replace(y1,"")}function jc(s,a,l){if(a=Tp(a),Tp(s)!==a&&l)throw Error(r(425))}function bc(){}var Td=null,qd=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 $d=typeof setTimeout=="function"?setTimeout:void 0,j1=typeof clearTimeout=="function"?clearTimeout:void 0,qp=typeof Promise=="function"?Promise:void 0,b1=typeof queueMicrotask=="function"?queueMicrotask:typeof qp<"u"?function(s){return qp.resolve(null).then(s).catch(w1)}:$d;function w1(s){setTimeout(function(){throw s})}function zd(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),Rl(a);return}u--}else l!=="$"&&l!=="$?"&&l!=="$!"||u++;l=m}while(l);Rl(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 Ip(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 ui=Math.random().toString(36).slice(2),bs="__reactFiber$"+ui,Dl="__reactProps$"+ui,As="__reactContainer$"+ui,Od="__reactEvents$"+ui,N1="__reactListeners$"+ui,k1="__reactHandles$"+ui;function ia(s){var a=s[bs];if(a)return a;for(var l=s.parentNode;l;){if(a=l[As]||l[bs]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(s=Ip(s);s!==null;){if(l=s[bs])return l;s=Ip(s)}return a}s=l,l=s.parentNode}return null}function Ul(s){return s=s[bs]||s[As],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function di(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(r(33))}function wc(s){return s[Dl]||null}var Ad=[],hi=-1;function yr(s){return{current:s}}function xt(s){0>hi||(s.current=Ad[hi],Ad[hi]=null,hi--)}function dt(s,a){hi++,Ad[hi]=s.current,s.current=a}var jr={},Yt=yr(jr),bn=yr(!1),la=jr;function fi(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 wn(s){return s=s.childContextTypes,s!=null}function Nc(){xt(bn),xt(Yt)}function $p(s,a,l){if(Yt.current!==jr)throw Error(r(168));dt(Yt,a),dt(bn,l)}function zp(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 ne({},l,u)}function kc(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||jr,la=Yt.current,dt(Yt,s),dt(bn,bn.current),!0}function Op(s,a,l){var u=s.stateNode;if(!u)throw Error(r(169));l?(s=zp(s,a,la),u.__reactInternalMemoizedMergedChildContext=s,xt(bn),xt(Yt),dt(Yt,s)):xt(bn),dt(bn,l)}var Ls=null,Sc=!1,Ld=!1;function Ap(s){Ls===null?Ls=[s]:Ls.push(s)}function S1(s){Sc=!0,Ap(s)}function br(){if(!Ld&&Ls!==null){Ld=!0;var s=0,a=it;try{var l=Ls;for(it=1;s<l.length;s++){var u=l[s];do u=u(!0);while(u!==null)}Ls=null,Sc=!1}catch(m){throw Ls!==null&&(Ls=Ls.slice(s+1)),bl(tt,br),m}finally{it=a,Ld=!1}}return null}var mi=[],pi=0,Cc=null,_c=0,Vn=[],Hn=0,oa=null,Fs=1,Ds="";function ca(s,a){mi[pi++]=_c,mi[pi++]=Cc,Cc=s,_c=a}function Lp(s,a,l){Vn[Hn++]=Fs,Vn[Hn++]=Ds,Vn[Hn++]=oa,oa=s;var u=Fs;s=Ds;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,Fs=1<<32-rs(a)+m|l<<m|u,Ds=x+s}else Fs=1<<x|l<<m|u,Ds=s}function Fd(s){s.return!==null&&(ca(s,1),Lp(s,1,0))}function Dd(s){for(;s===Cc;)Cc=mi[--pi],mi[pi]=null,_c=mi[--pi],mi[pi]=null;for(;s===oa;)oa=Vn[--Hn],Vn[Hn]=null,Ds=Vn[--Hn],Vn[Hn]=null,Fs=Vn[--Hn],Vn[Hn]=null}var Tn=null,qn=null,vt=!1,is=null;function Fp(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 Dp(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=oa!==null?{id:Fs,overflow:Ds}: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 Ud(s){return(s.mode&1)!==0&&(s.flags&128)===0}function Qd(s){if(vt){var a=qn;if(a){var l=a;if(!Dp(s,a)){if(Ud(s))throw Error(r(418));a=vr(l.nextSibling);var u=Tn;a&&Dp(s,a)?Fp(u,l):(s.flags=s.flags&-4097|2,vt=!1,Tn=s)}}else{if(Ud(s))throw Error(r(418));s.flags=s.flags&-4097|2,vt=!1,Tn=s}}}function Up(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Tn=s}function Pc(s){if(s!==Tn)return!1;if(!vt)return Up(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(Ud(s))throw Qp(),Error(r(418));for(;a;)Fp(s,a),a=vr(a.nextSibling)}if(Up(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 Qp(){for(var s=qn;s;)s=vr(s.nextSibling)}function xi(){qn=Tn=null,vt=!1}function Bd(s){is===null?is=[s]:is.push(s)}var C1=T.ReactCurrentBatchConfig;function Ql(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 Ec(s,a){throw s=Object.prototype.toString.call(a),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s))}function Bp(s){var a=s._init;return a(s._payload)}function Vp(s){function a(L,I){if(s){var D=L.deletions;D===null?(L.deletions=[I],L.flags|=16):D.push(I)}}function l(L,I){if(!s)return null;for(;I!==null;)a(L,I),I=I.sibling;return null}function u(L,I){for(L=new Map;I!==null;)I.key!==null?L.set(I.key,I):L.set(I.index,I),I=I.sibling;return L}function m(L,I){return L=Er(L,I),L.index=0,L.sibling=null,L}function x(L,I,D){return L.index=D,s?(D=L.alternate,D!==null?(D=D.index,D<I?(L.flags|=2,I):D):(L.flags|=2,I)):(L.flags|=1048576,I)}function N(L){return s&&L.alternate===null&&(L.flags|=2),L}function P(L,I,D,se){return I===null||I.tag!==6?(I=$h(D,L.mode,se),I.return=L,I):(I=m(I,D),I.return=L,I)}function R(L,I,D,se){var Ce=D.type;return Ce===$?J(L,I,D.props.children,se,D.key):I!==null&&(I.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===ot&&Bp(Ce)===I.type)?(se=m(I,D.props),se.ref=Ql(L,I,D),se.return=L,se):(se=Yc(D.type,D.key,D.props,null,L.mode,se),se.ref=Ql(L,I,D),se.return=L,se)}function U(L,I,D,se){return I===null||I.tag!==4||I.stateNode.containerInfo!==D.containerInfo||I.stateNode.implementation!==D.implementation?(I=zh(D,L.mode,se),I.return=L,I):(I=m(I,D.children||[]),I.return=L,I)}function J(L,I,D,se,Ce){return I===null||I.tag!==7?(I=ga(D,L.mode,se,Ce),I.return=L,I):(I=m(I,D),I.return=L,I)}function Y(L,I,D){if(typeof I=="string"&&I!==""||typeof I=="number")return I=$h(""+I,L.mode,D),I.return=L,I;if(typeof I=="object"&&I!==null){switch(I.$$typeof){case M:return D=Yc(I.type,I.key,I.props,null,L.mode,D),D.ref=Ql(L,null,I),D.return=L,D;case E:return I=zh(I,L.mode,D),I.return=L,I;case ot:var se=I._init;return Y(L,se(I._payload),D)}if(or(I)||me(I))return I=ga(I,L.mode,D,null),I.return=L,I;Ec(L,I)}return null}function G(L,I,D,se){var Ce=I!==null?I.key:null;if(typeof D=="string"&&D!==""||typeof D=="number")return Ce!==null?null:P(L,I,""+D,se);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case M:return D.key===Ce?R(L,I,D,se):null;case E:return D.key===Ce?U(L,I,D,se):null;case ot:return Ce=D._init,G(L,I,Ce(D._payload),se)}if(or(D)||me(D))return Ce!==null?null:J(L,I,D,se,null);Ec(L,D)}return null}function fe(L,I,D,se,Ce){if(typeof se=="string"&&se!==""||typeof se=="number")return L=L.get(D)||null,P(I,L,""+se,Ce);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case M:return L=L.get(se.key===null?D:se.key)||null,R(I,L,se,Ce);case E:return L=L.get(se.key===null?D:se.key)||null,U(I,L,se,Ce);case ot:var Te=se._init;return fe(L,I,D,Te(se._payload),Ce)}if(or(se)||me(se))return L=L.get(D)||null,J(I,L,se,Ce,null);Ec(I,se)}return null}function we(L,I,D,se){for(var Ce=null,Te=null,qe=I,$e=I=0,Qt=null;qe!==null&&$e<D.length;$e++){qe.index>$e?(Qt=qe,qe=null):Qt=qe.sibling;var et=G(L,qe,D[$e],se);if(et===null){qe===null&&(qe=Qt);break}s&&qe&&et.alternate===null&&a(L,qe),I=x(et,I,$e),Te===null?Ce=et:Te.sibling=et,Te=et,qe=Qt}if($e===D.length)return l(L,qe),vt&&ca(L,$e),Ce;if(qe===null){for(;$e<D.length;$e++)qe=Y(L,D[$e],se),qe!==null&&(I=x(qe,I,$e),Te===null?Ce=qe:Te.sibling=qe,Te=qe);return vt&&ca(L,$e),Ce}for(qe=u(L,qe);$e<D.length;$e++)Qt=fe(qe,L,$e,D[$e],se),Qt!==null&&(s&&Qt.alternate!==null&&qe.delete(Qt.key===null?$e:Qt.key),I=x(Qt,I,$e),Te===null?Ce=Qt:Te.sibling=Qt,Te=Qt);return s&&qe.forEach(function(Rr){return a(L,Rr)}),vt&&ca(L,$e),Ce}function ke(L,I,D,se){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 Te=Ce=null,qe=I,$e=I=0,Qt=null,et=D.next();qe!==null&&!et.done;$e++,et=D.next()){qe.index>$e?(Qt=qe,qe=null):Qt=qe.sibling;var Rr=G(L,qe,et.value,se);if(Rr===null){qe===null&&(qe=Qt);break}s&&qe&&Rr.alternate===null&&a(L,qe),I=x(Rr,I,$e),Te===null?Ce=Rr:Te.sibling=Rr,Te=Rr,qe=Qt}if(et.done)return l(L,qe),vt&&ca(L,$e),Ce;if(qe===null){for(;!et.done;$e++,et=D.next())et=Y(L,et.value,se),et!==null&&(I=x(et,I,$e),Te===null?Ce=et:Te.sibling=et,Te=et);return vt&&ca(L,$e),Ce}for(qe=u(L,qe);!et.done;$e++,et=D.next())et=fe(qe,L,$e,et.value,se),et!==null&&(s&&et.alternate!==null&&qe.delete(et.key===null?$e:et.key),I=x(et,I,$e),Te===null?Ce=et:Te.sibling=et,Te=et);return s&&qe.forEach(function(ab){return a(L,ab)}),vt&&ca(L,$e),Ce}function Rt(L,I,D,se){if(typeof D=="object"&&D!==null&&D.type===$&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case M:e:{for(var Ce=D.key,Te=I;Te!==null;){if(Te.key===Ce){if(Ce=D.type,Ce===$){if(Te.tag===7){l(L,Te.sibling),I=m(Te,D.props.children),I.return=L,L=I;break e}}else if(Te.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===ot&&Bp(Ce)===Te.type){l(L,Te.sibling),I=m(Te,D.props),I.ref=Ql(L,Te,D),I.return=L,L=I;break e}l(L,Te);break}else a(L,Te);Te=Te.sibling}D.type===$?(I=ga(D.props.children,L.mode,se,D.key),I.return=L,L=I):(se=Yc(D.type,D.key,D.props,null,L.mode,se),se.ref=Ql(L,I,D),se.return=L,L=se)}return N(L);case E:e:{for(Te=D.key;I!==null;){if(I.key===Te)if(I.tag===4&&I.stateNode.containerInfo===D.containerInfo&&I.stateNode.implementation===D.implementation){l(L,I.sibling),I=m(I,D.children||[]),I.return=L,L=I;break e}else{l(L,I);break}else a(L,I);I=I.sibling}I=zh(D,L.mode,se),I.return=L,L=I}return N(L);case ot:return Te=D._init,Rt(L,I,Te(D._payload),se)}if(or(D))return we(L,I,D,se);if(me(D))return ke(L,I,D,se);Ec(L,D)}return typeof D=="string"&&D!==""||typeof D=="number"?(D=""+D,I!==null&&I.tag===6?(l(L,I.sibling),I=m(I,D),I.return=L,L=I):(l(L,I),I=$h(D,L.mode,se),I.return=L,L=I),N(L)):l(L,I)}return Rt}var gi=Vp(!0),Hp=Vp(!1),Rc=yr(null),Mc=null,vi=null,Vd=null;function Hd(){Vd=vi=Mc=null}function Kd(s){var a=Rc.current;xt(Rc),s._currentValue=a}function Wd(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 yi(s,a){Mc=s,Vd=vi=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&a)!==0&&(Nn=!0),s.firstContext=null)}function Kn(s){var a=s._currentValue;if(Vd!==s)if(s={context:s,memoizedValue:a,next:null},vi===null){if(Mc===null)throw Error(r(308));vi=s,Mc.dependencies={lanes:0,firstContext:s}}else vi=vi.next=s;return a}var ua=null;function Zd(s){ua===null?ua=[s]:ua.push(s)}function Kp(s,a,l,u){var m=a.interleaved;return m===null?(l.next=l,Zd(a)):(l.next=m.next,m.next=l),a.interleaved=l,Us(s,u)}function Us(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 Gd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Wp(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 Qs(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,Us(s,l)}return m=u.interleaved,m===null?(a.next=a,Zd(u)):(a.next=m.next,m.next=a),u.interleaved=a,Us(s,l)}function Tc(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,ud(s,l)}}function Zp(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 qc(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=ne({},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);fa|=N,s.lanes=N,s.memoizedState=Y}}function Gp(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 Bl={},ws=yr(Bl),Vl=yr(Bl),Hl=yr(Bl);function da(s){if(s===Bl)throw Error(r(174));return s}function Jd(s,a){switch(dt(Hl,a),dt(Vl,s),dt(ws,Bl),s=a.nodeType,s){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:Ja(null,"");break;default:s=s===8?a.parentNode:a,a=s.namespaceURI||null,s=s.tagName,a=Ja(a,s)}xt(ws),dt(ws,a)}function ji(){xt(ws),xt(Vl),xt(Hl)}function Jp(s){da(Hl.current);var a=da(ws.current),l=Ja(a,s.type);a!==l&&(dt(Vl,s),dt(ws,l))}function Xd(s){Vl.current===s&&(xt(ws),xt(Vl))}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 Yd=[];function eh(){for(var s=0;s<Yd.length;s++)Yd[s]._workInProgressVersionPrimary=null;Yd.length=0}var $c=T.ReactCurrentDispatcher,th=T.ReactCurrentBatchConfig,ha=0,St=null,zt=null,Dt=null,zc=!1,Kl=!1,Wl=0,_1=0;function en(){throw Error(r(321))}function nh(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 sh(s,a,l,u,m,x){if(ha=x,St=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,$c.current=s===null||s.memoizedState===null?M1:T1,s=l(u,m),Kl){x=0;do{if(Kl=!1,Wl=0,25<=x)throw Error(r(301));x+=1,Dt=zt=null,a.updateQueue=null,$c.current=q1,s=l(u,m)}while(Kl)}if($c.current=Lc,a=zt!==null&&zt.next!==null,ha=0,Dt=zt=St=null,zc=!1,a)throw Error(r(300));return s}function rh(){var s=Wl!==0;return Wl=0,s}function Ns(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dt===null?St.memoizedState=Dt=s:Dt=Dt.next=s,Dt}function Wn(){if(zt===null){var s=St.alternate;s=s!==null?s.memoizedState:null}else s=zt.next;var a=Dt===null?St.memoizedState:Dt.next;if(a!==null)Dt=a,zt=s;else{if(s===null)throw Error(r(310));zt=s,s={memoizedState:zt.memoizedState,baseState:zt.baseState,baseQueue:zt.baseQueue,queue:zt.queue,next:null},Dt===null?St.memoizedState=Dt=s:Dt=Dt.next=s}return Dt}function Zl(s,a){return typeof a=="function"?a(s):a}function ah(s){var a=Wn(),l=a.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=s;var u=zt,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((ha&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,fa|=J}U=U.next}while(U!==null&&U!==x);R===null?N=u:R.next=P,as(u,a.memoizedState)||(Nn=!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,fa|=x,m=m.next;while(m!==s)}else m===null&&(l.lanes=0);return[a.memoizedState,l.dispatch]}function ih(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)||(Nn=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),l.lastRenderedState=x}return[x,u]}function Xp(){}function Yp(s,a){var l=St,u=Wn(),m=a(),x=!as(u.memoizedState,m);if(x&&(u.memoizedState=m,Nn=!0),u=u.queue,lh(nx.bind(null,l,u,s),[s]),u.getSnapshot!==a||x||Dt!==null&&Dt.memoizedState.tag&1){if(l.flags|=2048,Gl(9,tx.bind(null,l,u,m,a),void 0,null),Ut===null)throw Error(r(349));(ha&30)!==0||ex(l,a,m)}return m}function ex(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 tx(s,a,l,u){a.value=l,a.getSnapshot=u,sx(a)&&rx(s)}function nx(s,a,l){return l(function(){sx(a)&&rx(s)})}function sx(s){var a=s.getSnapshot;s=s.value;try{var l=a();return!as(s,l)}catch{return!0}}function rx(s){var a=Us(s,1);a!==null&&us(a,s,1,-1)}function ax(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:Zl,lastRenderedState:s},a.queue=s,s=s.dispatch=R1.bind(null,St,s),[a.memoizedState,s]}function Gl(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 ix(){return Wn().memoizedState}function Oc(s,a,l,u){var m=Ns();St.flags|=s,m.memoizedState=Gl(1|a,l,void 0,u===void 0?null:u)}function Ac(s,a,l,u){var m=Wn();u=u===void 0?null:u;var x=void 0;if(zt!==null){var N=zt.memoizedState;if(x=N.destroy,u!==null&&nh(u,N.deps)){m.memoizedState=Gl(a,l,x,u);return}}St.flags|=s,m.memoizedState=Gl(1|a,l,x,u)}function lx(s,a){return Oc(8390656,8,s,a)}function lh(s,a){return Ac(2048,8,s,a)}function ox(s,a){return Ac(4,2,s,a)}function cx(s,a){return Ac(4,4,s,a)}function ux(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 dx(s,a,l){return l=l!=null?l.concat([s]):null,Ac(4,4,ux.bind(null,a,s),l)}function oh(){}function hx(s,a){var l=Wn();a=a===void 0?null:a;var u=l.memoizedState;return u!==null&&a!==null&&nh(a,u[1])?u[0]:(l.memoizedState=[s,a],s)}function fx(s,a){var l=Wn();a=a===void 0?null:a;var u=l.memoizedState;return u!==null&&a!==null&&nh(a,u[1])?u[0]:(s=s(),l.memoizedState=[s,a],s)}function mx(s,a,l){return(ha&21)===0?(s.baseState&&(s.baseState=!1,Nn=!0),s.memoizedState=l):(as(l,a)||(l=Bm(),St.lanes|=l,fa|=l,s.baseState=!0),a)}function P1(s,a){var l=it;it=l!==0&&4>l?l:4,s(!0);var u=th.transition;th.transition={};try{s(!1),a()}finally{it=l,th.transition=u}}function px(){return Wn().memoizedState}function E1(s,a,l){var u=_r(s);if(l={lane:u,action:l,hasEagerState:!1,eagerState:null,next:null},xx(s))gx(a,l);else if(l=Kp(s,a,l,u),l!==null){var m=dn();us(l,s,u,m),vx(l,a,u)}}function R1(s,a,l){var u=_r(s),m={lane:u,action:l,hasEagerState:!1,eagerState:null,next:null};if(xx(s))gx(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,Zd(a)):(m.next=R.next,R.next=m),a.interleaved=m;return}}catch{}finally{}l=Kp(s,a,m,u),l!==null&&(m=dn(),us(l,s,u,m),vx(l,a,u))}}function xx(s){var a=s.alternate;return s===St||a!==null&&a===St}function gx(s,a){Kl=zc=!0;var l=s.pending;l===null?a.next=a:(a.next=l.next,l.next=a),s.pending=a}function vx(s,a,l){if((l&4194240)!==0){var u=a.lanes;u&=s.pendingLanes,l|=u,a.lanes=l,ud(s,l)}}var Lc={readContext:Kn,useCallback:en,useContext:en,useEffect:en,useImperativeHandle:en,useInsertionEffect:en,useLayoutEffect:en,useMemo:en,useReducer:en,useRef:en,useState:en,useDebugValue:en,useDeferredValue:en,useTransition:en,useMutableSource:en,useSyncExternalStore:en,useId:en,unstable_isNewReconciler:!1},M1={readContext:Kn,useCallback:function(s,a){return Ns().memoizedState=[s,a===void 0?null:a],s},useContext:Kn,useEffect:lx,useImperativeHandle:function(s,a,l){return l=l!=null?l.concat([s]):null,Oc(4194308,4,ux.bind(null,a,s),l)},useLayoutEffect:function(s,a){return Oc(4194308,4,s,a)},useInsertionEffect:function(s,a){return Oc(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=E1.bind(null,St,s),[u.memoizedState,s]},useRef:function(s){var a=Ns();return s={current:s},a.memoizedState=s},useState:ax,useDebugValue:oh,useDeferredValue:function(s){return Ns().memoizedState=s},useTransition:function(){var s=ax(!1),a=s[0];return s=P1.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(),Ut===null)throw Error(r(349));(ha&30)!==0||ex(u,a,l)}m.memoizedState=l;var x={value:l,getSnapshot:a};return m.queue=x,lx(nx.bind(null,u,x,s),[s]),u.flags|=2048,Gl(9,tx.bind(null,u,x,l,a),void 0,null),l},useId:function(){var s=Ns(),a=Ut.identifierPrefix;if(vt){var l=Ds,u=Fs;l=(u&~(1<<32-rs(u)-1)).toString(32)+l,a=":"+a+"R"+l,l=Wl++,0<l&&(a+="H"+l.toString(32)),a+=":"}else l=_1++,a=":"+a+"r"+l.toString(32)+":";return s.memoizedState=a},unstable_isNewReconciler:!1},T1={readContext:Kn,useCallback:hx,useContext:Kn,useEffect:lh,useImperativeHandle:dx,useInsertionEffect:ox,useLayoutEffect:cx,useMemo:fx,useReducer:ah,useRef:ix,useState:function(){return ah(Zl)},useDebugValue:oh,useDeferredValue:function(s){var a=Wn();return mx(a,zt.memoizedState,s)},useTransition:function(){var s=ah(Zl)[0],a=Wn().memoizedState;return[s,a]},useMutableSource:Xp,useSyncExternalStore:Yp,useId:px,unstable_isNewReconciler:!1},q1={readContext:Kn,useCallback:hx,useContext:Kn,useEffect:lh,useImperativeHandle:dx,useInsertionEffect:ox,useLayoutEffect:cx,useMemo:fx,useReducer:ih,useRef:ix,useState:function(){return ih(Zl)},useDebugValue:oh,useDeferredValue:function(s){var a=Wn();return zt===null?a.memoizedState=s:mx(a,zt.memoizedState,s)},useTransition:function(){var s=ih(Zl)[0],a=Wn().memoizedState;return[s,a]},useMutableSource:Xp,useSyncExternalStore:Yp,useId:px,unstable_isNewReconciler:!1};function ls(s,a){if(s&&s.defaultProps){a=ne({},a),s=s.defaultProps;for(var l in s)a[l]===void 0&&(a[l]=s[l]);return a}return a}function ch(s,a,l,u){a=s.memoizedState,l=l(u,a),l=l==null?a:ne({},a,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var Fc={isMounted:function(s){return(s=s._reactInternals)?ys(s)===s:!1},enqueueSetState:function(s,a,l){s=s._reactInternals;var u=dn(),m=_r(s),x=Qs(u,m);x.payload=a,l!=null&&(x.callback=l),a=Nr(s,x,m),a!==null&&(us(a,s,m,u),Tc(a,s,m))},enqueueReplaceState:function(s,a,l){s=s._reactInternals;var u=dn(),m=_r(s),x=Qs(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),Tc(a,s,m))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var l=dn(),u=_r(s),m=Qs(l,u);m.tag=2,a!=null&&(m.callback=a),a=Nr(s,m,u),a!==null&&(us(a,s,u,l),Tc(a,s,u))}};function yx(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?!zl(l,u)||!zl(m,x):!0}function jx(s,a,l){var u=!1,m=jr,x=a.contextType;return typeof x=="object"&&x!==null?x=Kn(x):(m=wn(a)?la:Yt.current,u=a.contextTypes,x=(u=u!=null)?fi(s,m):jr),a=new a(l,x),s.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Fc,s.stateNode=a,a._reactInternals=s,u&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=m,s.__reactInternalMemoizedMaskedChildContext=x),a}function bx(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&&Fc.enqueueReplaceState(a,a.state,null)}function uh(s,a,l,u){var m=s.stateNode;m.props=l,m.state=s.memoizedState,m.refs={},Gd(s);var x=a.contextType;typeof x=="object"&&x!==null?m.context=Kn(x):(x=wn(a)?la:Yt.current,m.context=fi(s,x)),m.state=s.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(ch(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&&Fc.enqueueReplaceState(m,m.state,null),qc(s,l,m,u),m.state=s.memoizedState),typeof m.componentDidMount=="function"&&(s.flags|=4194308)}function bi(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 dh(s,a,l){return{value:s,source:null,stack:l??null,digest:a??null}}function hh(s,a){try{console.error(a.value)}catch(l){setTimeout(function(){throw l})}}var I1=typeof WeakMap=="function"?WeakMap:Map;function wx(s,a,l){l=Qs(-1,l),l.tag=3,l.payload={element:null};var u=a.value;return l.callback=function(){Kc||(Kc=!0,_h=u),hh(s,a)},l}function Nx(s,a,l){l=Qs(-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(){hh(s,a)}}var x=s.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(l.callback=function(){hh(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 kx(s,a,l){var u=s.pingCache;if(u===null){u=s.pingCache=new I1;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=W1.bind(null,s,a,l),a.then(s,s))}function Sx(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 Cx(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=Qs(-1,1),a.tag=2,Nr(l,a,1))),l.lanes|=1),s):(s.flags|=65536,s.lanes=m,s)}var $1=T.ReactCurrentOwner,Nn=!1;function un(s,a,l,u){a.child=s===null?Hp(a,null,l,u):gi(a,s.child,l,u)}function _x(s,a,l,u,m){l=l.render;var x=a.ref;return yi(a,m),u=sh(s,a,l,u,x,m),l=rh(),s!==null&&!Nn?(a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~m,Bs(s,a,m)):(vt&&l&&Fd(a),a.flags|=1,un(s,a,u,m),a.child)}function Px(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,Ex(s,a,x,u,m)):(s=Yc(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:zl,l(N,u)&&s.ref===a.ref)return Bs(s,a,m)}return a.flags|=1,s=Er(x,u),s.ref=a.ref,s.return=a,a.child=s}function Ex(s,a,l,u,m){if(s!==null){var x=s.memoizedProps;if(zl(x,u)&&s.ref===a.ref)if(Nn=!1,a.pendingProps=u=x,(s.lanes&m)!==0)(s.flags&131072)!==0&&(Nn=!0);else return a.lanes=s.lanes,Bs(s,a,m)}return fh(s,a,l,u,m)}function Rx(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},dt(Ni,In),In|=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,dt(Ni,In),In|=s,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=x!==null?x.baseLanes:l,dt(Ni,In),In|=u}else x!==null?(u=x.baseLanes|l,a.memoizedState=null):u=l,dt(Ni,In),In|=u;return un(s,a,m,l),a.child}function Mx(s,a){var l=a.ref;(s===null&&l!==null||s!==null&&s.ref!==l)&&(a.flags|=512,a.flags|=2097152)}function fh(s,a,l,u,m){var x=wn(l)?la:Yt.current;return x=fi(a,x),yi(a,m),l=sh(s,a,l,u,x,m),u=rh(),s!==null&&!Nn?(a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~m,Bs(s,a,m)):(vt&&u&&Fd(a),a.flags|=1,un(s,a,l,m),a.child)}function Tx(s,a,l,u,m){if(wn(l)){var x=!0;kc(a)}else x=!1;if(yi(a,m),a.stateNode===null)Uc(s,a),jx(a,l,u),uh(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=wn(l)?la:Yt.current,U=fi(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)&&bx(a,N,u,U),wr=!1;var G=a.memoizedState;N.state=G,qc(a,u,N,m),R=a.memoizedState,P!==u||G!==R||bn.current||wr?(typeof J=="function"&&(ch(a,l,J,u),R=a.memoizedState),(P=wr||yx(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,Wp(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=wn(l)?la:Yt.current,R=fi(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)&&bx(a,N,u,R),wr=!1,G=a.memoizedState,N.state=G,qc(a,u,N,m);var we=a.memoizedState;P!==Y||G!==we||bn.current||wr?(typeof fe=="function"&&(ch(a,l,fe,u),we=a.memoizedState),(U=wr||yx(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 mh(s,a,l,u,x,m)}function mh(s,a,l,u,m,x){Mx(s,a);var N=(a.flags&128)!==0;if(!u&&!N)return m&&Op(a,l,!1),Bs(s,a,x);u=a.stateNode,$1.current=a;var P=N&&typeof l.getDerivedStateFromError!="function"?null:u.render();return a.flags|=1,s!==null&&N?(a.child=gi(a,s.child,null,x),a.child=gi(a,null,P,x)):un(s,a,P,x),a.memoizedState=u.state,m&&Op(a,l,!0),a.child}function qx(s){var a=s.stateNode;a.pendingContext?$p(s,a.pendingContext,a.pendingContext!==a.context):a.context&&$p(s,a.context,!1),Jd(s,a.containerInfo)}function Ix(s,a,l,u,m){return xi(),Bd(m),a.flags|=256,un(s,a,l,u),a.child}var ph={dehydrated:null,treeContext:null,retryLane:0};function xh(s){return{baseLanes:s,cachePool:null,transitions:null}}function $x(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),dt(kt,m&1),s===null)return Qd(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=eu(N,u,0,null),s=ga(s,u,l,null),x.return=a,s.return=a,x.sibling=s,a.child=x,a.child.memoizedState=xh(l),a.memoizedState=ph,s):gh(a,N));if(m=s.memoizedState,m!==null&&(P=m.dehydrated,P!==null))return z1(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=ga(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?xh(l):{baseLanes:N.baseLanes|l,cachePool:null,transitions:N.transitions},x.memoizedState=N,x.childLanes=s.childLanes&~l,a.memoizedState=ph,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 gh(s,a){return a=eu({mode:"visible",children:a},s.mode,0,null),a.return=s,s.child=a}function Dc(s,a,l,u){return u!==null&&Bd(u),gi(a,s.child,null,l),s=gh(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function z1(s,a,l,u,m,x,N){if(l)return a.flags&256?(a.flags&=-257,u=dh(Error(r(422))),Dc(s,a,N,u)):a.memoizedState!==null?(a.child=s.child,a.flags|=128,null):(x=u.fallback,m=a.mode,u=eu({mode:"visible",children:u.children},m,0,null),x=ga(x,m,N,null),x.flags|=2,u.return=a,x.return=a,u.sibling=x,a.child=u,(a.mode&1)!==0&&gi(a,s.child,null,N),a.child.memoizedState=xh(N),a.memoizedState=ph,x);if((a.mode&1)===0)return Dc(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=dh(x,u,void 0),Dc(s,a,N,u)}if(P=(N&s.childLanes)!==0,Nn||P){if(u=Ut,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,Us(s,m),us(u,s,m,-1))}return qh(),u=dh(Error(r(421))),Dc(s,a,N,u)}return m.data==="$?"?(a.flags|=128,a.child=s.child,a=Z1.bind(null,s),m._reactRetry=a,null):(s=x.treeContext,qn=vr(m.nextSibling),Tn=a,vt=!0,is=null,s!==null&&(Vn[Hn++]=Fs,Vn[Hn++]=Ds,Vn[Hn++]=oa,Fs=s.id,Ds=s.overflow,oa=a),a=gh(a,u.children),a.flags|=4096,a)}function zx(s,a,l){s.lanes|=a;var u=s.alternate;u!==null&&(u.lanes|=a),Wd(s.return,a,l)}function vh(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 Ox(s,a,l){var u=a.pendingProps,m=u.revealOrder,x=u.tail;if(un(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&&zx(s,l,a);else if(s.tag===19)zx(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(dt(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),vh(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}vh(a,!0,l,null,x);break;case"together":vh(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Uc(s,a){(a.mode&1)===0&&s!==null&&(s.alternate=null,a.alternate=null,a.flags|=2)}function Bs(s,a,l){if(s!==null&&(a.dependencies=s.dependencies),fa|=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 O1(s,a,l){switch(a.tag){case 3:qx(a),xi();break;case 5:Jp(a);break;case 1:wn(a.type)&&kc(a);break;case 4:Jd(a,a.stateNode.containerInfo);break;case 10:var u=a.type._context,m=a.memoizedProps.value;dt(Rc,u._currentValue),u._currentValue=m;break;case 13:if(u=a.memoizedState,u!==null)return u.dehydrated!==null?(dt(kt,kt.current&1),a.flags|=128,null):(l&a.child.childLanes)!==0?$x(s,a,l):(dt(kt,kt.current&1),s=Bs(s,a,l),s!==null?s.sibling:null);dt(kt,kt.current&1);break;case 19:if(u=(l&a.childLanes)!==0,(s.flags&128)!==0){if(u)return Ox(s,a,l);a.flags|=128}if(m=a.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),dt(kt,kt.current),u)break;return null;case 22:case 23:return a.lanes=0,Rx(s,a,l)}return Bs(s,a,l)}var Ax,yh,Lx,Fx;Ax=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}},yh=function(){},Lx=function(s,a,l,u){var m=s.memoizedProps;if(m!==u){s=a.stateNode,da(ws.current);var x=null;switch(l){case"input":m=Xr(s,m),u=Xr(s,u),x=[];break;case"select":m=ne({},m,{value:void 0}),u=ne({},u,{value:void 0}),x=[];break;case"textarea":m=Ft(s,m),u=Ft(s,u),x=[];break;default:typeof m.onClick!="function"&&typeof u.onClick=="function"&&(s.onclick=bc)}hl(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)}},Fx=function(s,a,l,u){l!==u&&(a.flags|=4)};function Jl(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 tn(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 A1(s,a,l){var u=a.pendingProps;switch(Dd(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tn(a),null;case 1:return wn(a.type)&&Nc(),tn(a),null;case 3:return u=a.stateNode,ji(),xt(bn),xt(Yt),eh(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(Pc(a)?a.flags|=4:s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,is!==null&&(Rh(is),is=null))),yh(s,a),tn(a),null;case 5:Xd(a);var m=da(Hl.current);if(l=a.type,s!==null&&a.stateNode!=null)Lx(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 tn(a),null}if(s=da(ws.current),Pc(a)){u=a.stateNode,l=a.type;var x=a.memoizedProps;switch(u[bs]=a,u[Dl]=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<Al.length;m++)pt(Al[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":Yr(u,x),pt("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!x.multiple},pt("invalid",u);break;case"textarea":Ho(u,x),pt("invalid",u)}hl(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&&jc(u.textContent,P,s),m=["children",P]):typeof P=="number"&&u.textContent!==""+P&&(x.suppressHydrationWarning!==!0&&jc(u.textContent,P,s),m=["children",""+P]):o.hasOwnProperty(N)&&P!=null&&N==="onScroll"&&pt("scroll",u)}switch(l){case"input":lr(u),Za(u,x,!0);break;case"textarea":lr(u),Qn(u);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(u.onclick=bc)}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=Ko(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[Dl]=u,Ax(s,a,!1,!1),a.stateNode=s;e:{switch(N=na(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<Al.length;m++)pt(Al[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":Yr(s,u),m=Xr(s,u),pt("invalid",s);break;case"option":m=u;break;case"select":s._wrapperState={wasMultiple:!!u.multiple},m=ne({},u,{value:void 0}),pt("invalid",s);break;case"textarea":Ho(s,u),m=Ft(s,u),pt("invalid",s);break;default:m=u}hl(l,m),P=m;for(x in P)if(P.hasOwnProperty(x)){var R=P[x];x==="style"?$t(s,R):x==="dangerouslySetInnerHTML"?(R=R?R.__html:void 0,R!=null&&vs(s,R)):x==="children"?typeof R=="string"?(l!=="textarea"||R!=="")&&$s(s,R):typeof R=="number"&&$s(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),Za(s,u,!1);break;case"textarea":lr(s),Qn(s);break;case"option":u.value!=null&&s.setAttribute("value",""+Be(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=bc)}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 tn(a),null;case 6:if(s&&a.stateNode!=null)Fx(s,a,s.memoizedProps,u);else{if(typeof u!="string"&&a.stateNode===null)throw Error(r(166));if(l=da(Hl.current),da(ws.current),Pc(a)){if(u=a.stateNode,l=a.memoizedProps,u[bs]=a,(x=u.nodeValue!==l)&&(s=Tn,s!==null))switch(s.tag){case 3:jc(u.nodeValue,l,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&jc(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 tn(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)Qp(),xi(),a.flags|=98560,x=!1;else if(x=Pc(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 xi(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;tn(a),x=!1}else is!==null&&(Rh(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?Ot===0&&(Ot=3):qh())),a.updateQueue!==null&&(a.flags|=4),tn(a),null);case 4:return ji(),yh(s,a),s===null&&Ll(a.stateNode.containerInfo),tn(a),null;case 10:return Kd(a.type._context),tn(a),null;case 17:return wn(a.type)&&Nc(),tn(a),null;case 19:if(xt(kt),x=a.memoizedState,x===null)return tn(a),null;if(u=(a.flags&128)!==0,N=x.rendering,N===null)if(u)Jl(x,!1);else{if(Ot!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(N=Ic(s),N!==null){for(a.flags|=128,Jl(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 dt(kt,kt.current&1|2),a.child}s=s.sibling}x.tail!==null&&gt()>ki&&(a.flags|=128,u=!0,Jl(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),Jl(x,!0),x.tail===null&&x.tailMode==="hidden"&&!N.alternate&&!vt)return tn(a),null}else 2*gt()-x.renderingStartTime>ki&&l!==1073741824&&(a.flags|=128,u=!0,Jl(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,dt(kt,u?l&1|2:l&1),a):(tn(a),null);case 22:case 23:return Th(),u=a.memoizedState!==null,s!==null&&s.memoizedState!==null!==u&&(a.flags|=8192),u&&(a.mode&1)!==0?(In&1073741824)!==0&&(tn(a),a.subtreeFlags&6&&(a.flags|=8192)):tn(a),null;case 24:return null;case 25:return null}throw Error(r(156,a.tag))}function L1(s,a){switch(Dd(a),a.tag){case 1:return wn(a.type)&&Nc(),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return ji(),xt(bn),xt(Yt),eh(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 5:return Xd(a),null;case 13:if(xt(kt),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(r(340));xi()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return xt(kt),null;case 4:return ji(),null;case 10:return Kd(a.type._context),null;case 22:case 23:return Th(),null;case 24:return null;default:return null}}var Qc=!1,nn=!1,F1=typeof WeakSet=="function"?WeakSet:Set,ye=null;function wi(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 jh(s,a,l){try{l()}catch(u){_t(s,a,u)}}var Dx=!1;function D1(s,a){if(Td=cc,s=yp(),kd(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(qd={focusedElem:s,selectionRange:l},cc=!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,Rt=we.memoizedState,L=a.stateNode,I=L.getSnapshotBeforeUpdate(a.elementType===a.type?ke:ls(a.type,ke),Rt);L.__reactInternalSnapshotBeforeUpdate=I}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(se){_t(a,a.return,se)}if(s=a.sibling,s!==null){s.return=a.return,ye=s;break}ye=a.return}return we=Dx,Dx=!1,we}function Xl(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&&jh(a,l,x)}m=m.next}while(m!==u)}}function Bc(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 bh(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 Ux(s){var a=s.alternate;a!==null&&(s.alternate=null,Ux(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&(delete a[bs],delete a[Dl],delete a[Od],delete a[N1],delete a[k1])),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 Qx(s){return s.tag===5||s.tag===3||s.tag===4}function Bx(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Qx(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 wh(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=bc));else if(u!==4&&(s=s.child,s!==null))for(wh(s,a,l),s=s.sibling;s!==null;)wh(s,a,l),s=s.sibling}function Nh(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(Nh(s,a,l),s=s.sibling;s!==null;)Nh(s,a,l),s=s.sibling}var Zt=null,os=!1;function kr(s,a,l){for(l=l.child;l!==null;)Vx(s,a,l),l=l.sibling}function Vx(s,a,l){if(js&&typeof js.onCommitFiberUnmount=="function")try{js.onCommitFiberUnmount(sc,l)}catch{}switch(l.tag){case 5:nn||wi(l,a);case 6:var u=Zt,m=os;Zt=null,kr(s,a,l),Zt=u,os=m,Zt!==null&&(os?(s=Zt,l=l.stateNode,s.nodeType===8?s.parentNode.removeChild(l):s.removeChild(l)):Zt.removeChild(l.stateNode));break;case 18:Zt!==null&&(os?(s=Zt,l=l.stateNode,s.nodeType===8?zd(s.parentNode,l):s.nodeType===1&&zd(s,l),Rl(s)):zd(Zt,l.stateNode));break;case 4:u=Zt,m=os,Zt=l.stateNode.containerInfo,os=!0,kr(s,a,l),Zt=u,os=m;break;case 0:case 11:case 14:case 15:if(!nn&&(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)&&jh(l,a,N),m=m.next}while(m!==u)}kr(s,a,l);break;case 1:if(!nn&&(wi(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?(nn=(u=nn)||l.memoizedState!==null,kr(s,a,l),nn=u):kr(s,a,l);break;default:kr(s,a,l)}}function Hx(s){var a=s.updateQueue;if(a!==null){s.updateQueue=null;var l=s.stateNode;l===null&&(l=s.stateNode=new F1),a.forEach(function(u){var m=G1.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:Zt=P.stateNode,os=!1;break e;case 3:Zt=P.stateNode.containerInfo,os=!0;break e;case 4:Zt=P.stateNode.containerInfo,os=!0;break e}P=P.return}if(Zt===null)throw Error(r(160));Vx(x,N,m),Zt=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;)Kx(a,s),a=a.sibling}function Kx(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{Xl(3,s,s.return),Bc(3,s)}catch(ke){_t(s,s.return,ke)}try{Xl(5,s,s.return)}catch(ke){_t(s,s.return,ke)}}break;case 1:cs(a,s),ks(s),u&512&&l!==null&&wi(l,l.return);break;case 5:if(cs(a,s),ks(s),u&512&&l!==null&&wi(l,l.return),s.flags&32){var m=s.stateNode;try{$s(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&&Wa(m,x),na(P,N);var U=na(P,x);for(N=0;N<R.length;N+=2){var J=R[N],Y=R[N+1];J==="style"?$t(m,Y):J==="dangerouslySetInnerHTML"?vs(m,Y):J==="children"?$s(m,Y):O(m,J,Y,U)}switch(P){case"input":ea(m,x);break;case"textarea":Ga(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[Dl]=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{Rl(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||(Ch=gt())),u&4&&Hx(s);break;case 22:if(J=l!==null&&l.memoizedState!==null,s.mode&1?(nn=(U=nn)||J,cs(a,s),nn=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:Xl(4,G,G.return);break;case 1:wi(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:wi(G,G.return);break;case 22:if(G.memoizedState!==null){Gx(Y);continue}}fe!==null?(fe.return=G,ye=fe):Gx(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=dl("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&&Hx(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(Qx(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&&($s(m,""),u.flags&=-33);var x=Bx(s);Nh(s,x,m);break;case 3:case 4:var N=u.stateNode.containerInfo,P=Bx(s);wh(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 U1(s,a,l){ye=s,Wx(s)}function Wx(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||Qc;if(!N){var P=m.alternate,R=P!==null&&P.memoizedState!==null||nn;P=Qc;var U=nn;if(Qc=N,(nn=R)&&!U)for(ye=m;ye!==null;)N=ye,R=N.child,N.tag===22&&N.memoizedState!==null?Jx(m):R!==null?(R.return=N,ye=R):Jx(m);for(;x!==null;)ye=x,Wx(x),x=x.sibling;ye=m,Qc=P,nn=U}Zx(s)}else(m.subtreeFlags&8772)!==0&&x!==null?(x.return=m,ye=x):Zx(s)}}function Zx(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:nn||Bc(5,a);break;case 1:var u=a.stateNode;if(a.flags&4&&!nn)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&&Gp(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}Gp(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&&Rl(Y)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}nn||a.flags&512&&bh(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 Gx(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 Jx(s){for(;ye!==null;){var a=ye;try{switch(a.tag){case 0:case 11:case 15:var l=a.return;try{Bc(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{bh(a)}catch(R){_t(a,x,R)}break;case 5:var N=a.return;try{bh(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 Q1=Math.ceil,Vc=T.ReactCurrentDispatcher,kh=T.ReactCurrentOwner,Zn=T.ReactCurrentBatchConfig,Je=0,Ut=null,Tt=null,Gt=0,In=0,Ni=yr(0),Ot=0,Yl=null,fa=0,Hc=0,Sh=0,eo=null,kn=null,Ch=0,ki=1/0,Vs=null,Kc=!1,_h=null,Sr=null,Wc=!1,Cr=null,Zc=0,to=0,Ph=null,Gc=-1,Jc=0;function dn(){return(Je&6)!==0?gt():Gc!==-1?Gc:Gc=gt()}function _r(s){return(s.mode&1)===0?1:(Je&2)!==0&&Gt!==0?Gt&-Gt:C1.transition!==null?(Jc===0&&(Jc=Bm()),Jc):(s=it,s!==0||(s=window.event,s=s===void 0?16:Ym(s.type)),s)}function us(s,a,l,u){if(50<to)throw to=0,Ph=null,Error(r(185));Sl(s,l,u),((Je&2)===0||s!==Ut)&&(s===Ut&&((Je&2)===0&&(Hc|=l),Ot===4&&Pr(s,Gt)),Sn(s,u),l===1&&Je===0&&(a.mode&1)===0&&(ki=gt()+500,Sc&&br()))}function Sn(s,a){var l=s.callbackNode;Cj(s,a);var u=ic(s,s===Ut?Gt:0);if(u===0)l!==null&&wl(l),s.callbackNode=null,s.callbackPriority=0;else if(a=u&-u,s.callbackPriority!==a){if(l!=null&&wl(l),a===1)s.tag===0?S1(Yx.bind(null,s)):Ap(Yx.bind(null,s)),b1(function(){(Je&6)===0&&br()}),l=null;else{switch(Vm(u)){case 1:l=tt;break;case 4:l=Ye;break;case 16:l=Mt;break;case 536870912:l=Qm;break;default:l=Mt}l=lg(l,Xx.bind(null,s))}s.callbackPriority=a,s.callbackNode=l}}function Xx(s,a){if(Gc=-1,Jc=0,(Je&6)!==0)throw Error(r(327));var l=s.callbackNode;if(Si()&&s.callbackNode!==l)return null;var u=ic(s,s===Ut?Gt:0);if(u===0)return null;if((u&30)!==0||(u&s.expiredLanes)!==0||a)a=Xc(s,u);else{a=u;var m=Je;Je|=2;var x=tg();(Ut!==s||Gt!==a)&&(Vs=null,ki=gt()+500,pa(s,a));do try{H1();break}catch(P){eg(s,P)}while(!0);Hd(),Vc.current=x,Je=m,Tt!==null?a=0:(Ut=null,Gt=0,a=Ot)}if(a!==0){if(a===2&&(m=od(s),m!==0&&(u=m,a=Eh(s,m))),a===1)throw l=Yl,pa(s,0),Pr(s,u),Sn(s,gt()),l;if(a===6)Pr(s,u);else{if(m=s.current.alternate,(u&30)===0&&!B1(m)&&(a=Xc(s,u),a===2&&(x=od(s),x!==0&&(u=x,a=Eh(s,x))),a===1))throw l=Yl,pa(s,0),Pr(s,u),Sn(s,gt()),l;switch(s.finishedWork=m,s.finishedLanes=u,a){case 0:case 1:throw Error(r(345));case 2:xa(s,kn,Vs);break;case 3:if(Pr(s,u),(u&130023424)===u&&(a=Ch+500-gt(),10<a)){if(ic(s,0)!==0)break;if(m=s.suspendedLanes,(m&u)!==u){dn(),s.pingedLanes|=s.suspendedLanes&m;break}s.timeoutHandle=$d(xa.bind(null,s,kn,Vs),a);break}xa(s,kn,Vs);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*Q1(u/1960))-u,10<u){s.timeoutHandle=$d(xa.bind(null,s,kn,Vs),u);break}xa(s,kn,Vs);break;case 5:xa(s,kn,Vs);break;default:throw Error(r(329))}}}return Sn(s,gt()),s.callbackNode===l?Xx.bind(null,s):null}function Eh(s,a){var l=eo;return s.current.memoizedState.isDehydrated&&(pa(s,a).flags|=256),s=Xc(s,a),s!==2&&(a=kn,kn=l,a!==null&&Rh(a)),s}function Rh(s){kn===null?kn=s:kn.push.apply(kn,s)}function B1(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&=~Sh,a&=~Hc,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 Yx(s){if((Je&6)!==0)throw Error(r(327));Si();var a=ic(s,0);if((a&1)===0)return Sn(s,gt()),null;var l=Xc(s,a);if(s.tag!==0&&l===2){var u=od(s);u!==0&&(a=u,l=Eh(s,u))}if(l===1)throw l=Yl,pa(s,0),Pr(s,a),Sn(s,gt()),l;if(l===6)throw Error(r(345));return s.finishedWork=s.current.alternate,s.finishedLanes=a,xa(s,kn,Vs),Sn(s,gt()),null}function Mh(s,a){var l=Je;Je|=1;try{return s(a)}finally{Je=l,Je===0&&(ki=gt()+500,Sc&&br())}}function ma(s){Cr!==null&&Cr.tag===0&&(Je&6)===0&&Si();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 Th(){In=Ni.current,xt(Ni)}function pa(s,a){s.finishedWork=null,s.finishedLanes=0;var l=s.timeoutHandle;if(l!==-1&&(s.timeoutHandle=-1,j1(l)),Tt!==null)for(l=Tt.return;l!==null;){var u=l;switch(Dd(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&Nc();break;case 3:ji(),xt(bn),xt(Yt),eh();break;case 5:Xd(u);break;case 4:ji();break;case 13:xt(kt);break;case 19:xt(kt);break;case 10:Kd(u.type._context);break;case 22:case 23:Th()}l=l.return}if(Ut=s,Tt=s=Er(s.current,null),Gt=In=a,Ot=0,Yl=null,Sh=Hc=fa=0,kn=eo=null,ua!==null){for(a=0;a<ua.length;a++)if(l=ua[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}ua=null}return s}function eg(s,a){do{var l=Tt;try{if(Hd(),$c.current=Lc,zc){for(var u=St.memoizedState;u!==null;){var m=u.queue;m!==null&&(m.pending=null),u=u.next}zc=!1}if(ha=0,Dt=zt=St=null,Kl=!1,Wl=0,kh.current=null,l===null||l.return===null){Ot=1,Yl=a,Tt=null;break}e:{var x=s,N=l.return,P=l,R=a;if(a=Gt,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=Sx(N);if(fe!==null){fe.flags&=-257,Cx(fe,N,P,x,a),fe.mode&1&&kx(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){kx(x,U,a),qh();break e}R=Error(r(426))}}else if(vt&&P.mode&1){var Rt=Sx(N);if(Rt!==null){(Rt.flags&65536)===0&&(Rt.flags|=256),Cx(Rt,N,P,x,a),Bd(bi(R,P));break e}}x=R=bi(R,P),Ot!==4&&(Ot=2),eo===null?eo=[x]:eo.push(x),x=N;do{switch(x.tag){case 3:x.flags|=65536,a&=-a,x.lanes|=a;var L=wx(x,R,a);Zp(x,L);break e;case 1:P=R;var I=x.type,D=x.stateNode;if((x.flags&128)===0&&(typeof I.getDerivedStateFromError=="function"||D!==null&&typeof D.componentDidCatch=="function"&&(Sr===null||!Sr.has(D)))){x.flags|=65536,a&=-a,x.lanes|=a;var se=Nx(x,P,a);Zp(x,se);break e}}x=x.return}while(x!==null)}sg(l)}catch(Ce){a=Ce,Tt===l&&l!==null&&(Tt=l=l.return);continue}break}while(!0)}function tg(){var s=Vc.current;return Vc.current=Lc,s===null?Lc:s}function qh(){(Ot===0||Ot===3||Ot===2)&&(Ot=4),Ut===null||(fa&268435455)===0&&(Hc&268435455)===0||Pr(Ut,Gt)}function Xc(s,a){var l=Je;Je|=2;var u=tg();(Ut!==s||Gt!==a)&&(Vs=null,pa(s,a));do try{V1();break}catch(m){eg(s,m)}while(!0);if(Hd(),Je=l,Vc.current=u,Tt!==null)throw Error(r(261));return Ut=null,Gt=0,Ot}function V1(){for(;Tt!==null;)ng(Tt)}function H1(){for(;Tt!==null&&!tc();)ng(Tt)}function ng(s){var a=ig(s.alternate,s,In);s.memoizedProps=s.pendingProps,a===null?sg(s):Tt=a,kh.current=null}function sg(s){var a=s;do{var l=a.alternate;if(s=a.return,(a.flags&32768)===0){if(l=A1(l,a,In),l!==null){Tt=l;return}}else{if(l=L1(l,a),l!==null){l.flags&=32767,Tt=l;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{Ot=6,Tt=null;return}}if(a=a.sibling,a!==null){Tt=a;return}Tt=a=s}while(a!==null);Ot===0&&(Ot=5)}function xa(s,a,l){var u=it,m=Zn.transition;try{Zn.transition=null,it=1,K1(s,a,l,u)}finally{Zn.transition=m,it=u}return null}function K1(s,a,l,u){do Si();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(_j(s,x),s===Ut&&(Tt=Ut=null,Gt=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||Wc||(Wc=!0,lg(Mt,function(){return Si(),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,kh.current=null,D1(s,l),Kx(l,s),f1(qd),cc=!!Td,qd=Td=null,s.current=l,U1(l),nc(),Je=P,it=N,Zn.transition=x}else s.current=l;if(Wc&&(Wc=!1,Cr=s,Zc=m),x=s.pendingLanes,x===0&&(Sr=null),bj(l.stateNode),Sn(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(Kc)throw Kc=!1,s=_h,_h=null,s;return(Zc&1)!==0&&s.tag!==0&&Si(),x=s.pendingLanes,(x&1)!==0?s===Ph?to++:(to=0,Ph=s):to=0,br(),null}function Si(){if(Cr!==null){var s=Vm(Zc),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,Zc=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:Xl(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(Ux(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 Rt=ke.sibling;ke.sibling=null,ke=Rt}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:Xl(9,x,x.return)}var L=x.sibling;if(L!==null){L.return=x.return,ye=L;break e}ye=x.return}}var I=s.current;for(ye=I;ye!==null;){N=ye;var D=N.child;if((N.subtreeFlags&2064)!==0&&D!==null)D.return=N,ye=D;else e:for(N=I;ye!==null;){if(P=ye,(P.flags&2048)!==0)try{switch(P.tag){case 0:case 11:case 15:Bc(9,P)}}catch(Ce){_t(P,P.return,Ce)}if(P===N){ye=null;break e}var se=P.sibling;if(se!==null){se.return=P.return,ye=se;break e}ye=P.return}}if(Je=m,br(),js&&typeof js.onPostCommitFiberRoot=="function")try{js.onPostCommitFiberRoot(sc,s)}catch{}u=!0}return u}finally{it=l,Zn.transition=a}}return!1}function rg(s,a,l){a=bi(l,a),a=wx(s,a,1),s=Nr(s,a,1),a=dn(),s!==null&&(Sl(s,1,a),Sn(s,a))}function _t(s,a,l){if(s.tag===3)rg(s,s,l);else for(;a!==null;){if(a.tag===3){rg(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=bi(l,s),s=Nx(a,s,1),a=Nr(a,s,1),s=dn(),a!==null&&(Sl(a,1,s),Sn(a,s));break}}a=a.return}}function W1(s,a,l){var u=s.pingCache;u!==null&&u.delete(a),a=dn(),s.pingedLanes|=s.suspendedLanes&l,Ut===s&&(Gt&l)===l&&(Ot===4||Ot===3&&(Gt&130023424)===Gt&&500>gt()-Ch?pa(s,0):Sh|=l),Sn(s,a)}function ag(s,a){a===0&&((s.mode&1)===0?a=1:(a=ac,ac<<=1,(ac&130023424)===0&&(ac=4194304)));var l=dn();s=Us(s,a),s!==null&&(Sl(s,a,l),Sn(s,l))}function Z1(s){var a=s.memoizedState,l=0;a!==null&&(l=a.retryLane),ag(s,l)}function G1(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),ag(s,l)}var ig;ig=function(s,a,l){if(s!==null)if(s.memoizedProps!==a.pendingProps||bn.current)Nn=!0;else{if((s.lanes&l)===0&&(a.flags&128)===0)return Nn=!1,O1(s,a,l);Nn=(s.flags&131072)!==0}else Nn=!1,vt&&(a.flags&1048576)!==0&&Lp(a,_c,a.index);switch(a.lanes=0,a.tag){case 2:var u=a.type;Uc(s,a),s=a.pendingProps;var m=fi(a,Yt.current);yi(a,l),m=sh(null,a,u,s,m,l);var x=rh();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,wn(u)?(x=!0,kc(a)):x=!1,a.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,Gd(a),m.updater=Fc,a.stateNode=m,m._reactInternals=a,uh(a,u,s,l),a=mh(null,a,u,!0,x,l)):(a.tag=0,vt&&x&&Fd(a),un(null,a,m,l),a=a.child),a;case 16:u=a.elementType;e:{switch(Uc(s,a),s=a.pendingProps,m=u._init,u=m(u._payload),a.type=u,m=a.tag=X1(u),s=ls(u,s),m){case 0:a=fh(null,a,u,s,l);break e;case 1:a=Tx(null,a,u,s,l);break e;case 11:a=_x(null,a,u,s,l);break e;case 14:a=Px(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),fh(s,a,u,m,l);case 1:return u=a.type,m=a.pendingProps,m=a.elementType===u?m:ls(u,m),Tx(s,a,u,m,l);case 3:e:{if(qx(a),s===null)throw Error(r(387));u=a.pendingProps,x=a.memoizedState,m=x.element,Wp(s,a),qc(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=bi(Error(r(423)),a),a=Ix(s,a,u,l,m);break e}else if(u!==m){m=bi(Error(r(424)),a),a=Ix(s,a,u,l,m);break e}else for(qn=vr(a.stateNode.containerInfo.firstChild),Tn=a,vt=!0,is=null,l=Hp(a,null,u,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(xi(),u===m){a=Bs(s,a,l);break e}un(s,a,u,l)}a=a.child}return a;case 5:return Jp(a),s===null&&Qd(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),Mx(s,a),un(s,a,N,l),a.child;case 6:return s===null&&Qd(a),null;case 13:return $x(s,a,l);case 4:return Jd(a,a.stateNode.containerInfo),u=a.pendingProps,s===null?a.child=gi(a,null,u,l):un(s,a,u,l),a.child;case 11:return u=a.type,m=a.pendingProps,m=a.elementType===u?m:ls(u,m),_x(s,a,u,m,l);case 7:return un(s,a,a.pendingProps,l),a.child;case 8:return un(s,a,a.pendingProps.children,l),a.child;case 12:return un(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,dt(Rc,u._currentValue),u._currentValue=N,x!==null)if(as(x.value,N)){if(x.children===m.children&&!bn.current){a=Bs(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=Qs(-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),Wd(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),Wd(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}un(s,a,m.children,l),a=a.child}return a;case 9:return m=a.type,u=a.pendingProps.children,yi(a,l),m=Kn(m),u=u(m),a.flags|=1,un(s,a,u,l),a.child;case 14:return u=a.type,m=ls(u,a.pendingProps),m=ls(u.type,m),Px(s,a,u,m,l);case 15:return Ex(s,a,a.type,a.pendingProps,l);case 17:return u=a.type,m=a.pendingProps,m=a.elementType===u?m:ls(u,m),Uc(s,a),a.tag=1,wn(u)?(s=!0,kc(a)):s=!1,yi(a,l),jx(a,u,m),uh(a,u,m,l),mh(null,a,u,!0,s,l);case 19:return Ox(s,a,l);case 22:return Rx(s,a,l)}throw Error(r(156,a.tag))};function lg(s,a){return bl(s,a)}function J1(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 J1(s,a,l,u)}function Ih(s){return s=s.prototype,!(!s||!s.isReactComponent)}function X1(s){if(typeof s=="function")return Ih(s)?1:0;if(s!=null){if(s=s.$$typeof,s===ue)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 Yc(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 $:return ga(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 oe:return s=Gn(13,l,a,m),s.elementType=oe,s.lanes=x,s;case Ne:return s=Gn(19,l,a,m),s.elementType=Ne,s.lanes=x,s;case Fe:return eu(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 ue: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 ga(s,a,l,u){return s=Gn(7,s,u,a),s.lanes=l,s}function eu(s,a,l,u){return s=Gn(22,s,u,a),s.elementType=Fe,s.lanes=l,s.stateNode={isHidden:!1},s}function $h(s,a,l){return s=Gn(6,s,null,a),s.lanes=l,s}function zh(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 Y1(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=cd(0),this.expirationTimes=cd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cd(0),this.identifierPrefix=u,this.onRecoverableError=m,this.mutableSourceEagerHydrationData=null}function Oh(s,a,l,u,m,x,N,P,R){return s=new Y1(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},Gd(x),s}function eb(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 og(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(wn(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(wn(l))return zp(s,l,a)}return a}function cg(s,a,l,u,m,x,N,P,R){return s=Oh(l,u,!0,s,m,x,N,P,R),s.context=og(null),l=s.current,u=dn(),m=_r(l),x=Qs(u,m),x.callback=a??null,Nr(l,x,m),s.current.lanes=m,Sl(s,m,u),Sn(s,u),s}function tu(s,a,l,u){var m=a.current,x=dn(),N=_r(m);return l=og(l),a.context===null?a.context=l:a.pendingContext=l,a=Qs(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),Tc(s,m,N)),N}function nu(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 ug(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<a?l:a}}function Ah(s,a){ug(s,a),(s=s.alternate)&&ug(s,a)}function tb(){return null}var dg=typeof reportError=="function"?reportError:function(s){console.error(s)};function Lh(s){this._internalRoot=s}su.prototype.render=Lh.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(r(409));tu(s,a,null,null)},su.prototype.unmount=Lh.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;ma(function(){tu(null,s,null,null)}),a[As]=null}};function su(s){this._internalRoot=s}su.prototype.unstable_scheduleHydration=function(s){if(s){var a=Wm();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&&Jm(s)}};function Fh(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function ru(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function hg(){}function nb(s,a,l,u,m){if(m){if(typeof u=="function"){var x=u;u=function(){var U=nu(N);x.call(U)}}var N=cg(a,u,s,0,null,!1,!1,"",hg);return s._reactRootContainer=N,s[As]=N.current,Ll(s.nodeType===8?s.parentNode:s),ma(),N}for(;m=s.lastChild;)s.removeChild(m);if(typeof u=="function"){var P=u;u=function(){var U=nu(R);P.call(U)}}var R=Oh(s,0,!1,null,null,!1,!1,"",hg);return s._reactRootContainer=R,s[As]=R.current,Ll(s.nodeType===8?s.parentNode:s),ma(function(){tu(a,R,l,u)}),R}function au(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=nu(N);P.call(R)}}tu(a,N,s,m)}else N=nb(l,a,s,m,u);return nu(N)}Hm=function(s){switch(s.tag){case 3:var a=s.stateNode;if(a.current.memoizedState.isDehydrated){var l=kl(a.pendingLanes);l!==0&&(ud(a,l|1),Sn(a,gt()),(Je&6)===0&&(ki=gt()+500,br()))}break;case 13:ma(function(){var u=Us(s,1);if(u!==null){var m=dn();us(u,s,1,m)}}),Ah(s,1)}},dd=function(s){if(s.tag===13){var a=Us(s,134217728);if(a!==null){var l=dn();us(a,s,134217728,l)}Ah(s,134217728)}},Km=function(s){if(s.tag===13){var a=_r(s),l=Us(s,a);if(l!==null){var u=dn();us(l,s,a,u)}Ah(s,a)}},Wm=function(){return it},Zm=function(s,a){var l=it;try{return it=s,a()}finally{it=l}},ei=function(s,a,l){switch(a){case"input":if(ea(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=wc(u);if(!m)throw Error(r(90));cl(u),ea(u,m)}}}break;case"textarea":Ga(s,l);break;case"select":a=l.value,a!=null&&Rn(s,!!l.multiple,a,!1)}},ml=Mh,pl=ma;var sb={usingClientEntryPoint:!1,Events:[Ul,di,wc,sa,fl,Mh]},no={findFiberByHostInstance:ia,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},rb={bundleType:no.bundleType,version:no.version,rendererPackageName:no.rendererPackageName,rendererConfig:no.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=yl(s),s===null?null:s.stateNode},findFiberByHostInstance:no.findFiberByHostInstance||tb,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 iu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!iu.isDisabled&&iu.supportsFiber)try{sc=iu.inject(rb),js=iu}catch{}}return Cn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sb,Cn.createPortal=function(s,a){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Fh(a))throw Error(r(200));return eb(s,a,null,l)},Cn.createRoot=function(s,a){if(!Fh(s))throw Error(r(299));var l=!1,u="",m=dg;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onRecoverableError!==void 0&&(m=a.onRecoverableError)),a=Oh(s,1,!1,null,null,l,!1,u,m),s[As]=a.current,Ll(s.nodeType===8?s.parentNode:s),new Lh(a)},Cn.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=yl(a),s=s===null?null:s.stateNode,s},Cn.flushSync=function(s){return ma(s)},Cn.hydrate=function(s,a,l){if(!ru(a))throw Error(r(200));return au(null,s,a,!0,l)},Cn.hydrateRoot=function(s,a,l){if(!Fh(s))throw Error(r(405));var u=l!=null&&l.hydratedSources||null,m=!1,x="",N=dg;if(l!=null&&(l.unstable_strictMode===!0&&(m=!0),l.identifierPrefix!==void 0&&(x=l.identifierPrefix),l.onRecoverableError!==void 0&&(N=l.onRecoverableError)),a=cg(a,null,s,1,l??null,m,!1,x,N),s[As]=a.current,Ll(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 su(a)},Cn.render=function(s,a,l){if(!ru(a))throw Error(r(200));return au(null,s,a,!1,l)},Cn.unmountComponentAtNode=function(s){if(!ru(s))throw Error(r(40));return s._reactRootContainer?(ma(function(){au(null,null,s,!1,function(){s._reactRootContainer=null,s[As]=null})}),!0):!1},Cn.unstable_batchedUpdates=Mh,Cn.unstable_renderSubtreeIntoContainer=function(s,a,l,u){if(!ru(l))throw Error(r(200));if(s==null||s._reactInternals===void 0)throw Error(r(38));return au(s,a,l,!1,u)},Cn.version="18.3.1-next-f1338f8080-20240426",Cn}var bg;function Xv(){if(bg)return Vh.exports;bg=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(),Vh.exports=gb(),Vh.exports}var wg;function vb(){if(wg)return ou;wg=1;var e=Xv();return ou.createRoot=e.createRoot,ou.hydrateRoot=e.hydrateRoot,ou}var yb=vb();const jb="modulepreload",bb=function(e){return"/"+e},Ng={},Qu=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=bb(g),g in Ng)return;Ng[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":jb,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)})};Xv();/**
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 fo(){return fo=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},fo.apply(null,arguments)}var Ur;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Ur||(Ur={}));const kg="popstate";function wb(e){e===void 0&&(e={});function n(i,o){let{pathname:c,search:d,hash:h}=i.location;return rf("",{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:ju(o)}return kb(n,r,null,e)}function jt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Yv(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function Nb(){return Math.random().toString(36).substr(2,8)}function Sg(e,n){return{usr:e.state,key:e.key,idx:n}}function rf(e,n,r,i){return r===void 0&&(r=null),fo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof n=="string"?el(n):n,{state:r,key:n&&n.key||i||Nb()})}function ju(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 el(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 kb(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(fo({},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=rf(b.location,k,C);g=p()+1;let O=Sg(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=rf(b.location,k,C);g=p();let O=Sg(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:ju(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(kg,v),f=k,()=>{o.removeEventListener(kg,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 Cg;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Cg||(Cg={}));function Sb(e,n,r){return r===void 0&&(r="/"),Cb(e,n,r)}function Cb(e,n,r,i){let o=typeof n=="string"?el(n):n,c=Bi(o.pathname||"/",r);if(c==null)return null;let d=ey(e);_b(d);let h=null,f=ny(c);for(let g=0;h==null&&g<d.length;++g)h=zb(d[g],f);return h}function ey(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+'".')),ey(c.children,n,p,g)),!(c.path==null&&!c.index)&&n.push({path:g,score:Ib(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 ty(c.path))o(c,d,f)}),n}function ty(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=ty(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 _b(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:$b(n.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}const Pb=/^:[\w-]+$/,Eb=3,Rb=2,Mb=1,Tb=10,qb=-2,_g=e=>e==="*";function Ib(e,n){let r=e.split("/"),i=r.length;return r.some(_g)&&(i+=qb),n&&(i+=Rb),r.filter(o=>!_g(o)).reduce((o,c)=>o+(Pb.test(c)?Eb:c===""?Mb:Tb),i)}function $b(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 zb(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=bu({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:Fb(Qr([c,v.pathnameBase])),route:j}),v.pathnameBase!=="/"&&(c=Qr([c,v.pathnameBase]))}return d}function bu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=Ob(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 Ob(e,n,r){n===void 0&&(n=!1),r===void 0&&(r=!0),Yv(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 ny(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Yv(!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 Bi(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 Ab(e,n){n===void 0&&(n="/");let{pathname:r,search:i="",hash:o=""}=typeof e=="string"?el(e):e,c;return r?(r=sy(r),r.startsWith("/")?c=Pg(r.substring(1),"/"):c=Pg(r,n)):c=n,{pathname:c,search:Db(i),hash:Ub(o)}}function Pg(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 Wh(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 Lb(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Zf(e,n){let r=Lb(e);return n?r.map((i,o)=>o===r.length-1?i.pathname:i.pathnameBase):r.map(i=>i.pathnameBase)}function Gf(e,n,r,i){i===void 0&&(i=!1);let o;typeof e=="string"?o=el(e):(o=fo({},e),jt(!o.pathname||!o.pathname.includes("?"),Wh("?","pathname","search",o)),jt(!o.pathname||!o.pathname.includes("#"),Wh("#","pathname","hash",o)),jt(!o.search||!o.search.includes("#"),Wh("#","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=Ab(o,h),g=d&&d!=="/"&&d.endsWith("/"),p=(c||d===".")&&r.endsWith("/");return!f.pathname.endsWith("/")&&(g||p)&&(f.pathname+="/"),f}const sy=e=>e.replace(/\/\/+/g,"/"),Qr=e=>sy(e.join("/")),Fb=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Db=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Ub=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Qb(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const ry=["post","put","patch","delete"];new Set(ry);const Bb=["get",...ry];new Set(Bb);/**
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 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)}const Bu=w.createContext(null),ay=w.createContext(null),ir=w.createContext(null),Vu=w.createContext(null),Is=w.createContext({outlet:null,matches:[],isDataRoute:!1}),iy=w.createContext(null);function Vb(e,n){let{relative:r}=n===void 0?{}:n;Ua()||jt(!1);let{basename:i,navigator:o}=w.useContext(ir),{hash:c,pathname:d,search:h}=Hu(e,{relative:r}),f=d;return i!=="/"&&(f=d==="/"?i:Qr([i,d])),o.createHref({pathname:f,search:h,hash:c})}function Ua(){return w.useContext(Vu)!=null}function Ln(){return Ua()||jt(!1),w.useContext(Vu).location}function Eg(e){Ua()||jt(!1);let{pathname:n}=Ln();return w.useMemo(()=>bu(e,ny(n)),[n,e])}function ly(e){w.useContext(ir).static||w.useLayoutEffect(e)}function cn(){let{isDataRoute:e}=w.useContext(Is);return e?iw():Hb()}function Hb(){Ua()||jt(!1);let e=w.useContext(Bu),{basename:n,future:r,navigator:i}=w.useContext(ir),{matches:o}=w.useContext(Is),{pathname:c}=Ln(),d=JSON.stringify(Zf(o,r.v7_relativeSplatPath)),h=w.useRef(!1);return ly(()=>{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=Gf(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 Kb=w.createContext(null);function Wb(e){let n=w.useContext(Is).outlet;return n&&w.createElement(Kb.Provider,{value:e},n)}function Fn(){let{matches:e}=w.useContext(Is),n=e[e.length-1];return n?n.params:{}}function Hu(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(Zf(o,i.v7_relativeSplatPath));return w.useMemo(()=>Gf(e,JSON.parse(d),c,r==="path"),[e,d,c,r])}function Zb(e,n){return Gb(e,n)}function Gb(e,n,r,i){Ua()||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"?el(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=Sb(e,{pathname:S}),b=tw(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(Vu.Provider,{value:{location:mo({pathname:"/",search:"",hash:"",state:null,key:"default"},p),navigationType:Ur.Pop}},b):b}function Jb(){let e=aw(),n=Qb(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 Xb=w.createElement(Jb,null);class Yb 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(iy.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function ew(e){let{routeContext:n,match:r,children:i}=e,o=w.useContext(Bu);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 tw(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||Xb,f&&(g<0&&j===0?(lw("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(ew,{match:v,routeContext:{outlet:p,matches:C,isDataRoute:r!=null},children:O})};return r&&(v.route.ErrorBoundary||v.route.errorElement||j===0)?w.createElement(Yb,{location:r.location,revalidation:r.revalidation,component:b,error:S,children:z(),routeContext:{outlet:null,matches:C,isDataRoute:!0}}):z()},null)}var oy=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(oy||{}),cy=(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})(cy||{});function nw(e){let n=w.useContext(Bu);return n||jt(!1),n}function sw(e){let n=w.useContext(ay);return n||jt(!1),n}function rw(e){let n=w.useContext(Is);return n||jt(!1),n}function uy(e){let n=rw(),r=n.matches[n.matches.length-1];return r.route.id||jt(!1),r.route.id}function aw(){var e;let n=w.useContext(iy),r=sw(),i=uy();return n!==void 0?n:(e=r.errors)==null?void 0:e[i]}function iw(){let{router:e}=nw(oy.UseNavigateStable),n=uy(cy.UseNavigateStable),r=w.useRef(!1);return ly(()=>{r.current=!0}),w.useCallback(function(o,c){c===void 0&&(c={}),r.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,mo({fromRouteId:n},c)))},[e,n])}const Rg={};function lw(e,n,r){Rg[e]||(Rg[e]=!0)}function ow(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;Ua()||jt(!1);let{future:c,static:d}=w.useContext(ir),{matches:h}=w.useContext(Is),{pathname:f}=Ln(),g=cn(),p=Gf(n,Zf(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 dy(e){return Wb(e.context)}function ct(e){jt(!1)}function cw(e){let{basename:n="/",children:r=null,location:i,navigationType:o=Ur.Pop,navigator:c,static:d=!1,future:h}=e;Ua()&&jt(!1);let f=n.replace(/^\/*/,"/"),g=w.useMemo(()=>({basename:f,navigator:c,static:d,future:mo({v7_relativeSplatPath:!1},h)}),[f,h,c,d]);typeof i=="string"&&(i=el(i));let{pathname:p="/",search:v="",hash:j="",state:S=null,key:y="default"}=i,b=w.useMemo(()=>{let k=Bi(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(Vu.Provider,{children:r,value:b}))}function uw(e){let{children:n,location:r}=e;return Zb(af(n),r)}new Promise(()=>{});function af(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,af(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=af(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 wu(){return wu=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},wu.apply(null,arguments)}function hy(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 dw(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function hw(e,n){return e.button===0&&(!n||n==="_self")&&!dw(e)}function lf(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 fw(e,n){let r=lf(e);return n&&n.forEach((i,o)=>{r.has(o)||n.getAll(o).forEach(c=>{r.append(o,c)})}),r}const mw=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],pw=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],xw="6";try{window.__reactRouterVersion=xw}catch{}const gw=w.createContext({isTransitioning:!1}),vw="startTransition",Mg=mb[vw];function yw(e){let{basename:n,children:r,future:i,window:o}=e,c=w.useRef();c.current==null&&(c.current=wb({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&&Mg?Mg(()=>f(v)):f(v)},[f,g]);return w.useLayoutEffect(()=>d.listen(p),[d,p]),w.useEffect(()=>ow(i),[i]),w.createElement(cw,{basename:n,children:r,location:h.location,navigationType:h.action,navigator:d,future:i})}const jw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",bw=/^(?:[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=hy(n,mw),{basename:S}=w.useContext(ir),y,b=!1;if(typeof g=="string"&&bw.test(g)&&(y=g,jw))try{let O=new URL(window.location.href),T=g.startsWith("//")?new URL(O.protocol+g):new URL(g),M=Bi(T.pathname,S);T.origin===O.origin&&M!=null?g=M+T.search+T.hash:b=!0}catch{}let k=Vb(g,{relative:o}),C=Nw(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",wu({},j,{href:y||k,onClick:b||c?i:z,ref:r,target:f}))}),zo=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=hy(n,pw),j=Hu(f,{relative:v.relative}),S=Ln(),y=w.useContext(ay),{navigator:b,basename:k}=w.useContext(ir),C=y!=null&&kw(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=Bi(T,k)||T);const M=z!=="/"&&z.endsWith("/")?z.length-1:z.length;let E=O===z||!d&&O.startsWith(z)&&O.charAt(M)==="/",$=T!=null&&(T===z||!d&&T.startsWith(z)&&T.charAt(z.length)==="/"),Q={isActive:E,isPending:$,isTransitioning:C},H=E?i:void 0,q;typeof c=="function"?q=c(Q):q=[c,E?"active":null,$?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let B=typeof h=="function"?h(Q):h;return w.createElement(Ee,wu({},v,{"aria-current":H,className:q,ref:r,style:B,to:f,viewTransition:g}),typeof p=="function"?p(Q):p)});var of;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(of||(of={}));var Tg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Tg||(Tg={}));function ww(e){let n=w.useContext(Bu);return n||jt(!1),n}function Nw(e,n){let{target:r,replace:i,state:o,preventScrollReset:c,relative:d,viewTransition:h}=n===void 0?{}:n,f=cn(),g=Ln(),p=Hu(e,{relative:d});return w.useCallback(v=>{if(hw(v,r)){v.preventDefault();let j=i!==void 0?i:ju(g)===ju(p);f(e,{replace:j,state:o,preventScrollReset:c,relative:d,viewTransition:h})}},[g,f,p,i,o,r,e,c,d,h])}function tl(e){let n=w.useRef(lf(e)),r=w.useRef(!1),i=Ln(),o=w.useMemo(()=>fw(i.search,r.current?null:n.current),[i.search]),c=cn(),d=w.useCallback((h,f)=>{const g=lf(typeof h=="function"?h(o):h);r.current=!0,c("?"+g,f)},[c,o]);return[o,d]}function kw(e,n){n===void 0&&(n={});let r=w.useContext(gw);r==null&&jt(!1);let{basename:i}=ww(of.useViewTransitionState),o=Hu(e,{relative:n.relative});if(!r.isTransitioning)return!1;let c=Bi(r.currentLocation.pathname,i)||r.currentLocation.pathname,d=Bi(r.nextLocation.pathname,i)||r.nextLocation.pathname;return bu(o.pathname,d)!=null||bu(o.pathname,c)!=null}const fy=w.createContext(void 0),We=e=>{const n=w.useContext(fy);if(!n)throw new Error("No QueryClient set, use QueryClientProvider to set one");return n},Sw=({client:e,children:n})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),t.jsx(fy.Provider,{value:e,children:n})),Cw={setTimeout:(e,n)=>setTimeout(e,n),clearTimeout:e=>clearTimeout(e),setInterval:(e,n)=>setInterval(e,n),clearInterval:e=>clearInterval(e)};var Ir,Kf,Fv,_w=(Fv=class{constructor(){ge(this,Ir,Cw);ge(this,Kf,!1)}setTimeoutProvider(e){te(this,Ir,e)}setTimeout(e,n){return _(this,Ir).setTimeout(e,n)}clearTimeout(e){_(this,Ir).clearTimeout(e)}setInterval(e,n){return _(this,Ir).setInterval(e,n)}clearInterval(e){_(this,Ir).clearInterval(e)}},Ir=new WeakMap,Kf=new WeakMap,Fv);const ba=new _w;function Pw(e){setTimeout(e,0)}const Ew=typeof window>"u"||"Deno"in globalThis;function ln(){}function Rw(e,n){return typeof e=="function"?e(n):e}function my(e){return typeof e=="number"&&e>=0&&e!==1/0}function py(e,n){return Math.max(e+(n||0)-Date.now(),0)}function Pt(e,n){return typeof e=="function"?e(n):e}function qg(e,n){const{type:r="all",exact:i,fetchStatus:o,predicate:c,queryKey:d,stale:h}=e;if(d){if(i){if(n.queryHash!==Jf(d,n.options))return!1}else if(!Vi(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 Ig(e,n){const{exact:r,status:i,predicate:o,mutationKey:c}=e;if(c){if(!n.options.mutationKey)return!1;if(r){if($a(n.options.mutationKey)!==$a(c))return!1}else if(!Vi(n.options.mutationKey,c))return!1}return!(i&&n.state.status!==i||o&&!o(n))}function Jf(e,n){return((n==null?void 0:n.queryKeyHashFn)||$a)(e)}function $a(e){return JSON.stringify(e,(n,r)=>cf(r)?Object.keys(r).sort().reduce((i,o)=>(i[o]=r[o],i),{}):r)}function Vi(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(!Vi(e[i],n[i]))return!1;return!0}const r=Object.keys(n);for(const i of r)if(!Vi(e[i],n[i]))return!1;return!0}return!1}const Mw=Object.prototype.hasOwnProperty;function Xf(e,n,r=0){if(e===n)return e;if(r>500)return n;const i=$g(e)&&$g(n);if(!i&&!(cf(e)&&cf(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:Mw.call(e,p))&&f++;continue}if(v===null||j===null||typeof v!="object"||typeof j!="object"){h[p]=j;continue}const S=Xf(v,j,r+1);h[p]=S,S===v&&f++}return o===d&&f===o?e:h}function uo(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 $g(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function cf(e){if(!zg(e))return!1;const n=e.constructor;if(n===void 0)return!0;const r=n.prototype;return!(!zg(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function zg(e){return Object.prototype.toString.call(e)==="[object Object]"}function Tw(e){return new Promise(n=>{ba.setTimeout(n,e)})}function uf(e,n,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,n):r.structuralSharing!==!1?Xf(e,n):n}function En(e){return e}function qw(e,n,r=0){const i=[...e,n];return r&&i.length>r?i.slice(1):i}function Iw(e,n,r=0){const i=[n,...e];return r&&i.length>r?i.slice(0,-1):i}const Yf=Symbol();function xy(e,n){return!e.queryFn&&(n!=null&&n.initialPromise)?()=>n.initialPromise:!e.queryFn||e.queryFn===Yf?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function em(e,n){return typeof e=="function"?e(...n):!!e}function $w(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 zw=()=>Ew;const tm=()=>zw();var Qa=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(){}},wa,$r,Ei,Dv,Ow=(Dv=class extends Qa{constructor(){super();ge(this,wa);ge(this,$r);ge(this,Ei);te(this,Ei,n=>{if(typeof window<"u"&&window.addEventListener){const r=()=>n();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){_(this,$r)||this.setEventListener(_(this,Ei))}onUnsubscribe(){var n;this.hasListeners()||((n=_(this,$r))==null||n.call(this),te(this,$r,void 0))}setEventListener(n){var r;te(this,Ei,n),(r=_(this,$r))==null||r.call(this),te(this,$r,n(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(n){_(this,wa)!==n&&(te(this,wa,n),this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(r=>{r(n)})}isFocused(){var n;return typeof _(this,wa)=="boolean"?_(this,wa):((n=globalThis.document)==null?void 0:n.visibilityState)!=="hidden"}},wa=new WeakMap,$r=new WeakMap,Ei=new WeakMap,Dv);const nm=new Ow,Aw=Pw;function Lw(){let e=[],n=0,r=h=>{h()},i=h=>{h()},o=Aw;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=Lw();var Ri,zr,Mi,Uv,Fw=(Uv=class extends Qa{constructor(){super();ge(this,Ri,!0);ge(this,zr);ge(this,Mi);te(this,Mi,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,Mi))}onUnsubscribe(){var n;this.hasListeners()||((n=_(this,zr))==null||n.call(this),te(this,zr,void 0))}setEventListener(n){var r;te(this,Mi,n),(r=_(this,zr))==null||r.call(this),te(this,zr,n(this.setOnline.bind(this)))}setOnline(n){_(this,Ri)!==n&&(te(this,Ri,n),this.listeners.forEach(r=>{r(n)}))}isOnline(){return _(this,Ri)}},Ri=new WeakMap,zr=new WeakMap,Mi=new WeakMap,Uv);const Nu=new Fw;function Dw(e){return Math.min(1e3*2**e,3e4)}function gy(e){return(e??"online")==="online"?Nu.isOnline():!0}var df=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function vy(e){let n=!1,r=0,i,o="pending",c,d;const h=new Promise((z,O)=>{c=z,d=O});h.catch(ln);const f=()=>o!=="pending",g=z=>{var O;if(!f()){const T=new df(z);b(T),(O=e.onCancel)==null||O.call(e,T)}},p=()=>{n=!0},v=()=>{n=!1},j=()=>nm.isFocused()&&(e.networkMode==="always"||Nu.isOnline())&&e.canRun(),S=()=>gy(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??(tm()?0:3),E=e.retryDelay??Dw,$=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),Tw($).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 Na,Qv,yy=(Qv=class{constructor(){ge(this,Na)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),my(this.gcTime)&&te(this,Na,ba.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(tm()?1/0:3e5))}clearGcTimeout(){_(this,Na)!==void 0&&(ba.clearTimeout(_(this,Na)),te(this,Na,void 0))}},Na=new WeakMap,Qv);function Uw(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=>{$w(O,()=>n.signal,()=>b=!0)},C=xy(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 $=(()=>{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($),{maxPages:H}=n.options,q=M?Iw:qw;return{pages:q(O.pages,Q,H),pageParams:q(O.pageParams,T,H)}};if(o&&c.length){const O=o==="backward",T=O?jy:hf,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:hf(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 hf(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 jy(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 Qw(e,n){return n?hf(e,n)!=null:!1}function Bw(e,n){return!n||!e.getPreviousPageParam?!1:jy(e,n)!=null}var Ti,ka,qi,Jn,Sa,At,_o,Ca,hs,Ws,Bv,Vw=(Bv=class extends yy{constructor(n){super();ge(this,hs);ge(this,Ti);ge(this,ka);ge(this,qi);ge(this,Jn);ge(this,Sa);ge(this,At);ge(this,_o);ge(this,Ca);te(this,Ca,!1),te(this,_o,n.defaultOptions),this.setOptions(n.options),this.observers=[],te(this,Sa,n.client),te(this,Jn,_(this,Sa).getQueryCache()),this.queryKey=n.queryKey,this.queryHash=n.queryHash,te(this,ka,Ag(this.options)),this.state=n.state??_(this,ka),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return _(this,Ti)}get promise(){var n;return(n=_(this,At))==null?void 0:n.promise}setOptions(n){if(this.options={..._(this,_o),...n},n!=null&&n._type&&te(this,Ti,n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Ag(this.options);r.data!==void 0&&(this.setState(Og(r.data,r.dataUpdatedAt)),te(this,ka,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,Jn).remove(this)}setData(n,r){const i=uf(this.state.data,n,this.options);return Re(this,hs,Ws).call(this,{data:i,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),i}setState(n){Re(this,hs,Ws).call(this,{type:"setState",state:n})}cancel(n){var i,o;const r=(i=_(this,At))==null?void 0:i.promise;return(o=_(this,At))==null||o.cancel(n),r?r.then(ln).catch(ln):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return _(this,ka)}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===Yf||!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:!py(this.state.dataUpdatedAt,n)}onFocus(){var n,r;(n=this.observers.find(i=>i.shouldFetchOnWindowFocus()))==null||n.refetch({cancelRefetch:!1}),(r=_(this,At))==null||r.continue()}onOnline(){var n,r;(n=this.observers.find(i=>i.shouldFetchOnReconnect()))==null||n.refetch({cancelRefetch:!1}),(r=_(this,At))==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,At)&&(_(this,Ca)||this.state.fetchStatus==="paused"&&this.state.status==="pending"?_(this,At).cancel({revert:!0}):_(this,At).cancelRetry()),this.scheduleGc()),_(this,Jn).notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Re(this,hs,Ws).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,At))==null?void 0:g.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(_(this,At))return _(this,At).continueRetry(),_(this,At).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:()=>(te(this,Ca,!0),i.signal)})},c=()=>{const M=xy(this.options,r),$=(()=>{const Q={client:_(this,Sa),queryKey:this.queryKey,meta:this.meta};return o(Q),Q})();return te(this,Ca,!1),this.options.persister?this.options.persister(M,$,this):M($)},h=(()=>{const M={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:_(this,Sa),state:this.state,fetchFn:c};return o(M),M})();(p=_(this,Ti)==="infinite"?Uw(this.options.pages):this.options.behavior)==null||p.onFetch(h,this),te(this,qi,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((v=h.fetchOptions)==null?void 0:v.meta))&&Re(this,hs,Ws).call(this,{type:"fetch",meta:(j=h.fetchOptions)==null?void 0:j.meta});const f=te(this,At,vy({initialPromise:r==null?void 0:r.initialPromise,fn:h.fetchFn,onCancel:M=>{M instanceof df&&M.revert&&this.setState({..._(this,qi),fetchStatus:"idle"}),i.abort()},onFail:(M,E)=>{Re(this,hs,Ws).call(this,{type:"failed",failureCount:M,error:E})},onPause:()=>{Re(this,hs,Ws).call(this,{type:"pause"})},onContinue:()=>{Re(this,hs,Ws).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 df){if(M.silent)return _(this,At).promise;if(M.revert){if(this.state.data===void 0)throw M;return this.state.data}}throw Re(this,hs,Ws).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,At)===f&&te(this,At,void 0),this.scheduleGc()}}},Ti=new WeakMap,ka=new WeakMap,qi=new WeakMap,Jn=new WeakMap,Sa=new WeakMap,At=new WeakMap,_o=new WeakMap,Ca=new WeakMap,hs=new WeakSet,Ws=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,...by(i.data,this.options),fetchMeta:n.meta??null};case"success":const o={...i,...Og(n.data,n.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return te(this,qi,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})})},Bv);function by(e,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:gy(n.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Og(e,n){return{data:e,dataUpdatedAt:n??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ag(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 fn,Ge,Po,mn,_a,Ii,Gs,Eo,$i,zi,Pa,Ea,Or,Oi,nt,lo,ff,mf,pf,xf,gf,vf,yf,jf,Vv,Ku=(Vv=class extends Qa{constructor(n,r){super();ge(this,nt);ge(this,fn);ge(this,Ge);ge(this,Po);ge(this,mn);ge(this,_a);ge(this,Ii);ge(this,Gs);ge(this,Eo);ge(this,$i);ge(this,zi);ge(this,Pa);ge(this,Ea);ge(this,Or);ge(this,Oi,new Set);this.options=r,te(this,fn,n),te(this,Gs,null),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,Ge).addObserver(this),Lg(_(this,Ge),this.options)?Re(this,nt,lo).call(this):this.updateResult(),Re(this,nt,gf).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return bf(_(this,Ge),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return bf(_(this,Ge),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Re(this,nt,vf).call(this),Re(this,nt,yf).call(this),_(this,Ge).removeObserver(this)}setOptions(n){const r=this.options,i=_(this,Ge);if(this.options=_(this,fn).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");Re(this,nt,jf).call(this),_(this,Ge).setOptions(this.options),r._defaulted&&!uo(this.options,r)&&_(this,fn).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,Ge),observer:this});const o=this.hasListeners();o&&Fg(_(this,Ge),i,this.options,r)&&Re(this,nt,lo).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)))&&Re(this,nt,mf).call(this);const c=Re(this,nt,pf).call(this);o&&(_(this,Ge)!==i||Pt(this.options.enabled,_(this,Ge))!==Pt(r.enabled,_(this,Ge))||c!==_(this,Or))&&Re(this,nt,xf).call(this,c)}getOptimisticResult(n){const r=_(this,fn).getQueryCache().build(_(this,fn),n),i=this.createResult(r,n);return uo(this.getCurrentResult(),i)||(te(this,mn,i),te(this,Ii,this.options),te(this,_a,_(this,Ge).state)),i}getCurrentResult(){return _(this,mn)}trackResult(n,r){return new Proxy(n,{get:(i,o)=>(this.trackProp(o),r==null||r(o),Reflect.get(i,o))})}trackProp(n){_(this,Oi).add(n)}getCurrentQuery(){return _(this,Ge)}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const r=_(this,fn).defaultQueryOptions(n),i=_(this,fn).getQueryCache().build(_(this,fn),r);let o=()=>{},c;const d=new Promise(h=>{c=h,o=_(this,fn).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 Re(this,nt,lo).call(this,{...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,mn)))}createResult(n,r){var E;const i=_(this,Ge),o=this.options,c=_(this,mn),d=_(this,_a),h=_(this,Ii),f=n!==i?n.state:_(this,Po),{state:g}=n;let p={...g},v=!1,j;if(r._optimisticResults){const $=this.hasListeners(),Q=!$&&Lg(n,r),H=$&&Fg(n,i,r,o);(Q||H)&&(p={...p,...by(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 $;c!=null&&c.isPlaceholderData&&r.placeholderData===(h==null?void 0:h.placeholderData)?($=c.data,k=!0):$=typeof r.placeholderData=="function"?r.placeholderData((E=_(this,zi))==null?void 0:E.state.data,_(this,zi)):r.placeholderData,$!==void 0&&(b="success",j=uf(c==null?void 0:c.data,$,r),v=!0)}if(r.select&&j!==void 0&&!k)if(c&&j===(d==null?void 0:d.data)&&r.select===_(this,Eo))j=_(this,$i);else try{te(this,Eo,r.select),j=r.select(j),j=uf(c==null?void 0:c.data,j,r),te(this,$i,j),te(this,Gs,null)}catch($){te(this,Gs,$)}else j===void 0&&te(this,Gs,null);_(this,Gs)&&(S=_(this,Gs),j=_(this,$i),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:sm(n,r),refetch:this.refetch,isEnabled:Pt(r.enabled,n)!==!1}}updateResult(){const n=_(this,mn),r=this.createResult(_(this,Ge),this.options);if(te(this,_a,_(this,Ge).state),te(this,Ii,this.options),_(this,_a).data!==void 0&&te(this,zi,_(this,Ge)),uo(r,n))return;te(this,mn,r);const o=(()=>{if(!n)return!0;const{notifyOnChangeProps:c}=this.options,d=typeof c=="function"?c():c;if(d==="all"||!d&&!_(this,Oi).size)return!0;const h=new Set(d??_(this,Oi));return this.options.throwOnError&&h.add("error"),Object.keys(_(this,mn)).some(f=>{const g=f;return _(this,mn)[g]!==n[g]&&h.has(g)})})();Et.batch(()=>{o&&this.listeners.forEach(c=>{c(_(this,mn))}),_(this,fn).getQueryCache().notify({query:_(this,Ge),type:"observerResultsUpdated"})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Re(this,nt,gf).call(this)}},fn=new WeakMap,Ge=new WeakMap,Po=new WeakMap,mn=new WeakMap,_a=new WeakMap,Ii=new WeakMap,Gs=new WeakMap,Eo=new WeakMap,$i=new WeakMap,zi=new WeakMap,Pa=new WeakMap,Ea=new WeakMap,Or=new WeakMap,Oi=new WeakMap,nt=new WeakSet,lo=function(n){Re(this,nt,jf).call(this);let r=_(this,Ge).fetch(this.options,n);return n!=null&&n.throwOnError||(r=r.catch(ln)),r},ff=function(n){return!tm()&&Pt(this.options.enabled,_(this,Ge))!==!1&&my(n)},mf=function(){Re(this,nt,vf).call(this);const n=Pt(this.options.staleTime,_(this,Ge));if(_(this,mn).isStale||!Re(this,nt,ff).call(this,n))return;const r=py(_(this,mn).dataUpdatedAt,n)+1;te(this,Pa,ba.setTimeout(()=>{_(this,mn).isStale||this.updateResult()},r))},pf=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,Ge)):this.options.refetchInterval)??!1},xf=function(n){Re(this,nt,yf).call(this),te(this,Or,n),!(_(this,Or)===0||!Re(this,nt,ff).call(this,_(this,Or)))&&te(this,Ea,ba.setInterval(()=>{(this.options.refetchIntervalInBackground||nm.isFocused())&&Re(this,nt,lo).call(this)},_(this,Or)))},gf=function(){Re(this,nt,mf).call(this),Re(this,nt,xf).call(this,Re(this,nt,pf).call(this))},vf=function(){_(this,Pa)!==void 0&&(ba.clearTimeout(_(this,Pa)),te(this,Pa,void 0))},yf=function(){_(this,Ea)!==void 0&&(ba.clearInterval(_(this,Ea)),te(this,Ea,void 0))},jf=function(){const n=_(this,fn).getQueryCache().build(_(this,fn),this.options);if(n===_(this,Ge))return;const r=_(this,Ge);te(this,Ge,n),te(this,Po,n.state),this.hasListeners()&&(r==null||r.removeObserver(this),n.addObserver(this))},Vv);function Hw(e,n){return Pt(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Pt(n.retryOnMount,e)===!1)}function Lg(e,n){return Hw(e,n)||e.state.data!==void 0&&bf(e,n,n.refetchOnMount)}function bf(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&&sm(e,n)}return!1}function Fg(e,n,r,i){return(e!==n||Pt(i.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&sm(e,r)}function sm(e,n){return Pt(n.enabled,e)!==!1&&e.isStaleByTime(Pt(n.staleTime,e))}var Kw=class extends Ku{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:Qw(n,r.data),hasPreviousPage:Bw(n,r.data),isFetchNextPageError:g,isFetchingNextPage:p,isFetchPreviousPageError:v,isFetchingPreviousPage:j,isRefetchError:h&&!g&&!v,isRefetching:c&&!p&&!j}}},Ro,Cs,sn,Ra,_s,Tr,Hv,Ww=(Hv=class extends yy{constructor(n){super();ge(this,_s);ge(this,Ro);ge(this,Cs);ge(this,sn);ge(this,Ra);te(this,Ro,n.client),this.mutationId=n.mutationId,te(this,sn,n.mutationCache),te(this,Cs,[]),this.state=n.state||wy(),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,sn).notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){te(this,Cs,_(this,Cs).filter(r=>r!==n)),this.scheduleGc(),_(this,sn).notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){_(this,Cs).length||(this.state.status==="pending"?this.scheduleGc():_(this,sn).remove(this))}continue(){var n;return((n=_(this,Ra))==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,$,Q;const r=()=>{Re(this,_s,Tr).call(this,{type:"continue"})},i={client:_(this,Ro),meta:this.options.meta,mutationKey:this.options.mutationKey},o=te(this,Ra,vy({fn:()=>this.options.mutationFn?this.options.mutationFn(n,i):Promise.reject(new Error("No mutationFn found")),onFail:(H,q)=>{Re(this,_s,Tr).call(this,{type:"failed",failureCount:H,error:q})},onPause:()=>{Re(this,_s,Tr).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,sn).canRun(this)})),c=this.state.status==="pending",d=!o.canStart();try{if(c)r();else{Re(this,_s,Tr).call(this,{type:"pending",variables:n,isPaused:d}),_(this,sn).config.onMutate&&await _(this,sn).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&&Re(this,_s,Tr).call(this,{type:"pending",context:q,variables:n,isPaused:d})}const H=await o.start();return await((p=(g=_(this,sn).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,sn).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)),Re(this,_s,Tr).call(this,{type:"success",data:H}),H}catch(H){try{await((z=(C=_(this,sn).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,sn).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=($=this.options).onSettled)==null?void 0:Q.call($,void 0,H,n,this.state.context,i))}catch(q){Promise.reject(q)}throw Re(this,_s,Tr).call(this,{type:"error",error:H}),H}finally{_(this,Ra)===o&&te(this,Ra,void 0),_(this,sn).runNext(this)}}},Ro=new WeakMap,Cs=new WeakMap,sn=new WeakMap,Ra=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,sn).notify({mutation:this,type:"updated",action:n})})},Hv);function wy(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Js,fs,Mo,Kv,Zw=(Kv=class extends Qa{constructor(n={}){super();ge(this,Js);ge(this,fs);ge(this,Mo);this.config=n,te(this,Js,new Set),te(this,fs,new Map),te(this,Mo,0)}build(n,r,i){const o=new Ww({client:n,mutationCache:this,mutationId:++lu(this,Mo)._,options:n.defaultMutationOptions(r),state:i});return this.add(o),o}add(n){_(this,Js).add(n);const r=cu(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,Js).delete(n)){const r=cu(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=cu(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=cu(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,Js).forEach(n=>{this.notify({type:"removed",mutation:n})}),_(this,Js).clear(),_(this,fs).clear()})}getAll(){return Array.from(_(this,Js))}find(n){const r={exact:!0,...n};return this.getAll().find(i=>Ig(r,i))}findAll(n={}){return this.getAll().filter(r=>Ig(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(ln))))}},Js=new WeakMap,fs=new WeakMap,Mo=new WeakMap,Kv);function cu(e){var n;return(n=e.options.scope)==null?void 0:n.id}var Xs,Ar,rn,Ys,Rs,oo,wf,Wv,Gw=(Wv=class extends Qa{constructor(r,i){super();ge(this,Rs);ge(this,Xs);ge(this,Ar);ge(this,rn);ge(this,Ys);te(this,Xs,r),this.setOptions(i),this.bindMethods(),Re(this,Rs,oo).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,Xs).defaultMutationOptions(r),uo(this.options,i)||_(this,Xs).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,rn),observer:this}),i!=null&&i.mutationKey&&this.options.mutationKey&&$a(i.mutationKey)!==$a(this.options.mutationKey)?this.reset():((o=_(this,rn))==null?void 0:o.state.status)==="pending"&&_(this,rn).setOptions(this.options)}onSubscribe(){this.listeners.size===1&&_(this,rn)&&(_(this,rn).addObserver(this),Re(this,Rs,oo).call(this))}onUnsubscribe(){var r;this.hasListeners()||(r=_(this,rn))==null||r.removeObserver(this)}onMutationUpdate(r){Re(this,Rs,oo).call(this),Re(this,Rs,wf).call(this,r)}getCurrentResult(){return _(this,Ar)}reset(){var r;(r=_(this,rn))==null||r.removeObserver(this),te(this,rn,void 0),Re(this,Rs,oo).call(this),Re(this,Rs,wf).call(this)}mutate(r,i){var o;return te(this,Ys,i),(o=_(this,rn))==null||o.removeObserver(this),te(this,rn,_(this,Xs).getMutationCache().build(_(this,Xs),this.options)),_(this,rn).addObserver(this),_(this,rn).execute(r)}},Xs=new WeakMap,Ar=new WeakMap,rn=new WeakMap,Ys=new WeakMap,Rs=new WeakSet,oo=function(){var i;const r=((i=_(this,rn))==null?void 0:i.state)??wy();te(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})},wf=function(r){Et.batch(()=>{var i,o,c,d,h,f,g,p;if(_(this,Ys)&&this.hasListeners()){const v=_(this,Ar).variables,j=_(this,Ar).context,S={client:_(this,Xs),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(o=(i=_(this,Ys)).onSuccess)==null||o.call(i,r.data,v,j,S)}catch(y){Promise.reject(y)}try{(d=(c=_(this,Ys)).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,Ys)).onError)==null||f.call(h,r.error,v,j,S)}catch(y){Promise.reject(y)}try{(p=(g=_(this,Ys)).onSettled)==null||p.call(g,void 0,r.error,v,j,S)}catch(y){Promise.reject(y)}}}this.listeners.forEach(v=>{v(_(this,Ar))})})},Wv);function Dg(e,n){const r=new Set(n);return e.filter(i=>!r.has(i))}var Ai,pn,Li,Ma,zn,Ta,To,qo,Io,$o,Lt,Nf,kf,Ny,Sf,Cf,_f,Zv,Jw=(Zv=class extends Qa{constructor(n,r,i){super();ge(this,Lt);ge(this,Ai);ge(this,pn);ge(this,Li);ge(this,Ma);ge(this,zn);ge(this,Ta);ge(this,To);ge(this,qo);ge(this,Io);ge(this,$o,[]);te(this,Ai,n),te(this,Ma,i),te(this,Li,[]),te(this,zn,[]),te(this,pn,[]),this.setQueries(r)}onSubscribe(){this.listeners.size===1&&_(this,zn).forEach(n=>{n.subscribe(r=>{Re(this,Lt,Cf).call(this,n,r)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,_(this,zn).forEach(n=>{n.destroy()})}setQueries(n,r){te(this,Li,n),te(this,Ma,r),Et.batch(()=>{const i=_(this,zn),o=Re(this,Lt,Sf).call(this,_(this,Li));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,pn)[j];return!S||!uo(v,S)});!g&&!p||(g&&(te(this,$o,o),te(this,zn,c)),te(this,pn,d),this.hasListeners()&&(g&&(Dg(i,c).forEach(v=>{v.destroy()}),Dg(c,i).forEach(v=>{v.subscribe(j=>{Re(this,Lt,Cf).call(this,v,j)})})),Re(this,Lt,_f).call(this)))})}getCurrentResult(){return _(this,pn)}getQueries(){return _(this,zn).map(n=>n.getCurrentQuery())}getObservers(){return _(this,zn)}getOptimisticResult(n,r){const i=Re(this,Lt,Sf).call(this,n),o=i.map(d=>d.observer.getOptimisticResult(d.defaultedQueryOptions)),c=i.map(d=>d.defaultedQueryOptions.queryHash);return[o,d=>Re(this,Lt,kf).call(this,d??o,r,c),()=>Re(this,Lt,Nf).call(this,o,i)]}},Ai=new WeakMap,pn=new WeakMap,Li=new WeakMap,Ma=new WeakMap,zn=new WeakMap,Ta=new WeakMap,To=new WeakMap,qo=new WeakMap,Io=new WeakMap,$o=new WeakMap,Lt=new WeakSet,Nf=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)}))})})},kf=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,pn)!==_(this,qo)||c||r!==_(this,To))&&(te(this,To,r),te(this,qo,_(this,pn)),i!==void 0&&te(this,Io,i),te(this,Ta,Xf(_(this,Ta),r(n)))),_(this,Ta)}return n},Ny=function(){var n;return!((n=_(this,Ma))!=null&&n.combine)||_(this,zn).some((r,i)=>{var o;return r.options.suspense&&((o=_(this,pn)[i])==null?void 0:o.data)===void 0})},Sf=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,Ai).defaultQueryOptions(o),d=((h=r.get(c.queryHash))==null?void 0:h.shift())??new Ku(_(this,Ai),c);i.push({defaultedQueryOptions:c,observer:d})}),i},Cf=function(n,r){const i=_(this,zn).indexOf(n);i!==-1&&(te(this,pn,_(this,pn).slice()),_(this,pn)[i]=r,Re(this,Lt,_f).call(this))},_f=function(){var n;if(this.hasListeners()){const r=Re(this,Lt,Ny).call(this),i=_(this,Ta),o=r?i:Re(this,Lt,kf).call(this,Re(this,Lt,Nf).call(this,_(this,pn),_(this,$o)),(n=_(this,Ma))==null?void 0:n.combine);(r||i!==o)&&Et.batch(()=>{this.listeners.forEach(c=>{c(_(this,pn))})})}},Zv),Ps,Gv,Xw=(Gv=class extends Qa{constructor(n={}){super();ge(this,Ps);this.config=n,te(this,Ps,new Map)}build(n,r,i){const o=r.queryKey,c=r.queryHash??Jf(o,r);let d=this.get(c);return d||(d=new Vw({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=>qg(r,i))}findAll(n={}){const r=this.getAll();return Object.keys(n).length>0?r.filter(i=>qg(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,Gv),Ct,Lr,Fr,Fi,Di,Dr,Ui,Qi,Jv,Yw=(Jv=class{constructor(e={}){ge(this,Ct);ge(this,Lr);ge(this,Fr);ge(this,Fi);ge(this,Di);ge(this,Dr);ge(this,Ui);ge(this,Qi);te(this,Ct,e.queryCache||new Xw),te(this,Lr,e.mutationCache||new Zw),te(this,Fr,e.defaultOptions||{}),te(this,Fi,new Map),te(this,Di,new Map),te(this,Dr,0)}mount(){lu(this,Dr)._++,_(this,Dr)===1&&(te(this,Ui,nm.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,Ct).onFocus())})),te(this,Qi,Nu.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,Ct).onOnline())})))}unmount(){var e,n;lu(this,Dr)._--,_(this,Dr)===0&&((e=_(this,Ui))==null||e.call(this),te(this,Ui,void 0),(n=_(this,Qi))==null||n.call(this),te(this,Qi,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=Rw(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(ln).catch(ln)}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(ln)),o.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(i).then(ln)}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(ln).catch(ln)}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(ln).catch(ln)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Nu.isOnline()?_(this,Lr).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,Ct)}getMutationCache(){return _(this,Lr)}getDefaultOptions(){return _(this,Fr)}setDefaultOptions(e){te(this,Fr,e)}setQueryDefaults(e,n){_(this,Fi).set($a(e),{queryKey:e,defaultOptions:n})}getQueryDefaults(e){const n=[..._(this,Fi).values()],r={};return n.forEach(i=>{Vi(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,n){_(this,Di).set($a(e),{mutationKey:e,defaultOptions:n})}getMutationDefaults(e){const n=[..._(this,Di).values()],r={};return n.forEach(i=>{Vi(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=Jf(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===Yf&&(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,Fi=new WeakMap,Di=new WeakMap,Dr=new WeakMap,Ui=new WeakMap,Qi=new WeakMap,Jv);const ky=w.createContext(!1),Sy=()=>w.useContext(ky);ky.Provider;function eN(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const tN=w.createContext(eN()),Cy=()=>w.useContext(tN),_y=(e,n,r)=>{const i=r!=null&&r.state.error&&typeof e.throwOnError=="function"?em(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||i)&&(n.isReset()||(e.retryOnMount=!1))},Py=e=>{w.useEffect(()=>{e.clearReset()},[e])},Ey=({result:e,errorResetBoundary:n,throwOnError:r,query:i,suspense:o})=>e.isError&&!n.isReset()&&!e.isFetching&&i&&(o&&e.data===void 0||em(r,[e.error,i])),Ry=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))}},Pf=(e,n)=>(e==null?void 0:e.suspense)&&n.isPending,My=(e,n,r)=>n.fetchOptimistic(e).catch(()=>{r.clearReset()});function Ty({queries:e,...n},r){const i=We(),o=Sy(),c=Cy(),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=>{Ry(b);const k=i.getQueryCache().get(b.queryHash);_y(b,c,k)}),Py(c);const[f]=w.useState(()=>new Jw(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)):ln,[f,j]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),w.useEffect(()=>{f.setQueries(h,n)},[h,n,f]);const S=g.some((b,k)=>Pf(h[k],b))?g.flatMap((b,k)=>{const C=h[k];if(C&&Pf(C,b)){const z=new Ku(i,C);return My(C,z,c)}return[]}):[];if(S.length>0)throw Promise.all(S);const y=g.find((b,k)=>{const C=h[k];return C&&Ey({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 qy(e,n,r){const i=Sy(),o=Cy(),c=We(),d=c.defaultQueryOptions(e),h=c.getQueryCache().get(d.queryHash),f=e.subscribed!==!1;d._optimisticResults=i?"isRestoring":f?"optimistic":void 0,Ry(d),_y(d,o,h),Py(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)):ln;return g.updateResult(),S},[g,v]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),w.useEffect(()=>{g.setOptions(d)},[d,g]),Pf(d,p))throw My(d,g,o);if(Ey({result:p,errorResetBoundary:o,throwOnError:d.throwOnError,query:h,suspense:d.suspense}))throw p.error;return d.notifyOnChangeProps?p:g.trackResult(p)}function st(e,n){return qy(e,Ku)}function He(e,n){const r=We(),[i]=w.useState(()=>new Gw(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(ln)},[i]);if(o.error&&em(i.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:c,mutateAsync:o.mutate}}function Iy(e,n){return qy(e,Kw)}/**
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 nN=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$y=(...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 sN={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 rN=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,...sN,width:n,height:n,stroke:e,strokeWidth:i?Number(r)*24/Number(n):r,className:$y("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 re=(e,n)=>{const r=w.forwardRef(({className:i,...o},c)=>w.createElement(rN,{ref:c,iconNode:n,className:$y(`lucide-${nN(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 Oo=re("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 aN=re("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 iN=re("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 lN=re("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 oN=re("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 rm=re("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 cN=re("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 uN=re("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 dN=re("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 am=re("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 nl=re("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 zy=re("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 hN=re("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 Oy=re("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 Ao=re("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 im=re("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=re("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=re("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 ku=re("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=re("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 fN=re("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 mN=re("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 lm=re("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 Ay=re("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 Ly=re("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 pN=re("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 Fy=re("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 xN=re("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 gN=re("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 Ba=re("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 vN=re("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 yN=re("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=re("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 Lo=re("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 Dy=re("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 om=re("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 jN=re("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 bN=re("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 Uy=re("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 Ug=re("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 nr=re("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 po=re("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 wN=re("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 NN=re("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 kN=re("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 SN=re("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 Va=re("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 sl=re("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 CN=re("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 Fo=re("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 _N=re("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 Qy=re("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 xo=re("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 PN=re("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 EN=re("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 RN=re("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 By=re("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 MN=re("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=re("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 Do=re("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 Uo=re("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 Vy=re("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=re("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 cm=re("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 Hy=re("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 Wu=re("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 Qo=re("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=re("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 TN=re("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 qN=re("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 Ky=re("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 Wy=re("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 um=re("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 Zu=re("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 IN=re("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 $N=re("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 Qg=re("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 Zy=re("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=re("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=re("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 dm=re("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 zN=re("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 ON=re("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 AN=re("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 Gu=re("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 Ef=re("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 LN=re("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=re("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 Gy=re("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 Jy(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=Jy(e[n]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function FN(){for(var e,n,r=0,i="",o=arguments.length;r<o;r++)(e=arguments[r])&&(n=Jy(e))&&(i&&(i+=" "),i+=n);return i}function F(...e){return FN(e)}function Vt({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(Qy,{className:"animate-spin",style:{width:n,height:n},"aria-hidden":!0}),r&&t.jsx("span",{className:"text-xs",children:r})]})}function rl({label:e="Loading…"}){return t.jsx("div",{className:"flex h-48 w-full items-center justify-center",children:t.jsx(Vt,{size:18,label:e})})}function Su({className:e}){return t.jsx("span",{className:F("skeleton inline-block h-3 w-16 align-middle",e),"aria-hidden":!0})}class Rf extends Error{constructor(r,i){super(i.message||i.error||`Request failed (${r})`);Dh(this,"status");Dh(this,"body");this.name="ApiRequestError",this.status=r,this.body=i}get code(){return this.body.error}}function sr(e){return e instanceof Rf}function ve(e,n="Something went wrong"){return sr(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 DN(e){Object.assign(Ss,e)}const Bg="/api";function Xy(e,n){const r=e.startsWith("/")?`${Bg}${e}`:`${Bg}/${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 UN(e){return typeof e=="object"&&e!==null&&typeof e.error=="string"}async function ro(e,n,r,i={}){const o={accept:"application/json"};r!==void 0&&(o["content-type"]="application/json");let c;try{c=await fetch(Xy(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 Rf(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=UN(h)?h:{error:`http_${c.status}`,message:typeof h=="string"&&h.slice(0,200)||c.statusText||`Request failed (${c.status})`},g=new Rf(c.status,f);throw i.silent===!0||Array.isArray(i.silent)&&i.silent.includes(c.status)||QN(g),g}function QN(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 ie={get:(e,n)=>ro("GET",e,void 0,n),post:(e,n,r)=>ro("POST",e,n??{},r),patch:(e,n,r)=>ro("PATCH",e,n??{},r),put:(e,n,r)=>ro("PUT",e,n??{},r),del:(e,n)=>ro("DELETE",e,void 0,n)},Ke=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 Vg;(function(e){e.mergeShapes=(n,r)=>({...n,...r})})(Vg||(Vg={}));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}},ee=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 Mf=(e,n)=>{let r;switch(e.code){case ee.invalid_type:e.received===je.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ee.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Xe.jsonStringifyReplacer)}`;break;case ee.unrecognized_keys:r=`Unrecognized key(s) in object: ${Xe.joinValues(e.keys,", ")}`;break;case ee.invalid_union:r="Invalid input";break;case ee.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Xe.joinValues(e.options)}`;break;case ee.invalid_enum_value:r=`Invalid enum value. Expected ${Xe.joinValues(e.options)}, received '${e.received}'`;break;case ee.invalid_arguments:r="Invalid function arguments";break;case ee.invalid_return_type:r="Invalid function return type";break;case ee.invalid_date:r="Invalid date";break;case ee.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 ee.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 ee.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 ee.custom:r="Invalid input";break;case ee.invalid_intersection_types:r="Intersection results could not be merged";break;case ee.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ee.not_finite:r="Number must be finite";break;default:r=n.defaultError,Xe.assertNever(e)}return{message:r}};let BN=Mf;function VN(){return BN}const HN=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 de(e,n){const r=VN(),i=HN({issueData:n,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Mf?void 0:Mf].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 ze;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 ze;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 ze=Object.freeze({status:"aborted"}),co=e=>({status:"dirty",value:e}),ns=e=>({status:"valid",value:e}),Hg=e=>e.status==="aborted",Kg=e=>e.status==="dirty",Hi=e=>e.status==="valid",Cu=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 Ts{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 Wg=(e,n)=>{if(Hi(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 Qe(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(Cu(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 Wg(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 Hi(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=>Hi(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(Cu(o)?o:Promise.resolve(o));return Wg(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:ee.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 Fa({schema:this,typeName:Oe.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 tr.create(this,this._def)}nullable(){return Da.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ms.create(this)}promise(){return Tu.create(this,this._def)}or(n){return Pu.create([this,n],this._def)}and(n){return Eu.create(this,n,this._def)}transform(n){return new Fa({...Qe(this._def),schema:this,typeName:Oe.ZodEffects,effect:{type:"transform",transform:n}})}default(n){const r=typeof n=="function"?n:()=>n;return new qu({...Qe(this._def),innerType:this,defaultValue:r,typeName:Oe.ZodDefault})}brand(){return new n0({typeName:Oe.ZodBranded,type:this,...Qe(this._def)})}catch(n){const r=typeof n=="function"?n:()=>n;return new Iu({...Qe(this._def),innerType:this,catchValue:r,typeName:Oe.ZodCatch})}describe(n){const r=this.constructor;return new r({...this._def,description:n})}pipe(n){return fm.create(this,n)}readonly(){return $u.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const KN=/^c[^\s-]{8,}$/i,WN=/^[0-9a-z]+$/,ZN=/^[0-9A-HJKMNP-TV-Z]{26}$/i,GN=/^[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,JN=/^[a-z0-9_-]{21}$/i,XN=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,YN=/^[-+]?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)?)??$/,ek=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tk="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Zh;const nk=/^(?:(?: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])$/,sk=/^(?:(?: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])$/,rk=/^(([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]))$/,ak=/^(([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])$/,ik=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,lk=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Yy="((\\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])))",ok=new RegExp(`^${Yy}$`);function e0(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 ck(e){return new RegExp(`^${e0(e)}$`)}function uk(e){let n=`${Yy}T${e0(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 dk(e,n){return!!((n==="v4"||!n)&&nk.test(e)||(n==="v6"||!n)&&rk.test(e))}function hk(e,n){if(!XN.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 fk(e,n){return!!((n==="v4"||!n)&&sk.test(e)||(n==="v6"||!n)&&ak.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 de(c,{code:ee.invalid_type,expected:je.string,received:c.parsedType}),ze}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),de(o,{code:ee.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),de(o,{code:ee.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?de(o,{code:ee.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):h&&de(o,{code:ee.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),i.dirty())}else if(c.kind==="email")ek.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"email",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="emoji")Zh||(Zh=new RegExp(tk,"u")),Zh.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"emoji",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="uuid")GN.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"uuid",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="nanoid")JN.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"nanoid",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="cuid")KN.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"cuid",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="cuid2")WN.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"cuid2",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="ulid")ZN.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"ulid",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="url")try{new URL(n.data)}catch{o=this._getOrReturnCtx(n,o),de(o,{validation:"url",code:ee.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),de(o,{validation:"regex",code:ee.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),de(o,{code:ee.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),de(o,{code:ee.invalid_string,validation:{startsWith:c.value},message:c.message}),i.dirty()):c.kind==="endsWith"?n.data.endsWith(c.value)||(o=this._getOrReturnCtx(n,o),de(o,{code:ee.invalid_string,validation:{endsWith:c.value},message:c.message}),i.dirty()):c.kind==="datetime"?uk(c).test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{code:ee.invalid_string,validation:"datetime",message:c.message}),i.dirty()):c.kind==="date"?ok.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{code:ee.invalid_string,validation:"date",message:c.message}),i.dirty()):c.kind==="time"?ck(c).test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{code:ee.invalid_string,validation:"time",message:c.message}),i.dirty()):c.kind==="duration"?YN.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"duration",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="ip"?dk(n.data,c.version)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"ip",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="jwt"?hk(n.data,c.alg)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"jwt",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="cidr"?fk(n.data,c.version)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"cidr",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="base64"?ik.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"base64",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="base64url"?lk.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"base64url",code:ee.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:ee.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:Oe.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Qe(e)});function mk(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 za 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 de(c,{code:ee.invalid_type,expected:je.number,received:c.parsedType}),ze}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),de(i,{code:ee.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),de(i,{code:ee.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),de(i,{code:ee.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),o.dirty()):c.kind==="multipleOf"?mk(n.data,c.value)!==0&&(i=this._getOrReturnCtx(n,i),de(i,{code:ee.not_multiple_of,multipleOf:c.value,message:c.message}),o.dirty()):c.kind==="finite"?Number.isFinite(n.data)||(i=this._getOrReturnCtx(n,i),de(i,{code:ee.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 za({...this._def,checks:[...this._def.checks,{kind:n,value:r,inclusive:i,message:_e.toString(o)}]})}_addCheck(n){return new za({...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)}}za.create=e=>new za({checks:[],typeName:Oe.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Qe(e)});class Oa 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),de(i,{code:ee.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),de(i,{code:ee.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),de(i,{code:ee.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 de(r,{code:ee.invalid_type,expected:je.bigint,received:r.parsedType}),ze}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]})}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}}Oa.create=e=>new Oa({checks:[],typeName:Oe.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Qe(e)});class _u extends Ze{_parse(n){if(this._def.coerce&&(n.data=!!n.data),this._getType(n)!==je.boolean){const i=this._getOrReturnCtx(n);return de(i,{code:ee.invalid_type,expected:je.boolean,received:i.parsedType}),ze}return ns(n.data)}}_u.create=e=>new _u({typeName:Oe.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Qe(e)});class Ki 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 de(c,{code:ee.invalid_type,expected:je.date,received:c.parsedType}),ze}if(Number.isNaN(n.data.getTime())){const c=this._getOrReturnCtx(n);return de(c,{code:ee.invalid_date}),ze}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),de(o,{code:ee.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),de(o,{code:ee.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 Ki({...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}}Ki.create=e=>new Ki({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Oe.ZodDate,...Qe(e)});class Zg extends Ze{_parse(n){if(this._getType(n)!==je.symbol){const i=this._getOrReturnCtx(n);return de(i,{code:ee.invalid_type,expected:je.symbol,received:i.parsedType}),ze}return ns(n.data)}}Zg.create=e=>new Zg({typeName:Oe.ZodSymbol,...Qe(e)});class Tf extends Ze{_parse(n){if(this._getType(n)!==je.undefined){const i=this._getOrReturnCtx(n);return de(i,{code:ee.invalid_type,expected:je.undefined,received:i.parsedType}),ze}return ns(n.data)}}Tf.create=e=>new Tf({typeName:Oe.ZodUndefined,...Qe(e)});class qf extends Ze{_parse(n){if(this._getType(n)!==je.null){const i=this._getOrReturnCtx(n);return de(i,{code:ee.invalid_type,expected:je.null,received:i.parsedType}),ze}return ns(n.data)}}qf.create=e=>new qf({typeName:Oe.ZodNull,...Qe(e)});class Gg extends Ze{constructor(){super(...arguments),this._any=!0}_parse(n){return ns(n.data)}}Gg.create=e=>new Gg({typeName:Oe.ZodAny,...Qe(e)});class If extends Ze{constructor(){super(...arguments),this._unknown=!0}_parse(n){return ns(n.data)}}If.create=e=>new If({typeName:Oe.ZodUnknown,...Qe(e)});class Hr extends Ze{_parse(n){const r=this._getOrReturnCtx(n);return de(r,{code:ee.invalid_type,expected:je.never,received:r.parsedType}),ze}}Hr.create=e=>new Hr({typeName:Oe.ZodNever,...Qe(e)});class Jg extends Ze{_parse(n){if(this._getType(n)!==je.undefined){const i=this._getOrReturnCtx(n);return de(i,{code:ee.invalid_type,expected:je.void,received:i.parsedType}),ze}return ns(n.data)}}Jg.create=e=>new Jg({typeName:Oe.ZodVoid,...Qe(e)});class Ms extends Ze{_parse(n){const{ctx:r,status:i}=this._processInputParams(n),o=this._def;if(r.parsedType!==je.array)return de(r,{code:ee.invalid_type,expected:je.array,received:r.parsedType}),ze;if(o.exactLength!==null){const d=r.data.length>o.exactLength.value,h=r.data.length<o.exactLength.value;(d||h)&&(de(r,{code:d?ee.too_big:ee.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&&(de(r,{code:ee.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&&(de(r,{code:ee.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 Ts(r,d,r.path,h)))).then(d=>yn.mergeArray(i,d));const c=[...r.data].map((d,h)=>o.type._parseSync(new Ts(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:Oe.ZodArray,...Qe(n)});function Pi(e){if(e instanceof qt){const n={};for(const r in e.shape){const i=e.shape[r];n[r]=tr.create(Pi(i))}return new qt({...e._def,shape:()=>n})}else return e instanceof Ms?new Ms({...e._def,type:Pi(e.element)}):e instanceof tr?tr.create(Pi(e.unwrap())):e instanceof Da?Da.create(Pi(e.unwrap())):e instanceof Aa?Aa.create(e.items.map(n=>Pi(n))):e}class qt 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 de(g,{code:ee.invalid_type,expected:je.object,received:g.parsedType}),ze}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 Ts(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&&(de(o,{code:ee.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 Ts(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 qt({...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 qt({...this._def,unknownKeys:"strip"})}passthrough(){return new qt({...this._def,unknownKeys:"passthrough"})}extend(n){return new qt({...this._def,shape:()=>({...this._def.shape(),...n})})}merge(n){return new qt({unknownKeys:n._def.unknownKeys,catchall:n._def.catchall,shape:()=>({...this._def.shape(),...n._def.shape()}),typeName:Oe.ZodObject})}setKey(n,r){return this.augment({[n]:r})}catchall(n){return new qt({...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 qt({...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 qt({...this._def,shape:()=>r})}deepPartial(){return Pi(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 qt({...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 tr;)c=c._def.innerType;r[i]=c}return new qt({...this._def,shape:()=>r})}keyof(){return t0(Xe.objectKeys(this.shape))}}qt.create=(e,n)=>new qt({shape:()=>e,unknownKeys:"strip",catchall:Hr.create(),typeName:Oe.ZodObject,...Qe(n)});qt.strictCreate=(e,n)=>new qt({shape:()=>e,unknownKeys:"strict",catchall:Hr.create(),typeName:Oe.ZodObject,...Qe(n)});qt.lazycreate=(e,n)=>new qt({shape:e,unknownKeys:"strip",catchall:Hr.create(),typeName:Oe.ZodObject,...Qe(n)});class Pu 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 de(r,{code:ee.invalid_union,unionErrors:d}),ze}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 de(r,{code:ee.invalid_union,unionErrors:h}),ze}}get options(){return this._def.options}}Pu.create=(e,n)=>new Pu({options:e,typeName:Oe.ZodUnion,...Qe(n)});const Zs=e=>e instanceof zf?Zs(e.schema):e instanceof Fa?Zs(e.innerType()):e instanceof Mu?[e.value]:e instanceof La?e.options:e instanceof Of?Xe.objectValues(e.enum):e instanceof qu?Zs(e._def.innerType):e instanceof Tf?[void 0]:e instanceof qf?[null]:e instanceof tr?[void 0,...Zs(e.unwrap())]:e instanceof Da?[null,...Zs(e.unwrap())]:e instanceof n0||e instanceof $u?Zs(e.unwrap()):e instanceof Iu?Zs(e._def.innerType):[];class hm extends Ze{_parse(n){const{ctx:r}=this._processInputParams(n);if(r.parsedType!==je.object)return de(r,{code:ee.invalid_type,expected:je.object,received:r.parsedType}),ze;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}):(de(r,{code:ee.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),ze)}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=Zs(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 hm({typeName:Oe.ZodDiscriminatedUnion,discriminator:n,options:r,optionsMap:o,...Qe(i)})}}function $f(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=$f(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=$f(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 Eu extends Ze{_parse(n){const{status:r,ctx:i}=this._processInputParams(n),o=(c,d)=>{if(Hg(c)||Hg(d))return ze;const h=$f(c.value,d.value);return h.valid?((Kg(c)||Kg(d))&&r.dirty(),{status:r.value,value:h.data}):(de(i,{code:ee.invalid_intersection_types}),ze)};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}))}}Eu.create=(e,n,r)=>new Eu({left:e,right:n,typeName:Oe.ZodIntersection,...Qe(r)});class Aa extends Ze{_parse(n){const{status:r,ctx:i}=this._processInputParams(n);if(i.parsedType!==je.array)return de(i,{code:ee.invalid_type,expected:je.array,received:i.parsedType}),ze;if(i.data.length<this._def.items.length)return de(i,{code:ee.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ze;!this._def.rest&&i.data.length>this._def.items.length&&(de(i,{code:ee.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 Ts(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 Aa({...this._def,rest:n})}}Aa.create=(e,n)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Aa({items:e,typeName:Oe.ZodTuple,rest:null,...Qe(n)})};class Ru 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 de(i,{code:ee.invalid_type,expected:je.object,received:i.parsedType}),ze;const o=[],c=this._def.keyType,d=this._def.valueType;for(const h in i.data)o.push({key:c._parse(new Ts(i,h,i.path,h)),value:d._parse(new Ts(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 Ru({keyType:n,valueType:r,typeName:Oe.ZodRecord,...Qe(i)}):new Ru({keyType:Es.create(),valueType:n,typeName:Oe.ZodRecord,...Qe(r)})}}class Xg 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 de(i,{code:ee.invalid_type,expected:je.map,received:i.parsedType}),ze;const o=this._def.keyType,c=this._def.valueType,d=[...i.data.entries()].map(([h,f],g)=>({key:o._parse(new Ts(i,h,i.path,[g,"key"])),value:c._parse(new Ts(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 ze;(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 ze;(g.status==="dirty"||p.status==="dirty")&&r.dirty(),h.set(g.value,p.value)}return{status:r.value,value:h}}}}Xg.create=(e,n,r)=>new Xg({valueType:n,keyType:e,typeName:Oe.ZodMap,...Qe(r)});class go extends Ze{_parse(n){const{status:r,ctx:i}=this._processInputParams(n);if(i.parsedType!==je.set)return de(i,{code:ee.invalid_type,expected:je.set,received:i.parsedType}),ze;const o=this._def;o.minSize!==null&&i.data.size<o.minSize.value&&(de(i,{code:ee.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&&(de(i,{code:ee.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 ze;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 Ts(i,f,i.path,g)));return i.common.async?Promise.all(h).then(f=>d(f)):d(h)}min(n,r){return new go({...this._def,minSize:{value:n,message:_e.toString(r)}})}max(n,r){return new go({...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)}}go.create=(e,n)=>new go({valueType:e,minSize:null,maxSize:null,typeName:Oe.ZodSet,...Qe(n)});class zf 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})}}zf.create=(e,n)=>new zf({getter:e,typeName:Oe.ZodLazy,...Qe(n)});class Mu extends Ze{_parse(n){if(n.data!==this._def.value){const r=this._getOrReturnCtx(n);return de(r,{received:r.data,code:ee.invalid_literal,expected:this._def.value}),ze}return{status:"valid",value:n.data}}get value(){return this._def.value}}Mu.create=(e,n)=>new Mu({value:e,typeName:Oe.ZodLiteral,...Qe(n)});function t0(e,n){return new La({values:e,typeName:Oe.ZodEnum,...Qe(n)})}class La extends Ze{_parse(n){if(typeof n.data!="string"){const r=this._getOrReturnCtx(n),i=this._def.values;return de(r,{expected:Xe.joinValues(i),received:r.parsedType,code:ee.invalid_type}),ze}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 de(r,{received:r.data,code:ee.invalid_enum_value,options:i}),ze}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 La.create(n,{...this._def,...r})}exclude(n,r=this._def){return La.create(this.options.filter(i=>!n.includes(i)),{...this._def,...r})}}La.create=t0;class Of 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 de(i,{expected:Xe.joinValues(o),received:i.parsedType,code:ee.invalid_type}),ze}if(this._cache||(this._cache=new Set(Xe.getValidEnumValues(this._def.values))),!this._cache.has(n.data)){const o=Xe.objectValues(r);return de(i,{received:i.data,code:ee.invalid_enum_value,options:o}),ze}return ns(n.data)}get enum(){return this._def.values}}Of.create=(e,n)=>new Of({values:e,typeName:Oe.ZodNativeEnum,...Qe(n)});class Tu 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 de(r,{code:ee.invalid_type,expected:je.promise,received:r.parsedType}),ze;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})))}}Tu.create=(e,n)=>new Tu({type:e,typeName:Oe.ZodPromise,...Qe(n)});class Fa extends Ze{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Oe.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=>{de(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 ze;const f=await this._def.schema._parseAsync({data:h,path:i.path,parent:i});return f.status==="aborted"?ze:f.status==="dirty"||r.value==="dirty"?co(f.value):f});{if(r.value==="aborted")return ze;const h=this._def.schema._parseSync({data:d,path:i.path,parent:i});return h.status==="aborted"?ze:h.status==="dirty"||r.value==="dirty"?co(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"?ze:(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"?ze:(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(!Hi(d))return ze;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=>Hi(d)?Promise.resolve(o.transform(d.value,c)).then(h=>({status:r.value,value:h})):ze);Xe.assertNever(o)}}Fa.create=(e,n,r)=>new Fa({schema:e,typeName:Oe.ZodEffects,effect:n,...Qe(r)});Fa.createWithPreprocess=(e,n,r)=>new Fa({schema:n,effect:{type:"preprocess",transform:e},typeName:Oe.ZodEffects,...Qe(r)});class tr extends Ze{_parse(n){return this._getType(n)===je.undefined?ns(void 0):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}tr.create=(e,n)=>new tr({innerType:e,typeName:Oe.ZodOptional,...Qe(n)});class Da extends Ze{_parse(n){return this._getType(n)===je.null?ns(null):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}Da.create=(e,n)=>new Da({innerType:e,typeName:Oe.ZodNullable,...Qe(n)});class qu 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}}qu.create=(e,n)=>new qu({innerType:e,typeName:Oe.ZodDefault,defaultValue:typeof n.default=="function"?n.default:()=>n.default,...Qe(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 Cu(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:Oe.ZodCatch,catchValue:typeof n.catch=="function"?n.catch:()=>n.catch,...Qe(n)});class Yg extends Ze{_parse(n){if(this._getType(n)!==je.nan){const i=this._getOrReturnCtx(n);return de(i,{code:ee.invalid_type,expected:je.nan,received:i.parsedType}),ze}return{status:"valid",value:n.data}}}Yg.create=e=>new Yg({typeName:Oe.ZodNaN,...Qe(e)});class n0 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 fm 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"?ze:c.status==="dirty"?(r.dirty(),co(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"?ze: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 fm({in:n,out:r,typeName:Oe.ZodPipeline})}}class $u extends Ze{_parse(n){const r=this._def.innerType._parse(n),i=o=>(Hi(o)&&(o.value=Object.freeze(o.value)),o);return Cu(r)?r.then(o=>i(o)):i(r)}unwrap(){return this._def.innerType}}$u.create=(e,n)=>new $u({innerType:e,typeName:Oe.ZodReadonly,...Qe(n)});var Oe;(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"})(Oe||(Oe={}));const he=Es.create,xn=za.create;Oa.create;const qs=_u.create;Ki.create;const ev=If.create;Hr.create;const al=Ms.create,Ae=qt.create,s0=Pu.create,Ju=hm.create;Eu.create;Aa.create;const r0=Ru.create,_n=Mu.create,ss=La.create;Tu.create;tr.create;Da.create;const ar={string:(e=>Es.create({...e,coerce:!0})),number:(e=>za.create({...e,coerce:!0})),boolean:(e=>_u.create({...e,coerce:!0})),bigint:(e=>Oa.create({...e,coerce:!0})),date:(e=>Ki.create({...e,coerce:!0}))},mm=["alerts","users","folders","flows","audit","sso","mcp"],a0={monthlyUsd:39,yearlyUsd:390},i0=he().trim().min(8).max(512);Ae({key:i0,instance:Ae({label:he().trim().min(1).max(120),version:he().max(40).optional()})});Ae({key:i0,activationId:he().trim().min(1).max(120)});const zu=["admin","operator","viewer"],pk="anonymous";function xk(e){return(e==null?void 0:e.id)===pk}const l0=ss(zu),gk=Ae({email:he().email(),name:he().min(1).max(80),password:he().min(8).max(200)}),vk=Ae({email:he().email(),password:he().min(1)}),yk=Ae({email:he().email(),name:he().min(1).max(80),role:l0,password:he().min(8).max(200).optional()});Ae({name:he().min(1).max(80).optional(),role:l0.optional(),password:he().min(8).max(200).optional(),disabled:qs().optional()});const o0=Ae({issuer:he().url(),clientId:he().min(1).max(255),clientSecret:he().min(1).max(500).optional(),scopes:al(he().min(1).max(60)).max(20).optional(),emailClaim:he().min(1).max(60).optional()}),c0=Ae({entryPoint:he().url(),issuer:he().min(1).max(255),idpCert:he().min(1).max(1e4),emailAttribute:he().min(1).max(200).optional()}),jk=Ju("kind",[Ae({kind:_n("oidc"),name:he().min(1).max(60),enabled:qs().optional(),config:o0.extend({clientSecret:he().min(1).max(500)})}),Ae({kind:_n("saml"),name:he().min(1).max(60),enabled:qs().optional(),config:c0})]);Ae({name:he().min(1).max(60).optional(),enabled:qs().optional(),config:s0([o0.partial(),c0.partial()]).optional()});const u0=he().trim().toLowerCase().transform(e=>e.replace(/^@/,"")).pipe(he().regex(/^(?=.{3,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/,"Enter a domain like example.com"));Ae({requireSso:qs().optional(),autoProvision:qs().optional(),autoProvisionDomains:al(u0).max(50).optional()});const d0=["redis","postgres"],pu={redis:"bull",postgres:"bullmq"},tv={redis:{test:/^rediss?:\/\//,message:"Must start with redis:// or rediss://"},postgres:{test:/^postgres(ql)?:\/\//,message:"Must start with postgres:// or postgresql://"}},bk=/^[A-Za-z_][A-Za-z0-9_]{0,62}$/;function h0(e){const n=[],r=e.kind??"redis";return e.url!==void 0&&!tv[r].test.test(e.url)&&n.push({path:"url",message:tv[r].message}),r==="postgres"&&(e.prefix!==void 0&&!bk.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 f0=Ae({name:he().min(1).max(80),kind:ss(d0).default("redis"),url:he().min(1),prefix:he().min(1).max(64).optional(),cluster:qs().default(!1),queueFilter:he().max(200).nullable().optional()}),wk=f0.superRefine((e,n)=>{for(const r of h0(e))n.addIssue({code:ee.custom,path:[r.path],message:r.message})}).transform(e=>({...e,prefix:e.prefix??pu[e.kind]}));f0.omit({kind:!0}).partial();Ae({ids:al(he().min(1)).min(1)});Ae({kind:ss(d0).default("redis"),url:he().min(1),prefix:he().optional(),cluster:qs().optional()}).superRefine((e,n)=>{for(const r of h0(e))n.addIssue({code:ee.custom,path:[r.path],message:r.message})});const vo=["waiting","active","completed","failed","delayed","prioritized","paused","waiting-children"],m0=ss(vo),Nk=1e3,kk=["waiting","limited","maxed","paused"];Ae({page:ar.number().int().min(1).default(1),pageSize:ar.number().int().min(1).max(200).default(25)});Ae({q:he().max(200).optional(),withinMs:ar.number().int().min(0).optional(),limit:ar.number().int().min(1).max(1e3).default(500)});const Sk=Ae({name:he().min(1).max(200).default("__default__"),data:ev().default({}),opts:r0(ev()).default({})}),p0=Ae({state:ss(["completed","failed","delayed","wait","active","paused","prioritized"]),grace:xn().int().min(0).default(0),limit:xn().int().min(1).max(1e5).default(1e3)});Ae({reason:he().trim().max(500).optional()});const Ou=500,Ck=["run_copy","skip_next"];Ae({scheduler:ss(Ck).default("run_copy")});Ae({jobIds:al(he().min(1).max(200)).min(1,"jobIds must not be empty").max(Ou,`at most ${Ou} job ids per call`)});Ae({query:he().max(500).optional(),groupId:he().min(1).max(200).optional(),cursor:he().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"]});Ae({state:m0.default("waiting"),groupId:he().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")});Ae({state:m0.default("failed"),q:he().max(500).default(""),groupId:he().min(1).max(200).optional(),cursor:he().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"]});Ae({queueName:he().min(1).max(255)});const x0=Ae({name:he().min(1).max(80),color:he().max(20).nullable().optional(),parentId:he().nullable().optional()}),_k=x0.partial().extend({position:xn().int().min(0).optional()});Ae({queues:al(Ae({connectionId:he(),queueName:he()}))});const Pk=Ae({waitingAbove:xn().int().min(0).max(1e7).default(0),failedAbove:xn().int().min(0).max(1e7).default(0)}),Au={waitingAbove:0,failedAbove:0},Ek=100,Rk=["waiting_above","failed_above","failed_rate_above","duration_above"],Mk=["failed_above","failed_rate_above"];function Tk(e){return Mk.includes(e)}const qk=Ju("kind",[Ae({kind:_n("waiting_above"),threshold:xn().int().min(1)}),Ae({kind:_n("failed_above"),threshold:xn().int().min(1),windowMinutes:xn().int().min(1).max(1440).default(5)}),Ae({kind:_n("failed_rate_above"),percent:xn().min(.1).max(100),windowMinutes:xn().int().min(1).max(1440).default(5),minSample:xn().int().min(1).default(20)}),Ae({kind:_n("duration_above"),seconds:xn().min(.001).max(86400),percentile:s0([_n(50),_n(95)]).default(95),windowMinutes:xn().int().min(1).max(1440).default(15),minSample:xn().int().min(1).max(Ek).default(5)})]),Ik=Ju("type",[Ae({type:_n("queue"),connectionId:he().min(1),queueName:he().min(1)}),Ae({type:_n("folder"),folderId:he().min(1)}),Ae({type:_n("connection"),connectionId:he().min(1)}),Ae({type:_n("global")})]),$k=Ju("type",[Ae({type:_n("slack"),webhookUrl:he().url()}),Ae({type:_n("webhook"),url:he().url(),headers:r0(he()).optional()})]),g0=Ae({name:he().min(1).max(120),enabled:qs().default(!0),scope:Ik,condition:qk,channels:al($k).default([]),cooldownMinutes:xn().int().min(1).max(1440).default(30)});g0.partial();const pm=["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"],xm={"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"},zk=["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"],Ok=ss(pm);Ae({limit:ar.number().int().min(1).max(200).default(50),cursor:he().max(200).optional(),actorId:he().max(36).optional(),action:Ok.optional(),connectionId:he().max(36).optional(),queueName:he().max(255).optional(),jobId:he().max(255).optional(),result:ss(["ok","error"]).optional(),from:he().datetime({offset:!0}).optional(),to:he().datetime({offset:!0}).optional()});Ae({connectionId:he(),from:he().min(1),to:he().min(1),label:he().max(120).nullable().optional()});Ae({maxNodes:ar.number().int().min(1).max(500).default(200),fromRoot:ss(["true","false"]).default("true").transform(e=>e==="true")});const nv={admin:3,operator:2,viewer:1};function sv(e,n){return nv[e]>=nv[n]}const Ak=["off","read","write"];Ae({maxAccess:ss(Ak)});Ae({request:he().min(1).max(4096),approve:qs(),access:ss(["read","write"]).default("read")});let Wi={open:!1,feature:"alerts"};const Af=new Set;function v0(e){Wi=e,Af.forEach(n=>n())}function yo(e){v0({open:!0,feature:e??Wi.feature})}function Gh(){Wi.open&&v0({...Wi,open:!1})}function Lk(){return w.useSyncExternalStore(e=>(Af.add(e),()=>Af.delete(e)),()=>Wi,()=>Wi)}let qa=[],Fk=0;const Lf=new Set;function y0(){Lf.forEach(e=>e())}function Dk(e){return Lf.add(e),()=>Lf.delete(e)}function Ci(e,n,r={}){const i=qa.find(c=>c.message===n&&c.kind===e);if(i)return i.id;const o=++Fk;return qa=[...qa,{id:o,kind:e,message:n,description:r.description,durationMs:r.durationMs??(r.action?8e3:e==="error"?6e3:3500),action:r.action}],y0(),o}function Jh(e){qa=qa.filter(n=>n.id!==e),y0()}const X=Object.assign((e,n)=>Ci((n==null?void 0:n.kind)??"info",e,n),{info:(e,n)=>Ci("info",e,{description:n}),success:(e,n)=>Ci("success",e,{description:n}),error:(e,n)=>Ci("error",e,{description:n}),warning:(e,n)=>Ci("warning",e,{description:n}),undoable:(e,n,r)=>Ci("success",e,{description:r,action:n})}),Uk={info:Va,success:lm,error:Ay,warning:ts},Qk={info:"text-info",success:"text-success",error:"text-danger",warning:"text-warning"};function Bk({item:e}){w.useEffect(()=>{const r=setTimeout(()=>Jh(e.id),e.durationMs);return()=>clearTimeout(r)},[e.id,e.durationMs]);const n=Uk[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",Qk[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(),Jh(e.id)},children:e.action.label})]}),t.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>Jh(e.id),className:"-mr-1 rounded p-0.5 text-fg-subtle hover:text-fg",children:t.jsx(vn,{className:"size-3.5"})})]})}function Vk(){const e=w.useSyncExternalStore(Dk,()=>qa,()=>qa);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(Bk,{item:n},n.id))})}const j0=w.createContext(null);function Hk({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=cn(),j=Ln(),S=We(),y=w.useRef(j);y.current=j;const b=w.useRef(h);b.current=h;const k=w.useCallback(async()=>{const[$,Q]=await Promise.allSettled([ie.get("/setup/status",{silent:!0}),ie.get("/edition",{silent:!0})]);$.status==="fulfilled"&&(d(!!$.value.needsSetup),f($.value.authRequired!==!1)),Q.status==="fulfilled"&&o(Q.value)},[]),C=w.useCallback(async()=>{try{const $=await ie.get("/auth/me",{silent:!0});r($.user),o($.edition),d(!1),f($.edition.features.users)}catch($){r(null),sr($)&&$.status===401?await k():sr($)&&$.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(()=>{DN({onUnauthenticated:()=>{if(!b.current){z.current();return}r(null),S.clear();const $=y.current.pathname;!$.startsWith("/login")&&!$.startsWith("/setup")&&v("/login",{replace:!0,state:{from:y.current}})},onProRequired:$=>yo($),onDemoLocked:()=>X.warning("This action is locked in the demo")})},[v,S]);const O=w.useCallback(async $=>{const Q=await ie.post("/auth/login",$,{silent:[401]});return r(Q.user),o(Q.edition),d(!1),S.clear(),Q},[S]),T=w.useCallback(async $=>{const Q=await ie.post("/setup",$);return r(Q.user),o(Q.edition),d(!1),Q},[]),M=w.useCallback(async()=>{try{await ie.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:xk(n),refresh:C,login:O,setup:T,logout:M,setEdition:o,can:$=>n?sv(n.role,$):!1,isAdmin:(n==null?void 0:n.role)==="admin",isOperator:n?sv(n.role,"operator"):!1}),[n,i,g,c,h,C,O,T,M]);return t.jsx(j0.Provider,{value:E,children:e})}function mt(){const e=w.useContext(j0);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}function on({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 Kk(){const{user:e,loading:n,needsSetup:r}=mt(),i=Ln();return n?t.jsx(w0,{}):e?t.jsx(dy,{}):r?t.jsx(Vr,{to:"/setup",replace:!0}):t.jsx(Vr,{to:"/login",replace:!0,state:{from:i}})}function rv({children:e}){const{user:n,loading:r,authRequired:i}=mt();return r?t.jsx(w0,{}):n||!i?t.jsx(Vr,{to:"/",replace:!0}):t.jsx(t.Fragment,{children:e})}function b0({role:e,children:n}){const{can:r}=mt();return r(e)?t.jsx(t.Fragment,{children:n}):t.jsx(on,{icon:t.jsx(um,{}),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 w0(){return t.jsx("div",{className:"flex h-full min-h-screen w-full items-center justify-center bg-bg",children:t.jsx(rl,{})})}const Wk={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"},Zk={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",Wk[n],Zk[r],d),...p,children:[i?t.jsx(Qy,{className:"animate-spin","aria-hidden":!0}):o,h,!i&&c]})}),Gk={sm:"26rem",md:"32rem",lg:"44rem",xl:"60rem"};function jn({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":Gk[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 jo={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:"See how queues feed each other, detected from BullMQ flow parents plus your own edges.",bullets:["Edges detected from job parent references with evidence counts","Manual edges for producer → consumer relationships Redis cannot see","Auto-layout graph with live counts and paused state per queue"]},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"]}},Jk={tier:"free",demo:!1,features:Object.fromEntries(mm.map(e=>[e,!1])),license:null,pricing:a0,checkoutUrl:""};function wt(){const{edition:e}=mt(),n=e??Jk,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):(yo(o),!1),[r]);return w.useMemo(()=>({edition:n,tier:n.tier,isPro:n.tier==="pro",demo:!!n.demo,pricing:n.pricing??a0,checkoutUrl:n.checkoutUrl??"",has:r,gate:i}),[n,r,i])}function Xk(){const{open:e,feature:n}=Lk(),{pricing:r,checkoutUrl:i,demo:o}=wt(),c=jo[n];return t.jsxs(jn,{open:e,onClose:Gh,size:"md",title:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx($N,{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:Gh,children:"Not now"}),t.jsxs(Ee,{to:"/settings/license",onClick:Gh,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(sl,{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 — ",mm.map(d=>jo[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 Yk(e){if(!e)return!1;const n=e.tagName;return n==="INPUT"||n==="TEXTAREA"||n==="SELECT"?!0:e.isContentEditable}function N0(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&&Yk(document.activeElement)||!i&&document.querySelector("dialog[open]")||n(h))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,n,i,o,c])}const e2=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),k0=e2?"⌘":"Ctrl",ht=encodeURIComponent,ce={home:"/",login:"/login",setup:"/setup",connection:e=>`/c/${ht(e)}`,queue:(e,n,r)=>`/c/${ht(e)}/q/${ht(n)}${r?`?state=${r}`:""}`,queueSearch:(e,n,r)=>`/c/${ht(e)}/q/${ht(n)}?search=1${r?`&state=${r}`:""}`,queueGroup:(e,n,r,i)=>`/c/${ht(e)}/q/${ht(n)}?state=${i}&group=${ht(r)}`,job:(e,n,r)=>`/c/${ht(e)}/q/${ht(n)}/j/${ht(r)}`,jobTree:(e,n,r)=>`/c/${ht(e)}/q/${ht(n)}/j/${ht(r)}/tree`,groups:(e,n)=>`/c/${ht(e)}/q/${ht(n)}/groups`,group:(e,n,r)=>`/c/${ht(e)}/q/${ht(n)}/groups/${ht(r)}`,queueMetrics:(e,n)=>`/c/${ht(e)}/q/${ht(n)}/metrics`,queueSchedulers:(e,n)=>`/c/${ht(e)}/q/${ht(n)}/schedulers`,schedulers:e=>e?`/schedulers/${ht(e)}`:"/schedulers",health:"/health",folders:"/folders",folder:e=>`/folders/${ht(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/${ht(e)}`:"/flows",settings:(e="connections")=>`/settings/${e}`};function av(e,n){const r=e.indexOf(":");return r>=0?e.slice(r+1):e}function bo(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 S0=new Intl.NumberFormat("en-US"),C0=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1});function K(e){return e==null||Number.isNaN(e)?"–":S0.format(e)}function ft(e){return e==null||Number.isNaN(e)?"–":Math.abs(e)<1e4?S0.format(e):C0.format(e)}function Pn(e,n=1){return e==null||Number.isNaN(e)?"–":`${e.toFixed(n)}%`}function Jt(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 wo(e){return e==null?"–":An(e*1e3)}function Bo(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=Bo(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 Lu(r);return o?`in ${h}`:`${h} ago`}function ho(e){return e<10?`0${e}`:String(e)}function Lu(e){const n=Bo(e);if(n==null)return"–";const r=new Date(n);return`${r.getFullYear()}-${ho(r.getMonth()+1)}-${ho(r.getDate())}`}function gn(e){const n=Bo(e);if(n==null)return"–";const r=new Date(n);return`${Lu(r)} ${ho(r.getHours())}:${ho(r.getMinutes())}:${ho(r.getSeconds())}`}function Ff(e){const n=Bo(e);if(n==null)return"–";const r=new Date(n);return`${gn(r)}.${String(r.getMilliseconds()).padStart(3,"0")}`}function Fu(e,n=2){try{return typeof e=="string"?e:JSON.stringify(e,null,n)??String(e)}catch{return String(e)}}function t2(e){try{const n=JSON.parse(e);return JSON.stringify(n,null,2)}catch{return null}}function _0(e){return e==null||!Number.isFinite(e)?"–":e>=10?`${e.toFixed(1)} cores`:`${e.toFixed(2)} ${e===1?"core":"cores"}`}function Zi(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?`${C0.format(e)}${n}`:e>=100?`${Math.round(e)}${n}`:`${e.toFixed(e<10?2:1)}${n}`}function No(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 n2(e){return e==null||!Number.isFinite(e)?"–":`${e.toFixed(2)}×`}const Df="bullpane.";function Xu(e,n,r=s2){try{const i=localStorage.getItem(Df+e);if(i==null)return n;const o=r(i);return o===void 0?n:o}catch{return n}}function ko(e,n){try{n==null?localStorage.removeItem(Df+e):localStorage.setItem(Df+e,typeof n=="string"?n:JSON.stringify(n))}catch{}}function s2(e){try{return JSON.parse(e)}catch{return e}}function Yu(e,n){const[r,i]=w.useState(()=>Xu(e,n,r2)),o=w.useCallback(d=>{i(d),ko(e,d?"1":"0")},[e]),c=w.useCallback(()=>{i(d=>(ko(e,d?"0":"1"),!d))},[e]);return[r,c,o]}function r2(e){if(e==="1"||e==="true"||e==='"true"')return!0;if(e==="0"||e==="false"||e==='"false"')return!1}const Ht=e=>()=>typeof document<"u"&&document.hidden?!1:e,It={queues:5e3,queue:3e3,job:5e3,connections:1e4,health:3e3,setup:1e4},le={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],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"]},Kt=(e,n)=>`/connections/${Ke(e)}/queues/${Ke(n)}`;function a2(){return st({queryKey:le.health,queryFn:()=>ie.get("/health"),staleTime:6e4})}function xs(){return st({queryKey:le.connections,queryFn:()=>ie.get("/connections"),refetchInterval:Ht(It.connections)})}function i2(e){return st({queryKey:le.overview(e??""),queryFn:()=>ie.get(`/connections/${Ke(e)}/overview`),enabled:!!e,refetchInterval:Ht(It.queues),placeholderData:En})}function l2(){const e=xs(),n=e.data??[],r=Ty({queries:n.map(o=>({queryKey:le.overview(o.id),queryFn:()=>ie.get(`/connections/${Ke(o.id)}/overview`),refetchInterval:Ht(It.queues),placeholderData:En}))}),i=n.map((o,c)=>({connection:o,result:r[c]}));return{connections:e,entries:i,isLoading:e.isLoading}}function o2(e,n={}){return st({queryKey:le.queues(e??""),queryFn:()=>ie.get(`/connections/${Ke(e)}/queues`),enabled:!!e&&(n.enabled??!0),refetchInterval:Ht(It.queues),placeholderData:En})}function il(){const e=xs(),n=e.data??[],r=Ty({queries:n.map(o=>({queryKey:le.queues(o.id),queryFn:()=>ie.get(`/connections/${Ke(o.id)}/queues`),refetchInterval:Ht(It.queues),placeholderData:En}))}),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 c2(e){const n=We();return He({mutationFn:()=>ie.get(`/connections/${Ke(e)}/queues`,{query:{refresh:1}}),onSuccess:r=>{e&&n.setQueryData(le.queues(e),r),n.invalidateQueries({queryKey:le.connection(e)})}})}function P0(e,n){return st({queryKey:le.queue(e??"",n??""),queryFn:()=>ie.get(Kt(e,n)),enabled:!!e&&!!n,refetchInterval:Ht(It.queue),placeholderData:En})}function gm(e,n,r={}){return st({queryKey:le.queueSetup(e??"",n??""),queryFn:()=>ie.get(`${Kt(e,n)}/setup`),enabled:!!e&&!!n&&(r.enabled??!0),refetchInterval:Ht(It.setup),placeholderData:En})}function E0(e,n,r,i={}){return st({queryKey:le.jobs(e??"",n??"",r),queryFn:()=>ie.get(`${Kt(e,n)}/jobs`,{query:{...r}}),enabled:!!e&&!!n&&(i.enabled??!0),refetchInterval:Ht(It.queue),placeholderData:En})}function u2(e,n,r,i={}){return Iy({queryKey:le.jobSearch(e??"",n??"",r),queryFn:({pageParam:o})=>ie.get(`${Kt(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 d2(e,n,r){return st({queryKey:le.job(e??"",n??"",r??""),queryFn:()=>ie.get(`${Kt(e,n)}/jobs/${Ke(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:It.job}})}function h2(e,n,r,i={},o=!0){return st({queryKey:le.jobLogs(e??"",n??"",r??"",i),queryFn:()=>ie.get(`${Kt(e,n)}/jobs/${Ke(r)}/logs`,{query:{start:i.start,end:i.end}}),enabled:o&&!!e&&!!n&&!!r,refetchInterval:Ht(It.job)})}function vm(e,n){const r=We();return He({mutationFn:({jobId:i,action:o,scheduler:c})=>{const d=`${Kt(e,n)}/jobs/${Ke(i)}`;return o==="remove"?ie.del(d):ie.post(`${d}/${o}`,o==="promote"&&c?{scheduler:c}:void 0)},onSuccess:()=>{r.invalidateQueries({queryKey:le.queue(e,n)}),r.invalidateQueries({queryKey:le.queues(e)}),r.invalidateQueries({queryKey:le.overview(e)})}})}function f2(e,n){const r=We();return He({mutationFn:({action:i,jobIds:o})=>ie.post(`${Kt(e,n)}/jobs/bulk/${i}`,{jobIds:o}),onSuccess:()=>{r.invalidateQueries({queryKey:le.queue(e,n)}),r.invalidateQueries({queryKey:le.queues(e)}),r.invalidateQueries({queryKey:le.overview(e)})}})}function m2(e,n){const r=We();return He({mutationFn:i=>ie.post(`${Kt(e,n)}/jobs`,i),onSuccess:()=>{r.invalidateQueries({queryKey:le.queue(e,n)}),r.invalidateQueries({queryKey:le.queues(e)})}})}function R0(e,n){const r=We();return He({mutationFn:i=>{const o=`${Kt(e,n)}/${i.action}`;return"body"in i?ie.post(o,i.body):ie.post(o)},onSuccess:()=>{r.invalidateQueries({queryKey:le.queue(e,n)}),r.invalidateQueries({queryKey:le.queues(e)}),r.invalidateQueries({queryKey:le.overview(e)})}})}function p2(e){const n=We();return He({mutationFn:({queue:r,action:i,reason:o})=>ie.post(`${Kt(e,r)}/${i}`,i==="pause"?{...o?{reason:o}:{}}:void 0),onSuccess:()=>{n.invalidateQueries({queryKey:le.connection(e)})}})}function ed(e,n,r){return st({queryKey:le.groups(e??"",n??"",r),queryFn:()=>ie.get(`${Kt(e,n)}/groups`,{query:{...r}}),enabled:!!e&&!!n,refetchInterval:Ht(It.queues),placeholderData:En})}function x2(e,n){const r=We();return He({mutationFn:i=>ie.post(`${Kt(e,n)}/jobs/promote-matching`,i),onSettled:()=>r.invalidateQueries({queryKey:le.queue(e,n)})})}function M0(e,n){const r=We();return He({mutationFn:({groupId:i,action:o})=>ie.post(`${Kt(e,n)}/groups/${Ke(i)}/${o}`),onSuccess:()=>r.invalidateQueries({queryKey:le.queue(e,n)})})}function T0(e,n,r,i){return st({queryKey:le.groupJobs(e??"",n??"",r??"",i),queryFn:()=>ie.get(`${Kt(e,n)}/groups/${Ke(r)}/jobs`,{query:{...i}}),enabled:!!e&&!!n&&!!r,refetchInterval:Ht(It.queue),placeholderData:En})}function g2(e,n,r,i={}){return st({queryKey:le.schedulers(e??"",n??"",r),queryFn:()=>ie.get(`${Kt(e,n)}/schedulers`,{query:{...r}}),enabled:!!e&&!!n&&i.enabled!==!1,refetchInterval:Ht(It.queues),placeholderData:En})}function v2(e,n={}){return st({queryKey:le.allSchedulers(e??"",n),queryFn:()=>ie.get(`/connections/${Ke(e)}/schedulers`,{query:{...n}}),enabled:!!e,refetchInterval:Ht(It.queues),placeholderData:En})}function y2(e,n){const r=We();return He({mutationFn:i=>ie.del(`${Kt(e,n)}/schedulers/${Ke(i)}`),onSuccess:()=>{r.invalidateQueries({queryKey:["connections",e,"queue",n,"schedulers"]}),r.invalidateQueries({queryKey:le.queue(e,n)}),r.invalidateQueries({queryKey:le.queues(e)})}})}function J3(e,n,r,i=200){return st({queryKey:le.jobTree(e??"",n??"",r??"",i),queryFn:()=>ie.get(`${Kt(e,n)}/jobs/${Ke(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:It.job},placeholderData:En})}function j2(){const e=We();return He({mutationFn:n=>ie.post("/connections",n),onSuccess:()=>e.invalidateQueries({queryKey:le.connections})})}function b2(){const e=We();return He({mutationFn:({id:n,input:r})=>ie.patch(`/connections/${Ke(n)}`,r),onSuccess:()=>e.invalidateQueries({queryKey:le.connections})})}function w2(){const e=We();return He({mutationFn:n=>ie.del(`/connections/${Ke(n)}`),onSuccess:()=>e.invalidateQueries({queryKey:le.connections})})}function N2(){return He({mutationFn:e=>ie.post("/connections/test",e)})}function k2(e={}){const n=e.enabled??!0;return st({queryKey:le.connectionsHealth,queryFn:()=>ie.get("/health/connections"),enabled:n,refetchInterval:n?Ht(It.health):!1,placeholderData:En})}function q0(e,n={}){return st({queryKey:le.hiddenQueues(e??""),queryFn:()=>ie.get(`/connections/${Ke(e)}/hidden-queues`),enabled:!!e&&(n.enabled??!0),staleTime:3e4})}function S2(e){const n=We();return He({mutationFn:({queue:r,hidden:i})=>i?ie.post(`/connections/${Ke(e)}/hidden-queues`,{queueName:r}):ie.del(`/connections/${Ke(e)}/hidden-queues/${Ke(r)}`),onSuccess:r=>{n.setQueryData(le.hiddenQueues(e),r),n.invalidateQueries({queryKey:le.queues(e)}),n.invalidateQueries({queryKey:le.overview(e)}),n.invalidateQueries({queryKey:le.connections})}})}function I0(){return st({queryKey:le.attentionThresholds,queryFn:()=>ie.get("/settings/attention"),staleTime:5*6e4})}function C2(){const e=We();return He({mutationFn:n=>ie.put("/settings/attention",n),onSuccess:n=>e.setQueryData(le.attentionThresholds,n)})}function Jr(e=!0){return st({queryKey:le.folders,queryFn:()=>ie.get("/folders",{silent:[402]}),enabled:e,staleTime:3e4})}function _2(){const e=We();return He({mutationFn:n=>ie.post("/folders",n),onSuccess:()=>e.invalidateQueries({queryKey:le.folders})})}function $0(){const e=We();return He({mutationFn:({id:n,input:r})=>ie.patch(`/folders/${Ke(n)}`,r),onSuccess:()=>e.invalidateQueries({queryKey:le.folders})})}function P2(){const e=We();return He({mutationFn:n=>ie.del(`/folders/${Ke(n)}`),onSuccess:()=>e.invalidateQueries({queryKey:le.folders})})}function z0(){const e=We();return He({mutationFn:({id:n,input:r})=>ie.put(`/folders/${Ke(n)}/queues`,r),onSuccess:()=>e.invalidateQueries({queryKey:le.folders})})}function ym(e=!0){return st({queryKey:le.alerts,queryFn:()=>ie.get("/alerts",{silent:[402]}),enabled:e,refetchInterval:Ht(It.connections)})}function E2(e=!0){return st({queryKey:le.attention,queryFn:()=>ie.get("/attention",{silent:[402]}),enabled:e,refetchInterval:Ht(It.queues)})}function jm(e){setTimeout(()=>void e.invalidateQueries({queryKey:le.attention}),1500)}function R2(e={},n=!0){return st({queryKey:le.alertEvents(e),queryFn:()=>ie.get("/alerts/events",{query:{...e},silent:[402]}),enabled:n,refetchInterval:Ht(It.connections)})}function M2(){const e=We();return He({mutationFn:n=>ie.post("/alerts",n),onSuccess:()=>{e.invalidateQueries({queryKey:le.alerts}),jm(e)}})}function O0(){const e=We();return He({mutationFn:({id:n,input:r})=>ie.patch(`/alerts/${Ke(n)}`,r),onSuccess:()=>{e.invalidateQueries({queryKey:le.alerts}),jm(e)}})}function T2(){const e=We();return He({mutationFn:n=>ie.del(`/alerts/${Ke(n)}`),onSuccess:()=>{e.invalidateQueries({queryKey:le.alerts}),jm(e)}})}function q2(){const e=We();return He({mutationFn:n=>ie.post(`/alerts/${Ke(n)}/test`),onSuccess:()=>e.invalidateQueries({queryKey:["alerts","events"]})})}function I2(e=!0){return st({queryKey:le.users,queryFn:()=>ie.get("/users",{silent:[402]}),enabled:e})}function $2(){const e=We();return He({mutationFn:n=>ie.post("/users",n),onSuccess:()=>e.invalidateQueries({queryKey:le.users})})}function z2(){const e=We();return He({mutationFn:({id:n,input:r})=>ie.patch(`/users/${Ke(n)}`,r),onSuccess:()=>e.invalidateQueries({queryKey:le.users})})}function O2(e={},n=50,r=!0){return Iy({queryKey:le.audit({...e,limit:n}),queryFn:({pageParam:i})=>ie.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 A2(e=!0){return st({queryKey:le.auditActors,queryFn:()=>ie.get("/audit/actors",{silent:[402,403]}),enabled:e,staleTime:6e4})}function L2(e={}){return Xy("/audit/export",{...e})}function F2(e,n,r,i=!0){const o={connectionId:e,queueName:n,jobId:r};return st({queryKey:le.audit({...o,limit:20}),queryFn:()=>ie.get("/audit",{query:{...o,limit:20},silent:[402,403]}),enabled:i&&!!e&&!!n&&!!r,staleTime:15e3})}function X3(e,n=200,r=!0){return st({queryKey:le.flows(e??"",n),queryFn:()=>ie.get(`/connections/${Ke(e)}/flows`,{query:{sample:n},silent:[402]}),enabled:r&&!!e,refetchInterval:Ht(It.connections),placeholderData:En})}function Y3(){const e=We();return He({mutationFn:n=>ie.post("/flow-edges",n),onSuccess:()=>e.invalidateQueries({queryKey:["flows"]})})}function e5(){const e=We();return He({mutationFn:n=>ie.del(`/flow-edges/${Ke(n)}`),onSuccess:()=>e.invalidateQueries({queryKey:["flows"]})})}function D2(){return He({mutationFn:e=>ie.put("/license",{key:e})})}function U2(){return He({mutationFn:()=>ie.post("/license/refresh")})}function Q2(){return He({mutationFn:()=>ie.del("/license")})}function B2(){return st({queryKey:le.ssoLoginOptions,queryFn:()=>ie.get("/auth/sso/options",{silent:!0}),staleTime:6e4,retry:!1})}function V2(e=!0){return st({queryKey:le.ssoProviders,queryFn:()=>ie.get("/sso/providers",{silent:[402]}),enabled:e})}function A0(e=!0){return st({queryKey:le.ssoSettings,queryFn:()=>ie.get("/sso/settings",{silent:[402]}),enabled:e})}function H2(){const e=We();return He({mutationFn:n=>ie.post("/sso/providers",n),onSuccess:()=>{e.invalidateQueries({queryKey:le.ssoProviders}),e.invalidateQueries({queryKey:le.ssoLoginOptions})}})}function K2(){const e=We();return He({mutationFn:({id:n,input:r})=>ie.patch(`/sso/providers/${Ke(n)}`,r),onSuccess:()=>{e.invalidateQueries({queryKey:le.ssoProviders}),e.invalidateQueries({queryKey:le.ssoLoginOptions})}})}function W2(){const e=We();return He({mutationFn:n=>ie.del(`/sso/providers/${Ke(n)}`),onSuccess:()=>{e.invalidateQueries({queryKey:le.ssoProviders}),e.invalidateQueries({queryKey:le.ssoLoginOptions}),e.invalidateQueries({queryKey:le.ssoSettings})}})}function Z2(){return He({mutationFn:e=>ie.post(`/sso/providers/${Ke(e)}/test`)})}function L0(){const e=We();return He({mutationFn:n=>ie.put("/sso/settings",n),onSuccess:()=>{e.invalidateQueries({queryKey:le.ssoSettings}),e.invalidateQueries({queryKey:le.ssoLoginOptions})}})}function G2(e=!0){return st({queryKey:le.mcpSettings,queryFn:()=>ie.get("/mcp/settings",{silent:[402]}),enabled:e})}function J2(){const e=We();return He({mutationFn:n=>ie.put("/mcp/settings",n),onSuccess:()=>void e.invalidateQueries({queryKey:le.mcpSettings})})}function X2(e,n=!0){return st({queryKey:le.mcpGrants(e),queryFn:()=>ie.get(`/mcp/grants${e?"?all=1":""}`,{silent:[402]}),enabled:n})}function Y2(){const e=We();return He({mutationFn:n=>ie.del(`/mcp/grants/${Ke(n)}`),onSuccess:()=>void e.invalidateQueries({queryKey:["mcp","grants"]})})}function t5(e){return st({queryKey:le.mcpConsent(e??""),queryFn:()=>ie.get(`/mcp/consent?request=${encodeURIComponent(e??"")}`),enabled:!!e,refetchOnWindowFocus:!1,staleTime:1/0})}function n5(){return He({mutationFn:e=>ie.post("/mcp/consent",e)})}const eS={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",eS[e],o),...d,children:[n&&t.jsx("span",{className:"status-dot size-1.5 bg-current","aria-hidden":!0}),c]})}function bm({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 iv({className:e}){return t.jsx(xo,{className:F("size-3 shrink-0 text-pro",e),"aria-label":"Pro feature"})}function Gi({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 tS(e){return e?e.ok?"ok":"down":"unknown"}function td({status:e,className:n,pulse:r,withLabel:i}){const o=tS(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 wm({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 lv({onOpenSwitcher:e,onNavigate:n,className:r}){const{isAdmin:i}=mt(),{has:o}=wt(),{byConnection:c,isLoading:d}=il(),h=o("folders"),f=Jr(h),g=[{to:ce.alerts,label:"Alerts",icon:nl,feature:"alerts"},{to:ce.flows(),label:"Flows",icon:LN,feature:"flows"},{to:ce.users,label:"Users",icon:Gu,feature:"users",adminOnly:!0},{to:ce.audit(),label:"Audit log",icon:Qo,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(wm,{}),t.jsx("span",{className:"truncate text-[13px] font-semibold tracking-tight",children:"Bullpane"}),t.jsx(bm,{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(Gi,{children:k0}),t.jsx(Gi,{children:"K"})]})}),t.jsxs("nav",{className:"px-2 pt-2","aria-label":"Primary",children:[t.jsx(ao,{to:ce.home,end:!0,icon:_N,label:"Overview",onNavigate:n}),t.jsx(ao,{to:ce.schedulers(),icon:Ao,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(nS,{children:"Queues"}),h&&f.data&&f.data.length>0&&t.jsx(aS,{folders:f.data,byConnection:c,onNavigate:n}),c.map(({connection:p,queues:v,error:j})=>t.jsx(rS,{connection:p,queues:v,error:j,onNavigate:n,defaultOpen:c.length<=sS},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(zo,{to:ce.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(ao,{to:ce.folders,icon:nr,label:"Manage folders",className:"mt-1 text-xs",onNavigate:n}):t.jsxs("button",{type:"button",onClick:()=>yo("folders"),className:"nav-item mt-1 w-full text-left",title:"Custom folders are a Pro feature",children:[t.jsx(bN,{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(iv,{})]})]}),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(ao,{to:p.to,icon:p.icon,label:p.label,onNavigate:n},p.to):t.jsxs("button",{type:"button",onClick:()=>yo(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(iv,{})]},p.to)),t.jsx(ao,{to:ce.settings(),icon:Wy,label:"Settings",onNavigate:n})]})]})}function nS({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 ao({to:e,icon:n,label:r,end:i,className:o,onNavigate:c}){return t.jsxs(zo,{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 F0(e,n=!0){const[r,i,o]=Yu(`sidebar.${e}`,n);return[r,i,o]}const sS=3;function rS({connection:e,queues:n,error:r,onNavigate:i,defaultOpen:o}){const c=Fn(),d=c.connectionId===e.id,[h,f,g]=F0(`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(zo,{to:ce.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(Ba,{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(td,{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(D0,{connectionId:e.id,queue:S,onNavigate:i},S.name))]})]})}function D0({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(zo,{to:ce.queue(e,n.name,bo(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 aS({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(U0,{folder:d,children:o(d.id),lookup:c,onNavigate:r,depth:0},d.id))})}function U0({folder:e,children:n,lookup:r,onNavigate:i,depth:o}){const[c,d]=F0(`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(zo,{to:ce.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(nr,{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(U0,{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(D0,{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 iS=.9,lS=.7;function Nm(e){if(!(e==null||!Number.isFinite(e))){if(e>=iS)return"danger";if(e>=lS)return"warn"}}function oS(e){return Nm(e)??"ok"}function Vo(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=`${_0(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 Q0="health.paused";let Uf=Xu(Q0,!1,e=>e==="true"||e==='"true"'||e==="1");const Qf=new Set;function cS(e){return Qf.add(e),()=>Qf.delete(e)}function ov(){return Uf}function uS(e){Uf!==e&&(Uf=e,ko(Q0,e),Qf.forEach(n=>n()))}function dS(){const e=w.useSyncExternalStore(cS,ov,ov),n=w.useCallback(r=>uS(r),[]);return[e,n]}function nd(){const[e,n]=dS(),r=k2({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 km(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 hS({className:e}){const{health:n,paused:r}=nd();if(n.length===0)return null;const i=km(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 ${Pn(i.memoryPct)} of maxmemory`,i.cpuCores==null?null:`busiest CPU ${Zi(i.cpuCores)} of one core — ${Vo(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:ce.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(Oo,{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:"·"}),Zi(i.cpuCores)," cpu"]}),i.memoryPct!=null&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-1 text-fg-subtle",children:"·"}),Pn(i.memoryPct,0)," mem"]})]})]})})}const fS={sso:"SSO",mcp:"MCP"};function mS(){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:ce.home}];return n.startsWith("/settings")?(o.push({label:"Settings",to:ce.settings()}),e.tab&&o.push({label:fS[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:ce.flows()}),i&&o.push({label:i.name}),o):(e.connectionId&&(o.push({label:(i==null?void 0:i.name)??e.connectionId,to:ce.connection(e.connectionId)}),e.queue&&(o.push({label:e.queue,to:ce.queue(e.connectionId,e.queue)}),n.includes("/groups")&&(o.push({label:"Groups",to:e.groupId?ce.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 pS({onOpenSwitcher:e,onToggleSidebar:n}){var d,h;const r=mS(),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(EN,{})}),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(td,{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(hS,{}),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(Gi,{children:k0}),t.jsx(Gi,{children:"K"})]}),t.jsx(gS,{})]})}function xS(){return t.jsxs("button",{type:"button",onClick:()=>yo("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(um,{className:"size-3.5","aria-hidden":!0}),t.jsx("span",{className:"hidden md:inline",children:"No login"})]})}function gS(){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(xS,{});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(IN,{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:ce.audit(),onClick:()=>h(!1),className:"nav-item",children:[t.jsx(Qo,{className:"size-3.5","aria-hidden":!0})," Audit log"]}),t.jsxs(Ee,{role:"menuitem",to:ce.settings("license"),onClick:()=>h(!1),className:"nav-item",children:[t.jsx(sl,{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(PN,{className:"size-3.5","aria-hidden":!0})," Log out"]})]})]})}function vS({open:e,onClose:n}){const{byConnection:r}=il(),i=cn(),[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:bo(k.counts)}))),[r]),j=w.useMemo(()=>{const y=o.trim().toLowerCase();return v.map(k=>({it:k,score:yS(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(ce.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(Gi,{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(Ba,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),t.jsx("span",{className:"truncate font-medium text-fg",children:t.jsx(jS,{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(xN,{className:"size-3.5 text-fg-subtle","aria-hidden":!0})]},y.key))]})]})})}function yS(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 jS({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 So=new Map;let uu=null,cv=Number.POSITIVE_INFINITY,B0=Date.now();function bS(){document.hidden||(B0=Date.now(),So.forEach((e,n)=>n()))}function uv(){const e=So.size?Math.min(...So.values()):Number.POSITIVE_INFINITY;e!==cv&&(uu&&clearInterval(uu),uu=null,cv=e,Number.isFinite(e)&&(uu=setInterval(bS,e)))}function ll(e=15e3){const[,n]=w.useState(0);return w.useEffect(()=>{const r=()=>n(i=>i+1);return So.set(r,e),uv(),()=>{So.delete(r),uv()}},[e]),B0}function Xt({value:e,className:n,withAbsolute:r,emptyText:i="–"}){const o=ll(),c=Bo(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 wS="only leaves the list · jobs untouched · reversible",V0="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.)",H0="Removed from the lists only. No job was deleted.";function Sm(e){var o;const n=S2(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})},H0),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 NS(){const e=We(),n=async(o,c,d)=>{const h=d?await ie.post(`/connections/${Ke(o)}/hidden-queues`,{queueName:c}):await ie.del(`/connections/${Ke(o)}/hidden-queues/${Ke(c)}`);e.setQueryData(le.hiddenQueues(o),h),e.invalidateQueries({queryKey:le.queues(o)}),e.invalidateQueries({queryKey:le.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})},H0),d=>X.error(ve(d))),unhide:r}}function kS({connectionId:e,queueName:n}){var d;const{isOperator:r}=mt(),i=q0(e),o=Sm(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(Lo,{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(Xt,{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(Dy,{}),loading:o.pendingQueue===n,onClick:()=>o.unhide(n),children:"Show again"})]}):null}function SS(){const[e,n]=w.useState(!1),[r,i]=w.useState(!1),o=Ln(),c=Eg("/c/:connectionId/q/:queue/*"),d=Eg("/c/:connectionId/q/:queue"),h=c??d,f=w.useCallback(()=>n(!0),[]);return N0("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(lv,{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(lv,{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(pS,{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(kS,{connectionId:h.params.connectionId,queueName:h.params.queue}),t.jsx(dy,{})]})]}),t.jsx(vS,{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 sd({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 Me=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(sd,{label:n,hint:r,error:i,htmlFor:j,className:d,children:S})}),Ji=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(sd,{label:n,hint:r,error:i,htmlFor:v,className:d,children:j})}),ut=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(sd,{label:n,hint:r,error:i,htmlFor:j,className:c,children:S})}),Cm=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 Xi({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 K0({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(wm,{className:"size-8"}),t.jsx("span",{className:"text-base font-semibold tracking-tight",children:"Bullpane"}),t.jsx(bm,{})]}),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 CS(){var ue;const{login:e,needsSetup:n}=mt(),{demo:r}=wt(),i=cn(),o=Ln(),[c,d]=tl(),[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 oe=new URLSearchParams(c);oe.delete("sso_error"),d(oe,{replace:!0})},[C,c,d]);const{data:z}=B2(),O=(z==null?void 0:z.providers)??[],T=O.length>0,M=(z==null?void 0:z.requireSso)??!1,[E,$]=w.useState(!1),Q=!M||E;if(n)return t.jsx(Vr,{to:"/setup",replace:!0});const H=(ue=o.state)==null?void 0:ue.from,q=H!=null&&H.pathname?`${H.pathname}${H.search??""}`:void 0,B=async oe=>{oe.preventDefault(),j(null);const Ne=vk.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){sr(Ie)&&Ie.status===401?j(ve(Ie,"Invalid email or password")):j(ve(Ie))}finally{k(!1)}};return t.jsxs(K0,{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(oe=>t.jsxs(V,{variant:"secondary",className:"w-full",leftIcon:t.jsx(Zu,{className:"size-4"}),onClick:()=>{const Ne=`/api/auth/sso/${encodeURIComponent(oe.id)}/start`;window.location.href=q?`${Ne}?next=${encodeURIComponent(q)}`:Ne},children:["Sign in with ",oe.name]},oe.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(Me,{label:"Email",type:"email",autoComplete:"username",autoFocus:!T,value:h,onChange:oe=>f(oe.target.value),error:S.email,required:!0}),t.jsx(Me,{label:"Password",type:"password",autoComplete:"current-password",value:g,onChange:oe=>p(oe.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(sl,{className:"size-3.5"}),onClick:()=>$(!0),children:"Sign in with a password instead"})})]})}function _S(){const{setup:e,needsSetup:n,loading:r}=mt(),i=cn(),[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=gk.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){sr(C)&&C.status===409?g("Setup was already completed. Sign in instead."):g(ve(C))}finally{v(!1)}}};return t.jsx(K0,{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(Me,{label:"Name",autoFocus:!0,autoComplete:"name",value:o.name,onChange:j("name"),error:d.name,required:!0}),t.jsx(Me,{label:"Email",type:"email",autoComplete:"username",value:o.email,onChange:j("email"),error:d.email,required:!0}),t.jsx(Me,{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(Me,{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 Bf(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(dv),h=p=>n.filter(v=>v.parentId===p).sort(dv),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:Xh(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:Xh(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=Xh(o.items);return[...i.values()]}function dv(e,n){return e.position-n.position||e.name.localeCompare(n.name)}function Xh(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 _m(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 Pm(e,n){const r=n.trim().toLowerCase();return r?e.queue.name.toLowerCase().includes(r)||e.connection.name.toLowerCase().includes(r):!0}const PS={failing:"failing now",paused:"paused",backlog:"backlog, no worker",waiting:"backlog over threshold",failed:"failed jobs"},ES=1;function RS(e,n=Au){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>=ES&&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 _i(e){return e>0?Math.min(Math.log10(e+1)*1e3,9999):0}const MS={failed_rate_above:1e6,failed_above:1e6,duration_above:7e5,waiting_above:7e5};function TS(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,MS[f.kind]+_i(g*100))}return c+=d,n.includes("failing")&&(c+=1e6+_i(((h=i.rates)==null?void 0:h.failed)??0)),n.includes("paused")&&(c+=5e5+_i(o.waiting+o.active)),n.includes("backlog")&&(c+=1e5+_i(o.waiting+o.prioritized)),n.includes("waiting")&&(c+=5e4+_i(o.waiting+o.prioritized)),n.includes("failed")&&(c+=_i(o.failed)),c}const qS=["paused","backlog"];function hv(e,n){return`${e}\0${n}`}function IS(e,n=Au,r=8,i){const o=[],c=[],d=new Map;for(const h of i??[]){const f=hv(h.connectionId,h.queueName),g=d.get(f);g?g.push(h):d.set(f,[h])}for(const h of e){const f=RS(h,n),g=i?f.filter(v=>qS.includes(v)):f,p=d.get(hv(h.connection.id,h.queue.name))??[];g.length>0||p.length>0?o.push({entry:h,reasons:g,findings:p,score:TS(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:$S(o,r),hidden:Math.max(0,o.length-r),rest:c}}function $S(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 Em(e,n,r){const[i,o]=tl(),c=w.useMemo(()=>{const g=fv(i.get("sort"),i.get("dir"),r);if(g)return g;const p=Xu(`table.${e}.sort`,null);return p&&typeof p=="object"&&fv(p.key,p.dir,r)?p:n},[i,e,n,r]),d=i.get("filter")??"",h=w.useCallback(g=>{ko(`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 fv(e,n,r){return!e||r&&!r.includes(e)?null:{key:e,dir:n==="asc"?"asc":"desc"}}function Hs(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:zS[e],textClass:OS[e],muted:r}}const zS={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"},OS={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:Hs("completed","completed"),active:Hs("active","active"),waiting:Hs("waiting","waiting"),delayed:Hs("delayed","delayed"),failed:Hs("failed","failed"),prioritized:Hs("prioritized","prioritized",!0),paused:Hs("paused","paused",!0),"waiting-children":Hs("waiting-children","waiting-children",!0),unknown:Hs("unknown","unknown",!0)};function rd(e){return e&&lt[e]||lt.unknown}function AS(e){const n=rd(e);return{"--chip-fg":n.fg,"--chip-bg":n.bg,"--chip-border":n.border}}const LS=["completed","active","waiting","delayed","failed"],FS=["prioritized","paused","waiting-children"];function Yi({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],$=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[oe,Ne]=Q.pts[0];return t.jsx("circle",{cx:oe,cy:Ne,r:1.4,fill:o},H)}const q=M(Q.pts),B=Q.pts[0][0],ue=Q.pts[Q.pts.length-1][0];return t.jsxs("g",{children:[c&&t.jsx("path",{d:`${q} L${ue.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)}),$&&t.jsx("circle",{cx:$[0],cy:$[1],r:1.8,fill:o})]})}const DS=Object.fromEntries(["waiting","active","completed","failed","delayed","prioritized","paused","waiting-children","unknown"].map(e=>{const n=rd(e);return[e,{label:n.label,dot:n.dotClass,color:n.fg,text:n.textClass}]}));function W0({state:e,size:n,className:r}){const i=rd(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 mv({state:e,count:n,hideZero:r,short:i,className:o,title:c,to:d}){if(r&&!n)return null;const h=rd(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:AS(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 Rm="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 }.",US="From BullMQ's own metrics counters, which are recorded when each job finishes — unaffected by removeOnComplete.",QS="Counted from the completed/failed sorted sets over the trailing window.";function Mm(e){return(e==null?void 0:e.retentionSkewed)===!0}function Tm(e){return e?e.retentionSkewed?Rm:e.source==="metrics"?US:QS:""}function Z0({rates:e,className:n}){return Mm(e)?t.jsx(Pe,{content:Rm,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 ad({entry:e,showConnection:n,onHide:r,hidePending:i}){const{connection:o,queue:c}=e,d=c.counts,h=ce.queue(o.id,c.name,bo(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:ce.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:V0,"aria-label":`Hide ${c.name} from the lists`,children:t.jsx(Lo,{className:"size-3.5"})})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[LS.map(f=>t.jsx(mv,{state:f,count:d[f],to:ce.queue(o.id,c.name,f)},f)),FS.map(f=>t.jsx(mv,{state:f,count:d[f],hideZero:!0,short:!0,to:ce.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(qm,{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(Yi,{values:c.metrics.completed,width:56,height:14,title:"Completed per minute"})})]})]})}function G0(e){return e?e%1440===0?`${e/1440}d`:e%60===0?`${e/60}h`:`${e}m`:"1h"}function qm({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=G0(e==null?void 0:e.windowMinutes),d=Mm(e),h=e?`${K(e.completed)} completed · ${K(e.failed)} failed in the last ${c}`:"no rate data",f=e?`${h}
534
+
535
+ ${Tm(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}`:`${Pn(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:[Pn(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(Z0,{rates:e})]})})]})}function J0({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(nr,{className:"size-3.5",style:{color:h.color??"var(--fg-subtle)"},"aria-hidden":!0}):h.kind==="connection"?t.jsx(Ky,{className:"size-3.5","aria-hidden":!0}):t.jsx(Uy,{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(ad,{entry:f,showConnection:n,onHide:o,hidePending:c===Ia(f)},`${f.connection.id}/${f.queue.name}`))})]},h.id))})}function Im({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 BS({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(VS,{section:c,showConnection:n,defaultOpen:r,storagePrefix:i},c.id))})}function VS({section:e,showConnection:n,defaultOpen:r,storagePrefix:i}){const[o,c]=Yu(`${i}.${e.id}`,r),d=_m(e.items),h=e.kind==="folder"?nr:e.kind==="connection"?Ky:Uy;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(Yh,{state:"waiting",value:d.waiting}),t.jsx(Yh,{state:"active",value:d.active}),t.jsx(Yh,{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(ad,{entry:f,showConnection:n},`${f.connection.id}/${f.queue.name}`))})]})}function Yh({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 HS({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:ce.alerts,className:"inline-flex items-center gap-1 text-[11px] text-fg-subtle hover:text-fg",children:[t.jsx(Va,{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(lm,{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:ce.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(ad,{entry:h,showConnection:r}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[g.map(p=>t.jsx(ZS,{finding:p},p.alertId)),f.map(p=>t.jsx(GS,{reason:p},p))]})]},`${h.connection.id}/${h.queue.name}`))})]})}const xu={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"},KS={failed_rate_above:xu.failing,failed_above:xu.failing,duration_above:"border-state-delayed/40 bg-state-delayed/10 text-state-delayed",waiting_above:xu.waiting};function ef(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 WS(e){const n=e.windowMinutes?` · ${e.windowMinutes>=60&&e.windowMinutes%60===0?`${e.windowMinutes/60}h`:`${e.windowMinutes}m`}`:"",r=` > ${ef(e,e.threshold)}`;switch(e.kind){case"failed_rate_above":return`${ef(e,e.value)} failed${n}${r}`;case"failed_above":return`${K(e.value)} failed${n}${r}`;case"duration_above":return`p${e.percentile??95} ${ef(e,e.value)}${n}${r}`;case"waiting_above":return`${K(e.value)} waiting${r}`}}function ZS({finding:e}){return t.jsx(Pe,{content:`Rule "${e.alertName}"${e.notifies?"":" · dashboard only, notifies nobody"}`,children:t.jsxs(Ee,{to:ce.alerts,className:F("inline-flex items-center gap-1 rounded border px-1.5 py-px text-[10px] font-medium hover:brightness-110",KS[e.kind]),children:[!e.notifies&&t.jsx(dN,{className:"size-2.5 opacity-70","aria-hidden":!0}),t.jsx("span",{className:"num",children:WS(e)})]})})}function GS({reason:e}){return t.jsx("span",{className:F("rounded border px-1.5 py-px text-[10px] font-medium",xu[e]),children:PS[e]})}function X0({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(io,{state:"waiting",value:e.waiting}),t.jsx(io,{state:"active",value:e.active}),t.jsx(io,{state:"delayed",value:e.delayed}),t.jsx(io,{state:"failed",value:e.failed,dimZero:!0}),t.jsx(io,{state:"completed",value:e.completed})]}),i&&t.jsx("div",{className:"ml-auto flex items-center gap-2",children:i})]})}function io({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 $m({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(Me,{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 ol({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 JS(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 XS(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=JS(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 YS({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:XS(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(cN,{className:"size-3","aria-hidden":!0}):t.jsx(iN,{className:"size-3","aria-hidden":!0}):t.jsx(lN,{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(ol,{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 zm=["queue","connection","waiting","active","completed","failed","delayed","prioritized","waiting-children","success","paused","groups","trend","actions"],Om={key:"failed",dir:"desc"};function Am({rows:e,showConnection:n,sort:r,onSort:i,message:o,messageClassName:c,onToggle:d,pendingKey:h,onHide:f,hidePendingKey:g}){const p=cn(),v=w.useMemo(()=>{var S,y;const j=[{key:"queue",header:"Queue",sortValue:b=>b.queue.name,render:b=>t.jsx(Ee,{to:ce.queue(b.connection.id,b.queue.name,bo(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(va("waiting","Waiting",b=>b.queue.counts.waiting),va("active","Active",b=>b.queue.counts.active),va("completed","Completed",b=>b.queue.counts.completed,!0),va("failed","Failed",b=>b.queue.counts.failed),va("delayed","Delayed",b=>b.queue.counts.delayed,!0),va("prioritized","Prioritized",b=>b.queue.counts.prioritized,!0),va("waiting-children","Waiting-children",b=>b.queue.counts["waiting-children"],!0),{key:"success",header:`Success % (${G0((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=Mm(k);return t.jsxs("span",{className:"inline-flex items-center justify-end gap-1.5",title:Tm(k),children:[t.jsx(qm,{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?"–":Pn(C)}),t.jsx(Z0,{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:ce.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(Yi,{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(ce.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(Uo,{}):t.jsx(Gr,{})}),f&&t.jsx(V,{size:"icon-xs",variant:"ghost",loading:g===Ia(b),title:V0,"aria-label":`Hide ${b.queue.name} from the lists`,onClick:()=>f(b),children:t.jsx(Lo,{})})]})}),j},[n,d,h,f,g,p,e]);return t.jsx(YS,{columns:v,rows:e,rowKey:Ia,sort:r,onSort:i,onRowActivate:j=>p(ce.queue(j.connection.id,j.queue.name,bo(j.queue.counts))),message:o,messageClassName:c,className:"min-w-[1100px]"})}function va(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:ce.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 eC=4;function tC({className:e}){const{health:n,paused:r,isLoading:i,error:o}=nd(),[c,d]=Yu("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>eC;return t.jsxs("section",{"aria-label":"Server health",className:F("space-y-2",e),children:[h.length>0&&t.jsx(sC,{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(Oo,{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(nC,{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(pv,{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:ce.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(pv,{health:p,paused:r,className:"min-w-0"},p.connectionId))})]})]})}function nC({health:e,paused:n,expanded:r,onToggle:i}){const o=km(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:ce.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:ce.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:Zi(o.cpuCores),tip:`Busiest single Redis — ${Vo(o.cpuCores)}`,tone:Nm(o.cpuCores)}),o.memoryPct!=null&&t.jsx(ds,{label:"mem",value:Pn(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 pv({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=rC(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:ce.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?Jt(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?No(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||Jt(i.usedMemoryBytes)}${e.memoryUsedPct!=null?` · ${Pn(e.memoryUsedPct)}`:""}`:"–",tip:e.memoryUsedPct!=null&&(i!=null&&i.maxMemoryBytes)?`${Pn(e.memoryUsedPct)} of ${Jt(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:Zi(e.cpuCores),tip:Vo(e.cpuCores),tone:Nm(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?No(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 sC({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(By,{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:ce.health,className:"shrink-0 underline underline-offset-2 hover:no-underline",children:"Monitor"})]})}function rC(e){let n=null;for(const r of e){if(r.level==="critical")return"critical";n="warn"}return n}const aC=2;function iC(){var ot,Fe;const{isAdmin:e,isOperator:n}=mt(),{has:r}=wt(),{connections:i,entries:o,isLoading:c}=l2(),d=I0(),h=r("alerts"),f=E2(h),g=r("folders"),p=Jr(g),v=cn(),{sort:j,setSort:S,filter:y,setFilter:b}=Em("overview",Om,zm),k=w.useMemo(()=>o.flatMap(W=>{var me;return(((me=W.result.data)==null?void 0:me.queues)??[]).map(ne=>({connection:W.connection,queue:ne}))}),[o]),C=w.useMemo(()=>k.filter(W=>Pm(W,y)),[k,y]),z=w.useMemo(()=>_m(k),[k]),O=c||o.some(W=>W.result.isLoading),T=w.useMemo(()=>o.reduce((W,me)=>{var ne;return W+(((ne=me.result.data)==null?void 0:ne.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,ne;return{name:W.connection.name,keys:((ne=(me=W.result.data)==null?void 0:me.discovery)==null?void 0:ne.totalKeys)??null}}),[o]),E=w.useMemo(()=>{const W=o.filter(me=>{var ne;return(((ne=me.result.data)==null?void 0:ne.hiddenCount)??0)>0});return W.length===1?W[0].connection.id:null},[o]),$=NS(),Q=n?W=>void $.hide(W.connection.id,W.queue.name):void 0,H=((ot=i.data)==null?void 0:ot.length)??0,q=H>aC,B=h?((Fe=f.data)==null?void 0:Fe.findings)??[]:void 0,ue=w.useMemo(()=>IS(C,d.data,8,B),[C,d.data,B]),oe=w.useMemo(()=>{if(!h||!f.data)return;const W=new Set(C.map(ne=>`${ne.connection.id}\0${ne.queue.name}`)),me=f.data.unmeasured.filter(ne=>W.has(`${ne.connectionId}\0${ne.queueName}`)).length;return{rules:f.data.rules,unmeasured:me}},[h,f.data,C]),Ne=w.useMemo(()=>Bf(ue.rest,g?p.data:void 0),[ue.rest,g,p.data]),Ie=w.useMemo(()=>Bf(C,g?p.data:void 0),[C,g,p.data]);return!c&&H===0?t.jsx(bt,{children:t.jsx(on,{icon:t.jsx(Ba,{}),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(`${ce.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(tC,{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(X0,{totals:z,hiddenCount:T,onRevealHidden:E?()=>v(`${ce.connection(E)}#hidden-queues`):void 0,children:[t.jsx($m,{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(Im,{}):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(HS,{items:ue.attention,hidden:ue.hidden,showConnection:q,filtered:!!y,rules:oe}),q?t.jsx(BS,{sections:Ne,showConnection:!0,defaultOpen:!1}):t.jsx(J0,{sections:Ie,showConnection:!0,onHide:Q})]}),t.jsx("div",{className:"card overflow-hidden",children:t.jsx(Am,{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 lC({connectionId:e,hidden:n,canUnhide:r,onUnhide:i,pendingQueue:o,className:c,forceOpen:d}){const[h,f]=Yu(`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(Lo,{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:ce.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(Xt,{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(Dy,{}),loading:o===p.queueName,onClick:()=>i(p.queueName),title:"Put this queue back in the lists",children:"Show again"})]},p.queueName))})]})}function Y0({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(jn,{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(Ji,{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 oC(){var me,ne,A,Z,Le,De;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=i2(e),h=c2(e),f=p2(e),g=q0(e),p=Sm(e),v=w.useRef(null),[j,S]=w.useState(!1),[y,b]=w.useState(null),k=i("folders"),C=Jr(k),z=cn(),{sort:O,setSort:T,filter:M,setFilter:E}=Em(`connection.${e}`,Om,zm),$=w.useMemo(()=>{var Se;return c?(((Se=d.data)==null?void 0:Se.queues)??[]).map(Ue=>({connection:c,queue:Ue})):[]},[c,d.data]),Q=w.useMemo(()=>$.filter(Se=>Pm(Se,M)),[$,M]),H=w.useMemo(()=>Bf(Q,k?C.data:void 0),[Q,k,C.data]),q=w.useMemo(()=>_m($),[$]);if(o.isSuccess&&!c)return t.jsx(bt,{children:t.jsx(on,{icon:t.jsx(Ba,{}),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=(ne=d.data)==null?void 0:ne.info,ue=((A=d.data)==null?void 0:A.status)??(c==null?void 0:c.status),oe=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:Ue=>X.error(ve(Ue))})}:void 0,Ne=Se=>{if(!y)return;const Ue=y.queue.name;f.mutate({queue:Ue,action:"pause",...Se?{reason:Se}:{}},{onSuccess:()=>{b(null),X.success(`${Ue} 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,Fe=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(td,{status:ue,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(cm,{}),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(Wy,{}),onClick:()=>z(`${ce.settings("connections")}?edit=${encodeURIComponent(e)}`),children:"Edit"})]})}),ue&&!ue.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: ",ue.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(hn,{label:"Postgres",value:B.serverVersion}),t.jsx(hn,{label:"Schema",value:B.schema}),t.jsx(hn,{label:"Uptime",value:wo(B.uptimeSeconds)}),t.jsx(hn,{label:"Connections",value:`${K(B.connectedClients)} / ${K(B.maxConnections)}`}),t.jsx(hn,{label:"Database",value:Jt(B.databaseSizeBytes)}),t.jsx(hn,{label:"Jobs table",value:Jt(B.jobTableBytes)}),t.jsx(hn,{label:"Events table",value:Jt(B.eventTableBytes)})]}):t.jsxs(t.Fragment,{children:[t.jsx(hn,{label:"Redis",value:B==null?void 0:B.redisVersion}),t.jsx(hn,{label:"Mode",value:B==null?void 0:B.mode}),t.jsx(hn,{label:"Uptime",value:B?wo(B.uptimeSeconds):void 0}),t.jsx(hn,{label:"Clients",value:B?K(B.connectedClients):void 0}),t.jsx(hn,{label:"Memory",value:B?`${Jt(B.usedMemoryBytes)}${B.maxMemoryBytes?` / ${Jt(B.maxMemoryBytes)}`:""}`:void 0}),t.jsx(hn,{label:"Keys",value:B?B.totalKeys!=null?K(B.totalKeys):"–":void 0}),t.jsx(hn,{label:"Ops / s",value:B?B.opsPerSec!=null?K(B.opsPerSec):"–":void 0})]}),t.jsx(hn,{label:"Latency",value:ue?ue.latencyMs!=null?`${ue.latencyMs} ms`:"–":void 0})]}),t.jsxs("section",{className:"space-y-3","aria-label":"Queues",children:[t.jsxs(X0,{totals:q,title:"Queues",hiddenCount:((Z=d.data)==null?void 0:Z.hiddenCount)??((Le=g.data)==null?void 0:Le.length)??0,onRevealHidden:W,children:[t.jsx($m,{value:M,onChange:E,"aria-label":"Filter queues"}),t.jsxs("span",{className:"num whitespace-nowrap text-xs text-fg-subtle",children:[Q.length," of ",$.length]})]}),d.isLoading?t.jsx(Im,{}):Q.length>0?t.jsx(J0,{sections:H,hideSingleHeader:!0,onHide:ot,hidePendingKey:Fe}):null,t.jsx("div",{className:"card overflow-hidden",children:t.jsx(Am,{rows:Q,sort:O,onSort:T,onToggle:oe,pendingKey:Ie,onHide:ot,hidePendingKey:Fe,message:d.isLoading?t.jsx(Vt,{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(lC,{connectionId:e,hidden:g.data??[],canUnhide:n,onUnhide:Se=>p.unhide(Se),pendingQueue:p.pendingQueue,forceOpen:j})})]}),t.jsx(Y0,{queue:(y==null?void 0:y.queue.name)??null,onClose:()=>b(null),onConfirm:Ne,loading:f.isPending&&((De=f.variables)==null?void 0:De.action)==="pause"})]})}function hn({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 Lm({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(Lm,{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(cC,{pct:g,label:p,tone:v}),d&&t.jsx(Yi,{values:d,width:S?260:112,height:S?44:22,className:"mt-1.5 w-full",stroke:h,title:f??e,dimmed:j})]})}function cC({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 ej({warning:e}){const n=e.level==="critical",r=n?By: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 an({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 uC="No rate yet — needs two samples. Also resets when Postgres restarts. This is not zero.";function dC({health:e,big:n,paused:r}){var v;const[i,o]=w.useState(!1),c=ll(1e3),d=((v=e.info)==null?void 0:v.backend)==="postgres"?e.info:null,h=!e.ok,f=tj(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 ",wo(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(Lm,{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(ej,{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(Gu,{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:er(g,"connectedClients"),sparkColor:"var(--info)",sparkTitle:"Connections"}),t.jsx(Xn,{label:"Transactions/sec",big:n,dimmed:h,isUnknown:e.commandsPerSec==null,unknownReason:uC,value:Wr(e.commandsPerSec),secondary:e.commandsPerSec==null?"measuring…":void 0,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Gy,{className:"size-3","aria-hidden":!0})," xact_commit + xact_rollback between samples"]}),spark:er(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?No(d.latencyMs):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(po,{className:"size-3","aria-hidden":!0})," round trip of the health query itself"]}),spark:er(g,"latencyMs"),sparkColor:"var(--warning)",sparkTitle:"Latency"}),t.jsx(Xn,{label:"Database",big:n,dimmed:h,isUnknown:!d,unknownReason:"No sample",value:d?Jt(d.databaseSizeBytes):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Ba,{className:"size-3","aria-hidden":!0})," pg_database_size, the whole database"]}),spark:er(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?Jt(d.jobTableBytes):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Qg,{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?Jt(d.eventTableBytes):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Qg,{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(an,{label:"Cache hit rate",value:(d==null?void 0:d.cacheHitRatePct)!=null?Pn(d.cacheHitRatePct):"—",hint:"blks_hit / (blks_hit + blks_read), cumulative"}),t.jsx(an,{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(an,{label:"Transactions",value:d?ft(d.totalTransactions):"—",hint:"xact_commit + xact_rollback, cumulative"}),t.jsx(an,{label:"History points",value:K(g.length),tone:"muted",hint:"Kept in the server's memory, not persisted"})]})]})]})}const xv="No rate yet — needs two INFO samples. Also resets when Redis restarts. This is not zero.";function tj(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 er(e,n){return e.map(r=>{const i=r[n];return typeof i=="number"&&Number.isFinite(i)?i:null})}function hC(e){return e.health.kind==="postgres"?t.jsx(dC,{...e}):t.jsx(fC,{...e})}function fC({health:e,big:n,paused:r}){const[i,o]=w.useState(!1),c=ll(1e3),d=e.info&&e.info.backend!=="postgres"?e.info:null,h=!e.ok,f=tj(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 ",wo(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(Lm,{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(ej,{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||Jt(d.usedMemoryBytes):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(NN,{className:"size-3","aria-hidden":!0})," used_memory"]}),meterPct:e.memoryUsedPct,meterLabel:e.memoryUsedPct!=null&&(d!=null&&d.maxMemoryBytes)?`${Pn(e.memoryUsedPct)} of ${Jt(d.maxMemoryBytes)}`:"no maxmemory set",meterTone:e.memoryUsedPct==null?"ok":e.memoryUsedPct>=90?"danger":e.memoryUsedPct>=75?"warn":"ok",spark:er(g,"memoryBytes"),sparkColor:"var(--violet)",sparkTitle:"Used memory"}),t.jsx(Xn,{label:"CPU",big:n,dimmed:p,isUnknown:e.cpuCores==null,unknownReason:xv,value:Zi(e.cpuCores),secondary:e.cpuCores==null?"measuring…":t.jsx(Pe,{content:Vo(e.cpuCores),children:t.jsx("span",{className:"num cursor-help border-b border-dotted border-border-strong",children:_0(e.cpuCores)})}),hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(gN,{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":oS(e.cpuCores),spark:er(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:xv,value:Wr(e.commandsPerSec),secondary:e.commandsPerSec==null?"measuring…":void 0,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Gy,{className:"size-3","aria-hidden":!0})," derived from total_commands_processed between samples"]}),spark:er(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?No(d.latencyMs):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(po,{className:"size-3","aria-hidden":!0})," round trip of the INFO command itself"]}),spark:er(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(Gu,{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:er(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(CN,{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(an,{label:"RSS",value:d?Jt(d.usedMemoryRssBytes):"—",hint:"used_memory_rss — what the OS actually holds for the Redis process"}),t.jsx(an,{label:"Peak memory",value:d?Jt(d.usedMemoryPeakBytes):"—",hint:"used_memory_peak"}),t.jsx(an,{label:"Fragmentation",value:d?n2(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(an,{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(an,{label:"Hit rate",value:(d==null?void 0:d.keyspaceHitRatePct)!=null?Pn(d.keyspaceHitRatePct):"—",hint:"keyspace_hits / (hits + misses), cumulative since start"}),t.jsx(an,{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(an,{label:"Expired keys",value:d?K(d.expiredKeys):"—",tone:"muted",hint:"expired_keys, cumulative"}),t.jsx(an,{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(an,{label:"Replicas",value:(d==null?void 0:d.connectedReplicas)!=null?K(d.connectedReplicas):"—",hint:"connected_slaves"}),t.jsx(an,{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(an,{label:"Commands processed",value:d?ft(d.totalCommandsProcessed):"—",hint:"total_commands_processed, cumulative since start"}),t.jsx(an,{label:"History points",value:K(g.length),tone:"muted",hint:"Kept in the server's memory, not persisted"})]})]})]})}const mC="redis-health";function pC({big:e,className:n,headless:r}){const{health:i,paused:o,setPaused:c,isLoading:d,error:h}=nd(),f=km(i);return t.jsxs("section",{id:mC,"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(Oo,{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:ce.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(gv,{paused:o,onChange:c})]})]}),r&&t.jsx("div",{className:"mb-2 flex items-center justify-end",children:t.jsx(gv,{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(on,{compact:!0,icon:t.jsx(qN,{}),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(hC,{health:g,big:e,paused:o},g.connectionId))}),t.jsx(xC,{})]})}function gv({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(Uo,{}):t.jsx(Gr,{}),"aria-pressed":e,onClick:()=>n(!e),children:e?"Resume monitoring":"Pause monitoring"})})}function xC(){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 gC(){const{health:e,paused:n,lastSampleAt:r}=nd();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(pC,{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(vC,{health:i},i.connectionId))]})]})}const tf=40;function vC({health:e}){const[n,r]=w.useState(!1),i=w.useMemo(()=>[...e.history??[]].reverse(),[e.history]),o=n?i:i.slice(0,tf);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>tf&&t.jsx("button",{type:"button",className:"ml-auto text-[11px] text-accent hover:underline",onClick:()=>r(c=>!c),children:n?`Show latest ${tf}`:`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:No(c.latencyMs)}),t.jsx(xe,{align:"right",num:!0,children:Jt(c.memoryBytes)}),t.jsx(xe,{align:"right",num:!0,muted:c.commandsPerSec==null,children:c.commandsPerSec==null?t.jsx(vv,{}):Wr(c.commandsPerSec,"")}),t.jsx(xe,{align:"right",num:!0,muted:c.cpuCores==null,children:c.cpuCores==null?t.jsx(vv,{}):t.jsx(Pe,{content:Vo(c.cpuCores),children:t.jsx("span",{className:"cursor-help",children:Zi(c.cpuCores)})})}),t.jsx(xe,{align:"right",num:!0,children:K(c.connectedClients)})]},c.t))})]})]})}function vv(){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 nj(e,n){const r=new Set(e);return r.has(n)?r.delete(n):r.add(n),r}function yC(e,n,r,i){const o=r?n.indexOf(r):-1,c=n.indexOf(i);if(o<0||c<0)return nj(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 jC(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 bC(e,n){return n.reduce((r,i)=>e.has(i)?r+1:r,0)}function wC(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=>nj(y,S))},[]),d=w.useCallback(S=>{const y=i.current;i.current=S,r(b=>yC(b,e,y,S))},[e]),h=w.useMemo(()=>bC(n,e),[e,n]),f=e.length>0&&h===e.length,g=w.useCallback(()=>{r(S=>jC(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 sj(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 NC={retry:"Retry",promote:"Promote",remove:"Remove"};function yv({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??sj(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(Wu,{}):p==="promote"?t.jsx(rm,{}):t.jsx(Un,{}),loading:c===p,disabled:!!c,onClick:()=>o(p),children:NC[p]},p)),t.jsx(V,{size:"sm",variant:"ghost",leftIcon:t.jsx(vn,{}),onClick:e.clear,disabled:!!c,children:"Clear"})]})}function jv({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 Fm({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(xo,{className:"size-3 text-pro","aria-label":"Pro feature"})]},g.value)})})}function Vf({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=cn(),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(Vt,{label:"Loading jobs…"})}),r&&r.length===0&&t.jsx(yt,{colSpan:k,children:c}),r==null?void 0:r.map(O=>t.jsx(kC,{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(ce.job(e,n,O.id))},O.id))]})]})}function kC({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(ol,{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:ce.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(ja,{text:e.name,needle:g})})}),d&&t.jsx(xe,{children:t.jsx(W0,{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:ce.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(dm,{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(Xt,{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(Xt,{value:e.delayedUntil})})}):t.jsx(Xt,{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(SC,{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(Wu,{})}),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(rm,{})}),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 ja({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 SC({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 ",Jt(e.dataBytes)," · open the job",e.failedReason&&t.jsx("span",{className:"block truncate font-sans text-danger",title:e.failedReason,children:t.jsx(ja,{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(ja,{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(ja,{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(ja,{text:o,needle:n}):t.jsx("span",{className:"text-fg-subtle",children:"{}"})});const c=e.dataTruncated?null:t2(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(ja,{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(ja,{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 CC=[25,50,100,200];function id({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(ut,{"aria-label":"Page size",className:"!h-7 !w-auto !py-0 text-xs",value:String(n),onChange:p=>o(Number(p.target.value)),options:CC.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(fN,{})}),t.jsx(V,{size:"icon-sm",variant:"ghost","aria-label":"Previous page",disabled:e<=1,onClick:()=>i(e-1),children:t.jsx(ku,{})}),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(mN,{})})]})]})}function Bt({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(jn,{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(Me,{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 _C(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 Co({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 _C(typeof e=="function"?e():e)&&g(!0)},...h,children:[f?t.jsx(Zr,{className:"text-success"}):o??t.jsx(Fy,{}),i&&(f?r:n)]})}function Dm({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(Co,{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 rj="new Worker(name, fn, { metrics: { maxDataPoints: MetricsTime.ONE_WEEK } })";function aj(e){return e.isLoading?"loading":e.isError||!e.data?"unknown":e.data.metricsEnabled?"on":"off"}function PC({connectionId:e,queueName:n}){const r=gm(e||void 0,n||void 0,{enabled:!!e&&!!n}),i=aj(r);return i==="loading"||i==="on"?null:t.jsx(ij,{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 EC({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(RC,{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(ij,{title:`Folder "${e.name}" — ${g.join(" · ")}`})]})}function RC({id:e,queue:n,onState:r}){const i=gm(n.connectionId,n.queueName),o=aj(i);return w.useEffect(()=>r(e,o),[e,o,r]),null}function ij({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(Dm,{code:rj,language:"ts",wrap:!0,maxHeight:80})]})}function MC({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 ${rj}`,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(Ly,{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 TC={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 qC(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 IC(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 $C(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 zC(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:$C(c.headersText)});return{name:e.name.trim(),enabled:e.enabled,scope:i,condition:r,channels:o,cooldownMinutes:n(e.cooldownMinutes)}}function ld({open:e,onClose:n,alert:r,initialScope:i}){var z,O,T,M;const o=xs(),c=M2(),d=O0(),h=((O=(z=o.data)==null?void 0:z[0])==null?void 0:O.id)??"",[f,g]=w.useState(()=>r?IC(r):qC(h,i)),[p,v]=w.useState({}),j=o2(f.connectionId||void 0,{enabled:f.scopeType==="queue"}),S=Jr(),y=(E,$)=>g(Q=>({...Q,[E]:$})),b=(E,$)=>g(Q=>({...Q,channels:Q.channels.map((H,q)=>q===E?{...H,...$}:H)})),k=c.isPending||d.isPending,C=()=>{let E;try{E=zC(f)}catch(H){v({channels:H.message});return}const $=g0.safeParse(E);if(!$.success){const H={};for(const q of $.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:$.data},{onSuccess:Q,onError:H=>X.error(ve(H))}):c.mutate($.data,{onSuccess:Q,onError:H=>X.error(ve(H))})};return t.jsx(jn,{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(Me,{label:"Name",value:f.name,onChange:E=>y("name",E.target.value),error:p.name,autoFocus:!0,placeholder:"payments: failures spiking"}),t.jsx(sd,{label:"Enabled",className:"justify-end",children:t.jsx(Cm,{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(ut,{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(ut,{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(ut,{label:"Connection",value:f.connectionId,onChange:E=>g($=>({...$,connectionId:E.target.value,queueName:""})),error:p.connectionId,options:(o.data??[]).map(E=>({value:E.id,label:E.name}))}),t.jsx(ut,{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(ut,{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 $,Q;return{value:E.id,label:E.parentId?`${((Q=($=S.data)==null?void 0:$.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(ut,{label:"Kind",value:f.kind,onChange:E=>y("kind",E.target.value),options:Rk.map(E=>({value:E,label:TC[E]}))}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[(f.kind==="waiting_above"||f.kind==="failed_above")&&t.jsx(Me,{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(Me,{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(Me,{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(ut,{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(Me,{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(Me,{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."]}),Tk(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(PC,{connectionId:f.connectionId,queueName:f.queueName}):f.scopeType==="folder"?f.folderId&&t.jsx(EC,{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,$)=>t.jsxs("div",{className:"grid gap-2 rounded-md bg-surface-2/50 p-2 sm:grid-cols-[130px_1fr_auto]",children:[t.jsx(ut,{"aria-label":"Channel type",value:E.type,onChange:Q=>b($,{type:Q.target.value}),options:[{value:"slack",label:"Slack webhook"},{value:"webhook",label:"Webhook (POST)"}]}),t.jsx(Me,{"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($,{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!==$)})),children:t.jsx(Un,{})}),E.type==="webhook"&&t.jsx(Ji,{"aria-label":"Headers",mono:!0,rows:2,placeholder:`Authorization: Bearer …
538
+ X-Source: bullpane`,value:E.headersText,onChange:Q=>b($,{headersText:Q.target.value}),wrapperClassName:"sm:col-span-3",hint:"One header per line, Name: value"})]},$)),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(Me,{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 OC=[15,30,60,0],AC={15:"15 min",30:"30 min",60:"1 hour",0:"All"};function LC(e){if(!e)return!1;const n=Du(e.completed)+Du(e.failed);return(e.completed.length>0||e.failed.length>0)&&n>0}function FC(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=>DC(f,o).slice(o-d);return{completed:h(r),failed:h(i),minutes:d,available:o,truncated:n!==0&&n>o}}function DC(e,n){return e.length>=n?e:[...Array.from({length:n-e.length},()=>0),...e]}function UC(e){if(e.minutes===0)return{perMinute:null,perHour:null,completed:0,failed:0,successPct:null};const n=Du(e.completed),r=Du(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 QC(e){return e.completed.map((n,r)=>{const i=e.failed[r]??0,o=n+i;return o>0?n/o*100:null})}function bv(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 Du(e){return(e??[]).reduce((n,r)=>n+r,0)}function BC(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:wv(r),process:wv(i),sampled:n.length}}function wv(e){if(e.length===0)return null;const n=[...e].sort((r,i)=>r-i);return{min:n[0],median:Nv(n,50),p95:Nv(n,95),max:n[n.length-1],count:n.length}}function Nv(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 $n={top:10,right:8,bottom:20,left:40},kv=4;function Sv({series:e,height:n=180,className:r,formatValue:i=ft,formatX:o=WC,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(Fe=>Fe.values.filter(W=>W!=null&&Number.isFinite(W))),B=q.length?Math.max(...q):0,ue=c??ZC(B),oe=Math.max(1,j-$n.left-$n.right),Ne=Math.max(1,n-$n.top-$n.bottom);return{max:ue,plotW:oe,plotH:Ne,scaleX:Fe=>$n.left+(y>1?Fe/(y-1)*oe:oe/2),scaleY:Fe=>$n.top+Ne-(ue>0?Fe/ue*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 oe=((q.clientX-B.left)/B.width*j-$n.left)/k,Ne=Math.round(oe*(y-1));v(Ne>=0&&Ne<y?Ne:null)},[E,$]=w.useState(null),Q=w.useCallback(q=>{g.current=q,$(q)},[]);w.useEffect(()=>{if(!E||typeof ResizeObserver>"u")return;const q=new ResizeObserver(([B])=>{const ue=Math.round(B.contentRect.width);ue>0&&S(ue)});return q.observe(E),()=>q.disconnect()},[E]);const H=Array.from({length:kv+1},(q,B)=>b/kv*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 ue=O(q);return t.jsxs("g",{children:[t.jsx("line",{x1:$n.left,x2:j-$n.right,y1:ue,y2:ue,stroke:"var(--border)",strokeWidth:1,shapeRendering:"crispEdges"}),t.jsx("text",{x:$n.left-6,y:ue+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(VC,{series:q,gradientId:`area-${f}-${q.key}`,scaleX:z,scaleY:O,baseline:$n.top+C},q.key)),p!=null&&t.jsxs("g",{pointerEvents:"none",children:[t.jsx("line",{x1:z(p),x2:z(p),y1:$n.top,y2:$n.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(HC,{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 VC({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 HC({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 KC({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 WC(e,n){const r=n-1-e;return r===0?"now":`${K(r)} min ago`}function ZC(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 GC=50;function JC({connectionId:e,queue:n,summary:r,onOpenState:i}){const[o,c]=w.useState(60),d=r==null?void 0:r.metrics,h=LC(d),f=w.useMemo(()=>FC(d,o),[d,o]),g=w.useMemo(()=>UC(f),[f]),p=w.useMemo(()=>QC(f),[f]);return t.jsxs("div",{className:"space-y-3",children:[t.jsx(YC,{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(e_,{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(t_,{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(_v,{icon:t.jsx(im,{}),title:"Processed",hint:`Completed and failed per minute over the last ${K(f.minutes)} min, straight from BullMQ's own metrics collection.`,legend:XC,children:t.jsx(Sv,{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(_v,{icon:t.jsx(Oo,{}),title:"Success rate",hint:"completed / (completed + failed) per minute. A minute where nothing finished is a gap, not 0 %.",children:t.jsx(Sv,{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(n_,{}),t.jsx(s_,{connectionId:e,queue:n,completedCount:(r==null?void 0:r.counts.completed)??0})]})}const XC=[{key:"completed",label:"Completed",color:lt.completed.fg},{key:"failed",label:"Failed",color:lt.failed.fg}];function YC({counts:e,onOpenState:n}){return t.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4 xl:grid-cols-8",children:vo.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 e_({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:OC.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:AC[i]},i)})})}function t_({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(Cv,{icon:t.jsx(po,{}),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(Cv,{icon:t.jsx(po,{}),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?"—":Pn(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:Tm(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(qm,{rates:e})]})]})}function Cv({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(Va,{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 _v({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(KC,{series:i,className:"ml-auto"})]}),o,t.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-fg-subtle",children:r})]})}function n_(){return t.jsxs("div",{className:"card",children:[t.jsx(on,{icon:t.jsx(im,{}),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(Dm,{className:"mx-auto max-w-2xl",language:"ts",code:"new Worker(name, fn, { metrics: { maxDataPoints: MetricsTime.ONE_WEEK } })"})})]})}function s_({connectionId:e,queue:n,completedCount:r}){var h;const i=E0(e,n,{state:"completed",page:1,pageSize:GC,order:"desc"},{enabled:r>0}),o=w.useMemo(()=>{var f;return BC((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(Zy,{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(Va,{className:"size-3","aria-hidden":!0}),"sample of ",K(c)]})})]}),r===0?t.jsx("div",{className:"card",children:t.jsx(on,{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(Pv,{title:"Response time",subtitle:"time in queue · processedOn − timestamp",stats:o.wait,loading:i.isLoading,color:lt.waiting.fg,note:d}),t.jsx(Pv,{title:"Process time",subtitle:"time in workers · finishedOn − processedOn",stats:o.process,loading:i.isLoading,color:lt.active.fg,note:d})]})]})}function Pv({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 Ev(e,n){const r=e.trim();if(!r)return{value:{}};try{return{value:JSON.parse(r)}}catch(i){return{error:`${n}: ${i.message}`}}}function r_({open:e,onClose:n,connectionId:r,queue:i}){const o=m2(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=Ev(h,"Data"),b=Ev(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=Sk.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(jn,{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(Me,{label:"Name",placeholder:"__default__",value:c,onChange:y=>d(y.target.value),error:v.name,mono:!0,autoFocus:!0}),t.jsx(Ji,{label:"Data (JSON)",mono:!0,rows:8,value:h,onChange:y=>f(y.target.value),error:v.data,spellCheck:!1}),t.jsx(Ji,{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 a_=p0.shape.state.options,i_=[{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 l_({open:e,onClose:n,connectionId:r,queue:i,defaultState:o}){const c=R0(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=p0.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(jn,{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(ut,{label:"State",value:d,onChange:b=>h(b.target.value),options:a_.map(b=>({value:b,label:b}))}),t.jsx(ut,{label:"Grace period",value:String(f),onChange:b=>g(Number(b.target.value)),options:i_.map(b=>({value:String(b.value),label:b.label})),hint:"Only jobs older than this are removed."}),t.jsx(Me,{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 Rv="queueSetup.open";function o_({connectionId:e,queue:n,className:r}){const[i,o]=w.useState(()=>Xu(Rv,!0)),c=gm(e,n),d=c.data,h=()=>{o(f=>(ko(Rv,!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(c_,{data:d}),(d==null?void 0:d.rateLimitedNow)&&t.jsx(lj,{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(Su,{className:"h-2.5 w-20"}),t.jsx(Su,{className:"h-3 w-28"})]},g))}),c.isError&&!d&&t.jsx("p",{className:"text-xs text-fg-muted",children:sr(c.error)&&c.error.status===404?"Setup details are not available on this server version.":`Setup unavailable: ${ve(c.error)}`}),d&&t.jsx(u_,{data:d,since:c.dataUpdatedAt})]})]})}function c_({data:e}){const n=oj(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 u_({data:e,since:n}){const r=oj(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(Ks,{icon:t.jsx(MN,{}),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(Ks,{icon:t.jsx(Gu,{}),label:"Workers connected",children:e.workers?t.jsx(Pe,{content:e.workers.names.length?d_(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(Ks,{icon:t.jsx(po,{}),label:"Global concurrency",children:e.globalConcurrency!=null?t.jsx("span",{className:"num",children:K(e.globalConcurrency)}):t.jsx(Mr,{children:"not set"})}),t.jsx(Ks,{icon:t.jsx(Zy,{}),label:"Global rate limit",children:e.globalRateLimit?t.jsxs("span",{className:"num",children:[K(e.globalRateLimit.max)," / ",cj(e.globalRateLimit.durationMs)]}):t.jsx(Mr,{children:"not set"})}),t.jsx(Ks,{icon:t.jsx(SN,{}),label:"Rate limited now",children:e.rateLimitedNow?t.jsx(lj,{ttlMs:e.rateLimitedNow.ttlMs,since:n}):t.jsx("span",{className:"text-fg-muted",children:"no"})}),t.jsx(Ks,{icon:t.jsx(Fo,{}),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(Ks,{icon:t.jsx(hN,{}),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(Ks,{icon:t.jsx(Oo,{}),label:"Metrics",children:e.metricsEnabled?t.jsx("span",{className:"text-state-completed",children:"enabled"}):t.jsx(Mr,{children:"disabled"})}),t.jsx(Ks,{icon:t.jsx(kN,{}),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(Oy,{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 Ks({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 lj({ttlMs:e,since:n}){const r=ll(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 ",cj(i)]})}function oj(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 cj(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 d_(e){const n=e.slice(0,12);return n.join(", ")+(e.length>n.length?` +${e.length-n.length} more`:"")}function h_({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=g2(e,n,{page:i,pageSize:c}),p=y2(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(Vt,{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(p_,{queue:n})}),v.map(C=>t.jsxs(ol,{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:m_(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:uj(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(id,{page:i,pageSize:c,total:j,count:v.length,onPage:o,onPageSize:C=>(d(C),o(1))})})]}),t.jsx(Bt,{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 uj(e){return e.every!=null?`every ${f_(e.every)}`:e.pattern?e.pattern:"unknown"}function f_(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 m_(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 p_({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(Ao,{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(Hy,{className:"size-3","aria-hidden":!0}),"upsertJobScheduler is idempotent: calling it again updates the schedule instead of adding a second one."]})]})}function Ha({feature:e}){const n=jo[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(xo,{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(sl,{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(x_,{feature:e})})]})}function x_({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(g_,{}),e==="users"&&t.jsx(v_,{}),e==="folders"&&t.jsx(y_,{}),e==="flows"&&t.jsx(j_,{}),t.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-surface to-transparent"})]})}function gu({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 g_(){return t.jsxs("div",{className:"space-y-2",children:[t.jsxs(gu,{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(gu,{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(gu,{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 v_(){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(gu,{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 y_(){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 j_(){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 b_(){const{has:e}=wt();return e("alerts")?t.jsx(N_,{}):t.jsx(Ha,{feature:"alerts"})}function dj(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 w_={fired:"danger",resolved:"success",delivery_failed:"warning",no_metrics:"info"};function N_(){var z,O;const{isOperator:e}=mt(),n=ym(),r=xs(),i=Jr(),o=O0(),c=T2(),d=q2(),[h,f]=w.useState(null),[g,p]=w.useState(null),[v,j]=w.useState(""),S=R2({limit:100,alertId:v||void 0}),y=T=>{var M,E;return T?((E=(M=r.data)==null?void 0:M.find($=>$.id===T))==null?void 0:E.name)??T:"–"},b=T=>{var M,E;return((E=(M=i.data)==null?void 0:M.find($=>$.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(Vt,{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(on,{compact:!0,icon:t.jsx(nl,{}),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(ol,{className:F(!T.enabled&&"opacity-60"),children:[t.jsx(xe,{children:T.firing?t.jsxs(be,{variant:"danger",dot:!0,children:[t.jsx(am,{className:"size-3"})," firing"]}):T.enabled?t.jsx(MC,{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:dj(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,$)=>t.jsx(be,{variant:"outline",size:"xs",className:"mr-1",children:E.type},$)),t.jsxs("span",{className:"text-[11px] text-fg-subtle",children:["· cooldown ",T.cooldownMinutes,"m"]})]})}),t.jsx(xe,{muted:!0,children:t.jsx(Xt,{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(Xi,{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:$=>X.error(ve($))})}),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 $=((Q=E.results)==null?void 0:Q.filter(q=>!q.ok))??[];E.ok&&$.length===0?X.success("Test notification sent",`${((H=E.results)==null?void 0:H.length)??0} channel(s) delivered`):X.error("Some channels failed",$.map(q=>`${q.channel}: ${q.error??"error"}`).join("; "))},onError:E=>X.error(ve(E))}),children:t.jsx(TN,{})}),e&&t.jsx(V,{size:"icon-xs",variant:"ghost",title:"Edit","aria-label":"Edit alert",onClick:()=>f({alert:T}),children:t.jsx(Do,{})}),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(ut,{"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(Vt,{})}),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(Xt,{value:T.createdAt})}),t.jsx(xe,{children:t.jsx(be,{variant:w_[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(ld,{open:!0,onClose:()=>f(null),alert:h.alert},((O=h.alert)==null?void 0:O.id)??"new"),t.jsx(Bt,{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 k_(e,n){const{has:r}=wt(),i=r("alerts"),o=ym(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 S_({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:ce.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(am,{className:"size-3"}):t.jsx(nl,{className:"size-3"}),n>0?`${n} firing`:r]})})}function C_({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(nl,{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:ce.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(am,{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:dj(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:ce.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(Xt,{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(Do,{className:"size-3.5"})})]})]},h.id))}),c&&t.jsx(ld,{open:!0,onClose:()=>d(null),alert:c}),t.jsx("span",{className:"sr-only",children:`Alerts watching ${n} on connection ${e}`})]})}function Um({open:e,onClose:n,connectionId:r,queue:i,match:o}){const c=x2(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(jn,{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 __({connectionId:e,queue:n,groupId:r}){var S;const{isOperator:i,isAdmin:o}=mt(),c=((S=ed(e,n,{page:1,pageSize:1}).data)==null?void 0:S.bullmqProApi)??!1,d=M0(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(Fo,{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:ce.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(Uo,{}),disabled:!c||d.isPending,title:v,onClick:()=>j("resume"),children:"Resume group"}),t.jsx(V,{size:"xs",variant:"secondary",leftIcon:t.jsx(om,{}),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(Bt,{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(Um,{open:g,onClose:()=>p(!1),connectionId:e,queue:n,match:{groupId:r}})]})}function P_({connectionId:e,queue:n,value:r,onChange:i,disabled:o,className:c,showWaiting:d=!0,pageGroups:h=[]}){var M;const f=ed(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(),$=z.filter(oe=>!E||oe.id.toLowerCase().includes(E)).slice(0,100),Q=E&&z.some(oe=>oe.id.toLowerCase()===E),H=h.filter(oe=>!E||oe.toLowerCase().includes(E)).slice(0,50),q=new Set(H),B=[];E||B.push({id:"",label:"All groups"}),B.push(...H.map(oe=>({id:oe,label:oe,onPage:!0}))),B.push(...$.filter(oe=>!q.has(oe.id)).map(oe=>({id:oe.id,label:oe.id,waiting:d?oe.waiting:void 0})));const ue=Q||H.some(oe=>oe.toLowerCase()===E);return E&&!ue&&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=$=>{var Q;(Q=k.current)!=null&&Q.contains($.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(Fo,{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($=>Math.min(O.length-1,$+1))):E.key==="ArrowUp"?(E.preventDefault(),y($=>Math.max(0,$-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,$)=>{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",$===S?"bg-surface-3 text-fg":"text-fg-muted hover:bg-surface-2 hover:text-fg"),onMouseEnter:()=>y($),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 E_={retry:"retried",promote:"promoted",remove:"removed",discard:"discarded"};function hj(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} ${E_[n]}`}const R_=[{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 fj({job:e,onClose:n,onPick:r,pending:i}){const o=e!=null&&e.delayedUntil?gn(e.delayedUntil):"its scheduled time";return t.jsx(jn,{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:R_.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 M_=10;function T_(e){return!!e&&vo.includes(e)}function nf({view:e="jobs"}={}){var fl,ml,pl,ti,xl,cr,ni,ur,Go,dr,ra,aa,si,Jo,Xo,Yo,ys,gl,vl,ec,yl,jl,bl,wl,tc,nc,gt;const{connectionId:n="",queue:r=""}=Fn(),[i,o]=tl(),c=cn(),{isOperator:d,isAdmin:h}=mt(),f=T_(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(ae=>{o(tt=>{const Ye=new URLSearchParams(tt);for(const[Mt,Nl]of Object.entries(ae))Nl==null||Nl===""?Ye.delete(Mt):Ye.set(Mt,Nl);return Ye},{replace:!0})},[o]),C=P0(n,r),z=k_(n,r),O=Sm(n),T=!!C.data&&(C.data.isPro||C.data.groupsCount>0),M=j.trim().length>0,E=!M&&!!S&&f!=="waiting"&&f!=="prioritized",$=!M&&!!S&&!E,Q=M||E,H=e==="metrics",q=e==="schedulers",B=H||q,ue=E0(n,r,{state:f,page:g,pageSize:p,order:v,groupId:$?S:void 0},{enabled:!Q&&!B}),oe=u2(n,r,{state:f,q:j.trim(),groupId:E?S:void 0,limit:50},{enabled:Q&&!B}),Ne=vm(n,r),Ie=R0(n,r),ot=f2(n,r),Fe=((fl=oe.data)==null?void 0:fl.pages)??[],W=Fe.flatMap(ae=>ae.jobs),me=Fe.reduce((ae,tt)=>ae+(tt.scanned??0),0),ne=Fe.reduce((ae,tt)=>ae+(tt.skippedLargePayloads??0),0),A=Fe.length?Fe[Fe.length-1].total:((pl=(ml=C.data)==null?void 0:ml.counts)==null?void 0:pl[f])??0,[Z,Le]=w.useState(0);w.useEffect(()=>Le(0),[S,f]),w.useEffect(()=>{!E||!oe.hasNextPage||oe.isFetching||W.length>=50||Fe.length-Z>=M_||oe.fetchNextPage()},[E,oe,W.length,Fe.length,Z]);const De=()=>{Le(Fe.length),oe.fetchNextPage()},Se=Q?W:((ti=ue.data)==null?void 0:ti.jobs)??[],Ue=w.useMemo(()=>Se.map(ae=>ae.id),[Se]),rt=w.useMemo(()=>[...new Set(Se.map(ae=>ae.groupId).filter(ae=>!!ae))],[Se]),Be=wC(Ue),[at,Wt]=w.useState(null),[lr,cl]=w.useState(null),[Ka,Xr]=w.useState(null),[Yr,Wa]=w.useState(null),[ea,Za]=w.useState(null),[ul,or]=w.useState(!1),[Rn,Ft]=w.useState(null),[Ho,Ga]=w.useState(!1),Qn=i.get("confirm");w.useEffect(()=>{if(Qn!=="drain"&&Qn!=="clean"&&Qn!=="obliterate")return;(Qn==="clean"?d:h)?Ft(Qn):X.error(`${Qn==="clean"?"Cleaning":Qn==="drain"?"Draining":"Obliterating"} a queue needs the ${Qn==="clean"?"operator":"admin"} role`),o(tt=>{const Ye=new URLSearchParams(tt);return Ye.delete("confirm"),Ye},{replace:!0})},[Qn,h,d,o]);const{has:Ko,gate:Ja}=wt(),[ta,vs]=w.useState(!1),$s=w.useRef(null),zs=w.useCallback(()=>{var ae,tt;(ae=$s.current)==null||ae.focus(),(tt=$s.current)==null||tt.select()},[]);N0("/",ae=>{ae.preventDefault(),zs()}),w.useEffect(()=>{if(i.get("search")!=="1")return;const ae=window.setTimeout(zs,0);return k({search:null}),()=>window.clearTimeout(ae)},[i,k,zs]),w.useEffect(()=>b(j),[j]);const Nt=(xl=C.data)==null?void 0:xl.counts,dl=(cr=T0(n,r,S||void 0,{page:1,pageSize:1}).data)==null?void 0:cr.total,$t=(ni=C.data)==null?void 0:ni.groupWaiting,Wo=w.useMemo(()=>{if(S)return{count:dl??null,title:`Jobs waiting in group ${S} (its list and its prioritized jobs)`};if(!$t||$t.jobs===0)return{count:(Nt==null?void 0:Nt.waiting)??null};const ae=(Nt==null?void 0:Nt.waiting)??0;return{count:ae+$t.jobs,countSuffix:$t.complete?void 0:"+",title:`${K(ae)} in the queue's wait list + ${K($t.jobs)} waiting inside BullMQ Pro groups`+($t.complete?"":` (the first ${K(Nk)} groups)`)+". Pick a group to list its jobs."}},[S,dl,$t,Nt==null?void 0:Nt.waiting]),hl=w.useMemo(()=>{var tt,Ye;const ae=[{value:"metrics",label:"Metrics",icon:t.jsx(im,{className:"size-3.5"})},{value:"schedulers",label:"Schedulers",count:((tt=C.data)==null?void 0:tt.schedulersCount)??null,icon:t.jsx(Ao,{className:"size-3.5"})},...vo.map(Mt=>({value:Mt,label:lt[Mt].label,count:(Nt==null?void 0:Nt[Mt])??null,tone:lt[Mt].dotClass,...Mt==="waiting"?Wo:{}}))];return(Ye=C.data)!=null&&Ye.isPro&&ae.push({value:"groups",label:"Groups",count:C.data.groupsCount,icon:t.jsx(Fo,{className:"size-3.5 text-pro"})}),ae},[Nt,Wo,(ur=C.data)==null?void 0:ur.isPro,(Go=C.data)==null?void 0:Go.groupsCount,(dr=C.data)==null?void 0:dr.schedulersCount]),na=(ae,tt,Ye)=>{Ne.mutate({jobId:ae,action:tt,scheduler:Ye},{onSuccess:Mt=>{X.success(hj(ae,tt,Mt)),Za(null)},onError:Mt=>X.error(ve(Mt))})},Xa=(ae,tt,Ye)=>{if(tt==="remove"){Wa(ae);return}if(tt==="promote"&&(Ye!=null&&Ye.repeatJobKey)){Za({id:Ye.id,repeatJobKey:Ye.repeatJobKey,delayedUntil:Ye.delayedUntil});return}na(ae,tt)},Ya=w.useMemo(()=>sj(M?"mixed":f),[M,f]),ei=ae=>{const tt=Be.selectedIds;if(tt.length!==0){if(tt.length>Ou){X.error(`Select at most ${K(Ou)} jobs per action (${K(tt.length)} selected).`);return}cl(ae),ot.mutate({action:ae,jobIds:tt},{onSuccess:Ye=>{Wt(Ye),Be.deselect(Ye.ok);const Mt=ae==="retry"?"retried":ae==="promote"?"promoted":"removed";Ye.failed.length===0?X.success(`${K(Ye.ok.length)} ${Mt}`):X.error(`${K(Ye.ok.length)} ${Mt} · ${K(Ye.failed.length)} failed`)},onError:Ye=>X.error(ve(Ye)),onSettled:()=>{cl(null),Xr(null)}})}},Os=ae=>{ae==="remove"?Xr("remove"):ei(ae)},Bn=(ae,tt)=>Ie.mutate(ae,{onSuccess:()=>{X.success(tt),Ft(null),ae.action==="obliterate"&&c(ce.connection(n))},onError:Ye=>X.error(ve(Ye))}),Zo=()=>k({q:y.trim()||null,page:null}),sa=()=>{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}),((ra=C.data)==null?void 0:ra.isPaused)&&t.jsx(be,{variant:"warning",dot:!0,className:"tracking-wider",children:"PAUSED"}),((aa=C.data)==null?void 0:aa.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:[((si=C.data)==null?void 0:si.prefix)??"bull",":",r]}),((Jo=C.data)==null?void 0:Jo.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(Yi,{values:C.data.metrics.completed,width:72,height:16,title:"Completed per minute"})}),t.jsx("span",{style:{color:lt.failed.fg},children:t.jsx(Yi,{values:C.data.metrics.failed,width:72,height:16,title:"Failed per minute"})})]}),t.jsx(S_,{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:()=>Ft("add"),children:"Add job"}),t.jsx(V,{size:"sm",leftIcon:t.jsx(nl,{}),onClick:()=>Ja("alerts",()=>Ga(!0)),title:"Alert on this queue",children:"Create alert"}),t.jsx(V,{size:"sm",leftIcon:(Xo=C.data)!=null&&Xo.isPaused?t.jsx(Uo,{}):t.jsx(Gr,{}),loading:Ie.isPending&&(((Yo=Ie.variables)==null?void 0:Yo.action)==="pause"||((ys=Ie.variables)==null?void 0:ys.action)==="resume"),onClick:()=>{var ae;return(ae=C.data)!=null&&ae.isPaused?Bn({action:"resume"},"Queue resumed"):Ft("pause")},children:(gl=C.data)!=null&&gl.isPaused?"Resume":"Pause"}),t.jsx(V,{size:"sm",leftIcon:t.jsx(Wu,{}),onClick:()=>Ft("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":ta,onClick:()=>vs(ae=>!ae),children:"More"}),ta&&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(du,{icon:t.jsx(yN,{}),label:"Clean…",hint:"remove by state and age",onClick:()=>(vs(!1),Ft("clean"))}),h&&t.jsxs(Ee,{role:"menuitem",to:ce.audit({connectionId:n,queueName:r}),onClick:()=>vs(!1),className:"nav-item w-full text-left",children:[t.jsx(Qo,{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(du,{icon:t.jsx(Lo,{}),label:"Hide from the lists",hint:wS,onClick:()=>(vs(!1),O.hide(r))}),h&&t.jsx(du,{icon:t.jsx(Un,{}),label:"Drain",hint:"remove all waiting jobs",onClick:()=>(vs(!1),Ft("drain"))}),h&&t.jsx(du,{icon:t.jsx(jN,{}),label:"Obliterate…",hint:"deletes the queue and every job · permanent",danger:!0,onClick:()=>(vs(!1),Ft("obliterate"))})]})]})]})]})]}),t.jsx(o_,{connectionId:n,queue:r,className:"mb-3"}),t.jsx("div",{className:"mb-3",children:t.jsx(C_,{connectionId:n,queueName:r,matches:z.matches,onCreate:()=>Ja("alerts",()=>Ga(!0))})}),!B&&t.jsxs("form",{className:"mb-3 flex flex-wrap items-center gap-2",role:"search",onSubmit:ae=>{ae.preventDefault(),Zo()},children:[t.jsxs("div",{className:"relative min-w-72 flex-1",children:[t.jsx(Me,{ref:$s,leftIcon:t.jsx(Yn,{}),placeholder:`Search job data, name, id or error in ${f}…`,"aria-label":"Search jobs",value:y,onChange:ae=>b(ae.target.value),onKeyDown:ae=>{ae.key==="Escape"&&(ae.preventDefault(),sa(),ae.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:sa,children:t.jsx(vn,{className:"size-3.5"})}):t.jsx("span",{className:"hidden items-center gap-1 sm:flex",children:t.jsx(Gi,{children:"/"})})})]}),t.jsx(ut,{"aria-label":"State to search",className:"!h-9 !w-auto",value:f,onChange:ae=>k({state:ae.target.value,page:null,group:null}),options:vo.map(ae=>({value:ae,label:`in ${lt[ae].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(Fm,{"aria-label":"Job state",items:hl,value:H?"metrics":q?"schedulers":f,onChange:ae=>{ae==="groups"?c(ce.groups(n,r)):ae==="metrics"?c(ce.queueMetrics(n,r)):ae==="schedulers"?c(`/c/${encodeURIComponent(n)}/q/${encodeURIComponent(r)}/schedulers`):B?c(ce.queue(n,r,ae)):k({state:ae,page:null})},className:"!border-b-0",size:"sm"})}),T&&!M&&!B&&t.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[($||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(P_,{connectionId:n,queue:r,value:S,onChange:ae=>k({group:ae||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(aN,{}),onClick:()=>k({order:v==="desc"?"asc":"desc"}),title:"Toggle order",children:v==="desc"?"Newest first":"Oldest first"})]}),T&&S&&!M&&!B&&t.jsx(__,{connectionId:n,queue:r,groupId:S}),q?t.jsx(h_,{connectionId:n,queue:r}):H?t.jsx(JC,{connectionId:n,queue:r,summary:C.data,onOpenState:ae=>c(ce.queue(n,r,ae))}):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}),oe.isFetching&&!oe.isFetchingNextPage?t.jsx(Vt,{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}),!oe.hasNextPage&&oe.data&&t.jsx("span",{className:"text-fg-subtle",children:" · whole state scanned"}),ne>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(ne)," ",ne===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(om,{}),onClick:()=>or(!0),title:"Promote every delayed job that contains the search, not only the loaded ones",children:"Promote all matches"}),oe.hasNextPage&&t.jsx(V,{size:"sm",onClick:De,loading:oe.isFetchingNextPage,children:"Scan more"}),t.jsx(V,{size:"sm",variant:"ghost",leftIcon:t.jsx(vn,{}),onClick:M?sa:()=>k({group:null,page:null}),children:"Clear"})]})]}),at&&t.jsx(jv,{result:at,onDismiss:()=>Wt(null)}),d&&t.jsx(yv,{selection:Be,state:M?"mixed":f,queue:r,actions:Ya,onRun:Os,pending:lr,searching:!0}),t.jsx(Vf,{connectionId:n,queue:r,jobs:oe.data?W:void 0,loading:oe.isLoading,error:oe.error,emptyText:oe.hasNextPage?"No matches yet — scan more to keep looking":M?`No ${f} job contains "${j}"`:`No ${f} jobs in group ${S}`,canOperate:d,onAction:Xa,pendingId:Ne.isPending?(vl=Ne.variables)==null?void 0:vl.jobId:null,showState:!1,showGroup:T,onGroupClick:ae=>{sa(),k({group:ae,page:null})},highlight:M?j:void 0,selection:d?Be: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."}),oe.hasNextPage&&t.jsx(V,{size:"sm",onClick:De,loading:oe.isFetchingNextPage,children:"Scan more"})]})]}):t.jsxs(t.Fragment,{children:[f==="active"&&(((ec=C.data)==null?void 0:ec.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(dm,{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(((yl=C.data)==null?void 0:yl.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(jv,{result:at,onDismiss:()=>Wt(null)}),d&&t.jsx(yv,{selection:Be,state:f,queue:r,actions:Ya,onRun:Os,pending:lr}),t.jsx(Vf,{connectionId:n,queue:r,jobs:(jl=ue.data)==null?void 0:jl.jobs,loading:ue.isLoading,error:ue.error,emptyText:$?`No waiting jobs in group ${S}`:f==="waiting"&&(($t==null?void 0:$t.jobs)??0)>0?`The queue's wait list is empty: BullMQ Pro keeps ${K(($t==null?void 0:$t.jobs)??0)}${$t!=null&&$t.complete?"":"+"} waiting jobs inside groups. Pick a group above to list them.`:"No jobs in this state",canOperate:d,onAction:Xa,pendingId:Ne.isPending?(bl=Ne.variables)==null?void 0:bl.jobId:null,showState:!1,showGroup:T,onGroupClick:ae=>k({group:ae,page:null}),selection:d?Be:void 0}),t.jsx("div",{className:F("border-t border-border px-3 py-2",ue.isFetching&&"opacity-80"),children:t.jsx(id,{page:g,pageSize:p,total:((wl=ue.data)==null?void 0:wl.total)??($?0:(Nt==null?void 0:Nt[f])??0),count:(tc=ue.data)==null?void 0:tc.jobs.length,onPage:ae=>k({page:String(ae)}),onPageSize:ae=>k({pageSize:String(ae),page:null})})})]})}),d&&t.jsx(r_,{open:Rn==="add",onClose:()=>Ft(null),connectionId:n,queue:r}),d&&Ko("alerts")&&Ho&&t.jsx(ld,{open:!0,onClose:()=>Ga(!1),alert:null,initialScope:{type:"queue",connectionId:n,queueName:r}}),d&&t.jsx(l_,{open:Rn==="clean",onClose:()=>Ft(null),connectionId:n,queue:r,defaultState:f==="waiting"?"wait":f==="waiting-children"?"completed":f}),t.jsx(Bt,{open:Ka==="remove",onClose:()=>Xr(null),title:"Remove selected jobs",description:`Remove ${K(Be.selectedIds.length)} ${Be.selectedIds.length===1?"job":"jobs"} from ${r}? This cannot be undone.`,confirmText:`Remove ${K(Be.selectedIds.length)}`,danger:!0,loading:lr==="remove",onConfirm:()=>ei("remove")}),t.jsx(Bt,{open:Yr!==null,onClose:()=>Wa(null),title:"Remove job",description:`Remove job ${Yr??""} from ${r}? This cannot be undone.`,confirmText:"Remove",danger:!0,loading:Ne.isPending,onConfirm:()=>{Yr&&na(Yr,"remove"),Wa(null)}}),t.jsx(fj,{job:ea,onClose:()=>Za(null),onPick:ae=>ea&&na(ea.id,"promote",ae),pending:Ne.isPending&&((nc=Ne.variables)==null?void 0:nc.action)==="promote"?Ne.variables.scheduler??null:null}),t.jsx(Y0,{queue:Rn==="pause"?r:null,onClose:()=>Ft(null),loading:Ie.isPending&&((gt=Ie.variables)==null?void 0:gt.action)==="pause",onConfirm:ae=>Bn({action:"pause",body:ae?{reason:ae}:{}},"Queue paused")}),t.jsx(Bt,{open:Rn==="retryAll",onClose:()=>Ft(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(Bt,{open:Rn==="drain",onClose:()=>Ft(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(Bt,{open:Rn==="obliterate",onClose:()=>Ft(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(Um,{open:ul,onClose:()=>or(!1),connectionId:n,queue:r,match:{query:j.trim()}})]})}function du({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 mj({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(xj,{name:i,value:e,depth:0,expandDepth:n,last:!0})})}function pj(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 hu=200;function q_({value:e}){const[n,r]=w.useState(!1);switch(pj(e)){case"string":{const o=e,d=!n&&o.length>hu?`${o.slice(0,hu)}…`:o;return t.jsxs("span",{className:"text-success break-all",children:['"',d,'"',o.length>hu&&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-hu} 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 xj({name:e,value:n,depth:r,expandDepth:i,last:o}){const c=pj(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:I_(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(q_,{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(xj,{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 I_(e){return/^[A-Za-z_$][\w$]*$/.test(e)}function $_(){var T,M,E,$,Q;const{connectionId:e="",queue:n="",jobId:r=""}=Fn(),i=cn(),{has:o}=wt(),{isOperator:c,isAdmin:d}=mt(),h=d2(e,n,r),f=vm(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(hj(r,H,B)),j(null),y(!1),H==="remove"&&i(ce.queue(e,n))},onError:B=>X.error(ve(B))});if(h.isLoading)return t.jsx(bt,{children:t.jsx(rl,{label:"Loading job…"})});if(h.isError||!h.data){const H=sr(h.error)&&h.error.status===404;return t.jsx(bt,{children:t.jsx(on,{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(ku,{}),onClick:()=>i(ce.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:ce.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(ku,{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(W0,{state:k.state}),k.groupId&&t.jsx(Ee,{to:ce.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(Co,{value:k.id,label:"Copy id",size:"icon-xs"}),t.jsx(Co,{value:()=>Fu(k),label:"Copy JSON",copiedLabel:"Copied JSON",showLabel:!0,size:"xs",icon:t.jsx(Oy,{}),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(Wu,{}),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(rm,{}),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(uN,{}),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(A_,{job:k})}),t.jsxs("dl",{className:"card grid grid-cols-2 gap-x-4 gap-y-3 p-4 text-xs",children:[t.jsx(ya,{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(ya,{label:"Runs at",children:t.jsx(z_,{at:k.delayedUntil})}):t.jsx(ya,{label:"Delay",children:k.delay?An(k.delay):"–"}),t.jsx(ya,{label:"Priority",children:k.priority||"–"}),t.jsx(ya,{label:"Progress",children:t.jsx(O_,{value:k.progress})}),t.jsx(ya,{label:"Parent",children:k.parent?t.jsxs(Ee,{to:ce.job(e,av(k.parent.queueKey),k.parent.id),className:"inline-flex items-center gap-1 font-mono text-accent hover:underline",children:[t.jsx(wN,{className:"size-3"}),k.parent.queue||av(k.parent.queueKey),"/",k.parent.id]}):"–"}),t.jsx(ya,{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:ce.jobTree(e,n,k.id),className:"inline-flex items-center gap-1.5 text-[13px] text-accent hover:underline",children:[t.jsx(RN,{className:"size-3.5","aria-hidden":!0}),"View flow tree"]})})]}),t.jsx(Fm,{"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??(($=k.logs)==null?void 0:$.length)??0},...d&&o("audit")?[{value:"audit",label:"Audit"}]:[]]}),g==="data"&&t.jsx(sf,{value:k.data,empty:"No data"}),g==="opts"&&t.jsx(sf,{value:k.opts,empty:"No options"}),g==="returnvalue"&&t.jsx(sf,{value:k.returnvalue,empty:"No return value (job has not completed)"}),g==="error"&&t.jsx(L_,{job:k}),g==="logs"&&t.jsx(F_,{connectionId:e,queue:n,jobId:r,initial:k.logs,total:k.logsCount}),g==="audit"&&t.jsx(D_,{connectionId:e,queue:n,jobId:r}),t.jsx(fj,{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(Bt,{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(Bt,{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 ya({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 z_({at:e}){return e?t.jsxs("span",{className:"flex flex-col leading-tight",children:[t.jsx(Xt,{value:e}),t.jsx("span",{className:"font-mono text-[10px] text-fg-subtle",children:Ff(e)})]}):t.jsx(t.Fragment,{children:"–"})}function O_({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:Fu(e),children:Fu(e,0).slice(0,40)})}function A_({job:e}){var g;const n=ll(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(Xt,{value:p.ts}):e.state==="active"&&v===2?"running…":e.state==="delayed"&&v===1&&e.delayedUntil?t.jsxs(t.Fragment,{children:["runs ",t.jsx(Xt,{value:e.delayedUntil})]}):"–"}),p.ts&&t.jsx("span",{className:"font-mono text-[10px] text-fg-subtle",children:Ff(p.ts)}),!p.ts&&e.state==="delayed"&&v===1&&e.delayedUntil&&t.jsx("span",{className:"font-mono text-[10px] text-fg-subtle",children:Ff(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=DS[e.state])==null?void 0:g.dot)??"bg-fg-subtle")})," ",e.state]})]})]})}function sf({value:e,empty:n}){const[r,i]=w.useState(!1),o=w.useMemo(()=>Fu(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(Co,{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(mj,{value:e,defaultExpandDepth:3})})]})}function L_({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(Dm,{code:r,header:`Stacktrace · attempt ${i+1} of ${e.stacktrace.length}`,wrap:!0,maxHeight:360},i))]})}function F_({connectionId:e,queue:n,jobId:r,initial:i,total:o}){var p,v;const[c,d]=w.useState(!1),h=h2(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(Co,{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 D_({connectionId:e,queue:n,jobId:r}){var c;const i=F2(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(Xt,{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:xm[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:ce.audit({connectionId:e,queueName:n}),className:"inline-flex items-center gap-1.5 text-xs text-accent hover:underline",children:[t.jsx(Qo,{className:"size-3.5","aria-hidden":!0})," Full audit log for this queue"]})})]})}const gj={waiting:"info",limited:"violet",maxed:"danger",paused:"warning"},vj={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."},Mv="No per-group override in Redis. The worker's own group option applies (a worker option, not stored in Redis).";function U_(){var v,j,S;const{connectionId:e="",queue:n=""}=Fn(),r=cn(),[i,o]=w.useState(1),[c,d]=w.useState(50),h=P0(e,n),f=ed(e,n,{page:i,pageSize:c}),g=ll(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:ce.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(B_,{byStatus:f.data.byStatus,total:f.data.total}),f.data&&!f.data.bullmqProApi&&t.jsx(yj,{}),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(Vt,{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(V_,{g:y,now:g,onOpen:()=>r(ce.group(e,n,y.id)),href:ce.group(e,n,y.id)},y.id))]})]}),t.jsx("div",{className:"border-t border-border px-3 py-2",children:t.jsx(id,{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 Q_="https://github.com/madmorett/bullpane/blob/main/docs/BULLMQ-PRO.md";function yj(){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(Va,{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:Q_,target:"_blank",rel:"noreferrer",className:"text-accent hover:underline",children:"How to install it"})]})]})}function B_({byStatus:e,total:n}){return t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[kk.map(r=>t.jsx(Pe,{content:vj[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:gj[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 V_({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(ol,{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:gj[e.status],dot:!0,size:"xs",title:vj[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:Mv,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:Mv,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(H_,{g:e,now:n})})]})}function H_({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 K_(){var H,q,B,ue,oe;const{connectionId:e="",queue:n="",groupId:r=""}=Fn(),{isOperator:i}=mt(),[o,c]=w.useState(1),[d,h]=w.useState(25),f=T0(e,n,r,{page:o,pageSize:d}),g=vm(e,n),{isAdmin:p}=mt(),v=((H=ed(e,n,{page:1,pageSize:1}).data)==null?void 0:H.bullmqProApi)??!1,j=M0(e,n),[S,y]=tl(),[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),$=(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):$(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:ce.groups(e,n),className:"inline-flex items-center gap-1 text-fg-muted hover:text-fg",children:[t.jsx(ku,{className:"size-4"})," Groups"]}),t.jsx("span",{className:"text-fg-subtle",children:"/"}),t.jsx(Fo,{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(Uo,{}),disabled:!v||j.isPending,title:z,onClick:()=>C("resume"),children:"Resume group"}),t.jsx(V,{size:"sm",variant:"secondary",leftIcon:t.jsx(om,{}),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:ce.queueGroup(e,n,r,Ne),className:"text-accent hover:underline",children:Ne})]},Ne))]}),f.data&&!v&&t.jsx(yj,{}),t.jsxs("div",{className:"card overflow-hidden",children:[t.jsx(Vf,{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(id,{page:o,pageSize:d,total:((ue=f.data)==null?void 0:ue.total)??0,count:(oe=f.data)==null?void 0:oe.jobs.length,onPage:c,onPageSize:Ne=>(h(Ne),c(1))})})]}),t.jsx(Um,{open:O,onClose:()=>T(!1),connectionId:e,queue:n,match:{groupId:r}}),t.jsx(Bt,{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(Bt,{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&&$(M,"remove"),E(null)}})]})}function jj({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}=il(),[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(jn,{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(Me,{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(rl,{}),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(Cm,{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 Uu=["#5b8def","#3fb950","#d29922","#f85149","#a371f7","#39c5bb","#f778ba","#9aa3ad"];function W_(){const{has:e}=wt();return e("folders")?t.jsx(Z_,{}):t.jsx(Ha,{feature:"folders"})}function Z_(){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(rl,{})}):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(Ug,{}),onClick:()=>c({parentId:null}),children:"New folder"})}),d.length===0?t.jsx(on,{icon:t.jsx(nr,{}),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(Ug,{}),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(Tv,{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(Tv,{folder:v,depth:1,selected:r===v.id,onSelect:()=>i(v.id)},v.id))]},p.id))}),t.jsx("div",{children:g?t.jsx(G_,{folder:g,allFolders:d,canEdit:e,onDeleted:()=>i(null)},g.id):t.jsx(on,{compact:!0,title:"Select a folder"})})]}),t.jsx(J_,{open:!!o,parentId:(o==null?void 0:o.parentId)??null,roots:h,onClose:()=>c(null),onCreated:p=>i(p.id)})]})}function Tv({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(nr,{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 G_({folder:e,allFolders:n,canEdit:r,onDeleted:i}){var T;const o=$0(),c=P2(),d=z0(),{byConnection:h}=il(),[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($=>$.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(nr,{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(Me,{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(Do,{})})]}),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:ce.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(oN,{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:[Uu.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(ut,{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:ce.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(jj,{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(Bt,{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 J_({open:e,parentId:n,roots:r,onClose:i,onCreated:o}){const c=_2(),[d,h]=w.useState(""),[f,g]=w.useState(Uu[0]),[p,v]=w.useState(n??""),[j,S]=w.useState(null);w.useEffect(()=>v(n??""),[n,e]);const y=()=>{var k;const b=x0.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(jn,{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(Me,{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:Uu.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(ut,{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 X_=["waiting","active","completed","failed","delayed"];function Y_(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:bv(e.map(j=>{var S;return(S=j.queue.metrics)==null?void 0:S.completed})),failedSeries:bv(e.map(j=>{var S;return(S=j.queue.metrics)==null?void 0:S.failed})),withMetrics:o,windowMinutes:c,skewedQueues:d}}function e3({entries:e,className:n}){const r=w.useMemo(()=>Y_(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. ${Rm}`:"";return t.jsxs("div",{className:F("grid gap-2 sm:grid-cols-3 xl:grid-cols-7",n),children:[X_.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?"—":Pn(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":`${Pn(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(Yi,{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 t3(e){let n="";for(const r of e)r==="*"?n+=".*":r==="?"?n+=".":n+=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^${n}$`,"i")}function n3(e,n){const r=e.trim();if(!r)return!1;try{return t3(r).test(n)}catch{return!1}}const fu="__any__";function s3({open:e,onClose:n,existing:r,onImport:i,saving:o}){const{byConnection:c}=il(),[d,h]=w.useState(""),[f,g]=w.useState(fu),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!==fu&&k.id!==f))for(const z of C){if(!n3(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(jn,{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(Ef,{}),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(Me,{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(ut,{label:"Connection",value:f,onChange:y=>g(y.target.value),options:[{value:fu,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!==fu&&" 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(Va,{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 r3({open:e,onClose:n,folder:r,allFolders:i}){const o=$0(),[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=_k.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(jn,{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(Me,{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:[Uu.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(ut,{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 a3(){const{has:e}=wt();return e("folders")?t.jsx(i3,{}):t.jsx(Ha,{feature:"folders"})}function i3(){const{folderId:e=""}=Fn(),{isOperator:n}=mt(),{has:r,gate:i}=wt(),o=Jr(),{byConnection:c,isLoading:d}=il(),h=z0(),[f,g]=w.useState(null),{sort:p,setSort:v,filter:j,setFilter:S}=Em(`folder.${e}`,Om,zm),y=o.data??[],b=y.find($=>$.id===e)??null,{entries:k,missing:C}=w.useMemo(()=>{const $=[],Q=[];for(const H of(b==null?void 0:b.queues)??[]){const q=c.find(ue=>ue.connection.id===H.connectionId),B=q==null?void 0:q.queues.find(ue=>ue.name===H.queueName);q&&B?$.push({connection:q.connection,queue:B}):Q.push(H)}return{entries:$,missing:Q}},[b,c]),z=w.useMemo(()=>k.filter($=>Pm($,j)),[k,j]),O=($,Q,H=!0)=>{b&&h.mutate({id:b.id,input:{queues:$}},{onSuccess:()=>{X.success(Q),H&&g(null)},onError:q=>X.error(ve(q))})},T=$=>O(((b==null?void 0:b.queues)??[]).filter(Q=>!(Q.connectionId===$.connectionId&&Q.queueName===$.queueName)),`${$.queueName} removed from ${(b==null?void 0:b.name)??"folder"}`,!1);if(o.isLoading)return t.jsx(bt,{wide:!0,children:t.jsx(rl,{})});if(!b)return t.jsx(bt,{wide:!0,children:t.jsx(on,{icon:t.jsx(nr,{}),title:"Folder not found",description:"It may have been deleted.",action:t.jsx(Ee,{to:ce.folders,className:"text-accent hover:underline",children:"Back to folders"})})});const M=b.parentId?y.find($=>$.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($=>$.queueName).join(", "),children:["· ",K(C.length)," not found"]}),t.jsx("span",{className:"text-fg-subtle",children:"·"}),t.jsx(Ee,{to:ce.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(Do,{}),onClick:()=>g("edit"),children:"Edit"}),n&&t.jsx(V,{size:"sm",variant:"secondary",leftIcon:t.jsx(Ef,{}),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(nl,{}),onClick:()=>i("alerts",()=>g("alert")),title:"Alert on every queue in this folder",children:"Create alert"})]})]}),t.jsx(e3,{entries:k,className:"mb-4"}),E?t.jsx("div",{className:"card",children:t.jsx(on,{icon:t.jsx(nr,{}),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(Ef,{}),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($m,{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(Im,{}):z.length>0?t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(auto-fill, minmax(230px, 1fr))"},children:z.map($=>t.jsx(l3,{entry:$,onRemove:n?()=>T({connectionId:$.connection.id,queueName:$.queue.name}):void 0,removing:h.isPending},Ia($)))}):null,t.jsx("div",{className:"card overflow-hidden",children:t.jsx(Am,{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($=>{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:$.queueName}),t.jsx(be,{variant:"outline",size:"xs",children:((Q=c.find(H=>H.connection.id===$.connectionId))==null?void 0:Q.connection.name)??$.connectionId}),n&&t.jsx(V,{size:"icon-xs",variant:"ghost",className:"hover:text-danger","aria-label":`Remove ${$.queueName}`,onClick:()=>T($),children:t.jsx(vn,{})})]},`${$.connectionId}/${$.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(r3,{open:!0,onClose:()=>g(null),folder:b,allFolders:y}),n&&t.jsx(jj,{open:f==="add",onClose:()=>g(null),initial:b.queues,saving:h.isPending,onSave:$=>O($,"Folder updated"),title:`Add queues to ${b.name}`}),n&&t.jsx(s3,{open:f==="import",onClose:()=>g(null),existing:b.queues,saving:h.isPending,onImport:$=>O($,`Imported into ${b.name}`)}),f==="alert"&&r("alerts")&&t.jsx(ld,{open:!0,onClose:()=>g(null),alert:null,initialScope:{type:"folder",folderId:b.id}})]})}function l3({entry:e,onRemove:n,removing:r}){return t.jsxs("div",{className:"group/card relative",children:[t.jsx(ad,{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 Hf={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 o3(){const{has:e}=wt();return e("users")?t.jsx(b0,{role:"admin",children:t.jsx(c3,{})}):t.jsx(Ha,{feature:"users"})}function c3(){const{user:e}=mt(),n=I2(),r=z2(),[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(ON,{}),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(Vt,{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(Xt,{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":Hf[p.role],block:!0,children:t.jsx(ut,{"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:zu.map(C=>({value:C,label:C}))})})}),t.jsx(xe,{muted:!0,children:t.jsx(Xt,{value:p.createdAt})}),t.jsx(xe,{muted:!0,children:t.jsx(Xt,{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(zN,{}),"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(AN,{})})})})]},p.id)})]})]})}),t.jsx("div",{className:"mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3",children:zu.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:Hf[p]})]},p))}),t.jsx(u3,{open:i,onClose:()=>o(!1)}),t.jsx(Bt,{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 qv(){const e="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789",n=new Uint8Array(16);return crypto.getRandomValues(n),Array.from(n,r=>e[r%e.length]).join("")}function u3({open:e,onClose:n}){const r=$2(),{has:i}=wt(),o=i("sso"),[c,d]=w.useState({name:"",email:"",role:"viewer",password:qv()}),[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=yk.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(jn,{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(Me,{label:"Name",autoFocus:!0,value:c.name,onChange:v("name"),error:g.name}),t.jsx(Me,{label:"Email",type:"email",value:c.email,onChange:v("email"),error:g.email}),t.jsx(ut,{label:"Role",value:c.role,onChange:v("role"),options:zu.map(S=>({value:S,label:S})),hint:Hf[c.role]}),o&&t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx(Xi,{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(Me,{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:qv()})),children:t.jsx(cm,{})})]})]})})}const d3=50,h3=new Set(zk);function f3(){const{has:e}=wt();return e("audit")?t.jsx(b0,{role:"admin",children:t.jsx(p3,{})}):t.jsx(Ha,{feature:"audit"})}function m3(){const[e,n]=tl();return[w.useMemo(()=>{const c=e.get("action"),d=e.get("result");return{actorId:e.get("actorId")||void 0,action:c&&pm.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 Iv=(e,n)=>e?new Date(`${e}T${n?"23:59:59.999":"00:00:00.000"}Z`).toISOString():void 0,$v=e=>e?e.slice(0,10):"";function p3(){var v;const[e,n,r]=m3(),i=xs(),o=A2(),c=O2(e,d3),[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:L2(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(vN,{"aria-hidden":!0}),"Export CSV"]})]})}),t.jsxs("div",{className:"card mb-3 flex flex-wrap items-end gap-2 p-3",children:[t.jsx(ut,{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(ut,{label:"Action",className:"!h-7 w-52 text-xs",value:e.action??"",onChange:j=>n({action:j.target.value}),options:[{value:"",label:"Any action"},...pm.map(j=>({value:j,label:`${xm[j]} (${j})`}))]}),t.jsx(ut,{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(Me,{label:"Queue",className:"!h-7 w-40 text-xs",placeholder:"exact name",value:e.queueName??"",onChange:j=>n({queueName:j.target.value})}),t.jsx(ut,{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(Me,{label:"From",type:"date",className:"!h-7 w-36 text-xs",value:$v(e.from),onChange:j=>n({from:Iv(j.target.value,!1)})}),t.jsx(Me,{label:"To",type:"date",className:"!h-7 w-36 text-xs",value:$v(e.to),onChange:j=>n({to:Iv(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(Vt,{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(on,{compact:!0,icon:t.jsx(Qo,{}),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(x3,{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 x3({entry:e,open:n,onToggle:r,connectionStillExists:i}){var h;const o=h3.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(Xt,{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(um,{className:"size-3.5 shrink-0 text-warning","aria-label":"High-risk action"}),t.jsx("span",{className:F(o&&"font-medium"),children:xm[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(g3,{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(mj,{value:e.detail,defaultExpandDepth:3}):t.jsx("span",{className:"text-fg-subtle",children:"no parameters recorded"})})]})})})]})}function g3({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:ce.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:ce.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:ce.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 v3(){const{has:e}=wt();return e("alerts")?t.jsx(y3,{}):t.jsx(j3,{})}function y3(){const r=(ym().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:ce.alerts,className:"inline-flex text-xs text-accent hover:underline",children:"Manage rules →"})]})}function j3(){const{isAdmin:e}=mt(),n=I0(),r=C2(),[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(Vt,{});const f=Pk.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:ce.alerts,className:"text-accent hover:underline",children:"See Alerts"})]}),t.jsx(Me,{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(Me,{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)??Au.waitingAbove)),d(String((h==null?void 0:h.failedAbove)??Au.failedAbove))},children:"Cancel"})]}):t.jsx("p",{className:"text-xs text-fg-subtle",children:"Only an administrator can change these."})]})}const vu={host:"localhost",port:"6379",username:"",password:"",db:"0",tls:!1};function b3(e){try{const n=new URL(e);if(n.protocol!=="redis:"&&n.protocol!=="rediss:")return{...vu};const r=Ov(n.password);return{host:n.hostname||vu.host,port:n.port||(n.protocol==="rediss:"?"6380":"6379"),username:Ov(n.username),password:r==="****"?"":r,db:n.pathname.replace(/^\//,"")||"0",tls:n.protocol==="rediss:"}}catch{return{...vu}}}function zv(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 w3(e,n){return e.host!==n.host||e.port!==n.port||e.username!==n.username||e.db!==n.db||e.tls!==n.tls}function Ov(e){try{return decodeURIComponent(e)}catch{return e}}function N3(){var v;const{isAdmin:e}=mt(),{demo:n}=wt(),r=xs(),i=w2(),[o,c]=tl(),[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(Vt,{})}),r.data&&p.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:7,children:t.jsx(on,{compact:!0,icon:t.jsx(Ba,{}),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:ce.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(td,{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(Xt,{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(Do,{})}),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(k3,{open:!0,onClose:()=>h(null),connection:d.connection},((v=d.connection)==null?void 0:v.id)??"new"),t.jsx(Bt,{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 k3({open:e,onClose:n,connection:r}){const i=j2(),o=b2(),c=N2(),[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?b3(r.url):vu,[b,k]=w.useState(y),C=(q,B)=>{h(ue=>({...ue,[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===pu[B.kind]||!B.prefix?pu[q]:B.prefix,cluster:q==="postgres"?!1:B.cluster})),g({}),v(null)},T=(q,B)=>{k(ue=>({...ue,[q]:B})),v(null)},M=()=>j==="url"||z?d.url.trim():r&&!b.password&&!w3(b,y)?"":zv(b),E=()=>{const q=M(),B={name:d.name.trim(),kind:d.kind,url:q,prefix:d.prefix.trim()||pu[d.kind],cluster:d.cluster,queueFilter:d.queueFilter.trim()||null};r&&!B.url&&(B.url=r.url);const ue=wk.safeParse(B);if(!ue.success){const oe={};for(const Ne of ue.error.issues)oe[String(Ne.path[0])]=Ne.message;return g(oe),null}return g({}),ue.data},$=()=>{const q=E();if(!q)return;const B=ue=>{X.success(`Connection "${ue.name}" saved`),n()};if(r){const ue={name:q.name,prefix:q.prefix,cluster:q.cluster,queueFilter:q.queueFilter};M()&&(ue.url=q.url),o.mutate({id:r.id,input:ue},{onSuccess:B,onError:oe=>X.error(ve(oe))})}else i.mutate(q,{onSuccess:B,onError:ue=>X.error(ve(ue))})},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(jn,{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(Vy,{}),onClick:Q,loading:c.isPending,children:"Test connection"}),t.jsx(V,{variant:"primary",size:"sm",onClick:$,loading:H,children:r?"Save":"Add connection"})]}),children:t.jsxs("form",{className:"space-y-3",onSubmit:q=>{q.preventDefault(),$()},children:[t.jsx(Me,{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(Me,{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(Me,{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(Me,{label:"Host",mono:!0,value:b.host,onChange:q=>T("host",q.target.value),placeholder:"cache.internal",autoComplete:"off",spellCheck:!1}),t.jsx(Me,{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(Me,{label:"Username (optional)",mono:!0,value:b.username,onChange:q=>T("username",q.target.value),placeholder:"default",autoComplete:"off",spellCheck:!1}),t.jsx(Me,{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(Me,{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(Xi,{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()?zv({...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(Me,{label:"Schema",mono:!0,value:d.prefix,onChange:q=>C("prefix",q.target.value),error:f.prefix,hint:"BullMQ default is bullmq"}):t.jsx(Me,{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(Me,{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(Cm,{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(lm,{className:"mt-px size-4 shrink-0"}):t.jsx(Ay,{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 Av={active:{label:"active",variant:"success"},grace:{label:"grace period",variant:"warning"},expired:{label:"expired",variant:"danger"},invalid:{label:"invalid",variant:"danger"}};function S3(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 C3(){const{isAdmin:e,setEdition:n}=mt(),{edition:r,isPro:i,demo:o,pricing:c,checkoutUrl:d,has:h}=wt(),f=D2(),g=Q2(),p=U2(),[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:$=>{n($),j(""),X.success("Pro unlocked",$.license?`Licensed to ${$.license.licensee}`:void 0)},onError:$=>{sr($)&&($.body.error==="invalid_license"||$.body.error==="license_already_activated"||$.body.error==="license_server_unavailable")?y($.body.message||"This key is not valid"):y(ve($))}})},z=()=>p.mutate(void 0,{onSuccess:E=>{var Q,H,q,B;n(E);const $=(Q=E.license)==null?void 0:Q.status;$==="active"?X.success("License verified",`Lease renewed until ${gn((H=E.license)==null?void 0:H.leaseExpiresAt)}`):$==="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?S3(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(Zu,{className:"size-5 text-pro"}):t.jsx(xo,{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(bm,{})]}),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(cm,{}),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":Lu(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?Lu(O.expiresAt):M?"Renews automatically":"Never"," ",t.jsx(be,{variant:Av[O.status].variant,size:"xs",className:"ml-1",children:Av[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:mm.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(xo,{className:"mt-px size-4 shrink-0 text-fg-subtle"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-fg",children:jo[E].title}),t.jsx("p",{className:"text-fg-muted",children:jo[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(sl,{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(Ji,{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(Bt,{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 _3(){const e=a2(),{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(wm,{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(Su,{})})]}),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?wo(e.data.uptime):e.isError?"unknown":t.jsx(Su,{})})]}),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 P3={oidc:"OIDC",saml:"SAML 2.0"};function E3(){const{has:e}=wt();return e("sso")?t.jsx(R3,{}):t.jsx(Ha,{feature:"sso"})}function yu({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(Fy,{className:"size-3"})})]})}function R3(){var k;const e=V2(),n=A0(),r=L0(),i=K2(),o=W2(),c=Z2(),[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(Vt,{})}):j.length===0?t.jsxs("div",{className:"card p-6 text-center",children:[t.jsx(Zu,{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:P3[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(Xi,{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(Vy,{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(yu,{label:"Redirect URI",value:C.callbackUrl}):t.jsxs(t.Fragment,{children:[t.jsx(yu,{label:"ACS URL",value:C.callbackUrl}),C.entityId&&t.jsx(yu,{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(Xi,{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(M3,{}),d&&t.jsx(T3,{onClose:()=>h(!1)}),t.jsx(Bt,{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 M3(){var p,v;const e=A0(),n=L0(),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=u0.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(Xi,{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(Me,{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 T3({onClose:e}){const n=H2(),[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,$]=w.useState(null),Q=()=>{var B;$(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=jk.safeParse(H);if(!q.success){$(((B=q.error.issues[0])==null?void 0:B.message)??"Check the fields above");return}n.mutate(q.data,{onSuccess:ue=>{X.success(`Added ${ue.name}. Enter the redirect URI at your IdP, then use Test.`),e()},onError:ue=>$(ve(ue))})};return t.jsx(jn,{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(ut,{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(Me,{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(Me,{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(Me,{label:"Client ID",value:f,onChange:H=>g(H.target.value),required:!0}),t.jsx(Me,{label:"Client secret",type:"password",hint:"Stored encrypted and never shown again.",value:p,onChange:H=>v(H.target.value),required:!0}),t.jsx(Me,{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(Me,{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(Me,{label:"IdP entity ID",placeholder:"https://idp.example.com/metadata",value:k,onChange:H=>C(H.target.value),required:!0}),t.jsx(Ji,{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(Me,{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 Lv=[{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 q3(){const{has:e}=wt();return e("mcp")?t.jsx(I3,{}):t.jsx(Ha,{feature:"mcp"})}function I3(){var S;const{isAdmin:e}=mt(),n=G2(),r=J2(),[i,o]=w.useState(!1),c=X2(e&&i),d=Y2(),[h,f]=w.useState(null);if(n.isLoading||!n.data)return t.jsx("div",{className:"flex justify-center py-8",children:t.jsx(Vt,{})});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(ut,{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:Lv.map(y=>({value:y.value,label:y.label})),hint:e?(S=Lv.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(yu,{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(Vt,{})}):j.length===0?t.jsxs("div",{className:"card p-6 text-center",children:[t.jsx(zy,{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(dm,{className:"size-3.5"}),onClick:()=>f(y),children:"Disconnect"})]},y.id))})]}),t.jsx(Bt,{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 $3=["connections","attention","sso","mcp","license","about"];function z3(){const{tab:e}=Fn(),n=cn();if(!e||!$3.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(Fm,{"aria-label":"Settings sections",className:"mb-5",value:r,onChange:i=>n(`/settings/${i}`),items:[{value:"connections",label:"Connections",icon:t.jsx(Ba,{className:"size-3.5"})},{value:"attention",label:"Attention",icon:t.jsx(ts,{className:"size-3.5"})},{value:"sso",label:"SSO",icon:t.jsx(Zu,{className:"size-3.5"})},{value:"mcp",label:"MCP",icon:t.jsx(zy,{className:"size-3.5"})},{value:"license",label:"License",icon:t.jsx(sl,{className:"size-3.5"})},{value:"about",label:"About",icon:t.jsx(Va,{className:"size-3.5"})}]}),r==="connections"&&t.jsx(N3,{}),r==="attention"&&t.jsx(v3,{}),r==="sso"&&t.jsx(E3,{}),r==="mcp"&&t.jsx(q3,{}),r==="license"&&t.jsx(C3,{}),r==="about"&&t.jsx(_3,{})]})}const O3=[{label:"Any time",ms:0},{label:"Next hour",ms:36e5},{label:"Next 24 hours",ms:864e5},{label:"Next 7 days",ms:6048e5}];function A3(){var r;const e=xs();if(e.isLoading)return t.jsx(bt,{children:t.jsx(Vt,{label:"Loading…"})});const n=(r=e.data)==null?void 0:r[0];return n?t.jsx(Vr,{to:ce.schedulers(n.id),replace:!0}):t.jsx(bt,{children:t.jsx(on,{icon:t.jsx(Ao,{}),title:"No connections",description:"Add a Redis connection first; schedulers are listed per connection."})})}function L3(){var p;const{connectionId:e}=Fn(),n=xs(),r=cn(),[i,o]=w.useState(""),[c,d]=w.useState(0),h=v2(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(ut,{"aria-label":"Connection",value:e??"",onChange:v=>r(ce.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(Me,{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(ut,{"aria-label":"Next run within",value:String(c),onChange:v=>d(Number(v.target.value)),children:O3.map(v=>t.jsx("option",{value:v.ms,children:v.label},v.ms))}),h.isFetching&&t.jsx(Vt,{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(Vt,{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(D3,{filtered:!!i.trim()||c>0,total:g.total})}),f.map(v=>t.jsx(F3,{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 F3({s:e,connectionId:n}){const r=e.next!=null&&e.next<=Date.now();return t.jsxs(ol,{children:[t.jsx(xe,{children:t.jsx(Ee,{to:ce.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:uj(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(Ly,{className:"size-3","aria-hidden":!0}),Kr(e.next)]})})]})}function D3({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(Ao,{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(Hy,{className:"size-3","aria-hidden":!0}),"Create one with ",t.jsx("span",{className:"font-mono",children:"queue.upsertJobScheduler()"}),"."]})]})}function U3(){return t.jsx(bt,{children:t.jsx(on,{icon:t.jsx(pN,{}),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 Q3=w.lazy(()=>Qu(()=>import("./FlowsPage-BVM22MG9.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.FlowsPage}))),B3=w.lazy(()=>Qu(()=>import("./FlowsPage-BVM22MG9.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.FlowsIndexPage}))),V3=w.lazy(()=>Qu(()=>import("./McpConsentPage-o4BOZhJd.js"),[]).then(e=>({default:e.McpConsentPage}))),H3=w.lazy(()=>Qu(()=>import("./JobTreePage-BZbwFo2w.js"),__vite__mapDeps([3,1,2])).then(e=>({default:e.JobTreePage})));function mu({children:e}){return t.jsx(w.Suspense,{fallback:t.jsx(rl,{}),children:e})}const K3=new Yw({defaultOptions:{queries:{retry:(e,n)=>sr(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 W3(){return t.jsx(Sw,{client:K3,children:t.jsx(yw,{children:t.jsxs(Hk,{children:[t.jsxs(uw,{children:[t.jsx(ct,{path:"/login",element:t.jsx(rv,{children:t.jsx(CS,{})})}),t.jsx(ct,{path:"/setup",element:t.jsx(rv,{children:t.jsx(_S,{})})}),t.jsx(ct,{path:"/oauth/consent",element:t.jsx(mu,{children:t.jsx(V3,{})})}),t.jsx(ct,{element:t.jsx(Kk,{}),children:t.jsxs(ct,{element:t.jsx(SS,{}),children:[t.jsx(ct,{index:!0,element:t.jsx(iC,{})}),t.jsx(ct,{path:"c/:connectionId",element:t.jsx(oC,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue",element:t.jsx(nf,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/metrics",element:t.jsx(nf,{view:"metrics"})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/schedulers",element:t.jsx(nf,{view:"schedulers"})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/groups",element:t.jsx(U_,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/groups/:groupId",element:t.jsx(K_,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/j/:jobId",element:t.jsx($_,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/j/:jobId/tree",element:t.jsx(mu,{children:t.jsx(H3,{})})}),t.jsx(ct,{path:"health",element:t.jsx(gC,{})}),t.jsx(ct,{path:"schedulers",element:t.jsx(A3,{})}),t.jsx(ct,{path:"schedulers/:connectionId",element:t.jsx(L3,{})}),t.jsx(ct,{path:"folders",element:t.jsx(W_,{})}),t.jsx(ct,{path:"folders/:folderId",element:t.jsx(a3,{})}),t.jsx(ct,{path:"alerts",element:t.jsx(b_,{})}),t.jsx(ct,{path:"users",element:t.jsx(o3,{})}),t.jsx(ct,{path:"audit",element:t.jsx(f3,{})}),t.jsxs(t.Fragment,{children:[t.jsx(ct,{path:"flows",element:t.jsx(mu,{children:t.jsx(B3,{})})}),t.jsx(ct,{path:"flows/:connectionId",element:t.jsx(mu,{children:t.jsx(Q3,{})})})]}),t.jsx(ct,{path:"settings",element:t.jsx(Vr,{to:"/settings/connections",replace:!0})}),t.jsx(ct,{path:"settings/:tab",element:t.jsx(z3,{})}),t.jsx(ct,{path:"*",element:t.jsx(U3,{})})]})})]}),t.jsx(Xk,{}),t.jsx(Vk,{})]})})})}yb.createRoot(document.getElementById("root")).render(t.jsx(w.StrictMode,{children:t.jsx(W3,{})}));export{K0 as A,V as B,ts as C,jn as D,on as E,t5 as F,n5 as G,zy as H,Va as I,J3 as J,gs as K,Ha as L,wN as M,Vr as N,rd as O,bt as P,Qy as Q,cm as R,Vt as S,Un as T,AS as U,Kr as V,LN as W,Wf as X,cb as Y,fb as Z,xs as a,Fn as b,re as c,cn as d,mt as e,w as f,X3 as g,Y3 as h,e5 as i,t as j,ut as k,K as l,es as m,ve as n,be as o,Ee as p,Br as q,ce as r,lt as s,X as t,wt as u,F as v,Me as w,ft as x,tl as y,Ln as z};