diff --git "a/src/flow/ui/ui/assets/index-AwuECPjC.js" "b/src/flow/ui/ui/assets/index-AwuECPjC.js" new file mode 100644--- /dev/null +++ "b/src/flow/ui/ui/assets/index-AwuECPjC.js" @@ -0,0 +1,194 @@ +var Ou=e=>{throw TypeError(e)};var Ll=(e,t,n)=>t.has(e)||Ou("Cannot "+n);var g=(e,t,n)=>(Ll(e,t,"read from private field"),n?n.call(e):t.get(e)),I=(e,t,n)=>t.has(e)?Ou("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),R=(e,t,n,r)=>(Ll(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),$=(e,t,n)=>(Ll(e,t,"access private method"),n);var ti=(e,t,n,r)=>({set _(s){R(e,t,s,n)},get _(){return g(e,t,r)}});function kp(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function Pd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bd={exports:{}},cl={},Td={exports:{}},A={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Gs=Symbol.for("react.element"),Np=Symbol.for("react.portal"),Cp=Symbol.for("react.fragment"),_p=Symbol.for("react.strict_mode"),Ep=Symbol.for("react.profiler"),Pp=Symbol.for("react.provider"),bp=Symbol.for("react.context"),Tp=Symbol.for("react.forward_ref"),Op=Symbol.for("react.suspense"),Rp=Symbol.for("react.memo"),Lp=Symbol.for("react.lazy"),Ru=Symbol.iterator;function Mp(e){return e===null||typeof e!="object"?null:(e=Ru&&e[Ru]||e["@@iterator"],typeof e=="function"?e:null)}var Od={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Rd=Object.assign,Ld={};function Vr(e,t,n){this.props=e,this.context=t,this.refs=Ld,this.updater=n||Od}Vr.prototype.isReactComponent={};Vr.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Vr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Md(){}Md.prototype=Vr.prototype;function No(e,t,n){this.props=e,this.context=t,this.refs=Ld,this.updater=n||Od}var Co=No.prototype=new Md;Co.constructor=No;Rd(Co,Vr.prototype);Co.isPureReactComponent=!0;var Lu=Array.isArray,zd=Object.prototype.hasOwnProperty,_o={current:null},Id={key:!0,ref:!0,__self:!0,__source:!0};function Fd(e,t,n){var r,s={},i=null,l=null;if(t!=null)for(r in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(i=""+t.key),t)zd.call(t,r)&&!Id.hasOwnProperty(r)&&(s[r]=t[r]);var o=arguments.length-2;if(o===1)s.children=n;else if(1>>1,O=T[J];if(0>>1;Js(Yr,D))Aes(Bt,Yr)?(T[J]=Bt,T[Ae]=D,J=Ae):(T[J]=Yr,T[Se]=D,J=Se);else if(Aes(Bt,D))T[J]=Bt,T[Ae]=D,J=Ae;else break e}}return F}function s(T,F){var D=T.sortIndex-F.sortIndex;return D!==0?D:T.id-F.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=[],m=1,h=null,d=3,x=!1,S=!1,y=!1,j=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(T){for(var F=n(c);F!==null;){if(F.callback===null)r(c);else if(F.startTime<=T)r(c),F.sortIndex=F.expirationTime,t(u,F);else break;F=n(c)}}function w(T){if(y=!1,v(T),!S)if(n(u)!==null)S=!0,pt(N);else{var F=n(c);F!==null&&Qt(w,F.startTime-T)}}function N(T,F){S=!1,y&&(y=!1,p(C),C=-1),x=!0;var D=d;try{for(v(F),h=n(u);h!==null&&(!(h.expirationTime>F)||T&&!P());){var J=h.callback;if(typeof J=="function"){h.callback=null,d=h.priorityLevel;var O=J(h.expirationTime<=F);F=e.unstable_now(),typeof O=="function"?h.callback=O:h===n(u)&&r(u),v(F)}else r(u);h=n(u)}if(h!==null)var V=!0;else{var Se=n(c);Se!==null&&Qt(w,Se.startTime-F),V=!1}return V}finally{h=null,d=D,x=!1}}var _=!1,b=null,C=-1,L=5,z=-1;function P(){return!(e.unstable_now()-zT||125J?(T.sortIndex=D,t(c,T),n(u)===null&&T===n(c)&&(y?(p(C),C=-1):y=!0,Qt(w,D-J))):(T.sortIndex=O,t(u,T),S||x||(S=!0,pt(N))),T},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(T){var F=d;return function(){var D=d;d=F;try{return T.apply(this,arguments)}finally{d=D}}}})(Qd);Ud.exports=Qd;var Wp=Ud.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 Kp=k,Ve=Wp;function E(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ca=Object.prototype.hasOwnProperty,qp=/^[: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 Gp(e){return ca.call(Iu,e)?!0:ca.call(zu,e)?!1:qp.test(e)?Iu[e]=!0:(zu[e]=!0,!1)}function Jp(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Yp(e,t,n,r){if(t===null||typeof t>"u"||Jp(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Re(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 we={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){we[e]=new Re(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];we[t]=new Re(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){we[e]=new Re(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){we[e]=new Re(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){we[e]=new Re(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){we[e]=new Re(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){we[e]=new Re(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){we[e]=new Re(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){we[e]=new Re(e,5,!1,e.toLowerCase(),null,!1,!1)});var bo=/[\-:]([a-z])/g;function To(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(bo,To);we[t]=new Re(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(bo,To);we[t]=new Re(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(bo,To);we[t]=new Re(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){we[e]=new Re(e,1,!1,e.toLowerCase(),null,!1,!1)});we.xlinkHref=new Re("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){we[e]=new Re(e,1,!1,e.toLowerCase(),null,!0,!0)});function Oo(e,t,n,r){var s=we.hasOwnProperty(t)?we[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{Il=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?as(e):""}function Xp(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=Fl(e.type,!1),e;case 11:return e=Fl(e.type.render,!1),e;case 1:return e=Fl(e.type,!0),e;default:return""}}function pa(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case sr:return"Fragment";case rr:return"Portal";case da:return"Profiler";case Ro:return"StrictMode";case fa:return"Suspense";case ha:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Hd:return(e.displayName||"Context")+".Consumer";case Vd:return(e._context.displayName||"Context")+".Provider";case Lo:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Mo:return t=e.displayName||null,t!==null?t:pa(e.type)||"Memo";case Kt:t=e._payload,e=e._init;try{return pa(e(t))}catch{}}return null}function Zp(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 pa(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 Kd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function em(e){var t=Kd(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(l){r=""+l,i.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(l){r=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function si(e){e._valueTracker||(e._valueTracker=em(e))}function qd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Kd(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function zi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ma(e,t){var n=t.checked;return re({},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 Gd(e,t){t=t.checked,t!=null&&Oo(e,"checked",t,!1)}function va(e,t){Gd(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")?ga(e,t.type,n):t.hasOwnProperty("defaultValue")&&ga(e,t.type,jn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $u(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 ga(e,t,n){(t!=="number"||zi(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var os=Array.isArray;function vr(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=ii.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function 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},tm=["Webkit","ms","Moz","O"];Object.keys(fs).forEach(function(e){tm.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fs[t]=fs[e]})});function Zd(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||fs.hasOwnProperty(e)&&fs[e]?(""+t).trim():t+"px"}function ef(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Zd(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var nm=re({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function wa(e,t){if(t){if(nm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(E(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(E(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(E(61))}if(t.style!=null&&typeof t.style!="object")throw Error(E(62))}}function Sa(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 ja=null;function zo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ka=null,gr=null,yr=null;function Qu(e){if(e=Xs(e)){if(typeof ka!="function")throw Error(E(280));var t=e.stateNode;t&&(t=ml(t),ka(e.stateNode,e.type,t))}}function tf(e){gr?yr?yr.push(e):yr=[e]:gr=e}function nf(){if(gr){var e=gr,t=yr;if(yr=gr=null,Qu(e),t)for(e=0;e>>=0,e===0?32:31-(hm(e)/pm|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 $i(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-ct(t),e[t]=n}function ym(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=ps),Yu=" ",Xu=!1;function kf(e,t){switch(e){case"keyup":return Wm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ir=!1;function qm(e,t){switch(e){case"compositionend":return Nf(t);case"keypress":return t.which!==32?null:(Xu=!0,Yu);case"textInput":return e=t.data,e===Yu&&Xu?null:e;default:return null}}function Gm(e,t){if(ir)return e==="compositionend"||!Bo&&kf(e,t)?(e=Sf(),Ni=Ao=an=null,ir=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=nc(n)}}function Pf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Pf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function bf(){for(var e=window,t=zi();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=zi(e.document)}return t}function Vo(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 sv(e){var t=bf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Pf(n.ownerDocument.documentElement,n)){if(r!==null&&Vo(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=rc(n,i);var l=rc(n,r);s&&l&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,lr=null,ba=null,vs=null,Ta=!1;function sc(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ta||lr==null||lr!==zi(r)||(r=lr,"selectionStart"in r&&Vo(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(ba,"onSelect"),0ur||(e.current=Ia[ur],Ia[ur]=null,ur--)}function G(e,t){ur++,Ia[ur]=e.current,e.current=t}var kn={},_e=Cn(kn),Fe=Cn(!1),Hn=kn;function Ir(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 De(e){return e=e.childContextTypes,e!=null}function Vi(){X(Fe),X(_e)}function dc(e,t,n){if(_e.current!==kn)throw Error(E(168));G(_e,t),G(Fe,n)}function Df(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(E(108,Zp(e)||"Unknown",s));return re({},n,r)}function Hi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||kn,Hn=_e.current,G(_e,e),G(Fe,Fe.current),!0}function fc(e,t,n){var r=e.stateNode;if(!r)throw Error(E(169));n?(e=Df(e,t,Hn),r.__reactInternalMemoizedMergedChildContext=e,X(Fe),X(_e),G(_e,e)):X(Fe),G(Fe,n)}var Ct=null,vl=!1,Yl=!1;function $f(e){Ct===null?Ct=[e]:Ct.push(e)}function vv(e){vl=!0,$f(e)}function _n(){if(!Yl&&Ct!==null){Yl=!0;var e=0,t=K;try{var n=Ct;for(K=1;e>=l,s-=l,Ot=1<<32-ct(t)+s|n<C?(L=b,b=null):L=b.sibling;var z=d(p,b,v[C],w);if(z===null){b===null&&(b=L);break}e&&b&&z.alternate===null&&t(p,b),f=i(z,f,C),_===null?N=z:_.sibling=z,_=z,b=L}if(C===v.length)return n(p,b),Z&&Pn(p,C),N;if(b===null){for(;CC?(L=b,b=null):L=b.sibling;var P=d(p,b,z.value,w);if(P===null){b===null&&(b=L);break}e&&b&&P.alternate===null&&t(p,b),f=i(P,f,C),_===null?N=P:_.sibling=P,_=P,b=L}if(z.done)return n(p,b),Z&&Pn(p,C),N;if(b===null){for(;!z.done;C++,z=v.next())z=h(p,z.value,w),z!==null&&(f=i(z,f,C),_===null?N=z:_.sibling=z,_=z);return Z&&Pn(p,C),N}for(b=r(p,b);!z.done;C++,z=v.next())z=x(b,p,C,z.value,w),z!==null&&(e&&z.alternate!==null&&b.delete(z.key===null?C:z.key),f=i(z,f,C),_===null?N=z:_.sibling=z,_=z);return e&&b.forEach(function(U){return t(p,U)}),Z&&Pn(p,C),N}function j(p,f,v,w){if(typeof v=="object"&&v!==null&&v.type===sr&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case ri:e:{for(var N=v.key,_=f;_!==null;){if(_.key===N){if(N=v.type,N===sr){if(_.tag===7){n(p,_.sibling),f=s(_,v.props.children),f.return=p,p=f;break e}}else if(_.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Kt&&mc(N)===_.type){n(p,_.sibling),f=s(_,v.props),f.ref=rs(p,_,v),f.return=p,p=f;break e}n(p,_);break}else t(p,_);_=_.sibling}v.type===sr?(f=Vn(v.props.children,p.mode,w,v.key),f.return=p,p=f):(w=Ri(v.type,v.key,v.props,null,p.mode,w),w.ref=rs(p,f,v),w.return=p,p=w)}return l(p);case rr:e:{for(_=v.key;f!==null;){if(f.key===_)if(f.tag===4&&f.stateNode.containerInfo===v.containerInfo&&f.stateNode.implementation===v.implementation){n(p,f.sibling),f=s(f,v.children||[]),f.return=p,p=f;break e}else{n(p,f);break}else t(p,f);f=f.sibling}f=ia(v,p.mode,w),f.return=p,p=f}return l(p);case Kt:return _=v._init,j(p,f,_(v._payload),w)}if(os(v))return S(p,f,v,w);if(Xr(v))return y(p,f,v,w);pi(p,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,f!==null&&f.tag===6?(n(p,f.sibling),f=s(f,v),f.return=p,p=f):(n(p,f),f=sa(v,p.mode,w),f.return=p,p=f),l(p)):n(p,f)}return j}var Dr=Bf(!0),Vf=Bf(!1),qi=Cn(null),Gi=null,fr=null,qo=null;function Go(){qo=fr=Gi=null}function Jo(e){var t=qi.current;X(qi),e._currentValue=t}function $a(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function wr(e,t){Gi=e,qo=fr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ie=!0),e.firstContext=null)}function tt(e){var t=e._currentValue;if(qo!==e)if(e={context:e,memoizedValue:t,next:null},fr===null){if(Gi===null)throw Error(E(308));fr=e,Gi.dependencies={lanes:0,firstContext:e}}else fr=fr.next=e;return t}var On=null;function Yo(e){On===null?On=[e]:On.push(e)}function Hf(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Yo(t)):(n.next=s.next,s.next=n),t.interleaved=n,Dt(e,r)}function Dt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var qt=!1;function Xo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Wf(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Lt(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,B&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Dt(e,n)}return s=r.interleaved,s===null?(t.next=t,Yo(r)):(t.next=s.next,s.next=t),r.interleaved=t,Dt(e,n)}function _i(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fo(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 m=e.alternate;m!==null&&(m=m.updateQueue,o=m.lastBaseUpdate,o!==l&&(o===null?m.firstBaseUpdate=c:o.next=c,m.lastBaseUpdate=u))}if(i!==null){var h=s.baseState;l=0,m=c=u=null,o=i;do{var d=o.lane,x=o.eventTime;if((r&d)===d){m!==null&&(m=m.next={eventTime:x,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var S=e,y=o;switch(d=t,x=n,y.tag){case 1:if(S=y.payload,typeof S=="function"){h=S.call(x,h,d);break e}h=S;break e;case 3:S.flags=S.flags&-65537|128;case 0:if(S=y.payload,d=typeof S=="function"?S.call(x,h,d):S,d==null)break e;h=re({},h,d);break e;case 2:qt=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,d=s.effects,d===null?s.effects=[o]:d.push(o))}else x={eventTime:x,lane:d,tag:o.tag,payload:o.payload,callback:o.callback,next:null},m===null?(c=m=x,u=h):m=m.next=x,l|=d;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;d=o,o=d.next,d.next=null,s.lastBaseUpdate=d,s.shared.pending=null}}while(!0);if(m===null&&(u=h),s.baseState=u,s.firstBaseUpdate=c,s.lastBaseUpdate=m,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=h}}function gc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Zl.transition;Zl.transition={};try{e(!1),t()}finally{K=n,Zl.transition=r}}function uh(){return nt().memoizedState}function wv(e,t,n){var r=gn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ch(e))dh(t,n);else if(n=Hf(e,t,n,r),n!==null){var s=Te();dt(n,e,r,s),fh(n,t,r)}}function Sv(e,t,n){var r=gn(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ch(e))dh(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var l=t.lastRenderedState,o=i(l,n);if(s.hasEagerState=!0,s.eagerState=o,ht(o,l)){var u=t.interleaved;u===null?(s.next=s,Yo(t)):(s.next=u.next,u.next=s),t.interleaved=s;return}}catch{}finally{}n=Hf(e,t,s,r),n!==null&&(s=Te(),dt(n,e,r,s),fh(n,t,r))}}function ch(e){var t=e.alternate;return e===ne||t!==null&&t===ne}function dh(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 fh(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fo(e,n)}}var Zi={readContext:tt,useCallback:je,useContext:je,useEffect:je,useImperativeHandle:je,useInsertionEffect:je,useLayoutEffect:je,useMemo:je,useReducer:je,useRef:je,useState:je,useDebugValue:je,useDeferredValue:je,useTransition:je,useMutableSource:je,useSyncExternalStore:je,useId:je,unstable_isNewReconciler:!1},jv={readContext:tt,useCallback:function(e,t){return vt().memoizedState=[e,t===void 0?null:t],e},useContext:tt,useEffect:xc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Pi(4194308,4,sh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Pi(4194308,4,e,t)},useInsertionEffect:function(e,t){return Pi(4,2,e,t)},useMemo:function(e,t){var n=vt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=vt();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=wv.bind(null,ne,e),[r.memoizedState,e]},useRef:function(e){var t=vt();return e={current:e},t.memoizedState=e},useState:yc,useDebugValue:lu,useDeferredValue:function(e){return vt().memoizedState=e},useTransition:function(){var e=yc(!1),t=e[0];return e=xv.bind(null,e[1]),vt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ne,s=vt();if(Z){if(n===void 0)throw Error(E(407));n=n()}else{if(n=t(),ve===null)throw Error(E(349));Kn&30||Jf(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,xc(Xf.bind(null,r,i,e),[e]),r.flags|=2048,Fs(9,Yf.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=vt(),t=ve.identifierPrefix;if(Z){var n=Rt,r=Ot;n=(r&~(1<<32-ct(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[wt]=t,e[Rs]=r,jh(e,t,!1,!1),t.stateNode=e;e:{switch(l=Sa(n,r),n){case"dialog":Y("cancel",e),Y("close",e),s=r;break;case"iframe":case"object":case"embed":Y("load",e),s=r;break;case"video":case"audio":for(s=0;sUr&&(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&&!Z)return ke(t),null}else 2*ae()-i.renderingStartTime>Ur&&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=ae(),t.sibling=null,n=ee.current,G(ee,r?n&1|2:n&1),t):(ke(t),null);case 22:case 23:return fu(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ue&1073741824&&(ke(t),t.subtreeFlags&6&&(t.flags|=8192)):ke(t),null;case 24:return null;case 25:return null}throw Error(E(156,t.tag))}function Tv(e,t){switch(Wo(t),t.tag){case 1:return De(t.type)&&Vi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return $r(),X(Fe),X(_e),tu(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return eu(t),null;case 13:if(X(ee),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(E(340));Fr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return X(ee),null;case 4:return $r(),null;case 10:return Jo(t.type._context),null;case 22:case 23:return fu(),null;case 24:return null;default:return null}}var vi=!1,Ce=!1,Ov=typeof WeakSet=="function"?WeakSet:Set,M=null;function hr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ie(e,t,r)}else n.current=null}function qa(e,t,n){try{n()}catch(r){ie(e,t,r)}}var Tc=!1;function Rv(e,t){if(Oa=Ai,e=bf(),Vo(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,m=0,h=e,d=null;t:for(;;){for(var x;h!==n||s!==0&&h.nodeType!==3||(o=l+s),h!==i||r!==0&&h.nodeType!==3||(u=l+r),h.nodeType===3&&(l+=h.nodeValue.length),(x=h.firstChild)!==null;)d=h,h=x;for(;;){if(h===e)break t;if(d===n&&++c===s&&(o=l),d===i&&++m===r&&(u=l),(x=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=x}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ra={focusedElem:e,selectionRange:n},Ai=!1,M=t;M!==null;)if(t=M,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,M=e;else for(;M!==null;){t=M;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,p=t.stateNode,f=p.getSnapshotBeforeUpdate(t.elementType===t.type?y:it(t.type,y),j);p.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(E(163))}}catch(w){ie(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,M=e;break}M=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&&qa(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 Ga(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Ch(e){var t=e.alternate;t!==null&&(e.alternate=null,Ch(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[wt],delete t[Rs],delete t[za],delete t[pv],delete t[mv])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function _h(e){return e.tag===5||e.tag===3||e.tag===4}function Oc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||_h(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ja(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Bi));else if(r!==4&&(e=e.child,e!==null))for(Ja(e,t,n),e=e.sibling;e!==null;)Ja(e,t,n),e=e.sibling}function Ya(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(Ya(e,t,n),e=e.sibling;e!==null;)Ya(e,t,n),e=e.sibling}var ye=null,ot=!1;function Vt(e,t,n){for(n=n.child;n!==null;)Eh(e,t,n),n=n.sibling}function Eh(e,t,n){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(dl,n)}catch{}switch(n.tag){case 5:Ce||hr(n,t);case 6:var r=ye,s=ot;ye=null,Vt(e,t,n),ye=r,ot=s,ye!==null&&(ot?(e=ye,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ye.removeChild(n.stateNode));break;case 18:ye!==null&&(ot?(e=ye,n=n.stateNode,e.nodeType===8?Jl(e.parentNode,n):e.nodeType===1&&Jl(e,n),Es(e)):Jl(ye,n.stateNode));break;case 4:r=ye,s=ot,ye=n.stateNode.containerInfo,ot=!0,Vt(e,t,n),ye=r,ot=s;break;case 0:case 11:case 14:case 15:if(!Ce&&(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)&&qa(n,t,l),s=s.next}while(s!==r)}Vt(e,t,n);break;case 1:if(!Ce&&(hr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){ie(n,t,o)}Vt(e,t,n);break;case 21:Vt(e,t,n);break;case 22:n.mode&1?(Ce=(r=Ce)||n.memoizedState!==null,Vt(e,t,n),Ce=r):Vt(e,t,n);break;default:Vt(e,t,n)}}function Rc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ov),t.forEach(function(r){var s=Uv.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function st(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=l),r&=~i}if(r=s,r=ae()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Mv(r/1960))-r,10e?16:e,on===null)var r=!1;else{if(e=on,on=null,nl=0,B&6)throw Error(E(331));var s=B;for(B|=4,M=e.current;M!==null;){var i=M,l=i.child;if(M.flags&16){var o=i.deletions;if(o!==null){for(var u=0;uae()-cu?Bn(e,0):uu|=n),$e(e,t)}function zh(e,t){t===0&&(e.mode&1?(t=ai,ai<<=1,!(ai&130023424)&&(ai=4194304)):t=1);var n=Te();e=Dt(e,t),e!==null&&(Js(e,t,n),$e(e,n))}function Av(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),zh(e,n)}function Uv(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(E(314))}r!==null&&r.delete(t),zh(e,n)}var Ih;Ih=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Fe.current)Ie=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ie=!1,Pv(e,t,n);Ie=!!(e.flags&131072)}else Ie=!1,Z&&t.flags&1048576&&Af(t,Ki,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;bi(e,t),e=t.pendingProps;var s=Ir(t,_e.current);wr(t,n),s=ru(null,t,r,e,s,n);var i=su();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,De(r)?(i=!0,Hi(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Xo(t),s.updater=yl,t.stateNode=s,s._reactInternals=t,Ua(t,r,e,n),t=Va(null,t,r,!0,i,n)):(t.tag=0,Z&&i&&Ho(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=Bv(r),e=it(r,e),s){case 0:t=Ba(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,it(r.type,e),n);break e}throw Error(E(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:it(r,s),Ba(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:it(r,s),Ec(e,t,r,s,n);case 3:e:{if(xh(t),e===null)throw Error(E(387));r=t.pendingProps,i=t.memoizedState,s=i.element,Wf(e,t),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=Ar(Error(E(423)),t),t=Pc(e,t,r,n,s);break e}else if(r!==s){s=Ar(Error(E(424)),t),t=Pc(e,t,r,n,s);break e}else for(Qe=pn(t.stateNode.containerInfo.firstChild),Be=t,Z=!0,ut=null,n=Vf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Fr(),r===s){t=$t(e,t,n);break e}Pe(e,t,r,n)}t=t.child}return t;case 5:return Kf(t),e===null&&Da(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,l=s.children,La(r,s)?l=null:i!==null&&La(r,i)&&(t.flags|=32),yh(e,t),Pe(e,t,l,n),t.child;case 6:return e===null&&Da(t),null;case 13:return wh(e,t,n);case 4:return Zo(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Dr(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:it(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,G(qi,r._currentValue),r._currentValue=l,i!==null)if(ht(i.value,l)){if(i.children===s.children&&!Fe.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=Lt(-1,n&-n),u.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var m=c.pending;m===null?u.next=u:(u.next=m.next,m.next=u),c.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),$a(i.return,n,t),o.lanes|=n;break}u=u.next}}else if(i.tag===10)l=i.type===t.type?null:i.child;else if(i.tag===18){if(l=i.return,l===null)throw Error(E(341));l.lanes|=n,o=l.alternate,o!==null&&(o.lanes|=n),$a(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,wr(t,n),s=tt(s),r=r(s),t.flags|=1,Pe(e,t,r,n),t.child;case 14:return r=t.type,s=it(r,t.pendingProps),s=it(r.type,s),_c(e,t,r,s,n);case 15:return vh(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:it(r,s),bi(e,t),t.tag=1,De(r)?(e=!0,Hi(t)):e=!1,wr(t,n),hh(t,r,s),Ua(t,r,s,n),Va(null,t,r,!0,e,n);case 19:return Sh(e,t,n);case 22:return gh(e,t,n)}throw Error(E(156,t.tag))};function Fh(e,t){return cf(e,t)}function Qv(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 Ze(e,t,n,r){return new Qv(e,t,n,r)}function pu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Bv(e){if(typeof e=="function")return pu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Lo)return 11;if(e===Mo)return 14}return 2}function yn(e,t){var n=e.alternate;return n===null?(n=Ze(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ri(e,t,n,r,s,i){var l=2;if(r=e,typeof e=="function")pu(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case sr:return Vn(n.children,s,i,t);case Ro:l=8,s|=8;break;case da:return e=Ze(12,n,t,s|2),e.elementType=da,e.lanes=i,e;case fa:return e=Ze(13,n,t,s),e.elementType=fa,e.lanes=i,e;case ha:return e=Ze(19,n,t,s),e.elementType=ha,e.lanes=i,e;case Wd:return Sl(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Vd:l=10;break e;case Hd:l=9;break e;case Lo:l=11;break e;case Mo:l=14;break e;case Kt:l=16,r=null;break e}throw Error(E(130,e==null?e:typeof e,""))}return t=Ze(l,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Vn(e,t,n,r){return e=Ze(7,e,r,t),e.lanes=n,e}function Sl(e,t,n,r){return e=Ze(22,e,r,t),e.elementType=Wd,e.lanes=n,e.stateNode={isHidden:!1},e}function sa(e,t,n){return e=Ze(6,e,null,t),e.lanes=n,e}function ia(e,t,n){return t=Ze(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Vv(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=$l(0),this.expirationTimes=$l(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$l(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function mu(e,t,n,r,s,i,l,o,u){return e=new Vv(e,t,n,o,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ze(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xo(i),e}function Hv(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Uh)}catch(e){console.error(e)}}Uh(),Ad.exports=He;var Jv=Ad.exports,Ac=Jv;ua.createRoot=Ac.createRoot,ua.hydrateRoot=Ac.hydrateRoot;var Kr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Yv={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Yt,ko,gd,Xv=(gd=class{constructor(){I(this,Yt,Yv);I(this,ko,!1)}setTimeoutProvider(e){R(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,ko=new WeakMap,gd),Ln=new Xv;function Zv(e){setTimeout(e,0)}var Jn=typeof window>"u"||"Deno"in globalThis;function be(){}function eg(e,t){return typeof e=="function"?e(t):e}function no(e){return typeof e=="number"&&e>=0&&e!==1/0}function Qh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function xn(e,t){return typeof e=="function"?e(t):e}function Ge(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!==xu(l,t.options))return!1}else if(!$s(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(!$s(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function xu(e,t){return((t==null?void 0:t.queryKeyHashFn)||Yn)(e)}function Yn(e){return JSON.stringify(e,(t,n)=>ro(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function $s(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>$s(e[n],t[n])):!1}var tg=Object.prototype.hasOwnProperty;function Bh(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Bc(e)&&Bc(t);if(!r&&!(ro(e)&&ro(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 m=0;m{Ln.setTimeout(t,e)})}function so(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Bh(e,t):t}function rg(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function sg(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var wu=Symbol();function Vh(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===wu?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Su(e,t){return typeof e=="function"?e(...t):!!e}function ig(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,kr,yd,lg=(yd=class extends Kr{constructor(){super();I(this,Mn);I(this,Xt);I(this,kr);R(this,kr,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,kr))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,Xt))==null||t.call(this),R(this,Xt,void 0))}setEventListener(t){var n;R(this,kr,t),(n=g(this,Xt))==null||n.call(this),R(this,Xt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){g(this,Mn)!==t&&(R(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,kr=new WeakMap,yd),ju=new lg;function io(){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 ag=Zv;function og(){let e=[],t=0,n=o=>{o()},r=o=>{o()},s=ag;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 de=og(),Nr,Zt,Cr,xd,ug=(xd=class extends Kr{constructor(){super();I(this,Nr,!0);I(this,Zt);I(this,Cr);R(this,Cr,t=>{if(!Jn&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){g(this,Zt)||this.setEventListener(g(this,Cr))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,Zt))==null||t.call(this),R(this,Zt,void 0))}setEventListener(t){var n;R(this,Cr,t),(n=g(this,Zt))==null||n.call(this),R(this,Zt,t(this.setOnline.bind(this)))}setOnline(t){g(this,Nr)!==t&&(R(this,Nr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return g(this,Nr)}},Nr=new WeakMap,Zt=new WeakMap,Cr=new WeakMap,xd),ll=new ug;function cg(e){return Math.min(1e3*2**e,3e4)}function Hh(e){return(e??"online")==="online"?ll.isOnline():!0}var lo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Wh(e){let t=!1,n=0,r;const s=io(),i=()=>s.status!=="pending",l=y=>{var j;if(!i()){const p=new lo(y);d(p),(j=e.onCancel)==null||j.call(e,p)}},o=()=>{t=!0},u=()=>{t=!1},c=()=>ju.isFocused()&&(e.networkMode==="always"||ll.isOnline())&&e.canRun(),m=()=>Hh(e.networkMode)&&e.canRun(),h=y=>{i()||(r==null||r(),s.resolve(y))},d=y=>{i()||(r==null||r(),s.reject(y))},x=()=>new Promise(y=>{var j;r=p=>{(i()||c())&&y(p)},(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(p){y=Promise.reject(p)}Promise.resolve(y).then(h).catch(p=>{var _;if(i())return;const f=e.retry??(Jn?0:3),v=e.retryDelay??cg,w=typeof v=="function"?v(n,p):v,N=f===!0||typeof f=="number"&&nc()?void 0:x()).then(()=>{t?d(p):S()})})};return{promise:s,status:()=>s.status,cancel:l,continue:()=>(r==null||r(),s),cancelRetry:o,continueRetry:u,canStart:m,start:()=>(m()?S():x().then(S),s)}}var zn,wd,Kh=(wd=class{constructor(){I(this,zn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),no(this.gcTime)&&R(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)),R(this,zn,void 0))}},zn=new WeakMap,wd),In,_r,qe,Fn,he,Vs,Dn,lt,kt,Sd,dg=(Sd=class extends Kh{constructor(t){super();I(this,lt);I(this,In);I(this,_r);I(this,qe);I(this,Fn);I(this,he);I(this,Vs);I(this,Dn);R(this,Dn,!1),R(this,Vs,t.defaultOptions),this.setOptions(t.options),this.observers=[],R(this,Fn,t.client),R(this,qe,g(this,Fn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,R(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,he))==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)),R(this,In,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&g(this,qe).remove(this)}setData(t,n){const r=so(this.state.data,t,this.options);return $(this,lt,kt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){$(this,lt,kt).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=g(this,he))==null?void 0:r.promise;return(s=g(this,he))==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=>Ge(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===wu||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:!Qh(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,he))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,he))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),g(this,qe).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,he)&&(g(this,Dn)?g(this,he).cancel({revert:!0}):g(this,he).cancelRetry()),this.scheduleGc()),g(this,qe).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||$(this,lt,kt).call(this,{type:"invalidate"})}async fetch(t,n){var u,c,m,h,d,x,S,y,j,p,f,v;if(this.state.fetchStatus!=="idle"&&((u=g(this,he))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(g(this,he))return g(this,he).continueRetry(),g(this,he).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(N=>N.options.queryFn);w&&this.setOptions(w.options)}const r=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(R(this,Dn,!0),r.signal)})},i=()=>{const w=Vh(this.options,n),_=(()=>{const b={client:g(this,Fn),queryKey:this.queryKey,meta:this.meta};return s(b),b})();return R(this,Dn,!1),this.options.persister?this.options.persister(w,_,this):w(_)},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),R(this,_r,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((m=o.fetchOptions)==null?void 0:m.meta))&&$(this,lt,kt).call(this,{type:"fetch",meta:(h=o.fetchOptions)==null?void 0:h.meta}),R(this,he,Wh({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:w=>{w instanceof lo&&w.revert&&this.setState({...g(this,_r),fetchStatus:"idle"}),r.abort()},onFail:(w,N)=>{$(this,lt,kt).call(this,{type:"failed",failureCount:w,error:N})},onPause:()=>{$(this,lt,kt).call(this,{type:"pause"})},onContinue:()=>{$(this,lt,kt).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const w=await g(this,he).start();if(w===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(w),(x=(d=g(this,qe).config).onSuccess)==null||x.call(d,w,this),(y=(S=g(this,qe).config).onSettled)==null||y.call(S,w,this.state.error,this),w}catch(w){if(w instanceof lo){if(w.silent)return g(this,he).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw $(this,lt,kt).call(this,{type:"error",error:w}),(p=(j=g(this,qe).config).onError)==null||p.call(j,w,this),(v=(f=g(this,qe).config).onSettled)==null||v.call(f,this.state.data,w,this),w}finally{this.scheduleGc()}}},In=new WeakMap,_r=new WeakMap,qe=new WeakMap,Fn=new WeakMap,he=new WeakMap,Vs=new WeakMap,Dn=new WeakMap,lt=new WeakSet,kt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...qh(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...Hc(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return R(this,_r,t.manual?s:void 0),s;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),de.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),g(this,qe).notify({query:this,type:"updated",action:t})})},Sd);function qh(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Hh(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Hc(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Wc(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Le,Q,Hs,Ee,$n,Er,Et,en,Ws,Pr,br,An,Un,tn,Tr,H,ds,ao,oo,uo,co,fo,ho,po,Gh,jd,fg=(jd=class extends Kr{constructor(t,n){super();I(this,H);I(this,Le);I(this,Q);I(this,Hs);I(this,Ee);I(this,$n);I(this,Er);I(this,Et);I(this,en);I(this,Ws);I(this,Pr);I(this,br);I(this,An);I(this,Un);I(this,tn);I(this,Tr,new Set);this.options=n,R(this,Le,t),R(this,en,null),R(this,Et,io()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(g(this,Q).addObserver(this),Kc(g(this,Q),this.options)?$(this,H,ds).call(this):this.updateResult(),$(this,H,co).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return mo(g(this,Q),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return mo(g(this,Q),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,$(this,H,fo).call(this),$(this,H,ho).call(this),g(this,Q).removeObserver(this)}setOptions(t){const n=this.options,r=g(this,Q);if(this.options=g(this,Le).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ge(this.options.enabled,g(this,Q))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");$(this,H,po).call(this),g(this,Q).setOptions(this.options),n._defaulted&&!il(this.options,n)&&g(this,Le).getQueryCache().notify({type:"observerOptionsUpdated",query:g(this,Q),observer:this});const s=this.hasListeners();s&&qc(g(this,Q),r,this.options,n)&&$(this,H,ds).call(this),this.updateResult(),s&&(g(this,Q)!==r||Ge(this.options.enabled,g(this,Q))!==Ge(n.enabled,g(this,Q))||xn(this.options.staleTime,g(this,Q))!==xn(n.staleTime,g(this,Q)))&&$(this,H,ao).call(this);const i=$(this,H,oo).call(this);s&&(g(this,Q)!==r||Ge(this.options.enabled,g(this,Q))!==Ge(n.enabled,g(this,Q))||i!==g(this,tn))&&$(this,H,uo).call(this,i)}getOptimisticResult(t){const n=g(this,Le).getQueryCache().build(g(this,Le),t),r=this.createResult(n,t);return pg(this,r)&&(R(this,Ee,r),R(this,Er,this.options),R(this,$n,g(this,Q).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,Et).status==="pending"&&g(this,Et).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){g(this,Tr).add(t)}getCurrentQuery(){return g(this,Q)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=g(this,Le).defaultQueryOptions(t),r=g(this,Le).getQueryCache().build(g(this,Le),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return $(this,H,ds).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),g(this,Ee)))}createResult(t,n){var L;const r=g(this,Q),s=this.options,i=g(this,Ee),l=g(this,$n),o=g(this,Er),c=t!==r?t.state:g(this,Hs),{state:m}=t;let h={...m},d=!1,x;if(n._optimisticResults){const z=this.hasListeners(),P=!z&&Kc(t,n),U=z&&qc(t,r,n,s);(P||U)&&(h={...h,...qh(m.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:S,errorUpdatedAt:y,status:j}=h;x=h.data;let p=!1;if(n.placeholderData!==void 0&&x===void 0&&j==="pending"){let z;i!=null&&i.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(z=i.data,p=!0):z=typeof n.placeholderData=="function"?n.placeholderData((L=g(this,br))==null?void 0:L.state.data,g(this,br)):n.placeholderData,z!==void 0&&(j="success",x=so(i==null?void 0:i.data,z,n),d=!0)}if(n.select&&x!==void 0&&!p)if(i&&x===(l==null?void 0:l.data)&&n.select===g(this,Ws))x=g(this,Pr);else try{R(this,Ws,n.select),x=n.select(x),x=so(i==null?void 0:i.data,x,n),R(this,Pr,x),R(this,en,null)}catch(z){R(this,en,z)}g(this,en)&&(S=g(this,en),x=g(this,Pr),y=Date.now(),j="error");const f=h.fetchStatus==="fetching",v=j==="pending",w=j==="error",N=v&&f,_=x!==void 0,C={status:j,fetchStatus:h.fetchStatus,isPending:v,isSuccess:j==="success",isError:w,isInitialLoading:N,isLoading:N,data:x,dataUpdatedAt:h.dataUpdatedAt,error:S,errorUpdatedAt:y,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:f,isRefetching:f&&!v,isLoadingError:w&&!_,isPaused:h.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:w&&_,isStale:ku(t,n),refetch:this.refetch,promise:g(this,Et),isEnabled:Ge(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const z=C.data!==void 0,P=C.status==="error"&&!z,U=Ke=>{P?Ke.reject(C.error):z&&Ke.resolve(C.data)},ge=()=>{const Ke=R(this,Et,C.promise=io());U(Ke)},rt=g(this,Et);switch(rt.status){case"pending":t.queryHash===r.queryHash&&U(rt);break;case"fulfilled":(P||C.data!==rt.value)&&ge();break;case"rejected":(!P||C.error!==rt.reason)&&ge();break}}return C}updateResult(){const t=g(this,Ee),n=this.createResult(g(this,Q),this.options);if(R(this,$n,g(this,Q).state),R(this,Er,this.options),g(this,$n).data!==void 0&&R(this,br,g(this,Q)),il(n,t))return;R(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,Tr).size)return!0;const l=new Set(i??g(this,Tr));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)})};$(this,H,Gh).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&$(this,H,co).call(this)}},Le=new WeakMap,Q=new WeakMap,Hs=new WeakMap,Ee=new WeakMap,$n=new WeakMap,Er=new WeakMap,Et=new WeakMap,en=new WeakMap,Ws=new WeakMap,Pr=new WeakMap,br=new WeakMap,An=new WeakMap,Un=new WeakMap,tn=new WeakMap,Tr=new WeakMap,H=new WeakSet,ds=function(t){$(this,H,po).call(this);let n=g(this,Q).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(be)),n},ao=function(){$(this,H,fo).call(this);const t=xn(this.options.staleTime,g(this,Q));if(Jn||g(this,Ee).isStale||!no(t))return;const r=Qh(g(this,Ee).dataUpdatedAt,t)+1;R(this,An,Ln.setTimeout(()=>{g(this,Ee).isStale||this.updateResult()},r))},oo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(g(this,Q)):this.options.refetchInterval)??!1},uo=function(t){$(this,H,ho).call(this),R(this,tn,t),!(Jn||Ge(this.options.enabled,g(this,Q))===!1||!no(g(this,tn))||g(this,tn)===0)&&R(this,Un,Ln.setInterval(()=>{(this.options.refetchIntervalInBackground||ju.isFocused())&&$(this,H,ds).call(this)},g(this,tn)))},co=function(){$(this,H,ao).call(this),$(this,H,uo).call(this,$(this,H,oo).call(this))},fo=function(){g(this,An)&&(Ln.clearTimeout(g(this,An)),R(this,An,void 0))},ho=function(){g(this,Un)&&(Ln.clearInterval(g(this,Un)),R(this,Un,void 0))},po=function(){const t=g(this,Le).getQueryCache().build(g(this,Le),this.options);if(t===g(this,Q))return;const n=g(this,Q);R(this,Q,t),R(this,Hs,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Gh=function(t){de.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(g(this,Ee))}),g(this,Le).getQueryCache().notify({query:g(this,Q),type:"observerResultsUpdated"})})},jd);function hg(e,t){return Ge(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Kc(e,t){return hg(e,t)||e.state.data!==void 0&&mo(e,t,t.refetchOnMount)}function mo(e,t,n){if(Ge(t.enabled,e)!==!1&&xn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ku(e,t)}return!1}function qc(e,t,n,r){return(e!==t||Ge(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ku(e,n)}function ku(e,t){return Ge(t.enabled,e)!==!1&&e.isStaleByTime(xn(t.staleTime,e))}function pg(e,t){return!il(e.getCurrentResult(),t)}function Gc(e){return{onFetch:(t,n)=>{var m,h,d,x,S;const r=t.options,s=(d=(h=(m=t.fetchOptions)==null?void 0:m.meta)==null?void 0:h.fetchMore)==null?void 0:d.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=v=>{ig(v,()=>t.signal,()=>y=!0)},p=Vh(t.options,t.fetchOptions),f=async(v,w,N)=>{if(y)return Promise.reject();if(w==null&&v.pages.length)return Promise.resolve(v);const b=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:w,direction:N?"backward":"forward",meta:t.options.meta};return j(P),P})(),C=await p(b),{maxPages:L}=t.options,z=N?sg:rg;return{pages:z(v.pages,C,L),pageParams:z(v.pageParams,w,L)}};if(s&&i.length){const v=s==="backward",w=v?mg:Jc,N={pages:i,pageParams:l},_=w(r,N);o=await f(N,_,v)}else{const v=e??i.length;do{const w=u===0?l[0]??r.initialPageParam:Jc(r,o);if(u>0&&w==null)break;o=await f(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 mg(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,gt,Ne,Qn,yt,Ht,kd,vg=(kd=class extends Kh{constructor(t){super();I(this,yt);I(this,Ks);I(this,gt);I(this,Ne);I(this,Qn);R(this,Ks,t.client),this.mutationId=t.mutationId,R(this,Ne,t.mutationCache),R(this,gt,[]),this.state=t.state||Jh(),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,gt).includes(t)||(g(this,gt).push(t),this.clearGcTimeout(),g(this,Ne).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){R(this,gt,g(this,gt).filter(n=>n!==t)),this.scheduleGc(),g(this,Ne).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){g(this,gt).length||(this.state.status==="pending"?this.scheduleGc():g(this,Ne).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,m,h,d,x,S,y,j,p,f,v,w,N,_,b;const n=()=>{$(this,yt,Ht).call(this,{type:"continue"})},r={client:g(this,Ks),meta:this.options.meta,mutationKey:this.options.mutationKey};R(this,Qn,Wh({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(C,L)=>{$(this,yt,Ht).call(this,{type:"failed",failureCount:C,error:L})},onPause:()=>{$(this,yt,Ht).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>g(this,Ne).canRun(this)}));const s=this.state.status==="pending",i=!g(this,Qn).canStart();try{if(s)n();else{$(this,yt,Ht).call(this,{type:"pending",variables:t,isPaused:i}),g(this,Ne).config.onMutate&&await g(this,Ne).config.onMutate(t,this,r);const L=await((o=(l=this.options).onMutate)==null?void 0:o.call(l,t,r));L!==this.state.context&&$(this,yt,Ht).call(this,{type:"pending",context:L,variables:t,isPaused:i})}const C=await g(this,Qn).start();return await((c=(u=g(this,Ne).config).onSuccess)==null?void 0:c.call(u,C,t,this.state.context,this,r)),await((h=(m=this.options).onSuccess)==null?void 0:h.call(m,C,t,this.state.context,r)),await((x=(d=g(this,Ne).config).onSettled)==null?void 0:x.call(d,C,null,this.state.variables,this.state.context,this,r)),await((y=(S=this.options).onSettled)==null?void 0:y.call(S,C,null,t,this.state.context,r)),$(this,yt,Ht).call(this,{type:"success",data:C}),C}catch(C){try{await((p=(j=g(this,Ne).config).onError)==null?void 0:p.call(j,C,t,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((v=(f=this.options).onError)==null?void 0:v.call(f,C,t,this.state.context,r))}catch(L){Promise.reject(L)}try{await((N=(w=g(this,Ne).config).onSettled)==null?void 0:N.call(w,void 0,C,this.state.variables,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((b=(_=this.options).onSettled)==null?void 0:b.call(_,void 0,C,t,this.state.context,r))}catch(L){Promise.reject(L)}throw $(this,yt,Ht).call(this,{type:"error",error:C}),C}finally{g(this,Ne).runNext(this)}}},Ks=new WeakMap,gt=new WeakMap,Ne=new WeakMap,Qn=new WeakMap,yt=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),de.batch(()=>{g(this,gt).forEach(r=>{r.onMutationUpdate(t)}),g(this,Ne).notify({mutation:this,type:"updated",action:t})})},kd);function Jh(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Pt,at,qs,Nd,gg=(Nd=class extends Kr{constructor(t={}){super();I(this,Pt);I(this,at);I(this,qs);this.config=t,R(this,Pt,new Set),R(this,at,new Map),R(this,qs,0)}build(t,n,r){const s=new vg({client:t,mutationCache:this,mutationId:++ti(this,qs)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){g(this,Pt).add(t);const n=xi(t);if(typeof n=="string"){const r=g(this,at).get(n);r?r.push(t):g(this,at).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(g(this,Pt).delete(t)){const n=xi(t);if(typeof n=="string"){const r=g(this,at).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,at).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=xi(t);if(typeof n=="string"){const r=g(this,at).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,at).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(){de.batch(()=>{g(this,Pt).forEach(t=>{this.notify({type:"removed",mutation:t})}),g(this,Pt).clear(),g(this,at).clear()})}getAll(){return Array.from(g(this,Pt))}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){de.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return de.batch(()=>Promise.all(t.map(n=>n.continue().catch(be))))}},Pt=new WeakMap,at=new WeakMap,qs=new WeakMap,Nd);function xi(e){var t;return(t=e.options.scope)==null?void 0:t.id}var bt,nn,Me,Tt,zt,Li,vo,Cd,yg=(Cd=class extends Kr{constructor(n,r){super();I(this,zt);I(this,bt);I(this,nn);I(this,Me);I(this,Tt);R(this,bt,n),this.setOptions(r),this.bindMethods(),$(this,zt,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,bt).defaultMutationOptions(n),il(this.options,r)||g(this,bt).getMutationCache().notify({type:"observerOptionsUpdated",mutation:g(this,Me),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Yn(r.mutationKey)!==Yn(this.options.mutationKey)?this.reset():((s=g(this,Me))==null?void 0:s.state.status)==="pending"&&g(this,Me).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=g(this,Me))==null||n.removeObserver(this)}onMutationUpdate(n){$(this,zt,Li).call(this),$(this,zt,vo).call(this,n)}getCurrentResult(){return g(this,nn)}reset(){var n;(n=g(this,Me))==null||n.removeObserver(this),R(this,Me,void 0),$(this,zt,Li).call(this),$(this,zt,vo).call(this)}mutate(n,r){var s;return R(this,Tt,r),(s=g(this,Me))==null||s.removeObserver(this),R(this,Me,g(this,bt).getMutationCache().build(g(this,bt),this.options)),g(this,Me).addObserver(this),g(this,Me).execute(n)}},bt=new WeakMap,nn=new WeakMap,Me=new WeakMap,Tt=new WeakMap,zt=new WeakSet,Li=function(){var r;const n=((r=g(this,Me))==null?void 0:r.state)??Jh();R(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})},vo=function(n){de.batch(()=>{var r,s,i,l,o,u,c,m;if(g(this,Tt)&&this.hasListeners()){const h=g(this,nn).variables,d=g(this,nn).context,x={client:g(this,bt),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(r=g(this,Tt)).onSuccess)==null||s.call(r,n.data,h,d,x)}catch(S){Promise.reject(S)}try{(l=(i=g(this,Tt)).onSettled)==null||l.call(i,n.data,null,h,d,x)}catch(S){Promise.reject(S)}}else if((n==null?void 0:n.type)==="error"){try{(u=(o=g(this,Tt)).onError)==null||u.call(o,n.error,h,d,x)}catch(S){Promise.reject(S)}try{(m=(c=g(this,Tt)).onSettled)==null||m.call(c,void 0,n.error,h,d,x)}catch(S){Promise.reject(S)}}}this.listeners.forEach(h=>{h(g(this,nn))})})},Cd),xt,_d,xg=(_d=class extends Kr{constructor(t={}){super();I(this,xt);this.config=t,R(this,xt,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??xu(s,n);let l=this.get(i);return l||(l=new dg({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(l)),l}add(t){g(this,xt).has(t.queryHash)||(g(this,xt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=g(this,xt).get(t.queryHash);n&&(t.destroy(),n===t&&g(this,xt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){de.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return g(this,xt).get(t)}getAll(){return[...g(this,xt).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){de.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){de.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){de.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},xt=new WeakMap,_d),se,rn,sn,Or,Rr,ln,Lr,Mr,Ed,wg=(Ed=class{constructor(e={}){I(this,se);I(this,rn);I(this,sn);I(this,Or);I(this,Rr);I(this,ln);I(this,Lr);I(this,Mr);R(this,se,e.queryCache||new xg),R(this,rn,e.mutationCache||new gg),R(this,sn,e.defaultOptions||{}),R(this,Or,new Map),R(this,Rr,new Map),R(this,ln,0)}mount(){ti(this,ln)._++,g(this,ln)===1&&(R(this,Lr,ju.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,se).onFocus())})),R(this,Mr,ll.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,se).onOnline())})))}unmount(){var e,t;ti(this,ln)._--,g(this,ln)===0&&((e=g(this,Lr))==null||e.call(this),R(this,Lr,void 0),(t=g(this,Mr))==null||t.call(this),R(this,Mr,void 0))}isFetching(e){return g(this,se).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,se).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=g(this,se).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,se).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,se).get(r.queryHash),i=s==null?void 0:s.state.data,l=eg(t,i);if(l!==void 0)return g(this,se).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return de.batch(()=>g(this,se).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,se).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=g(this,se);de.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=g(this,se);return de.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=de.batch(()=>g(this,se).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(be).catch(be)}invalidateQueries(e,t={}){return de.batch(()=>(g(this,se).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=de.batch(()=>g(this,se).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,se).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,se)}getMutationCache(){return g(this,rn)}getDefaultOptions(){return g(this,sn)}setDefaultOptions(e){R(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=>{$s(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){g(this,Rr).set(Yn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...g(this,Rr).values()],n={};return t.forEach(r=>{$s(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=xu(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===wu&&(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,se).clear(),g(this,rn).clear()}},se=new WeakMap,rn=new WeakMap,sn=new WeakMap,Or=new WeakMap,Rr=new WeakMap,ln=new WeakMap,Lr=new WeakMap,Mr=new WeakMap,Ed),Yh=k.createContext(void 0),er=e=>{const t=k.useContext(Yh);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Sg=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(Yh.Provider,{value:e,children:t})),Xh=k.createContext(!1),jg=()=>k.useContext(Xh);Xh.Provider;function kg(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ng=k.createContext(kg()),Cg=()=>k.useContext(Ng),_g=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Su(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Eg=e=>{k.useEffect(()=>{e.clearReset()},[e])},Pg=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Su(n,[e.error,r])),bg=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))}},Tg=(e,t)=>e.isLoading&&e.isFetching&&!t,Og=(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 d,x,S,y;const r=jg(),s=Cg(),i=er(),l=i.defaultQueryOptions(e);(x=(d=i.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||x.call(d,l);const o=i.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",bg(l),_g(l,s,o),Eg(s);const u=!i.getQueryCache().get(l.queryHash),[c]=k.useState(()=>new t(i,l)),m=c.getOptimisticResult(l),h=!r&&e.subscribed!==!1;if(k.useSyncExternalStore(k.useCallback(j=>{const p=h?c.subscribe(de.batchCalls(j)):be;return c.updateResult(),p},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),k.useEffect(()=>{c.setOptions(l)},[l,c]),Og(l,m))throw Yc(l,c,s);if(Pg({result:m,errorResetBoundary:s,throwOnError:l.throwOnError,query:o,suspense:l.suspense}))throw m.error;if((y=(S=i.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||y.call(S,l,m),l.experimental_prefetchInRender&&!Jn&&Tg(m,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?m:c.trackResult(m)}function Mt(e,t){return Rg(e,fg)}function ft(e,t){const n=er(),[r]=k.useState(()=>new yg(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);const s=k.useSyncExternalStore(k.useCallback(l=>r.subscribe(de.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=k.useCallback((l,o)=>{r.mutate(l,o).catch(be)},[r]);if(s.error&&Su(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}/** + * @remix-run/router v1.23.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function As(){return As=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Nu(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Mg(){return Math.random().toString(36).substr(2,8)}function Zc(e,t){return{usr:e.state,key:e.key,idx:t}}function go(e,t,n,r){return n===void 0&&(n=null),As({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?qr(t):t,{state:n,key:t&&t.key||r||Mg()})}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 qr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function zg(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=m();c==null&&(c=0,l.replaceState(As({},l.state,{idx:c}),""));function m(){return(l.state||{idx:null}).idx}function h(){o=un.Pop;let j=m(),p=j==null?null:j-c;c=j,u&&u({action:o,location:y.location,delta:p})}function d(j,p){o=un.Push;let f=go(y.location,j,p);c=m()+1;let v=Zc(f,c),w=y.createHref(f);try{l.pushState(v,"",w)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;s.location.assign(w)}i&&u&&u({action:o,location:y.location,delta:1})}function x(j,p){o=un.Replace;let f=go(y.location,j,p);c=m();let v=Zc(f,c),w=y.createHref(f);l.replaceState(v,"",w),i&&u&&u({action:o,location:y.location,delta:0})}function S(j){let p=s.location.origin!=="null"?s.location.origin:s.location.href,f=typeof j=="string"?j:al(j);return f=f.replace(/ $/,"%20"),le(p,"No window.location.(origin|href) available to create URL for href: "+f),new URL(f,p)}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,h),u=j,()=>{s.removeEventListener(Xc,h),u=null}},createHref(j){return t(s,j)},createURL:S,encodeLocation(j){let p=S(j);return{pathname:p.pathname,search:p.search,hash:p.hash}},push:d,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 Ig(e,t,n){return n===void 0&&(n="/"),Fg(e,t,n)}function Fg(e,t,n,r){let s=typeof t=="string"?qr(t):t,i=Qr(s.pathname||"/",n);if(i==null)return null;let l=Zh(e);Dg(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("/")&&(le(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]),m=n.concat(u);i.children&&i.children.length>0&&(le(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),Zh(i.children,t,m,c)),!(i.path==null&&!i.index)&&t.push({path:c,score:Hg(c,i.index),routesMeta:m})};return e.forEach((i,l)=>{var o;if(i.path===""||!((o=i.path)!=null&&o.includes("?")))s(i,l);else for(let u of ep(i.path))s(i,l,u)}),t}function ep(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let l=ep(r.join("/")),o=[];return o.push(...l.map(u=>u===""?i:[i,u].join("/"))),s&&o.push(...l),o.map(u=>e.startsWith("/")&&u===""?"/":u)}function Dg(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Wg(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const $g=/^:[\w-]+$/,Ag=3,Ug=2,Qg=1,Bg=10,Vg=-2,td=e=>e==="*";function Hg(e,t){let n=e.split("/"),r=n.length;return n.some(td)&&(r+=Vg),t&&(r+=Ug),n.filter(s=>!td(s)).reduce((s,i)=>s+($g.test(i)?Ag:i===""?Qg:Bg),r)}function Wg(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 Kg(e,t,n){let{routesMeta:r}=e,s={},i="/",l=[];for(let o=0;o{let{paramName:d,isOptional:x}=m;if(d==="*"){let y=o[h]||"";l=i.slice(0,i.length-y.length).replace(/(.)\/+$/,"$1")}const S=o[h];return x&&!S?c[d]=void 0:c[d]=(S||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:l,pattern:e}}function qg(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Nu(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 Gg(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Nu(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Qr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const Jg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Yg=e=>Jg.test(e);function Xg(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?qr(e):e,i;if(n)if(Yg(n))i=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),Nu(!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:ty(r),hash:ny(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 la(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 Zg(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function tp(e,t){let n=Zg(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function np(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=qr(e):(s=As({},e),le(!s.pathname||!s.pathname.includes("?"),la("?","pathname","search",s)),le(!s.pathname||!s.pathname.includes("#"),la("#","pathname","hash",s)),le(!s.search||!s.search.includes("#"),la("#","search","hash",s)));let i=e===""||s.pathname==="",l=i?"/":s.pathname,o;if(l==null)o=n;else{let h=t.length-1;if(!r&&l.startsWith("..")){let d=l.split("/");for(;d[0]==="..";)d.shift(),h-=1;s.pathname=d.join("/")}o=h>=0?t[h]:"/"}let u=Xg(s,o),c=l&&l!=="/"&&l.endsWith("/"),m=(i||l===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(c||m)&&(u.pathname+="/"),u}const wn=e=>e.join("/").replace(/\/\/+/g,"/"),ey=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),ty=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ny=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function ry(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const rp=["post","put","patch","delete"];new Set(rp);const sy=["get",...rp];new Set(sy);/** + * 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,m){if(m===void 0&&(m={}),!o.current)return;if(typeof c=="number"){r.go(c);return}let h=np(c,JSON.parse(l),i,m.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:wn([t,h.pathname])),(m.replace?r.replace:r.push)(h,m.state,m)},[t,r,l,i,e])}const ay=k.createContext(null);function oy(e){let t=k.useContext(Ut).outlet;return t&&k.createElement(ay.Provider,{value:e},t)}function ap(){let{matches:e}=k.useContext(Ut),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(Ut),{pathname:i}=Gr(),l=JSON.stringify(tp(s,r.v7_relativeSplatPath));return k.useMemo(()=>np(e,JSON.parse(l),i,n==="path"),[e,l,i,n])}function uy(e,t){return cy(e,t)}function cy(e,t,n,r){ei()||le(!1);let{navigator:s}=k.useContext(En),{matches:i}=k.useContext(Ut),l=i[i.length-1],o=l?l.params:{};l&&l.pathname;let u=l?l.pathnameBase:"/";l&&l.route;let c=Gr(),m;if(t){var h;let j=typeof t=="string"?qr(t):t;u==="/"||(h=j.pathname)!=null&&h.startsWith(u)||le(!1),m=j}else m=c;let d=m.pathname||"/",x=d;if(u!=="/"){let j=u.replace(/^\//,"").split("/");x="/"+d.replace(/^\//,"").split("/").slice(j.length).join("/")}let S=Ig(e,{pathname:x}),y=my(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"},m),navigationType:un.Pop}},y):y}function dy(){let e=xy(),t=ry(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 fy=k.createElement(dy,null);class hy 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(Ut.Provider,{value:this.props.routeContext},k.createElement(ip.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function py(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(Ut.Provider,{value:t},r)}function my(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 m=l.findIndex(h=>h.route.id&&(o==null?void 0:o[h.route.id])!==void 0);m>=0||le(!1),l=l.slice(0,Math.min(l.length,m+1))}let u=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let m=0;m=0?l=l.slice(0,c+1):l=[l[0]];break}}}return l.reduceRight((m,h,d)=>{let x,S=!1,y=null,j=null;n&&(x=o&&h.route.id?o[h.route.id]:void 0,y=h.route.errorElement||fy,u&&(c<0&&d===0?(Sy("route-fallback"),S=!0,j=null):c===d&&(S=!0,j=h.route.hydrateFallbackElement||null)));let p=t.concat(l.slice(0,d+1)),f=()=>{let v;return x?v=y:S?v=j:h.route.Component?v=k.createElement(h.route.Component,null):h.route.element?v=h.route.element:v=m,k.createElement(py,{match:h,routeContext:{outlet:m,matches:p,isDataRoute:n!=null},children:v})};return n&&(h.route.ErrorBoundary||h.route.errorElement||d===0)?k.createElement(hy,{location:n.location,revalidation:n.revalidation,component:y,error:x,children:f(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):f()},null)}var op=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(op||{}),up=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(up||{});function vy(e){let t=k.useContext(_l);return t||le(!1),t}function gy(e){let t=k.useContext(sp);return t||le(!1),t}function yy(e){let t=k.useContext(Ut);return t||le(!1),t}function cp(e){let t=yy(),n=t.matches[t.matches.length-1];return n.route.id||le(!1),n.route.id}function xy(){var e;let t=k.useContext(ip),n=gy(),r=cp();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function wy(){let{router:e}=vy(op.UseNavigateStable),t=cp(up.UseNavigateStable),n=k.useRef(!1);return lp(()=>{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 Sy(e,t,n){rd[e]||(rd[e]=!0)}function jy(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function ky(e){return oy(e.context)}function Wt(e){le(!1)}function Ny(e){let{basename:t="/",children:n=null,location:r,navigationType:s=un.Pop,navigator:i,static:l=!1,future:o}=e;ei()&&le(!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=qr(r));let{pathname:m="/",search:h="",hash:d="",state:x=null,key:S="default"}=r,y=k.useMemo(()=>{let j=Qr(m,u);return j==null?null:{location:{pathname:j,search:h,hash:d,state:x,key:S},navigationType:s}},[u,m,h,d,x,S,s]);return y==null?null:k.createElement(En.Provider,{value:c},k.createElement(El.Provider,{children:n,value:y}))}function Cy(e){let{children:t,location:n}=e;return uy(xo(t),n)}new Promise(()=>{});function xo(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,xo(r.props.children,i));return}r.type!==Wt&&le(!1),!r.props.index||!r.props.children||le(!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=xo(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 _y(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ey(e,t){return e.button===0&&(!t||t==="_self")&&!_y(e)}const Py=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],by=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Ty="6";try{window.__reactRouterVersion=Ty}catch{}const Oy=k.createContext({isTransitioning:!1}),Ry="startTransition",sd=$p[Ry];function Ly(e){let{basename:t,children:n,future:r,window:s}=e,i=k.useRef();i.current==null&&(i.current=Lg({window:s,v5Compat:!0}));let l=i.current,[o,u]=k.useState({action:l.action,location:l.location}),{v7_startTransition:c}=r||{},m=k.useCallback(h=>{c&&sd?sd(()=>u(h)):u(h)},[u,c]);return k.useLayoutEffect(()=>l.listen(m),[l,m]),k.useEffect(()=>jy(r),[r]),k.createElement(Ny,{basename:t,children:n,location:o.location,navigationType:o.action,navigator:l,future:r})}const My=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",zy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Iy=k.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:l,state:o,target:u,to:c,preventScrollReset:m,viewTransition:h}=t,d=dp(t,Py),{basename:x}=k.useContext(En),S,y=!1;if(typeof c=="string"&&zy.test(c)&&(S=c,My))try{let v=new URL(window.location.href),w=c.startsWith("//")?new URL(v.protocol+c):new URL(c),N=Qr(w.pathname,x);w.origin===v.origin&&N!=null?c=N+w.search+w.hash:y=!0}catch{}let j=iy(c,{relative:s}),p=Dy(c,{replace:l,state:o,target:u,preventScrollReset:m,relative:s,viewTransition:h});function f(v){r&&r(v),v.defaultPrevented||p(v)}return k.createElement("a",ol({},d,{href:S||j,onClick:y||i?r:f,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:m}=t,h=dp(t,by),d=Pl(u,{relative:h.relative}),x=Gr(),S=k.useContext(sp),{navigator:y,basename:j}=k.useContext(En),p=S!=null&&$y(d)&&c===!0,f=y.encodeLocation?y.encodeLocation(d).pathname:d.pathname,v=x.pathname,w=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;s||(v=v.toLowerCase(),w=w?w.toLowerCase():null,f=f.toLowerCase()),w&&j&&(w=Qr(w,j)||w);const N=f!=="/"&&f.endsWith("/")?f.length-1:f.length;let _=v===f||!l&&v.startsWith(f)&&v.charAt(N)==="/",b=w!=null&&(w===f||!l&&w.startsWith(f)&&w.charAt(f.length)==="/"),C={isActive:_,isPending:b,isTransitioning:p},L=_?r:void 0,z;typeof i=="function"?z=i(C):z=[i,_?"active":null,b?"pending":null,p?"transitioning":null].filter(Boolean).join(" ");let P=typeof o=="function"?o(C):o;return k.createElement(Iy,ol({},h,{"aria-current":L,className:z,ref:n,style:P,to:u,viewTransition:c}),typeof m=="function"?m(C):m)});var wo;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(wo||(wo={}));var ld;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ld||(ld={}));function Fy(e){let t=k.useContext(_l);return t||le(!1),t}function Dy(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:l,viewTransition:o}=t===void 0?{}:t,u=Jr(),c=Gr(),m=Pl(e,{relative:l});return k.useCallback(h=>{if(Ey(h,n)){h.preventDefault();let d=r!==void 0?r:al(c)===al(m);u(e,{replace:d,state:s,preventScrollReset:i,relative:l,viewTransition:o})}},[c,u,m,r,s,n,e,i,l,o])}function $y(e,t){t===void 0&&(t={});let n=k.useContext(Oy);n==null&&le(!1);let{basename:r}=Fy(wo.useViewTransitionState),s=Pl(e,{relative:t.relative});if(!n.isTransitioning)return!1;let i=Qr(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=Qr(n.nextLocation.pathname,r)||n.nextLocation.pathname;return yo(s.pathname,l)!=null||yo(s.pathname,i)!=null}/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var Ay={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Uy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),ue=(e,t)=>{const n=k.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:l,className:o="",children:u,...c},m)=>k.createElement("svg",{ref:m,...Ay,width:s,height:s,stroke:r,strokeWidth:l?Number(i)*24/Number(s):i,className:["lucide",`lucide-${Uy(e)}`,o].join(" "),...c},[...t.map(([h,d])=>k.createElement(h,d)),...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 Qy=ue("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 By=ue("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 fp=ue("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=ue("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=ue("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=ue("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=ue("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=ue("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=ue("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=ue("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ad=ue("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 So=ue("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 hp=ue("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 Gy=ue("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const od=ue("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 Jy=ue("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 Yy=ue("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** + * @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=ue("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/** + * @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 pp=ue("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 Tl=ue("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),Zy={},ud=e=>{let t;const n=new Set,r=(m,h)=>{const d=typeof m=="function"?m(t):m;if(!Object.is(d,t)){const x=t;t=h??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(S=>S(t,x))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>c,subscribe:m=>(n.add(m),()=>n.delete(m)),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?ud(e):ud;var mp={exports:{}},vp={},gp={exports:{}},yp={};/** + * @license React + * use-sync-external-store-shim.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Br=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=Br.useState,sx=Br.useEffect,ix=Br.useLayoutEffect,lx=Br.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,aa(s)&&i({inst:s})},[e,n,t]),sx(function(){return aa(s)&&i({inst:s}),e(function(){aa(s)&&i({inst:s})})},[e]),lx(n),n}function aa(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;yp.useSyncExternalStore=Br.useSyncExternalStore!==void 0?Br.useSyncExternalStore:ux;gp.exports=yp;var cx=gp.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Ol=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=Ol.useRef,vx=Ol.useEffect,gx=Ol.useMemo,yx=Ol.useDebugValue;vp.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,m=x,x=r(x),s!==void 0&&l.hasValue){var S=l.value;if(s(S,x))return h=S}return h=x}if(S=h,hx(m,x))return S;var y=r(x);return s!==void 0&&s(S,y)?(m=x,S):(m=x,h=y)}var c=!1,m,h,d=n===void 0?null:n;return[function(){return u(t())},d===null?void 0:function(){return u(d())}]},[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};mp.exports=vp;var xx=mp.exports;const wx=Pd(xx),xp={},{useDebugValue:Sx}=Po,{useSyncExternalStoreWithSelector:jx}=wx;let cd=!1;const kx=e=>e;function Nx(e,t=kx,n){(xp?"production":void 0)!=="production"&&n&&!cd&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),cd=!0);const r=jx(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Sx(r),r}const dd=e=>{(xp?"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?dd(e):dd,_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?(jr(),null):e}function fd(e,t,n){localStorage.setItem(Eu,e),localStorage.setItem(Pu,t),localStorage.setItem(bu,n)}function jr(){localStorage.removeItem(Eu),localStorage.removeItem(Pu),localStorage.removeItem(bu)}function Cx(){return localStorage.getItem(bu)}let Qs=null;function _x(e){Qs=e}async function te(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){jr(),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 nr={getConfig:()=>te("/auth/config",void 0,!0),login:e=>te("/auth/login",{method:"POST",body:JSON.stringify(e)},!0),getGitHubAuthUrl:()=>`${_u}/auth/github`,getCurrentUser:()=>te("/auth/me"),logout:()=>te("/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 te(`/configs${n?`?${n}`:""}`)},get:e=>te(`/configs/${e}`),create:e=>te("/configs",{method:"POST",body:JSON.stringify(e)}),update:(e,t)=>te(`/configs/${e}`,{method:"PUT",body:JSON.stringify(t)}),delete:e=>te(`/configs/${e}`,{method:"DELETE"}),generateVariations:e=>te("/configs/generate-variations",{method:"POST",body:JSON.stringify(e)})},mr={list:e=>{const t=new URLSearchParams;e!=null&&e.category&&t.set("category",e.category),e!=null&&e.suite&&t.set("suite",e.suite);const n=t.toString();return te(`/tasks${n?`?${n}`:""}`)},get:e=>te(`/tasks/${e}`),create:e=>te("/tasks",{method:"POST",body:JSON.stringify(e)}),delete:e=>te(`/tasks/${e}`,{method:"DELETE"}),importSuite:e=>te(`/tasks/import-suite?suite_name=${encodeURIComponent(e)}`,{method:"POST"})},Sn={list:e=>{const t=e?`?status=${e}`:"";return te(`/jobs${t}`)},get:e=>te(`/jobs/${e}`),create:e=>te("/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 jr(),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 m=l.split(` +`);l=m.pop()||"";for(const h of m)h.startsWith("data: ")&&(yield JSON.parse(h.slice(6)))}},cancel:e=>te(`/jobs/${e}/cancel`,{method:"POST"}),delete:e=>te(`/jobs/${e}`,{method:"DELETE"})},jo={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 te(`/runs${n?`?${n}`:""}`)},get:e=>te(`/runs/${e}`),getJobSummary:e=>te(`/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 nr.getConfig();if(e({authConfig:n,isLoadingConfig:!1}),n.enabled){const r=ul(),s=Cx();if(r&&s)try{const i=await nr.getCurrentUser();e({isAuthenticated:!0,user:i})}catch{jr(),e({isAuthenticated:!1,user:null})}}else e({isAuthenticated:!0,user:{username:"anonymous",auth_mode:"none"}})}catch(n){console.error("Failed to load auth config:",n),e({isLoadingConfig:!1,error:"Failed to connect to server"})}},login:async(n,r)=>{e({isLoading:!0,error:null});try{const s=await nr.login({username:n,password:r});return fd(s.access_token,s.expires_at,s.username),e({isAuthenticated:!0,isLoading:!1,user:{username:s.username,auth_mode:"basic"}}),!0}catch(s){return e({isLoading:!1,error:s instanceof Error?s.message:"Login failed"}),!1}},loginWithGitHub:()=>{window.location.href=nr.getGitHubAuthUrl()},handleOAuthCallback:()=>{const n=new URLSearchParams(window.location.search),r=n.get("auth_error");if(r)return e({error:r}),window.history.replaceState({},"",window.location.pathname),!0;if(n.get("auth_callback")==="true"){const s=n.get("token"),i=n.get("expires_at"),l=n.get("username");return s&&i&&l&&(fd(s,i,l),e({isAuthenticated:!0,user:{username:l,auth_mode:"github"}})),window.history.replaceState({},"",window.location.pathname),!0}return!1},logout:async()=>{try{await nr.logout()}catch{}jr(),e({isAuthenticated:!1,user:null,error:null})},checkAuth:async()=>{const{authConfig:n}=t();if(!(n!=null&&n.enabled)){e({isAuthenticated:!0});return}if(!ul()){e({isAuthenticated:!1,user:null});return}try{const s=await nr.getCurrentUser();e({isAuthenticated:!0,user:s})}catch{jr(),e({isAuthenticated:!1,user:null})}},clearError:()=>e({error:null})}));function 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",m={primary:"bg-[var(--accent)] text-black hover:bg-[#16a34a]",secondary:"bg-[var(--bg-tertiary)] text-[var(--text-primary)] border border-[var(--border)] hover:bg-[var(--border)]",danger:"bg-[var(--error)] text-white hover:bg-red-600",ghost:"text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)]"},h={sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm"},d=t==="sm"?14:16;return a.jsxs("button",{className:`${c} ${m[e]} ${h[t]} ${n}`,disabled:o||i,...u,children:[i?a.jsx(bl,{size:d,className:"animate-spin"}):r?a.jsx(r,{size:d}):null,l,s&&!i&&a.jsx(s,{size:d})]})}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,p)=>({...p,...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 m=Bs(i.serialize),h=()=>{const j=i.partialize({...r()});let p;const f=m({state:j,version:i.version}).then(v=>c.setItem(i.name,v)).catch(v=>{p=v});if(p)throw p;return f},d=s.setState;s.setState=(j,p)=>{d(j,p),h()};const x=e((...j)=>{n(...j),h()},r,s);let S;const y=()=>{var j;if(!c)return;l=!1,o.forEach(f=>f(r()));const p=((j=i.onRehydrateStorage)==null?void 0:j.call(i,r()))||void 0;return Bs(c.getItem.bind(c))(i.name).then(f=>{if(f)return i.deserialize(f)}).then(f=>{if(f)if(typeof f.version=="number"&&f.version!==i.version){if(i.migrate)return i.migrate(f.state,f.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return f.state}).then(f=>{var v;return S=i.merge(f,(v=r())!=null?v:x),n(S,!0),h()}).then(()=>{p==null||p(S,void 0),l=!0,u.forEach(f=>f(S))}).catch(f=>{p==null||p(void 0,f)})};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 m=()=>{const y=i.partialize({...r()});return c.setItem(i.name,{state:y,version:i.version})},h=s.setState;s.setState=(y,j)=>{h(y,j),m()};const d=e((...y)=>{n(...y),m()},r,s);s.getInitialState=()=>d;let x;const S=()=>{var y,j;if(!c)return;l=!1,o.forEach(f=>{var v;return f((v=r())!=null?v:d)});const p=((j=i.onRehydrateStorage)==null?void 0:j.call(i,(y=r())!=null?y:d))||void 0;return Bs(c.getItem.bind(c))(i.name).then(f=>{if(f)if(typeof f.version=="number"&&f.version!==i.version){if(i.migrate)return[!0,i.migrate(f.state,f.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,f.state];return[!1,void 0]}).then(f=>{var v;const[w,N]=f;if(x=i.merge(N,(v=r())!=null?v:d),n(x,!0),w)return m()}).then(()=>{p==null||p(x,void 0),x=r(),l=!0,u.forEach(f=>f(x))}).catch(f=>{p==null||p(void 0,f)})};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||d},Ox=(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),Rx=Ox,Lx=Cu()(Rx((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.jsxs("button",{onClick:t,className:"relative w-14 h-7 rounded-full bg-[var(--bg-tertiary)] border border-[var(--border)] transition-colors hover:border-[var(--text-secondary)] focus:outline-none focus:ring-2 focus:ring-[var(--accent)] focus:ring-offset-2 focus:ring-offset-[var(--bg-primary)]","aria-label":`Switch to ${e==="dark"?"light":"dark"} mode`,title:`Switch to ${e==="dark"?"light":"dark"} mode`,children:[a.jsxs("span",{className:"absolute inset-0 flex items-center justify-between px-1.5 pointer-events-none",children:[a.jsx(od,{size:12,className:`transition-opacity ${e==="light"?"opacity-0":"opacity-40"}`}),a.jsx(ad,{size:12,className:`transition-opacity ${e==="dark"?"opacity-0":"opacity-40"}`})]}),a.jsx("span",{className:`absolute top-0.5 w-6 h-6 rounded-full bg-[var(--accent)] shadow-md flex items-center justify-center transition-all duration-200 ease-in-out ${e==="dark"?"left-0.5":"left-[calc(100%-26px)]"}`,children:e==="dark"?a.jsx(ad,{size:12,className:"text-black"}):a.jsx(od,{size:12,className:"text-black"})})]})}const zx=[{path:"/agents",label:"Agents",icon:By},{path:"/tasks",label:"Tasks",icon:Wy},{path:"/jobs",label:"Jobs",icon:So}];function Ix(){const e=Gr(),{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(Tl,{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(pp,{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(ky,{})})})]})}function me({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 q({children:e,variant:t="default"}){const n={default:"bg-[var(--bg-tertiary)] text-[var(--text-primary)] border border-[var(--border)]",success:"bg-green-600 text-white",warning:"bg-yellow-500 text-black",error:"bg-red-600 text-white",info:"bg-blue-600 text-white"};return a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs font-medium rounded ${n[t]}`,children:e})}function 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 Xe({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 Fx({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 _t({label:e,className:t="",...n}){return a.jsxs("label",{className:`flex items-center gap-2 cursor-pointer ${t}`,children:[a.jsx("input",{type:"checkbox",className:"w-4 h-4 bg-[var(--bg-primary)] border border-[var(--border)] accent-[var(--accent)]",...n}),a.jsx("span",{className:"text-sm",children:e})]})}function hd(){const e=Jr(),t=er(),[n,r]=k.useState(!1),[s,i]=k.useState(null),{data:l=[],isLoading:o}=Mt({queryKey:["configs"],queryFn:()=>Mi.list()}),{data:u=[]}=Mt({queryKey:["jobs"],queryFn:()=>Sn.list()}),c=ft({mutationFn:Mi.create,onSuccess:()=>{t.invalidateQueries({queryKey:["configs"]}),r(!1)}}),m=ft({mutationFn:Mi.delete,onSuccess:()=>t.invalidateQueries({queryKey:["configs"]})}),h=d=>{const x=u.filter(j=>j.config_ids.includes(d)),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:hp,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(Dx,{onCreateClick:()=>r(!0)}):a.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:l.map(d=>{const x=h(d.id);return a.jsx($x,{agent:d,stats:x,onOptimize:()=>i(d),onDelete:()=>{confirm(`Delete agent "${d.name}"?`)&&m.mutate(d.id)}},d.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(d=>{const x=d.total_experiments>0?d.completed_experiments/d.total_experiments*100:0;return a.jsxs(me,{className:"cursor-pointer hover:border-[var(--accent-dim)] flex flex-col",onClick:()=>e(`/jobs/${d.id}`),children:[a.jsx("div",{className:"flex items-start justify-between mb-3",children:a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx(q,{variant:d.status==="completed"?"success":d.status==="running"?"info":d.status==="failed"?"error":"default",children:d.status}),d.pareto_frontier.length>0&&a.jsxs(q,{variant:"success",children:[d.pareto_frontier.length," Pareto"]}),d.use_llm_eval&&a.jsx(q,{children:"LLM"})]}),a.jsx("h3",{className:"font-medium mt-2 truncate",title:d.name||`Job ${d.id.slice(0,8)}`,children:d.name||`Job ${d.id.slice(0,8)}`}),a.jsxs("code",{className:"text-xs text-[var(--text-secondary)] font-mono",children:[d.id.slice(0,8),"..."]})]})}),(d.status==="running"||d.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:[d.completed_experiments,"/",d.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 ${d.status==="completed"?"bg-green-500":"bg-[var(--accent)]"}`,style:{width:`${x}%`}})})]}),d.status==="failed"&&d.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:d.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:d.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:d.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:d.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(d.created_at).toLocaleDateString()," ",new Date(d.created_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]},d.id)})}),u.length>6&&a.jsxs(W,{variant:"ghost",className:"mt-4",onClick:()=>e("/jobs"),children:["View all ",u.length," jobs →"]})]}),a.jsx(Ax,{isOpen:n,onClose:()=>r(!1),onSubmit:d=>c.mutate(d),isLoading:c.isPending}),s&&a.jsx(Ux,{agent:s,isOpen:!!s,onClose:()=>i(null)})]})}function Dx({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(Gy,{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:hp,onClick:e,children:"Create Your First Agent"})]})}function $x({agent:e,stats:t,onOptimize:n,onDelete:r}){return a.jsxs(me,{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:Jy,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(q,{children:["compaction ",e.config.compaction_head_size,"/",e.config.compaction_tail_size]}),e.config.enable_memory_tool&&a.jsx(q,{children:"memory"}),e.config.enable_sub_agent&&a.jsx(q,{children:"sub-agent"}),a.jsxs(q,{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:Tl,onClick:n,className:"w-full",children:"Optimize"})]})}function Ax({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(Xe,{label:"Name",value:s.name,onChange:o=>i({...s,name:o.target.value}),placeholder:"e.g., baseline, fast-compaction",required:!0}),a.jsx(Xe,{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(_t,{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(Xe,{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(Xe,{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(_t,{label:"Enable memory tool",checked:s.enable_memory_tool,onChange:o=>i({...s,enable_memory_tool:o.target.checked})}),a.jsx(_t,{label:"Enable sub-agent",checked:s.enable_sub_agent,onChange:o=>i({...s,enable_sub_agent:o.target.checked})})]}),a.jsx(Xe,{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 Ux({agent:e,isOpen:t,onClose:n}){var F,D,J;const r=Jr(),s=er(),[i,l]=k.useState("suite"),[o,u]=k.useState("quick"),[c,m]=k.useState(!1),[h,d]=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]}),[p,f]=k.useState(4),[v,w]=k.useState(!1),[N,_]=k.useState(null),{data:b=[]}=Mt({queryKey:["tasks"],queryFn:()=>mr.list()}),C=ft({mutationFn:mr.importSuite,onSuccess:O=>{s.invalidateQueries({queryKey:["tasks"]}),d(O.map(V=>V.id))}}),L=ft({mutationFn:Mi.generateVariations,onSuccess:()=>{s.invalidateQueries({queryKey:["configs"]})}}),z=ft({mutationFn:async O=>{const V=await Sn.create(O);return Sn.start(V.id).next(),V},onSuccess:O=>{s.invalidateQueries({queryKey:["jobs"]}),_(O.id),l("success")}}),P=[{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}],U=()=>{var V,Se;if(!x)return 1;let O=1;return y.vary_compaction&&(O*=2),y.vary_memory&&(O*=2),y.vary_sub_agent&&(O*=2),y.vary_compaction_head&&(O*=((V=y.compaction_head_values)==null?void 0:V.length)||3),y.vary_compaction_tail&&(O*=((Se=y.compaction_tail_values)==null?void 0:Se.length)||3),O},ge=async()=>{l("starting");let O=h,V=[e.id];if(!c)try{O=(await C.mutateAsync(o)).map(Bt=>Bt.id)}catch(Ae){console.error("Failed to import suite:",Ae),alert(`Failed to import task suite: ${o}`),l("variations");return}if(O.length===0){alert("No tasks selected. Please select tasks or choose a task suite."),l("variations");return}if(x)try{V=(await L.mutateAsync({...y,base_name:e.name})).map(Bt=>Bt.id)}catch(Ae){console.error("Failed to generate config variations:",Ae),alert("Failed to generate config variations"),l("variations");return}const Se=U(),Yr={name:x?`${e.name} ablation (${Se} configs × ${O.length} tasks)`:`${e.name} - ${o}`,config_ids:V,task_ids:O,parallel:p,use_llm_eval:v};z.mutate(Yr)},rt=O=>{d(V=>V.includes(O)?V.filter(Se=>Se!==O):[...V,O])},Ke=()=>{l("suite"),_(null),S(!1),n()},pt=U(),Qt=c?h.length:((F=P.find(O=>O.value===o))==null?void 0:F.tasks)||3,T=pt*Qt;return a.jsx(Rl,{isOpen:t,onClose:Ke,title:`Optimize: ${e.name}`,children:i==="success"&&N?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(Tl,{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: ",N.slice(0,8),"..."]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(W,{variant:"secondary",onClick:Ke,children:"Close"}),a.jsx(W,{variant:"primary",icon:So,onClick:()=>{Ke(),r(`/jobs/${N}`)},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:L.isPending?"Generating config variations...":C.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(q,{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(q,{variant:"info",children:[pt," 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(_t,{label:"Compaction (on/off)",checked:y.vary_compaction,onChange:O=>j({...y,vary_compaction:O.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(_t,{label:"Memory Tool (on/off)",checked:y.vary_memory,onChange:O=>j({...y,vary_memory:O.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(_t,{label:"Sub-Agent (on/off)",checked:y.vary_sub_agent,onChange:O=>j({...y,vary_sub_agent:O.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(_t,{label:"Compaction Head Size",checked:y.vary_compaction_head,onChange:O=>j({...y,vary_compaction_head:O.target.checked})}),y.vary_compaction_head&&a.jsx(Xe,{label:"Head sizes (comma-separated)",value:((D=y.compaction_head_values)==null?void 0:D.join(", "))||"5, 10, 20",onChange:O=>j({...y,compaction_head_values:O.target.value.split(",").map(V=>parseInt(V.trim())).filter(V=>!isNaN(V))})}),a.jsx(_t,{label:"Compaction Tail Size",checked:y.vary_compaction_tail,onChange:O=>j({...y,vary_compaction_tail:O.target.checked})}),y.vary_compaction_tail&&a.jsx(Xe,{label:"Tail sizes (comma-separated)",value:((J=y.compaction_tail_values)==null?void 0:J.join(", "))||"20, 40, 60",onChange:O=>j({...y,compaction_tail_values:O.target.value.split(",").map(V=>parseInt(V.trim())).filter(V=>!isNaN(V))})})]}),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:pt})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{children:"Tasks:"}),a.jsx("span",{className:"font-mono",children:Qt})]}),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(Xe,{label:"Parallel Workers",type:"number",value:p,onChange:O=>f(parseInt(O.target.value)||1),min:1,max:16}),a.jsx("div",{className:"flex items-end pb-1",children:a.jsx(_t,{label:"Use LLM evaluation",checked:v,onChange:O=>w(O.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:So,onClick:ge,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:P.map(O=>{const V=b.filter(Se=>Se.suite===O.value).length;return a.jsxs("label",{className:`flex items-center gap-3 p-3 border cursor-pointer transition-colors ${o===O.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:O.value,checked:o===O.value&&!c,onChange:()=>{u(O.value),m(!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:O.label}),a.jsxs(q,{children:[O.tasks," tasks"]}),V>0&&a.jsxs(q,{variant:"success",children:[V," imported"]})]}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:O.description})]})]},O.value)})})]}),b.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:()=>m(!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:b.map(O=>a.jsxs("label",{className:"flex items-center gap-2 p-2 hover:bg-[var(--bg-tertiary)] cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:h.includes(O.id),onChange:()=>rt(O.id),className:"accent-[var(--accent)]"}),a.jsx("span",{className:"text-sm",children:O.name}),O.suite&&a.jsx(q,{children:O.suite})]},O.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&&h.length===0,children:"Next: Config Variations"})]})]})})}const wp=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 Qx(){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}=wp(),m=f=>{l(v=>{const w=new Set(v);return w.has(f)?w.delete(f):w.add(f),w})},{data:h=[],isLoading:d}=Mt({queryKey:["tasks"],queryFn:()=>mr.list()});k.useEffect(()=>{h.length>0&&c(h)},[h,c]);const x=ft({mutationFn:mr.create,onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),n(!1)}}),S=ft({mutationFn:mr.importSuite,onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),s(!1)}}),y=ft({mutationFn:mr.delete,onSuccess:()=>e.invalidateQueries({queryKey:["tasks"]})}),j=h.reduce((f,v)=>{const w=v.suite||"custom";return f[w]||(f[w]=[]),f[w].push(v),f},{}),p=Object.keys(j).sort((f,v)=>f==="custom"?-1:v==="custom"?1:f.localeCompare(v));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"})]})]}),d?a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Loading..."}):h.length===0?a.jsx("div",{className:"text-center py-12 text-[var(--text-secondary)]",children:"No tasks yet. Create one or import a built-in suite."}):a.jsx("div",{className:"space-y-4",children:p.map(f=>{const v=j[f],w=i.has(f),N=v.filter(_=>o.includes(_.id)).length;return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>m(f),className:"flex items-center gap-2 py-2 hover:text-[var(--accent)] transition-colors",children:[w?a.jsx(fp,{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:f==="custom"?"Custom Tasks":`${f} Suite`}),a.jsx(q,{variant:f==="custom"?"default":"info",children:v.length}),N>0&&a.jsxs(q,{variant:"success",children:[N," selected"]})]}),w&&a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3 mt-2",children:v.map(_=>a.jsx(me,{selectable:!0,selected:o.includes(_.id),onClick:()=>u(_.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:_.name}),o.includes(_.id)&&a.jsx(q,{variant:"success",children:"Selected"}),_.category&&_.category!=="default"&&a.jsx(q,{variant:"default",children:_.category})]}),a.jsx(W,{variant:"ghost",size:"sm",onClick:b=>{b.stopPropagation(),confirm("Delete this task?")&&y.mutate(_.id)},children:"Delete"})]}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-2 line-clamp-3 flex-1",children:_.prompt}),_.criteria.length>0&&a.jsx("div",{className:"flex gap-1 mt-2 flex-wrap",children:_.criteria.map(b=>a.jsx(q,{variant:"default",children:b.name},b.name))})]})},_.id))})]},f)})}),a.jsx(Bx,{isOpen:t,onClose:()=>n(!1),onSubmit:f=>x.mutate(f),isLoading:x.isPending}),a.jsx(Vx,{isOpen:r,onClose:()=>s(!1),onSubmit:f=>S.mutate(f),isLoading:S.isPending})]})}function Bx({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=(m,h)=>{const d=[...s.criteria];d[m]={...d[m],...h},i({...s,criteria:d})},u=m=>{i({...s,criteria:s.criteria.filter((h,d)=>d!==m)})},c=m=>{m.preventDefault(),!(!s.name.trim()||!s.prompt.trim())&&n({...s,criteria:s.criteria.filter(h=>h.name.trim()&&h.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(Xe,{label:"Name",value:s.name,onChange:m=>i({...s,name:m.target.value}),placeholder:"e.g., fizzbuzz",required:!0}),a.jsx(Fx,{label:"Prompt",value:s.prompt,onChange:m=>i({...s,prompt:m.target.value}),placeholder:"The task description for the agent...",required:!0}),a.jsx(Xe,{label:"Category",value:s.category,onChange:m=>i({...s,category:m.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((m,h)=>a.jsxs("div",{className:"flex gap-2 items-start",children:[a.jsx(Xe,{value:m.name,onChange:d=>o(h,{name:d.target.value}),placeholder:"Name",className:"w-32"}),a.jsx(Xe,{value:m.instruction,onChange:d=>o(h,{instruction:d.target.value}),placeholder:"Instruction",className:"flex-1"}),a.jsx(W,{type:"button",variant:"ghost",size:"sm",onClick:()=>u(h),children:"×"})]},h))})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[a.jsx(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 Vx({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 Hx(){const e=Jr(),t=er(),{setJobs:n}=wp(),{data:r=[],isLoading:s}=Mt({queryKey:["jobs"],queryFn:()=>Sn.list(),refetchInterval:5e3});k.useEffect(()=>{r.length>0&&n(r)},[r,n]);const i=ft({mutationFn:Sn.delete,onSuccess:()=>t.invalidateQueries({queryKey:["jobs"]})}),l=o=>{const u={pending:"default",running:"info",completed:"success",failed:"error",cancelled:"warning"};return a.jsx(q,{variant:u[o]||"default",children:o})};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(o=>{const u=o.total_experiments>0?o.completed_experiments/o.total_experiments*100:0;return a.jsxs(me,{className:"cursor-pointer hover:border-[var(--accent-dim)] flex flex-col",onClick:()=>e(`/jobs/${o.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:[l(o.status),o.pareto_frontier.length>0&&a.jsxs(q,{variant:"success",children:[o.pareto_frontier.length," Pareto"]}),o.use_llm_eval&&a.jsx(q,{children:"LLM"})]}),a.jsx("h3",{className:"font-medium mt-2 truncate",title:o.name||`Job ${o.id.slice(0,8)}`,children:o.name||`Job ${o.id.slice(0,8)}`}),a.jsxs("code",{className:"text-xs text-[var(--text-secondary)] font-mono",children:[o.id.slice(0,8),"..."]})]}),a.jsx(W,{variant:"ghost",size:"sm",onClick:c=>{c.stopPropagation(),confirm("Delete this job?")&&i.mutate(o.id)},disabled:o.status==="running",children:"×"})]}),(o.status==="running"||o.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:[o.completed_experiments,"/",o.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 ${o.status==="completed"?"bg-green-500":"bg-[var(--accent)]"}`,style:{width:`${u}%`}})})]}),o.status==="failed"&&o.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:o.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:o.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:o.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:o.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(o.created_at).toLocaleDateString()," ",new Date(o.created_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]},o.id)})})]})}function Wx(e,t=!0){return Math.abs(e)<10?"text-[var(--text-secondary)]":(t?e<0:e>0)?"text-green-400":"text-red-400"}function Kx(e){return`${e>0?"+":""}${e.toFixed(1)}%`}function Sp(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=Sp(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 ${Wx(u,s)}`,children:Kx(u)}),c&&a.jsx("div",{className:"text-xs text-[var(--text-secondary)]",children:"(baseline)"})]},o)})]})}function qx({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(me,{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(q,{variant:"success",children:"Pareto"}),l===n&&a.jsx(q,{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=Sp(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 Gx({summaries:e,width:t=500,height:n=300}){const r={top:20,right:20,bottom:40,left:50},s=t-r.left-r.right,i=n-r.top-r.bottom,{xScale:l,yScale:o,xTicks:u,yTicks:c,paretoLine:m}=k.useMemo(()=>{if(e.length===0)return{xScale:()=>0,yScale:()=>0,xTicks:[],yTicks:[],paretoLine:[]};const d=e.map(C=>C.avg_tokens),x=e.map(C=>C.avg_score),S=Math.min(...d)*.9,y=Math.max(...d)*1.1,j=Math.min(...x,.5),p=Math.min(Math.max(...x)*1.05,1),f=C=>(C-S)/(y-S)*s,v=C=>i-(C-j)/(p-j)*i,w=Array.from({length:5},(C,L)=>S+L/4*(y-S)),N=Array.from({length:5},(C,L)=>j+L/4*(p-j)),b=e.filter(C=>C.is_pareto).sort((C,L)=>C.avg_tokens-L.avg_tokens).map(C=>({x:f(C.avg_tokens),y:v(C.avg_score)}));return{xScale:f,yScale:v,xTicks:w,yTicks:N,paretoLine:b}},[e,s,i]);if(e.length===0)return a.jsx("div",{className:"text-center py-8 text-[var(--text-secondary)]",children:"No data to display"});const h=d=>d>=1e6?`${(d/1e6).toFixed(1)}M`:d>=1e3?`${(d/1e3).toFixed(0)}K`:d.toFixed(0);return a.jsx("svg",{width:t,height:n,className:"font-mono text-xs",children:a.jsxs("g",{transform:`translate(${r.left}, ${r.top})`,children:[u.map((d,x)=>a.jsx("line",{x1:l(d),y1:0,x2:l(d),y2:i,stroke:"var(--border)",strokeDasharray:"2,2"},`x-grid-${x}`)),c.map((d,x)=>a.jsx("line",{x1:0,y1:o(d),x2:s,y2:o(d),stroke:"var(--border)",strokeDasharray:"2,2"},`y-grid-${x}`)),m.length>1&&a.jsx("polyline",{points:m.map(d=>`${d.x},${d.y}`).join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),e.map(d=>{const x=l(d.avg_tokens),S=o(d.avg_score),y=d.is_pareto;return a.jsxs("g",{children:[a.jsx("circle",{cx:x,cy:S,r:y?8:6,fill:y?"var(--accent)":"var(--bg-tertiary)",stroke:y?"var(--accent)":"var(--border)",strokeWidth:2,className:"cursor-pointer hover:opacity-80 transition-opacity"}),y&&a.jsx("text",{x,y:S-12,textAnchor:"middle",fill:"var(--text-primary)",fontSize:10,className:"pointer-events-none",children:d.config_name.replace(/^baseline_/,"").slice(0,15)})]},d.config_name)}),a.jsx("line",{x1:0,y1:i,x2:s,y2:i,stroke:"var(--text-secondary)"}),u.map((d,x)=>a.jsxs("g",{transform:`translate(${l(d)}, ${i})`,children:[a.jsx("line",{y2:5,stroke:"var(--text-secondary)"}),a.jsx("text",{y:18,textAnchor:"middle",fill:"var(--text-secondary)",fontSize:10,children:h(d)})]},`x-tick-${x}`)),a.jsx("text",{x:s/2,y:i+35,textAnchor:"middle",fill:"var(--text-secondary)",fontSize:11,children:"Tokens (cost)"}),a.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--text-secondary)"}),c.map((d,x)=>a.jsxs("g",{transform:`translate(0, ${o(d)})`,children:[a.jsx("line",{x2:-5,stroke:"var(--text-secondary)"}),a.jsxs("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--text-secondary)",fontSize:10,children:[(d*100).toFixed(0),"%"]})]},`y-tick-${x}`)),a.jsx("text",{transform:`translate(-35, ${i/2}) rotate(-90)`,textAnchor:"middle",fill:"var(--text-secondary)",fontSize:11,children:"Score (quality)"})]})})}function Jx(){const{jobId:e}=ap(),t=Jr(),n=er(),[r,s]=k.useState(null),[i,l]=k.useState(!1),[o,u]=k.useState(null),[c,m]=k.useState([]),[h,d]=k.useState(null),[x,S]=k.useState(null),[y,j]=k.useState(!1),{data:p,isLoading:f}=Mt({queryKey:["jobs",e],queryFn:()=>Sn.get(e),enabled:!!e,refetchInterval:i?2e3:!1}),{data:v=[]}=Mt({queryKey:["runs",e],queryFn:()=>jo.list({job_id:e}),enabled:!!e,refetchInterval:i?2e3:!1}),{data:w}=Mt({queryKey:["job-summary",e],queryFn:()=>jo.getJobSummary(e),enabled:!!e&&(p==null?void 0:p.status)==="completed"}),N=ft({mutationFn:async()=>{l(!0),m([]),d(null),S(null);for await(const P of Sn.start(e))s(P),P.current_config&&P.current_task&&d(U=>(U&&(U.config!==P.current_config||U.task!==P.current_task)&&m(ge=>[...ge,{config_name:U.config,task_name:U.task,completed_at:Date.now()}]),{config:P.current_config,task:P.current_task})),P.event==="error"&&(S(P.message),l(!1),n.invalidateQueries({queryKey:["jobs",e]})),P.event==="complete"&&(d(U=>(U&&m(ge=>[...ge,{config_name:U.config,task_name:U.task,completed_at:Date.now()}]),null)),l(!1),n.invalidateQueries({queryKey:["jobs",e]}),n.invalidateQueries({queryKey:["runs",e]}),n.invalidateQueries({queryKey:["job-summary",e]}))}}),_=ft({mutationFn:()=>Sn.cancel(e),onSuccess:()=>{l(!1),n.invalidateQueries({queryKey:["jobs",e]})}});k.useEffect(()=>{(p==null?void 0:p.status)==="running"&&l(!0)},[p==null?void 0:p.status]);const b=k.useMemo(()=>{const P=new Map;for(const U of v)P.has(U.task_name)||P.set(U.task_name,[]),P.get(U.task_name).push(U);return P},[v]),C=k.useMemo(()=>Array.from(b.keys()),[b]),L=k.useMemo(()=>{if(!(w!=null&&w.config_summaries)||w.config_summaries.length===0)return null;const P=w.config_summaries,U=[...P].sort((T,F)=>F.avg_score-T.avg_score)[0],ge=P.filter(T=>T.is_pareto),rt=ge.length>0?[...ge].sort((T,F)=>{const D=T.avg_score/(T.avg_tokens/1e3);return F.avg_score/(F.avg_tokens/1e3)-D})[0]:null,Ke=U.avg_score*.9,pt=P.filter(T=>T.avg_score>=Ke),Qt=pt.length>0?[...pt].sort((T,F)=>T.avg_tokens-F.avg_tokens)[0]:null;return{bestScore:U,mostEfficient:rt,lowestCost:Qt}},[w]);if(f)return a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Loading..."});if(!p)return a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Job not found"});const z=P=>{const U={pending:"default",running:"info",completed:"success",failed:"error",cancelled:"warning"};return a.jsx(q,{variant:U[P]||"default",children:P})};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:p.name||`Job ${p.id.slice(0,8)}`}),z(p.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:[p.id.slice(0,8),"..."]}),a.jsxs("span",{className:"text-sm text-[var(--text-secondary)]",children:[p.config_ids.length," configs × ",p.task_ids.length," tasks = ",p.total_experiments," experiments"]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[p.status==="pending"&&a.jsx(W,{variant:"primary",onClick:()=>N.mutate(),disabled:N.isPending,children:N.isPending?"Starting...":"Start"}),p.status==="running"&&a.jsx(W,{variant:"danger",onClick:()=>_.mutate(),disabled:_.isPending,children:"Cancel"})]})]}),(x||p.error)&&a.jsx(me,{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||p.error})]})]})}),(i||r)&&a.jsxs(me,{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)||p.completed_experiments,"/",(r==null?void 0:r.total)||p.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)||p.completed_experiments)/((r==null?void 0:r.total)||p.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((P,U)=>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:P.config_name}),a.jsx("span",{className:"text-[var(--text-secondary)]",children:"→"}),a.jsx("span",{children:P.task_name})]},`${P.config_name}-${P.task_name}-${U}`))})]})]})]}),w&&L&&a.jsxs(me,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-4",children:"Recommendations"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"p-4 bg-[var(--bg-primary)] rounded-lg border border-[var(--border)]",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Xy,{className:"w-5 h-5 text-yellow-500"}),a.jsx("span",{className:"font-medium text-sm",children:"Best Quality"})]}),a.jsx("div",{className:"text-lg font-bold text-[var(--accent)] truncate",title:L.bestScore.config_name,children:L.bestScore.config_name.replace(/^baseline_/,"")}),a.jsxs("div",{className:"text-sm text-[var(--text-secondary)] mt-1",children:[(L.bestScore.avg_score*100).toFixed(1),"% score"]}),a.jsx("div",{className:"text-xs text-[var(--text-secondary)] mt-2",children:"Highest average score across all tasks. Choose this when quality is the top priority."})]}),L.mostEfficient&&a.jsxs("div",{className:"p-4 bg-[var(--bg-primary)] rounded-lg border border-[var(--border)]",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Yy,{className:"w-5 h-5 text-green-500"}),a.jsx("span",{className:"font-medium text-sm",children:"Best Value"})]}),a.jsx("div",{className:"text-lg font-bold text-[var(--accent)] truncate",title:L.mostEfficient.config_name,children:L.mostEfficient.config_name.replace(/^baseline_/,"")}),a.jsxs("div",{className:"text-sm text-[var(--text-secondary)] mt-1",children:[(L.mostEfficient.avg_score*100).toFixed(1),"% @ ",(L.mostEfficient.avg_tokens/1e3).toFixed(0),"K tokens"]}),a.jsx("div",{className:"text-xs text-[var(--text-secondary)] mt-2",children:"Best score-to-cost ratio on Pareto frontier. Optimal balance of quality and efficiency."})]}),L.lowestCost&&L.lowestCost.config_name!==L.bestScore.config_name&&a.jsxs("div",{className:"p-4 bg-[var(--bg-primary)] rounded-lg border border-[var(--border)]",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Tl,{className:"w-5 h-5 text-blue-500"}),a.jsx("span",{className:"font-medium text-sm",children:"Budget Pick"})]}),a.jsx("div",{className:"text-lg font-bold text-[var(--accent)] truncate",title:L.lowestCost.config_name,children:L.lowestCost.config_name.replace(/^baseline_/,"")}),a.jsxs("div",{className:"text-sm text-[var(--text-secondary)] mt-1",children:[(L.lowestCost.avg_tokens/1e3).toFixed(0),"K tokens (",(L.lowestCost.avg_score*100).toFixed(1),"%)"]}),a.jsx("div",{className:"text-xs text-[var(--text-secondary)] mt-2",children:"Lowest cost while maintaining >90% of best score. Choose for high-volume use cases."})]})]})]}),w&&w.config_summaries.length>1&&a.jsxs(me,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-4",children:"Pareto Frontier"}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:"Configs on the frontier (connected line) represent optimal trade-offs between quality and cost. Points above and to the left are better."}),a.jsx("div",{className:"flex justify-center",children:a.jsx(Gx,{summaries:w.config_summaries,width:600,height:350})})]}),w&&a.jsxs(me,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-4",children:"Results Summary"}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-left text-[var(--text-secondary)] border-b border-[var(--border)]",children:[a.jsx("th",{className:"pb-2",children:"Config"}),a.jsx("th",{className:"pb-2",children:"Avg Score"}),a.jsx("th",{className:"pb-2",children:"Avg Tokens"}),a.jsx("th",{className:"pb-2",children:"Pass Rate"}),a.jsx("th",{className:"pb-2",children:"Pareto"})]})}),a.jsx("tbody",{children:w.config_summaries.map(P=>a.jsxs("tr",{className:"border-b border-[var(--border)]",children:[a.jsx("td",{className:"py-2 font-medium",children:P.config_name}),a.jsxs("td",{className:"py-2",children:[(P.avg_score*100).toFixed(1),"%"]}),a.jsx("td",{className:"py-2",children:P.avg_tokens.toLocaleString()}),a.jsxs("td",{className:"py-2",children:[P.passed_runs,"/",P.total_runs]}),a.jsx("td",{className:"py-2",children:P.is_pareto&&a.jsx(q,{variant:"success",children:"Pareto"})})]},P.config_name))})]})})]}),p.status==="completed"&&C.length>0&&a.jsxs(me,{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:C.map(P=>a.jsx("button",{onClick:()=>u(o===P?null:P),className:`px-3 py-1 text-sm rounded border transition-colors ${o===P?"bg-[var(--accent)] text-white border-[var(--accent)]":"border-[var(--border)] hover:border-[var(--accent-dim)]"}`,children:P},P))}),o&&b.get(o)&&a.jsx(qx,{runs:b.get(o).map(P=>({id:P.id,config_name:P.config_name,tokens_input:0,tokens_output:0,tokens_total:P.tokens_total,duration_seconds:P.duration_seconds,score:P.score,passed:P.passed,is_pareto:P.is_pareto}))})]}),a.jsxs(me,{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(fp,{size:18}):a.jsx(Ss,{size:18}),"Runs (",v.length,"/",p.total_experiments,")"]}),v.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:v.length===0?a.jsx("div",{className:"text-center py-8 text-[var(--text-secondary)]",children:i?"Runs will appear here after the job completes. See progress above for live status.":"No runs yet. Start the job to see results."}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:v.map(P=>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/${P.id}`),children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:`text-lg font-bold ${P.passed?"text-green-400":"text-red-400"}`,children:[(P.score*100).toFixed(0),"%"]}),P.is_pareto&&a.jsx(q,{variant:"success",children:"Pareto"})]}),a.jsx("div",{className:"text-sm font-medium truncate",title:P.config_name,children:P.config_name.replace(/^baseline_/,"")}),a.jsx("div",{className:"text-xs text-[var(--text-secondary)] truncate",children:P.task_name}),a.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-[var(--text-secondary)]",children:[a.jsxs("span",{children:[(P.tokens_total/1e3).toFixed(1),"K tokens"]}),a.jsxs("span",{children:[P.duration_seconds.toFixed(1),"s"]})]})]},P.id))})})]})]})}function Yx(e){const t=[];if(Array.isArray(e.spans))for(const n of e.spans)typeof n=="object"&&n!==null&&t.push(n);else if(e.span_id)t.push(e);else for(const n in e){const r=e[n];if(typeof r=="object"&&r!==null){if("span_id"in r)t.push(r);else if(Array.isArray(r))for(const s of r)typeof s=="object"&&s!==null&&"span_id"in s&&t.push(s)}}return t}function Xx(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 Zx(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 e0(e){return e>=1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(0)}ms`}function jp({node:e,depth:t=0}){var h,d;const[n,r]=k.useState(t<2),[s,i]=k.useState(!1),{span:l}=e,o=e.children.length>0,u=(h=l.attributes)==null?void 0:h["gen_ai.usage.input_tokens"],c=(d=l.attributes)==null?void 0:d["gen_ai.usage.output_tokens"],m=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 ${Zx(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:e0(l.duration_ms)}),m&&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(jp,{node:x,depth:t+1},x.span.span_id||S))})]})}function t0({trace:e}){const[t,n]=k.useState("tree"),r=k.useMemo(()=>Yx(e),[e]),s=k.useMemo(()=>Xx(r),[r]);return Object.keys(e).length===0?null:a.jsxs(me,{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(q,{variant:"default",children:[r.length," spans"]}),a.jsx("span",{children:"•"}),a.jsx("span",{children:"Click to expand details"})]}),s.map((i,l)=>a.jsx(jp,{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 pd(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function md({input:e,output:t,maxValue:n,height:r=24,showLabels:s=!0}){const i=e+t;if(i===0)return a.jsx("div",{className:"flex items-center gap-2 w-full",children:a.jsx("div",{className:"rounded bg-[var(--bg-primary)] flex-1",style:{height:`${r}px`}})});const l=n>0?i/n*100:100;return a.jsxs("div",{className:"flex items-center gap-3 w-full",children:[a.jsx("div",{className:"relative rounded overflow-hidden bg-[var(--bg-primary)] flex-1",style:{height:`${r}px`},children:a.jsxs("div",{className:"h-full flex transition-all duration-300",style:{width:`${l}%`},children:[a.jsx("div",{className:`h-full ${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:["↑",pd(e)]}),a.jsx("span",{children:"/"}),a.jsxs("span",{className:cn.outputText,children:["↓",pd(t)]})]})]})}function oa({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 n0({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(m=>(u+=m.input,c+=m.output,{input:u,output:c,total:u+c}))},[r]),o=l?Math.max(...l.map(u=>u.total)):n;return a.jsxs(me,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-4",children:"Token Usage"}),a.jsx("div",{className:"mb-4",children:a.jsx(md,{input:e,output:t,maxValue:n,height:32})}),a.jsxs("div",{className:"flex items-center gap-6 text-xs mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded ${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(oa,{label:"Input Tokens",value:e.toLocaleString(),color:"input"}),a.jsx(oa,{label:"Output Tokens",value:t.toLocaleString(),color:"output"}),a.jsx(oa,{label:"Total Tokens",value:n.toLocaleString()})]}),l&&l.length>1&&a.jsxs("div",{className:"border-t border-[var(--border)] pt-4",children:[a.jsxs("h4",{className:"text-sm font-medium mb-3 text-[var(--text-secondary)]",children:["Token Accumulation (",r.length," turns)"]}),a.jsx("div",{className:"space-y-2",children:r.map((u,c)=>a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--bg-primary)] border border-[var(--border)] flex items-center justify-center text-xs font-medium",children:c+1}),a.jsx("div",{className:"flex-1",children:a.jsx(md,{input:l[c].input,output:l[c].output,maxValue:o,height:16})})]},c))})]}),a.jsx("div",{className:"mt-4 text-xs text-[var(--text-secondary)] border-t border-[var(--border)] pt-3",children:"Token usage affects API cost. Input tokens are typically cheaper than output tokens."})]})}function r0(){const{runId:e}=ap(),t=Jr(),{data:n,isLoading:r}=Mt({queryKey:["runs",e],queryFn:()=>jo.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(q,{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(n0,{tokensInput:n.tokens_input,tokensOutput:n.tokens_output,tokensTotal:n.tokens_total}),a.jsxs(me,{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(q,{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(me,{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(me,{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(t0,{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(me,{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 s0(){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 m=async d=>{d.preventDefault(),!(!l||!u)&&await r(l,u)},h=()=>{s()};return a.jsx("div",{className:"min-h-screen bg-[var(--bg-primary)] flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-md",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:"Flow"}),a.jsx("p",{className:"text-[var(--text-secondary)]",children:"Sign in to access the optimization dashboard"})]}),a.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] p-6 space-y-6",children:[n&&a.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[var(--error)]/10 border border-[var(--error)]/20 text-[var(--error)]",children:[a.jsx(Qy,{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:m,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(pp,{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:d=>o(d.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:d=>c(d.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:h,variant:"secondary",className:"w-full justify-center",icon:Hy,children:"Continue with GitHub"})]})]}),a.jsx("p",{className:"text-center mt-6 text-xs text-[var(--text-tertiary)]",children:"Protected by authentication"})]})})}function i0({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(s0,{}):a.jsx(a.Fragment,{children:e})}function l0(){return a.jsx(Ly,{children:a.jsx(i0,{children:a.jsx(Cy,{children:a.jsxs(Wt,{path:"/",element:a.jsx(Ix,{}),children:[a.jsx(Wt,{index:!0,element:a.jsx(hd,{})}),a.jsx(Wt,{path:"agents",element:a.jsx(hd,{})}),a.jsx(Wt,{path:"tasks",element:a.jsx(Qx,{})}),a.jsx(Wt,{path:"jobs",element:a.jsx(Hx,{})}),a.jsx(Wt,{path:"jobs/:jobId",element:a.jsx(Jx,{})}),a.jsx(Wt,{path:"runs/:runId",element:a.jsx(r0,{})})]})})})})}const vd=localStorage.getItem("flow-theme");if(vd)try{const{state:e}=JSON.parse(vd);e!=null&&e.theme&&document.documentElement.setAttribute("data-theme",e.theme)}catch{}const a0=new wg({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!1}}});ua.createRoot(document.getElementById("root")).render(a.jsx(Po.StrictMode,{children:a.jsx(Sg,{client:a0,children:a.jsx(l0,{})})}));