vskill 0.5.82 → 0.5.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/agents-registry.d.ts +4 -0
- package/dist/agents/agents-registry.js +1 -0
- package/dist/agents/agents-registry.js.map +1 -1
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +30 -0
- package/dist/bin.js.map +1 -0
- package/dist/commands/eval/serve.js +3 -3
- package/dist/commands/eval/serve.js.map +1 -1
- package/dist/eval-server/api-routes.d.ts +33 -0
- package/dist/eval-server/api-routes.js +202 -0
- package/dist/eval-server/api-routes.js.map +1 -1
- package/dist/eval-ui/assets/CommandPalette-Zop9jgyY.js +1 -0
- package/dist/eval-ui/assets/fonts-i7Lkz2zN.css +1 -0
- package/dist/eval-ui/assets/index-DS30At-e.css +1 -0
- package/dist/eval-ui/assets/index-PsfutY7X.js +65 -0
- package/dist/eval-ui/assets/inter-tight-cyrillic-ext-wght-normal-okcGN4Nq.woff2 +0 -0
- package/dist/eval-ui/assets/inter-tight-cyrillic-wght-normal-BS41q_Tv.woff2 +0 -0
- package/dist/eval-ui/assets/inter-tight-greek-ext-wght-normal-DQgQPNk4.woff2 +0 -0
- package/dist/eval-ui/assets/inter-tight-greek-wght-normal-sS1B39LI.woff2 +0 -0
- package/dist/eval-ui/assets/inter-tight-latin-ext-wght-normal-B4u9PlvR.woff2 +0 -0
- package/dist/eval-ui/assets/inter-tight-latin-wght-normal-DX-nOvPD.woff2 +0 -0
- package/dist/eval-ui/assets/inter-tight-vietnamese-wght-normal-TKKdAiBA.woff2 +0 -0
- package/dist/eval-ui/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/eval-ui/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/eval-ui/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/eval-ui/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/eval-ui/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-cyrillic-ext-wght-normal-cHuGMAiY.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-cyrillic-wght-normal-DwHjdM4S.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-greek-wght-normal-ece1310W.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-latin-ext-wght-normal-CxNHBx-q.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-latin-wght-normal-D9elroTD.woff2 +0 -0
- package/dist/eval-ui/assets/source-serif-4-vietnamese-wght-normal-D-yuW59g.woff2 +0 -0
- package/dist/eval-ui/index.html +45 -2
- package/dist/utils/skill-creator-detection.d.ts +5 -1
- package/dist/utils/skill-creator-detection.js +33 -2
- package/dist/utils/skill-creator-detection.js.map +1 -1
- package/package.json +17 -4
- package/dist/eval-ui/assets/index-D2OKy2AG.js +0 -74
- package/dist/eval-ui/assets/index-tEmr_c8l.css +0 -1
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const x of document.querySelectorAll('link[rel="modulepreload"]'))u(x);new MutationObserver(x=>{for(const v of x)if(v.type==="childList")for(const m of v.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&u(m)}).observe(document,{childList:!0,subtree:!0});function c(x){const v={};return x.integrity&&(v.integrity=x.integrity),x.referrerPolicy&&(v.referrerPolicy=x.referrerPolicy),x.crossOrigin==="use-credentials"?v.credentials="include":x.crossOrigin==="anonymous"?v.credentials="omit":v.credentials="same-origin",v}function u(x){if(x.ep)return;x.ep=!0;const v=c(x);fetch(x.href,v)}})();var Po={exports:{}},is={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var gx;function Mh(){if(gx)return is;gx=1;var s=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function c(u,x,v){var m=null;if(v!==void 0&&(m=""+v),x.key!==void 0&&(m=""+x.key),"key"in x){v={};for(var b in x)b!=="key"&&(v[b]=x[b])}else v=x;return x=v.ref,{$$typeof:s,type:u,key:m,ref:x!==void 0?x:null,props:v}}return is.Fragment=o,is.jsx=c,is.jsxs=c,is}var bx;function _h(){return bx||(bx=1,Po.exports=Mh()),Po.exports}var l=_h(),ec={exports:{}},je={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var jx;function Lh(){if(jx)return je;jx=1;var s=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),m=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),k=Symbol.iterator;function C(N){return N===null||typeof N!="object"?null:(N=k&&N[k]||N["@@iterator"],typeof N=="function"?N:null)}var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,G={};function D(N,H,ae){this.props=N,this.context=H,this.refs=G,this.updater=ae||B}D.prototype.isReactComponent={},D.prototype.setState=function(N,H){if(typeof N!="object"&&typeof N!="function"&&N!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,N,H,"setState")},D.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function X(){}X.prototype=D.prototype;function J(N,H,ae){this.props=N,this.context=H,this.refs=G,this.updater=ae||B}var F=J.prototype=new X;F.constructor=J,_(F,D.prototype),F.isPureReactComponent=!0;var Y=Array.isArray;function I(){}var O={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function M(N,H,ae){var se=ae.ref;return{$$typeof:s,type:N,key:H,ref:se!==void 0?se:null,props:ae}}function $(N,H){return M(N.type,H,N.props)}function P(N){return typeof N=="object"&&N!==null&&N.$$typeof===s}function te(N){var H={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(ae){return H[ae]})}var oe=/\/+/g;function ne(N,H){return typeof N=="object"&&N!==null&&N.key!=null?te(""+N.key):H.toString(36)}function w(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(I,I):(N.status="pending",N.then(function(H){N.status==="pending"&&(N.status="fulfilled",N.value=H)},function(H){N.status==="pending"&&(N.status="rejected",N.reason=H)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function S(N,H,ae,se,fe){var xe=typeof N;(xe==="undefined"||xe==="boolean")&&(N=null);var ye=!1;if(N===null)ye=!0;else switch(xe){case"bigint":case"string":case"number":ye=!0;break;case"object":switch(N.$$typeof){case s:case o:ye=!0;break;case j:return ye=N._init,S(ye(N._payload),H,ae,se,fe)}}if(ye)return fe=fe(N),ye=se===""?"."+ne(N,0):se,Y(fe)?(ae="",ye!=null&&(ae=ye.replace(oe,"$&/")+"/"),S(fe,H,ae,"",function(ft){return ft})):fe!=null&&(P(fe)&&(fe=$(fe,ae+(fe.key==null||N&&N.key===fe.key?"":(""+fe.key).replace(oe,"$&/")+"/")+ye)),H.push(fe)),1;ye=0;var Ge=se===""?".":se+":";if(Y(N))for(var ze=0;ze<N.length;ze++)se=N[ze],xe=Ge+ne(se,ze),ye+=S(se,H,ae,xe,fe);else if(ze=C(N),typeof ze=="function")for(N=ze.call(N),ze=0;!(se=N.next()).done;)se=se.value,xe=Ge+ne(se,ze++),ye+=S(se,H,ae,xe,fe);else if(xe==="object"){if(typeof N.then=="function")return S(w(N),H,ae,se,fe);throw H=String(N),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return ye}function A(N,H,ae){if(N==null)return N;var se=[],fe=0;return S(N,se,"","",function(xe){return H.call(ae,xe,fe++)}),se}function le(N){if(N._status===-1){var H=N._result;H=H(),H.then(function(ae){(N._status===0||N._status===-1)&&(N._status=1,N._result=ae)},function(ae){(N._status===0||N._status===-1)&&(N._status=2,N._result=ae)}),N._status===-1&&(N._status=0,N._result=H)}if(N._status===1)return N._result.default;throw N._result}var V=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},ue={map:A,forEach:function(N,H,ae){A(N,function(){H.apply(this,arguments)},ae)},count:function(N){var H=0;return A(N,function(){H++}),H},toArray:function(N){return A(N,function(H){return H})||[]},only:function(N){if(!P(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return je.Activity=y,je.Children=ue,je.Component=D,je.Fragment=c,je.Profiler=x,je.PureComponent=J,je.StrictMode=u,je.Suspense=g,je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,je.__COMPILER_RUNTIME={__proto__:null,c:function(N){return O.H.useMemoCache(N)}},je.cache=function(N){return function(){return N.apply(null,arguments)}},je.cacheSignal=function(){return null},je.cloneElement=function(N,H,ae){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var se=_({},N.props),fe=N.key;if(H!=null)for(xe in H.key!==void 0&&(fe=""+H.key),H)!W.call(H,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&H.ref===void 0||(se[xe]=H[xe]);var xe=arguments.length-2;if(xe===1)se.children=ae;else if(1<xe){for(var ye=Array(xe),Ge=0;Ge<xe;Ge++)ye[Ge]=arguments[Ge+2];se.children=ye}return M(N.type,fe,se)},je.createContext=function(N){return N={$$typeof:m,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:v,_context:N},N},je.createElement=function(N,H,ae){var se,fe={},xe=null;if(H!=null)for(se in H.key!==void 0&&(xe=""+H.key),H)W.call(H,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(fe[se]=H[se]);var ye=arguments.length-2;if(ye===1)fe.children=ae;else if(1<ye){for(var Ge=Array(ye),ze=0;ze<ye;ze++)Ge[ze]=arguments[ze+2];fe.children=Ge}if(N&&N.defaultProps)for(se in ye=N.defaultProps,ye)fe[se]===void 0&&(fe[se]=ye[se]);return M(N,xe,fe)},je.createRef=function(){return{current:null}},je.forwardRef=function(N){return{$$typeof:b,render:N}},je.isValidElement=P,je.lazy=function(N){return{$$typeof:j,_payload:{_status:-1,_result:N},_init:le}},je.memo=function(N,H){return{$$typeof:f,type:N,compare:H===void 0?null:H}},je.startTransition=function(N){var H=O.T,ae={};O.T=ae;try{var se=N(),fe=O.S;fe!==null&&fe(ae,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(I,V)}catch(xe){V(xe)}finally{H!==null&&ae.types!==null&&(H.types=ae.types),O.T=H}},je.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},je.use=function(N){return O.H.use(N)},je.useActionState=function(N,H,ae){return O.H.useActionState(N,H,ae)},je.useCallback=function(N,H){return O.H.useCallback(N,H)},je.useContext=function(N){return O.H.useContext(N)},je.useDebugValue=function(){},je.useDeferredValue=function(N,H){return O.H.useDeferredValue(N,H)},je.useEffect=function(N,H){return O.H.useEffect(N,H)},je.useEffectEvent=function(N){return O.H.useEffectEvent(N)},je.useId=function(){return O.H.useId()},je.useImperativeHandle=function(N,H,ae){return O.H.useImperativeHandle(N,H,ae)},je.useInsertionEffect=function(N,H){return O.H.useInsertionEffect(N,H)},je.useLayoutEffect=function(N,H){return O.H.useLayoutEffect(N,H)},je.useMemo=function(N,H){return O.H.useMemo(N,H)},je.useOptimistic=function(N,H){return O.H.useOptimistic(N,H)},je.useReducer=function(N,H,ae){return O.H.useReducer(N,H,ae)},je.useRef=function(N){return O.H.useRef(N)},je.useState=function(N){return O.H.useState(N)},je.useSyncExternalStore=function(N,H,ae){return O.H.useSyncExternalStore(N,H,ae)},je.useTransition=function(){return O.H.useTransition()},je.version="19.2.4",je}var Sx;function jc(){return Sx||(Sx=1,ec.exports=Lh()),ec.exports}var p=jc(),tc={exports:{}},os={},ac={exports:{}},lc={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var Nx;function zh(){return Nx||(Nx=1,(function(s){function o(S,A){var le=S.length;S.push(A);e:for(;0<le;){var V=le-1>>>1,ue=S[V];if(0<x(ue,A))S[V]=A,S[le]=ue,le=V;else break e}}function c(S){return S.length===0?null:S[0]}function u(S){if(S.length===0)return null;var A=S[0],le=S.pop();if(le!==A){S[0]=le;e:for(var V=0,ue=S.length,N=ue>>>1;V<N;){var H=2*(V+1)-1,ae=S[H],se=H+1,fe=S[se];if(0>x(ae,le))se<ue&&0>x(fe,ae)?(S[V]=fe,S[se]=le,V=se):(S[V]=ae,S[H]=le,V=H);else if(se<ue&&0>x(fe,le))S[V]=fe,S[se]=le,V=se;else break e}}return A}function x(S,A){var le=S.sortIndex-A.sortIndex;return le!==0?le:S.id-A.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var v=performance;s.unstable_now=function(){return v.now()}}else{var m=Date,b=m.now();s.unstable_now=function(){return m.now()-b}}var g=[],f=[],j=1,y=null,k=3,C=!1,B=!1,_=!1,G=!1,D=typeof setTimeout=="function"?setTimeout:null,X=typeof clearTimeout=="function"?clearTimeout:null,J=typeof setImmediate<"u"?setImmediate:null;function F(S){for(var A=c(f);A!==null;){if(A.callback===null)u(f);else if(A.startTime<=S)u(f),A.sortIndex=A.expirationTime,o(g,A);else break;A=c(f)}}function Y(S){if(_=!1,F(S),!B)if(c(g)!==null)B=!0,I||(I=!0,te());else{var A=c(f);A!==null&&w(Y,A.startTime-S)}}var I=!1,O=-1,W=5,M=-1;function $(){return G?!0:!(s.unstable_now()-M<W)}function P(){if(G=!1,I){var S=s.unstable_now();M=S;var A=!0;try{e:{B=!1,_&&(_=!1,X(O),O=-1),C=!0;var le=k;try{t:{for(F(S),y=c(g);y!==null&&!(y.expirationTime>S&&$());){var V=y.callback;if(typeof V=="function"){y.callback=null,k=y.priorityLevel;var ue=V(y.expirationTime<=S);if(S=s.unstable_now(),typeof ue=="function"){y.callback=ue,F(S),A=!0;break t}y===c(g)&&u(g),F(S)}else u(g);y=c(g)}if(y!==null)A=!0;else{var N=c(f);N!==null&&w(Y,N.startTime-S),A=!1}}break e}finally{y=null,k=le,C=!1}A=void 0}}finally{A?te():I=!1}}}var te;if(typeof J=="function")te=function(){J(P)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,ne=oe.port2;oe.port1.onmessage=P,te=function(){ne.postMessage(null)}}else te=function(){D(P,0)};function w(S,A){O=D(function(){S(s.unstable_now())},A)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(S){S.callback=null},s.unstable_forceFrameRate=function(S){0>S||125<S?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<S?Math.floor(1e3/S):5},s.unstable_getCurrentPriorityLevel=function(){return k},s.unstable_next=function(S){switch(k){case 1:case 2:case 3:var A=3;break;default:A=k}var le=k;k=A;try{return S()}finally{k=le}},s.unstable_requestPaint=function(){G=!0},s.unstable_runWithPriority=function(S,A){switch(S){case 1:case 2:case 3:case 4:case 5:break;default:S=3}var le=k;k=S;try{return A()}finally{k=le}},s.unstable_scheduleCallback=function(S,A,le){var V=s.unstable_now();switch(typeof le=="object"&&le!==null?(le=le.delay,le=typeof le=="number"&&0<le?V+le:V):le=V,S){case 1:var ue=-1;break;case 2:ue=250;break;case 5:ue=1073741823;break;case 4:ue=1e4;break;default:ue=5e3}return ue=le+ue,S={id:j++,callback:A,priorityLevel:S,startTime:le,expirationTime:ue,sortIndex:-1},le>V?(S.sortIndex=le,o(f,S),c(g)===null&&S===c(f)&&(_?(X(O),O=-1):_=!0,w(Y,le-V))):(S.sortIndex=ue,o(g,S),B||C||(B=!0,I||(I=!0,te()))),S},s.unstable_shouldYield=$,s.unstable_wrapCallback=function(S){var A=k;return function(){var le=k;k=A;try{return S.apply(this,arguments)}finally{k=le}}}})(lc)),lc}var kx;function Dh(){return kx||(kx=1,ac.exports=zh()),ac.exports}var nc={exports:{}},St={};/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var Ex;function Oh(){if(Ex)return St;Ex=1;var s=jc();function o(g){var f="https://react.dev/errors/"+g;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var j=2;j<arguments.length;j++)f+="&args[]="+encodeURIComponent(arguments[j])}return"Minified React error #"+g+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(){}var u={d:{f:c,r:function(){throw Error(o(522))},D:c,C:c,L:c,m:c,X:c,S:c,M:c},p:0,findDOMNode:null},x=Symbol.for("react.portal");function v(g,f,j){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:x,key:y==null?null:""+y,children:g,containerInfo:f,implementation:j}}var m=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function b(g,f){if(g==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return St.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=u,St.createPortal=function(g,f){var j=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(o(299));return v(g,f,null,j)},St.flushSync=function(g){var f=m.T,j=u.p;try{if(m.T=null,u.p=2,g)return g()}finally{m.T=f,u.p=j,u.d.f()}},St.preconnect=function(g,f){typeof g=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,u.d.C(g,f))},St.prefetchDNS=function(g){typeof g=="string"&&u.d.D(g)},St.preinit=function(g,f){if(typeof g=="string"&&f&&typeof f.as=="string"){var j=f.as,y=b(j,f.crossOrigin),k=typeof f.integrity=="string"?f.integrity:void 0,C=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;j==="style"?u.d.S(g,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:y,integrity:k,fetchPriority:C}):j==="script"&&u.d.X(g,{crossOrigin:y,integrity:k,fetchPriority:C,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},St.preinitModule=function(g,f){if(typeof g=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var j=b(f.as,f.crossOrigin);u.d.M(g,{crossOrigin:j,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&u.d.M(g)},St.preload=function(g,f){if(typeof g=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var j=f.as,y=b(j,f.crossOrigin);u.d.L(g,j,{crossOrigin:y,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},St.preloadModule=function(g,f){if(typeof g=="string")if(f){var j=b(f.as,f.crossOrigin);u.d.m(g,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:j,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else u.d.m(g)},St.requestFormReset=function(g){u.d.r(g)},St.unstable_batchedUpdates=function(g,f){return g(f)},St.useFormState=function(g,f,j){return m.H.useFormState(g,f,j)},St.useFormStatus=function(){return m.H.useHostTransitionStatus()},St.version="19.2.4",St}var Cx;function Bh(){if(Cx)return nc.exports;Cx=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(o){console.error(o)}}return s(),nc.exports=Oh(),nc.exports}/**
|
|
34
|
-
* @license React
|
|
35
|
-
* react-dom-client.production.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var wx;function Uh(){if(wx)return os;wx=1;var s=Dh(),o=jc(),c=Bh();function u(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function x(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function v(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function m(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function b(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(v(e)!==e)throw Error(u(188))}function f(e){var t=e.alternate;if(!t){if(t=v(e),t===null)throw Error(u(188));return t!==e?null:e}for(var a=e,n=t;;){var r=a.return;if(r===null)break;var i=r.alternate;if(i===null){if(n=r.return,n!==null){a=n;continue}break}if(r.child===i.child){for(i=r.child;i;){if(i===a)return g(r),e;if(i===n)return g(r),t;i=i.sibling}throw Error(u(188))}if(a.return!==n.return)a=r,n=i;else{for(var d=!1,h=r.child;h;){if(h===a){d=!0,a=r,n=i;break}if(h===n){d=!0,n=r,a=i;break}h=h.sibling}if(!d){for(h=i.child;h;){if(h===a){d=!0,a=i,n=r;break}if(h===n){d=!0,n=i,a=r;break}h=h.sibling}if(!d)throw Error(u(189))}}if(a.alternate!==n)throw Error(u(190))}if(a.tag!==3)throw Error(u(188));return a.stateNode.current===a?e:t}function j(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=j(e),t!==null)return t;e=e.sibling}return null}var y=Object.assign,k=Symbol.for("react.element"),C=Symbol.for("react.transitional.element"),B=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),X=Symbol.for("react.consumer"),J=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),$=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function te(e){return e===null||typeof e!="object"?null:(e=P&&e[P]||e["@@iterator"],typeof e=="function"?e:null)}var oe=Symbol.for("react.client.reference");function ne(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case _:return"Fragment";case D:return"Profiler";case G:return"StrictMode";case Y:return"Suspense";case I:return"SuspenseList";case M:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case B:return"Portal";case J:return e.displayName||"Context";case X:return(e._context.displayName||"Context")+".Consumer";case F:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case O:return t=e.displayName||null,t!==null?t:ne(e.type)||"Memo";case W:t=e._payload,e=e._init;try{return ne(e(t))}catch{}}return null}var w=Array.isArray,S=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=c.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},V=[],ue=-1;function N(e){return{current:e}}function H(e){0>ue||(e.current=V[ue],V[ue]=null,ue--)}function ae(e,t){ue++,V[ue]=e.current,e.current=t}var se=N(null),fe=N(null),xe=N(null),ye=N(null);function Ge(e,t){switch(ae(xe,t),ae(fe,e),ae(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gf(t),e=Yf(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}H(se),ae(se,e)}function ze(){H(se),H(fe),H(xe)}function ft(e){e.memoizedState!==null&&ae(ye,e);var t=se.current,a=Yf(t,e.type);t!==a&&(ae(fe,e),ae(se,a))}function Nt(e){fe.current===e&&(H(se),H(fe)),ye.current===e&&(H(ye),ls._currentValue=le)}var ee,re;function ie(e){if(ee===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);ee=t&&t[1]||"",re=-1<a.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+ee+e+re}var he=!1;function be(e,t){if(!e||he)return"";he=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(t){var Z=function(){throw Error()};if(Object.defineProperty(Z.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Z,[])}catch(q){var U=q}Reflect.construct(e,[],Z)}else{try{Z.call()}catch(q){U=q}e.call(Z.prototype)}}else{try{throw Error()}catch(q){U=q}(Z=e())&&typeof Z.catch=="function"&&Z.catch(function(){})}}catch(q){if(q&&U&&typeof q.stack=="string")return[q.stack,U.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=n.DetermineComponentFrameRoot(),d=i[0],h=i[1];if(d&&h){var E=d.split(`
|
|
44
|
-
`),z=h.split(`
|
|
45
|
-
`);for(r=n=0;n<E.length&&!E[n].includes("DetermineComponentFrameRoot");)n++;for(;r<z.length&&!z[r].includes("DetermineComponentFrameRoot");)r++;if(n===E.length||r===z.length)for(n=E.length-1,r=z.length-1;1<=n&&0<=r&&E[n]!==z[r];)r--;for(;1<=n&&0<=r;n--,r--)if(E[n]!==z[r]){if(n!==1||r!==1)do if(n--,r--,0>r||E[n]!==z[r]){var Q=`
|
|
46
|
-
`+E[n].replace(" at new "," at ");return e.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",e.displayName)),Q}while(1<=n&&0<=r);break}}}finally{he=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?ie(a):""}function Ye(e,t){switch(e.tag){case 26:case 27:case 5:return ie(e.type);case 16:return ie("Lazy");case 13:return e.child!==t&&t!==null?ie("Suspense Fallback"):ie("Suspense");case 19:return ie("SuspenseList");case 0:case 15:return be(e.type,!1);case 11:return be(e.type.render,!1);case 1:return be(e.type,!0);case 31:return ie("Activity");default:return""}}function Qe(e){try{var t="",a=null;do t+=Ye(e,a),a=e,e=e.return;while(e);return t}catch(n){return`
|
|
47
|
-
Error generating stack: `+n.message+`
|
|
48
|
-
`+n.stack}}var ut=Object.prototype.hasOwnProperty,ca=s.unstable_scheduleCallback,Je=s.unstable_cancelCallback,wt=s.unstable_shouldYield,Xt=s.unstable_requestPaint,Fe=s.unstable_now,Tt=s.unstable_getCurrentPriorityLevel,ce=s.unstable_ImmediatePriority,ht=s.unstable_UserBlockingPriority,Se=s.unstable_NormalPriority,tt=s.unstable_LowPriority,At=s.unstable_IdlePriority,$e=s.log,mn=s.unstable_setDisableYieldValue,ma=null,at=null;function Ie(e){if(typeof $e=="function"&&mn(e),at&&typeof at.setStrictMode=="function")try{at.setStrictMode(ma,e)}catch{}}var We=Math.clz32?Math.clz32:sa,na=Math.log,ol=Math.LN2;function sa(e){return e>>>=0,e===0?32:31-(na(e)/ol|0)|0}var Ee=256,xt=262144,ha=4194304;function lt(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function hn(e,t,a){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,d=e.pingedLanes;e=e.warmLanes;var h=n&134217727;return h!==0?(n=h&~i,n!==0?r=lt(n):(d&=h,d!==0?r=lt(d):a||(a=h&~e,a!==0&&(r=lt(a))))):(h=n&~i,h!==0?r=lt(h):d!==0?r=lt(d):a||(a=n&~e,a!==0&&(r=lt(a)))),r===0?0:t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===32&&(a&4194048)!==0)?t:r}function Kt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Hr(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Sc(){var e=ha;return ha<<=1,(ha&62914560)===0&&(ha=4194304),e}function Vr(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function vn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function gp(e,t,a,n,r,i){var d=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var h=e.entanglements,E=e.expirationTimes,z=e.hiddenUpdates;for(a=d&~a;0<a;){var Q=31-We(a),Z=1<<Q;h[Q]=0,E[Q]=-1;var U=z[Q];if(U!==null)for(z[Q]=null,Q=0;Q<U.length;Q++){var q=U[Q];q!==null&&(q.lane&=-536870913)}a&=~Z}n!==0&&Nc(e,n,0),i!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=i&~(d&~t))}function Nc(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var n=31-We(t);e.entangledLanes|=t,e.entanglements[n]=e.entanglements[n]|1073741824|a&261930}function kc(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var n=31-We(a),r=1<<n;r&t|e[n]&t&&(e[n]|=t),a&=~r}}function Ec(e,t){var a=t&-t;return a=(a&42)!==0?1:qr(a),(a&(e.suspendedLanes|t))!==0?0:a}function qr(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Gr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Cc(){var e=A.p;return e!==0?e:(e=window.event,e===void 0?32:fx(e.type))}function wc(e,t){var a=A.p;try{return A.p=e,t()}finally{A.p=a}}var Da=Math.random().toString(36).slice(2),vt="__reactFiber$"+Da,Rt="__reactProps$"+Da,wl="__reactContainer$"+Da,Yr="__reactEvents$"+Da,bp="__reactListeners$"+Da,jp="__reactHandles$"+Da,Tc="__reactResources$"+Da,yn="__reactMarker$"+Da;function $r(e){delete e[vt],delete e[Rt],delete e[Yr],delete e[bp],delete e[jp]}function Tl(e){var t=e[vt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[wl]||a[vt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Wf(e);e!==null;){if(a=e[vt])return a;e=Wf(e)}return t}e=a,a=e.parentNode}return null}function Al(e){if(e=e[vt]||e[wl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function gn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(u(33))}function Rl(e){var t=e[Tc];return t||(t=e[Tc]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function pt(e){e[yn]=!0}var Ac=new Set,Rc={};function cl(e,t){Ml(e,t),Ml(e+"Capture",t)}function Ml(e,t){for(Rc[e]=t,e=0;e<t.length;e++)Ac.add(t[e])}var Sp=RegExp("^[: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]*$"),Mc={},_c={};function Np(e){return ut.call(_c,e)?!0:ut.call(Mc,e)?!1:Sp.test(e)?_c[e]=!0:(Mc[e]=!0,!1)}function ms(e,t,a){if(Np(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var n=t.toLowerCase().slice(0,5);if(n!=="data-"&&n!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function hs(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function va(e,t,a,n){if(n===null)e.removeAttribute(a);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+n)}}function Zt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Lc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function kp(e,t,a){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(d){a=""+d,i.call(this,d)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(d){a=""+d},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Qr(e){if(!e._valueTracker){var t=Lc(e)?"checked":"value";e._valueTracker=kp(e,t,""+e[t])}}function zc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),n="";return e&&(n=Lc(e)?e.checked?"true":"false":e.value),e=n,e!==a?(t.setValue(e),!0):!1}function vs(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}}var Ep=/[\n"\\]/g;function Jt(e){return e.replace(Ep,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Xr(e,t,a,n,r,i,d,h){e.name="",d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"?e.type=d:e.removeAttribute("type"),t!=null?d==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Zt(t)):e.value!==""+Zt(t)&&(e.value=""+Zt(t)):d!=="submit"&&d!=="reset"||e.removeAttribute("value"),t!=null?Kr(e,d,Zt(t)):a!=null?Kr(e,d,Zt(a)):n!=null&&e.removeAttribute("value"),r==null&&i!=null&&(e.defaultChecked=!!i),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.name=""+Zt(h):e.removeAttribute("name")}function Dc(e,t,a,n,r,i,d,h){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||a!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){Qr(e);return}a=a!=null?""+Zt(a):"",t=t!=null?""+Zt(t):a,h||t===e.value||(e.value=t),e.defaultValue=t}n=n??r,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=h?e.checked:!!n,e.defaultChecked=!!n,d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.name=d),Qr(e)}function Kr(e,t,a){t==="number"&&vs(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function _l(e,t,a,n){if(e=e.options,t){t={};for(var r=0;r<a.length;r++)t["$"+a[r]]=!0;for(a=0;a<e.length;a++)r=t.hasOwnProperty("$"+e[a].value),e[a].selected!==r&&(e[a].selected=r),r&&n&&(e[a].defaultSelected=!0)}else{for(a=""+Zt(a),t=null,r=0;r<e.length;r++){if(e[r].value===a){e[r].selected=!0,n&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function Oc(e,t,a){if(t!=null&&(t=""+Zt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Zt(a):""}function Bc(e,t,a,n){if(t==null){if(n!=null){if(a!=null)throw Error(u(92));if(w(n)){if(1<n.length)throw Error(u(93));n=n[0]}a=n}a==null&&(a=""),t=a}a=Zt(t),e.defaultValue=a,n=e.textContent,n===a&&n!==""&&n!==null&&(e.value=n),Qr(e)}function Ll(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var Cp=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Uc(e,t,a){var n=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?n?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":n?e.setProperty(t,a):typeof a!="number"||a===0||Cp.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Hc(e,t,a){if(t!=null&&typeof t!="object")throw Error(u(62));if(e=e.style,a!=null){for(var n in a)!a.hasOwnProperty(n)||t!=null&&t.hasOwnProperty(n)||(n.indexOf("--")===0?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="");for(var r in t)n=t[r],t.hasOwnProperty(r)&&a[r]!==n&&Uc(e,r,n)}else for(var i in t)t.hasOwnProperty(i)&&Uc(e,i,t[i])}function Zr(e){if(e.indexOf("-")===-1)return!1;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 wp=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Tp=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ys(e){return Tp.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ya(){}var Jr=null;function Wr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var zl=null,Dl=null;function Vc(e){var t=Al(e);if(t&&(e=t.stateNode)){var a=e[Rt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Xr(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Jt(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var n=a[t];if(n!==e&&n.form===e.form){var r=n[Rt]||null;if(!r)throw Error(u(90));Xr(n,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<a.length;t++)n=a[t],n.form===e.form&&zc(n)}break e;case"textarea":Oc(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&_l(e,!!a.multiple,t,!1)}}}var Fr=!1;function qc(e,t,a){if(Fr)return e(t,a);Fr=!0;try{var n=e(t);return n}finally{if(Fr=!1,(zl!==null||Dl!==null)&&(sr(),zl&&(t=zl,e=Dl,Dl=zl=null,Vc(t),e)))for(t=0;t<e.length;t++)Vc(e[t])}}function bn(e,t){var a=e.stateNode;if(a===null)return null;var n=a[Rt]||null;if(n===null)return null;a=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(u(231,t,typeof a));return a}var ga=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ir=!1;if(ga)try{var jn={};Object.defineProperty(jn,"passive",{get:function(){Ir=!0}}),window.addEventListener("test",jn,jn),window.removeEventListener("test",jn,jn)}catch{Ir=!1}var Oa=null,Pr=null,gs=null;function Gc(){if(gs)return gs;var e,t=Pr,a=t.length,n,r="value"in Oa?Oa.value:Oa.textContent,i=r.length;for(e=0;e<a&&t[e]===r[e];e++);var d=a-e;for(n=1;n<=d&&t[a-n]===r[i-n];n++);return gs=r.slice(e,1<n?1-n:void 0)}function bs(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function js(){return!0}function Yc(){return!1}function Mt(e){function t(a,n,r,i,d){this._reactName=a,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=d,this.currentTarget=null;for(var h in e)e.hasOwnProperty(h)&&(a=e[h],this[h]=a?a(i):i[h]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?js:Yc,this.isPropagationStopped=Yc,this}return y(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=js)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=js)},persist:function(){},isPersistent:js}),t}var ul={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ss=Mt(ul),Sn=y({},ul,{view:0,detail:0}),Ap=Mt(Sn),ei,ti,Nn,Ns=y({},Sn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:li,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Nn&&(Nn&&e.type==="mousemove"?(ei=e.screenX-Nn.screenX,ti=e.screenY-Nn.screenY):ti=ei=0,Nn=e),ei)},movementY:function(e){return"movementY"in e?e.movementY:ti}}),$c=Mt(Ns),Rp=y({},Ns,{dataTransfer:0}),Mp=Mt(Rp),_p=y({},Sn,{relatedTarget:0}),ai=Mt(_p),Lp=y({},ul,{animationName:0,elapsedTime:0,pseudoElement:0}),zp=Mt(Lp),Dp=y({},ul,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Op=Mt(Dp),Bp=y({},ul,{data:0}),Qc=Mt(Bp),Up={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Hp={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Vp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qp(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Vp[e])?!!t[e]:!1}function li(){return qp}var Gp=y({},Sn,{key:function(e){if(e.key){var t=Up[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=bs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Hp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:li,charCode:function(e){return e.type==="keypress"?bs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?bs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Yp=Mt(Gp),$p=y({},Ns,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xc=Mt($p),Qp=y({},Sn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:li}),Xp=Mt(Qp),Kp=y({},ul,{propertyName:0,elapsedTime:0,pseudoElement:0}),Zp=Mt(Kp),Jp=y({},Ns,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Wp=Mt(Jp),Fp=y({},ul,{newState:0,oldState:0}),Ip=Mt(Fp),Pp=[9,13,27,32],ni=ga&&"CompositionEvent"in window,kn=null;ga&&"documentMode"in document&&(kn=document.documentMode);var em=ga&&"TextEvent"in window&&!kn,Kc=ga&&(!ni||kn&&8<kn&&11>=kn),Zc=" ",Jc=!1;function Wc(e,t){switch(e){case"keyup":return Pp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ol=!1;function tm(e,t){switch(e){case"compositionend":return Fc(t);case"keypress":return t.which!==32?null:(Jc=!0,Zc);case"textInput":return e=t.data,e===Zc&&Jc?null:e;default:return null}}function am(e,t){if(Ol)return e==="compositionend"||!ni&&Wc(e,t)?(e=Gc(),gs=Pr=Oa=null,Ol=!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.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Kc&&t.locale!=="ko"?null:t.data;default:return null}}var lm={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ic(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!lm[e.type]:t==="textarea"}function Pc(e,t,a,n){zl?Dl?Dl.push(n):Dl=[n]:zl=n,t=fr(t,"onChange"),0<t.length&&(a=new Ss("onChange","change",null,a,n),e.push({event:a,listeners:t}))}var En=null,Cn=null;function nm(e){Of(e,0)}function ks(e){var t=gn(e);if(zc(t))return e}function eu(e,t){if(e==="change")return t}var tu=!1;if(ga){var si;if(ga){var ri="oninput"in document;if(!ri){var au=document.createElement("div");au.setAttribute("oninput","return;"),ri=typeof au.oninput=="function"}si=ri}else si=!1;tu=si&&(!document.documentMode||9<document.documentMode)}function lu(){En&&(En.detachEvent("onpropertychange",nu),Cn=En=null)}function nu(e){if(e.propertyName==="value"&&ks(Cn)){var t=[];Pc(t,Cn,e,Wr(e)),qc(nm,t)}}function sm(e,t,a){e==="focusin"?(lu(),En=t,Cn=a,En.attachEvent("onpropertychange",nu)):e==="focusout"&&lu()}function rm(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ks(Cn)}function im(e,t){if(e==="click")return ks(t)}function om(e,t){if(e==="input"||e==="change")return ks(t)}function cm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Bt=typeof Object.is=="function"?Object.is:cm;function wn(e,t){if(Bt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;for(n=0;n<a.length;n++){var r=a[n];if(!ut.call(t,r)||!Bt(e[r],t[r]))return!1}return!0}function su(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ru(e,t){var a=su(e);e=0;for(var n;a;){if(a.nodeType===3){if(n=e+a.textContent.length,e<=t&&n>=t)return{node:a,offset:t-e};e=n}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=su(a)}}function iu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?iu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ou(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=vs(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=vs(e.document)}return t}function ii(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")}var um=ga&&"documentMode"in document&&11>=document.documentMode,Bl=null,oi=null,Tn=null,ci=!1;function cu(e,t,a){var n=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;ci||Bl==null||Bl!==vs(n)||(n=Bl,"selectionStart"in n&&ii(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Tn&&wn(Tn,n)||(Tn=n,n=fr(oi,"onSelect"),0<n.length&&(t=new Ss("onSelect","select",null,t,a),e.push({event:t,listeners:n}),t.target=Bl)))}function dl(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Ul={animationend:dl("Animation","AnimationEnd"),animationiteration:dl("Animation","AnimationIteration"),animationstart:dl("Animation","AnimationStart"),transitionrun:dl("Transition","TransitionRun"),transitionstart:dl("Transition","TransitionStart"),transitioncancel:dl("Transition","TransitionCancel"),transitionend:dl("Transition","TransitionEnd")},ui={},uu={};ga&&(uu=document.createElement("div").style,"AnimationEvent"in window||(delete Ul.animationend.animation,delete Ul.animationiteration.animation,delete Ul.animationstart.animation),"TransitionEvent"in window||delete Ul.transitionend.transition);function fl(e){if(ui[e])return ui[e];if(!Ul[e])return e;var t=Ul[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in uu)return ui[e]=t[a];return e}var du=fl("animationend"),fu=fl("animationiteration"),xu=fl("animationstart"),dm=fl("transitionrun"),fm=fl("transitionstart"),xm=fl("transitioncancel"),pu=fl("transitionend"),mu=new Map,di="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");di.push("scrollEnd");function ra(e,t){mu.set(e,t),cl(t,[e])}var Es=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Wt=[],Hl=0,fi=0;function Cs(){for(var e=Hl,t=fi=Hl=0;t<e;){var a=Wt[t];Wt[t++]=null;var n=Wt[t];Wt[t++]=null;var r=Wt[t];Wt[t++]=null;var i=Wt[t];if(Wt[t++]=null,n!==null&&r!==null){var d=n.pending;d===null?r.next=r:(r.next=d.next,d.next=r),n.pending=r}i!==0&&hu(a,r,i)}}function ws(e,t,a,n){Wt[Hl++]=e,Wt[Hl++]=t,Wt[Hl++]=a,Wt[Hl++]=n,fi|=n,e.lanes|=n,e=e.alternate,e!==null&&(e.lanes|=n)}function xi(e,t,a,n){return ws(e,t,a,n),Ts(e)}function xl(e,t){return ws(e,null,null,t),Ts(e)}function hu(e,t,a){e.lanes|=a;var n=e.alternate;n!==null&&(n.lanes|=a);for(var r=!1,i=e.return;i!==null;)i.childLanes|=a,n=i.alternate,n!==null&&(n.childLanes|=a),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(r=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,r&&t!==null&&(r=31-We(a),e=i.hiddenUpdates,n=e[r],n===null?e[r]=[t]:n.push(t),t.lane=a|536870912),i):null}function Ts(e){if(50<Wn)throw Wn=0,No=null,Error(u(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Vl={};function pm(e,t,a,n){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ut(e,t,a,n){return new pm(e,t,a,n)}function pi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ba(e,t){var a=e.alternate;return a===null?(a=Ut(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function vu(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function As(e,t,a,n,r,i){var d=0;if(n=e,typeof e=="function")pi(e)&&(d=1);else if(typeof e=="string")d=gh(e,a,se.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case M:return e=Ut(31,a,t,r),e.elementType=M,e.lanes=i,e;case _:return pl(a.children,r,i,t);case G:d=8,r|=24;break;case D:return e=Ut(12,a,t,r|2),e.elementType=D,e.lanes=i,e;case Y:return e=Ut(13,a,t,r),e.elementType=Y,e.lanes=i,e;case I:return e=Ut(19,a,t,r),e.elementType=I,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case J:d=10;break e;case X:d=9;break e;case F:d=11;break e;case O:d=14;break e;case W:d=16,n=null;break e}d=29,a=Error(u(130,e===null?"null":typeof e,"")),n=null}return t=Ut(d,a,t,r),t.elementType=e,t.type=n,t.lanes=i,t}function pl(e,t,a,n){return e=Ut(7,e,n,t),e.lanes=a,e}function mi(e,t,a){return e=Ut(6,e,null,t),e.lanes=a,e}function yu(e){var t=Ut(18,null,null,0);return t.stateNode=e,t}function hi(e,t,a){return t=Ut(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var gu=new WeakMap;function Ft(e,t){if(typeof e=="object"&&e!==null){var a=gu.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Qe(t)},gu.set(e,t),t)}return{value:e,source:t,stack:Qe(t)}}var ql=[],Gl=0,Rs=null,An=0,It=[],Pt=0,Ba=null,ua=1,da="";function ja(e,t){ql[Gl++]=An,ql[Gl++]=Rs,Rs=e,An=t}function bu(e,t,a){It[Pt++]=ua,It[Pt++]=da,It[Pt++]=Ba,Ba=e;var n=ua;e=da;var r=32-We(n)-1;n&=~(1<<r),a+=1;var i=32-We(t)+r;if(30<i){var d=r-r%5;i=(n&(1<<d)-1).toString(32),n>>=d,r-=d,ua=1<<32-We(t)+r|a<<r|n,da=i+e}else ua=1<<i|a<<r|n,da=e}function vi(e){e.return!==null&&(ja(e,1),bu(e,1,0))}function yi(e){for(;e===Rs;)Rs=ql[--Gl],ql[Gl]=null,An=ql[--Gl],ql[Gl]=null;for(;e===Ba;)Ba=It[--Pt],It[Pt]=null,da=It[--Pt],It[Pt]=null,ua=It[--Pt],It[Pt]=null}function ju(e,t){It[Pt++]=ua,It[Pt++]=da,It[Pt++]=Ba,ua=t.id,da=t.overflow,Ba=e}var yt=null,Xe=null,Re=!1,Ua=null,ea=!1,gi=Error(u(519));function Ha(e){var t=Error(u(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Rn(Ft(t,e)),gi}function Su(e){var t=e.stateNode,a=e.type,n=e.memoizedProps;switch(t[vt]=e,t[Rt]=n,a){case"dialog":we("cancel",t),we("close",t);break;case"iframe":case"object":case"embed":we("load",t);break;case"video":case"audio":for(a=0;a<In.length;a++)we(In[a],t);break;case"source":we("error",t);break;case"img":case"image":case"link":we("error",t),we("load",t);break;case"details":we("toggle",t);break;case"input":we("invalid",t),Dc(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":we("invalid",t);break;case"textarea":we("invalid",t),Bc(t,n.value,n.defaultValue,n.children)}a=n.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||n.suppressHydrationWarning===!0||Vf(t.textContent,a)?(n.popover!=null&&(we("beforetoggle",t),we("toggle",t)),n.onScroll!=null&&we("scroll",t),n.onScrollEnd!=null&&we("scrollend",t),n.onClick!=null&&(t.onclick=ya),t=!0):t=!1,t||Ha(e,!0)}function Nu(e){for(yt=e.return;yt;)switch(yt.tag){case 5:case 31:case 13:ea=!1;return;case 27:case 3:ea=!0;return;default:yt=yt.return}}function Yl(e){if(e!==yt)return!1;if(!Re)return Nu(e),Re=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Uo(e.type,e.memoizedProps)),a=!a),a&&Xe&&Ha(e),Nu(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));Xe=Jf(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));Xe=Jf(e)}else t===27?(t=Xe,Pa(e.type)?(e=Yo,Yo=null,Xe=e):Xe=t):Xe=yt?aa(e.stateNode.nextSibling):null;return!0}function ml(){Xe=yt=null,Re=!1}function bi(){var e=Ua;return e!==null&&(Dt===null?Dt=e:Dt.push.apply(Dt,e),Ua=null),e}function Rn(e){Ua===null?Ua=[e]:Ua.push(e)}var ji=N(null),hl=null,Sa=null;function Va(e,t,a){ae(ji,t._currentValue),t._currentValue=a}function Na(e){e._currentValue=ji.current,H(ji)}function Si(e,t,a){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===a)break;e=e.return}}function Ni(e,t,a,n){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var i=r.dependencies;if(i!==null){var d=r.child;i=i.firstContext;e:for(;i!==null;){var h=i;i=r;for(var E=0;E<t.length;E++)if(h.context===t[E]){i.lanes|=a,h=i.alternate,h!==null&&(h.lanes|=a),Si(i.return,a,e),n||(d=null);break e}i=h.next}}else if(r.tag===18){if(d=r.return,d===null)throw Error(u(341));d.lanes|=a,i=d.alternate,i!==null&&(i.lanes|=a),Si(d,a,e),d=null}else d=r.child;if(d!==null)d.return=r;else for(d=r;d!==null;){if(d===e){d=null;break}if(r=d.sibling,r!==null){r.return=d.return,d=r;break}d=d.return}r=d}}function $l(e,t,a,n){e=null;for(var r=t,i=!1;r!==null;){if(!i){if((r.flags&524288)!==0)i=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var d=r.alternate;if(d===null)throw Error(u(387));if(d=d.memoizedProps,d!==null){var h=r.type;Bt(r.pendingProps.value,d.value)||(e!==null?e.push(h):e=[h])}}else if(r===ye.current){if(d=r.alternate,d===null)throw Error(u(387));d.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(ls):e=[ls])}r=r.return}e!==null&&Ni(t,e,a,n),t.flags|=262144}function Ms(e){for(e=e.firstContext;e!==null;){if(!Bt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function vl(e){hl=e,Sa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function gt(e){return ku(hl,e)}function _s(e,t){return hl===null&&vl(e),ku(e,t)}function ku(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Sa===null){if(e===null)throw Error(u(308));Sa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Sa=Sa.next=t;return a}var mm=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},hm=s.unstable_scheduleCallback,vm=s.unstable_NormalPriority,rt={$$typeof:J,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ki(){return{controller:new mm,data:new Map,refCount:0}}function Mn(e){e.refCount--,e.refCount===0&&hm(vm,function(){e.controller.abort()})}var _n=null,Ei=0,Ql=0,Xl=null;function ym(e,t){if(_n===null){var a=_n=[];Ei=0,Ql=Ao(),Xl={status:"pending",value:void 0,then:function(n){a.push(n)}}}return Ei++,t.then(Eu,Eu),t}function Eu(){if(--Ei===0&&_n!==null){Xl!==null&&(Xl.status="fulfilled");var e=_n;_n=null,Ql=0,Xl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function gm(e,t){var a=[],n={status:"pending",value:null,reason:null,then:function(r){a.push(r)}};return e.then(function(){n.status="fulfilled",n.value=t;for(var r=0;r<a.length;r++)(0,a[r])(t)},function(r){for(n.status="rejected",n.reason=r,r=0;r<a.length;r++)(0,a[r])(void 0)}),n}var Cu=S.S;S.S=function(e,t){uf=Fe(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ym(e,t),Cu!==null&&Cu(e,t)};var yl=N(null);function Ci(){var e=yl.current;return e!==null?e:qe.pooledCache}function Ls(e,t){t===null?ae(yl,yl.current):ae(yl,t.pool)}function wu(){var e=Ci();return e===null?null:{parent:rt._currentValue,pool:e}}var Kl=Error(u(460)),wi=Error(u(474)),zs=Error(u(542)),Ds={then:function(){}};function Tu(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Au(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(ya,ya),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Mu(e),e;default:if(typeof t.status=="string")t.then(ya,ya);else{if(e=qe,e!==null&&100<e.shellSuspendCounter)throw Error(u(482));e=t,e.status="pending",e.then(function(n){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=n}},function(n){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=n}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Mu(e),e}throw bl=t,Kl}}function gl(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(bl=a,Kl):a}}var bl=null;function Ru(){if(bl===null)throw Error(u(459));var e=bl;return bl=null,e}function Mu(e){if(e===Kl||e===zs)throw Error(u(483))}var Zl=null,Ln=0;function Os(e){var t=Ln;return Ln+=1,Zl===null&&(Zl=[]),Au(Zl,e,t)}function zn(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Bs(e,t){throw t.$$typeof===k?Error(u(525)):(e=Object.prototype.toString.call(t),Error(u(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function _u(e){function t(R,T){if(e){var L=R.deletions;L===null?(R.deletions=[T],R.flags|=16):L.push(T)}}function a(R,T){if(!e)return null;for(;T!==null;)t(R,T),T=T.sibling;return null}function n(R){for(var T=new Map;R!==null;)R.key!==null?T.set(R.key,R):T.set(R.index,R),R=R.sibling;return T}function r(R,T){return R=ba(R,T),R.index=0,R.sibling=null,R}function i(R,T,L){return R.index=L,e?(L=R.alternate,L!==null?(L=L.index,L<T?(R.flags|=67108866,T):L):(R.flags|=67108866,T)):(R.flags|=1048576,T)}function d(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function h(R,T,L,K){return T===null||T.tag!==6?(T=mi(L,R.mode,K),T.return=R,T):(T=r(T,L),T.return=R,T)}function E(R,T,L,K){var ve=L.type;return ve===_?Q(R,T,L.props.children,K,L.key):T!==null&&(T.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===W&&gl(ve)===T.type)?(T=r(T,L.props),zn(T,L),T.return=R,T):(T=As(L.type,L.key,L.props,null,R.mode,K),zn(T,L),T.return=R,T)}function z(R,T,L,K){return T===null||T.tag!==4||T.stateNode.containerInfo!==L.containerInfo||T.stateNode.implementation!==L.implementation?(T=hi(L,R.mode,K),T.return=R,T):(T=r(T,L.children||[]),T.return=R,T)}function Q(R,T,L,K,ve){return T===null||T.tag!==7?(T=pl(L,R.mode,K,ve),T.return=R,T):(T=r(T,L),T.return=R,T)}function Z(R,T,L){if(typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint")return T=mi(""+T,R.mode,L),T.return=R,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case C:return L=As(T.type,T.key,T.props,null,R.mode,L),zn(L,T),L.return=R,L;case B:return T=hi(T,R.mode,L),T.return=R,T;case W:return T=gl(T),Z(R,T,L)}if(w(T)||te(T))return T=pl(T,R.mode,L,null),T.return=R,T;if(typeof T.then=="function")return Z(R,Os(T),L);if(T.$$typeof===J)return Z(R,_s(R,T),L);Bs(R,T)}return null}function U(R,T,L,K){var ve=T!==null?T.key:null;if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return ve!==null?null:h(R,T,""+L,K);if(typeof L=="object"&&L!==null){switch(L.$$typeof){case C:return L.key===ve?E(R,T,L,K):null;case B:return L.key===ve?z(R,T,L,K):null;case W:return L=gl(L),U(R,T,L,K)}if(w(L)||te(L))return ve!==null?null:Q(R,T,L,K,null);if(typeof L.then=="function")return U(R,T,Os(L),K);if(L.$$typeof===J)return U(R,T,_s(R,L),K);Bs(R,L)}return null}function q(R,T,L,K,ve){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return R=R.get(L)||null,h(T,R,""+K,ve);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case C:return R=R.get(K.key===null?L:K.key)||null,E(T,R,K,ve);case B:return R=R.get(K.key===null?L:K.key)||null,z(T,R,K,ve);case W:return K=gl(K),q(R,T,L,K,ve)}if(w(K)||te(K))return R=R.get(L)||null,Q(T,R,K,ve,null);if(typeof K.then=="function")return q(R,T,L,Os(K),ve);if(K.$$typeof===J)return q(R,T,L,_s(T,K),ve);Bs(T,K)}return null}function de(R,T,L,K){for(var ve=null,_e=null,pe=T,ke=T=0,Ae=null;pe!==null&&ke<L.length;ke++){pe.index>ke?(Ae=pe,pe=null):Ae=pe.sibling;var Le=U(R,pe,L[ke],K);if(Le===null){pe===null&&(pe=Ae);break}e&&pe&&Le.alternate===null&&t(R,pe),T=i(Le,T,ke),_e===null?ve=Le:_e.sibling=Le,_e=Le,pe=Ae}if(ke===L.length)return a(R,pe),Re&&ja(R,ke),ve;if(pe===null){for(;ke<L.length;ke++)pe=Z(R,L[ke],K),pe!==null&&(T=i(pe,T,ke),_e===null?ve=pe:_e.sibling=pe,_e=pe);return Re&&ja(R,ke),ve}for(pe=n(pe);ke<L.length;ke++)Ae=q(pe,R,ke,L[ke],K),Ae!==null&&(e&&Ae.alternate!==null&&pe.delete(Ae.key===null?ke:Ae.key),T=i(Ae,T,ke),_e===null?ve=Ae:_e.sibling=Ae,_e=Ae);return e&&pe.forEach(function(nl){return t(R,nl)}),Re&&ja(R,ke),ve}function ge(R,T,L,K){if(L==null)throw Error(u(151));for(var ve=null,_e=null,pe=T,ke=T=0,Ae=null,Le=L.next();pe!==null&&!Le.done;ke++,Le=L.next()){pe.index>ke?(Ae=pe,pe=null):Ae=pe.sibling;var nl=U(R,pe,Le.value,K);if(nl===null){pe===null&&(pe=Ae);break}e&&pe&&nl.alternate===null&&t(R,pe),T=i(nl,T,ke),_e===null?ve=nl:_e.sibling=nl,_e=nl,pe=Ae}if(Le.done)return a(R,pe),Re&&ja(R,ke),ve;if(pe===null){for(;!Le.done;ke++,Le=L.next())Le=Z(R,Le.value,K),Le!==null&&(T=i(Le,T,ke),_e===null?ve=Le:_e.sibling=Le,_e=Le);return Re&&ja(R,ke),ve}for(pe=n(pe);!Le.done;ke++,Le=L.next())Le=q(pe,R,ke,Le.value,K),Le!==null&&(e&&Le.alternate!==null&&pe.delete(Le.key===null?ke:Le.key),T=i(Le,T,ke),_e===null?ve=Le:_e.sibling=Le,_e=Le);return e&&pe.forEach(function(Rh){return t(R,Rh)}),Re&&ja(R,ke),ve}function Ve(R,T,L,K){if(typeof L=="object"&&L!==null&&L.type===_&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case C:e:{for(var ve=L.key;T!==null;){if(T.key===ve){if(ve=L.type,ve===_){if(T.tag===7){a(R,T.sibling),K=r(T,L.props.children),K.return=R,R=K;break e}}else if(T.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===W&&gl(ve)===T.type){a(R,T.sibling),K=r(T,L.props),zn(K,L),K.return=R,R=K;break e}a(R,T);break}else t(R,T);T=T.sibling}L.type===_?(K=pl(L.props.children,R.mode,K,L.key),K.return=R,R=K):(K=As(L.type,L.key,L.props,null,R.mode,K),zn(K,L),K.return=R,R=K)}return d(R);case B:e:{for(ve=L.key;T!==null;){if(T.key===ve)if(T.tag===4&&T.stateNode.containerInfo===L.containerInfo&&T.stateNode.implementation===L.implementation){a(R,T.sibling),K=r(T,L.children||[]),K.return=R,R=K;break e}else{a(R,T);break}else t(R,T);T=T.sibling}K=hi(L,R.mode,K),K.return=R,R=K}return d(R);case W:return L=gl(L),Ve(R,T,L,K)}if(w(L))return de(R,T,L,K);if(te(L)){if(ve=te(L),typeof ve!="function")throw Error(u(150));return L=ve.call(L),ge(R,T,L,K)}if(typeof L.then=="function")return Ve(R,T,Os(L),K);if(L.$$typeof===J)return Ve(R,T,_s(R,L),K);Bs(R,L)}return typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint"?(L=""+L,T!==null&&T.tag===6?(a(R,T.sibling),K=r(T,L),K.return=R,R=K):(a(R,T),K=mi(L,R.mode,K),K.return=R,R=K),d(R)):a(R,T)}return function(R,T,L,K){try{Ln=0;var ve=Ve(R,T,L,K);return Zl=null,ve}catch(pe){if(pe===Kl||pe===zs)throw pe;var _e=Ut(29,pe,null,R.mode);return _e.lanes=K,_e.return=R,_e}finally{}}}var jl=_u(!0),Lu=_u(!1),qa=!1;function Ti(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ai(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ga(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ya(e,t,a){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(De&2)!==0){var r=n.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),n.pending=t,t=Ts(e),hu(e,null,a),t}return ws(e,n,t,a),Ts(e)}function Dn(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,kc(e,a)}}function Ri(e,t){var a=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,a===n)){var r=null,i=null;if(a=a.firstBaseUpdate,a!==null){do{var d={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};i===null?r=i=d:i=i.next=d,a=a.next}while(a!==null);i===null?r=i=t:i=i.next=t}else r=i=t;a={baseState:n.baseState,firstBaseUpdate:r,lastBaseUpdate:i,shared:n.shared,callbacks:n.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Mi=!1;function On(){if(Mi){var e=Xl;if(e!==null)throw e}}function Bn(e,t,a,n){Mi=!1;var r=e.updateQueue;qa=!1;var i=r.firstBaseUpdate,d=r.lastBaseUpdate,h=r.shared.pending;if(h!==null){r.shared.pending=null;var E=h,z=E.next;E.next=null,d===null?i=z:d.next=z,d=E;var Q=e.alternate;Q!==null&&(Q=Q.updateQueue,h=Q.lastBaseUpdate,h!==d&&(h===null?Q.firstBaseUpdate=z:h.next=z,Q.lastBaseUpdate=E))}if(i!==null){var Z=r.baseState;d=0,Q=z=E=null,h=i;do{var U=h.lane&-536870913,q=U!==h.lane;if(q?(Te&U)===U:(n&U)===U){U!==0&&U===Ql&&(Mi=!0),Q!==null&&(Q=Q.next={lane:0,tag:h.tag,payload:h.payload,callback:null,next:null});e:{var de=e,ge=h;U=t;var Ve=a;switch(ge.tag){case 1:if(de=ge.payload,typeof de=="function"){Z=de.call(Ve,Z,U);break e}Z=de;break e;case 3:de.flags=de.flags&-65537|128;case 0:if(de=ge.payload,U=typeof de=="function"?de.call(Ve,Z,U):de,U==null)break e;Z=y({},Z,U);break e;case 2:qa=!0}}U=h.callback,U!==null&&(e.flags|=64,q&&(e.flags|=8192),q=r.callbacks,q===null?r.callbacks=[U]:q.push(U))}else q={lane:U,tag:h.tag,payload:h.payload,callback:h.callback,next:null},Q===null?(z=Q=q,E=Z):Q=Q.next=q,d|=U;if(h=h.next,h===null){if(h=r.shared.pending,h===null)break;q=h,h=q.next,q.next=null,r.lastBaseUpdate=q,r.shared.pending=null}}while(!0);Q===null&&(E=Z),r.baseState=E,r.firstBaseUpdate=z,r.lastBaseUpdate=Q,i===null&&(r.shared.lanes=0),Za|=d,e.lanes=d,e.memoizedState=Z}}function zu(e,t){if(typeof e!="function")throw Error(u(191,e));e.call(t)}function Du(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)zu(a[e],t)}var Jl=N(null),Us=N(0);function Ou(e,t){e=_a,ae(Us,e),ae(Jl,t),_a=e|t.baseLanes}function _i(){ae(Us,_a),ae(Jl,Jl.current)}function Li(){_a=Us.current,H(Jl),H(Us)}var Ht=N(null),ta=null;function $a(e){var t=e.alternate;ae(nt,nt.current&1),ae(Ht,e),ta===null&&(t===null||Jl.current!==null||t.memoizedState!==null)&&(ta=e)}function zi(e){ae(nt,nt.current),ae(Ht,e),ta===null&&(ta=e)}function Bu(e){e.tag===22?(ae(nt,nt.current),ae(Ht,e),ta===null&&(ta=e)):Qa()}function Qa(){ae(nt,nt.current),ae(Ht,Ht.current)}function Vt(e){H(Ht),ta===e&&(ta=null),H(nt)}var nt=N(0);function Hs(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||qo(a)||Go(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ka=0,Ne=null,Ue=null,it=null,Vs=!1,Wl=!1,Sl=!1,qs=0,Un=0,Fl=null,bm=0;function Pe(){throw Error(u(321))}function Di(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Bt(e[a],t[a]))return!1;return!0}function Oi(e,t,a,n,r,i){return ka=i,Ne=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,S.H=e===null||e.memoizedState===null?bd:Fi,Sl=!1,i=a(n,r),Sl=!1,Wl&&(i=Hu(t,a,n,r)),Uu(e),i}function Uu(e){S.H=qn;var t=Ue!==null&&Ue.next!==null;if(ka=0,it=Ue=Ne=null,Vs=!1,Un=0,Fl=null,t)throw Error(u(300));e===null||ot||(e=e.dependencies,e!==null&&Ms(e)&&(ot=!0))}function Hu(e,t,a,n){Ne=e;var r=0;do{if(Wl&&(Fl=null),Un=0,Wl=!1,25<=r)throw Error(u(301));if(r+=1,it=Ue=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}S.H=jd,i=t(a,n)}while(Wl);return i}function jm(){var e=S.H,t=e.useState()[0];return t=typeof t.then=="function"?Hn(t):t,e=e.useState()[0],(Ue!==null?Ue.memoizedState:null)!==e&&(Ne.flags|=1024),t}function Bi(){var e=qs!==0;return qs=0,e}function Ui(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Hi(e){if(Vs){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Vs=!1}ka=0,it=Ue=Ne=null,Wl=!1,Un=qs=0,Fl=null}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return it===null?Ne.memoizedState=it=e:it=it.next=e,it}function st(){if(Ue===null){var e=Ne.alternate;e=e!==null?e.memoizedState:null}else e=Ue.next;var t=it===null?Ne.memoizedState:it.next;if(t!==null)it=t,Ue=e;else{if(e===null)throw Ne.alternate===null?Error(u(467)):Error(u(310));Ue=e,e={memoizedState:Ue.memoizedState,baseState:Ue.baseState,baseQueue:Ue.baseQueue,queue:Ue.queue,next:null},it===null?Ne.memoizedState=it=e:it=it.next=e}return it}function Gs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Hn(e){var t=Un;return Un+=1,Fl===null&&(Fl=[]),e=Au(Fl,e,t),t=Ne,(it===null?t.memoizedState:it.next)===null&&(t=t.alternate,S.H=t===null||t.memoizedState===null?bd:Fi),e}function Ys(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Hn(e);if(e.$$typeof===J)return gt(e)}throw Error(u(438,String(e)))}function Vi(e){var t=null,a=Ne.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var n=Ne.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(t={data:n.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Gs(),Ne.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),n=0;n<e;n++)a[n]=$;return t.index++,a}function Ea(e,t){return typeof t=="function"?t(e):t}function $s(e){var t=st();return qi(t,Ue,e)}function qi(e,t,a){var n=e.queue;if(n===null)throw Error(u(311));n.lastRenderedReducer=a;var r=e.baseQueue,i=n.pending;if(i!==null){if(r!==null){var d=r.next;r.next=i.next,i.next=d}t.baseQueue=r=i,n.pending=null}if(i=e.baseState,r===null)e.memoizedState=i;else{t=r.next;var h=d=null,E=null,z=t,Q=!1;do{var Z=z.lane&-536870913;if(Z!==z.lane?(Te&Z)===Z:(ka&Z)===Z){var U=z.revertLane;if(U===0)E!==null&&(E=E.next={lane:0,revertLane:0,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null}),Z===Ql&&(Q=!0);else if((ka&U)===U){z=z.next,U===Ql&&(Q=!0);continue}else Z={lane:0,revertLane:z.revertLane,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},E===null?(h=E=Z,d=i):E=E.next=Z,Ne.lanes|=U,Za|=U;Z=z.action,Sl&&a(i,Z),i=z.hasEagerState?z.eagerState:a(i,Z)}else U={lane:Z,revertLane:z.revertLane,gesture:z.gesture,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},E===null?(h=E=U,d=i):E=E.next=U,Ne.lanes|=Z,Za|=Z;z=z.next}while(z!==null&&z!==t);if(E===null?d=i:E.next=h,!Bt(i,e.memoizedState)&&(ot=!0,Q&&(a=Xl,a!==null)))throw a;e.memoizedState=i,e.baseState=d,e.baseQueue=E,n.lastRenderedState=i}return r===null&&(n.lanes=0),[e.memoizedState,n.dispatch]}function Gi(e){var t=st(),a=t.queue;if(a===null)throw Error(u(311));a.lastRenderedReducer=e;var n=a.dispatch,r=a.pending,i=t.memoizedState;if(r!==null){a.pending=null;var d=r=r.next;do i=e(i,d.action),d=d.next;while(d!==r);Bt(i,t.memoizedState)||(ot=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),a.lastRenderedState=i}return[i,n]}function Vu(e,t,a){var n=Ne,r=st(),i=Re;if(i){if(a===void 0)throw Error(u(407));a=a()}else a=t();var d=!Bt((Ue||r).memoizedState,a);if(d&&(r.memoizedState=a,ot=!0),r=r.queue,Qi(Yu.bind(null,n,r,e),[e]),r.getSnapshot!==t||d||it!==null&&it.memoizedState.tag&1){if(n.flags|=2048,Il(9,{destroy:void 0},Gu.bind(null,n,r,a,t),null),qe===null)throw Error(u(349));i||(ka&127)!==0||qu(n,t,a)}return a}function qu(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=Ne.updateQueue,t===null?(t=Gs(),Ne.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Gu(e,t,a,n){t.value=a,t.getSnapshot=n,$u(t)&&Qu(e)}function Yu(e,t,a){return a(function(){$u(t)&&Qu(e)})}function $u(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Bt(e,a)}catch{return!0}}function Qu(e){var t=xl(e,2);t!==null&&Ot(t,e,2)}function Yi(e){var t=kt();if(typeof e=="function"){var a=e;if(e=a(),Sl){Ie(!0);try{a()}finally{Ie(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ea,lastRenderedState:e},t}function Xu(e,t,a,n){return e.baseState=a,qi(e,Ue,typeof n=="function"?n:Ea)}function Sm(e,t,a,n,r){if(Ks(e))throw Error(u(485));if(e=t.action,e!==null){var i={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(d){i.listeners.push(d)}};S.T!==null?a(!0):i.isTransition=!1,n(i),a=t.pending,a===null?(i.next=t.pending=i,Ku(t,i)):(i.next=a.next,t.pending=a.next=i)}}function Ku(e,t){var a=t.action,n=t.payload,r=e.state;if(t.isTransition){var i=S.T,d={};S.T=d;try{var h=a(r,n),E=S.S;E!==null&&E(d,h),Zu(e,t,h)}catch(z){$i(e,t,z)}finally{i!==null&&d.types!==null&&(i.types=d.types),S.T=i}}else try{i=a(r,n),Zu(e,t,i)}catch(z){$i(e,t,z)}}function Zu(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(n){Ju(e,t,n)},function(n){return $i(e,t,n)}):Ju(e,t,a)}function Ju(e,t,a){t.status="fulfilled",t.value=a,Wu(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Ku(e,a)))}function $i(e,t,a){var n=e.pending;if(e.pending=null,n!==null){n=n.next;do t.status="rejected",t.reason=a,Wu(t),t=t.next;while(t!==n)}e.action=null}function Wu(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Fu(e,t){return t}function Iu(e,t){if(Re){var a=qe.formState;if(a!==null){e:{var n=Ne;if(Re){if(Xe){t:{for(var r=Xe,i=ea;r.nodeType!==8;){if(!i){r=null;break t}if(r=aa(r.nextSibling),r===null){r=null;break t}}i=r.data,r=i==="F!"||i==="F"?r:null}if(r){Xe=aa(r.nextSibling),n=r.data==="F!";break e}}Ha(n)}n=!1}n&&(t=a[0])}}return a=kt(),a.memoizedState=a.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fu,lastRenderedState:t},a.queue=n,a=vd.bind(null,Ne,n),n.dispatch=a,n=Yi(!1),i=Wi.bind(null,Ne,!1,n.queue),n=kt(),r={state:t,dispatch:null,action:e,pending:null},n.queue=r,a=Sm.bind(null,Ne,r,i,a),r.dispatch=a,n.memoizedState=e,[t,a,!1]}function Pu(e){var t=st();return ed(t,Ue,e)}function ed(e,t,a){if(t=qi(e,t,Fu)[0],e=$s(Ea)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var n=Hn(t)}catch(d){throw d===Kl?zs:d}else n=t;t=st();var r=t.queue,i=r.dispatch;return a!==t.memoizedState&&(Ne.flags|=2048,Il(9,{destroy:void 0},Nm.bind(null,r,a),null)),[n,i,e]}function Nm(e,t){e.action=t}function td(e){var t=st(),a=Ue;if(a!==null)return ed(t,a,e);st(),t=t.memoizedState,a=st();var n=a.queue.dispatch;return a.memoizedState=e,[t,n,!1]}function Il(e,t,a,n){return e={tag:e,create:a,deps:n,inst:t,next:null},t=Ne.updateQueue,t===null&&(t=Gs(),Ne.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(n=a.next,a.next=e,e.next=n,t.lastEffect=e),e}function ad(){return st().memoizedState}function Qs(e,t,a,n){var r=kt();Ne.flags|=e,r.memoizedState=Il(1|t,{destroy:void 0},a,n===void 0?null:n)}function Xs(e,t,a,n){var r=st();n=n===void 0?null:n;var i=r.memoizedState.inst;Ue!==null&&n!==null&&Di(n,Ue.memoizedState.deps)?r.memoizedState=Il(t,i,a,n):(Ne.flags|=e,r.memoizedState=Il(1|t,i,a,n))}function ld(e,t){Qs(8390656,8,e,t)}function Qi(e,t){Xs(2048,8,e,t)}function km(e){Ne.flags|=4;var t=Ne.updateQueue;if(t===null)t=Gs(),Ne.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function nd(e){var t=st().memoizedState;return km({ref:t,nextImpl:e}),function(){if((De&2)!==0)throw Error(u(440));return t.impl.apply(void 0,arguments)}}function sd(e,t){return Xs(4,2,e,t)}function rd(e,t){return Xs(4,4,e,t)}function id(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function od(e,t,a){a=a!=null?a.concat([e]):null,Xs(4,4,id.bind(null,t,e),a)}function Xi(){}function cd(e,t){var a=st();t=t===void 0?null:t;var n=a.memoizedState;return t!==null&&Di(t,n[1])?n[0]:(a.memoizedState=[e,t],e)}function ud(e,t){var a=st();t=t===void 0?null:t;var n=a.memoizedState;if(t!==null&&Di(t,n[1]))return n[0];if(n=e(),Sl){Ie(!0);try{e()}finally{Ie(!1)}}return a.memoizedState=[n,t],n}function Ki(e,t,a){return a===void 0||(ka&1073741824)!==0&&(Te&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=ff(),Ne.lanes|=e,Za|=e,a)}function dd(e,t,a,n){return Bt(a,t)?a:Jl.current!==null?(e=Ki(e,a,n),Bt(e,t)||(ot=!0),e):(ka&42)===0||(ka&1073741824)!==0&&(Te&261930)===0?(ot=!0,e.memoizedState=a):(e=ff(),Ne.lanes|=e,Za|=e,t)}function fd(e,t,a,n,r){var i=A.p;A.p=i!==0&&8>i?i:8;var d=S.T,h={};S.T=h,Wi(e,!1,t,a);try{var E=r(),z=S.S;if(z!==null&&z(h,E),E!==null&&typeof E=="object"&&typeof E.then=="function"){var Q=gm(E,n);Vn(e,t,Q,Yt(e))}else Vn(e,t,n,Yt(e))}catch(Z){Vn(e,t,{then:function(){},status:"rejected",reason:Z},Yt())}finally{A.p=i,d!==null&&h.types!==null&&(d.types=h.types),S.T=d}}function Em(){}function Zi(e,t,a,n){if(e.tag!==5)throw Error(u(476));var r=xd(e).queue;fd(e,r,t,le,a===null?Em:function(){return pd(e),a(n)})}function xd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:le,baseState:le,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ea,lastRenderedState:le},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ea,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function pd(e){var t=xd(e);t.next===null&&(t=e.alternate.memoizedState),Vn(e,t.next.queue,{},Yt())}function Ji(){return gt(ls)}function md(){return st().memoizedState}function hd(){return st().memoizedState}function Cm(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Yt();e=Ga(a);var n=Ya(t,e,a);n!==null&&(Ot(n,t,a),Dn(n,t,a)),t={cache:ki()},e.payload=t;return}t=t.return}}function wm(e,t,a){var n=Yt();a={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ks(e)?yd(t,a):(a=xi(e,t,a,n),a!==null&&(Ot(a,e,n),gd(a,t,n)))}function vd(e,t,a){var n=Yt();Vn(e,t,a,n)}function Vn(e,t,a,n){var r={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ks(e))yd(t,r);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var d=t.lastRenderedState,h=i(d,a);if(r.hasEagerState=!0,r.eagerState=h,Bt(h,d))return ws(e,t,r,0),qe===null&&Cs(),!1}catch{}finally{}if(a=xi(e,t,r,n),a!==null)return Ot(a,e,n),gd(a,t,n),!0}return!1}function Wi(e,t,a,n){if(n={lane:2,revertLane:Ao(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ks(e)){if(t)throw Error(u(479))}else t=xi(e,a,n,2),t!==null&&Ot(t,e,2)}function Ks(e){var t=e.alternate;return e===Ne||t!==null&&t===Ne}function yd(e,t){Wl=Vs=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function gd(e,t,a){if((a&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,kc(e,a)}}var qn={readContext:gt,use:Ys,useCallback:Pe,useContext:Pe,useEffect:Pe,useImperativeHandle:Pe,useLayoutEffect:Pe,useInsertionEffect:Pe,useMemo:Pe,useReducer:Pe,useRef:Pe,useState:Pe,useDebugValue:Pe,useDeferredValue:Pe,useTransition:Pe,useSyncExternalStore:Pe,useId:Pe,useHostTransitionStatus:Pe,useFormState:Pe,useActionState:Pe,useOptimistic:Pe,useMemoCache:Pe,useCacheRefresh:Pe};qn.useEffectEvent=Pe;var bd={readContext:gt,use:Ys,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:gt,useEffect:ld,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Qs(4194308,4,id.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Qs(4194308,4,e,t)},useInsertionEffect:function(e,t){Qs(4,2,e,t)},useMemo:function(e,t){var a=kt();t=t===void 0?null:t;var n=e();if(Sl){Ie(!0);try{e()}finally{Ie(!1)}}return a.memoizedState=[n,t],n},useReducer:function(e,t,a){var n=kt();if(a!==void 0){var r=a(t);if(Sl){Ie(!0);try{a(t)}finally{Ie(!1)}}}else r=t;return n.memoizedState=n.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},n.queue=e,e=e.dispatch=wm.bind(null,Ne,e),[n.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Yi(e);var t=e.queue,a=vd.bind(null,Ne,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Xi,useDeferredValue:function(e,t){var a=kt();return Ki(a,e,t)},useTransition:function(){var e=Yi(!1);return e=fd.bind(null,Ne,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var n=Ne,r=kt();if(Re){if(a===void 0)throw Error(u(407));a=a()}else{if(a=t(),qe===null)throw Error(u(349));(Te&127)!==0||qu(n,t,a)}r.memoizedState=a;var i={value:a,getSnapshot:t};return r.queue=i,ld(Yu.bind(null,n,i,e),[e]),n.flags|=2048,Il(9,{destroy:void 0},Gu.bind(null,n,i,a,t),null),a},useId:function(){var e=kt(),t=qe.identifierPrefix;if(Re){var a=da,n=ua;a=(n&~(1<<32-We(n)-1)).toString(32)+a,t="_"+t+"R_"+a,a=qs++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=bm++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Ji,useFormState:Iu,useActionState:Iu,useOptimistic:function(e){var t=kt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Wi.bind(null,Ne,!0,a),a.dispatch=t,[e,t]},useMemoCache:Vi,useCacheRefresh:function(){return kt().memoizedState=Cm.bind(null,Ne)},useEffectEvent:function(e){var t=kt(),a={impl:e};return t.memoizedState=a,function(){if((De&2)!==0)throw Error(u(440));return a.impl.apply(void 0,arguments)}}},Fi={readContext:gt,use:Ys,useCallback:cd,useContext:gt,useEffect:Qi,useImperativeHandle:od,useInsertionEffect:sd,useLayoutEffect:rd,useMemo:ud,useReducer:$s,useRef:ad,useState:function(){return $s(Ea)},useDebugValue:Xi,useDeferredValue:function(e,t){var a=st();return dd(a,Ue.memoizedState,e,t)},useTransition:function(){var e=$s(Ea)[0],t=st().memoizedState;return[typeof e=="boolean"?e:Hn(e),t]},useSyncExternalStore:Vu,useId:md,useHostTransitionStatus:Ji,useFormState:Pu,useActionState:Pu,useOptimistic:function(e,t){var a=st();return Xu(a,Ue,e,t)},useMemoCache:Vi,useCacheRefresh:hd};Fi.useEffectEvent=nd;var jd={readContext:gt,use:Ys,useCallback:cd,useContext:gt,useEffect:Qi,useImperativeHandle:od,useInsertionEffect:sd,useLayoutEffect:rd,useMemo:ud,useReducer:Gi,useRef:ad,useState:function(){return Gi(Ea)},useDebugValue:Xi,useDeferredValue:function(e,t){var a=st();return Ue===null?Ki(a,e,t):dd(a,Ue.memoizedState,e,t)},useTransition:function(){var e=Gi(Ea)[0],t=st().memoizedState;return[typeof e=="boolean"?e:Hn(e),t]},useSyncExternalStore:Vu,useId:md,useHostTransitionStatus:Ji,useFormState:td,useActionState:td,useOptimistic:function(e,t){var a=st();return Ue!==null?Xu(a,Ue,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Vi,useCacheRefresh:hd};jd.useEffectEvent=nd;function Ii(e,t,a,n){t=e.memoizedState,a=a(n,t),a=a==null?t:y({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Pi={enqueueSetState:function(e,t,a){e=e._reactInternals;var n=Yt(),r=Ga(n);r.payload=t,a!=null&&(r.callback=a),t=Ya(e,r,n),t!==null&&(Ot(t,e,n),Dn(t,e,n))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var n=Yt(),r=Ga(n);r.tag=1,r.payload=t,a!=null&&(r.callback=a),t=Ya(e,r,n),t!==null&&(Ot(t,e,n),Dn(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=Yt(),n=Ga(a);n.tag=2,t!=null&&(n.callback=t),t=Ya(e,n,a),t!==null&&(Ot(t,e,a),Dn(t,e,a))}};function Sd(e,t,a,n,r,i,d){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,i,d):t.prototype&&t.prototype.isPureReactComponent?!wn(a,n)||!wn(r,i):!0}function Nd(e,t,a,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,n),t.state!==e&&Pi.enqueueReplaceState(t,t.state,null)}function Nl(e,t){var a=t;if("ref"in t){a={};for(var n in t)n!=="ref"&&(a[n]=t[n])}if(e=e.defaultProps){a===t&&(a=y({},a));for(var r in e)a[r]===void 0&&(a[r]=e[r])}return a}function kd(e){Es(e)}function Ed(e){console.error(e)}function Cd(e){Es(e)}function Zs(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function wd(e,t,a){try{var n=e.onCaughtError;n(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function eo(e,t,a){return a=Ga(a),a.tag=3,a.payload={element:null},a.callback=function(){Zs(e,t)},a}function Td(e){return e=Ga(e),e.tag=3,e}function Ad(e,t,a,n){var r=a.type.getDerivedStateFromError;if(typeof r=="function"){var i=n.value;e.payload=function(){return r(i)},e.callback=function(){wd(t,a,n)}}var d=a.stateNode;d!==null&&typeof d.componentDidCatch=="function"&&(e.callback=function(){wd(t,a,n),typeof r!="function"&&(Ja===null?Ja=new Set([this]):Ja.add(this));var h=n.stack;this.componentDidCatch(n.value,{componentStack:h!==null?h:""})})}function Tm(e,t,a,n,r){if(a.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(t=a.alternate,t!==null&&$l(t,a,r,!0),a=Ht.current,a!==null){switch(a.tag){case 31:case 13:return ta===null?rr():a.alternate===null&&et===0&&(et=3),a.flags&=-257,a.flags|=65536,a.lanes=r,n===Ds?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([n]):t.add(n),Co(e,n,r)),!1;case 22:return a.flags|=65536,n===Ds?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([n]):a.add(n)),Co(e,n,r)),!1}throw Error(u(435,a.tag))}return Co(e,n,r),rr(),!1}if(Re)return t=Ht.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,n!==gi&&(e=Error(u(422),{cause:n}),Rn(Ft(e,a)))):(n!==gi&&(t=Error(u(423),{cause:n}),Rn(Ft(t,a))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,n=Ft(n,a),r=eo(e.stateNode,n,r),Ri(e,r),et!==4&&(et=2)),!1;var i=Error(u(520),{cause:n});if(i=Ft(i,a),Jn===null?Jn=[i]:Jn.push(i),et!==4&&(et=2),t===null)return!0;n=Ft(n,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=r&-r,a.lanes|=e,e=eo(a.stateNode,n,e),Ri(a,e),!1;case 1:if(t=a.type,i=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(Ja===null||!Ja.has(i))))return a.flags|=65536,r&=-r,a.lanes|=r,r=Td(r),Ad(r,e,a,n),Ri(a,r),!1}a=a.return}while(a!==null);return!1}var to=Error(u(461)),ot=!1;function bt(e,t,a,n){t.child=e===null?Lu(t,null,a,n):jl(t,e.child,a,n)}function Rd(e,t,a,n,r){a=a.render;var i=t.ref;if("ref"in n){var d={};for(var h in n)h!=="ref"&&(d[h]=n[h])}else d=n;return vl(t),n=Oi(e,t,a,d,i,r),h=Bi(),e!==null&&!ot?(Ui(e,t,r),Ca(e,t,r)):(Re&&h&&vi(t),t.flags|=1,bt(e,t,n,r),t.child)}function Md(e,t,a,n,r){if(e===null){var i=a.type;return typeof i=="function"&&!pi(i)&&i.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=i,_d(e,t,i,n,r)):(e=As(a.type,null,n,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!co(e,r)){var d=i.memoizedProps;if(a=a.compare,a=a!==null?a:wn,a(d,n)&&e.ref===t.ref)return Ca(e,t,r)}return t.flags|=1,e=ba(i,n),e.ref=t.ref,e.return=t,t.child=e}function _d(e,t,a,n,r){if(e!==null){var i=e.memoizedProps;if(wn(i,n)&&e.ref===t.ref)if(ot=!1,t.pendingProps=n=i,co(e,r))(e.flags&131072)!==0&&(ot=!0);else return t.lanes=e.lanes,Ca(e,t,r)}return ao(e,t,a,n,r)}function Ld(e,t,a,n){var r=n.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.mode==="hidden"){if((t.flags&128)!==0){if(i=i!==null?i.baseLanes|a:a,e!==null){for(n=t.child=e.child,r=0;n!==null;)r=r|n.lanes|n.childLanes,n=n.sibling;n=r&~i}else n=0,t.child=null;return zd(e,t,i,a,n)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ls(t,i!==null?i.cachePool:null),i!==null?Ou(t,i):_i(),Bu(t);else return n=t.lanes=536870912,zd(e,t,i!==null?i.baseLanes|a:a,a,n)}else i!==null?(Ls(t,i.cachePool),Ou(t,i),Qa(),t.memoizedState=null):(e!==null&&Ls(t,null),_i(),Qa());return bt(e,t,r,a),t.child}function Gn(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function zd(e,t,a,n,r){var i=Ci();return i=i===null?null:{parent:rt._currentValue,pool:i},t.memoizedState={baseLanes:a,cachePool:i},e!==null&&Ls(t,null),_i(),Bu(t),e!==null&&$l(e,t,n,!0),t.childLanes=r,null}function Js(e,t){return t=Fs({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Dd(e,t,a){return jl(t,e.child,null,a),e=Js(t,t.pendingProps),e.flags|=2,Vt(t),t.memoizedState=null,e}function Am(e,t,a){var n=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Re){if(n.mode==="hidden")return e=Js(t,n),t.lanes=536870912,Gn(null,e);if(zi(t),(e=Xe)?(e=Zf(e,ea),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ba!==null?{id:ua,overflow:da}:null,retryLane:536870912,hydrationErrors:null},a=yu(e),a.return=t,t.child=a,yt=t,Xe=null)):e=null,e===null)throw Ha(t);return t.lanes=536870912,null}return Js(t,n)}var i=e.memoizedState;if(i!==null){var d=i.dehydrated;if(zi(t),r)if(t.flags&256)t.flags&=-257,t=Dd(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(u(558));else if(ot||$l(e,t,a,!1),r=(a&e.childLanes)!==0,ot||r){if(n=qe,n!==null&&(d=Ec(n,a),d!==0&&d!==i.retryLane))throw i.retryLane=d,xl(e,d),Ot(n,e,d),to;rr(),t=Dd(e,t,a)}else e=i.treeContext,Xe=aa(d.nextSibling),yt=t,Re=!0,Ua=null,ea=!1,e!==null&&ju(t,e),t=Js(t,n),t.flags|=4096;return t}return e=ba(e.child,{mode:n.mode,children:n.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ws(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(u(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function ao(e,t,a,n,r){return vl(t),a=Oi(e,t,a,n,void 0,r),n=Bi(),e!==null&&!ot?(Ui(e,t,r),Ca(e,t,r)):(Re&&n&&vi(t),t.flags|=1,bt(e,t,a,r),t.child)}function Od(e,t,a,n,r,i){return vl(t),t.updateQueue=null,a=Hu(t,n,a,r),Uu(e),n=Bi(),e!==null&&!ot?(Ui(e,t,i),Ca(e,t,i)):(Re&&n&&vi(t),t.flags|=1,bt(e,t,a,i),t.child)}function Bd(e,t,a,n,r){if(vl(t),t.stateNode===null){var i=Vl,d=a.contextType;typeof d=="object"&&d!==null&&(i=gt(d)),i=new a(n,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Pi,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=n,i.state=t.memoizedState,i.refs={},Ti(t),d=a.contextType,i.context=typeof d=="object"&&d!==null?gt(d):Vl,i.state=t.memoizedState,d=a.getDerivedStateFromProps,typeof d=="function"&&(Ii(t,a,d,n),i.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(d=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),d!==i.state&&Pi.enqueueReplaceState(i,i.state,null),Bn(t,n,i,r),On(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!0}else if(e===null){i=t.stateNode;var h=t.memoizedProps,E=Nl(a,h);i.props=E;var z=i.context,Q=a.contextType;d=Vl,typeof Q=="object"&&Q!==null&&(d=gt(Q));var Z=a.getDerivedStateFromProps;Q=typeof Z=="function"||typeof i.getSnapshotBeforeUpdate=="function",h=t.pendingProps!==h,Q||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(h||z!==d)&&Nd(t,i,n,d),qa=!1;var U=t.memoizedState;i.state=U,Bn(t,n,i,r),On(),z=t.memoizedState,h||U!==z||qa?(typeof Z=="function"&&(Ii(t,a,Z,n),z=t.memoizedState),(E=qa||Sd(t,a,E,n,U,z,d))?(Q||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=z),i.props=n,i.state=z,i.context=d,n=E):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{i=t.stateNode,Ai(e,t),d=t.memoizedProps,Q=Nl(a,d),i.props=Q,Z=t.pendingProps,U=i.context,z=a.contextType,E=Vl,typeof z=="object"&&z!==null&&(E=gt(z)),h=a.getDerivedStateFromProps,(z=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(d!==Z||U!==E)&&Nd(t,i,n,E),qa=!1,U=t.memoizedState,i.state=U,Bn(t,n,i,r),On();var q=t.memoizedState;d!==Z||U!==q||qa||e!==null&&e.dependencies!==null&&Ms(e.dependencies)?(typeof h=="function"&&(Ii(t,a,h,n),q=t.memoizedState),(Q=qa||Sd(t,a,Q,n,U,q,E)||e!==null&&e.dependencies!==null&&Ms(e.dependencies))?(z||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(n,q,E),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(n,q,E)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||d===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=q),i.props=n,i.state=q,i.context=E,n=Q):(typeof i.componentDidUpdate!="function"||d===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),n=!1)}return i=n,Ws(e,t),n=(t.flags&128)!==0,i||n?(i=t.stateNode,a=n&&typeof a.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&n?(t.child=jl(t,e.child,null,r),t.child=jl(t,null,a,r)):bt(e,t,a,r),t.memoizedState=i.state,e=t.child):e=Ca(e,t,r),e}function Ud(e,t,a,n){return ml(),t.flags|=256,bt(e,t,a,n),t.child}var lo={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function no(e){return{baseLanes:e,cachePool:wu()}}function so(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Gt),e}function Hd(e,t,a){var n=t.pendingProps,r=!1,i=(t.flags&128)!==0,d;if((d=i)||(d=e!==null&&e.memoizedState===null?!1:(nt.current&2)!==0),d&&(r=!0,t.flags&=-129),d=(t.flags&32)!==0,t.flags&=-33,e===null){if(Re){if(r?$a(t):Qa(),(e=Xe)?(e=Zf(e,ea),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ba!==null?{id:ua,overflow:da}:null,retryLane:536870912,hydrationErrors:null},a=yu(e),a.return=t,t.child=a,yt=t,Xe=null)):e=null,e===null)throw Ha(t);return Go(e)?t.lanes=32:t.lanes=536870912,null}var h=n.children;return n=n.fallback,r?(Qa(),r=t.mode,h=Fs({mode:"hidden",children:h},r),n=pl(n,r,a,null),h.return=t,n.return=t,h.sibling=n,t.child=h,n=t.child,n.memoizedState=no(a),n.childLanes=so(e,d,a),t.memoizedState=lo,Gn(null,n)):($a(t),ro(t,h))}var E=e.memoizedState;if(E!==null&&(h=E.dehydrated,h!==null)){if(i)t.flags&256?($a(t),t.flags&=-257,t=io(e,t,a)):t.memoizedState!==null?(Qa(),t.child=e.child,t.flags|=128,t=null):(Qa(),h=n.fallback,r=t.mode,n=Fs({mode:"visible",children:n.children},r),h=pl(h,r,a,null),h.flags|=2,n.return=t,h.return=t,n.sibling=h,t.child=n,jl(t,e.child,null,a),n=t.child,n.memoizedState=no(a),n.childLanes=so(e,d,a),t.memoizedState=lo,t=Gn(null,n));else if($a(t),Go(h)){if(d=h.nextSibling&&h.nextSibling.dataset,d)var z=d.dgst;d=z,n=Error(u(419)),n.stack="",n.digest=d,Rn({value:n,source:null,stack:null}),t=io(e,t,a)}else if(ot||$l(e,t,a,!1),d=(a&e.childLanes)!==0,ot||d){if(d=qe,d!==null&&(n=Ec(d,a),n!==0&&n!==E.retryLane))throw E.retryLane=n,xl(e,n),Ot(d,e,n),to;qo(h)||rr(),t=io(e,t,a)}else qo(h)?(t.flags|=192,t.child=e.child,t=null):(e=E.treeContext,Xe=aa(h.nextSibling),yt=t,Re=!0,Ua=null,ea=!1,e!==null&&ju(t,e),t=ro(t,n.children),t.flags|=4096);return t}return r?(Qa(),h=n.fallback,r=t.mode,E=e.child,z=E.sibling,n=ba(E,{mode:"hidden",children:n.children}),n.subtreeFlags=E.subtreeFlags&65011712,z!==null?h=ba(z,h):(h=pl(h,r,a,null),h.flags|=2),h.return=t,n.return=t,n.sibling=h,t.child=n,Gn(null,n),n=t.child,h=e.child.memoizedState,h===null?h=no(a):(r=h.cachePool,r!==null?(E=rt._currentValue,r=r.parent!==E?{parent:E,pool:E}:r):r=wu(),h={baseLanes:h.baseLanes|a,cachePool:r}),n.memoizedState=h,n.childLanes=so(e,d,a),t.memoizedState=lo,Gn(e.child,n)):($a(t),a=e.child,e=a.sibling,a=ba(a,{mode:"visible",children:n.children}),a.return=t,a.sibling=null,e!==null&&(d=t.deletions,d===null?(t.deletions=[e],t.flags|=16):d.push(e)),t.child=a,t.memoizedState=null,a)}function ro(e,t){return t=Fs({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Fs(e,t){return e=Ut(22,e,null,t),e.lanes=0,e}function io(e,t,a){return jl(t,e.child,null,a),e=ro(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Vd(e,t,a){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Si(e.return,t,a)}function oo(e,t,a,n,r,i){var d=e.memoizedState;d===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:a,tailMode:r,treeForkCount:i}:(d.isBackwards=t,d.rendering=null,d.renderingStartTime=0,d.last=n,d.tail=a,d.tailMode=r,d.treeForkCount=i)}function qd(e,t,a){var n=t.pendingProps,r=n.revealOrder,i=n.tail;n=n.children;var d=nt.current,h=(d&2)!==0;if(h?(d=d&1|2,t.flags|=128):d&=1,ae(nt,d),bt(e,t,n,a),n=Re?An:0,!h&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Vd(e,a,t);else if(e.tag===19)Vd(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":for(a=t.child,r=null;a!==null;)e=a.alternate,e!==null&&Hs(e)===null&&(r=a),a=a.sibling;a=r,a===null?(r=t.child,t.child=null):(r=a.sibling,a.sibling=null),oo(t,!1,r,a,i,n);break;case"backwards":case"unstable_legacy-backwards":for(a=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&Hs(e)===null){t.child=r;break}e=r.sibling,r.sibling=a,a=r,r=e}oo(t,!0,a,null,i,n);break;case"together":oo(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function Ca(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Za|=t.lanes,(a&t.childLanes)===0)if(e!==null){if($l(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(u(153));if(t.child!==null){for(e=t.child,a=ba(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=ba(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function co(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ms(e)))}function Rm(e,t,a){switch(t.tag){case 3:Ge(t,t.stateNode.containerInfo),Va(t,rt,e.memoizedState.cache),ml();break;case 27:case 5:ft(t);break;case 4:Ge(t,t.stateNode.containerInfo);break;case 10:Va(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,zi(t),null;break;case 13:var n=t.memoizedState;if(n!==null)return n.dehydrated!==null?($a(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Hd(e,t,a):($a(t),e=Ca(e,t,a),e!==null?e.sibling:null);$a(t);break;case 19:var r=(e.flags&128)!==0;if(n=(a&t.childLanes)!==0,n||($l(e,t,a,!1),n=(a&t.childLanes)!==0),r){if(n)return qd(e,t,a);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),ae(nt,nt.current),n)break;return null;case 22:return t.lanes=0,Ld(e,t,a,t.pendingProps);case 24:Va(t,rt,e.memoizedState.cache)}return Ca(e,t,a)}function Gd(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)ot=!0;else{if(!co(e,a)&&(t.flags&128)===0)return ot=!1,Rm(e,t,a);ot=(e.flags&131072)!==0}else ot=!1,Re&&(t.flags&1048576)!==0&&bu(t,An,t.index);switch(t.lanes=0,t.tag){case 16:e:{var n=t.pendingProps;if(e=gl(t.elementType),t.type=e,typeof e=="function")pi(e)?(n=Nl(e,n),t.tag=1,t=Bd(null,t,e,n,a)):(t.tag=0,t=ao(null,t,e,n,a));else{if(e!=null){var r=e.$$typeof;if(r===F){t.tag=11,t=Rd(null,t,e,n,a);break e}else if(r===O){t.tag=14,t=Md(null,t,e,n,a);break e}}throw t=ne(e)||e,Error(u(306,t,""))}}return t;case 0:return ao(e,t,t.type,t.pendingProps,a);case 1:return n=t.type,r=Nl(n,t.pendingProps),Bd(e,t,n,r,a);case 3:e:{if(Ge(t,t.stateNode.containerInfo),e===null)throw Error(u(387));n=t.pendingProps;var i=t.memoizedState;r=i.element,Ai(e,t),Bn(t,n,null,a);var d=t.memoizedState;if(n=d.cache,Va(t,rt,n),n!==i.cache&&Ni(t,[rt],a,!0),On(),n=d.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:d.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=Ud(e,t,n,a);break e}else if(n!==r){r=Ft(Error(u(424)),t),Rn(r),t=Ud(e,t,n,a);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Xe=aa(e.firstChild),yt=t,Re=!0,Ua=null,ea=!0,a=Lu(t,null,n,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ml(),n===r){t=Ca(e,t,a);break e}bt(e,t,n,a)}t=t.child}return t;case 26:return Ws(e,t),e===null?(a=ex(t.type,null,t.pendingProps,null))?t.memoizedState=a:Re||(a=t.type,e=t.pendingProps,n=xr(xe.current).createElement(a),n[vt]=t,n[Rt]=e,jt(n,a,e),pt(n),t.stateNode=n):t.memoizedState=ex(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ft(t),e===null&&Re&&(n=t.stateNode=Ff(t.type,t.pendingProps,xe.current),yt=t,ea=!0,r=Xe,Pa(t.type)?(Yo=r,Xe=aa(n.firstChild)):Xe=r),bt(e,t,t.pendingProps.children,a),Ws(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Re&&((r=n=Xe)&&(n=rh(n,t.type,t.pendingProps,ea),n!==null?(t.stateNode=n,yt=t,Xe=aa(n.firstChild),ea=!1,r=!0):r=!1),r||Ha(t)),ft(t),r=t.type,i=t.pendingProps,d=e!==null?e.memoizedProps:null,n=i.children,Uo(r,i)?n=null:d!==null&&Uo(r,d)&&(t.flags|=32),t.memoizedState!==null&&(r=Oi(e,t,jm,null,null,a),ls._currentValue=r),Ws(e,t),bt(e,t,n,a),t.child;case 6:return e===null&&Re&&((e=a=Xe)&&(a=ih(a,t.pendingProps,ea),a!==null?(t.stateNode=a,yt=t,Xe=null,e=!0):e=!1),e||Ha(t)),null;case 13:return Hd(e,t,a);case 4:return Ge(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=jl(t,null,n,a):bt(e,t,n,a),t.child;case 11:return Rd(e,t,t.type,t.pendingProps,a);case 7:return bt(e,t,t.pendingProps,a),t.child;case 8:return bt(e,t,t.pendingProps.children,a),t.child;case 12:return bt(e,t,t.pendingProps.children,a),t.child;case 10:return n=t.pendingProps,Va(t,t.type,n.value),bt(e,t,n.children,a),t.child;case 9:return r=t.type._context,n=t.pendingProps.children,vl(t),r=gt(r),n=n(r),t.flags|=1,bt(e,t,n,a),t.child;case 14:return Md(e,t,t.type,t.pendingProps,a);case 15:return _d(e,t,t.type,t.pendingProps,a);case 19:return qd(e,t,a);case 31:return Am(e,t,a);case 22:return Ld(e,t,a,t.pendingProps);case 24:return vl(t),n=gt(rt),e===null?(r=Ci(),r===null&&(r=qe,i=ki(),r.pooledCache=i,i.refCount++,i!==null&&(r.pooledCacheLanes|=a),r=i),t.memoizedState={parent:n,cache:r},Ti(t),Va(t,rt,r)):((e.lanes&a)!==0&&(Ai(e,t),Bn(t,null,null,a),On()),r=e.memoizedState,i=t.memoizedState,r.parent!==n?(r={parent:n,cache:n},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),Va(t,rt,n)):(n=i.cache,Va(t,rt,n),n!==r.cache&&Ni(t,[rt],a,!0))),bt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(u(156,t.tag))}function wa(e){e.flags|=4}function uo(e,t,a,n,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(hf())e.flags|=8192;else throw bl=Ds,wi}else e.flags&=-16777217}function Yd(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!sx(t))if(hf())e.flags|=8192;else throw bl=Ds,wi}function Is(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Sc():536870912,e.lanes|=t,an|=t)}function Yn(e,t){if(!Re)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var n=null;a!==null;)a.alternate!==null&&(n=a),a=a.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Ke(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,n=0;if(t)for(var r=e.child;r!==null;)a|=r.lanes|r.childLanes,n|=r.subtreeFlags&65011712,n|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)a|=r.lanes|r.childLanes,n|=r.subtreeFlags,n|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=n,e.childLanes=a,t}function Mm(e,t,a){var n=t.pendingProps;switch(yi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ke(t),null;case 1:return Ke(t),null;case 3:return a=t.stateNode,n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Na(rt),ze(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Yl(t)?wa(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,bi())),Ke(t),null;case 26:var r=t.type,i=t.memoizedState;return e===null?(wa(t),i!==null?(Ke(t),Yd(t,i)):(Ke(t),uo(t,r,null,n,a))):i?i!==e.memoizedState?(wa(t),Ke(t),Yd(t,i)):(Ke(t),t.flags&=-16777217):(e=e.memoizedProps,e!==n&&wa(t),Ke(t),uo(t,r,e,n,a)),null;case 27:if(Nt(t),a=xe.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&wa(t);else{if(!n){if(t.stateNode===null)throw Error(u(166));return Ke(t),null}e=se.current,Yl(t)?Su(t):(e=Ff(r,n,a),t.stateNode=e,wa(t))}return Ke(t),null;case 5:if(Nt(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&wa(t);else{if(!n){if(t.stateNode===null)throw Error(u(166));return Ke(t),null}if(i=se.current,Yl(t))Su(t);else{var d=xr(xe.current);switch(i){case 1:i=d.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:i=d.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":i=d.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":i=d.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":i=d.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof n.is=="string"?d.createElement("select",{is:n.is}):d.createElement("select"),n.multiple?i.multiple=!0:n.size&&(i.size=n.size);break;default:i=typeof n.is=="string"?d.createElement(r,{is:n.is}):d.createElement(r)}}i[vt]=t,i[Rt]=n;e:for(d=t.child;d!==null;){if(d.tag===5||d.tag===6)i.appendChild(d.stateNode);else if(d.tag!==4&&d.tag!==27&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}t.stateNode=i;e:switch(jt(i,r,n),r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&wa(t)}}return Ke(t),uo(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&wa(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(u(166));if(e=xe.current,Yl(t)){if(e=t.stateNode,a=t.memoizedProps,n=null,r=yt,r!==null)switch(r.tag){case 27:case 5:n=r.memoizedProps}e[vt]=t,e=!!(e.nodeValue===a||n!==null&&n.suppressHydrationWarning===!0||Vf(e.nodeValue,a)),e||Ha(t,!0)}else e=xr(e).createTextNode(n),e[vt]=t,t.stateNode=e}return Ke(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(n=Yl(t),a!==null){if(e===null){if(!n)throw Error(u(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(557));e[vt]=t}else ml(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ke(t),e=!1}else a=bi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Vt(t),t):(Vt(t),null);if((t.flags&128)!==0)throw Error(u(558))}return Ke(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Yl(t),n!==null&&n.dehydrated!==null){if(e===null){if(!r)throw Error(u(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(u(317));r[vt]=t}else ml(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ke(t),r=!1}else r=bi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(Vt(t),t):(Vt(t),null)}return Vt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=n!==null,e=e!==null&&e.memoizedState!==null,a&&(n=t.child,r=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(r=n.alternate.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==r&&(n.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Is(t,t.updateQueue),Ke(t),null);case 4:return ze(),e===null&&Lo(t.stateNode.containerInfo),Ke(t),null;case 10:return Na(t.type),Ke(t),null;case 19:if(H(nt),n=t.memoizedState,n===null)return Ke(t),null;if(r=(t.flags&128)!==0,i=n.rendering,i===null)if(r)Yn(n,!1);else{if(et!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(i=Hs(e),i!==null){for(t.flags|=128,Yn(n,!1),e=i.updateQueue,t.updateQueue=e,Is(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)vu(a,e),a=a.sibling;return ae(nt,nt.current&1|2),Re&&ja(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&Fe()>lr&&(t.flags|=128,r=!0,Yn(n,!1),t.lanes=4194304)}else{if(!r)if(e=Hs(i),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Is(t,e),Yn(n,!0),n.tail===null&&n.tailMode==="hidden"&&!i.alternate&&!Re)return Ke(t),null}else 2*Fe()-n.renderingStartTime>lr&&a!==536870912&&(t.flags|=128,r=!0,Yn(n,!1),t.lanes=4194304);n.isBackwards?(i.sibling=t.child,t.child=i):(e=n.last,e!==null?e.sibling=i:t.child=i,n.last=i)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=Fe(),e.sibling=null,a=nt.current,ae(nt,r?a&1|2:a&1),Re&&ja(t,n.treeForkCount),e):(Ke(t),null);case 22:case 23:return Vt(t),Li(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(a&536870912)!==0&&(t.flags&128)===0&&(Ke(t),t.subtreeFlags&6&&(t.flags|=8192)):Ke(t),a=t.updateQueue,a!==null&&Is(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==a&&(t.flags|=2048),e!==null&&H(yl),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Na(rt),Ke(t),null;case 25:return null;case 30:return null}throw Error(u(156,t.tag))}function _m(e,t){switch(yi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Na(rt),ze(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Nt(t),null;case 31:if(t.memoizedState!==null){if(Vt(t),t.alternate===null)throw Error(u(340));ml()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Vt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));ml()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return H(nt),null;case 4:return ze(),null;case 10:return Na(t.type),null;case 22:case 23:return Vt(t),Li(),e!==null&&H(yl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Na(rt),null;case 25:return null;default:return null}}function $d(e,t){switch(yi(t),t.tag){case 3:Na(rt),ze();break;case 26:case 27:case 5:Nt(t);break;case 4:ze();break;case 31:t.memoizedState!==null&&Vt(t);break;case 13:Vt(t);break;case 19:H(nt);break;case 10:Na(t.type);break;case 22:case 23:Vt(t),Li(),e!==null&&H(yl);break;case 24:Na(rt)}}function $n(e,t){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var r=n.next;a=r;do{if((a.tag&e)===e){n=void 0;var i=a.create,d=a.inst;n=i(),d.destroy=n}a=a.next}while(a!==r)}}catch(h){Be(t,t.return,h)}}function Xa(e,t,a){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){var d=n.inst,h=d.destroy;if(h!==void 0){d.destroy=void 0,r=t;var E=a,z=h;try{z()}catch(Q){Be(r,E,Q)}}}n=n.next}while(n!==i)}}catch(Q){Be(t,t.return,Q)}}function Qd(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Du(t,a)}catch(n){Be(e,e.return,n)}}}function Xd(e,t,a){a.props=Nl(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(n){Be(e,t,n)}}function Qn(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof a=="function"?e.refCleanup=a(n):a.current=n}}catch(r){Be(e,t,r)}}function fa(e,t){var a=e.ref,n=e.refCleanup;if(a!==null)if(typeof n=="function")try{n()}catch(r){Be(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(r){Be(e,t,r)}else a.current=null}function Kd(e){var t=e.type,a=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break e;case"img":a.src?n.src=a.src:a.srcSet&&(n.srcset=a.srcSet)}}catch(r){Be(e,e.return,r)}}function fo(e,t,a){try{var n=e.stateNode;eh(n,e.type,a,t),n[Rt]=t}catch(r){Be(e,e.return,r)}}function Zd(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Pa(e.type)||e.tag===4}function xo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Zd(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.tag===27&&Pa(e.type)||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 po(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=ya));else if(n!==4&&(n===27&&Pa(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(po(e,t,a),e=e.sibling;e!==null;)po(e,t,a),e=e.sibling}function Ps(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(n!==4&&(n===27&&Pa(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Ps(e,t,a),e=e.sibling;e!==null;)Ps(e,t,a),e=e.sibling}function Jd(e){var t=e.stateNode,a=e.memoizedProps;try{for(var n=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);jt(t,n,a),t[vt]=e,t[Rt]=a}catch(i){Be(e,e.return,i)}}var Ta=!1,ct=!1,mo=!1,Wd=typeof WeakSet=="function"?WeakSet:Set,mt=null;function Lm(e,t){if(e=e.containerInfo,Oo=br,e=ou(e),ii(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var n=a.getSelection&&a.getSelection();if(n&&n.rangeCount!==0){a=n.anchorNode;var r=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{a.nodeType,i.nodeType}catch{a=null;break e}var d=0,h=-1,E=-1,z=0,Q=0,Z=e,U=null;t:for(;;){for(var q;Z!==a||r!==0&&Z.nodeType!==3||(h=d+r),Z!==i||n!==0&&Z.nodeType!==3||(E=d+n),Z.nodeType===3&&(d+=Z.nodeValue.length),(q=Z.firstChild)!==null;)U=Z,Z=q;for(;;){if(Z===e)break t;if(U===a&&++z===r&&(h=d),U===i&&++Q===n&&(E=d),(q=Z.nextSibling)!==null)break;Z=U,U=Z.parentNode}Z=q}a=h===-1||E===-1?null:{start:h,end:E}}else a=null}a=a||{start:0,end:0}}else a=null;for(Bo={focusedElem:e,selectionRange:a},br=!1,mt=t;mt!==null;)if(t=mt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,mt=e;else for(;mt!==null;){switch(t=mt,i=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)r=e[a],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&i!==null){e=void 0,a=t,r=i.memoizedProps,i=i.memoizedState,n=a.stateNode;try{var de=Nl(a.type,r);e=n.getSnapshotBeforeUpdate(de,i),n.__reactInternalSnapshotBeforeUpdate=e}catch(ge){Be(a,a.return,ge)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)Vo(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Vo(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(u(163))}if(e=t.sibling,e!==null){e.return=t.return,mt=e;break}mt=t.return}}function Fd(e,t,a){var n=a.flags;switch(a.tag){case 0:case 11:case 15:Ra(e,a),n&4&&$n(5,a);break;case 1:if(Ra(e,a),n&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(d){Be(a,a.return,d)}else{var r=Nl(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(d){Be(a,a.return,d)}}n&64&&Qd(a),n&512&&Qn(a,a.return);break;case 3:if(Ra(e,a),n&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Du(e,t)}catch(d){Be(a,a.return,d)}}break;case 27:t===null&&n&4&&Jd(a);case 26:case 5:Ra(e,a),t===null&&n&4&&Kd(a),n&512&&Qn(a,a.return);break;case 12:Ra(e,a);break;case 31:Ra(e,a),n&4&&ef(e,a);break;case 13:Ra(e,a),n&4&&tf(e,a),n&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Gm.bind(null,a),oh(e,a))));break;case 22:if(n=a.memoizedState!==null||Ta,!n){t=t!==null&&t.memoizedState!==null||ct,r=Ta;var i=ct;Ta=n,(ct=t)&&!i?Ma(e,a,(a.subtreeFlags&8772)!==0):Ra(e,a),Ta=r,ct=i}break;case 30:break;default:Ra(e,a)}}function Id(e){var t=e.alternate;t!==null&&(e.alternate=null,Id(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&$r(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Ze=null,_t=!1;function Aa(e,t,a){for(a=a.child;a!==null;)Pd(e,t,a),a=a.sibling}function Pd(e,t,a){if(at&&typeof at.onCommitFiberUnmount=="function")try{at.onCommitFiberUnmount(ma,a)}catch{}switch(a.tag){case 26:ct||fa(a,t),Aa(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ct||fa(a,t);var n=Ze,r=_t;Pa(a.type)&&(Ze=a.stateNode,_t=!1),Aa(e,t,a),es(a.stateNode),Ze=n,_t=r;break;case 5:ct||fa(a,t);case 6:if(n=Ze,r=_t,Ze=null,Aa(e,t,a),Ze=n,_t=r,Ze!==null)if(_t)try{(Ze.nodeType===9?Ze.body:Ze.nodeName==="HTML"?Ze.ownerDocument.body:Ze).removeChild(a.stateNode)}catch(i){Be(a,t,i)}else try{Ze.removeChild(a.stateNode)}catch(i){Be(a,t,i)}break;case 18:Ze!==null&&(_t?(e=Ze,Xf(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),dn(e)):Xf(Ze,a.stateNode));break;case 4:n=Ze,r=_t,Ze=a.stateNode.containerInfo,_t=!0,Aa(e,t,a),Ze=n,_t=r;break;case 0:case 11:case 14:case 15:Xa(2,a,t),ct||Xa(4,a,t),Aa(e,t,a);break;case 1:ct||(fa(a,t),n=a.stateNode,typeof n.componentWillUnmount=="function"&&Xd(a,t,n)),Aa(e,t,a);break;case 21:Aa(e,t,a);break;case 22:ct=(n=ct)||a.memoizedState!==null,Aa(e,t,a),ct=n;break;default:Aa(e,t,a)}}function ef(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{dn(e)}catch(a){Be(t,t.return,a)}}}function tf(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{dn(e)}catch(a){Be(t,t.return,a)}}function zm(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Wd),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Wd),t;default:throw Error(u(435,e.tag))}}function er(e,t){var a=zm(e);t.forEach(function(n){if(!a.has(n)){a.add(n);var r=Ym.bind(null,e,n);n.then(r,r)}})}function Lt(e,t){var a=t.deletions;if(a!==null)for(var n=0;n<a.length;n++){var r=a[n],i=e,d=t,h=d;e:for(;h!==null;){switch(h.tag){case 27:if(Pa(h.type)){Ze=h.stateNode,_t=!1;break e}break;case 5:Ze=h.stateNode,_t=!1;break e;case 3:case 4:Ze=h.stateNode.containerInfo,_t=!0;break e}h=h.return}if(Ze===null)throw Error(u(160));Pd(i,d,r),Ze=null,_t=!1,i=r.alternate,i!==null&&(i.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)af(t,e),t=t.sibling}var ia=null;function af(e,t){var a=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Lt(t,e),zt(e),n&4&&(Xa(3,e,e.return),$n(3,e),Xa(5,e,e.return));break;case 1:Lt(t,e),zt(e),n&512&&(ct||a===null||fa(a,a.return)),n&64&&Ta&&(e=e.updateQueue,e!==null&&(n=e.callbacks,n!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?n:a.concat(n))));break;case 26:var r=ia;if(Lt(t,e),zt(e),n&512&&(ct||a===null||fa(a,a.return)),n&4){var i=a!==null?a.memoizedState:null;if(n=e.memoizedState,a===null)if(n===null)if(e.stateNode===null){e:{n=e.type,a=e.memoizedProps,r=r.ownerDocument||r;t:switch(n){case"title":i=r.getElementsByTagName("title")[0],(!i||i[yn]||i[vt]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=r.createElement(n),r.head.insertBefore(i,r.querySelector("head > title"))),jt(i,n,a),i[vt]=e,pt(i),n=i;break e;case"link":var d=lx("link","href",r).get(n+(a.href||""));if(d){for(var h=0;h<d.length;h++)if(i=d[h],i.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&i.getAttribute("rel")===(a.rel==null?null:a.rel)&&i.getAttribute("title")===(a.title==null?null:a.title)&&i.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){d.splice(h,1);break t}}i=r.createElement(n),jt(i,n,a),r.head.appendChild(i);break;case"meta":if(d=lx("meta","content",r).get(n+(a.content||""))){for(h=0;h<d.length;h++)if(i=d[h],i.getAttribute("content")===(a.content==null?null:""+a.content)&&i.getAttribute("name")===(a.name==null?null:a.name)&&i.getAttribute("property")===(a.property==null?null:a.property)&&i.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&i.getAttribute("charset")===(a.charSet==null?null:a.charSet)){d.splice(h,1);break t}}i=r.createElement(n),jt(i,n,a),r.head.appendChild(i);break;default:throw Error(u(468,n))}i[vt]=e,pt(i),n=i}e.stateNode=n}else nx(r,e.type,e.stateNode);else e.stateNode=ax(r,n,e.memoizedProps);else i!==n?(i===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):i.count--,n===null?nx(r,e.type,e.stateNode):ax(r,n,e.memoizedProps)):n===null&&e.stateNode!==null&&fo(e,e.memoizedProps,a.memoizedProps)}break;case 27:Lt(t,e),zt(e),n&512&&(ct||a===null||fa(a,a.return)),a!==null&&n&4&&fo(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Lt(t,e),zt(e),n&512&&(ct||a===null||fa(a,a.return)),e.flags&32){r=e.stateNode;try{Ll(r,"")}catch(de){Be(e,e.return,de)}}n&4&&e.stateNode!=null&&(r=e.memoizedProps,fo(e,r,a!==null?a.memoizedProps:r)),n&1024&&(mo=!0);break;case 6:if(Lt(t,e),zt(e),n&4){if(e.stateNode===null)throw Error(u(162));n=e.memoizedProps,a=e.stateNode;try{a.nodeValue=n}catch(de){Be(e,e.return,de)}}break;case 3:if(hr=null,r=ia,ia=pr(t.containerInfo),Lt(t,e),ia=r,zt(e),n&4&&a!==null&&a.memoizedState.isDehydrated)try{dn(t.containerInfo)}catch(de){Be(e,e.return,de)}mo&&(mo=!1,lf(e));break;case 4:n=ia,ia=pr(e.stateNode.containerInfo),Lt(t,e),zt(e),ia=n;break;case 12:Lt(t,e),zt(e);break;case 31:Lt(t,e),zt(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,er(e,n)));break;case 13:Lt(t,e),zt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(ar=Fe()),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,er(e,n)));break;case 22:r=e.memoizedState!==null;var E=a!==null&&a.memoizedState!==null,z=Ta,Q=ct;if(Ta=z||r,ct=Q||E,Lt(t,e),ct=Q,Ta=z,zt(e),n&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(a===null||E||Ta||ct||kl(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){E=a=t;try{if(i=E.stateNode,r)d=i.style,typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none";else{h=E.stateNode;var Z=E.memoizedProps.style,U=Z!=null&&Z.hasOwnProperty("display")?Z.display:null;h.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(de){Be(E,E.return,de)}}}else if(t.tag===6){if(a===null){E=t;try{E.stateNode.nodeValue=r?"":E.memoizedProps}catch(de){Be(E,E.return,de)}}}else if(t.tag===18){if(a===null){E=t;try{var q=E.stateNode;r?Kf(q,!0):Kf(E.stateNode,!1)}catch(de){Be(E,E.return,de)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}n&4&&(n=e.updateQueue,n!==null&&(a=n.retryQueue,a!==null&&(n.retryQueue=null,er(e,a))));break;case 19:Lt(t,e),zt(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,er(e,n)));break;case 30:break;case 21:break;default:Lt(t,e),zt(e)}}function zt(e){var t=e.flags;if(t&2){try{for(var a,n=e.return;n!==null;){if(Zd(n)){a=n;break}n=n.return}if(a==null)throw Error(u(160));switch(a.tag){case 27:var r=a.stateNode,i=xo(e);Ps(e,i,r);break;case 5:var d=a.stateNode;a.flags&32&&(Ll(d,""),a.flags&=-33);var h=xo(e);Ps(e,h,d);break;case 3:case 4:var E=a.stateNode.containerInfo,z=xo(e);po(e,z,E);break;default:throw Error(u(161))}}catch(Q){Be(e,e.return,Q)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function lf(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;lf(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ra(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Fd(e,t.alternate,t),t=t.sibling}function kl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Xa(4,t,t.return),kl(t);break;case 1:fa(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Xd(t,t.return,a),kl(t);break;case 27:es(t.stateNode);case 26:case 5:fa(t,t.return),kl(t);break;case 22:t.memoizedState===null&&kl(t);break;case 30:kl(t);break;default:kl(t)}e=e.sibling}}function Ma(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var n=t.alternate,r=e,i=t,d=i.flags;switch(i.tag){case 0:case 11:case 15:Ma(r,i,a),$n(4,i);break;case 1:if(Ma(r,i,a),n=i,r=n.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(z){Be(n,n.return,z)}if(n=i,r=n.updateQueue,r!==null){var h=n.stateNode;try{var E=r.shared.hiddenCallbacks;if(E!==null)for(r.shared.hiddenCallbacks=null,r=0;r<E.length;r++)zu(E[r],h)}catch(z){Be(n,n.return,z)}}a&&d&64&&Qd(i),Qn(i,i.return);break;case 27:Jd(i);case 26:case 5:Ma(r,i,a),a&&n===null&&d&4&&Kd(i),Qn(i,i.return);break;case 12:Ma(r,i,a);break;case 31:Ma(r,i,a),a&&d&4&&ef(r,i);break;case 13:Ma(r,i,a),a&&d&4&&tf(r,i);break;case 22:i.memoizedState===null&&Ma(r,i,a),Qn(i,i.return);break;case 30:break;default:Ma(r,i,a)}t=t.sibling}}function ho(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Mn(a))}function vo(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Mn(e))}function oa(e,t,a,n){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)nf(e,t,a,n),t=t.sibling}function nf(e,t,a,n){var r=t.flags;switch(t.tag){case 0:case 11:case 15:oa(e,t,a,n),r&2048&&$n(9,t);break;case 1:oa(e,t,a,n);break;case 3:oa(e,t,a,n),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Mn(e)));break;case 12:if(r&2048){oa(e,t,a,n),e=t.stateNode;try{var i=t.memoizedProps,d=i.id,h=i.onPostCommit;typeof h=="function"&&h(d,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(E){Be(t,t.return,E)}}else oa(e,t,a,n);break;case 31:oa(e,t,a,n);break;case 13:oa(e,t,a,n);break;case 23:break;case 22:i=t.stateNode,d=t.alternate,t.memoizedState!==null?i._visibility&2?oa(e,t,a,n):Xn(e,t):i._visibility&2?oa(e,t,a,n):(i._visibility|=2,Pl(e,t,a,n,(t.subtreeFlags&10256)!==0||!1)),r&2048&&ho(d,t);break;case 24:oa(e,t,a,n),r&2048&&vo(t.alternate,t);break;default:oa(e,t,a,n)}}function Pl(e,t,a,n,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,d=t,h=a,E=n,z=d.flags;switch(d.tag){case 0:case 11:case 15:Pl(i,d,h,E,r),$n(8,d);break;case 23:break;case 22:var Q=d.stateNode;d.memoizedState!==null?Q._visibility&2?Pl(i,d,h,E,r):Xn(i,d):(Q._visibility|=2,Pl(i,d,h,E,r)),r&&z&2048&&ho(d.alternate,d);break;case 24:Pl(i,d,h,E,r),r&&z&2048&&vo(d.alternate,d);break;default:Pl(i,d,h,E,r)}t=t.sibling}}function Xn(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,n=t,r=n.flags;switch(n.tag){case 22:Xn(a,n),r&2048&&ho(n.alternate,n);break;case 24:Xn(a,n),r&2048&&vo(n.alternate,n);break;default:Xn(a,n)}t=t.sibling}}var Kn=8192;function en(e,t,a){if(e.subtreeFlags&Kn)for(e=e.child;e!==null;)sf(e,t,a),e=e.sibling}function sf(e,t,a){switch(e.tag){case 26:en(e,t,a),e.flags&Kn&&e.memoizedState!==null&&bh(a,ia,e.memoizedState,e.memoizedProps);break;case 5:en(e,t,a);break;case 3:case 4:var n=ia;ia=pr(e.stateNode.containerInfo),en(e,t,a),ia=n;break;case 22:e.memoizedState===null&&(n=e.alternate,n!==null&&n.memoizedState!==null?(n=Kn,Kn=16777216,en(e,t,a),Kn=n):en(e,t,a));break;default:en(e,t,a)}}function rf(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Zn(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var n=t[a];mt=n,cf(n,e)}rf(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)of(e),e=e.sibling}function of(e){switch(e.tag){case 0:case 11:case 15:Zn(e),e.flags&2048&&Xa(9,e,e.return);break;case 3:Zn(e);break;case 12:Zn(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,tr(e)):Zn(e);break;default:Zn(e)}}function tr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var n=t[a];mt=n,cf(n,e)}rf(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Xa(8,t,t.return),tr(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,tr(t));break;default:tr(t)}e=e.sibling}}function cf(e,t){for(;mt!==null;){var a=mt;switch(a.tag){case 0:case 11:case 15:Xa(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var n=a.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:Mn(a.memoizedState.cache)}if(n=a.child,n!==null)n.return=a,mt=n;else e:for(a=e;mt!==null;){n=mt;var r=n.sibling,i=n.return;if(Id(n),n===a){mt=null;break e}if(r!==null){r.return=i,mt=r;break e}mt=i}}}var Dm={getCacheForType:function(e){var t=gt(rt),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return gt(rt).controller.signal}},Om=typeof WeakMap=="function"?WeakMap:Map,De=0,qe=null,Ce=null,Te=0,Oe=0,qt=null,Ka=!1,tn=!1,yo=!1,_a=0,et=0,Za=0,El=0,go=0,Gt=0,an=0,Jn=null,Dt=null,bo=!1,ar=0,uf=0,lr=1/0,nr=null,Ja=null,dt=0,Wa=null,ln=null,La=0,jo=0,So=null,df=null,Wn=0,No=null;function Yt(){return(De&2)!==0&&Te!==0?Te&-Te:S.T!==null?Ao():Cc()}function ff(){if(Gt===0)if((Te&536870912)===0||Re){var e=xt;xt<<=1,(xt&3932160)===0&&(xt=262144),Gt=e}else Gt=536870912;return e=Ht.current,e!==null&&(e.flags|=32),Gt}function Ot(e,t,a){(e===qe&&(Oe===2||Oe===9)||e.cancelPendingCommit!==null)&&(nn(e,0),Fa(e,Te,Gt,!1)),vn(e,a),((De&2)===0||e!==qe)&&(e===qe&&((De&2)===0&&(El|=a),et===4&&Fa(e,Te,Gt,!1)),xa(e))}function xf(e,t,a){if((De&6)!==0)throw Error(u(327));var n=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Kt(e,t),r=n?Hm(e,t):Eo(e,t,!0),i=n;do{if(r===0){tn&&!n&&Fa(e,t,0,!1);break}else{if(a=e.current.alternate,i&&!Bm(a)){r=Eo(e,t,!1),i=!1;continue}if(r===2){if(i=t,e.errorRecoveryDisabledLanes&i)var d=0;else d=e.pendingLanes&-536870913,d=d!==0?d:d&536870912?536870912:0;if(d!==0){t=d;e:{var h=e;r=Jn;var E=h.current.memoizedState.isDehydrated;if(E&&(nn(h,d).flags|=256),d=Eo(h,d,!1),d!==2){if(yo&&!E){h.errorRecoveryDisabledLanes|=i,El|=i,r=4;break e}i=Dt,Dt=r,i!==null&&(Dt===null?Dt=i:Dt.push.apply(Dt,i))}r=d}if(i=!1,r!==2)continue}}if(r===1){nn(e,0),Fa(e,t,0,!0);break}e:{switch(n=e,i=r,i){case 0:case 1:throw Error(u(345));case 4:if((t&4194048)!==t)break;case 6:Fa(n,t,Gt,!Ka);break e;case 2:Dt=null;break;case 3:case 5:break;default:throw Error(u(329))}if((t&62914560)===t&&(r=ar+300-Fe(),10<r)){if(Fa(n,t,Gt,!Ka),hn(n,0,!0)!==0)break e;La=t,n.timeoutHandle=$f(pf.bind(null,n,a,Dt,nr,bo,t,Gt,El,an,Ka,i,"Throttled",-0,0),r);break e}pf(n,a,Dt,nr,bo,t,Gt,El,an,Ka,i,null,-0,0)}}break}while(!0);xa(e)}function pf(e,t,a,n,r,i,d,h,E,z,Q,Z,U,q){if(e.timeoutHandle=-1,Z=t.subtreeFlags,Z&8192||(Z&16785408)===16785408){Z={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ya},sf(t,i,Z);var de=(i&62914560)===i?ar-Fe():(i&4194048)===i?uf-Fe():0;if(de=jh(Z,de),de!==null){La=i,e.cancelPendingCommit=de(Sf.bind(null,e,t,i,a,n,r,d,h,E,Q,Z,null,U,q)),Fa(e,i,d,!z);return}}Sf(e,t,i,a,n,r,d,h,E)}function Bm(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var n=0;n<a.length;n++){var r=a[n],i=r.getSnapshot;r=r.value;try{if(!Bt(i(),r))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Fa(e,t,a,n){t&=~go,t&=~El,e.suspendedLanes|=t,e.pingedLanes&=~t,n&&(e.warmLanes|=t),n=e.expirationTimes;for(var r=t;0<r;){var i=31-We(r),d=1<<i;n[i]=-1,r&=~d}a!==0&&Nc(e,a,t)}function sr(){return(De&6)===0?(Fn(0),!1):!0}function ko(){if(Ce!==null){if(Oe===0)var e=Ce.return;else e=Ce,Sa=hl=null,Hi(e),Zl=null,Ln=0,e=Ce;for(;e!==null;)$d(e.alternate,e),e=e.return;Ce=null}}function nn(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,lh(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),La=0,ko(),qe=e,Ce=a=ba(e.current,null),Te=t,Oe=0,qt=null,Ka=!1,tn=Kt(e,t),yo=!1,an=Gt=go=El=Za=et=0,Dt=Jn=null,bo=!1,(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-We(n),i=1<<r;t|=e[r],n&=~i}return _a=t,Cs(),a}function mf(e,t){Ne=null,S.H=qn,t===Kl||t===zs?(t=Ru(),Oe=3):t===wi?(t=Ru(),Oe=4):Oe=t===to?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,qt=t,Ce===null&&(et=1,Zs(e,Ft(t,e.current)))}function hf(){var e=Ht.current;return e===null?!0:(Te&4194048)===Te?ta===null:(Te&62914560)===Te||(Te&536870912)!==0?e===ta:!1}function vf(){var e=S.H;return S.H=qn,e===null?qn:e}function yf(){var e=S.A;return S.A=Dm,e}function rr(){et=4,Ka||(Te&4194048)!==Te&&Ht.current!==null||(tn=!0),(Za&134217727)===0&&(El&134217727)===0||qe===null||Fa(qe,Te,Gt,!1)}function Eo(e,t,a){var n=De;De|=2;var r=vf(),i=yf();(qe!==e||Te!==t)&&(nr=null,nn(e,t)),t=!1;var d=et;e:do try{if(Oe!==0&&Ce!==null){var h=Ce,E=qt;switch(Oe){case 8:ko(),d=6;break e;case 3:case 2:case 9:case 6:Ht.current===null&&(t=!0);var z=Oe;if(Oe=0,qt=null,sn(e,h,E,z),a&&tn){d=0;break e}break;default:z=Oe,Oe=0,qt=null,sn(e,h,E,z)}}Um(),d=et;break}catch(Q){mf(e,Q)}while(!0);return t&&e.shellSuspendCounter++,Sa=hl=null,De=n,S.H=r,S.A=i,Ce===null&&(qe=null,Te=0,Cs()),d}function Um(){for(;Ce!==null;)gf(Ce)}function Hm(e,t){var a=De;De|=2;var n=vf(),r=yf();qe!==e||Te!==t?(nr=null,lr=Fe()+500,nn(e,t)):tn=Kt(e,t);e:do try{if(Oe!==0&&Ce!==null){t=Ce;var i=qt;t:switch(Oe){case 1:Oe=0,qt=null,sn(e,t,i,1);break;case 2:case 9:if(Tu(i)){Oe=0,qt=null,bf(t);break}t=function(){Oe!==2&&Oe!==9||qe!==e||(Oe=7),xa(e)},i.then(t,t);break e;case 3:Oe=7;break e;case 4:Oe=5;break e;case 7:Tu(i)?(Oe=0,qt=null,bf(t)):(Oe=0,qt=null,sn(e,t,i,7));break;case 5:var d=null;switch(Ce.tag){case 26:d=Ce.memoizedState;case 5:case 27:var h=Ce;if(d?sx(d):h.stateNode.complete){Oe=0,qt=null;var E=h.sibling;if(E!==null)Ce=E;else{var z=h.return;z!==null?(Ce=z,ir(z)):Ce=null}break t}}Oe=0,qt=null,sn(e,t,i,5);break;case 6:Oe=0,qt=null,sn(e,t,i,6);break;case 8:ko(),et=6;break e;default:throw Error(u(462))}}Vm();break}catch(Q){mf(e,Q)}while(!0);return Sa=hl=null,S.H=n,S.A=r,De=a,Ce!==null?0:(qe=null,Te=0,Cs(),et)}function Vm(){for(;Ce!==null&&!wt();)gf(Ce)}function gf(e){var t=Gd(e.alternate,e,_a);e.memoizedProps=e.pendingProps,t===null?ir(e):Ce=t}function bf(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Od(a,t,t.pendingProps,t.type,void 0,Te);break;case 11:t=Od(a,t,t.pendingProps,t.type.render,t.ref,Te);break;case 5:Hi(t);default:$d(a,t),t=Ce=vu(t,_a),t=Gd(a,t,_a)}e.memoizedProps=e.pendingProps,t===null?ir(e):Ce=t}function sn(e,t,a,n){Sa=hl=null,Hi(t),Zl=null,Ln=0;var r=t.return;try{if(Tm(e,r,t,a,Te)){et=1,Zs(e,Ft(a,e.current)),Ce=null;return}}catch(i){if(r!==null)throw Ce=r,i;et=1,Zs(e,Ft(a,e.current)),Ce=null;return}t.flags&32768?(Re||n===1?e=!0:tn||(Te&536870912)!==0?e=!1:(Ka=e=!0,(n===2||n===9||n===3||n===6)&&(n=Ht.current,n!==null&&n.tag===13&&(n.flags|=16384))),jf(t,e)):ir(t)}function ir(e){var t=e;do{if((t.flags&32768)!==0){jf(t,Ka);return}e=t.return;var a=Mm(t.alternate,t,_a);if(a!==null){Ce=a;return}if(t=t.sibling,t!==null){Ce=t;return}Ce=t=e}while(t!==null);et===0&&(et=5)}function jf(e,t){do{var a=_m(e.alternate,e);if(a!==null){a.flags&=32767,Ce=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){Ce=e;return}Ce=e=a}while(e!==null);et=6,Ce=null}function Sf(e,t,a,n,r,i,d,h,E){e.cancelPendingCommit=null;do or();while(dt!==0);if((De&6)!==0)throw Error(u(327));if(t!==null){if(t===e.current)throw Error(u(177));if(i=t.lanes|t.childLanes,i|=fi,gp(e,a,i,d,h,E),e===qe&&(Ce=qe=null,Te=0),ln=t,Wa=e,La=a,jo=i,So=r,df=n,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,$m(Se,function(){return wf(),null})):(e.callbackNode=null,e.callbackPriority=0),n=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||n){n=S.T,S.T=null,r=A.p,A.p=2,d=De,De|=4;try{Lm(e,t,a)}finally{De=d,A.p=r,S.T=n}}dt=1,Nf(),kf(),Ef()}}function Nf(){if(dt===1){dt=0;var e=Wa,t=ln,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=S.T,S.T=null;var n=A.p;A.p=2;var r=De;De|=4;try{af(t,e);var i=Bo,d=ou(e.containerInfo),h=i.focusedElem,E=i.selectionRange;if(d!==h&&h&&h.ownerDocument&&iu(h.ownerDocument.documentElement,h)){if(E!==null&&ii(h)){var z=E.start,Q=E.end;if(Q===void 0&&(Q=z),"selectionStart"in h)h.selectionStart=z,h.selectionEnd=Math.min(Q,h.value.length);else{var Z=h.ownerDocument||document,U=Z&&Z.defaultView||window;if(U.getSelection){var q=U.getSelection(),de=h.textContent.length,ge=Math.min(E.start,de),Ve=E.end===void 0?ge:Math.min(E.end,de);!q.extend&&ge>Ve&&(d=Ve,Ve=ge,ge=d);var R=ru(h,ge),T=ru(h,Ve);if(R&&T&&(q.rangeCount!==1||q.anchorNode!==R.node||q.anchorOffset!==R.offset||q.focusNode!==T.node||q.focusOffset!==T.offset)){var L=Z.createRange();L.setStart(R.node,R.offset),q.removeAllRanges(),ge>Ve?(q.addRange(L),q.extend(T.node,T.offset)):(L.setEnd(T.node,T.offset),q.addRange(L))}}}}for(Z=[],q=h;q=q.parentNode;)q.nodeType===1&&Z.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h<Z.length;h++){var K=Z[h];K.element.scrollLeft=K.left,K.element.scrollTop=K.top}}br=!!Oo,Bo=Oo=null}finally{De=r,A.p=n,S.T=a}}e.current=t,dt=2}}function kf(){if(dt===2){dt=0;var e=Wa,t=ln,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=S.T,S.T=null;var n=A.p;A.p=2;var r=De;De|=4;try{Fd(e,t.alternate,t)}finally{De=r,A.p=n,S.T=a}}dt=3}}function Ef(){if(dt===4||dt===3){dt=0,Xt();var e=Wa,t=ln,a=La,n=df;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?dt=5:(dt=0,ln=Wa=null,Cf(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Ja=null),Gr(a),t=t.stateNode,at&&typeof at.onCommitFiberRoot=="function")try{at.onCommitFiberRoot(ma,t,void 0,(t.current.flags&128)===128)}catch{}if(n!==null){t=S.T,r=A.p,A.p=2,S.T=null;try{for(var i=e.onRecoverableError,d=0;d<n.length;d++){var h=n[d];i(h.value,{componentStack:h.stack})}}finally{S.T=t,A.p=r}}(La&3)!==0&&or(),xa(e),r=e.pendingLanes,(a&261930)!==0&&(r&42)!==0?e===No?Wn++:(Wn=0,No=e):Wn=0,Fn(0)}}function Cf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Mn(t)))}function or(){return Nf(),kf(),Ef(),wf()}function wf(){if(dt!==5)return!1;var e=Wa,t=jo;jo=0;var a=Gr(La),n=S.T,r=A.p;try{A.p=32>a?32:a,S.T=null,a=So,So=null;var i=Wa,d=La;if(dt=0,ln=Wa=null,La=0,(De&6)!==0)throw Error(u(331));var h=De;if(De|=4,of(i.current),nf(i,i.current,d,a),De=h,Fn(0,!1),at&&typeof at.onPostCommitFiberRoot=="function")try{at.onPostCommitFiberRoot(ma,i)}catch{}return!0}finally{A.p=r,S.T=n,Cf(e,t)}}function Tf(e,t,a){t=Ft(a,t),t=eo(e.stateNode,t,2),e=Ya(e,t,2),e!==null&&(vn(e,2),xa(e))}function Be(e,t,a){if(e.tag===3)Tf(e,e,a);else for(;t!==null;){if(t.tag===3){Tf(t,e,a);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Ja===null||!Ja.has(n))){e=Ft(a,e),a=Td(2),n=Ya(t,a,2),n!==null&&(Ad(a,n,t,e),vn(n,2),xa(n));break}}t=t.return}}function Co(e,t,a){var n=e.pingCache;if(n===null){n=e.pingCache=new Om;var r=new Set;n.set(t,r)}else r=n.get(t),r===void 0&&(r=new Set,n.set(t,r));r.has(a)||(yo=!0,r.add(a),e=qm.bind(null,e,t,a),t.then(e,e))}function qm(e,t,a){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,qe===e&&(Te&a)===a&&(et===4||et===3&&(Te&62914560)===Te&&300>Fe()-ar?(De&2)===0&&nn(e,0):go|=a,an===Te&&(an=0)),xa(e)}function Af(e,t){t===0&&(t=Sc()),e=xl(e,t),e!==null&&(vn(e,t),xa(e))}function Gm(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Af(e,a)}function Ym(e,t){var a=0;switch(e.tag){case 31:case 13:var n=e.stateNode,r=e.memoizedState;r!==null&&(a=r.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(u(314))}n!==null&&n.delete(t),Af(e,a)}function $m(e,t){return ca(e,t)}var cr=null,rn=null,wo=!1,ur=!1,To=!1,Ia=0;function xa(e){e!==rn&&e.next===null&&(rn===null?cr=rn=e:rn=rn.next=e),ur=!0,wo||(wo=!0,Xm())}function Fn(e,t){if(!To&&ur){To=!0;do for(var a=!1,n=cr;n!==null;){if(e!==0){var r=n.pendingLanes;if(r===0)var i=0;else{var d=n.suspendedLanes,h=n.pingedLanes;i=(1<<31-We(42|e)+1)-1,i&=r&~(d&~h),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(a=!0,Lf(n,i))}else i=Te,i=hn(n,n===qe?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(i&3)===0||Kt(n,i)||(a=!0,Lf(n,i));n=n.next}while(a);To=!1}}function Qm(){Rf()}function Rf(){ur=wo=!1;var e=0;Ia!==0&&ah()&&(e=Ia);for(var t=Fe(),a=null,n=cr;n!==null;){var r=n.next,i=Mf(n,t);i===0?(n.next=null,a===null?cr=r:a.next=r,r===null&&(rn=a)):(a=n,(e!==0||(i&3)!==0)&&(ur=!0)),n=r}dt!==0&&dt!==5||Fn(e),Ia!==0&&(Ia=0)}function Mf(e,t){for(var a=e.suspendedLanes,n=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var d=31-We(i),h=1<<d,E=r[d];E===-1?((h&a)===0||(h&n)!==0)&&(r[d]=Hr(h,t)):E<=t&&(e.expiredLanes|=h),i&=~h}if(t=qe,a=Te,a=hn(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n=e.callbackNode,a===0||e===t&&(Oe===2||Oe===9)||e.cancelPendingCommit!==null)return n!==null&&n!==null&&Je(n),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Kt(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(n!==null&&Je(n),Gr(a)){case 2:case 8:a=ht;break;case 32:a=Se;break;case 268435456:a=At;break;default:a=Se}return n=_f.bind(null,e),a=ca(a,n),e.callbackPriority=t,e.callbackNode=a,t}return n!==null&&n!==null&&Je(n),e.callbackPriority=2,e.callbackNode=null,2}function _f(e,t){if(dt!==0&&dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(or()&&e.callbackNode!==a)return null;var n=Te;return n=hn(e,e===qe?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n===0?null:(xf(e,n,t),Mf(e,Fe()),e.callbackNode!=null&&e.callbackNode===a?_f.bind(null,e):null)}function Lf(e,t){if(or())return null;xf(e,t,!0)}function Xm(){nh(function(){(De&6)!==0?ca(ce,Qm):Rf()})}function Ao(){if(Ia===0){var e=Ql;e===0&&(e=Ee,Ee<<=1,(Ee&261888)===0&&(Ee=256)),Ia=e}return Ia}function zf(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ys(""+e)}function Df(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function Km(e,t,a,n,r){if(t==="submit"&&a&&a.stateNode===r){var i=zf((r[Rt]||null).action),d=n.submitter;d&&(t=(t=d[Rt]||null)?zf(t.formAction):d.getAttribute("formAction"),t!==null&&(i=t,d=null));var h=new Ss("action","action",null,n,r);e.push({event:h,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(Ia!==0){var E=d?Df(r,d):new FormData(r);Zi(a,{pending:!0,data:E,method:r.method,action:i},null,E)}}else typeof i=="function"&&(h.preventDefault(),E=d?Df(r,d):new FormData(r),Zi(a,{pending:!0,data:E,method:r.method,action:i},i,E))},currentTarget:r}]})}}for(var Ro=0;Ro<di.length;Ro++){var Mo=di[Ro],Zm=Mo.toLowerCase(),Jm=Mo[0].toUpperCase()+Mo.slice(1);ra(Zm,"on"+Jm)}ra(du,"onAnimationEnd"),ra(fu,"onAnimationIteration"),ra(xu,"onAnimationStart"),ra("dblclick","onDoubleClick"),ra("focusin","onFocus"),ra("focusout","onBlur"),ra(dm,"onTransitionRun"),ra(fm,"onTransitionStart"),ra(xm,"onTransitionCancel"),ra(pu,"onTransitionEnd"),Ml("onMouseEnter",["mouseout","mouseover"]),Ml("onMouseLeave",["mouseout","mouseover"]),Ml("onPointerEnter",["pointerout","pointerover"]),Ml("onPointerLeave",["pointerout","pointerover"]),cl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),cl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),cl("onBeforeInput",["compositionend","keypress","textInput","paste"]),cl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),cl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),cl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var In="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Wm=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(In));function Of(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var n=e[a],r=n.event;n=n.listeners;e:{var i=void 0;if(t)for(var d=n.length-1;0<=d;d--){var h=n[d],E=h.instance,z=h.currentTarget;if(h=h.listener,E!==i&&r.isPropagationStopped())break e;i=h,r.currentTarget=z;try{i(r)}catch(Q){Es(Q)}r.currentTarget=null,i=E}else for(d=0;d<n.length;d++){if(h=n[d],E=h.instance,z=h.currentTarget,h=h.listener,E!==i&&r.isPropagationStopped())break e;i=h,r.currentTarget=z;try{i(r)}catch(Q){Es(Q)}r.currentTarget=null,i=E}}}}function we(e,t){var a=t[Yr];a===void 0&&(a=t[Yr]=new Set);var n=e+"__bubble";a.has(n)||(Bf(t,e,2,!1),a.add(n))}function _o(e,t,a){var n=0;t&&(n|=4),Bf(a,e,n,t)}var dr="_reactListening"+Math.random().toString(36).slice(2);function Lo(e){if(!e[dr]){e[dr]=!0,Ac.forEach(function(a){a!=="selectionchange"&&(Wm.has(a)||_o(a,!1,e),_o(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[dr]||(t[dr]=!0,_o("selectionchange",!1,t))}}function Bf(e,t,a,n){switch(fx(t)){case 2:var r=kh;break;case 8:r=Eh;break;default:r=Zo}a=r.bind(null,t,a,e),r=void 0,!Ir||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),n?r!==void 0?e.addEventListener(t,a,{capture:!0,passive:r}):e.addEventListener(t,a,!0):r!==void 0?e.addEventListener(t,a,{passive:r}):e.addEventListener(t,a,!1)}function zo(e,t,a,n,r){var i=n;if((t&1)===0&&(t&2)===0&&n!==null)e:for(;;){if(n===null)return;var d=n.tag;if(d===3||d===4){var h=n.stateNode.containerInfo;if(h===r)break;if(d===4)for(d=n.return;d!==null;){var E=d.tag;if((E===3||E===4)&&d.stateNode.containerInfo===r)return;d=d.return}for(;h!==null;){if(d=Tl(h),d===null)return;if(E=d.tag,E===5||E===6||E===26||E===27){n=i=d;continue e}h=h.parentNode}}n=n.return}qc(function(){var z=i,Q=Wr(a),Z=[];e:{var U=mu.get(e);if(U!==void 0){var q=Ss,de=e;switch(e){case"keypress":if(bs(a)===0)break e;case"keydown":case"keyup":q=Yp;break;case"focusin":de="focus",q=ai;break;case"focusout":de="blur",q=ai;break;case"beforeblur":case"afterblur":q=ai;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":q=$c;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":q=Mp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":q=Xp;break;case du:case fu:case xu:q=zp;break;case pu:q=Zp;break;case"scroll":case"scrollend":q=Ap;break;case"wheel":q=Wp;break;case"copy":case"cut":case"paste":q=Op;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":q=Xc;break;case"toggle":case"beforetoggle":q=Ip}var ge=(t&4)!==0,Ve=!ge&&(e==="scroll"||e==="scrollend"),R=ge?U!==null?U+"Capture":null:U;ge=[];for(var T=z,L;T!==null;){var K=T;if(L=K.stateNode,K=K.tag,K!==5&&K!==26&&K!==27||L===null||R===null||(K=bn(T,R),K!=null&&ge.push(Pn(T,K,L))),Ve)break;T=T.return}0<ge.length&&(U=new q(U,de,null,a,Q),Z.push({event:U,listeners:ge}))}}if((t&7)===0){e:{if(U=e==="mouseover"||e==="pointerover",q=e==="mouseout"||e==="pointerout",U&&a!==Jr&&(de=a.relatedTarget||a.fromElement)&&(Tl(de)||de[wl]))break e;if((q||U)&&(U=Q.window===Q?Q:(U=Q.ownerDocument)?U.defaultView||U.parentWindow:window,q?(de=a.relatedTarget||a.toElement,q=z,de=de?Tl(de):null,de!==null&&(Ve=v(de),ge=de.tag,de!==Ve||ge!==5&&ge!==27&&ge!==6)&&(de=null)):(q=null,de=z),q!==de)){if(ge=$c,K="onMouseLeave",R="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(ge=Xc,K="onPointerLeave",R="onPointerEnter",T="pointer"),Ve=q==null?U:gn(q),L=de==null?U:gn(de),U=new ge(K,T+"leave",q,a,Q),U.target=Ve,U.relatedTarget=L,K=null,Tl(Q)===z&&(ge=new ge(R,T+"enter",de,a,Q),ge.target=L,ge.relatedTarget=Ve,K=ge),Ve=K,q&&de)t:{for(ge=Fm,R=q,T=de,L=0,K=R;K;K=ge(K))L++;K=0;for(var ve=T;ve;ve=ge(ve))K++;for(;0<L-K;)R=ge(R),L--;for(;0<K-L;)T=ge(T),K--;for(;L--;){if(R===T||T!==null&&R===T.alternate){ge=R;break t}R=ge(R),T=ge(T)}ge=null}else ge=null;q!==null&&Uf(Z,U,q,ge,!1),de!==null&&Ve!==null&&Uf(Z,Ve,de,ge,!0)}}e:{if(U=z?gn(z):window,q=U.nodeName&&U.nodeName.toLowerCase(),q==="select"||q==="input"&&U.type==="file")var _e=eu;else if(Ic(U))if(tu)_e=om;else{_e=rm;var pe=sm}else q=U.nodeName,!q||q.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?z&&Zr(z.elementType)&&(_e=eu):_e=im;if(_e&&(_e=_e(e,z))){Pc(Z,_e,a,Q);break e}pe&&pe(e,U,z),e==="focusout"&&z&&U.type==="number"&&z.memoizedProps.value!=null&&Kr(U,"number",U.value)}switch(pe=z?gn(z):window,e){case"focusin":(Ic(pe)||pe.contentEditable==="true")&&(Bl=pe,oi=z,Tn=null);break;case"focusout":Tn=oi=Bl=null;break;case"mousedown":ci=!0;break;case"contextmenu":case"mouseup":case"dragend":ci=!1,cu(Z,a,Q);break;case"selectionchange":if(um)break;case"keydown":case"keyup":cu(Z,a,Q)}var ke;if(ni)e:{switch(e){case"compositionstart":var Ae="onCompositionStart";break e;case"compositionend":Ae="onCompositionEnd";break e;case"compositionupdate":Ae="onCompositionUpdate";break e}Ae=void 0}else Ol?Wc(e,a)&&(Ae="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ae="onCompositionStart");Ae&&(Kc&&a.locale!=="ko"&&(Ol||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&Ol&&(ke=Gc()):(Oa=Q,Pr="value"in Oa?Oa.value:Oa.textContent,Ol=!0)),pe=fr(z,Ae),0<pe.length&&(Ae=new Qc(Ae,e,null,a,Q),Z.push({event:Ae,listeners:pe}),ke?Ae.data=ke:(ke=Fc(a),ke!==null&&(Ae.data=ke)))),(ke=em?tm(e,a):am(e,a))&&(Ae=fr(z,"onBeforeInput"),0<Ae.length&&(pe=new Qc("onBeforeInput","beforeinput",null,a,Q),Z.push({event:pe,listeners:Ae}),pe.data=ke)),Km(Z,e,z,a,Q)}Of(Z,t)})}function Pn(e,t,a){return{instance:e,listener:t,currentTarget:a}}function fr(e,t){for(var a=t+"Capture",n=[];e!==null;){var r=e,i=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||i===null||(r=bn(e,a),r!=null&&n.unshift(Pn(e,r,i)),r=bn(e,t),r!=null&&n.push(Pn(e,r,i))),e.tag===3)return n;e=e.return}return[]}function Fm(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Uf(e,t,a,n,r){for(var i=t._reactName,d=[];a!==null&&a!==n;){var h=a,E=h.alternate,z=h.stateNode;if(h=h.tag,E!==null&&E===n)break;h!==5&&h!==26&&h!==27||z===null||(E=z,r?(z=bn(a,i),z!=null&&d.unshift(Pn(a,z,E))):r||(z=bn(a,i),z!=null&&d.push(Pn(a,z,E)))),a=a.return}d.length!==0&&e.push({event:t,listeners:d})}var Im=/\r\n?/g,Pm=/\u0000|\uFFFD/g;function Hf(e){return(typeof e=="string"?e:""+e).replace(Im,`
|
|
49
|
-
`).replace(Pm,"")}function Vf(e,t){return t=Hf(t),Hf(e)===t}function He(e,t,a,n,r,i){switch(a){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||Ll(e,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&Ll(e,""+n);break;case"className":hs(e,"class",n);break;case"tabIndex":hs(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":hs(e,a,n);break;case"style":Hc(e,n,i);break;case"data":if(t!=="object"){hs(e,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=ys(""+n),e.setAttribute(a,n);break;case"action":case"formAction":if(typeof n=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof i=="function"&&(a==="formAction"?(t!=="input"&&He(e,t,"name",r.name,r,null),He(e,t,"formEncType",r.formEncType,r,null),He(e,t,"formMethod",r.formMethod,r,null),He(e,t,"formTarget",r.formTarget,r,null)):(He(e,t,"encType",r.encType,r,null),He(e,t,"method",r.method,r,null),He(e,t,"target",r.target,r,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=ys(""+n),e.setAttribute(a,n);break;case"onClick":n!=null&&(e.onclick=ya);break;case"onScroll":n!=null&&we("scroll",e);break;case"onScrollEnd":n!=null&&we("scrollend",e);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(u(61));if(a=n.__html,a!=null){if(r.children!=null)throw Error(u(60));e.innerHTML=a}}break;case"multiple":e.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":e.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){e.removeAttribute("xlink:href");break}a=ys(""+n),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""+n):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":n&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":n===!0?e.setAttribute(a,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,n):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(a,n):e.removeAttribute(a);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(a):e.setAttribute(a,n);break;case"popover":we("beforetoggle",e),we("toggle",e),ms(e,"popover",n);break;case"xlinkActuate":va(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":va(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":va(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":va(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":va(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":va(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":va(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":va(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":va(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":ms(e,"is",n);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=wp.get(a)||a,ms(e,a,n))}}function Do(e,t,a,n,r,i){switch(a){case"style":Hc(e,n,i);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(u(61));if(a=n.__html,a!=null){if(r.children!=null)throw Error(u(60));e.innerHTML=a}}break;case"children":typeof n=="string"?Ll(e,n):(typeof n=="number"||typeof n=="bigint")&&Ll(e,""+n);break;case"onScroll":n!=null&&we("scroll",e);break;case"onScrollEnd":n!=null&&we("scrollend",e);break;case"onClick":n!=null&&(e.onclick=ya);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Rc.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(r=a.endsWith("Capture"),t=a.slice(2,r?a.length-7:void 0),i=e[Rt]||null,i=i!=null?i[a]:null,typeof i=="function"&&e.removeEventListener(t,i,r),typeof n=="function")){typeof i!="function"&&i!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,n,r);break e}a in e?e[a]=n:n===!0?e.setAttribute(a,""):ms(e,a,n)}}}function jt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":we("error",e),we("load",e);var n=!1,r=!1,i;for(i in a)if(a.hasOwnProperty(i)){var d=a[i];if(d!=null)switch(i){case"src":n=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:He(e,t,i,d,a,null)}}r&&He(e,t,"srcSet",a.srcSet,a,null),n&&He(e,t,"src",a.src,a,null);return;case"input":we("invalid",e);var h=i=d=r=null,E=null,z=null;for(n in a)if(a.hasOwnProperty(n)){var Q=a[n];if(Q!=null)switch(n){case"name":r=Q;break;case"type":d=Q;break;case"checked":E=Q;break;case"defaultChecked":z=Q;break;case"value":i=Q;break;case"defaultValue":h=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(u(137,t));break;default:He(e,t,n,Q,a,null)}}Dc(e,i,h,E,z,d,r,!1);return;case"select":we("invalid",e),n=d=i=null;for(r in a)if(a.hasOwnProperty(r)&&(h=a[r],h!=null))switch(r){case"value":i=h;break;case"defaultValue":d=h;break;case"multiple":n=h;default:He(e,t,r,h,a,null)}t=i,a=d,e.multiple=!!n,t!=null?_l(e,!!n,t,!1):a!=null&&_l(e,!!n,a,!0);return;case"textarea":we("invalid",e),i=r=n=null;for(d in a)if(a.hasOwnProperty(d)&&(h=a[d],h!=null))switch(d){case"value":n=h;break;case"defaultValue":r=h;break;case"children":i=h;break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(u(91));break;default:He(e,t,d,h,a,null)}Bc(e,n,r,i);return;case"option":for(E in a)if(a.hasOwnProperty(E)&&(n=a[E],n!=null))switch(E){case"selected":e.selected=n&&typeof n!="function"&&typeof n!="symbol";break;default:He(e,t,E,n,a,null)}return;case"dialog":we("beforetoggle",e),we("toggle",e),we("cancel",e),we("close",e);break;case"iframe":case"object":we("load",e);break;case"video":case"audio":for(n=0;n<In.length;n++)we(In[n],e);break;case"image":we("error",e),we("load",e);break;case"details":we("toggle",e);break;case"embed":case"source":case"link":we("error",e),we("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(z in a)if(a.hasOwnProperty(z)&&(n=a[z],n!=null))switch(z){case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:He(e,t,z,n,a,null)}return;default:if(Zr(t)){for(Q in a)a.hasOwnProperty(Q)&&(n=a[Q],n!==void 0&&Do(e,t,Q,n,a,void 0));return}}for(h in a)a.hasOwnProperty(h)&&(n=a[h],n!=null&&He(e,t,h,n,a,null))}function eh(e,t,a,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,i=null,d=null,h=null,E=null,z=null,Q=null;for(q in a){var Z=a[q];if(a.hasOwnProperty(q)&&Z!=null)switch(q){case"checked":break;case"value":break;case"defaultValue":E=Z;default:n.hasOwnProperty(q)||He(e,t,q,null,n,Z)}}for(var U in n){var q=n[U];if(Z=a[U],n.hasOwnProperty(U)&&(q!=null||Z!=null))switch(U){case"type":i=q;break;case"name":r=q;break;case"checked":z=q;break;case"defaultChecked":Q=q;break;case"value":d=q;break;case"defaultValue":h=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(u(137,t));break;default:q!==Z&&He(e,t,U,q,n,Z)}}Xr(e,d,h,E,z,Q,i,r);return;case"select":q=d=h=U=null;for(i in a)if(E=a[i],a.hasOwnProperty(i)&&E!=null)switch(i){case"value":break;case"multiple":q=E;default:n.hasOwnProperty(i)||He(e,t,i,null,n,E)}for(r in n)if(i=n[r],E=a[r],n.hasOwnProperty(r)&&(i!=null||E!=null))switch(r){case"value":U=i;break;case"defaultValue":h=i;break;case"multiple":d=i;default:i!==E&&He(e,t,r,i,n,E)}t=h,a=d,n=q,U!=null?_l(e,!!a,U,!1):!!n!=!!a&&(t!=null?_l(e,!!a,t,!0):_l(e,!!a,a?[]:"",!1));return;case"textarea":q=U=null;for(h in a)if(r=a[h],a.hasOwnProperty(h)&&r!=null&&!n.hasOwnProperty(h))switch(h){case"value":break;case"children":break;default:He(e,t,h,null,n,r)}for(d in n)if(r=n[d],i=a[d],n.hasOwnProperty(d)&&(r!=null||i!=null))switch(d){case"value":U=r;break;case"defaultValue":q=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(u(91));break;default:r!==i&&He(e,t,d,r,n,i)}Oc(e,U,q);return;case"option":for(var de in a)if(U=a[de],a.hasOwnProperty(de)&&U!=null&&!n.hasOwnProperty(de))switch(de){case"selected":e.selected=!1;break;default:He(e,t,de,null,n,U)}for(E in n)if(U=n[E],q=a[E],n.hasOwnProperty(E)&&U!==q&&(U!=null||q!=null))switch(E){case"selected":e.selected=U&&typeof U!="function"&&typeof U!="symbol";break;default:He(e,t,E,U,n,q)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ge in a)U=a[ge],a.hasOwnProperty(ge)&&U!=null&&!n.hasOwnProperty(ge)&&He(e,t,ge,null,n,U);for(z in n)if(U=n[z],q=a[z],n.hasOwnProperty(z)&&U!==q&&(U!=null||q!=null))switch(z){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(u(137,t));break;default:He(e,t,z,U,n,q)}return;default:if(Zr(t)){for(var Ve in a)U=a[Ve],a.hasOwnProperty(Ve)&&U!==void 0&&!n.hasOwnProperty(Ve)&&Do(e,t,Ve,void 0,n,U);for(Q in n)U=n[Q],q=a[Q],!n.hasOwnProperty(Q)||U===q||U===void 0&&q===void 0||Do(e,t,Q,U,n,q);return}}for(var R in a)U=a[R],a.hasOwnProperty(R)&&U!=null&&!n.hasOwnProperty(R)&&He(e,t,R,null,n,U);for(Z in n)U=n[Z],q=a[Z],!n.hasOwnProperty(Z)||U===q||U==null&&q==null||He(e,t,Z,U,n,q)}function qf(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function th(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),n=0;n<a.length;n++){var r=a[n],i=r.transferSize,d=r.initiatorType,h=r.duration;if(i&&h&&qf(d)){for(d=0,h=r.responseEnd,n+=1;n<a.length;n++){var E=a[n],z=E.startTime;if(z>h)break;var Q=E.transferSize,Z=E.initiatorType;Q&&qf(Z)&&(E=E.responseEnd,d+=Q*(E<h?1:(h-z)/(E-z)))}if(--n,t+=8*(i+d)/(r.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Oo=null,Bo=null;function xr(e){return e.nodeType===9?e:e.ownerDocument}function Gf(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Yf(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Uo(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ho=null;function ah(){var e=window.event;return e&&e.type==="popstate"?e===Ho?!1:(Ho=e,!0):(Ho=null,!1)}var $f=typeof setTimeout=="function"?setTimeout:void 0,lh=typeof clearTimeout=="function"?clearTimeout:void 0,Qf=typeof Promise=="function"?Promise:void 0,nh=typeof queueMicrotask=="function"?queueMicrotask:typeof Qf<"u"?function(e){return Qf.resolve(null).then(e).catch(sh)}:$f;function sh(e){setTimeout(function(){throw e})}function Pa(e){return e==="head"}function Xf(e,t){var a=t,n=0;do{var r=a.nextSibling;if(e.removeChild(a),r&&r.nodeType===8)if(a=r.data,a==="/$"||a==="/&"){if(n===0){e.removeChild(r),dn(t);return}n--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")n++;else if(a==="html")es(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,es(a);for(var i=a.firstChild;i;){var d=i.nextSibling,h=i.nodeName;i[yn]||h==="SCRIPT"||h==="STYLE"||h==="LINK"&&i.rel.toLowerCase()==="stylesheet"||a.removeChild(i),i=d}}else a==="body"&&es(e.ownerDocument.body);a=r}while(a);dn(t)}function Kf(e,t){var a=e;e=0;do{var n=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),n&&n.nodeType===8)if(a=n.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=n}while(a)}function Vo(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Vo(a),$r(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function rh(e,t,a,n){for(;e.nodeType===1;){var r=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[yn])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=aa(e.nextSibling),e===null)break}return null}function ih(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=aa(e.nextSibling),e===null))return null;return e}function Zf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=aa(e.nextSibling),e===null))return null;return e}function qo(e){return e.data==="$?"||e.data==="$~"}function Go(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function oh(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var n=function(){t(),a.removeEventListener("DOMContentLoaded",n)};a.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function aa(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Yo=null;function Jf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return aa(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Wf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function Ff(e,t,a){switch(t=xr(a),e){case"html":if(e=t.documentElement,!e)throw Error(u(452));return e;case"head":if(e=t.head,!e)throw Error(u(453));return e;case"body":if(e=t.body,!e)throw Error(u(454));return e;default:throw Error(u(451))}}function es(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);$r(e)}var la=new Map,If=new Set;function pr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var za=A.d;A.d={f:ch,r:uh,D:dh,C:fh,L:xh,m:ph,X:hh,S:mh,M:vh};function ch(){var e=za.f(),t=sr();return e||t}function uh(e){var t=Al(e);t!==null&&t.tag===5&&t.type==="form"?pd(t):za.r(e)}var on=typeof document>"u"?null:document;function Pf(e,t,a){var n=on;if(n&&typeof t=="string"&&t){var r=Jt(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof a=="string"&&(r+='[crossorigin="'+a+'"]'),If.has(r)||(If.add(r),e={rel:e,crossOrigin:a,href:t},n.querySelector(r)===null&&(t=n.createElement("link"),jt(t,"link",e),pt(t),n.head.appendChild(t)))}}function dh(e){za.D(e),Pf("dns-prefetch",e,null)}function fh(e,t){za.C(e,t),Pf("preconnect",e,t)}function xh(e,t,a){za.L(e,t,a);var n=on;if(n&&e&&t){var r='link[rel="preload"][as="'+Jt(t)+'"]';t==="image"&&a&&a.imageSrcSet?(r+='[imagesrcset="'+Jt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(r+='[imagesizes="'+Jt(a.imageSizes)+'"]')):r+='[href="'+Jt(e)+'"]';var i=r;switch(t){case"style":i=cn(e);break;case"script":i=un(e)}la.has(i)||(e=y({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),la.set(i,e),n.querySelector(r)!==null||t==="style"&&n.querySelector(ts(i))||t==="script"&&n.querySelector(as(i))||(t=n.createElement("link"),jt(t,"link",e),pt(t),n.head.appendChild(t)))}}function ph(e,t){za.m(e,t);var a=on;if(a&&e){var n=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Jt(n)+'"][href="'+Jt(e)+'"]',i=r;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=un(e)}if(!la.has(i)&&(e=y({rel:"modulepreload",href:e},t),la.set(i,e),a.querySelector(r)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(as(i)))return}n=a.createElement("link"),jt(n,"link",e),pt(n),a.head.appendChild(n)}}}function mh(e,t,a){za.S(e,t,a);var n=on;if(n&&e){var r=Rl(n).hoistableStyles,i=cn(e);t=t||"default";var d=r.get(i);if(!d){var h={loading:0,preload:null};if(d=n.querySelector(ts(i)))h.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":t},a),(a=la.get(i))&&$o(e,a);var E=d=n.createElement("link");pt(E),jt(E,"link",e),E._p=new Promise(function(z,Q){E.onload=z,E.onerror=Q}),E.addEventListener("load",function(){h.loading|=1}),E.addEventListener("error",function(){h.loading|=2}),h.loading|=4,mr(d,t,n)}d={type:"stylesheet",instance:d,count:1,state:h},r.set(i,d)}}}function hh(e,t){za.X(e,t);var a=on;if(a&&e){var n=Rl(a).hoistableScripts,r=un(e),i=n.get(r);i||(i=a.querySelector(as(r)),i||(e=y({src:e,async:!0},t),(t=la.get(r))&&Qo(e,t),i=a.createElement("script"),pt(i),jt(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(r,i))}}function vh(e,t){za.M(e,t);var a=on;if(a&&e){var n=Rl(a).hoistableScripts,r=un(e),i=n.get(r);i||(i=a.querySelector(as(r)),i||(e=y({src:e,async:!0,type:"module"},t),(t=la.get(r))&&Qo(e,t),i=a.createElement("script"),pt(i),jt(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(r,i))}}function ex(e,t,a,n){var r=(r=xe.current)?pr(r):null;if(!r)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=cn(a.href),a=Rl(r).hoistableStyles,n=a.get(t),n||(n={type:"style",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=cn(a.href);var i=Rl(r).hoistableStyles,d=i.get(e);if(d||(r=r.ownerDocument||r,d={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,d),(i=r.querySelector(ts(e)))&&!i._p&&(d.instance=i,d.state.loading=5),la.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},la.set(e,a),i||yh(r,e,a,d.state))),t&&n===null)throw Error(u(528,""));return d}if(t&&n!==null)throw Error(u(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=un(a),a=Rl(r).hoistableScripts,n=a.get(t),n||(n={type:"script",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function cn(e){return'href="'+Jt(e)+'"'}function ts(e){return'link[rel="stylesheet"]['+e+"]"}function tx(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function yh(e,t,a,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),jt(t,"link",a),pt(t),e.head.appendChild(t))}function un(e){return'[src="'+Jt(e)+'"]'}function as(e){return"script[async]"+e}function ax(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+Jt(a.href)+'"]');if(n)return t.instance=n,pt(n),n;var r=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),pt(n),jt(n,"style",r),mr(n,a.precedence,e),t.instance=n;case"stylesheet":r=cn(a.href);var i=e.querySelector(ts(r));if(i)return t.state.loading|=4,t.instance=i,pt(i),i;n=tx(a),(r=la.get(r))&&$o(n,r),i=(e.ownerDocument||e).createElement("link"),pt(i);var d=i;return d._p=new Promise(function(h,E){d.onload=h,d.onerror=E}),jt(i,"link",n),t.state.loading|=4,mr(i,a.precedence,e),t.instance=i;case"script":return i=un(a.src),(r=e.querySelector(as(i)))?(t.instance=r,pt(r),r):(n=a,(r=la.get(i))&&(n=y({},a),Qo(n,r)),e=e.ownerDocument||e,r=e.createElement("script"),pt(r),jt(r,"link",n),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(u(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,mr(n,a.precedence,e));return t.instance}function mr(e,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=n.length?n[n.length-1]:null,i=r,d=0;d<n.length;d++){var h=n[d];if(h.dataset.precedence===t)i=h;else if(i!==r)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function $o(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Qo(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var hr=null;function lx(e,t,a){if(hr===null){var n=new Map,r=hr=new Map;r.set(a,n)}else r=hr,n=r.get(a),n||(n=new Map,r.set(a,n));if(n.has(e))return n;for(n.set(e,null),a=a.getElementsByTagName(e),r=0;r<a.length;r++){var i=a[r];if(!(i[yn]||i[vt]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var d=i.getAttribute(t)||"";d=e+d;var h=n.get(d);h?h.push(i):n.set(d,[i])}}return n}function nx(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function gh(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function sx(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function bh(e,t,a,n){if(a.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var r=cn(n.href),i=t.querySelector(ts(r));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=vr.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=i,pt(i);return}i=t.ownerDocument||t,n=tx(n),(r=la.get(r))&&$o(n,r),i=i.createElement("link"),pt(i);var d=i;d._p=new Promise(function(h,E){d.onload=h,d.onerror=E}),jt(i,"link",n),a.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=vr.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Xo=0;function jh(e,t){return e.stylesheets&&e.count===0&&gr(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var n=setTimeout(function(){if(e.stylesheets&&gr(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&Xo===0&&(Xo=62500*th());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&gr(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>Xo?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(r)}}:null}function vr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)gr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var yr=null;function gr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,yr=new Map,t.forEach(Sh,e),yr=null,vr.call(e))}function Sh(e,t){if(!(t.state.loading&4)){var a=yr.get(e);if(a)var n=a.get(null);else{a=new Map,yr.set(e,a);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<r.length;i++){var d=r[i];(d.nodeName==="LINK"||d.getAttribute("media")!=="not all")&&(a.set(d.dataset.precedence,d),n=d)}n&&a.set(null,n)}r=t.instance,d=r.getAttribute("data-precedence"),i=a.get(d)||n,i===n&&a.set(null,r),a.set(d,r),this.count++,n=vr.bind(this),r.addEventListener("load",n),r.addEventListener("error",n),i?i.parentNode.insertBefore(r,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var ls={$$typeof:J,Provider:null,Consumer:null,_currentValue:le,_currentValue2:le,_threadCount:0};function Nh(e,t,a,n,r,i,d,h,E){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Vr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vr(0),this.hiddenUpdates=Vr(null),this.identifierPrefix=n,this.onUncaughtError=r,this.onCaughtError=i,this.onRecoverableError=d,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=E,this.incompleteTransitions=new Map}function rx(e,t,a,n,r,i,d,h,E,z,Q,Z){return e=new Nh(e,t,a,d,E,z,Q,Z,h),t=1,i===!0&&(t|=24),i=Ut(3,null,null,t),e.current=i,i.stateNode=e,t=ki(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:n,isDehydrated:a,cache:t},Ti(i),e}function ix(e){return e?(e=Vl,e):Vl}function ox(e,t,a,n,r,i){r=ix(r),n.context===null?n.context=r:n.pendingContext=r,n=Ga(t),n.payload={element:a},i=i===void 0?null:i,i!==null&&(n.callback=i),a=Ya(e,n,t),a!==null&&(Ot(a,e,t),Dn(a,e,t))}function cx(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Ko(e,t){cx(e,t),(e=e.alternate)&&cx(e,t)}function ux(e){if(e.tag===13||e.tag===31){var t=xl(e,67108864);t!==null&&Ot(t,e,67108864),Ko(e,67108864)}}function dx(e){if(e.tag===13||e.tag===31){var t=Yt();t=qr(t);var a=xl(e,t);a!==null&&Ot(a,e,t),Ko(e,t)}}var br=!0;function kh(e,t,a,n){var r=S.T;S.T=null;var i=A.p;try{A.p=2,Zo(e,t,a,n)}finally{A.p=i,S.T=r}}function Eh(e,t,a,n){var r=S.T;S.T=null;var i=A.p;try{A.p=8,Zo(e,t,a,n)}finally{A.p=i,S.T=r}}function Zo(e,t,a,n){if(br){var r=Jo(n);if(r===null)zo(e,t,n,jr,a),xx(e,n);else if(wh(r,e,t,a,n))n.stopPropagation();else if(xx(e,n),t&4&&-1<Ch.indexOf(e)){for(;r!==null;){var i=Al(r);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var d=lt(i.pendingLanes);if(d!==0){var h=i;for(h.pendingLanes|=2,h.entangledLanes|=2;d;){var E=1<<31-We(d);h.entanglements[1]|=E,d&=~E}xa(i),(De&6)===0&&(lr=Fe()+500,Fn(0))}}break;case 31:case 13:h=xl(i,2),h!==null&&Ot(h,i,2),sr(),Ko(i,2)}if(i=Jo(n),i===null&&zo(e,t,n,jr,a),i===r)break;r=i}r!==null&&n.stopPropagation()}else zo(e,t,n,null,a)}}function Jo(e){return e=Wr(e),Wo(e)}var jr=null;function Wo(e){if(jr=null,e=Tl(e),e!==null){var t=v(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=m(t),e!==null)return e;e=null}else if(a===31){if(e=b(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return jr=e,null}function fx(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Tt()){case ce:return 2;case ht:return 8;case Se:case tt:return 32;case At:return 268435456;default:return 32}default:return 32}}var Fo=!1,el=null,tl=null,al=null,ns=new Map,ss=new Map,ll=[],Ch="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function xx(e,t){switch(e){case"focusin":case"focusout":el=null;break;case"dragenter":case"dragleave":tl=null;break;case"mouseover":case"mouseout":al=null;break;case"pointerover":case"pointerout":ns.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ss.delete(t.pointerId)}}function rs(e,t,a,n,r,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:a,eventSystemFlags:n,nativeEvent:i,targetContainers:[r]},t!==null&&(t=Al(t),t!==null&&ux(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function wh(e,t,a,n,r){switch(t){case"focusin":return el=rs(el,e,t,a,n,r),!0;case"dragenter":return tl=rs(tl,e,t,a,n,r),!0;case"mouseover":return al=rs(al,e,t,a,n,r),!0;case"pointerover":var i=r.pointerId;return ns.set(i,rs(ns.get(i)||null,e,t,a,n,r)),!0;case"gotpointercapture":return i=r.pointerId,ss.set(i,rs(ss.get(i)||null,e,t,a,n,r)),!0}return!1}function px(e){var t=Tl(e.target);if(t!==null){var a=v(t);if(a!==null){if(t=a.tag,t===13){if(t=m(a),t!==null){e.blockedOn=t,wc(e.priority,function(){dx(a)});return}}else if(t===31){if(t=b(a),t!==null){e.blockedOn=t,wc(e.priority,function(){dx(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Sr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Jo(e.nativeEvent);if(a===null){a=e.nativeEvent;var n=new a.constructor(a.type,a);Jr=n,a.target.dispatchEvent(n),Jr=null}else return t=Al(a),t!==null&&ux(t),e.blockedOn=a,!1;t.shift()}return!0}function mx(e,t,a){Sr(e)&&a.delete(t)}function Th(){Fo=!1,el!==null&&Sr(el)&&(el=null),tl!==null&&Sr(tl)&&(tl=null),al!==null&&Sr(al)&&(al=null),ns.forEach(mx),ss.forEach(mx)}function Nr(e,t){e.blockedOn===t&&(e.blockedOn=null,Fo||(Fo=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Th)))}var kr=null;function hx(e){kr!==e&&(kr=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){kr===e&&(kr=null);for(var t=0;t<e.length;t+=3){var a=e[t],n=e[t+1],r=e[t+2];if(typeof n!="function"){if(Wo(n||a)===null)continue;break}var i=Al(a);i!==null&&(e.splice(t,3),t-=3,Zi(i,{pending:!0,data:r,method:a.method,action:n},n,r))}}))}function dn(e){function t(E){return Nr(E,e)}el!==null&&Nr(el,e),tl!==null&&Nr(tl,e),al!==null&&Nr(al,e),ns.forEach(t),ss.forEach(t);for(var a=0;a<ll.length;a++){var n=ll[a];n.blockedOn===e&&(n.blockedOn=null)}for(;0<ll.length&&(a=ll[0],a.blockedOn===null);)px(a),a.blockedOn===null&&ll.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(n=0;n<a.length;n+=3){var r=a[n],i=a[n+1],d=r[Rt]||null;if(typeof i=="function")d||hx(a);else if(d){var h=null;if(i&&i.hasAttribute("formAction")){if(r=i,d=i[Rt]||null)h=d.formAction;else if(Wo(r)!==null)continue}else h=d.action;typeof h=="function"?a[n+1]=h:(a.splice(n,3),n-=3),hx(a)}}}function vx(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(d){return r=d})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),n||setTimeout(a,20)}function a(){if(!n&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var n=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function Io(e){this._internalRoot=e}Er.prototype.render=Io.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));var a=t.current,n=Yt();ox(a,n,e,t,null,null)},Er.prototype.unmount=Io.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ox(e.current,2,null,e,null,null),sr(),t[wl]=null}};function Er(e){this._internalRoot=e}Er.prototype.unstable_scheduleHydration=function(e){if(e){var t=Cc();e={blockedOn:null,target:e,priority:t};for(var a=0;a<ll.length&&t!==0&&t<ll[a].priority;a++);ll.splice(a,0,e),a===0&&px(e)}};var yx=o.version;if(yx!=="19.2.4")throw Error(u(527,yx,"19.2.4"));A.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(u(188)):(e=Object.keys(e).join(","),Error(u(268,e)));return e=f(t),e=e!==null?j(e):null,e=e===null?null:e.stateNode,e};var Ah={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:S,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Cr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Cr.isDisabled&&Cr.supportsFiber)try{ma=Cr.inject(Ah),at=Cr}catch{}}return os.createRoot=function(e,t){if(!x(e))throw Error(u(299));var a=!1,n="",r=kd,i=Ed,d=Cd;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(d=t.onRecoverableError)),t=rx(e,1,!1,null,null,a,n,null,r,i,d,vx),e[wl]=t.current,Lo(e),new Io(t)},os.hydrateRoot=function(e,t,a){if(!x(e))throw Error(u(299));var n=!1,r="",i=kd,d=Ed,h=Cd,E=null;return a!=null&&(a.unstable_strictMode===!0&&(n=!0),a.identifierPrefix!==void 0&&(r=a.identifierPrefix),a.onUncaughtError!==void 0&&(i=a.onUncaughtError),a.onCaughtError!==void 0&&(d=a.onCaughtError),a.onRecoverableError!==void 0&&(h=a.onRecoverableError),a.formState!==void 0&&(E=a.formState)),t=rx(e,1,!0,t,a??null,n,r,E,i,d,h,vx),t.context=ix(null),a=t.current,n=Yt(),n=qr(n),r=Ga(n),r.callback=null,Ya(a,r,n),a=n,t.current.lanes=a,vn(t,a),xa(t),e[wl]=t.current,Lo(e),new Er(t)},os.version="19.2.4",os}var Tx;function Hh(){if(Tx)return tc.exports;Tx=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(o){console.error(o)}}return s(),tc.exports=Uh(),tc.exports}var Vh=Hh();const fn="";class Fx extends Error{constructor(o,c){super(o),this.name="ApiError",this.status=c}}async function Me(s,o){const c=await fetch(`${fn}${s}`,o);if(!c.ok){const u=await c.json().catch(()=>({error:c.statusText}));throw new Fx(u.error||`HTTP ${c.status}`,c.status)}return c.json()}const me={getConfig(){return Me("/api/config")},setConfig(s,o){return Me("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:s,model:o})})},getSkills(){return Me("/api/skills")},getSkillDetail(s,o){return Me(`/api/skills/${s}/${o}`)},getEvals(s,o){return Me(`/api/skills/${s}/${o}/evals`)},saveEvals(s,o,c){return Me(`/api/skills/${s}/${o}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})},generateEvals(s,o){return Me(`/api/skills/${s}/${o}/generate-evals`,{method:"POST"})},async getLatestBenchmark(s,o){const c=await fetch(`${fn}/api/skills/${s}/${o}/benchmark/latest`);if(c.status===404)return null;if(!c.ok){const u=await c.json().catch(()=>({error:c.statusText}));throw new Fx(u.error||`HTTP ${c.status}`,c.status)}return c.json()},getHistory(s,o,c){const u=new URLSearchParams;c!=null&&c.model&&u.set("model",c.model),c!=null&&c.type&&u.set("type",c.type),c!=null&&c.from&&u.set("from",c.from),c!=null&&c.to&&u.set("to",c.to);const x=u.toString();return Me(`/api/skills/${s}/${o}/history${x?"?"+x:""}`)},getHistoryEntry(s,o,c){return Me(`/api/skills/${s}/${o}/history/${encodeURIComponent(c)}`)},compareRuns(s,o,c,u){return Me(`/api/skills/${s}/${o}/history-compare?a=${encodeURIComponent(c)}&b=${encodeURIComponent(u)}`)},getCaseHistory(s,o,c,u){const x=new URLSearchParams;u&&x.set("model",u);const v=x.toString();return Me(`/api/skills/${s}/${o}/history/case/${c}${v?"?"+v:""}`)},deleteHistoryEntry(s,o,c){return Me(`/api/skills/${s}/${o}/history/${encodeURIComponent(c)}`,{method:"DELETE"})},deleteSkill(s,o){return Me(`/api/skills/${s}/${o}`,{method:"DELETE"})},improveSkill(s,o,c){return Me(`/api/skills/${s}/${o}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})},instructEdit(s,o,c){return Me(`/api/skills/${s}/${o}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...c})})},applyImprovement(s,o,c){return Me(`/api/skills/${s}/${o}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:c})})},getStats(s,o){return Me(`/api/skills/${s}/${o}/stats`)},getDependencies(s,o){return Me(`/api/skills/${s}/${o}/dependencies`)},getProjectLayout(){return Me("/api/project-layout")},createSkill(s){return Me("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},saveDraft(s){return Me("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},getSkillCreatorStatus(){return Me("/api/skill-creator-status")},generateSkill(s){return Me("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},getSkillFiles(s,o){return Me(`/api/skills/${s}/${o}/files`)},getSkillFile(s,o,c){return Me(`/api/skills/${s}/${o}/file?path=${encodeURIComponent(c)}`)},saveSkillFile(s,o,c,u){return Me(`/api/skills/${s}/${o}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:c,content:u})})},getLeaderboard(s,o){return Me(`/api/skills/${s}/${o}/leaderboard`)},getLeaderboardEntry(s,o,c){return Me(`/api/skills/${s}/${o}/leaderboard/${encodeURIComponent(c)}`)},startSweep(s,o,c){const u=`${fn}/api/skills/${s}/${o}/sweep`,x=new EventSource(u);return fetch(u,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(c)}),x},getCredentials(s,o){return Me(`/api/credentials/${s}/${o}`)},setCredential(s,o,c,u){return Me(`/api/credentials/${s}/${o}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:c,value:u})})},getParams(s,o){return Me(`/api/credentials/${s}/${o}/params`)},getParamsRevealed(s,o,c){const u=c?`reveal=true&key=${encodeURIComponent(c)}`:"reveal=true";return Me(`/api/credentials/${s}/${o}/params?${u}`)},searchModels(){return Me("/api/openrouter/models")},getSkillVersions(s,o){return Me(`/api/skills/${s}/${o}/versions`)},getVersionDiff(s,o,c,u){return Me(`/api/skills/${s}/${o}/versions/diff?from=${c}&to=${u}`)},startBatchUpdate(s){const o=`${fn}/api/skills/batch-update`,c=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:s})}),c},startSkillUpdate(s,o){const c=`${fn}/api/skills/${s}/${o}/update`,u=new EventSource(c);return fetch(c,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),u},async getSkillUpdates(){try{const s=await fetch(`${fn}/api/skills/updates`);return s.ok?await s.json():[]}catch{return[]}}};function qh(s,o){if(!o.length)return s;const c=new Map;for(const u of o){const x=u.name.split("/").pop()||u.name;c.set(x,u)}return s.map(u=>{const x=c.get(u.skill);return x?{...u,updateAvailable:x.updateAvailable,currentVersion:x.installed,latestVersion:x.latest??void 0}:u})}function Gh(s){const[o,c]=p.useState(()=>typeof window>"u"?!1:window.matchMedia(s).matches);return p.useEffect(()=>{const u=window.matchMedia(s);c(u.matches);const x=v=>c(v.matches);return u.addEventListener("change",x),()=>u.removeEventListener("change",x)},[s]),o}const Yh={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1};function $h(s,o){switch(o.type){case"SELECT_SKILL":return{...s,selectedSkill:o.skill,mode:"browse",mobileView:s.isMobile?"detail":s.mobileView};case"CLEAR_SELECTION":return{...s,selectedSkill:null};case"SET_MODE":return{...s,mode:o.mode,selectedSkill:o.mode==="create"?null:s.selectedSkill};case"SET_SEARCH":return{...s,searchQuery:o.query};case"SET_SKILLS":return{...s,skills:o.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...s,skillsError:o.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...s,skillsLoading:o.loading};case"SET_MOBILE":return{...s,isMobile:o.isMobile};case"SET_MOBILE_VIEW":return{...s,mobileView:o.view};case"DISMISS_UPDATE_NOTIFICATION":return{...s,updateNotificationDismissed:!0};default:return s}}const Ix=p.createContext(null);function pa(){const s=p.useContext(Ix);if(!s)throw new Error("useStudio must be used within StudioProvider");return s}function Qh({children:s}){const[o,c]=p.useReducer($h,Yh),u=Gh("(max-width: 767px)");p.useEffect(()=>{c({type:"SET_MOBILE",isMobile:u})},[u]);const x=p.useCallback(()=>{c({type:"SET_SKILLS_LOADING",loading:!0}),me.getSkills().then(C=>{c({type:"SET_SKILLS",skills:C});const _=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(_){const[,G,D]=_,X=C.find(J=>J.plugin===G&&J.skill===D);X&&c({type:"SELECT_SKILL",skill:{plugin:G,skill:D,origin:X.origin}})}me.getSkillUpdates().then(G=>{G.length>0&&c({type:"SET_SKILLS",skills:qh(C,G)})}).catch(()=>{})}).catch(C=>c({type:"SET_SKILLS_ERROR",error:C.message}))},[]);p.useEffect(()=>{x()},[x]);const v=p.useCallback(C=>{c({type:"SELECT_SKILL",skill:C}),window.location.hash=`/skills/${C.plugin}/${C.skill}`},[]),m=p.useCallback(()=>{c({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),b=p.useCallback(C=>{c({type:"SET_MODE",mode:C})},[]),g=p.useCallback(C=>{c({type:"SET_SEARCH",query:C})},[]),f=p.useCallback(C=>{c({type:"SET_MOBILE_VIEW",view:C})},[]),j=p.useCallback(()=>{c({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),y=p.useMemo(()=>o.skills.filter(C=>C.updateAvailable).length,[o.skills]),k=p.useMemo(()=>({state:o,selectSkill:v,clearSelection:m,setMode:b,setSearch:g,setMobileView:f,refreshSkills:x,updateCount:y,dismissUpdateNotification:j}),[o,v,m,b,g,f,x,y,j]);return l.jsx(Ix.Provider,{value:k,children:s})}const Xh={config:null,loading:!0};function Kh(s,o){switch(o.type){case"SET_CONFIG":return{config:o.config,loading:!1};case"SET_LOADING":return{...s,loading:!0};default:return s}}const Px=p.createContext(null);function il(){const s=p.useContext(Px);if(!s)throw new Error("useConfig must be used within ConfigProvider");return s}function Zh({children:s}){const[o,c]=p.useReducer(Kh,Xh),u=p.useCallback(()=>{me.getConfig().then(m=>c({type:"SET_CONFIG",config:m})).catch(()=>{})},[]);p.useEffect(()=>{u()},[u]);const x=p.useCallback(async(m,b)=>{const g=await me.setConfig(m,b);return c({type:"SET_CONFIG",config:g}),g},[]),v=p.useMemo(()=>({config:o.config,loading:o.loading,updateConfig:x,refreshConfig:u}),[o,x,u]);return l.jsx(Px.Provider,{value:v,children:s})}function Jh({left:s,right:o}){const{state:c}=pa();return c.isMobile?l.jsx("div",{style:{height:"100vh",overflow:"hidden",background:"var(--surface-0)"},children:c.mobileView==="list"?l.jsx("div",{style:{height:"100%",overflowY:"auto",background:"var(--surface-1)"},children:s}):l.jsx("div",{style:{height:"100%",overflowY:"auto"},children:o})}):l.jsxs("div",{className:"studio-grid",style:{display:"grid",gridTemplateColumns:"280px 1px 1fr",height:"100vh",overflow:"hidden"},children:[l.jsx("div",{style:{overflowY:"auto",background:"var(--surface-1)"},children:s}),l.jsx("div",{style:{background:"var(--border-subtle)"}}),l.jsx("div",{style:{overflowY:"auto",background:"var(--surface-0)"},children:o})]})}function Wh(){const{state:s,setSearch:o}=pa(),[c,u]=p.useState(s.searchQuery),x=p.useRef(null);p.useEffect(()=>(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{o(c)},200),()=>{x.current&&clearTimeout(x.current)}),[c,o]),p.useEffect(()=>{s.searchQuery===""&&c!==""&&u("")},[s.searchQuery]);const v=new Set(s.skills.map(m=>m.plugin)).size;return l.jsxs("div",{className:"px-3 py-2",children:[l.jsxs("div",{className:"relative",children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)"},children:[l.jsx("circle",{cx:"11",cy:"11",r:"8"}),l.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),l.jsx("input",{type:"text",value:c,onChange:m=>u(m.target.value),placeholder:"Search skills...",className:"w-full py-2 pl-8 pr-3 rounded-lg text-[13px] transition-colors duration-150",style:{background:"var(--surface-2)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",outline:"none"},onFocus:m=>{m.currentTarget.style.borderColor="var(--accent)"},onBlur:m=>{m.currentTarget.style.borderColor="var(--border-subtle)"}}),c&&l.jsx("button",{onClick:()=>{u(""),o("")},style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:2},children:l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!s.skillsLoading&&l.jsxs("div",{className:"text-[11px] mt-1.5 px-1",style:{color:"var(--text-tertiary)"},children:[s.skills.length," skill",s.skills.length!==1?"s":""," across ",v," plugin",v!==1?"s":""]})]})}const Ax={pass:{bg:"var(--green-muted)",text:"var(--green)",dot:"var(--green)",label:"Passing"},fail:{bg:"var(--red-muted)",text:"var(--red)",dot:"var(--red)",label:"Failing"},pending:{bg:"var(--yellow-muted)",text:"var(--yellow)",dot:"var(--yellow)",label:"Pending"},stale:{bg:"var(--orange-muted)",text:"var(--orange)",dot:"var(--orange)",label:"Stale"},missing:{bg:"var(--surface-3)",text:"var(--text-tertiary)",dot:"var(--text-tertiary)",label:"No evals"}};function Rx({skill:s,isSelected:o,onSelect:c}){const u=Ax[s.benchmarkStatus]||Ax.missing,x=s.origin==="installed";return l.jsxs("button",{onClick:c,className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:o?"var(--surface-2)":"transparent",cursor:"pointer",borderTop:"none",borderRight:"none",borderBottom:"1px solid var(--border-subtle)",borderLeft:o?"2px solid var(--accent)":"2px solid transparent",display:"block",opacity:x?.7:1},onMouseEnter:v=>{o||(v.currentTarget.style.background="var(--surface-2)")},onMouseLeave:v=>{o||(v.currentTarget.style.background="transparent")},children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsxs("span",{className:"flex items-center gap-1.5 text-[13px] font-medium truncate",style:{color:"var(--text-primary)"},children:[x&&l.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0",children:[l.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),l.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),s.skill]}),l.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-medium px-1.5 py-0.5 rounded-full flex-shrink-0 ml-2",style:{background:u.bg,color:u.text},children:[l.jsx("span",{className:"rounded-full",style:{width:5,height:5,background:u.dot}}),u.label]})]}),(s.updateAvailable&&s.latestVersion||s.pinnedVersion)&&l.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[s.updateAvailable&&s.latestVersion&&l.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:"var(--yellow-muted)",color:"var(--yellow)"},children:[l.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M12 19V5"}),l.jsx("path",{d:"M5 12l7-7 7 7"})]}),s.latestVersion]}),s.pinnedVersion&&l.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},title:`Pinned at ${s.pinnedVersion}`,children:["📌 ",s.pinnedVersion]})]}),l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",style:{color:"var(--text-tertiary)"},children:[l.jsxs("span",{children:[s.evalCount," eval",s.evalCount!==1?"s":""]}),l.jsx("span",{style:{color:"var(--border-subtle)"},children:"|"}),l.jsxs("span",{children:[s.assertionCount," assert",s.assertionCount!==1?"s":""]}),s.lastBenchmark&&l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"var(--border-subtle)"},children:"|"}),l.jsx("span",{children:new Date(s.lastBenchmark).toLocaleDateString()})]})]})]})}function Mx(s){var c;const o={};for(const u of s)(o[c=u.plugin]||(o[c]=[])).push(u);return o}function Fh(){const{state:s,selectSkill:o}=pa(),{skills:c,searchQuery:u,selectedSkill:x}=s,[v,m]=p.useState(!1),[b,g]=p.useState(()=>{try{return sessionStorage.getItem("vskill-origin-banner-dismissed")==="1"}catch{return!1}}),{sourceGroups:f,installedGroups:j}=p.useMemo(()=>{const y=u.toLowerCase(),k=y?c.filter(_=>_.skill.toLowerCase().includes(y)||_.plugin.toLowerCase().includes(y)):c,C=k.filter(_=>_.origin==="source"),B=k.filter(_=>_.origin==="installed");return{sourceGroups:Object.entries(Mx(C)),installedGroups:Object.entries(Mx(B))}},[c,u]);return s.skillsLoading?l.jsx("div",{className:"px-3 py-4 space-y-3",children:[1,2,3].map(y=>l.jsx("div",{className:"skeleton h-14 w-full rounded-lg"},y))}):f.length===0&&j.length===0?l.jsx("div",{className:"px-4 py-8 text-center",children:l.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No skills match your search"})}):l.jsxs("div",{className:"flex-1",children:[f.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Ih,{title:"Your Skills",count:f.reduce((y,[,k])=>y+k.length,0)}),f.map(([y,k])=>l.jsxs("div",{children:[l.jsx(_x,{plugin:y,count:k.length}),k.map(C=>{const B=(x==null?void 0:x.plugin)===C.plugin&&(x==null?void 0:x.skill)===C.skill;return l.jsx(Rx,{skill:C,isSelected:B,onSelect:()=>o({plugin:C.plugin,skill:C.skill,origin:C.origin})},`${C.plugin}/${C.skill}`)})]},y))]}),j.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:()=>m(y=>!y),className:"w-full flex items-center gap-2 px-3 py-2.5 text-left",style:{background:"var(--surface-1)",border:"none",borderTop:"1px solid var(--border-subtle)",borderBottom:v?"1px solid var(--border-subtle)":"none",cursor:"pointer"},children:[l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:v?"rotate(90deg)":"rotate(0deg)",transition:"transform 150ms ease"},children:l.jsx("polyline",{points:"9 18 15 12 9 6"})}),l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Installed"}),l.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",j.reduce((y,[,k])=>y+k.length,0),")"]}),l.jsx("div",{className:"flex-1"}),l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),l.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]}),v&&l.jsxs(l.Fragment,{children:[!b&&l.jsxs("div",{className:"flex items-start gap-2 px-3 py-2",style:{background:"var(--surface-1)",borderBottom:"1px solid var(--border-subtle)"},children:[l.jsx("p",{className:"flex-1 text-[10px] leading-relaxed",style:{color:"var(--text-tertiary)",margin:0},children:"Skills inside agent folders (.claude/, .cursor/, etc.) are installed copies for consuming. Edit skills in your project root instead."}),l.jsx("button",{onClick:()=>{g(!0);try{sessionStorage.setItem("vskill-origin-banner-dismissed","1")}catch{}},className:"flex-shrink-0 mt-0.5",style:{background:"none",border:"none",cursor:"pointer",padding:0,color:"var(--text-tertiary)"},children:l.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),j.map(([y,k])=>l.jsxs("div",{children:[l.jsx(_x,{plugin:y,count:k.length}),k.map(C=>{const B=(x==null?void 0:x.plugin)===C.plugin&&(x==null?void 0:x.skill)===C.skill;return l.jsx(Rx,{skill:C,isSelected:B,onSelect:()=>o({plugin:C.plugin,skill:C.skill,origin:C.origin})},`${C.plugin}/${C.skill}`)})]},y))]})]})]})}function Ih({title:s,count:o}){return l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"var(--surface-1)",borderBottom:"1px solid var(--border-subtle)"},children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-secondary)"},children:s}),l.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",o,")"]})]})}function _x({plugin:s,count:o}){const[c,u]=p.useState(!1),x=`/images/icons/${s}.webp`;return l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[c?l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}):l.jsx("img",{src:x,width:16,height:16,alt:"",onError:()=>u(!0),style:{objectFit:"contain"}}),l.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:s}),l.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",o,")"]}),l.jsx("div",{className:"flex-1 h-px",style:{background:"var(--border-subtle)"}})]})}function Ph({value:s,onChange:o}){const[c,u]=p.useState([]),[x,v]=p.useState(!1),[m,b]=p.useState(null),[g,f]=p.useState(s),[j,y]=p.useState(!1),k=p.useRef(null),C=p.useRef(void 0);p.useEffect(()=>{v(!0),me.searchModels().then(D=>u(D.models)).catch(D=>b(D instanceof Error?D.message:String(D))).finally(()=>v(!1))},[]);const B=p.useCallback(D=>{f(D),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>y(!0),300)},[]),_=p.useMemo(()=>{if(!g.trim())return c.slice(0,50);const D=g.toLowerCase();return c.filter(X=>X.id.toLowerCase().includes(D)||X.name.toLowerCase().includes(D)).slice(0,50)},[c,g]);p.useEffect(()=>{function D(X){k.current&&!k.current.contains(X.target)&&y(!1)}return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);function G(D){var F;const X=(F=D.pricing)==null?void 0:F.prompt;return X==null||X===0?"Free":`$${(X*1e6).toFixed(2)}/1M`}return l.jsxs("div",{ref:k,style:{position:"relative"},children:[l.jsx("input",{type:"text",value:g,onChange:D=>B(D.target.value),onFocus:()=>y(!0),placeholder:x?"Loading models...":"Search OpenRouter models...",className:"input-field w-full",style:{fontSize:12}}),j&&!x&&l.jsxs("div",{style:{position:"absolute",top:"100%",left:0,right:0,maxHeight:280,overflowY:"auto",background:"var(--surface-2)",border:"1px solid var(--border-default)",borderRadius:8,marginTop:4,zIndex:20,boxShadow:"0 8px 24px rgba(0,0,0,0.4)"},children:[m&&l.jsxs("div",{className:"px-3 py-2 text-[11px]",style:{color:"var(--red)"},children:["Failed to load models: ",m]}),_.length===0&&!m&&l.jsx("div",{className:"px-3 py-3 text-[11px]",style:{color:"var(--text-tertiary)"},children:"No models found"}),_.map(D=>l.jsxs("button",{onClick:()=>{o(D.id),f(D.id),y(!1)},className:"w-full text-left px-3 py-2 flex items-center justify-between transition-colors duration-100",style:{background:D.id===s?"var(--accent-muted)":"transparent",border:"none",cursor:"pointer",borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:X=>{X.currentTarget.style.background="var(--surface-3)"},onMouseLeave:X=>{X.currentTarget.style.background=D.id===s?"var(--accent-muted)":"transparent"},children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:D.name}),l.jsx("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:D.id})]}),l.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:G(D)})]},D.id))]})]})}function ev(){const{config:s,updateConfig:o,refreshConfig:c}=il(),[u,x]=p.useState(!1),[v,m]=p.useState(!1),b=p.useRef(null);p.useEffect(()=>{function y(k){b.current&&!b.current.contains(k.target)&&x(!1)}return u&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[u]);async function g(y,k){m(!0);try{await o(y.id,k.id),x(!1)}catch{c()}finally{m(!1)}}if(!s)return null;const f=av(s),j=tv(s);return l.jsxs("div",{ref:b,className:"relative",children:[l.jsxs("button",{onClick:()=>x(!u),className:"w-full flex items-center gap-2 px-2.5 py-1.5 rounded-lg text-[11px] transition-all duration-150",style:{background:u?"var(--surface-3)":"var(--surface-2)",border:`1px solid ${u?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},onMouseEnter:y=>{u||(y.currentTarget.style.borderColor="var(--accent)")},onMouseLeave:y=>{u||(y.currentTarget.style.borderColor="var(--border-subtle)")},children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:j!=null&&j.available?"var(--green)":"var(--text-tertiary)"}}),l.jsx("span",{className:"flex-1 text-left font-medium truncate",style:{color:"var(--text-primary)"},children:f}),l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",style:{transform:u?"rotate(180deg)":"rotate(0)",transition:"transform 0.15s ease",flexShrink:0},children:l.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),u&&l.jsxs("div",{className:"absolute top-full mt-1 left-0 right-0 rounded-xl shadow-xl z-50 overflow-hidden animate-fade-in",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",minWidth:"240px"},children:[l.jsx("div",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:l.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Select Model"})}),l.jsx("div",{className:"py-1 max-h-72 overflow-y-auto",children:s.providers.map(y=>l.jsxs("div",{children:[l.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2",children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:y.available?"var(--green)":"var(--text-tertiary)",opacity:y.available?1:.3}}),l.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",opacity:y.available?1:.5},children:y.label})]}),y.id==="openrouter"&&y.available?l.jsx("div",{className:"px-3 py-1.5",children:l.jsx(Ph,{value:s.provider==="openrouter"?s.model:"",onChange:k=>{v||g(y,{id:k,label:k})}})}):y.models.map(k=>{const C=ep(s,y.id,k.id),B=!y.available||v;return l.jsxs("button",{onClick:()=>!B&&g(y,k),disabled:B,className:"w-full px-3 py-1.5 flex items-center gap-2.5 text-left transition-all duration-100",style:{background:C?"var(--accent-muted)":"transparent",color:B?"var(--text-tertiary)":"var(--text-primary)",opacity:B?.4:1,cursor:B?"not-allowed":"pointer"},onMouseEnter:_=>{!B&&!C&&(_.currentTarget.style.background="var(--surface-3)")},onMouseLeave:_=>{C||(_.currentTarget.style.background="transparent")},children:[l.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 flex items-center justify-center",style:{border:`2px solid ${C?"var(--accent)":"var(--border-subtle)"}`},children:C&&l.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}})}),l.jsx("span",{className:"text-[12px]",style:{fontWeight:C?600:400},title:k.id,children:k.label})]},`${y.id}-${k.id}`)})]},y.id))})]})]})}function ep(s,o,c){return s.provider!==o?!1:s.model===c}function tv(s){return s.providers.find(o=>o.id===s.provider)}function av(s){for(const o of s.providers)for(const c of o.models)if(ep(s,o.id,c.id))return c.label;return s.model}function lv(){const{state:s,setMode:o,updateCount:c}=pa(),{config:u}=il(),[x,v]=p.useState(null),[m,b]=p.useState(!1);return p.useEffect(()=>{me.getSkillCreatorStatus().then(v).catch(()=>{})},[]),l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"px-4 py-4 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",style:{background:"var(--accent-muted)"},children:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("div",{className:"text-[14px] font-semibold truncate",style:{color:"var(--text-primary)",letterSpacing:"-0.01em"},children:"Skill Studio"}),l.jsx("div",{className:"text-[11px] truncate",style:{color:"var(--text-tertiary)"},children:(u==null?void 0:u.projectName)||"vskill"})]})]}),l.jsx("div",{className:"mt-3",children:l.jsx(ev,{})})]}),l.jsx(Wh,{}),l.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:l.jsxs("button",{onClick:()=>o("create"),className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:s.mode==="create"?"var(--accent)":"var(--surface-3)",color:s.mode==="create"?"#fff":"var(--text-secondary)",border:"none",cursor:"pointer"},onMouseEnter:g=>{s.mode!=="create"&&(g.currentTarget.style.background="var(--surface-4)",g.currentTarget.style.color="var(--text-primary)")},onMouseLeave:g=>{s.mode!=="create"&&(g.currentTarget.style.background="var(--surface-3)",g.currentTarget.style.color="var(--text-secondary)")},children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),l.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]})}),c>0&&l.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:l.jsxs("button",{onClick:()=>{window.location.hash="/updates",o("browse")},className:"w-full flex items-center justify-between px-3 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:window.location.hash==="#/updates"?"var(--surface-3)":"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",cursor:"pointer"},onMouseEnter:g=>{g.currentTarget.style.background="var(--surface-3)"},onMouseLeave:g=>{window.location.hash!=="#/updates"&&(g.currentTarget.style.background="var(--surface-2)")},children:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M12 19V5"}),l.jsx("path",{d:"M5 12l7-7 7 7"})]}),"Updates"]}),l.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:"var(--yellow-muted)",color:"var(--yellow)"},children:c})]})}),x&&(x.installed?l.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:l.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[l.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"var(--green)"}}),"Skill Creator installed"]})}):l.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:l.jsxs("div",{className:"px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1.5",style:{color:"var(--yellow)"},children:[l.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"var(--yellow)"}}),l.jsx("span",{className:"font-medium",children:"Skill Creator not installed"})]}),l.jsx("button",{onClick:()=>{navigator.clipboard.writeText(x.installCommand).then(()=>{b(!0),setTimeout(()=>b(!1),2e3)}).catch(()=>{})},className:"w-full text-left px-2 py-1 rounded text-[10px] font-mono cursor-pointer transition-colors duration-150",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},title:"Click to copy",onMouseEnter:g=>{g.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:g=>{g.currentTarget.style.borderColor="var(--border-subtle)"},children:m?"Copied!":x.installCommand})]})})),l.jsx("div",{className:"flex-1 overflow-y-auto",style:{borderTop:"1px solid var(--border-subtle)"},children:l.jsx(Fh,{})})]})}const nv="modulepreload",sv=function(s){return"/"+s},Lx={},rv=function(o,c,u){let x=Promise.resolve();if(c&&c.length>0){let m=function(f){return Promise.all(f.map(j=>Promise.resolve(j).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const b=document.querySelector("meta[property=csp-nonce]"),g=(b==null?void 0:b.nonce)||(b==null?void 0:b.getAttribute("nonce"));x=m(c.map(f=>{if(f=sv(f),f in Lx)return;Lx[f]=!0;const j=f.endsWith(".css"),y=j?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${y}`))return;const k=document.createElement("link");if(k.rel=j?"stylesheet":nv,j||(k.as="script"),k.crossOrigin="",k.href=f,g&&k.setAttribute("nonce",g),document.head.appendChild(k),j)return new Promise((C,B)=>{k.addEventListener("load",C),k.addEventListener("error",()=>B(new Error(`Unable to preload CSS for ${f}`)))})}))}function v(m){const b=new Event("vite:preloadError",{cancelable:!0});if(b.payload=m,window.dispatchEvent(b),!b.defaultPrevented)throw m}return x.then(m=>{for(const b of m||[])b.status==="rejected"&&v(b.reason);return o().catch(v)})};function tp(s){if(s!==void 0)try{return JSON.stringify(s)}catch(o){console.error("Failed to serialize request body:",o);try{const c=new WeakSet;return JSON.stringify(s,(u,x)=>{if(typeof x=="object"&&x!==null){if(c.has(x))return"[Circular]";c.add(x)}return x})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function sc(){const[s,o]=p.useState([]),[c,u]=p.useState(!1),[x,v]=p.useState(!1),[m,b]=p.useState(null),g=p.useRef(null),f=p.useCallback(async(y,k)=>{o([]),u(!0),v(!1),b(null);const C=new AbortController;g.current=C;try{const B=tp(k),_=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:B,signal:C.signal});if(!_.ok||!_.body){let F=`HTTP ${_.status}`;try{const Y=await _.json();Y.error&&(F=Y.error)}catch{}throw new Error(F)}const G=_.body.getReader(),D=new TextDecoder;let X="",J="";for(;;){const{done:F,value:Y}=await G.read();if(F)break;X+=D.decode(Y,{stream:!0});const I=X.split(`
|
|
50
|
-
`);X=I.pop()||"";for(const O of I)if(O.startsWith("event: "))J=O.slice(7).trim();else if(O.startsWith("data: ")){try{const W=JSON.parse(O.slice(6)),M={event:J,data:W};J==="done"?(v(!0),o($=>[...$,M])):o($=>[...$,M])}catch{}J=""}}}catch(B){B.name!=="AbortError"&&b(B.message)}finally{u(!1),g.current=null}},[]),j=p.useCallback(()=>{var y;(y=g.current)==null||y.abort()},[]);return{events:s,running:c,done:x,error:m,start:f,stop:j}}function iv(s){const o=p.useRef(s);o.current=s;const[c,u]=p.useState(new Set),x=p.useRef(new Map),v=p.useCallback(async(f,j,y)=>{var C;(C=x.current.get(f))==null||C.abort();const k=new AbortController;x.current.set(f,k),u(B=>{const _=new Set(B);return _.add(f),_});try{const B=tp(y),_=await fetch(j,{method:"POST",headers:{"Content-Type":"application/json"},body:B,signal:k.signal});if(!_.ok||!_.body){let F=`HTTP ${_.status}`;try{const Y=await _.json();Y.error&&(F=Y.error)}catch{}throw new Error(F)}const G=_.body.getReader(),D=new TextDecoder;let X="",J="";for(;;){const{done:F,value:Y}=await G.read();if(F)break;X+=D.decode(Y,{stream:!0});const I=X.split(`
|
|
51
|
-
`);X=I.pop()||"";for(const O of I)if(O.startsWith("event: "))J=O.slice(7).trim();else if(O.startsWith("data: ")){try{const W=JSON.parse(O.slice(6)),M={event:J,data:W};o.current.onEvent(f,M)}catch{}J=""}}o.current.onDone(f)}catch(B){B.name!=="AbortError"&&o.current.onError(f,B.message)}finally{u(B=>{const _=new Set(B);return _.delete(f),_}),x.current.delete(f)}},[]),m=p.useCallback(f=>{var j;(j=x.current.get(f))==null||j.abort()},[]),b=p.useCallback(()=>{for(const f of x.current.values())f.abort()},[]),g=c.size>0;return{runningSet:c,startCase:v,stopCase:m,stopAll:b,isAnyCaseRunning:g}}const ov={plugin:"",skill:"",skillContent:"",savedContent:"",isDirty:!1,evals:null,evalsError:null,activePanel:"tests",selectedCaseId:null,caseRunStates:new Map,bulkRunActive:!1,runMode:null,latestBenchmark:null,inlineResults:new Map,improveTarget:null,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null,generateEvalsLoading:!1,generateEvalsProgress:[],generateEvalsError:null,regressions:[],iterationCount:0,activationPrompts:"",activationResults:[],activationSummary:null,activationRunning:!1,activationError:null,activationTotalPrompts:0,activationStartedAt:null,activationClassifyingStatus:null,generatingPrompts:!1,generatingPromptsError:null,activationHistory:null,activationHistoryLoading:!1,loading:!0,error:null};function cv(s,o){var c,u;switch(o.type){case"SET_LOADING":return{...s,loading:o.loading};case"SET_ERROR":return{...s,error:o.error};case"INIT_DATA":{const x=new Map;if(o.benchmark)for(const m of o.benchmark.cases)x.set(m.eval_id,{status:m.status,passRate:m.pass_rate,errorMessage:m.error_message||void 0,durationMs:m.durationMs,tokens:m.tokens,output:m.output,assertions:m.assertions.map(b=>({assertion_id:b.id,text:b.text,pass:b.pass,reasoning:b.reasoning}))});const v=((u=(c=o.evals)==null?void 0:c.evals[0])==null?void 0:u.id)??null;return{...s,skillContent:o.skillContent,savedContent:o.skillContent,isDirty:!1,evals:o.evals,evalsError:o.evalsError??null,latestBenchmark:o.benchmark,inlineResults:x,selectedCaseId:v,loading:!1,error:null}}case"SET_PANEL":return{...s,activePanel:o.panel};case"SET_CONTENT":return{...s,skillContent:o.content,isDirty:o.content!==s.savedContent};case"CONTENT_SAVED":return{...s,savedContent:s.skillContent,isDirty:!1};case"SET_EVALS":return{...s,evals:o.evals};case"SELECT_CASE":return{...s,selectedCaseId:o.caseId};case"CASE_RUN_START":{const x=new Map(s.caseRunStates);return x.set(o.caseId,{status:"running",startedAt:Date.now(),mode:o.mode}),{...s,caseRunStates:x,runMode:o.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const x=new Map(s.caseRunStates),v=x.get(o.caseId);x.set(o.caseId,{status:"complete",mode:v==null?void 0:v.mode});const m=new Map(s.inlineResults);return m.set(o.caseId,o.result),{...s,caseRunStates:x,inlineResults:m}}case"CASE_RUN_ERROR":{const x=new Map(s.caseRunStates),v=x.get(o.caseId);x.set(o.caseId,{status:"error",mode:v==null?void 0:v.mode});const m=new Map(s.inlineResults);return m.set(o.caseId,{status:"error",errorMessage:o.error,assertions:[]}),{...s,caseRunStates:x,inlineResults:m}}case"CASE_RUN_CANCEL":{const x=new Map(s.caseRunStates),v=x.get(o.caseId);return x.set(o.caseId,{status:"cancelled",mode:v==null?void 0:v.mode}),{...s,caseRunStates:x}}case"BULK_RUN_START":{const x=new Map(s.caseRunStates);for(const v of o.caseIds)x.set(v,{status:"queued",mode:o.mode});return{...s,caseRunStates:x,bulkRunActive:!0,runMode:o.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...s,bulkRunActive:!1,latestBenchmark:o.benchmark??s.latestBenchmark,iterationCount:s.iterationCount+1};case"CANCEL_ALL":{const x=new Map(s.caseRunStates);for(const[v,m]of x)(m.status==="running"||m.status==="queued")&&x.set(v,{status:"cancelled"});return{...s,caseRunStates:x,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const x=new Map(s.inlineResults);return x.set(o.evalId,o.result),{...s,inlineResults:x}}case"OPEN_IMPROVE":return{...s,improveTarget:o.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...s,improveTarget:null};case"OPEN_AI_EDIT":return{...s,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...s,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...s,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...s,aiEditProgress:[...s.aiEditProgress,o.entry]};case"AI_EDIT_RESULT":{const x=o.evalChanges??[],v=new Map;for(let m=0;m<x.length;m++)v.set(m,!0);return{...s,aiEditLoading:!1,aiEditResult:{improved:o.improved,reasoning:o.reasoning,evalChanges:x},aiEditEvalChanges:x,aiEditEvalSelections:v}}case"AI_EDIT_ERROR":return{...s,aiEditLoading:!1,aiEditError:o.message,aiEditClassifiedError:o.classified??null};case"GENERATE_EVALS_START":return{...s,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...s,generateEvalsProgress:[...s.generateEvalsProgress,o.entry]};case"GENERATE_EVALS_DONE":return{...s,generateEvalsLoading:!1,evals:o.evals};case"GENERATE_EVALS_ERROR":return{...s,generateEvalsLoading:!1,generateEvalsError:o.classified};case"TOGGLE_EVAL_CHANGE":{const x=new Map(s.aiEditEvalSelections);return x.set(o.index,!x.get(o.index)),{...s,aiEditEvalSelections:x}}case"SELECT_ALL_EVAL_CHANGES":{const x=new Map(s.aiEditEvalSelections);for(const v of x.keys())x.set(v,!0);return{...s,aiEditEvalSelections:x}}case"DESELECT_ALL_EVAL_CHANGES":{const x=new Map(s.aiEditEvalSelections);for(const v of x.keys())x.set(v,!1);return{...s,aiEditEvalSelections:x}}case"SET_EVALS_RETRY":return{...s,aiEditEvalsRetry:o.evalsFile};case"SET_REGRESSIONS":return{...s,regressions:o.regressions};case"INCREMENT_ITERATION":return{...s,iterationCount:s.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...s,activationPrompts:o.prompts};case"ACTIVATION_START":return{...s,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...s,activationResults:[...s.activationResults,o.result]};case"ACTIVATION_DONE":return{...s,activationRunning:!1,activationSummary:o.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...s,activationClassifyingStatus:`Classifying prompt ${o.index}/${o.total}...`};case"ACTIVATION_ERROR":return{...s,activationRunning:!1,activationError:o.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...s,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...s,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...s,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...s,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...s,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...s,generatingPrompts:!1,generatingPromptsError:o.error};case"ACTIVATION_HISTORY_LOADED":return{...s,activationHistory:o.runs,activationHistoryLoading:!1};default:return s}}function uv(s){if(s==="unit"||s==="integration")return s}function dv(s,o){const c=o.data;if(o.event==="output_ready"&&(s.output=c.output,c.durationMs!=null&&(s.durationMs=c.durationMs),c.tokens!=null&&(s.tokens=c.tokens)),o.event==="outputs_ready"&&(s.output=c.skillOutput,c.skillDurationMs!=null&&(s.durationMs=c.skillDurationMs),c.skillTokens!=null&&(s.tokens=c.skillTokens)),o.event==="assertion_result"){const u={assertion_id:c.assertion_id,text:c.text,pass:c.pass,reasoning:c.reasoning};s.assertions.find(x=>x.assertion_id===u.assertion_id)||s.assertions.push(u)}o.event==="case_complete"&&(s.status=c.status,s.passRate=c.pass_rate,s.errorMessage=c.error_message||void 0,s.classifiedError=c.classified_error||void 0)}const ap=p.createContext(null);function Qt(){const s=p.useContext(ap);if(!s)throw new Error("useWorkspace must be used within WorkspaceProvider");return s}function fv({plugin:s,skill:o,origin:c,children:u}){const x=c==="installed",[v,m]=p.useReducer(cv,{...ov,plugin:s,skill:o}),b=p.useRef(new Set),g=p.useRef(new Set),f=p.useRef(new Map),j=p.useCallback((ee,re)=>{let ie=f.current.get(ee);ie||(ie={assertions:[]},f.current.set(ee,ie)),dv(ie,re),m({type:"UPDATE_INLINE_RESULT",evalId:ee,result:{...ie,assertions:[...ie.assertions]}})},[]),y=p.useCallback(ee=>{if(g.current.has(ee))return;g.current.add(ee);const re=f.current.get(ee)??{assertions:[]};m({type:"CASE_RUN_COMPLETE",caseId:ee,result:{...re,assertions:[...re.assertions]}}),b.current.has(ee)&&(b.current.delete(ee),b.current.size===0&&me.getLatestBenchmark(s,o).then(ie=>m({type:"BULK_RUN_COMPLETE",benchmark:ie})).catch(()=>m({type:"BULK_RUN_COMPLETE",benchmark:null})))},[s,o]),k=p.useCallback((ee,re)=>{g.current.has(ee)||(g.current.add(ee),m({type:"CASE_RUN_ERROR",caseId:ee,error:re}),b.current.has(ee)&&(b.current.delete(ee),b.current.size===0&&me.getLatestBenchmark(s,o).then(ie=>m({type:"BULK_RUN_COMPLETE",benchmark:ie})).catch(()=>m({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[s,o]),{startCase:C,stopCase:B,stopAll:_}=iv({onEvent:j,onDone:y,onError:k});p.useEffect(()=>()=>{_()},[_]);const G=p.useCallback(async()=>{try{const ee=await fetch(`/api/skills/${s}/${o}/activation-history`);if(!ee.ok){if(ee.status===404){m({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const re=await ee.json();m({type:"ACTIVATION_HISTORY_LOADED",runs:re.runs||[]})}catch{}},[s,o]);p.useEffect(()=>{let ee=!1;async function re(){try{const[ie,he,be]=await Promise.allSettled([me.getSkillDetail(s,o),me.getEvals(s,o),me.getLatestBenchmark(s,o)]);if(ee)return;let Ye=null,Qe=null;if(he.status==="fulfilled")Ye=he.value;else{const ut=he.reason;(ut==null?void 0:ut.status)!==404&&(Qe=(ut==null?void 0:ut.message)??"Failed to load test cases")}m({type:"INIT_DATA",skillContent:ie.status==="fulfilled"?ie.value.skillContent:"",evals:Ye,evalsError:Qe,benchmark:be.status==="fulfilled"?be.value:null})}catch(ie){ee||m({type:"SET_ERROR",error:ie.message})}}return re(),G(),()=>{ee=!0}},[s,o,G]);const D=p.useCallback(async()=>{if(!x)try{await me.applyImprovement(s,o,v.skillContent),m({type:"CONTENT_SAVED"})}catch(ee){m({type:"SET_ERROR",error:ee.message})}},[x,s,o,v.skillContent]),X=p.useCallback(async ee=>{if(!x)try{const re=await me.saveEvals(s,o,ee);m({type:"SET_EVALS",evals:re})}catch(re){m({type:"SET_ERROR",error:re.message})}},[x,s,o]),J=p.useCallback((ee,re="benchmark")=>{if(x)return;const ie=v.caseRunStates.get(ee);if((ie==null?void 0:ie.status)!=="running")if(f.current.delete(ee),g.current.delete(ee),m({type:"CASE_RUN_START",caseId:ee,mode:re}),re==="comparison"){const he=`/api/skills/${s}/${o}/compare`;C(ee,he,{eval_ids:[ee]})}else{const he=`/api/skills/${s}/${o}/benchmark/case/${ee}`;C(ee,he,re==="baseline"?{baseline_only:!0}:void 0)}},[x,s,o,v.caseRunStates,C]),F=p.useCallback((ee="benchmark")=>{var he;if(x)return;const re=((he=v.evals)==null?void 0:he.evals)??[];if(re.length===0)return;const ie=re.map(be=>be.id);for(const be of ie)f.current.delete(be),g.current.delete(be);m({type:"BULK_RUN_START",caseIds:ie,mode:ee}),b.current=new Set(ie);for(const be of ie)if(ee==="comparison")C(be,`/api/skills/${s}/${o}/compare`,{eval_ids:[be]});else{const Ye=`/api/skills/${s}/${o}/benchmark/case/${be}`;C(be,Ye,ee==="baseline"?{baseline_only:!0}:void 0)}},[x,s,o,v.evals,C]),Y=p.useCallback(ee=>{B(ee),m({type:"CASE_RUN_CANCEL",caseId:ee}),b.current.delete(ee),g.current.add(ee)},[B]),I=p.useCallback(()=>{_(),m({type:"CANCEL_ALL"}),b.current.clear()},[_]),O=p.useCallback(async(ee,re)=>{m({type:"OPEN_IMPROVE",evalId:ee})},[]),W=p.useCallback(async(ee,re)=>{try{await me.applyImprovement(s,o,re),m({type:"SET_CONTENT",content:re}),m({type:"CONTENT_SAVED"}),m({type:"CLOSE_IMPROVE"}),J(ee,"benchmark")}catch(ie){m({type:"SET_ERROR",error:ie.message})}},[s,o,J]),M=sc(),$=p.useRef(null),P=p.useRef(0);p.useEffect(()=>{const ee=M.events;for(let re=P.current;re<ee.length;re++){const ie=ee[re],he=ie.data;if(ie.event==="progress"&&m({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),ie.event==="done"){const be=he.improved,Ye=he.reasoning,Qe=he.evalChanges??[];m({type:"AI_EDIT_RESULT",improved:be,reasoning:Ye,evalChanges:Qe})}if(ie.event==="error"){const be=he;m({type:"AI_EDIT_ERROR",message:be.description||"Unknown error",classified:be})}}P.current=ee.length},[M.events]),p.useEffect(()=>{M.error&&m({type:"AI_EDIT_ERROR",message:M.error})},[M.error]),p.useEffect(()=>()=>{M.stop()},[M.stop]);const te=p.useCallback(async(ee,re,ie)=>{x||(P.current=0,m({type:"AI_EDIT_LOADING"}),$.current=M.stop,M.start(`/api/skills/${s}/${o}/improve?sse`,{mode:"instruct",instruction:ee,content:v.skillContent,evals:v.evals??{skill_name:o,evals:[]},provider:re,model:ie}))},[x,s,o,v.skillContent,v.evals,M]),oe=p.useCallback(()=>{M.stop(),m({type:"AI_EDIT_ERROR",message:"Cancelled"})},[M]),ne=p.useCallback(async()=>{const ee=v.aiEditResult;if(ee!=null&&ee.improved)try{if(await me.applyImprovement(s,o,ee.improved),m({type:"SET_CONTENT",content:ee.improved}),m({type:"CONTENT_SAVED"}),v.aiEditEvalChanges.length>0&&Array.from(v.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:ie}=await rv(async()=>{const{mergeEvalChanges:Ye}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Ye}},[]),he=v.evals??{skill_name:o,evals:[]},be=ie(he,v.aiEditEvalChanges,v.aiEditEvalSelections);try{const Ye=await me.saveEvals(s,o,be);m({type:"SET_EVALS",evals:Ye})}catch(Ye){m({type:"SET_EVALS_RETRY",evalsFile:be}),m({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${Ye.message}. You can retry from the AI Edit panel.`});return}}m({type:"CLOSE_AI_EDIT"})}catch(re){m({type:"SET_ERROR",error:re.message})}},[s,o,v.aiEditResult,v.evals,v.aiEditEvalChanges,v.aiEditEvalSelections]),w=p.useCallback(()=>{m({type:"CLOSE_AI_EDIT"})},[]),S=p.useCallback(ee=>{m({type:"TOGGLE_EVAL_CHANGE",index:ee})},[]),A=p.useCallback(()=>{m({type:"SELECT_ALL_EVAL_CHANGES"})},[]),le=p.useCallback(()=>{m({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),V=p.useCallback(async()=>{const ee=v.aiEditEvalsRetry;if(ee)try{const re=await me.saveEvals(s,o,ee);m({type:"SET_EVALS",evals:re}),m({type:"SET_ERROR",error:null}),m({type:"CLOSE_AI_EDIT"})}catch(re){m({type:"SET_ERROR",error:`Retry failed: ${re.message}`})}},[s,o,v.aiEditEvalsRetry]),ue=p.useCallback(async()=>{try{const ee=await me.getSkillDetail(s,o);m({type:"SET_CONTENT",content:ee.skillContent}),m({type:"CONTENT_SAVED"})}catch{}},[s,o]),{config:N}=il(),H=sc(),ae=p.useRef(0);p.useEffect(()=>{const ee=H.events;for(let re=ae.current;re<ee.length;re++){const ie=ee[re],he=ie.data;if(ie.event==="progress"&&m({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),ie.event==="done"){const be=he;me.saveEvals(s,o,be).then(Ye=>m({type:"GENERATE_EVALS_DONE",evals:Ye})).catch(Ye=>m({type:"SET_ERROR",error:Ye.message}))}ie.event==="error"&&m({type:"GENERATE_EVALS_ERROR",classified:he})}ae.current=ee.length},[H.events,s,o]),p.useEffect(()=>{H.error&&m({type:"SET_ERROR",error:H.error})},[H.error]),p.useEffect(()=>()=>{H.stop()},[H.stop]);const se=p.useCallback(async ee=>{if(x)return;ae.current=0,m({type:"GENERATE_EVALS_START"});const re={};N!=null&&N.provider&&(re.provider=N.provider),N!=null&&N.model&&(re.model=N.model);const ie=uv(ee==null?void 0:ee.testType);ie&&(re.testType=ie),H.start(`/api/skills/${s}/${o}/generate-evals?sse`,Object.keys(re).length>0?re:void 0)},[x,s,o,H,N]),fe=sc(),xe=p.useRef(0);p.useEffect(()=>()=>{fe.stop()},[fe.stop]),p.useEffect(()=>{const ee=fe.events;for(let re=xe.current;re<ee.length;re++){const ie=ee[re];if(ie.event==="classifying"){const he=ie.data;m({type:"ACTIVATION_CLASSIFYING",index:he.index,total:he.total})}if(ie.event==="prompt_result"&&m({type:"ACTIVATION_RESULT",result:ie.data}),ie.event==="done"){ye.current&&(clearTimeout(ye.current),ye.current=null);const he=ie.data;if(he.error)m({type:"ACTIVATION_ERROR",error:he.error});else{m({type:"ACTIVATION_DONE",summary:he});const be={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(N==null?void 0:N.model)||"unknown",provider:(N==null?void 0:N.provider)||"unknown",promptCount:he.total,summary:{precision:he.precision,recall:he.recall,reliability:he.reliability,tp:he.tp,tn:he.tn,fp:he.fp,fn:he.fn}};m({type:"ACTIVATION_HISTORY_LOADED",runs:[be,...v.activationHistory??[]]})}}}xe.current=ee.length},[fe.events,N,v.activationHistory]),p.useEffect(()=>{fe.error&&(ye.current&&(clearTimeout(ye.current),ye.current=null),m({type:"ACTIVATION_ERROR",error:fe.error}))},[fe.error]);const ye=p.useRef(null),Ge=p.useCallback(()=>{ye.current&&(clearTimeout(ye.current),ye.current=null),fe.stop(),m({type:"ACTIVATION_CANCEL",totalPrompts:0})},[fe]),ze=p.useCallback(ee=>{const ie=ee.trim().split(`
|
|
52
|
-
`).filter(Boolean).map(be=>be.startsWith("!")?{prompt:be.slice(1).trim(),expected:"should_not_activate"}:be.startsWith("+")?{prompt:be.slice(1).trim(),expected:"should_activate"}:{prompt:be.trim(),expected:"auto"});xe.current=0,m({type:"ACTIVATION_START"}),m({type:"SET_ACTIVATION_PROMPTS",prompts:ee});const he={prompts:ie};N!=null&&N.provider&&(he.provider=N.provider),N!=null&&N.model&&(he.model=N.model),fe.start(`/api/skills/${s}/${o}/activation-test`,he),ye.current&&clearTimeout(ye.current),ye.current=setTimeout(()=>{fe.stop(),m({type:"ACTIVATION_TIMEOUT"}),ye.current=null},12e4)},[s,o,fe,N]),ft=p.useCallback(async(ee=8)=>{m({type:"GENERATE_PROMPTS_START"});try{const re={count:ee};N!=null&&N.provider&&(re.provider=N.provider),N!=null&&N.model&&(re.model=N.model);const ie=await fetch(`/api/skills/${s}/${o}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)});if(!ie.ok){let Je=`HTTP ${ie.status}`;try{const wt=await ie.json();wt.error&&(Je=wt.error)}catch{}throw new Error(Je)}const he=ie.body.getReader(),be=new TextDecoder;let Ye="",Qe="",ut=[];for(;;){const{done:Je,value:wt}=await he.read();if(Je)break;Ye+=be.decode(wt,{stream:!0});const Xt=Ye.split(`
|
|
53
|
-
`);Ye=Xt.pop()||"";for(const Fe of Xt)if(Fe.startsWith("event: "))Qe=Fe.slice(7).trim();else if(Fe.startsWith("data: ")){try{const Tt=JSON.parse(Fe.slice(6));if(Qe==="done"){if(Tt.error)throw new Error(Tt.error);ut=Tt.prompts||[]}if(Qe==="error")throw new Error(Tt.message||Tt.description||"Generation failed")}catch(Tt){if(!(Tt instanceof SyntaxError))throw Tt}Qe=""}}const ca=ut.map(Je=>`${Je.expected==="should_activate"?"+":"!"}${Je.prompt}`).join(`
|
|
54
|
-
`);m({type:"SET_ACTIVATION_PROMPTS",prompts:ca}),m({type:"GENERATE_PROMPTS_DONE"})}catch(re){m({type:"GENERATE_PROMPTS_ERROR",error:re.message})}},[s,o,N]),Nt=p.useMemo(()=>({state:v,dispatch:m,isReadOnly:x,saveContent:D,saveEvals:X,runCase:J,runAll:F,cancelCase:Y,cancelAll:I,improveForCase:O,applyImproveAndRerun:W,refreshSkillContent:ue,generateEvals:se,runActivationTest:ze,cancelActivation:Ge,generateActivationPrompts:ft,fetchActivationHistory:G,submitAiEdit:te,cancelAiEdit:oe,applyAiEdit:ne,discardAiEdit:w,toggleEvalChange:S,selectAllEvalChanges:A,deselectAllEvalChanges:le,retryEvalsSave:V}),[v,x,D,X,J,F,Y,I,O,W,ue,se,ze,Ge,ft,G,te,oe,ne,w,S,A,le,V]);return l.jsx(ap.Provider,{value:Nt,children:u})}function xv(s){return s==null?"var(--text-tertiary)":s>=.7?"var(--green)":s>=.4?"var(--yellow)":"var(--red)"}function pv(s){return s==null?"var(--surface-3)":s>=.7?"var(--green-muted)":s>=.4?"var(--yellow-muted)":"var(--red-muted)"}function mv({state:s,isReadOnly:o,onDelete:c}){const{plugin:u,skill:x,evals:v,latestBenchmark:m,isDirty:b,caseRunStates:g,regressions:f,iterationCount:j}=s,y=Array.from(g.values()).some(D=>D.status==="running"||D.status==="queued"),k=m==null?void 0:m.overall_pass_rate,C=(v==null?void 0:v.evals.reduce((D,X)=>D+X.assertions.length,0))??0,B=(v==null?void 0:v.evals.length)??0,_=xv(k),G=pv(k);return l.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:[l.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[l.jsx("span",{style:{color:"var(--text-tertiary)"},children:u}),l.jsx(hv,{}),l.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:x}),o&&l.jsxs("span",{className:"ml-2 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:[l.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),l.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),b&&l.jsx("span",{className:"ml-2 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--yellow-muted)",color:"var(--yellow)"},children:"unsaved"}),y&&l.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[l.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[!o&&c&&l.jsx("button",{disabled:y,onClick:()=>{window.confirm(`Delete skill "${x}"? This cannot be undone.`)&&c()},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:y?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:y?.4:1,borderRadius:4},onMouseEnter:D=>{y||(D.currentTarget.style.color="var(--red)")},onMouseLeave:D=>{D.currentTarget.style.color="var(--text-tertiary)"},children:l.jsx(vv,{})}),f.length>0&&l.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[l.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),l.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),l.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),f.length," regression",f.length>1?"s":""]}),j>0&&l.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",j]}),l.jsx("span",{className:"pill",style:{background:G,color:_},children:k!=null?`${Math.round(k*100)}%`:"--"}),l.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[B," case",B!==1?"s":""," / ",C," assert",C!==1?"s":""]})]})]})}function hv(){return l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:l.jsx("polyline",{points:"9 18 15 12 9 6"})})}function vv(){return l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("polyline",{points:"3 6 5 6 21 6"}),l.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),l.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),l.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}const yv=[{label:"Build",tabs:[{id:"editor",label:"Editor",shortcut:"1"},{id:"tests",label:"Tests",shortcut:"2"}]},{label:"Evaluate",tabs:[{id:"run",label:"Run",shortcut:"3"},{id:"activation",label:"Activation",shortcut:"4"}]},{label:"Insights",tabs:[{id:"history",label:"History",shortcut:"5"},{id:"leaderboard",label:"Leaderboard",shortcut:"6"},{id:"deps",label:"Deps",shortcut:"7"},{id:"versions",label:"Versions",shortcut:"8"}]}];function gv({id:s}){const o={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(s){case"editor":return l.jsxs("svg",{...o,children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"tests":return l.jsxs("svg",{...o,children:[l.jsx("path",{d:"M9 11l3 3L22 4"}),l.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]});case"run":return l.jsx("svg",{...o,children:l.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return l.jsxs("svg",{...o,children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("circle",{cx:"12",cy:"12",r:"6"}),l.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return l.jsxs("svg",{...o,children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"leaderboard":return l.jsxs("svg",{...o,children:[l.jsx("path",{d:"M18 20V10"}),l.jsx("path",{d:"M12 20V4"}),l.jsx("path",{d:"M6 20v-6"})]});case"deps":return l.jsxs("svg",{...o,children:[l.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),l.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]});case"versions":return l.jsxs("svg",{...o,children:[l.jsx("path",{d:"M12 8v4l3 3"}),l.jsx("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]})}}function bv({activePanel:s,onPanelChange:o,isDirty:c,isRunning:u,hasRegressions:x,isActivationRunning:v,hasUpdate:m}){return l.jsx("div",{className:"flex items-center gap-0.5 px-3 overflow-x-auto",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:yv.map((b,g)=>l.jsxs("div",{className:"flex items-center",children:[g>0&&l.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),b.tabs.map(f=>{const j=s===f.id,y=f.id==="editor"&&c||f.id==="run"&&u||f.id==="activation"&&v||f.id==="history"&&x||f.id==="versions"&&m,k=f.id==="run"||f.id==="activation"?"var(--accent)":f.id==="history"?"var(--red)":"var(--yellow)";return l.jsxs("button",{onClick:()=>o(f.id),title:`${f.label} (Ctrl+${f.shortcut})`,className:"relative flex items-center gap-1.5 px-3 py-2.5 text-[12px] font-medium transition-colors duration-150",style:{background:"transparent",color:j?"var(--text-primary)":"var(--text-tertiary)",borderBottom:j?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:j?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:C=>{j||(C.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:C=>{j||(C.currentTarget.style.color="var(--text-tertiary)")},children:[l.jsx(gv,{id:f.id}),f.label,y&&l.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:k}})]},f.id)})]},b.label))})}const zx={rate_limit:{icon:"⏱",color:"var(--amber, #f59e0b)"},context_window:{icon:"⚠",color:"var(--amber, #f59e0b)"},auth:{icon:"🔒",color:"var(--red, #ef4444)"},timeout:{icon:"⌛",color:"var(--amber, #f59e0b)"},model_not_found:{icon:"🔍",color:"var(--red, #ef4444)"},provider_unavailable:{icon:"⚡",color:"var(--red, #ef4444)"},parse_error:{icon:"❓",color:"var(--amber, #f59e0b)"},unknown:{icon:"❌",color:"var(--red, #ef4444)"}};function fs({error:s,onRetry:o,onDismiss:c}){const[u,x]=p.useState(null),v=p.useRef(null);p.useEffect(()=>(s.category==="rate_limit"&&s.retryAfterMs?x(Math.ceil(s.retryAfterMs/1e3)):x(null),()=>{v.current&&clearInterval(v.current)}),[s]),p.useEffect(()=>{if(!(u==null||u<=0))return v.current=setInterval(()=>{x(g=>g==null||g<=1?(v.current&&clearInterval(v.current),0):g-1)},1e3),()=>{v.current&&clearInterval(v.current)}},[u!=null&&u>0]);const m=zx[s.category]||zx.unknown,b=u!=null&&u>0;return l.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${m.color} 30%, transparent)`,background:`color-mix(in srgb, ${m.color} 6%, var(--surface-1))`},children:[l.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{style:{fontSize:14},children:m.icon}),l.jsx("span",{className:"text-[12px] font-semibold",style:{color:m.color},children:s.title})]}),c&&l.jsx("button",{onClick:c,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:l.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),l.jsxs("div",{className:"px-3.5 pb-3",children:[l.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:s.description}),l.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:s.hint}),(o||u!=null)&&l.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:o&&l.jsx("button",{onClick:o,disabled:b,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:b?.5:1},children:b?`Retry in ${u}s`:"Retry"})})]})]})}class jv extends p.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(o,c){console.error("ErrorBoundary caught:",o,c.componentStack)}render(){return this.state.hasError?l.jsxs("div",{style:{padding:24,textAlign:"center"},children:[l.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:"Something went wrong"}),l.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:8},children:"An unexpected error occurred in this panel."}),l.jsx("button",{onClick:()=>window.location.reload(),className:"btn btn-secondary",style:{marginTop:16,fontSize:12},children:"Reload"})]}):this.props.children}}function Sv(s){const o=s.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(o)?{category:"rate_limit",title:"Rate Limit",description:s,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(o)?{category:"auth",title:"Authentication Failed",description:s,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(o)?{category:"timeout",title:"Request Timed Out",description:s,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(o)?{category:"model_not_found",title:"Model Not Found",description:s,hint:"The selected model is not available. Try switching to a different model in the dropdown above.",retryable:!1}:/context.?(?:window|length)|token.?(?:limit|count|exceed)|too (?:long|large)|maximum.?context|input.?too.?long|prompt.?too.?(?:long|large)/.test(o)?{category:"context_window",title:"Content Too Large",description:s,hint:"Reduce SKILL.md size or move detailed content to references/ files.",retryable:!1}:/enoent|command not found|502|503|service.?unavailable|connection.?refused|econnrefused|server.?error/.test(o)?{category:"provider_unavailable",title:"Provider Unavailable",description:s,hint:"Check that the provider is installed and running.",retryable:!1}:/syntaxerror|json\.?parse|parse.?error|failed to parse|not valid json|unexpected token/.test(o)?{category:"parse_error",title:"Response Parse Error",description:s,hint:"Try again. If this persists, try a different model.",retryable:!0}:{category:"unknown",title:"Error",description:s,hint:"",retryable:!1}}function Nv(s){const o=s.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!o)return{metadata:{},body:s};const c=o[1],u=o[2].trim(),x={},v=c.split(`
|
|
55
|
-
`);let m="",b=!1;for(const g of v){const f=g.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(f&&m&&b){const k=f[1],C=f[2].trim();let B=x[m];if((typeof B!="object"||Array.isArray(B))&&(B={},x[m]=B),!C)B[k]=[];else{const _=C.match(/^\[(.+)\]$/);_?B[k]=_[1].split(",").map(G=>G.trim().replace(/^["']|["']$/g,"")).filter(Boolean):B[k]=C.replace(/^["']|["']$/g,"")}continue}const j=g.match(/^\s+-\s+(.+)$/);if(j&&m){b=!1;const k=x[m];Array.isArray(k)?k.push(j[1].trim().replace(/^["']|["']$/g,"")):x[m]=[j[1].trim().replace(/^["']|["']$/g,"")];continue}const y=g.match(/^([\w-]+):\s*(.*)$/);if(y){m=y[1];const k=y[2].trim();if(b=!1,!k){x[m]={},b=!0;continue}const C=k.match(/^\[(.+)\]$/);if(C){x[m]=C[1].split(",").map(B=>B.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}x[m]=k.replace(/^["']|["']$/g,"")}}return{metadata:x,body:u}}function Or(s){if(!s)return"";try{let o=s.replace(/^---\n[\s\S]*?\n---\n?/,""),c=kv(o);return c=c.replace(/```(\w*)\n([\s\S]*?)```/g,'<pre style="background:var(--surface-2);padding:0.75rem;border-radius:6px;overflow-x:auto;font-size:12px;line-height:1.5;margin:0.5rem 0;border:1px solid var(--border-subtle)"><code>$2</code></pre>'),c=c.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),c=c.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),c=c.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),c=c.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),c=c.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),c=c.replace(/\*([^*]+)\*/g,"<em>$1</em>"),c=c.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),c=c.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),c=c.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),c=c.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),c=c.replace(/\n/g,"<br/>"),c}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</pre>`}}function kv(s){const o=s.split(`
|
|
56
|
-
`),c=[];let u=0;for(;u<o.length;)if(o[u].trim().startsWith("|")&&u+1<o.length&&o[u+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(o[u+1])){const x=Dx(o[u]);u+=2;const v=[];for(;u<o.length&&o[u].trim().startsWith("|");)v.push(Dx(o[u])),u++;const m='style="text-align:left;padding:0.4rem 0.6rem;font-weight:600;font-size:12px;color:var(--text-primary);border-bottom:1px solid var(--border-default)"',b='style="padding:0.4rem 0.6rem;font-size:12px;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)"';let g='<table style="width:100%;border-collapse:collapse;margin:0.5rem 0;border:1px solid var(--border-subtle);border-radius:6px;overflow:hidden">';g+="<thead><tr>";for(const f of x)g+=`<th ${m}>${f}</th>`;g+="</tr></thead><tbody>";for(const f of v){g+="<tr>";for(const j of f)g+=`<td ${b}>${j}</td>`;g+="</tr>"}g+="</tbody></table>",c.push(g)}else c.push(o[u]),u++;return c.join(`
|
|
57
|
-
`)}function Dx(s){return s.split("|").map(o=>o.trim()).filter(o=>o.length>0)}function Br(s,o){const c=s.split(`
|
|
58
|
-
`),u=o.split(`
|
|
59
|
-
`);if(c.length>1e3||u.length>1e3)return[...c.map(j=>({type:"unchanged",content:j}))];const x=c.length,v=u.length,m=Array.from({length:x+1},()=>new Array(v+1).fill(0));for(let j=1;j<=x;j++)for(let y=1;y<=v;y++)c[j-1]===u[y-1]?m[j][y]=m[j-1][y-1]+1:m[j][y]=Math.max(m[j-1][y],m[j][y-1]);const b=[];let g=x,f=v;for(;g>0||f>0;)g>0&&f>0&&c[g-1]===u[f-1]?(b.push({type:"unchanged",content:c[g-1]}),g--,f--):f>0&&(g===0||m[g][f-1]>=m[g-1][f])?(b.push({type:"added",content:u[f-1]}),f--):(b.push({type:"removed",content:c[g-1]}),g--);return b.reverse()}function Ev(s,o){if(o&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(s))return l.jsx("div",{className:"spinner",style:{width:10,height:10,flexShrink:0}});const u=new Set(["generating","comparing","preparing","generating_skill","generating_baseline","scoring","action_items"]);return l.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:u.has(s)?"var(--accent)":"var(--green)"}})}function xs({entries:s,isRunning:o}){const[c,u]=p.useState(!1),x=p.useRef(null);return p.useEffect(()=>{x.current&&!c&&(x.current.scrollTop=x.current.scrollHeight)},[s,c]),s.length===0&&!o?null:l.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[l.jsxs("button",{onClick:()=>u(!c),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:v=>{v.currentTarget.style.color="var(--text-primary)"},onMouseLeave:v=>{v.currentTarget.style.color="var(--text-tertiary)"},children:[l.jsxs("span",{className:"flex items-center gap-2",children:[o&&l.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",s.length,")"]}),l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:c?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:l.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!c&&l.jsx("div",{ref:x,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:s.map((v,m)=>{const b=m===s.length-1&&o,g=m===0?"0s":`+${((v.timestamp-s[0].timestamp)/1e3).toFixed(1)}s`;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:b?1:.7},children:[Ev(v.phase,b),l.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:g}),l.jsx("span",{style:{color:b?"var(--text-primary)":"var(--text-secondary)"},children:v.message}),v.current!=null&&v.total!=null&&l.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",v.current,"/",v.total,"]"]})]},m)})})]})}function Cv({plugin:s,skill:o,skillContent:c,onApplied:u}){const[x,v]=p.useState("closed"),{config:m}=il(),[b,g]=p.useState("claude-cli"),[f,j]=p.useState("opus"),[y,k]=p.useState([]),[C,B]=p.useState(""),[_,G]=p.useState(""),[D,X]=p.useState(null),[J,F]=p.useState(null),[Y,I]=p.useState([]),[O,W]=p.useState(!1),M=p.useRef(null);p.useEffect(()=>{if(!m)return;m.providers.find(A=>A.id==="claude-cli"&&A.available)&&(g("claude-cli"),j("opus"))},[m]),p.useEffect(()=>()=>{var S;(S=M.current)==null||S.abort()},[]);function $(){return m==null?void 0:m.providers.find(S=>S.id===b&&S.available)}const P=p.useCallback(()=>{var S;(S=M.current)==null||S.abort(),v("open")},[]);async function te(){v("loading"),X(null),F(null),I([]);const S=new AbortController;M.current=S;try{const A=await fetch(`/api/skills/${encodeURIComponent(s)}/${encodeURIComponent(o)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,model:f}),signal:S.signal});if(!A.ok||!A.body){let H=`HTTP ${A.status}`;try{const ae=await A.json();ae.error&&(H=ae.error)}catch{}throw new Error(H)}const le=A.body.getReader(),V=new TextDecoder;let ue="",N="";for(;;){const{done:H,value:ae}=await le.read();if(H)break;ue+=V.decode(ae,{stream:!0});const se=ue.split(`
|
|
60
|
-
`);ue=se.pop()||"";for(const fe of se)if(fe.startsWith("event: "))N=fe.slice(7).trim();else if(fe.startsWith("data: ")){try{const xe=JSON.parse(fe.slice(6));N==="progress"?I(ye=>[...ye,{phase:xe.phase,message:xe.message,timestamp:Date.now()}]):N==="done"||N==="complete"?(B(xe.improved),G(xe.reasoning||""),k(Br(xe.original||c,xe.improved)),v("diff_shown")):N==="error"&&(X(xe.message||xe.description||"Unknown error"),xe.category&&F(xe),v("open"))}catch{}N=""}}}catch(A){A.name!=="AbortError"&&(X(A.message),v("open"))}finally{M.current=null}}async function oe(){W(!0);try{await me.applyImprovement(s,o,C),u(C),v("closed")}catch(S){X(S.message)}finally{W(!1)}}function ne(){v("closed"),k([]),B(""),G(""),X(null)}if(x==="closed")return l.jsxs("button",{onClick:()=>v("open"),className:"btn btn-secondary mb-5",disabled:!c,children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),l.jsx("path",{d:"M2 17l10 5 10-5"}),l.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const w=$();return l.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),l.jsx("path",{d:"M2 17l10 5 10-5"}),l.jsx("path",{d:"M2 12l10 5 10-5"})]})}),l.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),l.jsx("button",{onClick:ne,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:S=>{S.currentTarget.style.background="var(--surface-3)"},onMouseLeave:S=>{S.currentTarget.style.background="transparent"},children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),l.jsxs("div",{className:"px-5 py-4",children:[(x==="open"||x==="loading")&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),l.jsx("select",{className:"input-field text-[12px] py-1.5",value:b,onChange:S=>{g(S.target.value);const A=m==null?void 0:m.providers.find(le=>le.id===S.target.value);A!=null&&A.models[0]&&j(A.models[0].id)},disabled:x==="loading",children:m==null?void 0:m.providers.filter(S=>S.available).map(S=>l.jsx("option",{value:S.id,children:S.label},S.id))})]}),l.jsxs("div",{className:"flex-1",children:[l.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),l.jsx("select",{className:"input-field text-[12px] py-1.5",value:f,onChange:S=>j(S.target.value),disabled:x==="loading",children:w==null?void 0:w.models.map(S=>l.jsx("option",{value:S.id,children:S.label},S.id))})]}),x==="loading"?l.jsx("button",{onClick:P,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):l.jsx("button",{onClick:te,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),x==="loading"&&Y.length>0&&l.jsx("div",{className:"mt-3",children:l.jsx(xs,{entries:Y,isRunning:!0})})]}),D&&l.jsx("div",{className:"mb-4",children:J?l.jsx(fs,{error:J,onRetry:te,onDismiss:()=>{X(null),F(null)}}):l.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:D})}),x==="diff_shown"&&l.jsxs(l.Fragment,{children:[_&&l.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[l.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),_]}),l.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:y.map((S,A)=>l.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:S.type==="added"?"rgba(34,197,94,0.1)":S.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:S.type==="added"?"var(--green)":S.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:S.type==="added"?"3px solid var(--green)":S.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[l.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:S.type==="added"?"+":S.type==="removed"?"-":" "}),S.content]},A))}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:oe,disabled:O,className:"btn btn-primary",children:O?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):l.jsxs(l.Fragment,{children:[l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),l.jsx("button",{onClick:ne,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Ox={remove:{bg:"var(--red-muted)",color:"var(--red)",label:"REMOVE"},modify:{bg:"rgba(251,191,36,0.15)",color:"#fbbf24",label:"MODIFY"},add:{bg:"var(--green-muted)",color:"var(--green)",label:"ADD"}},wv={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function Tv({change:s,index:o,selected:c,onToggle:u,originalEval:x}){var y;const[v,m]=p.useState(!1),b=Ox[s.action]??Ox.add,g=wv[s.action]??"var(--border-subtle)",f=s.action==="remove"?(x==null?void 0:x.name)??`Eval #${s.evalId}`:((y=s.eval)==null?void 0:y.name)??"Unnamed",j=p.useCallback(()=>u(o),[u,o]);return l.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${g}`,opacity:c?1:.5},children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[l.jsx("input",{type:"checkbox",checked:c,onChange:j,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),l.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:b.bg,color:b.color,padding:"1px 6px"},children:b.label}),l.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:f}),l.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:s.reason}),l.jsx("button",{onClick:()=>m(!v),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:k=>{k.currentTarget.style.background="var(--surface-3)"},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},children:l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:v?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:l.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),v&&l.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[s.action==="add"&&s.eval&&l.jsx(Av,{evalCase:s.eval}),s.action==="modify"&&s.eval&&x&&l.jsx(Rv,{original:x,proposed:s.eval}),s.action==="remove"&&x&&l.jsx(Mv,{evalCase:x})]})]})}function Av({evalCase:s}){var o;return l.jsxs("div",{className:"pt-2.5 space-y-2",children:[l.jsx(hc,{label:"Prompt",value:s.prompt}),l.jsx(hc,{label:"Expected",value:s.expected_output}),l.jsxs("div",{children:[l.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((o=s.assertions)==null?void 0:o.length)??0,")"]}),l.jsx("div",{className:"mt-1 space-y-1",children:(s.assertions??[]).map(c=>l.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[l.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",c.text]},c.id))})]})]})}function Rv({original:s,proposed:o}){const c=[];s.name!==o.name&&c.push({label:"Name",old:s.name,new:o.name}),s.prompt!==o.prompt&&c.push({label:"Prompt",old:s.prompt,new:o.prompt}),s.expected_output!==o.expected_output&&c.push({label:"Expected",old:s.expected_output,new:o.expected_output});const u=s.assertions??[],x=o.assertions??[],v=new Set(u.map(f=>f.text)),m=new Set(x.map(f=>f.text)),b=x.filter(f=>!v.has(f.text)),g=u.filter(f=>!m.has(f.text));return l.jsxs("div",{className:"pt-2.5 space-y-2",children:[c.map(f=>l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:f.label}),l.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[l.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",vc(f.old,120)]}),l.jsxs("div",{style:{color:"var(--green)"},children:["+ ",vc(f.new,120)]})]})]},f.label)),(b.length>0||g.length>0)&&l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),l.jsxs("div",{className:"mt-1 space-y-0.5",children:[g.map(f=>l.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",f.text]},f.id)),b.map(f=>l.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",f.text]},f.id))]})]}),c.length===0&&b.length===0&&g.length===0&&l.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function Mv({evalCase:s}){var o;return l.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[l.jsx(hc,{label:"Prompt",value:s.prompt}),l.jsxs("div",{children:[l.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((o=s.assertions)==null?void 0:o.length)??0,")"]}),l.jsx("div",{className:"mt-1 space-y-0.5",children:(s.assertions??[]).map(c=>l.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:c.text},c.id))})]})]})}function hc({label:s,value:o}){return l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:s}),l.jsx("div",{className:"mt-0.5 text-[11px] p-2 rounded font-mono",style:{background:"var(--surface-1)",color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:vc(o,300)})]})}function vc(s,o){return s.length>o?s.slice(0,o)+"...":s}const Bx={remove:0,modify:1,add:2};function _v({changes:s,selections:o,currentEvals:c,onToggle:u,onSelectAll:x,onDeselectAll:v}){if(s.length===0)return null;const m=s.map((g,f)=>({change:g,originalIndex:f}));m.sort((g,f)=>(Bx[g.change.action]??2)-(Bx[f.change.action]??2));const b=Array.from(o.values()).filter(Boolean).length;return l.jsxs("div",{className:"mt-3 animate-fade-in",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),l.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",b,"/",s.length," selected)"]})]}),l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx("button",{onClick:x,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Select All"}),l.jsx("button",{onClick:v,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--surface-3)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),l.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:m.map(({change:g,originalIndex:f})=>l.jsx(Tv,{change:g,index:f,selected:o.get(f)??!1,onToggle:u,originalEval:g.evalId!=null?c.find(j=>j.id===g.evalId):void 0},f))})]})}function Lv(){var S;const{state:s,dispatch:o,submitAiEdit:c,applyAiEdit:u,discardAiEdit:x,cancelAiEdit:v,toggleEvalChange:m,selectAllEvalChanges:b,deselectAllEvalChanges:g,retryEvalsSave:f}=Qt(),{aiEditLoading:j,aiEditResult:y,aiEditError:k,aiEditClassifiedError:C,aiEditProgress:B,aiEditEvalChanges:_,aiEditEvalSelections:G,aiEditEvalsRetry:D}=s,[X,J]=p.useState(""),{config:F}=il(),[Y,I]=p.useState("claude-cli"),[O,W]=p.useState("opus"),M=p.useRef(null);p.useEffect(()=>{var A;(A=M.current)==null||A.focus()},[]),p.useEffect(()=>{if(!F)return;F.providers.find(le=>le.id==="claude-cli"&&le.available)&&(I("claude-cli"),W("opus"))},[F]);const $=F==null?void 0:F.providers.find(A=>A.id===Y&&A.available),P=p.useCallback(()=>{const A=X.trim();!A||j||c(A,Y,O)},[X,j,c,Y,O]),te=p.useCallback(A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),P()),A.key==="Escape"&&(A.preventDefault(),j?v():x())},[P,j,v,x]),oe=p.useCallback(()=>{o({type:"CLOSE_AI_EDIT"}),o({type:"OPEN_AI_EDIT"})},[o]),ne=y?Br(s.skillContent,y.improved):[],w=((S=s.evals)==null?void 0:S.evals)??[];return l.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-2)"},children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M15 4V2"}),l.jsx("path",{d:"M15 16v-2"}),l.jsx("path",{d:"M8 9h2"}),l.jsx("path",{d:"M20 9h2"}),l.jsx("path",{d:"M17.8 11.8L19 13"}),l.jsx("path",{d:"M15 9h.01"}),l.jsx("path",{d:"M17.8 6.2L19 5"}),l.jsx("path",{d:"M11 6.2L9.7 5"}),l.jsx("path",{d:"M3 21l9-9"})]})}),l.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),l.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),l.jsx("button",{onClick:x,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:A=>{A.currentTarget.style.background="var(--surface-3)"},onMouseLeave:A=>{A.currentTarget.style.background="transparent"},children:l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),l.jsxs("div",{className:"px-4 py-3",children:[!y&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-end gap-2.5",children:[l.jsx("div",{className:"flex-1",children:l.jsx("textarea",{ref:M,value:X,onChange:A=>J(A.target.value),onKeyDown:te,placeholder:"e.g., Add an error handling section...",disabled:j,rows:1,className:"w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 12px",fontSize:12.5,lineHeight:1.5,fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",minHeight:36,maxHeight:96},onInput:A=>{const le=A.currentTarget;le.style.height="auto",le.style.height=Math.min(le.scrollHeight,96)+"px"}})}),l.jsxs("div",{style:{minWidth:100},children:[l.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),l.jsx("select",{className:"input-field text-[11px] py-1",value:Y,onChange:A=>{I(A.target.value);const le=F==null?void 0:F.providers.find(V=>V.id===A.target.value);le!=null&&le.models[0]&&W(le.models[0].id)},disabled:j,style:{width:"100%"},children:F==null?void 0:F.providers.filter(A=>A.available).map(A=>l.jsx("option",{value:A.id,children:A.label},A.id))})]}),l.jsxs("div",{style:{minWidth:80},children:[l.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),l.jsx("select",{className:"input-field text-[11px] py-1",value:O,onChange:A=>W(A.target.value),disabled:j,style:{width:"100%"},children:$==null?void 0:$.models.map(A=>l.jsx("option",{value:A.id,children:A.label},A.id))})]}),j?l.jsx("button",{onClick:v,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):l.jsx("button",{onClick:P,disabled:!X.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),j&&B.length>0&&l.jsx("div",{className:"mt-2.5",children:l.jsx(xs,{entries:B,isRunning:!0})})]}),k&&l.jsx("div",{className:"mt-3",children:C?l.jsx(fs,{error:C,onRetry:oe,onDismiss:x}):l.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:k})}),y&&l.jsxs("div",{className:"animate-fade-in",children:[y.reasoning&&l.jsxs("div",{className:"mb-3 px-3 py-2.5 rounded-lg text-[11.5px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[l.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),y.reasoning]}),l.jsx("div",{className:"mb-1",children:l.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),l.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:ne.map((A,le)=>l.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:A.type==="added"?"rgba(34,197,94,0.1)":A.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:A.type==="added"?"var(--green)":A.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:A.type==="added"?"3px solid var(--green)":A.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[l.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:A.type==="added"?"+":A.type==="removed"?"-":" "}),A.content]},le))}),l.jsx(_v,{changes:_,selections:G,currentEvals:w,onToggle:m,onSelectAll:b,onDeselectAll:g}),D&&l.jsxs("div",{className:"mt-3 px-3 py-2.5 rounded-lg text-[12px] flex items-center justify-between",style:{background:"rgba(251,191,36,0.12)",border:"1px solid rgba(251,191,36,0.3)",color:"#fbbf24"},children:[l.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),l.jsx("button",{onClick:f,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),l.jsxs("div",{className:"flex gap-2 mt-3",children:[l.jsxs("button",{onClick:u,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),l.jsx("button",{onClick:x,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),l.jsx("button",{onClick:oe,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function zv(s,o){const[c,u]=p.useState([]),[x,v]=p.useState("SKILL.md"),[m,b]=p.useState(null),[g,f]=p.useState(!1),[j,y]=p.useState(null),k=p.useCallback(async()=>{try{const _=await me.getSkillFiles(s,o);u(_.files)}catch{u([])}},[s,o]);p.useEffect(()=>{v("SKILL.md"),b(null),y(null),k()},[s,o,k]);const C=p.useCallback(async _=>{if(v(_),_==="SKILL.md"){b(null),y(null);return}f(!0),y(null);try{const G=await me.getSkillFile(s,o,_);b(G)}catch(G){y(`Unable to open file: ${G.message}`),b(null)}finally{f(!1)}},[s,o]),B=p.useCallback(()=>{k()},[k]);return{files:c,activeFile:x,secondaryContent:m,loading:g,error:j,selectFile:C,refresh:B,isSkillMd:x==="SKILL.md"}}function Dv(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Ov(s){const o=[],c=new Map;for(const u of s){const x=u.path.split("/"),m={name:x[x.length-1],path:u.path,type:u.type,size:u.size,children:[]};c.set(u.path,m)}for(const u of s){const x=u.path.split("/");if(x.length===1){const v=c.get(u.path);v&&o.push(v)}else{const v=x.slice(0,-1).join("/"),m=c.get(v),b=c.get(u.path);m&&b&&m.children.push(b)}}return o}function lp({expanded:s}){return l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:s?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:l.jsx("polyline",{points:"9 18 15 12 9 6"})})}function np(){return l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function Bv(){return l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),l.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Uv(){return l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("polyline",{points:"23 4 23 10 17 10"}),l.jsx("polyline",{points:"1 20 1 14 7 14"}),l.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}function sp({node:s,depth:o,activeFile:c,onSelect:u}){const[x,v]=p.useState(!0),m=s.path===c;return s.type==="dir"?l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>v(!x),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+o*14}px`,paddingTop:2,paddingBottom:2,background:"none",border:"none",cursor:"pointer",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left"},children:[l.jsx(lp,{expanded:x}),l.jsx(np,{}),l.jsxs("span",{children:[s.name,"/"]})]}),x&&s.children.map(b=>l.jsx(sp,{node:b,depth:o+1,activeFile:c,onSelect:u},b.path))]}):l.jsxs("button",{onClick:()=>u(s.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+o*14}px`,paddingTop:2,paddingBottom:2,background:m?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:m?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[l.jsx("span",{style:{width:10}}),l.jsx(Bv,{}),l.jsx("span",{style:{flex:1},children:s.name}),l.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:Dv(s.size)})]})}function Hv({files:s,activeFile:o,onSelect:c,onRefresh:u}){const[x,v]=p.useState(!1),m=p.useMemo(()=>Ov(s),[s]);return l.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>v(!x),children:[l.jsx(lp,{expanded:x}),l.jsx(np,{}),l.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}),l.jsx("button",{onClick:b=>{b.stopPropagation(),u()},style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:"2px 4px",display:"flex",alignItems:"center",borderRadius:3},title:"Refresh file list",children:l.jsx(Uv,{})})]}),x&&l.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:m.length===0?l.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):m.map(b=>l.jsx(sp,{node:b,depth:0,activeFile:o,onSelect:c},b.path))})]})}function wr(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Vv(s){try{return JSON.stringify(JSON.parse(s),null,2)}catch{return s}}function qv(s){const o=s.toLowerCase();return o.endsWith(".json")?"json":o.endsWith(".md")?"md":"other"}function Ux({content:s}){return l.jsx("textarea",{readOnly:!0,value:s,style:{flex:1,width:"100%",resize:"none",background:"var(--surface-1)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}})}function Hx({content:s,fileType:o}){if(o==="json"){const c=Vv(s);return l.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:c})}return o==="md"?l.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px 20px",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:13,lineHeight:1.6},dangerouslySetInnerHTML:{__html:Or(s)}}):l.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s})}function Vx(s){try{return JSON.stringify(JSON.parse(s),null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"\\]|\\.)*"\s*:/g,c=>`<span style="color:#6383ff">${c}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,c=>`<span style="color:#22c55e">${c.slice(0,2)}<span style="color:#22c55e">${c.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(c,u)=>`: <span style="color:#fb923c">${u}</span>`).replace(/:\s*(true|false|null)/g,(c,u)=>`: <span style="color:#a855f7">${u}</span>`)}catch{return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}}function Gv({file:s,loading:o,error:c,viewMode:u,plugin:x,skill:v,onSaved:m,onDirtyChange:b}){const[g,f]=p.useState(u),[j,y]=p.useState(!1),[k,C]=p.useState(""),[B,_]=p.useState(!1),[G,D]=p.useState(null),X=u!==g?u:g;p.useEffect(()=>{b==null||b(j)},[j,b]);const J=p.useCallback(()=>{(s==null?void 0:s.content)!=null&&(C(s.content),y(!0))},[s]),F=p.useCallback(()=>{y(!1)},[]),Y=p.useCallback(async()=>{if(!(!x||!v||!s)){_(!0);try{await me.saveSkillFile(x,v,s.path,k),D("Saved"),y(!1),m==null||m(),setTimeout(()=>D(null),2e3)}catch(W){D(`Save failed: ${W.message}`),setTimeout(()=>D(null),3e3)}finally{_(!1)}}},[x,v,s,k,m]);if(p.useEffect(()=>{if(!j)return;const W=M=>{(M.ctrlKey||M.metaKey)&&M.key==="s"&&(M.preventDefault(),Y())};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[j,Y]),o)return l.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(c)return l.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:l.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[l.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),l.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:c})]})});if(!s)return null;if(s.binary)return l.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",wr(s.size),") — cannot be displayed"]});const I=s.content??"",O=qv(s.path);return l.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[s.truncated&&l.jsxs("div",{style:{padding:"4px 12px",background:"var(--warning-muted, #fef3c7)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:"var(--warning-text, #92400e)"},children:["File truncated at ",wr(512*1024)," — ",wr(s.size)," total"]}),l.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(O==="md"||O==="json")&&["raw","split","preview"].map(W=>l.jsx("button",{onClick:()=>f(W),style:{padding:"2px 8px",fontSize:11,background:X===W?"var(--accent-muted)":"none",color:X===W?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:W},W)),l.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[wr(s.size),x&&v&&!s.binary&&!j&&l.jsx("button",{onClick:J,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),j&&l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:Y,disabled:B,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:B?.6:1},children:B?"Saving...":"Save"}),l.jsx("button",{onClick:F,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),G&&l.jsx("div",{style:{padding:"4px 12px",background:G.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:G.startsWith("Save failed")?"var(--red)":"var(--green)"},children:G}),l.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:j?l.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[l.jsx("textarea",{value:k,onChange:W=>C(W.target.value),style:{flex:1,width:"100%",resize:"none",background:"var(--surface-0)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}}),l.jsxs("div",{style:{position:"sticky",bottom:0,display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[l.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),l.jsx("button",{onClick:Y,disabled:B,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:B?.6:1},children:B?"Saving...":"Save"}),l.jsx("button",{onClick:F,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):X==="split"&&O!=="other"?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:l.jsx(Ux,{content:I})}),l.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:O==="json"?l.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Vx(I)}}):l.jsx(Hx,{content:I,fileType:O})})]}):X==="preview"&&O!=="other"?O==="json"?l.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Vx(I)}}):l.jsx(Hx,{content:I,fileType:O}):l.jsx(Ux,{content:I})})]})}function Yv({size:s=15}){return l.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("polyline",{points:"16 18 22 12 16 6"}),l.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function $v({size:s=15}){return l.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),l.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function Qv({size:s=15}){return l.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),l.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Xv({size:s=15}){return l.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M15 4V2"}),l.jsx("path",{d:"M15 16v-2"}),l.jsx("path",{d:"M8 9h2"}),l.jsx("path",{d:"M20 9h2"}),l.jsx("path",{d:"M17.8 11.8L19 13"}),l.jsx("path",{d:"M15 9h.01"}),l.jsx("path",{d:"M17.8 6.2L19 5"}),l.jsx("path",{d:"M11 6.2L9.7 5"}),l.jsx("path",{d:"M3 21l9-9"})]})}function rc({size:s=15}){return l.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function Kv(){const{state:s,dispatch:o,saveContent:c,isReadOnly:u}=Qt(),{plugin:x,skill:v,skillContent:m,isDirty:b,improveTarget:g,aiEditOpen:f}=s,[j,y]=p.useState("split"),[k,C]=p.useState(!1),B=p.useRef(null),[_,G]=p.useState(!1),[D,X]=p.useState(""),[J,F]=p.useState(!1),[Y,I]=p.useState(null),[O,W]=p.useState([]),[M,$]=p.useState([]),[P,te]=p.useState(null),oe=p.useRef(null),{config:ne}=il(),{files:w,activeFile:S,secondaryContent:A,loading:le,error:V,selectFile:ue,refresh:N,isSkillMd:H}=zv(x??"",v??""),[ae,se]=p.useState(!1),fe=p.useCallback(ce=>{ae&&!window.confirm("You have unsaved changes. Discard?")||ue(ce)},[ae,ue]);p.useEffect(()=>()=>{var ce;(ce=oe.current)==null||ce.abort()},[]);const{metadata:xe,body:ye}=Nv(m),Ge=xe["allowed-tools"],ze=Array.isArray(Ge)?Ge:typeof Ge=="string"?[Ge]:[],ft=xe.name,Nt=xe.description,ee=xe.metadata,re=typeof ee=="object"&&!Array.isArray(ee)?ee:null,ie=xe.version||(re==null?void 0:re.version),he=xe.tags||(re==null?void 0:re.tags),be=Array.isArray(he)?he:typeof he=="string"?he.split(",").map(ce=>ce.trim()).filter(Boolean):[],Ye=new Set(["name","description","metadata","allowed-tools","version","tags"]),Qe=Object.entries(xe).filter(([ce])=>!Ye.has(ce)),ut=p.useCallback(async()=>{C(!0),await c(),C(!1)},[c]),ca=p.useCallback(ce=>{(ce.ctrlKey||ce.metaKey)&&ce.key==="s"&&(ce.preventDefault(),ce.stopPropagation(),b&&ut()),(ce.ctrlKey||ce.metaKey)&&ce.key==="k"&&(ce.preventDefault(),ce.stopPropagation(),o({type:f?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[b,ut,f,o]),Je=p.useCallback(async()=>{var ht,Se;if(!D.trim())return;(ht=oe.current)==null||ht.abort();const ce=new AbortController;oe.current=ce,F(!0),te(null),$([]),I(null),W([]);try{const tt=(ne==null?void 0:ne.provider)||"claude-cli",At=(ne==null?void 0:ne.model)||"sonnet",$e=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:D,provider:tt,model:At}),signal:ce.signal});if(!$e.ok||!$e.body){let We=`HTTP ${$e.status}`;try{const na=await $e.json();na.error&&(We=na.error)}catch{}throw new Error(We)}const mn=$e.body.getReader(),ma=new TextDecoder;let at="",Ie="";for(;;){const{done:We,value:na}=await mn.read();if(We)break;at+=ma.decode(na,{stream:!0});const ol=at.split(`
|
|
61
|
-
`);at=ol.pop()||"";for(const sa of ol)if(sa.startsWith("event: "))Ie=sa.slice(7).trim();else if(sa.startsWith("data: ")){try{const Ee=JSON.parse(sa.slice(6));if(Ie==="progress")$(xt=>[...xt,{phase:Ee.phase,message:Ee.message,timestamp:Date.now()}]);else if(Ie==="done"||Ie==="complete"){const xt=["---"];Ee.name&&xt.push(`name: ${Ee.name}`),Ee.description&&xt.push(`description: "${Ee.description.replace(/"/g,'\\"')}"`),Ee.model&&xt.push(`model: ${Ee.model}`),(Se=Ee.allowedTools)!=null&&Se.trim()&&xt.push(`allowed-tools: ${Ee.allowedTools.trim()}`),xt.push("---","",Ee.body||"");const ha=xt.join(`
|
|
62
|
-
`);I(ha),W(Br(m,ha)),F(!1)}else Ie==="error"&&(te(Ee.message||Ee.description||"Generation failed"),F(!1))}catch{}Ie=""}}}catch(tt){tt.name!=="AbortError"&&te(tt.message)}finally{F(!1),oe.current=null}},[D,ne,m]),wt=p.useCallback(()=>{Y&&o({type:"SET_CONTENT",content:Y}),G(!1),I(null),W([]),X(""),$([])},[Y,o]),Xt=p.useCallback(()=>{G(!1),I(null),W([]),X(""),$([]),te(null)},[]),Fe=p.useCallback(()=>{var ce;_?((ce=oe.current)==null||ce.abort(),Xt()):(f&&o({type:"CLOSE_AI_EDIT"}),G(!0))},[_,f,o,Xt]),Tt=[{mode:"raw",icon:l.jsx(Yv,{}),label:"Editor"},{mode:"split",icon:l.jsx($v,{}),label:"Split"},{mode:"preview",icon:l.jsx(Qv,{}),label:"Preview"}];return l.jsxs("div",{className:"flex flex-col h-full",onKeyDown:ca,tabIndex:-1,children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[l.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:Tt.map(({mode:ce,icon:ht,label:Se})=>l.jsxs("button",{onClick:()=>y(ce),title:Se,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:j===ce?"var(--surface-4)":"transparent",color:j===ce?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:j===ce?600:400,border:"none",cursor:"pointer"},children:[ht,l.jsx("span",{style:{letterSpacing:"0.01em"},children:Se})]},ce))}),H?u?l.jsx("div",{className:"flex items-center gap-2",children:l.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),l.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>{f?o({type:"CLOSE_AI_EDIT"}):(_&&Xt(),o({type:"OPEN_AI_EDIT"}))},title:"Edit with AI (Ctrl+K)",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:f?600:400,border:"none",cursor:"pointer",color:f?"#a855f7":"var(--text-tertiary)",background:f?"rgba(168,85,247,0.12)":"transparent"},children:[l.jsx(Xv,{size:13}),l.jsx("span",{children:"AI Edit"})]}),l.jsxs("button",{onClick:Fe,title:"Regenerate skill from prompt",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:_?600:400,border:"none",cursor:"pointer",color:_?"#a855f7":"var(--text-tertiary)",background:_?"rgba(168,85,247,0.12)":"transparent"},children:[l.jsx(rc,{size:13}),l.jsx("span",{children:"Regenerate"})]}),l.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),b&&l.jsx("button",{onClick:()=>o({type:"SET_CONTENT",content:s.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),l.jsx("button",{onClick:ut,disabled:!b||k,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:k?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),x&&v&&l.jsx(Hv,{files:w,activeFile:S,onSelect:fe,onRefresh:N}),!H&&l.jsx(Gv,{file:A,loading:le,error:V,viewMode:j,plugin:x??void 0,skill:v??void 0,onSaved:()=>{ue(S),N()},onDirtyChange:se}),H&&l.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:j==="raw"||j==="preview"?"1fr":"1fr 1fr"},children:[j!=="preview"&&l.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:j==="split"?"1px solid var(--border-subtle)":"none"},children:l.jsx("textarea",{ref:B,value:m,onChange:ce=>{u||o({type:"SET_CONTENT",content:ce.target.value})},onKeyDown:ca,spellCheck:!1,readOnly:u,className:"flex-1 w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",fontSize:12.5,lineHeight:1.7,tabSize:2,border:"none",padding:"16px 20px",opacity:u?.7:1}})}),j!=="raw"&&l.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:l.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(ft||ie||Nt)&&l.jsxs("div",{style:{marginBottom:20},children:[l.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[ft&&l.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:ft}),ie&&l.jsxs("span",{style:{fontSize:10,fontWeight:600,color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4,letterSpacing:"0.03em",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:["v",ie]})]}),Nt&&l.jsx("p",{style:{fontSize:12.5,lineHeight:1.65,color:"var(--text-secondary)",margin:0,paddingLeft:12,borderLeft:"2px solid var(--accent)",maxWidth:600},children:Nt})]}),be.length>0&&l.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:be.map(ce=>l.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:ce},ce))}),ze.length>0&&l.jsx("div",{style:{marginBottom:16},children:l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),ze.map(ce=>l.jsx("span",{style:{fontSize:10.5,fontFamily:"var(--font-mono, ui-monospace, monospace)",color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4},children:ce},ce))]})}),Qe.length>0&&l.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:Qe.map(([ce,ht],Se)=>{const tt=Array.isArray(ht)?ht.join(", "):typeof ht=="object"?Object.entries(ht).map(([At,$e])=>`${At}: ${Array.isArray($e)?$e.join(", "):$e}`).join(" | "):ht;return l.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:Se>0?"1px solid var(--border-subtle)":"none"},children:[l.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:ce}),l.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:tt})]},ce)})}),(ft||Nt||be.length>0||ze.length>0||Qe.length>0)&&ye&&l.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),ye&&l.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Or(ye)}})]})})]}),H&&f&&l.jsx(Lv,{}),H&&_&&l.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:l.jsxs("div",{className:"px-4 py-3",children:[!Y&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(rc,{size:14}),l.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),l.jsx("div",{className:"flex gap-2 mb-2",children:l.jsx("textarea",{value:D,onChange:ce=>X(ce.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:J,className:"flex-1 px-3 py-2 rounded-lg text-[12px] resize-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",outline:"none",opacity:J?.5:1},onKeyDown:ce=>{ce.key==="Enter"&&(ce.ctrlKey||ce.metaKey)&&D.trim()&&!J&&(ce.preventDefault(),Je())}})}),l.jsxs("div",{className:"flex items-center gap-2",children:[J?l.jsx("button",{onClick:()=>{var ce;(ce=oe.current)==null||ce.abort(),F(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):l.jsx("button",{onClick:Je,disabled:!D.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),l.jsx("button",{onClick:Xt,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),J&&M.length>0&&l.jsx("div",{className:"mt-2",children:l.jsx(xs,{entries:M,isRunning:!0})}),P&&l.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[P,l.jsx("button",{onClick:Je,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),Y&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(rc,{size:14}),l.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),l.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:O.map((ce,ht)=>l.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:ce.type==="added"?"rgba(34,197,94,0.1)":ce.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:ce.type==="added"?"var(--green)":ce.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:ce.type==="added"?"3px solid var(--green)":ce.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[l.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:ce.type==="added"?"+":ce.type==="removed"?"-":" "}),ce.content]},ht))}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("button",{onClick:wt,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),l.jsx("button",{onClick:Xt,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),H&&g!==null&&x&&v&&l.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:l.jsx(Cv,{plugin:x,skill:v,skillContent:m,onApplied:ce=>{o({type:"SET_CONTENT",content:ce}),o({type:"CONTENT_SAVED"}),o({type:"CLOSE_IMPROVE"})}})})]})}function xn(s){return s.testType==="integration"?"integration":"unit"}function pn(s){return s>=.8?"var(--green)":s>=.5?"var(--yellow)":"var(--red)"}function rp(s){const o=new Date(s);return o.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+o.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function ip(s){return s==null?"--":s>=1e3?`${(s/1e3).toFixed(1)}s`:`${s}ms`}const Zv=new Set(["benchmark","comparison","baseline"]);function qx(s,o,c,u){return s.map(({rate:x,idx:v,total:m})=>{const b=u+v/(m-1)*(o-u*2),g=u+(c-u*2)-x*(c-u*2);return`${b},${g}`})}function op({entries:s}){const o=s.filter(y=>Zv.has(y.type)).slice().reverse(),c=o.map((y,k,C)=>({rate:y.pass_rate,idx:k,total:C.length})).filter((y,k)=>{const C=o[k].type;return C==="benchmark"||C==="comparison"}),u=o.flatMap((y,k)=>y.type==="baseline"?[{rate:y.pass_rate,idx:k,total:o.length}]:y.type==="comparison"&&y.baselinePassRate!=null?[{rate:y.baselinePassRate,idx:k,total:o.length}]:[]);if(c.length<2&&u.length<2)return null;const x=80,v=24,m=2,b=c.length>=2?qx(c,x,v,m):[],g=u.length>=2?qx(u,x,v,m):[],f=b[b.length-1],j=g[g.length-1];return l.jsxs("svg",{width:x,height:v,style:{display:"block",flexShrink:0},children:[g.length>0&&l.jsx("polyline",{points:g.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),b.length>0&&l.jsx("polyline",{points:b.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),j&&l.jsx("circle",{cx:parseFloat(j.split(",")[0]),cy:parseFloat(j.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),f&&l.jsx("circle",{cx:parseFloat(f.split(",")[0]),cy:parseFloat(f.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function cp(s,o,c){const u=isNaN(o)?0:o,x=[],v=[],m=[];if((s==="PASS"||s==="EFFECTIVE")&&u>=.7){const f=x.length>0?` Met criteria: ${x.map(j=>j.criterion).join(", ")}.`:"";return{explanation:`${s} (score ${u.toFixed(2)}): evaluation met expectations.${f}`}}if(s==="FAIL"||s==="DEGRADING"){const f=v.length>0?` Failed criteria: ${v.map(y=>y.criterion).join(", ")}.`:"",j=[...v.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...m.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return j.length===0&&j.push("Review prompt instructions and add more specific guidance"),{explanation:`${s} (score ${u.toFixed(2)}): evaluation did not meet expectations.${f}`,recommendations:j}}if(s==="INEFFECTIVE"){if(u<.2){const j=[...v.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${s} (score ${u.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:j}}const f=[...v.map(j=>`Rework "${j.criterion}" — currently at ${j.score.toFixed(2)}`),...m.map(j=>`Strengthen "${j.criterion}" (score: ${j.score.toFixed(2)})`)];return f.length===0&&f.push("Consider restructuring your prompt approach"),{explanation:`${s} (score ${u.toFixed(2)}): below expectations but showing some capability.`,recommendations:f}}if(s==="MARGINAL"){const f=[...m.map(j=>`Strengthen "${j.criterion}" (score: ${j.score.toFixed(2)})`),...v.map(j=>`Improve "${j.criterion}" (score: ${j.score.toFixed(2)})`)];return f.length===0&&f.push(x.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${s} (score ${u.toFixed(2)}): moderate improvement detected.`,recommendations:f}}if(s==="EMERGING"){const f=[...v.map(j=>`Improve "${j.criterion}" (score: ${j.score.toFixed(2)})`),...m.map(j=>`Strengthen "${j.criterion}" (score: ${j.score.toFixed(2)})`)];return f.length===0&&f.push(x.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Add more specific guidance to your prompt instructions"),{explanation:`${s} (score ${u.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:f}}const b=x.length>0?` Passing: ${x.map(f=>f.criterion).join(", ")}.`:"",g=m.length>0?` Needs improvement: ${m.map(f=>f.criterion).join(", ")}.`:"";return{explanation:`${s} (score ${u.toFixed(2)}): mixed results.${b}${g}`}}const up={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function Jv(s){return Object.hasOwn(up,s)}function Wv(s){return Jv(s)?up[s]:s}function Fv(){const{state:s}=Qt(),{plugin:o,skill:c}=s,[u,x]=p.useState([]),[v,m]=p.useState([]),[b,g]=p.useState(!0),[f,j]=p.useState(null),[y,k]=p.useState(new Set),[C,B]=p.useState({}),[_,G]=p.useState(null),[D,X]=p.useState(""),[J,F]=p.useState(!1),[Y,I]=p.useState(""),[O,W]=p.useState(""),M=p.useCallback(async()=>{g(!0),j(null);try{const[w,S]=await Promise.all([me.getCredentials(o,c),me.getParams(o,c)]);x(w.credentials),m(S.params)}catch(w){j(w instanceof Error?w.message:"Failed to load parameters"),x([]),m([])}finally{g(!1)}},[o,c]);p.useEffect(()=>{M()},[M]);const $=p.useCallback(async(w,S)=>{F(!0),j(null);try{await me.setCredential(o,c,w,S),G(null),X(""),await M()}catch(A){j(A instanceof Error?A.message:`Failed to save ${w}`)}finally{F(!1)}},[o,c,M]),P=p.useCallback(async()=>{const w=Y.trim().toUpperCase(),S=O.trim();if(!(!w||!S)){F(!0),j(null);try{await me.setCredential(o,c,w,S),I(""),W(""),await M()}catch(A){j(A instanceof Error?A.message:`Failed to add ${w}`)}finally{F(!1)}}},[o,c,Y,O,M]),te=p.useCallback(async w=>{if(y.has(w)){k(S=>{const A=new Set(S);return A.delete(w),A}),B(S=>{const A={...S};return delete A[w],A});return}try{const A=(await me.getParamsRevealed(o,c,w)).params.find(le=>le.name===w);A!=null&&A.value&&(B(le=>({...le,[w]:A.value})),k(le=>new Set(le).add(w)))}catch{}},[o,c,y]),oe=new Set(u.map(w=>w.name)),ne=[...u.map(w=>{const S=v.find(A=>A.name===w.name);return{name:w.name,status:w.status,maskedValue:(S==null?void 0:S.maskedValue)??""}}),...v.filter(w=>!oe.has(w.name)).map(w=>({name:w.name,status:w.status,maskedValue:w.maskedValue}))];return l.jsxs("div",{className:"py-2 px-3",children:[l.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),f&&l.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"rgba(239,68,68,0.1)",color:"#ef4444",border:"1px solid rgba(239,68,68,0.2)"},role:"alert",children:f}),b&&ne.length===0&&l.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!b&&ne.length===0&&!f&&l.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),ne.map(w=>l.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[l.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:w.name}),l.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:w.status==="ready"?"rgba(34,197,94,0.15)":"rgba(239,68,68,0.15)",color:w.status==="ready"?"#22c55e":"#ef4444"},children:w.status}),(w.maskedValue||w.status==="ready")&&l.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[y.has(w.name)?C[w.name]??w.maskedValue:w.maskedValue||"***",l.jsx("button",{onClick:()=>te(w.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${y.has(w.name)?"Hide":"Reveal"} value for ${w.name}`,children:y.has(w.name)?"hide":"show"})]}),_===w.name?l.jsxs("div",{className:"flex gap-1",children:[l.jsx("input",{value:D,onChange:S=>X(S.target.value),onKeyDown:S=>{S.key==="Enter"&&D.trim()&&$(w.name,D)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${w.name}`,autoFocus:!0}),l.jsx("button",{onClick:()=>$(w.name,D),disabled:J||!D.trim(),className:"text-[10px] font-medium",style:{color:"#22c55e",background:"none",border:"none",cursor:"pointer"},children:"Save"}),l.jsx("button",{onClick:()=>{G(null),X("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):l.jsx("button",{onClick:()=>{G(w.name),X("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},w.name)),l.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[l.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx("input",{value:Y,onChange:w=>I(w.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),l.jsx("input",{value:O,onChange:w=>W(w.target.value),onKeyDown:w=>{w.key==="Enter"&&Y.trim()&&O.trim()&&P()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),l.jsx("button",{onClick:P,disabled:J||!Y.trim()||!O.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:J?"not-allowed":"pointer"},children:"Add"})]})]})]})}function Iv(s,o,c){const[u,x]=p.useState(null),[v,m]=p.useState(!1),b=p.useRef("");p.useEffect(()=>{const f=`${s}/${o}/${c}`;b.current!==f&&(b.current=f,m(!0),me.getCaseHistory(s,o,c).then(j=>x(j)).catch(()=>x([])).finally(()=>m(!1)))},[s,o,c]);const g=p.useCallback(()=>{m(!0),b.current="",me.getCaseHistory(s,o,c).then(f=>x(f)).catch(()=>x([])).finally(()=>m(!1))},[s,o,c]);return{entries:u,loading:v,refetch:g}}function Pv(s,o,c){const u={flaky:!1,nonDiscriminating:!1,regression:!1};if(!c||c.length===0)return u;const v=c.slice(0,10).map(g=>g.assertions.find(f=>f.id===s)).filter(Boolean);if(v.length>=2){const f=v.filter(j=>j.pass).length/v.length;f>=.3&&f<=.7&&(u.flaky=!0)}const m=c.find(g=>g.type==="benchmark"),b=c.find(g=>g.type==="baseline");if(m&&b){const g=m.assertions.find(j=>j.id===s),f=b.assertions.find(j=>j.id===s);g!=null&&g.pass&&(f!=null&&f.pass)&&(u.nonDiscriminating=!0)}if(o&&!o.pass&&c.length>=1){const f=c[0].assertions.find(j=>j.id===s);f!=null&&f.pass&&(u.regression=!0)}return u}function ey(){var le;const{state:s,dispatch:o,saveEvals:c,runCase:u,runAll:x,cancelCase:v,cancelAll:m,generateEvals:b,isReadOnly:g}=Qt(),{evals:f,evalsError:j,selectedCaseId:y,inlineResults:k,caseRunStates:C,generateEvalsLoading:B,generateEvalsProgress:_,generateEvalsError:G}=s,D=p.useMemo(()=>{for(const V of C.values())if(V.status==="running"||V.status==="queued")return!0;return!1},[C]),[X,J]=p.useState(!1),[F,Y]=p.useState("all"),I={skill_name:s.skill,evals:[]},O=f??I,W=O.evals,M=p.useMemo(()=>F==="all"?W:W.filter(V=>xn(V)===F),[F,W]),$=M.find(V=>V.id===y)??null;p.useEffect(()=>{y!==null&&!M.find(V=>V.id===y)&&o({type:"SELECT_CASE",caseId:M.length>0?M[0].id:null})},[M,y,o]);const[P,te]=p.useState([]),oe=p.useMemo(()=>W.some(V=>xn(V)==="integration"),[W]);p.useEffect(()=>{oe&&me.getCredentials(s.plugin,s.skill).then(V=>te(V.credentials)).catch(()=>te([]))},[s.plugin,s.skill,oe]);const ne=p.useMemo(()=>new Set(P.filter(V=>V.status==="missing").map(V=>V.name)),[P]),[w,S]=p.useState(!1),A=p.useCallback(V=>{S(!1),b(V?{testType:V}:void 0)},[b]);return!f||W.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[l.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:j?"var(--error-muted, #3f1a1a)":"var(--accent-muted)"},children:j?l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--error, #f87171)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),l.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M9 11l3 3L22 4"}),l.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),l.jsx("div",{className:"text-center",children:j?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--error, #f87171)"},children:"Invalid evals.json"}),l.jsx("div",{className:"text-[11px] font-mono px-3 py-2 rounded mt-1 max-w-sm text-left break-words",style:{color:"var(--text-secondary)",background:"var(--surface-2)"},children:j}),l.jsx("div",{className:"text-[12px] mt-2",style:{color:"var(--text-tertiary)"},children:"Fix the evals.json file and reload, or regenerate test cases with AI"})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),l.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>J(!0),disabled:g,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),l.jsxs("div",{style:{position:"relative"},children:[l.jsxs("div",{className:"flex",children:[l.jsx("button",{onClick:()=>A("unit"),disabled:B||g,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:B?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),l.jsx("button",{onClick:()=>S(!w),disabled:B||g,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:l.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),w&&l.jsx("div",{className:"absolute right-0 mt-1 rounded-lg py-1 z-50",style:{background:"var(--surface-1)",border:"1px solid var(--border-default)",minWidth:180,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:l.jsx("button",{onClick:()=>A("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:V=>{V.currentTarget.style.background="var(--surface-2)"},onMouseLeave:V=>{V.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),B&&_.length>0&&l.jsx("div",{className:"w-full max-w-md mt-3",children:l.jsx(xs,{entries:_,isRunning:!0})}),G&&l.jsx("div",{className:"w-full max-w-md mt-3",children:l.jsx(fs,{error:G,onRetry:()=>A()})}),X&&l.jsx(Gx,{evals:O,onSave:V=>{c(V),J(!1)},onCancel:()=>J(!1)})]}):l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[l.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[l.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[l.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",M.length,")"]}),l.jsx("div",{className:"flex items-center gap-1.5",children:D?l.jsx("button",{onClick:m,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:"Cancel All"}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>x("benchmark"),disabled:M.length===0||g,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),l.jsx("button",{onClick:()=>x("comparison"),disabled:M.length===0||g,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),l.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(V=>l.jsx("button",{onClick:()=>Y(V),style:{padding:"2px 8px",fontSize:10,fontWeight:F===V?600:400,background:F===V?"var(--accent-muted)":"transparent",color:F===V?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:V==="all"?`All (${W.length})`:V==="unit"?`Unit (${W.filter(ue=>xn(ue)==="unit").length})`:`Integration (${W.filter(ue=>xn(ue)==="integration").length})`},V))}),l.jsxs("div",{className:"py-1",children:[M.length===0&&W.length>0&&l.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",F==="all"?"":F+" ","tests yet"]}),M.map(V=>{var ae;const ue=k.get(V.id),N=y===V.id,H=xn(V);return l.jsxs("button",{onClick:()=>o({type:"SELECT_CASE",caseId:V.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:N?"var(--accent-muted)":"transparent",borderLeft:N?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:se=>{N||(se.currentTarget.style.background="var(--surface-2)")},onMouseLeave:se=>{N||(se.currentTarget.style.background="transparent")},children:[l.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[l.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:N?"var(--text-primary)":"var(--text-secondary)"},children:["#",V.id," ",V.name,l.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:H==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:H==="unit"?"#6383ff":"#fb923c",whiteSpace:"nowrap"},children:H==="unit"?"U":"I"}),H==="integration"&&((ae=V.requiredCredentials)==null?void 0:ae.some(se=>ne.has(se)))&&l.jsx("span",{title:"Configure credentials to run",children:l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),l.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),l.jsx(dp,{result:ue})]}),l.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[V.assertions.length," assertion",V.assertions.length!==1?"s":"",(ue==null?void 0:ue.passRate)!=null&&l.jsx(ly,{passRate:ue.passRate})]})]},V.id)})]}),l.jsx("div",{className:"px-3 py-2",children:!g&&l.jsx("button",{onClick:()=>J(!0),className:"w-full py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{border:"1px dashed var(--border-default)",color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:V=>{V.currentTarget.style.borderColor="var(--accent)",V.currentTarget.style.color="var(--accent)"},onMouseLeave:V=>{V.currentTarget.style.borderColor="var(--border-default)",V.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),oe&&l.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:l.jsx(Fv,{})})]}),l.jsx("div",{className:"overflow-auto",children:$?l.jsx(ty,{evalCase:$,result:k.get($.id),evals:f,caseStatus:((le=C.get($.id))==null?void 0:le.status)??"idle",onSaveEvals:c,onRun:V=>u(V,"benchmark"),onCompare:V=>u(V,"comparison"),onCancel:V=>v(V),onImprove:V=>o({type:"OPEN_IMPROVE",evalId:V})}):l.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),X&&l.jsx(Gx,{evals:O,onSave:V=>{c(V),J(!1)},onCancel:()=>J(!1)})]})}function ty({evalCase:s,result:o,evals:c,caseStatus:u,onSaveEvals:x,onRun:v,onCompare:m,onCancel:b,onImprove:g}){const{state:f,isReadOnly:j}=Qt(),{plugin:y,skill:k}=f,{entries:C,loading:B}=Iv(y,k,s.id),[_,G]=p.useState(!1),[D,X]=p.useState(s.prompt),[J,F]=p.useState(!1),[Y,I]=p.useState(s.expected_output);p.useState(()=>{X(s.prompt),I(s.expected_output)});const O=p.useCallback(V=>{x({...c,evals:c.evals.map(ue=>ue.id===V.id?V:ue)})},[c,x]),W=p.useCallback(()=>{O({...s,prompt:D}),G(!1)},[s,D,O]),M=p.useCallback(()=>{O({...s,expected_output:Y}),F(!1)},[s,Y,O]),$=p.useCallback(()=>{O({...s,assertions:[...s.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[s,O]),P=p.useCallback((V,ue)=>{O({...s,assertions:s.assertions.map(N=>N.id===V?{...N,text:ue}:N)})},[s,O]),te=p.useCallback(V=>{O({...s,assertions:s.assertions.filter(ue=>ue.id!==V)})},[s,O]),oe=p.useCallback(()=>{confirm("Delete this test case?")&&x({...c,evals:c.evals.filter(V=>V.id!==s.id)})},[c,s.id,x]),ne=o&&o.assertions.length>0&&o.assertions.every(V=>V.pass),w=o&&o.assertions.some(V=>!V.pass),S=xn(s),A=s.requiredCredentials??[],le=S==="integration"&&A.length>0;return l.jsxs("div",{className:"p-5 animate-fade-in",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",s.id," ",s.name]}),j?l.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:S==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:S==="unit"?"#6383ff":"#fb923c"},children:S==="unit"?"Unit":"Integration"}):l.jsx("button",{onClick:()=>{if((S==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:ue,requirements:N,cleanup:H,...ae}=s;O({...ae,testType:"unit"})}else O({...s,testType:"integration"})},title:`Click to switch to ${S==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:S==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:S==="unit"?"#6383ff":"#fb923c",border:"none",cursor:"pointer"},children:S==="unit"?"Unit":"Integration"}),l.jsx(dp,{result:o})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[u==="running"||u==="queued"?l.jsxs("button",{onClick:()=>b(s.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:[l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:l.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>v(s.id),disabled:j,className:"btn btn-primary text-[12px]",children:"Run"}),l.jsx("button",{onClick:()=>m(s.id),disabled:j,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),w&&!j&&u!=="running"&&u!=="queued"&&l.jsx("button",{onClick:()=>g(s.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!j&&u!=="running"&&u!=="queued"&&l.jsx("button",{onClick:oe,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("polyline",{points:"3 6 5 6 21 6"}),l.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),j&&S==="integration"&&l.jsxs("div",{"data-testid":"platform-integration-note",className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--accent-muted)",border:"1px solid rgba(99,131,255,0.2)"},children:[l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),l.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),l.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),l.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),ne&&l.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--green-muted)",border:"1px solid rgba(52, 211, 153, 0.2)"},children:[l.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[l.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),l.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),l.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),le&&l.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"rgba(251,146,60,0.1)",border:"1px solid rgba(251,146,60,0.2)"},children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),l.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),l.jsx("span",{className:"text-[12px] font-semibold",style:{color:"#fb923c"},children:"Required Credentials"})]}),l.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),l.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:A.map(V=>l.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:V},V))})]}),!j&&S==="integration"&&l.jsx(ry,{evalCase:s,onUpdate:O}),l.jsx(Tr,{title:"Prompt",children:_?l.jsxs("div",{children:[l.jsx("textarea",{value:D,onChange:V=>X(V.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),l.jsxs("div",{className:"flex gap-2 mt-2",children:[l.jsx("button",{onClick:W,className:"btn btn-primary text-[12px]",children:"Save"}),l.jsx("button",{onClick:()=>{X(s.prompt),G(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):l.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-secondary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:j?"default":"pointer"},onClick:()=>{j||G(!0)},onMouseEnter:V=>{j||(V.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:V=>{V.currentTarget.style.borderColor="var(--border-subtle)"},children:s.prompt||l.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:j?"No prompt":"Click to edit prompt..."})})}),l.jsx(Tr,{title:"Expected Output",children:J?l.jsxs("div",{children:[l.jsx("textarea",{value:Y,onChange:V=>I(V.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),l.jsxs("div",{className:"flex gap-2 mt-2",children:[l.jsx("button",{onClick:M,className:"btn btn-primary text-[12px]",children:"Save"}),l.jsx("button",{onClick:()=>{I(s.expected_output),F(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):l.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:j?"default":"pointer"},onClick:()=>{j||F(!0)},onMouseEnter:V=>{j||(V.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:V=>{V.currentTarget.style.borderColor="var(--border-subtle)"},children:s.expected_output||l.jsx("span",{style:{fontStyle:"italic"},children:j?"No expected output":"Click to edit expected output..."})})}),l.jsx(Tr,{title:`Assertions (${s.assertions.length})`,action:j?void 0:l.jsx("button",{onClick:$,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:s.assertions.length===0?l.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):l.jsx("div",{className:"space-y-2",children:s.assertions.map(V=>{const ue=o==null?void 0:o.assertions.find(H=>H.assertion_id===V.id),N=Pv(V.id,ue,C);return l.jsx(ay,{assertion:V,result:ue,badges:N,isReadOnly:j,onUpdate:H=>P(V.id,H),onDelete:()=>te(V.id)},V.id)})})}),(o==null?void 0:o.output)&&l.jsx(ny,{output:o.output,durationMs:o.durationMs,tokens:o.tokens}),o&&o.passRate!=null&&o.passRate<.2&&(()=>{const V=cp("INEFFECTIVE",o.passRate);return V.recommendations&&V.recommendations.length>0?l.jsx(Tr,{title:"Recommendations",children:l.jsxs("div",{className:"rounded-xl p-4",style:{background:"rgba(251,146,60,0.08)",border:"1px solid rgba(251,146,60,0.2)"},children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),l.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),l.jsx("span",{className:"text-[12px] font-semibold",style:{color:"#fb923c"},children:"This eval is significantly below expectations"})]}),l.jsx("ul",{className:"space-y-1.5 ml-1",children:V.recommendations.map((ue,N)=>l.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[l.jsx("span",{style:{color:"#fb923c",fontWeight:600,flexShrink:0},children:"•"}),ue]},N))})]})}):null})(),l.jsx(sy,{evalId:s.id,sharedEntries:C,sharedLoading:B})]},s.id)}function ay({assertion:s,result:o,badges:c,isReadOnly:u,onUpdate:x,onDelete:v}){const[m,b]=p.useState(!1),[g,f]=p.useState(s.text),[j,y]=p.useState(!1),k=()=>{x(g),b(!1)};return l.jsx("div",{className:"rounded-lg px-3 py-2.5 transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:l.jsxs("div",{className:"flex items-start gap-2",children:[o?l.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:o.pass?"var(--green-muted)":"var(--red-muted)"},children:o.pass?l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})}):l.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):l.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(c==null?void 0:c.regression)&&l.jsx("span",{className:"mt-0.5 flex-shrink-0",title:"Regression: was passing, now failing",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:18,color:"var(--red)",fontSize:14,fontWeight:700,lineHeight:1},children:l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),l.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[l.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:s.id}),(c==null?void 0:c.flaky)&&l.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"rgba(234, 179, 8, 0.15)",color:"#ca8a04",whiteSpace:"nowrap"},children:"Flaky"}),(c==null?void 0:c.nonDiscriminating)&&l.jsx("span",{title:"Non-discriminating: passes on both skill and baseline runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--surface-3)",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"Non-Discrim."})]}),m?l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{value:g,onChange:C=>f(C.target.value),onKeyDown:C=>{C.key==="Enter"&&k(),C.key==="Escape"&&b(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),l.jsx("button",{onClick:k,className:"btn btn-primary text-[11px]",children:"Save"})]}):l.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:u?"default":"pointer"},onClick:()=>{u||(f(s.text),b(!0))},children:s.text}),(o==null?void 0:o.reasoning)&&l.jsx("button",{onClick:()=>y(!j),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:j?"Hide reasoning":"Show reasoning"}),j&&(o==null?void 0:o.reasoning)&&l.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:o.reasoning})]}),!u&&l.jsx("button",{onClick:v,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:C=>{C.currentTarget.style.color="var(--red)",C.currentTarget.style.opacity="1"},onMouseLeave:C=>{C.currentTarget.style.color="var(--text-tertiary)",C.currentTarget.style.opacity=""},children:l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function Tr({title:s,action:o,children:c}){return l.jsxs("div",{className:"mb-5",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:s}),o]}),c]})}function dp({result:s}){const[o,c]=p.useState(!1);if(!s||s.status==null)return l.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const u=s.status==="pass",x=s.passRate??0,m=cp(u?"PASS":"FAIL",x);return l.jsxs("span",{className:"pill text-[10px]",style:{background:u?"var(--green-muted)":"var(--red-muted)",color:u?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),"aria-describedby":o?"verdict-tooltip":void 0,children:[s.passRate!=null?`${Math.round(s.passRate*100)}%`:s.status,o&&l.jsx("div",{id:"verdict-tooltip",role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,padding:"6px 10px",background:"var(--surface-4)",border:"1px solid var(--border-subtle)",borderRadius:6,fontSize:11,color:"var(--text-secondary)",whiteSpace:"nowrap",zIndex:50,maxWidth:300,width:"max-content",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:m.explanation})]})}function ly({passRate:s}){const o=Math.round(s*100);return l.jsx("div",{className:"flex items-center gap-1",children:l.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:l.jsx("div",{className:"h-full rounded-full",style:{width:`${o}%`,background:o>=80?"var(--green)":o>=50?"var(--yellow)":"var(--red)"}})})})}function ny({output:s,durationMs:o,tokens:c}){const[u,x]=p.useState(!1);return l.jsxs("div",{className:"mb-5",children:[l.jsxs("button",{onClick:()=>x(!u),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:u?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:l.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",o!=null&&l.jsxs("span",{style:{fontWeight:400},children:["(",(o/1e3).toFixed(1),"s)"]}),c!=null&&l.jsxs("span",{style:{fontWeight:400},children:["(",c," tokens)"]})]}),u&&l.jsx("pre",{className:"text-[12px] p-4 rounded-lg overflow-auto animate-fade-in",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:400,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s})]})}function ic(s){return s==="baseline"?"right":s==="comparison"?"full":"left"}function oc({entry:s}){return l.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[l.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:rp(s.timestamp)}),l.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:s.model}),l.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:s.type==="benchmark"?"rgba(99,131,255,0.15)":s.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:s.type==="benchmark"?"#6383ff":s.type==="comparison"?"var(--purple)":"#fb923c"},children:s.type}),l.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:pn(s.pass_rate)},children:[Math.round(s.pass_rate*100),"%"]})]}),l.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[s.durationMs!=null&&l.jsx("span",{children:ip(s.durationMs)}),s.tokens!=null&&l.jsxs("span",{children:[s.tokens>=1e3?`${(s.tokens/1e3).toFixed(1)}k`:s.tokens," tok"]})]}),s.type==="comparison"&&s.baselinePassRate!=null&&(()=>{const o=s.pass_rate-s.baselinePassRate,c=o>.001?"skill":o<-.001?"baseline":"tie",u=o>0?"+":"",x=c==="skill"?"var(--green)":c==="baseline"?"var(--red)":"var(--text-tertiary)";return l.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[l.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),l.jsxs("span",{className:"text-[11px] font-semibold",style:{color:o>=0?"var(--green)":"var(--red)"},children:[u,(o*100).toFixed(1),"%"]}),l.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"rgba(0,0,0,0.2)",color:x},children:c})]})})(),l.jsx("div",{className:"space-y-0.5",children:s.assertions.map(o=>l.jsxs("div",{className:"flex items-start gap-1.5",children:[l.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:o.pass?"var(--green-muted)":"var(--red-muted)"},children:o.pass?l.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})}):l.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),l.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:o.text})]},o.id))})]})}function sy({evalId:s,sharedEntries:o,sharedLoading:c}){const{state:u,dispatch:x}=Qt(),{plugin:v,skill:m}=u,[b,g]=p.useState(!0),f=o??null,j=c??!1,y=p.useCallback(()=>{g(_=>!_)},[]),k=f?f.slice(0,10):[],C=k.some(_=>{const G=ic(_.type);return G==="left"||G==="full"}),B=k.some(_=>{const G=ic(_.type);return G==="right"||G==="full"});return l.jsxs("div",{className:"mb-5",children:[l.jsxs("button",{onClick:y,className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:l.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",f&&f.length>0&&l.jsxs("span",{style:{fontWeight:400},children:["(",f.length," run",f.length!==1?"s":"",")"]})]}),b&&l.jsx("div",{className:"animate-fade-in",children:j?l.jsxs("div",{className:"flex items-center gap-2 py-3",children:[l.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),l.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!f||f.length===0?l.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):l.jsxs("div",{children:[k.length>=2&&l.jsx("div",{className:"mb-2",children:l.jsx(op,{entries:k})}),l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[l.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),l.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!C&&l.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!B&&l.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),k.map((_,G)=>{const D=ic(_.type);return D==="full"?l.jsx("div",{style:{gridColumn:"1 / -1"},children:l.jsx(oc,{entry:_})},G):D==="left"?l.jsxs(p.Fragment,{children:[l.jsx("div",{style:{gridColumn:"1"},children:l.jsx(oc,{entry:_})}),l.jsx("div",{style:{gridColumn:"2"}})]},G):l.jsxs(p.Fragment,{children:[l.jsx("div",{style:{gridColumn:"1"}}),l.jsx("div",{style:{gridColumn:"2"},children:l.jsx(oc,{entry:_})})]},G)})]}),l.jsx("button",{onClick:()=>x({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:_=>{_.currentTarget.style.textDecoration="underline"},onMouseLeave:_=>{_.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function Gx({evals:s,onSave:o,onCancel:c}){const[u,x]=p.useState(""),[v,m]=p.useState(""),[b,g]=p.useState(""),[f,j]=p.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[y,k]=p.useState("unit"),[C,B]=p.useState(""),[_,G]=p.useState([]),[D,X]=p.useState(""),[J,F]=p.useState(""),Y=Math.max(0,...s.evals.map(M=>M.id))+1,I=M=>{k(M),M==="unit"&&(G([]),B(""),X(""),F(""))},O=()=>{const M=C.trim().toUpperCase();M&&!_.includes(M)&&G([..._,M]),B("")},W=()=>{if(!u.trim()||!v.trim())return;const M={id:Y,name:u.trim(),prompt:v.trim(),expected_output:b.trim(),files:[],assertions:f.filter($=>$.text.trim()),...y==="integration"?{testType:"integration",..._.length>0?{requiredCredentials:_}:{},...D||J?{requirements:{...D?{platform:D}:{},...J?{chromeProfile:J}:{}}}:{}}:{}};o({...s,evals:[...s.evals,M]})};return l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center animate-overlay-in",style:{background:"rgba(0,0,0,0.6)"},children:l.jsxs("div",{className:"w-full max-w-lg rounded-xl p-6 animate-modal-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",maxHeight:"85vh",overflowY:"auto"},children:[l.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),l.jsxs("div",{className:"mb-3",children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),l.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(M=>l.jsx("button",{onClick:()=>I(M),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:y===M?M==="unit"?"rgba(99,131,255,0.2)":"rgba(251,146,60,0.2)":"transparent",color:y===M?M==="unit"?"#6383ff":"#fb923c":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:M},M))})]}),l.jsxs("label",{className:"block mb-3",children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),l.jsx("input",{value:u,onChange:M=>x(M.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),l.jsxs("label",{className:"block mb-3",children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),l.jsx("textarea",{value:v,onChange:M=>m(M.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),l.jsxs("label",{className:"block mb-3",children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),l.jsx("textarea",{value:b,onChange:M=>g(M.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),f.map((M,$)=>l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx("input",{value:M.text,onChange:P=>j(f.map((te,oe)=>oe===$?{...te,text:P.target.value}:te)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),f.length>1&&l.jsx("button",{onClick:()=>j(f.filter((P,te)=>te!==$)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},M.id)),l.jsx("button",{onClick:()=>j([...f,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),y==="integration"&&l.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"rgba(251,146,60,0.06)",border:"1px solid rgba(251,146,60,0.15)"},children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"#fb923c"},children:"Integration Settings"}),l.jsxs("div",{className:"mb-3",children:[l.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),l.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:_.map(M=>l.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:[M,l.jsx("button",{onClick:()=>G(_.filter($=>$!==M)),style:{color:"#fb923c",lineHeight:1},children:l.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},M))}),l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx("input",{value:C,onChange:M=>B(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),O())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),l.jsx("button",{onClick:O,className:"btn btn-ghost text-[11px]",style:{color:"#fb923c"},children:"Add"})]})]}),l.jsxs("label",{className:"block mb-3",children:[l.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),l.jsx("input",{value:D,onChange:M=>X(M.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),l.jsx("input",{value:J,onChange:M=>F(M.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:c,className:"btn btn-secondary text-[12px]",children:"Cancel"}),l.jsx("button",{onClick:W,disabled:!u.trim()||!v.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function ry({evalCase:s,onUpdate:o}){var m,b;const[c,u]=p.useState(""),x=()=>{const g=c.trim().toUpperCase();g&&!(s.requiredCredentials??[]).includes(g)&&o({...s,requiredCredentials:[...s.requiredCredentials??[],g]}),u("")},v=g=>{const f=(s.requiredCredentials??[]).filter(j=>j!==g);o({...s,requiredCredentials:f.length>0?f:void 0})};return l.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"rgba(251,146,60,0.06)",border:"1px solid rgba(251,146,60,0.15)"},children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"#fb923c"},children:"Integration Settings"}),l.jsxs("div",{className:"mb-2.5",children:[l.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),l.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(s.requiredCredentials??[]).map(g=>l.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:[g,l.jsx("button",{onClick:()=>v(g),style:{color:"#fb923c",lineHeight:1},children:l.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g))}),l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx("input",{value:c,onChange:g=>u(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),x())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),l.jsx("button",{onClick:x,className:"btn btn-ghost text-[11px]",style:{color:"#fb923c"},children:"Add"})]})]}),l.jsxs("div",{className:"mb-2.5",children:[l.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),l.jsx("input",{value:((m=s.requirements)==null?void 0:m.platform)??"",onChange:g=>o({...s,requirements:{...s.requirements,platform:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),l.jsx("input",{value:((b=s.requirements)==null?void 0:b.chromeProfile)??"",onChange:g=>o({...s,requirements:{...s.requirements,chromeProfile:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function $t(s,o){return o==="free"?"Free":o==="subscription"&&s==null?"Subscription":s==null?"N/A":s>=1?`$${s.toFixed(2)}`:s===0?"$0.00":s>=.001?`$${s.toFixed(4)}`:`$${s.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function fp(s,o){return s==null||o==null?"N/A":`${s.toLocaleString("en-US")} in / ${o.toLocaleString("en-US")} out`}function iy(s){return s==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function oy(s,o){let c="";if(o){const x=new Date(o);isNaN(x.getTime())||(c=x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[s,c].filter(Boolean).join(" · ")}function cy(s,o,c){const u=c===1?"test case":"test cases";if(s===0)return`Your skill performs the same as the baseline across ${c} ${u}`;const x=Math.round(Math.abs(s)*o);if(x===0)return`Your skill performs the same as the baseline across ${c} ${u}`;const v=s>0?"more":"fewer";return`Your skill passes ${x} ${v} assertions across ${c} ${u}`}function Yx(s,o){const c=u=>{const x=u/5*100;return isFinite(x)?Math.round(Math.min(100,Math.max(0,x))):0};return{skill:c(s),baseline:c(o)}}function uy(s){return s==="skill"?{text:"Skill wins",isSkill:!0}:s==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function dy(s,o){const c=s+o,u=c*10,x=c*25,v=m=>m>=60?`${Math.round(m/60)}m`:`${m}s`;return`${v(u)}–${v(x)}`}const fy={anthropic:.01,openrouter:.01,ollama:0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function xy(s,o){if(!s)return null;const c=fy[s];if(c==null||c===0)return null;const u=c*o*.5,x=c*o*2;return`${$t(u)}–${$t(x)}`}function py(){const{state:s,runCase:o,runAll:c,cancelCase:u,cancelAll:x,isReadOnly:v}=Qt(),{evals:m,caseRunStates:b,bulkRunActive:g,latestBenchmark:f,inlineResults:j}=s,{config:y}=il(),k=(m==null?void 0:m.evals)??[],C=p.useMemo(()=>{for(const O of b.values())if(O.status==="running"||O.status==="queued")return!0;return!1},[b]),B=k.filter(O=>{const W=b.get(O.id);return W&&(W.status==="complete"||W.status==="error"||W.status==="cancelled")}).length,_=k.filter(O=>{const W=b.get(O.id);return W&&(W.status==="running"||W.status==="queued")}).length,G=p.useRef(null),[D,X]=p.useState(0);p.useEffect(()=>{if(C&&!G.current&&(G.current=Date.now()),!C){G.current=null,X(0);return}const O=setInterval(()=>{G.current&&X(Math.round((Date.now()-G.current)/1e3))},1e3);return()=>clearInterval(O)},[C]);const J=k.reduce((O,W)=>O+W.assertions.length,0),F=k.length+J,Y=p.useMemo(()=>dy(k.length,J),[k.length,J]),I=p.useMemo(()=>xy((y==null?void 0:y.provider)??null,F),[y==null?void 0:y.provider,F]);return l.jsxs("div",{className:"p-5",children:[v&&l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-4 text-[11px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:[l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),l.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),l.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),C&&l.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[_," running"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[C&&l.jsxs("button",{onClick:x,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:[l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:l.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),l.jsx("button",{onClick:()=>c("comparison"),disabled:k.length===0||C||v,className:"btn btn-primary text-[12px]",title:"Runs both your skill and the baseline, then compares results side by side",children:"Run A/B Test"}),l.jsx("button",{onClick:()=>c("benchmark"),disabled:k.length===0||C||v,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),l.jsx("button",{onClick:()=>c("baseline"),disabled:k.length===0||C||v,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!C&&k.length>0&&l.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[l.jsxs("span",{children:["Est. duration: ",Y]}),I&&l.jsxs("span",{children:["Est. cost: ",I]}),!I&&(y==null?void 0:y.provider)&&(y.provider==="claude-cli"||y.provider==="codex-cli")&&l.jsx("span",{children:"Cost: Subscription"}),!I&&(y==null?void 0:y.provider)&&(y.provider==="ollama"||y.provider==="gemini-cli")&&l.jsx("span",{children:"Cost: Free"})]})]}),C&&k.length>0&&l.jsxs("div",{className:"mb-5",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",B,"/",k.length," cases"]}),l.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(B/k.length*100),"%"]})]}),l.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:l.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${B/k.length*100}%`,background:"var(--accent)"}})}),l.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[l.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",D>=60?`${Math.floor(D/60)}m ${D%60}s`:`${D}s`]}),l.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",Y]})]})]}),l.jsx("div",{className:"space-y-3 stagger-children",children:k.map(O=>{const W=j.get(O.id),M=b.get(O.id),$=(M==null?void 0:M.status)??"idle",P=f==null?void 0:f.cases.find(te=>te.eval_id===O.id);return l.jsx(hy,{name:O.name,evalId:O.id,result:W,caseCost:P==null?void 0:P.cost,caseBillingMode:P==null?void 0:P.billingMode,caseInputTokens:P==null?void 0:P.inputTokens,caseOutputTokens:P==null?void 0:P.outputTokens,caseStatus:$,runMode:(M==null?void 0:M.mode)??null,comparisonDetail:P==null?void 0:P.comparisonDetail,isReadOnly:v,onRun:te=>o(te,"benchmark"),onBaseline:te=>o(te,"baseline"),onCompare:te=>o(te,"comparison"),onCancel:te=>u(te)},O.id)})}),!C&&f&&f.cases.length>0&&l.jsxs("div",{className:"mt-5",children:[l.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:iy(f.type)}),l.jsx("span",{className:"text-[20px] font-bold",style:{color:(f.overall_pass_rate??0)>=.8?"var(--green)":(f.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:f.overall_pass_rate!=null?`${Math.round(f.overall_pass_rate*100)}%`:"--"})]}),f.totalDurationMs!=null&&l.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(f.totalDurationMs/1e3).toFixed(1),"s",f.model&&` | Model: ${f.model}`,f.totalInputTokens!=null&&f.totalOutputTokens!=null&&` | Tokens: ${fp(f.totalInputTokens,f.totalOutputTokens)}`,f.totalCost!=null&&` | Cost: ${$t(f.totalCost)}`]}),f.overall_pass_rate>=.9999&&!f.comparison&&l.jsx("button",{onClick:()=>c("comparison"),disabled:k.length===0||v,className:"text-[13px] font-semibold mt-3 w-full rounded-lg transition-opacity duration-150",style:{padding:"10px 0",background:"var(--green, #22c55e)",color:"#fff",border:"none",cursor:"pointer",opacity:k.length===0?.5:1},children:"Run Final A/B Comparison"})]}),f.comparison&&l.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[l.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const O=oy(f.model,f.timestamp);return O?l.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:O}):l.jsx("div",{className:"mb-3"})})(),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsx($x,{label:"Skill",value:f.comparison.skillPassRate,color:"var(--accent)"}),l.jsx($x,{label:"Baseline",value:f.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),l.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:f.comparison.delta>0?"var(--green)":f.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",f.comparison.delta>0?"+":"",(f.comparison.delta*100).toFixed(1),"%",f.verdict&&` | ${Wv(f.verdict)}`]}),(()=>{const O=f.cases.reduce((M,$)=>M+$.assertions.length,0),W=cy(f.comparison.delta,O,f.cases.length);return l.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:W})})()]})]})]})}const my={benchmark:{label:"Skill",bg:"var(--accent-muted)",color:"var(--accent)"},baseline:{label:"Baseline",bg:"var(--surface-3)",color:"var(--text-tertiary)"},comparison:{label:"Compare",bg:"rgba(168,85,247,0.12)",color:"rgb(168,85,247)"}};function hy({name:s,evalId:o,result:c,caseCost:u,caseBillingMode:x,caseInputTokens:v,caseOutputTokens:m,caseStatus:b,runMode:g,comparisonDetail:f,isReadOnly:j,onRun:y,onBaseline:k,onCompare:C,onCancel:B}){const[_,G]=p.useState(!1),D=b==="running"||b==="queued",X=b==="complete"||b==="error";return l.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:D?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:D?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[b==="running"&&l.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),b==="queued"&&l.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),l.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",o," ",s]}),g&&(D||X)&&(()=>{const J=my[g];return J?l.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:J.bg,color:J.color,padding:"1px 6px"},children:J.label}):null})()]}),l.jsxs("div",{className:"flex items-center gap-2",children:[D?l.jsx("button",{onClick:()=>B(o),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:"Cancel"}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>C(o),disabled:j,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),l.jsx("button",{onClick:()=>y(o),disabled:j,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),l.jsx("button",{onClick:()=>k(o),disabled:j,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),c&&c.status!=null&&l.jsx("span",{className:"pill text-[10px]",style:{background:c.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:c.status==="pass"?"var(--green)":"var(--red)"},children:c.passRate!=null?`${Math.round(c.passRate*100)}%`:c.status}),v!=null&&m!=null&&l.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:fp(v,m)}),u!=null&&l.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:$t(u,x)}),b==="cancelled"&&l.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),c&&c.assertions.length>0&&l.jsxs("div",{className:"px-4 pb-3",children:[l.jsx("div",{className:"space-y-1",children:c.assertions.map(J=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[l.jsx("span",{style:{color:J.pass?"var(--green)":"var(--red)"},children:J.pass?"PASS":"FAIL"}),l.jsx("span",{style:{color:"var(--text-secondary)"},children:J.text})]},J.assertion_id))}),c.output&&l.jsx("button",{onClick:()=>G(!_),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:_?"Hide output":"Show output"}),_&&c.output&&l.jsx("pre",{className:"text-[11px] mt-2 p-3 rounded-lg overflow-auto",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:200,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap"},children:c.output})]}),f&&l.jsx("div",{className:"px-4 pb-3",children:l.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:l.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const J=Yx(f.skillContentScore,f.baselineContentScore),F=Yx(f.skillStructureScore,f.baselineStructureScore),Y=uy(f.winner);return l.jsxs(l.Fragment,{children:[l.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",J.skill,"% / Baseline ",J.baseline,"%"]}),l.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),l.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",F.skill,"% / Baseline ",F.baseline,"%"]}),l.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),l.jsx("span",{style:{color:Y.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:Y.text})]})})()})})}),c&&c.errorMessage&&l.jsx(vy,{errorMessage:c.errorMessage,classifiedError:c.classifiedError})]})}const cc={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function vy({errorMessage:s,classifiedError:o}){const[c,u]=p.useState(!1),x=(o==null?void 0:o.title)??"Error",v=o==null?void 0:o.hint,m=o?cc[o.category]??cc.unknown:cc.unknown;return l.jsx("div",{className:"px-4 pb-3",children:l.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid rgba(239,68,68,0.2)"},children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[l.jsx("span",{style:{fontSize:12},children:m}),l.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:x}),l.jsx("button",{onClick:()=>u(!c),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:c?"Hide details":"Details"})]}),v&&l.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:v}),c&&l.jsx("pre",{className:"text-[10px] px-3 pb-2.5 overflow-auto",style:{color:"var(--text-tertiary)",maxHeight:120,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:s})]})})}function $x({label:s,value:o,color:c}){return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:s}),l.jsxs("span",{className:"text-[12px] font-semibold",style:{color:c},children:[Math.round(o*100),"%"]})]}),l.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:l.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${o*100}%`,background:c}})})]})}const Qx={TP:{bg:"var(--green-muted)",text:"var(--green)"},TN:{bg:"rgba(52,211,153,0.06)",text:"rgba(52,211,153,0.6)"},FP:{bg:"var(--red-muted)",text:"var(--red)"},FN:{bg:"rgba(248,113,113,0.06)",text:"rgba(248,113,113,0.6)"}};function yy(){const{state:s,dispatch:o,runActivationTest:c,cancelActivation:u,generateActivationPrompts:x}=Qt(),{plugin:v,skill:m,activationPrompts:b,activationResults:g,activationSummary:f,activationRunning:j,activationError:y,activationStartedAt:k,activationClassifyingStatus:C,generatingPrompts:B,generatingPromptsError:_,activationHistory:G}=s,[D,X]=p.useState(b),[J,F]=p.useState(null),[Y,I]=p.useState(!1);p.useEffect(()=>{b&&b!==D&&X(b)},[b]),p.useEffect(()=>{o({type:"SET_ACTIVATION_PROMPTS",prompts:D})},[D,o]),p.useEffect(()=>{fetch(`/api/skills/${v}/${m}/description`).then(w=>w.json()).then(w=>F(w.rawContent||w.description||null)).catch(()=>F(null))},[v,m]);function O(){c(D)}function W(){x(8)}const M=D.trim().split(`
|
|
63
|
-
`).filter(Boolean).length,$=g.filter(w=>w.classification==="TP"||w.classification==="TN"),P=g.filter(w=>w.classification==="FP"||w.classification==="FN"),te=(J==null?void 0:J.replace(/^---[\s\S]*?---\s*/,"").trim())??null,oe=D.trim().length>0,ne=te?Or(te):"";return l.jsxs("div",{className:"p-5 space-y-5",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),l.jsx("div",{className:"text-[12px] mt-0.5",style:{color:"var(--text-tertiary)"},children:"Test whether this skill's description activates for relevant prompts and stays silent for irrelevant ones."})]}),l.jsxs("div",{className:"grid grid-cols-[3fr_2fr] gap-4 items-stretch",children:[l.jsxs("div",{className:"glass-card p-4 flex flex-col gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Test Prompts"}),l.jsx("div",{className:"flex gap-1.5",children:l.jsx("button",{onClick:W,disabled:B||!te||j,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:B?"var(--surface-3)":"var(--surface-2)",color:te?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:te?1:.5,cursor:te?"pointer":"not-allowed"},title:te?void 0:"No skill description available",onMouseEnter:w=>{te&&!B&&(w.currentTarget.style.background="var(--surface-3)")},onMouseLeave:w=>{B||(w.currentTarget.style.background="var(--surface-2)")},children:B?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"spinner",style:{borderTopColor:"var(--accent)",borderColor:"var(--border-subtle)",width:10,height:10}}),"Generating..."]}):l.jsxs(l.Fragment,{children:[l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M12 3v3m6.36.64l-2.12 2.12M21 12h-3m-.64 6.36l-2.12-2.12M12 21v-3m-4.24.64l2.12-2.12M3 12h3m.64-6.36l2.12 2.12"})}),oe?"Regenerate":"Generate"," Test Prompts"]})})})]}),!te&&!j&&l.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},"aria-live":"polite",children:"Add a description to your skill's frontmatter to enable prompt generation."}),_&&l.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:_}),l.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:D,onChange:w=>X(w.target.value),placeholder:`How do I write a unit test?
|
|
64
|
-
What edge cases should I test?
|
|
65
|
-
+Deploy this to production
|
|
66
|
-
!What's the weather like today?
|
|
67
|
-
!Write me a poem about flowers`}),l.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[l.jsx("span",{children:"One prompt per line"}),l.jsx(Ar,{}),l.jsx("span",{children:"No prefix = auto-classify"}),l.jsx(Ar,{}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),l.jsx(Ar,{}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),l.jsx(Ar,{}),l.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[M," prompt",M!==1?"s":""]})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{onClick:O,disabled:j||!D.trim(),className:"btn btn-primary",children:j?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"spinner",style:{borderTopColor:"#fff",borderColor:"rgba(255,255,255,0.2)",width:14,height:14}}),"Testing..."]}):l.jsxs(l.Fragment,{children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("circle",{cx:"12",cy:"12",r:"6"}),l.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),j&&l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:u,className:"btn btn-secondary text-[12px]",children:"Cancel"}),l.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[C||`${g.length} / ${M} prompts tested`,k&&l.jsx(Sy,{startedAt:k})]})]})]})]}),l.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[l.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),l.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:te?l.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:ne}}):l.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),y&&l.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:y}),j&&g.length===0&&l.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[l.jsx("div",{className:"spinner-lg mx-auto mb-4"}),l.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),g.length>0&&l.jsxs("div",{className:"space-y-5",children:[P.length>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),l.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),l.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",P.length,")"]}),l.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),l.jsx("div",{className:"space-y-1.5 stagger-children",children:P.map((w,S)=>l.jsx(Xx,{result:w},`incorrect-${S}`))})]}),$.length>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("polyline",{points:"16 10 11 15 8 12"})]}),l.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",$.length,")"]})]}),l.jsx("div",{className:"space-y-1.5 stagger-children",children:$.map((w,S)=>l.jsx(Xx,{result:w},`correct-${S}`))})]})]}),f&&l.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[l.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),f.autoClassifiedCount!=null&&f.autoClassifiedCount>0&&l.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[f.autoClassifiedCount," of ",f.total," prompts auto-classified from skill name and tags"]}),l.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[l.jsx(uc,{label:"Precision",value:f.precision,description:"Of all activations, how many were correct?",detail:`${f.tp} true / ${f.tp+f.fp} total activations`}),l.jsx(uc,{label:"Recall",value:f.recall,description:"Of expected activations, how many fired?",detail:`${f.tp} activated / ${f.tp+f.fn} expected`}),l.jsx(uc,{label:"Reliability",value:f.reliability,description:"Overall correct classification rate",detail:`${f.tp+f.tn} correct / ${f.total} total`})]}),l.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[l.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[l.jsx(Rr,{label:"True Positive",abbr:"TP",count:f.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),l.jsx(Rr,{label:"False Positive",abbr:"FP",count:f.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),l.jsx(Rr,{label:"False Negative",abbr:"FN",count:f.fn,bg:"rgba(248,113,113,0.06)",color:"rgba(248,113,113,0.6)",description:"Missed activation"}),l.jsx(Rr,{label:"True Negative",abbr:"TN",count:f.tn,bg:"rgba(52,211,153,0.06)",color:"rgba(52,211,153,0.6)",description:"Correctly silent"})]})]})]}),l.jsx(gy,{history:G,expanded:Y,onToggle:()=>I(!Y)})]})}function gy({history:s,expanded:o,onToggle:c}){return s===null?null:l.jsxs("div",{className:"glass-card overflow-hidden",children:[l.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:o?"1px solid var(--border-subtle)":"none"},onClick:c,children:[l.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",s.length>0&&l.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",s.length," run",s.length!==1?"s":"",")"]})]}),l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:o?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:l.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),o&&l.jsx("div",{className:"px-4 py-3",children:s.length===0?l.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):l.jsx("div",{className:"space-y-2",children:s.map(u=>l.jsx(by,{run:u},u.id))})})]})}function by({run:s}){const o=Math.round(s.summary.reliability*100),c=o>=80?"var(--green)":o>=60?"var(--yellow)":"var(--red)",u=o>=80?"Good":o>=60?"Needs Work":"Poor",x=c;return l.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[l.jsx("div",{className:"flex-1 min-w-0",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:jy(s.timestamp)}),l.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:s.model||s.provider}),l.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[s.promptCount," prompts"]})]})}),l.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[l.jsxs("span",{className:"text-[12px] font-semibold",style:{color:c,fontVariantNumeric:"tabular-nums"},children:[o,"%"]}),l.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:x,background:`color-mix(in srgb, ${x} 10%, transparent)`},children:u})]})]})}function jy(s){const o=Date.now(),c=new Date(s).getTime(),u=Math.floor((o-c)/1e3);if(u<60)return"just now";const x=Math.floor(u/60);if(x<60)return`${x}m ago`;const v=Math.floor(x/60);if(v<24)return`${v}h ago`;const m=Math.floor(v/24);return m<7?`${m}d ago`:new Date(s).toLocaleDateString()}function Ar(){return l.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Xx({result:s}){const o=Qx[s.classification]||Qx.FN,c=s.classification==="TP"||s.classification==="TN";return l.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:o.bg,border:"1px solid transparent"},children:[l.jsx("div",{className:"flex-shrink-0 mt-0.5",children:l.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${o.text} 20%, transparent)`},children:c?l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:o.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})}):l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:o.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"flex items-center gap-2 mb-1",children:l.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:s.prompt})}),l.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[l.jsx("span",{className:"pill",style:{background:"rgba(0,0,0,0.1)",color:o.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:s.classification}),l.jsx("span",{style:{color:s.activate?"var(--green)":"var(--text-tertiary)"},children:s.activate?"Activated":"Silent"}),l.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",s.expected==="should_activate"?"activate":"stay silent"]}),l.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[s.confidence," confidence"]}),s.autoClassified&&l.jsx("span",{className:"pill",style:{background:"rgba(139,92,246,0.1)",color:"rgba(139,92,246,0.8)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),s.reasoning&&l.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:s.reasoning})]})]})}function uc({label:s,value:o,description:c,detail:u}){const x=Math.round(o*100),v=x>=80?"var(--green)":x>=60?"var(--yellow)":"var(--red)";return l.jsxs("div",{className:"text-center",children:[l.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:v},children:[x,"%"]}),l.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:s}),l.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:c}),l.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:u})]})}function Rr({abbr:s,count:o,bg:c,color:u,description:x}){return l.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:c},children:[l.jsx("div",{className:"text-[20px] font-bold",style:{color:u},children:o}),l.jsx("div",{className:"text-[11px] font-semibold",style:{color:u},children:s}),l.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:x})]})}function Sy({startedAt:s}){const[o,c]=p.useState(0);return p.useEffect(()=>{const u=setInterval(()=>c(Math.floor((Date.now()-s)/1e3)),1e3);return()=>clearInterval(u)},[s]),l.jsxs("span",{className:"ml-2",children:["(",o,"s)"]})}const dc={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Kx={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},yc=600,gc=180,Et=40,fc=yc-Et*2,sl=gc-Et*2,Ny=[25,50,75,100];function Zx(s){return new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function ky(s){return s==null?"--":`${(s/1e3).toFixed(1)}s`}function Ey({entries:s,onPointClick:o}){const[c,u]=p.useState(null),x=p.useMemo(()=>[...s].reverse(),[s]);if(x.length<2)return null;const v=x.length,m=x.map((f,j)=>{const y=Et+j/(v-1)*fc,k=f.passRate*100,C=Et+sl-k/100*sl;return{x:y,y:C,pct:k,entry:f}}),b=m.map(f=>`${f.x},${f.y}`).join(" "),g=Array.from(new Set(x.map(f=>f.type)));return l.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:v>=20?"auto":void 0},children:[l.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),l.jsx("div",{className:"flex items-center gap-5 mb-3",children:g.map(f=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:dc[f]??"var(--text-tertiary)"}}),l.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Kx[f]??f})]},f))}),l.jsxs("svg",{width:yc,height:gc,viewBox:`0 0 ${yc} ${gc}`,style:{display:"block",overflow:"visible"},children:[Ny.map(f=>{const j=Et+sl-f/100*sl;return l.jsxs("g",{children:[l.jsx("line",{x1:Et,y1:j,x2:Et+fc,y2:j,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),l.jsxs("text",{x:Et-8,y:j+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[f,"%"]})]},f)}),l.jsx("line",{x1:Et,y1:Et+sl,x2:Et+fc,y2:Et+sl,stroke:"var(--border-subtle)",strokeWidth:1}),l.jsx("text",{x:Et-8,y:Et+sl+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),l.jsx("polyline",{points:b,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),m.map((f,j)=>l.jsx("circle",{cx:f.x,cy:f.y,r:5,fill:dc[f.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:y=>{y.currentTarget.setAttribute("r","7"),u({x:f.x,y:f.y,entry:f.entry})},onMouseLeave:y=>{y.currentTarget.setAttribute("r","5"),u(null)},onClick:()=>o==null?void 0:o(f.entry)},j)),Cy(v).map(f=>l.jsx("text",{x:m[f].x,y:Et+sl+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Zx(x[f].timestamp)},f))]}),c&&l.jsxs("div",{style:{position:"absolute",left:c.x,top:c.y-12,transform:"translate(-50%, -100%)",background:"var(--surface-3)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"8px 12px",pointerEvents:"none",zIndex:10,whiteSpace:"nowrap"},children:[l.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:Zx(c.entry.timestamp)}),l.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:c.entry.model}),l.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[l.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:dc[c.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Kx[c.entry.type]??c.entry.type}),l.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(c.entry.passRate*100),"%"]})]}),l.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[l.jsx("span",{children:ky(c.entry.totalDurationMs)}),l.jsx("span",{children:c.entry.totalTokens!=null?`${c.entry.totalTokens} tokens`:"--"})]})]})]})}function Cy(s){if(s<=3)return Array.from({length:s},(u,x)=>x);if(s<=6)return[0,Math.floor(s/2),s-1];if(s<20)return[0,Math.floor(s/3),Math.floor(2*s/3),s-1];const o=Math.ceil(s/10),c=[0];for(let u=o;u<s-1;u+=o)c.push(u);return c.push(s-1),c}const cs=new Map;let Ct=null,_r=null,Mr=1e3,us=0;function xp(){if(Ct)return;Ct=new EventSource("/api/events");const s=o=>c=>{let u={};try{u=c.data?JSON.parse(c.data):{}}catch{}const x=cs.get(o);if(x)for(const v of x)v(u)};Ct.addEventListener("benchmark:complete",s("benchmark:complete")),Ct.addEventListener("history:written",s("history:written")),Ct.addEventListener("leaderboard:updated",s("leaderboard:updated")),Ct.onerror=()=>{Ct==null||Ct.close(),Ct=null,us>0&&(_r=setTimeout(()=>{Mr=Math.min(Mr*2,3e4),xp()},Mr))},Ct.onopen=()=>{Mr=1e3}}function wy(){_r!=null&&(clearTimeout(_r),_r=null),Ct==null||Ct.close(),Ct=null}function Ty(s,o){return cs.has(s)||cs.set(s,new Set),cs.get(s).add(o),us++,xp(),()=>{var c;(c=cs.get(s))==null||c.delete(o),us--,us<=0&&(us=0,wy())}}function zr(s,o){const c=p.useRef(o);c.current=o,p.useEffect(()=>Ty(s,x=>c.current(x)),[s])}const Lr=new Map,Cl=new Map,ds=new Map;function ps(s){Lr.delete(s),Cl.delete(s);const o=ds.get(s);if(o)for(const c of o)c()}function Ur(s,o,c={}){const{ttl:u=3e4,enabled:x=!0}=c,[,v]=p.useState(0),m=p.useRef(!0),b=p.useRef(s);b.current=s;const g=()=>ps(s);p.useEffect(()=>(m.current=!0,()=>{m.current=!1}),[]),p.useEffect(()=>{if(!x)return;const k=()=>{m.current&&v(C=>C+1)};return ds.has(s)||ds.set(s,new Set),ds.get(s).add(k),()=>{var C;(C=ds.get(s))==null||C.delete(k)}},[s,x]),p.useEffect(()=>{if(!x)return;const k=Lr.get(s);if(!(!k||Date.now()-k.fetchedAt>u))return;if(Cl.has(s)){const G=Cl.get(s),D=()=>{m.current&&b.current===s&&v(X=>X+1)};G.subscribers.push(D);return}const B={promise:Promise.resolve(),subscribers:[]},_=o().then(G=>{Lr.set(s,{data:G,fetchedAt:Date.now()}),Cl.delete(s),m.current&&b.current===s&&v(D=>D+1);for(const D of B.subscribers)D()},G=>{Cl.delete(s),m.current&&b.current===s&&v(D=>D+1);for(const D of B.subscribers)D();throw G});B.promise=_,Cl.set(s,B)},[s,o,u,x]);const f=Lr.get(s),j=x&&!f&&Cl.has(s);return{data:f==null?void 0:f.data,loading:j||x&&!f,error:void 0,revalidate:g}}function Dr(s){return s>=.8?"var(--green)":s>=.5?"var(--yellow)":"var(--red)"}function Ay(s){return s>=1e3?`${(s/1e3).toFixed(1)}s`:`${Math.round(s)}ms`}function Ry({rate:s,label:o}){const c=Math.round(s*100);return l.jsx("div",{className:"flex items-center gap-3",children:l.jsxs("div",{className:"flex-1",children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:o}),l.jsxs("span",{className:"text-[11px] font-semibold",style:{color:Dr(s)},children:[c,"%"]})]}),l.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:l.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${c}%`,background:Dr(s)}})})]})})}function My({points:s}){if(s.length<2)return null;const o=200,c=48,u=4,x=s.length,v=s.map((g,f)=>{const j=u+f/(x-1)*(o-u*2),y=u+(c-u*2)-g.passRate*(c-u*2);return{x:j,y}}),m=`M ${v[0].x},${c-u} `+v.map(g=>`L ${g.x},${g.y}`).join(" ")+` L ${v[v.length-1].x},${c-u} Z`,b=v.map((g,f)=>`${f===0?"M":"L"} ${g.x},${g.y}`).join(" ");return l.jsxs("svg",{width:o,height:c,style:{display:"block"},children:[l.jsx("path",{d:m,fill:"var(--accent-muted)"}),l.jsx("path",{d:b,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),l.jsx("circle",{cx:v[v.length-1].x,cy:v[v.length-1].y,r:3,fill:"var(--accent)"})]})}function _y({plugin:s,skill:o}){const c=`stats/${s}/${o}`,u=p.useCallback(()=>me.getStats(s,o),[s,o]),{data:x,loading:v}=Ur(c,u),m=p.useCallback(()=>ps(c),[c]);if(zr("benchmark:complete",m),zr("history:written",m),v)return l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"skeleton h-24 rounded-xl"}),l.jsx("div",{className:"skeleton h-48 rounded-xl"}),l.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!x||x.totalRuns===0)return l.jsxs("div",{className:"text-center py-12",children:[l.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:l.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[l.jsx("path",{d:"M18 20V10"}),l.jsx("path",{d:"M12 20V4"}),l.jsx("path",{d:"M6 20v-6"})]})}),l.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),l.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const b=x.trendPoints.length>0?x.trendPoints[x.trendPoints.length-1].passRate:0,g=x.trendPoints.length>0?x.trendPoints[0].passRate:0,f=b-g,j=x.assertionStats.slice(0,10);return l.jsxs("div",{className:"space-y-4 stagger-children",children:[l.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[l.jsxs("div",{className:"glass-card p-4",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),l.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:x.totalRuns})]}),l.jsxs("div",{className:"glass-card p-4",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),l.jsxs("div",{className:"text-[24px] font-bold",style:{color:Dr(b)},children:[Math.round(b*100),"%"]})]}),l.jsxs("div",{className:"glass-card p-4",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),l.jsxs("div",{className:"text-[24px] font-bold",style:{color:f>=0?"var(--green)":"var(--red)"},children:[f>=0?"+":"",Math.round(f*100),"%"]})]}),l.jsxs("div",{className:"glass-card p-4",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),l.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:x.modelStats.length})]}),x.totalCost!=null&&l.jsxs("div",{className:"glass-card p-4",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Cost"}),l.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:$t(x.totalCost)})]}),x.costPerRun!=null&&l.jsxs("div",{className:"glass-card p-4",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Avg Cost/Run"}),l.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:$t(x.costPerRun)})]})]}),x.trendPoints.length>=2&&l.jsxs("div",{className:"glass-card p-5",children:[l.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),l.jsx(My,{points:x.trendPoints})]}),x.modelStats.length>0&&l.jsxs("div",{className:"glass-card p-5",children:[l.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),l.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[l.jsx("thead",{children:l.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[l.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),l.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),l.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),l.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"}),l.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),l.jsx("tbody",{children:x.modelStats.map(y=>l.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[l.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:y.model}),l.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:y.runs}),l.jsx("td",{style:{padding:"8px",textAlign:"center"},children:l.jsxs("span",{className:"font-semibold",style:{color:Dr(y.avgPassRate)},children:[Math.round(y.avgPassRate*100),"%"]})}),l.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:Ay(y.avgDurationMs)}),l.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:y.avgCost!=null?$t(y.avgCost):"N/A"})]},y.model))})]})]}),j.length>0&&l.jsxs("div",{className:"glass-card p-5",children:[l.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),l.jsx("div",{className:"space-y-3",children:j.map(y=>l.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--surface-2)"},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},onClick:()=>{},children:[l.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[l.jsxs("span",{className:"text-[10px] font-mono px-1 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",y.evalId]}),l.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:y.evalName}),l.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[y.totalRuns," runs"]})]}),l.jsx(Ry,{rate:y.passRate,label:y.text})]},`${y.evalId}:${y.id}`))})]})]})}function Ly({plugin:s,skill:o}){const[c,u]=p.useState(null),[x,v]=p.useState(null),[m,b]=p.useState({}),[g,f]=p.useState({});p.useEffect(()=>{me.getEvals(s,o).then(u).catch(()=>u(null))},[s,o]);async function j(y){if(x===y){v(null);return}if(v(y),!m[y]){f(k=>({...k,[y]:!0}));try{const k=await me.getCaseHistory(s,o,y);b(C=>({...C,[y]:k}))}catch{b(k=>({...k,[y]:[]}))}finally{f(k=>({...k,[y]:!1}))}}}return c?l.jsx("div",{className:"space-y-2 stagger-children",children:c.evals.map(y=>{const k=m[y.id]||[],C=x===y.id,B=g[y.id],_=k.length>0?k[0].pass_rate:null;return l.jsxs("div",{className:"glass-card overflow-hidden",children:[l.jsxs("button",{onClick:()=>j(y.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:C?"var(--surface-2)":"transparent"},onMouseEnter:G=>{C||(G.currentTarget.style.background="var(--surface-2)")},onMouseLeave:G=>{C||(G.currentTarget.style.background="transparent")},children:[l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:C?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:l.jsx("polyline",{points:"9 18 15 12 9 6"})}),l.jsxs("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",y.id]}),l.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:y.name}),k.length>=2&&l.jsx(op,{entries:k}),_!=null&&l.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:pn(_)},children:[Math.round(_*100),"%"]}),k.length>0&&l.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[k.length," runs"]})]}),C&&l.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:B?l.jsxs("div",{className:"p-4 flex items-center gap-2",children:[l.jsx("div",{className:"spinner",style:{width:14,height:14}}),l.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):k.length===0?l.jsx("div",{className:"p-4",children:l.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):l.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:k.map((G,D)=>l.jsxs("div",{className:"p-4",style:{background:D===0?"var(--surface-2)":"transparent"},children:[l.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[l.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:rp(G.timestamp)}),l.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:G.model}),l.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:G.type==="benchmark"?"rgba(99,131,255,0.15)":G.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:G.type==="benchmark"?"#6383ff":G.type==="comparison"?"var(--purple)":"#fb923c"},children:G.type}),l.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:pn(G.pass_rate)},children:[Math.round(G.pass_rate*100),"%"]})]}),l.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[G.durationMs!=null&&l.jsx("span",{children:ip(G.durationMs)}),G.tokens!=null&&l.jsxs("span",{children:[G.tokens>=1e3?`${(G.tokens/1e3).toFixed(1)}k`:G.tokens," tok"]})]}),l.jsx("div",{className:"space-y-1",children:G.assertions.map(X=>l.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[l.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:X.pass?"var(--green)":"var(--red)"},children:l.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:X.pass?l.jsx("polyline",{points:"20 6 9 17 4 12"}):l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:X.text}),X.reasoning&&l.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:X.reasoning})]})]},X.id))})]},D))})})]},y.id)})}):l.jsx("div",{className:"text-center py-12",children:l.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function zy(){const{state:s,dispatch:o}=Qt(),{plugin:c,skill:u}=s,[x,v]=p.useState("timeline"),[m,b]=p.useState(""),[g,f]=p.useState(""),[j,y]=p.useState(!1),[k,C]=p.useState([]),[B,_]=p.useState(null),[G,D]=p.useState(!1),[X,J]=p.useState(null),[F,Y]=p.useState(!1),I=`history/${c}/${u}?model=${m}&type=${g}`,O=p.useCallback(()=>me.getHistory(c,u,{model:m||void 0,type:g||void 0}),[c,u,m,g]),{data:W,loading:M}=Ur(I,O),$=W??[];p.useEffect(()=>{!W||W.length<2||me.compareRuns(c,u,W[0].timestamp,W[1].timestamp).then(w=>{const S=w.regressions.filter(A=>A.change==="regression");o({type:"SET_REGRESSIONS",regressions:S})}).catch(()=>{})},[W,c,u,o]);const P=p.useCallback(()=>ps(I),[I]);zr("history:written",P);const te=p.useCallback(async w=>{if(j){C(S=>S.includes(w)?S.filter(A=>A!==w):S.length>=2?[S[1],w]:[...S,w]);return}Y(!0);try{const S=await me.getHistoryEntry(c,u,w);J(S)}catch{}finally{Y(!1)}},[c,u,j]),oe=p.useCallback(async()=>{if(k.length===2){D(!0);try{const w=await me.compareRuns(c,u,k[0],k[1]);_(w)}catch{}finally{D(!1)}}},[c,u,k]),ne=[...new Set($.map(w=>w.model))];return M?l.jsxs("div",{className:"p-5",children:[l.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),l.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"skeleton h-12 rounded-lg"}),l.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):l.jsxs("div",{className:"p-5",children:[l.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(w=>l.jsx("button",{onClick:()=>v(w),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:x===w?"var(--accent-muted)":"transparent",color:x===w?"var(--accent)":"var(--text-tertiary)"},children:w==="timeline"?"Timeline":w==="per-eval"?"Per Eval":"Statistics"},w))}),x==="timeline"&&l.jsxs("div",{children:[$.length>0&&l.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:l.jsx(Ey,{entries:$,onPointClick:w=>te(w.timestamp)})}),l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsxs("select",{value:m,onChange:w=>b(w.target.value),className:"input-field text-[12px]",style:{width:150},children:[l.jsx("option",{value:"",children:"All Models"}),ne.map(w=>l.jsx("option",{value:w,children:w},w))]}),l.jsxs("select",{value:g,onChange:w=>f(w.target.value),className:"input-field text-[12px]",style:{width:150},children:[l.jsx("option",{value:"",children:"All Types"}),l.jsx("option",{value:"benchmark",children:"Benchmark"}),l.jsx("option",{value:"comparison",children:"Comparison"}),l.jsx("option",{value:"baseline",children:"Baseline"}),l.jsx("option",{value:"model-compare",children:"Model Compare"}),l.jsx("option",{value:"improve",children:"AI Improve"}),l.jsx("option",{value:"instruct",children:"AI Edit"}),l.jsx("option",{value:"ai-generate",children:"AI Generate"}),l.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{y(!j),C([]),_(null)},className:`btn text-[12px] ${j?"btn-primary":"btn-secondary"}`,children:j?"Exit Compare":"Compare Runs"}),j&&k.length===2&&l.jsx("button",{onClick:oe,disabled:G,className:"btn btn-primary text-[12px]",children:G?"Comparing...":"Compare"})]}),l.jsx("div",{className:"space-y-2",children:$.length===0?l.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):$.map(w=>{const S=k.includes(w.timestamp);return l.jsx("button",{onClick:()=>te(w.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:S?"var(--accent-muted)":"var(--surface-1)",border:S?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:A=>{S||(A.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:A=>{S||(A.currentTarget.style.borderColor="var(--border-subtle)")},children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[j&&l.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:S?"var(--accent)":"var(--border-default)",background:S?"var(--accent)":"transparent"},children:S&&l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})})}),l.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(w.timestamp).toLocaleString()}),l.jsx("span",{className:"pill text-[9px]",style:{background:w.type==="comparison"?"var(--purple-muted)":w.type==="baseline"?"var(--surface-3)":w.type==="model-compare"?"rgba(56,189,248,0.15)":w.type==="improve"||w.type==="instruct"?"rgba(168,85,247,0.15)":w.type==="ai-generate"?"rgba(34,197,94,0.15)":w.type==="eval-generate"?"rgba(251,146,60,0.15)":"var(--accent-muted)",color:w.type==="comparison"?"var(--purple)":w.type==="baseline"?"var(--text-tertiary)":w.type==="model-compare"?"#38bdf8":w.type==="improve"||w.type==="instruct"?"#a855f7":w.type==="ai-generate"?"#22c55e":w.type==="eval-generate"?"#fb923c":"var(--accent)"},children:w.type==="model-compare"?"model compare":w.type==="improve"?"ai improve":w.type==="instruct"?"ai edit":w.type==="ai-generate"?"ai generate":w.type==="eval-generate"?"eval generate":w.type})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:w.model}),w.totalCost!=null&&w.totalCost>0&&l.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:$t(w.totalCost)}),l.jsxs("span",{className:"text-[12px] font-semibold",style:{color:w.passRate>=.8?"var(--green)":w.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(w.passRate*100),"%"]})]})]})},w.timestamp)})}),B&&l.jsx(Dy,{result:B}),X&&!j&&l.jsx(Oy,{run:X,onClose:()=>J(null)})]}),x==="per-eval"&&l.jsx(Ly,{plugin:c,skill:u}),x==="statistics"&&l.jsx(_y,{plugin:c,skill:u})]})}function Dy({result:s}){const o=s.regressions.filter(u=>u.change==="regression"),c=s.regressions.filter(u=>u.change==="improvement");return l.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(s.runA.timestamp).toLocaleDateString()," vs ",new Date(s.runB.timestamp).toLocaleDateString()]}),(s.runA.totalCost!=null||s.runB.totalCost!=null)&&l.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[l.jsxs("span",{children:["Run A cost: ",$t(s.runA.totalCost??null)]}),l.jsxs("span",{children:["Run B cost: ",$t(s.runB.totalCost??null)]}),s.runA.totalCost!=null&&s.runB.totalCost!=null&&l.jsxs("span",{style:{color:s.runB.totalCost<=s.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",$t(s.runB.totalCost-s.runA.totalCost)]})]}),o.length>0&&l.jsxs("div",{className:"mb-3",children:[l.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",o.length,")"]}),o.map(u=>l.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",u.evalId," ",u.evalName,": ",l.jsx("span",{style:{color:"var(--red)"},children:u.assertionId})," (was passing, now failing)"]},`${u.evalId}-${u.assertionId}`))]}),c.length>0&&l.jsxs("div",{className:"mb-3",children:[l.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",c.length,")"]}),c.map(u=>l.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",u.evalId," ",u.evalName,": ",l.jsx("span",{style:{color:"var(--green)"},children:u.assertionId})," (was failing, now passing)"]},`${u.evalId}-${u.assertionId}`))]}),l.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),l.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:l.jsxs("table",{className:"w-full text-[12px]",children:[l.jsx("thead",{children:l.jsxs("tr",{style:{background:"var(--surface-2)"},children:[l.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),l.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),l.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),l.jsx("tbody",{children:s.caseDiffs.map(u=>l.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[l.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",u.eval_id," ",u.eval_name]}),l.jsx("td",{className:"text-right px-3 py-2",style:{color:u.passRateA!=null?u.passRateA>=.8?"var(--green)":u.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:u.passRateA!=null?`${Math.round(u.passRateA*100)}%`:u.statusA}),l.jsx("td",{className:"text-right px-3 py-2",style:{color:u.passRateB!=null?u.passRateB>=.8?"var(--green)":u.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:u.passRateB!=null?`${Math.round(u.passRateB*100)}%`:u.statusB})]},u.eval_id))})]})})]})}function Oy({run:s,onClose:o}){return(s.type==="improve"||s.type==="instruct")&&s.improve?l.jsx(By,{run:s,onClose:o}):l.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(s.timestamp).toLocaleString()]}),l.jsx("button",{onClick:o,className:"btn btn-ghost text-[11px]",children:"Close"})]}),l.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",s.model," | Cases: ",s.cases.length," | Pass Rate: ",s.overall_pass_rate!=null?`${Math.round(s.overall_pass_rate*100)}%`:"--",s.totalCost!=null&&s.totalCost>0&&` | Cost: ${$t(s.totalCost)}`]}),l.jsx("div",{className:"space-y-2",children:s.cases.map(c=>l.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",c.eval_id," ",c.eval_name]}),l.jsxs("div",{className:"flex items-center gap-2",children:[c.cost!=null&&c.cost>0&&l.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:$t(c.cost)}),l.jsx("span",{className:"text-[11px] font-semibold",style:{color:c.status==="pass"?"var(--green)":"var(--red)"},children:c.pass_rate!=null?`${Math.round(c.pass_rate*100)}%`:c.status})]})]})},c.eval_id))})]})}function By({run:s,onClose:o}){var v;const c=p.useMemo(()=>s.improve?Br(s.improve.original,s.improve.improved):[],[s.improve]),u=p.useMemo(()=>{const m=c.filter(g=>g.type==="added").length,b=c.filter(g=>g.type==="removed").length;return{added:m,removed:b}},[c]),x=p.useMemo(()=>{let m=0,b=0;return c.map(g=>g.type==="removed"?(m++,{...g,origNum:m,newNum:null}):g.type==="added"?(b++,{...g,origNum:null,newNum:b}):(m++,b++,{...g,origNum:m,newNum:b}))},[c]);return l.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),l.jsx("path",{d:"M2 17l10 5 10-5"}),l.jsx("path",{d:"M2 12l10 5 10-5"})]})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),l.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(s.timestamp).toLocaleString()," · ",s.model]})]})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[l.jsxs("span",{style:{color:"var(--green)"},children:["+",u.added]}),l.jsxs("span",{style:{color:"var(--red)"},children:["-",u.removed]})]}),l.jsx("button",{onClick:o,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:m=>{m.currentTarget.style.background="var(--surface-3)"},onMouseLeave:m=>{m.currentTarget.style.background="transparent"},children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((v=s.improve)==null?void 0:v.reasoning)&&l.jsxs("div",{className:"mx-4 mt-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.06)",border:"1px solid rgba(168,85,247,0.15)",color:"var(--text-secondary)"},children:[l.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),s.improve.reasoning]}),l.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:l.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:l.jsx("tbody",{children:x.map((m,b)=>l.jsxs("tr",{style:{background:m.type==="added"?"rgba(34,197,94,0.08)":m.type==="removed"?"rgba(239,68,68,0.08)":"transparent"},children:[l.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:m.type==="removed"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:m.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:m.origNum??""}),l.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:m.type==="added"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:m.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:m.newNum??""}),l.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:m.type==="added"?"var(--green)":m.type==="removed"?"var(--red)":"transparent",borderRight:m.type==="added"?"2px solid var(--green)":m.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:m.type==="added"?"+":m.type==="removed"?"-":" "}),l.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:m.type==="added"?"var(--green)":m.type==="removed"?"var(--red)":"var(--text-secondary)"},children:m.content||""})]},b))})})})]})}function Uy({plugin:s,skill:o}){const[c,u]=p.useState([]),[x,v]=p.useState([]),[m,b]=p.useState(!0),[g,f]=p.useState(null);p.useEffect(()=>{me.getDependencies(s,o).then(y=>{u(y.mcpDependencies),v(y.skillDependencies)}).catch(()=>{}).finally(()=>b(!1))},[s,o]);async function j(y,k){try{await navigator.clipboard.writeText(k),f(y),setTimeout(()=>f(null),2e3)}catch{}}return m?null:c.length===0&&x.length===0?l.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:"No dependencies detected"}):l.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[l.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[l.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),l.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),l.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),l.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:c.length+x.length})]}),l.jsxs("div",{className:"px-5 py-4",children:[c.length>0&&l.jsxs("div",{className:"space-y-3 mb-4",children:[l.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),c.map(y=>l.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:y.server}),l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:y.transport})]}),l.jsx("button",{onClick:()=>j(y.server,y.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:g===y.server?"var(--green)":"var(--accent)"},children:g===y.server?l.jsxs(l.Fragment,{children:[l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):l.jsxs(l.Fragment,{children:[l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})," Copy Config"]})})]}),l.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:y.url}),l.jsx("div",{className:"flex flex-wrap gap-1.5",children:y.matchedTools.map(k=>l.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:k},k))})]},y.server))]}),x.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),l.jsx("div",{className:"space-y-1.5",children:x.map(y=>l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),l.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:y.name}),l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:y.source==="frontmatter"?"frontmatter":"referenced"})]},y.name))})]})]})]})}function Jx({plugin:s,skill:o}){const[c,u]=p.useState([]),[x,v]=p.useState(!0),[m,b]=p.useState(null),[g,f]=p.useState(""),[j,y]=p.useState(!1),[k,C]=p.useState(null),[B,_]=p.useState(""),[G,D]=p.useState(""),[X,J]=p.useState(!1),[F,Y]=p.useState(new Set),I=p.useCallback(async()=>{v(!0);try{const[$,P]=await Promise.all([me.getCredentials(s,o).catch(()=>({credentials:[]})),me.getParams(s,o).catch(()=>({params:[]}))]),te=new Map(P.params.map(w=>[w.name,w])),oe=new Set,ne=[];for(const w of $.credentials){oe.add(w.name);const S=te.get(w.name);ne.push({name:w.name,status:w.status==="ready"||w.status==="resolved"?"ready":"missing",source:w.source,maskedValue:S==null?void 0:S.maskedValue})}for(const w of P.params)oe.has(w.name)||ne.push({name:w.name,status:w.status,maskedValue:w.maskedValue});u(ne)}finally{v(!1)}},[s,o]);p.useEffect(()=>{I()},[I]);const O=p.useCallback(async $=>{if(F.has($)){Y(P=>{const te=new Set(P);return te.delete($),te}),u(P=>P.map(te=>te.name===$?{...te,revealedValue:void 0}:te));return}try{const te=(await me.getParamsRevealed(s,o,$)).params.find(oe=>oe.name===$);te&&(u(oe=>oe.map(ne=>ne.name===$?{...ne,revealedValue:te.value}:ne)),Y(oe=>new Set(oe).add($)))}catch{}},[s,o,F]),W=async($,P)=>{if(!(!$.trim()||!P.trim())){y(!0),C(null);try{await me.setCredential(s,o,$,P),b(null),f(""),Y(new Set),I()}catch(te){C(te.message)}finally{y(!1)}}},M=async()=>{if(!(!B.trim()||!G.trim())){y(!0),C(null);try{await me.setCredential(s,o,B.trim().toUpperCase(),G),_(""),D(""),J(!1),I()}catch($){C($.message)}finally{y(!1)}}};return x?l.jsxs("div",{className:"mt-6",children:[l.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),l.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):l.jsxs("div",{className:"mt-6",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),l.jsx("button",{onClick:()=>J(!X),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),k&&l.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--error-muted, #3f1a1a)",color:"var(--error, #f87171)"},children:k}),c.length===0&&!X?l.jsx("div",{className:"text-[12px] text-center py-6 rounded-xl",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"No credentials configured for this skill"}):l.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:c.map($=>l.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[l.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:$.name}),$.maskedValue&&l.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:F.has($.name)&&$.revealedValue!=null?$.revealedValue:$.maskedValue}),$.maskedValue&&l.jsx("button",{onClick:()=>O($.name),className:"btn btn-ghost px-1",title:F.has($.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:F.has($.name)?l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),l.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),l.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),l.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),l.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:$.status==="ready"?"rgba(52,211,153,0.15)":"rgba(251,146,60,0.15)",color:$.status==="ready"?"var(--green)":"#fb923c"},children:$.status==="ready"?"ready":"missing"}),$.source&&l.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:$.source}),m===$.name?l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("input",{value:g,onChange:P=>f(P.target.value),onKeyDown:P=>{P.key==="Enter"&&W($.name,g)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),l.jsx("button",{onClick:()=>W($.name,g),disabled:j||!g.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:j?"...":"Save"}),l.jsx("button",{onClick:()=>{b(null),f("")},className:"btn btn-ghost text-[10px] px-1",children:l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):l.jsx("button",{onClick:()=>{b($.name),f("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},$.name))}),X&&l.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx("input",{value:B,onChange:$=>_($.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),l.jsx("input",{value:G,onChange:$=>D($.target.value),onKeyDown:$=>{$.key==="Enter"&&M()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),l.jsxs("div",{className:"flex justify-end gap-1.5",children:[l.jsx("button",{onClick:()=>{J(!1),_(""),D("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),l.jsx("button",{onClick:M,disabled:j||!B.trim()||!G.trim(),className:"btn btn-primary text-[10px]",children:j?"Saving...":"Save"})]})]})]})}function Hy(){const{state:s}=Qt(),{plugin:o,skill:c}=s,[u,x]=p.useState(null),[v,m]=p.useState(!0);return p.useEffect(()=>{me.getDependencies(o,c).then(x).catch(()=>{}).finally(()=>m(!1))},[o,c]),v?l.jsxs("div",{className:"p-5",children:[l.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),l.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):u?l.jsxs("div",{className:"p-5 max-w-3xl",children:[l.jsx(Uy,{plugin:o,skill:c}),l.jsx(Jx,{plugin:o,skill:c})]}):l.jsxs("div",{className:"p-5 max-w-3xl",children:[l.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),l.jsx(Jx,{plugin:o,skill:c})]})}function pp({data:s}){if(s.length<2)return l.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const o=s.slice(-10),c=80,u=24,x=2,v=c-x*2,m=u-x*2,b=o.length,g=Math.min(...o),j=Math.max(...o)-g||1,y=o.map((B,_)=>{const G=x+_/(b-1)*v,D=x+m-(B-g)/j*m;return`${G.toFixed(1)},${D.toFixed(1)}`}),k=o[o.length-1],C=pn(k);return l.jsxs("svg",{width:c,height:u,viewBox:`0 0 ${c} ${u}`,style:{display:"block"},children:[l.jsx("polyline",{points:y.join(" "),fill:"none",stroke:C,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[B,_]=y[y.length-1].split(",");return l.jsx("circle",{cx:B,cy:_,r:2.5,fill:C})})()]})}function Vy(){return l.jsxs("span",{className:"pill",style:{background:"rgba(251,191,36,0.15)",color:"#fbbf24",fontSize:9,fontWeight:700,gap:3},children:[l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"#fbbf24",stroke:"none",children:l.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),"Best Model"]})}function qy({pct:s}){const o=s>=10?"var(--green)":s>=0?"var(--yellow)":"var(--red)",c=s>=10?"var(--green-muted)":s>=0?"var(--yellow-muted)":"var(--red-muted)",u=s>=0?"+":"";return l.jsxs("span",{className:"pill",style:{background:c,color:o,fontSize:10,fontWeight:600},children:[u,s.toFixed(1),"%"]})}function Gy({score:s,rating:o}){const c={excellent:{bg:"var(--green-muted)",fg:"var(--green)"},good:{bg:"var(--green-muted)",fg:"var(--green)"},marginal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},minimal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},harmful:{bg:"var(--red-muted)",fg:"var(--red)"}},u=c[o]??c.minimal,x=s>=0?"+":"";return l.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[l.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),l.jsxs("span",{className:"pill",style:{background:u.bg,color:u.fg,fontSize:11,fontWeight:600},children:[x,s.toFixed(1),"% (",o.toUpperCase(),")"]})]})}function Yy({warning:s}){return l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-3",style:{background:"var(--yellow-muted)",border:"1px solid rgba(251,191,36,0.3)"},children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),l.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),l.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),l.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:s})]})}function $y({active:s,onChange:o,hasBaseline:c}){return l.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[l.jsx("button",{onClick:()=>o("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:s==="rankings"?"var(--surface-3)":"transparent",color:s==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),l.jsx("button",{onClick:()=>o("amplification"),disabled:!c,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:s==="amplification"?"var(--surface-3)":"transparent",color:c&&s==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:c?1:.5,cursor:c?"pointer":"not-allowed"},title:c?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function Qy(s){var u,x,v;if(s.length===0)return[];const o=new Map;for(const m of s)for(const b of m.models){if(b.status==="error")continue;const g=`${b.provider}/${b.model}`;o.has(g)||o.set(g,{provider:b.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const f=o.get(g);f.passRates.push(b.passRate.mean),f.lastRubric=((u=b.rubricScore)==null?void 0:u.mean)??null,f.lastDuration=b.duration.mean,f.lastCost=((x=b.cost)==null?void 0:x.total)??null,f.lastCompositeScore=b.compositeScore,b.baselinePassRate!=null&&(f.lastBaselinePassRate=b.baselinePassRate.mean,f.lastSkillDelta=(v=b.skillDelta)==null?void 0:v.mean,f.lastAmplificationPct=b.amplificationPct,f.hasBaseline=!0)}const c=[];for(const[m,b]of o){const[g,...f]=m.split("/");c.push({rank:0,model:f.join("/"),provider:g,passRate:b.passRates[b.passRates.length-1],rubricScore:b.lastRubric,duration:b.lastDuration,cost:b.lastCost,sparklineData:b.passRates,isBest:!1,baselinePassRate:b.lastBaselinePassRate,skillDelta:b.lastSkillDelta,amplificationPct:b.lastAmplificationPct,compositeScore:b.lastCompositeScore,hasBaseline:b.hasBaseline})}return c.sort((m,b)=>{const g=m.compositeScore??m.passRate;return(b.compositeScore??b.passRate)-g}),c.forEach((m,b)=>{m.rank=b+1}),c.length>0&&(c[0].isBest=!0),c}const mp=(s="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:s,whiteSpace:"nowrap"});function Xy({entries:s}){return l.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:l.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[l.jsx("thead",{children:l.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(o=>l.jsx("th",{style:mp(o==="#"?"center":"left"),children:o},o))})}),l.jsx("tbody",{children:s.map(o=>l.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:c=>{c.currentTarget.style.background="var(--surface-2)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:[l.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o.rank}),l.jsx("td",{style:{padding:"10px 12px"},children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:o.model}),l.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:o.provider}),o.isBest&&l.jsx(Vy,{})]})}),l.jsx("td",{style:{padding:"10px 12px"},children:l.jsxs("span",{className:"pill",style:{background:o.passRate>=.7?"var(--green-muted)":o.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:pn(o.passRate),fontSize:11,fontWeight:600},children:[Math.round(o.passRate*100),"%"]})}),l.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:o.rubricScore!=null?o.rubricScore.toFixed(1):"--"}),l.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:o.duration<1e3?`${Math.round(o.duration)}ms`:`${(o.duration/1e3).toFixed(1)}s`}),l.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:o.cost!=null?`$${o.cost.toFixed(4)}`:"N/A"}),l.jsx("td",{style:{padding:"10px 12px"},children:l.jsx(pp,{data:o.sparklineData})})]},`${o.provider}/${o.model}`))})]})})}function Ky({entries:s}){const o=[...s].filter(c=>c.hasBaseline).sort((c,u)=>(u.amplificationPct??0)-(c.amplificationPct??0));return o.length===0?l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx("div",{className:"text-center",children:l.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",l.jsx("code",{children:"--baseline"})," flag."]})})}):l.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:l.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[l.jsx("thead",{children:l.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(c=>l.jsx("th",{style:mp(c==="#"?"center":"left"),children:c},c))})}),l.jsx("tbody",{children:o.map((c,u)=>l.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:x=>{x.currentTarget.style.background="var(--surface-2)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:[l.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:u+1}),l.jsx("td",{style:{padding:"10px 12px"},children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:c.model}),l.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:c.provider})]})}),l.jsx("td",{style:{padding:"10px 12px"},children:l.jsxs("span",{className:"pill",style:{background:c.passRate>=.7?"var(--green-muted)":c.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:pn(c.passRate),fontSize:11,fontWeight:600},children:[Math.round(c.passRate*100),"%"]})}),l.jsx("td",{style:{padding:"10px 12px"},children:c.baselinePassRate!=null?l.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(c.baselinePassRate*100),"%"]}):"--"}),l.jsx("td",{style:{padding:"10px 12px"},children:c.skillDelta!=null?l.jsxs("span",{className:"text-[11px] font-medium",style:{color:c.skillDelta>=0?"var(--green)":"var(--red)"},children:[c.skillDelta>=0?"+":"",(c.skillDelta*100).toFixed(1),"pp"]}):"--"}),l.jsx("td",{style:{padding:"10px 12px"},children:c.amplificationPct!=null&&isFinite(c.amplificationPct)?l.jsx(qy,{pct:c.amplificationPct}):"--"}),l.jsx("td",{style:{padding:"10px 12px"},children:l.jsx(pp,{data:c.sparklineData})})]},`${c.provider}/${c.model}`))})]})})}function Zy(){const{state:s}=Qt(),{plugin:o,skill:c}=s,[u,x]=p.useState("rankings"),v=`leaderboard/${o}/${c}`,m=p.useCallback(()=>me.getLeaderboard(o,c),[o,c]),{data:b,loading:g,error:f}=Ur(v,m),j=(b==null?void 0:b.entries)??[],y=(f==null?void 0:f.message)??null;p.useEffect(()=>{x("rankings")},[o,c]);const k=p.useCallback(()=>ps(v),[v]);zr("leaderboard:updated",k);const C=p.useMemo(()=>Qy(j),[j]),B=C.some(D=>D.hasBaseline),_=j[0],G=_==null?void 0:_.judgeBiasWarning;return g?l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx("div",{className:"spinner spinner-lg"})}):y?l.jsx("div",{className:"flex items-center justify-center h-full px-8",children:l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Failed to load leaderboard"}),l.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:y})]})}):C.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[l.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M18 20V10"}),l.jsx("path",{d:"M12 20V4"}),l.jsx("path",{d:"M6 20v-6"})]})}),l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),l.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),l.jsx("div",{className:"text-[11px] font-mono px-4 py-3 rounded-lg text-left",style:{background:"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:'vskill eval sweep --models "anthropic/claude-sonnet-4,openrouter/meta-llama/llama-3.1-70b" --judge "anthropic/claude-sonnet-4"'}),l.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",l.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):l.jsxs("div",{className:"p-5 animate-fade-in",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),l.jsx($y,{active:u,onChange:x,hasBaseline:B})]}),l.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[j.length," sweep",j.length!==1?"s":""," · ",C.length," model",C.length!==1?"s":""]})]}),G&&l.jsx(Yy,{warning:G}),u==="rankings"?l.jsx(Xy,{entries:C}):l.jsx(Ky,{entries:C}),u==="amplification"&&(_==null?void 0:_.skillQualityScore)!=null&&(_==null?void 0:_.skillQualityRating)&&l.jsx(Gy,{score:_.skillQualityScore,rating:_.skillQualityRating})]})}function Jy(s){if(!s)return[];const o=s.split(`
|
|
68
|
-
`),c=[];for(const u of o)if(!(u.startsWith("--- ")||u.startsWith("+++ "))){if(u.startsWith("@@")){c.push({type:"header",content:u});continue}if(u.startsWith("+")){c.push({type:"add",content:u.slice(1)});continue}if(u.startsWith("-")){c.push({type:"remove",content:u.slice(1)});continue}(u.startsWith(" ")||u===""&&c.length>0)&&c.push({type:"context",content:u.startsWith(" ")?u.slice(1):""})}return c}function hp({contentDiff:s,fromLabel:o,toLabel:c,diffSummary:u,maxHeight:x=480,collapsible:v=!1,renderContext:m="inline",onRetry:b}){const[g,f]=p.useState(v),[j,y]=p.useState("unified"),k=p.useRef(null),C=p.useRef(null),B=p.useMemo(()=>Jy(s),[s]),_=p.useMemo(()=>{const Y=B.filter(O=>O.type==="add").length,I=B.filter(O=>O.type==="remove").length;return{added:Y,removed:I}},[B]),G=p.useMemo(()=>{let Y=0,I=0;return B.filter(O=>O.type!=="header").map(O=>O.type==="remove"?(Y++,{...O,origNum:Y,newNum:null}):O.type==="add"?(I++,{...O,origNum:null,newNum:I}):(Y++,I++,{...O,origNum:Y,newNum:I}))},[B]),D=p.useMemo(()=>{const Y=[],I=[];for(const O of G)if(O.type==="remove")Y.push(O);else if(O.type==="add")I.push(O);else{for(;Y.length<I.length;)Y.push({type:"context",content:"",origNum:null,newNum:null});for(;I.length<Y.length;)I.push({type:"context",content:"",origNum:null,newNum:null});Y.push(O),I.push(O)}for(;Y.length<I.length;)Y.push({type:"context",content:"",origNum:null,newNum:null});for(;I.length<Y.length;)I.push({type:"context",content:"",origNum:null,newNum:null});return{left:Y,right:I}},[G]),X=p.useCallback(Y=>{const I=Y==="left"?k.current:C.current,O=Y==="left"?C.current:k.current;I&&O&&(O.scrollTop=I.scrollTop)},[]);if(!s||B.length===0)return l.jsxs("div",{className:"rounded-lg p-6 text-center",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[l.jsx("div",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"Unable to load diff. Try again."}),b&&l.jsx("button",{onClick:b,className:"btn btn-secondary text-[12px]",children:"Retry"})]});const J=m==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",F=l.jsxs("div",{className:"rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:[o," → ",c]}),l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[l.jsxs("span",{style:{color:"var(--green)"},children:["+",_.added]}),l.jsxs("span",{style:{color:"var(--red)"},children:["-",_.removed]})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>y(j==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:j==="unified"?"Side-by-side":"Unified"}),v&&l.jsx("button",{onClick:()=>f(!g),className:"btn btn-ghost text-[11px]",children:g?"Expand":"Collapse"})]})]}),u&&l.jsx("div",{className:"mx-4 mt-3 px-4 py-2 rounded-lg text-[12px]",style:{background:"var(--accent-muted)",color:"var(--text-secondary)"},children:u}),!g&&(j==="unified"?l.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:x,overflowY:"auto"},children:l.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:l.jsx("tbody",{children:G.map((Y,I)=>l.jsxs("tr",{style:{background:Y.type==="add"?"rgba(34,197,94,0.08)":Y.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[l.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:Y.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:Y.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:Y.origNum??""}),l.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:Y.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:Y.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:Y.newNum??""}),l.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:Y.type==="add"?"var(--green)":Y.type==="remove"?"var(--red)":"transparent",borderRight:Y.type==="add"?"2px solid var(--green)":Y.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:Y.type==="add"?"+":Y.type==="remove"?"-":" "}),l.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:Y.type==="add"?"var(--green)":Y.type==="remove"?"var(--red)":"var(--text-secondary)"},children:Y.content||""})]},I))})})}):l.jsxs("div",{className:"mx-4 my-4 grid grid-cols-2 gap-0 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:[l.jsx("div",{ref:k,style:{maxHeight:x,overflowY:"auto",borderRight:"1px solid var(--border-subtle)"},onScroll:()=>X("left"),children:l.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:l.jsx("tbody",{children:D.left.map((Y,I)=>l.jsxs("tr",{style:{background:Y.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[l.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:Y.origNum??""}),l.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:Y.type==="remove"?"var(--red)":"var(--text-secondary)"},children:Y.content||""})]},I))})})}),l.jsx("div",{ref:C,style:{maxHeight:x,overflowY:"auto"},onScroll:()=>X("right"),children:l.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:l.jsx("tbody",{children:D.right.map((Y,I)=>l.jsxs("tr",{style:{background:Y.type==="add"?"rgba(34,197,94,0.08)":"transparent"},children:[l.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:Y.newNum??""}),l.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:Y.type==="add"?"var(--green)":"var(--text-secondary)"},children:Y.content||""})]},I))})})})]}))]});return m==="modal"?l.jsx("div",{className:J,children:l.jsx("div",{style:{width:"80%",maxWidth:900},children:F})}):F}const Wx={CERTIFIED:{bg:"rgba(212,160,23,0.15)",text:"#d4a017"},VERIFIED:{bg:"rgba(59,130,246,0.15)",text:"#3b82f6"},COMMUNITY:{bg:"var(--surface-3)",text:"var(--text-tertiary)"}};function Wy(s,o){return s?s.length>o?s.slice(0,o)+"…":s:""}function Fy(){const{state:s}=Qt(),{plugin:o,skill:c}=s,{refreshSkills:u,updateCount:x}=pa(),v=`versions/${o}/${c}`,m=p.useCallback(()=>me.getSkillVersions(o,c),[o,c]),{data:b,loading:g}=Ur(v,m),[f,j]=p.useState(null),[y,k]=p.useState(null),[C,B]=p.useState(null),[_,G]=p.useState(!1),[D,X]=p.useState("idle"),[J,F]=p.useState(null),Y=p.useRef(null),I=p.useRef(null),O=p.useMemo(()=>(b==null?void 0:b.find(ne=>ne.isInstalled))??null,[b]),W=p.useMemo(()=>(b==null?void 0:b[0])??null,[b]),M=O&&W&&O.version!==W.version,$=p.useCallback(ne=>{f?!y&&ne!==f?k(ne):(j(ne),k(null),B(null)):(j(ne),B(null))},[f,y]),P=p.useCallback(async(ne,w)=>{G(!0);try{const S=await me.getVersionDiff(o,c,ne,w);B(S)}catch{B(null)}finally{G(!1)}},[o,c]);p.useEffect(()=>{if(f&&y){const ne=b||[],w=ne.findIndex(V=>V.version===f),S=ne.findIndex(V=>V.version===y),[A,le]=w>S?[f,y]:[y,f];P(A,le)}},[f,y,b,P]);const te=p.useCallback(()=>{!O||!W||(j(O.version),k(W.version))},[O,W]),oe=p.useCallback(()=>{X("updating"),F(null);const ne=me.startSkillUpdate(o,c);Y.current=ne,ne.addEventListener("progress",w=>{try{switch(JSON.parse(w.data).status){case"scanning":X("scanning");break;case"installing":X("installing");break;case"done":X("done");break}}catch{X("error"),F("Unexpected response from server")}}),ne.addEventListener("done",()=>{ne.close(),Y.current=null,u(),ps(v),X("done")}),ne.addEventListener("error",w=>{const S=w;let A="Connection lost";if(S.data)try{A=JSON.parse(S.data).error||"Update failed"}catch{}X("error"),F(A),ne.close(),Y.current=null})},[o,c,v,u]);return p.useEffect(()=>()=>{Y.current&&(Y.current.close(),Y.current=null)},[]),g?l.jsxs("div",{className:"p-5",children:[l.jsx("div",{className:"skeleton h-5 w-40 mb-4"}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"skeleton h-14 rounded-lg"}),l.jsx("div",{className:"skeleton h-14 rounded-lg"}),l.jsx("div",{className:"skeleton h-14 rounded-lg"})]})]}):!b||b.length===0?l.jsx("div",{className:"flex flex-col items-center justify-center h-full py-16",children:l.jsx("div",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No version history available"})}):l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Version History"}),l.jsxs("div",{className:"flex items-center gap-2",children:[M&&l.jsx("button",{onClick:te,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),M&&D!=="done"&&(D==="error"?l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:J||"Update failed"}),l.jsx("button",{onClick:oe,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):l.jsx("button",{onClick:oe,disabled:D!=="idle",className:"btn btn-primary text-[11px]",children:D==="idle"?`Update to ${W==null?void 0:W.version}`:D==="updating"?"Starting update...":D==="scanning"?"Scanning...":"Installing..."})),x>1&&l.jsxs("button",{onClick:()=>{window.location.hash="#/updates"},className:"text-[11px] hover:underline",style:{color:"var(--text-tertiary)",background:"transparent",border:"none",cursor:"pointer"},children:["Manage all updates (",x,")"]})]})]}),f&&!y&&l.jsxs("div",{className:"text-[11px] mb-3 px-3 py-2 rounded-lg",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:["Click another version to compare with ",f]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),l.jsx("div",{className:"space-y-1",children:b.map(ne=>{const w=Wx[ne.certTier]||Wx.COMMUNITY,S=ne.version===f||ne.version===y,A=ne.isInstalled;return l.jsxs("button",{onClick:()=>$(ne.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:S?"var(--accent-muted)":"transparent",border:S?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:le=>{S||(le.currentTarget.style.background="var(--surface-1)")},onMouseLeave:le=>{S||(le.currentTarget.style.background="transparent")},children:[l.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:A?10:8,height:A?10:8,background:A?"var(--accent)":"var(--surface-3)",border:A?"2px solid var(--accent)":"2px solid var(--border-default)"}}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:ne.version}),l.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:w.bg,color:w.text},children:ne.certTier}),A&&l.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:"installed"})]}),l.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:new Date(ne.createdAt).toLocaleDateString()})]}),ne.diffSummary&&l.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:Wy(ne.diffSummary,80)})]},ne.version)})}),l.jsx("div",{ref:I,style:{height:1}})]}),_&&l.jsx("div",{className:"mt-4",children:l.jsx("div",{className:"skeleton h-48 rounded-xl"})}),C&&!_&&l.jsx("div",{className:"mt-4",children:l.jsx(hp,{contentDiff:C.contentDiff,fromLabel:C.from,toLabel:C.to,diffSummary:C.diffSummary,renderContext:"inline",onRetry:()=>f&&y&&P(C.from,C.to)})})]})}const Iy=["editor","tests","run","activation","history","leaderboard","deps","versions"];function Py(s){return s!=null&&Iy.includes(s)}function e1(){var y;const{state:s,dispatch:o,saveContent:c,isReadOnly:u}=Qt(),{state:x,refreshSkills:v,clearSelection:m}=pa(),b=p.useCallback(async()=>{try{await me.deleteSkill(s.plugin,s.skill),v(),m()}catch(k){const C=k instanceof Error?k.message:String(k);o({type:"SET_ERROR",error:`Failed to delete skill: ${C}`})}},[s.plugin,s.skill,v,m,o]);p.useEffect(()=>{const C=new URLSearchParams(window.location.search).get("panel");Py(C)&&C!==s.activePanel&&o({type:"SET_PANEL",panel:C})},[]),p.useEffect(()=>{const k=new URLSearchParams(window.location.search);k.set("panel",s.activePanel);const C=`${window.location.pathname}?${k.toString()}${window.location.hash}`;history.replaceState(null,"",C)},[s.activePanel]);const g=p.useCallback(k=>{const C=k.ctrlKey||k.metaKey;if(C&&k.key>="1"&&k.key<="8"){k.preventDefault(),o({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps","versions"][parseInt(k.key)-1]});return}if(C&&k.key==="s"&&!k.shiftKey){k.preventDefault(),s.isDirty&&c();return}},[s.isDirty,c,o]);if(p.useEffect(()=>(window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)),[g]),s.loading)return l.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:l.jsxs("div",{className:"flex flex-col items-center gap-3",children:[l.jsx("div",{className:"spinner spinner-lg"}),l.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const f=Array.from(s.caseRunStates.values()).some(k=>k.status==="running"||k.status==="queued"),j=((y=x.skills.find(k=>k.skill===s.skill&&k.plugin===s.plugin))==null?void 0:y.updateAvailable)??!1;return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[l.jsx(mv,{state:s,isReadOnly:u,onDelete:u?void 0:b}),s.error&&l.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:l.jsx(fs,{error:Sv(s.error),onDismiss:()=>o({type:"SET_ERROR",error:null})})}),l.jsx(bv,{activePanel:s.activePanel,onPanelChange:k=>o({type:"SET_PANEL",panel:k}),isDirty:s.isDirty,isRunning:f,hasRegressions:s.regressions.length>0,isActivationRunning:s.activationRunning,hasUpdate:j}),l.jsx(jv,{children:l.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:l.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[s.activePanel==="editor"&&l.jsx(Kv,{}),s.activePanel==="tests"&&l.jsx(ey,{}),s.activePanel==="run"&&l.jsx(py,{}),s.activePanel==="activation"&&l.jsx(yy,{}),s.activePanel==="history"&&l.jsx(zy,{}),s.activePanel==="leaderboard"&&l.jsx(Zy,{}),s.activePanel==="deps"&&l.jsx(Hy,{}),s.activePanel==="versions"&&l.jsx(Fy,{})]},s.activePanel)})},`${s.plugin}/${s.skill}`)]})}function t1(s){const o={prompt:s.prompt,provider:s.provider,model:s.model};return s.targetAgents&&s.targetAgents.length>0&&(o.targetAgents=s.targetAgents),o}function bc(s,o=!0){let c=s.toLowerCase().replace(/[^a-z0-9]+/g,"-");return o&&(c=c.replace(/^-+|-+$/g,"")),c}function a1(s,o,c,u){const v=`.../${s.split("/").slice(-2).join("/")}`;switch(o){case 1:return`${v}/${c}/skills/${u}/SKILL.md`;case 2:return`${v}/plugins/${c}/skills/${u}/SKILL.md`;case 3:return`${v}/skills/${u}/SKILL.md`}}function l1({onCreated:s,resolveAiConfigOverride:o}){const[c,u]=p.useState("ai"),[x,v]=p.useState(null),[m,b]=p.useState(!0),{config:g}=il(),[f,j]=p.useState(""),[y,k]=p.useState(3),[C,B]=p.useState(""),[_,G]=p.useState(""),[D,X]=p.useState(""),[J,F]=p.useState(""),[Y,I]=p.useState(""),[O,W]=p.useState(""),[M,$]=p.useState("write"),[P,te]=p.useState([]),[oe,ne]=p.useState(!1),[w,S]=p.useState(null),[A,le]=p.useState(""),[V,ue]=p.useState(!1),[N,H]=p.useState(!1),[ae,se]=p.useState(null),[fe,xe]=p.useState(null),[ye,Ge]=p.useState([]),ze=p.useRef(null),ft=p.useRef(null),Nt=p.useRef(null),ee=p.useRef(null),[re,ie]=p.useState(!1),[he,be]=p.useState(!1);p.useEffect(()=>{me.getProjectLayout().then(Se=>{v(Se),k(Se.suggestedLayout);const tt=Se.detectedLayouts.find(At=>At.layout===Se.suggestedLayout);tt!=null&&tt.existingPlugins.length&&B(tt.existingPlugins[0])}).catch(()=>{}).finally(()=>b(!1))},[]),p.useEffect(()=>{var Se;c==="ai"&&((Se=ze.current)==null||Se.focus())},[c]),p.useEffect(()=>()=>{var Se;(Se=ft.current)==null||Se.abort()},[]);const Ye=p.useMemo(()=>{var Se;return x?((Se=x.detectedLayouts.find(tt=>tt.layout===y))==null?void 0:Se.existingPlugins)||[]:[]},[x,y]),Qe=C==="__new__"?_:C,ut=x?a1(x.root,y,Qe||"{plugin}",f||"{skill}"):"",ca=p.useMemo(()=>x?x.detectedLayouts.filter(Se=>Se.layout!==4):[],[x]),Je=p.useMemo(()=>{if(!x)return null;const Se=x.detectedLayouts.find($e=>$e.layout===2&&$e.existingPlugins.length>0),tt=x.detectedLayouts.find($e=>$e.layout===1&&$e.existingPlugins.length>0),At=Se||tt;return At?{layout:At.layout,plugins:At.existingPlugins}:null},[x]),wt=p.useCallback(()=>{if(o)return o();if(!g)return{provider:"claude-cli",model:"sonnet"};const Se=g.provider||"claude-cli",tt=g.model||"sonnet";return{provider:Se,model:tt}},[g,o]),Xt=p.useCallback(()=>{var Se;(Se=ft.current)==null||Se.abort(),ue(!1)},[]),Fe=p.useCallback(()=>{se(null),xe(null)},[]),Tt=p.useCallback(async()=>{if(se(null),xe(null),Ge([]),Nt.current=null,!A.trim()){se("Describe what your skill should do");return}ue(!0);const Se=new AbortController;ft.current=Se;const{provider:tt,model:At}=wt();try{const $e=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t1({prompt:A.trim(),provider:tt,model:At,targetAgents:P})),signal:Se.signal});if(!$e.ok||!$e.body){let We=`HTTP ${$e.status}`;try{const na=await $e.json();na.error&&(We=na.error)}catch{}throw new Error(We)}const mn=$e.body.getReader(),ma=new TextDecoder;let at="",Ie="";for(;;){const{done:We,value:na}=await mn.read();if(We)break;at+=ma.decode(na,{stream:!0});const ol=at.split(`
|
|
69
|
-
`);at=ol.pop()||"";for(const sa of ol)if(sa.startsWith("event: "))Ie=sa.slice(7).trim();else if(sa.startsWith("data: ")){try{const Ee=JSON.parse(sa.slice(6));if(Ie==="progress")Ge(xt=>[...xt,{phase:Ee.phase,message:Ee.message,timestamp:Date.now()}]);else if(Ie==="done"||Ie==="complete"){const xt={prompt:A.trim(),provider:wt().provider,model:wt().model,reasoning:Ee.reasoning||""};if(j(Ee.name),X(Ee.description),F(Ee.model||""),I(Ee.allowedTools||""),W(Ee.body),H(!0),Nt.current=xt,u("manual"),Ee.suggestedPlugin&&typeof Ee.suggestedPlugin=="object"&&Ee.suggestedPlugin.plugin){const lt=Ee.suggestedPlugin;if(((x==null?void 0:x.detectedLayouts.flatMap(Kt=>Kt.existingPlugins))??[]).includes(lt.plugin))if(B(lt.plugin),lt.layout&&(lt.layout===1||lt.layout===2))k(lt.layout);else{const Kt=x==null?void 0:x.detectedLayouts.find(Hr=>Hr.existingPlugins.includes(lt.plugin));Kt&&(Kt.layout===1||Kt.layout===2)&&k(Kt.layout)}else B("__new__"),G(lt.plugin)}else y===3&&Je&&be(!0);const ha={name:Ee.name,plugin:Qe||"",layout:y,description:Ee.description,model:Ee.model||void 0,allowedTools:Ee.allowedTools||void 0,body:Ee.body,aiMeta:xt};me.saveDraft(ha).then(lt=>{ie(!0),lt!=null&<.dir&&(ee.current=lt.dir)}).catch(()=>{})}else Ie==="error"&&(se(Ee.message||Ee.description||"Unknown error"),Ee.category&&xe(Ee))}catch{}Ie=""}}}catch($e){$e.name!=="AbortError"&&se($e.message)}finally{ue(!1),ft.current=null}},[A,wt,y,Je,Qe,x,P]),ce=p.useCallback(async()=>{if(S(null),!f.trim()){S("Skill name is required");return}if(!D.trim()){S("Description is required");return}if(y!==3&&!Qe.trim()){S("Plugin name is required");return}ne(!0);try{const Se=await me.createSkill({name:bc(f),plugin:Qe||"",layout:y,description:D,model:J||void 0,allowedTools:Y||void 0,body:O,aiMeta:Nt.current||void 0,draftDir:ee.current||void 0});ee.current=null,s(Se.plugin,Se.skill)}catch(Se){S(Se.message)}finally{ne(!1)}},[f,D,y,Qe,J,Y,O,s]),ht=p.useCallback(()=>{Je&&(k(Je.layout),B(Je.plugins[0]),be(!1))},[Je]);return{mode:c,setMode:u,layout:x,layoutLoading:m,selectedLayout:y,setSelectedLayout:k,creatableLayouts:ca,availablePlugins:Ye,pathPreview:ut,plugin:C,setPlugin:B,newPlugin:_,setNewPlugin:G,effectivePlugin:Qe,name:f,setName:j,description:D,setDescription:X,model:J,setModel:F,allowedTools:Y,setAllowedTools:I,body:O,setBody:W,bodyViewMode:M,setBodyViewMode:$,aiPrompt:A,setAiPrompt:le,generating:V,aiGenerated:N,aiError:ae,aiClassifiedError:fe,aiProgress:ye,promptRef:ze,handleGenerate:Tt,handleCancelGenerate:Xt,clearAiError:Fe,targetAgents:P,setTargetAgents:te,draftSaved:re,showPluginRecommendation:he,setShowPluginRecommendation:be,pluginLayoutInfo:Je,applyPluginRecommendation:ht,creating:oe,error:w,handleCreate:ce}}function vp(){return l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function n1(){return l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),l.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function yp({node:s,depth:o=0}){var c;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${o*16}px`,color:s.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[s.type==="dir"?l.jsx(vp,{}):l.jsx(n1,{}),l.jsxs("span",{children:[s.name,s.type==="dir"?"/":""]})]}),(c=s.children)==null?void 0:c.map(u=>l.jsx(yp,{node:u,depth:o+1},u.name))]})}function s1(s,o,c){const u=[];o&&u.push({name:"evals.json",type:"file"}),u.push({name:"history",type:"dir"});const x=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:u}];return c&&x.push({name:"draft.json",type:"file"}),{name:s||"{skill}",type:"dir",children:x}}function r1({skillName:s,hasEvals:o,isDraft:c}){const u=s1(s,o,c);return l.jsxs("div",{className:"glass-card p-4",children:[l.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[l.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:l.jsx(vp,{})}),"Skill Structure"]}),l.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-0)",border:"1px solid var(--border-subtle)"},children:l.jsx(yp,{node:u})})]})}const rl={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function xc({size:s=14,color:o="currentColor"}){return l.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function i1({onCreated:s,onCancel:o}){const c=l1({onCreated:s});return l.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),l.jsx("div",{className:"flex items-center justify-between mt-2",children:l.jsxs("div",{className:"inline-flex rounded-lg p-0.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[l.jsx("button",{onClick:()=>c.setMode("ai"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:c.mode==="ai"?"rgba(168,85,247,0.15)":"transparent",color:c.mode==="ai"?"#a855f7":"var(--text-tertiary)",boxShadow:c.mode==="ai"?"0 1px 3px rgba(168,85,247,0.15)":"none",cursor:"pointer",border:"none"},children:l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx(xc,{size:12}),"AI-Assisted"]})}),l.jsx("button",{onClick:()=>c.setMode("manual"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:c.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:c.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:c.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none",cursor:"pointer",border:"none"},children:"Manual"})]})})]}),c.layoutLoading&&l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),l.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!c.layoutLoading&&c.layout&&c.mode==="ai"&&l.jsxs("div",{className:"space-y-4 animate-fade-in",children:[l.jsxs("div",{className:"glass-card p-4",children:[l.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[l.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:l.jsx(xc,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),l.jsx("textarea",{ref:c.promptRef,value:c.aiPrompt,onChange:u=>c.setAiPrompt(u.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
|
|
70
|
-
|
|
71
|
-
Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:c.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...rl,minHeight:"120px"},onKeyDown:u=>{u.key==="Enter"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),c.handleGenerate())}}),l.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),c.generating&&c.aiProgress.length>0&&l.jsx(xs,{entries:c.aiProgress,isRunning:!0}),c.aiError&&l.jsx("div",{children:c.aiClassifiedError?l.jsx(fs,{error:c.aiClassifiedError,onRetry:c.handleGenerate,onDismiss:c.clearAiError}):l.jsxs("div",{children:[l.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:c.aiError}),l.jsx("button",{onClick:c.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),l.jsxs("div",{className:"flex items-center gap-3",children:[c.generating?l.jsx("button",{onClick:c.handleCancelGenerate,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)",border:"none",cursor:"pointer"},children:"Cancel Generation"}):l.jsxs("button",{onClick:c.handleGenerate,disabled:!c.aiPrompt.trim(),className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:c.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:c.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:c.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[l.jsx(xc,{size:14}),"Generate"]}),l.jsx("button",{onClick:o,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"}),!c.generating&&l.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",l.jsx("button",{onClick:()=>c.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!c.layoutLoading&&c.layout&&c.mode==="manual"&&l.jsxs("div",{className:"space-y-4 animate-fade-in",children:[l.jsxs("div",{className:"glass-card p-4",children:[l.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),c.creatableLayouts.length>1&&l.jsxs("div",{className:"mb-3",children:[l.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),l.jsx("div",{className:"flex gap-2",children:c.creatableLayouts.map(u=>l.jsx("button",{onClick:()=>{c.setSelectedLayout(u.layout),c.setPlugin(u.existingPlugins[0]||""),c.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:c.selectedLayout===u.layout?"var(--accent)":"var(--surface-3)",color:c.selectedLayout===u.layout?"#fff":"var(--text-secondary)",border:`1px solid ${c.selectedLayout===u.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:u.label},u.layout))})]}),c.selectedLayout!==3&&l.jsxs("div",{className:"mb-3",children:[l.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),l.jsxs("select",{value:c.plugin,onChange:u=>{c.setPlugin(u.target.value),c.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:rl,children:[c.availablePlugins.map(u=>l.jsx("option",{value:u,children:u},u)),l.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),c.plugin==="__new__"&&l.jsx("input",{type:"text",value:c.newPlugin,onChange:u=>c.setNewPlugin(bc(u.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:rl})]}),l.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:c.pathPreview})]}),c.showPluginRecommendation&&c.pluginLayoutInfo&&c.selectedLayout===3&&l.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex items-center justify-between gap-3",style:{background:"rgba(59,130,246,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(59,130,246,0.2)"},children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),l.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),l.jsxs("span",{children:["Plugins detected (",l.jsx("strong",{children:c.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),l.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[l.jsx("button",{onClick:c.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),l.jsx("button",{onClick:()=>c.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),l.jsxs("div",{className:"glass-card p-4",children:[l.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),l.jsxs("div",{className:"mb-3",children:[l.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",l.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),l.jsx("input",{type:"text",value:c.name,onChange:u=>c.setName(bc(u.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:rl})]}),l.jsxs("div",{className:"mb-3",children:[l.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",l.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),l.jsx("textarea",{value:c.description,onChange:u=>c.setDescription(u.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...rl,minHeight:"72px"}})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),l.jsxs("select",{value:c.model,onChange:u=>c.setModel(u.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:rl,children:[l.jsx("option",{value:"",children:"Any"}),l.jsx("option",{value:"opus",children:"Opus"}),l.jsx("option",{value:"sonnet",children:"Sonnet"}),l.jsx("option",{value:"haiku",children:"Haiku"})]})]}),l.jsxs("div",{className:"flex-1",children:[l.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),l.jsx("input",{type:"text",value:c.allowedTools,onChange:u=>c.setAllowedTools(u.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:rl})]})]})]}),l.jsxs("div",{className:"glass-card p-4",children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),l.jsx("polyline",{points:"14 2 14 8 20 8"}),l.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),l.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),l.jsxs("div",{children:[l.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),l.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),l.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(u=>l.jsxs("button",{onClick:()=>c.setBodyViewMode(u),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:c.bodyViewMode===u?"var(--surface-4)":"transparent",color:c.bodyViewMode===u?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:c.bodyViewMode===u?600:400,border:"none",cursor:"pointer"},children:[u==="write"?l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("polyline",{points:"16 18 22 12 16 6"}),l.jsx("polyline",{points:"8 6 2 12 8 18"})]}):l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),l.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),l.jsx("span",{children:u==="write"?"Write":"Preview"})]},u))})]}),c.bodyViewMode==="write"?l.jsx("textarea",{value:c.body,onChange:u=>c.setBody(u.target.value),placeholder:`# /my-skill
|
|
72
|
-
|
|
73
|
-
You are an expert at...
|
|
74
|
-
`,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...rl,minHeight:"150px"}}):c.body.trim()?l.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:Or(c.body)}}):l.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},children:l.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),l.jsx(r1,{skillName:c.name||"{skill}",hasEvals:!1,isDraft:c.draftSaved}),c.error&&l.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:c.error}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{onClick:c.handleCreate,disabled:c.creating||!c.name||!c.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:c.creating||!c.name||!c.description?"var(--surface-3)":"var(--accent)",color:c.creating||!c.name||!c.description?"var(--text-tertiary)":"#fff",cursor:c.creating||!c.name||!c.description?"not-allowed":"pointer",border:"none"},children:c.creating?"Creating...":"Create Skill"}),l.jsx("button",{onClick:o,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]})]})]})}function o1(){return l.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:l.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),l.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),l.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function pc({variant:s,message:o,onRetry:c}){const{setMode:u,setSearch:x}=pa(),[v,m]=p.useState(!1);return s==="no-selection"?l.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[l.jsx("div",{className:"mb-5",children:v?l.jsx(o1,{}):l.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>m(!0),style:{objectFit:"contain"}})}),l.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),l.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):s==="no-skills"?l.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[l.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})})}),l.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),l.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",l.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-2)"},children:"--root"})," directory, or create your first skill"]}),l.jsxs("button",{onClick:()=>u("create"),className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:"var(--accent)",color:"#fff",border:"none",cursor:"pointer"},onMouseEnter:b=>{b.currentTarget.style.opacity="0.9"},onMouseLeave:b=>{b.currentTarget.style.opacity="1"},children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),l.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):s==="error"?l.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:l.jsxs("div",{className:"px-5 py-4 rounded-lg text-center max-w-sm",style:{background:"var(--red-muted)",border:"1px solid rgba(248,113,113,0.2)"},children:[l.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:o||"Failed to load skill data"}),c&&l.jsx("button",{onClick:c,className:"px-4 py-2 rounded-lg text-[12px] font-medium",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"none",cursor:"pointer"},children:"Retry"})]})}):l.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[l.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),l.jsx("button",{onClick:()=>x(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function c1(s,o){const[c,u]=s.split(".").map(Number),[x,v]=o.split(".").map(Number);return x>c?"major":v>u?"minor":"patch"}const u1={major:{bg:"var(--red-muted)",text:"var(--red)"},minor:{bg:"var(--yellow-muted)",text:"var(--yellow)"},patch:{bg:"var(--green-muted)",text:"var(--green)"}};function d1(){const[s,o]=p.useState([]),[c,u]=p.useState(!0),[x,v]=p.useState(new Set),[m,b]=p.useState(new Map),[g,f]=p.useState(!1),[j,y]=p.useState(new Set),[k,C]=p.useState(null),[B,_]=p.useState(null),[G,D]=p.useState(!1),X=p.useCallback(async()=>{u(!0);try{const M=await me.getSkillUpdates();o(M.filter($=>$.updateAvailable))}catch{o([])}finally{u(!1)}},[]);p.useEffect(()=>{X()},[X]);const J=p.useMemo(()=>s.filter(M=>!M.pinned),[s]),F=p.useCallback(M=>{v($=>{const P=new Set($);return P.has(M)?P.delete(M):P.add(M),P})},[]),Y=p.useCallback(()=>{x.size===J.length?v(new Set):v(new Set(J.map(M=>M.name)))},[x,J]),I=p.useCallback(()=>{const M=[...x];if(!M.length)return;f(!0),b(new Map(M.map(P=>[P,{skill:P,status:"pending"}])));const $=me.startBatchUpdate(M);$.addEventListener("progress",P=>{try{const te=JSON.parse(P.data);b(oe=>new Map(oe).set(te.skill,te))}catch{}}),$.addEventListener("done",P=>{$.close(),f(!1);try{const te=JSON.parse(P.data);C(`Updated ${te.updated??0} skills, ${te.failed??0} failed`),setTimeout(()=>C(null),5e3)}catch{}X()}),$.addEventListener("error",()=>{$.close(),f(!1),C("Batch update failed"),setTimeout(()=>C(null),5e3)})},[x,X]),O=p.useCallback(M=>{M.name.split("/").pop()||M.name;const $=M.name.split("/"),P=$.length>=3?$[$.length-2]:$[0],te=$[$.length-1];y(ne=>new Set(ne).add(M.name));const oe=me.startSkillUpdate(P,te);oe.addEventListener("done",()=>{oe.close(),y(ne=>{const w=new Set(ne);return w.delete(M.name),w}),X()}),oe.addEventListener("error",()=>{oe.close(),y(ne=>{const w=new Set(ne);return w.delete(M.name),w})})},[X]),W=p.useCallback(async M=>{if(!M.latest)return;const $=M.name.split("/"),P=$.length>=3?$[$.length-2]:$[0],te=$[$.length-1];D(!0);try{const oe=await me.getVersionDiff(P,te,M.installed,M.latest);_({skill:M,diff:oe})}catch{_(null)}finally{D(!1)}},[]);return c?l.jsxs("div",{className:"p-6",children:[l.jsx("div",{className:"skeleton h-6 w-48 mb-4"}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"skeleton h-16 rounded-lg"}),l.jsx("div",{className:"skeleton h-16 rounded-lg"})]})]}):s.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16",children:[l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-4",children:[l.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),l.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),l.jsx("div",{className:"text-[15px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"All skills are up to date"}),l.jsx("div",{className:"text-[12px] mb-4",style:{color:"var(--text-tertiary)"},children:"No updates available for installed skills."}),l.jsx("button",{onClick:X,className:"btn btn-secondary text-[12px]",children:"Refresh"})]}):l.jsxs("div",{className:"p-6",children:[k&&l.jsx("div",{className:"fixed top-4 right-4 z-50 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},children:k}),l.jsxs("div",{className:"flex items-center justify-between mb-5",children:[l.jsxs("div",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["Available Updates (",J.length,")"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:X,className:"btn btn-ghost text-[12px]",disabled:g,children:"Refresh"}),l.jsx("button",{onClick:I,disabled:x.size===0||g,className:"btn btn-primary text-[12px]",children:g?"Updating...":`Update Selected (${x.size})`})]})]}),l.jsx("div",{className:"flex items-center gap-2 mb-3",children:l.jsxs("button",{onClick:Y,className:"flex items-center gap-2 text-[12px] font-medium",style:{color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer"},children:[l.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:x.size===J.length&&J.length>0?"var(--accent)":"var(--border-default)",background:x.size===J.length&&J.length>0?"var(--accent)":"transparent"},children:x.size===J.length&&J.length>0&&l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})})}),"Select All"]})}),l.jsx("div",{className:"space-y-2",children:s.map(M=>{const $=M.name.split("/").pop()||M.name,P=M.latest?c1(M.installed,M.latest):"patch",te=u1[P],oe=!!M.pinned,ne=j.has(M.name),w=m.get(M.name),S=x.has(M.name);return l.jsx("div",{className:"rounded-lg px-4 py-3 transition-all duration-150",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",opacity:oe?.7:1},children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{onClick:()=>!oe&&F(M.name),disabled:oe,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:oe?"not-allowed":"pointer"},children:l.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:S?"var(--accent)":"var(--border-default)",background:S?"var(--accent)":"transparent",opacity:oe?.4:1},children:S&&l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[l.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:$}),oe&&l.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),l.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:te.bg,color:te.text},children:P})]}),l.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[M.installed," → ",M.latest||"?",oe&&` (pinned at ${M.pinnedVersion||M.installed})`]})]}),w&&l.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:w.status==="done"?"var(--green-muted)":w.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:w.status==="done"?"var(--green)":w.status==="error"?"var(--red)":"var(--yellow)"},children:[w.status,w.error&&`: ${w.error}`]}),l.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[l.jsx("button",{onClick:()=>W(M),className:"btn btn-ghost text-[11px]",disabled:G,children:"View Changes"}),l.jsx("button",{onClick:()=>O(M),disabled:oe||ne||g,title:oe?"Pinned — unpin from CLI to update":"",className:`btn ${oe?"btn-ghost":"btn-primary"} text-[11px]`,children:ne?l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(w==null?void 0:w.status)==="done"?l.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},M.name)})}),B&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>_(null),children:l.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:M=>M.stopPropagation(),children:[l.jsx("div",{className:"mb-2 flex justify-end",children:l.jsx("button",{onClick:()=>_(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),l.jsx(hp,{contentDiff:B.diff.contentDiff,fromLabel:B.diff.from,toLabel:B.diff.to,diffSummary:B.diff.diffSummary,renderContext:"inline"})]})})]})}function mc(){const{state:s,setMobileView:o}=pa();return s.isMobile?l.jsxs("button",{onClick:()=>o("list"),className:"flex items-center gap-1.5 px-3 py-2 text-[12px] font-medium",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"none",borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",width:"100%"},children:[l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function f1(){const{state:s,selectSkill:o,setMode:c,refreshSkills:u}=pa(),[x,v]=p.useState(window.location.hash);if(p.useEffect(()=>{const f=()=>v(window.location.hash);return window.addEventListener("hashchange",f),()=>window.removeEventListener("hashchange",f)},[]),x==="#/updates")return l.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[l.jsx(mc,{}),l.jsx(d1,{})]});if(s.mode==="create")return l.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[l.jsx(mc,{}),l.jsx(i1,{onCreated:(f,j)=>{c("browse"),u(),o({plugin:f,skill:j,origin:"source"})},onCancel:()=>c("browse")})]});if(!s.selectedSkill)return s.skillsError?l.jsx(pc,{variant:"error",message:s.skillsError,onRetry:u}):!s.skillsLoading&&s.skills.length===0?l.jsx(pc,{variant:"no-skills"}):l.jsx(pc,{variant:"no-selection"});const{plugin:m,skill:b,origin:g}=s.selectedSkill;return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsx(mc,{}),l.jsx("div",{className:"flex-1 overflow-hidden",children:l.jsx(fv,{plugin:m,skill:b,origin:g,children:l.jsx(e1,{})},`${m}/${b}`)})]})}function x1(){const{updateCount:s,state:o,dismissUpdateNotification:c}=pa(),u=s>0&&!o.updateNotificationDismissed;return p.useEffect(()=>{if(!u)return;const x=setTimeout(()=>c(),1e4);return()=>clearTimeout(x)},[u,c]),u?l.jsxs("div",{className:"fixed bottom-4 right-4 z-50 flex items-center gap-3 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow)",color:"var(--text-primary)"},children:[l.jsxs("span",{children:[s," update",s===1?"":"s"," available"]}),l.jsx("button",{onClick:()=>{window.location.hash="#/updates"},className:"px-2 py-0.5 rounded text-[12px] font-semibold",style:{background:"var(--yellow)",color:"var(--surface-0)",border:"none",cursor:"pointer"},children:"View Updates"}),l.jsx("button",{onClick:c,className:"text-[14px] leading-none",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px"},"aria-label":"Dismiss",children:"✕"})]}):null}function p1(){return l.jsx(Zh,{children:l.jsxs(Qh,{children:[l.jsx(Jh,{left:l.jsx(lv,{}),right:l.jsx(f1,{})}),l.jsx(x1,{})]})})}Vh.createRoot(document.getElementById("root")).render(l.jsx(p.StrictMode,{children:l.jsx(p1,{})}));
|