diff --git "a/src/flow/ui/ui/assets/index-BFk_2IKX.js" "b/src/flow/ui/ui/assets/index-BFk_2IKX.js" new file mode 100644--- /dev/null +++ "b/src/flow/ui/ui/assets/index-BFk_2IKX.js" @@ -0,0 +1,189 @@ +var Ru=e=>{throw TypeError(e)};var Ol=(e,t,n)=>t.has(e)||Ru("Cannot "+n);var g=(e,t,n)=>(Ol(e,t,"read from private field"),n?n.call(e):t.get(e)),F=(e,t,n)=>t.has(e)?Ru("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),M=(e,t,n,r)=>(Ol(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),D=(e,t,n)=>(Ol(e,t,"access private method"),n);var ti=(e,t,n,r)=>({set _(s){M(e,t,s,n)},get _(){return g(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 _d(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ed={exports:{}},cl={},Pd={exports:{}},$={};/** + * @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 Gs=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"),Rp=Symbol.for("react.memo"),Op=Symbol.for("react.lazy"),Ou=Symbol.iterator;function Lp(e){return e===null||typeof e!="object"?null:(e=Ou&&e[Ou]||e["@@iterator"],typeof e=="function"?e:null)}var bd={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Td=Object.assign,Rd={};function Hr(e,t,n){this.props=e,this.context=t,this.refs=Rd,this.updater=n||bd}Hr.prototype.isReactComponent={};Hr.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")};Hr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Od(){}Od.prototype=Hr.prototype;function ko(e,t,n){this.props=e,this.context=t,this.refs=Rd,this.updater=n||bd}var No=ko.prototype=new Od;No.constructor=ko;Td(No,Hr.prototype);No.isPureReactComponent=!0;var Lu=Array.isArray,Ld=Object.prototype.hasOwnProperty,Co={current:null},Md={key:!0,ref:!0,__self:!0,__source:!0};function zd(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)Ld.call(t,r)&&!Md.hasOwnProperty(r)&&(s[r]=t[r]);var o=arguments.length-2;if(o===1)s.children=n;else if(1>>1,R=T[B];if(0>>1;Bs(Yr,L))Bes(Bt,Yr)?(T[B]=Bt,T[Be]=L,B=Be):(T[B]=Yr,T[we]=L,B=we);else if(Bes(Bt,L))T[B]=Bt,T[Be]=L,B=Be;else break e}}return _}function s(T,_){var L=T.sortIndex-_.sortIndex;return L!==0?L:T.id-_.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,f=null,h=3,x=!1,S=!1,y=!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 m(T){for(var _=n(c);_!==null;){if(_.callback===null)r(c);else if(_.startTime<=T)r(c),_.sortIndex=_.expirationTime,t(u,_);else break;_=n(c)}}function w(T){if(y=!1,m(T),!S)if(n(u)!==null)S=!0,mt(E);else{var _=n(c);_!==null&&Qe(w,_.startTime-T)}}function E(T,_){S=!1,y&&(y=!1,v(P),P=-1),x=!0;var L=h;try{for(m(_),f=n(u);f!==null&&(!(f.expirationTime>_)||T&&!Q());){var B=f.callback;if(typeof B=="function"){f.callback=null,h=f.priorityLevel;var R=B(f.expirationTime<=_);_=e.unstable_now(),typeof R=="function"?f.callback=R:f===n(u)&&r(u),m(_)}else r(u);f=n(u)}if(f!==null)var A=!0;else{var we=n(c);we!==null&&Qe(w,we.startTime-_),A=!1}return A}finally{f=null,h=L,x=!1}}var N=!1,C=null,P=-1,I=5,O=-1;function Q(){return!(e.unstable_now()-OT||125B?(T.sortIndex=L,t(c,T),n(u)===null&&T===n(c)&&(y?(v(P),P=-1):y=!0,Qe(w,L-B))):(T.sortIndex=R,t(u,T),S||x||(S=!0,mt(E))),T},e.unstable_shouldYield=Q,e.unstable_wrapCallback=function(T){var _=h;return function(){var L=h;h=_;try{return T.apply(this,arguments)}finally{h=L}}}})($d);Ad.exports=$d;var Hp=Ad.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=k,Ke=Hp;function b(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]*$/,zu={},Iu={};function qp(e){return ua.call(Iu,e)?!0:ua.call(zu,e)?!1:Kp.test(e)?Iu[e]=!0:(zu[e]=!0,!1)}function Gp(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 Jp(e,t,n,r){if(t===null||typeof t>"u"||Gp(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 Oe(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 xe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){xe[e]=new Oe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];xe[t]=new Oe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){xe[e]=new Oe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){xe[e]=new Oe(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){xe[e]=new Oe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){xe[e]=new Oe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){xe[e]=new Oe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){xe[e]=new Oe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){xe[e]=new Oe(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);xe[t]=new Oe(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);xe[t]=new Oe(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);xe[t]=new Oe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){xe[e]=new Oe(e,1,!1,e.toLowerCase(),null,!1,!1)});xe.xlinkHref=new Oe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){xe[e]=new Oe(e,1,!1,e.toLowerCase(),null,!0,!0)});function To(e,t,n,r){var s=xe.hasOwnProperty(t)?xe[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{zl=!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=Il(e.type,!1),e;case 11:return e=Il(e.type.render,!1),e;case 1:return e=Il(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 ir:return"Fragment";case sr:return"Portal";case ca:return"Profiler";case Ro:return"StrictMode";case da:return"Suspense";case fa:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Bd:return(e.displayName||"Context")+".Consumer";case Qd:return(e._context.displayName||"Context")+".Provider";case Oo: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 Kt: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===Ro?"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 jn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Hd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Zp(e){var t=Hd(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 Wd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Hd(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 ne({},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=jn(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 Kd(e,t){t=t.checked,t!=null&&To(e,"checked",t,!1)}function ma(e,t){Kd(e,t);var n=jn(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,jn(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 gr(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 ks(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 Yd(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 Xd(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Yd(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var tm=ne({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function xa(e,t){if(t){if(tm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(b(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(b(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(b(61))}if(t.style!=null&&typeof t.style!="object")throw Error(b(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 Mo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ja=null,yr=null,xr=null;function Qu(e){if(e=Xs(e)){if(typeof ja!="function")throw Error(b(280));var t=e.stateNode;t&&(t=ml(t),ja(e.stateNode,e.type,t))}}function Zd(e){yr?xr?xr.push(e):xr=[e]:yr=e}function ef(){if(yr){var e=yr,t=xr;if(xr=yr=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 Ai(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-dt(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 Sf(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 jf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var lr=!1;function Km(e,t){switch(e){case"compositionend":return jf(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(lr)return e==="compositionend"||!Qo&&Sf(e,t)?(e=xf(),Ni=Ao=an=null,lr=!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 _f(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_f(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ef(){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=Ef(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&_f(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,ar=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||ar==null||ar!==zi(r)||(r=ar,"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&&bs(vs,r)||(vs=r,r=Qi(Pa,"onSelect"),0cr||(e.current=za[cr],za[cr]=null,cr--)}function q(e,t){cr++,za[cr]=e.current,e.current=t}var kn={},_e=Cn(kn),Ae=Cn(!1),Hn=kn;function Fr(e,t){var n=e.type.contextTypes;if(!n)return kn;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 $e(e){return e=e.childContextTypes,e!=null}function Vi(){Y(Ae),Y(_e)}function dc(e,t,n){if(_e.current!==kn)throw Error(b(168));q(_e,t),q(Ae,n)}function If(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(b(108,Xp(e)||"Unknown",s));return ne({},n,r)}function Hi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||kn,Hn=_e.current,q(_e,e),q(Ae,Ae.current),!0}function fc(e,t,n){var r=e.stateNode;if(!r)throw Error(b(169));n?(e=If(e,t,Hn),r.__reactInternalMemoizedMergedChildContext=e,Y(Ae),Y(_e),q(_e,e)):Y(Ae),q(Ae,n)}var _t=null,vl=!1,Jl=!1;function Ff(e){_t===null?_t=[e]:_t.push(e)}function mv(e){vl=!0,Ff(e)}function _n(){if(!Jl&&_t!==null){Jl=!0;var e=0,t=K;try{var n=_t;for(K=1;e>=l,s-=l,Ot=1<<32-dt(t)+s|n<P?(I=C,C=null):I=C.sibling;var O=h(v,C,m[P],w);if(O===null){C===null&&(C=I);break}e&&C&&O.alternate===null&&t(v,C),d=i(O,d,P),N===null?E=O:N.sibling=O,N=O,C=I}if(P===m.length)return n(v,C),X&&Pn(v,P),E;if(C===null){for(;PP?(I=C,C=null):I=C.sibling;var Q=h(v,C,O.value,w);if(Q===null){C===null&&(C=I);break}e&&C&&Q.alternate===null&&t(v,C),d=i(Q,d,P),N===null?E=Q:N.sibling=Q,N=Q,C=I}if(O.done)return n(v,C),X&&Pn(v,P),E;if(C===null){for(;!O.done;P++,O=m.next())O=f(v,O.value,w),O!==null&&(d=i(O,d,P),N===null?E=O:N.sibling=O,N=O);return X&&Pn(v,P),E}for(C=r(v,C);!O.done;P++,O=m.next())O=x(C,v,P,O.value,w),O!==null&&(e&&O.alternate!==null&&C.delete(O.key===null?P:O.key),d=i(O,d,P),N===null?E=O:N.sibling=O,N=O);return e&&C.forEach(function(oe){return t(v,oe)}),X&&Pn(v,P),E}function j(v,d,m,w){if(typeof m=="object"&&m!==null&&m.type===ir&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case ri:e:{for(var E=m.key,N=d;N!==null;){if(N.key===E){if(E=m.type,E===ir){if(N.tag===7){n(v,N.sibling),d=s(N,m.props.children),d.return=v,v=d;break e}}else if(N.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Kt&&mc(E)===N.type){n(v,N.sibling),d=s(N,m.props),d.ref=rs(v,N,m),d.return=v,v=d;break e}n(v,N);break}else t(v,N);N=N.sibling}m.type===ir?(d=Vn(m.props.children,v.mode,w,m.key),d.return=v,v=d):(w=Oi(m.type,m.key,m.props,null,v.mode,w),w.ref=rs(v,d,m),w.return=v,v=w)}return l(v);case sr:e:{for(N=m.key;d!==null;){if(d.key===N)if(d.tag===4&&d.stateNode.containerInfo===m.containerInfo&&d.stateNode.implementation===m.implementation){n(v,d.sibling),d=s(d,m.children||[]),d.return=v,v=d;break e}else{n(v,d);break}else t(v,d);d=d.sibling}d=sa(m,v.mode,w),d.return=v,v=d}return l(v);case Kt:return N=m._init,j(v,d,N(m._payload),w)}if(os(m))return S(v,d,m,w);if(Xr(m))return y(v,d,m,w);pi(v,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,d!==null&&d.tag===6?(n(v,d.sibling),d=s(d,m),d.return=v,v=d):(n(v,d),d=ra(m,v.mode,w),d.return=v,v=d),l(v)):n(v,d)}return j}var Ar=Uf(!0),Qf=Uf(!1),qi=Cn(null),Gi=null,hr=null,Ko=null;function qo(){Ko=hr=Gi=null}function Go(e){var t=qi.current;Y(qi),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 Sr(e,t){Gi=e,Ko=hr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(De=!0),e.firstContext=null)}function rt(e){var t=e._currentValue;if(Ko!==e)if(e={context:e,memoizedValue:t,next:null},hr===null){if(Gi===null)throw Error(b(308));hr=e,Gi.dependencies={lanes:0,firstContext:e}}else hr=hr.next=e;return t}var Rn=null;function Jo(e){Rn===null?Rn=[e]:Rn.push(e)}function Bf(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Jo(t)):(n.next=s.next,s.next=n),t.interleaved=n,At(e,r)}function At(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 qt=!1;function Yo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vf(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 Mt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function mn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,V&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,At(e,n)}return s=r.interleaved,s===null?(t.next=t,Jo(r)):(t.next=s.next,s.next=t),r.interleaved=t,At(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,Io(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 Ji(e,t,n,r){var s=e.updateQueue;qt=!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 f=s.baseState;l=0,p=c=u=null,o=i;do{var h=o.lane,x=o.eventTime;if((r&h)===h){p!==null&&(p=p.next={eventTime:x,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var S=e,y=o;switch(h=t,x=n,y.tag){case 1:if(S=y.payload,typeof S=="function"){f=S.call(x,f,h);break e}f=S;break e;case 3:S.flags=S.flags&-65537|128;case 0:if(S=y.payload,h=typeof S=="function"?S.call(x,f,h):S,h==null)break e;f=ne({},f,h);break e;case 2:qt=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[o]:h.push(o))}else x={eventTime:x,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},p===null?(c=p=x,u=f):p=p.next=x,l|=h;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;h=o,o=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(p===null&&(u=f),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);qn|=l,e.lanes=l,e.memoizedState=f}}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{K=n,Xl.transition=r}}function ah(){return st().memoizedState}function xv(e,t,n){var r=gn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},oh(e))uh(t,n);else if(n=Bf(e,t,n,r),n!==null){var s=Te();ft(n,e,r,s),ch(n,t,r)}}function wv(e,t,n){var r=gn(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(oh(e))uh(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,pt(o,l)){var u=t.interleaved;u===null?(s.next=s,Jo(t)):(s.next=u.next,u.next=s),t.interleaved=s;return}}catch{}finally{}n=Bf(e,t,s,r),n!==null&&(s=Te(),ft(n,e,r,s),ch(n,t,r))}}function oh(e){var t=e.alternate;return e===te||t!==null&&t===te}function uh(e,t){gs=Xi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ch(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Io(e,n)}}var Zi={readContext:rt,useCallback:Se,useContext:Se,useEffect:Se,useImperativeHandle:Se,useInsertionEffect:Se,useLayoutEffect:Se,useMemo:Se,useReducer:Se,useRef:Se,useState:Se,useDebugValue:Se,useDeferredValue:Se,useTransition:Se,useMutableSource:Se,useSyncExternalStore:Se,useId:Se,unstable_isNewReconciler:!1},Sv={readContext:rt,useCallback:function(e,t){return gt().memoizedState=[e,t===void 0?null:t],e},useContext:rt,useEffect:xc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Pi(4194308,4,nh.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=gt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=gt();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,te,e),[r.memoizedState,e]},useRef:function(e){var t=gt();return e={current:e},t.memoizedState=e},useState:yc,useDebugValue:iu,useDeferredValue:function(e){return gt().memoizedState=e},useTransition:function(){var e=yc(!1),t=e[0];return e=yv.bind(null,e[1]),gt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=te,s=gt();if(X){if(n===void 0)throw Error(b(407));n=n()}else{if(n=t(),ve===null)throw Error(b(349));Kn&30||qf(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,xc(Jf.bind(null,r,i,e),[e]),r.flags|=2048,Fs(9,Gf.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=gt(),t=ve.identifierPrefix;if(X){var n=Lt,r=Ot;n=(r&~(1<<32-dt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=zs++,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[St]=t,e[Os]=r,wh(e,t,!1,!1),t.stateNode=e;e:{switch(l=wa(n,r),n){case"dialog":G("cancel",e),G("close",e),s=r;break;case"iframe":case"object":case"embed":G("load",e),s=r;break;case"video":case"audio":for(s=0;sQr&&(t.flags|=128,r=!0,ss(i,!1),t.lanes=4194304)}else{if(!r)if(e=Yi(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 je(t),null}else 2*le()-i.renderingStartTime>Qr&&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=le(),t.sibling=null,n=Z.current,q(Z,r?n&1|2:n&1),t):(je(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?Ve&1073741824&&(je(t),t.subtreeFlags&6&&(t.flags|=8192)):je(t),null;case 24:return null;case 25:return null}throw Error(b(156,t.tag))}function bv(e,t){switch(Ho(t),t.tag){case 1:return $e(t.type)&&Vi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return $r(),Y(Ae),Y(_e),eu(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Zo(t),null;case 13:if(Y(Z),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(b(340));Dr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Y(Z),null;case 4:return $r(),null;case 10:return Go(t.type._context),null;case 22:case 23:return du(),null;case 24:return null;default:return null}}var vi=!1,Ne=!1,Tv=typeof WeakSet=="function"?WeakSet:Set,z=null;function pr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){se(e,t,r)}else n.current=null}function Ka(e,t,n){try{n()}catch(r){se(e,t,r)}}var Tc=!1;function Rv(e,t){if(Ta=$i,e=Ef(),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,f=e,h=null;t:for(;;){for(var x;f!==n||s!==0&&f.nodeType!==3||(o=l+s),f!==i||r!==0&&f.nodeType!==3||(u=l+r),f.nodeType===3&&(l+=f.nodeValue.length),(x=f.firstChild)!==null;)h=f,f=x;for(;;){if(f===e)break t;if(h===n&&++c===s&&(o=l),h===i&&++p===r&&(u=l),(x=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=x}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ra={focusedElem:e,selectionRange:n},$i=!1,z=t;z!==null;)if(t=z,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,z=e;else for(;z!==null;){t=z;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 y=S.memoizedProps,j=S.memoizedState,v=t.stateNode,d=v.getSnapshotBeforeUpdate(t.elementType===t.type?y:lt(t.type,y),j);v.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(b(163))}}catch(w){se(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,z=e;break}z=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 xl(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 kh(e){var t=e.alternate;t!==null&&(e.alternate=null,kh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[St],delete t[Os],delete t[Ma],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 Nh(e){return e.tag===5||e.tag===3||e.tag===4}function Rc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Nh(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 Ga(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=Bi));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}function Ja(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(Ja(e,t,n),e=e.sibling;e!==null;)Ja(e,t,n),e=e.sibling}var ge=null,ut=!1;function Vt(e,t,n){for(n=n.child;n!==null;)Ch(e,t,n),n=n.sibling}function Ch(e,t,n){if(jt&&typeof jt.onCommitFiberUnmount=="function")try{jt.onCommitFiberUnmount(dl,n)}catch{}switch(n.tag){case 5:Ne||pr(n,t);case 6:var r=ge,s=ut;ge=null,Vt(e,t,n),ge=r,ut=s,ge!==null&&(ut?(e=ge,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ge.removeChild(n.stateNode));break;case 18:ge!==null&&(ut?(e=ge,n=n.stateNode,e.nodeType===8?Gl(e.parentNode,n):e.nodeType===1&&Gl(e,n),Es(e)):Gl(ge,n.stateNode));break;case 4:r=ge,s=ut,ge=n.stateNode.containerInfo,ut=!0,Vt(e,t,n),ge=r,ut=s;break;case 0:case 11:case 14:case 15:if(!Ne&&(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)}Vt(e,t,n);break;case 1:if(!Ne&&(pr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){se(n,t,o)}Vt(e,t,n);break;case 21:Vt(e,t,n);break;case 22:n.mode&1?(Ne=(r=Ne)||n.memoizedState!==null,Vt(e,t,n),Ne=r):Vt(e,t,n);break;default:Vt(e,t,n)}}function Oc(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=$v.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function it(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=l),r&=~i}if(r=s,r=le()-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,on===null)var r=!1;else{if(e=on,on=null,nl=0,V&6)throw Error(b(331));var s=V;for(V|=4,z=e.current;z!==null;){var i=z,l=i.child;if(z.flags&16){var o=i.deletions;if(o!==null){for(var u=0;ule()-uu?Bn(e,0):ou|=n),Ue(e,t)}function Lh(e,t){t===0&&(e.mode&1?(t=ai,ai<<=1,!(ai&130023424)&&(ai=4194304)):t=1);var n=Te();e=At(e,t),e!==null&&(Js(e,t,n),Ue(e,n))}function Av(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Lh(e,n)}function $v(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(b(314))}r!==null&&r.delete(t),Lh(e,n)}var Mh;Mh=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ae.current)De=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return De=!1,Ev(e,t,n);De=!!(e.flags&131072)}else De=!1,X&&t.flags&1048576&&Df(t,Ki,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;bi(e,t),e=t.pendingProps;var s=Fr(t,_e.current);Sr(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,$e(r)?(i=!0,Hi(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Yo(t),s.updater=yl,t.stateNode=s,s._reactInternals=t,$a(t,r,e,n),t=Ba(null,t,r,!0,i,n)):(t.tag=0,X&&i&&Vo(t),Pe(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=lt(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,lt(r.type,e),n);break e}throw Error(b(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:lt(r,s),Qa(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:lt(r,s),Ec(e,t,r,s,n);case 3:e:{if(gh(t),e===null)throw Error(b(387));r=t.pendingProps,i=t.memoizedState,s=i.element,Vf(e,t),Ji(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(b(423)),t),t=Pc(e,t,r,n,s);break e}else if(r!==s){s=Ur(Error(b(424)),t),t=Pc(e,t,r,n,s);break e}else for(He=pn(t.stateNode.containerInfo.firstChild),We=t,X=!0,ct=null,n=Qf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Dr(),r===s){t=$t(e,t,n);break e}Pe(e,t,r,n)}t=t.child}return t;case 5:return Hf(t),e===null&&Fa(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,l=s.children,Oa(r,s)?l=null:i!==null&&Oa(r,i)&&(t.flags|=32),vh(e,t),Pe(e,t,l,n),t.child;case 6:return e===null&&Fa(t),null;case 13:return yh(e,t,n);case 4:return Xo(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ar(t,null,r,n):Pe(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:lt(r,s),Cc(e,t,r,s,n);case 7:return Pe(e,t,t.pendingProps,n),t.child;case 8:return Pe(e,t,t.pendingProps.children,n),t.child;case 12:return Pe(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,q(qi,r._currentValue),r._currentValue=l,i!==null)if(pt(i.value,l)){if(i.children===s.children&&!Ae.current){t=$t(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=Mt(-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(b(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}Pe(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Sr(t,n),s=rt(s),r=r(s),t.flags|=1,Pe(e,t,r,n),t.child;case 14:return r=t.type,s=lt(r,t.pendingProps),s=lt(r.type,s),_c(e,t,r,s,n);case 15:return ph(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:lt(r,s),bi(e,t),t.tag=1,$e(r)?(e=!0,Hi(t)):e=!1,Sr(t,n),dh(t,r,s),$a(t,r,s,n),Ba(null,t,r,!0,e,n);case 19:return xh(e,t,n);case 22:return mh(e,t,n)}throw Error(b(156,t.tag))};function zh(e,t){return of(e,t)}function Uv(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 tt(e,t,n,r){return new Uv(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===Oo)return 11;if(e===Lo)return 14}return 2}function yn(e,t){var n=e.alternate;return n===null?(n=tt(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 Oi(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 ir:return Vn(n.children,s,i,t);case Ro:l=8,s|=8;break;case ca:return e=tt(12,n,t,s|2),e.elementType=ca,e.lanes=i,e;case da:return e=tt(13,n,t,s),e.elementType=da,e.lanes=i,e;case fa:return e=tt(19,n,t,s),e.elementType=fa,e.lanes=i,e;case Vd:return Sl(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Qd:l=10;break e;case Bd:l=9;break e;case Oo:l=11;break e;case Lo:l=14;break e;case Kt:l=16,r=null;break e}throw Error(b(130,e==null?e:typeof e,""))}return t=tt(l,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Vn(e,t,n,r){return e=tt(7,e,r,t),e.lanes=n,e}function Sl(e,t,n,r){return e=tt(22,e,r,t),e.elementType=Vd,e.lanes=n,e.stateNode={isHidden:!1},e}function ra(e,t,n){return e=tt(6,e,null,t),e.lanes=n,e}function sa(e,t,n){return t=tt(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=tt(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(Ah)}catch(e){console.error(e)}}Ah(),Dd.exports=qe;var Gv=Dd.exports,$c=Gv;oa.createRoot=$c.createRoot,oa.hydrateRoot=$c.hydrateRoot;var qr=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(){}},Jv={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Yt,jo,md,Yv=(md=class{constructor(){F(this,Yt,Jv);F(this,jo,!1)}setTimeoutProvider(e){M(this,Yt,e)}setTimeout(e,t){return g(this,Yt).setTimeout(e,t)}clearTimeout(e){g(this,Yt).clearTimeout(e)}setInterval(e,t){return g(this,Yt).setInterval(e,t)}clearInterval(e){g(this,Yt).clearInterval(e)}},Yt=new WeakMap,jo=new WeakMap,md),Ln=new Yv;function Xv(e){setTimeout(e,0)}var Jn=typeof window>"u"||"Deno"in globalThis;function be(){}function Zv(e,t){return typeof e=="function"?e(t):e}function to(e){return typeof e=="number"&&e>=0&&e!==1/0}function $h(e,t){return Math.max(e+(t||0)-Date.now(),0)}function xn(e,t){return typeof e=="function"?e(t):e}function Ye(e,t){return typeof e=="function"?e(t):e}function Uc(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(!As(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(Yn(t.options.mutationKey)!==Yn(i))return!1}else if(!As(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)||Yn)(e)}function Yn(e){return JSON.stringify(e,(t,n)=>no(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function As(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>As(e[n],t[n])):!1}var eg=Object.prototype.hasOwnProperty;function Uh(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{Ln.setTimeout(t,e)})}function ro(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Uh(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 Qh(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 Mn,Xt,Nr,vd,ig=(vd=class extends qr{constructor(){super();F(this,Mn);F(this,Xt);F(this,Nr);M(this,Nr,t=>{if(!Jn&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){g(this,Xt)||this.setEventListener(g(this,Nr))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,Xt))==null||t.call(this),M(this,Xt,void 0))}setEventListener(t){var n;M(this,Nr,t),(n=g(this,Xt))==null||n.call(this),M(this,Xt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){g(this,Mn)!==t&&(M(this,Mn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof g(this,Mn)=="boolean"?g(this,Mn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Mn=new WeakMap,Xt=new WeakMap,Nr=new WeakMap,vd),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 ce=ag(),Cr,Zt,_r,gd,og=(gd=class extends qr{constructor(){super();F(this,Cr,!0);F(this,Zt);F(this,_r);M(this,_r,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(){g(this,Zt)||this.setEventListener(g(this,_r))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,Zt))==null||t.call(this),M(this,Zt,void 0))}setEventListener(t){var n;M(this,_r,t),(n=g(this,Zt))==null||n.call(this),M(this,Zt,t(this.setOnline.bind(this)))}setOnline(t){g(this,Cr)!==t&&(M(this,Cr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return g(this,Cr)}},Cr=new WeakMap,Zt=new WeakMap,_r=new WeakMap,gd),ll=new og;function ug(e){return Math.min(1e3*2**e,3e4)}function Bh(e){return(e??"online")==="online"?ll.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 Vh(e){let t=!1,n=0,r;const s=so(),i=()=>s.status!=="pending",l=y=>{var j;if(!i()){const v=new io(y);h(v),(j=e.onCancel)==null||j.call(e,v)}},o=()=>{t=!0},u=()=>{t=!1},c=()=>Su.isFocused()&&(e.networkMode==="always"||ll.isOnline())&&e.canRun(),p=()=>Bh(e.networkMode)&&e.canRun(),f=y=>{i()||(r==null||r(),s.resolve(y))},h=y=>{i()||(r==null||r(),s.reject(y))},x=()=>new Promise(y=>{var j;r=v=>{(i()||c())&&y(v)},(j=e.onPause)==null||j.call(e)}).then(()=>{var y;r=void 0,i()||(y=e.onContinue)==null||y.call(e)}),S=()=>{if(i())return;let y;const j=n===0?e.initialPromise:void 0;try{y=j??e.fn()}catch(v){y=Promise.reject(v)}Promise.resolve(y).then(f).catch(v=>{var N;if(i())return;const d=e.retry??(Jn?0:3),m=e.retryDelay??ug,w=typeof m=="function"?m(n,v):m,E=d===!0||typeof d=="number"&&nc()?void 0:x()).then(()=>{t?h(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 zn,yd,Hh=(yd=class{constructor(){F(this,zn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),to(this.gcTime)&&M(this,zn,Ln.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Jn?1/0:5*60*1e3))}clearGcTimeout(){g(this,zn)&&(Ln.clearTimeout(g(this,zn)),M(this,zn,void 0))}},zn=new WeakMap,yd),In,Er,Je,Fn,pe,Vs,Dn,at,Nt,xd,cg=(xd=class extends Hh{constructor(t){super();F(this,at);F(this,In);F(this,Er);F(this,Je);F(this,Fn);F(this,pe);F(this,Vs);F(this,Dn);M(this,Dn,!1),M(this,Vs,t.defaultOptions),this.setOptions(t.options),this.observers=[],M(this,Fn,t.client),M(this,Je,g(this,Fn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,M(this,In,Wc(this.options)),this.state=t.state??g(this,In),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=g(this,pe))==null?void 0:t.promise}setOptions(t){if(this.options={...g(this,Vs),...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)),M(this,In,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&g(this,Je).remove(this)}setData(t,n){const r=ro(this.state.data,t,this.options);return D(this,at,Nt).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,at,Nt).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=g(this,pe))==null?void 0:r.promise;return(s=g(this,pe))==null||s.cancel(t),n?n.then(be).catch(be):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(g(this,In))}isActive(){return this.observers.some(t=>Ye(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=>xn(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:!$h(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,pe))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,pe))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),g(this,Je).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(g(this,pe)&&(g(this,Dn)?g(this,pe).cancel({revert:!0}):g(this,pe).cancelRetry()),this.scheduleGc()),g(this,Je).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||D(this,at,Nt).call(this,{type:"invalidate"})}async fetch(t,n){var u,c,p,f,h,x,S,y,j,v,d,m;if(this.state.fetchStatus!=="idle"&&((u=g(this,pe))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(g(this,pe))return g(this,pe).continueRetry(),g(this,pe).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(E=>E.options.queryFn);w&&this.setOptions(w.options)}const r=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(M(this,Dn,!0),r.signal)})},i=()=>{const w=Qh(this.options,n),N=(()=>{const C={client:g(this,Fn),queryKey:this.queryKey,meta:this.meta};return s(C),C})();return M(this,Dn,!1),this.options.persister?this.options.persister(w,N,this):w(N)},o=(()=>{const w={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:g(this,Fn),state:this.state,fetchFn:i};return s(w),w})();(c=this.options.behavior)==null||c.onFetch(o,this),M(this,Er,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=o.fetchOptions)==null?void 0:p.meta))&&D(this,at,Nt).call(this,{type:"fetch",meta:(f=o.fetchOptions)==null?void 0:f.meta}),M(this,pe,Vh({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:w=>{w instanceof io&&w.revert&&this.setState({...g(this,Er),fetchStatus:"idle"}),r.abort()},onFail:(w,E)=>{D(this,at,Nt).call(this,{type:"failed",failureCount:w,error:E})},onPause:()=>{D(this,at,Nt).call(this,{type:"pause"})},onContinue:()=>{D(this,at,Nt).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const w=await g(this,pe).start();if(w===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(w),(x=(h=g(this,Je).config).onSuccess)==null||x.call(h,w,this),(y=(S=g(this,Je).config).onSettled)==null||y.call(S,w,this.state.error,this),w}catch(w){if(w instanceof io){if(w.silent)return g(this,pe).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw D(this,at,Nt).call(this,{type:"error",error:w}),(v=(j=g(this,Je).config).onError)==null||v.call(j,w,this),(m=(d=g(this,Je).config).onSettled)==null||m.call(d,this.state.data,w,this),w}finally{this.scheduleGc()}}},In=new WeakMap,Er=new WeakMap,Je=new WeakMap,Fn=new WeakMap,pe=new WeakMap,Vs=new WeakMap,Dn=new WeakMap,at=new WeakSet,Nt=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,...Wh(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 M(this,Er,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),ce.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),g(this,Je).notify({query:this,type:"updated",action:t})})},xd);function Wh(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Bh(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 ze,U,Hs,Ee,An,Pr,Pt,en,Ws,br,Tr,$n,Un,tn,Rr,H,ds,lo,ao,oo,uo,co,fo,ho,Kh,wd,dg=(wd=class extends qr{constructor(t,n){super();F(this,H);F(this,ze);F(this,U);F(this,Hs);F(this,Ee);F(this,An);F(this,Pr);F(this,Pt);F(this,en);F(this,Ws);F(this,br);F(this,Tr);F(this,$n);F(this,Un);F(this,tn);F(this,Rr,new Set);this.options=n,M(this,ze,t),M(this,en,null),M(this,Pt,so()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(g(this,U).addObserver(this),Kc(g(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(g(this,U),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return po(g(this,U),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,D(this,H,co).call(this),D(this,H,fo).call(this),g(this,U).removeObserver(this)}setOptions(t){const n=this.options,r=g(this,U);if(this.options=g(this,ze).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ye(this.options.enabled,g(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),g(this,U).setOptions(this.options),n._defaulted&&!il(this.options,n)&&g(this,ze).getQueryCache().notify({type:"observerOptionsUpdated",query:g(this,U),observer:this});const s=this.hasListeners();s&&qc(g(this,U),r,this.options,n)&&D(this,H,ds).call(this),this.updateResult(),s&&(g(this,U)!==r||Ye(this.options.enabled,g(this,U))!==Ye(n.enabled,g(this,U))||xn(this.options.staleTime,g(this,U))!==xn(n.staleTime,g(this,U)))&&D(this,H,lo).call(this);const i=D(this,H,ao).call(this);s&&(g(this,U)!==r||Ye(this.options.enabled,g(this,U))!==Ye(n.enabled,g(this,U))||i!==g(this,tn))&&D(this,H,oo).call(this,i)}getOptimisticResult(t){const n=g(this,ze).getQueryCache().build(g(this,ze),t),r=this.createResult(n,t);return hg(this,r)&&(M(this,Ee,r),M(this,Pr,this.options),M(this,An,g(this,U).state)),r}getCurrentResult(){return g(this,Ee)}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&&g(this,Pt).status==="pending"&&g(this,Pt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){g(this,Rr).add(t)}getCurrentQuery(){return g(this,U)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=g(this,ze).defaultQueryOptions(t),r=g(this,ze).getQueryCache().build(g(this,ze),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(),g(this,Ee)))}createResult(t,n){var I;const r=g(this,U),s=this.options,i=g(this,Ee),l=g(this,An),o=g(this,Pr),c=t!==r?t.state:g(this,Hs),{state:p}=t;let f={...p},h=!1,x;if(n._optimisticResults){const O=this.hasListeners(),Q=!O&&Kc(t,n),oe=O&&qc(t,r,n,s);(Q||oe)&&(f={...f,...Wh(p.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:S,errorUpdatedAt:y,status:j}=f;x=f.data;let v=!1;if(n.placeholderData!==void 0&&x===void 0&&j==="pending"){let O;i!=null&&i.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(O=i.data,v=!0):O=typeof n.placeholderData=="function"?n.placeholderData((I=g(this,Tr))==null?void 0:I.state.data,g(this,Tr)):n.placeholderData,O!==void 0&&(j="success",x=ro(i==null?void 0:i.data,O,n),h=!0)}if(n.select&&x!==void 0&&!v)if(i&&x===(l==null?void 0:l.data)&&n.select===g(this,Ws))x=g(this,br);else try{M(this,Ws,n.select),x=n.select(x),x=ro(i==null?void 0:i.data,x,n),M(this,br,x),M(this,en,null)}catch(O){M(this,en,O)}g(this,en)&&(S=g(this,en),x=g(this,br),y=Date.now(),j="error");const d=f.fetchStatus==="fetching",m=j==="pending",w=j==="error",E=m&&d,N=x!==void 0,P={status:j,fetchStatus:f.fetchStatus,isPending:m,isSuccess:j==="success",isError:w,isInitialLoading:E,isLoading:E,data:x,dataUpdatedAt:f.dataUpdatedAt,error:S,errorUpdatedAt:y,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:d,isRefetching:d&&!m,isLoadingError:w&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:w&&N,isStale:ju(t,n),refetch:this.refetch,promise:g(this,Pt),isEnabled:Ye(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const O=P.data!==void 0,Q=P.status==="error"&&!O,oe=Me=>{Q?Me.reject(P.error):O&&Me.resolve(P.data)},he=()=>{const Me=M(this,Pt,P.promise=so());oe(Me)},Le=g(this,Pt);switch(Le.status){case"pending":t.queryHash===r.queryHash&&oe(Le);break;case"fulfilled":(Q||P.data!==Le.value)&&he();break;case"rejected":(!Q||P.error!==Le.reason)&&he();break}}return P}updateResult(){const t=g(this,Ee),n=this.createResult(g(this,U),this.options);if(M(this,An,g(this,U).state),M(this,Pr,this.options),g(this,An).data!==void 0&&M(this,Tr,g(this,U)),il(n,t))return;M(this,Ee,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!g(this,Rr).size)return!0;const l=new Set(i??g(this,Rr));return this.options.throwOnError&&l.add("error"),Object.keys(g(this,Ee)).some(o=>{const u=o;return g(this,Ee)[u]!==t[u]&&l.has(u)})};D(this,H,Kh).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&D(this,H,uo).call(this)}},ze=new WeakMap,U=new WeakMap,Hs=new WeakMap,Ee=new WeakMap,An=new WeakMap,Pr=new WeakMap,Pt=new WeakMap,en=new WeakMap,Ws=new WeakMap,br=new WeakMap,Tr=new WeakMap,$n=new WeakMap,Un=new WeakMap,tn=new WeakMap,Rr=new WeakMap,H=new WeakSet,ds=function(t){D(this,H,ho).call(this);let n=g(this,U).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(be)),n},lo=function(){D(this,H,co).call(this);const t=xn(this.options.staleTime,g(this,U));if(Jn||g(this,Ee).isStale||!to(t))return;const r=$h(g(this,Ee).dataUpdatedAt,t)+1;M(this,$n,Ln.setTimeout(()=>{g(this,Ee).isStale||this.updateResult()},r))},ao=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(g(this,U)):this.options.refetchInterval)??!1},oo=function(t){D(this,H,fo).call(this),M(this,tn,t),!(Jn||Ye(this.options.enabled,g(this,U))===!1||!to(g(this,tn))||g(this,tn)===0)&&M(this,Un,Ln.setInterval(()=>{(this.options.refetchIntervalInBackground||Su.isFocused())&&D(this,H,ds).call(this)},g(this,tn)))},uo=function(){D(this,H,lo).call(this),D(this,H,oo).call(this,D(this,H,ao).call(this))},co=function(){g(this,$n)&&(Ln.clearTimeout(g(this,$n)),M(this,$n,void 0))},fo=function(){g(this,Un)&&(Ln.clearInterval(g(this,Un)),M(this,Un,void 0))},ho=function(){const t=g(this,ze).getQueryCache().build(g(this,ze),this.options);if(t===g(this,U))return;const n=g(this,U);M(this,U,t),M(this,Hs,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Kh=function(t){ce.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(g(this,Ee))}),g(this,ze).getQueryCache().notify({query:g(this,U),type:"observerResultsUpdated"})})},wd);function fg(e,t){return Ye(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(Ye(t.enabled,e)!==!1&&xn(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||Ye(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ju(e,n)}function ju(e,t){return Ye(t.enabled,e)!==!1&&e.isStaleByTime(xn(t.staleTime,e))}function hg(e,t){return!il(e.getCurrentResult(),t)}function Gc(e){return{onFetch:(t,n)=>{var p,f,h,x,S;const r=t.options,s=(h=(f=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:f.fetchMore)==null?void 0:h.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 y=!1;const j=m=>{sg(m,()=>t.signal,()=>y=!0)},v=Qh(t.options,t.fetchOptions),d=async(m,w,E)=>{if(y)return Promise.reject();if(w==null&&m.pages.length)return Promise.resolve(m);const C=(()=>{const Q={client:t.client,queryKey:t.queryKey,pageParam:w,direction:E?"backward":"forward",meta:t.options.meta};return j(Q),Q})(),P=await v(C),{maxPages:I}=t.options,O=E?rg:ng;return{pages:O(m.pages,P,I),pageParams:O(m.pageParams,w,I)}};if(s&&i.length){const m=s==="backward",w=m?pg:Jc,E={pages:i,pageParams:l},N=w(r,E);o=await d(E,N,m)}else{const m=e??i.length;do{const w=u===0?l[0]??r.initialPageParam:Jc(r,o);if(u>0&&w==null)break;o=await d(o,w),u++}while(u{var y,j;return(j=(y=t.options).persister)==null?void 0:j.call(y,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function Jc(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 Ks,yt,ke,Qn,xt,Ht,Sd,mg=(Sd=class extends Hh{constructor(t){super();F(this,xt);F(this,Ks);F(this,yt);F(this,ke);F(this,Qn);M(this,Ks,t.client),this.mutationId=t.mutationId,M(this,ke,t.mutationCache),M(this,yt,[]),this.state=t.state||qh(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){g(this,yt).includes(t)||(g(this,yt).push(t),this.clearGcTimeout(),g(this,ke).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){M(this,yt,g(this,yt).filter(n=>n!==t)),this.scheduleGc(),g(this,ke).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){g(this,yt).length||(this.state.status==="pending"?this.scheduleGc():g(this,ke).remove(this))}continue(){var t;return((t=g(this,Qn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,o,u,c,p,f,h,x,S,y,j,v,d,m,w,E,N,C;const n=()=>{D(this,xt,Ht).call(this,{type:"continue"})},r={client:g(this,Ks),meta:this.options.meta,mutationKey:this.options.mutationKey};M(this,Qn,Vh({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(P,I)=>{D(this,xt,Ht).call(this,{type:"failed",failureCount:P,error:I})},onPause:()=>{D(this,xt,Ht).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>g(this,ke).canRun(this)}));const s=this.state.status==="pending",i=!g(this,Qn).canStart();try{if(s)n();else{D(this,xt,Ht).call(this,{type:"pending",variables:t,isPaused:i}),g(this,ke).config.onMutate&&await g(this,ke).config.onMutate(t,this,r);const I=await((o=(l=this.options).onMutate)==null?void 0:o.call(l,t,r));I!==this.state.context&&D(this,xt,Ht).call(this,{type:"pending",context:I,variables:t,isPaused:i})}const P=await g(this,Qn).start();return await((c=(u=g(this,ke).config).onSuccess)==null?void 0:c.call(u,P,t,this.state.context,this,r)),await((f=(p=this.options).onSuccess)==null?void 0:f.call(p,P,t,this.state.context,r)),await((x=(h=g(this,ke).config).onSettled)==null?void 0:x.call(h,P,null,this.state.variables,this.state.context,this,r)),await((y=(S=this.options).onSettled)==null?void 0:y.call(S,P,null,t,this.state.context,r)),D(this,xt,Ht).call(this,{type:"success",data:P}),P}catch(P){try{await((v=(j=g(this,ke).config).onError)==null?void 0:v.call(j,P,t,this.state.context,this,r))}catch(I){Promise.reject(I)}try{await((m=(d=this.options).onError)==null?void 0:m.call(d,P,t,this.state.context,r))}catch(I){Promise.reject(I)}try{await((E=(w=g(this,ke).config).onSettled)==null?void 0:E.call(w,void 0,P,this.state.variables,this.state.context,this,r))}catch(I){Promise.reject(I)}try{await((C=(N=this.options).onSettled)==null?void 0:C.call(N,void 0,P,t,this.state.context,r))}catch(I){Promise.reject(I)}throw D(this,xt,Ht).call(this,{type:"error",error:P}),P}finally{g(this,ke).runNext(this)}}},Ks=new WeakMap,yt=new WeakMap,ke=new WeakMap,Qn=new WeakMap,xt=new WeakSet,Ht=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),ce.batch(()=>{g(this,yt).forEach(r=>{r.onMutationUpdate(t)}),g(this,ke).notify({mutation:this,type:"updated",action:t})})},Sd);function qh(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var bt,ot,qs,jd,vg=(jd=class extends qr{constructor(t={}){super();F(this,bt);F(this,ot);F(this,qs);this.config=t,M(this,bt,new Set),M(this,ot,new Map),M(this,qs,0)}build(t,n,r){const s=new mg({client:t,mutationCache:this,mutationId:++ti(this,qs)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){g(this,bt).add(t);const n=xi(t);if(typeof n=="string"){const r=g(this,ot).get(n);r?r.push(t):g(this,ot).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(g(this,bt).delete(t)){const n=xi(t);if(typeof n=="string"){const r=g(this,ot).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&g(this,ot).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=xi(t);if(typeof n=="string"){const r=g(this,ot).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=g(this,ot).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(){ce.batch(()=>{g(this,bt).forEach(t=>{this.notify({type:"removed",mutation:t})}),g(this,bt).clear(),g(this,ot).clear()})}getAll(){return Array.from(g(this,bt))}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){ce.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ce.batch(()=>Promise.all(t.map(n=>n.continue().catch(be))))}},bt=new WeakMap,ot=new WeakMap,qs=new WeakMap,jd);function xi(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Tt,nn,Ie,Rt,It,Li,mo,kd,gg=(kd=class extends qr{constructor(n,r){super();F(this,It);F(this,Tt);F(this,nn);F(this,Ie);F(this,Rt);M(this,Tt,n),this.setOptions(r),this.bindMethods(),D(this,It,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=g(this,Tt).defaultMutationOptions(n),il(this.options,r)||g(this,Tt).getMutationCache().notify({type:"observerOptionsUpdated",mutation:g(this,Ie),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Yn(r.mutationKey)!==Yn(this.options.mutationKey)?this.reset():((s=g(this,Ie))==null?void 0:s.state.status)==="pending"&&g(this,Ie).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=g(this,Ie))==null||n.removeObserver(this)}onMutationUpdate(n){D(this,It,Li).call(this),D(this,It,mo).call(this,n)}getCurrentResult(){return g(this,nn)}reset(){var n;(n=g(this,Ie))==null||n.removeObserver(this),M(this,Ie,void 0),D(this,It,Li).call(this),D(this,It,mo).call(this)}mutate(n,r){var s;return M(this,Rt,r),(s=g(this,Ie))==null||s.removeObserver(this),M(this,Ie,g(this,Tt).getMutationCache().build(g(this,Tt),this.options)),g(this,Ie).addObserver(this),g(this,Ie).execute(n)}},Tt=new WeakMap,nn=new WeakMap,Ie=new WeakMap,Rt=new WeakMap,It=new WeakSet,Li=function(){var r;const n=((r=g(this,Ie))==null?void 0:r.state)??qh();M(this,nn,{...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){ce.batch(()=>{var r,s,i,l,o,u,c,p;if(g(this,Rt)&&this.hasListeners()){const f=g(this,nn).variables,h=g(this,nn).context,x={client:g(this,Tt),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(r=g(this,Rt)).onSuccess)==null||s.call(r,n.data,f,h,x)}catch(S){Promise.reject(S)}try{(l=(i=g(this,Rt)).onSettled)==null||l.call(i,n.data,null,f,h,x)}catch(S){Promise.reject(S)}}else if((n==null?void 0:n.type)==="error"){try{(u=(o=g(this,Rt)).onError)==null||u.call(o,n.error,f,h,x)}catch(S){Promise.reject(S)}try{(p=(c=g(this,Rt)).onSettled)==null||p.call(c,void 0,n.error,f,h,x)}catch(S){Promise.reject(S)}}}this.listeners.forEach(f=>{f(g(this,nn))})})},kd),wt,Nd,yg=(Nd=class extends qr{constructor(t={}){super();F(this,wt);this.config=t,M(this,wt,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){g(this,wt).has(t.queryHash)||(g(this,wt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=g(this,wt).get(t.queryHash);n&&(t.destroy(),n===t&&g(this,wt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ce.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return g(this,wt).get(t)}getAll(){return[...g(this,wt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Uc(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Uc(t,r)):n}notify(t){ce.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ce.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ce.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},wt=new WeakMap,Nd),re,rn,sn,Or,Lr,ln,Mr,zr,Cd,xg=(Cd=class{constructor(e={}){F(this,re);F(this,rn);F(this,sn);F(this,Or);F(this,Lr);F(this,ln);F(this,Mr);F(this,zr);M(this,re,e.queryCache||new yg),M(this,rn,e.mutationCache||new vg),M(this,sn,e.defaultOptions||{}),M(this,Or,new Map),M(this,Lr,new Map),M(this,ln,0)}mount(){ti(this,ln)._++,g(this,ln)===1&&(M(this,Mr,Su.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,re).onFocus())})),M(this,zr,ll.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,re).onOnline())})))}unmount(){var e,t;ti(this,ln)._--,g(this,ln)===0&&((e=g(this,Mr))==null||e.call(this),M(this,Mr,void 0),(t=g(this,zr))==null||t.call(this),M(this,zr,void 0))}isFetching(e){return g(this,re).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return g(this,rn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=g(this,re).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=g(this,re).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(xn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return g(this,re).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=g(this,re).get(r.queryHash),i=s==null?void 0:s.state.data,l=Zv(t,i);if(l!==void 0)return g(this,re).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return ce.batch(()=>g(this,re).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=g(this,re).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=g(this,re);ce.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=g(this,re);return ce.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ce.batch(()=>g(this,re).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(be).catch(be)}invalidateQueries(e,t={}){return ce.batch(()=>(g(this,re).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=ce.batch(()=>g(this,re).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(be)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(be)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=g(this,re).build(this,t);return n.isStaleByTime(xn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(be).catch(be)}fetchInfiniteQuery(e){return e.behavior=Gc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(be).catch(be)}ensureInfiniteQueryData(e){return e.behavior=Gc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ll.isOnline()?g(this,rn).resumePausedMutations():Promise.resolve()}getQueryCache(){return g(this,re)}getMutationCache(){return g(this,rn)}getDefaultOptions(){return g(this,sn)}setDefaultOptions(e){M(this,sn,e)}setQueryDefaults(e,t){g(this,Or).set(Yn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...g(this,Or).values()],n={};return t.forEach(r=>{As(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){g(this,Lr).set(Yn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...g(this,Lr).values()],n={};return t.forEach(r=>{As(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...g(this,sn).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:{...g(this,sn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){g(this,re).clear(),g(this,rn).clear()}},re=new WeakMap,rn=new WeakMap,sn=new WeakMap,Or=new WeakMap,Lr=new WeakMap,ln=new WeakMap,Mr=new WeakMap,zr=new WeakMap,Cd),Gh=k.createContext(void 0),er=e=>{const t=k.useContext(Gh);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},wg=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(Gh.Provider,{value:e,children:t})),Jh=k.createContext(!1),Sg=()=>k.useContext(Jh);Jh.Provider;function jg(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var kg=k.createContext(jg()),Ng=()=>k.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=>{k.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 Rg(e,t,n){var h,x,S,y;const r=Sg(),s=Ng(),i=er(),l=i.defaultQueryOptions(e);(x=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||x.call(h,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]=k.useState(()=>new t(i,l)),p=c.getOptimisticResult(l),f=!r&&e.subscribed!==!1;if(k.useSyncExternalStore(k.useCallback(j=>{const v=f?c.subscribe(ce.batchCalls(j)):be;return c.updateResult(),v},[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),k.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((y=(S=i.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||y.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(be).finally(()=>{c.updateResult()})}return l.notifyOnChangeProps?p:c.trackResult(p)}function zt(e,t){return Rg(e,dg)}function ht(e,t){const n=er(),[r]=k.useState(()=>new gg(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);const s=k.useSyncExternalStore(k.useCallback(l=>r.subscribe(ce.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=k.useCallback((l,o)=>{r.mutate(l,o).catch(be)},[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 $s(){return $s=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),$s({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Gr(t):t,{state:n,key:t&&t.key||r||Lg()})}function al(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 Gr(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 Mg(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,l=s.history,o=un.Pop,u=null,c=p();c==null&&(c=0,l.replaceState($s({},l.state,{idx:c}),""));function p(){return(l.state||{idx:null}).idx}function f(){o=un.Pop;let j=p(),v=j==null?null:j-c;c=j,u&&u({action:o,location:y.location,delta:v})}function h(j,v){o=un.Push;let d=vo(y.location,j,v);c=p()+1;let m=Zc(d,c),w=y.createHref(d);try{l.pushState(m,"",w)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;s.location.assign(w)}i&&u&&u({action:o,location:y.location,delta:1})}function x(j,v){o=un.Replace;let d=vo(y.location,j,v);c=p();let m=Zc(d,c),w=y.createHref(d);l.replaceState(m,"",w),i&&u&&u({action:o,location:y.location,delta:0})}function S(j){let v=s.location.origin!=="null"?s.location.origin:s.location.href,d=typeof j=="string"?j:al(j);return d=d.replace(/ $/,"%20"),ie(v,"No window.location.(origin|href) available to create URL for href: "+d),new URL(d,v)}let y={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,f),u=j,()=>{s.removeEventListener(Xc,f),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:h,replace:x,go(j){return l.go(j)}};return y}var ed;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(ed||(ed={}));function zg(e,t,n){return n===void 0&&(n="/"),Ig(e,t,n)}function Ig(e,t,n,r){let s=typeof t=="string"?Gr(t):t,i=Br(s.pathname||"/",n);if(i==null)return null;let l=Yh(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("/")&&(ie(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=wn([r,u.relativePath]),p=n.concat(u);i.children&&i.children.length>0&&(ie(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),Yh(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 Xh(i.path))s(i,l,u)}),t}function Xh(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=Xh(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,$g=2,Ug=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+=$g),n.filter(s=>!td(s)).reduce((s,i)=>s+(Dg.test(i)?Ag:i===""?Ug: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:h,isOptional:x}=p;if(h==="*"){let y=o[f]||"";l=i.slice(0,i.length-y.length).replace(/(.)\/+$/,"$1")}const S=o[f];return x&&!S?c[h]=void 0:c[h]=(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 Br(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 Gg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Jg=e=>Gg.test(e);function Yg(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Gr(e):e,i;if(n)if(Jg(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 Zh(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 ep(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=Gr(e):(s=$s({},e),ie(!s.pathname||!s.pathname.includes("?"),ia("?","pathname","search",s)),ie(!s.pathname||!s.pathname.includes("#"),ia("#","pathname","hash",s)),ie(!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 f=t.length-1;if(!r&&l.startsWith("..")){let h=l.split("/");for(;h[0]==="..";)h.shift(),f-=1;s.pathname=h.join("/")}o=f>=0?t[f]:"/"}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 wn=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 tp=["post","put","patch","delete"];new Set(tp);const ry=["get",...tp];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}),k.useCallback(function(c,p){if(p===void 0&&(p={}),!o.current)return;if(typeof c=="number"){r.go(c);return}let f=ep(c,JSON.parse(l),i,p.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:wn([t,f.pathname])),(p.replace?r.replace:r.push)(f,p.state,p)},[t,r,l,i,e])}const ly=k.createContext(null);function ay(e){let t=k.useContext(Qt).outlet;return t&&k.createElement(ly.Provider,{value:e},t)}function ip(){let{matches:e}=k.useContext(Qt),t=e[e.length-1];return t?t.params:{}}function Pl(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=k.useContext(En),{matches:s}=k.useContext(Qt),{pathname:i}=Jr(),l=JSON.stringify(Zh(s,r.v7_relativeSplatPath));return k.useMemo(()=>ep(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){ei()||ie(!1);let{navigator:s}=k.useContext(En),{matches:i}=k.useContext(Qt),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 f;let j=typeof t=="string"?Gr(t):t;u==="/"||(f=j.pathname)!=null&&f.startsWith(u)||ie(!1),p=j}else p=c;let h=p.pathname||"/",x=h;if(u!=="/"){let j=u.replace(/^\//,"").split("/");x="/"+h.replace(/^\//,"").split("/").slice(j.length).join("/")}let S=zg(e,{pathname:x}),y=py(S&&S.map(j=>Object.assign({},j,{params:Object.assign({},o,j.params),pathname:wn([u,s.encodeLocation?s.encodeLocation(j.pathname).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?u:wn([u,s.encodeLocation?s.encodeLocation(j.pathnameBase).pathname:j.pathnameBase])})),i,n,r);return t&&y?k.createElement(El.Provider,{value:{location:Us({pathname:"/",search:"",hash:"",state:null,key:"default"},p),navigationType:un.Pop}},y):y}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 k.createElement(k.Fragment,null,k.createElement("h2",null,"Unexpected Application Error!"),k.createElement("h3",{style:{fontStyle:"italic"}},t),n?k.createElement("pre",{style:s},n):null,null)}const dy=k.createElement(cy,null);class fy extends k.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?k.createElement(Qt.Provider,{value:this.props.routeContext},k.createElement(rp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hy(e){let{routeContext:t,match:n,children:r}=e,s=k.useContext(_l);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),k.createElement(Qt.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(f=>f.route.id&&(o==null?void 0:o[f.route.id])!==void 0);p>=0||ie(!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,f,h)=>{let x,S=!1,y=null,j=null;n&&(x=o&&f.route.id?o[f.route.id]:void 0,y=f.route.errorElement||dy,u&&(c<0&&h===0?(wy("route-fallback"),S=!0,j=null):c===h&&(S=!0,j=f.route.hydrateFallbackElement||null)));let v=t.concat(l.slice(0,h+1)),d=()=>{let m;return x?m=y:S?m=j:f.route.Component?m=k.createElement(f.route.Component,null):f.route.element?m=f.route.element:m=p,k.createElement(hy,{match:f,routeContext:{outlet:p,matches:v,isDataRoute:n!=null},children:m})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?k.createElement(fy,{location:n.location,revalidation:n.revalidation,component:y,error:x,children:d(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):d()},null)}var lp=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(lp||{}),ap=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}(ap||{});function my(e){let t=k.useContext(_l);return t||ie(!1),t}function vy(e){let t=k.useContext(np);return t||ie(!1),t}function gy(e){let t=k.useContext(Qt);return t||ie(!1),t}function op(e){let t=gy(),n=t.matches[t.matches.length-1];return n.route.id||ie(!1),n.route.id}function yy(){var e;let t=k.useContext(rp),n=vy(),r=op();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function xy(){let{router:e}=my(lp.UseNavigateStable),t=op(ap.UseNavigateStable),n=k.useRef(!1);return sp(()=>{n.current=!0}),k.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 Wt(e){ie(!1)}function ky(e){let{basename:t="/",children:n=null,location:r,navigationType:s=un.Pop,navigator:i,static:l=!1,future:o}=e;ei()&&ie(!1);let u=t.replace(/^\/*/,"/"),c=k.useMemo(()=>({basename:u,navigator:i,static:l,future:Us({v7_relativeSplatPath:!1},o)}),[u,o,i,l]);typeof r=="string"&&(r=Gr(r));let{pathname:p="/",search:f="",hash:h="",state:x=null,key:S="default"}=r,y=k.useMemo(()=>{let j=Br(p,u);return j==null?null:{location:{pathname:j,search:f,hash:h,state:x,key:S},navigationType:s}},[u,p,f,h,x,S,s]);return y==null?null:k.createElement(En.Provider,{value:c},k.createElement(El.Provider,{children:n,value:y}))}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 k.Children.forEach(e,(r,s)=>{if(!k.isValidElement(r))return;let i=[...t,s];if(r.type===k.Fragment){n.push.apply(n,yo(r.props.children,i));return}r.type!==Wt&&ie(!1),!r.props.index||!r.props.children||ie(!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 ol(){return ol=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=k.createContext({isTransitioning:!1}),Ry="startTransition",sd=Dp[Ry];function Oy(e){let{basename:t,children:n,future:r,window:s}=e,i=k.useRef();i.current==null&&(i.current=Og({window:s,v5Compat:!0}));let l=i.current,[o,u]=k.useState({action:l.action,location:l.location}),{v7_startTransition:c}=r||{},p=k.useCallback(f=>{c&&sd?sd(()=>u(f)):u(f)},[u,c]);return k.useLayoutEffect(()=>l.listen(p),[l,p]),k.useEffect(()=>Sy(r),[r]),k.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",My=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,zy=k.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:l,state:o,target:u,to:c,preventScrollReset:p,viewTransition:f}=t,h=up(t,Ey),{basename:x}=k.useContext(En),S,y=!1;if(typeof c=="string"&&My.test(c)&&(S=c,Ly))try{let m=new URL(window.location.href),w=c.startsWith("//")?new URL(m.protocol+c):new URL(c),E=Br(w.pathname,x);w.origin===m.origin&&E!=null?c=E+w.search+w.hash:y=!0}catch{}let j=sy(c,{relative:s}),v=Fy(c,{replace:l,state:o,target:u,preventScrollReset:p,relative:s,viewTransition:f});function d(m){r&&r(m),m.defaultPrevented||v(m)}return k.createElement("a",ol({},h,{href:S||j,onClick:y||i?r:d,ref:n,target:u}))}),id=k.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,f=up(t,Py),h=Pl(u,{relative:f.relative}),x=Jr(),S=k.useContext(np),{navigator:y,basename:j}=k.useContext(En),v=S!=null&&Dy(h)&&c===!0,d=y.encodeLocation?y.encodeLocation(h).pathname:h.pathname,m=x.pathname,w=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;s||(m=m.toLowerCase(),w=w?w.toLowerCase():null,d=d.toLowerCase()),w&&j&&(w=Br(w,j)||w);const E=d!=="/"&&d.endsWith("/")?d.length-1:d.length;let N=m===d||!l&&m.startsWith(d)&&m.charAt(E)==="/",C=w!=null&&(w===d||!l&&w.startsWith(d)&&w.charAt(d.length)==="/"),P={isActive:N,isPending:C,isTransitioning:v},I=N?r:void 0,O;typeof i=="function"?O=i(P):O=[i,N?"active":null,C?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let Q=typeof o=="function"?o(P):o;return k.createElement(zy,ol({},f,{"aria-current":I,className:O,ref:n,style:Q,to:u,viewTransition:c}),typeof p=="function"?p(P):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 Iy(e){let t=k.useContext(_l);return t||ie(!1),t}function Fy(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:l,viewTransition:o}=t===void 0?{}:t,u=tr(),c=Jr(),p=Pl(e,{relative:l});return k.useCallback(f=>{if(_y(f,n)){f.preventDefault();let h=r!==void 0?r:al(c)===al(p);u(e,{replace:h,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=k.useContext(Ty);n==null&&ie(!1);let{basename:r}=Iy(xo.useViewTransitionState),s=Pl(e,{relative:t.relative});if(!n.isTransitioning)return!1;let i=Br(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=Br(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 $y=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),fe=(e,t)=>{const n=k.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:l,className:o="",children:u,...c},p)=>k.createElement("svg",{ref:p,...Ay,width:s,height:s,stroke:r,strokeWidth:l?Number(i)*24/Number(s):i,className:["lucide",`lucide-${$y(e)}`,o].join(" "),...c},[...t.map(([f,h])=>k.createElement(f,h)),...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 Uy=fe("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=fe("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** + * @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=fe("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 cp=fe("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=fe("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 Ss=fe("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=fe("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=fe("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 bl=fe("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=fe("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=fe("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 Gy=fe("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=fe("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 dp=fe("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=fe("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 Yy=fe("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 Xy=fe("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 fp=fe("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=fe("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),Zy={},ad=e=>{let t;const n=new Set,r=(p,f)=>{const h=typeof p=="function"?p(t):p;if(!Object.is(h,t)){const x=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(S=>S(t,x))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>c,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(Zy?"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},ex=e=>e?ad(e):ad;var hp={exports:{}},pp={},mp={exports:{}},vp={};/** + * @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 Vr=k;function tx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var nx=typeof Object.is=="function"?Object.is:tx,rx=Vr.useState,sx=Vr.useEffect,ix=Vr.useLayoutEffect,lx=Vr.useDebugValue;function ax(e,t){var n=t(),r=rx({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return ix(function(){s.value=n,s.getSnapshot=t,la(s)&&i({inst:s})},[e,n,t]),sx(function(){return la(s)&&i({inst:s}),e(function(){la(s)&&i({inst:s})})},[e]),lx(n),n}function la(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!nx(e,n)}catch{return!0}}function ox(e,t){return t()}var ux=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ox:ax;vp.useSyncExternalStore=Vr.useSyncExternalStore!==void 0?Vr.useSyncExternalStore:ux;mp.exports=vp;var cx=mp.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 Tl=k,dx=cx;function fx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var hx=typeof Object.is=="function"?Object.is:fx,px=dx.useSyncExternalStore,mx=Tl.useRef,vx=Tl.useEffect,gx=Tl.useMemo,yx=Tl.useDebugValue;pp.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=mx(null);if(i.current===null){var l={hasValue:!1,value:null};i.current=l}else l=i.current;i=gx(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 f=S}return f=x}if(S=f,hx(p,x))return S;var y=r(x);return s!==void 0&&s(S,y)?(p=x,S):(p=x,f=y)}var c=!1,p,f,h=n===void 0?null:n;return[function(){return u(t())},h===null?void 0:function(){return u(h())}]},[t,n,r,s]);var o=px(e,i[0],i[1]);return vx(function(){l.hasValue=!0,l.value=o},[o]),yx(o),o};hp.exports=pp;var xx=hp.exports;const wx=_d(xx),gp={},{useDebugValue:Sx}=Eo,{useSyncExternalStoreWithSelector:jx}=wx;let od=!1;const kx=e=>e;function Nx(e,t=kx,n){(gp?"production":void 0)!=="production"&&n&&!od&&(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"),od=!0);const r=jx(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Sx(r),r}const ud=e=>{(gp?"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"?ex(e):e,n=(r,s)=>Nx(t,r,s);return Object.assign(n,t),n},Cu=e=>e?ud(e):ud,_u="/api",Eu="flow_auth_token",Pu="flow_auth_expires",bu="flow_auth_username";function ul(){const e=localStorage.getItem(Eu),t=localStorage.getItem(Pu);return!e||!t?null:new Date(t)<=new Date?(kr(),null):e}function cd(e,t,n){localStorage.setItem(Eu,e),localStorage.setItem(Pu,t),localStorage.setItem(bu,n)}function kr(){localStorage.removeItem(Eu),localStorage.removeItem(Pu),localStorage.removeItem(bu)}function Cx(){return localStorage.getItem(bu)}let Qs=null;function _x(e){Qs=e}async function ee(e,t,n=!1){const r={"Content-Type":"application/json",...t==null?void 0:t.headers};if(!n){const i=ul();i&&(r.Authorization=`Bearer ${i}`)}const s=await fetch(`${_u}${e}`,{...t,headers:r});if(s.status===401){kr(),Qs&&Qs();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 rr={getConfig:()=>ee("/auth/config",void 0,!0),login:e=>ee("/auth/login",{method:"POST",body:JSON.stringify(e)},!0),getGitHubAuthUrl:()=>`${_u}/auth/github`,getCurrentUser:()=>ee("/auth/me"),logout:()=>ee("/auth/logout",{method:"POST"})},Mi={list:e=>{const t=new URLSearchParams;e!=null&&e.include_auto_generated&&t.set("include_auto_generated","true");const n=t.toString();return ee(`/configs${n?`?${n}`:""}`)},get:e=>ee(`/configs/${e}`),create:e=>ee("/configs",{method:"POST",body:JSON.stringify(e)}),update:(e,t)=>ee(`/configs/${e}`,{method:"PUT",body:JSON.stringify(t)}),delete:e=>ee(`/configs/${e}`,{method:"DELETE"}),generateVariations:e=>ee("/configs/generate-variations",{method:"POST",body:JSON.stringify(e)})},vr={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 ee(`/tasks${n?`?${n}`:""}`)},get:e=>ee(`/tasks/${e}`),create:e=>ee("/tasks",{method:"POST",body:JSON.stringify(e)}),delete:e=>ee(`/tasks/${e}`,{method:"DELETE"}),importSuite:e=>ee(`/tasks/import-suite?suite_name=${encodeURIComponent(e)}`,{method:"POST"})},Sn={list:e=>{const t=e?`?status=${e}`:"";return ee(`/jobs${t}`)},get:e=>ee(`/jobs/${e}`),create:e=>ee("/jobs",{method:"POST",body:JSON.stringify(e)}),start:async function*(e){var o;const t={},n=ul();n&&(t.Authorization=`Bearer ${n}`);const r=await fetch(`${_u}/jobs/${e}/start`,{method:"POST",headers:t});if(r.status===401)throw kr(),Qs&&Qs(),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 f of p)f.startsWith("data: ")&&(yield JSON.parse(f.slice(6)))}},cancel:e=>ee(`/jobs/${e}/cancel`,{method:"POST"}),delete:e=>ee(`/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 ee(`/runs${n?`?${n}`:""}`)},get:e=>ee(`/runs/${e}`),getJobSummary:e=>ee(`/runs/job/${e}/summary`)},Tu=Cu((e,t)=>(_x(()=>{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 rr.getConfig();if(e({authConfig:n,isLoadingConfig:!1}),n.enabled){const r=ul(),s=Cx();if(r&&s)try{const i=await rr.getCurrentUser();e({isAuthenticated:!0,user:i})}catch{kr(),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 rr.login({username:n,password:r});return cd(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=rr.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&&(cd(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 rr.logout()}catch{}kr(),e({isAuthenticated:!1,user:null,error:null})},checkAuth:async()=>{const{authConfig:n}=t();if(!(n!=null&&n.enabled)){e({isAuthenticated:!0});return}if(!ul()){e({isAuthenticated:!1,user:null});return}try{const s=await rr.getCurrentUser();e({isAuthenticated:!0,user:s})}catch{kr(),e({isAuthenticated:!1,user:null})}},clearError:()=>e({error:null})}));function W({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)]"},f={sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm"},h=t==="sm"?14:16;return a.jsxs("button",{className:`${c} ${p[e]} ${f[t]} ${n}`,disabled:o||i,...u,children:[i?a.jsx(bl,{size:h,className:"animate-spin"}):r?a.jsx(r,{size:h}):null,l,s&&!i&&a.jsx(s,{size:h})]})}const Ex={};function Px(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 Bs=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Bs(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Bs(r)(n)}}}},bx=(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=Bs(i.serialize),f=()=>{const j=i.partialize({...r()});let v;const d=p({state:j,version:i.version}).then(m=>c.setItem(i.name,m)).catch(m=>{v=m});if(v)throw v;return d},h=s.setState;s.setState=(j,v)=>{h(j,v),f()};const x=e((...j)=>{n(...j),f()},r,s);let S;const y=()=>{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 Bs(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 m;return S=i.merge(d,(m=r())!=null?m:x),n(S,!0),f()}).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:()=>y(),hasHydrated:()=>l,onHydrate:j=>(o.add(j),()=>{o.delete(j)}),onFinishHydration:j=>(u.add(j),()=>{u.delete(j)})},y(),S||x},Tx=(e,t)=>(n,r,s)=>{let i={storage:Px(()=>localStorage),partialize:y=>y,version:0,merge:(y,j)=>({...j,...y}),...t},l=!1;const o=new Set,u=new Set;let c=i.storage;if(!c)return e((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...y)},r,s);const p=()=>{const y=i.partialize({...r()});return c.setItem(i.name,{state:y,version:i.version})},f=s.setState;s.setState=(y,j)=>{f(y,j),p()};const h=e((...y)=>{n(...y),p()},r,s);s.getInitialState=()=>h;let x;const S=()=>{var y,j;if(!c)return;l=!1,o.forEach(d=>{var m;return d((m=r())!=null?m:h)});const v=((j=i.onRehydrateStorage)==null?void 0:j.call(i,(y=r())!=null?y:h))||void 0;return Bs(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 m;const[w,E]=d;if(x=i.merge(E,(m=r())!=null?m:h),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:y=>{i={...i,...y},y.storage&&(c=y.storage)},clearStorage:()=>{c==null||c.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>S(),hasHydrated:()=>l,onHydrate:y=>(o.add(y),()=>{o.delete(y)}),onFinishHydration:y=>(u.add(y),()=>{u.delete(y)})},i.skipHydration||S(),x||h},Rx=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((Ex?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),bx(e,t)):Tx(e,t),Ox=Rx,Lx=Cu()(Ox((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 Mx(){const{theme:e,toggleTheme:t}=Lx();return a.jsx("button",{onClick:t,className:"p-2 rounded-md text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)] transition-colors focus:outline-none focus:ring-2 focus:ring-[var(--accent)]","aria-label":`Switch to ${e==="dark"?"light":"dark"} mode`,title:`Switch to ${e==="dark"?"light":"dark"} mode`,children:e==="dark"?a.jsx(Yy,{size:16}):a.jsx(Gy,{size:16})})}const zx=[{path:"/agents",label:"Agents",icon:By},{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=>l==="/agents"?e.pathname==="/"||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:zx.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)?"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(Mx,{}),(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(fp,{size:14}),a.jsx("span",{children:n.username})]}),a.jsx(W,{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 Ce({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 J({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})}const Fx={pending:"default",running:"info",completed:"success",failed:"error",cancelled:"warning"};function yp({job:e,onDelete:t}){const n=tr(),r=e.total_experiments>0?e.completed_experiments/e.total_experiments*100:0;return a.jsxs(Ce,{className:"cursor-pointer hover:border-[var(--accent-dim)] flex flex-col",onClick:()=>n(`/jobs/${e.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:[a.jsx(J,{variant:Fx[e.status]||"default",children:e.status}),e.pareto_frontier.length>0&&a.jsxs(J,{variant:"success",children:[e.pareto_frontier.length," Pareto"]}),e.use_llm_eval&&a.jsx(J,{children:"LLM"})]}),a.jsx("h3",{className:"font-medium mt-2 truncate",title:e.name||`Job ${e.id.slice(0,8)}`,children:e.name||`Job ${e.id.slice(0,8)}`}),a.jsxs("code",{className:"text-xs text-[var(--text-secondary)] font-mono",children:[e.id.slice(0,8),"..."]})]}),t&&a.jsx(W,{variant:"ghost",size:"sm",onClick:s=>{s.stopPropagation(),confirm("Delete this job?")&&t(e.id)},disabled:e.status==="running",children:"×"})]}),(e.status==="running"||e.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:[e.completed_experiments,"/",e.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 ${e.status==="completed"?"bg-green-500":"bg-[var(--accent)]"}`,style:{width:`${r}%`}})})]}),e.status==="failed"&&e.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:e.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:e.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:e.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:e.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(e.created_at).toLocaleDateString()," ",new Date(e.created_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]})}function Rl({isOpen:e,onClose:t,title:n,children:r}){return k.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 et({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 Dx({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 Et({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 dd(){const e=tr(),t=er(),[n,r]=k.useState(!1),[s,i]=k.useState(null),{data:l=[],isLoading:o}=zt({queryKey:["configs"],queryFn:()=>Mi.list()}),{data:u=[]}=zt({queryKey:["jobs"],queryFn:()=>Sn.list()}),c=ht({mutationFn:Mi.create,onSuccess:()=>{t.invalidateQueries({queryKey:["configs"]}),r(!1)}}),p=ht({mutationFn:Mi.delete,onSuccess:()=>t.invalidateQueries({queryKey:["configs"]})}),f=h=>{const x=u.filter(j=>j.config_ids.includes(h)),S=x.filter(j=>j.status==="running").length,y=x.filter(j=>j.status==="completed").length;return{running:S,completed:y,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(W,{variant:"primary",icon:dp,onClick:()=>r(!0),children:"New Agent"})]}),o?a.jsxs("div",{className:"flex items-center gap-2 text-[var(--text-secondary)]",children:[a.jsx(bl,{size:16,className:"animate-spin"}),"Loading agents..."]}):l.length===0?a.jsx(Ax,{onCreateClick:()=>r(!0)}):a.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:l.map(h=>{const x=f(h.id);return a.jsx($x,{agent:h,stats:x,onOptimize:()=>i(h),onDelete:()=>{confirm(`Delete agent "${h.name}"?`)&&p.mutate(h.id)}},h.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(h=>a.jsx(yp,{job:h},h.id))}),u.length>6&&a.jsxs(W,{variant:"ghost",className:"mt-4",onClick:()=>e("/jobs"),children:["View all ",u.length," jobs →"]})]}),a.jsx(Ux,{isOpen:n,onClose:()=>r(!1),onSubmit:h=>c.mutate(h),isLoading:c.isPending}),s&&a.jsx(Qx,{agent:s,isOpen:!!s,onClose:()=>i(null)})]})}function Ax({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(W,{variant:"primary",icon:dp,onClick:e,children:"Create Your First Agent"})]})}function $x({agent:e,stats:t,onOptimize:n,onDelete:r}){return a.jsxs(Ce,{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(W,{variant:"ghost",size:"sm",icon:Xy,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(J,{children:["compaction ",e.config.compaction_head_size,"/",e.config.compaction_tail_size]}),e.config.enable_memory_tool&&a.jsx(J,{children:"memory"}),e.config.enable_sub_agent&&a.jsx(J,{children:"sub-agent"}),a.jsxs(J,{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(W,{variant:"primary",icon:Nu,onClick:n,className:"w-full",children:"Optimize"})]})}function Ux({isOpen:e,onClose:t,onSubmit:n,isLoading:r}){const[s,i]=k.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(Rl,{isOpen:e,onClose:t,title:"Create Agent",children:a.jsxs("form",{onSubmit:l,className:"space-y-4",children:[a.jsx(et,{label:"Name",value:s.name,onChange:o=>i({...s,name:o.target.value}),placeholder:"e.g., baseline, fast-compaction",required:!0}),a.jsx(et,{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(Et,{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(et,{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(et,{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(Et,{label:"Enable memory tool",checked:s.enable_memory_tool,onChange:o=>i({...s,enable_memory_tool:o.target.checked})}),a.jsx(Et,{label:"Enable sub-agent",checked:s.enable_sub_agent,onChange:o=>i({...s,enable_sub_agent:o.target.checked})})]}),a.jsx(et,{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(W,{type:"button",variant:"secondary",onClick:t,children:"Cancel"}),a.jsx(W,{type:"submit",variant:"primary",disabled:!s.name.trim(),loading:r,children:"Create Agent"})]})]})})}function Qx({agent:e,isOpen:t,onClose:n}){var _,L,B;const r=tr(),s=er(),[i,l]=k.useState("suite"),[o,u]=k.useState("quick"),[c,p]=k.useState(!1),[f,h]=k.useState([]),[x,S]=k.useState(!1),[y,j]=k.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]=k.useState(4),[m,w]=k.useState(!1),[E,N]=k.useState(null),{data:C=[]}=zt({queryKey:["tasks"],queryFn:()=>vr.list()}),P=ht({mutationFn:vr.importSuite,onSuccess:R=>{s.invalidateQueries({queryKey:["tasks"]}),h(R.map(A=>A.id))}}),I=ht({mutationFn:Mi.generateVariations,onSuccess:()=>{s.invalidateQueries({queryKey:["configs"]})}}),O=ht({mutationFn:async R=>{const A=await Sn.create(R);return Sn.start(A.id).next(),A},onSuccess:R=>{s.invalidateQueries({queryKey:["jobs"]}),N(R.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}],oe=()=>{var A,we;if(!x)return 1;let R=1;return y.vary_compaction&&(R*=2),y.vary_memory&&(R*=2),y.vary_sub_agent&&(R*=2),y.vary_compaction_head&&(R*=((A=y.compaction_head_values)==null?void 0:A.length)||3),y.vary_compaction_tail&&(R*=((we=y.compaction_tail_values)==null?void 0:we.length)||3),R},he=async()=>{l("starting");let R=f,A=[e.id];if(!c)try{R=(await P.mutateAsync(o)).map(Bt=>Bt.id)}catch(Be){console.error("Failed to import suite:",Be),alert(`Failed to import task suite: ${o}`),l("variations");return}if(R.length===0){alert("No tasks selected. Please select tasks or choose a task suite."),l("variations");return}if(x)try{A=(await I.mutateAsync({...y,base_name:e.name})).map(Bt=>Bt.id)}catch(Be){console.error("Failed to generate config variations:",Be),alert("Failed to generate config variations"),l("variations");return}const we=oe(),Yr={name:x?`${e.name} ablation (${we} configs × ${R.length} tasks)`:`${e.name} - ${o}`,config_ids:A,task_ids:R,parallel:v,use_llm_eval:m};O.mutate(Yr)},Le=R=>{h(A=>A.includes(R)?A.filter(we=>we!==R):[...A,R])},Me=()=>{l("suite"),N(null),S(!1),n()},mt=oe(),Qe=c?f.length:((_=Q.find(R=>R.value===o))==null?void 0:_.tasks)||3,T=mt*Qe;return a.jsx(Rl,{isOpen:t,onClose:Me,title:`Optimize: ${e.name}`,children:i==="success"&&E?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: ",E.slice(0,8),"..."]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(W,{variant:"secondary",onClick:Me,children:"Close"}),a.jsx(W,{variant:"primary",icon:wo,onClick:()=>{Me(),r(`/jobs/${E}`)},children:"View Job"})]})]}):i==="starting"?a.jsxs("div",{className:"flex flex-col items-center py-8",children:[a.jsx(bl,{size:32,className:"animate-spin text-[var(--accent)] mb-4"}),a.jsx("p",{className:"text-[var(--text-secondary)]",children:I.isPending?"Generating config variations...":P.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(Ss,{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(J,{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(J,{variant:"info",children:[mt," 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(Et,{label:"Compaction (on/off)",checked:y.vary_compaction,onChange:R=>j({...y,vary_compaction:R.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(Et,{label:"Memory Tool (on/off)",checked:y.vary_memory,onChange:R=>j({...y,vary_memory:R.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(Et,{label:"Sub-Agent (on/off)",checked:y.vary_sub_agent,onChange:R=>j({...y,vary_sub_agent:R.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(Et,{label:"Compaction Head Size",checked:y.vary_compaction_head,onChange:R=>j({...y,vary_compaction_head:R.target.checked})}),y.vary_compaction_head&&a.jsx(et,{label:"Head sizes (comma-separated)",value:((L=y.compaction_head_values)==null?void 0:L.join(", "))||"5, 10, 20",onChange:R=>j({...y,compaction_head_values:R.target.value.split(",").map(A=>parseInt(A.trim())).filter(A=>!isNaN(A))})}),a.jsx(Et,{label:"Compaction Tail Size",checked:y.vary_compaction_tail,onChange:R=>j({...y,vary_compaction_tail:R.target.checked})}),y.vary_compaction_tail&&a.jsx(et,{label:"Tail sizes (comma-separated)",value:((B=y.compaction_tail_values)==null?void 0:B.join(", "))||"20, 40, 60",onChange:R=>j({...y,compaction_tail_values:R.target.value.split(",").map(A=>parseInt(A.trim())).filter(A=>!isNaN(A))})})]}),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:mt})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{children:"Tasks:"}),a.jsx("span",{className:"font-mono",children:Qe})]}),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:T})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(et,{label:"Parallel Workers",type:"number",value:v,onChange:R=>d(parseInt(R.target.value)||1),min:1,max:16}),a.jsx("div",{className:"flex items-end pb-1",children:a.jsx(Et,{label:"Use LLM evaluation",checked:m,onChange:R=>w(R.target.checked)})})]}),a.jsxs("div",{className:"flex justify-between gap-2 pt-4 border-t border-[var(--border)]",children:[a.jsx(W,{variant:"secondary",icon:Vy,onClick:()=>l("suite"),children:"Back"}),a.jsxs(W,{variant:"primary",icon:wo,onClick:he,children:["Start Optimization (",T," 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(Ss,{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(R=>{const A=C.filter(we=>we.suite===R.value).length;return a.jsxs("label",{className:`flex items-center gap-3 p-3 border cursor-pointer transition-colors ${o===R.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:R.value,checked:o===R.value&&!c,onChange:()=>{u(R.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:R.label}),a.jsxs(J,{children:[R.tasks," tasks"]}),A>0&&a.jsxs(J,{variant:"success",children:[A," imported"]})]}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:R.description})]})]},R.value)})})]}),C.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:C.map(R=>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:f.includes(R.id),onChange:()=>Le(R.id),className:"accent-[var(--accent)]"}),a.jsx("span",{className:"text-sm",children:R.name}),R.suite&&a.jsx(J,{children:R.suite})]},R.id))})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-[var(--border)]",children:[a.jsx(W,{variant:"secondary",onClick:n,children:"Cancel"}),a.jsx(W,{variant:"primary",icon:Ss,onClick:()=>l("variations"),disabled:c&&f.length===0,children:"Next: Config Variations"})]})]})})}const xp=Cu(e=>({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]})),jobs:[],setJobs:t=>e({jobs:t})}));function Bx(){const e=er(),[t,n]=k.useState(!1),[r,s]=k.useState(!1),[i,l]=k.useState(new Set(["custom"])),{selectedTaskIds:o,toggleTaskSelection:u,setTasks:c}=xp(),p=d=>{l(m=>{const w=new Set(m);return w.has(d)?w.delete(d):w.add(d),w})},{data:f=[],isLoading:h}=zt({queryKey:["tasks"],queryFn:()=>vr.list()});k.useEffect(()=>{f.length>0&&c(f)},[f,c]);const x=ht({mutationFn:vr.create,onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),n(!1)}}),S=ht({mutationFn:vr.importSuite,onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),s(!1)}}),y=ht({mutationFn:vr.delete,onSuccess:()=>e.invalidateQueries({queryKey:["tasks"]})}),j=f.reduce((d,m)=>{const w=m.suite||"custom";return d[w]||(d[w]=[]),d[w].push(m),d},{}),v=Object.keys(j).sort((d,m)=>d==="custom"?-1:m==="custom"?1:d.localeCompare(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:"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(W,{variant:"secondary",onClick:()=>s(!0),children:"Import Suite"}),a.jsx(W,{variant:"primary",onClick:()=>n(!0),children:"+ New Task"})]})]}),h?a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Loading..."}):f.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 m=j[d],w=i.has(d),E=m.filter(N=>o.includes(N.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(cp,{size:16,className:"text-[var(--text-secondary)]"}):a.jsx(Ss,{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(J,{variant:d==="custom"?"default":"info",children:m.length}),E>0&&a.jsxs(J,{variant:"success",children:[E," selected"]})]}),w&&a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3 mt-2",children:m.map(N=>a.jsx(Ce,{selectable:!0,selected:o.includes(N.id),onClick:()=>u(N.id),children:a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"font-medium",children:N.name}),o.includes(N.id)&&a.jsx(J,{variant:"success",children:"Selected"}),N.category&&N.category!=="default"&&a.jsx(J,{variant:"default",children:N.category})]}),a.jsx(W,{variant:"ghost",size:"sm",onClick:C=>{C.stopPropagation(),confirm("Delete this task?")&&y.mutate(N.id)},children:"Delete"})]}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-2 line-clamp-3 flex-1",children:N.prompt}),N.criteria.length>0&&a.jsx("div",{className:"flex gap-1 mt-2 flex-wrap",children:N.criteria.map(C=>a.jsx(J,{variant:"default",children:C.name},C.name))})]})},N.id))})]},d)})}),a.jsx(Vx,{isOpen:t,onClose:()=>n(!1),onSubmit:d=>x.mutate(d),isLoading:x.isPending}),a.jsx(Hx,{isOpen:r,onClose:()=>s(!1),onSubmit:d=>S.mutate(d),isLoading:S.isPending})]})}function Vx({isOpen:e,onClose:t,onSubmit:n,isLoading:r}){const[s,i]=k.useState({name:"",prompt:"",criteria:[],category:"default"}),l=()=>{i({...s,criteria:[...s.criteria,{name:"",instruction:"",weight:1}]})},o=(p,f)=>{const h=[...s.criteria];h[p]={...h[p],...f},i({...s,criteria:h})},u=p=>{i({...s,criteria:s.criteria.filter((f,h)=>h!==p)})},c=p=>{p.preventDefault(),!(!s.name.trim()||!s.prompt.trim())&&n({...s,criteria:s.criteria.filter(f=>f.name.trim()&&f.instruction.trim())})};return a.jsx(Rl,{isOpen:e,onClose:t,title:"Create Task",children:a.jsxs("form",{onSubmit:c,className:"space-y-4",children:[a.jsx(et,{label:"Name",value:s.name,onChange:p=>i({...s,name:p.target.value}),placeholder:"e.g., fizzbuzz",required:!0}),a.jsx(Dx,{label:"Prompt",value:s.prompt,onChange:p=>i({...s,prompt:p.target.value}),placeholder:"The task description for the agent...",required:!0}),a.jsx(et,{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(W,{type:"button",variant:"ghost",size:"sm",onClick:l,children:"+ Add"})]}),a.jsx("div",{className:"space-y-2",children:s.criteria.map((p,f)=>a.jsxs("div",{className:"flex gap-2 items-start",children:[a.jsx(et,{value:p.name,onChange:h=>o(f,{name:h.target.value}),placeholder:"Name",className:"w-32"}),a.jsx(et,{value:p.instruction,onChange:h=>o(f,{instruction:h.target.value}),placeholder:"Instruction",className:"flex-1"}),a.jsx(W,{type:"button",variant:"ghost",size:"sm",onClick:()=>u(f),children:"×"})]},f))})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[a.jsx(W,{type:"button",variant:"secondary",onClick:t,children:"Cancel"}),a.jsx(W,{type:"submit",variant:"primary",disabled:r||!s.name.trim()||!s.prompt.trim(),children:r?"Creating...":"Create"})]})]})})}function Hx({isOpen:e,onClose:t,onSubmit:n,isLoading:r}){const[s,i]=k.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(Rl,{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(W,{type:"button",variant:"secondary",onClick:t,children:"Cancel"}),a.jsx(W,{variant:"primary",onClick:()=>n(s),disabled:r,children:r?"Importing...":"Import"})]})]})})}function Wx(){const e=tr(),t=er(),{setJobs:n}=xp(),{data:r=[],isLoading:s}=zt({queryKey:["jobs"],queryFn:()=>Sn.list(),refetchInterval:5e3});k.useEffect(()=>{r.length>0&&n(r)},[r,n]);const i=ht({mutationFn:Sn.delete,onSuccess:()=>t.invalidateQueries({queryKey:["jobs"]})});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:"View and manage optimization experiments. Start new jobs from the Agents page."})]}),a.jsx(W,{variant:"secondary",onClick:()=>e("/agents"),children:"Go to Agents"})]}),s?a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Loading..."}):r.length===0?a.jsx("div",{className:"text-center py-12 text-[var(--text-secondary)]",children:"No jobs yet. Go to Agents page to start an optimization."}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:r.map(l=>a.jsx(yp,{job:l,onDelete:o=>i.mutate(o)},l.id))})]})}function Kx(e,t=!0){return Math.abs(e)<10?"text-[var(--text-secondary)]":(t?e<0:e>0)?"text-green-400":"text-red-400"}function qx(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 ${Kx(u,s)}`,children:qx(u)}),c&&a.jsx("div",{className:"text-xs text-[var(--text-secondary)]",children:"(baseline)"})]},o)})]})}function Gx({runs:e,baselineRunId:t}){const n=k.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(Ce,{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(J,{variant:"success",children:"Pareto"}),l===n&&a.jsx(J,{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 Jx({summaries:e,height:t=350}){const n=k.useRef(null),[r,s]=k.useState(600),[i,l]=k.useState("tokens"),[o,u]=k.useState(null),[c,p]=k.useState({x:0,y:0});k.useEffect(()=>{const N=()=>{n.current&&s(n.current.clientWidth)};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]);const f={top:30,right:30,bottom:50,left:60},h=r-f.left-f.right,x=t-f.top-f.bottom,S=N=>i==="tokens"?N.avg_tokens:N.avg_duration,{xScale:y,yScale:j,xTicks:v,yTicks:d,paretoLine:m}=k.useMemo(()=>{if(e.length===0||h<=0)return{xScale:()=>0,yScale:()=>0,xTicks:[],yTicks:[],paretoLine:[]};const N=e.map(S),C=e.map(T=>T.avg_score),P=Math.min(...N)*.9,I=Math.max(...N)*1.1,O=Math.min(...C,.5),Q=Math.min(Math.max(...C)*1.05,1),oe=T=>(T-P)/(I-P)*h,he=T=>x-(T-O)/(Q-O)*x,Le=Array.from({length:5},(T,_)=>P+_/4*(I-P)),Me=Array.from({length:5},(T,_)=>O+_/4*(Q-O)),Qe=e.filter(T=>T.is_pareto).sort((T,_)=>S(T)-S(_)).map(T=>({x:oe(S(T)),y:he(T.avg_score)}));return{xScale:oe,yScale:he,xTicks:Le,yTicks:Me,paretoLine:Qe}},[e,h,x,i]);if(e.length===0)return a.jsx("div",{className:"text-center py-8 text-[var(--text-secondary)]",children:"No data to display"});const w=N=>i==="tokens"?N>=1e6?`${(N/1e6).toFixed(1)}M`:N>=1e3?`${(N/1e3).toFixed(0)}K`:N.toFixed(0):`${N.toFixed(1)}s`,E=(N,C)=>{var I;const P=(I=n.current)==null?void 0:I.getBoundingClientRect();P&&p({x:C.clientX-P.left,y:C.clientY-P.top}),u(N)};return a.jsxs("div",{ref:n,className:"w-full relative",children:[a.jsx("div",{className:"flex justify-end mb-2",children:a.jsxs("div",{className:"inline-flex rounded border border-[var(--border)] text-xs",children:[a.jsx("button",{className:`px-3 py-1 ${i==="tokens"?"bg-[var(--accent)] text-black":"text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,onClick:()=>l("tokens"),children:"Tokens"}),a.jsx("button",{className:`px-3 py-1 ${i==="duration"?"bg-[var(--accent)] text-black":"text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,onClick:()=>l("duration"),children:"Latency"})]})}),a.jsx("svg",{width:r,height:t,className:"font-mono text-xs",children:a.jsxs("g",{transform:`translate(${f.left}, ${f.top})`,children:[v.map((N,C)=>a.jsx("line",{x1:y(N),y1:0,x2:y(N),y2:x,stroke:"var(--border)",strokeDasharray:"2,2"},`x-grid-${C}`)),d.map((N,C)=>a.jsx("line",{x1:0,y1:j(N),x2:h,y2:j(N),stroke:"var(--border)",strokeDasharray:"2,2"},`y-grid-${C}`)),m.length>1&&a.jsx("polyline",{points:m.map(N=>`${N.x},${N.y}`).join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),e.slice().sort((N,C)=>(N.is_pareto?1:0)-(C.is_pareto?1:0)).map(N=>{const C=y(S(N)),P=j(N.avg_score),I=N.is_pareto,O=(o==null?void 0:o.config_name)===N.config_name;return a.jsxs("g",{onMouseEnter:Q=>E(N,Q),onMouseLeave:()=>u(null),children:[a.jsx("circle",{cx:C,cy:P,r:O?10:I?8:6,fill:I?"var(--accent)":"transparent",stroke:O?"var(--text-primary)":I?"var(--accent)":"var(--text-secondary)",strokeWidth:O?3:2,className:"cursor-pointer transition-all"}),I&&!O&&a.jsx("text",{x:C,y:P-12,textAnchor:"middle",fill:"var(--text-primary)",fontSize:10,className:"pointer-events-none",children:N.config_name.replace(/^baseline_/,"").slice(0,15)})]},N.config_name)}),a.jsx("line",{x1:0,y1:x,x2:h,y2:x,stroke:"var(--text-secondary)"}),v.map((N,C)=>a.jsxs("g",{transform:`translate(${y(N)}, ${x})`,children:[a.jsx("line",{y2:5,stroke:"var(--text-secondary)"}),a.jsx("text",{y:20,textAnchor:"middle",fill:"var(--text-secondary)",fontSize:10,children:w(N)})]},`x-tick-${C}`)),a.jsx("text",{x:h/2,y:x+40,textAnchor:"middle",fill:"var(--text-secondary)",fontSize:11,children:i==="tokens"?"Tokens (cost)":"Duration (latency)"}),a.jsx("line",{x1:0,y1:0,x2:0,y2:x,stroke:"var(--text-secondary)"}),d.map((N,C)=>a.jsxs("g",{transform:`translate(0, ${j(N)})`,children:[a.jsx("line",{x2:-5,stroke:"var(--text-secondary)"}),a.jsxs("text",{x:-10,textAnchor:"end",dominantBaseline:"middle",fill:"var(--text-secondary)",fontSize:10,children:[(N*100).toFixed(0),"%"]})]},`y-tick-${C}`)),a.jsx("text",{transform:`translate(-45, ${x/2}) rotate(-90)`,textAnchor:"middle",fill:"var(--text-secondary)",fontSize:11,children:"Score (quality)"})]})}),o&&a.jsxs("div",{className:"absolute z-10 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-lg shadow-lg p-3 text-sm pointer-events-none",style:{left:Math.min(c.x+15,r-200),top:c.y-10,maxWidth:220},children:[a.jsx("div",{className:"font-medium text-[var(--text-primary)] truncate mb-2",children:o.config_name.replace(/^baseline_/,"")}),a.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[a.jsx("span",{className:"text-[var(--text-secondary)]",children:"Score:"}),a.jsxs("span",{className:"text-right font-medium",children:[(o.avg_score*100).toFixed(1),"%"]}),a.jsx("span",{className:"text-[var(--text-secondary)]",children:"Tokens:"}),a.jsxs("span",{className:"text-right",children:[(o.avg_tokens/1e3).toFixed(1),"K"]}),a.jsx("span",{className:"text-[var(--text-secondary)]",children:"Duration:"}),a.jsxs("span",{className:"text-right",children:[o.avg_duration.toFixed(1),"s"]}),a.jsx("span",{className:"text-[var(--text-secondary)]",children:"Pass rate:"}),a.jsxs("span",{className:"text-right",children:[o.passed_runs,"/",o.total_runs]})]}),o.is_pareto&&a.jsx("div",{className:"mt-2 pt-2 border-t border-[var(--border)] text-xs text-[var(--accent)]",children:"Pareto optimal"})]})]})}function Yx(){const{jobId:e}=ip(),t=tr(),n=er(),[r,s]=k.useState(null),[i,l]=k.useState(!1),[o,u]=k.useState(null),[c,p]=k.useState([]),[f,h]=k.useState(null),[x,S]=k.useState(null),[y,j]=k.useState(!1),[v,d]=k.useState("score"),[m,w]=k.useState("desc"),[E,N]=k.useState(!1),{data:C,isLoading:P}=zt({queryKey:["jobs",e],queryFn:()=>Sn.get(e),enabled:!!e,refetchInterval:i?2e3:!1}),{data:I=[]}=zt({queryKey:["runs",e],queryFn:()=>So.list({job_id:e}),enabled:!!e,refetchInterval:i?2e3:!1}),{data:O}=zt({queryKey:["job-summary",e],queryFn:()=>So.getJobSummary(e),enabled:!!e&&(C==null?void 0:C.status)==="completed"}),Q=ht({mutationFn:async()=>{l(!0),p([]),h(null),S(null);for await(const _ of Sn.start(e))s(_),_.current_config&&_.current_task&&h(L=>(L&&(L.config!==_.current_config||L.task!==_.current_task)&&p(B=>[...B,{config_name:L.config,task_name:L.task,completed_at:Date.now()}]),{config:_.current_config,task:_.current_task})),_.event==="error"&&(S(_.message),l(!1),n.invalidateQueries({queryKey:["jobs",e]})),_.event==="complete"&&(h(L=>(L&&p(B=>[...B,{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]}))}}),oe=ht({mutationFn:()=>Sn.cancel(e),onSuccess:()=>{l(!1),n.invalidateQueries({queryKey:["jobs",e]})}});k.useEffect(()=>{(C==null?void 0:C.status)==="running"&&l(!0)},[C==null?void 0:C.status]);const he=k.useMemo(()=>{const _=new Map;for(const L of I)_.has(L.task_name)||_.set(L.task_name,[]),_.get(L.task_name).push(L);return _},[I]),Le=k.useMemo(()=>Array.from(he.keys()),[he]),Me=k.useMemo(()=>{if(!(O!=null&&O.config_summaries))return[];let _=[...O.config_summaries];return E&&(_=_.filter(L=>L.is_pareto)),_.sort((L,B)=>{let R,A;switch(v){case"score":R=L.avg_score,A=B.avg_score;break;case"tokens":R=L.avg_tokens,A=B.avg_tokens;break;case"duration":R=L.avg_duration,A=B.avg_duration;break;case"pass_rate":R=L.passed_runs/L.total_runs,A=B.passed_runs/B.total_runs;break}return m==="desc"?A-R:R-A}),_},[O,v,m,E]),mt=_=>{v===_?w(m==="desc"?"asc":"desc"):(d(_),w(_==="tokens"||_==="duration"?"asc":"desc"))},Qe=({label:_,sortKeyVal:L})=>a.jsx("th",{className:"pb-2 cursor-pointer hover:text-[var(--text-primary)] select-none",onClick:()=>mt(L),children:a.jsxs("div",{className:"flex items-center gap-1",children:[_,v===L&&a.jsx(Qy,{size:12,className:m==="asc"?"rotate-180":""})]})});if(P)return a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Loading..."});if(!C)return a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Job not found"});const T=_=>{const L={pending:"default",running:"info",completed:"success",failed:"error",cancelled:"warning"};return a.jsx(J,{variant:L[_]||"default",children:_})};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:C.name||`Job ${C.id.slice(0,8)}`}),T(C.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:[C.id.slice(0,8),"..."]}),a.jsxs("span",{className:"text-sm text-[var(--text-secondary)]",children:[C.config_ids.length," configs × ",C.task_ids.length," tasks = ",C.total_experiments," experiments"]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[C.status==="pending"&&a.jsx(W,{variant:"primary",onClick:()=>Q.mutate(),disabled:Q.isPending,children:Q.isPending?"Starting...":"Start"}),C.status==="running"&&a.jsx(W,{variant:"danger",onClick:()=>oe.mutate(),disabled:oe.isPending,children:"Cancel"})]})]}),(x||C.error)&&a.jsx(Ce,{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||C.error})]})]})}),(i||r)&&a.jsxs(Ce,{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)||C.completed_experiments,"/",(r==null?void 0:r.total)||C.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)||C.completed_experiments)/((r==null?void 0:r.total)||C.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((_,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:_.config_name}),a.jsx("span",{className:"text-[var(--text-secondary)]",children:"→"}),a.jsx("span",{children:_.task_name})]},`${_.config_name}-${_.task_name}-${L}`))})]})]})]}),O&&O.config_summaries.length>1&&a.jsxs(Ce,{className:"mb-6",children:[a.jsx("div",{className:"flex items-start justify-between mb-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium",children:"Pareto Frontier"}),a.jsxs("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:["Configs on the frontier (connected line) are ",a.jsx("strong",{children:"Pareto optimal"})," - no other config beats them on both score AND cost."]})]})}),a.jsxs("div",{className:"mb-4 p-3 bg-[var(--bg-primary)] rounded border border-[var(--border)] text-xs text-[var(--text-secondary)]",children:[a.jsx("strong",{className:"text-[var(--text-primary)]",children:"How Pareto optimal is calculated:"})," A config is Pareto optimal if there's no other config that has both a higher score AND lower cost. For example, if Config A has 95% score at 50K tokens and Config B has 90% score at 40K tokens, both are Pareto optimal - A is better on score, B is better on cost. But if Config C has 85% score at 60K tokens, it's ",a.jsx("em",{children:"not"})," Pareto optimal because B beats it on both metrics."]}),a.jsx(Jx,{summaries:O.config_summaries,height:350})]}),O&&a.jsxs(Ce,{className:"mb-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"font-medium",children:"Results Summary"}),a.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text-secondary)] cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:E,onChange:_=>N(_.target.checked),className:"rounded border-[var(--border)]"}),"Pareto only"]})]}),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(Qe,{label:"Score",sortKeyVal:"score"}),a.jsx(Qe,{label:"Tokens",sortKeyVal:"tokens"}),a.jsx(Qe,{label:"Duration",sortKeyVal:"duration"}),a.jsx(Qe,{label:"Pass Rate",sortKeyVal:"pass_rate"}),a.jsx("th",{className:"pb-2",children:"Pareto"})]})}),a.jsx("tbody",{children:Me.map((_,L)=>a.jsxs("tr",{className:`border-b border-[var(--border)] ${L===0?"bg-[var(--accent)]/10":""}`,children:[a.jsxs("td",{className:"py-2 font-medium",children:[L===0&&a.jsx("span",{className:"text-[var(--accent)] mr-1",children:"#1"}),_.config_name.replace(/^baseline_/,"")]}),a.jsxs("td",{className:"py-2",children:[(_.avg_score*100).toFixed(1),"%"]}),a.jsxs("td",{className:"py-2",children:[(_.avg_tokens/1e3).toFixed(1),"K"]}),a.jsxs("td",{className:"py-2",children:[_.avg_duration.toFixed(1),"s"]}),a.jsxs("td",{className:"py-2",children:[_.passed_runs,"/",_.total_runs]}),a.jsx("td",{className:"py-2",children:_.is_pareto&&a.jsx(J,{variant:"success",children:"Pareto"})})]},_.config_name))})]})}),a.jsx("p",{className:"text-xs text-[var(--text-secondary)] mt-3",children:"Click column headers to sort. The #1 ranked config is highlighted based on your sort criteria."})]}),C.status==="completed"&&Le.length>0&&a.jsxs(Ce,{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:Le.map(_=>a.jsx("button",{onClick:()=>u(o===_?null:_),className:`px-3 py-1 text-sm rounded border transition-colors ${o===_?"bg-[var(--accent)] text-white border-[var(--accent)]":"border-[var(--border)] hover:border-[var(--accent-dim)]"}`,children:_},_))}),o&&he.get(o)&&a.jsx(Gx,{runs:he.get(o).map(_=>({id:_.id,config_name:_.config_name,tokens_input:0,tokens_output:0,tokens_total:_.tokens_total,duration_seconds:_.duration_seconds,score:_.score,passed:_.passed,is_pareto:_.is_pareto}))})]}),a.jsxs(Ce,{children:[a.jsxs("button",{className:"w-full flex items-center justify-between py-2",onClick:()=>j(!y),children:[a.jsxs("h3",{className:"font-medium flex items-center gap-2",children:[y?a.jsx(cp,{size:18}):a.jsx(Ss,{size:18}),"Runs (",I.length,"/",C.total_experiments,")"]}),I.length>0&&!y&&a.jsx("span",{className:"text-sm text-[var(--text-secondary)]",children:"Click to expand"})]}),y&&a.jsx("div",{className:"mt-4",children:I.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 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:I.map(_=>a.jsxs("div",{className:"p-3 bg-[var(--bg-primary)] rounded border border-[var(--border)] cursor-pointer hover:border-[var(--accent-dim)] transition-colors",onClick:()=>t(`/runs/${_.id}`),children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:`text-lg font-bold ${_.passed?"text-green-400":"text-red-400"}`,children:[(_.score*100).toFixed(0),"%"]}),_.is_pareto&&a.jsx(J,{variant:"success",children:"Pareto"})]}),a.jsx("div",{className:"text-sm font-medium truncate",title:_.config_name,children:_.config_name.replace(/^baseline_/,"")}),a.jsx("div",{className:"text-xs text-[var(--text-secondary)] truncate",children:_.task_name}),a.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-[var(--text-secondary)]",children:[a.jsxs("span",{children:[(_.tokens_total/1e3).toFixed(1),"K tokens"]}),a.jsxs("span",{children:[_.duration_seconds.toFixed(1),"s"]})]})]},_.id))})})]})]})}function Xx(e){const t=[],n=r=>r.type==="trace_span"&&typeof r.data=="object"&&r.data!==null?r.data:"span_id"in r?r:null;if(Array.isArray(e.spans)){for(const r of e.spans)if(typeof r=="object"&&r!==null){const s=n(r);s&&t.push(s)}}else if(e.span_id)t.push(e);else for(const r in e){const s=e[r];if(typeof s=="object"&&s!==null){const i=n(s);if(i)t.push(i);else if(Array.isArray(s)){for(const l of s)if(typeof l=="object"&&l!==null){const o=n(l);o&&t.push(o)}}}}return t}function Zx(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 e0(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 t0(e){return e>=1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(0)}ms`}function Sp({node:e,depth:t=0}){var f,h;const[n,r]=k.useState(t<2),[s,i]=k.useState(!1),{span:l}=e,o=e.children.length>0,u=(f=l.attributes)==null?void 0:f["gen_ai.usage.input_tokens"],c=(h=l.attributes)==null?void 0:h["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 ${e0(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:t0(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 n0({trace:e}){const[t,n]=k.useState("tree"),r=k.useMemo(()=>Xx(e),[e]),s=k.useMemo(()=>Zx(r),[r]);return Object.keys(e).length===0?null:a.jsxs(Ce,{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(J,{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 cn={input:"bg-blue-500",output:"bg-emerald-500",inputText:"text-blue-400",outputText:"text-emerald-400"};function fd(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function hd({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 ${cn.input} transition-all`,style:{width:`${e/i*100}%`},title:`Input: ${e.toLocaleString()} tokens`}),a.jsx("div",{className:`h-full ${cn.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:cn.inputText,children:["↑",fd(e)]}),a.jsx("span",{children:"/"}),a.jsxs("span",{className:cn.outputText,children:["↓",fd(t)]})]})]})}function aa({label:e,value:t,color:n="default"}){const r={default:"text-[var(--text-primary)]",input:cn.inputText,output:cn.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 r0({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=k.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(Ce,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-4",children:"Token Usage"}),a.jsx("div",{className:"mb-4",children:a.jsx(hd,{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 ${cn.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 ${cn.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(hd,{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 s0(){const{runId:e}=ip(),t=tr(),{data:n,isLoading:r}=zt({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(J,{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(r0,{tokensInput:n.tokens_input,tokensOutput:n.tokens_output,tokensTotal:n.tokens_total}),a.jsxs(Ce,{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(J,{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(Ce,{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(Ce,{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(n0,{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(Ce,{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 i0(){const{authConfig:e,isLoading:t,error:n,login:r,loginWithGitHub:s,clearError:i}=Tu(),[l,o]=k.useState(""),[u,c]=k.useState("");k.useEffect(()=>{n&&i()},[l,u]);const p=async h=>{h.preventDefault(),!(!l||!u)&&await r(l,u)},f=()=>{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(Uy,{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(fp,{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:h=>o(h.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:h=>c(h.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(W,{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(W,{onClick:f,variant:"secondary",className:"w-full justify-center",icon:Hy,children:"Continue with GitHub"})]})]})]})})}function l0({children:e}){const{authConfig:t,isLoadingConfig:n,isAuthenticated:r,loadAuthConfig:s,handleOAuthCallback:i}=Tu();return k.useEffect(()=>{s()},[s]),k.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(bl,{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(i0,{}):a.jsx(a.Fragment,{children:e})}function a0(){return a.jsx(Oy,{children:a.jsx(l0,{children:a.jsx(Ny,{children:a.jsxs(Wt,{path:"/",element:a.jsx(Ix,{}),children:[a.jsx(Wt,{index:!0,element:a.jsx(dd,{})}),a.jsx(Wt,{path:"agents",element:a.jsx(dd,{})}),a.jsx(Wt,{path:"tasks",element:a.jsx(Bx,{})}),a.jsx(Wt,{path:"jobs",element:a.jsx(Wx,{})}),a.jsx(Wt,{path:"jobs/:jobId",element:a.jsx(Yx,{})}),a.jsx(Wt,{path:"runs/:runId",element:a.jsx(s0,{})})]})})})})}const pd=localStorage.getItem("flow-theme");if(pd)try{const{state:e}=JSON.parse(pd);e!=null&&e.theme&&document.documentElement.setAttribute("data-theme",e.theme)}catch{}const o0=new xg({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!1}}});oa.createRoot(document.getElementById("root")).render(a.jsx(Eo.StrictMode,{children:a.jsx(wg,{client:o0,children:a.jsx(a0,{})})}));