diff --git "a/src/flow/ui/ui/assets/index-D0u7uw0T.js" "b/src/flow/ui/ui/assets/index-D0u7uw0T.js" new file mode 100644--- /dev/null +++ "b/src/flow/ui/ui/assets/index-D0u7uw0T.js" @@ -0,0 +1,184 @@ +var Ou=e=>{throw TypeError(e)};var Rl=(e,t,n)=>t.has(e)||Ou("Cannot "+n);var y=(e,t,n)=>(Rl(e,t,"read from private field"),n?n.call(e):t.get(e)),M=(e,t,n)=>t.has(e)?Ou("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),T=(e,t,n,r)=>(Rl(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),D=(e,t,n)=>(Rl(e,t,"access private method"),n);var ti=(e,t,n,r)=>({set _(s){T(e,t,s,n)},get _(){return y(e,t,r)}});function jp(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function Pd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bd={exports:{}},dl={},Td={exports:{}},A={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var qs=Symbol.for("react.element"),kp=Symbol.for("react.portal"),Np=Symbol.for("react.fragment"),Cp=Symbol.for("react.strict_mode"),_p=Symbol.for("react.profiler"),Ep=Symbol.for("react.provider"),Pp=Symbol.for("react.context"),bp=Symbol.for("react.forward_ref"),Tp=Symbol.for("react.suspense"),Op=Symbol.for("react.memo"),Rp=Symbol.for("react.lazy"),Ru=Symbol.iterator;function Lp(e){return e===null||typeof e!="object"?null:(e=Ru&&e[Ru]||e["@@iterator"],typeof e=="function"?e:null)}var Od={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Rd=Object.assign,Ld={};function Vr(e,t,n){this.props=e,this.context=t,this.refs=Ld,this.updater=n||Od}Vr.prototype.isReactComponent={};Vr.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Vr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Id(){}Id.prototype=Vr.prototype;function ko(e,t,n){this.props=e,this.context=t,this.refs=Ld,this.updater=n||Od}var No=ko.prototype=new Id;No.constructor=ko;Rd(No,Vr.prototype);No.isPureReactComponent=!0;var Lu=Array.isArray,Md=Object.prototype.hasOwnProperty,Co={current:null},zd={key:!0,ref:!0,__self:!0,__source:!0};function Fd(e,t,n){var r,s={},i=null,l=null;if(t!=null)for(r in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(i=""+t.key),t)Md.call(t,r)&&!zd.hasOwnProperty(r)&&(s[r]=t[r]);var o=arguments.length-2;if(o===1)s.children=n;else if(1>>1,b=O[Y];if(0>>1;Ys(Yr,F))Ues(Qt,Yr)?(O[Y]=Qt,O[Ue]=F,Y=Ue):(O[Y]=Yr,O[ye]=F,Y=ye);else if(Ues(Qt,F))O[Y]=Qt,O[Ue]=F,Y=Ue;else break e}}return z}function s(O,z){var F=O.sortIndex-z.sortIndex;return F!==0?F:O.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,o=l.now();e.unstable_now=function(){return l.now()-o}}var u=[],c=[],p=1,h=null,f=3,x=!1,S=!1,m=!1,j=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(O){for(var z=n(c);z!==null;){if(z.callback===null)r(c);else if(z.startTime<=O)r(c),z.sortIndex=z.expirationTime,t(u,z);else break;z=n(c)}}function w(O){if(m=!1,g(O),!S)if(n(u)!==null)S=!0,_n(C);else{var z=n(c);z!==null&&er(w,z.startTime-O)}}function C(O,z){S=!1,m&&(m=!1,v(k),k=-1),x=!0;var F=f;try{for(g(z),h=n(u);h!==null&&(!(h.expirationTime>z)||O&&!q());){var Y=h.callback;if(typeof Y=="function"){h.callback=null,f=h.priorityLevel;var b=Y(h.expirationTime<=z);z=e.unstable_now(),typeof b=="function"?h.callback=b:h===n(u)&&r(u),g(z)}else r(u);h=n(u)}if(h!==null)var B=!0;else{var ye=n(c);ye!==null&&er(w,ye.startTime-z),B=!1}return B}finally{h=null,f=F,x=!1}}var _=!1,P=null,k=-1,L=5,I=-1;function q(){return!(e.unstable_now()-IO||125Y?(O.sortIndex=F,t(c,O),n(u)===null&&O===n(c)&&(m?(v(k),k=-1):m=!0,er(w,F-Y))):(O.sortIndex=b,t(u,O),S||x||(S=!0,_n(C))),O},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(O){var z=f;return function(){var F=f;f=z;try{return O.apply(this,arguments)}finally{f=F}}}})(Qd);$d.exports=Qd;var Hp=$d.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Wp=N,Ve=Hp;function E(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ua=Object.prototype.hasOwnProperty,Kp=/^[: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]*$/,Mu={},zu={};function qp(e){return ua.call(zu,e)?!0:ua.call(Mu,e)?!1:Kp.test(e)?zu[e]=!0:(Mu[e]=!0,!1)}function Jp(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Gp(e,t,n,r){if(t===null||typeof t>"u"||Jp(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Te(e,t,n,r,s,i,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=l}var ge={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ge[e]=new Te(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ge[t]=new Te(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ge[e]=new Te(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ge[e]=new Te(e,2,!1,e,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(e){ge[e]=new Te(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ge[e]=new Te(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ge[e]=new Te(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ge[e]=new Te(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ge[e]=new Te(e,5,!1,e.toLowerCase(),null,!1,!1)});var Po=/[\-:]([a-z])/g;function bo(e){return e[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(e){var t=e.replace(Po,bo);ge[t]=new Te(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Po,bo);ge[t]=new Te(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Po,bo);ge[t]=new Te(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ge[e]=new Te(e,1,!1,e.toLowerCase(),null,!1,!1)});ge.xlinkHref=new Te("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ge[e]=new Te(e,1,!1,e.toLowerCase(),null,!0,!0)});function To(e,t,n,r){var s=ge.hasOwnProperty(t)?ge[t]:null;(s!==null?s.type!==0:r||!(2o||s[l]!==i[o]){var u=` +`+s[l].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=l&&0<=o);break}}}finally{Ml=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?as(e):""}function Yp(e){switch(e.tag){case 5:return as(e.type);case 16:return as("Lazy");case 13:return as("Suspense");case 19:return as("SuspenseList");case 0:case 2:case 15:return e=zl(e.type,!1),e;case 11:return e=zl(e.type.render,!1),e;case 1:return e=zl(e.type,!0),e;default:return""}}function ha(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case sr:return"Fragment";case rr:return"Portal";case ca:return"Profiler";case Oo:return"StrictMode";case da:return"Suspense";case fa:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Hd:return(e.displayName||"Context")+".Consumer";case Vd:return(e._context.displayName||"Context")+".Provider";case Ro:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Lo:return t=e.displayName||null,t!==null?t:ha(e.type)||"Memo";case Wt:t=e._payload,e=e._init;try{return ha(e(t))}catch{}}return null}function Xp(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ha(t);case 8:return t===Oo?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function wn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Kd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Zp(e){var t=Kd(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(l){r=""+l,i.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(l){r=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function si(e){e._valueTracker||(e._valueTracker=Zp(e))}function qd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Kd(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function zi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function pa(e,t){var n=t.checked;return te({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Du(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=wn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Jd(e,t){t=t.checked,t!=null&&To(e,"checked",t,!1)}function ma(e,t){Jd(e,t);var n=wn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?va(e,t.type,n):t.hasOwnProperty("defaultValue")&&va(e,t.type,wn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Au(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function va(e,t,n){(t!=="number"||zi(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var os=Array.isArray;function vr(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=ii.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function js(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var fs={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},em=["Webkit","ms","Moz","O"];Object.keys(fs).forEach(function(e){em.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fs[t]=fs[e]})});function Zd(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||fs.hasOwnProperty(e)&&fs[e]?(""+t).trim():t+"px"}function ef(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Zd(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var tm=te({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 xa(e,t){if(t){if(tm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(E(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(E(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(E(61))}if(t.style!=null&&typeof t.style!="object")throw Error(E(62))}}function wa(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Sa=null;function Io(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ja=null,gr=null,yr=null;function Qu(e){if(e=Ys(e)){if(typeof ja!="function")throw Error(E(280));var t=e.stateNode;t&&(t=vl(t),ja(e.stateNode,e.type,t))}}function tf(e){gr?yr?yr.push(e):yr=[e]:gr=e}function nf(){if(gr){var e=gr,t=yr;if(yr=gr=null,Qu(e),t)for(e=0;e>>=0,e===0?32:31-(fm(e)/hm|0)|0}var li=64,ai=4194304;function us(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ui(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,l=n&268435455;if(l!==0){var o=l&~s;o!==0?r=us(o):(i&=l,i!==0&&(r=us(i)))}else l=n&~s,l!==0?r=us(l):i!==0&&(r=us(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Js(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ot(t),e[t]=n}function gm(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=ps),Yu=" ",Xu=!1;function kf(e,t){switch(e){case"keyup":return Hm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ir=!1;function Km(e,t){switch(e){case"compositionend":return Nf(t);case"keypress":return t.which!==32?null:(Xu=!0,Yu);case"textInput":return e=t.data,e===Yu&&Xu?null:e;default:return null}}function qm(e,t){if(ir)return e==="compositionend"||!Qo&&kf(e,t)?(e=Sf(),Ni=Ao=ln=null,ir=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=nc(n)}}function Pf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Pf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function bf(){for(var e=window,t=zi();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=zi(e.document)}return t}function Bo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function rv(e){var t=bf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Pf(n.ownerDocument.documentElement,n)){if(r!==null&&Bo(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=rc(n,i);var l=rc(n,r);s&&l&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,lr=null,Pa=null,vs=null,ba=!1;function sc(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ba||lr==null||lr!==zi(r)||(r=lr,"selectionStart"in r&&Bo(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),vs&&Ps(vs,r)||(vs=r,r=Bi(Pa,"onSelect"),0ur||(e.current=Ma[ur],Ma[ur]=null,ur--)}function K(e,t){ur++,Ma[ur]=e.current,e.current=t}var Sn={},Ne=kn(Sn),ze=kn(!1),Vn=Sn;function zr(e,t){var n=e.type.contextTypes;if(!n)return Sn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Fe(e){return e=e.childContextTypes,e!=null}function Hi(){G(ze),G(Ne)}function dc(e,t,n){if(Ne.current!==Sn)throw Error(E(168));K(Ne,t),K(ze,n)}function Df(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(E(108,Xp(e)||"Unknown",s));return te({},n,r)}function Wi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Sn,Vn=Ne.current,K(Ne,e),K(ze,ze.current),!0}function fc(e,t,n){var r=e.stateNode;if(!r)throw Error(E(169));n?(e=Df(e,t,Vn),r.__reactInternalMemoizedMergedChildContext=e,G(ze),G(Ne),K(Ne,e)):G(ze),K(ze,n)}var Ct=null,gl=!1,Gl=!1;function Af(e){Ct===null?Ct=[e]:Ct.push(e)}function mv(e){gl=!0,Af(e)}function Nn(){if(!Gl&&Ct!==null){Gl=!0;var e=0,t=W;try{var n=Ct;for(W=1;e>=l,s-=l,Tt=1<<32-ot(t)+s|n<k?(L=P,P=null):L=P.sibling;var I=f(v,P,g[k],w);if(I===null){P===null&&(P=L);break}e&&P&&I.alternate===null&&t(v,P),d=i(I,d,k),_===null?C=I:_.sibling=I,_=I,P=L}if(k===g.length)return n(v,P),X&&En(v,k),C;if(P===null){for(;kk?(L=P,P=null):L=P.sibling;var q=f(v,P,I.value,w);if(q===null){P===null&&(P=L);break}e&&P&&q.alternate===null&&t(v,P),d=i(q,d,k),_===null?C=q:_.sibling=q,_=q,P=L}if(I.done)return n(v,P),X&&En(v,k),C;if(P===null){for(;!I.done;k++,I=g.next())I=h(v,I.value,w),I!==null&&(d=i(I,d,k),_===null?C=I:_.sibling=I,_=I);return X&&En(v,k),C}for(P=r(v,P);!I.done;k++,I=g.next())I=x(P,v,k,I.value,w),I!==null&&(e&&I.alternate!==null&&P.delete(I.key===null?k:I.key),d=i(I,d,k),_===null?C=I:_.sibling=I,_=I);return e&&P.forEach(function(Ae){return t(v,Ae)}),X&&En(v,k),C}function j(v,d,g,w){if(typeof g=="object"&&g!==null&&g.type===sr&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case ri:e:{for(var C=g.key,_=d;_!==null;){if(_.key===C){if(C=g.type,C===sr){if(_.tag===7){n(v,_.sibling),d=s(_,g.props.children),d.return=v,v=d;break e}}else if(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Wt&&mc(C)===_.type){n(v,_.sibling),d=s(_,g.props),d.ref=rs(v,_,g),d.return=v,v=d;break e}n(v,_);break}else t(v,_);_=_.sibling}g.type===sr?(d=Bn(g.props.children,v.mode,w,g.key),d.return=v,v=d):(w=Ri(g.type,g.key,g.props,null,v.mode,w),w.ref=rs(v,d,g),w.return=v,v=w)}return l(v);case rr:e:{for(_=g.key;d!==null;){if(d.key===_)if(d.tag===4&&d.stateNode.containerInfo===g.containerInfo&&d.stateNode.implementation===g.implementation){n(v,d.sibling),d=s(d,g.children||[]),d.return=v,v=d;break e}else{n(v,d);break}else t(v,d);d=d.sibling}d=sa(g,v.mode,w),d.return=v,v=d}return l(v);case Wt:return _=g._init,j(v,d,_(g._payload),w)}if(os(g))return S(v,d,g,w);if(Xr(g))return m(v,d,g,w);pi(v,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,d!==null&&d.tag===6?(n(v,d.sibling),d=s(d,g),d.return=v,v=d):(n(v,d),d=ra(g,v.mode,w),d.return=v,v=d),l(v)):n(v,d)}return j}var Dr=Bf(!0),Vf=Bf(!1),Ji=kn(null),Gi=null,fr=null,Ko=null;function qo(){Ko=fr=Gi=null}function Jo(e){var t=Ji.current;G(Ji),e._currentValue=t}function Da(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function wr(e,t){Gi=e,Ko=fr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Me=!0),e.firstContext=null)}function et(e){var t=e._currentValue;if(Ko!==e)if(e={context:e,memoizedValue:t,next:null},fr===null){if(Gi===null)throw Error(E(308));fr=e,Gi.dependencies={lanes:0,firstContext:e}}else fr=fr.next=e;return t}var Tn=null;function Go(e){Tn===null?Tn=[e]:Tn.push(e)}function Hf(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Go(t)):(n.next=s.next,s.next=n),t.interleaved=n,Dt(e,r)}function Dt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Kt=!1;function Yo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Wf(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Rt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function pn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Dt(e,n)}return s=r.interleaved,s===null?(t.next=t,Go(r)):(t.next=s.next,s.next=t),r.interleaved=t,Dt(e,n)}function _i(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,zo(e,n)}}function vc(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=l:i=i.next=l,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Yi(e,t,n,r){var s=e.updateQueue;Kt=!1;var i=s.firstBaseUpdate,l=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var u=o,c=u.next;u.next=null,l===null?i=c:l.next=c,l=u;var p=e.alternate;p!==null&&(p=p.updateQueue,o=p.lastBaseUpdate,o!==l&&(o===null?p.firstBaseUpdate=c:o.next=c,p.lastBaseUpdate=u))}if(i!==null){var h=s.baseState;l=0,p=c=u=null,o=i;do{var f=o.lane,x=o.eventTime;if((r&f)===f){p!==null&&(p=p.next={eventTime:x,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var S=e,m=o;switch(f=t,x=n,m.tag){case 1:if(S=m.payload,typeof S=="function"){h=S.call(x,h,f);break e}h=S;break e;case 3:S.flags=S.flags&-65537|128;case 0:if(S=m.payload,f=typeof S=="function"?S.call(x,h,f):S,f==null)break e;h=te({},h,f);break e;case 2:Kt=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[o]:f.push(o))}else x={eventTime:x,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},p===null?(c=p=x,u=h):p=p.next=x,l|=f;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;f=o,o=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(p===null&&(u=h),s.baseState=u,s.firstBaseUpdate=c,s.lastBaseUpdate=p,t=s.shared.interleaved,t!==null){s=t;do l|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Kn|=l,e.lanes=l,e.memoizedState=h}}function gc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Xl.transition;Xl.transition={};try{e(!1),t()}finally{W=n,Xl.transition=r}}function uh(){return tt().memoizedState}function xv(e,t,n){var r=vn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ch(e))dh(t,n);else if(n=Hf(e,t,n,r),n!==null){var s=Pe();ut(n,e,r,s),fh(n,t,r)}}function wv(e,t,n){var r=vn(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ch(e))dh(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var l=t.lastRenderedState,o=i(l,n);if(s.hasEagerState=!0,s.eagerState=o,ct(o,l)){var u=t.interleaved;u===null?(s.next=s,Go(t)):(s.next=u.next,u.next=s),t.interleaved=s;return}}catch{}finally{}n=Hf(e,t,s,r),n!==null&&(s=Pe(),ut(n,e,r,s),fh(n,t,r))}}function ch(e){var t=e.alternate;return e===ee||t!==null&&t===ee}function dh(e,t){gs=Zi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function fh(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,zo(e,n)}}var el={readContext:et,useCallback:xe,useContext:xe,useEffect:xe,useImperativeHandle:xe,useInsertionEffect:xe,useLayoutEffect:xe,useMemo:xe,useReducer:xe,useRef:xe,useState:xe,useDebugValue:xe,useDeferredValue:xe,useTransition:xe,useMutableSource:xe,useSyncExternalStore:xe,useId:xe,unstable_isNewReconciler:!1},Sv={readContext:et,useCallback:function(e,t){return pt().memoizedState=[e,t===void 0?null:t],e},useContext:et,useEffect:xc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Pi(4194308,4,sh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Pi(4194308,4,e,t)},useInsertionEffect:function(e,t){return Pi(4,2,e,t)},useMemo:function(e,t){var n=pt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=pt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=xv.bind(null,ee,e),[r.memoizedState,e]},useRef:function(e){var t=pt();return e={current:e},t.memoizedState=e},useState:yc,useDebugValue:iu,useDeferredValue:function(e){return pt().memoizedState=e},useTransition:function(){var e=yc(!1),t=e[0];return e=yv.bind(null,e[1]),pt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ee,s=pt();if(X){if(n===void 0)throw Error(E(407));n=n()}else{if(n=t(),he===null)throw Error(E(349));Wn&30||Gf(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,xc(Xf.bind(null,r,i,e),[e]),r.flags|=2048,zs(9,Yf.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=pt(),t=he.identifierPrefix;if(X){var n=Ot,r=Tt;n=(r&~(1<<32-ot(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Is++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=l.createElement(n,{is:r.is}):(e=l.createElement(n),n==="select"&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,n),e[xt]=t,e[Os]=r,jh(e,t,!1,!1),t.stateNode=e;e:{switch(l=wa(n,r),n){case"dialog":J("cancel",e),J("close",e),s=r;break;case"iframe":case"object":case"embed":J("load",e),s=r;break;case"video":case"audio":for(s=0;s$r&&(t.flags|=128,r=!0,ss(i,!1),t.lanes=4194304)}else{if(!r)if(e=Xi(l),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ss(i,!0),i.tail===null&&i.tailMode==="hidden"&&!l.alternate&&!X)return we(t),null}else 2*ie()-i.renderingStartTime>$r&&n!==1073741824&&(t.flags|=128,r=!0,ss(i,!1),t.lanes=4194304);i.isBackwards?(l.sibling=t.child,t.child=l):(n=i.last,n!==null?n.sibling=l:t.child=l,i.last=l)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ie(),t.sibling=null,n=Z.current,K(Z,r?n&1|2:n&1),t):(we(t),null);case 22:case 23:return du(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?$e&1073741824&&(we(t),t.subtreeFlags&6&&(t.flags|=8192)):we(t),null;case 24:return null;case 25:return null}throw Error(E(156,t.tag))}function bv(e,t){switch(Ho(t),t.tag){case 1:return Fe(t.type)&&Hi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ar(),G(ze),G(Ne),eu(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Zo(t),null;case 13:if(G(Z),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(E(340));Fr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return G(Z),null;case 4:return Ar(),null;case 10:return Jo(t.type._context),null;case 22:case 23:return du(),null;case 24:return null;default:return null}}var vi=!1,je=!1,Tv=typeof WeakSet=="function"?WeakSet:Set,R=null;function hr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){re(e,t,r)}else n.current=null}function Ka(e,t,n){try{n()}catch(r){re(e,t,r)}}var Tc=!1;function Ov(e,t){if(Ta=$i,e=bf(),Bo(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var l=0,o=-1,u=-1,c=0,p=0,h=e,f=null;t:for(;;){for(var x;h!==n||s!==0&&h.nodeType!==3||(o=l+s),h!==i||r!==0&&h.nodeType!==3||(u=l+r),h.nodeType===3&&(l+=h.nodeValue.length),(x=h.firstChild)!==null;)f=h,h=x;for(;;){if(h===e)break t;if(f===n&&++c===s&&(o=l),f===i&&++p===r&&(u=l),(x=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=x}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Oa={focusedElem:e,selectionRange:n},$i=!1,R=t;R!==null;)if(t=R,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,R=e;else for(;R!==null;){t=R;try{var S=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(S!==null){var m=S.memoizedProps,j=S.memoizedState,v=t.stateNode,d=v.getSnapshotBeforeUpdate(t.elementType===t.type?m:rt(t.type,m),j);v.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(E(163))}}catch(w){re(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,R=e;break}R=t.return}return S=Tc,Tc=!1,S}function ys(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Ka(t,n,i)}s=s.next}while(s!==r)}}function wl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function qa(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Ch(e){var t=e.alternate;t!==null&&(e.alternate=null,Ch(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[xt],delete t[Os],delete t[Ia],delete t[hv],delete t[pv])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function _h(e){return e.tag===5||e.tag===3||e.tag===4}function Oc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||_h(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ja(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Vi));else if(r!==4&&(e=e.child,e!==null))for(Ja(e,t,n),e=e.sibling;e!==null;)Ja(e,t,n),e=e.sibling}function Ga(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ga(e,t,n),e=e.sibling;e!==null;)Ga(e,t,n),e=e.sibling}var me=null,lt=!1;function Bt(e,t,n){for(n=n.child;n!==null;)Eh(e,t,n),n=n.sibling}function Eh(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount(fl,n)}catch{}switch(n.tag){case 5:je||hr(n,t);case 6:var r=me,s=lt;me=null,Bt(e,t,n),me=r,lt=s,me!==null&&(lt?(e=me,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):me.removeChild(n.stateNode));break;case 18:me!==null&&(lt?(e=me,n=n.stateNode,e.nodeType===8?Jl(e.parentNode,n):e.nodeType===1&&Jl(e,n),_s(e)):Jl(me,n.stateNode));break;case 4:r=me,s=lt,me=n.stateNode.containerInfo,lt=!0,Bt(e,t,n),me=r,lt=s;break;case 0:case 11:case 14:case 15:if(!je&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,l=i.destroy;i=i.tag,l!==void 0&&(i&2||i&4)&&Ka(n,t,l),s=s.next}while(s!==r)}Bt(e,t,n);break;case 1:if(!je&&(hr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){re(n,t,o)}Bt(e,t,n);break;case 21:Bt(e,t,n);break;case 22:n.mode&1?(je=(r=je)||n.memoizedState!==null,Bt(e,t,n),je=r):Bt(e,t,n);break;default:Bt(e,t,n)}}function Rc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Tv),t.forEach(function(r){var s=Uv.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function nt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=l),r&=~i}if(r=s,r=ie()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Lv(r/1960))-r,10e?16:e,an===null)var r=!1;else{if(e=an,an=null,rl=0,$&6)throw Error(E(331));var s=$;for($|=4,R=e.current;R!==null;){var i=R,l=i.child;if(R.flags&16){var o=i.deletions;if(o!==null){for(var u=0;uie()-uu?Qn(e,0):ou|=n),De(e,t)}function Mh(e,t){t===0&&(e.mode&1?(t=ai,ai<<=1,!(ai&130023424)&&(ai=4194304)):t=1);var n=Pe();e=Dt(e,t),e!==null&&(Js(e,t,n),De(e,n))}function Av(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Mh(e,n)}function Uv(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(E(314))}r!==null&&r.delete(t),Mh(e,n)}var zh;zh=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ze.current)Me=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Me=!1,Ev(e,t,n);Me=!!(e.flags&131072)}else Me=!1,X&&t.flags&1048576&&Uf(t,qi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;bi(e,t),e=t.pendingProps;var s=zr(t,Ne.current);wr(t,n),s=nu(null,t,r,e,s,n);var i=ru();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Fe(r)?(i=!0,Wi(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Yo(t),s.updater=xl,t.stateNode=s,s._reactInternals=t,Ua(t,r,e,n),t=Ba(null,t,r,!0,i,n)):(t.tag=0,X&&i&&Vo(t),_e(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(bi(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=Qv(r),e=rt(r,e),s){case 0:t=Qa(null,t,r,e,n);break e;case 1:t=Ec(null,t,r,e,n);break e;case 11:t=Cc(null,t,r,e,n);break e;case 14:t=_c(null,t,r,rt(r.type,e),n);break e}throw Error(E(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:rt(r,s),Qa(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:rt(r,s),Ec(e,t,r,s,n);case 3:e:{if(xh(t),e===null)throw Error(E(387));r=t.pendingProps,i=t.memoizedState,s=i.element,Wf(e,t),Yi(t,r,null,n);var l=t.memoizedState;if(r=l.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Ur(Error(E(423)),t),t=Pc(e,t,r,n,s);break e}else if(r!==s){s=Ur(Error(E(424)),t),t=Pc(e,t,r,n,s);break e}else for(Qe=hn(t.stateNode.containerInfo.firstChild),Be=t,X=!0,at=null,n=Vf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Fr(),r===s){t=At(e,t,n);break e}_e(e,t,r,n)}t=t.child}return t;case 5:return Kf(t),e===null&&Fa(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,l=s.children,Ra(r,s)?l=null:i!==null&&Ra(r,i)&&(t.flags|=32),yh(e,t),_e(e,t,l,n),t.child;case 6:return e===null&&Fa(t),null;case 13:return wh(e,t,n);case 4:return Xo(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Dr(t,null,r,n):_e(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:rt(r,s),Cc(e,t,r,s,n);case 7:return _e(e,t,t.pendingProps,n),t.child;case 8:return _e(e,t,t.pendingProps.children,n),t.child;case 12:return _e(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,l=s.value,K(Ji,r._currentValue),r._currentValue=l,i!==null)if(ct(i.value,l)){if(i.children===s.children&&!ze.current){t=At(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){l=i.child;for(var u=o.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=Rt(-1,n&-n),u.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var p=c.pending;p===null?u.next=u:(u.next=p.next,p.next=u),c.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Da(i.return,n,t),o.lanes|=n;break}u=u.next}}else if(i.tag===10)l=i.type===t.type?null:i.child;else if(i.tag===18){if(l=i.return,l===null)throw Error(E(341));l.lanes|=n,o=l.alternate,o!==null&&(o.lanes|=n),Da(l,n,t),l=i.sibling}else l=i.child;if(l!==null)l.return=i;else for(l=i;l!==null;){if(l===t){l=null;break}if(i=l.sibling,i!==null){i.return=l.return,l=i;break}l=l.return}i=l}_e(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,wr(t,n),s=et(s),r=r(s),t.flags|=1,_e(e,t,r,n),t.child;case 14:return r=t.type,s=rt(r,t.pendingProps),s=rt(r.type,s),_c(e,t,r,s,n);case 15:return vh(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:rt(r,s),bi(e,t),t.tag=1,Fe(r)?(e=!0,Wi(t)):e=!1,wr(t,n),hh(t,r,s),Ua(t,r,s,n),Ba(null,t,r,!0,e,n);case 19:return Sh(e,t,n);case 22:return gh(e,t,n)}throw Error(E(156,t.tag))};function Fh(e,t){return cf(e,t)}function $v(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ye(e,t,n,r){return new $v(e,t,n,r)}function hu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qv(e){if(typeof e=="function")return hu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ro)return 11;if(e===Lo)return 14}return 2}function gn(e,t){var n=e.alternate;return n===null?(n=Ye(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ri(e,t,n,r,s,i){var l=2;if(r=e,typeof e=="function")hu(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case sr:return Bn(n.children,s,i,t);case Oo:l=8,s|=8;break;case ca:return e=Ye(12,n,t,s|2),e.elementType=ca,e.lanes=i,e;case da:return e=Ye(13,n,t,s),e.elementType=da,e.lanes=i,e;case fa:return e=Ye(19,n,t,s),e.elementType=fa,e.lanes=i,e;case Wd:return jl(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Vd:l=10;break e;case Hd:l=9;break e;case Ro:l=11;break e;case Lo:l=14;break e;case Wt:l=16,r=null;break e}throw Error(E(130,e==null?e:typeof e,""))}return t=Ye(l,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Bn(e,t,n,r){return e=Ye(7,e,r,t),e.lanes=n,e}function jl(e,t,n,r){return e=Ye(22,e,r,t),e.elementType=Wd,e.lanes=n,e.stateNode={isHidden:!1},e}function ra(e,t,n){return e=Ye(6,e,null,t),e.lanes=n,e}function sa(e,t,n){return t=Ye(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Bv(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Dl(0),this.expirationTimes=Dl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dl(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function pu(e,t,n,r,s,i,l,o,u){return e=new Bv(e,t,n,o,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ye(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yo(i),e}function Vv(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($h)}catch(e){console.error(e)}}$h(),Ud.exports=He;var Jv=Ud.exports,Uc=Jv;oa.createRoot=Uc.createRoot,oa.hydrateRoot=Uc.hydrateRoot;var Kr=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(){}},Gv={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Gt,jo,gd,Yv=(gd=class{constructor(){M(this,Gt,Gv);M(this,jo,!1)}setTimeoutProvider(e){T(this,Gt,e)}setTimeout(e,t){return y(this,Gt).setTimeout(e,t)}clearTimeout(e){y(this,Gt).clearTimeout(e)}setInterval(e,t){return y(this,Gt).setInterval(e,t)}clearInterval(e){y(this,Gt).clearInterval(e)}},Gt=new WeakMap,jo=new WeakMap,gd),Rn=new Yv;function Xv(e){setTimeout(e,0)}var Jn=typeof window>"u"||"Deno"in globalThis;function Ee(){}function Zv(e,t){return typeof e=="function"?e(t):e}function to(e){return typeof e=="number"&&e>=0&&e!==1/0}function Qh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function yn(e,t){return typeof e=="function"?e(t):e}function qe(e,t){return typeof e=="function"?e(t):e}function $c(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:l,stale:o}=e;if(l){if(r){if(t.queryHash!==yu(l,t.options))return!1}else if(!Ds(t.queryKey,l))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||s&&s!==t.state.fetchStatus||i&&!i(t))}function Qc(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Gn(t.options.mutationKey)!==Gn(i))return!1}else if(!Ds(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function yu(e,t){return((t==null?void 0:t.queryKeyHashFn)||Gn)(e)}function Gn(e){return JSON.stringify(e,(t,n)=>no(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Ds(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ds(e[n],t[n])):!1}var eg=Object.prototype.hasOwnProperty;function Bh(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Bc(e)&&Bc(t);if(!r&&!(no(e)&&no(t)))return t;const i=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),o=l.length,u=r?new Array(o):{};let c=0;for(let p=0;p{Rn.setTimeout(t,e)})}function ro(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Bh(e,t):t}function ng(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function rg(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var xu=Symbol();function Vh(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===xu?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function wu(e,t){return typeof e=="function"?e(...t):!!e}function sg(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var Ln,Yt,kr,yd,ig=(yd=class extends Kr{constructor(){super();M(this,Ln);M(this,Yt);M(this,kr);T(this,kr,t=>{if(!Jn&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){y(this,Yt)||this.setEventListener(y(this,kr))}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Yt))==null||t.call(this),T(this,Yt,void 0))}setEventListener(t){var n;T(this,kr,t),(n=y(this,Yt))==null||n.call(this),T(this,Yt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){y(this,Ln)!==t&&(T(this,Ln,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof y(this,Ln)=="boolean"?y(this,Ln):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ln=new WeakMap,Yt=new WeakMap,kr=new WeakMap,yd),Su=new ig;function so(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var lg=Xv;function ag(){let e=[],t=0,n=o=>{o()},r=o=>{o()},s=lg;const i=o=>{t?e.push(o):s(()=>{n(o)})},l=()=>{const o=e;e=[],o.length&&s(()=>{r(()=>{o.forEach(u=>{n(u)})})})};return{batch:o=>{let u;t++;try{u=o()}finally{t--,t||l()}return u},batchCalls:o=>(...u)=>{i(()=>{o(...u)})},schedule:i,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{s=o}}}var ue=ag(),Nr,Xt,Cr,xd,og=(xd=class extends Kr{constructor(){super();M(this,Nr,!0);M(this,Xt);M(this,Cr);T(this,Cr,t=>{if(!Jn&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){y(this,Xt)||this.setEventListener(y(this,Cr))}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Xt))==null||t.call(this),T(this,Xt,void 0))}setEventListener(t){var n;T(this,Cr,t),(n=y(this,Xt))==null||n.call(this),T(this,Xt,t(this.setOnline.bind(this)))}setOnline(t){y(this,Nr)!==t&&(T(this,Nr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return y(this,Nr)}},Nr=new WeakMap,Xt=new WeakMap,Cr=new WeakMap,xd),al=new og;function ug(e){return Math.min(1e3*2**e,3e4)}function Hh(e){return(e??"online")==="online"?al.isOnline():!0}var io=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Wh(e){let t=!1,n=0,r;const s=so(),i=()=>s.status!=="pending",l=m=>{var j;if(!i()){const v=new io(m);f(v),(j=e.onCancel)==null||j.call(e,v)}},o=()=>{t=!0},u=()=>{t=!1},c=()=>Su.isFocused()&&(e.networkMode==="always"||al.isOnline())&&e.canRun(),p=()=>Hh(e.networkMode)&&e.canRun(),h=m=>{i()||(r==null||r(),s.resolve(m))},f=m=>{i()||(r==null||r(),s.reject(m))},x=()=>new Promise(m=>{var j;r=v=>{(i()||c())&&m(v)},(j=e.onPause)==null||j.call(e)}).then(()=>{var m;r=void 0,i()||(m=e.onContinue)==null||m.call(e)}),S=()=>{if(i())return;let m;const j=n===0?e.initialPromise:void 0;try{m=j??e.fn()}catch(v){m=Promise.reject(v)}Promise.resolve(m).then(h).catch(v=>{var _;if(i())return;const d=e.retry??(Jn?0:3),g=e.retryDelay??ug,w=typeof g=="function"?g(n,v):g,C=d===!0||typeof d=="number"&&nc()?void 0:x()).then(()=>{t?f(v):S()})})};return{promise:s,status:()=>s.status,cancel:l,continue:()=>(r==null||r(),s),cancelRetry:o,continueRetry:u,canStart:p,start:()=>(p()?S():x().then(S),s)}}var In,wd,Kh=(wd=class{constructor(){M(this,In)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),to(this.gcTime)&&T(this,In,Rn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Jn?1/0:5*60*1e3))}clearGcTimeout(){y(this,In)&&(Rn.clearTimeout(y(this,In)),T(this,In,void 0))}},In=new WeakMap,wd),Mn,_r,Ke,zn,de,Bs,Fn,st,kt,Sd,cg=(Sd=class extends Kh{constructor(t){super();M(this,st);M(this,Mn);M(this,_r);M(this,Ke);M(this,zn);M(this,de);M(this,Bs);M(this,Fn);T(this,Fn,!1),T(this,Bs,t.defaultOptions),this.setOptions(t.options),this.observers=[],T(this,zn,t.client),T(this,Ke,y(this,zn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,T(this,Mn,Wc(this.options)),this.state=t.state??y(this,Mn),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=y(this,de))==null?void 0:t.promise}setOptions(t){if(this.options={...y(this,Bs),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Wc(this.options);n.data!==void 0&&(this.setState(Hc(n.data,n.dataUpdatedAt)),T(this,Mn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&y(this,Ke).remove(this)}setData(t,n){const r=ro(this.state.data,t,this.options);return D(this,st,kt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){D(this,st,kt).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=y(this,de))==null?void 0:r.promise;return(s=y(this,de))==null||s.cancel(t),n?n.then(Ee).catch(Ee):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(y(this,Mn))}isActive(){return this.observers.some(t=>qe(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===xu||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>yn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Qh(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=y(this,de))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=y(this,de))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),y(this,Ke).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(y(this,de)&&(y(this,Fn)?y(this,de).cancel({revert:!0}):y(this,de).cancelRetry()),this.scheduleGc()),y(this,Ke).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||D(this,st,kt).call(this,{type:"invalidate"})}async fetch(t,n){var u,c,p,h,f,x,S,m,j,v,d,g;if(this.state.fetchStatus!=="idle"&&((u=y(this,de))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(y(this,de))return y(this,de).continueRetry(),y(this,de).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(C=>C.options.queryFn);w&&this.setOptions(w.options)}const r=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(T(this,Fn,!0),r.signal)})},i=()=>{const w=Vh(this.options,n),_=(()=>{const P={client:y(this,zn),queryKey:this.queryKey,meta:this.meta};return s(P),P})();return T(this,Fn,!1),this.options.persister?this.options.persister(w,_,this):w(_)},o=(()=>{const w={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:y(this,zn),state:this.state,fetchFn:i};return s(w),w})();(c=this.options.behavior)==null||c.onFetch(o,this),T(this,_r,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=o.fetchOptions)==null?void 0:p.meta))&&D(this,st,kt).call(this,{type:"fetch",meta:(h=o.fetchOptions)==null?void 0:h.meta}),T(this,de,Wh({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:w=>{w instanceof io&&w.revert&&this.setState({...y(this,_r),fetchStatus:"idle"}),r.abort()},onFail:(w,C)=>{D(this,st,kt).call(this,{type:"failed",failureCount:w,error:C})},onPause:()=>{D(this,st,kt).call(this,{type:"pause"})},onContinue:()=>{D(this,st,kt).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const w=await y(this,de).start();if(w===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(w),(x=(f=y(this,Ke).config).onSuccess)==null||x.call(f,w,this),(m=(S=y(this,Ke).config).onSettled)==null||m.call(S,w,this.state.error,this),w}catch(w){if(w instanceof io){if(w.silent)return y(this,de).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw D(this,st,kt).call(this,{type:"error",error:w}),(v=(j=y(this,Ke).config).onError)==null||v.call(j,w,this),(g=(d=y(this,Ke).config).onSettled)==null||g.call(d,this.state.data,w,this),w}finally{this.scheduleGc()}}},Mn=new WeakMap,_r=new WeakMap,Ke=new WeakMap,zn=new WeakMap,de=new WeakMap,Bs=new WeakMap,Fn=new WeakMap,st=new WeakSet,kt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...qh(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...Hc(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return T(this,_r,t.manual?s:void 0),s;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ue.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),y(this,Ke).notify({query:this,type:"updated",action:t})})},Sd);function qh(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Hh(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Hc(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Wc(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Oe,U,Vs,Ce,Dn,Er,_t,Zt,Hs,Pr,br,An,Un,en,Tr,H,ds,lo,ao,oo,uo,co,fo,ho,Jh,jd,dg=(jd=class extends Kr{constructor(t,n){super();M(this,H);M(this,Oe);M(this,U);M(this,Vs);M(this,Ce);M(this,Dn);M(this,Er);M(this,_t);M(this,Zt);M(this,Hs);M(this,Pr);M(this,br);M(this,An);M(this,Un);M(this,en);M(this,Tr,new Set);this.options=n,T(this,Oe,t),T(this,Zt,null),T(this,_t,so()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(y(this,U).addObserver(this),Kc(y(this,U),this.options)?D(this,H,ds).call(this):this.updateResult(),D(this,H,uo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return po(y(this,U),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return po(y(this,U),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,D(this,H,co).call(this),D(this,H,fo).call(this),y(this,U).removeObserver(this)}setOptions(t){const n=this.options,r=y(this,U);if(this.options=y(this,Oe).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof qe(this.options.enabled,y(this,U))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");D(this,H,ho).call(this),y(this,U).setOptions(this.options),n._defaulted&&!ll(this.options,n)&&y(this,Oe).getQueryCache().notify({type:"observerOptionsUpdated",query:y(this,U),observer:this});const s=this.hasListeners();s&&qc(y(this,U),r,this.options,n)&&D(this,H,ds).call(this),this.updateResult(),s&&(y(this,U)!==r||qe(this.options.enabled,y(this,U))!==qe(n.enabled,y(this,U))||yn(this.options.staleTime,y(this,U))!==yn(n.staleTime,y(this,U)))&&D(this,H,lo).call(this);const i=D(this,H,ao).call(this);s&&(y(this,U)!==r||qe(this.options.enabled,y(this,U))!==qe(n.enabled,y(this,U))||i!==y(this,en))&&D(this,H,oo).call(this,i)}getOptimisticResult(t){const n=y(this,Oe).getQueryCache().build(y(this,Oe),t),r=this.createResult(n,t);return hg(this,r)&&(T(this,Ce,r),T(this,Er,this.options),T(this,Dn,y(this,U).state)),r}getCurrentResult(){return y(this,Ce)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&y(this,_t).status==="pending"&&y(this,_t).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){y(this,Tr).add(t)}getCurrentQuery(){return y(this,U)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=y(this,Oe).defaultQueryOptions(t),r=y(this,Oe).getQueryCache().build(y(this,Oe),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return D(this,H,ds).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),y(this,Ce)))}createResult(t,n){var L;const r=y(this,U),s=this.options,i=y(this,Ce),l=y(this,Dn),o=y(this,Er),c=t!==r?t.state:y(this,Vs),{state:p}=t;let h={...p},f=!1,x;if(n._optimisticResults){const I=this.hasListeners(),q=!I&&Kc(t,n),Ae=I&&qc(t,r,n,s);(q||Ae)&&(h={...h,...qh(p.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:S,errorUpdatedAt:m,status:j}=h;x=h.data;let v=!1;if(n.placeholderData!==void 0&&x===void 0&&j==="pending"){let I;i!=null&&i.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(I=i.data,v=!0):I=typeof n.placeholderData=="function"?n.placeholderData((L=y(this,br))==null?void 0:L.state.data,y(this,br)):n.placeholderData,I!==void 0&&(j="success",x=ro(i==null?void 0:i.data,I,n),f=!0)}if(n.select&&x!==void 0&&!v)if(i&&x===(l==null?void 0:l.data)&&n.select===y(this,Hs))x=y(this,Pr);else try{T(this,Hs,n.select),x=n.select(x),x=ro(i==null?void 0:i.data,x,n),T(this,Pr,x),T(this,Zt,null)}catch(I){T(this,Zt,I)}y(this,Zt)&&(S=y(this,Zt),x=y(this,Pr),m=Date.now(),j="error");const d=h.fetchStatus==="fetching",g=j==="pending",w=j==="error",C=g&&d,_=x!==void 0,k={status:j,fetchStatus:h.fetchStatus,isPending:g,isSuccess:j==="success",isError:w,isInitialLoading:C,isLoading:C,data:x,dataUpdatedAt:h.dataUpdatedAt,error:S,errorUpdatedAt:m,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:d,isRefetching:d&&!g,isLoadingError:w&&!_,isPaused:h.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:w&&_,isStale:ju(t,n),refetch:this.refetch,promise:y(this,_t),isEnabled:qe(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=k.data!==void 0,q=k.status==="error"&&!I,Ae=ft=>{q?ft.reject(k.error):I&&ft.resolve(k.data)},dt=()=>{const ft=T(this,_t,k.promise=so());Ae(ft)},jt=y(this,_t);switch(jt.status){case"pending":t.queryHash===r.queryHash&&Ae(jt);break;case"fulfilled":(q||k.data!==jt.value)&&dt();break;case"rejected":(!q||k.error!==jt.reason)&&dt();break}}return k}updateResult(){const t=y(this,Ce),n=this.createResult(y(this,U),this.options);if(T(this,Dn,y(this,U).state),T(this,Er,this.options),y(this,Dn).data!==void 0&&T(this,br,y(this,U)),ll(n,t))return;T(this,Ce,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!y(this,Tr).size)return!0;const l=new Set(i??y(this,Tr));return this.options.throwOnError&&l.add("error"),Object.keys(y(this,Ce)).some(o=>{const u=o;return y(this,Ce)[u]!==t[u]&&l.has(u)})};D(this,H,Jh).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&D(this,H,uo).call(this)}},Oe=new WeakMap,U=new WeakMap,Vs=new WeakMap,Ce=new WeakMap,Dn=new WeakMap,Er=new WeakMap,_t=new WeakMap,Zt=new WeakMap,Hs=new WeakMap,Pr=new WeakMap,br=new WeakMap,An=new WeakMap,Un=new WeakMap,en=new WeakMap,Tr=new WeakMap,H=new WeakSet,ds=function(t){D(this,H,ho).call(this);let n=y(this,U).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ee)),n},lo=function(){D(this,H,co).call(this);const t=yn(this.options.staleTime,y(this,U));if(Jn||y(this,Ce).isStale||!to(t))return;const r=Qh(y(this,Ce).dataUpdatedAt,t)+1;T(this,An,Rn.setTimeout(()=>{y(this,Ce).isStale||this.updateResult()},r))},ao=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(y(this,U)):this.options.refetchInterval)??!1},oo=function(t){D(this,H,fo).call(this),T(this,en,t),!(Jn||qe(this.options.enabled,y(this,U))===!1||!to(y(this,en))||y(this,en)===0)&&T(this,Un,Rn.setInterval(()=>{(this.options.refetchIntervalInBackground||Su.isFocused())&&D(this,H,ds).call(this)},y(this,en)))},uo=function(){D(this,H,lo).call(this),D(this,H,oo).call(this,D(this,H,ao).call(this))},co=function(){y(this,An)&&(Rn.clearTimeout(y(this,An)),T(this,An,void 0))},fo=function(){y(this,Un)&&(Rn.clearInterval(y(this,Un)),T(this,Un,void 0))},ho=function(){const t=y(this,Oe).getQueryCache().build(y(this,Oe),this.options);if(t===y(this,U))return;const n=y(this,U);T(this,U,t),T(this,Vs,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Jh=function(t){ue.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(y(this,Ce))}),y(this,Oe).getQueryCache().notify({query:y(this,U),type:"observerResultsUpdated"})})},jd);function fg(e,t){return qe(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Kc(e,t){return fg(e,t)||e.state.data!==void 0&&po(e,t,t.refetchOnMount)}function po(e,t,n){if(qe(t.enabled,e)!==!1&&yn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ju(e,t)}return!1}function qc(e,t,n,r){return(e!==t||qe(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ju(e,n)}function ju(e,t){return qe(t.enabled,e)!==!1&&e.isStaleByTime(yn(t.staleTime,e))}function hg(e,t){return!ll(e.getCurrentResult(),t)}function Jc(e){return{onFetch:(t,n)=>{var p,h,f,x,S;const r=t.options,s=(f=(h=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:h.fetchMore)==null?void 0:f.direction,i=((x=t.state.data)==null?void 0:x.pages)||[],l=((S=t.state.data)==null?void 0:S.pageParams)||[];let o={pages:[],pageParams:[]},u=0;const c=async()=>{let m=!1;const j=g=>{sg(g,()=>t.signal,()=>m=!0)},v=Vh(t.options,t.fetchOptions),d=async(g,w,C)=>{if(m)return Promise.reject();if(w==null&&g.pages.length)return Promise.resolve(g);const P=(()=>{const q={client:t.client,queryKey:t.queryKey,pageParam:w,direction:C?"backward":"forward",meta:t.options.meta};return j(q),q})(),k=await v(P),{maxPages:L}=t.options,I=C?rg:ng;return{pages:I(g.pages,k,L),pageParams:I(g.pageParams,w,L)}};if(s&&i.length){const g=s==="backward",w=g?pg:Gc,C={pages:i,pageParams:l},_=w(r,C);o=await d(C,_,g)}else{const g=e??i.length;do{const w=u===0?l[0]??r.initialPageParam:Gc(r,o);if(u>0&&w==null)break;o=await d(o,w),u++}while(u{var m,j;return(j=(m=t.options).persister)==null?void 0:j.call(m,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function Gc(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function pg(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Ws,mt,Se,$n,vt,Vt,kd,mg=(kd=class extends Kh{constructor(t){super();M(this,vt);M(this,Ws);M(this,mt);M(this,Se);M(this,$n);T(this,Ws,t.client),this.mutationId=t.mutationId,T(this,Se,t.mutationCache),T(this,mt,[]),this.state=t.state||Gh(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){y(this,mt).includes(t)||(y(this,mt).push(t),this.clearGcTimeout(),y(this,Se).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){T(this,mt,y(this,mt).filter(n=>n!==t)),this.scheduleGc(),y(this,Se).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){y(this,mt).length||(this.state.status==="pending"?this.scheduleGc():y(this,Se).remove(this))}continue(){var t;return((t=y(this,$n))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,o,u,c,p,h,f,x,S,m,j,v,d,g,w,C,_,P;const n=()=>{D(this,vt,Vt).call(this,{type:"continue"})},r={client:y(this,Ws),meta:this.options.meta,mutationKey:this.options.mutationKey};T(this,$n,Wh({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(k,L)=>{D(this,vt,Vt).call(this,{type:"failed",failureCount:k,error:L})},onPause:()=>{D(this,vt,Vt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>y(this,Se).canRun(this)}));const s=this.state.status==="pending",i=!y(this,$n).canStart();try{if(s)n();else{D(this,vt,Vt).call(this,{type:"pending",variables:t,isPaused:i}),y(this,Se).config.onMutate&&await y(this,Se).config.onMutate(t,this,r);const L=await((o=(l=this.options).onMutate)==null?void 0:o.call(l,t,r));L!==this.state.context&&D(this,vt,Vt).call(this,{type:"pending",context:L,variables:t,isPaused:i})}const k=await y(this,$n).start();return await((c=(u=y(this,Se).config).onSuccess)==null?void 0:c.call(u,k,t,this.state.context,this,r)),await((h=(p=this.options).onSuccess)==null?void 0:h.call(p,k,t,this.state.context,r)),await((x=(f=y(this,Se).config).onSettled)==null?void 0:x.call(f,k,null,this.state.variables,this.state.context,this,r)),await((m=(S=this.options).onSettled)==null?void 0:m.call(S,k,null,t,this.state.context,r)),D(this,vt,Vt).call(this,{type:"success",data:k}),k}catch(k){try{await((v=(j=y(this,Se).config).onError)==null?void 0:v.call(j,k,t,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((g=(d=this.options).onError)==null?void 0:g.call(d,k,t,this.state.context,r))}catch(L){Promise.reject(L)}try{await((C=(w=y(this,Se).config).onSettled)==null?void 0:C.call(w,void 0,k,this.state.variables,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((P=(_=this.options).onSettled)==null?void 0:P.call(_,void 0,k,t,this.state.context,r))}catch(L){Promise.reject(L)}throw D(this,vt,Vt).call(this,{type:"error",error:k}),k}finally{y(this,Se).runNext(this)}}},Ws=new WeakMap,mt=new WeakMap,Se=new WeakMap,$n=new WeakMap,vt=new WeakSet,Vt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ue.batch(()=>{y(this,mt).forEach(r=>{r.onMutationUpdate(t)}),y(this,Se).notify({mutation:this,type:"updated",action:t})})},kd);function Gh(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Et,it,Ks,Nd,vg=(Nd=class extends Kr{constructor(t={}){super();M(this,Et);M(this,it);M(this,Ks);this.config=t,T(this,Et,new Set),T(this,it,new Map),T(this,Ks,0)}build(t,n,r){const s=new mg({client:t,mutationCache:this,mutationId:++ti(this,Ks)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){y(this,Et).add(t);const n=xi(t);if(typeof n=="string"){const r=y(this,it).get(n);r?r.push(t):y(this,it).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(y(this,Et).delete(t)){const n=xi(t);if(typeof n=="string"){const r=y(this,it).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&y(this,it).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=xi(t);if(typeof n=="string"){const r=y(this,it).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=xi(t);if(typeof n=="string"){const s=(r=y(this,it).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ue.batch(()=>{y(this,Et).forEach(t=>{this.notify({type:"removed",mutation:t})}),y(this,Et).clear(),y(this,it).clear()})}getAll(){return Array.from(y(this,Et))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Qc(n,r))}findAll(t={}){return this.getAll().filter(n=>Qc(t,n))}notify(t){ue.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ue.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ee))))}},Et=new WeakMap,it=new WeakMap,Ks=new WeakMap,Nd);function xi(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Pt,tn,Re,bt,Mt,Li,mo,Cd,gg=(Cd=class extends Kr{constructor(n,r){super();M(this,Mt);M(this,Pt);M(this,tn);M(this,Re);M(this,bt);T(this,Pt,n),this.setOptions(r),this.bindMethods(),D(this,Mt,Li).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=y(this,Pt).defaultMutationOptions(n),ll(this.options,r)||y(this,Pt).getMutationCache().notify({type:"observerOptionsUpdated",mutation:y(this,Re),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Gn(r.mutationKey)!==Gn(this.options.mutationKey)?this.reset():((s=y(this,Re))==null?void 0:s.state.status)==="pending"&&y(this,Re).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=y(this,Re))==null||n.removeObserver(this)}onMutationUpdate(n){D(this,Mt,Li).call(this),D(this,Mt,mo).call(this,n)}getCurrentResult(){return y(this,tn)}reset(){var n;(n=y(this,Re))==null||n.removeObserver(this),T(this,Re,void 0),D(this,Mt,Li).call(this),D(this,Mt,mo).call(this)}mutate(n,r){var s;return T(this,bt,r),(s=y(this,Re))==null||s.removeObserver(this),T(this,Re,y(this,Pt).getMutationCache().build(y(this,Pt),this.options)),y(this,Re).addObserver(this),y(this,Re).execute(n)}},Pt=new WeakMap,tn=new WeakMap,Re=new WeakMap,bt=new WeakMap,Mt=new WeakSet,Li=function(){var r;const n=((r=y(this,Re))==null?void 0:r.state)??Gh();T(this,tn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},mo=function(n){ue.batch(()=>{var r,s,i,l,o,u,c,p;if(y(this,bt)&&this.hasListeners()){const h=y(this,tn).variables,f=y(this,tn).context,x={client:y(this,Pt),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(r=y(this,bt)).onSuccess)==null||s.call(r,n.data,h,f,x)}catch(S){Promise.reject(S)}try{(l=(i=y(this,bt)).onSettled)==null||l.call(i,n.data,null,h,f,x)}catch(S){Promise.reject(S)}}else if((n==null?void 0:n.type)==="error"){try{(u=(o=y(this,bt)).onError)==null||u.call(o,n.error,h,f,x)}catch(S){Promise.reject(S)}try{(p=(c=y(this,bt)).onSettled)==null||p.call(c,void 0,n.error,h,f,x)}catch(S){Promise.reject(S)}}}this.listeners.forEach(h=>{h(y(this,tn))})})},Cd),gt,_d,yg=(_d=class extends Kr{constructor(t={}){super();M(this,gt);this.config=t,T(this,gt,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??yu(s,n);let l=this.get(i);return l||(l=new cg({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(l)),l}add(t){y(this,gt).has(t.queryHash)||(y(this,gt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=y(this,gt).get(t.queryHash);n&&(t.destroy(),n===t&&y(this,gt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ue.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return y(this,gt).get(t)}getAll(){return[...y(this,gt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>$c(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>$c(t,r)):n}notify(t){ue.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ue.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ue.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},gt=new WeakMap,_d),ne,nn,rn,Or,Rr,sn,Lr,Ir,Ed,xg=(Ed=class{constructor(e={}){M(this,ne);M(this,nn);M(this,rn);M(this,Or);M(this,Rr);M(this,sn);M(this,Lr);M(this,Ir);T(this,ne,e.queryCache||new yg),T(this,nn,e.mutationCache||new vg),T(this,rn,e.defaultOptions||{}),T(this,Or,new Map),T(this,Rr,new Map),T(this,sn,0)}mount(){ti(this,sn)._++,y(this,sn)===1&&(T(this,Lr,Su.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,ne).onFocus())})),T(this,Ir,al.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,ne).onOnline())})))}unmount(){var e,t;ti(this,sn)._--,y(this,sn)===0&&((e=y(this,Lr))==null||e.call(this),T(this,Lr,void 0),(t=y(this,Ir))==null||t.call(this),T(this,Ir,void 0))}isFetching(e){return y(this,ne).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return y(this,nn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=y(this,ne).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=y(this,ne).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(yn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return y(this,ne).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=y(this,ne).get(r.queryHash),i=s==null?void 0:s.state.data,l=Zv(t,i);if(l!==void 0)return y(this,ne).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return ue.batch(()=>y(this,ne).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=y(this,ne).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=y(this,ne);ue.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=y(this,ne);return ue.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ue.batch(()=>y(this,ne).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ee).catch(Ee)}invalidateQueries(e,t={}){return ue.batch(()=>(y(this,ne).findAll(e).forEach(n=>{n.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"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ue.batch(()=>y(this,ne).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Ee)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Ee)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=y(this,ne).build(this,t);return n.isStaleByTime(yn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ee).catch(Ee)}fetchInfiniteQuery(e){return e.behavior=Jc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ee).catch(Ee)}ensureInfiniteQueryData(e){return e.behavior=Jc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return al.isOnline()?y(this,nn).resumePausedMutations():Promise.resolve()}getQueryCache(){return y(this,ne)}getMutationCache(){return y(this,nn)}getDefaultOptions(){return y(this,rn)}setDefaultOptions(e){T(this,rn,e)}setQueryDefaults(e,t){y(this,Or).set(Gn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...y(this,Or).values()],n={};return t.forEach(r=>{Ds(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){y(this,Rr).set(Gn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...y(this,Rr).values()],n={};return t.forEach(r=>{Ds(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...y(this,rn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=yu(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===xu&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...y(this,rn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){y(this,ne).clear(),y(this,nn).clear()}},ne=new WeakMap,nn=new WeakMap,rn=new WeakMap,Or=new WeakMap,Rr=new WeakMap,sn=new WeakMap,Lr=new WeakMap,Ir=new WeakMap,Ed),Yh=N.createContext(void 0),Zn=e=>{const t=N.useContext(Yh);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},wg=({client:e,children:t})=>(N.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(Yh.Provider,{value:e,children:t})),Xh=N.createContext(!1),Sg=()=>N.useContext(Xh);Xh.Provider;function jg(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var kg=N.createContext(jg()),Ng=()=>N.useContext(kg),Cg=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?wu(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},_g=e=>{N.useEffect(()=>{e.clearReset()},[e])},Eg=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||wu(n,[e.error,r])),Pg=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},bg=(e,t)=>e.isLoading&&e.isFetching&&!t,Tg=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Yc=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Og(e,t,n){var f,x,S,m;const r=Sg(),s=Ng(),i=Zn(),l=i.defaultQueryOptions(e);(x=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||x.call(f,l);const o=i.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",Pg(l),Cg(l,s,o),_g(s);const u=!i.getQueryCache().get(l.queryHash),[c]=N.useState(()=>new t(i,l)),p=c.getOptimisticResult(l),h=!r&&e.subscribed!==!1;if(N.useSyncExternalStore(N.useCallback(j=>{const v=h?c.subscribe(ue.batchCalls(j)):Ee;return c.updateResult(),v},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),N.useEffect(()=>{c.setOptions(l)},[l,c]),Tg(l,p))throw Yc(l,c,s);if(Eg({result:p,errorResetBoundary:s,throwOnError:l.throwOnError,query:o,suspense:l.suspense}))throw p.error;if((m=(S=i.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||m.call(S,l,p),l.experimental_prefetchInRender&&!Jn&&bg(p,r)){const j=u?Yc(l,c,s):o==null?void 0:o.promise;j==null||j.catch(Ee).finally(()=>{c.updateResult()})}return l.notifyOnChangeProps?p:c.trackResult(p)}function Lt(e,t){return Og(e,dg)}function Ze(e,t){const n=Zn(),[r]=N.useState(()=>new gg(n,e));N.useEffect(()=>{r.setOptions(e)},[r,e]);const s=N.useSyncExternalStore(N.useCallback(l=>r.subscribe(ue.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=N.useCallback((l,o)=>{r.mutate(l,o).catch(Ee)},[r]);if(s.error&&wu(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}/** + * @remix-run/router v1.23.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function As(){return As=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function ku(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Lg(){return Math.random().toString(36).substr(2,8)}function Zc(e,t){return{usr:e.state,key:e.key,idx:t}}function vo(e,t,n,r){return n===void 0&&(n=null),As({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?qr(t):t,{state:n,key:t&&t.key||r||Lg()})}function ol(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function qr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function Ig(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,l=s.history,o=on.Pop,u=null,c=p();c==null&&(c=0,l.replaceState(As({},l.state,{idx:c}),""));function p(){return(l.state||{idx:null}).idx}function h(){o=on.Pop;let j=p(),v=j==null?null:j-c;c=j,u&&u({action:o,location:m.location,delta:v})}function f(j,v){o=on.Push;let d=vo(m.location,j,v);c=p()+1;let g=Zc(d,c),w=m.createHref(d);try{l.pushState(g,"",w)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;s.location.assign(w)}i&&u&&u({action:o,location:m.location,delta:1})}function x(j,v){o=on.Replace;let d=vo(m.location,j,v);c=p();let g=Zc(d,c),w=m.createHref(d);l.replaceState(g,"",w),i&&u&&u({action:o,location:m.location,delta:0})}function S(j){let v=s.location.origin!=="null"?s.location.origin:s.location.href,d=typeof j=="string"?j:ol(j);return d=d.replace(/ $/,"%20"),se(v,"No window.location.(origin|href) available to create URL for href: "+d),new URL(d,v)}let m={get action(){return o},get location(){return e(s,l)},listen(j){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(Xc,h),u=j,()=>{s.removeEventListener(Xc,h),u=null}},createHref(j){return t(s,j)},createURL:S,encodeLocation(j){let v=S(j);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:f,replace:x,go(j){return l.go(j)}};return m}var ed;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(ed||(ed={}));function Mg(e,t,n){return n===void 0&&(n="/"),zg(e,t,n)}function zg(e,t,n,r){let s=typeof t=="string"?qr(t):t,i=Qr(s.pathname||"/",n);if(i==null)return null;let l=Zh(e);Fg(l);let o=null;for(let u=0;o==null&&u{let u={relativePath:o===void 0?i.path||"":o,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};u.relativePath.startsWith("/")&&(se(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let c=xn([r,u.relativePath]),p=n.concat(u);i.children&&i.children.length>0&&(se(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),Zh(i.children,t,p,c)),!(i.path==null&&!i.index)&&t.push({path:c,score:Vg(c,i.index),routesMeta:p})};return e.forEach((i,l)=>{var o;if(i.path===""||!((o=i.path)!=null&&o.includes("?")))s(i,l);else for(let u of ep(i.path))s(i,l,u)}),t}function ep(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let l=ep(r.join("/")),o=[];return o.push(...l.map(u=>u===""?i:[i,u].join("/"))),s&&o.push(...l),o.map(u=>e.startsWith("/")&&u===""?"/":u)}function Fg(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Hg(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Dg=/^:[\w-]+$/,Ag=3,Ug=2,$g=1,Qg=10,Bg=-2,td=e=>e==="*";function Vg(e,t){let n=e.split("/"),r=n.length;return n.some(td)&&(r+=Bg),t&&(r+=Ug),n.filter(s=>!td(s)).reduce((s,i)=>s+(Dg.test(i)?Ag:i===""?$g:Qg),r)}function Hg(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function Wg(e,t,n){let{routesMeta:r}=e,s={},i="/",l=[];for(let o=0;o{let{paramName:f,isOptional:x}=p;if(f==="*"){let m=o[h]||"";l=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const S=o[h];return x&&!S?c[f]=void 0:c[f]=(S||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:l,pattern:e}}function Kg(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),ku(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 r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,o,u)=>(r.push({paramName:o,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function qg(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ku(!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 ("+t+").")),e}}function Qr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const Jg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Gg=e=>Jg.test(e);function Yg(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?qr(e):e,i;if(n)if(Gg(n))i=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),ku(!1,"Pathnames cannot have embedded double slashes - normalizing "+(l+" -> "+n))}n.startsWith("/")?i=nd(n.substring(1),"/"):i=nd(n,t)}else i=t;return{pathname:i,search:ey(r),hash:ty(s)}}function nd(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function ia(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Xg(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function tp(e,t){let n=Xg(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function np(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=qr(e):(s=As({},e),se(!s.pathname||!s.pathname.includes("?"),ia("?","pathname","search",s)),se(!s.pathname||!s.pathname.includes("#"),ia("#","pathname","hash",s)),se(!s.search||!s.search.includes("#"),ia("#","search","hash",s)));let i=e===""||s.pathname==="",l=i?"/":s.pathname,o;if(l==null)o=n;else{let h=t.length-1;if(!r&&l.startsWith("..")){let f=l.split("/");for(;f[0]==="..";)f.shift(),h-=1;s.pathname=f.join("/")}o=h>=0?t[h]:"/"}let u=Yg(s,o),c=l&&l!=="/"&&l.endsWith("/"),p=(i||l===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(c||p)&&(u.pathname+="/"),u}const xn=e=>e.join("/").replace(/\/\/+/g,"/"),Zg=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),ey=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ty=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function ny(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const rp=["post","put","patch","delete"];new Set(rp);const ry=["get",...rp];new Set(ry);/** + * React Router v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Us(){return Us=Object.assign?Object.assign.bind():function(e){for(var t=1;t{o.current=!0}),N.useCallback(function(c,p){if(p===void 0&&(p={}),!o.current)return;if(typeof c=="number"){r.go(c);return}let h=np(c,JSON.parse(l),i,p.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:xn([t,h.pathname])),(p.replace?r.replace:r.push)(h,p.state,p)},[t,r,l,i,e])}const ly=N.createContext(null);function ay(e){let t=N.useContext($t).outlet;return t&&N.createElement(ly.Provider,{value:e},t)}function ap(){let{matches:e}=N.useContext($t),t=e[e.length-1];return t?t.params:{}}function bl(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=N.useContext(Cn),{matches:s}=N.useContext($t),{pathname:i}=Jr(),l=JSON.stringify(tp(s,r.v7_relativeSplatPath));return N.useMemo(()=>np(e,JSON.parse(l),i,n==="path"),[e,l,i,n])}function oy(e,t){return uy(e,t)}function uy(e,t,n,r){Zs()||se(!1);let{navigator:s}=N.useContext(Cn),{matches:i}=N.useContext($t),l=i[i.length-1],o=l?l.params:{};l&&l.pathname;let u=l?l.pathnameBase:"/";l&&l.route;let c=Jr(),p;if(t){var h;let j=typeof t=="string"?qr(t):t;u==="/"||(h=j.pathname)!=null&&h.startsWith(u)||se(!1),p=j}else p=c;let f=p.pathname||"/",x=f;if(u!=="/"){let j=u.replace(/^\//,"").split("/");x="/"+f.replace(/^\//,"").split("/").slice(j.length).join("/")}let S=Mg(e,{pathname:x}),m=py(S&&S.map(j=>Object.assign({},j,{params:Object.assign({},o,j.params),pathname:xn([u,s.encodeLocation?s.encodeLocation(j.pathname).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?u:xn([u,s.encodeLocation?s.encodeLocation(j.pathnameBase).pathname:j.pathnameBase])})),i,n,r);return t&&m?N.createElement(Pl.Provider,{value:{location:Us({pathname:"/",search:"",hash:"",state:null,key:"default"},p),navigationType:on.Pop}},m):m}function cy(){let e=yy(),t=ny(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return N.createElement(N.Fragment,null,N.createElement("h2",null,"Unexpected Application Error!"),N.createElement("h3",{style:{fontStyle:"italic"}},t),n?N.createElement("pre",{style:s},n):null,null)}const dy=N.createElement(cy,null);class fy extends N.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?N.createElement($t.Provider,{value:this.props.routeContext},N.createElement(ip.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hy(e){let{routeContext:t,match:n,children:r}=e,s=N.useContext(El);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),N.createElement($t.Provider,{value:t},r)}function py(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,o=(s=n)==null?void 0:s.errors;if(o!=null){let p=l.findIndex(h=>h.route.id&&(o==null?void 0:o[h.route.id])!==void 0);p>=0||se(!1),l=l.slice(0,Math.min(l.length,p+1))}let u=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let p=0;p=0?l=l.slice(0,c+1):l=[l[0]];break}}}return l.reduceRight((p,h,f)=>{let x,S=!1,m=null,j=null;n&&(x=o&&h.route.id?o[h.route.id]:void 0,m=h.route.errorElement||dy,u&&(c<0&&f===0?(wy("route-fallback"),S=!0,j=null):c===f&&(S=!0,j=h.route.hydrateFallbackElement||null)));let v=t.concat(l.slice(0,f+1)),d=()=>{let g;return x?g=m:S?g=j:h.route.Component?g=N.createElement(h.route.Component,null):h.route.element?g=h.route.element:g=p,N.createElement(hy,{match:h,routeContext:{outlet:p,matches:v,isDataRoute:n!=null},children:g})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?N.createElement(fy,{location:n.location,revalidation:n.revalidation,component:m,error:x,children:d(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):d()},null)}var op=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(op||{}),up=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}(up||{});function my(e){let t=N.useContext(El);return t||se(!1),t}function vy(e){let t=N.useContext(sp);return t||se(!1),t}function gy(e){let t=N.useContext($t);return t||se(!1),t}function cp(e){let t=gy(),n=t.matches[t.matches.length-1];return n.route.id||se(!1),n.route.id}function yy(){var e;let t=N.useContext(ip),n=vy(),r=cp();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function xy(){let{router:e}=my(op.UseNavigateStable),t=cp(up.UseNavigateStable),n=N.useRef(!1);return lp(()=>{n.current=!0}),N.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,Us({fromRouteId:t},i)))},[e,t])}const rd={};function wy(e,t,n){rd[e]||(rd[e]=!0)}function Sy(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function jy(e){return ay(e.context)}function Ht(e){se(!1)}function ky(e){let{basename:t="/",children:n=null,location:r,navigationType:s=on.Pop,navigator:i,static:l=!1,future:o}=e;Zs()&&se(!1);let u=t.replace(/^\/*/,"/"),c=N.useMemo(()=>({basename:u,navigator:i,static:l,future:Us({v7_relativeSplatPath:!1},o)}),[u,o,i,l]);typeof r=="string"&&(r=qr(r));let{pathname:p="/",search:h="",hash:f="",state:x=null,key:S="default"}=r,m=N.useMemo(()=>{let j=Qr(p,u);return j==null?null:{location:{pathname:j,search:h,hash:f,state:x,key:S},navigationType:s}},[u,p,h,f,x,S,s]);return m==null?null:N.createElement(Cn.Provider,{value:c},N.createElement(Pl.Provider,{children:n,value:m}))}function Ny(e){let{children:t,location:n}=e;return oy(yo(t),n)}new Promise(()=>{});function yo(e,t){t===void 0&&(t=[]);let n=[];return N.Children.forEach(e,(r,s)=>{if(!N.isValidElement(r))return;let i=[...t,s];if(r.type===N.Fragment){n.push.apply(n,yo(r.props.children,i));return}r.type!==Ht&&se(!1),!r.props.index||!r.props.children||se(!1);let l={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=yo(r.props.children,i)),n.push(l)}),n}/** + * React Router DOM v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function ul(){return ul=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[s]=e[s]);return n}function Cy(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function _y(e,t){return e.button===0&&(!t||t==="_self")&&!Cy(e)}const Ey=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Py=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],by="6";try{window.__reactRouterVersion=by}catch{}const Ty=N.createContext({isTransitioning:!1}),Oy="startTransition",sd=Dp[Oy];function Ry(e){let{basename:t,children:n,future:r,window:s}=e,i=N.useRef();i.current==null&&(i.current=Rg({window:s,v5Compat:!0}));let l=i.current,[o,u]=N.useState({action:l.action,location:l.location}),{v7_startTransition:c}=r||{},p=N.useCallback(h=>{c&&sd?sd(()=>u(h)):u(h)},[u,c]);return N.useLayoutEffect(()=>l.listen(p),[l,p]),N.useEffect(()=>Sy(r),[r]),N.createElement(ky,{basename:t,children:n,location:o.location,navigationType:o.action,navigator:l,future:r})}const Ly=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Iy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,My=N.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:l,state:o,target:u,to:c,preventScrollReset:p,viewTransition:h}=t,f=dp(t,Ey),{basename:x}=N.useContext(Cn),S,m=!1;if(typeof c=="string"&&Iy.test(c)&&(S=c,Ly))try{let g=new URL(window.location.href),w=c.startsWith("//")?new URL(g.protocol+c):new URL(c),C=Qr(w.pathname,x);w.origin===g.origin&&C!=null?c=C+w.search+w.hash:m=!0}catch{}let j=sy(c,{relative:s}),v=Fy(c,{replace:l,state:o,target:u,preventScrollReset:p,relative:s,viewTransition:h});function d(g){r&&r(g),g.defaultPrevented||v(g)}return N.createElement("a",ul({},f,{href:S||j,onClick:m||i?r:d,ref:n,target:u}))}),id=N.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:s=!1,className:i="",end:l=!1,style:o,to:u,viewTransition:c,children:p}=t,h=dp(t,Py),f=bl(u,{relative:h.relative}),x=Jr(),S=N.useContext(sp),{navigator:m,basename:j}=N.useContext(Cn),v=S!=null&&Dy(f)&&c===!0,d=m.encodeLocation?m.encodeLocation(f).pathname:f.pathname,g=x.pathname,w=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;s||(g=g.toLowerCase(),w=w?w.toLowerCase():null,d=d.toLowerCase()),w&&j&&(w=Qr(w,j)||w);const C=d!=="/"&&d.endsWith("/")?d.length-1:d.length;let _=g===d||!l&&g.startsWith(d)&&g.charAt(C)==="/",P=w!=null&&(w===d||!l&&w.startsWith(d)&&w.charAt(d.length)==="/"),k={isActive:_,isPending:P,isTransitioning:v},L=_?r:void 0,I;typeof i=="function"?I=i(k):I=[i,_?"active":null,P?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let q=typeof o=="function"?o(k):o;return N.createElement(My,ul({},h,{"aria-current":L,className:I,ref:n,style:q,to:u,viewTransition:c}),typeof p=="function"?p(k):p)});var xo;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(xo||(xo={}));var ld;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ld||(ld={}));function zy(e){let t=N.useContext(El);return t||se(!1),t}function Fy(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:l,viewTransition:o}=t===void 0?{}:t,u=Gr(),c=Jr(),p=bl(e,{relative:l});return N.useCallback(h=>{if(_y(h,n)){h.preventDefault();let f=r!==void 0?r:ol(c)===ol(p);u(e,{replace:f,state:s,preventScrollReset:i,relative:l,viewTransition:o})}},[c,u,p,r,s,n,e,i,l,o])}function Dy(e,t){t===void 0&&(t={});let n=N.useContext(Ty);n==null&&se(!1);let{basename:r}=zy(xo.useViewTransitionState),s=bl(e,{relative:t.relative});if(!n.isTransitioning)return!1;let i=Qr(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=Qr(n.nextLocation.pathname,r)||n.nextLocation.pathname;return go(s.pathname,l)!=null||go(s.pathname,i)!=null}/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var Ay={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"};/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Uy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),pe=(e,t)=>{const n=N.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:l,className:o="",children:u,...c},p)=>N.createElement("svg",{ref:p,...Ay,width:s,height:s,stroke:r,strokeWidth:l?Number(i)*24/Number(s):i,className:["lucide",`lucide-${Uy(e)}`,o].join(" "),...c},[...t.map(([h,f])=>N.createElement(h,f)),...Array.isArray(u)?u:[u]]));return n.displayName=`${e}`,n};/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $y=pe("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Qy=pe("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"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const By=pe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vy=pe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ii=pe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Hy=pe("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Wy=pe("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Tl=pe("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ky=pe("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"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qy=pe("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"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ad=pe("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wo=pe("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fp=pe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Jy=pe("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"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const od=pe("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Gy=pe("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"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hp=pe("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Nu=pe("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),Yy={},ud=e=>{let t;const n=new Set,r=(p,h)=>{const f=typeof p=="function"?p(t):p;if(!Object.is(f,t)){const x=t;t=h??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(S=>S(t,x))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>c,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(Yy?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(r,s,u);return u},Xy=e=>e?ud(e):ud;var pp={exports:{}},mp={},vp={exports:{}},gp={};/** + * @license React + * use-sync-external-store-shim.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Br=N;function Zy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ex=typeof Object.is=="function"?Object.is:Zy,tx=Br.useState,nx=Br.useEffect,rx=Br.useLayoutEffect,sx=Br.useDebugValue;function ix(e,t){var n=t(),r=tx({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return rx(function(){s.value=n,s.getSnapshot=t,la(s)&&i({inst:s})},[e,n,t]),nx(function(){return la(s)&&i({inst:s}),e(function(){la(s)&&i({inst:s})})},[e]),sx(n),n}function la(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ex(e,n)}catch{return!0}}function lx(e,t){return t()}var ax=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?lx:ix;gp.useSyncExternalStore=Br.useSyncExternalStore!==void 0?Br.useSyncExternalStore:ax;vp.exports=gp;var ox=vp.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Ol=N,ux=ox;function cx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var dx=typeof Object.is=="function"?Object.is:cx,fx=ux.useSyncExternalStore,hx=Ol.useRef,px=Ol.useEffect,mx=Ol.useMemo,vx=Ol.useDebugValue;mp.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=hx(null);if(i.current===null){var l={hasValue:!1,value:null};i.current=l}else l=i.current;i=mx(function(){function u(x){if(!c){if(c=!0,p=x,x=r(x),s!==void 0&&l.hasValue){var S=l.value;if(s(S,x))return h=S}return h=x}if(S=h,dx(p,x))return S;var m=r(x);return s!==void 0&&s(S,m)?(p=x,S):(p=x,h=m)}var c=!1,p,h,f=n===void 0?null:n;return[function(){return u(t())},f===null?void 0:function(){return u(f())}]},[t,n,r,s]);var o=fx(e,i[0],i[1]);return px(function(){l.hasValue=!0,l.value=o},[o]),vx(o),o};pp.exports=mp;var gx=pp.exports;const yx=Pd(gx),yp={},{useDebugValue:xx}=Eo,{useSyncExternalStoreWithSelector:wx}=yx;let cd=!1;const Sx=e=>e;function jx(e,t=Sx,n){(yp?"production":void 0)!=="production"&&n&&!cd&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),cd=!0);const r=wx(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return xx(r),r}const dd=e=>{(yp?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Xy(e):e,n=(r,s)=>jx(t,r,s);return Object.assign(n,t),n},Cu=e=>e?dd(e):dd,_u="/api",Eu="flow_auth_token",Pu="flow_auth_expires",bu="flow_auth_username";function cl(){const e=localStorage.getItem(Eu),t=localStorage.getItem(Pu);return!e||!t?null:new Date(t)<=new Date?(jr(),null):e}function fd(e,t,n){localStorage.setItem(Eu,e),localStorage.setItem(Pu,t),localStorage.setItem(bu,n)}function jr(){localStorage.removeItem(Eu),localStorage.removeItem(Pu),localStorage.removeItem(bu)}function kx(){return localStorage.getItem(bu)}let $s=null;function Nx(e){$s=e}async function le(e,t,n=!1){const r={"Content-Type":"application/json",...t==null?void 0:t.headers};if(!n){const i=cl();i&&(r.Authorization=`Bearer ${i}`)}const s=await fetch(`${_u}${e}`,{...t,headers:r});if(s.status===401){jr(),$s&&$s();const i=await s.json().catch(()=>({detail:"Not authenticated"}));throw new Error(i.detail||"Not authenticated")}if(!s.ok){const i=await s.json().catch(()=>({detail:s.statusText}));throw new Error(i.detail||"API request failed")}if(s.status!==204)return s.json()}const nr={getConfig:()=>le("/auth/config",void 0,!0),login:e=>le("/auth/login",{method:"POST",body:JSON.stringify(e)},!0),getGitHubAuthUrl:()=>`${_u}/auth/github`,getCurrentUser:()=>le("/auth/me"),logout:()=>le("/auth/logout",{method:"POST"})},Mi={list:()=>le("/configs"),create:e=>le("/configs",{method:"POST",body:JSON.stringify(e)}),delete:e=>le(`/configs/${e}`,{method:"DELETE"}),generateVariations:e=>le("/configs/generate-variations",{method:"POST",body:JSON.stringify(e)})},mr={list:e=>{const t=new URLSearchParams;e!=null&&e.category&&t.set("category",e.category),e!=null&&e.suite&&t.set("suite",e.suite);const n=t.toString();return le(`/tasks${n?`?${n}`:""}`)},get:e=>le(`/tasks/${e}`),create:e=>le("/tasks",{method:"POST",body:JSON.stringify(e)}),delete:e=>le(`/tasks/${e}`,{method:"DELETE"}),importSuite:e=>le(`/tasks/import-suite?suite_name=${encodeURIComponent(e)}`,{method:"POST"})},It={list:e=>{const t=e?`?status=${e}`:"";return le(`/jobs${t}`)},get:e=>le(`/jobs/${e}`),create:e=>le("/jobs",{method:"POST",body:JSON.stringify(e)}),start:async function*(e){var o;const t={},n=cl();n&&(t.Authorization=`Bearer ${n}`);const r=await fetch(`${_u}/jobs/${e}/start`,{method:"POST",headers:t});if(r.status===401)throw jr(),$s&&$s(),new Error("Not authenticated");if(!r.ok)throw new Error("Failed to start job");const s=(o=r.body)==null?void 0:o.getReader();if(!s)throw new Error("No response body");const i=new TextDecoder;let l="";for(;;){const{done:u,value:c}=await s.read();if(u)break;l+=i.decode(c,{stream:!0});const p=l.split(` +`);l=p.pop()||"";for(const h of p)h.startsWith("data: ")&&(yield JSON.parse(h.slice(6)))}},cancel:e=>le(`/jobs/${e}/cancel`,{method:"POST"}),delete:e=>le(`/jobs/${e}`,{method:"DELETE"})},So={list:e=>{const t=new URLSearchParams;e!=null&&e.job_id&&t.set("job_id",e.job_id),e!=null&&e.config_name&&t.set("config_name",e.config_name),e!=null&&e.task_name&&t.set("task_name",e.task_name),(e==null?void 0:e.is_pareto)!==void 0&&t.set("is_pareto",String(e.is_pareto));const n=t.toString();return le(`/runs${n?`?${n}`:""}`)},get:e=>le(`/runs/${e}`),getJobSummary:e=>le(`/runs/job/${e}/summary`)},Tu=Cu((e,t)=>(Nx(()=>{e({isAuthenticated:!1,user:null,error:"Session expired. Please log in again."})}),{authConfig:null,isLoadingConfig:!0,isAuthenticated:!1,isLoading:!1,user:null,error:null,loadAuthConfig:async()=>{e({isLoadingConfig:!0});try{const n=await nr.getConfig();if(e({authConfig:n,isLoadingConfig:!1}),n.enabled){const r=cl(),s=kx();if(r&&s)try{const i=await nr.getCurrentUser();e({isAuthenticated:!0,user:i})}catch{jr(),e({isAuthenticated:!1,user:null})}}else e({isAuthenticated:!0,user:{username:"anonymous",auth_mode:"none"}})}catch(n){console.error("Failed to load auth config:",n),e({isLoadingConfig:!1,error:"Failed to connect to server"})}},login:async(n,r)=>{e({isLoading:!0,error:null});try{const s=await nr.login({username:n,password:r});return fd(s.access_token,s.expires_at,s.username),e({isAuthenticated:!0,isLoading:!1,user:{username:s.username,auth_mode:"basic"}}),!0}catch(s){return e({isLoading:!1,error:s instanceof Error?s.message:"Login failed"}),!1}},loginWithGitHub:()=>{window.location.href=nr.getGitHubAuthUrl()},handleOAuthCallback:()=>{const n=new URLSearchParams(window.location.search),r=n.get("auth_error");if(r)return e({error:r}),window.history.replaceState({},"",window.location.pathname),!0;if(n.get("auth_callback")==="true"){const s=n.get("token"),i=n.get("expires_at"),l=n.get("username");return s&&i&&l&&(fd(s,i,l),e({isAuthenticated:!0,user:{username:l,auth_mode:"github"}})),window.history.replaceState({},"",window.location.pathname),!0}return!1},logout:async()=>{try{await nr.logout()}catch{}jr(),e({isAuthenticated:!1,user:null,error:null})},checkAuth:async()=>{const{authConfig:n}=t();if(!(n!=null&&n.enabled)){e({isAuthenticated:!0});return}if(!cl()){e({isAuthenticated:!1,user:null});return}try{const s=await nr.getCurrentUser();e({isAuthenticated:!0,user:s})}catch{jr(),e({isAuthenticated:!1,user:null})}},clearError:()=>e({error:null})}));function Q({variant:e="secondary",size:t="md",className:n="",icon:r,iconRight:s,loading:i=!1,children:l,disabled:o,...u}){const c="font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-1.5",p={primary:"bg-[var(--accent)] text-black hover:bg-[#16a34a]",secondary:"bg-[var(--bg-tertiary)] text-[var(--text-primary)] border border-[var(--border)] hover:bg-[var(--border)]",danger:"bg-[var(--error)] text-white hover:bg-red-600",ghost:"text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)]"},h={sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm"},f=t==="sm"?14:16;return a.jsxs("button",{className:`${c} ${p[e]} ${h[t]} ${n}`,disabled:o||i,...u,children:[i?a.jsx(Tl,{size:f,className:"animate-spin"}):r?a.jsx(r,{size:f}):null,l,s&&!i&&a.jsx(s,{size:f})]})}const Cx={};function _x(e,t){let n;try{n=e()}catch{return}return{getItem:s=>{var i;const l=u=>u===null?null:JSON.parse(u,void 0),o=(i=n.getItem(s))!=null?i:null;return o instanceof Promise?o.then(l):l(o)},setItem:(s,i)=>n.setItem(s,JSON.stringify(i,void 0)),removeItem:s=>n.removeItem(s)}}const Qs=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Qs(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Qs(r)(n)}}}},Ex=(e,t)=>(n,r,s)=>{let i={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:j=>j,version:0,merge:(j,v)=>({...v,...j}),...t},l=!1;const o=new Set,u=new Set;let c;try{c=i.getStorage()}catch{}if(!c)return e((...j)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...j)},r,s);const p=Qs(i.serialize),h=()=>{const j=i.partialize({...r()});let v;const d=p({state:j,version:i.version}).then(g=>c.setItem(i.name,g)).catch(g=>{v=g});if(v)throw v;return d},f=s.setState;s.setState=(j,v)=>{f(j,v),h()};const x=e((...j)=>{n(...j),h()},r,s);let S;const m=()=>{var j;if(!c)return;l=!1,o.forEach(d=>d(r()));const v=((j=i.onRehydrateStorage)==null?void 0:j.call(i,r()))||void 0;return Qs(c.getItem.bind(c))(i.name).then(d=>{if(d)return i.deserialize(d)}).then(d=>{if(d)if(typeof d.version=="number"&&d.version!==i.version){if(i.migrate)return i.migrate(d.state,d.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return d.state}).then(d=>{var g;return S=i.merge(d,(g=r())!=null?g:x),n(S,!0),h()}).then(()=>{v==null||v(S,void 0),l=!0,u.forEach(d=>d(S))}).catch(d=>{v==null||v(void 0,d)})};return s.persist={setOptions:j=>{i={...i,...j},j.getStorage&&(c=j.getStorage())},clearStorage:()=>{c==null||c.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>m(),hasHydrated:()=>l,onHydrate:j=>(o.add(j),()=>{o.delete(j)}),onFinishHydration:j=>(u.add(j),()=>{u.delete(j)})},m(),S||x},Px=(e,t)=>(n,r,s)=>{let i={storage:_x(()=>localStorage),partialize:m=>m,version:0,merge:(m,j)=>({...j,...m}),...t},l=!1;const o=new Set,u=new Set;let c=i.storage;if(!c)return e((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...m)},r,s);const p=()=>{const m=i.partialize({...r()});return c.setItem(i.name,{state:m,version:i.version})},h=s.setState;s.setState=(m,j)=>{h(m,j),p()};const f=e((...m)=>{n(...m),p()},r,s);s.getInitialState=()=>f;let x;const S=()=>{var m,j;if(!c)return;l=!1,o.forEach(d=>{var g;return d((g=r())!=null?g:f)});const v=((j=i.onRehydrateStorage)==null?void 0:j.call(i,(m=r())!=null?m:f))||void 0;return Qs(c.getItem.bind(c))(i.name).then(d=>{if(d)if(typeof d.version=="number"&&d.version!==i.version){if(i.migrate)return[!0,i.migrate(d.state,d.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,d.state];return[!1,void 0]}).then(d=>{var g;const[w,C]=d;if(x=i.merge(C,(g=r())!=null?g:f),n(x,!0),w)return p()}).then(()=>{v==null||v(x,void 0),x=r(),l=!0,u.forEach(d=>d(x))}).catch(d=>{v==null||v(void 0,d)})};return s.persist={setOptions:m=>{i={...i,...m},m.storage&&(c=m.storage)},clearStorage:()=>{c==null||c.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>S(),hasHydrated:()=>l,onHydrate:m=>(o.add(m),()=>{o.delete(m)}),onFinishHydration:m=>(u.add(m),()=>{u.delete(m)})},i.skipHydration||S(),x||f},bx=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((Cx?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Ex(e,t)):Px(e,t),Tx=bx,Ox=Cu()(Tx((e,t)=>({theme:"dark",setTheme:n=>{document.documentElement.setAttribute("data-theme",n),e({theme:n})},toggleTheme:()=>{const n=t().theme==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",n),e({theme:n})}}),{name:"flow-theme",onRehydrateStorage:()=>e=>{e!=null&&e.theme&&document.documentElement.setAttribute("data-theme",e.theme)}}));function Rx(){const{theme:e,toggleTheme:t}=Ox();return a.jsxs("button",{onClick:t,className:"relative w-14 h-7 rounded-full bg-[var(--bg-tertiary)] border border-[var(--border)] transition-colors hover:border-[var(--text-secondary)] focus:outline-none focus:ring-2 focus:ring-[var(--accent)] focus:ring-offset-2 focus:ring-offset-[var(--bg-primary)]","aria-label":`Switch to ${e==="dark"?"light":"dark"} mode`,title:`Switch to ${e==="dark"?"light":"dark"} mode`,children:[a.jsxs("span",{className:"absolute inset-0 flex items-center justify-between px-1.5 pointer-events-none",children:[a.jsx(od,{size:12,className:`transition-opacity ${e==="light"?"opacity-0":"opacity-40"}`}),a.jsx(ad,{size:12,className:`transition-opacity ${e==="dark"?"opacity-0":"opacity-40"}`})]}),a.jsx("span",{className:`absolute top-0.5 w-6 h-6 rounded-full bg-[var(--accent)] shadow-md flex items-center justify-center transition-all duration-200 ease-in-out ${e==="dark"?"left-0.5":"left-[calc(100%-26px)]"}`,children:e==="dark"?a.jsx(ad,{size:12,className:"text-black"}):a.jsx(od,{size:12,className:"text-black"})})]})}const Lx=[{path:"/",label:"Agents",icon:Qy,exact:!0},{path:"/tasks",label:"Tasks",icon:Wy},{path:"/jobs",label:"Jobs",icon:wo}];function Ix(){const e=Jr(),{authConfig:t,user:n,logout:r}=Tu(),s=(l,o)=>o?e.pathname===l||e.pathname==="/agents":e.pathname.startsWith(l),i=async()=>{await r()};return a.jsxs("div",{className:"min-h-screen flex flex-col",children:[a.jsx("header",{className:"border-b border-[var(--border)] bg-[var(--bg-secondary)]",children:a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-8",children:[a.jsxs(id,{to:"/",className:"text-lg font-bold text-[var(--accent)] flex items-center gap-2 hover:opacity-80",children:[a.jsx(Nu,{size:20}),"flow",a.jsx("span",{className:"text-[var(--text-secondary)]",children:"/optimize"})]}),a.jsx("nav",{className:"flex gap-1",children:Lx.map(l=>a.jsxs(id,{to:l.path,className:`px-3 py-1.5 rounded text-sm transition-colors flex items-center gap-2 ${s(l.path,l.exact)?"bg-[var(--accent)] text-black font-medium":"text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)]"}`,children:[a.jsx(l.icon,{size:16}),l.label]},l.path))})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(Rx,{}),(t==null?void 0:t.enabled)&&n&&a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--text-secondary)]",children:[a.jsx(hp,{size:14}),a.jsx("span",{children:n.username})]}),a.jsx(Q,{variant:"ghost",size:"sm",icon:qy,onClick:i,title:"Sign out",children:"Sign out"})]})]})]})}),a.jsx("main",{className:"flex-1 bg-[var(--bg-primary)]",children:a.jsx("div",{className:"max-w-7xl mx-auto p-4",children:a.jsx(jy,{})})})]})}function ke({children:e,className:t="",onClick:n,selected:r=!1,selectable:s=!1}){const i="bg-[var(--bg-secondary)] border border-[var(--border)] p-4",l=s?"cursor-pointer hover:border-[var(--accent-dim)] transition-colors":"",o=r?"border-[var(--accent)]":"";return a.jsx("div",{className:`${i} ${l} ${o} ${t}`,onClick:n,children:e})}function V({children:e,variant:t="default"}){const n={default:"bg-[var(--bg-tertiary)] text-[var(--text-primary)] border border-[var(--border)]",success:"bg-green-600 text-white",warning:"bg-yellow-500 text-black",error:"bg-red-600 text-white",info:"bg-blue-600 text-white"};return a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-medium rounded ${n[t]}`,children:e})}function ei({isOpen:e,onClose:t,title:n,children:r}){return N.useEffect(()=>{const s=i=>{i.key==="Escape"&&t()};return e&&(document.addEventListener("keydown",s),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",s),document.body.style.overflow=""}},[e,t]),e?a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-0 bg-black/80",onClick:t}),a.jsxs("div",{className:"relative bg-[var(--bg-secondary)] border border-[var(--border)] max-w-lg w-full mx-4 max-h-[80vh] overflow-y-auto",children:[a.jsxs("div",{className:"sticky top-0 bg-[var(--bg-secondary)] border-b border-[var(--border)] px-4 py-3 flex items-center justify-between",children:[a.jsx("h2",{className:"font-semibold",children:n}),a.jsx("button",{onClick:t,className:"text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:"×"})]}),a.jsx("div",{className:"p-4",children:r})]})]}):null}function Ie({label:e,className:t="",...n}){return a.jsxs("div",{className:"space-y-1",children:[e&&a.jsx("label",{className:"block text-sm text-[var(--text-secondary)]",children:e}),a.jsx("input",{className:`w-full bg-[var(--bg-primary)] border border-[var(--border)] px-3 py-2 text-sm focus:outline-none focus:border-[var(--accent)] ${t}`,...n})]})}function Mx({label:e,className:t="",...n}){return a.jsxs("div",{className:"space-y-1",children:[e&&a.jsx("label",{className:"block text-sm text-[var(--text-secondary)]",children:e}),a.jsx("textarea",{className:`w-full bg-[var(--bg-primary)] border border-[var(--border)] px-3 py-2 text-sm focus:outline-none focus:border-[var(--accent)] resize-y min-h-[100px] ${t}`,...n})]})}function yt({label:e,className:t="",...n}){return a.jsxs("label",{className:`flex items-center gap-2 cursor-pointer ${t}`,children:[a.jsx("input",{type:"checkbox",className:"w-4 h-4 bg-[var(--bg-primary)] border border-[var(--border)] accent-[var(--accent)]",...n}),a.jsx("span",{className:"text-sm",children:e})]})}function hd(){const e=Gr(),t=Zn(),[n,r]=N.useState(!1),[s,i]=N.useState(null),{data:l=[],isLoading:o}=Lt({queryKey:["configs"],queryFn:Mi.list}),{data:u=[]}=Lt({queryKey:["jobs"],queryFn:()=>It.list()}),c=Ze({mutationFn:Mi.create,onSuccess:()=>{t.invalidateQueries({queryKey:["configs"]}),r(!1)}}),p=Ze({mutationFn:Mi.delete,onSuccess:()=>t.invalidateQueries({queryKey:["configs"]})}),h=f=>{const x=u.filter(j=>j.config_ids.includes(f)),S=x.filter(j=>j.status==="running").length,m=x.filter(j=>j.status==="completed").length;return{running:S,completed:m,total:x.length}};return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold",children:"Agents"}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:"Configure and optimize your agent settings."})]}),a.jsx(Q,{variant:"primary",icon:fp,onClick:()=>r(!0),children:"New Agent"})]}),o?a.jsxs("div",{className:"flex items-center gap-2 text-[var(--text-secondary)]",children:[a.jsx(Tl,{size:16,className:"animate-spin"}),"Loading agents..."]}):l.length===0?a.jsx(zx,{onCreateClick:()=>r(!0)}):a.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:l.map(f=>{const x=h(f.id);return a.jsx(Fx,{agent:f,stats:x,onOptimize:()=>i(f),onDelete:()=>{confirm(`Delete agent "${f.name}"?`)&&p.mutate(f.id)}},f.id)})}),u.length>0&&a.jsxs("div",{className:"mt-8",children:[a.jsx("h3",{className:"text-lg font-medium mb-4",children:"Recent Optimization Jobs"}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:u.slice(0,6).map(f=>{const x=f.total_experiments>0?f.completed_experiments/f.total_experiments*100:0;return a.jsxs(ke,{className:"cursor-pointer hover:border-[var(--accent-dim)] flex flex-col",onClick:()=>e(`/jobs/${f.id}`),children:[a.jsx("div",{className:"flex items-start justify-between mb-3",children:a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx(V,{variant:f.status==="completed"?"success":f.status==="running"?"info":f.status==="failed"?"error":"default",children:f.status}),f.pareto_frontier.length>0&&a.jsxs(V,{variant:"success",children:[f.pareto_frontier.length," Pareto"]}),f.use_llm_eval&&a.jsx(V,{children:"LLM"})]}),a.jsx("h3",{className:"font-medium mt-2 truncate",title:f.name||`Job ${f.id.slice(0,8)}`,children:f.name||`Job ${f.id.slice(0,8)}`}),a.jsxs("code",{className:"text-xs text-[var(--text-secondary)] font-mono",children:[f.id.slice(0,8),"..."]})]})}),(f.status==="running"||f.status==="completed")&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"flex justify-between text-xs text-[var(--text-secondary)] mb-1",children:[a.jsx("span",{children:"Progress"}),a.jsxs("span",{children:[f.completed_experiments,"/",f.total_experiments]})]}),a.jsx("div",{className:"w-full bg-[var(--bg-primary)] h-1.5 rounded-full overflow-hidden",children:a.jsx("div",{className:`h-full transition-all ${f.status==="completed"?"bg-green-500":"bg-[var(--accent)]"}`,style:{width:`${x}%`}})})]}),f.status==="failed"&&f.error&&a.jsx("div",{className:"mb-3 px-2 py-1.5 bg-red-500/10 border border-red-500/30 rounded text-xs text-red-400 line-clamp-2",children:f.error}),a.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center py-2 border-t border-[var(--border)] mt-auto",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-lg font-bold",children:f.config_ids.length}),a.jsx("div",{className:"text-xs text-[var(--text-secondary)]",children:"configs"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-lg font-bold",children:f.task_ids.length}),a.jsx("div",{className:"text-xs text-[var(--text-secondary)]",children:"tasks"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-lg font-bold",children:f.total_experiments}),a.jsx("div",{className:"text-xs text-[var(--text-secondary)]",children:"runs"})]})]}),a.jsxs("div",{className:"text-xs text-[var(--text-secondary)] pt-2 border-t border-[var(--border)]",children:[new Date(f.created_at).toLocaleDateString()," ",new Date(f.created_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]},f.id)})}),u.length>6&&a.jsxs(Q,{variant:"ghost",className:"mt-4",onClick:()=>e("/jobs"),children:["View all ",u.length," jobs →"]})]}),a.jsx(Dx,{isOpen:n,onClose:()=>r(!1),onSubmit:f=>c.mutate(f),isLoading:c.isPending}),s&&a.jsx(Ax,{agent:s,isOpen:!!s,onClose:()=>i(null)})]})}function zx({onCreateClick:e}){return a.jsxs("div",{className:"text-center py-16 border border-dashed border-[var(--border)] rounded-lg",children:[a.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-[var(--bg-tertiary)] mb-4",children:a.jsx(Jy,{size:24,className:"text-[var(--text-secondary)]"})}),a.jsx("h3",{className:"text-lg font-medium mb-2",children:"No agents yet"}),a.jsx("p",{className:"text-[var(--text-secondary)] mb-4 max-w-md mx-auto",children:"Create your first agent configuration to start optimizing. Each agent can have different settings like compaction, memory, and timeouts."}),a.jsx(Q,{variant:"primary",icon:fp,onClick:e,children:"Create Your First Agent"})]})}function Fx({agent:e,stats:t,onOptimize:n,onDelete:r}){return a.jsxs(ke,{className:"flex flex-col",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg",children:e.name}),e.description&&a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:e.description})]}),a.jsx(Q,{variant:"ghost",size:"sm",icon:Gy,onClick:s=>{s.stopPropagation(),r()}})]}),a.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[e.config.enable_message_compaction&&a.jsxs(V,{children:["compaction ",e.config.compaction_head_size,"/",e.config.compaction_tail_size]}),e.config.enable_memory_tool&&a.jsx(V,{children:"memory"}),e.config.enable_sub_agent&&a.jsx(V,{children:"sub-agent"}),a.jsxs(V,{children:["timeout: ",e.config.bash_timeout,"s"]})]}),t.total>0&&a.jsxs("div",{className:"text-xs text-[var(--text-secondary)] mb-3",children:[t.running>0&&a.jsxs("span",{className:"text-[var(--accent)]",children:[t.running," running "]}),t.completed>0&&a.jsxs("span",{children:[t.completed," completed"]})]})]}),a.jsx(Q,{variant:"primary",icon:Nu,onClick:n,className:"w-full",children:"Optimize"})]})}function Dx({isOpen:e,onClose:t,onSubmit:n,isLoading:r}){const[s,i]=N.useState({name:"",description:"",enable_message_compaction:!0,enable_memory_tool:!0,enable_sub_agent:!1,compaction_head_size:10,compaction_tail_size:40,bash_timeout:120}),l=o=>{o.preventDefault(),s.name.trim()&&n(s)};return a.jsx(ei,{isOpen:e,onClose:t,title:"Create Agent",children:a.jsxs("form",{onSubmit:l,className:"space-y-4",children:[a.jsx(Ie,{label:"Name",value:s.name,onChange:o=>i({...s,name:o.target.value}),placeholder:"e.g., baseline, fast-compaction",required:!0}),a.jsx(Ie,{label:"Description (optional)",value:s.description,onChange:o=>i({...s,description:o.target.value}),placeholder:"Brief description of this agent configuration"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(yt,{label:"Enable message compaction",checked:s.enable_message_compaction,onChange:o=>i({...s,enable_message_compaction:o.target.checked})}),s.enable_message_compaction&&a.jsxs("div",{className:"ml-6 grid grid-cols-2 gap-3",children:[a.jsx(Ie,{label:"Head size",type:"number",value:s.compaction_head_size,onChange:o=>i({...s,compaction_head_size:parseInt(o.target.value)||10}),min:1}),a.jsx(Ie,{label:"Tail size",type:"number",value:s.compaction_tail_size,onChange:o=>i({...s,compaction_tail_size:parseInt(o.target.value)||40}),min:1})]}),a.jsx(yt,{label:"Enable memory tool",checked:s.enable_memory_tool,onChange:o=>i({...s,enable_memory_tool:o.target.checked})}),a.jsx(yt,{label:"Enable sub-agent",checked:s.enable_sub_agent,onChange:o=>i({...s,enable_sub_agent:o.target.checked})})]}),a.jsx(Ie,{label:"Bash timeout (seconds)",type:"number",value:s.bash_timeout,onChange:o=>i({...s,bash_timeout:parseInt(o.target.value)||120}),min:10}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[a.jsx(Q,{type:"button",variant:"secondary",onClick:t,children:"Cancel"}),a.jsx(Q,{type:"submit",variant:"primary",disabled:!s.name.trim(),loading:r,children:"Create Agent"})]})]})})}function Ax({agent:e,isOpen:t,onClose:n}){var z,F,Y;const r=Gr(),s=Zn(),[i,l]=N.useState("suite"),[o,u]=N.useState("quick"),[c,p]=N.useState(!1),[h,f]=N.useState([]),[x,S]=N.useState(!1),[m,j]=N.useState({base_name:e.name,vary_compaction:!1,vary_memory:!1,vary_sub_agent:!1,vary_compaction_head:!1,vary_compaction_tail:!1,compaction_head_values:[5,10,20],compaction_tail_values:[20,40,60]}),[v,d]=N.useState(4),[g,w]=N.useState(!1),[C,_]=N.useState(null),{data:P=[]}=Lt({queryKey:["tasks"],queryFn:()=>mr.list()}),k=Ze({mutationFn:mr.importSuite,onSuccess:b=>{s.invalidateQueries({queryKey:["tasks"]}),f(b.map(B=>B.id))}}),L=Ze({mutationFn:Mi.generateVariations,onSuccess:()=>{s.invalidateQueries({queryKey:["configs"]})}}),I=Ze({mutationFn:async b=>{const B=await It.create(b);return It.start(B.id).next(),B},onSuccess:b=>{s.invalidateQueries({queryKey:["jobs"]}),_(b.id),l("success")}}),q=[{value:"quick",label:"Quick",description:"3 fast tasks for rapid testing",tasks:3},{value:"core",label:"Core",description:"5 standard evaluation tasks",tasks:5},{value:"coding",label:"Coding",description:"10 comprehensive coding tasks",tasks:10}],Ae=()=>{var B,ye;if(!x)return 1;let b=1;return m.vary_compaction&&(b*=2),m.vary_memory&&(b*=2),m.vary_sub_agent&&(b*=2),m.vary_compaction_head&&(b*=((B=m.compaction_head_values)==null?void 0:B.length)||3),m.vary_compaction_tail&&(b*=((ye=m.compaction_tail_values)==null?void 0:ye.length)||3),b},dt=async()=>{l("starting");let b=h,B=[e.id];if(!c)try{b=(await k.mutateAsync(o)).map(Qt=>Qt.id)}catch(Ue){console.error("Failed to import suite:",Ue),alert(`Failed to import task suite: ${o}`),l("variations");return}if(b.length===0){alert("No tasks selected. Please select tasks or choose a task suite."),l("variations");return}if(x)try{B=(await L.mutateAsync({...m,base_name:e.name})).map(Qt=>Qt.id)}catch(Ue){console.error("Failed to generate config variations:",Ue),alert("Failed to generate config variations"),l("variations");return}const ye=Ae(),Yr={name:x?`${e.name} ablation (${ye} configs × ${b.length} tasks)`:`${e.name} - ${o}`,config_ids:B,task_ids:b,parallel:v,use_llm_eval:g};I.mutate(Yr)},jt=b=>{f(B=>B.includes(b)?B.filter(ye=>ye!==b):[...B,b])},ft=()=>{l("suite"),_(null),S(!1),n()},_n=Ae(),er=c?h.length:((z=q.find(b=>b.value===o))==null?void 0:z.tasks)||3,O=_n*er;return a.jsx(ei,{isOpen:t,onClose:ft,title:`Optimize: ${e.name}`,children:i==="success"&&C?a.jsxs("div",{className:"flex flex-col items-center py-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-green-500/20 flex items-center justify-center mb-4",children:a.jsx(Nu,{size:24,className:"text-green-500"})}),a.jsx("h3",{className:"text-lg font-medium mb-2",children:"Job Started!"}),a.jsx("p",{className:"text-[var(--text-secondary)] text-center mb-2",children:"Optimization job is now running"}),a.jsxs("code",{className:"text-xs bg-[var(--bg-primary)] px-3 py-1.5 rounded font-mono mb-6",children:["ID: ",C.slice(0,8),"..."]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(Q,{variant:"secondary",onClick:ft,children:"Close"}),a.jsx(Q,{variant:"primary",icon:wo,onClick:()=>{ft(),r(`/jobs/${C}`)},children:"View Job"})]})]}):i==="starting"?a.jsxs("div",{className:"flex flex-col items-center py-8",children:[a.jsx(Tl,{size:32,className:"animate-spin text-[var(--accent)] mb-4"}),a.jsx("p",{className:"text-[var(--text-secondary)]",children:L.isPending?"Generating config variations...":k.isPending?"Importing tasks...":"Creating optimization job..."})]}):i==="variations"?a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--text-secondary)]",children:[a.jsx("span",{className:"text-[var(--text-primary)]",children:"1. Tasks"}),a.jsx(Ii,{size:14}),a.jsx("span",{className:"text-[var(--accent)] font-medium",children:"2. Config Variations"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:`flex items-center gap-3 p-4 border cursor-pointer transition-colors ${x?"border-[var(--border)] hover:border-[var(--accent-dim)]":"border-[var(--accent)] bg-[var(--accent)]/10"}`,children:[a.jsx("input",{type:"radio",checked:!x,onChange:()=>S(!1),className:"accent-[var(--accent)]"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("span",{className:"font-medium",children:"Single Config (Baseline)"}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"Run tasks with current agent settings only"})]}),a.jsx(V,{children:"1 config"})]}),a.jsxs("label",{className:`flex items-center gap-3 p-4 border cursor-pointer transition-colors mt-2 ${x?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--border)] hover:border-[var(--accent-dim)]"}`,children:[a.jsx("input",{type:"radio",checked:x,onChange:()=>S(!0),className:"accent-[var(--accent)]"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("span",{className:"font-medium",children:"Ablation Study"}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"Compare multiple config variations to find optimal settings"})]}),x&&a.jsxs(V,{variant:"info",children:[_n," configs"]})]})]}),x&&a.jsxs("div",{className:"space-y-4 p-4 border border-[var(--border)] bg-[var(--bg-secondary)]",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Select variations to test:"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(yt,{label:"Compaction (on/off)",checked:m.vary_compaction,onChange:b=>j({...m,vary_compaction:b.target.checked})}),a.jsx("p",{className:"text-xs text-[var(--text-secondary)] ml-6 -mt-1",children:"Test with message compaction enabled vs disabled"}),a.jsx(yt,{label:"Memory Tool (on/off)",checked:m.vary_memory,onChange:b=>j({...m,vary_memory:b.target.checked})}),a.jsx("p",{className:"text-xs text-[var(--text-secondary)] ml-6 -mt-1",children:"Test with agent memory tool enabled vs disabled"}),a.jsx(yt,{label:"Sub-Agent (on/off)",checked:m.vary_sub_agent,onChange:b=>j({...m,vary_sub_agent:b.target.checked})}),a.jsx("p",{className:"text-xs text-[var(--text-secondary)] ml-6 -mt-1",children:"Test with sub-agent delegation enabled vs disabled"})]}),a.jsxs("div",{className:"border-t border-[var(--border)] pt-3 mt-3 space-y-2",children:[a.jsx(yt,{label:"Compaction Head Size",checked:m.vary_compaction_head,onChange:b=>j({...m,vary_compaction_head:b.target.checked})}),m.vary_compaction_head&&a.jsx(Ie,{label:"Head sizes (comma-separated)",value:((F=m.compaction_head_values)==null?void 0:F.join(", "))||"5, 10, 20",onChange:b=>j({...m,compaction_head_values:b.target.value.split(",").map(B=>parseInt(B.trim())).filter(B=>!isNaN(B))})}),a.jsx(yt,{label:"Compaction Tail Size",checked:m.vary_compaction_tail,onChange:b=>j({...m,vary_compaction_tail:b.target.checked})}),m.vary_compaction_tail&&a.jsx(Ie,{label:"Tail sizes (comma-separated)",value:((Y=m.compaction_tail_values)==null?void 0:Y.join(", "))||"20, 40, 60",onChange:b=>j({...m,compaction_tail_values:b.target.value.split(",").map(B=>parseInt(B.trim())).filter(B=>!isNaN(B))})})]}),a.jsxs("div",{className:"bg-[var(--bg-tertiary)] p-3 rounded text-sm",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{children:"Configurations:"}),a.jsx("span",{className:"font-mono",children:_n})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{children:"Tasks:"}),a.jsx("span",{className:"font-mono",children:er})]}),a.jsxs("div",{className:"flex justify-between font-medium border-t border-[var(--border)] pt-2 mt-2",children:[a.jsx("span",{children:"Total experiments:"}),a.jsx("span",{className:"font-mono text-[var(--accent)]",children:O})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Ie,{label:"Parallel Workers",type:"number",value:v,onChange:b=>d(parseInt(b.target.value)||1),min:1,max:16}),a.jsx("div",{className:"flex items-end pb-1",children:a.jsx(yt,{label:"Use LLM evaluation",checked:g,onChange:b=>w(b.target.checked)})})]}),a.jsxs("div",{className:"flex justify-between gap-2 pt-4 border-t border-[var(--border)]",children:[a.jsx(Q,{variant:"secondary",icon:Vy,onClick:()=>l("suite"),children:"Back"}),a.jsxs(Q,{variant:"primary",icon:wo,onClick:dt,children:["Start Optimization (",O," runs)"]})]})]}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--text-secondary)]",children:[a.jsx("span",{className:"text-[var(--accent)] font-medium",children:"1. Tasks"}),a.jsx(Ii,{size:14}),a.jsx("span",{children:"2. Config Variations"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium mb-3 block",children:"Select Task Suite"}),a.jsx("div",{className:"space-y-2",children:q.map(b=>{const B=P.filter(ye=>ye.suite===b.value).length;return a.jsxs("label",{className:`flex items-center gap-3 p-3 border cursor-pointer transition-colors ${o===b.value&&!c?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--border)] hover:border-[var(--accent-dim)]"}`,children:[a.jsx("input",{type:"radio",name:"suite",value:b.value,checked:o===b.value&&!c,onChange:()=>{u(b.value),p(!1)},className:"accent-[var(--accent)]"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium",children:b.label}),a.jsxs(V,{children:[b.tasks," tasks"]}),B>0&&a.jsxs(V,{variant:"success",children:[B," imported"]})]}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:b.description})]})]},b.value)})})]}),P.length>0&&a.jsxs("div",{children:[a.jsxs("label",{className:`flex items-center gap-3 p-3 border cursor-pointer transition-colors ${c?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--border)] hover:border-[var(--accent-dim)]"}`,children:[a.jsx("input",{type:"radio",checked:c,onChange:()=>p(!0),className:"accent-[var(--accent)]"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("span",{className:"font-medium",children:"Custom Selection"}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"Choose specific tasks from your library"})]})]}),c&&a.jsx("div",{className:"mt-3 max-h-48 overflow-y-auto border border-[var(--border)] p-2 space-y-1",children:P.map(b=>a.jsxs("label",{className:"flex items-center gap-2 p-2 hover:bg-[var(--bg-tertiary)] cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:h.includes(b.id),onChange:()=>jt(b.id),className:"accent-[var(--accent)]"}),a.jsx("span",{className:"text-sm",children:b.name}),b.suite&&a.jsx(V,{children:b.suite})]},b.id))})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-[var(--border)]",children:[a.jsx(Q,{variant:"secondary",onClick:n,children:"Cancel"}),a.jsx(Q,{variant:"primary",icon:Ii,onClick:()=>l("variations"),disabled:c&&h.length===0,children:"Next: Config Variations"})]})]})})}const xp=Cu(e=>({configs:[],selectedConfigIds:[],setConfigs:t=>e({configs:t}),toggleConfigSelection:t=>e(n=>({selectedConfigIds:n.selectedConfigIds.includes(t)?n.selectedConfigIds.filter(r=>r!==t):[...n.selectedConfigIds,t]})),clearConfigSelection:()=>e({selectedConfigIds:[]}),tasks:[],selectedTaskIds:[],setTasks:t=>e({tasks:t}),toggleTaskSelection:t=>e(n=>({selectedTaskIds:n.selectedTaskIds.includes(t)?n.selectedTaskIds.filter(r=>r!==t):[...n.selectedTaskIds,t]})),clearTaskSelection:()=>e({selectedTaskIds:[]}),jobs:[],currentJob:null,jobProgress:null,setJobs:t=>e({jobs:t}),setCurrentJob:t=>e({currentJob:t}),setJobProgress:t=>e({jobProgress:t}),updateJob:t=>e(n=>{var r;return{jobs:n.jobs.map(s=>s.id===t.id?t:s),currentJob:((r=n.currentJob)==null?void 0:r.id)===t.id?t:n.currentJob}}),runs:[],setRuns:t=>e({runs:t}),isCreatingJob:!1,setIsCreatingJob:t=>e({isCreatingJob:t})}));function Ux(){const e=Zn(),[t,n]=N.useState(!1),[r,s]=N.useState(!1),[i,l]=N.useState(new Set(["custom"])),{selectedTaskIds:o,toggleTaskSelection:u,setTasks:c}=xp(),p=d=>{l(g=>{const w=new Set(g);return w.has(d)?w.delete(d):w.add(d),w})},{data:h=[],isLoading:f}=Lt({queryKey:["tasks"],queryFn:()=>mr.list()});N.useEffect(()=>{h.length>0&&c(h)},[h,c]);const x=Ze({mutationFn:mr.create,onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),n(!1)}}),S=Ze({mutationFn:mr.importSuite,onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),s(!1)}}),m=Ze({mutationFn:mr.delete,onSuccess:()=>e.invalidateQueries({queryKey:["tasks"]})}),j=h.reduce((d,g)=>{const w=g.suite||"custom";return d[w]||(d[w]=[]),d[w].push(g),d},{}),v=Object.keys(j).sort((d,g)=>d==="custom"?-1:g==="custom"?1:d.localeCompare(g));return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold",children:"Tasks"}),a.jsxs("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:["Define tasks to evaluate agent configurations.",o.length>0&&a.jsxs("span",{className:"ml-2 text-[var(--accent)]",children:[o.length," selected"]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Q,{variant:"secondary",onClick:()=>s(!0),children:"Import Suite"}),a.jsx(Q,{variant:"primary",onClick:()=>n(!0),children:"+ New Task"})]})]}),f?a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Loading..."}):h.length===0?a.jsx("div",{className:"text-center py-12 text-[var(--text-secondary)]",children:"No tasks yet. Create one or import a built-in suite."}):a.jsx("div",{className:"space-y-4",children:v.map(d=>{const g=j[d],w=i.has(d),C=g.filter(_=>o.includes(_.id)).length;return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>p(d),className:"flex items-center gap-2 py-2 hover:text-[var(--accent)] transition-colors",children:[w?a.jsx(By,{size:16,className:"text-[var(--text-secondary)]"}):a.jsx(Ii,{size:16,className:"text-[var(--text-secondary)]"}),a.jsx("h3",{className:"text-sm font-medium uppercase tracking-wide",children:d==="custom"?"Custom Tasks":`${d} Suite`}),a.jsx(V,{variant:d==="custom"?"default":"info",children:g.length}),C>0&&a.jsxs(V,{variant:"success",children:[C," selected"]})]}),w&&a.jsx("div",{className:"grid gap-2 mt-2",children:g.map(_=>a.jsx(ke,{selectable:!0,selected:o.includes(_.id),onClick:()=>u(_.id),children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium",children:_.name}),o.includes(_.id)&&a.jsx(V,{variant:"success",children:"Selected"}),_.category&&_.category!=="default"&&a.jsx(V,{variant:"default",children:_.category})]}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1 line-clamp-2",children:_.prompt}),_.criteria.length>0&&a.jsx("div",{className:"flex gap-1 mt-2 flex-wrap",children:_.criteria.map(P=>a.jsx(V,{variant:"default",children:P.name},P.name))})]}),a.jsx(Q,{variant:"ghost",size:"sm",onClick:P=>{P.stopPropagation(),confirm("Delete this task?")&&m.mutate(_.id)},children:"Delete"})]})},_.id))})]},d)})}),a.jsx($x,{isOpen:t,onClose:()=>n(!1),onSubmit:d=>x.mutate(d),isLoading:x.isPending}),a.jsx(Qx,{isOpen:r,onClose:()=>s(!1),onSubmit:d=>S.mutate(d),isLoading:S.isPending})]})}function $x({isOpen:e,onClose:t,onSubmit:n,isLoading:r}){const[s,i]=N.useState({name:"",prompt:"",criteria:[],category:"default"}),l=()=>{i({...s,criteria:[...s.criteria,{name:"",instruction:"",weight:1}]})},o=(p,h)=>{const f=[...s.criteria];f[p]={...f[p],...h},i({...s,criteria:f})},u=p=>{i({...s,criteria:s.criteria.filter((h,f)=>f!==p)})},c=p=>{p.preventDefault(),!(!s.name.trim()||!s.prompt.trim())&&n({...s,criteria:s.criteria.filter(h=>h.name.trim()&&h.instruction.trim())})};return a.jsx(ei,{isOpen:e,onClose:t,title:"Create Task",children:a.jsxs("form",{onSubmit:c,className:"space-y-4",children:[a.jsx(Ie,{label:"Name",value:s.name,onChange:p=>i({...s,name:p.target.value}),placeholder:"e.g., fizzbuzz",required:!0}),a.jsx(Mx,{label:"Prompt",value:s.prompt,onChange:p=>i({...s,prompt:p.target.value}),placeholder:"The task description for the agent...",required:!0}),a.jsx(Ie,{label:"Category",value:s.category,onChange:p=>i({...s,category:p.target.value}),placeholder:"e.g., coding, research"}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("label",{className:"text-sm text-[var(--text-secondary)]",children:"Evaluation Criteria"}),a.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:l,children:"+ Add"})]}),a.jsx("div",{className:"space-y-2",children:s.criteria.map((p,h)=>a.jsxs("div",{className:"flex gap-2 items-start",children:[a.jsx(Ie,{value:p.name,onChange:f=>o(h,{name:f.target.value}),placeholder:"Name",className:"w-32"}),a.jsx(Ie,{value:p.instruction,onChange:f=>o(h,{instruction:f.target.value}),placeholder:"Instruction",className:"flex-1"}),a.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>u(h),children:"×"})]},h))})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[a.jsx(Q,{type:"button",variant:"secondary",onClick:t,children:"Cancel"}),a.jsx(Q,{type:"submit",variant:"primary",disabled:r||!s.name.trim()||!s.prompt.trim(),children:r?"Creating...":"Create"})]})]})})}function Qx({isOpen:e,onClose:t,onSubmit:n,isLoading:r}){const[s,i]=N.useState("quick"),l=[{value:"quick",label:"Quick (3 tasks) - Fast testing"},{value:"core",label:"Core (5 tasks) - Standard evaluation"},{value:"coding",label:"Coding (10 tasks) - Comprehensive coding"}];return a.jsx(ei,{isOpen:e,onClose:t,title:"Import Task Suite",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"Import a built-in task suite for evaluation."}),a.jsx("div",{className:"space-y-2",children:l.map(o=>a.jsxs("label",{className:`flex items-center gap-3 p-3 border cursor-pointer ${s===o.value?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--border)] hover:border-[var(--accent-dim)]"}`,children:[a.jsx("input",{type:"radio",name:"suite",value:o.value,checked:s===o.value,onChange:()=>i(o.value),className:"accent-[var(--accent)]"}),a.jsx("span",{children:o.label})]},o.value))}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[a.jsx(Q,{type:"button",variant:"secondary",onClick:t,children:"Cancel"}),a.jsx(Q,{variant:"primary",onClick:()=>n(s),disabled:r,children:r?"Importing...":"Import"})]})]})})}function Bx(){const e=Gr(),t=Zn(),[n,r]=N.useState(!1),{selectedConfigIds:s,selectedTaskIds:i,configs:l,tasks:o,setJobs:u}=xp(),{data:c=[],isLoading:p}=Lt({queryKey:["jobs"],queryFn:()=>It.list(),refetchInterval:5e3});N.useEffect(()=>{c.length>0&&u(c)},[c,u]);const h=Ze({mutationFn:It.create,onSuccess:m=>{t.invalidateQueries({queryKey:["jobs"]}),r(!1),e(`/jobs/${m.id}`)}}),f=Ze({mutationFn:It.delete,onSuccess:()=>t.invalidateQueries({queryKey:["jobs"]})}),x=s.length>0&&i.length>0,S=m=>{const j={pending:"default",running:"info",completed:"success",failed:"error",cancelled:"warning"};return a.jsx(V,{variant:j[m]||"default",children:m})};return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold",children:"Optimization Jobs"}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:"Run and track optimization experiments."})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[!x&&a.jsx("span",{className:"text-sm text-[var(--text-secondary)]",children:"Select configs and tasks first"}),a.jsxs(Q,{variant:"primary",onClick:()=>r(!0),disabled:!x,children:["+ New Job (",s.length,"×",i.length,")"]})]})]}),p?a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Loading..."}):c.length===0?a.jsx("div",{className:"text-center py-12 text-[var(--text-secondary)]",children:"No jobs yet. Select configs and tasks, then create a job."}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:c.map(m=>{const j=m.total_experiments>0?m.completed_experiments/m.total_experiments*100:0;return a.jsxs(ke,{className:"cursor-pointer hover:border-[var(--accent-dim)] flex flex-col",onClick:()=>e(`/jobs/${m.id}`),children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[S(m.status),m.pareto_frontier.length>0&&a.jsxs(V,{variant:"success",children:[m.pareto_frontier.length," Pareto"]}),m.use_llm_eval&&a.jsx(V,{children:"LLM"})]}),a.jsx("h3",{className:"font-medium mt-2 truncate",title:m.name||`Job ${m.id.slice(0,8)}`,children:m.name||`Job ${m.id.slice(0,8)}`}),a.jsxs("code",{className:"text-xs text-[var(--text-secondary)] font-mono",children:[m.id.slice(0,8),"..."]})]}),a.jsx(Q,{variant:"ghost",size:"sm",onClick:v=>{v.stopPropagation(),confirm("Delete this job?")&&f.mutate(m.id)},disabled:m.status==="running",children:"×"})]}),(m.status==="running"||m.status==="completed")&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"flex justify-between text-xs text-[var(--text-secondary)] mb-1",children:[a.jsx("span",{children:"Progress"}),a.jsxs("span",{children:[m.completed_experiments,"/",m.total_experiments]})]}),a.jsx("div",{className:"w-full bg-[var(--bg-primary)] h-1.5 rounded-full overflow-hidden",children:a.jsx("div",{className:`h-full transition-all ${m.status==="completed"?"bg-green-500":"bg-[var(--accent)]"}`,style:{width:`${j}%`}})})]}),m.status==="failed"&&m.error&&a.jsx("div",{className:"mb-3 px-2 py-1.5 bg-red-500/10 border border-red-500/30 rounded text-xs text-red-400 line-clamp-2",children:m.error}),a.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center py-2 border-t border-[var(--border)] mt-auto",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-lg font-bold",children:m.config_ids.length}),a.jsx("div",{className:"text-xs text-[var(--text-secondary)]",children:"configs"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-lg font-bold",children:m.task_ids.length}),a.jsx("div",{className:"text-xs text-[var(--text-secondary)]",children:"tasks"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-lg font-bold",children:m.total_experiments}),a.jsx("div",{className:"text-xs text-[var(--text-secondary)]",children:"runs"})]})]}),a.jsxs("div",{className:"text-xs text-[var(--text-secondary)] pt-2 border-t border-[var(--border)]",children:[new Date(m.created_at).toLocaleDateString()," ",new Date(m.created_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]},m.id)})}),a.jsx(Vx,{isOpen:n,onClose:()=>r(!1),onSubmit:m=>h.mutate(m),isLoading:h.isPending,selectedConfigs:l.filter(m=>s.includes(m.id)),selectedTasks:o.filter(m=>i.includes(m.id))})]})}function Vx({isOpen:e,onClose:t,onSubmit:n,isLoading:r,selectedConfigs:s,selectedTasks:i}){const[l,o]=N.useState({name:"",parallel:4,use_llm_eval:!1}),u=p=>{p.preventDefault(),n({...l,config_ids:s.map(h=>h.id),task_ids:i.map(h=>h.id)})},c=s.length*i.length;return a.jsx(ei,{isOpen:e,onClose:t,title:"Create Optimization Job",children:a.jsxs("form",{onSubmit:u,className:"space-y-4",children:[a.jsx(Ie,{label:"Job Name (optional)",value:l.name,onChange:p=>o({...l,name:p.target.value}),placeholder:"e.g., compaction-test-v1"}),a.jsxs("div",{className:"bg-[var(--bg-primary)] border border-[var(--border)] p-3",children:[a.jsx("div",{className:"text-sm font-medium mb-2",children:"Selected Configurations"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:s.map(p=>a.jsx(V,{children:p.name},p.id))})]}),a.jsxs("div",{className:"bg-[var(--bg-primary)] border border-[var(--border)] p-3",children:[a.jsx("div",{className:"text-sm font-medium mb-2",children:"Selected Tasks"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:i.map(p=>a.jsx(V,{children:p.name},p.id))})]}),a.jsxs("div",{className:"text-sm text-[var(--text-secondary)]",children:["Total experiments: ",a.jsx("span",{className:"text-[var(--accent)]",children:c})]}),a.jsx(Ie,{label:"Parallel Workers",type:"number",value:l.parallel,onChange:p=>o({...l,parallel:parseInt(p.target.value)||1}),min:1,max:16}),a.jsx(yt,{label:"Use LLM evaluation (more accurate but slower)",checked:l.use_llm_eval,onChange:p=>o({...l,use_llm_eval:p.target.checked})}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[a.jsx(Q,{type:"button",variant:"secondary",onClick:t,children:"Cancel"}),a.jsx(Q,{type:"submit",variant:"primary",disabled:r,children:r?"Creating...":"Create & Start"})]})]})})}function Hx(e,t=!0){return Math.abs(e)<10?"text-[var(--text-secondary)]":(t?e<0:e>0)?"text-green-400":"text-red-400"}function Wx(e){return`${e>0?"+":""}${e.toFixed(1)}%`}function wp(e,t){return t===0?0:(e-t)/t*100}function ls({label:e,values:t,baselineIndex:n,formatter:r,isLowerBetter:s=!0}){const i=t[n];return a.jsxs("tr",{className:"border-b border-[var(--border)] last:border-0",children:[a.jsx("td",{className:"py-2 pr-4 text-[var(--text-secondary)] text-sm",children:e}),t.map((l,o)=>{const u=wp(l,i),c=o===n;return a.jsxs("td",{className:"py-2 px-4 text-right",children:[a.jsx("div",{className:"font-mono",children:r(l)}),!c&&a.jsx("div",{className:`text-xs ${Hx(u,s)}`,children:Wx(u)}),c&&a.jsx("div",{className:"text-xs text-[var(--text-secondary)]",children:"(baseline)"})]},o)})]})}function Kx({runs:e,baselineRunId:t}){const n=N.useMemo(()=>{if(t){const i=e.findIndex(l=>l.id===t);if(i>=0)return i}return 0},[e,t]);if(e.length<2)return null;const r=Math.min(...e.map(i=>i.tokens_total)),s=Math.max(...e.map(i=>i.score));return a.jsxs(ke,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-4",children:"Config Comparison"}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-[var(--border)]",children:[a.jsx("th",{className:"pb-2 pr-4 text-left text-[var(--text-secondary)] font-medium",children:"Metric"}),e.map((i,l)=>a.jsx("th",{className:"pb-2 px-4 text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("span",{className:"font-medium",children:i.config_name}),i.is_pareto&&a.jsx(V,{variant:"success",children:"Pareto"}),l===n&&a.jsx(V,{variant:"info",children:"Base"})]})},i.id))]})}),a.jsxs("tbody",{children:[a.jsx(ls,{label:"Total Tokens",values:e.map(i=>i.tokens_total),baselineIndex:n,formatter:i=>i.toLocaleString(),isLowerBetter:!0}),a.jsx(ls,{label:"Input Tokens",values:e.map(i=>i.tokens_input),baselineIndex:n,formatter:i=>i.toLocaleString(),isLowerBetter:!0}),a.jsx(ls,{label:"Output Tokens",values:e.map(i=>i.tokens_output),baselineIndex:n,formatter:i=>i.toLocaleString(),isLowerBetter:!0}),a.jsx(ls,{label:"Duration",values:e.map(i=>i.duration_seconds),baselineIndex:n,formatter:i=>`${i.toFixed(1)}s`,isLowerBetter:!0}),a.jsx(ls,{label:"Score",values:e.map(i=>i.score*100),baselineIndex:n,formatter:i=>`${i.toFixed(1)}%`,isLowerBetter:!1})]})]})}),a.jsxs("div",{className:"mt-4 pt-4 border-t border-[var(--border)]",children:[a.jsx("h4",{className:"text-sm font-medium mb-2 text-[var(--text-secondary)]",children:"Key Insights"}),a.jsxs("ul",{className:"text-sm space-y-1 text-[var(--text-secondary)]",children:[e.map(i=>{const l=wp(i.tokens_total,e[n].tokens_total);return i.tokens_total===r&&l<-5?a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-green-400",children:"✓"}),a.jsxs("span",{children:[a.jsx("strong",{children:i.config_name})," uses ",Math.abs(l).toFixed(0),"% fewer tokens"]})]},`token-${i.id}`):null}),e.map(i=>i.score===s&&i.passed?a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-green-400",children:"✓"}),a.jsxs("span",{children:[a.jsx("strong",{children:i.config_name})," achieved highest score (",(i.score*100).toFixed(0),"%)"]})]},`score-${i.id}`):null),e.filter(i=>i.is_pareto).length>0&&a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-purple-400",children:"★"}),a.jsxs("span",{children:["Pareto-optimal configs:"," ",e.filter(i=>i.is_pareto).map(i=>i.config_name).join(", ")]})]})]})]}),a.jsxs("div",{className:"mt-4 pt-4 border-t border-[var(--border)]",children:[a.jsx("h4",{className:"text-sm font-medium mb-3 text-[var(--text-secondary)]",children:"Token Efficiency"}),a.jsx("div",{className:"space-y-2",children:e.map(i=>{const l=i.tokens_total/e[n].tokens_total*100,o=i.tokens_total<=r;return a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-24 text-sm truncate",title:i.config_name,children:i.config_name}),a.jsx("div",{className:"flex-1 h-6 bg-[var(--bg-primary)] rounded overflow-hidden",children:a.jsx("div",{className:`h-full transition-all duration-300 ${o?"bg-green-500":"bg-blue-500"}`,style:{width:`${Math.min(l,100)}%`}})}),a.jsx("div",{className:"w-20 text-right font-mono text-sm",children:i.tokens_total.toLocaleString()})]},i.id)})})]})]})}function qx(){const{jobId:e}=ap(),t=Gr(),n=Zn(),[r,s]=N.useState(null),[i,l]=N.useState(!1),[o,u]=N.useState(null),[c,p]=N.useState([]),[h,f]=N.useState(null),[x,S]=N.useState(null),{data:m,isLoading:j}=Lt({queryKey:["jobs",e],queryFn:()=>It.get(e),enabled:!!e,refetchInterval:i?2e3:!1}),{data:v=[]}=Lt({queryKey:["runs",e],queryFn:()=>So.list({job_id:e}),enabled:!!e,refetchInterval:i?2e3:!1}),{data:d}=Lt({queryKey:["job-summary",e],queryFn:()=>So.getJobSummary(e),enabled:!!e&&(m==null?void 0:m.status)==="completed"}),g=Ze({mutationFn:async()=>{l(!0),p([]),f(null),S(null);for await(const k of It.start(e))s(k),k.current_config&&k.current_task&&f(L=>(L&&(L.config!==k.current_config||L.task!==k.current_task)&&p(I=>[...I,{config_name:L.config,task_name:L.task,completed_at:Date.now()}]),{config:k.current_config,task:k.current_task})),k.event==="error"&&(S(k.message),l(!1),n.invalidateQueries({queryKey:["jobs",e]})),k.event==="complete"&&(f(L=>(L&&p(I=>[...I,{config_name:L.config,task_name:L.task,completed_at:Date.now()}]),null)),l(!1),n.invalidateQueries({queryKey:["jobs",e]}),n.invalidateQueries({queryKey:["runs",e]}),n.invalidateQueries({queryKey:["job-summary",e]}))}}),w=Ze({mutationFn:()=>It.cancel(e),onSuccess:()=>{l(!1),n.invalidateQueries({queryKey:["jobs",e]})}});N.useEffect(()=>{(m==null?void 0:m.status)==="running"&&l(!0)},[m==null?void 0:m.status]);const C=N.useMemo(()=>{const k=new Map;for(const L of v)k.has(L.task_name)||k.set(L.task_name,[]),k.get(L.task_name).push(L);return k},[v]),_=N.useMemo(()=>Array.from(C.keys()),[C]);if(j)return a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Loading..."});if(!m)return a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Job not found"});const P=k=>{const L={pending:"default",running:"info",completed:"success",failed:"error",cancelled:"warning"};return a.jsx(V,{variant:L[k]||"default",children:k})};return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:()=>t("/jobs"),className:"text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:"← Jobs"}),a.jsx("h2",{className:"text-xl font-bold",children:m.name||`Job ${m.id.slice(0,8)}`}),P(m.status)]}),a.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[a.jsxs("code",{className:"text-xs bg-[var(--bg-primary)] px-2 py-0.5 rounded font-mono text-[var(--text-secondary)]",children:[m.id.slice(0,8),"..."]}),a.jsxs("span",{className:"text-sm text-[var(--text-secondary)]",children:[m.config_ids.length," configs × ",m.task_ids.length," tasks = ",m.total_experiments," experiments"]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[m.status==="pending"&&a.jsx(Q,{variant:"primary",onClick:()=>g.mutate(),disabled:g.isPending,children:g.isPending?"Starting...":"Start"}),m.status==="running"&&a.jsx(Q,{variant:"danger",onClick:()=>w.mutate(),disabled:w.isPending,children:"Cancel"})]})]}),(x||m.error)&&a.jsx(ke,{className:"mb-6 border-red-500/50 bg-red-500/10",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-5 h-5 rounded-full bg-red-500 flex items-center justify-center text-white text-xs font-bold flex-shrink-0 mt-0.5",children:"!"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-red-400",children:"Error"}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:x||m.error})]})]})}),(i||r)&&a.jsxs(ke,{className:"mb-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"font-medium",children:"Progress"}),a.jsxs("span",{className:"text-[var(--accent)]",children:[(r==null?void 0:r.completed)||m.completed_experiments,"/",(r==null?void 0:r.total)||m.total_experiments]})]}),a.jsx("div",{className:"w-full bg-[var(--bg-primary)] h-2 mb-2",children:a.jsx("div",{className:"h-full bg-[var(--accent)] transition-all",style:{width:`${((r==null?void 0:r.completed)||m.completed_experiments)/((r==null?void 0:r.total)||m.total_experiments)*100}%`}})}),(r==null?void 0:r.message)&&a.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:r.message}),i&&a.jsxs("div",{className:"mt-4 border-t border-[var(--border)] pt-4",children:[(r==null?void 0:r.current_config)&&(r==null?void 0:r.current_task)&&a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-xs text-[var(--text-secondary)] uppercase tracking-wider",children:"Currently Running"}),a.jsxs("div",{className:"flex items-center gap-2 mt-1 px-3 py-2 bg-blue-500/10 border border-blue-500/30 rounded",children:[a.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full animate-pulse"}),a.jsx("span",{className:"font-medium",children:r.current_config}),a.jsx("span",{className:"text-[var(--text-secondary)]",children:"→"}),a.jsx("span",{children:r.current_task})]})]}),c.length>0&&a.jsxs("div",{children:[a.jsxs("span",{className:"text-xs text-[var(--text-secondary)] uppercase tracking-wider",children:["Completed (",c.length,")"]}),a.jsx("div",{className:"mt-1 max-h-40 overflow-y-auto space-y-1",children:c.map((k,L)=>a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-green-500/10 border border-green-500/30 rounded text-sm",children:[a.jsx("div",{className:"w-2 h-2 bg-green-400 rounded-full"}),a.jsx("span",{className:"font-medium",children:k.config_name}),a.jsx("span",{className:"text-[var(--text-secondary)]",children:"→"}),a.jsx("span",{children:k.task_name})]},`${k.config_name}-${k.task_name}-${L}`))})]})]})]}),d&&a.jsxs(ke,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-4",children:"Results Summary"}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-left text-[var(--text-secondary)] border-b border-[var(--border)]",children:[a.jsx("th",{className:"pb-2",children:"Config"}),a.jsx("th",{className:"pb-2",children:"Avg Score"}),a.jsx("th",{className:"pb-2",children:"Avg Tokens"}),a.jsx("th",{className:"pb-2",children:"Pass Rate"}),a.jsx("th",{className:"pb-2",children:"Pareto"})]})}),a.jsx("tbody",{children:d.config_summaries.map(k=>a.jsxs("tr",{className:"border-b border-[var(--border)]",children:[a.jsx("td",{className:"py-2 font-medium",children:k.config_name}),a.jsxs("td",{className:"py-2",children:[(k.avg_score*100).toFixed(1),"%"]}),a.jsx("td",{className:"py-2",children:k.avg_tokens.toLocaleString()}),a.jsxs("td",{className:"py-2",children:[k.passed_runs,"/",k.total_runs]}),a.jsx("td",{className:"py-2",children:k.is_pareto&&a.jsx(V,{variant:"success",children:"Pareto"})})]},k.config_name))})]})})]}),m.status==="completed"&&_.length>0&&a.jsxs(ke,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-4",children:"Compare Configs by Task"}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:_.map(k=>a.jsx("button",{onClick:()=>u(o===k?null:k),className:`px-3 py-1 text-sm rounded border transition-colors ${o===k?"bg-[var(--accent)] text-white border-[var(--accent)]":"border-[var(--border)] hover:border-[var(--accent-dim)]"}`,children:k},k))}),o&&C.get(o)&&a.jsx(Kx,{runs:C.get(o).map(k=>({id:k.id,config_name:k.config_name,tokens_input:0,tokens_output:0,tokens_total:k.tokens_total,duration_seconds:k.duration_seconds,score:k.score,passed:k.passed,is_pareto:k.is_pareto}))})]}),a.jsxs("div",{children:[a.jsxs("h3",{className:"font-medium mb-4",children:["Runs (",v.length,"/",m.total_experiments,")"]}),v.length===0?a.jsx("div",{className:"text-center py-8 text-[var(--text-secondary)]",children:i?"Runs will appear here after the job completes. See progress above for live status.":"No runs yet. Start the job to see results."}):a.jsx("div",{className:"grid gap-2",children:v.map(k=>a.jsx(ke,{className:"cursor-pointer hover:border-[var(--accent-dim)]",onClick:()=>t(`/runs/${k.id}`),children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("span",{className:"font-medium",children:k.config_name}),a.jsx("span",{className:"text-[var(--text-secondary)]",children:"→"}),a.jsx("span",{children:k.task_name})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:k.passed?"text-green-400":"text-red-400",children:[(k.score*100).toFixed(0),"%"]}),a.jsxs("span",{className:"text-[var(--text-secondary)] text-sm",children:[k.tokens_total.toLocaleString()," tokens"]}),a.jsxs("span",{className:"text-[var(--text-secondary)] text-sm",children:[k.duration_seconds.toFixed(1),"s"]}),k.is_pareto&&a.jsx(V,{variant:"success",children:"Pareto"})]})]})},k.id))})]})]})}function Jx(e){const t=[];if(Array.isArray(e.spans))for(const n of e.spans)typeof n=="object"&&n!==null&&t.push(n);else if(e.span_id)t.push(e);else for(const n in e){const r=e[n];if(typeof r=="object"&&r!==null){if("span_id"in r)t.push(r);else if(Array.isArray(r))for(const s of r)typeof s=="object"&&s!==null&&"span_id"in s&&t.push(s)}}return t}function Gx(e){const t=new Map,n=[];for(const s of e)t.set(s.span_id,{span:s,children:[]});for(const s of e){const i=t.get(s.span_id);s.parent_span_id&&t.has(s.parent_span_id)?t.get(s.parent_span_id).children.push(i):n.push(i)}const r=s=>{s.sort((i,l)=>(i.span.start_time||0)-(l.span.start_time||0)),s.forEach(i=>r(i.children))};return r(n),n}function Yx(e){return e.includes("Agent")||e.includes("agent")?"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200":e.includes("chat")||e.includes("Chat")||e.includes("llm")?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":e.includes("tool")||e.includes("execute")||e.includes("bash")?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200"}function Xx(e){return e>=1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(0)}ms`}function Sp({node:e,depth:t=0}){var h,f;const[n,r]=N.useState(t<2),[s,i]=N.useState(!1),{span:l}=e,o=e.children.length>0,u=(h=l.attributes)==null?void 0:h["gen_ai.usage.input_tokens"],c=(f=l.attributes)==null?void 0:f["gen_ai.usage.output_tokens"],p=u!==void 0||c!==void 0;return a.jsxs("div",{className:"relative",children:[t>0&&a.jsx("div",{className:"absolute left-0 top-0 bottom-0 border-l-2 border-[var(--border)]",style:{marginLeft:`${(t-1)*16+8}px`}}),a.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-1 hover:bg-[var(--bg-primary)] rounded transition-colors cursor-pointer",style:{paddingLeft:`${t*16}px`},onClick:()=>o?r(!n):i(!s),children:[a.jsx("div",{className:"w-4 h-4 flex items-center justify-center text-[var(--text-secondary)]",children:o?n?"▼":"▶":s?"▼":"▶"}),a.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded font-medium ${Yx(l.operation_name)}`,children:l.operation_name.replace("ChatAgent.","").replace("invoke_agent ","")}),l.duration_ms!==void 0&&a.jsx("span",{className:"text-xs text-[var(--text-secondary)] font-mono",children:Xx(l.duration_ms)}),p&&a.jsxs("span",{className:"text-xs text-[var(--text-secondary)] font-mono",children:[u!==void 0&&a.jsxs("span",{className:"text-blue-400",children:["↑",String(u)]}),u!==void 0&&c!==void 0&&a.jsx("span",{className:"mx-0.5",children:"/"}),c!==void 0&&a.jsxs("span",{className:"text-green-400",children:["↓",String(c)]})]})]}),s&&!o&&a.jsx("div",{className:"ml-4 mt-1 mb-2 p-2 bg-[var(--bg-primary)] rounded border border-[var(--border)] text-xs",style:{marginLeft:`${t*16+20}px`},children:a.jsxs("div",{className:"space-y-1",children:[l.span_id&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx("span",{className:"text-[var(--text-secondary)] w-20",children:"Span ID:"}),a.jsx("span",{className:"font-mono text-xs break-all",children:l.span_id})]}),l.trace_id&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx("span",{className:"text-[var(--text-secondary)] w-20",children:"Trace ID:"}),a.jsx("span",{className:"font-mono text-xs break-all",children:l.trace_id})]}),l.status&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx("span",{className:"text-[var(--text-secondary)] w-20",children:"Status:"}),a.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs ${l.status==="OK"||l.status==="StatusCode.UNSET"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}`,children:l.status})]}),Object.keys(l.attributes||{}).length>0&&a.jsxs("div",{className:"mt-2",children:[a.jsx("span",{className:"text-[var(--text-secondary)] block mb-1",children:"Attributes:"}),a.jsx("pre",{className:"text-xs bg-[var(--bg-secondary)] border border-[var(--border)] rounded p-2 overflow-auto max-h-32 whitespace-pre-wrap break-all",children:JSON.stringify(l.attributes,null,2)})]})]})}),o&&n&&a.jsx("div",{children:e.children.map((x,S)=>a.jsx(Sp,{node:x,depth:t+1},x.span.span_id||S))})]})}function Zx({trace:e}){const[t,n]=N.useState("tree"),r=N.useMemo(()=>Jx(e),[e]),s=N.useMemo(()=>Gx(r),[r]);return Object.keys(e).length===0?null:a.jsxs(ke,{className:"mb-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h3",{className:"font-medium",children:"Trace Data"}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{onClick:()=>n("tree"),className:`px-2 py-1 text-xs rounded ${t==="tree"?"bg-[var(--accent)] text-white":"bg-[var(--bg-primary)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:"Tree"}),a.jsx("button",{onClick:()=>n("raw"),className:`px-2 py-1 text-xs rounded ${t==="raw"?"bg-[var(--accent)] text-white":"bg-[var(--bg-primary)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:"Raw"})]})]}),t==="tree"?r.length>0?a.jsx("div",{className:"border border-[var(--border)] rounded overflow-hidden",children:a.jsxs("div",{className:"p-2",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2 text-xs text-[var(--text-secondary)]",children:[a.jsxs(V,{variant:"default",children:[r.length," spans"]}),a.jsx("span",{children:"•"}),a.jsx("span",{children:"Click to expand details"})]}),s.map((i,l)=>a.jsx(Sp,{node:i,depth:0},i.span.span_id||l))]})}):a.jsx("div",{className:"text-sm text-[var(--text-secondary)] text-center py-4",children:"No structured spans found. View raw data below."}):a.jsx("pre",{className:"text-xs bg-[var(--bg-primary)] p-3 overflow-x-auto border border-[var(--border)] max-h-96 whitespace-pre-wrap",children:JSON.stringify(e,null,2)})]})}const un={input:"bg-blue-500",output:"bg-emerald-500",inputText:"text-blue-400",outputText:"text-emerald-400"};function pd(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function md({input:e,output:t,maxValue:n,height:r=24,showLabels:s=!0}){const i=e+t;if(i===0)return a.jsx("div",{className:"flex items-center gap-2 w-full",children:a.jsx("div",{className:"rounded bg-[var(--bg-primary)] flex-1",style:{height:`${r}px`}})});const l=n>0?i/n*100:100;return a.jsxs("div",{className:"flex items-center gap-3 w-full",children:[a.jsx("div",{className:"relative rounded overflow-hidden bg-[var(--bg-primary)] flex-1",style:{height:`${r}px`},children:a.jsxs("div",{className:"h-full flex transition-all duration-300",style:{width:`${l}%`},children:[a.jsx("div",{className:`h-full ${un.input} transition-all`,style:{width:`${e/i*100}%`},title:`Input: ${e.toLocaleString()} tokens`}),a.jsx("div",{className:`h-full ${un.output} transition-all`,style:{width:`${t/i*100}%`},title:`Output: ${t.toLocaleString()} tokens`})]})}),s&&a.jsxs("div",{className:"flex items-center gap-1 text-xs font-mono text-[var(--text-secondary)] min-w-[90px] justify-end",children:[a.jsxs("span",{className:un.inputText,children:["↑",pd(e)]}),a.jsx("span",{children:"/"}),a.jsxs("span",{className:un.outputText,children:["↓",pd(t)]})]})]})}function aa({label:e,value:t,color:n="default"}){const r={default:"text-[var(--text-primary)]",input:un.inputText,output:un.outputText}[n];return a.jsxs("div",{className:"flex-1 p-3 bg-[var(--bg-primary)] border border-[var(--border)] rounded",children:[a.jsx("div",{className:"text-xs text-[var(--text-secondary)] mb-1",children:e}),a.jsx("div",{className:`font-mono text-lg font-bold ${r}`,children:t})]})}function e0({tokensInput:e,tokensOutput:t,tokensTotal:n,turns:r}){const s=n>0?Math.round(e/n*100):0,i=n>0?Math.round(t/n*100):0,l=N.useMemo(()=>{if(!r||r.length===0)return null;let u=0,c=0;return r.map(p=>(u+=p.input,c+=p.output,{input:u,output:c,total:u+c}))},[r]),o=l?Math.max(...l.map(u=>u.total)):n;return a.jsxs(ke,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-4",children:"Token Usage"}),a.jsx("div",{className:"mb-4",children:a.jsx(md,{input:e,output:t,maxValue:n,height:32})}),a.jsxs("div",{className:"flex items-center gap-6 text-xs mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded ${un.input}`}),a.jsxs("span",{className:"text-[var(--text-secondary)]",children:["Input (",s,"%)"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded ${un.output}`}),a.jsxs("span",{className:"text-[var(--text-secondary)]",children:["Output (",i,"%)"]})]})]}),a.jsxs("div",{className:"flex gap-3 mb-4",children:[a.jsx(aa,{label:"Input Tokens",value:e.toLocaleString(),color:"input"}),a.jsx(aa,{label:"Output Tokens",value:t.toLocaleString(),color:"output"}),a.jsx(aa,{label:"Total Tokens",value:n.toLocaleString()})]}),l&&l.length>1&&a.jsxs("div",{className:"border-t border-[var(--border)] pt-4",children:[a.jsxs("h4",{className:"text-sm font-medium mb-3 text-[var(--text-secondary)]",children:["Token Accumulation (",r.length," turns)"]}),a.jsx("div",{className:"space-y-2",children:r.map((u,c)=>a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--bg-primary)] border border-[var(--border)] flex items-center justify-center text-xs font-medium",children:c+1}),a.jsx("div",{className:"flex-1",children:a.jsx(md,{input:l[c].input,output:l[c].output,maxValue:o,height:16})})]},c))})]}),a.jsx("div",{className:"mt-4 text-xs text-[var(--text-secondary)] border-t border-[var(--border)] pt-3",children:"Token usage affects API cost. Input tokens are typically cheaper than output tokens."})]})}function t0(){const{runId:e}=ap(),t=Gr(),{data:n,isLoading:r}=Lt({queryKey:["runs",e],queryFn:()=>So.get(e),enabled:!!e});return r?a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Loading..."}):n?a.jsxs("div",{children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("div",{className:"flex items-center gap-3 mb-2",children:a.jsx("button",{onClick:()=>t(`/jobs/${n.job_id}`),className:"text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:"← Back to Job"})}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h2",{className:"text-xl font-bold",children:n.config_name}),a.jsx("span",{className:"text-[var(--text-secondary)]",children:"→"}),a.jsx("span",{className:"text-lg",children:n.task_name}),n.is_pareto&&a.jsx(V,{variant:"success",children:"Pareto Optimal"})]})]}),a.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[a.jsx(wi,{label:"Score",value:`${(n.score*100).toFixed(1)}%`,status:n.passed?"success":"error"}),a.jsx(wi,{label:"Total Tokens",value:n.tokens_total.toLocaleString()}),a.jsx(wi,{label:"Duration",value:`${n.duration_seconds.toFixed(1)}s`}),a.jsx(wi,{label:"Status",value:n.passed?"Passed":"Failed",status:n.passed?"success":"error"})]}),a.jsx(e0,{tokensInput:n.tokens_input,tokensOutput:n.tokens_output,tokensTotal:n.tokens_total}),a.jsxs(ke,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-3",children:"Evaluation"}),n.reasoning&&a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:n.reasoning}),n.criteria_results.length>0&&a.jsx("div",{className:"space-y-2",children:n.criteria_results.map(s=>a.jsx("div",{className:"flex items-start justify-between p-3 bg-[var(--bg-primary)] border border-[var(--border)]",children:a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium",children:s.name}),a.jsxs(V,{variant:s.passed?"success":"error",children:[(s.score*100).toFixed(0),"%"]})]}),s.reasoning&&a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:s.reasoning})]})},s.name))})]}),a.jsxs(ke,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-3",children:"Agent Output"}),a.jsx("pre",{className:"text-sm bg-[var(--bg-primary)] p-3 overflow-x-auto whitespace-pre-wrap border border-[var(--border)]",children:n.output||"(no output)"})]}),n.files_created.length>0&&a.jsxs(ke,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-3",children:"Files Created"}),a.jsx("div",{className:"space-y-1",children:n.files_created.map(s=>a.jsx("div",{className:"text-sm font-mono text-[var(--text-secondary)]",children:s},s))})]}),Object.keys(n.trace).length>0&&a.jsx(Zx,{trace:n.trace})]}):a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Run not found"})}function wi({label:e,value:t,status:n}){const r={success:"text-green-400",error:"text-red-400"};return a.jsxs(ke,{children:[a.jsx("div",{className:"text-sm text-[var(--text-secondary)]",children:e}),a.jsx("div",{className:`text-xl font-bold ${n?r[n]:""}`,children:t})]})}function n0(){const{authConfig:e,isLoading:t,error:n,login:r,loginWithGitHub:s,clearError:i}=Tu(),[l,o]=N.useState(""),[u,c]=N.useState("");N.useEffect(()=>{n&&i()},[l,u]);const p=async f=>{f.preventDefault(),!(!l||!u)&&await r(l,u)},h=()=>{s()};return a.jsx("div",{className:"min-h-screen bg-[var(--bg-primary)] flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-md",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:"Flow"}),a.jsx("p",{className:"text-[var(--text-secondary)]",children:"Sign in to access the optimization dashboard"})]}),a.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] p-6 space-y-6",children:[n&&a.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[var(--error)]/10 border border-[var(--error)]/20 text-[var(--error)]",children:[a.jsx($y,{size:18,className:"mt-0.5 flex-shrink-0"}),a.jsx("p",{className:"text-sm",children:n})]}),(e==null?void 0:e.mode)==="basic"&&a.jsxs("form",{onSubmit:p,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-sm text-[var(--text-secondary)]",children:"Username"}),a.jsxs("div",{className:"relative",children:[a.jsx(hp,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)]"}),a.jsx("input",{type:"text",value:l,onChange:f=>o(f.target.value),className:"w-full bg-[var(--bg-primary)] border border-[var(--border)] pl-10 pr-3 py-2 text-sm focus:outline-none focus:border-[var(--accent)]",placeholder:"Enter username",autoComplete:"username",autoFocus:!0})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-sm text-[var(--text-secondary)]",children:"Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ky,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)]"}),a.jsx("input",{type:"password",value:u,onChange:f=>c(f.target.value),className:"w-full bg-[var(--bg-primary)] border border-[var(--border)] pl-10 pr-3 py-2 text-sm focus:outline-none focus:border-[var(--accent)]",placeholder:"Enter password",autoComplete:"current-password"})]})]}),a.jsx(Q,{type:"submit",variant:"primary",className:"w-full justify-center",loading:t,disabled:!l||!u,children:"Sign In"})]}),(e==null?void 0:e.mode)==="github"&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-[var(--text-secondary)] text-center",children:"Sign in with your GitHub account to continue"}),a.jsx(Q,{onClick:h,variant:"secondary",className:"w-full justify-center",icon:Hy,children:"Continue with GitHub"})]})]}),a.jsx("p",{className:"text-center mt-6 text-xs text-[var(--text-tertiary)]",children:"Protected by authentication"})]})})}function r0({children:e}){const{authConfig:t,isLoadingConfig:n,isAuthenticated:r,loadAuthConfig:s,handleOAuthCallback:i}=Tu();return N.useEffect(()=>{s()},[s]),N.useEffect(()=>{n||i()},[n,i]),n?a.jsx("div",{className:"min-h-screen bg-[var(--bg-primary)] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx(Tl,{className:"w-8 h-8 animate-spin text-[var(--accent)] mx-auto mb-4"}),a.jsx("p",{className:"text-[var(--text-secondary)]",children:"Loading..."})]})}):t!=null&&t.enabled&&!r?a.jsx(n0,{}):a.jsx(a.Fragment,{children:e})}function s0(){return a.jsx(Ry,{children:a.jsx(r0,{children:a.jsx(Ny,{children:a.jsxs(Ht,{path:"/",element:a.jsx(Ix,{}),children:[a.jsx(Ht,{index:!0,element:a.jsx(hd,{})}),a.jsx(Ht,{path:"agents",element:a.jsx(hd,{})}),a.jsx(Ht,{path:"tasks",element:a.jsx(Ux,{})}),a.jsx(Ht,{path:"jobs",element:a.jsx(Bx,{})}),a.jsx(Ht,{path:"jobs/:jobId",element:a.jsx(qx,{})}),a.jsx(Ht,{path:"runs/:runId",element:a.jsx(t0,{})})]})})})})}const vd=localStorage.getItem("flow-theme");if(vd)try{const{state:e}=JSON.parse(vd);e!=null&&e.theme&&document.documentElement.setAttribute("data-theme",e.theme)}catch{}const i0=new xg({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!1}}});oa.createRoot(document.getElementById("root")).render(a.jsx(Eo.StrictMode,{children:a.jsx(wg,{client:i0,children:a.jsx(s0,{})})}));