diff --git "a/src/flow/ui/ui/assets/index-AqV2bzyn.js" "b/src/flow/ui/ui/assets/index-AqV2bzyn.js" new file mode 100644--- /dev/null +++ "b/src/flow/ui/ui/assets/index-AqV2bzyn.js" @@ -0,0 +1,179 @@ +var Tu=e=>{throw TypeError(e)};var Tl=(e,t,n)=>t.has(e)||Tu("Cannot "+n);var y=(e,t,n)=>(Tl(e,t,"read from private field"),n?n.call(e):t.get(e)),I=(e,t,n)=>t.has(e)?Tu("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),T=(e,t,n,r)=>(Tl(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),z=(e,t,n)=>(Tl(e,t,"access private method"),n);var Xs=(e,t,n,r)=>({set _(s){T(e,t,s,n)},get _(){return y(e,t,r)}});function Sp(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function _d(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pd={exports:{}},ll={},bd={exports:{}},D={};/** + * @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 Bs=Symbol.for("react.element"),kp=Symbol.for("react.portal"),jp=Symbol.for("react.fragment"),Np=Symbol.for("react.strict_mode"),Cp=Symbol.for("react.profiler"),Ep=Symbol.for("react.provider"),_p=Symbol.for("react.context"),Pp=Symbol.for("react.forward_ref"),bp=Symbol.for("react.suspense"),Tp=Symbol.for("react.memo"),Op=Symbol.for("react.lazy"),Ou=Symbol.iterator;function Rp(e){return e===null||typeof e!="object"?null:(e=Ou&&e[Ou]||e["@@iterator"],typeof e=="function"?e:null)}var Td={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Od=Object.assign,Rd={};function Ar(e,t,n){this.props=e,this.context=t,this.refs=Rd,this.updater=n||Td}Ar.prototype.isReactComponent={};Ar.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")};Ar.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ld(){}Ld.prototype=Ar.prototype;function ko(e,t,n){this.props=e,this.context=t,this.refs=Rd,this.updater=n||Td}var jo=ko.prototype=new Ld;jo.constructor=ko;Od(jo,Ar.prototype);jo.isPureReactComponent=!0;var Ru=Array.isArray,Id=Object.prototype.hasOwnProperty,No={current:null},Md={key:!0,ref:!0,__self:!0,__source:!0};function zd(e,t,n){var r,s={},i=null,l=null;if(t!=null)for(r in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(i=""+t.key),t)Id.call(t,r)&&!Md.hasOwnProperty(r)&&(s[r]=t[r]);var o=arguments.length-2;if(o===1)s.children=n;else if(1>>1,ue=L[ne];if(0>>1;nes(bl,F))Sns(Ys,bl)?(L[ne]=Ys,L[Sn]=F,ne=Sn):(L[ne]=bl,L[wn]=F,ne=wn);else if(Sns(Ys,F))L[ne]=Ys,L[Sn]=F,ne=Sn;else break e}}return M}function s(L,M){var F=L.sortIndex-M.sortIndex;return F!==0?F:L.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,o=l.now();e.unstable_now=function(){return l.now()-o}}var u=[],c=[],p=1,h=null,f=3,w=!1,S=!1,g=!1,k=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(L){for(var M=n(c);M!==null;){if(M.callback===null)r(c);else if(M.startTime<=L)r(c),M.sortIndex=M.expirationTime,t(u,M);else break;M=n(c)}}function x(L){if(g=!1,v(L),!S)if(n(u)!==null)S=!0,_l(C);else{var M=n(c);M!==null&&Pl(x,M.startTime-L)}}function C(L,M){S=!1,g&&(g=!1,m(j),j=-1),w=!0;var F=f;try{for(v(M),h=n(u);h!==null&&(!(h.expirationTime>M)||L&&!A());){var ne=h.callback;if(typeof ne=="function"){h.callback=null,f=h.priorityLevel;var ue=ne(h.expirationTime<=M);M=e.unstable_now(),typeof ue=="function"?h.callback=ue:h===n(u)&&r(u),v(M)}else r(u);h=n(u)}if(h!==null)var Gs=!0;else{var wn=n(c);wn!==null&&Pl(x,wn.startTime-M),Gs=!1}return Gs}finally{h=null,f=F,w=!1}}var E=!1,b=null,j=-1,R=5,_=-1;function A(){return!(e.unstable_now()-_L||125ne?(L.sortIndex=F,t(c,L),n(u)===null&&L===n(c)&&(g?(m(j),j=-1):g=!0,Pl(x,F-ne))):(L.sortIndex=ue,t(u,L),S||w||(S=!0,_l(C))),L},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(L){var M=f;return function(){var F=f;f=M;try{return L.apply(this,arguments)}finally{f=F}}}})($d);Ud.exports=$d;var Hp=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 Vp=N,Ue=Hp;function P(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"),oa=Object.prototype.hasOwnProperty,Wp=/^[: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]*$/,Iu={},Mu={};function Kp(e){return oa.call(Mu,e)?!0:oa.call(Iu,e)?!1:Wp.test(e)?Mu[e]=!0:(Iu[e]=!0,!1)}function qp(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Jp(e,t,n,r){if(t===null||typeof t>"u"||qp(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 be(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 ve={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ve[e]=new be(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ve[t]=new be(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ve[e]=new be(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ve[e]=new be(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){ve[e]=new be(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ve[e]=new be(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ve[e]=new be(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ve[e]=new be(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ve[e]=new be(e,5,!1,e.toLowerCase(),null,!1,!1)});var _o=/[\-:]([a-z])/g;function Po(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(_o,Po);ve[t]=new be(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(_o,Po);ve[t]=new be(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(_o,Po);ve[t]=new be(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ve[e]=new be(e,1,!1,e.toLowerCase(),null,!1,!1)});ve.xlinkHref=new be("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ve[e]=new be(e,1,!1,e.toLowerCase(),null,!0,!0)});function bo(e,t,n,r){var s=ve.hasOwnProperty(t)?ve[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{Ll=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ts(e):""}function Gp(e){switch(e.tag){case 5:return ts(e.type);case 16:return ts("Lazy");case 13:return ts("Suspense");case 19:return ts("SuspenseList");case 0:case 2:case 15:return e=Il(e.type,!1),e;case 11:return e=Il(e.type.render,!1),e;case 1:return e=Il(e.type,!0),e;default:return""}}function fa(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 Zn:return"Fragment";case Xn:return"Portal";case ua:return"Profiler";case To:return"StrictMode";case ca:return"Suspense";case da:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Hd:return(e.displayName||"Context")+".Consumer";case Bd:return(e._context.displayName||"Context")+".Provider";case Oo:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ro:return t=e.displayName||null,t!==null?t:fa(e.type)||"Memo";case At:t=e._payload,e=e._init;try{return fa(e(t))}catch{}}return null}function Yp(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 fa(t);case 8:return t===To?"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 hn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Xp(e){var t=Wd(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 ti(e){e._valueTracker||(e._valueTracker=Xp(e))}function Kd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Wd(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Oi(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 ha(e,t){var n=t.checked;return X({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Fu(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=hn(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 qd(e,t){t=t.checked,t!=null&&bo(e,"checked",t,!1)}function pa(e,t){qd(e,t);var n=hn(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")?ma(e,t.type,n):t.hasOwnProperty("defaultValue")&&ma(e,t.type,hn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Du(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 ma(e,t,n){(t!=="number"||Oi(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ns=Array.isArray;function dr(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=ni.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function gs(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ls={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},Zp=["Webkit","ms","Moz","O"];Object.keys(ls).forEach(function(e){Zp.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ls[t]=ls[e]})});function Xd(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ls.hasOwnProperty(e)&&ls[e]?(""+t).trim():t+"px"}function Zd(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Xd(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var em=X({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 ya(e,t){if(t){if(em[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(P(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(P(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(P(61))}if(t.style!=null&&typeof t.style!="object")throw Error(P(62))}}function xa(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 wa=null;function Lo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Sa=null,fr=null,hr=null;function $u(e){if(e=Ws(e)){if(typeof Sa!="function")throw Error(P(280));var t=e.stateNode;t&&(t=dl(t),Sa(e.stateNode,e.type,t))}}function ef(e){fr?hr?hr.push(e):hr=[e]:fr=e}function tf(){if(fr){var e=fr,t=hr;if(hr=fr=null,$u(e),t)for(e=0;e>>=0,e===0?32:31-(dm(e)/fm|0)|0}var ri=64,si=4194304;function rs(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 Mi(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=rs(o):(i&=l,i!==0&&(r=rs(i)))}else l=n&~s,l!==0?r=rs(l):i!==0&&(r=rs(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 Hs(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-st(t),e[t]=n}function vm(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=os),Gu=" ",Yu=!1;function kf(e,t){switch(e){case"keyup":return Hm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var er=!1;function Wm(e,t){switch(e){case"compositionend":return jf(t);case"keypress":return t.which!==32?null:(Yu=!0,Gu);case"textInput":return e=t.data,e===Gu&&Yu?null:e;default:return null}}function Km(e,t){if(er)return e==="compositionend"||!$o&&kf(e,t)?(e=wf(),Si=Do=Xt=null,er=!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=tc(n)}}function _f(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_f(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pf(){for(var e=window,t=Oi();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Oi(e.document)}return t}function Qo(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 nv(e){var t=Pf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&_f(n.ownerDocument.documentElement,n)){if(r!==null&&Qo(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=nc(n,i);var l=nc(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,tr=null,_a=null,cs=null,Pa=!1;function rc(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pa||tr==null||tr!==Oi(r)||(r=tr,"selectionStart"in r&&Qo(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}),cs&&js(cs,r)||(cs=r,r=Di(_a,"onSelect"),0sr||(e.current=Ia[sr],Ia[sr]=null,sr--)}function W(e,t){sr++,Ia[sr]=e.current,e.current=t}var pn={},je=vn(pn),Ie=vn(!1),An=pn;function Or(e,t){var n=e.type.contextTypes;if(!n)return pn;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 Me(e){return e=e.childContextTypes,e!=null}function Ui(){q(Ie),q(je)}function cc(e,t,n){if(je.current!==pn)throw Error(P(168));W(je,t),W(Ie,n)}function Ff(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(P(108,Yp(e)||"Unknown",s));return X({},n,r)}function $i(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pn,An=je.current,W(je,e),W(Ie,Ie.current),!0}function dc(e,t,n){var r=e.stateNode;if(!r)throw Error(P(169));n?(e=Ff(e,t,An),r.__reactInternalMemoizedMergedChildContext=e,q(Ie),q(je),W(je,e)):q(Ie),W(Ie,n)}var xt=null,fl=!1,ql=!1;function Df(e){xt===null?xt=[e]:xt.push(e)}function pv(e){fl=!0,Df(e)}function gn(){if(!ql&&xt!==null){ql=!0;var e=0,t=H;try{var n=xt;for(H=1;e>=l,s-=l,Nt=1<<32-st(t)+s|n<j?(R=b,b=null):R=b.sibling;var _=f(m,b,v[j],x);if(_===null){b===null&&(b=R);break}e&&b&&_.alternate===null&&t(m,b),d=i(_,d,j),E===null?C=_:E.sibling=_,E=_,b=R}if(j===v.length)return n(m,b),J&&kn(m,j),C;if(b===null){for(;jj?(R=b,b=null):R=b.sibling;var A=f(m,b,_.value,x);if(A===null){b===null&&(b=R);break}e&&b&&A.alternate===null&&t(m,b),d=i(A,d,j),E===null?C=A:E.sibling=A,E=A,b=R}if(_.done)return n(m,b),J&&kn(m,j),C;if(b===null){for(;!_.done;j++,_=v.next())_=h(m,_.value,x),_!==null&&(d=i(_,d,j),E===null?C=_:E.sibling=_,E=_);return J&&kn(m,j),C}for(b=r(m,b);!_.done;j++,_=v.next())_=w(b,m,j,_.value,x),_!==null&&(e&&_.alternate!==null&&b.delete(_.key===null?j:_.key),d=i(_,d,j),E===null?C=_:E.sibling=_,E=_);return e&&b.forEach(function(he){return t(m,he)}),J&&kn(m,j),C}function k(m,d,v,x){if(typeof v=="object"&&v!==null&&v.type===Zn&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case ei:e:{for(var C=v.key,E=d;E!==null;){if(E.key===C){if(C=v.type,C===Zn){if(E.tag===7){n(m,E.sibling),d=s(E,v.props.children),d.return=m,m=d;break e}}else if(E.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===At&&pc(C)===E.type){n(m,E.sibling),d=s(E,v.props),d.ref=Yr(m,E,v),d.return=m,m=d;break e}n(m,E);break}else t(m,E);E=E.sibling}v.type===Zn?(d=Dn(v.props.children,m.mode,x,v.key),d.return=m,m=d):(x=bi(v.type,v.key,v.props,null,m.mode,x),x.ref=Yr(m,d,v),x.return=m,m=x)}return l(m);case Xn:e:{for(E=v.key;d!==null;){if(d.key===E)if(d.tag===4&&d.stateNode.containerInfo===v.containerInfo&&d.stateNode.implementation===v.implementation){n(m,d.sibling),d=s(d,v.children||[]),d.return=m,m=d;break e}else{n(m,d);break}else t(m,d);d=d.sibling}d=na(v,m.mode,x),d.return=m,m=d}return l(m);case At:return E=v._init,k(m,d,E(v._payload),x)}if(ns(v))return S(m,d,v,x);if(Wr(v))return g(m,d,v,x);di(m,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,d!==null&&d.tag===6?(n(m,d.sibling),d=s(d,v),d.return=m,m=d):(n(m,d),d=ta(v,m.mode,x),d.return=m,m=d),l(m)):n(m,d)}return k}var Lr=Qf(!0),Bf=Qf(!1),Hi=vn(null),Vi=null,ar=null,Wo=null;function Ko(){Wo=ar=Vi=null}function qo(e){var t=Hi.current;q(Hi),e._currentValue=t}function Fa(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 mr(e,t){Vi=e,Wo=ar=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Le=!0),e.firstContext=null)}function Ge(e){var t=e._currentValue;if(Wo!==e)if(e={context:e,memoizedValue:t,next:null},ar===null){if(Vi===null)throw Error(P(308));ar=e,Vi.dependencies={lanes:0,firstContext:e}}else ar=ar.next=e;return t}var Cn=null;function Jo(e){Cn===null?Cn=[e]:Cn.push(e)}function Hf(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Jo(t)):(n.next=s.next,s.next=n),t.interleaved=n,Rt(e,r)}function Rt(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 Ut=!1;function Go(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vf(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Et(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function an(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Rt(e,n)}return s=r.interleaved,s===null?(t.next=t,Jo(r)):(t.next=s.next,s.next=t),r.interleaved=t,Rt(e,n)}function ji(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,Mo(e,n)}}function mc(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 Wi(e,t,n,r){var s=e.updateQueue;Ut=!1;var i=s.firstBaseUpdate,l=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var u=o,c=u.next;u.next=null,l===null?i=c:l.next=c,l=u;var p=e.alternate;p!==null&&(p=p.updateQueue,o=p.lastBaseUpdate,o!==l&&(o===null?p.firstBaseUpdate=c:o.next=c,p.lastBaseUpdate=u))}if(i!==null){var h=s.baseState;l=0,p=c=u=null,o=i;do{var f=o.lane,w=o.eventTime;if((r&f)===f){p!==null&&(p=p.next={eventTime:w,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var S=e,g=o;switch(f=t,w=n,g.tag){case 1:if(S=g.payload,typeof S=="function"){h=S.call(w,h,f);break e}h=S;break e;case 3:S.flags=S.flags&-65537|128;case 0:if(S=g.payload,f=typeof S=="function"?S.call(w,h,f):S,f==null)break e;h=X({},h,f);break e;case 2:Ut=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[o]:f.push(o))}else w={eventTime:w,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},p===null?(c=p=w,u=h):p=p.next=w,l|=f;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;f=o,o=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(p===null&&(u=h),s.baseState=u,s.firstBaseUpdate=c,s.lastBaseUpdate=p,t=s.shared.interleaved,t!==null){s=t;do l|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Qn|=l,e.lanes=l,e.memoizedState=h}}function vc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Gl.transition;Gl.transition={};try{e(!1),t()}finally{H=n,Gl.transition=r}}function oh(){return Ye().memoizedState}function yv(e,t,n){var r=un(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},uh(e))ch(t,n);else if(n=Hf(e,t,n,r),n!==null){var s=_e();it(n,e,r,s),dh(n,t,r)}}function xv(e,t,n){var r=un(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(uh(e))ch(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,at(o,l)){var u=t.interleaved;u===null?(s.next=s,Jo(t)):(s.next=u.next,u.next=s),t.interleaved=s;return}}catch{}finally{}n=Hf(e,t,s,r),n!==null&&(s=_e(),it(n,e,r,s),dh(n,t,r))}}function uh(e){var t=e.alternate;return e===Y||t!==null&&t===Y}function ch(e,t){ds=qi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function dh(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Mo(e,n)}}var Ji={readContext:Ge,useCallback:ye,useContext:ye,useEffect:ye,useImperativeHandle:ye,useInsertionEffect:ye,useLayoutEffect:ye,useMemo:ye,useReducer:ye,useRef:ye,useState:ye,useDebugValue:ye,useDeferredValue:ye,useTransition:ye,useMutableSource:ye,useSyncExternalStore:ye,useId:ye,unstable_isNewReconciler:!1},wv={readContext:Ge,useCallback:function(e,t){return ct().memoizedState=[e,t===void 0?null:t],e},useContext:Ge,useEffect:yc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ci(4194308,4,rh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ci(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ci(4,2,e,t)},useMemo:function(e,t){var n=ct();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ct();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=yv.bind(null,Y,e),[r.memoizedState,e]},useRef:function(e){var t=ct();return e={current:e},t.memoizedState=e},useState:gc,useDebugValue:su,useDeferredValue:function(e){return ct().memoizedState=e},useTransition:function(){var e=gc(!1),t=e[0];return e=gv.bind(null,e[1]),ct().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Y,s=ct();if(J){if(n===void 0)throw Error(P(407));n=n()}else{if(n=t(),fe===null)throw Error(P(349));$n&30||Jf(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,yc(Yf.bind(null,r,i,e),[e]),r.flags|=2048,Os(9,Gf.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=ct(),t=fe.identifierPrefix;if(J){var n=Ct,r=Nt;n=(r&~(1<<32-st(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=bs++,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[pt]=t,e[Es]=r,Sh(e,t,!1,!1),t.stateNode=e;e:{switch(l=xa(n,r),n){case"dialog":K("cancel",e),K("close",e),s=r;break;case"iframe":case"object":case"embed":K("load",e),s=r;break;case"video":case"audio":for(s=0;szr&&(t.flags|=128,r=!0,Xr(i,!1),t.lanes=4194304)}else{if(!r)if(e=Ki(l),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Xr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!l.alternate&&!J)return xe(t),null}else 2*re()-i.renderingStartTime>zr&&n!==1073741824&&(t.flags|=128,r=!0,Xr(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=re(),t.sibling=null,n=G.current,W(G,r?n&1|2:n&1),t):(xe(t),null);case 22:case 23:return cu(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Fe&1073741824&&(xe(t),t.subtreeFlags&6&&(t.flags|=8192)):xe(t),null;case 24:return null;case 25:return null}throw Error(P(156,t.tag))}function Pv(e,t){switch(Ho(t),t.tag){case 1:return Me(t.type)&&Ui(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ir(),q(Ie),q(je),Zo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Xo(t),null;case 13:if(q(G),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(P(340));Rr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return q(G),null;case 4:return Ir(),null;case 10:return qo(t.type._context),null;case 22:case 23:return cu(),null;case 24:return null;default:return null}}var hi=!1,Se=!1,bv=typeof WeakSet=="function"?WeakSet:Set,O=null;function or(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ee(e,t,r)}else n.current=null}function Wa(e,t,n){try{n()}catch(r){ee(e,t,r)}}var bc=!1;function Tv(e,t){if(ba=zi,e=Pf(),Qo(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var l=0,o=-1,u=-1,c=0,p=0,h=e,f=null;t:for(;;){for(var w;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),(w=h.firstChild)!==null;)f=h,h=w;for(;;){if(h===e)break t;if(f===n&&++c===s&&(o=l),f===i&&++p===r&&(u=l),(w=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=w}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ta={focusedElem:e,selectionRange:n},zi=!1,O=t;O!==null;)if(t=O,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,O=e;else for(;O!==null;){t=O;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 g=S.memoizedProps,k=S.memoizedState,m=t.stateNode,d=m.getSnapshotBeforeUpdate(t.elementType===t.type?g:Ze(t.type,g),k);m.__reactInternalSnapshotBeforeUpdate=d}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(P(163))}}catch(x){ee(t,t.return,x)}if(e=t.sibling,e!==null){e.return=t.return,O=e;break}O=t.return}return S=bc,bc=!1,S}function fs(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&&Wa(t,n,i)}s=s.next}while(s!==r)}}function ml(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 Ka(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 Nh(e){var t=e.alternate;t!==null&&(e.alternate=null,Nh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[pt],delete t[Es],delete t[La],delete t[fv],delete t[hv])),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 Ch(e){return e.tag===5||e.tag===3||e.tag===4}function Tc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ch(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 qa(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=Ai));else if(r!==4&&(e=e.child,e!==null))for(qa(e,t,n),e=e.sibling;e!==null;)qa(e,t,n),e=e.sibling}function Ja(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ja(e,t,n),e=e.sibling;e!==null;)Ja(e,t,n),e=e.sibling}var pe=null,nt=!1;function zt(e,t,n){for(n=n.child;n!==null;)Eh(e,t,n),n=n.sibling}function Eh(e,t,n){if(mt&&typeof mt.onCommitFiberUnmount=="function")try{mt.onCommitFiberUnmount(al,n)}catch{}switch(n.tag){case 5:Se||or(n,t);case 6:var r=pe,s=nt;pe=null,zt(e,t,n),pe=r,nt=s,pe!==null&&(nt?(e=pe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):pe.removeChild(n.stateNode));break;case 18:pe!==null&&(nt?(e=pe,n=n.stateNode,e.nodeType===8?Kl(e.parentNode,n):e.nodeType===1&&Kl(e,n),Ss(e)):Kl(pe,n.stateNode));break;case 4:r=pe,s=nt,pe=n.stateNode.containerInfo,nt=!0,zt(e,t,n),pe=r,nt=s;break;case 0:case 11:case 14:case 15:if(!Se&&(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)&&Wa(n,t,l),s=s.next}while(s!==r)}zt(e,t,n);break;case 1:if(!Se&&(or(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){ee(n,t,o)}zt(e,t,n);break;case 21:zt(e,t,n);break;case 22:n.mode&1?(Se=(r=Se)||n.memoizedState!==null,zt(e,t,n),Se=r):zt(e,t,n);break;default:zt(e,t,n)}}function Oc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new bv),t.forEach(function(r){var s=Av.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Xe(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=l),r&=~i}if(r=s,r=re()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Rv(r/1960))-r,10e?16:e,Zt===null)var r=!1;else{if(e=Zt,Zt=null,Xi=0,$&6)throw Error(P(331));var s=$;for($|=4,O=e.current;O!==null;){var i=O,l=i.child;if(O.flags&16){var o=i.deletions;if(o!==null){for(var u=0;ure()-ou?Fn(e,0):au|=n),ze(e,t)}function Ih(e,t){t===0&&(e.mode&1?(t=si,si<<=1,!(si&130023424)&&(si=4194304)):t=1);var n=_e();e=Rt(e,t),e!==null&&(Hs(e,t,n),ze(e,n))}function Dv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ih(e,n)}function Av(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(P(314))}r!==null&&r.delete(t),Ih(e,n)}var Mh;Mh=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ie.current)Le=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Le=!1,Ev(e,t,n);Le=!!(e.flags&131072)}else Le=!1,J&&t.flags&1048576&&Af(t,Bi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ei(e,t),e=t.pendingProps;var s=Or(t,je.current);mr(t,n),s=tu(null,t,r,e,s,n);var i=nu();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,Me(r)?(i=!0,$i(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Go(t),s.updater=pl,t.stateNode=s,s._reactInternals=t,Aa(t,r,e,n),t=Qa(null,t,r,!0,i,n)):(t.tag=0,J&&i&&Bo(t),Ce(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ei(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=$v(r),e=Ze(r,e),s){case 0:t=$a(null,t,r,e,n);break e;case 1:t=Ec(null,t,r,e,n);break e;case 11:t=Nc(null,t,r,e,n);break e;case 14:t=Cc(null,t,r,Ze(r.type,e),n);break e}throw Error(P(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ze(r,s),$a(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ze(r,s),Ec(e,t,r,s,n);case 3:e:{if(yh(t),e===null)throw Error(P(387));r=t.pendingProps,i=t.memoizedState,s=i.element,Vf(e,t),Wi(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=Mr(Error(P(423)),t),t=_c(e,t,r,n,s);break e}else if(r!==s){s=Mr(Error(P(424)),t),t=_c(e,t,r,n,s);break e}else for(De=ln(t.stateNode.containerInfo.firstChild),Ae=t,J=!0,rt=null,n=Bf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Rr(),r===s){t=Lt(e,t,n);break e}Ce(e,t,r,n)}t=t.child}return t;case 5:return Wf(t),e===null&&za(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,l=s.children,Oa(r,s)?l=null:i!==null&&Oa(r,i)&&(t.flags|=32),gh(e,t),Ce(e,t,l,n),t.child;case 6:return e===null&&za(t),null;case 13:return xh(e,t,n);case 4:return Yo(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Lr(t,null,r,n):Ce(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ze(r,s),Nc(e,t,r,s,n);case 7:return Ce(e,t,t.pendingProps,n),t.child;case 8:return Ce(e,t,t.pendingProps.children,n),t.child;case 12:return Ce(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,W(Hi,r._currentValue),r._currentValue=l,i!==null)if(at(i.value,l)){if(i.children===s.children&&!Ie.current){t=Lt(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=Et(-1,n&-n),u.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var p=c.pending;p===null?u.next=u:(u.next=p.next,p.next=u),c.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Fa(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(P(341));l.lanes|=n,o=l.alternate,o!==null&&(o.lanes|=n),Fa(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}Ce(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,mr(t,n),s=Ge(s),r=r(s),t.flags|=1,Ce(e,t,r,n),t.child;case 14:return r=t.type,s=Ze(r,t.pendingProps),s=Ze(r.type,s),Cc(e,t,r,s,n);case 15:return mh(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ze(r,s),Ei(e,t),t.tag=1,Me(r)?(e=!0,$i(t)):e=!1,mr(t,n),fh(t,r,s),Aa(t,r,s,n),Qa(null,t,r,!0,e,n);case 19:return wh(e,t,n);case 22:return vh(e,t,n)}throw Error(P(156,t.tag))};function zh(e,t){return uf(e,t)}function Uv(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qe(e,t,n,r){return new Uv(e,t,n,r)}function fu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function $v(e){if(typeof e=="function")return fu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Oo)return 11;if(e===Ro)return 14}return 2}function cn(e,t){var n=e.alternate;return n===null?(n=qe(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 bi(e,t,n,r,s,i){var l=2;if(r=e,typeof e=="function")fu(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case Zn:return Dn(n.children,s,i,t);case To:l=8,s|=8;break;case ua:return e=qe(12,n,t,s|2),e.elementType=ua,e.lanes=i,e;case ca:return e=qe(13,n,t,s),e.elementType=ca,e.lanes=i,e;case da:return e=qe(19,n,t,s),e.elementType=da,e.lanes=i,e;case Vd:return gl(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Bd:l=10;break e;case Hd:l=9;break e;case Oo:l=11;break e;case Ro:l=14;break e;case At:l=16,r=null;break e}throw Error(P(130,e==null?e:typeof e,""))}return t=qe(l,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Dn(e,t,n,r){return e=qe(7,e,r,t),e.lanes=n,e}function gl(e,t,n,r){return e=qe(22,e,r,t),e.elementType=Vd,e.lanes=n,e.stateNode={isHidden:!1},e}function ta(e,t,n){return e=qe(6,e,null,t),e.lanes=n,e}function na(e,t,n){return t=qe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Qv(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=zl(0),this.expirationTimes=zl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zl(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function hu(e,t,n,r,s,i,l,o,u){return e=new Qv(e,t,n,o,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=qe(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Go(i),e}function Bv(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=$e;var qv=Ad.exports,Ac=qv;aa.createRoot=Ac.createRoot,aa.hydrateRoot=Ac.hydrateRoot;var Qr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Jv={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Bt,So,vd,Gv=(vd=class{constructor(){I(this,Bt,Jv);I(this,So,!1)}setTimeoutProvider(e){T(this,Bt,e)}setTimeout(e,t){return y(this,Bt).setTimeout(e,t)}clearTimeout(e){y(this,Bt).clearTimeout(e)}setInterval(e,t){return y(this,Bt).setInterval(e,t)}clearInterval(e){y(this,Bt).clearInterval(e)}},Bt=new WeakMap,So=new WeakMap,vd),_n=new Gv;function Yv(e){setTimeout(e,0)}var Hn=typeof window>"u"||"Deno"in globalThis;function Ee(){}function Xv(e,t){return typeof e=="function"?e(t):e}function eo(e){return typeof e=="number"&&e>=0&&e!==1/0}function $h(e,t){return Math.max(e+(t||0)-Date.now(),0)}function dn(e,t){return typeof e=="function"?e(t):e}function He(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!==gu(l,t.options))return!1}else if(!Ls(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 $c(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Vn(t.options.mutationKey)!==Vn(i))return!1}else if(!Ls(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function gu(e,t){return((t==null?void 0:t.queryKeyHashFn)||Vn)(e)}function Vn(e){return JSON.stringify(e,(t,n)=>to(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Ls(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ls(e[n],t[n])):!1}var Zv=Object.prototype.hasOwnProperty;function Qh(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Qc(e)&&Qc(t);if(!r&&!(to(e)&&to(t)))return t;const i=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),o=l.length,u=r?new Array(o):{};let c=0;for(let p=0;p{_n.setTimeout(t,e)})}function no(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Qh(e,t):t}function tg(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function ng(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var yu=Symbol();function Bh(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===yu?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function xu(e,t){return typeof e=="function"?e(...t):!!e}function rg(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 Pn,Ht,yr,gd,sg=(gd=class extends Qr{constructor(){super();I(this,Pn);I(this,Ht);I(this,yr);T(this,yr,t=>{if(!Hn&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){y(this,Ht)||this.setEventListener(y(this,yr))}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Ht))==null||t.call(this),T(this,Ht,void 0))}setEventListener(t){var n;T(this,yr,t),(n=y(this,Ht))==null||n.call(this),T(this,Ht,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){y(this,Pn)!==t&&(T(this,Pn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof y(this,Pn)=="boolean"?y(this,Pn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Pn=new WeakMap,Ht=new WeakMap,yr=new WeakMap,gd),wu=new sg;function ro(){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 ig=Yv;function lg(){let e=[],t=0,n=o=>{o()},r=o=>{o()},s=ig;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 ae=lg(),xr,Vt,wr,yd,ag=(yd=class extends Qr{constructor(){super();I(this,xr,!0);I(this,Vt);I(this,wr);T(this,wr,t=>{if(!Hn&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){y(this,Vt)||this.setEventListener(y(this,wr))}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Vt))==null||t.call(this),T(this,Vt,void 0))}setEventListener(t){var n;T(this,wr,t),(n=y(this,Vt))==null||n.call(this),T(this,Vt,t(this.setOnline.bind(this)))}setOnline(t){y(this,xr)!==t&&(T(this,xr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return y(this,xr)}},xr=new WeakMap,Vt=new WeakMap,wr=new WeakMap,yd),nl=new ag;function og(e){return Math.min(1e3*2**e,3e4)}function Hh(e){return(e??"online")==="online"?nl.isOnline():!0}var so=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Vh(e){let t=!1,n=0,r;const s=ro(),i=()=>s.status!=="pending",l=g=>{var k;if(!i()){const m=new so(g);f(m),(k=e.onCancel)==null||k.call(e,m)}},o=()=>{t=!0},u=()=>{t=!1},c=()=>wu.isFocused()&&(e.networkMode==="always"||nl.isOnline())&&e.canRun(),p=()=>Hh(e.networkMode)&&e.canRun(),h=g=>{i()||(r==null||r(),s.resolve(g))},f=g=>{i()||(r==null||r(),s.reject(g))},w=()=>new Promise(g=>{var k;r=m=>{(i()||c())&&g(m)},(k=e.onPause)==null||k.call(e)}).then(()=>{var g;r=void 0,i()||(g=e.onContinue)==null||g.call(e)}),S=()=>{if(i())return;let g;const k=n===0?e.initialPromise:void 0;try{g=k??e.fn()}catch(m){g=Promise.reject(m)}Promise.resolve(g).then(h).catch(m=>{var E;if(i())return;const d=e.retry??(Hn?0:3),v=e.retryDelay??og,x=typeof v=="function"?v(n,m):v,C=d===!0||typeof d=="number"&&nc()?void 0:w()).then(()=>{t?f(m):S()})})};return{promise:s,status:()=>s.status,cancel:l,continue:()=>(r==null||r(),s),cancelRetry:o,continueRetry:u,canStart:p,start:()=>(p()?S():w().then(S),s)}}var bn,xd,Wh=(xd=class{constructor(){I(this,bn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),eo(this.gcTime)&&T(this,bn,_n.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Hn?1/0:5*60*1e3))}clearGcTimeout(){y(this,bn)&&(_n.clearTimeout(y(this,bn)),T(this,bn,void 0))}},bn=new WeakMap,xd),Tn,Sr,Be,On,ce,Ds,Rn,et,gt,wd,ug=(wd=class extends Wh{constructor(t){super();I(this,et);I(this,Tn);I(this,Sr);I(this,Be);I(this,On);I(this,ce);I(this,Ds);I(this,Rn);T(this,Rn,!1),T(this,Ds,t.defaultOptions),this.setOptions(t.options),this.observers=[],T(this,On,t.client),T(this,Be,y(this,On).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,T(this,Tn,Vc(this.options)),this.state=t.state??y(this,Tn),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=y(this,ce))==null?void 0:t.promise}setOptions(t){if(this.options={...y(this,Ds),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Vc(this.options);n.data!==void 0&&(this.setState(Hc(n.data,n.dataUpdatedAt)),T(this,Tn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&y(this,Be).remove(this)}setData(t,n){const r=no(this.state.data,t,this.options);return z(this,et,gt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){z(this,et,gt).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=y(this,ce))==null?void 0:r.promise;return(s=y(this,ce))==null||s.cancel(t),n?n.then(Ee).catch(Ee):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(y(this,Tn))}isActive(){return this.observers.some(t=>He(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===yu||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>dn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!$h(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=y(this,ce))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=y(this,ce))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),y(this,Be).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(y(this,ce)&&(y(this,Rn)?y(this,ce).cancel({revert:!0}):y(this,ce).cancelRetry()),this.scheduleGc()),y(this,Be).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||z(this,et,gt).call(this,{type:"invalidate"})}async fetch(t,n){var u,c,p,h,f,w,S,g,k,m,d,v;if(this.state.fetchStatus!=="idle"&&((u=y(this,ce))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(y(this,ce))return y(this,ce).continueRetry(),y(this,ce).promise}if(t&&this.setOptions(t),!this.options.queryFn){const x=this.observers.find(C=>C.options.queryFn);x&&this.setOptions(x.options)}const r=new AbortController,s=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(T(this,Rn,!0),r.signal)})},i=()=>{const x=Bh(this.options,n),E=(()=>{const b={client:y(this,On),queryKey:this.queryKey,meta:this.meta};return s(b),b})();return T(this,Rn,!1),this.options.persister?this.options.persister(x,E,this):x(E)},o=(()=>{const x={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:y(this,On),state:this.state,fetchFn:i};return s(x),x})();(c=this.options.behavior)==null||c.onFetch(o,this),T(this,Sr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=o.fetchOptions)==null?void 0:p.meta))&&z(this,et,gt).call(this,{type:"fetch",meta:(h=o.fetchOptions)==null?void 0:h.meta}),T(this,ce,Vh({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:x=>{x instanceof so&&x.revert&&this.setState({...y(this,Sr),fetchStatus:"idle"}),r.abort()},onFail:(x,C)=>{z(this,et,gt).call(this,{type:"failed",failureCount:x,error:C})},onPause:()=>{z(this,et,gt).call(this,{type:"pause"})},onContinue:()=>{z(this,et,gt).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const x=await y(this,ce).start();if(x===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(x),(w=(f=y(this,Be).config).onSuccess)==null||w.call(f,x,this),(g=(S=y(this,Be).config).onSettled)==null||g.call(S,x,this.state.error,this),x}catch(x){if(x instanceof so){if(x.silent)return y(this,ce).promise;if(x.revert){if(this.state.data===void 0)throw x;return this.state.data}}throw z(this,et,gt).call(this,{type:"error",error:x}),(m=(k=y(this,Be).config).onError)==null||m.call(k,x,this),(v=(d=y(this,Be).config).onSettled)==null||v.call(d,this.state.data,x,this),x}finally{this.scheduleGc()}}},Tn=new WeakMap,Sr=new WeakMap,Be=new WeakMap,On=new WeakMap,ce=new WeakMap,Ds=new WeakMap,Rn=new WeakMap,et=new WeakSet,gt=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,...Kh(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...Hc(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return T(this,Sr,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),ae.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),y(this,Be).notify({query:this,type:"updated",action:t})})},wd);function Kh(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 Vc(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 Te,U,As,Ne,Ln,kr,wt,Wt,Us,jr,Nr,In,Mn,Kt,Cr,Q,is,io,lo,ao,oo,uo,co,fo,qh,Sd,cg=(Sd=class extends Qr{constructor(t,n){super();I(this,Q);I(this,Te);I(this,U);I(this,As);I(this,Ne);I(this,Ln);I(this,kr);I(this,wt);I(this,Wt);I(this,Us);I(this,jr);I(this,Nr);I(this,In);I(this,Mn);I(this,Kt);I(this,Cr,new Set);this.options=n,T(this,Te,t),T(this,Wt,null),T(this,wt,ro()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(y(this,U).addObserver(this),Wc(y(this,U),this.options)?z(this,Q,is).call(this):this.updateResult(),z(this,Q,oo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ho(y(this,U),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ho(y(this,U),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,z(this,Q,uo).call(this),z(this,Q,co).call(this),y(this,U).removeObserver(this)}setOptions(t){const n=this.options,r=y(this,U);if(this.options=y(this,Te).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof He(this.options.enabled,y(this,U))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");z(this,Q,fo).call(this),y(this,U).setOptions(this.options),n._defaulted&&!tl(this.options,n)&&y(this,Te).getQueryCache().notify({type:"observerOptionsUpdated",query:y(this,U),observer:this});const s=this.hasListeners();s&&Kc(y(this,U),r,this.options,n)&&z(this,Q,is).call(this),this.updateResult(),s&&(y(this,U)!==r||He(this.options.enabled,y(this,U))!==He(n.enabled,y(this,U))||dn(this.options.staleTime,y(this,U))!==dn(n.staleTime,y(this,U)))&&z(this,Q,io).call(this);const i=z(this,Q,lo).call(this);s&&(y(this,U)!==r||He(this.options.enabled,y(this,U))!==He(n.enabled,y(this,U))||i!==y(this,Kt))&&z(this,Q,ao).call(this,i)}getOptimisticResult(t){const n=y(this,Te).getQueryCache().build(y(this,Te),t),r=this.createResult(n,t);return fg(this,r)&&(T(this,Ne,r),T(this,kr,this.options),T(this,Ln,y(this,U).state)),r}getCurrentResult(){return y(this,Ne)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&y(this,wt).status==="pending"&&y(this,wt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){y(this,Cr).add(t)}getCurrentQuery(){return y(this,U)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=y(this,Te).defaultQueryOptions(t),r=y(this,Te).getQueryCache().build(y(this,Te),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return z(this,Q,is).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),y(this,Ne)))}createResult(t,n){var R;const r=y(this,U),s=this.options,i=y(this,Ne),l=y(this,Ln),o=y(this,kr),c=t!==r?t.state:y(this,As),{state:p}=t;let h={...p},f=!1,w;if(n._optimisticResults){const _=this.hasListeners(),A=!_&&Wc(t,n),he=_&&Kc(t,r,n,s);(A||he)&&(h={...h,...Kh(p.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:S,errorUpdatedAt:g,status:k}=h;w=h.data;let m=!1;if(n.placeholderData!==void 0&&w===void 0&&k==="pending"){let _;i!=null&&i.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(_=i.data,m=!0):_=typeof n.placeholderData=="function"?n.placeholderData((R=y(this,Nr))==null?void 0:R.state.data,y(this,Nr)):n.placeholderData,_!==void 0&&(k="success",w=no(i==null?void 0:i.data,_,n),f=!0)}if(n.select&&w!==void 0&&!m)if(i&&w===(l==null?void 0:l.data)&&n.select===y(this,Us))w=y(this,jr);else try{T(this,Us,n.select),w=n.select(w),w=no(i==null?void 0:i.data,w,n),T(this,jr,w),T(this,Wt,null)}catch(_){T(this,Wt,_)}y(this,Wt)&&(S=y(this,Wt),w=y(this,jr),g=Date.now(),k="error");const d=h.fetchStatus==="fetching",v=k==="pending",x=k==="error",C=v&&d,E=w!==void 0,j={status:k,fetchStatus:h.fetchStatus,isPending:v,isSuccess:k==="success",isError:x,isInitialLoading:C,isLoading:C,data:w,dataUpdatedAt:h.dataUpdatedAt,error:S,errorUpdatedAt:g,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:d,isRefetching:d&&!v,isLoadingError:x&&!E,isPaused:h.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:x&&E,isStale:Su(t,n),refetch:this.refetch,promise:y(this,wt),isEnabled:He(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const _=j.data!==void 0,A=j.status==="error"&&!_,he=Jn=>{A?Jn.reject(j.error):_&&Jn.resolve(j.data)},ot=()=>{const Jn=T(this,wt,j.promise=ro());he(Jn)},xn=y(this,wt);switch(xn.status){case"pending":t.queryHash===r.queryHash&&he(xn);break;case"fulfilled":(A||j.data!==xn.value)&&ot();break;case"rejected":(!A||j.error!==xn.reason)&&ot();break}}return j}updateResult(){const t=y(this,Ne),n=this.createResult(y(this,U),this.options);if(T(this,Ln,y(this,U).state),T(this,kr,this.options),y(this,Ln).data!==void 0&&T(this,Nr,y(this,U)),tl(n,t))return;T(this,Ne,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!y(this,Cr).size)return!0;const l=new Set(i??y(this,Cr));return this.options.throwOnError&&l.add("error"),Object.keys(y(this,Ne)).some(o=>{const u=o;return y(this,Ne)[u]!==t[u]&&l.has(u)})};z(this,Q,qh).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&z(this,Q,oo).call(this)}},Te=new WeakMap,U=new WeakMap,As=new WeakMap,Ne=new WeakMap,Ln=new WeakMap,kr=new WeakMap,wt=new WeakMap,Wt=new WeakMap,Us=new WeakMap,jr=new WeakMap,Nr=new WeakMap,In=new WeakMap,Mn=new WeakMap,Kt=new WeakMap,Cr=new WeakMap,Q=new WeakSet,is=function(t){z(this,Q,fo).call(this);let n=y(this,U).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ee)),n},io=function(){z(this,Q,uo).call(this);const t=dn(this.options.staleTime,y(this,U));if(Hn||y(this,Ne).isStale||!eo(t))return;const r=$h(y(this,Ne).dataUpdatedAt,t)+1;T(this,In,_n.setTimeout(()=>{y(this,Ne).isStale||this.updateResult()},r))},lo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(y(this,U)):this.options.refetchInterval)??!1},ao=function(t){z(this,Q,co).call(this),T(this,Kt,t),!(Hn||He(this.options.enabled,y(this,U))===!1||!eo(y(this,Kt))||y(this,Kt)===0)&&T(this,Mn,_n.setInterval(()=>{(this.options.refetchIntervalInBackground||wu.isFocused())&&z(this,Q,is).call(this)},y(this,Kt)))},oo=function(){z(this,Q,io).call(this),z(this,Q,ao).call(this,z(this,Q,lo).call(this))},uo=function(){y(this,In)&&(_n.clearTimeout(y(this,In)),T(this,In,void 0))},co=function(){y(this,Mn)&&(_n.clearInterval(y(this,Mn)),T(this,Mn,void 0))},fo=function(){const t=y(this,Te).getQueryCache().build(y(this,Te),this.options);if(t===y(this,U))return;const n=y(this,U);T(this,U,t),T(this,As,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},qh=function(t){ae.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(y(this,Ne))}),y(this,Te).getQueryCache().notify({query:y(this,U),type:"observerResultsUpdated"})})},Sd);function dg(e,t){return He(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Wc(e,t){return dg(e,t)||e.state.data!==void 0&&ho(e,t,t.refetchOnMount)}function ho(e,t,n){if(He(t.enabled,e)!==!1&&dn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Su(e,t)}return!1}function Kc(e,t,n,r){return(e!==t||He(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Su(e,n)}function Su(e,t){return He(t.enabled,e)!==!1&&e.isStaleByTime(dn(t.staleTime,e))}function fg(e,t){return!tl(e.getCurrentResult(),t)}function qc(e){return{onFetch:(t,n)=>{var p,h,f,w,S;const r=t.options,s=(f=(h=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:h.fetchMore)==null?void 0:f.direction,i=((w=t.state.data)==null?void 0:w.pages)||[],l=((S=t.state.data)==null?void 0:S.pageParams)||[];let o={pages:[],pageParams:[]},u=0;const c=async()=>{let g=!1;const k=v=>{rg(v,()=>t.signal,()=>g=!0)},m=Bh(t.options,t.fetchOptions),d=async(v,x,C)=>{if(g)return Promise.reject();if(x==null&&v.pages.length)return Promise.resolve(v);const b=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:x,direction:C?"backward":"forward",meta:t.options.meta};return k(A),A})(),j=await m(b),{maxPages:R}=t.options,_=C?ng:tg;return{pages:_(v.pages,j,R),pageParams:_(v.pageParams,x,R)}};if(s&&i.length){const v=s==="backward",x=v?hg:Jc,C={pages:i,pageParams:l},E=x(r,C);o=await d(C,E,v)}else{const v=e??i.length;do{const x=u===0?l[0]??r.initialPageParam:Jc(r,o);if(u>0&&x==null)break;o=await d(o,x),u++}while(u{var g,k;return(k=(g=t.options).persister)==null?void 0:k.call(g,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 hg(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 $s,dt,we,zn,ft,Ft,kd,pg=(kd=class extends Wh{constructor(t){super();I(this,ft);I(this,$s);I(this,dt);I(this,we);I(this,zn);T(this,$s,t.client),this.mutationId=t.mutationId,T(this,we,t.mutationCache),T(this,dt,[]),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){y(this,dt).includes(t)||(y(this,dt).push(t),this.clearGcTimeout(),y(this,we).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){T(this,dt,y(this,dt).filter(n=>n!==t)),this.scheduleGc(),y(this,we).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){y(this,dt).length||(this.state.status==="pending"?this.scheduleGc():y(this,we).remove(this))}continue(){var t;return((t=y(this,zn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,o,u,c,p,h,f,w,S,g,k,m,d,v,x,C,E,b;const n=()=>{z(this,ft,Ft).call(this,{type:"continue"})},r={client:y(this,$s),meta:this.options.meta,mutationKey:this.options.mutationKey};T(this,zn,Vh({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(j,R)=>{z(this,ft,Ft).call(this,{type:"failed",failureCount:j,error:R})},onPause:()=>{z(this,ft,Ft).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>y(this,we).canRun(this)}));const s=this.state.status==="pending",i=!y(this,zn).canStart();try{if(s)n();else{z(this,ft,Ft).call(this,{type:"pending",variables:t,isPaused:i}),y(this,we).config.onMutate&&await y(this,we).config.onMutate(t,this,r);const R=await((o=(l=this.options).onMutate)==null?void 0:o.call(l,t,r));R!==this.state.context&&z(this,ft,Ft).call(this,{type:"pending",context:R,variables:t,isPaused:i})}const j=await y(this,zn).start();return await((c=(u=y(this,we).config).onSuccess)==null?void 0:c.call(u,j,t,this.state.context,this,r)),await((h=(p=this.options).onSuccess)==null?void 0:h.call(p,j,t,this.state.context,r)),await((w=(f=y(this,we).config).onSettled)==null?void 0:w.call(f,j,null,this.state.variables,this.state.context,this,r)),await((g=(S=this.options).onSettled)==null?void 0:g.call(S,j,null,t,this.state.context,r)),z(this,ft,Ft).call(this,{type:"success",data:j}),j}catch(j){try{await((m=(k=y(this,we).config).onError)==null?void 0:m.call(k,j,t,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((v=(d=this.options).onError)==null?void 0:v.call(d,j,t,this.state.context,r))}catch(R){Promise.reject(R)}try{await((C=(x=y(this,we).config).onSettled)==null?void 0:C.call(x,void 0,j,this.state.variables,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((b=(E=this.options).onSettled)==null?void 0:b.call(E,void 0,j,t,this.state.context,r))}catch(R){Promise.reject(R)}throw z(this,ft,Ft).call(this,{type:"error",error:j}),j}finally{y(this,we).runNext(this)}}},$s=new WeakMap,dt=new WeakMap,we=new WeakMap,zn=new WeakMap,ft=new WeakSet,Ft=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),ae.batch(()=>{y(this,dt).forEach(r=>{r.onMutationUpdate(t)}),y(this,we).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 St,tt,Qs,jd,mg=(jd=class extends Qr{constructor(t={}){super();I(this,St);I(this,tt);I(this,Qs);this.config=t,T(this,St,new Set),T(this,tt,new Map),T(this,Qs,0)}build(t,n,r){const s=new pg({client:t,mutationCache:this,mutationId:++Xs(this,Qs)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){y(this,St).add(t);const n=vi(t);if(typeof n=="string"){const r=y(this,tt).get(n);r?r.push(t):y(this,tt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(y(this,St).delete(t)){const n=vi(t);if(typeof n=="string"){const r=y(this,tt).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&y(this,tt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=vi(t);if(typeof n=="string"){const r=y(this,tt).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=vi(t);if(typeof n=="string"){const s=(r=y(this,tt).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(){ae.batch(()=>{y(this,St).forEach(t=>{this.notify({type:"removed",mutation:t})}),y(this,St).clear(),y(this,tt).clear()})}getAll(){return Array.from(y(this,St))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>$c(n,r))}findAll(t={}){return this.getAll().filter(n=>$c(t,n))}notify(t){ae.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ae.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ee))))}},St=new WeakMap,tt=new WeakMap,Qs=new WeakMap,jd);function vi(e){var t;return(t=e.options.scope)==null?void 0:t.id}var kt,qt,Oe,jt,bt,Ti,po,Nd,vg=(Nd=class extends Qr{constructor(n,r){super();I(this,bt);I(this,kt);I(this,qt);I(this,Oe);I(this,jt);T(this,kt,n),this.setOptions(r),this.bindMethods(),z(this,bt,Ti).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=y(this,kt).defaultMutationOptions(n),tl(this.options,r)||y(this,kt).getMutationCache().notify({type:"observerOptionsUpdated",mutation:y(this,Oe),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Vn(r.mutationKey)!==Vn(this.options.mutationKey)?this.reset():((s=y(this,Oe))==null?void 0:s.state.status)==="pending"&&y(this,Oe).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=y(this,Oe))==null||n.removeObserver(this)}onMutationUpdate(n){z(this,bt,Ti).call(this),z(this,bt,po).call(this,n)}getCurrentResult(){return y(this,qt)}reset(){var n;(n=y(this,Oe))==null||n.removeObserver(this),T(this,Oe,void 0),z(this,bt,Ti).call(this),z(this,bt,po).call(this)}mutate(n,r){var s;return T(this,jt,r),(s=y(this,Oe))==null||s.removeObserver(this),T(this,Oe,y(this,kt).getMutationCache().build(y(this,kt),this.options)),y(this,Oe).addObserver(this),y(this,Oe).execute(n)}},kt=new WeakMap,qt=new WeakMap,Oe=new WeakMap,jt=new WeakMap,bt=new WeakSet,Ti=function(){var r;const n=((r=y(this,Oe))==null?void 0:r.state)??Jh();T(this,qt,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},po=function(n){ae.batch(()=>{var r,s,i,l,o,u,c,p;if(y(this,jt)&&this.hasListeners()){const h=y(this,qt).variables,f=y(this,qt).context,w={client:y(this,kt),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(r=y(this,jt)).onSuccess)==null||s.call(r,n.data,h,f,w)}catch(S){Promise.reject(S)}try{(l=(i=y(this,jt)).onSettled)==null||l.call(i,n.data,null,h,f,w)}catch(S){Promise.reject(S)}}else if((n==null?void 0:n.type)==="error"){try{(u=(o=y(this,jt)).onError)==null||u.call(o,n.error,h,f,w)}catch(S){Promise.reject(S)}try{(p=(c=y(this,jt)).onSettled)==null||p.call(c,void 0,n.error,h,f,w)}catch(S){Promise.reject(S)}}}this.listeners.forEach(h=>{h(y(this,qt))})})},Nd),ht,Cd,gg=(Cd=class extends Qr{constructor(t={}){super();I(this,ht);this.config=t,T(this,ht,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??gu(s,n);let l=this.get(i);return l||(l=new ug({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(l)),l}add(t){y(this,ht).has(t.queryHash)||(y(this,ht).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=y(this,ht).get(t.queryHash);n&&(t.destroy(),n===t&&y(this,ht).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ae.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return y(this,ht).get(t)}getAll(){return[...y(this,ht).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){ae.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ae.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ae.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ht=new WeakMap,Cd),Z,Jt,Gt,Er,_r,Yt,Pr,br,Ed,yg=(Ed=class{constructor(e={}){I(this,Z);I(this,Jt);I(this,Gt);I(this,Er);I(this,_r);I(this,Yt);I(this,Pr);I(this,br);T(this,Z,e.queryCache||new gg),T(this,Jt,e.mutationCache||new mg),T(this,Gt,e.defaultOptions||{}),T(this,Er,new Map),T(this,_r,new Map),T(this,Yt,0)}mount(){Xs(this,Yt)._++,y(this,Yt)===1&&(T(this,Pr,wu.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,Z).onFocus())})),T(this,br,nl.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,Z).onOnline())})))}unmount(){var e,t;Xs(this,Yt)._--,y(this,Yt)===0&&((e=y(this,Pr))==null||e.call(this),T(this,Pr,void 0),(t=y(this,br))==null||t.call(this),T(this,br,void 0))}isFetching(e){return y(this,Z).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return y(this,Jt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=y(this,Z).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=y(this,Z).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(dn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return y(this,Z).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=y(this,Z).get(r.queryHash),i=s==null?void 0:s.state.data,l=Xv(t,i);if(l!==void 0)return y(this,Z).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return ae.batch(()=>y(this,Z).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=y(this,Z).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=y(this,Z);ae.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=y(this,Z);return ae.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ae.batch(()=>y(this,Z).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ee).catch(Ee)}invalidateQueries(e,t={}){return ae.batch(()=>(y(this,Z).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=ae.batch(()=>y(this,Z).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Ee)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Ee)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=y(this,Z).build(this,t);return n.isStaleByTime(dn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ee).catch(Ee)}fetchInfiniteQuery(e){return e.behavior=qc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ee).catch(Ee)}ensureInfiniteQueryData(e){return e.behavior=qc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return nl.isOnline()?y(this,Jt).resumePausedMutations():Promise.resolve()}getQueryCache(){return y(this,Z)}getMutationCache(){return y(this,Jt)}getDefaultOptions(){return y(this,Gt)}setDefaultOptions(e){T(this,Gt,e)}setQueryDefaults(e,t){y(this,Er).set(Vn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...y(this,Er).values()],n={};return t.forEach(r=>{Ls(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){y(this,_r).set(Vn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...y(this,_r).values()],n={};return t.forEach(r=>{Ls(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...y(this,Gt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=gu(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===yu&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...y(this,Gt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){y(this,Z).clear(),y(this,Jt).clear()}},Z=new WeakMap,Jt=new WeakMap,Gt=new WeakMap,Er=new WeakMap,_r=new WeakMap,Yt=new WeakMap,Pr=new WeakMap,br=new WeakMap,Ed),Gh=N.createContext(void 0),qn=e=>{const t=N.useContext(Gh);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},xg=({client:e,children:t})=>(N.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(Gh.Provider,{value:e,children:t})),Yh=N.createContext(!1),wg=()=>N.useContext(Yh);Yh.Provider;function Sg(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var kg=N.createContext(Sg()),jg=()=>N.useContext(kg),Ng=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?xu(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Cg=e=>{N.useEffect(()=>{e.clearReset()},[e])},Eg=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||xu(n,[e.error,r])),_g=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))}},Pg=(e,t)=>e.isLoading&&e.isFetching&&!t,bg=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Gc=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Tg(e,t,n){var f,w,S,g;const r=wg(),s=jg(),i=qn(),l=i.defaultQueryOptions(e);(w=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||w.call(f,l);const o=i.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",_g(l),Ng(l,s,o),Cg(s);const u=!i.getQueryCache().get(l.queryHash),[c]=N.useState(()=>new t(i,l)),p=c.getOptimisticResult(l),h=!r&&e.subscribed!==!1;if(N.useSyncExternalStore(N.useCallback(k=>{const m=h?c.subscribe(ae.batchCalls(k)):Ee;return c.updateResult(),m},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),N.useEffect(()=>{c.setOptions(l)},[l,c]),bg(l,p))throw Gc(l,c,s);if(Eg({result:p,errorResetBoundary:s,throwOnError:l.throwOnError,query:o,suspense:l.suspense}))throw p.error;if((g=(S=i.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||g.call(S,l,p),l.experimental_prefetchInRender&&!Hn&&Pg(p,r)){const k=u?Gc(l,c,s):o==null?void 0:o.promise;k==null||k.catch(Ee).finally(()=>{c.updateResult()})}return l.notifyOnChangeProps?p:c.trackResult(p)}function _t(e,t){return Tg(e,cg)}function lt(e,t){const n=qn(),[r]=N.useState(()=>new vg(n,e));N.useEffect(()=>{r.setOptions(e)},[r,e]);const s=N.useSyncExternalStore(N.useCallback(l=>r.subscribe(ae.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=N.useCallback((l,o)=>{r.mutate(l,o).catch(Ee)},[r]);if(s.error&&xu(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 Is(){return Is=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function ku(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Rg(){return Math.random().toString(36).substr(2,8)}function Xc(e,t){return{usr:e.state,key:e.key,idx:t}}function mo(e,t,n,r){return n===void 0&&(n=null),Is({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Br(t):t,{state:n,key:t&&t.key||r||Rg()})}function rl(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 Br(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 Lg(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,l=s.history,o=en.Pop,u=null,c=p();c==null&&(c=0,l.replaceState(Is({},l.state,{idx:c}),""));function p(){return(l.state||{idx:null}).idx}function h(){o=en.Pop;let k=p(),m=k==null?null:k-c;c=k,u&&u({action:o,location:g.location,delta:m})}function f(k,m){o=en.Push;let d=mo(g.location,k,m);c=p()+1;let v=Xc(d,c),x=g.createHref(d);try{l.pushState(v,"",x)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;s.location.assign(x)}i&&u&&u({action:o,location:g.location,delta:1})}function w(k,m){o=en.Replace;let d=mo(g.location,k,m);c=p();let v=Xc(d,c),x=g.createHref(d);l.replaceState(v,"",x),i&&u&&u({action:o,location:g.location,delta:0})}function S(k){let m=s.location.origin!=="null"?s.location.origin:s.location.href,d=typeof k=="string"?k:rl(k);return d=d.replace(/ $/,"%20"),te(m,"No window.location.(origin|href) available to create URL for href: "+d),new URL(d,m)}let g={get action(){return o},get location(){return e(s,l)},listen(k){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(Yc,h),u=k,()=>{s.removeEventListener(Yc,h),u=null}},createHref(k){return t(s,k)},createURL:S,encodeLocation(k){let m=S(k);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:f,replace:w,go(k){return l.go(k)}};return g}var Zc;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Zc||(Zc={}));function Ig(e,t,n){return n===void 0&&(n="/"),Mg(e,t,n)}function Mg(e,t,n,r){let s=typeof t=="string"?Br(t):t,i=Fr(s.pathname||"/",n);if(i==null)return null;let l=Xh(e);zg(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("/")&&(te(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=fn([r,u.relativePath]),p=n.concat(u);i.children&&i.children.length>0&&(te(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),Xh(i.children,t,p,c)),!(i.path==null&&!i.index)&&t.push({path:c,score:Bg(c,i.index),routesMeta:p})};return e.forEach((i,l)=>{var o;if(i.path===""||!((o=i.path)!=null&&o.includes("?")))s(i,l);else for(let u of Zh(i.path))s(i,l,u)}),t}function Zh(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=Zh(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 zg(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Hg(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Fg=/^:[\w-]+$/,Dg=3,Ag=2,Ug=1,$g=10,Qg=-2,ed=e=>e==="*";function Bg(e,t){let n=e.split("/"),r=n.length;return n.some(ed)&&(r+=Qg),t&&(r+=Ag),n.filter(s=>!ed(s)).reduce((s,i)=>s+(Fg.test(i)?Dg:i===""?Ug:$g),r)}function Hg(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function Vg(e,t,n){let{routesMeta:r}=e,s={},i="/",l=[];for(let o=0;o{let{paramName:f,isOptional:w}=p;if(f==="*"){let g=o[h]||"";l=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const S=o[h];return w&&!S?c[f]=void 0:c[f]=(S||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:l,pattern:e}}function Wg(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),ku(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,o,u)=>(r.push({paramName:o,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function Kg(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ku(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Fr(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 qg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Jg=e=>qg.test(e);function Gg(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Br(e):e,i;if(n)if(Jg(n))i=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),ku(!1,"Pathnames cannot have embedded double slashes - normalizing "+(l+" -> "+n))}n.startsWith("/")?i=td(n.substring(1),"/"):i=td(n,t)}else i=t;return{pathname:i,search:Zg(r),hash:ey(s)}}function td(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 ra(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 Yg(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function ep(e,t){let n=Yg(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function tp(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=Br(e):(s=Is({},e),te(!s.pathname||!s.pathname.includes("?"),ra("?","pathname","search",s)),te(!s.pathname||!s.pathname.includes("#"),ra("#","pathname","hash",s)),te(!s.search||!s.search.includes("#"),ra("#","search","hash",s)));let i=e===""||s.pathname==="",l=i?"/":s.pathname,o;if(l==null)o=n;else{let h=t.length-1;if(!r&&l.startsWith("..")){let f=l.split("/");for(;f[0]==="..";)f.shift(),h-=1;s.pathname=f.join("/")}o=h>=0?t[h]:"/"}let u=Gg(s,o),c=l&&l!=="/"&&l.endsWith("/"),p=(i||l===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(c||p)&&(u.pathname+="/"),u}const fn=e=>e.join("/").replace(/\/\/+/g,"/"),Xg=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Zg=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ey=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function ty(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const np=["post","put","patch","delete"];new Set(np);const ny=["get",...np];new Set(ny);/** + * 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 Ms(){return Ms=Object.assign?Object.assign.bind():function(e){for(var t=1;t{o.current=!0}),N.useCallback(function(c,p){if(p===void 0&&(p={}),!o.current)return;if(typeof c=="number"){r.go(c);return}let h=tp(c,JSON.parse(l),i,p.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:fn([t,h.pathname])),(p.replace?r.replace:r.push)(h,p.state,p)},[t,r,l,i,e])}const iy=N.createContext(null);function ly(e){let t=N.useContext(Mt).outlet;return t&&N.createElement(iy.Provider,{value:e},t)}function lp(){let{matches:e}=N.useContext(Mt),t=e[e.length-1];return t?t.params:{}}function Nl(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=N.useContext(yn),{matches:s}=N.useContext(Mt),{pathname:i}=Hr(),l=JSON.stringify(ep(s,r.v7_relativeSplatPath));return N.useMemo(()=>tp(e,JSON.parse(l),i,n==="path"),[e,l,i,n])}function ay(e,t){return oy(e,t)}function oy(e,t,n,r){qs()||te(!1);let{navigator:s}=N.useContext(yn),{matches:i}=N.useContext(Mt),l=i[i.length-1],o=l?l.params:{};l&&l.pathname;let u=l?l.pathnameBase:"/";l&&l.route;let c=Hr(),p;if(t){var h;let k=typeof t=="string"?Br(t):t;u==="/"||(h=k.pathname)!=null&&h.startsWith(u)||te(!1),p=k}else p=c;let f=p.pathname||"/",w=f;if(u!=="/"){let k=u.replace(/^\//,"").split("/");w="/"+f.replace(/^\//,"").split("/").slice(k.length).join("/")}let S=Ig(e,{pathname:w}),g=hy(S&&S.map(k=>Object.assign({},k,{params:Object.assign({},o,k.params),pathname:fn([u,s.encodeLocation?s.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?u:fn([u,s.encodeLocation?s.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),i,n,r);return t&&g?N.createElement(jl.Provider,{value:{location:Ms({pathname:"/",search:"",hash:"",state:null,key:"default"},p),navigationType:en.Pop}},g):g}function uy(){let e=gy(),t=ty(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return N.createElement(N.Fragment,null,N.createElement("h2",null,"Unexpected Application Error!"),N.createElement("h3",{style:{fontStyle:"italic"}},t),n?N.createElement("pre",{style:s},n):null,null)}const cy=N.createElement(uy,null);class dy extends N.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?N.createElement(Mt.Provider,{value:this.props.routeContext},N.createElement(sp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function fy(e){let{routeContext:t,match:n,children:r}=e,s=N.useContext(kl);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),N.createElement(Mt.Provider,{value:t},r)}function hy(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,o=(s=n)==null?void 0:s.errors;if(o!=null){let p=l.findIndex(h=>h.route.id&&(o==null?void 0:o[h.route.id])!==void 0);p>=0||te(!1),l=l.slice(0,Math.min(l.length,p+1))}let u=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let p=0;p=0?l=l.slice(0,c+1):l=[l[0]];break}}}return l.reduceRight((p,h,f)=>{let w,S=!1,g=null,k=null;n&&(w=o&&h.route.id?o[h.route.id]:void 0,g=h.route.errorElement||cy,u&&(c<0&&f===0?(xy("route-fallback"),S=!0,k=null):c===f&&(S=!0,k=h.route.hydrateFallbackElement||null)));let m=t.concat(l.slice(0,f+1)),d=()=>{let v;return w?v=g:S?v=k:h.route.Component?v=N.createElement(h.route.Component,null):h.route.element?v=h.route.element:v=p,N.createElement(fy,{match:h,routeContext:{outlet:p,matches:m,isDataRoute:n!=null},children:v})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?N.createElement(dy,{location:n.location,revalidation:n.revalidation,component:g,error:w,children:d(),routeContext:{outlet:null,matches:m,isDataRoute:!0}}):d()},null)}var ap=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(ap||{}),op=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}(op||{});function py(e){let t=N.useContext(kl);return t||te(!1),t}function my(e){let t=N.useContext(rp);return t||te(!1),t}function vy(e){let t=N.useContext(Mt);return t||te(!1),t}function up(e){let t=vy(),n=t.matches[t.matches.length-1];return n.route.id||te(!1),n.route.id}function gy(){var e;let t=N.useContext(sp),n=my(),r=up();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function yy(){let{router:e}=py(ap.UseNavigateStable),t=up(op.UseNavigateStable),n=N.useRef(!1);return ip(()=>{n.current=!0}),N.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,Ms({fromRouteId:t},i)))},[e,t])}const nd={};function xy(e,t,n){nd[e]||(nd[e]=!0)}function wy(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Sy(e){return ly(e.context)}function Dt(e){te(!1)}function ky(e){let{basename:t="/",children:n=null,location:r,navigationType:s=en.Pop,navigator:i,static:l=!1,future:o}=e;qs()&&te(!1);let u=t.replace(/^\/*/,"/"),c=N.useMemo(()=>({basename:u,navigator:i,static:l,future:Ms({v7_relativeSplatPath:!1},o)}),[u,o,i,l]);typeof r=="string"&&(r=Br(r));let{pathname:p="/",search:h="",hash:f="",state:w=null,key:S="default"}=r,g=N.useMemo(()=>{let k=Fr(p,u);return k==null?null:{location:{pathname:k,search:h,hash:f,state:w,key:S},navigationType:s}},[u,p,h,f,w,S,s]);return g==null?null:N.createElement(yn.Provider,{value:c},N.createElement(jl.Provider,{children:n,value:g}))}function jy(e){let{children:t,location:n}=e;return ay(go(t),n)}new Promise(()=>{});function go(e,t){t===void 0&&(t=[]);let n=[];return N.Children.forEach(e,(r,s)=>{if(!N.isValidElement(r))return;let i=[...t,s];if(r.type===N.Fragment){n.push.apply(n,go(r.props.children,i));return}r.type!==Dt&&te(!1),!r.props.index||!r.props.children||te(!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=go(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 sl(){return sl=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[s]=e[s]);return n}function Ny(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Cy(e,t){return e.button===0&&(!t||t==="_self")&&!Ny(e)}const Ey=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],_y=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Py="6";try{window.__reactRouterVersion=Py}catch{}const by=N.createContext({isTransitioning:!1}),Ty="startTransition",rd=Fp[Ty];function Oy(e){let{basename:t,children:n,future:r,window:s}=e,i=N.useRef();i.current==null&&(i.current=Og({window:s,v5Compat:!0}));let l=i.current,[o,u]=N.useState({action:l.action,location:l.location}),{v7_startTransition:c}=r||{},p=N.useCallback(h=>{c&&rd?rd(()=>u(h)):u(h)},[u,c]);return N.useLayoutEffect(()=>l.listen(p),[l,p]),N.useEffect(()=>wy(r),[r]),N.createElement(ky,{basename:t,children:n,location:o.location,navigationType:o.action,navigator:l,future:r})}const Ry=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ly=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Iy=N.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:l,state:o,target:u,to:c,preventScrollReset:p,viewTransition:h}=t,f=cp(t,Ey),{basename:w}=N.useContext(yn),S,g=!1;if(typeof c=="string"&&Ly.test(c)&&(S=c,Ry))try{let v=new URL(window.location.href),x=c.startsWith("//")?new URL(v.protocol+c):new URL(c),C=Fr(x.pathname,w);x.origin===v.origin&&C!=null?c=C+x.search+x.hash:g=!0}catch{}let k=ry(c,{relative:s}),m=zy(c,{replace:l,state:o,target:u,preventScrollReset:p,relative:s,viewTransition:h});function d(v){r&&r(v),v.defaultPrevented||m(v)}return N.createElement("a",sl({},f,{href:S||k,onClick:g||i?r:d,ref:n,target:u}))}),sd=N.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:s=!1,className:i="",end:l=!1,style:o,to:u,viewTransition:c,children:p}=t,h=cp(t,_y),f=Nl(u,{relative:h.relative}),w=Hr(),S=N.useContext(rp),{navigator:g,basename:k}=N.useContext(yn),m=S!=null&&Fy(f)&&c===!0,d=g.encodeLocation?g.encodeLocation(f).pathname:f.pathname,v=w.pathname,x=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;s||(v=v.toLowerCase(),x=x?x.toLowerCase():null,d=d.toLowerCase()),x&&k&&(x=Fr(x,k)||x);const C=d!=="/"&&d.endsWith("/")?d.length-1:d.length;let E=v===d||!l&&v.startsWith(d)&&v.charAt(C)==="/",b=x!=null&&(x===d||!l&&x.startsWith(d)&&x.charAt(d.length)==="/"),j={isActive:E,isPending:b,isTransitioning:m},R=E?r:void 0,_;typeof i=="function"?_=i(j):_=[i,E?"active":null,b?"pending":null,m?"transitioning":null].filter(Boolean).join(" ");let A=typeof o=="function"?o(j):o;return N.createElement(Iy,sl({},h,{"aria-current":R,className:_,ref:n,style:A,to:u,viewTransition:c}),typeof p=="function"?p(j):p)});var yo;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(yo||(yo={}));var id;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(id||(id={}));function My(e){let t=N.useContext(kl);return t||te(!1),t}function zy(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:l,viewTransition:o}=t===void 0?{}:t,u=Vr(),c=Hr(),p=Nl(e,{relative:l});return N.useCallback(h=>{if(Cy(h,n)){h.preventDefault();let f=r!==void 0?r:rl(c)===rl(p);u(e,{replace:f,state:s,preventScrollReset:i,relative:l,viewTransition:o})}},[c,u,p,r,s,n,e,i,l,o])}function Fy(e,t){t===void 0&&(t={});let n=N.useContext(by);n==null&&te(!1);let{basename:r}=My(yo.useViewTransitionState),s=Nl(e,{relative:t.relative});if(!n.isTransitioning)return!1;let i=Fr(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=Fr(n.nextLocation.pathname,r)||n.nextLocation.pathname;return vo(s.pathname,l)!=null||vo(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 Dy={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 Ay=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),ge=(e,t)=>{const n=N.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:l,className:o="",children:u,...c},p)=>N.createElement("svg",{ref:p,...Dy,width:s,height:s,stroke:r,strokeWidth:l?Number(i)*24/Number(s):i,className:["lucide",`lucide-${Ay(e)}`,o].join(" "),...c},[...t.map(([h,f])=>N.createElement(h,f)),...Array.isArray(u)?u:[u]]));return n.displayName=`${e}`,n};/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Uy=ge("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 $y=ge("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 Qy=ge("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 By=ge("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=ge("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 Vy=ge("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 Cl=ge("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 Wy=ge("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 Ky=ge("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 ld=ge("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 xo=ge("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dp=ge("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 qy=ge("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 ad=ge("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=ge("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.330.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fp=ge("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 ju=ge("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),Gy={},od=e=>{let t;const n=new Set,r=(p,h)=>{const f=typeof p=="function"?p(t):p;if(!Object.is(f,t)){const w=t;t=h??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(S=>S(t,w))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>c,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(Gy?"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},Yy=e=>e?od(e):od;var hp={exports:{}},pp={},mp={exports:{}},vp={};/** + * @license React + * use-sync-external-store-shim.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Dr=N;function Xy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Zy=typeof Object.is=="function"?Object.is:Xy,ex=Dr.useState,tx=Dr.useEffect,nx=Dr.useLayoutEffect,rx=Dr.useDebugValue;function sx(e,t){var n=t(),r=ex({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return nx(function(){s.value=n,s.getSnapshot=t,sa(s)&&i({inst:s})},[e,n,t]),tx(function(){return sa(s)&&i({inst:s}),e(function(){sa(s)&&i({inst:s})})},[e]),rx(n),n}function sa(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Zy(e,n)}catch{return!0}}function ix(e,t){return t()}var lx=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ix:sx;vp.useSyncExternalStore=Dr.useSyncExternalStore!==void 0?Dr.useSyncExternalStore:lx;mp.exports=vp;var ax=mp.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var El=N,ox=ax;function ux(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var cx=typeof Object.is=="function"?Object.is:ux,dx=ox.useSyncExternalStore,fx=El.useRef,hx=El.useEffect,px=El.useMemo,mx=El.useDebugValue;pp.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=fx(null);if(i.current===null){var l={hasValue:!1,value:null};i.current=l}else l=i.current;i=px(function(){function u(w){if(!c){if(c=!0,p=w,w=r(w),s!==void 0&&l.hasValue){var S=l.value;if(s(S,w))return h=S}return h=w}if(S=h,cx(p,w))return S;var g=r(w);return s!==void 0&&s(S,g)?(p=w,S):(p=w,h=g)}var c=!1,p,h,f=n===void 0?null:n;return[function(){return u(t())},f===null?void 0:function(){return u(f())}]},[t,n,r,s]);var o=dx(e,i[0],i[1]);return hx(function(){l.hasValue=!0,l.value=o},[o]),mx(o),o};hp.exports=pp;var vx=hp.exports;const gx=_d(vx),gp={},{useDebugValue:yx}=Eo,{useSyncExternalStoreWithSelector:xx}=gx;let ud=!1;const wx=e=>e;function Sx(e,t=wx,n){(gp?"production":void 0)!=="production"&&n&&!ud&&(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"),ud=!0);const r=xx(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return yx(r),r}const cd=e=>{(gp?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Yy(e):e,n=(r,s)=>Sx(t,r,s);return Object.assign(n,t),n},Nu=e=>e?cd(e):cd,Cu="/api",Eu="flow_auth_token",_u="flow_auth_expires",Pu="flow_auth_username";function il(){const e=localStorage.getItem(Eu),t=localStorage.getItem(_u);return!e||!t?null:new Date(t)<=new Date?(gr(),null):e}function dd(e,t,n){localStorage.setItem(Eu,e),localStorage.setItem(_u,t),localStorage.setItem(Pu,n)}function gr(){localStorage.removeItem(Eu),localStorage.removeItem(_u),localStorage.removeItem(Pu)}function kx(){return localStorage.getItem(Pu)}let zs=null;function jx(e){zs=e}async function ie(e,t,n=!1){const r={"Content-Type":"application/json",...t==null?void 0:t.headers};if(!n){const i=il();i&&(r.Authorization=`Bearer ${i}`)}const s=await fetch(`${Cu}${e}`,{...t,headers:r});if(s.status===401){gr(),zs&&zs();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 Yn={getConfig:()=>ie("/auth/config",void 0,!0),login:e=>ie("/auth/login",{method:"POST",body:JSON.stringify(e)},!0),getGitHubAuthUrl:()=>`${Cu}/auth/github`,getCurrentUser:()=>ie("/auth/me"),logout:()=>ie("/auth/logout",{method:"POST"})},ia={list:()=>ie("/configs"),create:e=>ie("/configs",{method:"POST",body:JSON.stringify(e)}),delete:e=>ie(`/configs/${e}`,{method:"DELETE"})},cr={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 ie(`/tasks${n?`?${n}`:""}`)},get:e=>ie(`/tasks/${e}`),create:e=>ie("/tasks",{method:"POST",body:JSON.stringify(e)}),delete:e=>ie(`/tasks/${e}`,{method:"DELETE"}),importSuite:e=>ie(`/tasks/import-suite?suite_name=${encodeURIComponent(e)}`,{method:"POST"})},Pt={list:e=>{const t=e?`?status=${e}`:"";return ie(`/jobs${t}`)},get:e=>ie(`/jobs/${e}`),create:e=>ie("/jobs",{method:"POST",body:JSON.stringify(e)}),start:async function*(e){var o;const t={},n=il();n&&(t.Authorization=`Bearer ${n}`);const r=await fetch(`${Cu}/jobs/${e}/start`,{method:"POST",headers:t});if(r.status===401)throw gr(),zs&&zs(),new Error("Not authenticated");if(!r.ok)throw new Error("Failed to start job");const s=(o=r.body)==null?void 0:o.getReader();if(!s)throw new Error("No response body");const i=new TextDecoder;let l="";for(;;){const{done:u,value:c}=await s.read();if(u)break;l+=i.decode(c,{stream:!0});const p=l.split(` +`);l=p.pop()||"";for(const h of p)h.startsWith("data: ")&&(yield JSON.parse(h.slice(6)))}},cancel:e=>ie(`/jobs/${e}/cancel`,{method:"POST"}),delete:e=>ie(`/jobs/${e}`,{method:"DELETE"})},wo={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 ie(`/runs${n?`?${n}`:""}`)},get:e=>ie(`/runs/${e}`),getJobSummary:e=>ie(`/runs/job/${e}/summary`)},bu=Nu((e,t)=>(jx(()=>{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 Yn.getConfig();if(e({authConfig:n,isLoadingConfig:!1}),n.enabled){const r=il(),s=kx();if(r&&s)try{const i=await Yn.getCurrentUser();e({isAuthenticated:!0,user:i})}catch{gr(),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 Yn.login({username:n,password:r});return dd(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=Yn.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&&(dd(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 Yn.logout()}catch{}gr(),e({isAuthenticated:!1,user:null,error:null})},checkAuth:async()=>{const{authConfig:n}=t();if(!(n!=null&&n.enabled)){e({isAuthenticated:!0});return}if(!il()){e({isAuthenticated:!1,user:null});return}try{const s=await Yn.getCurrentUser();e({isAuthenticated:!0,user:s})}catch{gr(),e({isAuthenticated:!1,user:null})}},clearError:()=>e({error:null})}));function B({variant:e="secondary",size:t="md",className:n="",icon:r,iconRight:s,loading:i=!1,children:l,disabled:o,...u}){const c="font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-1.5",p={primary:"bg-[var(--accent)] text-black hover:bg-[#16a34a]",secondary:"bg-[var(--bg-tertiary)] text-[var(--text-primary)] border border-[var(--border)] hover:bg-[var(--border)]",danger:"bg-[var(--error)] text-white hover:bg-red-600",ghost:"text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)]"},h={sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm"},f=t==="sm"?14:16;return a.jsxs("button",{className:`${c} ${p[e]} ${h[t]} ${n}`,disabled:o||i,...u,children:[i?a.jsx(Cl,{size:f,className:"animate-spin"}):r?a.jsx(r,{size:f}):null,l,s&&!i&&a.jsx(s,{size:f})]})}const Nx={};function Cx(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 Fs=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Fs(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Fs(r)(n)}}}},Ex=(e,t)=>(n,r,s)=>{let i={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:k=>k,version:0,merge:(k,m)=>({...m,...k}),...t},l=!1;const o=new Set,u=new Set;let c;try{c=i.getStorage()}catch{}if(!c)return e((...k)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...k)},r,s);const p=Fs(i.serialize),h=()=>{const k=i.partialize({...r()});let m;const d=p({state:k,version:i.version}).then(v=>c.setItem(i.name,v)).catch(v=>{m=v});if(m)throw m;return d},f=s.setState;s.setState=(k,m)=>{f(k,m),h()};const w=e((...k)=>{n(...k),h()},r,s);let S;const g=()=>{var k;if(!c)return;l=!1,o.forEach(d=>d(r()));const m=((k=i.onRehydrateStorage)==null?void 0:k.call(i,r()))||void 0;return Fs(c.getItem.bind(c))(i.name).then(d=>{if(d)return i.deserialize(d)}).then(d=>{if(d)if(typeof d.version=="number"&&d.version!==i.version){if(i.migrate)return i.migrate(d.state,d.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return d.state}).then(d=>{var v;return S=i.merge(d,(v=r())!=null?v:w),n(S,!0),h()}).then(()=>{m==null||m(S,void 0),l=!0,u.forEach(d=>d(S))}).catch(d=>{m==null||m(void 0,d)})};return s.persist={setOptions:k=>{i={...i,...k},k.getStorage&&(c=k.getStorage())},clearStorage:()=>{c==null||c.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>g(),hasHydrated:()=>l,onHydrate:k=>(o.add(k),()=>{o.delete(k)}),onFinishHydration:k=>(u.add(k),()=>{u.delete(k)})},g(),S||w},_x=(e,t)=>(n,r,s)=>{let i={storage:Cx(()=>localStorage),partialize:g=>g,version:0,merge:(g,k)=>({...k,...g}),...t},l=!1;const o=new Set,u=new Set;let c=i.storage;if(!c)return e((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...g)},r,s);const p=()=>{const g=i.partialize({...r()});return c.setItem(i.name,{state:g,version:i.version})},h=s.setState;s.setState=(g,k)=>{h(g,k),p()};const f=e((...g)=>{n(...g),p()},r,s);s.getInitialState=()=>f;let w;const S=()=>{var g,k;if(!c)return;l=!1,o.forEach(d=>{var v;return d((v=r())!=null?v:f)});const m=((k=i.onRehydrateStorage)==null?void 0:k.call(i,(g=r())!=null?g:f))||void 0;return Fs(c.getItem.bind(c))(i.name).then(d=>{if(d)if(typeof d.version=="number"&&d.version!==i.version){if(i.migrate)return[!0,i.migrate(d.state,d.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,d.state];return[!1,void 0]}).then(d=>{var v;const[x,C]=d;if(w=i.merge(C,(v=r())!=null?v:f),n(w,!0),x)return p()}).then(()=>{m==null||m(w,void 0),w=r(),l=!0,u.forEach(d=>d(w))}).catch(d=>{m==null||m(void 0,d)})};return s.persist={setOptions:g=>{i={...i,...g},g.storage&&(c=g.storage)},clearStorage:()=>{c==null||c.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>S(),hasHydrated:()=>l,onHydrate:g=>(o.add(g),()=>{o.delete(g)}),onFinishHydration:g=>(u.add(g),()=>{u.delete(g)})},i.skipHydration||S(),w||f},Px=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((Nx?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Ex(e,t)):_x(e,t),bx=Px,Tx=Nu()(bx((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 Ox(){const{theme:e,toggleTheme:t}=Tx();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(ad,{size:12,className:`transition-opacity ${e==="light"?"opacity-0":"opacity-40"}`}),a.jsx(ld,{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(ld,{size:12,className:"text-black"}):a.jsx(ad,{size:12,className:"text-black"})})]})}const Rx=[{path:"/",label:"Agents",icon:$y,exact:!0},{path:"/tasks",label:"Tasks",icon:Vy},{path:"/jobs",label:"Jobs",icon:xo}];function Lx(){const e=Hr(),{authConfig:t,user:n,logout:r}=bu(),s=(l,o)=>o?e.pathname===l||e.pathname==="/agents":e.pathname.startsWith(l),i=async()=>{await r()};return a.jsxs("div",{className:"min-h-screen flex flex-col",children:[a.jsx("header",{className:"border-b border-[var(--border)] bg-[var(--bg-secondary)]",children:a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-8",children:[a.jsxs(sd,{to:"/",className:"text-lg font-bold text-[var(--accent)] flex items-center gap-2 hover:opacity-80",children:[a.jsx(ju,{size:20}),"flow",a.jsx("span",{className:"text-[var(--text-secondary)]",children:"/optimize"})]}),a.jsx("nav",{className:"flex gap-1",children:Rx.map(l=>a.jsxs(sd,{to:l.path,className:`px-3 py-1.5 rounded text-sm transition-colors flex items-center gap-2 ${s(l.path,l.exact)?"bg-[var(--accent)] text-black font-medium":"text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)]"}`,children:[a.jsx(l.icon,{size:16}),l.label]},l.path))})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(Ox,{}),(t==null?void 0:t.enabled)&&n&&a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--text-secondary)]",children:[a.jsx(fp,{size:14}),a.jsx("span",{children:n.username})]}),a.jsx(B,{variant:"ghost",size:"sm",icon:Ky,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(Sy,{})})})]})}function ke({children:e,className:t="",onClick:n,selected:r=!1,selectable:s=!1}){const i="bg-[var(--bg-secondary)] border border-[var(--border)] p-4",l=s?"cursor-pointer hover:border-[var(--accent-dim)] transition-colors":"",o=r?"border-[var(--accent)]":"";return a.jsx("div",{className:`${i} ${l} ${o} ${t}`,onClick:n,children:e})}function V({children:e,variant:t="default"}){const n={default:"bg-[var(--bg-tertiary)] text-[var(--text-secondary)]",success:"bg-green-900/50 text-green-400",warning:"bg-yellow-900/50 text-yellow-400",error:"bg-red-900/50 text-red-400",info:"bg-blue-900/50 text-blue-400"};return a.jsx("span",{className:`inline-block px-2 py-0.5 text-xs ${n[t]}`,children:e})}function Js({isOpen:e,onClose:t,title:n,children:r}){return N.useEffect(()=>{const s=i=>{i.key==="Escape"&&t()};return e&&(document.addEventListener("keydown",s),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",s),document.body.style.overflow=""}},[e,t]),e?a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-0 bg-black/80",onClick:t}),a.jsxs("div",{className:"relative bg-[var(--bg-secondary)] border border-[var(--border)] max-w-lg w-full mx-4 max-h-[80vh] overflow-y-auto",children:[a.jsxs("div",{className:"sticky top-0 bg-[var(--bg-secondary)] border-b border-[var(--border)] px-4 py-3 flex items-center justify-between",children:[a.jsx("h2",{className:"font-semibold",children:n}),a.jsx("button",{onClick:t,className:"text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:"×"})]}),a.jsx("div",{className:"p-4",children:r})]})]}):null}function Ke({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 Ix({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 ms({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 fd(){const e=Vr(),t=qn(),[n,r]=N.useState(!1),[s,i]=N.useState(null),{data:l=[],isLoading:o}=_t({queryKey:["configs"],queryFn:ia.list}),{data:u=[]}=_t({queryKey:["jobs"],queryFn:()=>Pt.list()}),c=lt({mutationFn:ia.create,onSuccess:()=>{t.invalidateQueries({queryKey:["configs"]}),r(!1)}}),p=lt({mutationFn:ia.delete,onSuccess:()=>t.invalidateQueries({queryKey:["configs"]})}),h=f=>{const w=u.filter(k=>k.config_ids.includes(f)),S=w.filter(k=>k.status==="running").length,g=w.filter(k=>k.status==="completed").length;return{running:S,completed:g,total:w.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(B,{variant:"primary",icon:dp,onClick:()=>r(!0),children:"New Agent"})]}),o?a.jsxs("div",{className:"flex items-center gap-2 text-[var(--text-secondary)]",children:[a.jsx(Cl,{size:16,className:"animate-spin"}),"Loading agents..."]}):l.length===0?a.jsx(Mx,{onCreateClick:()=>r(!0)}):a.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:l.map(f=>{const w=h(f.id);return a.jsx(zx,{agent:f,stats:w,onOptimize:()=>i(f),onDelete:()=>{confirm(`Delete agent "${f.name}"?`)&&p.mutate(f.id)}},f.id)})}),u.length>0&&a.jsxs("div",{className:"mt-8",children:[a.jsx("h3",{className:"text-lg font-medium mb-4",children:"Recent Optimization Jobs"}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:u.slice(0,6).map(f=>{const w=f.total_experiments>0?f.completed_experiments/f.total_experiments*100:0;return a.jsxs(ke,{className:"cursor-pointer hover:border-[var(--accent-dim)] flex flex-col",onClick:()=>e(`/jobs/${f.id}`),children:[a.jsx("div",{className:"flex items-start justify-between mb-3",children:a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx(V,{variant:f.status==="completed"?"success":f.status==="running"?"info":f.status==="failed"?"error":"default",children:f.status}),f.pareto_frontier.length>0&&a.jsxs(V,{variant:"success",children:[f.pareto_frontier.length," Pareto"]}),f.use_llm_eval&&a.jsx(V,{children:"LLM"})]}),a.jsx("h3",{className:"font-medium mt-2 truncate",title:f.name||`Job ${f.id.slice(0,8)}`,children:f.name||`Job ${f.id.slice(0,8)}`}),a.jsxs("code",{className:"text-xs text-[var(--text-secondary)] font-mono",children:[f.id.slice(0,8),"..."]})]})}),(f.status==="running"||f.status==="completed")&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"flex justify-between text-xs text-[var(--text-secondary)] mb-1",children:[a.jsx("span",{children:"Progress"}),a.jsxs("span",{children:[f.completed_experiments,"/",f.total_experiments]})]}),a.jsx("div",{className:"w-full bg-[var(--bg-primary)] h-1.5 rounded-full overflow-hidden",children:a.jsx("div",{className:`h-full transition-all ${f.status==="completed"?"bg-green-500":"bg-[var(--accent)]"}`,style:{width:`${w}%`}})})]}),f.status==="failed"&&f.error&&a.jsx("div",{className:"mb-3 px-2 py-1.5 bg-red-500/10 border border-red-500/30 rounded text-xs text-red-400 line-clamp-2",children:f.error}),a.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center py-2 border-t border-[var(--border)] mt-auto",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-lg font-bold",children:f.config_ids.length}),a.jsx("div",{className:"text-xs text-[var(--text-secondary)]",children:"configs"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-lg font-bold",children:f.task_ids.length}),a.jsx("div",{className:"text-xs text-[var(--text-secondary)]",children:"tasks"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-lg font-bold",children:f.total_experiments}),a.jsx("div",{className:"text-xs text-[var(--text-secondary)]",children:"runs"})]})]}),a.jsxs("div",{className:"text-xs text-[var(--text-secondary)] pt-2 border-t border-[var(--border)]",children:[new Date(f.created_at).toLocaleDateString()," ",new Date(f.created_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]},f.id)})}),u.length>6&&a.jsxs(B,{variant:"ghost",className:"mt-4",onClick:()=>e("/jobs"),children:["View all ",u.length," jobs →"]})]}),a.jsx(Fx,{isOpen:n,onClose:()=>r(!1),onSubmit:f=>c.mutate(f),isLoading:c.isPending}),s&&a.jsx(Dx,{agent:s,isOpen:!!s,onClose:()=>i(null)})]})}function Mx({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(qy,{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(B,{variant:"primary",icon:dp,onClick:e,children:"Create Your First Agent"})]})}function zx({agent:e,stats:t,onOptimize:n,onDelete:r}){return a.jsxs(ke,{className:"flex flex-col",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg",children:e.name}),e.description&&a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:e.description})]}),a.jsx(B,{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(V,{children:["compaction ",e.config.compaction_head_size,"/",e.config.compaction_tail_size]}),e.config.enable_memory_tool&&a.jsx(V,{children:"memory"}),e.config.enable_sub_agent&&a.jsx(V,{children:"sub-agent"}),a.jsxs(V,{children:["timeout: ",e.config.bash_timeout,"s"]})]}),t.total>0&&a.jsxs("div",{className:"text-xs text-[var(--text-secondary)] mb-3",children:[t.running>0&&a.jsxs("span",{className:"text-[var(--accent)]",children:[t.running," running "]}),t.completed>0&&a.jsxs("span",{children:[t.completed," completed"]})]})]}),a.jsx(B,{variant:"primary",icon:ju,onClick:n,className:"w-full",children:"Optimize"})]})}function Fx({isOpen:e,onClose:t,onSubmit:n,isLoading:r}){const[s,i]=N.useState({name:"",description:"",enable_message_compaction:!0,enable_memory_tool:!0,enable_sub_agent:!1,compaction_head_size:10,compaction_tail_size:40,bash_timeout:120}),l=o=>{o.preventDefault(),s.name.trim()&&n(s)};return a.jsx(Js,{isOpen:e,onClose:t,title:"Create Agent",children:a.jsxs("form",{onSubmit:l,className:"space-y-4",children:[a.jsx(Ke,{label:"Name",value:s.name,onChange:o=>i({...s,name:o.target.value}),placeholder:"e.g., baseline, fast-compaction",required:!0}),a.jsx(Ke,{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(ms,{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(Ke,{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(Ke,{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(ms,{label:"Enable memory tool",checked:s.enable_memory_tool,onChange:o=>i({...s,enable_memory_tool:o.target.checked})}),a.jsx(ms,{label:"Enable sub-agent",checked:s.enable_sub_agent,onChange:o=>i({...s,enable_sub_agent:o.target.checked})})]}),a.jsx(Ke,{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(B,{type:"button",variant:"secondary",onClick:t,children:"Cancel"}),a.jsx(B,{type:"submit",variant:"primary",disabled:!s.name.trim(),loading:r,children:"Create Agent"})]})]})})}function Dx({agent:e,isOpen:t,onClose:n}){const r=Vr(),s=qn(),[i,l]=N.useState("quick"),[o,u]=N.useState(!1),[c,p]=N.useState([]),[h,f]=N.useState(4),[w,S]=N.useState(!1),[g,k]=N.useState("suite"),[m,d]=N.useState(null),{data:v=[]}=_t({queryKey:["tasks"],queryFn:()=>cr.list()}),x=lt({mutationFn:cr.importSuite,onSuccess:_=>{s.invalidateQueries({queryKey:["tasks"]}),p(_.map(A=>A.id))}}),C=lt({mutationFn:async _=>{const A=await Pt.create(_);return Pt.start(A.id).next(),A},onSuccess:_=>{s.invalidateQueries({queryKey:["jobs"]}),d(_.id),k("success")}}),E=[{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}],b=async()=>{k("starting");let _=c;if(!o)try{_=(await x.mutateAsync(i)).map(ot=>ot.id)}catch(he){console.error("Failed to import suite:",he),alert(`Failed to import task suite: ${i}`),k("suite");return}if(_.length===0){alert("No tasks selected. Please select tasks or choose a task suite."),k("suite");return}const A={name:`${e.name} - ${i}`,config_ids:[e.id],task_ids:_,parallel:h,use_llm_eval:w};C.mutate(A)},j=_=>{p(A=>A.includes(_)?A.filter(he=>he!==_):[...A,_])},R=()=>{k("suite"),d(null),n()};return a.jsx(Js,{isOpen:t,onClose:R,title:`Optimize: ${e.name}`,children:g==="success"&&m?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(ju,{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: ",m.slice(0,8),"..."]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(B,{variant:"secondary",onClick:R,children:"Close"}),a.jsx(B,{variant:"primary",icon:xo,onClick:()=>{R(),r(`/jobs/${m}`)},children:"View Job"})]})]}):g==="starting"?a.jsxs("div",{className:"flex flex-col items-center py-8",children:[a.jsx(Cl,{size:32,className:"animate-spin text-[var(--accent)] mb-4"}),a.jsx("p",{className:"text-[var(--text-secondary)]",children:x.isPending?"Importing tasks...":"Creating optimization job..."})]}):a.jsxs("div",{className:"space-y-6",children:[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:E.map(_=>{const A=v.filter(he=>he.suite===_.value).length;return a.jsxs("label",{className:`flex items-center gap-3 p-3 border cursor-pointer transition-colors ${i===_.value&&!o?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--border)] hover:border-[var(--accent-dim)]"}`,children:[a.jsx("input",{type:"radio",name:"suite",value:_.value,checked:i===_.value&&!o,onChange:()=>{l(_.value),u(!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:_.label}),a.jsxs(V,{children:[_.tasks," tasks"]}),A>0&&a.jsxs(V,{variant:"success",children:[A," imported"]})]}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:_.description})]})]},_.value)})})]}),v.length>0&&a.jsxs("div",{children:[a.jsxs("label",{className:`flex items-center gap-3 p-3 border cursor-pointer transition-colors ${o?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--border)] hover:border-[var(--accent-dim)]"}`,children:[a.jsx("input",{type:"radio",checked:o,onChange:()=>u(!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"})]})]}),o&&a.jsx("div",{className:"mt-3 max-h-48 overflow-y-auto border border-[var(--border)] p-2 space-y-1",children:v.map(_=>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:c.includes(_.id),onChange:()=>j(_.id),className:"accent-[var(--accent)]"}),a.jsx("span",{className:"text-sm",children:_.name}),_.suite&&a.jsx(V,{children:_.suite})]},_.id))})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Ke,{label:"Parallel Workers",type:"number",value:h,onChange:_=>f(parseInt(_.target.value)||1),min:1,max:16}),a.jsx("div",{className:"flex items-end pb-1",children:a.jsx(ms,{label:"Use LLM evaluation",checked:w,onChange:_=>S(_.target.checked)})})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-[var(--border)]",children:[a.jsx(B,{variant:"secondary",onClick:n,children:"Cancel"}),a.jsx(B,{variant:"primary",icon:xo,onClick:b,disabled:o&&c.length===0,children:"Start Optimization Job"})]})]})})}const yp=Nu(e=>({configs:[],selectedConfigIds:[],setConfigs:t=>e({configs:t}),toggleConfigSelection:t=>e(n=>({selectedConfigIds:n.selectedConfigIds.includes(t)?n.selectedConfigIds.filter(r=>r!==t):[...n.selectedConfigIds,t]})),clearConfigSelection:()=>e({selectedConfigIds:[]}),tasks:[],selectedTaskIds:[],setTasks:t=>e({tasks:t}),toggleTaskSelection:t=>e(n=>({selectedTaskIds:n.selectedTaskIds.includes(t)?n.selectedTaskIds.filter(r=>r!==t):[...n.selectedTaskIds,t]})),clearTaskSelection:()=>e({selectedTaskIds:[]}),jobs:[],currentJob:null,jobProgress:null,setJobs:t=>e({jobs:t}),setCurrentJob:t=>e({currentJob:t}),setJobProgress:t=>e({jobProgress:t}),updateJob:t=>e(n=>{var r;return{jobs:n.jobs.map(s=>s.id===t.id?t:s),currentJob:((r=n.currentJob)==null?void 0:r.id)===t.id?t:n.currentJob}}),runs:[],setRuns:t=>e({runs:t}),isCreatingJob:!1,setIsCreatingJob:t=>e({isCreatingJob:t})}));function Ax(){const e=qn(),[t,n]=N.useState(!1),[r,s]=N.useState(!1),[i,l]=N.useState(new Set(["custom"])),{selectedTaskIds:o,toggleTaskSelection:u,setTasks:c}=yp(),p=d=>{l(v=>{const x=new Set(v);return x.has(d)?x.delete(d):x.add(d),x})},{data:h=[],isLoading:f}=_t({queryKey:["tasks"],queryFn:()=>cr.list()});N.useEffect(()=>{h.length>0&&c(h)},[h,c]);const w=lt({mutationFn:cr.create,onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),n(!1)}}),S=lt({mutationFn:cr.importSuite,onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),s(!1)}}),g=lt({mutationFn:cr.delete,onSuccess:()=>e.invalidateQueries({queryKey:["tasks"]})}),k=h.reduce((d,v)=>{const x=v.suite||"custom";return d[x]||(d[x]=[]),d[x].push(v),d},{}),m=Object.keys(k).sort((d,v)=>d==="custom"?-1:v==="custom"?1:d.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(B,{variant:"secondary",onClick:()=>s(!0),children:"Import Suite"}),a.jsx(B,{variant:"primary",onClick:()=>n(!0),children:"+ New Task"})]})]}),f?a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Loading..."}):h.length===0?a.jsx("div",{className:"text-center py-12 text-[var(--text-secondary)]",children:"No tasks yet. Create one or import a built-in suite."}):a.jsx("div",{className:"space-y-4",children:m.map(d=>{const v=k[d],x=i.has(d),C=v.filter(E=>o.includes(E.id)).length;return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>p(d),className:"flex items-center gap-2 py-2 hover:text-[var(--accent)] transition-colors",children:[x?a.jsx(Qy,{size:16,className:"text-[var(--text-secondary)]"}):a.jsx(By,{size:16,className:"text-[var(--text-secondary)]"}),a.jsx("h3",{className:"text-sm font-medium uppercase tracking-wide",children:d==="custom"?"Custom Tasks":`${d} Suite`}),a.jsx(V,{variant:d==="custom"?"default":"info",children:v.length}),C>0&&a.jsxs(V,{variant:"success",children:[C," selected"]})]}),x&&a.jsx("div",{className:"grid gap-2 mt-2",children:v.map(E=>a.jsx(ke,{selectable:!0,selected:o.includes(E.id),onClick:()=>u(E.id),children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium",children:E.name}),o.includes(E.id)&&a.jsx(V,{variant:"success",children:"Selected"}),E.category&&E.category!=="default"&&a.jsx(V,{variant:"default",children:E.category})]}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1 line-clamp-2",children:E.prompt}),E.criteria.length>0&&a.jsx("div",{className:"flex gap-1 mt-2 flex-wrap",children:E.criteria.map(b=>a.jsx(V,{variant:"default",children:b.name},b.name))})]}),a.jsx(B,{variant:"ghost",size:"sm",onClick:b=>{b.stopPropagation(),confirm("Delete this task?")&&g.mutate(E.id)},children:"Delete"})]})},E.id))})]},d)})}),a.jsx(Ux,{isOpen:t,onClose:()=>n(!1),onSubmit:d=>w.mutate(d),isLoading:w.isPending}),a.jsx($x,{isOpen:r,onClose:()=>s(!1),onSubmit:d=>S.mutate(d),isLoading:S.isPending})]})}function Ux({isOpen:e,onClose:t,onSubmit:n,isLoading:r}){const[s,i]=N.useState({name:"",prompt:"",criteria:[],category:"default"}),l=()=>{i({...s,criteria:[...s.criteria,{name:"",instruction:"",weight:1}]})},o=(p,h)=>{const f=[...s.criteria];f[p]={...f[p],...h},i({...s,criteria:f})},u=p=>{i({...s,criteria:s.criteria.filter((h,f)=>f!==p)})},c=p=>{p.preventDefault(),!(!s.name.trim()||!s.prompt.trim())&&n({...s,criteria:s.criteria.filter(h=>h.name.trim()&&h.instruction.trim())})};return a.jsx(Js,{isOpen:e,onClose:t,title:"Create Task",children:a.jsxs("form",{onSubmit:c,className:"space-y-4",children:[a.jsx(Ke,{label:"Name",value:s.name,onChange:p=>i({...s,name:p.target.value}),placeholder:"e.g., fizzbuzz",required:!0}),a.jsx(Ix,{label:"Prompt",value:s.prompt,onChange:p=>i({...s,prompt:p.target.value}),placeholder:"The task description for the agent...",required:!0}),a.jsx(Ke,{label:"Category",value:s.category,onChange:p=>i({...s,category:p.target.value}),placeholder:"e.g., coding, research"}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("label",{className:"text-sm text-[var(--text-secondary)]",children:"Evaluation Criteria"}),a.jsx(B,{type:"button",variant:"ghost",size:"sm",onClick:l,children:"+ Add"})]}),a.jsx("div",{className:"space-y-2",children:s.criteria.map((p,h)=>a.jsxs("div",{className:"flex gap-2 items-start",children:[a.jsx(Ke,{value:p.name,onChange:f=>o(h,{name:f.target.value}),placeholder:"Name",className:"w-32"}),a.jsx(Ke,{value:p.instruction,onChange:f=>o(h,{instruction:f.target.value}),placeholder:"Instruction",className:"flex-1"}),a.jsx(B,{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(B,{type:"button",variant:"secondary",onClick:t,children:"Cancel"}),a.jsx(B,{type:"submit",variant:"primary",disabled:r||!s.name.trim()||!s.prompt.trim(),children:r?"Creating...":"Create"})]})]})})}function $x({isOpen:e,onClose:t,onSubmit:n,isLoading:r}){const[s,i]=N.useState("quick"),l=[{value:"quick",label:"Quick (3 tasks) - Fast testing"},{value:"core",label:"Core (5 tasks) - Standard evaluation"},{value:"coding",label:"Coding (10 tasks) - Comprehensive coding"}];return a.jsx(Js,{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(B,{type:"button",variant:"secondary",onClick:t,children:"Cancel"}),a.jsx(B,{variant:"primary",onClick:()=>n(s),disabled:r,children:r?"Importing...":"Import"})]})]})})}function Qx(){const e=Vr(),t=qn(),[n,r]=N.useState(!1),{selectedConfigIds:s,selectedTaskIds:i,configs:l,tasks:o,setJobs:u}=yp(),{data:c=[],isLoading:p}=_t({queryKey:["jobs"],queryFn:()=>Pt.list(),refetchInterval:5e3});N.useEffect(()=>{c.length>0&&u(c)},[c,u]);const h=lt({mutationFn:Pt.create,onSuccess:g=>{t.invalidateQueries({queryKey:["jobs"]}),r(!1),e(`/jobs/${g.id}`)}}),f=lt({mutationFn:Pt.delete,onSuccess:()=>t.invalidateQueries({queryKey:["jobs"]})}),w=s.length>0&&i.length>0,S=g=>{const k={pending:"default",running:"info",completed:"success",failed:"error",cancelled:"warning"};return a.jsx(V,{variant:k[g]||"default",children:g})};return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold",children:"Optimization Jobs"}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:"Run and track optimization experiments."})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[!w&&a.jsx("span",{className:"text-sm text-[var(--text-secondary)]",children:"Select configs and tasks first"}),a.jsxs(B,{variant:"primary",onClick:()=>r(!0),disabled:!w,children:["+ New Job (",s.length,"×",i.length,")"]})]})]}),p?a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Loading..."}):c.length===0?a.jsx("div",{className:"text-center py-12 text-[var(--text-secondary)]",children:"No jobs yet. Select configs and tasks, then create a job."}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:c.map(g=>{const k=g.total_experiments>0?g.completed_experiments/g.total_experiments*100:0;return a.jsxs(ke,{className:"cursor-pointer hover:border-[var(--accent-dim)] flex flex-col",onClick:()=>e(`/jobs/${g.id}`),children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[S(g.status),g.pareto_frontier.length>0&&a.jsxs(V,{variant:"success",children:[g.pareto_frontier.length," Pareto"]}),g.use_llm_eval&&a.jsx(V,{children:"LLM"})]}),a.jsx("h3",{className:"font-medium mt-2 truncate",title:g.name||`Job ${g.id.slice(0,8)}`,children:g.name||`Job ${g.id.slice(0,8)}`}),a.jsxs("code",{className:"text-xs text-[var(--text-secondary)] font-mono",children:[g.id.slice(0,8),"..."]})]}),a.jsx(B,{variant:"ghost",size:"sm",onClick:m=>{m.stopPropagation(),confirm("Delete this job?")&&f.mutate(g.id)},disabled:g.status==="running",children:"×"})]}),(g.status==="running"||g.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:[g.completed_experiments,"/",g.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 ${g.status==="completed"?"bg-green-500":"bg-[var(--accent)]"}`,style:{width:`${k}%`}})})]}),g.status==="failed"&&g.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:g.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:g.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:g.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:g.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(g.created_at).toLocaleDateString()," ",new Date(g.created_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]},g.id)})}),a.jsx(Bx,{isOpen:n,onClose:()=>r(!1),onSubmit:g=>h.mutate(g),isLoading:h.isPending,selectedConfigs:l.filter(g=>s.includes(g.id)),selectedTasks:o.filter(g=>i.includes(g.id))})]})}function Bx({isOpen:e,onClose:t,onSubmit:n,isLoading:r,selectedConfigs:s,selectedTasks:i}){const[l,o]=N.useState({name:"",parallel:4,use_llm_eval:!1}),u=p=>{p.preventDefault(),n({...l,config_ids:s.map(h=>h.id),task_ids:i.map(h=>h.id)})},c=s.length*i.length;return a.jsx(Js,{isOpen:e,onClose:t,title:"Create Optimization Job",children:a.jsxs("form",{onSubmit:u,className:"space-y-4",children:[a.jsx(Ke,{label:"Job Name (optional)",value:l.name,onChange:p=>o({...l,name:p.target.value}),placeholder:"e.g., compaction-test-v1"}),a.jsxs("div",{className:"bg-[var(--bg-primary)] border border-[var(--border)] p-3",children:[a.jsx("div",{className:"text-sm font-medium mb-2",children:"Selected Configurations"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:s.map(p=>a.jsx(V,{children:p.name},p.id))})]}),a.jsxs("div",{className:"bg-[var(--bg-primary)] border border-[var(--border)] p-3",children:[a.jsx("div",{className:"text-sm font-medium mb-2",children:"Selected Tasks"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:i.map(p=>a.jsx(V,{children:p.name},p.id))})]}),a.jsxs("div",{className:"text-sm text-[var(--text-secondary)]",children:["Total experiments: ",a.jsx("span",{className:"text-[var(--accent)]",children:c})]}),a.jsx(Ke,{label:"Parallel Workers",type:"number",value:l.parallel,onChange:p=>o({...l,parallel:parseInt(p.target.value)||1}),min:1,max:16}),a.jsx(ms,{label:"Use LLM evaluation (more accurate but slower)",checked:l.use_llm_eval,onChange:p=>o({...l,use_llm_eval:p.target.checked})}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[a.jsx(B,{type:"button",variant:"secondary",onClick:t,children:"Cancel"}),a.jsx(B,{type:"submit",variant:"primary",disabled:r,children:r?"Creating...":"Create & Start"})]})]})})}function Hx(e,t=!0){return Math.abs(e)<10?"text-[var(--text-secondary)]":(t?e<0:e>0)?"text-green-400":"text-red-400"}function Vx(e){return`${e>0?"+":""}${e.toFixed(1)}%`}function xp(e,t){return t===0?0:(e-t)/t*100}function es({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=xp(l,i),c=o===n;return a.jsxs("td",{className:"py-2 px-4 text-right",children:[a.jsx("div",{className:"font-mono",children:r(l)}),!c&&a.jsx("div",{className:`text-xs ${Hx(u,s)}`,children:Vx(u)}),c&&a.jsx("div",{className:"text-xs text-[var(--text-secondary)]",children:"(baseline)"})]},o)})]})}function Wx({runs:e,baselineRunId:t}){const n=N.useMemo(()=>{if(t){const i=e.findIndex(l=>l.id===t);if(i>=0)return i}return 0},[e,t]);if(e.length<2)return null;const r=Math.min(...e.map(i=>i.tokens_total)),s=Math.max(...e.map(i=>i.score));return a.jsxs(ke,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-4",children:"Config Comparison"}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-[var(--border)]",children:[a.jsx("th",{className:"pb-2 pr-4 text-left text-[var(--text-secondary)] font-medium",children:"Metric"}),e.map((i,l)=>a.jsx("th",{className:"pb-2 px-4 text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("span",{className:"font-medium",children:i.config_name}),i.is_pareto&&a.jsx(V,{variant:"success",children:"Pareto"}),l===n&&a.jsx(V,{variant:"info",children:"Base"})]})},i.id))]})}),a.jsxs("tbody",{children:[a.jsx(es,{label:"Total Tokens",values:e.map(i=>i.tokens_total),baselineIndex:n,formatter:i=>i.toLocaleString(),isLowerBetter:!0}),a.jsx(es,{label:"Input Tokens",values:e.map(i=>i.tokens_input),baselineIndex:n,formatter:i=>i.toLocaleString(),isLowerBetter:!0}),a.jsx(es,{label:"Output Tokens",values:e.map(i=>i.tokens_output),baselineIndex:n,formatter:i=>i.toLocaleString(),isLowerBetter:!0}),a.jsx(es,{label:"Duration",values:e.map(i=>i.duration_seconds),baselineIndex:n,formatter:i=>`${i.toFixed(1)}s`,isLowerBetter:!0}),a.jsx(es,{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=xp(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 Kx(){const{jobId:e}=lp(),t=Vr(),n=qn(),[r,s]=N.useState(null),[i,l]=N.useState(!1),[o,u]=N.useState(null),[c,p]=N.useState([]),[h,f]=N.useState(null),[w,S]=N.useState(null),{data:g,isLoading:k}=_t({queryKey:["jobs",e],queryFn:()=>Pt.get(e),enabled:!!e,refetchInterval:i?2e3:!1}),{data:m=[]}=_t({queryKey:["runs",e],queryFn:()=>wo.list({job_id:e}),enabled:!!e,refetchInterval:i?2e3:!1}),{data:d}=_t({queryKey:["job-summary",e],queryFn:()=>wo.getJobSummary(e),enabled:!!e&&(g==null?void 0:g.status)==="completed"}),v=lt({mutationFn:async()=>{l(!0),p([]),f(null),S(null);for await(const j of Pt.start(e))s(j),j.current_config&&j.current_task&&f(R=>(R&&(R.config!==j.current_config||R.task!==j.current_task)&&p(_=>[..._,{config_name:R.config,task_name:R.task,completed_at:Date.now()}]),{config:j.current_config,task:j.current_task})),j.event==="error"&&(S(j.message),l(!1),n.invalidateQueries({queryKey:["jobs",e]})),j.event==="complete"&&(f(R=>(R&&p(_=>[..._,{config_name:R.config,task_name:R.task,completed_at:Date.now()}]),null)),l(!1),n.invalidateQueries({queryKey:["jobs",e]}),n.invalidateQueries({queryKey:["runs",e]}),n.invalidateQueries({queryKey:["job-summary",e]}))}}),x=lt({mutationFn:()=>Pt.cancel(e),onSuccess:()=>{l(!1),n.invalidateQueries({queryKey:["jobs",e]})}});N.useEffect(()=>{(g==null?void 0:g.status)==="running"&&l(!0)},[g==null?void 0:g.status]);const C=N.useMemo(()=>{const j=new Map;for(const R of m)j.has(R.task_name)||j.set(R.task_name,[]),j.get(R.task_name).push(R);return j},[m]),E=N.useMemo(()=>Array.from(C.keys()),[C]);if(k)return a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Loading..."});if(!g)return a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Job not found"});const b=j=>{const R={pending:"default",running:"info",completed:"success",failed:"error",cancelled:"warning"};return a.jsx(V,{variant:R[j]||"default",children:j})};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:g.name||`Job ${g.id.slice(0,8)}`}),b(g.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:[g.id.slice(0,8),"..."]}),a.jsxs("span",{className:"text-sm text-[var(--text-secondary)]",children:[g.config_ids.length," configs × ",g.task_ids.length," tasks = ",g.total_experiments," experiments"]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[g.status==="pending"&&a.jsx(B,{variant:"primary",onClick:()=>v.mutate(),disabled:v.isPending,children:v.isPending?"Starting...":"Start"}),g.status==="running"&&a.jsx(B,{variant:"danger",onClick:()=>x.mutate(),disabled:x.isPending,children:"Cancel"})]})]}),(w||g.error)&&a.jsx(ke,{className:"mb-6 border-red-500/50 bg-red-500/10",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-5 h-5 rounded-full bg-red-500 flex items-center justify-center text-white text-xs font-bold flex-shrink-0 mt-0.5",children:"!"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-red-400",children:"Error"}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:w||g.error})]})]})}),(i||r)&&a.jsxs(ke,{className:"mb-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"font-medium",children:"Progress"}),a.jsxs("span",{className:"text-[var(--accent)]",children:[(r==null?void 0:r.completed)||g.completed_experiments,"/",(r==null?void 0:r.total)||g.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)||g.completed_experiments)/((r==null?void 0:r.total)||g.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((j,R)=>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:j.config_name}),a.jsx("span",{className:"text-[var(--text-secondary)]",children:"→"}),a.jsx("span",{children:j.task_name})]},`${j.config_name}-${j.task_name}-${R}`))})]})]})]}),d&&a.jsxs(ke,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-4",children:"Results Summary"}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-left text-[var(--text-secondary)] border-b border-[var(--border)]",children:[a.jsx("th",{className:"pb-2",children:"Config"}),a.jsx("th",{className:"pb-2",children:"Avg Score"}),a.jsx("th",{className:"pb-2",children:"Avg Tokens"}),a.jsx("th",{className:"pb-2",children:"Pass Rate"}),a.jsx("th",{className:"pb-2",children:"Pareto"})]})}),a.jsx("tbody",{children:d.config_summaries.map(j=>a.jsxs("tr",{className:"border-b border-[var(--border)]",children:[a.jsx("td",{className:"py-2 font-medium",children:j.config_name}),a.jsxs("td",{className:"py-2",children:[(j.avg_score*100).toFixed(1),"%"]}),a.jsx("td",{className:"py-2",children:j.avg_tokens.toLocaleString()}),a.jsxs("td",{className:"py-2",children:[j.passed_runs,"/",j.total_runs]}),a.jsx("td",{className:"py-2",children:j.is_pareto&&a.jsx(V,{variant:"success",children:"Pareto"})})]},j.config_name))})]})})]}),g.status==="completed"&&E.length>0&&a.jsxs(ke,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-4",children:"Compare Configs by Task"}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:E.map(j=>a.jsx("button",{onClick:()=>u(o===j?null:j),className:`px-3 py-1 text-sm rounded border transition-colors ${o===j?"bg-[var(--accent)] text-white border-[var(--accent)]":"border-[var(--border)] hover:border-[var(--accent-dim)]"}`,children:j},j))}),o&&C.get(o)&&a.jsx(Wx,{runs:C.get(o).map(j=>({id:j.id,config_name:j.config_name,tokens_input:0,tokens_output:0,tokens_total:j.tokens_total,duration_seconds:j.duration_seconds,score:j.score,passed:j.passed,is_pareto:j.is_pareto}))})]}),a.jsxs("div",{children:[a.jsxs("h3",{className:"font-medium mb-4",children:["Runs (",m.length,"/",g.total_experiments,")"]}),m.length===0?a.jsx("div",{className:"text-center py-8 text-[var(--text-secondary)]",children:i?"Runs will appear here after the job completes. See progress above for live status.":"No runs yet. Start the job to see results."}):a.jsx("div",{className:"grid gap-2",children:m.map(j=>a.jsx(ke,{className:"cursor-pointer hover:border-[var(--accent-dim)]",onClick:()=>t(`/runs/${j.id}`),children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("span",{className:"font-medium",children:j.config_name}),a.jsx("span",{className:"text-[var(--text-secondary)]",children:"→"}),a.jsx("span",{children:j.task_name})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:j.passed?"text-green-400":"text-red-400",children:[(j.score*100).toFixed(0),"%"]}),a.jsxs("span",{className:"text-[var(--text-secondary)] text-sm",children:[j.tokens_total.toLocaleString()," tokens"]}),a.jsxs("span",{className:"text-[var(--text-secondary)] text-sm",children:[j.duration_seconds.toFixed(1),"s"]}),j.is_pareto&&a.jsx(V,{variant:"success",children:"Pareto"})]})]})},j.id))})]})]})}function qx(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 Jx(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 Gx(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 Yx(e){return e>=1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(0)}ms`}function wp({node:e,depth:t=0}){var h,f;const[n,r]=N.useState(t<2),[s,i]=N.useState(!1),{span:l}=e,o=e.children.length>0,u=(h=l.attributes)==null?void 0:h["gen_ai.usage.input_tokens"],c=(f=l.attributes)==null?void 0:f["gen_ai.usage.output_tokens"],p=u!==void 0||c!==void 0;return a.jsxs("div",{className:"relative",children:[t>0&&a.jsx("div",{className:"absolute left-0 top-0 bottom-0 border-l-2 border-[var(--border)]",style:{marginLeft:`${(t-1)*16+8}px`}}),a.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-1 hover:bg-[var(--bg-primary)] rounded transition-colors cursor-pointer",style:{paddingLeft:`${t*16}px`},onClick:()=>o?r(!n):i(!s),children:[a.jsx("div",{className:"w-4 h-4 flex items-center justify-center text-[var(--text-secondary)]",children:o?n?"▼":"▶":s?"▼":"▶"}),a.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded font-medium ${Gx(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:Yx(l.duration_ms)}),p&&a.jsxs("span",{className:"text-xs text-[var(--text-secondary)] font-mono",children:[u!==void 0&&a.jsxs("span",{className:"text-blue-400",children:["↑",String(u)]}),u!==void 0&&c!==void 0&&a.jsx("span",{className:"mx-0.5",children:"/"}),c!==void 0&&a.jsxs("span",{className:"text-green-400",children:["↓",String(c)]})]})]}),s&&!o&&a.jsx("div",{className:"ml-4 mt-1 mb-2 p-2 bg-[var(--bg-primary)] rounded border border-[var(--border)] text-xs",style:{marginLeft:`${t*16+20}px`},children:a.jsxs("div",{className:"space-y-1",children:[l.span_id&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx("span",{className:"text-[var(--text-secondary)] w-20",children:"Span ID:"}),a.jsx("span",{className:"font-mono text-xs break-all",children:l.span_id})]}),l.trace_id&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx("span",{className:"text-[var(--text-secondary)] w-20",children:"Trace ID:"}),a.jsx("span",{className:"font-mono text-xs break-all",children:l.trace_id})]}),l.status&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx("span",{className:"text-[var(--text-secondary)] w-20",children:"Status:"}),a.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs ${l.status==="OK"||l.status==="StatusCode.UNSET"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}`,children:l.status})]}),Object.keys(l.attributes||{}).length>0&&a.jsxs("div",{className:"mt-2",children:[a.jsx("span",{className:"text-[var(--text-secondary)] block mb-1",children:"Attributes:"}),a.jsx("pre",{className:"text-xs bg-[var(--bg-secondary)] border border-[var(--border)] rounded p-2 overflow-auto max-h-32 whitespace-pre-wrap break-all",children:JSON.stringify(l.attributes,null,2)})]})]})}),o&&n&&a.jsx("div",{children:e.children.map((w,S)=>a.jsx(wp,{node:w,depth:t+1},w.span.span_id||S))})]})}function Xx({trace:e}){const[t,n]=N.useState("tree"),r=N.useMemo(()=>qx(e),[e]),s=N.useMemo(()=>Jx(r),[r]);return Object.keys(e).length===0?null:a.jsxs(ke,{className:"mb-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h3",{className:"font-medium",children:"Trace Data"}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{onClick:()=>n("tree"),className:`px-2 py-1 text-xs rounded ${t==="tree"?"bg-[var(--accent)] text-white":"bg-[var(--bg-primary)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:"Tree"}),a.jsx("button",{onClick:()=>n("raw"),className:`px-2 py-1 text-xs rounded ${t==="raw"?"bg-[var(--accent)] text-white":"bg-[var(--bg-primary)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:"Raw"})]})]}),t==="tree"?r.length>0?a.jsx("div",{className:"border border-[var(--border)] rounded overflow-hidden",children:a.jsxs("div",{className:"p-2",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2 text-xs text-[var(--text-secondary)]",children:[a.jsxs(V,{variant:"default",children:[r.length," spans"]}),a.jsx("span",{children:"•"}),a.jsx("span",{children:"Click to expand details"})]}),s.map((i,l)=>a.jsx(wp,{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 tn={input:"bg-blue-500",output:"bg-emerald-500",inputText:"text-blue-400",outputText:"text-emerald-400"};function hd(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function pd({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 ${tn.input} transition-all`,style:{width:`${e/i*100}%`},title:`Input: ${e.toLocaleString()} tokens`}),a.jsx("div",{className:`h-full ${tn.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:tn.inputText,children:["↑",hd(e)]}),a.jsx("span",{children:"/"}),a.jsxs("span",{className:tn.outputText,children:["↓",hd(t)]})]})]})}function la({label:e,value:t,color:n="default"}){const r={default:"text-[var(--text-primary)]",input:tn.inputText,output:tn.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 Zx({tokensInput:e,tokensOutput:t,tokensTotal:n,turns:r}){const s=n>0?Math.round(e/n*100):0,i=n>0?Math.round(t/n*100):0,l=N.useMemo(()=>{if(!r||r.length===0)return null;let u=0,c=0;return r.map(p=>(u+=p.input,c+=p.output,{input:u,output:c,total:u+c}))},[r]),o=l?Math.max(...l.map(u=>u.total)):n;return a.jsxs(ke,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-4",children:"Token Usage"}),a.jsx("div",{className:"mb-4",children:a.jsx(pd,{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 ${tn.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 ${tn.output}`}),a.jsxs("span",{className:"text-[var(--text-secondary)]",children:["Output (",i,"%)"]})]})]}),a.jsxs("div",{className:"flex gap-3 mb-4",children:[a.jsx(la,{label:"Input Tokens",value:e.toLocaleString(),color:"input"}),a.jsx(la,{label:"Output Tokens",value:t.toLocaleString(),color:"output"}),a.jsx(la,{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(pd,{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 e0(){const{runId:e}=lp(),t=Vr(),{data:n,isLoading:r}=_t({queryKey:["runs",e],queryFn:()=>wo.get(e),enabled:!!e});return r?a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Loading..."}):n?a.jsxs("div",{children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("div",{className:"flex items-center gap-3 mb-2",children:a.jsx("button",{onClick:()=>t(`/jobs/${n.job_id}`),className:"text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:"← Back to Job"})}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h2",{className:"text-xl font-bold",children:n.config_name}),a.jsx("span",{className:"text-[var(--text-secondary)]",children:"→"}),a.jsx("span",{className:"text-lg",children:n.task_name}),n.is_pareto&&a.jsx(V,{variant:"success",children:"Pareto Optimal"})]})]}),a.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[a.jsx(gi,{label:"Score",value:`${(n.score*100).toFixed(1)}%`,status:n.passed?"success":"error"}),a.jsx(gi,{label:"Total Tokens",value:n.tokens_total.toLocaleString()}),a.jsx(gi,{label:"Duration",value:`${n.duration_seconds.toFixed(1)}s`}),a.jsx(gi,{label:"Status",value:n.passed?"Passed":"Failed",status:n.passed?"success":"error"})]}),a.jsx(Zx,{tokensInput:n.tokens_input,tokensOutput:n.tokens_output,tokensTotal:n.tokens_total}),a.jsxs(ke,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-3",children:"Evaluation"}),n.reasoning&&a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:n.reasoning}),n.criteria_results.length>0&&a.jsx("div",{className:"space-y-2",children:n.criteria_results.map(s=>a.jsx("div",{className:"flex items-start justify-between p-3 bg-[var(--bg-primary)] border border-[var(--border)]",children:a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium",children:s.name}),a.jsxs(V,{variant:s.passed?"success":"error",children:[(s.score*100).toFixed(0),"%"]})]}),s.reasoning&&a.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:s.reasoning})]})},s.name))})]}),a.jsxs(ke,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-3",children:"Agent Output"}),a.jsx("pre",{className:"text-sm bg-[var(--bg-primary)] p-3 overflow-x-auto whitespace-pre-wrap border border-[var(--border)]",children:n.output||"(no output)"})]}),n.files_created.length>0&&a.jsxs(ke,{className:"mb-6",children:[a.jsx("h3",{className:"font-medium mb-3",children:"Files Created"}),a.jsx("div",{className:"space-y-1",children:n.files_created.map(s=>a.jsx("div",{className:"text-sm font-mono text-[var(--text-secondary)]",children:s},s))})]}),Object.keys(n.trace).length>0&&a.jsx(Xx,{trace:n.trace})]}):a.jsx("div",{className:"text-[var(--text-secondary)]",children:"Run not found"})}function gi({label:e,value:t,status:n}){const r={success:"text-green-400",error:"text-red-400"};return a.jsxs(ke,{children:[a.jsx("div",{className:"text-sm text-[var(--text-secondary)]",children:e}),a.jsx("div",{className:`text-xl font-bold ${n?r[n]:""}`,children:t})]})}function t0(){const{authConfig:e,isLoading:t,error:n,login:r,loginWithGitHub:s,clearError:i}=bu(),[l,o]=N.useState(""),[u,c]=N.useState("");N.useEffect(()=>{n&&i()},[l,u]);const p=async f=>{f.preventDefault(),!(!l||!u)&&await r(l,u)},h=()=>{s()};return a.jsx("div",{className:"min-h-screen bg-[var(--bg-primary)] flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-md",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:"Flow"}),a.jsx("p",{className:"text-[var(--text-secondary)]",children:"Sign in to access the optimization dashboard"})]}),a.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border)] p-6 space-y-6",children:[n&&a.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[var(--error)]/10 border border-[var(--error)]/20 text-[var(--error)]",children:[a.jsx(Uy,{size:18,className:"mt-0.5 flex-shrink-0"}),a.jsx("p",{className:"text-sm",children:n})]}),(e==null?void 0:e.mode)==="basic"&&a.jsxs("form",{onSubmit:p,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-sm text-[var(--text-secondary)]",children:"Username"}),a.jsxs("div",{className:"relative",children:[a.jsx(fp,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)]"}),a.jsx("input",{type:"text",value:l,onChange:f=>o(f.target.value),className:"w-full bg-[var(--bg-primary)] border border-[var(--border)] pl-10 pr-3 py-2 text-sm focus:outline-none focus:border-[var(--accent)]",placeholder:"Enter username",autoComplete:"username",autoFocus:!0})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-sm text-[var(--text-secondary)]",children:"Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Wy,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)]"}),a.jsx("input",{type:"password",value:u,onChange:f=>c(f.target.value),className:"w-full bg-[var(--bg-primary)] border border-[var(--border)] pl-10 pr-3 py-2 text-sm focus:outline-none focus:border-[var(--accent)]",placeholder:"Enter password",autoComplete:"current-password"})]})]}),a.jsx(B,{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(B,{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 n0({children:e}){const{authConfig:t,isLoadingConfig:n,isAuthenticated:r,loadAuthConfig:s,handleOAuthCallback:i}=bu();return N.useEffect(()=>{s()},[s]),N.useEffect(()=>{n||i()},[n,i]),n?a.jsx("div",{className:"min-h-screen bg-[var(--bg-primary)] flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx(Cl,{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(t0,{}):a.jsx(a.Fragment,{children:e})}function r0(){return a.jsx(Oy,{children:a.jsx(n0,{children:a.jsx(jy,{children:a.jsxs(Dt,{path:"/",element:a.jsx(Lx,{}),children:[a.jsx(Dt,{index:!0,element:a.jsx(fd,{})}),a.jsx(Dt,{path:"agents",element:a.jsx(fd,{})}),a.jsx(Dt,{path:"tasks",element:a.jsx(Ax,{})}),a.jsx(Dt,{path:"jobs",element:a.jsx(Qx,{})}),a.jsx(Dt,{path:"jobs/:jobId",element:a.jsx(Kx,{})}),a.jsx(Dt,{path:"runs/:runId",element:a.jsx(e0,{})})]})})})})}const md=localStorage.getItem("flow-theme");if(md)try{const{state:e}=JSON.parse(md);e!=null&&e.theme&&document.documentElement.setAttribute("data-theme",e.theme)}catch{}const s0=new yg({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!1}}});aa.createRoot(document.getElementById("root")).render(a.jsx(Eo.StrictMode,{children:a.jsx(xg,{client:s0,children:a.jsx(r0,{})})}));